UNPKG

origami-zen

Version:

Collection of reusable web components. Built for Origami CMS.

8 lines (7 loc) 39.6 kB
function __decorate(e,t,n,a){var o,s=arguments.length,p=3>s?t:null===a?a=Object.getOwnPropertyDescriptor(t,n):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)p=Reflect.decorate(e,t,n,a);else for(var l=e.length-1;0<=l;l--)(o=e[l])&&(p=(3>s?o(p):3<s?o(t,n,p):o(t,n))||p);return 3<s&&p&&Object.defineProperty(t,n,p),p}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 a=t.__mixinSet;if(a&&a[n])return t;let o=r,i=o.get(t);i||(i=e(t),o.set(t,i));let s=Object.create(i.__mixinSet||a||null);return s[n]=!0,i.__mixinSet=s,i}let r=e.__mixinApplications;r||(r=new WeakMap,e.__mixinApplications=r);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,r=0;r<e;r++)if(t=microtaskCallbacks[r],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 r in e)r in t||t._createPropertyAccessor(r)}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 r=this.__data[e],n=this._shouldPropertyChange(e,t,r);return n&&(!this.__dataPending&&(this.__dataPending={},this.__dataOld={}),this.__dataOld&&!(e in this.__dataOld)&&(this.__dataOld[e]=r),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,r=this.__dataOld;this._shouldPropertiesChange(e,t,r)&&(this.__dataPending=null,this.__dataOld=null,this._propertiesChanged(e,t,r))}_shouldPropertiesChange(e,t){return!!t}_propertiesChanged(){}_shouldPropertyChange(e,t,r){return r!==t&&(r===r||t===t)}attributeChangedCallback(e,t,r,n){t!==r&&this._attributeToProperty(e,r),super.attributeChangedCallback&&super.attributeChangedCallback(e,t,r,n)}_attributeToProperty(e,t,r){if(!this.__serializing){const n=this.__dataAttributes,a=n&&n[e]||e;this[a]=this._deserializeValue(t,r||this.constructor.typeForProperty(a))}}_propertyToAttribute(e,t,r){this.__serializing=!0,r=3>arguments.length?this[e]:r,this._valueToNodeAttribute(this,r,t||this.constructor.attributeNameForProperty(e)),this.__serializing=!1}_valueToNodeAttribute(e,t,r){const n=this._serializeValue(t);n===void 0?e.removeAttribute(r):e.setAttribute(r,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 r in e){const n=e[r];t[r]="function"==typeof n?{type:n}:n}return t}const PropertiesMixin=dedupingMixin(e=>{function t(e){const t=Object.getPrototypeOf(e);return t.prototype instanceof a?t:null}function r(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 a 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=r(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,r(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 a}),templateCaches=new Map;class TemplateResult{constructor(e,t,r,n=defaultPartCallback){this.strings=e,this.values=t,this.type=r,this.partCallback=n}getHTML(){const e=this.strings.length-1;let t="",r=!0;for(let n=0;n<e;n++){const e=this.strings[n];t+=e;const a=findTagClose(e);r=-1<a?a<e.length:r,t+=r?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 r=t.get(e.strings);return void 0===r&&(r=new Template(e,e.getTemplateElement()),t.set(e.strings,r)),r}function render(e,t,r=defaultTemplateFactory){const n=r(e);let a=t.__templateInstance;if(void 0!==a&&a.template===n&&a._partCallback===e.partCallback)return void a.update(e.values);a=new TemplateInstance(n,e.partCallback,r),t.__templateInstance=a;const o=a._clone();a.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(">"),r=e.indexOf("<",t+1);return-1<r?e.length:t}class TemplatePart{constructor(e,t,r,n,a){this.type=e,this.index=t,this.name=r,this.rawName=n,this.strings=a}}class Template{constructor(e,t){this.parts=[],this.element=t;const r=this.element.content,n=document.createTreeWalker(r,133,null,!1);let a=-1,o=0;const i=[];for(let r,s;n.nextNode();){a++,r=s;const t=s=n.currentNode;if(1===t.nodeType){if(!t.hasAttributes())continue;const r=t.attributes;let n=0;for(let e=0;e<r.length;e++)0<=r[e].value.indexOf(marker)&&n++;for(;0<n--;){const n=e.strings[o],i=lastAttributeNameRegex.exec(n)[1],s=r.getNamedItem(i),d=s.value.split(markerRegex);this.parts.push(new TemplatePart("attribute",a,s.name,i,d)),t.removeAttribute(s.name),o+=d.length-1}}else if(3===t.nodeType){const e=t.nodeValue;if(0>e.indexOf(marker))continue;const r=t.parentNode,n=e.split(markerRegex),s=n.length-1;o+=s;for(let e=0;e<s;e++)r.insertBefore(""===n[e]?document.createComment(""):document.createTextNode(n[e]),t),this.parts.push(new TemplatePart("node",a++));r.insertBefore(""===n[s]?document.createComment(""):document.createTextNode(n[s]),t),i.push(t)}else if(8===t.nodeType&&t.nodeValue===marker){const e=t.parentNode,n=t.previousSibling;null===n||n!==r||n.nodeType!==Node.TEXT_NODE?e.insertBefore(document.createComment(""),t):a--,this.parts.push(new TemplatePart("node",a++)),i.push(t),null===t.nextSibling?e.insertBefore(document.createComment(""),t):a--,s=r,o++}}for(const r of i)r.parentNode.removeChild(r)}}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,r,n){this.instance=e,this.element=t,this.name=r,this.strings=n,this.size=n.length-1,this._previousValues=[]}_interpolate(e,t){const r=this.strings,n=r.length-1;let a="";for(let o=0;o<n;o++){a+=r[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)a+=e;else a+=n}return a+r[n]}_equalToPreviousValues(e,t){for(let r=t;r<t+this.size;r++)if(this._previousValues[r]!==e[r]||!isPrimitiveValue(e[r]))return!1;return!0}setValue(e,t){if(this._equalToPreviousValues(e,t))return;const r=this.strings;let n;2===r.length&&""===r[0]&&""===r[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,r){this.instance=e,this.startNode=t,this.endNode=r,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 r;this._previousValue&&this._previousValue.template===t?r=this._previousValue:(r=new TemplateInstance(t,this.instance._partCallback,this.instance._getTemplate),this._setNode(r._clone()),this._previousValue=r),r.update(e.values)}_setIterable(e){Array.isArray(this._previousValue)||(this.clear(),this._previousValue=[]);const t=this._previousValue;let r=0;for(const n of e){let e=t[r];if(e===void 0){let n=this.startNode;if(0<r){const e=t[r-1];n=e.endNode=document.createTextNode(""),this._insert(n)}e=new NodePart(this.instance,n,this.endNode),t.push(e)}e.setValue(n),r++}if(0==r)this.clear(),this._previousValue=void 0;else if(r<t.length){const e=t[r-1];t.length=r,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,r)=>{if("attribute"===t.type)return new AttributePart(e,r,t.name,t.strings);if("node"===t.type)return new NodePart(e,r,r.nextSibling);throw new Error(`Unknown part type ${t.type}`)};class TemplateInstance{constructor(e,t,r){this._parts=[],this.template=e,this._partCallback=t,this._getTemplate=r}update(e){let t=0;for(const r of this._parts)void 0===r.size?(r.setValue(e[t]),t++):(r.setValue(e,t),t+=r.size)}_clone(){const e=document.importNode(this.template.element.content,!0),t=this.template.parts;if(0<t.length){const r=document.createTreeWalker(e,133,null,!1);let n=-1;for(let e=0;e<t.length;e++){const a=t[e];for(;n<a.index;)n++,r.nextNode();this._parts.push(this._partCallback(this,a,r.currentNode))}}return e}}const removeNodes=(e,t,r=null)=>{for(let a=t;a!==r;){const t=a.nextSibling;e.removeChild(a),a=t}},shadyTemplateFactory=e=>t=>{const r=`${t.type}--${e}`;let n=templateCaches.get(r);n===void 0&&(n=new Map,templateCaches.set(r,n));let a=n.get(t.strings);if(a===void 0){const r=t.getTemplateElement();"object"==typeof window.ShadyCSS&&window.ShadyCSS.prepareTemplate(r,e),a=new Template(t,r),n.set(t.strings,a)}return a};function render$1(e,t,r){return render(e,t,shadyTemplateFactory(r))}const html$1=(e,...t)=>new TemplateResult(e,t,"html",extendedPartCallback),extendedPartCallback=(e,t,r)=>{if("attribute"===t.type){if("on-"===t.rawName.substr(0,3)){const n=t.rawName.slice(3);return new EventPart(e,r,n)}const n=t.name.substr(t.name.length-1);if("$"===n){const n=t.name.slice(0,-1);return new AttributePart(e,r,n,t.strings)}if("?"===n){const n=t.name.slice(0,-1);return new BooleanAttributePart(e,r,n,t.strings)}return new PropertyPart(e,r,t.rawName,t.strings)}return defaultPartCallback(e,t,r)};class BooleanAttributePart extends AttributePart{setValue(e,t){const r=this.strings;if(2===r.length&&""===r[0]&&""===r[1]){const r=getValue(this,e[t]);if(r===directiveValue)return;r?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}else throw new Error("boolean attributes can only contain a single expression")}}class PropertyPart extends AttributePart{setValue(e,t){const r=this.strings;let n;this._equalToPreviousValues(e,t)||(n=2===r.length&&""===r[0]&&""===r[1]?getValue(this,e[t]):this._interpolate(e,t),n!==directiveValue&&(this.element[this.name]=n),this._previousValues=e)}}class EventPart{constructor(e,t,r){this.instance=e,this.element=t,this.eventName=r}setValue(e){const t=getValue(this,e);t===this._listener||(null==t?this.element.removeEventListener(this.eventName,this):null==this._listener&&this.element.addEventListener(this.eventName,this),this._listener=t)}handleEvent(e){"function"==typeof this._listener?this._listener.call(this.element,e):"function"==typeof this._listener.handleEvent&&this._listener.handleEvent(e)}}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,r){const n=this._shouldRender(e,t,r);return!n&&this.__resolveRenderComplete&&this.__resolveRenderComplete(!1),n}_shouldRender(){return!0}_propertiesChanged(e,t,r){super._propertiesChanged(e,t,r);const n=this._render(e);n&&this._root!==void 0&&this._applyRender(n,this._root),this._didRender(e,t,r),this.__resolveRenderComplete&&this.__resolveRenderComplete(!0)}_flushProperties(){this.__isChanging=!0,this.__isInvalid=!1,super._flushProperties(),this.__isChanging=!1}_shouldPropertyChange(e,t,r){const n=super._shouldPropertyChange(e,t,r);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}}var commonjsGlobal="undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window;function unwrapExports(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e["default"]:e}function createCommonjsModule(e,t){return t={exports:{}},e(t,t.exports),t.exports}var Reflect$1;(function(e){(function(t){function r(e,t){return function(r,n){"function"!=typeof e[r]&&Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}var n="object"==typeof commonjsGlobal?commonjsGlobal:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),a=r(e);"undefined"==typeof n.Reflect?n.Reflect=e:a=r(n.Reflect,a),t(a)})(function(e){function t(e,t){for(var r=e.length-1;0<=r;--r){var n=e[r],a=n(t);if(!u(a)&&!c(a)){if(!k(a))throw new TypeError;t=a}}return t}function r(e,t,r,n){for(var a=e.length-1;0<=a;--a){var o=e[a],s=o(t,r,n);if(!u(s)&&!c(s)){if(!g(s))throw new TypeError;n=s}}return n}function n(e,t,r){var n=q.get(e);if(u(n)){if(!r)return;n=new H,q.set(e,n)}var a=n.get(t);if(u(a)){if(!r)return;a=new H,n.set(t,a)}return a}function a(e,t,r){var n=o(e,t,r);if(n)return!0;var i=w(t);return!c(i)&&a(e,i,r)}function o(e,t,r){var a=n(t,r,!1);return!u(a)&&f(a.has(e))}function i(e,t,r){var n=o(e,t,r);if(n)return s(e,t,r);var a=w(t);return c(a)?void 0:i(e,a,r)}function s(e,t,r){var a=n(t,r,!1);return u(a)?void 0:a.get(e)}function d(e,t,r,a){var o=n(r,a,!0);o.set(e,t)}function p(e,t){var r=l(e,t),n=w(e);if(null===n)return r;var a=p(n,t);if(0>=a.length)return r;if(0>=r.length)return a;for(var o=new B,i=[],s=0,d=r;s<d.length;s++){var _=d[s],u=o.has(_);u||(o.add(_),i.push(_))}for(var c=0,y=a;c<y.length;c++){var _=y[c],u=o.has(_);u||(o.add(_),i.push(_))}return i}function l(e,t){var r=[],a=n(e,t,!1);if(u(a))return r;for(var o=a.keys(),i=A(o),s=0;;){var d=O(i);if(!d)return r.length=s,r;var p=I(d);try{r[s]=p}catch(t){try{T(i)}finally{throw t}}s++}}function _(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 m(e,t){switch(_(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 r=3===t?"string":5===t?"number":"default",n=N(e,z);if(n!==void 0){var a=n.call(e,r);if(g(a))throw new TypeError;return a}return h(e,"default"==r?"number":r)}function h(e,t){if("string"===t){var r=e.toString;if(x(r)){var n=r.call(e);if(!g(n))return n}var a=e.valueOf;if(x(a)){var n=a.call(e);if(!g(n))return n}}else{var a=e.valueOf;if(x(a)){var n=a.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 f(e){return!!e}function v(e){return""+e}function b(e){var t=m(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(_(e)){case 3:return!0;case 4:return!0;default:return!1;}}function N(e,t){var r=e[t];if(void 0!==r&&null!==r){if(!x(r))throw new TypeError;return r}}function A(e){var t=N(e,E);if(!x(t))throw new TypeError;var r=t.call(e);if(!g(r))throw new TypeError;return r}function I(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 w(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===K)return t;if(t!==K)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var a=n.constructor;return"function"==typeof a?a===e?t:a:t}function V(e){return e.__=void 0,delete e.__,e}var S=Object.prototype.hasOwnProperty,R="function"==typeof Symbol,z=R&&"undefined"!=typeof Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",E=R&&"undefined"!=typeof Symbol.iterator?Symbol.iterator:"@@iterator",M="function"==typeof Object.create,j={__proto__:[]}instanceof Array,L=!M&&!j,F={create:M?function(){return V(Object.create(null))}:j?function(){return V({__proto__:null})}:function(){return V({})},has:L?function(e,t){return S.call(e,t)}:function(e,t){return t in e},get:L?function(e,t){return S.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},K=Object.getPrototypeOf(Function),D="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,H=D||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){function e(e){return e}function t(e,t){return t}function r(e,t){return[e,t]}var n={},a=[],o=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}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=a,this._values=a):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=a,this._values=a),e},e.prototype.return=function(e){return 0<=this._index&&(this._index=-1,this._keys=a,this._values=a),{value:e,done:!0}},e}();return function(){function a(){this._keys=[],this._values=[],this._cacheKey=n,this._cacheIndex=-2}return Object.defineProperty(a.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),a.prototype.has=function(e){return 0<=this._find(e,!1)},a.prototype.get=function(e){var t=this._find(e,!1);return 0<=t?this._values[t]:void 0},a.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},a.prototype.delete=function(e){var t=this._find(e,!1);if(0<=t){for(var r=this._keys.length,a=t+1;a<r;a++)this._keys[a-1]=this._keys[a],this._values[a-1]=this._values[a];return this._keys.length--,this._values.length--,e===this._cacheKey&&(this._cacheKey=n,this._cacheIndex=-2),!0}return!1},a.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=n,this._cacheIndex=-2},a.prototype.keys=function(){return new o(this._keys,this._values,e)},a.prototype.values=function(){return new o(this._keys,this._values,t)},a.prototype.entries=function(){return new o(this._keys,this._values,r)},a.prototype["@@iterator"]=function(){return this.entries()},a.prototype[E]=function(){return this.entries()},a.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},a}()}():Map,B=D||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){return function(){function e(){this._map=new H}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=D||"function"!=typeof WeakMap?function(){function e(){var e;do e="@@WeakMap@@"+a();while(F.has(o,e));return o[e]=!0,e}function t(e,t){if(!S.call(e,i)){if(!t)return;Object.defineProperty(e,i,{value:F.create()})}return e[i]}function r(e,t){for(var r=0;r<t;++r)e[r]=0|255*Math.random();return e}function n(e){return"function"==typeof Uint8Array?"undefined"==typeof crypto?"undefined"==typeof msCrypto?r(new Uint8Array(e),e):msCrypto.getRandomValues(new Uint8Array(e)):crypto.getRandomValues(new Uint8Array(e)):r(Array(e),e)}function a(){var e=n(16);e[6]=64|79&e[6],e[8]=128|191&e[8];for(var t,r="",a=0;a<16;++a)t=e[a],(4===a||6===a||8===a)&&(r+="-"),16>t&&(r+="0"),r+=t.toString(16).toLowerCase();return r}var o=F.create(),i=e();return function(){function r(){this._key=e()}return r.prototype.has=function(e){var r=t(e,!1);return void 0!==r&&F.has(r,this._key)},r.prototype.get=function(e){var r=t(e,!1);return void 0===r?void 0:F.get(r,this._key)},r.prototype.set=function(e,r){var n=t(e,!0);return n[this._key]=r,this},r.prototype.delete=function(e){var r=t(e,!1);return void 0!==r&&delete r[this._key]},r.prototype.clear=function(){this._key=e()},r}()}():WeakMap,q=new W;e("decorate",function(e,n,a,o){if(!u(a)){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),a=b(a),r(e,n,a,o)}if(!P(e))throw new TypeError;if(!k(n))throw new TypeError;return t(e,n)}),e("metadata",function(e,t){return function(r,n){if(!g(r))throw new TypeError;if(!u(n)&&!C(n))throw new TypeError;d(e,t,r,n)}}),e("defineMetadata",function(e,t,r,n){if(!g(r))throw new TypeError;return u(n)||(n=b(n)),d(e,t,r,n)}),e("hasMetadata",function(e,t,r){if(!g(t))throw new TypeError;return u(r)||(r=b(r)),a(e,t,r)}),e("hasOwnMetadata",function(e,t,r){if(!g(t))throw new TypeError;return u(r)||(r=b(r)),o(e,t,r)}),e("getMetadata",function(e,t,r){if(!g(t))throw new TypeError;return u(r)||(r=b(r)),i(e,t,r)}),e("getOwnMetadata",function(e,t,r){if(!g(t))throw new TypeError;return u(r)||(r=b(r)),s(e,t,r)}),e("getMetadataKeys",function(e,t){if(!g(e))throw new TypeError;return u(t)||(t=b(t)),p(e,t)}),e("getOwnMetadataKeys",function(e,t){if(!g(e))throw new TypeError;return u(t)||(t=b(t)),l(e,t)}),e("deleteMetadata",function(e,t,r){if(!g(t))throw new TypeError;u(r)||(r=b(r));var a=n(t,r,!1);if(u(a))return!1;if(!a.delete(e))return!1;if(0<a.size)return!0;var o=q.get(t);return!(o.delete(r),!(0<o.size))||(q.delete(t),!0)})})})(Reflect$1||(Reflect$1={}));var dist=createCommonjsModule(function(e,t){function r(e){return function(t){t.behaviors=t.behaviors||[],t.behaviors.push(e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.PolymerElement=function(){return function(){}}(),t.component=function(e,t,r){return void 0===r&&(r=!0),function(n){if(void 0===t&&(t=n.extends),void 0!==n.extends&&delete n.extends,void 0!==n.prototype.beforeRegister){var a=n.prototype.beforeRegister;n.prototype.beforeRegister=function(){this.is=e,this.extends=t,a.apply(this,arguments)}}else n.prototype.beforeRegister=function(){this.is=e,this.extends=t};var o=n.behaviors;return void 0!==o&&(delete n.behaviors,Object.defineProperty(n.prototype,"behaviors",{get:function(){return o}})),r&&customElements.define(e,n),n}},t.extend=function(e){return function(t){return t.extends=e,t}},t.behavior=r,t.property=function(e,t){function r(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]||{})}var n,a=!1;return void 0===t?(n=e||{},a=!0):n={},a?r:r(e,t)},t.observe=function(e){return 0<e.indexOf(",")||0<e.indexOf(".")?function(t,r){t.observers=t.observers||[],t.observers.push(r+"("+e+")")}:function(t,r){var n=t.constructor;n.properties=n.properties||{},n.properties[e]=n.properties[e]||{},n.properties[e].observer=r}},t.listen=function(e){return function(t,r){var n=t.constructor;n.listeners=n.listeners||{},n.listeners[e]=r}},t.computed=function(e,t){function r(e,t){var r=e.constructor;r.properties=r.properties||{},n=n||{},Reflect.hasMetadata("design:returntype",e,t)&&(n.type=Reflect.getMetadata("design:returntype",e,t));var a="get_computed_"+t,o=e[t].toString(),i=o.indexOf("("),s=o.indexOf(")"),d=o.substring(i+1,s);n.computed=a+"("+d+")",r.properties[t]=n,e[a]=e[t]}var n,a=!1;return void 0===t&&(n=e,a=!0),a?r:r(e,t)}});unwrapExports(dist);var dist_1=dist.PolymerElement,dist_2=dist.component,dist_3=dist.extend,dist_4=dist.behavior,dist_5=dist.property,dist_6=dist.observe,dist_7=dist.listen,dist_8=dist.computed;const bindAttributes=function(e){return class extends e{_propertiesChanged(e,t,r){super._propertiesChanged(e,t,r);const n=this.constructor._boundAttributes;n&&t&&Object.keys(t).forEach(t=>{if(n.includes(t)){const r=e[t];r||0===r?this.setAttribute(t,e[t]):this.removeAttribute(t)}})}}},component=e=>function(t){window.customElements.define(e,t)};var CSS=html$1`<style>:host{display:inline-block;width:auto;text-transform:uppercase;font-weight:600;letter-spacing:2px;border:none;height:var(--btn-height, var(--size-main, 4rem));line-height:var(--btn-height, var(--size-main, 4rem));padding:0 var(--btn-padding, var(--size-small, 2rem));border-radius:var(--btn-border-radius, var(--border-radius, .4rem));color:var(--color-white, #fff);transition:color var(--transition-time, .35s),background var(--transition-time, .35s);user-select:none;font-family:var(--btn-font-family, var(--font-family, "Work Sans",sans-serif));cursor:pointer;font-size:var(--btn-font-size, var(--font-size-main, 1.6rem));text-align:center;white-space:nowrap}:not([color]):host{background-color:var(--btn-bg, linear-gradient(to bottom right, var(--color-main-alt, #b155ba), var(--color-main, var(--color-purple, #693a91))));background:var(--btn-bg, linear-gradient(to bottom right, var(--color-main-alt, #b155ba), var(--color-main, var(--color-purple, #693a91))))}:host *{vertical-align:middle}:host+:host{margin-left:var(--size-small)}:hover:host{filter:brightness(1.1)}:focus:host{border:none;filter:brightness(0.9)}.round:host{padding:0;border-radius:50%}.has-icon:host{padding-left:var(--size-small, 2rem)}.has-icon:host .i{vertical-align:top;margin-right:var(--size-small, 2rem)}.has-icon:host .loader{margin-top:calc(default('size-small') / 2)}.no-text:host{padding:0}.no-text:host .i{margin:0}:disabled:host{opacity:0.5;pointer-events:none}:host>span{display:inline-block;vertical-align:middle}.size-tiny:host,[size=tiny]:host{width:auto;height:var(--size-tiny, 1rem);line-height:var(--size-tiny, 1rem);padding:0 calc(var(--size-tiny, 1rem) / 2)}.size-tiny.icon-right:host,[size=tiny].icon-right:host{padding-right:var(--size-tiny, 1rem)}.size-small:host,[size=small]:host{width:auto;height:var(--size-small, 2rem);line-height:var(--size-small, 2rem);padding:0 calc(var(--size-small, 2rem) / 2)}.size-small.icon-right:host,[size=small].icon-right:host{padding-right:var(--size-small, 2rem)}.size-medium:host,[size=medium]:host{width:auto;height:var(--size-medium, 3rem);line-height:var(--size-medium, 3rem);padding:0 calc(var(--size-medium, 3rem) / 2)}.size-medium.icon-right:host,[size=medium].icon-right:host{padding-right:var(--size-medium, 3rem)}.size-main:host,[size=main]:host{width:auto;height:var(--size-main, 4rem);line-height:var(--size-main, 4rem);padding:0 calc(var(--size-main, 4rem) / 2)}.size-main.icon-right:host,[size=main].icon-right:host{padding-right:var(--size-main, 4rem)}.size-large:host,[size=large]:host{width:auto;height:var(--size-large, 6rem);line-height:var(--size-large, 6rem);padding:0 calc(var(--size-large, 6rem) / 2)}.size-large.icon-right:host,[size=large].icon-right:host{padding-right:var(--size-large, 6rem)}.size-huge:host,[size=huge]:host{width:auto;height:var(--size-huge, 8rem);line-height:var(--size-huge, 8rem);padding:0 calc(var(--size-huge, 8rem) / 2)}.size-huge.icon-right:host,[size=huge].icon-right:host{padding-right:var(--size-huge, 8rem)}.size-super:host,[size=super]:host{width:auto;height:var(--size-super, 12rem);line-height:var(--size-super, 12rem);padding:0 calc(var(--size-super, 12rem) / 2)}.size-super.icon-right:host,[size=super].icon-right:host{padding-right:var(--size-super, 12rem)}.size-hero:host,[size=hero]:host{width:auto;height:var(--size-hero, 24rem);line-height:var(--size-hero, 24rem);padding:0 calc(var(--size-hero, 24rem) / 2)}.size-hero.icon-right:host,[size=hero].icon-right:host{padding-right:var(--size-hero, 24rem)}.hollow:host,[hollow]:host,:host([hollow]){background:transparent !important;color:var(--color-main, var(--color-purple, #693a91));padding-left:0;padding-right:0}.hollow[color=main]:host,[color=main][hollow]:host,[color=main]:host([hollow]){color:var(--color-main)}.hollow[color=alt]:host,[color=alt][hollow]:host,[color=alt]:host([hollow]){color:var(--color-alt)}.hollow[color=text]:host,[color=text][hollow]:host,[color=text]:host([hollow]){color:var(--color-text)}.hollow[color=white]:host,[color=white][hollow]:host,[color=white]:host([hollow]){color:var(--color-white)}.hollow[color=grey-50]:host,[color=grey-50][hollow]:host,[color=grey-50]:host([hollow]){color:var(--color-grey-50)}.hollow[color=grey-100]:host,[color=grey-100][hollow]:host,[color=grey-100]:host([hollow]){color:var(--color-grey-100)}.hollow[color=grey-200]:host,[color=grey-200][hollow]:host,[color=grey-200]:host([hollow]){color:var(--color-grey-200)}.hollow[color=grey-300]:host,[color=grey-300][hollow]:host,[color=grey-300]:host([hollow]){color:var(--color-grey-300)}.hollow[color=grey-400]:host,[color=grey-400][hollow]:host,[color=grey-400]:host([hollow]){color:var(--color-grey-400)}.hollow[color=grey-500]:host,[color=grey-500][hollow]:host,[color=grey-500]:host([hollow]){color:var(--color-grey-500)}.hollow[color=grey-600]:host,[color=grey-600][hollow]:host,[color=grey-600]:host([hollow]){color:var(--color-grey-600)}.hollow[color=grey-700]:host,[color=grey-700][hollow]:host,[color=grey-700]:host([hollow]){color:var(--color-grey-700)}.hollow[color=grey-800]:host,[color=grey-800][hollow]:host,[color=grey-800]:host([hollow]){color:var(--color-grey-800)}.hollow[color=grey-900]:host,[color=grey-900][hollow]:host,[color=grey-900]:host([hollow]){color:var(--color-grey-900)}.hollow[color=black]:host,[color=black][hollow]:host,[color=black]:host([hollow]){color:var(--color-black)}.hollow[color=error]:host,[color=error][hollow]:host,[color=error]:host([hollow]){color:var(--color-error)}:host([iconright]){position:relative;padding-right:0}:host([iconright]) .i:last-of-type,:host([iconright]) zen-icon{float:right;margin-right:0}:host .loading{position:relative;display:block;height:var(--loading-size, var(--size-main, 4rem));width:var(--loading-size, var(--size-main, 4rem))}:host .loading:before{content:'';background:var(--loading-color, var(--color-white, #fff));position:absolute;left:50%;width:var(--loading-size, var(--size-main, 4rem));height:var(--loading-size, var(--size-main, 4rem));margin-left:calc(var(--loading-size, var(--size-main, 4rem)) / -2);animation:loading-bounce infinite 1.5s ease-in-out}:host .loading:after{content:'';position:absolute;background:var(--loading-color, var(--color-white, #fff));display:inline-block;width:calc(var(--loading-size, var(--size-main, 4rem)) * 3 / 4);height:calc(var(--loading-size, var(--size-main, 4rem)) * 1 / 4);left:50%;margin-left:calc(var(--loading-size, var(--size-main, 4rem)) * -1.5 / 4);top:calc(100% + (var(--loading-size, var(--size-main, 4rem)) * 3 / 4));border-radius:50%;animation:loading-bounce-shadow infinite 1.5s ease-in-out;opacity:0.1}:host zen-icon{margin-right:var(--size-tiny, 1rem);vertical-align:middle}:host .loading{--loading-color: default('color-white');--loading-size: 1.5rem;position:absolute;top:0;left:50%;margin:auto;transform:translate(-50%, 1.5rem)}:host([size=tiny]){width:auto;height:var(--size-tiny, 1rem);line-height:var(--size-tiny, 1rem);font-size:calc((1.6/4) * var(--size-tiny, 1rem));padding:0 calc(var(--size-tiny, 1rem) / 2)}:host([size=small]){width:auto;height:var(--size-small, 2rem);line-height:var(--size-small, 2rem);font-size:calc((1.6/4) * var(--size-small, 2rem));padding:0 calc(var(--size-small, 2rem) / 2)}:host([size=medium]){width:auto;height:var(--size-medium, 3rem);line-height:var(--size-medium, 3rem);font-size:calc((1.6/4) * var(--size-medium, 3rem));padding:0 calc(var(--size-medium, 3rem) / 2)}:host([size=main]){width:auto;height:var(--size-main, 4rem);line-height:var(--size-main, 4rem);font-size:calc((1.6/4) * var(--size-main, 4rem));padding:0 calc(var(--size-main, 4rem) / 2)}:host([size=large]){width:auto;height:var(--size-large, 6rem);line-height:var(--size-large, 6rem);font-size:calc((1.6/4) * var(--size-large, 6rem));padding:0 calc(var(--size-large, 6rem) / 2)}:host([size=huge]){width:auto;height:var(--size-huge, 8rem);line-height:var(--size-huge, 8rem);font-size:calc((1.6/4) * var(--size-huge, 8rem));padding:0 calc(var(--size-huge, 8rem) / 2)}:host([size=super]){width:auto;height:var(--size-super, 12rem);line-height:var(--size-super, 12rem);font-size:calc((1.6/4) * var(--size-super, 12rem));padding:0 calc(var(--size-super, 12rem) / 2)}:host([size=hero]){width:auto;height:var(--size-hero, 24rem);line-height:var(--size-hero, 24rem);font-size:calc((1.6/4) * var(--size-hero, 24rem));padding:0 calc(var(--size-hero, 24rem) / 2)}:host([color="main"]){background:linear-gradient(to bottom right, var(--color-main-alt, #b155ba), var(--color-main, var(--color-purple, #693a91)))}:host([color="orange"]){background:linear-gradient(to bottom right, #FF9B54, #C95A54)}:host([color="red"]){background:linear-gradient(to bottom right, #FF5554, #C92954)}:host([color="green"]){background:linear-gradient(to bottom right, #84D59A, #00BED0)}:host([color="blue"]){background:linear-gradient(to bottom right, #008CBA, #6146C8)}:host([color="white"]){background:linear-gradient(to bottom right, var(--color-main-soft), #cacadf)}:host([color="gold"]){background:linear-gradient(to bottom right, #f1e35f, #da9124)}:host([disabled]){opacity:0.5;pointer-events:none}:host(:not([color]):not([hollow])){background-color:var(--btn-bg, linear-gradient(to bottom right, var(--color-main-alt, #b155ba), var(--color-main, var(--color-purple, #693a91))));background:var(--btn-bg, linear-gradient(to bottom right, var(--color-main-alt, #b155ba), var(--color-main, var(--color-purple, #693a91))))} </style>`;let Button=class extends LitElement{get _icon(){return this.shadowRoot.querySelector("zen-icon")}_render({icon:e,size:t,hollow:r}){return html$1` ${CSS} ${e?html$1`<zen-icon type="${e}" size="${t}" color="${this._iconColor}"></zen-icon>`:""} <slot>Submit</slot> `}get _iconColor(){return this.hollow&&this.color?this.color:this.hollow&&!this.color?"main":"white"}};Button._boundAttributes=["hollow","color","iconright","icon","disabled","size"],__decorate([dist_5,__metadata("design:type",String)],Button.prototype,"size",void 0),__decorate([dist_5,__metadata("design:type",Object)],Button.prototype,"icon",void 0),__decorate([dist_5,__metadata("design:type",Boolean)],Button.prototype,"iconright",void 0),__decorate([dist_5,__metadata("design:type",Boolean)],Button.prototype,"hollow",void 0),__decorate([dist_5,__metadata("design:type",String)],Button.prototype,"color",void 0),__decorate([dist_5,__metadata("design:type",Boolean)],Button.prototype,"disabled",void 0),__decorate([dist_5,__metadata("design:type",Boolean)],Button.prototype,"loading",void 0),Button=__decorate([component("zen-button"),bindAttributes],Button); //# sourceMappingURL=Button.js.map