export const __rspack_esm_id="81493";export const __rspack_esm_ids=["81493"];export const __webpack_modules__={44244(a,o,t){t.a(a,async function(a,s){try{t.r(o);var i=t(62826),e=t(96196),n=t(97735),r=t(1087),c=t(38962),l=t(18350),p=t(72554),d=(t(93444),t(91485)),h=t(31420),_=t(14503),g=t(63993),u=a([c,l,p,d,h,g]);[c,l,p,d,h,g]=u.then?(await u)():u;class y extends e.WF{showDialog(a){this._open=!0,this._params=a}closeDialog(){return this._open=!1,!0}_dialogClosed(){this._open&&(0,r.r)(this,"dialog-closed",{dialog:this.localName}),this._open=!1,this._params=void 0,this._encryptionKey="",this._error=""}render(){return this._params?e.qy` <ha-dialog .hass="${this.hass}" .open="${this._open}" header-title="${this.hass.localize("ui.panel.config.backup.dialogs.download.title")}" prevent-scrim-close @closed="${this._dialogClosed}"> <p> ${this.hass.localize("ui.panel.config.backup.dialogs.download.description")} </p> <p> ${this.hass.localize("ui.panel.config.backup.dialogs.download.download_backup_encrypted",{download_it_encrypted:e.qy`<button class="link" @click="${this._downloadEncrypted}"> ${this.hass.localize("ui.panel.config.backup.dialogs.download.download_it_encrypted")} </button>`})} </p> <ha-input type="password" password-toggle .label="${this.hass.localize("ui.panel.config.backup.dialogs.download.encryption_key")}" @input="${this._keyChanged}"></ha-input> ${this._error?e.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:e.s6} <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${this._cancel}"> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button slot="primaryAction" @click="${this._submit}"> ${this.hass.localize("ui.panel.config.backup.dialogs.download.download")} </ha-button> </ha-dialog-footer> </ha-dialog> `:e.s6}_cancel(){this.closeDialog()}async _submit(){if(""!==this._encryptionKey)try{await(0,h.Zm)(this.hass,this._params.backup.backup_id,this._agentId,this._encryptionKey),(0,g.s)(this.hass,this._params.backup.backup_id,this._agentId,this._encryptionKey),this.closeDialog()}catch(a){"password_incorrect"===a?.code?this._error=this.hass.localize("ui.panel.config.backup.dialogs.download.incorrect_encryption_key"):"decrypt_not_supported"===a?.code?this._error=this.hass.localize("ui.panel.config.backup.dialogs.download.decryption_not_supported"):alert(a.message)}}_keyChanged(a){this._encryptionKey=a.currentTarget.value,this._error=""}get _agentId(){return this._params?.agentId?this._params.agentId:(0,h.EB)(Object.keys(this._params.backup.agents))}async _downloadEncrypted(){(0,g.s)(this.hass,this._params.backup.backup_id,this._agentId),this.closeDialog()}static get styles(){return[_.RF,_.nA,e.AH`ha-dialog{--dialog-content-padding:var(--ha-space-2) var(--ha-space-6)}button.link{background:0 0;border:none;padding:0;font-size:var(--ha-font-size-m);color:var(--primary-color);text-decoration:underline;cursor:pointer}`]}constructor(...a){super(...a),this._open=!1,this._encryptionKey="",this._error=""}}(0,i.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_open",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_params",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_encryptionKey",void 0),(0,i.Cg)([(0,n.wk)()],y.prototype,"_error",void 0),y=(0,i.Cg)([(0,n.EM)("ha-dialog-download-decrypted-backup")],y),s()}catch(a){s(a)}})}};
//# sourceMappingURL=81493.c00395beddd6f985.js.map