export const __rspack_esm_id="87980";export const __rspack_esm_ids=["87980"];export const __webpack_modules__={24519(a,o,e){e.a(a,async function(a,i){try{e.r(o),e.d(o,{HuiSaveConfig:()=>u});var t=e(62826),s=e(96196),l=e(97735),h=e(1087),n=e(18350),c=e(72554),r=(e(93444),e(6),e(26300)),p=(e(59646),e(10763)),g=e(14503),d=e(36918),_=e(93275),v=a([n,c,r,p]);[n,c,r,p]=v.then?(await v)():v;const f="M11,18H13V16H11V18M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,6A4,4 0 0,0 8,10H10A2,2 0 0,1 12,8A2,2 0 0,1 14,10C14,12 11,11.75 11,15H13C13,12.75 16,12.5 16,10A4,4 0 0,0 12,6Z",m={views:[{title:"Home"}]};class u extends s.WF{showDialog(a){this._params=a,this._emptyConfig=!1,this._open=!0}closeDialog(){return this._open=!1,!0}_dialogClosed(){this._params=void 0,(0,h.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params)return s.s6;const a=this.hass.localize("ui.panel.lovelace.editor.save_config.header");return s.qy` <ha-dialog .hass="${this.hass}" .open="${this._open}" header-title="${a}" prevent-scrim-close @closed="${this._dialogClosed}"> <ha-icon-button .path="${f}" .label="${this.hass.localize("ui.common.help")}" .href="${(0,d.o)(this.hass,"/lovelace/")}" title="${this.hass.localize("ui.panel.lovelace.menu.help")}" target="_blank" rel="noreferrer" slot="headerActionItems"></ha-icon-button>  <div> <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.para")} </p> ${"storage"===this._params.mode?s.qy` <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.para_sure")} </p> <ha-formfield .label="${this.hass.localize("ui.panel.lovelace.editor.save_config.empty_config")}"> <ha-switch .checked="${this._emptyConfig}" @change="${this._emptyConfigChanged}" autofocus></ha-switch></ha-formfield> `:s.qy` <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.yaml_mode")} </p> <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.yaml_control")} </p> <p> ${this.hass.localize("ui.panel.lovelace.editor.save_config.yaml_config")} </p> <ha-yaml-editor .hass="${this.hass}" .defaultValue="${this._params.lovelace.config}" autofocus></ha-yaml-editor> `} </div> ${"storage"===this._params.mode?s.qy` <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${this.closeDialog}"> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button slot="primaryAction" @click="${this._saveConfig}" .loading="${this._saving}"> ${this.hass.localize("ui.panel.lovelace.editor.save_config.save")} </ha-button> </ha-dialog-footer> `:s.qy` <ha-dialog-footer slot="footer"> <ha-button slot="primaryAction" @click="${this.closeDialog}"> ${this.hass.localize("ui.panel.lovelace.editor.save_config.close")} </ha-button> </ha-dialog-footer> `} </ha-dialog> `}_emptyConfigChanged(a){this._emptyConfig=a.target.checked}async _saveConfig(){if(this.hass&&this._params){this._saving=!0;try{const a=this._params.lovelace;await a.saveConfig(this._emptyConfig?m:await(0,_.d4)(a.config,this.hass)),a.setEditMode(!0),this._saving=!1,this.closeDialog()}catch(a){alert(`Saving failed: ${a.message}`),this._saving=!1}}}static get styles(){return[g.nA,s.AH`ha-dialog{--dialog-content-padding:0 24px 24px 24px}ha-dialog ha-icon-button[slot=headerActionItems]{color:var(--secondary-text-color)}`]}constructor(){super(),this._emptyConfig=!1,this._open=!1,this._saving=!1}}(0,t.Cg)([(0,l.MZ)({attribute:!1})],u.prototype,"hass",void 0),(0,t.Cg)([(0,l.wk)()],u.prototype,"_params",void 0),(0,t.Cg)([(0,l.wk)()],u.prototype,"_emptyConfig",void 0),(0,t.Cg)([(0,l.wk)()],u.prototype,"_saving",void 0),(0,t.Cg)([(0,l.wk)()],u.prototype,"_open",void 0),u=(0,t.Cg)([(0,l.EM)("hui-dialog-save-config")],u),i()}catch(a){i(a)}})}};
//# sourceMappingURL=87980.cd641815ed33e9bc.js.map