iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
124 lines (114 loc) • 30.3 kB
JavaScript
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[4160],{49706:(e,t,r)=>{"use strict";r.d(t,{Rb:()=>i,Zy:()=>s,h2:()=>a,PS:()=>n,l:()=>o,ht:()=>c,f0:()=>l,tj:()=>d,uo:()=>u,lC:()=>h,Kk:()=>p,ot:()=>f,gD:()=>m,a1:()=>v,AZ:()=>y});const i="hass:bookmark",s={alert:"hass:alert",alexa:"hass:amazon-alexa",air_quality:"hass:air-filter",automation:"hass:robot",calendar:"hass:calendar",camera:"hass:video",climate:"hass:thermostat",configurator:"hass:cog",conversation:"hass:text-to-speech",counter:"hass:counter",device_tracker:"hass:account",fan:"hass:fan",google_assistant:"hass:google-assistant",group:"hass:google-circles-communities",homeassistant:"hass:home-assistant",homekit:"hass:home-automation",image_processing:"hass:image-filter-frames",input_boolean:"hass:toggle-switch-outline",input_datetime:"hass:calendar-clock",input_number:"hass:ray-vertex",input_select:"hass:format-list-bulleted",input_text:"hass:form-textbox",light:"hass:lightbulb",mailbox:"hass:mailbox",notify:"hass:comment-alert",persistent_notification:"hass:bell",person:"hass:account",plant:"hass:flower",proximity:"hass:apple-safari",remote:"hass:remote",scene:"hass:palette",script:"hass:script-text",sensor:"hass:eye",simple_alarm:"hass:bell",sun:"hass:white-balance-sunny",switch:"hass:flash",timer:"hass:timer-outline",updater:"hass:cloud-upload",vacuum:"hass:robot-vacuum",water_heater:"hass:thermometer",weather:"hass:weather-cloudy",zone:"hass:map-marker-radius"},a={current:"hass:current-ac",energy:"hass:flash",humidity:"hass:water-percent",illuminance:"hass:brightness-5",temperature:"hass:thermometer",pressure:"hass:gauge",power:"hass:flash",power_factor:"hass:angle-acute",signal_strength:"hass:wifi",timestamp:"hass:clock",voltage:"hass:sine-wave"},n=["climate","cover","configurator","input_select","input_number","input_text","lock","media_player","scene","script","timer","vacuum","water_heater"],o=["alarm_control_panel","automation","camera","climate","configurator","counter","cover","fan","group","humidifier","input_datetime","light","lock","media_player","person","script","sun","timer","vacuum","water_heater","weather"],c=["input_number","input_select","input_text","scene"],l=["camera","configurator","scene"],d=["closed","locked","off"],u="on",h="off",p=new Set(["fan","input_boolean","light","switch","group","automation","humidifier"]),f="°C",m="°F",v="group.default_view",y=["ff0029","66a61e","377eb8","984ea3","00d2d5","ff7f00","af8d00","7f80cd","b3e900","c42e60","a65628","f781bf","8dd3c7","bebada","fb8072","80b1d3","fdb462","fccde5","bc80bd","ffed6f","c4eaff","cf8c00","1b9e77","d95f02","e7298a","e6ab02","a6761d","0097ff","00d067","f43600","4ba93b","5779bb","927acc","97ee3f","bf3947","9f5b00","f48758","8caed6","f2b94f","eff26e","e43872","d9b100","9d7a00","698cff","d9d9d9","00d27e","d06800","009f82","c49200","cbe8ff","fecddf","c27eb6","8cd2ce","c4b8d9","f883b0","a49100","f48800","27d0df","a04a9b"]},44634:(e,t,r)=>{"use strict";r.d(t,{M:()=>i});const i=(e,t)=>{const r=Number(e.state),i=t&&"on"===t.state;if(isNaN(r))return"hass:battery-unknown";let s="hass:battery";const a=10*Math.round(r/10);return i&&r>10?s+="-charging-"+a:i?s+="-outline":r<=5?s+="-alert":r>5&&r<95&&(s+="-"+a),s}},76151:(e,t,r)=>{"use strict";r.d(t,{K:()=>a});var i=r(49706);var s=r(44634);const a=(e,t,r)=>{const a=void 0!==r?r:null==t?void 0:t.state;switch(e){case"alarm_control_panel":switch(a){case"armed_home":return"hass:bell-plus";case"armed_night":return"hass:bell-sleep";case"disarmed":return"hass:bell-outline";case"triggered":return"hass:bell-ring";default:return"hass:bell"}case"binary_sensor":return((e,t)=>{const r="off"===e;switch(null==t?void 0:t.attributes.device_class){case"battery":return r?"hass:battery":"hass:battery-outline";case"battery_charging":return r?"hass:battery":"hass:battery-charging";case"cold":return r?"hass:thermometer":"hass:snowflake";case"connectivity":return r?"hass:server-network-off":"hass:server-network";case"door":return r?"hass:door-closed":"hass:door-open";case"garage_door":return r?"hass:garage":"hass:garage-open";case"power":return r?"hass:power-plug-off":"hass:power-plug";case"gas":case"problem":case"safety":case"smoke":return r?"hass:check-circle":"hass:alert-circle";case"heat":return r?"hass:thermometer":"hass:fire";case"light":return r?"hass:brightness-5":"hass:brightness-7";case"lock":return r?"hass:lock":"hass:lock-open";case"moisture":return r?"hass:water-off":"hass:water";case"motion":return r?"hass:walk":"hass:run";case"occupancy":return r?"hass:home-outline":"hass:home";case"opening":return r?"hass:square":"hass:square-outline";case"plug":return r?"hass:power-plug-off":"hass:power-plug";case"presence":return r?"hass:home-outline":"hass:home";case"sound":return r?"hass:music-note-off":"hass:music-note";case"vibration":return r?"hass:crop-portrait":"hass:vibrate";case"window":return r?"hass:window-closed":"hass:window-open";default:return r?"hass:radiobox-blank":"hass:checkbox-marked-circle"}})(a,t);case"cover":return((e,t)=>{const r="closed"!==e;switch(null==t?void 0:t.attributes.device_class){case"garage":switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:garage";default:return"hass:garage-open"}case"gate":switch(e){case"opening":case"closing":return"hass:gate-arrow-right";case"closed":return"hass:gate";default:return"hass:gate-open"}case"door":return r?"hass:door-open":"hass:door-closed";case"damper":return r?"hass:circle":"hass:circle-slice-8";case"shutter":switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:window-shutter";default:return"hass:window-shutter-open"}case"blind":case"curtain":switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:blinds";default:return"hass:blinds-open"}case"window":switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:window-closed";default:return"hass:window-open"}}switch(e){case"opening":return"hass:arrow-up-box";case"closing":return"hass:arrow-down-box";case"closed":return"hass:window-closed";default:return"hass:window-open"}})(a,t);case"humidifier":return r&&"off"===r?"hass:air-humidifier-off":"hass:air-humidifier";case"lock":return"unlocked"===a?"hass:lock-open":"hass:lock";case"media_player":return"playing"===a?"hass:cast-connected":"hass:cast";case"zwave":switch(a){case"dead":return"hass:emoticon-dead";case"sleeping":return"hass:sleep";case"initializing":return"hass:timer-sand";default:return"hass:z-wave"}case"sensor":{const e=(e=>{const t=null==e?void 0:e.attributes.device_class;if(t&&t in i.h2)return i.h2[t];if("battery"===t)return e?(0,s.M)(e):"hass:battery";const r=null==e?void 0:e.attributes.unit_of_measurement;return r===i.ot||r===i.gD?"hass:thermometer":void 0})(t);if(e)return e;break}case"input_datetime":if(!(null==t?void 0:t.attributes.has_date))return"hass:clock";if(!t.attributes.has_time)return"hass:calendar"}return e in i.Zy?i.Zy[e]:(console.warn("Unable to find icon for domain "+e+" ("+t+")"),i.Rb)}},36145:(e,t,r)=>{"use strict";r.d(t,{M:()=>n});var i=r(49706),s=r(58831),a=r(76151);const n=e=>e?e.attributes.icon?e.attributes.icon:(0,a.K)((0,s.M)(e.entity_id),e):i.Rb},96151:(e,t,r)=>{"use strict";r.d(t,{T:()=>i,y:()=>s});const i=e=>{requestAnimationFrame((()=>setTimeout(e,0)))},s=()=>new Promise((e=>{i(e)}))},91769:(e,t,r)=>{"use strict";var i=r(50856),s=r(28426),a=r(36145);r(16509);class n extends s.H3{static get template(){return i.d` <ha-icon icon="[[computeIcon(stateObj)]]"></ha-icon> `}static get properties(){return{stateObj:{type:Object}}}computeIcon(e){return(0,a.M)(e)}}customElements.define("ha-state-icon",n)},22383:(e,t,r)=>{"use strict";r.d(t,{$l:()=>i,VZ:()=>s,o5:()=>a,z3:()=>n,vn:()=>o,go:()=>c,mO:()=>l,iJ:()=>d,S_:()=>u,lR:()=>h,qm:()=>p,bt:()=>f,gg:()=>m,yi:()=>v,pT:()=>y,dy:()=>b,tz:()=>g,Rp:()=>w});const i=(e,t)=>e.callWS({type:"zha/devices/reconfigure",ieee:t}),s=(e,t,r,i,s)=>e.callWS({type:"zha/devices/clusters/attributes",ieee:t,endpoint_id:r,cluster_id:i,cluster_type:s}),a=(e,t)=>e.callWS({type:"zha/device",ieee:t}),n=(e,t)=>e.callWS({type:"zha/devices/bindable",ieee:t}),o=(e,t,r)=>e.callWS({type:"zha/devices/bind",source_ieee:t,target_ieee:r}),c=(e,t,r)=>e.callWS({type:"zha/devices/unbind",source_ieee:t,target_ieee:r}),l=(e,t,r,i)=>e.callWS({type:"zha/groups/bind",source_ieee:t,group_id:r,bindings:i}),d=(e,t,r,i)=>e.callWS({type:"zha/groups/unbind",source_ieee:t,group_id:r,bindings:i}),u=(e,t)=>e.callWS({...t,type:"zha/devices/clusters/attributes/value"}),h=(e,t,r,i,s)=>e.callWS({type:"zha/devices/clusters/commands",ieee:t,endpoint_id:r,cluster_id:i,cluster_type:s}),p=(e,t)=>e.callWS({type:"zha/devices/clusters",ieee:t}),f=e=>e.callWS({type:"zha/groups"}),m=(e,t)=>e.callWS({type:"zha/group/remove",group_ids:t}),v=(e,t)=>e.callWS({type:"zha/group",group_id:t}),y=e=>e.callWS({type:"zha/devices/groupable"}),b=(e,t,r)=>e.callWS({type:"zha/group/members/add",group_id:t,members:r}),g=(e,t,r)=>e.callWS({type:"zha/group/members/remove",group_id:t,members:r}),w=(e,t,r)=>e.callWS({type:"zha/group/add",group_name:t,members:r})},88165:(e,t,r)=>{"use strict";var i=r(15652),s=r(81471);function a(){a=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var s=t.placement;if(t.kind===i&&("static"===s||"prototype"===s)){var a="static"===s?e:r;this.defineClassElement(a,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],s={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,s)}),this),e.forEach((function(e){if(!c(e))return r.push(e);var t=this.decorateElement(e,s);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var a=this.decorateConstructor(r,t);return i.push.apply(i,a.finishers),a.finishers=i,a},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],s=e.decorators,a=s.length-1;a>=0;a--){var n=t[e.placement];n.splice(n.indexOf(e.key),1);var o=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,s[a])(o)||o);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);r.push.apply(r,l)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var s=this.fromClassDescriptor(e),a=this.toClassDescriptor((0,t[i])(s)||s);if(void 0!==a.finisher&&r.push(a.finisher),void 0!==a.elements){e=a.elements;for(var n=0;n<e.length-1;n++)for(var o=n+1;o<e.length;o++)if(e[n].key===e[o].key&&e[n].placement===e[o].placement)throw new TypeError("Duplicated element ("+e[n].key+")")}}return{elements:e,finishers:r}},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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?h(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 r=u(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 s=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var a={kind:t,key:r,placement:i,descriptor:Object.assign({},s)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(s,"get","The property descriptor of a field descriptor"),this.disallowProperty(s,"set","The property descriptor of a field descriptor"),this.disallowProperty(s,"value","The property descriptor of a field descriptor"),a.initializer=e.initializer),a},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:d(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 r=d(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(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,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function n(e){var t,r=u(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:r,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 o(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function c(e){return e.decorators&&e.decorators.length}function l(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function d(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function u(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}!function(e,t,r,i){var s=a();if(i)for(var d=0;d<i.length;d++)s=i[d](s);var u=t((function(e){s.initializeInstanceElements(e,h.elements)}),r),h=s.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===a.key&&e.placement===a.placement},i=0;i<e.length;i++){var s,a=e[i];if("method"===a.kind&&(s=t.find(r)))if(l(a.descriptor)||l(s.descriptor)){if(c(a)||c(s))throw new ReferenceError("Duplicated methods ("+a.key+") can't be decorated.");s.descriptor=a.descriptor}else{if(c(a)){if(c(s))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+a.key+").");s.decorators=a.decorators}o(a,s)}else t.push(a)}return t}(u.d.map(n)),e);s.initializeClassElements(u.F,h.elements),s.runClassFinishers(u.F,h.finishers)}([(0,i.Mo)("ha-config-section")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,i.Cb)()],key:"isWide",value:()=>!1},{kind:"method",key:"render",value:function(){return i.dy`
<div
class="content ${(0,s.$)({narrow:!this.isWide})}"
>
<div class="header"><slot name="header"></slot></div>
<div
class="together layout ${(0,s.$)({narrow:!this.isWide,vertical:!this.isWide,horizontal:this.isWide})}"
>
<div class="intro"><slot name="introduction"></slot></div>
<div class="panel flex-auto"><slot></slot></div>
</div>
</div>
`}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv`
:host {
display: block;
}
.content {
padding: 28px 20px 0;
max-width: 1040px;
margin: 0 auto;
}
.layout {
display: flex;
}
.horizontal {
flex-direction: row;
}
.vertical {
flex-direction: column;
}
.flex-auto {
flex: 1 1 auto;
}
.header {
font-family: var(--paper-font-headline_-_font-family);
-webkit-font-smoothing: var(
--paper-font-headline_-_-webkit-font-smoothing
);
font-size: var(--paper-font-headline_-_font-size);
font-weight: var(--paper-font-headline_-_font-weight);
letter-spacing: var(--paper-font-headline_-_letter-spacing);
line-height: var(--paper-font-headline_-_line-height);
opacity: var(--dark-primary-opacity);
}
.together {
margin-top: 32px;
}
.intro {
font-family: var(--paper-font-subhead_-_font-family);
-webkit-font-smoothing: var(
--paper-font-subhead_-_-webkit-font-smoothing
);
font-weight: var(--paper-font-subhead_-_font-weight);
line-height: var(--paper-font-subhead_-_line-height);
width: 100%;
max-width: 400px;
margin-right: 40px;
opacity: var(--dark-primary-opacity);
font-size: 14px;
padding-bottom: 20px;
}
.panel {
margin-top: -24px;
}
.panel ::slotted(*) {
margin-top: 24px;
display: block;
}
.narrow.content {
max-width: 640px;
}
.narrow .together {
margin-top: 20px;
}
.narrow .intro {
padding-bottom: 20px;
margin-right: 0;
max-width: 500px;
}
`}}]}}),i.oi)},79484:(e,t,r)=>{"use strict";var i=r(15652),s=r(14516),a=(r(12899),r(91769),r(87744));function n(){n=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(r){t.forEach((function(t){t.kind===r&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var r=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var s=t.placement;if(t.kind===i&&("static"===s||"prototype"===s)){var a="static"===s?e:r;this.defineClassElement(a,t)}}),this)}),this)},defineClassElement:function(e,t){var r=t.descriptor;if("field"===t.kind){var i=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,r)},decorateClass:function(e,t){var r=[],i=[],s={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,s)}),this),e.forEach((function(e){if(!l(e))return r.push(e);var t=this.decorateElement(e,s);r.push(t.element),r.push.apply(r,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:r,finishers:i};var a=this.decorateConstructor(r,t);return i.push.apply(i,a.finishers),a.finishers=i,a},addElementPlacement:function(e,t,r){var i=t[e.placement];if(!r&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var r=[],i=[],s=e.decorators,a=s.length-1;a>=0;a--){var n=t[e.placement];n.splice(n.indexOf(e.key),1);var o=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,s[a])(o)||o);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);r.push.apply(r,l)}}return{element:e,finishers:i,extras:r}},decorateConstructor:function(e,t){for(var r=[],i=t.length-1;i>=0;i--){var s=this.fromClassDescriptor(e),a=this.toClassDescriptor((0,t[i])(s)||s);if(void 0!==a.finisher&&r.push(a.finisher),void 0!==a.elements){e=a.elements;for(var n=0;n<e.length-1;n++)for(var o=n+1;o<e.length;o++)if(e[n].key===e[o].key&&e[n].placement===e[o].placement)throw new TypeError("Duplicated element ("+e[n].key+")")}}return{elements:e,finishers:r}},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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?p(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 r=h(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 s=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var a={kind:t,key:r,placement:i,descriptor:Object.assign({},s)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(s,"get","The property descriptor of a field descriptor"),this.disallowProperty(s,"set","The property descriptor of a field descriptor"),this.disallowProperty(s,"value","The property descriptor of a field descriptor"),a.initializer=e.initializer),a},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:u(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 r=u(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:r}},runClassFinishers:function(e,t){for(var r=0;r<t.length;r++){var i=(0,t[r])(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,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}};return e}function o(e){var t,r=h(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:r,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 c(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function l(e){return e.decorators&&e.decorators.length}function d(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function u(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function h(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}!function(e,t,r,i){var s=n();if(i)for(var a=0;a<i.length;a++)s=i[a](s);var u=t((function(e){s.initializeInstanceElements(e,h.elements)}),r),h=s.decorateClass(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===a.key&&e.placement===a.placement},i=0;i<e.length;i++){var s,a=e[i];if("method"===a.kind&&(s=t.find(r)))if(d(a.descriptor)||d(s.descriptor)){if(l(a)||l(s))throw new ReferenceError("Duplicated methods ("+a.key+") can't be decorated.");s.descriptor=a.descriptor}else{if(l(a)){if(l(s))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+a.key+").");s.decorators=a.decorators}c(a,s)}else t.push(a)}return t}(u.d.map(o)),e);s.initializeClassElements(u.F,h.elements),s.runClassFinishers(u.F,h.finishers)}([(0,i.Mo)("zha-device-endpoint-data-table")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,i.Cb)({type:Object})],key:"hass",value:void 0},{kind:"field",decorators:[(0,i.Cb)({type:Boolean})],key:"narrow",value:()=>!1},{kind:"field",decorators:[(0,i.Cb)({type:Boolean})],key:"selectable",value:()=>!1},{kind:"field",decorators:[(0,i.Cb)({type:Array})],key:"deviceEndpoints",value:()=>[]},{kind:"field",decorators:[(0,i.IO)("ha-data-table",!0)],key:"_dataTable",value:void 0},{kind:"field",key:"_deviceEndpoints",value:()=>(0,s.Z)((e=>{const t=[];return e.forEach((e=>{t.push({name:e.device.user_given_name||e.device.name,model:e.device.model,manufacturer:e.device.manufacturer,id:e.device.ieee+"_"+e.endpoint_id,ieee:e.device.ieee,endpoint_id:e.endpoint_id,entities:e.entities,dev_id:e.device.device_reg_id})})),t}))},{kind:"field",key:"_columns",value:()=>(0,s.Z)((e=>e?{name:{title:"Devices",sortable:!0,filterable:!0,direction:"asc",grows:!0,template:(e,t)=>i.dy`
<a href="${"/config/devices/device/"+t.dev_id}">
${e}
</a>
`},endpoint_id:{title:"Endpoint",sortable:!0,filterable:!0}}:{name:{title:"Name",sortable:!0,filterable:!0,direction:"asc",grows:!0,template:(e,t)=>i.dy`
<a href="${"/config/devices/device/"+t.dev_id}">
${e}
</a>
`},endpoint_id:{title:"Endpoint",sortable:!0,filterable:!0},entities:{title:"Associated Entities",sortable:!1,filterable:!1,width:"50%",template:e=>i.dy`
${e.length?e.length>3?i.dy`${e.slice(0,2).map((e=>i.dy`<div
style="overflow: hidden; text-overflow: ellipsis;"
>
${e.name||e.original_name}
</div>`))}
<div>And ${e.length-2} more...</div>`:e.map((e=>i.dy`<div
style="overflow: hidden; text-overflow: ellipsis;"
>
${e.name||e.original_name}
</div>`)):"This endpoint has no associated entities"}
`}}))},{kind:"method",key:"clearSelection",value:function(){this._dataTable.clearSelection()}},{kind:"method",key:"render",value:function(){return i.dy`
<ha-data-table
.columns=${this._columns(this.narrow)}
.data=${this._deviceEndpoints(this.deviceEndpoints)}
.selectable=${this.selectable}
auto-height
.dir=${(0,a.Zu)(this.hass)}
.searchLabel=${this.hass.localize("ui.components.data-table.search")}
.noDataText=${this.hass.localize("ui.components.data-table.no-data")}
></ha-data-table>
`}},{kind:"get",static:!0,key:"styles",value:function(){return[i.iv`
.table-cell-text {
word-break: break-word;
}
`]}}]}}),i.oi)}}]);
//# sourceMappingURL=chunk.eaaa97ba6f5bf6087939.js.map