export const __rspack_esm_id=43421;export const __rspack_esm_ids=[43421];export const __webpack_modules__={22060(t,e,a){a.a(t,async function(t,o){try{a.r(e);var i=a(15697),s=a(57527),l=a(79224),d=a(5455),h=a(148),n=a(98747),r=(a(90507),a(73651)),g=a(8146),c=(a(20688),a(63047)),_=a(19157),p=a(76730),m=a(34570),u=a(89579),y=a(30339),C=t([n,r,g,c,y]);[n,r,g,c,y]=C.then?(await C)():C;const v="M12,15C7.58,15 4,16.79 4,19V21H20V19C20,16.79 16.42,15 12,15M8,9A4,4 0 0,0 12,13A4,4 0 0,0 16,9M11.5,2C11.2,2 11,2.21 11,2.5V5.5H10V3C10,3 7.75,3.86 7.75,6.75C7.75,6.75 7,6.89 7,8H17C16.95,6.89 16.25,6.75 16.25,6.75C16.25,3.86 14,3 14,3V5.5H13V2.5C13,2.21 12.81,2 12.5,2H11.5Z",A="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",b="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 f extends((0,_.U)()(s.WF)){async showDialog(t){this._params=t,this._strategyConfig=t.config.strategy,this._open=!0,this._initDirtyTracking({type:"deep"},this._strategyConfig),await this.updateComplete}closeDialog(){this._open=!1}_dialogClosed(){this._params=void 0,this._strategyConfig=void 0,this._guiModeAvailable=!0,this._GUImode=!0,(0,h.r)(this,"dialog-closed",{dialog:this.localName})}_handleConfigChanged(t){t.stopPropagation(),this._guiModeAvailable=t.detail.guiModeAvailable,this._strategyConfig=t.detail.config,this._updateDirtyState(this._strategyConfig)}_handleGUIModeChanged(t){t.stopPropagation(),this._GUImode=t.detail.guiMode,this._guiModeAvailable=t.detail.guiModeAvailable}async _save(){await this._params.saveConfig({...this._params.config,strategy:this._strategyConfig}),(0,m.f)(this,this.hass),this._markDirtyStateClean(),this.closeDialog()}async _delete(t){t.stopPropagation(),await this._params.deleteDashboard()&&this.closeDialog()}_cancel(t){t.stopPropagation(),this.closeDialog()}_handleAction(t){const e=t.detail.item.value;if(e)switch(e){case"toggle-mode":this._toggleMode();break;case"take-control":this._takeControl()}}_toggleMode(){this._strategyEditorEl?.toggleMode()}_takeControl(){this._params.takeControl(),this.closeDialog()}render(){if(!this._params||!this._strategyConfig)return s.s6;const t=(0,u._V)(this._strategyConfig),e=this.hass.localize("ui.panel.lovelace.editor.strategy-editor.header");return s.qy` <ha-dialog .open=${this._open} .preventScrimClose=${this.isDirtyState} header-title=${e||"-"} header-subtitle=${(0,d.J)(this._params.title)} width="large" @closed=${this._dialogClosed}> <ha-dropdown placement="bottom-end" slot="headerActionItems" @wa-select=${this._handleAction}> <ha-icon-button slot="trigger" .label=${this.hass.localize("ui.common.menu")} .path=${A}></ha-icon-button> <ha-dropdown-item value="toggle-mode" .disabled=${!this._guiModeAvailable&&!this._GUImode}> ${this.hass.localize("ui.panel.lovelace.editor.edit_view.edit_"+(this._GUImode?"yaml":"ui"))} <ha-svg-icon slot="icon" .path=${b}></ha-svg-icon> </ha-dropdown-item> <ha-dropdown-item value="take-control"> ${this.hass.localize("ui.panel.lovelace.editor.strategy-editor.take_control")} <ha-svg-icon slot="icon" .path=${v}></ha-svg-icon> </ha-dropdown-item> </ha-dropdown> <div class="content"> <hui-dashboard-strategy-element-editor .hass=${this.hass} .lovelace=${this._params.config} .value=${t} @config-changed=${this._handleConfigChanged} @GUImode-changed=${this._handleGUIModeChanged} autofocus></hui-dashboard-strategy-element-editor> </div> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" variant="danger" appearance="plain" @click=${this._delete}> ${this.hass.localize("ui.common.delete")} </ha-button> <ha-button slot="secondaryAction" appearance="plain" @click=${this._cancel}> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button slot="primaryAction" @click=${this._save} ?disabled=${!this.isDirtyState}> ${this.hass.localize("ui.common.save")} </ha-button> </ha-dialog-footer> </ha-dialog> `}static get styles(){return[p.nA,p.kO,s.AH`ha-dialog{--dialog-content-padding:0 24px}`]}constructor(...t){super(...t),this._GUImode=!0,this._guiModeAvailable=!0,this._open=!1}}(0,i.Cg)([(0,l.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,i.Cg)([(0,l.wk)()],f.prototype,"_params",void 0),(0,i.Cg)([(0,l.wk)()],f.prototype,"_strategyConfig",void 0),(0,i.Cg)([(0,l.wk)()],f.prototype,"_GUImode",void 0),(0,i.Cg)([(0,l.wk)()],f.prototype,"_guiModeAvailable",void 0),(0,i.Cg)([(0,l.wk)()],f.prototype,"_open",void 0),(0,i.Cg)([(0,l.P)("hui-dashboard-strategy-element-editor")],f.prototype,"_strategyEditorEl",void 0),f=(0,i.Cg)([(0,l.EM)("dialog-dashboard-strategy-editor")],f),o()}catch(t){o(t)}})},34570(t,e,a){var o=a(95678);a.d(e,{},{f:(t,e)=>(0,o.P)(t,{message:e.localize("ui.common.successfully_saved")})})}};
//# sourceMappingURL=43421.4fdca67de0de7e82.js.map