Files
haos_config/custom_components/hacs/hacs_frontend/frontend_es5/9009.db9db3591c1c285a.js
2026-01-30 23:31:00 -06:00

5 lines
16 KiB
JavaScript

"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([["9009"],{73386:function(e,i,t){t.d(i,{I:function(){return s},k:function(){return a}});t(71695),t(92519),t(42179),t(89256),t(24931),t(88463),t(57449),t(19814),t(47021);const a=new Set(["primary","accent","disabled","red","pink","purple","deep-purple","indigo","blue","light-blue","cyan","teal","green","light-green","lime","yellow","amber","orange","deep-orange","brown","light-grey","grey","dark-grey","blue-grey","black","white"]);function s(e){return a.has(e)?`var(--${e}-color)`:e}},84573:function(e,i,t){var a=t(73577),s=(t(71695),t(47021),t(74763)),l=t(50778);(0,a.Z)([(0,l.Mo)("ha-chip-set")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[]}}),s.l)},13978:function(e,i,t){var a=t(73577),s=t(72621),l=(t(71695),t(47021),t(74514)),n=t(57243),o=t(50778);let d,r=e=>e;(0,a.Z)([(0,o.Mo)("ha-input-chip")],(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",static:!0,key:"styles",value(){return[...(0,s.Z)(t,"styles",this),(0,n.iv)(d||(d=r`:host{--md-sys-color-primary:var(--primary-text-color);--md-sys-color-on-surface:var(--primary-text-color);--md-sys-color-on-surface-variant:var(--primary-text-color);--md-sys-color-on-secondary-container:var(--primary-text-color);--md-input-chip-container-shape:16px;--md-input-chip-outline-color:var(--outline-color);--md-input-chip-selected-container-color:rgba(
var(--rgb-primary-text-color),
0.15
);--ha-input-chip-selected-container-opacity:1;--md-input-chip-label-text-font:Roboto,sans-serif}::slotted([slot=icon]){display:flex;--mdc-icon-size:var(--md-input-chip-icon-size, 18px)}.selected::before{opacity:var(--ha-input-chip-selected-container-opacity)}`))]}}]}}),l.W)},21930:function(e,i,t){t.a(e,(async function(e,i){try{var a=t(73577),s=(t(19083),t(71695),t(19423),t(40251),t(92519),t(42179),t(89256),t(24931),t(88463),t(57449),t(19814),t(61006),t(39527),t(92181),t(99790),t(67670),t(41360),t(13334),t(36993),t(47021),t(57243)),l=t(50778),n=t(35359),o=t(27486),d=t(11297),r=t(79575),c=t(59848),u=t(92374),h=t(11960),b=t(44573),v=t(87022),p=t(69484),k=(t(59897),t(74064),t(10508),e([p]));p=(k.then?(await k)():k)[0];let f,y,m,_=e=>e;const g="___ADD_NEW___",C="___NO_LABELS___",x="___ADD_NEW_SUGGESTION___",$=e=>(0,s.dy)(f||(f=_`<ha-list-item graphic="icon" class="${0}"> ${0} ${0} </ha-list-item>`),(0,n.$)({"add-new":e.label_id===g}),e.icon?(0,s.dy)(y||(y=_`<ha-icon slot="graphic" .icon="${0}"></ha-icon>`),e.icon):s.Ld,e.name);(0,a.Z)([(0,l.Mo)("ha-label-picker")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean,attribute:"no-add"})],key:"noAdd",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"exclude-label"})],key:"excludeLabels",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,l.SB)()],key:"_opened",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_labels",value:void 0},{kind:"field",decorators:[(0,l.IO)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"field",key:"_suggestion",value:void 0},{kind:"field",key:"_init",value(){return!1}},{kind:"method",key:"open",value:async function(){var e;await this.updateComplete,await(null===(e=this.comboBox)||void 0===e?void 0:e.open())}},{kind:"method",key:"focus",value:async function(){var e;await this.updateComplete,await(null===(e=this.comboBox)||void 0===e?void 0:e.focus())}},{kind:"method",key:"hassSubscribe",value:function(){return[(0,h.f4)(this.hass.connection,(e=>{this._labels=e}))]}},{kind:"field",key:"_getLabels",value(){return(0,o.Z)(((e,i,t,a,s,l,n,o,d,c,h)=>{let b,v,p={};(s||l||n||o||d)&&(p=(0,u.R6)(a),b=t,v=a.filter((e=>e.labels.length>0)),s&&(b=b.filter((e=>{const i=p[e.id];return!(!i||!i.length)&&p[e.id].some((e=>s.includes((0,r.M)(e.entity_id))))})),v=v.filter((e=>s.includes((0,r.M)(e.entity_id))))),l&&(b=b.filter((e=>{const i=p[e.id];return!i||!i.length||a.every((e=>!l.includes((0,r.M)(e.entity_id))))})),v=v.filter((e=>!l.includes((0,r.M)(e.entity_id))))),n&&(b=b.filter((e=>{const i=p[e.id];return!(!i||!i.length)&&p[e.id].some((e=>{const i=this.hass.states[e.entity_id];return!!i&&(i.attributes.device_class&&n.includes(i.attributes.device_class))}))})),v=v.filter((e=>{const i=this.hass.states[e.entity_id];return i.attributes.device_class&&n.includes(i.attributes.device_class)}))),o&&(b=b.filter((e=>o(e)))),d&&(b=b.filter((e=>{const i=p[e.id];return!(!i||!i.length)&&p[e.id].some((e=>{const i=this.hass.states[e.entity_id];return!!i&&d(i)}))})),v=v.filter((e=>{const i=this.hass.states[e.entity_id];return!!i&&d(i)}))));let k=e;const f=new Set;let y;return b&&(y=b.filter((e=>e.area_id)).map((e=>e.area_id)),b.forEach((e=>{e.labels.forEach((e=>f.add(e)))}))),v&&(y=(null!=y?y:[]).concat(v.filter((e=>e.area_id)).map((e=>e.area_id))),v.forEach((e=>{e.labels.forEach((e=>f.add(e)))}))),y&&y.forEach((e=>{i[e].labels.forEach((e=>f.add(e)))})),h&&(k=k.filter((e=>!h.includes(e.label_id)))),(b||v)&&(k=k.filter((e=>f.has(e.label_id)))),k.length||(k=[{label_id:C,name:this.hass.localize("ui.components.label-picker.no_match"),icon:null,color:null,description:null,created_at:0,modified_at:0}]),c?k:[...k,{label_id:g,name:this.hass.localize("ui.components.label-picker.add_new"),icon:"mdi:plus",color:null,description:null,created_at:0,modified_at:0}]}))}},{kind:"method",key:"updated",value:function(e){if(!this._init&&this.hass&&this._labels||this._init&&e.has("_opened")&&this._opened){this._init=!0;const e=this._getLabels(this._labels,this.hass.areas,Object.values(this.hass.devices),Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.noAdd,this.excludeLabels).map((e=>Object.assign(Object.assign({},e),{},{strings:[e.label_id,e.name]})));this.comboBox.items=e,this.comboBox.filteredItems=e}}},{kind:"method",key:"render",value:function(){var e;return(0,s.dy)(m||(m=_` <ha-combo-box .hass="${0}" .helper="${0}" item-value-path="label_id" item-id-path="label_id" item-label-path="name" .value="${0}" .disabled="${0}" .required="${0}" .label="${0}" .placeholder="${0}" .renderer="${0}" @filter-changed="${0}" @opened-changed="${0}" @value-changed="${0}"> </ha-combo-box> `),this.hass,this.helper,this._value,this.disabled,this.required,void 0===this.label&&this.hass?this.hass.localize("ui.components.label-picker.label"):this.label,this.placeholder?null===(e=this._labels)||void 0===e||null===(e=e.find((e=>e.label_id===this.placeholder)))||void 0===e?void 0:e.name:void 0,$,this._filterChanged,this._openedChanged,this._labelChanged)}},{kind:"method",key:"_filterChanged",value:function(e){var i;const t=e.target,a=e.detail.value;if(!a)return void(this.comboBox.filteredItems=this.comboBox.items);const s=(0,c.q)(a,(null===(i=t.items)||void 0===i?void 0:i.filter((e=>![C,g].includes(e.label_id))))||[]);0===s.length?this.noAdd?this.comboBox.filteredItems=[{label_id:C,name:this.hass.localize("ui.components.label-picker.no_match"),icon:null,color:null}]:(this._suggestion=a,this.comboBox.filteredItems=[{label_id:x,name:this.hass.localize("ui.components.label-picker.add_new_sugestion",{name:this._suggestion}),icon:"mdi:plus",color:null}]):this.comboBox.filteredItems=s}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_labelChanged",value:function(e){e.stopPropagation();let i=e.detail.value;if(i===C)return i="",void this.comboBox.setInputValue("");[x,g].includes(i)?(e.target.value=this._value,this.hass.loadFragmentTranslation("config"),(0,v.T)(this,{entry:void 0,suggestedName:i===x?this._suggestion:"",createEntry:async e=>{const i=await(0,h.jo)(this.hass,e),t=[...this._labels,i];return this.comboBox.filteredItems=this._getLabels(t,this.hass.areas,Object.values(this.hass.devices),Object.values(this.hass.entities),this.includeDomains,this.excludeDomains,this.includeDeviceClasses,this.deviceFilter,this.entityFilter,this.noAdd,this.excludeLabels),await this.updateComplete,await this.comboBox.updateComplete,this._setValue(i.label_id),i}}),this._suggestion=void 0,this.comboBox.setInputValue("")):i!==this._value&&this._setValue(i)}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,d.B)(this,"value-changed",{value:e}),(0,d.B)(this,"change")}),0)}}]}}),(0,b.f)(s.oi));i()}catch(f){i(f)}}))},35760:function(e,i,t){t.a(e,(async function(e,i){try{var a=t(73577),s=(t(19083),t(71695),t(61893),t(40251),t(61006),t(39527),t(99790),t(41360),t(13334),t(47021),t(57243)),l=t(50778),n=t(91583),o=t(27486),d=t(73386),r=t(11297),c=t(32770),u=t(11960),h=t(44573),b=t(87022),v=(t(84573),t(13978),t(21930)),p=e([v]);v=(p.then?(await p)():p)[0];let k,f,y,m,_,g=e=>e;(0,a.Z)([(0,l.Mo)("ha-labels-picker")],(function(e,i){return{F:class extends i{constructor(...i){super(...i),e(this)}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,l.Cb)()],key:"placeholder",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean,attribute:"no-add"})],key:"noAdd",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Array,attribute:"exclude-label"})],key:"excludeLabels",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",decorators:[(0,l.Cb)({type:Boolean})],key:"required",value(){return!1}},{kind:"field",decorators:[(0,l.SB)()],key:"_labels",value:void 0},{kind:"field",decorators:[(0,l.IO)("ha-label-picker",!0)],key:"labelPicker",value:void 0},{kind:"method",key:"open",value:async function(){var e;await this.updateComplete,await(null===(e=this.labelPicker)||void 0===e?void 0:e.open())}},{kind:"method",key:"focus",value:async function(){var e;await this.updateComplete,await(null===(e=this.labelPicker)||void 0===e?void 0:e.focus())}},{kind:"method",key:"hassSubscribe",value:function(){return[(0,u.f4)(this.hass.connection,(e=>{const i={};e.forEach((e=>{i[e.label_id]=e})),this._labels=i}))]}},{kind:"field",key:"_sortedLabels",value(){return(0,o.Z)(((e,i,t)=>null==e?void 0:e.map((e=>null==i?void 0:i[e])).sort(((e,i)=>(0,c.$)((null==e?void 0:e.name)||"",(null==i?void 0:i.name)||"",t)))))}},{kind:"method",key:"render",value:function(){const e=this._sortedLabels(this.value,this._labels,this.hass.locale.language);return(0,s.dy)(k||(k=g` ${0} <ha-label-picker .hass="${0}" .helper="${0}" .disabled="${0}" .required="${0}" .label="${0}" .placeholder="${0}" .excludeLabels="${0}" @value-changed="${0}"> </ha-label-picker> `),null!=e&&e.length?(0,s.dy)(f||(f=g`<ha-chip-set> ${0} </ha-chip-set>`),(0,n.r)(e,(e=>null==e?void 0:e.label_id),(e=>{const i=null!=e&&e.color?(0,d.I)(e.color):void 0;return(0,s.dy)(y||(y=g` <ha-input-chip .item="${0}" @remove="${0}" @click="${0}" .label="${0}" selected="selected" style="${0}"> ${0} </ha-input-chip> `),e,this._removeItem,this._openDetail,null==e?void 0:e.name,i?`--color: ${i}`:"",null!=e&&e.icon?(0,s.dy)(m||(m=g`<ha-icon slot="icon" .icon="${0}"></ha-icon>`),e.icon):s.Ld)}))):s.Ld,this.hass,this.helper,this.disabled,this.required,void 0===this.label&&this.hass?this.hass.localize("ui.components.label-picker.add_label"):this.label,this.placeholder,this.value,this._labelChanged)}},{kind:"get",key:"_value",value:function(){return this.value||[]}},{kind:"method",key:"_removeItem",value:function(e){const i=e.currentTarget.item;this._setValue(this._value.filter((e=>e!==i.label_id)))}},{kind:"method",key:"_openDetail",value:function(e){const i=e.currentTarget.item;(0,b.T)(this,{entry:i,updateEntry:async e=>await(0,u.$0)(this.hass,i.label_id,e)})}},{kind:"method",key:"_labelChanged",value:function(e){e.stopPropagation();const i=e.detail.value;i&&!this._value.includes(i)&&(this._setValue([...this._value,i]),this.labelPicker.value="")}},{kind:"method",key:"_setValue",value:function(e){this.value=e,setTimeout((()=>{(0,r.B)(this,"value-changed",{value:e}),(0,r.B)(this,"change")}),0)}},{kind:"field",static:!0,key:"styles",value(){return(0,s.iv)(_||(_=g`ha-chip-set{margin-bottom:8px}ha-input-chip{--md-input-chip-selected-container-color:var(--color, var(--grey-color));--ha-input-chip-selected-container-opacity:0.5;--md-input-chip-selected-outline-width:1px}`))}}]}}),(0,h.f)(s.oi));i()}catch(k){i(k)}}))},11960:function(e,i,t){t.d(i,{$0:function(){return c},f4:function(){return d},jo:function(){return r}});t(61893),t(19423);var a=t(94787),s=t(32770),l=t(56587);const n=e=>e.sendMessagePromise({type:"config/label_registry/list"}).then((e=>e.sort(((e,i)=>(0,s.$)(e.name,i.name))))),o=(e,i)=>e.subscribeEvents((0,l.D)((()=>n(e).then((e=>i.setState(e,!0)))),500,!0),"label_registry_updated"),d=(e,i)=>(0,a.B)("_labelRegistry",n,o,e,i),r=(e,i)=>e.callWS(Object.assign({type:"config/label_registry/create"},i)),c=(e,i,t)=>e.callWS(Object.assign({type:"config/label_registry/update",label_id:i},t))},44573:function(e,i,t){t.d(i,{f:function(){return n}});var a=t(73577),s=t(72621),l=(t(19083),t(71695),t(40251),t(61006),t(39527),t(36993),t(47021),t(50778));const n=e=>(0,a.Z)(null,(function(e,i){class t extends i{constructor(...i){super(...i),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",key:"hassSubscribeRequiredHostProps",value:void 0},{kind:"field",key:"__unsubs",value:void 0},{kind:"method",key:"connectedCallback",value:function(){(0,s.Z)(t,"connectedCallback",this,3)([]),this._checkSubscribed()}},{kind:"method",key:"disconnectedCallback",value:function(){if((0,s.Z)(t,"disconnectedCallback",this,3)([]),this.__unsubs){for(;this.__unsubs.length;){const e=this.__unsubs.pop();e instanceof Promise?e.then((e=>e())):e()}this.__unsubs=void 0}}},{kind:"method",key:"updated",value:function(e){if((0,s.Z)(t,"updated",this,3)([e]),e.has("hass"))this._checkSubscribed();else if(this.hassSubscribeRequiredHostProps)for(const i of e.keys())if(this.hassSubscribeRequiredHostProps.includes(i))return void this._checkSubscribed()}},{kind:"method",key:"hassSubscribe",value:function(){return[]}},{kind:"method",key:"_checkSubscribed",value:function(){var e;void 0!==this.__unsubs||!this.isConnected||void 0===this.hass||null!==(e=this.hassSubscribeRequiredHostProps)&&void 0!==e&&e.some((e=>void 0===this[e]))||(this.__unsubs=this.hassSubscribe())}}]}}),e)},87022:function(e,i,t){t.d(i,{T:function(){return l}});t(71695),t(40251),t(47021);var a=t(11297);const s=()=>Promise.all([t.e("1552"),t.e("686"),t.e("6898"),t.e("513"),t.e("7420"),t.e("3693")]).then(t.bind(t,57834)),l=(e,i)=>{(0,a.B)(e,"show-dialog",{dialogTag:"dialog-label-detail",dialogImport:s,dialogParams:i})}}}]);
//# sourceMappingURL=9009.db9db3591c1c285a.js.map