export const __rspack_esm_id="42364";export const __rspack_esm_ids=["42364"];export const __webpack_modules__={94039(t,i,o){o.a(t,async function(t,e){try{o.r(i),o.d(i,{HuiDialogEditViewFooter:()=>w});var a=o(62826),s=o(96196),h=o(97735),n=o(1087),d=o(19459),l=o(18350),r=o(72554),c=(o(93444),o(29823)),_=(o(70947),o(65829)),g=o(10763),m=o(65063),p=o(14503),u=o(15401),v=t([l,r,c,_,g,u]);[l,r,c,_,g,u]=v.then?(await v)():v;const f="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",y="M3 6V8H14V6H3M3 10V12H14V10H3M20 10.1C19.9 10.1 19.7 10.2 19.6 10.3L18.6 11.3L20.7 13.4L21.7 12.4C21.9 12.2 21.9 11.8 21.7 11.6L20.4 10.3C20.3 10.2 20.2 10.1 20 10.1M18.1 11.9L12 17.9V20H14.1L20.2 13.9L18.1 11.9M3 14V16H10V14H3Z";class w extends s.WF{updated(t){if(this._yamlMode&&t.has("_yamlMode")){const t={...this._config};this._editor?.setValue(t)}}showDialog(t){this._params=t,this._dirty=!1,this._config=this._params.config,this._open=!0}closeDialog(){this._open=!1}_dialogClosed(){this._params=void 0,this._config=void 0,this._yamlMode=!1,this._dirty=!1,this._saving=!1,(0,n.r)(this,"dialog-closed",{dialog:this.localName})}render(){if(!this._params||!this.hass)return s.s6;let t;t=this._yamlMode?s.qy` <ha-yaml-editor .hass="${this.hass}" autofocus @value-changed="${this._viewYamlChanged}"></ha-yaml-editor> `:s.qy` <hui-view-footer-settings-editor .hass="${this.hass}" .config="${this._config}" @config-changed="${this._configChanged}"></hui-view-footer-settings-editor> `;const i=this.hass.localize("ui.panel.lovelace.editor.edit_view_footer.header");return s.qy` <ha-dialog .hass="${this.hass}" .open="${this._open}" header-title="${i}" width="medium" @closed="${this._dialogClosed}" class="${this._yamlMode?"yaml-mode":""}"> <ha-dropdown slot="headerActionItems" placement="bottom-end" @wa-select="${this._handleAction}"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${f}"></ha-icon-button> <ha-dropdown-item value="toggle-mode"> ${this.hass.localize("ui.panel.lovelace.editor.edit_view_footer.edit_"+(this._yamlMode?"ui":"yaml"))} <ha-svg-icon slot="icon" .path="${y}"></ha-svg-icon> </ha-dropdown-item> </ha-dropdown> ${t} <ha-dialog-footer slot="footer"> <ha-button slot="primaryAction" .disabled="${!this._config||!this._dirty}" @click="${this._save}" .loading="${this._saving}"> ${this.hass.localize("ui.common.save")}</ha-button> </ha-dialog-footer> </ha-dialog> `}async _handleAction(t){"toggle-mode"===t.detail.item.value&&(this._yamlMode=!this._yamlMode)}_configChanged(t){t.detail&&t.detail.config&&!(0,d.b)(this._config,t.detail.config)&&(this._config=t.detail.config,this._dirty=!0)}_viewYamlChanged(t){t.stopPropagation(),t.detail.isValid&&(this._config=t.detail.value,this._dirty=!0)}async _save(){if(this._params&&this._config){this._saving=!0;try{await this._params.saveConfig(this._config),this.closeDialog()}catch(t){(0,m.showAlertDialog)(this,{text:`${this.hass.localize("ui.panel.lovelace.editor.edit_view_footer.saving_failed")}: ${t.message}`})}finally{this._saving=!1}}}static get styles(){return[p.nA,p.kO,s.AH`ha-dialog.yaml-mode{--dialog-content-padding:0}`]}constructor(...t){super(...t),this._saving=!1,this._dirty=!1,this._yamlMode=!1,this._open=!1}}(0,a.Cg)([(0,h.MZ)({attribute:!1})],w.prototype,"hass",void 0),(0,a.Cg)([(0,h.wk)()],w.prototype,"_params",void 0),(0,a.Cg)([(0,h.wk)()],w.prototype,"_config",void 0),(0,a.Cg)([(0,h.wk)()],w.prototype,"_saving",void 0),(0,a.Cg)([(0,h.wk)()],w.prototype,"_dirty",void 0),(0,a.Cg)([(0,h.wk)()],w.prototype,"_yamlMode",void 0),(0,a.Cg)([(0,h.P)("ha-yaml-editor")],w.prototype,"_editor",void 0),(0,a.Cg)([(0,h.wk)()],w.prototype,"_open",void 0),w=(0,a.Cg)([(0,h.EM)("hui-dialog-edit-view-footer")],w),e()}catch(t){e(t)}})},15401(t,i,o){o.a(t,async function(t,i){try{var e=o(62826),a=o(96196),s=o(97735),h=o(1087),n=o(52763),d=t([n]);n=(d.then?(await d)():d)[0];const l=[{name:"max_width",selector:{number:{min:100,max:1600,step:10,unit_of_measurement:"px"}}}];class r extends a.WF{render(){const t={max_width:this.config?.max_width||600};return a.qy` <ha-form .hass="${this.hass}" .data="${t}" .schema="${l}" .computeLabel="${this._computeLabel}" @value-changed="${this._valueChanged}"></ha-form> `}_valueChanged(t){t.stopPropagation();const i=t.detail.value,o={...this.config,...i};(0,h.r)(this,"config-changed",{config:o})}constructor(...t){super(...t),this._computeLabel=t=>this.hass.localize(`ui.panel.lovelace.editor.edit_view_footer.settings.${t.name}`)}}(0,e.Cg)([(0,s.MZ)({attribute:!1})],r.prototype,"hass",void 0),(0,e.Cg)([(0,s.MZ)({attribute:!1})],r.prototype,"config",void 0),r=(0,e.Cg)([(0,s.EM)("hui-view-footer-settings-editor")],r),i()}catch(t){i(t)}})}};
//# sourceMappingURL=42364.dc15f3ba1674842e.js.map