mancha 0.12.16 → 0.13.0

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/browser.js CHANGED
@@ -1 +1 @@
1
- class e{iterable;constructor(e){this.iterable=e}filter(t){return new e(e.filterGenerator(t,this.iterable))}map(t){return new e(e.mapGenerator(t,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}}const t=/^\s*(?!javascript:)(?:[\w+.-]+:|[^:/?#]*(?:[/?#]|$))/i;function r(e){if(!function(e){const r=!t.test(e);return r}(e))return e}function i(e){return r(e)}const n={};function s(e){0}"undefined"!=typeof window&&window.TrustedScriptURL;class o{constructor(e,t){this.privateDoNotAccessOrElseWrappedAttributePrefix=t}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}}const a=o;function l(e){if(function(e){return e instanceof o}(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=>l(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 h{}class u extends h{constructor(e,t){super(),s(),this.privateDoNotAccessOrElseWrappedStyleSheet=e}toString(){return this.privateDoNotAccessOrElseWrappedStyleSheet}}function p(e){return new u(e,n)}function d(e){if(e instanceof u)return e.privateDoNotAccessOrElseWrappedStyleSheet;throw new Error("")}Error;function f(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function m(e){return-1===e.toString().indexOf("`")}m((e=>e``))||m((e=>e`\0`))||m((e=>e`\n`))||m((e=>e`\u0000`)),f``&&f`\0`&&f`\n`&&f`\u0000`;function _(e){const t=e[0].toLowerCase();return new a(n,t)}var g,$;function v(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"}(g||(g={}));class x{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:$.KEEP};const i=this.globalAttributePolicies.get(e);return i||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some((t=>0===e.indexOf(t)))?{policyAction:$.KEEP}:{policyAction:$.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"}($||($={}));new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const w=["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:$.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:$.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:$.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:$.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY}]])]],E=["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"],y=[["dir",{policyAction:$.KEEP_AND_NORMALIZE,conditions:v((()=>new Map([["dir",new Set(["auto","ltr","rtl"])]])))}],["async",{policyAction:$.KEEP_AND_NORMALIZE,conditions:v((()=>new Map([["async",new Set(["async"])]])))}],["cite",{policyAction:$.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:$.KEEP_AND_NORMALIZE,conditions:v((()=>new Map([["loading",new Set(["eager","lazy"])]])))}],["poster",{policyAction:$.KEEP_AND_SANITIZE_URL}],["target",{policyAction:$.KEEP_AND_NORMALIZE,conditions:v((()=>new Map([["target",new Set(["_self","_blank"])]])))}]];new x(new Set(w),new Map(b),new Set(E),new Map(y)),new x(new Set(v((()=>w.concat(["STYLE"])))),new Map(b),new Set(v((()=>E.concat(["id","name","class"])))),new Map(v((()=>y.concat([["style",{policyAction:$.KEEP_AND_SANITIZE_STYLE}]])))));function A(e){return p(e[0])}const R=[_`:`,_`style`,_`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 I(e,t){return void 0!==e?.[t]}function N(e,t){return"function"==typeof e?.[t]}function k(e){return e.replace(/-./g,(e=>e[1].toUpperCase()))}function T(e,t){return I(e,"attribs")?e.attribs?.[t]??null:e.getAttribute?.(t)??null}function P(e,t,r=""){return T(e,r+t)||(e.dataset?.[k(t)]??null)}function S(e,t,r){I(e,"attribs")?e.attribs[t]=r:e.setAttribute?.(t,r)}function C(e,t,r){I(e,"attribs")?e.attribs[t]=r:c(R,e,t,r)}function L(e,t,r){switch(t){case"disabled":return void(e.disabled=r);case"selected":return void(e.selected=r);case"checked":return void(e.checked=r);default:e[t]=r}}function D(e,t){I(e,"attribs")?delete e.attribs[t]:e.removeAttribute?.(t)}function M(e,t,r=""){D(e,`${r}${t}`),D(e,`data-${t}`)}function U(e,t,r){if(I(e,"attribs")&&I(t,"attribs"))t.attribs[r]=e.attribs[r];else if(r.startsWith("data-")){const i=k(r.slice(5));t.dataset[i]=e.dataset?.[i]}else{const i=e?.getAttribute?.(r);C(t,r,i||"")}}function z(e){if(I(e,"firstElementChild"))return e.firstElementChild;return Array.from(e.children).find((e=>1===e.nodeType))}function j(e,...t){if(N(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 F(e,...t){N(e,"replaceChildren")?e.replaceChildren(...t):(e.childNodes=t,t.forEach((t=>t.parentNode=e)))}function G(e,t){return N(t,"appendChild")?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,t)}function K(e,t){return N(t,"removeChild")?e.removeChild(t):(F(e,...Array.from(e.childNodes).filter((e=>e!==t))),t)}function W(e,t,r){return r?N(e,"insertBefore")?e.insertBefore(t,r):(j(r,t,r),t):G(e,t)}function Y(e,t=0){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function B(e,t=0){return globalThis.DocumentFragment&&e instanceof DocumentFragment?Array.from(e.childNodes).map((e=>B(e,t))).join(""):Y(e.outerHTML||e.nodeValue||String(e),t)}function H(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):""}var V;!function(t){t.resolveIncludes=async function(e,t){const r=e,i=r.tagName?.toLowerCase();if(!["include","link"].includes(i))return;if("link"===i&&"subresource"!==T(r,"rel"))return;this.log("include directive found in:\n",B(e,128)),this.log("include params:",t);const n="link"===r.tagName.toLocaleLowerCase()?"href":"src",s=T(r,n);if(!s)throw new Error(`"${n}" attribute missing from ${B(e,128)}.`);const o=[];"include"===i&&o.push("src"),"link"===i&&o.push("rel","href");const a=t=>{const i=z(t);for(const e of Array.from(r.attributes))i&&!o.includes(e.name)&&U(r,i,e.name);j(e,...t.childNodes)},l={...t,rootDocument:!1,maxdepth:t?.maxdepth-1};if(0===l.maxdepth)throw new Error("Maximum recursion depth reached.");if(s.includes("://")||s.startsWith("//"))this.log("Including remote file from absolute path:",s),await this.preprocessRemote(s,l).then(a);else if(t?.dirpath?.includes("://")||t?.dirpath?.startsWith("//")){const e=s.startsWith("/")?s:`${t.dirpath}/${s}`;this.log("Including remote file from relative path:",e),await this.preprocessRemote(e,l).then(a)}else if("/"===s.charAt(0))this.log("Including local file from absolute path:",s),await this.preprocessLocal(s,l).then(a);else{const e=t?.dirpath&&"."!==t?.dirpath?`${t?.dirpath}/${s}`:s;this.log("Including local file from relative path:",e),await this.preprocessLocal(e,l).then(a)}},t.rebaseRelativePaths=async function(e,t){const r=e,n=r.tagName?.toLowerCase();if(!t?.dirpath)return;const s=T(r,"src"),o=T(r,"href"),a=s||o;if(!a||((l=a).includes("://")||l.startsWith("/")||l.startsWith("#")||l.startsWith("data:")))return;var l;const c=`${t.dirpath}/${a}`;this.log("Rebasing relative path as:",c),I(r,"attribs")?C(r,s?"src":"href",c):"img"===n?r.src=c:"a"===n?function(e,t){const r=i(t);void 0!==r&&(e.href=r)}(r,c):"source"===n||"audio"===n||"video"===n||"track"===n||"input"===n?r.src=c:"area"===n?function(e,t){const r=i(t);void 0!==r&&(e.href=r)}(r,c):this.log("Unable to rebase relative path for element:",n)},t.registerCustomElements=async function(e,t){const r=e,i=r.tagName?.toLowerCase(),n=(T(r,"is")||T(r,"alt"))?.toLowerCase();if(["template","div"].includes(i)&&n){if("div"===i&&"template"!==T(r,"role"))return;this._customElements.has(n)||(this.log(`Registering custom element: ${n}\n`,B(r,128)),this._customElements.set(n,r),K(r.parentNode,r))}},t.resolveCustomElements=async function(t,r){const i=t,n=i.tagName?.toLowerCase();let s=n;if("div"===s&&(s=T(i,"role")?.toLowerCase()||s),s&&this._customElements.has(s)){this.log(`Processing custom element: ${s}\n`,B(i,128));const r=this._customElements.get(s),o=(r.content||r).cloneNode(!0),a=z(o);if(a)for(const e of Array.from(i.attributes))"div"===n&&"role"===e.name||U(i,a,e.name);const l=new e(O(o)).find((e=>"slot"===e.tagName?.toLowerCase()));l&&j(l,...i.childNodes),j(t,...o.childNodes)}},t.resolveTextNodeExpressions=async function(e,t){const r=e.nodeValue||"";if(3!==e.nodeType||!r?.trim())return;this.log("Processing node content value:\n",Y(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}))},t.resolveDataAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"data",":");if(i){this.log(":data attribute found in:\n",B(e,128)),M(r,"data",":");const n=t?.rootNode===e?this:this.subrenderer();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)}},t.resolveClassAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"class",":");if(i){this.log(":class attribute found in:\n",B(e,128)),M(r,"class",":");const t=T(r,"class")||"";return this.effect((function(){const n=this.eval(i,{$elem:e});C(r,"class",(n?`${t} ${n}`:t).trim())}))}},t.resolveTextAttributes=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"text",":");if(i){this.log(":text attribute found in:\n",B(e,128)),M(r,"text",":");const t=t=>this.textContent(e,t);return this.effect((function(){t(this.eval(i,{$elem:e}))}))}},t.resolveHtmlAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"html",":");return i?(this.log(":html attribute found in:\n",B(e,128)),M(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),F(r,i),e()}))}))):void 0},t.resolveEventAttributes=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(":on:")||t.name.startsWith("data-on-")){const i=t.name.split(":on:",2).at(-1)?.split("data-on-",2).at(-1)||"";if(!i)throw new Error(`Invalid event attribute: ${t.name}`);this.log(t.name,"attribute found in:\n",B(e,128)),D(r,t.name);const n="submit"===i&&"FORM"===r.tagName.toUpperCase();e.addEventListener?.(i,(r=>(n&&r.preventDefault(),this.eval(t.value,{$elem:e,$event:r}))))}},t.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"for",":")?.trim();if(i){this.log(":for attribute found in:\n",B(e,128)),M(r,"for",":");for(const t of O(e,this._skipNodes))this._skipNodes.add(t);const n=e.parentNode,s=this.createElement("template",e.ownerDocument);W(n,s,e),K(n,e),G(s,e),this.log(":for template:\n",B(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=[],[l,c]=o;await this.effect((function(){const r=this.eval(c,{$elem:e});if(this.log(":for list items:",r),a.splice(0,a.length).forEach((e=>{K(n,e),this._skipNodes.delete(e)})),!Array.isArray(r))return console.error(`Expression did not yield a list: \`${c}\` => \`${r}\``),Promise.resolve();const i=[];for(const n of r){const r=this.subrenderer();r.set(l,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",B(s,128))}const o=s.nextSibling;for(const e of a)W(n,e,o);return Promise.all(i)}))}},t.resolveBindAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"bind",":");if(i){this.log(":bind attribute found in:\n",B(e,128));const t=["change","input"],n=T(r,":bind:on")?.split(",")||r.dataset?.bindOn?.split(",")||t;M(r,"bind",":"),D(r,":bind:on"),D(r,"data-bind-on");const s="checkbox"===T(r,"type")?"checked":"value";this.effect((function(){const t=this.eval(i,{$elem:e});"checked"===s?r.checked=!!t:r.value=t}));const o=`${i} = $elem.${s}`;for(const t of n)e.addEventListener(t,(()=>this.eval(o,{$elem:e})))}},t.resolveShowAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"show",":");if(i){this.log(":show attribute found in:\n",B(e,128)),M(r,"show",":");const t="none"===r.style?.display?"":r.style?.display??T(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":C(r,"style",`display: ${n?t:"none"};`)}))}},t.resolveCustomAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[])){const i=":attr:",n="data-attr-";if(t.name.startsWith(i)||t.name.startsWith(n)){this.log(t.name,"attribute found in:\n",B(e,128)),D(r,t.name);const s=t.name.split(i,2).at(-1)?.split(n,2).at(-1);this.effect((function(){const i=this.eval(t.value,{$elem:e});S(r,s,i)}))}}},t.resolveCustomProperty=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[])){const i=":prop:",n="data-prop-";if(t.name.startsWith(i)||t.name.startsWith(n)){this.log(t.name,"property found in:\n",B(e,128)),D(r,t.name);const s=t.name.split(i,2).at(-1)?.split(n,2).at(-1),o=k(s);this.effect((function(){const i=this.eval(t.value,{$elem:e});L(r,o,i)}))}}}}(V||(V={}));const Z=["this"],q=["+","-","!"],Q=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],X={"!":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},J=["==","!=","<=",">=","||","&&","??","|>"],ee=["===","!=="];var te;!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"}(te||(te={}));const re=(e,t,r=0)=>({kind:e,value:t,precedence:r}),ie=e=>95===e||36===e||65<=(e&=-33)&&e<=90,ne=e=>48<=e&&e<=57;class se{_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(ie(this._next))return this._tokenizeIdentOrKeyword();if(ne(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=re(te.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,ie(e)||ne(e));var e;const t=this._getValue(),r=(i=t,-1!==Z.indexOf(i)?te.KEYWORD:te.IDENTIFIER);var i;return re(r,t)}_tokenizeNumber(){do{this._advance()}while(ne(this._next));return 46===this._next?this._tokenizeDot():re(te.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),ne(this._next)?this._tokenizeFraction():(this._clearValue(),re(te.DOT,".",13))}_tokenizeComma(){return this._advance(!0),re(te.COMMA,",")}_tokenizeColon(){return this._advance(!0),re(te.COLON,":")}_tokenizeFraction(){do{this._advance()}while(ne(this._next));return re(te.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(-1!==ee.indexOf(e))this._advance(),this._advance();else{if(e=this._getValue(1),"=>"===e)return this._advance(),re(te.ARROW,e);-1!==J.indexOf(e)&&this._advance()}return e=this._getValue(),re(te.OPERATOR,e,X[e])}_tokenizeGrouper(){const e=String.fromCharCode(this._next),t=re(te.GROUPER,e,X[e]);return this._advance(!0),t}}class oe{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new se(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(te.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(te.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(te.DOT)){this._advance();const t=this._parseUnary();e=this._makeInvokeOrGetter(e,t)}else{if(this._matches(te.KEYWORD))break;if(!(this._matches(te.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===Q.indexOf(t.value))throw new Error(`unknown operator: ${t.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===te.OPERATOR||this._kind===te.DOT||this._kind===te.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(te.OPERATOR)){const e=this._value;if(this._advance(),"+"===e||"-"===e){if(this._matches(te.INTEGER))return this._parseInteger(e);if(this._matches(te.DECIMAL))return this._parseDecimal(e)}if(-1===q.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(te.OPERATOR,"?");const t=this._parseExpression();this._advance(te.COLON);const r=this._parseExpression();return this._ast.ternary(e,t,r)}_parsePrimary(){switch(this._kind){case te.KEYWORD:const e=this._value;if("this"===e)return this._advance(),this._ast.id(e);if(-1!==Z.indexOf(e))throw new Error(`unexpected keyword: ${e}`);throw new Error(`unrecognized keyword: ${e}`);case te.IDENTIFIER:return this._parseInvokeOrIdentifier();case te.STRING:return this._parseString();case te.INTEGER:return this._parseInteger();case te.DECIMAL:return this._parseDecimal();case te.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case te.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const e=[];do{if(this._advance(),this._matches(te.GROUPER,"]"))break;e.push(this._parseExpression())}while(this._matches(te.COMMA));return this._advance(te.GROUPER,"]"),this._ast.list(e)}_parseMap(){const e={};do{if(this._advance(),this._matches(te.GROUPER,"}"))break;const t=this._value;(this._matches(te.STRING)||this._matches(te.IDENTIFIER))&&this._advance(),this._advance(te.COLON),e[t]=this._parseExpression()}while(this._matches(te.COMMA));return this._advance(te.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(te.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(te.GROUPER,"("))return;const e=[];do{if(this._advance(),this._matches(te.GROUPER,")"))break;const t=this._parseExpression();e.push(t)}while(this._matches(te.COMMA));return this._advance(te.GROUPER,")"),e}_parseIndex(){this._advance();const e=this._parseExpression();return this._advance(te.GROUPER,"]"),e}_parseParenOrFunction(){const e=this._parseArguments();if(this._matches(te.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 ae={"+":(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)},le={"+":e=>e,"-":e=>-e,"!":e=>!e};class ce{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 he=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=le[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=ae[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)))}}}};function ue(e,t){if(e.has(t))return e.get(t);if(e.has("$parent")){return ue(e.get("$parent"),t)}return null}function pe(e,t){if(e.has(t))return e;if(e.has("$parent")){return pe(e.get("$parent"),t)}return null}class de extends ce{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 de||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),ue(this.store,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)),function(e,t,r){const i=pe(e,t);i?i.set(t,r):e.set(t,r)}(this.store,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&&pe(this.store,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 oe(e,t).parse())(e,he),s=n?.getIds([])?.map((e=>[e,i[e]??r[e]??globalThis[e]])),o=n?.evaluate(Object.fromEntries(s||[]));if(!t)return o;!function(e,t,r){const i=t.split(".");for(let t=0;t<i.length-1;t++)i[t]in e||(e[i[t]]={}),e=e[i[t]];e[i[i.length-1]]=r}(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 fe extends de{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:H(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:H(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}subrenderer(){const e=(new this.constructor).debug(this.debugging);return e.set("$parent",this),e.set("$root",this.get("$root")??this),e._customElements=this._customElements,e}log(...e){this.debugging&&console.debug(...e)}async preprocessNode(t,r){r={dirpath:this.dirpath,maxdepth:10,...r};const i=new e(O(t,this._skipNodes)).map((async e=>{this.log("Preprocessing node:\n",B(e,128)),await V.resolveIncludes.call(this,e,r),await V.rebaseRelativePaths.call(this,e,r),await V.registerCustomElements.call(this,e,r),await V.resolveCustomElements.call(this,e,r)}));return await Promise.all(i.generator()),t}async renderNode(e,t){for(const r of O(e,this._skipNodes))this.log("Rendering node:\n",B(r,128)),await V.resolveForAttribute.call(this,r,t),await V.resolveDataAttribute.call(this,r,t),await V.resolveTextAttributes.call(this,r,t),await V.resolveHtmlAttribute.call(this,r,t),await V.resolveShowAttribute.call(this,r,t),await V.resolveClassAttribute.call(this,r,t),await V.resolveBindAttribute.call(this,r,t),await V.resolveEventAttributes.call(this,r,t),await V.resolveTextNodeExpressions.call(this,r,t),await V.resolveCustomAttribute.call(this,r,t),await V.resolveCustomProperty.call(this,r,t);return e}async mount(e,t){t={...t,rootNode:e},await this.preprocessNode(e,t),await this.renderNode(e,t),L(e,"renderer",this)}}function me(){return p([A`html{`,A`max-width: 70ch;`,A`padding: 2em 1em;`,A`margin: auto;`,A`line-height: 1.75;`,A`font-size: 1.25em;`,A`font-family: sans-serif;`,A`}`,A`h1,h2,h3,h4,h5,h6{`,A`margin: 1em 0 0.5em;`,A`}`,A`p,ul,ol{`,A`margin-bottom: 1em;`,A`color: #1d1d1d;`,A`}`].map(d).join(""))}const _e={sm:640,md:768,lg:1024,xl:1280},ge=.25,$e=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],ve=[...$e,16,20,24,25,28,30,32,36,40,44,48,50,52,56,60,64,72,80,96,100,112,128,144,160,192,200,224,256,288,300,320,384,400,448,500,512,...Object.values(_e)],xe=[1,2,5,10,20,25,30,40,50,60,70,75,80,90,95,98,99,100],we=[75,100,150,200,300,500,700,1e3],be=["hover","focus","disabled","active"],Ee={margin:"m",padding:"p"},ye={width:"w",height:"h"},Ae={top:"top",right:"right",bottom:"bottom",left:"left"},Re={"min-width":"min-w","min-height":"min-h","max-width":"max-w","max-height":"max-h"},Oe={"font-mono":{"font-family":"monospace"},"font-sans":{"font-family":"sans-serif"},"font-serif":{"font-family":"serif"},"font-cursive":{"font-family":"cursive"},"text-xs":{"font-size":".75rem","line-height":"calc(1 / 0.75)"},"text-sm":{"font-size":".875rem","line-height":"calc(1.25 / 0.875)"},"text-base":{"font-size":"1rem","line-height":"calc(1.5 / 1)"},"text-lg":{"font-size":"1.125rem","line-height":"calc(1.75 / 1.125)"},"text-xl":{"font-size":"1.25rem","line-height":"calc(1.75 / 1.25)"},"text-2xl":{"font-size":"1.5rem","line-height":"calc(2 / 1.5)"},"text-3xl":{"font-size":"1.875rem","line-height":"calc(2.25 / 1.875)"},"text-4xl":{"font-size":"2.25rem","line-height":"calc(2.5 / 2.25)"},"text-5xl":{"font-size":"3rem","line-height":"1"},"text-6xl":{"font-size":"3.75rem","line-height":"1"},"text-7xl":{"font-size":"4.5rem","line-height":"1"},"font-thin":{"font-weight":100},"font-extralight":{"font-weight":200},"font-light":{"font-weight":300},"font-normal":{"font-weight":400},"font-medium":{"font-weight":500},"font-semibold":{"font-weight":600},"font-bold":{"font-weight":700},"font-extrabold":{"font-weight":800},"font-black":{"font-weight":900},italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"},"w-max":{width:"max-content"},"w-min":{width:"min-content"},"w-fit":{width:"fit-content"},"h-max":{height:"max-content"},"h-min":{height:"min-content"},"h-fit":{height:"fit-content"},"tracking-tighter":{"letter-spacing":"-0.05em"},"tracking-tight":{"letter-spacing":"-0.025em"},"tracking-normal":{"letter-spacing":"0"},"tracking-wide":{"letter-spacing":"0.025em"},"tracking-wider":{"letter-spacing":"0.05em"},"tracking-widest":{"letter-spacing":"0.1em"},"leading-none":{"line-height":"1"},"leading-tight":{"line-height":"1.25"},"leading-snug":{"line-height":"1.375"},"leading-normal":{"line-height":"1.5"},"leading-relaxed":{"line-height":"1.625"},"leading-loose":{"line-height":"2"},"text-left":{"text-align":"left"},"text-right":{"text-align":"right"},"text-center":{"text-align":"center"},"text-justify":{"text-align":"justify"},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"},truncate:{"white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"},"text-elipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"},"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"},"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"},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-x-hidden":{"overflow-x":"hidden"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-visible":{overflow:"visible"},"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"},"z-auto":{"z-index":"auto"},"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-none":{border:"none"},"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-collapse":{"border-collapse":"collapse"},"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"},shadow:{"box-shadow":"0 0 1px 0 rgba(0, 0, 0, 0.05)"},"shadow-sm":{"box-shadow":"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},"shadow-md":{"box-shadow":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},"shadow-lg":{"box-shadow":"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},"shadow-xl":{"box-shadow":"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"},"shadow-2xl":{"box-shadow":"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},"shadow-inner":{"box-shadow":"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},"shadow-outline":{"box-shadow":"0 0 0 3px rgba(66, 153, 225, 0.5)"},"shadow-none":{"box-shadow":"none"},"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"}},Ie=["@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 }"],Ne={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 ke(e){return`#${e.toString(16).padStart(6,"0")}`}function Te(e){return be.map((t=>`.${t}\\:${e}:${t}`))}function Pe(e,t){return Object.entries(_e).map((([r,i])=>`@media (min-width: ${i}px) { .${r}\\:${e} { ${t} } }`))}function Se(e,t){return e.includes("@media")&&!t.includes("@media")?1:!e.includes("@media")&&t.includes("@media")?-1:e.localeCompare(t)}function Ce(e){return Object.entries(e).flatMap((([e,t])=>[[`${t}-0`,`${e}: 0`],[`${t}-screen`,`${e}: 100vw`],[`${t}-full`,`${e}: 100%`],...ve.map((r=>[`${t}-${r}`,`${e}: ${r*ge}rem`])),...ve.map((r=>[`-${t}-${r}`,`${e}: -${r*ge}rem`])),...ve.map((r=>[`${t}-${r}px`,`${e}: ${r}px`])),...ve.map((r=>[`-${t}-${r}px`,`${e}: -${r}px`])),...xe.map((r=>[`${t}-${r}\\%`,`${e}: ${r}%`])),...xe.map((r=>[`-${t}-${r}\\%`,`${e}: -${r}%`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))}function Le(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;`],...ve.map((e=>[e,e*ge])).map((([r,i])=>[`${t}x-${r}`,`${e}-left: ${i}rem; ${e}-right: ${i}rem;`])),...ve.map((e=>[e,e*ge])).map((([r,i])=>[`${t}y-${r}`,`${e}-top: ${i}rem; ${e}-bottom: ${i}rem;`])),...ve.map((r=>[`${t}x-${r}px`,`${e}-left: ${r}px; ${e}-right: ${r}px;`])),...ve.map((r=>[`${t}y-${r}px`,`${e}-top: ${r}px; ${e}-bottom: ${r}px;`])),...xe.map((r=>[`${t}x-${r}\\%`,`${e}-left: ${r}%; ${e}-right: ${r}%;`])),...xe.map((r=>[`${t}y-${r}\\%`,`${e}-top: ${r}%; ${e}-bottom: ${r}%;`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))}function De(){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(Ne).flatMap((([e,t])=>[[`text-${e}`,`color: ${ke(t[500])}`],[`fill-${e}`,`fill: ${ke(t[500])}`],[`bg-${e}`,`background-color: ${ke(t[500])}`],[`border-${e}`,`border-color: ${ke(t[500])}`]])),r=Object.entries(Ne).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[[`text-${e}-${t}`,`color: ${ke(r)}`],[`fill-${e}-${t}`,`fill: ${ke(r)}`],[`bg-${e}-${t}`,`background-color: ${ke(r)}`],[`border-${e}-${t}`,`border-color: ${ke(r)}`]]))));return[].concat(e).concat(t).concat(r).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))}function Me(){return[...Ie,...Object.entries(Oe).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[`.${e} { ${t}: ${r} }`,`${Te(e).join(",")} { ${t}: ${r} }`,...Pe(e,`${t}: ${r}`)])))),...De(),...[["opacity-0","opacity: 0"],...xe.map((e=>[`opacity-${e}`,"opacity: "+e/100]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...xe.map((e=>[`z-${e}`,`z-index: ${e}`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...we.map((e=>[`duration-${e}`,`transition-duration: ${e}ms`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...Ce(Ae),...Ce(ye),...Le(ye),...(e=Ee,Object.entries(e).flatMap((([e,t])=>[[`${t}t-0`,`${e}-top: 0`],[`${t}b-0`,`${e}-bottom: 0`],[`${t}l-0`,`${e}-left: 0`],[`${t}r-0`,`${e}-right: 0`],[`${t}t-auto`,`${e}-top: auto`],[`${t}b-auto`,`${e}-bottom: auto`],[`${t}l-auto`,`${e}-left: auto`],[`${t}r-auto`,`${e}-right: auto`],...["","-"].flatMap((r=>[...ve.map((e=>[e,e*ge])).map((([i,n])=>[`${r}${t}t-${i}`,`${e}-top: ${r}${n}rem`])),...ve.map((e=>[e,e*ge])).map((([i,n])=>[`${r}${t}b-${i}`,`${e}-bottom: ${r}${n}rem`])),...ve.map((e=>[e,e*ge])).map((([i,n])=>[`${r}${t}l-${i}`,`${e}-left: ${r}${n}rem`])),...ve.map((e=>[e,e*ge])).map((([i,n])=>[`${r}${t}r-${i}`,`${e}-right: ${r}${n}rem`])),...ve.map((i=>[`${r}${t}t-${i}px`,`${e}-top: ${r}${i}px`])),...ve.map((i=>[`${r}${t}b-${i}px`,`${e}-bottom: ${r}${i}px`])),...ve.map((i=>[`${r}${t}l-${i}px`,`${e}-left: ${r}${i}px`])),...ve.map((i=>[`${r}${t}r-${i}px`,`${e}-right: ${r}${i}px`])),...xe.map((i=>[`${r}${t}t-${i}\\%`,`${e}-top: ${r}${i}%`])),...xe.map((i=>[`${r}${t}b-${i}\\%`,`${e}-bottom: ${r}${i}%;`])),...xe.map((i=>[`${r}${t}l-${i}\\%`,`${e}-left: ${r}${i}%`])),...xe.map((i=>[`${r}${t}r-${i}\\%`,`${e}-right: ${r}${i}%`]))]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))),...Ce(Ee),...Le(Ee),...[["space-x-0 > *","margin-left: 0"],["space-y-0 > *","margin-top: 0"],...ve.map((e=>[`space-x-${e} > :not(:first-child)`,`margin-left: ${e*ge}rem`])),...ve.map((e=>[`space-y-${e} > :not(:first-child)`,`margin-top: ${e*ge}rem`])),...ve.map((e=>[`space-x-${e}px > :not(:first-child)`,`margin-left: ${e}px`])),...ve.map((e=>[`space-y-${e}px > :not(:first-child)`,`margin-top: ${e}px`])),["gap-0","gap: 0"],...ve.map((e=>[`gap-${e}`,`gap: ${e*ge}rem`])),...ve.map((e=>[`gap-${e}px`,`gap: ${e}px`])),...ve.map((e=>[`gap-x-${e}`,`column-gap: ${e*ge}rem`])),...ve.map((e=>[`gap-y-${e}`,`row-gap: ${e*ge}rem`])),...ve.map((e=>[`gap-x-${e}px`,`column-gap: ${e}px`])),...ve.map((e=>[`gap-y-${e}px`,`row-gap: ${e}px`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...Ce(Re),...[["border","border: 1px"],["border-x","border-inline-width: 1px"],["border-y","border-block-width: 1px"],...[0,...$e].map((e=>[`border-${e}`,`border-width: ${e}px`])),...[0,...$e].map((e=>[`border-x-${e}`,`border-inline-width: ${e}px;`])),...[0,...$e].map((e=>[`border-y-${e}`,`border-block-width: ${e}px;`])),...["top","bottom","left","right"].flatMap((e=>[[`border-${e.slice(0,1)}`,`border-${e}: 1px`],...[0,...$e].map((t=>[`border-${e.slice(0,1)}-${t}`,`border-${e}-width: ${t}px`]))]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...Array.from({length:100},((e,t)=>t)).map((e=>[`text-${e}px`,`font-size: ${e}px`])),...Array.from({length:100},((e,t)=>t*ge)).map((e=>[`text-${e}rem`,`font-size: ${e}rem`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))].sort(Se).join("\n");var e}class Ue extends fe{impl="browser";dirpath=H(globalThis.location?.href??"http://localhost/");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}}const ze=new Ue;export{ze as Mancha,Ue as Renderer,me as basicCssRules,Me as utilsCssRules};
1
+ class e{iterable;constructor(e){this.iterable=e}filter(t){return new e(e.filterGenerator(t,this.iterable))}map(t){return new e(e.mapGenerator(t,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}}const t=/^\s*(?!javascript:)(?:[\w+.-]+:|[^:/?#]*(?:[/?#]|$))/i;function r(e){if(!function(e){const r=!t.test(e);return r}(e))return e}function i(e){return r(e)}const n={};function s(e){0}"undefined"!=typeof window&&window.TrustedScriptURL;class o{constructor(e,t){this.privateDoNotAccessOrElseWrappedAttributePrefix=t}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}}const a=o;function l(e){if(function(e){return e instanceof o}(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=>l(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 h{}class u extends h{constructor(e,t){super(),s(),this.privateDoNotAccessOrElseWrappedStyleSheet=e}toString(){return this.privateDoNotAccessOrElseWrappedStyleSheet}}function p(e){return new u(e,n)}function d(e){if(e instanceof u)return e.privateDoNotAccessOrElseWrappedStyleSheet;throw new Error("")}Error;function f(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function m(e){return-1===e.toString().indexOf("`")}m((e=>e``))||m((e=>e`\0`))||m((e=>e`\n`))||m((e=>e`\u0000`)),f``&&f`\0`&&f`\n`&&f`\u0000`;function _(e){const t=e[0].toLowerCase();return new a(n,t)}var g,$;function v(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"}(g||(g={}));class x{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:$.KEEP};const i=this.globalAttributePolicies.get(e);return i||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some((t=>0===e.indexOf(t)))?{policyAction:$.KEEP}:{policyAction:$.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"}($||($={}));new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const w=["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:$.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:$.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:$.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:$.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:$.KEEP_AND_USE_RESOURCE_URL_POLICY}]])]],E=["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"],y=[["dir",{policyAction:$.KEEP_AND_NORMALIZE,conditions:v((()=>new Map([["dir",new Set(["auto","ltr","rtl"])]])))}],["async",{policyAction:$.KEEP_AND_NORMALIZE,conditions:v((()=>new Map([["async",new Set(["async"])]])))}],["cite",{policyAction:$.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:$.KEEP_AND_NORMALIZE,conditions:v((()=>new Map([["loading",new Set(["eager","lazy"])]])))}],["poster",{policyAction:$.KEEP_AND_SANITIZE_URL}],["target",{policyAction:$.KEEP_AND_NORMALIZE,conditions:v((()=>new Map([["target",new Set(["_self","_blank"])]])))}]];new x(new Set(w),new Map(b),new Set(E),new Map(y)),new x(new Set(v((()=>w.concat(["STYLE"])))),new Map(b),new Set(v((()=>E.concat(["id","name","class"])))),new Map(v((()=>y.concat([["style",{policyAction:$.KEEP_AND_SANITIZE_STYLE}]])))));function A(e){return p(e[0])}const R=[_`:`,_`style`,_`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 I(e,t){return void 0!==e?.[t]}function N(e,t){return"function"==typeof e?.[t]}function k(e){return e.replace(/-./g,(e=>e[1].toUpperCase()))}function T(e,t){return I(e,"attribs")?e.attribs?.[t]??null:e.getAttribute?.(t)??null}function P(e,t,r=""){return T(e,r+t)||(e.dataset?.[k(t)]??null)}function S(e,t,r){I(e,"attribs")?e.attribs[t]=r:e.setAttribute?.(t,r)}function C(e,t,r){I(e,"attribs")?e.attribs[t]=r:c(R,e,t,r)}function L(e,t,r){switch(t){case"disabled":return void(e.disabled=r);case"selected":return void(e.selected=r);case"checked":return void(e.checked=r);default:e[t]=r}}function D(e,t){I(e,"attribs")?delete e.attribs[t]:e.removeAttribute?.(t)}function M(e,t,r=""){D(e,`${r}${t}`),D(e,`data-${t}`)}function U(e,t,r){if(I(e,"attribs")&&I(t,"attribs"))t.attribs[r]=e.attribs[r];else if(r.startsWith("data-")){const i=k(r.slice(5));t.dataset[i]=e.dataset?.[i]}else{const i=e?.getAttribute?.(r);C(t,r,i||"")}}function z(e){if(I(e,"firstElementChild"))return e.firstElementChild;return Array.from(e.children).find((e=>1===e.nodeType))}function j(e,...t){if(N(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 F(e,...t){N(e,"replaceChildren")?e.replaceChildren(...t):(e.childNodes=t,t.forEach((t=>t.parentNode=e)))}function G(e,t){return N(t,"appendChild")?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,t)}function K(e,t){return N(t,"removeChild")?e.removeChild(t):(F(e,...Array.from(e.childNodes).filter((e=>e!==t))),t)}function W(e,t,r){return r?N(e,"insertBefore")?e.insertBefore(t,r):(j(r,t,r),t):G(e,t)}function Y(e,t=0){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function B(e,t=0){return globalThis.DocumentFragment&&e instanceof DocumentFragment?Array.from(e.childNodes).map((e=>B(e,t))).join(""):Y(e.outerHTML||e.nodeValue||String(e),t)}function H(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):""}var V;!function(t){t.resolveIncludes=async function(e,t){const r=e,i=r.tagName?.toLowerCase();if(!["include","link"].includes(i))return;if("link"===i&&"subresource"!==T(r,"rel"))return;this.log("include directive found in:\n",B(e,128)),this.log("include params:",t);const n="link"===r.tagName.toLocaleLowerCase()?"href":"src",s=T(r,n);if(!s)throw new Error(`"${n}" attribute missing from ${B(e,128)}.`);const o=[];"include"===i&&o.push("src"),"link"===i&&o.push("rel","href");const a=t=>{const i=z(t);for(const e of Array.from(r.attributes))i&&!o.includes(e.name)&&U(r,i,e.name);j(e,...t.childNodes)},l={...t,rootDocument:!1,maxdepth:t?.maxdepth-1};if(0===l.maxdepth)throw new Error("Maximum recursion depth reached.");if(s.includes("://")||s.startsWith("//"))this.log("Including remote file from absolute path:",s),await this.preprocessRemote(s,l).then(a);else if(t?.dirpath?.includes("://")||t?.dirpath?.startsWith("//")){const e=s.startsWith("/")?s:`${t.dirpath}/${s}`;this.log("Including remote file from relative path:",e),await this.preprocessRemote(e,l).then(a)}else if("/"===s.charAt(0))this.log("Including local file from absolute path:",s),await this.preprocessLocal(s,l).then(a);else{const e=t?.dirpath&&"."!==t?.dirpath?`${t?.dirpath}/${s}`:s;this.log("Including local file from relative path:",e),await this.preprocessLocal(e,l).then(a)}},t.rebaseRelativePaths=async function(e,t){const r=e,n=r.tagName?.toLowerCase();if(!t?.dirpath)return;const s=T(r,"src"),o=T(r,"href"),a=s||o;if(!a||((l=a).includes("://")||l.startsWith("/")||l.startsWith("#")||l.startsWith("data:")))return;var l;const c=`${t.dirpath}/${a}`;this.log("Rebasing relative path as:",c),I(r,"attribs")?C(r,s?"src":"href",c):"img"===n?r.src=c:"a"===n?function(e,t){const r=i(t);void 0!==r&&(e.href=r)}(r,c):"source"===n||"audio"===n||"video"===n||"track"===n||"input"===n?r.src=c:"area"===n?function(e,t){const r=i(t);void 0!==r&&(e.href=r)}(r,c):this.log("Unable to rebase relative path for element:",n)},t.registerCustomElements=async function(e,t){const r=e,i=r.tagName?.toLowerCase(),n=(T(r,"is")||T(r,"alt"))?.toLowerCase();if(["template","div"].includes(i)&&n){if("div"===i&&"template"!==T(r,"role"))return;this._customElements.has(n)||(this.log(`Registering custom element: ${n}\n`,B(r,128)),this._customElements.set(n,r),K(r.parentNode,r))}},t.resolveCustomElements=async function(t,r){const i=t,n=i.tagName?.toLowerCase();let s=n;if("div"===s&&(s=T(i,"role")?.toLowerCase()||s),s&&this._customElements.has(s)){this.log(`Processing custom element: ${s}\n`,B(i,128));const r=this._customElements.get(s),o=(r.content||r).cloneNode(!0),a=z(o);if(a)for(const e of Array.from(i.attributes))"div"===n&&"role"===e.name||U(i,a,e.name);const l=new e(O(o)).find((e=>"slot"===e.tagName?.toLowerCase()));l&&j(l,...i.childNodes),j(t,...o.childNodes)}},t.resolveTextNodeExpressions=async function(e,t){const r=e.nodeValue||"";if(3!==e.nodeType||!r?.trim())return;this.log("Processing node content value:\n",Y(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}))},t.resolveDataAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"data",":");if(i){this.log(":data attribute found in:\n",B(e,128)),M(r,"data",":");const n=t?.rootNode===e?this:this.subrenderer();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)}},t.resolveClassAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"class",":");if(i){this.log(":class attribute found in:\n",B(e,128)),M(r,"class",":");const t=T(r,"class")||"";return this.effect((function(){const n=this.eval(i,{$elem:e});C(r,"class",(n?`${t} ${n}`:t).trim())}))}},t.resolveTextAttributes=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"text",":");if(i){this.log(":text attribute found in:\n",B(e,128)),M(r,"text",":");const t=t=>this.textContent(e,t);return this.effect((function(){t(this.eval(i,{$elem:e}))}))}},t.resolveHtmlAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"html",":");return i?(this.log(":html attribute found in:\n",B(e,128)),M(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),F(r,i),e()}))}))):void 0},t.resolveEventAttributes=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(":on:")||t.name.startsWith("data-on-")){const i=t.name.split(":on:",2).at(-1)?.split("data-on-",2).at(-1)||"";if(!i)throw new Error(`Invalid event attribute: ${t.name}`);this.log(t.name,"attribute found in:\n",B(e,128)),D(r,t.name);const n="submit"===i&&"FORM"===r.tagName.toUpperCase();e.addEventListener?.(i,(r=>(n&&r.preventDefault(),this.eval(t.value,{$elem:e,$event:r}))))}},t.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"for",":")?.trim();if(i){this.log(":for attribute found in:\n",B(e,128)),M(r,"for",":");for(const t of O(e,this._skipNodes))this._skipNodes.add(t);const n=T(r,"style")||"";S(r,"style","display: none;");const s=e.parentNode,o=this.createElement("template",e.ownerDocument);W(s,o,e),K(s,e),G(o,e),this.log(":for template:\n",B(o,128));const a=i.split(" in ",2);if(2!==a.length)throw new Error(`Invalid :for format: \`${i}\`. Expected "{key} in {expression}".`);const l=[],[c,h]=a;await this.effect((function(){const r=this.eval(h,{$elem:e});if(this.log(":for list items:",r),l.splice(0,l.length).forEach((e=>{K(s,e),this._skipNodes.delete(e)})),!Array.isArray(r))return console.error(`Expression did not yield a list: \`${h}\` => \`${r}\``),Promise.resolve();const i=[];for(const s of r){const r=this.subrenderer();r.set(c,s);const o=e.cloneNode(!0);S(o,"style",n),l.push(o),this._skipNodes.add(o),i.push(r.mount(o,t)),this.log("Rendered list child:\n",B(o,128))}const a=o.nextSibling;for(const e of l)W(s,e,a);return Promise.all(i)}))}},t.resolveBindAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"bind",":");if(i){this.log(":bind attribute found in:\n",B(e,128));const t=["change","input"],n=T(r,":bind:on")?.split(",")||r.dataset?.bindOn?.split(",")||t;M(r,"bind",":"),D(r,":bind:on"),D(r,"data-bind-on");const s="checkbox"===T(r,"type")?"checked":"value";this.effect((function(){const t=this.eval(i,{$elem:e});"checked"===s?r.checked=!!t:r.value=t}));const o=`${i} = $elem.${s}`;for(const t of n)e.addEventListener(t,(()=>this.eval(o,{$elem:e})))}},t.resolveShowAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"show",":");if(i){this.log(":show attribute found in:\n",B(e,128)),M(r,"show",":");const t="none"===r.style?.display?"":r.style?.display??T(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":C(r,"style",`display: ${n?t:"none"};`)}))}},t.resolveCustomAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[])){const i=":attr:",n="data-attr-";if(t.name.startsWith(i)||t.name.startsWith(n)){this.log(t.name,"attribute found in:\n",B(e,128)),D(r,t.name);const s=t.name.split(i,2).at(-1)?.split(n,2).at(-1);this.effect((function(){const i=this.eval(t.value,{$elem:e});S(r,s,i)}))}}},t.resolveCustomProperty=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[])){const i=":prop:",n="data-prop-";if(t.name.startsWith(i)||t.name.startsWith(n)){this.log(t.name,"property found in:\n",B(e,128)),D(r,t.name);const s=t.name.split(i,2).at(-1)?.split(n,2).at(-1),o=k(s);this.effect((function(){const i=this.eval(t.value,{$elem:e});L(r,o,i)}))}}}}(V||(V={}));const Z=["this"],q=["+","-","!"],Q=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],X={"!":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},J=["==","!=","<=",">=","||","&&","??","|>"],ee=["===","!=="];var te;!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"}(te||(te={}));const re=(e,t,r=0)=>({kind:e,value:t,precedence:r}),ie=e=>95===e||36===e||65<=(e&=-33)&&e<=90,ne=e=>48<=e&&e<=57;class se{_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(ie(this._next))return this._tokenizeIdentOrKeyword();if(ne(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=re(te.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,ie(e)||ne(e));var e;const t=this._getValue(),r=(i=t,-1!==Z.indexOf(i)?te.KEYWORD:te.IDENTIFIER);var i;return re(r,t)}_tokenizeNumber(){do{this._advance()}while(ne(this._next));return 46===this._next?this._tokenizeDot():re(te.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),ne(this._next)?this._tokenizeFraction():(this._clearValue(),re(te.DOT,".",13))}_tokenizeComma(){return this._advance(!0),re(te.COMMA,",")}_tokenizeColon(){return this._advance(!0),re(te.COLON,":")}_tokenizeFraction(){do{this._advance()}while(ne(this._next));return re(te.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(-1!==ee.indexOf(e))this._advance(),this._advance();else{if(e=this._getValue(1),"=>"===e)return this._advance(),re(te.ARROW,e);-1!==J.indexOf(e)&&this._advance()}return e=this._getValue(),re(te.OPERATOR,e,X[e])}_tokenizeGrouper(){const e=String.fromCharCode(this._next),t=re(te.GROUPER,e,X[e]);return this._advance(!0),t}}class oe{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new se(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(te.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(te.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(te.DOT)){this._advance();const t=this._parseUnary();e=this._makeInvokeOrGetter(e,t)}else{if(this._matches(te.KEYWORD))break;if(!(this._matches(te.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===Q.indexOf(t.value))throw new Error(`unknown operator: ${t.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===te.OPERATOR||this._kind===te.DOT||this._kind===te.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(te.OPERATOR)){const e=this._value;if(this._advance(),"+"===e||"-"===e){if(this._matches(te.INTEGER))return this._parseInteger(e);if(this._matches(te.DECIMAL))return this._parseDecimal(e)}if(-1===q.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(te.OPERATOR,"?");const t=this._parseExpression();this._advance(te.COLON);const r=this._parseExpression();return this._ast.ternary(e,t,r)}_parsePrimary(){switch(this._kind){case te.KEYWORD:const e=this._value;if("this"===e)return this._advance(),this._ast.id(e);if(-1!==Z.indexOf(e))throw new Error(`unexpected keyword: ${e}`);throw new Error(`unrecognized keyword: ${e}`);case te.IDENTIFIER:return this._parseInvokeOrIdentifier();case te.STRING:return this._parseString();case te.INTEGER:return this._parseInteger();case te.DECIMAL:return this._parseDecimal();case te.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case te.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const e=[];do{if(this._advance(),this._matches(te.GROUPER,"]"))break;e.push(this._parseExpression())}while(this._matches(te.COMMA));return this._advance(te.GROUPER,"]"),this._ast.list(e)}_parseMap(){const e={};do{if(this._advance(),this._matches(te.GROUPER,"}"))break;const t=this._value;(this._matches(te.STRING)||this._matches(te.IDENTIFIER))&&this._advance(),this._advance(te.COLON),e[t]=this._parseExpression()}while(this._matches(te.COMMA));return this._advance(te.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(te.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(te.GROUPER,"("))return;const e=[];do{if(this._advance(),this._matches(te.GROUPER,")"))break;const t=this._parseExpression();e.push(t)}while(this._matches(te.COMMA));return this._advance(te.GROUPER,")"),e}_parseIndex(){this._advance();const e=this._parseExpression();return this._advance(te.GROUPER,"]"),e}_parseParenOrFunction(){const e=this._parseArguments();if(this._matches(te.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 ae={"+":(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)},le={"+":e=>e,"-":e=>-e,"!":e=>!e};class ce{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 he=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=le[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=ae[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)))}}}};function ue(e,t){if(e.has(t))return e.get(t);if(e.has("$parent")){return ue(e.get("$parent"),t)}return null}function pe(e,t){if(e.has(t))return e;if(e.has("$parent")){return pe(e.get("$parent"),t)}return null}class de extends ce{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 de||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),ue(this.store,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)),function(e,t,r){const i=pe(e,t);i?i.set(t,r):e.set(t,r)}(this.store,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&&pe(this.store,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 oe(e,t).parse())(e,he),s=n?.getIds([])?.map((e=>[e,i[e]??r[e]??globalThis[e]])),o=n?.evaluate(Object.fromEntries(s||[]));if(!t)return o;!function(e,t,r){const i=t.split(".");for(let t=0;t<i.length-1;t++)i[t]in e||(e[i[t]]={}),e=e[i[t]];e[i[i.length-1]]=r}(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 fe extends de{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:H(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:H(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}subrenderer(){const e=(new this.constructor).debug(this.debugging);return e.set("$parent",this),e.set("$root",this.get("$root")??this),e._customElements=this._customElements,e}log(...e){this.debugging&&console.debug(...e)}async preprocessNode(t,r){r={dirpath:this.dirpath,maxdepth:10,...r};const i=new e(O(t,this._skipNodes)).map((async e=>{this.log("Preprocessing node:\n",B(e,128)),await V.resolveIncludes.call(this,e,r),await V.rebaseRelativePaths.call(this,e,r),await V.registerCustomElements.call(this,e,r),await V.resolveCustomElements.call(this,e,r)}));return await Promise.all(i.generator()),t}async renderNode(e,t){for(const r of O(e,this._skipNodes))this.log("Rendering node:\n",B(r,128)),await V.resolveForAttribute.call(this,r,t),await V.resolveDataAttribute.call(this,r,t),await V.resolveTextAttributes.call(this,r,t),await V.resolveHtmlAttribute.call(this,r,t),await V.resolveShowAttribute.call(this,r,t),await V.resolveClassAttribute.call(this,r,t),await V.resolveBindAttribute.call(this,r,t),await V.resolveEventAttributes.call(this,r,t),await V.resolveTextNodeExpressions.call(this,r,t),await V.resolveCustomAttribute.call(this,r,t),await V.resolveCustomProperty.call(this,r,t);return e}async mount(e,t){t={...t,rootNode:e},await this.preprocessNode(e,t),await this.renderNode(e,t),L(e,"renderer",this)}}function me(){return p([A`html{`,A`max-width: 70ch;`,A`padding: 2em 1em;`,A`margin: auto;`,A`line-height: 1.75;`,A`font-size: 1.25em;`,A`font-family: sans-serif;`,A`}`,A`h1,h2,h3,h4,h5,h6{`,A`margin: 1em 0 0.5em;`,A`}`,A`p,ul,ol{`,A`margin-bottom: 1em;`,A`color: #1d1d1d;`,A`}`].map(d).join(""))}const _e={sm:640,md:768,lg:1024,xl:1280},ge=.25,$e=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],ve=[...$e,16,20,24,25,28,30,32,36,40,44,48,50,52,56,60,64,72,80,96,100,112,128,144,160,192,200,224,256,288,300,320,384,400,448,500,512,...Object.values(_e)],xe=[1,2,5,10,20,25,30,40,50,60,70,75,80,90,95,98,99,100],we=[75,100,150,200,300,500,700,1e3],be=["hover","focus","disabled","active"],Ee={margin:"m",padding:"p"},ye={width:"w",height:"h"},Ae={top:"top",right:"right",bottom:"bottom",left:"left"},Re={"min-width":"min-w","min-height":"min-h","max-width":"max-w","max-height":"max-h"},Oe={"font-mono":{"font-family":"monospace"},"font-sans":{"font-family":"sans-serif"},"font-serif":{"font-family":"serif"},"font-cursive":{"font-family":"cursive"},"text-xs":{"font-size":".75rem","line-height":"calc(1 / 0.75)"},"text-sm":{"font-size":".875rem","line-height":"calc(1.25 / 0.875)"},"text-base":{"font-size":"1rem","line-height":"calc(1.5 / 1)"},"text-lg":{"font-size":"1.125rem","line-height":"calc(1.75 / 1.125)"},"text-xl":{"font-size":"1.25rem","line-height":"calc(1.75 / 1.25)"},"text-2xl":{"font-size":"1.5rem","line-height":"calc(2 / 1.5)"},"text-3xl":{"font-size":"1.875rem","line-height":"calc(2.25 / 1.875)"},"text-4xl":{"font-size":"2.25rem","line-height":"calc(2.5 / 2.25)"},"text-5xl":{"font-size":"3rem","line-height":"1"},"text-6xl":{"font-size":"3.75rem","line-height":"1"},"text-7xl":{"font-size":"4.5rem","line-height":"1"},"font-thin":{"font-weight":100},"font-extralight":{"font-weight":200},"font-light":{"font-weight":300},"font-normal":{"font-weight":400},"font-medium":{"font-weight":500},"font-semibold":{"font-weight":600},"font-bold":{"font-weight":700},"font-extrabold":{"font-weight":800},"font-black":{"font-weight":900},italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"},"w-max":{width:"max-content"},"w-min":{width:"min-content"},"w-fit":{width:"fit-content"},"h-max":{height:"max-content"},"h-min":{height:"min-content"},"h-fit":{height:"fit-content"},"tracking-tighter":{"letter-spacing":"-0.05em"},"tracking-tight":{"letter-spacing":"-0.025em"},"tracking-normal":{"letter-spacing":"0"},"tracking-wide":{"letter-spacing":"0.025em"},"tracking-wider":{"letter-spacing":"0.05em"},"tracking-widest":{"letter-spacing":"0.1em"},"leading-none":{"line-height":"1"},"leading-tight":{"line-height":"1.25"},"leading-snug":{"line-height":"1.375"},"leading-normal":{"line-height":"1.5"},"leading-relaxed":{"line-height":"1.625"},"leading-loose":{"line-height":"2"},"text-left":{"text-align":"left"},"text-right":{"text-align":"right"},"text-center":{"text-align":"center"},"text-justify":{"text-align":"justify"},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"},truncate:{"white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"},"text-elipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"},"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"},"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"},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-x-hidden":{"overflow-x":"hidden"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-visible":{overflow:"visible"},"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"},"z-auto":{"z-index":"auto"},"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-none":{border:"none"},"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-collapse":{"border-collapse":"collapse"},"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"},shadow:{"box-shadow":"0 0 1px 0 rgba(0, 0, 0, 0.05)"},"shadow-sm":{"box-shadow":"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},"shadow-md":{"box-shadow":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},"shadow-lg":{"box-shadow":"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},"shadow-xl":{"box-shadow":"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"},"shadow-2xl":{"box-shadow":"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},"shadow-inner":{"box-shadow":"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},"shadow-outline":{"box-shadow":"0 0 0 3px rgba(66, 153, 225, 0.5)"},"shadow-none":{"box-shadow":"none"},"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"}},Ie=["@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 }"],Ne={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 ke(e){return`#${e.toString(16).padStart(6,"0")}`}function Te(e){return be.map((t=>`.${t}\\:${e}:${t}`))}function Pe(e,t){return Object.entries(_e).map((([r,i])=>`@media (min-width: ${i}px) { .${r}\\:${e} { ${t} } }`))}function Se(e,t){return e.includes("@media")&&!t.includes("@media")?1:!e.includes("@media")&&t.includes("@media")?-1:e.localeCompare(t)}function Ce(e){return Object.entries(e).flatMap((([e,t])=>[[`${t}-0`,`${e}: 0`],[`${t}-screen`,`${e}: 100vw`],[`${t}-full`,`${e}: 100%`],...ve.map((r=>[`${t}-${r}`,`${e}: ${r*ge}rem`])),...ve.map((r=>[`-${t}-${r}`,`${e}: -${r*ge}rem`])),...ve.map((r=>[`${t}-${r}px`,`${e}: ${r}px`])),...ve.map((r=>[`-${t}-${r}px`,`${e}: -${r}px`])),...xe.map((r=>[`${t}-${r}\\%`,`${e}: ${r}%`])),...xe.map((r=>[`-${t}-${r}\\%`,`${e}: -${r}%`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))}function Le(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;`],...ve.map((e=>[e,e*ge])).map((([r,i])=>[`${t}x-${r}`,`${e}-left: ${i}rem; ${e}-right: ${i}rem;`])),...ve.map((e=>[e,e*ge])).map((([r,i])=>[`${t}y-${r}`,`${e}-top: ${i}rem; ${e}-bottom: ${i}rem;`])),...ve.map((r=>[`${t}x-${r}px`,`${e}-left: ${r}px; ${e}-right: ${r}px;`])),...ve.map((r=>[`${t}y-${r}px`,`${e}-top: ${r}px; ${e}-bottom: ${r}px;`])),...xe.map((r=>[`${t}x-${r}\\%`,`${e}-left: ${r}%; ${e}-right: ${r}%;`])),...xe.map((r=>[`${t}y-${r}\\%`,`${e}-top: ${r}%; ${e}-bottom: ${r}%;`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))}function De(){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(Ne).flatMap((([e,t])=>[[`text-${e}`,`color: ${ke(t[500])}`],[`fill-${e}`,`fill: ${ke(t[500])}`],[`bg-${e}`,`background-color: ${ke(t[500])}`],[`border-${e}`,`border-color: ${ke(t[500])}`]])),r=Object.entries(Ne).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[[`text-${e}-${t}`,`color: ${ke(r)}`],[`fill-${e}-${t}`,`fill: ${ke(r)}`],[`bg-${e}-${t}`,`background-color: ${ke(r)}`],[`border-${e}-${t}`,`border-color: ${ke(r)}`]]))));return[].concat(e).concat(t).concat(r).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))}function Me(){return[...Ie,...Object.entries(Oe).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[`.${e} { ${t}: ${r} }`,`${Te(e).join(",")} { ${t}: ${r} }`,...Pe(e,`${t}: ${r}`)])))),...De(),...[["opacity-0","opacity: 0"],...xe.map((e=>[`opacity-${e}`,"opacity: "+e/100]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...xe.map((e=>[`z-${e}`,`z-index: ${e}`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...we.map((e=>[`duration-${e}`,`transition-duration: ${e}ms`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...Ce(Ae),...Ce(ye),...Le(ye),...(e=Ee,Object.entries(e).flatMap((([e,t])=>[[`${t}t-0`,`${e}-top: 0`],[`${t}b-0`,`${e}-bottom: 0`],[`${t}l-0`,`${e}-left: 0`],[`${t}r-0`,`${e}-right: 0`],[`${t}t-auto`,`${e}-top: auto`],[`${t}b-auto`,`${e}-bottom: auto`],[`${t}l-auto`,`${e}-left: auto`],[`${t}r-auto`,`${e}-right: auto`],...["","-"].flatMap((r=>[...ve.map((e=>[e,e*ge])).map((([i,n])=>[`${r}${t}t-${i}`,`${e}-top: ${r}${n}rem`])),...ve.map((e=>[e,e*ge])).map((([i,n])=>[`${r}${t}b-${i}`,`${e}-bottom: ${r}${n}rem`])),...ve.map((e=>[e,e*ge])).map((([i,n])=>[`${r}${t}l-${i}`,`${e}-left: ${r}${n}rem`])),...ve.map((e=>[e,e*ge])).map((([i,n])=>[`${r}${t}r-${i}`,`${e}-right: ${r}${n}rem`])),...ve.map((i=>[`${r}${t}t-${i}px`,`${e}-top: ${r}${i}px`])),...ve.map((i=>[`${r}${t}b-${i}px`,`${e}-bottom: ${r}${i}px`])),...ve.map((i=>[`${r}${t}l-${i}px`,`${e}-left: ${r}${i}px`])),...ve.map((i=>[`${r}${t}r-${i}px`,`${e}-right: ${r}${i}px`])),...xe.map((i=>[`${r}${t}t-${i}\\%`,`${e}-top: ${r}${i}%`])),...xe.map((i=>[`${r}${t}b-${i}\\%`,`${e}-bottom: ${r}${i}%;`])),...xe.map((i=>[`${r}${t}l-${i}\\%`,`${e}-left: ${r}${i}%`])),...xe.map((i=>[`${r}${t}r-${i}\\%`,`${e}-right: ${r}${i}%`]))]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))),...Ce(Ee),...Le(Ee),...[["space-x-0 > *","margin-left: 0"],["space-y-0 > *","margin-top: 0"],...ve.map((e=>[`space-x-${e} > :not(:first-child)`,`margin-left: ${e*ge}rem`])),...ve.map((e=>[`space-y-${e} > :not(:first-child)`,`margin-top: ${e*ge}rem`])),...ve.map((e=>[`space-x-${e}px > :not(:first-child)`,`margin-left: ${e}px`])),...ve.map((e=>[`space-y-${e}px > :not(:first-child)`,`margin-top: ${e}px`])),["gap-0","gap: 0"],...ve.map((e=>[`gap-${e}`,`gap: ${e*ge}rem`])),...ve.map((e=>[`gap-${e}px`,`gap: ${e}px`])),...ve.map((e=>[`gap-x-${e}`,`column-gap: ${e*ge}rem`])),...ve.map((e=>[`gap-y-${e}`,`row-gap: ${e*ge}rem`])),...ve.map((e=>[`gap-x-${e}px`,`column-gap: ${e}px`])),...ve.map((e=>[`gap-y-${e}px`,`row-gap: ${e}px`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...Ce(Re),...[["border","border: 1px"],["border-x","border-inline-width: 1px"],["border-y","border-block-width: 1px"],...[0,...$e].map((e=>[`border-${e}`,`border-width: ${e}px`])),...[0,...$e].map((e=>[`border-x-${e}`,`border-inline-width: ${e}px;`])),...[0,...$e].map((e=>[`border-y-${e}`,`border-block-width: ${e}px;`])),...["top","bottom","left","right"].flatMap((e=>[[`border-${e.slice(0,1)}`,`border-${e}: 1px`],...[0,...$e].map((t=>[`border-${e.slice(0,1)}-${t}`,`border-${e}-width: ${t}px`]))]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...Array.from({length:100},((e,t)=>t)).map((e=>[`text-${e}px`,`font-size: ${e}px`])),...Array.from({length:100},((e,t)=>t*ge)).map((e=>[`text-${e}rem`,`font-size: ${e}rem`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Te(e).join(",")} { ${t} }`,...Pe(e,t)]))].sort(Se).join("\n");var e}class Ue extends fe{impl="browser";dirpath=H(globalThis.location?.href??"http://localhost/");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}}const ze=new Ue;export{ze as Mancha,Ue as Renderer,me as basicCssRules,Me as utilsCssRules};
package/dist/mancha.js CHANGED
@@ -1 +1 @@
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 l(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 c{}class h extends c{constructor(e,t){super(),n(),this.privateDoNotAccessOrElseWrappedStyleSheet=e}toString(){return this.privateDoNotAccessOrElseWrappedStyleSheet}}function u(e){return new h(e,i)}function d(e){if(e instanceof h)return e.privateDoNotAccessOrElseWrappedStyleSheet;throw new Error("")}function p(e,t){e.textContent=d(t)}Error;class f{iterable;constructor(e){this.iterable=e}filter(e){return new f(f.filterGenerator(e,this.iterable))}map(e){return new f(f.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 m(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function _(e){return-1===e.toString().indexOf("`")}_((e=>e``))||_((e=>e`\0`))||_((e=>e`\n`))||_((e=>e`\u0000`)),m``&&m`\0`&&m`\n`&&m`\u0000`;function g(e){const t=e[0].toLowerCase();return new o(i,t)}var $,v;function x(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 b{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:v.KEEP};const i=this.globalAttributePolicies.get(e);return i||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some((t=>0===e.indexOf(t)))?{policyAction:v.KEEP}:{policyAction:v.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"}(v||(v={}));new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const w=["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"],E=[["A",new Map([["href",{policyAction:v.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:v.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:v.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:v.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:v.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:v.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:v.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:v.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:v.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"],A=[["dir",{policyAction:v.KEEP_AND_NORMALIZE,conditions:x((()=>new Map([["dir",new Set(["auto","ltr","rtl"])]])))}],["async",{policyAction:v.KEEP_AND_NORMALIZE,conditions:x((()=>new Map([["async",new Set(["async"])]])))}],["cite",{policyAction:v.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:v.KEEP_AND_NORMALIZE,conditions:x((()=>new Map([["loading",new Set(["eager","lazy"])]])))}],["poster",{policyAction:v.KEEP_AND_SANITIZE_URL}],["target",{policyAction:v.KEEP_AND_NORMALIZE,conditions:x((()=>new Map([["target",new Set(["_self","_blank"])]])))}]];new b(new Set(w),new Map(E),new Set(y),new Map(A)),new b(new Set(x((()=>w.concat(["STYLE"])))),new Map(E),new Set(x((()=>y.concat(["id","name","class"])))),new Map(x((()=>A.concat([["style",{policyAction:v.KEEP_AND_SANITIZE_STYLE}]])))));function O(e){return u(e[0])}const R=[g`:`,g`style`,g`class`];function*I(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 N(e,t){return void 0!==e?.[t]}function T(e,t){return"function"==typeof e?.[t]}function k(e){return e.replace(/-./g,(e=>e[1].toUpperCase()))}function S(e,t){return N(e,"attribs")?e.attribs?.[t]??null:e.getAttribute?.(t)??null}function P(e,t,r=""){return S(e,r+t)||(e.dataset?.[k(t)]??null)}function C(e,t,r){N(e,"attribs")?e.attribs[t]=r:e.setAttribute?.(t,r)}function L(e,t,r){N(e,"attribs")?e.attribs[t]=r:l(R,e,t,r)}function D(e,t,r){switch(t){case"disabled":return void(e.disabled=r);case"selected":return void(e.selected=r);case"checked":return void(e.checked=r);default:e[t]=r}}function M(e,t){N(e,"attribs")?delete e.attribs[t]:e.removeAttribute?.(t)}function U(e,t,r=""){M(e,`${r}${t}`),M(e,`data-${t}`)}function z(e,t,r){if(N(e,"attribs")&&N(t,"attribs"))t.attribs[r]=e.attribs[r];else if(r.startsWith("data-")){const i=k(r.slice(5));t.dataset[i]=e.dataset?.[i]}else{const i=e?.getAttribute?.(r);L(t,r,i||"")}}function j(e){if(N(e,"firstElementChild"))return e.firstElementChild;return Array.from(e.children).find((e=>1===e.nodeType))}function F(e,...t){if(T(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 G(e,...t){T(e,"replaceChildren")?e.replaceChildren(...t):(e.childNodes=t,t.forEach((t=>t.parentNode=e)))}function K(e,t){return T(t,"appendChild")?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,t)}function W(e,t){return T(t,"removeChild")?e.removeChild(t):(G(e,...Array.from(e.childNodes).filter((e=>e!==t))),t)}function Y(e,t,r){return r?T(e,"insertBefore")?e.insertBefore(t,r):(F(r,t,r),t):K(e,t)}function B(e,t=0){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function H(e,t=0){return globalThis.DocumentFragment&&e instanceof DocumentFragment?Array.from(e.childNodes).map((e=>H(e,t))).join(""):B(e.outerHTML||e.nodeValue||String(e),t)}function V(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):""}var Z;!function(e){e.resolveIncludes=async function(e,t){const r=e,i=r.tagName?.toLowerCase();if(!["include","link"].includes(i))return;if("link"===i&&"subresource"!==S(r,"rel"))return;this.log("include directive found in:\n",H(e,128)),this.log("include params:",t);const n="link"===r.tagName.toLocaleLowerCase()?"href":"src",s=S(r,n);if(!s)throw new Error(`"${n}" attribute missing from ${H(e,128)}.`);const o=[];"include"===i&&o.push("src"),"link"===i&&o.push("rel","href");const a=t=>{const i=j(t);for(const e of Array.from(r.attributes))i&&!o.includes(e.name)&&z(r,i,e.name);F(e,...t.childNodes)},l={...t,rootDocument:!1,maxdepth:t?.maxdepth-1};if(0===l.maxdepth)throw new Error("Maximum recursion depth reached.");if(s.includes("://")||s.startsWith("//"))this.log("Including remote file from absolute path:",s),await this.preprocessRemote(s,l).then(a);else if(t?.dirpath?.includes("://")||t?.dirpath?.startsWith("//")){const e=s.startsWith("/")?s:`${t.dirpath}/${s}`;this.log("Including remote file from relative path:",e),await this.preprocessRemote(e,l).then(a)}else if("/"===s.charAt(0))this.log("Including local file from absolute path:",s),await this.preprocessLocal(s,l).then(a);else{const e=t?.dirpath&&"."!==t?.dirpath?`${t?.dirpath}/${s}`:s;this.log("Including local file from relative path:",e),await this.preprocessLocal(e,l).then(a)}},e.rebaseRelativePaths=async function(e,t){const i=e,n=i.tagName?.toLowerCase();if(!t?.dirpath)return;const s=S(i,"src"),o=S(i,"href"),a=s||o;if(!a||((l=a).includes("://")||l.startsWith("/")||l.startsWith("#")||l.startsWith("data:")))return;var l;const c=`${t.dirpath}/${a}`;this.log("Rebasing relative path as:",c),N(i,"attribs")?L(i,s?"src":"href",c):"img"===n?i.src=c:"a"===n?function(e,t){const i=r(t);void 0!==i&&(e.href=i)}(i,c):"source"===n||"audio"===n||"video"===n||"track"===n||"input"===n?i.src=c:"area"===n?function(e,t){const i=r(t);void 0!==i&&(e.href=i)}(i,c):this.log("Unable to rebase relative path for element:",n)},e.registerCustomElements=async function(e,t){const r=e,i=r.tagName?.toLowerCase(),n=(S(r,"is")||S(r,"alt"))?.toLowerCase();if(["template","div"].includes(i)&&n){if("div"===i&&"template"!==S(r,"role"))return;this._customElements.has(n)||(this.log(`Registering custom element: ${n}\n`,H(r,128)),this._customElements.set(n,r),W(r.parentNode,r))}},e.resolveCustomElements=async function(e,t){const r=e,i=r.tagName?.toLowerCase();let n=i;if("div"===n&&(n=S(r,"role")?.toLowerCase()||n),n&&this._customElements.has(n)){this.log(`Processing custom element: ${n}\n`,H(r,128));const t=this._customElements.get(n),s=(t.content||t).cloneNode(!0),o=j(s);if(o)for(const e of Array.from(r.attributes))"div"===i&&"role"===e.name||z(r,o,e.name);const a=new f(I(s)).find((e=>"slot"===e.tagName?.toLowerCase()));a&&F(a,...r.childNodes),F(e,...s.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",B(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=P(r,"data",":");if(i){this.log(":data attribute found in:\n",H(e,128)),U(r,"data",":");const n=t?.rootNode===e?this:this.subrenderer();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 I(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=P(r,"class",":");if(i){this.log(":class attribute found in:\n",H(e,128)),U(r,"class",":");const t=S(r,"class")||"";return this.effect((function(){const n=this.eval(i,{$elem:e});L(r,"class",(n?`${t} ${n}`:t).trim())}))}},e.resolveTextAttributes=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"text",":");if(i){this.log(":text attribute found in:\n",H(e,128)),U(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=P(r,"html",":");return i?(this.log(":html attribute found in:\n",H(e,128)),U(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),G(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||[]))if(t.name.startsWith(":on:")||t.name.startsWith("data-on-")){const i=t.name.split(":on:",2).at(-1)?.split("data-on-",2).at(-1)||"";if(!i)throw new Error(`Invalid event attribute: ${t.name}`);this.log(t.name,"attribute found in:\n",H(e,128)),M(r,t.name);const n="submit"===i&&"FORM"===r.tagName.toUpperCase();e.addEventListener?.(i,(r=>(n&&r.preventDefault(),this.eval(t.value,{$elem:e,$event:r}))))}},e.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"for",":")?.trim();if(i){this.log(":for attribute found in:\n",H(e,128)),U(r,"for",":");for(const t of I(e,this._skipNodes))this._skipNodes.add(t);const n=e.parentNode,s=this.createElement("template",e.ownerDocument);Y(n,s,e),W(n,e),K(s,e),this.log(":for template:\n",H(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=[],[l,c]=o;await this.effect((function(){const r=this.eval(c,{$elem:e});if(this.log(":for list items:",r),a.splice(0,a.length).forEach((e=>{W(n,e),this._skipNodes.delete(e)})),!Array.isArray(r))return console.error(`Expression did not yield a list: \`${c}\` => \`${r}\``),Promise.resolve();const i=[];for(const n of r){const r=this.subrenderer();r.set(l,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",H(s,128))}const o=s.nextSibling;for(const e of a)Y(n,e,o);return Promise.all(i)}))}},e.resolveBindAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"bind",":");if(i){this.log(":bind attribute found in:\n",H(e,128));const t=["change","input"],n=S(r,":bind:on")?.split(",")||r.dataset?.bindOn?.split(",")||t;U(r,"bind",":"),M(r,":bind:on"),M(r,"data-bind-on");const s="checkbox"===S(r,"type")?"checked":"value";this.effect((function(){const t=this.eval(i,{$elem:e});"checked"===s?r.checked=!!t:r.value=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=P(r,"show",":");if(i){this.log(":show attribute found in:\n",H(e,128)),U(r,"show",":");const t="none"===r.style?.display?"":r.style?.display??S(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":L(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||[])){const i=":attr:",n="data-attr-";if(t.name.startsWith(i)||t.name.startsWith(n)){this.log(t.name,"attribute found in:\n",H(e,128)),M(r,t.name);const s=t.name.split(i,2).at(-1)?.split(n,2).at(-1);this.effect((function(){const i=this.eval(t.value,{$elem:e});C(r,s,i)}))}}},e.resolveCustomProperty=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[])){const i=":prop:",n="data-prop-";if(t.name.startsWith(i)||t.name.startsWith(n)){this.log(t.name,"property found in:\n",H(e,128)),M(r,t.name);const s=t.name.split(i,2).at(-1)?.split(n,2).at(-1),o=k(s);this.effect((function(){const i=this.eval(t.value,{$elem:e});D(r,o,i)}))}}}}(Z||(Z={}));const q=["this"],Q=["+","-","!"],X=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],J={"!":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},ee=["==","!=","<=",">=","||","&&","??","|>"],te=["===","!=="];var re;!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"}(re||(re={}));const ie=(e,t,r=0)=>({kind:e,value:t,precedence:r}),ne=e=>95===e||36===e||65<=(e&=-33)&&e<=90,se=e=>48<=e&&e<=57;class oe{_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(ne(this._next))return this._tokenizeIdentOrKeyword();if(se(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=ie(re.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,ne(e)||se(e));var e;const t=this._getValue(),r=(i=t,-1!==q.indexOf(i)?re.KEYWORD:re.IDENTIFIER);var i;return ie(r,t)}_tokenizeNumber(){do{this._advance()}while(se(this._next));return 46===this._next?this._tokenizeDot():ie(re.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),se(this._next)?this._tokenizeFraction():(this._clearValue(),ie(re.DOT,".",13))}_tokenizeComma(){return this._advance(!0),ie(re.COMMA,",")}_tokenizeColon(){return this._advance(!0),ie(re.COLON,":")}_tokenizeFraction(){do{this._advance()}while(se(this._next));return ie(re.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(-1!==te.indexOf(e))this._advance(),this._advance();else{if(e=this._getValue(1),"=>"===e)return this._advance(),ie(re.ARROW,e);-1!==ee.indexOf(e)&&this._advance()}return e=this._getValue(),ie(re.OPERATOR,e,J[e])}_tokenizeGrouper(){const e=String.fromCharCode(this._next),t=ie(re.GROUPER,e,J[e]);return this._advance(!0),t}}class ae{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new oe(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(re.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(re.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(re.DOT)){this._advance();const t=this._parseUnary();e=this._makeInvokeOrGetter(e,t)}else{if(this._matches(re.KEYWORD))break;if(!(this._matches(re.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===X.indexOf(t.value))throw new Error(`unknown operator: ${t.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===re.OPERATOR||this._kind===re.DOT||this._kind===re.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(re.OPERATOR)){const e=this._value;if(this._advance(),"+"===e||"-"===e){if(this._matches(re.INTEGER))return this._parseInteger(e);if(this._matches(re.DECIMAL))return this._parseDecimal(e)}if(-1===Q.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(re.OPERATOR,"?");const t=this._parseExpression();this._advance(re.COLON);const r=this._parseExpression();return this._ast.ternary(e,t,r)}_parsePrimary(){switch(this._kind){case re.KEYWORD:const e=this._value;if("this"===e)return this._advance(),this._ast.id(e);if(-1!==q.indexOf(e))throw new Error(`unexpected keyword: ${e}`);throw new Error(`unrecognized keyword: ${e}`);case re.IDENTIFIER:return this._parseInvokeOrIdentifier();case re.STRING:return this._parseString();case re.INTEGER:return this._parseInteger();case re.DECIMAL:return this._parseDecimal();case re.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case re.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const e=[];do{if(this._advance(),this._matches(re.GROUPER,"]"))break;e.push(this._parseExpression())}while(this._matches(re.COMMA));return this._advance(re.GROUPER,"]"),this._ast.list(e)}_parseMap(){const e={};do{if(this._advance(),this._matches(re.GROUPER,"}"))break;const t=this._value;(this._matches(re.STRING)||this._matches(re.IDENTIFIER))&&this._advance(),this._advance(re.COLON),e[t]=this._parseExpression()}while(this._matches(re.COMMA));return this._advance(re.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(re.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(re.GROUPER,"("))return;const e=[];do{if(this._advance(),this._matches(re.GROUPER,")"))break;const t=this._parseExpression();e.push(t)}while(this._matches(re.COMMA));return this._advance(re.GROUPER,")"),e}_parseIndex(){this._advance();const e=this._parseExpression();return this._advance(re.GROUPER,"]"),e}_parseParenOrFunction(){const e=this._parseArguments();if(this._matches(re.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 le={"+":(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)},ce={"+":e=>e,"-":e=>-e,"!":e=>!e};class he{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 ue=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=ce[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=le[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)))}}}};function de(e,t){if(e.has(t))return e.get(t);if(e.has("$parent")){return de(e.get("$parent"),t)}return null}function pe(e,t){if(e.has(t))return e;if(e.has("$parent")){return pe(e.get("$parent"),t)}return null}class fe extends he{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 fe||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),de(this.store,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)),function(e,t,r){const i=pe(e,t);i?i.set(t,r):e.set(t,r)}(this.store,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&&pe(this.store,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 ae(e,t).parse())(e,ue),s=n?.getIds([])?.map((e=>[e,i[e]??r[e]??globalThis[e]])),o=n?.evaluate(Object.fromEntries(s||[]));if(!t)return o;!function(e,t,r){const i=t.split(".");for(let t=0;t<i.length-1;t++)i[t]in e||(e[i[t]]={}),e=e[i[t]];e[i[i.length-1]]=r}(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 me extends fe{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:V(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:V(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}subrenderer(){const e=(new this.constructor).debug(this.debugging);return e.set("$parent",this),e.set("$root",this.get("$root")??this),e._customElements=this._customElements,e}log(...e){this.debugging&&console.debug(...e)}async preprocessNode(e,t){t={dirpath:this.dirpath,maxdepth:10,...t};const r=new f(I(e,this._skipNodes)).map((async e=>{this.log("Preprocessing node:\n",H(e,128)),await Z.resolveIncludes.call(this,e,t),await Z.rebaseRelativePaths.call(this,e,t),await Z.registerCustomElements.call(this,e,t),await Z.resolveCustomElements.call(this,e,t)}));return await Promise.all(r.generator()),e}async renderNode(e,t){for(const r of I(e,this._skipNodes))this.log("Rendering node:\n",H(r,128)),await Z.resolveForAttribute.call(this,r,t),await Z.resolveDataAttribute.call(this,r,t),await Z.resolveTextAttributes.call(this,r,t),await Z.resolveHtmlAttribute.call(this,r,t),await Z.resolveShowAttribute.call(this,r,t),await Z.resolveClassAttribute.call(this,r,t),await Z.resolveBindAttribute.call(this,r,t),await Z.resolveEventAttributes.call(this,r,t),await Z.resolveTextNodeExpressions.call(this,r,t),await Z.resolveCustomAttribute.call(this,r,t),await Z.resolveCustomProperty.call(this,r,t);return e}async mount(e,t){t={...t,rootNode:e},await this.preprocessNode(e,t),await this.renderNode(e,t),D(e,"renderer",this)}}function _e(){return u([O`html{`,O`max-width: 70ch;`,O`padding: 2em 1em;`,O`margin: auto;`,O`line-height: 1.75;`,O`font-size: 1.25em;`,O`font-family: sans-serif;`,O`}`,O`h1,h2,h3,h4,h5,h6{`,O`margin: 1em 0 0.5em;`,O`}`,O`p,ul,ol{`,O`margin-bottom: 1em;`,O`color: #1d1d1d;`,O`}`].map(d).join(""))}const ge={sm:640,md:768,lg:1024,xl:1280},$e=.25,ve=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],xe=[...ve,16,20,24,25,28,30,32,36,40,44,48,50,52,56,60,64,72,80,96,100,112,128,144,160,192,200,224,256,288,300,320,384,400,448,500,512,...Object.values(ge)],be=[1,2,5,10,20,25,30,40,50,60,70,75,80,90,95,98,99,100],we=[75,100,150,200,300,500,700,1e3],Ee=["hover","focus","disabled","active"],ye={margin:"m",padding:"p"},Ae={width:"w",height:"h"},Oe={top:"top",right:"right",bottom:"bottom",left:"left"},Re={"min-width":"min-w","min-height":"min-h","max-width":"max-w","max-height":"max-h"},Ie={"font-mono":{"font-family":"monospace"},"font-sans":{"font-family":"sans-serif"},"font-serif":{"font-family":"serif"},"font-cursive":{"font-family":"cursive"},"text-xs":{"font-size":".75rem","line-height":"calc(1 / 0.75)"},"text-sm":{"font-size":".875rem","line-height":"calc(1.25 / 0.875)"},"text-base":{"font-size":"1rem","line-height":"calc(1.5 / 1)"},"text-lg":{"font-size":"1.125rem","line-height":"calc(1.75 / 1.125)"},"text-xl":{"font-size":"1.25rem","line-height":"calc(1.75 / 1.25)"},"text-2xl":{"font-size":"1.5rem","line-height":"calc(2 / 1.5)"},"text-3xl":{"font-size":"1.875rem","line-height":"calc(2.25 / 1.875)"},"text-4xl":{"font-size":"2.25rem","line-height":"calc(2.5 / 2.25)"},"text-5xl":{"font-size":"3rem","line-height":"1"},"text-6xl":{"font-size":"3.75rem","line-height":"1"},"text-7xl":{"font-size":"4.5rem","line-height":"1"},"font-thin":{"font-weight":100},"font-extralight":{"font-weight":200},"font-light":{"font-weight":300},"font-normal":{"font-weight":400},"font-medium":{"font-weight":500},"font-semibold":{"font-weight":600},"font-bold":{"font-weight":700},"font-extrabold":{"font-weight":800},"font-black":{"font-weight":900},italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"},"w-max":{width:"max-content"},"w-min":{width:"min-content"},"w-fit":{width:"fit-content"},"h-max":{height:"max-content"},"h-min":{height:"min-content"},"h-fit":{height:"fit-content"},"tracking-tighter":{"letter-spacing":"-0.05em"},"tracking-tight":{"letter-spacing":"-0.025em"},"tracking-normal":{"letter-spacing":"0"},"tracking-wide":{"letter-spacing":"0.025em"},"tracking-wider":{"letter-spacing":"0.05em"},"tracking-widest":{"letter-spacing":"0.1em"},"leading-none":{"line-height":"1"},"leading-tight":{"line-height":"1.25"},"leading-snug":{"line-height":"1.375"},"leading-normal":{"line-height":"1.5"},"leading-relaxed":{"line-height":"1.625"},"leading-loose":{"line-height":"2"},"text-left":{"text-align":"left"},"text-right":{"text-align":"right"},"text-center":{"text-align":"center"},"text-justify":{"text-align":"justify"},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"},truncate:{"white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"},"text-elipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"},"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"},"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"},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-x-hidden":{"overflow-x":"hidden"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-visible":{overflow:"visible"},"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"},"z-auto":{"z-index":"auto"},"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-none":{border:"none"},"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-collapse":{"border-collapse":"collapse"},"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"},shadow:{"box-shadow":"0 0 1px 0 rgba(0, 0, 0, 0.05)"},"shadow-sm":{"box-shadow":"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},"shadow-md":{"box-shadow":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},"shadow-lg":{"box-shadow":"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},"shadow-xl":{"box-shadow":"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"},"shadow-2xl":{"box-shadow":"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},"shadow-inner":{"box-shadow":"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},"shadow-outline":{"box-shadow":"0 0 0 3px rgba(66, 153, 225, 0.5)"},"shadow-none":{"box-shadow":"none"},"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"}},Ne=["@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 }"],Te={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 ke(e){return`#${e.toString(16).padStart(6,"0")}`}function Se(e){return Ee.map((t=>`.${t}\\:${e}:${t}`))}function Pe(e,t){return Object.entries(ge).map((([r,i])=>`@media (min-width: ${i}px) { .${r}\\:${e} { ${t} } }`))}function Ce(e,t){return e.includes("@media")&&!t.includes("@media")?1:!e.includes("@media")&&t.includes("@media")?-1:e.localeCompare(t)}function Le(e){return Object.entries(e).flatMap((([e,t])=>[[`${t}-0`,`${e}: 0`],[`${t}-screen`,`${e}: 100vw`],[`${t}-full`,`${e}: 100%`],...xe.map((r=>[`${t}-${r}`,`${e}: ${r*$e}rem`])),...xe.map((r=>[`-${t}-${r}`,`${e}: -${r*$e}rem`])),...xe.map((r=>[`${t}-${r}px`,`${e}: ${r}px`])),...xe.map((r=>[`-${t}-${r}px`,`${e}: -${r}px`])),...be.map((r=>[`${t}-${r}\\%`,`${e}: ${r}%`])),...be.map((r=>[`-${t}-${r}\\%`,`${e}: -${r}%`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))}function De(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;`],...xe.map((e=>[e,e*$e])).map((([r,i])=>[`${t}x-${r}`,`${e}-left: ${i}rem; ${e}-right: ${i}rem;`])),...xe.map((e=>[e,e*$e])).map((([r,i])=>[`${t}y-${r}`,`${e}-top: ${i}rem; ${e}-bottom: ${i}rem;`])),...xe.map((r=>[`${t}x-${r}px`,`${e}-left: ${r}px; ${e}-right: ${r}px;`])),...xe.map((r=>[`${t}y-${r}px`,`${e}-top: ${r}px; ${e}-bottom: ${r}px;`])),...be.map((r=>[`${t}x-${r}\\%`,`${e}-left: ${r}%; ${e}-right: ${r}%;`])),...be.map((r=>[`${t}y-${r}\\%`,`${e}-top: ${r}%; ${e}-bottom: ${r}%;`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))}function Me(){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(Te).flatMap((([e,t])=>[[`text-${e}`,`color: ${ke(t[500])}`],[`fill-${e}`,`fill: ${ke(t[500])}`],[`bg-${e}`,`background-color: ${ke(t[500])}`],[`border-${e}`,`border-color: ${ke(t[500])}`]])),r=Object.entries(Te).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[[`text-${e}-${t}`,`color: ${ke(r)}`],[`fill-${e}-${t}`,`fill: ${ke(r)}`],[`bg-${e}-${t}`,`background-color: ${ke(r)}`],[`border-${e}-${t}`,`border-color: ${ke(r)}`]]))));return[].concat(e).concat(t).concat(r).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))}class Ue extends me{impl="browser";dirpath=V(globalThis.location?.href??"http://localhost/");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 Ue;const ze=new Ue;globalThis.Mancha=ze;const je=globalThis.document?.currentScript;if(globalThis.document?.currentScript?.hasAttribute("init")){const e=je?.hasAttribute("debug"),t=je?.getAttribute("cache"),r=je?.getAttribute("target")?.split("+")||["body"];window.addEventListener("load",(()=>{r.map((async r=>{const i=globalThis.document.querySelector(r);await ze.debug(e).mount(i,{cache:t})}))}))}if(globalThis.document?.currentScript?.hasAttribute("css")){const e=je?.getAttribute("css")?.split("+");for(const t of e){const e=document.createElement("style");switch(t){case"basic":p(e,_e());break;case"utils":e.textContent=(Fe=void 0,[...Ne,...Object.entries(Ie).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[`.${e} { ${t}: ${r} }`,`${Se(e).join(",")} { ${t}: ${r} }`,...Pe(e,`${t}: ${r}`)])))),...Me(),...[["opacity-0","opacity: 0"],...be.map((e=>[`opacity-${e}`,"opacity: "+e/100]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...be.map((e=>[`z-${e}`,`z-index: ${e}`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...we.map((e=>[`duration-${e}`,`transition-duration: ${e}ms`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...Le(Oe),...Le(Ae),...De(Ae),...(Fe=ye,Object.entries(Fe).flatMap((([e,t])=>[[`${t}t-0`,`${e}-top: 0`],[`${t}b-0`,`${e}-bottom: 0`],[`${t}l-0`,`${e}-left: 0`],[`${t}r-0`,`${e}-right: 0`],[`${t}t-auto`,`${e}-top: auto`],[`${t}b-auto`,`${e}-bottom: auto`],[`${t}l-auto`,`${e}-left: auto`],[`${t}r-auto`,`${e}-right: auto`],...["","-"].flatMap((r=>[...xe.map((e=>[e,e*$e])).map((([i,n])=>[`${r}${t}t-${i}`,`${e}-top: ${r}${n}rem`])),...xe.map((e=>[e,e*$e])).map((([i,n])=>[`${r}${t}b-${i}`,`${e}-bottom: ${r}${n}rem`])),...xe.map((e=>[e,e*$e])).map((([i,n])=>[`${r}${t}l-${i}`,`${e}-left: ${r}${n}rem`])),...xe.map((e=>[e,e*$e])).map((([i,n])=>[`${r}${t}r-${i}`,`${e}-right: ${r}${n}rem`])),...xe.map((i=>[`${r}${t}t-${i}px`,`${e}-top: ${r}${i}px`])),...xe.map((i=>[`${r}${t}b-${i}px`,`${e}-bottom: ${r}${i}px`])),...xe.map((i=>[`${r}${t}l-${i}px`,`${e}-left: ${r}${i}px`])),...xe.map((i=>[`${r}${t}r-${i}px`,`${e}-right: ${r}${i}px`])),...be.map((i=>[`${r}${t}t-${i}\\%`,`${e}-top: ${r}${i}%`])),...be.map((i=>[`${r}${t}b-${i}\\%`,`${e}-bottom: ${r}${i}%;`])),...be.map((i=>[`${r}${t}l-${i}\\%`,`${e}-left: ${r}${i}%`])),...be.map((i=>[`${r}${t}r-${i}\\%`,`${e}-right: ${r}${i}%`]))]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))),...Le(ye),...De(ye),...[["space-x-0 > *","margin-left: 0"],["space-y-0 > *","margin-top: 0"],...xe.map((e=>[`space-x-${e} > :not(:first-child)`,`margin-left: ${e*$e}rem`])),...xe.map((e=>[`space-y-${e} > :not(:first-child)`,`margin-top: ${e*$e}rem`])),...xe.map((e=>[`space-x-${e}px > :not(:first-child)`,`margin-left: ${e}px`])),...xe.map((e=>[`space-y-${e}px > :not(:first-child)`,`margin-top: ${e}px`])),["gap-0","gap: 0"],...xe.map((e=>[`gap-${e}`,`gap: ${e*$e}rem`])),...xe.map((e=>[`gap-${e}px`,`gap: ${e}px`])),...xe.map((e=>[`gap-x-${e}`,`column-gap: ${e*$e}rem`])),...xe.map((e=>[`gap-y-${e}`,`row-gap: ${e*$e}rem`])),...xe.map((e=>[`gap-x-${e}px`,`column-gap: ${e}px`])),...xe.map((e=>[`gap-y-${e}px`,`row-gap: ${e}px`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...Le(Re),...[["border","border: 1px"],["border-x","border-inline-width: 1px"],["border-y","border-block-width: 1px"],...[0,...ve].map((e=>[`border-${e}`,`border-width: ${e}px`])),...[0,...ve].map((e=>[`border-x-${e}`,`border-inline-width: ${e}px;`])),...[0,...ve].map((e=>[`border-y-${e}`,`border-block-width: ${e}px;`])),...["top","bottom","left","right"].flatMap((e=>[[`border-${e.slice(0,1)}`,`border-${e}: 1px`],...[0,...ve].map((t=>[`border-${e.slice(0,1)}-${t}`,`border-${e}-width: ${t}px`]))]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...Array.from({length:100},((e,t)=>t)).map((e=>[`text-${e}px`,`font-size: ${e}px`])),...Array.from({length:100},((e,t)=>t*$e)).map((e=>[`text-${e}rem`,`font-size: ${e}rem`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))].sort(Ce).join("\n"));break;default:console.error(`Unknown style name: "${t}"`)}globalThis.document.head.appendChild(e)}}var Fe})();
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 l(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 c{}class h extends c{constructor(e,t){super(),n(),this.privateDoNotAccessOrElseWrappedStyleSheet=e}toString(){return this.privateDoNotAccessOrElseWrappedStyleSheet}}function u(e){return new h(e,i)}function d(e){if(e instanceof h)return e.privateDoNotAccessOrElseWrappedStyleSheet;throw new Error("")}function p(e,t){e.textContent=d(t)}Error;class f{iterable;constructor(e){this.iterable=e}filter(e){return new f(f.filterGenerator(e,this.iterable))}map(e){return new f(f.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 m(e){return Object.isFrozen(e)&&Object.isFrozen(e.raw)}function _(e){return-1===e.toString().indexOf("`")}_((e=>e``))||_((e=>e`\0`))||_((e=>e`\n`))||_((e=>e`\u0000`)),m``&&m`\0`&&m`\n`&&m`\u0000`;function g(e){const t=e[0].toLowerCase();return new o(i,t)}var $,v;function x(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 b{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:v.KEEP};const i=this.globalAttributePolicies.get(e);return i||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some((t=>0===e.indexOf(t)))?{policyAction:v.KEEP}:{policyAction:v.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"}(v||(v={}));new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const w=["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"],E=[["A",new Map([["href",{policyAction:v.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:v.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:v.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:v.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:v.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:v.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:v.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:v.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:v.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"],A=[["dir",{policyAction:v.KEEP_AND_NORMALIZE,conditions:x((()=>new Map([["dir",new Set(["auto","ltr","rtl"])]])))}],["async",{policyAction:v.KEEP_AND_NORMALIZE,conditions:x((()=>new Map([["async",new Set(["async"])]])))}],["cite",{policyAction:v.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:v.KEEP_AND_NORMALIZE,conditions:x((()=>new Map([["loading",new Set(["eager","lazy"])]])))}],["poster",{policyAction:v.KEEP_AND_SANITIZE_URL}],["target",{policyAction:v.KEEP_AND_NORMALIZE,conditions:x((()=>new Map([["target",new Set(["_self","_blank"])]])))}]];new b(new Set(w),new Map(E),new Set(y),new Map(A)),new b(new Set(x((()=>w.concat(["STYLE"])))),new Map(E),new Set(x((()=>y.concat(["id","name","class"])))),new Map(x((()=>A.concat([["style",{policyAction:v.KEEP_AND_SANITIZE_STYLE}]])))));function O(e){return u(e[0])}const R=[g`:`,g`style`,g`class`];function*I(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 N(e,t){return void 0!==e?.[t]}function T(e,t){return"function"==typeof e?.[t]}function k(e){return e.replace(/-./g,(e=>e[1].toUpperCase()))}function S(e,t){return N(e,"attribs")?e.attribs?.[t]??null:e.getAttribute?.(t)??null}function P(e,t,r=""){return S(e,r+t)||(e.dataset?.[k(t)]??null)}function C(e,t,r){N(e,"attribs")?e.attribs[t]=r:e.setAttribute?.(t,r)}function L(e,t,r){N(e,"attribs")?e.attribs[t]=r:l(R,e,t,r)}function D(e,t,r){switch(t){case"disabled":return void(e.disabled=r);case"selected":return void(e.selected=r);case"checked":return void(e.checked=r);default:e[t]=r}}function M(e,t){N(e,"attribs")?delete e.attribs[t]:e.removeAttribute?.(t)}function U(e,t,r=""){M(e,`${r}${t}`),M(e,`data-${t}`)}function z(e,t,r){if(N(e,"attribs")&&N(t,"attribs"))t.attribs[r]=e.attribs[r];else if(r.startsWith("data-")){const i=k(r.slice(5));t.dataset[i]=e.dataset?.[i]}else{const i=e?.getAttribute?.(r);L(t,r,i||"")}}function j(e){if(N(e,"firstElementChild"))return e.firstElementChild;return Array.from(e.children).find((e=>1===e.nodeType))}function F(e,...t){if(T(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 G(e,...t){T(e,"replaceChildren")?e.replaceChildren(...t):(e.childNodes=t,t.forEach((t=>t.parentNode=e)))}function K(e,t){return T(t,"appendChild")?e.appendChild(t):(e.childNodes.push(t),t.parentNode=e,t)}function W(e,t){return T(t,"removeChild")?e.removeChild(t):(G(e,...Array.from(e.childNodes).filter((e=>e!==t))),t)}function Y(e,t,r){return r?T(e,"insertBefore")?e.insertBefore(t,r):(F(r,t,r),t):K(e,t)}function B(e,t=0){return e?e.length<=t?e:e.slice(0,t-1)+"…":""}function H(e,t=0){return globalThis.DocumentFragment&&e instanceof DocumentFragment?Array.from(e.childNodes).map((e=>H(e,t))).join(""):B(e.outerHTML||e.nodeValue||String(e),t)}function V(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):""}var Z;!function(e){e.resolveIncludes=async function(e,t){const r=e,i=r.tagName?.toLowerCase();if(!["include","link"].includes(i))return;if("link"===i&&"subresource"!==S(r,"rel"))return;this.log("include directive found in:\n",H(e,128)),this.log("include params:",t);const n="link"===r.tagName.toLocaleLowerCase()?"href":"src",s=S(r,n);if(!s)throw new Error(`"${n}" attribute missing from ${H(e,128)}.`);const o=[];"include"===i&&o.push("src"),"link"===i&&o.push("rel","href");const a=t=>{const i=j(t);for(const e of Array.from(r.attributes))i&&!o.includes(e.name)&&z(r,i,e.name);F(e,...t.childNodes)},l={...t,rootDocument:!1,maxdepth:t?.maxdepth-1};if(0===l.maxdepth)throw new Error("Maximum recursion depth reached.");if(s.includes("://")||s.startsWith("//"))this.log("Including remote file from absolute path:",s),await this.preprocessRemote(s,l).then(a);else if(t?.dirpath?.includes("://")||t?.dirpath?.startsWith("//")){const e=s.startsWith("/")?s:`${t.dirpath}/${s}`;this.log("Including remote file from relative path:",e),await this.preprocessRemote(e,l).then(a)}else if("/"===s.charAt(0))this.log("Including local file from absolute path:",s),await this.preprocessLocal(s,l).then(a);else{const e=t?.dirpath&&"."!==t?.dirpath?`${t?.dirpath}/${s}`:s;this.log("Including local file from relative path:",e),await this.preprocessLocal(e,l).then(a)}},e.rebaseRelativePaths=async function(e,t){const i=e,n=i.tagName?.toLowerCase();if(!t?.dirpath)return;const s=S(i,"src"),o=S(i,"href"),a=s||o;if(!a||((l=a).includes("://")||l.startsWith("/")||l.startsWith("#")||l.startsWith("data:")))return;var l;const c=`${t.dirpath}/${a}`;this.log("Rebasing relative path as:",c),N(i,"attribs")?L(i,s?"src":"href",c):"img"===n?i.src=c:"a"===n?function(e,t){const i=r(t);void 0!==i&&(e.href=i)}(i,c):"source"===n||"audio"===n||"video"===n||"track"===n||"input"===n?i.src=c:"area"===n?function(e,t){const i=r(t);void 0!==i&&(e.href=i)}(i,c):this.log("Unable to rebase relative path for element:",n)},e.registerCustomElements=async function(e,t){const r=e,i=r.tagName?.toLowerCase(),n=(S(r,"is")||S(r,"alt"))?.toLowerCase();if(["template","div"].includes(i)&&n){if("div"===i&&"template"!==S(r,"role"))return;this._customElements.has(n)||(this.log(`Registering custom element: ${n}\n`,H(r,128)),this._customElements.set(n,r),W(r.parentNode,r))}},e.resolveCustomElements=async function(e,t){const r=e,i=r.tagName?.toLowerCase();let n=i;if("div"===n&&(n=S(r,"role")?.toLowerCase()||n),n&&this._customElements.has(n)){this.log(`Processing custom element: ${n}\n`,H(r,128));const t=this._customElements.get(n),s=(t.content||t).cloneNode(!0),o=j(s);if(o)for(const e of Array.from(r.attributes))"div"===i&&"role"===e.name||z(r,o,e.name);const a=new f(I(s)).find((e=>"slot"===e.tagName?.toLowerCase()));a&&F(a,...r.childNodes),F(e,...s.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",B(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=P(r,"data",":");if(i){this.log(":data attribute found in:\n",H(e,128)),U(r,"data",":");const n=t?.rootNode===e?this:this.subrenderer();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 I(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=P(r,"class",":");if(i){this.log(":class attribute found in:\n",H(e,128)),U(r,"class",":");const t=S(r,"class")||"";return this.effect((function(){const n=this.eval(i,{$elem:e});L(r,"class",(n?`${t} ${n}`:t).trim())}))}},e.resolveTextAttributes=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"text",":");if(i){this.log(":text attribute found in:\n",H(e,128)),U(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=P(r,"html",":");return i?(this.log(":html attribute found in:\n",H(e,128)),U(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),G(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||[]))if(t.name.startsWith(":on:")||t.name.startsWith("data-on-")){const i=t.name.split(":on:",2).at(-1)?.split("data-on-",2).at(-1)||"";if(!i)throw new Error(`Invalid event attribute: ${t.name}`);this.log(t.name,"attribute found in:\n",H(e,128)),M(r,t.name);const n="submit"===i&&"FORM"===r.tagName.toUpperCase();e.addEventListener?.(i,(r=>(n&&r.preventDefault(),this.eval(t.value,{$elem:e,$event:r}))))}},e.resolveForAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"for",":")?.trim();if(i){this.log(":for attribute found in:\n",H(e,128)),U(r,"for",":");for(const t of I(e,this._skipNodes))this._skipNodes.add(t);const n=S(r,"style")||"";C(r,"style","display: none;");const s=e.parentNode,o=this.createElement("template",e.ownerDocument);Y(s,o,e),W(s,e),K(o,e),this.log(":for template:\n",H(o,128));const a=i.split(" in ",2);if(2!==a.length)throw new Error(`Invalid :for format: \`${i}\`. Expected "{key} in {expression}".`);const l=[],[c,h]=a;await this.effect((function(){const r=this.eval(h,{$elem:e});if(this.log(":for list items:",r),l.splice(0,l.length).forEach((e=>{W(s,e),this._skipNodes.delete(e)})),!Array.isArray(r))return console.error(`Expression did not yield a list: \`${h}\` => \`${r}\``),Promise.resolve();const i=[];for(const s of r){const r=this.subrenderer();r.set(c,s);const o=e.cloneNode(!0);C(o,"style",n),l.push(o),this._skipNodes.add(o),i.push(r.mount(o,t)),this.log("Rendered list child:\n",H(o,128))}const a=o.nextSibling;for(const e of l)Y(s,e,a);return Promise.all(i)}))}},e.resolveBindAttribute=async function(e,t){if(this._skipNodes.has(e))return;const r=e,i=P(r,"bind",":");if(i){this.log(":bind attribute found in:\n",H(e,128));const t=["change","input"],n=S(r,":bind:on")?.split(",")||r.dataset?.bindOn?.split(",")||t;U(r,"bind",":"),M(r,":bind:on"),M(r,"data-bind-on");const s="checkbox"===S(r,"type")?"checked":"value";this.effect((function(){const t=this.eval(i,{$elem:e});"checked"===s?r.checked=!!t:r.value=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=P(r,"show",":");if(i){this.log(":show attribute found in:\n",H(e,128)),U(r,"show",":");const t="none"===r.style?.display?"":r.style?.display??S(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":L(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||[])){const i=":attr:",n="data-attr-";if(t.name.startsWith(i)||t.name.startsWith(n)){this.log(t.name,"attribute found in:\n",H(e,128)),M(r,t.name);const s=t.name.split(i,2).at(-1)?.split(n,2).at(-1);this.effect((function(){const i=this.eval(t.value,{$elem:e});C(r,s,i)}))}}},e.resolveCustomProperty=async function(e,t){if(this._skipNodes.has(e))return;const r=e;for(const t of Array.from(r.attributes||[])){const i=":prop:",n="data-prop-";if(t.name.startsWith(i)||t.name.startsWith(n)){this.log(t.name,"property found in:\n",H(e,128)),M(r,t.name);const s=t.name.split(i,2).at(-1)?.split(n,2).at(-1),o=k(s);this.effect((function(){const i=this.eval(t.value,{$elem:e});D(r,o,i)}))}}}}(Z||(Z={}));const q=["this"],Q=["+","-","!"],X=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],J={"!":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},ee=["==","!=","<=",">=","||","&&","??","|>"],te=["===","!=="];var re;!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"}(re||(re={}));const ie=(e,t,r=0)=>({kind:e,value:t,precedence:r}),ne=e=>95===e||36===e||65<=(e&=-33)&&e<=90,se=e=>48<=e&&e<=57;class oe{_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(ne(this._next))return this._tokenizeIdentOrKeyword();if(se(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=ie(re.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,ne(e)||se(e));var e;const t=this._getValue(),r=(i=t,-1!==q.indexOf(i)?re.KEYWORD:re.IDENTIFIER);var i;return ie(r,t)}_tokenizeNumber(){do{this._advance()}while(se(this._next));return 46===this._next?this._tokenizeDot():ie(re.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),se(this._next)?this._tokenizeFraction():(this._clearValue(),ie(re.DOT,".",13))}_tokenizeComma(){return this._advance(!0),ie(re.COMMA,",")}_tokenizeColon(){return this._advance(!0),ie(re.COLON,":")}_tokenizeFraction(){do{this._advance()}while(se(this._next));return ie(re.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let e=this._getValue(2);if(-1!==te.indexOf(e))this._advance(),this._advance();else{if(e=this._getValue(1),"=>"===e)return this._advance(),ie(re.ARROW,e);-1!==ee.indexOf(e)&&this._advance()}return e=this._getValue(),ie(re.OPERATOR,e,J[e])}_tokenizeGrouper(){const e=String.fromCharCode(this._next),t=ie(re.GROUPER,e,J[e]);return this._advance(!0),t}}class ae{_kind;_tokenizer;_ast;_token;_value;constructor(e,t){this._tokenizer=new oe(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(re.GROUPER,"(")){const t=this._parseArguments();e=this._ast.invoke(e,void 0,t)}else if(this._matches(re.GROUPER,"[")){const t=this._parseIndex();e=this._ast.index(e,t)}else if(this._matches(re.DOT)){this._advance();const t=this._parseUnary();e=this._makeInvokeOrGetter(e,t)}else{if(this._matches(re.KEYWORD))break;if(!(this._matches(re.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===X.indexOf(t.value))throw new Error(`unknown operator: ${t.value}`);this._advance();let r=this._parseUnary();for(;(this._kind===re.OPERATOR||this._kind===re.DOT||this._kind===re.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(re.OPERATOR)){const e=this._value;if(this._advance(),"+"===e||"-"===e){if(this._matches(re.INTEGER))return this._parseInteger(e);if(this._matches(re.DECIMAL))return this._parseDecimal(e)}if(-1===Q.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(re.OPERATOR,"?");const t=this._parseExpression();this._advance(re.COLON);const r=this._parseExpression();return this._ast.ternary(e,t,r)}_parsePrimary(){switch(this._kind){case re.KEYWORD:const e=this._value;if("this"===e)return this._advance(),this._ast.id(e);if(-1!==q.indexOf(e))throw new Error(`unexpected keyword: ${e}`);throw new Error(`unrecognized keyword: ${e}`);case re.IDENTIFIER:return this._parseInvokeOrIdentifier();case re.STRING:return this._parseString();case re.INTEGER:return this._parseInteger();case re.DECIMAL:return this._parseDecimal();case re.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case re.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const e=[];do{if(this._advance(),this._matches(re.GROUPER,"]"))break;e.push(this._parseExpression())}while(this._matches(re.COMMA));return this._advance(re.GROUPER,"]"),this._ast.list(e)}_parseMap(){const e={};do{if(this._advance(),this._matches(re.GROUPER,"}"))break;const t=this._value;(this._matches(re.STRING)||this._matches(re.IDENTIFIER))&&this._advance(),this._advance(re.COLON),e[t]=this._parseExpression()}while(this._matches(re.COMMA));return this._advance(re.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(re.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const e=this._value;return this._advance(),this._ast.id(e)}_parseArguments(){if(!this._matches(re.GROUPER,"("))return;const e=[];do{if(this._advance(),this._matches(re.GROUPER,")"))break;const t=this._parseExpression();e.push(t)}while(this._matches(re.COMMA));return this._advance(re.GROUPER,")"),e}_parseIndex(){this._advance();const e=this._parseExpression();return this._advance(re.GROUPER,"]"),e}_parseParenOrFunction(){const e=this._parseArguments();if(this._matches(re.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 le={"+":(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)},ce={"+":e=>e,"-":e=>-e,"!":e=>!e};class he{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 ue=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=ce[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=le[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)))}}}};function de(e,t){if(e.has(t))return e.get(t);if(e.has("$parent")){return de(e.get("$parent"),t)}return null}function pe(e,t){if(e.has(t))return e;if(e.has("$parent")){return pe(e.get("$parent"),t)}return null}class fe extends he{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 fe||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),de(this.store,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)),function(e,t,r){const i=pe(e,t);i?i.set(t,r):e.set(t,r)}(this.store,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&&pe(this.store,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 ae(e,t).parse())(e,ue),s=n?.getIds([])?.map((e=>[e,i[e]??r[e]??globalThis[e]])),o=n?.evaluate(Object.fromEntries(s||[]));if(!t)return o;!function(e,t,r){const i=t.split(".");for(let t=0;t<i.length-1;t++)i[t]in e||(e[i[t]]={}),e=e[i[t]];e[i[i.length-1]]=r}(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 me extends fe{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:V(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:V(e),rootDocument:t?.rootDocument??!e.endsWith(".tpl.html")})}subrenderer(){const e=(new this.constructor).debug(this.debugging);return e.set("$parent",this),e.set("$root",this.get("$root")??this),e._customElements=this._customElements,e}log(...e){this.debugging&&console.debug(...e)}async preprocessNode(e,t){t={dirpath:this.dirpath,maxdepth:10,...t};const r=new f(I(e,this._skipNodes)).map((async e=>{this.log("Preprocessing node:\n",H(e,128)),await Z.resolveIncludes.call(this,e,t),await Z.rebaseRelativePaths.call(this,e,t),await Z.registerCustomElements.call(this,e,t),await Z.resolveCustomElements.call(this,e,t)}));return await Promise.all(r.generator()),e}async renderNode(e,t){for(const r of I(e,this._skipNodes))this.log("Rendering node:\n",H(r,128)),await Z.resolveForAttribute.call(this,r,t),await Z.resolveDataAttribute.call(this,r,t),await Z.resolveTextAttributes.call(this,r,t),await Z.resolveHtmlAttribute.call(this,r,t),await Z.resolveShowAttribute.call(this,r,t),await Z.resolveClassAttribute.call(this,r,t),await Z.resolveBindAttribute.call(this,r,t),await Z.resolveEventAttributes.call(this,r,t),await Z.resolveTextNodeExpressions.call(this,r,t),await Z.resolveCustomAttribute.call(this,r,t),await Z.resolveCustomProperty.call(this,r,t);return e}async mount(e,t){t={...t,rootNode:e},await this.preprocessNode(e,t),await this.renderNode(e,t),D(e,"renderer",this)}}function _e(){return u([O`html{`,O`max-width: 70ch;`,O`padding: 2em 1em;`,O`margin: auto;`,O`line-height: 1.75;`,O`font-size: 1.25em;`,O`font-family: sans-serif;`,O`}`,O`h1,h2,h3,h4,h5,h6{`,O`margin: 1em 0 0.5em;`,O`}`,O`p,ul,ol{`,O`margin-bottom: 1em;`,O`color: #1d1d1d;`,O`}`].map(d).join(""))}const ge={sm:640,md:768,lg:1024,xl:1280},$e=.25,ve=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],xe=[...ve,16,20,24,25,28,30,32,36,40,44,48,50,52,56,60,64,72,80,96,100,112,128,144,160,192,200,224,256,288,300,320,384,400,448,500,512,...Object.values(ge)],be=[1,2,5,10,20,25,30,40,50,60,70,75,80,90,95,98,99,100],we=[75,100,150,200,300,500,700,1e3],Ee=["hover","focus","disabled","active"],ye={margin:"m",padding:"p"},Ae={width:"w",height:"h"},Oe={top:"top",right:"right",bottom:"bottom",left:"left"},Re={"min-width":"min-w","min-height":"min-h","max-width":"max-w","max-height":"max-h"},Ie={"font-mono":{"font-family":"monospace"},"font-sans":{"font-family":"sans-serif"},"font-serif":{"font-family":"serif"},"font-cursive":{"font-family":"cursive"},"text-xs":{"font-size":".75rem","line-height":"calc(1 / 0.75)"},"text-sm":{"font-size":".875rem","line-height":"calc(1.25 / 0.875)"},"text-base":{"font-size":"1rem","line-height":"calc(1.5 / 1)"},"text-lg":{"font-size":"1.125rem","line-height":"calc(1.75 / 1.125)"},"text-xl":{"font-size":"1.25rem","line-height":"calc(1.75 / 1.25)"},"text-2xl":{"font-size":"1.5rem","line-height":"calc(2 / 1.5)"},"text-3xl":{"font-size":"1.875rem","line-height":"calc(2.25 / 1.875)"},"text-4xl":{"font-size":"2.25rem","line-height":"calc(2.5 / 2.25)"},"text-5xl":{"font-size":"3rem","line-height":"1"},"text-6xl":{"font-size":"3.75rem","line-height":"1"},"text-7xl":{"font-size":"4.5rem","line-height":"1"},"font-thin":{"font-weight":100},"font-extralight":{"font-weight":200},"font-light":{"font-weight":300},"font-normal":{"font-weight":400},"font-medium":{"font-weight":500},"font-semibold":{"font-weight":600},"font-bold":{"font-weight":700},"font-extrabold":{"font-weight":800},"font-black":{"font-weight":900},italic:{"font-style":"italic"},"not-italic":{"font-style":"normal"},"w-max":{width:"max-content"},"w-min":{width:"min-content"},"w-fit":{width:"fit-content"},"h-max":{height:"max-content"},"h-min":{height:"min-content"},"h-fit":{height:"fit-content"},"tracking-tighter":{"letter-spacing":"-0.05em"},"tracking-tight":{"letter-spacing":"-0.025em"},"tracking-normal":{"letter-spacing":"0"},"tracking-wide":{"letter-spacing":"0.025em"},"tracking-wider":{"letter-spacing":"0.05em"},"tracking-widest":{"letter-spacing":"0.1em"},"leading-none":{"line-height":"1"},"leading-tight":{"line-height":"1.25"},"leading-snug":{"line-height":"1.375"},"leading-normal":{"line-height":"1.5"},"leading-relaxed":{"line-height":"1.625"},"leading-loose":{"line-height":"2"},"text-left":{"text-align":"left"},"text-right":{"text-align":"right"},"text-center":{"text-align":"center"},"text-justify":{"text-align":"justify"},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"},truncate:{"white-space":"nowrap",overflow:"hidden","text-overflow":"ellipsis"},"text-elipsis":{"text-overflow":"ellipsis"},"text-clip":{"text-overflow":"clip"},"text-wrap":{"text-wrap":"wrap"},"text-nowrap":{"text-wrap":"nowrap"},"text-balance":{"text-wrap":"balance"},"text-pretty":{"text-wrap":"pretty"},"whitespace-normal":{"white-space":"normal"},"whitespace-nowrap":{"white-space":"nowrap"},"whitespace-pre":{"white-space":"pre"},"whitespace-pre-line":{"white-space":"pre-line"},"whitespace-pre-wrap":{"white-space":"pre-wrap"},"whitespace-break-spaces":{"white-space":"break-spaces"},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-x-hidden":{"overflow-x":"hidden"},"overflow-y-hidden":{"overflow-y":"hidden"},"overflow-visible":{overflow:"visible"},"overscroll-auto":{"overscroll-behavior":"auto"},"overscroll-contain":{"overscroll-behavior":"contain"},"overscroll-none":{"overscroll-behavior":"none"},"overscroll-x-auto":{"overscroll-behavior-x":"auto"},"overscroll-x-contain":{"overscroll-behavior-x":"contain"},"overscroll-x-none":{"overscroll-behavior-x":"none"},"overscroll-y-auto":{"overscroll-behavior-y":"auto"},"overscroll-y-contain":{"overscroll-behavior-y":"contain"},"overscroll-y-none":{"overscroll-behavior-y":"none"},"z-auto":{"z-index":"auto"},"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-none":{border:"none"},"border-solid":{"border-style":"solid"},"border-dashed":{"border-style":"dashed"},"border-dotted":{"border-style":"dotted"},"border-collapse":{"border-collapse":"collapse"},"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"},shadow:{"box-shadow":"0 0 1px 0 rgba(0, 0, 0, 0.05)"},"shadow-sm":{"box-shadow":"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},"shadow-md":{"box-shadow":"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},"shadow-lg":{"box-shadow":"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},"shadow-xl":{"box-shadow":"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)"},"shadow-2xl":{"box-shadow":"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},"shadow-inner":{"box-shadow":"inset 0 2px 4px 0 rgba(0, 0, 0, 0.06)"},"shadow-outline":{"box-shadow":"0 0 0 3px rgba(66, 153, 225, 0.5)"},"shadow-none":{"box-shadow":"none"},"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"}},Ne=["@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 }"],Te={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 ke(e){return`#${e.toString(16).padStart(6,"0")}`}function Se(e){return Ee.map((t=>`.${t}\\:${e}:${t}`))}function Pe(e,t){return Object.entries(ge).map((([r,i])=>`@media (min-width: ${i}px) { .${r}\\:${e} { ${t} } }`))}function Ce(e,t){return e.includes("@media")&&!t.includes("@media")?1:!e.includes("@media")&&t.includes("@media")?-1:e.localeCompare(t)}function Le(e){return Object.entries(e).flatMap((([e,t])=>[[`${t}-0`,`${e}: 0`],[`${t}-screen`,`${e}: 100vw`],[`${t}-full`,`${e}: 100%`],...xe.map((r=>[`${t}-${r}`,`${e}: ${r*$e}rem`])),...xe.map((r=>[`-${t}-${r}`,`${e}: -${r*$e}rem`])),...xe.map((r=>[`${t}-${r}px`,`${e}: ${r}px`])),...xe.map((r=>[`-${t}-${r}px`,`${e}: -${r}px`])),...be.map((r=>[`${t}-${r}\\%`,`${e}: ${r}%`])),...be.map((r=>[`-${t}-${r}\\%`,`${e}: -${r}%`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))}function De(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;`],...xe.map((e=>[e,e*$e])).map((([r,i])=>[`${t}x-${r}`,`${e}-left: ${i}rem; ${e}-right: ${i}rem;`])),...xe.map((e=>[e,e*$e])).map((([r,i])=>[`${t}y-${r}`,`${e}-top: ${i}rem; ${e}-bottom: ${i}rem;`])),...xe.map((r=>[`${t}x-${r}px`,`${e}-left: ${r}px; ${e}-right: ${r}px;`])),...xe.map((r=>[`${t}y-${r}px`,`${e}-top: ${r}px; ${e}-bottom: ${r}px;`])),...be.map((r=>[`${t}x-${r}\\%`,`${e}-left: ${r}%; ${e}-right: ${r}%;`])),...be.map((r=>[`${t}y-${r}\\%`,`${e}-top: ${r}%; ${e}-bottom: ${r}%;`]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))}function Me(){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(Te).flatMap((([e,t])=>[[`text-${e}`,`color: ${ke(t[500])}`],[`fill-${e}`,`fill: ${ke(t[500])}`],[`bg-${e}`,`background-color: ${ke(t[500])}`],[`border-${e}`,`border-color: ${ke(t[500])}`]])),r=Object.entries(Te).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[[`text-${e}-${t}`,`color: ${ke(r)}`],[`fill-${e}-${t}`,`fill: ${ke(r)}`],[`bg-${e}-${t}`,`background-color: ${ke(r)}`],[`border-${e}-${t}`,`border-color: ${ke(r)}`]]))));return[].concat(e).concat(t).concat(r).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))}class Ue extends me{impl="browser";dirpath=V(globalThis.location?.href??"http://localhost/");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 Ue;const ze=new Ue;globalThis.Mancha=ze;const je=globalThis.document?.currentScript;if(globalThis.document?.currentScript?.hasAttribute("init")){const e=je?.hasAttribute("debug"),t=je?.getAttribute("cache"),r=je?.getAttribute("target")?.split("+")||["body"];window.addEventListener("load",(()=>{r.map((async r=>{const i=globalThis.document.querySelector(r);await ze.debug(e).mount(i,{cache:t})}))}))}if(globalThis.document?.currentScript?.hasAttribute("css")){const e=je?.getAttribute("css")?.split("+");for(const t of e){const e=document.createElement("style");switch(t){case"basic":p(e,_e());break;case"utils":e.textContent=(Fe=void 0,[...Ne,...Object.entries(Ie).flatMap((([e,t])=>Object.entries(t).flatMap((([t,r])=>[`.${e} { ${t}: ${r} }`,`${Se(e).join(",")} { ${t}: ${r} }`,...Pe(e,`${t}: ${r}`)])))),...Me(),...[["opacity-0","opacity: 0"],...be.map((e=>[`opacity-${e}`,"opacity: "+e/100]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...be.map((e=>[`z-${e}`,`z-index: ${e}`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...we.map((e=>[`duration-${e}`,`transition-duration: ${e}ms`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...Le(Oe),...Le(Ae),...De(Ae),...(Fe=ye,Object.entries(Fe).flatMap((([e,t])=>[[`${t}t-0`,`${e}-top: 0`],[`${t}b-0`,`${e}-bottom: 0`],[`${t}l-0`,`${e}-left: 0`],[`${t}r-0`,`${e}-right: 0`],[`${t}t-auto`,`${e}-top: auto`],[`${t}b-auto`,`${e}-bottom: auto`],[`${t}l-auto`,`${e}-left: auto`],[`${t}r-auto`,`${e}-right: auto`],...["","-"].flatMap((r=>[...xe.map((e=>[e,e*$e])).map((([i,n])=>[`${r}${t}t-${i}`,`${e}-top: ${r}${n}rem`])),...xe.map((e=>[e,e*$e])).map((([i,n])=>[`${r}${t}b-${i}`,`${e}-bottom: ${r}${n}rem`])),...xe.map((e=>[e,e*$e])).map((([i,n])=>[`${r}${t}l-${i}`,`${e}-left: ${r}${n}rem`])),...xe.map((e=>[e,e*$e])).map((([i,n])=>[`${r}${t}r-${i}`,`${e}-right: ${r}${n}rem`])),...xe.map((i=>[`${r}${t}t-${i}px`,`${e}-top: ${r}${i}px`])),...xe.map((i=>[`${r}${t}b-${i}px`,`${e}-bottom: ${r}${i}px`])),...xe.map((i=>[`${r}${t}l-${i}px`,`${e}-left: ${r}${i}px`])),...xe.map((i=>[`${r}${t}r-${i}px`,`${e}-right: ${r}${i}px`])),...be.map((i=>[`${r}${t}t-${i}\\%`,`${e}-top: ${r}${i}%`])),...be.map((i=>[`${r}${t}b-${i}\\%`,`${e}-bottom: ${r}${i}%;`])),...be.map((i=>[`${r}${t}l-${i}\\%`,`${e}-left: ${r}${i}%`])),...be.map((i=>[`${r}${t}r-${i}\\%`,`${e}-right: ${r}${i}%`]))]))])).flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))),...Le(ye),...De(ye),...[["space-x-0 > *","margin-left: 0"],["space-y-0 > *","margin-top: 0"],...xe.map((e=>[`space-x-${e} > :not(:first-child)`,`margin-left: ${e*$e}rem`])),...xe.map((e=>[`space-y-${e} > :not(:first-child)`,`margin-top: ${e*$e}rem`])),...xe.map((e=>[`space-x-${e}px > :not(:first-child)`,`margin-left: ${e}px`])),...xe.map((e=>[`space-y-${e}px > :not(:first-child)`,`margin-top: ${e}px`])),["gap-0","gap: 0"],...xe.map((e=>[`gap-${e}`,`gap: ${e*$e}rem`])),...xe.map((e=>[`gap-${e}px`,`gap: ${e}px`])),...xe.map((e=>[`gap-x-${e}`,`column-gap: ${e*$e}rem`])),...xe.map((e=>[`gap-y-${e}`,`row-gap: ${e*$e}rem`])),...xe.map((e=>[`gap-x-${e}px`,`column-gap: ${e}px`])),...xe.map((e=>[`gap-y-${e}px`,`row-gap: ${e}px`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...Le(Re),...[["border","border: 1px"],["border-x","border-inline-width: 1px"],["border-y","border-block-width: 1px"],...[0,...ve].map((e=>[`border-${e}`,`border-width: ${e}px`])),...[0,...ve].map((e=>[`border-x-${e}`,`border-inline-width: ${e}px;`])),...[0,...ve].map((e=>[`border-y-${e}`,`border-block-width: ${e}px;`])),...["top","bottom","left","right"].flatMap((e=>[[`border-${e.slice(0,1)}`,`border-${e}: 1px`],...[0,...ve].map((t=>[`border-${e.slice(0,1)}-${t}`,`border-${e}-width: ${t}px`]))]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)])),...[...Array.from({length:100},((e,t)=>t)).map((e=>[`text-${e}px`,`font-size: ${e}px`])),...Array.from({length:100},((e,t)=>t*$e)).map((e=>[`text-${e}rem`,`font-size: ${e}rem`]))].flatMap((([e,t])=>[`.${e} { ${t} }`,`${Se(e).join(",")} { ${t} }`,...Pe(e,t)]))].sort(Ce).join("\n"));break;default:console.error(`Unknown style name: "${t}"`)}globalThis.document.head.appendChild(e)}}var Fe})();
package/dist/plugins.js CHANGED
@@ -292,6 +292,10 @@ export var RendererPlugins;
292
292
  for (const child of traverse(node, this._skipNodes)) {
293
293
  this._skipNodes.add(child);
294
294
  }
295
+ // Save the original node style to restore it later.
296
+ // NOTE: This is a hack because Chrome is sometimes displaying the contents of <template>.
297
+ const originalStyle = getAttribute(elem, "style") || "";
298
+ setAttribute(elem, "style", "display: none;");
295
299
  // Place the template node into a template element.
296
300
  const parent = node.parentNode;
297
301
  const template = this.createElement("template", node.ownerDocument);
@@ -329,6 +333,8 @@ export var RendererPlugins;
329
333
  subrenderer.set(loopKey, item);
330
334
  // Create a new HTML element for each item and add them to parent node.
331
335
  const copy = node.cloneNode(true);
336
+ // Restore the original style of the node.
337
+ setAttribute(copy, "style", originalStyle);
332
338
  // Also add the new element to the store.
333
339
  children.push(copy);
334
340
  // Since the element will be handled by a subrenderer, skip it in parent renderer.
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAe,MAAM,gBAAgB,CAAC;AACvE,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,wBAAwB,EACxB,eAAe,EACf,WAAW,EACX,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,WAAW,GACZ,MAAM,WAAW,CAAC;AAEnB,OA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,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBACnE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,sBAAsB,EAAE,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;gBAErE,6CAA6C;gBAC7C,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBAEjC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAG,CAAC;gBAChF,MAAM,QAAQ,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;gBACpD,IAAI,CAAC,MAAM,CAAC;oBACV,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;oBACzD,WAAW,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;gBACzC,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,EAvfgB,eAAe,KAAf,eAAe,QAuf/B"}
@@ -1 +1 @@
1
- const t={};function e(t){0}class i{constructor(t,e){this.privateDoNotAccessOrElseWrappedAttributePrefix=e}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}}const r=i;function s(t){if(function(t){return t instanceof i}(t))return t.privateDoNotAccessOrElseWrappedAttributePrefix;throw new Error("")}function n(t){return Object.isFrozen(t)&&Object.isFrozen(t.raw)}function a(t){return-1===t.toString().indexOf("`")}a((t=>t``))||a((t=>t`\0`))||a((t=>t`\n`))||a((t=>t`\u0000`)),n``&&n`\0`&&n`\n`&&n`\u0000`;function o(e){const i=e[0].toLowerCase();return new r(t,i)}let l,c="google#safe";function h(){var t;return""!==c&&null!==(t=function(){if("undefined"!=typeof window)return window.trustedTypes}())&&void 0!==t?t:null}class u{constructor(t,i){e(),this.privateDoNotAccessOrElseWrappedHtml=t}toString(){return this.privateDoNotAccessOrElseWrappedHtml.toString()}}function d(e,i){return null!=i?i:new u(e,t)}"undefined"!=typeof window&&window.TrustedHTML;function p(t){var e;const i=t;return d(i,null===(e=function(){var t,e;if(void 0===l)try{l=null!==(e=null===(t=h())||void 0===t?void 0:t.createPolicy(c,{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t}))&&void 0!==e?e:null}catch(t){l=null}return l}())||void 0===e?void 0:e.createHTML(i))}function f(t){var e;if(null===(e=h())||void 0===e?void 0:e.isHTML(t))return t;if(t instanceof u)return t.privateDoNotAccessOrElseWrappedHtml;throw new Error("")}"undefined"!=typeof window&&window.TrustedScriptURL;"undefined"!=typeof window&&window.TrustedScript;function _(t,e){e.appendChild(t);let i=(new XMLSerializer).serializeToString(e);return i=i.slice(i.indexOf(">")+1,i.lastIndexOf("</")),p(i)}const m=["data:","http:","https:","mailto:","ftp:"],E=/^\s*(?!javascript:)(?:[\w+.-]+:|[^:/?#]*(?:[/?#]|$))/i;function v(t){if(!function(t){const e=!E.test(t);return e}(t))return t}function w(t){return v(t)}function b(t){const e=function(t){let e;try{e=new URL(t)}catch(t){return"https:"}return e.protocol}(t);return void 0!==e&&-1!==m.indexOf(e.toLowerCase())?t:"about:invalid#zClosurez"}function g(t,e){const i=e.createRange();i.selectNode(e.body);return function(t,e){return t.createContextualFragment(f(e))}(i,p(t))}function A(t){const e=t.nodeName;return"string"==typeof e?e:"FORM"}function y(t){return 3===t.nodeType}function T(t){const e=t.nodeType;return 1===e||"number"!=typeof e}var R,O;function N(t){try{return new URL(t,window.document.baseURI)}catch(t){return new URL("about:invalid")}}function I(t){return{valueOf:t}.valueOf()}!function(t){t[t.STYLE_TAG=0]="STYLE_TAG",t[t.STYLE_ATTRIBUTE=1]="STYLE_ATTRIBUTE",t[t.HTML_ATTRIBUTE=2]="HTML_ATTRIBUTE"}(R||(R={}));class P{constructor(t,e,i,r,s){this.allowedElements=t,this.elementPolicies=e,this.allowedGlobalAttributes=i,this.globalAttributePolicies=r,this.globallyAllowedAttributePrefixes=s}isAllowedElement(t){return"FORM"!==t&&(this.allowedElements.has(t)||this.elementPolicies.has(t))}getAttributePolicy(t,e){const i=this.elementPolicies.get(e);if(null==i?void 0:i.has(t))return i.get(t);if(this.allowedGlobalAttributes.has(t))return{policyAction:O.KEEP};const r=this.globalAttributePolicies.get(t);return r||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some((e=>0===t.indexOf(e)))?{policyAction:O.KEEP}:{policyAction:O.DROP})}}!function(t){t[t.DROP=0]="DROP",t[t.KEEP=1]="KEEP",t[t.KEEP_AND_SANITIZE_URL=2]="KEEP_AND_SANITIZE_URL",t[t.KEEP_AND_NORMALIZE=3]="KEEP_AND_NORMALIZE",t[t.KEEP_AND_SANITIZE_STYLE=4]="KEEP_AND_SANITIZE_STYLE",t[t.KEEP_AND_USE_RESOURCE_URL_POLICY=5]="KEEP_AND_USE_RESOURCE_URL_POLICY",t[t.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET=6]="KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET"}(O||(O={}));const x=new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const S=["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"],C=[["A",new Map([["href",{policyAction:O.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:O.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:O.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:O.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}]])]],L=["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"],k=[["dir",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I((()=>new Map([["dir",new Set(["auto","ltr","rtl"])]])))}],["async",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I((()=>new Map([["async",new Set(["async"])]])))}],["cite",{policyAction:O.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I((()=>new Map([["loading",new Set(["eager","lazy"])]])))}],["poster",{policyAction:O.KEEP_AND_SANITIZE_URL}],["target",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I((()=>new Map([["target",new Set(["_self","_blank"])]])))}]],D=new P(new Set(S),new Map(C),new Set(L),new Map(k));new P(new Set(I((()=>S.concat(["STYLE"])))),new Map(C),new Set(I((()=>L.concat(["id","name","class"])))),new Map(I((()=>k.concat([["style",{policyAction:O.KEEP_AND_SANITIZE_STYLE}]])))));class U{constructor(t,i,r,s,n){this.sanitizerTable=t,this.styleElementSanitizer=r,this.styleAttributeSanitizer=s,this.resourceUrlPolicy=n,this.changes=[],e()}sanitizeAssertUnchanged(t){return this.sanitize(t)}sanitize(t){const e=document.implementation.createHTMLDocument("");return _(this.sanitizeToFragmentInternal(t,e),e.body)}sanitizeToFragment(t){const e=document.implementation.createHTMLDocument("");return this.sanitizeToFragmentInternal(t,e)}sanitizeToFragmentInternal(t,e){const i=g(t,e),r=document.createTreeWalker(i,5,(t=>this.nodeFilter(t)));let s=r.nextNode();const n=e.createDocumentFragment();let a=n;for(;null!==s;){let t;if(y(s))if(this.styleElementSanitizer&&"STYLE"===a.nodeName){const e=this.styleElementSanitizer(s.data);t=this.createTextNode(e)}else t=this.sanitizeTextNode(s);else{if(!T(s)){throw new Error("")}t=this.sanitizeElementNode(s,e)}if(a.appendChild(t),s=r.firstChild(),s)a=t;else for(;!(s=r.nextSibling())&&(s=r.parentNode());)a=a.parentNode}return n}createTextNode(t){return document.createTextNode(t)}sanitizeTextNode(t){return this.createTextNode(t.data)}sanitizeElementNode(t,e){const i=A(t),r=e.createElement(i),s=t.attributes;for(const{name:t,value:e}of s){const n=this.sanitizerTable.getAttributePolicy(t,i);if(this.satisfiesAllConditions(n.conditions,s))switch(n.policyAction){case O.KEEP:z(r,t,e);break;case O.KEEP_AND_SANITIZE_URL:const s=b(e);s!==e&&this.recordChange(`Url in attribute ${t} was modified during sanitization. Original url:"${e}" was sanitized to: "${s}"`),z(r,t,s);break;case O.KEEP_AND_NORMALIZE:z(r,t,e.toLowerCase());break;case O.KEEP_AND_SANITIZE_STYLE:if(this.styleAttributeSanitizer){z(r,t,this.styleAttributeSanitizer(e))}else z(r,t,e);break;case O.KEEP_AND_USE_RESOURCE_URL_POLICY:if(this.resourceUrlPolicy){const s={type:R.HTML_ATTRIBUTE,attributeName:t,tagName:i},n=N(e),a=this.resourceUrlPolicy(n,s);a&&z(r,t,a.toString())}else z(r,t,e);break;case O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET:if(this.resourceUrlPolicy){const s={type:R.HTML_ATTRIBUTE,attributeName:t,tagName:i},n=M(e),a={parts:[]};for(const t of n.parts){const e=N(t.url),i=this.resourceUrlPolicy(e,s);i&&a.parts.push({url:i.toString(),descriptor:t.descriptor})}z(r,t,$(a))}else z(r,t,e);break;case O.DROP:this.recordChange(`Attribute: ${t} was dropped`)}else this.recordChange(`Not all conditions satisfied for attribute: ${t}.`)}return r}nodeFilter(t){if(y(t))return 1;if(!T(t))return 2;const e=A(t);return null===e?(this.recordChange(`Node name was null for node: ${t}`),2):this.sanitizerTable.isAllowedElement(e)?1:(this.recordChange(`Element: ${e} was dropped`),2)}recordChange(t){0}satisfiesAllConditions(t,e){var i;if(!t)return!0;for(const[r,s]of t){const t=null===(i=e.getNamedItem(r))||void 0===i?void 0:i.value;if(t&&!s.has(t))return!1}return!0}}function z(t,e,i){t.setAttribute(e,i)}function M(t){const e=[];for(const i of t.split(",")){const[t,r]=i.trim().split(/\s+/,2);e.push({url:t,descriptor:r})}return{parts:e}}function $(t){return t.parts.map((t=>{const{url:e,descriptor:i}=t;return`${e}${i?` ${i}`:""}`})).join(" , ")}class F{constructor(){this.calledBuild=!1,this.sanitizerTable=D}onlyAllowElements(t){const e=new Set,i=new Map;for(let r of t){if(r=r.toUpperCase(),!this.sanitizerTable.isAllowedElement(r))throw new Error(`Element: ${r}, is not allowed by html5_contract.textpb`);const t=this.sanitizerTable.elementPolicies.get(r);void 0!==t?i.set(r,t):e.add(r)}return this.sanitizerTable=new P(e,i,this.sanitizerTable.allowedGlobalAttributes,this.sanitizerTable.globalAttributePolicies),this}allowCustomElement(t,e){const i=new Set(this.sanitizerTable.allowedElements),r=new Map(this.sanitizerTable.elementPolicies);if(t=t.toUpperCase(),s=t,x.has(s.toUpperCase())||!/^[a-z][-_.a-z0-9]*-[-_.a-z0-9]*$/i.test(s))throw new Error(`Element: ${t} is not a custom element`);var s;if(e){const i=new Map;for(const t of e)i.set(t,{policyAction:O.KEEP});r.set(t,i)}else i.add(t);return this.sanitizerTable=new P(i,r,this.sanitizerTable.allowedGlobalAttributes,this.sanitizerTable.globalAttributePolicies),this}onlyAllowAttributes(t){const e=new Set,i=new Map,r=new Map;for(const r of t)this.sanitizerTable.allowedGlobalAttributes.has(r)&&e.add(r),this.sanitizerTable.globalAttributePolicies.has(r)&&i.set(r,this.sanitizerTable.globalAttributePolicies.get(r));for(const[e,i]of this.sanitizerTable.elementPolicies.entries()){const s=new Map;for(const[e,r]of i.entries())t.has(e)&&s.set(e,r);r.set(e,s)}return this.sanitizerTable=new P(this.sanitizerTable.allowedElements,r,e,i),this}allowDataAttributes(t){const e=new Set(this.sanitizerTable.allowedGlobalAttributes);for(const i of t){if(0!==i.indexOf("data-"))throw new Error(`data attribute: ${i} does not begin with the prefix "data-"`);e.add(i)}return this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,e,this.sanitizerTable.globalAttributePolicies),this}allowStyleAttributes(){const t=new Map(this.sanitizerTable.globalAttributePolicies);return t.set("style",{policyAction:O.KEEP_AND_SANITIZE_STYLE}),this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,this.sanitizerTable.allowedGlobalAttributes,t),this}allowClassAttributes(){const t=new Set(this.sanitizerTable.allowedGlobalAttributes);return t.add("class"),this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,t,this.sanitizerTable.globalAttributePolicies),this}allowIdAttributes(){const t=new Set(this.sanitizerTable.allowedGlobalAttributes);return t.add("id"),this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,t,this.sanitizerTable.globalAttributePolicies),this}allowIdReferenceAttributes(){const t=new Set(this.sanitizerTable.allowedGlobalAttributes);return t.add("aria-activedescendant").add("aria-controls").add("aria-labelledby").add("aria-owns").add("for").add("list"),this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,t,this.sanitizerTable.globalAttributePolicies),this}withResourceUrlPolicy(t){return this.resourceUrlPolicy=t,this}build(){if(this.calledBuild)throw new Error("this sanitizer has already called build");return this.calledBuild=!0,new U(this.sanitizerTable,t,void 0,void 0,this.resourceUrlPolicy)}}function G(t,e,i,r){if(0===t.length){throw new Error("")}const n=t.map((t=>s(t))),a=i.toLowerCase();if(n.every((t=>0!==a.indexOf(t))))throw new Error(`Attribute "${i}" does not match any of the allowed prefixes.`);e.setAttribute(i,r)}function K(t,e,i){return t.parseFromString(f(e),i)}Error;const W=[o`:`,o`style`,o`class`];function*Y(t,e=new Set){const i=new Set,r=Array.from(t.childNodes).filter((t=>!e.has(t)));for(yield t;r.length;){const t=r.shift();i.has(t)||(i.add(t),yield t),t.childNodes&&Array.from(t.childNodes).filter((t=>!e.has(t))).forEach((t=>r.push(t)))}}function H(t,e){return void 0!==t?.[e]}function B(t,e){return"function"==typeof t?.[e]}function V(t){return t.replace(/-./g,(t=>t[1].toUpperCase()))}function Z(t,e){return H(t,"attribs")?t.attribs?.[e]??null:t.getAttribute?.(e)??null}function j(t,e,i=""){return Z(t,i+e)||(t.dataset?.[V(e)]??null)}function q(t,e,i){H(t,"attribs")?t.attribs[e]=i:t.setAttribute?.(e,i)}function X(t,e,i){H(t,"attribs")?t.attribs[e]=i:G(W,t,e,i)}function Q(t,e,i){switch(e){case"disabled":return void(t.disabled=i);case"selected":return void(t.selected=i);case"checked":return void(t.checked=i);default:t[e]=i}}function J(t,e){H(t,"attribs")?delete t.attribs[e]:t.removeAttribute?.(e)}function tt(t,e,i=""){J(t,`${i}${e}`),J(t,`data-${e}`)}function et(t,e,i){if(H(t,"attribs")&&H(e,"attribs"))e.attribs[i]=t.attribs[i];else if(i.startsWith("data-")){const r=V(i.slice(5));e.dataset[r]=t.dataset?.[r]}else{const r=t?.getAttribute?.(i);X(e,i,r||"")}}function it(t){if(H(t,"firstElementChild"))return t.firstElementChild;return Array.from(t.children).find((t=>1===t.nodeType))}function rt(t,...e){if(B(t,"replaceWith"))return t.replaceWith(...e);{const i=t,r=i.parentNode,s=Array.from(r.childNodes).indexOf(i);e.forEach((t=>t.parentNode=r)),r.childNodes=[].concat(Array.from(r.childNodes).slice(0,s)).concat(e).concat(Array.from(r.childNodes).slice(s+1))}}function st(t,...e){B(t,"replaceChildren")?t.replaceChildren(...e):(t.childNodes=e,e.forEach((e=>e.parentNode=t)))}function nt(t,e){return B(e,"appendChild")?t.appendChild(e):(t.childNodes.push(e),e.parentNode=t,e)}function at(t,e){return B(e,"removeChild")?t.removeChild(e):(st(t,...Array.from(t.childNodes).filter((t=>t!==e))),e)}function ot(t,e,i){return i?B(t,"insertBefore")?t.insertBefore(e,i):(rt(i,e,i),e):nt(t,e)}function lt(t,e=0){return t?t.length<=e?t:t.slice(0,e-1)+"…":""}function ct(t,e=0){return globalThis.DocumentFragment&&t instanceof DocumentFragment?Array.from(t.childNodes).map((t=>ct(t,e))).join(""):lt(t.outerHTML||t.nodeValue||String(t),e)}function ht(t){return t.includes("/")?t.split("/").slice(0,-1).join("/"):""}class ut{iterable;constructor(t){this.iterable=t}filter(t){return new ut(ut.filterGenerator(t,this.iterable))}map(t){return new ut(ut.mapGenerator(t,this.iterable))}find(t){for(const e of this.iterable)if(t(e))return e}array(){return Array.from(this.iterable)}*generator(){for(const t of this.iterable)yield t}static*filterGenerator(t,e){for(const i of e)t(i)&&(yield i)}static*mapGenerator(t,e){for(const i of e)yield t(i)}static equals(t,e){const i=t[Symbol.iterator](),r=e[Symbol.iterator]();let s=i.next(),n=r.next();for(;!s.done&&!n.done;){if(s.value!==n.value)return!1;s=i.next(),n=r.next()}return s.done===n.done}}var dt;!function(t){t.resolveIncludes=async function(t,e){const i=t,r=i.tagName?.toLowerCase();if(!["include","link"].includes(r))return;if("link"===r&&"subresource"!==Z(i,"rel"))return;this.log("include directive found in:\n",ct(t,128)),this.log("include params:",e);const s="link"===i.tagName.toLocaleLowerCase()?"href":"src",n=Z(i,s);if(!n)throw new Error(`"${s}" attribute missing from ${ct(t,128)}.`);const a=[];"include"===r&&a.push("src"),"link"===r&&a.push("rel","href");const o=e=>{const r=it(e);for(const t of Array.from(i.attributes))r&&!a.includes(t.name)&&et(i,r,t.name);rt(t,...e.childNodes)},l={...e,rootDocument:!1,maxdepth:e?.maxdepth-1};if(0===l.maxdepth)throw new Error("Maximum recursion depth reached.");if(n.includes("://")||n.startsWith("//"))this.log("Including remote file from absolute path:",n),await this.preprocessRemote(n,l).then(o);else if(e?.dirpath?.includes("://")||e?.dirpath?.startsWith("//")){const t=n.startsWith("/")?n:`${e.dirpath}/${n}`;this.log("Including remote file from relative path:",t),await this.preprocessRemote(t,l).then(o)}else if("/"===n.charAt(0))this.log("Including local file from absolute path:",n),await this.preprocessLocal(n,l).then(o);else{const t=e?.dirpath&&"."!==e?.dirpath?`${e?.dirpath}/${n}`:n;this.log("Including local file from relative path:",t),await this.preprocessLocal(t,l).then(o)}},t.rebaseRelativePaths=async function(t,e){const i=t,r=i.tagName?.toLowerCase();if(!e?.dirpath)return;const s=Z(i,"src"),n=Z(i,"href"),a=s||n;if(!a||((o=a).includes("://")||o.startsWith("/")||o.startsWith("#")||o.startsWith("data:")))return;var o;const l=`${e.dirpath}/${a}`;this.log("Rebasing relative path as:",l),H(i,"attribs")?X(i,s?"src":"href",l):"img"===r?i.src=l:"a"===r?function(t,e){const i=w(e);void 0!==i&&(t.href=i)}(i,l):"source"===r||"audio"===r||"video"===r||"track"===r||"input"===r?i.src=l:"area"===r?function(t,e){const i=w(e);void 0!==i&&(t.href=i)}(i,l):this.log("Unable to rebase relative path for element:",r)},t.registerCustomElements=async function(t,e){const i=t,r=i.tagName?.toLowerCase(),s=(Z(i,"is")||Z(i,"alt"))?.toLowerCase();if(["template","div"].includes(r)&&s){if("div"===r&&"template"!==Z(i,"role"))return;this._customElements.has(s)||(this.log(`Registering custom element: ${s}\n`,ct(i,128)),this._customElements.set(s,i),at(i.parentNode,i))}},t.resolveCustomElements=async function(t,e){const i=t,r=i.tagName?.toLowerCase();let s=r;if("div"===s&&(s=Z(i,"role")?.toLowerCase()||s),s&&this._customElements.has(s)){this.log(`Processing custom element: ${s}\n`,ct(i,128));const e=this._customElements.get(s),n=(e.content||e).cloneNode(!0),a=it(n);if(a)for(const t of Array.from(i.attributes))"div"===r&&"role"===t.name||et(i,a,t.name);const o=new ut(Y(n)).find((t=>"slot"===t.tagName?.toLowerCase()));o&&rt(o,...i.childNodes),rt(t,...n.childNodes)}},t.resolveTextNodeExpressions=async function(t,e){const i=t.nodeValue||"";if(3!==t.nodeType||!i?.trim())return;this.log("Processing node content value:\n",lt(i,128));const r=new RegExp(/{{ ([^}]+) }}/gm),s=Array.from(i.matchAll(r)).map((t=>t[1]));return this.effect((function(){let e=i;for(const i of s){const r=this.eval(i,{$elem:t});e=e.replace(`{{ ${i} }}`,String(r))}t.nodeValue=e}))},t.resolveDataAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"data",":");if(r){this.log(":data attribute found in:\n",ct(t,128)),tt(i,"data",":");const s=e?.rootNode===t?this:this.subrenderer();t.renderer=s;const n=s.eval(r,{$elem:t});if(await Promise.all(Object.entries(n).map((([t,e])=>s.set(t,e)))),s!==this)for(const e of Y(t,this._skipNodes))this._skipNodes.add(e);await s.mount(t,e)}},t.resolveClassAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"class",":");if(r){this.log(":class attribute found in:\n",ct(t,128)),tt(i,"class",":");const e=Z(i,"class")||"";return this.effect((function(){const s=this.eval(r,{$elem:t});X(i,"class",(s?`${e} ${s}`:e).trim())}))}},t.resolveTextAttributes=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"text",":");if(r){this.log(":text attribute found in:\n",ct(t,128)),tt(i,"text",":");const e=e=>this.textContent(t,e);return this.effect((function(){e(this.eval(r,{$elem:t}))}))}},t.resolveHtmlAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"html",":");return r?(this.log(":html attribute found in:\n",ct(t,128)),tt(i,"html",":"),this.effect((function(){const s=this.eval(r,{$elem:t});return new Promise((async t=>{const r=await this.preprocessString(s,e);await this.renderNode(r),st(i,r),t()}))}))):void 0},t.resolveEventAttributes=async function(t,e){if(this._skipNodes.has(t))return;const i=t;for(const e of Array.from(i.attributes||[]))if(e.name.startsWith(":on:")||e.name.startsWith("data-on-")){const r=e.name.split(":on:",2).at(-1)?.split("data-on-",2).at(-1)||"";if(!r)throw new Error(`Invalid event attribute: ${e.name}`);this.log(e.name,"attribute found in:\n",ct(t,128)),J(i,e.name);const s="submit"===r&&"FORM"===i.tagName.toUpperCase();t.addEventListener?.(r,(i=>(s&&i.preventDefault(),this.eval(e.value,{$elem:t,$event:i}))))}},t.resolveForAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"for",":")?.trim();if(r){this.log(":for attribute found in:\n",ct(t,128)),tt(i,"for",":");for(const e of Y(t,this._skipNodes))this._skipNodes.add(e);const s=t.parentNode,n=this.createElement("template",t.ownerDocument);ot(s,n,t),at(s,t),nt(n,t),this.log(":for template:\n",ct(n,128));const a=r.split(" in ",2);if(2!==a.length)throw new Error(`Invalid :for format: \`${r}\`. Expected "{key} in {expression}".`);const o=[],[l,c]=a;await this.effect((function(){const i=this.eval(c,{$elem:t});if(this.log(":for list items:",i),o.splice(0,o.length).forEach((t=>{at(s,t),this._skipNodes.delete(t)})),!Array.isArray(i))return console.error(`Expression did not yield a list: \`${c}\` => \`${i}\``),Promise.resolve();const r=[];for(const s of i){const i=this.subrenderer();i.set(l,s);const n=t.cloneNode(!0);o.push(n),this._skipNodes.add(n),r.push(i.mount(n,e)),this.log("Rendered list child:\n",ct(n,128))}const a=n.nextSibling;for(const t of o)ot(s,t,a);return Promise.all(r)}))}},t.resolveBindAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"bind",":");if(r){this.log(":bind attribute found in:\n",ct(t,128));const e=["change","input"],s=Z(i,":bind:on")?.split(",")||i.dataset?.bindOn?.split(",")||e;tt(i,"bind",":"),J(i,":bind:on"),J(i,"data-bind-on");const n="checkbox"===Z(i,"type")?"checked":"value";this.effect((function(){const e=this.eval(r,{$elem:t});"checked"===n?i.checked=!!e:i.value=e}));const a=`${r} = $elem.${n}`;for(const e of s)t.addEventListener(e,(()=>this.eval(a,{$elem:t})))}},t.resolveShowAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"show",":");if(r){this.log(":show attribute found in:\n",ct(t,128)),tt(i,"show",":");const e="none"===i.style?.display?"":i.style?.display??Z(i,"style")?.split(";")?.find((t=>"display"===t.split(":")[0]))?.split(":")?.at(1)?.trim();this.effect((function(){const s=this.eval(r,{$elem:t});i.style?i.style.display=s?e:"none":X(i,"style",`display: ${s?e:"none"};`)}))}},t.resolveCustomAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t;for(const e of Array.from(i.attributes||[])){const r=":attr:",s="data-attr-";if(e.name.startsWith(r)||e.name.startsWith(s)){this.log(e.name,"attribute found in:\n",ct(t,128)),J(i,e.name);const n=e.name.split(r,2).at(-1)?.split(s,2).at(-1);this.effect((function(){const r=this.eval(e.value,{$elem:t});q(i,n,r)}))}}},t.resolveCustomProperty=async function(t,e){if(this._skipNodes.has(t))return;const i=t;for(const e of Array.from(i.attributes||[])){const r=":prop:",s="data-prop-";if(e.name.startsWith(r)||e.name.startsWith(s)){this.log(e.name,"property found in:\n",ct(t,128)),J(i,e.name);const n=e.name.split(r,2).at(-1)?.split(s,2).at(-1),a=V(n);this.effect((function(){const r=this.eval(e.value,{$elem:t});Q(i,a,r)}))}}}}(dt||(dt={}));const pt=["this"],ft=["+","-","!"],_t=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],mt={"!":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},Et=["==","!=","<=",">=","||","&&","??","|>"],vt=["===","!=="];var wt;!function(t){t[t.STRING=1]="STRING",t[t.IDENTIFIER=2]="IDENTIFIER",t[t.DOT=3]="DOT",t[t.COMMA=4]="COMMA",t[t.COLON=5]="COLON",t[t.INTEGER=6]="INTEGER",t[t.DECIMAL=7]="DECIMAL",t[t.OPERATOR=8]="OPERATOR",t[t.GROUPER=9]="GROUPER",t[t.KEYWORD=10]="KEYWORD",t[t.ARROW=11]="ARROW"}(wt||(wt={}));const bt=(t,e,i=0)=>({kind:t,value:e,precedence:i}),gt=t=>95===t||36===t||65<=(t&=-33)&&t<=90,At=t=>48<=t&&t<=57;class yt{_input;_index=-1;_tokenStart=0;_next;constructor(t){this._input=t,this._advance()}nextToken(){for(;9===(t=this._next)||10===t||13===t||32===t;)this._advance(!0);var t;if((t=>34===t||39===t)(this._next))return this._tokenizeString();if(gt(this._next))return this._tokenizeIdentOrKeyword();if(At(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((t=>43===t||45===t||42===t||47===t||33===t||38===t||37===t||60===t||61===t||62===t||63===t||94===t||124===t)(this._next))return this._tokenizeOperator();if((t=>40===t||41===t||91===t||93===t||123===t||125===t)(this._next))return this._tokenizeGrouper();if(this._advance(),void 0!==this._next)throw new Error(`Expected end of input, got ${this._next}`)}_advance(t){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),!0===t&&(this._tokenStart=this._index)):this._next=void 0}_getValue(t=0){const e=this._input.substring(this._tokenStart,this._index+t);return 0===t&&this._clearValue(),e}_clearValue(){this._tokenStart=this._index}_tokenizeString(){const t="unterminated string",e=this._next;for(this._advance(!0);this._next!==e;){if(void 0===this._next)throw new Error(t);if(92===this._next&&(this._advance(),void 0===this._next))throw new Error(t);this._advance()}const i=bt(wt.STRING,this._getValue().replace(/\\(.)/g,((t,e)=>{switch(e){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";default:return e}})));return this._advance(),i}_tokenizeIdentOrKeyword(){do{this._advance()}while(t=this._next,gt(t)||At(t));var t;const e=this._getValue(),i=(r=e,-1!==pt.indexOf(r)?wt.KEYWORD:wt.IDENTIFIER);var r;return bt(i,e)}_tokenizeNumber(){do{this._advance()}while(At(this._next));return 46===this._next?this._tokenizeDot():bt(wt.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),At(this._next)?this._tokenizeFraction():(this._clearValue(),bt(wt.DOT,".",13))}_tokenizeComma(){return this._advance(!0),bt(wt.COMMA,",")}_tokenizeColon(){return this._advance(!0),bt(wt.COLON,":")}_tokenizeFraction(){do{this._advance()}while(At(this._next));return bt(wt.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let t=this._getValue(2);if(-1!==vt.indexOf(t))this._advance(),this._advance();else{if(t=this._getValue(1),"=>"===t)return this._advance(),bt(wt.ARROW,t);-1!==Et.indexOf(t)&&this._advance()}return t=this._getValue(),bt(wt.OPERATOR,t,mt[t])}_tokenizeGrouper(){const t=String.fromCharCode(this._next),e=bt(wt.GROUPER,t,mt[t]);return this._advance(!0),e}}class Tt{_kind;_tokenizer;_ast;_token;_value;constructor(t,e){this._tokenizer=new yt(t),this._ast=e}parse(){return this._advance(),this._parseExpression()}_advance(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this._token?.kind} (${this._token?.value})`);const i=this._tokenizer.nextToken();this._token=i,this._kind=i?.kind,this._value=i?.value}_matches(t,e){return!(t&&this._kind!==t||e&&this._value!==e)}_parseExpression(){if(!this._token)return this._ast.empty();const t=this._parseUnary();return void 0===t?void 0:this._parsePrecedence(t,0)}_parsePrecedence(t,e){if(void 0===t)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(wt.GROUPER,"(")){const e=this._parseArguments();t=this._ast.invoke(t,void 0,e)}else if(this._matches(wt.GROUPER,"[")){const e=this._parseIndex();t=this._ast.index(t,e)}else if(this._matches(wt.DOT)){this._advance();const e=this._parseUnary();t=this._makeInvokeOrGetter(t,e)}else{if(this._matches(wt.KEYWORD))break;if(!(this._matches(wt.OPERATOR)&&this._token.precedence>=e))break;t="?"===this._value?this._parseTernary(t):this._parseBinary(t,this._token)}return t}_makeInvokeOrGetter(t,e){if(void 0===e)throw new Error("expected identifier");if("ID"===e.type)return this._ast.getter(t,e.value);if("Invoke"===e.type&&"ID"===e.receiver.type){const i=e.receiver;return this._ast.invoke(t,i.value,e.arguments)}throw new Error(`expected identifier: ${e}`)}_parseBinary(t,e){if(-1===_t.indexOf(e.value))throw new Error(`unknown operator: ${e.value}`);this._advance();let i=this._parseUnary();for(;(this._kind===wt.OPERATOR||this._kind===wt.DOT||this._kind===wt.GROUPER)&&this._token.precedence>e.precedence;)i=this._parsePrecedence(i,this._token.precedence);return this._ast.binary(t,e.value,i)}_parseUnary(){if(this._matches(wt.OPERATOR)){const t=this._value;if(this._advance(),"+"===t||"-"===t){if(this._matches(wt.INTEGER))return this._parseInteger(t);if(this._matches(wt.DECIMAL))return this._parseDecimal(t)}if(-1===ft.indexOf(t))throw new Error(`unexpected token: ${t}`);const e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(t,e)}return this._parsePrimary()}_parseTernary(t){this._advance(wt.OPERATOR,"?");const e=this._parseExpression();this._advance(wt.COLON);const i=this._parseExpression();return this._ast.ternary(t,e,i)}_parsePrimary(){switch(this._kind){case wt.KEYWORD:const t=this._value;if("this"===t)return this._advance(),this._ast.id(t);if(-1!==pt.indexOf(t))throw new Error(`unexpected keyword: ${t}`);throw new Error(`unrecognized keyword: ${t}`);case wt.IDENTIFIER:return this._parseInvokeOrIdentifier();case wt.STRING:return this._parseString();case wt.INTEGER:return this._parseInteger();case wt.DECIMAL:return this._parseDecimal();case wt.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case wt.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const t=[];do{if(this._advance(),this._matches(wt.GROUPER,"]"))break;t.push(this._parseExpression())}while(this._matches(wt.COMMA));return this._advance(wt.GROUPER,"]"),this._ast.list(t)}_parseMap(){const t={};do{if(this._advance(),this._matches(wt.GROUPER,"}"))break;const e=this._value;(this._matches(wt.STRING)||this._matches(wt.IDENTIFIER))&&this._advance(),this._advance(wt.COLON),t[e]=this._parseExpression()}while(this._matches(wt.COMMA));return this._advance(wt.GROUPER,"}"),this._ast.map(t)}_parseInvokeOrIdentifier(){const t=this._value;if("true"===t)return this._advance(),this._ast.literal(!0);if("false"===t)return this._advance(),this._ast.literal(!1);if("null"===t)return this._advance(),this._ast.literal(null);if("undefined"===t)return this._advance(),this._ast.literal(void 0);const e=this._parseIdentifier(),i=this._parseArguments();return i?this._ast.invoke(e,void 0,i):e}_parseIdentifier(){if(!this._matches(wt.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const t=this._value;return this._advance(),this._ast.id(t)}_parseArguments(){if(!this._matches(wt.GROUPER,"("))return;const t=[];do{if(this._advance(),this._matches(wt.GROUPER,")"))break;const e=this._parseExpression();t.push(e)}while(this._matches(wt.COMMA));return this._advance(wt.GROUPER,")"),t}_parseIndex(){this._advance();const t=this._parseExpression();return this._advance(wt.GROUPER,"]"),t}_parseParenOrFunction(){const t=this._parseArguments();if(this._matches(wt.ARROW)){this._advance();const e=this._parseExpression(),i=t?.map((t=>t.value))??[];return this._ast.arrowFunction(i,e)}return this._ast.paren(t[0])}_parseString(){const t=this._ast.literal(this._value);return this._advance(),t}_parseInteger(t=""){const e=this._ast.literal(parseInt(`${t}${this._value}`,10));return this._advance(),e}_parseDecimal(t=""){const e=this._ast.literal(parseFloat(`${t}${this._value}`));return this._advance(),e}}const Rt={"+":(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,e)=>e(t),"|>":(t,e)=>e(t)},Ot={"+":t=>t,"-":t=>-t,"!":t=>!t};class Nt{timeouts=new Map;debounce(t,e){return new Promise(((i,r)=>{const s=this.timeouts.get(e);s&&clearTimeout(s),this.timeouts.set(e,setTimeout((()=>{try{i(e()),this.timeouts.delete(e)}catch(t){r(t)}}),t))}))}}const It=new class{empty(){return{type:"Empty",evaluate:t=>t,getIds:t=>t}}literal(t){return{type:"Literal",value:t,evaluate(t){return this.value},getIds:t=>t}}id(t){return{type:"ID",value:t,evaluate(t){return"this"===this.value?t:t?.[this.value]},getIds(t){return t.push(this.value),t}}}unary(t,e){const i=Ot[t];return{type:"Unary",operator:t,child:e,evaluate(t){return i(this.child.evaluate(t))},getIds(t){return this.child.getIds(t)}}}binary(t,e,i){const r=Rt[e];return{type:"Binary",operator:e,left:t,right:i,evaluate(t){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 e=this.right.evaluate(t);let i,r;return"Getter"===this.left.type?(i=this.left.receiver.evaluate(t),r=this.left.name):"Index"===this.left.type?(i=this.left.receiver.evaluate(t),r=this.left.argument.evaluate(t)):"ID"===this.left.type&&(i=t,r=this.left.value),void 0===i?void 0:i[r]=e}return r(this.left.evaluate(t),this.right.evaluate(t))},getIds(t){return this.left.getIds(t),this.right.getIds(t),t}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(t,e,i){if(null!=e&&"string"!=typeof e)throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:i,evaluate(t){const i=this.receiver.evaluate(t),r=this.method?i:t?.this??t,s=this.method?i?.[e]:i,n=(this.arguments??[]).map((e=>e?.evaluate(t)));return s?.apply?.(r,n)},getIds(t){return this.receiver.getIds(t),this.arguments?.forEach((e=>e?.getIds(t))),t}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(t,e,i){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:i,evaluate(t){return this.condition.evaluate(t)?this.trueExpr.evaluate(t):this.falseExpr.evaluate(t)},getIds(t){return this.condition.getIds(t),this.trueExpr.getIds(t),this.falseExpr.getIds(t),t}}}map(t){return{type:"Map",entries:t,evaluate(e){const i={};if(t&&this.entries)for(const r in t){const t=this.entries[r];t&&(i[r]=t.evaluate(e))}return i},getIds(e){if(t&&this.entries)for(const i in t){const t=this.entries[i];t&&t.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(t){return this.items?.map((e=>e?.evaluate(t)))},getIds(t){return this.items?.forEach((e=>e?.getIds(t))),t}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(t){const e=this.params,i=this.body;return function(...r){const s=Object.fromEntries(e.map(((t,e)=>[t,r[e]]))),n=new Proxy(t??{},{set:(t,e,i)=>(s.hasOwnProperty(e)&&(s[e]=i),t[e]=i),get:(t,e)=>s.hasOwnProperty(e)?s[e]:t[e]});return i.evaluate(n)}},getIds(t){return this.body.getIds(t).filter((t=>!this.params.includes(t)))}}}};function Pt(t,e){if(t.has(e))return t.get(e);if(t.has("$parent")){return Pt(t.get("$parent"),e)}return null}function xt(t,e){if(t.has(e))return t;if(t.has("$parent")){return xt(t.get("$parent"),e)}return null}class St extends Nt{evalkeys=["$elem","$event"];expressionCache=new Map;store=new Map;observers=new Map;_observer=null;_lock=Promise.resolve();constructor(t){super();for(let[e,i]of Object.entries(t||{}))this.set(e,i)}wrapFunction(t){return(...e)=>t.call(this.$,...e)}wrapObject(t,e){return null==t||((i=t)instanceof St||i.__is_proxy__)||t.constructor!==Object&&!Array.isArray(t)?t:new Proxy(t,{deleteProperty:(t,i)=>i in t&&(delete t[i],e(),!0),set:(i,r,s,n)=>{"object"==typeof s&&null!=t&&(s=this.wrapObject(s,e));const a=Reflect.set(i,r,s,n);return e(),a},get:(t,e,i)=>"__is_proxy__"===e||Reflect.get(t,e,i)});var i}watch(t,e){this.observers.has(t)||this.observers.set(t,new Set),this.observers.get(t)?.has(e)||this.observers.get(t)?.add(e)}async notify(t,e=10){const i=Array.from(this.observers.get(t)||[]);await this.debounce(e,(()=>Promise.all(i.map((t=>t.call(this.proxify(t)))))))}get(t,e){return e&&this.watch(t,e),Pt(this.store,t)}async set(t,e){if(e===this.store.get(t))return;const i=()=>this.notify(t);e&&"function"==typeof e&&(e=this.wrapFunction(e)),e&&"object"==typeof e&&(e=this.wrapObject(e,i)),function(t,e,i){const r=xt(t,e);r?r.set(e,i):t.set(e,i)}(this.store,t,e),await i()}del(t){this.store.delete(t),this.observers.delete(t)}has(t){return this.store.has(t)}effect(t){return t.call(this.proxify(t))}proxify(t){const e=Array.from(this.store.entries()).map((([t])=>t)),i=Object.fromEntries(e.map((t=>[t,void 0])));return new Proxy(i,{get:(e,i,r)=>"string"==typeof i&&xt(this.store,i)?this.get(i,t):"$"===i?this.proxify(t):Reflect.get(this,i,r),set:(t,e,i,r)=>("string"!=typeof e||e in this?Reflect.set(this,e,i,r):this.set(e,i),!0)})}get $(){return this.proxify()}makeEvalFunction(t){if(t.includes(";"))throw new Error("Complex expressions are not supported.");let e=null;if(t.includes(" = ")){const[i,r]=t.split(" = ");e=i.trim(),t=r.trim()}return(i,r)=>{const s=((t,e)=>new Tt(t,e).parse())(t,It),n=s?.getIds([])?.map((t=>[t,r[t]??i[t]??globalThis[t]])),a=s?.evaluate(Object.fromEntries(n||[]));if(!e)return a;!function(t,e,i){const r=e.split(".");for(let e=0;e<r.length-1;e++)r[e]in t||(t[r[e]]={}),t=t[r[e]];t[r[r.length-1]]=i}(i,e,a)}}cachedExpressionFunction(t){return t=t.trim(),this.expressionCache.has(t)||this.expressionCache.set(t,this.makeEvalFunction(t)),this.expressionCache.get(t)}eval(t,e={}){const i=this._observer?this:this.$;if(this.store.has(t))return i[t];{const r=this.cachedExpressionFunction(t);try{return r(i,e)}catch(e){return console.error(`Failed to evaluate expression: ${t}`),console.error(e),null}}}}class Ct extends St{debugging=!1;dirpath="";_skipNodes=new Set;_customElements=new Map;debug(t){return this.debugging=t,this}async fetchRemote(t,e){return fetch(t,{cache:e?.cache??"default"}).then((t=>t.text()))}async fetchLocal(t,e){return this.fetchRemote(t,e)}async preprocessString(t,e){this.log("Preprocessing string content with params:\n",e);const i=this.parseHTML(t,e);return await this.preprocessNode(i,e),i}async preprocessRemote(t,e){const i={};e?.cache&&(i.cache=e.cache);const r=await fetch(t,i).then((t=>t.text()));return this.preprocessString(r,{...e,dirpath:ht(t),rootDocument:e?.rootDocument??!t.endsWith(".tpl.html")})}async preprocessLocal(t,e){const i=await this.fetchLocal(t,e);return this.preprocessString(i,{...e,dirpath:ht(t),rootDocument:e?.rootDocument??!t.endsWith(".tpl.html")})}subrenderer(){const t=(new this.constructor).debug(this.debugging);return t.set("$parent",this),t.set("$root",this.get("$root")??this),t._customElements=this._customElements,t}log(...t){this.debugging&&console.debug(...t)}async preprocessNode(t,e){e={dirpath:this.dirpath,maxdepth:10,...e};const i=new ut(Y(t,this._skipNodes)).map((async t=>{this.log("Preprocessing node:\n",ct(t,128)),await dt.resolveIncludes.call(this,t,e),await dt.rebaseRelativePaths.call(this,t,e),await dt.registerCustomElements.call(this,t,e),await dt.resolveCustomElements.call(this,t,e)}));return await Promise.all(i.generator()),t}async renderNode(t,e){for(const i of Y(t,this._skipNodes))this.log("Rendering node:\n",ct(i,128)),await dt.resolveForAttribute.call(this,i,e),await dt.resolveDataAttribute.call(this,i,e),await dt.resolveTextAttributes.call(this,i,e),await dt.resolveHtmlAttribute.call(this,i,e),await dt.resolveShowAttribute.call(this,i,e),await dt.resolveClassAttribute.call(this,i,e),await dt.resolveBindAttribute.call(this,i,e),await dt.resolveEventAttributes.call(this,i,e),await dt.resolveTextNodeExpressions.call(this,i,e),await dt.resolveCustomAttribute.call(this,i,e),await dt.resolveCustomProperty.call(this,i,e);return t}async mount(t,e){e={...e,rootNode:t},await this.preprocessNode(t,e),await this.renderNode(t,e),Q(t,"renderer",this)}}const Lt=[":data",":for",":text",":html",":show",":class",":bind",":on:click",":on:input",":on:change",":on:submit",":attr:src",":attr:href",":attr:title",":prop:checked",":prop:selected",":prop:disabled"];class kt extends Ct{impl="safe_browser";dirpath=ht(globalThis.location?.href??"http://localhost/");parseHTML(t,e={rootDocument:!1}){for(const e of Lt)t=t.replace(new RegExp(`\\s:${e.slice(1)}=`,"g"),` data-${e.slice(1).replace(":","-")}=`);t=(t=(t=t.replace(/<include(.*) src="([^"]+)"(.*)><\/include>/g,'<link $1 rel="subresource" href="$2" $3>')).replace(/<template is="([^"]+)">([\s\S]*)<\/template>/g,'<div role="template" alt="$1">$2</div>')).replace(/<(\w+)-(\w+)(.*)>([\s\S]*)<\/(\w+)-(\w+)>/g,'<div role="$1-$2" $3>$4</div>');const i=Lt.map((t=>`data-${t.slice(1).replace(":","-")}`));i.push("data-testid");const r=(new F).allowDataAttributes(i).allowClassAttributes().allowStyleAttributes().build();if(this.log("parseHTML",t),this.log("sanitized",String(r.sanitize(t))),e.rootDocument){return K(new DOMParser,r.sanitize(t),"text/html")}return r.sanitizeToFragment(t)}serializeHTML(t){return(new XMLSerializer).serializeToString(t).replace(/\s?xmlns="[^"]+"/gm,"")}preprocessLocal(t,e){return this.preprocessRemote(t,e)}createElement(t,e){return(e||document).createElement(t)}textContent(t,e){t.textContent=e}}const Dt=new kt;export{Dt as Mancha,kt as Renderer};
1
+ const t={};function e(t){0}class i{constructor(t,e){this.privateDoNotAccessOrElseWrappedAttributePrefix=e}toString(){return this.privateDoNotAccessOrElseWrappedAttributePrefix}}const r=i;function s(t){if(function(t){return t instanceof i}(t))return t.privateDoNotAccessOrElseWrappedAttributePrefix;throw new Error("")}function n(t){return Object.isFrozen(t)&&Object.isFrozen(t.raw)}function a(t){return-1===t.toString().indexOf("`")}a((t=>t``))||a((t=>t`\0`))||a((t=>t`\n`))||a((t=>t`\u0000`)),n``&&n`\0`&&n`\n`&&n`\u0000`;function o(e){const i=e[0].toLowerCase();return new r(t,i)}let l,c="google#safe";function h(){var t;return""!==c&&null!==(t=function(){if("undefined"!=typeof window)return window.trustedTypes}())&&void 0!==t?t:null}class u{constructor(t,i){e(),this.privateDoNotAccessOrElseWrappedHtml=t}toString(){return this.privateDoNotAccessOrElseWrappedHtml.toString()}}function d(e,i){return null!=i?i:new u(e,t)}"undefined"!=typeof window&&window.TrustedHTML;function p(t){var e;const i=t;return d(i,null===(e=function(){var t,e;if(void 0===l)try{l=null!==(e=null===(t=h())||void 0===t?void 0:t.createPolicy(c,{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t}))&&void 0!==e?e:null}catch(t){l=null}return l}())||void 0===e?void 0:e.createHTML(i))}function f(t){var e;if(null===(e=h())||void 0===e?void 0:e.isHTML(t))return t;if(t instanceof u)return t.privateDoNotAccessOrElseWrappedHtml;throw new Error("")}"undefined"!=typeof window&&window.TrustedScriptURL;"undefined"!=typeof window&&window.TrustedScript;function _(t,e){e.appendChild(t);let i=(new XMLSerializer).serializeToString(e);return i=i.slice(i.indexOf(">")+1,i.lastIndexOf("</")),p(i)}const m=["data:","http:","https:","mailto:","ftp:"],E=/^\s*(?!javascript:)(?:[\w+.-]+:|[^:/?#]*(?:[/?#]|$))/i;function v(t){if(!function(t){const e=!E.test(t);return e}(t))return t}function w(t){return v(t)}function b(t){const e=function(t){let e;try{e=new URL(t)}catch(t){return"https:"}return e.protocol}(t);return void 0!==e&&-1!==m.indexOf(e.toLowerCase())?t:"about:invalid#zClosurez"}function g(t,e){const i=e.createRange();i.selectNode(e.body);return function(t,e){return t.createContextualFragment(f(e))}(i,p(t))}function A(t){const e=t.nodeName;return"string"==typeof e?e:"FORM"}function y(t){return 3===t.nodeType}function T(t){const e=t.nodeType;return 1===e||"number"!=typeof e}var R,O;function N(t){try{return new URL(t,window.document.baseURI)}catch(t){return new URL("about:invalid")}}function I(t){return{valueOf:t}.valueOf()}!function(t){t[t.STYLE_TAG=0]="STYLE_TAG",t[t.STYLE_ATTRIBUTE=1]="STYLE_ATTRIBUTE",t[t.HTML_ATTRIBUTE=2]="HTML_ATTRIBUTE"}(R||(R={}));class P{constructor(t,e,i,r,s){this.allowedElements=t,this.elementPolicies=e,this.allowedGlobalAttributes=i,this.globalAttributePolicies=r,this.globallyAllowedAttributePrefixes=s}isAllowedElement(t){return"FORM"!==t&&(this.allowedElements.has(t)||this.elementPolicies.has(t))}getAttributePolicy(t,e){const i=this.elementPolicies.get(e);if(null==i?void 0:i.has(t))return i.get(t);if(this.allowedGlobalAttributes.has(t))return{policyAction:O.KEEP};const r=this.globalAttributePolicies.get(t);return r||(this.globallyAllowedAttributePrefixes&&[...this.globallyAllowedAttributePrefixes].some((e=>0===t.indexOf(e)))?{policyAction:O.KEEP}:{policyAction:O.DROP})}}!function(t){t[t.DROP=0]="DROP",t[t.KEEP=1]="KEEP",t[t.KEEP_AND_SANITIZE_URL=2]="KEEP_AND_SANITIZE_URL",t[t.KEEP_AND_NORMALIZE=3]="KEEP_AND_NORMALIZE",t[t.KEEP_AND_SANITIZE_STYLE=4]="KEEP_AND_SANITIZE_STYLE",t[t.KEEP_AND_USE_RESOURCE_URL_POLICY=5]="KEEP_AND_USE_RESOURCE_URL_POLICY",t[t.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET=6]="KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET"}(O||(O={}));const x=new Set(["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"]);const S=["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"],C=[["A",new Map([["href",{policyAction:O.KEEP_AND_SANITIZE_URL}]])],["AREA",new Map([["href",{policyAction:O.KEEP_AND_SANITIZE_URL}]])],["LINK",new Map([["href",{policyAction:O.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:O.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["IMG",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}],["srcset",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET}]])],["VIDEO",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}]])],["AUDIO",new Map([["src",{policyAction:O.KEEP_AND_USE_RESOURCE_URL_POLICY}]])]],L=["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"],k=[["dir",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I((()=>new Map([["dir",new Set(["auto","ltr","rtl"])]])))}],["async",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I((()=>new Map([["async",new Set(["async"])]])))}],["cite",{policyAction:O.KEEP_AND_SANITIZE_URL}],["loading",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I((()=>new Map([["loading",new Set(["eager","lazy"])]])))}],["poster",{policyAction:O.KEEP_AND_SANITIZE_URL}],["target",{policyAction:O.KEEP_AND_NORMALIZE,conditions:I((()=>new Map([["target",new Set(["_self","_blank"])]])))}]],D=new P(new Set(S),new Map(C),new Set(L),new Map(k));new P(new Set(I((()=>S.concat(["STYLE"])))),new Map(C),new Set(I((()=>L.concat(["id","name","class"])))),new Map(I((()=>k.concat([["style",{policyAction:O.KEEP_AND_SANITIZE_STYLE}]])))));class U{constructor(t,i,r,s,n){this.sanitizerTable=t,this.styleElementSanitizer=r,this.styleAttributeSanitizer=s,this.resourceUrlPolicy=n,this.changes=[],e()}sanitizeAssertUnchanged(t){return this.sanitize(t)}sanitize(t){const e=document.implementation.createHTMLDocument("");return _(this.sanitizeToFragmentInternal(t,e),e.body)}sanitizeToFragment(t){const e=document.implementation.createHTMLDocument("");return this.sanitizeToFragmentInternal(t,e)}sanitizeToFragmentInternal(t,e){const i=g(t,e),r=document.createTreeWalker(i,5,(t=>this.nodeFilter(t)));let s=r.nextNode();const n=e.createDocumentFragment();let a=n;for(;null!==s;){let t;if(y(s))if(this.styleElementSanitizer&&"STYLE"===a.nodeName){const e=this.styleElementSanitizer(s.data);t=this.createTextNode(e)}else t=this.sanitizeTextNode(s);else{if(!T(s)){throw new Error("")}t=this.sanitizeElementNode(s,e)}if(a.appendChild(t),s=r.firstChild(),s)a=t;else for(;!(s=r.nextSibling())&&(s=r.parentNode());)a=a.parentNode}return n}createTextNode(t){return document.createTextNode(t)}sanitizeTextNode(t){return this.createTextNode(t.data)}sanitizeElementNode(t,e){const i=A(t),r=e.createElement(i),s=t.attributes;for(const{name:t,value:e}of s){const n=this.sanitizerTable.getAttributePolicy(t,i);if(this.satisfiesAllConditions(n.conditions,s))switch(n.policyAction){case O.KEEP:z(r,t,e);break;case O.KEEP_AND_SANITIZE_URL:const s=b(e);s!==e&&this.recordChange(`Url in attribute ${t} was modified during sanitization. Original url:"${e}" was sanitized to: "${s}"`),z(r,t,s);break;case O.KEEP_AND_NORMALIZE:z(r,t,e.toLowerCase());break;case O.KEEP_AND_SANITIZE_STYLE:if(this.styleAttributeSanitizer){z(r,t,this.styleAttributeSanitizer(e))}else z(r,t,e);break;case O.KEEP_AND_USE_RESOURCE_URL_POLICY:if(this.resourceUrlPolicy){const s={type:R.HTML_ATTRIBUTE,attributeName:t,tagName:i},n=N(e),a=this.resourceUrlPolicy(n,s);a&&z(r,t,a.toString())}else z(r,t,e);break;case O.KEEP_AND_USE_RESOURCE_URL_POLICY_FOR_SRCSET:if(this.resourceUrlPolicy){const s={type:R.HTML_ATTRIBUTE,attributeName:t,tagName:i},n=M(e),a={parts:[]};for(const t of n.parts){const e=N(t.url),i=this.resourceUrlPolicy(e,s);i&&a.parts.push({url:i.toString(),descriptor:t.descriptor})}z(r,t,$(a))}else z(r,t,e);break;case O.DROP:this.recordChange(`Attribute: ${t} was dropped`)}else this.recordChange(`Not all conditions satisfied for attribute: ${t}.`)}return r}nodeFilter(t){if(y(t))return 1;if(!T(t))return 2;const e=A(t);return null===e?(this.recordChange(`Node name was null for node: ${t}`),2):this.sanitizerTable.isAllowedElement(e)?1:(this.recordChange(`Element: ${e} was dropped`),2)}recordChange(t){0}satisfiesAllConditions(t,e){var i;if(!t)return!0;for(const[r,s]of t){const t=null===(i=e.getNamedItem(r))||void 0===i?void 0:i.value;if(t&&!s.has(t))return!1}return!0}}function z(t,e,i){t.setAttribute(e,i)}function M(t){const e=[];for(const i of t.split(",")){const[t,r]=i.trim().split(/\s+/,2);e.push({url:t,descriptor:r})}return{parts:e}}function $(t){return t.parts.map((t=>{const{url:e,descriptor:i}=t;return`${e}${i?` ${i}`:""}`})).join(" , ")}class F{constructor(){this.calledBuild=!1,this.sanitizerTable=D}onlyAllowElements(t){const e=new Set,i=new Map;for(let r of t){if(r=r.toUpperCase(),!this.sanitizerTable.isAllowedElement(r))throw new Error(`Element: ${r}, is not allowed by html5_contract.textpb`);const t=this.sanitizerTable.elementPolicies.get(r);void 0!==t?i.set(r,t):e.add(r)}return this.sanitizerTable=new P(e,i,this.sanitizerTable.allowedGlobalAttributes,this.sanitizerTable.globalAttributePolicies),this}allowCustomElement(t,e){const i=new Set(this.sanitizerTable.allowedElements),r=new Map(this.sanitizerTable.elementPolicies);if(t=t.toUpperCase(),s=t,x.has(s.toUpperCase())||!/^[a-z][-_.a-z0-9]*-[-_.a-z0-9]*$/i.test(s))throw new Error(`Element: ${t} is not a custom element`);var s;if(e){const i=new Map;for(const t of e)i.set(t,{policyAction:O.KEEP});r.set(t,i)}else i.add(t);return this.sanitizerTable=new P(i,r,this.sanitizerTable.allowedGlobalAttributes,this.sanitizerTable.globalAttributePolicies),this}onlyAllowAttributes(t){const e=new Set,i=new Map,r=new Map;for(const r of t)this.sanitizerTable.allowedGlobalAttributes.has(r)&&e.add(r),this.sanitizerTable.globalAttributePolicies.has(r)&&i.set(r,this.sanitizerTable.globalAttributePolicies.get(r));for(const[e,i]of this.sanitizerTable.elementPolicies.entries()){const s=new Map;for(const[e,r]of i.entries())t.has(e)&&s.set(e,r);r.set(e,s)}return this.sanitizerTable=new P(this.sanitizerTable.allowedElements,r,e,i),this}allowDataAttributes(t){const e=new Set(this.sanitizerTable.allowedGlobalAttributes);for(const i of t){if(0!==i.indexOf("data-"))throw new Error(`data attribute: ${i} does not begin with the prefix "data-"`);e.add(i)}return this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,e,this.sanitizerTable.globalAttributePolicies),this}allowStyleAttributes(){const t=new Map(this.sanitizerTable.globalAttributePolicies);return t.set("style",{policyAction:O.KEEP_AND_SANITIZE_STYLE}),this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,this.sanitizerTable.allowedGlobalAttributes,t),this}allowClassAttributes(){const t=new Set(this.sanitizerTable.allowedGlobalAttributes);return t.add("class"),this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,t,this.sanitizerTable.globalAttributePolicies),this}allowIdAttributes(){const t=new Set(this.sanitizerTable.allowedGlobalAttributes);return t.add("id"),this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,t,this.sanitizerTable.globalAttributePolicies),this}allowIdReferenceAttributes(){const t=new Set(this.sanitizerTable.allowedGlobalAttributes);return t.add("aria-activedescendant").add("aria-controls").add("aria-labelledby").add("aria-owns").add("for").add("list"),this.sanitizerTable=new P(this.sanitizerTable.allowedElements,this.sanitizerTable.elementPolicies,t,this.sanitizerTable.globalAttributePolicies),this}withResourceUrlPolicy(t){return this.resourceUrlPolicy=t,this}build(){if(this.calledBuild)throw new Error("this sanitizer has already called build");return this.calledBuild=!0,new U(this.sanitizerTable,t,void 0,void 0,this.resourceUrlPolicy)}}function G(t,e,i,r){if(0===t.length){throw new Error("")}const n=t.map((t=>s(t))),a=i.toLowerCase();if(n.every((t=>0!==a.indexOf(t))))throw new Error(`Attribute "${i}" does not match any of the allowed prefixes.`);e.setAttribute(i,r)}function K(t,e,i){return t.parseFromString(f(e),i)}Error;const W=[o`:`,o`style`,o`class`];function*Y(t,e=new Set){const i=new Set,r=Array.from(t.childNodes).filter((t=>!e.has(t)));for(yield t;r.length;){const t=r.shift();i.has(t)||(i.add(t),yield t),t.childNodes&&Array.from(t.childNodes).filter((t=>!e.has(t))).forEach((t=>r.push(t)))}}function H(t,e){return void 0!==t?.[e]}function B(t,e){return"function"==typeof t?.[e]}function V(t){return t.replace(/-./g,(t=>t[1].toUpperCase()))}function Z(t,e){return H(t,"attribs")?t.attribs?.[e]??null:t.getAttribute?.(e)??null}function j(t,e,i=""){return Z(t,i+e)||(t.dataset?.[V(e)]??null)}function q(t,e,i){H(t,"attribs")?t.attribs[e]=i:t.setAttribute?.(e,i)}function X(t,e,i){H(t,"attribs")?t.attribs[e]=i:G(W,t,e,i)}function Q(t,e,i){switch(e){case"disabled":return void(t.disabled=i);case"selected":return void(t.selected=i);case"checked":return void(t.checked=i);default:t[e]=i}}function J(t,e){H(t,"attribs")?delete t.attribs[e]:t.removeAttribute?.(e)}function tt(t,e,i=""){J(t,`${i}${e}`),J(t,`data-${e}`)}function et(t,e,i){if(H(t,"attribs")&&H(e,"attribs"))e.attribs[i]=t.attribs[i];else if(i.startsWith("data-")){const r=V(i.slice(5));e.dataset[r]=t.dataset?.[r]}else{const r=t?.getAttribute?.(i);X(e,i,r||"")}}function it(t){if(H(t,"firstElementChild"))return t.firstElementChild;return Array.from(t.children).find((t=>1===t.nodeType))}function rt(t,...e){if(B(t,"replaceWith"))return t.replaceWith(...e);{const i=t,r=i.parentNode,s=Array.from(r.childNodes).indexOf(i);e.forEach((t=>t.parentNode=r)),r.childNodes=[].concat(Array.from(r.childNodes).slice(0,s)).concat(e).concat(Array.from(r.childNodes).slice(s+1))}}function st(t,...e){B(t,"replaceChildren")?t.replaceChildren(...e):(t.childNodes=e,e.forEach((e=>e.parentNode=t)))}function nt(t,e){return B(e,"appendChild")?t.appendChild(e):(t.childNodes.push(e),e.parentNode=t,e)}function at(t,e){return B(e,"removeChild")?t.removeChild(e):(st(t,...Array.from(t.childNodes).filter((t=>t!==e))),e)}function ot(t,e,i){return i?B(t,"insertBefore")?t.insertBefore(e,i):(rt(i,e,i),e):nt(t,e)}function lt(t,e=0){return t?t.length<=e?t:t.slice(0,e-1)+"…":""}function ct(t,e=0){return globalThis.DocumentFragment&&t instanceof DocumentFragment?Array.from(t.childNodes).map((t=>ct(t,e))).join(""):lt(t.outerHTML||t.nodeValue||String(t),e)}function ht(t){return t.includes("/")?t.split("/").slice(0,-1).join("/"):""}class ut{iterable;constructor(t){this.iterable=t}filter(t){return new ut(ut.filterGenerator(t,this.iterable))}map(t){return new ut(ut.mapGenerator(t,this.iterable))}find(t){for(const e of this.iterable)if(t(e))return e}array(){return Array.from(this.iterable)}*generator(){for(const t of this.iterable)yield t}static*filterGenerator(t,e){for(const i of e)t(i)&&(yield i)}static*mapGenerator(t,e){for(const i of e)yield t(i)}static equals(t,e){const i=t[Symbol.iterator](),r=e[Symbol.iterator]();let s=i.next(),n=r.next();for(;!s.done&&!n.done;){if(s.value!==n.value)return!1;s=i.next(),n=r.next()}return s.done===n.done}}var dt;!function(t){t.resolveIncludes=async function(t,e){const i=t,r=i.tagName?.toLowerCase();if(!["include","link"].includes(r))return;if("link"===r&&"subresource"!==Z(i,"rel"))return;this.log("include directive found in:\n",ct(t,128)),this.log("include params:",e);const s="link"===i.tagName.toLocaleLowerCase()?"href":"src",n=Z(i,s);if(!n)throw new Error(`"${s}" attribute missing from ${ct(t,128)}.`);const a=[];"include"===r&&a.push("src"),"link"===r&&a.push("rel","href");const o=e=>{const r=it(e);for(const t of Array.from(i.attributes))r&&!a.includes(t.name)&&et(i,r,t.name);rt(t,...e.childNodes)},l={...e,rootDocument:!1,maxdepth:e?.maxdepth-1};if(0===l.maxdepth)throw new Error("Maximum recursion depth reached.");if(n.includes("://")||n.startsWith("//"))this.log("Including remote file from absolute path:",n),await this.preprocessRemote(n,l).then(o);else if(e?.dirpath?.includes("://")||e?.dirpath?.startsWith("//")){const t=n.startsWith("/")?n:`${e.dirpath}/${n}`;this.log("Including remote file from relative path:",t),await this.preprocessRemote(t,l).then(o)}else if("/"===n.charAt(0))this.log("Including local file from absolute path:",n),await this.preprocessLocal(n,l).then(o);else{const t=e?.dirpath&&"."!==e?.dirpath?`${e?.dirpath}/${n}`:n;this.log("Including local file from relative path:",t),await this.preprocessLocal(t,l).then(o)}},t.rebaseRelativePaths=async function(t,e){const i=t,r=i.tagName?.toLowerCase();if(!e?.dirpath)return;const s=Z(i,"src"),n=Z(i,"href"),a=s||n;if(!a||((o=a).includes("://")||o.startsWith("/")||o.startsWith("#")||o.startsWith("data:")))return;var o;const l=`${e.dirpath}/${a}`;this.log("Rebasing relative path as:",l),H(i,"attribs")?X(i,s?"src":"href",l):"img"===r?i.src=l:"a"===r?function(t,e){const i=w(e);void 0!==i&&(t.href=i)}(i,l):"source"===r||"audio"===r||"video"===r||"track"===r||"input"===r?i.src=l:"area"===r?function(t,e){const i=w(e);void 0!==i&&(t.href=i)}(i,l):this.log("Unable to rebase relative path for element:",r)},t.registerCustomElements=async function(t,e){const i=t,r=i.tagName?.toLowerCase(),s=(Z(i,"is")||Z(i,"alt"))?.toLowerCase();if(["template","div"].includes(r)&&s){if("div"===r&&"template"!==Z(i,"role"))return;this._customElements.has(s)||(this.log(`Registering custom element: ${s}\n`,ct(i,128)),this._customElements.set(s,i),at(i.parentNode,i))}},t.resolveCustomElements=async function(t,e){const i=t,r=i.tagName?.toLowerCase();let s=r;if("div"===s&&(s=Z(i,"role")?.toLowerCase()||s),s&&this._customElements.has(s)){this.log(`Processing custom element: ${s}\n`,ct(i,128));const e=this._customElements.get(s),n=(e.content||e).cloneNode(!0),a=it(n);if(a)for(const t of Array.from(i.attributes))"div"===r&&"role"===t.name||et(i,a,t.name);const o=new ut(Y(n)).find((t=>"slot"===t.tagName?.toLowerCase()));o&&rt(o,...i.childNodes),rt(t,...n.childNodes)}},t.resolveTextNodeExpressions=async function(t,e){const i=t.nodeValue||"";if(3!==t.nodeType||!i?.trim())return;this.log("Processing node content value:\n",lt(i,128));const r=new RegExp(/{{ ([^}]+) }}/gm),s=Array.from(i.matchAll(r)).map((t=>t[1]));return this.effect((function(){let e=i;for(const i of s){const r=this.eval(i,{$elem:t});e=e.replace(`{{ ${i} }}`,String(r))}t.nodeValue=e}))},t.resolveDataAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"data",":");if(r){this.log(":data attribute found in:\n",ct(t,128)),tt(i,"data",":");const s=e?.rootNode===t?this:this.subrenderer();t.renderer=s;const n=s.eval(r,{$elem:t});if(await Promise.all(Object.entries(n).map((([t,e])=>s.set(t,e)))),s!==this)for(const e of Y(t,this._skipNodes))this._skipNodes.add(e);await s.mount(t,e)}},t.resolveClassAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"class",":");if(r){this.log(":class attribute found in:\n",ct(t,128)),tt(i,"class",":");const e=Z(i,"class")||"";return this.effect((function(){const s=this.eval(r,{$elem:t});X(i,"class",(s?`${e} ${s}`:e).trim())}))}},t.resolveTextAttributes=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"text",":");if(r){this.log(":text attribute found in:\n",ct(t,128)),tt(i,"text",":");const e=e=>this.textContent(t,e);return this.effect((function(){e(this.eval(r,{$elem:t}))}))}},t.resolveHtmlAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"html",":");return r?(this.log(":html attribute found in:\n",ct(t,128)),tt(i,"html",":"),this.effect((function(){const s=this.eval(r,{$elem:t});return new Promise((async t=>{const r=await this.preprocessString(s,e);await this.renderNode(r),st(i,r),t()}))}))):void 0},t.resolveEventAttributes=async function(t,e){if(this._skipNodes.has(t))return;const i=t;for(const e of Array.from(i.attributes||[]))if(e.name.startsWith(":on:")||e.name.startsWith("data-on-")){const r=e.name.split(":on:",2).at(-1)?.split("data-on-",2).at(-1)||"";if(!r)throw new Error(`Invalid event attribute: ${e.name}`);this.log(e.name,"attribute found in:\n",ct(t,128)),J(i,e.name);const s="submit"===r&&"FORM"===i.tagName.toUpperCase();t.addEventListener?.(r,(i=>(s&&i.preventDefault(),this.eval(e.value,{$elem:t,$event:i}))))}},t.resolveForAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"for",":")?.trim();if(r){this.log(":for attribute found in:\n",ct(t,128)),tt(i,"for",":");for(const e of Y(t,this._skipNodes))this._skipNodes.add(e);const s=Z(i,"style")||"";q(i,"style","display: none;");const n=t.parentNode,a=this.createElement("template",t.ownerDocument);ot(n,a,t),at(n,t),nt(a,t),this.log(":for template:\n",ct(a,128));const o=r.split(" in ",2);if(2!==o.length)throw new Error(`Invalid :for format: \`${r}\`. Expected "{key} in {expression}".`);const l=[],[c,h]=o;await this.effect((function(){const i=this.eval(h,{$elem:t});if(this.log(":for list items:",i),l.splice(0,l.length).forEach((t=>{at(n,t),this._skipNodes.delete(t)})),!Array.isArray(i))return console.error(`Expression did not yield a list: \`${h}\` => \`${i}\``),Promise.resolve();const r=[];for(const n of i){const i=this.subrenderer();i.set(c,n);const a=t.cloneNode(!0);q(a,"style",s),l.push(a),this._skipNodes.add(a),r.push(i.mount(a,e)),this.log("Rendered list child:\n",ct(a,128))}const o=a.nextSibling;for(const t of l)ot(n,t,o);return Promise.all(r)}))}},t.resolveBindAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"bind",":");if(r){this.log(":bind attribute found in:\n",ct(t,128));const e=["change","input"],s=Z(i,":bind:on")?.split(",")||i.dataset?.bindOn?.split(",")||e;tt(i,"bind",":"),J(i,":bind:on"),J(i,"data-bind-on");const n="checkbox"===Z(i,"type")?"checked":"value";this.effect((function(){const e=this.eval(r,{$elem:t});"checked"===n?i.checked=!!e:i.value=e}));const a=`${r} = $elem.${n}`;for(const e of s)t.addEventListener(e,(()=>this.eval(a,{$elem:t})))}},t.resolveShowAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t,r=j(i,"show",":");if(r){this.log(":show attribute found in:\n",ct(t,128)),tt(i,"show",":");const e="none"===i.style?.display?"":i.style?.display??Z(i,"style")?.split(";")?.find((t=>"display"===t.split(":")[0]))?.split(":")?.at(1)?.trim();this.effect((function(){const s=this.eval(r,{$elem:t});i.style?i.style.display=s?e:"none":X(i,"style",`display: ${s?e:"none"};`)}))}},t.resolveCustomAttribute=async function(t,e){if(this._skipNodes.has(t))return;const i=t;for(const e of Array.from(i.attributes||[])){const r=":attr:",s="data-attr-";if(e.name.startsWith(r)||e.name.startsWith(s)){this.log(e.name,"attribute found in:\n",ct(t,128)),J(i,e.name);const n=e.name.split(r,2).at(-1)?.split(s,2).at(-1);this.effect((function(){const r=this.eval(e.value,{$elem:t});q(i,n,r)}))}}},t.resolveCustomProperty=async function(t,e){if(this._skipNodes.has(t))return;const i=t;for(const e of Array.from(i.attributes||[])){const r=":prop:",s="data-prop-";if(e.name.startsWith(r)||e.name.startsWith(s)){this.log(e.name,"property found in:\n",ct(t,128)),J(i,e.name);const n=e.name.split(r,2).at(-1)?.split(s,2).at(-1),a=V(n);this.effect((function(){const r=this.eval(e.value,{$elem:t});Q(i,a,r)}))}}}}(dt||(dt={}));const pt=["this"],ft=["+","-","!"],_t=["=","+","-","*","/","%","^","==","!=",">","<",">=","<=","||","&&","??","&","===","!==","|","|>"],mt={"!":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},Et=["==","!=","<=",">=","||","&&","??","|>"],vt=["===","!=="];var wt;!function(t){t[t.STRING=1]="STRING",t[t.IDENTIFIER=2]="IDENTIFIER",t[t.DOT=3]="DOT",t[t.COMMA=4]="COMMA",t[t.COLON=5]="COLON",t[t.INTEGER=6]="INTEGER",t[t.DECIMAL=7]="DECIMAL",t[t.OPERATOR=8]="OPERATOR",t[t.GROUPER=9]="GROUPER",t[t.KEYWORD=10]="KEYWORD",t[t.ARROW=11]="ARROW"}(wt||(wt={}));const bt=(t,e,i=0)=>({kind:t,value:e,precedence:i}),gt=t=>95===t||36===t||65<=(t&=-33)&&t<=90,At=t=>48<=t&&t<=57;class yt{_input;_index=-1;_tokenStart=0;_next;constructor(t){this._input=t,this._advance()}nextToken(){for(;9===(t=this._next)||10===t||13===t||32===t;)this._advance(!0);var t;if((t=>34===t||39===t)(this._next))return this._tokenizeString();if(gt(this._next))return this._tokenizeIdentOrKeyword();if(At(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((t=>43===t||45===t||42===t||47===t||33===t||38===t||37===t||60===t||61===t||62===t||63===t||94===t||124===t)(this._next))return this._tokenizeOperator();if((t=>40===t||41===t||91===t||93===t||123===t||125===t)(this._next))return this._tokenizeGrouper();if(this._advance(),void 0!==this._next)throw new Error(`Expected end of input, got ${this._next}`)}_advance(t){this._index++,this._index<this._input.length?(this._next=this._input.charCodeAt(this._index),!0===t&&(this._tokenStart=this._index)):this._next=void 0}_getValue(t=0){const e=this._input.substring(this._tokenStart,this._index+t);return 0===t&&this._clearValue(),e}_clearValue(){this._tokenStart=this._index}_tokenizeString(){const t="unterminated string",e=this._next;for(this._advance(!0);this._next!==e;){if(void 0===this._next)throw new Error(t);if(92===this._next&&(this._advance(),void 0===this._next))throw new Error(t);this._advance()}const i=bt(wt.STRING,this._getValue().replace(/\\(.)/g,((t,e)=>{switch(e){case"n":return"\n";case"r":return"\r";case"t":return"\t";case"b":return"\b";case"f":return"\f";default:return e}})));return this._advance(),i}_tokenizeIdentOrKeyword(){do{this._advance()}while(t=this._next,gt(t)||At(t));var t;const e=this._getValue(),i=(r=e,-1!==pt.indexOf(r)?wt.KEYWORD:wt.IDENTIFIER);var r;return bt(i,e)}_tokenizeNumber(){do{this._advance()}while(At(this._next));return 46===this._next?this._tokenizeDot():bt(wt.INTEGER,this._getValue())}_tokenizeDot(){return this._advance(),At(this._next)?this._tokenizeFraction():(this._clearValue(),bt(wt.DOT,".",13))}_tokenizeComma(){return this._advance(!0),bt(wt.COMMA,",")}_tokenizeColon(){return this._advance(!0),bt(wt.COLON,":")}_tokenizeFraction(){do{this._advance()}while(At(this._next));return bt(wt.DECIMAL,this._getValue())}_tokenizeOperator(){this._advance();let t=this._getValue(2);if(-1!==vt.indexOf(t))this._advance(),this._advance();else{if(t=this._getValue(1),"=>"===t)return this._advance(),bt(wt.ARROW,t);-1!==Et.indexOf(t)&&this._advance()}return t=this._getValue(),bt(wt.OPERATOR,t,mt[t])}_tokenizeGrouper(){const t=String.fromCharCode(this._next),e=bt(wt.GROUPER,t,mt[t]);return this._advance(!0),e}}class Tt{_kind;_tokenizer;_ast;_token;_value;constructor(t,e){this._tokenizer=new yt(t),this._ast=e}parse(){return this._advance(),this._parseExpression()}_advance(t,e){if(!this._matches(t,e))throw new Error(`Expected kind ${t} (${e}), was ${this._token?.kind} (${this._token?.value})`);const i=this._tokenizer.nextToken();this._token=i,this._kind=i?.kind,this._value=i?.value}_matches(t,e){return!(t&&this._kind!==t||e&&this._value!==e)}_parseExpression(){if(!this._token)return this._ast.empty();const t=this._parseUnary();return void 0===t?void 0:this._parsePrecedence(t,0)}_parsePrecedence(t,e){if(void 0===t)throw new Error("Expected left to be defined.");for(;this._token;)if(this._matches(wt.GROUPER,"(")){const e=this._parseArguments();t=this._ast.invoke(t,void 0,e)}else if(this._matches(wt.GROUPER,"[")){const e=this._parseIndex();t=this._ast.index(t,e)}else if(this._matches(wt.DOT)){this._advance();const e=this._parseUnary();t=this._makeInvokeOrGetter(t,e)}else{if(this._matches(wt.KEYWORD))break;if(!(this._matches(wt.OPERATOR)&&this._token.precedence>=e))break;t="?"===this._value?this._parseTernary(t):this._parseBinary(t,this._token)}return t}_makeInvokeOrGetter(t,e){if(void 0===e)throw new Error("expected identifier");if("ID"===e.type)return this._ast.getter(t,e.value);if("Invoke"===e.type&&"ID"===e.receiver.type){const i=e.receiver;return this._ast.invoke(t,i.value,e.arguments)}throw new Error(`expected identifier: ${e}`)}_parseBinary(t,e){if(-1===_t.indexOf(e.value))throw new Error(`unknown operator: ${e.value}`);this._advance();let i=this._parseUnary();for(;(this._kind===wt.OPERATOR||this._kind===wt.DOT||this._kind===wt.GROUPER)&&this._token.precedence>e.precedence;)i=this._parsePrecedence(i,this._token.precedence);return this._ast.binary(t,e.value,i)}_parseUnary(){if(this._matches(wt.OPERATOR)){const t=this._value;if(this._advance(),"+"===t||"-"===t){if(this._matches(wt.INTEGER))return this._parseInteger(t);if(this._matches(wt.DECIMAL))return this._parseDecimal(t)}if(-1===ft.indexOf(t))throw new Error(`unexpected token: ${t}`);const e=this._parsePrecedence(this._parsePrimary(),13);return this._ast.unary(t,e)}return this._parsePrimary()}_parseTernary(t){this._advance(wt.OPERATOR,"?");const e=this._parseExpression();this._advance(wt.COLON);const i=this._parseExpression();return this._ast.ternary(t,e,i)}_parsePrimary(){switch(this._kind){case wt.KEYWORD:const t=this._value;if("this"===t)return this._advance(),this._ast.id(t);if(-1!==pt.indexOf(t))throw new Error(`unexpected keyword: ${t}`);throw new Error(`unrecognized keyword: ${t}`);case wt.IDENTIFIER:return this._parseInvokeOrIdentifier();case wt.STRING:return this._parseString();case wt.INTEGER:return this._parseInteger();case wt.DECIMAL:return this._parseDecimal();case wt.GROUPER:return"("===this._value?this._parseParenOrFunction():"{"===this._value?this._parseMap():"["===this._value?this._parseList():void 0;case wt.COLON:throw new Error('unexpected token ":"');default:return}}_parseList(){const t=[];do{if(this._advance(),this._matches(wt.GROUPER,"]"))break;t.push(this._parseExpression())}while(this._matches(wt.COMMA));return this._advance(wt.GROUPER,"]"),this._ast.list(t)}_parseMap(){const t={};do{if(this._advance(),this._matches(wt.GROUPER,"}"))break;const e=this._value;(this._matches(wt.STRING)||this._matches(wt.IDENTIFIER))&&this._advance(),this._advance(wt.COLON),t[e]=this._parseExpression()}while(this._matches(wt.COMMA));return this._advance(wt.GROUPER,"}"),this._ast.map(t)}_parseInvokeOrIdentifier(){const t=this._value;if("true"===t)return this._advance(),this._ast.literal(!0);if("false"===t)return this._advance(),this._ast.literal(!1);if("null"===t)return this._advance(),this._ast.literal(null);if("undefined"===t)return this._advance(),this._ast.literal(void 0);const e=this._parseIdentifier(),i=this._parseArguments();return i?this._ast.invoke(e,void 0,i):e}_parseIdentifier(){if(!this._matches(wt.IDENTIFIER))throw new Error(`expected identifier: ${this._value}`);const t=this._value;return this._advance(),this._ast.id(t)}_parseArguments(){if(!this._matches(wt.GROUPER,"("))return;const t=[];do{if(this._advance(),this._matches(wt.GROUPER,")"))break;const e=this._parseExpression();t.push(e)}while(this._matches(wt.COMMA));return this._advance(wt.GROUPER,")"),t}_parseIndex(){this._advance();const t=this._parseExpression();return this._advance(wt.GROUPER,"]"),t}_parseParenOrFunction(){const t=this._parseArguments();if(this._matches(wt.ARROW)){this._advance();const e=this._parseExpression(),i=t?.map((t=>t.value))??[];return this._ast.arrowFunction(i,e)}return this._ast.paren(t[0])}_parseString(){const t=this._ast.literal(this._value);return this._advance(),t}_parseInteger(t=""){const e=this._ast.literal(parseInt(`${t}${this._value}`,10));return this._advance(),e}_parseDecimal(t=""){const e=this._ast.literal(parseFloat(`${t}${this._value}`));return this._advance(),e}}const Rt={"+":(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,e)=>e(t),"|>":(t,e)=>e(t)},Ot={"+":t=>t,"-":t=>-t,"!":t=>!t};class Nt{timeouts=new Map;debounce(t,e){return new Promise(((i,r)=>{const s=this.timeouts.get(e);s&&clearTimeout(s),this.timeouts.set(e,setTimeout((()=>{try{i(e()),this.timeouts.delete(e)}catch(t){r(t)}}),t))}))}}const It=new class{empty(){return{type:"Empty",evaluate:t=>t,getIds:t=>t}}literal(t){return{type:"Literal",value:t,evaluate(t){return this.value},getIds:t=>t}}id(t){return{type:"ID",value:t,evaluate(t){return"this"===this.value?t:t?.[this.value]},getIds(t){return t.push(this.value),t}}}unary(t,e){const i=Ot[t];return{type:"Unary",operator:t,child:e,evaluate(t){return i(this.child.evaluate(t))},getIds(t){return this.child.getIds(t)}}}binary(t,e,i){const r=Rt[e];return{type:"Binary",operator:e,left:t,right:i,evaluate(t){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 e=this.right.evaluate(t);let i,r;return"Getter"===this.left.type?(i=this.left.receiver.evaluate(t),r=this.left.name):"Index"===this.left.type?(i=this.left.receiver.evaluate(t),r=this.left.argument.evaluate(t)):"ID"===this.left.type&&(i=t,r=this.left.value),void 0===i?void 0:i[r]=e}return r(this.left.evaluate(t),this.right.evaluate(t))},getIds(t){return this.left.getIds(t),this.right.getIds(t),t}}}getter(t,e){return{type:"Getter",receiver:t,name:e,evaluate(t){return this.receiver.evaluate(t)?.[this.name]},getIds(t){return this.receiver.getIds(t),t}}}invoke(t,e,i){if(null!=e&&"string"!=typeof e)throw new Error("method not a string");return{type:"Invoke",receiver:t,method:e,arguments:i,evaluate(t){const i=this.receiver.evaluate(t),r=this.method?i:t?.this??t,s=this.method?i?.[e]:i,n=(this.arguments??[]).map((e=>e?.evaluate(t)));return s?.apply?.(r,n)},getIds(t){return this.receiver.getIds(t),this.arguments?.forEach((e=>e?.getIds(t))),t}}}paren(t){return t}index(t,e){return{type:"Index",receiver:t,argument:e,evaluate(t){return this.receiver.evaluate(t)?.[this.argument.evaluate(t)]},getIds(t){return this.receiver.getIds(t),t}}}ternary(t,e,i){return{type:"Ternary",condition:t,trueExpr:e,falseExpr:i,evaluate(t){return this.condition.evaluate(t)?this.trueExpr.evaluate(t):this.falseExpr.evaluate(t)},getIds(t){return this.condition.getIds(t),this.trueExpr.getIds(t),this.falseExpr.getIds(t),t}}}map(t){return{type:"Map",entries:t,evaluate(e){const i={};if(t&&this.entries)for(const r in t){const t=this.entries[r];t&&(i[r]=t.evaluate(e))}return i},getIds(e){if(t&&this.entries)for(const i in t){const t=this.entries[i];t&&t.getIds(e)}return e}}}list(t){return{type:"List",items:t,evaluate(t){return this.items?.map((e=>e?.evaluate(t)))},getIds(t){return this.items?.forEach((e=>e?.getIds(t))),t}}}arrowFunction(t,e){return{type:"ArrowFunction",params:t,body:e,evaluate(t){const e=this.params,i=this.body;return function(...r){const s=Object.fromEntries(e.map(((t,e)=>[t,r[e]]))),n=new Proxy(t??{},{set:(t,e,i)=>(s.hasOwnProperty(e)&&(s[e]=i),t[e]=i),get:(t,e)=>s.hasOwnProperty(e)?s[e]:t[e]});return i.evaluate(n)}},getIds(t){return this.body.getIds(t).filter((t=>!this.params.includes(t)))}}}};function Pt(t,e){if(t.has(e))return t.get(e);if(t.has("$parent")){return Pt(t.get("$parent"),e)}return null}function xt(t,e){if(t.has(e))return t;if(t.has("$parent")){return xt(t.get("$parent"),e)}return null}class St extends Nt{evalkeys=["$elem","$event"];expressionCache=new Map;store=new Map;observers=new Map;_observer=null;_lock=Promise.resolve();constructor(t){super();for(let[e,i]of Object.entries(t||{}))this.set(e,i)}wrapFunction(t){return(...e)=>t.call(this.$,...e)}wrapObject(t,e){return null==t||((i=t)instanceof St||i.__is_proxy__)||t.constructor!==Object&&!Array.isArray(t)?t:new Proxy(t,{deleteProperty:(t,i)=>i in t&&(delete t[i],e(),!0),set:(i,r,s,n)=>{"object"==typeof s&&null!=t&&(s=this.wrapObject(s,e));const a=Reflect.set(i,r,s,n);return e(),a},get:(t,e,i)=>"__is_proxy__"===e||Reflect.get(t,e,i)});var i}watch(t,e){this.observers.has(t)||this.observers.set(t,new Set),this.observers.get(t)?.has(e)||this.observers.get(t)?.add(e)}async notify(t,e=10){const i=Array.from(this.observers.get(t)||[]);await this.debounce(e,(()=>Promise.all(i.map((t=>t.call(this.proxify(t)))))))}get(t,e){return e&&this.watch(t,e),Pt(this.store,t)}async set(t,e){if(e===this.store.get(t))return;const i=()=>this.notify(t);e&&"function"==typeof e&&(e=this.wrapFunction(e)),e&&"object"==typeof e&&(e=this.wrapObject(e,i)),function(t,e,i){const r=xt(t,e);r?r.set(e,i):t.set(e,i)}(this.store,t,e),await i()}del(t){this.store.delete(t),this.observers.delete(t)}has(t){return this.store.has(t)}effect(t){return t.call(this.proxify(t))}proxify(t){const e=Array.from(this.store.entries()).map((([t])=>t)),i=Object.fromEntries(e.map((t=>[t,void 0])));return new Proxy(i,{get:(e,i,r)=>"string"==typeof i&&xt(this.store,i)?this.get(i,t):"$"===i?this.proxify(t):Reflect.get(this,i,r),set:(t,e,i,r)=>("string"!=typeof e||e in this?Reflect.set(this,e,i,r):this.set(e,i),!0)})}get $(){return this.proxify()}makeEvalFunction(t){if(t.includes(";"))throw new Error("Complex expressions are not supported.");let e=null;if(t.includes(" = ")){const[i,r]=t.split(" = ");e=i.trim(),t=r.trim()}return(i,r)=>{const s=((t,e)=>new Tt(t,e).parse())(t,It),n=s?.getIds([])?.map((t=>[t,r[t]??i[t]??globalThis[t]])),a=s?.evaluate(Object.fromEntries(n||[]));if(!e)return a;!function(t,e,i){const r=e.split(".");for(let e=0;e<r.length-1;e++)r[e]in t||(t[r[e]]={}),t=t[r[e]];t[r[r.length-1]]=i}(i,e,a)}}cachedExpressionFunction(t){return t=t.trim(),this.expressionCache.has(t)||this.expressionCache.set(t,this.makeEvalFunction(t)),this.expressionCache.get(t)}eval(t,e={}){const i=this._observer?this:this.$;if(this.store.has(t))return i[t];{const r=this.cachedExpressionFunction(t);try{return r(i,e)}catch(e){return console.error(`Failed to evaluate expression: ${t}`),console.error(e),null}}}}class Ct extends St{debugging=!1;dirpath="";_skipNodes=new Set;_customElements=new Map;debug(t){return this.debugging=t,this}async fetchRemote(t,e){return fetch(t,{cache:e?.cache??"default"}).then((t=>t.text()))}async fetchLocal(t,e){return this.fetchRemote(t,e)}async preprocessString(t,e){this.log("Preprocessing string content with params:\n",e);const i=this.parseHTML(t,e);return await this.preprocessNode(i,e),i}async preprocessRemote(t,e){const i={};e?.cache&&(i.cache=e.cache);const r=await fetch(t,i).then((t=>t.text()));return this.preprocessString(r,{...e,dirpath:ht(t),rootDocument:e?.rootDocument??!t.endsWith(".tpl.html")})}async preprocessLocal(t,e){const i=await this.fetchLocal(t,e);return this.preprocessString(i,{...e,dirpath:ht(t),rootDocument:e?.rootDocument??!t.endsWith(".tpl.html")})}subrenderer(){const t=(new this.constructor).debug(this.debugging);return t.set("$parent",this),t.set("$root",this.get("$root")??this),t._customElements=this._customElements,t}log(...t){this.debugging&&console.debug(...t)}async preprocessNode(t,e){e={dirpath:this.dirpath,maxdepth:10,...e};const i=new ut(Y(t,this._skipNodes)).map((async t=>{this.log("Preprocessing node:\n",ct(t,128)),await dt.resolveIncludes.call(this,t,e),await dt.rebaseRelativePaths.call(this,t,e),await dt.registerCustomElements.call(this,t,e),await dt.resolveCustomElements.call(this,t,e)}));return await Promise.all(i.generator()),t}async renderNode(t,e){for(const i of Y(t,this._skipNodes))this.log("Rendering node:\n",ct(i,128)),await dt.resolveForAttribute.call(this,i,e),await dt.resolveDataAttribute.call(this,i,e),await dt.resolveTextAttributes.call(this,i,e),await dt.resolveHtmlAttribute.call(this,i,e),await dt.resolveShowAttribute.call(this,i,e),await dt.resolveClassAttribute.call(this,i,e),await dt.resolveBindAttribute.call(this,i,e),await dt.resolveEventAttributes.call(this,i,e),await dt.resolveTextNodeExpressions.call(this,i,e),await dt.resolveCustomAttribute.call(this,i,e),await dt.resolveCustomProperty.call(this,i,e);return t}async mount(t,e){e={...e,rootNode:t},await this.preprocessNode(t,e),await this.renderNode(t,e),Q(t,"renderer",this)}}const Lt=[":data",":for",":text",":html",":show",":class",":bind",":on:click",":on:input",":on:change",":on:submit",":attr:src",":attr:href",":attr:title",":prop:checked",":prop:selected",":prop:disabled"];class kt extends Ct{impl="safe_browser";dirpath=ht(globalThis.location?.href??"http://localhost/");parseHTML(t,e={rootDocument:!1}){for(const e of Lt)t=t.replace(new RegExp(`\\s:${e.slice(1)}=`,"g"),` data-${e.slice(1).replace(":","-")}=`);t=(t=(t=t.replace(/<include(.*) src="([^"]+)"(.*)><\/include>/g,'<link $1 rel="subresource" href="$2" $3>')).replace(/<template is="([^"]+)">([\s\S]*)<\/template>/g,'<div role="template" alt="$1">$2</div>')).replace(/<(\w+)-(\w+)(.*)>([\s\S]*)<\/(\w+)-(\w+)>/g,'<div role="$1-$2" $3>$4</div>');const i=Lt.map((t=>`data-${t.slice(1).replace(":","-")}`));i.push("data-testid");const r=(new F).allowDataAttributes(i).allowClassAttributes().allowStyleAttributes().build();if(this.log("parseHTML",t),this.log("sanitized",String(r.sanitize(t))),e.rootDocument){return K(new DOMParser,r.sanitize(t),"text/html")}return r.sanitizeToFragment(t)}serializeHTML(t){return(new XMLSerializer).serializeToString(t).replace(/\s?xmlns="[^"]+"/gm,"")}preprocessLocal(t,e){return this.preprocessRemote(t,e)}createElement(t,e){return(e||document).createElement(t)}textContent(t,e){t.textContent=e}}const Dt=new kt;export{Dt as Mancha,kt as Renderer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mancha",
3
- "version": "0.12.16",
3
+ "version": "0.13.0",
4
4
  "description": "Javscript HTML rendering engine",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -65,4 +65,4 @@
65
65
  "webpack-cli": "^5.1.4",
66
66
  "yargs": "^17.7.2"
67
67
  }
68
- }
68
+ }