UNPKG

origami-zen

Version:

Collection of reusable web components. Built for Origami CMS.

10 lines (9 loc) 26.6 kB
function __decorate(e,t,a,n){var o,s=arguments.length,_=3>s?t:null===n?n=Object.getOwnPropertyDescriptor(t,a):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)_=Reflect.decorate(e,t,a,n);else for(var p=e.length-1;0<=p;p--)(o=e[p])&&(_=(3>s?o(_):3<s?o(t,a,_):o(t,a))||_);return 3<s&&_&&Object.defineProperty(t,a,_),_}function __metadata(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}window.JSCompiler_renameProperty=function(e){return e};let dedupeId=0;const dedupingMixin=function(e){function t(t){let r=t.__mixinSet;if(r&&r[n])return t;let o=a,i=o.get(t);i||(i=e(t),o.set(t,i));let d=Object.create(i.__mixinSet||r||null);return d[n]=!0,i.__mixinSet=d,i}let a=e.__mixinApplications;a||(a=new WeakMap,e.__mixinApplications=a);let n=dedupeId++;return t};let microtaskCurrHandle=0,microtaskLastHandle=0,microtaskCallbacks=[],microtaskNodeContent=0,microtaskNode=document.createTextNode("");new window.MutationObserver(microtaskFlush).observe(microtaskNode,{characterData:!0});function microtaskFlush(){const e=microtaskCallbacks.length;for(let t,a=0;a<e;a++)if(t=microtaskCallbacks[a],t)try{t()}catch(t){setTimeout(()=>{throw t})}microtaskCallbacks.splice(0,e),microtaskLastHandle+=e}const microTask={run(e){return microtaskNode.textContent=microtaskNodeContent++,microtaskCallbacks.push(e),microtaskCurrHandle++},cancel(e){const t=e-microtaskLastHandle;if(0<=t){if(!microtaskCallbacks[t])throw new Error("invalid async handle: "+e);microtaskCallbacks[t]=null}}},microtask=microTask,PropertiesChanged=dedupingMixin(e=>{return class extends e{static createProperties(e){const t=this.prototype;for(let a in e)a in t||t._createPropertyAccessor(a)}static attributeNameForProperty(e){return e.toLowerCase()}static typeForProperty(){}_createPropertyAccessor(e,t){this._addPropertyToAttributeMap(e),this.hasOwnProperty("__dataHasAccessor")||(this.__dataHasAccessor=Object.assign({},this.__dataHasAccessor)),this.__dataHasAccessor[e]||(this.__dataHasAccessor[e]=!0,this._definePropertyAccessor(e,t))}_addPropertyToAttributeMap(e){if(this.hasOwnProperty("__dataAttributes")||(this.__dataAttributes=Object.assign({},this.__dataAttributes)),!this.__dataAttributes[e]){const t=this.constructor.attributeNameForProperty(e);this.__dataAttributes[t]=e}}_definePropertyAccessor(e,t){Object.defineProperty(this,e,{get(){return this._getProperty(e)},set:t?function(){}:function(t){this._setProperty(e,t)}})}constructor(){super(),this.__dataEnabled=!1,this.__dataReady=!1,this.__dataInvalid=!1,this.__data={},this.__dataPending=null,this.__dataOld=null,this.__dataInstanceProps=null,this.__serializing=!1,this._initializeProperties()}ready(){this.__dataReady=!0,this._flushProperties()}_initializeProperties(){for(let e in this.__dataHasAccessor)this.hasOwnProperty(e)&&(this.__dataInstanceProps=this.__dataInstanceProps||{},this.__dataInstanceProps[e]=this[e],delete this[e])}_initializeInstanceProperties(e){Object.assign(this,e)}_setProperty(e,t){this._setPendingProperty(e,t)&&this._invalidateProperties()}_getProperty(e){return this.__data[e]}_setPendingProperty(e,t){let a=this.__data[e],n=this._shouldPropertyChange(e,t,a);return n&&(!this.__dataPending&&(this.__dataPending={},this.__dataOld={}),this.__dataOld&&!(e in this.__dataOld)&&(this.__dataOld[e]=a),this.__data[e]=t,this.__dataPending[e]=t),n}_invalidateProperties(){!this.__dataInvalid&&this.__dataReady&&(this.__dataInvalid=!0,microtask.run(()=>{this.__dataInvalid&&(this.__dataInvalid=!1,this._flushProperties())}))}_enableProperties(){this.__dataEnabled||(this.__dataEnabled=!0,this.__dataInstanceProps&&(this._initializeInstanceProperties(this.__dataInstanceProps),this.__dataInstanceProps=null),this.ready())}_flushProperties(){const e=this.__data,t=this.__dataPending,a=this.__dataOld;this._shouldPropertiesChange(e,t,a)&&(this.__dataPending=null,this.__dataOld=null,this._propertiesChanged(e,t,a))}_shouldPropertiesChange(e,t){return!!t}_propertiesChanged(){}_shouldPropertyChange(e,t,a){return a!==t&&(a===a||t===t)}attributeChangedCallback(e,t,a,n){t!==a&&this._attributeToProperty(e,a),super.attributeChangedCallback&&super.attributeChangedCallback(e,t,a,n)}_attributeToProperty(e,t,a){if(!this.__serializing){const n=this.__dataAttributes,r=n&&n[e]||e;this[r]=this._deserializeValue(t,a||this.constructor.typeForProperty(r))}}_propertyToAttribute(e,t,a){this.__serializing=!0,a=3>arguments.length?this[e]:a,this._valueToNodeAttribute(this,a,t||this.constructor.attributeNameForProperty(e)),this.__serializing=!1}_valueToNodeAttribute(e,t,a){const n=this._serializeValue(t);n===void 0?e.removeAttribute(a):e.setAttribute(a,n)}_serializeValue(e){switch(typeof e){case"boolean":return e?"":void 0;default:return null==e?void 0:e.toString();}}_deserializeValue(e,t){return t===Boolean?null!==e:t===Number?+e:e}}});function normalizeProperties(e){const t={};for(let a in e){const n=e[a];t[a]="function"==typeof n?{type:n}:n}return t}const PropertiesMixin=dedupingMixin(e=>{function t(e){const t=Object.getPrototypeOf(e);return t.prototype instanceof r?t:null}function a(e){if(!e.hasOwnProperty(JSCompiler_renameProperty("__ownProperties",e))){let t=null;e.hasOwnProperty(JSCompiler_renameProperty("properties",e))&&e.properties&&(t=normalizeProperties(e.properties)),e.__ownProperties=t}return e.__ownProperties}const n=PropertiesChanged(e);class r extends n{static get observedAttributes(){const e=this._properties;return e?Object.keys(e).map(e=>this.attributeNameForProperty(e)):[]}static finalize(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__finalized",this))){const e=t(this);e&&e.finalize(),this.__finalized=!0,this._finalizeClass()}}static _finalizeClass(){const e=a(this);e&&this.createProperties(e)}static get _properties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("__properties",this))){const e=t(this);this.__properties=Object.assign({},e&&e._properties,a(this))}return this.__properties}static typeForProperty(e){const t=this._properties[e];return t&&t.type}_initializeProperties(){this.constructor.finalize(),super._initializeProperties()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),this._enableProperties()}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback()}}return r}),templateCaches=new Map,html=(e,...t)=>new TemplateResult(e,t,"html");class TemplateResult{constructor(e,t,a,n=defaultPartCallback){this.strings=e,this.values=t,this.type=a,this.partCallback=n}getHTML(){const e=this.strings.length-1;let t="",a=!0;for(let n=0;n<e;n++){const e=this.strings[n];t+=e;const r=findTagClose(e);a=-1<r?r<e.length:a,t+=a?nodeMarker:marker}return t+=this.strings[e],t}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}function defaultTemplateFactory(e){let t=templateCaches.get(e.type);void 0===t&&(t=new Map,templateCaches.set(e.type,t));let a=t.get(e.strings);return void 0===a&&(a=new Template(e,e.getTemplateElement()),t.set(e.strings,a)),a}function render(e,t,a=defaultTemplateFactory){const n=a(e);let r=t.__templateInstance;if(void 0!==r&&r.template===n&&r._partCallback===e.partCallback)return void r.update(e.values);r=new TemplateInstance(n,e.partCallback,a),t.__templateInstance=r;const o=r._clone();r.update(e.values),removeNodes(t,t.firstChild),t.appendChild(o)}const marker=`{{lit-${(Math.random()+"").slice(2)}}}`,nodeMarker=`<!--${marker}-->`,markerRegex=new RegExp(`${marker}|${nodeMarker}`),lastAttributeNameRegex=/[ \x09\x0a\x0c\x0d]([^\0-\x1F\x7F-\x9F \x09\x0a\x0c\x0d"'>=/]+)[ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*)$/;function findTagClose(e){const t=e.lastIndexOf(">"),a=e.indexOf("<",t+1);return-1<a?e.length:t}class TemplatePart{constructor(e,t,a,n,r){this.type=e,this.index=t,this.name=a,this.rawName=n,this.strings=r}}class Template{constructor(e,t){this.parts=[],this.element=t;const a=this.element.content,n=document.createTreeWalker(a,133,null,!1);let r=-1,o=0;const i=[];for(let a,d;n.nextNode();){r++,a=d;const t=d=n.currentNode;if(1===t.nodeType){if(!t.hasAttributes())continue;const a=t.attributes;let n=0;for(let e=0;e<a.length;e++)0<=a[e].value.indexOf(marker)&&n++;for(;0<n--;){const n=e.strings[o],i=lastAttributeNameRegex.exec(n)[1],d=a.getNamedItem(i),s=d.value.split(markerRegex);this.parts.push(new TemplatePart("attribute",r,d.name,i,s)),t.removeAttribute(d.name),o+=s.length-1}}else if(3===t.nodeType){const e=t.nodeValue;if(0>e.indexOf(marker))continue;const a=t.parentNode,n=e.split(markerRegex),d=n.length-1;o+=d;for(let e=0;e<d;e++)a.insertBefore(""===n[e]?document.createComment(""):document.createTextNode(n[e]),t),this.parts.push(new TemplatePart("node",r++));a.insertBefore(""===n[d]?document.createComment(""):document.createTextNode(n[d]),t),i.push(t)}else if(8===t.nodeType&&t.nodeValue===marker){const e=t.parentNode,n=t.previousSibling;null===n||n!==a||n.nodeType!==Node.TEXT_NODE?e.insertBefore(document.createComment(""),t):r--,this.parts.push(new TemplatePart("node",r++)),i.push(t),null===t.nextSibling?e.insertBefore(document.createComment(""),t):r--,d=a,o++}}for(const a of i)a.parentNode.removeChild(a)}}const getValue=(e,t)=>isDirective(t)?(t=t(e),directiveValue):null===t?void 0:t,isDirective=e=>"function"==typeof e&&!0===e.__litDirective,directiveValue={},isPrimitiveValue=e=>null===e||"object"!=typeof e&&"function"!=typeof e;class AttributePart{constructor(e,t,a,n){this.instance=e,this.element=t,this.name=a,this.strings=n,this.size=n.length-1,this._previousValues=[]}_interpolate(e,t){const a=this.strings,n=a.length-1;let r="";for(let o=0;o<n;o++){r+=a[o];const n=getValue(this,e[t+o]);if(n&&n!==directiveValue&&(Array.isArray(n)||"string"!=typeof n&&n[Symbol.iterator]))for(const e of n)r+=e;else r+=n}return r+a[n]}_equalToPreviousValues(e,t){for(let a=t;a<t+this.size;a++)if(this._previousValues[a]!==e[a]||!isPrimitiveValue(e[a]))return!1;return!0}setValue(e,t){if(this._equalToPreviousValues(e,t))return;const a=this.strings;let n;2===a.length&&""===a[0]&&""===a[1]?(n=getValue(this,e[t]),Array.isArray(n)&&(n=n.join(""))):n=this._interpolate(e,t),n!==directiveValue&&this.element.setAttribute(this.name,n),this._previousValues=e}}class NodePart{constructor(e,t,a){this.instance=e,this.startNode=t,this.endNode=a,this._previousValue=void 0}setValue(e){if(e=getValue(this,e),e!==directiveValue)if(isPrimitiveValue(e)){if(e===this._previousValue)return;this._setText(e)}else e instanceof TemplateResult?this._setTemplateResult(e):Array.isArray(e)||e[Symbol.iterator]?this._setIterable(e):e instanceof Node?this._setNode(e):void 0===e.then?this._setText(e):this._setPromise(e)}_insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}_setNode(e){this._previousValue===e||(this.clear(),this._insert(e),this._previousValue=e)}_setText(e){const t=this.startNode.nextSibling;e=e===void 0?"":e,t===this.endNode.previousSibling&&t.nodeType===Node.TEXT_NODE?t.textContent=e:this._setNode(document.createTextNode(e)),this._previousValue=e}_setTemplateResult(e){const t=this.instance._getTemplate(e);let a;this._previousValue&&this._previousValue.template===t?a=this._previousValue:(a=new TemplateInstance(t,this.instance._partCallback,this.instance._getTemplate),this._setNode(a._clone()),this._previousValue=a),a.update(e.values)}_setIterable(e){Array.isArray(this._previousValue)||(this.clear(),this._previousValue=[]);const t=this._previousValue;let a=0;for(const n of e){let e=t[a];if(e===void 0){let n=this.startNode;if(0<a){const e=t[a-1];n=e.endNode=document.createTextNode(""),this._insert(n)}e=new NodePart(this.instance,n,this.endNode),t.push(e)}e.setValue(n),a++}if(0==a)this.clear(),this._previousValue=void 0;else if(a<t.length){const e=t[a-1];t.length=a,this.clear(e.endNode.previousSibling),e.endNode=this.endNode}}_setPromise(e){this._previousValue=e,e.then(t=>{this._previousValue===e&&this.setValue(t)})}clear(e=this.startNode){removeNodes(this.startNode.parentNode,e.nextSibling,this.endNode)}}const defaultPartCallback=(e,t,a)=>{if("attribute"===t.type)return new AttributePart(e,a,t.name,t.strings);if("node"===t.type)return new NodePart(e,a,a.nextSibling);throw new Error(`Unknown part type ${t.type}`)};class TemplateInstance{constructor(e,t,a){this._parts=[],this.template=e,this._partCallback=t,this._getTemplate=a}update(e){let t=0;for(const a of this._parts)void 0===a.size?(a.setValue(e[t]),t++):(a.setValue(e,t),t+=a.size)}_clone(){const e=document.importNode(this.template.element.content,!0),t=this.template.parts;if(0<t.length){const a=document.createTreeWalker(e,133,null,!1);let n=-1;for(let e=0;e<t.length;e++){const r=t[e];for(;n<r.index;)n++,a.nextNode();this._parts.push(this._partCallback(this,r,a.currentNode))}}return e}}const removeNodes=(e,t,a=null)=>{for(let r=t;r!==a;){const t=r.nextSibling;e.removeChild(r),r=t}},shadyTemplateFactory=e=>t=>{const a=`${t.type}--${e}`;let n=templateCaches.get(a);n===void 0&&(n=new Map,templateCaches.set(a,n));let r=n.get(t.strings);if(r===void 0){const a=t.getTemplateElement();"object"==typeof window.ShadyCSS&&window.ShadyCSS.prepareTemplate(a,e),r=new Template(t,a),n.set(t.strings,r)}return r};function render$1(e,t,a){return render(e,t,shadyTemplateFactory(a))}class LitElement extends PropertiesMixin(HTMLElement){constructor(){super(...arguments),this.__renderComplete=null,this.__resolveRenderComplete=null,this.__isInvalid=!1,this.__isChanging=!1}ready(){this._root=this._createRoot(),super.ready(),this._firstRendered()}_firstRendered(){}_createRoot(){return this.attachShadow({mode:"open"})}_shouldPropertiesChange(e,t,a){const n=this._shouldRender(e,t,a);return!n&&this.__resolveRenderComplete&&this.__resolveRenderComplete(!1),n}_shouldRender(){return!0}_propertiesChanged(e,t,a){super._propertiesChanged(e,t,a);const n=this._render(e);n&&this._root!==void 0&&this._applyRender(n,this._root),this._didRender(e,t,a),this.__resolveRenderComplete&&this.__resolveRenderComplete(!0)}_flushProperties(){this.__isChanging=!0,this.__isInvalid=!1,super._flushProperties(),this.__isChanging=!1}_shouldPropertyChange(e,t,a){const n=super._shouldPropertyChange(e,t,a);return n&&this.__isChanging&&console.trace(`Setting properties in response to other properties changing `+`considered harmful. Setting '${e}' from `+`'${this._getProperty(e)}' to '${t}'.`),n}_render(){throw new Error("_render() not implemented")}_applyRender(e,t){render$1(e,t,this.localName)}_didRender(){}_requestRender(){this._invalidateProperties()}_invalidateProperties(){this.__isInvalid=!0,super._invalidateProperties()}get renderComplete(){return this.__renderComplete||(this.__renderComplete=new Promise(e=>{this.__resolveRenderComplete=t=>{this.__resolveRenderComplete=this.__renderComplete=null,e(t)}}),!this.__isInvalid&&this.__resolveRenderComplete&&Promise.resolve().then(()=>this.__resolveRenderComplete(!1))),this.__renderComplete}}const installRouter=t=>{document.body.addEventListener("click",a=>{if(!(a.defaultPrevented||0!==a.button||a.metaKey||a.ctrlKey||a.shiftKey)){const e=a.composedPath().filter(e=>"A"===e.tagName)[0];if(!(!e||e.target||e.hasAttribute("download")||"external"===e.getAttribute("rel"))){const n=e.href;if(n&&-1===n.indexOf("mailto:")){const e=window.location,r=e.origin||e.protocol+"//"+e.host;0!==n.indexOf(r)||(a.preventDefault(),n!==e.href&&(window.history.pushState({},"",n),t(e,a)))}}}}),window.addEventListener("popstate",a=>t(window.location,a)),t(window.location,null)};var Reflect$1,commonjsGlobal="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window;(function(e){(function(t){function a(e,t){return function(a,n){"function"!=typeof e[a]&&Object.defineProperty(e,a,{configurable:!0,writable:!0,value:n}),t&&t(a,n)}}var n="object"==typeof commonjsGlobal?commonjsGlobal:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),r=a(e);"undefined"==typeof n.Reflect?n.Reflect=e:r=a(n.Reflect,r),t(r)})(function(e){function t(e,t){for(var a=e.length-1;0<=a;--a){var n=e[a],r=n(t);if(!u(r)&&!c(r)){if(!k(r))throw new TypeError;t=r}}return t}function a(e,t,a,n){for(var r=e.length-1;0<=r;--r){var o=e[r],d=o(t,a,n);if(!u(d)&&!c(d)){if(!g(d))throw new TypeError;n=d}}return n}function n(e,t,a){var n=X.get(e);if(u(n)){if(!a)return;n=new F,X.set(e,n)}var r=n.get(t);if(u(r)){if(!a)return;r=new F,n.set(t,r)}return r}function r(e,t,a){var n=o(e,t,a);if(n)return!0;var i=S(t);return!c(i)&&r(e,i,a)}function o(e,t,a){var r=n(t,a,!1);return!u(r)&&m(r.has(e))}function i(e,t,a){var n=o(e,t,a);if(n)return d(e,t,a);var r=S(t);return c(r)?void 0:i(e,r,a)}function d(e,t,a){var r=n(t,a,!1);return u(r)?void 0:r.get(e)}function s(e,t,a,r){var o=n(a,r,!0);o.set(e,t)}function _(e,t){var a=p(e,t),n=S(e);if(null===n)return a;var r=_(n,t);if(0>=r.length)return a;if(0>=a.length)return r;for(var o=new B,i=[],d=0,s=a;d<s.length;d++){var l=s[d],u=o.has(l);u||(o.add(l),i.push(l))}for(var c=0,y=r;c<y.length;c++){var l=y[c],u=o.has(l);u||(o.add(l),i.push(l))}return i}function p(e,t){var a=[],r=n(e,t,!1);if(u(r))return a;for(var o=r.keys(),i=I(o),d=0;;){var s=O(i);if(!s)return a.length=d,a;var _=A(s);try{a[d]=_}catch(t){try{T(i)}finally{throw t}}d++}}function l(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6;}}function u(e){return e===void 0}function c(e){return null===e}function y(e){return"symbol"==typeof e}function g(e){return"object"==typeof e?null!==e:"function"==typeof e}function f(e,t){switch(l(e)){case 0:return e;case 1:return e;case 2:return e;case 3:return e;case 4:return e;case 5:return e;}var a=3===t?"string":5===t?"number":"default",n=N(e,w);if(n!==void 0){var r=n.call(e,a);if(g(r))throw new TypeError;return r}return h(e,"default"==a?"number":a)}function h(e,t){if("string"===t){var a=e.toString;if(x(a)){var n=a.call(e);if(!g(n))return n}var r=e.valueOf;if(x(r)){var n=r.call(e);if(!g(n))return n}}else{var r=e.valueOf;if(x(r)){var n=r.call(e);if(!g(n))return n}var o=e.toString;if(x(o)){var n=o.call(e);if(!g(n))return n}}throw new TypeError}function m(e){return!!e}function v(e){return""+e}function b(e){var t=f(e,3);return y(t)?t:v(t)}function P(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function x(e){return"function"==typeof e}function k(e){return"function"==typeof e}function C(e){switch(l(e)){case 3:return!0;case 4:return!0;default:return!1;}}function N(e,t){var a=e[t];if(void 0!==a&&null!==a){if(!x(a))throw new TypeError;return a}}function I(e){var t=N(e,E);if(!x(t))throw new TypeError;var a=t.call(e);if(!g(a))throw new TypeError;return a}function A(e){return e.value}function O(e){var t=e.next();return!t.done&&t}function T(e){var t=e["return"];t&&t.call(e)}function S(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===D)return t;if(t!==D)return t;var a=e.prototype,n=a&&Object.getPrototypeOf(a);if(null==n||n===Object.prototype)return t;var r=n.constructor;return"function"==typeof r?r===e?t:r:t}function V(e){return e.__=void 0,delete e.__,e}var z=Object.prototype.hasOwnProperty,R="function"==typeof Symbol,w=R&&"undefined"!=typeof Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",E=R&&"undefined"!=typeof Symbol.iterator?Symbol.iterator:"@@iterator",M="function"==typeof Object.create,K={__proto__:[]}instanceof Array,L=!M&&!K,j={create:M?function(){return V(Object.create(null))}:K?function(){return V({__proto__:null})}:function(){return V({})},has:L?function(e,t){return z.call(e,t)}:function(e,t){return t in e},get:L?function(e,t){return z.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},D=Object.getPrototypeOf(Function),H="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,F=H||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){function e(e){return e}function t(e,t){return t}function a(e,t){return[e,t]}var n={},r=[],o=function(){function e(e,t,a){this._index=0,this._keys=e,this._values=t,this._selector=a}return e.prototype["@@iterator"]=function(){return this},e.prototype[E]=function(){return this},e.prototype.next=function(){var e=this._index;if(0<=e&&e<this._keys.length){var t=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=r,this._values=r):this._index++,{value:t,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw 0<=this._index&&(this._index=-1,this._keys=r,this._values=r),e},e.prototype.return=function(e){return 0<=this._index&&(this._index=-1,this._keys=r,this._values=r),{value:e,done:!0}},e}();return function(){function r(){this._keys=[],this._values=[],this._cacheKey=n,this._cacheIndex=-2}return Object.defineProperty(r.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),r.prototype.has=function(e){return 0<=this._find(e,!1)},r.prototype.get=function(e){var t=this._find(e,!1);return 0<=t?this._values[t]:void 0},r.prototype.set=function(e,t){var a=this._find(e,!0);return this._values[a]=t,this},r.prototype.delete=function(e){var t=this._find(e,!1);if(0<=t){for(var a=this._keys.length,r=t+1;r<a;r++)this._keys[r-1]=this._keys[r],this._values[r-1]=this._values[r];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=n,this._cacheIndex=-2),!0}return!1},r.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=n,this._cacheIndex=-2},r.prototype.keys=function(){return new o(this._keys,this._values,e)},r.prototype.values=function(){return new o(this._keys,this._values,t)},r.prototype.entries=function(){return new o(this._keys,this._values,a)},r.prototype["@@iterator"]=function(){return this.entries()},r.prototype[E]=function(){return this.entries()},r.prototype._find=function(e,t){return this._cacheKey!==e&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=e)),0>this._cacheIndex&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},r}()}():Map,B=H||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){return function(){function e(){this._map=new F}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.values()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[E]=function(){return this.keys()},e}()}():Set,W=H||"function"!=typeof WeakMap?function(){function e(){var e;do e="@@WeakMap@@"+r();while(j.has(o,e));return o[e]=!0,e}function t(e,t){if(!z.call(e,i)){if(!t)return;Object.defineProperty(e,i,{value:j.create()})}return e[i]}function a(e,t){for(var a=0;a<t;++a)e[a]=0|255*Math.random();return e}function n(e){return"function"==typeof Uint8Array?"undefined"==typeof crypto?"undefined"==typeof msCrypto?a(new Uint8Array(e),e):msCrypto.getRandomValues(new Uint8Array(e)):crypto.getRandomValues(new Uint8Array(e)):a(Array(e),e)}function r(){var e=n(16);e[6]=64|79&e[6],e[8]=128|191&e[8];for(var t,a="",r=0;r<16;++r)t=e[r],(4===r||6===r||8===r)&&(a+="-"),16>t&&(a+="0"),a+=t.toString(16).toLowerCase();return a}var o=j.create(),i=e();return function(){function a(){this._key=e()}return a.prototype.has=function(e){var a=t(e,!1);return void 0!==a&&j.has(a,this._key)},a.prototype.get=function(e){var a=t(e,!1);return void 0===a?void 0:j.get(a,this._key)},a.prototype.set=function(e,a){var n=t(e,!0);return n[this._key]=a,this},a.prototype.delete=function(e){var a=t(e,!1);return void 0!==a&&delete a[this._key]},a.prototype.clear=function(){this._key=e()},a}()}():WeakMap,X=new W;e("decorate",function(e,n,r,o){if(!u(r)){if(!P(e))throw new TypeError;if(!g(n))throw new TypeError;if(!g(o)&&!u(o)&&!c(o))throw new TypeError;return c(o)&&(o=void 0),r=b(r),a(e,n,r,o)}if(!P(e))throw new TypeError;if(!k(n))throw new TypeError;return t(e,n)}),e("metadata",function(e,t){return function(a,n){if(!g(a))throw new TypeError;if(!u(n)&&!C(n))throw new TypeError;s(e,t,a,n)}}),e("defineMetadata",function(e,t,a,n){if(!g(a))throw new TypeError;return u(n)||(n=b(n)),s(e,t,a,n)}),e("hasMetadata",function(e,t,a){if(!g(t))throw new TypeError;return u(a)||(a=b(a)),r(e,t,a)}),e("hasOwnMetadata",function(e,t,a){if(!g(t))throw new TypeError;return u(a)||(a=b(a)),o(e,t,a)}),e("getMetadata",function(e,t,a){if(!g(t))throw new TypeError;return u(a)||(a=b(a)),i(e,t,a)}),e("getOwnMetadata",function(e,t,a){if(!g(t))throw new TypeError;return u(a)||(a=b(a)),d(e,t,a)}),e("getMetadataKeys",function(e,t){if(!g(e))throw new TypeError;return u(t)||(t=b(t)),_(e,t)}),e("getOwnMetadataKeys",function(e,t){if(!g(e))throw new TypeError;return u(t)||(t=b(t)),p(e,t)}),e("deleteMetadata",function(e,t,a){if(!g(t))throw new TypeError;u(a)||(a=b(a));var r=n(t,a,!1);if(u(r))return!1;if(!r.delete(e))return!1;if(0<r.size)return!0;var o=X.get(t);return!(o.delete(a),!(0<o.size))||(X.delete(t),!0)})})})(Reflect$1||(Reflect$1={}));const component=e=>function(t){window.customElements.define(e,t)};function property(e,t){function a(e,t){Reflect.hasMetadata("design:type",e,t)&&(n.type=Reflect.getMetadata("design:type",e,t)),e.constructor.properties=e.constructor.properties||{},e.constructor.properties[t]=Object.assign(n,e.constructor.properties[t]||{})}let n,r=!1;return void 0===t?(n=e||{},r=!0):n={},r?a:a(e,t)}let Link=class extends LitElement{connectedCallback(){super.connectedCallback(),this.addEventListener("click",()=>{this.href&&window.location.pathname!==this.href&&(setTimeout(()=>{dispatchEvent(new PopStateEvent("popstate",{state:{}}))},3),window.history.pushState({},"",this.href))})}_firstRendered(){installRouter(this._updateClass.bind(this))}_render(){return html` <style> :host{ display: inline-block; cursor: pointer; }</style> <slot></slot> `}_updateClass(e){let t=e.pathname===this.href;t||(t=`${this.href}/`===e.pathname),this.classList.toggle("active",t)}};__decorate([property,__metadata("design:type",String)],Link.prototype,"href",void 0),Link=__decorate([component("zen-link")],Link); //# sourceMappingURL=Link.js.map