UNPKG

x-weather

Version:

A collection of web components implementing portions of the OpenWeatherMap API.

1 lines 69.7 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["x-weather"]={})}(this,(function(e){"use strict";function t(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function r(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?n(i,!0).forEach((function(n){t(e,n,i[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):n(i).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function i(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}const a=new WeakMap,o=e=>"function"==typeof e&&a.has(e),s=void 0!==window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,u=(e,t,n=null)=>{for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}},c={},l={},d=`{{lit-${String(Math.random()).slice(2)}}}`,h=`\x3c!--${d}--\x3e`,p=new RegExp(`${d}|${h}`),m="$lit$";class f{constructor(e,t){this.parts=[],this.element=t;const n=[],r=[],i=document.createTreeWalker(t.content,133,null,!1);let a=0,o=-1,s=0;const{strings:u,values:{length:c}}=e;for(;s<c;){const e=i.nextNode();if(null!==e){if(o++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:n}=t;let r=0;for(let e=0;e<n;e++)g(t[e].name,m)&&r++;for(;r-- >0;){const t=u[s],n=v.exec(t)[2],r=n.toLowerCase()+m,i=e.getAttribute(r);e.removeAttribute(r);const a=i.split(p);this.parts.push({type:"attribute",index:o,name:n,strings:a}),s+=a.length-1}}"TEMPLATE"===e.tagName&&(r.push(e),i.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(d)>=0){const r=e.parentNode,i=t.split(p),a=i.length-1;for(let t=0;t<a;t++){let n,a=i[t];if(""===a)n=w();else{const e=v.exec(a);null!==e&&g(e[2],m)&&(a=a.slice(0,e.index)+e[1]+e[2].slice(0,-m.length)+e[3]),n=document.createTextNode(a)}r.insertBefore(n,e),this.parts.push({type:"node",index:++o})}""===i[a]?(r.insertBefore(w(),e),n.push(e)):e.data=i[a],s+=a}}else if(8===e.nodeType)if(e.data===d){const t=e.parentNode;null!==e.previousSibling&&o!==a||(o++,t.insertBefore(w(),e)),a=o,this.parts.push({type:"node",index:o}),null===e.nextSibling?e.data="":(n.push(e),o--),s++}else{let t=-1;for(;-1!==(t=e.data.indexOf(d,t+1));)this.parts.push({type:"node",index:-1}),s++}}else i.currentNode=r.pop()}for(const e of n)e.parentNode.removeChild(e)}}const g=(e,t)=>{const n=e.length-t.length;return n>=0&&e.slice(n)===t},y=e=>-1!==e.index,w=()=>document.createComment(""),v=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;class b{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=s?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let i,a=0,o=0,u=r.nextNode();for(;a<n.length;)if(i=n[a],y(i)){for(;o<i.index;)o++,"TEMPLATE"===u.nodeName&&(t.push(u),r.currentNode=u.content),null===(u=r.nextNode())&&(r.currentNode=t.pop(),u=r.nextNode());if("node"===i.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(u.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(u,i.name,i.strings,this.options));a++}else this.__parts.push(void 0),a++;return s&&(document.adoptNode(e),customElements.upgrade(e)),e}}const S=` ${d} `;class x{constructor(e,t,n,r){this.strings=e,this.values=t,this.type=n,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",n=!1;for(let r=0;r<e;r++){const e=this.strings[r],i=e.lastIndexOf("\x3c!--");n=(i>-1||n)&&-1===e.indexOf("--\x3e",i+1);const a=v.exec(e);t+=null===a?e+(n?S:h):e.substr(0,a.index)+a[1]+a[2]+m+a[3]+d}return t+=this.strings[e]}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}const _=e=>null===e||!("object"==typeof e||"function"==typeof e),T=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class C{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e<n.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new E(this)}_getValue(){const e=this.strings,t=e.length-1;let n="";for(let r=0;r<t;r++){n+=e[r];const t=this.parts[r];if(void 0!==t){const e=t.value;if(_(e)||!T(e))n+="string"==typeof e?e:String(e);else for(const t of e)n+="string"==typeof t?t:String(t)}}return n+=e[t]}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class E{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===c||_(e)&&e===this.value||(this.value=e,o(e)||(this.committer.dirty=!0))}commit(){for(;o(this.value);){const e=this.value;this.value=c,e(this)}this.value!==c&&this.committer.commit()}}class P{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(w()),this.endNode=e.appendChild(w())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=w()),e.__insert(this.endNode=w())}insertAfterPart(e){e.__insert(this.startNode=w()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){for(;o(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=c,e(this)}const e=this.__pendingValue;e!==c&&(_(e)?e!==this.value&&this.__commitText(e):e instanceof x?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):T(e)?this.__commitIterable(e):e===l?(this.value=l,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,n="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=n:this.__commitNode(document.createTextNode(n)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof b&&this.value.template===t)this.value.update(e.values);else{const n=new b(t,e.processor,this.options),r=n._clone();n.update(e.values),this.__commitNode(r),this.value=n}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let n,r=0;for(const i of e)void 0===(n=t[r])&&(n=new P(this.options),t.push(n),0===r?n.appendIntoPart(this):n.insertAfterPart(t[r-1])),n.setValue(i),n.commit(),r++;r<t.length&&(t.length=r,this.clear(n&&n.endNode))}clear(e=this.startNode){u(this.startNode.parentNode,e.nextSibling,this.endNode)}}class O{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;o(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=c,e(this)}if(this.__pendingValue===c)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=c}}class N extends C{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new M(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class M extends E{}let k=!1;try{const e={get capture(){return k=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}class A{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;o(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=c,e(this)}if(this.__pendingValue===c)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),r=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=U(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=c}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const U=e=>e&&(k?{capture:e.capture,passive:e.passive,once:e.once}:e.capture);const j=new class{handleAttributeExpressions(e,t,n,r){const i=t[0];if("."===i){return new N(e,t.slice(1),n).parts}return"@"===i?[new A(e,t.slice(1),r.eventContext)]:"?"===i?[new O(e,t.slice(1),n)]:new C(e,t,n).parts}handleTextExpression(e){return new P(e)}};function D(e){let t=R.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},R.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const r=e.strings.join(d);return void 0===(n=t.keyString.get(r))&&(n=new f(e,e.getTemplateElement()),t.keyString.set(r,n)),t.stringsArray.set(e.strings,n),n}const R=new Map,W=new WeakMap;(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.1.2");const q=(e,...t)=>new x(e,t,"html",j),I=133;function z(e,t){const{element:{content:n},parts:r}=e,i=document.createTreeWalker(n,I,null,!1);let a=Y(r),o=r[a],s=-1,u=0;const c=[];let l=null;for(;i.nextNode();){s++;const e=i.currentNode;for(e.previousSibling===l&&(l=null),t.has(e)&&(c.push(e),null===l&&(l=e)),null!==l&&u++;void 0!==o&&o.index===s;)o.index=null!==l?-1:o.index-u,o=r[a=Y(r,a)]}c.forEach(e=>e.parentNode.removeChild(e))}const F=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,I,null,!1);for(;n.nextNode();)t++;return t},Y=(e,t=-1)=>{for(let n=t+1;n<e.length;n++){const t=e[n];if(y(t))return n}return-1};const L=(e,t)=>`${e}--${t}`;let V=!0;void 0===window.ShadyCSS?V=!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."),V=!1);const H=e=>t=>{const n=L(t.type,e);let r=R.get(n);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},R.set(n,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const a=t.strings.join(d);if(void 0===(i=r.keyString.get(a))){const n=t.getTemplateElement();V&&window.ShadyCSS.prepareTemplateDom(n,e),i=new f(t,n),r.keyString.set(a,i)}return r.stringsArray.set(t.strings,i),i},B=["html","svg"],X=new Set,G=(e,t,n)=>{X.add(e);const r=n?n.element:document.createElement("template"),i=t.querySelectorAll("style"),{length:a}=i;if(0===a)return void window.ShadyCSS.prepareTemplateStyles(r,e);const o=document.createElement("style");for(let e=0;e<a;e++){const t=i[e];t.parentNode.removeChild(t),o.textContent+=t.textContent}(e=>{B.forEach(t=>{const n=R.get(L(t,e));void 0!==n&&n.keyString.forEach(e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{n.add(e)}),z(e,n)})})})(e);const s=r.content;n?function(e,t,n=null){const{element:{content:r},parts:i}=e;if(null==n)return void r.appendChild(t);const a=document.createTreeWalker(r,I,null,!1);let o=Y(i),s=0,u=-1;for(;a.nextNode();){for(u++,a.currentNode===n&&(s=F(t),n.parentNode.insertBefore(t,n));-1!==o&&i[o].index===u;){if(s>0){for(;-1!==o;)i[o].index+=s,o=Y(i,o);return}o=Y(i,o)}}}(n,o,s.firstChild):s.insertBefore(o,s.firstChild),window.ShadyCSS.prepareTemplateStyles(r,e);const u=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==u)t.insertBefore(u.cloneNode(!0),t.firstChild);else if(n){s.insertBefore(o,s.firstChild);const e=new Set;e.add(o),z(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const Q={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},J=(e,t)=>t!==e&&(t==t||e==e),$={attribute:!0,type:String,converter:Q,reflect:!1,hasChanged:J},K=Promise.resolve(!0),Z=1,ee=4,te=8,ne=16,re=32,ie="finalized";class ae extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=K,this._hasConnectedResolver=void 0,this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,n)=>{const r=this._attributeNameForProperty(n,t);void 0!==r&&(this._attributeToPropertyMap.set(r,n),e.push(r))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=$){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():`__${e}`;Object.defineProperty(this.prototype,e,{get(){return this[n]},set(t){const r=this[e];this[n]=t,this._requestUpdate(e,r)},configurable:!0,enumerable:!0})}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(ie)||e.finalize(),this[ie]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,n=J){return n(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,r=t.converter||Q,i="function"==typeof r?r:r.fromAttribute;return i?i(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,r=t.converter;return(r&&r.toAttribute||Q.toAttribute)(e,n)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this._updateState=this._updateState|re,this._hasConnectedResolver&&(this._hasConnectedResolver(),this._hasConnectedResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t,n=$){const r=this.constructor,i=r._attributeNameForProperty(e,n);if(void 0!==i){const e=r._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=this._updateState|te,null==e?this.removeAttribute(i):this.setAttribute(i,e),this._updateState=this._updateState&~te}}_attributeToProperty(e,t){if(this._updateState&te)return;const n=this.constructor,r=n._attributeToPropertyMap.get(e);if(void 0!==r){const e=n._classProperties.get(r)||$;this._updateState=this._updateState|ne,this[r]=n._propertyValueFromAttribute(t,e),this._updateState=this._updateState&~ne}}_requestUpdate(e,t){let n=!0;if(void 0!==e){const r=this.constructor,i=r._classProperties.get(e)||$;r._valueHasChanged(this[e],t,i.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==i.reflect||this._updateState&ne||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,i))):n=!1}!this._hasRequestedUpdate&&n&&this._enqueueUpdate()}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){let e,t;this._updateState=this._updateState|ee;const n=this._updatePromise;this._updatePromise=new Promise((n,r)=>{e=n,t=r});try{await n}catch(e){}this._hasConnected||await new Promise(e=>this._hasConnectedResolver=e);try{const e=this.performUpdate();null!=e&&await e}catch(e){t(e)}e(!this._hasRequestedUpdate)}get _hasConnected(){return this._updateState&re}get _hasRequestedUpdate(){return this._updateState&ee}get hasUpdated(){return this._updateState&Z}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{(e=this.shouldUpdate(t))&&this.update(t)}catch(t){throw e=!1,t}finally{this._markUpdated()}e&&(this._updateState&Z||(this._updateState=this._updateState|Z,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~ee}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0)}updated(e){}firstUpdated(e){}}ae[ie]=!0;const oe="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,se=Symbol();class ue{constructor(e,t){if(t!==se)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(oe?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const ce=(e,...t)=>{const n=t.reduce((t,n,r)=>t+(e=>{if(e instanceof ue)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(n)+e[r+1],e[0]);return new ue(n,se)};(window.litElementVersions||(window.litElementVersions=[])).push("2.2.1");const le=e=>e.flat?e.flat(1/0):function e(t,n=[]){for(let r=0,i=t.length;r<i;r++){const i=t[r];Array.isArray(i)?e(i,n):n.push(i)}return n}(e);class de extends ae{static finalize(){super.finalize.call(this),this._styles=this.hasOwnProperty(JSCompiler_renameProperty("styles",this))?this._getUniqueStyles():this._styles||[]}static _getUniqueStyles(){const e=this.styles,t=[];if(Array.isArray(e)){le(e).reduceRight((e,t)=>(e.add(t),e),new Set).forEach(e=>t.unshift(e))}else e&&t.push(e);return t}initialize(){super.initialize(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?oe?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){super.update(e);const t=this.render();t instanceof x&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){}}de.finalized=!0,de.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const r=n.scopeName,i=W.has(t),a=V&&11===t.nodeType&&!!t.host,o=a&&!X.has(r),s=o?document.createDocumentFragment():t;if(((e,t,n)=>{let r=W.get(t);void 0===r&&(u(t,t.firstChild),W.set(t,r=new P(Object.assign({templateFactory:D},n))),r.appendInto(t)),r.setValue(e),r.commit()})(e,s,Object.assign({templateFactory:H(r)},n)),o){const e=W.get(s);W.delete(s);const n=e.value instanceof b?e.value.template:void 0;G(r,s,n),u(t,t.firstChild),t.appendChild(s),W.set(t,e)}!i&&a&&window.ShadyCSS.styleElement(t.host)};const he=e=>t=>(class extends t{connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._storeUnsubscribe=e.subscribe(()=>this.stateChanged(e.getState())),this.stateChanged(e.getState())}disconnectedCallback(){this._storeUnsubscribe(),super.disconnectedCallback&&super.disconnectedCallback()}stateChanged(e){}});var pe=function(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof module?module:Function("return this")()),me=function(){return Math.random().toString(36).substring(7).split("").join(".")},fe={INIT:"@@redux/INIT"+me(),REPLACE:"@@redux/REPLACE"+me(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+me()}};function ge(e,t,n){var r;if("function"==typeof t&&"function"==typeof n||"function"==typeof n&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(ge)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var i=e,a=t,o=[],s=o,u=!1;function c(){s===o&&(s=o.slice())}function l(){if(u)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function d(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(u)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return c(),s.push(e),function(){if(t){if(u)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,c();var n=s.indexOf(e);s.splice(n,1)}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(u)throw new Error("Reducers may not dispatch actions.");try{u=!0,a=i(a,e)}finally{u=!1}for(var t=o=s,n=0;n<t.length;n++){(0,t[n])()}return e}return h({type:fe.INIT}),(r={dispatch:h,subscribe:d,getState:l,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");i=e,h({type:fe.REPLACE})}})[pe]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(l())}return n(),{unsubscribe:t(n)}}})[pe]=function(){return this},e},r}function ye(e,t){var n=t&&t.type;return"Given "+(n&&'action "'+String(n)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function we(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var i=t[r];"function"==typeof e[i]&&(n[i]=e[i])}var a,o=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(void 0===n(void 0,{type:fe.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:fe.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+fe.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(n)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var r=!1,i={},s=0;s<o.length;s++){var u=o[s],c=n[u],l=e[u],d=c(l,t);if(void 0===d){var h=ye(u,t);throw new Error(h)}i[u]=d,r=r||d!==l}return r?i:e}}function ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function be(e,t){var n=Object.keys(e);return Object.getOwnPropertySymbols&&n.push.apply(n,Object.getOwnPropertySymbols(e)),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n}function Se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?be(n,!0).forEach((function(t){ve(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):be(n).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce((function(e,t){return function(){return e(t.apply(void 0,arguments))}}))}function _e(e){return function(t){var n=t.dispatch,r=t.getState;return function(t){return function(i){return"function"==typeof i?i(n,r,e):t(i)}}}}var Te=_e();Te.withExtraArgument=_e;var Ce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"cToF",n=e=>e+273.15,r=e=>e-273.15,i=e=>1.8*e+32,a=e=>5*(e-32)/9;return{cToK:n,kToC:r,cToF:i,fToC:a,kToF:e=>i(r(e)),fToK:e=>n(a(e))}[t](e)};function Ee(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var Pe="object"==typeof global&&global&&global.Object===Object&&global,Oe="object"==typeof self&&self&&self.Object===Object&&self,Ne=Pe||Oe||Function("return this")(),Me=function(){return Ne.Date.now()},ke=Ne.Symbol,Ae=Object.prototype,Ue=Ae.hasOwnProperty,je=Ae.toString,De=ke?ke.toStringTag:void 0;var Re=Object.prototype.toString;var We="[object Null]",qe="[object Undefined]",Ie=ke?ke.toStringTag:void 0;function ze(e){return null==e?void 0===e?qe:We:Ie&&Ie in Object(e)?function(e){var t=Ue.call(e,De),n=e[De];try{e[De]=void 0;var r=!0}catch(e){}var i=je.call(e);return r&&(t?e[De]=n:delete e[De]),i}(e):function(e){return Re.call(e)}(e)}var Fe="[object Symbol]";var Ye=NaN,Le=/^\s+|\s+$/g,Ve=/^[-+]0x[0-9a-f]+$/i,He=/^0b[01]+$/i,Be=/^0o[0-7]+$/i,Xe=parseInt;function Ge(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&ze(e)==Fe}(e))return Ye;if(Ee(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ee(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Le,"");var n=He.test(e);return n||Be.test(e)?Xe(e.slice(2),n?2:8):Ve.test(e)?Ye:+e}var Qe="Expected a function",Je=Math.max,$e=Math.min;function Ke(e,t,n){var r,i,a,o,s,u,c=0,l=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError(Qe);function p(t){var n=r,a=i;return r=i=void 0,c=t,o=e.apply(a,n)}function m(e){var n=e-u;return void 0===u||n>=t||n<0||d&&e-c>=a}function f(){var e=Me();if(m(e))return g(e);s=setTimeout(f,function(e){var n=t-(e-u);return d?$e(n,a-(e-c)):n}(e))}function g(e){return s=void 0,h&&r?p(e):(r=i=void 0,o)}function y(){var e=Me(),n=m(e);if(r=arguments,i=this,u=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(f,t),l?p(e):o}(u);if(d)return clearTimeout(s),s=setTimeout(f,t),p(u)}return void 0===s&&(s=setTimeout(f,t)),o}return t=Ge(t)||0,Ee(n)&&(l=!!n.leading,a=(d="maxWait"in n)?Je(Ge(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=u=i=s=void 0},y.flush=function(){return void 0===s?o:g(Me())},y}var Ze="Expected a function";var et=(e,t)=>(function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e,r=arguments.length>1?arguments[1]:void 0;return!0===t.hasOwnProperty(r.type)?t[r.type](n,r):n}),tt=we({current:et({},{CURRENT_WEATHER_UPDATE(e,t){var{payload:n}=t;return r({},e,{},n)}}),forecast:et({},{FORECAST_WEATHER_UPDATE(e,t){var{payload:n}=t;return r({},e,{},n)}}),preferences:et({},{LOCATION_UPDATE(e,t){var{payload:n}=t;return r({},e,{location:r({},e.location,{},n)})},PRIMARY_SCALE_FORECAST_SWAP(e,t){var{payload:n}=t;return r({},e,{primaryScaleForecast:n})},PRIMARY_SCALE_CURRENT_SWAP(e,t){var{payload:n}=t;return r({},e,{primaryScaleCurrent:n})}})}),nt=we({weather:tt}),rt=(e=>ge(nt,e,xe(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(){var n=e.apply(void 0,arguments),r=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},i={getState:n.getState,dispatch:function(){return r.apply(void 0,arguments)}},a=t.map((function(e){return e(i)}));return Se({},n,{dispatch:r=xe.apply(void 0,a)(n.dispatch)})}}}(Te))))(r({},{weather:{current:{iconAlt:"shower rain",iconSrc:"09d",temperature:{kelvin:283.4,celsius:10.25,fahrenheit:50.45},timestamp:1570576970,sunrise:1570543089,sunset:1570583768,timezone:-25200},forecast:{0:{dt:1570518e3,sunrise:1570543089,sunset:1570583768,temp:{day:10.25,min:10.25,max:10.25,night:10.25,eve:10.25,morn:10.25},pressure:1007,humidity:34,weather:[{id:801,main:"Clouds",description:"few clouds",icon:"02d"}],speed:7.062,deg:253,clouds:17},1:{dt:1570604400,sunrise:1570629574,sunset:1570670049,temp:{day:3.16,min:-1.65,max:8.94,night:2.75,eve:-1.65,morn:8.94},pressure:1014,humidity:87,weather:[{id:600,main:"Snow",description:"light snow",icon:"13d"}],speed:1.939,deg:266,clouds:100,rain:1.69,snow:1.31},2:{dt:1570690800,sunrise:1570716059,sunset:1570756331,temp:{day:-.04,min:-2.25,max:5.63,night:4.9,eve:-2.25,morn:5.63},pressure:1032,humidity:41,weather:[{id:800,main:"Clear",description:"sky is clear",icon:"01n"}],speed:.785,deg:159,clouds:0},3:{dt:1570777200,sunrise:1570802544,sunset:1570842614,temp:{day:1.09,min:-1.13,max:6.52,night:5.33,eve:-1.13,morn:6.52},pressure:1031,humidity:50,weather:[{id:800,main:"Clear",description:"sky is clear",icon:"01n"}],speed:1.571,deg:86,clouds:0},4:{dt:1570863600,sunrise:1570889029,sunset:1570928897,temp:{day:3.67,min:.82,max:9.36,night:7.98,eve:.82,morn:9.36},pressure:1022,humidity:52,weather:[{id:801,main:"Clouds",description:"few clouds",icon:"02n"}],speed:1.647,deg:59,clouds:25},5:{dt:157095e4,sunrise:1570975515,sunset:1571015182,temp:{day:6.19,min:5.06,max:10.74,night:5.47,eve:5.06,morn:10.74},pressure:1013,humidity:54,weather:[{id:500,main:"Rain",description:"light rain",icon:"10d"}],speed:.761,deg:220,clouds:100,rain:.25},6:{dt:1571036400,sunrise:1571062001,sunset:1571101467,temp:{day:6.06,min:4.65,max:10.79,night:10.79,eve:4.65,morn:8.15},pressure:1015,humidity:68,weather:[{id:804,main:"Clouds",description:"overcast clouds",icon:"04n"}],speed:1.532,deg:178,clouds:87},7:{dt:1571122800,sunrise:1571148488,sunset:1571187753,temp:{day:6.17,min:3.96,max:11.51,night:10.36,eve:3.99,morn:11.51},pressure:1020,humidity:72,weather:[{id:800,main:"Clear",description:"sky is clear",icon:"01n"}],speed:1.499,deg:77,clouds:0},8:{dt:1571209200,sunrise:1571234975,sunset:1571274040,temp:{day:9.94,min:7.41,max:13.26,night:12.95,eve:7.41,morn:13.26},pressure:1016,humidity:56,weather:[{id:804,main:"Clouds",description:"overcast clouds",icon:"04n"}],speed:1.271,deg:136,clouds:100},9:{dt:1571295600,sunrise:1571321462,sunset:1571360327,temp:{day:11.68,min:8.71,max:14.91,night:8.71,eve:9.68,morn:14.91},pressure:1002,humidity:50,weather:[{id:500,main:"Rain",description:"light rain",icon:"10d"}],speed:.799,deg:89,clouds:100,rain:1.5},10:{dt:1571382e3,sunrise:1571407950,sunset:1571446616,temp:{day:6.12,min:5.25,max:11.14,night:7.79,eve:6.05,morn:11.14},pressure:1002,humidity:70,weather:[{id:500,main:"Rain",description:"light rain",icon:"10d"}],speed:3.418,deg:185,clouds:26,rain:2.81},11:{dt:1571468400,sunrise:1571494438,sunset:1571532906,temp:{day:4.85,min:3.01,max:8.77,night:6.1,eve:4.15,morn:8.77},pressure:1006,humidity:71,weather:[{id:804,main:"Clouds",description:"overcast clouds",icon:"04n"}],speed:1.632,deg:180,clouds:86},12:{dt:1571554800,sunrise:1571580927,sunset:1571619196,temp:{day:6.24,min:5.19,max:8.67,night:5.32,eve:5.27,morn:8.67},pressure:1019,humidity:70,weather:[{id:501,main:"Rain",description:"moderate rain",icon:"10d"}],speed:3.716,deg:192,clouds:100,rain:9.94},13:{dt:1571641200,sunrise:1571667415,sunset:1571705488,temp:{day:12.68,min:11.2,max:14.27,night:14.25,eve:14.27,morn:11.2},pressure:1014,humidity:84,weather:[{id:804,main:"Clouds",description:"overcast clouds",icon:"04n"}],speed:7.944,deg:222,clouds:100}},preferences:{primaryScaleCurrent:"f",primaryScaleForecast:"f",location:{latitude:47.62,longitude:-117.43,placename:"Spokane, Washington"},locations:[{latitude:42.35,longitude:-83.06,placename:"Detroit, Michigan"},{latitude:33.43,longitude:-112.11,placename:"Phoenix, Arizona"},{latitude:42.57,longitude:-84.42,placename:"Mason, Michigan"},{latitude:47.62,longitude:-117.43,placename:"Spokane, Washington"},{latitude:41.4081,longitude:-92.9164,placename:"Pella, Iowa"},{latitude:43.6834,longitude:-80.433,placename:"Elora, Ontario"},{latitude:43.5501,longitude:-80.2497,placename:"Guelph, Ontario"},{latitude:37.6597,longitude:-97.5754,placename:"Wichita, Kansas"},{latitude:52.1058,longitude:-101.2676,placename:"Swan River, Manitoba"},{latitude:44.4001,longitude:-79.6664,placename:"Barrie, Ontario"},{latitude:49.8844,longitude:-97.1471,placename:"Winnipeg, Manitoba"},{latitude:41.6834,longitude:-86.2501,placename:"South Bend, Indiana"},{latitude:40.0379,longitude:-76.3056,placename:"Lancaster, Pennsylvania"}]}}},{},(()=>{try{var e=localStorage.getItem("x-weather-state");if(null===e)return;return JSON.parse(e)}catch(e){return}})()));rt.subscribe(function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new TypeError(Ze);return Ee(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Ke(e,t,{leading:r,maxWait:t,trailing:i})}(()=>{(e=>{try{var t=JSON.stringify(e);localStorage.setItem("x-weather-state",t)}catch(e){}})(rt.getState())},1e3));var it=e=>{var{appid:t,host:n,latitude:r,longitude:i,placename:a}=e;if(t&&n&&r&&i&&a)return(e=>{var{appid:t,host:n,latitude:r,longitude:i,placename:a}=e,o="https://".concat(n,"/data/2.5/weather?lat=").concat(r,"&lon=").concat(i,"&appid=").concat(t);return fetch(o,{method:"GET"}).then(e=>{if(e.ok)return e.json()})})({appid:t,host:n,latitude:r,longitude:i,placename:a}).then(e=>{if(!e)throw new Error("failed to get result from the current weather service using: appid: ".concat(t,", host: ").concat(n,", latitude: ").concat(r,", longitude: ").concat(i,", placename: ").concat(a));var{coord:o,weather:s,base:u,main:c,visibility:l,wind:d,clouds:h,dt:p,sys:m,timezone:f,id:g,name:y,cod:w}=e;return JSON.stringify({sunrise:m.sunrise,sunset:m.sunset,timezone:f,iconAlt:s[0].description,iconSrc:s[0].icon,temperature:{kelvin:c.temp,celsius:Ce(c.temp,"kToC"),fahrenheit:Ce(c.temp,"kToF")},timestamp:p})})},at=e=>{var{appid:t,host:n}=e;return(e,r)=>{var{latitude:i,longitude:a,placename:o}=r().weather.preferences.location;return it({appid:t,host:n,latitude:i,longitude:a,placename:o}).then(t=>{t.length>0&&e((e=>{var{json:t}=e;return{type:"CURRENT_WEATHER_UPDATE",payload:JSON.parse(t)}})({json:t}))})}},ot=e=>{var{appid:t,host:n,latitude:r,longitude:i,placename:a}=e;if(t&&n&&r&&i&&a)return(e=>{var{appid:t,host:n,latitude:r,longitude:i,placename:a}=e,o="https://".concat(n,"/data/2.5/forecast/daily?lat=").concat(r,"&lon=").concat(i,"&mode=json&units=metric&cnt=14&appid=").concat(t);return fetch(o,{method:"GET"}).then(e=>{if(e.ok)return e.json()})})({appid:t,host:n,latitude:r,longitude:i,placename:a}).then(e=>{if(!e)throw new Error("failed to get result from the forecast weather service using: appid: ".concat(t,", host: ").concat(n,", latitude: ").concat(r,", longitude: ").concat(i,", placename: ").concat(a));var{city:o,cod:s,message:u,cnt:c,list:l}=e;return JSON.stringify(l)})},st=e=>{var{appid:t,host:n}=e;return(e,r)=>{var{latitude:i,longitude:a,placename:o}=r().weather.preferences.location;return ot({appid:t,host:n,latitude:i,longitude:a,placename:o}).then(t=>{t.length>0&&e((e=>{var{json:t}=e;return{type:"FORECAST_WEATHER_UPDATE",payload:JSON.parse(t)}})({json:t}))})}};function ut(){var e=i(['\n <ul>\n <li>\n <slot name="x-date-time"></slot>\n </li>\n <li>\n <slot name="x-weather-item-temperature"></slot>\n </li>\n <li>\n <img alt="','" src="','"></img>\n </li>\n </ul>\n ']);return ut=function(){return e},e}function ct(){var e=i(["\n :host {\n display: block;\n }\n\n img {\n display: var(--x-weather-item-icon-display, block);\n height: var(--x-weather-item-icon-height, 7.5rem);\n margin: var(--x-weather-item-icon-margin, auto);\n width: var(--x-weather-item-icon-width, 7.5rem);\n }\n\n ul {\n list-style-type: none;\n padding: 0;\n }\n\n ul > li {\n text-align: center;\n }\n "]);return ct=function(){return e},e}function lt(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=Object.prototype.toString.call(e);return e instanceof Date||"object"==typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"==typeof e||"[object Number]"===t?new Date(e):("string"!=typeof e&&"[object String]"!==t||"undefined"==typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}function dt(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}customElements.get("x-weather-item")||customElements.define("x-weather-item",class extends de{static get styles(){return ce(ct())}static get properties(){return{datetime:{type:Number},iconalt:{type:String},iconsrc:{type:String}}}render(){var e="https://openweathermap.org/themes/openweathermap/assets/vendor/owm/img/widgets/".concat(this.iconsrc,".png");return q(ut(),this.iconalt,e)}});var ht=6e4;var pt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function mt(e){return function(t){var n=t||{},r=n.width?String(n.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}var ft={date:mt({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:mt({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:mt({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},gt={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function yt(e){return function(t,n){var r,i=n||{};if("formatting"===(i.context?String(i.context):"standalone")&&e.formattingValues){var a=e.defaultFormattingWidth||e.defaultWidth,o=i.width?String(i.width):a;r=e.formattingValues[o]||e.formattingValues[a]}else{var s=e.defaultWidth,u=i.width?String(i.width):e.defaultWidth;r=e.values[u]||e.values[s]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function wt(e){return function(t,n){var r=String(t),i=n||{},a=i.width,o=a&&e.matchPatterns[a]||e.matchPatterns[e.defaultMatchWidth],s=r.match(o);if(!s)return null;var u,c=s[0],l=a&&e.parsePatterns[a]||e.parsePatterns[e.defaultParseWidth];return u="[object Array]"===Object.prototype.toString.call(l)?l.findIndex((function(e){return e.test(r)})):function(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}(l,(function(e){return e.test(r)})),u=e.valueCallback?e.valueCallback(u):u,{value:u=i.valueCallback?i.valueCallback(u):u,rest:r.slice(c.length)}}}var vt,bt={formatDistance:function(e,t,n){var r;return n=n||{},r="string"==typeof pt[e]?pt[e]:1===t?pt[e].one:pt[e].other.replace("{{count}}",t),n.addSuffix?n.comparison>0?"in "+r:r+" ago":r},formatLong:ft,formatRelative:function(e,t,n,r){return gt[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:yt({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:yt({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return Number(e)-1}}),month:yt({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:yt({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:yt({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(vt={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e,t){var n=String(e),r=t||{},i=n.match(vt.matchPattern);if(!i)return null;var a=i[0],o=n.match(vt.parsePattern);if(!o)return null;var s=vt.valueCallback?vt.valueCallback(o[0]):o[0];return{value:s=r.valueCallback?r.valueCallback(s):s,rest:n.slice(a.length)}}),era:wt({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:wt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:wt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:wt({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:wt({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function St(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");return function(e,t){if(arguments.length<2)throw new TypeError("2 arguments required, but only "+arguments.length+" present");var n=lt(e).getTime(),r=dt(t);return new Date(n+r)}(e,-dt(t))}function xt(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length<t;)r="0"+r;return n+r}var _t=function(e,t){var n=e.getUTCFullYear(),r=n>0?n:1-n;return xt("yy"===t?r%100:r,t.length)},Tt=function(e,t){var n=e.getUTCMonth();return"M"===t?String(n+1):xt(n+1,2)},Ct=function(e,t){return xt(e.getUTCDate(),t.length)},Et=function(e,t){return xt(e.getUTCHours()%12||12,t.length)},Pt=function(e,t){return xt(e.getUTCHours(),t.length)},Ot=function(e,t){return xt(e.getUTCMinutes(),t.length)},Nt=function(e,t){return xt(e.getUTCSeconds(),t.length)},Mt=function(e,t){var n=t.length,r=e.getUTCMilliseconds();return xt(Math.floor(r*Math.pow(10,n-3)),t.length)},kt=864e5;function At(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=lt(e),n=t.getUTCDay(),r=(n<1?7:0)+n-1;return t.setUTCDate(t.getUTCDate()-r),t.setUTCHours(0,0,0,0),t}function Ut(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=lt(e),n=t.getUTCFullYear(),r=new Date(0);r.setUTCFullYear(n+1,0,4),r.setUTCHours(0,0,0,0);var i=At(r),a=new Date(0);a.setUTCFullYear(n,0,4),a.setUTCHours(0,0,0,0);var o=At(a);return t.getTime()>=i.getTime()?n+1:t.getTime()>=o.getTime()?n:n-1}var jt=6048e5;function Dt(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=lt(e),n=At(t).getTime()-function(e){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var t=Ut(e),n=new Date(0);return n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0),At(n)}(t).getTime();return Math.round(n/jt)+1}function Rt(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var n=t||{},r=n.locale,i=r&&r.options&&r.options.weekStartsOn,a=null==i?0:dt(i),o=null==n.weekStartsOn?a:dt(n.weekStartsOn);if(!(o>=0&&o<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var s=lt(e),u=s.getUTCDay(),c=(u<o?7:0)+u-o;return s.setUTCDate(s.getUTCDate()-c),s.setUTCHours(0,0,0,0),s}function Wt(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var n=lt(e,t),r=n.getUTCFullYear(),i=t||{},a=i.locale,o=a&&a.options&&a.options.firstWeekContainsDate,s=null==o?1:dt(o),u=null==i.firstWeekContainsDate?s:dt(i.firstWeekContainsDate);if(!(u>=1&&u<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var c=new Date(0);c.setUTCFullYear(r+1,0,u),c.setUTCHours(0,0,0,0);var l=Rt(c,t),d=new Date(0);d.setUTCFullYear(r,0,u),d.setUTCHours(0,0,0,0);var h=Rt(d,t);return n.getTime()>=l.getTime()?r+1:n.getTime()>=h.getTime()?r:r-1}var qt=6048e5;function It(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var n=lt(e),r=Rt(n,t).getTime()-function(e,t){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");var n=t||{},r=n.locale,i=r&&r.options&&r.options.firstWeekContainsDate,a=null==i?1:dt(i),o=null==n.firstWeekContainsDate?a:dt(n.firstWeekContainsDate),s=Wt(e,t),u=new Date(0);return u.setUTCFullYear(s,0,o),u.setUTCHours(0,0,0,0),Rt(u,t)}(n,t).getTime();return Math.round(r/qt)+1}var zt="midnight",Ft="noon",Yt="morning",Lt="afternoon",Vt="evening",Ht=