@telperion/elements 5.3.1 → 5.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-manifest.json +1 -1
- package/README.md +3 -0
- package/_chunks/shade-mixer-lit-element-sw8t_VC5.d.cts +50 -0
- package/_chunks/shade-mixer-lit-element-sw8t_VC5.d.ts +50 -0
- package/_chunks/{signal-watcher-lit-element-B9xodkLt.d.cts → signal-watcher-lit-element-B-vV0yNG.d.ts} +7 -1
- package/_chunks/{signal-watcher-lit-element-B9xodkLt.d.ts → signal-watcher-lit-element-B5xCaa26.d.cts} +7 -1
- package/button/index.d.cts +2 -48
- package/button/index.d.ts +2 -48
- package/fesm/elements.mjs +205 -159
- package/fesm/elements.mjs.map +1 -1
- package/iife/elements.js +114 -106
- package/iife/elements.js.map +1 -1
- package/iife/router/index.js +64 -21
- package/iife/router/index.js.map +1 -1
- package/iife/select/index.js +179 -127
- package/iife/select/index.js.map +1 -1
- package/index.d.cts +2 -1
- package/index.d.ts +2 -1
- package/package.json +1 -1
- package/router/index.d.cts +2 -1
- package/router/index.d.ts +2 -1
- package/select/index.d.cts +33 -3
- package/select/index.d.ts +33 -3
- package/select/select.element.cjs +90 -44
- package/select/select.element.cjs.map +1 -1
- package/select/select.element.js +91 -45
- package/select/select.element.js.map +1 -1
- package/utils/signal-watcher-lit-element.cjs +3 -0
- package/utils/signal-watcher-lit-element.cjs.map +1 -1
- package/utils/signal-watcher-lit-element.js +3 -1
- package/utils/signal-watcher-lit-element.js.map +1 -1
package/iife/router/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
this.TelperionElements=this.TelperionElements||{},function(t){"use strict";function e(t,e,r,
|
|
1
|
+
this.TelperionElements=this.TelperionElements||{},function(t){"use strict";function e(t,e,r,o){var n,i=arguments.length,s=i<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,o);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(i<3?n(s):i>3?n(e,r,s):n(e,r))||s);return i>3&&s&&Object.defineProperty(e,r,s),s}function r(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
5
5
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
6
|
*/
|
|
7
|
-
const
|
|
7
|
+
const o=globalThis,n=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;let a=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const r=void 0!==e&&1===e.length;r&&(t=s.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&s.set(e,t))}return t}toString(){return this.cssText}};const c=(t,...e)=>{const r=1===t.length?t[0]:e.reduce((e,r,o)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+t[o+1],t[0]);return new a(r,t,i)},l=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:h,defineProperty:u,getOwnPropertyDescriptor:d,getOwnPropertyNames:p,getOwnPropertySymbols:f,getPrototypeOf:v}=Object,m=globalThis,y=m.trustedTypes,g=y?y.emptyScript:"",$=m.reactiveElementPolyfillSupport,_=(t,e)=>t,b={toAttribute(t,e){switch(e){case Boolean:t=t?g:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},S=(t,e)=>!h(t,e),w={attribute:!0,type:String,converter:b,reflect:!1,useDefault:!1,hasChanged:S};
|
|
8
8
|
/**
|
|
9
9
|
* @license
|
|
10
10
|
* Copyright 2017 Google LLC
|
|
11
11
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
-
*/Symbol.metadata??=Symbol("metadata"),
|
|
12
|
+
*/Symbol.metadata??=Symbol("metadata"),m.litPropertyMetadata??=new WeakMap;let C=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=w){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),o=this.getPropertyDescriptor(t,r,e);void 0!==o&&u(this.prototype,t,o)}}static getPropertyDescriptor(t,e,r){const{get:o,set:n}=d(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:o,set(e){const i=o?.call(this);n?.call(this,e),this.requestUpdate(t,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??w}static _$Ei(){if(this.hasOwnProperty(_("elementProperties")))return;const t=v(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(_("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_("properties"))){const t=this.properties,e=[...p(t),...f(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const r=this._$Eu(t,e);void 0!==r&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(n)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const r of e){const e=document.createElement("style"),n=o.litNonce;void 0!==n&&e.setAttribute("nonce",n),e.textContent=r.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$ET(t,e){const r=this.constructor.elementProperties.get(t),o=this.constructor._$Eu(t,r);if(void 0!==o&&!0===r.reflect){const n=(void 0!==r.converter?.toAttribute?r.converter:b).toAttribute(e,r.type);this._$Em=t,null==n?this.removeAttribute(o):this.setAttribute(o,n),this._$Em=null}}_$AK(t,e){const r=this.constructor,o=r._$Eh.get(t);if(void 0!==o&&this._$Em!==o){const t=r.getPropertyOptions(o),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:b;this._$Em=o;const i=n.fromAttribute(e,t.type);this[o]=i??this._$Ej?.get(o)??i,this._$Em=null}}requestUpdate(t,e,r){if(void 0!==t){const o=this.constructor,n=this[t];if(r??=o.getPropertyOptions(t),!((r.hasChanged??S)(n,e)||r.useDefault&&r.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:o,wrapped:n},i){r&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==n||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||r||(e=void 0),this._$AL.set(t,e)),!0===o&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t){const{wrapped:t}=r,o=this[e];!0!==t||this._$AL.has(e)||void 0===o||this.C(e,void 0,r,o)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};C.elementStyles=[],C.shadowRootOptions={mode:"open"},C[_("elementProperties")]=new Map,C[_("finalized")]=new Map,$?.({ReactiveElement:C}),(m.reactiveElementVersions??=[]).push("2.1.1");
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
|
15
15
|
* Copyright 2017 Google LLC
|
|
16
16
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
17
|
*/
|
|
18
|
-
const A=globalThis,E=A.trustedTypes,R=E?E.createPolicy("lit-html",{createHTML:t=>t}):void 0,T="$lit$",
|
|
18
|
+
const A=globalThis,E=A.trustedTypes,R=E?E.createPolicy("lit-html",{createHTML:t=>t}):void 0,T="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,O="?"+k,x=`<${O}>`,N=document,P=()=>N.createComment(""),U=t=>null===t||"object"!=typeof t&&"function"!=typeof t,M=Array.isArray,I="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,W=/>/g,j=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,V=/"/g,q=/^(?:script|style|textarea|title)$/i,z=(t=>(e,...r)=>({_$litType$:t,strings:e,values:r}))(1),B=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),F=new WeakMap,G=N.createTreeWalker(N,129);function K(t,e){if(!M(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==R?R.createHTML(e):e}const Y=(t,e)=>{const r=t.length-1,o=[];let n,i=2===e?"<svg>":3===e?"<math>":"",s=H;for(let e=0;e<r;e++){const r=t[e];let a,c,l=-1,h=0;for(;h<r.length&&(s.lastIndex=h,c=s.exec(r),null!==c);)h=s.lastIndex,s===H?"!--"===c[1]?s=L:void 0!==c[1]?s=W:void 0!==c[2]?(q.test(c[2])&&(n=RegExp("</"+c[2],"g")),s=j):void 0!==c[3]&&(s=j):s===j?">"===c[0]?(s=n??H,l=-1):void 0===c[1]?l=-2:(l=s.lastIndex-c[2].length,a=c[1],s=void 0===c[3]?j:'"'===c[3]?V:D):s===V||s===D?s=j:s===L||s===W?s=H:(s=j,n=void 0);const u=s===j&&t[e+1].startsWith("/>")?" ":"";i+=s===H?r+x:l>=0?(o.push(a),r.slice(0,l)+T+r.slice(l)+k+u):r+k+(-2===l?e:u)}return[K(t,i+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),o]};class Z{constructor({strings:t,_$litType$:e},r){let o;this.parts=[];let n=0,i=0;const s=t.length-1,a=this.parts,[c,l]=Y(t,e);if(this.el=Z.createElement(c,r),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(o=G.nextNode())&&a.length<s;){if(1===o.nodeType){if(o.hasAttributes())for(const t of o.getAttributeNames())if(t.endsWith(T)){const e=l[i++],r=o.getAttribute(t).split(k),s=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:s[2],strings:r,ctor:"."===s[1]?rt:"?"===s[1]?ot:"@"===s[1]?nt:et}),o.removeAttribute(t)}else t.startsWith(k)&&(a.push({type:6,index:n}),o.removeAttribute(t));if(q.test(o.tagName)){const t=o.textContent.split(k),e=t.length-1;if(e>0){o.textContent=E?E.emptyScript:"";for(let r=0;r<e;r++)o.append(t[r],P()),G.nextNode(),a.push({type:2,index:++n});o.append(t[e],P())}}}else if(8===o.nodeType)if(o.data===O)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=o.data.indexOf(k,t+1));)a.push({type:7,index:n}),t+=k.length-1}n++}}static createElement(t,e){const r=N.createElement("template");return r.innerHTML=t,r}}function Q(t,e,r=t,o){if(e===B)return e;let n=void 0!==o?r._$Co?.[o]:r._$Cl;const i=U(e)?void 0:e._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),void 0===i?n=void 0:(n=new i(t),n._$AT(t,r,o)),void 0!==o?(r._$Co??=[])[o]=n:r._$Cl=n),void 0!==n&&(e=Q(t,n._$AS(t,e.values),n,o)),e}class X{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,o=(t?.creationScope??N).importNode(e,!0);G.currentNode=o;let n=G.nextNode(),i=0,s=0,a=r[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new tt(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new it(n,this,t)),this._$AV.push(e),a=r[++s]}i!==a?.index&&(n=G.nextNode(),i++)}return G.currentNode=N,o}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class tt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,o){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Q(this,t,e),U(t)?t===J||null==t||""===t?(this._$AH!==J&&this._$AR(),this._$AH=J):t!==this._$AH&&t!==B&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>M(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==J&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(N.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,o="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=Z.createElement(K(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===o)this._$AH.p(e);else{const t=new X(o,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=F.get(t.strings);return void 0===e&&F.set(t.strings,e=new Z(t)),e}k(t){M(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,o=0;for(const n of t)o===e.length?e.push(r=new tt(this.O(P()),this.O(P()),this,this.options)):r=e[o],r._$AI(n),o++;o<e.length&&(this._$AR(r&&r._$AB.nextSibling,o),e.length=o)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class et{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,o,n){this.type=1,this._$AH=J,this._$AN=void 0,this.element=t,this.name=e,this._$AM=o,this.options=n,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=J}_$AI(t,e=this,r,o){const n=this.strings;let i=!1;if(void 0===n)t=Q(this,t,e,0),i=!U(t)||t!==this._$AH&&t!==B,i&&(this._$AH=t);else{const o=t;let s,a;for(t=n[0],s=0;s<n.length-1;s++)a=Q(this,o[r+s],e,s),a===B&&(a=this._$AH[s]),i||=!U(a)||a!==this._$AH[s],a===J?t=J:t!==J&&(t+=(a??"")+n[s+1]),this._$AH[s]=a}i&&!o&&this.j(t)}j(t){t===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends et{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===J?void 0:t}}class ot extends et{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==J)}}class nt extends et{constructor(t,e,r,o,n){super(t,e,r,o,n),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??J)===B)return;const r=this._$AH,o=t===J&&r!==J||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,n=t!==J&&(r===J||o);o&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const st=A.litHtmlPolyfillSupport;st?.(Z,tt),(A.litHtmlVersions??=[]).push("3.3.1");const at=globalThis;
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/let
|
|
23
|
+
*/let ct=class extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,r)=>{const o=r?.renderBefore??e;let n=o._$litPart$;if(void 0===n){const t=r?.renderBefore??null;o._$litPart$=n=new tt(e.insertBefore(P(),t),t,void 0,r??{})}return n._$AI(t),n})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return B}};ct._$litElement$=!0,ct.finalized=!0,at.litElementHydrateSupport?.({LitElement:ct});const lt=at.litElementPolyfillSupport;lt?.({LitElement:ct}),(at.litElementVersions??=[]).push("4.2.1");
|
|
24
24
|
/**
|
|
25
25
|
* @license
|
|
26
26
|
* Copyright 2017 Google LLC
|
|
27
27
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
28
|
*/
|
|
29
|
-
const
|
|
29
|
+
const ht=t=>(e,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ut={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:S},dt=(t=ut,e,r)=>{const{kind:o,metadata:n}=r;let i=globalThis.litPropertyMetadata.get(n);if(void 0===i&&globalThis.litPropertyMetadata.set(n,i=new Map),"setter"===o&&((t=Object.create(t)).wrapped=!0),i.set(r.name,t),"accessor"===o){const{name:o}=r;return{set(r){const n=e.get.call(this);e.set.call(this,r),this.requestUpdate(o,n,t)},init(e){return void 0!==e&&this.C(o,void 0,t,e),e}}}if("setter"===o){const{name:o}=r;return function(r){const n=this[o];e.call(this,r),this.requestUpdate(o,n,t)}}throw Error("Unsupported decorator location: "+o)};
|
|
30
30
|
/**
|
|
31
31
|
* @license
|
|
32
32
|
* Copyright 2017 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/function pt(t){return(e,r)=>"object"==typeof r?dt(t,e,r):((t,e,r)=>{const
|
|
34
|
+
*/function pt(t){return(e,r)=>"object"==typeof r?dt(t,e,r):((t,e,r)=>{const o=e.hasOwnProperty(r);return e.constructor.createProperty(r,t),o?Object.getOwnPropertyDescriptor(e,r):void 0})(t,e,r)}
|
|
35
35
|
/**
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2017 Google LLC
|
|
38
38
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
-
*/var ft=Object.defineProperty,vt=(t,e,r)=>(((t,e,r)=>{e in t?ft(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r),
|
|
39
|
+
*/var ft=Object.defineProperty,vt=(t,e,r)=>(((t,e,r)=>{e in t?ft(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r})(t,"symbol"!=typeof e?e+"":e,r),r),mt=(t,e)=>{if(Object(e)!==e)throw TypeError('Cannot use the "in" operator on this value');return t.has(e)},yt=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},gt=(t,e,r)=>(((t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)})(t,e,"access private method"),r);
|
|
40
40
|
/**
|
|
41
41
|
* @license
|
|
42
42
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -51,14 +51,14 @@ function $t(t,e){return Object.is(t,e)}
|
|
|
51
51
|
*
|
|
52
52
|
* Use of this source code is governed by an MIT-style license that can be
|
|
53
53
|
* found in the LICENSE file at https://angular.io/license
|
|
54
|
-
*/let _t=null,bt=!1,St=1;const wt=Symbol("SIGNAL");function Ct(t){const e=_t;return _t=t,e}const At={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Et(t){if(bt)throw new Error("undefined"!=typeof ngDevMode&&ngDevMode?"Assertion error: signal read during notification phase":"");if(null===_t)return;_t.consumerOnSignalRead(t);const e=_t.nextProducerIndex++;if(
|
|
54
|
+
*/let _t=null,bt=!1,St=1;const wt=Symbol("SIGNAL");function Ct(t){const e=_t;return _t=t,e}const At={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function Et(t){if(bt)throw new Error("undefined"!=typeof ngDevMode&&ngDevMode?"Assertion error: signal read during notification phase":"");if(null===_t)return;_t.consumerOnSignalRead(t);const e=_t.nextProducerIndex++;if(Pt(_t),e<_t.producerNode.length&&_t.producerNode[e]!==t&&Nt(_t)){xt(_t.producerNode[e],_t.producerIndexOfThis[e])}_t.producerNode[e]!==t&&(_t.producerNode[e]=t,_t.producerIndexOfThis[e]=Nt(_t)?Ot(t,_t,e):0),_t.producerLastReadVersion[e]=t.version}function Rt(t){if(t.dirty||t.lastCleanEpoch!==St){if(!t.producerMustRecompute(t)&&!function(t){Pt(t);for(let e=0;e<t.producerNode.length;e++){const r=t.producerNode[e],o=t.producerLastReadVersion[e];if(o!==r.version)return!0;if(Rt(r),o!==r.version)return!0}return!1}(t))return t.dirty=!1,void(t.lastCleanEpoch=St);t.producerRecomputeValue(t),t.dirty=!1,t.lastCleanEpoch=St}}function Tt(t){if(void 0===t.liveConsumerNode)return;const e=bt;bt=!0;try{for(const e of t.liveConsumerNode)e.dirty||kt(e)}finally{bt=e}}function kt(t){var e;t.dirty=!0,Tt(t),null==(e=t.consumerMarkedDirty)||e.call(t.wrapper??t)}function Ot(t,e,r){var o;if(Ut(t),Pt(t),0===t.liveConsumerNode.length){null==(o=t.watched)||o.call(t.wrapper);for(let e=0;e<t.producerNode.length;e++)t.producerIndexOfThis[e]=Ot(t.producerNode[e],t,e)}return t.liveConsumerIndexOfThis.push(r),t.liveConsumerNode.push(e)-1}function xt(t,e){var r;if(Ut(t),Pt(t),"undefined"!=typeof ngDevMode&&ngDevMode&&e>=t.liveConsumerNode.length)throw new Error(`Assertion error: active consumer index ${e} is out of bounds of ${t.liveConsumerNode.length} consumers)`);if(1===t.liveConsumerNode.length){null==(r=t.unwatched)||r.call(t.wrapper);for(let e=0;e<t.producerNode.length;e++)xt(t.producerNode[e],t.producerIndexOfThis[e])}const o=t.liveConsumerNode.length-1;if(t.liveConsumerNode[e]=t.liveConsumerNode[o],t.liveConsumerIndexOfThis[e]=t.liveConsumerIndexOfThis[o],t.liveConsumerNode.length--,t.liveConsumerIndexOfThis.length--,e<t.liveConsumerNode.length){const r=t.liveConsumerIndexOfThis[e],o=t.liveConsumerNode[e];Pt(o),o.producerIndexOfThis[r]=e}}function Nt(t){var e;return t.consumerIsAlwaysLive||((null==(e=null==t?void 0:t.liveConsumerNode)?void 0:e.length)??0)>0}function Pt(t){t.producerNode??(t.producerNode=[]),t.producerIndexOfThis??(t.producerIndexOfThis=[]),t.producerLastReadVersion??(t.producerLastReadVersion=[])}function Ut(t){t.liveConsumerNode??(t.liveConsumerNode=[]),t.liveConsumerIndexOfThis??(t.liveConsumerIndexOfThis=[])}
|
|
55
55
|
/**
|
|
56
56
|
* @license
|
|
57
57
|
* Copyright Google LLC All Rights Reserved.
|
|
58
58
|
*
|
|
59
59
|
* Use of this source code is governed by an MIT-style license that can be
|
|
60
60
|
* found in the LICENSE file at https://angular.io/license
|
|
61
|
-
*/function Mt(t){if(Rt(t),Et(t),t.value===Lt)throw t.error;return t.value}const It=Symbol("UNSET"),Ht=Symbol("COMPUTING"),Lt=Symbol("ERRORED"),Wt=(()=>({...At,value:It,dirty:!0,error:null,equal:$t,producerMustRecompute:t=>t.value===It||t.value===Ht,producerRecomputeValue(t){if(t.value===Ht)throw new Error("Detected cycle in computations.");const e=t.value;t.value=Ht;const r=function(t){return t&&(t.nextProducerIndex=0),Ct(t)}(t);let n
|
|
61
|
+
*/function Mt(t){if(Rt(t),Et(t),t.value===Lt)throw t.error;return t.value}const It=Symbol("UNSET"),Ht=Symbol("COMPUTING"),Lt=Symbol("ERRORED"),Wt=(()=>({...At,value:It,dirty:!0,error:null,equal:$t,producerMustRecompute:t=>t.value===It||t.value===Ht,producerRecomputeValue(t){if(t.value===Ht)throw new Error("Detected cycle in computations.");const e=t.value;t.value=Ht;const r=function(t){return t&&(t.nextProducerIndex=0),Ct(t)}(t);let o,n=!1;try{o=t.computation.call(t.wrapper);n=e!==It&&e!==Lt&&t.equal.call(t.wrapper,e,o)}catch(e){o=Lt,t.error=e}finally{!function(t,e){if(Ct(e),t&&void 0!==t.producerNode&&void 0!==t.producerIndexOfThis&&void 0!==t.producerLastReadVersion){if(Nt(t))for(let e=t.nextProducerIndex;e<t.producerNode.length;e++)xt(t.producerNode[e],t.producerIndexOfThis[e]);for(;t.producerNode.length>t.nextProducerIndex;)t.producerNode.pop(),t.producerLastReadVersion.pop(),t.producerIndexOfThis.pop()}}(t,r)}n?t.value=e:(t.value=o,t.version++)}}))();let jt=
|
|
62
62
|
/**
|
|
63
63
|
* @license
|
|
64
64
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -82,7 +82,7 @@ function(){throw new Error};function Dt(){return Et(this),this.value}function Vt
|
|
|
82
82
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
83
83
|
* See the License for the specific language governing permissions and
|
|
84
84
|
* limitations under the License.
|
|
85
|
-
*/(t))}const qt=(()=>({...At,equal:$t,value:void 0}))();const zt=Symbol("node");var Bt;(t=>{var e,r,n
|
|
85
|
+
*/(t))}const qt=(()=>({...At,equal:$t,value:void 0}))();const zt=Symbol("node");var Bt;(t=>{var e,r,o,n;e=zt,r=new WeakSet,t.isState=t=>"object"==typeof t&&mt(r,t),t.State=class{constructor(o,n={}){yt(this,r),vt(this,e);const i=
|
|
86
86
|
/**
|
|
87
87
|
* @license
|
|
88
88
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -90,34 +90,33 @@ function(){throw new Error};function Dt(){return Et(this),this.value}function Vt
|
|
|
90
90
|
* Use of this source code is governed by an MIT-style license that can be
|
|
91
91
|
* found in the LICENSE file at https://angular.io/license
|
|
92
92
|
*/
|
|
93
|
-
function(t){const e=Object.create(qt);e.value=t;const r=()=>(Et(e),e.value);return r[wt]=e,r}(
|
|
93
|
+
function(t){const e=Object.create(qt);e.value=t;const r=()=>(Et(e),e.value);return r[wt]=e,r}(o),s=i[wt];if(this[zt]=s,s.wrapper=this,n){const e=n.equals;e&&(s.equal=e),s.watched=n[t.subtle.watched],s.unwatched=n[t.subtle.unwatched]}}get(){if(!(0,t.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.get");return Dt.call(this[zt])}set(e){if(!(0,t.isState)(this))throw new TypeError("Wrong receiver type for Signal.State.prototype.set");if(bt)throw new Error("Writes to signals not permitted during Watcher callback");Vt(this[zt],e)}};o=zt,n=new WeakSet,t.isComputed=t=>"object"==typeof t&&mt(n,t),t.Computed=class{constructor(e,r){yt(this,n),vt(this,o);const i=function(t){const e=Object.create(Wt);e.computation=t;const r=()=>Mt(e);return r[wt]=e,r}(e),s=i[wt];if(s.consumerAllowSignalWrites=!0,this[zt]=s,s.wrapper=this,r){const e=r.equals;e&&(s.equal=e),s.watched=r[t.subtle.watched],s.unwatched=r[t.subtle.unwatched]}}get(){if(!(0,t.isComputed)(this))throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");return Mt(this[zt])}},(e=>{var r,o,n,i;e.untrack=function(t){let e,r=null;try{r=Ct(null),e=t()}finally{Ct(r)}return e},e.introspectSources=function(e){var r;if(!(0,t.isComputed)(e)&&!(0,t.isWatcher)(e))throw new TypeError("Called introspectSources without a Computed or Watcher argument");return(null==(r=e[zt].producerNode)?void 0:r.map(t=>t.wrapper))??[]},e.introspectSinks=function(e){var r;if(!(0,t.isComputed)(e)&&!(0,t.isState)(e))throw new TypeError("Called introspectSinks without a Signal argument");return(null==(r=e[zt].liveConsumerNode)?void 0:r.map(t=>t.wrapper))??[]},e.hasSinks=function(e){if(!(0,t.isComputed)(e)&&!(0,t.isState)(e))throw new TypeError("Called hasSinks without a Signal argument");const r=e[zt].liveConsumerNode;return!!r&&r.length>0},e.hasSources=function(e){if(!(0,t.isComputed)(e)&&!(0,t.isWatcher)(e))throw new TypeError("Called hasSources without a Computed or Watcher argument");const r=e[zt].producerNode;return!!r&&r.length>0};r=zt,o=new WeakSet,n=new WeakSet,i=function(e){for(const r of e)if(!(0,t.isComputed)(r)&&!(0,t.isState)(r))throw new TypeError("Called watch/unwatch without a Computed or State argument")},t.isWatcher=t=>mt(o,t),e.Watcher=class{constructor(t){yt(this,o),yt(this,n),vt(this,r);let e=Object.create(At);e.wrapper=this,e.consumerMarkedDirty=t,e.consumerIsAlwaysLive=!0,e.consumerAllowSignalWrites=!1,e.producerNode=[],this[zt]=e}watch(...e){if(!(0,t.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");gt(this,n,i).call(this,e);const r=this[zt];r.dirty=!1;const o=Ct(r);for(const t of e)Et(t[zt]);Ct(o)}unwatch(...e){if(!(0,t.isWatcher)(this))throw new TypeError("Called unwatch without Watcher receiver");gt(this,n,i).call(this,e);const r=this[zt];Pt(r);for(let t=r.producerNode.length-1;t>=0;t--)if(e.includes(r.producerNode[t].wrapper)){xt(r.producerNode[t],r.producerIndexOfThis[t]);const e=r.producerNode.length-1;if(r.producerNode[t]=r.producerNode[e],r.producerIndexOfThis[t]=r.producerIndexOfThis[e],r.producerNode.length--,r.producerIndexOfThis.length--,r.nextProducerIndex--,t<r.producerNode.length){const e=r.producerIndexOfThis[t],o=r.producerNode[t];Ut(o),o.liveConsumerIndexOfThis[e]=t}}}getPending(){if(!(0,t.isWatcher)(this))throw new TypeError("Called getPending without Watcher receiver");return this[zt].producerNode.filter(t=>t.dirty).map(t=>t.wrapper)}},e.currentComputed=function(){var t;return null==(t=_t)?void 0:t.wrapper},e.watched=Symbol("watched"),e.unwatched=Symbol("unwatched")})(t.subtle||(t.subtle={}))})(Bt||(Bt={}));
|
|
94
94
|
/**
|
|
95
95
|
* @license
|
|
96
96
|
* Copyright 2023 Google LLC
|
|
97
97
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
98
98
|
*/
|
|
99
|
-
let Jt=!1;const Ft=new Bt.subtle.Watcher(()=>{Jt||(Jt=!0,queueMicrotask(()=>{Jt=!1;for(const t of Ft.getPending())t.get();Ft.watch()}))}),Gt=Symbol("SignalWatcherBrand"),Kt=new FinalizationRegistry(t=>{t.unwatch(...Bt.subtle.introspectSources(t))}),Yt=new WeakMap;
|
|
99
|
+
let Jt=!1;const Ft=new Bt.subtle.Watcher(()=>{Jt||(Jt=!0,queueMicrotask(()=>{Jt=!1;for(const t of Ft.getPending())t.get();Ft.watch()}))}),Gt=Symbol("SignalWatcherBrand"),Kt=new FinalizationRegistry(t=>{t.unwatch(...Bt.subtle.introspectSources(t))}),Yt=new WeakMap;function Zt(t){return!0===t[Gt]?(console.warn("SignalWatcher should not be applied to the same class more than once."),t):class extends t{constructor(){super(...arguments),this._$St=new Map,this._$So=new Bt.State(0),this._$Si=!1}_$Sl(){var t,e;const r=[],o=[];this._$St.forEach((t,e)=>{((null==t?void 0:t.beforeUpdate)?r:o).push(e)});const n=null===(t=this.h)||void 0===t?void 0:t.getPending().filter(t=>t!==this._$Su&&!this._$St.has(t));r.forEach(t=>t.get()),null===(e=this._$Su)||void 0===e||e.get(),n.forEach(t=>t.get()),o.forEach(t=>t.get())}_$Sv(){this.isUpdatePending||queueMicrotask(()=>{this.isUpdatePending||this._$Sl()})}_$S_(){if(void 0!==this.h)return;this._$Su=new Bt.Computed(()=>{this._$So.get(),super.performUpdate()});const t=this.h=new Bt.subtle.Watcher(function(){const t=Yt.get(this);void 0!==t&&(!1===t._$Si&&(new Set(this.getPending()).has(t._$Su)?t.requestUpdate():t._$Sv()),this.watch())});Yt.set(t,this),Kt.register(this,t),t.watch(this._$Su),t.watch(...Array.from(this._$St).map(([t])=>t))}_$Sp(){if(void 0===this.h)return;let t=!1;this.h.unwatch(...Bt.subtle.introspectSources(this.h).filter(e=>{var r;const o=!0!==(null===(r=this._$St.get(e))||void 0===r?void 0:r.manualDispose);return o&&this._$St.delete(e),t||(t=!o),o})),t||(this._$Su=void 0,this.h=void 0,this._$St.clear())}updateEffect(t,e){var r;this._$S_();const o=new Bt.Computed(()=>{t()});return this.h.watch(o),this._$St.set(o,e),null!==(r=null==e?void 0:e.beforeUpdate)&&void 0!==r&&r?Bt.subtle.untrack(()=>o.get()):this.updateComplete.then(()=>Bt.subtle.untrack(()=>o.get())),()=>{this._$St.delete(o),this.h.unwatch(o),!1===this.isConnected&&this._$Sp()}}performUpdate(){this.isUpdatePending&&(this._$S_(),this._$Si=!0,this._$So.set(this._$So.get()+1),this._$Si=!1,this._$Sl())}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask(()=>{!1===this.isConnected&&this._$Sp()})}}}
|
|
100
100
|
/**
|
|
101
101
|
* @license
|
|
102
102
|
* Copyright 2017 Google LLC
|
|
103
103
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
104
|
-
*/
|
|
105
|
-
const Zt=2;let Qt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
|
|
104
|
+
*/const Qt=2;let Xt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this._$Ct=t,this._$AM=e,this._$Ci=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};
|
|
106
105
|
/**
|
|
107
106
|
* @license
|
|
108
107
|
* Copyright 2020 Google LLC
|
|
109
108
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
110
|
-
*/const
|
|
109
|
+
*/const te=(t,e)=>{const r=t._$AN;if(void 0===r)return!1;for(const t of r)t._$AO?.(e,!1),te(t,e);return!0},ee=t=>{let e,r;do{if(void 0===(e=t._$AM))break;r=e._$AN,r.delete(t),t=e}while(0===r?.size)},re=t=>{for(let e;e=t._$AM;t=e){let r=e._$AN;if(void 0===r)e._$AN=r=new Set;else if(r.has(t))break;r.add(t),ie(e)}};
|
|
111
110
|
/**
|
|
112
111
|
* @license
|
|
113
112
|
* Copyright 2017 Google LLC
|
|
114
113
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
115
|
-
*/function
|
|
114
|
+
*/function oe(t){void 0!==this._$AN?(ee(this),this._$AM=t,re(this)):this._$AM=t}function ne(t,e=!1,r=0){const o=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(o))for(let t=r;t<o.length;t++)te(o[t],!1),ee(o[t]);else null!=o&&(te(o,!1),ee(o));else te(this,t)}const ie=t=>{t.type==Qt&&(t._$AP??=ne,t._$AQ??=oe)};class se extends Xt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),re(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(te(this,t),ee(this))}setValue(t){if((t=>void 0===t.strings)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}
|
|
116
115
|
/**
|
|
117
116
|
* @license
|
|
118
117
|
* Copyright 2023 Google LLC
|
|
119
118
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
120
|
-
*/let
|
|
119
|
+
*/let ae=!1;const ce=new Bt.subtle.Watcher(async()=>{ae||(ae=!0,queueMicrotask(()=>{ae=!1;for(const t of ce.getPending())t.get();ce.watch()}))});const le=(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends se{_$S_(){var t,e;void 0===this._$Sm&&(this._$Sj=new Bt.Computed(()=>{var t;const e=null===(t=this._$SW)||void 0===t?void 0:t.get();return this.setValue(e),e}),this._$Sm=null!==(e=null===(t=this._$Sk)||void 0===t?void 0:t.h)&&void 0!==e?e:ce,this._$Sm.watch(this._$Sj),Bt.subtle.untrack(()=>{var t;return null===(t=this._$Sj)||void 0===t?void 0:t.get()}))}_$Sp(){void 0!==this._$Sm&&(this._$Sm.unwatch(this._$SW),this._$Sm=void 0)}render(t){return Bt.subtle.untrack(()=>t.get())}update(t,[e]){var r,o;return null!==(r=this._$Sk)&&void 0!==r||(this._$Sk=null===(o=t.options)||void 0===o?void 0:o.host),e!==this._$SW&&void 0!==this._$SW&&this._$Sp(),this._$SW=e,this._$S_(),Bt.subtle.untrack(()=>this._$SW.get())}disconnected(){this._$Sp()}reconnected(){this._$S_()}}),he=(t=>(e,...r)=>t(e,...r.map(t=>t instanceof Bt.State||t instanceof Bt.Computed?le(t):t)))(z);
|
|
121
120
|
/**
|
|
122
121
|
* @license
|
|
123
122
|
* Copyright 2023 Google LLC
|
|
@@ -128,15 +127,59 @@ const Zt=2;let Qt=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,
|
|
|
128
127
|
* Copyright 2023 Google LLC
|
|
129
128
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
130
129
|
*/
|
|
131
|
-
Bt.State,Bt.Computed;const le=(t,e)=>new Bt.State(t,e),ue=(t,e)=>new Bt.Computed(t,e);var de,pe;const fe=Symbol("ThaRoute:fragment"),ve=Symbol("ThaRoute:path-pattern");function ge(){}t.ThaRoute=class extends ht{constructor(){super(...arguments),this[de]=le(this.#t()),this[pe]=null,this.path=null,this.#e=new MutationObserver(()=>{this[fe].set(this.#t())})}static{de=fe,pe=ve}#e;connectedCallback(){super.connectedCallback(),this.#e.observe(this,{childList:!0})}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"path"===t)this[ve]=r?new URLPattern({pathname:r}):null}#t(){const t=this.querySelector("template");return t?new WeakRef(t.content):null}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}},e([pt({type:String}),r("design:type",Object)],t.ThaRoute.prototype,"path",void 0),t.ThaRoute=e([lt("tha-route")],t.ThaRoute);const me=function(t){return!0===t[Gt]?(console.warn("SignalWatcher should not be applied to the same class more than once."),t):class extends t{constructor(){super(...arguments),this._$St=new Map,this._$So=new Bt.State(0),this._$Si=!1}_$Sl(){var t,e;const r=[],n=[];this._$St.forEach((t,e)=>{((null==t?void 0:t.beforeUpdate)?r:n).push(e)});const i=null===(t=this.h)||void 0===t?void 0:t.getPending().filter(t=>t!==this._$Su&&!this._$St.has(t));r.forEach(t=>t.get()),null===(e=this._$Su)||void 0===e||e.get(),i.forEach(t=>t.get()),n.forEach(t=>t.get())}_$Sv(){this.isUpdatePending||queueMicrotask(()=>{this.isUpdatePending||this._$Sl()})}_$S_(){if(void 0!==this.h)return;this._$Su=new Bt.Computed(()=>{this._$So.get(),super.performUpdate()});const t=this.h=new Bt.subtle.Watcher(function(){const t=Yt.get(this);void 0!==t&&(!1===t._$Si&&(new Set(this.getPending()).has(t._$Su)?t.requestUpdate():t._$Sv()),this.watch())});Yt.set(t,this),Kt.register(this,t),t.watch(this._$Su),t.watch(...Array.from(this._$St).map(([t])=>t))}_$Sp(){if(void 0===this.h)return;let t=!1;this.h.unwatch(...Bt.subtle.introspectSources(this.h).filter(e=>{var r;const n=!0!==(null===(r=this._$St.get(e))||void 0===r?void 0:r.manualDispose);return n&&this._$St.delete(e),t||(t=!n),n})),t||(this._$Su=void 0,this.h=void 0,this._$St.clear())}updateEffect(t,e){var r;this._$S_();const n=new Bt.Computed(()=>{t()});return this.h.watch(n),this._$St.set(n,e),null!==(r=null==e?void 0:e.beforeUpdate)&&void 0!==r&&r?Bt.subtle.untrack(()=>n.get()):this.updateComplete.then(()=>Bt.subtle.untrack(()=>n.get())),()=>{this._$St.delete(n),this.h.unwatch(n),!1===this.isConnected&&this._$Sp()}}performUpdate(){this.isUpdatePending&&(this._$S_(),this._$Si=!0,this._$So.set(this._$So.get()+1),this._$Si=!1,this._$Sl())}connectedCallback(){super.connectedCallback(),this.requestUpdate()}disconnectedCallback(){super.disconnectedCallback(),queueMicrotask(()=>{!1===this.isConnected&&this._$Sp()})}}}(ht);function ye(){return ye=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ye.apply(null,arguments)}var $e;!function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}($e||($e={}));var _e="production"!==process.env.NODE_ENV?function(t){return Object.freeze(t)}:function(t){return t};function be(t,e){if(!t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}}var Se="beforeunload",we="popstate";function Ce(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function i(){var t=ke(r.location.hash.substr(1)),e=t.pathname,i=void 0===e?"/":e,s=t.search,o=void 0===s?"":s,a=t.hash,h=void 0===a?"":a,c=n.state||{};return[c.idx,_e({pathname:i,search:o,hash:h,state:c.usr||null,key:c.key||"default"})]}var s=null;function o(){if(s)d.call(s),s=null;else{var t=$e.Pop,e=i(),r=e[0],n=e[1];if(d.length)if(null!=r){var o=c-r;o&&(s={action:t,location:n,retry:function(){y(-1*o)}},y(o))}else"production"!==process.env.NODE_ENV&&be(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else m(t)}}r.addEventListener(we,o),r.addEventListener("hashchange",function(){Oe(i()[1])!==Oe(l)&&o()});var a=$e.Pop,h=i(),c=h[0],l=h[1],u=Re(),d=Re();function p(t){return function(){var t=document.querySelector("base"),e="";if(t&&t.getAttribute("href")){var n=r.location.href,i=n.indexOf("#");e=-1===i?n:n.slice(0,i)}return e}()+"#"+("string"==typeof t?t:Oe(t))}function f(t,e){return void 0===e&&(e=null),_e(ye({pathname:l.pathname,hash:"",search:""},"string"==typeof t?ke(t):t,{state:e,key:Te()}))}function v(t,e){return[{usr:t.state,key:t.key,idx:e},p(t)]}function g(t,e,r){return!d.length||(d.call({action:t,location:e,retry:r}),!1)}function m(t){a=t;var e=i();c=e[0],l=e[1],u.call({action:a,location:l})}function y(t){n.go(t)}null==c&&(c=0,n.replaceState(ye({},n.state,{idx:c}),""));var $={get action(){return a},get location(){return l},createHref:p,push:function t(e,i){var s=$e.Push,o=f(e,i);if("production"!==process.env.NODE_ENV&&be("/"===o.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+JSON.stringify(e)+")"),g(s,o,function(){t(e,i)})){var a=v(o,c+1),h=a[0],l=a[1];try{n.pushState(h,"",l)}catch(t){r.location.assign(l)}m(s)}},replace:function t(e,r){var i=$e.Replace,s=f(e,r);if("production"!==process.env.NODE_ENV&&be("/"===s.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(e)+")"),g(i,s,function(){t(e,r)})){var o=v(s,c),a=o[0],h=o[1];n.replaceState(a,"",h),m(i)}},go:y,back:function(){y(-1)},forward:function(){y(1)},listen:function(t){return u.push(t)},block:function(t){var e=d.push(t);return 1===d.length&&r.addEventListener(Se,Ee),function(){e(),d.length||r.removeEventListener(Se,Ee)}}};return $}function Ae(t,e,r){return Math.min(Math.max(t,e),r)}function Ee(t){t.preventDefault(),t.returnValue=""}function Re(){var t=[];return{get length(){return t.length},push:function(e){return t.push(e),function(){t=t.filter(function(t){return t!==e})}},call:function(e){t.forEach(function(t){return t&&t(e)})}}}function Te(){return Math.random().toString(36).substr(2,8)}function Oe(t){var e=t.pathname,r=void 0===e?"/":e,n=t.search,i=void 0===n?"":n,s=t.hash,o=void 0===s?"":s;return i&&"?"!==i&&(r+="?"===i.charAt(0)?i:"?"+i),o&&"#"!==o&&(r+="#"===o.charAt(0)?o:"#"+o),r}function ke(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}const Ne={},Pe=le("browser");function xe(t){let e=Ne[t];if(!e){switch(t){case"browser":e=function(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,n=r.history;function i(){var t=r.location,e=t.pathname,i=t.search,s=t.hash,o=n.state||{};return[o.idx,_e({pathname:e,search:i,hash:s,state:o.usr||null,key:o.key||"default"})]}var s=null;r.addEventListener(we,function(){if(s)u.call(s),s=null;else{var t=$e.Pop,e=i(),r=e[0],n=e[1];if(u.length)if(null!=r){var o=h-r;o&&(s={action:t,location:n,retry:function(){m(-1*o)}},m(o))}else"production"!==process.env.NODE_ENV&&be(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else g(t)}});var o=$e.Pop,a=i(),h=a[0],c=a[1],l=Re(),u=Re();function d(t){return"string"==typeof t?t:Oe(t)}function p(t,e){return void 0===e&&(e=null),_e(ye({pathname:c.pathname,hash:"",search:""},"string"==typeof t?ke(t):t,{state:e,key:Te()}))}function f(t,e){return[{usr:t.state,key:t.key,idx:e},d(t)]}function v(t,e,r){return!u.length||(u.call({action:t,location:e,retry:r}),!1)}function g(t){o=t;var e=i();h=e[0],c=e[1],l.call({action:o,location:c})}function m(t){n.go(t)}null==h&&(h=0,n.replaceState(ye({},n.state,{idx:h}),""));var y={get action(){return o},get location(){return c},createHref:d,push:function t(e,i){var s=$e.Push,o=p(e,i);if(v(s,o,function(){t(e,i)})){var a=f(o,h+1),c=a[0],l=a[1];try{n.pushState(c,"",l)}catch(t){r.location.assign(l)}g(s)}},replace:function t(e,r){var i=$e.Replace,s=p(e,r);if(v(i,s,function(){t(e,r)})){var o=f(s,h),a=o[0],c=o[1];n.replaceState(a,"",c),g(i)}},go:m,back:function(){m(-1)},forward:function(){m(1)},listen:function(t){return l.push(t)},block:function(t){var e=u.push(t);return 1===u.length&&r.addEventListener(Se,Ee),function(){e(),u.length||r.removeEventListener(Se,Ee)}}};return y}();break;case"hash":e=Ce();break;default:e=function(t){void 0===t&&(t={});var e=t,r=e.initialEntries,n=void 0===r?["/"]:r,i=e.initialIndex,s=n.map(function(t){var e=_e(ye({pathname:"/",search:"",hash:"",state:null,key:Te()},"string"==typeof t?ke(t):t));return"production"!==process.env.NODE_ENV&&be("/"===e.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(t)+")"),e}),o=Ae(null==i?s.length-1:i,0,s.length-1),a=$e.Pop,h=s[o],c=Re(),l=Re();function u(t,e){return void 0===e&&(e=null),_e(ye({pathname:h.pathname,search:"",hash:""},"string"==typeof t?ke(t):t,{state:e,key:Te()}))}function d(t,e,r){return!l.length||(l.call({action:t,location:e,retry:r}),!1)}function p(t,e){a=t,h=e,c.call({action:a,location:h})}function f(t){var e=Ae(o+t,0,s.length-1),r=$e.Pop,n=s[e];d(r,n,function(){f(t)})&&(o=e,p(r,n))}var v={get index(){return o},get action(){return a},get location(){return h},createHref:function(t){return"string"==typeof t?t:Oe(t)},push:function t(e,r){var n=$e.Push,i=u(e,r);"production"!==process.env.NODE_ENV&&be("/"===h.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(e)+")"),d(n,i,function(){t(e,r)})&&(o+=1,s.splice(o,s.length,i),p(n,i))},replace:function t(e,r){var n=$e.Replace,i=u(e,r);"production"!==process.env.NODE_ENV&&be("/"===h.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(e)+")"),d(n,i,function(){t(e,r)})&&(s[o]=i,p(n,i))},go:f,back:function(){f(-1)},forward:function(){f(1)},listen:function(t){return c.push(t)},block:function(t){return l.push(t)}};return v}()}Ne[t]=e}return e}ue(()=>xe(Pe.get()));const Ue=Symbol("HistoryManaged:history"),Me=Symbol("HistoryManaged:historyType"),Ie=t=>{var n,i;class s extends t{constructor(){super(...arguments),this.history=void 0,this.#r=le(this.history),this.#n=ue(()=>{const t=this.closest("tha-router-config, tha-router-outlet");return t?.[Me]?.get()}),this[n]=ue(()=>this.#r.get()??this.#n.get()??Pe.get()),this[i]=ue(()=>xe(this[Me].get()))}static{n=Me,i=Ue}#r;#n;attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"history"===t)this.#r.set(r)}}return e([pt({type:String}),r("design:type",Object)],s.prototype,"history",void 0),s};function He(t=ge){return new Promise((e,r)=>{setTimeout(()=>{try{const r=t();e(r)}catch(t){r(t)}},0)})}var Le;const We=Symbol("ThaRouterOutlet:renderRoute"),je=Symbol("ThaRouterOutlet:params");function De(t){return!!t}function Ve(t){return t.filter(De)}t.ThaRouterOutlet=class extends me{constructor(){super(...arguments),this.#i=le(void 0),this.#s=le(null),this.#o=ue(()=>this.#s.get()?.deref()?.[fe].get()??null),this.#a=ue(()=>{const t=this.#i.get()?.deref(),e=this.#s.get()?.deref(),r=e?.[ve];if(!t||!r)return null;const{location:{pathname:n}}=t[Ue].get();return r.exec(n,"http://dummy.base")?.pathname.groups??null}),this[Le]=ue(()=>{const t=this.#a.get()??{},e=this.parentElement?.closest("tha-router-outlet"),r=e?.[je].get()??{};return Object.freeze({...r,...t})}),this.params={},this.#h=ge,this.#c=ge,this.#l=ge,this.for=null,this.routePath=null,this.routeID=void 0}#i;#s;#o;#a;#h;#c;#l;connectedCallback(){super.connectedCallback(),He(()=>{this.bindToRouter()}),this.#h=this.updateEffect(()=>{Array.from(this.renderRoot.children).forEach(t=>t.remove());const t=this.#o.get()?.deref()??null;t&&this.renderRoot.appendChild(t.cloneNode(!0))}),this.#c=this.updateEffect(()=>{const t=this.#s.get()?.deref()??null;this.routePath=t?.getAttribute("path")??null,this.routeID=t?.id?t?.id:void 0}),this.#l=this.updateEffect(()=>{const t=this[je].get();Array.from(this.attributes).filter(t=>t.name.startsWith("param-")).filter(e=>!(e.name.slice(6)in t)).forEach(t=>{this.removeAttribute(t.name)});for(const[e,r]of Object.entries(t))this.setAttribute(`param-${e}`,r??"");this.params=t})}bindToRouter(t){if(!t)if(this.for){t=this.getRootNode().querySelector(`tha-router#${this.for}`)??void 0}else t=this.closest("tha-router")??void 0;const e=this.#i?.get()?.deref()??null;return e===t?e:(e?.assignOutlet(null),t?.assignOutlet(this),this.#i.set(t?new WeakRef(t):void 0),t??null)}[(Le=je,We)](t){this.#s.set(t?new WeakRef(t):null)}disconnectedCallback(){super.disconnectedCallback(),this.#i?.get()?.deref()?.assignOutlet(null);try{this.#h(),this.#c(),this.#l()}catch{}}createRenderRoot(){return this}},e([function(t){return pt({...t,state:!0,attribute:!1})}(),r("design:type",Object)],t.ThaRouterOutlet.prototype,"params",void 0),e([pt({type:String}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"for",void 0),e([pt({type:String,reflect:!0}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"routePath",void 0),e([pt({type:String,reflect:!0}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"routeID",void 0),t.ThaRouterOutlet=e([lt("tha-router-outlet")],t.ThaRouterOutlet),t.ThaRouter=class extends(Ie(me)){static{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-id","tha-router-styles"),t.textContent=h`
|
|
130
|
+
Bt.State,Bt.Computed;const ue=(t,e)=>new Bt.State(t,e),de=(t,e)=>new Bt.Computed(t,e);var pe,fe;const ve=Symbol("ThaRoute:fragment"),me=Symbol("ThaRoute:path-pattern");function ye(){}t.ThaRoute=class extends ct{constructor(){super(...arguments),this[pe]=ue(this.#t()),this[fe]=null,this.path=null,this.#e=new MutationObserver(()=>{this[ve].set(this.#t())})}static{pe=ve,fe=me}#e;connectedCallback(){super.connectedCallback(),this.#e.observe(this,{childList:!0})}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"path"===t)this[me]=r?new URLPattern({pathname:r}):null}#t(){const t=this.querySelector("template");return t?new WeakRef(t.content):null}disconnectedCallback(){super.disconnectedCallback(),this.#e.disconnect()}},e([pt({type:String}),r("design:type",Object)],t.ThaRoute.prototype,"path",void 0),t.ThaRoute=e([ht("tha-route")],t.ThaRoute);class ge extends ct{constructor(){super(...arguments),this.color="contrast",this.shade=500,this.mixer="none"}static{this.rootStyles=(()=>{const t=c`
|
|
131
|
+
@layer properties {
|
|
132
|
+
:root {
|
|
133
|
+
--tp-color-white: hsl(0 0% 100%);
|
|
134
|
+
--tp-color-black: hsl(0 0% 0%);
|
|
135
|
+
--tp-color-contrast: var(--tp-color-black);
|
|
136
|
+
--tp-color-primary: hsl(220 90% 56%);
|
|
137
|
+
--tp-color-secondary: hsl(340 82% 52%);
|
|
138
|
+
--tp-color-tertiary: hsl(50 100% 50%);
|
|
139
|
+
--tp-color-quaternary: hsl(120 100% 40%);
|
|
140
|
+
--tp-color-success: hsl(140 70% 40%);
|
|
141
|
+
--tp-color-danger: hsl(0 70% 50%);
|
|
142
|
+
--tp-color-warning: hsl(45 100% 50%);
|
|
143
|
+
--tp-color-neutral: color-mix(in xyz, var(--tp-color-white) 50%, var(--tp-color-black) 50%);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`;var e;return document.adoptedStyleSheets=(e=[...document.adoptedStyleSheets,t.styleSheet],[...new Set(e)]),t})()}static{this.shadedElementStyles=c`
|
|
147
|
+
--tp-element-color: var(--tp-color-primary);
|
|
148
|
+
--tp-shade-attr: attr(shade type(<number>));
|
|
149
|
+
--tp-shade-mixer-type: attr(mixer type(*));
|
|
150
|
+
--tp-shade-mixer-color: if(
|
|
151
|
+
style(--tp-shade-mixer-type: black): var(--tp-color-black);
|
|
152
|
+
else: var(--tp-color-white)
|
|
153
|
+
);
|
|
154
|
+
--tp-shade-mixer-percent: if(
|
|
155
|
+
style(--tp-shade-mixer-type: black): calc(100% - ((var(--tp-shade-attr) - 500) / 500 * 100%));
|
|
156
|
+
else: calc(100% - ((500 - var(--tp-shade-attr)) / 500 * 100%))
|
|
157
|
+
);
|
|
158
|
+
--tp-calc-element-color: color-mix(in xyz, var(--tp-element-color) var(--tp-shade-mixer-percent), var(--tp-shade-mixer-color) calc(100% - var(--tp-shade-mixer-percent)));
|
|
159
|
+
--tp-calc-contrast-color: contrast-color(var(--tp-calc-element-color));
|
|
160
|
+
--tp-contrast-color: if(
|
|
161
|
+
style(--tp-calc-contrast-color: white): var(--tp-color-white);
|
|
162
|
+
else: var(--tp-color-black);
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
&[color="contrast"] { --tp-element-color: var(--tp-color-contrast); }
|
|
166
|
+
&[color="primary"] { --tp-element-color: var(--tp-color-primary); }
|
|
167
|
+
&[color="secondary"] { --tp-element-color: var(--tp-color-secondary); }
|
|
168
|
+
&[color="tertiary"] { --tp-element-color: var(--tp-color-tertiary); }
|
|
169
|
+
&[color="quaternary"] { --tp-element-color: var(--tp-color-quaternary); }
|
|
170
|
+
&[color="success"] { --tp-element-color: var(--tp-color-success); }
|
|
171
|
+
&[color="danger"] { --tp-element-color: var(--tp-color-danger); }
|
|
172
|
+
&[color="warning"] { --tp-element-color: var(--tp-color-warning); }
|
|
173
|
+
&[color="neutral"] { --tp-element-color: var(--tp-color-neutral); }
|
|
174
|
+
`}willUpdate(t){t.has("shade")&&(this.mixer=500===this.shade?"none":this.shade>500?"black":"white")}}e([pt({type:String,reflect:!0}),r("design:type",String)],ge.prototype,"color",void 0),e([pt({type:Number,reflect:!0,converter(t,e){const r=Number(t);return isNaN(r)?500:function(t,e,r){return Math.max(Math.min(e,r),t)}(0,1e3,r)}}),r("design:type",Number)],ge.prototype,"shade",void 0),e([pt({type:String,reflect:!0}),r("design:type",String)],ge.prototype,"mixer",void 0);const $e=Zt(ct);function _e(){return _e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)({}).hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},_e.apply(null,arguments)}var be;Zt(ge),function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"}(be||(be={}));var Se="production"!==process.env.NODE_ENV?function(t){return Object.freeze(t)}:function(t){return t};function we(t,e){if(!t){"undefined"!=typeof console&&console.warn(e);try{throw new Error(e)}catch(t){}}}var Ce="beforeunload",Ae="popstate";function Ee(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,o=r.history;function n(){var t=Ne(r.location.hash.substr(1)),e=t.pathname,n=void 0===e?"/":e,i=t.search,s=void 0===i?"":i,a=t.hash,c=void 0===a?"":a,l=o.state||{};return[l.idx,Se({pathname:n,search:s,hash:c,state:l.usr||null,key:l.key||"default"})]}var i=null;function s(){if(i)d.call(i),i=null;else{var t=be.Pop,e=n(),r=e[0],o=e[1];if(d.length)if(null!=r){var s=l-r;s&&(i={action:t,location:o,retry:function(){g(-1*s)}},g(s))}else"production"!==process.env.NODE_ENV&&we(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else y(t)}}r.addEventListener(Ae,s),r.addEventListener("hashchange",function(){xe(n()[1])!==xe(h)&&s()});var a=be.Pop,c=n(),l=c[0],h=c[1],u=ke(),d=ke();function p(t){return function(){var t=document.querySelector("base"),e="";if(t&&t.getAttribute("href")){var o=r.location.href,n=o.indexOf("#");e=-1===n?o:o.slice(0,n)}return e}()+"#"+("string"==typeof t?t:xe(t))}function f(t,e){return void 0===e&&(e=null),Se(_e({pathname:h.pathname,hash:"",search:""},"string"==typeof t?Ne(t):t,{state:e,key:Oe()}))}function v(t,e){return[{usr:t.state,key:t.key,idx:e},p(t)]}function m(t,e,r){return!d.length||(d.call({action:t,location:e,retry:r}),!1)}function y(t){a=t;var e=n();l=e[0],h=e[1],u.call({action:a,location:h})}function g(t){o.go(t)}null==l&&(l=0,o.replaceState(_e({},o.state,{idx:l}),""));var $={get action(){return a},get location(){return h},createHref:p,push:function t(e,n){var i=be.Push,s=f(e,n);if("production"!==process.env.NODE_ENV&&we("/"===s.pathname.charAt(0),"Relative pathnames are not supported in hash history.push("+JSON.stringify(e)+")"),m(i,s,function(){t(e,n)})){var a=v(s,l+1),c=a[0],h=a[1];try{o.pushState(c,"",h)}catch(t){r.location.assign(h)}y(i)}},replace:function t(e,r){var n=be.Replace,i=f(e,r);if("production"!==process.env.NODE_ENV&&we("/"===i.pathname.charAt(0),"Relative pathnames are not supported in hash history.replace("+JSON.stringify(e)+")"),m(n,i,function(){t(e,r)})){var s=v(i,l),a=s[0],c=s[1];o.replaceState(a,"",c),y(n)}},go:g,back:function(){g(-1)},forward:function(){g(1)},listen:function(t){return u.push(t)},block:function(t){var e=d.push(t);return 1===d.length&&r.addEventListener(Ce,Te),function(){e(),d.length||r.removeEventListener(Ce,Te)}}};return $}function Re(t,e,r){return Math.min(Math.max(t,e),r)}function Te(t){t.preventDefault(),t.returnValue=""}function ke(){var t=[];return{get length(){return t.length},push:function(e){return t.push(e),function(){t=t.filter(function(t){return t!==e})}},call:function(e){t.forEach(function(t){return t&&t(e)})}}}function Oe(){return Math.random().toString(36).substr(2,8)}function xe(t){var e=t.pathname,r=void 0===e?"/":e,o=t.search,n=void 0===o?"":o,i=t.hash,s=void 0===i?"":i;return n&&"?"!==n&&(r+="?"===n.charAt(0)?n:"?"+n),s&&"#"!==s&&(r+="#"===s.charAt(0)?s:"#"+s),r}function Ne(t){var e={};if(t){var r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));var o=t.indexOf("?");o>=0&&(e.search=t.substr(o),t=t.substr(0,o)),t&&(e.pathname=t)}return e}const Pe={},Ue=ue("browser");function Me(t){let e=Pe[t];if(!e){switch(t){case"browser":e=function(t){void 0===t&&(t={});var e=t.window,r=void 0===e?document.defaultView:e,o=r.history;function n(){var t=r.location,e=t.pathname,n=t.search,i=t.hash,s=o.state||{};return[s.idx,Se({pathname:e,search:n,hash:i,state:s.usr||null,key:s.key||"default"})]}var i=null;r.addEventListener(Ae,function(){if(i)u.call(i),i=null;else{var t=be.Pop,e=n(),r=e[0],o=e[1];if(u.length)if(null!=r){var s=c-r;s&&(i={action:t,location:o,retry:function(){y(-1*s)}},y(s))}else"production"!==process.env.NODE_ENV&&we(!1,"You are trying to block a POP navigation to a location that was not created by the history library. The block will fail silently in production, but in general you should do all navigation with the history library (instead of using window.history.pushState directly) to avoid this situation.");else m(t)}});var s=be.Pop,a=n(),c=a[0],l=a[1],h=ke(),u=ke();function d(t){return"string"==typeof t?t:xe(t)}function p(t,e){return void 0===e&&(e=null),Se(_e({pathname:l.pathname,hash:"",search:""},"string"==typeof t?Ne(t):t,{state:e,key:Oe()}))}function f(t,e){return[{usr:t.state,key:t.key,idx:e},d(t)]}function v(t,e,r){return!u.length||(u.call({action:t,location:e,retry:r}),!1)}function m(t){s=t;var e=n();c=e[0],l=e[1],h.call({action:s,location:l})}function y(t){o.go(t)}null==c&&(c=0,o.replaceState(_e({},o.state,{idx:c}),""));var g={get action(){return s},get location(){return l},createHref:d,push:function t(e,n){var i=be.Push,s=p(e,n);if(v(i,s,function(){t(e,n)})){var a=f(s,c+1),l=a[0],h=a[1];try{o.pushState(l,"",h)}catch(t){r.location.assign(h)}m(i)}},replace:function t(e,r){var n=be.Replace,i=p(e,r);if(v(n,i,function(){t(e,r)})){var s=f(i,c),a=s[0],l=s[1];o.replaceState(a,"",l),m(n)}},go:y,back:function(){y(-1)},forward:function(){y(1)},listen:function(t){return h.push(t)},block:function(t){var e=u.push(t);return 1===u.length&&r.addEventListener(Ce,Te),function(){e(),u.length||r.removeEventListener(Ce,Te)}}};return g}();break;case"hash":e=Ee();break;default:e=function(t){void 0===t&&(t={});var e=t,r=e.initialEntries,o=void 0===r?["/"]:r,n=e.initialIndex,i=o.map(function(t){var e=Se(_e({pathname:"/",search:"",hash:"",state:null,key:Oe()},"string"==typeof t?Ne(t):t));return"production"!==process.env.NODE_ENV&&we("/"===e.pathname.charAt(0),"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: "+JSON.stringify(t)+")"),e}),s=Re(null==n?i.length-1:n,0,i.length-1),a=be.Pop,c=i[s],l=ke(),h=ke();function u(t,e){return void 0===e&&(e=null),Se(_e({pathname:c.pathname,search:"",hash:""},"string"==typeof t?Ne(t):t,{state:e,key:Oe()}))}function d(t,e,r){return!h.length||(h.call({action:t,location:e,retry:r}),!1)}function p(t,e){a=t,c=e,l.call({action:a,location:c})}function f(t){var e=Re(s+t,0,i.length-1),r=be.Pop,o=i[e];d(r,o,function(){f(t)})&&(s=e,p(r,o))}var v={get index(){return s},get action(){return a},get location(){return c},createHref:function(t){return"string"==typeof t?t:xe(t)},push:function t(e,r){var o=be.Push,n=u(e,r);"production"!==process.env.NODE_ENV&&we("/"===c.pathname.charAt(0),"Relative pathnames are not supported in memory history.push("+JSON.stringify(e)+")"),d(o,n,function(){t(e,r)})&&(s+=1,i.splice(s,i.length,n),p(o,n))},replace:function t(e,r){var o=be.Replace,n=u(e,r);"production"!==process.env.NODE_ENV&&we("/"===c.pathname.charAt(0),"Relative pathnames are not supported in memory history.replace("+JSON.stringify(e)+")"),d(o,n,function(){t(e,r)})&&(i[s]=n,p(o,n))},go:f,back:function(){f(-1)},forward:function(){f(1)},listen:function(t){return l.push(t)},block:function(t){return h.push(t)}};return v}()}Pe[t]=e}return e}de(()=>Me(Ue.get()));const Ie=Symbol("HistoryManaged:history"),He=Symbol("HistoryManaged:historyType"),Le=t=>{var o,n;class i extends t{constructor(){super(...arguments),this.history=void 0,this.#r=ue(this.history),this.#o=de(()=>{const t=this.closest("tha-router-config, tha-router-outlet");return t?.[He]?.get()}),this[o]=de(()=>this.#r.get()??this.#o.get()??Ue.get()),this[n]=de(()=>Me(this[He].get()))}static{o=He,n=Ie}#r;#o;attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"history"===t)this.#r.set(r)}}return e([pt({type:String}),r("design:type",Object)],i.prototype,"history",void 0),i};function We(t=ye){return new Promise((e,r)=>{setTimeout(()=>{try{const r=t();e(r)}catch(t){r(t)}},0)})}var je;const De=Symbol("ThaRouterOutlet:renderRoute"),Ve=Symbol("ThaRouterOutlet:params");function qe(t){return!!t}function ze(t){return t.filter(qe)}t.ThaRouterOutlet=class extends $e{constructor(){super(...arguments),this.#n=ue(void 0),this.#i=ue(null),this.#s=de(()=>this.#i.get()?.deref()?.[ve].get()??null),this.#a=de(()=>{const t=this.#n.get()?.deref(),e=this.#i.get()?.deref(),r=e?.[me];if(!t||!r)return null;const{location:{pathname:o}}=t[Ie].get();return r.exec(o,"http://dummy.base")?.pathname.groups??null}),this[je]=de(()=>{const t=this.#a.get()??{},e=this.parentElement?.closest("tha-router-outlet"),r=e?.[Ve].get()??{};return Object.freeze({...r,...t})}),this.params={},this.#c=ye,this.#l=ye,this.#h=ye,this.for=null,this.routePath=null,this.routeID=void 0}#n;#i;#s;#a;#c;#l;#h;connectedCallback(){super.connectedCallback(),We(()=>{this.bindToRouter()}),this.#c=this.updateEffect(()=>{Array.from(this.renderRoot.children).forEach(t=>t.remove());const t=this.#s.get()?.deref()??null;t&&this.renderRoot.appendChild(t.cloneNode(!0))}),this.#l=this.updateEffect(()=>{const t=this.#i.get()?.deref()??null;this.routePath=t?.getAttribute("path")??null,this.routeID=t?.id?t?.id:void 0}),this.#h=this.updateEffect(()=>{const t=this[Ve].get();Array.from(this.attributes).filter(t=>t.name.startsWith("param-")).filter(e=>!(e.name.slice(6)in t)).forEach(t=>{this.removeAttribute(t.name)});for(const[e,r]of Object.entries(t))this.setAttribute(`param-${e}`,r??"");this.params=t})}bindToRouter(t){if(!t)if(this.for){t=this.getRootNode().querySelector(`tha-router#${this.for}`)??void 0}else t=this.closest("tha-router")??void 0;const e=this.#n?.get()?.deref()??null;return e===t?e:(e?.assignOutlet(null),t?.assignOutlet(this),this.#n.set(t?new WeakRef(t):void 0),t??null)}[(je=Ve,De)](t){this.#i.set(t?new WeakRef(t):null)}disconnectedCallback(){super.disconnectedCallback(),this.#n?.get()?.deref()?.assignOutlet(null);try{this.#c(),this.#l(),this.#h()}catch{}}createRenderRoot(){return this}},e([function(t){return pt({...t,state:!0,attribute:!1})}(),r("design:type",Object)],t.ThaRouterOutlet.prototype,"params",void 0),e([pt({type:String}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"for",void 0),e([pt({type:String,reflect:!0}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"routePath",void 0),e([pt({type:String,reflect:!0}),r("design:type",Object)],t.ThaRouterOutlet.prototype,"routeID",void 0),t.ThaRouterOutlet=e([ht("tha-router-outlet")],t.ThaRouterOutlet),t.ThaRouter=class extends(Le($e)){static{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-id","tha-router-styles"),t.textContent=c`
|
|
132
175
|
tha-router {
|
|
133
176
|
& > :not(tha-router-outlet) {
|
|
134
177
|
display: none;
|
|
135
178
|
}
|
|
136
179
|
}
|
|
137
|
-
`.toString(),document.head.appendChild(t)}#u=new MutationObserver(e=>{e.filter(t=>"childList"===t.type).length&&this.#d.set(Array.from(this.children).filter(e=>e instanceof t.ThaRoute).map(t=>new WeakRef(t)))});#p=
|
|
180
|
+
`.toString(),document.head.appendChild(t)}#u=new MutationObserver(e=>{e.filter(t=>"childList"===t.type).length&&this.#d.set(Array.from(this.children).filter(e=>e instanceof t.ThaRoute).map(t=>new WeakRef(t)))});#p=ye;#f=ye;#v=ye;#d=ue([]);#m=ue(null);#y=ue(null);connectedCallback(){super.connectedCallback(),this.#u.observe(this,{childList:!0}),this.#p=this.updateEffect(()=>{const t=this.#m.get()?.deref()??null,e=this.#y.get()?.deref()??null;e?.[De](t)}),this.#f=this.updateEffect(()=>{const t=this[Ie].get();this.#v(),this.#g({location:this[Ie].get().location,action:"POP"}),this.#v=t?t.listen(this.#g):ye}),We(()=>{this.#g({location:this[Ie].get().location,action:"POP"})})}assignOutlet(t){this.#y.set(t?new WeakRef(t):null)}#g=t=>{const e=this.#d.get().map(t=>t.deref()).filter(Boolean);for(const r of e){const e=r[me];if(e?.test({pathname:t.location.pathname}))return void this.#m.set(new WeakRef(r))}this.#m.set(null)};disconnectedCallback(){super.disconnectedCallback();try{this.#p(),this.#f()}catch{}this.#u.disconnect(),this.#v()}createRenderRoot(){return this}},t.ThaRouter=e([ht("tha-router")],t.ThaRouter),t.ThaRouterLink=class extends(Le($e)){constructor(){super(...arguments),this.to=null,this.active=!1,this.#$=ye,this.#v=ye,this.#_=ue(null),this.#b=de(()=>{const t=this.#_.get();if(!t||"back"===t||"forward"===t)return null;try{return new URLPattern({pathname:t})}catch{return null}}),this.#S=t=>{const e=this[Ie].get();if(console.log(this[He].get()),"back"===this.to)return e.back();if("forward"===this.to)return e.forward();const r=e.location.pathname+e.location.search+e.location.hash;let o=this.to;if(o?.startsWith(".")){const t=ze(r.split("/")),e=ze(o.split("/"));for(const r of e)".."===r?t.pop():"."!==r&&t.push(r);o="/"+t.join("/")}o=o?.replaceAll("//","/"),this[Ie].get()?.push(o||"/")}}static{const t=document.createElement("style");t.setAttribute("type","text/css"),t.setAttribute("data-id","tha-router-link-styles"),t.textContent=c`
|
|
138
181
|
tha-router-link {
|
|
139
182
|
cursor: pointer;
|
|
140
183
|
}
|
|
141
|
-
`.toString(),document.head.appendChild(t)}#$;#v;#_;#b;connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#S),this.#$=this.updateEffect(()=>{const t=this[
|
|
184
|
+
`.toString(),document.head.appendChild(t)}#$;#v;#_;#b;connectedCallback(){super.connectedCallback(),this.addEventListener("click",this.#S),this.#$=this.updateEffect(()=>{const t=this[Ie].get(),e=this.#b.get();this.active=e?.test({pathname:t?.location.pathname??""})??!1,this.#v=t?.listen(()=>{this.active=e?.test({pathname:t.location.pathname})??!1})??ye})}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"to"===t)this.#_.set(r)}#S;disconnectedCallback(){super.disconnectedCallback();try{this.#$()}catch{}this.#v(),this.removeEventListener("click",this.#S)}createRenderRoot(){return this}},e([pt({type:String}),r("design:type",Object)],t.ThaRouterLink.prototype,"to",void 0),e([pt({type:Boolean,reflect:!0}),r("design:type",Object)],t.ThaRouterLink.prototype,"active",void 0),t.ThaRouterLink=e([ht("tha-router-link")],t.ThaRouterLink),t.ThaRouterConfig=class extends(Le($e)){#w=ye;connectedCallback(){super.connectedCallback(),document.head.contains(this)&&(console.log("ThaRouterConfig: Setting global history type to",this[He].get()),this.#w=this.updateEffect(()=>{Ue.set(this[He].get())}))}disconnectedCallback(){super.disconnectedCallback();try{this.#w()}catch{}}createRenderRoot(){return this}},t.ThaRouterConfig=e([ht("tha-router-config")],t.ThaRouterConfig),t.ThaRouterParam=class extends $e{constructor(){super(...arguments),this.#y=ue(null),this.#C=ue(""),this.#A=de(()=>this.#y.get()?.[Ve]?.get()[this.#C.get()]),this.name=""}#y;#C;#A;connectedCallback(){super.connectedCallback();const t=this.closest("tha-router-outlet");if(!t)throw new Error("<tha-router-param> must be used within a <tha-router-outlet>.");this.#y.set(t)}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),"name"===t)this.#C.set(r??"")}render(){return he`${this.#A}`}},e([pt({type:String}),r("design:type",String)],t.ThaRouterParam.prototype,"name",void 0),t.ThaRouterParam=e([ht("tha-router-param")],t.ThaRouterParam)}(this.TelperionElements.Router=this.TelperionElements.Router||{});
|
|
142
185
|
//# sourceMappingURL=index.js.map
|