From 9d379a38e891eeb5bebf09b56172ae76499725d7 Mon Sep 17 00:00:00 2001 From: benct Date: Sun, 19 Dec 2021 00:44:43 +0100 Subject: [PATCH] Update version (4.3.1) --- CHANGELOG.md | 8 ++++++-- README.md | 2 +- multiple-entity-row.js | 2 +- package.json | 2 +- src/index.js | 2 +- tracker.json | 4 ++-- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 531c6e4..0de31e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,16 @@ # Changelog All notable changes to this project will be documented in this file. +## 4.3.1 + +**Fixed:** +- Use correct locale field on entity value formatting (#212) + ## 4.3.0 **Added:** - Support hiding main entity name with `name: false` (#131, #134, #179) -- Locale-aware number formatting of state and attribute values (#208) -- Locale-aware number formatting when using `precision` format option (#212) +- Locale-aware number formatting of all entity values (#149, #162, #208, #212) **Changed:** - Bundle `Lit` in card rather than importing from HA (#192) diff --git a/README.md b/README.md index 7e88c66..e1c2185 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ to your `/www/` folder and add the following to the `configuration.yaml` ```yaml lovelace: resources: - - url: /local/multiple-entity-row.js?v=4.3.0 + - url: /local/multiple-entity-row.js?v=4.3.1 type: module ``` diff --git a/multiple-entity-row.js b/multiple-entity-row.js index 0614d68..04390b3 100644 --- a/multiple-entity-row.js +++ b/multiple-entity-row.js @@ -1 +1 @@ -(()=>{"use strict";const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e=Symbol(),n=new Map;class i{constructor(t,n){if(this._$cssResult$=!0,n!==e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let e=n.get(this.cssText);return t&&void 0===e&&(n.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const r=t=>new i("string"==typeof t?t:t+"",e),o=(t,...n)=>{const r=1===t.length?t[0]:n.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 i(r,e)},s=t?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return r(e)})(t):t;var a;const u=window.trustedTypes,c=u?u.emptyScript:"",l=window.reactiveElementPolyfillSupport,h={toAttribute(t,e){switch(e){case Boolean:t=t?c: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}},d=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:h,reflect:!1,hasChanged:d};class p extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,n)=>{const i=this._$Eh(n,e);void 0!==i&&(this._$Eu.set(i,n),t.push(i))})),t}static createProperty(t,e=f){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const n="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,n,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){return{get(){return this[e]},set(i){const r=this[t];this[e]=i,this.requestUpdate(t,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const n of e)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}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 _$Eh(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,n;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(n=t.hostConnected)||void 0===n||n.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var e;const n=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,n)=>{t?e.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((t=>{const n=document.createElement("style"),i=window.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=t.cssText,e.appendChild(n)}))})(n,this.constructor.elementStyles),n}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||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._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ES(t,e,n=f){var i,r;const o=this.constructor._$Eh(t,n);if(void 0!==o&&!0===n.reflect){const s=(null!==(r=null===(i=n.converter)||void 0===i?void 0:i.toAttribute)&&void 0!==r?r:h.toAttribute)(e,n.type);this._$Ei=t,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$Ei=null}}_$AK(t,e){var n,i,r;const o=this.constructor,s=o._$Eu.get(t);if(void 0!==s&&this._$Ei!==s){const t=o.getPropertyOptions(s),a=t.converter,u=null!==(r=null!==(i=null===(n=a)||void 0===n?void 0:n.fromAttribute)&&void 0!==i?i:"function"==typeof a?a:null)&&void 0!==r?r:h.fromAttribute;this._$Ei=s,this[s]=u(e,t.type),this._$Ei=null}}requestUpdate(t,e,n){let i=!0;void 0!==t&&(((n=n||this.constructor.getPropertyOptions(t)).hasChanged||d)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Ei!==t&&(void 0===this._$E_&&(this._$E_=new Map),this._$E_.set(t,n))):i=!1),!this.isUpdatePending&&i&&(this._$Ep=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ep}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._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(n)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(n)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$E_&&(this._$E_.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$E_=void 0),this._$EU()}updated(t){}firstUpdated(t){}}var m;p.finalized=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==l||l({ReactiveElement:p}),(null!==(a=globalThis.reactiveElementVersions)&&void 0!==a?a:globalThis.reactiveElementVersions=[]).push("1.0.2");const y=globalThis.trustedTypes,v=y?y.createPolicy("lit-html",{createHTML:t=>t}):void 0,g=`lit$${(Math.random()+"").slice(9)}$`,b="?"+g,_=`<${b}>`,$=document,w=(t="")=>$.createComment(t),S=t=>null===t||"object"!=typeof t&&"function"!=typeof t,A=Array.isArray,E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,M=/>/g,D=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,P=/'/g,j=/"/g,k=/^(?:script|style|textarea)$/i,C=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),x=C(1),N=(C(2),Symbol.for("lit-noChange")),H=Symbol.for("lit-nothing"),T=new WeakMap,U=$.createTreeWalker($,129,null,!1),Y=(t,e)=>{const n=t.length-1,i=[];let r,o=2===e?"":"",s=E;for(let e=0;e"===u[0]?(s=null!=r?r:E,c=-1):void 0===u[1]?c=-2:(c=s.lastIndex-u[2].length,a=u[1],s=void 0===u[3]?D:'"'===u[3]?j:P):s===j||s===P?s=D:s===O||s===M?s=E:(s=D,r=void 0);const h=s===D&&t[e+1].startsWith("/>")?" ":"";o+=s===E?n+_:c>=0?(i.push(a),n.slice(0,c)+"$lit$"+n.slice(c)+g+h):n+g+(-2===c?(i.push(void 0),e):h)}const a=o+(t[n]||"")+(2===e?"":"");return[void 0!==v?v.createHTML(a):a,i]};class R{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let r=0,o=0;const s=t.length-1,a=this.parts,[u,c]=Y(t,e);if(this.el=R.createElement(u,n),U.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=U.nextNode())&&a.length0){i.textContent=y?y.emptyScript:"";for(let n=0;n{var e;return A(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==H&&S(this._$AH)?this._$AA.nextSibling.data=t:this.S($.createTextNode(t)),this._$AH=t}T(t){var e;const{values:n,_$litType$:i}=t,r="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=R.createElement(i.h,this.options)),i);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(n);else{const t=new z(r,this),e=t.p(this.options);t.m(n),this.S(e),this._$AH=t}}_$AC(t){let e=T.get(t.strings);return void 0===e&&T.set(t.strings,e=new R(t)),e}M(t){A(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const r of t)i===e.length?e.push(n=new L(this.A(w()),this.A(w()),this,this.options)):n=e[i],n._$AI(r),i++;i2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=H}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,i){const r=this.strings;let o=!1;if(void 0===r)t=I(this,t,e,0),o=!S(t)||t!==this._$AH&&t!==N,o&&(this._$AH=t);else{const i=t;let s,a;for(t=r[0],s=0;s{var i,r;const o=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:e;let s=o._$litPart$;if(void 0===s){const t=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:null;o._$litPart$=s=new L(e.insertBefore(w(),t),t,void 0,null!=n?n:{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return N}}Q.finalized=!0,Q._$litElement$=!0,null===(G=globalThis.litElementHydrateSupport)||void 0===G||G.call(globalThis,{LitElement:Q});const X=globalThis.litElementPolyfillSupport;null==X||X({LitElement:Q}),(null!==(K=globalThis.litElementVersions)&&void 0!==K?K:globalThis.litElementVersions=[]).push("3.0.2");var tt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,et="[1-9]\\d?",nt="\\d\\d",it="[^\\s]+",rt=/\[([^]*?)\]/gm;function ot(t,e){for(var n=[],i=0,r=t.length;i-1?r:null}};function at(t){for(var e=[],n=1;n3?0:(t-t%10!=10?1:0)*t%10]}},dt=at({},ht),ft=function(t){return t.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},pt=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+pt(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+pt(Math.floor(Math.abs(e)/60),2)+":"+pt(Math.abs(e)%60,2)}},yt=function(t){return+t-1},vt=[null,et],gt=[null,it],bt=["isPm",it,function(t,e){var n=t.toLowerCase();return n===e.amPm[0]?0:n===e.amPm[1]?1:null}],_t=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var n=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?n:-n}return 0}],$t={D:["day",et],DD:["day",nt],Do:["day","[1-9]\\d?[^\\s]+",function(t){return parseInt(t,10)}],M:["month",et,yt],MM:["month",nt,yt],YY:["year",nt,function(t){var e=+(""+(new Date).getFullYear()).substr(0,2);return+(""+(+t>68?e-1:e)+t)}],h:["hour",et,void 0,"isPm"],hh:["hour",nt,void 0,"isPm"],H:["hour",et],HH:["hour",nt],m:["minute",et],mm:["minute",nt],s:["second",et],ss:["second",nt],YYYY:["year","\\d{4}"],S:["millisecond","\\d",function(t){return 100*+t}],SS:["millisecond",nt,function(t){return 10*+t}],SSS:["millisecond","\\d{3}"],d:vt,dd:vt,ddd:gt,dddd:gt,MMM:["month",it,st("monthNamesShort")],MMMM:["month",it,st("monthNames")],a:bt,A:bt,ZZ:_t,Z:_t},wt={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"};const St={format:function(t,e,n){if(void 0===e&&(e=wt.default),void 0===n&&(n={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var i=[];e=(e=wt[e]||e).replace(rt,(function(t,e){return i.push(e),"@@@"}));var r=at(at({},dt),n);return(e=e.replace(tt,(function(e){return mt[e](t,r)}))).replace(/@@@/g,(function(){return i.shift()}))},parse:function(t,e,n){if(void 0===n&&(n={}),"string"!=typeof e)throw new Error("Invalid format in fecha parse");if(e=wt[e]||e,t.length>1e3)return null;var i={year:(new Date).getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},r=[],o=[],s=e.replace(rt,(function(t,e){return o.push(ft(e)),"@@@"})),a={},u={};s=ft(s).replace(tt,(function(t){var e=$t[t],n=e[0],i=e[1],o=e[3];if(a[n])throw new Error("Invalid format. "+n+" specified twice in format");return a[n]=!0,o&&(u[o]=!0),r.push(e),"("+i+")"})),Object.keys(u).forEach((function(t){if(!a[t])throw new Error("Invalid format. "+t+" is required in specified format")})),s=s.replace(/@@@/g,(function(){return o.shift()}));var c=t.match(new RegExp(s,"i"));if(!c)return null;for(var l=at(at({},dt),n),h=1;h-1?t.split(".")[1].length:0;n.minimumFractionDigits=i,n.maximumFractionDigits=i}return n};var Nt=["closed","locked","off"],Ht=(new Set(["fan","input_boolean","light","switch","group","automation"]),function(t,e,n,i){i=i||{},n=null==n?{}:n;var r=new Event(e,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return r.detail=n,t.dispatchEvent(r),r});new Set(["call-service","divider","section","weblink","cast","select"]);var Tt=function(t){Ht(window,"haptic",t)};function Ut(t){return Ut="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},Ut(t)}var Yt=["entity-id","last-changed","last-updated","last-triggered","position","tilt-position","brightness"],Rt=function(t){return"object"===Ut(t)&&!Array.isArray(t)&&!!t},It=function(t){return!t||["unknown","unavailable"].includes(t.state)},zt=function(t,e){return e.hide_unavailable&&(It(t)||e.attribute&&void 0===t.attributes[e.attribute])};function Lt(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 Ft(t){for(var e=1;e0?e+":"+Pt(n)+":"+Pt(i):n>0?n+":"+Pt(i):i>0?""+i:null}(i);if(n.format.startsWith("precision")){var o=parseInt(n.format.slice(-1),10),s=Ct(parseFloat(i),t.language,{minimumFractionDigits:o,maximumFractionDigits:o});return"".concat(s).concat(r?" ".concat(r):"")}return i}if(n.attribute)return"".concat(isNaN(i)?i:Ct(i,t.language)).concat(r?" ".concat(r):"");var a=Ft(Ft({},e),{},{attributes:Ft(Ft({},e.attributes),{},{unit_of_measurement:r})});return function(t,e,n,i){var r=void 0!==i?i:e.state;if("unknown"===r||"unavailable"===r)return t("state.default."+r);if(e.attributes.unit_of_measurement)return Ct(r,n)+" "+e.attributes.unit_of_measurement;var o=function(t){return kt(t.entity_id)}(e);if("input_datetime"===o){var s;if(!e.attributes.has_time)return s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),Ot(s,n);if(!e.attributes.has_date){var a=new Date;return s=new Date(a.getFullYear(),a.getMonth(),a.getDay(),e.attributes.hour,e.attributes.minute),Dt(s,n)}return s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),Mt(s,n)}return"humidifier"===o&&"on"===r&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===o||"number"===o?Ct(r,n):e.attributes.device_class&&t("component."+o+".state."+e.attributes.device_class+"."+e.state)||t("component."+o+".state._."+e.state)||e.state}(t.localize,a,t.language)},se=function(t){return Rt(null==t?void 0:t.styles)?Object.keys(t.styles).map((function(e){return"".concat(e,": ").concat(t.styles[e],";")})).join(""):""};function ae(t){return ae="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},ae(t)}function ue(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function ce(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 le(t){for(var e=1;e\n
\n ',"","\n
\n "])),this._hass,this.config,this.renderSecondaryInfo(),this.config.column?"entities-column":"entities-row",this.entities.map((function(e){return t.renderEntity(e.stateObj,e)})),this.renderMainEntity()):this.renderWarning():x(Vt||(Vt=ue([""])))}},{key:"renderSecondaryInfo",value:function(){if(!this.config.secondary_info||"string"==typeof(t=this.config.secondary_info)&&Yt.includes(t)||zt(this.info,this.config.secondary_info))return null;var t;if("string"==typeof this.config.secondary_info)return x(qt||(qt=ue(["",""])),this.config.secondary_info);var e=re(this.info,this.config.secondary_info);return x(Jt||(Jt=ue([""," ",""])),e,this.renderValue(this.info,this.config.secondary_info))}},{key:"renderMainEntity",value:function(){return!1===this.config.show_state?null:x(Gt||(Gt=ue(['
\n ',"\n
","
\n
"])),se(this.config),this.onRowClick,this.config.state_header&&x(Kt||(Kt=ue(["",""])),this.config.state_header),this.renderValue(this.stateObj,this.config))}},{key:"renderEntity",value:function(t,e){if(!t||zt(t,e))return null;var n=this.clickHandler(t.entity_id,e.tap_action);return x(Qt||(Qt=ue(['
\n ',"\n
","
\n
"])),se(e),n,re(t,e),e.icon?this.renderIcon(t,e):this.renderValue(t,e))}},{key:"renderValue",value:function(t,e){if(!0===e.toggle)return x(Xt||(Xt=ue([''])),t,this._hass);if(e.format&&["relative","total","date","time","datetime"].includes(e.format)){var n=e.attribute?t.attributes[e.attribute]:t.state,i=new Date(n);return i instanceof Date&&!isNaN(i.getTime())?x(te||(te=ue([""])),this._hass,i,e.format):n}return oe(this._hass,t,e)}},{key:"renderIcon",value:function(t,e){return x(ee||(ee=ue([''])),t,!0===e.icon?t.attributes.icon||null:e.icon,e.state_color)}},{key:"renderWarning",value:function(){return x(ne||(ne=ue(["\n ","\n "])),this._hass.localize("ui.panel.lovelace.warning.entity_not_found","entity",this.config.entity))}},{key:"clickHandler",value:function(t,e){var n=this;return function(i){i.stopPropagation(),function(t,e,n,i,r){var o;if(n.tap_action&&(o=n.tap_action),o||(o={action:"more-info"}),!o.confirmation||o.confirmation.exemptions&&o.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||confirm(o.confirmation.text||"Are you sure you want to "+o.action+"?"))switch(o.action){case"more-info":(o.entity||n.entity||n.camera_image)&&(Ht(t,"hass-more-info",{entityId:o.entity?o.entity:n.entity?n.entity:n.camera_image}),o.haptic&&Tt(o.haptic));break;case"navigate":o.navigation_path&&(function(t,e,n){void 0===n&&(n=!1),n?history.replaceState(null,"",e):history.pushState(null,"",e),Ht(window,"location-changed",{replace:n})}(0,o.navigation_path),o.haptic&&Tt(o.haptic));break;case"url":o.url_path&&window.open(o.url_path),o.haptic&&Tt(o.haptic);break;case"toggle":n.entity&&(function(t,e){(function(t,e,n){void 0===n&&(n=!0);var i,r=kt(e),o="group"===r?"homeassistant":r;switch(r){case"lock":i=n?"unlock":"lock";break;case"cover":i=n?"open_cover":"close_cover";break;default:i=n?"turn_on":"turn_off"}t.callService(o,i,{entity_id:e})})(t,e,Nt.includes(t.states[e].state))}(e,n.entity),o.haptic&&Tt(o.haptic));break;case"call-service":if(!o.service)return;var s=o.service.split(".",2),a=s[0],u=s[1],c=jt({},o.service_data);"entity"===c.entity_id&&(c.entity_id=n.entity),e.callService(a,u,c),o.haptic&&Tt(o.haptic);break;case"fire-dom-event":Ht(t,"ll-custom",o),o.haptic&&Tt(o.haptic)}}(n,n._hass,{entity:t,tap_action:e})}}}],i=[{key:"properties",get:function(){return{_hass:Object,config:Object,stateObj:Object}}},{key:"styles",get:function(){return o(Zt||(t=["\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(--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"],e||(e=t.slice(0)),Zt=Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))));var t,e}}],n&&fe(e.prototype,n),i&&fe(e,i),Object.defineProperty(e,"prototype",{writable:!1}),u}(Q);customElements.define("multiple-entity-row",ve)})(); \ No newline at end of file +(()=>{"use strict";const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,e=Symbol(),n=new Map;class i{constructor(t,n){if(this._$cssResult$=!0,n!==e)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let e=n.get(this.cssText);return t&&void 0===e&&(n.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const r=t=>new i("string"==typeof t?t:t+"",e),o=(t,...n)=>{const r=1===t.length?t[0]:n.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 i(r,e)},s=t?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return r(e)})(t):t;var a;const u=window.trustedTypes,c=u?u.emptyScript:"",l=window.reactiveElementPolyfillSupport,h={toAttribute(t,e){switch(e){case Boolean:t=t?c: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}},d=(t,e)=>e!==t&&(e==e||t==t),f={attribute:!0,type:String,converter:h,reflect:!1,hasChanged:d};class p extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,n)=>{const i=this._$Eh(n,e);void 0!==i&&(this._$Eu.set(i,n),t.push(i))})),t}static createProperty(t,e=f){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const n="symbol"==typeof t?Symbol():"__"+t,i=this.getPropertyDescriptor(t,n,e);void 0!==i&&Object.defineProperty(this.prototype,t,i)}}static getPropertyDescriptor(t,e,n){return{get(){return this[e]},set(i){const r=this[t];this[e]=i,this.requestUpdate(t,r,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||f}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const n of e)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}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 _$Eh(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ep=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,n;(null!==(e=this._$Eg)&&void 0!==e?e:this._$Eg=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(n=t.hostConnected)||void 0===n||n.call(t))}removeController(t){var e;null===(e=this._$Eg)||void 0===e||e.splice(this._$Eg.indexOf(t)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var e;const n=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,n)=>{t?e.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):n.forEach((t=>{const n=document.createElement("style"),i=window.litNonce;void 0!==i&&n.setAttribute("nonce",i),n.textContent=t.cssText,e.appendChild(n)}))})(n,this.constructor.elementStyles),n}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Eg)||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._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,n){this._$AK(t,n)}_$ES(t,e,n=f){var i,r;const o=this.constructor._$Eh(t,n);if(void 0!==o&&!0===n.reflect){const s=(null!==(r=null===(i=n.converter)||void 0===i?void 0:i.toAttribute)&&void 0!==r?r:h.toAttribute)(e,n.type);this._$Ei=t,null==s?this.removeAttribute(o):this.setAttribute(o,s),this._$Ei=null}}_$AK(t,e){var n,i,r;const o=this.constructor,s=o._$Eu.get(t);if(void 0!==s&&this._$Ei!==s){const t=o.getPropertyOptions(s),a=t.converter,u=null!==(r=null!==(i=null===(n=a)||void 0===n?void 0:n.fromAttribute)&&void 0!==i?i:"function"==typeof a?a:null)&&void 0!==r?r:h.fromAttribute;this._$Ei=s,this[s]=u(e,t.type),this._$Ei=null}}requestUpdate(t,e,n){let i=!0;void 0!==t&&(((n=n||this.constructor.getPropertyOptions(t)).hasChanged||d)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===n.reflect&&this._$Ei!==t&&(void 0===this._$E_&&(this._$E_=new Map),this._$E_.set(t,n))):i=!1),!this.isUpdatePending&&i&&(this._$Ep=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ep}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._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const n=this._$AL;try{e=this.shouldUpdate(n),e?(this.willUpdate(n),null===(t=this._$Eg)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(n)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(n)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Eg)||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)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(t){return!0}update(t){void 0!==this._$E_&&(this._$E_.forEach(((t,e)=>this._$ES(e,this[e],t))),this._$E_=void 0),this._$EU()}updated(t){}firstUpdated(t){}}var m;p.finalized=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==l||l({ReactiveElement:p}),(null!==(a=globalThis.reactiveElementVersions)&&void 0!==a?a:globalThis.reactiveElementVersions=[]).push("1.0.2");const y=globalThis.trustedTypes,v=y?y.createPolicy("lit-html",{createHTML:t=>t}):void 0,g=`lit$${(Math.random()+"").slice(9)}$`,b="?"+g,_=`<${b}>`,$=document,w=(t="")=>$.createComment(t),S=t=>null===t||"object"!=typeof t&&"function"!=typeof t,A=Array.isArray,E=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,M=/>/g,D=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,P=/'/g,j=/"/g,k=/^(?:script|style|textarea)$/i,C=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),x=C(1),N=(C(2),Symbol.for("lit-noChange")),H=Symbol.for("lit-nothing"),T=new WeakMap,U=$.createTreeWalker($,129,null,!1),Y=(t,e)=>{const n=t.length-1,i=[];let r,o=2===e?"":"",s=E;for(let e=0;e"===u[0]?(s=null!=r?r:E,c=-1):void 0===u[1]?c=-2:(c=s.lastIndex-u[2].length,a=u[1],s=void 0===u[3]?D:'"'===u[3]?j:P):s===j||s===P?s=D:s===O||s===M?s=E:(s=D,r=void 0);const h=s===D&&t[e+1].startsWith("/>")?" ":"";o+=s===E?n+_:c>=0?(i.push(a),n.slice(0,c)+"$lit$"+n.slice(c)+g+h):n+g+(-2===c?(i.push(void 0),e):h)}const a=o+(t[n]||"")+(2===e?"":"");return[void 0!==v?v.createHTML(a):a,i]};class R{constructor({strings:t,_$litType$:e},n){let i;this.parts=[];let r=0,o=0;const s=t.length-1,a=this.parts,[u,c]=Y(t,e);if(this.el=R.createElement(u,n),U.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(i=U.nextNode())&&a.length0){i.textContent=y?y.emptyScript:"";for(let n=0;n{var e;return A(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==H&&S(this._$AH)?this._$AA.nextSibling.data=t:this.S($.createTextNode(t)),this._$AH=t}T(t){var e;const{values:n,_$litType$:i}=t,r="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=R.createElement(i.h,this.options)),i);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===r)this._$AH.m(n);else{const t=new z(r,this),e=t.p(this.options);t.m(n),this.S(e),this._$AH=t}}_$AC(t){let e=T.get(t.strings);return void 0===e&&T.set(t.strings,e=new R(t)),e}M(t){A(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,i=0;for(const r of t)i===e.length?e.push(n=new L(this.A(w()),this.A(w()),this,this.options)):n=e[i],n._$AI(r),i++;i2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=H}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,n,i){const r=this.strings;let o=!1;if(void 0===r)t=I(this,t,e,0),o=!S(t)||t!==this._$AH&&t!==N,o&&(this._$AH=t);else{const i=t;let s,a;for(t=r[0],s=0;s{var i,r;const o=null!==(i=null==n?void 0:n.renderBefore)&&void 0!==i?i:e;let s=o._$litPart$;if(void 0===s){const t=null!==(r=null==n?void 0:n.renderBefore)&&void 0!==r?r:null;o._$litPart$=s=new L(e.insertBefore(w(),t),t,void 0,null!=n?n:{})}return s._$AI(t),s})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return N}}Q.finalized=!0,Q._$litElement$=!0,null===(G=globalThis.litElementHydrateSupport)||void 0===G||G.call(globalThis,{LitElement:Q});const X=globalThis.litElementPolyfillSupport;null==X||X({LitElement:Q}),(null!==(K=globalThis.litElementVersions)&&void 0!==K?K:globalThis.litElementVersions=[]).push("3.0.2");var tt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,et="[1-9]\\d?",nt="\\d\\d",it="[^\\s]+",rt=/\[([^]*?)\]/gm;function ot(t,e){for(var n=[],i=0,r=t.length;i-1?r:null}};function at(t){for(var e=[],n=1;n3?0:(t-t%10!=10?1:0)*t%10]}},dt=at({},ht),ft=function(t){return t.replace(/[|\\{()[^$+*?.-]/g,"\\$&")},pt=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+pt(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+pt(Math.floor(Math.abs(e)/60),2)+":"+pt(Math.abs(e)%60,2)}},yt=function(t){return+t-1},vt=[null,et],gt=[null,it],bt=["isPm",it,function(t,e){var n=t.toLowerCase();return n===e.amPm[0]?0:n===e.amPm[1]?1:null}],_t=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var n=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?n:-n}return 0}],$t={D:["day",et],DD:["day",nt],Do:["day","[1-9]\\d?[^\\s]+",function(t){return parseInt(t,10)}],M:["month",et,yt],MM:["month",nt,yt],YY:["year",nt,function(t){var e=+(""+(new Date).getFullYear()).substr(0,2);return+(""+(+t>68?e-1:e)+t)}],h:["hour",et,void 0,"isPm"],hh:["hour",nt,void 0,"isPm"],H:["hour",et],HH:["hour",nt],m:["minute",et],mm:["minute",nt],s:["second",et],ss:["second",nt],YYYY:["year","\\d{4}"],S:["millisecond","\\d",function(t){return 100*+t}],SS:["millisecond",nt,function(t){return 10*+t}],SSS:["millisecond","\\d{3}"],d:vt,dd:vt,ddd:gt,dddd:gt,MMM:["month",it,st("monthNamesShort")],MMMM:["month",it,st("monthNames")],a:bt,A:bt,ZZ:_t,Z:_t},wt={default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"};const St={format:function(t,e,n){if(void 0===e&&(e=wt.default),void 0===n&&(n={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var i=[];e=(e=wt[e]||e).replace(rt,(function(t,e){return i.push(e),"@@@"}));var r=at(at({},dt),n);return(e=e.replace(tt,(function(e){return mt[e](t,r)}))).replace(/@@@/g,(function(){return i.shift()}))},parse:function(t,e,n){if(void 0===n&&(n={}),"string"!=typeof e)throw new Error("Invalid format in fecha parse");if(e=wt[e]||e,t.length>1e3)return null;var i={year:(new Date).getFullYear(),month:0,day:1,hour:0,minute:0,second:0,millisecond:0,isPm:null,timezoneOffset:null},r=[],o=[],s=e.replace(rt,(function(t,e){return o.push(ft(e)),"@@@"})),a={},u={};s=ft(s).replace(tt,(function(t){var e=$t[t],n=e[0],i=e[1],o=e[3];if(a[n])throw new Error("Invalid format. "+n+" specified twice in format");return a[n]=!0,o&&(u[o]=!0),r.push(e),"("+i+")"})),Object.keys(u).forEach((function(t){if(!a[t])throw new Error("Invalid format. "+t+" is required in specified format")})),s=s.replace(/@@@/g,(function(){return o.shift()}));var c=t.match(new RegExp(s,"i"));if(!c)return null;for(var l=at(at({},dt),n),h=1;h-1?t.split(".")[1].length:0;n.minimumFractionDigits=i,n.maximumFractionDigits=i}return n};var Nt=["closed","locked","off"],Ht=(new Set(["fan","input_boolean","light","switch","group","automation"]),function(t,e,n,i){i=i||{},n=null==n?{}:n;var r=new Event(e,{bubbles:void 0===i.bubbles||i.bubbles,cancelable:Boolean(i.cancelable),composed:void 0===i.composed||i.composed});return r.detail=n,t.dispatchEvent(r),r});new Set(["call-service","divider","section","weblink","cast","select"]);var Tt=function(t){Ht(window,"haptic",t)};function Ut(t){return Ut="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},Ut(t)}var Yt=["entity-id","last-changed","last-updated","last-triggered","position","tilt-position","brightness"],Rt=function(t){return"object"===Ut(t)&&!Array.isArray(t)&&!!t},It=function(t){return!t||["unknown","unavailable"].includes(t.state)},zt=function(t,e){return e.hide_unavailable&&(It(t)||e.attribute&&void 0===t.attributes[e.attribute])};function Lt(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 Ft(t){for(var e=1;e0?e+":"+Pt(n)+":"+Pt(i):n>0?n+":"+Pt(i):i>0?""+i:null}(i);if(n.format.startsWith("precision")){var o=parseInt(n.format.slice(-1),10),s=Ct(parseFloat(i),t.locale,{minimumFractionDigits:o,maximumFractionDigits:o});return"".concat(s).concat(r?" ".concat(r):"")}return i}if(n.attribute)return"".concat(isNaN(i)?i:Ct(i,t.locale)).concat(r?" ".concat(r):"");var a=Ft(Ft({},e),{},{attributes:Ft(Ft({},e.attributes),{},{unit_of_measurement:r})});return function(t,e,n,i){var r=void 0!==i?i:e.state;if("unknown"===r||"unavailable"===r)return t("state.default."+r);if(e.attributes.unit_of_measurement)return Ct(r,n)+" "+e.attributes.unit_of_measurement;var o=function(t){return kt(t.entity_id)}(e);if("input_datetime"===o){var s;if(!e.attributes.has_time)return s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day),Ot(s,n);if(!e.attributes.has_date){var a=new Date;return s=new Date(a.getFullYear(),a.getMonth(),a.getDay(),e.attributes.hour,e.attributes.minute),Dt(s,n)}return s=new Date(e.attributes.year,e.attributes.month-1,e.attributes.day,e.attributes.hour,e.attributes.minute),Mt(s,n)}return"humidifier"===o&&"on"===r&&e.attributes.humidity?e.attributes.humidity+" %":"counter"===o||"number"===o?Ct(r,n):e.attributes.device_class&&t("component."+o+".state."+e.attributes.device_class+"."+e.state)||t("component."+o+".state._."+e.state)||e.state}(t.localize,a,t.locale)},se=function(t){return Rt(null==t?void 0:t.styles)?Object.keys(t.styles).map((function(e){return"".concat(e,": ").concat(t.styles[e],";")})).join(""):""};function ae(t){return ae="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},ae(t)}function ue(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function ce(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 le(t){for(var e=1;e\n
\n ',"","\n
\n "])),this._hass,this.config,this.renderSecondaryInfo(),this.config.column?"entities-column":"entities-row",this.entities.map((function(e){return t.renderEntity(e.stateObj,e)})),this.renderMainEntity()):this.renderWarning():x(Vt||(Vt=ue([""])))}},{key:"renderSecondaryInfo",value:function(){if(!this.config.secondary_info||"string"==typeof(t=this.config.secondary_info)&&Yt.includes(t)||zt(this.info,this.config.secondary_info))return null;var t;if("string"==typeof this.config.secondary_info)return x(qt||(qt=ue(["",""])),this.config.secondary_info);var e=re(this.info,this.config.secondary_info);return x(Jt||(Jt=ue([""," ",""])),e,this.renderValue(this.info,this.config.secondary_info))}},{key:"renderMainEntity",value:function(){return!1===this.config.show_state?null:x(Gt||(Gt=ue(['
\n ',"\n
","
\n
"])),se(this.config),this.onRowClick,this.config.state_header&&x(Kt||(Kt=ue(["",""])),this.config.state_header),this.renderValue(this.stateObj,this.config))}},{key:"renderEntity",value:function(t,e){if(!t||zt(t,e))return null;var n=this.clickHandler(t.entity_id,e.tap_action);return x(Qt||(Qt=ue(['
\n ',"\n
","
\n
"])),se(e),n,re(t,e),e.icon?this.renderIcon(t,e):this.renderValue(t,e))}},{key:"renderValue",value:function(t,e){if(!0===e.toggle)return x(Xt||(Xt=ue([''])),t,this._hass);if(e.format&&["relative","total","date","time","datetime"].includes(e.format)){var n=e.attribute?t.attributes[e.attribute]:t.state,i=new Date(n);return i instanceof Date&&!isNaN(i.getTime())?x(te||(te=ue([""])),this._hass,i,e.format):n}return oe(this._hass,t,e)}},{key:"renderIcon",value:function(t,e){return x(ee||(ee=ue([''])),t,!0===e.icon?t.attributes.icon||null:e.icon,e.state_color)}},{key:"renderWarning",value:function(){return x(ne||(ne=ue(["\n ","\n "])),this._hass.localize("ui.panel.lovelace.warning.entity_not_found","entity",this.config.entity))}},{key:"clickHandler",value:function(t,e){var n=this;return function(i){i.stopPropagation(),function(t,e,n,i,r){var o;if(n.tap_action&&(o=n.tap_action),o||(o={action:"more-info"}),!o.confirmation||o.confirmation.exemptions&&o.confirmation.exemptions.some((function(t){return t.user===e.user.id}))||confirm(o.confirmation.text||"Are you sure you want to "+o.action+"?"))switch(o.action){case"more-info":(o.entity||n.entity||n.camera_image)&&(Ht(t,"hass-more-info",{entityId:o.entity?o.entity:n.entity?n.entity:n.camera_image}),o.haptic&&Tt(o.haptic));break;case"navigate":o.navigation_path&&(function(t,e,n){void 0===n&&(n=!1),n?history.replaceState(null,"",e):history.pushState(null,"",e),Ht(window,"location-changed",{replace:n})}(0,o.navigation_path),o.haptic&&Tt(o.haptic));break;case"url":o.url_path&&window.open(o.url_path),o.haptic&&Tt(o.haptic);break;case"toggle":n.entity&&(function(t,e){(function(t,e,n){void 0===n&&(n=!0);var i,r=kt(e),o="group"===r?"homeassistant":r;switch(r){case"lock":i=n?"unlock":"lock";break;case"cover":i=n?"open_cover":"close_cover";break;default:i=n?"turn_on":"turn_off"}t.callService(o,i,{entity_id:e})})(t,e,Nt.includes(t.states[e].state))}(e,n.entity),o.haptic&&Tt(o.haptic));break;case"call-service":if(!o.service)return;var s=o.service.split(".",2),a=s[0],u=s[1],c=jt({},o.service_data);"entity"===c.entity_id&&(c.entity_id=n.entity),e.callService(a,u,c),o.haptic&&Tt(o.haptic);break;case"fire-dom-event":Ht(t,"ll-custom",o),o.haptic&&Tt(o.haptic)}}(n,n._hass,{entity:t,tap_action:e})}}}],i=[{key:"properties",get:function(){return{_hass:Object,config:Object,stateObj:Object}}},{key:"styles",get:function(){return o(Zt||(t=["\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(--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"],e||(e=t.slice(0)),Zt=Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))));var t,e}}],n&&fe(e.prototype,n),i&&fe(e,i),Object.defineProperty(e,"prototype",{writable:!1}),u}(Q);customElements.define("multiple-entity-row",ve)})(); \ No newline at end of file diff --git a/package.json b/package.json index acfe572..0760be9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "multiple-entity-row", - "version": "4.3.0", + "version": "4.3.1", "description": "Show multiple entity states, attributes and icons on entity rows in Home Assistant's Lovelace UI", "keywords": [ "home-assistant", diff --git a/src/index.js b/src/index.js index b396f8e..8b2d777 100644 --- a/src/index.js +++ b/src/index.js @@ -6,7 +6,7 @@ import { getEntityIds, hasConfigOrEntitiesChanged, hasGenericSecondaryInfo, hide import { style } from './styles'; console.info( - '%c MULTIPLE-ENTITY-ROW %c 4.3.0 ', + '%c MULTIPLE-ENTITY-ROW %c 4.3.1 ', 'color: cyan; background: black; font-weight: bold;', 'color: darkblue; background: white; font-weight: bold;' ); diff --git a/tracker.json b/tracker.json index ee303cf..c48bdd1 100644 --- a/tracker.json +++ b/tracker.json @@ -1,7 +1,7 @@ { "multiple-entity-row": { - "updated_at": "2021-12-17", - "version": "4.3.0", + "updated_at": "2021-12-19", + "version": "4.3.1", "remote_location": "https://raw.githubusercontent.com/benct/lovelace-multiple-entity-row/master/multiple-entity-row.js", "visit_repo": "https://github.com/benct/lovelace-multiple-entity-row", "changelog": "https://github.com/benct/lovelace-multiple-entity-row/blob/master/CHANGELOG.md"