Files
HomeAssistance/www/community/lovelace-card-mod/card-mod.js
T
2026-06-05 22:34:31 -04:00

2 lines
97 KiB
JavaScript

var e,t,n,r,o,i,a,s;function u(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t,n){return(t=O(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},h.apply(this,arguments)}function f(e){return function(e){if(Array.isArray(e))return A(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||E(e)||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 p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,a,s=[],u=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,o=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,t)||E(e,t)||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 v(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_(e,t)}function y(e){var t=w();return function(){var n,r=k(e);if(t){var o=k(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===T(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}(this,n)}}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function b(e){var t="function"==typeof Map?new Map:void 0;return b=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return g(e,arguments,k(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)},b(e)}function g(e,t,n){return g=w()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&_(o,n.prototype),o},g.apply(null,arguments)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _(e,t){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_(e,t)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}function x(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=E(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 i,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw i}}}}function E(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?A(e,t):void 0}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,O(r.key),r)}}function C(e,t,n){return t&&S(e.prototype,t),n&&S(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function O(e){var t=function(e,t){if("object"!=T(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=T(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==T(t)?t:String(t)}function P(){P=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var i=t&&t.prototype instanceof m?t:m,a=Object.create(i.prototype),s=new j(r||[]);return o(a,"_invoke",{value:$(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var h="suspendedStart",f="suspendedYield",p="executing",v="completed",y={};function m(){}function b(){}function g(){}var w={};c(w,a,(function(){return this}));var _=Object.getPrototypeOf,k=_&&_(_(M([])));k&&k!==n&&r.call(k,a)&&(w=k);var x=g.prototype=m.prototype=Object.create(w);function E(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,t){function n(o,i,a,s){var u=d(e[o],e,i);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==T(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var i;o(this,"_invoke",{value:function(e,r){function o(){return new t((function(t,o){n(e,r,t,o)}))}return i=i?i.then(o,o):o()}})}function $(t,n,r){var o=h;return function(i,a){if(o===p)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:e,done:!0}}for(r.method=i,r.arg=a;;){var s=r.delegate;if(s){var u=S(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(o===h)throw o=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=p;var c=d(t,n,r);if("normal"===c.type){if(o=r.done?v:f,c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(o=v,r.method="throw",r.arg=c.arg)}}}function S(t,n){var r=n.method,o=t.iterator[r];if(o===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,S(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var i=d(o,t.iterator,n.arg);if("throw"===i.type)return n.method="throw",n.arg=i.arg,n.delegate=null,y;var a=i.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function M(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,i=function n(){for(;++o<t.length;)if(r.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}throw new TypeError(T(t)+" is not iterable")}return b.prototype=g,o(x,"constructor",{value:g,configurable:!0}),o(g,"constructor",{value:b,configurable:!0}),b.displayName=c(g,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,u,"GeneratorFunction")),e.prototype=Object.create(x),e},t.awrap=function(e){return{__await:e}},E(A.prototype),c(A.prototype,s,(function(){return this})),t.AsyncIterator=A,t.async=function(e,n,r,o,i){void 0===i&&(i=Promise);var a=new A(l(e,n,r,o),i);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(x),c(x,u,"Generator"),c(x,a,(function(){return this})),c(x,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=M,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(O),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(r,o){return s.type="throw",s.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("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 o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:M(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function T(e){return T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T(e)}function j(e,t,n,r,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,o)}function M(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function a(e){j(i,r,o,a,s,"next",e)}function s(e){j(i,r,o,a,s,"throw",e)}a(void 0)}))}}window.addEventListener("card-mod-bootstrap",function(){var e=M(P().mark((function e(t){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.stopPropagation(),document.addEventListener("ll-custom",(function(e){var t=e.detail;if(t&&"object"===T(t)){var n=t.card_mod;if(n&&"object"===T(n)){var r=n.action;if(r&&"string"==typeof r&&"function"==typeof N[r])try{var o=N[r]();o&&"function"==typeof o.catch&&o.catch((function(e){console.error('Error while executing action "'.concat(r,'":'),e)}))}catch(e){console.error('Error while executing action "'.concat(r,'":'),e)}}}}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());var N=function(){function e(){$(this,e)}var t;return C(e,null,[{key:"clear_cache",value:(t=M(P().mark((function e(){var t,n;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!window.caches){e.next=18;break}return e.prev=1,e.next=4,window.caches.keys();case 4:return t=e.sent,n=[],t.forEach((function(e){n.push(window.caches.delete(e))})),e.next=9,Promise.all(n);case 9:window.location.reload(),e.next=16;break;case 12:e.prev=12,e.t0=e.catch(1),console.error("Failed to clear caches:",e.t0),window.location.reload();case 16:e.next=19;break;case 18:window.location.reload();case 19:case"end":return e.stop()}}),e,null,[[1,12]])}))),function(){return t.apply(this,arguments)})}]),e}();function R(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"===("undefined"==typeof Reflect?"undefined":T(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}"function"==typeof SuppressedError&&SuppressedError;var L=globalThis,U=L.ShadowRoot&&(void 0===L.ShadyCSS||L.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,D=Symbol(),H=new WeakMap,I=function(){function e(t,n,r){if($(this,e),this._$cssResult$=!0,r!==D)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=n}return C(e,[{key:"styleSheet",get:function(){var e=this.o,t=this.t;if(U&&void 0===e){var n=void 0!==t&&1===t.length;n&&(e=H.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&H.set(t,e))}return e}},{key:"toString",value:function(){return this.cssText}}]),e}(),q=U?function(e){return e}:function(e){return e instanceof CSSStyleSheet?function(e){var t,n="",r=x(e.cssRules);try{for(r.s();!(t=r.n()).done;){n+=t.value.cssText}}catch(e){r.e(e)}finally{r.f()}return function(e){return new I("string"==typeof e?e:e+"",void 0,D)}(n)}(e):e},z=Object.is,V=Object.defineProperty,B=Object.getOwnPropertyDescriptor,W=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols,J=Object.getPrototypeOf,Y=globalThis,G=Y.trustedTypes,K=G?G.emptyScript:"",Z=Y.reactiveElementPolyfillSupport,X=function(e,t){return e},Q={toAttribute:function(e,t){switch(t){case Boolean:e=e?K:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute:function(e,t){var n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},ee=function(e,t){return!z(e,t)},te={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:ee};null!==(e=Symbol.metadata)&&void 0!==e||(Symbol.metadata=Symbol("metadata")),null!==(t=Y.litPropertyMetadata)&&void 0!==t||(Y.litPropertyMetadata=new WeakMap);var ne=function(e){v(r,b(HTMLElement));var t,n=y(r);function r(){var e;return $(this,r),(e=n.call(this))._$Ep=void 0,e.isUpdatePending=!1,e.hasUpdated=!1,e._$Em=null,e._$Ev(),e}return C(r,[{key:"_$Ev",value:function(){var e,t=this;this._$Eg=new Promise((function(e){return t.enableUpdating=e})),this._$AL=new Map,this._$ES(),this.requestUpdate(),null===(e=this.constructor.l)||void 0===e||e.forEach((function(e){return e(t)}))}},{key:"addController",value:function(e){var t,n;(null!==(t=this._$E_)&&void 0!==t?t:this._$E_=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&(null===(n=e.hostConnected)||void 0===n||n.call(e))}},{key:"removeController",value:function(e){var t;null===(t=this._$E_)||void 0===t||t.delete(e)}},{key:"_$ES",value:function(){var e,t=new Map,n=x(this.constructor.elementProperties.keys());try{for(n.s();!(e=n.n()).done;){var r=e.value;this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r])}}catch(e){n.e(e)}finally{n.f()}t.size>0&&(this._$Ep=t)}},{key:"createRenderRoot",value:function(){var e,t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return function(e,t){if(U)e.adoptedStyleSheets=t.map((function(e){return e instanceof CSSStyleSheet?e:e.styleSheet}));else{var n,r=x(t);try{for(r.s();!(n=r.n()).done;){var o=n.value,i=document.createElement("style"),a=L.litNonce;void 0!==a&&i.setAttribute("nonce",a),i.textContent=o.cssText,e.appendChild(i)}}catch(e){r.e(e)}finally{r.f()}}}(t,this.constructor.elementStyles),t}},{key:"connectedCallback",value:function(){var e,t;null!==(e=this.renderRoot)&&void 0!==e||(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$E_)||void 0===t||t.forEach((function(e){var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}},{key:"enableUpdating",value:function(e){}},{key:"disconnectedCallback",value:function(){var e;null===(e=this._$E_)||void 0===e||e.forEach((function(e){var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}},{key:"attributeChangedCallback",value:function(e,t,n){this._$AK(e,n)}},{key:"_$EO",value:function(e,t){var n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(void 0!==r&&!0===n.reflect){var o,i=(void 0!==(null===(o=n.converter)||void 0===o?void 0:o.toAttribute)?n.converter:Q).toAttribute(t,n.type);this._$Em=e,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}},{key:"_$AK",value:function(e,t){var n=this.constructor,r=n._$Eh.get(e);if(void 0!==r&&this._$Em!==r){var o,i=n.getPropertyOptions(r),a="function"==typeof i.converter?{fromAttribute:i.converter}:void 0!==(null===(o=i.converter)||void 0===o?void 0:o.fromAttribute)?i.converter:Q;this._$Em=r,this[r]=a.fromAttribute(t,i.type),this._$Em=null}}},{key:"requestUpdate",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;if(void 0!==e){var i,a;if(null!==(i=n)&&void 0!==i||(n=this.constructor.getPropertyOptions(e)),!(null!==(a=n.hasChanged)&&void 0!==a?a:ee)(r?o:this[e],t))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}},{key:"C",value:function(e,t,n){var r;this._$AL.has(e)||this._$AL.set(e,t),!0===n.reflect&&this._$Em!==e&&(null!==(r=this._$Ej)&&void 0!==r?r:this._$Ej=new Set).add(e)}},{key:"_$EP",value:(t=M(P().mark((function e(){var t;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isUpdatePending=!0,e.prev=1,e.next=4,this._$Eg;case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),Promise.reject(e.t0);case 9:if(t=this.scheduleUpdate(),e.t1=null!=t,!e.t1){e.next=14;break}return e.next=14,t;case 14:return e.abrupt("return",!this.isUpdatePending);case 15:case"end":return e.stop()}}),e,this,[[1,6]])}))),function(){return t.apply(this,arguments)})},{key:"scheduleUpdate",value:function(){return this.performUpdate()}},{key:"performUpdate",value:function(){if(this.isUpdatePending){if(!this.hasUpdated){var e;if(null!==(e=this.renderRoot)&&void 0!==e||(this.renderRoot=this.createRenderRoot()),this._$Ep){var t,n=x(this._$Ep);try{for(n.s();!(t=n.n()).done;){var r=p(t.value,2),o=r[0],i=r[1];this[o]=i}}catch(e){n.e(e)}finally{n.f()}this._$Ep=void 0}var a=this.constructor.elementProperties;if(a.size>0){var s,u=x(a);try{for(u.s();!(s=u.n()).done;){var c=p(s.value,2),l=c[0],d=c[1];!0!==d.wrapped||this._$AL.has(l)||void 0===this[l]||this.C(l,this[l],d)}}catch(e){u.e(e)}finally{u.f()}}}var h=!1,f=this._$AL;try{var v;(h=this.shouldUpdate(f))?(this.willUpdate(f),null!==(v=this._$E_)&&void 0!==v&&v.forEach((function(e){var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(f)):this._$ET()}catch(f){throw h=!1,this._$ET(),f}h&&this._$AE(f)}}},{key:"willUpdate",value:function(e){}},{key:"_$AE",value:function(e){var t;null!==(t=this._$E_)&&void 0!==t&&t.forEach((function(e){var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}},{key:"_$ET",value:function(){this._$AL=new Map,this.isUpdatePending=!1}},{key:"updateComplete",get:function(){return this.getUpdateComplete()}},{key:"getUpdateComplete",value:function(){return this._$Eg}},{key:"shouldUpdate",value:function(e){return!0}},{key:"update",value:function(e){var t=this;this._$Ej&&(this._$Ej=this._$Ej.forEach((function(e){return t._$EO(e,t[e])}))),this._$ET()}},{key:"updated",value:function(e){}},{key:"firstUpdated",value:function(e){}}],[{key:"addInitializer",value:function(e){var t;this._$Ei(),(null!==(t=this.l)&&void 0!==t?t:this.l=[]).push(e)}},{key:"observedAttributes",get:function(){return this.finalize(),this._$Eh&&f(this._$Eh.keys())}},{key:"createProperty",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:te;if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){var n=Symbol(),r=this.getPropertyDescriptor(e,n,t);void 0!==r&&V(this.prototype,e,r)}}},{key:"getPropertyDescriptor",value:function(e,t,n){var r,o=null!==(r=B(this.prototype,e))&&void 0!==r?r:{get:function(){return this[t]},set:function(e){this[t]=e}},i=o.get,a=o.set;return{get:function(){return null==i?void 0:i.call(this)},set:function(t){var r=null==i?void 0:i.call(this);a.call(this,t),this.requestUpdate(e,r,n)},configurable:!0,enumerable:!0}}},{key:"getPropertyOptions",value:function(e){var t;return null!==(t=this.elementProperties.get(e))&&void 0!==t?t:te}},{key:"_$Ei",value:function(){if(!this.hasOwnProperty(X("elementProperties"))){var e=J(this);e.finalize(),void 0!==e.l&&(this.l=f(e.l)),this.elementProperties=new Map(e.elementProperties)}}},{key:"finalize",value:function(){if(!this.hasOwnProperty(X("finalized"))){if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(X("properties"))){var e,t=this.properties,n=x([].concat(f(W(t)),f(F(t))));try{for(n.s();!(e=n.n()).done;){var r=e.value;this.createProperty(r,t[r])}}catch(e){n.e(e)}finally{n.f()}}var o=this[Symbol.metadata];if(null!==o){var i=litPropertyMetadata.get(o);if(void 0!==i){var a,s=x(i);try{for(s.s();!(a=s.n()).done;){var u=p(a.value,2),c=u[0],l=u[1];this.elementProperties.set(c,l)}}catch(e){s.e(e)}finally{s.f()}}}this._$Eh=new Map;var d,h=x(this.elementProperties);try{for(h.s();!(d=h.n()).done;){var v=p(d.value,2),y=v[0],m=v[1],b=this._$Eu(y,m);void 0!==b&&this._$Eh.set(b,y)}}catch(e){h.e(e)}finally{h.f()}this.elementStyles=this.finalizeStyles(this.styles)}}},{key:"finalizeStyles",value:function(e){var t=[];if(Array.isArray(e)){var n,r=x(new Set(e.flat(1/0).reverse()));try{for(r.s();!(n=r.n()).done;){var o=n.value;t.unshift(q(o))}}catch(e){r.e(e)}finally{r.f()}}else void 0!==e&&t.push(q(e));return t}},{key:"_$Eu",value:function(e,t){var n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}}]),r}();ne.elementStyles=[],ne.shadowRootOptions={mode:"open"},ne[X("elementProperties")]=new Map,ne[X("finalized")]=new Map,null!=Z&&Z({ReactiveElement:ne}),(null!==(n=Y.reactiveElementVersions)&&void 0!==n?n:Y.reactiveElementVersions=[]).push("2.0.2");var re=globalThis,oe=re.trustedTypes,ie=oe?oe.createPolicy("lit-html",{createHTML:function(e){return e}}):void 0,ae="$lit$",se="lit$".concat((Math.random()+"").slice(9),"$"),ue="?"+se,ce="<".concat(ue,">"),le=document,de=function(){return le.createComment("")},he=function(e){return null===e||"object"!=T(e)&&"function"!=typeof e},fe=Array.isArray,pe="[ \t\n\f\r]",ve=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ye=/-->/g,me=/>/g,be=RegExp(">|".concat(pe,"(?:([^\\s\"'>=/]+)(").concat(pe,"*=").concat(pe,"*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)"),"g"),ge=/'/g,we=/"/g,_e=/^(?:script|style|textarea|title)$/i,ke=function(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return{_$litType$:e,strings:t,values:r}}}(1),xe=Symbol.for("lit-noChange"),Ee=Symbol.for("lit-nothing"),Ae=new WeakMap,$e=le.createTreeWalker(le,129);function Se(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==ie?ie.createHTML(t):t}var Ce=function(e,t){for(var n,r=e.length-1,o=[],i=2===t?"<svg>":"",a=ve,s=0;s<r;s++){for(var u=e[s],c=void 0,l=void 0,d=-1,h=0;h<u.length&&(a.lastIndex=h,null!==(l=a.exec(u)));){var f;h=a.lastIndex,a===ve?"!--"===l[1]?a=ye:void 0!==l[1]?a=me:void 0!==l[2]?(_e.test(l[2])&&(n=RegExp("</"+l[2],"g")),a=be):void 0!==l[3]&&(a=be):a===be?">"===l[0]?(a=null!==(f=n)&&void 0!==f?f:ve,d=-1):void 0===l[1]?d=-2:(d=a.lastIndex-l[2].length,c=l[1],a=void 0===l[3]?be:'"'===l[3]?we:ge):a===we||a===ge?a=be:a===ye||a===me?a=ve:(a=be,n=void 0)}var p=a===be&&e[s+1].startsWith("/>")?" ":"";i+=a===ve?u+ce:d>=0?(o.push(c),u.slice(0,d)+ae+u.slice(d)+se+p):u+se+(-2===d?s:p)}return[Se(e,i+(e[r]||"<?>")+(2===t?"</svg>":"")),o]},Oe=function(){function e(t,n){var r,o=t.strings,i=t._$litType$;$(this,e),this.parts=[];var a=0,s=0,u=o.length-1,c=this.parts,l=p(Ce(o,i),2),d=l[0],h=l[1];if(this.el=e.createElement(d,n),$e.currentNode=this.el.content,2===i){var v=this.el.content.firstChild;v.replaceWith.apply(v,f(v.childNodes))}for(;null!==(r=$e.nextNode())&&c.length<u;){if(1===r.nodeType){if(r.hasAttributes()){var y,m=x(r.getAttributeNames());try{for(m.s();!(y=m.n()).done;){var b=y.value;if(b.endsWith(ae)){var g=h[s++],w=r.getAttribute(b).split(se),_=/([.?@])?(.*)/.exec(g);c.push({type:1,index:a,name:_[2],strings:w,ctor:"."===_[1]?Ne:"?"===_[1]?Re:"@"===_[1]?Le:Me}),r.removeAttribute(b)}else b.startsWith(se)&&(c.push({type:6,index:a}),r.removeAttribute(b))}}catch(e){m.e(e)}finally{m.f()}}if(_e.test(r.tagName)){var k=r.textContent.split(se),E=k.length-1;if(E>0){r.textContent=oe?oe.emptyScript:"";for(var A=0;A<E;A++)r.append(k[A],de()),$e.nextNode(),c.push({type:2,index:++a});r.append(k[E],de())}}}else if(8===r.nodeType)if(r.data===ue)c.push({type:2,index:a});else for(var S=-1;-1!==(S=r.data.indexOf(se,S+1));)c.push({type:7,index:a}),S+=se.length-1;a++}}return C(e,null,[{key:"createElement",value:function(e,t){var n=le.createElement("template");return n.innerHTML=e,n}}]),e}();function Pe(e,t){var n,r,o,i,a,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,u=arguments.length>3?arguments[3]:void 0;if(t===xe)return t;var c=void 0!==u?null===(n=s._$Co)||void 0===n?void 0:n[u]:s._$Cl,l=he(t)?void 0:t._$litDirective$;return(null===(r=c)||void 0===r?void 0:r.constructor)!==l&&(null!==(o=c)&&void 0!==o&&null!==(i=o._$AO)&&void 0!==i&&i.call(o,!1),void 0===l?c=void 0:(c=new l(e))._$AT(e,s,u),void 0!==u?(null!==(a=s._$Co)&&void 0!==a?a:s._$Co=[])[u]=c:s._$Cl=c),void 0!==c&&(t=Pe(e,c._$AS(e,t.values),c,u)),t}var Te=function(){function e(t,n){$(this,e),this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=n}return C(e,[{key:"parentNode",get:function(){return this._$AM.parentNode}},{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"u",value:function(e){var t,n=this._$AD,r=n.el.content,o=n.parts,i=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:le).importNode(r,!0);$e.currentNode=i;for(var a=$e.nextNode(),s=0,u=0,c=o[0];void 0!==c;){var l;if(s===c.index){var d=void 0;2===c.type?d=new je(a,a.nextSibling,this,e):1===c.type?d=new c.ctor(a,c.name,c.strings,this,e):6===c.type&&(d=new Ue(a,this,e)),this._$AV.push(d),c=o[++u]}s!==(null===(l=c)||void 0===l?void 0:l.index)&&(a=$e.nextNode(),s++)}return $e.currentNode=le,i}},{key:"p",value:function(e){var t,n=0,r=x(this._$AV);try{for(r.s();!(t=r.n()).done;){var o=t.value;void 0!==o&&(void 0!==o.strings?(o._$AI(e,o,n),n+=o.strings.length-2):o._$AI(e[n])),n++}}catch(e){r.e(e)}finally{r.f()}}}]),e}(),je=function(){function e(t,n,r,o){var i;$(this,e),this.type=2,this._$AH=Ee,this._$AN=void 0,this._$AA=t,this._$AB=n,this._$AM=r,this.options=o,this._$Cv=null===(i=null==o?void 0:o.isConnected)||void 0===i||i}return C(e,[{key:"_$AU",get:function(){var e,t;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cv}},{key:"parentNode",get:function(){var e,t=this._$AA.parentNode,n=this._$AM;return void 0!==n&&11===(null===(e=t)||void 0===e?void 0:e.nodeType)&&(t=n.parentNode),t}},{key:"startNode",get:function(){return this._$AA}},{key:"endNode",get:function(){return this._$AB}},{key:"_$AI",value:function(e){e=Pe(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this),he(e)?e===Ee||null==e||""===e?(this._$AH!==Ee&&this._$AR(),this._$AH=Ee):e!==this._$AH&&e!==xe&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):function(e){return fe(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator])}(e)?this.T(e):this._(e)}},{key:"k",value:function(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}},{key:"$",value:function(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}},{key:"_",value:function(e){this._$AH!==Ee&&he(this._$AH)?this._$AA.nextSibling.data=e:this.$(le.createTextNode(e)),this._$AH=e}},{key:"g",value:function(e){var t,n=e.values,r=e._$litType$,o="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Oe.createElement(Se(r.h,r.h[0]),this.options)),r);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===o)this._$AH.p(n);else{var i=new Te(o,this),a=i.u(this.options);i.p(n),this.$(a),this._$AH=i}}},{key:"_$AC",value:function(e){var t=Ae.get(e.strings);return void 0===t&&Ae.set(e.strings,t=new Oe(e)),t}},{key:"T",value:function(t){fe(this._$AH)||(this._$AH=[],this._$AR());var n,r,o=this._$AH,i=0,a=x(t);try{for(a.s();!(r=a.n()).done;){var s=r.value;i===o.length?o.push(n=new e(this.k(de()),this.k(de()),this,this.options)):n=o[i],n._$AI(s),i++}}catch(e){a.e(e)}finally{a.f()}i<o.length&&(this._$AR(n&&n._$AB.nextSibling,i),o.length=i)}},{key:"_$AR",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._$AA.nextSibling,t=arguments.length>1?arguments[1]:void 0;for(null===(n=this._$AP)||void 0===n||n.call(this,!1,!0,t);e&&e!==this._$AB;){var n,r=e.nextSibling;e.remove(),e=r}}},{key:"setConnected",value:function(e){var t;void 0===this._$AM&&(this._$Cv=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}]),e}(),Me=function(){function e(t,n,r,o,i){$(this,e),this.type=1,this._$AH=Ee,this._$AN=void 0,this.element=t,this.name=n,this._$AM=o,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=Ee}return C(e,[{key:"tagName",get:function(){return this.element.tagName}},{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AI",value:function(e){var t=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,o=this.strings,i=!1;if(void 0===o)e=Pe(this,e,t,0),(i=!he(e)||e!==this._$AH&&e!==xe)&&(this._$AH=e);else{var a,s,u=e;for(e=o[0],a=0;a<o.length-1;a++){var c;(s=Pe(this,u[n+a],t,a))===xe&&(s=this._$AH[a]),i||(i=!he(s)||s!==this._$AH[a]),s===Ee?e=Ee:e!==Ee&&(e+=(null!==(c=s)&&void 0!==c?c:"")+o[a+1]),this._$AH[a]=s}}i&&!r&&this.O(e)}},{key:"O",value:function(e){e===Ee?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}]),e}(),Ne=function(e){v(n,Me);var t=y(n);function n(){var e;return $(this,n),(e=t.apply(this,arguments)).type=3,e}return C(n,[{key:"O",value:function(e){this.element[this.name]=e===Ee?void 0:e}}]),n}(),Re=function(e){v(n,Me);var t=y(n);function n(){var e;return $(this,n),(e=t.apply(this,arguments)).type=4,e}return C(n,[{key:"O",value:function(e){this.element.toggleAttribute(this.name,!!e&&e!==Ee)}}]),n}(),Le=function(e){v(n,Me);var t=y(n);function n(e,r,o,i,a){var s;return $(this,n),(s=t.call(this,e,r,o,i,a)).type=5,s}return C(n,[{key:"_$AI",value:function(e){var t;if((e=null!==(t=Pe(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this,0))&&void 0!==t?t:Ee)!==xe){var n=this._$AH,r=e===Ee&&n!==Ee||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==Ee&&(n===Ee||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}}},{key:"handleEvent",value:function(e){var t,n;"function"==typeof this._$AH?this._$AH.call(null!==(t=null===(n=this.options)||void 0===n?void 0:n.host)&&void 0!==t?t:this.element,e):this._$AH.handleEvent(e)}}]),n}(),Ue=function(){function e(t,n,r){$(this,e),this.element=t,this.type=6,this._$AN=void 0,this._$AM=n,this.options=r}return C(e,[{key:"_$AU",get:function(){return this._$AM._$AU}},{key:"_$AI",value:function(e){Pe(this,e)}}]),e}(),De=re.litHtmlPolyfillSupport;null!=De&&De(Oe,je),(null!==(r=re.litHtmlVersions)&&void 0!==r?r:re.litHtmlVersions=[]).push("3.1.0");var He=function(e){v(n,ne);var t=y(n);function n(){var e;return $(this,n),(e=t.apply(this,arguments)).renderOptions={host:m(e)},e._$Do=void 0,e}return C(n,[{key:"createRenderRoot",value:function(){var e,t,r=h(k(n.prototype),"createRenderRoot",this).call(this);return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=r.firstChild),r}},{key:"update",value:function(e){var t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),h(k(n.prototype),"update",this).call(this,e),this._$Do=function(e,t,n){var r,o=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:t,i=o._$litPart$;if(void 0===i){var a,s=null!==(a=null==n?void 0:n.renderBefore)&&void 0!==a?a:null;o._$litPart$=i=new je(t.insertBefore(de(),s),s,void 0,null!=n?n:{})}return i._$AI(e),i}(t,this.renderRoot,this.renderOptions)}},{key:"connectedCallback",value:function(){var e;h(k(n.prototype),"connectedCallback",this).call(this),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}},{key:"disconnectedCallback",value:function(){var e;h(k(n.prototype),"disconnectedCallback",this).call(this),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}},{key:"render",value:function(){return xe}}]),n}();He._$litElement$=!0,He.finalized=!0,null===(o=globalThis.litElementHydrateSupport)||void 0===o||o.call(globalThis,{LitElement:He});var Ie=globalThis.litElementPolyfillSupport;null==Ie||Ie({LitElement:He}),(null!==(i=globalThis.litElementVersions)&&void 0!==i?i:globalThis.litElementVersions=[]).push("4.0.2");var qe,ze={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:ee};function Ve(e){return function(t,n){return"object"==T(n)?function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ze,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=n.kind,o=n.metadata,i=globalThis.litPropertyMetadata.get(o);if(void 0===i&&globalThis.litPropertyMetadata.set(o,i=new Map),i.set(n.name,e),"accessor"===r){var a=n.name;return{set:function(n){var r=t.get.call(this);t.set.call(this,n),this.requestUpdate(a,r,e)},init:function(t){return void 0!==t&&this.C(a,void 0,e),t}}}if("setter"===r){var s=n.name;return function(n){var r=this[s];t.call(this,n),this.requestUpdate(s,r,e)}}throw Error("Unsupported decorator location: "+r)}(e,t,n):function(e,t,n){var r=t.hasOwnProperty(n);return t.constructor.createProperty(n,r?l(l({},e),{},{wrapped:!0}):e),r?Object.getOwnPropertyDescriptor(t,n):void 0}(e,t,n)}}var Be=new WeakMap,We=function(){},Fe=function(){function e(t){var n=this;$(this,e),this.subscribers=[],this.settlement=null,this[qe]="Unpromise",this.promise="function"==typeof t?new Promise(t):t;var r=this.promise.then((function(e){var t=n.subscribers;n.subscribers=null,n.settlement={status:"fulfilled",value:e},null==t||t.forEach((function(t){(0,t.resolve)(e)}))}));"catch"in r&&r.catch((function(e){var t=n.subscribers;n.subscribers=null,n.settlement={status:"rejected",reason:e},null==t||t.forEach((function(t){(0,t.reject)(e)}))}))}var t,n,r;return C(e,[{key:"subscribe",value:function(){var e,t,n=this,r=this.settlement;if(null===r){if(null===this.subscribers)throw new Error("Unpromise settled but still has subscribers");var o=function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),resolve:e,reject:t}}();this.subscribers=function(e,t){return[].concat(f(e),[t])}(this.subscribers,o),e=o.promise,t=function(){null!==n.subscribers&&(n.subscribers=function(e,t){var n=e.indexOf(t);return-1!==n?function(e,t){return[].concat(f(e.slice(0,t)),f(e.slice(t+1)))}(e,n):e}(n.subscribers,o))}}else{e="fulfilled"===r.status?Promise.resolve(r.value):Promise.reject(r.reason),t=We}return Object.assign(e,{unsubscribe:t})}},{key:"then",value:function(e,t){var n=this.subscribe(),r=n.unsubscribe;return Object.assign(n.then(e,t),{unsubscribe:r})}},{key:"catch",value:function(e){var t=this.subscribe(),n=t.unsubscribe;return Object.assign(t.catch(e),{unsubscribe:n})}},{key:"finally",value:function(e){var t=this.subscribe(),n=t.unsubscribe;return Object.assign(t.finally(e),{unsubscribe:n})}}],[{key:"proxy",value:function(t){var n=e.getSubscribablePromise(t);return T(n)<"u"?n:e.createSubscribablePromise(t)}},{key:"createSubscribablePromise",value:function(t){var n=new e(t);return Be.set(t,n),Be.set(n,n),n}},{key:"getSubscribablePromise",value:function(e){return Be.get(e)}},{key:"resolve",value:function(t){var n="object"==T(t)&&null!==t&&"then"in t&&"function"==typeof t.then?t:Promise.resolve(t);return e.proxy(n).subscribe()}},{key:"any",value:(r=M(P().mark((function t(n){var r;return P().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=(Array.isArray(n)?n:f(n)).map(e.resolve),t.prev=1,t.next=4,Promise.any(r);case 4:return t.abrupt("return",t.sent);case 5:return t.prev=5,r.forEach((function(e){(0,e.unsubscribe)()})),t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])}))),function(e){return r.apply(this,arguments)})},{key:"race",value:(n=M(P().mark((function t(n){var r;return P().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=(Array.isArray(n)?n:f(n)).map(e.resolve),t.prev=1,t.next=4,Promise.race(r);case 4:return t.abrupt("return",t.sent);case 5:return t.prev=5,r.forEach((function(e){(0,e.unsubscribe)()})),t.finish(5);case 8:case"end":return t.stop()}}),t,null,[[1,,5,8]])}))),function(e){return n.apply(this,arguments)})},{key:"raceReferences",value:(t=M(P().mark((function e(t){var n,r,o;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.map(Ye),e.prev=1,e.next=4,Promise.race(n);case 4:return e.abrupt("return",e.sent);case 5:e.prev=5,r=x(n);try{for(r.s();!(o=r.n()).done;)o.value.unsubscribe()}catch(e){r.e(e)}finally{r.f()}return e.finish(5);case 9:case"end":return e.stop()}}),e,null,[[1,,5,9]])}))),function(e){return t.apply(this,arguments)})}]),e}();qe=Symbol.toStringTag;var Je=Fe;function Ye(e){return Je.proxy(e).then((function(){return[e]}))}function Ge(){return Ke.apply(this,arguments)}function Ke(){return Ke=M(P().mark((function e(){var t;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Je.race([customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")]);case 2:t=customElements.get("home-assistant")?"home-assistant":"hc-main";case 3:if(document.querySelector(t)){e.next=8;break}return e.next=6,new Promise((function(e){return window.setTimeout(e,100)}));case 6:e.next=3;break;case 8:return e.abrupt("return",document.querySelector(t));case 9:case"end":return e.stop()}}),e)}))),Ke.apply(this,arguments)}function Ze(){return Xe.apply(this,arguments)}function Xe(){return Xe=M(P().mark((function e(){var t;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ge();case 2:t=e.sent;case 3:if(t.hass){e.next=8;break}return e.next=6,new Promise((function(e){return window.setTimeout(e,100)}));case 6:e.next=3;break;case 8:return e.abrupt("return",t.hass);case 9:case"end":return e.stop()}}),e)}))),Xe.apply(this,arguments)}var Qe="browser_mod-browser-id";var et="SELECTTREE-TIMEOUT";function tt(e){return nt.apply(this,arguments)}function nt(){return nt=M(P().mark((function e(t){var n,r,o,i=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.length>1&&void 0!==i[1]&&i[1],!(null===(r=t.localName)||void 0===r?void 0:r.includes("-"))){e.next=4;break}return e.next=4,customElements.whenDefined(t.localName);case 4:if(!t.updateComplete){e.next=7;break}return e.next=7,t.updateComplete;case 7:if(!n){e.next=18;break}if(!t.pageRendered){e.next=11;break}return e.next=11,t.pageRendered;case 11:if(!t._panelState){e.next=18;break}o=0;case 13:if(!("loaded"!==t._panelState&&o++<5)){e.next=18;break}return e.next=16,new Promise((function(e){return setTimeout(e,100)}));case 16:e.next=13;break;case 18:case"end":return e.stop()}}),e)}))),nt.apply(this,arguments)}function rt(e,t){return ot.apply(this,arguments)}function ot(){return ot=M(P().mark((function e(t,n){var r,o,i,a,s,u,c,l=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=l.length>2&&void 0!==l[2]&&l[2],o=[t],"string"==typeof n&&(n=n.split(/(\$| )/));""===n[n.length-1];)n.pop();i=x(n.entries()),e.prev=5,i.s();case 7:if((a=i.n()).done){e.next=24;break}if(s=p(a.value,2),s[0],"$"!==(u=s[1])){e.next=14;break}return e.next=12,Promise.all(f(o).map((function(e){return tt(e)})));case 12:return o=f(o).map((function(e){return e.shadowRoot})),e.abrupt("continue",22);case 14:if(c=o[0]){e.next=17;break}return e.abrupt("return",null);case 17:if(u.trim().length){e.next=19;break}return e.abrupt("continue",22);case 19:return e.next=21,tt(c);case 21:o=c.querySelectorAll(u);case 22:e.next=7;break;case 24:e.next=29;break;case 26:e.prev=26,e.t0=e.catch(5),i.e(e.t0);case 29:return e.prev=29,i.f(),e.finish(29);case 32:return e.abrupt("return",r?o:o[0]);case 33:case"end":return e.stop()}}),e,null,[[5,26,29,32]])}))),ot.apply(this,arguments)}function it(e,t){return at.apply(this,arguments)}function at(){return at=M(P().mark((function e(t,n){var r,o,i=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>2&&void 0!==i[2]&&i[2],o=i.length>3&&void 0!==i[3]?i[3]:1e4,e.abrupt("return",Je.race([rt(t,n,r),new Promise((function(e,t){return setTimeout((function(){return t(new Error(et))}),o)}))]).catch((function(e){if(!e.message||e.message!==et)throw e;return null})));case 3:case"end":return e.stop()}}),e)}))),at.apply(this,arguments)}var st=null;function ut(e){return ct.apply(this,arguments)}function ct(){return ct=M(P().mark((function e(t){var n,r,o;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=function(){return o=M(P().mark((function e(t){var n;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,it(t,"home-assistant $ home-assistant-main $ partial-panel-resolver>*");case 2:if(n=e.sent){e.next=7;break}return e.next=6,it(t,"hc-main $ hc-lovelace");case 6:n=e.sent;case 7:if(n){e.next=11;break}return e.next=10,it(t,"hc-main $ hc-lovelace");case 10:n=e.sent;case 11:return e.abrupt("return",n);case 12:case"end":return e.stop()}}),e)}))),o.apply(this,arguments)},r=function(e){return o.apply(this,arguments)},e.next=4,r(t);case 4:n=e.sent;case 5:if(null!==n){e.next=13;break}return e.next=8,new Promise((function(e){return setTimeout(e,100)}));case 8:return e.next=10,r(t);case 10:n=e.sent,e.next=5;break;case 13:return e.abrupt("return",n);case 14:case"end":return e.stop()}}),e)}))),ct.apply(this,arguments)}function lt(e){var t,n,r;if(null===(t=null==e?void 0:e.hass)||void 0===t?void 0:t.localize){var o=function(e){return"lovelace"===(null==e?void 0:e.url_path)?"panel.states":"profile"===(null==e?void 0:e.url_path)?"panel.profile":"panel.".concat(null==e?void 0:e.title)}(e.panel);return e.hass.localize(o)||(null===(n=e.panel)||void 0===n?void 0:n.title)||""}return(null===(r=null==e?void 0:e.panel)||void 0===r?void 0:r.title)||""}function dt(e){var t,n,r,o,i;return{panelTitle:lt(e),panelUrlPath:(null===(n=null===(t=null==e?void 0:e.route)||void 0===t?void 0:t.prefix)||void 0===n?void 0:n.replace(/^\/|\/$/g,""))||"",panelComponentName:(null===(r=null==e?void 0:e.panel)||void 0===r?void 0:r.component_name)||"",panelIcon:(null===(o=null==e?void 0:e.panel)||void 0===o?void 0:o.icon)||"",panelNarrow:(null==e?void 0:e.narrow)||!1,panelRequireAdmin:(null===(i=null==e?void 0:e.panel)||void 0===i?void 0:i.require_admin)||!1}}function ht(e){return ft.apply(this,arguments)}function ft(){return ft=M(P().mark((function e(t){var n,r,o,i,a,s,u,c,l,d,h,f,p;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("lovelace"===(null===(n=null==t?void 0:t.panel)||void 0===n?void 0:n.component_name)){e.next=2;break}return e.abrupt("return",{viewTitle:"",viewUrlPath:(null===(o=null===(r=null==t?void 0:t.route)||void 0===r?void 0:r.path)||void 0===o?void 0:o.replace(/^\/|\/$/g,""))||"",viewNarrow:(null==t?void 0:t.narrow)||!1});case 2:h=0;case 3:if((null===(i=t.shadowRoot)||void 0===i?void 0:i.querySelector("hui-root"))||!(h<100)){e.next=9;break}return e.next=6,new Promise((function(e){return setTimeout(e,10)}));case 6:h++,e.next=3;break;case 9:if(f=t.shadowRoot.querySelector("hui-root")){e.next=12;break}return e.abrupt("return",{});case 12:return p=f._curView||0,e.abrupt("return",{viewTitle:(null===(u=null===(s=null===(a=f.config)||void 0===a?void 0:a.views)||void 0===s?void 0:s[p])||void 0===u?void 0:u.title)||"",viewUrlPath:(null===(d=null===(l=null===(c=f.config)||void 0===c?void 0:c.views)||void 0===l?void 0:l[p])||void 0===d?void 0:d.path)||"".concat(p),viewNarrow:f.narrow||!1});case 14:case"end":return e.stop()}}),e)}))),ft.apply(this,arguments)}function pt(){return vt.apply(this,arguments)}function vt(){return(vt=M(P().mark((function e(){var t,n,r,o,i;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ut(document);case 2:return t=e.sent,n=dt(t),e.next=6,ht(t);case 6:return r=e.sent,o=[],n.panelTitle&&o.push(n.panelTitle),r.viewTitle&&o.push(r.viewTitle),i=[],n.panelUrlPath&&i.push(n.panelUrlPath),r.viewUrlPath&&i.push(r.viewUrlPath),e.abrupt("return",{hash:location.hash.substr(1)||"",panel:Object.assign(Object.assign({title:o.join(" - "),fullUrlPath:i.join("/")},n),r)});case 14:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function yt(){var e=function(){var e=M(P().mark((function e(){var t,n,r,o;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,pt();case 2:t=e.sent,n=window.location.pathname.slice(1).toLowerCase(),r=t.panel.fullUrlPath.toLowerCase(),o=0;case 6:if(!(n!==r&&o++<200)){e.next=16;break}return e.next=9,new Promise((function(e){return setTimeout(e,10)}));case 9:return e.next=11,pt();case 11:t=e.sent,n=window.location.pathname.slice(1).toLowerCase(),r=t.panel.fullUrlPath.toLowerCase(),e.next=6;break;case 16:return n!==r&&(console.groupCollapsed("Card-mod: cannot resolve Panel information after 2s."),console.log("Browser path:",n),console.log("Panel path:",r),console.log("Final panel state:",t),console.groupEnd()),e.abrupt("return",t);case 18:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();st=new Promise((function(t){return t(e())}))}window.addEventListener("card-mod-bootstrap",function(){var e=M(P().mark((function e(t){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.stopPropagation(),["popstate","location-changed"].forEach((function(e){window.addEventListener(e,M(P().mark((function e(){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:st=null,yt(),st.then((function(){document.dispatchEvent(new CustomEvent("cm_update",{detail:{variablesChanged:!0}}))}));case 3:case"end":return e.stop()}}),e)}))))}));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),window.cardMod_template_cache=window.cardMod_template_cache||{};var mt=window.cardMod_template_cache;function bt(e,t){var n=mt[e];n&&("error"in t?(n.error=t,n.value="",n.debug&&(console.groupCollapsed("CardMod: Template ".concat(n.error.level)),console.log({template:n.template,variables:n.variables,value:n.value,error:n.error}),console.groupEnd())):(n.value=t.result,n.debug&&(console.groupCollapsed("CardMod: Template updated"),console.log({template:n.template,variables:n.variables,value:n.value,error:n.error}),console.groupEnd())),n.callbacks.forEach((function(e){return e(n.value)})))}function gt(e,t,n){return wt.apply(this,arguments)}function wt(){return(wt=M(P().mark((function e(t,n,r){var o,i,a,s,u,c;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ze();case 2:return o=e.sent,e.next=5,st||yt(),st;case 5:i=e.sent,a=o.connection,r=Object.assign(Object.assign({user:o.user.name,browser:document.querySelector("hc-main")?"CAST":localStorage[Qe]?localStorage[Qe]:""},i),r),s=JSON.stringify([n,r]),(u=mt[s])?(u.debug&&(console.groupCollapsed("CardMod: Reusing template"),console.log({template:u.template,variables:u.variables,value:u.value,error:u.error}),console.groupEnd()),u.callbacks.has(t)||_t(t),t(u.value),u.callbacks.add(t),u.cooldownTimeoutID&&clearTimeout(u.cooldownTimeoutID),u.cooldownTimeoutID=void 0):(c=!1,_t(t),t(""),n.includes("card_mod.debug")&&(c=!0,console.groupCollapsed("CardMod: Binding template"),console.log({template:n,variables:r}),console.groupEnd()),mt[s]=u={template:n,variables:r,value:"",callbacks:new Set([t]),debug:c,unsubscribe:a.subscribeMessage((function(e){return bt(s,e)}),{type:"render_template",template:n,variables:r,report_errors:c})});case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _t(e){return kt.apply(this,arguments)}function kt(){return(kt=M(P().mark((function e(t){var n,r,o,i,a;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0,r=Object.entries(mt);case 1:if(!(n<r.length)){e.next=10;break}if(o=p(r[n],2),i=o[0],!(a=o[1]).callbacks.has(t)){e.next=7;break}return a.callbacks.delete(t),0==a.callbacks.size&&(a.debug&&(console.groupCollapsed("CardMod: Template unbound and will be unsubscribed after cooldown"),console.log({template:a.template,variables:a.variables}),console.groupEnd()),a.cooldownTimeoutID=window.setTimeout(xt,2e4,i)),e.abrupt("break",10);case 7:n++,e.next=1;break;case 10:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xt(e){return Et.apply(this,arguments)}function Et(){return(Et=M(P().mark((function e(t){var n;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=mt[t]){e.next=3;break}return e.abrupt("return");case 3:return n.cooldownTimeoutID&&clearTimeout(n.cooldownTimeoutID),n.debug&&(console.groupCollapsed("CardMod: Unsubscribing template after cooldown"),console.log({template:n.template,variables:n.variables}),console.groupEnd()),delete mt[t],e.next=8,n.unsubscribe;case 8:return e.t0=e.sent,e.next=11,(0,e.t0)();case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var At={name:"card-mod",private:!0,version:"4.2.1",description:"",scripts:{build:"rollup -c",watch:"rollup -c --watch"},keywords:[],author:"Thomas Lovén",license:"MIT",devDependencies:{"@babel/core":"^7.23.6","@babel/preset-env":"^7.23.6","@rollup/plugin-babel":"^6.0.4","@rollup/plugin-json":"^6.1.0","@rollup/plugin-node-resolve":"^15.2.3",rollup:"^2.79.2","rollup-plugin-terser":"^7.0.2","rollup-plugin-typescript2":"^0.36.0",typescript:"^5.3.3"},dependencies:{"@watchable/unpromise":"^1.0.2",lit:"^3.1.0",tslib:"^2.6.2"}},$t=function(){var e=M(P().mark((function e(){var t,n,r,o;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!customElements.get("developer-tools-event")){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,e.next=5,customElements.whenDefined("partial-panel-resolver");case 5:return(n=document.createElement("partial-panel-resolver")).hass={panels:[{url_path:"tmp",component_name:"config"}]},n._updateRoutes(),e.next=10,n.routerOptions.routes.tmp.load();case 10:return e.next=12,customElements.whenDefined("ha-panel-config");case 12:return r=document.createElement("ha-panel-config"),e.next=15,null===(t=r.routerOptions.routes["developer-tools"])||void 0===t?void 0:t.load();case 15:return e.next=17,customElements.whenDefined("developer-tools-router");case 17:return o=document.createElement("developer-tools-router"),e.next=20,o.routerOptions.routes.event.load();case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(2),console.error("CARD-MOD: Error loading yaml2json:",e.t0);case 25:case"end":return e.stop()}}),e,null,[[2,22]])})));return function(){return e.apply(this,arguments)}}(),St=function(){var e=M(P().mark((function e(t){var n;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,$t();case 2:if((n=document.createElement("ha-yaml-editor")).hass={},n.hass.localize=function(e){return"Invalid YAML"},n._onChange(new CustomEvent("yaml",{detail:{value:t}})),n.isValid){e.next=9;break}return console.error("CARD-MOD: Error loading theme yaml:",t),e.abrupt("return",{});case 9:return e.abrupt("return",n.value);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function Ct(){document.dispatchEvent(new Event("cm_update"))}var Ot=[customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")];function Pt(){function e(e){return(null==e?void 0:e.themes)&&(null==e?void 0:e.themes.themes)&&(null==e?void 0:e.themes.theme)}return new Promise((function(t,n){var r=!1;M(P().mark((function o(){var i,a;return P().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,Ze();case 2:if(!e(o.sent)){o.next=7;break}return r=!0,t(),o.abrupt("return");case 7:i=window.setInterval(M(P().mark((function n(){return P().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Ze();case 2:e(n.sent)&&(r||(r=!0,clearInterval(i),clearTimeout(a),t()));case 4:case"end":return n.stop()}}),n)}))),500),a=window.setTimeout((function(){r||(r=!0,clearInterval(i),n(new Error("themesReady: Timeout waiting for themes to become ready")))}),3e4);case 9:case"end":return o.stop()}}),o)})))()}))}function Tt(e){if(!e)return!1;var t=e.trim().toLowerCase();return"true"===t||"1"===t||"yes"===t||"on"===t}function jt(e){return Mt.apply(this,arguments)}function Mt(){return Mt=M(P().mark((function e(t){var n,r,o,i,a,s,u,c,l,d;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.type){e.next=2;break}return e.abrupt("return",null);case 2:return e.next=4,Pt();case 4:r=t.parentElement?t.parentElement:t,o=window.getComputedStyle(r),i=o.getPropertyValue("--card-mod-theme"),a=!1,Tt(o.getPropertyValue("--card-mod-".concat(t.type,"-debug")))&&(a=!0),s=x(t.classes),e.prev=11,s.s();case 13:if((u=s.n()).done){e.next=21;break}if(c=u.value,!Tt(o.getPropertyValue("--card-mod-".concat(t.type,"-").concat(c,"-debug")))){e.next=19;break}return a=!0,e.abrupt("break",21);case 19:e.next=13;break;case 21:e.next=26;break;case 23:e.prev=23,e.t0=e.catch(11),s.e(e.t0);case 26:return e.prev=26,s.f(),e.finish(26);case 29:return t.debug||(t.debug=!!a),t.debug&&console.log("CardMod Debug: Theme:",i),e.next=33,Ze();case 33:if(l=e.sent){e.next=36;break}return e.abrupt("return",{});case 36:if((d=null!==(n=null==l?void 0:l.themes.themes)&&void 0!==n?n:{})[i]){e.next=39;break}return e.abrupt("return",{});case 39:if(!d[i]["card-mod-".concat(t.type,"-yaml")]){e.next=43;break}return e.abrupt("return",St(d[i]["card-mod-".concat(t.type,"-yaml")]));case 43:if(!d[i]["card-mod-".concat(t.type)]){e.next=47;break}return e.abrupt("return",{".":d[i]["card-mod-".concat(t.type)]});case 47:return e.abrupt("return",{});case 48:case"end":return e.stop()}}),e,null,[[11,23,26,29]])}))),Mt.apply(this,arguments)}Je.race(Ot).then((function(){window.setTimeout(M(P().mark((function e(){var t,n,r;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ze();case 2:r=e.sent;case 3:if(r){e.next=8;break}return e.next=6,new Promise((function(e){return window.setTimeout(e,500)}));case 6:e.next=3;break;case 8:r.connection.subscribeEvents((function(){window.setTimeout(Ct,500)}),"themes_updated"),null===(t=document.querySelector("home-assistant"))||void 0===t||t.addEventListener("settheme",Ct),null===(n=document.querySelector("hc-main"))||void 0===n||n.addEventListener("settheme",Ct);case 11:case"end":return e.stop()}}),e)}))),1e3)}));var Nt=function(e){v(n,He);var t=y(n);function n(){var e;return $(this,n),(e=t.apply(this,arguments))._cardMod=[],e}return C(n,[{key:"setConfig",value:function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];null==e||e.apply(void 0,[t].concat(r)),this._cardMod.forEach((function(e){var n;e.variables={config:t},e.styles=(null===(n=t.card_mod)||void 0===n?void 0:n.style)||{}}))}},{key:"updated",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];null==e||e.apply(void 0,r),Promise.all([this.updateComplete]).then((function(){return t._cardMod.forEach((function(e){var t;return null===(t=e.refresh)||void 0===t?void 0:t.call(e)}))}))}}]),n}();function Rt(e,t){return Lt.apply(this,arguments)}function Lt(){return Lt=M(P().mark((function e(t,n){var r,o,i,a,s,u,c,l=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=l.length>3&&void 0!==l[3]?l[3]:{},i=!(l.length>4&&void 0!==l[4])||l[4],c=!1,void 0!==(a=l.length>5&&void 0!==l[5]?l[5]:void 0)&&"string"!=typeof a&&(c=!0,i=a,a=void 0),"boolean"!=typeof i&&(i=!0,c=!0),"string"==typeof(r=l.length>2&&void 0!==l[2]?l[2]:void 0)&&(r={style:r},c=!0),r&&0!==Object.keys(r).length&&void 0===(null!==(u=null!==(s=null==r?void 0:r.style)&&void 0!==s?s:null==r?void 0:r.class)&&void 0!==u?u:null==r?void 0:r.debug)&&(r={style:r},c=!0),c&&!window.cm_compatibility_warning&&(window.cm_compatibility_warning=!0,console.groupCollapsed("Card-mod warning"),console.info("You are using a custom card which relies on card-mod, and uses an outdated signature for applyToElement."),console.info("The outdated signature will be removed at some point in the future. Hopefully the developer of your card will have updated their card by then."),console.info("The card used card-mod to apply styles here:",t),console.groupEnd()),e.abrupt("return",Ut(t,n,r,o,i,a));case 11:case"end":return e.stop()}}),e)}))),Lt.apply(this,arguments)}function Ut(e,t){return Dt.apply(this,arguments)}function Dt(){return Dt=M(P().mark((function e(t,n){var r,o,i,a,s,u,c,l,d,h,p,v,y,m,b=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=b.length>3&&void 0!==b[3]?b[3]:{},a=!(b.length>4&&void 0!==b[4])||b[4],s=b.length>5&&void 0!==b[5]?b[5]:void 0,y=(null==(o=b.length>2&&void 0!==b[2]?b[2]:void 0)?void 0:o.debug)?function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=console).log.apply(e,["CardMod Debug:"].concat(n))}:function(){},y.apply(void 0,["Applying card-mod to:"].concat(f((null==t?void 0:t.host)?["#shadow-root of:",null==t?void 0:t.host]:[t]),["type: ",n,"configuration: ",o])),t){e.next=8;break}return e.abrupt("return");case 8:if(!(null===(u=t.localName)||void 0===u?void 0:u.includes("-"))){e.next=11;break}return e.next=11,customElements.whenDefined(t.localName);case 11:if(t._cardMod=t._cardMod||[],customElements.get("card-mod")){e.next=16;break}return y("Waiting for card-mod customElement to be defined"),e.next=16,customElements.whenDefined("card-mod");case 16:return m=null!==(c=t._cardMod.find((function(e){return e.type===n})))&&void 0!==c?c:document.createElement("card-mod"),y("Applying card-mod in:",m),m.type=n,m.card_mod_class=s,m.debug=null!==(l=null==o?void 0:o.debug)&&void 0!==l&&l,m.cancelStyleChild(),t._cardMod.includes(m)||t._cardMod.push(m),window.setTimeout(M(P().mark((function e(){var n,r,s,u,c,l;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([t.updateComplete]);case 2:(c=(null!==(n=t.modElement)&&void 0!==n?n:a)&&null!==(r=t.shadowRoot)&&void 0!==r?r:t).contains(m)||((l=null===(null===(s=null==t?void 0:t.renderOptions)||void 0===s?void 0:s.renderBefore))&&y("Lit prepend workaround applied for:",t),(null==o?void 0:o.prepend)||l?c.prepend(m):c.appendChild(m)),m.variables=i,m.styles=null!==(u=null==o?void 0:o.style)&&void 0!==u?u:"";case 6:case"end":return e.stop()}}),e)}))),1),m.classes="string"==typeof(null==o?void 0:o.class)?null===(h=null===(d=null==o?void 0:o.class)||void 0===d?void 0:d.split)||void 0===h?void 0:h.call(d," "):f(null!==(p=null==o?void 0:o.class)&&void 0!==p?p:[]),s&&m.classes.push(s),null===(v=t.classList)||void 0===v||(r=v).add.apply(r,f(m.classes)),e.abrupt("return",m);case 28:case"end":return e.stop()}}),e)}))),Dt.apply(this,arguments)}function Ht(e,t){var n=function(e){return e&&"object"===T(e)&&!Array.isArray(e)};if(n(e)&&n(t))for(var r in t)n(t[r])?(e[r]||Object.assign(e,d({},r,{})),"string"==typeof e[r]&&(e[r]={".":e[r]}),Ht(e[r],t[r])):e[r]?e[r]=t[r]+e[r]:e[r]=t[r];return e}function It(e,t){if(e===t)return!0;if(T(e)!==T(t))return!1;if(!(e instanceof Object&&t instanceof Object))return!1;for(var n in e)if(e.hasOwnProperty(n)){if(!t.hasOwnProperty(n))return!1;if(e[n]!==t[n]){if("object"!==T(e[n]))return!1;if(!It(e[n],t[n]))return!1}}for(var r in t)if(t.hasOwnProperty(r)&&!e.hasOwnProperty(r))return!1;return!0}var qt=function(e){v(s,He);var t,n,r,o,i=y(s);function s(){var e;return $(this,s),(e=i.call(this)).dynamicVariablesHaveChanged=!1,e.card_mod_children={},e.card_mod_parent=void 0,e.card_mod_class=void 0,e.classes=[],e.debug=!1,e._fixed_styles={},e._styles="",e._processStylesOnConnect=!1,e._rendered_styles="",e._cancel_style_child=[],e._observer=new MutationObserver((function(t){e.debug&&e._debug("Mutations observed:",t);var n,r=!0,o=x(t);try{for(o.s();!(n=o.n()).done;){var i=n.value;if("card-mod"===i.target.localName)return;i.addedNodes.length&&i.addedNodes.forEach((function(e){"card-mod"!==e.localName&&(r=!1)})),i.removedNodes.length&&i.removedNodes.forEach((function(e){"card-mod"!==e.localName&&(r=!1)}))}}catch(e){o.e(e)}finally{o.f()}r||e.refresh()})),document.addEventListener("cm_update",(function(t){var n;e.dynamicVariablesHaveChanged=(null===(n=t.detail)||void 0===n?void 0:n.variablesChanged)||!1,e.isConnected?e._process_styles(e.card_mod_input):e._processStylesOnConnect=!0})),e}return C(s,[{key:"connectedCallback",value:function(){var e,t,n;h(k(s.prototype),"connectedCallback",this).call(this),this._processStylesOnConnect?(this._processStylesOnConnect=!1,this._debug.apply(this,["Processing styles on (Re)connect:","type:",this.type,"for:"].concat(f((null===(e=null==this?void 0:this.parentNode)||void 0===e?void 0:e.host)?["#shadow-root of:",null===(t=null==this?void 0:this.parentNode)||void 0===t?void 0:t.host]:[null!==(n=this.parentElement)&&void 0!==n?n:this.parentNode]))),this._process_styles(this.card_mod_input)):this.refresh(),this.setAttribute("slot","none"),this.style.display="none"}},{key:"disconnectedCallback",value:function(){h(k(s.prototype),"disconnectedCallback",this).call(this),this._disconnect()}},{key:"styles",get:function(){return this._styles},set:function(e){It(e,this.card_mod_input)||(this.card_mod_input=e,this.isConnected?this._process_styles(e):this._processStylesOnConnect=!0)}},{key:"refresh",value:function(){this._connect()}},{key:"cancelStyleChild",value:function(){this._cancel_style_child.forEach((function(e){return e()})),this._cancel_style_child=[]}},{key:"_debug",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this.debug&&(e=console).log.apply(e,["CardMod Debug:"].concat(n))}},{key:"_process_styles",value:(o=M(P().mark((function e(t){var n,r;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="string"==typeof t||void 0===t?{".":null!=t?t:""}:JSON.parse(JSON.stringify(t)),e.next=3,jt(this);case 3:r=e.sent,Ht(n,r),this._fixed_styles=n,this.refresh();case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_style_child",value:(r=M(P().mark((function e(t,n){var r,o,i,a,s=this,u=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>2&&void 0!==u[2]?u[2]:0,o=this.parentElement||this.parentNode,e.next=4,it(o,t,!0);case 4:if((i=e.sent)&&i.length){e.next=12;break}if(!(r>5)){e.next=8;break}throw new Error("NoElements");case 8:return a=new Promise((function(e,t){setTimeout(e,100*r),s._cancel_style_child.push(t)})),e.next=11,a.catch((function(e){throw new Error("Cancelled")}));case 11:return e.abrupt("return",this._style_child(t,n,r+1));case 12:return e.abrupt("return",f(i).map(function(){var e=M(P().mark((function e(t){var r;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ut(t,"".concat(s.type,"-child"),{style:n,debug:s.debug},s.variables,!1);case 2:return(r=e.sent)&&(r.card_mod_parent=s),e.abrupt("return",r);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_connect",value:(n=M(P().mark((function e(){var t,n,r,o,i,a,s,u,c,l,d,h,v,y,m,b=this;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=null!==(t=this._fixed_styles)&&void 0!==t?t:{},u={},c="",l=!1,this._debug.apply(this,["(Re)connecting:","type:",this.type,"to:"].concat(f((null===(n=null==this?void 0:this.parentNode)||void 0===n?void 0:n.host)?["#shadow-root of:",null===(r=null==this?void 0:this.parentNode)||void 0===r?void 0:r.host]:[null!==(o=this.parentElement)&&void 0!==o?o:this.parentNode]))),this.cancelStyleChild(),d=P().mark((function e(){var t,n,r;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=p(v[h],2),n=t[0],r=t[1],"."===n?"string"==typeof r?c=r:b._debug("Style of '.' must be a string: ",r):(l=!0,u[n]=b._style_child(n,r).catch((function(e){if("NoElements"!=e.message){if("Cancelled"!=e.message)throw e;b.debug&&(console.groupCollapsed("card-mod style_child cancelled while looking for elements"),console.info("Looked for ".concat(n)),console.info(b),console.groupEnd())}else b.debug&&(console.groupCollapsed("card-mod found no elements"),console.info("Looked for ".concat(n)),console.info(b),console.groupEnd())})));case 2:case"end":return e.stop()}}),e)})),h=0,v=Object.entries(s);case 8:if(!(h<v.length)){e.next=13;break}return e.delegateYield(d(),"t0",10);case 10:h++,e.next=8;break;case 13:e.t1=P().keys(this.card_mod_children);case 14:if((e.t2=e.t1()).done){e.next=30;break}if(y=e.t2.value,u[y]){e.next=28;break}return e.next=19,this.card_mod_children[y];case 19:if(e.t4=i=e.sent,e.t3=null===e.t4,e.t3){e.next=23;break}e.t3=void 0===i;case 23:if(!e.t3){e.next=27;break}e.next=28;break;case 27:i.forEach(function(){var e=M(P().mark((function e(t){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.then((function(e){return e.styles=""})).catch((function(){}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}());case 28:e.next=14;break;case 30:if(this.card_mod_children=u,l&&(this._observer.disconnect(),(m=null!==(a=this.parentElement)&&void 0!==a?a:this.parentNode)&&(this.debug&&this._debug("Observing for changes on:",m),this._observer.observe(m,{childList:!0}),m.host&&(this.debug&&this._debug("Observing for changes on:",m.host),this._observer.observe(m.host,{childList:!0})))),this._styles!==c||this.dynamicVariablesHaveChanged){e.next=34;break}return e.abrupt("return");case 34:this._styles=c,this.dynamicVariablesHaveChanged=!1,(g=this._styles)&&(String(g).includes("{%")||String(g).includes("{{"))?(this._renderer=this._renderer||this._style_rendered.bind(this),gt(this._renderer,this._styles,this.variables)):this._style_rendered(this._styles||"");case 37:case"end":return e.stop()}var g}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"_disconnect",value:(t=M(P().mark((function e(){var t,n;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._observer.disconnect(),this._styles="",this.cancelStyleChild(),e.next=5,_t(this._renderer);case 5:null===(n=null===(t=this.card_mod_parent)||void 0===t?void 0:t.refresh)||void 0===n||n.call(t);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_style_rendered",value:function(e){this._rendered_styles!==e&&(this._rendered_styles=e),this.dispatchEvent(new Event("card-mod-update"))}},{key:"createRenderRoot",value:function(){return this}},{key:"render",value:function(){return ke(a||(a=u(["\n <style>\n ","\n </style>\n "])),this._rendered_styles)}}],[{key:"applyToElement",get:function(){return Rt}}]),s}();R([Ve({attribute:"card-mod-type",reflect:!0})],qt.prototype,"type",void 0),R([Ve()],qt.prototype,"_rendered_styles",void 0),customElements.get("card-mod")||(customElements.define("card-mod",qt),console.info("%cCARD-MOD ".concat(At.version," IS INSTALLED"),"color: green; font-weight: bold"),window.dispatchEvent(new Event("card-mod-bootstrap"))),M(P().mark((function e(){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==customElements.get("home-assistant")){e.next=5;break}return e.next=3,new Promise((function(e){return window.setTimeout(e,100)}));case 3:e.next=0;break;case 5:customElements.get("card-mod")||customElements.define("card-mod",qt);case 6:case"end":return e.stop()}}),e)})))(),window.cardMod_patch_state=window.cardMod_patch_state||{};var zt=window.cardMod_patch_state,Vt=function(e,t,n){if("constructor"!==t){var r=e[t];e[t]=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];try{return n.call.apply(n,[this,null==r?void 0:r.bind(this)].concat(t))}catch(e){return null==r?void 0:r.bind(this).apply(void 0,t)}}}},Bt=function(e,t){if(e)for(var n in Object.getOwnPropertyDescriptors(t.prototype))Vt(e,n,t.prototype[n])},Wt=function(){var e=M(P().mark((function e(t,n,r){var o;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=4;break}return e.next=3,customElements.whenDefined(t);case 3:t=customElements.get(t);case 4:return o=Bt(t.prototype,n),null==r||r(),e.abrupt("return",o);case 7:case"end":return e.stop()}}),e)})));return function(t,n,r){return e.apply(this,arguments)}}();function Ft(e,t){return function(n){var r,o,i,a="string"==typeof e?e:e.name,s=null!==(i=null!==(o=null===(r=zt[a])||void 0===r?void 0:r.patched)&&void 0!==o?o:zt[a])&&void 0!==i&&i;s?function(e){var t;if(window.cm_patch_warning)return;window.cm_patch_warning=!0;var n="CARD-MOD (".concat(At.version,"): ").concat(e," already patched by ").concat((null===(t=zt[e])||void 0===t?void 0:t.version)||"unknown version","!"),r=["Card-mod likely loaded twice with different resource URLs.","Make sure all card-mod resource URLs including hacstag match EXACTLY.","Also check other custom elements including cards and themes which may load card-mod.","See https://github.com/thomasloven/lovelace-card-mod/blob/master/README.md#performance-improvements for details.","If you have corrected this issue in config, then the device generating this notification needs its Frontend cache cleared."];it(document.body,"home-assistant").then((function(e){var t,o,i,a;if(null==e?void 0:e.hass){null!==(o=null===(t=e.hass.user)||void 0===t?void 0:t.name)&&void 0!==o?o:null===(i=e.hass.user)||void 0===i?void 0:i.id;var s="User: ".concat((null===(a=e.hass.user)||void 0===a?void 0:a.name)||"unknown","\n\nBrowser: ").concat(navigator.userAgent);e.hass.callService("system_log","write",{logger:"card-mod.".concat(At.version),level:"warning",message:"".concat(n," ").concat(r.join(" ")," ").concat(s)},void 0,!1).catch((function(e){console.error("CARD-MOD: Failed to create duplicate patch warning notification",e)}))}}))}(a):(zt[a]={patched:!0,version:At.version},Wt(e,n,t))}}var Jt=["conditional","entity-filter"],Yt=function(e){v(r,Nt);var t,n=y(r);function r(){var e;return $(this,r),(e=n.apply(this,arguments))._cardMod=[],e}return C(r,[{key:"_add_card_mod",value:(t=M(P().mark((function e(){var t,n,r,o,i,a,s;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._element){e.next=2;break}return e.abrupt("return");case 2:if(!Jt.includes(null===(n=null===(t=this.config)||void 0===t?void 0:t.type)||void 0===n?void 0:n.toLowerCase())){e.next=4;break}return e.abrupt("return");case 4:return i=this._element,a=(null==i?void 0:i.config)||(null==i?void 0:i._config)||this.config,s="type-".concat(null===(o=null===(r=null==a?void 0:a.type)||void 0===r?void 0:r.replace)||void 0===o?void 0:o.call(r,":","-")),e.next=9,Ut(this._element,"card",null==a?void 0:a.card_mod,{config:a},!0,s);case 9:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_loadElement",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),this._add_card_mod()}}]),r}();Yt=R([Ft("hui-card")],Yt);var Gt=function(e){v(r,Nt);var t,n=y(r);function r(){var e;return $(this,r),(e=n.apply(this,arguments))._cardMod=[],e}return C(r,[{key:"firstUpdated",value:(t=M(P().mark((function e(t){var n,r,o,i,a,s,u,c,l,d,h,f,p=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(s=p.length,u=new Array(s>1?s-1:0),c=1;c<s;c++)u[c-1]=p[c];return e.next=3,null==t?void 0:t.apply(void 0,u);case 3:if(!(l=null===(r=null===(n=this.parentNode)||void 0===n?void 0:n.host)||void 0===r?void 0:r.parentNode)||"hui-card"!==l.localName){e.next=6;break}return e.abrupt("return");case 6:if(d=Kt(this)){e.next=9;break}return e.abrupt("return");case 9:return h="type-".concat(null===(i=null===(o=null==d?void 0:d.type)||void 0===o?void 0:o.replace)||void 0===i?void 0:i.call(o,":","-")),e.next=12,Ut(this,"card",null==d?void 0:d.card_mod,{config:d},!1,h);case 12:if(f=null===(a=this.parentNode)||void 0===a?void 0:a.host){e.next=15;break}return e.abrupt("return");case 15:Bt(f,Nt),f._cardMod=this._cardMod;case 17:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),r}();function Kt(e){return e.config?e.config:e._config?e._config:e.host?Kt(e.host):e.parentElement?Kt(e.parentElement):e.parentNode?Kt(e.parentNode):null}Gt=R([Ft("ha-card")],Gt);var Zt=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"firstUpdated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),Ut(this,"grid-section",this._config.card_mod,{config:this._config},!0,"type-grid-section")}}]),n}();Zt=R([Ft("hui-grid-section")],Zt);var Xt=function(e){v(r,Nt);var t,n=y(r);function r(){return $(this,r),n.apply(this,arguments)}return C(r,[{key:"_createCards",value:(t=M(P().mark((function e(t){var n,r,o,i=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=null===(n=this.config)||void 0===n?void 0:n.strategy,o=Object.assign({},i.length<=1?void 0:i[1]),r&&r.card_mod&&Object.entries(o.cards).forEach((function(e){var t=p(e,2),n=t[0],i=t[1];i.type in r.card_mod&&(r.card_mod.debug&&console.log("CardMod Debug: adding card-mod to card",i,"with",r.card_mod[i.type]),o.cards[n]=Object.assign(Object.assign({},i),{card_mod:r.card_mod[i.type]}))})),null==t||t(o);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),r}();Xt=R([Ft("hui-section")],Xt);var Qt=["entity-filter"],en=function(e){v(r,Nt);var t,n=y(r);function r(){return $(this,r),n.apply(this,arguments)}return C(r,[{key:"_add_card_mod",value:(t=M(P().mark((function e(){var t,n,r,o,i,a;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._element){e.next=2;break}return e.abrupt("return");case 2:if(!Qt.includes(null===(n=null===(t=this.config)||void 0===t?void 0:t.type)||void 0===n?void 0:n.toLowerCase())){e.next=4;break}return e.abrupt("return");case 4:return a="type-".concat(null===(i=null===(o=null===(r=this.config)||void 0===r?void 0:r.type)||void 0===o?void 0:o.replace)||void 0===i?void 0:i.call(o,":","-")),e.next=7,Ut(this._element,"badge",this.config.card_mod,{config:this.config},!0,a);case 7:this._cardMod=this._element._cardMod;case 8:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_loadElement",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),this._add_card_mod()}},{key:"_updateElement",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),this._add_card_mod()}}]),r}();en=R([Ft("hui-badge")],en);var tn=function(e){v(r,Nt);var t,n=y(r);function r(){return $(this,r),n.apply(this,arguments)}return C(r,[{key:"_add_card_mod",value:(t=M(P().mark((function e(){var t,n,r,o;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._element){e.next=2;break}return e.abrupt("return");case 2:return o="type-".concat(null===(r=null===(n=null===(t=this.config)||void 0===t?void 0:t.type)||void 0===n?void 0:n.replace)||void 0===r?void 0:r.call(n,":","-")),e.next=5,Ut(this._element,"heading-badge",this.config.card_mod,{config:this.config},!0,o);case 5:this._cardMod=this._element._cardMod;case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_loadElement",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),this._add_card_mod()}},{key:"_updateElement",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),this._add_card_mod()}}]),r}();tn=R([Ft("hui-heading-badge")],tn);var nn=function(e){v(r,Nt);var t,n=y(r);function r(){return $(this,r),n.apply(this,arguments)}return C(r,[{key:"firstUpdated",value:(t=M(P().mark((function e(t){var n,r,o,i,a=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=a.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=a[i];return e.next=3,null==t?void 0:t.apply(void 0,o);case 3:return e.next=5,Ut(this,"assist-chip",null===(n=this.config)||void 0===n?void 0:n.card_mod,{config:this.config},!0,"type-assist-chip");case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),r}();nn=R([Ft("ha-assist-chip")],nn);var rn=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"_renderEntity",value:function(e,t){for(var n,r,o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];var s=null==e?void 0:e.apply(void 0,[t].concat(i));if("custom:mod-card"===(null==t?void 0:t.type))return s;if(!(null==s?void 0:s.values))return s;var u=s.values[1];if(!u)return s;var c=(null==t?void 0:t.type)?"type-".concat(null===(r=(n=t.type).replace)||void 0===r?void 0:r.call(n,":","-")):"type-entity",l=function(){var e=M(P().mark((function e(){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tt(u);case 2:Bt(u,Nt),Ut(u,"row",null==t?void 0:t.card_mod,{config:t},!0,c),u.addEventListener("ll-rebuild",l);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return Promise.all([this.updateComplete]).then((function(){return l()})),s}}]),n}();rn=R([Ft("hui-entities-card")],rn);var on=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"setConfig",value:function(e,t){for(var n,r,o,i,a=arguments.length,s=new Array(a>2?a-2:0),u=2;u<a;u++)s[u-2]=arguments[u];null==e||e.apply(void 0,[t].concat(s));var c=this._element;if(c&&(null==t?void 0:t.row)&&"custom:mod-card"!==(null===(n=null==t?void 0:t.row)||void 0===n?void 0:n.type)){var l=(null===(r=null==t?void 0:t.row)||void 0===r?void 0:r.type)?"type-".concat(null===(i=(o=t.row.type).replace)||void 0===i?void 0:i.call(o,":","-")):"type-entity",d=function(){var e=M(P().mark((function e(){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tt(c);case 2:Bt(c,Nt),Ut(c,"row",t.row.card_mod,{config:t.row},!0,l),c.addEventListener("ll-rebuild",d);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();Promise.all([this.updateComplete]).then((function(){return d()}))}}}]),n}();on=R([Ft("hui-conditional-row")],on);var an=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"updated",value:function(e){for(var t,n,r,o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];null==e||e.apply(void 0,i);var s,u=x(this.shadowRoot.querySelectorAll("ha-card div.entity"));try{for(u.s();!(s=u.n()).done;){var c=s.value;Bt(c,Nt);for(var l=null!==(t=c.shadowRoot)&&void 0!==t?t:c.attachShadow({mode:"open"});c.firstChild;)l.append(c.firstChild);var d=null!==(n=c.querySelector("style[card-mod]"))&&void 0!==n?n:document.createElement("style");d.setAttribute("card-mod",""),d.innerHTML="\ndiv {\n width: 100%;\n text-align: center;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.name {\n min-height: var(--paper-font-body1_-_line-height, 20px);\n}\nstate-badge {\n margin: 8px 0;\n}\n",l.append(d);var h=null!==(r=c.config)&&void 0!==r?r:c.entityConfig;Ut(c,"glance",null==h?void 0:h.card_mod,{config:h})}}catch(e){u.e(e)}finally{u.f()}}}]),n}();an=R([Ft("hui-glance-card")],an);var sn=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"setConfig",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];null==e||e.apply(void 0,r);var i=function(){var e=M(P().mark((function e(){var n,r,o,i,a,s,u,c,l;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=x(t._elements.entries()),e.prev=1,o.s();case 3:if((i=o.n()).done){e.next=13;break}return a=p(i.value,2),s=a[0],u=a[1],e.next=7,tt(u);case 7:Bt(u,Nt),c=t._config.elements[s],l="type-".concat(null===(r=null===(n=null==c?void 0:c.type)||void 0===n?void 0:n.replace)||void 0===r?void 0:r.call(n,":","-")),Ut(u,"element",null==c?void 0:c.card_mod,{config:c},!0,l);case 11:e.next=3;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(1),o.e(e.t0);case 18:return e.prev=18,o.f(),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[1,15,18,21]])})));return function(){return e.apply(this,arguments)}}();Promise.all([this.updateComplete]).then((function(){return i()}))}}]),n}();sn=R([Ft("hui-picture-elements-card")],sn);var un=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"setConfig",value:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];null==e||e.apply(void 0,r);var i=function(){var e=M(P().mark((function e(){var n,r,o,i,a,s,u,c,l;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=x(t._elements.entries()),e.prev=1,o.s();case 3:if((i=o.n()).done){e.next=13;break}return a=p(i.value,2),s=a[0],u=a[1],e.next=7,tt(u);case 7:Bt(u,Nt),c=t._config.elements[s],l="type-".concat(null===(r=null===(n=null==c?void 0:c.type)||void 0===n?void 0:n.replace)||void 0===r?void 0:r.call(n,":","-")),Ut(u,"element",null==c?void 0:c.card_mod,{config:c},!0,l);case 11:e.next=3;break;case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(1),o.e(e.t0);case 18:return e.prev=18,o.f(),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[1,15,18,21]])})));return function(){return e.apply(this,arguments)}}();Promise.all([this.updateComplete]).then((function(){return i()}))}}]),n}();un=R([Ft("hui-conditional-element")],un);var cn=function(e){var t=window.getComputedStyle(e),n=t.getPropertyValue("--card-mod-icon");n&&(e.icon=n.trim());var r=t.getPropertyValue("--card-mod-icon-color");r&&(e.style.color=r),"none"===t.getPropertyValue("--card-mod-icon-dim")&&(e.style.filter="none")},ln=function(){var e=M(P().mark((function e(t){var n,r,o,i,a;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return cn(t),t._boundCardMod=null!==(n=t._boundCardMod)&&void 0!==n?n:new Set,e.next=4,vn(t);case 4:r=e.sent,o=x(r),e.prev=6,a=P().mark((function e(){var n;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=i.value,!t._boundCardMod.has(n)){e.next=3;break}return e.abrupt("return",1);case 3:n.addEventListener("card-mod-update",M(P().mark((function e(){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.updateComplete;case 2:cn(t);case 3:case"end":return e.stop()}}),e)})))),t._boundCardMod.add(n);case 5:case"end":return e.stop()}}),e)})),o.s();case 9:if((i=o.n()).done){e.next=15;break}return e.delegateYield(a(),"t0",11);case 11:if(!e.t0){e.next=13;break}return e.abrupt("continue",13);case 13:e.next=9;break;case 15:e.next=20;break;case 17:e.prev=17,e.t1=e.catch(6),o.e(e.t1);case 20:return e.prev=20,o.f(),e.finish(20);case 23:if(!(t.cm_retries<5)){e.next=26;break}return t.cm_retries++,e.abrupt("return",window.setTimeout((function(){return ln(t)}),250*t.cm_retries));case 26:case"end":return e.stop()}}),e,null,[[6,17,20,23]])})));return function(t){return e.apply(this,arguments)}}(),dn=function(e){v(n,Nt);var t=y(n);function n(){var e;return $(this,n),(e=t.apply(this,arguments)).cm_retries=0,e}return C(n,[{key:"updated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),this.cm_retries=0,ln(this)}}]),n}();dn=R([Ft("ha-state-icon")],dn);var hn=function(e){v(n,Nt);var t=y(n);function n(){var e;return $(this,n),(e=t.apply(this,arguments)).cm_retries=0,e}return C(n,[{key:"updated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),this.cm_retries=0,ln(this)}}]),n}();hn=R([Ft("ha-icon")],hn);var fn=function(e){v(n,Nt);var t=y(n);function n(){var e;return $(this,n),(e=t.apply(this,arguments)).cm_retries=0,e}return C(n,[{key:"updated",value:function(e){for(var t,n,r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];null==e||e.apply(void 0,o),"ha-icon"!==(null===(n=null===(t=this.parentNode)||void 0===t?void 0:t.host)||void 0===n?void 0:n.localName)&&(this.cm_retries=0,ln(this))}}]),n}();function pn(e,t){var n,r=x(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;e.add(o)}}catch(e){r.e(e)}finally{r.f()}}function vn(e){return yn.apply(this,arguments)}function yn(){return yn=M(P().mark((function e(t){var n,r,o,i,a,s=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=s.length>1&&void 0!==s[1]?s[1]:0,r=new Set,10!=n){e.next=4;break}return e.abrupt("return",r);case 4:if(t){e.next=6;break}return e.abrupt("return",r);case 6:if(!t.updateComplete){e.next=9;break}return e.next=9,t.updateComplete;case 9:if(t._cardMod){o=x(t._cardMod);try{for(o.s();!(i=o.n()).done;)(a=i.value).styles&&r.add(a)}catch(e){o.e(e)}finally{o.f()}}if(!t.parentElement){e.next=19;break}return e.t0=pn,e.t1=r,e.next=15,vn(t.parentElement,n+1);case 15:e.t2=e.sent,(0,e.t0)(e.t1,e.t2),e.next=26;break;case 19:if(!t.parentNode){e.next=26;break}return e.t3=pn,e.t4=r,e.next=24,vn(t.parentNode,n+1);case 24:e.t5=e.sent,(0,e.t3)(e.t4,e.t5);case 26:if(!t.host){e.next=33;break}return e.t6=pn,e.t7=r,e.next=31,vn(t.host,n+1);case 31:e.t8=e.sent,(0,e.t6)(e.t7,e.t8);case 33:return e.abrupt("return",r);case 34:case"end":return e.stop()}}),e)}))),yn.apply(this,arguments)}fn=R([Ft("ha-svg-icon")],fn);var mn=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"updated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),Ut(this,"view",void 0,{},!1)}}]),n}();mn=R([Ft("hui-view")],mn);var bn=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"firstUpdated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),Ut(this,"root")}}]),n}();function gn(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new WeakSet;if(null==e)return e;var n=T(e);if("function"!==n&&!("undefined"!=typeof HTMLElement&&e instanceof HTMLElement||"undefined"!=typeof Element&&e instanceof Element)){if("object"!==n)return e;if(!t.has(e)){if(t.add(e),Array.isArray(e)){var r=e.map((function(e){return gn(e,t)})).filter((function(e){return void 0!==e}));return r}for(var o={},i=0,a=Object.entries(e);i<a.length;i++){var s=p(a[i],2),u=s[0],c=gn(s[1],t);void 0!==c&&(o[u]=c)}return o}}}bn=R([Ft("hui-root",(function(){it(document,"home-assistant$home-assistant-main$partial-panel-resolver ha-panel-lovelace$hui-root",!1).then((function(e){return null==e?void 0:e.firstUpdated()}))}))],bn);var wn=function(e){v(r,Nt);var t,n=y(r);function r(){return $(this,r),n.apply(this,arguments)}return C(r,[{key:"showDialog",value:(t=M(P().mark((function e(t,n){var r,o,i,a=this,s=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=s.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=s[i];return e.next=3,null==t?void 0:t.apply(void 0,[n].concat(o));case 3:this.requestUpdate(),this.updateComplete.then(M(P().mark((function e(){var t,r,o,i;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=a.shadowRoot.querySelector("ha-dialog"))||(o=a.shadowRoot.querySelector("ha-md-dialog")),o||(o=a.shadowRoot.querySelector("ha-wa-dialog")),o||(o=a.shadowRoot.querySelector("ha-drawer")),o){e.next=6;break}return e.abrupt("return");case 6:i="type-".concat(null===(r=(t=a.localName).replace)||void 0===r?void 0:r.call(t,"ha-","")),Ut(o,"dialog",void 0,{params:gn(n)},!1,i);case 8:case"end":return e.stop()}}),e)}))));case 5:case"end":return e.stop()}}),e,this)}))),function(e,n){return t.apply(this,arguments)})}]),r}();window.addEventListener("show-dialog",(function(e){var t,n,r,o=null===(t=e.detail)||void 0===t?void 0:t.dialogTag;o&&!function(e){var t,n,r,o="string"==typeof e?e:e.constructor.name;return null!==(r=null!==(n=null===(t=zt[o])||void 0===t?void 0:t.patched)&&void 0!==n?n:zt[o])&&void 0!==r&&r}(o)&&(r="string"==typeof(n=o)?n:n.constructor.name,zt[r]={patched:!0,version:At.version},Wt(o,wn))}),{capture:!0});var _n=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"showDialog",value:function(e,t){for(var n=this,r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];null==e||e.apply(void 0,[t].concat(o)),this.requestUpdate(),this.updateComplete.then(M(P().mark((function e(){var r;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=n.shadowRoot.querySelector("ha-dialog")){e.next=3;break}return e.abrupt("return");case 3:Ut(r,"more-info",void 0,{config:t},!1);case 4:case"end":return e.stop()}}),e)}))))}}]),n}();_n=R([Ft("ha-more-info-dialog")],_n);var kn=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"firstUpdated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),Ut(this,"sidebar")}}]),n}();kn=R([Ft("ha-sidebar",(function(){it(document,"home-assistant$home-assistant-main$ha-sidebar",!1).then((function(e){return null==e?void 0:e.firstUpdated()}))}))],kn);var xn=function(e){v(n,He);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"setConfig",value:function(e,t){var n,r,o,i,a,s=JSON.parse(JSON.stringify(t));if(this._cardModData={card:s.card_mod,entities:[]},delete s.card_mod,Array.isArray(s.entities)){var u,c=x(null===(r=null===(n=s.entities)||void 0===n?void 0:n.entries)||void 0===r?void 0:r.call(n));try{for(c.s();!(u=c.n()).done;){var l=p(u.value,2),d=l[0],h=l[1];this._cardModData.entities[d]=h.card_mod,delete h.card_mod}}catch(e){c.e(e)}finally{c.f()}}for(var f=arguments.length,v=new Array(f>2?f-2:0),y=2;y<f;y++)v[y-2]=arguments[y];if(e.apply(void 0,[s].concat(v)),Array.isArray(s.entities)){var m,b=x(null===(i=null===(o=s.entities)||void 0===o?void 0:o.entries)||void 0===i?void 0:i.call(o));try{for(b.s();!(m=b.n()).done;){var g=p(m.value,2),w=g[0],_=g[1];(null===(a=this._cardModData)||void 0===a?void 0:a.entities[w])&&(_.card_mod=this._cardModData.entities[w])}}catch(e){b.e(e)}finally{b.f()}}}}]),n}(),En=function(e){v(r,He);var t,n=y(r);function r(){return $(this,r),n.apply(this,arguments)}return C(r,[{key:"getConfigElement",value:(t=M(P().mark((function e(t){var n,r,o,i,a=arguments;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(n=a.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=a[o];return e.next=3,t.apply(void 0,r);case 3:return i=e.sent,Bt(i,xn),e.abrupt("return",i);case 6:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"_handleUIConfigChanged",value:function(e,t){var n,r=null===(n=this._configElement)||void 0===n?void 0:n._cardModData;r&&(t.detail.config.card_mod=r.card);for(var o=arguments.length,i=new Array(o>2?o-2:0),a=2;a<o;a++)i[a-2]=arguments[a];e.apply(void 0,[t].concat(i))}}]),r}();En=R([Ft("hui-card-element-editor")],En);var An=function(e){v(n,He);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"updated",value:function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];null==e||e.apply(void 0,r),this._cardModIcon||(this._cardModIcon=document.createElement("ha-icon"),this._cardModIcon.icon="mdi:brush");var i=this.shadowRoot.querySelector("ha-button[slot=secondaryAction]");i&&(i.appendChild(this._cardModIcon),(null===(t=JSON.stringify(this._cardConfig))||void 0===t?void 0:t.includes("card_mod"))?this._cardModIcon.style.visibility="visible":this._cardModIcon.style.visibility="hidden")}}]),n}();An=R([Ft("hui-dialog-edit-card")],An);var $n=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"updated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),Ut(this,"config",{prepend:!0})}}]),n}();$n=R([Ft("ha-panel-config")],$n);var Sn=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"updated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),Ut(this,"panel-custom",{prepend:!0})}}]),n}();Sn=R([Ft("ha-panel-custom")],Sn);var Cn=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"updated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),Ut(this,"top-app-bar-fixed")}}]),n}();Cn=R([Ft("ha-top-app-bar-fixed")],Cn);var On=function(e){v(n,Nt);var t=y(n);function n(){return $(this,n),t.apply(this,arguments)}return C(n,[{key:"updated",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];null==e||e.apply(void 0,n),Ut(this,"developer-tools")}}]),n}();On=R([Ft("ha-panel-developer-tools")],On);var Pn,Tn,jn,Mn="\nha-card {\n background: none;\n box-shadow: none;\n border: none;\n transition: none;\n}",Nn=function(e){v(r,He);var t,n=y(r);function r(){return $(this,r),n.apply(this,arguments)}return C(r,[{key:"setConfig",value:function(e){var t,n;this._config=JSON.parse(JSON.stringify(e));var r=(null===(t=this._config.card_mod)||void 0===t?void 0:t.style)||this._config.style;void 0===r?r=Mn:"string"==typeof r?r=Mn+r:r["."]?r["."]=Mn+r["."]:r["."]=Mn,this._config.card_mod={style:r,debug:(null===(n=this._config.card_mod)||void 0===n?void 0:n.debug)||!1},this.build_card(e.card)}},{key:"build_card",value:(t=M(P().mark((function e(t){var n,r=this;return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==this._hass){e.next=3;break}return e.next=3,new Promise((function(e){return r._hassResolve=e}));case 3:return this._hassResolve=void 0,e.next=6,window.loadCardHelpers();case 6:return n=e.sent,e.next=9,n.createCardElement(t);case 9:this.card=e.sent,this.card.hass=this._hass;case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"firstUpdated",value:function(){var e=this;window.setTimeout((function(){var t,n;if(null===(n=null===(t=e.card)||void 0===t?void 0:t.shadowRoot)||void 0===n?void 0:n.querySelector("ha-card")){console.info("%cYou are doing it wrong!","color: red; font-weight: bold");var r=e.card.localName.replace(/hui-(.*)-card/,"$1");console.info("mod-card should NEVER be used with a card that already has a ha-card element, such as ".concat(r))}}),3e3)}},{key:"hass",set:function(e){this._hass=e,this.card&&(this.card.hass=e),this._hassResolve&&this._hassResolve()}},{key:"render",value:function(){return ke(s||(s=u([" <ha-card modcard> "," </ha-card> "])),this.card)}},{key:"getCardSize",value:function(){if(this._config.report_size)return this._config.report_size;var e=this.shadowRoot;return e&&(e=e.querySelector("ha-card card-maker")),e&&(e=e.getCardSize),e&&(e=e()),e||1}}]),r}();R([Ve()],Nn.prototype,"card",void 0),customElements.get("mod-card")||customElements.define("mod-card",Nn),M(P().mark((function e(){return P().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==customElements.get("home-assistant")){e.next=5;break}return e.next=3,new Promise((function(e){return window.setTimeout(e,100)}));case 3:e.next=0;break;case 5:customElements.get("mod-card")||customElements.define("mod-card",Nn);case 6:case"end":return e.stop()}}),e)})))();var Rn,Ln=[],Un=x(document.querySelectorAll("script"));try{for(Un.s();!(Rn=Un.n()).done;){var Dn=Rn.value;if(null===(Tn=null===(Pn=null==Dn?void 0:Dn.innerText)||void 0===Pn?void 0:Pn.trim())||void 0===Tn?void 0:Tn.startsWith("import(")){var Hn,In=null===(jn=Dn.innerText.split("\n"))||void 0===jn?void 0:jn.map((function(e){return e.trim()})),qn=x(In);try{for(qn.s();!(Hn=qn.n()).done;){var zn=Hn.value;Ln.push(zn.replace(/^import\(\"/,"").replace(/\"\);/,""))}}catch(e){qn.e(e)}finally{qn.f()}}}}catch(e){Un.e(e)}finally{Un.f()}Ln.some((function(e){return e.includes("/card-mod.js")}))||console.info("You may not be getting optimal performance out of card-mod.\nSee https://github.com/thomasloven/lovelace-card-mod#performance-improvements");