UNPKG

iobroker.lovelace

Version:

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

13 lines 48.4 kB
export const __rspack_esm_id=71380;export const __rspack_esm_ids=[71380];export const __webpack_modules__={76776(e,t,a){var s=a(62826),i=a(5124),o=a(22441);class r extends i.WF{render(){return i.qy` ${this.header?i.qy`<h1 class="card-header">${this.header}</h1>`:i.s6} <slot></slot> `}constructor(...e){super(...e),this.raised=!1}}r.styles=i.AH`: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,o.MZ)()],r.prototype,"header",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,reflect:!0})],r.prototype,"raised",void 0),r=(0,s.Cg)([(0,o.EM)("ha-card")],r)},8034(e,t,a){var s=a(62826),i=a(92070),o=a(5124),r=a(22441);class n extends o.WF{render(){const e=this._hasSlotController.test("description");return o.qy` <div class="prefix-wrap"> <slot name="prefix"></slot> <div class="body" part="heading" ?two-line="${!this.threeLine&&e}" ?three-line="${this.threeLine}"> <slot name="heading"></slot> ${e?o.qy`<span class="secondary"><slot name="description"></slot></span>`:o.s6} </div> </div> <div class="content"> <slot></slot> </div> `}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")}}n.styles=o.AH`: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})],n.prototype,"narrow",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],n.prototype,"slim",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,attribute:"three-line"})],n.prototype,"threeLine",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,attribute:"wrap-heading",reflect:!0})],n.prototype,"wrapHeading",void 0),(0,s.Cg)([(0,r.MZ)({type:Boolean,reflect:!0})],n.prototype,"empty",void 0),n=(0,s.Cg)([(0,r.EM)("ha-settings-row")],n)},85938(e,t,a){a(18111),a(22489),a(46058);var s=a(62826),i=a(5124),o=a(22441),r=a(1087);class n 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:i.qy` <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={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,o.MZ)({type:Boolean})],n.prototype,"disabled",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,attribute:"no-style"})],n.prototype,"noStyle",void 0),(0,s.Cg)([(0,o.MZ)({type:String,attribute:"draggable-selector"})],n.prototype,"draggableSelector",void 0),(0,s.Cg)([(0,o.MZ)({type:String,attribute:"handle-selector"})],n.prototype,"handleSelector",void 0),(0,s.Cg)([(0,o.MZ)({type:String,attribute:"filter"})],n.prototype,"filter",void 0),(0,s.Cg)([(0,o.MZ)({type:String})],n.prototype,"group",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean,attribute:"invert-swap"})],n.prototype,"invertSwap",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],n.prototype,"options",void 0),(0,s.Cg)([(0,o.MZ)({type:Boolean})],n.prototype,"rollback",void 0),n=(0,s.Cg)([(0,o.EM)("ha-sortable")],n)},26571(e,t,a){a.d(t,{Al:()=>o,KY:()=>i,PN:()=>c,dG:()=>d,jm:()=>l,m7:()=>y,sR:()=>h,t1:()=>n,t2:()=>g,x:()=>u,yu:()=>p});var s=a(95350);const i=["bluetooth","dhcp","discovery","esphome","hardware","hassio","homekit","integration_discovery","mqtt","ssdp","unignore","usb","zeroconf"],o=66649!=a.j?["reauth"]:null,r={"HA-Frontend-Base":`${location.protocol}//${location.host}`},n=(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(e,t,a){a.d(t,{W:()=>n});var s=a(5124),i=a(26571),o=a(95350),r=a(29094);const n=(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?s.qy` <ha-markdown allow-svg breaks .content="${a}"></ha-markdown> `:t.reason},renderShowFormStepHeader:(e,t)=>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?s.qy` <ha-markdown .allowDataUrl="${"zwave_js"===t.handler}" allow-svg breaks .content="${a}"></ha-markdown> `:""},renderShowFormStepFieldLabel(e,t,a,s){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 i=s?.path?.[0]?`sections.${s.path[0]}.`:"";return e.localize(`component.${t.handler}.config.step.${t.step_id}.${i}data.${a.name}`,t.description_placeholders)||a.name},renderShowFormStepFieldHelper(e,t,a,i){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 o=i?.path?.[0]?`sections.${i.path[0]}.`:"",r=e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.${o}data_description.${a.name}`,t.description_placeholders);return r?s.qy`<ha-markdown breaks .content="${r}"></ha-markdown>`:""},renderShowFormStepFieldError:(e,t,a)=>e.localize(`component.${t.translation_domain||t.translation_domain||t.handler}.config.error.${a}`,t.description_placeholders)||a,renderShowFormStepFieldLocalizeValue:(e,t,a)=>e.localize(`component.${t.handler}.selector.${a}`),renderShowFormStepSubmitButton:(e,t)=>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)=>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 s.qy` <p> ${e.localize("ui.panel.config.integrations.config_flow.external_step.description")} </p> ${a?s.qy` <ha-markdown allow-svg breaks .content="${a}"></ha-markdown> `:""} `},renderCreateEntryDescription(e,t){const a=e.localize(`component.${t.translation_domain||t.handler}.config.create_entry.${t.description||"default"}`,t.description_placeholders);return s.qy` ${a?s.qy` <ha-markdown allow-svg breaks .content="${a}"></ha-markdown> `:s.s6} `},renderShowFormProgressHeader:(e,t)=>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?s.qy` <ha-markdown allow-svg breaks .content="${a}"></ha-markdown> `:""},renderMenuHeader:(e,t)=>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?s.qy` <ha-markdown allow-svg breaks .content="${a}"></ha-markdown> `:""},renderMenuOption:(e,t,a)=>e.localize(`component.${t.translation_domain||t.handler}.config.step.${t.step_id}.menu_options.${a}`,t.description_placeholders),renderMenuOptionDescription:(e,t,a)=>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=s?.handler||a;return e.localize(`ui.panel.config.integrations.config_flow.loading.${t}`,{integration:i?(0,o.p$)(e.localize,i):e.localize("ui.panel.config.integrations.config_flow.loading.fallback_title")})}})},29094(e,t,a){a.d(t,{g:()=>o});var s=a(1087);const i=()=>Promise.all([a.e(4801),a.e(39763),a.e(32450),a.e(46095),a.e(7305),a.e(92769),a.e(3283),a.e(80131),a.e(58416),a.e(54066),a.e(84038),a.e(69205),a.e(26092),a.e(48531),a.e(92411),a.e(44642)]).then(a.bind(a,78314)),o=(e,t,a)=>{(0,s.r)(e,"show-dialog",{dialogTag:"dialog-data-entry-flow",dialogImport:i,dialogParams:{...t,flowConfig:a,dialogParentElement:e}})}},23206(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701);var s=a(62826),i=a(5124),o=a(22441),r=a(1087),n=(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([n,c,y,l]);[n,c,y,l]=v.then?(await v)():v;const _="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",m="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",b="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",$="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class w 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]))}),i.qy` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${_}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.battery.title")} </h1> <div class="card-content"> <p> ${this.hass.localize("ui.panel.config.energy.battery.sub")} <a target="_blank" rel="noopener noreferrer" href="${(0,g.o)(this.hass,"/docs/energy/battery/")}">${this.hass.localize("ui.panel.config.energy.battery.learn_more")}</a> </p> ${t.map(e=>i.qy` <ha-energy-validation-result .hass="${this.hass}" .issues="${e}"></ha-energy-validation-result> `)} ${e.length>0?i.qy` <div class="items-container"> ${e.map(e=>{const t=this.hass.states[e.stat_energy_to];return i.qy` <div class="row" .source="${e}"> ${t?.attributes.icon?i.qy`<ha-icon .icon="${t.attributes.icon}"></ha-icon>`:i.qy`<ha-svg-icon .path="${_}"></ha-svg-icon>`} <div class="content"> <span class="label">${e.name||(0,d.$O)(this.hass,e.stat_energy_from,this.statsMetadata?.[e.stat_energy_from])}</span> ${e.name?i.s6:i.qy` <span class="label">${(0,d.$O)(this.hass,e.stat_energy_to,this.statsMetadata?.[e.stat_energy_to])}</span> `} </div> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.battery.edit_battery_system")}" @click="${this._editSource}" .path="${b}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.battery.delete_battery_system")}" @click="${this._deleteSource}" .path="${m}"></ha-icon-button> </div> `})} </div> `:""} <div class="row"> <ha-button @click="${this._addSource}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${$}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.battery.add_battery_system")}</ha-button> </div> </div> </ha-card> `}_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({...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:{...t},battery_sources:this.preferences.energy_sources.filter(e=>"battery"===e.type),saveCallback:async e=>{await this._savePreferences({...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({...this.preferences,energy_sources:this.preferences.energy_sources.filter(e=>e!==t)})}catch(e){(0,h.showAlertDialog)(this,{title:`Failed to save config: ${e.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,i.AH`.row{height:58px}.content{display:flex;flex-direction:column}.label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}`]}}(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"preferences",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"validationResult",void 0),w=(0,s.Cg)([(0,o.EM)("ha-energy-battery-settings")],w),t()}catch(e){t(e)}})},76135(e,t,a){a.a(e,async function(e,t){try{a(74423),a(18111),a(22489),a(7588),a(61701);var s=a(62826),i=a(5124),o=a(75751),r=a(22441),n=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),m=e([c,l,d,v,h]);[c,l,d,v,h]=m.then?(await m)():m;const b="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",$="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",w="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",M="M21 11H3V9H21V11M21 13H3V15H21V13Z",C="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",H="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class x extends i.WF{render(){return i.qy` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${w}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.device_consumption.title")} </h1> <div class="card-content"> <p> ${this.hass.localize("ui.panel.config.energy.device_consumption.sub")} <a target="_blank" rel="noopener noreferrer" href="${(0,y.o)(this.hass,"/docs/energy/individual-devices/")}">${this.hass.localize("ui.panel.config.energy.device_consumption.learn_more")}</a> </p> ${this.validationResult?.device_consumption.map(e=>i.qy` <ha-energy-validation-result .hass="${this.hass}" .issues="${e}"></ha-energy-validation-result> `)} ${this.preferences.device_consumption.length>0?i.qy` <div class="items-container"> <ha-sortable handle-selector=".handle" @item-moved="${this._itemMoved}"> <div class="devices"> ${(0,o.u)(this.preferences.device_consumption,e=>e.stat_consumption,(e,t)=>i.qy` <div class="row" .device="${e}"> <div class="handle"> <ha-svg-icon .path="${M}"></ha-svg-icon> </div> <span class="content">${e.name||(0,p.$O)(this.hass,e.stat_consumption,this.statsMetadata?.[e.stat_consumption])}</span> ${this._renderIssueIndicator(this.validationResult?.device_consumption[t],t)} <ha-icon-button .label="${this.hass.localize("ui.common.edit")}" @click="${this._editDevice}" .path="${C}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.common.delete")}" @click="${this._deleteDevice}" .device="${e}" .path="${$}"></ha-icon-button> </div> `)} </div> </ha-sortable> </div> `:""} <div class="row"> <ha-button @click="${this._addDevice}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${H}"></ha-svg-icon>${this.hass.localize("ui.panel.config.energy.device_consumption.add_device")}</ha-button> </div> </div> </ha-card> `}_renderIssueIndicator(e,t){if(!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 i.qy` <ha-svg-icon id="${s}" class="issue-icon" .path="${b}" aria-label="${a}"></ha-svg-icon> <ha-tooltip .for="${s}" placement="top">${a}</ha-tooltip> `}_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 o={...this.preferences,device_consumption:s};(0,n.r)(this,"value-changed",{value:o}),this._savePreferences(o)}_editDevice(e){const t=e.currentTarget.closest(".row").device;(0,f.D0)(this,{statsMetadata:this.statsMetadata,device:{...t},device_consumptions:this.preferences.device_consumption,saveCallback:async e=>{const a={...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({...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={...this.preferences,device_consumption:this.preferences.device_consumption.filter(e=>e!==t)};this._sanitizeParents(e),await this._savePreferences(e)}catch(e){(0,g.showAlertDialog)(this,{title:`Failed to save config: ${e.message}`})}}async _savePreferences(e){const t=await(0,h.WN)(this.hass,e);(0,n.r)(this,"value-changed",{value:t})}static get styles(){return[u.RF,_.X,i.AH`.handle{cursor:move;cursor:grab}.issue-icon{color:var(--warning-color)}`]}}(0,s.Cg)([(0,r.MZ)({attribute:!1})],x.prototype,"hass",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],x.prototype,"preferences",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],x.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,r.MZ)({attribute:!1})],x.prototype,"validationResult",void 0),x=(0,s.Cg)([(0,r.EM)("ha-energy-device-settings")],x),t()}catch(e){t(e)}})},28166(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701);var s=a(62826),i=a(5124),o=a(22441),r=a(1087),n=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([n,c,y,l]);[n,c,y,l]=v.then?(await v)():v;const _="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",m="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",b="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",$="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class w 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]))}),i.qy` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${m}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.gas.title")} </h1> <div class="card-content"> <p> ${this.hass.localize("ui.panel.config.energy.gas.sub")} <a target="_blank" rel="noopener noreferrer" href="${(0,g.o)(this.hass,"/docs/energy/gas/")}">${this.hass.localize("ui.panel.config.energy.gas.learn_more")}</a> </p> ${t.map(e=>i.qy` <ha-energy-validation-result .hass="${this.hass}" .issues="${e}"></ha-energy-validation-result> `)} ${e.length>0?i.qy` <div class="items-container"> ${e.map(e=>{const t=this.hass.states[e.stat_energy_from];return i.qy` <div class="row" .source="${e}"> ${t?.attributes.icon?i.qy`<ha-icon .icon="${t.attributes.icon}"></ha-icon>`:i.qy`<ha-svg-icon .path="${m}"></ha-svg-icon>`} <span class="content">${e.name||(0,d.$O)(this.hass,e.stat_energy_from,this.statsMetadata?.[e.stat_energy_from])}</span> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.gas.edit_gas_source")}" @click="${this._editSource}" .path="${b}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.gas.delete_gas_source")}" @click="${this._deleteSource}" .path="${_}"></ha-icon-button> </div> `})} </div> `:""} <div class="row"> <ha-button @click="${this._addSource}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${$}"></ha-svg-icon>${this.hass.localize("ui.panel.config.energy.gas.add_gas_source")}</ha-button> </div> </div> </ha-card> `}_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({...this.preferences,energy_sources:this.preferences.energy_sources.concat(e)})}})}_editSource(e){const t=e.currentTarget.closest(".row").source;(0,u.yH)(this,{source:{...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({...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({...this.preferences,energy_sources:this.preferences.energy_sources.filter(e=>e!==t)})}catch(e){(0,h.showAlertDialog)(this,{title:`Failed to save config: ${e.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,o.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"preferences",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"validationResult",void 0),w=(0,s.Cg)([(0,o.EM)("ha-energy-gas-settings")],w),t()}catch(e){t(e)}})},54081(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701);var s=a(62826),i=a(5124),o=a(22441),r=a(1087),n=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),m=a(6268),b=e([n,c,_,d]);[n,c,_,d]=b.then?(await b)():b;const $="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",w="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",M="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",C="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 H extends i.WF{firstUpdated(){this._fetchCO2SignalConfigEntries()}render(){const e=[],t=[];return this.preferences.energy_sources.forEach((a,s)=>{"grid"===a.type&&(e.push(a),this.validationResult&&t.push(this.validationResult.energy_sources[s]))}),i.qy` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${C}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.grid.title")} </h1> <div class="card-content"> <p> ${this.hass.localize("ui.panel.config.energy.grid.sub")} <a target="_blank" rel="noopener noreferrer" href="${(0,f.o)(this.hass,"/docs/energy/electricity-grid/")}">${this.hass.localize("ui.panel.config.energy.grid.learn_more")}</a> </p> ${t.map(e=>i.qy` <ha-energy-validation-result .hass="${this.hass}" .issues="${e}"></ha-energy-validation-result> `)} <h3> ${this.hass.localize("ui.panel.config.energy.grid.grid_connections")} </h3> ${e.length>0?i.qy` <div class="items-container"> ${e.map((e,t)=>{const a=e.stat_energy_from||e.stat_energy_to||e.stat_rate,s=this.hass.states[a];return i.qy` <div class="row" .source="${e}" .sourceIndex="${t}"> ${s?.attributes.icon?i.qy`<ha-icon .icon="${s.attributes.icon}"></ha-icon>`:i.qy`<ha-svg-icon .path="${C}"></ha-svg-icon>`} <div class="content"> <span class="label">${e.name||(0,h.$O)(this.hass,a,this.statsMetadata?.[a])}</span> ${e.stat_energy_from&&e.stat_energy_to&&!e.name?i.qy`<span class="label secondary">${(0,h.$O)(this.hass,e.stat_energy_to,this.statsMetadata?.[e.stat_energy_to])}</span>`:i.s6} </div> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.grid.edit_connection")}" @click="${this._editSource}" .path="${w}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.grid.delete_connection")}" @click="${this._deleteSource}" .path="${$}"></ha-icon-button> </div> `})} </div> `:i.s6} <div class="row"> <ha-button @click="${this._addSource}" appearance="filled" size="small"> <ha-svg-icon .path="${M}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.grid.add_connection")}</ha-button> </div> <h3> ${this.hass.localize("ui.panel.config.energy.grid.grid_carbon_footprint")} </h3> ${this._co2ConfigEntry?i.qy` <div class="items-container"> <div class="row" .entry="${this._co2ConfigEntry}"> <img alt="" crossorigin="anonymous" referrerpolicy="no-referrer" src="${(0,y.MR)({domain:"co2signal",type:"icon",darkOptimized:this.hass.themes?.darkMode},this.hass.auth.data.hassUrl)}"> <span class="content">${this._co2ConfigEntry.title}</span> <ha-icon-button .path="${w}" href="${`/config/integrations/integration/${this._co2ConfigEntry?.domain}`}"> </ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.grid.remove_co2_signal")}" @click="${this._removeCO2Sensor}" .path="${$}"></ha-icon-button> </div> </div> `:i.qy` <div class="row"> <ha-button @click="${this._addCO2Sensor}" appearance="filled" size="small"> <ha-svg-icon .path="${M}" slot="start"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.grid.add_co2_signal")} </ha-button> </div> `} </div> </ha-card> `}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={...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:{...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={...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={...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(e){(0,g.showAlertDialog)(this,{title:`Failed to save config: ${e.message}`})}}static get styles(){return[u.RF,m.X,i.AH`.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,o.MZ)({attribute:!1})],H.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],H.prototype,"preferences",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],H.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],H.prototype,"validationResult",void 0),(0,s.Cg)([(0,o.wk)()],H.prototype,"_co2ConfigEntry",void 0),H=(0,s.Cg)([(0,o.EM)("ha-energy-grid-settings")],H),t()}catch(e){t(e)}})},38726(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701);var s=a(62826),i=a(5124),o=a(22441),r=a(1087),n=(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([n,c,y,l]);[n,c,y,l]=v.then?(await v)():v;const _="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",m="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",b="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",$="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 w 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]))}),i.qy` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${$}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.solar.title")} </h1> <div class="card-content"> <p> ${this.hass.localize("ui.panel.config.energy.solar.sub")} <a target="_blank" rel="noopener noreferrer" href="${(0,g.o)(this.hass,"/docs/energy/solar-panels/")}">${this.hass.localize("ui.panel.config.energy.solar.learn_more")}</a> </p> ${t.map(e=>i.qy` <ha-energy-validation-result .hass="${this.hass}" .issues="${e}"></ha-energy-validation-result> `)} ${e.length>0?i.qy` <div class="items-container"> ${e.map(e=>{const t=this.hass.states[e.stat_energy_from];return i.qy` <div class="row" .source="${e}"> ${t?.attributes.icon?i.qy`<ha-icon .icon="${t.attributes.icon}"></ha-icon>`:i.qy`<ha-svg-icon .path="${$}"></ha-svg-icon>`} <span class="content">${e.name||(0,d.$O)(this.hass,e.stat_energy_from,this.statsMetadata?.[e.stat_energy_from])}</span> ${this.info?i.qy` <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.solar.edit_solar_production")}" @click="${this._editSource}" .path="${m}"></ha-icon-button> `:""} <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.solar.delete_solar_production")}" @click="${this._deleteSource}" .path="${_}"></ha-icon-button> </div> `})} </div> `:""} ${this.info?i.qy` <div class="row"> <ha-button @click="${this._addSource}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${b}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.solar.add_solar_production")} </ha-button> </div> `:""} </div> </ha-card> `}_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({...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:{...t},solar_sources:this.preferences.energy_sources.filter(e=>"solar"===e.type),saveCallback:async e=>{await this._savePreferences({...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({...this.preferences,energy_sources:this.preferences.energy_sources.filter(e=>e!==t)})}catch(e){(0,h.showAlertDialog)(this,{title:`Failed to save config: ${e.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,o.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"preferences",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"validationResult",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"info",void 0),w=(0,s.Cg)([(0,o.EM)("ha-energy-solar-settings")],w),t()}catch(e){t(e)}})},38940(e,t,a){a.a(e,async function(e,t){try{a(18111),a(61701);var s=a(62826),i=a(5124),o=a(22441),r=a(38962),n=a(36918),c=e([r]);r=(c.then?(await c)():c)[0];class l extends i.WF{render(){return 0===this.issues.length?i.s6:this.issues.map(e=>i.qy` <ha-alert alert-type="warning" .title="${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?i.qy`(<a href="${(0,n.o)(this.hass,"/integrations/recorder#configure-filter")}" target="_blank" rel="noopener noreferrer">${this.hass.localize("ui.panel.config.common.learn_more")}</a>)`:""} <ul> ${e.affected_entities.map(([e,t])=>i.qy`<li>${e}${t?i.qy` (${t})`:""}</li>`)} </ul> </ha-alert> `)}}l.styles=i.AH`ul{padding-left:24px;padding-inline-start:24px padding-inline-end: initial;margin:4px 0}a{color:var(--primary-color)}`,(0,s.Cg)([(0,o.MZ)({attribute:!1})],l.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],l.prototype,"issues",void 0),l=(0,s.Cg)([(0,o.EM)("ha-energy-validation-result")],l),t()}catch(e){t(e)}})},70604(e,t,a){a.a(e,async function(e,t){try{a(44114),a(18111),a(22489),a(7588),a(61701);var s=a(62826),i=a(5124),o=a(22441),r=a(1087),n=(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([n,c,y,l]);[n,c,y,l]=v.then?(await v)():v;const _="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",m="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",b="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",$="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";class w 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]))}),i.qy` <ha-card> <h1 class="card-header"> <ha-svg-icon .path="${m}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.energy.water.title")} </h1> <div class="card-content"> <p> ${this.hass.localize("ui.panel.config.energy.water.sub")} <a target="_blank" rel="noopener noreferrer" href="${(0,g.o)(this.hass,"/docs/energy/water/")}">${this.hass.localize("ui.panel.config.energy.water.learn_more")}</a> </p> ${t.map(e=>i.qy` <ha-energy-validation-result .hass="${this.hass}" .issues="${e}"></ha-energy-validation-result> `)} ${e.length>0?i.qy` <div class="items-container"> ${e.map(e=>{const t=this.hass.states[e.stat_energy_from];return i.qy` <div class="row" .source="${e}"> ${t?.attributes.icon?i.qy`<ha-icon .icon="${t.attributes.icon}"></ha-icon>`:i.qy`<ha-svg-icon .path="${m}"></ha-svg-icon>`} <span class="content">${e.name||(0,d.$O)(this.hass,e.stat_energy_from,this.statsMetadata?.[e.stat_energy_from])}</span> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.water.edit_water_source")}" @click="${this._editSource}" .path="${b}"></ha-icon-button> <ha-icon-button .label="${this.hass.localize("ui.panel.config.energy.water.delete_water_source")}" @click="${this._deleteSource}" .path="${_}"></ha-icon-button> </div> `})} </div> `:""} <div class="row"> <ha-button @click="${this._addSource}" appearance="filled" size="small"> <ha-svg-icon slot="start" .path="${$}"></ha-svg-icon>${this.hass.localize("ui.panel.config.energy.water.add_water_source")}</ha-button> </div> </div> </ha-card> `}_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({...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:{...t},water_sources:this.preferences.energy_sources.filter(e=>"water"===e.type),saveCallback:async e=>{await this._savePreferences({...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({...this.preferences,energy_sources:this.preferences.energy_sources.filter(e=>e!==t)})}catch(e){(0,h.showAlertDialog)(this,{title:`Failed to save config: ${e.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,o.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"preferences",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"statsMetadata",void 0),(0,s.Cg)([(0,o.MZ)({attribute:!1})],w.prototype,"validationResult",void 0),w=(0,s.Cg)([(0,o.EM)("ha-energy-water-settings")],w),t()}catch(e){t(e)}})},6268(e,t,a){a.d(t,{X:()=>s});const s=a(5124).AH`.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(e,t,a){a.d(t,{D0:()=>i,YA:()=>l,YX:()=>c,m5:()=>o,r5:()=>d,se:()=>r,yH:()=>n});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(86359),a.e(26092),a.e(8851),a.e(54884),a.e(7673)]).then(a.bind(a,23800)),dialogParams:t})},o=(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(26092),a.e(8851),a.e(54884),a.e(6915),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(26092),a.e(8851),a.e(54884),a.e(16049)]).then(a.bind(a,94098)),dialogParams:t})},n=(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(58416),a.e(81034),a.e(98829),a.e(26092),a.e(8851),a.e(54884),a.e(98814)]).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(58416),a.e(81034),a.e(21210),a.e(26092),a.e(8851),a.e(54884),a.e(28280)]).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(63978),a.e(26092),a.e(8851),a.e(54884),a.e(72623)]).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(26092),a.e(8851),a.e(54884),a.e(6915),a.e(45078)]).then(a.bind(a,65941)),dialogParams:t})}},36918(e,t,a){a.d(t,{o:()=>s});const s=(e,t)=>`https://www.iobroker.net/#${e.language&&e.language.split("-")[0]||"en"}/adapters/adapterref/iobroker.lovelace/README.md#`}};