353 lines
76 KiB
JavaScript
353 lines
76 KiB
JavaScript
/*! *****************************************************************************
|
||
Copyright (c) Microsoft Corporation.
|
||
|
||
Permission to use, copy, modify, and/or distribute this software for any
|
||
purpose with or without fee is hereby granted.
|
||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||
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 t(t,e,i,n){var o,s=arguments.length,r=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s<3?o(r):s>3?o(e,i,r):o(e,i))||r);return s>3&&r&&Object.defineProperty(e,i,r),r
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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 e="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,i=(t,e,i=null)=>{for(;e!==i;){const i=e.nextSibling;t.removeChild(e),e=i}},n=`{{lit-${String(Math.random()).slice(2)}}}`,o=`\x3c!--${n}--\x3e`,s=new RegExp(`${n}|${o}`);class r{constructor(t,e){this.parts=[],this.element=e;const i=[],o=[],r=document.createTreeWalker(e.content,133,null,!1);let d=0,u=-1,h=0;const{strings:p,values:{length:g}}=t;for(;h<g;){const t=r.nextNode();if(null!==t){if(u++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:i}=e;let n=0;for(let t=0;t<i;t++)a(e[t].name,"$lit$")&&n++;for(;n-- >0;){const e=p[h],i=c.exec(e)[2],n=i.toLowerCase()+"$lit$",o=t.getAttribute(n);t.removeAttribute(n);const r=o.split(s);this.parts.push({type:"attribute",index:u,name:i,strings:r}),h+=r.length-1}}"TEMPLATE"===t.tagName&&(o.push(t),r.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(n)>=0){const n=t.parentNode,o=e.split(s),r=o.length-1;for(let e=0;e<r;e++){let i,s=o[e];if(""===s)i=l();else{const t=c.exec(s);null!==t&&a(t[2],"$lit$")&&(s=s.slice(0,t.index)+t[1]+t[2].slice(0,-"$lit$".length)+t[3]),i=document.createTextNode(s)}n.insertBefore(i,t),this.parts.push({type:"node",index:++u})}""===o[r]?(n.insertBefore(l(),t),i.push(t)):t.data=o[r],h+=r}}else if(8===t.nodeType)if(t.data===n){const e=t.parentNode;null!==t.previousSibling&&u!==d||(u++,e.insertBefore(l(),t)),d=u,this.parts.push({type:"node",index:u}),null===t.nextSibling?t.data="":(i.push(t),u--),h++}else{let e=-1;for(;-1!==(e=t.data.indexOf(n,e+1));)this.parts.push({type:"node",index:-1}),h++}}else r.currentNode=o.pop()}for(const t of i)t.parentNode.removeChild(t)}}const a=(t,e)=>{const i=t.length-e.length;return i>=0&&t.slice(i)===e},d=t=>-1!==t.index,l=()=>document.createComment(""),c=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function u(t,e){const{element:{content:i},parts:n}=t,o=document.createTreeWalker(i,133,null,!1);let s=p(n),r=n[s],a=-1,d=0;const l=[];let c=null;for(;o.nextNode();){a++;const t=o.currentNode;for(t.previousSibling===c&&(c=null),e.has(t)&&(l.push(t),null===c&&(c=t)),null!==c&&d++;void 0!==r&&r.index===a;)r.index=null!==c?-1:r.index-d,s=p(n,s),r=n[s]}l.forEach((t=>t.parentNode.removeChild(t)))}const h=t=>{let e=11===t.nodeType?0:1;const i=document.createTreeWalker(t,133,null,!1);for(;i.nextNode();)e++;return e},p=(t,e=-1)=>{for(let i=e+1;i<t.length;i++){const e=t[i];if(d(e))return i}return-1};
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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 g=new WeakMap,f=t=>"function"==typeof t&&g.has(t),v={},m={};
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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
|
||
*/
|
||
class _{constructor(t,e,i){this.__parts=[],this.template=t,this.processor=e,this.options=i}update(t){let e=0;for(const i of this.__parts)void 0!==i&&i.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=e?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),i=[],n=this.template.parts,o=document.createTreeWalker(t,133,null,!1);let s,r=0,a=0,l=o.nextNode();for(;r<n.length;)if(s=n[r],d(s)){for(;a<s.index;)a++,"TEMPLATE"===l.nodeName&&(i.push(l),o.currentNode=l.content),null===(l=o.nextNode())&&(o.currentNode=i.pop(),l=o.nextNode());if("node"===s.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(l.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,s.name,s.strings,this.options));r++}else this.__parts.push(void 0),r++;return e&&(document.adoptNode(t),customElements.upgrade(t)),t}}
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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 y=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),S=` ${n} `;class b{constructor(t,e,i,n){this.strings=t,this.values=e,this.type=i,this.processor=n}getHTML(){const t=this.strings.length-1;let e="",i=!1;for(let s=0;s<t;s++){const t=this.strings[s],r=t.lastIndexOf("\x3c!--");i=(r>-1||i)&&-1===t.indexOf("--\x3e",r+1);const a=c.exec(t);e+=null===a?t+(i?S:o):t.substr(0,a.index)+a[1]+a[2]+"$lit$"+a[3]+n}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==y&&(e=y.createHTML(e)),t.innerHTML=e,t}}class w extends b{getHTML(){return`<svg>${super.getHTML()}</svg>`}getTemplateElement(){const t=super.getTemplateElement(),e=t.content,i=e.firstChild;return e.removeChild(i),((t,e,i=null,n=null)=>{for(;e!==i;){const i=e.nextSibling;t.insertBefore(e,n),e=i}})(e,i.firstChild),t}}
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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 N=t=>null===t||!("object"==typeof t||"function"==typeof t),E=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class O{constructor(t,e,i){this.dirty=!0,this.element=t,this.name=e,this.strings=i,this.parts=[];for(let t=0;t<i.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new k(this)}_getValue(){const t=this.strings,e=t.length-1,i=this.parts;if(1===e&&""===t[0]&&""===t[1]){const t=i[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!E(t))return t}let n="";for(let o=0;o<e;o++){n+=t[o];const e=i[o];if(void 0!==e){const t=e.value;if(N(t)||!E(t))n+="string"==typeof t?t:String(t);else for(const e of t)n+="string"==typeof e?e:String(e)}}return n+=t[e],n}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class k{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===v||N(t)&&t===this.value||(this.value=t,f(t)||(this.committer.dirty=!0))}commit(){for(;f(this.value);){const t=this.value;this.value=v,t(this)}this.value!==v&&this.committer.commit()}}class W{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(l()),this.endNode=t.appendChild(l())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=l()),t.__insert(this.endNode=l())}insertAfterPart(t){t.__insert(this.startNode=l()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;f(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=v,t(this)}const t=this.__pendingValue;t!==v&&(N(t)?t!==this.value&&this.__commitText(t):t instanceof b?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):E(t)?this.__commitIterable(t):t===m?(this.value=m,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,i="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=i:this.__commitNode(document.createTextNode(i)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof _&&this.value.template===e)this.value.update(t.values);else{const i=new _(e,t.processor,this.options),n=i._clone();i.update(t.values),this.__commitNode(n),this.value=i}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let i,n=0;for(const o of t)i=e[n],void 0===i&&(i=new W(this.options),e.push(i),0===n?i.appendIntoPart(this):i.insertAfterPart(e[n-1])),i.setValue(o),i.commit(),n++;n<e.length&&(e.length=n,this.clear(i&&i.endNode))}clear(t=this.startNode){i(this.startNode.parentNode,t.nextSibling,this.endNode)}}class x{constructor(t,e,i){if(this.value=void 0,this.__pendingValue=void 0,2!==i.length||""!==i[0]||""!==i[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=i}setValue(t){this.__pendingValue=t}commit(){for(;f(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=v,t(this)}if(this.__pendingValue===v)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=v}}class C extends O{constructor(t,e,i){super(t,e,i),this.single=2===i.length&&""===i[0]&&""===i[1]}_createPart(){return new P(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class P extends k{}let V=!1;(()=>{try{const t={get capture(){return V=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class j{constructor(t,e,i){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=i,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;f(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=v,t(this)}if(this.__pendingValue===v)return;const t=this.__pendingValue,e=this.value,i=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),n=null!=t&&(null==e||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),n&&(this.__options=z(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=v}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const z=t=>t&&(V?{capture:t.capture,passive:t.passive,once:t.once}:t.capture)
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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 M(t){let e=$.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},$.set(t.type,e));let i=e.stringsArray.get(t.strings);if(void 0!==i)return i;const o=t.strings.join(n);return i=e.keyString.get(o),void 0===i&&(i=new r(t,t.getTemplateElement()),e.keyString.set(o,i)),e.stringsArray.set(t.strings,i),i}const $=new Map,D=new WeakMap;
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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=new
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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
|
||
*/
|
||
class{handleAttributeExpressions(t,e,i,n){const o=e[0];if("."===o){return new C(t,e.slice(1),i).parts}if("@"===o)return[new j(t,e.slice(1),n.eventContext)];if("?"===o)return[new x(t,e.slice(1),i)];return new O(t,e,i).parts}handleTextExpression(t){return new W(t)}};
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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.3.0");const A=(t,...e)=>new b(t,e,"html",T),I=(t,...e)=>new w(t,e,"svg",T)
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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
|
||
*/,R=(t,e)=>`${t}--${e}`;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 Z=t=>e=>{const i=R(e.type,t);let o=$.get(i);void 0===o&&(o={stringsArray:new WeakMap,keyString:new Map},$.set(i,o));let s=o.stringsArray.get(e.strings);if(void 0!==s)return s;const a=e.strings.join(n);if(s=o.keyString.get(a),void 0===s){const i=e.getTemplateElement();U&&window.ShadyCSS.prepareTemplateDom(i,t),s=new r(e,i),o.keyString.set(a,s)}return o.stringsArray.set(e.strings,s),s},H=["html","svg"],Y=new Set,q=(t,e,i)=>{Y.add(t);const n=i?i.element:document.createElement("template"),o=e.querySelectorAll("style"),{length:s}=o;if(0===s)return void window.ShadyCSS.prepareTemplateStyles(n,t);const r=document.createElement("style");for(let t=0;t<s;t++){const e=o[t];e.parentNode.removeChild(e),r.textContent+=e.textContent}(t=>{H.forEach((e=>{const i=$.get(R(e,t));void 0!==i&&i.keyString.forEach((t=>{const{element:{content:e}}=t,i=new Set;Array.from(e.querySelectorAll("style")).forEach((t=>{i.add(t)})),u(t,i)}))}))})(t);const a=n.content;i?function(t,e,i=null){const{element:{content:n},parts:o}=t;if(null==i)return void n.appendChild(e);const s=document.createTreeWalker(n,133,null,!1);let r=p(o),a=0,d=-1;for(;s.nextNode();)for(d++,s.currentNode===i&&(a=h(e),i.parentNode.insertBefore(e,i));-1!==r&&o[r].index===d;){if(a>0){for(;-1!==r;)o[r].index+=a,r=p(o,r);return}r=p(o,r)}}(i,r,a.firstChild):a.insertBefore(r,a.firstChild),window.ShadyCSS.prepareTemplateStyles(n,t);const d=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==d)e.insertBefore(d.cloneNode(!0),e.firstChild);else if(i){a.insertBefore(r,a.firstChild);const t=new Set;t.add(r),u(i,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const L={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},F=(t,e)=>e!==t&&(e==e||t==t),J={attribute:!0,type:String,converter:L,reflect:!1,hasChanged:F};class K extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach(((e,i)=>{const n=this._attributeNameForProperty(i,e);void 0!==n&&(this._attributeToPropertyMap.set(n,i),t.push(n))})),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach(((t,e)=>this._classProperties.set(e,t)))}}static createProperty(t,e=J){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const i="symbol"==typeof t?Symbol():`__${t}`,n=this.getPropertyDescriptor(t,i,e);void 0!==n&&Object.defineProperty(this.prototype,t,n)}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(n){const o=this[t];this[e]=n,this.requestUpdateInternal(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||J}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty("finalized")||t.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const i of e)this.createProperty(i,t[i])}}static _attributeNameForProperty(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,i=F){return i(t,e)}static _propertyValueFromAttribute(t,e){const i=e.type,n=e.converter||L,o="function"==typeof n?n:n.fromAttribute;return o?o(t,i):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const i=e.type,n=e.converter;return(n&&n.toAttribute||L.toAttribute)(t,i)}initialize(){this._updateState=0,this._updatePromise=new Promise((t=>this._enableUpdatingResolver=t)),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach(((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}}))}_applyInstanceProperties(){this._instanceProperties.forEach(((t,e)=>this[e]=t)),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,i){e!==i&&this._attributeToProperty(t,i)}_propertyToAttribute(t,e,i=J){const n=this.constructor,o=n._attributeNameForProperty(t,i);if(void 0!==o){const t=n._propertyValueToAttribute(e,i);if(void 0===t)return;this._updateState=8|this._updateState,null==t?this.removeAttribute(o):this.setAttribute(o,t),this._updateState=-9&this._updateState}}_attributeToProperty(t,e){if(8&this._updateState)return;const i=this.constructor,n=i._attributeToPropertyMap.get(t);if(void 0!==n){const t=i.getPropertyOptions(n);this._updateState=16|this._updateState,this[n]=i._propertyValueFromAttribute(e,t),this._updateState=-17&this._updateState}}requestUpdateInternal(t,e,i){let n=!0;if(void 0!==t){const o=this.constructor;i=i||o.getPropertyOptions(t),o._valueHasChanged(this[t],e,i.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==i.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,i))):n=!1}!this._hasRequestedUpdate&&n&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(t,e){return this.requestUpdateInternal(t,e),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(t){}const t=this.performUpdate();return null!=t&&await t,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{t=this.shouldUpdate(e),t?this.update(e):this._markUpdated()}catch(e){throw t=!1,this._markUpdated(),e}t&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach(((t,e)=>this._propertyToAttribute(e,this[e],t))),this._reflectingProperties=void 0),this._markUpdated()}updated(t){}firstUpdated(t){}}K.finalized=!0;
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:n}=e;return{kind:i,elements:n,finisher(e){window.customElements.define(t,e)}}})(t,e),X=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?Object.assign(Object.assign({},e),{finisher(i){i.createProperty(e.key,t)}}):{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};function G(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):X(t,e)}function Q(t){return G({attribute:!1,hasChanged:null==t?void 0:t.hasChanged})}
|
||
/**
|
||
@license
|
||
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
|
||
This code may only be used under the BSD style license found at
|
||
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
||
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
||
found at http://polymer.github.io/CONTRIBUTORS.txt 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 tt=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,et=Symbol();class it{constructor(t,e){if(e!==et)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(tt?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const nt=(t,...e)=>{const i=e.reduce(((e,i,n)=>e+(t=>{if(t instanceof it)return t.cssText;if("number"==typeof t)return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(i)+t[n+1]),t[0]);return new it(i,et)};
|
||
/**
|
||
* @license
|
||
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
||
* This code may only be used under the BSD style license found at
|
||
* http://polymer.github.io/LICENSE.txt
|
||
* The complete set of authors may be found at
|
||
* http://polymer.github.io/AUTHORS.txt
|
||
* The complete set of contributors may be found at
|
||
* http://polymer.github.io/CONTRIBUTORS.txt
|
||
* 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
|
||
*/
|
||
(window.litElementVersions||(window.litElementVersions=[])).push("2.4.0");const ot={};class st extends K{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,i)=>t.reduceRight(((t,i)=>Array.isArray(i)?e(i,t):(t.add(i),t)),i),i=e(t,new Set),n=[];i.forEach((t=>n.unshift(t))),this._styles=n}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map((t=>{if(t instanceof CSSStyleSheet&&!tt){const e=Array.prototype.slice.call(t.cssRules).reduce(((t,e)=>t+e.cssText),"");return new it(String(e),et)}return t}))}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 t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?tt?this.renderRoot.adoptedStyleSheets=t.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map((t=>t.cssText)),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==ot&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach((t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)})))}render(){return ot}}st.finalized=!0,st.render=(t,e,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const o=n.scopeName,s=D.has(e),r=U&&11===e.nodeType&&!!e.host,a=r&&!Y.has(o),d=a?document.createDocumentFragment():e;if(((t,e,n)=>{let o=D.get(e);void 0===o&&(i(e,e.firstChild),D.set(e,o=new W(Object.assign({templateFactory:M},n))),o.appendInto(e)),o.setValue(t),o.commit()})(t,d,Object.assign({templateFactory:Z(o)},n)),a){const t=D.get(d);D.delete(d);const n=t.value instanceof _?t.value.template:void 0;q(o,d,n),i(e,e.firstChild),e.appendChild(d),D.set(e,t)}!s&&r&&window.ShadyCSS.styleElement(e.host)};var rt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,at="[^\\s]+",dt=/\[([^]*?)\]/gm;function lt(t,e){for(var i=[],n=0,o=t.length;n<o;n++)i.push(t[n].substr(0,e));return i}var ct=function(t){return function(e,i){var n=i[t].map((function(t){return t.toLowerCase()})).indexOf(e.toLowerCase());return n>-1?n:null}};function ut(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];for(var n=0,o=e;n<o.length;n++){var s=o[n];for(var r in s)t[r]=s[r]}return t}var ht=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],pt=["January","February","March","April","May","June","July","August","September","October","November","December"],gt=lt(pt,3),ft={dayNamesShort:lt(ht,3),dayNames:ht,monthNamesShort:gt,monthNames:pt,amPm:["am","pm"],DoFn:function(t){return t+["th","st","nd","rd"][t%10>3?0:(t-t%10!=10?1:0)*t%10]}},vt=ut({},ft),mt=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length<e;)t="0"+t;return t},_t={D:function(t){return String(t.getDate())},DD:function(t){return mt(t.getDate())},Do:function(t,e){return e.DoFn(t.getDate())},d:function(t){return String(t.getDay())},dd:function(t){return mt(t.getDay())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return String(t.getMonth()+1)},MM:function(t){return mt(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},YY:function(t){return mt(String(t.getFullYear()),4).substr(2)},YYYY:function(t){return mt(t.getFullYear(),4)},h:function(t){return String(t.getHours()%12||12)},hh:function(t){return mt(t.getHours()%12||12)},H:function(t){return String(t.getHours())},HH:function(t){return mt(t.getHours())},m:function(t){return String(t.getMinutes())},mm:function(t){return mt(t.getMinutes())},s:function(t){return String(t.getSeconds())},ss:function(t){return mt(t.getSeconds())},S:function(t){return String(Math.round(t.getMilliseconds()/100))},SS:function(t){return mt(Math.round(t.getMilliseconds()/10),2)},SSS:function(t){return mt(t.getMilliseconds(),3)},a:function(t,e){return t.getHours()<12?e.amPm[0]:e.amPm[1]},A:function(t,e){return t.getHours()<12?e.amPm[0].toUpperCase():e.amPm[1].toUpperCase()},ZZ:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+mt(100*Math.floor(Math.abs(e)/60)+Math.abs(e)%60,4)},Z:function(t){var e=t.getTimezoneOffset();return(e>0?"-":"+")+mt(Math.floor(Math.abs(e)/60),2)+":"+mt(Math.abs(e)%60,2)}},yt=function(t){return+t-1},St=[null,"[1-9]\\d?"],bt=[null,at],wt=["isPm",at,function(t,e){var i=t.toLowerCase();return i===e.amPm[0]?0:i===e.amPm[1]?1:null}],Nt=["timezoneOffset","[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?",function(t){var e=(t+"").match(/([+-]|\d\d)/gi);if(e){var i=60*+e[1]+parseInt(e[2],10);return"+"===e[0]?i:-i}return 0}],Et=(ct("monthNamesShort"),ct("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 Ot=function(t,e,i){if(void 0===e&&(e=Et.default),void 0===i&&(i={}),"number"==typeof t&&(t=new Date(t)),"[object Date]"!==Object.prototype.toString.call(t)||isNaN(t.getTime()))throw new Error("Invalid Date pass to format");var n=[];e=(e=Et[e]||e).replace(dt,(function(t,e){return n.push(e),"@@@"}));var o=ut(ut({},vt),i);return(e=e.replace(rt,(function(e){return _t[e](t,o)}))).replace(/@@@/g,(function(){return n.shift()}))},kt=(function(){try{(new Date).toLocaleDateString("i")}catch(t){return"RangeError"===t.name}}(),function(){try{(new Date).toLocaleString("i")}catch(t){return"RangeError"===t.name}}(),function(){try{(new Date).toLocaleTimeString("i")}catch(t){return"RangeError"===t.name}}(),function(t,e,i,n){n=n||{},i=null==i?{}:i;var o=new Event(e,{bubbles:void 0===n.bubbles||n.bubbles,cancelable:Boolean(n.cancelable),composed:void 0===n.composed||n.composed});return o.detail=i,t.dispatchEvent(o),o}),Wt={version:"Verze",description:"Zobrazit kompas s indikátorem ve směru hodnoty entity",invalid_configuration:"Neplatná konfigurace",no_entity:"Entita není nakonfigurována",offset_not_a_number:"Kompenzace směru není číslo",invalid:"Neplatné",on:"Zapnuto",off:"Vypnuto"},xt={name:"Název",optional:"Volitelný",entity:"Entita",required:"Požadované",primary:"Směr",secondary:"Sekundární",indicator:"Indikátor",direction:"Směr",offset:"Kompenzace",show:"Ukázat",abbreviations:"Zkratky",toggle:"Přepnout",language:"Jazyk","primary entity description":"Entita směru ","secondary entity description":"Sekundární entita","language description":"Jazyk zkratky směru","offset description":"Kompenzace směru"},Ct={north:"Sever",east:"Východ",south:"Jih",west:"Západ",N:"S",NNE:"SSV",NE:"SV",ENE:"VSV",E:"V",ESE:"VJV",SE:"JV",SSE:"JJV",S:"J",SSW:"JJZ",SW:"JZ",WSW:"ZJZ",W:"Z",WNW:"ZSZ",NW:"SZ",NNW:"SSZ"},Pt={common:Wt,editor:xt,directions:Ct},Vt={version:"Version",description:"Zeigt einen Kompass mit einem Indikator in Richtung des Entitätswertes an",invalid_configuration:"Ungültige Konfiguration",no_entity:"Entität nicht konfiguriert",offset_not_a_number:"Richtungs-Offset ist keine Zahl",invalid:"ungültig",on:"An",off:"Aus"},jt={name:"Name",optional:"Optional",entity:"Entität",required:"Benötigt",primary:"Richtung",secondary:"Sekundär",indicator:"Indikator",direction:"Richtung",offset:"Offset",show:"Zeige",abbreviations:"Abkürzungen",toggle:"Umschalten",language:"Sprache","primary entity description":"Richtungsentität","secondary entity description":"Sekundäre Entität","language description":"Sprache der Himmelsrichtungen","offset description":"Richtungsversatz"},zt={north:"Norden",east:"Osten",south:"Süden",west:"Westen",N:"N",NNE:"NNO",NE:"NO",ENE:"ONO",E:"O",ESE:"OSO",SE:"SO",SSE:"SSO",S:"S",SSW:"SSW",SW:"SW",WSW:"WSW",W:"W",WNW:"WNW",NW:"NW",NNW:"NNW"},Mt={common:Vt,editor:jt,directions:zt},$t={version:"Version",description:"Show a compass with an indicator in the direction of the entity's value",invalid_configuration:"Invalid configuration",missing_direction_entity:"Missing direction entity",no_entity:"Entity not configured",offset_not_a_number:"Direction offset is not a number",invalid:"invalid",on:"On",off:"Off"},Dt={name:"Name",optional:"Optional",entity:"Entity",required:"Required",primary:"Direction",secondary:"Secondary",indicator:"Indicator",direction:"Direction",offset:"Offset",show:"Show",abbreviations:"Abbreviations",toggle:"Toggle",language:"Language","primary entity description":"Direction entity","secondary entity description":"Secondary entity","language description":"Direction abbreviation language","offset description":"Direction offset"},Tt={north:"North",east:"East",south:"South",west:"West",N:"N",NNE:"NNE",NE:"NE",ENE:"ENE",E:"E",ESE:"ESE",SE:"SE",SSE:"SSE",S:"S",SSW:"SSW",SW:"SW",WSW:"WSW",W:"W",WNW:"WNW",NW:"NW",NNW:"NNW"},At={common:$t,editor:Dt,directions:Tt},It={version:"Versión",description:"Mostrar una brújula con un indicador en la dirección del valor de la entidad",invalid_configuration:"Configuración inválida",no_entity:"Entidad no configurada",offset_not_a_number:"El desplazamiento de dirección no es un número",invalid:"inválido",on:"Encendido",off:"Apagado"},Rt={name:"Nombre",optional:"Opcional",entity:"Entidad",required:"Requerido",primary:"Primario",secondary:"Secundario",indicator:"Indicador",direction:"Dirección",offset:"Desplazamiento",show:"Mostrar",abbreviations:"Abreviaturas",toggle:"Conmutar",language:"Idioma","primary entity description":"Entidad primaria","secondary entity description":"Entidad secundaria","language description":"Idioma abreviatura dirección","offset description":"Desplazamiento de la dirección"},Ut={north:"Norte",east:"Este",south:"Sur",west:"Oeste",N:"N",NNE:"NNE",NE:"NE",ENE:"ENE",E:"E",ESE:"ESE",SE:"SE",SSE:"SSE",S:"S",SSW:"SSO",SW:"SO",WSW:"OSO",W:"O",WNW:"ONO",NW:"NO",NNW:"NNO"},Zt={common:It,editor:Rt,directions:Ut},Ht={version:"version",description:"Montre une boussole avec un indicateur dans la direction de la valeur de l'entité",invalid_configuration:"configuration non valable",no_entity:"entité non configurée",offset_not_a_number:"Le décalage de direction n'est pas un nombre",invalid:"invalide",on:"allumé",off:"éteint"},Yt={name:"Nom",optional:"Facultatif",entity:"entité",required:"obligatoire",primary:"primaire",secondary:"secondaire",indicator:"indicateur",direction:"direction",offset:"décalage",show:"montrer",abbreviations:"abréviations",toggle:"basculer",language:"langue","primary entity description":"Entité primaire","secondary entity description":"Entité secondaire","language description":"Langue abréviation de la direction","offset description":"Décalage de la direction"},qt={north:"Nord",east:"Est",south:"Sud",west:"Ouest",N:"N",NNE:"NNE",NE:"NE",ENE:"ENE",E:"E",ESE:"ESE",SE:"SE",SSE:"SSE",S:"S",SSW:"SSO",SW:"SO",WSW:"OSO",W:"O",WNW:"ONO",NW:"NO",NNW:"NNO"},Lt={common:Ht,editor:Yt,directions:qt},Ft={version:"Verzió",description:"Egy iránytűt mutat, az entitás értékének megfelelő irányba",invalid_configuration:"Nem megfelelő konfiguráció",no_entity:"Entitás nincs konfigurálva",offset_not_a_number:"Irány offszet nem szám érték",invalid:"nem megfelelő",on:"Be",off:"Ki"},Jt={name:"Név",optional:"Opcionális",entity:"Entitás",required:"Szükséges",primary:"Irány",secondary:"Másodlagos",indicator:"Indikátor",direction:"Irány",offset:"Offszet",show:"Mutat",abbreviations:"Rövidítések",toggle:"kapcsol",language:"nyelv","primary entity description":"Irány entitás","secondary entity description":"Másodlagos entitás","language description":"Irány rövidítés nyelve","offset description":"Irány offszet"},Kt={north:"Észak",east:"Kelet",south:"Dél",west:"Nyugat",N:"É",NNE:"ÉÉK",NE:"ÉK",ENE:"ÉKÉ",E:"K",ESE:"KDK",SE:"DK",SSE:"DDK",S:"D",SSW:"DDNy",SW:"DNy",WSW:"NyDNy",W:"Ny",WNW:"NyÉNy",NW:"ÉNy",NNW:"ÉÉNy"},Bt={common:Ft,editor:Jt,directions:Kt},Xt={version:"Versione",description:"Mostra una bussola con un indicatore nella direzione indicata dal valore dell'entità.",invalid_configuration:"Configurazione non valida",no_entity:"Entità non configurata",offset_not_a_number:"L'offset della direzione non è un numero.",invalid:"invalido",on:"Acceso",off:"Spento"},Gt={name:"Nome",optional:"Opzionale",entity:"Entità",required:"Richiesto",primary:"Direzione",secondary:"Secondario",indicator:"Indicatore",direction:"Direzione",offset:"Compensazione",show:"Mostra",abbreviations:"Abbreviazioni",toggle:"Inverti stato",language:"Lingua","primary entity description":"Entità primaria","secondary entity description":"Entità secondaria","language description":"Lingua abbreviazione direzione","offset description":"Compensazione direzione"},Qt={north:"Nord",east:"Est",south:"Sud",west:"Ovest",N:"N",NNE:"NNE",NE:"NE",ENE:"ENE",E:"E",ESE:"ESE",SE:"SE",SSE:"SSE",S:"S",SSW:"SSO",SW:"SO",WSW:"OSO",W:"O",WNW:"ONO",NW:"NO",NNW:"NNO"},te={common:Xt,editor:Gt,directions:Qt},ee={version:"Versie",description:"Toon een kompas met een pijl wijzend naar de waarde van de entity",invalid_configuration:"Foutieve configuratie",no_entity:"Entity niet geconfigureerd",offset_not_a_number:"Direction offset is geen nummer",invalid:"ongeldig",on:"Aan",off:"Uit"},ie={name:"Naam",optional:"Optioneel",entity:"Entiteit",required:"Noodzakelijk",primary:"Richting",secondary:"Secundaire",indicator:"Wijzer",direction:"Richting",offset:"Afwijking",show:"Toon",abbreviations:"Afkorting",toggle:"Wissel",language:"Taal","primary entity description":"Richtings entiteit","secondary entity description":"Secundaire entiteit","language description":"Richting afkortings taal","offset description":"Richtingsafwijking"},ne={north:"Noorden",east:"Oosten",south:"Zuiden",west:"Westen",N:"N",NNE:"NNO",NE:"NO",ENE:"ONO",E:"O",ESE:"OZO",SE:"ZO",SSE:"ZZO",S:"Z",SSW:"ZZW",SW:"ZW",WSW:"WZW",W:"W",WNW:"WNW",NW:"NW",NNW:"NNW"},oe={common:ee,editor:ie,directions:ne},se={version:"Versjon",description:"Vis et kompass med en indikator i retning av enhetens verdi",invalid_configuration:"Ugyldig konfigurasjon",no_entity:"Enheten er ikke konfigurert",offset_not_a_number:"Retningsforskyvning er ikke et tall",invalid:"Ugyldig",on:"På",off:"Av"},re={name:"Navn",optional:"Valgfri",entity:"Enhet",required:"Obligatorisk",primary:"Primær",secondary:"Sekundær",indicator:"Indikator",direction:"Retning",offset:"Offset",show:"Vis",abbreviations:"Forkortelser",toggle:"Veksle",language:"Språk","primary entity description":"Retningsenhet","secondary entity description":"Sekundær enhet","language description":"Retning for språkforkortelser","offset description":"Retningsforskyvningt"},ae={north:"Nord",east:"Øst",south:"Sør",west:"Vest",N:"N",NNE:"NNØ",NE:"NØ",ENE:"ØNØ",E:"Ø",ESE:"ØSØ",SE:"SØ",SSE:"SSØ",S:"S",SSW:"SSV",SW:"SV",WSW:"VSV",W:"V",WNW:"VNV",NW:"NV",NNW:"NNV"},de={common:se,editor:re,directions:ae},le={version:"Wersja",description:"Pokazuje kompas ze wskaźnikiem w kierunku wartości encji",invalid_configuration:"Nieprawidłowa konfiguracja",no_entity:"Encja nie została skonfigurowana",offset_not_a_number:"Korekcja kierunku powinna być liczbą",invalid:"Nieprawidłowy",on:"Włączony",off:"Wyłączony"},ce={name:"Nazwa",optional:"Opcjonalne",entity:"Encja",required:"Wymagane",primary:"Kierunek",secondary:"Dodatkowa",indicator:"Wskaźnik",direction:"Kierunek",offset:"Przesunięcie",show:"Pokaż",abbreviations:"Skróty",toggle:"Przełącznik",language:"Język","primary entity description":"Encja Kierunku","secondary entity description":"Encja Dodatkowa","language description":"Język skrótów kierunków","offset description":"Korekcja kierunku"},ue={north:"Północ",east:"Wschód",south:"Południe",west:"Zachód",N:"Pn.",NNE:"Pn. Pn. Wsch.",NE:"Pn. Wsch.",ENE:"Wsch. Pn. Wsch.",E:"Wsch.",ESE:"Wsch. Pd. Wsch.",SE:"Pd. Wsch.",SSE:"Pd. Pd. Wsch.",S:"Pd.",SSW:"Pd. Pd. Zach.",SW:"Pd. Zach.",WSW:"Zach. Pd. Zach.",W:"Zach.",WNW:"Zach. Pn. Zach.",NW:"Pn. Zach.",NNW:"Pn. Pn. Zach."},he={common:le,editor:ce,directions:ue},pe={version:"versão",description:"Exibe uma bússola com um indicador na direção do valor da entidade",invalid_configuration:"configuração inválida",no_entity:"entidade não configurada",offset_not_a_number:"o offset direcional não é um número",invalid:"inválido",on:"ligado",off:"desligado"},ge={name:"nome",optional:"opcional",entity:"entidade",required:"necessário",primary:"primário",secondary:"secundário",indicator:"indicador",direction:"direção",offset:"offset",show:"mostra",abbreviations:"abreviações",toggle:"alternar",language:"idioma","primary entity description":"Entidade primária","secondary entity description":"Entidade secundária","language description":"Idioma abreviação de direção","offset description":"Offset de direção"},fe={north:"norte",east:"leste",south:"sul",west:"oeste",N:"N",NNE:"NNE",NE:"NE",ENE:"ENE",E:"L",ESE:"ESE",SE:"SE",SSE:"SSE",S:"S",SSW:"SSO",SW:"SO",WSW:"OSO",W:"O",WNW:"ONO",NW:"NO",NNW:"NNO"},ve={common:pe,editor:ge,directions:fe},me={version:"Версия",description:"Показывает компас с индикатором в направлении значения объекта",invalid_configuration:"Неверная конфигурация",no_entity:"Объект не сконфигурирован",offset_not_a_number:"Смещение направления не является числом",invalid:"ошибка",on:"Вкл",off:"Выкл"},_e={name:"Имя",optional:"Не обязательно",entity:"Объект",required:"Обязательно",primary:"Направление",secondary:"Дополнительно",indicator:"Индикатор",direction:"Направление",offset:"Смещение",show:"Показать",abbreviations:"Сокращения",toggle:"Включить",language:"Язык","primary entity description":"Объект направления","secondary entity description":"Дополнительный объект","language description":"Язык аббревиатуры направления","offset description":"Смещение направления"},ye={north:"Север",east:"Восток",south:"Юг",west:"Запад",N:"С",NNE:"ССВ",NE:"СВ",ENE:"ВСВ",E:"В",ESE:"ВСВ",SE:"ЮВ",SSE:"ЮЮВ",S:"Ю",SSW:"ЮЮЗ",SW:"ЮЗ",WSW:"ЗЮЗ",W:"З",WNW:"ЗСЗ",NW:"СЗ",NNW:"ССЗ"},Se={common:me,editor:_e,directions:ye};const be={cz:Object.freeze({__proto__:null,common:Wt,editor:xt,directions:Ct,default:Pt}),de:Object.freeze({__proto__:null,common:Vt,editor:jt,directions:zt,default:Mt}),en:Object.freeze({__proto__:null,common:$t,editor:Dt,directions:Tt,default:At}),es:Object.freeze({__proto__:null,common:It,editor:Rt,directions:Ut,default:Zt}),fr:Object.freeze({__proto__:null,common:Ht,editor:Yt,directions:qt,default:Lt}),hu:Object.freeze({__proto__:null,common:Ft,editor:Jt,directions:Kt,default:Bt}),it:Object.freeze({__proto__:null,common:Xt,editor:Gt,directions:Qt,default:te}),nl:Object.freeze({__proto__:null,common:ee,editor:ie,directions:ne,default:oe}),no:Object.freeze({__proto__:null,common:se,editor:re,directions:ae,default:de}),pl:Object.freeze({__proto__:null,common:le,editor:ce,directions:ue,default:he}),pt:Object.freeze({__proto__:null,common:pe,editor:ge,directions:fe,default:ve}),ru:Object.freeze({__proto__:null,common:me,editor:_e,directions:ye,default:Se})},we=[...Object.keys(be),""].sort();function Ne(t,e="",i="",n=""){let o;""===n&&(n=(localStorage.getItem("selectedLanguage")||"en").replace(/['"]+/g,"").replace("-","_"));try{o=t.split(".").reduce(((t,e)=>t[e]),be[n])}catch(e){o=t.split(".").reduce(((t,e)=>t[e]),be.en)}return void 0===o&&(o=t.split(".").reduce(((t,e)=>t[e]),be.en)),""!==e&&""!==i&&(o=o.replace(e,i)),o}const Ee="mdi:compass",Oe={N:0,NNE:22.5,NE:45,ENE:67.5,E:90,ESE:112.5,SE:135,SSE:157.5,S:180,SSW:202.5,SW:225,WSW:247.5,W:270,WNW:292.5,NW:315,NNW:337.5},ke=[...Object.keys(Oe)],We=Ne("common.invalid"),xe=["arrow_inward","arrow_outward","circle"].sort();function Ce(t,e,i){const n=[];return t.indicator_sensors.forEach((o=>{o.sensor&&i[o.sensor]&&n.push(function(t,e,i,n,o){var s,r,a,d,l,c,u,h,p,g,f,v,m,_;const y=i.sensor||"",S=i.attribute||"",b=(null===(s=i.indicator)||void 0===s?void 0:s.color)||e.accent,w=ze(null===(r=i.indicator)||void 0===r?void 0:r.show,!0),N=(null===(a=i.state_abbreviation)||void 0===a?void 0:a.color)||e.secondaryText,E=ze(null===(d=i.state_abbreviation)||void 0===d?void 0:d.show,0===n),O=(null===(l=i.state_value)||void 0===l?void 0:l.color)||e.secondaryText,k=ze(null===(c=i.state_value)||void 0===c?void 0:c.show,!1),W=(null===(u=i.state_units)||void 0===u?void 0:u.color)||e.secondaryText,x=ze(null===(h=i.state_units)||void 0===h?void 0:h.show,!1);return{sensor:""===S?y:y+"."+S,is_attribute:""!==S,entity:o[y],decimals:i.decimals||0,units:""!==S?i.units||"":i.units||(null===(p=o[y].attributes)||void 0===p?void 0:p.unit_of_measurement)||"",indicator:{type:(null===(g=i.indicator)||void 0===g?void 0:g.type)||xe[1],dynamic_style:je(null===(f=i.indicator)||void 0===f?void 0:f.dynamic_style,t,o,b,w),color:b,show:w},state_abbreviation:{color:N,dynamic_style:je(null===(v=i.state_abbreviation)||void 0===v?void 0:v.dynamic_style,t,o,N,E),show:E},state_value:{color:O,dynamic_style:je(null===(m=i.state_value)||void 0===m?void 0:m.dynamic_style,t,o,O,k),show:k},state_units:{color:W,dynamic_style:je(null===(_=i.state_units)||void 0===_?void 0:_.dynamic_style,t,o,W,x),show:x}}}(t,e,o,n.length,i))})),n}function Pe(t,e,i){const n=[];return t.value_sensors&&t.value_sensors.length>0&&t.value_sensors.forEach((o=>{o.sensor&&i[o.sensor]&&n.push(function(t,e,i,n){var o,s,r,a,d,l,c,u,h,p,g,f,v;const m=i.sensor||"",_=i.attribute||"",y=(null===(o=i.state_min)||void 0===o?void 0:o.color)||e.secondaryText,S=ze(null===(s=i.state_min)||void 0===s?void 0:s.show,!1),b=(null===(r=i.state_max)||void 0===r?void 0:r.color)||e.secondaryText,w=ze(null===(a=i.state_max)||void 0===a?void 0:a.show,!1),N=(null===(d=i.state_value)||void 0===d?void 0:d.color)||e.primaryText,E=ze(null===(l=i.state_value)||void 0===l?void 0:l.show,!0),O=(null===(c=i.state_units)||void 0===c?void 0:c.color)||e.secondaryText,k=ze(null===(u=i.state_units)||void 0===u?void 0:u.show,!0);return{sensor:""===_?m:m+"."+_,entity:n[m],decimals:i.decimals||0,units:""!==_?i.units||"":i.units||(null===(h=n[m].attributes)||void 0===h?void 0:h.unit_of_measurement)||"",is_attribute:""!==_,state_min:{color:y,dynamic_style:je(null===(p=i.state_min)||void 0===p?void 0:p.dynamic_style,t,n,y,S),show:S},state_max:{color:b,dynamic_style:je(null===(g=i.state_max)||void 0===g?void 0:g.dynamic_style,t,n,b,w),show:w},state_value:{color:N,dynamic_style:je(null===(f=i.state_value)||void 0===f?void 0:f.dynamic_style,t,n,N,E),show:E},state_units:{color:O,dynamic_style:je(null===(v=i.state_units)||void 0===v?void 0:v.dynamic_style,t,n,O,k),show:k}}}(t,e,o,i))})),n}function Ve(t,e,i){const n=[],o=[...t||[]];return o&&o.length>0&&(o.sort(((t,e)=>t.from_value-e.from_value)),o.forEach(((t,o)=>{const s=t.color||(0===o?e:n[o-1].color)||e,r=0===o?i:ze(n[o-1].show,i),a=ze(t.show,r);n.push({from_value:t.from_value,color:s,show:a})}))),n}function je(t,e,i,n,o){const s=function(t,e,i){var n,o,s,r,a;const d={entity:i[null===(n=t.indicator_sensors[0])||void 0===n?void 0:n.sensor],sensor:(null===(o=t.indicator_sensors[0])||void 0===o?void 0:o.sensor)||"",attribute:(null===(s=t.indicator_sensors[0])||void 0===s?void 0:s.attribute)||"",units:(null===(r=t.indicator_sensors[0])||void 0===r?void 0:r.units)||i[t.indicator_sensors[0].sensor].attributes.unit_of_measurement||"",decimals:(null===(a=t.indicator_sensors[0])||void 0===a?void 0:a.decimals)||0};t.value_sensors&&t.value_sensors.length>0&&i[t.value_sensors[0].sensor]&&(d.entity=i[t.value_sensors[0].sensor],d.sensor=t.value_sensors[0].sensor,d.attribute=t.value_sensors[0].attribute||"",d.units=t.value_sensors[0].units||i[t.value_sensors[0].sensor].attributes.unit_of_measurement||"",d.decimals=t.value_sensors[0].decimals||0);e&&e.sensor&&(d.entity=i[e.sensor],d.sensor=e.sensor,d.attribute=e.attribute||"",d.units="",d.decimals=0);return d}(e,t,i),r=(null==t?void 0:t.sensor)||s.sensor,a=(null==t?void 0:t.attribute)||s.attribute,d=s.units,l=s.decimals,c=""!==a;return{entity:i[r],sensor:""===a?r:r+"."+a,is_attribute:c,bands:Ve(null==t?void 0:t.bands,n,o),decimals:l,units:d}}function ze(t,e){return void 0===t?e:Boolean(t).valueOf()}function Me(t){return("string"==typeof t||"number"==typeof t)&&(!isNaN(Number(t))&&!isNaN(parseFloat(t)))}function $e(t,e,i,n=""){const o=[t];let s=[];for(let t=0;t<o.length;t++)Object.keys(o[t]).forEach((function(r,a,d){const l=o[t][r];let c="";switch(Me(d[a])?c=""!==n?n+"["+d[a]+"]":"":""!==d[a]&&(c=""!==n?n+"."+d[a]:d[a]),r){case"sensor":e[l]?s.push(l):i&&console.warn("Compass-Card configuration: "+c+" ("+l+") is invalid");break;case"attribute":const n=o[t].sensor,r=e[n];r&&r.attributes&&r.attributes[l]?s.push(n):i&&console.warn("Compass-Card configuration: attribute "+c+" ("+l+") is invalid for entity "+c.slice(0,c.lastIndexOf("."))+".sensor ("+n+")");break;default:l&&"object"==typeof l&&(s=[...s,...$e(l,e,i,c)])}}));return s.length?[...new Set(s)]:[]}let De=class extends st{constructor(){super(...arguments),this._initialized=!1}setConfig(t){var e;(e=t)&&e.entity&&"string"==typeof e.entity?(this._config=function(t){var e,i,n,o,s,r,a,d,l;const c={type:"custom:compass-card",indicator_sensors:[{sensor:t.entity}]};return(null===(e=t.compass)||void 0===e?void 0:e.indicator)&&1!==xe.indexOf(null===(i=t.compass)||void 0===i?void 0:i.indicator)&&(c.indicator_sensors[0]=Object.assign(Object.assign({},c.indicator_sensors[0]),{indicator:{type:t.compass.indicator}})),t.secondary_entity&&""!==t.secondary_entity&&(c.value_sensors=[{sensor:t.secondary_entity}]),t.direction_offset&&"0"!==t.direction_offset&&(c.compass=Object.assign(Object.assign({},c.compass),{north:Object.assign({offset:Number(t.direction_offset)},null===(n=c.compass)||void 0===n?void 0:n.north)})),(null===(o=t.compass)||void 0===o?void 0:o.show_north)&&(null===(s=t.compass)||void 0===s?void 0:s.show_north)&&(c.compass=Object.assign(Object.assign({},c.compass),{north:Object.assign({show:!0},null===(r=c.compass)||void 0===r?void 0:r.north)})),(null===(a=t.compass)||void 0===a?void 0:a.language)&&""!==(null===(d=t.compass)||void 0===d?void 0:d.language)&&(c.language=null===(l=t.compass)||void 0===l?void 0:l.language),t.tap_action&&(c.tap_action=t.tap_action),t.name&&(c.header={title:{value:t.name}}),Object.assign({},c)}(t),kt(this,"config-changed",{config:this._config})):this._config=t,this.loadCardHelpers()}shouldUpdate(){return this._initialized||this._initialize(),!0}get _name(){var t,e,i;return(null===(i=null===(e=null===(t=this._config)||void 0===t?void 0:t.header)||void 0===e?void 0:e.title)||void 0===i?void 0:i.value)||""}get _entity(){var t,e,i;return(null===(t=this._config)||void 0===t?void 0:t.indicator_sensors)&&(null===(e=this._config)||void 0===e?void 0:e.indicator_sensors.length)>0?null===(i=this._config)||void 0===i?void 0:i.indicator_sensors[0].sensor:""}get _secondary_entity(){var t,e,i;return(null===(t=this._config)||void 0===t?void 0:t.value_sensors)&&(null===(e=this._config)||void 0===e?void 0:e.value_sensors.length)>0?null===(i=this._config)||void 0===i?void 0:i.value_sensors[0].sensor:""}get _direction_offset(){var t,e,i;return(null===(i=null===(e=null===(t=this._config)||void 0===t?void 0:t.compass)||void 0===e?void 0:e.north)||void 0===i?void 0:i.offset)||0}get _compass_indicator(){var t,e,i,n;return(null===(t=this._config)||void 0===t?void 0:t.indicator_sensors)&&(null===(e=this._config)||void 0===e?void 0:e.indicator_sensors.length)>0&&(null===(n=null===(i=this._config)||void 0===i?void 0:i.indicator_sensors[0].indicator)||void 0===n?void 0:n.type)||xe[1]}get _compass_show_north(){var t,e,i;return(null===(i=null===(e=null===(t=this._config)||void 0===t?void 0:t.compass)||void 0===e?void 0:e.north)||void 0===i?void 0:i.show)||!1}get _compass_language(){var t;return(null===(t=this._config)||void 0===t?void 0:t.language)||""}render(){if(!this.hass||!this._helpers)return A``;this._helpers.importMoreInfoControl("climate");const t=["sensor","sun","input_number","input_text"],e=Object.keys(this.hass.states).filter((e=>t.includes(e.substr(0,e.indexOf("."))))).sort(),i=["",...e];return A`
|
||
<div class="card-config">
|
||
${this.getEditorInput("editor.name","editor.optional","header.title.value",this._name)}
|
||
${this.getEditorDropDown("editor.primary entity description","editor.required","indicator_sensors[0].sensor",this._entity,e)}
|
||
${this.getEditorDropDown("editor.secondary entity description","editor.optional","value_sensors[0].sensor",this._secondary_entity,i)}
|
||
${this.getEditorDropDown("editor.indicator","editor.optional","indicator_sensors[0].indicator.type",this._compass_indicator,xe)}
|
||
${this.getEditorDropDown("editor.language description","editor.optional","language",this._compass_language,we)}
|
||
${this.getEditorInput("editor.offset description","editor.optional","compass.north.offset",this._direction_offset)}
|
||
${this.getEditorSwitch("directions.north","compass.north.show",this._compass_show_north)}
|
||
</div>
|
||
`}_valueChanged(t){var e,i,n,o,s,r,a,d,l,c,u,h,p,g,f,v,m,_,y,S,b,w,N,E,O,k;if(!this._config||!this.hass)return;const W=t.target;if(void 0!==W.checked){if(this[`_${W.configValue}`]===W.checked)return}else if(this[`_${W.configValue}`]===W.value)return;if(W.configValue)switch(W.configValue){case"language":this._config=Object.assign(Object.assign({},this._config),{language:W.value}),""===(null===(e=W.value)||void 0===e?void 0:e.trim())&&delete this._config.language;break;case"compass.north.show":const t=Object.assign(Object.assign({},null===(i=this._config.compass)||void 0===i?void 0:i.north),{show:W.checked}),x=Object.assign(Object.assign({},this._config.compass),{north:t});this._config=Object.assign(Object.assign({},this._config),{compass:x}),W.checked||(null===(o=null===(n=this._config.compass)||void 0===n?void 0:n.north)||void 0===o||delete o.show,(null===(s=this._config.compass)||void 0===s?void 0:s.north)&&0===Object.keys(null===(r=this._config.compass)||void 0===r?void 0:r.north).length&&(null===(a=this._config.compass)||void 0===a||delete a.north),this._config.compass&&0===Object.keys(this._config.compass).length&&delete this._config.compass);break;case"header.title.value":const C=Object.assign(Object.assign({},null===(d=this._config.header)||void 0===d?void 0:d.title),{value:W.value}),P=Object.assign(Object.assign({},this._config.header),{title:C});this._config=Object.assign(Object.assign({},this._config),{header:P}),""===(null===(l=W.value)||void 0===l?void 0:l.trim())&&(null===(u=null===(c=this._config.header)||void 0===c?void 0:c.title)||void 0===u||delete u.value,(null===(h=this._config.header)||void 0===h?void 0:h.title)&&0===Object.keys(null===(p=this._config.header)||void 0===p?void 0:p.title).length&&(null===(g=this._config.header)||void 0===g||delete g.title),this._config.header&&0===Object.keys(this._config.header).length&&delete this._config.header);break;case"compass.north.offset":const V=Object.assign(Object.assign({},null===(f=this._config.compass)||void 0===f?void 0:f.north),{offset:Number(W.value)}),j=Object.assign(Object.assign({},this._config.compass),{north:V});this._config=Object.assign(Object.assign({},this._config),{compass:j}),W.value&&Me(W.value)&&0===Number(W.value)&&(null===(m=null===(v=this._config.compass)||void 0===v?void 0:v.north)||void 0===m||delete m.offset,(null===(_=this._config.compass)||void 0===_?void 0:_.north)&&0===Object.keys(null===(y=this._config.compass)||void 0===y?void 0:y.north).length&&(null===(S=this._config.compass)||void 0===S||delete S.north),this._config.compass&&0===Object.keys(this._config.compass).length&&delete this._config.compass);break;case"indicator_sensors[0].sensor":const z=[...this._config.indicator_sensors];z[0]=Object.assign(Object.assign({},this._config.indicator_sensors[0]),{sensor:W.value||""}),this._config=Object.assign(Object.assign({},this._config),{indicator_sensors:z});break;case"value_sensors[0].sensor":const M=this._config.value_sensors?[...this._config.value_sensors]:[];M[0]=Object.assign(Object.assign({},M[0]),{sensor:W.value||""}),this._config=Object.assign(Object.assign({},this._config),{value_sensors:M});break;case"indicator_sensors[0].indicator.type":const $=Object.assign(Object.assign({},null===(b=this._config.indicator_sensors[0])||void 0===b?void 0:b.indicator),{type:W.value}),D=[...this._config.indicator_sensors];D[0]=Object.assign(Object.assign({},this._config.indicator_sensors[0]),{indicator:$}),this._config=Object.assign(Object.assign({},this._config),{indicator_sensors:D}),(null===(N=null===(w=this._config.indicator_sensors[0])||void 0===w?void 0:w.indicator)||void 0===N?void 0:N.type)&&1===xe.indexOf(null===(O=null===(E=this._config.indicator_sensors[0])||void 0===E?void 0:E.indicator)||void 0===O?void 0:O.type)&&1===Object.keys(null===(k=this._config.indicator_sensors[0])||void 0===k?void 0:k.indicator).length&&delete this._config.indicator_sensors[0].indicator;break;default:console.warn("Value changed of unknown config node: "+W.configValue)}kt(this,"config-changed",{config:this._config})}getEditorDropDown(t,e,i,n,o){return A` <paper-dropdown-menu class="editor-entity-select" label="${Ne(t)} (${Ne(e)})" @value-changed=${this._valueChanged} .configValue=${i}>
|
||
<paper-listbox slot="dropdown-content" .selected=${o.indexOf(n)}>
|
||
${o.map((t=>A` <paper-item>${t}</paper-item> `))}
|
||
</paper-listbox>
|
||
</paper-dropdown-menu>`}getEditorInput(t,e,i,n){return A`<paper-input label="${Ne(t)} (${Ne(e)})" .value=${n} .configValue=${i} @value-changed=${this._valueChanged}></paper-input>`}getEditorSwitch(t,e,i){return A`
|
||
<ha-formfield
|
||
.label=${`${Ne("editor.toggle")} ${Ne(t)} ${Ne("editor.indicator")} ${Ne(i?"common.off":"common.on")}`}>
|
||
<ha-switch
|
||
.checked=${!1!==i}
|
||
.configValue=${e}
|
||
@change=${this._valueChanged}
|
||
></ha-switch>
|
||
</ha-formfield>
|
||
</div>`}_initialize(){void 0!==this.hass&&void 0!==this._config&&void 0!==this._helpers&&(this._initialized=!0)}async loadCardHelpers(){this._helpers=await window.loadCardHelpers()}static get styles(){return nt`
|
||
.editor-entity-select {
|
||
width: 100%;
|
||
}
|
||
ha-switch {
|
||
ha-formfield {
|
||
padding-bottom: 8px;
|
||
}
|
||
`}};t([G({attribute:!1})],De.prototype,"hass",void 0),t([Q()],De.prototype,"_helpers",void 0),t([Q()],De.prototype,"_config",void 0),De=t([B("compass-card-editor")],De);const Te=nt`
|
||
:host ::slotted(.card-content:not(:first-child)),
|
||
slot:not(:first-child)::slotted(.card-content) {
|
||
padding-top: 0px;
|
||
margin-top: -8px;
|
||
}
|
||
:host ::slotted(.card-content) {
|
||
padding: 16px;
|
||
}
|
||
ha-card {
|
||
flex-direction: column;
|
||
flex: 1;
|
||
position: relative;
|
||
overflow: hidden;
|
||
}
|
||
.header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 8px 16px 0px;
|
||
}
|
||
.header > .name {
|
||
line-height: 40px;
|
||
font-weight: 500;
|
||
font-size: 16px;
|
||
white-space: nowrap;
|
||
text-overflow: ellipsis;
|
||
overflow: hidden;
|
||
}
|
||
.icon {
|
||
margin-top: 8px;
|
||
float: right;
|
||
}
|
||
.compass {
|
||
display: block;
|
||
width: 100%;
|
||
height: 152px;
|
||
max-width: 152px;
|
||
margin: 10px auto;
|
||
}
|
||
.content {
|
||
height: 162px;
|
||
position: relative;
|
||
width: 100%;
|
||
font-weight: normal;
|
||
line-height: 28px;
|
||
}
|
||
.value-sensors {
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
position: absolute;
|
||
text-align: center;
|
||
top: 62px;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
}
|
||
.indicator-sensors {
|
||
line-height: 18px;
|
||
font-weight: 500;
|
||
font-size: 16px;
|
||
white-space: nowrap;
|
||
text-overflow: ellipsis;
|
||
text-align: center;
|
||
overflow: hidden;
|
||
position: absolute;
|
||
top: 32px;
|
||
left: 50%;
|
||
transform: translateX(-50%);
|
||
}
|
||
.value-sensors .measurement {
|
||
font-size: 18px;
|
||
}
|
||
.value-sensors .value {
|
||
font-size: 28px;
|
||
}
|
||
`;var Ae;console.info("%c COMPASS-CARD %c 1.1.0 ","color: white; background: coral; font-weight: 700;","color: coral; background: white; font-weight: 700;"),window.customCards=window.customCards||[],window.customCards.push({type:"compass-card",name:"Compass Card",preview:!0,description:Ne("common.description")});let Ie=Ae=class extends st{constructor(){super(...arguments),this.entities={}}static async getConfigElement(){return document.createElement("compass-card-editor")}static getStubConfig(){return{type:"custom:compass-card",indicator_sensors:[{sensor:"sun.sun",attribute:"azimuth"}]}}setConfig(t){if(!t)throw new Error(Ne("common.invalid_configuration"));if(!t.indicator_sensors||!t.indicator_sensors[0].sensor)throw new Error(Ne("common.missing_direction_entity"));t.test_gui&&function(){var t=document.querySelector("home-assistant");if(t=(t=(t=(t=(t=(t=(t=(t=t&&t.shadowRoot)&&t.querySelector("home-assistant-main"))&&t.shadowRoot)&&t.querySelector("app-drawer-layout partial-panel-resolver"))&&t.shadowRoot||t)&&t.querySelector("ha-panel-lovelace"))&&t.shadowRoot)&&t.querySelector("hui-root")){var e=t.lovelace;return e.current_view=t.___curView,e}return null}().setEditMode(!0),this.colors={accent:getComputedStyle(document.documentElement).getPropertyValue("--accent-color").trim(),primary:getComputedStyle(document.documentElement).getPropertyValue("--primary-color").trim(),stateIcon:getComputedStyle(document.documentElement).getPropertyValue("--state-icon-color").trim(),secondaryText:getComputedStyle(document.documentElement).getPropertyValue("--secondary-text-color").trim(),primaryText:getComputedStyle(document.documentElement).getPropertyValue("--primary-text-color").trim()},this._config=Object.assign({},t),this.updateConfig(this._hass,this._config)}getCardSize(){return 5}set hass(t){this._hass=t,this.updateConfig(this._hass,this._config)}shouldUpdate(t){if(t.has("_config"))return!0;if(t.has("_hass")){const e=t.get("_hass");for(const t in this.entities)if(e.states[t].last_updated!==this._hass.states[t].last_updated)return!0}return!1}updateConfig(t,e){var i;if(!t||!e)return;$e(this._config,t.states,ze(this._config.debug,!1)).forEach((t=>{if(this._hass.states[t]){const e=this._hass.states[t];this.entities[e.entity_id]=this._hass.states[t]}})),this.header=function(t,e,i,n){var o,s,r,a,d,l,c,u,h,p,g,f,v,m,_,y,S,b,w,N,E,O,k,W,x,C;const P=(null===(s=null===(o=t.header)||void 0===o?void 0:o.title)||void 0===s?void 0:s.color)||e.secondaryText,V=ze(null===(a=null===(r=t.header)||void 0===r?void 0:r.title)||void 0===a?void 0:a.show,ze(void 0!==(null===(l=null===(d=t.header)||void 0===d?void 0:d.title)||void 0===l?void 0:l.value),!1)),j=(null===(u=null===(c=t.header)||void 0===c?void 0:c.icon)||void 0===u?void 0:u.color)||e.stateIcon,z=ze(null===(p=null===(h=t.header)||void 0===h?void 0:h.icon)||void 0===p?void 0:p.show,ze(null===(f=null===(g=t.header)||void 0===g?void 0:g.icon)||void 0===f?void 0:f.value,!1)||ze(null===(m=null===(v=t.header)||void 0===v?void 0:v.title)||void 0===m?void 0:m.value,!1));return{label:(null===(y=null===(_=t.header)||void 0===_?void 0:_.title)||void 0===y?void 0:y.value)||(null===(S=null==i?void 0:i.attributes)||void 0===S?void 0:S.friendly_name)||(null==i?void 0:i.entity_id),title:{value:(null===(w=null===(b=t.header)||void 0===b?void 0:b.title)||void 0===w?void 0:w.value)||"",color:P,dynamic_style:je(null===(E=null===(N=t.header)||void 0===N?void 0:N.title)||void 0===E?void 0:E.dynamic_style,t,n,P,V),show:V},icon:{value:(null===(k=null===(O=t.header)||void 0===O?void 0:O.icon)||void 0===k?void 0:k.value)||(null===(W=null==i?void 0:i.attributes)||void 0===W?void 0:W.icon)||Ee,color:j,dynamic_style:je(null===(C=null===(x=t.header)||void 0===x?void 0:x.icon)||void 0===C?void 0:C.dynamic_style,t,n,j,z),show:z}}}(this._config,this.colors,this.entities[null===(i=this._config)||void 0===i?void 0:i.indicator_sensors[0].sensor],this.entities),this.compass=function(t,e,i){var n,o,s,r,a,d,l,c,u,h,p,g,f,v;const m=(null===(o=null===(n=t.compass)||void 0===n?void 0:n.circle)||void 0===o?void 0:o.color)||e.primary,_=ze(null===(r=null===(s=t.compass)||void 0===s?void 0:s.circle)||void 0===r?void 0:r.show,!0),y=(null===(d=null===(a=t.compass)||void 0===a?void 0:a.north)||void 0===d?void 0:d.color)||e.primary,S=ze(null===(c=null===(l=t.compass)||void 0===l?void 0:l.north)||void 0===c?void 0:c.show,!1);return{circle:{color:m,dynamic_style:je(null===(h=null===(u=t.compass)||void 0===u?void 0:u.circle)||void 0===h?void 0:h.dynamic_style,t,i,m,_),show:_},north:{offset:(null===(g=null===(p=t.compass)||void 0===p?void 0:p.north)||void 0===g?void 0:g.offset)||0,color:y,dynamic_style:je(null===(v=null===(f=t.compass)||void 0===f?void 0:f.north)||void 0===v?void 0:v.dynamic_style,t,i,y,S),show:S}}}(this._config,this.colors,this.entities),this.indicatorSensors=Ce(this._config,this.colors,this.entities),this.valueSensors=Pe(this._config,this.colors,this.entities),ze(this._config.debug,!1)&&(console.info("Compass-Card inflated configuration: header",this.header),console.info("Compass-Card inflated configuration: compass",this.compass),console.info("Compass-Card inflated configuration: indicator sensors",this.indicatorSensors),console.info("Compass-Card inflated configuration: value sensors",this.valueSensors),console.info("Compass-Card configuration: listening to entities",this.entities))}render(){return this._config&&this._hass?A`
|
||
<ha-card tabindex="0" .label=${`Compass: ${this.header.label}`} class="flex compass-card" @click=${t=>this.handlePopup(t)}>
|
||
${this.getVisibility(this.header.title)||this.getVisibility(this.header.icon)?this.renderHeader():""}
|
||
<div class="content">
|
||
<div class="compass">${this.svgCompass(this.compass.north.offset)}</div>
|
||
<div class="indicator-sensors">${this.renderDirections()}</div>
|
||
<div class="value-sensors">${this.renderValues()}</div>
|
||
</div>
|
||
</ha-card>
|
||
`:A``}renderHeader(){return A`
|
||
<div class="header">
|
||
<div class="name" style="color:${this.getColor(this.header.title)};">${this.getVisibility(this.header.title)?this.renderTitle():A`<span> </span>`}</div>
|
||
<div class="icon" style="color:${this.getColor(this.header.icon)};">${this.getVisibility(this.header.icon)?this.renderIcon():A`<span> </span>`}</div>
|
||
</div>
|
||
`}renderTitle(){return A`<span>${this.header.title.value} </span>`}renderIcon(){return A`<ha-icon .icon=${this.header.icon.value}></ha-icon>`}renderDirections(){const t=[];let e=0;return this.indicatorSensors.forEach((i=>{(this.getVisibility(i.state_abbreviation)||this.getVisibility(i.state_value))&&(t.push(A`<div class="sensor-${e}">
|
||
<span class="abbr" style="color: ${this.getColor(i.state_abbreviation)};"
|
||
>${this.getVisibility(i.state_abbreviation)?this.computeIndicator(i).abbreviation:""}</span
|
||
>
|
||
<span class="value" style="color: ${this.getColor(i.state_value)};"
|
||
>${this.getVisibility(i.state_value)?this.computeIndicator(i).degrees.toFixed(i.decimals):""}</span
|
||
>
|
||
<span class="measurement" style="color: ${this.getColor(i.state_units)};">${this.getVisibility(i.state_units)?i.units:""}</span>
|
||
</div>`),e++)})),t}renderValues(){const t=[];let e=0;return this.valueSensors.forEach((i=>{this.getVisibility(i.state_value)&&(t.push(A`<div class="sensor-${e}">
|
||
<span class="value" style="color: ${this.getColor(i.state_value)};">${this.getVisibility(i.state_value)?this.getValue(i).value:""}</span>
|
||
<span class="measurement" style="color: ${this.getColor(i.state_units)};">${this.getVisibility(i.state_units)?i.units:""}</span>
|
||
</div>`),e++)})),t}getVisibility(t){var e;if(0===t.dynamic_style.bands.length)return t.show;const i=this.getValue(t.dynamic_style);if(Me(i.value)){const n=t.dynamic_style.bands.filter((t=>t.from_value<=Number(i.value)));return ze(null===(e=n[n.length-1])||void 0===e?void 0:e.show,t.show)}return t.show}getColor(t){var e;if(0===t.dynamic_style.bands.length)return t.color;const i=this.getValue(t.dynamic_style);if(Me(i.value)){const n=t.dynamic_style.bands.filter((t=>t.from_value<=Number(i.value)));return(null===(e=n[n.length-1])||void 0===e?void 0:e.color)||t.color}return t.color}svgCompass(t){return I`
|
||
<svg viewbox="0 0 152 152" preserveAspectRatio="xMidYMin slice" style="width: 100%; padding-bottom: 92%; height: 1px; overflow: visible">
|
||
${this.getVisibility(this.compass.circle)?this.svgCircle():""}
|
||
<g class="indicators" transform="rotate(${t},76,76)" stroke-width=".5">
|
||
${this.compass.north.show?this.svgIndicatorNorth():""}
|
||
${this.svgIndicators()}
|
||
</g>
|
||
</svg>
|
||
`}svgCircle(){return I`<circle class="circle" cx="76" cy="76" r="62" stroke="${this.getColor(this.compass.circle)}" stroke-width="2" fill="white" fill-opacity="0.0" stroke-opacity="1.0" />`}svgIndicators(){const t=[];return this.indicatorSensors.forEach((e=>{this.getVisibility(e.indicator)&&t.push(this.svgSingleIndicator(e))})),t}svgIndicator(t){switch(t.indicator.type){case"arrow_outward":return this.svgIndicatorArrowOutward(t);case"circle":return this.svgIndicatorCircle(t)}return this.svgIndicatorArrowInward(t)}svgSingleIndicator(t){const e=this.svgIndicator(t),{degrees:i}=this.computeIndicator(t);return I`
|
||
<g class="indicator" transform="rotate(${i},76,76)">
|
||
${e}
|
||
</g>
|
||
`}svgIndicatorArrowOutward(t){return I`
|
||
<g class="arrow-outward">
|
||
<path d="M76 0v23l-8 7z" fill="${this.getColor(t.indicator)}" stroke="${this.getColor(t.indicator)}" stroke-width=".5"/>
|
||
<path d="M76 0v23l8 7z" fill="${this.getColor(t.indicator)}" stroke="${this.getColor(t.indicator)}" stroke-width="0"/>
|
||
<path d="M76 0v23l8 7z" fill="white" opacity="0.5" stroke="white" stroke-width=".5"/>
|
||
</g>
|
||
`}svgIndicatorArrowInward(t){return I`
|
||
<g class="arrow-inward">
|
||
<path d="M76 30.664v-23l-8-7z" fill="${this.getColor(t.indicator)}" stroke="${this.getColor(t.indicator)}" stroke-width=".5" />
|
||
<path d="M76 30.664v-23l8-7z" fill="${this.getColor(t.indicator)}" stroke="${this.getColor(t.indicator)}" stroke-width="0" />
|
||
<path d="M76 30.664v-23l8-7z" fill="white" opacity="0.5" stroke="white" stroke-width=".5" />
|
||
</g>
|
||
`}svgIndicatorCircle(t){return I`
|
||
<g class="circle">
|
||
<path d="m76 5.8262a9.1809 9.1809 0 0 0-0.0244 0 9.1809 9.1809 0 0 0-9.1813 9.18 9.1809 9.1809 0 0 0 9.1813 9.1813 9.1809 9.1809 0 0 0 0.0244 0z" fill="${this.getColor(t.indicator)}"/>
|
||
<path d="m76 5.8262v18.361a9.1809 9.1809 0 0 0 9.1556-9.1813 9.1809 9.1809 0 0 0-9.1556-9.18z" fill="${this.getColor(t.indicator)}"/>
|
||
<path d="m76 5.8262v18.361a9.1809 9.1809 0 0 0 9.1556-9.1813 9.1809 9.1809 0 0 0-9.1556-9.18z" fill="white" opacity="0.5"/>
|
||
</g>
|
||
`}svgIndicatorNorth(){return I`
|
||
<g class="north">
|
||
<text x="76" y="10.089" font-family="sans-serif" font-size="13.333" text-anchor="middle" fill="${this.getColor(this.compass.north)}">
|
||
<tspan x="76" y="11">${Ne("directions.N","","",this._config.language)}</tspan>
|
||
</text>
|
||
</g>
|
||
`}getSecondaryEntity(t){return A` <span class="value">${t.state}</span> <span class="measurement">${t.attributes.unit_of_measurement}</span>`}getValue(t){var e;if(t.is_attribute){const e=t.sensor.slice(0,t.sensor.lastIndexOf(".")),i=this.entities[e];if(i&&i.attributes){const e=t.sensor.slice(t.sensor.lastIndexOf(".")+1),n=i.attributes[e]||We;return{value:Me(n)?Number(n).toFixed(t.decimals):n,units:t.units}}return{value:We,units:t.units}}const i=(null===(e=this.entities[t.sensor])||void 0===e?void 0:e.state)||We;return{value:Me(i)?Number(i).toFixed(t.decimals):i,units:t.units}}handlePopup(t){t.stopPropagation(),this._config.tap_action&&((t,e,i,n)=>{let o;switch(n.action||"more-info"){case"more-info":o=new Event("hass-more-info",{composed:!0}),o.detail={entityId:n.entity||(null==i?void 0:i.tap_action)},t.dispatchEvent(o);break;case"navigate":if(!n.navigation_path)return;if(n.new_tab||void 0===n.new_tab){window.open(n.navigation_path,"_blank");break}window.history.pushState(null,"",n.navigation_path),o=new Event("location-changed",{composed:!0}),o.detail={replace:!1},window.dispatchEvent(o);break;case"call-service":{if(!n.service)return;const[t,i]=n.service.split(".",2),o=n.service_data?Object.assign({},JSON.parse(n.service_data)):"";e.callService(t,i,o);break}case"url":if(!n.url)return;if(n.new_tab||void 0===n.new_tab){window.open(n.url,"_blank");break}window.location.href=n.url;break;default:;}})(this,this._hass,this._config,this._config.tap_action)}computeIndicator(t){let e=0,i=Ne("common.invalid");const n=this.getValue(t);if(Number.isNaN(Number(n.value))){if(e=Ae.getDegrees(n.value),i=n.value,-1===e){const t=n.value.replace(/\s+/g,"").match(/[+-]?\d+(\.\d)?/);e=(null==t?void 0:t.length)?Ae.positiveDegrees(parseFloat(t[0])):0,i=Ae.getCompassAbbreviation(e,this._config.language)}}else e=Ae.positiveDegrees(parseFloat(n.value)),i=Ae.getCompassAbbreviation(e,this._config.language);return{abbreviation:i,degrees:Math.round(e)}}static get styles(){return Te}static getDegrees(t){return Oe[t]?Oe[t]:-1}static getCompassAbbreviation(t,e){const i=Math.round(Ae.positiveDegrees(t)/22.5);let n="N";return n=ke[i],i>15&&(n=ke[0]),Ne(`directions.${n}`,"","",e)}static positiveDegrees(t){return t<0?t+360*(Math.abs(Math.ceil(t/360))+1):t%360}};t([G({attribute:!1})],Ie.prototype,"_hass",void 0),t([G({attribute:!1})],Ie.prototype,"_config",void 0),t([Q()],Ie.prototype,"colors",void 0),t([Q()],Ie.prototype,"header",void 0),t([Q()],Ie.prototype,"compass",void 0),t([Q()],Ie.prototype,"indicatorSensors",void 0),t([Q()],Ie.prototype,"entities",void 0),t([Q()],Ie.prototype,"valueSensors",void 0),Ie=Ae=t([B("compass-card")],Ie);export{Ie as CompassCard};
|