2 lines
74 KiB
JavaScript
2 lines
74 KiB
JavaScript
/*! For license information please see multiple-entity-row.js.LICENSE.txt */
|
||
(()=>{"use strict";const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,n=Symbol(),i=new WeakMap;class o{constructor(t,e,i){if(this._$cssResult$=!0,i!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const n=this.t;if(e&&void 0===t){const e=void 0!==n&&1===n.length;e&&(t=i.get(n)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&i.set(n,t))}return t}toString(){return this.cssText}}const r=(t,...e)=>{const i=1===t.length?t[0]:e.reduce((e,n,i)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[i+1],t[0]);return new o(i,t,n)},a=(n,i)=>{if(e)n.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of i){const i=document.createElement("style"),o=t.litNonce;void 0!==o&&i.setAttribute("nonce",o),i.textContent=e.cssText,n.appendChild(i)}},s=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new o("string"==typeof t?t:t+"",void 0,n))(e)})(t):t,{is:c,defineProperty:l,getOwnPropertyDescriptor:u,getOwnPropertyNames:d,getOwnPropertySymbols:h,getPrototypeOf:f}=Object,p=globalThis,m=p.trustedTypes,v=m?m.emptyScript:"",y=p.reactiveElementPolyfillSupport,b=(t,e)=>t,_={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},g=(t,e)=>!c(t,e),w={attribute:!0,type:String,converter:_,reflect:!1,useDefault:!1,hasChanged:g};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;class A extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(t,n,e);void 0!==i&&l(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){const{get:i,set:o}=u(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:i,set(e){const r=i?.call(this);o?.call(this,e),this.requestUpdate(t,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??w}static _$Ei(){if(this.hasOwnProperty(b("elementProperties")))return;const t=f(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(b("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(b("properties"))){const t=this.properties,e=[...d(t),...h(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(s(t))}else void 0!==t&&e.push(s(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return a(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,n);if(void 0!==i&&!0===n.reflect){const o=(void 0!==n.converter?.toAttribute?n.converter:_).toAttribute(e,n.type);this._$Em=t,null==o?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){const n=this.constructor,i=n._$Eh.get(t);if(void 0!==i&&this._$Em!==i){const t=n.getPropertyOptions(i),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:_;this._$Em=i;const r=o.fromAttribute(e,t.type);this[i]=r??this._$Ej?.get(i)??r,this._$Em=null}}requestUpdate(t,e,n,i=!1,o){if(void 0!==t){const r=this.constructor;if(!1===i&&(o=this[t]),n??=r.getPropertyOptions(t),!((n.hasChanged??g)(o,e)||n.useDefault&&n.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:i,wrapped:o},r){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,r??e??this[t]),!0!==o||void 0!==r)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===i&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,i=this[e];!0!==t||this._$AL.has(e)||void 0===i||this.C(e,void 0,n,i)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[b("elementProperties")]=new Map,A[b("finalized")]=new Map,y?.({ReactiveElement:A}),(p.reactiveElementVersions??=[]).push("2.1.2");const $=globalThis,S=t=>t,O=$.trustedTypes,x=O?O.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",C=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+C,j=`<${k}>`,P=document,T=()=>P.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,I=Array.isArray,H=t=>I(t)||"function"==typeof t?.[Symbol.iterator],F="[ \t\n\f\r]",D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,N=/>/g,U=RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,V=/"/g,z=/^(?:script|style|textarea|title)$/i,B=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),W=B(1),Z=(B(2),B(3),Symbol.for("lit-noChange")),q=Symbol.for("lit-nothing"),J=new WeakMap,G=P.createTreeWalker(P,129);function K(t,e){if(!I(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==x?x.createHTML(e):e}const Y=(t,e)=>{const n=t.length-1,i=[];let o,r=2===e?"<svg>":3===e?"<math>":"",a=D;for(let e=0;e<n;e++){const n=t[e];let s,c,l=-1,u=0;for(;u<n.length&&(a.lastIndex=u,c=a.exec(n),null!==c);)u=a.lastIndex,a===D?"!--"===c[1]?a=R:void 0!==c[1]?a=N:void 0!==c[2]?(z.test(c[2])&&(o=RegExp("</"+c[2],"g")),a=U):void 0!==c[3]&&(a=U):a===U?">"===c[0]?(a=o??D,l=-1):void 0===c[1]?l=-2:(l=a.lastIndex-c[2].length,s=c[1],a=void 0===c[3]?U:'"'===c[3]?V:L):a===V||a===L?a=U:a===R||a===N?a=D:(a=U,o=void 0);const d=a===U&&t[e+1].startsWith("/>")?" ":"";r+=a===D?n+j:l>=0?(i.push(s),n.slice(0,l)+E+n.slice(l)+C+d):n+C+(-2===l?e:d)}return[K(t,r+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),i]};class Q{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let o=0,r=0;const a=t.length-1,s=this.parts,[c,l]=Y(t,e);if(this.el=Q.createElement(c,n),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(i=G.nextNode())&&s.length<a;){if(1===i.nodeType){if(i.hasAttributes())for(const t of i.getAttributeNames())if(t.endsWith(E)){const e=l[r++],n=i.getAttribute(t).split(C),a=/([.?@])?(.*)/.exec(e);s.push({type:1,index:o,name:a[2],strings:n,ctor:"."===a[1]?it:"?"===a[1]?ot:"@"===a[1]?rt:nt}),i.removeAttribute(t)}else t.startsWith(C)&&(s.push({type:6,index:o}),i.removeAttribute(t));if(z.test(i.tagName)){const t=i.textContent.split(C),e=t.length-1;if(e>0){i.textContent=O?O.emptyScript:"";for(let n=0;n<e;n++)i.append(t[n],T()),G.nextNode(),s.push({type:2,index:++o});i.append(t[e],T())}}}else if(8===i.nodeType)if(i.data===k)s.push({type:2,index:o});else{let t=-1;for(;-1!==(t=i.data.indexOf(C,t+1));)s.push({type:7,index:o}),t+=C.length-1}o++}}static createElement(t,e){const n=P.createElement("template");return n.innerHTML=t,n}}function X(t,e,n=t,i){if(e===Z)return e;let o=void 0!==i?n._$Co?.[i]:n._$Cl;const r=M(e)?void 0:e._$litDirective$;return o?.constructor!==r&&(o?._$AO?.(!1),void 0===r?o=void 0:(o=new r(t),o._$AT(t,n,i)),void 0!==i?(n._$Co??=[])[i]=o:n._$Cl=o),void 0!==o&&(e=X(t,o._$AS(t,e.values),o,i)),e}class tt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:n}=this._$AD,i=(t?.creationScope??P).importNode(e,!0);G.currentNode=i;let o=G.nextNode(),r=0,a=0,s=n[0];for(;void 0!==s;){if(r===s.index){let e;2===s.type?e=new et(o,o.nextSibling,this,t):1===s.type?e=new s.ctor(o,s.name,s.strings,this,t):6===s.type&&(e=new at(o,this,t)),this._$AV.push(e),s=n[++a]}r!==s?.index&&(o=G.nextNode(),r++)}return G.currentNode=P,i}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}}class et{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,i){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=X(this,t,e),M(t)?t===q||null==t||""===t?(this._$AH!==q&&this._$AR(),this._$AH=q):t!==this._$AH&&t!==Z&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):H(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==q&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(P.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,i="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=Q.createElement(K(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===i)this._$AH.p(e);else{const t=new tt(i,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=J.get(t.strings);return void 0===e&&J.set(t.strings,e=new Q(t)),e}k(t){I(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const o of t)i===e.length?e.push(n=new et(this.O(T()),this.O(T()),this,this.options)):n=e[i],n._$AI(o),i++;i<e.length&&(this._$AR(n&&n._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=S(t).nextSibling;S(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class nt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,i,o){this.type=1,this._$AH=q,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=q}_$AI(t,e=this,n,i){const o=this.strings;let r=!1;if(void 0===o)t=X(this,t,e,0),r=!M(t)||t!==this._$AH&&t!==Z,r&&(this._$AH=t);else{const i=t;let a,s;for(t=o[0],a=0;a<o.length-1;a++)s=X(this,i[n+a],e,a),s===Z&&(s=this._$AH[a]),r||=!M(s)||s!==this._$AH[a],s===q?t=q:t!==q&&(t+=(s??"")+o[a+1]),this._$AH[a]=s}r&&!i&&this.j(t)}j(t){t===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class it extends nt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===q?void 0:t}}class ot extends nt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==q)}}class rt extends nt{constructor(t,e,n,i,o){super(t,e,n,i,o),this.type=5}_$AI(t,e=this){if((t=X(this,t,e,0)??q)===Z)return;const n=this._$AH,i=t===q&&n!==q||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,o=t!==q&&(n===q||i);i&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){X(this,t)}}const st={M:E,P:C,A:k,C:1,L:Y,R:tt,D:H,V:X,I:et,H:nt,N:ot,U:rt,B:it,F:at},ct=$.litHtmlPolyfillSupport;ct?.(Q,et),($.litHtmlVersions??=[]).push("3.3.3");const lt=globalThis;class ut extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,n)=>{const i=n?.renderBefore??e;let o=i._$litPart$;if(void 0===o){const t=n?.renderBefore??null;i._$litPart$=o=new et(e.insertBefore(T(),t),t,void 0,n??{})}return o._$AI(t),o})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Z}}ut._$litElement$=!0,ut.finalized=!0,lt.litElementHydrateSupport?.({LitElement:ut});const dt=lt.litElementPolyfillSupport;dt?.({LitElement:ut}),(lt.litElementVersions??=[]).push("4.2.2");var ht=["unavailable","unknown"],ft="last-changed",pt="last-updated",mt=["relative","total","date","time","datetime"],vt=["entity-id","last-changed","last-updated","last-triggered","position","tilt-position","brightness"],yt=function(t){return t<10?"0".concat(t):t};function bt(t){var e=Math.floor(t/3600),n=Math.floor(t%3600/60),i=Math.floor(t%3600%60);return e>0?"".concat(e,":").concat(yt(n),":").concat(yt(i)):n>0?"".concat(n,":").concat(yt(i)):i>0?""+i:null}function _t(t){return _t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_t(t)}function gt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function wt(t,e,n){return(e=function(t){var e=function(t){if("object"!=_t(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=_t(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_t(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var At=function(t,e,n){var i=e?function(t){switch(t.number_format){case"comma_decimal":return["en-US","en"];case"decimal_comma":return["de","es","it"];case"space_comma":return["fr","sv","cs"];case"system":return;default:return t.language}}(e):void 0;if(Number.isNaN=Number.isNaN||function t(e){return"number"==typeof e&&t(e)},"none"!==(null==e?void 0:e.number_format)&&!Number.isNaN(Number(t))&&Intl)try{return new Intl.NumberFormat(i,$t(t,n)).format(Number(t))}catch(e){return console.error(e),new Intl.NumberFormat(void 0,$t(t,n)).format(Number(t))}return"string"==typeof t?t:"".concat(function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return Math.round(t*Math.pow(10,e))/Math.pow(10,e)}(t,null==n?void 0:n.maximumFractionDigits).toString()).concat("currency"===(null==n?void 0:n.style)?" ".concat(n.currency):"")},$t=function(t,e){var n=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?gt(Object(n),!0).forEach(function(e){wt(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({maximumFractionDigits:2},e);if("string"!=typeof t)return n;if(!e||!e.minimumFractionDigits&&!e.maximumFractionDigits){var i=t.indexOf(".")>-1?t.split(".")[1].length:0;n.minimumFractionDigits=i,n.maximumFractionDigits=i}return n};function St(t){return St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},St(t)}var Ot=function(t){return"object"===St(t)&&!Array.isArray(t)&&!!t},xt=function(t,e,n){var i=new Event(e,{bubbles:!0,composed:!0});i.detail=n,t.dispatchEvent(i)},Et=function(t){return!t||ht.includes(t.state)},Ct=function(t,e,n){if(function(t,e){return e.hide_unavailable&&(Et(t)||e.attribute&&![ft,pt].includes(e.attribute)&&void 0===t.attributes[e.attribute])}(t,e))return!0;if(void 0===e.hide_if)return!1;var i;if(Ot(e.hide_if)&&(e.hide_if.entity||e.hide_if.attribute)){var o=e.hide_if.entity?null==n?void 0:n.states[e.hide_if.entity]:t;i=e.hide_if.attribute?null==o?void 0:o.attributes[e.hide_if.attribute]:null==o?void 0:o.state}else i=e.attribute?t.attributes[e.attribute]:t.state;var r=[];if(Ot(e.hide_if)){if(e.hide_if.below&&i<e.hide_if.below)return!0;if(e.hide_if.above&&i>e.hide_if.above)return!0;e.hide_if.value&&(r=r.concat(e.hide_if.value))}else r=r.concat(e.hide_if);return r.some(function(t){return"number"==typeof t?t===+i:t===i})},kt=["formatEntityName","formatEntityState","formatEntityAttributeValue"];function jt(t){return jt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jt(t)}function Pt(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function Tt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?Pt(Object(n),!0).forEach(function(e){Mt(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Pt(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Mt(t,e,n){return(e=function(t){var e=function(t){if("object"!=jt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=jt(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==jt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function It(t,e){if(t){if("string"==typeof t)return Ht(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ht(t,e):void 0}}function Ht(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}var Ft,Dt=function(t){if(Ot(t)&&!(t.entity||t.attribute||t.icon))throw new Error("Entity object requires at least one 'entity', 'attribute' or 'icon'.");if("string"==typeof t&&""===t)throw new Error("Entity ID string must not be blank.");if("string"!=typeof t&&!Ot(t))throw new Error("Entity config must be a valid entity ID string or entity object.")},Rt=function(t){return"string"==typeof t&&t.includes(".")?t.split(".")[1].length:void 0},Nt=["precision","kilo","mega","milli"],Ut=/^(precision|kilo|mega|milli)(\d+)?$/,Lt=function(t){var e=Ut.exec(t);return!e||"precision"===e[1]&&void 0===e[2]?null:e},Vt=/^(brightness|percent|invert|position|celsius_to_fahrenheit|fahrenheit_to_celsius|kilo\d*|mega\d*|milli\d*|precision\d+)$/,zt=["upper","lower","capitalize","title"],Bt=function(t){return t?"--paper-item-icon-color: ".concat(t,"; --mdc-icon-color: ").concat(t,"; --state-icon-color: ").concat(t,";"):""},Wt=function(t,e){return Ot(e.state_icon)?e.state_icon[t.state]:void 0},Zt=function(t,e){return!1===e.name?null:e.name||(e.entity?t.attributes.friendly_name||(n=t.entity_id).substr(n.indexOf(".")+1):null)||null;var n},qt=function(t){return"string"==typeof t?t.replace(/(\d)%/,"$1%"):t},Jt=function(t,e,n){if(Et(e))return t.formatEntityState(e);var i,o=n.attribute?e.attributes[n.attribute]:e.state,r=!1===n.unit?void 0:void 0!==n.attribute?n.unit:n.unit||e.attributes.unit_of_measurement,a="string"==typeof(i=n.format)?i.split(",").map(function(t){return t.trim()}).filter(Boolean):[];if(a.length>1&&a.every(function(t){return Vt.test(t)})){var s=o??0;return!isNaN(parseFloat(s))&&isFinite(s)?function(t,e,n,i){var o,r,a=parseFloat(e),s=Rt(e),c=!1,l=function(t){c||(s=void 0,o=t)},u=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=It(t))){e&&(t=e);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,r=!0,a=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return r=t.done,t},e:function(t){a=!0,o=t},f:function(){try{r||null==e.return||e.return()}finally{if(a)throw o}}}}(t);try{for(u.s();!(r=u.n()).done;){var d=r.value,h=Ut.exec(d);if(h&&"precision"===h[1])s=parseInt(h[2],10),o=void 0,c=!0;else if(h)a/={kilo:1e3,mega:1e6,milli:.001}[h[1]],void 0!==h[2]?(s=parseInt(h[2],10),o=void 0,c=!0):l(2);else switch(d){case"brightness":a=Math.round(a/255*100),n="%",l(0);break;case"percent":a*=100,n="%",l(2);break;case"invert":a=-a;break;case"position":a=100-a;break;case"celsius_to_fahrenheit":a=1.8*a+32,l(0);break;case"fahrenheit_to_celsius":a=5*(a-32)/9,l(1)}}}catch(t){u.e(t)}finally{u.f()}return"".concat(At(a,i,void 0!==s?{minimumFractionDigits:s,maximumFractionDigits:s}:void 0!==o?{maximumFractionDigits:o}:void 0)).concat(n?" ".concat(n):"")}(a,s,r,t.locale):"".concat(s).concat(r?" ".concat(r):"")}if(n.format&&!function(t){return Nt.some(function(e){return null==t?void 0:t.startsWith(e)})&&!Lt(t)}(n.format)){if(null==o&&(o=zt.includes(n.format)?"":0),zt.includes(n.format))return"".concat(function(t,e){switch(t){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();case"capitalize":return e.charAt(0).toUpperCase()+e.slice(1);case"title":return e.split(/(\s+)/).map(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}).join("")}}(n.format,String(o))).concat(r?" ".concat(r):"");if(isNaN(parseFloat(o))||!isFinite(o));else if("brightness"===n.format)o=Math.round(o/255*100),r="%";else if("percent"===n.format)o=At(100*o,t.locale,{maximumFractionDigits:2}),r="%";else if("duration"===n.format){var c;o=null!==(c=bt(o))&&void 0!==c?c:"0",r=void 0}else if("duration-m"===n.format){var l;o=null!==(l=bt(o/1e3))&&void 0!==l?l:"0",r=void 0}else if("duration-h"===n.format){var u;o=null!==(u=bt(3600*o))&&void 0!==u?u:"0",r=void 0}else if(Lt(n.format)){var d=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,o,r,a,s=[],c=!0,l=!1;try{if(r=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=r.call(n)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||It(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(Lt(n.format),3),h=d[1],f=d[2];if("precision"===h){var p=parseInt(f,10);o=At(parseFloat(o),t.locale,{minimumFractionDigits:p,maximumFractionDigits:p})}else o=function(t,e,n,i){if(void 0===n)return At(t/e,i,{maximumFractionDigits:2});var o=parseInt(n,10);return At(t/e,i,{minimumFractionDigits:o,maximumFractionDigits:o})}(o,{kilo:1e3,mega:1e6,milli:.001}[h],f,t.locale)}else if("invert"===n.format){var m=Rt(o);o=At(o-2*o,t.locale,void 0!==m?{minimumFractionDigits:m,maximumFractionDigits:m}:void 0)}else if("position"===n.format){var v=Rt(o);o=At(100-o,t.locale,void 0!==v?{minimumFractionDigits:v,maximumFractionDigits:v}:void 0)}else"celsius_to_fahrenheit"===n.format?o=At(1.8*o+32,t.locale,{maximumFractionDigits:0}):"fahrenheit_to_celsius"===n.format&&(o=At(5*(o-32)/9,t.locale,{maximumFractionDigits:1}));return"".concat(o).concat(r?" ".concat(r):"")}var y=Tt(Tt({},e),{},{attributes:Tt(Tt({},e.attributes),{},{unit_of_measurement:r})});if(n.attribute){if(void 0!==n.unit){var b=null==o?"":isNaN(o)?o:At(o,t.locale);return"".concat(b).concat(r?" ".concat(r):"")}return qt(t.formatEntityAttributeValue(y,n.attribute))}return qt(t.formatEntityState(y))},Gt=function(t){return Ot(null==t?void 0:t.styles)?Object.keys(t.styles).map(function(e){return"".concat(e,": ").concat(t.styles[e],";")}).join(""):""};class Kt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const{I:Yt}=st,Qt={},Xt=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Kt{constructor(){super(...arguments),this.key=q}render(t,e){return this.key=t,e}update(t,[e,n]){return e!==this.key&&(((t,e=Qt)=>{t._$AH=e})(t),this.key=e),n}});var te,ee,ne,ie,oe,re,ae,se,ce,le,ue,de,he,fe,pe,me,ve,ye="__custom__",be=[{value:"",label:"No format"},{value:"brightness",label:"Brightness (0-255 → %)"},{value:"percent",label:"Percent (value × 100 → x %)"},{value:"duration",label:"Duration (seconds → h:mm:ss)"},{value:"duration-m",label:"Duration (milliseconds)"},{value:"duration-h",label:"Duration (hours)"},{value:"precision0",label:"Precision 0 decimals"},{value:"precision1",label:"Precision 1 decimal"},{value:"precision2",label:"Precision 2 decimals"},{value:"precision3",label:"Precision 3 decimals"},{value:"kilo",label:"Kilo (value / 1,000)"},{value:"mega",label:"Mega (value / 1,000,000)"},{value:"milli",label:"Milli (value × 1,000)"},{value:"invert",label:"Invert (value × -1)"},{value:"position",label:"Position (100 - value)"},{value:"celsius_to_fahrenheit",label:"°C → °F"},{value:"fahrenheit_to_celsius",label:"°F → °C"},{value:"upper",label:"Text: UPPERCASE"},{value:"lower",label:"Text: lowercase"},{value:"capitalize",label:"Text: Capitalize first letter"},{value:"title",label:"Text: Title Case"},{value:"relative",label:"Timestamp: relative"},{value:"total",label:"Timestamp: total"},{value:"date",label:"Timestamp: date"},{value:"time",label:"Timestamp: time"},{value:"datetime",label:"Timestamp: date + time"},{value:ye,label:"Custom…"}],_e=new Set(be.map(function(t){return t.value}).filter(function(t){return t&&t!==ye})),ge=[{name:"entity",required:!0,selector:{entity:{}}},{type:"grid",schema:[{name:"name",selector:{text:{}}},{name:"attribute",selector:{text:{}}}]},{type:"grid",schema:[{name:"unit",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]},{name:"icon_color",selector:{text:{}}},{type:"grid",schema:[{name:"show_state",default:!0,selector:{boolean:{}}},{name:"state_color",selector:{boolean:{}}}]},{type:"grid",schema:[{name:"toggle",selector:{boolean:{}}},{name:"column",selector:{boolean:{}}}]},{type:"grid",schema:[{name:"show_state_first",selector:{boolean:{}}},{name:"hide_unavailable",selector:{boolean:{}}}]},{name:"state_header",selector:{text:{}}},{name:"image",selector:{text:{}}},{name:"format",selector:{select:{mode:"dropdown",options:be}}}],we=[{name:"tap_action",selector:{ui_action:{default_action:"more-info"}}},{name:"hold_action",selector:{ui_action:{default_action:"none"}}},{name:"double_tap_action",selector:{ui_action:{default_action:"none"}}}],Ae=[{name:"entity",selector:{entity:{}}},{type:"grid",schema:[{name:"name",selector:{text:{}}},{name:"attribute",selector:{text:{}}}]},{type:"grid",schema:[{name:"unit",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]},{name:"icon_color",selector:{text:{}}},{type:"grid",schema:[{name:"state_color",selector:{boolean:{}}},{name:"toggle",selector:{boolean:{}}}]},{name:"hide_unavailable",selector:{boolean:{}}},{name:"format",selector:{select:{mode:"dropdown",options:be}}}],$e={entity:"Entity",attribute:"Attribute",name:"Name override",unit:"Unit",icon:"Icon",icon_color:"Icon color (CSS value, e.g. red, #ff0000, var(--my-color))",image:"Image URL",format:"Format",show_state:"Show main entity state",show_state_first:"State before entities",state_header:"State header label",state_color:"State color",column:"Column layout",toggle:"Show as toggle",hide_unavailable:"Hide if unavailable",tap_action:"Tap action",hold_action:"Hold action",double_tap_action:"Double-tap action"};function Se(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function Oe(t){return function(t){if(Array.isArray(t))return De(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Fe(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xe(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,Me(i.key),i)}}function Ee(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Ee=function(){return!!t})()}function Ce(t){return Ce=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ce(t)}function ke(t,e){return ke=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ke(t,e)}function je(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function Pe(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?je(Object(n),!0).forEach(function(e){Te(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):je(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function Te(t,e,n){return(e=Me(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Me(t){var e=function(t){if("object"!=Re(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=Re(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Re(e)?e:e+""}function Ie(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=Fe(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},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 r,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){s=!0,r=t},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw r}}}}function He(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var i,o,r,a,s=[],c=!0,l=!1;try{if(r=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;c=!1}else for(;!(c=(i=r.call(n)).done)&&(s.push(i.value),s.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(t,e)||Fe(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Fe(t,e){if(t){if("string"==typeof t)return De(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?De(t,e):void 0}}function De(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=Array(e);n<e;n++)i[n]=t[n];return i}function Re(t){return Re="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Re(t)}var Ne,Ue,Le,Ve,ze,Be,We,Ze,qe,Je,Ge,Ke,Ye,Qe,Xe,tn,en,nn="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",on="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z",rn="M19,20H5V4H7V7H17V4H19M12,2A1,1 0 0,1 13,3A1,1 0 0,1 12,4A1,1 0 0,1 11,3A1,1 0 0,1 12,2M19,2H14.82C14.4,0.84 13.3,0 12,0C10.7,0 9.6,0.84 9.18,2H5A2,2 0 0,0 3,4V20A2,2 0 0,0 5,22H19A2,2 0 0,0 21,20V4A2,2 0 0,0 19,2Z",an=[{name:"mode",selector:{select:{mode:"dropdown",options:[{value:"none",label:"None"},{value:"text",label:"Custom text"},{value:"generic",label:"HA built-in token"},{value:"entity",label:"Entity-based"}]}}}],sn=[{name:"token",selector:{select:{mode:"dropdown",options:vt.map(function(t){return{value:t,label:t}})}}}],cn=[{name:"text",selector:{text:{multiline:!0}}}],ln=[{type:"grid",schema:[{name:"state",selector:{text:{}}},{name:"icon",selector:{icon:{}}}]}],un=function(t){return"state"===t.name?"State":"icon"===t.name?"Icon":t.name},dn=function(t){var e={};if(!t)return e;var n,i=Ie(t.split("\n"));try{for(i.s();!(n=i.n()).done;){var o=n.value.trim();if(o&&!o.startsWith("#")){var r=o.indexOf(":");if(!(r<1)){var a=o.slice(0,r).trim(),s=o.slice(r+1).trim();(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),a&&s&&(e[a]=s)}}}}catch(t){i.e(t)}finally{i.f()}return e},hn=function(t){return!1===t.unit?Pe(Pe({},t),{},{unit:"false"}):t},fn=function(t){return"false"===t.unit?Pe(Pe({},t),{},{unit:!1}):t},pn="multipleEntityRowClipboard",mn=["entity","name","attribute","unit","icon","icon_color","state_icon","state_color","toggle","hide_unavailable","format","tap_action","styles"],vn=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),Te(t=function(t,e,n){return e=Ce(e),function(t,e){if(e&&("object"==Re(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Ee()?Reflect.construct(e,n||[],Ce(t).constructor):e.apply(t,n))}(this,e),"_keys",new Map),Te(t,"_onEntitiesExpandedChanged",function(e){var n=e.target;"boolean"==typeof(null==n?void 0:n.expanded)&&(t._entitiesExpanded=n.expanded)}),Te(t,"_computeLabel",function(t){var e;return null!==(e=$e[t.name])&&void 0!==e?e:t.name}),Te(t,"_onTabShow",function(e){var n,i=null===(n=e.detail)||void 0===n?void 0:n.name;if(null!=i){var o=parseInt(i,10);Number.isNaN(o)||o===t._selectedTab||(t._selectedTab=o)}}),Te(t,"_mainValueChanged",function(e){if(t._config){var n=fn(Pe({},e.detail.value));!0===(n=t._formatFromForm("main",n,t._config.format)).show_state&&delete n.show_state,xt(t,"config-changed",{config:n})}}),Te(t,"_additionalValueChanged",function(e,n){var i;if(t._config){var o=Oe(null!==(i=t._config.entities)&&void 0!==i?i:[]),r=o[n],a=Ot(r)?r.format:void 0;o[n]=t._formatFromForm("sub-".concat(n),fn(e.detail.value),a),t._updateConfig({entities:o})}}),Te(t,"_addEntity",function(){var e;if(t._config){var n=[].concat(Oe(null!==(e=t._config.entities)&&void 0!==e?e:[]),[{}]);t._selectedTab=n.length,t._keys.clear(),t._updateConfig({entities:n})}}),Te(t,"_deleteAdditional",function(e){var n;if(t._config){var i=Oe(null!==(n=t._config.entities)&&void 0!==n?n:[]);i.splice(e,1),t._selectedTab>i.length&&(t._selectedTab=i.length),t._keys.clear(),t._updateConfig({entities:i.length?i:void 0})}}),Te(t,"_moveAdditional",function(e,n){var i;if(t._config){var o=Oe(null!==(i=t._config.entities)&&void 0!==i?i:[]),r=e+n;if(!(r<0||r>=o.length)){var a=[o[r],o[e]];o[e]=a[0],o[r]=a[1],t._selectedTab=r+1,t._keys.clear(),t._updateConfig({entities:o})}}}),Te(t,"_copyAdditional",function(e){var n,i=null===(n=t._config)||void 0===n||null===(n=n.entities)||void 0===n?void 0:n[e];null!=i&&t._writeClipboard("string"==typeof i?{entity:i}:Pe({},i))}),Te(t,"_cutAdditional",function(e){t._copyAdditional(e),t._deleteAdditional(e)}),Te(t,"_copyMainAsTemplate",function(){if(t._config){var e,n={},i=Ie(mn);try{for(i.s();!(e=i.n()).done;){var o=e.value,r=t._config[o];void 0!==r&&(n[o]=r)}}catch(t){i.e(t)}finally{i.f()}t._writeClipboard(n)}}),Te(t,"_pasteEntity",function(){var e;if(t._config){var n=t._readClipboard();if(n){var i=[].concat(Oe(null!==(e=t._config.entities)&&void 0!==e?e:[]),[n]);t._selectedTab=i.length,t._keys.clear(),t._updateConfig({entities:i})}}}),Te(t,"_secondaryModeChanged",function(e){if(t._config){var n=e.detail.value.mode;if(n!==t._secondaryInfoMode()){var i;switch(n){case"none":i=void 0;break;case"text":i="";break;case"generic":i="last-changed";break;case"entity":i={entity:t._config.entity}}t._updateConfig({secondary_info:i})}}}),Te(t,"_secondaryTextChanged",function(e){t._updateConfig({secondary_info:e.detail.value.text})}),Te(t,"_secondaryTokenChanged",function(e){t._updateConfig({secondary_info:e.detail.value.token})}),Te(t,"_secondaryEntityChanged",function(e){var n,i=Ot(null===(n=t._config)||void 0===n?void 0:n.secondary_info)?t._config.secondary_info.format:void 0;t._updateConfig({secondary_info:t._formatFromForm("secondary",fn(e.detail.value),i)})}),t._selectedTab=0,t._entitiesExpanded=!0,t._stateIconRowsMain=[],t._stateIconRowsAdditional=new Map,t._customFormatScopes=new Set,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ke(t,e)}(e,t),function(t,e,n){return e&&xe(t.prototype,e),n&&xe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setConfig",value:function(t){var e,n,i,o=this;this._config=t;var r,a=null!==(e=null===(n=t.entities)||void 0===n?void 0:n.length)&&void 0!==e?e:0;this._selectedTab>a&&(this._selectedTab=a),this._clipboardEntity=this._readClipboard(),this._stateIconRowsMatch(this._stateIconRowsMain,t.state_icon)||(this._stateIconRowsMain=Object.entries(null!==(r=t.state_icon)&&void 0!==r?r:{}));var s=new Map;null===(i=t.entities)||void 0===i||i.forEach(function(t,e){var n=Ot(t)?t.state_icon:void 0,i=o._stateIconRowsAdditional.get(e);i&&o._stateIconRowsMatch(i,n)?s.set(e,i):n&&s.set(e,Object.entries(n))}),this._stateIconRowsAdditional=s}},{key:"_stateIconRowsMatch",value:function(t,e){var n,i={},o=Ie(t);try{for(o.s();!(n=o.n()).done;){var r=He(n.value,2),a=r[0],s=r[1];a.trim()&&s.trim()&&(i[a.trim()]=s.trim())}}catch(t){o.e(t)}finally{o.f()}var c=null!=e?e:{},l=Object.keys(i);return l.length===Object.keys(c).length&&l.every(function(t){return i[t]===c[t]})}},{key:"_readClipboard",value:function(){try{var t=sessionStorage.getItem(pn);if(!t)return;var e=JSON.parse(t);if(e&&"object"===Re(e))return e}catch(t){}}},{key:"_writeClipboard",value:function(t){try{sessionStorage.setItem(pn,JSON.stringify(t)),this._clipboardEntity=t}catch(t){}}},{key:"_hasNativeTabs",get:function(){return!!customElements.get("ha-tab-group")&&!!customElements.get("ha-tab-group-tab")}},{key:"render",value:function(){return this.hass&&this._config?W(te||(te=Se(["\n <ha-expansion-panel\n .header=","\n outlined\n ?expanded=","\n @expanded-changed=","\n >\n ",'\n </ha-expansion-panel>\n\n <div class="footer">v'," · ","</div>\n "])),"Entities",this._entitiesExpanded,this._onEntitiesExpandedChanged,this._renderEntitiesPanel(),"4.7.1","2026-07-23T00:32:46.387Z"):q}},{key:"_isCustomFormat",value:function(t,e){return this._customFormatScopes.has(t)||!!e&&!_e.has(e)}},{key:"_setCustomFormatScope",value:function(t,e){if(e!==this._customFormatScopes.has(t)){var n=new Set(this._customFormatScopes);e?n.add(t):n.delete(t),this._customFormatScopes=n}}},{key:"_formatToForm",value:function(t,e){return this._isCustomFormat(t,e.format)?Pe(Pe({},e),{},{format:ye}):e}},{key:"_formatFromForm",value:function(t,e,n){if(e.format===ye){this._setCustomFormatScope(t,!0);var i=Pe({},e);return void 0!==n?i.format=n:delete i.format,i}return this._setCustomFormatScope(t,!1),e}},{key:"_renderCustomFormatField",value:function(t,e,n){return this._isCustomFormat(t,e)?W(ee||(ee=Se(["\n <ha-form\n .hass=","\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n "])),this.hass,{custom_format:null!=e?e:""},[{name:"custom_format",selector:{text:{}}}],function(){return"Custom format (e.g. invert, precision3)"},function(t){var e,i=(null!==(e=t.detail.value.custom_format)&&void 0!==e?e:"").trim();n(i||void 0)}):q}},{key:"_keyFor",value:function(t){return this._keys.has(t)||this._keys.set(t,"".concat(t,"-").concat(Math.random().toString(36).slice(2,10))),this._keys.get(t)}},{key:"_renderEntitiesPanel",value:function(){var t,e,n=this,i=null!==(t=null===(e=this._config)||void 0===e?void 0:e.entities)&&void 0!==t?t:[],o=Math.min(this._selectedTab,i.length);return W(ne||(ne=Se(['\n <div class="panel-content">\n <div class="tabs-row">\n ','\n <ha-icon-button\n class="tabs__add"\n .label=',"\n .path=","\n @click=",'\n ></ha-icon-button>\n </div>\n\n <div id="mer-tab-panel" role="tabpanel">\n ',"\n </div>\n </div>\n "])),this._hasNativeTabs?W(ie||(ie=Se(['\n <ha-tab-group class="tabs" @wa-tab-show=','>\n <ha-tab-group-tab slot="nav" .panel='," .active=",">\n Main\n </ha-tab-group-tab>\n ","\n </ha-tab-group>\n "])),this._onTabShow,0,0===o,i.map(function(t,e){return W(oe||(oe=Se(['\n <ha-tab-group-tab slot="nav" .panel='," .active=",">\n ","\n </ha-tab-group-tab>\n "])),e+1,o===e+1,e+1)})):W(re||(re=Se(['\n <div class="tab-bar--fallback" role="tablist">\n <button\n type="button"\n class=','\n role="tab"\n aria-selected=','\n aria-controls="mer-tab-panel"\n @click=',"\n >\n Main\n </button>\n ","\n </div>\n "])),"tab "+(0===o?"tab--active":""),0===o?"true":"false",function(){return n._selectedTab=0},i.map(function(t,e){return W(ae||(ae=Se(['\n <button\n type="button"\n class=','\n role="tab"\n aria-selected=','\n aria-controls="mer-tab-panel"\n @click=',"\n >\n ","\n </button>\n "])),"tab "+(o===e+1?"tab--active":""),o===e+1?"true":"false",function(){return n._selectedTab=e+1},e+1)})),"Add entity","M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",this._addEntity,Xt(this._keyFor(o),0===o?this._renderMainTab():this._renderAdditionalTab(o-1)))}},{key:"_renderMainTab",value:function(){var t,e,n=this;return W(se||(se=Se(['\n <div class="child-actions">\n <ha-icon-button\n .label=',"\n .path=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n .disabled=","\n @click=",'\n ></ha-icon-button>\n </div>\n <div class="child-editor">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n ",'\n <div class="section-label">Interactions</div>\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=",'\n ></ha-form>\n <div class="section-label">Secondary info</div>\n ','\n <div class="section-label">State-based icons</div>\n ','\n <div class="section-label">Custom CSS</div>\n ',"\n </div>\n "])),"Copy main as template",on,this._copyMainAsTemplate,"Paste as new entity",rn,!this._clipboardEntity,this._pasteEntity,this.hass,this._mainFormData(),ge,this._computeLabel,this._mainValueChanged,this._renderCustomFormatField("main",null===(t=this._config)||void 0===t?void 0:t.format,function(t){return n._updateConfig({format:t})}),this.hass,this._mainFormData(),we,this._computeLabel,this._mainValueChanged,this._renderSecondaryInfoBlock(),this._renderStateIconRows("main"),this._renderStylesBlock(null===(e=this._config)||void 0===e?void 0:e.styles,function(t){return n._mainStylesChanged(t)}))}},{key:"_renderStylesBlock",value:function(t,e){return W(ce||(ce=Se(['\n <ha-code-editor\n mode="yaml"\n autocomplete-entities\n autocomplete-icons\n .hass=',"\n .value=","\n @value-changed=","\n ></ha-code-editor>\n "])),this.hass,!(n=t)||"object"!==Re(n)||Array.isArray(n)?"":Object.entries(n).filter(function(t){return null!=He(t,2)[1]}).map(function(t){var e=He(t,2),n=e[0],i=e[1];return"".concat(n,": ").concat(i)}).join("\n"),e);var n}},{key:"_mainStylesChanged",value:function(t){if(this._config){var e=dn(t.detail.value);this._updateConfig({styles:Object.keys(e).length>0?e:void 0})}}},{key:"_additionalStylesChanged",value:function(t,e){var n;if(this._config){var i=dn(t.detail.value),o=Oe(null!==(n=this._config.entities)&&void 0!==n?n:[]),r=o[e],a="string"==typeof r?{entity:r}:Pe({},r);Object.keys(i).length>0?a.styles=i:delete a.styles,o[e]=a,this._updateConfig({entities:o})}}},{key:"_stateIconRowsFor",value:function(t){var e;return"main"===t?this._stateIconRowsMain:null!==(e=this._stateIconRowsAdditional.get(t))&&void 0!==e?e:[]}},{key:"_setStateIconRows",value:function(t,e){if("main"===t)this._stateIconRowsMain=e;else{var n=new Map(this._stateIconRowsAdditional);n.set(t,e),this._stateIconRowsAdditional=n}var i,o={},r=Ie(e);try{for(r.s();!(i=r.n()).done;){var a=He(i.value,2),s=a[0],c=a[1];s.trim()&&c.trim()&&(o[s.trim()]=c.trim())}}catch(t){r.e(t)}finally{r.f()}var l=Object.keys(o).length>0?o:void 0;if(this._config)if("main"===t)this._updateConfig({state_icon:l});else{var u,d=Oe(null!==(u=this._config.entities)&&void 0!==u?u:[]),h=d[t],f="string"==typeof h?{entity:h}:Pe({},h);l?f.state_icon=l:delete f.state_icon,d[t]=f,this._updateConfig({entities:d})}}},{key:"_renderStateIconRows",value:function(t){var e=this,n=this._stateIconRowsFor(t);return W(le||(le=Se(['\n <div class="state-icon-rows">\n ','\n <button\n type="button"\n class="state-icon-add"\n @click=',"\n >\n + Add state\n </button>\n </div>\n "])),n.map(function(i,o){return W(ue||(ue=Se(['\n <div class="state-icon-row">\n <ha-form\n class="state-icon-form"\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n <ha-icon-button\n .label=","\n .path=","\n @click=","\n ></ha-icon-button>\n </div>\n "])),e.hass,{state:i[0],icon:i[1]},ln,un,function(i){var r=i.detail.value,a=n.map(function(t,e){var n,i;return e===o?[null!==(n=r.state)&&void 0!==n?n:"",null!==(i=r.icon)&&void 0!==i?i:""]:t});e._setStateIconRows(t,a)},"Remove",nn,function(){return e._setStateIconRows(t,n.filter(function(t,e){return e!==o}))})}),function(){return e._setStateIconRows(t,[].concat(Oe(n),[["",""]]))})}},{key:"_renderAdditionalTab",value:function(t){var e,n,i=this,o=this._config.entities[t],r="string"==typeof o?{entity:o}:o,a=(null!==(e=null===(n=this._config)||void 0===n||null===(n=n.entities)||void 0===n?void 0:n.length)&&void 0!==e?e:1)-1;return W(de||(de=Se(['\n <div class="child-actions">\n <ha-icon-button\n .label=',"\n .path=","\n .disabled=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n .disabled=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n .disabled=","\n @click=","\n ></ha-icon-button>\n <ha-icon-button\n .label=","\n .path=","\n @click=",'\n ></ha-icon-button>\n </div>\n <div class="child-editor">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n ",'\n <div class="section-label">Interactions</div>\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=",'\n ></ha-form>\n <div class="section-label">State-based icons</div>\n ','\n <div class="section-label">Custom CSS</div>\n ',"\n </div>\n "])),"Move before","M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",0===t,function(){return i._moveAdditional(t,-1)},"Move after","M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",t===a,function(){return i._moveAdditional(t,1)},"Copy entity",on,function(){return i._copyAdditional(t)},"Cut entity","M19,3L13,9L15,11L22,4V3M12,12.5A0.5,0.5 0 0,1 11.5,12A0.5,0.5 0 0,1 12,11.5A0.5,0.5 0 0,1 12.5,12A0.5,0.5 0 0,1 12,12.5M6,20A2,2 0 0,1 4,18C4,16.89 4.9,16 6,16A2,2 0 0,1 8,18C8,19.11 7.1,20 6,20M6,8A2,2 0 0,1 4,6C4,4.89 4.9,4 6,4A2,2 0 0,1 8,6C8,7.11 7.1,8 6,8M9.64,7.64C9.87,7.14 10,6.59 10,6A4,4 0 0,0 6,2A4,4 0 0,0 2,6A4,4 0 0,0 6,10C6.59,10 7.14,9.87 7.64,9.64L10,12L7.64,14.36C7.14,14.13 6.59,14 6,14A4,4 0 0,0 2,18A4,4 0 0,0 6,22A4,4 0 0,0 10,18C10,17.41 9.87,16.86 9.64,16.36L12,14L19,21H22V20L9.64,7.64Z",function(){return i._cutAdditional(t)},"Paste from clipboard",rn,!this._clipboardEntity,this._pasteEntity,"Delete entity",nn,function(){return i._deleteAdditional(t)},this.hass,this._formatToForm("sub-".concat(t),hn(r)),Ae,this._computeLabel,function(e){return i._additionalValueChanged(e,t)},this._renderCustomFormatField("sub-".concat(t),r.format,function(e){return i._setAdditionalFormat(t,e)}),this.hass,this._formatToForm("sub-".concat(t),hn(r)),we,this._computeLabel,function(e){return i._additionalValueChanged(e,t)},this._renderStateIconRows(t),this._renderStylesBlock(r.styles,function(e){return i._additionalStylesChanged(e,t)}))}},{key:"_mainFormData",value:function(){return this._formatToForm("main",hn(Pe({show_state:!0},this._config)))}},{key:"_setAdditionalFormat",value:function(t,e){var n;if(this._config){var i=Oe(null!==(n=this._config.entities)&&void 0!==n?n:[]),o=i[t],r="string"==typeof o?{entity:o}:Pe({},o);e?r.format=e:delete r.format,i[t]=r,this._updateConfig({entities:i})}}},{key:"_secondaryInfoMode",value:function(){var t,e=null===(t=this._config)||void 0===t?void 0:t.secondary_info;return null==e?"none":"object"===Re(e)?"entity":vt.includes(e)?"generic":"text"}},{key:"_renderSecondaryInfoBlock",value:function(){var t,e=this,n=this._secondaryInfoMode(),i=null===(t=this._config)||void 0===t?void 0:t.secondary_info;return W(he||(he=Se(["\n <div>\n <ha-form\n .hass=","\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n ","\n ","\n ","\n </div>\n "])),this.hass,{mode:n},an,function(){return"Mode"},this._secondaryModeChanged,"text"===n?W(fe||(fe=Se(['<div class="secondary-sub-form">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n </div>"])),this.hass,{text:null!=i?i:""},cn,function(){return"Custom text"},this._secondaryTextChanged):q,"generic"===n?W(pe||(pe=Se(['<div class="secondary-sub-form">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n </div>"])),this.hass,{token:i},sn,function(){return"HA built-in"},this._secondaryTokenChanged):q,"entity"===n?W(me||(me=Se(['<div class="secondary-sub-form">\n <ha-form\n .hass=',"\n .data=","\n .schema=","\n .computeLabel=","\n @value-changed=","\n ></ha-form>\n ","\n </div>"])),this.hass,this._formatToForm("secondary",hn(i)),Ae,this._computeLabel,this._secondaryEntityChanged,this._renderCustomFormatField("secondary",i.format,function(t){return e._updateConfig({secondary_info:Pe(Pe({},i),{},{format:t})})})):q)}},{key:"_updateConfig",value:function(t){if(this._config){for(var e=Pe({},this._config),n=0,i=Object.entries(t);n<i.length;n++){var o=He(i[n],2),r=o[0],a=o[1];void 0===a?delete e[r]:e[r]=a}xt(this,"config-changed",{config:e})}}}],[{key:"properties",get:function(){return{hass:{attribute:!1},_config:{state:!0},_selectedTab:{state:!0},_entitiesExpanded:{state:!0},_clipboardEntity:{state:!0},_stateIconRowsMain:{state:!0},_stateIconRowsAdditional:{state:!0},_customFormatScopes:{state:!0}}}}])}(ut);function yn(t){return yn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yn(t)}function bn(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function _n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,i)}return n}function gn(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?_n(Object(n),!0).forEach(function(e){wn(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_n(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function wn(t,e,n){return(e=$n(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function An(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,$n(i.key),i)}}function $n(t){var e=function(t){if("object"!=yn(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=yn(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==yn(e)?e:e+""}function Sn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(Sn=function(){return!!t})()}function On(t){return On=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},On(t)}function xn(t,e){return xn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},xn(t,e)}Te(vn,"styles",r(ve||(ve=Se(["\n ha-expansion-panel {\n display: block;\n margin-top: 12px;\n }\n .panel-content {\n padding: 12px 0;\n }\n .tabs-row {\n display: flex;\n align-items: center;\n gap: 4px;\n border-bottom: 1px solid var(--divider-color, #e0e0e0);\n margin-bottom: 8px;\n }\n ha-tab-group.tabs {\n flex: 1;\n min-width: 0;\n }\n .tab-bar--fallback {\n display: flex;\n flex: 1;\n gap: 4px;\n overflow-x: auto;\n }\n .tab-bar--fallback .tab {\n padding: 8px 12px;\n cursor: pointer;\n border: 1px solid transparent;\n border-bottom: none;\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n white-space: nowrap;\n color: var(--secondary-text-color);\n background: transparent;\n font: inherit;\n }\n .tab-bar--fallback .tab--active {\n background: var(--card-background-color);\n border-color: var(--divider-color);\n color: var(--primary-text-color);\n }\n .tabs__add {\n flex: 0 0 auto;\n }\n .child-actions {\n display: flex;\n align-items: center;\n gap: 4px;\n padding: 4px 0 8px;\n }\n .child-actions ha-icon-button[disabled] {\n opacity: 0.4;\n pointer-events: none;\n }\n .child-editor {\n border: 1px solid var(--divider-color, #e0e0e0);\n border-radius: 8px;\n padding: 8px;\n background: var(--card-background-color);\n }\n .secondary-sub-form {\n margin-top: 8px;\n }\n .state-icon-rows {\n margin-top: 4px;\n }\n .state-icon-row {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-bottom: 8px;\n }\n .state-icon-row .state-icon-form {\n flex: 1;\n min-width: 0;\n }\n .state-icon-row ha-icon-button {\n flex: 0 0 auto;\n }\n .state-icon-add {\n margin-top: 4px;\n padding: 6px 14px;\n background: transparent;\n border: 1px dashed var(--divider-color, #e0e0e0);\n border-radius: 4px;\n color: var(--primary-color);\n cursor: pointer;\n font: inherit;\n }\n .state-icon-add:hover {\n background: var(--secondary-background-color);\n }\n .section-label {\n margin-top: 16px;\n margin-bottom: 4px;\n font-size: 12px;\n font-weight: 500;\n color: var(--secondary-text-color);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n }\n .footer {\n margin-top: 16px;\n padding-top: 8px;\n border-top: 1px solid var(--divider-color, #e0e0e0);\n font-size: 11px;\n color: var(--secondary-text-color);\n text-align: right;\n }\n "])))),customElements.define("multiple-entity-row-editor",vn);var En=function(t){return t.stopPropagation()};console.info("%c MULTIPLE-ENTITY-ROW %c ".concat("4.7.1"," (built ").concat("2026-07-23T00:32:46.387Z",", ").concat("aed1d07",") "),"color: cyan; background: black; font-weight: bold;","color: darkblue; background: white; font-weight: bold;");var Cn=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),function(t,e,n){return e=On(e),function(t,e){if(e&&("object"==yn(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,Sn()?Reflect.construct(e,n||[],On(t).constructor):e.apply(t,n))}(this,e,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&xn(t,e)}(e,t),function(t,e,n){return e&&An(t.prototype,e),n&&An(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}(e,[{key:"setConfig",value:function(t){var e;if(!t||!t.entity)throw new Error("Please define a main entity.");t.entities&&t.entities.forEach(function(t){return Dt(t)}),t.secondary_info&&Dt(t.secondary_info),this.entityIds=function(t){var e,n,i,o;return[t.entity,null===(e=t.hide_if)||void 0===e?void 0:e.entity,null===(n=t.secondary_info)||void 0===n?void 0:n.entity,null===(i=t.secondary_info)||void 0===i||null===(i=i.hide_if)||void 0===i?void 0:i.entity].concat(null===(o=t.entities)||void 0===o?void 0:o.flatMap(function(t){var e;return"string"==typeof t?t:[t.entity,null===(e=t.hide_if)||void 0===e?void 0:e.entity]})).filter(function(t){return t})}(t),this._actionHandlers=new Map,this.config=gn(gn({},t),{},{name:!1===t.name?" ":t.name,format:null!==(e=t.format)&&void 0!==e?e:t.time_format})}},{key:"shouldUpdate",value:function(t){return function(t,e){if(e.has("config"))return!0;if(e.has("_hass")){var n=e.get("_hass");return!n||!!kt.some(function(e){return n[e]!==t._hass[e]})||t.entityIds.some(function(e){return n.states[e]!==t._hass.states[e]})}return!1}(this,t)}},{key:"hass",set:function(t){var e,n,i,o=this;(this._hass=t,t&&this.config)&&(this.stateObj=t.states[this.config.entity],Ot(this.config.secondary_info)&&(this.info=null!==(i=t.states[this.config.secondary_info.entity])&&void 0!==i?i:this.stateObj),this.entities=null!==(e=null===(n=this.config.entities)||void 0===n?void 0:n.map(function(e){var n="string"==typeof e?{entity:e}:e;return gn(gn({},n),{},{stateObj:n.entity?t.states[n.entity]:o.stateObj})}))&&void 0!==e?e:[])}},{key:"render",value:function(){var t=this;if(!this._hass||!this.config)return W(Ne||(Ne=bn([""])));if(!this.stateObj)return this.renderWarning();var e=Wt(this.stateObj,this.config),n=e?gn(gn({},this.config),{},{icon:e}):this.config;return W(Ue||(Ue=bn(['<hui-generic-entity-row\n style="','"\n .hass="','"\n .config="','"\n .secondaryText="','"\n .catchInteraction=','\n >\n <div class="','">\n ',"\n </div>\n </hui-generic-entity-row>"])),Bt(this.config.icon_color),this._hass,n,this.renderSecondaryInfo(),!0,this.config.column?"entities-column":"entities-row",this.config.show_state_first?W(Le||(Le=bn(["","",""])),this.renderMainEntity(),this.entities.map(function(e,n){return t.renderEntity(e.stateObj,e,n)})):W(Ve||(Ve=bn(["","",""])),this.entities.map(function(e,n){return t.renderEntity(e.stateObj,e,n)}),this.renderMainEntity()))}},{key:"renderSecondaryInfo",value:function(){if(!this.config.secondary_info||"string"==typeof(t=this.config.secondary_info)&&vt.includes(t)||Ct(this.info,this.config.secondary_info,this._hass))return null;var t;if("string"==typeof this.config.secondary_info)return W(ze||(ze=bn(["",""])),this.config.secondary_info);var e=Zt(this.info,this.config.secondary_info);return W(Be||(Be=bn([""," ",""])),e,this.renderValue(this.info,this.config.secondary_info))}},{key:"renderMainEntity",value:function(){if(!1===this.config.show_state)return null;if(Ct(this.stateObj,this.config,this._hass))return this.config.default?W(We||(We=bn(['<div class="state entity" style="','">\n ',"\n <div>","</div>\n </div>"])),Gt(this.config),this.renderMainHeader(),this.config.default):null;var t=this.getGestureHandlers("main",this.config.entity,this.config);return W(Ze||(Ze=bn(['<div\n class="state entity"\n style="','"\n @pointerdown="','"\n @pointerup="','"\n @pointercancel="','"\n @mousedown="','"\n @click="','"\n @touchstart="','"\n @touchend="','"\n @touchcancel="','"\n @contextmenu="','"\n >\n ',"\n <div>","</div>\n </div>"])),Gt(this.config),null==t?void 0:t.onDown,null==t?void 0:t.onUp,null==t?void 0:t.onCancel,En,En,En,En,En,En,this.renderMainHeader(),this.renderValue(this.stateObj,this.config))}},{key:"renderEntity",value:function(t,e,n){var i;if(!t||Ct(t,e,this._hass))return e.default?W(qe||(qe=bn(['<div class="entity" style="','">\n <span>',"</span>\n <div>","</div>\n </div>"])),Gt(e),t?Zt(t,e):e.name,e.default):null;var o=this.getGestureHandlers("sub-".concat(n),t.entity_id,e);return W(Je||(Je=bn(['<div\n class="entity"\n style="','"\n @pointerdown="','"\n @pointerup="','"\n @pointercancel="','"\n @mousedown="','"\n @click="','"\n @touchstart="','"\n @touchend="','"\n @touchcancel="','"\n @contextmenu="','"\n >\n <span>',"</span>\n <div>\n ","\n </div>\n </div>"])),Gt(e),null==o?void 0:o.onDown,null==o?void 0:o.onUp,null==o?void 0:o.onCancel,En,En,En,En,En,En,null!==(i=Zt(t,e))&&void 0!==i?i:this.headerPlaceholder(),e.icon||Ot(e.state_icon)?this.renderIcon(t,e):this.renderValue(t,e))}},{key:"renderMainHeader",value:function(){var t,e=null!==(t=this.config.state_header)&&void 0!==t?t:this.headerPlaceholder();return e?W(Ge||(Ge=bn(["<span>","</span>"])),e):null}},{key:"headerPlaceholder",value:function(){return void 0!==this.config.state_header||this.entities.some(function(t){return!1!==t.name&&(t.name||t.entity)})?" ":null}},{key:"renderValue",value:function(t,e){if(!0===e.toggle)return this.renderToggle(t,e);var n=e.attribute&&[ft,pt].includes(e.attribute);if(e.format&&mt.includes(e.format)){var i,o=n?t[e.attribute.replace("-","_")]:e.attribute?null!==(i=t.attributes[e.attribute])&&void 0!==i?i:t[e.attribute]:t.state,r=new Date(o);return r instanceof Date&&!isNaN(r.getTime())?W(Ke||(Ke=bn(["<hui-timestamp-display\n .hass=","\n .ts=","\n .format=","\n capitalize\n ></hui-timestamp-display>"])),this._hass,r,e.format):o}return n?W(Ye||(Ye=bn(["<ha-relative-time\n .hass=","\n .datetime=","\n capitalize\n ></ha-relative-time>"])),this._hass,t[e.attribute.replace("-","_")]):Jt(this._hass,t,e)}},{key:"renderToggle",value:function(t,e){var n,i=this,o=null===(n=e.tap_action)||void 0===n?void 0:n.confirmation;if(!o)return W(Qe||(Qe=bn(['<ha-entity-toggle .stateObj="','" .hass="','"></ha-entity-toggle>'])),t,this._hass);var r={handleEvent:function(n){var r,a;n.stopPropagation(),n.preventDefault();var s=Ot(o)&&(null===(r=o.exemptions)||void 0===r?void 0:r.some(function(t){var e;return t.user===(null===(e=i._hass.user)||void 0===e?void 0:e.id)})),c=Ot(o)&&o.text||"Are you sure you want to toggle ".concat(null!==(a=Zt(t,e))&&void 0!==a?a:t.entity_id,"?");(s||confirm(c))&&i._hass.callService("homeassistant","toggle",{entity_id:t.entity_id})},capture:!0};return W(Xe||(Xe=bn(["<span @click=",'>\n <ha-entity-toggle .stateObj="','" .hass="','"></ha-entity-toggle>\n </span>'])),r,t,this._hass)}},{key:"renderIcon",value:function(t,e){var n,i=null!==(n=Wt(t,e))&&void 0!==n?n:!0===e.icon?t.attributes.icon||null:e.icon;return W(tn||(tn=bn(['<state-badge\n class="icon-small"\n style="','"\n .hass=','\n .stateObj="','"\n .overrideIcon="','"\n .stateColor="','"\n ></state-badge>'])),Bt(e.icon_color),this._hass,t,i,e.state_color)}},{key:"renderWarning",value:function(){return W(en||(en=bn(["<hui-warning>\n ","\n </hui-warning>"])),this._hass.localize("ui.panel.lovelace.warning.entity_not_found","entity",this.config.entity))}},{key:"getGestureHandlers",value:function(t,e,n){var i,o,r,a,s,c,l,u=this;return!0===n.toggle?null:(this._actionHandlers.has(t)||this._actionHandlers.set(t,(i=function(t,i){return u.dispatchAction(e,n,t,i)},o={hasHold:!!n.hold_action,hasDoubleTap:!!n.double_tap_action},s=o.hasHold,c=o.hasDoubleTap,l=!1,{onDown:function(){l=!1,s&&(r=setTimeout(function(){l=!0},500))},onUp:function(){if(clearTimeout(r),l)return l=!1,void i(!0,!1);c?a?(clearTimeout(a),a=void 0,i(!1,!0)):a=setTimeout(function(){a=void 0,i(!1,!1)},250):i(!1,!1)},onCancel:function(){clearTimeout(r)}})),this._actionHandlers.get(t))}},{key:"dispatchAction",value:function(t,e,n,i){var o,r=i?e.double_tap_action:n?e.hold_action:null!==(o=e.tap_action)&&void 0!==o?o:{action:"more-info"};if(r&&"none"!==r.action){var a=i?"double_tap":n?"hold":"tap";xt(this,"hass-action",{config:wn({entity:r.entity||t},"".concat(a,"_action"),r),action:a})}}}],[{key:"getConfigElement",value:function(){return document.createElement("multiple-entity-row-editor")}},{key:"getStubConfig",value:function(t,e){var n,i,o=null!==(n=null!==(i=null==e?void 0:e.find(function(t){return t.startsWith("sensor.")}))&&void 0!==i?i:null==e?void 0:e[0])&&void 0!==n?n:"";return{entity:o}}},{key:"properties",get:function(){return{_hass:Object,config:Object,stateObj:Object}}},{key:"styles",get:function(){return r(Ft||(Ft=function(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}(["\n .icon-small {\n width: auto;\n }\n .entity {\n text-align: center;\n cursor: pointer;\n }\n .entity span {\n font-size: 10px;\n color: var(--multiple-entity-row-header-color, var(--secondary-text-color));\n }\n .entities-row {\n flex-direction: row;\n display: inline-flex;\n justify-content: space-between;\n align-items: center;\n }\n .entities-row .entity {\n margin-right: 16px;\n }\n .entities-row .entity:last-of-type {\n margin-right: 0;\n }\n .entities-column {\n flex-direction: column;\n display: flex;\n align-items: flex-end;\n justify-content: space-evenly;\n }\n .entities-column .entity div {\n display: inline-block;\n vertical-align: middle;\n }\n"])))}}])}(ut);customElements.define("multiple-entity-row",Cn),window.customCards=window.customCards||[],window.customCards.push({type:"multiple-entity-row",name:"Multiple Entity Row",description:"Show multiple entity states and attributes on a single entity row"})})(); |