iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
234 lines (205 loc) • 29.6 kB
JavaScript
/*! For license information please see chunk.a32b5a99e3faa755dc50.js.LICENSE.txt */
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[2744],{35854:(e,t,r)=>{"use strict";r.d(t,{G:()=>a,R:()=>n});r(43437);var i=r(21006),o=r(98235);const a={properties:{checked:{type:Boolean,value:!1,reflectToAttribute:!0,notify:!0,observer:"_checkedChanged"},toggles:{type:Boolean,value:!0,reflectToAttribute:!0},value:{type:String,value:"on",observer:"_valueChanged"}},observers:["_requiredChanged(required)"],created:function(){this._hasIronCheckedElementBehavior=!0},_getValidity:function(e){return this.disabled||!this.required||this.checked},_requiredChanged:function(){this.required?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required")},_checkedChanged:function(){this.active=this.checked,this.fire("iron-change")},_valueChanged:function(){void 0!==this.value&&null!==this.value||(this.value="on")}},n=[i.V,o.x,a]},62132:(e,t,r)=>{"use strict";r.d(t,{K:()=>s});r(43437);var i=r(35854),o=r(49075),a=r(84938);const n={_checkedChanged:function(){i.G._checkedChanged.call(this),this.hasRipple()&&(this.checked?this._ripple.setAttribute("checked",""):this._ripple.removeAttribute("checked"))},_buttonStateChanged:function(){a.o._buttonStateChanged.call(this),this.disabled||this.isAttached&&(this.checked=this.active)}},s=[o.B,i.R,n]},32296:(e,t,r)=>{"use strict";r(43437),r(1656);var i=r(62132),o=r(49075),a=r(9672),n=r(50856),s=r(87529);const c=n.d`<style>
:host {
display: inline-block;
white-space: nowrap;
cursor: pointer;
--calculated-paper-checkbox-size: var(--paper-checkbox-size, 18px);
/* -1px is a sentinel for the default and is replaced in \`attached\`. */
--calculated-paper-checkbox-ink-size: var(--paper-checkbox-ink-size, -1px);
@apply --paper-font-common-base;
line-height: 0;
-webkit-tap-highlight-color: transparent;
}
:host([hidden]) {
display: none !important;
}
:host(:focus) {
outline: none;
}
.hidden {
display: none;
}
#checkboxContainer {
display: inline-block;
position: relative;
width: var(--calculated-paper-checkbox-size);
height: var(--calculated-paper-checkbox-size);
min-width: var(--calculated-paper-checkbox-size);
margin: var(--paper-checkbox-margin, initial);
vertical-align: var(--paper-checkbox-vertical-align, middle);
background-color: var(--paper-checkbox-unchecked-background-color, transparent);
}
#ink {
position: absolute;
/* Center the ripple in the checkbox by negative offsetting it by
* (inkWidth - rippleWidth) / 2 */
top: calc(0px - (var(--calculated-paper-checkbox-ink-size) - var(--calculated-paper-checkbox-size)) / 2);
left: calc(0px - (var(--calculated-paper-checkbox-ink-size) - var(--calculated-paper-checkbox-size)) / 2);
width: var(--calculated-paper-checkbox-ink-size);
height: var(--calculated-paper-checkbox-ink-size);
color: var(--paper-checkbox-unchecked-ink-color, var(--primary-text-color));
opacity: 0.6;
pointer-events: none;
}
#ink:dir(rtl) {
right: calc(0px - (var(--calculated-paper-checkbox-ink-size) - var(--calculated-paper-checkbox-size)) / 2);
left: auto;
}
#ink[checked] {
color: var(--paper-checkbox-checked-ink-color, var(--primary-color));
}
#checkbox {
position: relative;
box-sizing: border-box;
height: 100%;
border: solid 2px;
border-color: var(--paper-checkbox-unchecked-color, var(--primary-text-color));
border-radius: 2px;
pointer-events: none;
-webkit-transition: background-color 140ms, border-color 140ms;
transition: background-color 140ms, border-color 140ms;
-webkit-transition-duration: var(--paper-checkbox-animation-duration, 140ms);
transition-duration: var(--paper-checkbox-animation-duration, 140ms);
}
/* checkbox checked animations */
#checkbox.checked #checkmark {
-webkit-animation: checkmark-expand 140ms ease-out forwards;
animation: checkmark-expand 140ms ease-out forwards;
-webkit-animation-duration: var(--paper-checkbox-animation-duration, 140ms);
animation-duration: var(--paper-checkbox-animation-duration, 140ms);
}
@-webkit-keyframes checkmark-expand {
0% {
-webkit-transform: scale(0, 0) rotate(45deg);
}
100% {
-webkit-transform: scale(1, 1) rotate(45deg);
}
}
@keyframes checkmark-expand {
0% {
transform: scale(0, 0) rotate(45deg);
}
100% {
transform: scale(1, 1) rotate(45deg);
}
}
#checkbox.checked {
background-color: var(--paper-checkbox-checked-color, var(--primary-color));
border-color: var(--paper-checkbox-checked-color, var(--primary-color));
}
#checkmark {
position: absolute;
width: 36%;
height: 70%;
border-style: solid;
border-top: none;
border-left: none;
border-right-width: calc(2/15 * var(--calculated-paper-checkbox-size));
border-bottom-width: calc(2/15 * var(--calculated-paper-checkbox-size));
border-color: var(--paper-checkbox-checkmark-color, white);
-webkit-transform-origin: 97% 86%;
transform-origin: 97% 86%;
box-sizing: content-box; /* protect against page-level box-sizing */
}
#checkmark:dir(rtl) {
-webkit-transform-origin: 50% 14%;
transform-origin: 50% 14%;
}
/* label */
#checkboxLabel {
position: relative;
display: inline-block;
vertical-align: middle;
padding-left: var(--paper-checkbox-label-spacing, 8px);
white-space: normal;
line-height: normal;
color: var(--paper-checkbox-label-color, var(--primary-text-color));
@apply --paper-checkbox-label;
}
:host([checked]) #checkboxLabel {
color: var(--paper-checkbox-label-checked-color, var(--paper-checkbox-label-color, var(--primary-text-color)));
@apply --paper-checkbox-label-checked;
}
#checkboxLabel:dir(rtl) {
padding-right: var(--paper-checkbox-label-spacing, 8px);
padding-left: 0;
}
#checkboxLabel[hidden] {
display: none;
}
/* disabled state */
:host([disabled]) #checkbox {
opacity: 0.5;
border-color: var(--paper-checkbox-unchecked-color, var(--primary-text-color));
}
:host([disabled][checked]) #checkbox {
background-color: var(--paper-checkbox-unchecked-color, var(--primary-text-color));
opacity: 0.5;
}
:host([disabled]) #checkboxLabel {
opacity: 0.65;
}
/* invalid state */
#checkbox.invalid:not(.checked) {
border-color: var(--paper-checkbox-error-color, var(--error-color));
}
</style>
<div id="checkboxContainer">
<div id="checkbox" class$="[[_computeCheckboxClass(checked, invalid)]]">
<div id="checkmark" class$="[[_computeCheckmarkClass(checked)]]"></div>
</div>
</div>
<div id="checkboxLabel"><slot></slot></div>`;c.setAttribute("strip-whitespace",""),(0,a.k)({_template:c,is:"paper-checkbox",behaviors:[i.K],hostAttributes:{role:"checkbox","aria-checked":!1,tabindex:0},properties:{ariaActiveAttribute:{type:String,value:"aria-checked"}},attached:function(){(0,s.T8)(this,(function(){if("-1px"===this.getComputedStyleValue("--calculated-paper-checkbox-ink-size").trim()){var e=this.getComputedStyleValue("--calculated-paper-checkbox-size").trim(),t="px",r=e.match(/[A-Za-z]+$/);null!==r&&(t=r[0]);var i=parseFloat(e),o=8/3*i;"px"===t&&(o=Math.floor(o))%2!=i%2&&o++,this.updateStyles({"--paper-checkbox-ink-size":o+t})}}))},_computeCheckboxClass:function(e,t){var r="";return e&&(r+="checked "),t&&(r+="invalid"),r},_computeCheckmarkClass:function(e){return e?"":"hidden"},_createRipple:function(){return this._rippleContainer=this.$.checkboxContainer,o.S._createRipple.call(this)}})},96151:(e,t,r)=>{"use strict";r.d(t,{T:()=>i,y:()=>o});const i=e=>{requestAnimationFrame((()=>setTimeout(e,0)))},o=()=>new Promise((e=>{i(e)}))},67250:(e,t,r)=>{"use strict";var i=r(15652),o=r(47181),a=r(91741),n=r(40095),s=r(50538);r(319);function c(){c=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 o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var a="static"===o?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=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!p(e))return r.push(e);var t=this.decorateElement(e,o);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=[],o=e.decorators,a=o.length-1;a>=0;a--){var n=t[e.placement];n.splice(n.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,o[a])(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);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 o=this.fromClassDescriptor(e),a=this.toClassDescriptor((0,t[i])(o)||o);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 s=n+1;s<e.length;s++)if(e[n].key===e[s].key&&e[n].placement===e[s].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 m(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)?m(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=f(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 o=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var a={kind:t,key:r,placement:i,descriptor:Object.assign({},o)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(o,"get","The property descriptor of a field descriptor"),this.disallowProperty(o,"set","The property descriptor of a field descriptor"),this.disallowProperty(o,"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 l(e){var t,r=f(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 d(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function p(e){return e.decorators&&e.decorators.length}function h(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 f(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 m(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 o=c();if(i)for(var a=0;a<i.length;a++)o=i[a](o);var n=t((function(e){o.initializeInstanceElements(e,s.elements)}),r),s=o.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 o,a=e[i];if("method"===a.kind&&(o=t.find(r)))if(h(a.descriptor)||h(o.descriptor)){if(p(a)||p(o))throw new ReferenceError("Duplicated methods ("+a.key+") can't be decorated.");o.descriptor=a.descriptor}else{if(p(a)){if(p(o))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+a.key+").");o.decorators=a.decorators}d(a,o)}else t.push(a)}return t}(n.d.map(l)),e);o.initializeClassElements(n.F,s.elements),o.runClassFinishers(n.F,s.finishers)}([(0,i.Mo)("ha-camera-stream")],(function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,i.Cb)({type:Boolean,attribute:"controls"})],key:"controls",value:()=>!1},{kind:"field",decorators:[(0,i.Cb)({type:Boolean,attribute:"muted"})],key:"muted",value:()=>!1},{kind:"field",decorators:[(0,i.Cb)({type:Boolean,attribute:"allow-exoplayer"})],key:"allowExoPlayer",value:()=>!1},{kind:"field",decorators:[(0,i.sz)()],key:"_forceMJPEG",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_url",value:void 0},{kind:"method",key:"render",value:function(){return this.stateObj?i.dy`
${this._shouldRenderMJPEG?i.dy`
<img
@load=${this._elementResized}
.src=${(0,s.nk)(this.stateObj)}
.alt=${`Preview of the ${(0,a.C)(this.stateObj)} camera.`}
/>
`:this._url?i.dy`
<ha-hls-player
autoplay
playsinline
.allowExoPlayer=${this.allowExoPlayer}
.muted=${this.muted}
.controls=${this.controls}
.hass=${this.hass}
.url=${this._url}
></ha-hls-player>
`:""}
`:i.dy``}},{kind:"method",key:"updated",value:function(e){e.has("stateObj")&&!this._shouldRenderMJPEG&&(this._forceMJPEG=void 0,this._getStreamUrl())}},{kind:"get",key:"_shouldRenderMJPEG",value:function(){return this._forceMJPEG===this.stateObj.entity_id||!this.hass.config.components.includes("stream")||!(0,n.e)(this.stateObj,s.qW)}},{kind:"method",key:"_getStreamUrl",value:async function(){try{const{url:e}=await(0,s.Lr)(this.hass,this.stateObj.entity_id);this._url=e}catch(e){console.error(e),this._forceMJPEG=this.stateObj.entity_id}}},{kind:"method",key:"_elementResized",value:function(){(0,o.B)(this,"iron-resize")}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv`
:host,
img {
display: block;
}
img {
width: 100%;
}
`}}]}}),i.oi)},22814:(e,t,r)=>{"use strict";r.d(t,{uw:()=>i,iI:()=>o,W2:()=>a,TZ:()=>n});const i=`${location.protocol}//${location.host}`,o=(e,t)=>e.callWS({type:"auth/sign_path",path:t}),a=async(e,t,r,i)=>e.callWS({type:"config/auth_provider/homeassistant/create",user_id:t,username:r,password:i}),n=async(e,t,r)=>e.callWS({type:"config/auth_provider/homeassistant/admin_change_password",user_id:t,password:r})},50538:(e,t,r)=>{"use strict";r.d(t,{qW:()=>o,nk:()=>a,Xn:()=>l,Lr:()=>c,i4:()=>n,Mw:()=>d});var i=r(22814);const o=2,a=e=>`/api/camera_proxy_stream/${e.entity_id}?token=${e.attributes.access_token}`,n=(e,t)=>(async(e,t,r,i,o,...a)=>{let n=i[e];n||(n=i[e]={});const s=n[o];if(s)return s;const c=r(i,o,...a);return n[o]=c,c.then((()=>setTimeout((()=>{n[o]=void 0}),t)),(()=>{n[o]=void 0})),c})("_cameraTmbUrl",9e3,s,e,t),s=async(e,t)=>{const r=await(0,i.iI)(e,"/api/camera_proxy/"+t);return e.hassUrl(r.path)},c=async(e,t,r)=>{const i={type:"camera/stream",entity_id:t};r&&(i.format=r);const o=await e.callWS(i);return o.url=e.hassUrl(o.url),o},l=(e,t)=>e.callWS({type:"camera/get_prefs",entity_id:t}),d=(e,t,r)=>e.callWS({type:"camera/update_prefs",entity_id:t,...r})},14920:(e,t,r)=>{"use strict";r.r(t);r(32296);var i=r(15652),o=r(40095),a=(r(67250),r(50538));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 o=t.placement;if(t.kind===i&&("static"===o||"prototype"===o)){var a="static"===o?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=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!l(e))return r.push(e);var t=this.decorateElement(e,o);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=[],o=e.decorators,a=o.length-1;a>=0;a--){var n=t[e.placement];n.splice(n.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,o[a])(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);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 o=this.fromClassDescriptor(e),a=this.toClassDescriptor((0,t[i])(o)||o);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 s=n+1;s<e.length;s++)if(e[n].key===e[s].key&&e[n].placement===e[s].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 u(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)?u(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 o=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var a={kind:t,key:r,placement:i,descriptor:Object.assign({},o)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(o,"get","The property descriptor of a field descriptor"),this.disallowProperty(o,"set","The property descriptor of a field descriptor"),this.disallowProperty(o,"value","The property descriptor of a field descriptor"),a.initializer=e.initializer),a},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:p(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=p(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 s(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 p(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 u(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 f(e,t,r){return(f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=m(e)););return e}(e,t);if(i){var o=Object.getOwnPropertyDescriptor(i,t);return o.get?o.get.call(r):o.value}})(e,t,r||e)}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}let k=function(e,t,r,i){var o=n();if(i)for(var a=0;a<i.length;a++)o=i[a](o);var p=t((function(e){o.initializeInstanceElements(e,h.elements)}),r),h=o.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 o,a=e[i];if("method"===a.kind&&(o=t.find(r)))if(d(a.descriptor)||d(o.descriptor)){if(l(a)||l(o))throw new ReferenceError("Duplicated methods ("+a.key+") can't be decorated.");o.descriptor=a.descriptor}else{if(l(a)){if(l(o))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+a.key+").");o.decorators=a.decorators}c(a,o)}else t.push(a)}return t}(p.d.map(s)),e);return o.initializeClassElements(p.F,h.elements),o.runClassFinishers(p.F,h.finishers)}(null,(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,d:[{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,i.Cb)()],key:"stateObj",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_cameraPrefs",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_attached",value:()=>!1},{kind:"method",key:"connectedCallback",value:function(){f(m(r.prototype),"connectedCallback",this).call(this),this._attached=!0}},{kind:"method",key:"disconnectedCallback",value:function(){f(m(r.prototype),"disconnectedCallback",this).call(this),this._attached=!1}},{kind:"method",key:"render",value:function(){return this._attached&&this.hass&&this.stateObj?i.dy`
<ha-camera-stream
.hass=${this.hass}
.stateObj=${this.stateObj}
allow-exoplayer
controls
></ha-camera-stream>
${this._cameraPrefs?i.dy`
<paper-checkbox
.checked=${this._cameraPrefs.preload_stream}
@change=${this._handleCheckboxChanged}
>
Preload stream
</paper-checkbox>
`:void 0}
`:i.dy``}},{kind:"method",key:"updated",value:function(e){if(!e.has("stateObj"))return;const t=e.get("stateObj"),r=t?t.entity_id:void 0,i=this.stateObj?this.stateObj.entity_id:void 0;i!==r&&i&&this.hass.config.components.includes("stream")&&(0,o.e)(this.stateObj,a.qW)&&this._fetchCameraPrefs()}},{kind:"method",key:"_fetchCameraPrefs",value:async function(){this._cameraPrefs=await(0,a.Xn)(this.hass,this.stateObj.entity_id)}},{kind:"method",key:"_handleCheckboxChanged",value:async function(e){const t=e.currentTarget;try{this._cameraPrefs=await(0,a.Mw)(this.hass,this.stateObj.entity_id,{preload_stream:t.checked})}catch(r){alert(r.message),t.checked=!t.checked}}},{kind:"get",static:!0,key:"styles",value:function(){return i.iv`
paper-checkbox {
position: absolute;
top: 0;
right: 0;
background-color: var(--secondary-background-color);
padding: 5px;
border-bottom-left-radius: 6px;
}
`}}]}}),i.oi);customElements.define("more-info-camera",k)}}]);
//# sourceMappingURL=chunk.a32b5a99e3faa755dc50.js.map