mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-24 12:29:08 +00:00
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["1258"],{38506:function(e,t,i){i.a(e,(async function(e,a){try{i.r(t);var o=i(73577),s=(i(19083),i(71695),i(19423),i(40251),i(61006),i(47021),i(87319),i(57243)),n=i(50778),l=i(17803),r=i(36522),c=i(49976),d=i(34798),u=(i(51784),i(95198),i(29095),i(99426),i(59826),i(34273),i(19277),i(23043),i(43546)),h=i(39231),p=i(56785),g=i(76131),m=i(28008),_=i(59131),k=i(60501),v=e([k]);k=(v.then?(await v)():v)[0];let f,b,y,w,x,z,$=e=>e;const P="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",C="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";(0,o.Z)([(0,n.Mo)("dialog-hassio-backup")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_backup",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_dialogParams",value:void 0},{kind:"field",decorators:[(0,n.SB)()],key:"_restoringBackup",value(){return!1}},{kind:"field",decorators:[(0,n.IO)("supervisor-backup-content")],key:"_backupContent",value:void 0},{kind:"field",decorators:[(0,n.IO)("ha-md-dialog")],key:"_dialog",value:void 0},{kind:"method",key:"showDialog",value:async function(e){this._dialogParams=e,this._backup=await(0,h._P)(this.hass,e.slug),this._backup?this._dialogParams.onboarding&&!this._backup.homeassistant&&(this._error=this._localize("restore_no_home_assistant")):this._error=this._localize("no_backup_found"),this._restoringBackup=!1}},{kind:"method",key:"_dialogClosed",value:function(){this._backup=void 0,this._dialogParams=void 0,this._restoringBackup=!1,this._error=void 0,(0,r.B)(this,"dialog-closed",{dialog:this.localName})}},{kind:"method",key:"closeDialog",value:function(){var e;return null===(e=this._dialog)||void 0===e||e.close(),!0}},{kind:"method",key:"_localize",value:function(e){var t;return(null===(t=this._dialogParams.supervisor)||void 0===t?void 0:t.localize(`backup.${e}`))||this._dialogParams.localize(`ui.panel.page-onboarding.restore.${e}`)}},{kind:"method",key:"render",value:function(){return this._dialogParams&&this._backup?(0,s.dy)(f||(f=$` <ha-md-dialog open .disableCancelAction="${0}" @closed="${0}"> <ha-dialog-header slot="headline"> <ha-icon-button slot="navigationIcon" .label="${0}" .path="${0}" @click="${0}" .disabled="${0}"></ha-icon-button> <span slot="title" .title="${0}">${0}</span> ${0} </ha-dialog-header> <div slot="content"> ${0} </div> <div slot="actions"> <ha-button .disabled="${0}" @click="${0}"> ${0} </ha-button> </div> </ha-md-dialog> `),!this._error,this._dialogClosed,this._localize("close"),P,this.closeDialog,this._restoringBackup,this._backup.name,this._backup.name,!this._dialogParams.onboarding&&this._dialogParams.supervisor?(0,s.dy)(b||(b=$`<ha-button-menu slot="actionItems" fixed @action="${0}" @closed="${0}"> <ha-icon-button .label="${0}" .path="${0}" slot="trigger"></ha-icon-button> <mwc-list-item>${0}</mwc-list-item> <mwc-list-item class="error">${0}</mwc-list-item> </ha-button-menu>`),this._handleMenuAction,c.U,this._dialogParams.supervisor.localize("backup.more_actions"),C,this._dialogParams.supervisor.localize("backup.download_backup"),this._dialogParams.supervisor.localize("backup.delete_backup_title")):s.Ld,this._error?(0,s.dy)(y||(y=$`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):this._restoringBackup?(0,s.dy)(w||(w=$`<div class="loading"> <ha-circular-progress indeterminate></ha-circular-progress> </div>`)):(0,s.dy)(x||(x=$` <supervisor-backup-content .hass="${0}" .supervisor="${0}" .backup="${0}" .onboarding="${0}" .localize="${0}" dialogInitialFocus> </supervisor-backup-content> `),this.hass,this._dialogParams.supervisor,this._backup,this._dialogParams.onboarding||!1,this._dialogParams.localize),this._restoringBackup||!!this._error,this._restoreClicked,this._localize("restore")):s.Ld}},{kind:"method",key:"_handleMenuAction",value:function(e){switch(e.detail.index){case 0:this._downloadClicked();break;case 1:this._deleteClicked()}}},{kind:"method",key:"_restoreClicked",value:async function(){var e;const t=this._backupContent.backupDetails();this._restoringBackup=!0;const i=null===(e=this._dialogParams)||void 0===e?void 0:e.supervisor;if(void 0!==i&&"running"!==i.info.state)return await(0,g.Ys)(this,{title:i.localize("backup.could_not_restore"),text:i.localize("backup.restore_blocked_not_running",{state:i.info.state})}),void(this._restoringBackup=!1);if(await(0,g.g7)(this,{title:this._localize("full"===this._backup.type?"confirm_restore_full_backup_title":"confirm_restore_partial_backup_title"),text:this._localize("full"===this._backup.type?"confirm_restore_full_backup_text":"confirm_restore_partial_backup_text"),confirmText:this._localize("restore"),dismissText:this._localize("cancel")}))try{var a,o,s;await(0,h.pi)(this.hass,this._backup.type,this._backup.slug,Object.assign(Object.assign({},t),{},{background:null===(a=this._dialogParams)||void 0===a?void 0:a.onboarding}),!!this.hass&&(0,l.I)(this.hass.config.version,2021,9)),null===(o=this._dialogParams)||void 0===o||null===(s=o.onRestoring)||void 0===s||s.call(o),this.closeDialog()}catch(r){var n;this._error=(null==r||null===(n=r.body)||void 0===n?void 0:n.message)||this._localize("restore_start_failed")}finally{this._restoringBackup=!1}else this._restoringBackup=!1}},{kind:"method",key:"_deleteClicked",value:async function(){var e;const t=null===(e=this._dialogParams)||void 0===e?void 0:e.supervisor;if(t&&await(0,g.g7)(this,{title:t.localize("backup.confirm_delete_title"),text:t.localize("backup.confirm_delete_text"),confirmText:t.localize("backup.delete"),dismissText:t.localize("backup.cancel"),destructive:!0}))try{await(0,h.FZ)(this.hass,this._backup.slug),this._dialogParams.onDelete&&this._dialogParams.onDelete(),this.closeDialog()}catch(i){this._error=i.body.message}}},{kind:"method",key:"_downloadClicked",value:async function(){var e;const t=null===(e=this._dialogParams)||void 0===e?void 0:e.supervisor;if(!t)return;let i;try{i=await(0,u.iI)(this.hass,`/api/hassio/${(0,l.I)(this.hass.config.version,2021,9)?"backups":"snapshots"}/${this._backup.slug}/download`)}catch(a){return void(await(0,g.Ys)(this,{text:(0,p.js)(a)}))}if(window.location.href.includes("ui.nabu.casa")){if(!(await(0,g.g7)(this,{title:t.localize("backup.remote_download_title"),text:t.localize("backup.remote_download_text"),confirmText:t.localize("backup.download"),dismissText:this._localize("cancel")})))return}(0,_.N)(i.path,`home_assistant_backup_${(0,d.l)(this._computeName)}.tar`)}},{kind:"get",key:"_computeName",value:function(){return this._backup?this._backup.name||this._backup.slug:this._localize("unnamed_backup")}},{kind:"get",static:!0,key:"styles",value:function(){return[m.Qx,m.yu,(0,s.iv)(z||(z=$`ha-circular-progress{display:block;text-align:center}ha-header-bar{--mdc-theme-on-primary:var(--primary-text-color);--mdc-theme-primary:var(--mdc-theme-surface);flex-shrink:0;display:block}ha-icon-button{color:var(--secondary-text-color)}.loading{width:100%;display:flex;height:100%;justify-content:center;align-items:center}`))]}}]}}),s.oi);a()}catch(f){a(f)}}))},49976:function(e,t,i){i.d(t,{U:()=>a});const a=e=>e.stopPropagation()},34798:function(e,t,i){i.d(t,{l:()=>a});i(69235),i(12385),i(19134),i(11740),i(97003);const a=(e,t="_")=>{const i="àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìıİłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·",a=`aaaaaaaaaacccddeeeeeeeegghiiiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz${t}`,o=new RegExp(i.split("").join("|"),"g");let s;return""===e?s="":(s=e.toString().toLowerCase().replace(o,(e=>a.charAt(i.indexOf(e)))).replace(/(\d),(?=\d)/g,"$1").replace(/[^a-z0-9]+/g,t).replace(new RegExp(`(${t})\\1+`,"g"),"$1").replace(new RegExp(`^${t}+`),"").replace(new RegExp(`${t}+$`),""),""===s&&(s="unknown")),s}},51784:function(e,t,i){var a=i(73577),o=i(72621),s=(i(52247),i(71695),i(19423),i(40251),i(47021),i(67840)),n=i(88854),l=i(57243),r=i(50778);let c,d,u=e=>e;s.A.addInitializer((async e=>{await e.updateComplete;const t=e;t.dialog.prepend(t.scrim),t.scrim.style.inset=0,t.scrim.style.zIndex=0;const{getOpenAnimation:i,getCloseAnimation:a}=t;t.getOpenAnimation=()=>{var e,t;const a=i.call(void 0);return a.container=[...null!==(e=a.container)&&void 0!==e?e:[],...null!==(t=a.dialog)&&void 0!==t?t:[]],a.dialog=[],a},t.getCloseAnimation=()=>{var e,t;const i=a.call(void 0);return i.container=[...null!==(e=i.container)&&void 0!==e?e:[],...null!==(t=i.dialog)&&void 0!==t?t:[]],i.dialog=[],i}}));(0,a.Z)([(0,r.Mo)("ha-md-dialog")],(function(e,t){class a extends t{constructor(){super(),e(this),this.addEventListener("cancel",this._handleCancel),"function"!=typeof HTMLDialogElement&&(this.addEventListener("open",this._handleOpen),d||(d=i.e("3854").then(i.bind(i,85893)))),void 0===this.animate&&(this.quick=!0),void 0===this.animate&&(this.quick=!0)}}return{F:a,d:[{kind:"field",decorators:[(0,r.Cb)({attribute:"disable-cancel-action",type:Boolean})],key:"disableCancelAction",value(){return!1}},{kind:"field",key:"_polyfillDialogRegistered",value(){return!1}},{kind:"method",key:"_handleOpen",value:async function(e){var t;if(e.preventDefault(),this._polyfillDialogRegistered)return;this._polyfillDialogRegistered=!0,this._loadPolyfillStylesheet("/static/polyfills/dialog-polyfill.css");const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("dialog");(await d).default.registerDialog(i),this.removeEventListener("open",this._handleOpen),this.show()}},{kind:"method",key:"_loadPolyfillStylesheet",value:async function(e){const t=document.createElement("link");return t.rel="stylesheet",t.href=e,new Promise(((i,a)=>{var o;t.onload=()=>i(),t.onerror=()=>a(new Error(`Stylesheet failed to load: ${e}`)),null===(o=this.shadowRoot)||void 0===o||o.appendChild(t)}))}},{kind:"method",key:"_handleCancel",value:function(e){if(this.disableCancelAction){var t;e.preventDefault();const i=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("dialog .container");void 0!==this.animate&&(null==i||i.animate([{transform:"rotate(-1deg)","animation-timing-function":"ease-in"},{transform:"rotate(1.5deg)","animation-timing-function":"ease-out"},{transform:"rotate(0deg)","animation-timing-function":"ease-in"}],{duration:200,iterations:2}))}}},{kind:"field",static:!0,key:"styles",value(){return[...(0,o.Z)(a,"styles",this),(0,l.iv)(c||(c=u`:host{--md-dialog-container-color:var(--card-background-color);--md-dialog-headline-color:var(--primary-text-color);--md-dialog-supporting-text-color:var(--primary-text-color);--md-sys-color-scrim:#000000;--md-dialog-headline-weight:400;--md-dialog-headline-size:1.574rem;--md-dialog-supporting-text-size:1rem;--md-dialog-supporting-text-line-height:1.5rem}:host([type=alert]){min-width:320px}@media all and (max-width:450px),all and (max-height:500px){:host(:not([type=alert])){min-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));max-width:calc(100vw - env(safe-area-inset-right) - env(safe-area-inset-left));min-height:100%;max-height:100%;--md-dialog-container-shape:0}}::slotted(ha-dialog-header[slot=headline]){display:contents}.scroller{overflow:var(--dialog-content-overflow,auto)}slot[name=content]::slotted(*){padding:var(--dialog-content-padding,24px)}.scrim{z-index:10}`))]}}]}}),s.A);Object.assign(Object.assign({},n.I),{},{dialog:[[[{transform:"translateY(50px)"},{transform:"translateY(0)"}],{duration:500,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:0},{opacity:1}],{duration:50,easing:"linear",pseudoElement:"::before"}]]}),Object.assign(Object.assign({},n.G),{},{dialog:[[[{transform:"translateY(0)"},{transform:"translateY(50px)"}],{duration:150,easing:"cubic-bezier(.3,0,0,1)"}]],container:[[[{opacity:"1"},{opacity:"0"}],{delay:100,duration:50,easing:"linear",pseudoElement:"::before"}]]})},43546:function(e,t,i){i.d(t,{iI:()=>o,oT:()=>a});i(19083),i(77439),i(19423),i(40251),i(97499),i(61006),i(13334);const a=e=>e.map((e=>{if("string"!==e.type)return e;switch(e.name){case"username":return Object.assign(Object.assign({},e),{},{autocomplete:"username",autofocus:!0});case"password":return Object.assign(Object.assign({},e),{},{autocomplete:"current-password"});case"code":return Object.assign(Object.assign({},e),{},{autocomplete:"one-time-code",autofocus:!0});default:return e}})),o=(e,t)=>e.callWS({type:"auth/sign_path",path:t})},59131:function(e,t,i){i.d(t,{N:()=>o,G:()=>s});i(19134),i(5740);const a=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),o=(e,t="")=>{const i=document.createElement("a");i.target="_blank",i.href=e,i.download=t,i.style.display="none",document.body.appendChild(i),i.dispatchEvent(new MouseEvent("click")),document.body.removeChild(i)},s=e=>{var t;return!(e=>!!e.auth.external&&a)(e)||!(null===(t=e.auth.external)||void 0===t||!t.config.downloadFileSupported)}}}]);
|
|
//# sourceMappingURL=1258.bb6811ca0567a5d6.js.map
|