mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-25 02:28:07 +00:00
1 line
39 KiB
JavaScript
1 line
39 KiB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[419],{42141:function(e,t,n){function i(e){return void 0===e||Array.isArray(e)?e:[e]}n.d(t,{r:function(){return i}})},40095:function(e,t,n){n.d(t,{e:function(){return i},f:function(){return r}});var i=function(e,t){return r(e.attributes,t)},r=function(e,t){return 0!=(e.supported_features&t)}},15033:function(e,t,n){n.r(t),n.d(t,{HaTargetSelector:function(){return Ee}});var i,r,o,a,s,c,l,d,u,p,f,h,v,m,y,b,k=n(37500),_=n(63550),g=n(14516),w=n(57292),E=n(74186),C=n(30715),x=n(33855),P=n(73826),D=n(67182),S=(n(51187),n(54444),n(8636)),O=n(47181),j=n(42141),z=n(58831),A=n(91741),T=n(57066);n(60033),n(46647),n(68101),n(66255),n(16235),n(52039);function F(e){return F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F(e)}function V(e){return function(e){if(Array.isArray(e))return ee(e)}(e)||te(e)||Y(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(l){return void n(l)}s.done?t(c):Promise.resolve(c).then(i,r)}function M(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function I(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=Y(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function H(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function B(e,t){return B=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},B(e,t)}function Z(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=U(e);if(t){var r=U(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return $(this,n)}}function $(e,t){if(t&&("object"===F(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return N(e)}function N(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function U(e){return U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},U(e)}function q(){q=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(n){t.forEach((function(t){t.kind===n&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var n=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var r=t.placement;if(t.kind===i&&("static"===r||"prototype"===r)){var o="static"===r?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var i=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],i=[],r={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,r)}),this),e.forEach((function(e){if(!W(e))return n.push(e);var t=this.decorateElement(e,r);n.push(t.element),n.push.apply(n,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:n,finishers:i};var o=this.decorateConstructor(n,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,n){var i=t[e.placement];if(!n&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var n=[],i=[],r=e.decorators,o=r.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,r[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&i.push(c.finisher);var l=c.extras;if(l){for(var d=0;d<l.length;d++)this.addElementPlacement(l[d],t);n.push.apply(n,l)}}return{element:e,finishers:i,extras:n}},decorateConstructor:function(e,t){for(var n=[],i=t.length-1;i>=0;i--){var r=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(r)||r);if(void 0!==o.finisher&&n.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:n}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||te(t)||Y(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var n=X(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var r=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:n,placement:i,descriptor:Object.assign({},r)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(r,"get","The property descriptor of a field descriptor"),this.disallowProperty(r,"set","The property descriptor of a field descriptor"),this.disallowProperty(r,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:Q(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var n=Q(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:n}},runClassFinishers:function(e,t){for(var n=0;n<t.length;n++){var i=(0,t[n])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,n){if(void 0!==e[t])throw new TypeError(n+" can't have a ."+t+" property.")}};return e}function G(e){var t,n=X(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:n,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function J(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function W(e){return e.decorators&&e.decorators.length}function K(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function Q(e,t){var n=e[t];if(void 0!==n&&"function"!=typeof n)throw new TypeError("Expected '"+t+"' to be a function");return n}function X(e){var t=function(e,t){if("object"!==F(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==F(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===F(t)?t:String(t)}function Y(e,t){if(e){if("string"==typeof e)return ee(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ee(e,t):void 0}}function ee(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function te(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}var ne,ie,re,oe="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z";!function(e,t,n,i){var r=q();if(i)for(var o=0;o<i.length;o++)r=i[o](r);var a=t((function(e){r.initializeInstanceElements(e,s.elements)}),n),s=r.decorateClass(function(e){for(var t=[],n=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var r,o=e[i];if("method"===o.kind&&(r=t.find(n)))if(K(o.descriptor)||K(r.descriptor)){if(W(o)||W(r))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");r.descriptor=o.descriptor}else{if(W(o)){if(W(r))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");r.decorators=o.decorators}J(o,r)}else t.push(o)}return t}(a.d.map(G)),e);r.initializeClassElements(a.F,s.elements),r.runClassFinishers(a.F,s.finishers)}([(0,_.Mo)("ha-target-picker")],(function(e,t){var n,g,C=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)}(i,t);var n=Z(i);function i(){var t;H(this,i);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return t=n.call.apply(n,[this].concat(o)),e(N(t)),t}return i}(t);return{F:C,d:[{kind:"field",decorators:[(0,_.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,_.Cb)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,_.Cb)({type:Array,attribute:"include-domains"})],key:"includeDomains",value:void 0},{kind:"field",decorators:[(0,_.Cb)({type:Array,attribute:"include-device-classes"})],key:"includeDeviceClasses",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"deviceFilter",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"entityRegFilter",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"entityFilter",value:void 0},{kind:"field",decorators:[(0,_.Cb)({type:Boolean,reflect:!0})],key:"disabled",value:function(){return!1}},{kind:"field",decorators:[(0,_.Cb)({type:Boolean})],key:"horizontal",value:function(){return!1}},{kind:"field",decorators:[(0,_.SB)()],key:"_areas",value:void 0},{kind:"field",decorators:[(0,_.SB)()],key:"_devices",value:void 0},{kind:"field",decorators:[(0,_.SB)()],key:"_entities",value:void 0},{kind:"field",decorators:[(0,_.SB)()],key:"_addMode",value:void 0},{kind:"field",decorators:[(0,_.IO)("#input")],key:"_inputElement",value:void 0},{kind:"method",key:"hassSubscribe",value:function(){var e=this;return[(0,T.sG)(this.hass.connection,(function(t){var n,i={},r=I(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;i[o.area_id]=o}}catch(a){r.e(a)}finally{r.f()}e._areas=i})),(0,w.q4)(this.hass.connection,(function(t){var n,i={},r=I(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;i[o.id]=o}}catch(a){r.e(a)}finally{r.f()}e._devices=i})),(0,E.LM)(this.hass.connection,(function(t){e._entities=t}))]}},{kind:"method",key:"render",value:function(){return this._areas&&this._devices&&this._entities?(0,k.dy)(r||(r=M(["\n ","\n "])),this.horizontal?(0,k.dy)(o||(o=M(['\n <div class="horizontal-container">\n '," ","\n </div>\n ","\n "])),this._renderChips(),this._renderPicker(),this._renderItems()):(0,k.dy)(a||(a=M(["\n <div>\n "," ","\n ","\n </div>\n "])),this._renderItems(),this._renderPicker(),this._renderChips())):(0,k.dy)(i||(i=M([""])))}},{kind:"method",key:"_renderItems",value:function(){var e,t,n,i=this;return(0,k.dy)(s||(s=M(['\n <div class="mdc-chip-set items">\n ',"\n ","\n ","\n </div>\n "])),null!==(e=this.value)&&void 0!==e&&e.area_id?(0,j.r)(this.value.area_id).map((function(e){var t=i._areas[e];return i._renderChip("area_id",e,(null==t?void 0:t.name)||e,void 0,"M12.5 7C12.5 5.89 13.39 5 14.5 5H18C19.1 5 20 5.9 20 7V9.16C18.84 9.57 18 10.67 18 11.97V14H12.5V7M6 11.96V14H11.5V7C11.5 5.89 10.61 5 9.5 5H6C4.9 5 4 5.9 4 7V9.15C5.16 9.56 6 10.67 6 11.96M20.66 10.03C19.68 10.19 19 11.12 19 12.12V15H5V12C5 10.9 4.11 10 3 10S1 10.9 1 12V17C1 18.1 1.9 19 3 19V21H5V19H19V21H21V19C22.1 19 23 18.1 23 17V12C23 10.79 21.91 9.82 20.66 10.03Z")})):"",null!==(t=this.value)&&void 0!==t&&t.device_id?(0,j.r)(this.value.device_id).map((function(e){var t=i._devices[e];return i._renderChip("device_id",e,t?(0,w.jL)(t,i.hass):e,void 0,"M3 6H21V4H3C1.9 4 1 4.9 1 6V18C1 19.1 1.9 20 3 20H7V18H3V6M13 12H9V13.78C8.39 14.33 8 15.11 8 16C8 16.89 8.39 17.67 9 18.22V20H13V18.22C13.61 17.67 14 16.88 14 16S13.61 14.33 13 13.78V12M11 17.5C10.17 17.5 9.5 16.83 9.5 16S10.17 14.5 11 14.5 12.5 15.17 12.5 16 11.83 17.5 11 17.5M22 8H16C15.5 8 15 8.5 15 9V19C15 19.5 15.5 20 16 20H22C22.5 20 23 19.5 23 19V9C23 8.5 22.5 8 22 8M21 18H17V10H21V18Z")})):"",null!==(n=this.value)&&void 0!==n&&n.entity_id?(0,j.r)(this.value.entity_id).map((function(e){var t=i.hass.states[e];return i._renderChip("entity_id",e,t?(0,A.C)(t):e,t)})):"")}},{kind:"method",key:"_renderChips",value:function(){return(0,k.dy)(c||(c=M(['\n <div class="mdc-chip-set">\n <div\n class="mdc-chip area_id add"\n .type=',"\n @click=",'\n >\n <div class="mdc-chip__ripple"></div>\n <ha-svg-icon\n class="mdc-chip__icon mdc-chip__icon--leading"\n .path=','\n ></ha-svg-icon>\n <span role="gridcell">\n <span role="button" tabindex="0" class="mdc-chip__primary-action">\n <span class="mdc-chip__text"\n >','</span\n >\n </span>\n </span>\n </div>\n <div\n class="mdc-chip device_id add"\n .type=',"\n @click=",'\n >\n <div class="mdc-chip__ripple"></div>\n <ha-svg-icon\n class="mdc-chip__icon mdc-chip__icon--leading"\n .path=','\n ></ha-svg-icon>\n <span role="gridcell">\n <span role="button" tabindex="0" class="mdc-chip__primary-action">\n <span class="mdc-chip__text"\n >','</span\n >\n </span>\n </span>\n </div>\n <div\n class="mdc-chip entity_id add"\n .type=',"\n @click=",'\n >\n <div class="mdc-chip__ripple"></div>\n <ha-svg-icon\n class="mdc-chip__icon mdc-chip__icon--leading"\n .path=','\n ></ha-svg-icon>\n <span role="gridcell">\n <span role="button" tabindex="0" class="mdc-chip__primary-action">\n <span class="mdc-chip__text"\n >',"</span\n >\n </span>\n </span>\n </div>\n </div>\n ","\n "])),"area_id",this._showPicker,oe,this.hass.localize("ui.components.target-picker.add_area_id"),"device_id",this._showPicker,oe,this.hass.localize("ui.components.target-picker.add_device_id"),"entity_id",this._showPicker,oe,this.hass.localize("ui.components.target-picker.add_entity_id"),this.helper?(0,k.dy)(l||(l=M(["<ha-input-helper-text>","</ha-input-helper-text>"])),this.helper):"")}},{kind:"method",key:"_showPicker",value:(n=regeneratorRuntime.mark((function e(t){var n,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._addMode=t.currentTarget.type,e.next=3,this.updateComplete;case 3:return e.next=5,null===(n=this._inputElement)||void 0===n?void 0:n.focus();case 5:return e.next=7,null===(i=this._inputElement)||void 0===i?void 0:i.open();case 7:case"end":return e.stop()}}),e,this)})),g=function(){var e=this,t=arguments;return new Promise((function(i,r){var o=n.apply(e,t);function a(e){L(o,i,r,a,s,"next",e)}function s(e){L(o,i,r,a,s,"throw",e)}a(void 0)}))},function(e){return g.apply(this,arguments)})},{kind:"method",key:"_renderChip",value:function(e,t,n,i,r){return(0,k.dy)(d||(d=M(['\n <div\n class="mdc-chip ','"\n >\n ',"\n ",'\n <span role="gridcell">\n <span role="button" tabindex="0" class="mdc-chip__primary-action">\n <span class="mdc-chip__text">',"</span>\n </span>\n </span>\n ",'\n <span role="gridcell">\n <ha-icon-button\n class="mdc-chip__icon mdc-chip__icon--trailing"\n tabindex="-1"\n role="button"\n .label=',"\n .path=","\n hideTooltip\n .id=","\n .type=","\n @click=",'\n ></ha-icon-button>\n <paper-tooltip animation-delay="0"\n >',"</paper-tooltip\n >\n </span>\n </div>\n "])),(0,S.$)(R({},e,!0)),r?(0,k.dy)(u||(u=M(['<ha-svg-icon\n class="mdc-chip__icon mdc-chip__icon--leading"\n .path=',"\n ></ha-svg-icon>"])),r):"",i?(0,k.dy)(p||(p=M(['<ha-state-icon\n class="mdc-chip__icon mdc-chip__icon--leading"\n .state=',"\n ></ha-state-icon>"])),i):"",n,"entity_id"===e?"":(0,k.dy)(f||(f=M([' <span role="gridcell">\n <ha-icon-button\n class="expand-btn mdc-chip__icon mdc-chip__icon--trailing"\n tabindex="-1"\n role="button"\n .label=',"\n .path=","\n hideTooltip\n .id=","\n .type=","\n @click=",'\n ></ha-icon-button>\n <paper-tooltip class="expand" animation-delay="0"\n >',"</paper-tooltip\n >\n </span>"])),this.hass.localize("ui.components.target-picker.expand"),"M18.17,12L15,8.83L16.41,7.41L21,12L16.41,16.58L15,15.17L18.17,12M5.83,12L9,15.17L7.59,16.59L3,12L7.59,7.42L9,8.83L5.83,12Z",t,e,this._handleExpand,this.hass.localize("ui.components.target-picker.expand_".concat(e))),this.hass.localize("ui.components.target-picker.remove"),"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",t,e,this._handleRemove,this.hass.localize("ui.components.target-picker.remove_".concat(e)))}},{kind:"method",key:"_renderPicker",value:function(){switch(this._addMode){case"area_id":return(0,k.dy)(h||(h=M(["\n <ha-area-picker\n .hass=",'\n id="input"\n .type=',"\n .label=","\n no-add\n .deviceFilter=","\n .entityFilter=","\n .includeDeviceClasses=","\n .includeDomains=","\n @value-changed=","\n ></ha-area-picker>\n "])),this.hass,"area_id",this.hass.localize("ui.components.target-picker.add_area_id"),this.deviceFilter,this.entityRegFilter,this.includeDeviceClasses,this.includeDomains,this._targetPicked);case"device_id":return(0,k.dy)(v||(v=M(["\n <ha-device-picker\n .hass=",'\n id="input"\n .type=',"\n .label=","\n .deviceFilter=","\n .entityFilter=","\n .includeDeviceClasses=","\n .includeDomains=","\n @value-changed=","\n ></ha-device-picker>\n "])),this.hass,"device_id",this.hass.localize("ui.components.target-picker.add_device_id"),this.deviceFilter,this.entityRegFilter,this.includeDeviceClasses,this.includeDomains,this._targetPicked);case"entity_id":return(0,k.dy)(m||(m=M(["\n <ha-entity-picker\n .hass=",'\n id="input"\n .type=',"\n .label=","\n .entityFilter=","\n .includeDeviceClasses=","\n .includeDomains=","\n @value-changed=","\n allow-custom-entity\n ></ha-entity-picker>\n "])),this.hass,"entity_id",this.hass.localize("ui.components.target-picker.add_entity_id"),this.entityFilter,this.includeDeviceClasses,this.includeDomains,this._targetPicked)}return(0,k.dy)(y||(y=M([""])))}},{kind:"method",key:"_targetPicked",value:function(e){if(e.stopPropagation(),e.detail.value){var t=e.detail.value,n=e.currentTarget;n.value="",this._addMode=void 0,(0,O.B)(this,"value-changed",{value:this.value?Object.assign({},this.value,R({},n.type,this.value[n.type]?[].concat(V((0,j.r)(this.value[n.type])),[t]):t)):R({},n.type,t)})}}},{kind:"method",key:"_handleExpand",value:function(e){var t=this,n=e.currentTarget,i=[],r=[];if("area_id"===n.type)Object.values(this._devices).forEach((function(e){var r;e.area_id!==n.id||null!==(r=t.value.device_id)&&void 0!==r&&r.includes(e.id)||!t._deviceMeetsFilter(e)||i.push(e.id)})),this._entities.forEach((function(e){var i;e.area_id!==n.id||null!==(i=t.value.entity_id)&&void 0!==i&&i.includes(e.entity_id)||!t._entityRegMeetsFilter(e)||r.push(e.entity_id)}));else{if("device_id"!==n.type)return;this._entities.forEach((function(e){var i;e.device_id!==n.id||null!==(i=t.value.entity_id)&&void 0!==i&&i.includes(e.entity_id)||!t._entityRegMeetsFilter(e)||r.push(e.entity_id)}))}var o=this.value;r.length&&(o=this._addItems(o,"entity_id",r)),i.length&&(o=this._addItems(o,"device_id",i)),o=this._removeItem(o,n.type,n.id),(0,O.B)(this,"value-changed",{value:o})}},{kind:"method",key:"_handleRemove",value:function(e){var t=e.currentTarget;(0,O.B)(this,"value-changed",{value:this._removeItem(this.value,t.type,t.id)})}},{kind:"method",key:"_addItems",value:function(e,t,n){return Object.assign({},e,R({},t,e[t]?(0,j.r)(e[t]).concat(n):n))}},{kind:"method",key:"_removeItem",value:function(e,t,n){var i=(0,j.r)(e[t]).filter((function(e){return String(e)!==n}));if(i.length)return Object.assign({},e,R({},t,i));var r=Object.assign({},e);return delete r[t],Object.keys(r).length?r:void 0}},{kind:"method",key:"_deviceMeetsFilter",value:function(e){var t,n=this,i=null===(t=this._entities)||void 0===t?void 0:t.filter((function(t){return t.device_id===e.id}));if(this.includeDomains){if(!i||!i.length)return!1;if(!i.some((function(e){return n.includeDomains.includes((0,z.M)(e.entity_id))})))return!1}if(this.includeDeviceClasses){if(!i||!i.length)return!1;if(!i.some((function(e){var t=n.hass.states[e.entity_id];return!!t&&(t.attributes.device_class&&n.includeDeviceClasses.includes(t.attributes.device_class))})))return!1}return!this.deviceFilter||this.deviceFilter(e)}},{kind:"method",key:"_entityRegMeetsFilter",value:function(e){if(e.entity_category)return!1;if(this.includeDomains&&!this.includeDomains.includes((0,z.M)(e.entity_id)))return!1;if(this.includeDeviceClasses){var t=this.hass.states[e.entity_id];if(!t)return!1;if(!t.attributes.device_class||!this.includeDeviceClasses.includes(t.attributes.device_class))return!1}return!this.entityRegFilter||this.entityRegFilter(e)}},{kind:"get",static:!0,key:"styles",value:function(){return(0,k.iv)(b||(b=M(["\n ","\n .horizontal-container {\n display: flex;\n flex-wrap: wrap;\n min-height: 56px;\n align-items: center;\n }\n .mdc-chip {\n color: var(--primary-text-color);\n }\n .items {\n z-index: 2;\n }\n .mdc-chip-set {\n padding: 4px 0;\n }\n .mdc-chip.add {\n color: rgba(0, 0, 0, 0.87);\n }\n .mdc-chip:not(.add) {\n cursor: default;\n }\n .mdc-chip ha-icon-button {\n --mdc-icon-button-size: 24px;\n display: flex;\n align-items: center;\n outline: none;\n }\n .mdc-chip ha-icon-button ha-svg-icon {\n border-radius: 50%;\n background: var(--secondary-text-color);\n }\n .mdc-chip__icon.mdc-chip__icon--trailing {\n width: 16px;\n height: 16px;\n --mdc-icon-size: 14px;\n color: var(--secondary-text-color);\n margin-inline-start: 4px !important;\n margin-inline-end: -4px !important;\n direction: var(--direction);\n }\n .mdc-chip__icon--leading {\n display: flex;\n align-items: center;\n justify-content: center;\n --mdc-icon-size: 20px;\n border-radius: 50%;\n padding: 6px;\n margin-left: -14px !important;\n margin-inline-start: -14px !important;\n margin-inline-end: 4px !important;\n direction: var(--direction);\n }\n .expand-btn {\n margin-right: 0;\n }\n .mdc-chip.area_id:not(.add) {\n border: 2px solid #fed6a4;\n background: var(--card-background-color);\n }\n .mdc-chip.area_id:not(.add) .mdc-chip__icon--leading,\n .mdc-chip.area_id.add {\n background: #fed6a4;\n }\n .mdc-chip.device_id:not(.add) {\n border: 2px solid #a8e1fb;\n background: var(--card-background-color);\n }\n .mdc-chip.device_id:not(.add) .mdc-chip__icon--leading,\n .mdc-chip.device_id.add {\n background: #a8e1fb;\n }\n .mdc-chip.entity_id:not(.add) {\n border: 2px solid #d2e7b9;\n background: var(--card-background-color);\n }\n .mdc-chip.entity_id:not(.add) .mdc-chip__icon--leading,\n .mdc-chip.entity_id.add {\n background: #d2e7b9;\n }\n .mdc-chip:hover {\n z-index: 5;\n }\n paper-tooltip.expand {\n min-width: 200px;\n }\n :host([disabled]) .mdc-chip {\n opacity: var(--light-disabled-opacity);\n pointer-events: none;\n }\n "])),(0,k.$m)(D))}}]}}),(0,P.f)(k.oi));function ae(e){return ae="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ae(e)}function se(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ce(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function le(e,t){return le=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},le(e,t)}function de(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=we(e);if(t){var r=we(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return ue(this,n)}}function ue(e,t){if(t&&("object"===ae(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return pe(e)}function pe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function fe(){fe=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(n){t.forEach((function(t){t.kind===n&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var n=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var r=t.placement;if(t.kind===i&&("static"===r||"prototype"===r)){var o="static"===r?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var i=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],i=[],r={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,r)}),this),e.forEach((function(e){if(!me(e))return n.push(e);var t=this.decorateElement(e,r);n.push(t.element),n.push.apply(n,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:n,finishers:i};var o=this.decorateConstructor(n,t);return i.push.apply(i,o.finishers),o.finishers=i,o},addElementPlacement:function(e,t,n){var i=t[e.placement];if(!n&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var n=[],i=[],r=e.decorators,o=r.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,r[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&i.push(c.finisher);var l=c.extras;if(l){for(var d=0;d<l.length;d++)this.addElementPlacement(l[d],t);n.push.apply(n,l)}}return{element:e,finishers:i,extras:n}},decorateConstructor:function(e,t){for(var n=[],i=t.length-1;i>=0;i--){var r=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(r)||r);if(void 0!==o.finisher&&n.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a<e.length-1;a++)for(var s=a+1;s<e.length;s++)if(e[a].key===e[s].key&&e[a].placement===e[s].placement)throw new TypeError("Duplicated element ("+e[a].key+")")}}return{elements:e,finishers:n}},fromElementDescriptor:function(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t},toElementDescriptors:function(e){var t;if(void 0!==e)return(t=e,function(e){if(Array.isArray(e))return e}(t)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return _e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_e(e,t):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).map((function(e){var t=this.toElementDescriptor(e);return this.disallowProperty(e,"finisher","An element descriptor"),this.disallowProperty(e,"extras","An element descriptor"),t}),this)},toElementDescriptor:function(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var n=ke(e.key),i=String(e.placement);if("static"!==i&&"prototype"!==i&&"own"!==i)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+i+'"');var r=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:n,placement:i,descriptor:Object.assign({},r)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(r,"get","The property descriptor of a field descriptor"),this.disallowProperty(r,"set","The property descriptor of a field descriptor"),this.disallowProperty(r,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:be(e,"finisher"),extras:this.toElementDescriptors(e.extras)}},fromClassDescriptor:function(e){var t={kind:"class",elements:e.map(this.fromElementDescriptor,this)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t},toClassDescriptor:function(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');this.disallowProperty(e,"key","A class descriptor"),this.disallowProperty(e,"placement","A class descriptor"),this.disallowProperty(e,"descriptor","A class descriptor"),this.disallowProperty(e,"initializer","A class descriptor"),this.disallowProperty(e,"extras","A class descriptor");var n=be(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:n}},runClassFinishers:function(e,t){for(var n=0;n<t.length;n++){var i=(0,t[n])(e);if(void 0!==i){if("function"!=typeof i)throw new TypeError("Finishers must return a constructor.");e=i}}return e},disallowProperty:function(e,t,n){if(void 0!==e[t])throw new TypeError(n+" can't have a ."+t+" property.")}};return e}function he(e){var t,n=ke(e.key);"method"===e.kind?t={value:e.value,writable:!0,configurable:!0,enumerable:!1}:"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var i={kind:"field"===e.kind?"field":"method",key:n,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(i.decorators=e.decorators),"field"===e.kind&&(i.initializer=e.value),i}function ve(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function me(e){return e.decorators&&e.decorators.length}function ye(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function be(e,t){var n=e[t];if(void 0!==n&&"function"!=typeof n)throw new TypeError("Expected '"+t+"' to be a function");return n}function ke(e){var t=function(e,t){if("object"!==ae(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!==ae(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===ae(t)?t:String(t)}function _e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function ge(e,t,n){return ge="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=we(e)););return e}(e,t);if(i){var r=Object.getOwnPropertyDescriptor(i,t);return r.get?r.get.call(n):r.value}},ge(e,t,n||e)}function we(e){return we=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},we(e)}var Ee=function(e,t,n,i){var r=fe();if(i)for(var o=0;o<i.length;o++)r=i[o](r);var a=t((function(e){r.initializeInstanceElements(e,s.elements)}),n),s=r.decorateClass(function(e){for(var t=[],n=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},i=0;i<e.length;i++){var r,o=e[i];if("method"===o.kind&&(r=t.find(n)))if(ye(o.descriptor)||ye(r.descriptor)){if(me(o)||me(r))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");r.descriptor=o.descriptor}else{if(me(o)){if(me(r))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");r.decorators=o.decorators}ve(o,r)}else t.push(o)}return t}(a.d.map(he)),e);return r.initializeClassElements(a.F,s.elements),r.runClassFinishers(a.F,s.finishers)}([(0,_.Mo)("ha-selector-target")],(function(e,t){var n=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&le(e,t)}(i,t);var n=de(i);function i(){var t;ce(this,i);for(var r=arguments.length,o=new Array(r),a=0;a<r;a++)o[a]=arguments[a];return t=n.call.apply(n,[this].concat(o)),e(pe(t)),t}return i}(t);return{F:n,d:[{kind:"field",decorators:[(0,_.Cb)()],key:"hass",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"selector",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"value",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"label",value:void 0},{kind:"field",decorators:[(0,_.Cb)()],key:"helper",value:void 0},{kind:"field",decorators:[(0,_.Cb)({type:Boolean})],key:"disabled",value:function(){return!1}},{kind:"field",decorators:[(0,_.SB)()],key:"_entitySources",value:void 0},{kind:"field",decorators:[(0,_.SB)()],key:"_entities",value:void 0},{kind:"field",key:"_deviceIntegrationLookup",value:function(){return(0,g.Z)(w.HP)}},{kind:"method",key:"hassSubscribe",value:function(){var e=this;return[(0,E.LM)(this.hass.connection,(function(t){e._entities=t.filter((function(e){return null!==e.device_id}))}))]}},{kind:"method",key:"updated",value:function(e){var t,i,r=this;ge(we(n.prototype),"updated",this).call(this,e),e.has("selector")&&(null!==(t=this.selector.target.device)&&void 0!==t&&t.integration||null!==(i=this.selector.target.entity)&&void 0!==i&&i.integration)&&!this._entitySources&&(0,C.m)(this.hass).then((function(e){r._entitySources=e}))}},{kind:"method",key:"render",value:function(){var e,t;return(null!==(e=this.selector.target.device)&&void 0!==e&&e.integration||null!==(t=this.selector.target.entity)&&void 0!==t&&t.integration)&&!this._entitySources?(0,k.dy)(ne||(ne=se([""]))):(0,k.dy)(ie||(ie=se(["<ha-target-picker\n .hass=","\n .value=","\n .helper=","\n .deviceFilter=","\n .entityFilter=","\n .disabled=","\n ></ha-target-picker>"])),this.hass,this.value,this.helper,this._filterDevices,this._filterEntities,this.disabled)}},{kind:"field",key:"_filterEntities",value:function(){var e=this;return function(t){return!e.selector.target.entity||(0,x.J)(e.selector.target.entity,t,e._entitySources)}}},{kind:"field",key:"_filterDevices",value:function(){var e=this;return function(t){if(!e.selector.target.device)return!0;var n=e._entitySources&&e._entities?e._deviceIntegrationLookup(e._entitySources,e._entities):void 0;return(0,x.l)(e.selector.target.device,t,n)}}},{kind:"get",static:!0,key:"styles",value:function(){return(0,k.iv)(re||(re=se(["\n ha-target-picker {\n display: block;\n }\n "])))}}]}}),(0,P.f)(k.oi))},22814:function(e,t,n){n.d(t,{iI:function(){return i}});"".concat(location.protocol,"//").concat(location.host);var i=function(e,t){return e.callWS({type:"auth/sign_path",path:t})}},56007:function(e,t,n){n.d(t,{nZ:function(){return i},lz:function(){return r},V_:function(){return o}});var i="unavailable",r="unknown",o=[i,r]}}]); |