iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
4 lines • 40.5 kB
JavaScript
export const __rspack_esm_id=21679;export const __rspack_esm_ids=[21679];export const __webpack_modules__={90433(t,e,a){a.d(e,{Vy:()=>n,fI:()=>s,ux:()=>r});var o=a(22786),i=a(79468);function n(t,e){const a=t%54+1;return e.getPropertyValue(`--color-${a}`)}function s(t,e){const a=e.getPropertyValue(`--graph-color-${t+1}`)||n(t,e);return(0,i.RQ)(a)}const r=(0,o.A)(t=>Array.from({length:54},(e,a)=>s(a,t)),(t,e)=>t[0].getPropertyValue("--graph-color-1")===e[0].getPropertyValue("--graph-color-1")&&t[0].getPropertyValue("--color-1")===e[0].getPropertyValue("--color-1"))},72487(t,e,a){a.a(t,async function(t,o){try{a.d(e,{CA:()=>k,Mi:()=>I,Pm:()=>$,Wq:()=>_,Yq:()=>c,bl:()=>L,c2:()=>w,fr:()=>f,gu:()=>A,kz:()=>h,m9:()=>Z,sl:()=>g,ur:()=>H,zB:()=>u});a(18111),a(20116);var i=a(74487),n=a(22786),s=a(46927),r=a(8480),l=t([i,r]);[i,r]=l.then?(await l)():l;(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",month:"long",day:"numeric",timeZone:(0,r.wj)(t.time_zone,e)}));const c=(t,e,a)=>d(e,a.time_zone).format(t),d=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"long",day:"numeric",timeZone:(0,r.wj)(t.time_zone,e)})),h=(t,e,a)=>p(e,a.time_zone).format(t),p=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",month:"short",day:"numeric",timeZone:(0,r.wj)(t.time_zone,e)})),u=(t,e,a)=>{const o=m(e,a.time_zone);if(e.date_format===s.ow.language||e.date_format===s.ow.system)return o.format(t);const i=o.formatToParts(t),n=i.find(t=>"literal"===t.type)?.value,r=i.find(t=>"day"===t.type)?.value,l=i.find(t=>"month"===t.type)?.value,c=i.find(t=>"year"===t.type)?.value,d=i[i.length-1];let h="literal"===d?.type?d?.value:"";"bg"===e.language&&e.date_format===s.ow.YMD&&(h="");return{[s.ow.DMY]:`${r}${n}${l}${n}${c}${h}`,[s.ow.MDY]:`${l}${n}${r}${n}${c}${h}`,[s.ow.YMD]:`${c}${n}${l}${n}${r}${h}`}[e.date_format]},m=(0,n.A)((t,e)=>{const a=t.date_format===s.ow.system?void 0:t.language;return t.date_format===s.ow.language||(t.date_format,s.ow.system),new Intl.DateTimeFormat(a,{year:"numeric",month:"numeric",day:"numeric",timeZone:(0,r.wj)(t.time_zone,e)})}),g=(t,e,a)=>y(e,a.time_zone).format(t),y=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{day:"numeric",month:"short",timeZone:(0,r.wj)(t.time_zone,e)})),f=(t,e,a)=>v(e,a.time_zone).format(t),v=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",year:"numeric",timeZone:(0,r.wj)(t.time_zone,e)})),_=(t,e,a)=>b(e,a.time_zone).format(t),b=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"long",timeZone:(0,r.wj)(t.time_zone,e)})),w=(t,e,a)=>x(e,a.time_zone).format(t),x=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{month:"short",timeZone:(0,r.wj)(t.time_zone,e)})),$=(t,e,a)=>C(e,a.time_zone).format(t),C=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{year:"numeric",timeZone:(0,r.wj)(t.time_zone,e)})),k=(t,e,a)=>M(e,a.time_zone).format(t),M=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",timeZone:(0,r.wj)(t.time_zone,e)})),A=(t,e,a)=>z(e,a.time_zone).format(t),z=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",timeZone:(0,r.wj)(t.time_zone,e)})),I=(t,e,a)=>T(e,a.time_zone).format(t),T=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",month:"short",day:"numeric",timeZone:(0,r.wj)(t.time_zone,e)})),H=(t,e,a)=>S(e,a.time_zone).format(t),S=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"short",month:"short",day:"numeric",year:"numeric",timeZone:(0,r.wj)(t.time_zone,e)})),L=(t,e,a)=>{const o=(0,r.wj)(e.time_zone,a.time_zone);return new Intl.DateTimeFormat("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",timeZone:o}).format(t)},Z=(t,e,a,o)=>`${L(t,a,o)}/${L(e,a,o)}`;o()}catch(t){o(t)}})},30162(t,e,a){a.a(t,async function(t,o){try{a.d(e,{LW:()=>g,Xs:()=>u,fU:()=>c,ie:()=>h});var i=a(74487),n=a(22786),s=a(8480),r=a(69543),l=t([i,s]);[i,s]=l.then?(await l)():l;const c=(t,e,a)=>d(e,a.time_zone).format(t),d=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{hour:"numeric",minute:"2-digit",hourCycle:(0,r.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),h=(t,e,a)=>p(e,a.time_zone).format(t),p=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{hour:(0,r.J)(t)?"numeric":"2-digit",minute:"2-digit",second:"2-digit",hourCycle:(0,r.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),u=(t,e,a)=>m(e,a.time_zone).format(t),m=(0,n.A)((t,e)=>new Intl.DateTimeFormat(t.language,{weekday:"long",hour:(0,r.J)(t)?"numeric":"2-digit",minute:"2-digit",hourCycle:(0,r.J)(t)?"h12":"h23",timeZone:(0,s.wj)(t.time_zone,e)})),g=(t,e,a)=>y(e,a.time_zone).format(t),y=(0,n.A)((t,e)=>new Intl.DateTimeFormat("en-GB",{hour:"numeric",minute:"2-digit",hour12:!1,timeZone:(0,s.wj)(t.time_zone,e)}));o()}catch(t){o(t)}})},8480(t,e,a){a.a(t,async function(t,o){try{a.d(e,{fL:()=>d,n2:()=>h,wj:()=>p});var i=a(74487),n=a(29079),s=a(46927),r=t([i]);i=(r.then?(await r)():r)[0];const l=Intl.DateTimeFormat?.().resolvedOptions?.().timeZone,c=l&&("UTC"===l||"Etc/UTC"===l||l in n)?l:void 0,d=14881==a.j?void 0!==c:null,h=c??"UTC",p=(t,e)=>t===s.Wj.local&&c?h:e;o()}catch(t){o(t)}})},69543(t,e,a){a.d(e,{J:()=>n});a(74423);var o=a(22786),i=a(46927);const n=(0,o.A)(t=>{if(t.time_format===i.Hg.language||t.time_format===i.Hg.system){const e=t.time_format===i.Hg.language?t.language:void 0;return new Date("January 1, 2023 22:00:00").toLocaleString(e).includes("10")}return t.time_format===i.Hg.am_pm})},93421(t,e,a){a.d(e,{IW:()=>d,dH:()=>c,fI:()=>l});a(44114);var o=a(35211),i=a(22792),n=a(32172);const s=(t,e)=>{let a=t;for(const t of e){if(null==a)return;a=a[t]}return a},r=(t,e,a)=>{const i=(0,n.p)({transformer:function(t){return a.call(this,t)},watch:e?[e]:[]}),s=(0,o.Fg)({context:t,subscribe:!0});return(t,e)=>{i(t,e),s(t,e)}},l=t=>r(i.iN,t.entityIdPath[0],function(e){const a=s(this,t.entityIdPath);return"string"==typeof a?e?.[a]:void 0}),c=t=>r(i.X1,t.entityIdPath[0],function(e){const a=s(this,t.entityIdPath);return"string"==typeof a?e?.[a]:void 0}),d=()=>r(i.D5,void 0,({localize:t})=>t)},32172(t,e,a){a.d(e,{p:()=>o});a(18111),a(7588),a(45367),a(92731),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);function o(t){return(e,a)=>{if("object"==typeof a)throw new Error("This decorator does not support this compilation type.");const o=String(a),i=e;if(i._transformers){if(!i.hasOwnProperty("_transformers")){const t=i._transformers;i._transformers=new Map,t.forEach((t,e)=>i._transformers.set(e,t))}}else{i._transformers=new Map,i._watching=new Map;const t=i.willUpdate;i.willUpdate=function(e){t.call(this,e);const a=new Set;e.forEach((t,e)=>{const o=this._watching.get(e);void 0!==o&&o.forEach(t=>a.add(t))}),a.forEach(t=>{this[t]=this[`__original_${String(t)}`]})}}i._transformers.set(a,t.transformer),t.watch&&t.watch.forEach(t=>{let e=i._watching.get(t);e||(e=new Set,i._watching.set(t,e)),e.add(a)});const n=Object.getOwnPropertyDescriptor(e,a);let s;if(void 0===n)s={get(){return this[`__transform_${o}`]},set(t){const e=this[`__transform_${o}`],a=this._transformers.get(o);this[`__transform_${o}`]=a?a.call(this,t):t,this[`__original_${o}`]=t,this.requestUpdate(o,e)},configurable:!0,enumerable:!0};else{const t=n.set;s={...n,set(e){const a=this[`__transform_${o}`],i=this._transformers.get(o);this[`__transform_${o}`]=i?i.call(this,e):e,this[`__original_${o}`]=e,this.requestUpdate(o,a),t?.call(this,e)}}}Object.defineProperty(e,a,s)}}},67258(t,e,a){a.d(e,{d:()=>o});const o=t=>{switch(t.language){case"cs":case"de":case"fi":case"fr":case"sk":case"sv":return" ";default:return""}}},29961(t,e,a){a.a(t,async function(t,o){try{a.d(e,{d:()=>r,n:()=>l});var i=a(72487),n=a(30162),s=t([i,n]);function r(t,e,a){return"month"===t?{formatter:t=>{const o=new Date(t);return 0===o.getMonth()?`{bold|${(0,i.fr)(o,e,a)}}`:(0,i.Wq)(o,e,a)}}:"year"===t?{formatter:t=>(0,i.Pm)(new Date(t),e,a)}:void 0}function l(t,e,a,o){const s=o/60/24,r=new Date(t);if(s>88)return 0===r.getMonth()?`{bold|${(0,i.fr)(r,e,a)}}`:(0,i.Wq)(r,e,a);if(s>35)return 1===r.getDate()?`{bold|${(0,i.sl)(r,e,a)}}`:(0,i.sl)(r,e,a);if(s>7){const t=(0,i.sl)(r,e,a);return 1===r.getDate()?`{bold|${t}}`:t}return s>2?(0,i.gu)(r,e,a):o&&o<5?(0,n.ie)(r,e,a):0===r.getHours()&&0===r.getMinutes()&&0===r.getSeconds()?`{bold|${(0,i.sl)(r,e,a)}}`:(0,n.fU)(r,e,a)}[i,n]=s.then?(await s)():s,o()}catch(c){o(c)}})},34218(t,e,a){a.d(e,{P:()=>o});a(44114),a(18111),a(18237),a(45367),a(92731);function o(t,e,a,o,n=!1){if(!t)return[];if(t.length<=e)return t;const s=a??i(t[0])[0],r=o??i(t[t.length-1])[0],l=Math.ceil((r-s)/Math.floor(e)),c=new Map;for(const e of t){const t=i(e);if(!Array.isArray(t))continue;const a=Number(t[0]),o=Number(t[1]);if(isNaN(a)||isNaN(o))continue;const n=Math.floor((a-s)/l),r=c.get(n);r?r.push({point:e,x:a,y:o}):c.set(n,[{point:e,x:a,y:o}])}const d=[];if(n)for(const[t,e]of c){const t=e.reduce((t,e)=>t+e.y,0)/e.length,a=e.reduce((t,e)=>t+e.x,0)/e.length,o=i(e[0].point),n=Array.isArray(o)?[a,t]:{value:[a,t]};d.push(n)}else for(const[t,e]of c){let t=e[0],a=e[0];for(const o of e)o.y<t.y&&(t=o),o.y>a.y&&(a=o);t.x>a.x&&d.push(a.point),d.push(t.point),t.x<a.x&&d.push(a.point)}return d}function i(t){return t&&"object"==typeof t&&"value"in t?t.value:t}},33062(t,e,a){var o=a(62826),i=a(5124),n=a(22441);class s extends i.WF{willUpdate(t){t.has("color")&&(this.style.backgroundColor=this.color)}render(){return i.s6}constructor(...t){super(...t),this.color="",this.rtl=!1}}s.styles=i.AH`:host{display:inline-block;margin-inline-end:4px;margin-inline-start:initial;border-radius:10px;width:10px;height:10px;vertical-align:middle}:host([rtl]){direction:rtl}`,(0,o.Cg)([(0,n.MZ)()],s.prototype,"color",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,reflect:!0})],s.prototype,"rtl",void 0),s=(0,o.Cg)([(0,n.EM)("ha-chart-tooltip-marker")],s)},86760(t,e,a){a.a(t,async function(t,e){try{a(44114),a(18111),a(61701),a(18237);var o=a(62826),i=a(5124),n=a(22441),s=a(22786),r=a(90433),l=a(44439),c=(a(33062),t([l]));let d;l=(c.then?(await c)():c)[0];class h extends i.WF{render(){if(!d||!this.data)return i.s6;const t={tooltip:{trigger:"item",formatter:this._renderTooltip,appendTo:document.body}};return i.qy`<ha-chart-base .data="${this._createData(this.data)}" .options="${t}" height="100%" .extraComponents="${[d]}"></ha-chart-base>`}_getMaxDepth(t,e=0){return t.children&&0!==t.children.length?Math.max(...t.children.map(t=>this._getMaxDepth(t,e+1))):e}_generateLevels(t){const e=[];if(e.push({r0:"0%",r:"15%",itemStyle:{color:"transparent"}}),0===t)return e;const a=Array.from({length:t},(e,a)=>t-a),o=a.reduce((t,e)=>t+e,0);let i=15;for(let n=0;n<t;n++){const t=i,s=i+a[n]/o*80;i=s,e.push({r0:`${t}%`,r:`${s}%`,...0===n?{label:{show:!0}}:{}})}return e}constructor(){super(),this._renderTooltip=t=>{const e=t.data,a=this.valueFormatter?this.valueFormatter(e.value):e.value;return i.qy`<ha-chart-tooltip-marker .color="${String(t.color??"")}"></ha-chart-tooltip-marker> ${e.name}<br>${a}`},this._createData=(0,s.A)(t=>{const e=getComputedStyle(this),a=(t,o,i,n)=>{const s={...t,name:t.name||t.id};return i>0&&!t.itemStyle?.color&&(s.itemStyle={color:n??(0,r.fI)(o,e)}),t.children&&t.children.length>0&&(s.children=t.children.map((t,e)=>a(t,e,i+1,s.itemStyle?.color))),s},o=a(t,0,0);return{type:"sunburst",data:o.children||[o],radius:[0,"90%"],sort:void 0,label:{show:!1,align:"center",rotate:"radial",minAngle:15,hideOverlap:!0},emphasis:{focus:"ancestor",label:{show:!1}},itemStyle:{borderRadius:2},levels:this._generateLevels(this._getMaxDepth(t))}}),d||Promise.all([a.e(37552),a.e(77072),a.e(78307)]).then(a.bind(a,60686)).then(t=>{d=t,this.requestUpdate()})}}h.styles=i.AH`:host{display:block;flex:1}ha-chart-base{width:100%;height:100%}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],h.prototype,"data",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],h.prototype,"valueFormatter",void 0),h=(0,o.Cg)([(0,n.EM)("ha-sunburst-chart")],h),e()}catch(t){e(t)}})},34296(t,e,a){var o=a(62826),i=a(96229),n=a(26069),s=a(91735),r=a(42034),l=a(5124),c=a(22441);class d extends i.k{renderOutline(){return this.filled?l.qy`<span class="filled"></span>`:super.renderOutline()}getContainerClasses(){return{...super.getContainerClasses(),active:this.active}}renderPrimaryContent(){return l.qy` <span class="leading icon" aria-hidden="true"> ${this.renderLeadingIcon()} </span> <span class="label">${this.label}</span> <span class="touch"></span> <span class="trailing leading icon" aria-hidden="true"> ${this.renderTrailingIcon()} </span> `}renderTrailingIcon(){return l.qy`<slot name="trailing-icon"></slot>`}constructor(...t){super(...t),this.filled=!1,this.active=!1}}d.styles=[s.R,r.R,n.R,l.AH`:host{--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-surface:var(--primary-text-color);--md-assist-chip-container-shape:var(
--ha-assist-chip-container-shape,
16px
);--md-assist-chip-outline-color:var(--outline-color);--md-assist-chip-label-text-weight:400}.filled{display:flex;pointer-events:none;border-radius:inherit;inset:0;position:absolute;background-color:var(--ha-assist-chip-filled-container-color)}::slotted([slot=icon]),::slotted([slot=trailing-icon]){display:flex;--mdc-icon-size:var(--md-input-chip-icon-size, 18px);font-size:var(--_label-text-size)!important}.trailing.icon ::slotted(*),.trailing.icon svg{margin-inline-end:unset;margin-inline-start:var(--_icon-label-space)}::before{background:var(--ha-assist-chip-container-color,transparent);opacity:var(--ha-assist-chip-container-opacity, 1)}:where(.active)::before{background:var(--ha-assist-chip-active-container-color);opacity:var(--ha-assist-chip-active-container-opacity)}.label{font-family:var(--ha-font-family-body)}`],(0,o.Cg)([(0,c.MZ)({type:Boolean,reflect:!0})],d.prototype,"filled",void 0),(0,o.Cg)([(0,c.MZ)({type:Boolean})],d.prototype,"active",void 0),d=(0,o.Cg)([(0,c.EM)("ha-assist-chip")],d)},38962(t,e,a){a.a(t,async function(t,o){try{a.r(e);var i=a(62826),n=a(5124),s=a(22441),r=a(6412),l=a(93421),c=a(1087),d=a(26300),h=(a(67094),t([d]));d=(h.then?(await h)():h)[0];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",u={info:"M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",warning:"M12,2L1,21H23M12,6L19.53,19H4.47M11,10V14H13V10M11,16V18H13V16",error:"M11,15H13V17H11V15M11,7H13V13H11V7M12,2C6.47,2 2,6.5 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4A8,8 0 0,1 20,12A8,8 0 0,1 12,20Z",success:"M20,12A8,8 0 0,1 12,20A8,8 0 0,1 4,12A8,8 0 0,1 12,4C12.76,4 13.5,4.11 14.2,4.31L15.77,2.74C14.61,2.26 13.34,2 12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12M7.91,10.08L6.5,11.5L11,16L21,6L19.59,4.58L11,13.17L7.91,10.08Z"};class m extends n.WF{render(){return n.qy` <div class="issue-type ${(0,r.H)({[this.alertType]:!0})}" role="alert"> <div class="icon ${this.title?"":"no-title"}"> <slot name="icon"> <ha-svg-icon .path="${u[this.alertType]}"></ha-svg-icon> </slot> </div> <div class="${(0,r.H)({content:!0,narrow:this.narrow})}"> <div class="main-content"> ${this.title?n.qy`<div class="title">${this.title}</div>`:n.s6} <slot></slot> </div> <div class="action"> <slot name="action"> ${this.dismissable?n.qy`<ha-icon-button @click="${this._dismissClicked}" .label="${this._localize?.("ui.common.dismiss_alert")}" .path="${p}"></ha-icon-button>`:n.s6} </slot> </div> </div> </div> `}_dismissClicked(){(0,c.r)(this,"alert-dismissed-clicked")}constructor(...t){super(...t),this.title="",this.alertType="info",this.dismissable=!1,this.narrow=!1}}m.styles=n.AH`.issue-type{position:relative;padding:8px;display:flex}.icon{height:var(--ha-alert-icon-size,24px);width:var(--ha-alert-icon-size,24px)}.issue-type::after{position:absolute;top:0;right:0;bottom:0;left:0;opacity:.12;pointer-events:none;content:"";border-radius:var(--ha-border-radius-sm)}.icon.no-title{align-self:center}.content{display:flex;justify-content:space-between;align-items:center;width:100%;text-align:var(--float-start)}.content.narrow{flex-direction:column;align-items:flex-end}.action{z-index:1;width:min-content;--mdc-theme-primary:var(--primary-text-color)}.main-content{overflow-wrap:anywhere;word-break:break-word;line-height:normal;margin-left:8px;margin-right:0;margin-inline-start:8px;margin-inline-end:8px}.title{margin-top:2px;font-weight:var(--ha-font-weight-bold)}.action ha-icon-button{--mdc-theme-primary:var(--primary-text-color);--ha-icon-button-size:36px}.issue-type.info>.icon{color:var(--info-color)}.issue-type.info::after{background-color:var(--info-color)}.issue-type.warning>.icon{color:var(--warning-color)}.issue-type.warning::after{background-color:var(--warning-color)}.issue-type.error>.icon{color:var(--error-color)}.issue-type.error::after{background-color:var(--error-color)}.issue-type.success>.icon{color:var(--success-color)}.issue-type.success::after{background-color:var(--success-color)}:host ::slotted(ul){margin:0;padding-inline-start:20px}`,(0,i.Cg)([(0,s.MZ)()],m.prototype,"title",void 0),(0,i.Cg)([(0,s.MZ)({attribute:"alert-type"})],m.prototype,"alertType",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"dismissable",void 0),(0,i.Cg)([(0,s.wk)(),(0,l.IW)()],m.prototype,"_localize",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],m.prototype,"narrow",void 0),m=(0,i.Cg)([(0,s.EM)("ha-alert")],m),o()}catch(t){o(t)}})},43661(t,e,a){a.r(e),a.d(e,{HaIconNext:()=>r});var o=a(62826),i=a(22441),n=a(63091),s=a(67094);class r extends s.HaSvgIcon{constructor(...t){super(...t),this.path="rtl"===n.G.document.dir?"M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z":"M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"}}(0,o.Cg)([(0,i.MZ)()],r.prototype,"path",void 0),r=(0,o.Cg)([(0,i.EM)("ha-icon-next")],r)},28732(t,e,a){var o=a(62826),i=a(27686),n=a(7731),s=a(5124),r=a(22441);class l extends i.J{renderRipple(){return this.noninteractive?"":super.renderRipple()}static get styles(){return[n.R,s.AH`:host{padding-left:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-inline-start:var(--mdc-list-side-padding-left,var(--mdc-list-side-padding,20px));padding-right:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px));padding-inline-end:var(--mdc-list-side-padding-right,var(--mdc-list-side-padding,20px))}:host([graphic=avatar]:not([twoLine])),:host([graphic=icon]:not([twoLine])){height:48px}span.material-icons:first-of-type{margin-inline-start:0px!important;margin-inline-end:var(--mdc-list-item-graphic-margin,16px)!important;direction:var(--direction)!important}span.material-icons:last-of-type{margin-inline-start:auto!important;margin-inline-end:0px!important;direction:var(--direction)!important}.mdc-deprecated-list-item__meta{display:var(--mdc-list-item-meta-display);align-items:center;flex-shrink:0}:host([graphic=icon]:not([twoline])) .mdc-deprecated-list-item__graphic{margin-inline-end:var(--mdc-list-item-graphic-margin,20px)!important}:host([multiline-secondary]){height:auto}:host([multiline-secondary]) .mdc-deprecated-list-item__text{padding:8px 0}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text{text-overflow:initial;white-space:normal;overflow:auto;display:inline-block;margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text{margin-top:10px}:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text::before{display:none}:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text::before{display:none}:host([disabled]){color:var(--disabled-text-color)}:host([noninteractive]){pointer-events:unset}`,"rtl"===document.dir?s.AH`span.material-icons:first-of-type,span.material-icons:last-of-type{direction:rtl!important;--direction:rtl}`:s.AH``]}}l=(0,o.Cg)([(0,r.EM)("ha-list-item")],l)},8630(t,e,a){var o=a(62826),i=a(68618),n=a(11081),s=a(22441);class r extends i.iY{}r.styles=n.R,r=(0,o.Cg)([(0,s.EM)("ha-list")],r)},96832(t,e,a){a.a(t,async function(t,e){try{a(74423),a(18111),a(61701),a(18237);var o=a(62826),i=a(5124),n=a(22441),s=a(6412),r=a(89784),l=a(1087),c=a(34127),d=t([c]);c=(d.then?(await d)():d)[0];class h extends i.WF{render(){const t=this.segments.reduce((t,e,a)=>this.hiddenSegments?.includes(a)?t:t+e.value,0);return i.qy` <div class="container"> ${this.heading||this.description?i.qy` <div class="heading"> <div class="title"> <span>${this.heading}</span> <span>${this.description}</span> </div> <slot name="extra"></slot> </div> `:i.s6} <div class="bar"> ${this.segments.map((e,a)=>i.qy` ${this.hideTooltip||!e.label?i.s6:i.qy` <ha-tooltip for="segment-${a}" placement="top"> ${e.label} (${(e.value/t*100).toFixed(1)}%) </ha-tooltip> `} <div id="segment-${a}" class="${(0,s.H)({clickable:this.barClickable})}" data-index="${a}" @click="${this.barClickable?this._handleSegmentClick:i.s6}" style="${(0,r.W)({width:e.value/t*100+"%",backgroundColor:e.color,display:this.hiddenSegments?.includes(a)?"none":"block"})}"></div> `)} </div> ${this.hideLegend?i.s6:i.qy` <ul class="legend"> ${this.segments.map((t,e)=>t.label?i.qy` <li class="${(0,s.H)({clickable:this.clickable,hidden:this.hiddenSegments?.includes(e)})}" data-index="${e}" @click="${this.clickable?this._handleLegendClick:i.s6}"> <div class="bullet" style="${(0,r.W)({backgroundColor:t.color})}"></div> <span class="label">${t.label}</span> </li> `:i.s6)} </ul> `} </div> `}_handleSegmentClick(t){const e=t.currentTarget,a=Number(e.dataset.index),o=this.segments[a];o&&(0,l.r)(this,"segment-clicked",{index:a,segment:o})}_handleLegendClick(t){const e=t.currentTarget,a=Number(e.dataset.index),o=this.segments[a];o&&(0,l.r)(this,"legend-item-clicked",{index:a,segment:o})}constructor(...t){super(...t),this.hideLegend=!1,this.hideTooltip=!1,this.clickable=!1,this.barClickable=!1}}h.styles=i.AH`.container{width:100%}.heading{display:flex;flex-direction:row;gap:var(--ha-space-2)}.heading .title{flex:1}.heading .title span{color:var(--secondary-text-color);line-height:var(--ha-line-height-expanded);margin-right:8px}.heading .title span:first-child{color:var(--primary-text-color)}.bar{display:flex;overflow:hidden;border-radius:var(--ha-bar-border-radius,var(--ha-border-radius-sm));width:100%;height:12px;margin:2px 0;background-color:var(--ha-bar-background-color,var(--secondary-background-color))}.bar div{height:100%}.bar div.clickable{cursor:pointer}.bar div.clickable:hover{opacity:.8}.legend{display:flex;flex-direction:row;flex-wrap:wrap;gap:var(--ha-space-3);margin:12px 0;padding:0;list-style:none}.legend li{display:flex;align-items:center;gap:var(--ha-space-1);font-size:var(--ha-font-size-s)}.legend li .bullet{width:12px;height:12px;border-radius:var(--ha-border-radius-circle)}.spacer{flex:1}.legend li.clickable{cursor:pointer}.legend li.clickable:hover{opacity:.8}.legend li.hidden{opacity:.5}.legend li.hidden .label{text-decoration:line-through}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],h.prototype,"segments",void 0),(0,o.Cg)([(0,n.MZ)({type:String})],h.prototype,"heading",void 0),(0,o.Cg)([(0,n.MZ)({type:String})],h.prototype,"description",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"hide-legend"})],h.prototype,"hideLegend",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"hide-tooltip"})],h.prototype,"hideTooltip",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean})],h.prototype,"clickable",void 0),(0,o.Cg)([(0,n.MZ)({type:Boolean,attribute:"bar-clickable"})],h.prototype,"barClickable",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],h.prototype,"hiddenSegments",void 0),h=(0,o.Cg)([(0,n.EM)("ha-segmented-bar")],h),e()}catch(t){e(t)}})},47351(t,e,a){a.d(e,{PS:()=>o,Tv:()=>s,VR:()=>i,lE:()=>r});a(74423),a(17642),a(58004),a(33853),a(45876),a(32475),a(15024),a(31698);const o=t=>t.data,i=t=>"object"==typeof t?"object"==typeof t.body?t.body.message||"Unknown error, see supervisor logs":t.body||t.message||"Unknown error, see supervisor logs":t,n=new Set([502,503,504]),s=t=>!!(t&&t.status_code&&n.has(t.status_code))||!(!t||!t.message||!t.message.includes("ERR_CONNECTION_CLOSED")&&!t.message.includes("ERR_CONNECTION_RESET")),r=async(t,e)=>t({type:"supervisor/api",endpoint:`/${e}/stats`,method:"get"})},15336(t,e,a){a.d(e,{He:()=>c,Ku:()=>n,PB:()=>s,Wq:()=>p,hu:()=>l,mZ:()=>r,v9:()=>d,xY:()=>h});var o=a(62384),i=a(47351);const n=async t=>{if((0,o.v)(t.config.version,2021,2,4))return t.callWS({type:"supervisor/api",endpoint:"/host/info",method:"get"});const e=await t.callApi("GET","hassio/host/info");return(0,i.PS)(e)},s=async t=>(0,o.v)(t.config.version,2021,2,4)?t.callWS({type:"supervisor/api",endpoint:"/os/info",method:"get"}):(0,i.PS)(await t.callApi("GET","hassio/os/info")),r=async t=>(0,o.v)(t.config.version,2021,2,4)?t.callWS({type:"supervisor/api",endpoint:"/host/reboot",method:"post",timeout:null}):t.callApi("POST","hassio/host/reboot"),l=async t=>(0,o.v)(t.config.version,2021,2,4)?t.callWS({type:"supervisor/api",endpoint:"/host/shutdown",method:"post",timeout:null}):t.callApi("POST","hassio/host/shutdown"),c=async(t,e)=>(0,o.v)(t.config.version,2021,2,4)?t.callWS({type:"supervisor/api",endpoint:"/host/options",method:"post",data:e}):t.callApi("POST","hassio/host/options",e),d=async(t,e)=>(0,o.v)(t.config.version,2021,2,4)?t.callWS({type:"supervisor/api",endpoint:"/os/datadisk/move",method:"post",timeout:null,data:{device:e}}):t.callApi("POST","hassio/os/datadisk/move"),h=async t=>(0,o.v)(t.config.version,2021,2,4)?t.callWS({type:"supervisor/api",endpoint:"/os/datadisk/list",method:"get",timeout:null}):(0,i.PS)(await t.callApi("GET","/os/datadisk/list")),p=async t=>(0,o.v)(t.config.version,2021,2,4)?t.callWS({type:"supervisor/api",endpoint:"/host/disks/default/usage",method:"get",timeout:3600,params:{max_depth:3}}):(0,i.PS)(await t.callApi("GET","hassio/host/disks/default/usage"))},96273(t,e,a){a.d(e,{Bt:()=>l,Qf:()=>r,Su:()=>h,Wu:()=>o,bK:()=>s,dd:()=>d,f3:()=>n,h1:()=>i,wZ:()=>c});var o=function(t){return t.BIND="bind",t.CIFS="cifs",t.NFS="nfs",t}({}),i=function(t){return t.BACKUP="backup",t.MEDIA="media",t.SHARE="share",t}({}),n=function(t){return t.ACTIVE="active",t.FAILED="failed",t.UNKNOWN="unknown",t}({});const s=async t=>t.callWS({type:"supervisor/api",endpoint:"/mounts",method:"get",timeout:null}),r=async(t,e)=>t.callWS({type:"supervisor/api",endpoint:"/mounts",method:"post",timeout:null,data:e}),l=async(t,e)=>t.callWS({type:"supervisor/api",endpoint:`/mounts/${e.name}`,method:"put",timeout:null,data:e}),c=async(t,e)=>t.callWS({type:"supervisor/api",endpoint:`/mounts/${e}`,method:"delete",timeout:null}),d=async(t,e)=>t.callWS({type:"supervisor/api",endpoint:`/mounts/${e.name}/reload`,method:"post",timeout:null}),h=async(t,e)=>t.callWS({type:"supervisor/api",endpoint:"/mounts/options",method:"post",timeout:null,data:e})},94406(t,e,a){a.a(t,async function(t,o){try{a.r(e);a(74423),a(18111),a(22489),a(61701);var i=a(62826),n=a(5124),s=a(22441),r=a(36312),l=a(91926),c=a(67258),d=a(38962),h=a(18350),p=a(26300),u=(a(43661),a(8630),a(28732),a(96832)),m=(a(67094),a(47351)),g=a(15336),y=a(96273),f=a(65063),v=a(81310),_=a(13133),b=a(26008),w=a(99012),x=a(83870),$=t([d,h,p,u,v,_,x]);[d,h,p,u,v,_,x]=$.then?(await $)():$;const C="M12,3A9,9 0 0,0 3,12H0L4,16L8,12H5A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19C10.5,19 9.09,18.5 7.94,17.7L6.5,19.14C8.04,20.3 9.94,21 12,21A9,9 0 0,0 21,12A9,9 0 0,0 12,3M14,12A2,2 0 0,0 12,10A2,2 0 0,0 10,12A2,2 0 0,0 12,14A2,2 0 0,0 14,12Z",k="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",M="M11,9H13V7H11M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M11,17H13V11H11V17Z",A="M4,5C2.89,5 2,5.89 2,7V17C2,18.11 2.89,19 4,19H20C21.11,19 22,18.11 22,17V7C22,5.89 21.11,5 20,5H4M4.5,7A1,1 0 0,1 5.5,8A1,1 0 0,1 4.5,9A1,1 0 0,1 3.5,8A1,1 0 0,1 4.5,7M7,7H20V17H7V7M8,8V16H11V8H8M12,8V16H15V8H12M16,8V16H19V8H16M9,9H10V10H9V9M13,9H14V10H13V9M17,9H18V10H17V9Z",z="M19 3H5C3.89 3 3 3.89 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.89 20.1 3 19 3M10 16V8L15 12",I="M2 12C2 16.97 6.03 21 11 21C13.39 21 15.68 20.06 17.4 18.4L15.9 16.9C14.63 18.25 12.86 19 11 19C4.76 19 1.64 11.46 6.05 7.05C10.46 2.64 18 5.77 18 12H15L19 16H19.1L23 12H20C20 7.03 15.97 3 11 3C6.03 3 2 7.03 2 12Z";class T extends n.WF{firstUpdated(t){super.firstUpdated(t),(0,r.x)(this.hass.config,"hassio")&&this._load()}render(){if(void 0===this._mountsInfo)return n.s6;const t=this._mountsInfo?.mounts.filter(t=>[y.Wu.CIFS,y.Wu.NFS].includes(t.type)),e=this._hostInfo?.features.includes("haos");return n.qy` <hass-subpage back-path="/config/system" .hass="${this.hass}" .narrow="${this.narrow}" .header="${this.hass.localize("ui.panel.config.storage.caption")}"> <div class="content"> ${this._error?n.qy` <ha-alert alert-type="error">${this._error.message||this._error.code}</ha-alert> `:""} ${this._hostInfo?n.qy` <ha-card outlined .header="${this.hass.localize("ui.panel.config.storage.disk_metrics")}"> <div class="card-content"> <storage-breakdown-chart .hass="${this.hass}" .hostInfo="${this._hostInfo}" .storageInfo="${this._storageInfo}"></storage-breakdown-chart> ${this._renderDiskLifeTime(this._hostInfo.disk_life_time)} </div> ${this._hostInfo?n.qy`<div class="card-actions"> <ha-button appearance="plain" @click="${this._moveDatadisk}"> ${this.hass.localize("ui.panel.config.storage.datadisk.title")} </ha-button> </div>`:n.s6} </ha-card> `:""} <ha-card outlined .header="${this.hass.localize("ui.panel.config.storage.network_mounts.title")}"> ${null===this._mountsInfo?n.qy`<ha-alert class="mounts-not-supported" alert-type="warning" .title="${this.hass.localize("ui.panel.config.storage.network_mounts.not_supported.title")}"> ${e?n.qy`${this.hass.localize("ui.panel.config.storage.network_mounts.not_supported.os",{version:"10.2"})} <ha-button appearance="plain" slot="action" @click="${this._navigateToUpdates}"> ${this.hass.localize("ui.panel.config.storage.network_mounts.not_supported.navigate_to_updates")} </ha-button>`:this.hass.localize("ui.panel.config.storage.network_mounts.not_supported.supervised")} </ha-alert>`:t?.length?n.qy`<ha-list> ${t.map(t=>n.qy` <ha-list-item graphic="avatar" .mount="${t}" twoline hasMeta @click="${this._changeMount}"> <div slot="graphic"> <ha-svg-icon .path="${t.usage===y.h1.MEDIA?z:t.usage===y.h1.SHARE?k:C}"></ha-svg-icon> </div> <span class="mount-state-${t.state||"unknown"}"> ${t.name} </span> <span slot="secondary"> ${t.server}${t.port?`:${t.port}`:n.s6}${t.type===y.Wu.NFS?t.path:`:${t.share}`} </span> ${t.state!==y.f3.ACTIVE?n.qy`<ha-icon-button class="reload-btn" slot="meta" .mount="${t}" @click="${this._reloadMount}" .path="${I}"></ha-icon-button>`:n.qy`<ha-icon-next slot="meta"></ha-icon-next>`} </ha-list-item> `)} </ha-list>`:n.qy`<div class="no-mounts"> <ha-svg-icon .path="${A}"></ha-svg-icon> <p> ${this.hass.localize("ui.panel.config.storage.network_mounts.no_mounts")} </p> </div>`} ${null!==this._mountsInfo?n.qy`<div class="card-actions"> <ha-button appearance="plain" @click="${this._addMount}"> ${this.hass.localize("ui.panel.config.storage.network_mounts.add_title")} </ha-button> </div>`:n.s6} </ha-card> </div> </hass-subpage> `}_renderDiskLifeTime(t){if(null===t)return n.s6;const e=[{color:"var(--primary-color)",value:t},{color:"var(--ha-bar-background-color, var(--secondary-background-color))",value:100-t}];return n.qy` <ha-segmented-bar .heading="${this.hass.localize("ui.panel.config.storage.lifetime")}" .description="${this.hass.localize("ui.panel.config.storage.lifetime_description",{lifetime:`${t}${(0,c.d)(this.hass.locale)}%`})}" .segments="${e}" hide-legend hide-tooltip> <ha-tooltip slot="extra"> <ha-icon-button .path="${M}" class="help-button"></ha-icon-button> <p class="metric-description" slot="content"> ${this.hass.localize("ui.panel.config.storage.lifetime_used_description")} </p> </ha-tooltip> </ha-segmented-bar> `}async _load(){this._loadStorageInfo();try{this._hostInfo=await(0,g.Ku)(this.hass)}catch(t){this._error=t.message||t}this._hostInfo?.features.includes("mount")?await this._reloadMounts():this._mountsInfo=null}async _loadStorageInfo(){try{this._storageInfo=await(0,g.Wq)(this.hass)}catch(t){this._error=t.message||t,this._storageInfo=null}}_moveDatadisk(){(0,b.E)(this,{hostInfo:this._hostInfo})}async _navigateToUpdates(){(0,l.oo)("/config/updates")}async _reloadMount(t){t.stopPropagation();const e=t.currentTarget.mount;try{await(0,y.dd)(this.hass,e)}catch(t){return void(0,f.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.storage.network_mounts.errors.reload",{mount:e.name}),text:(0,m.VR)(t)})}await this._reloadMounts()}_addMount(){(0,w.O)(this,{reloadMounts:()=>this._reloadMounts()})}_changeMount(t){t.stopPropagation(),(0,w.O)(this,{mount:t.currentTarget.mount,reloadMounts:()=>this._reloadMounts()})}async _reloadMounts(){try{this._mountsInfo=await(0,y.bK)(this.hass)}catch(t){this._error=t.message||t,this._mountsInfo=null}}constructor(...t){super(...t),this.narrow=!1}}T.styles=n.AH`.content{padding:28px 20px 0;max-width:1040px;margin:0 auto}.card-actions{display:flex;justify-content:flex-end}ha-card{max-width:600px;margin:0 auto 12px;justify-content:space-between;flex-direction:column;display:flex}.card-content{display:flex;justify-content:space-between;flex-direction:column}.loading-container{position:relative}.loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background-color:rgba(var(--rgb-card-background-color),.75);display:flex;justify-content:center;align-items:center}.mount-state-failed{color:var(--error-color)}.mount-state-unknown{color:var(--warning-color)}.mounts-not-supported{padding:0 16px 16px}.reload-btn{float:right;position:relative;top:-10px;right:10px;inset-inline-end:10px;inset-inline-start:initial}.help-button{--ha-icon-button-size:20px;--mdc-icon-size:20px;color:var(--secondary-text-color)}.no-mounts{display:flex;flex-direction:column;align-items:center;text-align:center}.no-mounts ha-svg-icon{background-color:var(--light-primary-color);color:var(--secondary-text-color);padding:16px;border-radius:var(--ha-border-radius-circle);margin-bottom:8px}ha-list-item{--mdc-list-item-meta-size:auto;--mdc-list-item-meta-display:flex}ha-icon-next,ha-svg-icon{width:24px}ha-alert{--ha-alert-icon-size:24px}`,(0,i.Cg)([(0,s.MZ)({attribute:!1})],T.prototype,"hass",void 0),(0,i.Cg)([(0,s.MZ)({attribute:!1})],T.prototype,"route",void 0),(0,i.Cg)([(0,s.MZ)({type:Boolean})],T.prototype,"narrow",void 0),(0,i.Cg)([(0,s.wk)()],T.prototype,"_error",void 0),(0,i.Cg)([(0,s.wk)()],T.prototype,"_hostInfo",void 0),(0,i.Cg)([(0,s.wk)()],T.prototype,"_storageInfo",void 0),(0,i.Cg)([(0,s.wk)()],T.prototype,"_mountsInfo",void 0),T=(0,i.Cg)([(0,s.EM)("ha-config-section-storage")],T),o()}catch(t){o(t)}})},26008(t,e,a){a.d(e,{E:()=>i});var o=a(1087);const i=(t,e)=>{(0,o.r)(t,"show-dialog",{dialogTag:"dialog-move-datadisk",dialogImport:()=>Promise.all([a.e(34995),a.e(82201),a.e(3383)]).then(a.bind(a,12810)),dialogParams:e})}},99012(t,e,a){a.d(e,{O:()=>i});var o=a(1087);const i=(t,e)=>{(0,o.r)(t,"show-dialog",{dialogTag:"dialog-mount-view",dialogImport:()=>Promise.all([a.e(53480),a.e(70018)]).then(a.bind(a,67642)),dialogParams:e})}},83870(t,e,a){a.a(t,async function(t,e){try{a(44114),a(18111),a(7588),a(61701);var o=a(62826),i=a(5124),n=a(22441),s=a(22786),r=a(90433),l=a(86760),c=a(38962),d=a(26300),h=a(96832),p=a(65829),u=a(36240),m=t([l,c,d,h,p]);[l,c,d,h,p]=m.then?(await m)():m;const g="M13,2.05C18.05,2.55 22,6.82 22,12C22,13.45 21.68,14.83 21.12,16.07L18.5,14.54C18.82,13.75 19,12.9 19,12C19,8.47 16.39,5.57 13,5.08V2.05M12,19C14.21,19 16.17,18 17.45,16.38L20.05,17.91C18.23,20.39 15.3,22 12,22C6.47,22 2,17.5 2,12C2,6.81 5.94,2.55 11,2.05V5.08C7.61,5.57 5,8.47 5,12A7,7 0 0,0 12,19M12,6A6,6 0 0,1 18,12C18,14.97 15.84,17.44 13,17.92V14.83C14.17,14.42 15,13.31 15,12A3,3 0 0,0 12,9L11.45,9.05L9.91,6.38C10.56,6.13 11.26,6 12,6M6,12C6,10.14 6.85,8.5 8.18,7.38L9.72,10.05C9.27,10.57 9,11.26 9,12C9,13.31 9.83,14.42 11,14.83V17.92C8.16,17.44 6,14.97 6,12Z",y="M8,18H17V5H8M18,5V18H21V5M4,18H7V5H4V18Z";class f extends i.WF{render(){if(!this.hostInfo)return i.s6;const{totalSpaceGB:t,usedSpaceGB:e,freeSpaceGB:a}=this._computeSpaceValues(this.hostInfo,this.storageInfo),o=Boolean(this.storageInfo?.children?.length),n=this.hass.localize("ui.panel.config.storage.used_space"),s=this.hass.localize("ui.panel.config.storage.detailed_description",{used:`${(0,u.gN)(e)} GB`,total:`${(0,u.gN)(t)} GB`}),r="bar"===this._chartType||!o;return i.qy` <div class="header"> <div class="heading-text"> <span class="heading">${n}</span> <span class="description">${s}</span> </div> <ha-icon-button .path="${"sunburst"===this._chartType?y:g}" .label="${this.hass.localize("ui.panel.config.storage.change_chart_type")}" .disabled="${!o}" @click="${this._handleChartTypeChange}"></ha-icon-button> </div> <div class="chart-container ${this._chartType}"> ${r?i.qy`<ha-segmented-bar .heading="${""}" .segments="${this._computeSegments(this.storageInfo,e,a)}"></ha-segmented-bar>`:i.qy`<ha-sunburst-chart .hass="${this.hass}" .data="${this._transformToSunburstData(this.storageInfo)}" .valueFormatter="${this._formatBytes}"></ha-sunburst-chart>`} </div> ${this.storageInfo&&null!==this.storageInfo?i.s6:i.qy`<ha-alert alert-type="info"> <ha-spinner slot="icon"></ha-spinner> ${this.hass.localize("ui.panel.config.storage.loading_detailed")}</ha-alert>`} `}_handleChartTypeChange(){this._chartType="bar"===this._chartType?"sunburst":"bar"}_bytesToGB(t){return t/1024/1024/1024}_gbToBytes(t){return 1024*t*1024*1024}constructor(...t){super(...t),this._chartType="bar",this._computeSpaceValues=(0,s.A)((t,e)=>{let a=t.disk_total,o=t.disk_free||t.disk_total-t.disk_used,i=a-o;if(e){const n=e.total_bytes??this._gbToBytes(t.disk_total);a=this._bytesToGB(n),i=this._bytesToGB(e.used_bytes),o=this._bytesToGB(n-e.used_bytes)}return{totalSpaceGB:a,usedSpaceGB:i,freeSpaceGB:o}}),this._computeSegments=(0,s.A)((t,e,a)=>{const o=getComputedStyle(this),n=[];return t?t.children?.forEach((t,e)=>{if(t.used_bytes>0){const a=this._bytesToGB(t.used_bytes);n.push({value:a,color:(0,r.fI)(e,o),label:i.qy`${this.hass.localize(`ui.panel.config.storage.segments.${t.id}`)||t.label||t.id} <span style="color:var(--secondary-text-color)">${(0,u.gN)(a)} GB</span>`})}}):n.push({value:e,color:"var(--primary-color)",label:i.qy`${this.hass.localize("ui.panel.config.storage.segments.used")} <span style="color:var(--secondary-text-color)">${(0,u.gN)(e)} GB</span>`}),n.push({value:a,color:"var(--ha-bar-background-color, var(--secondary-background-color))",label:i.qy`${this.hass.localize("ui.panel.config.storage.segments.free")} <span style="color:var(--secondary-text-color)">${(0,u.gN)(a)} GB</span>`}),n}),this._transformToSunburstData=(0,s.A)(t=>{const e=(t,a)=>({id:a?`${a.id}.${t.id}`:t.id,name:this._formatLabel(t.id)||t.label,value:t.used_bytes,children:t.children?.map(a=>e(a,t))});return e(t)}),this._formatBytes=t=>{const e=this._bytesToGB(t);return`${(0,u.gN)(e)} GB`},this._formatLabel=t=>this.hass.localize(`ui.panel.config.storage.segments.${t}`)||t}}f.styles=i.AH`.header{display:flex;align-items:flex-end;gap:var(--ha-space-2)}.heading-text{display:flex;flex:1}.heading{color:var(--primary-text-color);line-height:var(--ha-line-height-expanded);margin-right:var(--ha-space-2)}.description{color:var(--secondary-text-color);line-height:var(--ha-line-height-expanded)}ha-icon-button{--ha-icon-button-size:36px;--mdc-icon-size:20px;color:var(--secondary-text-color)}.chart-container{transition:height var(--ha-animation-duration-slow) ease;overflow:hidden}.chart-container.bar{height:calc-size(auto,size)}.chart-container.sunburst{height:400px}ha-segmented-bar{display:block}ha-sunburst-chart{height:400px}ha-segmented-bar,ha-sunburst-chart{animation:fade-in var(--ha-animation-duration-slow) ease}@keyframes fade-in{from{opacity:0}to{opacity:1}}ha-alert{--ha-alert-icon-size:24px}ha-alert ha-spinner{--ha-spinner-size:24px}`,(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"hostInfo",void 0),(0,o.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"storageInfo",void 0),(0,o.Cg)([(0,n.wk)()],f.prototype,"_chartType",void 0),f=(0,o.Cg)([(0,n.EM)("storage-breakdown-chart")],f),e()}catch(t){e(t)}})},36240(t,e,a){a.d(e,{NN:()=>i,S8:()=>o,gN:()=>n});const o=(t,e,a)=>isNaN(t)||isNaN(e)||isNaN(a)?0:t>a?a:t<e?e:t,i=(t,e,a)=>100*(t-e)/(a-e),n=t=>Math.round(10*t)/10}};