iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
3 lines • 36.3 kB
JavaScript
/*! For license information please see 47457.71e9b4fb239748c4.js.LICENSE.txt */
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["47457"],{42983:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),s=(i(19083),i(71695),i(92745),i(61893),i(9359),i(56475),i(31526),i(40251),i(61006),i(47021),i(87319),i(57243)),n=i(50778),o=i(27486),r=i(95262),l=i(36522),d=i(1416),c=i(17705),h=i(73192),u=i(94279),p=(i(37583),i(5460)),v=i(24360),f=e([u,p]);[u,p]=f.then?(await f)():f;let m,b,_,y,g=e=>e;(0,a.Z)([(0,n.Mo)("ha-statistic-picker")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,n.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"statistic-types"})],key:"statisticTypes",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"allow-custom-entity"})],key:"allowCustomEntity",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1,type:Array})],key:"statisticIds",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Array,attribute:"include-statistics-unit-of-measurement"})],key:"includeStatisticsUnitOfMeasurement",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"include-unit-class"})],key:"includeUnitClass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"include-device-class"})],key:"includeDeviceClass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"entities-only"})],key:"entitiesOnly",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Array,attribute:"exclude-statistics"})],key:"excludeStatistics",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"helpMissingEntityUrl",value(){return"/more-info/statistics/"}},{kind:"field",decorators:[(0,n.SB)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,n.IO)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_init",value(){return!1}},{kind:"field",key:"_statistics",value(){return[]}},{kind:"field",decorators:[(0,n.SB)()],key:"_filteredItems",value(){}},{kind:"field",key:"_rowRenderer",value(){return e=>(0,s.dy)(m||(m=g`<mwc-list-item graphic="avatar" twoline> ${0} <span>${0}</span> <span slot="secondary">${0}</span> </mwc-list-item>`),e.state?(0,s.dy)(b||(b=g`<state-badge slot="graphic" .stateObj="${0}" .hass="${0}"></state-badge>`),e.state,this.hass):"",e.name,""===e.id||"__missing"===e.id?(0,s.dy)(_||(_=g`<a target="_blank" rel="noopener noreferrer" href="${0}">${0}</a>`),(0,h.R)(this.hass,this.helpMissingEntityUrl),this.hass.localize("ui.components.statistic-picker.learn_more")):e.id)}},{kind:"field",key:"_getStatistics",value(){return(0,o.Z)(((e,t,i,a,s,n,o)=>{if(!e.length)return[{id:"",name:this.hass.localize("ui.components.statistic-picker.no_statistics"),strings:[]}];if(t){const i=(0,r.r)(t);e=e.filter((e=>i.includes(e.statistics_unit_of_measurement)))}if(i){const t=(0,r.r)(i);e=e.filter((e=>t.includes(e.unit_class)))}if(a){const t=(0,r.r)(a);e=e.filter((e=>{const i=this.hass.states[e.statistic_id];return!i||t.includes(i.attributes.device_class||"")}))}const l=[];return e.forEach((e=>{if(n&&e.statistic_id!==o&&n.includes(e.statistic_id))return;const t=this.hass.states[e.statistic_id];if(!t){if(!s){const t=e.statistic_id,i=(0,c.Kd)(this.hass,e.statistic_id,e);l.push({id:t,name:i,strings:[t,i]})}return}const i=e.statistic_id,a=(0,c.Kd)(this.hass,e.statistic_id,e);l.push({id:i,name:a,state:t,strings:[i,a]})})),l.length?(l.length>1&&l.sort(((e,t)=>(0,d.$K)(e.name||"",t.name||"",this.hass.locale.language))),l.push({id:"__missing",name:this.hass.localize("ui.components.statistic-picker.missing_entity"),strings:[]}),l):[{id:"",name:this.hass.localize("ui.components.statistic-picker.no_match"),strings:[]}]}))}},{kind:"method",key:"open",value:function(){var e;null===(e=this.comboBox)||void 0===e||e.open()}},{kind:"method",key:"focus",value:function(){var e;null===(e=this.comboBox)||void 0===e||e.focus()}},{kind:"method",key:"willUpdate",value:function(e){(!this.hasUpdated&&!this.statisticIds||e.has("statisticTypes"))&&this._getStatisticIds(),(!this._init&&this.statisticIds||e.has("_opened")&&this._opened)&&(this._init=!0,this.hasUpdated?this._statistics=this._getStatistics(this.statisticIds,this.includeStatisticsUnitOfMeasurement,this.includeUnitClass,this.includeDeviceClass,this.entitiesOnly,this.excludeStatistics,this.value):this.updateComplete.then((()=>{this._statistics=this._getStatistics(this.statisticIds,this.includeStatisticsUnitOfMeasurement,this.includeUnitClass,this.includeDeviceClass,this.entitiesOnly,this.excludeStatistics,this.value)})))}},{kind:"method",key:"render",value:function(){var e;return 0===this._statistics.length?s.Ld:(0,s.dy)(y||(y=g` <ha-combo-box .hass="${0}" .label="${0}" .value="${0}" .renderer="${0}" .disabled="${0}" .allowCustomValue="${0}" .items="${0}" .filteredItems="${0}" item-value-path="id" item-id-path="id" item-label-path="name" -changed="${0}" -changed="${0}" -changed="${0}"></ha-combo-box> `),this.hass,void 0===this.label&&this.hass?this.hass.localize("ui.components.statistic-picker.statistic"):this.label,this._value,this._rowRenderer,this.disabled,this.allowCustomEntity,this._statistics,null!==(e=this._filteredItems)&&void 0!==e?e:this._statistics,this._openedChanged,this._statisticChanged,this._filterChanged)}},{kind:"method",key:"_getStatisticIds",value:async function(){this.statisticIds=await(0,c.uR)(this.hass,this.statisticTypes)}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_statisticChanged",value:function(e){e.stopPropagation();let t=e.detail.value;"__missing"===t&&(t=""),t!==this._value&&this._setValue(t)}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_filterChanged",value:function(e){const t=e.detail.value.toLowerCase();this._filteredItems=t.length?(0,v.q)(t,this._statistics):void 0}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,l.B)(this,"value-changed",{value:e}),(0,l.B)(this,"change")}),0)}}]}}),s.oi);t()}catch(m){t(m)}}))},52131:function(e,t,i){i.a(e,(async function(e,t){try{var a=i(61701),s=(i(19083),i(71695),i(9359),i(56475),i(70104),i(40251),i(61006),i(47021),i(57243)),n=i(50778),o=i(91583),r=i(36522),l=i(42983),d=e([l]);l=(d.then?(await d)():d)[0];let c,h,u,p=e=>e;(0,a.Z)([(0,n.Mo)("ha-statistics-picker")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Array})],key:"value",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1,type:Array})],key:"statisticIds",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"statistic-types"})],key:"statisticTypes",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"picked-statistic-label"})],key:"pickedStatisticLabel",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"pick-statistic-label"})],key:"pickStatisticLabel",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"allow-custom-entity"})],key:"allowCustomEntity",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"include-statistics-unit-of-measurement"})],key:"includeStatisticsUnitOfMeasurement",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"include-unit-class"})],key:"includeUnitClass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"include-device-class"})],key:"includeDeviceClass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:Boolean,attribute:"ignore-restrictions-on-first-statistic"})],key:"ignoreRestrictionsOnFirstStatistic",value(){return!1}},{kind:"method",key:"render",value:function(){if(!this.hass)return s.Ld;const e=this.ignoreRestrictionsOnFirstStatistic&&this._currentStatistics.length<=1,t=e?void 0:this.includeStatisticsUnitOfMeasurement,i=e?void 0:this.includeUnitClass,a=e?void 0:this.includeDeviceClass,n=e?void 0:this.statisticTypes;return(0,s.dy)(c||(c=p` ${0} <div> <ha-statistic-picker .hass="${0}" .includeStatisticsUnitOfMeasurement="${0}" .includeUnitClass="${0}" .includeDeviceClass="${0}" .statisticTypes="${0}" .statisticIds="${0}" .label="${0}" .excludeStatistics="${0}" .allowCustomEntity="${0}" -changed="${0}"></ha-statistic-picker> </div> `),(0,o.r)(this._currentStatistics,(e=>e),(e=>(0,s.dy)(h||(h=p` <div> <ha-statistic-picker .curValue="${0}" .hass="${0}" .includeStatisticsUnitOfMeasurement="${0}" .includeUnitClass="${0}" .includeDeviceClass="${0}" .value="${0}" .statisticTypes="${0}" .statisticIds="${0}" .label="${0}" .excludeStatistics="${0}" .allowCustomEntity="${0}" -changed="${0}"></ha-statistic-picker> </div> `),e,this.hass,t,i,a,e,n,this.statisticIds,this.pickedStatisticLabel,this.value,this.allowCustomEntity,this._statisticChanged))),this.hass,this.includeStatisticsUnitOfMeasurement,this.includeUnitClass,this.includeDeviceClass,this.statisticTypes,this.statisticIds,this.pickStatisticLabel,this.value,this.allowCustomEntity,this._addStatistic)}},{kind:"get",key:"_currentStatistics",value:function(){return this.value||[]}},{kind:"method",key:"_updateStatistics",value:async function(e){this.value=e,(0,r.B)(this,"value-changed",{value:e})}},{kind:"method",key:"_statisticChanged",value:function(e){e.stopPropagation();const t=e.currentTarget.curValue,i=e.detail.value;if(i===t)return;const a=this._currentStatistics;i&&!a.includes(i)?this._updateStatistics(a.map((e=>e===t?i:e))):this._updateStatistics(a.filter((e=>e!==t)))}},{kind:"method",key:"_addStatistic",value:async function(e){e.stopPropagation();const t=e.detail.value;if(!t)return;if(e.currentTarget.value="",!t)return;const i=this._currentStatistics;i.includes(t)||this._updateStatistics([...i,t])}},{kind:"field",static:!0,key:"styles",value(){return(0,s.iv)(u||(u=p`:host{width:200px;display:block}ha-statistic-picker{display:block;width:100%;margin-top:8px}`))}}]}}),s.oi);t()}catch(c){t(c)}}))},83166:function(e,t,i){var a=i(61701),s=i(72621),n=(i(71695),i(47021),i(1105)),o=i(33990),r=i(57243),l=i(50778),d=i(5111);let c,h,u,p,v=e=>e;(0,a.Z)([(0,l.Mo)("ha-textfield")],(function(e,t){class i extends t{constructor(...t){super(...t),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"invalid",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:"error-message"})],key:"errorMessage",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"icon",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"iconTrailing",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)()],key:"autocomplete",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"autocorrect",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:"input-spellcheck"})],key:"inputSpellcheck",value:void 0},{kind:"field",decorators:[(0,l.IO)("input")],key:"formElement",value:void 0},{kind:"method",key:"updated",value:function(e){(0,s.Z)(i,"updated",this,3)([e]),(e.has("invalid")||e.has("errorMessage"))&&(this.setCustomValidity(this.invalid?this.errorMessage||this.validationMessage||"Invalid":""),(this.invalid||this.validateOnInitialRender||e.has("invalid")&&void 0!==e.get("invalid"))&&this.reportValidity()),e.has("autocomplete")&&(this.autocomplete?this.formElement.setAttribute("autocomplete",this.autocomplete):this.formElement.removeAttribute("autocomplete")),e.has("autocorrect")&&(this.autocorrect?this.formElement.setAttribute("autocorrect",this.autocorrect):this.formElement.removeAttribute("autocorrect")),e.has("inputSpellcheck")&&(this.inputSpellcheck?this.formElement.setAttribute("spellcheck",this.inputSpellcheck):this.formElement.removeAttribute("spellcheck"))}},{kind:"method",key:"renderIcon",value:function(e,t=!1){const i=t?"trailing":"leading";return(0,r.dy)(c||(c=v` <span class="mdc-text-field__icon mdc-text-field__icon--${0}" tabindex="${0}"> <slot name="${0}Icon"></slot> </span> `),i,t?1:-1,i)}},{kind:"field",static:!0,key:"styles",value(){return[o.W,(0,r.iv)(h||(h=v`.mdc-text-field__input{width:var(--ha-textfield-input-width,100%)}.mdc-text-field:not(.mdc-text-field--with-leading-icon){padding:var(--text-field-padding,0px 16px)}.mdc-text-field__affix--suffix{padding-left:var(--text-field-suffix-padding-left,12px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,12px);padding-inline-end:var(--text-field-suffix-padding-right,0px);direction:ltr}.mdc-text-field--with-leading-icon{padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,16px);direction:var(--direction)}.mdc-text-field--with-leading-icon.mdc-text-field--with-trailing-icon{padding-left:var(--text-field-suffix-padding-left,0px);padding-right:var(--text-field-suffix-padding-right,0px);padding-inline-start:var(--text-field-suffix-padding-left,0px);padding-inline-end:var(--text-field-suffix-padding-right,0px)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--suffix{color:var(--secondary-text-color)}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__icon{color:var(--secondary-text-color)}.mdc-text-field__icon--leading{margin-inline-start:16px;margin-inline-end:8px;direction:var(--direction)}.mdc-text-field__icon--trailing{padding:var(--textfield-icon-trailing-padding,12px)}.mdc-floating-label:not(.mdc-floating-label--float-above){text-overflow:ellipsis;width:inherit;padding-right:30px;padding-inline-end:30px;padding-inline-start:initial;box-sizing:border-box;direction:var(--direction)}input{text-align:var(--text-field-text-align,start)}input[type=color]{height:20px}::-ms-reveal{display:none}:host([no-spinner]) input::-webkit-inner-spin-button,:host([no-spinner]) input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=color]::-webkit-color-swatch-wrapper{padding:0}:host([no-spinner]) input[type=number]{-moz-appearance:textfield}.mdc-text-field__ripple{overflow:hidden}.mdc-text-field{overflow:var(--text-field-overflow)}.mdc-floating-label{inset-inline-start:16px!important;inset-inline-end:initial!important;transform-origin:var(--float-start);direction:var(--direction);text-align:var(--float-start)}.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label{max-width:calc(100% - 48px - var(--text-field-suffix-padding-left,0px));inset-inline-start:calc(48px + var(--text-field-suffix-padding-left,0px))!important;inset-inline-end:initial!important;direction:var(--direction)}.mdc-text-field__input[type=number]{direction:var(--direction)}.mdc-text-field__affix--prefix{padding-right:var(--text-field-prefix-padding-right,2px);padding-inline-end:var(--text-field-prefix-padding-right,2px);padding-inline-start:initial}.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field__affix--prefix{color:var(--mdc-text-field-label-ink-color)}#helper-text ha-markdown{display:inline-block}`)),"rtl"===d.E.document.dir?(0,r.iv)(u||(u=v`.mdc-floating-label,.mdc-text-field--with-leading-icon,.mdc-text-field--with-leading-icon.mdc-text-field--filled .mdc-floating-label,.mdc-text-field__icon--leading,.mdc-text-field__input[type=number]{direction:rtl;--direction:rtl}`)):(0,r.iv)(p||(p=v``))]}}]}}),n.P)},38070:function(e,t,i){i.d(t,{Q:()=>a});const a=["relative","total","date","time","datetime"]},23656:function(e,t,i){i.a(e,(async function(e,a){try{i.r(t),i.d(t,{HuiStatisticsGraphCardEditor:()=>O});var s=i(61701),n=(i(71695),i(92745),i(9359),i(56475),i(1331),i(31526),i(70104),i(52924),i(19423),i(40251),i(92519),i(42179),i(89256),i(24931),i(88463),i(57449),i(19814),i(47021),i(57243)),o=i(50778),r=i(27486),l=i(62900),d=i(95262),c=i(36522),h=i(48045),u=i(84892),p=i(52131),v=(i(29073),i(17705)),f=i(29401),m=i(18200),b=i(8148),_=i(56615),y=e([p,_,u]);[p,_,u]=y.then?(await y)():y;let g,x,k=e=>e;const w=(0,l.G0)([(0,l.i0)("state"),(0,l.i0)("sum"),(0,l.i0)("change"),(0,l.i0)("min"),(0,l.i0)("max"),(0,l.i0)("mean")]),C=(0,l.f0)(m.I,(0,l.Ry)({entities:(0,l.IX)(b.K),title:(0,l.jt)((0,l.Z_)()),days_to_show:(0,l.jt)((0,l.Rx)()),period:(0,l.jt)((0,l.G0)([(0,l.i0)("5minute"),(0,l.i0)("hour"),(0,l.i0)("day"),(0,l.i0)("week"),(0,l.i0)("month")])),chart_type:(0,l.jt)((0,l.G0)([(0,l.i0)("bar"),(0,l.i0)("line")])),stat_types:(0,l.jt)((0,l.G0)([(0,l.IX)(w),w])),unit:(0,l.jt)((0,l.Z_)()),hide_legend:(0,l.jt)((0,l.O7)()),logarithmic_scale:(0,l.jt)((0,l.O7)()),min_y_axis:(0,l.jt)((0,l.Rx)()),max_y_axis:(0,l.jt)((0,l.Rx)()),fit_y_data:(0,l.jt)((0,l.O7)())})),$=["5minute","hour","day","week","month"],S=["mean","min","max","sum","state","change"];let O=(0,s.Z)([(0,o.Mo)("hui-statistics-graph-card-editor")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,o.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_configEntities",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_metaDatas",value:void 0},{kind:"method",key:"setConfig",value:function(e){(0,l.hu)(e,C),this._config=e,this._configEntities=e.entities?(0,f.A)(e.entities,!1).map((e=>e.entity)):[]}},{kind:"field",key:"_getStatisticsMetaData",value(){return async e=>{this._metaDatas=await(0,v.Py)(this.hass,e||[])}}},{kind:"method",key:"willUpdate",value:function(e){var t;e.has("_configEntities")&&!(0,h.v)(this._configEntities,e.get("_configEntities"))&&(this._metaDatas=void 0,null!==(t=this._configEntities)&&void 0!==t&&t.length&&this._getStatisticsMetaData(this._configEntities))}},{kind:"field",key:"_schema",value(){return(0,r.Z)(((e,t,i,a)=>{const s=new Set;null==i||i.forEach((e=>{const t=(0,v.dO)(this.hass,e.statistic_id,e);t&&s.add(t)}));const n=[{name:"title",selector:{text:{}}},{name:"",type:"grid",schema:[{name:"period",required:!0,selector:{select:{options:$.map((i=>({value:i,label:e(`ui.panel.lovelace.editor.card.statistics-graph.periods.${i}`),disabled:"5minute"===i&&(null==t?void 0:t.some((e=>(0,v.Hs)(e))))})))}}},{name:"days_to_show",default:_.DEFAULT_DAYS_TO_SHOW,selector:{number:{min:1,mode:"box"}}},{name:"stat_types",required:!0,selector:{select:{multiple:!0,mode:"list",options:S.map((t=>({value:t,label:e(`ui.panel.lovelace.editor.card.statistics-graph.stat_type_labels.${t}`),disabled:!i||!i.some((e=>(0,v.Z0)(e,u.O[t])))})))}}},{name:"chart_type",required:!0,type:"select",options:[["line",e("ui.panel.lovelace.editor.card.statistics-graph.chart_type_labels.line")],["bar",e("ui.panel.lovelace.editor.card.statistics-graph.chart_type_labels.bar")]]},{name:"",type:"grid",schema:[{name:"min_y_axis",required:!1,selector:{number:{mode:"box",step:"any"}}},{name:"max_y_axis",required:!1,selector:{number:{mode:"box",step:"any"}}}]},...a?[{name:"fit_y_data",required:!1,selector:{boolean:{}}}]:[],{name:"hide_legend",required:!1,selector:{boolean:{}}},{name:"logarithmic_scale",required:!1,selector:{boolean:{}}}]}];return s.size>1&&n[1].schema.push({name:"unit",required:!1,selector:{select:{options:Array.from(s).map((e=>({value:e,label:e})))}}}),n}))}},{kind:"method",key:"render",value:function(){var e,t;if(!this.hass||!this._config)return n.Ld;const i=this._schema(this.hass.localize,this._configEntities,this._metaDatas,void 0!==this._config.min_y_axis||void 0!==this._config.max_y_axis),a=this._config.stat_types?(0,d.r)(this._config.stat_types):S.filter((e=>{var t;return null===(t=this._metaDatas)||void 0===t?void 0:t.some((t=>(0,v.Z0)(t,e)))})),s=Object.assign(Object.assign({chart_type:"line",period:"hour"},this._config),{},{stat_types:a}),o=null===(e=this._metaDatas)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.unit_class,r=o||null===(t=this._metaDatas)||void 0===t||null===(t=t[0])||void 0===t?void 0:t.statistics_unit_of_measurement;return(0,n.dy)(g||(g=k` <ha-form .hass="${0}" .data="${0}" .schema="${0}" .computeLabel="${0}" -changed="${0}"></ha-form> <ha-statistics-picker allow-custom-entity .hass="${0}" .pickStatisticLabel="${0}" .pickedStatisticLabel="${0}" .includeStatisticsUnitOfMeasurement="${0}" .includeUnitClass="${0}" .ignoreRestrictionsOnFirstStatistic="${0}" .value="${0}" .configValue="${0}" -changed="${0}"></ha-statistics-picker> `),this.hass,s,i,this._computeLabelCallback,this._valueChanged,this.hass,this.hass.localize("ui.panel.lovelace.editor.card.statistics-graph.pick_statistic"),this.hass.localize("ui.panel.lovelace.editor.card.statistics-graph.picked_statistic"),r,o,!0,this._configEntities,"entities",this._entitiesChanged)}},{kind:"method",key:"_valueChanged",value:function(e){(0,c.B)(this,"config-changed",{config:e.detail.value})}},{kind:"method",key:"_entitiesChanged",value:async function(e){const t=e.detail.value,i=t.map((e=>{const t=this._config.entities.find((t=>"string"!=typeof t&&t.entity===e));return null!=t?t:e})),a=Object.assign(Object.assign({},this._config),{},{entities:i});null!=t&&t.some((e=>(0,v.Hs)(e)))&&"5minute"===a.period&&delete a.period;const s=a.stat_types||a.unit?await(0,v.Py)(this.hass,t):void 0;a.stat_types&&a.entities.length&&(a.stat_types=(0,d.r)(a.stat_types).filter((e=>s.some((t=>(0,v.Z0)(t,e))))),a.stat_types.length||delete a.stat_types),a.unit&&!s.some((e=>(0,v.dO)(this.hass,null==e?void 0:e.statistic_id,e)===a.unit))&&delete a.unit,(0,c.B)(this,"config-changed",{config:a})}},{kind:"field",key:"_computeLabelCallback",value(){return e=>{switch(e.name){case"chart_type":case"stat_types":case"period":case"unit":case"hide_legend":case"logarithmic_scale":case"min_y_axis":case"max_y_axis":case"fit_y_data":return this.hass.localize(`ui.panel.lovelace.editor.card.statistics-graph.${e.name}`);default:return this.hass.localize(`ui.panel.lovelace.editor.card.generic.${e.name}`)}}}},{kind:"field",static:!0,key:"styles",value(){return(0,n.iv)(x||(x=k`ha-statistics-picker{width:100%}`))}}]}}),n.oi);a()}catch(g){a(g)}}))},18200:function(e,t,i){i.d(t,{I:()=>s});var a=i(62900);const s=(0,a.Ry)({type:(0,a.Z_)(),view_layout:(0,a.Yj)(),layout_options:(0,a.Yj)(),grid_options:(0,a.Yj)(),visibility:(0,a.Yj)()})},8148:function(e,t,i){i.d(t,{K:()=>o});var a=i(62900),s=i(38070),n=i(30571);const o=(0,a.G0)([(0,a.Ry)({entity:(0,a.Z_)(),name:(0,a.jt)((0,a.Z_)()),icon:(0,a.jt)((0,a.Z_)()),image:(0,a.jt)((0,a.Z_)()),secondary_info:(0,a.jt)((0,a.Z_)()),format:(0,a.jt)((0,a.kE)(s.Q)),state_color:(0,a.jt)((0,a.O7)()),tap_action:(0,a.jt)(n.fJ),hold_action:(0,a.jt)(n.fJ),double_tap_action:(0,a.jt)(n.fJ),confirmation:(0,a.jt)(n.TX)}),(0,a.Z_)()])},10445:function(e,t,i){i.d(t,{X:()=>m});var a=i(9065),s=i(50778),n=(i(71695),i(19423),i(47021),i(54835),i(57243)),o=i(4077);let r,l,d,c=e=>e;class h extends o.A{constructor(){super(...arguments),this.elevated=!1,this.href="",this.target=""}get primaryId(){return this.href?"link":"button"}get rippleDisabled(){return!this.href&&(this.disabled||this.softDisabled)}getContainerClasses(){return Object.assign(Object.assign({},super.getContainerClasses()),{},{disabled:!this.href&&(this.disabled||this.softDisabled),elevated:this.elevated,link:!!this.href})}renderPrimaryAction(e){const{ariaLabel:t}=this;return this.href?(0,n.dy)(r||(r=c` <a class="primary action" id="link" aria-label="${0}" href="${0}" target="${0}">${0}</a> `),t||n.Ld,this.href,this.target||n.Ld,e):(0,n.dy)(l||(l=c` <button class="primary action" id="button" aria-label="${0}" aria-disabled="${0}" ?disabled="${0}" type="button">${0}</button> `),t||n.Ld,this.softDisabled||n.Ld,this.disabled&&!this.alwaysFocusable,e)}renderOutline(){return this.elevated?(0,n.dy)(d||(d=c`<md-elevation part="elevation"></md-elevation>`)):super.renderOutline()}}(0,a.__decorate)([(0,s.Cb)({type:Boolean})],h.prototype,"elevated",void 0),(0,a.__decorate)([(0,s.Cb)()],h.prototype,"href",void 0),(0,a.__decorate)([(0,s.Cb)()],h.prototype,"target",void 0);let u;const p=(0,n.iv)(u||(u=(e=>e)`:host{--_container-height:var(--md-assist-chip-container-height, 32px);--_disabled-label-text-color:var(--md-assist-chip-disabled-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-label-text-opacity:var(--md-assist-chip-disabled-label-text-opacity, 0.38);--_elevated-container-color:var(--md-assist-chip-elevated-container-color, var(--md-sys-color-surface-container-low, #f7f2fa));--_elevated-container-elevation:var(--md-assist-chip-elevated-container-elevation, 1);--_elevated-container-shadow-color:var(--md-assist-chip-elevated-container-shadow-color, var(--md-sys-color-shadow, #000));--_elevated-disabled-container-color:var(--md-assist-chip-elevated-disabled-container-color, var(--md-sys-color-on-surface, #1d1b20));--_elevated-disabled-container-elevation:var(--md-assist-chip-elevated-disabled-container-elevation, 0);--_elevated-disabled-container-opacity:var(--md-assist-chip-elevated-disabled-container-opacity, 0.12);--_elevated-focus-container-elevation:var(--md-assist-chip-elevated-focus-container-elevation, 1);--_elevated-hover-container-elevation:var(--md-assist-chip-elevated-hover-container-elevation, 2);--_elevated-pressed-container-elevation:var(--md-assist-chip-elevated-pressed-container-elevation, 1);--_focus-label-text-color:var(--md-assist-chip-focus-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-label-text-color:var(--md-assist-chip-hover-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-color:var(--md-assist-chip-hover-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_hover-state-layer-opacity:var(--md-assist-chip-hover-state-layer-opacity, 0.08);--_label-text-color:var(--md-assist-chip-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_label-text-font:var(--md-assist-chip-label-text-font, var(--md-sys-typescale-label-large-font, var(--md-ref-typeface-plain, Roboto)));--_label-text-line-height:var(--md-assist-chip-label-text-line-height, var(--md-sys-typescale-label-large-line-height, 1.25rem));--_label-text-size:var(--md-assist-chip-label-text-size, var(--md-sys-typescale-label-large-size, 0.875rem));--_label-text-weight:var(--md-assist-chip-label-text-weight, var(--md-sys-typescale-label-large-weight, var(--md-ref-typeface-weight-medium, 500)));--_pressed-label-text-color:var(--md-assist-chip-pressed-label-text-color, var(--md-sys-color-on-surface, #1d1b20));--_pressed-state-layer-color:var(--md-assist-chip-pressed-state-layer-color, var(--md-sys-color-on-surface, #1d1b20));--_pressed-state-layer-opacity:var(--md-assist-chip-pressed-state-layer-opacity, 0.12);--_disabled-outline-color:var(--md-assist-chip-disabled-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-outline-opacity:var(--md-assist-chip-disabled-outline-opacity, 0.12);--_focus-outline-color:var(--md-assist-chip-focus-outline-color, var(--md-sys-color-on-surface, #1d1b20));--_outline-color:var(--md-assist-chip-outline-color, var(--md-sys-color-outline, #79747e));--_outline-width:var(--md-assist-chip-outline-width, 1px);--_disabled-leading-icon-color:var(--md-assist-chip-disabled-leading-icon-color, var(--md-sys-color-on-surface, #1d1b20));--_disabled-leading-icon-opacity:var(--md-assist-chip-disabled-leading-icon-opacity, 0.38);--_focus-leading-icon-color:var(--md-assist-chip-focus-leading-icon-color, var(--md-sys-color-primary, #6750a4));--_hover-leading-icon-color:var(--md-assist-chip-hover-leading-icon-color, var(--md-sys-color-primary, #6750a4));--_leading-icon-color:var(--md-assist-chip-leading-icon-color, var(--md-sys-color-primary, #6750a4));--_icon-size:var(--md-assist-chip-icon-size, 18px);--_pressed-leading-icon-color:var(--md-assist-chip-pressed-leading-icon-color, var(--md-sys-color-primary, #6750a4));--_container-shape-start-start:var(--md-assist-chip-container-shape-start-start, var(--md-assist-chip-container-shape, var(--md-sys-shape-corner-small, 8px)));--_container-shape-start-end:var(--md-assist-chip-container-shape-start-end, var(--md-assist-chip-container-shape, var(--md-sys-shape-corner-small, 8px)));--_container-shape-end-end:var(--md-assist-chip-container-shape-end-end, var(--md-assist-chip-container-shape, var(--md-sys-shape-corner-small, 8px)));--_container-shape-end-start:var(--md-assist-chip-container-shape-end-start, var(--md-assist-chip-container-shape, var(--md-sys-shape-corner-small, 8px)));--_leading-space:var(--md-assist-chip-leading-space, 16px);--_trailing-space:var(--md-assist-chip-trailing-space, 16px);--_icon-label-space:var(--md-assist-chip-icon-label-space, 8px);--_with-leading-icon-leading-space:var(--md-assist-chip-with-leading-icon-leading-space, 8px)}{.link .outline{border-color:ActiveText}}`));var v=i(29126),f=i(21016);let m=class extends h{};m.styles=[f.W,v.W,p],m=(0,a.__decorate)([(0,s.Mo)("md-assist-chip")],m)},4077:function(e,t,i){i.d(t,{A:()=>m});i(19423);var a=i(9065),s=(i(57618),i(23111),i(57243)),n=i(50778),o=i(35359),r=i(13823);let l,d,c,h,u,p,v=e=>e;const f=(0,r.T)(s.oi);class m extends f{get rippleDisabled(){return this.disabled||this.softDisabled}constructor(){super(),this.disabled=!1,this.softDisabled=!1,this.alwaysFocusable=!1,this.label="",this.hasIcon=!1,s.sk||this.addEventListener("click",this.handleClick.bind(this))}focus(e){this.disabled&&!this.alwaysFocusable||super.focus(e)}render(){return(0,s.dy)(l||(l=v` <div class="container ${0}"> ${0} </div> `),(0,o.$)(this.getContainerClasses()),this.renderContainerContent())}updated(e){e.has("disabled")&&void 0!==e.get("disabled")&&this.dispatchEvent(new Event("update-focus",{bubbles:!0}))}getContainerClasses(){return{disabled:this.disabled||this.softDisabled,"has-icon":this.hasIcon}}renderContainerContent(){return(0,s.dy)(d||(d=v` ${0} <md-focus-ring part="focus-ring" for="${0}"></md-focus-ring> <md-ripple for="${0}" ?disabled="${0}"></md-ripple> ${0} `),this.renderOutline(),this.primaryId,this.primaryId,this.rippleDisabled,this.renderPrimaryAction(this.renderPrimaryContent()))}renderOutline(){return(0,s.dy)(c||(c=v`<span class="outline"></span>`))}renderLeadingIcon(){return(0,s.dy)(h||(h=v`<slot name="icon" ="${0}"></slot>`),this.handleIconChange)}renderPrimaryContent(){return(0,s.dy)(u||(u=v` <span class="leading icon" aria-hidden="true"> ${0} </span> <span class="label"> <span class="label-text" id="label"> ${0} </span> </span> <span class="touch"></span> `),this.renderLeadingIcon(),this.label?this.label:(0,s.dy)(p||(p=v`<slot></slot>`)))}handleIconChange(e){const t=e.target;this.hasIcon=t.assignedElements({flatten:!0}).length>0}handleClick(e){if(this.softDisabled||this.disabled&&this.alwaysFocusable)return e.stopImmediatePropagation(),void e.preventDefault()}}m.shadowRootOptions=Object.assign(Object.assign({},s.oi.shadowRootOptions),{},{delegatesFocus:!0}),(0,a.__decorate)([(0,n.Cb)({type:Boolean,reflect:!0})],m.prototype,"disabled",void 0),(0,a.__decorate)([(0,n.Cb)({type:Boolean,attribute:"soft-disabled",reflect:!0})],m.prototype,"softDisabled",void 0),(0,a.__decorate)([(0,n.Cb)({type:Boolean,attribute:"always-focusable"})],m.prototype,"alwaysFocusable",void 0),(0,a.__decorate)([(0,n.Cb)()],m.prototype,"label",void 0),(0,a.__decorate)([(0,n.Cb)({type:Boolean,reflect:!0,attribute:"has-icon"})],m.prototype,"hasIcon",void 0)},29126:function(e,t,i){i.d(t,{W:()=>s});let a;const s=(0,i(57243).iv)(a||(a=(e=>e)`.elevated{--md-elevation-level:var(--_elevated-container-elevation);--md-elevation-shadow-color:var(--_elevated-container-shadow-color)}.elevated::before{background:var(--_elevated-container-color)}.elevated:hover{--md-elevation-level:var(--_elevated-hover-container-elevation)}.elevated:focus-within{--md-elevation-level:var(--_elevated-focus-container-elevation)}.elevated:active{--md-elevation-level:var(--_elevated-pressed-container-elevation)}.elevated.disabled{--md-elevation-level:var(--_elevated-disabled-container-elevation)}.elevated.disabled::before{background:var(--_elevated-disabled-container-color);opacity:var(--_elevated-disabled-container-opacity)}{.elevated md-elevation{border:1px solid CanvasText}.elevated.disabled md-elevation{border-color:GrayText}}`))},21016:function(e,t,i){i.d(t,{W:()=>s});let a;const s=(0,i(57243).iv)(a||(a=(e=>e)`:host{border-start-start-radius:var(--_container-shape-start-start);border-start-end-radius:var(--_container-shape-start-end);border-end-start-radius:var(--_container-shape-end-start);border-end-end-radius:var(--_container-shape-end-end);display:inline-flex;height:var(--_container-height);cursor:pointer;-webkit-tap-highlight-color:transparent;--md-ripple-hover-color:var(--_hover-state-layer-color);--md-ripple-hover-opacity:var(--_hover-state-layer-opacity);--md-ripple-pressed-color:var(--_pressed-state-layer-color);--md-ripple-pressed-opacity:var(--_pressed-state-layer-opacity)}:host(:is([disabled],[soft-disabled])){pointer-events:none}:host([touch-target=wrapper]){margin:max(0px,(48px - var(--_container-height))/2) 0}md-focus-ring{--md-focus-ring-shape-start-start:var(--_container-shape-start-start);--md-focus-ring-shape-start-end:var(--_container-shape-start-end);--md-focus-ring-shape-end-end:var(--_container-shape-end-end);--md-focus-ring-shape-end-start:var(--_container-shape-end-start)}.container{border-radius:inherit;box-sizing:border-box;display:flex;height:100%;position:relative;width:100%}.container::before{border-radius:inherit;content:"";inset:0;pointer-events:none;position:absolute}.container:not(.disabled){cursor:pointer}.container.disabled{pointer-events:none}.cell{display:flex}.action{align-items:baseline;appearance:none;background:0 0;border:none;border-radius:inherit;display:flex;outline:0;padding:0;position:relative;text-decoration:none}.primary.action{min-width:0;padding-inline-start:var(--_leading-space);padding-inline-end:var(--_trailing-space)}.has-icon .primary.action{padding-inline-start:var(--_with-leading-icon-leading-space)}.touch{height:48px;inset:50% 0 0;position:absolute;transform:translateY(-50%);width:100%}:host([touch-target=none]) .touch{display:none}.outline{border:var(--_outline-width) solid var(--_outline-color);border-radius:inherit;inset:0;pointer-events:none;position:absolute}:where(:focus) .outline{border-color:var(--_focus-outline-color)}:where(.disabled) .outline{border-color:var(--_disabled-outline-color);opacity:var(--_disabled-outline-opacity)}md-ripple{border-radius:inherit}.icon,.label,.touch{z-index:1}.label{align-items:center;color:var(--_label-text-color);display:flex;font-family:var(--_label-text-font);font-size:var(--_label-text-size);font-weight:var(--_label-text-weight);height:100%;line-height:var(--_label-text-line-height);overflow:hidden;user-select:none}.label-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(:hover) .label{color:var(--_hover-label-text-color)}:where(:focus) .label{color:var(--_focus-label-text-color)}:where(:active) .label{color:var(--_pressed-label-text-color)}:where(.disabled) .label{color:var(--_disabled-label-text-color);opacity:var(--_disabled-label-text-opacity)}.icon{align-self:center;display:flex;fill:currentColor;position:relative}.icon ::slotted(:first-child){font-size:var(--_icon-size);height:var(--_icon-size);width:var(--_icon-size)}.leading.icon{color:var(--_leading-icon-color)}.leading.icon ::slotted(*),.leading.icon svg{margin-inline-end:var(--_icon-label-space)}:where(:hover) .leading.icon{color:var(--_hover-leading-icon-color)}:where(:focus) .leading.icon{color:var(--_focus-leading-icon-color)}:where(:active) .leading.icon{color:var(--_pressed-leading-icon-color)}:where(.disabled) .leading.icon{color:var(--_disabled-leading-icon-color);opacity:var(--_disabled-leading-icon-opacity)}{:where(.disabled) :is(.label,.outline,.leading.icon){color:GrayText;opacity:1}}a,button{text-transform:inherit}a,button:not(:disabled,[aria-disabled=true]){cursor:inherit}`))},5376:function(e,t,i){i.d(t,{X:()=>o});var a=i(34151),s=i(76808),n=i(14276);function o(e,t,i){const o=(0,n._)(e,t)/s.yJ;return(0,a.u)(null==i?void 0:i.roundingMethod)(o)}}}]);
//# sourceMappingURL=47457.71e9b4fb239748c4.js.map