UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

2 lines 42.5 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([[4564],{24734:function(e,t,n){"use strict";n.d(t,{B:function(){return i}});var r=n(47181),i=function(e,t){(0,r.B)(e,"show-dialog",{dialogTag:"dialog-media-player-browse",dialogImport:function(){return Promise.all([n.e(5009),n.e(4358),n.e(6755),n.e(1041),n.e(8374),n.e(6372),n.e(9119),n.e(2174),n.e(3238),n.e(8967),n.e(4535),n.e(4821),n.e(3998),n.e(5397),n.e(2509)]).then(n.bind(n,52809))},dialogParams:t})}},54564:function(e,t,n){"use strict";n.r(t),n.d(t,{HuiMediaControlCard:function(){return je}});n(25230);var r=n(55317),i=(n(85481),n(15652)),o=n(81471),a=n(79865),s=n(99824),c=n.n(s),l=n(62877),u=n(47181),d=n(91741),f=n(36145),p=n(40095),h=n(38346),m=(n(22098),n(16509),n(10983),n(52039),n(24734)),v=n(56007),y=n(69371),g=function(e,t,n){var r=[e,t,n].map((function(e){return(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)}));return.2126*r[0]+.7152*r[1]+.0722*r[2]};function b(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return k(e,t)}(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 k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var _=n(64588),w=n(53658),E=n(54845);function x(e){return(x="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})(e)}function C(){var e=j(["\n :host {\n display: flex;\n position: relative;\n align-items: center;\n height: 1em;\n contain: strict;\n }\n\n .marquee-inner {\n position: absolute;\n left: 0;\n right: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n }\n\n :host(.hovering) .marquee-inner {\n text-overflow: initial;\n overflow: initial;\n }\n\n :host([animating]) .marquee-inner {\n left: initial;\n right: initial;\n animation: marquee 10s linear infinite;\n }\n\n :host([animating]) .marquee-inner span {\n padding-right: 16px;\n }\n\n @keyframes marquee {\n 0% {\n transform: translateX(0%);\n }\n 100% {\n transform: translateX(-50%);\n }\n }\n "]);return C=function(){return e},e}function O(){var e=j([" <span>","</span> "]);return O=function(){return e},e}function P(){var e=j(['\n <div class="marquee-inner" @animationiteration=',">\n <span>","</span>\n ","\n </div>\n "]);return P=function(){return e},e}function S(){var e=j([""]);return S=function(){return e},e}function j(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function D(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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=L(e);if(t){var i=L(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return I(this,n)}}function I(e,t){return!t||"object"!==x(t)&&"function"!=typeof t?T(e):t}function T(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function R(){R=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(r){t.forEach((function(t){var i=t.placement;if(t.kind===r&&("static"===i||"prototype"===i)){var o="static"===i?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var r=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],r=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!B(e))return n.push(e);var t=this.decorateElement(e,i);n.push(t.element),n.push.apply(n,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:n,finishers:r};var o=this.decorateConstructor(n,t);return r.push.apply(r,o.finishers),o.finishers=r,o},addElementPlacement:function(e,t,n){var r=t[e.placement];if(!n&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var n=[],r=[],i=e.decorators,o=i.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,i[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&r.push(c.finisher);var l=c.extras;if(l){for(var u=0;u<l.length;u++)this.addElementPlacement(l[u],t);n.push.apply(n,l)}}return{element:e,finishers:r,extras:n}},decorateConstructor:function(e,t){for(var n=[],r=t.length-1;r>=0;r--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[r])(i)||i);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&&Symbol.iterator in Object(e))return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return N(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)?N(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=U(e.key),r=String(e.placement);if("static"!==r&&"prototype"!==r&&"own"!==r)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 "'+r+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:n,placement:r,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:V(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=V(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:n}},runClassFinishers:function(e,t){for(var n=0;n<t.length;n++){var r=(0,t[n])(e);if(void 0!==r){if("function"!=typeof r)throw new TypeError("Finishers must return a constructor.");e=r}}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 M(e){var t,n=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 r={kind:"field"===e.kind?"field":"method",key:n,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(r.decorators=e.decorators),"field"===e.kind&&(r.initializer=e.value),r}function q(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function B(e){return e.decorators&&e.decorators.length}function F(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function V(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 U(e){var t=function(e,t){if("object"!==x(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===x(t)?t:String(t)}function N(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function H(e,t,n){return(H="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=L(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function L(e){return(L=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}!function(e,t,n,r){var i=R();if(r)for(var o=0;o<r.length;o++)i=r[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),n),s=i.decorateClass(function(e){for(var t=[],n=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},r=0;r<e.length;r++){var i,o=e[r];if("method"===o.kind&&(i=t.find(n)))if(F(o.descriptor)||F(i.descriptor)){if(B(o)||B(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(B(o)){if(B(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}q(o,i)}else t.push(o)}return t}(a.d.map(M)),e);i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,i.Mo)("hui-marquee")],(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&&A(e,t)}(r,t);var n=D(r);function r(){var t;z(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=n.call.apply(n,[this].concat(o)),e(T(t)),t}return r}(t);return{F:n,d:[{kind:"field",decorators:[(0,i.Cb)()],key:"text",value:void 0},{kind:"field",decorators:[(0,i.Cb)({type:Boolean})],key:"active",value:void 0},{kind:"field",decorators:[(0,i.Cb)({reflect:!0,type:Boolean,attribute:"animating"})],key:"_animating",value:function(){return!1}},{kind:"method",key:"firstUpdated",value:function(e){var t=this;H(L(n.prototype),"firstUpdated",this).call(this,e),this.addEventListener("mouseover",(function(){return t.classList.add("hovering")}),{capture:!0}),this.addEventListener("mouseout",(function(){return t.classList.remove("hovering")}))}},{kind:"method",key:"updated",value:function(e){H(L(n.prototype),"updated",this).call(this,e),e.has("text")&&this._animating&&(this._animating=!1),e.has("active")&&this.active&&this.offsetWidth<this.scrollWidth&&(this._animating=!0)}},{kind:"method",key:"render",value:function(){return this.text?(0,i.dy)(P(),this._onIteration,this.text,this._animating?(0,i.dy)(O(),this.text):""):(0,i.dy)(S())}},{kind:"method",key:"_onIteration",value:function(){this.active||(this._animating=!1)}},{kind:"get",static:!0,key:"styles",value:function(){return(0,i.iv)(C())}}]}}),i.oi);var W=n(75502);function $(e){return($="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})(e)}function X(){var e=oe(['\n ha-card {\n overflow: hidden;\n height: 100%;\n }\n\n .background {\n display: flex;\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n transition: filter 0.8s;\n }\n\n .color-block {\n background-color: var(--primary-color);\n transition: background-color 0.8s;\n width: 100%;\n }\n\n .color-gradient {\n position: absolute;\n background-image: linear-gradient(\n to right,\n var(--primary-color),\n transparent\n );\n height: 100%;\n right: 0;\n opacity: 1;\n transition: width 0.8s, opacity 0.8s linear 0.8s;\n }\n\n .image {\n background-color: var(--primary-color);\n background-position: center;\n background-size: cover;\n background-repeat: no-repeat;\n position: absolute;\n right: 0;\n height: 100%;\n opacity: 1;\n transition: width 0.8s, background-image 0.8s, background-color 0.8s,\n background-size 0.8s, opacity 0.8s linear 0.8s;\n }\n\n .no-image .image {\n opacity: 0;\n }\n\n .no-img {\n background-color: var(--primary-color);\n background-size: initial;\n background-repeat: no-repeat;\n background-position: center center;\n padding-bottom: 0;\n position: absolute;\n right: 0;\n height: 100%;\n background-image: url("/static/images/card_media_player_bg.png");\n width: 50%;\n transition: opacity 0.8s, background-color 0.8s;\n }\n\n .off .image,\n .off .color-gradient {\n opacity: 0;\n transition: opacity 0s, width 0.8s;\n width: 0;\n }\n\n .unavailable .no-img,\n .background:not(.off):not(.no-image) .no-img {\n opacity: 0;\n }\n\n .player {\n position: relative;\n padding: 16px;\n color: var(--text-primary-color);\n transition-property: color, padding;\n transition-duration: 0.4s;\n }\n\n .controls {\n padding: 8px 8px 8px 0;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n transition: padding, color;\n transition-duration: 0.4s;\n margin-left: -12px;\n }\n\n .controls > div {\n display: flex;\n align-items: center;\n }\n\n .controls ha-icon-button {\n --mdc-icon-button-size: 44px;\n --mdc-icon-size: 30px;\n }\n\n ha-icon-button[action="media_play"],\n ha-icon-button[action="media_play_pause"],\n ha-icon-button[action="turn_on"],\n ha-icon-button[action="turn_off"] {\n --mdc-icon-button-size: 56px;\n --mdc-icon-size: 40px;\n }\n\n mwc-icon-button.browse-media {\n position: absolute;\n right: 0;\n --mdc-icon-size: 24px;\n }\n\n .top-info {\n display: flex;\n justify-content: space-between;\n }\n\n .icon-name {\n display: flex;\n height: fit-content;\n align-items: center;\n }\n\n .icon-name ha-icon {\n padding-right: 8px;\n }\n\n .more-info {\n position: absolute;\n top: 8px;\n right: 0px;\n }\n\n .media-info {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n }\n\n hui-marquee {\n font-size: 1.2em;\n margin: 0px 0 4px;\n }\n\n .title-controls {\n padding-top: 16px;\n }\n\n paper-progress {\n width: 100%;\n height: var(--paper-progress-height, 4px);\n margin-top: 4px;\n border-radius: calc(var(--paper-progress-height, 4px) / 2);\n --paper-progress-container-color: rgba(200, 200, 200, 0.5);\n }\n\n .no-image .controls {\n padding: 0;\n }\n\n .off.background {\n filter: grayscale(1);\n }\n\n .narrow .controls,\n .no-progress .controls {\n padding-bottom: 0;\n }\n\n .narrow ha-icon-button {\n --mdc-icon-button-size: 40px;\n --mdc-icon-size: 28px;\n }\n\n .narrow ha-icon-button[action="media_play"],\n .narrow ha-icon-button[action="media_play_pause"],\n .narrow ha-icon-button[action="turn_on"] {\n --mdc-icon-button-size: 50px;\n --mdc-icon-size: 36px;\n }\n\n .narrow ha-icon-button.browse-media {\n --mdc-icon-size: 24px;\n }\n\n .no-progress.player:not(.no-controls) {\n padding-bottom: 0px;\n }\n ']);return X=function(){return e},e}function G(e,t){return Ee(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(c){i=!0,o=c}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||_e(e,t)||ke()}function J(){var e=oe(["\n <paper-progress\n .max=","\n style=","\n @click=","\n ></paper-progress>\n "]);return J=function(){return e},e}function Y(){var e=oe(['\n <mwc-icon-button\n class="browse-media"\n .title=',"\n @click=","\n ><ha-svg-icon\n .path=","\n ></ha-svg-icon\n ></mwc-icon-button>\n "]);return Y=function(){return e},e}function Z(){var e=oe(["\n <ha-icon-button\n .title=","\n .icon=","\n action=","\n @click=","\n ></ha-icon-button>\n "]);return Z=function(){return e},e}function K(){var e=oe(['\n <div class="controls">\n ',"\n ","\n </div>\n "]);return K=function(){return e},e}function Q(){var e=oe(['\n <div class="media-info">\n <hui-marquee\n .text=',"\n .active=","\n @mouseover=","\n @mouseleave=","\n ></hui-marquee>\n ","\n </div>\n "]);return Q=function(){return e},e}function ee(){var e=oe(['\n <div\n class="title-controls"\n style=',"\n >\n ","\n ","\n </div>\n ","\n "]);return ee=function(){return e},e}function te(){var e=oe(['\n <div\n class="color-gradient"\n style=',"\n ></div>\n "]);return te=function(){return e},e}function ne(){var e=oe(['\n <ha-card>\n <div\n class="background ','"\n >\n <div\n class="color-block"\n style=','\n ></div>\n <div\n class="no-img"\n style=','\n ></div>\n <div class="image" style=',"></div>\n ",'\n </div>\n <div\n class="player ','"\n style=','\n >\n <div class="top-info">\n <div class="icon-name">\n <ha-icon class="icon" .icon=',"></ha-icon>\n <div>\n ",'\n </div>\n </div>\n <div>\n <ha-icon-button\n icon="hass:dots-vertical"\n class="more-info"\n @click=',"\n ></ha-icon-button>\n </div>\n </div>\n ","\n </div>\n </ha-card>\n "]);return ne=function(){return e},e}function re(){var e=oe(["\n <hui-warning>\n ","\n </hui-warning>\n "]);return re=function(){return e},e}function ie(){var e=oe([""]);return ie=function(){return e},e}function oe(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function ae(e,t,n,r,i,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(r,i)}function se(e){return function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){ae(o,r,i,a,s,"next",e)}function s(e){ae(o,r,i,a,s,"throw",e)}a(void 0)}))}}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})(e,t)}function ue(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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=Ce(e);if(t){var i=Ce(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return de(this,n)}}function de(e,t){return!t||"object"!==$(t)&&"function"!=typeof t?fe(e):t}function fe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pe(){pe=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(r){t.forEach((function(t){var i=t.placement;if(t.kind===r&&("static"===i||"prototype"===i)){var o="static"===i?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var r=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===r?void 0:r.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],r=[],i={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,i)}),this),e.forEach((function(e){if(!ve(e))return n.push(e);var t=this.decorateElement(e,i);n.push(t.element),n.push.apply(n,t.extras),r.push.apply(r,t.finishers)}),this),!t)return{elements:n,finishers:r};var o=this.decorateConstructor(n,t);return r.push.apply(r,o.finishers),o.finishers=r,o},addElementPlacement:function(e,t,n){var r=t[e.placement];if(!n&&-1!==r.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");r.push(e.key)},decorateElement:function(e,t){for(var n=[],r=[],i=e.decorators,o=i.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,i[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&r.push(c.finisher);var l=c.extras;if(l){for(var u=0;u<l.length;u++)this.addElementPlacement(l[u],t);n.push.apply(n,l)}}return{element:e,finishers:r,extras:n}},decorateConstructor:function(e,t){for(var n=[],r=t.length-1;r>=0;r--){var i=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[r])(i)||i);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,Ee(t)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(t)||_e(t)||ke()).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=be(e.key),r=String(e.placement);if("static"!==r&&"prototype"!==r&&"own"!==r)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 "'+r+'"');var i=e.descriptor;this.disallowProperty(e,"elements","An element descriptor");var o={kind:t,key:n,placement:r,descriptor:Object.assign({},i)};return"field"!==t?this.disallowProperty(e,"initializer","A method descriptor"):(this.disallowProperty(i,"get","The property descriptor of a field descriptor"),this.disallowProperty(i,"set","The property descriptor of a field descriptor"),this.disallowProperty(i,"value","The property descriptor of a field descriptor"),o.initializer=e.initializer),o},toElementFinisherExtras:function(e){return{element:this.toElementDescriptor(e),finisher:ge(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=ge(e,"finisher");return{elements:this.toElementDescriptors(e.elements),finisher:n}},runClassFinishers:function(e,t){for(var n=0;n<t.length;n++){var r=(0,t[n])(e);if(void 0!==r){if("function"!=typeof r)throw new TypeError("Finishers must return a constructor.");e=r}}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=be(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 r={kind:"field"===e.kind?"field":"method",key:n,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(r.decorators=e.decorators),"field"===e.kind&&(r.initializer=e.value),r}function me(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function ve(e){return e.decorators&&e.decorators.length}function ye(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function ge(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 be(e){var t=function(e,t){if("object"!==$(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!==$(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===$(t)?t:String(t)}function ke(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _e(e,t){if(e){if("string"==typeof e)return we(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)?we(e,t):void 0}}function we(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ee(e){if(Array.isArray(e))return e}function xe(e,t,n){return(xe="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=Ce(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function Ce(e){return(Ce=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Oe(e,t){return Math.round(100*(function(e,t){var n=g.apply(void 0,b(e)),r=g.apply(void 0,b(t));return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}(e,t)+Number.EPSILON))/100}var Pe=!1,Se=function(e){e.sort((function(e,t){return t.population-e.population}));for(var t,n=e[0],r=new Map,i=function(e){return r.has(e)||r.set(e,Oe(n.rgb,e.rgb)),r.get(e)>y.ZI},o=1;o<e.length&&void 0===t;o++){if(i(e[o])){Pe,t=e[o].hex;break}var a=e[o];Pe;for(var s=o+1;s<e.length;s++){var c=e[s],l=Math.abs(a.rgb[0]-c.rgb[0])+Math.abs(a.rgb[1]-c.rgb[1])+Math.abs(a.rgb[2]-c.rgb[2]);if(!(l>150)&&i(c)){Pe,t=c.hex;break}}}return void 0===t&&(t=n.bodyTextColor),[t,n.hex]},je=function(e,t,n,r){var i=pe();if(r)for(var o=0;o<r.length;o++)i=r[o](i);var a=t((function(e){i.initializeInstanceElements(e,s.elements)}),n),s=i.decorateClass(function(e){for(var t=[],n=function(e){return"method"===e.kind&&e.key===o.key&&e.placement===o.placement},r=0;r<e.length;r++){var i,o=e[r];if("method"===o.kind&&(i=t.find(n)))if(ye(o.descriptor)||ye(i.descriptor)){if(ve(o)||ve(i))throw new ReferenceError("Duplicated methods ("+o.key+") can't be decorated.");i.descriptor=o.descriptor}else{if(ve(o)){if(ve(i))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+o.key+").");i.decorators=o.decorators}me(o,i)}else t.push(o)}return t}(a.d.map(he)),e);return i.initializeClassElements(a.F,s.elements),i.runClassFinishers(a.F,s.finishers)}([(0,i.Mo)("hui-media-control-card")],(function(e,t){var s,g,b=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)}(r,t);var n=ue(r);function r(){var t;ce(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return t=n.call.apply(n,[this].concat(o)),e(fe(t)),t}return r}(t);return{F:b,d:[{kind:"method",static:!0,key:"getConfigElement",value:(g=se(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all([n.e(1041),n.e(8374),n.e(4268),n.e(4535),n.e(7845)]).then(n.bind(n,52105));case 2:return e.abrupt("return",document.createElement("hui-media-control-card-editor"));case 3:case"end":return e.stop()}}),e)}))),function(){return g.apply(this,arguments)})},{kind:"method",static:!0,key:"getStubConfig",value:function(e,t,n){return{type:"media-control",entity:(0,_.j)(e,1,t,n,["media_player"])[0]||""}}},{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_config",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_foregroundColor",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_backgroundColor",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_narrow",value:function(){return!1}},{kind:"field",decorators:[(0,i.sz)()],key:"_veryNarrow",value:function(){return!1}},{kind:"field",decorators:[(0,i.sz)()],key:"_cardHeight",value:function(){return 0}},{kind:"field",decorators:[(0,i.IO)("paper-progress")],key:"_progressBar",value:void 0},{kind:"field",decorators:[(0,i.sz)()],key:"_marqueeActive",value:function(){return!1}},{kind:"field",key:"_progressInterval",value:void 0},{kind:"field",key:"_resizeObserver",value:void 0},{kind:"method",key:"getCardSize",value:function(){return 3}},{kind:"method",key:"setConfig",value:function(e){if(!e.entity||"media_player"!==e.entity.split(".")[0])throw new Error("Specify an entity from within the media_player domain.");this._config=e}},{kind:"method",key:"connectedCallback",value:function(){var e=this;if(xe(Ce(b.prototype),"connectedCallback",this).call(this),this.updateComplete.then((function(){return e._attachObserver()})),this.hass&&this._config){var t=this._stateObj;t&&!this._progressInterval&&this._showProgressBar&&"playing"===t.state&&(this._progressInterval=window.setInterval((function(){return e._updateProgressBar()}),1e3))}}},{kind:"method",key:"disconnectedCallback",value:function(){this._progressInterval&&(clearInterval(this._progressInterval),this._progressInterval=void 0),this._resizeObserver&&this._resizeObserver.disconnect()}},{kind:"method",key:"render",value:function(){var e=this;if(!this.hass||!this._config)return(0,i.dy)(ie());var t=this._stateObj;if(!t)return(0,i.dy)(re(),(0,W.i)(this.hass,this._config.entity));var n={"background-image":this._image?"url(".concat(this.hass.hassUrl(this._image),")"):"none",width:"".concat(this._cardHeight,"px"),"background-color":this._backgroundColor||""},s={"background-image":"linear-gradient(to right, ".concat(this._backgroundColor,", ").concat(this._backgroundColor+"00",")"),width:"".concat(this._cardHeight,"px")},c=t.state,l="off"===c,u=v.V_.includes(c)||"off"===c&&!(0,p.e)(t,y.rv),h=!this._image,m=this._getControls(),g=m&&(!this._veryNarrow||l||"idle"===c||"on"===c),b=(0,y.Mj)(t);return(0,i.dy)(ne(),(0,o.$)({"no-image":h,off:l||u,unavailable:u}),(0,a.V)({"background-color":this._backgroundColor||""}),(0,a.V)({"background-color":this._backgroundColor||""}),(0,a.V)(n),h?"":(0,i.dy)(te(),(0,a.V)(s)),(0,o.$)({"no-image":h,narrow:this._narrow&&!this._veryNarrow,off:l||u,"no-progress":this._veryNarrow||!this._showProgressBar,"no-controls":!g}),(0,a.V)({color:this._foregroundColor||""}),(0,f.M)(t),this._config.name||(0,d.C)(this.hass.states[this._config.entity]),this._handleMoreInfo,u?"":(0,i.dy)(ee(),(0,a.V)({paddingRight:l?"0":"".concat(this._cardHeight-40,"px")}),b||t.attributes.media_title?(0,i.dy)(Q(),t.attributes.media_title||b,this._marqueeActive,this._marqueeMouseOver,this._marqueeMouseLeave,t.attributes.media_title?b:""):"",g?(0,i.dy)(K(),m.map((function(t){return(0,i.dy)(Z(),e.hass.localize("ui.card.media_player.".concat(t.action)),t.icon,t.action,e._handleClick)})),(0,p.e)(t,y.pu)?(0,i.dy)(Y(),this.hass.localize("ui.card.media_player.browse_media"),this._handleBrowseMedia,r.hBf):""):"",this._showProgressBar?(0,i.dy)(J(),t.attributes.media_duration,(0,a.V)({"--paper-progress-active-color":this._foregroundColor||"var(--accent-color)",cursor:(0,p.e)(t,y.xh)?"pointer":"initial"}),this._handleSeek):""))}},{kind:"method",key:"shouldUpdate",value:function(e){return(0,w.G)(this,e)}},{kind:"method",key:"firstUpdated",value:function(){this._measureCard(),this._attachObserver()}},{kind:"method",key:"updated",value:function(e){var t,n,r=this;if(xe(Ce(b.prototype),"updated",this).call(this,e),this._config&&this.hass&&e.has("hass")){var i=this._stateObj;if(!i)return this._progressInterval&&(clearInterval(this._progressInterval),this._progressInterval=void 0),this._foregroundColor=void 0,void(this._backgroundColor=void 0);var o=e.get("hass"),a=e.get("_config");o&&a&&o.themes===this.hass.themes&&a.theme===this._config.theme||(0,l.R)(this,this.hass.themes,this._config.theme),this._updateProgressBar(),!this._progressInterval&&this._showProgressBar&&"playing"===i.state?this._progressInterval=window.setInterval((function(){return r._updateProgressBar()}),1e3):!this._progressInterval||this._showProgressBar&&"playing"===i.state||(clearInterval(this._progressInterval),this._progressInterval=void 0);var s=(null==o||null===(t=o.states[this._config.entity])||void 0===t?void 0:t.attributes.entity_picture_local)||(null==o||null===(n=o.states[this._config.entity])||void 0===n?void 0:n.attributes.entity_picture);if(!this._image)return this._foregroundColor=void 0,void(this._backgroundColor=void 0);this._image!==s&&this._setColors()}}},{kind:"method",key:"_getControls",value:function(){var e=this._stateObj;if(e){var t=e.state;if(!v.V_.includes(t)){if("off"===t)return(0,p.e)(e,y.rv)?[{icon:"hass:power",action:"turn_on"}]:void 0;if("on"===t)return(0,p.e)(e,y.VJ)?[{icon:"hass:power",action:"turn_off"}]:void 0;if("idle"===t)return(0,p.e)(e,y.ep)?[{icon:"hass:play",action:"media_play"}]:void 0;var n=[];return(0,p.e)(e,y.Y3)&&n.push({icon:"hass:skip-previous",action:"media_previous_track"}),("playing"===t&&((0,p.e)(e,y.MU)||(0,p.e)(e,y.VH))||"paused"===t&&(0,p.e)(e,y.ep))&&n.push({icon:"playing"!==t?"hass:play":(0,p.e)(e,y.MU)?"hass:pause":"hass:stop",action:"media_play_pause"}),(0,p.e)(e,y.Bp)&&n.push({icon:"hass:skip-next",action:"media_next_track"}),n.length>0?n:void 0}}}},{kind:"get",key:"_image",value:function(){if(this.hass&&this._config){var e=this._stateObj;if(e)return e.attributes.entity_picture_local||e.attributes.entity_picture}}},{kind:"get",key:"_showProgressBar",value:function(){if(!this.hass||!this._config||this._narrow)return!1;var e=this._stateObj;return!!e&&(("playing"===e.state||"paused"===e.state)&&"media_duration"in e.attributes&&"media_position"in e.attributes)}},{kind:"method",key:"_measureCard",value:function(){var e=this.shadowRoot.querySelector("ha-card");e&&(this._narrow=e.offsetWidth<350,this._veryNarrow=e.offsetWidth<300,this._cardHeight=e.offsetHeight)}},{kind:"method",key:"_attachObserver",value:(s=se(regeneratorRuntime.mark((function e(){var t,n=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._resizeObserver){e.next=4;break}return e.next=3,(0,E.P)();case 3:this._resizeObserver=new ResizeObserver((0,h.D)((function(){return n._measureCard()}),250,!1));case 4:if(t=this.shadowRoot.querySelector("ha-card")){e.next=7;break}return e.abrupt("return");case 7:this._resizeObserver.observe(t);case 8:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{kind:"method",key:"_handleMoreInfo",value:function(){(0,u.B)(this,"hass-more-info",{entityId:this._config.entity})}},{kind:"method",key:"_handleBrowseMedia",value:function(){var e=this;(0,m.B)(this,{action:"play",entityId:this._config.entity,mediaPickedCallback:function(t){return e._playMedia(t.item.media_content_id,t.item.media_content_type)}})}},{kind:"method",key:"_playMedia",value:function(e,t){this.hass.callService("media_player","play_media",{entity_id:this._config.entity,media_content_id:e,media_content_type:t})}},{kind:"method",key:"_handleClick",value:function(e){var t=e.currentTarget.getAttribute("action");this.hass.callService("media_player",t,{entity_id:this._config.entity})}},{kind:"method",key:"_updateProgressBar",value:function(){this._progressBar&&(this._progressBar.value=(0,y.rs)(this._stateObj))}},{kind:"get",key:"_stateObj",value:function(){return this.hass.states[this._config.entity]}},{kind:"method",key:"_handleSeek",value:function(e){var t=this._stateObj;if((0,p.e)(t,y.xh)){var n=this.shadowRoot.querySelector("paper-progress").offsetWidth,r=e.offsetX/n,i=e.currentTarget.max*r;this.hass.callService("media_player","media_seek",{entity_id:this._config.entity,seek_position:i})}}},{kind:"method",key:"_setColors",value:function(){var e=this;this._image&&new(c())(this._image,{colorCount:16,generator:Se}).getPalette().then((function(t){var n=G(t,2),r=n[0],i=n[1];e._backgroundColor=i,e._foregroundColor=r})).catch((function(t){console.error("Error getting Image Colors",t),e._foregroundColor=void 0,e._backgroundColor=void 0}))}},{kind:"method",key:"_marqueeMouseOver",value:function(){this._marqueeActive||(this._marqueeActive=!0)}},{kind:"method",key:"_marqueeMouseLeave",value:function(){this._marqueeActive&&(this._marqueeActive=!1)}},{kind:"get",static:!0,key:"styles",value:function(){return(0,i.iv)(X())}}]}}),i.oi)}}]); //# sourceMappingURL=chunk.83e371ba66101ab86f31.js.map