"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["5217"],{35560:function(a,t,s){s.a(a,async function(a,i){try{s.r(t);s(35748),s(5934),s(95013);var r=s(69868),o=s(84922),e=s(11991),c=s(44017),n=(s(94124),s(17372)),l=s(96635),h=s(68940),p=s(78698),u=s(63625),_=s(15241),d=s(50809),g=s(10637),k=a([n,l,g]);[n,l,g]=k.then?(await k)():k;let v,b,m,w,y,P=a=>a;class f extends o.WF{showDialog(a){this._dialogParams=a,this._creatingBackup=!1}closeDialog(){this._dialogParams=void 0,this._creatingBackup=!1,this._error=void 0,(0,c.r)(this,"dialog-closed",{dialog:this.localName})}render(){return this._dialogParams?(0,o.qy)(v||(v=P` <ha-dialog open scrimClickAction @closed="${0}" .heading="${0}"> ${0} ${0} <ha-button appearance="plain" slot="secondaryAction" @click="${0}"> ${0} </ha-button> <ha-button .disabled="${0}" slot="primaryAction" @click="${0}"> ${0} </ha-button> </ha-dialog> `),this.closeDialog,(0,h.l)(this.hass,this._dialogParams.supervisor.localize("backup.create_backup")),this._creatingBackup?(0,o.qy)(b||(b=P`<ha-spinner></ha-spinner>`)):(0,o.qy)(m||(m=P`<supervisor-backup-content .hass="${0}" .supervisor="${0}" dialogInitialFocus> </supervisor-backup-content>`),this.hass,this._dialogParams.supervisor),this._error?(0,o.qy)(w||(w=P`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):"",this.closeDialog,this._dialogParams.supervisor.localize("common.close"),this._creatingBackup,this._createBackup,this._dialogParams.supervisor.localize("backup.create")):o.s6}async _createBackup(){if("running"!==this._dialogParams.supervisor.info.state)return void(0,_.K$)(this,{title:this._dialogParams.supervisor.localize("backup.could_not_create"),text:this._dialogParams.supervisor.localize("backup.create_blocked_not_running",{state:this._dialogParams.supervisor.info.state})});const a=this._backupContent.backupDetails();if(this._creatingBackup=!0,this._error="",a.password&&!a.password.length)return this._error=this._dialogParams.supervisor.localize("backup.enter_password"),void(this._creatingBackup=!1);if(a.password&&a.password!==a.confirm_password)return this._error=this._dialogParams.supervisor.localize("backup.passwords_not_matching"),void(this._creatingBackup=!1);delete a.confirm_password;try{"full"===this._backupContent.backupType?await(0,p.Tw)(this.hass,a):await(0,p.Di)(this.hass,a),this._dialogParams.onCreate(),this.closeDialog()}catch(t){this._error=(0,u.VR)(t)}this._creatingBackup=!1}static get styles(){return[d.RF,d.nA,(0,o.AH)(y||(y=P`:host{direction:var(--direction)}`))]}constructor(...a){super(...a),this._creatingBackup=!1}}(0,r.__decorate)([(0,e.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,r.__decorate)([(0,e.wk)()],f.prototype,"_dialogParams",void 0),(0,r.__decorate)([(0,e.wk)()],f.prototype,"_error",void 0),(0,r.__decorate)([(0,e.wk)()],f.prototype,"_creatingBackup",void 0),(0,r.__decorate)([(0,e.P)("supervisor-backup-content")],f.prototype,"_backupContent",void 0),f=(0,r.__decorate)([(0,e.EM)("dialog-hassio-create-backup")],f),i()}catch(v){i(v)}})}}]);
//# sourceMappingURL=5217.d807e85af424b3dd.js.map