{"size": 26064, "ext": "js", "max_stars_repo_path": "dist/css-vars-element.import.min.js", "max_stars_repo_name": "purtuga/theme-picker-element", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "dist/css-vars-element.import.min.js", "max_issues_repo_name": "purtuga/theme-picker-element", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "dist/css-vars-element.import.min.js", "max_forks_repo_name": "purtuga/theme-picker-element", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 13032.0, "max_line_length": 26008, "alphanum_fraction": 0.6883440761}
!function(e,t,r,n,o,i){if("customElements"in e)i();else{if(e.WC_ENV)return void e.WC_ENV.then(i);var s=function(e,r){var n=t.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){"loaded"!=n.readyState&&"complete"!=n.readyState||(n.onreadystatechange=null,r())}:n.onload=function(){r()},n.src=e,t.getElementsByTagName("head")[0].appendChild(n)},a=e.WC_ENV=function(){var e=[],t=function(e){try{e()}catch(e){console.error(e)}};return e.isDone=!1,e.exec=function(){e.splice(0).forEach(t)},e.then=function(t){return e.isDone?t():e.push(t),e},e}();a.then(i);var c=e.WC_POLYFILL||"//cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/2.0.2/webcomponents-bundle.js",l=0,u=function(){--l||(a.isDone=!0,a.exec())};"Reflect"in e||e.SKIP_ES_POLYFILL?(l++,s(c,u)):(l++,s(e.ES_POLYFILL||"//cdnjs.cloudflare.com/ajax/libs/core-js/2.5.3/core.min.js",function(){s(c,u)}),function(){try{new Function("function* test() {}")()}catch(e){return!1}return!0}()||e.regeneratorRuntime||(l++,s(window.GE_POLYFILL||n,u)))}}(window,document,0,"//unpkg.com/regenerator-runtime@0.12.1/runtime.js",0,function(){!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";function n(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}r.r(t);var o=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){(function(e){r.d(t,"a",function(){return n});const n="undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:Function("return this;")()}).call(this,r(3))},function(e,t){e.exports=WeakMap.WeakMap=WeakMap},function(e,t){e.exports=Symbol.Symbol=Symbol},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){r.r(t);const n=Function.bind.call.bind(Function.bind)(Function.call.bind,Function.call),o=n(Object.prototype.toString),i=e=>"[object Object]"===o(e),s=Object.defineProperty,a=(Object.defineProperties,Object.keys),c=(e,t,r,n,o,i=!0,a=!1,c=!0)=>{const l={configurable:i,enumerable:a};return n||o?(l.get=n,l.set=o):(l.writable=c,l.value=r),s(e,t,l),e},l=[],u=Array.isArray,d=(n(l.forEach),n(l.indexOf),n(l.splice),n(l.slice),console.log),h=(console.error,console.warn||d),f=("undefined"!=typeof Symbol&&Symbol.iterator&&Symbol.iterator,HTMLElement.prototype),p=document,m=p.head,y=e=>p.createElement(e);n(f.appendChild),n(f.insertBefore),n(f.hasAttribute),n(f.getAttribute),n(f.setAttribute),n(f.removeAttribute);var b=function e(t,...r){let n,o,s=t||{},a=r.length,c=!1;for("boolean"==typeof t&&(c=t,s=r.shift()||{},a=r.length),n=0;n<a;n++)if(r[n])for(o in r[n])r[n].hasOwnProperty(o)&&(c&&i(s[o])&&i(r[n][o])?s[o]=e(!0,s[o],r[n][o]):s[o]=r[n][o]);return s};let g=/native code/i,v=function(){if("undefined"!=typeof setImediate&&g.test(setImediate.toString()))return setImediate;if("function"==typeof Promise&&g.test(Promise.toString())){let e=Promise.resolve();return function(t){e.then(t).catch(e=>console.error(e))}}let e=[],t=!1;return function(r){e.push(r),t||(t=!0,function r(){setTimeout(function(){e.shift()(),e.length?r():t=!1},0)}())}}(),w=!1;const k=new Set;let S,x;const E=()=>{const e=[...k];for(k.clear(),w=!1,S=0,x=e.length;S<x;S++)e[S]()};function C(e){if(e.constructor&&e===e.constructor.prototype)throw new Error("Can not be accessed directly on constructor.prototype!")}v.queue=(e=>{k.add(e),w||(w=!0,v(E))});var A=function(e,t,r,n){let o=t.split(/\s+/),i={};return o.forEach(t=>{e.addEventListener(t,r,n),i[t]={remove:()=>e.removeEventListener(t,r,n)}}),Object.create({listeners:i,remove:function(){o.forEach(e=>i[e].remove())}})};function j(e,t){return Array.prototype.slice.call(e.querySelectorAll(t))}var O=j,T=r(1),M=(new T.WeakMap,function(){return new T.WeakMap});const _=Symbol("state");class P{on(e,t){return $(this,e).add(t),()=>$(this,e).delete(t)}emit(e,t){$(this,e).forEach(e=>e(t))}clear(){$(this).clear()}}function $(e,t){return e[_]||(e[_]=new Map),t?(e[_].has(t)||e[_].set(t,new Set),e[_].get(t)):e[_]}var D=r(2);const F=M(),L=Object(D.Symbol)("state");function N(e,t){return t.aliases.some(t=>e.hasAttribute(t))}function z(e){if(!F.has(e)){let t={isCssScopingDone:!1,templateEle:null,ev:new P,destroyCallbacks:[],destroyQueued:null,isMounted:!1};F.set(e,t)}return F.get(e)}function I(e){let t=R(e);if(!t.propsDef){const r=t.propsDef={},n=e.propsDef;n&&a(n).forEach(e=>{if(r[e]=n[e],u(r[e].aliases)){const t=b({},n[e],{_isAlias:!0});r[e].aliases.forEach(e=>!r[e]&&(r[e]=t))}})}return t.propsDef}function R(e){return F.has(e)||F.set(e,{propsDef:null,templateEle:null,observedAttrs:null}),F.get(e)}var q=r(0);const B=()=>!!q.a.ShadyCSS,H=e=>e.parentNode.removeChild(e),U=e=>"string"==typeof e;function V(){return(m.createShadowRoot||m.attachShadow)&&(!B()||q.a.ShadyCSS.nativeShadow)}const Q=m.createShadowRoot||m.attachShadow,W={bubbles:!0,cancelable:!0,composed:!0},Y=window.customElements,Z=Object.freeze(Object.create(null)),G=Symbol("ev.props.any");let K=!1;class J extends HTMLElement{constructor(...e){const t=super(...e)||this;return function(e){const{useShadow:t,shadowMode:r}=e.constructor;t&&Q?e.shadowRoot?e._$ui=e.shadowRoot:e._$ui=e.attachShadow({mode:r}):e._$ui=e,e.onPropsChange(e._queueUpdate),e.didInit()}(t),t}static get tagName(){throw new Error("tagName not defined")}static define(e){e=e||this.tagName,Y.get(e)?Y.get(e)!==this&&h(`${e} is already a defined in customElementsRegistry as a different Class`):Y.define(e,this)}static get delayDestroy(){return 0}static get useShadow(){return!0}static get shadowMode(){return"open"}static get template(){return"<div></div>"}static renderTemplate(){}static get eventInitOptions(){return W}static get observedAttributes(){let e=R(this);if(!e.observedAttrs){const t=I(this);e.observedAttrs=a(t).filter(e=>t[e].attr)}return e.observedAttrs}get props(){if(C(this),K)return;K=!0;const e=I(this.constructor);let t={};const r=z(this).ev,n=()=>r.emit(G);return a(e).forEach(o=>{if(!e[o]||!e[o]._isAlias){const i=()=>r.emit(o);let s=e[o].default.call(this);e[o].attr&&!e[o].boolean&&N(this,e[o])?s=function(e,t){let r="";return t.aliases.some(t=>{if(e.hasAttribute(t))return r=e.getAttribute(t),!0}),r}(this,e[o]):this.hasOwnProperty(o)&&(s=this[o],delete this[o]),c(t,o,void 0,function(){return s},t=>(t=e[o].filter.call(this,t),v.queue(i),v.queue(n),s=t),!0,!0)}}),c(this,"props",t,void 0,void 0,!0,!0,!1),K=!1,t}get hasRequiredProps(){return C(this),a(this.constructor.propsDef).filter(e=>this.constructor.propsDef[e].required).every(e=>!!this.props[e])}get isMounted(){return C(this),z(this).isMounted}get $ui(){return this._$ui}destroy(){if(F.has(this)){const e=z(this);F.delete(this),e.destroyQueued&&(clearTimeout(e.destroyQueued),e.destroyQueued=null),e.destroyCallbacks.splice(0).forEach(e=>e())}this.parentNode&&this.parentNode.removeChild(this),this.didDestroy()}onDestroy(e){z(this).destroyCallbacks.push(e)}$(e){return this.$ui.querySelector(e)}$$(e){return O(this.$ui,e)}get update(){if(C(this),K)return;const e=()=>{if(!this.isMounted)return;const e=this.willRender();("boolean"!=typeof e||e)&&(this._setView(this.render()),this.didRender())};return K=!0,c(this,"update",e),K=!1,e}get _queueUpdate(){if(C(this),K)return;const e=()=>{v.queue(this.update)};return K=!0,c(this,"_queueUpdate",e),K=!1,e}_setView(e){let t=e;V()||(t=function(e,t){if(B()){const r=U(e),n=R(t.constructor);let o,{templateEle:i}=n;return i||(n.templateEle=i=y("template"),r?i.innerHTML=e:i.appendChild(e.cloneNode(!0)),function(e,t){B()&&q.a.ShadyCSS.prepareTemplate(e,t.constructor.tagName)}(i,t)),r?(i.innerHTML=e,o=document.importNode(i.content,!0),i.textContent=""):o=e,o.content||(o.content=o),q.a.ShadyCSS.prepareTemplateDom(o,t.constructor.tagName),j(o,"style").forEach(H),o}}(e,this)||e),"string"==typeof t?this.$ui.innerHTML=t:(this.$ui.textContent="",this.$ui.appendChild(t))}didInit(){"init"in this&&this.init()}didMount(){"ready"in this&&this.ready(),"mounted"in this&&this.mounted()}willRender(){}render(){return"<span></span>"}didRender(){}didUnmount(){"unmounted"in this&&this.unmounted()}didDestroy(){}emit(e,t,r){const n=e.toLowerCase(),o=new CustomEvent(e,b({},this.constructor.eventInitOptions,r,{detail:t}));"function"==typeof this[n]&&this[n](o),this.dispatchEvent(o)}on(e,t,r){return A(this,e,t,r)}onPropsChange(e,t){return z(this).ev.on(t||G,e)}attributeChangedCallback(e,t,r){const n=I(this.constructor);n[e]&&(e=n[e].name),this.props[e]=r}connectedCallback(){const e=z(this);e.destroyQueued&&(clearTimeout(e.destroyQueued),e.destroyQueued=null),V()||function(e){B()&&q.a.ShadyCSS.styleElement(e)}(this),e.isMounted=!0,this.didMount(),this._queueUpdate()}disconnectedCallback(){if(F.has(this)){const e=z(this);e.destroyQueued||(e.destroyQueued=setTimeout(this.destroy.bind(this),this.constructor.delayDestroy)),e.isMounted=!1}this.didUnmount()}}!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(J,"propsDef",Z);const X=/[A-Z]/,ee=e=>e;function te(e={}){return e.key&&e.kind?re({},e):re.bind(null,e)}function re(e,{key:t,initializer:r,descriptor:n}){const o=function(e,t,r,n){const o=b({name:e,attr:!1,required:!1,boolean:!1,default:t||ee,filter:r||ee,aliases:[]},n);return o.boolean&&(o.attr=!0,o.default=o.filter=function(){return N(this,o)}),e.toLowerCase()!==e&&o.aliases.push(e.toLowerCase()),X.test(e)&&o.aliases.push(function(e){return e.replace(/([A-Z])/g,(e,t)=>"-"+t.toLowerCase())}(e)),o}(t,r||n.get,n.set,e),i=ne(t,t,o);return o.aliases&&(i.extras=o.aliases.map(e=>ne(e,t))),i}function ne(e,t,r){const n={key:e,kind:"method",placement:"prototype",descriptor:{configurable:!0,get(){return C(this),this.props[t]},set(e){return C(this),this.props[t]=e}}};return r&&(n.finisher=function(t){t.hasOwnProperty("propsDef")||c(t,"propsDef",b(Object.create(null),t.propsDef)),t.propsDef[e]=r}),n}function oe(e){return e.key&&e.kind?ie(e):ie}function ie(e){const{kind:t,key:r,descriptor:n}=e;if("method"===t&&n.value){let e=!1;const t=n.value;delete n.value,delete n.writable,n.get=function(){if(C(this),e)return;e=!0;const n=t.bind(this);return c(this,r,n),e=!1,n}}return e}r.d(t,"ComponentElement",function(){return J}),r.d(t,"prop",function(){return te}),r.d(t,"bind",function(){return oe}),r.d(t,"getState",function(){return z}),r.d(t,"STATE_SYMBOL",function(){return L}),r.d(t,"default",function(){return J})}]);o.getState;const i=o.STATE_SYMBOL;o.default;const s=o.ComponentElement,a=o.prop,c=o.bind;function l(e,t){return Array.prototype.slice.call(e.querySelectorAll(t))}function u(e,t){return!(!e||!t)&&(e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector).call(e,t)}const d=Function.bind.call.bind(Function.bind)(Function.call.bind,Function.call),h=(d(Object.prototype.toString),Object.defineProperty,Object.defineProperties,Object.keys),f=[],p=(Array.isArray,d(f.forEach),d(f.indexOf),d(f.splice),d(f.slice),console.log),m=(console.error,console.warn,"undefined"!=typeof Symbol&&Symbol.iterator&&Symbol.iterator,HTMLElement.prototype),y=document,b=(y.head,e=>y.createElement(e)),g=e=>y.createTextNode(e||""),v=d(m.appendChild),w=(d(m.insertBefore),d(m.hasAttribute),d(m.getAttribute),d(m.setAttribute),d(m.removeAttribute),Object.freeze({"--theme-color-0":"#FFFFFF","--theme-color-1":"#ECECEC","--theme-color-2":"#DCDCDC","--theme-color-3":"#C5C5C5","--theme-color-4":"#ADADAD","--theme-color-5":"#8A8A8A","--theme-color-6":"#656565","--theme-color-7":"#565656","--theme-color-8":"#2D2D2D","--theme-color-9":"#000000","--theme-color-accent-info-0":"#def3ff","--theme-color-accent-info-1":"#bee1f4","--theme-color-accent-info-2":"#39a5dc","--theme-color-accent-info-3":"#0088ce","--theme-color-accent-info-4":"#00659c","--theme-color-accent-success-0":"#cfe7cd","--theme-color-accent-success-1":"#9ecf99","--theme-color-accent-success-2":"#6ec664","--theme-color-accent-success-3":"#3f9c35","--theme-color-accent-success-4":"#2d7623","--theme-color-accent-alert-0":"#fcf6e3","--theme-color-accent-alert-1":"#f9e4a4","--theme-color-accent-alert-2":"#f9d463","--theme-color-accent-alert-3":"#f9c62c","--theme-color-accent-alert-4":"#dda600","--theme-color-accent-warning-0":"#ffe2af","--theme-color-accent-warning-1":"#ffc57a","--theme-color-accent-warning-2":"#ffa86b","--theme-color-accent-warning-3":"#ff8330","--theme-color-accent-warning-4":"#f4581f","--theme-color-accent-error-0":"#F9CACA","--theme-color-accent-error-1":"#FF7A7A","--theme-color-accent-error-2":"#FF4B4B","--theme-color-accent-error-3":"#FF171A","--theme-color-accent-error-4":"#BD1818","--theme-color-bg":"var(--theme-color-0)","--theme-color-fg":"var(--theme-color-8)","--theme-color-link":"var(--theme-color-accent-info-3)","--theme-color-msg-success-bg":"var(--theme-color-accent-success-0)","--theme-color-msg-success-fg":"var(--theme-color-accent-success-4)","--theme-color-msg-alert-bg":"var(--theme-color-accent-alert-0)","--theme-color-msg-alert-fg":"var(--theme-color-accent-alert-4)","--theme-color-msg-warning-bg":"var(--theme-color-accent-warning-0)","--theme-color-msg-warning-fg":"var(--theme-color-accent-warning-4)","--theme-color-msg-info-bg":"var(--theme-color-accent-info-0)","--theme-color-msg-info-fg":"var(--theme-color-accent-info-4)","--theme-color-msg-error-bg":"var(--theme-color-accent-error-0)","--theme-color-msg-error-fg":"var(--theme-color-accent-error-4)","--theme-font-size-xxl":"28px","--theme-font-size-xl":"22px","--theme-font-size-l":"18px","--theme-font-size-m":"16px","--theme-font-size-s":"14px","--theme-font-size-xs":"11px","--theme-font-size":"var(--theme-font-size-m)","--theme-font-family":'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',"--theme-font-family-monospace":'SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',"--theme-border-style":"solid","--theme-border-width":"1px","--theme-border-color":"var(--theme-color-5)","--theme-border-color-light":"var(--theme-color-4)","--theme-border-radius-sm":"3px","--theme-border-radius-md":"6px","--theme-border-radius-lg":"12px","--theme-border-radius-xl":"24px","--theme-border-radius":"var(--theme-border-radius-md)","--theme-border":"var(--theme-border-width) var(--theme-border-style) var(--theme-border-color)","--theme-border-light":"var(--theme-border-width) var(--theme-border-style) var(--theme-border-color-light)","--theme-spacing-0":"0","--theme-spacing-1":"0.25rem","--theme-spacing-2":"0.5rem","--theme-spacing-3":"0.75rem","--theme-spacing-4":"1rem","--theme-spacing-5":"1.25rem","--theme-spacing-6":"1.5rem","--theme-spacing-7":"1.75rem","--theme-spacing-8":"2rem","--theme-spacing-9":"2.25rem","--theme-spacing":"var(--theme-spacing-2)","--theme-box-shadow-n":"0 -8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2)","--theme-box-shadow-e":"8px 0 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2)","--theme-box-shadow-s":"0 8px 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2)","--theme-box-shadow-w":"-8px 0 10px 1px rgba(0,0,0,0.14), 0 3px 14px 2px rgba(0,0,0,0.12), 0 5px 5px -3px rgba(0,0,0,0.2)","--theme-box-shadow":"var(--theme-box-shadow-s)"}));function k(e){var t,r=F(e.key);"method"===e.kind?(t={value:e.value,writable:!0,configurable:!0,enumerable:!1},Object.defineProperty(e.value,"name",{value:"symbol"==typeof r?"":r,configurable:!0})):"get"===e.kind?t={get:e.value,configurable:!0,enumerable:!1}:"set"===e.kind?t={set:e.value,configurable:!0,enumerable:!1}:"field"===e.kind&&(t={configurable:!0,writable:!0,enumerable:!0});var n={kind:"field"===e.kind?"field":"method",key:r,placement:e.static?"static":"field"===e.kind?"own":"prototype",descriptor:t};return e.decorators&&(n.decorators=e.decorators),"field"===e.kind&&(n.initializer=e.value),n}function S(e,t){void 0!==e.descriptor.get?t.descriptor.get=e.descriptor.get:t.descriptor.set=e.descriptor.set}function x(e){return e.decorators&&e.decorators.length}function E(e){return void 0!==e&&!(void 0===e.value&&void 0===e.writable)}function C(e,t){var r=t.descriptor;if("field"===t.kind){var n=t.initializer;r={enumerable:r.enumerable,writable:r.writable,configurable:r.configurable,value:void 0===n?void 0:n.call(e)}}Object.defineProperty(e,t.key,r)}function A(e,t,r){var n=t[e.placement];if(!r&&-1!==n.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");n.push(e.key)}function j(e){var t={kind:e.kind,key:e.key,placement:e.placement,descriptor:e.descriptor};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),"field"===e.kind&&(t.initializer=e.initializer),t}function O(e){if(void 0!==e)return n(e).map(function(e){var t=T(e);return $(e,"finisher","An element descriptor"),$(e,"extras","An element descriptor"),t})}function T(e){var t=String(e.kind);if("method"!==t&&"field"!==t)throw new TypeError('An element descriptor\'s .kind property must be either "method" or "field", but a decorator created an element descriptor with .kind "'+t+'"');var r=F(e.key),n=String(e.placement);if("static"!==n&&"prototype"!==n&&"own"!==n)throw new TypeError('An element descriptor\'s .placement property must be one of "static", "prototype" or "own", but a decorator created an element descriptor with .placement "'+n+'"');var o=e.descriptor;$(e,"elements","An element descriptor");var i={kind:t,key:r,placement:n,descriptor:Object.assign({},o)};return"field"!==t?$(e,"initializer","A method descriptor"):($(o,"get","The property descriptor of a field descriptor"),$(o,"set","The property descriptor of a field descriptor"),$(o,"value","The property descriptor of a field descriptor"),i.initializer=e.initializer),i}function M(e){return{element:T(e),finisher:D(e,"finisher"),extras:O(e.extras)}}function _(e){var t={kind:"class",elements:e.map(j)};return Object.defineProperty(t,Symbol.toStringTag,{value:"Descriptor",configurable:!0}),t}function P(e){var t=String(e.kind);if("class"!==t)throw new TypeError('A class descriptor\'s .kind property must be "class", but a decorator created a class descriptor with .kind "'+t+'"');$(e,"key","A class descriptor"),$(e,"placement","A class descriptor"),$(e,"descriptor","A class descriptor"),$(e,"initializer","A class descriptor"),$(e,"extras","A class descriptor");var r=D(e,"finisher");return{elements:O(e.elements),finisher:r}}function $(e,t,r){if(void 0!==e[t])throw new TypeError(r+" can't have a ."+t+" property.")}function D(e,t){var r=e[t];if(void 0!==r&&"function"!=typeof r)throw new TypeError("Expected '"+t+"' to be a function");return r}function F(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}const L=h(w),N=L.reduce((e,t)=>e+=`${t}: ${w[t]};`+"\n",""),z=e=>Object.entries(e).reduce((e,[t,r])=>e+=`${t}: ${r};`,""),I=e=>u(e,":root");let R=function(e,t,r){var n=t(function(e){!function(e,t){["method","field"].forEach(function(r){t.forEach(function(t){t.kind===r&&"own"===t.placement&&C(e,t)})})}(e,o.elements)},r),o=function(e,t){var r=[],n=[],o={static:[],prototype:[],own:[]};if(e.forEach(function(e){A(e,o)}),e.forEach(function(e){if(!x(e))return r.push(e);var t=function(e,t){for(var r=[],n=[],o=e.decorators,i=o.length-1;i>=0;i--){var s=t[e.placement];s.splice(s.indexOf(e.key),1);var a=j(e),c=M((0,o[i])(a)||a);A(e=c.element,t),c.finisher&&n.push(c.finisher);var l=c.extras;if(l){for(var u=0;u<l.length;u++)A(l[u],t);r.push.apply(r,l)}}return{element:e,finishers:n,extras:r}}(e,o);r.push(t.element),r.push.apply(r,t.extras),n.push.apply(n,t.finishers)}),!t)return{elements:r,finishers:n};var i=function(e,t){for(var r=[],n=t.length-1;n>=0;n--){var o=_(e),i=P((0,t[n])(o)||o);if(void 0!==i.finisher&&r.push(i.finisher),void 0!==i.elements){e=i.elements;for(var s=0;s<e.length-1;s++)for(var a=s+1;a<e.length;a++)if(e[s].key===e[a].key&&e[s].placement===e[a].placement)throw new TypeError("Duplicated element ("+e[s].key+")")}}return{elements:e,finishers:r}}(r,t);return n.push.apply(n,i.finishers),i.finishers=n,i}(function(e){for(var t=[],r=function(e){return"method"===e.kind&&e.key===i.key&&e.placement===i.placement},n=0;n<e.length;n++){var o,i=e[n];if("method"===i.kind&&(o=t.find(r)))if(E(i.descriptor)||E(o.descriptor)){if(x(i)||x(o))throw new ReferenceError("Duplicated methods ("+i.key+") can't be decorated.");o.descriptor=i.descriptor}else{if(x(i)){if(x(o))throw new ReferenceError("Decorators can't be placed on different accessors with for the same property ("+i.key+").");o.decorators=i.decorators}S(i,o)}else t.push(i)}return t}(n.d.map(k)),e);return function(e,t){var r=e.prototype;["method","field"].forEach(function(n){t.forEach(function(t){var o=t.placement;if(t.kind===n&&("static"===o||"prototype"===o)){var i="static"===o?e:r;C(i,t)}})})}(n.F,o.elements),function(e,t){for(var r=0;r<t.length;r++){var n=(0,t[r])(e);if(void 0!==n){if("function"!=typeof n)throw new TypeError("Finishers must return a constructor.");e=n}}return e}(n.F,o.finishers)}(null,function(e,t){return{F:class extends t{constructor(...t){super(...t),e(this)}},d:[{kind:"field",static:!0,key:"tagName",value:()=>"css-vars"},{kind:"field",static:!0,key:"defaultVars",value:()=>w},{kind:"get",static:!0,key:"varNames",value:()=>L.slice(0)},{kind:"method",key:"render",value:()=>`\n<style>\n:host {\n    display: block;\n}\n</style>\n<style vars>\n:host {\n    ${N}\n}\n</style>\n<slot></slot>`},{kind:"get",decorators:[a],key:"vars",value:()=>w},{kind:"set",key:"vars",value:e=>("object"!=typeof e&&(console.warn("vars prop must be an object!"),e={}),e)},{kind:"get",decorators:[a({attr:!0})],key:"target",value:()=>null},{kind:"method",key:"didInit",value(){this[i]={priorTarget:null,$targets:null,$style:null},this.on("themeChange",this),this.onPropsChange(this._handleCustomVarsChange,"vars"),this.onPropsChange(this._handleTargetChange,"target")}},{kind:"method",key:"didRender",value(){this._varStyleEle=this.$("style[vars]"),this._handleCustomVarsChange(),this._handleTargetChange()}},{kind:"method",key:"didUnmount",value(){U(this),V(this)}},{kind:"method",decorators:[c],key:"_handleCustomVarsChange",value(){B(this,this.vars,!1),q(this,this.props.vars),U(this),H(this)}},{kind:"method",decorators:[c],key:"_handleTargetChange",value(){this[i].priorTarget&&this[i].priorTarget!==this.props.target&&(U(this),V(this)),this.props.target&&H(this)}},{kind:"method",key:"handleEvent",value(e){"themeChange"===e.type&&e.detail&&(this.clear(),this.props.vars=e.detail&&e.detail.theme?e.detail.theme:e.detail)}},{kind:"method",key:"clear",value(){this.props.vars&&B(this,this.props.vars),this.props.vars={}}},{kind:"method",key:"getVarNames",value(){return this.constructor.varNames}}]}},s);function q(e,t,r=!0){const n=h(t);n.length&&(e._varStyleEle?(e._varStyleEle.innerHTML="",v(e._varStyleEle,g(`\n:host {\n${z(t)}\n}\n`))):"STYLE"===e.tagName?(e.innerHTML="",v(e,g(`\n:root {\n${z(t)} \n}\n`))):n.forEach(r=>{e.style.setProperty(r,t[r])}),r&&e.emit&&e.emit("change",null,{bubble:!0}))}function B(e,t,r=!0){const n=h(t);n.length&&(n.forEach(t=>{"STYLE"===e.tagName?e.innerHTML="":e.style.removeProperty(t)}),r&&e.emit&&e.emit("change",null,{bubble:!0}))}function H(e){const t=e[i],{target:r,vars:n}=e.props;r&&(t.$targets||(t.$targets="string"==typeof r?l(y,r):[r]),t.$targets.forEach(e=>{I(e)&&(t.$style||(t.$style=function(e){const t=b("style"),r=y.head;t.type="text/css",v(t,g(e)),r.hasChildNodes()?r.insertBefore(t,r.firstChild):v(r,t);return t}("")),e=t.$style),q(e,n,!1)}),e[i].priorTarget=r)}function U(e){const t=e[i];t.$targets&&t.$targets.forEach(r=>{I(r)&&(r=t.$style),B(r,e.props.vars,!1)})}function V(e){const t=e[i];t.$style&&(t.$style.parentNode.removeChild(t.$style),t.$style=null),t.$targets&&(t.$targets=null)}R.define()}])});
//# sourceMappingURL=css-vars-element.import.min.js.map