@hyperfixi/engine 7.5.1 → 7.6.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/CHANGELOG.md +103 -0
- package/README.md +109 -30
- package/dist/additions.d.ts +11 -4
- package/dist/common.js +247 -201
- package/dist/common.min.js +9 -9
- package/dist/core.js +55 -3
- package/dist/core.min.js +9 -9
- package/dist/engine.d.ts +9 -1
- package/dist/ext/socket.d.ts +32 -0
- package/dist/ext/socket.dev.js +139 -0
- package/dist/ext/socket.esm.js +127 -0
- package/dist/ext/socket.js +1 -0
- package/dist/ext/tailwind.d.ts +16 -0
- package/dist/ext/tailwind.dev.js +30 -0
- package/dist/ext/tailwind.esm.js +16 -0
- package/dist/ext/tailwind.js +1 -0
- package/dist/full.js +82 -12
- package/dist/full.min.js +15 -15
- package/dist/hyperfixi-hs.dev.js +82 -12
- package/dist/hyperfixi-hs.js +15 -15
- package/dist/index.d.ts +1 -2
- package/dist/index.js +68 -12
- package/dist/kit.d.ts +13 -0
- package/dist/minimal.js +56 -10
- package/dist/minimal.min.js +8 -8
- package/dist/parser.d.ts +15 -2
- package/dist/statements.d.ts +1 -1
- package/package.json +8 -1
package/dist/common.min.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";(()=>{var oe=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function",x=(e,t)=>oe(e)?e.then(t):t(e),C=(e,t)=>e.some(oe)?Promise.all(e).then(t):t(e),M=e=>e!=null,q=e=>typeof e=="function",v=(e,t)=>M(e)?e[t]:void 0,ie=(e,t,n)=>{M(e)&&(e[t]=n)},R=e=>e instanceof Element
|
|
2
|
-
`,r:"\r",t:" ",v:"\v"},
|
|
3
|
-
`,
|
|
4
|
-
`?(i++,o=0):o++,s),p=y=>({type:y,value:"",start:r,end:r+1,line:i,column:o}),f=(y,w)=>(y.value=w,y.end=r,y),d=y=>{let w="";for(;a()&&y(a());)w+=
|
|
5
|
-
`),c();else if(ze(y))n.push(f(p("WHITESPACE"),d(ze)));else if(!h()&&y==="."&&(V(w)||w==="{"||w==="-"))n.push(E("CLASS_REF",!0));else if(!h()&&y==="#"&&(V(w)||w==="{"))n.push(E("ID_REF",!1));else if(y==="@"||y==="["&&w==="@")n.push(H());else if(y==="*"&&V(w)){let A=p("STYLE_REF");n.push(f(A,c()+d(L=>V(L)||L==="-")))}else if(m()&&(V(y)||y==="\\"))n.push(P());else if(!m()&&(V(y)||y==="_"||y==="$"))n.push(_());else if(B(y))n.push(I());else if(!m()&&(y==='"'||y==="`"))n.push(N());else if(!m()&&y==="'")n.push(ne()?N():O());else if(Et.has(y))s==="$"&&y==="{"&&u++,y==="}"&&u--,n.push(O());else if(m()||y==="`"){let A=p("RESERVED");n.push(f(A,c()))}else throw new Error("Unknown token: "+y+" ")}return n}function g(e){return e.match("the"),Pn(e)}function Pn(e){let t=kt(e),n,r=()=>e.match("and")??e.match("or");for(let o=r();o;o=r())n??=o.value,n!==o.value&&e.err("You must parenthesize logical operations with different operators"),t=Rn(o.value,t,kt(e));return t}function Rn(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>x(t.ev(o),i=>!!i===r?i:n.ev(o))}}var Sn={"+":(e,t)=>Array.isArray(e)?e.concat(t):b(e)+b(t),"-":(e,t)=>b(e)-b(t),"*":(e,t)=>b(e)*b(t),"/":(e,t)=>b(e)/b(t),mod:(e,t)=>b(e)%b(t)};function Je(e){let t=Ze(e),n,r=()=>e.matchAnyOp("+","-","*","/")??e.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&e.err("You must parenthesize math operations with different operators");let i=t,s=Ze(e),u=Sn[o.value];t={type:"mathOperator",operator:o.value,left:i,right:s,start:i.start,end:s.end,ev:l=>C([i.ev(l),s.ev(l)],([c,p])=>u(c,p))}}return t}function Ze(e){let t=z(e);for(let n=!0;n;){n=!1;for(let r of e.g.collections){let o=r(e,t);if(o){t=o,n=!0;break}}}return t}function z(e){e.match("the");let t=e.pos();if(e.match("not"))return Ke(e,"logicalNot",t,z(e),n=>!n);if(e.match("no"))return Ke(e,"noExpression",t,Ze(e),Ue);for(let n of e.g.unaries){let r=n(e);if(r)return D(e,r)}return In(e)}function Ke(e,t,n,r,o,i=t!=="negativeNumber"){let s={type:t,root:r,start:n,end:e.endPos(),ev:u=>x(r.ev(u),a=>o(a,u))};return i?D(e,s):s}var An="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function In(e){let t=Tt(e),n=e.matchAny(...An)??e.matchOp("%");if(n)return bt(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return bt(e,"timeExpression",t,r);for(let o of e.g.postfixes){let i=o(e,t);if(i)return i}return t}function bt(e,t,n,r){let o=s=>typeof r=="number"?b(s)*r:`${s}${r}`,i={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:s=>x(n.ev(s),o)};return n.stat&&(i.stat=()=>o(ye(n))),i}function Tt(e){let t=e.pos();return e.matchOp("-")?Ke(e,"negativeNumber",t,Tt(e),n=>-b(n)):Se(e)}function Se(e){let t=_n(e);return t?D(e,t):e.err("Unexpected value: "+e.cur().value)}function se(e){return e.match("the"),tt(e,Se(e))}function tt(e,t){let n=Ae(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function Ae(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&On(t.expr);)t=t.expr;return t}var On=e=>q(v(e,"ev"));function ye(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function Ln(e){let t=e.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(t)return{operator:t.value,right:!0,isType:!1};let n=(a,l=!0,c=!1)=>({operator:a,right:l,isType:c}),r=()=>e.match("equal")&&e.match("to"),o=(a,l)=>(e.req("than"),e.match("or")?(e.req("equal"),e.req("to"),n(l)):n(a));if(e.match("is")||e.match("am")){let a=!!e.match("not"),l=a?"not ":"";return e.match("in")?n(l+"in"):e.match("a")||e.match("an")?n(l+"a",!1,!0):e.match("empty")?n(l+"empty",!1):e.match("between")?n(l+"between"):!a&&e.match("less")?o("<","<="):!a&&e.match("greater")?o(">",">="):e.match("really")?(r(),n(a?"!==":"===")):e.match("equal")?(e.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(e.match("equals"))return n("==");if(e.match("really"))return e.req("equals"),n("===");if(e.matchAny("exist","exists"))return n("exist",!1);let i=!!e.matchAny("do","does");i&&e.req("not");let s=i?"not ":"",u=(a,l)=>e.match(a)??(i&&a!=="match"&&a!=="contain"?void 0:e.match(l));if(u("match","matches"))return n(s+"match");if(u("contain","contains"))return n(s+"contain");if(i&&e.match("exist"))return n("not exist",!1);if(u("include","includes"))return n(s+"include");if(e.match(i?"start":"starts"))return e.req("with"),n(s+"start with");if(e.match(i?"end":"ends"))return e.req("with"),n(s+"end with");if(u("precede","precedes"))return n(s+"precede");if(u("follow","follows"))return n(s+"follow");i&&e.expected("matches","contains","starts with","ends with","precede","follow")}function kt(e){let t=Je(e),n=Ln(e);if(!n)return t;let{operator:r}=n,o,i=!0,s,u;n.isType?(o=e.reqType("IDENTIFIER").value,i=!e.matchOp("!")):n.right&&(s=Je(e),r.endsWith("match")&&(u=s.css));let a;r.endsWith("between")&&(e.req("and"),a=Je(e));let l=!1;e.match("ignoring")&&(e.req("case"),l=!0);let c=d=>l&&typeof d=="string"?d.toLowerCase():d,p=s?.type==="symbol"&&"scope"in s&&s.scope==="local"&&s.name!=="undefined"&&s.name!=="null"?s.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:s,right2:a,typeName:o,ignoringCase:l,start:t.start,end:e.endPos(),ev:d=>C([t.ev(d),u??s?.ev(d),a?.ev(d)],([m,h,E])=>{if(o){let N=ht(m,o,i);return r==="a"?N:!N}if(p&&h===void 0&&(r==="is"||r==="is not")){let N=!!ce(m,p);return r==="is"?N:!N}return Pt(r,c(m),c(h),E)})}}function Nt(e,t){let n=v(e,"contains")??v(e,"includes");if(!q(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function Fn(e,t){let n=v(e,"match")??v(e,"matches");if(!q(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var Ct=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function Pt(e,t,n,r){if(e==="not between")return b(t)<b(n)||b(t)>b(r);if(e.startsWith("not "))return!Pt(e.slice(4),t,n,r);switch(e){case"is":case"==":return t==n;case"is not":case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return b(t)<b(n);case">":return b(t)>b(n);case"<=":return b(t)<=b(n);case">=":return b(t)>=b(n);case"match":return t!=null&&Fn(t,n);case"in":return n!=null&&Nt(n,t);case"contain":case"include":return t!=null&&Nt(t,n);case"start with":return t!=null&&String(t).startsWith(String(n));case"end with":return t!=null&&String(t).endsWith(String(n));case"between":return b(t)>=b(n)&&b(t)<=b(r);case"precede":return Ct(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return Ct(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return Ue(t);case"exist":return pt(t)}throw new Error("Unknown comparison : "+e)}function _n(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),Xe("number",parseFloat(t.value),t);case"STRING":return Hn(e);case"ID_REF":return Gn(e);case"CLASS_REF":return Z(e);case"ATTRIBUTE_REF":return Q(e);case"STYLE_REF":return Lt(e)}if(t.op){if(t.value==="(")return Mn(e);if(t.value==="[")return Dn(e);if(t.value==="{")return nt(e);if(t.value==="<")return Wn(e)}let n=e.match("true")??e.match("false");if(n)return Xe("boolean",n.value==="true",n);let r=e.match("null");if(r)return Xe("null",null,r);for(let o of e.g.leaves){let i=o(e);if(i)return i}return It(e)}function Xe(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function Mn(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>g(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var qn=(e,t)=>C(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function Rt(e,t){let n=e.child(he(t,!0),t),r=[],o="";do{o+=n.lastWs();let i=n.cur();if(i.value==="$"){n.consume();let s=n.matchOp("{");r.push(o,g(n)),o="",s&&n.reqOp("}")}else i.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function Hn(e){let t=e.consume(),n=t.value,r={type:"string",value:n,start:t.start,end:t.end,ev:()=>n};if(t.template){let o=r.parts=Rt(e,n);r.ev=i=>qn(o,i)}else r.stat=()=>n;return r}function Dn(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(g(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>C(n.map(o=>o.ev(r)),o=>o)}}function nt(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let i=e.matchType("STRING");if(i)n.push(i.value);else if(e.matchOp("["))n.push(g(e)),e.reqOp("]");else{let s="";for(let u=e.matchType("IDENTIFIER")??e.matchOp("-");u;u=e.matchType("IDENTIFIER")??e.matchOp("-"))s+=u.value;n.push(s)}e.reqOp(":"),r.push(g(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:i=>C([...n.map(s=>typeof s=="string"?s:s.ev(i)),...r.map(s=>s.ev(i))],s=>Object.fromEntries(n.map((u,a)=>[String(s[a]),s[n.length+a]])))}}function St(e){if(!e.matchOp("("))return;let t=e.last.start,n=jn(e,t);return e.reqOp(")"),n.end=e.endPos(),n}function jn(e,t=e.pos()){let n=[],r=[];if(e.cur().type==="IDENTIFIER")do n.push(e.reqType("IDENTIFIER").value),e.reqOp(":"),r.push(g(e));while(e.matchOp(","));return{type:"namedArgumentList",names:n,values:r,start:t,end:e.endPos(),ev:o=>C(r.map(i=>i.ev(o)),i=>Object.fromEntries([["_namedArgList_",!0],...n.map((s,u)=>[s,i[u]])]))}}function At(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function It(e){let t=e.pos(),n;e.match("global")?n="global":e.match("element")?(n="element",e.matchOp("'")&&e.req("s")):e.match("dom")?n="inherited":e.match("local")&&(n="local");let r=e.matchOp(":"),o=!r&&e.matchOp("^"),i=e.matchType("IDENTIFIER");if(!i?.value)return;let s=(r?":":o?"^":"")+i.value,a=n??{$:"global",":":"element","^":"inherited"}[s[0]]??"local",l;return a==="inherited"&&e.match("on")&&(l=e.withFollow(["to","into","before","after","then"],()=>g(e))),{type:"symbol",name:s,scope:a,...l?{on:l}:{},start:t,end:e.endPos(),ev:c=>Ve(s,c,a,l?.ev(c)),lhs:()=>{},put:(c,p,f)=>Be(s,c,a,f,l?.ev(c))}}var Ot=(e,t)=>{let n=t.value.substring(2);return g(e.child(he(n),n))};function Gn(e){let t=e.consume(),n=(o,i)=>Ge(o.me).getElementById(String(i)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,i,s)=>x(r.ev(o),u=>u&&me(u,s))};if(t.template){let o=r.expr=Ot(e,t);r.ev=i=>x(o.ev(i),s=>n(i,s))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=i=>n(i,o)}return r}function Z(e){let t=e.matchType("CLASS_REF");if(!t)return;let n={type:"classRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(r,o,i)=>x(n.ev(r),s=>me(Array.from(s instanceof G?s:[]),i))};if(t.template){let r=n.expr=Ot(e,t);n.ev=o=>x(r.ev(o),i=>new G("."+i,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new G(r,o.me,!0)}return n}var et=class extends G{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>R(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(R);n.forEach((o,i)=>o.setAttribute("data-hs-query-id",String(i)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function Wn(e){let t=e.pos();e.consume();let n=e.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");e.reqOp("/"),e.reqOp(">");let r={type:"queryRef",css:n,start:t,end:e.endPos(),ev:o=>new G(n,o.me),lhs:()=>{},put:(o,i,s)=>x(r.ev(o),u=>me(Array.from(u instanceof G?u:[]),s))};if(/\$[^=]/.test(n)){let o=r.parts=Rt(e,n);r.ev=i=>C(o.map(s=>typeof s=="string"?s:s.ev(i)),s=>new et(i.me,s))}return r}function Q(e){let t=e.matchType("ATTRIBUTE_REF");if(!t)return;let n=t.value.startsWith("[")?t.value.slice(2,-1):t.value.slice(1),[r,o]=n.split("="),i=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:i,css:`[${n}]`,start:t.start,end:t.end,ev:s=>le(s.you||s.me,r),lhs:()=>{},put:(s,u,a)=>de(s.you||s.me,r,a)}}function Lt(e){let t=e.matchType("STYLE_REF");if(!t)return;let n=t.value.startsWith("*computed-"),r=t.value.slice(n?10:1);return{type:n?"computedStyleRef":"styleRef",name:r,start:t.start,end:t.end,ev:o=>(n?Ne:ke)(o.you||o.me,r),lhs:()=>{},put:(o,i,s)=>Ce(o.you||o.me,r,s)}}function Ft(e){let t=e.pos();if(!e.matchOp("{"))return;let n=[""],r=[];for(;e.hasMore();){if(e.matchOp("\\"))e.consume();else{if(e.matchOp("}"))break;if(e.match("$")){let o=e.matchOp("{");r.push(g(e)),o&&e.reqOp("}"),n.push("")}else n[n.length-1]+=e.text(e.consume())}n[n.length-1]+=e.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:t,end:e.endPos(),ev:o=>C(r.map(i=>i.ev(o)),i=>n.map((s,u)=>s+(u in i?`${i[u]}`:"")).join(""))}}function j(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function _t(e){let t=e.matchType("IDENTIFIER");if(!t)return;let n=[t.value],r=e.matchOp(".")??e.matchOp(":");if(r)do n.push(e.reqType("IDENTIFIER","NUMBER").value);while(e.matchOp(r.value));return n.join(r?.value??"")}function ee(e,t="Expected event name"){return e.matchType("STRING")?.value??_t(e)??e.err(t)}function D(e,t){return Un(e,t)??Vn(e,t)??Jn(e,t)??Bn(e,t)??zn(e,t)??Qn(e,t)??Yn(e,t)??Zn(e,t)??$n(e,t)??t}function $n(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function Un(e,t){if(!e.matchOp("."))return;let n=e.reqType("IDENTIFIER").value,r=e.text(t),o={type:"propertyAccess",root:t,prop:n,start:t.start,end:e.endPos(),ev:i=>x(o.root.ev(i),s=>ce(s,n)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{S(s,r),Te(s,n,u)},del:(i,s)=>{S(s,r),T(s,u=>{M(u)&&delete u[n],k.wroteProperty(u)})}};return D(e,o)}function Vn(e,t){if(!e.match("of"))return;let n=z(e),r,o=t;for(;o.root;)r=o,o=o.root;let s={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],u=o.name;if(!s||u===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),l={property:ce,attribute:le,style:ke,computed:Ne}[s],c={type:"ofExpression",root:n,name:u,kind:s,start:t.start,end:e.endPos(),ev:p=>x(c.root.ev(p),f=>l(f,u)),lhs:p=>c.root.ev(p),put:(p,f,d)=>{S(f,a),s==="attribute"?de(f,u,d):s==="property"?Te(f,u,d):Ce(f,u,d)},del:(p,f)=>{S(f,a),T(f,d=>{s==="attribute"?R(d)&&d.removeAttribute(u):s==="property"?(M(d)&&delete d[u],k.wroteProperty(d)):d instanceof HTMLElement&&d.style.removeProperty(u)})}};return r?(r.root=c,D(e,t)):D(e,c)}function Bn(e,t){let n=e.matchOp("'"),r=t.type==="symbol"&&["my","its","your"].includes(t.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(e.cur().type);if(!n&&!r)return;n&&e.req("s");let o=Q(e)??Lt(e),i=o?void 0:e.reqType("IDENTIFIER").value,s=e.text(t),u=l=>i!==void 0?ce(l,i):o?.type==="attributeRef"?le(l,o.name):o?.type==="computedStyleRef"?Ne(l,o.name):o&&ke(l,o.name),a={type:"possessive",root:t,prop:i,attribute:o,start:t.start,end:e.endPos(),ev:l=>x(a.root.ev(l),u),lhs:l=>a.root.ev(l),put:(l,c,p)=>{S(c,s),i!==void 0?Te(c,i,p):o?.type==="attributeRef"?de(c,o.name,p):o&&Ce(c,o.name,p)}};return D(e,a)}function zn(e,t){if(!e.match("in"))return;let n=z(e),r=(s,u)=>{if(s==null)return[];let a=[],l=v(s,"css");if(typeof l=="string")T(u,c=>R(c)&&a.push(...We(c,l)));else if(R(s)){let c=!1;if(T(u,p=>{p instanceof Node&&p.contains(s)&&(c=!0)}),c)return s}else T(s,c=>T(u,p=>c===p&&a.push(c)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:s=>C([o.root.ev(s),n.ev(s)],([u,a])=>r(u,a)),lhs:s=>o.ev(s),put:(s,u,a)=>me(u,a)},i;if(e.peek("where"))for(let s of e.g.collections)i??=s(e,o);return D(e,i??o)}function Qn(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let i=_t(e)??e.err("Expected dotOrColonPath"),s={type:"asExpression",root:o,conversion:i,start:o.start,end:e.endPos(),ev:u=>x(s.root.ev(u),a=>yt(a,i))};return s},r=n(t);for(;e.matchOp("|");)r=n(r);return D(e,r)}function Yn(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(g(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",i={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:s=>{let u=i.root,a=u.prop,l=a===void 0?void 0:u.root;return C([(l??u).ev(s),...n.map(c=>c.ev(s))],([c,...p])=>{if(!l||a===void 0)return Re(c,void 0,p,s,r);S(c,o);let f=Re(v(c,a),c,p,s,r);return xe(c,a),f})}};return D(e,i)}function Re(e,t,n,r,o){if(!q(e))throw S(e,o),new Error(`'${o}' is not a function`);return v(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function Jn(e,t){let n=Q(e);return n&&Xn(e,t,n)}function Xn(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:i=>x(o.root.ev(i),s=>le(s,n.name)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{S(s,r),de(s,n.name,u)}};return o}function Zn(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=g(e),o=!1,i;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(i=g(e))),e.reqOp("]");let s=e.text(t),u=(c,p)=>b(p)<0?b(v(c,"length"))+b(p):b(p),a=(c,p,f)=>{let d=v(c,"slice");return q(d)?Reflect.apply(d,c,[p,f]):void 0},l={type:"arrayIndex",root:t,first:r,second:i,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:c=>C([l.root.ev(c),r.ev(c),i?.ev(c)],([p,f,d])=>p==null?null:n?a(p,0,u(p,f)+1):o?d==null?a(p,b(f)):a(p,b(f),u(p,d)+1):v(p,String(f))),lhs:c=>C([l.root.ev(c),r.ev(c)],p=>p),put:(c,p,f)=>{let[d,m]=Array.isArray(p)?p:[];S(d,s),M(d)&&(d[String(m)]=f)},del:(c,p)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[f,d]=Array.isArray(p)?p:[];S(f,s),Array.isArray(f)?f.splice(u(f,d),1):M(f)&&delete f[String(d)],k.wroteProperty(f)}};return D(e,l)}function Ie(e){let t=e.pos();if(e.matchOp("(")){let a=Ie(e)??e.err("Expected command");return e.reqOp(")"),a}let n=e.cur(),r=e.g.commands[n.value],o;if(r?o=e.match(n.value)&&r(e,n.value,t):n.type==="IDENTIFIER"&&(o=e.g.pseudo?.(e,t)),!o||!e.match("unless"))return o;let i=o,s=g(e);return{type:"unlessStatementModifier",command:i,condition:s,start:t,end:e.endPos(),run:a=>x(s.ev(a),l=>l?void 0:i.run(a))}}function Y(e){let t=[];for(;e.hasMore();){let n=Ie(e);if(!n)break;t.push(n),e.match("then")}return t}function Mt(e){let t=e.pos();if(e.matchOp("(")){let o=Mt(e);return e.reqOp(")"),o}let n=e.cur(),r=e.g.features[n.value];return!r||!e.match(n.value)?e.err("Expected feature"):r(e,t)}function rt(e){let t=e.pos(),n=[];for(;e.hasMore();){let r=e.cur();if(e.featureStart(r)||r.value==="(")n.push(Mt(e)),e.match("end");else{if(r.value==="end")break;e.err()}}return{type:"hyperscript",features:n,start:t,end:e.endPos()}}function qt(e){let t={};return e.match("catch")&&(t.errorSymbol=e.reqType("IDENTIFIER").value,t.errorHandler=Y(e)),e.match("finally")&&(t.finallyHandler=Y(e)),t}function Oe(e){let t=[],n=e.tok(1).value,r=e.tok(2).value;if(e.cur().value==="("&&(n===")"||r===","||r===")")){e.matchOp("(");do t.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}return t}function Ht(e){e.commands.if=(t,n,r)=>{let o=g(t);t.match("then");let i=Y(t),s,u=!1,a=t.match("else")??t.match("otherwise");if(a)if(u=t.peek("if")?.line===a.line,u){let c=Ie(t);s=c?[c]:[]}else s=Y(t);return t.hasMore()&&!u&&t.req("end"),{type:"ifCommand",condition:o,trueBranch:i,falseBranch:s,start:r,end:t.endPos(),run:c=>x(o.ev(c),p=>p?$(i,c):s&&$(s,c))}}}var Kn={k:"return",value:null};function Dt(e){e.commands.halt=(t,n,r)=>{let o=!1;t.match("the")&&(t.req("event"),t.matchOp("'")&&t.req("s"),o=!0);let i=!!t.match("bubbling"),s=!i&&!!t.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:i,haltDefault:s,start:r,end:t.endPos(),run:a=>{let l=a.event;if(l instanceof Event&&(s||l.stopPropagation(),i||l.preventDefault()),!o)return Kn}}}}function Wt(e){let t=Z(e);if(!t)return;let n=[t];for(let r=Z(e);r;r=Z(e))n.push(r);return n}var ot=(e,t)=>(e??[]).map(n=>x(n.ev(t),r=>String(v(r,"className")))),er=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),st=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,jt=(e,t,n,r,o)=>t?Pe(e,t,n,i=>R(i)&&r(i),i=>R(i)&&o(i)):T(e,i=>R(i)&&r(i)),ge=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),$t=(e,t,n,r,o,i)=>i?jt(t,n,r,s=>ge(s,i,e),s=>ge(s,i,!e)):C(o.map(s=>jt(t,n,r,u=>u.classList.toggle(String(s),e),u=>u.classList.toggle(String(s),!e))),()=>{});function Ut(e){let t=Wt(e),n=t?void 0:Q(e);return{refs:t,attribute:n,css:t||n?void 0:Ft(e)}}function Vt(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ut(t),u;!o&&!i&&!s&&(u=t.withFollow(["to"],()=>g(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?g(t):j(t),l=t.match("when")?g(t):void 0,c=o||i?l:void 0,p=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:i,css:s,value:u,to:a,when:c,start:r,end:t.endPos(),run:d=>C([a.ev(d),s?.ev(d),u?.ev(d),...ot(o,d)],([m,h,E,...N])=>{if(S(m,p),u){if(Array.isArray(m))m.push(E);else if(m instanceof Set)m.add(E);else throw m instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof m);k.wroteProperty(m)}else if(s)T(m,_=>{let P=st(_);P&&(P.cssText+=h)});else return $t(!0,m,c,d,N,i)})}}}var tr=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function Bt(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ut(t),u=o||i||s?void 0:g(t),a=t.match("from")?g(t):u?void 0:j(t),l;t.match("when")&&(u&&t.err("'when' clause is not supported when removing elements"),l=g(t));let c=a?t.text(a):"",p=u?t.text(u):"",f=(m,h,E)=>{if(E==null&&u?.del&&u.lhs&&!tr(h)){let N=u;return x(u.lhs(m),_=>N.del?.(m,_))}if(S(h,p),Array.isArray(E)){let N=E.indexOf(h);N>-1&&E.splice(N,1),k.wroteProperty(E)}else E instanceof Set||E instanceof Map?(E.delete(h),k.wroteProperty(E)):T(h,N=>{R(N)&&N.parentElement&&(E==null||E instanceof Node&&E.contains(N))&&N.parentElement.removeChild(N)})};return{type:"removeCommand",classRefs:o,attributeRef:i,css:s,element:u,from:a,when:l,start:r,end:t.endPos(),run:m=>C([a?.ev(m),s?.ev(m),u?.ev(m),...ot(o,m)],([h,E,N,..._])=>{if(u)return f(m,N,h);if(S(h,c),s){let P=er(String(E));T(h,I=>P.forEach(O=>st(I)?.removeProperty(O)))}else return $t(!1,h,l,m,_,i)})}}}var Gt=(e,t,n)=>(r,o,i)=>{i?o.style[e]=i:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},zt={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=X(t);n?t.style.display=n:e==="toggle"?zt.display(getComputedStyle(t).display==="none"?"show":"hide",t):e==="hide"?(r.originalDisplay??=t.style.display,t.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?t.style.display=r.originalDisplay:t.style.removeProperty("display")},visibility:Gt("visibility","hidden","visible"),opacity:Gt("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function it(e,t){let n=t??K.defaultHideShowStrategy??"display";return K.hideShowStrategies[n]??zt[n]??e.err("Unknown show/hide strategy : "+n)}function Qt(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},i;if(t.cur().type==="STYLE_REF"){let h=o.styleProp=t.consume().value.slice(1);i=it(t,h),o.on=t.match("of")?t.withFollow(["with","between"],()=>g(t)):j(t)}else if(t.match("between")){let h=Z(t);if(h)t.req("and"),o.between=[h,Z(t)??t.err("Expected classRef")];else{let E=Q(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[E,Q(t)??t.err("Expected attributeRef")]}}else if(!(o.classRefs=Wt(t))&&!(o.attributeRef=Q(t))){let h=t.g.toggleElement;if(!h)o.target=t.withFollow(["between"],()=>se(t));else{let E=t.withFollow(["between","as"],()=>z(t));if(!t.peek("between"))return h(t,E,r);o.target=tt(t,E)}}if(!o.styleProp&&!o.target&&(o.on=t.match("on")?g(t):j(t)),t.match("between")){let h=o.betweenValues=t.withFollow(["and"],()=>{let E=[g(t)];for(;t.matchOp(",");)E.push(g(t));return E});t.req("and"),h.push(g(t))}o.target&&!o.betweenValues&&t.err("toggle <expression> requires 'between' with values"),t.peek("for")&&!t.peek("in",2)?(t.match("for"),o.time=g(t)):t.match("until")&&(o.until=ee(t),t.match("from")&&(o.from=g(t))),o.end=t.endPos();let{on:s,target:u,betweenValues:a,between:l,attributeRef:c,styleProp:p}=o,f=s?t.text(s):"",d=(h,E)=>h[(h.findIndex(N=>N==E)+1)%h.length],m=(h,E,N,_)=>{if(a&&u?.lhs&&u.put){let P=u;return C([u.ev(h),u.lhs(h)],([I,O])=>P.put?.(h,O,d(N,I)))}if(a&&p)return T(E,P=>{let I=st(P);if(!I||!R(P))return;let O=I.getPropertyValue(p)||getComputedStyle(P).getPropertyValue(p);I.setProperty(p,String(d(N,O)))});S(E,f),T(E,P=>{if(R(P))if(i)P instanceof HTMLElement&&i("toggle",P);else if(l){let[I,O]=l;if(I.type==="classRef"&&O.type==="classRef"){let[H,ne]=[String(I.className),String(O.className)],re=P.classList.contains(H);P.classList.toggle(H,!re),P.classList.toggle(ne,re)}else if(I.type==="attributeRef"&&O.type==="attributeRef"){let H=P.getAttribute(I.name)===String(I.value);ge(P,H?I:O,!1),ge(P,H?O:I,!0)}}else c?ge(P,c,!P.hasAttribute(c.name)):_.forEach(I=>P.classList.toggle(String(I)))})};return o.run=h=>C([s?.ev(h),o.time?.ev(h),o.from?.ev(h),C((a??[]).map(E=>E.ev(h)),E=>E),...ot(o.classRefs,h)],([E,N,_,P,...I])=>{let O=()=>m(h,E,Array.isArray(P)?P:[],I);if(o.time)return new Promise(H=>{O(),setTimeout(()=>{O(),H()},b(N))});if(o.until){let H=o.until,ne=_||h.me;return new Promise(re=>{W(ne)&&ne.addEventListener(H,()=>{O(),re()},{once:!0}),O()})}return x(O(),()=>{})}),o}}function Yt(e){for(let t of["hide","show"])e.commands[t]=(n,r,o)=>{let i=n.cur(),s=i.value==="when"||i.value==="with"||n.commandBoundary(i)?j(n):g(n),u;n.match("with")&&(u=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;t==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(m=>m.value).join(""));let l=n.match("when")?g(n):void 0,c=it(n,u),p=n.text(s),f=m=>h=>{h instanceof HTMLElement&&c(m,h,m==="show"?a:void 0)};return{type:`${t}Command`,target:s,strategy:u,arg:a,when:l,start:o,end:n.endPos(),run:m=>x(s.ev(m),h=>{if(S(h,p),l)return Pe(h,l,m,f(t),f(t==="hide"?"show":"hide"));T(h,f(t))})}}}var Wr="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function Jt(e){e.commands.send=e.commands.trigger=(t,n,r)=>{let o=ee(t),i=St(t),s=t.match(n==="trigger"?"on":"to")?g(t):j(t),u=t.text(s);return{type:"sendCommand",event:o,details:i,to:s,start:r,end:t.endPos(),run:l=>C([s.ev(l),i?.ev(l)],([c,p])=>{S(c,u),T(c,f=>F(f,o,M(p)?p:{},l.me))})}}}function Xt(e){e.commands.wait=(t,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(t.match("for")){t.match("a");let i=o.events=[];do{let a=t.cur();a.type==="NUMBER"||a.op&&a.value==="("?i.push(g(t)):i.push({event:ee(t),args:Oe(t)})}while(t.match("or"));let s=o.from=t.match("from")?g(t):void 0,u=s?t.text(s):"me";o.run=a=>x(s?s.ev(a):a.me,l=>{if(!W(l))throw new Error("Not a valid event target: "+u);return new Promise(c=>{for(let p of i)"event"in p?l.addEventListener(p.event,f=>{a.result=f;for(let d of p.args)a.locals[d]=v(f,d)||v(v(f,"detail"),d)||null;c()},{once:!0}):x(p.ev(a),f=>setTimeout(()=>{a.result=f,c()},b(f)))})})}else{let i;t.match("a")?t.req("tick"):i=o.time=g(t),o.run=s=>x(i?.ev(s),u=>new Promise(a=>setTimeout(a,i?b(u):0)))}return o.end=t.endPos(),o}}function Zt(e){e.commands.log=(t,n,r)=>{let o=[g(t)];for(;t.matchOp(",");)o.push(g(t));let i=t.match("with")?g(t):void 0;return{type:"logCommand",values:o,logger:i,start:r,end:t.endPos(),run:u=>C([i?.ev(u),...o.map(a=>a.ev(u))],([a,...l])=>{q(a)?a(...l):console.log(...l)})}}}function Kt(e){e.commands.get=e.commands.call=(t,n,r)=>{let o=g(t);return n==="call"&&o.type!=="functionCall"&&t.err("Must be a function invocation"),{type:"getCommand",value:o,start:r,end:t.endPos(),run:s=>x(o.ev(s),u=>{s.result=u})}}}function en(e){e.pseudo=(t,n)=>{let r=t.tok(1);if(!(r.op&&(r.value==="."||r.value==="(")))return;let o=Se(t);o.type!=="functionCall"&&t.err("Pseudo-commands must be function calls");let i=o.root,s="args"in o&&Array.isArray(o.args)?o.args:[],u;i&&!i.root&&(t.matchAny("the","to","on","with","into","from","at")?u=g(t):t.match("me")&&(u=j(t)));let a=i?.name??"",l=u?t.text(u):"",c=t.text(o),p=u;return{type:"pseudoCommand",value:o,target:u,start:n,end:t.endPos(),run:d=>p?C([p.ev(d),...s.map(m=>m.ev(d))],([m,...h])=>{S(m,l),d.result=Re(v(m,a),m,h,d,c),xe(m,a)}):x(o.ev(d),m=>{d.result=m})}}}function nn(e){e.commands.set=(t,n,r)=>nr(t,r)}function nr(e,t){{if(e.cur().op&&e.cur().value==="{"){let i=nt(e);e.req("on");let s=g(e);return{type:"setCommand",target:s,object:i,start:t,end:e.endPos(),run:a=>C([i.ev(a),s.ev(a)],([l,c])=>void Object.assign(Object(c),l))}}let n=e.withFollow(["to"],()=>se(e));e.req("to");let r=g(e);return{type:"setCommand",target:n,value:r,start:t,end:e.endPos(),run:i=>C([n.lhs?.(i),r.ev(i)],([s,u])=>n.put?.(i,s,u))}}}function rn(e){for(let t of["increment","decrement"]){let n=t==="increment"?1:-1;e.commands[t]=(r,o,i)=>{let s=r.withFollow(n<0?["by"]:[],()=>se(r)),u=r.match("by")?g(r):void 0;return{type:`${t}Command`,target:s,amount:u,start:i,end:r.endPos(),run:l=>C([s.ev(l),u?.ev(l),s.lhs?.(l)],([c,p,f])=>{let d=(c?parseFloat(String(c)):0)+n*(u?parseFloat(String(p)):1);l.result=d,s.put?.(l,f,d)})}}}}function tn(e,t){e.replaceChildren(fe(t)),U.process(e)}var rr=["arrayIndex","propertyAccess","possessive","ofExpression","attributeRef","styleRef","attributeRefAccess"],or={into:"into",before:"before",after:"after",start:"start",end:"end"},sr={before:"before",after:"after",start:"prepend",end:"append"};function on(e){e.commands.put=(t,n,r)=>{let o=g(t),i=t.matchAny("into","before","after");!i&&t.match("at")&&(t.match("the"),i=t.matchAny("start","end"),t.req("of"));let s=or[(i??t.expected("into","before","at start of","at end of","after")).value],u=Ae(g(t)),a=t.text(u),l=(f,d)=>u.type==="symbol"?x(u.ev(f),m=>{R(m)||m instanceof Document?tn(m,d):u.put?.(f,void 0,d)}):rr.includes(u.type)?x(u.lhs?.(f),m=>u.put?.(f,m,d)):x(u.ev(f),m=>{S(m,a),T(m,h=>{(R(h)||h instanceof Document)&&tn(h,d)})}),c=(f,d,m)=>x(u.ev(f),h=>{if(S(h,a),Array.isArray(h)){m==="prepend"?h.unshift(d):h.push(d),k.wroteProperty(h);return}T(h,E=>{R(E)&&(E[m](d instanceof Node?d:fe(d)),U.process(E.parentElement??E))})});return{type:"putCommand",value:o,operation:s,target:u,start:r,end:t.endPos(),run:f=>x(o.ev(f),d=>s==="into"?l(f,d):c(f,d,sr[s]))}}}var sn=new WeakSet;function an(e){if(sn.has(e))return;sn.add(e);let t=!1,n=o=>{let i=t;t=!0;try{o()}finally{t=i}};document.addEventListener("htmx:load",o=>n(()=>e.process(o.detail?.elt))),document.addEventListener("htmx:after:process",o=>n(()=>e.process(o.target))),document.addEventListener("fx:swapped",o=>{let i=o.detail?.cfg?.target;e.process(i instanceof Element&&i.isConnected?i.parentElement??i:document.body)});let r=Reflect.get(globalThis,"htmx");typeof r?.process=="function"&&(e.addAfterProcessHook(o=>{t||n(()=>r.process(o))}),r.version?.startsWith("4")&&r.registerExtension?.("hs-include",{htmx_config_request(o,i){let s=i?.ctx;if(!s)return;let u=ir(s.sourceElement||o);if(!u)return;let a=ur(u.value,u.scopeElt),l=s.request?.body;if(l instanceof FormData)for(let c in a)l.set(c,a[c])}}))}function ir(e){let t=e.getAttribute("hs-include");if(t!==null)return{value:t,scopeElt:e};for(let n=e.parentElement;n;n=n.parentElement){let r=n.getAttribute("hs-include:inherited");if(r!==null)return{value:r,scopeElt:n}}return null}var Fe=e=>e&&J(e)?.scopes?.elementScope||{};function Le(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return""}return String(e)}function ar(e,t){for(let n=t;n;n=n.parentElement){let r=Fe(n);if(e in r)return r[e]}}function ur(e,t){let n={},r=e.trim();if(r==="*"){let o=Fe(t);for(let i of Object.keys(o))n[i[0]===":"?i.slice(1):i]=Le(o[i]);return n}for(let o of r.split(","))if(o=o.trim(),!!o){if(o[0]===":"){let i=Fe(t);o in i&&(n[o.slice(1)]=Le(i[o]))}else if(o[0]==="^"){let i=ar(":"+o.slice(1),t);i!==void 0&&(n[o.slice(1)]=Le(i))}else if(o[0]==="#"){let i=o.lastIndexOf(":");if(i>0){let s=Fe(document.querySelector(o.slice(0,i))),u=o.slice(i+1);":"+u in s&&(n[u]=Le(s[":"+u]))}}}return n}var te=class extends Error{constructor(n,r,o,i){super(n);this.token=r;this.source=o;this.expected=i}written},un=()=>({commands:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),_e=class e{constructor(t,n,r){this.g=t;this.tokens=n;this.src=r;let o=r.length;this.eof={type:"EOF",value:"<<<EOF>>>",start:o,end:o,line:0,column:0},this.last=this.eof,this.skipWs()}i=0;follows=[];eof;last;child(t,n){return new e(this.g,t,n)}tok(t=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(t--===0)return this.tokens[r]??this.eof;r++}}cur(){return this.tokens[this.i]??this.eof}hasMore(){return this.i<this.tokens.length}pos(){return this.cur().start}endPos(){return this.last.end}text(t){return this.src.substring(t.start,t.end)}match(t,n="IDENTIFIER"){if(this.follows.includes(t))return;let r=this.cur();if(r.value===t&&r.type===n)return this.consume()}matchOp(t){let n=this.cur();if(n.op&&n.value===t)return this.consume()}matchType(...t){if(t.includes(this.cur().type))return this.consume()}matchAny(...t){for(let n of t){let r=this.match(n);if(r)return r}}matchAnyOp(...t){for(let n of t){let r=this.matchOp(n);if(r)return r}}req(t){return this.match(t)??this.expected(t)}reqOp(t){return this.matchOp(t)??this.expected(t)}reqType(...t){return this.matchType(...t)??this.expected(...t)}peek(t,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===t&&o.type===r)return o}consume(){return this.hasMore()?(this.last=this.tokens[this.i++],this.skipWs(),this.last):this.eof}skipWs(){for(;this.tokens[this.i]?.type==="WHITESPACE";)this.i++}consumeUntil(t,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let t=this.tokens[this.i-1];return t?.type==="WHITESPACE"?t.value:""}pushFollow(...t){return this.follows.push(...t),t.length}popFollow(t=1){this.follows.length-=t}withFollow(t,n){let r=this.pushFollow(...t);try{return n()}finally{this.popFollow(r)}}withoutFollows(t){let n=this.follows;this.follows=[];try{return t()}finally{this.follows=n}}err(t,n){let r=this.cur();throw new te(t??"Unexpected Token : "+r.value,r,this.src,n)}expected(...t){this.err(t.length===1?`Expected '${t[0]}' but found '${this.cur().value}'`:"Expected one of: "+t.map(n=>`'${n}'`).join(", "),t)}commandStart(t){return t.value in this.g.commands}featureStart(t){return t.value in this.g.features}commandBoundary(t){return["end","then","else","otherwise",")"].includes(t.value)||this.commandStart(t)||this.featureStart(t)||t.type==="EOF"}};function at(e){let t=e.source.split(`
|
|
1
|
+
"use strict";(()=>{var oe=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function",x=(e,t)=>oe(e)?e.then(t):t(e),C=(e,t)=>e.some(oe)?Promise.all(e).then(t):t(e),M=e=>e!=null,q=e=>typeof e=="function",v=(e,t)=>M(e)?e[t]:void 0,ie=(e,t,n)=>{M(e)&&(e[t]=n)},R=e=>e instanceof Element,$=e=>q(v(e,"addEventListener"));var b=e=>e;var K={attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",hideShowStrategies:{},fetchThrowsOn:[/^4/,/^5/]},He=Object.assign(Object.create(null),{String:e=>String(e),Int:e=>parseInt(String(e)),Float:e=>parseFloat(String(e)),Number:e=>Number(e),Fragment:e=>fe(e)}),De=[],V={process(e){},enter(e){}},pt=new WeakMap;function je(e){if(e.window!==e)return e;let t=pt.get(e);return t||pt.set(e,t={}),t}var J=e=>je(e)._hyperscript;function Ge(e){let t=je(e),n=t._hyperscript!==void 0;return delete t._hyperscript,n}function X(e){return je(e)._hyperscript??={}}var k={tracking:!1,readGlobal(e){},readElement(e,t){},readProperty(e,t){},readAttribute(e,t){},readQuery(e){},wroteGlobal(e){},wroteElement(e,t){},wroteProperty(e){},stop(e){}},xe=e=>(k.tracking&&typeof e=="object"&&e!==null&&k.readProperty(e,"__mutation__"),e),Cn={Array:["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"],Set:["add","delete","clear"],Map:["set","delete","clear"]};function Ee(e,t){let n=v(v(e,"constructor"),"name");typeof n=="string"&&Cn[n]?.includes(t)&&k.wroteProperty(e)}var We=e=>{if(e instanceof Node){let t=e.getRootNode();if(t instanceof Document||t instanceof ShadowRoot)return t}return document},Tn=e=>e.replace(/[:&()[\]/]/g,t=>"\\"+t);function $e(e,t){return k.tracking&&k.readQuery(e),e.querySelectorAll(t)}var G=class{constructor(t,n,r=!1){this.raw=t;this.relativeTo=n;this.escape=r}get css(){return this.escape?Tn(this.raw):this.raw}get className(){return this.raw.slice(1)}get length(){return this.select().length}contains(t){for(let n of this)if(n.contains(t))return!0;return!1}select(){return $e(We(this.relativeTo),this.css)}[Symbol.iterator](){return this.select()[Symbol.iterator]()}},Ue=e=>e instanceof G||Array.isArray(e)||e instanceof NodeList||e instanceof HTMLCollection||e instanceof FileList;function T(e,t){if(Ue(e))for(let n of e)t(n);else t(e)}var be=(e,t)=>{if(e==null)return;let n=t(e);if(n!==void 0)return n;if(Ue(e))return Array.from(e,t)},ue=(e,t)=>(k.tracking&&k.readProperty(e,t),be(e,n=>v(n,t))),le=(e,t)=>(k.tracking&&k.readAttribute(e,t),be(e,n=>R(n)?n.getAttribute(t):void 0)),ke=(e,t)=>be(e,n=>v(v(n,"style"),t)),Ne=(e,t)=>be(e,n=>R(n)?getComputedStyle(n).getPropertyValue(t):void 0),de=(e,t,n)=>T(e,r=>{R(r)&&(n==null?r.removeAttribute(t):r.setAttribute(t,String(n)))}),Ce=(e,t,n)=>T(e,r=>ie(v(r,"style"),t,n)),Te=(e,t,n)=>T(e,r=>{ie(r,t,n),k.wroteProperty(r)});function S(e,t){if(e==null)throw new Error(`'${t}' is null`)}var Ve=e=>e==null||v(e,"length")===0;function yt(e){if(e==null)return!1;if(Ue(e)){for(let t of e)return!0;return!1}return!0}function gt(e,t,n){if(e==null&&n||Object.prototype.toString.call(e).slice(8,-1)===t)return!0;let r=v(globalThis,t);return q(r)&&e instanceof r}function wt(e,t){for(let r of De){let o=r(t,e);if(o!==void 0)return o}if(e==null)return null;let n=He[t];if(n)return n(e);throw new Error("Unknown conversion : "+t)}function fe(e){let t=document.createDocumentFragment();return e==null?t.append("null"):T(e,n=>{if(n instanceof Node)t.append(n);else{let r=document.createElement("template");r.innerHTML=n===null?"":String(n),t.append(r.content)}}),t}function me(e,t){T(e,n=>{if(!R(n))return;let r=n.parentElement;n.replaceWith(t instanceof Node?t.cloneNode(!0):fe(t)),r&&V.process(r)})}function F(e,t,n={},r){if(!$(e))return!0;n.sender=r;let o=Object.assign(new Event(t,{bubbles:!0,cancelable:!0,composed:!0}),{detail:n});return e.dispatchEvent(o)}var vt=(e,t="elementScope")=>(X(e).scopes??={})[t]??={},Pn=Object.create(null,{selection:{get:()=>getSelection()?.toString(),enumerable:!0},clipboard:{get:()=>navigator.clipboard.readText(),set:e=>void navigator.clipboard.writeText(String(e))}});function pe(e,t,n,r){let o=v(r,"detail"),i=Object.create(Pn);for(let s=R(e)?e:null;s;s=s.parentElement)Object.assign(i,J(s)?.features);return{meta:{owner:e,feature:t},locals:i,me:n,you:void 0,result:void 0,beingTested:null,event:r,target:v(r,"target")??null,detail:o??null,sender:v(o,"sender")??null,body:typeof document>"u"?null:document.body}}var qe=["meta","it","result","locals","event","target","detail","sender","body"],ae=e=>{let t=e.meta.owner,n=e.meta.feature?.behavior;return M(t)?vt(t,n?n+"Scope":void 0):{}};function xt(e,t,n){let r=R(n)?n:R(t.meta.owner)?t.meta.owner:null;for(;r;){let o=J(r)?.scopes?.elementScope;if(o&&e in o)return{value:o[e],element:r};let i=r.getAttribute("dom-scope");if(i==="isolated")break;let s=i?.match(/^closest\s+(.+)/),c=i?.match(/^parent\s+of\s+(.+)/);s?r=r.parentElement?.closest(s[1])??null:c?r=r.closest(c[1])?.parentElement??null:r=r.parentElement}return{value:void 0,element:null}}function Be(e,t,n,r){if(e==="me"||e==="my"||e==="I")return t.me;if(e==="it"||e==="its")return t.beingTested??t.result;if(e==="result")return t.result;if(e==="you"||e==="your"||e==="yourself")return t.you;let o=t.meta.owner,i=()=>(k.tracking&&k.readGlobal(e),xe(v(globalThis,e)));if(n==="global")return i();if(n==="element")return k.tracking&&k.readElement(e,o),xe(ae(t)[e]);if(n==="inherited"){let u=xt(e,t,r);return k.tracking&&k.readElement(e,u.element??(R(r)?r:o)),xe(u.value)}let s=t.meta.context;if(s!=null){let u=v(s,e);if(u!==void 0)return u;let l=v(v(s,"detail"),e);if(l!==void 0)return l}let c=qe.includes(e)?v(t,e):t.locals[e];if(c!==void 0)return c;let a=ae(t)[e];return a!==void 0?(k.tracking&&k.readElement(e,o),xe(a)):i()}function ze(e,t,n,r,o){if(n==="global")ie(globalThis,e,r),k.wroteGlobal(e);else if(n==="element")ae(t)[e]=r,k.wroteElement(e,t.meta.owner);else if(n==="inherited"){let s=xt(e,t,o).element??(R(o)?o:t.meta.owner);M(s)&&(vt(s)[e]=r),k.wroteElement(e,s)}else!qe.includes(e)&&t.locals[e]!==void 0?t.locals[e]=r:ae(t)[e]!==void 0?(ae(t)[e]=r,k.wroteElement(e,t.meta.owner)):qe.includes(e)?ie(t,e,r):t.locals[e]=r}function U(e,t,n=0){for(let r=n;r<e.length;r++){let o=e[r].run(t);if(oe(o))return o.then(i=>i||U(e,t,r+1));if(o)return o}}function ce(e,t){try{let n=e();return oe(n)?n.then(void 0,t):n}catch(n){return t(n)}}function Et(e,t,n){let{errorSymbol:r,errorHandler:o,finallyHandler:i}=n,s=()=>ce(()=>x(U(t,e),a=>{let u=v(a,"k");if(u==="break"||u==="continue")throw new Error(`Command \`${u}\` cannot be used outside of a \`repeat\` loop.`);return ht(a)}),a=>{if(!o||!r)throw a;return e.locals[r]=a,U(o,e)});if(!i)return s();let c=()=>ce(()=>x(U(i,e),()=>{}),a=>console.error(" Exception in finally block: ",a));return ce(()=>x(s(),a=>x(c(),()=>ht(a))),a=>x(c(),()=>{throw a}))}var ht=e=>{let t=v(e,"k");if(t==="return")return{k:"return",value:v(e,"value")};if(t==="break"||t==="continue")return{k:t}};function Pe(e,t,n,r,o){let i=[];T(e,a=>i.push(a));let s=i.map(a=>(n.beingTested=a,t.ev(n)));n.beingTested=null;let c=a=>{n.result=i.filter((u,l)=>((a[l]?r:o)(u),a[l]))};return s.some(oe)?Promise.all(s).then(c):c(s)}var bt=new Set("+ - * / . .. \\ : % | ! ? # & $ ; , ( ) < > <= >= == === != !== { } [ ] = ~ ^".split(" ")),kt={b:"\b",f:"\f",n:`
|
|
2
|
+
`,r:"\r",t:" ",v:"\v"},B=e=>e>="a"&&e<="z"||e>="A"&&e<="Z",z=e=>e>="0"&&e<="9",Qe=e=>e===" "||e===" "||e==="\r"||e===`
|
|
3
|
+
`,Ye=e=>B(e)||z(e)||e==="-"||e==="_"||e===":",Je=e=>B(e)||z(e)||e==="_"||e==="$";function he(e,t=!1){let n=[],r=0,o=0,i=1,s="<START>",c=0,a=()=>e.charAt(r),u=y=>e.charAt(r+y),l=()=>(s=e.charAt(r++),s===`
|
|
4
|
+
`?(i++,o=0):o++,s),p=y=>({type:y,value:"",start:r,end:r+1,line:i,column:o}),f=(y,w)=>(y.value=w,y.end=r,y),d=y=>{let w="";for(;a()&&y(a());)w+=l();return w},m=()=>t&&c===0,h=()=>B(s)||z(s)||")\"'`}]".includes(s),E=(y,w)=>{let A=p(y),L=l();if(a()==="{"){if(A.template=!0,L+=l(),L+=d(kn=>kn!=="}"),a()!=="}")throw new Error("Unterminated "+(w?"class":"id")+" reference");let ve=l();w&&(L+=ve)}else if(w)for(;Ye(a())||a()==="\\";)a()==="\\"&&l(),L+=l();else L+=d(Ye);return f(A,L)},N=()=>{let y=p("STRING"),w=l();y.template=w==="`";let A="";for(;a()&&a()!==w;)if(a()==="\\"){l();let L=l();if(L in kt)A+=kt[L];else if(y.template&&L==="$")A+="\\$";else if(L==="x"){let ve=a()&&u(1)?parseInt(l()+l(),16):NaN;if(Number.isNaN(ve))throw new Error(`Invalid hexadecimal escape at [Line: ${y.line}, Column: ${y.column}]`);A+=String.fromCharCode(ve)}else A+=L}else A+=l();if(a()!==w)throw new Error(`Unterminated string at [Line: ${y.line}, Column: ${y.column}]`);return l(),f(y,A)},_=()=>{let y=p("IDENTIFIER"),w=l()+d(Je);return a()==="!"&&w==="beep"&&(w+=l()),f(y,w)},P=()=>{let y=p("IDENTIFIER"),w=l(),A=w==="\\";for(A&&(w="");(Je(a())||"\\{}".includes(a()||" "))&&!(a()==="$"&&!A);)a()==="\\"?(A=!0,l()):(A=!1,w+=l());return f(y,w)},O=()=>{let y=p("NUMBER"),w=l()+d(z);return a()==="."&&z(u(1))&&(w+=l()),w+=d(z),(a()==="e"||a()==="E")&&(z(u(1))?w+=l():u(1)==="-"&&(w+=l()+l())),f(y,w+d(z))},I=()=>{let y=p("OP");y.op=!0;let w=l();for(;a()&&bt.has(w+a());)w+=l();return f(y,w)},H=()=>{let y=p("ATTRIBUTE_REF"),w=l();return w==="["?(w+=d(A=>A!=="]"),a()==="]"&&(w+=l())):(w+=d(Ye),a()==="="&&(w+=l(),a()==='"'||a()==="'"?w+=N().value:Je(a())&&(w+=_().value))),f(y,w)},ne=()=>{let y=n.at(-1);return y?y.type==="IDENTIFIER"||y.type==="CLASS_REF"||y.type==="ID_REF"?!1:!(y.op&&(y.value===">"||y.value===")")):!0},re=()=>{let y=a(),w=u(2);return(y==="-"||y==="/")&&u(1)===y&&(Qe(w)||w===""||w===y)};for(;r<e.length;){let y=a(),w=u(1);if(re())d(A=>A!=="\r"&&A!==`
|
|
5
|
+
`),l();else if(Qe(y))n.push(f(p("WHITESPACE"),d(Qe)));else if(!h()&&y==="."&&(B(w)||w==="{"||w==="-"))n.push(E("CLASS_REF",!0));else if(!h()&&y==="#"&&(B(w)||w==="{"))n.push(E("ID_REF",!1));else if(y==="@"||y==="["&&w==="@")n.push(H());else if(y==="*"&&B(w)){let A=p("STYLE_REF");n.push(f(A,l()+d(L=>B(L)||L==="-")))}else if(m()&&(B(y)||y==="\\"))n.push(P());else if(!m()&&(B(y)||y==="_"||y==="$"))n.push(_());else if(z(y))n.push(O());else if(!m()&&(y==='"'||y==="`"))n.push(N());else if(!m()&&y==="'")n.push(ne()?N():I());else if(bt.has(y))s==="$"&&y==="{"&&c++,y==="}"&&c--,n.push(I());else if(m()||y==="`"){let A=p("RESERVED");n.push(f(A,l()))}else throw new Error("Unknown token: "+y+" ")}return n}function g(e){return e.match("the"),Rn(e)}function Rn(e){let t=Ct(e),n,r=()=>e.match("and")??e.match("or");for(let o=r();o;o=r())n??=o.value,n!==o.value&&e.err("You must parenthesize logical operations with different operators"),t=Sn(o.value,t,Ct(e));return t}function Sn(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>x(t.ev(o),i=>!!i===r?i:n.ev(o))}}var An={"+":(e,t)=>Array.isArray(e)?e.concat(t):b(e)+b(t),"-":(e,t)=>b(e)-b(t),"*":(e,t)=>b(e)*b(t),"/":(e,t)=>b(e)/b(t),mod:(e,t)=>b(e)%b(t)};function Xe(e){let t=Ke(e),n,r=()=>e.matchAnyOp("+","-","*","/")??e.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&e.err("You must parenthesize math operations with different operators");let i=t,s=Ke(e),c=An[o.value];t={type:"mathOperator",operator:o.value,left:i,right:s,start:i.start,end:s.end,ev:u=>C([i.ev(u),s.ev(u)],([l,p])=>c(l,p))}}return t}function Ke(e){let t=ee(e);for(let n=!0;n;){n=!1;for(let r of e.g.collections){let o=r(e,t);if(o){t=o,n=!0;break}}}return t}function ee(e){e.match("the");let t=e.pos();if(e.match("not"))return et(e,"logicalNot",t,ee(e),n=>!n);if(e.match("no"))return et(e,"noExpression",t,Ke(e),Ve);for(let n of e.g.unaries){let r=n(e);if(r)return D(e,r)}return In(e)}function et(e,t,n,r,o,i=t!=="negativeNumber"){let s={type:t,root:r,start:n,end:e.endPos(),ev:c=>x(r.ev(c),a=>o(a,c))};return i?D(e,s):s}var On="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function In(e){let t=Rt(e),n=e.matchAny(...On)??e.matchOp("%");if(n)return Nt(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return Nt(e,"timeExpression",t,r);for(let o of e.g.postfixes){let i=o(e,t);if(i)return i}return t}function Nt(e,t,n,r){let o=s=>typeof r=="number"?b(s)*r:`${s}${r}`,i={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:s=>x(n.ev(s),o)};return n.stat&&(i.stat=()=>o(ye(n))),i}function Rt(e){let t=e.pos();return e.matchOp("-")?et(e,"negativeNumber",t,Rt(e),n=>-b(n)):Se(e)}function Se(e){let t=qn(e);return t?D(e,t):e.err("Unexpected value: "+e.cur().value)}function se(e){return e.match("the"),Ln(e,Se(e))}function Ln(e,t){let n=Ae(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function Ae(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&Fn(t.expr);)t=t.expr;return t}var Fn=e=>q(v(e,"ev"));function ye(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function _n(e){let t=e.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(t)return{operator:t.value,right:!0,isType:!1};let n=(a,u=!0,l=!1)=>({operator:a,right:u,isType:l}),r=()=>e.match("equal")&&e.match("to"),o=(a,u)=>(e.req("than"),e.match("or")?(e.req("equal"),e.req("to"),n(u)):n(a));if(e.match("is")||e.match("am")){let a=!!e.match("not"),u=a?"not ":"";return e.match("in")?n(u+"in"):e.match("a")||e.match("an")?n(u+"a",!1,!0):e.match("empty")?n(u+"empty",!1):e.match("between")?n(u+"between"):!a&&e.match("less")?o("<","<="):!a&&e.match("greater")?o(">",">="):e.match("really")?(r(),n(a?"!==":"===")):e.match("equal")?(e.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(e.match("equals"))return n("==");if(e.match("really"))return e.req("equals"),n("===");if(e.matchAny("exist","exists"))return n("exist",!1);let i=!!e.matchAny("do","does");i&&e.req("not");let s=i?"not ":"",c=(a,u)=>e.match(a)??(i&&a!=="match"&&a!=="contain"?void 0:e.match(u));if(c("match","matches"))return n(s+"match");if(c("contain","contains"))return n(s+"contain");if(i&&e.match("exist"))return n("not exist",!1);if(c("include","includes"))return n(s+"include");if(e.match(i?"start":"starts"))return e.req("with"),n(s+"start with");if(e.match(i?"end":"ends"))return e.req("with"),n(s+"end with");if(c("precede","precedes"))return n(s+"precede");if(c("follow","follows"))return n(s+"follow");i&&e.expected("matches","contains","starts with","ends with","precede","follow")}function Ct(e){let t=Xe(e),n=_n(e);if(!n)return t;let{operator:r}=n,o,i=!0,s,c;n.isType?(o=e.reqType("IDENTIFIER").value,i=!e.matchOp("!")):n.right&&(s=Xe(e),r.endsWith("match")&&(c=s.css));let a;r.endsWith("between")&&(e.req("and"),a=Xe(e));let u=!1;e.match("ignoring")&&(e.req("case"),u=!0);let l=d=>u&&typeof d=="string"?d.toLowerCase():d,p=s?.type==="symbol"&&"scope"in s&&s.scope==="local"&&s.name!=="undefined"&&s.name!=="null"?s.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:s,right2:a,typeName:o,ignoringCase:u,start:t.start,end:e.endPos(),ev:d=>C([t.ev(d),c??s?.ev(d),a?.ev(d)],([m,h,E])=>{if(o){let N=gt(m,o,i);return r==="a"?N:!N}if(p&&h===void 0&&(r==="is"||r==="is not")){let N=!!ue(m,p);return r==="is"?N:!N}return St(r,l(m),l(h),E)})}}function Tt(e,t){let n=v(e,"contains")??v(e,"includes");if(!q(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function Mn(e,t){let n=v(e,"match")??v(e,"matches");if(!q(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var Pt=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function St(e,t,n,r){if(e==="not between")return b(t)<b(n)||b(t)>b(r);if(e.startsWith("not "))return!St(e.slice(4),t,n,r);switch(e){case"is":case"==":return t==n;case"is not":case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return b(t)<b(n);case">":return b(t)>b(n);case"<=":return b(t)<=b(n);case">=":return b(t)>=b(n);case"match":return t!=null&&Mn(t,n);case"in":return n!=null&&Tt(n,t);case"contain":case"include":return t!=null&&Tt(t,n);case"start with":return t!=null&&String(t).startsWith(String(n));case"end with":return t!=null&&String(t).endsWith(String(n));case"between":return b(t)>=b(n)&&b(t)<=b(r);case"precede":return Pt(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return Pt(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return Ve(t);case"exist":return yt(t)}throw new Error("Unknown comparison : "+e)}function qn(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),Ze("number",parseFloat(t.value),t);case"STRING":return jn(e);case"ID_REF":return $n(e);case"CLASS_REF":return Z(e);case"ATTRIBUTE_REF":return Q(e);case"STYLE_REF":return _t(e)}if(t.op){if(t.value==="(")return Hn(e);if(t.value==="[")return Gn(e);if(t.value==="{")return nt(e);if(t.value==="<")return Un(e)}let n=e.match("true")??e.match("false");if(n)return Ze("boolean",n.value==="true",n);let r=e.match("null");if(r)return Ze("null",null,r);for(let o of e.g.leaves){let i=o(e);if(i)return i}return Lt(e)}function Ze(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function Hn(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>g(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var Dn=(e,t)=>C(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function At(e,t){let n=e.child(he(t,!0),t),r=[],o="";do{o+=n.lastWs();let i=n.cur();if(i.value==="$"){n.consume();let s=n.matchOp("{");r.push(o,g(n)),o="",s&&n.reqOp("}")}else i.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function jn(e){let t=e.consume(),n=t.value,r={type:"string",value:n,start:t.start,end:t.end,ev:()=>n};if(t.template){let o=r.parts=At(e,n);r.ev=i=>Dn(o,i)}else r.stat=()=>n;return r}function Gn(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(g(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>C(n.map(o=>o.ev(r)),o=>o)}}function nt(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let i=e.matchType("STRING");if(i)n.push(i.value);else if(e.matchOp("["))n.push(g(e)),e.reqOp("]");else{let s="";for(let c=e.matchType("IDENTIFIER")??e.matchOp("-");c;c=e.matchType("IDENTIFIER")??e.matchOp("-"))s+=c.value;n.push(s)}e.reqOp(":"),r.push(g(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:i=>C([...n.map(s=>typeof s=="string"?s:s.ev(i)),...r.map(s=>s.ev(i))],s=>Object.fromEntries(n.map((c,a)=>[String(s[a]),s[n.length+a]])))}}function Ot(e){if(!e.matchOp("("))return;let t=e.last.start,n=Wn(e,t);return e.reqOp(")"),n.end=e.endPos(),n}function Wn(e,t=e.pos()){let n=[],r=[];if(e.cur().type==="IDENTIFIER")do n.push(e.reqType("IDENTIFIER").value),e.reqOp(":"),r.push(g(e));while(e.matchOp(","));return{type:"namedArgumentList",names:n,values:r,start:t,end:e.endPos(),ev:o=>C(r.map(i=>i.ev(o)),i=>Object.fromEntries([["_namedArgList_",!0],...n.map((s,c)=>[s,i[c]])]))}}function It(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function Lt(e){let t=e.pos(),n;e.match("global")?n="global":e.match("element")?(n="element",e.matchOp("'")&&e.req("s")):e.match("dom")?n="inherited":e.match("local")&&(n="local");let r=e.matchOp(":"),o=!r&&e.matchOp("^"),i=e.matchType("IDENTIFIER");if(!i?.value)return;let s=(r?":":o?"^":"")+i.value,a=n??{$:"global",":":"element","^":"inherited"}[s[0]]??"local",u;return a==="inherited"&&e.match("on")&&(u=e.withFollow(["to","into","before","after","then"],()=>g(e))),{type:"symbol",name:s,scope:a,...u?{on:u}:{},start:t,end:e.endPos(),ev:l=>Be(s,l,a,u?.ev(l)),lhs:()=>{},put:(l,p,f)=>ze(s,l,a,f,u?.ev(l))}}var Ft=(e,t)=>{let n=t.value.substring(2);return g(e.child(he(n),n))};function $n(e){let t=e.consume(),n=(o,i)=>We(o.me).getElementById(String(i)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,i,s)=>x(r.ev(o),c=>c&&me(c,s))};if(t.template){let o=r.expr=Ft(e,t);r.ev=i=>x(o.ev(i),s=>n(i,s))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=i=>n(i,o)}return r}function Z(e){let t=e.matchType("CLASS_REF");if(!t)return;let n={type:"classRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(r,o,i)=>x(n.ev(r),s=>me(Array.from(s instanceof G?s:[]),i))};if(t.template){let r=n.expr=Ft(e,t);n.ev=o=>x(r.ev(o),i=>new G("."+i,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new G(r,o.me,!0)}return n}var tt=class extends G{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>R(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(R);n.forEach((o,i)=>o.setAttribute("data-hs-query-id",String(i)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function Un(e){let t=e.pos();e.consume();let n=e.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");e.reqOp("/"),e.reqOp(">");let r={type:"queryRef",css:n,start:t,end:e.endPos(),ev:o=>new G(n,o.me),lhs:()=>{},put:(o,i,s)=>x(r.ev(o),c=>me(Array.from(c instanceof G?c:[]),s))};if(/\$[^=]/.test(n)){let o=r.parts=At(e,n);r.ev=i=>C(o.map(s=>typeof s=="string"?s:s.ev(i)),s=>new tt(i.me,s))}return r}function Q(e){let t=e.matchType("ATTRIBUTE_REF");if(!t)return;let n=t.value.startsWith("[")?t.value.slice(2,-1):t.value.slice(1),[r,o]=n.split("="),i=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:i,css:`[${n}]`,start:t.start,end:t.end,ev:s=>le(s.you||s.me,r),lhs:()=>{},put:(s,c,a)=>de(s.you||s.me,r,a)}}function _t(e){let t=e.matchType("STYLE_REF");if(!t)return;let n=t.value.startsWith("*computed-"),r=t.value.slice(n?10:1);return{type:n?"computedStyleRef":"styleRef",name:r,start:t.start,end:t.end,ev:o=>(n?Ne:ke)(o.you||o.me,r),lhs:()=>{},put:(o,i,s)=>Ce(o.you||o.me,r,s)}}function Mt(e){let t=e.pos();if(!e.matchOp("{"))return;let n=[""],r=[];for(;e.hasMore();){if(e.matchOp("\\"))e.consume();else{if(e.matchOp("}"))break;if(e.match("$")){let o=e.matchOp("{");r.push(g(e)),o&&e.reqOp("}"),n.push("")}else n[n.length-1]+=e.text(e.consume())}n[n.length-1]+=e.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:t,end:e.endPos(),ev:o=>C(r.map(i=>i.ev(o)),i=>n.map((s,c)=>s+(c in i?`${i[c]}`:"")).join(""))}}function j(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function qt(e){let t=e.matchType("IDENTIFIER");if(!t)return;let n=[t.value],r=e.matchOp(".")??e.matchOp(":");if(r)do n.push(e.reqType("IDENTIFIER","NUMBER").value);while(e.matchOp(r.value));return n.join(r?.value??"")}function te(e,t="Expected event name"){return e.matchType("STRING")?.value??qt(e)??e.err(t)}function D(e,t){return Bn(e,t)??zn(e,t)??Zn(e,t)??Qn(e,t)??Yn(e,t)??Jn(e,t)??Xn(e,t)??er(e,t)??Vn(e,t)??t}function Vn(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function Bn(e,t){if(!e.matchOp("."))return;let n=e.reqType("IDENTIFIER").value,r=e.text(t),o={type:"propertyAccess",root:t,prop:n,start:t.start,end:e.endPos(),ev:i=>x(o.root.ev(i),s=>ue(s,n)),lhs:i=>o.root.ev(i),put:(i,s,c)=>{S(s,r),Te(s,n,c)},del:(i,s)=>{S(s,r),T(s,c=>{M(c)&&delete c[n],k.wroteProperty(c)})}};return D(e,o)}function zn(e,t){if(!e.match("of"))return;let n=ee(e),r,o=t;for(;o.root;)r=o,o=o.root;let s={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],c=o.name;if(!s||c===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),u={property:ue,attribute:le,style:ke,computed:Ne}[s],l={type:"ofExpression",root:n,name:c,kind:s,start:t.start,end:e.endPos(),ev:p=>x(l.root.ev(p),f=>u(f,c)),lhs:p=>l.root.ev(p),put:(p,f,d)=>{S(f,a),s==="attribute"?de(f,c,d):s==="property"?Te(f,c,d):Ce(f,c,d)},del:(p,f)=>{S(f,a),T(f,d=>{s==="attribute"?R(d)&&d.removeAttribute(c):s==="property"?(M(d)&&delete d[c],k.wroteProperty(d)):d instanceof HTMLElement&&d.style.removeProperty(c)})}};return r?(r.root=l,D(e,t)):D(e,l)}function Qn(e,t){let n=e.matchOp("'"),r=t.type==="symbol"&&["my","its","your"].includes(t.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(e.cur().type);if(!n&&!r)return;n&&e.req("s");let o=Q(e)??_t(e),i=o?void 0:e.reqType("IDENTIFIER").value,s=e.text(t),c=u=>i!==void 0?ue(u,i):o?.type==="attributeRef"?le(u,o.name):o?.type==="computedStyleRef"?Ne(u,o.name):o&&ke(u,o.name),a={type:"possessive",root:t,prop:i,attribute:o,start:t.start,end:e.endPos(),ev:u=>x(a.root.ev(u),c),lhs:u=>a.root.ev(u),put:(u,l,p)=>{S(l,s),i!==void 0?Te(l,i,p):o?.type==="attributeRef"?de(l,o.name,p):o&&Ce(l,o.name,p)}};return D(e,a)}function Yn(e,t){if(!e.match("in"))return;let n=ee(e),r=(s,c)=>{if(s==null)return[];let a=[],u=v(s,"css");if(typeof u=="string")T(c,l=>R(l)&&a.push(...$e(l,u)));else if(R(s)){let l=!1;if(T(c,p=>{p instanceof Node&&p.contains(s)&&(l=!0)}),l)return s}else T(s,l=>T(c,p=>l===p&&a.push(l)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:s=>C([o.root.ev(s),n.ev(s)],([c,a])=>r(c,a)),lhs:s=>o.ev(s),put:(s,c,a)=>me(c,a)},i;if(e.peek("where"))for(let s of e.g.collections)i??=s(e,o);return D(e,i??o)}function Jn(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let i=qt(e)??e.err("Expected dotOrColonPath"),s={type:"asExpression",root:o,conversion:i,start:o.start,end:e.endPos(),ev:c=>x(s.root.ev(c),a=>wt(a,i))};return s},r=n(t);for(;e.matchOp("|");)r=n(r);return D(e,r)}function Xn(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(g(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",i={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:s=>{let c=i.root,a=c.prop,u=a===void 0?void 0:c.root;return C([(u??c).ev(s),...n.map(l=>l.ev(s))],([l,...p])=>{if(!u||a===void 0)return Re(l,void 0,p,s,r);S(l,o);let f=Re(v(l,a),l,p,s,r);return Ee(l,a),f})}};return D(e,i)}function Re(e,t,n,r,o){if(!q(e))throw S(e,o),new Error(`'${o}' is not a function`);return v(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function Zn(e,t){let n=Q(e);return n&&Kn(e,t,n)}function Kn(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:i=>x(o.root.ev(i),s=>le(s,n.name)),lhs:i=>o.root.ev(i),put:(i,s,c)=>{S(s,r),de(s,n.name,c)}};return o}function er(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=g(e),o=!1,i;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(i=g(e))),e.reqOp("]");let s=e.text(t),c=(l,p)=>b(p)<0?b(v(l,"length"))+b(p):b(p),a=(l,p,f)=>{let d=v(l,"slice");return q(d)?Reflect.apply(d,l,[p,f]):void 0},u={type:"arrayIndex",root:t,first:r,second:i,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:l=>C([u.root.ev(l),r.ev(l),i?.ev(l)],([p,f,d])=>p==null?null:n?a(p,0,c(p,f)+1):o?d==null?a(p,b(f)):a(p,b(f),c(p,d)+1):v(p,String(f))),lhs:l=>C([u.root.ev(l),r.ev(l)],p=>p),put:(l,p,f)=>{let[d,m]=Array.isArray(p)?p:[];S(d,s),M(d)&&(d[String(m)]=f)},del:(l,p)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[f,d]=Array.isArray(p)?p:[];S(f,s),Array.isArray(f)?f.splice(c(f,d),1):M(f)&&delete f[String(d)],k.wroteProperty(f)}};return D(e,u)}var W=class extends Error{constructor(n,r,o,i){super(n);this.token=r;this.source=o;this.expected=i}written},Ht=()=>({commands:Object.create(null),fallbacks:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),Oe=class e{constructor(t,n,r){this.g=t;this.tokens=n;this.src=r;let o=r.length;this.eof={type:"EOF",value:"<<<EOF>>>",start:o,end:o,line:0,column:0},this.last=this.eof,this.skipWs()}i=0;follows=[];eof;last;child(t,n){return new e(this.g,t,n)}tok(t=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(t--===0)return this.tokens[r]??this.eof;r++}}cur(){return this.tokens[this.i]??this.eof}hasMore(){return this.i<this.tokens.length}pos(){return this.cur().start}mark(){return{i:this.i,last:this.last,follows:this.follows.length}}reset(t){this.i=t.i,this.last=t.last,this.follows.length=t.follows}endPos(){return this.last.end}text(t){return this.src.substring(t.start,t.end)}match(t,n="IDENTIFIER"){if(this.follows.includes(t))return;let r=this.cur();if(r.value===t&&r.type===n)return this.consume()}matchOp(t){let n=this.cur();if(n.op&&n.value===t)return this.consume()}matchType(...t){if(t.includes(this.cur().type))return this.consume()}matchAny(...t){for(let n of t){let r=this.match(n);if(r)return r}}matchAnyOp(...t){for(let n of t){let r=this.matchOp(n);if(r)return r}}req(t){return this.match(t)??this.expected(t)}reqOp(t){return this.matchOp(t)??this.expected(t)}reqType(...t){return this.matchType(...t)??this.expected(...t)}peek(t,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===t&&o.type===r)return o}consume(){return this.hasMore()?(this.last=this.tokens[this.i++],this.skipWs(),this.last):this.eof}skipWs(){for(;this.tokens[this.i]?.type==="WHITESPACE";)this.i++}consumeUntil(t,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let t=this.tokens[this.i-1];return t?.type==="WHITESPACE"?t.value:""}pushFollow(...t){return this.follows.push(...t),t.length}popFollow(t=1){this.follows.length-=t}withFollow(t,n){let r=this.pushFollow(...t);try{return n()}finally{this.popFollow(r)}}withoutFollows(t){let n=this.follows;this.follows=[];try{return t()}finally{this.follows=n}}err(t,n){let r=this.cur();throw new W(t??"Unexpected Token : "+r.value,r,this.src,n)}expected(...t){this.err(t.length===1?`Expected '${t[0]}' but found '${this.cur().value}'`:"Expected one of: "+t.map(n=>`'${n}'`).join(", "),t)}commandStart(t){return t.value in this.g.commands}featureStart(t){return t.value in this.g.features}commandBoundary(t){return["end","then","else","otherwise",")"].includes(t.value)||this.commandStart(t)||this.featureStart(t)||t.type==="EOF"}};function rt(e){let t=e.source.split(`
|
|
6
6
|
`),n=e.token.line?e.token.line-1:t.length-1,r=t[n]??"",o=e.token.line?e.token.column:Math.max(0,r.length-1),i=String(n+1).length,s=" ".repeat(i+5+o);return` ${n+1} | ${r}
|
|
7
7
|
`+s+"^".repeat(Math.max(1,e.token.value.length))+`
|
|
8
8
|
`+s+e.message+`
|
|
9
|
-
`}var dn=un();function fn(...e){for(let t of e)t(dn)}var mn=e=>new _e(dn,he(e),e);function cr(e){let t=mn(e),n=rt(t);return t.hasMore()&&t.err(),n}function pn(e){let t=mn(e),n=t.cur(),r=t.commandStart(n)?{kind:"commands",commands:Y(t)}:t.featureStart(n)?{kind:"features",program:rt(t)}:{kind:"expression",expression:g(t)};return t.hasMore()&&t.err(),r}function cn(e,t){let n;try{n=pn(e)}catch(i){throw i instanceof te?new Error(i.message+`
|
|
9
|
+
`}function tr(e,t,n,r){let o=e.g.fallbacks[n];if(!o)return t(e,n,r);let i=e.mark();try{return t(e,n,r)}catch(s){if(!(s instanceof W))throw s;let c=s;for(let a of o){e.reset(i);try{let u=a(e,n,r);if(u&&e.pos()>=s.token.start)return u}catch(u){if(!(u instanceof W))throw u;u.token.start>c.token.start&&(c=u)}}throw c}}function Ie(e){let t=e.pos();if(e.matchOp("(")){let a=Ie(e)??e.err("Expected command");return e.reqOp(")"),a}let n=e.cur(),r=e.g.commands[n.value],o;if(r?o=e.match(n.value)&&tr(e,r,n.value,t):n.type==="IDENTIFIER"&&(o=e.g.pseudo?.(e,t)),!o||!e.match("unless"))return o;let i=o,s=g(e);return{type:"unlessStatementModifier",command:i,condition:s,start:t,end:e.endPos(),run:a=>x(s.ev(a),u=>u?void 0:i.run(a))}}function Y(e){let t=[];for(;e.hasMore();){let n=Ie(e);if(!n)break;t.push(n),e.match("then")}return t}function Dt(e){let t=e.pos();if(e.matchOp("(")){let o=Dt(e);return e.reqOp(")"),o}let n=e.cur(),r=e.g.features[n.value];return!r||!e.match(n.value)?e.err("Expected feature"):r(e,t)}function ot(e){let t=e.pos(),n=[];for(;e.hasMore();){let r=e.cur();if(e.featureStart(r)||r.value==="(")n.push(Dt(e)),e.match("end");else{if(r.value==="end")break;e.err()}}return{type:"hyperscript",features:n,start:t,end:e.endPos()}}function jt(e){let t={};return e.match("catch")&&(t.errorSymbol=e.reqType("IDENTIFIER").value,t.errorHandler=Y(e)),e.match("finally")&&(t.finallyHandler=Y(e)),t}function Le(e){let t=[],n=e.tok(1).value,r=e.tok(2).value;if(e.cur().value==="("&&(n===")"||r===","||r===")")){e.matchOp("(");do t.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}return t}function Gt(e){e.commands.if=(t,n,r)=>{let o=g(t);t.match("then");let i=Y(t),s,c=!1,a=t.match("else")??t.match("otherwise");if(a)if(c=t.peek("if")?.line===a.line,c){let l=Ie(t);s=l?[l]:[]}else s=Y(t);return t.hasMore()&&!c&&t.req("end"),{type:"ifCommand",condition:o,trueBranch:i,falseBranch:s,start:r,end:t.endPos(),run:l=>x(o.ev(l),p=>p?U(i,l):s&&U(s,l))}}}var nr={k:"return",value:null};function Wt(e){e.commands.halt=(t,n,r)=>{let o=!1;t.match("the")&&(t.req("event"),t.matchOp("'")&&t.req("s"),o=!0);let i=!!t.match("bubbling"),s=!i&&!!t.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:i,haltDefault:s,start:r,end:t.endPos(),run:a=>{let u=a.event;if(u instanceof Event&&(s||u.stopPropagation(),i||u.preventDefault()),!o)return nr}}}}function Vt(e){let t=Z(e);if(!t)return;let n=[t];for(let r=Z(e);r;r=Z(e))n.push(r);return n}var st=(e,t)=>(e??[]).map(n=>x(n.ev(t),r=>String(v(r,"className")))),rr=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),it=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,$t=(e,t,n,r,o)=>t?Pe(e,t,n,i=>R(i)&&r(i),i=>R(i)&&o(i)):T(e,i=>R(i)&&r(i)),ge=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),Bt=(e,t,n,r,o,i)=>i?$t(t,n,r,s=>ge(s,i,e),s=>ge(s,i,!e)):C(o.map(s=>$t(t,n,r,c=>c.classList.toggle(String(s),e),c=>c.classList.toggle(String(s),!e))),()=>{});function zt(e){let t=Vt(e),n=t?void 0:Q(e);return{refs:t,attribute:n,css:t||n?void 0:Mt(e)}}function Qt(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:i,css:s}=zt(t),c;!o&&!i&&!s&&(c=t.withFollow(["to"],()=>g(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?g(t):j(t),u=t.match("when")?g(t):void 0,l=o||i?u:void 0,p=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:i,css:s,value:c,to:a,when:l,start:r,end:t.endPos(),run:d=>C([a.ev(d),s?.ev(d),c?.ev(d),...st(o,d)],([m,h,E,...N])=>{if(S(m,p),c){if(Array.isArray(m))m.push(E);else if(m instanceof Set)m.add(E);else throw m instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof m);k.wroteProperty(m)}else if(s)T(m,_=>{let P=it(_);P&&(P.cssText+=h)});else return Bt(!0,m,l,d,N,i)})}}}var or=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function Yt(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:i,css:s}=zt(t),c=o||i||s?void 0:g(t),a=t.match("from")?g(t):c?void 0:j(t),u;t.match("when")&&(c&&t.err("'when' clause is not supported when removing elements"),u=g(t));let l=a?t.text(a):"",p=c?t.text(c):"",f=(m,h,E)=>{if(E==null&&c?.del&&c.lhs&&!or(h)){let N=c;return x(c.lhs(m),_=>N.del?.(m,_))}if(S(h,p),Array.isArray(E)){let N=E.indexOf(h);N>-1&&E.splice(N,1),k.wroteProperty(E)}else E instanceof Set||E instanceof Map?(E.delete(h),k.wroteProperty(E)):T(h,N=>{R(N)&&N.parentElement&&(E==null||E instanceof Node&&E.contains(N))&&N.parentElement.removeChild(N)})};return{type:"removeCommand",classRefs:o,attributeRef:i,css:s,element:c,from:a,when:u,start:r,end:t.endPos(),run:m=>C([a?.ev(m),s?.ev(m),c?.ev(m),...st(o,m)],([h,E,N,..._])=>{if(c)return f(m,N,h);if(S(h,l),s){let P=rr(String(E));T(h,O=>P.forEach(I=>it(O)?.removeProperty(I)))}else return Bt(!1,h,u,m,_,i)})}}}var Ut=(e,t,n)=>(r,o,i)=>{i?o.style[e]=i:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},Jt={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=X(t);n?t.style.display=n:e==="toggle"?Jt.display(getComputedStyle(t).display==="none"?"show":"hide",t):e==="hide"?(r.originalDisplay??=t.style.display,t.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?t.style.display=r.originalDisplay:t.style.removeProperty("display")},visibility:Ut("visibility","hidden","visible"),opacity:Ut("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function at(e,t){let n=t??K.defaultHideShowStrategy??"display";return K.hideShowStrategies[n]??Jt[n]??e.err("Unknown show/hide strategy : "+n)}function Xt(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},i;if(t.cur().type==="STYLE_REF"){let h=o.styleProp=t.consume().value.slice(1);i=at(t,h),o.on=t.match("of")?t.withFollow(["with","between"],()=>g(t)):j(t)}else if(t.match("between")){let h=Z(t);if(h)t.req("and"),o.between=[h,Z(t)??t.err("Expected classRef")];else{let E=Q(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[E,Q(t)??t.err("Expected attributeRef")]}}else!(o.classRefs=Vt(t))&&!(o.attributeRef=Q(t))&&(o.target=t.withFollow(["between"],()=>se(t)));if(!o.styleProp&&!o.target&&(o.on=t.match("on")?g(t):j(t)),t.match("between")){let h=o.betweenValues=t.withFollow(["and"],()=>{let E=[g(t)];for(;t.matchOp(",");)E.push(g(t));return E});t.req("and"),h.push(g(t))}o.target&&!o.betweenValues&&t.err("toggle <expression> requires 'between' with values"),t.peek("for")&&!t.peek("in",2)?(t.match("for"),o.time=g(t)):t.match("until")&&(o.until=te(t),t.match("from")&&(o.from=g(t))),o.end=t.endPos();let{on:s,target:c,betweenValues:a,between:u,attributeRef:l,styleProp:p}=o,f=s?t.text(s):"",d=(h,E)=>h[(h.findIndex(N=>N==E)+1)%h.length],m=(h,E,N,_)=>{if(a&&c?.lhs&&c.put){let P=c;return C([c.ev(h),c.lhs(h)],([O,I])=>P.put?.(h,I,d(N,O)))}if(a&&p)return T(E,P=>{let O=it(P);if(!O||!R(P))return;let I=O.getPropertyValue(p)||getComputedStyle(P).getPropertyValue(p);O.setProperty(p,String(d(N,I)))});S(E,f),T(E,P=>{if(R(P))if(i)P instanceof HTMLElement&&i("toggle",P);else if(u){let[O,I]=u;if(O.type==="classRef"&&I.type==="classRef"){let[H,ne]=[String(O.className),String(I.className)],re=P.classList.contains(H);P.classList.toggle(H,!re),P.classList.toggle(ne,re)}else if(O.type==="attributeRef"&&I.type==="attributeRef"){let H=P.getAttribute(O.name)===String(O.value);ge(P,H?O:I,!1),ge(P,H?I:O,!0)}}else l?ge(P,l,!P.hasAttribute(l.name)):_.forEach(O=>P.classList.toggle(String(O)))})};return o.run=h=>C([s?.ev(h),o.time?.ev(h),o.from?.ev(h),C((a??[]).map(E=>E.ev(h)),E=>E),...st(o.classRefs,h)],([E,N,_,P,...O])=>{let I=()=>m(h,E,Array.isArray(P)?P:[],O);if(o.time)return new Promise(H=>{I(),setTimeout(()=>{I(),H()},b(N))});if(o.until){let H=o.until,ne=_||h.me;return new Promise(re=>{$(ne)&&ne.addEventListener(H,()=>{I(),re()},{once:!0}),I()})}return x(I(),()=>{})}),o}}function Zt(e){for(let t of["hide","show"])e.commands[t]=(n,r,o)=>{let i=n.cur(),s=i.value==="when"||i.value==="with"||n.commandBoundary(i)?j(n):g(n),c;n.match("with")&&(c=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;t==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(m=>m.value).join(""));let u=n.match("when")?g(n):void 0,l=at(n,c),p=n.text(s),f=m=>h=>{h instanceof HTMLElement&&l(m,h,m==="show"?a:void 0)};return{type:`${t}Command`,target:s,strategy:c,arg:a,when:u,start:o,end:n.endPos(),run:m=>x(s.ev(m),h=>{if(S(h,p),u)return Pe(h,u,m,f(t),f(t==="hide"?"show":"hide"));T(h,f(t))})}}}var zr="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function Kt(e){e.commands.send=e.commands.trigger=(t,n,r)=>{let o=te(t),i=Ot(t),s=t.match(n==="trigger"?"on":"to")?g(t):j(t),c=t.text(s);return{type:"sendCommand",event:o,details:i,to:s,start:r,end:t.endPos(),run:u=>C([s.ev(u),i?.ev(u)],([l,p])=>{S(l,c),T(l,f=>F(f,o,M(p)?p:{},u.me))})}}}function en(e){e.commands.wait=(t,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(t.match("for")){t.match("a");let i=o.events=[];do{let a=t.cur();a.type==="NUMBER"||a.op&&a.value==="("?i.push(g(t)):i.push({event:te(t),args:Le(t)})}while(t.match("or"));let s=o.from=t.match("from")?g(t):void 0,c=s?t.text(s):"me";o.run=a=>x(s?s.ev(a):a.me,u=>{if(!$(u))throw new Error("Not a valid event target: "+c);return new Promise(l=>{for(let p of i)"event"in p?u.addEventListener(p.event,f=>{a.result=f;for(let d of p.args)a.locals[d]=v(f,d)||v(v(f,"detail"),d)||null;l()},{once:!0}):x(p.ev(a),f=>setTimeout(()=>{a.result=f,l()},b(f)))})})}else{let i;t.match("a")?t.req("tick"):i=o.time=g(t),o.run=s=>x(i?.ev(s),c=>new Promise(a=>setTimeout(a,i?b(c):0)))}return o.end=t.endPos(),o}}function tn(e){e.commands.log=(t,n,r)=>{let o=[g(t)];for(;t.matchOp(",");)o.push(g(t));let i=t.match("with")?g(t):void 0;return{type:"logCommand",values:o,logger:i,start:r,end:t.endPos(),run:c=>C([i?.ev(c),...o.map(a=>a.ev(c))],([a,...u])=>{q(a)?a(...u):console.log(...u)})}}}function nn(e){e.commands.get=e.commands.call=(t,n,r)=>{let o=g(t);return n==="call"&&o.type!=="functionCall"&&t.err("Must be a function invocation"),{type:"getCommand",value:o,start:r,end:t.endPos(),run:s=>x(o.ev(s),c=>{s.result=c})}}}function rn(e){e.pseudo=(t,n)=>{let r=t.tok(1);if(!(r.op&&(r.value==="."||r.value==="(")))return;let o=Se(t);o.type!=="functionCall"&&t.err("Pseudo-commands must be function calls");let i=o.root,s="args"in o&&Array.isArray(o.args)?o.args:[],c;i&&!i.root&&(t.matchAny("the","to","on","with","into","from","at")?c=g(t):t.match("me")&&(c=j(t)));let a=i?.name??"",u=c?t.text(c):"",l=t.text(o),p=c;return{type:"pseudoCommand",value:o,target:c,start:n,end:t.endPos(),run:d=>p?C([p.ev(d),...s.map(m=>m.ev(d))],([m,...h])=>{S(m,u),d.result=Re(v(m,a),m,h,d,l),Ee(m,a)}):x(o.ev(d),m=>{d.result=m})}}}function sn(e){e.commands.set=(t,n,r)=>sr(t,r)}function sr(e,t){{if(e.cur().op&&e.cur().value==="{"){let i=nt(e);e.req("on");let s=g(e);return{type:"setCommand",target:s,object:i,start:t,end:e.endPos(),run:a=>C([i.ev(a),s.ev(a)],([u,l])=>void Object.assign(Object(l),u))}}let n=e.withFollow(["to"],()=>se(e));e.req("to");let r=g(e);return{type:"setCommand",target:n,value:r,start:t,end:e.endPos(),run:i=>C([n.lhs?.(i),r.ev(i)],([s,c])=>n.put?.(i,s,c))}}}function an(e){for(let t of["increment","decrement"]){let n=t==="increment"?1:-1;e.commands[t]=(r,o,i)=>{let s=r.withFollow(n<0?["by"]:[],()=>se(r)),c=r.match("by")?g(r):void 0;return{type:`${t}Command`,target:s,amount:c,start:i,end:r.endPos(),run:u=>C([s.ev(u),c?.ev(u),s.lhs?.(u)],([l,p,f])=>{let d=(l?parseFloat(String(l)):0)+n*(c?parseFloat(String(p)):1);u.result=d,s.put?.(u,f,d)})}}}}function on(e,t){e.replaceChildren(fe(t)),V.process(e)}var ir=["arrayIndex","propertyAccess","possessive","ofExpression","attributeRef","styleRef","attributeRefAccess"],ar={into:"into",before:"before",after:"after",start:"start",end:"end"},cr={before:"before",after:"after",start:"prepend",end:"append"};function cn(e){e.commands.put=(t,n,r)=>{let o=g(t),i=t.matchAny("into","before","after");!i&&t.match("at")&&(t.match("the"),i=t.matchAny("start","end"),t.req("of"));let s=ar[(i??t.expected("into","before","at start of","at end of","after")).value],c=Ae(g(t)),a=t.text(c),u=(f,d)=>c.type==="symbol"?x(c.ev(f),m=>{R(m)||m instanceof Document?on(m,d):c.put?.(f,void 0,d)}):ir.includes(c.type)?x(c.lhs?.(f),m=>c.put?.(f,m,d)):x(c.ev(f),m=>{S(m,a),T(m,h=>{(R(h)||h instanceof Document)&&on(h,d)})}),l=(f,d,m)=>x(c.ev(f),h=>{if(S(h,a),Array.isArray(h)){m==="prepend"?h.unshift(d):h.push(d),k.wroteProperty(h);return}T(h,E=>{R(E)&&(E[m](d instanceof Node?d:fe(d)),V.process(E.parentElement??E))})});return{type:"putCommand",value:o,operation:s,target:c,start:r,end:t.endPos(),run:f=>x(o.ev(f),d=>s==="into"?u(f,d):l(f,d,cr[s]))}}}var un=new WeakSet;function ln(e){if(un.has(e))return;un.add(e);let t=!1,n=o=>{let i=t;t=!0;try{o()}finally{t=i}};document.addEventListener("htmx:load",o=>n(()=>e.process(o.detail?.elt))),document.addEventListener("htmx:after:process",o=>n(()=>e.process(o.target))),document.addEventListener("fx:swapped",o=>{let i=o.detail?.cfg?.target;e.process(i instanceof Element&&i.isConnected?i.parentElement??i:document.body)});let r=Reflect.get(globalThis,"htmx");typeof r?.process=="function"&&(e.addAfterProcessHook(o=>{t||n(()=>r.process(o))}),r.version?.startsWith("4")&&r.registerExtension?.("hs-include",{htmx_config_request(o,i){let s=i?.ctx;if(!s)return;let c=ur(s.sourceElement||o);if(!c)return;let a=dr(c.value,c.scopeElt),u=s.request?.body;if(u instanceof FormData)for(let l in a)u.set(l,a[l])}}))}function ur(e){let t=e.getAttribute("hs-include");if(t!==null)return{value:t,scopeElt:e};for(let n=e.parentElement;n;n=n.parentElement){let r=n.getAttribute("hs-include:inherited");if(r!==null)return{value:r,scopeElt:n}}return null}var _e=e=>e&&J(e)?.scopes?.elementScope||{};function Fe(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return""}return String(e)}function lr(e,t){for(let n=t;n;n=n.parentElement){let r=_e(n);if(e in r)return r[e]}}function dr(e,t){let n={},r=e.trim();if(r==="*"){let o=_e(t);for(let i of Object.keys(o))n[i[0]===":"?i.slice(1):i]=Fe(o[i]);return n}for(let o of r.split(","))if(o=o.trim(),!!o){if(o[0]===":"){let i=_e(t);o in i&&(n[o.slice(1)]=Fe(i[o]))}else if(o[0]==="^"){let i=lr(":"+o.slice(1),t);i!==void 0&&(n[o.slice(1)]=Fe(i))}else if(o[0]==="#"){let i=o.lastIndexOf(":");if(i>0){let s=_e(document.querySelector(o.slice(0,i))),c=o.slice(i+1);":"+c in s&&(n[c]=Fe(s[":"+c]))}}}return n}var mn=Ht(),dn=new Set,ut=new Set;function ft(...e){let t=e.filter(n=>!dn.has(n));for(let n of t)dn.add(n),n(mn);if(t.length)for(let n of[...ut])ut.delete(n),n.isConnected&&(Ge(n),lt(n))}var pn=e=>new Oe(mn,he(e),e);function fr(e){let t=pn(e),n=ot(t);return t.hasMore()&&t.err(),n}function hn(e){let t=pn(e),n=t.cur(),r=t.commandStart(n)?{kind:"commands",commands:Y(t)}:t.featureStart(n)?{kind:"features",program:ot(t)}:{kind:"expression",expression:g(t)};return t.hasMore()&&t.err(),r}function fn(e,t){let n;try{n=hn(e)}catch(i){throw i instanceof W?new Error(i.message+`
|
|
10
10
|
|
|
11
|
-
`+
|
|
11
|
+
`+rt(i)):i}let r=document.body;if(n.kind==="features"){for(let i of n.program.features)i.install(r,r);return}let o=Object.assign(pe(r,void 0,r,null),t);return n.kind==="expression"?n.expression.ev(o):x(U(n.commands,o),i=>{let s=v(i,"k")==="return"?v(i,"value"):void 0;return s!==void 0?s:o.result})}var yn=()=>K.attributes.replaceAll(" ","").split(","),gn=e=>e instanceof HTMLScriptElement&&e.type==="text/hyperscript";function mr(e){for(let t of yn())if(e.hasAttribute(t))return e.getAttribute(t);return gn(e)?e.innerText:null}var pr=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return t},wn=[];function lt(e){if(e.closest(K.disableSelector))return;let t=mr(e);if(!t)return;let n=pr(t);if(J(e)?.initialized){if(J(e)?.scriptHash===n)return V.enter(e);Me(e)}if(!F(e,"hyperscript:before:init"))return;Object.assign(X(e),{initialized:!0,scriptHash:n});let r=gn(e)?document.body:e,o=t;try{for(let s of wn)o=s(o,e)??o;let{features:i}=fr(o);V.enter(e);for(let s of i)s.install(r,e);e.setAttribute("data-hyperscript-powered","true"),F(e,"hyperscript:after:init"),setTimeout(()=>F(r,"load",{hyperscript:!0}),1)}catch(i){if(i instanceof W){ut.add(e),o!==t&&(i.written=t),F(e,"hyperscript:parse-error",{errors:[i]});let s=i.written?`
|
|
12
12
|
rewritten from: ${i.written}
|
|
13
13
|
`:"";console.error("hyperscript: 1 parse error(s) on:",e,`
|
|
14
14
|
|
|
15
|
-
`+
|
|
15
|
+
`+rt(i)+s)}else F(e,"exception",{error:i}),console.error("hyperscript errors were found on the following element:",e,`
|
|
16
16
|
|
|
17
|
-
`,i)}}var
|
|
17
|
+
`,i)}}var vn=[],xn=[],ct=new Set;function we(e){if((e instanceof Element||e instanceof Document||e instanceof DocumentFragment)&&!ct.has(e)){ct.add(e);try{for(let n of vn)n(e);let t=yn().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&<(e),e.querySelectorAll(t).forEach(lt);for(let n of xn)n(e)}finally{ct.delete(e)}}}function Me(e){let t=J(e);if(t){F(e,"hyperscript:before:cleanup");for(let{target:n,event:r,handler:o}of t.listeners??[])n.removeEventListener(r,o);for(let n of t.observers??[])n.disconnect();for(let n of t.timers??[])clearTimeout(n);k.stop(e),e.querySelectorAll("[data-hyperscript-powered]").forEach(Me),F(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),Ge(e)}}V.process=we;function hr(e){try{let t=hn(e);return t.kind==="features"?{...t.program,errors:[]}:{...t.kind==="commands"?t.commands[0]:t.expression,errors:[]}}catch(t){if(t instanceof W)return{errors:[t]};throw t}}var dt=Object.assign(fn,{config:Object.assign(K,{conversions:Object.assign(He,{dynamicResolvers:De})}),use(e){e(dt)},addBeforeProcessHook:e=>void vn.push(e),addAfterProcessHook:e=>void xn.push(e),addSourceTransform:e=>void wn.push(e),register:ft,extensions:new Set,evaluate:fn,parse:hr,process:we,processNode:we,cleanup:Me,internals:{runtime:{cleanup:Me,processNode:we}},version:"7.6.0"});function En(){if(Object.assign(globalThis,{_hyperscript:dt}),typeof document>"u")return;let e=()=>{we(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),ln(dt)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function yr(e,t){if(typeof e!="object"||e===null)return{queue:[],executing:!1};let n=X(e).eventQueues??=new Map,r=n.get(t);return r||n.set(t,r={queue:[],executing:!1}),r}function mt(e,t){let n=yr(e.me,t);if(n.executing&&!t.every){if(t.queue==="none"||t.queue==="first"&&n.queue.length>0)return;t.queue!=="all"&&(n.queue.length=0),n.queue.push(e);return}n.executing=!0;let r=o=>{n.executing=!1;let i=n.queue.shift();if(i&&setTimeout(()=>mt(i,t),1),o){let{error:s}=o;console.error(v(s,"message")??s),console.error(v(s,"stack")),F(e.me,"exception",{error:s})}};ce(()=>x(Et(e,t.body,t),()=>r()),o=>r({error:o}))}function gr(e,t){if(!$(t))return;let n=X(t),r=n.listeners??=[],o=n.observers??=[],i=n.timers??=new Set;for(let s of e.events){let c={execCount:0},a=s.elsewhere?[document]:s.from?s.from.ev(pe(t,e,t,null)):[t];T(a,u=>{if(!$(u)){console.warn("'%s' feature ignored because target does not exists:",e.displayName,t);return}let l=s.on;if(s.mutationSpec&&u instanceof Node){l="hyperscript:mutation";let f=new MutationObserver(d=>F(u,l,{mutationList:d,observer:f}));f.observe(u,s.mutationSpec),o.push(f)}if(s.intersectionSpec&&u instanceof Element){l="hyperscript:intersection";let f=new IntersectionObserver(d=>{for(let m of d)F(u,l,{observer:f,entry:m,intersecting:m.isIntersecting,isIntersecting:m.isIntersecting,intersectionRatio:m.intersectionRatio})},s.intersectionSpec);f.observe(u),o.push(f)}if(s.resizeSpec&&u instanceof Element){l="hyperscript:resize";let f=new ResizeObserver(d=>{for(let m of d){let{width:h,height:E}=m.contentRect;F(u,l,{width:h,height:E,contentRect:m.contentRect,entry:m})}});f.observe(u),o.push(f)}let p=f=>{if(t instanceof Node&&u!==t&&!t.isConnected){u.removeEventListener(l,p);return}let d=pe(t,e,t,f);if(!(s.elsewhere&&t instanceof Node&&f.target instanceof Node&&t.contains(f.target))){s.from&&(d.result=u);for(let m of s.args){let h=v(f,m);h!==void 0?d.locals[m]=h:d.detail!=null&&(d.locals[m]=v(d.detail,m))}if(s.filter){d.meta.context=f;try{if(!s.filter.ev(d))return}finally{d.meta.context=void 0}}if(s.inExpr?.css){let m=f.target instanceof Element?f.target:null;for(;m&&!m.matches(s.inExpr.css);)m=m.parentElement;if(!m)return;d.result=m}if(c.execCount++,s.startCount){let m=c.execCount;if(s.endCount?m<s.startCount||m>s.endCount:s.unbounded?m<s.startCount:m!==s.startCount)return}if(s.debounceTime){c.debounced&&(clearTimeout(c.debounced),i.delete(c.debounced)),i.add(c.debounced=setTimeout(()=>mt(d,e),s.debounceTime));return}if(s.throttleTime){if(c.lastExec&&Date.now()<c.lastExec+s.throttleTime)return;c.lastExec=Date.now()}mt(d,e)}};u.addEventListener(l,p),r.push({target:u,event:l,handler:p})})}}function wr(e){if(!e.match("of"))return{attributes:!0,characterData:!0,childList:!0,attributeOldValue:!0,characterDataOldValue:!0};let t={};do if(e.match("anything"))Object.assign(t,{attributes:!0,subtree:!0,characterData:!0,childList:!0});else if(e.match("childList"))t.childList=!0;else if(e.match("attributes"))t.attributes=!0;else if(e.match("subtree"))t.subtree=!0;else if(e.match("characterData"))t.characterData=!0;else if(e.cur().type==="ATTRIBUTE_REF"){let n=e.consume().value;n.startsWith("@")||e.err("Only shorthand attribute references are allowed here"),(t.attributeFilter??=[]).push(n.substring(1))}else e.err("Unknown mutation config specification");while(e.match("or"));return(t.attributes||t.attributeFilter)&&(t.attributeOldValue=!0),t.characterData&&(t.characterDataOldValue=!0),t}function vr(e){let t={};if(e.match("with")){let n=ye(g(e));n instanceof Element&&(t.root=n)}if(e.match("having"))do e.match("margin")?t.rootMargin=It(e):e.match("threshold")?t.threshold=Number(ye(g(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function xr(e,t){let n=te(e),r=Le(e),o;e.matchOp("[")&&(o=g(e),e.reqOp("]"));let i,s,c=!1;t?i=1:e.cur().type==="NUMBER"&&(i=parseInt(e.consume().value),e.match("to")?s=parseInt(e.consume().value):e.match("and")&&(c=!0,e.req("on")));let a={on:n,args:r,filter:o,startCount:i,endCount:s,unbounded:c,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?a.intersectionSpec=vr(e):n==="mutation"&&(a.mutationSpec=wr(e)),e.match("from")&&(e.match("elsewhere")?a.elsewhere=!0:a.from=e.withFollow(["or"],()=>g(e))),!a.from&&!a.elsewhere&&e.match("elsewhere")&&(a.elsewhere=!0),e.match("in")&&(a.inExpr=ee(e));let u=()=>(e.req("at"),Number(ye(ee(e))));return e.match("debounced")?a.debounceTime=u():e.match("throttled")&&(a.throttleTime=u()),a}function bn(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),i=[];do i.push(xr(t,o));while(t.match("or"));let s="last";!r&&t.match("queue")&&(t.match("all")?s="all":t.match("first")?s="first":t.match("none")?s="none":t.req("last"));let c=Y(t),a={type:"onFeature",displayName:"on "+i.map(u=>u.on).join(" or "),events:i,body:c,every:r,queue:s,...jt(t),start:n,end:t.endPos(),install:u=>gr(a,u)};return a}}ft(bn,Qt,Yt,Xt,Zt,sn,cn,an,Gt,Wt,Kt,en,tn,nn,rn);En();})();
|
package/dist/core.js
CHANGED
|
@@ -1610,6 +1610,7 @@
|
|
|
1610
1610
|
};
|
|
1611
1611
|
var createGrammar = () => ({
|
|
1612
1612
|
commands: /* @__PURE__ */ Object.create(null),
|
|
1613
|
+
fallbacks: /* @__PURE__ */ Object.create(null),
|
|
1613
1614
|
features: /* @__PURE__ */ Object.create(null),
|
|
1614
1615
|
leaves: [],
|
|
1615
1616
|
indirects: [],
|
|
@@ -1655,6 +1656,15 @@
|
|
|
1655
1656
|
pos() {
|
|
1656
1657
|
return this.cur().start;
|
|
1657
1658
|
}
|
|
1659
|
+
/** Where the parser is, for `reset`: a command's fallback reads again from here. */
|
|
1660
|
+
mark() {
|
|
1661
|
+
return { i: this.i, last: this.last, follows: this.follows.length };
|
|
1662
|
+
}
|
|
1663
|
+
reset(mark) {
|
|
1664
|
+
this.i = mark.i;
|
|
1665
|
+
this.last = mark.last;
|
|
1666
|
+
this.follows.length = mark.follows;
|
|
1667
|
+
}
|
|
1658
1668
|
/** End offset of the last consumed token — a node's `end`. */
|
|
1659
1669
|
endPos() {
|
|
1660
1670
|
return this.last.end;
|
|
@@ -1789,6 +1799,28 @@
|
|
|
1789
1799
|
}
|
|
1790
1800
|
|
|
1791
1801
|
// src/statements.ts
|
|
1802
|
+
function withFallbacks(p, rule, keyword, start) {
|
|
1803
|
+
const fallbacks = p.g.fallbacks[keyword];
|
|
1804
|
+
if (!fallbacks) return rule(p, keyword, start);
|
|
1805
|
+
const mark = p.mark();
|
|
1806
|
+
try {
|
|
1807
|
+
return rule(p, keyword, start);
|
|
1808
|
+
} catch (e) {
|
|
1809
|
+
if (!(e instanceof ParseError)) throw e;
|
|
1810
|
+
let error = e;
|
|
1811
|
+
for (const fallback of fallbacks) {
|
|
1812
|
+
p.reset(mark);
|
|
1813
|
+
try {
|
|
1814
|
+
const cmd = fallback(p, keyword, start);
|
|
1815
|
+
if (cmd && p.pos() >= e.token.start) return cmd;
|
|
1816
|
+
} catch (f) {
|
|
1817
|
+
if (!(f instanceof ParseError)) throw f;
|
|
1818
|
+
if (f.token.start > error.token.start) error = f;
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
throw error;
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1792
1824
|
function command(p) {
|
|
1793
1825
|
const start = p.pos();
|
|
1794
1826
|
if (p.matchOp("(")) {
|
|
@@ -1799,7 +1831,7 @@
|
|
|
1799
1831
|
const t = p.cur();
|
|
1800
1832
|
const rule = p.g.commands[t.value];
|
|
1801
1833
|
let cmd;
|
|
1802
|
-
if (rule) cmd = p.match(t.value) &&
|
|
1834
|
+
if (rule) cmd = p.match(t.value) && withFallbacks(p, rule, t.value, start);
|
|
1803
1835
|
else if (t.type === "IDENTIFIER") cmd = p.g.pseudo?.(p, start);
|
|
1804
1836
|
if (!cmd || !p.match("unless")) return cmd;
|
|
1805
1837
|
const inner = cmd;
|
|
@@ -1874,8 +1906,21 @@
|
|
|
1874
1906
|
|
|
1875
1907
|
// src/engine.ts
|
|
1876
1908
|
var grammar = createGrammar();
|
|
1909
|
+
var registered = /* @__PURE__ */ new Set();
|
|
1910
|
+
var unread = /* @__PURE__ */ new Set();
|
|
1877
1911
|
function register(...modules) {
|
|
1878
|
-
|
|
1912
|
+
const added = modules.filter((module) => !registered.has(module));
|
|
1913
|
+
for (const module of added) {
|
|
1914
|
+
registered.add(module);
|
|
1915
|
+
module(grammar);
|
|
1916
|
+
}
|
|
1917
|
+
if (!added.length) return;
|
|
1918
|
+
for (const elt of [...unread]) {
|
|
1919
|
+
unread.delete(elt);
|
|
1920
|
+
if (!elt.isConnected) continue;
|
|
1921
|
+
dropData(elt);
|
|
1922
|
+
initElement(elt);
|
|
1923
|
+
}
|
|
1879
1924
|
}
|
|
1880
1925
|
var parser = (src) => new Parser(grammar, tokenize(src), src);
|
|
1881
1926
|
function parseProgram(src) {
|
|
@@ -1948,6 +1993,7 @@
|
|
|
1948
1993
|
setTimeout(() => triggerEvent(target, "load", { hyperscript: true }), 1);
|
|
1949
1994
|
} catch (e) {
|
|
1950
1995
|
if (e instanceof ParseError) {
|
|
1996
|
+
unread.add(elt);
|
|
1951
1997
|
if (src !== written) e.written = written;
|
|
1952
1998
|
triggerEvent(elt, "hyperscript:parse-error", { errors: [e] });
|
|
1953
1999
|
const from = e.written ? `
|
|
@@ -2014,6 +2060,12 @@
|
|
|
2014
2060
|
addAfterProcessHook: (hook) => void afterProcess.push(hook),
|
|
2015
2061
|
/** Not in upstream: rewrite a script as it is read, leaving the attribute as written. */
|
|
2016
2062
|
addSourceTransform: (transform) => void transforms.push(transform),
|
|
2063
|
+
/** Not in upstream: add grammar modules, from a script tag (`dist/ext/<name>.js`) or a page. */
|
|
2064
|
+
register,
|
|
2065
|
+
// `kit` (what a module may call) is added by the script-tag bundle (`bundles/full.ts`) only,
|
|
2066
|
+
// so a bundle of the user's own keeps only the parts of the engine it uses.
|
|
2067
|
+
/** Not in upstream: the extension files (`dist/ext/<name>.js`) this page has loaded. */
|
|
2068
|
+
extensions: /* @__PURE__ */ new Set(),
|
|
2017
2069
|
evaluate,
|
|
2018
2070
|
parse: hostParse,
|
|
2019
2071
|
process: processNode,
|
|
@@ -2022,7 +2074,7 @@
|
|
|
2022
2074
|
cleanup,
|
|
2023
2075
|
/** The part of upstream's `internals` that pages and tests reach for. */
|
|
2024
2076
|
internals: { runtime: { cleanup, processNode } },
|
|
2025
|
-
version: false ? "dev" : "7.
|
|
2077
|
+
version: false ? "dev" : "7.6.0"
|
|
2026
2078
|
});
|
|
2027
2079
|
function boot() {
|
|
2028
2080
|
Object.assign(globalThis, { _hyperscript: api });
|