UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

13 lines 52.2 kB
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[71380],{76776:function(e,t,a){a(62953);var s=a(40445),i=a(5124),n=a(67576);let r,o,c,l=e=>e;class d extends i.WF{render(){return(0,i.qy)(r||(r=l` ${0} <slot></slot> `),this.header?(0,i.qy)(o||(o=l`<h1 class="card-header">${0}</h1>`),this.header):i.s6)}constructor(...e){super(...e),this.raised=!1}}d.styles=(0,i.AH)(c||(c=l`:host{background:var(--ha-card-background,var(--card-background-color,#fff));-webkit-backdrop-filter:var(--ha-card-backdrop-filter,none);backdrop-filter:var(--ha-card-backdrop-filter,none);box-shadow:var(--ha-card-box-shadow,none);box-sizing:border-box;border-radius:var(--ha-card-border-radius,var(--ha-border-radius-lg));border-width:var(--ha-card-border-width,1px);border-style:solid;border-color:var(--ha-card-border-color,var(--divider-color,#e0e0e0));color:var(--primary-text-color);display:block;transition:all .3s ease-out;position:relative}:host([raised]){border:none;box-shadow:var(--ha-card-box-shadow,0px 2px 1px -1px rgba(0,0,0,.2),0px 1px 1px 0px rgba(0,0,0,.14),0px 1px 3px 0px rgba(0,0,0,.12))}.card-header,:host ::slotted(.card-header){color:var(--ha-card-header-color,var(--primary-text-color));font-family:var(--ha-card-header-font-family, inherit);font-size:var(--ha-card-header-font-size, var(--ha-font-size-2xl));letter-spacing:-.012em;line-height:var(--ha-line-height-expanded);padding:var(--ha-space-3) var(--ha-space-4) var(--ha-space-4);display:block;margin-block-start:0;margin-block-end:0;font-weight:var(--ha-font-weight-normal)}
    :host
      ::slotted(
        .card-content:not(:nth-child(1 of .card-content, .card-header))
      ),
    slot:not(:first-child)::slotted(.card-content) {
      padding-top: 0;
      margin-top: calc(var(--ha-space-2) * -1);
    }
    :host ::slotted(.card-content){padding:var(--ha-space-4)}:host ::slotted(.card-actions){border-top:1px solid var(--divider-color,#e8e8e8);padding:var(--ha-space-2)}`)),(0,s.Cg)([(0,n.MZ)()],d.prototype,"header",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],d.prototype,"raised",void 0),d=(0,s.Cg)([(0,n.EM)("ha-card")],d)},8034:function(e,t,a){a(27495),a(62953);var s=a(40445),i=a(92070),n=a(5124),r=a(67576);let o,c,l,d=e=>e;class h extends n.WF{render(){const e=this._hasSlotController.test("description");return(0,n.qy)(o||(o=d` <div class="prefix-wrap"> <slot name="prefix"></slot> <div class="body" part="heading" ?two-line="${0}" ?three-line="${0}"> <slot name="heading"></slot> ${0} </div> </div> <div class="content"> <slot></slot> </div> `),!this.threeLine&&e,this.threeLine,e?(0,n.qy)(c||(c=d`<span class="secondary"><slot name="description"></slot></span>`)):n.s6)}constructor(...e){super(...e),this.narrow=!1,this.slim=!1,this.threeLine=!1,this.wrapHeading=!1,this.empty=!1,this._hasSlotController=new i.X(this,"description")}}h.styles=(0,n.AH)(l||(l=d`:host{display:flex;padding:0 var(--ha-space-4);align-content:normal;align-self:auto;align-items:center}.body{padding-top:var(--settings-row-body-padding-top,var(--ha-space-2));padding-bottom:var(--settings-row-body-padding-bottom,var(--ha-space-2));padding-left:0;padding-inline-start:0;padding-right:var(--ha-space-4);padding-inline-end:var(--ha-space-4);overflow:hidden;display:var(--layout-vertical_-_display,flex);flex-direction:var(--layout-vertical_-_flex-direction,column);justify-content:var(--layout-center-justified_-_justify-content,center);flex:var(--layout-flex_-_flex,1);flex-basis:var(--layout-flex_-_flex-basis,0.000000001px)}.body[three-line]{min-height:88px}:host(:not([wrap-heading])) body>*{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.body>.secondary{display:block;padding-top:var(--ha-space-1);font-family:var(
        --mdc-typography-body2-font-family,
        var(--mdc-typography-font-family, var(--ha-font-family-body))
      );font-size:var(--mdc-typography-body2-font-size, var(--ha-font-size-s));-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-weight:var(--mdc-typography-body2-font-weight,var(--ha-font-weight-normal));line-height:normal;color:var(--secondary-text-color)}.body[two-line]{min-height:calc(72px - 16px);flex:1}.content{display:contents}:host(:not([narrow])) .content{display:var(--settings-row-content-display,flex);justify-content:flex-end;flex:1;min-width:0;padding:var(--settings-row-content-padding-block,var(--ha-space-4)) 0}:host([empty]) .content{display:none}.content ::slotted(*){width:var(--settings-row-content-width)}:host([narrow]){align-items:normal;flex-direction:column;border-top:1px solid var(--divider-color);padding-bottom:var(--ha-space-2)}::slotted(ha-switch){padding:var(--settings-row-switch-padding-block,var(--ha-space-4)) 0}.secondary{white-space:normal}.prefix-wrap{flex:var(--settings-row-prefix-flex,1);display:var(--settings-row-prefix-display)}:host([narrow]) .prefix-wrap{display:flex;align-items:center}:host([slim]),:host([slim]) .content,:host([slim]) ::slotted(ha-switch){padding:0}:host([slim]) .body{min-height:0}`)),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],h.prototype,"narrow",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],h.prototype,"slim",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,attribute:"three-line"})],h.prototype,"threeLine",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,attribute:"wrap-heading",reflect:!0})],h.prototype,"wrapHeading",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],h.prototype,"empty",void 0),h=(0,s.Cg)([(0,r.EM)("ha-settings-row")],h)},85938:function(e,t,a){a(18111),a(22489),a(3362),a(46058),a(62953);var s=a(40445),i=a(5124),n=a(67576),r=a(1087);let o,c=e=>e;class l extends i.WF{updated(e){e.has("disabled")&&(this.disabled?this._destroySortable():this._createSortable())}disconnectedCallback(){super.disconnectedCallback(),this._shouldBeDestroy=!0,setTimeout(()=>{this._shouldBeDestroy&&(this._destroySortable(),this._shouldBeDestroy=!1)},1)}connectedCallback(){super.connectedCallback(),this._shouldBeDestroy=!1,this.hasUpdated&&!this.disabled&&this._createSortable()}createRenderRoot(){return this}render(){return this.noStyle?i.s6:(0,i.qy)(o||(o=c` <style>.sortable-fallback{display:none!important}.sortable-ghost{box-shadow:0 0 0 2px var(--primary-color);background:rgba(var(--rgb-primary-color),.25);border-radius:var(--ha-border-radius-sm);opacity:.4}.sortable-drag{border-radius:var(--ha-border-radius-sm);opacity:1;background:var(--card-background-color);box-shadow:0px 4px 8px 3px #00000026;cursor:grabbing}</style> `))}async _createSortable(){if(this._sortable)return;const e=this.children[0];if(!e)return;const t=(await Promise.all([a.e(85283),a.e(70322)]).then(a.bind(a,80745))).default,s=Object.assign(Object.assign({scroll:!0,forceAutoScrollFallback:!0,scrollSpeed:20,animation:150},this.options),{},{onChoose:this._handleChoose,onStart:this._handleStart,onEnd:this._handleEnd,onUpdate:this._handleUpdate,onAdd:this._handleAdd,onRemove:this._handleRemove});this.draggableSelector&&(s.draggable=this.draggableSelector),this.handleSelector&&(s.handle=this.handleSelector),void 0!==this.invertSwap&&(s.invertSwap=this.invertSwap),this.group&&(s.group=this.group),this.filter&&(s.filter=this.filter),this._sortable=new t(e,s)}_destroySortable(){this._sortable&&(this._sortable.destroy(),this._sortable=void 0)}constructor(...e){super(...e),this.disabled=!1,this.noStyle=!1,this.invertSwap=!1,this.rollback=!0,this._shouldBeDestroy=!1,this._handleUpdate=e=>{(0,r.r)(this,"item-moved",{newIndex:e.newIndex,oldIndex:e.oldIndex})},this._handleAdd=e=>{(0,r.r)(this,"item-added",{index:e.newIndex,data:e.item.sortableData,item:e.item})},this._handleRemove=e=>{(0,r.r)(this,"item-removed",{index:e.oldIndex})},this._handleEnd=async e=>{(0,r.r)(this,"drag-end"),this.rollback&&e.item.placeholder&&(e.item.placeholder.replaceWith(e.item),delete e.item.placeholder)},this._handleStart=()=>{(0,r.r)(this,"drag-start")},this._handleChoose=e=>{this.rollback&&(e.item.placeholder=document.createComment("sort-placeholder"),e.item.after(e.item.placeholder))}}}(0,s.Cg)([(0,n.MZ)({type:Boolean})],l.prototype,"disabled",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,attribute:"no-style"})],l.prototype,"noStyle",void 0),(0,s.Cg)([(0,n.MZ)({type:String,attribute:"draggable-selector"})],l.prototype,"draggableSelector",void 0),(0,s.Cg)([(0,n.MZ)({type:String,attribute:"handle-selector"})],l.prototype,"handleSelector",void 0),(0,s.Cg)([(0,n.MZ)({type:String,attribute:"filter"})],l.prototype,"filter",void 0),(0,s.Cg)([(0,n.MZ)({type:String})],l.prototype,"group",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean,attribute:"invert-swap"})],l.prototype,"invertSwap",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],l.prototype,"options",void 0),(0,s.Cg)([(0,n.MZ)({type:Boolean})],l.prototype,"rollback",void 0),l=(0,s.Cg)([(0,n.EM)("ha-sortable")],l)},26571:function(e,t,a){a.d(t,{Al:function(){return n},KY:function(){return i},PN:function(){return c},dG:function(){return d},jm:function(){return l},m7:function(){return y},sR:function(){return h},t1:function(){return o},t2:function(){return g},x:function(){return u},yu:function(){return p}});var s=a(95350);const i=["bluetooth","dhcp","discovery","esphome","hardware","hassio","homekit","integration_discovery","mqtt","ssdp","unignore","usb","zeroconf"],n=66649!=a.j?["reauth"]:null,r={"HA-Frontend-Base":`${location.protocol}//${location.host}`},o=(e,t,a)=>e.callApi("POST","config/config_entries/flow",{handler:t,entry_id:a},r),c=(e,t)=>e.callApi("GET",`config/config_entries/flow/${t}`,void 0,r),l=(e,t,a)=>e.callApi("POST",`config/config_entries/flow/${t}`,a,r),d=(e,t,a)=>e.callWS({type:"config_entries/ignore_flow",flow_id:t,title:a}),h=(e,t)=>e.callApi("DELETE",`config/config_entries/flow/${t}`),p=(e,t)=>e.callApi("GET","config/config_entries/flow_handlers"+(t?`?type=${t}`:"")),g=e=>e.sendMessagePromise({type:"config_entries/flow/progress"}),u=(e,t)=>e.connection.subscribeMessage(e=>t(e),{type:"config_entries/flow/subscribe"}),y=(e,t)=>t.context.title_placeholders&&0!==Object.keys(t.context.title_placeholders).length?e(`component.${t.handler}.config.flow_title`,t.context.title_placeholders)||("name"in t.context.title_placeholders?t.context.title_placeholders.name:(0,s.p$)(e,t.handler)):(0,s.p$)(e,t.handler)},77763:function(e,t,a){a.d(t,{W:function(){return v}});a(89463),a(3362),a(62953);var s=a(5124),i=a(26571),n=a(95350),r=a(29094);let o,c,l,d,h,p,g,u,y,f=e=>e;const v=(e,t)=>(0,r.g)(e,t,{flowType:"config_flow",showDevices:!0,createFlow:async(e,a)=>{const[s]=await Promise.all([(0,i.t1)(e,a,t.entryId),e.loadFragmentTranslation("config"),e.loadBackendTranslation("config",a),e.loadBackendTranslation("selector",a),e.loadBackendTranslation("title",a)]);return s},fetchFlow:async(e,t)=>{const[a]=await Promise.all([(0,i.PN)(e,t),e.loadFragmentTranslation("config")]);return await Promise.all([e.loadBackendTranslation("config",a.handler),e.loadBackendTranslation("selector",a.handler),e.loadBackendTranslation("title",a.handler)]),a},handleFlowStep:i.jm,deleteFlow:i.sR,renderAbortDescription(e,t){const a=e.localize(`component.${t.translation_domain||t.handler}.config.abort.${t.reason}`,t.description_placeholders);return a?(0,s.qy)(o||(o=f` <ha-markdown allow-svg breaks .content="${0}"></ha-markdown> `),a):t.reason},renderShowFormStepHeader(e,t){return e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.title`,t.description_placeholders)||e.localize(`component.${t.handler}.title`)},renderShowFormStepDescription(e,t){const a=e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.description`,t.description_placeholders);return a?(0,s.qy)(c||(c=f` <ha-markdown .allowDataUrl="${0}" allow-svg breaks .content="${0}"></ha-markdown> `),"zwave_js"===t.handler,a):""},renderShowFormStepFieldLabel(e,t,a,s){var i;if("expandable"===a.type)return e.localize(`component.${t.handler}.config.step.${t.step_id}.sections.${a.name}.name`,t.description_placeholders)||a.name;const n=null!=s&&null!==(i=s.path)&&void 0!==i&&i[0]?`sections.${s.path[0]}.`:"";return e.localize(`component.${t.handler}.config.step.${t.step_id}.${n}data.${a.name}`,t.description_placeholders)||a.name},renderShowFormStepFieldHelper(e,t,a,i){var n;if("expandable"===a.type)return e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.sections.${a.name}.description`,t.description_placeholders);const r=null!=i&&null!==(n=i.path)&&void 0!==n&&n[0]?`sections.${i.path[0]}.`:"",o=e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.${r}data_description.${a.name}`,t.description_placeholders);return o?(0,s.qy)(l||(l=f`<ha-markdown breaks .content="${0}"></ha-markdown>`),o):""},renderShowFormStepFieldError(e,t,a){return e.localize(`component.${t.translation_domain||t.translation_domain||t.handler}.config.error.${a}`,t.description_placeholders)||a},renderShowFormStepFieldLocalizeValue(e,t,a){return e.localize(`component.${t.handler}.selector.${a}`)},renderShowFormStepSubmitButton(e,t){return e.localize(`component.${t.handler}.config.step.${t.step_id}.submit`)||e.localize("ui.panel.config.integrations.config_flow."+(!1===t.last_step?"next":"submit"))},renderExternalStepHeader(e,t){return e.localize(`component.${t.handler}.config.step.${t.step_id}.title`)||e.localize("ui.panel.config.integrations.config_flow.external_step.open_site")},renderExternalStepDescription(e,t){const a=e.localize(`component.${t.translation_domain||t.handler}.config.${t.step_id}.description`,t.description_placeholders);return(0,s.qy)(d||(d=f` <p> ${0} </p> ${0} `),e.localize("ui.panel.config.integrations.config_flow.external_step.description"),a?(0,s.qy)(h||(h=f` <ha-markdown allow-svg breaks .content="${0}"></ha-markdown> `),a):"")},renderCreateEntryDescription(e,t){const a=e.localize(`component.${t.translation_domain||t.handler}.config.create_entry.${t.description||"default"}`,t.description_placeholders);return(0,s.qy)(p||(p=f` ${0} `),a?(0,s.qy)(g||(g=f` <ha-markdown allow-svg breaks .content="${0}"></ha-markdown> `),a):s.s6)},renderShowFormProgressHeader(e,t){return e.localize(`component.${t.handler}.config.step.${t.step_id}.title`)||e.localize(`component.${t.handler}.title`)},renderShowFormProgressDescription(e,t){const a=e.localize(`component.${t.translation_domain||t.handler}.config.progress.${t.progress_action}`,t.description_placeholders);return a?(0,s.qy)(u||(u=f` <ha-markdown allow-svg breaks .content="${0}"></ha-markdown> `),a):""},renderMenuHeader(e,t){return e.localize(`component.${t.handler}.config.step.${t.step_id}.title`)||e.localize(`component.${t.handler}.title`)},renderMenuDescription(e,t){const a=e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.description`,t.description_placeholders);return a?(0,s.qy)(y||(y=f` <ha-markdown allow-svg breaks .content="${0}"></ha-markdown> `),a):""},renderMenuOption(e,t,a){return e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.menu_options.${a}`,t.description_placeholders)},renderMenuOptionDescription(e,t,a){return e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.menu_option_descriptions.${a}`,t.description_placeholders)},renderLoadingDescription(e,t,a,s){if("loading_flow"!==t&&"loading_step"!==t)return"";const i=(null==s?void 0:s.handler)||a;return e.localize(`ui.panel.config.integrations.config_flow.loading.${t}`,{integration:i?(0,n.p$)(e.localize,i):e.localize("ui.panel.config.integrations.config_flow.loading.fallback_title")})}})},29094:function(e,t,a){a.d(t,{g:function(){return n}});a(3362),a(62953);var s=a(1087);const i=()=>Promise.all([a.e(72850),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(80131),a.e(98470),a.e(54066),a.e(84038),a.e(62364),a.e(62574),a.e(26092),a.e(39005),a.e(28501),a.e(29792)]).then(a.bind(a,78314)),n=(e,t,a)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-data-entry-flow",dialogImport:i,dialogParams:Object.assign(Object.assign({},t),{},{flowConfig:a,dialogParentElement:e})})}},23206:function(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701),a(3362);var s=a(40445),i=a(5124),n=a(67576),r=a(1087),o=(a(76776),a(18350)),c=(a(67094),a(26300)),l=(a(8034),a(38114)),d=a(23528),h=a(65063),p=a(14503),g=a(36918),u=a(82105),y=a(38940),f=a(6268),v=e([o,c,y,d,l]);[o,c,y,d,l]=v.then?(await v)():v;let _,b,m,$,w,M,C,H,x=e=>e;const k="M16 20H8V6H16M16.67 4H15V2H9V4H7.33C6.6 4 6 4.6 6 5.33V20.67C6 21.4 6.6 22 7.33 22H16.67C17.41 22 18 21.41 18 20.67V5.33C18 4.6 17.4 4 16.67 4M15 16H9V19H15V16M15 7H9V10H15V7M15 11.5H9V14.5H15V11.5Z",z="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",S="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",L="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class V extends i.WF{render(){const e=[],t=[];return this.preferences.energy_sources.forEach((a,s)=>{"battery"===a.type&&(e.push(a),this.validationResult&&t.push(this.validationResult.energy_sources[s]))}),(0,i.qy)(_||(_=x` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </h1> <div class="card-content"> <p> ${0} <a target="_blank" rel="noopener noreferrer" href="${0}">${0}</a> </p> ${0} ${0} <div class="row"> <ha-button @click="${0}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> ${0}</ha-button> </div> </div> </ha-card> `),k,this.hass.localize("ui.panel.config.energy.battery.title"),this.hass.localize("ui.panel.config.energy.battery.sub"),(0,g.o)(this.hass,"/docs/energy/battery/"),this.hass.localize("ui.panel.config.energy.battery.learn_more"),t.map(e=>(0,i.qy)(b||(b=x` <ha-energy-validation-result .hass="${0}" .issues="${0}"></ha-energy-validation-result> `),this.hass,e)),e.length>0?(0,i.qy)(m||(m=x` <div class="items-container"> ${0} </div> `),e.map(e=>{var t,a;const s=this.hass.states[e.stat_energy_to];return(0,i.qy)($||($=x` <div class="row" .source="${0}"> ${0} <div class="content"> <span class="label">${0}</span> ${0} </div> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> `),e,null!=s&&s.attributes.icon?(0,i.qy)(w||(w=x`<ha-icon .icon="${0}"></ha-icon>`),s.attributes.icon):(0,i.qy)(M||(M=x`<ha-svg-icon .path="${0}"></ha-svg-icon>`),k),e.name||(0,d.$O)(this.hass,e.stat_energy_from,null===(t=this.statsMetadata)||void 0===t?void 0:t[e.stat_energy_from]),e.name?i.s6:(0,i.qy)(C||(C=x` <span class="label">${0}</span> `),(0,d.$O)(this.hass,e.stat_energy_to,null===(a=this.statsMetadata)||void 0===a?void 0:a[e.stat_energy_to])),this.hass.localize("ui.panel.config.energy.battery.edit_battery_system"),this._editSource,S,this.hass.localize("ui.panel.config.energy.battery.delete_battery_system"),this._deleteSource,z)})):"",this._addSource,L,this.hass.localize("ui.panel.config.energy.battery.add_battery_system"))}_addSource(){(0,u.m5)(this,{statsMetadata:this.statsMetadata,battery_sources:this.preferences.energy_sources.filter(e=>"battery"===e.type),saveCallback:async e=>{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.concat(e)}))}})}_editSource(e){const t=e.currentTarget.closest(".row").source;(0,u.m5)(this,{statsMetadata:this.statsMetadata,source:Object.assign({},t),battery_sources:this.preferences.energy_sources.filter(e=>"battery"===e.type),saveCallback:async e=>{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.map(a=>a===t?e:a)}))}})}async _deleteSource(e){const t=e.currentTarget.closest(".row").source;if(await(0,h.dk)(this,{title:this.hass.localize("ui.panel.config.energy.delete_source")}))try{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.filter(e=>e!==t)}))}catch(a){(0,h.showAlertDialog)(this,{title:`Failed to save config: ${a.message}`})}}async _savePreferences(e){const t=await(0,l.WN)(this.hass,e);(0,r.r)(this,"value-changed",{value:t})}static get styles(){return[p.RF,f.X,(0,i.AH)(H||(H=x`.row{height:58px}.content{display:flex;flex-direction:column}.label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`))]}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"preferences",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"validationResult",void 0),V=(0,s.Cg)([(0,n.EM)("ha-energy-battery-settings")],V),t()}catch(_){t(_)}})},76135:function(e,t,a){a.a(e,async function(e,t){try{a(74423),a(18111),a(22489),a(7588),a(61701),a(3362);var s=a(40445),i=a(5124),n=a(75751),r=a(67576),o=a(1087),c=(a(76776),a(18350)),l=a(26300),d=(a(85938),a(67094),a(34127)),h=a(38114),p=a(23528),g=a(65063),u=a(14503),y=a(36918),f=a(82105),v=a(38940),_=a(6268),b=e([c,l,d,v,p,h]);[c,l,d,v,p,h]=b.then?(await b)():b;let m,$,w,M,C,H,x=e=>e;const k="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z",z="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",S="M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z",L="M21 11H3V9H21V11M21 13H3V15H21V13Z",V="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",O="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class Z extends i.WF{render(){var e;return(0,i.qy)(m||(m=x` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </h1> <div class="card-content"> <p> ${0} <a target="_blank" rel="noopener noreferrer" href="${0}">${0}</a> </p> ${0} ${0} <div class="row"> <ha-button @click="${0}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>${0}</ha-button> </div> </div> </ha-card> `),S,this.hass.localize("ui.panel.config.energy.device_consumption.title"),this.hass.localize("ui.panel.config.energy.device_consumption.sub"),(0,y.o)(this.hass,"/docs/energy/individual-devices/"),this.hass.localize("ui.panel.config.energy.device_consumption.learn_more"),null===(e=this.validationResult)||void 0===e?void 0:e.device_consumption.map(e=>(0,i.qy)($||($=x` <ha-energy-validation-result .hass="${0}" .issues="${0}"></ha-energy-validation-result> `),this.hass,e)),this.preferences.device_consumption.length>0?(0,i.qy)(w||(w=x` <div class="items-container"> <ha-sortable handle-selector=".handle" @item-moved="${0}"> <div class="devices"> ${0} </div> </ha-sortable> </div> `),this._itemMoved,(0,n.u)(this.preferences.device_consumption,e=>e.stat_consumption,(e,t)=>{var a,s;return(0,i.qy)(M||(M=x` <div class="row" .device="${0}"> <div class="handle"> <ha-svg-icon .path="${0}"></ha-svg-icon> </div> <span class="content">${0}</span> ${0} <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> <ha-icon-button .label="${0}" @click="${0}" .device="${0}" .path="${0}"></ha-icon-button> </div> `),e,L,e.name||(0,p.$O)(this.hass,e.stat_consumption,null===(a=this.statsMetadata)||void 0===a?void 0:a[e.stat_consumption]),this._renderIssueIndicator(null===(s=this.validationResult)||void 0===s?void 0:s.device_consumption[t],t),this.hass.localize("ui.common.edit"),this._editDevice,V,this.hass.localize("ui.common.delete"),this._deleteDevice,e,z)})):"",this._addDevice,O,this.hass.localize("ui.panel.config.energy.device_consumption.add_device"))}_renderIssueIndicator(e,t){if(null==e||!e.length)return i.s6;const a=e.map(e=>this.hass.localize(`component.energy.issues.${e.type}.title`)||e.type).join("\n"),s=`issue-icon-${t}`;return(0,i.qy)(C||(C=x` <ha-svg-icon id="${0}" class="issue-icon" .path="${0}" aria-label="${0}"></ha-svg-icon> <ha-tooltip .for="${0}" placement="top">${0}</ha-tooltip> `),s,k,a,s,a)}_itemMoved(e){e.stopPropagation();const{oldIndex:t,newIndex:a}=e.detail,s=this.preferences.device_consumption.concat(),i=s.splice(t,1)[0];s.splice(a,0,i);const n=Object.assign(Object.assign({},this.preferences),{},{device_consumption:s});(0,o.r)(this,"value-changed",{value:n}),this._savePreferences(n)}_editDevice(e){const t=e.currentTarget.closest(".row").device;(0,f.D0)(this,{statsMetadata:this.statsMetadata,device:Object.assign({},t),device_consumptions:this.preferences.device_consumption,saveCallback:async e=>{const a=Object.assign(Object.assign({},this.preferences),{},{device_consumption:this.preferences.device_consumption.map(a=>a===t?e:a)});this._sanitizeParents(a),await this._savePreferences(a)}})}_addDevice(){(0,f.D0)(this,{statsMetadata:this.statsMetadata,device_consumptions:this.preferences.device_consumption,saveCallback:async e=>{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{device_consumption:this.preferences.device_consumption.concat(e)}))}})}_sanitizeParents(e){const t=e.device_consumption.map(e=>e.stat_consumption);e.device_consumption.forEach(e=>{e.included_in_stat&&!t.includes(e.included_in_stat)&&delete e.included_in_stat})}async _deleteDevice(e){const t=e.currentTarget.device;if(await(0,g.dk)(this,{title:this.hass.localize("ui.panel.config.energy.delete_source")}))try{const e=Object.assign(Object.assign({},this.preferences),{},{device_consumption:this.preferences.device_consumption.filter(e=>e!==t)});this._sanitizeParents(e),await this._savePreferences(e)}catch(a){(0,g.showAlertDialog)(this,{title:`Failed to save config: ${a.message}`})}}async _savePreferences(e){const t=await(0,h.WN)(this.hass,e);(0,o.r)(this,"value-changed",{value:t})}static get styles(){return[u.RF,_.X,(0,i.AH)(H||(H=x`.handle{cursor:move;cursor:grab}.issue-icon{color:var(--warning-color)}`))]}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],Z.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],Z.prototype,"preferences",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],Z.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],Z.prototype,"validationResult",void 0),Z=(0,s.Cg)([(0,r.EM)("ha-energy-device-settings")],Z),t()}catch(m){t(m)}})},28166:function(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701),a(3362);var s=a(40445),i=a(5124),n=a(67576),r=a(1087),o=a(18350),c=(a(76776),a(26300)),l=a(38114),d=a(23528),h=a(65063),p=a(14503),g=a(36918),u=a(82105),y=a(38940),f=a(6268),v=e([o,c,y,d,l]);[o,c,y,d,l]=v.then?(await v)():v;let _,b,m,$,w,M,C=e=>e;const H="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",x="M17.66 11.2C17.43 10.9 17.15 10.64 16.89 10.38C16.22 9.78 15.46 9.35 14.82 8.72C13.33 7.26 13 4.85 13.95 3C13 3.23 12.17 3.75 11.46 4.32C8.87 6.4 7.85 10.07 9.07 13.22C9.11 13.32 9.15 13.42 9.15 13.55C9.15 13.77 9 13.97 8.8 14.05C8.57 14.15 8.33 14.09 8.14 13.93C8.08 13.88 8.04 13.83 8 13.76C6.87 12.33 6.69 10.28 7.45 8.64C5.78 10 4.87 12.3 5 14.47C5.06 14.97 5.12 15.47 5.29 15.97C5.43 16.57 5.7 17.17 6 17.7C7.08 19.43 8.95 20.67 10.96 20.92C13.1 21.19 15.39 20.8 17.03 19.32C18.86 17.66 19.5 15 18.56 12.72L18.43 12.46C18.22 12 17.66 11.2 17.66 11.2M14.5 17.5C14.22 17.74 13.76 18 13.4 18.1C12.28 18.5 11.16 17.94 10.5 17.28C11.69 17 12.4 16.12 12.61 15.23C12.78 14.43 12.46 13.77 12.33 13C12.21 12.26 12.23 11.63 12.5 10.94C12.69 11.32 12.89 11.7 13.13 12C13.9 13 15.11 13.44 15.37 14.8C15.41 14.94 15.43 15.08 15.43 15.23C15.46 16.05 15.1 16.95 14.5 17.5H14.5Z",k="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",z="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class S extends i.WF{render(){const e=[],t=[];return this.preferences.energy_sources.forEach((a,s)=>{"gas"===a.type&&(e.push(a),this.validationResult&&t.push(this.validationResult.energy_sources[s]))}),(0,i.qy)(_||(_=C` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </h1> <div class="card-content"> <p> ${0} <a target="_blank" rel="noopener noreferrer" href="${0}">${0}</a> </p> ${0} ${0} <div class="row"> <ha-button @click="${0}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>${0}</ha-button> </div> </div> </ha-card> `),x,this.hass.localize("ui.panel.config.energy.gas.title"),this.hass.localize("ui.panel.config.energy.gas.sub"),(0,g.o)(this.hass,"/docs/energy/gas/"),this.hass.localize("ui.panel.config.energy.gas.learn_more"),t.map(e=>(0,i.qy)(b||(b=C` <ha-energy-validation-result .hass="${0}" .issues="${0}"></ha-energy-validation-result> `),this.hass,e)),e.length>0?(0,i.qy)(m||(m=C` <div class="items-container"> ${0} </div> `),e.map(e=>{var t;const a=this.hass.states[e.stat_energy_from];return(0,i.qy)($||($=C` <div class="row" .source="${0}"> ${0} <span class="content">${0}</span> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> `),e,null!=a&&a.attributes.icon?(0,i.qy)(w||(w=C`<ha-icon .icon="${0}"></ha-icon>`),a.attributes.icon):(0,i.qy)(M||(M=C`<ha-svg-icon .path="${0}"></ha-svg-icon>`),x),e.name||(0,d.$O)(this.hass,e.stat_energy_from,null===(t=this.statsMetadata)||void 0===t?void 0:t[e.stat_energy_from]),this.hass.localize("ui.panel.config.energy.gas.edit_gas_source"),this._editSource,k,this.hass.localize("ui.panel.config.energy.gas.delete_gas_source"),this._deleteSource,H)})):"",this._addSource,z,this.hass.localize("ui.panel.config.energy.gas.add_gas_source"))}_addSource(){(0,u.yH)(this,{statsMetadata:this.statsMetadata,allowedGasUnitClass:(0,l._d)(this.preferences,void 0,this.statsMetadata),gas_sources:this.preferences.energy_sources.filter(e=>"gas"===e.type),saveCallback:async e=>{delete e.unit_of_measurement,await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.concat(e)}))}})}_editSource(e){const t=e.currentTarget.closest(".row").source;(0,u.yH)(this,{source:Object.assign({},t),statsMetadata:this.statsMetadata,allowedGasUnitClass:(0,l._d)(this.preferences,t.stat_energy_from,this.statsMetadata),gas_sources:this.preferences.energy_sources.filter(e=>"gas"===e.type),saveCallback:async e=>{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.map(a=>a===t?e:a)}))}})}async _deleteSource(e){const t=e.currentTarget.closest(".row").source;if(await(0,h.dk)(this,{title:this.hass.localize("ui.panel.config.energy.delete_source")}))try{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.filter(e=>e!==t)}))}catch(a){(0,h.showAlertDialog)(this,{title:`Failed to save config: ${a.message}`})}}async _savePreferences(e){const t=await(0,l.WN)(this.hass,e);(0,r.r)(this,"value-changed",{value:t})}static get styles(){return[p.RF,f.X]}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"preferences",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"validationResult",void 0),S=(0,s.Cg)([(0,n.EM)("ha-energy-gas-settings")],S),t()}catch(_){t(_)}})},54081:function(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701),a(3362),a(62953);var s=a(40445),i=a(5124),n=a(67576),r=a(1087),o=a(18350),c=(a(76776),a(26300)),l=(a(67094),a(77423)),d=a(38114),h=a(23528),p=a(77763),g=a(65063),u=a(14503),y=a(44144),f=a(36918),v=a(82105),_=a(38940),b=a(6268),m=e([o,c,_,h,d]);[o,c,_,h,d]=m.then?(await m)():m;let $,w,M,C,H,x,k,z,S,L,V=e=>e;const O="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",Z="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",q="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",j="M8.28,5.45L6.5,4.55L7.76,2H16.23L17.5,4.55L15.72,5.44L15,4H9L8.28,5.45M18.62,8H14.09L13.3,5H10.7L9.91,8H5.38L4.1,10.55L5.89,11.44L6.62,10H17.38L18.1,11.45L19.89,10.56L18.62,8M17.77,22H15.7L15.46,21.1L12,15.9L8.53,21.1L8.3,22H6.23L9.12,11H11.19L10.83,12.35L12,14.1L13.16,12.35L12.81,11H14.88L17.77,22M11.4,15L10.5,13.65L9.32,18.13L11.4,15M14.68,18.12L13.5,13.64L12.6,15L14.68,18.12Z";class P extends i.WF{firstUpdated(){this._fetchCO2SignalConfigEntries()}render(){var e,t;const a=[],s=[];return this.preferences.energy_sources.forEach((e,t)=>{"grid"===e.type&&(a.push(e),this.validationResult&&s.push(this.validationResult.energy_sources[t]))}),(0,i.qy)($||($=V` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </h1> <div class="card-content"> <p> ${0} <a target="_blank" rel="noopener noreferrer" href="${0}">${0}</a> </p> ${0} <h3> ${0} </h3> ${0} <div class="row"> <ha-button @click="${0}" appearance="filled" size="small"> <ha-svg-icon .path="${0}" slot="start"></ha-svg-icon> ${0}</ha-button> </div> <h3> ${0} </h3> ${0} </div> </ha-card> `),j,this.hass.localize("ui.panel.config.energy.grid.title"),this.hass.localize("ui.panel.config.energy.grid.sub"),(0,f.o)(this.hass,"/docs/energy/electricity-grid/"),this.hass.localize("ui.panel.config.energy.grid.learn_more"),s.map(e=>(0,i.qy)(w||(w=V` <ha-energy-validation-result .hass="${0}" .issues="${0}"></ha-energy-validation-result> `),this.hass,e)),this.hass.localize("ui.panel.config.energy.grid.grid_connections"),a.length>0?(0,i.qy)(M||(M=V` <div class="items-container"> ${0} </div> `),a.map((e,t)=>{var a,s;const n=e.stat_energy_from||e.stat_energy_to||e.stat_rate,r=this.hass.states[n];return(0,i.qy)(C||(C=V` <div class="row" .source="${0}" .sourceIndex="${0}"> ${0} <div class="content"> <span class="label">${0}</span> ${0} </div> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> `),e,t,null!=r&&r.attributes.icon?(0,i.qy)(H||(H=V`<ha-icon .icon="${0}"></ha-icon>`),r.attributes.icon):(0,i.qy)(x||(x=V`<ha-svg-icon .path="${0}"></ha-svg-icon>`),j),e.name||(0,h.$O)(this.hass,n,null===(a=this.statsMetadata)||void 0===a?void 0:a[n]),e.stat_energy_from&&e.stat_energy_to&&!e.name?(0,i.qy)(k||(k=V`<span class="label secondary">${0}</span>`),(0,h.$O)(this.hass,e.stat_energy_to,null===(s=this.statsMetadata)||void 0===s?void 0:s[e.stat_energy_to])):i.s6,this.hass.localize("ui.panel.config.energy.grid.edit_connection"),this._editSource,Z,this.hass.localize("ui.panel.config.energy.grid.delete_connection"),this._deleteSource,O)})):i.s6,this._addSource,q,this.hass.localize("ui.panel.config.energy.grid.add_connection"),this.hass.localize("ui.panel.config.energy.grid.grid_carbon_footprint"),this._co2ConfigEntry?(0,i.qy)(z||(z=V` <div class="items-container"> <div class="row" .entry="${0}"> <img alt="" crossorigin="anonymous" referrerpolicy="no-referrer" src="${0}"> <span class="content">${0}</span> <ha-icon-button .path="${0}" href="${0}"> </ha-icon-button> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> </div> `),this._co2ConfigEntry,(0,y.MR)({domain:"co2signal",type:"icon",darkOptimized:null===(e=this.hass.themes)||void 0===e?void 0:e.darkMode},this.hass.auth.data.hassUrl),this._co2ConfigEntry.title,Z,`/config/integrations/integration/${null===(t=this._co2ConfigEntry)||void 0===t?void 0:t.domain}`,this.hass.localize("ui.panel.config.energy.grid.remove_co2_signal"),this._removeCO2Sensor,O):(0,i.qy)(S||(S=V` <div class="row"> <ha-button @click="${0}" appearance="filled" size="small"> <ha-svg-icon .path="${0}" slot="start"></ha-svg-icon> ${0} </ha-button> </div> `),this._addCO2Sensor,q,this.hass.localize("ui.panel.config.energy.grid.add_co2_signal")))}async _fetchCO2SignalConfigEntries(){const e=await(0,l.VN)(this.hass,{domain:"co2signal"});this._co2ConfigEntry=e.length?e[0]:void 0}_addCO2Sensor(){(0,p.W)(this,{startFlowHandler:"co2signal",dialogClosedCallback:()=>{this._fetchCO2SignalConfigEntries()}})}async _removeCO2Sensor(e){const t=e.currentTarget.closest(".row").entry.entry_id;await(0,g.dk)(this,{title:this.hass.localize("ui.panel.config.energy.delete_integration")})&&(await(0,l.eM)(this.hass,t),this._fetchCO2SignalConfigEntries())}_getGridSources(){return this.preferences.energy_sources.filter(e=>"grid"===e.type)}_addSource(){(0,v.r5)(this,{statsMetadata:this.statsMetadata,grid_sources:this._getGridSources(),saveCallback:async e=>{const t=Object.assign(Object.assign({},this.preferences),{},{energy_sources:[...this.preferences.energy_sources,e]});await this._savePreferences(t)}})}_editSource(e){const t=e.currentTarget.closest(".row"),a=t.source,s=t.sourceIndex;(0,v.r5)(this,{statsMetadata:this.statsMetadata,source:Object.assign({},a),grid_sources:this._getGridSources(),saveCallback:async e=>{const t=this.preferences.energy_sources.filter(e=>"grid"!==e.type),a=this._getGridSources().map((t,a)=>a===s?e:t),i=Object.assign(Object.assign({},this.preferences),{},{energy_sources:[...t,...a]});await this._savePreferences(i)}})}async _deleteSource(e){const t=e.currentTarget.closest(".row").sourceIndex;if(!(await(0,g.dk)(this,{title:this.hass.localize("ui.panel.config.energy.delete_source")})))return;const a=this.preferences.energy_sources.filter(e=>"grid"!==e.type),s=this._getGridSources().filter((e,a)=>a!==t),i=Object.assign(Object.assign({},this.preferences),{},{energy_sources:[...a,...s]});await this._savePreferences(i)}async _savePreferences(e){try{const t=await(0,d.WN)(this.hass,e);(0,r.r)(this,"value-changed",{value:t})}catch(t){(0,g.showAlertDialog)(this,{title:`Failed to save config: ${t.message}`})}}static get styles(){return[u.RF,b.X,(0,i.AH)(L||(L=V`.row{height:58px}.content{display:flex;flex-direction:column}.label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.label.secondary{color:var(--secondary-text-color);font-size:.9em}`))]}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],P.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],P.prototype,"preferences",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],P.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],P.prototype,"validationResult",void 0),(0,s.Cg)([(0,n.wk)()],P.prototype,"_co2ConfigEntry",void 0),P=(0,s.Cg)([(0,n.EM)("ha-energy-grid-settings")],P),t()}catch($){t($)}})},38726:function(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701),a(3362);var s=a(40445),i=a(5124),n=a(67576),r=a(1087),o=(a(76776),a(18350)),c=a(26300),l=a(38114),d=a(23528),h=a(65063),p=a(14503),g=a(36918),u=a(82105),y=a(38940),f=a(6268),v=e([o,c,y,d,l]);[o,c,y,d,l]=v.then?(await v)():v;let _,b,m,$,w,M,C,H,x=e=>e;const k="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",z="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",S="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",L="M11.45,2V5.55L15,3.77L11.45,2M10.45,8L8,10.46L11.75,11.71L10.45,8M2,11.45L3.77,15L5.55,11.45H2M10,2H2V10C2.57,10.17 3.17,10.25 3.77,10.25C7.35,10.26 10.26,7.35 10.27,3.75C10.26,3.16 10.17,2.57 10,2M17,22V16H14L19,7V13H22L17,22Z";class V extends i.WF{render(){const e=[],t=[];return this.preferences.energy_sources.forEach((a,s)=>{"solar"===a.type&&(e.push(a),this.validationResult&&t.push(this.validationResult.energy_sources[s]))}),(0,i.qy)(_||(_=x` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </h1> <div class="card-content"> <p> ${0} <a target="_blank" rel="noopener noreferrer" href="${0}">${0}</a> </p> ${0} ${0} ${0} </div> </ha-card> `),L,this.hass.localize("ui.panel.config.energy.solar.title"),this.hass.localize("ui.panel.config.energy.solar.sub"),(0,g.o)(this.hass,"/docs/energy/solar-panels/"),this.hass.localize("ui.panel.config.energy.solar.learn_more"),t.map(e=>(0,i.qy)(b||(b=x` <ha-energy-validation-result .hass="${0}" .issues="${0}"></ha-energy-validation-result> `),this.hass,e)),e.length>0?(0,i.qy)(m||(m=x` <div class="items-container"> ${0} </div> `),e.map(e=>{var t;const a=this.hass.states[e.stat_energy_from];return(0,i.qy)($||($=x` <div class="row" .source="${0}"> ${0} <span class="content">${0}</span> ${0} <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> `),e,null!=a&&a.attributes.icon?(0,i.qy)(w||(w=x`<ha-icon .icon="${0}"></ha-icon>`),a.attributes.icon):(0,i.qy)(M||(M=x`<ha-svg-icon .path="${0}"></ha-svg-icon>`),L),e.name||(0,d.$O)(this.hass,e.stat_energy_from,null===(t=this.statsMetadata)||void 0===t?void 0:t[e.stat_energy_from]),this.info?(0,i.qy)(C||(C=x` <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> `),this.hass.localize("ui.panel.config.energy.solar.edit_solar_production"),this._editSource,z):"",this.hass.localize("ui.panel.config.energy.solar.delete_solar_production"),this._deleteSource,k)})):"",this.info?(0,i.qy)(H||(H=x` <div class="row"> <ha-button @click="${0}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon> ${0} </ha-button> </div> `),this._addSource,S,this.hass.localize("ui.panel.config.energy.solar.add_solar_production")):"")}_addSource(){(0,u.se)(this,{statsMetadata:this.statsMetadata,info:this.info,solar_sources:this.preferences.energy_sources.filter(e=>"solar"===e.type),saveCallback:async e=>{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.concat(e)}))}})}_editSource(e){const t=e.currentTarget.closest(".row").source;(0,u.se)(this,{statsMetadata:this.statsMetadata,info:this.info,source:Object.assign({},t),solar_sources:this.preferences.energy_sources.filter(e=>"solar"===e.type),saveCallback:async e=>{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.map(a=>a===t?e:a)}))}})}async _deleteSource(e){const t=e.currentTarget.closest(".row").source;if(await(0,h.dk)(this,{title:this.hass.localize("ui.panel.config.energy.delete_source")}))try{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.filter(e=>e!==t)}))}catch(a){(0,h.showAlertDialog)(this,{title:`Failed to save config: ${a.message}`})}}async _savePreferences(e){const t=await(0,l.WN)(this.hass,e);(0,r.r)(this,"value-changed",{value:t})}static get styles(){return[p.RF,f.X]}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"preferences",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"validationResult",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],V.prototype,"info",void 0),V=(0,s.Cg)([(0,n.EM)("ha-energy-solar-settings")],V),t()}catch(_){t(_)}})},38940:function(e,t,a){a.a(e,async function(e,t){try{a(18111),a(61701),a(62953);var s=a(40445),i=a(5124),n=a(67576),r=a(38962),o=a(36918),c=e([r]);r=(c.then?(await c)():c)[0];let l,d,h,p,g,u=e=>e;class y extends i.WF{render(){return 0===this.issues.length?i.s6:this.issues.map(e=>(0,i.qy)(l||(l=u` <ha-alert alert-type="warning" .title="${0}"> ${0} ${0} <ul> ${0} </ul> </ha-alert> `),this.hass.localize(`component.energy.issues.${e.type}.title`)||e.type,this.hass.localize(`component.energy.issues.${e.type}.description`,e.translation_placeholders),"recorder_untracked"===e.type?(0,i.qy)(d||(d=u`(<a href="${0}" target="_blank" rel="noopener noreferrer">${0}</a>)`),(0,o.o)(this.hass,"/integrations/recorder#configure-filter"),this.hass.localize("ui.panel.config.common.learn_more")):"",e.affected_entities.map(([e,t])=>(0,i.qy)(h||(h=u`<li>${0}${0}</li>`),e,t?(0,i.qy)(p||(p=u` (${0})`),t):""))))}}y.styles=(0,i.AH)(g||(g=u`ul{padding-left:24px;padding-inline-start:24px padding-inline-end: initial;margin:4px 0}a{color:var(--primary-color)}`)),(0,s.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"issues",void 0),y=(0,s.Cg)([(0,n.EM)("ha-energy-validation-result")],y),t()}catch(l){t(l)}})},70604:function(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701),a(3362);var s=a(40445),i=a(5124),n=a(67576),r=a(1087),o=(a(76776),a(18350)),c=a(26300),l=a(38114),d=a(23528),h=a(65063),p=a(14503),g=a(36918),u=a(82105),y=a(38940),f=a(6268),v=e([o,c,y,d,l]);[o,c,y,d,l]=v.then?(await v)():v;let _,b,m,$,w,M,C=e=>e;const H="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",x="M12,20A6,6 0 0,1 6,14C6,10 12,3.25 12,3.25C12,3.25 18,10 18,14A6,6 0 0,1 12,20Z",k="M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z",z="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class S extends i.WF{render(){const e=[],t=[];return this.preferences.energy_sources.forEach((a,s)=>{"water"===a.type&&(e.push(a),this.validationResult&&t.push(this.validationResult.energy_sources[s]))}),(0,i.qy)(_||(_=C` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${0}"></ha-svg-icon> ${0} </h1> <div class="card-content"> <p> ${0} <a target="_blank" rel="noopener noreferrer" href="${0}">${0}</a> </p> ${0} ${0} <div class="row"> <ha-button @click="${0}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${0}"></ha-svg-icon>${0}</ha-button> </div> </div> </ha-card> `),x,this.hass.localize("ui.panel.config.energy.water.title"),this.hass.localize("ui.panel.config.energy.water.sub"),(0,g.o)(this.hass,"/docs/energy/water/"),this.hass.localize("ui.panel.config.energy.water.learn_more"),t.map(e=>(0,i.qy)(b||(b=C` <ha-energy-validation-result .hass="${0}" .issues="${0}"></ha-energy-validation-result> `),this.hass,e)),e.length>0?(0,i.qy)(m||(m=C` <div class="items-container"> ${0} </div> `),e.map(e=>{var t;const a=this.hass.states[e.stat_energy_from];return(0,i.qy)($||($=C` <div class="row" .source="${0}"> ${0} <span class="content">${0}</span> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> <ha-icon-button .label="${0}" @click="${0}" .path="${0}"></ha-icon-button> </div> `),e,null!=a&&a.attributes.icon?(0,i.qy)(w||(w=C`<ha-icon .icon="${0}"></ha-icon>`),a.attributes.icon):(0,i.qy)(M||(M=C`<ha-svg-icon .path="${0}"></ha-svg-icon>`),x),e.name||(0,d.$O)(this.hass,e.stat_energy_from,null===(t=this.statsMetadata)||void 0===t?void 0:t[e.stat_energy_from]),this.hass.localize("ui.panel.config.energy.water.edit_water_source"),this._editSource,k,this.hass.localize("ui.panel.config.energy.water.delete_water_source"),this._deleteSource,H)})):"",this._addSource,z,this.hass.localize("ui.panel.config.energy.water.add_water_source"))}_addSource(){(0,u.YX)(this,{statsMetadata:this.statsMetadata,water_sources:this.preferences.energy_sources.filter(e=>"water"===e.type),saveCallback:async e=>{delete e.unit_of_measurement,await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.concat(e)}))}})}_editSource(e){const t=e.currentTarget.closest(".row").source;(0,u.YX)(this,{statsMetadata:this.statsMetadata,source:Object.assign({},t),water_sources:this.preferences.energy_sources.filter(e=>"water"===e.type),saveCallback:async e=>{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.map(a=>a===t?e:a)}))}})}async _deleteSource(e){const t=e.currentTarget.closest(".row").source;if(await(0,h.dk)(this,{title:this.hass.localize("ui.panel.config.energy.delete_source")}))try{await this._savePreferences(Object.assign(Object.assign({},this.preferences),{},{energy_sources:this.preferences.energy_sources.filter(e=>e!==t)}))}catch(a){(0,h.showAlertDialog)(this,{title:`Failed to save config: ${a.message}`})}}async _savePreferences(e){const t=await(0,l.WN)(this.hass,e);(0,r.r)(this,"value-changed",{value:t})}static get styles(){return[p.RF,f.X]}}(0,s.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"hass",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"preferences",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,n.MZ)({attribute:!1})],S.prototype,"validationResult",void 0),S=(0,s.Cg)([(0,n.EM)("ha-energy-water-settings")],S),t()}catch(_){t(_)}})},6268:function(e,t,a){a.d(t,{X:function(){return i}});let s;const i=(0,a(5124).AH)(s||(s=(e=>e)`.card-header ha-svg-icon{height:32px;width:32px;margin-right:8px;margin-inline-end:8px;margin-inline-start:initial;direction:var(--direction)}h3{margin-top:24px;margin-bottom:4px}.row{display:flex;align-items:center;height:48px;box-sizing:border-box}.row ha-icon,.row ha-svg-icon,.row img{margin-right:16px;margin-inline-end:16px;margin-inline-start:initial;direction:var(--direction)}.row img{height:24px}.row .content{flex-grow:1;overflow:hidden;text-overflow:ellipsis}ha-icon-button{color:var(--secondary-text-color)}p{color:var(--secondary-text-color)}p a{color:var(--primary-color)}hr{border:none;border-top:1px solid var(--divider-color);margin:24px calc(var(--ha-space-4) * -1)}.items-container{border:1px solid var(--ha-color-border-neutral-quiet);border-radius:var(--ha-border-radius-lg);padding:var(--ha-space-2);display:flex;flex-direction:column;gap:var(--ha-space-2)}`))},82105:function(e,t,a){a.d(t,{D0:function(){return i},YA:function(){return l},YX:function(){return c},m5:function(){return n},r5:function(){return d},se:function(){return r},yH:function(){return o}});a(3362),a(62953);var s=a(1087);const i=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-energy-device-settings",dialogImport:()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(8740),a.e(62574),a.e(26092),a.e(39005),a.e(8851),a.e(54884),a.e(58715)]).then(a.bind(a,23800)),dialogParams:t})},n=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-energy-battery-settings",dialogImport:()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(3283),a.e(81034),a.e(14309),a.e(62574),a.e(26092),a.e(39005),a.e(8851),a.e(54884),a.e(48336),a.e(39591)]).then(a.bind(a,5242)),dialogParams:t})},r=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-energy-solar-settings",dialogImport:()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(3283),a.e(81034),a.e(97868),a.e(62574),a.e(26092),a.e(39005),a.e(8851),a.e(54884),a.e(88578)]).then(a.bind(a,94098)),dialogParams:t})},o=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-energy-gas-settings",dialogImport:()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(3283),a.e(98470),a.e(81034),a.e(99555),a.e(62574),a.e(26092),a.e(39005),a.e(8851),a.e(54884),a.e(80880)]).then(a.bind(a,16106)),dialogParams:t})},c=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-energy-water-settings",dialogImport:()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(3283),a.e(98470),a.e(81034),a.e(21936),a.e(62574),a.e(26092),a.e(39005),a.e(8851),a.e(54884),a.e(74194)]).then(a.bind(a,86240)),dialogParams:t})},l=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-energy-device-settings-water",dialogImport:()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(86359),a.e(62574),a.e(26092),a.e(39005),a.e(8851),a.e(54884),a.e(76305)]).then(a.bind(a,68937)),dialogParams:t})},d=(e,t)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-energy-grid-settings",dialogImport:()=>Promise.all([a.e(32450),a.e(7305),a.e(92769),a.e(3283),a.e(81034),a.e(14309),a.e(62574),a.e(26092),a.e(39005),a.e(8851),a.e(54884),a.e(48336),a.e(45078)]).then(a.bind(a,65941)),dialogParams:t})}},36918:function(e,t,a){a.d(t,{o:function(){return s}});const s=(e,t)=>`https://www.iobroker.net/#${e.language&&e.language.split("-")[0]||"en"}/adapters/adapterref/iobroker.lovelace/README.md#`}}]);