mancha 0.9.4 → 0.9.6

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/dist/mancha.js CHANGED
@@ -1,74 +1,4 @@
1
- (()=>{"use strict";const e=/^\s*(?!javascript:)(?:[\w+.-]+:|[^:/?#]*(?:[/?#]|$))/i;function t(t){if(!function(t){const r=!e.test(t);return r}(t))return t}function r(e){return t(e)}
2
- /**
3
- * @license
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- const i={};function n(e){0}"undefined"!=typeof window&&window.TrustedScriptURL;
7
- /**
8
- * @license
9
- * SPDX-License-Identifier: Apache-2.0
10
- */
11
- class s{constructor(e,t){this.privateDoNotAccessOrElseWrappedAttributePrefix=t}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}}const o=s;function a(e){if(function(e){return e instanceof s}(e))return e.privateDoNotAccessOrElseWrappedAttributePrefix;throw new Error("")}"undefined"!=typeof window&&window.TrustedHTML;function c(e,t,r,i){if(0===e.length){throw new Error("")}const n=e.map((e=>a(e))),s=r.toLowerCase();if(n.every((e=>0!==s.indexOf(e))))throw new Error(`Attribute "${r}" does not match any of the allowed prefixes.`);t.setAttribute(r,i)}"undefined"!=typeof window&&window.TrustedScript;
12
- /**
13
- * @license
14
- * SPDX-License-Identifier: Apache-2.0
15
- */
16
- class l{}class h extends l{constructor(e,t){super(),n(),this.privateDoNotAccessOrElseWrappedStyleSheet=e}toString(){return this.privateDoNotAccessOrElseWrappedStyleSheet}}
17
- /**
18
- * @license
19
- * SPDX-License-Identifier: Apache-2.0
20
- */
21
- function u(e,t){e.textContent=function(e){if(e instanceof h)return e.privateDoNotAccessOrElseWrappedStyleSheet;throw new Error("")}(t)}Error;class d{iterable;constructor(e){this.iterable=e}filter(e){return new d(d.filterGenerator(e,this.iterable))}map(e){return new d(d.mapGenerator(e,this.iterable))}find(e){for(const t of this.iterable)if(e(t))return t}array(){return Array.from(this.iterable)}*generator(){for(const e of this.iterable)yield e}static*filterGenerator(e,t){for(const r of t)e(r)&&(yield r)}static*mapGenerator(e,t){for(const r of t)yield e(r)}static equals(e,t){const r=e[Symbol.iterator](),i=t[Symbol.iterator]();let n=r.next(),s=i.next();for(;!n.done&&!s.done;){if(n.value!==s.value)return!1;n=r.next(),s=i.next()}return n.done===s.done}}function p(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function f(e){return-1===e.toString().indexOf("`")}f((e=>e``))||f((e=>e`\0`))||f((e=>e`\n`))||f((e=>e`\u0000`)),p``&&p`\0`&&p`\n`&&p`\u0000`;
22
- /**
23
- * @license
24
- * SPDX-License-Identifier: Apache-2.0
25
- */
26
- function m(e){const t=e[0].toLowerCase();return new o(i,t)}
27
- /**
28
- * @license
29
- * SPDX-License-Identifier: Apache-2.0
30
- */
31
- var _,E;
32
- /**
33
- * @license
34
- * SPDX-License-Identifier: Apache-2.0
35
- */
36
- function g(e){return{valueOf:e}.valueOf()}!function(e){e[e.STYLE_TAG=0]="STYLE_TAG",e[e.STYLE_ATTRIBUTE=1]="STYLE_ATTRIBUTE",e[e.HTML_ATTRIBUTE=2]="HTML_ATTRIBUTE"}(_||(_={}));
37
- /**
38
- * @license
39
- * SPDX-License-Identifier: Apache-2.0
40
- */
41
- class ${constructor(e,t,r,i,n){this.allowedElements=e,this.elementPolicies=t,this.allowedGlobalAttributes=r,this.globalAttributePolicies=i,this.globallyAllowedAttributePrefixes=n}isAllowedElement(e){return"FORM"!==e&&(this.allowedElements.has(e)||this.elementPolicies.has(e))}getAttributePolicy(e,t){const r=this.elementPolicies.get(t);if(null==r?void 0:r.has(e))return r.get(e);if(this.allowedGlobalAttributes.has(e))return{policyAction:E.KEEP};const i=this.globalAttributePolicies.get(e);return i||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some((t=>0===e.indexOf(t)))?{policyAction:E.KEEP}:{policyAction:E.DROP})}}!function(e){e[e.DROP=0]="DROP",e[e.KEEP=1]="KEEP",e[e.KEEP_AND_SANITIZE_URL=2]="KEEP_AND_SANITIZE_URL",e[e.KEEP_AND_NORMALIZE=3]="KEEP_AND_NORMALIZE",e[e.KEEP_AND_SANITIZE_STYLE=4]="KEEP_AND_SANITIZE_STYLE",e[e.KEEP_AND_USE_RESOURCE_URL_POLICY=5]="KEEP_AND_USE_RESOURCE_URL_POLICY",e[e.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET=6]="KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET"}(E||(E={}));new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);
42
- /**
43
- * @license
44
- * SPDX-License-Identifier: Apache-2.0
45
- */
46
- const v=["ARTICLE","SECTION","NAV","ASIDE","H1","H2","H3","H4","H5","H6","HEADER","FOOTER","ADDRESS","P","HR","PRE","BLOCKQUOTE","OL","UL","LH","LI","DL","DT","DD","FIGURE","FIGCAPTION","MAIN","DIV","EM","STRONG","SMALL","S","CITE","Q","DFN","ABBR","RUBY","RB","RT","RTC","RP","DATA","TIME","CODE","VAR","SAMP","KBD","SUB","SUP","I","B","U","MARK","BDI","BDO","SPAN","BR","WBR","INS","DEL","PICTURE","PARAM","TRACK","MAP","TABLE","CAPTION","COLGROUP","COL","TBODY","THEAD","TFOOT","TR","TD","TH","SELECT","DATALIST","OPTGROUP","OPTION","OUTPUT","PROGRESS","METER","FIELDSET","LEGEND","DETAILS","SUMMARY","MENU","DIALOG","SLOT","CANVAS","FONT","CENTER","ACRONYM","BASEFONT","BIG","DIR","HGROUP","STRIKE","TT"],b=[["A",new Map([["href",{policyAction:E.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:E.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY,conditions:new Map([["rel",new Set(["alternate","author","bookmark","canonical","cite","help","icon","license","next","prefetch","dns-prefetch","prerender","preconnect","preload","prev","search","subresource"])]])}]])],["SOURCE",new Map([["src",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY}]])]],y=["title","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-current","aria-disabled","aria-dropeffect","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-level","aria-live","aria-multiline","aria-multiselectable","aria-orientation","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","alt","align","autocapitalize","autocomplete","autocorrect","autofocus","autoplay","bgcolor","border","cellpadding","cellspacing","checked","color","cols","colspan","controls","datetime","disabled","download","draggable","enctype","face","formenctype","frameborder","height","hreflang","hidden","ismap","label","lang","loop","max","maxlength","media","minlength","min","multiple","muted","nonce","open","placeholder","preload","rel","required","reversed","role","rows","rowspan","selected","shape","size","sizes","slot","span","spellcheck","start","step","summary","translate","type","valign","value","width","wrap","itemscope","itemtype","itemid","itemprop","itemref"],w=[["dir",{policyAction:E.KEEP_AND_NORMALIZE,conditions:g((()=>new Map([["dir",new Set(["auto","ltr","rtl"])]])))}],["async",{policyAction:E.KEEP_AND_NORMALIZE,conditions:g((()=>new Map([["async",new Set(["async"])]])))}],["cite",{policyAction:E.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:E.KEEP_AND_NORMALIZE,conditions:g((()=>new Map([["loading",new Set(["eager","lazy"])]])))}],["poster",{policyAction:E.KEEP_AND_SANITIZE_URL}],["target",{policyAction:E.KEEP_AND_NORMALIZE,conditions:g((()=>new Map([["target",new Set(["_self","_blank"])]])))}]];new $(new Set(v),new Map(b),new Set(y),new Map(w)),new $(new Set(g((()=>v.concat(["STYLE"])))),new Map(b),new Set(g((()=>y.concat(["id","name","class"])))),new Map(g((()=>w.concat([["style",{policyAction:E.KEEP_AND_SANITIZE_STYLE}]])))));
47
- /**
48
- * @license
49
- * SPDX-License-Identifier: Apache-2.0
50
- */
51
- function x(e){return function(e){return new h(e,i)}(e[0])}const A=[m`:`,m`style`,m`class`];function*O(e,t=new Set){const r=new Set,i=Array.from(e.childNodes).filter((e=>!t.has(e)));for(yield e;i.length;){const e=i.shift();r.has(e)||(r.add(e),yield e),e.childNodes&&Array.from(e.childNodes).filter((e=>!t.has(e))).forEach((e=>i.push(e)))}}function R(e,t){return void 0!==e?.[t]}function I(e,t){return"function"==typeof e?.[t]}function N(e,t){return R(e,"attribs")?e.attribs?.[t]??null:e.getAttribute?.(t)}function T(e,t,r){R(e,"attribs")?e.attribs[t]=r:c(A,e,t,r)}function S(e,t){R(e,"attribs")?delete e.attribs[t]:e.removeAttribute?.(t)}function P(e,t,r){if(R(e,"attribs")&&R(t,"attribs"))t.attribs[r]=e.attribs[r];else{const i=e?.getAttribute?.(r);T(t,r,i||"")}}function k(e,...t){if(I(e,"replaceWith"))return e.replaceWith(...t);{const r=e,i=r.parentNode,n=Array.from(i.childNodes).indexOf(r);t.forEach((e=>e.parentNode=i)),i.childNodes=[].concat(Array.from(i.childNodes).slice(0,n)).concat(t).concat(Array.from(i.childNodes).slice(n+1))}}function C(e,...t){I(e,"replaceChildren")?e.replaceChildren(...t):(e.childNodes=t,t.forEach((t=>t.parentNode=e)))}function L(e,t){return I(t,"appendChild")?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,t)}function D(e,t){return I(t,"removeChild")?e.removeChild(t):(C(e,...Array.from(e.childNodes).filter((e=>e!==t))),t)}function M(e,t,r){return r?I(e,"insertBefore")?e.insertBefore(t,r):(k(r,t,r),t):L(e,t)}function U(e,t=0){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function j(e,t=0){return U(e.outerHTML||e.nodeValue||String(e),t)}function z(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):""}var G;!function(e){e.resolveIncludes=async function(e,t){const r=e;if("include"!==r.tagName?.toLocaleLowerCase())return;this.log("<include> tag found in:\n",j(e,128)),this.log("<include> params:",t);const i=N(r,"src");if(!i)throw new Error(`"src" attribute missing from ${e}.`);const n=t=>{const i=t.firstChild;for(const e of Array.from(r.attributes))i&&"src"!==e.name&&P(r,i,e.name);k(e,...t.childNodes)},s={...t,rootDocument:!1,maxdepth:t?.maxdepth-1};if(0===s.maxdepth)throw new Error("Maximum recursion depth reached.");if(i.includes("://")||i.startsWith("//"))this.log("Including remote file from absolute path:",i),await this.preprocessRemote(i,s).then(n);else if(t?.dirpath?.includes("://")||t?.dirpath?.startsWith("//")){const e=i.startsWith("/")?i:`${t.dirpath}/${i}`;this.log("Including remote file from relative path:",e),await this.preprocessRemote(e,s).then(n)}else if("/"===i.charAt(0))this.log("Including local file from absolute path:",i),await this.preprocessLocal(i,s).then(n);else{const e=t?.dirpath&&"."!==t?.dirpath?`${t?.dirpath}/${i}`:i;this.log("Including local file from relative path:",e),await this.preprocessLocal(e,s).then(n)}},e.rebaseRelativePaths=async function(e,t){const i=e,n=i.tagName?.toLowerCase();if(!t?.dirpath)return;const s=N(i,"src"),o=N(i,"href"),a=s||o;if(a&&!((c=a).includes("://")||c.startsWith("/")||c.startsWith("#")||c.startsWith("data:"))){const e=`${t.dirpath}/${a}`;this.log("Rebasing relative path as:",e),"img"===n?i.src=e:"a"===n?
52
- /**
53
- * @license
54
- * SPDX-License-Identifier: Apache-2.0
55
- */
56
- function(e,t){const i=r(t);void 0!==i&&(e.href=i)}(i,e):"source"===n||"audio"===n||"video"===n||"track"===n||"input"===n?i.src=e:"area"===n?
57
- /**
58
- * @license
59
- * SPDX-License-Identifier: Apache-2.0
60
- */
61
- function(e,t){const i=r(t);void 0!==i&&(e.href=i)}(i,e):this.log("Unable to rebase relative path for element:",n)}var c},e.registerCustomElements=async function(e,t){const r=e;if("template"===r.tagName?.toLowerCase()&&N(r,"is")){const e=N(r,"is")?.toLowerCase();this._customElements.has(e)||(this.log(`Registering custom element: ${e}\n`,j(r,128)),this._customElements.set(e,r.cloneNode(!0)),D(r.parentNode,r))}},e.resolveCustomElements=async function(e,t){const r=e,i=r.tagName?.toLowerCase();if(this._customElements.has(i)){this.log(`Processing custom element: ${i}\n`,j(r,128));const t=this._customElements.get(i),n=(t.content||t).cloneNode(!0),s=function(e){return R(e,"firstElementChild")?e.firstElementChild:Array.from(e.children).find((e=>1===e.nodeType))}(n);for(const e of Array.from(r.attributes))s&&P(r,s,e.name);const o=new d(O(n)).find((e=>"slot"===e.tagName?.toLowerCase()));o&&k(o,...r.childNodes),k(e,...n.childNodes)}},e.resolveTextNodeExpressions=async function(e,t){const r=e.nodeValue||"";if(3!==e.nodeType||!r?.trim())return;this.log("Processing node content value:\n",U(r,128));const i=new RegExp(/{{ ([^}]+) }}/gm),n=Array.from(r.matchAll(i)).map((e=>e[1]));return this.effect((function(){let t=r;for(const r of n){const i=this.eval(r,{$elem:e});t=t.replace(`{{ ${r} }}`,String(i))}e.nodeValue=t}))},e.resolveDataAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":data");if(i){this.log(":data attribute found in:\n",j(e,128)),S(r,":data");const n=t?.rootNode===e?this:this.clone();e.renderer=n;const s=n.eval(i,{$elem:e});if(await Promise.all(Object.entries(s).map((([e,t])=>n.set(e,t)))),n!==this)for(const t of O(e,this._skipNodes))this._skipNodes.add(t);await n.mount(e,t)}},e.resolveClassAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":class");if(i){this.log(":class attribute found in:\n",j(e,128)),S(r,":class");const t=N(r,"class")||"";return this.effect((function(){const n=this.eval(i,{$elem:e});T(r,"class",(n?`${t} ${n}`:t).trim())}))}},e.resolveTextAttributes=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":text");if(i){this.log(":text attribute found in:\n",j(e,128)),S(r,":text");const t=t=>this.textContent(e,t);return this.effect((function(){t(this.eval(i,{$elem:e}))}))}},e.resolveHtmlAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":html");return i?(this.log(":html attribute found in:\n",j(e,128)),S(r,":html"),this.effect((function(){const n=this.eval(i,{$elem:e});return new Promise((async e=>{const i=await this.preprocessString(n,t);await this.renderNode(i),C(r,i),e()}))}))):void 0},e.resolveEventAttributes=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[]))t.name.startsWith(":on:")&&(this.log(t.name,"attribute found in:\n",j(e,128)),S(r,t.name),e.addEventListener?.(t.name.substring(4),(r=>this.eval(t.value,{$elem:e,$event:r}))))},e.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":for")?.trim();if(i){this.log(":for attribute found in:\n",j(e,128)),S(r,":for");for(const t of O(e,this._skipNodes))this._skipNodes.add(t);const n=e.parentNode,s=this.createElement("template",e.ownerDocument);M(n,s,e),D(n,e),L(s,e),this.log(":for template:\n",j(s,128));const o=i.split(" in ",2);if(2!==o.length)throw new Error(`Invalid :for format: \`${i}\`. Expected "{key} in {expression}".`);const a=[],[c,l]=o;await this.effect((function(){const r=this.eval(l,{$elem:e});if(this.log(":for list items:",r),a.splice(0,a.length).forEach((e=>{D(n,e),this._skipNodes.delete(e)})),!Array.isArray(r))return console.error(`Expression did not yield a list: \`${l}\` => \`${r}\``),Promise.resolve();const i=[];for(const n of r){const r=this.clone();r.set(c,n);const s=e.cloneNode(!0);a.push(s),this._skipNodes.add(s),i.push(r.mount(s,t)),this.log("Rendered list child:\n",j(s,128))}const o=s.nextSibling;for(const e of a)M(n,e,o);return Promise.all(i)}))}},e.resolveBindAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":bind");if(i){this.log(":bind attribute found in:\n",j(e,128));const t=["change","input"],n=N(r,":bind:on")?.split(",")||t;S(r,":bind"),S(r,":bind:on");const s="checkbox"===N(r,"type")?"checked":"value";this.effect((function(){const t=this.eval(i,{$elem:e});r[s]=t}));const o=`${i} = $elem.${s}`;for(const t of n)e.addEventListener(t,(()=>this.eval(o,{$elem:e})))}},e.resolveShowAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":show");if(i){this.log(":show attribute found in:\n",j(e,128)),S(r,":show");const t="none"===r.style?.display?"":r.style?.display??N(r,"style")?.split(";")?.find((e=>"display"===e.split(":")[0]))?.split(":")?.at(1)?.trim();this.effect((function(){const n=this.eval(i,{$elem:e});r.style?r.style.display=n?t:"none":T(r,"style",`display: ${n?t:"none"};`)}))}},e.resolveCustomAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[]))if(t.name.startsWith(":")){this.log(t.name,"attribute found in:\n",j(e,128)),S(r,t.name);const i=t.name.substring(1).replace(/-./g,(e=>e[1].toUpperCase()));this.effect((function(){const n=this.eval(t.value,{$elem:e});r[i]=n}))}}}(G||(G={}));
62
- /*
63
- * @license
64
- * Portions Copyright (c) 2013, the Dart project authors.
65
- */
66
- const F=["this"],K=["+","-","!"],Y=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],W={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},B=["==","!=","<=",">=","||","&&","??","|>"],H=["===","!=="];var V;!function(e){e[e.STRING=1]="STRING",e[e.IDENTIFIER=2]="IDENTIFIER",e[e.DOT=3]="DOT",e[e.COMMA=4]="COMMA",e[e.COLON=5]="COLON",e[e.INTEGER=6]="INTEGER",e[e.DECIMAL=7]="DECIMAL",e[e.OPERATOR=8]="OPERATOR",e[e.GROUPER=9]="GROUPER",e[e.KEYWORD=10]="KEYWORD",e[e.ARROW=11]="ARROW"}(V||(V={}));const Z=(e,t,r=0)=>({kind:e,value:t,precedence:r}),q=e=>95===e||36===e||65<=(e&=-33)&&e<=90,Q=e=>48<=e&&e<=57;class X{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;9===(e=this._next)||10===e||13===e||32===e;)this._advance(!0);var e;if((e=>34===e||39===e)(this._next))return this._tokenizeString();if(q(this._next))return this._tokenizeIdentOrKeyword();if(Q(this._next))return this._tokenizeNumber();if(46===this._next)return this._tokenizeDot();if(44===this._next)return this._tokenizeComma();if(58===this._next)return this._tokenizeColon();if((e=>43===e||45===e||42===e||47===e||33===e||38===e||37===e||60===e||61===e||62===e||63===e||94===e||124===e)(this._next))return this._tokenizeOperator();if((e=>40===e||41===e||91===e||93===e||123===e||125===e)(this._next))return this._tokenizeGrouper();if(this._advance(),void 0!==this._next)throw new Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),!0===e&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){const t=this._input.substring(this._tokenStart,this._index+e);return 0===e&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){const e="unterminated string",t=this._next;for(this._advance(!0);this._next!==t;){if(void 0===this._next)throw new Error(e);if(92===this._next&&(this._advance(),void 0===this._next))throw new Error(e);this._advance()}const r=Z(V.STRING,this._getValue().replace(/\\(.)/g,((e,t)=>{switch(t){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";default:return t}})));return this._advance(),r}_tokenizeIdentOrKeyword(){do{this._advance()}while(e=this._next,q(e)||Q(e));var e;const t=this._getValue(),r=(i=t,-1!==F.indexOf(i)?V.KEYWORD:V.IDENTIFIER);var i;return Z(r,t)}_tokenizeNumber(){do{this._advance()}while(Q(this._next));return 46===this._next?this._tokenizeDot():Z(V.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),Q(this._next)?this._tokenizeFraction():(this._clearValue(),Z(V.DOT,".",13))}_tokenizeComma(){return this._advance(!0),Z(V.COMMA,",")}_tokenizeColon(){return this._advance(!0),Z(V.COLON,":")}_tokenizeFraction(){do{this._advance()}while(Q(this._next));return Z(V.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(-1!==H.indexOf(e))this._advance(),this._advance();else{if(e=this._getValue(1),"=>"===e)return this._advance(),Z(V.ARROW,e);-1!==B.indexOf(e)&&this._advance()}return e=this._getValue(),Z(V.OPERATOR,e,W[e])}_tokenizeGrouper(){const e=String.fromCharCode(this._next),t=Z(V.GROUPER,e,W[e]);return this._advance(!0),t}}class J{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new X(e),this._ast=t}parse(){return this._advance(),this._parseExpression()}_advance(e,t){if(!this._matches(e,t))throw new Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);const r=this._tokenizer.nextToken();this._token=r,this._kind=r?.kind,this._value=r?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();const e=this._parseUnary();return void 0===e?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(void 0===e)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(V.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(V.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(V.DOT)){this._advance();const t=this._parseUnary();e=this._makeInvokeOrGetter(e,t)}else{if(this._matches(V.KEYWORD))break;if(!(this._matches(V.OPERATOR)&&this._token.precedence>=t))break;e="?"===this._value?this._parseTernary(e):this._parseBinary(e,this._token)}return e}_makeInvokeOrGetter(e,t){if(void 0===t)throw new Error("expected identifier");if("ID"===t.type)return this._ast.getter(e,t.value);if("Invoke"===t.type&&"ID"===t.receiver.type){const r=t.receiver;return this._ast.invoke(e,r.value,t.arguments)}throw new Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(-1===Y.indexOf(t.value))throw new Error(`unknown operator: ${t.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===V.OPERATOR||this._kind===V.DOT||this._kind===V.GROUPER)&&this._token.precedence>t.precedence;)r=this._parsePrecedence(r,this._token.precedence);return this._ast.binary(e,t.value,r)}_parseUnary(){if(this._matches(V.OPERATOR)){const e=this._value;if(this._advance(),"+"===e||"-"===e){if(this._matches(V.INTEGER))return this._parseInteger(e);if(this._matches(V.DECIMAL))return this._parseDecimal(e)}if(-1===K.indexOf(e))throw new Error(`unexpected token: ${e}`);const t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(V.OPERATOR,"?");const t=this._parseExpression();this._advance(V.COLON);const r=this._parseExpression();return this._ast.ternary(e,t,r)}_parsePrimary(){switch(this._kind){case V.KEYWORD:const e=this._value;if("this"===e)return this._advance(),this._ast.id(e);if(-1!==F.indexOf(e))throw new Error(`unexpected keyword: ${e}`);throw new Error(`unrecognized keyword: ${e}`);case V.IDENTIFIER:return this._parseInvokeOrIdentifier();case V.STRING:return this._parseString();case V.INTEGER:return this._parseInteger();case V.DECIMAL:return this._parseDecimal();case V.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case V.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const e=[];do{if(this._advance(),this._matches(V.GROUPER,"]"))break;e.push(this._parseExpression())}while(this._matches(V.COMMA));return this._advance(V.GROUPER,"]"),this._ast.list(e)}_parseMap(){const e={};do{if(this._advance(),this._matches(V.GROUPER,"}"))break;const t=this._value;(this._matches(V.STRING)||this._matches(V.IDENTIFIER))&&this._advance(),this._advance(V.COLON),e[t]=this._parseExpression()}while(this._matches(V.COMMA));return this._advance(V.GROUPER,"}"),this._ast.map(e)}_parseInvokeOrIdentifier(){const e=this._value;if("true"===e)return this._advance(),this._ast.literal(!0);if("false"===e)return this._advance(),this._ast.literal(!1);if("null"===e)return this._advance(),this._ast.literal(null);if("undefined"===e)return this._advance(),this._ast.literal(void 0);const t=this._parseIdentifier(),r=this._parseArguments();return r?this._ast.invoke(t,void 0,r):t}_parseIdentifier(){if(!this._matches(V.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(V.GROUPER,"("))return;const e=[];do{if(this._advance(),this._matches(V.GROUPER,")"))break;const t=this._parseExpression();e.push(t)}while(this._matches(V.COMMA));return this._advance(V.GROUPER,")"),e}_parseIndex(){this._advance();const e=this._parseExpression();return this._advance(V.GROUPER,"]"),e}_parseParenOrFunction(){const e=this._parseArguments();if(this._matches(V.ARROW)){this._advance();const t=this._parseExpression(),r=e?.map((e=>e.value))??[];return this._ast.arrowFunction(r,t)}return this._ast.paren(e[0])}_parseString(){const e=this._ast.literal(this._value);return this._advance(),e}_parseInteger(e=""){const t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=""){const t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}}
67
- /*
68
- * @license
69
- * Portions Copyright (c) 2013, the Dart project authors.
70
- */
71
- const ee={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"??":(e,t)=>e??t,"|":(e,t)=>t(e),"|>":(e,t)=>t(e)},te={"+":e=>e,"-":e=>-e,"!":e=>!e};class re{timeouts=new Map;debounce(e,t){return new Promise(((r,i)=>{const n=this.timeouts.get(t);n&&clearTimeout(n),this.timeouts.set(t,setTimeout((()=>{try{r(t()),this.timeouts.delete(t)}catch(e){i(e)}}),e))}))}}const ie=new class{empty(){return{type:"Empty",evaluate:e=>e,getIds:e=>e}}literal(e){return{type:"Literal",value:e,evaluate(e){return this.value},getIds:e=>e}}id(e){return{type:"ID",value:e,evaluate(e){return"this"===this.value?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(e,t){const r=te[e];return{type:"Unary",operator:e,child:t,evaluate(e){return r(this.child.evaluate(e))},getIds(e){return this.child.getIds(e)}}}binary(e,t,r){const i=ee[t];return{type:"Binary",operator:t,left:e,right:r,evaluate(e){if("="===this.operator){if("ID"!==this.left.type&&"Getter"!==this.left.type&&"Index"!==this.left.type)throw new Error(`Invalid assignment target: ${this.left}`);const t=this.right.evaluate(e);let r,i;return"Getter"===this.left.type?(r=this.left.receiver.evaluate(e),i=this.left.name):"Index"===this.left.type?(r=this.left.receiver.evaluate(e),i=this.left.argument.evaluate(e)):"ID"===this.left.type&&(r=e,i=this.left.value),void 0===r?void 0:r[i]=t}return i(this.left.evaluate(e),this.right.evaluate(e))},getIds(e){return this.left.getIds(e),this.right.getIds(e),e}}}getter(e,t){return{type:"Getter",receiver:e,name:t,evaluate(e){return this.receiver.evaluate(e)?.[this.name]},getIds(e){return this.receiver.getIds(e),e}}}invoke(e,t,r){if(null!=t&&"string"!=typeof t)throw new Error("method not a string");return{type:"Invoke",receiver:e,method:t,arguments:r,evaluate(e){const r=this.receiver.evaluate(e),i=this.method?r:e?.this??e,n=this.method?r?.[t]:r,s=(this.arguments??[]).map((t=>t?.evaluate(e)));return n?.apply?.(i,s)},getIds(e){return this.receiver.getIds(e),this.arguments?.forEach((t=>t?.getIds(e))),e}}}paren(e){return e}index(e,t){return{type:"Index",receiver:e,argument:t,evaluate(e){return this.receiver.evaluate(e)?.[this.argument.evaluate(e)]},getIds(e){return this.receiver.getIds(e),e}}}ternary(e,t,r){return{type:"Ternary",condition:e,trueExpr:t,falseExpr:r,evaluate(e){return this.condition.evaluate(e)?this.trueExpr.evaluate(e):this.falseExpr.evaluate(e)},getIds(e){return this.condition.getIds(e),this.trueExpr.getIds(e),this.falseExpr.getIds(e),e}}}map(e){return{type:"Map",entries:e,evaluate(t){const r={};if(e&&this.entries)for(const i in e){const e=this.entries[i];e&&(r[i]=e.evaluate(t))}return r},getIds(t){if(e&&this.entries)for(const r in e){const e=this.entries[r];e&&e.getIds(t)}return t}}}list(e){return{type:"List",items:e,evaluate(e){return this.items?.map((t=>t?.evaluate(e)))},getIds(e){return this.items?.forEach((t=>t?.getIds(e))),e}}}arrowFunction(e,t){return{type:"ArrowFunction",params:e,body:t,evaluate(e){const t=this.params,r=this.body;return function(...i){const n=Object.fromEntries(t.map(((e,t)=>[e,i[t]]))),s=new Proxy(e??{},{set:(e,t,r)=>(n.hasOwnProperty(t)&&(n[t]=r),e[t]=r),get:(e,t)=>n.hasOwnProperty(t)?n[t]:e[t]});return r.evaluate(s)}},getIds(e){return this.body.getIds(e).filter((e=>!this.params.includes(e)))}}}};class ne extends re{evalkeys=["$elem","$event"];expressionCache=new Map;store=new Map;observers=new Map;_observer=null;_lock=Promise.resolve();constructor(e){super();for(let[t,r]of Object.entries(e||{}))this.set(t,r)}wrapFunction(e){return(...t)=>e.call(this.$,...t)}wrapObject(e,t){return null==e||((r=e)instanceof ne||r.__is_proxy__)||e.constructor!==Object&&!Array.isArray(e)?e:new Proxy(e,{deleteProperty:(e,r)=>r in e&&(delete e[r],t(),!0),set:(r,i,n,s)=>{"object"==typeof n&&null!=e&&(n=this.wrapObject(n,t));const o=Reflect.set(r,i,n,s);return t(),o},get:(e,t,r)=>"__is_proxy__"===t||Reflect.get(e,t,r)});var r}watch(e,t){this.observers.has(e)||this.observers.set(e,new Set),this.observers.get(e)?.has(t)||this.observers.get(e)?.add(t)}async notify(e,t=10){const r=Array.from(this.observers.get(e)||[]);await this.debounce(t,(()=>Promise.all(r.map((e=>e.call(this.proxify(e)))))))}get(e,t){return t&&this.watch(e,t),this.store.get(e)}async set(e,t){if(t===this.store.get(e))return;const r=()=>this.notify(e);t&&"function"==typeof t&&(t=this.wrapFunction(t)),t&&"object"==typeof t&&(t=this.wrapObject(t,r)),this.store.set(e,t),await r()}del(e){this.store.delete(e),this.observers.delete(e)}has(e){return this.store.has(e)}effect(e){return e.call(this.proxify(e))}proxify(e){const t=Array.from(this.store.entries()).map((([e])=>e)),r=Object.fromEntries(t.map((e=>[e,void 0])));return new Proxy(r,{get:(t,r,i)=>"string"==typeof r&&this.store.has(r)?this.get(r,e):"$"===r?this.proxify(e):Reflect.get(this,r,i),set:(e,t,r,i)=>("string"!=typeof t||t in this?Reflect.set(this,t,r,i):this.set(t,r),!0)})}get $(){return this.proxify()}makeEvalFunction(e){if(e.includes(";"))throw new Error("Complex expressions are not supported.");let t=null;if(e.includes("=")){const[r,i]=e.split("=");t=r.trim(),e=i.trim()}return(r,i)=>{const n=((e,t)=>new J(e,t).parse())(e,ie),s=n?.getIds([])?.map((e=>[e,i[e]??r[e]??globalThis[e]])),o=n?.evaluate(Object.fromEntries(s||[]));if(!t)return o;r[t]=o}}cachedExpressionFunction(e){return e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e)),this.expressionCache.get(e)}eval(e,t={}){const r=this._observer?this:this.$;if(this.store.has(e))return r[e];return this.cachedExpressionFunction(e)(r,t)}}class se extends ne{debugging=!1;dirpath="";_skipNodes=new Set;_customElements=new Map;debug(e){return this.debugging=e,this}async fetchRemote(e,t){return fetch(e,{cache:t?.cache??"default"}).then((e=>e.text()))}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log("Preprocessing string content with params:\n",t);const r=this.parseHTML(e,t);return await this.preprocessNode(r,t),r}async preprocessRemote(e,t){const r={};t?.cache&&(r.cache=t.cache);const i=await fetch(e,r).then((e=>e.text()));return this.preprocessString(i,{...t,dirpath:z(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}async preprocessLocal(e,t){const r=await this.fetchLocal(e,t);return this.preprocessString(r,{...t,dirpath:z(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}clone(){const e=Object.fromEntries(this.store.entries()),t=new this.constructor(e).debug(this.debugging);return t._customElements=this._customElements,Array.from(this.store.keys()).forEach((e=>this.watch(e,(()=>t.set(e,this.get(e)))))),t}log(...e){this.debugging&&console.debug(...e)}async preprocessNode(e,t){t={dirpath:this.dirpath,maxdepth:10,...t};const r=new d(O(e,this._skipNodes)).map((async e=>{this.log("Preprocessing node:\n",j(e,128)),await G.resolveIncludes.call(this,e,t),await G.rebaseRelativePaths.call(this,e,t),await G.registerCustomElements.call(this,e,t),await G.resolveCustomElements.call(this,e,t)}));return await Promise.all(r.generator()),e}async renderNode(e,t){for(const r of O(e,this._skipNodes))this.log("Rendering node:\n",j(r,128)),await G.resolveDataAttribute.call(this,r,t),await G.resolveForAttribute.call(this,r,t),await G.resolveTextAttributes.call(this,r,t),await G.resolveHtmlAttribute.call(this,r,t),await G.resolveShowAttribute.call(this,r,t),await G.resolveClassAttribute.call(this,r,t),await G.resolveBindAttribute.call(this,r,t),await G.resolveEventAttributes.call(this,r,t),await G.resolveTextNodeExpressions.call(this,r,t),await G.resolveCustomAttribute.call(this,r,t);return e}async mount(e,t){t={...t,rootNode:e},await this.preprocessNode(e,t),await this.renderNode(e,t),e.renderer=this}}class oe extends se{dirpath=z(self.location.href);parseHTML(e,t={rootDocument:!1}){if(t.rootDocument)return(new DOMParser).parseFromString(e,"text/html");{const t=document.createRange();return t.selectNodeContents(document.body),t.createContextualFragment(e)}}serializeHTML(e){return(new XMLSerializer).serializeToString(e).replace(/\s?xmlns="[^"]+"/gm,"")}preprocessLocal(e,t){return this.preprocessRemote(e,t)}createElement(e,t){return(t||document).createElement(e)}textContent(e,t){e.textContent=t}}new oe;const ae={sm:640,md:768,lg:1024,xl:1280},ce=.25,le=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],he=[...le,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,112,128,144,160,192,224,256,288,320,384,448,512,...Object.values(ae)],ue=[1,2,5,10,20,25,30,40,50,60,70,75,80,90,95,98,99,100],de=["hover","focus","disabled","focus","active"],pe={margin:"m",padding:"p"},fe={width:"w",height:"h"},me={top:"top",right:"right",bottom:"bottom",left:"left"},_e={"min-width":"min-w","min-height":"min-h","max-width":"max-w","max-height":"max-h"},Ee={bold:{"font-weight":"bold"},semibold:{"font-weight":600},italic:{"font-style":"italic"},underline:{"text-decoration":"underline"},"no-underline":{"text-decoration":"none"},"decoration-none":{"text-decoration":"none"},"line-through":{"text-decoration":"line-through"},uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"font-mono":{"font-family":"monospace"},"font-sans":{"font-family":"sans-serif"},"font-serif":{"font-family":"serif"},"font-cursive":{"font-family":"cursive"},"text-left":{"text-align":"left"},"text-right":{"text-align":"right"},"text-center":{"text-align":"center"},"text-justify":{"text-align":"justify"},"text-xs":{"font-size":".75rem"},"text-sm":{"font-size":".875rem"},"text-base":{"font-size":"1rem"},"text-lg":{"font-size":"1.125rem"},"text-xl":{"font-size":"1.25rem"},relative:{position:"relative"},fixed:{position:"fixed"},absolute:{position:"absolute"},sticky:{position:"sticky"},"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},block:{display:"block"},contents:{display:"contents"},hidden:{display:"none"},inline:{display:"inline"},"inline-block":{display:"inline-block"},visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"},"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},flex:{display:"flex"},"flex-1":{flex:"1 1 0%"},"flex-inline":{display:"inline-flex"},"flex-row":{"flex-direction":"row"},"flex-col":{"flex-direction":"column"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col-reverse":{"flex-direction":"column-reverse"},"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"},"justify-start":{"justify-content":"flex-start"},"justify-end":{"justify-content":"flex-end"},"justify-center":{"justify-content":"center"},"justify-between":{"justify-content":"space-between"},"justify-around":{"justify-content":"space-around"},"justify-evenly":{"justify-content":"space-evenly"},"justify-stretch":{"justify-content":"stretch"},"items-start":{"align-items":"flex-start"},"items-end":{"align-items":"flex-end"},"items-center":{"align-items":"center"},"items-stretch":{"align-items":"stretch"},"flex-grow":{"flex-grow":1},"flex-shrink":{"flex-shrink":1},"overflow-auto":{overflow:"auto"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-not-allowed":{cursor:"not-allowed"},"select-none":{"user-select":"none"},"select-all":{"user-select":"all"},"pointer-events-auto":{"pointer-events":"auto"},"pointer-events-none":{"pointer-events":"none"},"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"},resize:{resize:"both"},"resize-x":{resize:"horizontal"},"resize-y":{resize:"vertical"},"resize-none":{resize:"none"},border:{border:"1px solid"},"border-none":{border:"none"},"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"rounded-none":{"border-radius":"0"},rounded:{"border-radius":".25rem"},"rounded-sm":{"border-radius":".125rem"},"rounded-md":{"border-radius":".375rem"},"rounded-lg":{"border-radius":".5rem"},"rounded-xl":{"border-radius":".75rem"},"rounded-full":{"border-radius":"9999px"},"transition-none":{transition:"none"},transition:{transition:"all 150ms ease-in-out"},"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}},ge=["@keyframes spin {\n from { transform: rotate(0deg) }\n to { transform: rotate(360deg) }\n }","@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n }","@keyframes pulse {\n 0%, 100% { opacity: 1 }\n 50% { opacity: .5 }\n }"],$e={red:{50:16772078,100:16764370,200:15702682,300:15037299,400:15684432,500:16007990,600:15022389,700:13840175,800:12986408,900:12000284},pink:{50:16573676,100:16301008,200:16027569,300:15753874,400:15483002,500:15277667,600:14162784,700:12720219,800:11342935,900:8916559},purple:{50:15984117,100:14794471,200:13538264,300:12216520,400:11225020,500:10233776,600:9315498,700:8069026,800:6953882,900:4854924},"deep-purple":{50:15591414,100:13747433,200:11771355,300:9795021,400:8280002,500:6765239,600:6174129,700:5320104,800:4532128,900:3218322},indigo:{50:15264502,100:12962537,200:10463450,300:7964363,400:6056896,500:4149685,600:3754411,700:3162015,800:2635155,900:1713022},blue:{50:14938877,100:12312315,200:9489145,300:6600182,400:4367861,500:2201331,600:2001125,700:1668818,800:1402304,900:870305},"light-blue":{50:14808574,100:11789820,200:8508666,300:5227511,400:2733814,500:240116,600:236517,700:166097,800:161725,900:87963},cyan:{50:14743546,100:11725810,200:8445674,300:5099745,400:2541274,500:48340,600:44225,700:38823,800:33679,900:24676},teal:{50:14742257,100:11722715,200:8440772,300:5093036,400:2533018,500:38536,600:35195,700:31083,800:26972,900:19776},green:{50:15267305,100:13166281,200:10868391,300:8505220,400:6732650,500:5025616,600:4431943,700:3706428,800:3046706,900:1793568},"light-green":{50:15857897,100:14478792,200:12968357,300:11457921,400:10275941,500:9159498,600:8172354,700:6856504,800:5606191,900:3369246},lime:{50:16382951,100:15791299,200:15134364,300:14477173,400:13951319,500:13491257,600:12634675,700:11514923,800:10394916,900:8550167},yellow:{50:16776679,100:16775620,200:16774557,300:16773494,400:16772696,500:16771899,600:16635957,700:16498733,800:16361509,900:16088855},amber:{50:16775393,100:16772275,200:16769154,300:16766287,400:16763432,500:16761095,600:16757504,700:16752640,800:16748288,900:16740096},orange:{50:16774112,100:16769202,200:16764032,300:16758605,400:16754470,500:16750592,600:16485376,700:16088064,800:15690752,900:15094016},"deep-orange":{50:16509415,100:16764092,200:16755601,300:16747109,400:16740419,500:16733986,600:16011550,700:15092249,800:14172949,900:12531212},brown:{50:15723497,100:14142664,200:12364452,300:10586239,400:9268835,500:7951688,600:7162945,700:6111287,800:5125166,900:4073251},gray:{50:16448250,100:16119285,200:15658734,300:14737632,400:12434877,500:10395294,600:7697781,700:6381921,800:4342338,900:2171169},"blue-gray":{50:15527921,100:13621468,200:11583173,300:9479342,400:7901340,500:6323595,600:5533306,700:4545124,800:3622735,900:2503224}};function ve(e){return de.map((t=>`.${t}\\:${e}:${t}`))}function be(e,t){return Object.entries(ae).map((([r,i])=>`@media (min-width: ${i}px) { .${r}\\:${e} { ${t} } }`))}function ye(e,t){return e.includes("@media")&&!t.includes("@media")?1:!e.includes("@media")&&t.includes("@media")?-1:e.localeCompare(t)}function we(e){return Object.entries(e).flatMap((([e,t])=>[[`${t}-0`,`${e}: 0`],[`${t}-screen`,`${e}: 100vw`],[`${t}-full`,`${e}: 100%`],...he.map((r=>[`${t}-${r}`,`${e}: ${r*ce}rem`])),...he.map((r=>[`-${t}-${r}`,`${e}: -${r*ce}rem`])),...he.map((r=>[`${t}-${r}px`,`${e}: ${r}px`])),...he.map((r=>[`-${t}-${r}px`,`${e}: -${r}px`])),...ue.map((r=>[`${t}-${r}\\%`,`${e}: ${r}%`])),...ue.map((r=>[`-${t}-${r}\\%`,` ${e}: -${r}%`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${ve(e).join(",")} { ${t} }`,...be(e,t)]))}function xe(e){return Object.entries(e).flatMap((([e,t])=>[`.${t}-auto { ${e}: auto; }`,`.${t}x-auto { ${e}-left: auto; ${e}-right: auto; }`,`.${t}y-auto { ${e}-top: auto; ${e}-bottom: auto; }`,`.${t}x-0 { ${e}-left: 0; ${e}-right: 0; }`,`.${t}y-0 { ${e}-top: 0; ${e}-bottom: 0; }`,...he.map((e=>[e,e*ce])).map((([r,i])=>`.${t}x-${r} { ${e}-left: ${i}rem; ${e}-right: ${i}rem; }`)),...he.map((e=>[e,e*ce])).map((([r,i])=>`.${t}y-${r} { ${e}-top: ${i}rem; ${e}-bottom: ${i}rem; }`)),...he.map((r=>`.${t}x-${r}px { ${e}-left: ${r}px; ${e}-right: ${r}px; }`)),...he.map((r=>`.${t}y-${r}px { ${e}-top: ${r}px; ${e}-bottom: ${r}px; }`)),...ue.map((r=>`.${t}x-${r}\\% { ${e}-left: ${r}%; ${e}-right: ${r}%; }`)),...ue.map((r=>`.${t}y-${r}\\% { ${e}-top: ${r}%; ${e}-bottom: ${r}%; }`))]))}function Ae(){const e=[["white","#fff"],["black","#000"],["transparent","transparent"]].flatMap((([e,t])=>[[`text-${e}`,`color: ${t}`],[`fill-${e}`,`fill: ${t}`],[`bg-${e}`,`background-color: ${t}`],[`border-${e}`,`border-color: ${t}`]])),t=Object.entries($e).flatMap((([e,t])=>[[`text-${e}`,`color: #${t[500].toString(16)}`],[`fill-${e}`,`fill: #${t[500].toString(16)}`],[`bg-${e}`,`background-color: #${t[500].toString(16)}`],[`border-${e}`,`border-color: #${t[500].toString(16)}`]])),r=Object.entries($e).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[[`text-${e}-${t}`,`color: #${r.toString(16)}`],[`fill-${e}-${t}`,`fill: #${r.toString(16)}`],[`bg-${e}-${t}`,`background-color: #${r.toString(16)}`],[`border-${e}-${t}`,`border-color: #${r.toString(16)}`]]))));return[].concat(e).concat(t).concat(r).flatMap((([e,t])=>[`.${e} { ${t} }`,`${ve(e).join(",")} { ${t} }`,...be(e,t)]))}const Oe=new oe;globalThis.Mancha=Oe;const Re=globalThis.document?.currentScript;if(globalThis.document?.currentScript?.hasAttribute("init")){const e=Re?.hasAttribute("debug"),t=Re?.getAttribute("cache"),r=Re?.getAttribute("target")?.split("+")||["body"];window.addEventListener("load",(()=>{r.map((async r=>{const i=globalThis.document.querySelector(r);await Oe.debug(e).mount(i,{cache:t})}))}))}if(globalThis.document?.currentScript?.hasAttribute("css")){const e=Re?.getAttribute("css")?.split("+");for(const t of e){const e=document.createElement("style");switch(t){case"basic":u(e,x`
1
+ (()=>{"use strict";const e=/^\s*(?!javascript:)(?:[\w+.-]+:|[^:/?#]*(?:[/?#]|$))/i;function t(t){if(!function(t){const r=!e.test(t);return r}(t))return t}function r(e){return t(e)}const i={};function n(e){0}"undefined"!=typeof window&&window.TrustedScriptURL;class s{constructor(e,t){this.privateDoNotAccessOrElseWrappedAttributePrefix=t}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}}const o=s;function a(e){if(function(e){return e instanceof s}(e))return e.privateDoNotAccessOrElseWrappedAttributePrefix;throw new Error("")}"undefined"!=typeof window&&window.TrustedHTML;function c(e,t,r,i){if(0===e.length){throw new Error("")}const n=e.map((e=>a(e))),s=r.toLowerCase();if(n.every((e=>0!==s.indexOf(e))))throw new Error(`Attribute "${r}" does not match any of the allowed prefixes.`);t.setAttribute(r,i)}"undefined"!=typeof window&&window.TrustedScript;class l{}class h extends l{constructor(e,t){super(),n(),this.privateDoNotAccessOrElseWrappedStyleSheet=e}toString(){return this.privateDoNotAccessOrElseWrappedStyleSheet}}function u(e,t){e.textContent=function(e){if(e instanceof h)return e.privateDoNotAccessOrElseWrappedStyleSheet;throw new Error("")}(t)}Error;class d{iterable;constructor(e){this.iterable=e}filter(e){return new d(d.filterGenerator(e,this.iterable))}map(e){return new d(d.mapGenerator(e,this.iterable))}find(e){for(const t of this.iterable)if(e(t))return t}array(){return Array.from(this.iterable)}*generator(){for(const e of this.iterable)yield e}static*filterGenerator(e,t){for(const r of t)e(r)&&(yield r)}static*mapGenerator(e,t){for(const r of t)yield e(r)}static equals(e,t){const r=e[Symbol.iterator](),i=t[Symbol.iterator]();let n=r.next(),s=i.next();for(;!n.done&&!s.done;){if(n.value!==s.value)return!1;n=r.next(),s=i.next()}return n.done===s.done}}function p(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function f(e){return-1===e.toString().indexOf("`")}f((e=>e``))||f((e=>e`\0`))||f((e=>e`\n`))||f((e=>e`\u0000`)),p``&&p`\0`&&p`\n`&&p`\u0000`;function m(e){const t=e[0].toLowerCase();return new o(i,t)}var _,E;function g(e){return{valueOf:e}.valueOf()}!function(e){e[e.STYLE_TAG=0]="STYLE_TAG",e[e.STYLE_ATTRIBUTE=1]="STYLE_ATTRIBUTE",e[e.HTML_ATTRIBUTE=2]="HTML_ATTRIBUTE"}(_||(_={}));class ${constructor(e,t,r,i,n){this.allowedElements=e,this.elementPolicies=t,this.allowedGlobalAttributes=r,this.globalAttributePolicies=i,this.globallyAllowedAttributePrefixes=n}isAllowedElement(e){return"FORM"!==e&&(this.allowedElements.has(e)||this.elementPolicies.has(e))}getAttributePolicy(e,t){const r=this.elementPolicies.get(t);if(null==r?void 0:r.has(e))return r.get(e);if(this.allowedGlobalAttributes.has(e))return{policyAction:E.KEEP};const i=this.globalAttributePolicies.get(e);return i||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some((t=>0===e.indexOf(t)))?{policyAction:E.KEEP}:{policyAction:E.DROP})}}!function(e){e[e.DROP=0]="DROP",e[e.KEEP=1]="KEEP",e[e.KEEP_AND_SANITIZE_URL=2]="KEEP_AND_SANITIZE_URL",e[e.KEEP_AND_NORMALIZE=3]="KEEP_AND_NORMALIZE",e[e.KEEP_AND_SANITIZE_STYLE=4]="KEEP_AND_SANITIZE_STYLE",e[e.KEEP_AND_USE_RESOURCE_URL_POLICY=5]="KEEP_AND_USE_RESOURCE_URL_POLICY",e[e.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET=6]="KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET"}(E||(E={}));new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const v=["ARTICLE","SECTION","NAV","ASIDE","H1","H2","H3","H4","H5","H6","HEADER","FOOTER","ADDRESS","P","HR","PRE","BLOCKQUOTE","OL","UL","LH","LI","DL","DT","DD","FIGURE","FIGCAPTION","MAIN","DIV","EM","STRONG","SMALL","S","CITE","Q","DFN","ABBR","RUBY","RB","RT","RTC","RP","DATA","TIME","CODE","VAR","SAMP","KBD","SUB","SUP","I","B","U","MARK","BDI","BDO","SPAN","BR","WBR","INS","DEL","PICTURE","PARAM","TRACK","MAP","TABLE","CAPTION","COLGROUP","COL","TBODY","THEAD","TFOOT","TR","TD","TH","SELECT","DATALIST","OPTGROUP","OPTION","OUTPUT","PROGRESS","METER","FIELDSET","LEGEND","DETAILS","SUMMARY","MENU","DIALOG","SLOT","CANVAS","FONT","CENTER","ACRONYM","BASEFONT","BIG","DIR","HGROUP","STRIKE","TT"],b=[["A",new Map([["href",{policyAction:E.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:E.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY,conditions:new Map([["rel",new Set(["alternate","author","bookmark","canonical","cite","help","icon","license","next","prefetch","dns-prefetch","prerender","preconnect","preload","prev","search","subresource"])]])}]])],["SOURCE",new Map([["src",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:E.KEEP_AND_USE_RESOURCE_URL_POLICY}]])]],y=["title","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-current","aria-disabled","aria-dropeffect","aria-expanded","aria-haspopup","aria-hidden","aria-invalid","aria-label","aria-level","aria-live","aria-multiline","aria-multiselectable","aria-orientation","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","alt","align","autocapitalize","autocomplete","autocorrect","autofocus","autoplay","bgcolor","border","cellpadding","cellspacing","checked","color","cols","colspan","controls","datetime","disabled","download","draggable","enctype","face","formenctype","frameborder","height","hreflang","hidden","ismap","label","lang","loop","max","maxlength","media","minlength","min","multiple","muted","nonce","open","placeholder","preload","rel","required","reversed","role","rows","rowspan","selected","shape","size","sizes","slot","span","spellcheck","start","step","summary","translate","type","valign","value","width","wrap","itemscope","itemtype","itemid","itemprop","itemref"],w=[["dir",{policyAction:E.KEEP_AND_NORMALIZE,conditions:g((()=>new Map([["dir",new Set(["auto","ltr","rtl"])]])))}],["async",{policyAction:E.KEEP_AND_NORMALIZE,conditions:g((()=>new Map([["async",new Set(["async"])]])))}],["cite",{policyAction:E.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:E.KEEP_AND_NORMALIZE,conditions:g((()=>new Map([["loading",new Set(["eager","lazy"])]])))}],["poster",{policyAction:E.KEEP_AND_SANITIZE_URL}],["target",{policyAction:E.KEEP_AND_NORMALIZE,conditions:g((()=>new Map([["target",new Set(["_self","_blank"])]])))}]];new $(new Set(v),new Map(b),new Set(y),new Map(w)),new $(new Set(g((()=>v.concat(["STYLE"])))),new Map(b),new Set(g((()=>y.concat(["id","name","class"])))),new Map(g((()=>w.concat([["style",{policyAction:E.KEEP_AND_SANITIZE_STYLE}]])))));function x(e){return function(e){return new h(e,i)}(e[0])}const A=[m`:`,m`style`,m`class`];function*O(e,t=new Set){const r=new Set,i=Array.from(e.childNodes).filter((e=>!t.has(e)));for(yield e;i.length;){const e=i.shift();r.has(e)||(r.add(e),yield e),e.childNodes&&Array.from(e.childNodes).filter((e=>!t.has(e))).forEach((e=>i.push(e)))}}function R(e,t){return void 0!==e?.[t]}function I(e,t){return"function"==typeof e?.[t]}function N(e,t){return R(e,"attribs")?e.attribs?.[t]??null:e.getAttribute?.(t)}function T(e,t,r){R(e,"attribs")?e.attribs[t]=r:c(A,e,t,r)}function S(e,t){R(e,"attribs")?delete e.attribs[t]:e.removeAttribute?.(t)}function P(e,t,r){if(R(e,"attribs")&&R(t,"attribs"))t.attribs[r]=e.attribs[r];else{const i=e?.getAttribute?.(r);T(t,r,i||"")}}function k(e,...t){if(I(e,"replaceWith"))return e.replaceWith(...t);{const r=e,i=r.parentNode,n=Array.from(i.childNodes).indexOf(r);t.forEach((e=>e.parentNode=i)),i.childNodes=[].concat(Array.from(i.childNodes).slice(0,n)).concat(t).concat(Array.from(i.childNodes).slice(n+1))}}function C(e,...t){I(e,"replaceChildren")?e.replaceChildren(...t):(e.childNodes=t,t.forEach((t=>t.parentNode=e)))}function L(e,t){return I(t,"appendChild")?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,t)}function D(e,t){return I(t,"removeChild")?e.removeChild(t):(C(e,...Array.from(e.childNodes).filter((e=>e!==t))),t)}function M(e,t,r){return r?I(e,"insertBefore")?e.insertBefore(t,r):(k(r,t,r),t):L(e,t)}function U(e,t=0){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function j(e,t=0){return U(e.outerHTML||e.nodeValue||String(e),t)}function z(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):""}var G;!function(e){e.resolveIncludes=async function(e,t){const r=e;if("include"!==r.tagName?.toLocaleLowerCase())return;this.log("<include> tag found in:\n",j(e,128)),this.log("<include> params:",t);const i=N(r,"src");if(!i)throw new Error(`"src" attribute missing from ${e}.`);const n=t=>{const i=t.firstChild;for(const e of Array.from(r.attributes))i&&"src"!==e.name&&P(r,i,e.name);k(e,...t.childNodes)},s={...t,rootDocument:!1,maxdepth:t?.maxdepth-1};if(0===s.maxdepth)throw new Error("Maximum recursion depth reached.");if(i.includes("://")||i.startsWith("//"))this.log("Including remote file from absolute path:",i),await this.preprocessRemote(i,s).then(n);else if(t?.dirpath?.includes("://")||t?.dirpath?.startsWith("//")){const e=i.startsWith("/")?i:`${t.dirpath}/${i}`;this.log("Including remote file from relative path:",e),await this.preprocessRemote(e,s).then(n)}else if("/"===i.charAt(0))this.log("Including local file from absolute path:",i),await this.preprocessLocal(i,s).then(n);else{const e=t?.dirpath&&"."!==t?.dirpath?`${t?.dirpath}/${i}`:i;this.log("Including local file from relative path:",e),await this.preprocessLocal(e,s).then(n)}},e.rebaseRelativePaths=async function(e,t){const i=e,n=i.tagName?.toLowerCase();if(!t?.dirpath)return;const s=N(i,"src"),o=N(i,"href"),a=s||o;if(a&&!((c=a).includes("://")||c.startsWith("/")||c.startsWith("#")||c.startsWith("data:"))){const e=`${t.dirpath}/${a}`;this.log("Rebasing relative path as:",e),"img"===n?i.src=e:"a"===n?function(e,t){const i=r(t);void 0!==i&&(e.href=i)}(i,e):"source"===n||"audio"===n||"video"===n||"track"===n||"input"===n?i.src=e:"area"===n?function(e,t){const i=r(t);void 0!==i&&(e.href=i)}(i,e):this.log("Unable to rebase relative path for element:",n)}var c},e.registerCustomElements=async function(e,t){const r=e;if("template"===r.tagName?.toLowerCase()&&N(r,"is")){const e=N(r,"is")?.toLowerCase();this._customElements.has(e)||(this.log(`Registering custom element: ${e}\n`,j(r,128)),this._customElements.set(e,r.cloneNode(!0)),D(r.parentNode,r))}},e.resolveCustomElements=async function(e,t){const r=e,i=r.tagName?.toLowerCase();if(this._customElements.has(i)){this.log(`Processing custom element: ${i}\n`,j(r,128));const t=this._customElements.get(i),n=(t.content||t).cloneNode(!0),s=function(e){return R(e,"firstElementChild")?e.firstElementChild:Array.from(e.children).find((e=>1===e.nodeType))}(n);for(const e of Array.from(r.attributes))s&&P(r,s,e.name);const o=new d(O(n)).find((e=>"slot"===e.tagName?.toLowerCase()));o&&k(o,...r.childNodes),k(e,...n.childNodes)}},e.resolveTextNodeExpressions=async function(e,t){const r=e.nodeValue||"";if(3!==e.nodeType||!r?.trim())return;this.log("Processing node content value:\n",U(r,128));const i=new RegExp(/{{ ([^}]+) }}/gm),n=Array.from(r.matchAll(i)).map((e=>e[1]));return this.effect((function(){let t=r;for(const r of n){const i=this.eval(r,{$elem:e});t=t.replace(`{{ ${r} }}`,String(i))}e.nodeValue=t}))},e.resolveDataAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":data");if(i){this.log(":data attribute found in:\n",j(e,128)),S(r,":data");const n=t?.rootNode===e?this:this.clone();e.renderer=n;const s=n.eval(i,{$elem:e});if(await Promise.all(Object.entries(s).map((([e,t])=>n.set(e,t)))),n!==this)for(const t of O(e,this._skipNodes))this._skipNodes.add(t);await n.mount(e,t)}},e.resolveClassAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":class");if(i){this.log(":class attribute found in:\n",j(e,128)),S(r,":class");const t=N(r,"class")||"";return this.effect((function(){const n=this.eval(i,{$elem:e});T(r,"class",(n?`${t} ${n}`:t).trim())}))}},e.resolveTextAttributes=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":text");if(i){this.log(":text attribute found in:\n",j(e,128)),S(r,":text");const t=t=>this.textContent(e,t);return this.effect((function(){t(this.eval(i,{$elem:e}))}))}},e.resolveHtmlAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":html");return i?(this.log(":html attribute found in:\n",j(e,128)),S(r,":html"),this.effect((function(){const n=this.eval(i,{$elem:e});return new Promise((async e=>{const i=await this.preprocessString(n,t);await this.renderNode(i),C(r,i),e()}))}))):void 0},e.resolveEventAttributes=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[]))t.name.startsWith(":on:")&&(this.log(t.name,"attribute found in:\n",j(e,128)),S(r,t.name),e.addEventListener?.(t.name.substring(4),(r=>this.eval(t.value,{$elem:e,$event:r}))))},e.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":for")?.trim();if(i){this.log(":for attribute found in:\n",j(e,128)),S(r,":for");for(const t of O(e,this._skipNodes))this._skipNodes.add(t);const n=e.parentNode,s=this.createElement("template",e.ownerDocument);M(n,s,e),D(n,e),L(s,e),this.log(":for template:\n",j(s,128));const o=i.split(" in ",2);if(2!==o.length)throw new Error(`Invalid :for format: \`${i}\`. Expected "{key} in {expression}".`);const a=[],[c,l]=o;await this.effect((function(){const r=this.eval(l,{$elem:e});if(this.log(":for list items:",r),a.splice(0,a.length).forEach((e=>{D(n,e),this._skipNodes.delete(e)})),!Array.isArray(r))return console.error(`Expression did not yield a list: \`${l}\` => \`${r}\``),Promise.resolve();const i=[];for(const n of r){const r=this.clone();r.set(c,n);const s=e.cloneNode(!0);a.push(s),this._skipNodes.add(s),i.push(r.mount(s,t)),this.log("Rendered list child:\n",j(s,128))}const o=s.nextSibling;for(const e of a)M(n,e,o);return Promise.all(i)}))}},e.resolveBindAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":bind");if(i){this.log(":bind attribute found in:\n",j(e,128));const t=["change","input"],n=N(r,":bind:on")?.split(",")||t;S(r,":bind"),S(r,":bind:on");const s="checkbox"===N(r,"type")?"checked":"value";this.effect((function(){const t=this.eval(i,{$elem:e});r[s]=t}));const o=`${i} = $elem.${s}`;for(const t of n)e.addEventListener(t,(()=>this.eval(o,{$elem:e})))}},e.resolveShowAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=N(r,":show");if(i){this.log(":show attribute found in:\n",j(e,128)),S(r,":show");const t="none"===r.style?.display?"":r.style?.display??N(r,"style")?.split(";")?.find((e=>"display"===e.split(":")[0]))?.split(":")?.at(1)?.trim();this.effect((function(){const n=this.eval(i,{$elem:e});r.style?r.style.display=n?t:"none":T(r,"style",`display: ${n?t:"none"};`)}))}},e.resolveCustomAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[]))if(t.name.startsWith(":")){this.log(t.name,"attribute found in:\n",j(e,128)),S(r,t.name);const i=t.name.substring(1).replace(/-./g,(e=>e[1].toUpperCase()));this.effect((function(){const n=this.eval(t.value,{$elem:e});r[i]=n}))}}}(G||(G={}));const F=["this"],K=["+","-","!"],Y=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],W={"!":0,":":0,",":0,")":0,"]":0,"}":0,"|>":1,"?":2,"??":3,"||":4,"&&":5,"|":6,"^":7,"&":8,"!=":9,"==":9,"!==":9,"===":9,">=":10,">":10,"<=":10,"<":10,"+":11,"-":11,"%":12,"/":12,"*":12,"(":13,"[":13,".":13,"{":13},B=["==","!=","<=",">=","||","&&","??","|>"],H=["===","!=="];var V;!function(e){e[e.STRING=1]="STRING",e[e.IDENTIFIER=2]="IDENTIFIER",e[e.DOT=3]="DOT",e[e.COMMA=4]="COMMA",e[e.COLON=5]="COLON",e[e.INTEGER=6]="INTEGER",e[e.DECIMAL=7]="DECIMAL",e[e.OPERATOR=8]="OPERATOR",e[e.GROUPER=9]="GROUPER",e[e.KEYWORD=10]="KEYWORD",e[e.ARROW=11]="ARROW"}(V||(V={}));const Z=(e,t,r=0)=>({kind:e,value:t,precedence:r}),q=e=>95===e||36===e||65<=(e&=-33)&&e<=90,Q=e=>48<=e&&e<=57;class X{_input;_index=-1;_tokenStart=0;_next;constructor(e){this._input=e,this._advance()}nextToken(){for(;9===(e=this._next)||10===e||13===e||32===e;)this._advance(!0);var e;if((e=>34===e||39===e)(this._next))return this._tokenizeString();if(q(this._next))return this._tokenizeIdentOrKeyword();if(Q(this._next))return this._tokenizeNumber();if(46===this._next)return this._tokenizeDot();if(44===this._next)return this._tokenizeComma();if(58===this._next)return this._tokenizeColon();if((e=>43===e||45===e||42===e||47===e||33===e||38===e||37===e||60===e||61===e||62===e||63===e||94===e||124===e)(this._next))return this._tokenizeOperator();if((e=>40===e||41===e||91===e||93===e||123===e||125===e)(this._next))return this._tokenizeGrouper();if(this._advance(),void 0!==this._next)throw new Error(`Expected end of input, got ${this._next}`)}_advance(e){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),!0===e&&(this._tokenStart=this._index)):this._next=void 0}_getValue(e=0){const t=this._input.substring(this._tokenStart,this._index+e);return 0===e&&this._clearValue(),t}_clearValue(){this._tokenStart=this._index}_tokenizeString(){const e="unterminated string",t=this._next;for(this._advance(!0);this._next!==t;){if(void 0===this._next)throw new Error(e);if(92===this._next&&(this._advance(),void 0===this._next))throw new Error(e);this._advance()}const r=Z(V.STRING,this._getValue().replace(/\\(.)/g,((e,t)=>{switch(t){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";default:return t}})));return this._advance(),r}_tokenizeIdentOrKeyword(){do{this._advance()}while(e=this._next,q(e)||Q(e));var e;const t=this._getValue(),r=(i=t,-1!==F.indexOf(i)?V.KEYWORD:V.IDENTIFIER);var i;return Z(r,t)}_tokenizeNumber(){do{this._advance()}while(Q(this._next));return 46===this._next?this._tokenizeDot():Z(V.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),Q(this._next)?this._tokenizeFraction():(this._clearValue(),Z(V.DOT,".",13))}_tokenizeComma(){return this._advance(!0),Z(V.COMMA,",")}_tokenizeColon(){return this._advance(!0),Z(V.COLON,":")}_tokenizeFraction(){do{this._advance()}while(Q(this._next));return Z(V.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(-1!==H.indexOf(e))this._advance(),this._advance();else{if(e=this._getValue(1),"=>"===e)return this._advance(),Z(V.ARROW,e);-1!==B.indexOf(e)&&this._advance()}return e=this._getValue(),Z(V.OPERATOR,e,W[e])}_tokenizeGrouper(){const e=String.fromCharCode(this._next),t=Z(V.GROUPER,e,W[e]);return this._advance(!0),t}}class J{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new X(e),this._ast=t}parse(){return this._advance(),this._parseExpression()}_advance(e,t){if(!this._matches(e,t))throw new Error(`Expected kind ${e} (${t}), was ${this._token?.kind} (${this._token?.value})`);const r=this._tokenizer.nextToken();this._token=r,this._kind=r?.kind,this._value=r?.value}_matches(e,t){return!(e&&this._kind!==e||t&&this._value!==t)}_parseExpression(){if(!this._token)return this._ast.empty();const e=this._parseUnary();return void 0===e?void 0:this._parsePrecedence(e,0)}_parsePrecedence(e,t){if(void 0===e)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(V.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(V.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(V.DOT)){this._advance();const t=this._parseUnary();e=this._makeInvokeOrGetter(e,t)}else{if(this._matches(V.KEYWORD))break;if(!(this._matches(V.OPERATOR)&&this._token.precedence>=t))break;e="?"===this._value?this._parseTernary(e):this._parseBinary(e,this._token)}return e}_makeInvokeOrGetter(e,t){if(void 0===t)throw new Error("expected identifier");if("ID"===t.type)return this._ast.getter(e,t.value);if("Invoke"===t.type&&"ID"===t.receiver.type){const r=t.receiver;return this._ast.invoke(e,r.value,t.arguments)}throw new Error(`expected identifier: ${t}`)}_parseBinary(e,t){if(-1===Y.indexOf(t.value))throw new Error(`unknown operator: ${t.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===V.OPERATOR||this._kind===V.DOT||this._kind===V.GROUPER)&&this._token.precedence>t.precedence;)r=this._parsePrecedence(r,this._token.precedence);return this._ast.binary(e,t.value,r)}_parseUnary(){if(this._matches(V.OPERATOR)){const e=this._value;if(this._advance(),"+"===e||"-"===e){if(this._matches(V.INTEGER))return this._parseInteger(e);if(this._matches(V.DECIMAL))return this._parseDecimal(e)}if(-1===K.indexOf(e))throw new Error(`unexpected token: ${e}`);const t=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(e,t)}return this._parsePrimary()}_parseTernary(e){this._advance(V.OPERATOR,"?");const t=this._parseExpression();this._advance(V.COLON);const r=this._parseExpression();return this._ast.ternary(e,t,r)}_parsePrimary(){switch(this._kind){case V.KEYWORD:const e=this._value;if("this"===e)return this._advance(),this._ast.id(e);if(-1!==F.indexOf(e))throw new Error(`unexpected keyword: ${e}`);throw new Error(`unrecognized keyword: ${e}`);case V.IDENTIFIER:return this._parseInvokeOrIdentifier();case V.STRING:return this._parseString();case V.INTEGER:return this._parseInteger();case V.DECIMAL:return this._parseDecimal();case V.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case V.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const e=[];do{if(this._advance(),this._matches(V.GROUPER,"]"))break;e.push(this._parseExpression())}while(this._matches(V.COMMA));return this._advance(V.GROUPER,"]"),this._ast.list(e)}_parseMap(){const e={};do{if(this._advance(),this._matches(V.GROUPER,"}"))break;const t=this._value;(this._matches(V.STRING)||this._matches(V.IDENTIFIER))&&this._advance(),this._advance(V.COLON),e[t]=this._parseExpression()}while(this._matches(V.COMMA));return this._advance(V.GROUPER,"}"),this._ast.map(e)}_parseInvokeOrIdentifier(){const e=this._value;if("true"===e)return this._advance(),this._ast.literal(!0);if("false"===e)return this._advance(),this._ast.literal(!1);if("null"===e)return this._advance(),this._ast.literal(null);if("undefined"===e)return this._advance(),this._ast.literal(void 0);const t=this._parseIdentifier(),r=this._parseArguments();return r?this._ast.invoke(t,void 0,r):t}_parseIdentifier(){if(!this._matches(V.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(V.GROUPER,"("))return;const e=[];do{if(this._advance(),this._matches(V.GROUPER,")"))break;const t=this._parseExpression();e.push(t)}while(this._matches(V.COMMA));return this._advance(V.GROUPER,")"),e}_parseIndex(){this._advance();const e=this._parseExpression();return this._advance(V.GROUPER,"]"),e}_parseParenOrFunction(){const e=this._parseArguments();if(this._matches(V.ARROW)){this._advance();const t=this._parseExpression(),r=e?.map((e=>e.value))??[];return this._ast.arrowFunction(r,t)}return this._ast.paren(e[0])}_parseString(){const e=this._ast.literal(this._value);return this._advance(),e}_parseInteger(e=""){const t=this._ast.literal(parseInt(`${e}${this._value}`,10));return this._advance(),t}_parseDecimal(e=""){const t=this._ast.literal(parseFloat(`${e}${this._value}`));return this._advance(),t}}const ee={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"??":(e,t)=>e??t,"|":(e,t)=>t(e),"|>":(e,t)=>t(e)},te={"+":e=>e,"-":e=>-e,"!":e=>!e};class re{timeouts=new Map;debounce(e,t){return new Promise(((r,i)=>{const n=this.timeouts.get(t);n&&clearTimeout(n),this.timeouts.set(t,setTimeout((()=>{try{r(t()),this.timeouts.delete(t)}catch(e){i(e)}}),e))}))}}const ie=new class{empty(){return{type:"Empty",evaluate:e=>e,getIds:e=>e}}literal(e){return{type:"Literal",value:e,evaluate(e){return this.value},getIds:e=>e}}id(e){return{type:"ID",value:e,evaluate(e){return"this"===this.value?e:e?.[this.value]},getIds(e){return e.push(this.value),e}}}unary(e,t){const r=te[e];return{type:"Unary",operator:e,child:t,evaluate(e){return r(this.child.evaluate(e))},getIds(e){return this.child.getIds(e)}}}binary(e,t,r){const i=ee[t];return{type:"Binary",operator:t,left:e,right:r,evaluate(e){if("="===this.operator){if("ID"!==this.left.type&&"Getter"!==this.left.type&&"Index"!==this.left.type)throw new Error(`Invalid assignment target: ${this.left}`);const t=this.right.evaluate(e);let r,i;return"Getter"===this.left.type?(r=this.left.receiver.evaluate(e),i=this.left.name):"Index"===this.left.type?(r=this.left.receiver.evaluate(e),i=this.left.argument.evaluate(e)):"ID"===this.left.type&&(r=e,i=this.left.value),void 0===r?void 0:r[i]=t}return i(this.left.evaluate(e),this.right.evaluate(e))},getIds(e){return this.left.getIds(e),this.right.getIds(e),e}}}getter(e,t){return{type:"Getter",receiver:e,name:t,evaluate(e){return this.receiver.evaluate(e)?.[this.name]},getIds(e){return this.receiver.getIds(e),e}}}invoke(e,t,r){if(null!=t&&"string"!=typeof t)throw new Error("method not a string");return{type:"Invoke",receiver:e,method:t,arguments:r,evaluate(e){const r=this.receiver.evaluate(e),i=this.method?r:e?.this??e,n=this.method?r?.[t]:r,s=(this.arguments??[]).map((t=>t?.evaluate(e)));return n?.apply?.(i,s)},getIds(e){return this.receiver.getIds(e),this.arguments?.forEach((t=>t?.getIds(e))),e}}}paren(e){return e}index(e,t){return{type:"Index",receiver:e,argument:t,evaluate(e){return this.receiver.evaluate(e)?.[this.argument.evaluate(e)]},getIds(e){return this.receiver.getIds(e),e}}}ternary(e,t,r){return{type:"Ternary",condition:e,trueExpr:t,falseExpr:r,evaluate(e){return this.condition.evaluate(e)?this.trueExpr.evaluate(e):this.falseExpr.evaluate(e)},getIds(e){return this.condition.getIds(e),this.trueExpr.getIds(e),this.falseExpr.getIds(e),e}}}map(e){return{type:"Map",entries:e,evaluate(t){const r={};if(e&&this.entries)for(const i in e){const e=this.entries[i];e&&(r[i]=e.evaluate(t))}return r},getIds(t){if(e&&this.entries)for(const r in e){const e=this.entries[r];e&&e.getIds(t)}return t}}}list(e){return{type:"List",items:e,evaluate(e){return this.items?.map((t=>t?.evaluate(e)))},getIds(e){return this.items?.forEach((t=>t?.getIds(e))),e}}}arrowFunction(e,t){return{type:"ArrowFunction",params:e,body:t,evaluate(e){const t=this.params,r=this.body;return function(...i){const n=Object.fromEntries(t.map(((e,t)=>[e,i[t]]))),s=new Proxy(e??{},{set:(e,t,r)=>(n.hasOwnProperty(t)&&(n[t]=r),e[t]=r),get:(e,t)=>n.hasOwnProperty(t)?n[t]:e[t]});return r.evaluate(s)}},getIds(e){return this.body.getIds(e).filter((e=>!this.params.includes(e)))}}}};class ne extends re{evalkeys=["$elem","$event"];expressionCache=new Map;store=new Map;observers=new Map;_observer=null;_lock=Promise.resolve();constructor(e){super();for(let[t,r]of Object.entries(e||{}))this.set(t,r)}wrapFunction(e){return(...t)=>e.call(this.$,...t)}wrapObject(e,t){return null==e||((r=e)instanceof ne||r.__is_proxy__)||e.constructor!==Object&&!Array.isArray(e)?e:new Proxy(e,{deleteProperty:(e,r)=>r in e&&(delete e[r],t(),!0),set:(r,i,n,s)=>{"object"==typeof n&&null!=e&&(n=this.wrapObject(n,t));const o=Reflect.set(r,i,n,s);return t(),o},get:(e,t,r)=>"__is_proxy__"===t||Reflect.get(e,t,r)});var r}watch(e,t){this.observers.has(e)||this.observers.set(e,new Set),this.observers.get(e)?.has(t)||this.observers.get(e)?.add(t)}async notify(e,t=10){const r=Array.from(this.observers.get(e)||[]);await this.debounce(t,(()=>Promise.all(r.map((e=>e.call(this.proxify(e)))))))}get(e,t){return t&&this.watch(e,t),this.store.get(e)}async set(e,t){if(t===this.store.get(e))return;const r=()=>this.notify(e);t&&"function"==typeof t&&(t=this.wrapFunction(t)),t&&"object"==typeof t&&(t=this.wrapObject(t,r)),this.store.set(e,t),await r()}del(e){this.store.delete(e),this.observers.delete(e)}has(e){return this.store.has(e)}effect(e){return e.call(this.proxify(e))}proxify(e){const t=Array.from(this.store.entries()).map((([e])=>e)),r=Object.fromEntries(t.map((e=>[e,void 0])));return new Proxy(r,{get:(t,r,i)=>"string"==typeof r&&this.store.has(r)?this.get(r,e):"$"===r?this.proxify(e):Reflect.get(this,r,i),set:(e,t,r,i)=>("string"!=typeof t||t in this?Reflect.set(this,t,r,i):this.set(t,r),!0)})}get $(){return this.proxify()}makeEvalFunction(e){if(e.includes(";"))throw new Error("Complex expressions are not supported.");let t=null;if(e.includes("=")){const[r,i]=e.split("=");t=r.trim(),e=i.trim()}return(r,i)=>{const n=((e,t)=>new J(e,t).parse())(e,ie),s=n?.getIds([])?.map((e=>[e,i[e]??r[e]??globalThis[e]])),o=n?.evaluate(Object.fromEntries(s||[]));if(!t)return o;r[t]=o}}cachedExpressionFunction(e){return e=e.trim(),this.expressionCache.has(e)||this.expressionCache.set(e,this.makeEvalFunction(e)),this.expressionCache.get(e)}eval(e,t={}){const r=this._observer?this:this.$;if(this.store.has(e))return r[e];{const i=this.cachedExpressionFunction(e);try{return i(r,t)}catch(t){return console.error(`Failed to evaluate expression: ${e}`),console.error(t),null}}}}class se extends ne{debugging=!1;dirpath="";_skipNodes=new Set;_customElements=new Map;debug(e){return this.debugging=e,this}async fetchRemote(e,t){return fetch(e,{cache:t?.cache??"default"}).then((e=>e.text()))}async fetchLocal(e,t){return this.fetchRemote(e,t)}async preprocessString(e,t){this.log("Preprocessing string content with params:\n",t);const r=this.parseHTML(e,t);return await this.preprocessNode(r,t),r}async preprocessRemote(e,t){const r={};t?.cache&&(r.cache=t.cache);const i=await fetch(e,r).then((e=>e.text()));return this.preprocessString(i,{...t,dirpath:z(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}async preprocessLocal(e,t){const r=await this.fetchLocal(e,t);return this.preprocessString(r,{...t,dirpath:z(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}clone(){const e=Object.fromEntries(this.store.entries()),t=new this.constructor(e).debug(this.debugging);return t._customElements=this._customElements,Array.from(this.store.keys()).forEach((e=>this.watch(e,(()=>t.set(e,this.get(e)))))),t}log(...e){this.debugging&&console.debug(...e)}async preprocessNode(e,t){t={dirpath:this.dirpath,maxdepth:10,...t};const r=new d(O(e,this._skipNodes)).map((async e=>{this.log("Preprocessing node:\n",j(e,128)),await G.resolveIncludes.call(this,e,t),await G.rebaseRelativePaths.call(this,e,t),await G.registerCustomElements.call(this,e,t),await G.resolveCustomElements.call(this,e,t)}));return await Promise.all(r.generator()),e}async renderNode(e,t){for(const r of O(e,this._skipNodes))this.log("Rendering node:\n",j(r,128)),await G.resolveDataAttribute.call(this,r,t),await G.resolveForAttribute.call(this,r,t),await G.resolveTextAttributes.call(this,r,t),await G.resolveHtmlAttribute.call(this,r,t),await G.resolveShowAttribute.call(this,r,t),await G.resolveClassAttribute.call(this,r,t),await G.resolveBindAttribute.call(this,r,t),await G.resolveEventAttributes.call(this,r,t),await G.resolveTextNodeExpressions.call(this,r,t),await G.resolveCustomAttribute.call(this,r,t);return e}async mount(e,t){t={...t,rootNode:e},await this.preprocessNode(e,t),await this.renderNode(e,t),e.renderer=this}}class oe extends se{dirpath=z(self.location.href);parseHTML(e,t={rootDocument:!1}){if(t.rootDocument)return(new DOMParser).parseFromString(e,"text/html");{const t=document.createRange();return t.selectNodeContents(document.body),t.createContextualFragment(e)}}serializeHTML(e){return(new XMLSerializer).serializeToString(e).replace(/\s?xmlns="[^"]+"/gm,"")}preprocessLocal(e,t){return this.preprocessRemote(e,t)}createElement(e,t){return(t||document).createElement(e)}textContent(e,t){e.textContent=t}}new oe;const ae={sm:640,md:768,lg:1024,xl:1280},ce=.25,le=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],he=[...le,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96,112,128,144,160,192,224,256,288,320,384,448,512,...Object.values(ae)],ue=[1,2,5,10,20,25,30,40,50,60,70,75,80,90,95,98,99,100],de=["hover","focus","disabled","focus","active"],pe={margin:"m",padding:"p"},fe={width:"w",height:"h"},me={top:"top",right:"right",bottom:"bottom",left:"left"},_e={"min-width":"min-w","min-height":"min-h","max-width":"max-w","max-height":"max-h"},Ee={bold:{"font-weight":"bold"},semibold:{"font-weight":600},italic:{"font-style":"italic"},underline:{"text-decoration":"underline"},"no-underline":{"text-decoration":"none"},"decoration-none":{"text-decoration":"none"},"line-through":{"text-decoration":"line-through"},uppercase:{"text-transform":"uppercase"},lowercase:{"text-transform":"lowercase"},capitalize:{"text-transform":"capitalize"},"font-mono":{"font-family":"monospace"},"font-sans":{"font-family":"sans-serif"},"font-serif":{"font-family":"serif"},"font-cursive":{"font-family":"cursive"},"text-left":{"text-align":"left"},"text-right":{"text-align":"right"},"text-center":{"text-align":"center"},"text-justify":{"text-align":"justify"},"text-xs":{"font-size":".75rem"},"text-sm":{"font-size":".875rem"},"text-base":{"font-size":"1rem"},"text-lg":{"font-size":"1.125rem"},"text-xl":{"font-size":"1.25rem"},relative:{position:"relative"},fixed:{position:"fixed"},absolute:{position:"absolute"},sticky:{position:"sticky"},"object-contain":{"object-fit":"contain"},"object-cover":{"object-fit":"cover"},"object-fill":{"object-fit":"fill"},"object-none":{"object-fit":"none"},block:{display:"block"},contents:{display:"contents"},hidden:{display:"none"},inline:{display:"inline"},"inline-block":{display:"inline-block"},visible:{visibility:"visible"},invisible:{visibility:"hidden"},collapse:{visibility:"collapse"},"list-none":{"list-style-type":"none"},"list-disc":{"list-style-type":"disc"},"list-decimal":{"list-style-type":"decimal"},flex:{display:"flex"},"flex-1":{flex:"1 1 0%"},"flex-inline":{display:"inline-flex"},"flex-row":{"flex-direction":"row"},"flex-col":{"flex-direction":"column"},"flex-row-reverse":{"flex-direction":"row-reverse"},"flex-col-reverse":{"flex-direction":"column-reverse"},"flex-wrap":{"flex-wrap":"wrap"},"flex-wrap-reverse":{"flex-wrap":"wrap-reverse"},"flex-nowrap":{"flex-wrap":"nowrap"},"justify-start":{"justify-content":"flex-start"},"justify-end":{"justify-content":"flex-end"},"justify-center":{"justify-content":"center"},"justify-between":{"justify-content":"space-between"},"justify-around":{"justify-content":"space-around"},"justify-evenly":{"justify-content":"space-evenly"},"justify-stretch":{"justify-content":"stretch"},"items-start":{"align-items":"flex-start"},"items-end":{"align-items":"flex-end"},"items-center":{"align-items":"center"},"items-stretch":{"align-items":"stretch"},"flex-grow":{"flex-grow":1},"flex-shrink":{"flex-shrink":1},"overflow-auto":{overflow:"auto"},"overflow-x-auto":{"overflow-x":"auto"},"overflow-y-auto":{"overflow-y":"auto"},"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"cursor-pointer":{cursor:"pointer"},"cursor-wait":{cursor:"wait"},"cursor-not-allowed":{cursor:"not-allowed"},"select-none":{"user-select":"none"},"select-all":{"user-select":"all"},"pointer-events-auto":{"pointer-events":"auto"},"pointer-events-none":{"pointer-events":"none"},"box-border":{"box-sizing":"border-box"},"box-content":{"box-sizing":"content-box"},resize:{resize:"both"},"resize-x":{resize:"horizontal"},"resize-y":{resize:"vertical"},"resize-none":{resize:"none"},border:{border:"1px solid"},"border-none":{border:"none"},"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"rounded-none":{"border-radius":"0"},rounded:{"border-radius":".25rem"},"rounded-sm":{"border-radius":".125rem"},"rounded-md":{"border-radius":".375rem"},"rounded-lg":{"border-radius":".5rem"},"rounded-xl":{"border-radius":".75rem"},"rounded-full":{"border-radius":"9999px"},"transition-none":{transition:"none"},transition:{transition:"all 150ms ease-in-out"},"animate-none":{animation:"none"},"animate-spin":{animation:"spin 1s linear infinite"},"animate-ping":{animation:"ping 1s cubic-bezier(0, 0, 0.2, 1) infinite"},"animate-pulse":{animation:"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"}},ge=["@keyframes spin {\n from { transform: rotate(0deg) }\n to { transform: rotate(360deg) }\n }","@keyframes ping {\n 75%, 100% {\n transform: scale(2);\n opacity: 0;\n }\n }","@keyframes pulse {\n 0%, 100% { opacity: 1 }\n 50% { opacity: .5 }\n }"],$e={red:{50:16772078,100:16764370,200:15702682,300:15037299,400:15684432,500:16007990,600:15022389,700:13840175,800:12986408,900:12000284},pink:{50:16573676,100:16301008,200:16027569,300:15753874,400:15483002,500:15277667,600:14162784,700:12720219,800:11342935,900:8916559},purple:{50:15984117,100:14794471,200:13538264,300:12216520,400:11225020,500:10233776,600:9315498,700:8069026,800:6953882,900:4854924},"deep-purple":{50:15591414,100:13747433,200:11771355,300:9795021,400:8280002,500:6765239,600:6174129,700:5320104,800:4532128,900:3218322},indigo:{50:15264502,100:12962537,200:10463450,300:7964363,400:6056896,500:4149685,600:3754411,700:3162015,800:2635155,900:1713022},blue:{50:14938877,100:12312315,200:9489145,300:6600182,400:4367861,500:2201331,600:2001125,700:1668818,800:1402304,900:870305},"light-blue":{50:14808574,100:11789820,200:8508666,300:5227511,400:2733814,500:240116,600:236517,700:166097,800:161725,900:87963},cyan:{50:14743546,100:11725810,200:8445674,300:5099745,400:2541274,500:48340,600:44225,700:38823,800:33679,900:24676},teal:{50:14742257,100:11722715,200:8440772,300:5093036,400:2533018,500:38536,600:35195,700:31083,800:26972,900:19776},green:{50:15267305,100:13166281,200:10868391,300:8505220,400:6732650,500:5025616,600:4431943,700:3706428,800:3046706,900:1793568},"light-green":{50:15857897,100:14478792,200:12968357,300:11457921,400:10275941,500:9159498,600:8172354,700:6856504,800:5606191,900:3369246},lime:{50:16382951,100:15791299,200:15134364,300:14477173,400:13951319,500:13491257,600:12634675,700:11514923,800:10394916,900:8550167},yellow:{50:16776679,100:16775620,200:16774557,300:16773494,400:16772696,500:16771899,600:16635957,700:16498733,800:16361509,900:16088855},amber:{50:16775393,100:16772275,200:16769154,300:16766287,400:16763432,500:16761095,600:16757504,700:16752640,800:16748288,900:16740096},orange:{50:16774112,100:16769202,200:16764032,300:16758605,400:16754470,500:16750592,600:16485376,700:16088064,800:15690752,900:15094016},"deep-orange":{50:16509415,100:16764092,200:16755601,300:16747109,400:16740419,500:16733986,600:16011550,700:15092249,800:14172949,900:12531212},brown:{50:15723497,100:14142664,200:12364452,300:10586239,400:9268835,500:7951688,600:7162945,700:6111287,800:5125166,900:4073251},gray:{50:16448250,100:16119285,200:15658734,300:14737632,400:12434877,500:10395294,600:7697781,700:6381921,800:4342338,900:2171169},"blue-gray":{50:15527921,100:13621468,200:11583173,300:9479342,400:7901340,500:6323595,600:5533306,700:4545124,800:3622735,900:2503224}};function ve(e){return de.map((t=>`.${t}\\:${e}:${t}`))}function be(e,t){return Object.entries(ae).map((([r,i])=>`@media (min-width: ${i}px) { .${r}\\:${e} { ${t} } }`))}function ye(e,t){return e.includes("@media")&&!t.includes("@media")?1:!e.includes("@media")&&t.includes("@media")?-1:e.localeCompare(t)}function we(e){return Object.entries(e).flatMap((([e,t])=>[[`${t}-0`,`${e}: 0`],[`${t}-screen`,`${e}: 100vw`],[`${t}-full`,`${e}: 100%`],...he.map((r=>[`${t}-${r}`,`${e}: ${r*ce}rem`])),...he.map((r=>[`-${t}-${r}`,`${e}: -${r*ce}rem`])),...he.map((r=>[`${t}-${r}px`,`${e}: ${r}px`])),...he.map((r=>[`-${t}-${r}px`,`${e}: -${r}px`])),...ue.map((r=>[`${t}-${r}\\%`,`${e}: ${r}%`])),...ue.map((r=>[`-${t}-${r}\\%`,` ${e}: -${r}%`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${ve(e).join(",")} { ${t} }`,...be(e,t)]))}function xe(e){return Object.entries(e).flatMap((([e,t])=>[`.${t}-auto { ${e}: auto; }`,`.${t}x-auto { ${e}-left: auto; ${e}-right: auto; }`,`.${t}y-auto { ${e}-top: auto; ${e}-bottom: auto; }`,`.${t}x-0 { ${e}-left: 0; ${e}-right: 0; }`,`.${t}y-0 { ${e}-top: 0; ${e}-bottom: 0; }`,...he.map((e=>[e,e*ce])).map((([r,i])=>`.${t}x-${r} { ${e}-left: ${i}rem; ${e}-right: ${i}rem; }`)),...he.map((e=>[e,e*ce])).map((([r,i])=>`.${t}y-${r} { ${e}-top: ${i}rem; ${e}-bottom: ${i}rem; }`)),...he.map((r=>`.${t}x-${r}px { ${e}-left: ${r}px; ${e}-right: ${r}px; }`)),...he.map((r=>`.${t}y-${r}px { ${e}-top: ${r}px; ${e}-bottom: ${r}px; }`)),...ue.map((r=>`.${t}x-${r}\\% { ${e}-left: ${r}%; ${e}-right: ${r}%; }`)),...ue.map((r=>`.${t}y-${r}\\% { ${e}-top: ${r}%; ${e}-bottom: ${r}%; }`))]))}function Ae(){const e=[["white","#fff"],["black","#000"],["transparent","transparent"]].flatMap((([e,t])=>[[`text-${e}`,`color: ${t}`],[`fill-${e}`,`fill: ${t}`],[`bg-${e}`,`background-color: ${t}`],[`border-${e}`,`border-color: ${t}`]])),t=Object.entries($e).flatMap((([e,t])=>[[`text-${e}`,`color: #${t[500].toString(16)}`],[`fill-${e}`,`fill: #${t[500].toString(16)}`],[`bg-${e}`,`background-color: #${t[500].toString(16)}`],[`border-${e}`,`border-color: #${t[500].toString(16)}`]])),r=Object.entries($e).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[[`text-${e}-${t}`,`color: #${r.toString(16)}`],[`fill-${e}-${t}`,`fill: #${r.toString(16)}`],[`bg-${e}-${t}`,`background-color: #${r.toString(16)}`],[`border-${e}-${t}`,`border-color: #${r.toString(16)}`]]))));return[].concat(e).concat(t).concat(r).flatMap((([e,t])=>[`.${e} { ${t} }`,`${ve(e).join(",")} { ${t} }`,...be(e,t)]))}const Oe=new oe;globalThis.Mancha=Oe;const Re=globalThis.document?.currentScript;if(globalThis.document?.currentScript?.hasAttribute("init")){const e=Re?.hasAttribute("debug"),t=Re?.getAttribute("cache"),r=Re?.getAttribute("target")?.split("+")||["body"];window.addEventListener("load",(()=>{r.map((async r=>{const i=globalThis.document.querySelector(r);await Oe.debug(e).mount(i,{cache:t})}))}))}if(globalThis.document?.currentScript?.hasAttribute("css")){const e=Re?.getAttribute("css")?.split("+");for(const t of e){const e=document.createElement("style");switch(t){case"basic":u(e,x`
72
2
  html {
73
3
  max-width: 70ch;
74
4
  padding: 2em 1em;
@@ -1,7 +1,11 @@
1
- import { Renderer as BrowserRenderer } from "./browser.js";
2
- import { ParserParams } from "./interfaces.js";
3
- export declare class Renderer extends BrowserRenderer {
1
+ import { ParserParams, RenderParams } from "./interfaces.js";
2
+ import { IRenderer } from "./core.js";
3
+ export declare class Renderer extends IRenderer {
4
4
  protected readonly dirpath: string;
5
5
  parseHTML(content: string, params?: ParserParams): Document | DocumentFragment;
6
+ serializeHTML(root: Node | DocumentFragment): string;
7
+ preprocessLocal(fpath: string, params?: RenderParams & ParserParams): Promise<Document | DocumentFragment>;
8
+ createElement(tag: string, owner?: Document | null): Element;
9
+ textContent(node: Node, content: string): void;
6
10
  }
7
11
  export declare const Mancha: Renderer;
@@ -1,8 +1,8 @@
1
1
  import { sanitizeHtml } from "safevalues";
2
2
  import { safeRange, safeDomParser } from "safevalues/dom";
3
- import { Renderer as BrowserRenderer } from "./browser.js";
4
3
  import { dirname } from "./dome.js";
5
- export class Renderer extends BrowserRenderer {
4
+ import { IRenderer } from "./core.js";
5
+ export class Renderer extends IRenderer {
6
6
  dirpath = dirname(self.location.href);
7
7
  parseHTML(content, params = { rootDocument: false }) {
8
8
  if (params.rootDocument) {
@@ -15,5 +15,18 @@ export class Renderer extends BrowserRenderer {
15
15
  return safeRange.createContextualFragment(range, sanitizeHtml(content));
16
16
  }
17
17
  }
18
+ serializeHTML(root) {
19
+ return new XMLSerializer().serializeToString(root).replace(/\s?xmlns="[^"]+"/gm, "");
20
+ }
21
+ preprocessLocal(fpath, params) {
22
+ // In the browser, "local" paths (i.e., relative paths) can still be fetched.
23
+ return this.preprocessRemote(fpath, params);
24
+ }
25
+ createElement(tag, owner) {
26
+ return (owner || document).createElement(tag);
27
+ }
28
+ textContent(node, content) {
29
+ node.textContent = content;
30
+ }
18
31
  }
19
32
  export const Mancha = new Renderer();
package/dist/store.js CHANGED
@@ -196,7 +196,14 @@ export class SignalStore extends IDebouncer {
196
196
  else {
197
197
  // Otherwise, perform the expression evaluation.
198
198
  const fn = this.cachedExpressionFunction(expr);
199
- return fn(thisArg, args);
199
+ try {
200
+ return fn(thisArg, args);
201
+ }
202
+ catch (exc) {
203
+ console.error(`Failed to evaluate expression: ${expr}`);
204
+ console.error(exc);
205
+ return null;
206
+ }
200
207
  }
201
208
  }
202
209
  }
package/gulpfile.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as fs from "fs/promises";
2
- import run from "gulp-run";
3
2
  import GulpClient from "gulp";
4
3
  import csso from "gulp-csso";
4
+ import { exec } from "child_process";
5
5
 
6
6
  // Clean tasks
7
7
 
@@ -11,9 +11,10 @@ GulpClient.task("clean", function (done) {
11
11
 
12
12
  // Build tasks
13
13
 
14
- GulpClient.task("ts", function () {
15
- // The gulp-typescript plugin is deprecated.
16
- return run("tsec -p .").exec();
14
+ GulpClient.task("ts", function (done) {
15
+ return exec("tsec -p .", (err, stdout, stderr) => {
16
+ done(err || stderr);
17
+ });
17
18
  });
18
19
 
19
20
  GulpClient.task("css", function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mancha",
3
- "version": "0.9.4",
3
+ "version": "0.9.6",
4
4
  "description": "Javscript HTML rendering engine",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -44,14 +44,13 @@
44
44
  "csso": "^5.0.5",
45
45
  "gulp": "^5.0.0",
46
46
  "gulp-csso": "^4.0.1",
47
- "gulp-run": "^1.7.1",
48
47
  "gulp-typescript": "^6.0.0-alpha.1",
49
48
  "static-server": "^3.0.0",
50
49
  "terser-webpack-plugin": "^5.3.10",
51
50
  "ts-node": "^10.9.2",
52
51
  "tsec": "^0.2.8",
53
52
  "typescript": "5.4.5",
54
- "webpack": "5.91.0",
53
+ "webpack": "^5.94.0",
55
54
  "webpack-cli": "^5.1.4",
56
55
  "yargs": "^17.7.2"
57
56
  }
package/webpack.config.js CHANGED
@@ -19,6 +19,8 @@ export default {
19
19
  },
20
20
  optimization: {
21
21
  minimize: true,
22
- minimizer: [new TerserPlugin({ extractComments: false })],
22
+ minimizer: [
23
+ new TerserPlugin({ extractComments: false, terserOptions: { output: { comments: false } } }),
24
+ ],
23
25
  },
24
26
  };