Files
hassos_config/www/community/lovelace-auto-entities/auto-entities.js
2026-03-26 12:10:21 +01:00

2 lines
95 KiB
JavaScript

var t,e,n,r,i,o,a,s,u,c,l,d,f,h,p,v,y,m,g,b,_,w,x,k,$,E,A,O,S,C;function P(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function j(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function T(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?j(Object(n),!0).forEach((function(e){U(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function U(t,e,n){return(e=tt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function N(t,e,n,r){var i=M(V(1&r?t.prototype:t),e,n);return 2&r&&"function"==typeof i?function(t){return i.apply(n,t)}:i}function M(){return M="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=V(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},M.apply(null,arguments)}function R(t){return function(t){if(Array.isArray(t))return Y(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||K(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(t,e)||K(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(){I=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,n){return t[e]=n}}function l(t,e,n,r){var o=e&&e.prototype instanceof m?e:m,a=Object.create(o.prototype),s=new P(r||[]);return i(a,"_invoke",{value:A(t,n,s)}),a}function d(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var f="suspendedStart",h="suspendedYield",p="executing",v="completed",y={};function m(){}function g(){}function b(){}var _={};c(_,a,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(j([])));x&&x!==n&&r.call(x,a)&&(_=x);var k=b.prototype=m.prototype=Object.create(_);function $(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function n(i,o,a,s){var u=d(t[i],t,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==et(l)&&r.call(l,"__await")?e.resolve(l.__await).then((function(t){n("next",t,a,s)}),(function(t){n("throw",t,a,s)})):e.resolve(l).then((function(t){c.value=t,a(c)}),(function(t){return n("throw",t,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(t,r){function i(){return new e((function(e,i){n(t,r,e,i)}))}return o=o?o.then(i,i):i()}})}function A(e,n,r){var i=f;return function(o,a){if(i===p)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:t,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=O(s,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===f)throw i=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=p;var c=d(e,n,r);if("normal"===c.type){if(i=r.done?v:h,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=v,r.method="throw",r.arg=c.arg)}}}function O(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,O(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=d(i,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function S(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function j(e){if(e||""===e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return o.next=o}}throw new TypeError(et(e)+" is not iterable")}return g.prototype=b,i(k,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:g,configurable:!0}),g.displayName=c(b,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,c(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},$(E.prototype),c(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,n,r,i,o){void 0===o&&(o=Promise);var a=new E(l(t,n,r,i),o);return e.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},$(k),c(k,u,"Generator"),c(k,a,(function(){return this})),c(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=j,P.prototype={constructor:P,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),y}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:j(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function F(t,e,n,r,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void n(t)}s.done?e(u):Promise.resolve(u).then(r,i)}function D(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function a(t){F(o,r,i,a,s,"next",t)}function s(t){F(o,r,i,a,s,"throw",t)}a(void 0)}))}}function H(t,e,n){return e=V(e),function(t,e){if(e&&("object"==et(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return W(t)}(t,B()?Reflect.construct(e,n||[],V(t).constructor):e.apply(t,n))}function W(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function q(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&z(t,e)}function G(t){var e="function"==typeof Map?new Map:void 0;return G=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return function(t,e,n){if(B())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,e);var i=new(t.bind.apply(t,r));return n&&z(i,n.prototype),i}(t,arguments,V(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),z(n,t)},G(t)}function B(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(B=function(){return!!t})()}function z(t,e){return z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},z(t,e)}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},V(t)}function J(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=K(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function K(t,e){if(t){if("string"==typeof t)return Y(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Y(t,e):void 0}}function Y(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function Z(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Q(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,tt(r.key),r)}}function X(t,e,n){return e&&Q(t.prototype,e),n&&Q(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function tt(t){var e=function(t,e){if("object"!=et(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=et(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==et(e)?e:e+""}function et(t){return et="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},et(t)}function nt(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===("undefined"==typeof Reflect?"undefined":et(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}"function"==typeof SuppressedError&&SuppressedError;var rt=globalThis,it=rt.ShadowRoot&&(void 0===rt.ShadyCSS||rt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ot=Symbol(),at=new WeakMap,st=function(){return X((function t(e,n,r){if(Z(this,t),this._$cssResult$=!0,r!==ot)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=n}),[{key:"styleSheet",get:function(){var t=this.o,e=this.t;if(it&&void 0===t){var n=void 0!==e&&1===e.length;n&&(t=at.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&at.set(e,t))}return t}},{key:"toString",value:function(){return this.cssText}}])}(),ut=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=1===t.length?t[0]:n.reduce((function(e,n,r){return e+function(t){if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")}(n)+t[r+1]}),t[0]);return new st(i,t,ot)},ct=it?function(t){return t}:function(t){return t instanceof CSSStyleSheet?function(t){var e,n="",r=J(t.cssRules);try{for(r.s();!(e=r.n()).done;){n+=e.value.cssText}}catch(t){r.e(t)}finally{r.f()}return function(t){return new st("string"==typeof t?t:t+"",void 0,ot)}(n)}(t):t},lt=Object.is,dt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,ht=Object.getOwnPropertyNames,pt=Object.getOwnPropertySymbols,vt=Object.getPrototypeOf,yt=globalThis,mt=yt.trustedTypes,gt=mt?mt.emptyScript:"",bt=yt.reactiveElementPolyfillSupport,_t=function(t,e){return t},wt={toAttribute:function(t,e){switch(e){case Boolean:t=t?gt:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute:function(t,e){var n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},xt=function(t,e){return!lt(t,e)},kt={attribute:!0,type:String,converter:wt,reflect:!1,hasChanged:xt};null!==(t=Symbol.metadata)&&void 0!==t||(Symbol.metadata=Symbol("metadata")),null!==(e=yt.litPropertyMetadata)&&void 0!==e||(yt.litPropertyMetadata=new WeakMap);var $t=function(){function t(){var e;return Z(this,t),(e=H(this,t))._$Ep=void 0,e.isUpdatePending=!1,e.hasUpdated=!1,e._$Em=null,e._$Ev(),e}return q(t,G(HTMLElement)),X(t,[{key:"_$Ev",value:function(){var t,e=this;this._$ES=new Promise((function(t){return e.enableUpdating=t})),this._$AL=new Map,this._$E_(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((function(t){return t(e)}))}},{key:"addController",value:function(t){var e,n;(null!==(e=this._$EO)&&void 0!==e?e:this._$EO=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&(null===(n=t.hostConnected)||void 0===n||n.call(t))}},{key:"removeController",value:function(t){var e;null===(e=this._$EO)||void 0===e||e.delete(t)}},{key:"_$E_",value:function(){var t,e=new Map,n=J(this.constructor.elementProperties.keys());try{for(n.s();!(t=n.n()).done;){var r=t.value;this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r])}}catch(t){n.e(t)}finally{n.f()}e.size>0&&(this._$Ep=e)}},{key:"createRenderRoot",value:function(){var t,e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return function(t,e){if(it)t.adoptedStyleSheets=e.map((function(t){return t instanceof CSSStyleSheet?t:t.styleSheet}));else{var n,r=J(e);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=document.createElement("style"),a=rt.litNonce;void 0!==a&&o.setAttribute("nonce",a),o.textContent=i.cssText,t.appendChild(o)}}catch(t){r.e(t)}finally{r.f()}}}(e,this.constructor.elementStyles),e}},{key:"connectedCallback",value:function(){var t,e;null!==(t=this.renderRoot)&&void 0!==t||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$EO)||void 0===e||e.forEach((function(t){var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}},{key:"enableUpdating",value:function(t){}},{key:"disconnectedCallback",value:function(){var t;null===(t=this._$EO)||void 0===t||t.forEach((function(t){var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}},{key:"attributeChangedCallback",value:function(t,e,n){this._$AK(t,n)}},{key:"_$EC",value:function(t,e){var n=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,n);if(void 0!==r&&!0===n.reflect){var i,o=(void 0!==(null===(i=n.converter)||void 0===i?void 0:i.toAttribute)?n.converter:wt).toAttribute(e,n.type);this._$Em=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}},{key:"_$AK",value:function(t,e){var n=this.constructor,r=n._$Eh.get(t);if(void 0!==r&&this._$Em!==r){var i,o=n.getPropertyOptions(r),a="function"==typeof o.converter?{fromAttribute:o.converter}:void 0!==(null===(i=o.converter)||void 0===i?void 0:i.fromAttribute)?o.converter:wt;this._$Em=r,this[r]=a.fromAttribute(e,o.type),this._$Em=null}}},{key:"requestUpdate",value:function(t,e,n){if(void 0!==t){var r;if(null!=n||(n=this.constructor.getPropertyOptions(t)),!(null!==(r=n.hasChanged)&&void 0!==r?r:xt)(this[t],e))return;this.P(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}},{key:"P",value:function(t,e,n){var r;this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Em!==t&&(null!==(r=this._$Ej)&&void 0!==r?r:this._$Ej=new Set).add(t)}},{key:"_$ET",value:(e=D(I().mark((function t(){var e;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isUpdatePending=!0,t.prev=1,t.next=4,this._$ES;case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),Promise.reject(t.t0);case 9:if(e=this.scheduleUpdate(),t.t1=null!=e,!t.t1){t.next=14;break}return t.next=14,e;case 14:return t.abrupt("return",!this.isUpdatePending);case 15:case"end":return t.stop()}}),t,this,[[1,6]])}))),function(){return e.apply(this,arguments)})},{key:"scheduleUpdate",value:function(){return this.performUpdate()}},{key:"performUpdate",value:function(){if(this.isUpdatePending){if(!this.hasUpdated){var t;if(null!==(t=this.renderRoot)&&void 0!==t||(this.renderRoot=this.createRenderRoot()),this._$Ep){var e,n=J(this._$Ep);try{for(n.s();!(e=n.n()).done;){var r=L(e.value,2),i=r[0],o=r[1];this[i]=o}}catch(t){n.e(t)}finally{n.f()}this._$Ep=void 0}var a=this.constructor.elementProperties;if(a.size>0){var s,u=J(a);try{for(u.s();!(s=u.n()).done;){var c=L(s.value,2),l=c[0],d=c[1];!0!==d.wrapped||this._$AL.has(l)||void 0===this[l]||this.P(l,this[l],d)}}catch(t){u.e(t)}finally{u.f()}}}var f=!1,h=this._$AL;try{var p;(f=this.shouldUpdate(h))?(this.willUpdate(h),null!==(p=this._$EO)&&void 0!==p&&p.forEach((function(t){var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(h)):this._$EU()}catch(h){throw f=!1,this._$EU(),h}f&&this._$AE(h)}}},{key:"willUpdate",value:function(t){}},{key:"_$AE",value:function(t){var e;null!==(e=this._$EO)&&void 0!==e&&e.forEach((function(t){var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}},{key:"_$EU",value:function(){this._$AL=new Map,this.isUpdatePending=!1}},{key:"updateComplete",get:function(){return this.getUpdateComplete()}},{key:"getUpdateComplete",value:function(){return this._$ES}},{key:"shouldUpdate",value:function(t){return!0}},{key:"update",value:function(t){var e=this;this._$Ej&&(this._$Ej=this._$Ej.forEach((function(t){return e._$EC(t,e[t])}))),this._$EU()}},{key:"updated",value:function(t){}},{key:"firstUpdated",value:function(t){}}],[{key:"addInitializer",value:function(t){var e;this._$Ei(),(null!==(e=this.l)&&void 0!==e?e:this.l=[]).push(t)}},{key:"observedAttributes",get:function(){return this.finalize(),this._$Eh&&R(this._$Eh.keys())}},{key:"createProperty",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:kt;if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){var n=Symbol(),r=this.getPropertyDescriptor(t,n,e);void 0!==r&&dt(this.prototype,t,r)}}},{key:"getPropertyDescriptor",value:function(t,e,n){var r,i=null!==(r=ft(this.prototype,t))&&void 0!==r?r:{get:function(){return this[e]},set:function(t){this[e]=t}},o=i.get,a=i.set;return{get:function(){return null==o?void 0:o.call(this)},set:function(e){var r=null==o?void 0:o.call(this);a.call(this,e),this.requestUpdate(t,r,n)},configurable:!0,enumerable:!0}}},{key:"getPropertyOptions",value:function(t){var e;return null!==(e=this.elementProperties.get(t))&&void 0!==e?e:kt}},{key:"_$Ei",value:function(){if(!this.hasOwnProperty(_t("elementProperties"))){var t=vt(this);t.finalize(),void 0!==t.l&&(this.l=R(t.l)),this.elementProperties=new Map(t.elementProperties)}}},{key:"finalize",value:function(){if(!this.hasOwnProperty(_t("finalized"))){if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_t("properties"))){var t,e=this.properties,n=J([].concat(R(ht(e)),R(pt(e))));try{for(n.s();!(t=n.n()).done;){var r=t.value;this.createProperty(r,e[r])}}catch(t){n.e(t)}finally{n.f()}}var i=this[Symbol.metadata];if(null!==i){var o=litPropertyMetadata.get(i);if(void 0!==o){var a,s=J(o);try{for(s.s();!(a=s.n()).done;){var u=L(a.value,2),c=u[0],l=u[1];this.elementProperties.set(c,l)}}catch(t){s.e(t)}finally{s.f()}}}this._$Eh=new Map;var d,f=J(this.elementProperties);try{for(f.s();!(d=f.n()).done;){var h=L(d.value,2),p=h[0],v=h[1],y=this._$Eu(p,v);void 0!==y&&this._$Eh.set(y,p)}}catch(t){f.e(t)}finally{f.f()}this.elementStyles=this.finalizeStyles(this.styles)}}},{key:"finalizeStyles",value:function(t){var e=[];if(Array.isArray(t)){var n,r=J(new Set(t.flat(1/0).reverse()));try{for(r.s();!(n=r.n()).done;){var i=n.value;e.unshift(ct(i))}}catch(t){r.e(t)}finally{r.f()}}else void 0!==t&&e.push(ct(t));return e}},{key:"_$Eu",value:function(t,e){var n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}}]);var e}();$t.elementStyles=[],$t.shadowRootOptions={mode:"open"},$t[_t("elementProperties")]=new Map,$t[_t("finalized")]=new Map,null!=bt&&bt({ReactiveElement:$t}),(null!==(n=yt.reactiveElementVersions)&&void 0!==n?n:yt.reactiveElementVersions=[]).push("2.0.4");var Et=globalThis,At=Et.trustedTypes,Ot=At?At.createPolicy("lit-html",{createHTML:function(t){return t}}):void 0,St="$lit$",Ct="lit$".concat(Math.random().toFixed(9).slice(2),"$"),Pt="?"+Ct,jt="<".concat(Pt,">"),Tt=document,Ut=function(){return Tt.createComment("")},Nt=function(t){return null===t||"object"!=et(t)&&"function"!=typeof t},Mt=Array.isArray,Rt="[ \t\n\f\r]",Lt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,It=/-->/g,Ft=/>/g,Dt=RegExp(">|".concat(Rt,"(?:([^\\s\"'>=/]+)(").concat(Rt,"*=").concat(Rt,"*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)"),"g"),Ht=/'/g,Wt=/"/g,qt=/^(?:script|style|textarea|title)$/i,Gt=function(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return{_$litType$:t,strings:e,values:r}}}(1),Bt=Symbol.for("lit-noChange"),zt=Symbol.for("lit-nothing"),Vt=new WeakMap,Jt=Tt.createTreeWalker(Tt,129);function Kt(t,e){if(!Mt(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==Ot?Ot.createHTML(e):e}var Yt=function(t,e){for(var n,r=t.length-1,i=[],o=2===e?"<svg>":3===e?"<math>":"",a=Lt,s=0;s<r;s++){for(var u=t[s],c=void 0,l=void 0,d=-1,f=0;f<u.length&&(a.lastIndex=f,null!==(l=a.exec(u)));)f=a.lastIndex,a===Lt?"!--"===l[1]?a=It:void 0!==l[1]?a=Ft:void 0!==l[2]?(qt.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=Dt):void 0!==l[3]&&(a=Dt):a===Dt?">"===l[0]?(a=null!=n?n:Lt,d=-1):void 0===l[1]?d=-2:(d=a.lastIndex-l[2].length,c=l[1],a=void 0===l[3]?Dt:'"'===l[3]?Wt:Ht):a===Wt||a===Ht?a=Dt:a===It||a===Ft?a=Lt:(a=Dt,n=void 0);var h=a===Dt&&t[s+1].startsWith("/>")?" ":"";o+=a===Lt?u+jt:d>=0?(i.push(c),u.slice(0,d)+St+u.slice(d)+Ct+h):u+Ct+(-2===d?s:h)}return[Kt(t,o+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]},Zt=function(){return X((function t(e,n){var r,i=e.strings,o=e._$litType$;Z(this,t),this.parts=[];var a=0,s=0,u=i.length-1,c=this.parts,l=L(Yt(i,o),2),d=l[0],f=l[1];if(this.el=t.createElement(d,n),Jt.currentNode=this.el.content,2===o||3===o){var h=this.el.content.firstChild;h.replaceWith.apply(h,R(h.childNodes))}for(;null!==(r=Jt.nextNode())&&c.length<u;){if(1===r.nodeType){if(r.hasAttributes()){var p,v=J(r.getAttributeNames());try{for(v.s();!(p=v.n()).done;){var y=p.value;if(y.endsWith(St)){var m=f[s++],g=r.getAttribute(y).split(Ct),b=/([.?@])?(.*)/.exec(m);c.push({type:1,index:a,name:b[2],strings:g,ctor:"."===b[1]?ne:"?"===b[1]?re:"@"===b[1]?ie:ee}),r.removeAttribute(y)}else y.startsWith(Ct)&&(c.push({type:6,index:a}),r.removeAttribute(y))}}catch(t){v.e(t)}finally{v.f()}}if(qt.test(r.tagName)){var _=r.textContent.split(Ct),w=_.length-1;if(w>0){r.textContent=At?At.emptyScript:"";for(var x=0;x<w;x++)r.append(_[x],Ut()),Jt.nextNode(),c.push({type:2,index:++a});r.append(_[w],Ut())}}}else if(8===r.nodeType)if(r.data===Pt)c.push({type:2,index:a});else for(var k=-1;-1!==(k=r.data.indexOf(Ct,k+1));)c.push({type:7,index:a}),k+=Ct.length-1;a++}}),null,[{key:"createElement",value:function(t,e){var n=Tt.createElement("template");return n.innerHTML=t,n}}])}();function Qt(t,e){var n,r,i,o,a,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,u=arguments.length>3?arguments[3]:void 0;if(e===Bt)return e;var c=void 0!==u?null===(n=s._$Co)||void 0===n?void 0:n[u]:s._$Cl,l=Nt(e)?void 0:e._$litDirective$;return(null===(r=c)||void 0===r?void 0:r.constructor)!==l&&(null!==(i=c)&&void 0!==i&&null!==(o=i._$AO)&&void 0!==o&&o.call(i,!1),void 0===l?c=void 0:(c=new l(t))._$AT(t,s,u),void 0!==u?(null!==(a=s._$Co)&&void 0!==a?a:s._$Co=[])[u]=c:s._$Cl=c),void 0!==c&&(e=Qt(t,c._$AS(t,e.values),c,u)),e}var Xt=function(){return X((function t(e,n){Z(this,t),this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=n}),[{key:"parentNode",get:function(){return this._$AM.parentNode}},{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"u",value:function(t){var e,n=this._$AD,r=n.el.content,i=n.parts,o=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:Tt).importNode(r,!0);Jt.currentNode=o;for(var a=Jt.nextNode(),s=0,u=0,c=i[0];void 0!==c;){var l;if(s===c.index){var d=void 0;2===c.type?d=new te(a,a.nextSibling,this,t):1===c.type?d=new c.ctor(a,c.name,c.strings,this,t):6===c.type&&(d=new oe(a,this,t)),this._$AV.push(d),c=i[++u]}s!==(null===(l=c)||void 0===l?void 0:l.index)&&(a=Jt.nextNode(),s++)}return Jt.currentNode=Tt,o}},{key:"p",value:function(t){var e,n=0,r=J(this._$AV);try{for(r.s();!(e=r.n()).done;){var i=e.value;void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,n),n+=i.strings.length-2):i._$AI(t[n])),n++}}catch(t){r.e(t)}finally{r.f()}}}])}(),te=function(){function t(e,n,r,i){var o;Z(this,t),this.type=2,this._$AH=zt,this._$AN=void 0,this._$AA=e,this._$AB=n,this._$AM=r,this.options=i,this._$Cv=null===(o=null==i?void 0:i.isConnected)||void 0===o||o}return X(t,[{key:"_$AU",get:function(){var t,e;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cv}},{key:"parentNode",get:function(){var t,e=this._$AA.parentNode,n=this._$AM;return void 0!==n&&11===(null===(t=e)||void 0===t?void 0:t.nodeType)&&(e=n.parentNode),e}},{key:"startNode",get:function(){return this._$AA}},{key:"endNode",get:function(){return this._$AB}},{key:"_$AI",value:function(t){t=Qt(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),Nt(t)?t===zt||null==t||""===t?(this._$AH!==zt&&this._$AR(),this._$AH=zt):t!==this._$AH&&t!==Bt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):function(t){return Mt(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator])}(t)?this.k(t):this._(t)}},{key:"O",value:function(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}},{key:"T",value:function(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}},{key:"_",value:function(t){this._$AH!==zt&&Nt(this._$AH)?this._$AA.nextSibling.data=t:this.T(Tt.createTextNode(t)),this._$AH=t}},{key:"$",value:function(t){var e,n=t.values,r=t._$litType$,i="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=Zt.createElement(Kt(r.h,r.h[0]),this.options)),r);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===i)this._$AH.p(n);else{var o=new Xt(i,this),a=o.u(this.options);o.p(n),this.T(a),this._$AH=o}}},{key:"_$AC",value:function(t){var e=Vt.get(t.strings);return void 0===e&&Vt.set(t.strings,e=new Zt(t)),e}},{key:"k",value:function(e){Mt(this._$AH)||(this._$AH=[],this._$AR());var n,r,i=this._$AH,o=0,a=J(e);try{for(a.s();!(r=a.n()).done;){var s=r.value;o===i.length?i.push(n=new t(this.O(Ut()),this.O(Ut()),this,this.options)):n=i[o],n._$AI(s),o++}}catch(t){a.e(t)}finally{a.f()}o<i.length&&(this._$AR(n&&n._$AB.nextSibling,o),i.length=o)}},{key:"_$AR",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,e=arguments.length>1?arguments[1]:void 0;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,e);t&&t!==this._$AB;){var n,r=t.nextSibling;t.remove(),t=r}}},{key:"setConnected",value:function(t){var e;void 0===this._$AM&&(this._$Cv=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}])}(),ee=function(){return X((function t(e,n,r,i,o){Z(this,t),this.type=1,this._$AH=zt,this._$AN=void 0,this.element=e,this.name=n,this._$AM=i,this.options=o,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=zt}),[{key:"tagName",get:function(){return this.element.tagName}},{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AI",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=this.strings,o=!1;if(void 0===i)t=Qt(this,t,e,0),(o=!Nt(t)||t!==this._$AH&&t!==Bt)&&(this._$AH=t);else{var a,s,u=t;for(t=i[0],a=0;a<i.length-1;a++)(s=Qt(this,u[n+a],e,a))===Bt&&(s=this._$AH[a]),o||(o=!Nt(s)||s!==this._$AH[a]),s===zt?t=zt:t!==zt&&(t+=(null!=s?s:"")+i[a+1]),this._$AH[a]=s}o&&!r&&this.j(t)}},{key:"j",value:function(t){t===zt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}])}(),ne=function(){function t(){var e;return Z(this,t),(e=H(this,t,arguments)).type=3,e}return q(t,ee),X(t,[{key:"j",value:function(t){this.element[this.name]=t===zt?void 0:t}}])}(),re=function(){function t(){var e;return Z(this,t),(e=H(this,t,arguments)).type=4,e}return q(t,ee),X(t,[{key:"j",value:function(t){this.element.toggleAttribute(this.name,!!t&&t!==zt)}}])}(),ie=function(){function t(e,n,r,i,o){var a;return Z(this,t),(a=H(this,t,[e,n,r,i,o])).type=5,a}return q(t,ee),X(t,[{key:"_$AI",value:function(t){var e;if((t=null!==(e=Qt(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,0))&&void 0!==e?e:zt)!==Bt){var n=this._$AH,r=t===zt&&n!==zt||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,i=t!==zt&&(n===zt||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}}},{key:"handleEvent",value:function(t){var e,n;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(n=this.options)||void 0===n?void 0:n.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}])}(),oe=function(){return X((function t(e,n,r){Z(this,t),this.element=e,this.type=6,this._$AN=void 0,this._$AM=n,this.options=r}),[{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AI",value:function(t){Qt(this,t)}}])}(),ae=Et.litHtmlPolyfillSupport;null!=ae&&ae(Zt,te),(null!==(r=Et.litHtmlVersions)&&void 0!==r?r:Et.litHtmlVersions=[]).push("3.2.1");var se=function(){function t(){var e;return Z(this,t),(e=H(this,t,arguments)).renderOptions={host:W(e)},e._$Do=void 0,e}return q(t,$t),X(t,[{key:"createRenderRoot",value:function(){var e,n,r=N(t,"createRenderRoot",this,3)([]);return null!==(n=(e=this.renderOptions).renderBefore)&&void 0!==n||(e.renderBefore=r.firstChild),r}},{key:"update",value:function(e){var n=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),N(t,"update",this,3)([e]),this._$Do=function(t,e,n){var r,i=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:e,o=i._$litPart$;if(void 0===o){var a,s=null!==(a=null==n?void 0:n.renderBefore)&&void 0!==a?a:null;i._$litPart$=o=new te(e.insertBefore(Ut(),s),s,void 0,null!=n?n:{})}return o._$AI(t),o}(n,this.renderRoot,this.renderOptions)}},{key:"connectedCallback",value:function(){var e;N(t,"connectedCallback",this,3)([]),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}},{key:"disconnectedCallback",value:function(){var e;N(t,"disconnectedCallback",this,3)([]),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}},{key:"render",value:function(){return Bt}}])}();se._$litElement$=!0,se.finalized=!0,null===(i=globalThis.litElementHydrateSupport)||void 0===i||i.call(globalThis,{LitElement:se});var ue=globalThis.litElementPolyfillSupport;null==ue||ue({LitElement:se}),(null!==(o=globalThis.litElementVersions)&&void 0!==o?o:globalThis.litElementVersions=[]).push("4.1.1");var ce={attribute:!0,type:String,converter:wt,reflect:!1,hasChanged:xt},le=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ce,e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=n.kind,i=n.metadata,o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),o.set(n.name,t),"accessor"===r){var a=n.name;return{set:function(n){var r=e.get.call(this);e.set.call(this,n),this.requestUpdate(a,r,t)},init:function(e){return void 0!==e&&this.P(a,void 0,t),e}}}if("setter"===r){var s=n.name;return function(n){var r=this[s];e.call(this,n),this.requestUpdate(s,r,t)}}throw Error("Unsupported decorator location: "+r)};function de(t){return function(e,n){return"object"==et(n)?le(t,e,n):function(t,e,n){var r=e.hasOwnProperty(n);return e.constructor.createProperty(n,r?T(T({},t),{},{wrapped:!0}):t),r?Object.getOwnPropertyDescriptor(e,n):void 0}(t,e,n)}}function fe(t){return de(T(T({},t),{},{state:!0,attribute:!1}))}function he(){return pe.apply(this,arguments)}function pe(){return pe=D(I().mark((function t(){var e;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.race([customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")]);case 2:e=customElements.get("home-assistant")?"home-assistant":"hc-main";case 3:if(document.querySelector(e)){t.next=8;break}return t.next=6,new Promise((function(t){return window.setTimeout(t,100)}));case 6:t.next=3;break;case 8:return t.abrupt("return",document.querySelector(e));case 9:case"end":return t.stop()}}),t)}))),pe.apply(this,arguments)}function ve(){return ye.apply(this,arguments)}function ye(){return ye=D(I().mark((function t(){var e;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,he();case 2:e=t.sent;case 3:if(e.hass){t.next=8;break}return t.next=6,new Promise((function(t){return window.setTimeout(t,100)}));case 6:t.next=3;break;case 8:return t.abrupt("return",e.hass);case 9:case"end":return t.stop()}}),t)}))),ye.apply(this,arguments)}var me="browser_mod-browser-id";window.cardMod_template_cache=window.cardMod_template_cache||{};var ge,be=window.cardMod_template_cache;function _e(t,e){var n=be[t];n&&(n.value=e.result,n.callbacks.forEach((function(t){return t(e.result)})))}function we(t){return!!t&&(String(t).includes("{%")||String(t).includes("{{"))}function xe(t,e,n){return ke.apply(this,arguments)}function ke(){return ke=D(I().mark((function t(e,n,r){var i,o,a,s;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,ve();case 2:i=t.sent,o=i.connection,a=JSON.stringify([n,r]),(s=be[a])?(s.callbacks.has(e)||$e(e),e(s.value),s.callbacks.add(e)):($e(e),e(""),r=Object.assign({user:i.user.name,browser:document.querySelector("hc-main")?"CAST":localStorage[me]?localStorage[me]:"",hash:location.hash.substr(1)||""},r),be[a]=s={template:n,variables:r,value:"",callbacks:new Set([e]),unsubscribe:o.subscribeMessage((function(t){return _e(a,t)}),{type:"render_template",template:n,variables:r})});case 7:case"end":return t.stop()}}),t)}))),ke.apply(this,arguments)}function $e(t){return Ee.apply(this,arguments)}function Ee(){return(Ee=D(I().mark((function t(e){var n,r,i,o,a,s;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0,i=Object.entries(be);case 1:if(!(r<i.length)){t.next=10;break}if(o=L(i[r],2),a=o[0],!(s=o[1]).callbacks.has(e)){t.next=7;break}return s.callbacks.delete(e),0==s.callbacks.size&&(n=s.unsubscribe,delete be[a]),t.abrupt("break",10);case 7:r++,t.next=1;break;case 10:if(!n){t.next=16;break}return t.next=13,n;case 13:return t.t0=t.sent,t.next=16,(0,t.t0)();case 16:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var Ae=function(){var t=D(I().mark((function t(){var e,n,r,i;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!customElements.get("ha-form")){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,null===(n=(e=window).loadCardHelpers)||void 0===n?void 0:n.call(e);case 4:if(r=t.sent){t.next=7;break}return t.abrupt("return");case 7:return t.next=9,r.createCardElement({type:"entity"});case 9:if(i=t.sent){t.next=12;break}return t.abrupt("return");case 12:return t.next=14,i.getConfigElement();case 14:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),Oe=function(t,e){if(t===e)return!0;if(et(t)!==et(e))return!1;if(!(t instanceof Object&&e instanceof Object))return!1;for(var n in t)if(t.hasOwnProperty(n)){if(!e.hasOwnProperty(n))return!1;if(t[n]!==e[n]){if("object"!==et(t[n]))return!1;if(!Oe(t[n],e[n]))return!1}}for(var r in e)if(e.hasOwnProperty(r)&&!t.hasOwnProperty(r))return!1;return!0};window.autoEntities_cache=null!==(ge=window.autoEntities_cache)&&void 0!==ge?ge:{};var Se=window.autoEntities_cache;function Ce(t){var e;return Se.areas=null!==(e=Se.areas)&&void 0!==e?e:t.callWS({type:"config/area_registry/list"}),Se.areas}function Pe(t){var e;return Se.floors=null!==(e=Se.floors)&&void 0!==e?e:t.callWS({type:"config/floor_registry/list"}),Se.floors}function je(t){var e;return Se.devices=null!==(e=Se.devices)&&void 0!==e?e:t.callWS({type:"config/device_registry/list"}),Se.devices}function Te(t){var e;return Se.entities=null!==(e=Se.entities)&&void 0!==e?e:t.callWS({type:"config/entity_registry/list"}),Se.entities}function Ue(t){var e;return Se.labels=null!==(e=Se.labels)&&void 0!==e?e:t.callWS({type:"config/label_registry/list"}),Se.labels}var Ne=/([mhd])\s+ago\s*$/i;function Me(t){return Re.apply(this,arguments)}function Re(){return Re=D(I().mark((function t(e){var n,r,i,o,a,s,u,c,l,d,f,h,p;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=[],r=[],"string"==typeof e?(e.startsWith("$$")&&(e=e.substring(2),r.push(JSON.stringify)),(e.startsWith("/")&&e.endsWith("/")||-1!==e.indexOf("*"))&&(e.startsWith("/")||(e=e.replace(/\./g,".").replace(/\*/g,".*"),e="/^".concat(e,"$/")),i=new RegExp(e.slice(1,-1)),n.push((function(t){return"string"==typeof t&&i.test(t)}))),(o=Ne.exec(e))&&(e=e.replace(o[0],""),a=(new Date).getTime(),r.push((function(t){var e=new Date(t).getTime(),n=(a-e)/6e4,r=o[1];return"h"===r?n/60:"d"===r?n/60/24:n}))),e.startsWith("<=")&&(s=parseFloat(e.substring(2)),n.push((function(t){return parseFloat(t)<=s}))),e.startsWith(">=")&&(u=parseFloat(e.substring(2)),n.push((function(t){return parseFloat(t)>=u}))),e.startsWith("==")&&(c=parseFloat(e.substring(2)),n.push((function(t){return parseFloat(t)==c}))),e.startsWith("!=")&&(l=parseFloat(e.substring(2)),n.push((function(t){return parseFloat(t)!=l}))),e.startsWith("<")&&(d=parseFloat(e.substring(1)),n.push((function(t){return parseFloat(t)<d}))),e.startsWith(">")&&(f=parseFloat(e.substring(1)),n.push((function(t){return parseFloat(t)>f}))),e.startsWith("!")&&(h=parseFloat(e.substring(1)),n.push((function(t){return parseFloat(t)!=h}))),e.startsWith("=")&&(p=parseFloat(e.substring(1)),n.push((function(t){return parseFloat(t)==p}))),n.push((function(t){return t===e}))):n.push((function(t){return t===e})),t.abrupt("return",(function(t){var e=r.reduce((function(t,e){return e(t)}),t);return void 0!==e&&n.some((function(t){return t(e)}))}));case 4:case"end":return t.stop()}}),t)}))),Re.apply(this,arguments)}var Le,Ie,Fe,De,He,We,qe,Ge,Be,ze,Ve,Je,Ke,Ye,Ze,Qe,Xe,tn,en,nn,rn,on,an,sn,un,cn=/([mhd])\s+ago\s*$/i,ln="m ago",dn={type:(un=D(I().mark((function t(e,n){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",void 0);case 1:case"end":return t.stop()}}),t)}))),function(t,e){return un.apply(this,arguments)}),options:(sn=D(I().mark((function t(e,n){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",void 0);case 1:case"end":return t.stop()}}),t)}))),function(t,e){return sn.apply(this,arguments)}),sort:(an=D(I().mark((function t(e,n){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",void 0);case 1:case"end":return t.stop()}}),t)}))),function(t,e){return an.apply(this,arguments)}),domain:(on=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Me(n);case 2:return r=t.sent,t.abrupt("return",(function(t){return r(t.entity_id.split(".")[0])}));case 4:case"end":return t.stop()}}),t)}))),function(t,e){return on.apply(this,arguments)}),entity_id:(rn=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Me(n);case 2:return r=t.sent,t.abrupt("return",(function(t){return r(t.entity_id)}));case 4:case"end":return t.stop()}}),t)}))),function(t,e){return rn.apply(this,arguments)}),state:(nn=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Me(n);case 2:return r=t.sent,t.abrupt("return",(function(t){return r(t.state)||r(e.formatEntityState(e.states[t.entity_id]))}));case 4:case"end":return t.stop()}}),t)}))),function(t,e){return nn.apply(this,arguments)}),name:(en=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Me(n);case 2:return r=t.sent,t.abrupt("return",(function(t){var e;return r(null===(e=t.attributes)||void 0===e?void 0:e.friendly_name)}));case 4:case"end":return t.stop()}}),t)}))),function(t,e){return en.apply(this,arguments)}),group:(tn=D(I().mark((function t(e,n){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(function(t){var r,i,o;return null===(o=null===(i=null===(r=e.states[n])||void 0===r?void 0:r.attributes)||void 0===i?void 0:i.entity_id)||void 0===o?void 0:o.includes(t.entity_id)}));case 1:case"end":return t.stop()}}),t)}))),function(t,e){return tn.apply(this,arguments)}),attributes:(Xe=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(Object.entries(n).map(function(){var t=D(I().mark((function t(e){var n,r,i,o,a,s;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=L(e,2),r=n[0],i=n[1],o=r.split(" ")[0],a=function(t){return o.split(":").reduce((function(t,e){return null==t?void 0:t[e]}),t)},t.next=5,Me(i);case 5:return s=t.sent,t.abrupt("return",{prepare:a,match:s});case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 2:return r=t.sent,t.abrupt("return",(function(t){return r.every((function(e){var n=e.prepare;return(0,e.match)(n(t.attributes))}))}));case 4:case"end":return t.stop()}}),t)}))),function(t,e){return Xe.apply(this,arguments)}),not:(Qe=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fn(e,n);case 2:return r=t.sent,t.abrupt("return",(function(t){return!r(t.entity_id)}));case 4:case"end":return t.stop()}}),t)}))),function(t,e){return Qe.apply(this,arguments)}),and:(Ze=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(n.map((function(t){return fn(e,t)})));case 2:return r=t.sent,t.abrupt("return",(function(t){return r.every((function(e){return e(t.entity_id)}))}));case 4:case"end":return t.stop()}}),t)}))),function(t,e){return Ze.apply(this,arguments)}),or:(Ye=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(n.map((function(t){return fn(e,t)})));case 2:return r=t.sent,t.abrupt("return",(function(t){return r.some((function(e){return e(t.entity_id)}))}));case 4:case"end":return t.stop()}}),t)}))),function(t,e){return Ye.apply(this,arguments)}),device:(Ke=D(I().mark((function t(e,n){var r,i,o,a,s;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e),je(e)]);case 2:return r=t.sent,i=L(r,3),o=i[0],a=i[1],s=i[2],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));if(!e)return!1;var n=s.find((function(t){return t.id===e.device_id}));return!!n&&(o(n.id)||o(n.name_by_user)||o(n.name))}));case 8:case"end":return t.stop()}}),t)}))),function(t,e){return Ke.apply(this,arguments)}),device_manufacturer:(Je=D(I().mark((function t(e,n){var r,i,o,a,s;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e),je(e)]);case 2:return r=t.sent,i=L(r,3),o=i[0],a=i[1],s=i[2],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));if(!e)return!1;var n=s.find((function(t){return t.id===e.device_id}));return!!n&&o(n.manufacturer)}));case 8:case"end":return t.stop()}}),t)}))),function(t,e){return Je.apply(this,arguments)}),device_model:(Ve=D(I().mark((function t(e,n){var r,i,o,a,s;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e),je(e)]);case 2:return r=t.sent,i=L(r,3),o=i[0],a=i[1],s=i[2],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));if(!e)return!1;var n=s.find((function(t){return t.id===e.device_id}));return!!n&&o(n.model)}));case 8:case"end":return t.stop()}}),t)}))),function(t,e){return Ve.apply(this,arguments)}),area:(ze=D(I().mark((function t(e,n){var r,i,o,a,s,u;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e),je(e),Ce(e)]);case 2:return r=t.sent,i=L(r,4),o=i[0],a=i[1],s=i[2],u=i[3],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));if(!e)return!1;var n=u.find((function(t){return t.area_id===e.area_id}));if(n)return o(n.name)||o(n.area_id);var r=s.find((function(t){return t.id===e.device_id}));return!!r&&(n=u.find((function(t){return t.area_id===r.area_id})),!!n&&(o(n.name)||o(n.area_id)))}));case 9:case"end":return t.stop()}}),t)}))),function(t,e){return ze.apply(this,arguments)}),floor:(Be=D(I().mark((function t(e,n){var r,i,o,a,s,u,c;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e),je(e),Ce(e),Pe(e)]);case 2:return r=t.sent,i=L(r,5),o=i[0],a=i[1],s=i[2],u=i[3],c=i[4],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));if(!e)return!1;var n=u.find((function(t){return t.area_id===e.area_id}));if(!n){var r=s.find((function(t){return t.id===e.device_id}));if(!r)return!1;n=u.find((function(t){return t.area_id===r.area_id}))}if(!n)return!1;var i=c.find((function(t){return t.floor_id===n.floor_id}));return!!i&&(o(i.name)||o(i.floor_id))}));case 10:case"end":return t.stop()}}),t)}))),function(t,e){return Be.apply(this,arguments)}),level:(Ge=D(I().mark((function t(e,n){var r,i,o,a,s,u,c;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e),je(e),Ce(e),Pe(e)]);case 2:return r=t.sent,i=L(r,5),o=i[0],a=i[1],s=i[2],u=i[3],c=i[4],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));if(!e)return!1;var n=u.find((function(t){return t.area_id===e.area_id}));if(!n){var r=s.find((function(t){return t.id===e.device_id}));if(!r)return!1;n=u.find((function(t){return t.area_id===r.area_id}))}if(!n)return!1;var i=c.find((function(t){return t.floor_id===n.floor_id}));return!!i&&o(i.level)}));case 10:case"end":return t.stop()}}),t)}))),function(t,e){return Ge.apply(this,arguments)}),entity_category:(qe=D(I().mark((function t(e,n){var r,i,o,a;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e)]);case 2:return r=t.sent,i=L(r,2),o=i[0],a=i[1],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));return!!e&&o(e.entity_category)}));case 7:case"end":return t.stop()}}),t)}))),function(t,e){return qe.apply(this,arguments)}),last_changed:(We=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return cn.test(n)||(n+=ln),t.next=3,Me(n);case 3:return r=t.sent,t.abrupt("return",(function(t){return r(t.last_changed)}));case 5:case"end":return t.stop()}}),t)}))),function(t,e){return We.apply(this,arguments)}),last_updated:(He=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return cn.test(n)||(n+=ln),t.next=3,Me(n);case 3:return r=t.sent,t.abrupt("return",(function(t){return r(t.last_updated)}));case 5:case"end":return t.stop()}}),t)}))),function(t,e){return He.apply(this,arguments)}),last_triggered:(De=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return cn.test(n)||(n+=ln),t.next=3,Me(n);case 3:return r=t.sent,t.abrupt("return",(function(t){return r(t.attributes.last_triggered)}));case 5:case"end":return t.stop()}}),t)}))),function(t,e){return De.apply(this,arguments)}),integration:(Fe=D(I().mark((function t(e,n){var r,i,o,a;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e)]);case 2:return r=t.sent,i=L(r,2),o=i[0],a=i[1],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));return!!e&&(o(e.platform)||o(e.config_entry_id))}));case 7:case"end":return t.stop()}}),t)}))),function(t,e){return Fe.apply(this,arguments)}),hidden_by:(Ie=D(I().mark((function t(e,n){var r,i,o,a;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e)]);case 2:return r=t.sent,i=L(r,2),o=i[0],a=i[1],t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));return!!e&&o(e.hidden_by)}));case 7:case"end":return t.stop()}}),t)}))),function(t,e){return Ie.apply(this,arguments)}),label:(Le=D(I().mark((function t(e,n){var r,i,o,a,s,u,c;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Me(n),Te(e),je(e),Ue(e)]);case 2:return r=t.sent,i=L(r,4),o=i[0],a=i[1],s=i[2],u=i[3],c=function(t){if(o(t))return!0;var e=u.find((function(e){return e.label_id===t}));return o(null==e?void 0:e.name)},t.abrupt("return",(function(t){var e=a.find((function(e){return e.entity_id===t.entity_id}));if(!e)return!1;if(!e.labels)return!1;if(e.labels.some(c))return!0;var n=s.find((function(t){return t.id===e.device_id}));return!!n&&n.labels.some(c)}));case 10:case"end":return t.stop()}}),t)}))),function(t,e){return Le.apply(this,arguments)})};function fn(t,e){return hn.apply(this,arguments)}function hn(){return hn=D(I().mark((function t(e,n){var r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(Object.entries(n).map((function(t){var n,r,i=L(t,2),o=i[0],a=i[1];return o=o.trim().split(" ")[0].trim(),null!==(r=null===(n=dn[o])||void 0===n?void 0:n.call(dn,e,a))&&void 0!==r?r:function(){return!1}})));case 2:return r=t.sent.filter((function(t){return void 0!==t})).filter(Boolean),t.abrupt("return",(function(t){var n;if(!r.length)return!1;if("string"!=typeof t&&(t=t.entity),!t)return!1;var i=null===(n=null==e?void 0:e.states)||void 0===n?void 0:n[t];return!!i&&r.every((function(t){return t(i)}))}));case 4:case"end":return t.stop()}}),t)}))),hn.apply(this,arguments)}function pn(t,e,n){var r,i,o,a,s=L(n.reverse?[1,-1]:[-1,1],2),u=s[0],c=s[1];return n.ignore_case&&(t=null!==(i=null===(r=null==t?void 0:t.toLowerCase)||void 0===r?void 0:r.call(t))&&void 0!==i?i:t,e=null!==(a=null===(o=null==e?void 0:e.toLowerCase)||void 0===o?void 0:o.call(e))&&void 0!==a?a:e),n.numeric&&(isNaN(parseFloat(t))&&isNaN(parseFloat(e))||(t=isNaN(parseFloat(t))?void 0:parseFloat(t),e=isNaN(parseFloat(e))?void 0:parseFloat(e))),void 0===t&&void 0===e?0:void 0===t?c:void 0===e?u:n.numeric?t===e?0:t<e?u:c:n.ip?(t=t.split("."),e=e.split("."),(n.reverse?-1:1)*(pn(t[0],e[0],{method:"",numeric:!0})||pn(t[1],e[1],{method:"",numeric:!0})||pn(t[2],e[2],{method:"",numeric:!0})||pn(t[3],e[3],{method:"",numeric:!0}))):(n.reverse?-1:1)*String(t).localeCompare(String(e),void 0,n)}var vn,yn,mn={none:function(t){return 0},domain:function(t){var e;return null===(e=null==t?void 0:t.entity_id)||void 0===e?void 0:e.split(".")[0]},entity_id:function(t){return null==t?void 0:t.entity_id},friendly_name:function(t){var e,n;return(null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.friendly_name)||(null===(n=null==t?void 0:t.entity_id)||void 0===n?void 0:n.split(".")[1])},name:function(t){var e,n;return(null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.friendly_name)||(null===(n=null==t?void 0:t.entity_id)||void 0===n?void 0:n.split(".")[1])},device:(yn=D(I().mark((function t(e,n,r){var i,o,a,s,u,c,l;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Te(r),je(r)]);case 2:if(o=t.sent,a=L(o,2),s=a[0],u=a[1],c=s.find((function(t){return t.entity_id===e.entity_id})),c){t.next=9;break}return t.abrupt("return",void 0);case 9:if(l=u.find((function(t){return t.id===c.device_id})),l){t.next=12;break}return t.abrupt("return",void 0);case 12:return t.abrupt("return",null!==(i=l.name_by_user)&&void 0!==i?i:l.name);case 13:case"end":return t.stop()}}),t)}))),function(t,e,n){return yn.apply(this,arguments)}),area:(vn=D(I().mark((function t(e,n,r){var i,o,a,s,u,c,l,d;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Te(r),je(r),Ce(r)]);case 2:if(i=t.sent,o=L(i,3),a=o[0],s=o[1],u=o[2],c=a.find((function(t){return t.entity_id===e.entity_id})),c){t.next=10;break}return t.abrupt("return",void 0);case 10:if(l=u.find((function(t){return t.area_id===c.area_id})),!l){t.next=13;break}return t.abrupt("return",l.name);case 13:if(d=s.find((function(t){return t.id===c.device_id})),d){t.next=16;break}return t.abrupt("return",void 0);case 16:if(l=u.find((function(t){return t.area_id===d.area_id})),l){t.next=19;break}return t.abrupt("return",void 0);case 19:return t.abrupt("return",l.name);case 20:case"end":return t.stop()}}),t)}))),function(t,e,n){return vn.apply(this,arguments)}),state:function(t){return null==t?void 0:t.state},attribute:function(t,e){var n;return null===(n=null==e?void 0:e.attribute)||void 0===n?void 0:n.split(":").reduce((function(t,e){return null==t?void 0:t[e]}),null==t?void 0:t.attributes)},last_changed:function(t){return(null==t?void 0:t.last_changed)?new Date(t.last_changed).getTime():void 0},last_updated:function(t){return(null==t?void 0:t.last_updated)?new Date(t.last_updated).getTime():void 0},last_triggered:function(t){var e;return(null===(e=null==t?void 0:t.attributes)||void 0===e?void 0:e.last_triggered)?new Date(t.attributes.last_triggered).getTime():void 0}};function gn(t,e){return bn.apply(this,arguments)}function bn(){return bn=D(I().mark((function t(e,n){var r,i;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=mn[n.method]){t.next=3;break}return t.abrupt("return",(function(t){return t}));case 3:return["last_changed","last_updated","last_triggered"].includes(n.method)&&(n.numeric=!0),i=function(){var t=D(I().mark((function t(i){var o;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all(i.map(function(){var t=D(I().mark((function t(i){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=i,t.next=3,r(e.states[i.entity],n,e);case 3:return t.t1=t.sent,t.abrupt("return",[t.t0,t.t1]);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 2:return(o=t.sent).sort((function(t,e){return pn(t[1],e[1],n)})),t.abrupt("return",o.map((function(t){return t[0]})));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)}))),bn.apply(this,arguments)}var _n="1.16.1",wn="SELECTTREE-TIMEOUT";function xn(t){return kn.apply(this,arguments)}function kn(){return kn=D(I().mark((function t(e){var n,r,i,o=arguments;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=o.length>1&&void 0!==o[1]&&o[1],!(null===(r=e.localName)||void 0===r?void 0:r.includes("-"))){t.next=4;break}return t.next=4,customElements.whenDefined(e.localName);case 4:if(!e.updateComplete){t.next=7;break}return t.next=7,e.updateComplete;case 7:if(!n){t.next=18;break}if(!e.pageRendered){t.next=11;break}return t.next=11,e.pageRendered;case 11:if(!e._panelState){t.next=18;break}i=0;case 13:if(!("loaded"!==e._panelState&&i++<5)){t.next=18;break}return t.next=16,new Promise((function(t){return setTimeout(t,100)}));case 16:t.next=13;break;case 18:case"end":return t.stop()}}),t)}))),kn.apply(this,arguments)}function $n(t,e){return En.apply(this,arguments)}function En(){return En=D(I().mark((function t(e,n){var r,i,o,a,s,u,c,l=arguments;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r=l.length>2&&void 0!==l[2]&&l[2],i=[e],"string"==typeof n&&(n=n.split(/(\$| )/));""===n[n.length-1];)n.pop();o=J(n.entries()),t.prev=5,o.s();case 7:if((a=o.n()).done){t.next=24;break}if(s=L(a.value,2),s[0],"$"!==(u=s[1])){t.next=14;break}return t.next=12,Promise.all(R(i).map((function(t){return xn(t)})));case 12:return i=R(i).map((function(t){return t.shadowRoot})),t.abrupt("continue",22);case 14:if(c=i[0]){t.next=17;break}return t.abrupt("return",null);case 17:if(u.trim().length){t.next=19;break}return t.abrupt("continue",22);case 19:return t.next=21,xn(c);case 21:i=c.querySelectorAll(u);case 22:t.next=7;break;case 24:t.next=29;break;case 26:t.prev=26,t.t0=t.catch(5),o.e(t.t0);case 29:return t.prev=29,o.f(),t.finish(29);case 32:return t.abrupt("return",r?i:i[0]);case 33:case"end":return t.stop()}}),t,null,[[5,26,29,32]])}))),En.apply(this,arguments)}function An(t,e){return On.apply(this,arguments)}function On(){return On=D(I().mark((function t(e,n){var r,i,o=arguments;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=o.length>2&&void 0!==o[2]&&o[2],i=o.length>3&&void 0!==o[3]?o[3]:1e4,t.abrupt("return",Promise.race([$n(e,n,r),new Promise((function(t,e){return setTimeout((function(){return e(new Error(wn))}),i)}))]).catch((function(t){if(!t.message||t.message!==wn)throw t;return null})));case 3:case"end":return t.stop()}}),t)}))),On.apply(this,arguments)}var Sn={type:"select",options:[["area","Area"],["attributes","Attribute"],["device","Device"],["domain","Domain"],["entity_category","Entity Category"],["entity_id","Entity ID"],["floor","Floor"],["group","Group"],["hidden_by","Hidden by"],["integration","Integration"],["label","Label"],["last_changed","Last Changed"],["last_triggered","Last Triggered"],["last_updated","Last Updated"],["level","Level"],["device_manufacturer","Manufacturer"],["device_model","Model"],["name","Name"],["state","State"]]},Cn={attributes:{object:{}},area:{area:{}},device:{device:{}},entity_id:{entity:{}},floor:{floor:{}},group:{entity:{filter:{domain:"group"}}},integration:{config_entry:{}},label:{label:{}}},Pn=function(t,e){var n,r=L(t,2),i=r[0];r[1];if(!["sort","optios"].includes(i))return Sn.options.some((function(t){var e=L(t,2),n=e[0];e[1];return n===i}))?{type:"grid",name:"",schema:[Object.assign(Object.assign({},Sn),{name:"key_".concat(e),label:"Rule"}),{name:"value_".concat(e),selector:null!==(n=Cn[i])&&void 0!==n?n:{text:{}},label:""}]}:{type:"Constant",name:"Some rules are not shown",value:'The rule "'.concat(i,'" is not supported by the GUI editor.\n Please switch to the CODE EDITOR to access all options.')}},jn=function(){var t=D(I().mark((function t(e){var n,r,i,o,a,s,u,c,l,d;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,xn(e);case 2:return t.t0=J,t.next=5,An(e,"$ ha-form-grid",!0);case 5:t.t1=t.sent,s=(0,t.t0)(t.t1),t.prev=7,s.s();case 9:if((u=s.n()).done){t.next=85;break}return c=u.value,t.next=13,xn(c);case 13:return t.next=15,An(c,"$ ha-form:nth-child(2) $ ha-selector");case 15:if(l=t.sent){t.next=18;break}return t.abrupt("continue",83);case 18:return t.next=20,xn(l);case 20:return t.next=22,An(l,"$ ha-selector-area $ ha-area-picker $ ha-combo-box");case 22:if(t.t7=n=t.sent,t.t6=null!==t.t7,!t.t6){t.next=26;break}t.t6=void 0!==n;case 26:if(!t.t6){t.next=30;break}t.t8=n,t.next=33;break;case 30:return t.next=32,An(l,"$ ha-selector-device $ ha-device-picker $ ha-combo-box");case 32:t.t8=t.sent;case 33:if(t.t9=r=t.t8,t.t5=null!==t.t9,!t.t5){t.next=37;break}t.t5=void 0!==r;case 37:if(!t.t5){t.next=41;break}t.t10=r,t.next=44;break;case 41:return t.next=43,An(l,"$ ha-selector-entity $ ha-entity-picker $ ha-combo-box");case 43:t.t10=t.sent;case 44:if(t.t11=i=t.t10,t.t4=null!==t.t11,!t.t4){t.next=48;break}t.t4=void 0!==i;case 48:if(!t.t4){t.next=52;break}t.t12=i,t.next=55;break;case 52:return t.next=54,An(l,"$ ha-selector-label $ ha-label-picker $ ha-combo-box");case 54:t.t12=t.sent;case 55:if(t.t13=o=t.t12,t.t3=null!==t.t13,!t.t3){t.next=59;break}t.t3=void 0!==o;case 59:if(!t.t3){t.next=63;break}t.t14=o,t.next=66;break;case 63:return t.next=65,An(l,"$ ha-selector-config_entry $ ha-config-entry-picker $ ha-combo-box");case 65:t.t14=t.sent;case 66:if(t.t15=a=t.t14,t.t2=null!==t.t15,!t.t2){t.next=70;break}t.t2=void 0!==a;case 70:if(!t.t2){t.next=74;break}t.t16=a,t.next=77;break;case 74:return t.next=76,An(l,"$ ha-selector-floor $ ha-floor-picker $ ha-combo-box");case 76:t.t16=t.sent;case 77:if(!(d=t.t16)){t.next=83;break}return t.next=81,xn(d);case 81:return d.allowCustomValue=!0,t.abrupt("continue",83);case 83:t.next=9;break;case 85:t.next=90;break;case 87:t.prev=87,t.t17=t.catch(7),s.e(t.t17);case 90:return t.prev=90,s.f(),t.finish(90);case 93:case"end":return t.stop()}}),t,null,[[7,87,90,93]])})));return function(e){return t.apply(this,arguments)}}(),Tn=[{name:"data",label:" ",selector:{object:{}}}],Un=[{name:"entities",label:"Entities:",selector:{object:{}}}],Nn=[{name:"template",label:"Template:",selector:{template:{}}}],Mn=function(t){var e=[{name:"method",label:"Sort method",type:"select",options:[["domain","Entity Domain"],["entity_id","Entity ID"],["friendly_name","Friendly Name"],["state","Entity State"],["last_changed","Last Change"],["last_updated","Last Update"],["last_triggered","Last Trigger"],["attribute","Attribute"]]},{type:"constant",name:"Sorting options:",value:""},{type:"grid",name:"",schema:[{name:"reverse",type:"boolean",label:"Reverse"},{name:"ignore_case",type:"boolean",label:"Ignore case"},{name:"numeric",type:"boolean",label:"Numeric sort"},{name:"ip",type:"boolean",label:"IP address sort"}]}];return void 0===t||e[0].options.some((function(e){var n=L(e,2),r=n[0];n[1];return r===t}))?("attribute"==t&&e.push(),e.push({name:"attribute",label:"Attribute:",selector:{object:{}}}),e):[{type:"Constant",name:"GUI editor not available",value:"Sorting by ".concat(t," is not supported by the GUI editor.\n Please switch to the CODE EDITOR to access all options.")}]},Rn=[{type:"grid",name:"",schema:[{name:"show_empty",type:"boolean",label:"Show if empty"},{name:"card_param",type:"string",label:"Parameter to populate"}]}],Ln=function(){function t(){return Z(this,t),H(this,t,arguments)}return q(t,se),X(t,[{key:"_describe_filter",value:function(t){return"type"in t?"".concat(t.type," ").concat(t.label?'"'.concat(t.label,'"'):""):"".concat(Object.keys(t).length," rules")}},{key:"_getFilters",value:function(t){var e,n,r;return null!==(r=null===(n=null===(e=this._config.filter)||void 0===e?void 0:e[t])||void 0===n?void 0:n.concat())&&void 0!==r?r:[]}},{key:"_setFilters",value:function(t,e){var n=Object.assign(Object.assign({},this._config.filter),U({},t,e));this._config=Object.assign(Object.assign({},this._config),{filter:n}),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}},{key:"_closeAll",value:function(t){this.shadowRoot.querySelectorAll("ha-expansion-panel .".concat(t)).forEach((function(t){t.expanded=!1}))}},{key:"_filterAdd",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.stopPropagation(),this._closeAll(e);var i=this._getFilters(e);r?i.push({type:"section"}):i.push({}),this._setFilters(e,i),this.requestUpdate(),this.updateComplete.then((function(){n.shadowRoot.querySelector("ha-expansion-panel .".concat(e,":last-child")).expanded=!0}))}},{key:"_filterMove",value:function(t,e){t.stopPropagation(),this._closeAll(e);var n=t.detail,r=n.oldIndex,i=n.newIndex,o=this._getFilters(e);o.splice(i,0,o.splice(r,1)[0]),this._setFilters(e,o)}},{key:"_filterDelete",value:function(t,e,n){t.stopPropagation(),this._closeAll(n);var r=this._getFilters(n);r.splice(e,1),this._setFilters(n,r)}},{key:"_rulesChanged",value:function(t,e,n){t.stopPropagation();var r=function(t,e){var n,r={};r.options=e.options;for(var i=0;i<=t.filter.include.length+1;i++)void 0!==e["key_".concat(i)]&&(r[e["key_".concat(i)]]=null!==(n=e["value_".concat(i)])&&void 0!==n?n:"");return void 0!==e.key_new&&(r[e.key_new]=""),r}(this._config,t.detail.value);if("string"!=typeof r.options&&void 0!==r.options){var i=this._getFilters(n);i[e]=Object.assign({},r),this._setFilters(n,i)}}},{key:"_sortChanged",value:function(t,e,n){t.stopPropagation();var r=t.detail.value,i=this._getFilters(n);i[e]=Object.assign(Object.assign({},i[e]),{sort:r}),this._setFilters(n,i)}},{key:"_customChanged",value:function(t,e,n){if(t.stopPropagation(),void 0!==t.detail.value.data){var r=this._getFilters(n);r[e]=Object.assign({},t.detail.value.data),this._setFilters(n,r)}}},{key:"_templateChanged",value:function(t){t.stopPropagation();var e=t.detail.value.template;console.log(e),this._setFilters("template",e)}},{key:"_entitiesChanged",value:function(t){t.stopPropagation();var e=t.detail.value.entities;this._config=Object.assign(Object.assign({},this._config),{entities:e}),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}},{key:"firstUpdated",value:function(t){var e=this;this.updateComplete.then((function(){e.shadowRoot.querySelector("ha-expansion-panel:first-child").expanded=!0}))}},{key:"updated",value:function(t){var e=this;this.updateComplete.then(D(I().mark((function t(){var n;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Array.from(e.shadowRoot.querySelectorAll(".filter-rule-form")).map(jn),t.next=3,Promise.all(n);case 3:e.shadowRoot.querySelectorAll("ha-form").forEach((function(t){var n,r,i,o=t;void 0!==o.filter_type&&void 0!==o.filter_idx&&(o.data=(n=e._config.filter[o.filter_type][o.filter_idx],r=Object.assign({},n),i=Object.assign({},n.options),delete r.options,Object.assign.apply(Object,[{}].concat(R(Object.entries(r).map((function(t,e){var n=L(t,2),r=n[0],i=n[1];return U(U({},"key_".concat(e),r),"value_".concat(e),i)}))),[{options:i}]))))}));case 4:case"end":return t.stop()}}),t)}))))}},{key:"render",value:function(){var t=this,e=function(e){var n;return Gt(a||(a=P(['\n <ha-sortable\n handle-selector=".handle"\n @item-moved=',"\n >\n <div>\n ","\n </div>\n </ha-sortable>\n <mwc-button @click=",">\n <ha-icon .icon=","></ha-icon>Add filter\n </mwc-button>\n <mwc-button @click=",">\n <ha-icon .icon=","></ha-icon>Add custom entry\n </mwc-button>\n "])),(function(n){return t._filterMove(n,e)}),(null!==(n=t._config.filter[e])&&void 0!==n?n:[]).map((function(n,r){var i,o,a;return Gt(s||(s=P(['\n <ha-expansion-panel\n outlined\n class="drag ','"\n ','\n >\n <div class="handle" slot="leading-icon">\n <ha-icon .icon=','></ha-icon>\n </div>\n <h3 slot="header">\n [',"] - ",'\n </h3>\n <div class="content">\n <mwc-button\n class="warning"\n @click=',"\n >\n Delete\n </mwc-button>\n ","\n </div>\n </ha-expansion-panel>\n "])),e,"include"==e?"expanded":"","mdi:drag",r,t._describe_filter(n),(function(n){return t._filterDelete(n,r,e)}),void 0===n.type?Gt(u||(u=P(["\n ","\n <ha-form\n .hass=","\n .schema=","\n .computeLabel=","\n @value-changed=",'\n class="filter-rule-form"\n .filter_type=',"\n .filter_idx=",'\n >\n </ha-form>\n <ha-expansion-panel outlined class="sort">\n <h4 slot="header">Sorting</h4>\n <div class="content">\n <ha-form\n .hass=',"\n .schema=","\n .data=","\n .computeLabel=","\n @value-changed=","\n >\n </ha-form>\n </div>\n </ha-expansion-panel>\n "])),function(t){return Object.keys(t).some((function(t){return t in Cn}))}(n)?Gt(c||(c=P(['\n <p class="info">\n If entering a custom Value (e.g. "*light" or\n "/^[Bb]ed/") in a box with options, you need to\n finish with the Enter key.\n </p>\n ']))):"",t.hass,(o=n,delete(a=Object.assign({},o)).options,[].concat(R(Object.entries(a).map(Pn).filter(Boolean)),[Object.assign(Object.assign({},Sn),{name:"key_new",label:"New Rule ..."}),{name:"options",label:"Options:",selector:{object:{}}}])),(function(t){var e;return null!==(e=t.label)&&void 0!==e?e:t.name}),(function(n){return t._rulesChanged(n,r,e)}),e,r,t.hass,Mn(null===(i=n.sort)||void 0===i?void 0:i.method),n.sort,(function(t){var e;return null!==(e=t.label)&&void 0!==e?e:t.name}),(function(n){return t._sortChanged(n,r,e)})):Gt(l||(l=P(["\n <ha-form\n .hass=","\n .schema=","\n .data=","\n .computeLabel=","\n @value-changed=","\n >\n </ha-form>\n "])),t.hass,Tn,{data:n},(function(t){var e;return null!==(e=t.label)&&void 0!==e?e:t.name}),(function(n){return t._customChanged(n,r,e)})))})),(function(n){return t._filterAdd(n,e)}),"mdi:plus",(function(n){return t._filterAdd(n,e,!0)}),"mdi:plus")};return Gt(d||(d=P(["\n <div>\n <ha-expansion-panel outlined>\n <ha-icon .icon=",' slot="leading-icon"></ha-icon>\n <h3 slot="header">Include</h3>\n\n <div class="content">',"</div>\n </ha-expansion-panel>\n <ha-expansion-panel outlined>\n <ha-icon .icon=",' slot="leading-icon"></ha-icon>\n <h3 slot="header">Exclude</h3>\n <div class="content">',"</div>\n </ha-expansion-panel>\n ","\n ","\n </div>\n "])),"mdi:plus",e("include"),"mdi:minus",e("exclude"),this._config.entities?Gt(f||(f=P(["\n <ha-form\n .hass=","\n .schema=","\n .data=","\n .computeLabel=","\n @value-changed=","\n >\n </ha-form>\n "])),this.hass,Un,this._config,(function(t){var e;return null!==(e=t.label)&&void 0!==e?e:t.name}),(function(e){return t._entitiesChanged(e)})):"",this._config.filter.template?Gt(h||(h=P(["\n <ha-form\n .hass=","\n .schema=","\n .data=","\n .computeLabel=","\n @value-changed=","\n >\n </ha-form>\n "])),this.hass,Nn,this._config.filter,(function(t){var e;return null!==(e=t.label)&&void 0!==e?e:t.name}),(function(e){return t._templateChanged(e)})):"")}}],[{key:"styles",get:function(){return[ut(p||(p=P(['\n ha-expansion-panel {\n margin-bottom: 24px;\n display: block;\n --expansion-panel-content-padding: 0;\n border-radius: 6px;\n --ha-card-border-radius: 6px;\n }\n ha-sortable ha-expansion-panel {\n margin-bottom: 8px;\n }\n ha-expansion-panel .content {\n padding: 12px;\n }\n ha-expansion-panel > *[slot="header"] {\n margin: 0;\n font-size: inherit;\n font-weight: inherit;\n }\n ha-expansion-panel ha-svg-icon {\n color: var(--secondary-text-color);\n }\n ha-expansion-panel .sort {\n margin-top: 8px;\n }\n\n .handle > ha-icon {\n pointer-events: none;\n }\n\n mwc-button.warning {\n --mdc-theme-primary: var(--error-color);\n }\n\n p.info {\n font-size: 0.875rem;\n color: var(--secondary-text-color);\n }\n '])))]}}])}();nt([fe()],Ln.prototype,"_config",void 0),nt([de()],Ln.prototype,"hass",void 0),customElements.define("auto-entities-filter-editor",Ln);var In=function(){function t(){return Z(this,t),H(this,t,arguments)}return q(t,se),X(t,[{key:"_changeSortOptions",value:function(t){if(this._config){var e=t.detail.value;this._config=Object.assign(Object.assign({},this._config),{sort:e}),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}}},{key:"render",value:function(){var t,e=null!==(t=this._config.sort)&&void 0!==t?t:{};return Gt(v||(v=P(["\n <div>\n <ha-form\n .hass=","\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n </div>\n "])),this.hass,e,Mn(e.method),(function(t){var e;return null!==(e=t.label)&&void 0!==e?e:t.name}),this._changeSortOptions)}}])}();nt([fe()],In.prototype,"_config",void 0),nt([de()],In.prototype,"hass",void 0),customElements.define("auto-entities-sorting-editor",In);var Fn=function(){function t(){var e;return Z(this,t),(e=H(this,t,arguments))._cardGUIMode=!0,e._cardGUIModeAvailable=!0,e}return q(t,se),X(t,[{key:"_changeCardOptions",value:function(t){if(this._config){var e=t.detail.value;this._config=Object.assign(Object.assign({},this._config),e),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}}},{key:"_toggleCardMode",value:function(t){var e;null===(e=this._cardEditorEl)||void 0===e||e.toggleMode()}},{key:"_deleteCard",value:function(t){this._config&&(this._config=Object.assign({},this._config),delete this._config.card,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}})))}},{key:"_getCardConfig",value:function(){var t=Object.assign({},this._config.card);return t[this._config.card_param||"entities"]=[],t}},{key:"_handleCardConfigChanged",value:function(t){if(t.stopPropagation(),this._config){var e=Object.assign({},t.detail.config);delete e[this._config.card_param||"entities"],this._config=Object.assign(Object.assign({},this._config),{card:e}),this._cardGUIModeAvailable=t.detail.guiModeAvailable,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}}},{key:"_cardGUIModeChanged",value:function(t){t.stopPropagation(),this._cardGUIMode=t.detail.guiMode,this._cardGUIModeAvailable=t.detail.guiModeAvailable}},{key:"render",value:function(){var t,e=Object.assign({},this._config);return e.show_empty=null===(t=e.show_empty)||void 0===t||t,Gt(y||(y=P(['\n <div class="box cards">\n <ha-form\n .hass=',"\n .schema=","\n .computeLabel=","\n .data=","\n @value-changed=","\n ></ha-form>\n ","\n </div>\n "])),this.hass,Rn,(function(t){var e;return null!==(e=t.label)&&void 0!==e?e:t.name}),e,this._changeCardOptions,this._config.card?Gt(m||(m=P(["\n <div>\n <mwc-button\n @click=","\n .disabled=","\n >\n ","\n </mwc-button>\n <mwc-button\n .title=","\n @click=","\n >\n Change card type\n </mwc-button>\n </div>\n <hui-card-element-editor\n .hass=","\n .lovelace=","\n .value=","\n @config-changed=","\n @GUImode-changed=","\n ></hui-card-element-editor>\n "])),this._toggleCardMode,!this._cardGUIModeAvailable,!this._cardEditorEl||this._cardGUIMode?"Show code editor":"Show Visual Editor","Change card type",this._deleteCard,this.hass,this.lovelace,this._getCardConfig(),this._handleCardConfigChanged,this._cardGUIModeChanged):Gt(g||(g=P(["\n <hui-card-picker\n .hass=","\n .lovelace=","\n @config-changed=","\n ></hui-card-picker>\n "])),this.hass,this.lovelace,this._handleCardConfigChanged))}}])}();nt([fe()],Fn.prototype,"_config",void 0),nt([de()],Fn.prototype,"lovelace",void 0),nt([de()],Fn.prototype,"hass",void 0),nt([fe()],Fn.prototype,"_cardGUIMode",void 0),nt([fe()],Fn.prototype,"_cardGUIModeAvailable",void 0),nt([function(t){return function(e,n,r){return function(t,e,n){return n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=et(e)&&Object.defineProperty(t,e,n),n}(e,n,{get:function(){return function(e){var n,r;return null!==(n=null===(r=e.renderRoot)||void 0===r?void 0:r.querySelector(t))&&void 0!==n?n:null}(this)}})}}("hui-card-element-editor")],Fn.prototype,"_cardEditorEl",void 0),customElements.define("auto-entities-card-editor",Fn);var Dn=function(){function t(){return Z(this,t),H(this,t,arguments)}return q(t,se),X(t,[{key:"render",value:function(){return Gt(b||(b=P(["\n <div>\n <p>Auto entities version ",'</p>\n <p>\n See\n <a\n href="https://github.com/thomasloven/lovelace-auto-entities"\n target="_blank"\n rel="noreferrer"\n >\n auto-entities on github\n </a>\n for usage instructions.\n </p>\n <p>Not all options are available in the GUI editor.</p>\n </div>\n '])),_n)}}],[{key:"styles",get:function(){return[ut(_||(_=P(["\n a {\n color: var(--primary-color);\n }\n "])))]}}])}();customElements.define("auto-entities-help",Dn),customElements.whenDefined("ha-yaml-editor").then((function(){var t=customElements.get("ha-yaml-editor").prototype,e=t.setValue;t.setValue=function(t){!this.autoUpdate&&Oe(t,this.value)||e.bind(this)(t)}}));var Hn=function(){function t(){var e;return Z(this,t),(e=H(this,t,arguments))._selectedTab="Filters",e}return q(t,se),X(t,[{key:"setConfig",value:function(t){this._config=t}},{key:"connectedCallback",value:function(){N(t,"connectedCallback",this,3)([]),Ae()}},{key:"_config_changed",value:function(t){t.stopPropagation(),this._config&&(this._config=t.detail.config,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}})))}},{key:"_handleSwitchTab",value:function(t){this._selectedTab=t.detail.name}},{key:"render",value:function(){var t=this;if(!this.hass||!this._config)return Gt(w||(w=P([""])));var e={Filters:function(){return Gt(x||(x=P(["<auto-entities-filter-editor\n .hass=","\n ._config=","\n @config-changed=","\n ></auto-entities-filter-editor>"])),t.hass,t._config,t._config_changed)},Sorting:function(){return Gt(k||(k=P(["<auto-entities-sorting-editor\n .hass=","\n ._config=","\n @config-changed=","\n ></auto-entities-sorting-editor>"])),t.hass,t._config,t._config_changed)},Card:function(){return Gt($||($=P(["<auto-entities-card-editor\n .hass=","\n .lovelace=","\n ._config=","\n @config-changed=","\n ></auto-entities-card-editor>"])),t.hass,t.lovelace,t._config,t._config_changed)},"?":function(){return Gt(E||(E=P(["<auto-entities-help></auto-entities-help>"])))}};return Gt(A||(A=P(["\n <div>\n <sl-tab-group @sl-tab-show=",">\n ","\n </sl-tab-group>\n\n <div>","</div>\n </div>\n "])),this._handleSwitchTab,Object.keys(e).map((function(e){return Gt(O||(O=P(['\n <sl-tab\n slot="nav"\n .active=',"\n panel=","\n >\n ","\n </sl-tab>\n "])),t._selectedTab==e,e,e)})),e[this._selectedTab].bind(this)())}}],[{key:"styles",get:function(){return[ut(S||(S=P(['\n sl-tab-group {\n margin-top: -16px;\n margin-bottom: 16px;\n }\n sl-tab {\n flex: 1;\n }\n sl-tab::part(base) {\n width: 100%;\n justify-content: center;\n }\n sl-tab[panel="?"] {\n flex: 0;\n }\n '])))]}}])}();nt([fe()],Hn.prototype,"_config",void 0),nt([de()],Hn.prototype,"lovelace",void 0),nt([de()],Hn.prototype,"hass",void 0),nt([fe()],Hn.prototype,"_selectedTab",void 0),customElements.define("auto-entities-editor",Hn),window.customCards=window.customCards||[],window.customCards.push({type:"auto-entities",name:"Auto Entities",preview:!1,description:"Entity Filter on Steroids. Auto Entities allows you to fill other cards with entities automatically, based on a number of attributes."});var Wn=function(){var t=D(I().mark((function t(e,n,r){var i,o,a,s,u,c,l,d,f,h,p,v,y,m,g;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Promise.all([Te(e),je(e),Ce(e)]);case 2:if(u=t.sent,c=L(u,3),l=c[0],d=c[1],f=c[2],h=null===(i=null==e?void 0:e.states)||void 0===i?void 0:i[r],p=l.find((function(t){return t.entity_id===r})),v=p?d.find((function(t){return t.id===p.device_id})):void 0,y=p?f.find((function(t){return t.area_id===p.area_id})):void 0,void 0===y&&(y=v?f.find((function(t){return t.area_id===v.area_id})):void 0),m=(m=JSON.stringify(n)).replace(/this.entity_id/g,r),!0!==n.eval_js){t.next=23;break}g=new Function("entity_id","entity","device","area","state",'\n "use strict";\n return (String.raw`'.concat(m,"`);\n ")),t.prev=16,m=g(r,null!==(o=null==p?void 0:p.name_by_user)&&void 0!==o?o:null==p?void 0:p.name,null!==(a=null==v?void 0:v.name_by_user)&&void 0!==a?a:null==v?void 0:v.name,null!==(s=null==y?void 0:y.name_by_user)&&void 0!==s?s:null==y?void 0:y.name,h),t.next=23;break;case 20:return t.prev=20,t.t0=t.catch(16),t.abrupt("return",{error:t.t0.message});case 23:return t.abrupt("return",JSON.parse(m));case 24:case"end":return t.stop()}}),t,null,[[16,20]])})));return function(e,n,r){return t.apply(this,arguments)}}();window.queueMicrotask=window.queueMicrotask||function(t){return window.setTimeout(t,1)};var qn=["section","divider"],Gn=function(){function t(){var e;return Z(this,t),(e=H(this,t,arguments)).connectedWhileHidden=!0,e.empty=!1,e._updateCooldown={timer:void 0,rerun:!1},e._renderer=function(t){e._template="string"==typeof t?t.split(/[\s,]+/):t,queueMicrotask((function(){return e.update_all()}))},e}return q(t,se),X(t,[{key:"setConfig",value:function(t){var e,n,r,i=this;if(!t)throw new Error("No configuration.");if(!t.filter&&!t.entities)throw new Error("No filters specified.");if(null===(e=t.filter)||void 0===e?void 0:e.include){var o,a=J(t.filter.include.entries());try{for(a.s();!(o=a.n()).done;){var s=L(o.value,2),u=s[0],c=s[1];if(!Object.keys(c).includes("type"))for(var l in c)if(!(l.trim().split(" ")[0].trim()in dn))throw new Error('Unknown rule "'.concat(l,'" in include filter ').concat(u))}}catch(t){a.e(t)}finally{a.f()}}if(null===(n=t.filter)||void 0===n?void 0:n.exclude){var d,f=J(t.filter.exclude.entries());try{for(f.s();!(d=f.n()).done;){var h=L(d.value,2),p=h[0],v=h[1];if(!Object.keys(v).includes("type"))for(var y in v)if(!(y.trim().split(" ")[0].trim()in dn))throw new Error('Unknown rule "'.concat(y,'" in exclude filter ').concat(p))}}catch(t){f.e(t)}finally{f.f()}}t=JSON.parse(JSON.stringify(t)),this._config=t,(null===(r=this._config.filter)||void 0===r?void 0:r.template)&&we(this._config.filter.template)&&xe(this._renderer,this._config.filter.template,{config:t}),this._cardBuilt=new Promise((function(t){return i._cardBuiltResolve=t})),queueMicrotask((function(){return i.build_else()})),queueMicrotask((function(){return i.update_all()}))}},{key:"connectedCallback",value:function(){var e,n;N(t,"connectedCallback",this,3)([]),(null===(n=null===(e=this._config)||void 0===e?void 0:e.filter)||void 0===n?void 0:n.template)&&we(this._config.filter.template)&&xe(this._renderer,this._config.filter.template,{config:this._config})}},{key:"disconnectedCallback",value:function(){N(t,"disconnectedCallback",this,3)([]),$e(this._renderer)}},{key:"update_all",value:(a=D(I().mark((function t(){var e,n=this;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.card&&(this.card.hass=this.hass),this.else&&(this.else.hass=this.hass),!this._updateCooldown.timer){t.next=7;break}return this._updateCooldown.rerun=!0,t.abrupt("return");case 7:this._updateCooldown.rerun=!1,this._updateCooldown.timer=window.setTimeout((function(){n._updateCooldown.timer=void 0,n._updateCooldown.rerun&&n.update_all()}),500);case 9:if(this.hass){t.next=11;break}return t.abrupt("return");case 11:return t.next=13,this.update_entities();case 13:e=t.sent,this.update_card(e);case 15:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)})},{key:"build_else",value:(o=D(I().mark((function t(){var e;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==this._config.else){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,window.loadCardHelpers();case 4:return e=t.sent,t.next=7,e.createCardElement(this._config.else);case 7:this.else=t.sent,this.else.hass=this.hass;case 9:case"end":return t.stop()}}),t,this)}))),function(){return o.apply(this,arguments)})},{key:"update_card",value:(i=D(I().mark((function t(e){var n,r,i,o,a,s,u,c,l,d,f,h,p,v,y,m,g,b,_,w;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(this._entities&&Oe(e,this._entities)&&Oe(this._cardConfig,this._config.card))){t.next=2;break}return t.abrupt("return");case 2:if(y=(null===(n=this._cardConfig)||void 0===n?void 0:n.type)!==(null===(r=this._config.card)||void 0===r?void 0:r.type),this._entities=e,this._cardConfig=JSON.parse(JSON.stringify(null!==(i=this._config.card)&&void 0!==i?i:{})),m=Object.assign(U({type:"entities"},this._config.card_param||"entities",e),this._config.card),this.card&&!y){t.next=40;break}return t.next=9,window.loadCardHelpers();case 9:return g=t.sent,console.oldError=console.oldError||[],b=console.error,console.oldError.push(b),console.error=function(){for(var t,e,n,r,i,o,a=arguments.length,s=new Array(a),u=0;u<a;u++)s[u]=arguments[u];3===s.length&&s[2].message&&((null===(e=(t=s[2].message).startsWith)||void 0===e?void 0:e.call(t,"Entities"))||(null===(r=(n=s[2].message).startsWith)||void 0===r?void 0:r.call(n,"Either entities"))||(null===(o=(i=s[2].message).endsWith)||void 0===o?void 0:o.call(i,"entity")))||b.apply(void 0,s)},t.prev=14,t.next=17,g.createCardElement(m);case 17:if(this.card=t.sent,"hui-error-card"!==this.card.localName){t.next=35;break}return _=this.card,t.next=22,customElements.whenDefined("hui-error-card");case 22:w=10;case 23:if(_._config||!w){t.next=29;break}return t.next=26,new Promise((function(t){return window.setTimeout(t,100)}));case 26:w--,t.next=23;break;case 29:if(!((null===(s=null===(a=null===(o=_._config)||void 0===o?void 0:o.error)||void 0===a?void 0:a.startsWith)||void 0===s?void 0:s.call(a,"Entities"))||(null===(l=null===(c=null===(u=_._config)||void 0===u?void 0:u.error)||void 0===c?void 0:c.startsWith)||void 0===l?void 0:l.call(c,"Either entities"))||(null===(h=null===(f=null===(d=_._config)||void 0===d?void 0:d.error)||void 0===f?void 0:f.endsWith)||void 0===h?void 0:h.call(f,"entity")))){t.next=35;break}return this.card=void 0,this._entities=void 0,this._cardConfig=void 0,null===(p=this._cardBuiltResolve)||void 0===p||p.call(this),t.abrupt("return");case 35:return t.prev=35,console.error=console.oldError.pop(),t.finish(35);case 38:t.next=41;break;case 40:this.card.setConfig(m);case 41:if(null===(v=this._cardBuiltResolve)||void 0===v||v.call(this),this.card.hass=this.hass,this.empty=0===e.length||e.every((function(t){return qn.includes(t.type)})),this.dispatchEvent(new Event("card-visibility-changed",{bubbles:!0,cancelable:!0})),!this.card.requestUpdate){t.next=49;break}return t.next=48,this.updateComplete;case 48:this.card.requestUpdate();case 49:case"end":return t.stop()}}),t,this,[[14,,35,38]])}))),function(t){return i.apply(this,arguments)})},{key:"update_entities",value:(r=D(I().mark((function t(){var e,n,r,i,o,a,s,u,c,l,d,f,h,p,v,y,m,g,b,_,w,x,k,$=this;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v=function(t){return t?"string"==typeof t?{entity:t.trim()}:t:null},y=R((null===(r=null===(n=this._config)||void 0===n?void 0:n.entities)||void 0===r?void 0:r.map(v))||[]),this.hass){t.next=4;break}return t.abrupt("return",y);case 4:return this._template&&(y=y.concat(this._template.map(v))),y=y.filter(Boolean),t.next=8,Promise.all((null!==(o=null===(i=this._config.filter)||void 0===i?void 0:i.include)&&void 0!==o?o:[]).map(function(){var t=D(I().mark((function t(e){var n,r,i,o;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0===e.type){t.next=2;break}return t.abrupt("return",D(I().mark((function t(){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",[e]);case 1:case"end":return t.stop()}}),t)}))));case 2:return t.next=4,fn($.hass,e);case 4:if(r=t.sent,!(null===(n=e.sort)||void 0===n?void 0:n.method)){t.next=11;break}return t.next=8,gn($.hass,e.sort);case 8:t.t0=t.sent,t.next=12;break;case 11:t.t0=function(t){return t};case 12:return i=t.t0,o=function(){var t=D(I().mark((function t(n){return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Wn($.hass,Object.assign(Object.assign({},n),e.options),n.entity);case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),t.abrupt("return",function(){var t=D(I().mark((function t(n){var a,s,u,c,l,d,f,h,p;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return f=n.filter(r),t.next=3,i(f);case 3:return f=t.sent,((null===(a=e.sort)||void 0===a?void 0:a.count)||(null===(s=e.sort)||void 0===s?void 0:s.first))&&(h=null!==(c=null===(u=e.sort)||void 0===u?void 0:u.first)&&void 0!==c?c:0,p=null!==(d=null===(l=e.sort)||void 0===l?void 0:l.count)&&void 0!==d?d:1/0,f=f.slice(h,h+p)),t.next=7,Promise.all(f.map(o));case 7:return f=t.sent,t.abrupt("return",f);case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}());case 15:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 8:return m=t.sent,t.next=11,Promise.all((null!==(s=null===(a=this._config.filter)||void 0===a?void 0:a.exclude)&&void 0!==s?s:[]).map(function(){var t=D(I().mark((function t(e){var n;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fn($.hass,e);case 2:return n=t.sent,t.abrupt("return",n);case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 11:return g=t.sent,b=Object.keys(this.hass.states).map(v),t.t0=(e=y).concat,t.t1=e,t.t2=R,t.next=18,Promise.all(m.map((function(t){return t(b)})));case 18:if(t.t3=t.sent,t.t4=(0,t.t2)(t.t3),y=(y=t.t0.apply.call(t.t0,t.t1,t.t4)).filter((function(t){return!g.some((function(e){return e(t)}))})),!(null===(u=this._config.sort)||void 0===u?void 0:u.method)){t.next=28;break}return t.next=25,gn(this.hass,this._config.sort);case 25:t.t5=t.sent,t.next=29;break;case 28:t.t5=function(t){return t};case 29:return _=t.t5,t.next=32,_(y);case 32:return y=t.sent,this._config.unique&&(w=function(t,e,n){return e===n.findIndex((function(e){return Oe(e,t)}))},"entity"===this._config.unique&&(w=function(t,e,n){return e===n.findIndex((function(e){return e.entity===t.entity}))}),y=y.filter(w)),((null===(c=this._config.sort)||void 0===c?void 0:c.count)||(null===(l=this._config.sort)||void 0===l?void 0:l.first))&&(x=null!==(f=null===(d=this._config.sort)||void 0===d?void 0:d.first)&&void 0!==f?f:0,k=null!==(p=null===(h=this._config.sort)||void 0===h?void 0:h.count)&&void 0!==p?p:1/0,y=y.slice(x,x+k)),t.abrupt("return",y);case 36:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"updated",value:(n=D(I().mark((function t(e){var n=this;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:(e.has("_template")||e.has("hass")&&this.hass)&&queueMicrotask((function(){return n.update_all()}));case 1:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"createRenderRoot",value:function(){return this}},{key:"render",value:function(){return Gt(C||(C=P(["",""])),this.empty&&(!1===this._config.show_empty||this._config.else)?this.else:this.card)}},{key:"getCardSize",value:(e=D(I().mark((function t(){var e,n,r;return I().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=0,t.next=3,this._cardBuilt;case 3:if(!this.card||!this.card.getCardSize){t.next=7;break}return t.next=6,this.card.getCardSize();case 6:r=t.sent;case 7:return 1===r&&(null===(e=this._entities)||void 0===e?void 0:e.length)&&(r=this._entities.length),0===r&&(null===(n=this._config.filter)||void 0===n?void 0:n.include)&&(r=Object.keys(this._config.filter.include).length),t.abrupt("return",r||5);case 10:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"hidden",get:function(){return this.empty&&!1===this._config.show_empty&&void 0===this._config.else}}],[{key:"getConfigElement",value:function(){return document.createElement("auto-entities-editor")}},{key:"getStubConfig",value:function(){return{card:{type:"entities"},filter:{include:[],exclude:[]}}}}]);var e,n,r,i,o,a}();nt([de()],Gn.prototype,"_config",void 0),nt([de()],Gn.prototype,"hass",void 0),nt([de()],Gn.prototype,"card",void 0),nt([de()],Gn.prototype,"else",void 0),nt([de()],Gn.prototype,"_template",void 0),nt([fe()],Gn.prototype,"empty",void 0),customElements.get("auto-entities")||(customElements.define("auto-entities",Gn),console.groupCollapsed("%cAUTO-ENTITIES ".concat(_n," IS INSTALLED"),"color: green; font-weight: bold"),console.log("Readme:","https://github.com/thomasloven/lovelace-auto-entities"),console.groupEnd());