iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
25 lines • 54.9 kB
JavaScript
"use strict";(self.rspackChunkhome_assistant_frontend=self.rspackChunkhome_assistant_frontend||[]).push([[22311],{80785:function(e,t,a){function o(e){return!!e&&(e instanceof Date&&!isNaN(e.valueOf()))}a.d(t,{A:function(){return o}})},72487:function(e,t,a){a.a(e,async function(e,o){try{a.d(t,{CA:function(){return x},Mi:function(){return L},Pm:function(){return $},Wq:function(){return v},Yq:function(){return l},bl:function(){return V},c2:function(){return k},fr:function(){return _},gu:function(){return A},kz:function(){return u},m9:function(){return S},sl:function(){return m},ur:function(){return Z},zB:function(){return p}});a(18111),a(20116);var n=a(74487),i=a(22786),r=a(46927),s=a(8480),c=e([n,s]);[n,s]=c.then?(await c)():c;(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",month:"long",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)}));const l=(e,t,a)=>d(t,a.time_zone).format(e),d=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),u=(e,t,a)=>h(t,a.time_zone).format(e),h=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"short",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),p=(e,t,a)=>{var o,n,i,s;const c=g(t,a.time_zone);if(t.date_format===r.ow.language||t.date_format===r.ow.system)return c.format(e);const l=c.formatToParts(e),d=null===(o=l.find(e=>"literal"===e.type))||void 0===o?void 0:o.value,u=null===(n=l.find(e=>"day"===e.type))||void 0===n?void 0:n.value,h=null===(i=l.find(e=>"month"===e.type))||void 0===i?void 0:i.value,p=null===(s=l.find(e=>"year"===e.type))||void 0===s?void 0:s.value,m=l[l.length-1];let b="literal"===(null==m?void 0:m.type)?null==m?void 0:m.value:"";"bg"===t.language&&t.date_format===r.ow.YMD&&(b="");return{[r.ow.DMY]:`${u}${d}${h}${d}${p}${b}`,[r.ow.MDY]:`${h}${d}${u}${d}${p}${b}`,[r.ow.YMD]:`${p}${d}${h}${d}${u}${b}`}[t.date_format]},g=(0,i.A)((e,t)=>{const a=e.date_format===r.ow.system?void 0:e.language;return e.date_format===r.ow.language||(e.date_format,r.ow.system),new Intl.DateTimeFormat(a,{year:"numeric",month:"numeric",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})}),m=(e,t,a)=>b(t,a.time_zone).format(e),b=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{day:"numeric",month:"short",timeZone:(0,s.wj)(e.time_zone,t)})),_=(e,t,a)=>f(t,a.time_zone).format(e),f=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{month:"long",year:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),v=(e,t,a)=>y(t,a.time_zone).format(e),y=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{month:"long",timeZone:(0,s.wj)(e.time_zone,t)})),k=(e,t,a)=>w(t,a.time_zone).format(e),w=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{month:"short",timeZone:(0,s.wj)(e.time_zone,t)})),$=(e,t,a)=>C(t,a.time_zone).format(e),C=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),x=(e,t,a)=>z(t,a.time_zone).format(e),z=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",timeZone:(0,s.wj)(e.time_zone,t)})),A=(e,t,a)=>I(t,a.time_zone).format(e),I=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"short",timeZone:(0,s.wj)(e.time_zone,t)})),L=(e,t,a)=>H(t,a.time_zone).format(e),H=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"short",month:"short",day:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),Z=(e,t,a)=>M(t,a.time_zone).format(e),M=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"short",month:"short",day:"numeric",year:"numeric",timeZone:(0,s.wj)(e.time_zone,t)})),V=(e,t,a)=>{const o=(0,s.wj)(t.time_zone,a.time_zone);return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:o}).format(e)},S=(e,t,a,o)=>`${V(e,a,o)}/${V(t,a,o)}`;o()}catch(l){o(l)}})},95747:function(e,t,a){a.a(e,async function(e,o){try{a.d(t,{CL:function(){return v},GH:function(){return w},Rl:function(){return p},ZS:function(){return _},aQ:function(){return m},r6:function(){return u},yg:function(){return y}});var n=a(74487),i=a(22786),r=a(72487),s=a(30162),c=a(8480),l=a(69543),d=e([n,c,r,s]);[n,c,r,s]=d.then?(await d)():d;const u=(e,t,a)=>h(t,a.time_zone).format(e),h=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:(0,l.J)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,l.J)(e)?"h12":"h23",timeZone:(0,c.wj)(e.time_zone,t)})),p=e=>g().format(e),g=(0,i.A)(()=>new Intl.DateTimeFormat(void 0,{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})),m=(e,t,a)=>b(t,a.time_zone).format(e),b=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"short",day:"numeric",hour:(0,l.J)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,l.J)(e)?"h12":"h23",timeZone:(0,c.wj)(e.time_zone,t)})),_=(e,t,a)=>f(t,a.time_zone).format(e),f=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{month:"short",day:"numeric",hour:(0,l.J)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,l.J)(e)?"h12":"h23",timeZone:(0,c.wj)(e.time_zone,t)})),v=(e,t,a)=>(new Date).getFullYear()===e.getFullYear()?_(e,t,a):m(e,t,a),y=(e,t,a)=>k(t,a.time_zone).format(e),k=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{year:"numeric",month:"long",day:"numeric",hour:(0,l.J)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,l.J)(e)?"h12":"h23",timeZone:(0,c.wj)(e.time_zone,t)})),w=(e,t,a)=>`${(0,r.zB)(e,t,a)}, ${(0,s.fU)(e,t,a)}`;o()}catch(u){o(u)}})},30162:function(e,t,a){a.a(e,async function(e,o){try{a.d(t,{LW:function(){return m},Xs:function(){return p},fU:function(){return l},ie:function(){return u}});var n=a(74487),i=a(22786),r=a(8480),s=a(69543),c=e([n,r]);[n,r]=c.then?(await c)():c;const l=(e,t,a)=>d(t,a.time_zone).format(e),d=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,r.wj)(e.time_zone,t)})),u=(e,t,a)=>h(t,a.time_zone).format(e),h=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{hour:(0,s.J)(e)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,r.wj)(e.time_zone,t)})),p=(e,t,a)=>g(t,a.time_zone).format(e),g=(0,i.A)((e,t)=>new Intl.DateTimeFormat(e.language,{weekday:"long",hour:(0,s.J)(e)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,s.J)(e)?"h12":"h23",timeZone:(0,r.wj)(e.time_zone,t)})),m=(e,t,a)=>b(t,a.time_zone).format(e),b=(0,i.A)((e,t)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,r.wj)(e.time_zone,t)}));o()}catch(l){o(l)}})},8480:function(e,t,a){a.a(e,async function(e,o){try{a.d(t,{fL:function(){return p},n2:function(){return g},wj:function(){return m}});var n,i,r,s=a(74487),c=a(29079),l=a(46927),d=e([s]);s=(d.then?(await d)():d)[0];const u=null===(n=Intl.DateTimeFormat)||void 0===n||null===(i=(r=n.call(Intl)).resolvedOptions)||void 0===i?void 0:i.call(r).timeZone,h=u&&("UTC"===u||"Etc/UTC"===u||u in c)?u:void 0,p=void 0!==h,g=null!=h?h:"UTC",m=(e,t)=>e===l.Wj.local&&h?g:t;o()}catch(u){o(u)}})},69543:function(e,t,a){a.d(t,{J:function(){return i}});a(74423);var o=a(22786),n=a(46927);const i=(0,o.A)(e=>{if(e.time_format===n.Hg.language||e.time_format===n.Hg.system){const t=e.time_format===n.Hg.language?e.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(t).includes("10")}return e.time_format===n.Hg.am_pm})},93905:function(e,t,a){a.d(t,{I:function(){return i}});a(16280),a(44114),a(18111),a(7588),a(69112),a(33110);class o{addFromStorage(e){if(!this._storage[e]){const t=this.storage.getItem(e);t&&(this._storage[e]=JSON.parse(t))}}subscribeChanges(e,t){return this._listeners[e]?this._listeners[e].push(t):this._listeners[e]=[t],()=>{this.unsubscribeChanges(e,t)}}unsubscribeChanges(e,t){if(!(e in this._listeners))return;const a=this._listeners[e].indexOf(t);-1!==a&&this._listeners[e].splice(a,1)}hasKey(e){return e in this._storage}getValue(e){return this._storage[e]}setValue(e,t){const a=this._storage[e];this._storage[e]=t;try{void 0===t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify(t))}catch(o){}finally{this._listeners[e]&&this._listeners[e].forEach(e=>e(a,t))}}constructor(e=window.localStorage){this._storage={},this._listeners={},this.storage=e,this.storage===window.localStorage&&window.addEventListener("storage",e=>{e.key&&this.hasKey(e.key)&&(this._storage[e.key]=e.newValue?JSON.parse(e.newValue):e.newValue,this._listeners[e.key]&&this._listeners[e.key].forEach(t=>t(e.oldValue?JSON.parse(e.oldValue):e.oldValue,this._storage[e.key])))})}}const n={};function i(e){return(t,a)=>{if("object"==typeof a)throw new Error("This decorator does not support this compilation type.");const i=e.storage||"localStorage";let r;i&&i in n?r=n[i]:(r=new o(window[i]),n[i]=r);const s=e.key||String(a);r.addFromStorage(s);const c=!1!==e.subscribe?e=>r.subscribeChanges(s,(t,o)=>{e.requestUpdate(a,t)}):void 0,l=()=>r.hasKey(s)?e.deserializer?e.deserializer(r.getValue(s)):r.getValue(s):void 0,d=(t,o)=>{let n;e.state&&(n=l()),r.setValue(s,e.serializer?e.serializer(o):o),e.state&&t.requestUpdate(a,n)},u=t.performUpdate;if(t.performUpdate=function(){this.__initialized=!0,u.call(this)},e.subscribe){const e=t.connectedCallback,a=t.disconnectedCallback;t.connectedCallback=function(){e.call(this);const t=this;t.__unbsubLocalStorage||(t.__unbsubLocalStorage=null==c?void 0:c(this))},t.disconnectedCallback=function(){var e;a.call(this);const t=this;null===(e=t.__unbsubLocalStorage)||void 0===e||e.call(t),t.__unbsubLocalStorage=void 0}}const h=Object.getOwnPropertyDescriptor(t,a);let p;if(void 0===h)p={get(){return l()},set(e){(this.__initialized||void 0===l())&&d(this,e)},configurable:!0,enumerable:!0};else{const e=h.set;p=Object.assign(Object.assign({},h),{},{get(){return l()},set(t){(this.__initialized||void 0===l())&&d(this,t),null==e||e.call(this,t)}})}Object.defineProperty(t,a,p)}}},52943:function(e,t,a){a.d(t,{Z:function(){return o}});const o=e=>e.charAt(0).toUpperCase()+e.slice(1)},89300:function(e,t,a){a.a(e,async function(e,t){try{a(62953);var o=a(40445),n=a(5124),i=a(67576),r=a(6412),s=a(18350),c=a(65829),l=(a(67094),e([s,c]));[s,c]=l.then?(await l)():l;let d,u,h,p,g,m,b=e=>e;const _="M2.2,16.06L3.88,12L2.2,7.94L6.26,6.26L7.94,2.2L12,3.88L16.06,2.2L17.74,6.26L21.8,7.94L20.12,12L21.8,16.06L17.74,17.74L16.06,21.8L12,20.12L7.94,21.8L6.26,17.74L2.2,16.06M13,17V15H11V17H13M13,13V7H11V13H13Z",f="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z";class v extends n.WF{render(){const e=this.progress||this._result?"accent":this.appearance;return(0,n.qy)(d||(d=b` <ha-button .appearance="${0}" .disabled="${0}" .loading="${0}" .variant="${0}" class="${0}"> ${0} <slot>${0}</slot> </ha-button> ${0} `),e,this.disabled,this.progress,"success"===this._result?"success":"error"===this._result?"danger":this.variant,(0,r.H)({result:!!this._result,success:"success"===this._result,error:"error"===this._result}),this.iconPath?(0,n.qy)(u||(u=b`<ha-svg-icon .path="${0}" slot="start"></ha-svg-icon>`),this.iconPath):n.s6,this.label,this._result?(0,n.qy)(h||(h=b` <div class="progress"> ${0} </div> `),"success"===this._result?(0,n.qy)(p||(p=b`<ha-svg-icon .path="${0}"></ha-svg-icon>`),f):"error"===this._result?(0,n.qy)(g||(g=b`<ha-svg-icon .path="${0}"></ha-svg-icon>`),_):n.s6):n.s6)}actionSuccess(){this._setResult("success")}actionError(){this._setResult("error")}_setResult(e){this._result=e,setTimeout(()=>{this._result=void 0},2e3)}constructor(...e){super(...e),this.disabled=!1,this.progress=!1,this.appearance="accent",this.variant="brand"}}v.styles=(0,n.AH)(m||(m=b`:host{outline:0;display:inline-block;position:relative}:host([progress]){pointer-events:none}.progress{bottom:0;display:flex;justify-content:center;align-items:center;position:absolute;top:0;width:100%}ha-button{width:100%}ha-button.result::part(caret),ha-button.result::part(end),ha-button.result::part(label),ha-button.result::part(spinner),ha-button.result::part(start){visibility:hidden}:host([appearance=brand]) ha-svg-icon{color:var(--white-color)}`)),(0,o.Cg)([(0,i.MZ)()],v.prototype,"label",void 0),(0,o.Cg)([(0,i.MZ)({type:Boolean})],v.prototype,"disabled",void 0),(0,o.Cg)([(0,i.MZ)({type:Boolean,reflect:!0})],v.prototype,"progress",void 0),(0,o.Cg)([(0,i.MZ)()],v.prototype,"appearance",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],v.prototype,"iconPath",void 0),(0,o.Cg)([(0,i.MZ)()],v.prototype,"variant",void 0),(0,o.Cg)([(0,i.wk)()],v.prototype,"_result",void 0),v=(0,o.Cg)([(0,i.EM)("ha-progress-button")],v),t()}catch(d){t(d)}})},9503:function(e,t,a){var o=a(40445),n=a(97577),i=a(5124),r=a(67576);let s,c=e=>e;class l extends n.A{get value(){var e;return null!==(e=this._value)&&void 0!==e?e:null}set value(e){this._value=e}static get styles(){return[n.A.styles,(0,i.AH)(s||(s=c`:host{--wa-form-control-toggle-size:var(--ha-checkbox-size, 20px);--wa-form-control-border-color:var(
--ha-checkbox-border-color,
var(--ha-color-border-neutral-normal)
);--wa-form-control-background-color:var(
--ha-checkbox-background-color,
var(--wa-form-control-background-color)
);--checked-icon-color:var(
--ha-checkbox-checked-icon-color,
var(--wa-color-brand-on-loud)
);--wa-form-control-activated-color:var(
--ha-checkbox-checked-background-color,
var(--ha-color-fill-primary-loud-resting)
);-webkit-tap-highlight-color:transparent;--checked-icon-scale:var(--ha-checkbox-checked-icon-scale, 0.9);--wa-form-control-required-content:var(
--ha-checkbox-required-marker,
var(--ha-input-required-marker, "*")
);--wa-form-control-required-content-offset:var(
--ha-checkbox-required-marker-offset,
0.1rem
)}[part~=base]{align-items:center;gap:var(--ha-space-2)}[part~=control]{border-radius:var(--ha-checkbox-border-radius,var(--ha-border-radius-sm));border-width:var(--ha-checkbox-border-width,var(--ha-border-width-md));margin-inline-end:0}[part~=label]{line-height:1}#hint{font-size:var(--ha-font-size-xs);color:var(--ha-color-text-secondary)}label:has(input:not(:disabled)):hover{--wa-form-control-border-color:var(
--ha-checkbox-border-color-hover,
var(--ha-checkbox-border-color, var(--ha-color-border-neutral-loud))
)}label:has(input:not(:disabled)):hover [part~=control]{background-color:var(--ha-checkbox-background-color-hover,var(--ha-color-form-background-hover))}label:has(input:checked:not(:disabled)):hover [part~=control],label:has(input:indeterminate:not(:disabled)):hover [part~=control]{background-color:var(--ha-checkbox-checked-background-color-hover,var(--ha-color-fill-primary-loud-hover));border-color:var(--ha-checkbox-checked-background-color-hover,var(--ha-color-fill-primary-loud-hover))}`))]}}l=(0,o.Cg)([(0,r.EM)("ha-checkbox")],l)},90248:function(e,t,a){a.a(e,async function(e,o){try{a.r(t),a.d(t,{HaIconButtonArrowPrev:function(){return g}});a(62953);var n=a(40445),i=a(5124),r=a(67576),s=a(63091),c=a(26300),l=e([c]);c=(l.then?(await l)():l)[0];let d,u=e=>e;const h="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z",p="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z";class g extends i.WF{render(){var e;return(0,i.qy)(d||(d=u` <ha-icon-button .disabled="${0}" .label="${0}" .path="${0}" .href="${0}" .target="${0}" .rel="${0}" .download="${0}"></ha-icon-button> `),this.disabled,this.label||(null===(e=this.hass)||void 0===e?void 0:e.localize("ui.common.back"))||"Back",this._icon,this.href,this.target,this.rel,this.download)}constructor(...e){super(...e),this.disabled=!1,this._icon="rtl"===s.G.document.dir?p:h}}(0,n.Cg)([(0,r.MZ)({attribute:!1})],g.prototype,"hass",void 0),(0,n.Cg)([(0,r.MZ)({type:Boolean})],g.prototype,"disabled",void 0),(0,n.Cg)([(0,r.MZ)()],g.prototype,"label",void 0),(0,n.Cg)([(0,r.MZ)()],g.prototype,"href",void 0),(0,n.Cg)([(0,r.MZ)()],g.prototype,"target",void 0),(0,n.Cg)([(0,r.MZ)()],g.prototype,"rel",void 0),(0,n.Cg)([(0,r.MZ)()],g.prototype,"download",void 0),(0,n.Cg)([(0,r.wk)()],g.prototype,"_icon",void 0),g=(0,n.Cg)([(0,r.EM)("ha-icon-button-arrow-prev")],g),o()}catch(d){o(d)}})},65829:function(e,t,a){a.a(e,async function(e,t){try{var o=a(40445),n=a(55262),i=a(5124),r=a(67576),s=e([n]);n=(s.then?(await s)():s)[0];let c,l=e=>e;class d extends n.A{updated(e){if(super.updated(e),e.has("size"))switch(this.size){case"tiny":this.style.setProperty("--ha-spinner-size","16px");break;case"small":this.style.setProperty("--ha-spinner-size","28px");break;case"medium":this.style.setProperty("--ha-spinner-size","48px");break;case"large":this.style.setProperty("--ha-spinner-size","68px");break;case void 0:this.style.removeProperty("--ha-progress-ring-size")}}static get styles(){return[n.A.styles,(0,i.AH)(c||(c=l`:host{--indicator-color:var(
--ha-spinner-indicator-color,
var(--primary-color)
);--track-color:var(--ha-spinner-divider-color, var(--divider-color));--track-width:4px;--speed:3.5s;font-size:var(--ha-spinner-size, 48px)}`))]}}(0,o.Cg)([(0,r.MZ)()],d.prototype,"size",void 0),d=(0,o.Cg)([(0,r.EM)("ha-spinner")],d),t()}catch(c){t(c)}})},31420:function(e,t,a){a.a(e,async function(e,o){try{a.d(t,{Bi:function(){return D},Dt:function(){return G},EB:function(){return Z},IW:function(){return I},P_:function(){return x},SG:function(){return A},Sx:function(){return K},T2:function(){return _},Xm:function(){return v},Ye:function(){return f},Zm:function(){return M},cq:function(){return R},dH:function(){return L},en:function(){return Y},gF:function(){return k},gb:function(){return y},gv:function(){return V},jU:function(){return j},kI:function(){return H},mF:function(){return S},mu:function(){return z},oJ:function(){return q},pI:function(){return $},pL:function(){return N},q5:function(){return O},q7:function(){return E},qk:function(){return b},sp:function(){return F},uM:function(){return J},v3:function(){return T},xN:function(){return Q},yL:function(){return w},yj:function(){return U},zZ:function(){return C}});a(74423),a(26910),a(54743),a(11745),a(16573),a(78100),a(77936),a(18111),a(22489),a(20116),a(7588),a(61701),a(3362),a(27495),a(25440),a(21489),a(48140),a(75044),a(21903),a(91134),a(28845),a(373),a(37467),a(44732),a(79577),a(16632),a(34226),a(9486),a(20456),a(62953),a(48408),a(14603),a(47566),a(98721);var n=a(22711),i=a(97732),r=a(6226),s=a(22786),c=a(80785),l=a(95747),d=a(30162),u=a(36918),h=a(30039),p=a(39889),g=a(95350),m=e([n,l,d]);[n,l,d]=m.then?(await m)():m;var b=function(e){return e.NEVER="never",e.DAILY="daily",e.CUSTOM_DAYS="custom_days",e}({});const _=["mon","tue","wed","thu","fri","sat","sun"],f=e=>e.sort((e,t)=>_.indexOf(e)-_.indexOf(t)),v=e=>e.callWS({type:"backup/config/info"}),y=(e,t)=>e.callWS(Object.assign({type:"backup/config/update"},t)),k=(e,t)=>{var a,o;return y(e,{create_backup:{agent_ids:t.create_backup.agent_ids,include_folders:null!==(a=t.create_backup.include_folders)&&void 0!==a?a:[],include_database:t.create_backup.include_database,include_addons:null!==(o=t.create_backup.include_addons)&&void 0!==o?o:[],include_all_addons:t.create_backup.include_all_addons,password:t.create_backup.password},retention:t.retention,schedule:t.schedule})},w=(e,t,a)=>`/api/backup/download/${e}?agent_id=${t}${a?`&password=${a}`:""}`,$=e=>e.callWS({type:"backup/info"}),C=(e,t)=>e.callWS({type:"backup/details",backup_id:t}),x=e=>e.callWS({type:"backup/agents/info"}),z=(e,t)=>e.callWS({type:"backup/delete",backup_id:t}),A=(e,t)=>e.callWS(Object.assign({type:"backup/generate"},t)),I=e=>e.callWS({type:"backup/generate_with_automatic_settings"}),L=(e,t)=>e.callWS(Object.assign({type:"backup/restore"},t)),H=async(e,t,a)=>{const o=new FormData;o.append("file",t);const n=new URLSearchParams;return a.forEach(e=>{n.append("agent_id",e)}),(0,p.QE)(e.fetchWithAuth(`/api/backup/upload?${n.toString()}`,{method:"POST",body:o}))},Z=e=>{const t=e.find(D);if(t)return t;const a=e.find(j);return a||e[0]},M=(e,t,a,o)=>e.callWS({type:"backup/can_decrypt_on_download",backup_id:t,agent_id:a,password:o}),V="backup.local",S="hassio.local",q="cloud.cloud",D=e=>[V,S].includes(e),j=e=>{const[t,a]=e.split(".");return"hassio"===t&&"local"!==a},E=(e,t,a)=>{if(D(t))return e("ui.panel.config.backup.agents.local_agent");const o=a.find(e=>e.agent_id===t),n=t.split(".")[0],i=o?o.name:t.split(".")[1];if(j(t))return i;const r=(0,g.p$)(e,n);return a.filter(e=>e.agent_id.split(".")[0]===n).length>1?`${r}: ${i}`:r},T=e=>Math.max(...Object.values(e.agents).map(e=>e.size)),P=["automatic","app_update","manual"],O=(0,n.z)(e=>e?P:P.filter(e=>"app_update"!==e)),F=(e,t)=>{var a,o;return e.with_automatic_settings?"automatic":!t||null==(null===(a=e.extra_metadata)||void 0===a?void 0:a["supervisor.addon_update"])&&null==(null===(o=e.extra_metadata)||void 0===o?void 0:o["supervisor.app_update"])?"manual":"app_update"},U=(e,t)=>{const a=D(e),o=D(t),n=j(e),i=j(t),r=(e,t)=>e?1:t?2:3,s=r(a,n),c=r(o,i);return s!==c?s-c:e.localeCompare(t)},R=()=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",t="xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx";let a="";const o=new Uint8Array(34);return crypto.getRandomValues(o),o.forEach((o,n)=>{a+="-"===t[n]?"-":e[o%36]}),a},B=(e,t)=>"data:text/plain;charset=utf-8,"+encodeURIComponent(`${e.localize("ui.panel.config.backup.emergency_kit_file.title")}\n\n${e.localize("ui.panel.config.backup.emergency_kit_file.description")}\n\n${e.localize("ui.panel.config.backup.emergency_kit_file.date")} ${(0,l.r6)(new Date,e.locale,e.config)}\n\n${e.localize("ui.panel.config.backup.emergency_kit_file.instance")}\n${e.config.location_name}\n\n${e.localize("ui.panel.config.backup.emergency_kit_file.url")}\n${e.auth.data.hassUrl}\n\n${e.localize("ui.panel.config.backup.emergency_kit_file.encryption_key")}\n${t}\n\n${e.localize("ui.panel.config.backup.emergency_kit_file.more_info",{link:(0,u.o)(e,"/more-info/backup-emergency-kit")})}`),W=(e,t)=>`home_assistant_backup_emergency_kit_${t?`${t}_`:""}${(0,l.GH)(new Date,e.locale,e.config).replace(",","").replace(" ","_")}.txt`,K=(e,t,a)=>(0,h.R)(B(e,t),W(e,a)),J=(0,i.g)((0,r.a)(new Date,4),45),N=(0,i.g)((0,r.a)(new Date,5),45),Y=(0,s.A)((e,t,a)=>{if((0,c.A)(a))return(0,d.fU)(a,e,t);if("string"==typeof a&&a){const o=a.split(":"),n=(0,i.g)((0,r.a)(new Date,parseInt(o[0])),parseInt(o[1]));return(0,d.fU)(n,e,t)}return`${(0,d.fU)(J,e,t)} - ${(0,d.fU)(N,e,t)}`}),Q="application/x-tar",G={file:void 0};o()}catch(_){o(_)}})},12530:function(e,t,a){a.d(t,{O5:function(){return i},ZR:function(){return r},y4:function(){return n}});a(18111),a(7588),a(33110),a(3362),a(62953),a(48408),a(14603),a(47566),a(98721);var o=a(39889);const n=async()=>(0,o.QE)(fetch(`${location.protocol}//${location.host}/api/onboarding/backup/info`)),i=async e=>(0,o.QE)(fetch(`${location.protocol}//${location.host}/api/onboarding/backup/restore`,{method:"POST",body:JSON.stringify(e)})),r=async(e,t)=>{const a=new FormData;a.append("file",e);const n=new URLSearchParams;return t.forEach(e=>{n.append("agent_id",e)}),(0,o.QE)(fetch(`${location.protocol}//${location.host}/api/onboarding/backup/upload?${n.toString()}`,{method:"POST",body:a}))}},16869:function(e,t,a){a.d(t,{B:function(){return n}});var o;a(74423),a(27495);window.externalAppV2||window.externalApp||(null===(o=window.webkit)||void 0===o||null===(o=o.messageHandlers)||void 0===o?void 0:o.getExternalAuth)||location.search.includes("external_auth=1");const n=window.externalApp||window.externalAppV2},22130:function(e,t,a){a.d(t,{fetchHassioAddonChangelog:function(){return s},fetchHassioAddonDocumentation:function(){return c},fetchHassioAddonInfo:function(){return r},fetchHassioAddonsInfo:function(){return i},installHassioAddon:function(){return g},rebuildLocalAddon:function(){return _},reloadHassioAddons:function(){return n},restartHassioAddon:function(){return m},setHassioAddonOption:function(){return l},setHassioAddonSecurity:function(){return p},startHassioAddon:function(){return u},stopHassioAddon:function(){return h},uninstallHassioAddon:function(){return b},validateHassioAddonOption:function(){return d}});a(16280),a(18111),a(20116),a(3362),a(35541);var o=a(47351);const n=async e=>{await e.callWS({type:"supervisor/api",endpoint:"/addons/reload",method:"post"})},i=async e=>e.callWS({type:"supervisor/api",endpoint:"/addons",method:"get"}),r=async(e,t)=>e({type:"supervisor/api",endpoint:`/addons/${t}/info`,method:"get"}),s=async(e,t)=>e.callApi("GET",`hassio/addons/${t}/changelog`),c=async(e,t)=>e.callApi("GET",`hassio/addons/${t}/documentation`),l=async(e,t,a)=>{const n=await e({type:"supervisor/api",endpoint:`/addons/${t}/options`,method:"post",data:a});if("error"===n.result)throw Error((0,o.VR)(n));return n},d=async(e,t,a)=>e({type:"supervisor/api",endpoint:`/addons/${t}/options/validate`,method:"post",data:a}),u=async(e,t)=>e({type:"supervisor/api",endpoint:`/addons/${t}/start`,method:"post",timeout:null}),h=async(e,t)=>e({type:"supervisor/api",endpoint:`/addons/${t}/stop`,method:"post",timeout:null}),p=async(e,t,a)=>{await e({type:"supervisor/api",endpoint:`/addons/${t}/security`,method:"post",data:a})},g=async(e,t)=>{await e({type:"supervisor/api",endpoint:`/addons/${t}/install`,method:"post",timeout:null})},m=async(e,t)=>{await e({type:"supervisor/api",endpoint:`/addons/${t}/restart`,method:"post",timeout:null})},b=async(e,t,a)=>{await e({type:"supervisor/api",endpoint:`/addons/${t}/uninstall`,method:"post",timeout:null,data:{remove_config:a}})},_=async(e,t)=>e({type:"supervisor/api",endpoint:`/addons/${t}/rebuild`,method:"post",timeout:null})},47351:function(e,t,a){a.d(t,{PS:function(){return o},Tv:function(){return r},VR:function(){return n},lE:function(){return s}});a(74423),a(3362),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(62953);const o=e=>e.data,n=e=>"object"==typeof e?"object"==typeof e.body?e.body.message||"Unknown error, see supervisor logs":e.body||e.message||"Unknown error, see supervisor logs":e,i=new Set([502,503,504]),r=e=>!!(e&&e.status_code&&i.has(e.status_code))||!(!e||!e.message||!e.message.includes("ERR_CONNECTION_CLOSED")&&!e.message.includes("ERR_CONNECTION_RESET")),s=async(e,t)=>e({type:"supervisor/api",endpoint:`/${t}/stats`,method:"get"})},35541:function(e,t,a){a.d(t,{X:function(){return i}});a(3362);var o=a(62384),n=a(47351);const i=async(e,t,a)=>{var i;return(0,o.v)(e.config.version,2021,2,4)?e.callWS({type:"supervisor/api",endpoint:t,method:(null==a?void 0:a.method)||"get",timeout:null!==(i=null==a?void 0:a.timeout)&&void 0!==i?i:null,data:null==a?void 0:a.data}):(0,n.PS)(await e.callApi((a.method||"get").toUpperCase(),`hassio${t}`,null==a?void 0:a.data))}},23930:function(e,t,a){a.a(e,async function(e,o){try{a.r(t);a(18111),a(20116),a(3362),a(27495),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698),a(25440),a(62953);var n=a(40445),i=a(5124),r=a(67576),s=a(93905),c=a(91926),l=a(6030),d=a(31420),u=a(12530),h=a(79007),p=a(81619),g=(a(97177),a(75993)),m=a(92701),b=a(54819),_=e([g,m,d]);[g,m,d]=_.then?(await _)():_;let f,v,y,k,w,$,C,x,z,A=e=>e;const I=5e3;class L extends i.WF{render(){var e;return(0,i.qy)(f||(f=A` ${0} ${0} ${0} `),this._error&&"restore"!==this._view?(0,i.qy)(v||(v=A`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):i.s6,"loading"===this._view?(0,i.qy)(y||(y=A`<onboarding-loading></onboarding-loading>`)):"upload"===this._view?(0,i.qy)(k||(k=A` <onboarding-restore-backup-upload .supervisor="${0}" .localize="${0}" @backup-uploaded="${0}"></onboarding-restore-backup-upload> `),this.supervisor,this.localize,this._backupUploaded):"cloud_login"===this._view?(0,i.qy)(w||(w=A` <onboarding-restore-backup-cloud-login .localize="${0}" @ha-refresh-cloud-status="${0}"></onboarding-restore-backup-cloud-login> `),this.localize,this._showCloudBackup):"empty_cloud"===this._view?(0,i.qy)($||($=A` <onboarding-restore-backup-no-cloud-backup .localize="${0}" @sign-out="${0}"></onboarding-restore-backup-no-cloud-backup> `),this.localize,this._signOut):"restore"===this._view?(0,i.qy)(C||(C=A`<onboarding-restore-backup-restore .mode="${0}" .localize="${0}" .backup="${0}" .supervisor="${0}" .error="${0}" @restore-started="${0}" @restore-backup-back="${0}" @sign-out="${0}"></onboarding-restore-backup-restore>`),this.mode,this.localize,this._backup,this.supervisor,this._failed?this.localize("ui.panel.page-onboarding.restore."+("password_incorrect"===(null===(e=this._backupInfo)||void 0===e||null===(e=e.last_action_event)||void 0===e?void 0:e.reason)?"failed_wrong_password_description":"failed_description")):this._error,this._restoreStarted,this._back,this._signOut):i.s6,"status"===this._view&&this._backupInfo?(0,i.qy)(x||(x=A`<onboarding-restore-backup-status .localize="${0}" .backupInfo="${0}" @restore-backup-back="${0}"></onboarding-restore-backup-status>`),this.localize,this._backupInfo,this._back):i.s6)}firstUpdated(e){super.firstUpdated(e),"cloud"===this.mode?(Promise.all([a.e(7305),a.e(92769),a.e(34995),a.e(3283),a.e(80131),a.e(70183),a.e(72130),a.e(85010),a.e(83113),a.e(67218),a.e(98470),a.e(99788),a.e(58303),a.e(59979),a.e(21543),a.e(66283),a.e(82134),a.e(46601),a.e(42635),a.e(93077),a.e(26092),a.e(39005),a.e(8851),a.e(19112),a.e(34310),a.e(30002),a.e(59704),a.e(25322),a.e(82209),a.e(55392),a.e(89747),a.e(71572),a.e(55076),a.e(72453),a.e(36332),a.e(77563),a.e(15862),a.e(99143),a.e(41344),a.e(97500),a.e(66990),a.e(3025),a.e(94847),a.e(2749)]).then(a.bind(a,50258)),a.e(7756).then(a.bind(a,46119))):a.e(28195).then(a.bind(a,83336)),this._loadBackupInfo()}async _loadBackupInfo(){var e;let t;if(this._restoreRunning||!this._loadedIntegrations.has("backup"))try{if(!(await(0,h.HQ)("backup")).integration_loaded)return void(this._error="Backup integration not loaded");this._loadedIntegrations.add("backup")}catch(l){return 404===l.status_code?void this._resetAndReload():void this._scheduleLoadBackupInfo(1e3)}try{t=await(0,u.y4)()}catch(l){if(this._restoreRunning){var a;if("Request error"===l.error||500===l.status_code&&"backup_disabled"===(null===(a=l.body)||void 0===a?void 0:a.error))return void this._scheduleLoadBackupInfo();if(404===l.status_code)return void this._resetAndReload()}return this._error=(null==l?void 0:l.message)||"Cannot get backup info",void("loading"===this._view&&(this._view="upload"))}const{last_action_event:o,state:n,backups:i}=t;if(this._backupInfo={state:n,last_action_event:o},"cloud"===this.mode){var r;try{if(!this._loadedIntegrations.has("cloud")){if(!(await(0,h.HQ)("cloud")).integration_loaded)return void(this._error="Cloud integration not loaded");this._loadedIntegrations.add("cloud")}this._cloudStatus=await(0,h.Zr)()}catch(l){this._error=(null==l?void 0:l.message)||"Cannot get ioBroker Cloud status"}if(null!==(r=this._cloudStatus)&&void 0!==r&&r.logged_in&&!this._backupId){var s;if(this._backup=i.find(({agents:e})=>d.oJ in e),!this._backup)return void(this._view="empty_cloud");this._backupId=null===(s=this._backup)||void 0===s?void 0:s.backup_id}}else this._backupId&&(this._backup=i.find(({backup_id:e})=>e===this._backupId));const c="restore_backup"===(null==o?void 0:o.manager_state)&&"failed"===(null==o?void 0:o.state);if(c&&(this._failed=!0),this._restoreRunning)return this._view="status",void(c||"restore_backup"!==n?(this._failed=!0,this._restoreRunning=void 0):this._scheduleLoadBackupInfo());this._backup?this._view="restore":"upload"===this.mode?this._view="upload":null!==(e=this._cloudStatus)&&void 0!==e&&e.logged_in?this._view="empty_cloud":this._view="cloud_login"}_resetAndReload(){this._restoreRunning=void 0,this._backupId=void 0,window.location.replace("/")}_showCloudBackup(){this._view="loading",this._loadBackupInfo()}_scheduleLoadBackupInfo(e=I){setTimeout(()=>this._loadBackupInfo(),e)}async _backupUploaded(e){this._backupId=e.detail.backupId,await this._loadBackupInfo()}async _restoreStarted(){this._backupInfo&&(this._backupInfo.state="restore_backup"),this._view="status",this._restoreRunning=!0,await this._loadBackupInfo()}async _signOut(){this._view="loading",(0,p.P)(this,{id:"sign-out-ha-cloud",message:this.localize("ui.panel.page-onboarding.restore.ha-cloud.sign_out_progress")}),this._backupId=void 0,this._cloudStatus=void 0;try{await(0,h.mQ)(),(0,p.P)(this,{id:"sign-out-ha-cloud",message:this.localize("ui.panel.page-onboarding.restore.ha-cloud.sign_out_success")})}catch(e){console.error(e),(0,p.P)(this,{id:"sign-out-ha-cloud",message:this.localize("ui.panel.page-onboarding.restore.ha-cloud.sign_out_error")})}(0,c.oo)(`${location.pathname}?${(0,l.s8)("page")}`)}async _back(){this._view="loading",this._backup=void 0,this._backupId=void 0,"upload"===this.mode?this._view="upload":(0,c.oo)(`${location.pathname}?${(0,l.s8)("page")}`)}constructor(...e){super(...e),this.supervisor=!1,this._view="loading",this._loadedIntegrations=new Set}}L.styles=[b.o,(0,i.AH)(z||(z=A`:host{display:flex;flex-direction:column;position:relative}.logout{white-space:nowrap}`))],(0,n.Cg)([(0,r.MZ)({attribute:!1})],L.prototype,"localize",void 0),(0,n.Cg)([(0,r.MZ)({type:Boolean})],L.prototype,"supervisor",void 0),(0,n.Cg)([(0,r.MZ)()],L.prototype,"mode",void 0),(0,n.Cg)([(0,r.wk)()],L.prototype,"_view",void 0),(0,n.Cg)([(0,r.wk)()],L.prototype,"_backup",void 0),(0,n.Cg)([(0,r.wk)()],L.prototype,"_backupInfo",void 0),(0,n.Cg)([(0,r.wk)()],L.prototype,"_error",void 0),(0,n.Cg)([(0,r.wk)()],L.prototype,"_failed",void 0),(0,n.Cg)([(0,r.wk)()],L.prototype,"_cloudStatus",void 0),(0,n.Cg)([(0,s.I)({key:"onboarding-restore-backup-backup-id"})],L.prototype,"_backupId",void 0),(0,n.Cg)([(0,s.I)({key:"onboarding-restore-running"})],L.prototype,"_restoreRunning",void 0),L=(0,n.Cg)([(0,r.EM)("onboarding-restore-backup")],L),o()}catch(f){o(f)}})},75993:function(e,t,a){a.a(e,async function(e,t){try{a(18111),a(61701),a(3362),a(62953);var o=a(40445),n=a(5124),i=a(67576),r=a(95747),s=a(1087),c=a(89300),l=a(38962),d=a(18350),u=a(90248),h=a(91485),p=(a(83892),a(31420)),g=a(12530),m=(a(70074),a(27826),a(54819)),b=e([c,l,d,u,h,p,r]);[c,l,d,u,h,p,r]=b.then?(await b)():b;let _,f,v,y,k,w,$,C,x,z,A,I,L=e=>e;class H extends n.WF{render(){const e=(0,p.EB)(Object.keys(this.backup.agents)),t=this.backup.agents[e].protected,a=(0,r.Rl)(new Date(this.backup.date)),o=0===this.backup.addons.length&&0===this.backup.folders.length;return(0,n.qy)(_||(_=L` <ha-icon-button-arrow-prev .label="${0}" @click="${0}"></ha-icon-button-arrow-prev> <h1> ${0} </h1> ${0} ${0} <ha-row-item> <span slot="headline"> ${0} </span> <span slot="supporting-text">${0}</span> </ha-row-item> ${0} ${0} ${0} ${0} ${0} ${0} <div class="actions${0}"> ${0} <ha-progress-button .progress="${0}" .disabled="${0}" @click="${0}"> ${0} </ha-progress-button> </div> `),this.localize("ui.panel.page-onboarding.restore.back"),this._back,this.localize("ui.panel.page-onboarding.restore.details.restore.title"),this.backup.homeassistant_included?(0,n.qy)(f||(f=L`<div class="description"> ${0} </div>`),this.localize("ui.panel.page-onboarding.restore.confirm_restore_full_backup_text")):(0,n.qy)(v||(v=L` <ha-alert alert-type="error"> ${0} </ha-alert> `),this.localize("ui.panel.page-onboarding.restore.details.home_assistant_missing")),this.error?(0,n.qy)(y||(y=L`<ha-alert alert-type="error" .title="${0}"> ${0} </ha-alert>`),this.localize("ui.panel.page-onboarding.restore.failed"),this.error):n.s6,this.localize("ui.panel.page-onboarding.restore.details.summary.created"),a,o?(0,n.qy)(k||(k=L`<ha-row-item> <span slot="headline"> ${0} </span> <ha-backup-formfield-label slot="supporting-text" .version="${0}" .label="${0}"></ha-backup-formfield-label> </ha-row-item>`),this.localize("ui.panel.page-onboarding.restore.details.summary.content"),this.backup.homeassistant_version,this.localize("ui.panel.page-onboarding.restore.data_picker."+(this.backup.database_included?"settings_and_history":"settings"))):n.s6,o?n.s6:(0,n.qy)(w||(w=L`<h2> ${0} </h2>`),this.localize("ui.panel.page-onboarding.restore.select_type")),this.backup.homeassistant_included&&!this.supervisor&&this.backup.addons.length>0?(0,n.qy)($||($=L`<ha-alert class="supervisor-warning"> ${0} <ha-button slot="action" href="https://www.home-assistant.io/installation/#advanced-installation-methods" target="_blank" rel="noreferrer noopener" size="small"> ${0}</ha-button> </ha-alert>`),this.localize("ui.panel.page-onboarding.restore.details.apps_unsupported"),this.localize("ui.panel.page-onboarding.restore.ha-cloud.learn_more")):n.s6,o?n.s6:(0,n.qy)(C||(C=L`<ha-backup-data-picker translation-key-panel="page-onboarding.restore" .localize="${0}" .data="${0}" .value="${0}" @value-changed="${0}" .requiredItems="${0}" .addonsDisabled="${0}"></ha-backup-data-picker>`),this.localize,this.backup,this._selectedData,this._selectedBackupChanged,["config"],!this.supervisor),this._error?(0,n.qy)(x||(x=L`<ha-alert alert-type="error">${0}</ha-alert> `),this._error):n.s6,t?(0,n.qy)(z||(z=L`<div class="encryption"> <h2> ${0} </h2> <span> ${0} </span> <ha-input .disabled="${0}" @input="${0}" .label="${0}" .value="${0}" @keydown="${0}" .validationMessage="${0}" .invalid="${0}"></ha-input> </div>`),this.localize("ui.panel.page-onboarding.restore.details.restore.encryption.label"),this.localize("ui.panel.page-onboarding.restore.details.restore.encryption.description"+("cloud"===this.mode?"_cloud":"")),this._loading,this._encryptionKeyChanged,this.localize("ui.panel.page-onboarding.restore.details.restore.encryption.input_label"),this._encryptionKey,this._keyDown,this.localize("ui.panel.page-onboarding.restore.details.restore.encryption.incorrect_key"),this._encryptionKeyWrong):n.s6,"cloud"===this.mode?" cloud":"","cloud"===this.mode?(0,n.qy)(A||(A=L`<ha-button appearance="plain" @click="${0}"> ${0} </ha-button>`),this._signOut,this.localize("ui.panel.page-onboarding.restore.ha-cloud.sign_out")):n.s6,this._loading,this._loading||t&&""===this._encryptionKey||!this.backup.homeassistant_included,this._startRestore,this.localize("ui.panel.page-onboarding.restore.details.restore.action"))}willUpdate(){this.hasUpdated||(this._selectedData={homeassistant_included:!0,folders:[],addons:[],homeassistant_version:this.backup.homeassistant_version,database_included:this.backup.database_included})}_keyDown(e){"Enter"===e.key&&""!==this._encryptionKey&&this._progressButtonElement.click()}_signOut(){(0,s.r)(this,"sign-out")}_selectedBackupChanged(e){e.stopPropagation(),this._selectedData=e.detail.value}_encryptionKeyChanged(e){this._encryptionKey=e.target.value}async _startRestore(e){const t=Object.keys(this.backup.agents)[0],a=this.backup.agents[t].protected;if(this._loading||a&&""===this._encryptionKey||!this.backup.homeassistant_included||!this._selectedData)return;this._loading=!0;const o=e.currentTarget;this._error=void 0,this._encryptionKeyWrong=!1;const n=Object.keys(this.backup.agents)[0];try{await(0,g.O5)({agent_id:n,backup_id:this.backup.backup_id,password:this._encryptionKey||void 0,restore_addons:this._selectedData.addons.map(e=>e.slug),restore_database:this._selectedData.database_included,restore_folders:this._selectedData.folders}),o.actionSuccess(),(0,s.r)(this,"restore-started")}catch(c){var i,r;if("Request error"===c.error)return o.actionSuccess(),void(0,s.r)(this,"restore-started");if(o.actionError(),"incorrect_password"===(null===(i=c.body)||void 0===i?void 0:i.code))this._encryptionKeyWrong=!0;else this._error=(null===(r=c.body)||void 0===r?void 0:r.message)||c.message||"Unknown error occurred";this._loading=!1}}_back(){(0,s.r)(this,"restore-backup-back")}static get styles(){return[m.o,(0,n.AH)(I||(I=L`h1,p{text-align:left}.description{font-size:1rem;line-height:var(--ha-line-height-normal);margin-top:24px;margin-bottom:16px}ha-alert{display:block;margin-top:16px}ha-row-item{--ha-row-item-padding-inline:0}h2{font-size:var(--ha-font-size-xl);margin-top:24px;margin-bottom:8px;font-style:normal;font-weight:var(--ha-font-weight-normal)}.supervisor-warning{display:block;margin-bottom:16px}ha-backup-data-picker{display:block;margin-bottom:32px}.encryption{margin-bottom:32px}.encryption ha-input{margin-top:24px}.actions{display:flex;justify-content:flex-end}.actions.cloud{justify-content:space-between}a ha-button{--mdc-theme-primary:var(--primary-color);white-space:nowrap}`))]}constructor(...e){super(...e),this.supervisor=!1,this._encryptionKey="",this._encryptionKeyWrong=!1,this._loading=!1}}(0,o.Cg)([(0,i.MZ)({attribute:!1})],H.prototype,"localize",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],H.prototype,"backup",void 0),(0,o.Cg)([(0,i.MZ)({type:Boolean})],H.prototype,"supervisor",void 0),(0,o.Cg)([(0,i.MZ)()],H.prototype,"error",void 0),(0,o.Cg)([(0,i.MZ)()],H.prototype,"mode",void 0),(0,o.Cg)([(0,i.wk)()],H.prototype,"_encryptionKey",void 0),(0,o.Cg)([(0,i.wk)()],H.prototype,"_encryptionKeyWrong",void 0),(0,o.Cg)([(0,i.wk)()],H.prototype,"_error",void 0),(0,o.Cg)([(0,i.wk)()],H.prototype,"_loading",void 0),(0,o.Cg)([(0,i.wk)()],H.prototype,"_selectedData",void 0),(0,o.Cg)([(0,i.P)("ha-progress-button")],H.prototype,"_progressButtonElement",void 0),H=(0,o.Cg)([(0,i.EM)("onboarding-restore-backup-restore")],H),t()}catch(_){t(_)}})},92701:function(e,t,a){a.a(e,async function(e,t){try{var o=a(40445),n=a(5124),i=a(67576),r=a(1087),s=a(38962),c=a(18350),l=a(94355),d=a(54819),u=e([s,c,l]);[s,c,l]=u.then?(await u)():u;let h,p,g,m,b,_,f,v=e=>e;class y extends n.WF{render(){var e,t;return(0,n.qy)(h||(h=v` <h1> ${0} </h1> ${0} <div class="card-content"> ${0} </div> ${0} `),this.localize("ui.panel.page-onboarding.restore."+("restore_backup"===this.backupInfo.state?"in_progress":"failed")),"restore_backup"===this.backupInfo.state?(0,n.qy)(p||(p=v` <p> ${0} </p>`),this.localize("ui.panel.page-onboarding.restore.in_progress_description")):n.s6,"restore_backup"===this.backupInfo.state?(0,n.qy)(g||(g=v` <div class="loading"> <ha-progress-bar indeterminate></ha-progress-bar> </div> `)):(0,n.qy)(m||(m=v` <ha-alert alert-type="error"> ${0} </ha-alert> ${0} `),this.localize("ui.panel.page-onboarding.restore.failed_status_description"),null!==(e=this.backupInfo.last_action_event)&&void 0!==e&&e.reason?(0,n.qy)(b||(b=v` <div class="failed"> <h4>Error:</h4> ${0} </div> `),null===(t=this.backupInfo.last_action_event)||void 0===t?void 0:t.reason):n.s6),"restore_backup"!==this.backupInfo.state?(0,n.qy)(_||(_=v`<div class="actions"> <ha-button @click="${0}"> ${0} </ha-button> </div>`),this._back,this.localize("ui.panel.page-onboarding.restore.back")):n.s6)}_back(){(0,r.r)(this,"restore-backup-back")}static get styles(){return[d.o,(0,n.AH)(f||(f=v`h1,p{text-align:left}.actions{display:flex;justify-content:flex-end}.loading{display:flex;justify-content:center;padding:32px}p{text-align:center;padding:0 16px;font-size:var(--ha-font-size-l)}.failed{padding:16px 0;font-size:var(--ha-font-size-l)}ha-progress-bar{width:100%}`))]}}(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"localize",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"backupInfo",void 0),y=(0,o.Cg)([(0,i.EM)("onboarding-restore-backup-status")],y),t()}catch(h){t(h)}})},76127:function(e,t,a){a(74423),a(44114),a(26910),a(18111),a(22489),a(20116),a(61701),a(62953);var o=a(40445),n=a(5124),i=a(67576),r=a(22786),s=a(1087),c=a(52220);a(9503),a(27826);let l,d,u,h=e=>e;class p extends n.WF{render(){return(0,n.qy)(l||(l=h` <div class="items"> ${0} </div> `),this._addons(this.addons).map(e=>{var t,a;return(0,n.qy)(d||(d=h` <ha-checkbox .id="${0}" .checked="${0}" @change="${0}" .disabled="${0}"> <ha-backup-formfield-label .label="${0}" .version="${0}" .iconPath="${0}" .imageUrl="${0}"> </ha-backup-formfield-label> </ha-checkbox> `),e.slug,(null===(t=this.value)||void 0===t?void 0:t.includes(e.slug))||!1,this._checkboxChanged,this.disabled,e.name,this.hideVersion?void 0:e.version,e.iconPath||"M20.5,11H19V7C19,5.89 18.1,5 17,5H13V3.5A2.5,2.5 0 0,0 10.5,1A2.5,2.5 0 0,0 8,3.5V5H4A2,2 0 0,0 2,7V10.8H3.5C5,10.8 6.2,12 6.2,13.5C6.2,15 5,16.2 3.5,16.2H2V20A2,2 0 0,0 4,22H7.8V20.5C7.8,19 9,17.8 10.5,17.8C12,17.8 13.2,19 13.2,20.5V22H17A2,2 0 0,0 19,20V16H20.5A2.5,2.5 0 0,0 23,13.5A2.5,2.5 0 0,0 20.5,11Z",null!==(a=this.addons)&&void 0!==a&&null!==(a=a.find(t=>t.slug===e.slug))&&void 0!==a&&a.icon?`/api/hassio/addons/${e.slug}/icon`:void 0)}))}_checkboxChanged(e){var t;e.stopPropagation();let a=null!==(t=this.value)&&void 0!==t?t:[];const o=e.currentTarget;o.checked?a.push(o.id):a=a.filter(e=>e!==o.id),(0,s.r)(this,"value-changed",{value:a})}constructor(...e){super(...e),this.hideVersion=!1,this.disabled=!1,this._addons=(0,r.A)(e=>e.sort((e,t)=>{var a;return(0,c.xL)(e.name,t.name,null===(a=this.hass)||void 0===a||null===(a=a.locale)||void 0===a?void 0:a.language)}))}}p.styles=(0,n.AH)(u||(u=h`.items{display:flex;flex-direction:column;gap:var(--ha-space-2);padding-inline-start:var(--ha-space-2);padding-bottom:var(--ha-space-3)}`)),(0,o.Cg)([(0,i.MZ)({attribute:!1})],p.prototype,"hass",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],p.prototype,"addons",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],p.prototype,"value",void 0),(0,o.Cg)([(0,i.MZ)({attribute:"hide-version",type:Boolean})],p.prototype,"hideVersion",void 0),(0,o.Cg)([(0,i.MZ)({type:Boolean})],p.prototype,"disabled",void 0),p=(0,o.Cg)([(0,i.EM)("ha-backup-addons-picker")],p)},70074:function(e,t,a){a(74423),a(44114),a(72712),a(18111),a(22489),a(61701),a(18237),a(3362),a(62953);var o=a(40445),n=a(5124),i=a(67576),r=a(22786),s=a(36312),c=a(1087),l=a(52943),d=(a(9503),a(22130)),u=a(53580);a(76127),a(27826);let h,p,g,m,b,_=e=>e;const f="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",v={config:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",database:"M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9 17H7V10H9V17M13 17H11V7H13V17M17 17H15V13H17V17Z",media:"M4,6H2V20A2,2 0 0,0 4,22H18V20H4V6M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M12,14.5V5.5L18,10L12,14.5Z",share:f,ssl:"M10,17L6,13L7.41,11.59L10,14.17L16.59,7.58L18,9M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1Z"};class y extends n.WF{firstUpdated(e){super.firstUpdated(e),this.hass&&(0,s.x)(this.hass.config,"hassio")&&this._fetchAddonInfo()}async _fetchAddonInfo(){const{addons:e}=await(0,d.fetchHassioAddonsInfo)(this.hass);this._addonIcons=e.reduce((e,t)=>Object.assign(Object.assign({},e),{},{[t.slug]:t.icon}),{})}_localizeFolder(e){const t=this.localize||this.hass.localize;switch(e){case"media":return t(`ui.panel.${this.translationKeyPanel}.data_picker.media`);case"share":return t(`ui.panel.${this.translationKeyPanel}.data_picker.share_folder`);case"ssl":return t(`ui.panel.${this.translationKeyPanel}.data_picker.ssl`);case"addons/local":return t(`ui.panel.${this.translationKeyPanel}.data_picker.local_apps`)}return(0,l.Z)(e)}_homeassistantChanged(e){const t=this._parseValue(this.value),a=e.currentTarget;a.checked?t.homeassistant.push(a.id):t.homeassistant=t.homeassistant.filter(e=>e!==a.id);const o=this._formatValue(t,this.data);(0,c.r)(this,"value-changed",{value:o})}_addonsChanged(e){e.stopPropagation();const t=this._parseValue(this.value),a=e.detail.value;t.addons=a;const o=this._formatValue(t,this.data);(0,c.r)(this,"value-changed",{value:o})}_sectionChanged(e){const t=this._parseValue(this.value),a=this._parseValue(this.data),o=e.currentTarget,n=o.id;o.checked?t[n]=a[n]:t[n]=[];const i=this._formatValue(t,this.data);(0,c.r)(this,"value-changed",{value:i})}render(){const e=this.localize||this.hass.localize,t=this._homeAssistantItems(this.data,e),a=this._addonsItems(this.data,e,this._addonIcons),o=this._parseValue(this.value);return(0,n.qy)(h||(h=_` ${0} ${0} `),t.length?(0,n.qy)(p||(p=_` <div class="section"> <ha-checkbox .id="${0}" .checked="${0}" .indeterminate="${0}" @change="${0}" ?disabled="${0}"> <ha-backup-formfield-label label="ioBroker" .iconPath="${0}"> </ha-backup-formfield-label> </ha-checkbox> <div class="items"> ${0} </div> </div> `),"homeassistant",o.homeassistant.length===t.length,o.homeassistant.length>0&&o.homeassistant.length<t.length,this._sectionChanged,this.requiredItems.length>0,u.mdiHomeAssistant,t.map(e=>(0,n.qy)(g||(g=_` <ha-checkbox .id="${0}" .checked="${0}" @change="${0}" .disabled="${0}"> <ha-backup-formfield-label .label="${0}" .version="${0}" .iconPath="${0}"> </ha-backup-formfield-label> </ha-checkbox> `),e.id,o.homeassistant.includes(e.id),this._homeassistantChanged,this.requiredItems.includes(e.id),e.label,e.version,v[e.id]||f))):n.s6,a.length?(0,n.qy)(m||(m=_` <div class="section"> <ha-checkbox .id="${0}" .checked="${0}" .indeterminate="${0}" @change="${0}" .disabled="${0}"> <ha-backup-formfield-label .label="${0}" .iconPath="${0}"> </ha-backup-formfield-label> </ha-checkbox> <ha-backup-addons-picker .hass="${0}" .value="${0}" @value-changed="${0}" .addons="${0}" .disabled="${0}"> </ha-backup-addons-picker> </div> `),"addons",o.addons.length===a.length,o.addons.length>0&&o.addons.length<a.length,this._sectionChanged,this.addonsDisabled,e(`ui.panel.${this.translationKeyPanel}.data_picker.apps`),"M20.5,11H19V7C19,5.89 18.1,5 17,5H13V3.5A2.5,2.5 0 0,0 10.5,1A2.5,2.5 0 0,0 8,3.5V5H4A2,2 0 0,0 2,7V10.8H3.5C5,10.8 6.2,12 6.2,13.5C6.2,15 5,16.2 3.5,16.2H2V20A2,2 0 0,0 4,22H7.8V20.5C7.8,19 9,17.8 10.5,17.8C12,17.8 13.2,19 13.2,20.5V22H17A2,2 0 0,0 19,20V16H20.5A2.5,2.5 0 0,0 23,13.5A2.5,2.5 0 0,0 20.5,11Z",this.hass,o.addons,this._addonsChanged,a,this.addonsDisabled):n.s6)}constructor(...e){super(...e),this.requiredItems=[],this.translationKeyPanel="config.backup",this.addonsDisabled=!1,this._addonIcons={},this._homeAssistantItems=(0,r.A)((e,t)=>{const a=[];return e.homeassistant_included&&a.push({label:t(`ui.panel.${this.translationKeyPanel}.data_picker.${e.database_included?"settings_and_history":"settings"}`),id:"config",version:e.homeassistant_version}),a.push(...e.folders.map(e=>({label:this._localizeFolder(e),id:e}))),a}),this._addonsItems=(0,r.A)((e,t,a)=>e.addons.map(e=>({name:e.name,slug:e.slug,version:e.version,icon:a[e.slug]}))),this._parseValue=(0,r.A)(e=>{if(!e)return{homeassistant:[],addons:[]};const t=[],a=[];e.homeassistant_included&&t.push("config");const o=e.folders;t.push(...o);const n=e.addons.map(e=>e.slug);return a.push(...n),{homeassistant:t,addons:a}}),this._formatValue=(0,r.A)((e,t)=>({homeassistant_version:t.homeassistant_version,homeassistant_included:e.homeassistant.includes("config"),database_included:t.database_included&&e.homeassistant.includes("config"),addons:t.addons.filter(t=>e.addons.includes(t.slug)),folders:t.folders.filter(t=>e.homeassistant.includes(t))}))}}y.styles=(0,n.AH)(b||(b=_`.section{margin-left:-16px;margin-inline-start:-16px;margin-inline-end:initial}.items{padding-inline-start:52px;padding-inline-end:initial;display:flex;flex-direction:column;gap:var(--ha-space-2);margin-bottom:var(--ha-space-3)}ha-backup-addons-picker{display:block;padding-inline-start:42px;padding-inline-end:initial}ha-checkbox{justify-content:center}.section>ha-checkbox{min-height:40px;padding-inline-start:var(--ha-space-5)}`)),(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"data",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"value",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"localize",void 0),(0,o.Cg)([(0,i.MZ)({type:Array,attribute:"required-items"})],y.prototype,"requiredItems",void 0),(0,o.Cg)([(0,i.MZ)({attribute:"translation-key-panel"})],y.prototype,"translationKeyPanel",void 0),(0,o.Cg)([(0,i.MZ)({attribute:!1})],y.prototype,"addonsDisabled",void 0),(0,o.Cg)([(0,i.wk)()],y.prototype,"_addonIcons",void 0),y=(0,o.Cg)([(0,i.EM)("ha-backup-data-picker")],y)},27826:function(e,t,a){var o=a(40445),n=a(5124),i=a(67576);a(67094);let r,s,c,l,d,u=e=>e;class h extends n.WF{render(){return(0,n.qy)(r||(r=u` ${0} <span class="label"> ${0} ${0} </span> `),this.imageUrl?(0,n.qy)(s||(s=u`<img loading="lazy" alt="" src="${0}" class="icon">`),this.imageUrl):this.iconPath?(0,n.qy)(c||(c=u` <ha-svg-icon .path="${0}" class="icon"></ha-svg-icon> `),this.iconPath):n.s6,this.label,this.version?(0,n.qy)(l||(l=u`<span class="version">(${0})</span>`),this.version):n.s6)}}h.styles=(0,n.AH)(d||(d=u`:host{display:flex;flex-direction:row;gap:var(--ha-space-1);align-items:center}.label{margin-right:4px;margin-inline-end:4px;margin-inline-start:initial;font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-normal);letter-spacing:.5px}.version{color:var(--secondary-text-color)}.icon{--mdi-icon-size:24px;width:24px;height:24px}`)),(0,o.Cg)([(0,i.MZ)({type:String})],h.prototype,"label",void 0),(0,o.Cg)([(0,i.MZ)({type:String,attribute:"image-url"})],h.prototype,"imageUrl",void 0),(0,o.Cg)([(0,i.MZ)({type:String,attribute:"icon-path"})],h.prototype,"iconPath",void 0),(0,o.Cg)([(0,i.MZ)({type:String})],h.prototype,"version",void 0),h=(0,o.Cg)([(0,i.EM)("ha-backup-formfield-label")],h)},53580:function(e,t,a){a.d(t,{mdiHomeAssistant:function(){return o}});const o="m12.151 1.5882c-.3262 0-.6523.1291-.8996.3867l-8.3848 8.7354c-.0619.0644-.1223.1368-.1807.2154-.0588.0789-.1151.1638-.1688.2534-.2593.4325-.4552.9749-.5232 1.4555-.0026.018-.0076.0369-.0094.0548-.0121.0987-.0184.1944-.0184.2857v8.0124a1.2731 1.2731 0 001.2731 1.2731h7.8313l-3.4484-3.593a1.7399 1.7399 0 111.0803-1.125l2.6847 2.7972v-10.248a1.7399 1.7399 0 111.5276-0v7.187l2.6702-2.782a1.7399 1.7399 0 111.0566 1.1505l-3.7269 3.8831v2.7299h8.174a1.2471 1.2471 0 001.2471-1.2471v-8.0375c0-.0912-.0059-.1868-.0184-.2855-.0603-.4935-.2636-1.0617-.5326-1.5105-.0537-.0896-.1101-.1745-.1684-.253-.0588-.079-.1191-.1513-.181-.2158l-8.3848-8.7363c-.2473-.2577-.5735-.3866-.8995-.3864"},30039:function(e,t,a){a.d(t,{R:function(){return n}});a(62953),a(3296),a(27208),a(48408),a(14603),a(47566),a(98721);var o=a(16869);const n=(e,t="")=>{const a=document.createElement("a");a.target="_blank",a.href=e,a.download=t,a.style.display="none",document.body.appendChild(a),a.dispatchEvent(new MouseEvent("click")),document.body.removeChild(a),e.startsWith("blob:")&&(o.B?setTimeout(()=>URL.revokeObjectURL(e),1e4):URL.revokeObjectURL(e))}}}]);