export const __rspack_esm_id="35131";export const __rspack_esm_ids=["35131"];export const __webpack_modules__={72406(a,s,t){t.a(a,async function(a,o){try{t.r(s),t.d(s,{HuiDialogSelectDashboard:()=>u});t(18111),t(61701);var e=t(62826),i=t(96196),l=t(97735),h=t(1087),r=t(18350),d=(t(93444),t(606)),c=t(65829),_=t(72554),n=t(71730),p=t(99774),g=t(65063),v=t(14503),b=a([r,d,c,_]);[r,d,c,_]=b.then?(await b)():b;class u extends i.WF{showDialog(a){this._config=a.lovelaceConfig,this._fromUrlPath=a.urlPath,this._params=a,this._open=!0,this._getDashboards()}closeDialog(){this._open&&(0,h.r)(this,"dialog-closed",{dialog:this.localName}),this._saving=!1,this._dashboards=void 0,this._toUrlPath=void 0,this._open=!1,this._params=void 0}_dialogClosed(){this.closeDialog()}render(){if(!this._params)return i.s6;const a=this._params.header||this.hass.localize("ui.panel.lovelace.editor.select_dashboard.header");return i.qy` <ha-dialog .hass="${this.hass}" .open="${this._open}" header-title="${a}" .preventScrimClose="${this._saving}" @closed="${this._dialogClosed}"> ${this._dashboards&&!this._saving?i.qy` <ha-select .label="${this.hass.localize("ui.panel.lovelace.editor.select_view.dashboard_label")}" @selected="${this._dashboardChanged}" .value="${this._toUrlPath||""}" .options="${this._dashboards.map(a=>({value:a.url_path,label:a.title,disabled:"storage"!==a.mode||a.url_path===this._fromUrlPath||"lovelace"===a.url_path&&null===this._fromUrlPath}))}"></ha-select> `:i.qy`<div class="loading"> <ha-spinner size="medium"></ha-spinner> </div>`} <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${this.closeDialog}" .disabled="${this._saving}"> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button slot="primaryAction" @click="${this._selectDashboard}" .disabled="${!this._config||this._fromUrlPath===this._toUrlPath||this._saving}"> ${this._params.actionLabel||this.hass.localize("ui.common.move")} </ha-button> </ha-dialog-footer> </ha-dialog> `}async _getDashboards(){let a=this._params.dashboards;if(!a)try{a=await(0,n.SJ)(this.hass)}catch(a){console.error("Error fetching dashboards:",a),(0,g.showAlertDialog)(this,{title:this.hass.localize("ui.panel.lovelace.editor.select_dashboard.error_title"),text:this.hass.localize("ui.panel.lovelace.editor.select_dashboard.error_text")})}this._dashboards=[{id:"lovelace",url_path:"lovelace",require_admin:!1,show_in_sidebar:!0,title:this.hass.localize("ui.common.default"),mode:this.hass.panels.lovelace?.config?.mode},...a??[]];const s=(0,p.EN)(this.hass),t=this._fromUrlPath||s;for(const a of this._dashboards)if(a.url_path!==t){this._toUrlPath=a.url_path;break}}async _dashboardChanged(a){const s=a.detail.value;s!==this._toUrlPath&&(this._toUrlPath=s)}async _selectDashboard(){this._saving=!0,"lovelace"===this._toUrlPath&&(this._toUrlPath=null),this._params.dashboardSelectedCallback(this._toUrlPath),this.closeDialog()}static get styles(){return[v.nA,i.AH`ha-select{width:100%}.loading{display:flex;justify-content:center}`]}constructor(...a){super(...a),this._saving=!1,this._open=!1}}(0,e.Cg)([(0,l.wk)()],u.prototype,"_params",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_dashboards",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_fromUrlPath",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_toUrlPath",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_config",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_saving",void 0),(0,e.Cg)([(0,l.wk)()],u.prototype,"_open",void 0),u=(0,e.Cg)([(0,l.EM)("hui-dialog-select-dashboard")],u),o()}catch(a){o(a)}})}};
//# sourceMappingURL=35131.8d20f537f097b17f.js.map