diff --git a/package-lock.json b/package-lock.json index 2a5c67a..5a92ffe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "room-card", - "version": "1.08.00", + "version": "1.08.01", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "room-card", - "version": "1.08.00", + "version": "1.08.01", "license": "MIT", "dependencies": { "babel-jest": "^29.6.4", diff --git a/package.json b/package.json index 2c7c9b0..dd3756f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "room-card", - "version": "1.08.00", + "version": "1.08.01", "description": "Show entities in Home Assistant's Lovelace UI", "keywords": [ "home-assistant", diff --git a/room-card.js b/room-card.js index 5409b5c..71535a3 100644 --- a/room-card.js +++ b/room-card.js @@ -27,7 +27,7 @@ ${void 0===t.show_name||t.show_name?l.html`${(0,e.entityName)(t,i)}`:""}
${(0,e.renderIcon)(t.stateObj,t,i)}
${t.show_state?l.html`${(0,e.entityStateDisplay)(i,t)}`:""} - `,e.renderRows=(t,i,n)=>{const r=t.filter((t=>!(0,d.hideIfRow)(t,i)));return l.html`${r.map((t=>(0,e.renderEntitiesRow)(t,t.entities,i,n)))}`},e.extractValue=(t,e,i,o)=>{if(t.format.startsWith("precision")){const n=parseInt(t.format.slice(-1),10);e=(0,r.formatNumber)(e,i.locale,{minimumFractionDigits:n,maximumFractionDigits:n})}else isNaN(parseFloat(e))||!isFinite(e)||("brightness"===t.format?(e=Math.round(e/255*100),o="%"):t.format.startsWith("duration")?(e=(0,n.secondsToDuration)("duration-m"===t.format?e/1e3:e),o=void 0):"kilo"===t.format?e=(0,r.formatNumber)(e/1e3,i.locale,{maximumFractionDigits:2}):"invert"===t.format?e=(0,r.formatNumber)(e-2*e,i.locale):"position"===t.format&&(e=(0,r.formatNumber)(100-e,i.locale)));return{value:e,unit:o}}},846:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.hideIfEntity=e.hideIfRow=e.hideIfCard=e.hideUnavailable=void 0;const n=i(882);e.hideUnavailable=t=>t.hide_unavailable&&(0,n.isUnavailable)(t.stateObj),e.hideIfCard=(t,e)=>{var i,r;if(void 0===t.hide_if)return!1;if(t.hide_if){const o=null===(i=e.states[t.entity])||void 0===i?void 0:i.state,a=null===(r=t.hide_if.conditions)||void 0===r?void 0:r.filter((i=>{let r=o;if(i.entity){const t=e.states[i.entity];r=i.attribute?t.attributes[i.attribute]:t.state}return i.attribute&&!i.entity&&(r=e.states[t.entity].attributes[i.attribute]),(0,n.checkConditionalValue)(i,r)}));return(null==a?void 0:a.length)>0}},e.hideIfRow=(t,e)=>{var i;if(void 0===t.hide_if)return!1;if(t.hide_if){const r=null===(i=t.hide_if.conditions)||void 0===i?void 0:i.filter((t=>{if(t.entity){const i=e.states[t.entity];return(0,n.checkConditionalValue)(t,t.attribute?i.attributes[t.attribute]:i.state)}}));return(null==r?void 0:r.length)>0}},e.hideIfEntity=(t,i)=>{var r;if((0,e.hideUnavailable)(t))return!0;if(void 0===t.hide_if)return!1;if(t.hide_if){const e=t.stateObj.state,o=null===(r=t.hide_if.conditions)||void 0===r?void 0:r.filter((r=>{let o=e;if(r.entity){const t=i.states[r.entity];o=r.attribute?t.attributes[r.attribute]:t.state}return r.attribute&&!r.entity&&(o=t.stateObj.attributes[r.attribute]),(0,n.checkConditionalValue)(r,o)}));return(null==o?void 0:o.length)>0}}},607:function(t,e,i){var n=this&&this.__decorate||function(t,e,i,n){var r,o=arguments.length,a=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,i,a):r(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{l(n.next(t))}catch(t){o(t)}}function s(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=i(62),a=i(595),s=i(197),l=i(461),c=i(882),u=i(846),d=i(299),m=i(147);console.info(`%c ROOM-CARD %c ${m.version}`,"color: cyan; background: black; font-weight: bold;","color: darkblue; background: white; font-weight: bold;"),window.customCards=window.customCards||[],window.customCards.push({type:"room-card",name:"Room card",preview:!1,description:"Show multiple entity states, attributes and icons in a single card in Home Assistant's Lovelace UI"});let h=class extends o.LitElement{getChildCustomCardTypes(t,e){if(t)for(const i of t)0===i.type.indexOf("custom:")&&e.add(i.type.substring(7,i.type.length)),this.getChildCustomCardTypes(i.cards,e)}waitForDependentComponents(t){return r(this,void 0,void 0,(function*(){const e=new Set;this.getChildCustomCardTypes(t.cards,e),yield Promise.all(Array.from(e).map((t=>customElements.whenDefined(t))))}))}setConfig(t){return r(this,void 0,void 0,(function*(){(0,l.checkConfig)(t);const e=(0,c.getEntityIds)(t);this.config=Object.assign(Object.assign({},t),{entityIds:e}),yield this.waitForDependentComponents(t),window.loadCardHelpers&&(this._helpers=yield window.loadCardHelpers())}))}shouldUpdate(t){return void 0!==this.monitoredStates&&void 0!==this.config&&t.size>0&&void 0!==this._helpers&&void 0!==this._helpers.createCardElement}updateMonitoredStates(t){const e=Object.assign({},this.monitoredStates);let i=!1;for(const n of this.config.entityIds)if(n in t.states){const r=this.monitoredStates&&this.monitoredStates[n];(!this.monitoredStates||(null==r?void 0:r.last_updated)`,e.renderRows=(t,i,n)=>{const r=t.filter((t=>!(0,d.hideIfRow)(t,i)));return l.html`${r.map((t=>(0,e.renderEntitiesRow)(t,t.entities,i,n)))}`},e.extractValue=(t,e,i,o)=>{if(t.format.startsWith("precision")){const n=parseInt(t.format.slice(-1),10);e=(0,r.formatNumber)(e,i.locale,{minimumFractionDigits:n,maximumFractionDigits:n})}else isNaN(parseFloat(e))||!isFinite(e)||("brightness"===t.format?(e=Math.round(e/255*100),o="%"):t.format.startsWith("duration")?(e=(0,n.secondsToDuration)("duration-m"===t.format?e/1e3:e),o=void 0):"kilo"===t.format?e=(0,r.formatNumber)(e/1e3,i.locale,{maximumFractionDigits:2}):"invert"===t.format?e=(0,r.formatNumber)(e-2*e,i.locale):"position"===t.format&&(e=(0,r.formatNumber)(100-e,i.locale)));return{value:e,unit:o}}},846:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.hideIfEntity=e.hideIfRow=e.hideIfCard=e.hideUnavailable=void 0;const n=i(882);e.hideUnavailable=t=>t.hide_unavailable&&(0,n.isUnavailable)(t.stateObj),e.hideIfCard=(t,e)=>{var i,r;if(void 0===t.hide_if)return!1;if(t.hide_if){const o=null===(i=e.states[t.entity])||void 0===i?void 0:i.state,a=null===(r=t.hide_if.conditions)||void 0===r?void 0:r.filter((i=>{let r=o;if(i.entity){const t=e.states[i.entity];r=i.attribute?t.attributes[i.attribute]:t.state}return i.attribute&&!i.entity&&(r=e.states[t.entity].attributes[i.attribute]),(0,n.checkConditionalValue)(i,r)}));return(null==a?void 0:a.length)>0}},e.hideIfRow=(t,e)=>{var i;if(void 0===t.hide_if)return!1;if(t.hide_if){const r=null===(i=t.hide_if.conditions)||void 0===i?void 0:i.filter((t=>{if(t.entity){const i=e.states[t.entity];return(0,n.checkConditionalValue)(t,t.attribute?i.attributes[t.attribute]:i.state)}}));return(null==r?void 0:r.length)>0}},e.hideIfEntity=(t,i)=>{var r;if((0,e.hideUnavailable)(t))return!0;if(void 0===t.hide_if)return!1;if(t.hide_if){const e=t.stateObj.state,o=null===(r=t.hide_if.conditions)||void 0===r?void 0:r.filter((r=>{let o=e;if(r.entity){const t=i.states[r.entity];o=r.attribute?t.attributes[r.attribute]:t.state}return r.attribute&&!r.entity&&(o=t.stateObj.attributes[r.attribute]),(0,n.checkConditionalValue)(r,o)}));return(null==o?void 0:o.length)>0}}},607:function(t,e,i){var n=this&&this.__decorate||function(t,e,i,n){var r,o=arguments.length,a=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,n);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(a=(o<3?r(a):o>3?r(e,i,a):r(e,i))||a);return o>3&&a&&Object.defineProperty(e,i,a),a},r=this&&this.__awaiter||function(t,e,i,n){return new(i||(i=Promise))((function(r,o){function a(t){try{l(n.next(t))}catch(t){o(t)}}function s(t){try{l(n.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,s)}l((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=i(62),a=i(595),s=i(197),l=i(461),c=i(882),u=i(846),d=i(299),m=i(147);console.info(`%c ROOM-CARD %c ${m.version}`,"color: cyan; background: black; font-weight: bold;","color: darkblue; background: white; font-weight: bold;"),window.customCards=window.customCards||[],window.customCards.push({type:"room-card",name:"Room card",preview:!1,description:"Show multiple entity states, attributes and icons in a single card in Home Assistant's Lovelace UI"});let h=class extends o.LitElement{constructor(){super(...arguments),this.monitoredStates={}}getChildCustomCardTypes(t,e){if(t)for(const i of t)0===i.type.indexOf("custom:")&&e.add(i.type.substring(7,i.type.length)),this.getChildCustomCardTypes(i.cards,e)}waitForDependentComponents(t){return r(this,void 0,void 0,(function*(){const e=new Set;this.getChildCustomCardTypes(t.cards,e),yield Promise.all(Array.from(e).map((t=>customElements.whenDefined(t))))}))}setConfig(t){return r(this,void 0,void 0,(function*(){(0,l.checkConfig)(t);const e=(0,c.getEntityIds)(t);this.config=Object.assign(Object.assign({},t),{entityIds:e}),yield this.waitForDependentComponents(t),window.loadCardHelpers&&(this._helpers=yield window.loadCardHelpers())}))}shouldUpdate(t){return void 0!==this.monitoredStates&&void 0!==this.config&&t.size>0&&void 0!==this._helpers&&void 0!==this._helpers.createCardElement}updateMonitoredStates(t){const e=Object.assign({},this.monitoredStates);let i=!1;for(const n of this.config.entityIds)if(n in t.states){const r=this.monitoredStates&&this.monitoredStates[n];(!this.monitoredStates||(null==r?void 0:r.last_updated)
${(0,l.renderTitle)(this.config,this._hass,this,e)} @@ -125,4 +125,4 @@ .content-right { justify-content: right; } -`},704:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getTemplateOrAttribute=e.mapTemplate=e.templateStyling=void 0;const n=i(882);e.templateStyling=(t,e,i)=>{var r;const o=e.icon;return void 0!==(null===(r=null==o?void 0:o.template)||void 0===r?void 0:r.styles)?(0,n.evalTemplate)(i,t,o.template.styles):null},e.mapTemplate=(t,e)=>{if(void 0!==t&&t.template){const i=e.templates.filter((e=>e.name===t.template));if(i.length>0){const e=i[0];return Object.assign(Object.assign({stateObj:t.stateObj},t),e.template)}}return t},e.getTemplateOrAttribute=(t,e,i)=>t&&"object"==typeof t&&"template"in t?(0,n.evalTemplate)(e,i,t.template):t},882:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.parseConfig=e.renderClasses=e.evalTemplate=e.mapStateObject=e.checkConditionalValue=e.hasConfigOrEntitiesChanged=e.getCardEntities=e.getConditionEntitiesFromConfig=e.getConditionEntities=e.getEntity=e.getEntityIds=e.getValue=e.isUnavailable=e.isObject=void 0;const n=i(62),r=i(623),o=i(704);e.isObject=t=>"object"==typeof t&&!Array.isArray(t)&&!!t,e.isUnavailable=t=>!t||r.UNAVAILABLE_STATES.includes(t.state),e.getValue=t=>{if(t.attribute&&void 0===t.stateObj.attributes[t.attribute])throw new Error(`Entity: '${t.entity}' has no attribute named '${t.attribute}'`);return t.attribute?t.stateObj.attributes[t.attribute]:t.stateObj.state},e.getEntityIds=t=>{var i,n,r,o;return[t.entity].concat(null===(i=t.entities)||void 0===i?void 0:i.map((t=>(0,e.getEntity)(t)))).concat(null===(n=t.info_entities)||void 0===n?void 0:n.map((t=>(0,e.getEntity)(t)))).concat(null===(r=t.rows)||void 0===r?void 0:r.flatMap((t=>t.entities)).map((t=>(0,e.getEntity)(t)))).concat(null===(o=t.cards)||void 0===o?void 0:o.flatMap((t=>(0,e.getCardEntities)(t)))).concat((0,e.getConditionEntitiesFromConfig)(t)).filter((t=>t))},e.getEntity=t=>void 0===t?null:"string"==typeof t?t:t.entity,e.getConditionEntities=t=>{let e=[];return null==t||t.forEach((t=>{var i,n,r,o;const a=null===(n=null===(i=null==t?void 0:t.icon)||void 0===i?void 0:i.conditions)||void 0===n?void 0:n.filter((t=>void 0!==t.entity));a&&(e=e.concat(a));const s=null===(o=null===(r=null==t?void 0:t.hide_if)||void 0===r?void 0:r.conditions)||void 0===o?void 0:o.filter((t=>void 0!==t.entity));s&&(e=e.concat(s))})),e},e.getConditionEntitiesFromConfig=t=>{var i;const n=[t.entities,t.info_entities,null===(i=t.rows)||void 0===i?void 0:i.flatMap((t=>t.entities))];return(0,e.getConditionEntities)(n.flatMap((t=>t))).filter((t=>t.entity)).map((t=>t.entity))},e.getCardEntities=t=>{var i,n;return[(0,e.getEntity)(t.entity)].concat(null===(i=t.cards)||void 0===i?void 0:i.flatMap((t=>(0,e.getCardEntities)(t)))).concat(null===(n=t.entities)||void 0===n?void 0:n.flatMap((t=>(0,e.getEntity)(t)))).filter((t=>t))},e.hasConfigOrEntitiesChanged=(t,e)=>{if(e.has("config"))return!0;const i=e.get("_hass");return!!i&&t.entityIds.some((e=>i.states[e]!==t.hass.states[e]))},e.checkConditionalValue=(t,e)=>{const i="boolean"==typeof t.value?String(t.value):t.value;return"equals"==t.condition&&e==i||"not_equals"==t.condition&&e!=i||"above"==t.condition&&e>i||"below"==t.condition&&e{let n="string"==typeof t?{entity:t}:t;return n=(0,o.mapTemplate)(n,i),Object.assign(Object.assign({},n),{stateObj:e.states[n.entity]})},e.evalTemplate=(t,e,i)=>{try{return new Function("states","entity","user","hass","html",`'use strict'; ${i}`).call(this,null==t?void 0:t.states,e,null==t?void 0:t.user,t,n.html)}catch(t){const e=i.length<=100?i.trim():`${i.trim().substring(0,98)}...`;throw t.message=`${t.name}: ${t.message} in '${e}'`,t.name="RoomCardJSTemplateError",t}},e.renderClasses=(t,e)=>`entities-row ${t.content_alignment?`content-${t.content_alignment}`:"content-left"}${void 0!==e?` ${e}`:""}`,e.parseConfig=(t,i)=>{var n,r,o,a,s,l;const c={info_entities:[],entities:[]};return i&&t?(c.stateObj=void 0!==t.entity?i.states[t.entity]:void 0,c.entity=void 0!==t.entity?Object.assign(Object.assign({},t),{stateObj:c.stateObj}):void 0,c.info_entities=null!==(r=null===(n=t.info_entities)||void 0===n?void 0:n.map((n=>(0,e.mapStateObject)(n,i,t))))&&void 0!==r?r:[],c.entities=null!==(a=null===(o=t.entities)||void 0===o?void 0:o.map((n=>(0,e.mapStateObject)(n,i,t))))&&void 0!==a?a:[],c.rows=null!==(l=null===(s=t.rows)||void 0===s?void 0:s.map((n=>{var r;return{entities:null===(r=n.entities)||void 0===r?void 0:r.map((n=>(0,e.mapStateObject)(n,i,t))),hide_if:n.hide_if,content_alignment:n.content_alignment}})))&&void 0!==l?l:[],t.hass=i,c):c}},595:(t,e,i)=>{i.r(e),i.d(e,{customElement:()=>n,eventOptions:()=>c,property:()=>a,query:()=>u,queryAll:()=>d,queryAssignedElements:()=>f,queryAssignedNodes:()=>v,queryAsync:()=>m,state:()=>s});const n=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e),r=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},o=(t,e,i)=>{e.constructor.createProperty(i,t)};function a(t){return(e,i)=>void 0!==i?o(t,e,i):r(t,e)}function s(t){return a({...t,state:!0})}const l=({finisher:t,descriptor:e})=>(i,n)=>{var r;if(void 0===n){const n=null!==(r=i.originalKey)&&void 0!==r?r:i.key,o=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(i.key)}:{...i,key:n};return null!=t&&(o.finisher=function(e){t(e,n)}),o}{const r=i.constructor;void 0!==e&&Object.defineProperty(i,n,e(n)),null==t||t(r,n)}};function c(t){return l({finisher:(e,i)=>{Object.assign(e.prototype[i],t)}})}function u(t,e){return l({descriptor:i=>{const n={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;n.get=function(){var i,n;return void 0===this[e]&&(this[e]=null!==(n=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}function d(t){return l({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}function m(t){return l({descriptor:e=>({async get(){var e;return await this.updateComplete,null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t)},enumerable:!0,configurable:!0})})}var h;const p=null!=(null===(h=window.HTMLSlotElement)||void 0===h?void 0:h.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function f(t){const{slot:e,selector:i}=null!=t?t:{};return l({descriptor:n=>({get(){var n;const r="slot"+(e?`[name=${e}]`:":not([name])"),o=null===(n=this.renderRoot)||void 0===n?void 0:n.querySelector(r),a=null!=o?p(o,t):[];return i?a.filter((t=>t.matches(i))):a},enumerable:!0,configurable:!0})})}function v(t,e,i){let n,r=t;return"object"==typeof t?(r=t.slot,n=t):n={flatten:e},i?f({slot:r,flatten:e,selector:i}):l({descriptor:t=>({get(){var t,e;const i="slot"+(r?`[name=${r}]`:":not([name])"),o=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(i);return null!==(e=null==o?void 0:o.assignedNodes(n))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}},156:(t,e,i)=>{i.r(e),i.d(e,{Directive:()=>o,PartType:()=>n,directive:()=>r});const n={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},r=t=>(...e)=>({_$litDirective$:t,values:e});class o{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},62:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>s,LitElement:()=>pt,ReactiveElement:()=>w,UpdatingElement:()=>ht,_$LE:()=>vt,_$LH:()=>lt,adoptStyles:()=>u,css:()=>c,defaultConverter:()=>g,getCompatibleStyle:()=>d,html:()=>B,isServer:()=>gt,noChange:()=>W,notEqual:()=>y,nothing:()=>Y,render:()=>ut,supportsAdoptingStyleSheets:()=>r,svg:()=>q,unsafeCSS:()=>l});const n=window,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),a=new WeakMap;class s{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&a.set(e,t))}return t}toString(){return this.cssText}}const l=t=>new s("string"==typeof t?t:t+"",void 0,o),c=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>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.")})(i)+t[n+1]),t[0]);return new s(i,t,o)},u=(t,e)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),r=n.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=e.cssText,t.appendChild(i)}))},d=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return l(e)})(t):t;var m;const h=window,p=h.trustedTypes,f=p?p.emptyScript:"",v=h.reactiveElementPolyfillSupport,g={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},y=(t,e)=>e!==t&&(e==e||t==t),_={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:y},b="finalized";class w extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||_}static finalize(){if(this.hasOwnProperty(b))return!1;this[b]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return u(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=_){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const o=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:g).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:g;this._$El=r,this[r]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||y)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var $;w[b]=!0,w.elementProperties=new Map,w.elementStyles=[],w.shadowRootOptions={mode:"open"},null==v||v({ReactiveElement:w}),(null!==(m=h.reactiveElementVersions)&&void 0!==m?m:h.reactiveElementVersions=[]).push("1.6.3");const A=window,E=A.trustedTypes,S=E?E.createPolicy("lit-html",{createHTML:t=>t}):void 0,T="$lit$",O=`lit$${(Math.random()+"").slice(9)}$`,C="?"+O,k=`<${C}>`,N=document,D=()=>N.createComment(""),x=t=>null===t||"object"!=typeof t&&"function"!=typeof t,j=Array.isArray,I=t=>j(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),M="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,U=/>/g,R=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,L=/"/g,V=/^(?:script|style|textarea|title)$/i,z=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),B=z(1),q=z(2),W=Symbol.for("lit-noChange"),Y=Symbol.for("lit-nothing"),K=new WeakMap,G=N.createTreeWalker(N,129,null,!1);function J(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const X=(t,e)=>{const i=t.length-1,n=[];let r,o=2===e?"":"",a=P;for(let e=0;e"===l[0]?(a=null!=r?r:P,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?R:'"'===l[3]?L:H):a===L||a===H?a=R:a===F||a===U?a=P:(a=R,r=void 0);const d=a===R&&t[e+1].startsWith("/>")?" ":"";o+=a===P?i+k:c>=0?(n.push(s),i.slice(0,c)+T+i.slice(c)+O+d):i+O+(-2===c?(n.push(void 0),e):d)}return[J(t,o+(t[i]||"")+(2===e?"":"")),n]};class Z{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0;const a=t.length-1,s=this.parts,[l,c]=X(t,e);if(this.el=Z.createElement(l,i),G.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=G.nextNode())&&s.length0){n.textContent=E?E.emptyScript:"";for(let i=0;i2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Y}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let o=!1;if(void 0===r)t=Q(this,t,e,0),o=!x(t)||t!==this._$AH&&t!==W,o&&(this._$AH=t);else{const n=t;let a,s;for(t=r[0],a=0;a{var n,r;const o=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let a=o._$litPart$;if(void 0===a){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;o._$litPart$=a=new et(e.insertBefore(D(),t),t,void 0,null!=i?i:{})}return a._$AI(t),a};var dt,mt;const ht=w;class pt extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ut(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return W}}pt.finalized=!0,pt._$litElement$=!0,null===(dt=globalThis.litElementHydrateSupport)||void 0===dt||dt.call(globalThis,{LitElement:pt});const ft=globalThis.litElementPolyfillSupport;null==ft||ft({LitElement:pt});const vt={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(mt=globalThis.litElementVersions)&&void 0!==mt?mt:globalThis.litElementVersions=[]).push("3.3.3");const gt=!1},147:t=>{t.exports=JSON.parse('{"name":"room-card","version":"1.07.30","description":"Show entities in Home Assistant\'s Lovelace UI","keywords":["home-assistant","homeassistant","lovelace","custom-cards","multiple","entity","row"],"module":"room-card.js","license":"MIT","dependencies":{"babel-jest":"^29.6.4","custom-card-helpers":"^1.8.0","jest-environment-jsdom":"^29.5.0","jest-ts-auto-mock":"^2.1.0","lit":"^2.7.5","ts-auto-mock":"3.5.0","ttypescript":"^1.5.13","yarn":"^1.22.18"},"devDependencies":{"@babel/core":"^7.22.1","@babel/plugin-transform-runtime":"^7.22.4","@babel/preset-env":"^7.22.5","@types/jest":"^29.5.3","@typescript-eslint/eslint-plugin":"^5.60.1","@typescript-eslint/parser":"^5.59.1","babel-loader":"^9.1.3","codecov":"^3.8.3","compression-webpack-plugin":"^10.0.0","eslint":"^8.44.0","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.0.0","jest":"^29.6.2","prettier":"^2.8.8","ts-jest":"^29.1.1","ts-loader":"^9.4.4","typescript":"^4.9.5","webpack":"^5.88.2","webpack-cli":"^5.0.2"},"scripts":{"lint":"eslint src/**/*.ts","dev":"webpack -c webpack.config.js","build":"yarn lint && webpack -c webpack.config.js","test":"jest","coverage":"jest --coverage","workflow":"jest --coverage --json --outputFile=/home/runner/work/room-card/room-card/jest.results.json","prebuild":"copy git-hooks\\\\pre-commit .git\\\\hooks\\\\ && echo \'hook copied\'"}}')}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(607)})(); +`},704:(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getTemplateOrAttribute=e.mapTemplate=e.templateStyling=void 0;const n=i(882);e.templateStyling=(t,e,i)=>{var r;const o=e.icon;return void 0!==(null===(r=null==o?void 0:o.template)||void 0===r?void 0:r.styles)?(0,n.evalTemplate)(i,t,o.template.styles):null},e.mapTemplate=(t,e)=>{if(void 0!==t&&t.template){const i=e.templates.filter((e=>e.name===t.template));if(i.length>0){const e=i[0];return Object.assign(Object.assign({stateObj:t.stateObj},t),e.template)}}return t},e.getTemplateOrAttribute=(t,e,i)=>t&&"object"==typeof t&&"template"in t?(0,n.evalTemplate)(e,i,t.template):t},882:function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.parseConfig=e.renderClasses=e.evalTemplate=e.mapStateObject=e.checkConditionalValue=e.hasConfigOrEntitiesChanged=e.getCardEntities=e.getConditionEntitiesFromConfig=e.getConditionEntities=e.getEntity=e.getEntityIds=e.getValue=e.isUnavailable=e.isObject=void 0;const n=i(62),r=i(623),o=i(704);e.isObject=t=>"object"==typeof t&&!Array.isArray(t)&&!!t,e.isUnavailable=t=>!t||r.UNAVAILABLE_STATES.includes(t.state),e.getValue=t=>{if(t.attribute&&void 0===t.stateObj.attributes[t.attribute])throw new Error(`Entity: '${t.entity}' has no attribute named '${t.attribute}'`);return t.attribute?t.stateObj.attributes[t.attribute]:t.stateObj.state},e.getEntityIds=t=>{var i,n,r,o;return[t.entity].concat(null===(i=t.entities)||void 0===i?void 0:i.map((t=>(0,e.getEntity)(t)))).concat(null===(n=t.info_entities)||void 0===n?void 0:n.map((t=>(0,e.getEntity)(t)))).concat(null===(r=t.rows)||void 0===r?void 0:r.flatMap((t=>t.entities)).map((t=>(0,e.getEntity)(t)))).concat(null===(o=t.cards)||void 0===o?void 0:o.flatMap((t=>(0,e.getCardEntities)(t)))).concat((0,e.getConditionEntitiesFromConfig)(t)).filter((t=>t))},e.getEntity=t=>void 0===t?null:"string"==typeof t?t:t.entity,e.getConditionEntities=t=>{let e=[];return null==t||t.forEach((t=>{var i,n,r,o;const a=null===(n=null===(i=null==t?void 0:t.icon)||void 0===i?void 0:i.conditions)||void 0===n?void 0:n.filter((t=>void 0!==t.entity));a&&(e=e.concat(a));const s=null===(o=null===(r=null==t?void 0:t.hide_if)||void 0===r?void 0:r.conditions)||void 0===o?void 0:o.filter((t=>void 0!==t.entity));s&&(e=e.concat(s))})),e},e.getConditionEntitiesFromConfig=t=>{var i;const n=[t.entities,t.info_entities,null===(i=t.rows)||void 0===i?void 0:i.flatMap((t=>t.entities))];return(0,e.getConditionEntities)(n.flatMap((t=>t))).filter((t=>t.entity)).map((t=>t.entity))},e.getCardEntities=t=>{var i,n;return[(0,e.getEntity)(t.entity)].concat(null===(i=t.cards)||void 0===i?void 0:i.flatMap((t=>(0,e.getCardEntities)(t)))).concat(null===(n=t.entities)||void 0===n?void 0:n.flatMap((t=>(0,e.getEntity)(t)))).filter((t=>t))},e.hasConfigOrEntitiesChanged=(t,e)=>{if(e.has("config"))return!0;const i=e.get("_hass");return!!i&&t.entityIds.some((e=>i.states[e]!==t.hass.states[e]))},e.checkConditionalValue=(t,e)=>{const i="boolean"==typeof t.value?String(t.value):t.value;return"equals"==t.condition&&e==i||"not_equals"==t.condition&&e!=i||"above"==t.condition&&e>i||"below"==t.condition&&e{let n="string"==typeof t?{entity:t}:t;return n=(0,o.mapTemplate)(n,i),Object.assign(Object.assign({},n),{stateObj:e.states[n.entity]})},e.evalTemplate=(t,e,i)=>{try{return new Function("states","entity","user","hass","html",`'use strict'; ${i}`).call(this,null==t?void 0:t.states,e,null==t?void 0:t.user,t,n.html)}catch(t){const e=i.length<=100?i.trim():`${i.trim().substring(0,98)}...`;throw t.message=`${t.name}: ${t.message} in '${e}'`,t.name="RoomCardJSTemplateError",t}},e.renderClasses=(t,e)=>`entities-row ${t.content_alignment?`content-${t.content_alignment}`:"content-left"}${void 0!==e?` ${e}`:""}`,e.parseConfig=(t,i)=>{var n,r,o,a,s,l;const c={info_entities:[],entities:[]};return i&&t?(c.stateObj=void 0!==t.entity?i.states[t.entity]:void 0,c.entity=void 0!==t.entity?Object.assign(Object.assign({},t),{stateObj:c.stateObj}):void 0,c.info_entities=null!==(r=null===(n=t.info_entities)||void 0===n?void 0:n.map((n=>(0,e.mapStateObject)(n,i,t))))&&void 0!==r?r:[],c.entities=null!==(a=null===(o=t.entities)||void 0===o?void 0:o.map((n=>(0,e.mapStateObject)(n,i,t))))&&void 0!==a?a:[],c.rows=null!==(l=null===(s=t.rows)||void 0===s?void 0:s.map((n=>{var r;return{entities:null===(r=n.entities)||void 0===r?void 0:r.map((n=>(0,e.mapStateObject)(n,i,t))),hide_if:n.hide_if,content_alignment:n.content_alignment}})))&&void 0!==l?l:[],t.hass=i,c):c}},595:(t,e,i)=>{i.r(e),i.d(e,{customElement:()=>n,eventOptions:()=>c,property:()=>a,query:()=>u,queryAll:()=>d,queryAssignedElements:()=>f,queryAssignedNodes:()=>v,queryAsync:()=>m,state:()=>s});const n=t=>e=>"function"==typeof e?((t,e)=>(customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){customElements.define(t,e)}}})(t,e),r=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}},o=(t,e,i)=>{e.constructor.createProperty(i,t)};function a(t){return(e,i)=>void 0!==i?o(t,e,i):r(t,e)}function s(t){return a({...t,state:!0})}const l=({finisher:t,descriptor:e})=>(i,n)=>{var r;if(void 0===n){const n=null!==(r=i.originalKey)&&void 0!==r?r:i.key,o=null!=e?{kind:"method",placement:"prototype",key:n,descriptor:e(i.key)}:{...i,key:n};return null!=t&&(o.finisher=function(e){t(e,n)}),o}{const r=i.constructor;void 0!==e&&Object.defineProperty(i,n,e(n)),null==t||t(r,n)}};function c(t){return l({finisher:(e,i)=>{Object.assign(e.prototype[i],t)}})}function u(t,e){return l({descriptor:i=>{const n={get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t))&&void 0!==i?i:null},enumerable:!0,configurable:!0};if(e){const e="symbol"==typeof i?Symbol():"__"+i;n.get=function(){var i,n;return void 0===this[e]&&(this[e]=null!==(n=null===(i=this.renderRoot)||void 0===i?void 0:i.querySelector(t))&&void 0!==n?n:null),this[e]}}return n}})}function d(t){return l({descriptor:e=>({get(){var e,i;return null!==(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelectorAll(t))&&void 0!==i?i:[]},enumerable:!0,configurable:!0})})}function m(t){return l({descriptor:e=>({async get(){var e;return await this.updateComplete,null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector(t)},enumerable:!0,configurable:!0})})}var h;const p=null!=(null===(h=window.HTMLSlotElement)||void 0===h?void 0:h.prototype.assignedElements)?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE));function f(t){const{slot:e,selector:i}=null!=t?t:{};return l({descriptor:n=>({get(){var n;const r="slot"+(e?`[name=${e}]`:":not([name])"),o=null===(n=this.renderRoot)||void 0===n?void 0:n.querySelector(r),a=null!=o?p(o,t):[];return i?a.filter((t=>t.matches(i))):a},enumerable:!0,configurable:!0})})}function v(t,e,i){let n,r=t;return"object"==typeof t?(r=t.slot,n=t):n={flatten:e},i?f({slot:r,flatten:e,selector:i}):l({descriptor:t=>({get(){var t,e;const i="slot"+(r?`[name=${r}]`:":not([name])"),o=null===(t=this.renderRoot)||void 0===t?void 0:t.querySelector(i);return null!==(e=null==o?void 0:o.assignedNodes(n))&&void 0!==e?e:[]},enumerable:!0,configurable:!0})})}},156:(t,e,i)=>{i.r(e),i.d(e,{Directive:()=>o,PartType:()=>n,directive:()=>r});const n={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},r=t=>(...e)=>({_$litDirective$:t,values:e});class o{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}},62:(t,e,i)=>{i.r(e),i.d(e,{CSSResult:()=>s,LitElement:()=>pt,ReactiveElement:()=>w,UpdatingElement:()=>ht,_$LE:()=>vt,_$LH:()=>lt,adoptStyles:()=>u,css:()=>c,defaultConverter:()=>g,getCompatibleStyle:()=>d,html:()=>B,isServer:()=>gt,noChange:()=>W,notEqual:()=>y,nothing:()=>Y,render:()=>ut,supportsAdoptingStyleSheets:()=>r,svg:()=>q,unsafeCSS:()=>l});const n=window,r=n.ShadowRoot&&(void 0===n.ShadyCSS||n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),a=new WeakMap;class s{constructor(t,e,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(r&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=a.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&a.set(e,t))}return t}toString(){return this.cssText}}const l=t=>new s("string"==typeof t?t:t+"",void 0,o),c=(t,...e)=>{const i=1===t.length?t[0]:e.reduce(((e,i,n)=>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.")})(i)+t[n+1]),t[0]);return new s(i,t,o)},u=(t,e)=>{r?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),r=n.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=e.cssText,t.appendChild(i)}))},d=r?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return l(e)})(t):t;var m;const h=window,p=h.trustedTypes,f=p?p.emptyScript:"",v=h.reactiveElementPolyfillSupport,g={toAttribute(t,e){switch(e){case Boolean:t=t?f:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},y=(t,e)=>e!==t&&(e==e||t==t),_={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:y},b="finalized";class w extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),(null!==(e=this.h)&&void 0!==e?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const n=this._$Ep(i,e);void 0!==n&&(this._$Ev.set(n,i),t.push(n))})),t}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const r=this[t];this[e]=n,this.requestUpdate(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||_}static finalize(){if(this.hasOwnProperty(b))return!1;this[b]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),void 0!==t.h&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static _$Ep(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(t=this.constructor.h)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$ES)&&void 0!==e?e:this._$ES=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$ES)||void 0===e||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return u(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=_){var n;const r=this.constructor._$Ep(t,i);if(void 0!==r&&!0===i.reflect){const o=(void 0!==(null===(n=i.converter)||void 0===n?void 0:n.toAttribute)?i.converter:g).toAttribute(e,i.type);this._$El=t,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$El=null}}_$AK(t,e){var i;const n=this.constructor,r=n._$Ev.get(t);if(void 0!==r&&this._$El!==r){const t=n.getPropertyOptions(r),o="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==(null===(i=t.converter)||void 0===i?void 0:i.fromAttribute)?t.converter:g;this._$El=r,this[r]=o.fromAttribute(e,t.type),this._$El=null}}requestUpdate(t,e,i){let n=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||y)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$El!==t&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(t,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((t,e)=>this[e]=t)),this._$Ei=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$ES)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$Ek()}catch(t){throw e=!1,this._$Ek(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$ES)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){void 0!==this._$EC&&(this._$EC.forEach(((t,e)=>this._$EO(e,this[e],t))),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}}var $;w[b]=!0,w.elementProperties=new Map,w.elementStyles=[],w.shadowRootOptions={mode:"open"},null==v||v({ReactiveElement:w}),(null!==(m=h.reactiveElementVersions)&&void 0!==m?m:h.reactiveElementVersions=[]).push("1.6.3");const A=window,E=A.trustedTypes,S=E?E.createPolicy("lit-html",{createHTML:t=>t}):void 0,T="$lit$",O=`lit$${(Math.random()+"").slice(9)}$`,C="?"+O,k=`<${C}>`,N=document,D=()=>N.createComment(""),x=t=>null===t||"object"!=typeof t&&"function"!=typeof t,j=Array.isArray,I=t=>j(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]),M="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,U=/>/g,R=RegExp(`>|${M}(?:([^\\s"'>=/]+)(${M}*=${M}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,L=/"/g,V=/^(?:script|style|textarea|title)$/i,z=t=>(e,...i)=>({_$litType$:t,strings:e,values:i}),B=z(1),q=z(2),W=Symbol.for("lit-noChange"),Y=Symbol.for("lit-nothing"),K=new WeakMap,G=N.createTreeWalker(N,129,null,!1);function J(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const X=(t,e)=>{const i=t.length-1,n=[];let r,o=2===e?"":"",a=P;for(let e=0;e"===l[0]?(a=null!=r?r:P,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?R:'"'===l[3]?L:H):a===L||a===H?a=R:a===F||a===U?a=P:(a=R,r=void 0);const d=a===R&&t[e+1].startsWith("/>")?" ":"";o+=a===P?i+k:c>=0?(n.push(s),i.slice(0,c)+T+i.slice(c)+O+d):i+O+(-2===c?(n.push(void 0),e):d)}return[J(t,o+(t[i]||"")+(2===e?"":"")),n]};class Z{constructor({strings:t,_$litType$:e},i){let n;this.parts=[];let r=0,o=0;const a=t.length-1,s=this.parts,[l,c]=X(t,e);if(this.el=Z.createElement(l,i),G.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(n=G.nextNode())&&s.length0){n.textContent=E?E.emptyScript:"";for(let i=0;i2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Y}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,n){const r=this.strings;let o=!1;if(void 0===r)t=Q(this,t,e,0),o=!x(t)||t!==this._$AH&&t!==W,o&&(this._$AH=t);else{const n=t;let a,s;for(t=r[0],a=0;a{var n,r;const o=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:e;let a=o._$litPart$;if(void 0===a){const t=null!==(r=null==i?void 0:i.renderBefore)&&void 0!==r?r:null;o._$litPart$=a=new et(e.insertBefore(D(),t),t,void 0,null!=i?i:{})}return a._$AI(t),a};var dt,mt;const ht=w;class pt extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=ut(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Do)||void 0===t||t.setConnected(!1)}render(){return W}}pt.finalized=!0,pt._$litElement$=!0,null===(dt=globalThis.litElementHydrateSupport)||void 0===dt||dt.call(globalThis,{LitElement:pt});const ft=globalThis.litElementPolyfillSupport;null==ft||ft({LitElement:pt});const vt={_$AK:(t,e,i)=>{t._$AK(e,i)},_$AL:t=>t._$AL};(null!==(mt=globalThis.litElementVersions)&&void 0!==mt?mt:globalThis.litElementVersions=[]).push("3.3.3");const gt=!1},147:t=>{t.exports=JSON.parse('{"name":"room-card","version":"1.08.01","description":"Show entities in Home Assistant\'s Lovelace UI","keywords":["home-assistant","homeassistant","lovelace","custom-cards","multiple","entity","row"],"module":"room-card.js","license":"MIT","dependencies":{"babel-jest":"^29.6.4","custom-card-helpers":"^1.8.0","jest-environment-jsdom":"^29.5.0","jest-ts-auto-mock":"^2.1.0","lit":"^2.7.5","ts-auto-mock":"3.5.0","ttypescript":"^1.5.13","yarn":"^1.22.18"},"devDependencies":{"@babel/core":"^7.22.1","@babel/plugin-transform-runtime":"^7.22.4","@babel/preset-env":"^7.22.5","@types/jest":"^29.5.3","@typescript-eslint/eslint-plugin":"^5.60.1","@typescript-eslint/parser":"^5.59.1","babel-loader":"^9.1.3","codecov":"^3.8.3","compression-webpack-plugin":"^10.0.0","eslint":"^8.44.0","eslint-config-prettier":"^8.8.0","eslint-plugin-prettier":"^4.0.0","jest":"^29.6.2","prettier":"^2.8.8","ts-jest":"^29.1.1","ts-loader":"^9.4.4","typescript":"^4.9.5","webpack":"^5.88.2","webpack-cli":"^5.0.2"},"scripts":{"lint":"eslint src/**/*.ts","dev":"webpack -c webpack.config.js","build":"yarn lint && webpack -c webpack.config.js","test":"jest","coverage":"jest --coverage","workflow":"jest --coverage --json --outputFile=/home/runner/work/room-card/room-card/jest.results.json","prebuild":"copy git-hooks\\\\pre-commit .git\\\\hooks\\\\ && echo \'hook copied\'"}}')}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,i),o.exports}i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(607)})(); \ No newline at end of file diff --git a/room-card.js.gz b/room-card.js.gz index 94415d2..25ef0cf 100644 Binary files a/room-card.js.gz and b/room-card.js.gz differ diff --git a/src/index.ts b/src/index.ts index ae1bc8f..ba97c30 100644 --- a/src/index.ts +++ b/src/index.ts @@ -29,7 +29,7 @@ console.info( @customElement('room-card') export default class RoomCard extends LitElement { private _hass?: HomeAssistant; - @property() monitoredStates?: HassEntities; + @property() monitoredStates?: HassEntities = {}; @property() config?: RoomCardConfig; @property() _helpers: { createCardElement(config: LovelaceCardConfig): LovelaceCard }