/*! For license information please see 9208e9e6.js.LICENSE.txt */
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[65600],{39841:(e,t,i)=>{i(94604),i(65660);var r=i(9672),n=i(87156),o=i(50856),a=i(44181);(0,r.k)({_template:o.d`
    <style>
      :host {
        display: block;
        /**
         * Force app-header-layout to have its own stacking context so that its parent can
         * control the stacking of it relative to other elements (e.g. app-drawer-layout).
         * This could be done using \`isolation: isolate\`, but that's not well supported
         * across browsers.
         */
        position: relative;
        z-index: 0;
      }

      #wrapper ::slotted([slot=header]) {
        @apply --layout-fixed-top;
        z-index: 1;
      }

      #wrapper.initializing ::slotted([slot=header]) {
        position: relative;
      }

      :host([has-scrolling-region]) {
        height: 100%;
      }

      :host([has-scrolling-region]) #wrapper ::slotted([slot=header]) {
        position: absolute;
      }

      :host([has-scrolling-region]) #wrapper.initializing ::slotted([slot=header]) {
        position: relative;
      }

      :host([has-scrolling-region]) #wrapper #contentContainer {
        @apply --layout-fit;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
      }

      :host([has-scrolling-region]) #wrapper.initializing #contentContainer {
        position: relative;
      }

      :host([fullbleed]) {
        @apply --layout-vertical;
        @apply --layout-fit;
      }

      :host([fullbleed]) #wrapper,
      :host([fullbleed]) #wrapper #contentContainer {
        @apply --layout-vertical;
        @apply --layout-flex;
      }

      #contentContainer {
        /* Create a stacking context here so that all children appear below the header. */
        position: relative;
        z-index: 0;
      }

      @media print {
        :host([has-scrolling-region]) #wrapper #contentContainer {
          overflow-y: visible;
        }
      }

    </style>

    <div id="wrapper" class="initializing">
      <slot id="headerSlot" name="header"></slot>

      <div id="contentContainer">
        <slot></slot>
      </div>
    </div>
`,is:"app-header-layout",behaviors:[a.Y],properties:{hasScrollingRegion:{type:Boolean,value:!1,reflectToAttribute:!0}},observers:["resetLayout(isAttached, hasScrollingRegion)"],get header(){return(0,n.vz)(this.$.headerSlot).getDistributedNodes()[0]},_updateLayoutStates:function(){var e=this.header;if(this.isAttached&&e){this.$.wrapper.classList.remove("initializing"),e.scrollTarget=this.hasScrollingRegion?this.$.contentContainer:this.ownerDocument.documentElement;var t=e.offsetHeight;this.hasScrollingRegion?(e.style.left="",e.style.right=""):requestAnimationFrame(function(){var t=this.getBoundingClientRect(),i=document.documentElement.clientWidth-t.right;e.style.left=t.left+"px",e.style.right=i+"px"}.bind(this));var i=this.$.contentContainer.style;e.fixed&&!e.condenses&&this.hasScrollingRegion?(i.marginTop=t+"px",i.paddingTop=""):(i.paddingTop=t+"px",i.marginTop="")}}})},27849:(e,t,i)=>{i(39841);var r=i(50856);i(28426);class n extends(customElements.get("app-header-layout")){static get template(){return r.d`
      <style>
        :host {
          display: block;
          /**
         * Force app-header-layout to have its own stacking context so that its parent can
         * control the stacking of it relative to other elements (e.g. app-drawer-layout).
         * This could be done using \`isolation: isolate\`, but that's not well supported
         * across browsers.
         */
          position: relative;
          z-index: 0;
        }

        #wrapper ::slotted([slot="header"]) {
          @apply --layout-fixed-top;
          z-index: 1;
        }

        #wrapper.initializing ::slotted([slot="header"]) {
          position: relative;
        }

        :host([has-scrolling-region]) {
          height: 100%;
        }

        :host([has-scrolling-region]) #wrapper ::slotted([slot="header"]) {
          position: absolute;
        }

        :host([has-scrolling-region])
          #wrapper.initializing
          ::slotted([slot="header"]) {
          position: relative;
        }

        :host([has-scrolling-region]) #wrapper #contentContainer {
          @apply --layout-fit;
          overflow-y: auto;
          -webkit-overflow-scrolling: touch;
        }

        :host([has-scrolling-region]) #wrapper.initializing #contentContainer {
          position: relative;
        }

        #contentContainer {
          /* Create a stacking context here so that all children appear below the header. */
          position: relative;
          z-index: 0;
          /* Using 'transform' will cause 'position: fixed' elements to behave like
           'position: absolute' relative to this element. */
          transform: translate(0);
          margin-left: env(safe-area-inset-left);
          margin-right: env(safe-area-inset-right);
        }

        @media print {
          :host([has-scrolling-region]) #wrapper #contentContainer {
            overflow-y: visible;
          }
        }
      </style>

      <div id="wrapper" class="initializing">
        <slot id="headerSlot" name="header"></slot>

        <div id="contentContainer"><slot></slot></div>
        <slot id="fab" name="fab"></slot>
      </div>
    `}}customElements.define("ha-app-layout",n)},73953:(e,t,i)=>{i.a(e,(async e=>{i.d(t,{J:()=>l});var r=i(71948),n=i(7778),o=e([r]);r=(o.then?await o:o)[0];const a=new Set(["error","state-label"]),s={"entity-filter":()=>i.e(68045).then(i.bind(i,68045))},l=e=>(0,n.Tw)("badge",e,a,s,void 0,"state-label")}))},51153:(e,t,i)=>{i.a(e,(async e=>{i.d(t,{l$:()=>v,Z6:()=>y,Do:()=>g});var r=i(10175),n=(i(80251),i(89894)),o=i(14888),a=i(69377),s=i(95035),l=i(6169),d=i(41043),c=i(57464),h=(i(24617),i(82778)),u=i(7778),p=e([h,c,d,l,s,a,o,n,r]);[h,c,d,l,s,a,o,n,r]=p.then?await p:p;const f=new Set(["entity","entities","button","entity-button","glance","grid","light","sensor","thermostat","weather-forecast"]),m={"alarm-panel":()=>i.e(77639).then(i.bind(i,77639)),area:()=>i.e(95795).then(i.bind(i,95795)),calendar:()=>Promise.resolve().then(i.bind(i,80251)),conditional:()=>i.e(68857).then(i.bind(i,68857)),"empty-state":()=>i.e(67284).then(i.bind(i,67284)),"energy-carbon-consumed-gauge":()=>Promise.all([i.e(91573),i.e(67498),i.e(43283),i.e(19490)]).then(i.bind(i,19490)),"energy-date-selection":()=>Promise.all([i.e(71250),i.e(23754),i.e(10346)]).then(i.bind(i,10346)),"energy-devices-graph":()=>Promise.all([i.e(5287),i.e(22039),i.e(47420)]).then(i.bind(i,47420)),"energy-distribution":()=>i.e(9928).then(i.bind(i,9928)),"energy-gas-graph":()=>Promise.all([i.e(22039),i.e(61252),i.e(41305)]).then(i.bind(i,41305)),"energy-grid-neutrality-gauge":()=>Promise.all([i.e(31752),i.e(67498),i.e(32176)]).then(i.bind(i,32176)),"energy-solar-consumed-gauge":()=>Promise.all([i.e(86087),i.e(67498),i.e(43283),i.e(85930)]).then(i.bind(i,85930)),"energy-solar-graph":()=>Promise.all([i.e(22039),i.e(61252),i.e(70310)]).then(i.bind(i,70310)),"energy-sources-table":()=>Promise.all([i.e(57646),i.e(22039),i.e(17595),i.e(16938)]).then(i.bind(i,16938)),"energy-usage-graph":()=>Promise.all([i.e(22039),i.e(61252),i.e(9897)]).then(i.bind(i,9897)),"entity-filter":()=>i.e(33688).then(i.bind(i,33688)),error:()=>Promise.all([i.e(77426),i.e(55796)]).then(i.bind(i,55796)),gauge:()=>Promise.all([i.e(67498),i.e(43283)]).then(i.bind(i,43283)),"history-graph":()=>Promise.all([i.e(22039),i.e(77243),i.e(38026)]).then(i.bind(i,38026)),"horizontal-stack":()=>i.e(89173).then(i.bind(i,89173)),humidifier:()=>i.e(68558).then(i.bind(i,68558)),iframe:()=>i.e(95018).then(i.bind(i,95018)),logbook:()=>Promise.all([i.e(196),i.e(81855),i.e(90851)]).then(i.bind(i,8436)),map:()=>Promise.all([i.e(23956),i.e(60076)]).then(i.bind(i,60076)),markdown:()=>Promise.all([i.e(4940),i.e(26607)]).then(i.bind(i,51282)),"media-control":()=>Promise.all([i.e(28611),i.e(13525)]).then(i.bind(i,13525)),"picture-elements":()=>Promise.all([i.e(54909),i.e(319),i.e(97282),i.e(99810),i.e(44121)]).then(i.bind(i,83358)),"picture-entity":()=>Promise.all([i.e(319),i.e(97282),i.e(25917)]).then(i.bind(i,41500)),"picture-glance":()=>Promise.all([i.e(319),i.e(97282),i.e(7015)]).then(i.bind(i,66621)),picture:()=>i.e(45338).then(i.bind(i,45338)),"plant-status":()=>i.e(48723).then(i.bind(i,48723)),"safe-mode":()=>i.e(24503).then(i.bind(i,24503)),"shopping-list":()=>Promise.all([i.e(54040),i.e(43376)]).then(i.bind(i,43376)),starting:()=>i.e(47873).then(i.bind(i,47873)),"statistics-graph":()=>Promise.all([i.e(22039),i.e(17595),i.e(95396)]).then(i.bind(i,95396)),"vertical-stack":()=>i.e(26136).then(i.bind(i,26136))},v=e=>(0,u.Xm)("card",e,f,m,void 0,void 0),y=e=>(0,u.Tw)("card",e,f,m,void 0,void 0),g=e=>(0,u.ED)(e,"card",f,m)}))},89026:(e,t,i)=>{i.d(t,{t:()=>o,Q:()=>a});var r=i(7778);const n={picture:()=>i.e(69130).then(i.bind(i,69130)),buttons:()=>Promise.all([i.e(42109),i.e(32587)]).then(i.bind(i,32587)),graph:()=>i.e(28922).then(i.bind(i,28922))},o=e=>(0,r.Tw)("header-footer",e,void 0,n,void 0,void 0),a=e=>(0,r.ED)(e,"header-footer",void 0,n)},48745:(e,t,i)=>{i.a(e,(async e=>{i.d(t,{o:()=>l});var r=i(45229),n=i(7778),o=e([r]);r=(o.then?await o:o)[0];const a=new Set(["masonry"]),s={panel:()=>i.e(48480).then(i.bind(i,48480)),sidebar:()=>i.e(60999).then(i.bind(i,60999))},l=e=>(0,n.Tw)("view",e,a,s)}))},97504:(e,t,i)=>{i.d(t,{L:()=>n,F:()=>o});var r=i(47181);const n=()=>Promise.all([i.e(45243),i.e(54040),i.e(196),i.e(22001),i.e(81480),i.e(38679),i.e(67065),i.e(21257),i.e(52408)]).then(i.bind(i,52408)),o=(e,t)=>{(0,r.B)(e,"show-dialog",{dialogTag:"hui-dialog-create-card",dialogImport:n,dialogParams:t})}},62765:(e,t,i)=>{i.d(t,{K:()=>n,k:()=>o});var r=i(47181);const n=()=>i.e(95050).then(i.bind(i,95050)),o=(e,t)=>{(0,r.B)(e,"show-dialog",{dialogTag:"hui-dialog-delete-card",dialogImport:n,dialogParams:t})}},18678:(e,t,i)=>{i.d(t,{I:()=>n,x:()=>o});var r=i(47181);const n=()=>Promise.all([i.e(78161),i.e(75009),i.e(42955),i.e(45243),i.e(88985),i.e(28055),i.e(54040),i.e(87502),i.e(69505),i.e(41248),i.e(1536),i.e(93883),i.e(93098),i.e(15517),i.e(77426),i.e(92094),i.e(69916),i.e(22001),i.e(46002),i.e(77047),i.e(22355),i.e(74535),i.e(68331),i.e(68101),i.e(36902),i.e(60033),i.e(640),i.e(20515),i.e(99216),i.e(88254),i.e(81151)]).then(i.bind(i,24932)),o=(e,t)=>{(0,r.B)(e,"show-dialog",{dialogTag:"hui-dialog-edit-card",dialogImport:n,dialogParams:t})}},54324:(e,t,i)=>{i.d(t,{Z0:()=>r,BN:()=>n,LG:()=>o,f1:()=>a,qD:()=>s,Y7:()=>l,wI:()=>d,Uo:()=>c,YI:()=>h,mA:()=>u,PT:()=>p});const r=(e,t,i)=>{const[r]=t,n=[];return e.views.forEach(((t,o)=>{if(o!==r)return void n.push(e.views[o]);const a=t.cards?[...t.cards,i]:[i];n.push({...t,cards:a})})),{...e,views:n}},n=(e,t,i)=>{const[r]=t,n=[];return e.views.forEach(((t,o)=>{if(o!==r)return void n.push(e.views[o]);const a=t.cards?[...t.cards,...i]:[...i];n.push({...t,cards:a})})),{...e,views:n}},o=(e,t,i)=>{const[r,n]=t,o=[];return e.views.forEach(((t,a)=>{a===r?o.push({...t,cards:(t.cards||[]).map(((e,t)=>t===n?i:e))}):o.push(e.views[a])})),{...e,views:o}},a=(e,t)=>{const[i,r]=t,n=[];return e.views.forEach(((t,o)=>{o===i?n.push({...t,cards:(t.cards||[]).filter(((e,t)=>t!==r))}):n.push(e.views[o])})),{...e,views:n}},s=(e,t,i)=>{const[r,n]=t,o=[];return e.views.forEach(((t,a)=>{if(a!==r)return void o.push(e.views[a]);const s=t.cards?[...t.cards.slice(0,n),i,...t.cards.slice(n)]:[i];o.push({...t,cards:s})})),{...e,views:o}},l=(e,t,i)=>{const r=e.views[t[0]].cards[t[1]],n=e.views[i[0]].cards[i[1]],o=e.views[t[0]],a={...o,cards:o.cards.map(((e,i)=>i===t[1]?n:e))},s=t[0]===i[0]?a:e.views[i[0]],l={...s,cards:s.cards.map(((e,t)=>t===i[1]?r:e))};return{...e,views:e.views.map(((e,r)=>r===i[0]?l:r===t[0]?a:e))}},d=(e,t,i)=>{if(t[0]===i[0])throw new Error("You can not move a card to the view it is in.");const r=e.views[t[0]],n=r.cards[t[1]],o={...r,cards:(r.cards||[]).filter(((e,i)=>i!==t[1]))},a=e.views[i[0]],s=a.cards?[...a.cards,n]:[n],l={...a,cards:s};return{...e,views:e.views.map(((e,r)=>r===i[0]?l:r===t[0]?o:e))}},c=(e,t)=>({...e,views:e.views.concat(t)}),h=(e,t,i)=>({...e,views:e.views.map(((e,r)=>r===t?i:e))}),u=(e,t,i)=>{const r=e.views[t],n=e.views[i];return{...e,views:e.views.map(((e,o)=>o===i?r:o===t?n:e))}},p=(e,t)=>({...e,views:e.views.filter(((e,i)=>i!==t))})},12330:(e,t,i)=>{i.d(t,{R:()=>s});var r=i(26765),n=i(81796);var o=i(62765),a=i(54324);async function s(e,t,i,s){const l=i.config.views[s[0]].cards[s[1]];(0,o.k)(e,{cardConfig:l,deleteCard:async()=>{try{const r=(0,a.f1)(i.config,s);await i.saveConfig(r);((e,t,i)=>{const r={message:t.localize("ui.common.successfully_deleted")};i&&(r.action={action:i,text:t.localize("ui.common.undo")}),(0,n.C)(e,r)})(e,t,(async()=>{await i.saveConfig((0,a.qD)(r,s,l))}))}catch(t){(0,r.Ys)(e,{text:`Deleting failed: ${t.message}`})}}})}},12042:(e,t,i)=>{i.d(t,{to:()=>a,ar:()=>s,mQ:()=>l});const r="custom:",n={"original-states":async()=>(await i.e(76478).then(i.bind(i,76478))).OriginalStatesStrategy,energy:async()=>(await i.e(66054).then(i.bind(i,66054))).EnergyStrategy},o=async(e,t,i,o)=>{if(!o)return t("No strategy type found");try{const t=await(async e=>{if(e in n)return await n[e]();if(!e.startsWith(r))throw new Error("Unknown strategy");const t=`ll-strategy-${e.substr(r.length)}`;if(!0===await Promise.race([customElements.whenDefined(t),new Promise((e=>setTimeout((()=>e(!0)),5e3)))]))throw new Error(`Timeout waiting for strategy element ${t} to be registered`);return customElements.get(t)})(o);return await t[e](i)}catch(e){return"timeout"!==e.message&&console.error(e),t(e)}},a=async(e,t)=>{var i,r;return o("generateDashboard",(e=>({views:[{title:"Error",cards:[{type:"markdown",content:`Error loading the dashboard strategy:\n> ${e}`}]}]})),e,t||(null===(i=e.config)||void 0===i||null===(r=i.strategy)||void 0===r?void 0:r.type))},s=async(e,t)=>{var i,r;return o("generateView",(e=>({cards:[{type:"markdown",content:`Error loading the view strategy:\n> ${e}`}]})),e,t||(null===(i=e.view)||void 0===i||null===(r=i.strategy)||void 0===r?void 0:r.type))},l=async e=>{const t=e.config.strategy?await a(e):{...e.config};return t.views=await Promise.all(t.views.map((i=>i.strategy?s({hass:e.hass,narrow:e.narrow,config:t,view:i}):i))),t}},13192:(e,t,i)=>{i.d(t,{Zx:()=>r,Jh:()=>n,rQ:()=>o,cW:()=>a});const r="masonry",n="panel",o="sidebar",a=[n,o]},45229:(e,t,i)=>{i.a(e,(async e=>{var t=i(37500),r=i(5701),n=i(17717),o=i(228),a=i(47181),s=i(87744),l=i(96151),d=i(6315),c=(i(52039),i(50467)),h=e([d]);function u(){u=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(i){t.forEach((function(t){t.kind===i&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var i=e.prototype;["method","field"].forEach((function(r){t.forEach((function(t){var n=t.placement;if(t.kind===r&&("static"===n||"prototype"===n)){var o="static"===n?e:i;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var i=t.descriptor;if("field"===t.kind){var r=t.initializer;i={enumerable:i.enumerable,writable:i.writable,configurable:i.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,i)},decorateClass:function(e,t){var i=[],r=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!m(e))return i.push(e);var t=this.decorateElement(e,n);i.push(t.element),i.push.apply(i,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:i,finishers:r};var o=this.decorateConstructor(i,t);return r.push.apply(r,o.finishers),o.finishers=r,o},addElementPlacement:function(e,t,i){var r=t[e.placement];if(!i&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var i=[],r=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,n[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&r.push(l.finisher);var d=l.extras;if(d){for(var c=0;c<d.length;c++)this.addElementPlacement(d[c],t);i.push.apply(i,d)}}return{element:e,finishers:r,extras:i}},decorateConstructor:function(e,t){for(var i=[],r=t.length-1;r>=0;r--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[r])(n)||n);if(void 0!==o.finisher&&i.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:i}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?w(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var i=g(e.key),r=String(e.placement);if("static"!==r&&"prototype"!==r&&"own"!==r)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+r+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:i,placement:r,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:y(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var i=y(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:i}},runClassFinishers:function(e,t){for(var i=0;i<t.length;i++){var r=(0,t[i])(e);if(void 0!==r){if("function"!=typeof r)throw new TypeError("Finishers must return a constructor.");e=r}}return e},disallowProperty:function(e,t,i){if(void 0!==e[t])throw new TypeError(i+" can't have a ."+t+" property.")}};return e}function p(e){var t,i=g(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var r={kind:"field"===e.kind?"field":"method",key:i,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(r.decorators=e.decorators),"field"===e.kind&&(r.initializer=e.value),r}function f(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function m(e){return e.decorators&&e.decorators.length}function v(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function y(e,t){var i=e[t];if(void 0!==i&&"function"!=typeof i)throw new TypeError("Expected '"+t+"' to be a function");return i}function g(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function b(e,t,i){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=k(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(i):n.value}},b(e,t,i||e)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}d=(h.then?await h:h)[0];const E=(e,t)=>{let i=0;for(let t=0;t<e.length;t++){if(e[t]<5){i=t;break}e[t]<e[i]&&(i=t)}return e[i]+=t,i};let C=function(e,t,i,r){var n=u();if(r)for(var o=0;o<r.length;o++)n=r[o](n);var a=t((function(e){n.initializeInstanceElements(e,s.elements)}),i),s=n.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},r=0;r<e.length;r++){var n,o=e[r];if("method"===o.kind&&(n=t.find(i)))if(v(o.descriptor)||v(n.descriptor)){if(m(o)||m(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(m(o)){if(m(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}f(o,n)}else t.push(o)}return t}(a.d.map(p)),e);return n.initializeClassElements(a.F,s.elements),n.runClassFinishers(a.F,s.finishers)}(null,(function(e,d){class h extends d{constructor(){super(),e(this),this.addEventListener("iron-resize",(e=>e.stopPropagation()))}}return{F:h,d:[{kind:"field",decorators:[(0,r.C)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,r.C)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,r.C)({type:Boolean})],key:"narrow",value:void 0},{kind:"field",decorators:[(0,r.C)({type:Number})],key:"index",value:void 0},{kind:"field",decorators:[(0,r.C)({type:Boolean})],key:"isStrategy",value:()=>!1},{kind:"field",decorators:[(0,r.C)({attribute:!1})],key:"cards",value:()=>[]},{kind:"field",decorators:[(0,r.C)({attribute:!1})],key:"badges",value:()=>[]},{kind:"field",decorators:[(0,n.S)()],key:"_columns",value:void 0},{kind:"field",key:"_createColumnsIteration",value:()=>0},{kind:"field",key:"_mqls",value:void 0},{kind:"field",key:"_mqlListenerRef",value:void 0},{kind:"method",key:"connectedCallback",value:function(){b(k(h.prototype),"connectedCallback",this).call(this),this._initMqls()}},{kind:"method",key:"disconnectedCallback",value:function(){var e;b(k(h.prototype),"disconnectedCallback",this).call(this),null===(e=this._mqls)||void 0===e||e.forEach((e=>{e.removeListener(this._mqlListenerRef)})),this._mqlListenerRef=void 0,this._mqls=void 0}},{kind:"method",key:"setConfig",value:function(e){}},{kind:"method",key:"render",value:function(){var e;return t.dy`
      ${this.badges.length>0?t.dy` <div class="badges">${this.badges}</div>`:""}
      <div id="columns"></div>
      ${null!==(e=this.lovelace)&&void 0!==e&&e.editMode?t.dy`
            <ha-fab
              .label=${this.hass.localize("ui.panel.lovelace.editor.edit_card.add")}
              extended
              @click=${this._addCard}
              class=${(0,o.$)({rtl:(0,s.HE)(this.hass)})}
            >
              <ha-svg-icon slot="icon" .path=${"M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z"}></ha-svg-icon>
            </ha-fab>
          `:""}
    `}},{kind:"method",key:"_initMqls",value:function(){this._mqls=[300,600,900,1200].map((e=>{const t=window.matchMedia(`(min-width: ${e}px)`);return this._mqlListenerRef||(this._mqlListenerRef=this._updateColumns.bind(this)),t.addListener(this._mqlListenerRef),t}))}},{kind:"get",key:"mqls",value:function(){return this._mqls||this._initMqls(),this._mqls}},{kind:"method",key:"willUpdate",value:function(e){var t;if(b(k(h.prototype),"willUpdate",this).call(this,e),null!==(t=this.lovelace)&&void 0!==t&&t.editMode&&Promise.all([i.e(87502),i.e(1536),i.e(93883),i.e(95916),i.e(70741)]).then(i.bind(i,70741)),e.has("hass")){const t=e.get("hass");if(this.hass.dockedSidebar!==(null==t?void 0:t.dockedSidebar))return void this._updateColumns()}if(e.has("narrow"))return void this._updateColumns();const r=e.get("lovelace");(e.has("cards")||e.has("lovelace")&&r&&(r.config!==this.lovelace.config||r.editMode!==this.lovelace.editMode))&&this._createColumns()}},{kind:"method",key:"_addCard",value:function(){(0,a.B)(this,"ll-create-card")}},{kind:"method",key:"_createRootElement",value:function(e){const t=this.shadowRoot.getElementById("columns");for(;t.lastChild;)t.removeChild(t.lastChild);e.forEach((e=>t.appendChild(e)))}},{kind:"method",key:"_createColumns",value:async function(){if(!this._columns)return;this._createColumnsIteration++;const e=this._createColumnsIteration,t=[],i=[];for(let e=0;e<Math.min(this._columns,this.cards.length);e++){const e=document.createElement("div");e.classList.add("column"),t.push(0),i.push(e)}let r,n;this.hasUpdated?this._createRootElement(i):this.updateComplete.then((()=>{this._createRootElement(i)}));for(const[o,a]of this.cards.entries()){let s;void 0===r&&(r=(0,l.y)().then((()=>{r=void 0,n=void 0}))),void 0===n?n=new Date:(new Date).getTime()-n.getTime()>16&&(s=r);const d=(0,c.N)(a),[h]=await Promise.all([d,s]);if(e!==this._createColumnsIteration)return;this._addCardToColumn(i[E(t,h)],o,this.lovelace.editMode)}i.forEach((e=>{e.lastChild||e.parentElement.removeChild(e)}))}},{kind:"method",key:"_addCardToColumn",value:function(e,t,i){const r=this.cards[t];if(!i||this.isStrategy)r.editMode=!1,e.appendChild(r);else{const i=document.createElement("hui-card-options");i.hass=this.hass,i.lovelace=this.lovelace,i.path=[this.index,t],r.editMode=!0,i.appendChild(r),e.appendChild(i)}}},{kind:"method",key:"_updateColumns",value:function(){const e=this.mqls.reduce(((e,t)=>e+Number(t.matches)),0),t=Math.max(1,e-Number(!this.narrow&&"docked"===this.hass.dockedSidebar));t!==this._columns&&(this._columns=t,this._createColumns())}},{kind:"get",static:!0,key:"styles",value:function(){return t.iv`
      :host {
        display: block;
        padding-top: 4px;
        height: 100%;
        box-sizing: border-box;
      }

      .badges {
        margin: 8px 16px;
        font-size: 85%;
        text-align: center;
      }

      #columns {
        display: flex;
        flex-direction: row;
        justify-content: center;
        margin-left: 4px;
        margin-right: 4px;
      }

      .column {
        flex: 1 0 0;
        max-width: 500px;
        min-width: 0;
      }

      .column > * {
        display: block;
        margin: var(--masonry-view-card-margin, 4px 4px 8px);
      }

      ha-fab {
        position: sticky;
        float: right;
        right: calc(16px + env(safe-area-inset-right));
        bottom: calc(16px + env(safe-area-inset-bottom));
        z-index: 1;
      }

      ha-fab.rtl {
        float: left;
        right: auto;
        left: calc(16px + env(safe-area-inset-left));
      }

      @media (max-width: 500px) {
        .column > * {
          margin-left: 0;
          margin-right: 0;
        }
      }

      @media (max-width: 599px) {
        .column {
          max-width: 600px;
        }
      }
    `}}]}}),t.oi);customElements.define("hui-masonry-view",C)}))},10009:(e,t,i)=>{i.a(e,(async e=>{var t=i(37500),r=i(26767),n=i(5701),o=i(17717),a=i(62877),s=i(6315),l=(i(52039),i(90271)),d=i(73953),c=i(51153),h=i(48745),u=i(97504),p=i(18678),f=i(12330),m=i(12042),v=i(13192),y=e([d,h,c,s]);function g(){g=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(i){t.forEach((function(t){t.kind===i&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var i=e.prototype;["method","field"].forEach((function(r){t.forEach((function(t){var n=t.placement;if(t.kind===r&&("static"===n||"prototype"===n)){var o="static"===n?e:i;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var i=t.descriptor;if("field"===t.kind){var r=t.initializer;i={enumerable:i.enumerable,writable:i.writable,configurable:i.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,i)},decorateClass:function(e,t){var i=[],r=[],n={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,n)}),this),e.forEach((function(e){if(!k(e))return i.push(e);var t=this.decorateElement(e,n);i.push(t.element),i.push.apply(i,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:i,finishers:r};var o=this.decorateConstructor(i,t);return r.push.apply(r,o.finishers),o.finishers=r,o},addElementPlacement:function(e,t,i){var r=t[e.placement];if(!i&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var i=[],r=[],n=e.decorators,o=n.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),l=this.toElementFinisherExtras((0,n[o])(s)||s);e=l.element,this.addElementPlacement(e,t),l.finisher&&r.push(l.finisher);var d=l.extras;if(d){for(var c=0;c<d.length;c++)this.addElementPlacement(d[c],t);i.push.apply(i,d)}}return{element:e,finishers:r,extras:i}},decorateConstructor:function(e,t){for(var i=[],r=t.length-1;r>=0;r--){var n=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[r])(n)||n);if(void 0!==o.finisher&&i.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:i}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return x(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?x(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var i=_(e.key),r=String(e.placement);if("static"!==r&&"prototype"!==r&&"own"!==r)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+r+'"');var n=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:i,placement:r,descriptor:Object.assign({},n)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(n,"get","The property descriptor of a field descriptor"),this.disallowProperty(n,"set","The property descriptor of a field descriptor"),this.disallowProperty(n,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:C(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var i=C(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:i}},runClassFinishers:function(e,t){for(var i=0;i<t.length;i++){var r=(0,t[i])(e);if(void 0!==r){if("function"!=typeof r)throw new TypeError("Finishers must return a constructor.");e=r}}return e},disallowProperty:function(e,t,i){if(void 0!==e[t])throw new TypeError(i+" can't have a ."+t+" property.")}};return e}function w(e){var t,i=_(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var r={kind:"field"===e.kind?"field":"method",key:i,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(r.decorators=e.decorators),"field"===e.kind&&(r.initializer=e.value),r}function b(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function k(e){return e.decorators&&e.decorators.length}function E(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function C(e,t){var i=e[t];if(void 0!==i&&"function"!=typeof i)throw new TypeError("Expected '"+t+"' to be a function");return i}function _(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=new Array(t);i<t;i++)r[i]=e[i];return r}function P(e,t,i){return P="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=T(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(i):n.value}},P(e,t,i||e)}function T(e){return T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},T(e)}[d,h,c,s]=y.then?await y:y;!function(e,t,i,r){var n=g();if(r)for(var o=0;o<r.length;o++)n=r[o](n);var a=t((function(e){n.initializeInstanceElements(e,s.elements)}),i),s=n.decorateClass(function(e){for(var t=[],i=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},r=0;r<e.length;r++){var n,o=e[r];if("method"===o.kind&&(n=t.find(i)))if(E(o.descriptor)||E(n.descriptor)){if(k(o)||k(n))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");n.descriptor=o.descriptor}else{if(k(o)){if(k(n))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");n.decorators=o.decorators}b(o,n)}else t.push(o)}return t}(a.d.map(w)),e);n.initializeClassElements(a.F,s.elements),n.runClassFinishers(a.F,s.finishers)}([(0,r.M)("hui-view")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,n.C)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.C)({attribute:!1})],key:"lovelace",value:void 0},{kind:"field",decorators:[(0,n.C)({type:Boolean})],key:"narrow",value:void 0},{kind:"field",decorators:[(0,n.C)({type:Number})],key:"index",value:void 0},{kind:"field",decorators:[(0,o.S)()],key:"_cards",value:()=>[]},{kind:"field",decorators:[(0,o.S)()],key:"_badges",value:()=>[]},{kind:"field",key:"_layoutElementType",value:void 0},{kind:"field",key:"_layoutElement",value:void 0},{kind:"field",key:"_viewConfigTheme",value:void 0},{kind:"method",key:"createCardElement",value:function(e){const t=(0,c.Z6)(e);return t.hass=this.hass,t.addEventListener("ll-rebuild",(i=>{this.lovelace.editMode||(i.stopPropagation(),this._rebuildCard(t,e))}),{once:!0}),t}},{kind:"method",key:"createBadgeElement",value:function(e){const t=(0,d.J)(e);return t.hass=this.hass,t.addEventListener("ll-badge-rebuild",(()=>{this._rebuildBadge(t,e)}),{once:!0}),t}},{kind:"method",key:"createRenderRoot",value:function(){return this}},{kind:"method",key:"willUpdate",value:function(e){P(T(i.prototype),"willUpdate",this).call(this,e);const t=e.get("lovelace");(e.has("index")||e.has("lovelace")&&(!t||this.lovelace.config.views[this.index]!==t.config.views[this.index]))&&this._initializeConfig()}},{kind:"method",key:"update",value:function(e){if(P(T(i.prototype),"update",this).call(this,e),this._layoutElement){if(e.has("hass")){this._badges.forEach((e=>{e.hass=this.hass})),this._cards.forEach((e=>{e.hass=this.hass})),this._layoutElement.hass=this.hass;const t=e.get("hass");t&&this.hass.themes===t.themes&&this.hass.selectedTheme===t.selectedTheme||(0,a.R)(this,this.hass.themes,this._viewConfigTheme)}e.has("narrow")&&(this._layoutElement.narrow=this.narrow),e.has("lovelace")&&(this._layoutElement.lovelace=this.lovelace),e.has("_cards")&&(this._layoutElement.cards=this._cards),e.has("_badges")&&(this._layoutElement.badges=this._badges)}}},{kind:"method",key:"_initializeConfig",value:async function(){let e=this.lovelace.config.views[this.index],t=!1;e.strategy&&(t=!0,e=await(0,m.ar)({hass:this.hass,config:this.lovelace.config,narrow:this.narrow,view:e})),e={...e,type:e.panel?v.Jh:e.type||v.Zx};let i=!1;if(this._layoutElement&&this._layoutElementType===e.type||(i=!0,this._createLayoutElement(e)),this._createBadges(e),this._createCards(e),this._layoutElement.isStrategy=t,this._layoutElement.hass=this.hass,this._layoutElement.narrow=this.narrow,this._layoutElement.lovelace=this.lovelace,this._layoutElement.index=this.index,this._layoutElement.cards=this._cards,this._layoutElement.badges=this._badges,(0,a.R)(this,this.hass.themes,e.theme),this._viewConfigTheme=e.theme,i){for(;this.lastChild;)this.removeChild(this.lastChild);this.appendChild(this._layoutElement)}}},{kind:"method",key:"_createLayoutElement",value:function(e){this._layoutElement=(0,h.o)(e),this._layoutElementType=e.type,this._layoutElement.addEventListener("ll-create-card",(()=>{(0,u.F)(this,{lovelaceConfig:this.lovelace.config,saveConfig:this.lovelace.saveConfig,path:[this.index]})})),this._layoutElement.addEventListener("ll-edit-card",(e=>{(0,p.x)(this,{lovelaceConfig:this.lovelace.config,saveConfig:this.lovelace.saveConfig,path:e.detail.path})})),this._layoutElement.addEventListener("ll-delete-card",(e=>{(0,f.R)(this,this.hass,this.lovelace,e.detail.path)}))}},{kind:"method",key:"_createBadges",value:function(e){if(!e||!e.badges||!Array.isArray(e.badges))return void(this._badges=[]);const t=(0,l.A)(e.badges);this._badges=t.map((e=>{const t=(0,d.J)(e);return t.hass=this.hass,t}))}},{kind:"method",key:"_createCards",value:function(e){e&&e.cards&&Array.isArray(e.cards)?this._cards=e.cards.map((e=>{const t=this.createCardElement(e);return t.hass=this.hass,t})):this._cards=[]}},{kind:"method",key:"_rebuildCard",value:function(e,t){const i=this.createCardElement(t);i.hass=this.hass,e.parentElement&&e.parentElement.replaceChild(i,e),this._cards=this._cards.map((t=>t===e?i:t))}},{kind:"method",key:"_rebuildBadge",value:function(e,t){const i=this.createBadgeElement(t);i.hass=this.hass,e.parentElement&&e.parentElement.replaceChild(i,e),this._badges=this._badges.map((t=>t===e?i:t))}}]}}),t.fl)}))}}]);
//# sourceMappingURL=9208e9e6.js.map