"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["86236"],{97431:function(e,s,t){t.a(e,async function(e,i){try{t.r(s),t.d(s,{EnergySetupWizard:function(){return W}});t(3362),t(62953);var n=t(40445),a=t(96196),r=t(77845),h=t(1087),p=t(38114),c=t(65063),o=t(14503),g=t(23206),_=t(76135),l=t(28166),u=t(54081),d=t(38726),f=t(70604),y=t(18350),$=e([g,_,l,u,d,f,y,p]);[g,_,l,u,d,f,y,p]=$.then?(await $)():$;let v,b,C,w,k,q,m,x,z,D,F,A,M=e=>e;class W extends a.WF{getCardSize(){return 10}setConfig(e){e.preferences&&(this._preferences=e.preferences)}firstUpdated(){this.hass.loadFragmentTranslation("config"),this._fetchconfig()}render(){return(0,a.qy)(v||(v=M` <p> ${0} </p> ${0} <div class="buttons"> ${0} ${0} </div> `),this.hass.localize("ui.panel.energy.setup.step",{step:this._step+1,steps:6}),0===this._step?(0,a.qy)(b||(b=M`<ha-energy-grid-settings .hass="${0}" .preferences="${0}" @value-changed="${0}"></ha-energy-grid-settings>`),this.hass,this._preferences,this._prefsChanged):1===this._step?(0,a.qy)(C||(C=M`<ha-energy-solar-settings .hass="${0}" .preferences="${0}" .info="${0}" @value-changed="${0}"></ha-energy-solar-settings>`),this.hass,this._preferences,this._info,this._prefsChanged):2===this._step?(0,a.qy)(w||(w=M`<ha-energy-battery-settings .hass="${0}" .preferences="${0}" @value-changed="${0}"></ha-energy-battery-settings>`),this.hass,this._preferences,this._prefsChanged):3===this._step?(0,a.qy)(k||(k=M`<ha-energy-gas-settings .hass="${0}" .preferences="${0}" @value-changed="${0}"></ha-energy-gas-settings>`),this.hass,this._preferences,this._prefsChanged):4===this._step?(0,a.qy)(q||(q=M`<ha-energy-water-settings .hass="${0}" .preferences="${0}" @value-changed="${0}"></ha-energy-water-settings>`),this.hass,this._preferences,this._prefsChanged):(0,a.qy)(m||(m=M`<ha-energy-device-settings .hass="${0}" .preferences="${0}" @value-changed="${0}"></ha-energy-device-settings>`),this.hass,this._preferences,this._prefsChanged),this._step>0?(0,a.qy)(x||(x=M`<ha-button appearance="plain" @click="${0}">${0}</ha-button>`),this._back,this.hass.localize("ui.panel.energy.setup.back")):(0,a.qy)(z||(z=M`<div></div>`)),this._step<4?(0,a.qy)(D||(D=M`<ha-button @click="${0}">${0}</ha-button>`),this._next,this.hass.localize("ui.panel.energy.setup.next")):(0,a.qy)(F||(F=M`<ha-button @click="${0}"> ${0} </ha-button>`),this._setupDone,this.hass.localize("ui.panel.energy.setup.done")))}async _fetchconfig(){this._info=await(0,p.BV)(this.hass)}_prefsChanged(e){this._preferences=e.detail.value}_back(){0!==this._step&&this._step--}_next(){5!==this._step&&this._step++}async _setupDone(){if(this._preferences)if(0!==this._preferences.device_consumption.length||0!==this._preferences.energy_sources.length){try{this._preferences=await(0,p.WN)(this.hass,this._preferences)}catch(e){(0,c.showAlertDialog)(this,{title:`Failed to save config: ${e.message}`})}(0,h.r)(this,"reload-energy-panel")}else(0,c.showAlertDialog)(this,{title:this.hass.localize("ui.panel.energy.setup.no_statistics_selected_title"),text:this.hass.localize("ui.panel.energy.setup.no_statistics_selected_description")})}static get styles(){return[o.RF,(0,a.AH)(A||(A=M`:host{display:block;padding:16px;max-width:700px;margin:0 auto}ha-button{margin-top:8px}.buttons{display:flex;justify-content:space-between}`))]}constructor(...e){super(...e),this._step=0,this._preferences={energy_sources:[],device_consumption:[],device_consumption_water:[]}}}(0,n.Cg)([(0,r.MZ)({attribute:!1})],W.prototype,"hass",void 0),(0,n.Cg)([(0,r.MZ)({attribute:!1})],W.prototype,"lovelace",void 0),(0,n.Cg)([(0,r.wk)()],W.prototype,"_info",void 0),(0,n.Cg)([(0,r.wk)()],W.prototype,"_step",void 0),(0,n.Cg)([(0,r.wk)()],W.prototype,"_preferences",void 0),W=(0,n.Cg)([(0,r.EM)("energy-setup-wizard-card")],W),i()}catch(v){i(v)}})}}]);
//# sourceMappingURL=86236.4976624fb4bcfdb1.js.map