homeassistant/custom_components/hacs/hacs_frontend_experimental/frontend_es5/5775.exb2O9gJQvY.js
2025-01-10 21:08:35 -08:00

2 lines
No EOL
10 KiB
JavaScript

"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([[5775],{58135:function(e,t,n){n.d(t,{z:function(){return i}});n(40271),n(60163);var i=function(e){return function(t,n){return e.includes(t,n)}}},58664:function(e,t,n){n.d(t,{v:function(){return a}});n(40271);var i=n(21157),r=n(36655);function a(e,t){var n=(0,r.M)(e.entity_id),a=void 0!==t?t:null==e?void 0:e.state;if(["button","event","input_button","scene"].includes(n))return a!==i.nZ;if((0,i.rk)(a))return!1;if(a===i.PX&&"alert"!==n)return!1;switch(n){case"alarm_control_panel":return"disarmed"!==a;case"alert":return"idle"!==a;case"cover":case"valve":return"closed"!==a;case"device_tracker":case"person":return"not_home"!==a;case"lawn_mower":return["mowing","error"].includes(a);case"lock":return"locked"!==a;case"media_player":return"standby"!==a;case"vacuum":return!["idle","docked","paused"].includes(a);case"plant":return"problem"===a;case"group":return["on","home","open","locked","problem"].includes(a);case"timer":return"active"===a;case"camera":return"streaming"===a}return!0}},11705:function(e,t,n){n.d(t,{T:function(){return r}});n(63789),n(99397);var i=/^(\w+)\.(\w+)$/,r=function(e){return i.test(e)}},91998:function(e,t,n){var i,r,a,u=n(88962),s=n(99312),o=n(81043),l=n(33368),c=n(71650),d=n(68308),f=n(82390),h=n(69205),v=n(91808),y=(n(97393),n(65974),n(87438),n(46798),n(9849),n(22890),n(40271),n(60163),n(37313),n(46349),n(70320),n(85717),n(90532),n(5095)),p=n(95260),m=n(14516),k=n(18394),_=n(36655),b=n(2733),g=n(1913),C=(n(16591),n(54371),n(37662),n(14303),n(28858));(0,v.Z)([(0,p.Mo)("ha-entity-picker")],(function(e,t){var n,v,w=function(t){function n(){var t;(0,c.Z)(this,n);for(var i=arguments.length,r=new Array(i),a=0;a<i;a++)r[a]=arguments[a];return t=(0,d.Z)(this,n,[].concat(r)),e((0,f.Z)(t)),t}return(0,h.Z)(n,t),(0,l.Z)(n)}(t);return{F:w,d:[{kind:"field",decorators:[(0,p.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,p.Cb)({type:Boolean})],key:"autofocus",value:function(){return!1}},{kind:"field",decorators:[(0,p.Cb)({type:Boolean})],key:"disabled",value:function(){return!1}},{kind:"field",decorators:[(0,p.Cb)({type:Boolean})],key:"required",value:function(){return!1}},{kind:"field",decorators:[(0,p.Cb)({type:Boolean,attribute:"allow-custom-entity"})],key:"allowCustomEntity",value:void 0},{kind:"field",decorators:[(0,p.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,p.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,p.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,p.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,p.Cb)({type:Array,attribute:"exclude-domains"})],key:"excludeDomains",value:void 0},{kind:"field",decorators:[(0,p.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,p.Cb)({type:Array,attribute:"include-unit-of-measurement"})],key:"includeUnitOfMeasurement",value:void 0},{kind:"field",decorators:[(0,p.Cb)({type:Array,attribute:"include-entities"})],key:"includeEntities",value:void 0},{kind:"field",decorators:[(0,p.Cb)({type:Array,attribute:"exclude-entities"})],key:"excludeEntities",value:void 0},{kind:"field",decorators:[(0,p.Cb)()],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,p.Cb)({type:Boolean})],key:"hideClearIcon",value:function(){return!1}},{kind:"field",decorators:[(0,p.Cb)({attribute:"item-label-path"})],key:"itemLabelPath",value:function(){return"friendly_name"}},{kind:"field",decorators:[(0,p.SB)()],key:"_opened",value:function(){return!1}},{kind:"field",decorators:[(0,p.IO)("ha-combo-box",!0)],key:"comboBox",value:void 0},{kind:"method",key:"open",value:(v=(0,o.Z)((0,s.Z)().mark((function e(){var t;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateComplete;case 2:return e.next=4,null===(t=this.comboBox)||void 0===t?void 0:t.open();case 4:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{kind:"method",key:"focus",value:(n=(0,o.Z)((0,s.Z)().mark((function e(){var t;return(0,s.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateComplete;case 2:return e.next=4,null===(t=this.comboBox)||void 0===t?void 0:t.focus();case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{kind:"field",key:"_initedStates",value:function(){return!1}},{kind:"field",key:"_states",value:function(){return[]}},{kind:"field",key:"_rowRenderer",value:function(){var e=this;return function(t){return(0,y.dy)(i||(i=(0,u.Z)(['<ha-list-item graphic="avatar" .twoline="','"> '," <span>",'</span> <span slot="secondary">',"</span> </ha-list-item>"])),!!t.entity_id,t.state?(0,y.dy)(r||(r=(0,u.Z)(['<state-badge slot="graphic" .stateObj="','" .hass="','"></state-badge>'])),t,e.hass):"",t.friendly_name,t.entity_id)}}},{kind:"field",key:"_getStates",value:function(){var e=this;return(0,m.Z)((function(t,n,i,r,a,u,s,o,l){var c=[];if(!n)return[];var d=Object.keys(n.states);return d.length?o?(d=d.filter((function(t){return e.includeEntities.includes(t)}))).map((function(e){var t=(0,b.C)(n.states[e])||e;return Object.assign(Object.assign({},n.states[e]),{},{friendly_name:t,strings:[e,t]})})).sort((function(t,n){return(0,C.f)(t.friendly_name,n.friendly_name,e.hass.locale.language)})):(l&&(d=d.filter((function(e){return!l.includes(e)}))),i&&(d=d.filter((function(e){return i.includes((0,_.M)(e))}))),r&&(d=d.filter((function(e){return!r.includes((0,_.M)(e))}))),c=d.map((function(e){var t=(0,b.C)(n.states[e])||e;return Object.assign(Object.assign({},n.states[e]),{},{friendly_name:t,strings:[e,t]})})).sort((function(t,n){return(0,C.f)(t.friendly_name,n.friendly_name,e.hass.locale.language)})),u&&(c=c.filter((function(t){return t.entity_id===e.value||t.attributes.device_class&&u.includes(t.attributes.device_class)}))),s&&(c=c.filter((function(t){return t.entity_id===e.value||t.attributes.unit_of_measurement&&s.includes(t.attributes.unit_of_measurement)}))),a&&(c=c.filter((function(t){return t.entity_id===e.value||a(t)}))),c.length?c:[{entity_id:"",state:"",last_changed:"",last_updated:"",context:{id:"",user_id:null,parent_id:null},friendly_name:e.hass.localize("ui.components.entity.entity-picker.no_match"),attributes:{friendly_name:e.hass.localize("ui.components.entity.entity-picker.no_match"),icon:"mdi:magnify"},strings:[]}]):[{entity_id:"",state:"",last_changed:"",last_updated:"",context:{id:"",user_id:null,parent_id:null},friendly_name:e.hass.localize("ui.components.entity.entity-picker.no_entities"),attributes:{friendly_name:e.hass.localize("ui.components.entity.entity-picker.no_entities"),icon:"mdi:magnify"},strings:[]}]}))}},{kind:"method",key:"shouldUpdate",value:function(e){return!!(e.has("value")||e.has("label")||e.has("disabled"))||!(!e.has("_opened")&&this._opened)}},{kind:"method",key:"willUpdate",value:function(e){(!this._initedStates||e.has("_opened")&&this._opened)&&(this._states=this._getStates(this._opened,this.hass,this.includeDomains,this.excludeDomains,this.entityFilter,this.includeDeviceClasses,this.includeUnitOfMeasurement,this.includeEntities,this.excludeEntities),this._initedStates&&(this.comboBox.filteredItems=this._states),this._initedStates=!0)}},{kind:"method",key:"render",value:function(){return(0,y.dy)(a||(a=(0,u.Z)([' <ha-combo-box item-value-path="entity_id" .itemLabelPath="','" .hass="','" .value="','" .label="','" .helper="','" .allowCustomValue="','" .filteredItems="','" .renderer="','" .required="','" .disabled="','" @opened-changed="','" @value-changed="','" @filter-changed="','"> </ha-combo-box> '])),this.itemLabelPath,this.hass,this._value,void 0===this.label?this.hass.localize("ui.components.entity.entity-picker.entity"):this.label,this.helper,this.allowCustomEntity,this._states,this._rowRenderer,this.required,this.disabled,this._openedChanged,this._valueChanged,this._filterChanged)}},{kind:"get",key:"_value",value:function(){return this.value||""}},{kind:"method",key:"_openedChanged",value:function(e){this._opened=e.detail.value}},{kind:"method",key:"_valueChanged",value:function(e){e.stopPropagation();var t=e.detail.value;t!==this._value&&this._setValue(t)}},{kind:"method",key:"_filterChanged",value:function(e){var t=e.target,n=e.detail.value.toLowerCase();t.filteredItems=n.length?(0,g.q)(n,this._states):this._states}},{kind:"method",key:"_setValue",value:function(e){var t=this;this.value=e,setTimeout((function(){(0,k.B)(t,"value-changed",{value:e}),(0,k.B)(t,"change")}),0)}}]}}),y.oi)},92599:function(e,t,n){n.d(t,{iI:function(){return r},oT:function(){return i}});n(99312),n(81043),n(83609),n(97393),n(46349),n(70320),n(22859),n(85717),n(46798),n(47084),n(88770),n(40271),n(60163),n(2094),"".concat(location.protocol,"//").concat(location.host);var i=function(e){return e.map((function(e){if("string"!==e.type)return e;switch(e.name){case"username":return Object.assign(Object.assign({},e),{},{autocomplete:"username"});case"password":return Object.assign(Object.assign({},e),{},{autocomplete:"current-password"});case"code":return Object.assign(Object.assign({},e),{},{autocomplete:"one-time-code"});default:return e}}))},r=function(e,t){return e.callWS({type:"auth/sign_path",path:t})}},21157:function(e,t,n){n.d(t,{PX:function(){return u},V_:function(){return s},nZ:function(){return r},rk:function(){return l}});var i=n(58135),r="unavailable",a="unknown",u="off",s=[r,a],o=[r,a,u],l=(0,i.z)(s);(0,i.z)(o)},92794:function(e,t,n){n.d(t,{m:function(){return s}});n(65974);var i=n(99312),r=n(81043),a=(n(97393),n(46798),n(47084),function(){var e=(0,r.Z)((0,i.Z)().mark((function e(t,n,r,u,s){var o,l,c,d,f,h,v,y=arguments;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(o=y.length,l=new Array(o>5?o-5:0),c=5;c<o;c++)l[c-5]=y[c];if(f=(d=s)[t],h=function(e){return u&&u(s,e.result)!==e.cacheKey?(d[t]=void 0,a.apply(void 0,[t,n,r,u,s].concat(l))):e.result},!f){e.next=6;break}return e.abrupt("return",f instanceof Promise?f.then(h):h(f));case 6:return v=r.apply(void 0,[s].concat(l)),d[t]=v,v.then((function(e){d[t]={result:e,cacheKey:null==u?void 0:u(s,e)},setTimeout((function(){d[t]=void 0}),n)}),(function(){d[t]=void 0})),e.abrupt("return",v);case 10:case"end":return e.stop()}}),e)})));return function(t,n,i,r,a){return e.apply(this,arguments)}}()),u=function(e){return e.callWS({type:"entity/source"})},s=function(e){return a("_entitySources",3e4,u,(function(e){return Object.keys(e.states).length}),e)}}}]);
//# sourceMappingURL=5775.exb2O9gJQvY.js.map