From 8f84c874da763894aba4430c3b0933deb27b4a56 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Aug 2020 11:49:42 +0200 Subject: [PATCH] Add dist files --- dist/spotify-card.js | 260 ++++++++++++++++++++++----------------- dist/spotify-card.js.map | 2 +- src/const.ts | 2 +- 3 files changed, 149 insertions(+), 115 deletions(-) diff --git a/dist/spotify-card.js b/dist/spotify-card.js index c801769..6f74455 100644 --- a/dist/spotify-card.js +++ b/dist/spotify-card.js @@ -12,7 +12,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -function e(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(r=(o<3?n(r):o>3?n(t,i,r):n(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r +function e(e,t,i,s){var n,a=arguments.length,r=a<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(r=(a<3?n(r):a>3?n(t,i,r):n(t,i))||r);return a>3&&r&&Object.defineProperty(t,i,r),r /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -25,7 +25,7 @@ function e(e,t,i,s){var n,o=arguments.length,r=o<3?t:null===s?s=Object.getOwnPro * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */}const t="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,i=(e,t,i=null)=>{for(;t!==i;){const i=t.nextSibling;e.removeChild(t),t=i}},s=`{{lit-${String(Math.random()).slice(2)}}}`,n=`\x3c!--${s}--\x3e`,o=new RegExp(`${s}|${n}`);class r{constructor(e,t){this.parts=[],this.element=t;const i=[],n=[],r=document.createTreeWalker(t.content,133,null,!1);let c=0,h=-1,p=0;const{strings:u,values:{length:g}}=e;for(;p0;){const t=u[p],i=d.exec(t)[2],s=i.toLowerCase()+"$lit$",n=e.getAttribute(s);e.removeAttribute(s);const r=n.split(o);this.parts.push({type:"attribute",index:h,name:i,strings:r}),p+=r.length-1}}"TEMPLATE"===e.tagName&&(n.push(e),r.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(s)>=0){const s=e.parentNode,n=t.split(o),r=n.length-1;for(let t=0;t{const i=e.length-t.length;return i>=0&&e.slice(i)===t},c=e=>-1!==e.index,l=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function h(e,t){const{element:{content:i},parts:s}=e,n=document.createTreeWalker(i,133,null,!1);let o=u(s),r=s[o],a=-1,c=0;const l=[];let d=null;for(;n.nextNode();){a++;const e=n.currentNode;for(e.previousSibling===d&&(d=null),t.has(e)&&(l.push(e),null===d&&(d=e)),null!==d&&c++;void 0!==r&&r.index===a;)r.index=null!==d?-1:r.index-c,o=u(s,o),r=s[o]}l.forEach(e=>e.parentNode.removeChild(e))}const p=e=>{let t=11===e.nodeType?0:1;const i=document.createTreeWalker(e,133,null,!1);for(;i.nextNode();)t++;return t},u=(e,t=-1)=>{for(let i=t+1;i{for(;t!==i;){const i=t.nextSibling;e.removeChild(t),t=i}},s=`{{lit-${String(Math.random()).slice(2)}}}`,n=`\x3c!--${s}--\x3e`,a=new RegExp(`${s}|${n}`);class r{constructor(e,t){this.parts=[],this.element=t;const i=[],n=[],r=document.createTreeWalker(t.content,133,null,!1);let l=0,h=-1,p=0;const{strings:u,values:{length:g}}=e;for(;p0;){const t=u[p],i=d.exec(t)[2],s=i.toLowerCase()+"$lit$",n=e.getAttribute(s);e.removeAttribute(s);const r=n.split(a);this.parts.push({type:"attribute",index:h,name:i,strings:r}),p+=r.length-1}}"TEMPLATE"===e.tagName&&(n.push(e),r.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(s)>=0){const s=e.parentNode,n=t.split(a),r=n.length-1;for(let t=0;t{const i=e.length-t.length;return i>=0&&e.slice(i)===t},l=e=>-1!==e.index,c=()=>document.createComment(""),d=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function h(e,t){const{element:{content:i},parts:s}=e,n=document.createTreeWalker(i,133,null,!1);let a=u(s),r=s[a],o=-1,l=0;const c=[];let d=null;for(;n.nextNode();){o++;const e=n.currentNode;for(e.previousSibling===d&&(d=null),t.has(e)&&(c.push(e),null===d&&(d=e)),null!==d&&l++;void 0!==r&&r.index===o;)r.index=null!==d?-1:r.index-l,a=u(s,a),r=s[a]}c.forEach(e=>e.parentNode.removeChild(e))}const p=e=>{let t=11===e.nodeType?0:1;const i=document.createTreeWalker(e,133,null,!1);for(;i.nextNode();)t++;return t},u=(e,t=-1)=>{for(let i=t+1;i"function"==typeof e&&g.has(e),f={},m={}; +const g=new WeakMap,v=e=>"function"==typeof e&&g.has(e),f={},m={}; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -53,7 +53,7 @@ const g=new WeakMap,_=e=>"function"==typeof e&&g.has(e),f={},m={}; * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ -class v{constructor(e,t,i){this.__parts=[],this.template=e,this.processor=t,this.options=i}update(e){let t=0;for(const i of this.__parts)void 0!==i&&i.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=t?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),i=[],s=this.template.parts,n=document.createTreeWalker(e,133,null,!1);let o,r=0,a=0,l=n.nextNode();for(;r-1||i)&&-1===e.indexOf("--\x3e",r+1);const a=d.exec(e);t+=null===a?e+(i?y:n):e.substr(0,a.index)+a[1]+a[2]+"$lit$"+a[3]+s}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}} + */const y=` ${s} `;class b{constructor(e,t,i,s){this.strings=e,this.values=t,this.type=i,this.processor=s}getHTML(){const e=this.strings.length-1;let t="",i=!1;for(let a=0;a-1||i)&&-1===e.indexOf("--\x3e",r+1);const o=d.exec(e);t+=null===o?e+(i?y:n):e.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+s}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}} /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -79,7 +79,7 @@ class v{constructor(e,t,i){this.__parts=[],this.template=e,this.processor=t,this * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */const b=e=>null===e||!("object"==typeof e||"function"==typeof e),S=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class C{constructor(e,t,i){this.dirty=!0,this.element=e,this.name=t,this.strings=i,this.parts=[];for(let e=0;e{try{const e={get capture(){return N=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class T{constructor(e,t,i){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=i,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;_(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=f,e(this)}if(this.__pendingValue===f)return;const e=this.__pendingValue,t=this.value,i=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),s=null!=e&&(null==t||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=E(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=f}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const E=e=>e&&(N?{capture:e.capture,passive:e.passive,once:e.once}:e.capture) + */const w=e=>null===e||!("object"==typeof e||"function"==typeof e),S=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class C{constructor(e,t,i){this.dirty=!0,this.element=e,this.name=t,this.strings=i,this.parts=[];for(let e=0;e{try{const e={get capture(){return D=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}})();class N{constructor(e,t,i){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=i,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;v(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=f,e(this)}if(this.__pendingValue===f)return;const e=this.__pendingValue,t=this.value,i=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),s=null!=e&&(null==t||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=E(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=f}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const E=e=>e&&(D?{capture:e.capture,passive:e.passive,once:e.once}:e.capture) /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -92,7 +92,7 @@ class v{constructor(e,t,i){this.__parts=[],this.template=e,this.processor=t,this * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */;function O(e){let t=V.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},V.set(e.type,t));let i=t.stringsArray.get(e.strings);if(void 0!==i)return i;const n=e.strings.join(s);return i=t.keyString.get(n),void 0===i&&(i=new r(e,e.getTemplateElement()),t.keyString.set(n,i)),t.stringsArray.set(e.strings,i),i}const V=new Map,A=new WeakMap; + */;function V(e){let t=T.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},T.set(e.type,t));let i=t.stringsArray.get(e.strings);if(void 0!==i)return i;const n=e.strings.join(s);return i=t.keyString.get(n),void 0===i&&(i=new r(e,e.getTemplateElement()),t.keyString.set(n,i)),t.stringsArray.set(e.strings,i),i}const T=new Map,A=new WeakMap; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -105,7 +105,7 @@ class v{constructor(e,t,i){this.__parts=[],this.template=e,this.processor=t,this * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */const D=new + */const O=new /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -119,7 +119,7 @@ class v{constructor(e,t,i){this.__parts=[],this.template=e,this.processor=t,this * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ -class{handleAttributeExpressions(e,t,i,s){const n=t[0];if("."===n){return new k(e,t.slice(1),i).parts}if("@"===n)return[new T(e,t.slice(1),s.eventContext)];if("?"===n)return[new P(e,t.slice(1),i)];return new C(e,t,i).parts}handleTextExpression(e){return new $(e)}}; +class{handleAttributeExpressions(e,t,i,s){const n=t[0];if("."===n){return new k(e,t.slice(1),i).parts}if("@"===n)return[new N(e,t.slice(1),s.eventContext)];if("?"===n)return[new $(e,t.slice(1),i)];return new C(e,t,i).parts}handleTextExpression(e){return new P(e)}}; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -132,7 +132,7 @@ class{handleAttributeExpressions(e,t,i,s){const n=t[0];if("."===n){return new k( * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const z=(e,...t)=>new w(e,t,"html",D) + */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const z=(e,...t)=>new b(e,t,"html",O) /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -145,7 +145,7 @@ class{handleAttributeExpressions(e,t,i,s){const n=t[0];if("."===n){return new k( * Code distributed by Google as part of the polymer project is also * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt - */,U=(e,t)=>`${e}--${t}`;let j=!0;void 0===window.ShadyCSS?j=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),j=!1);const H=e=>t=>{const i=U(t.type,e);let n=V.get(i);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},V.set(i,n));let o=n.stringsArray.get(t.strings);if(void 0!==o)return o;const a=t.strings.join(s);if(o=n.keyString.get(a),void 0===o){const i=t.getTemplateElement();j&&window.ShadyCSS.prepareTemplateDom(i,e),o=new r(t,i),n.keyString.set(a,o)}return n.stringsArray.set(t.strings,o),o},L=["html","svg"],Y=new Set,R=(e,t,i)=>{Y.add(e);const s=i?i.element:document.createElement("template"),n=t.querySelectorAll("style"),{length:o}=n;if(0===o)return void window.ShadyCSS.prepareTemplateStyles(s,e);const r=document.createElement("style");for(let e=0;e{L.forEach(t=>{const i=V.get(U(t,e));void 0!==i&&i.keyString.forEach(e=>{const{element:{content:t}}=e,i=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{i.add(e)}),h(e,i)})})})(e);const a=s.content;i?function(e,t,i=null){const{element:{content:s},parts:n}=e;if(null==i)return void s.appendChild(t);const o=document.createTreeWalker(s,133,null,!1);let r=u(n),a=0,c=-1;for(;o.nextNode();){c++;for(o.currentNode===i&&(a=p(t),i.parentNode.insertBefore(t,i));-1!==r&&n[r].index===c;){if(a>0){for(;-1!==r;)n[r].index+=a,r=u(n,r);return}r=u(n,r)}}}(i,r,a.firstChild):a.insertBefore(r,a.firstChild),window.ShadyCSS.prepareTemplateStyles(s,e);const c=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)t.insertBefore(c.cloneNode(!0),t.firstChild);else if(i){a.insertBefore(r,a.firstChild);const e=new Set;e.add(r),h(i,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const q={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},F=(e,t)=>t!==e&&(t==t||e==e),W={attribute:!0,type:String,converter:q,reflect:!1,hasChanged:F};class I extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,i)=>{const s=this._attributeNameForProperty(i,t);void 0!==s&&(this._attributeToPropertyMap.set(s,i),e.push(s))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=W){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const i="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,i,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(i){const s=this[e];this[t]=i,this._requestUpdate(e,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||W}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const i of t)this.createProperty(i,e[i])}}static _attributeNameForProperty(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,i=F){return i(e,t)}static _propertyValueFromAttribute(e,t){const i=t.type,s=t.converter||q,n="function"==typeof s?s:s.fromAttribute;return n?n(e,i):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const i=t.type,s=t.converter;return(s&&s.toAttribute||q.toAttribute)(e,i)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,i){t!==i&&this._attributeToProperty(e,i)}_propertyToAttribute(e,t,i=W){const s=this.constructor,n=s._attributeNameForProperty(e,i);if(void 0!==n){const e=s._propertyValueToAttribute(t,i);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(n):this.setAttribute(n,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const i=this.constructor,s=i._attributeToPropertyMap.get(e);if(void 0!==s){const e=i.getPropertyOptions(s);this._updateState=16|this._updateState,this[s]=i._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}_requestUpdate(e,t){let i=!0;if(void 0!==e){const s=this.constructor,n=s.getPropertyOptions(e);s._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}I.finalized=!0; + */,H=(e,t)=>`${e}--${t}`;let U=!0;void 0===window.ShadyCSS?U=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),U=!1);const j=e=>t=>{const i=H(t.type,e);let n=T.get(i);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},T.set(i,n));let a=n.stringsArray.get(t.strings);if(void 0!==a)return a;const o=t.strings.join(s);if(a=n.keyString.get(o),void 0===a){const i=t.getTemplateElement();U&&window.ShadyCSS.prepareTemplateDom(i,e),a=new r(t,i),n.keyString.set(o,a)}return n.stringsArray.set(t.strings,a),a},L=["html","svg"],R=new Set,F=(e,t,i)=>{R.add(e);const s=i?i.element:document.createElement("template"),n=t.querySelectorAll("style"),{length:a}=n;if(0===a)return void window.ShadyCSS.prepareTemplateStyles(s,e);const r=document.createElement("style");for(let e=0;e{L.forEach(t=>{const i=T.get(H(t,e));void 0!==i&&i.keyString.forEach(e=>{const{element:{content:t}}=e,i=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{i.add(e)}),h(e,i)})})})(e);const o=s.content;i?function(e,t,i=null){const{element:{content:s},parts:n}=e;if(null==i)return void s.appendChild(t);const a=document.createTreeWalker(s,133,null,!1);let r=u(n),o=0,l=-1;for(;a.nextNode();)for(l++,a.currentNode===i&&(o=p(t),i.parentNode.insertBefore(t,i));-1!==r&&n[r].index===l;){if(o>0){for(;-1!==r;)n[r].index+=o,r=u(n,r);return}r=u(n,r)}}(i,r,o.firstChild):o.insertBefore(r,o.firstChild),window.ShadyCSS.prepareTemplateStyles(s,e);const l=o.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(i){o.insertBefore(r,o.firstChild);const e=new Set;e.add(r),h(i,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const Y={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},q=(e,t)=>t!==e&&(t==t||e==e),W={attribute:!0,type:String,converter:Y,reflect:!1,hasChanged:q};class I extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=new Promise(e=>this._enableUpdatingResolver=e),this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,i)=>{const s=this._attributeNameForProperty(i,t);void 0!==s&&(this._attributeToPropertyMap.set(s,i),e.push(s))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=W){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const i="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,i,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(i){const s=this[e];this[t]=i,this._requestUpdate(e,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this._classProperties&&this._classProperties.get(e)||W}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty("finalized")||e.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const i of t)this.createProperty(i,e[i])}}static _attributeNameForProperty(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,i=q){return i(e,t)}static _propertyValueFromAttribute(e,t){const i=t.type,s=t.converter||Y,n="function"==typeof s?s:s.fromAttribute;return n?n(e,i):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const i=t.type,s=t.converter;return(s&&s.toAttribute||Y.toAttribute)(e,i)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,i){t!==i&&this._attributeToProperty(e,i)}_propertyToAttribute(e,t,i=W){const s=this.constructor,n=s._attributeNameForProperty(e,i);if(void 0!==n){const e=s._propertyValueToAttribute(t,i);if(void 0===e)return;this._updateState=8|this._updateState,null==e?this.removeAttribute(n):this.setAttribute(n,e),this._updateState=-9&this._updateState}}_attributeToProperty(e,t){if(8&this._updateState)return;const i=this.constructor,s=i._attributeToPropertyMap.get(e);if(void 0!==s){const e=i.getPropertyOptions(s);this._updateState=16|this._updateState,this[s]=i._propertyValueFromAttribute(t,e),this._updateState=-17&this._updateState}}_requestUpdate(e,t){let i=!0;if(void 0!==e){const s=this.constructor,n=s.getPropertyOptions(e);s._valueHasChanged(this[e],t,n.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==n.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,n))):i=!1}!this._hasRequestedUpdate&&i&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(e){}const e=this.performUpdate();return null!=e&&await e,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{e=this.shouldUpdate(t),e?this.update(t):this._markUpdated()}catch(t){throw e=!1,this._markUpdated(),t}e&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0),this._markUpdated()}updated(e){}firstUpdated(e){}}I.finalized=!0; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -159,7 +159,7 @@ class{handleAttributeExpressions(e,t,i,s){const n=t[0];if("."===n){return new k( * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ -const B=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:i,elements:s}=t;return{kind:i,elements:s,finisher(t){window.customElements.define(e,t)}}})(e,t),Z=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(i){i.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(i){i.createProperty(t.key,e)}};function G(e){return(t,i)=>void 0!==i?((e,t,i)=>{t.constructor.createProperty(i,e)})(e,t,i):Z(e,t)}function J(e){return G({attribute:!1,hasChanged:null==e?void 0:e.hasChanged})} +const G=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t))(e,t):((e,t)=>{const{kind:i,elements:s}=t;return{kind:i,elements:s,finisher(t){window.customElements.define(e,t)}}})(e,t),B=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?Object.assign(Object.assign({},t),{finisher(i){i.createProperty(t.key,e)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(i){i.createProperty(t.key,e)}};function Z(e){return(t,i)=>void 0!==i?((e,t,i)=>{t.constructor.createProperty(i,e)})(e,t,i):B(e,t)}function J(e){return Z({attribute:!1,hasChanged:null==e?void 0:e.hasChanged})} /** @license Copyright (c) 2019 The Polymer Project Authors. All rights reserved. @@ -183,52 +183,59 @@ found at http://polymer.github.io/PATENTS.txt * subject to an additional IP rights grant found at * http://polymer.github.io/PATENTS.txt */ -(window.litElementVersions||(window.litElementVersions=[])).push("2.3.1");const te={};class ie extends I{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(void 0===e)this._styles=[];else if(Array.isArray(e)){const t=(e,i)=>e.reduceRight((e,i)=>Array.isArray(i)?t(i,e):(e.add(i),e),i),i=t(e,new Set),s=[];i.forEach(e=>s.unshift(e)),this._styles=s}else this._styles=[e]}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?K?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==te&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return te}}ie.finalized=!0,ie.render=(e,t,s)=>{if(!s||"object"!=typeof s||!s.scopeName)throw new Error("The `scopeName` option is required.");const n=s.scopeName,o=A.has(t),r=j&&11===t.nodeType&&!!t.host,a=r&&!Y.has(n),c=a?document.createDocumentFragment():t;if(((e,t,s)=>{let n=A.get(t);void 0===n&&(i(t,t.firstChild),A.set(t,n=new $(Object.assign({templateFactory:O},s))),n.appendInto(t)),n.setValue(e),n.commit()})(e,c,Object.assign({templateFactory:H(n)},s)),a){const e=A.get(c);A.delete(c);const s=e.value instanceof v?e.value.template:void 0;R(n,c,s),i(t,t.firstChild),t.appendChild(c),A.set(t,e)}!o&&r&&window.ShadyCSS.styleElement(t.host)};var se=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,ne="[^\\s]+",oe=/\[([^]*?)\]/gm;function re(e,t){for(var i=[],s=0,n=e.length;s-1?s:null}};function ce(e){for(var t=[],i=1;i3?0:(e-e%10!=10?1:0)*e%10]}},ue=ce({},pe),ge=function(e,t){for(void 0===t&&(t=2),e=String(e);e.length0?"-":"+")+ge(100*Math.floor(Math.abs(t)/60)+Math.abs(t)%60,4)},Z:function(e){var t=e.getTimezoneOffset();return(t>0?"-":"+")+ge(Math.floor(Math.abs(t)/60),2)+":"+ge(Math.abs(t)%60,2)}},fe=function(e){return+e-1},me=[null,"[1-9]\\d?"],ve=[null,ne],ye=["isPm",ne,function(e,t){var i=e.toLowerCase();return i===t.amPm[0]?0:i===t.amPm[1]?1:null}],we=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(e){var t=(e+"").match(/([+-]|\d\d)/gi);if(t){var i=60*+t[1]+parseInt(t[2],10);return"+"===t[0]?i:-i}return 0}],be=(ae("monthNamesShort"),ae("monthNames"),{default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"});var Se=function(e,t,i){if(void 0===t&&(t=be.default),void 0===i&&(i={}),"number"==typeof e&&(e=new Date(e)),"[object Date]"!==Object.prototype.toString.call(e)||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");var s=[];t=(t=be[t]||t).replace(oe,(function(e,t){return s.push(t),"@@@"}));var n=ce(ce({},ue),i);return(t=t.replace(se,(function(t){return _e[t](e,n)}))).replace(/@@@/g,(function(){return s.shift()}))},Ce=(function(){try{(new Date).toLocaleDateString("i")}catch(e){return"RangeError"===e.name}}(),function(){try{(new Date).toLocaleString("i")}catch(e){return"RangeError"===e.name}}(),function(){try{(new Date).toLocaleTimeString("i")}catch(e){return"RangeError"===e.name}}(),function(e,t,i,s){s=s||{},i=null==i?{}:i;var n=new Event(t,{bubbles:void 0===s.bubbles||s.bubbles,cancelable:Boolean(s.cancelable),composed:void 0===s.composed||s.composed});return n.detail=i,e.dispatchEvent(n),n});const xe=e=>{let t=[];function i(i,s){e=s?i:Object.assign(Object.assign({},e),i);let n=t;for(let t=0;t(t.push(e),()=>{!function(e){let i=[];for(let s=0;s{if(e[t])return e[t];let n,o=0,r=xe();const a=()=>i(e).then(e=>r.setState(e,!0)),c=()=>a().catch(t=>{if(e.connected)throw t});return e[t]={get state(){return r.state},refresh:a,subscribe(t){o++,1===o&&(s&&(n=s(e,r)),e.addEventListener("ready",c),c());const i=r.subscribe(t);return void 0!==r.state&&setTimeout(()=>t(r.state),0),()=>{i(),o--,o||(n&&n.then(e=>{e()}),e.removeEventListener("ready",a))}}},e[t]},Pe=e=>e.sendMessagePromise({type:"get_states"});function ke(e,t){if(void 0===e)return null;const{domain:i,service:s}=t.data;return{[i]:Object.assign({},e[i],{[s]:{description:"",fields:{}}})}}function Me(e,t){if(void 0===e)return null;const{domain:i,service:s}=t.data,n=e[i];if(!n||!(s in n))return null;const o={};return Object.keys(n).forEach(e=>{e!==s&&(o[e]=n[e])}),{[i]:o}}const Ne=e=>e.sendMessagePromise({type:"get_services"}),Te=(e,t)=>Promise.all([e.subscribeEvents(t.action(ke),"service_registered"),e.subscribeEvents(t.action(Me),"service_removed")]).then(e=>()=>e.forEach(e=>e()));async function Ee(e){const t=await Pe(e),i={};for(let e=0;ee.subscribeEvents(e=>function(e,t){const i=e.state;if(void 0===i)return;const{entity_id:s,new_state:n}=t.data;if(n)e.setState({[n.entity_id]:n});else{const t=Object.assign({},i);delete t[s],e.setState(t,!0)}}(t,e),"state_changed"),Ve=(e,t)=>(e=>$e(e,"_ent",Ee,Oe))(e).subscribe(t);var Ae={version:"Version",description:"A custom card for displaying Spotify-Playlist and starting playback",invalid_configuration:"Invalid configuration",show_warning:"Show Warning",show_missing_spotcast:"Spotcast integration has to be installed for this component to work",show_missing_spotify:"Spotify integration has to be installed for playback information",choose_player:"Choose player"},De={general:"General",general_description:"General settings for this card",appearance:"Appearance",appearance_description:"Customize the style, icon, etc",advanced:"Advanced",advanced_description:"Customize advanced settings",hide_warning:"Hide warnings",playlist_type:"Playlist Type",limit:"Amount of playlists shown",height:"Height of card",country_code:"Country Code for featured playlists",always_play_random_song:"Always play random song when starting playback",title:"Title of card",display_style:"Display Style",grid_covers_per_row:"Number of covers per row",grid_center_covers:"Center Covers",account:"Account",filter_out_cast_devices:"Filter out chromecast devices",spotify_entity:"Spotify media player entity",default_device:"Default device name",filter_devices:"Hide devices (see documentation under 'Advanced usage')"},ze={common:Ae,settings:De},Ue={version:"Version",description:"Eine Karte um Spotify-Playlist anzuzeigen und abzuspielen",invalid_configuration:"Ungültige Konfiguration",show_warning:"Warnung",show_missing_spotcast:"Die Spotcast-Integration muss installiert sein, damit diese Karte funktioniert",show_missing_spotify:"Die Spotify-Integration muss installiert sein, damit der Spotify-Status angezeigt werden kann"},je={general:"Generell",general_description:"Generelle Einstellungen",appearance:"Aussehen",appearance_description:"Passe den Stil und anderes an",hide_warning:"Verstecke Warnhinweise",playlist_type:"Playlist Typ",limit:"Anzahl an angezeigten Playlisten",height:"Höhe der Karte",country_code:"Länder-Code für die Featured-Playlist",always_play_random_song:"Spiele immer einen zufälligen Song beim Starten der Wiedergabe ab",title:"Titel der Karte",display_style:"Anzeige-Stil",grid_covers_per_row:"Number of covers per row",account:"Account",filter_out_cast_devices:"Filter out chromecast devices",spotify_entity:"Spotify media player entity",default_device:"Default device name"},He={common:Ue,settings:je},Le={version:"Version",description:"A custom card for displaying Spotify-Playlist and starting playback",invalid_configuration:"Invalid configuration",show_warning:"Show Warning",show_missing_spotcast:"Spotcast integration has to be installed for this component to work",show_missing_spotify:"Spotify integration has to be installed for playback information"},Ye={general:"General",general_description:"General settings for this card",appearance:"Appearance",appearance_description:"Customize the style, icon, etc",hide_warning:"Hide warnings",playlist_type:"Playlist Type",limit:"Amount of playlists shown",height:"Height of card",country_code:"Country Code for featured playlists",always_play_random_song:"Always play random song when starting playback",title:"Title of card",display_style:"Display Style",grid_covers_per_row:"Number of covers per row",account:"Account",filter_out_cast_devices:"Filter out chromecast devices",spotify_entity:"Spotify media player entity",default_device:"Default device name"},Re={common:Le,settings:Ye};const qe={en:Object.freeze({__proto__:null,common:Ae,settings:De,default:ze}),de:Object.freeze({__proto__:null,common:Ue,settings:je,default:He}),se:Object.freeze({__proto__:null,common:Le,settings:Ye,default:Re})};function Fe(e,t="",i=""){const s=e.split(".")[0],n=e.split(".")[1],o=(localStorage.getItem("selectedLanguage")||navigator.language.split("-")[0]||"en").replace(/['"]+/g,"").replace("-","_");let r;try{r=qe[o][s][n]}catch(e){r=qe.en[s][n]}return void 0===r&&(r=qe.en[s][n]),""!==t&&""!==i&&(r=r.replace(t,i)),r}const We={general:{icon:"tune",name:Fe("settings.general"),secondary:Fe("settings.general_description"),show:!0},appearance:{icon:"palette",name:Fe("settings.appearance"),secondary:Fe("settings.appearance_description"),show:!1},advanced:{icon:"pencil",name:Fe("settings.advanced"),secondary:Fe("settings.advanced_description"),show:!1}},Ie=["Default","featured","discover-weekly"],Be=["List","Grid"];let Ze=class extends ie{constructor(){super(...arguments),this.accounts=[],this.chromecast_devices=[]}async connectedCallback(){super.connectedCallback();const e=await this.hass.callWS({type:"spotcast/accounts"});this.accounts=e;const t=await this.hass.callWS({type:"spotcast/castdevices"});this.chromecast_devices=t.map(e=>e.friendly_name),this.requestUpdate()}setConfig(e){this._config=e}get _name(){return this._config&&this._config.name||""}get _account(){return this._config?this._config.account||"default":""}get _spotify_entity(){if(this._config){const e=this.getMediaPlayerEntities().filter(e=>e.entity_id.includes("spotify"));return this._config.spotify_entity||(e.length>0?e[0].entity_id:"")}return""}get _country_code(){return this._config&&this._config.country_code||""}get _limit(){return this._config&&this._config.limit||10}get _playlist_type(){return this._config?this._config.playlist_type||"Default":""}get _always_play_random_song(){return this._config&&this._config.always_play_random_song||!1}get _height(){return this._config&&this._config.height||""}get _display_style(){return this._config&&this._config.display_style||"List"}get _grid_covers_per_row(){return this._config&&this._config.grid_covers_per_row||5}get _grid_center_covers(){return this._config&&this._config.grid_center_covers||!1}get _hide_warning(){return this._config&&this._config.hide_warning||!1}get _show_warning(){return this._config&&this._config.show_warning||!1}get _show_error(){return this._config&&this._config.show_error||!1}get _default_device(){return this._config&&this._config.default_device||""}get _filter_devices(){var e;return this._config&&(null===(e=this._config.filter_devices)||void 0===e?void 0:e.toString())||""}getMediaPlayerEntities(){return Object.keys(this.hass.states).map(e=>this.hass.states[e]).filter(e=>e.entity_id.match("media_player[.]"))}renderGeneral(){const e=this.getMediaPlayerEntities().map(e=>e.entity_id);return z` +(window.litElementVersions||(window.litElementVersions=[])).push("2.3.1");const te={};class ie extends I{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const e=this.getStyles();if(void 0===e)this._styles=[];else if(Array.isArray(e)){const t=(e,i)=>e.reduceRight((e,i)=>Array.isArray(i)?t(i,e):(e.add(i),e),i),i=t(e,new Set),s=[];i.forEach(e=>s.unshift(e)),this._styles=s}else this._styles=[e]}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?K?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){const t=this.render();super.update(e),t!==te&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){return te}}ie.finalized=!0,ie.render=(e,t,s)=>{if(!s||"object"!=typeof s||!s.scopeName)throw new Error("The `scopeName` option is required.");const n=s.scopeName,a=A.has(t),r=U&&11===t.nodeType&&!!t.host,o=r&&!R.has(n),l=o?document.createDocumentFragment():t;if(((e,t,s)=>{let n=A.get(t);void 0===n&&(i(t,t.firstChild),A.set(t,n=new P(Object.assign({templateFactory:V},s))),n.appendInto(t)),n.setValue(e),n.commit()})(e,l,Object.assign({templateFactory:j(n)},s)),o){const e=A.get(l);A.delete(l);const s=e.value instanceof _?e.value.template:void 0;F(n,l,s),i(t,t.firstChild),t.appendChild(l),A.set(t,e)}!a&&r&&window.ShadyCSS.styleElement(t.host)};var se,ne,ae;!function(e){e.Grid="grid",e.List="list"}(se||(se={})),function(e){e.default="default",e.featured="featured",e.discover_weekly="discover-weekly"}(ne||(ne={})),function(e){e[e.Name=0]="Name",e[e.Account=1]="Account",e[e.Spotify_Entity=2]="Spotify_Entity",e[e.Country_Code=3]="Country_Code",e[e.Limit=4]="Limit",e[e.Playlist_Type=5]="Playlist_Type",e[e.Always_Play_Random_Song=6]="Always_Play_Random_Song",e[e.Height=7]="Height",e[e.Display_Style=8]="Display_Style",e[e.Grid_Covers_Per_Row=9]="Grid_Covers_Per_Row",e[e.Grid_Center_Covers=10]="Grid_Center_Covers",e[e.Hide_Warning=11]="Hide_Warning",e[e.Default_Device=12]="Default_Device",e[e.Filter_Devices=13]="Filter_Devices"}(ae||(ae={}));var re={version:"Version",description:"A custom card for displaying Spotify-Playlist and starting playback",invalid_configuration:"Invalid configuration",show_warning:"Show Warning",show_missing_spotcast:"Spotcast integration has to be installed for this component to work",show_missing_spotify:"Spotify integration has to be installed for playback information",choose_player:"Choose player"},oe={general:"General",general_description:"General settings for this card",appearance:"Appearance",appearance_description:"Customize the style, icon, etc",advanced:"Advanced",advanced_description:"Customize advanced settings",hide_warning:"Hide warnings",playlist_type:"Playlist Type",limit:"Amount of playlists shown",height:"Height of card",country_code:"Country Code for featured playlists",always_play_random_song:"Always play random song when starting playback",title:"Title of card",display_style:"Display Style",grid_covers_per_row:"Number of covers per row",grid_center_covers:"Center Covers",account:"Account",filter_out_cast_devices:"Filter out chromecast devices",spotify_entity:"Spotify media player entity",default_device:"Default device name",filter_devices:"Hide devices (see documentation under 'Advanced usage')"},le={common:re,settings:oe},ce={version:"Version",description:"Eine Karte um Spotify-Playlist anzuzeigen und abzuspielen",invalid_configuration:"Ungültige Konfiguration",show_warning:"Warnung",show_missing_spotcast:"Die Spotcast-Integration muss installiert sein, damit diese Karte funktioniert",show_missing_spotify:"Die Spotify-Integration muss installiert sein, damit der Spotify-Status angezeigt werden kann"},de={general:"Generell",general_description:"Generelle Einstellungen",appearance:"Aussehen",appearance_description:"Passe den Stil und anderes an",hide_warning:"Verstecke Warnhinweise",playlist_type:"Playlist Typ",limit:"Anzahl an angezeigten Playlisten",height:"Höhe der Karte",country_code:"Länder-Code für die Featured-Playlist",always_play_random_song:"Spiele immer einen zufälligen Song beim Starten der Wiedergabe ab",title:"Titel der Karte",display_style:"Anzeige-Stil",grid_covers_per_row:"Number of covers per row",account:"Account",filter_out_cast_devices:"Filter out chromecast devices",spotify_entity:"Spotify media player entity",default_device:"Default device name"},he={common:ce,settings:de},pe={version:"Version",description:"A custom card for displaying Spotify-Playlist and starting playback",invalid_configuration:"Invalid configuration",show_warning:"Show Warning",show_missing_spotcast:"Spotcast integration has to be installed for this component to work",show_missing_spotify:"Spotify integration has to be installed for playback information"},ue={general:"General",general_description:"General settings for this card",appearance:"Appearance",appearance_description:"Customize the style, icon, etc",hide_warning:"Hide warnings",playlist_type:"Playlist Type",limit:"Amount of playlists shown",height:"Height of card",country_code:"Country Code for featured playlists",always_play_random_song:"Always play random song when starting playback",title:"Title of card",display_style:"Display Style",grid_covers_per_row:"Number of covers per row",account:"Account",filter_out_cast_devices:"Filter out chromecast devices",spotify_entity:"Spotify media player entity",default_device:"Default device name"},ge={common:pe,settings:ue};const ve={en:Object.freeze({__proto__:null,common:re,settings:oe,default:le}),de:Object.freeze({__proto__:null,common:ce,settings:de,default:he}),se:Object.freeze({__proto__:null,common:pe,settings:ue,default:ge})};function fe(e,t="",i=""){const s=e.split(".")[0],n=e.split(".")[1],a=(localStorage.getItem("selectedLanguage")||navigator.language.split("-")[0]||"en").replace(/['"]+/g,"").replace("-","_");let r;try{r=ve[a][s][n]}catch(e){r=ve.en[s][n]}return void 0===r&&(r=ve.en[s][n]),""!==t&&""!==i&&(r=r.replace(t,i)),r}const me=e=>{let t=[];function i(i,s){e=s?i:Object.assign(Object.assign({},e),i);let n=t;for(let t=0;t(t.push(e),()=>{!function(e){let i=[];for(let s=0;s{if(e[t])return e[t];let n,a=0,r=me();const o=()=>i(e).then(e=>r.setState(e,!0)),l=()=>o().catch(t=>{if(e.connected)throw t});return e[t]={get state(){return r.state},refresh:o,subscribe(t){a++,1===a&&(s&&(n=s(e,r)),e.addEventListener("ready",l),l());const i=r.subscribe(t);return void 0!==r.state&&setTimeout(()=>t(r.state),0),()=>{i(),a--,a||(n&&n.then(e=>{e()}),e.removeEventListener("ready",o))}}},e[t]},ye=e=>e.sendMessagePromise({type:"get_states"});function be(e,t){if(void 0===e)return null;const{domain:i,service:s}=t.data;return{[i]:Object.assign({},e[i],{[s]:{description:"",fields:{}}})}}function we(e,t){if(void 0===e)return null;const{domain:i,service:s}=t.data,n=e[i];if(!n||!(s in n))return null;const a={};return Object.keys(n).forEach(e=>{e!==s&&(a[e]=n[e])}),{[i]:a}}const Se=e=>e.sendMessagePromise({type:"get_services"}),Ce=(e,t)=>Promise.all([e.subscribeEvents(t.action(be),"service_registered"),e.subscribeEvents(t.action(we),"service_removed")]).then(e=>()=>e.forEach(e=>e()));async function xe(e){const t=await ye(e),i={};for(let e=0;ee.subscribeEvents(e=>function(e,t){const i=e.state;if(void 0===i)return;const{entity_id:s,new_state:n}=t.data;if(n)e.setState({[n.entity_id]:n});else{const t=Object.assign({},i);delete t[s],e.setState(t,!0)}}(t,e),"state_changed"),$e=(e,t)=>(e=>_e(e,"_ent",xe,Pe))(e).subscribe(t);class ke{constructor(e){this.playlists=[],this.devices=[],this.chromecast_devices=[],this.state_ttl=4e3,this.last_state_update_time=0,this.loading=!1,this.parent=e}is_loading(){return setTimeout(this.set_loading_off,100),this.loading}set_loading_off(){this.loading=!1}is_loaded(){return void 0!==this.playlists.length}getPlaybackOptions(e){return{uri:e,force_playback:"playing"==this.parent.getSpotifyEntityState(),random_song:this.parent.config.always_play_random_song||!1,account:this.parent.config.account}}playUri(e){const t=this.getCurrentPlayer();if(!t){const t=this.parent.config.default_device;if(t){const i=this.devices.filter(e=>e.name==t);if(i.length>0)return this.playUriOnConnectDevice(i[0].id,e);{const i=this.chromecast_devices.filter(e=>e.friendly_name==t);if(i.length>0)return this.playUriOnCastDevice(i[0].friendly_name,e);throw new Error("Could not find default_device: "+t)}}throw new Error("No active device nor default device in settings")}this.playUriOnConnectDevice(t.id,e)}transferPlaybackToCastDevice(e){this.parent.hass.callService("spotcast","start",{device_name:e,force_playback:!0,account:this.parent.config.account})}transferPlaybackToConnectDevice(e){this.parent.hass.callService("spotcast","start",{spotify_device_id:e,force_playback:!0,account:this.parent.config.account})}playUriOnCastDevice(e,t){const i=Object.assign(Object.assign({},this.getPlaybackOptions(t)),{device_name:e});this.parent.hass.callService("spotcast","start",i)}playUriOnConnectDevice(e,t){const i=Object.assign(Object.assign({},this.getPlaybackOptions(t)),{spotify_device_id:e});this.parent.hass.callService("spotcast","start",i)}async updateState(){if(!((new Date).getTime()-this.last_state_update_time-1?s:null}};function Te(e){for(var t=[],i=1;i3?0:(e-e%10!=10?1:0)*e%10]}},Ue=Te({},He),je=function(e,t){for(void 0===t&&(t=2),e=String(e);e.length0?"-":"+")+je(100*Math.floor(Math.abs(t)/60)+Math.abs(t)%60,4)},Z:function(e){var t=e.getTimezoneOffset();return(t>0?"-":"+")+je(Math.floor(Math.abs(t)/60),2)+":"+je(Math.abs(t)%60,2)}},Re=function(e){return+e-1},Fe=[null,"[1-9]\\d?"],Ye=[null,De],qe=["isPm",De,function(e,t){var i=e.toLowerCase();return i===t.amPm[0]?0:i===t.amPm[1]?1:null}],We=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(e){var t=(e+"").match(/([+-]|\d\d)/gi);if(t){var i=60*+t[1]+parseInt(t[2],10);return"+"===t[0]?i:-i}return 0}],Ie=(Ve("monthNamesShort"),Ve("monthNames"),{default:"ddd MMM DD YYYY HH:mm:ss",shortDate:"M/D/YY",mediumDate:"MMM D, YYYY",longDate:"MMMM D, YYYY",fullDate:"dddd, MMMM D, YYYY",isoDate:"YYYY-MM-DD",isoDateTime:"YYYY-MM-DDTHH:mm:ssZ",shortTime:"HH:mm",mediumTime:"HH:mm:ss",longTime:"HH:mm:ss.SSS"});var Ge=function(e,t,i){if(void 0===t&&(t=Ie.default),void 0===i&&(i={}),"number"==typeof e&&(e=new Date(e)),"[object Date]"!==Object.prototype.toString.call(e)||isNaN(e.getTime()))throw new Error("Invalid Date pass to format");var s=[];t=(t=Ie[t]||t).replace(Ne,(function(e,t){return s.push(t),"@@@"}));var n=Te(Te({},Ue),i);return(t=t.replace(Me,(function(t){return Le[t](e,n)}))).replace(/@@@/g,(function(){return s.shift()}))};(function(){try{(new Date).toLocaleDateString("i")}catch(e){return"RangeError"===e.name}})(),function(){try{(new Date).toLocaleString("i")}catch(e){return"RangeError"===e.name}}(),function(){try{(new Date).toLocaleTimeString("i")}catch(e){return"RangeError"===e.name}}();class Be{constructor(e){this.accounts=[],this.chromecast_devices=[],this._parent=e}async connectedCallback(){this.hass=this.hass||this._parent.hass;const e=await this.hass.callWS({type:"spotcast/accounts"});this.accounts=e;const t=await this.hass.callWS({type:"spotcast/castdevices"});this.chromecast_devices=null==t?void 0:t.map(e=>e.friendly_name),this._parent.requestUpdate()}getMediaPlayerEntities(){return Object.values(this.hass.states).filter(e=>e.entity_id.match("media_player[.]")).map(e=>e.entity_id)}valueChangedFunction(e,t){if(!e.config||!e.hass||null===t.target.offsetParent)return;const{target:i}=t;if(!i.value||e["_"+i.configValue]!==i.value){if(i.configValue)if(!1===i.checked||""===i.value){const t=Object.assign({},e.config);delete t[i.configValue],e.config=t}else{let t=i.value;"height"==i.configValue?t=Number(t):"filter_devices"==i.configValue&&(t=t.split(",").map(e=>e.trim()).filter(e=>""!=e)),e.config=Object.assign(Object.assign({},e.config),{[i.configValue]:void 0!==i.checked?i.checked:t})}!function(e,t,i,s){s=s||{},i=null==i?{}:i;var n=new Event(t,{bubbles:void 0===s.bubbles||s.bubbles,cancelable:Boolean(s.cancelable),composed:void 0===s.composed||s.composed});n.detail=i,e.dispatchEvent(n)}(e,"config-changed",{config:e.config}),e.requestUpdate(i.configValue)}}getValue(e){var t,i,s,n,a,r,o,l,c,d,h,p,u,g,v,f,m,_,y,b,w,S,C,x,P,$,k,M,D;switch(e){case ae.Name:return null!==(i=null===(t=this._parent.config)||void 0===t?void 0:t.name)&&void 0!==i?i:"";case ae.Account:return null!==(n=null===(s=this._parent.config)||void 0===s?void 0:s.account)&&void 0!==n?n:"default";case ae.Spotify_Entity:const e=this.getMediaPlayerEntities().filter(e=>e.includes("spotify"));return null!==(r=null===(a=this._parent.config)||void 0===a?void 0:a.spotify_entity)&&void 0!==r?r:e.length>0?e[0]:"";case ae.Country_Code:return null!==(l=null===(o=this._parent.config)||void 0===o?void 0:o.country_code)&&void 0!==l?l:"";case ae.Limit:return null!==(d=null===(c=this._parent.config)||void 0===c?void 0:c.limit)&&void 0!==d?d:10;case ae.Playlist_Type:return null!==(p=null===(h=this._parent.config)||void 0===h?void 0:h.playlist_type)&&void 0!==p?p:"default";case ae.Always_Play_Random_Song:return null!==(g=null===(u=this._parent.config)||void 0===u?void 0:u.always_play_random_song)&&void 0!==g&&g;case ae.Height:return null!==(f=null===(v=this._parent.config)||void 0===v?void 0:v.height)&&void 0!==f?f:"";case ae.Display_Style:return null!==(_=null===(m=this._parent.config)||void 0===m?void 0:m.display_style)&&void 0!==_?_:"list";case ae.Grid_Covers_Per_Row:return null!==(b=null===(y=this._parent.config)||void 0===y?void 0:y.grid_covers_per_row)&&void 0!==b?b:5;case ae.Grid_Center_Covers:return null!==(S=null===(w=this._parent.config)||void 0===w?void 0:w.grid_center_covers)&&void 0!==S&&S;case ae.Hide_Warning:return null!==(x=null===(C=this._parent.config)||void 0===C?void 0:C.hide_warning)&&void 0!==x&&x;case ae.Default_Device:return null!==($=null===(P=this._parent.config)||void 0===P?void 0:P.default_device)&&void 0!==$?$:"";case ae.Filter_Devices:return null!==(D=null===(M=null===(k=this._parent.config)||void 0===k?void 0:k.filter_devices)||void 0===M?void 0:M.toString())&&void 0!==D?D:""}}}const Ze={general:{icon:"tune",name:fe("settings.general"),secondary:fe("settings.general_description"),show:!0},appearance:{icon:"palette",name:fe("settings.appearance"),secondary:fe("settings.appearance_description"),show:!1},advanced:{icon:"pencil",name:fe("settings.advanced"),secondary:fe("settings.advanced_description"),show:!1}};let Je=class extends ie{constructor(){super(),this.accounts=[],this.chromecast_devices=[],this.lib=new Be(this)}async connectedCallback(){super.connectedCallback(),await this.lib.connectedCallback()}setConfig(e){this.config=e}renderGeneral(){const e=this.lib.getMediaPlayerEntities();return z`
- + ${this.accounts.map(e=>z` ${e} `)}
-
- + ${e.map(e=>z` ${e} `)}
-
- - ${Ie.map(e=>z` ${e} `)} + + ${Object.values(ne).map(e=>z` ${e} `)}
-
${Fe("settings.limit")}
+
${fe("settings.limit")}
- +
@@ -273,40 +279,42 @@ found at http://polymer.github.io/PATENTS.txt
- +
- - ${Be.map(e=>z` ${e} `)} + + ${Object.values(se).map(e=>z` ${e} `)}
-
${Fe("settings.grid_covers_per_row")}
+
${fe("settings.grid_covers_per_row")}
- +
`}renderAdvanced(){return z`
@@ -339,30 +346,30 @@ found at http://polymer.github.io/PATENTS.txt
- -
${We.general.name}
+ +
${Ze.general.name}
-
${We.general.secondary}
+
${Ze.general.secondary}
- ${We.general.show?this.renderGeneral():""} + ${Ze.general.show?this.renderGeneral():""}
- -
${We.appearance.name}
+ +
${Ze.appearance.name}
-
${We.appearance.secondary}
+
${Ze.appearance.secondary}
- ${We.appearance.show?this.renderAppearance():""} + ${Ze.appearance.show?this.renderAppearance():""}
- -
${We.advanced.name}
+ +
${Ze.advanced.name}
-
${We.advanced.secondary}
+
${Ze.advanced.secondary}
- ${We.advanced.show?this.renderAdvanced():""} + ${Ze.advanced.show?this.renderAdvanced():""}
- `:z``}_toggleOption(e){this._toggleThing(e,We)}_toggleThing(e,t){const i=!t[e.target.option].show;for(const[e]of Object.entries(t))t[e].show=!1;t[e.target.option].show=i,this._toggle=!this._toggle}_valueChanged(e){if(!this._config||!this.hass||null===e.target.offsetParent)return;const{target:t}=e;if(this["_"+t.configValue]!==t.value){if(t.configValue)if(!1===t.checked||""===t.value){const e=Object.assign({},this._config);delete e[t.configValue],this._config=e}else{let e=t.value;"height"==t.configValue?e=Number(e):"filter_devices"==t.configValue&&""!=e&&(e=e.split(",").map(e=>e.trim()).filter(e=>""!=e)),this._config=Object.assign(Object.assign({},this._config),{[t.configValue]:void 0!==t.checked?t.checked:e})}Ce(this,"config-changed",{config:this._config}),this.requestUpdate(t.configValue)}}_valueChangedForList(e){if(!this._config||!this.hass)return;const{checked:t}=e.currentTarget,i=e.target.configValue,s=e.target.innerText,n=JSON.parse(JSON.stringify(this._config));n[i]||(n[i]=[]),t?n[i].includes(s)||n[i].push(s):n[i]=n[i].filter(e=>e!==s),Ce(this,"config-changed",{config:n}),this.requestUpdate(i)}static get styles(){return ee` + `:z``}_toggleOption(e){this._toggleThing(e,Ze)}_toggleThing(e,t){const i=!t[e.target.option].show;for(const[e]of Object.entries(t))t[e].show=!1;t[e.target.option].show=i,this._toggle=!this._toggle}valueChanged(e){this.lib.valueChangedFunction(this,e)}static get styles(){return ee` .option { padding: 4px 0px; cursor: pointer; @@ -422,9 +429,9 @@ found at http://polymer.github.io/PATENTS.txt paper-slider { width: auto; } - `}};e([G({type:Object})],Ze.prototype,"hass",void 0),e([J()],Ze.prototype,"_config",void 0),e([J()],Ze.prototype,"_toggle",void 0),Ze=e([B("spotify-card-editor")],Ze);class Ge{constructor(e){this.playlists=[],this.devices=[],this.chromecast_devices=[],this.state_ttl=4e3,this.last_state_update_time=0,this.loading=!1,this.parent=e}is_loading(){return setTimeout(this.set_loading_off,100),this.loading}set_loading_off(){this.loading=!1}is_loaded(){return void 0!==this.playlists.length}getPlaybackOptions(e){return{uri:e,force_playback:"playing"==this.parent.getSpotifyEntityState(),random_song:this.parent.config.always_play_random_song||!1,account:this.parent.config.account}}playUri(e){const t=this.getCurrentPlayer();if(t)this.playUriOnConnectDevice(t.id,e);else{const t=this.parent.config.default_device;if(t){const i=this.devices.filter(e=>e.name==t);if(i.length>0)return this.playUriOnConnectDevice(i[0].id,e);{const i=this.chromecast_devices.filter(e=>e.friendly_name==t);if(i.length>0)return this.playUriOnCastDevice(i[0].friendly_name,e);console.error("Could not find default_device:"+t)}}console.error("No active device nor default device in settings")}}transferPlaybackToCastDevice(e){this.parent.hass.callService("spotcast","start",{device_name:e,force_playback:!0,account:this.parent.config.account})}transferPlaybackToConnectDevice(e){this.parent.hass.callService("spotcast","start",{spotify_device_id:e,force_playback:!0,account:this.parent.config.account})}playUriOnCastDevice(e,t){const i=Object.assign(Object.assign({},this.getPlaybackOptions(t)),{device_name:e});this.parent.hass.callService("spotcast","start",i)}playUriOnConnectDevice(e,t){const i=Object.assign(Object.assign({},this.getPlaybackOptions(t)),{spotify_device_id:e});this.parent.hass.callService("spotcast","start",i)}async updateState(){if(!((new Date).getTime()-this.last_state_update_timethis.entitiesUpdated(e)))}connectedCallback(){super.connectedCallback(),this.spotcast_connector=new Ge(this),this.doSubscribeEntities()}updated(e){super.updated(e),this.doSubscribeEntities()}disconnectedCallback(){super.disconnectedCallback(),this.unsubscribe_entitites&&this.unsubscribe_entitites()}entitiesUpdated(e){let t=!1;for(const i in e)i.startsWith("media_player")&&((i.startsWith("media_player.spotify")||i==this.config.spotify_entity)&&(this.spotify_installed=!0,this.spotify_state=e[i]),t=!0);t&&!document.hidden&&(this.fetch_time_out&&clearTimeout(this.fetch_time_out),this.fetch_time_out=setTimeout(()=>{this.spotcast_connector.updateState().then(()=>{this.requestUpdate()})},500))}getSpotifyEntityState(){return this.spotify_state?this.spotify_state.state:""}setConfig(e){let t="";if(e.limit&&"number"!=typeof e.limit&&(t="limit"),e.playlist_type&&!Ie.includes(e.playlist_type)&&(t="playlist_type"),e.country_code&&"string"!=typeof e.country_code&&(t="country_code"),e.height&&"number"!=typeof e.height&&(t="height"),e.display_style&&!Be.includes(e.display_style)&&(t="display_style"),e.darkmode&&"boolean"!=typeof e.darkmode&&(t="darkmode"),e.show_error||""!=t)throw new Error(Fe("common.invalid_configuration")+": "+t);e.test_gui&&function(){var e=document.querySelector("home-assistant");if(e=(e=(e=(e=(e=(e=(e=(e=e&&e.shadowRoot)&&e.querySelector("home-assistant-main"))&&e.shadowRoot)&&e.querySelector("app-drawer-layout partial-panel-resolver"))&&e.shadowRoot||e)&&e.querySelector("ha-panel-lovelace"))&&e.shadowRoot)&&e.querySelector("hui-root")){var t=e.lovelace;return t.current_view=e.___curView,t}return null}().setEditMode(!0),this.config=Object.assign({},e)}spotifyDeviceSelected(e){if(this.spotcast_connector.getCurrentPlayer())return this.spotcast_connector.transferPlaybackToConnectDevice(e.id);const t=this.spotcast_connector.playlists[0];console.log("spotifyDeviceSelected playing first playlist"),this.spotcast_connector.playUriOnConnectDevice(e.id,t.uri)}chromecastDeviceSelected(e){if(this.spotcast_connector.getCurrentPlayer())return this.spotcast_connector.transferPlaybackToCastDevice(e.friendly_name);const t=this.spotcast_connector.playlists[0];console.log("chromecastDeviceSelected playing first playlist"),this.spotcast_connector.playUriOnCastDevice(e.friendly_name,t.uri)}onShuffleSelect(){var e,t;"playing"==(null===(e=this.spotify_state)||void 0===e?void 0:e.state)&&this.hass.callService("media_player","shuffle_set",{entity_id:this.spotify_state.entity_id,shuffle:!(null===(t=this.spotcast_connector.player)||void 0===t?void 0:t.shuffle_state)})}handlePlayPauseEvent(e,t){e.stopPropagation(),this.spotify_state&&this.hass.callService("media_player",t,{entity_id:this.spotify_state.entity_id})}onPauseSelect(e){this.handlePlayPauseEvent(e,"media_pause")}onResumeSelect(e){this.handlePlayPauseEvent(e,"media_play")}render(){var e,t,i,s;let n=z``;var o;this.spotcast_installed||this.hass.connection&&void 0!==(o=this.hass.connection,$e(o,"_srv",Ne,Te)).state.spotcast&&(this.spotcast_installed=!0),this.config.show_warning&&(n=this.showWarning(Fe("common.show_warning"))),this.spotcast_installed||(n=this.showWarning(Fe("common.show_missing_spotcast"))),this.spotify_installed||(n=this.showWarning(Fe("common.show_missing_spotify")));let r=z`
Loading...
`;!this.spotcast_connector.is_loading()&&this.spotcast_installed?this.spotcast_connector.fetchPlaylists().then(()=>{this.requestUpdate()}):r="grid"==(null===(e=this.config.display_style)||void 0===e?void 0:e.toLowerCase())?this.generateGridView():this.generateListView();const a=this.spotcast_connector.getCurrentPlayer(),c=null!==(t=null==a?void 0:a.name)&&void 0!==t?t:Fe("common.choose_player");return z` - ${this.config.hide_warning?"":n} + `}};e([Z({type:Object})],Je.prototype,"hass",void 0),e([J()],Je.prototype,"config",void 0),e([J()],Je.prototype,"_toggle",void 0),e([J()],Je.prototype,"lib",void 0),Je=e([G("spotify-card-editor")],Je);class Ke{constructor(e){this._spotify_installed=!1,this._fetch_time_out=0,this._parent=e,this.hass=e.hass}setConfig(e){return this.config=e,this.config.playlist_type&&!Object.values(ne).includes(this.config.playlist_type.toLowerCase())?"playlist_type":this.config.display_style&&!Object.values(se).includes(this.config.display_style.toLowerCase())?"display_style":""}getDisplayStyle(){var e;return"grid"==(null===(e=this.config.display_style)||void 0===e?void 0:e.toLowerCase())?se.Grid:se.List}getPlayingState(){var e,t;return null!==(t="playing"==(null===(e=this.spotify_state)||void 0===e?void 0:e.state))&&void 0!==t&&t}getShuffleState(){var e,t;return null!==(t=null===(e=this._spotcast_connector.player)||void 0===e?void 0:e.shuffle_state)&&void 0!==t&&t}getSpotifyEntityState(){return this.spotify_state?this.spotify_state.state:""}isSpotcastInstalled(){var e;return!(!(null===(e=this.hass)||void 0===e?void 0:e.connection)||void 0===this.getHassConnection().state.spotcast)}getHassConnection(){return e=this.hass.connection,_e(e,"_srv",Se,Ce);var e}isSpotifyInstalled(){return this._spotify_installed}requestUpdate(){this.isSpotcastInstalled()&&!this._spotcast_connector.is_loading()&&this._spotcast_connector.fetchPlaylists().then(()=>{this._parent.requestUpdate()})}getCurrentPlayer(){return this._spotcast_connector.getCurrentPlayer()}dataAvailable(){return this._spotcast_connector.is_loaded()}updated(e){this.hass=e,this.doSubscribeEntities()}connectedCallback(){this._spotcast_connector=new ke(this),this.doSubscribeEntities()}disconnectedCallback(){this._unsubscribe_entitites&&this._unsubscribe_entitites()}doSubscribeEntities(){var e;(null===(e=this.hass)||void 0===e?void 0:e.connection)&&!this._unsubscribe_entitites&&this._parent.isHASSConnected&&(this._unsubscribe_entitites=$e(this.hass.connection,e=>this.entitiesUpdated(e)))}entitiesUpdated(e){let t=!1;for(const i in e)i.startsWith("media_player")&&((i.startsWith("media_player.spotify")||i==this.config.spotify_entity)&&(this._spotify_installed=!0,this.spotify_state=e[i]),t=!0);t&&!document.hidden&&(this._fetch_time_out&&clearTimeout(this._fetch_time_out),this._fetch_time_out=setTimeout(()=>{this._spotcast_connector.updateState().then(()=>{this.requestUpdate()})},500))}checkIfAllowedToShow(e){var t,i;const s=null!==(i=null===(t=this.config.filter_devices)||void 0===t?void 0:t.map(e=>new RegExp(e+"$")))&&void 0!==i?i:[];for(const t of s)if(t.test("name"in e?e.name:e.friendly_name))return!1;return!0}getDefaultDevice(){let[e,t]=this.getFilteredDevices();if(e=e.filter(e=>e.name==this.config.default_device),t=t.filter(e=>e.friendly_name==this.config.default_device),e.length>0||t.length>0)return this.config.default_device}getFilteredDevices(){return[this._spotcast_connector.devices.filter(this.checkIfAllowedToShow,this),this._spotcast_connector.chromecast_devices.filter(this.checkIfAllowedToShow,this)]}getPlaylists(){return this._spotcast_connector.playlists}isThisPlaylistPlaying(e){var t;return(null===(t=this.spotify_state)||void 0===t?void 0:t.attributes.media_playlist)===e.name}playUri(e,t){const i=e.srcElement;"div"==(null==i?void 0:i.localName)?i.children[1].classList.add("loading"):"svg"==(null==i?void 0:i.localName)?i.parentElement.classList.add("loading"):"path"==(null==i?void 0:i.localName)&&i.parentElement.parentElement.classList.add("loading"),this._spotcast_connector.playUri(t)}onShuffleSelect(){var e,t;"playing"==(null===(e=this.spotify_state)||void 0===e?void 0:e.state)&&this.hass.callService("media_player","shuffle_set",{entity_id:this.spotify_state.entity_id,shuffle:!(null===(t=this._spotcast_connector.player)||void 0===t?void 0:t.shuffle_state)})}handlePlayPauseEvent(e,t){e.stopPropagation(),this.spotify_state&&this.hass.callService("media_player",t,{entity_id:this.spotify_state.entity_id})}spotifyDeviceSelected(e){if(this._spotcast_connector.getCurrentPlayer())return this._spotcast_connector.transferPlaybackToConnectDevice(e.id);const t=this._spotcast_connector.playlists[0];console.log("spotifyDeviceSelected playing first playlist"),this._spotcast_connector.playUriOnConnectDevice(e.id,t.uri)}chromecastDeviceSelected(e){if(this._spotcast_connector.getCurrentPlayer())return this._spotcast_connector.transferPlaybackToCastDevice(e.friendly_name);const t=this._spotcast_connector.playlists[0];console.log("chromecastDeviceSelected playing first playlist"),this._spotcast_connector.playUriOnCastDevice(e.friendly_name,t.uri)}}var Qe;console.info(`%c SPOTIFY-CARD \n%c ${fe("common.version")} 2.1.1 `,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray"),window.customCards=window.customCards||[],window.customCards.push({type:"spotify-card",name:"Spotify Card",description:fe("common.description"),preview:!0});let Xe=Qe=class extends ie{constructor(){super(),this.lib=new Ke(this)}static async getConfigElement(){return document.createElement("spotify-card-editor")}static getStubConfig(){return{}}setConfig(e){const t=this.lib.setConfig(e);if(e.show_error||""!=t)throw new Error(fe("common.invalid_configuration")+": "+t)}connectedCallback(){super.connectedCallback(),this.lib.connectedCallback()}updated(e){super.updated(e),this.lib.updated(this.hass)}disconnectedCallback(){super.disconnectedCallback(),this.lib.disconnectedCallback()}isHASSConnected(){return this.isConnected}render(){var e,t,i;let s=z``;this.lib.isSpotcastInstalled()||(s=this.showWarning(fe("common.show_missing_spotcast"))),this.lib.isSpotifyInstalled()||(s=this.showWarning(fe("common.show_missing_spotify")));let n=z`
Loading...
`;if(this.lib.dataAvailable())switch(this.lib.getDisplayStyle()){case se.Grid:n=this.generateGridView();break;default:n=this.generateListView()}else this.lib.requestUpdate();return z` + ${this.lib.config.hide_warning?"":s}
- ${r} + ${n}
@@ -465,9 +472,9 @@ found at http://polymer.github.io/PATENTS.txt
- `}checkIfAllowedToShow(e){var t,i;const s=null!==(i=null===(t=this.config.filter_devices)||void 0===t?void 0:t.map(e=>new RegExp(e+"$")))&&void 0!==i?i:[];for(const t of s)if(t.test(e.name?e.name:e.friendly_name))return!1;return!0}generateDeviceList(){const e=this.spotcast_connector.devices.filter(this.checkIfAllowedToShow,this),t=this.spotcast_connector.chromecast_devices.filter(this.checkIfAllowedToShow,this);return 0==e.length&&0==t.length?z`

No devices found

`:z` + `}generateDeviceList(){const[e,t]=this.lib.getFilteredDevices();return 0==e.length&&0==t.length?z`

No devices found

`:z` ${e.length>0?z`

Spotify Connect devices

`:null} - ${e.map(e=>z`this.spotifyDeviceSelected(e)}>${e.name}`)} + ${e.map(e=>z`this.lib.spotifyDeviceSelected(e)}>${e.name}`)} ${t.length>0?z`

Chromecast devices

`:null} - ${t.map(e=>z`this.chromecastDeviceSelected(e)}>${e.friendly_name}`)} - `}generateButtonForCurrent(){var e;return"playing"==(null===(e=this.spotify_state)||void 0===e?void 0:e.state)?z`
+ ${t.map(e=>z`this.lib.chromecastDeviceSelected(e)}>${e.friendly_name}`)} + `}generateButtonForCurrent(){var e;return"playing"==(null===(e=this.lib.spotify_state)||void 0===e?void 0:e.state)?z`
@@ -493,29 +500,29 @@ found at http://polymer.github.io/PATENTS.txt -
`}generateListView(){var e;if(this.spotcast_connector.is_loaded()){const t=[];for(let i=0;ithis.spotcast_connector.playUri(s.uri)}> - ${s.images.length>0?z``:z` - - `} - ${n?this.generateButtonForCurrent():z`
- - - - -
`} -

${s.name}

-
`)}return z`
${t}
`}return z``}generateGridIconForCurrent(){var e;return"playing"==(null===(e=this.spotify_state)||void 0===e?void 0:e.state)?z` + `}generateListView(){const e=[],t=this.lib.getPlaylists();for(let i=0;ithis.lib.playUri(e,s.uri)}> + ${s.images.length>0?z``:z` + + `} + ${this.lib.isThisPlaylistPlaying(s)?this.generateButtonForCurrent():z`
+ + + + +
`} +

${s.name}

+ `)}return z`
${e}
`}generateGridIconForCurrent(){var e;return"playing"==(null===(e=this.lib.spotify_state)||void 0===e?void 0:e.state)?z` `:z` - `}generateGridView(){var e,t;if(!this.spotcast_connector.is_loaded())return z``;const i=[];for(let s=0;sthis.spotcast_connector.playUri(n.uri)}> + `}generateGridView(){var e;const t=[],i=this.lib.getPlaylists();for(let s=0;sthis.lib.playUri(e,n.uri)}> ${n.images.length>0?z``:z`
+ />`:z`
`}
- ${o?this.generateGridIconForCurrent():z` - this.spotcast_connector.playUri(n.uri)}> + ${this.lib.isThisPlaylistPlaying(n)?this.generateGridIconForCurrent():z` + this.lib.playUri(e,n.uri)}> `}
-
`)}const s=this.config.grid_covers_per_row?this.config.grid_covers_per_row:3;return z`
- ${i} -
`}showWarning(e){return z`${e}`}static get styles(){return[Je.generalStyles,Je.listStyles,Je.gridStyles]}};Ke.generalStyles=ee` + `)}const s=this.lib.config.grid_covers_per_row?this.lib.config.grid_covers_per_row:3;return z`
+ ${t} +
`}onPauseSelect(e){this.lib.handlePlayPauseEvent(e,"media_pause")}onResumeSelect(e){this.lib.handlePlayPauseEvent(e,"media_play")}showWarning(e){return z`${e}`}static get styles(){return[Qe.generalStyles,Qe.listStyles,Qe.gridStyles]}};Xe.generalStyles=ee` *:focus { outline: none; } @@ -544,6 +551,13 @@ found at http://polymer.github.io/PATENTS.txt padding-right: 0.5em; } + hui-warning { + position: absolute; + right: 0; + left: 0; + text-align: center; + } + #header { display: flex; height: var(--header-height); @@ -669,12 +683,31 @@ found at http://polymer.github.io/PATENTS.txt .icon.playing > svg { fill: var(--primary-color) !important; } - `,Ke.listStyles=ee` + `,Xe.listStyles=ee` ha-card { --list-item-height: 3em; --placeholder-padding: 4px; } + @keyframes loading { + 0% { + opacity: 100%; + } + 50% { + opacity: 0%; + } + 100% { + opacity: 100%; + } + } + + .loading { + animation-name: loading; + animation-duration: 1s; + animation-iteration-count: 5; + animation-timing-function: ease-in; + } + .list-item { /* height: var(--list-item-height); */ align-items: center; @@ -703,6 +736,7 @@ found at http://polymer.github.io/PATENTS.txt } .list-item > .icon { + opacity: 100%; height: var(--list-item-height); width: var(--list-item-height); min-height: var(--list-item-height); @@ -715,7 +749,7 @@ found at http://polymer.github.io/PATENTS.txt .list-item > p { margin: 0 0.5em 0 0.5em; } - `,Ke.gridStyles=ee` + `,Xe.gridStyles=ee` .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(30%, 1fr)); @@ -758,5 +792,5 @@ found at http://polymer.github.io/PATENTS.txt .grid-item-overlay-icon > svg { fill: white; } - `,e([G()],Ke.prototype,"hass",void 0),e([G({type:Object})],Ke.prototype,"config",void 0),e([J()],Ke.prototype,"spotcast_connector",void 0),Ke=Je=e([B("spotify-card")],Ke);export{Ke as SpotifyCard}; + `,e([Z({type:Object})],Xe.prototype,"hass",void 0),e([Z({type:Object})],Xe.prototype,"config",void 0),e([J()],Xe.prototype,"lib",void 0),Xe=Qe=e([G("spotify-card")],Xe);export{Xe as SpotifyCard}; //# sourceMappingURL=spotify-card.js.map diff --git a/dist/spotify-card.js.map b/dist/spotify-card.js.map index f0b49de..0500d36 100644 --- a/dist/spotify-card.js.map +++ b/dist/spotify-card.js.map @@ -1 +1 @@ -{"version":3,"file":"spotify-card.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/lit-html/lib/dom.js","../node_modules/lit-html/lib/template.js","../node_modules/lit-html/lib/modify-template.js","../node_modules/lit-html/lib/directive.js","../node_modules/lit-html/lib/part.js","../node_modules/lit-html/lib/template-instance.js","../node_modules/lit-html/lib/template-result.js","../node_modules/lit-html/lib/parts.js","../node_modules/lit-html/lib/template-factory.js","../node_modules/lit-html/lib/render.js","../node_modules/lit-html/lib/default-template-processor.js","../node_modules/lit-html/lit-html.js","../node_modules/lit-html/lib/shady-render.js","../node_modules/lit-element/lib/updating-element.js","../node_modules/lit-element/lib/decorators.js","../node_modules/lit-element/lib/css-tag.js","../node_modules/lit-element/lit-element.js","../node_modules/fecha/lib/fecha.js","../node_modules/custom-card-helpers/dist/index.m.js","../node_modules/home-assistant-js-websocket/dist/store.js","../node_modules/home-assistant-js-websocket/dist/collection.js","../node_modules/home-assistant-js-websocket/dist/commands.js","../node_modules/home-assistant-js-websocket/dist/messages.js","../node_modules/home-assistant-js-websocket/dist/services.js","../node_modules/home-assistant-js-websocket/dist/entities.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n window.customElements.polyfillWrapFlushCallback !==\n undefined;\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes = (container, start, end = null, before = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.insertBefore(start, before);\n start = n;\n }\n};\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes = (container, start, end = null) => {\n while (start !== end) {\n const n = start.nextSibling;\n container.removeChild(start);\n start = n;\n }\n};\n//# sourceMappingURL=dom.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = ``;\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n constructor(result, element) {\n this.parts = [];\n this.element = element;\n const nodesToRemove = [];\n const stack = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(element.content, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const { strings, values: { length } } = result;\n while (partIndex < length) {\n const node = walker.nextNode();\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n continue;\n }\n index++;\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if (node.hasAttributes()) {\n const attributes = node.attributes;\n const { length } = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)[2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName = name.toLowerCase() + boundAttributeSuffix;\n const attributeValue = node.getAttribute(attributeLookupName);\n node.removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({ type: 'attribute', index, name, strings: statics });\n partIndex += statics.length - 1;\n }\n }\n if (node.tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n }\n else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = node.data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n }\n else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({ type: 'node', index: ++index });\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n }\n else {\n node.data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n }\n else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if (node.data === marker) {\n const parent = node.parentNode;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({ type: 'node', index });\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n node.data = '';\n }\n else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({ type: 'node', index: -1 });\n partIndex++;\n }\n }\n }\n }\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode.removeChild(n);\n }\n }\n}\nconst endsWith = (str, suffix) => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\nexport const isTemplatePartActive = (part) => part.index !== -1;\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex = \n// eslint-disable-next-line no-control-regex\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n//# sourceMappingURL=template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module shady-render\n */\nimport { isTemplatePartActive } from './template.js';\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(template, nodesToRemove) {\n const { element: { content }, parts } = template;\n const walker = document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode.removeChild(n));\n}\nconst countNodes = (node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\nconst nextActiveIndexInTemplateParts = (parts, startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n};\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(template, node, refNode = null) {\n const { element: { content }, parts } = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker = document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n//# sourceMappingURL=modify-template.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\nconst directives = new WeakMap();\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`
    <${repeat(items, (item) => html`
  • ${item}
  • `)}
`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = (f) => ((...args) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n});\nexport const isDirective = (o) => {\n return typeof o === 'function' && directives.has(o);\n};\n//# sourceMappingURL=directive.js.map","/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n//# sourceMappingURL=part.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { isCEPolyfill } from './dom.js';\nimport { isTemplatePartActive } from './template.js';\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n constructor(template, processor, options) {\n this.__parts = [];\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n update(values) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n _clone() {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) :\n document.importNode(this.template.element.content, true);\n const stack = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(fragment, 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */, null, false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node.nodeName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = node.content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop();\n node = walker.nextNode();\n }\n }\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node.previousSibling);\n this.__parts.push(part);\n }\n else {\n this.__parts.push(...this.processor.handleAttributeExpressions(node, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n//# sourceMappingURL=template-instance.js.map","/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n/**\n * @module lit-html\n */\nimport { reparentNodes } from './dom.js';\nimport { boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker } from './template.js';\nconst commentMarker = ` ${marker} `;\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n constructor(strings, values, type, processor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n /**\n * Returns a string of HTML used to create a `