diff --git a/CHANGELOG.md b/CHANGELOG.md index 10436523..60595972 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com), and this project adheres to [Semantic Versioning](https://semver.org). -## 1.7.1 - ? +## 1.7.1 - 2021-05-30 ### ✨ NEW - Adding precipitation probability (if exists in weather object) @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this ### 🧹 Cleanup - Don't require sun +- Small code format cleanup --- diff --git a/dist/weather-card.js b/dist/weather-card.js index 528ef579..ffe8a8c5 100644 --- a/dist/weather-card.js +++ b/dist/weather-card.js @@ -66,7 +66,7 @@ class _{constructor(t,e,i){this.__parts=[],this.template=t,this.processor=e,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 v=` ${r} `;class w{constructor(t,e,i,r){this.strings=t,this.values=e,this.type=i,this.processor=r}getHTML(){const t=this.strings.length-1;let e="",i=!1;for(let s=0;s-1||i)&&-1===t.indexOf("--\x3e",a+1);const o=h.exec(t);e+=null===o?t+(i?v:n):t.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+r}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");return t.innerHTML=this.getHTML(),t}} + */const v=` ${r} `;class b{constructor(t,e,i,r){this.strings=t,this.values=e,this.type=i,this.processor=r}getHTML(){const t=this.strings.length-1;let e="",i=!1;for(let s=0;s-1||i)&&-1===t.indexOf("--\x3e",a+1);const o=h.exec(t);e+=null===o?t+(i?v:n):t.substr(0,o.index)+o[1]+o[2]+"$lit$"+o[3]+r}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");return t.innerHTML=this.getHTML(),t}} /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -79,7 +79,7 @@ class _{constructor(t,e,i){this.__parts=[],this.template=t,this.processor=e,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 S=t=>null===t||!("object"==typeof t||"function"==typeof t),b=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class x{constructor(t,e,i){this.dirty=!0,this.element=t,this.name=e,this.strings=i,this.parts=[];for(let t=0;t{try{const t={get capture(){return E=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class ${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(;g(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=f,t(this)}if(this.__pendingValue===f)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),r=null!=t&&(null==e||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=M(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=f}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const M=t=>t&&(E?{capture:t.capture,passive:t.passive,once:t.once}:t.capture) + */const S=t=>null===t||!("object"==typeof t||"function"==typeof t),w=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class x{constructor(t,e,i){this.dirty=!0,this.element=t,this.name=e,this.strings=i,this.parts=[];for(let t=0;t{try{const t={get capture(){return E=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class ${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(;g(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=f,t(this)}if(this.__pendingValue===f)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),r=null!=t&&(null==e||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=M(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=f}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const M=t=>t&&(E?{capture:t.capture,passive:t.passive,once:t.once}:t.capture) /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -132,7 +132,7 @@ class{handleAttributeExpressions(t,e,i,r){const n=e[0];if("."===n){return new C( * 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 j=(t,...e)=>new w(t,e,"html",A) + */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.2.1");const j=(t,...e)=>new b(t,e,"html",A) /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -145,7 +145,7 @@ class{handleAttributeExpressions(t,e,i,r){const n=e[0];if("."===n){return new C( * 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 - */,L=(t,e)=>`${t}--${e}`;let W=!0;void 0===window.ShadyCSS?W=!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."),W=!1);const H=t=>e=>{const i=L(e.type,t);let n=k.get(i);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},k.set(i,n));let s=n.stringsArray.get(e.strings);if(void 0!==s)return s;const o=e.strings.join(r);if(s=n.keyString.get(o),void 0===s){const i=e.getTemplateElement();W&&window.ShadyCSS.prepareTemplateDom(i,t),s=new a(e,i),n.keyString.set(o,s)}return n.stringsArray.set(e.strings,s),s},U=["html","svg"],z=new Set,R=(t,e,i)=>{z.add(t);const r=i?i.element:document.createElement("template"),n=e.querySelectorAll("style"),{length:s}=n;if(0===s)return void window.ShadyCSS.prepareTemplateStyles(r,t);const a=document.createElement("style");for(let t=0;t{U.forEach(e=>{const i=k.get(L(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)}),d(t,i)})})})(t);const o=r.content;i?function(t,e,i=null){const{element:{content:r},parts:n}=t;if(null==i)return void r.appendChild(e);const s=document.createTreeWalker(r,133,null,!1);let a=p(n),o=0,c=-1;for(;s.nextNode();){c++;for(s.currentNode===i&&(o=u(e),i.parentNode.insertBefore(e,i));-1!==a&&n[a].index===c;){if(o>0){for(;-1!==a;)n[a].index+=o,a=p(n,a);return}a=p(n,a)}}}(i,a,o.firstChild):o.insertBefore(a,o.firstChild),window.ShadyCSS.prepareTemplateStyles(r,t);const c=o.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)e.insertBefore(c.cloneNode(!0),e.firstChild);else if(i){o.insertBefore(a,o.firstChild);const t=new Set;t.add(a),d(i,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const Y={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}},I=(t,e)=>e!==t&&(e==e||t==t),F={attribute:!0,type:String,converter:Y,reflect:!1,hasChanged:I};class q extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach((e,i)=>{const r=this._attributeNameForProperty(i,e);void 0!==r&&(this._attributeToPropertyMap.set(r,i),t.push(r))}),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=F){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const i="symbol"==typeof t?Symbol():"__"+t,r=this.getPropertyDescriptor(t,i,e);void 0!==r&&Object.defineProperty(this.prototype,t,r)}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(r){const n=this[t];this[e]=r,this.requestUpdateInternal(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||F}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=I){return i(t,e)}static _propertyValueFromAttribute(t,e){const i=e.type,r=e.converter||Y,n="function"==typeof r?r:r.fromAttribute;return n?n(t,i):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const i=e.type,r=e.converter;return(r&&r.toAttribute||Y.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=F){const r=this.constructor,n=r._attributeNameForProperty(t,i);if(void 0!==n){const t=r._propertyValueToAttribute(e,i);if(void 0===t)return;this._updateState=8|this._updateState,null==t?this.removeAttribute(n):this.setAttribute(n,t),this._updateState=-9&this._updateState}}_attributeToProperty(t,e){if(8&this._updateState)return;const i=this.constructor,r=i._attributeToPropertyMap.get(t);if(void 0!==r){const t=i.getPropertyOptions(r);this._updateState=16|this._updateState,this[r]=i._propertyValueFromAttribute(e,t),this._updateState=-17&this._updateState}}requestUpdateInternal(t,e,i){let r=!0;if(void 0!==t){const n=this.constructor;i=i||n.getPropertyOptions(t),n._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))):r=!1}!this._hasRequestedUpdate&&r&&(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.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){}}q.finalized=!0; + */,L=(t,e)=>`${t}--${e}`;let W=!0;void 0===window.ShadyCSS?W=!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."),W=!1);const H=t=>e=>{const i=L(e.type,t);let n=k.get(i);void 0===n&&(n={stringsArray:new WeakMap,keyString:new Map},k.set(i,n));let s=n.stringsArray.get(e.strings);if(void 0!==s)return s;const o=e.strings.join(r);if(s=n.keyString.get(o),void 0===s){const i=e.getTemplateElement();W&&window.ShadyCSS.prepareTemplateDom(i,t),s=new a(e,i),n.keyString.set(o,s)}return n.stringsArray.set(e.strings,s),s},U=["html","svg"],z=new Set,R=(t,e,i)=>{z.add(t);const r=i?i.element:document.createElement("template"),n=e.querySelectorAll("style"),{length:s}=n;if(0===s)return void window.ShadyCSS.prepareTemplateStyles(r,t);const a=document.createElement("style");for(let t=0;t{U.forEach(e=>{const i=k.get(L(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)}),d(t,i)})})})(t);const o=r.content;i?function(t,e,i=null){const{element:{content:r},parts:n}=t;if(null==i)return void r.appendChild(e);const s=document.createTreeWalker(r,133,null,!1);let a=p(n),o=0,c=-1;for(;s.nextNode();){c++;for(s.currentNode===i&&(o=u(e),i.parentNode.insertBefore(e,i));-1!==a&&n[a].index===c;){if(o>0){for(;-1!==a;)n[a].index+=o,a=p(n,a);return}a=p(n,a)}}}(i,a,o.firstChild):o.insertBefore(a,o.firstChild),window.ShadyCSS.prepareTemplateStyles(r,t);const c=o.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==c)e.insertBefore(c.cloneNode(!0),e.firstChild);else if(i){o.insertBefore(a,o.firstChild);const t=new Set;t.add(a),d(i,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const Y={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}},I=(t,e)=>e!==t&&(e==e||t==t),F={attribute:!0,type:String,converter:Y,reflect:!1,hasChanged:I};class B extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach((e,i)=>{const r=this._attributeNameForProperty(i,e);void 0!==r&&(this._attributeToPropertyMap.set(r,i),t.push(r))}),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=F){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const i="symbol"==typeof t?Symbol():"__"+t,r=this.getPropertyDescriptor(t,i,e);void 0!==r&&Object.defineProperty(this.prototype,t,r)}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(r){const n=this[t];this[e]=r,this.requestUpdateInternal(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||F}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=I){return i(t,e)}static _propertyValueFromAttribute(t,e){const i=e.type,r=e.converter||Y,n="function"==typeof r?r:r.fromAttribute;return n?n(t,i):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const i=e.type,r=e.converter;return(r&&r.toAttribute||Y.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=F){const r=this.constructor,n=r._attributeNameForProperty(t,i);if(void 0!==n){const t=r._propertyValueToAttribute(e,i);if(void 0===t)return;this._updateState=8|this._updateState,null==t?this.removeAttribute(n):this.setAttribute(n,t),this._updateState=-9&this._updateState}}_attributeToProperty(t,e){if(8&this._updateState)return;const i=this.constructor,r=i._attributeToPropertyMap.get(t);if(void 0!==r){const t=i.getPropertyOptions(r);this._updateState=16|this._updateState,this[r]=i._propertyValueFromAttribute(e,t),this._updateState=-17&this._updateState}}requestUpdateInternal(t,e,i){let r=!0;if(void 0!==t){const n=this.constructor;i=i||n.getPropertyOptions(t),n._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))):r=!1}!this._hasRequestedUpdate&&r&&(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.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){}}B.finalized=!0; /** * @license * Copyright (c) 2017 The Polymer Project Authors. All rights reserved. @@ -159,7 +159,7 @@ class{handleAttributeExpressions(t,e,i,r){const n=e[0];if("."===n){return new C( * 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:r}=e;return{kind:i,elements:r,finisher(e){window.customElements.define(t,e)}}})(t,e),Z=(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 J(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):Z(t,e)}const G=t=>function(t){return J({attribute:!1,hasChanged:null==t?void 0:t.hasChanged})}(t) +const q=t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:r}=e;return{kind:i,elements:r,finisher(e){window.customElements.define(t,e)}}})(t,e),Z=(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 J(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):Z(t,e)}const G=t=>function(t){return J({attribute:!1,hasChanged:null==t?void 0:t.hasChanged})}(t) /** @license Copyright (c) 2019 The Polymer Project Authors. All rights reserved. @@ -183,7 +183,7 @@ 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.5.1");const et={};class it extends q{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),r=[];i.forEach(t=>r.unshift(t)),this._styles=r}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map(t=>{if(t instanceof CSSStyleSheet&&!K){const e=Array.prototype.slice.call(t.cssRules).reduce((t,e)=>t+e.cssText,"");return new X(String(e),Q)}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(this.constructor.shadowRootOptions)}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?K?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!==et&&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 et}}it.finalized=!0,it.render=(t,e,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");const n=r.scopeName,s=V.has(e),a=W&&11===e.nodeType&&!!e.host,o=a&&!z.has(n),c=o?document.createDocumentFragment():e;if(((t,e,r)=>{let n=V.get(e);void 0===n&&(i(e,e.firstChild),V.set(e,n=new P(Object.assign({templateFactory:D},r))),n.appendInto(e)),n.setValue(t),n.commit()})(t,c,Object.assign({templateFactory:H(n)},r)),o){const t=V.get(c);V.delete(c);const r=t.value instanceof _?t.value.template:void 0;R(n,c,r),i(e,e.firstChild),e.appendChild(c),V.set(e,t)}!s&&a&&window.ShadyCSS.styleElement(e.host)},it.shadowRootOptions={mode:"open"};var rt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,nt="[^\\s]+",st=/\[([^]*?)\]/gm;function at(t,e){for(var i=[],r=0,n=t.length;r-1?r:null}};function ct(t){for(var e=[],i=1;i3?0:(t-t%10!=10?1:0)*t%10]}},pt=ct({},ut),mt=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+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)}},ft=function(t){return+t-1},yt=[null,"[1-9]\\d?"],_t=[null,nt],vt=["isPm",nt,function(t,e){var i=t.toLowerCase();return i===e.amPm[0]?0:i===e.amPm[1]?1:null}],wt=["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}],St=(ot("monthNamesShort"),ot("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 bt=function(t,e,i){if(void 0===e&&(e=St.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 r=[];e=(e=St[e]||e).replace(st,(function(t,e){return r.push(e),"@@@"}));var n=ct(ct({},pt),i);return(e=e.replace(rt,(function(e){return gt[e](t,n)}))).replace(/@@@/g,(function(){return r.shift()}))},xt=(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,r){r=r||{},i=null==i?{}:i;var n=new Event(e,{bubbles:void 0===r.bubbles||r.bubbles,cancelable:Boolean(r.cancelable),composed:void 0===r.composed||r.composed});return n.detail=i,t.dispatchEvent(n),n});let Nt=class extends it{constructor(){super(...arguments),this._initialized=!1}setConfig(t){this._config=t}shouldUpdate(){return this._initialized||this._initialize(),!0}get _name(){var t;return(null===(t=this._config)||void 0===t?void 0:t.name)||""}get _entity(){var t;return(null===(t=this._config)||void 0===t?void 0:t.entity)||""}get _icons(){var t;return(null===(t=this._config)||void 0===t?void 0:t.icons)||""}get _current(){var t;return!1!==(null===(t=this._config)||void 0===t?void 0:t.current)}get _details(){var t;return!1!==(null===(t=this._config)||void 0===t?void 0:t.details)}get _forecast(){var t;return!1!==(null===(t=this._config)||void 0===t?void 0:t.forecast)}get _graph(){var t;return!1!==(null===(t=this._config)||void 0===t?void 0:t.graph)}get _forecastMaxColumn(){var t;return(null===(t=this._config)||void 0===t?void 0:t.forecastMaxColumn)||9}get _hidePrecipitation(){var t;return!0===(null===(t=this._config)||void 0===t?void 0:t.hidePrecipitation)}render(){if(!this.hass)return j``;const t=Object.keys(this.hass.states).filter(t=>"weather"===t.substr(0,t.indexOf(".")));return j` +(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const et={};class it extends B{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),r=[];i.forEach(t=>r.unshift(t)),this._styles=r}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map(t=>{if(t instanceof CSSStyleSheet&&!K){const e=Array.prototype.slice.call(t.cssRules).reduce((t,e)=>t+e.cssText,"");return new X(String(e),Q)}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(this.constructor.shadowRootOptions)}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?K?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!==et&&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 et}}it.finalized=!0,it.render=(t,e,r)=>{if(!r||"object"!=typeof r||!r.scopeName)throw new Error("The `scopeName` option is required.");const n=r.scopeName,s=V.has(e),a=W&&11===e.nodeType&&!!e.host,o=a&&!z.has(n),c=o?document.createDocumentFragment():e;if(((t,e,r)=>{let n=V.get(e);void 0===n&&(i(e,e.firstChild),V.set(e,n=new P(Object.assign({templateFactory:D},r))),n.appendInto(e)),n.setValue(t),n.commit()})(t,c,Object.assign({templateFactory:H(n)},r)),o){const t=V.get(c);V.delete(c);const r=t.value instanceof _?t.value.template:void 0;R(n,c,r),i(e,e.firstChild),e.appendChild(c),V.set(e,t)}!s&&a&&window.ShadyCSS.styleElement(e.host)},it.shadowRootOptions={mode:"open"};var rt=/d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g,nt="[^\\s]+",st=/\[([^]*?)\]/gm;function at(t,e){for(var i=[],r=0,n=t.length;r-1?r:null}};function ct(t){for(var e=[],i=1;i3?0:(t-t%10!=10?1:0)*t%10]}},pt=ct({},ut),mt=function(t,e){for(void 0===e&&(e=2),t=String(t);t.length0?"-":"+")+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)}},ft=function(t){return+t-1},yt=[null,"[1-9]\\d?"],_t=[null,nt],vt=["isPm",nt,function(t,e){var i=t.toLowerCase();return i===e.amPm[0]?0:i===e.amPm[1]?1:null}],bt=["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}],St=(ot("monthNamesShort"),ot("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 wt=function(t,e,i){if(void 0===e&&(e=St.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 r=[];e=(e=St[e]||e).replace(st,(function(t,e){return r.push(e),"@@@"}));var n=ct(ct({},pt),i);return(e=e.replace(rt,(function(e){return gt[e](t,n)}))).replace(/@@@/g,(function(){return r.shift()}))},xt=(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,r){r=r||{},i=null==i?{}:i;var n=new Event(e,{bubbles:void 0===r.bubbles||r.bubbles,cancelable:Boolean(r.cancelable),composed:void 0===r.composed||r.composed});return n.detail=i,t.dispatchEvent(n),n});let Nt=class extends it{constructor(){super(...arguments),this._initialized=!1}setConfig(t){this._config=t}shouldUpdate(){return this._initialized||this._initialize(),!0}get _name(){var t;return(null===(t=this._config)||void 0===t?void 0:t.name)||""}get _entity(){var t;return(null===(t=this._config)||void 0===t?void 0:t.entity)||""}get _icons(){var t;return(null===(t=this._config)||void 0===t?void 0:t.icons)||""}get _current(){var t;return!1!==(null===(t=this._config)||void 0===t?void 0:t.current)}get _details(){var t;return!1!==(null===(t=this._config)||void 0===t?void 0:t.details)}get _forecast(){var t;return!1!==(null===(t=this._config)||void 0===t?void 0:t.forecast)}get _graph(){var t;return!1!==(null===(t=this._config)||void 0===t?void 0:t.graph)}get _forecastMaxColumn(){var t;return(null===(t=this._config)||void 0===t?void 0:t.forecastMaxColumn)||9}get _hidePrecipitation(){var t;return!0===(null===(t=this._config)||void 0===t?void 0:t.hidePrecipitation)}render(){if(!this.hass)return j``;const t=Object.keys(this.hass.states).filter(t=>"weather"===t.substr(0,t.indexOf(".")));return j`
@@ -247,7 +247,7 @@ found at http://polymer.github.io/PATENTS.txt .option .help { color: var(--secondary-text-color); } - `}};t([J({attribute:!1})],Nt.prototype,"hass",void 0),t([G()],Nt.prototype,"_config",void 0),t([G()],Nt.prototype,"_toggle",void 0),Nt=t([B("weather-card-editor")],Nt);const Pt=tt` + `}};t([J({attribute:!1})],Nt.prototype,"hass",void 0),t([G()],Nt.prototype,"_config",void 0),t([G()],Nt.prototype,"_toggle",void 0),Nt=t([q("weather-card-editor")],Nt);const Pt=tt` ha-card { cursor: pointer; margin: auto; @@ -420,7 +420,7 @@ found at http://polymer.github.io/PATENTS.txt .conditions .icon { margin-top: -10px; } -`;var Ot={version:"Version",invalid_configuration:"Invalid configuration",invalid_entity:"Please define a weather entity",show_warning:"Show Warning",show_error:"Show Error"},Ct=["N","N-NE","NE","E-NE","E","E-SE","SE","S-SE","S","S-SW","SW","W-SW","W","W-NW","NW","N-NW","N"],Tt={common:Ot,temp:"Temperature",tempHi:"Temperature max",tempLo:"Temperature min",precip:"Precipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Ct},Et=["N","N-NØ","NØ","Ø-NØ","Ø","Ø-SØ","SØ","S-SØ","S","S-SV","SV","V-SV","V","V-NV","NV","N-NV","N"],$t={temp:"Temperatur",tempHi:"Temperatur maks",tempLo:"Temperatur nat",precip:"Nedbør",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Et},Mt=["N","N-NO","NO","O-NO","O","O-SO","SO","S-SO","S","S-SW","SW","W-SW","W","W-NW","NW","N-NW","N"],Dt={temp:"temperatur",tempHi:"Höchsttemperatur",tempLo:"Tiefsttemperatur",precip:"Niederschlag",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Mt},kt=["N","N-NE","NE","E-NE","E","E-SE","SE","S-SE","S","S-SO","SO","O-SO","O","O-NO","NO","N-NO","N"],Vt={temp:"Temperatura",tempHi:"Temperatura máxima",tempLo:"Temperatura mínima",precip:"Precipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:kt},At=["N","N-NE","NE","E-NE","E","E-SE","SE","S-SE","S","S-SO","SO","O-SO","O","O-NO","NO","N-NO","N"],jt={temp:"Température",tempHi:"Température max",tempLo:"Température min",precip:"Précipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:At},Lt=["N","N-NO","NO","O-NO","O","O-ZO","ZO","Z-ZO","Z","Z-ZW","ZW","W-ZW","W","W-NW","NW","N-NW","N"],Wt={temp:"temperatuur",tempHi:"Maximum temperatuur",tempLo:"Minimum temperatuur",precip:"Neerslag",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Lt},Ht=["С","С-СВ","СВ","В-СВ","В","В-ЮВ","ЮВ","Ю-ЮВ","Ю","Ю-ЮЗ","ЮЗ","З-ЮЗ","З","З-СЗ","СЗ","С-СЗ","С"],Ut={temp:"Температура",tempHi:"Температура макси",tempLo:"Температура ночью",precip:"Осадки",uPress:"гПа",uSpeed:"м/с",uPrecip:"мм",cardinalDirections:Ht},zt=["N","N-NO","NO","O-NO","O","O-SO","SO","S-SO","S","S-SV","SV","V-SV","V","V-NV","NV","N-NV","N"],Rt={temp:"Temperatur",tempHi:"Max temperatur",tempLo:"Min temperatur",precip:"Nederbörd",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:zt};const Yt={en:Object.freeze({__proto__:null,common:Ot,temp:"Temperature",tempHi:"Temperature max",tempLo:"Temperature min",precip:"Precipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Ct,default:Tt}),da:Object.freeze({__proto__:null,temp:"Temperatur",tempHi:"Temperatur maks",tempLo:"Temperatur nat",precip:"Nedbør",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Et,default:$t}),de:Object.freeze({__proto__:null,temp:"temperatur",tempHi:"Höchsttemperatur",tempLo:"Tiefsttemperatur",precip:"Niederschlag",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Mt,default:Dt}),es:Object.freeze({__proto__:null,temp:"Temperatura",tempHi:"Temperatura máxima",tempLo:"Temperatura mínima",precip:"Precipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:kt,default:Vt}),fr:Object.freeze({__proto__:null,temp:"Température",tempHi:"Température max",tempLo:"Température min",precip:"Précipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:At,default:jt}),nl:Object.freeze({__proto__:null,temp:"temperatuur",tempHi:"Maximum temperatuur",tempLo:"Minimum temperatuur",precip:"Neerslag",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Lt,default:Wt}),ru:Object.freeze({__proto__:null,temp:"Температура",tempHi:"Температура макси",tempLo:"Температура ночью",precip:"Осадки",uPress:"гПа",uSpeed:"м/с",uPrecip:"мм",cardinalDirections:Ht,default:Ut}),sv:Object.freeze({__proto__:null,temp:"Temperatur",tempHi:"Max temperatur",tempLo:"Min temperatur",precip:"Nederbörd",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:zt,default:Rt})};function It(t,e="",i=""){const r=(localStorage.getItem("selectedLanguage")||"en").replace(/['"]+/g,"").replace("-","_");let n;try{n=t.split(".").reduce((t,e)=>t[e],Yt[r])}catch(e){n=t.split(".").reduce((t,e)=>t[e],Yt.en)}return void 0===n&&(n=t.split(".").reduce((t,e)=>t[e],Yt.en)),""!==e&&""!==i&&(n=n.replace(e,i)),n}const Ft=["entity","config"],qt=["mdi:arrow-down","mdi:arrow-bottom-left","mdi:arrow-left","mdi:arrow-top-left","mdi:arrow-up","mdi:arrow-top-right","mdi:arrow-right","mdi:arrow-bottom-right","mdi:arrow-down"],Bt={clear:"day","clear-night":"night",cloudy:"cloudy",fog:"cloudy",hail:"rainy-7",lightning:"thunder","lightning-rainy":"thunder",partlycloudy:"cloudy-day-3",pouring:"rainy-6",rainy:"rainy-5",snowy:"snowy-6","snowy-rainy":"rainy-7",sunny:"day",windy:"cloudy","windy-variant":"cloudy-day-3",exceptional:"!!"},Zt=Object.assign(Object.assign({},Bt),{clear:"night",sunny:"night",partlycloudy:"cloudy-night-3","windy-variant":"cloudy-night-3"});var Jt;!function(t){t[t.hourly=0]="hourly",t[t.daily=1]="daily"}(Jt||(Jt={}));var Gt;window.customCards=window.customCards||[],window.customCards.push({type:"weather-card",name:"Animated weather card",description:"Lovelace animated weather card"}),console.info(`%c WEATHER-CARD \n%c ${It("common.version")} 1.7.0 `,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray");let Kt=Gt=class extends it{constructor(){var t;super(),this.numberElements=0,this.mode=Jt.daily,this.currentLanguage=(null===(t=this.hass)||void 0===t?void 0:t.language)||"en"}static async getConfigElement(){return document.createElement("weather-card-editor")}setConfig(t){if(!t)throw new Error(It("common.invalid_configuration"));if(!t.entity)throw new Error(It("common.invalid_entity"));this.config=Object.assign({name:""},t),this.setWeatherObj()}setWeatherObj(){var t,e;if(!this.hass||!this.config.entity)return;if(this.weatherObj=this.config.entity in this.hass.states?this.hass.states[this.config.entity]:null,!this.weatherObj)return;if(!this.config.forecastMaxColumn||this.config.forecastMaxColumn<2?this.forecast=this.weatherObj.attributes.forecast.slice(0,9):this.forecast=this.weatherObj.attributes.forecast.slice(0,this.config.forecastMaxColumn),!Array.isArray(this.forecast))return;let i;if((null===(t=this.forecast)||void 0===t?void 0:t.length)&&(null===(e=this.forecast)||void 0===e?void 0:e.length)>2){const t=new Date(this.forecast[1].datetime);i=new Date(this.forecast[2].datetime).getTime()-t.getTime()<864e5,i&&(this.mode=Jt.hourly)}}shouldUpdate(t){return!this.weatherObj||Ft.some(e=>t.has(e))}updated(){this.setWeatherObj();const t=this.shadowRoot.querySelector("#Chart");t&&(t.data=this.chartData,t.hass=this.hass)}render(){return this.config&&this.hass?(this.setWeatherObj(),this.numberElements=0,this.weatherObj?j` +`;var Ot={version:"Version",invalid_configuration:"Invalid configuration",invalid_entity:"Please define a weather entity",show_warning:"Show Warning",show_error:"Show Error"},Ct=["N","N-NE","NE","E-NE","E","E-SE","SE","S-SE","S","S-SW","SW","W-SW","W","W-NW","NW","N-NW","N"],Tt={common:Ot,temp:"Temperature",tempHi:"Temperature max",tempLo:"Temperature min",precip:"Precipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Ct},Et=Object.freeze({__proto__:null,common:Ot,temp:"Temperature",tempHi:"Temperature max",tempLo:"Temperature min",precip:"Precipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Ct,default:Tt}),$t=["N","N-NØ","NØ","Ø-NØ","Ø","Ø-SØ","SØ","S-SØ","S","S-SV","SV","V-SV","V","V-NV","NV","N-NV","N"],Mt={temp:"Temperatur",tempHi:"Temperatur maks",tempLo:"Temperatur nat",precip:"Nedbør",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:$t},Dt=["N","N-NO","NO","O-NO","O","O-SO","SO","S-SO","S","S-SW","SW","W-SW","W","W-NW","NW","N-NW","N"],kt={temp:"temperatur",tempHi:"Höchsttemperatur",tempLo:"Tiefsttemperatur",precip:"Niederschlag",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Dt},Vt=["N","N-NE","NE","E-NE","E","E-SE","SE","S-SE","S","S-SO","SO","O-SO","O","O-NO","NO","N-NO","N"],At={temp:"Temperatura",tempHi:"Temperatura máxima",tempLo:"Temperatura mínima",precip:"Precipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Vt},jt=["N","N-NE","NE","E-NE","E","E-SE","SE","S-SE","S","S-SO","SO","O-SO","O","O-NO","NO","N-NO","N"],Lt={temp:"Température",tempHi:"Température max",tempLo:"Température min",precip:"Précipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:jt},Wt=["N","N-NO","NO","O-NO","O","O-ZO","ZO","Z-ZO","Z","Z-ZW","ZW","W-ZW","W","W-NW","NW","N-NW","N"],Ht={temp:"temperatuur",tempHi:"Maximum temperatuur",tempLo:"Minimum temperatuur",precip:"Neerslag",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Wt},Ut=["С","С-СВ","СВ","В-СВ","В","В-ЮВ","ЮВ","Ю-ЮВ","Ю","Ю-ЮЗ","ЮЗ","З-ЮЗ","З","З-СЗ","СЗ","С-СЗ","С"],zt={temp:"Температура",tempHi:"Температура макси",tempLo:"Температура ночью",precip:"Осадки",uPress:"гПа",uSpeed:"м/с",uPrecip:"мм",cardinalDirections:Ut},Rt=["N","N-NO","NO","O-NO","O","O-SO","SO","S-SO","S","S-SV","SV","V-SV","V","V-NV","NV","N-NV","N"],Yt={temp:"Temperatur",tempHi:"Max temperatur",tempLo:"Min temperatur",precip:"Nederbörd",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Rt};const It={en:Et,en_GB:Et,da:Object.freeze({__proto__:null,temp:"Temperatur",tempHi:"Temperatur maks",tempLo:"Temperatur nat",precip:"Nedbør",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:$t,default:Mt}),de:Object.freeze({__proto__:null,temp:"temperatur",tempHi:"Höchsttemperatur",tempLo:"Tiefsttemperatur",precip:"Niederschlag",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Dt,default:kt}),es:Object.freeze({__proto__:null,temp:"Temperatura",tempHi:"Temperatura máxima",tempLo:"Temperatura mínima",precip:"Precipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Vt,default:At}),fr:Object.freeze({__proto__:null,temp:"Température",tempHi:"Température max",tempLo:"Température min",precip:"Précipitations",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:jt,default:Lt}),nl:Object.freeze({__proto__:null,temp:"temperatuur",tempHi:"Maximum temperatuur",tempLo:"Minimum temperatuur",precip:"Neerslag",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Wt,default:Ht}),ru:Object.freeze({__proto__:null,temp:"Температура",tempHi:"Температура макси",tempLo:"Температура ночью",precip:"Осадки",uPress:"гПа",uSpeed:"м/с",uPrecip:"мм",cardinalDirections:Ut,default:zt}),sv:Object.freeze({__proto__:null,temp:"Temperatur",tempHi:"Max temperatur",tempLo:"Min temperatur",precip:"Nederbörd",uPress:"hPa",uSpeed:"m/s",uPrecip:"mm",cardinalDirections:Rt,default:Yt})};function Ft(t,e="",i=""){const r=(localStorage.getItem("selectedLanguage")||"en").replace(/['"]+/g,"").replace("-","_");let n;try{n=t.split(".").reduce((t,e)=>t[e],It[r])}catch(e){n=t.split(".").reduce((t,e)=>t[e],It.en)}return void 0===n&&(n=t.split(".").reduce((t,e)=>t[e],It.en)),""!==e&&""!==i&&(n=n.replace(e,i)),n}const Bt=["entity","config"],qt=["mdi:arrow-down","mdi:arrow-bottom-left","mdi:arrow-left","mdi:arrow-top-left","mdi:arrow-up","mdi:arrow-top-right","mdi:arrow-right","mdi:arrow-bottom-right","mdi:arrow-down"],Zt={clear:"day","clear-night":"night",cloudy:"cloudy",fog:"cloudy",hail:"rainy-7",lightning:"thunder","lightning-rainy":"thunder",partlycloudy:"cloudy-day-3",pouring:"rainy-6",rainy:"rainy-5",snowy:"snowy-6","snowy-rainy":"rainy-7",sunny:"day",windy:"cloudy","windy-variant":"cloudy-day-3",exceptional:"!!"},Jt=Object.assign(Object.assign({},Zt),{clear:"night",sunny:"night",partlycloudy:"cloudy-night-3","windy-variant":"cloudy-night-3"});var Gt;!function(t){t[t.hourly=0]="hourly",t[t.daily=1]="daily"}(Gt||(Gt={}));var Kt;window.customCards=window.customCards||[],window.customCards.push({type:"weather-card",name:"Animated weather card",description:"Lovelace animated weather card"}),console.info(`%c WEATHER-CARD \n%c ${Ft("common.version")} 1.7.1 `,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: dimgray");let Qt=Kt=class extends it{constructor(){super(),this.numberElements=0,this.mode=Gt.daily,this.currentLanguage=(localStorage.getItem("selectedLanguage")||"en").replace(/['"]+/g,"")}static async getConfigElement(){return document.createElement("weather-card-editor")}setConfig(t){if(!t)throw new Error(Ft("common.invalid_configuration"));if(!t.entity)throw new Error(Ft("common.invalid_entity"));this.config=Object.assign({name:""},t),this.setWeatherObj()}setWeatherObj(){var t,e;if(!this.hass||!this.config.entity)return;if(this.weatherObj=this.config.entity in this.hass.states?this.hass.states[this.config.entity]:null,!this.weatherObj)return;if(!this.config.forecastMaxColumn||this.config.forecastMaxColumn<2?this.forecast=this.weatherObj.attributes.forecast.slice(0,9):this.forecast=this.weatherObj.attributes.forecast.slice(0,this.config.forecastMaxColumn),!Array.isArray(this.forecast))return;let i;if((null===(t=this.forecast)||void 0===t?void 0:t.length)&&(null===(e=this.forecast)||void 0===e?void 0:e.length)>2){const t=new Date(this.forecast[1].datetime);i=new Date(this.forecast[2].datetime).getTime()-t.getTime()<864e5,i&&(this.mode=Gt.hourly)}}shouldUpdate(t){return!this.weatherObj||Bt.some(e=>t.has(e))}updated(){this.setWeatherObj();const t=this.shadowRoot.querySelector("#Chart");t&&(t.data=this.chartData,t.hass=this.hass)}render(){return this.config&&this.hass?(this.setWeatherObj(),this.numberElements=0,this.weatherObj?j` ${!1!==this.config.current?this.renderCurrent():""} ${!1!==this.config.details?this.renderDetails():""} @@ -441,17 +441,9 @@ found at http://polymer.github.io/PATENTS.txt `):j``}_handleClick(){xt(this,"hass-more-info",{entityId:this.config.entity})}renderCurrent(){return this.numberElements++,this.weatherObj?j`
- ${this.weatherObj.state} - - ${this.config.name?j` - ${this.config.name} - `:""} - ${"°F"==this.getUnit("temperature")?Math.round(this.weatherObj.attributes.temperature):this.weatherObj.attributes.temperature} + ${this.weatherObj.state} + ${this.config.name?j` ${this.config.name} `:""} + ${"°F"==this.getUnit("temperature")?Math.round(this.weatherObj.attributes.temperature):this.weatherObj.attributes.temperature} ${this.getUnit("temperature")}
`:j``}renderDetails(){if(!this.weatherObj)return j``;const t=this.hass.states["sun.sun"];let e,i;return t&&(e=new Date(t.attributes.next_rising),i=new Date(t.attributes.next_setting)),this.numberElements++,j` @@ -461,11 +453,8 @@ found at http://polymer.github.io/PATENTS.txt ${this.weatherObj.attributes.humidity} %
  • - ${Gt.getWindDir(this.weatherObj.attributes.wind_bearing)} - + ${Kt.getWindDir(this.weatherObj.attributes.wind_bearing)} + ${this.weatherObj.attributes.wind_speed} ${this.getUnit("length")}/h${this.getWindForce()} @@ -473,15 +462,11 @@ found at http://polymer.github.io/PATENTS.txt
  • ${this.weatherObj.attributes.pressure} - - ${this.getUnit("air_pressure")} - + ${this.getUnit("air_pressure")}
  • ${this.weatherObj.attributes.visibility} - - ${this.getUnit("length")} - + ${this.getUnit("length")}
  • ${e?j` @@ -504,11 +489,8 @@ found at http://polymer.github.io/PATENTS.txt
    ${this.getDateString(t.datetime)}
    - -
    - ${t.temperature}${this.getUnit("temperature")} -
    + +
    ${t.temperature}${this.getUnit("temperature")}
    ${void 0!==t.templow?j`
    ${t.templow}${this.getUnit("temperature")} @@ -516,7 +498,12 @@ found at http://polymer.github.io/PATENTS.txt `:""} ${this.config.hidePrecipitation||void 0===t.precipitation||null===t.precipitation?"":j`
    - ${t.precipitation} ${this.getUnit("precipitation")} + ${Math.round(10*t.precipitation)/10} ${this.getUnit("precipitation")} +
    + `} + ${this.config.hidePrecipitation||void 0===t.precipitation_probability||null===t.precipitation_probability?"":j` +
    + ${Math.round(10*t.precipitation_probability)/10} ${this.getUnit("precipitation_probability")}
    `}
    @@ -527,7 +514,7 @@ found at http://polymer.github.io/PATENTS.txt
    - ${this.forecast.map(t=>j``)} + ${this.forecast.map(t=>j` + `)}
    - `):j``}drawChart(){if(!this.forecast)return;const t=[],e=[],i=[],r=[];for(let n=0;nthis.getDateString(t)}}],yAxes:[{id:"TempAxis",position:"left",gridLines:{display:!0,drawBorder:!1,color:a,borderDash:[1,3]},ticks:{display:!0,fontColor:s},afterFit:t=>{t.width=28}},{id:"PrecipAxis",position:"right",gridLines:{display:!1,drawBorder:!1,color:a},ticks:{display:!1,min:0,suggestedMax:20,fontColor:s},afterFit:t=>{t.width=15}}]},tooltips:{mode:"index",callbacks:{title:(t,e)=>{const i=t[0],r=e.labels[i.index];return new Date(r).toLocaleDateString(this.currentLanguage,{month:"long",day:"numeric",weekday:"long",hour:"numeric",minute:"numeric"})},label:(t,e)=>{const i=e.datasets[t.datasetIndex].label||"";return e.datasets[2].label===i?i+": "+(t.yLabel?t.yLabel+" "+this.getUnit("precipitation"):"0 "+this.getUnit("precipitation")):i+": "+t.yLabel+" "+this.getUnit("temperature")}}}}}}getWeatherIcon(t,e){return`${this.config.icons?this.config.icons:"https://cdn.jsdelivr.net/gh/MarcHagen/weather-card/dist/icons/"}${e&&"below_horizon"===e?Zt[t]:Bt[t]}.svg`}static getWindDirIcon(t){return qt[(t+22.5)/45]}static getWindDir(t){return It("cardinalDirections")[(t+11.25)/22.5]}getWindForce(){if("km"!==this.getUnit("length")||!this.weatherObj)return j``;const t=Math.ceil(Math.cbrt(Math.pow(this.weatherObj.attributes.wind_speed/3.6/.836,2)));return j` | ${t} Bft`}getUnit(t){const e=this.hass.config.unit_system.length;switch(t){case"air_pressure":return"km"===e?It("uPress"):"mbar";case"length":return e;case"precipitation":return"km"===e?It("uPrecip"):"in";case"intensity":return"km"===e?It("uPrecip")+"/h":"in/h";default:return this.hass.config.unit_system[t]||""}}getDateString(t){return this.mode===Jt.hourly?new Date(t).toLocaleTimeString(this.currentLanguage,{hour:"numeric"}):new Date(t).toLocaleDateString(this.currentLanguage,{weekday:"short"})}getCardSize(){return this.numberElements||3}static get styles(){return Pt}};t([J({attribute:!1})],Kt.prototype,"hass",void 0),t([J({attribute:!1})],Kt.prototype,"chartData",void 0),t([G()],Kt.prototype,"config",void 0),t([G()],Kt.prototype,"weatherObj",void 0),t([G()],Kt.prototype,"numberElements",void 0),Kt=Gt=t([B("weather-card")],Kt);export{Kt as WeatherCard}; + `):j``}drawChart(){if(!this.forecast)return;const t=[],e=[],i=[],r=[];for(let n=0;nthis.getDateString(t)}}],yAxes:[{id:"TempAxis",position:"left",gridLines:{display:!0,drawBorder:!1,color:a,borderDash:[1,3]},ticks:{display:!0,fontColor:s},afterFit:t=>{t.width=28}},{id:"PrecipAxis",position:"right",gridLines:{display:!1,drawBorder:!1,color:a},ticks:{display:!1,min:0,suggestedMax:20,fontColor:s},afterFit:t=>{t.width=15}}]},tooltips:{mode:"index",callbacks:{title:(t,e)=>{const i=t[0],r=e.labels[i.index];return new Date(r).toLocaleDateString(this.currentLanguage,{month:"long",day:"numeric",weekday:"long",hour:"numeric",minute:"numeric"})},label:(t,e)=>{const i=e.datasets[t.datasetIndex].label||"";return e.datasets[2].label===i?i+": "+(t.yLabel?t.yLabel+" "+this.getUnit("precipitation"):"0 "+this.getUnit("precipitation")):i+": "+t.yLabel+" "+this.getUnit("temperature")}}}}}}getWeatherIcon(t,e){return`${this.config.icons?this.config.icons:"https://cdn.jsdelivr.net/gh/MarcHagen/weather-card/dist/icons/"}${e&&"below_horizon"===e.state?Jt[t]:Zt[t]}.svg`}static getWindDirIcon(t){return qt[(t+22.5)/45]}static getWindDir(t){return Ft("cardinalDirections")[(t+11.25)/22.5]}getWindForce(){if("km"!==this.getUnit("length")||!this.weatherObj)return j``;const t=Math.ceil(Math.cbrt(Math.pow(this.weatherObj.attributes.wind_speed/3.6/.836,2)));return j` | ${t} Bft`}getUnit(t){const e=this.hass.config.unit_system.length;switch(t){case"air_pressure":return"km"===e?Ft("uPress"):"mbar";case"length":return e;case"precipitation":return"km"===e?Ft("uPrecip"):"in";case"intensity":return"km"===e?Ft("uPrecip")+"/h":"in/h";case"precipitation_probability":return"%";default:return this.hass.config.unit_system[t]||""}}getDateString(t){return this.mode===Gt.hourly?new Date(t).toLocaleTimeString(this.currentLanguage,{hour:"numeric"}):new Date(t).toLocaleDateString(this.currentLanguage,{weekday:"short"})}getCardSize(){return this.numberElements||3}static get styles(){return Pt}};t([J({attribute:!1})],Qt.prototype,"hass",void 0),t([J({attribute:!1})],Qt.prototype,"chartData",void 0),t([G()],Qt.prototype,"config",void 0),t([G()],Qt.prototype,"weatherObj",void 0),t([G()],Qt.prototype,"numberElements",void 0),Qt=Kt=t([q("weather-card")],Qt);export{Qt as WeatherCard};