@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/full.min.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`,r:"\r",t:" ",v:"\v"},
|
|
3
|
-
`,
|
|
4
|
-
`?(s++,o=0):o++,i),m=b=>({type:b,value:"",start:r,end:r+1,line:s,column:o}),f=(b,k)=>(b.value=k,b.end=r,b),p=b=>{let k="";for(;a()&&b(a());)k+=l();return k},d=()=>
|
|
5
|
-
`),l();else if(Ct(b))n.push(f(m("WHITESPACE"),p(Ct)));else if(!y()&&b==="."&&(se(k)||k==="{"||k==="-"))n.push(g("CLASS_REF",!0));else if(!y()&&b==="#"&&(se(k)||k==="{"))n.push(g("ID_REF",!1));else if(b==="@"||b==="["&&k==="@")n.push(A());else if(b==="*"&&se(k)){let L=m("STYLE_REF");n.push(f(L,l()+p(H=>se(H)||H==="-")))}else if(d()&&(se(b)||b==="\\"))n.push(S());else if(!d()&&(se(b)||b==="_"||b==="$"))n.push(C());else if(ie(b))n.push(R());else if(!d()&&(b==='"'||b==="`"))n.push(v());else if(!d()&&b==="'")n.push(M()?v():I());else if(un.has(b))i==="$"&&b==="{"&&c++,b==="}"&&c--,n.push(I());else if(d()||b==="`"){let L=m("RESERVED");n.push(f(L,l()))}else throw new Error("Unknown token: "+b+" ")}return n}function h(t){return t.match("the"),Eo(t)}function Eo(t){let e=fn(t),n,r=()=>t.match("and")??t.match("or");for(let o=r();o;o=r())n??=o.value,n!==o.value&&t.err("You must parenthesize logical operations with different operators"),e=bo(o.value,e,fn(t));return e}function bo(t,e,n){let r=t==="or";return{type:"logicalOperator",operator:t,left:e,right:n,start:e.start,end:n.end,ev:o=>E(e.ev(o),s=>!!s===r?s:n.ev(o))}}var xo={"+":(t,e)=>Array.isArray(t)?t.concat(e):T(t)+T(e),"-":(t,e)=>T(t)-T(e),"*":(t,e)=>T(t)*T(e),"/":(t,e)=>T(t)/T(e),mod:(t,e)=>T(t)%T(e)};function Rt(t){let e=Ot(t),n,r=()=>t.matchAnyOp("+","-","*","/")??t.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&t.err("You must parenthesize math operations with different operators");let s=e,i=Ot(t),c=xo[o.value];e={type:"mathOperator",operator:o.value,left:s,right:i,start:s.start,end:i.end,ev:u=>N([s.ev(u),i.ev(u)],([l,m])=>c(l,m))}}return e}function Ot(t){let e=$(t);for(let n=!0;n;){n=!1;for(let r of t.g.collections){let o=r(t,e);if(o){e=o,n=!0;break}}}return e}function $(t){t.match("the");let e=t.pos();if(t.match("not"))return Ce(t,"logicalNot",e,$(t),n=>!n);if(t.match("no"))return Ce(t,"noExpression",e,Ot(t),qe);for(let n of t.g.unaries){let r=n(t);if(r)return ee(t,r)}return No(t)}function Ce(t,e,n,r,o,s=e!=="negativeNumber"){let i={type:e,root:r,start:n,end:t.endPos(),ev:c=>E(r.ev(c),a=>o(a,c))};return s?ee(t,i):i}var ko="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function No(t){let e=hn(t),n=t.matchAny(...ko)??t.matchOp("%");if(n)return dn(t,"stringPostfixExpression",e,n.value);let r=t.matchAny("s","seconds")?1e3:t.matchAny("ms","milliseconds")?1:0;if(r)return dn(t,"timeExpression",e,r);for(let o of t.g.postfixes){let s=o(t,e);if(s)return s}return e}function dn(t,e,n,r){let o=i=>typeof r=="number"?T(i)*r:`${i}${r}`,s={type:e,root:n,suffix:r,start:n.start,end:t.endPos(),ev:i=>E(n.ev(i),o)};return n.stat&&(s.stat=()=>o(je(n))),s}function hn(t){let e=t.pos();return t.matchOp("-")?Ce(t,"negativeNumber",e,hn(t),n=>-T(n)):ct(t)}function ct(t){let e=Ft(t);return e?ee(t,e):t.err("Unexpected value: "+t.cur().value)}function ae(t){return t.match("the"),Lt(t,ct(t))}function Lt(t,e){let n=_e(e);return n.put||t.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function _e(t){let e=t;for(;e.type==="parenthesized"&&"expr"in e&&To(e.expr);)e=e.expr;return e}var To=t=>G(w(t,"ev"));function je(t){if(t.stat)return t.stat();throw new Error("This expression cannot be evaluated statically: "+t.type)}function Co(t){let e=t.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(e)return{operator:e.value,right:!0,isType:!1};let n=(a,u=!0,l=!1)=>({operator:a,right:u,isType:l}),r=()=>t.match("equal")&&t.match("to"),o=(a,u)=>(t.req("than"),t.match("or")?(t.req("equal"),t.req("to"),n(u)):n(a));if(t.match("is")||t.match("am")){let a=!!t.match("not"),u=a?"not ":"";return t.match("in")?n(u+"in"):t.match("a")||t.match("an")?n(u+"a",!1,!0):t.match("empty")?n(u+"empty",!1):t.match("between")?n(u+"between"):!a&&t.match("less")?o("<","<="):!a&&t.match("greater")?o(">",">="):t.match("really")?(r(),n(a?"!==":"===")):t.match("equal")?(t.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(t.match("equals"))return n("==");if(t.match("really"))return t.req("equals"),n("===");if(t.matchAny("exist","exists"))return n("exist",!1);let s=!!t.matchAny("do","does");s&&t.req("not");let i=s?"not ":"",c=(a,u)=>t.match(a)??(s&&a!=="match"&&a!=="contain"?void 0:t.match(u));if(c("match","matches"))return n(i+"match");if(c("contain","contains"))return n(i+"contain");if(s&&t.match("exist"))return n("not exist",!1);if(c("include","includes"))return n(i+"include");if(t.match(s?"start":"starts"))return t.req("with"),n(i+"start with");if(t.match(s?"end":"ends"))return t.req("with"),n(i+"end with");if(c("precede","precedes"))return n(i+"precede");if(c("follow","follows"))return n(i+"follow");s&&t.expected("matches","contains","starts with","ends with","precede","follow")}function fn(t){let e=Rt(t),n=Co(t);if(!n)return e;let{operator:r}=n,o,s=!0,i,c;n.isType?(o=t.reqType("IDENTIFIER").value,s=!t.matchOp("!")):n.right&&(i=Rt(t),r.endsWith("match")&&(c=i.css));let a;r.endsWith("between")&&(t.req("and"),a=Rt(t));let u=!1;t.match("ignoring")&&(t.req("case"),u=!0);let l=p=>u&&typeof p=="string"?p.toLowerCase():p,m=i?.type==="symbol"&&"scope"in i&&i.scope==="local"&&i.name!=="undefined"&&i.name!=="null"?i.name:void 0;return{type:"comparisonOperator",operator:r,left:e,right:i,right2:a,typeName:o,ignoringCase:u,start:e.start,end:t.endPos(),ev:p=>N([e.ev(p),c??i?.ev(p),a?.ev(p)],([d,y,g])=>{if(o){let v=nt(d,o,s);return r==="a"?v:!v}if(m&&y===void 0&&(r==="is"||r==="is not")){let v=!!ue(d,m);return r==="is"?v:!v}return yn(r,l(d),l(y),g)})}}function mn(t,e){let n=w(t,"contains")??w(t,"includes");if(!G(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,t,[e])}function So(t,e){let n=w(t,"match")??w(t,"matches");if(!G(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,t,[e])}var pn=(t,e,n)=>t instanceof Node&&e instanceof Node&&(t.compareDocumentPosition(e)&n)!==0;function yn(t,e,n,r){if(t==="not between")return T(e)<T(n)||T(e)>T(r);if(t.startsWith("not "))return!yn(t.slice(4),e,n,r);switch(t){case"is":case"==":return e==n;case"is not":case"!=":return e!=n;case"===":return e===n;case"!==":return e!==n;case"<":return T(e)<T(n);case">":return T(e)>T(n);case"<=":return T(e)<=T(n);case">=":return T(e)>=T(n);case"match":return e!=null&&So(e,n);case"in":return n!=null&&mn(n,e);case"contain":case"include":return e!=null&&mn(e,n);case"start with":return e!=null&&String(e).startsWith(String(n));case"end with":return e!=null&&String(e).endsWith(String(n));case"between":return T(e)>=T(n)&&T(e)<=T(r);case"precede":return pn(e,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return pn(e,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return qe(e);case"exist":return an(e)}throw new Error("Unknown comparison : "+t)}function Ft(t){let e=t.cur();switch(e.type){case"NUMBER":return t.consume(),It("number",parseFloat(e.value),e);case"STRING":return Io(t);case"ID_REF":return Ao(t);case"CLASS_REF":return te(t);case"ATTRIBUTE_REF":return K(t);case"STYLE_REF":return vn(t)}if(e.op){if(e.value==="(")return Po(t);if(e.value==="[")return Oo(t);if(e.value==="{")return De(t);if(e.value==="<")return Lo(t)}let n=t.match("true")??t.match("false");if(n)return It("boolean",n.value==="true",n);let r=t.match("null");if(r)return It("null",null,r);for(let o of t.g.leaves){let s=o(t);if(s)return s}return qt(t)}function It(t,e,n){return{type:t,value:e,start:n.start,end:n.end,ev:()=>e,stat:()=>e}}function Po(t){let e=t.pos();t.consume();let n=t.withoutFollows(()=>h(t));return t.reqOp(")"),{type:"parenthesized",expr:n,start:e,end:t.endPos(),ev:r=>n.ev(r)}}var Ro=(t,e)=>N(t.map(n=>typeof n=="string"?n:n.ev(e)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function gn(t,e){let n=t.child(de(e,!0),e),r=[],o="";do{o+=n.lastWs();let s=n.cur();if(s.value==="$"){n.consume();let i=n.matchOp("{");r.push(o,h(n)),o="",i&&n.reqOp("}")}else s.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function Io(t){let e=t.consume(),n=e.value,r={type:"string",value:n,start:e.start,end:e.end,ev:()=>n};if(e.template){let o=r.parts=gn(t,n);r.ev=s=>Ro(o,s)}else r.stat=()=>n;return r}function Oo(t){let e=t.pos();t.consume();let n=[];if(!t.matchOp("]")){do n.push(h(t));while(t.matchOp(","));t.reqOp("]")}return{type:"arrayLiteral",values:n,start:e,end:t.endPos(),ev:r=>N(n.map(o=>o.ev(r)),o=>o)}}function De(t){let e=t.pos();t.consume();let n=[],r=[],o=()=>t.cur().op&&t.cur().value==="}";if(!t.matchOp("}")){do{let s=t.matchType("STRING");if(s)n.push(s.value);else if(t.matchOp("["))n.push(h(t)),t.reqOp("]");else{let i="";for(let c=t.matchType("IDENTIFIER")??t.matchOp("-");c;c=t.matchType("IDENTIFIER")??t.matchOp("-"))i+=c.value;n.push(i)}t.reqOp(":"),r.push(h(t))}while(t.matchOp(",")&&!o());t.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:e,end:t.endPos(),ev:s=>N([...n.map(i=>typeof i=="string"?i:i.ev(s)),...r.map(i=>i.ev(s))],i=>Object.fromEntries(n.map((c,a)=>[String(i[a]),i[n.length+a]])))}}function ut(t){if(!t.matchOp("("))return;let e=t.last.start,n=He(t,e);return t.reqOp(")"),n.end=t.endPos(),n}function He(t,e=t.pos()){let n=[],r=[];if(t.cur().type==="IDENTIFIER")do n.push(t.reqType("IDENTIFIER").value),t.reqOp(":"),r.push(h(t));while(t.matchOp(","));return{type:"namedArgumentList",names:n,values:r,start:e,end:t.endPos(),ev:o=>N(r.map(s=>s.ev(o)),s=>Object.fromEntries([["_namedArgList_",!0],...n.map((i,c)=>[i,s[c]])]))}}function Ge(t){return t.matchType("STRING")?.value??t.consumeUntil(void 0,"WHITESPACE").map(e=>e.value).join("")}function Mt(t){let e=t.cur();if(!(e.op&&e.value==="/"||e.type==="IDENTIFIER"&&["http","https","ws","wss"].includes(e.value)))return h(t);let r=Ge(t);return{type:"string",value:r,start:e.start,end:t.endPos(),ev:()=>r,stat:()=>r}}function qt(t){let e=t.pos(),n;t.match("global")?n="global":t.match("element")?(n="element",t.matchOp("'")&&t.req("s")):t.match("dom")?n="inherited":t.match("local")&&(n="local");let r=t.matchOp(":"),o=!r&&t.matchOp("^"),s=t.matchType("IDENTIFIER");if(!s?.value)return;let i=(r?":":o?"^":"")+s.value,a=n??{$:"global",":":"element","^":"inherited"}[i[0]]??"local",u;return a==="inherited"&&t.match("on")&&(u=t.withFollow(["to","into","before","after","then"],()=>h(t))),{type:"symbol",name:i,scope:a,...u?{on:u}:{},start:e,end:t.endPos(),ev:l=>le(i,l,a,u?.ev(l)),lhs:()=>{},put:(l,m,f)=>ot(i,l,a,f,u?.ev(l))}}var wn=(t,e)=>{let n=e.value.substring(2);return h(t.child(de(n),n))};function Ao(t){let e=t.consume(),n=(o,s)=>xt(o.me).getElementById(String(s)),r={type:"idRef",start:e.start,end:e.end,ev:()=>null,lhs:()=>{},put:(o,s,i)=>E(r.ev(o),c=>c&&Ee(c,i))};if(e.template){let o=r.expr=wn(t,e);r.ev=s=>E(o.ev(s),i=>n(s,i))}else{let o=r.value=e.value.substring(1);r.css=e.value,r.ev=s=>n(s,o)}return r}function te(t){let e=t.matchType("CLASS_REF");if(!e)return;let n={type:"classRef",start:e.start,end:e.end,ev:()=>null,lhs:()=>{},put:(r,o,s)=>E(n.ev(r),i=>Ee(Array.from(i instanceof ne?i:[]),s))};if(e.template){let r=n.expr=wn(t,e);n.ev=o=>E(r.ev(o),s=>new ne("."+s,o.me,!0))}else{let r=n.css=e.value;n.className=r.slice(1),n.ev=o=>new ne(r,o.me,!0)}return n}var At=class extends ne{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>x(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(x);n.forEach((o,s)=>o.setAttribute("data-hs-query-id",String(s)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function Lo(t){let e=t.pos();t.consume();let n=t.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");t.reqOp("/"),t.reqOp(">");let r={type:"queryRef",css:n,start:e,end:t.endPos(),ev:o=>new ne(n,o.me),lhs:()=>{},put:(o,s,i)=>E(r.ev(o),c=>Ee(Array.from(c instanceof ne?c:[]),i))};if(/\$[^=]/.test(n)){let o=r.parts=gn(t,n);r.ev=s=>N(o.map(i=>typeof i=="string"?i:i.ev(s)),i=>new At(s.me,i))}return r}function K(t){let e=t.matchType("ATTRIBUTE_REF");if(!e)return;let n=e.value.startsWith("[")?e.value.slice(2,-1):e.value.slice(1),[r,o]=n.split("="),s=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:s,css:`[${n}]`,start:e.start,end:e.end,ev:i=>we(i.you||i.me,r),lhs:()=>{},put:(i,c,a)=>Me(i.you||i.me,r,a)}}function vn(t){let e=t.matchType("STYLE_REF");if(!e)return;let n=e.value.startsWith("*computed-"),r=e.value.slice(n?10:1);return{type:n?"computedStyleRef":"styleRef",name:r,start:e.start,end:e.end,ev:o=>(n?Ze:Xe)(o.you||o.me,r),lhs:()=>{},put:(o,s,i)=>et(o.you||o.me,r,i)}}function En(t){let e=t.pos();if(!t.matchOp("{"))return;let n=[""],r=[];for(;t.hasMore();){if(t.matchOp("\\"))t.consume();else{if(t.matchOp("}"))break;if(t.match("$")){let o=t.matchOp("{");r.push(h(t)),o&&t.reqOp("}"),n.push("")}else n[n.length-1]+=t.text(t.consume())}n[n.length-1]+=t.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:e,end:t.endPos(),ev:o=>N(r.map(s=>s.ev(o)),s=>n.map((i,c)=>i+(c in s?`${s[c]}`:"")).join(""))}}function U(t){let e=t.endPos();return{type:"implicitMeTarget",start:e,end:e,ev:n=>n.you||n.me}}function Se(t){let e=t.matchType("IDENTIFIER");if(!e)return;let n=[e.value],r=t.matchOp(".")??t.matchOp(":");if(r)do n.push(t.reqType("IDENTIFIER","NUMBER").value);while(t.matchOp(r.value));return n.join(r?.value??"")}function ce(t,e="Expected event name"){return t.matchType("STRING")?.value??Se(t)??t.err(e)}function ee(t,e){return Mo(t,e)??qo(t,e)??Go(t,e)??_o(t,e)??jo(t,e)??Do(t,e)??Ho(t,e)??$o(t,e)??Fo(t,e)??e}function Fo(t,e){for(let n of t.g.indirects){let r=n(t,e);if(r)return r}}function Mo(t,e){if(!t.matchOp("."))return;let n=t.reqType("IDENTIFIER").value,r=t.text(e),o={type:"propertyAccess",root:e,prop:n,start:e.start,end:t.endPos(),ev:s=>E(o.root.ev(s),i=>ue(i,n)),lhs:s=>o.root.ev(s),put:(s,i,c)=>{F(i,r),tt(i,n,c)},del:(s,i)=>{F(i,r),O(i,c=>{W(c)&&delete c[n],P.wroteProperty(c)})}};return ee(t,o)}function qo(t,e){if(!t.match("of"))return;let n=$(t),r,o=e;for(;o.root;)r=o,o=o.root;let i={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],c=o.name;if(!i||c===void 0)return t.err("Cannot take a property of a non-symbol: "+o.type);let a=t.text(n),u={property:ue,attribute:we,style:Xe,computed:Ze}[i],l={type:"ofExpression",root:n,name:c,kind:i,start:e.start,end:t.endPos(),ev:m=>E(l.root.ev(m),f=>u(f,c)),lhs:m=>l.root.ev(m),put:(m,f,p)=>{F(f,a),i==="attribute"?Me(f,c,p):i==="property"?tt(f,c,p):et(f,c,p)},del:(m,f)=>{F(f,a),O(f,p=>{i==="attribute"?x(p)&&p.removeAttribute(c):i==="property"?(W(p)&&delete p[c],P.wroteProperty(p)):p instanceof HTMLElement&&p.style.removeProperty(c)})}};return r?(r.root=l,ee(t,e)):ee(t,l)}function _o(t,e){let n=t.matchOp("'"),r=e.type==="symbol"&&["my","its","your"].includes(e.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(t.cur().type);if(!n&&!r)return;n&&t.req("s");let o=K(t)??vn(t),s=o?void 0:t.reqType("IDENTIFIER").value,i=t.text(e),c=u=>s!==void 0?ue(u,s):o?.type==="attributeRef"?we(u,o.name):o?.type==="computedStyleRef"?Ze(u,o.name):o&&Xe(u,o.name),a={type:"possessive",root:e,prop:s,attribute:o,start:e.start,end:t.endPos(),ev:u=>E(a.root.ev(u),c),lhs:u=>a.root.ev(u),put:(u,l,m)=>{F(l,i),s!==void 0?tt(l,s,m):o?.type==="attributeRef"?Me(l,o.name,m):o&&et(l,o.name,m)}};return ee(t,a)}function jo(t,e){if(!t.match("in"))return;let n=$(t),r=(i,c)=>{if(i==null)return[];let a=[],u=w(i,"css");if(typeof u=="string")O(c,l=>x(l)&&a.push(...kt(l,u)));else if(x(i)){let l=!1;if(O(c,m=>{m instanceof Node&&m.contains(i)&&(l=!0)}),l)return i}else O(i,l=>O(c,m=>l===m&&a.push(l)));return a},o={type:"inExpression",root:e,target:n,start:e.start,end:t.endPos(),ev:i=>N([o.root.ev(i),n.ev(i)],([c,a])=>r(c,a)),lhs:i=>o.ev(i),put:(i,c,a)=>Ee(c,a)},s;if(t.peek("where"))for(let i of t.g.collections)s??=i(t,o);return ee(t,s??o)}function Do(t,e){if(!t.match("as"))return;t.match("a")||t.match("an");let n=o=>{let s=Se(t)??t.err("Expected dotOrColonPath"),i={type:"asExpression",root:o,conversion:s,start:o.start,end:t.endPos(),ev:c=>E(i.root.ev(c),a=>rt(a,s))};return i},r=n(e);for(;t.matchOp("|");)r=n(r);return ee(t,r)}function Ho(t,e){if(!t.matchOp("("))return;let n=[];if(!t.matchOp(")")){do n.push(h(t));while(t.matchOp(","));t.reqOp(")")}let r=t.text(e),o=e.root?t.text(e.root):"",s={type:"functionCall",root:e,args:n,start:e.start,end:t.endPos(),ev:i=>{let c=s.root,a=c.prop,u=a===void 0?void 0:c.root;return N([(u??c).ev(i),...n.map(l=>l.ev(i))],([l,...m])=>{if(!u||a===void 0)return at(l,void 0,m,i,r);F(l,o);let f=at(w(l,a),l,m,i,r);return Ye(l,a),f})}};return ee(t,s)}function at(t,e,n,r,o){if(!G(t))throw F(t,o),new Error(`'${o}' is not a function`);return w(t,"hyperfunc")&&n.push(r),Reflect.apply(t,e,n)}function Go(t,e){let n=K(t);return n&&_t(t,e,n)}function _t(t,e,n){let r=t.text(e),o={type:"attributeRefAccess",root:e,attribute:n,start:e.start,end:t.endPos(),ev:s=>E(o.root.ev(s),i=>we(i,n.name)),lhs:s=>o.root.ev(s),put:(s,i,c)=>{F(i,r),Me(i,n.name,c)}};return o}function $o(t,e){if(!t.matchOp("["))return;let n=!!t.matchOp(".."),r=h(t),o=!1,s;!n&&t.matchOp("..")&&(o=!0,t.cur().op&&t.cur().value==="]"||(s=h(t))),t.reqOp("]");let i=t.text(e),c=(l,m)=>T(m)<0?T(w(l,"length"))+T(m):T(m),a=(l,m,f)=>{let p=w(l,"slice");return G(p)?Reflect.apply(p,l,[m,f]):void 0},u={type:"arrayIndex",root:e,first:r,second:s,andBefore:n,andAfter:o,start:e.start,end:t.endPos(),ev:l=>N([u.root.ev(l),r.ev(l),s?.ev(l)],([m,f,p])=>m==null?null:n?a(m,0,c(m,f)+1):o?p==null?a(m,T(f)):a(m,T(f),c(m,p)+1):w(m,String(f))),lhs:l=>N([u.root.ev(l),r.ev(l)],m=>m),put:(l,m,f)=>{let[p,d]=Array.isArray(m)?m:[];F(p,i),W(p)&&(p[String(d)]=f)},del:(l,m)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[f,p]=Array.isArray(m)?m:[];F(f,i),Array.isArray(f)?f.splice(c(f,p),1):W(f)&&delete f[String(p)],P.wroteProperty(f)}};return ee(t,u)}var bn=new WeakSet;function xn(t){if(bn.has(t))return;bn.add(t);let e=!1,n=o=>{let s=e;e=!0;try{o()}finally{e=s}};document.addEventListener("htmx:load",o=>n(()=>t.process(o.detail?.elt))),document.addEventListener("htmx:after:process",o=>n(()=>t.process(o.target))),document.addEventListener("fx:swapped",o=>{let s=o.detail?.cfg?.target;t.process(s instanceof Element&&s.isConnected?s.parentElement??s:document.body)});let r=Reflect.get(globalThis,"htmx");typeof r?.process=="function"&&(t.addAfterProcessHook(o=>{e||n(()=>r.process(o))}),r.version?.startsWith("4")&&r.registerExtension?.("hs-include",{htmx_config_request(o,s){let i=s?.ctx;if(!i)return;let c=Wo(i.sourceElement||o);if(!c)return;let a=Uo(c.value,c.scopeElt),u=i.request?.body;if(u instanceof FormData)for(let l in a)u.set(l,a[l])}}))}function Wo(t){let e=t.getAttribute("hs-include");if(e!==null)return{value:e,scopeElt:t};for(let n=t.parentElement;n;n=n.parentElement){let r=n.getAttribute("hs-include:inherited");if(r!==null)return{value:r,scopeElt:n}}return null}var dt=t=>t&&oe(t)?.scopes?.elementScope||{};function lt(t){if(t==null)return"";if(typeof t=="object")try{return JSON.stringify(t)}catch{return""}return String(t)}function Bo(t,e){for(let n=e;n;n=n.parentElement){let r=dt(n);if(t in r)return r[t]}}function Uo(t,e){let n={},r=t.trim();if(r==="*"){let o=dt(e);for(let s of Object.keys(o))n[s[0]===":"?s.slice(1):s]=lt(o[s]);return n}for(let o of r.split(","))if(o=o.trim(),!!o){if(o[0]===":"){let s=dt(e);o in s&&(n[o.slice(1)]=lt(s[o]))}else if(o[0]==="^"){let s=Bo(":"+o.slice(1),e);s!==void 0&&(n[o.slice(1)]=lt(s))}else if(o[0]==="#"){let s=o.lastIndexOf(":");if(s>0){let i=dt(document.querySelector(o.slice(0,s))),c=o.slice(s+1);":"+c in i&&(n[c]=lt(i[":"+c]))}}}return n}var be=class extends Error{constructor(n,r,o,s){super(n);this.token=r;this.source=o;this.expected=s}written},kn=()=>({commands:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),Pe=class t{constructor(e,n,r){this.g=e;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(e,n){return new t(this.g,e,n)}tok(e=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(e--===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(e){return this.src.substring(e.start,e.end)}match(e,n="IDENTIFIER"){if(this.follows.includes(e))return;let r=this.cur();if(r.value===e&&r.type===n)return this.consume()}matchOp(e){let n=this.cur();if(n.op&&n.value===e)return this.consume()}matchType(...e){if(e.includes(this.cur().type))return this.consume()}matchAny(...e){for(let n of e){let r=this.match(n);if(r)return r}}matchAnyOp(...e){for(let n of e){let r=this.matchOp(n);if(r)return r}}req(e){return this.match(e)??this.expected(e)}reqOp(e){return this.matchOp(e)??this.expected(e)}reqType(...e){return this.matchType(...e)??this.expected(...e)}peek(e,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===e&&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(e,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(e==null||o.value!==e)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let e=this.tokens[this.i-1];return e?.type==="WHITESPACE"?e.value:""}pushFollow(...e){return this.follows.push(...e),e.length}popFollow(e=1){this.follows.length-=e}withFollow(e,n){let r=this.pushFollow(...e);try{return n()}finally{this.popFollow(r)}}withoutFollows(e){let n=this.follows;this.follows=[];try{return e()}finally{this.follows=n}}err(e,n){let r=this.cur();throw new be(e??"Unexpected Token : "+r.value,r,this.src,n)}expected(...e){this.err(e.length===1?`Expected '${e[0]}' but found '${this.cur().value}'`:"Expected one of: "+e.map(n=>`'${n}'`).join(", "),e)}commandStart(e){return e.value in this.g.commands}featureStart(e){return e.value in this.g.features}commandBoundary(e){return["end","then","else","otherwise",")"].includes(e.value)||this.commandStart(e)||this.featureStart(e)||e.type==="EOF"}};function jt(t){let e=t.source.split(`
|
|
6
|
-
`),n=
|
|
7
|
-
`+i+"^".repeat(Math.max(1,
|
|
8
|
-
`+i+
|
|
9
|
-
`}function
|
|
1
|
+
"use strict";(()=>{var Eo=Object.defineProperty;var bo=(e,t)=>{for(var n in t)Eo(e,n,{get:t[n],enumerable:!0})};var J=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function",E=(e,t)=>J(e)?e.then(t):t(e),N=(e,t)=>e.some(J)?Promise.all(e).then(t):t(e),B=e=>e!=null,G=e=>typeof e=="function",w=(e,t)=>B(e)?e[t]:void 0,ge=(e,t,n)=>{B(e)&&(e[t]=n)},x=e=>e instanceof Element,Q=e=>G(w(e,"addEventListener")),Y=e=>typeof e=="object"&&e!==null&&typeof Reflect.get(e,Symbol.iterator)=="function",T=e=>e;var K={attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",hideShowStrategies:{},fetchThrowsOn:[/^4/,/^5/]},ve=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=>be(e)}),qe=[],z={process(e){},enter(e){}},un=new WeakMap;function kt(e){if(e.window!==e)return e;let t=un.get(e);return t||un.set(e,t={}),t}var oe=e=>kt(e)._hyperscript;function Nt(e){let t=kt(e),n=t._hyperscript!==void 0;return delete t._hyperscript,n}function V(e){return kt(e)._hyperscript??={}}var P={tracking:!1,readGlobal(e){},readElement(e,t){},readProperty(e,t){},readAttribute(e,t){},readQuery(e){},wroteGlobal(e){},wroteElement(e,t){},wroteProperty(e){},stop(e){}},Ke=e=>(P.tracking&&typeof e=="object"&&e!==null&&P.readProperty(e,"__mutation__"),e),xo={Array:["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"],Set:["add","delete","clear"],Map:["set","delete","clear"]};function Xe(e,t){let n=w(w(e,"constructor"),"name");typeof n=="string"&&xo[n]?.includes(t)&&P.wroteProperty(e)}var Tt=e=>{if(e instanceof Node){let t=e.getRootNode();if(t instanceof Document||t instanceof ShadowRoot)return t}return document},ko=e=>e.replace(/[:&()[\]/]/g,t=>"\\"+t);function Ct(e,t){return P.tracking&&P.readQuery(e),e.querySelectorAll(t)}var ne=class{constructor(t,n,r=!1){this.raw=t;this.relativeTo=n;this.escape=r}get css(){return this.escape?ko(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 Ct(Tt(this.relativeTo),this.css)}[Symbol.iterator](){return this.select()[Symbol.iterator]()}},Se=e=>e instanceof ne||Array.isArray(e)||e instanceof NodeList||e instanceof HTMLCollection||e instanceof FileList;function O(e,t){if(Se(e))for(let n of e)t(n);else t(e)}var Ze=(e,t)=>{if(e==null)return;let n=t(e);if(n!==void 0)return n;if(Se(e))return Array.from(e,t)},le=(e,t)=>(P.tracking&&P.readProperty(e,t),Ze(e,n=>w(n,t))),Ee=(e,t)=>(P.tracking&&P.readAttribute(e,t),Ze(e,n=>x(n)?n.getAttribute(t):void 0)),et=(e,t)=>Ze(e,n=>w(w(n,"style"),t)),tt=(e,t)=>Ze(e,n=>x(n)?getComputedStyle(n).getPropertyValue(t):void 0),_e=(e,t,n)=>O(e,r=>{x(r)&&(n==null?r.removeAttribute(t):r.setAttribute(t,String(n)))}),nt=(e,t,n)=>O(e,r=>ge(w(r,"style"),t,n)),rt=(e,t,n)=>O(e,r=>{ge(r,t,n),P.wroteProperty(r)});function M(e,t){if(e==null)throw new Error(`'${t}' is null`)}var je=e=>e==null||w(e,"length")===0;function ln(e){if(e==null)return!1;if(Se(e)){for(let t of e)return!0;return!1}return!0}function ot(e,t,n){if(e==null&&n||Object.prototype.toString.call(e).slice(8,-1)===t)return!0;let r=w(globalThis,t);return G(r)&&e instanceof r}function st(e,t){for(let r of qe){let o=r(t,e);if(o!==void 0)return o}if(e==null)return null;let n=ve[t];if(n)return n(e);throw new Error("Unknown conversion : "+t)}function be(e){let t=document.createDocumentFragment();return e==null?t.append("null"):O(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 xe(e,t){O(e,n=>{if(!x(n))return;let r=n.parentElement;n.replaceWith(t instanceof Node?t.cloneNode(!0):be(t)),r&&z.process(r)})}function j(e,t,n={},r){if(!Q(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 Pe=(e,t="elementScope")=>(V(e).scopes??={})[t]??={},St=Object.create(null,{selection:{get:()=>getSelection()?.toString(),enumerable:!0},clipboard:{get:()=>navigator.clipboard.readText(),set:e=>void navigator.clipboard.writeText(String(e))}});function $(e,t,n,r){let o=w(r,"detail"),s=Object.create(St);for(let i=x(e)?e:null;i;i=i.parentElement)Object.assign(s,oe(i)?.features);return{meta:{owner:e,feature:t},locals:s,me:n,you:void 0,result:void 0,beingTested:null,event:r,target:w(r,"target")??null,detail:o??null,sender:w(o,"sender")??null,body:typeof document>"u"?null:document.body}}function De(e,t,n,r){let o=e==null||e===document.body||!B(e)?globalThis:V(e).features??={};for(let s of t)w(o,s)==null&&ge(o,s,{}),o=w(o,s);ge(o,n,r)}var xt=["meta","it","result","locals","event","target","detail","sender","body"],Fe=e=>{let t=e.meta.owner,n=e.meta.feature?.behavior;return B(t)?Pe(t,n?n+"Scope":void 0):{}};function dn(e,t,n){let r=x(n)?n:x(t.meta.owner)?t.meta.owner:null;for(;r;){let o=oe(r)?.scopes?.elementScope;if(o&&e in o)return{value:o[e],element:r};let s=r.getAttribute("dom-scope");if(s==="isolated")break;let i=s?.match(/^closest\s+(.+)/),c=s?.match(/^parent\s+of\s+(.+)/);i?r=r.parentElement?.closest(i[1])??null:c?r=r.closest(c[1])?.parentElement??null:r=r.parentElement}return{value:void 0,element:null}}function de(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,s=()=>(P.tracking&&P.readGlobal(e),Ke(w(globalThis,e)));if(n==="global")return s();if(n==="element")return P.tracking&&P.readElement(e,o),Ke(Fe(t)[e]);if(n==="inherited"){let u=dn(e,t,r);return P.tracking&&P.readElement(e,u.element??(x(r)?r:o)),Ke(u.value)}let i=t.meta.context;if(i!=null){let u=w(i,e);if(u!==void 0)return u;let l=w(w(i,"detail"),e);if(l!==void 0)return l}let c=xt.includes(e)?w(t,e):t.locals[e];if(c!==void 0)return c;let a=Fe(t)[e];return a!==void 0?(P.tracking&&P.readElement(e,o),Ke(a)):s()}function it(e,t,n,r,o){if(n==="global")ge(globalThis,e,r),P.wroteGlobal(e);else if(n==="element")Fe(t)[e]=r,P.wroteElement(e,t.meta.owner);else if(n==="inherited"){let i=dn(e,t,o).element??(x(o)?o:t.meta.owner);B(i)&&(Pe(i)[e]=r),P.wroteElement(e,i)}else!xt.includes(e)&&t.locals[e]!==void 0?t.locals[e]=r:Fe(t)[e]!==void 0?(Fe(t)[e]=r,P.wroteElement(e,t.meta.owner)):xt.includes(e)?ge(t,e,r):t.locals[e]=r}function _(e,t,n=0){for(let r=n;r<e.length;r++){let o=e[r].run(t);if(J(o))return o.then(s=>s||_(e,t,r+1));if(o)return o}}function we(e,t){try{let n=e();return J(n)?n.then(void 0,t):n}catch(n){return t(n)}}function at(e,t,n){let{errorSymbol:r,errorHandler:o,finallyHandler:s}=n,i=()=>we(()=>E(_(t,e),a=>{let u=w(a,"k");if(u==="break"||u==="continue")throw new Error(`Command \`${u}\` cannot be used outside of a \`repeat\` loop.`);return re(a)}),a=>{if(!o||!r)throw a;return e.locals[r]=a,_(o,e)});if(!s)return i();let c=()=>we(()=>E(_(s,e),()=>{}),a=>console.error(" Exception in finally block: ",a));return we(()=>E(i(),a=>E(c(),()=>re(a))),a=>E(c(),()=>{throw a}))}var re=e=>{let t=w(e,"k");if(t==="return")return{k:"return",value:w(e,"value")};if(t==="break"||t==="continue")return{k:t}};function ct(e,t,n,r,o){let s=[];O(e,a=>s.push(a));let i=s.map(a=>(n.beingTested=a,t.ev(n)));n.beingTested=null;let c=a=>{n.result=s.filter((u,l)=>((a[l]?r:o)(u),a[l]))};return i.some(J)?Promise.all(i).then(c):c(i)}var fn=new Set("+ - * / . .. \\ : % | ! ? # & $ ; , ( ) < > <= >= == === != !== { } [ ] = ~ ^".split(" ")),mn={b:"\b",f:"\f",n:`
|
|
2
|
+
`,r:"\r",t:" ",v:"\v"},ie=e=>e>="a"&&e<="z"||e>="A"&&e<="Z",ae=e=>e>="0"&&e<="9",Pt=e=>e===" "||e===" "||e==="\r"||e===`
|
|
3
|
+
`,Rt=e=>ie(e)||ae(e)||e==="-"||e==="_"||e===":",It=e=>ie(e)||ae(e)||e==="_"||e==="$";function fe(e,t=!1){let n=[],r=0,o=0,s=1,i="<START>",c=0,a=()=>e.charAt(r),u=b=>e.charAt(r+b),l=()=>(i=e.charAt(r++),i===`
|
|
4
|
+
`?(s++,o=0):o++,i),m=b=>({type:b,value:"",start:r,end:r+1,line:s,column:o}),f=(b,k)=>(b.value=k,b.end=r,b),p=b=>{let k="";for(;a()&&b(a());)k+=l();return k},d=()=>t&&c===0,y=()=>ie(i)||ae(i)||")\"'`}]".includes(i),g=(b,k)=>{let L=m(b),H=l();if(a()==="{"){if(L.template=!0,H+=l(),H+=p(ye=>ye!=="}"),a()!=="}")throw new Error("Unterminated "+(k?"class":"id")+" reference");let Z=l();k&&(H+=Z)}else if(k)for(;Rt(a())||a()==="\\";)a()==="\\"&&l(),H+=l();else H+=p(Rt);return f(L,H)},v=()=>{let b=m("STRING"),k=l();b.template=k==="`";let L="";for(;a()&&a()!==k;)if(a()==="\\"){l();let H=l();if(H in mn)L+=mn[H];else if(b.template&&H==="$")L+="\\$";else if(H==="x"){let Z=a()&&u(1)?parseInt(l()+l(),16):NaN;if(Number.isNaN(Z))throw new Error(`Invalid hexadecimal escape at [Line: ${b.line}, Column: ${b.column}]`);L+=String.fromCharCode(Z)}else L+=H}else L+=l();if(a()!==k)throw new Error(`Unterminated string at [Line: ${b.line}, Column: ${b.column}]`);return l(),f(b,L)},C=()=>{let b=m("IDENTIFIER"),k=l()+p(It);return a()==="!"&&k==="beep"&&(k+=l()),f(b,k)},S=()=>{let b=m("IDENTIFIER"),k=l(),L=k==="\\";for(L&&(k="");(It(a())||"\\{}".includes(a()||" "))&&!(a()==="$"&&!L);)a()==="\\"?(L=!0,l()):(L=!1,k+=l());return f(b,k)},R=()=>{let b=m("NUMBER"),k=l()+p(ae);return a()==="."&&ae(u(1))&&(k+=l()),k+=p(ae),(a()==="e"||a()==="E")&&(ae(u(1))?k+=l():u(1)==="-"&&(k+=l()+l())),f(b,k+p(ae))},I=()=>{let b=m("OP");b.op=!0;let k=l();for(;a()&&fn.has(k+a());)k+=l();return f(b,k)},A=()=>{let b=m("ATTRIBUTE_REF"),k=l();return k==="["?(k+=p(L=>L!=="]"),a()==="]"&&(k+=l())):(k+=p(Rt),a()==="="&&(k+=l(),a()==='"'||a()==="'"?k+=v().value:It(a())&&(k+=C().value))),f(b,k)},F=()=>{let b=n.at(-1);return b?b.type==="IDENTIFIER"||b.type==="CLASS_REF"||b.type==="ID_REF"?!1:!(b.op&&(b.value===">"||b.value===")")):!0},q=()=>{let b=a(),k=u(2);return(b==="-"||b==="/")&&u(1)===b&&(Pt(k)||k===""||k===b)};for(;r<e.length;){let b=a(),k=u(1);if(q())p(L=>L!=="\r"&&L!==`
|
|
5
|
+
`),l();else if(Pt(b))n.push(f(m("WHITESPACE"),p(Pt)));else if(!y()&&b==="."&&(ie(k)||k==="{"||k==="-"))n.push(g("CLASS_REF",!0));else if(!y()&&b==="#"&&(ie(k)||k==="{"))n.push(g("ID_REF",!1));else if(b==="@"||b==="["&&k==="@")n.push(A());else if(b==="*"&&ie(k)){let L=m("STYLE_REF");n.push(f(L,l()+p(H=>ie(H)||H==="-")))}else if(d()&&(ie(b)||b==="\\"))n.push(S());else if(!d()&&(ie(b)||b==="_"||b==="$"))n.push(C());else if(ae(b))n.push(R());else if(!d()&&(b==='"'||b==="`"))n.push(v());else if(!d()&&b==="'")n.push(F()?v():I());else if(fn.has(b))i==="$"&&b==="{"&&c++,b==="}"&&c--,n.push(I());else if(d()||b==="`"){let L=m("RESERVED");n.push(f(L,l()))}else throw new Error("Unknown token: "+b+" ")}return n}function h(e){return e.match("the"),No(e)}function No(e){let t=hn(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=To(o.value,t,hn(e));return t}function To(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>E(t.ev(o),s=>!!s===r?s:n.ev(o))}}var Co={"+":(e,t)=>Array.isArray(e)?e.concat(t):T(e)+T(t),"-":(e,t)=>T(e)-T(t),"*":(e,t)=>T(e)*T(t),"/":(e,t)=>T(e)/T(t),mod:(e,t)=>T(e)%T(t)};function Ot(e){let t=Lt(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 s=t,i=Lt(e),c=Co[o.value];t={type:"mathOperator",operator:o.value,left:s,right:i,start:s.start,end:i.end,ev:u=>N([s.ev(u),i.ev(u)],([l,m])=>c(l,m))}}return t}function Lt(e){let t=W(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 W(e){e.match("the");let t=e.pos();if(e.match("not"))return Re(e,"logicalNot",t,W(e),n=>!n);if(e.match("no"))return Re(e,"noExpression",t,Lt(e),je);for(let n of e.g.unaries){let r=n(e);if(r)return ee(e,r)}return Po(e)}function Re(e,t,n,r,o,s=t!=="negativeNumber"){let i={type:t,root:r,start:n,end:e.endPos(),ev:c=>E(r.ev(c),a=>o(a,c))};return s?ee(e,i):i}var So="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function Po(e){let t=wn(e),n=e.matchAny(...So)??e.matchOp("%");if(n)return pn(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return pn(e,"timeExpression",t,r);for(let o of e.g.postfixes){let s=o(e,t);if(s)return s}return t}function pn(e,t,n,r){let o=i=>typeof r=="number"?T(i)*r:`${i}${r}`,s={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:i=>E(n.ev(i),o)};return n.stat&&(s.stat=()=>o(ke(n))),s}function wn(e){let t=e.pos();return e.matchOp("-")?Re(e,"negativeNumber",t,wn(e),n=>-T(n)):lt(e)}function lt(e){let t=Ft(e);return t?ee(e,t):e.err("Unexpected value: "+e.cur().value)}function ce(e){return e.match("the"),Ro(e,lt(e))}function Ro(e,t){let n=He(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function He(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&Io(t.expr);)t=t.expr;return t}var Io=e=>G(w(e,"ev"));function ke(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function Oo(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 s=!!e.matchAny("do","does");s&&e.req("not");let i=s?"not ":"",c=(a,u)=>e.match(a)??(s&&a!=="match"&&a!=="contain"?void 0:e.match(u));if(c("match","matches"))return n(i+"match");if(c("contain","contains"))return n(i+"contain");if(s&&e.match("exist"))return n("not exist",!1);if(c("include","includes"))return n(i+"include");if(e.match(s?"start":"starts"))return e.req("with"),n(i+"start with");if(e.match(s?"end":"ends"))return e.req("with"),n(i+"end with");if(c("precede","precedes"))return n(i+"precede");if(c("follow","follows"))return n(i+"follow");s&&e.expected("matches","contains","starts with","ends with","precede","follow")}function hn(e){let t=Ot(e),n=Oo(e);if(!n)return t;let{operator:r}=n,o,s=!0,i,c;n.isType?(o=e.reqType("IDENTIFIER").value,s=!e.matchOp("!")):n.right&&(i=Ot(e),r.endsWith("match")&&(c=i.css));let a;r.endsWith("between")&&(e.req("and"),a=Ot(e));let u=!1;e.match("ignoring")&&(e.req("case"),u=!0);let l=p=>u&&typeof p=="string"?p.toLowerCase():p,m=i?.type==="symbol"&&"scope"in i&&i.scope==="local"&&i.name!=="undefined"&&i.name!=="null"?i.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:i,right2:a,typeName:o,ignoringCase:u,start:t.start,end:e.endPos(),ev:p=>N([t.ev(p),c??i?.ev(p),a?.ev(p)],([d,y,g])=>{if(o){let v=ot(d,o,s);return r==="a"?v:!v}if(m&&y===void 0&&(r==="is"||r==="is not")){let v=!!le(d,m);return r==="is"?v:!v}return vn(r,l(d),l(y),g)})}}function yn(e,t){let n=w(e,"contains")??w(e,"includes");if(!G(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function Ao(e,t){let n=w(e,"match")??w(e,"matches");if(!G(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var gn=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function vn(e,t,n,r){if(e==="not between")return T(t)<T(n)||T(t)>T(r);if(e.startsWith("not "))return!vn(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 T(t)<T(n);case">":return T(t)>T(n);case"<=":return T(t)<=T(n);case">=":return T(t)>=T(n);case"match":return t!=null&&Ao(t,n);case"in":return n!=null&&yn(n,t);case"contain":case"include":return t!=null&&yn(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 T(t)>=T(n)&&T(t)<=T(r);case"precede":return gn(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return gn(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return je(t);case"exist":return ln(t)}throw new Error("Unknown comparison : "+e)}function Ft(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),At("number",parseFloat(t.value),t);case"STRING":return Fo(e);case"ID_REF":return _o(e);case"CLASS_REF":return te(e);case"ATTRIBUTE_REF":return X(e);case"STYLE_REF":return xn(e)}if(t.op){if(t.value==="(")return Lo(e);if(t.value==="[")return qo(e);if(t.value==="{")return Ge(e);if(t.value==="<")return jo(e)}let n=e.match("true")??e.match("false");if(n)return At("boolean",n.value==="true",n);let r=e.match("null");if(r)return At("null",null,r);for(let o of e.g.leaves){let s=o(e);if(s)return s}return qt(e)}function At(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function Lo(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>h(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var Mo=(e,t)=>N(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function En(e,t){let n=e.child(fe(t,!0),t),r=[],o="";do{o+=n.lastWs();let s=n.cur();if(s.value==="$"){n.consume();let i=n.matchOp("{");r.push(o,h(n)),o="",i&&n.reqOp("}")}else s.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function Fo(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=En(e,n);r.ev=s=>Mo(o,s)}else r.stat=()=>n;return r}function qo(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(h(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>N(n.map(o=>o.ev(r)),o=>o)}}function Ge(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let s=e.matchType("STRING");if(s)n.push(s.value);else if(e.matchOp("["))n.push(h(e)),e.reqOp("]");else{let i="";for(let c=e.matchType("IDENTIFIER")??e.matchOp("-");c;c=e.matchType("IDENTIFIER")??e.matchOp("-"))i+=c.value;n.push(i)}e.reqOp(":"),r.push(h(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:s=>N([...n.map(i=>typeof i=="string"?i:i.ev(s)),...r.map(i=>i.ev(s))],i=>Object.fromEntries(n.map((c,a)=>[String(i[a]),i[n.length+a]])))}}function dt(e){if(!e.matchOp("("))return;let t=e.last.start,n=$e(e,t);return e.reqOp(")"),n.end=e.endPos(),n}function $e(e,t=e.pos()){let n=[],r=[];if(e.cur().type==="IDENTIFIER")do n.push(e.reqType("IDENTIFIER").value),e.reqOp(":"),r.push(h(e));while(e.matchOp(","));return{type:"namedArgumentList",names:n,values:r,start:t,end:e.endPos(),ev:o=>N(r.map(s=>s.ev(o)),s=>Object.fromEntries([["_namedArgList_",!0],...n.map((i,c)=>[i,s[c]])]))}}function We(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function Be(e){let t=e.cur();if(!(t.op&&t.value==="/"||t.type==="IDENTIFIER"&&["http","https","ws","wss"].includes(t.value)))return h(e);let r=We(e);return{type:"string",value:r,start:t.start,end:e.endPos(),ev:()=>r,stat:()=>r}}function qt(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("^"),s=e.matchType("IDENTIFIER");if(!s?.value)return;let i=(r?":":o?"^":"")+s.value,a=n??{$:"global",":":"element","^":"inherited"}[i[0]]??"local",u;return a==="inherited"&&e.match("on")&&(u=e.withFollow(["to","into","before","after","then"],()=>h(e))),{type:"symbol",name:i,scope:a,...u?{on:u}:{},start:t,end:e.endPos(),ev:l=>de(i,l,a,u?.ev(l)),lhs:()=>{},put:(l,m,f)=>it(i,l,a,f,u?.ev(l))}}var bn=(e,t)=>{let n=t.value.substring(2);return h(e.child(fe(n),n))};function _o(e){let t=e.consume(),n=(o,s)=>Tt(o.me).getElementById(String(s)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,s,i)=>E(r.ev(o),c=>c&&xe(c,i))};if(t.template){let o=r.expr=bn(e,t);r.ev=s=>E(o.ev(s),i=>n(s,i))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=s=>n(s,o)}return r}function te(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,s)=>E(n.ev(r),i=>xe(Array.from(i instanceof ne?i:[]),s))};if(t.template){let r=n.expr=bn(e,t);n.ev=o=>E(r.ev(o),s=>new ne("."+s,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new ne(r,o.me,!0)}return n}var Mt=class extends ne{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>x(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(x);n.forEach((o,s)=>o.setAttribute("data-hs-query-id",String(s)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function jo(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 ne(n,o.me),lhs:()=>{},put:(o,s,i)=>E(r.ev(o),c=>xe(Array.from(c instanceof ne?c:[]),i))};if(/\$[^=]/.test(n)){let o=r.parts=En(e,n);r.ev=s=>N(o.map(i=>typeof i=="string"?i:i.ev(s)),i=>new Mt(s.me,i))}return r}function X(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("="),s=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:s,css:`[${n}]`,start:t.start,end:t.end,ev:i=>Ee(i.you||i.me,r),lhs:()=>{},put:(i,c,a)=>_e(i.you||i.me,r,a)}}function xn(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?tt:et)(o.you||o.me,r),lhs:()=>{},put:(o,s,i)=>nt(o.you||o.me,r,i)}}function kn(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(h(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=>N(r.map(s=>s.ev(o)),s=>n.map((i,c)=>i+(c in s?`${s[c]}`:"")).join(""))}}function U(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function me(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 ue(e,t="Expected event name"){return e.matchType("STRING")?.value??me(e)??e.err(t)}function ee(e,t){return Ho(e,t)??Go(e,t)??Vo(e,t)??$o(e,t)??Wo(e,t)??Bo(e,t)??Uo(e,t)??zo(e,t)??Do(e,t)??t}function Do(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function Ho(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:s=>E(o.root.ev(s),i=>le(i,n)),lhs:s=>o.root.ev(s),put:(s,i,c)=>{M(i,r),rt(i,n,c)},del:(s,i)=>{M(i,r),O(i,c=>{B(c)&&delete c[n],P.wroteProperty(c)})}};return ee(e,o)}function Go(e,t){if(!e.match("of"))return;let n=W(e),r,o=t;for(;o.root;)r=o,o=o.root;let i={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],c=o.name;if(!i||c===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),u={property:le,attribute:Ee,style:et,computed:tt}[i],l={type:"ofExpression",root:n,name:c,kind:i,start:t.start,end:e.endPos(),ev:m=>E(l.root.ev(m),f=>u(f,c)),lhs:m=>l.root.ev(m),put:(m,f,p)=>{M(f,a),i==="attribute"?_e(f,c,p):i==="property"?rt(f,c,p):nt(f,c,p)},del:(m,f)=>{M(f,a),O(f,p=>{i==="attribute"?x(p)&&p.removeAttribute(c):i==="property"?(B(p)&&delete p[c],P.wroteProperty(p)):p instanceof HTMLElement&&p.style.removeProperty(c)})}};return r?(r.root=l,ee(e,t)):ee(e,l)}function $o(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=X(e)??xn(e),s=o?void 0:e.reqType("IDENTIFIER").value,i=e.text(t),c=u=>s!==void 0?le(u,s):o?.type==="attributeRef"?Ee(u,o.name):o?.type==="computedStyleRef"?tt(u,o.name):o&&et(u,o.name),a={type:"possessive",root:t,prop:s,attribute:o,start:t.start,end:e.endPos(),ev:u=>E(a.root.ev(u),c),lhs:u=>a.root.ev(u),put:(u,l,m)=>{M(l,i),s!==void 0?rt(l,s,m):o?.type==="attributeRef"?_e(l,o.name,m):o&&nt(l,o.name,m)}};return ee(e,a)}function Wo(e,t){if(!e.match("in"))return;let n=W(e),r=(i,c)=>{if(i==null)return[];let a=[],u=w(i,"css");if(typeof u=="string")O(c,l=>x(l)&&a.push(...Ct(l,u)));else if(x(i)){let l=!1;if(O(c,m=>{m instanceof Node&&m.contains(i)&&(l=!0)}),l)return i}else O(i,l=>O(c,m=>l===m&&a.push(l)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:i=>N([o.root.ev(i),n.ev(i)],([c,a])=>r(c,a)),lhs:i=>o.ev(i),put:(i,c,a)=>xe(c,a)},s;if(e.peek("where"))for(let i of e.g.collections)s??=i(e,o);return ee(e,s??o)}function Bo(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let s=me(e)??e.err("Expected dotOrColonPath"),i={type:"asExpression",root:o,conversion:s,start:o.start,end:e.endPos(),ev:c=>E(i.root.ev(c),a=>st(a,s))};return i},r=n(t);for(;e.matchOp("|");)r=n(r);return ee(e,r)}function Uo(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(h(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",s={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:i=>{let c=s.root,a=c.prop,u=a===void 0?void 0:c.root;return N([(u??c).ev(i),...n.map(l=>l.ev(i))],([l,...m])=>{if(!u||a===void 0)return ut(l,void 0,m,i,r);M(l,o);let f=ut(w(l,a),l,m,i,r);return Xe(l,a),f})}};return ee(e,s)}function ut(e,t,n,r,o){if(!G(e))throw M(e,o),new Error(`'${o}' is not a function`);return w(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function Vo(e,t){let n=X(e);return n&&_t(e,t,n)}function _t(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:s=>E(o.root.ev(s),i=>Ee(i,n.name)),lhs:s=>o.root.ev(s),put:(s,i,c)=>{M(i,r),_e(i,n.name,c)}};return o}function zo(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=h(e),o=!1,s;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(s=h(e))),e.reqOp("]");let i=e.text(t),c=(l,m)=>T(m)<0?T(w(l,"length"))+T(m):T(m),a=(l,m,f)=>{let p=w(l,"slice");return G(p)?Reflect.apply(p,l,[m,f]):void 0},u={type:"arrayIndex",root:t,first:r,second:s,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:l=>N([u.root.ev(l),r.ev(l),s?.ev(l)],([m,f,p])=>m==null?null:n?a(m,0,c(m,f)+1):o?p==null?a(m,T(f)):a(m,T(f),c(m,p)+1):w(m,String(f))),lhs:l=>N([u.root.ev(l),r.ev(l)],m=>m),put:(l,m,f)=>{let[p,d]=Array.isArray(m)?m:[];M(p,i),B(p)&&(p[String(d)]=f)},del:(l,m)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[f,p]=Array.isArray(m)?m:[];M(f,i),Array.isArray(f)?f.splice(c(f,p),1):B(f)&&delete f[String(p)],P.wroteProperty(f)}};return ee(e,u)}var Nn=new WeakSet;function Tn(e){if(Nn.has(e))return;Nn.add(e);let t=!1,n=o=>{let s=t;t=!0;try{o()}finally{t=s}};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 s=o.detail?.cfg?.target;e.process(s instanceof Element&&s.isConnected?s.parentElement??s: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,s){let i=s?.ctx;if(!i)return;let c=Qo(i.sourceElement||o);if(!c)return;let a=Yo(c.value,c.scopeElt),u=i.request?.body;if(u instanceof FormData)for(let l in a)u.set(l,a[l])}}))}function Qo(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 mt=e=>e&&oe(e)?.scopes?.elementScope||{};function ft(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return""}return String(e)}function Jo(e,t){for(let n=t;n;n=n.parentElement){let r=mt(n);if(e in r)return r[e]}}function Yo(e,t){let n={},r=e.trim();if(r==="*"){let o=mt(t);for(let s of Object.keys(o))n[s[0]===":"?s.slice(1):s]=ft(o[s]);return n}for(let o of r.split(","))if(o=o.trim(),!!o){if(o[0]===":"){let s=mt(t);o in s&&(n[o.slice(1)]=ft(s[o]))}else if(o[0]==="^"){let s=Jo(":"+o.slice(1),t);s!==void 0&&(n[o.slice(1)]=ft(s))}else if(o[0]==="#"){let s=o.lastIndexOf(":");if(s>0){let i=mt(document.querySelector(o.slice(0,s))),c=o.slice(s+1);":"+c in i&&(n[c]=ft(i[":"+c]))}}}return n}var se=class extends Error{constructor(n,r,o,s){super(n);this.token=r;this.source=o;this.expected=s}written},Cn=()=>({commands:Object.create(null),fallbacks:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),Ie=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 se(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 jt(e){let t=e.source.split(`
|
|
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),s=String(n+1).length,i=" ".repeat(s+5+o);return` ${n+1} | ${r}
|
|
7
|
+
`+i+"^".repeat(Math.max(1,e.token.value.length))+`
|
|
8
|
+
`+i+e.message+`
|
|
9
|
+
`}function Ko(e,t,n,r){let o=e.g.fallbacks[n];if(!o)return t(e,n,r);let s=e.mark();try{return t(e,n,r)}catch(i){if(!(i instanceof se))throw i;let c=i;for(let a of o){e.reset(s);try{let u=a(e,n,r);if(u&&e.pos()>=i.token.start)return u}catch(u){if(!(u instanceof se))throw u;u.token.start>c.token.start&&(c=u)}}throw c}}function pt(e){let t=e.pos();if(e.matchOp("(")){let a=pt(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)&&Ko(e,r,n.value,t):n.type==="IDENTIFIER"&&(o=e.g.pseudo?.(e,t)),!o||!e.match("unless"))return o;let s=o,i=h(e);return{type:"unlessStatementModifier",command:s,condition:i,start:t,end:e.endPos(),run:a=>E(i.ev(a),u=>u?void 0:s.run(a))}}function D(e){let t=[];for(;e.hasMore();){let n=pt(e);if(!n)break;t.push(n),e.match("then")}return t}function Sn(e){let t=e.pos();if(e.matchOp("(")){let o=Sn(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 Ue(e){let t=e.pos(),n=[];for(;e.hasMore();){let r=e.cur();if(e.featureStart(r)||r.value==="(")n.push(Sn(e)),e.match("end");else{if(r.value==="end")break;e.err()}}return{type:"hyperscript",features:n,start:t,end:e.endPos()}}function ht(e){let t={};return e.match("catch")&&(t.errorSymbol=e.reqType("IDENTIFIER").value,t.errorHandler=D(e)),e.match("finally")&&(t.finallyHandler=D(e)),t}function yt(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}var In=Cn(),Pn=new Set,Ht=new Set;function $t(...e){let t=e.filter(n=>!Pn.has(n));for(let n of t)Pn.add(n),n(In);if(t.length)for(let n of[...Ht])Ht.delete(n),n.isConnected&&(Nt(n),Gt(n))}var On=e=>new Ie(In,fe(e),e);function Xo(e){let t=On(e),n=Ue(t);return t.hasMore()&&t.err(),n}function An(e){let t=On(e),n=t.cur(),r=t.commandStart(n)?{kind:"commands",commands:D(t)}:t.featureStart(n)?{kind:"features",program:Ue(t)}:{kind:"expression",expression:h(t)};return t.hasMore()&&t.err(),r}function Rn(e,t){let n;try{n=An(e)}catch(s){throw s instanceof se?new Error(s.message+`
|
|
10
10
|
|
|
11
|
-
`+jt(s)):s}let r=document.body;if(n.kind==="features"){for(let s of n.program.features)s.install(r,r);return}let o=Object.assign(
|
|
11
|
+
`+jt(s)):s}let r=document.body;if(n.kind==="features"){for(let s of n.program.features)s.install(r,r);return}let o=Object.assign($(r,void 0,r,null),t);return n.kind==="expression"?n.expression.ev(o):E(_(n.commands,o),s=>{let i=w(s,"k")==="return"?w(s,"value"):void 0;return i!==void 0?i:o.result})}var Ln=()=>K.attributes.replaceAll(" ","").split(","),Mn=e=>e instanceof HTMLScriptElement&&e.type==="text/hyperscript";function Zo(e){for(let t of Ln())if(e.hasAttribute(t))return e.getAttribute(t);return Mn(e)?e.innerText:null}var es=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return t},Fn=[];function Gt(e){if(e.closest(K.disableSelector))return;let t=Zo(e);if(!t)return;let n=es(t);if(oe(e)?.initialized){if(oe(e)?.scriptHash===n)return z.enter(e);Ne(e)}if(!j(e,"hyperscript:before:init"))return;Object.assign(V(e),{initialized:!0,scriptHash:n});let r=Mn(e)?document.body:e,o=t;try{for(let i of Fn)o=i(o,e)??o;let{features:s}=Xo(o);z.enter(e);for(let i of s)i.install(r,e);e.setAttribute("data-hyperscript-powered","true"),j(e,"hyperscript:after:init"),setTimeout(()=>j(r,"load",{hyperscript:!0}),1)}catch(s){if(s instanceof se){Ht.add(e),o!==t&&(s.written=t),j(e,"hyperscript:parse-error",{errors:[s]});let i=s.written?`
|
|
12
12
|
rewritten from: ${s.written}
|
|
13
|
-
`:"";console.error("hyperscript: 1 parse error(s) on:",
|
|
13
|
+
`:"";console.error("hyperscript: 1 parse error(s) on:",e,`
|
|
14
14
|
|
|
15
|
-
`+jt(s)+i)}else
|
|
15
|
+
`+jt(s)+i)}else j(e,"exception",{error:s}),console.error("hyperscript errors were found on the following element:",e,`
|
|
16
16
|
|
|
17
|
-
`,s)}}var Fn=[],Mn=[],Dt=new Set;function fe(t){if((t instanceof Element||t instanceof Document||t instanceof DocumentFragment)&&!Dt.has(t)){Dt.add(t);try{for(let n of Fn)n(t);let e=On().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";t instanceof Element&&t.matches(e)&&Cn(t),t.querySelectorAll(e).forEach(Cn);for(let n of Mn)n(t)}finally{Dt.delete(t)}}}function xe(t){let e=oe(t);if(e){_(t,"hyperscript:before:cleanup");for(let{target:n,event:r,handler:o}of e.listeners??[])n.removeEventListener(r,o);for(let n of e.observers??[])n.disconnect();for(let n of e.timers??[])clearTimeout(n);P.stop(t),t.querySelectorAll("[data-hyperscript-powered]").forEach(xe),_(t,"hyperscript:after:cleanup"),t.removeAttribute("data-hyperscript-powered"),sn(t)}}z.process=fe;function Jo(t){try{let e=In(t);return e.kind==="features"?{...e.program,errors:[]}:{...e.kind==="commands"?e.commands[0]:e.expression,errors:[]}}catch(e){if(e instanceof be)return{errors:[e]};throw e}}var We=Object.assign(Tn,{config:Object.assign(Z,{conversions:Object.assign(ge,{dynamicResolvers:Fe})}),use(t){t(We)},addBeforeProcessHook:t=>void Fn.push(t),addAfterProcessHook:t=>void Mn.push(t),addSourceTransform:t=>void Ln.push(t),evaluate:Tn,parse:Jo,process:fe,processNode:fe,cleanup:xe,internals:{runtime:{cleanup:xe,processNode:fe}},version:"7.5.1"});function qn(){if(Object.assign(globalThis,{_hyperscript:We}),typeof document>"u")return;let t=()=>{fe(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),xn(We)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t):setTimeout(t)}function _n(t){t.unaries.push(e=>{let n=1;for(;e.tok(n).type==="IDENTIFIER"&&e.tok(n+1).op&&e.tok(n+1).value===".";)n+=2;let r=e.tok(n+1);if(!e.peek("new")||e.tok(n).type!=="IDENTIFIER"||!r.op||r.value!=="(")return;let o=e.pos();e.consume();let s=[e.consume().value];for(;e.matchOp(".");)s.push(e.consume().value);e.reqOp("(");let i=[];if(!e.matchOp(")")){do i.push(h(e));while(e.matchOp(","));e.reqOp(")")}return{type:"newExpression",path:s,args:i,start:o,end:e.endPos(),ev:a=>N(i.map(u=>u.ev(a)),u=>{let l=s.slice(1).reduce((m,f)=>w(m,f),le(s[0],a));if(!G(l))throw new Error(`'${s.join(".")}' is not a constructor`);return Reflect.construct(l,u)})}})}function Yo(t,e){let n=t instanceof HTMLElement&&t.tagName==="SUMMARY"?t.parentElement:t;if(n instanceof HTMLDialogElement)n.open?n.close():e?n.showModal():n.show();else if(n instanceof HTMLDetailsElement)n.open=!n.open;else if(n instanceof HTMLSelectElement){if(document.activeElement===n)return n.blur();n.focus();try{n.showPicker()}catch{}}else if(n instanceof HTMLElement&&n.hasAttribute("popover"))n.togglePopover();else throw new Error("toggle needs a dialog, details, select or popover element")}function jn(t){t.toggleElement=(e,n,r)=>{let o=e.match("as")?!!e.req("modal"):!!e.match("modal"),s=e.text(n);return{type:"toggleElementCommand",target:n,modal:o,start:r,end:e.endPos(),run:c=>E(n.ev(c),a=>{F(a,s),O(a,u=>Yo(u,o))})}}}var Dn=(t,e,n)=>new Promise(r=>{let o=!1;t.addEventListener("transitionstart",()=>o=!0,{once:!0}),t.addEventListener("transitionend",()=>r(),{once:!0}),setTimeout(()=>o||r(),e),n?.()});function Hn(t){t.commands.settle=(e,n,r)=>{let o=e.commandBoundary(e.cur())?U(e):h(e),s=e.text(o);return{type:"settleCommand",target:o,start:r,end:e.endPos(),run:c=>E(o.ev(c),a=>{F(a,s);let u=x(a)?[a]:Y(a)?Array.from(a).filter(x):[];return Promise.all(u.map(l=>Dn(l,500))).then(()=>{})})}}}function Gn(t){t.commands.transition=(e,n,r)=>{let o=[],s=[],i=[];do o.push(e.withFollow(["from","to"],()=>h(e))),s.push(e.match("from")?h(e):void 0),e.req("to"),i.push(e.match("initial")?"initial":h(e));while(!e.commandBoundary(e.cur())&&e.cur().value!=="over"&&e.cur().value!=="using");let c=e.match("over")?h(e):void 0,a=!c&&e.match("using")?h(e):void 0,u=o[0].root,l=u?e.text(u):"",m=(p,d)=>o.forEach((y,g)=>{d[g]!=null&&E(y.lhs?.(p),v=>y.put?.(p,v,d[g]))});return{type:"transitionCommand",properties:o,from:s,to:i,over:c,using:a,start:r,end:e.endPos(),run:p=>N([u?u.ev(p):p.me,c?.ev(p),a?.ev(p),N(s.map(d=>d?.ev(p)),d=>d),N(i.map(d=>d==="initial"?void 0:d.ev(p)),d=>d)],([d,y,g,v,C])=>{u&&F(d,l);let S=[];return O(d,R=>{if(!(R instanceof HTMLElement))return;let I=R.style.transition;R.style.transition=y?`all ${y}ms ease-in`:g?String(g):Z.defaultTransition;let A=V(R).transitionInitials??={};o.forEach((q,b)=>{b in A||(A[b]=q.ev(p))}),Array.isArray(v)&&m(p,v);let M=i.map((q,b)=>q==="initial"?A[b]:w(C,String(b)));S.push(Dn(R,100,()=>setTimeout(()=>m(p,M),0)).then(()=>{R.style.transition=I}))}),Promise.all(S).then(()=>{})})}}}function $n(t){t.commands.start=(e,n,r)=>{e.match("a"),e.req("view"),e.req("transition"),e.match("using");let o=e.matchType("STRING")?.value,s=D(e);e.hasMore()&&e.req("end");let i=!1;return{type:"viewTransitionCommand",body:s,transitionType:o,start:r,end:e.endPos(),run:a=>{if(!document.startViewTransition)return j(s,a);if(i)throw new Error("A view transition is already in progress");i=!0;let u=()=>{},l=new Promise(d=>u=d),m=()=>l,f=o?document.startViewTransition({update:m,types:[o]}):document.startViewTransition(m),p=d=>(i=!1,u(),d?(console.warn("hyperscript: view transition skipped due to early exit (return, halt, or break)"),f.finished.catch(()=>{}),f.skipTransition(),d):f.finished.then(()=>{}));return new Promise(d=>setTimeout(d,0)).then(()=>j(s,a)).then(d=>p(re(d)))}}}}function Wn(t){t.commands.if=(e,n,r)=>{let o=h(e);e.match("then");let s=D(e),i,c=!1,a=e.match("else")??e.match("otherwise");if(a)if(c=e.peek("if")?.line===a.line,c){let l=ft(e);i=l?[l]:[]}else i=D(e);return e.hasMore()&&!c&&e.req("end"),{type:"ifCommand",condition:o,trueBranch:s,falseBranch:i,start:r,end:e.endPos(),run:l=>E(o.ev(l),m=>m?j(s,l):i&&j(i,l))}}}var Bn={k:"return",value:null};function Un(t){t.commands.halt=(e,n,r)=>{let o=!1;e.match("the")&&(e.req("event"),e.matchOp("'")&&e.req("s"),o=!0);let s=!!e.match("bubbling"),i=!s&&!!e.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:s,haltDefault:i,start:r,end:e.endPos(),run:a=>{let u=a.event;if(u instanceof Event&&(i||u.stopPropagation(),s||u.preventDefault()),!o)return Bn}}}}function Vn(t){t.commands.return=(e,n,r)=>{let o=e.commandBoundary(e.cur())?void 0:h(e);return{type:"returnCommand",value:o,start:r,end:e.endPos(),run:i=>E(o?o.ev(i):null,c=>(i.meta.returned=!0,i.meta.returnValue=c,{k:"return",value:c}))}},t.commands.exit=(e,n,r)=>({type:"exitCommand",start:r,end:e.endPos(),run:()=>Bn})}function zn(t){t.commands.throw=(e,n,r)=>{let o=h(e);return{type:"throwCommand",value:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{throw c})}}}function Yn(t){let e=te(t);if(!e)return;let n=[e];for(let r=te(t);r;r=te(t))n.push(r);return n}var Ht=(t,e)=>(t??[]).map(n=>E(n.ev(e),r=>String(w(r,"className")))),Ko=t=>t.split(";").map(e=>e.split(":")[0].trim()).filter(Boolean),Gt=t=>t instanceof HTMLElement||t instanceof SVGElement?t.style:void 0,Qn=(t,e,n,r,o)=>e?it(t,e,n,s=>x(s)&&r(s),s=>x(s)&&o(s)):O(t,s=>x(s)&&r(s)),Be=(t,{name:e,value:n},r)=>r?t.setAttribute(e,String(n)):t.removeAttribute(e),Kn=(t,e,n,r,o,s)=>s?Qn(e,n,r,i=>Be(i,s,t),i=>Be(i,s,!t)):N(o.map(i=>Qn(e,n,r,c=>c.classList.toggle(String(i),t),c=>c.classList.toggle(String(i),!t))),()=>{});function Xn(t){let e=Yn(t),n=e?void 0:K(t);return{refs:e,attribute:n,css:e||n?void 0:En(t)}}function Zn(t){t.commands.add=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c;!o&&!s&&!i&&(c=e.withFollow(["to"],()=>h(e)),e.cur().value!=="to"&&e.err("Expected either a class reference or attribute expression"));let a=e.match("to")?h(e):U(e),u=e.match("when")?h(e):void 0,l=o||s?u:void 0,m=e.text(a);return{type:"addCommand",classRefs:o,attributeRef:s,css:i,value:c,to:a,when:l,start:r,end:e.endPos(),run:p=>N([a.ev(p),i?.ev(p),c?.ev(p),...Ht(o,p)],([d,y,g,...v])=>{if(F(d,m),c){if(Array.isArray(d))d.push(g);else if(d instanceof Set)d.add(g);else throw d instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof d);P.wroteProperty(d)}else if(i)O(d,C=>{let S=Gt(C);S&&(S.cssText+=y)});else return Kn(!0,d,l,p,v,s)})}}}var Xo=t=>t instanceof Node||t instanceof NodeList||t instanceof HTMLCollection;function er(t){t.commands.remove=(e,n,r)=>{let{refs:o,attribute:s,css:i}=Xn(e),c=o||s||i?void 0:h(e),a=e.match("from")?h(e):c?void 0:U(e),u;e.match("when")&&(c&&e.err("'when' clause is not supported when removing elements"),u=h(e));let l=a?e.text(a):"",m=c?e.text(c):"",f=(d,y,g)=>{if(g==null&&c?.del&&c.lhs&&!Xo(y)){let v=c;return E(c.lhs(d),C=>v.del?.(d,C))}if(F(y,m),Array.isArray(g)){let v=g.indexOf(y);v>-1&&g.splice(v,1),P.wroteProperty(g)}else g instanceof Set||g instanceof Map?(g.delete(y),P.wroteProperty(g)):O(y,v=>{x(v)&&v.parentElement&&(g==null||g instanceof Node&&g.contains(v))&&v.parentElement.removeChild(v)})};return{type:"removeCommand",classRefs:o,attributeRef:s,css:i,element:c,from:a,when:u,start:r,end:e.endPos(),run:d=>N([a?.ev(d),i?.ev(d),c?.ev(d),...Ht(o,d)],([y,g,v,...C])=>{if(c)return f(d,v,y);if(F(y,l),i){let S=Ko(String(g));O(y,R=>S.forEach(I=>Gt(R)?.removeProperty(I)))}else return Kn(!1,y,u,d,C,s)})}}}var Jn=(t,e,n)=>(r,o,s)=>{s?o.style[t]=s:r==="toggle"?o.style[t]=getComputedStyle(o)[t]===e?n:e:o.style[t]=r==="hide"?e:n},tr={display(t,e,n){if(!n&&e instanceof HTMLDialogElement){t==="hide"||t==="toggle"&&e.open?e.close():e.open||e.show();return}let r=V(e);n?e.style.display=n:t==="toggle"?tr.display(getComputedStyle(e).display==="none"?"show":"hide",e):t==="hide"?(r.originalDisplay??=e.style.display,e.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?e.style.display=r.originalDisplay:e.style.removeProperty("display")},visibility:Jn("visibility","hidden","visible"),opacity:Jn("opacity","0","1"),hidden(t,e){(t==="toggle"?!e.hasAttribute("hidden"):t==="hide")?e.setAttribute("hidden",""):e.removeAttribute("hidden")}};function $t(t,e){let n=e??Z.defaultHideShowStrategy??"display";return Z.hideShowStrategies[n]??tr[n]??t.err("Unknown show/hide strategy : "+n)}function nr(t){t.commands.toggle=(e,n,r)=>{e.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},s;if(e.cur().type==="STYLE_REF"){let y=o.styleProp=e.consume().value.slice(1);s=$t(e,y),o.on=e.match("of")?e.withFollow(["with","between"],()=>h(e)):U(e)}else if(e.match("between")){let y=te(e);if(y)e.req("and"),o.between=[y,te(e)??e.err("Expected classRef")];else{let g=K(e)??e.err("Expected either a class reference or attribute expression");e.req("and"),o.between=[g,K(e)??e.err("Expected attributeRef")]}}else if(!(o.classRefs=Yn(e))&&!(o.attributeRef=K(e))){let y=e.g.toggleElement;if(!y)o.target=e.withFollow(["between"],()=>ae(e));else{let g=e.withFollow(["between","as"],()=>$(e));if(!e.peek("between"))return y(e,g,r);o.target=Lt(e,g)}}if(!o.styleProp&&!o.target&&(o.on=e.match("on")?h(e):U(e)),e.match("between")){let y=o.betweenValues=e.withFollow(["and"],()=>{let g=[h(e)];for(;e.matchOp(",");)g.push(h(e));return g});e.req("and"),y.push(h(e))}o.target&&!o.betweenValues&&e.err("toggle <expression> requires 'between' with values"),e.peek("for")&&!e.peek("in",2)?(e.match("for"),o.time=h(e)):e.match("until")&&(o.until=ce(e),e.match("from")&&(o.from=h(e))),o.end=e.endPos();let{on:i,target:c,betweenValues:a,between:u,attributeRef:l,styleProp:m}=o,f=i?e.text(i):"",p=(y,g)=>y[(y.findIndex(v=>v==g)+1)%y.length],d=(y,g,v,C)=>{if(a&&c?.lhs&&c.put){let S=c;return N([c.ev(y),c.lhs(y)],([R,I])=>S.put?.(y,I,p(v,R)))}if(a&&m)return O(g,S=>{let R=Gt(S);if(!R||!x(S))return;let I=R.getPropertyValue(m)||getComputedStyle(S).getPropertyValue(m);R.setProperty(m,String(p(v,I)))});F(g,f),O(g,S=>{if(x(S))if(s)S instanceof HTMLElement&&s("toggle",S);else if(u){let[R,I]=u;if(R.type==="classRef"&&I.type==="classRef"){let[A,M]=[String(R.className),String(I.className)],q=S.classList.contains(A);S.classList.toggle(A,!q),S.classList.toggle(M,q)}else if(R.type==="attributeRef"&&I.type==="attributeRef"){let A=S.getAttribute(R.name)===String(R.value);Be(S,A?R:I,!1),Be(S,A?I:R,!0)}}else l?Be(S,l,!S.hasAttribute(l.name)):C.forEach(R=>S.classList.toggle(String(R)))})};return o.run=y=>N([i?.ev(y),o.time?.ev(y),o.from?.ev(y),N((a??[]).map(g=>g.ev(y)),g=>g),...Ht(o.classRefs,y)],([g,v,C,S,...R])=>{let I=()=>d(y,g,Array.isArray(S)?S:[],R);if(o.time)return new Promise(A=>{I(),setTimeout(()=>{I(),A()},T(v))});if(o.until){let A=o.until,M=C||y.me;return new Promise(q=>{Q(M)&&M.addEventListener(A,()=>{I(),q()},{once:!0}),I()})}return E(I(),()=>{})}),o}}function sr(t){for(let e of["hide","show"])t.commands[e]=(n,r,o)=>{let s=n.cur(),i=s.value==="when"||s.value==="with"||n.commandBoundary(s)?U(n):h(n),c;n.match("with")&&(c=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;e==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(d=>d.value).join(""));let u=n.match("when")?h(n):void 0,l=$t(n,c),m=n.text(i),f=d=>y=>{y instanceof HTMLElement&&l(d,y,d==="show"?a:void 0)};return{type:`${e}Command`,target:i,strategy:c,arg:a,when:u,start:o,end:n.endPos(),run:d=>E(i.ev(d),y=>{if(F(y,m),u)return it(y,u,d,f(e),f(e==="hide"?"show":"hide"));O(y,f(e))})}}}function ir(t){t.commands.take=(e,n,r)=>{let o=[];for(let v=te(e);v;v=te(e))o.push(v);let s=o.length>0,i=s?void 0:K(e)??e.err("Expected either a class reference or attribute expression"),c,a,u=v=>(o.length>1&&e.err(`\`${v}\` cannot be combined with multiple class refs`),te(e)??e.err("Expected classRef"));e.match("with")&&(s?c=u("with"):a=h(e));let l;e.match("from")&&(l=h(e),e.match("giving")&&((c||a)&&e.err("`giving` cannot be combined with `with`"),s?c=u("giving"):a=h(e)));let m=e.match("for")?h(e):U(e),f=e.text(m),p=l?e.text(l):"",d=c?.className,y=(v,C)=>O(v,S=>x(S)&&C(S));return{type:"takeCommand",classRefs:o,attributeRef:i,from:l,for:m,replacementClass:c,replacementValue:a,start:r,end:e.endPos(),run:v=>N([l?.ev(v),m.ev(v),a?.ev(v),...o.map(C=>C.ev(v))],([C,S,R,...I])=>{if(F(S,f),i){F(C,p),y(C,A=>R?A.setAttribute(i.name,String(R)):A.removeAttribute(i.name)),y(S,A=>A.setAttribute(i.name,i.value||""));return}o.forEach((A,M)=>{let q=String(A.className);y(l?C:I[M],b=>{b.classList.remove(q),d&&b.classList.add(d)}),y(S,b=>{b.classList.add(q),d&&b.classList.remove(d)})})})}}}var Zo="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function ar(t){t.commands.measure=(e,n,r)=>{let o=U(e),s=[];if(!e.commandBoundary(e.cur())){let a=h(e);a.type==="symbol"&&a.name&&Zo.includes(a.name)?s.push(a.name):a.type==="possessive"&&a.prop&&a.root?(o=a.root,s.push(a.prop)):a.type==="ofExpression"&&a.name&&a.root?(o=a.root,s.push(a.name)):o=a}for(;e.matchOp(",");)s.push(e.reqType("IDENTIFIER").value);let i=e.text(o);return{type:"measureCommand",target:o,properties:s,start:r,end:e.endPos(),run:a=>E(o.ev(a),u=>{F(u,i);let l=x(u)?u:Y(u)?Array.from(u).find(x):void 0;if(!l)throw new Error(`'${i}' is not an element`);let m=l.getBoundingClientRect(),f={top:l.scrollTop,left:l.scrollLeft,topMax:w(l,"scrollTopMax"),leftMax:w(l,"scrollLeftMax"),height:l.scrollHeight,width:l.scrollWidth},{x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R}=m,I={x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R,bounds:m,scrollLeft:f.left,scrollTop:f.top,scrollLeftMax:f.leftMax,scrollTopMax:f.topMax,scrollWidth:f.width,scrollHeight:f.height,scroll:f};a.result=I;for(let A of s){if(!(A in I))throw new Error("No such measurement as "+A);a.locals[A]=I[A]}})}}}function Ue(t,e,n){for(let r of e)t.commands[r]=(o,s,i)=>{let c=o.commandBoundary(o.cur())?void 0:h(o);return{type:`${e[0]}Command`,target:c,start:i,end:o.endPos(),run:u=>E(c?.ev(u),l=>E(n(l||u.me),()=>{}))}}}var ht=t=>e=>{let n=w(e,t);G(n)&&Reflect.apply(n,e,[])},rr=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement,cr=t=>t instanceof HTMLInputElement&&(t.type==="checkbox"||t.type==="radio"),or=(t,e)=>{if(rr(t))e(t);else if(t instanceof HTMLFormElement)t.querySelectorAll("input, textarea, select").forEach(n=>rr(n)&&e(n));else return!1;return!0},es=t=>{t instanceof HTMLSelectElement?t.selectedIndex=-1:cr(t)?t.checked=!1:t.value=""},ts=t=>{if(t instanceof HTMLSelectElement)for(let e of t.options)e.selected=e.defaultSelected;else cr(t)?t.checked=t.defaultChecked:t.value=t.defaultValue},ns=t=>e=>O(e,n=>{n instanceof HTMLDialogElement?t?n.open||n.showModal():n.close():n instanceof HTMLDetailsElement?n.open=t:n instanceof HTMLElement&&n.hasAttribute("popover")?n[t?"showPopover":"hidePopover"]():ht(t?"open":"close")(n)});function ur(t){Ue(t,["focus"],ht("focus")),Ue(t,["blur"],ht("blur")),Ue(t,["select"],ht("select")),Ue(t,["empty","clear"],e=>{Array.isArray(e)||e instanceof Set||e instanceof Map?(Array.isArray(e)?e.splice(0):e.clear(),P.wroteProperty(e)):O(e,n=>or(n,es)||x(n)&&n.replaceChildren())}),Ue(t,["reset"],e=>O(e,n=>n instanceof HTMLFormElement?n.reset():or(n,ts)))}function lr(t){for(let e of[!0,!1]){let n=e?"open":"close";t.commands[n]=(r,o,s)=>{let i=!!r.match("fullscreen"),c=r.commandBoundary(r.cur())?void 0:h(r);return{type:`${n}Command`,target:c,start:s,end:r.endPos(),run:u=>E(c?.ev(u),l=>i?e?(x(l)?l:document.documentElement).requestFullscreen():document.exitFullscreen():ns(e)(l||u.me))}}}}function dr(t){t.commands.make=(e,n,r)=>{e.match("a")||e.match("an");let o=h(e),s=[],i=o.type==="queryRef"?o.css:void 0;if(i===void 0&&e.match("from"))do s.push(h(e));while(e.matchOp(","));let c=e.match("called")?qt(e)??e.err("Expected symbol"):void 0,a=()=>{let l="div",m={classes:[]};for(let[,p,d]of(i??"").matchAll(/(^|#|\.)([^#. ]+)/g))p===""?l=d.trim():p==="#"?m.id=d.trim():m.classes.push(d.trim());let f=document.createElement(l);return m.id!==void 0&&(f.id=m.id),f.classList.add(...m.classes),f};return{type:"makeCommand",value:o,args:s,called:c,start:r,end:e.endPos(),run:l=>N([i===void 0?o.ev(l):void 0,...s.map(m=>m.ev(l))],([m,...f])=>{l.result=i===void 0?Reflect.construct(G(m)?m:Object,f):a(),c?.put?.(l,void 0,l.result)})}}}function fr(t){t.commands.append=(e,n,r)=>{let o=h(e),s=e.match("to")?_e(h(e)):void 0;return{type:"appendCommand",value:o,target:s,start:r,end:e.endPos(),run:c=>N([s?s.ev(c):le("result",c),o.ev(c),s?.lhs?.(c)],([a,u,l])=>{if(Array.isArray(a)||a instanceof Set)Array.isArray(a)?a.push(u):a.add(u),P.wroteProperty(a);else if(x(a))x(u)?a.insertAdjacentElement("beforeend",u):a.insertAdjacentHTML("beforeend",String(u)),z.process(a);else{let m=T(a||"")+T(u);if(!s)ot("result",c,void 0,m);else if(s.put)s.put(c,l,m);else throw new Error("Unable to append a value!")}})}}}function mr(t){t.commands.swap=(e,n,r)=>{let o=e.withFollow(["with"],()=>ae(e));e.req("with");let s=ae(e);return{type:"swapCommand",first:o,second:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s.ev(c),o.lhs?.(c),s.lhs?.(c)],([a,u,l,m])=>{if(x(a)&&x(u)){let f=document.createComment("");a.replaceWith(f),u.replaceWith(a),f.replaceWith(u)}else o.put?.(c,l,u),s.put?.(c,m,a)})}}}function pr(t){t.commands.send=t.commands.trigger=(e,n,r)=>{let o=ce(e),s=ut(e),i=e.match(n==="trigger"?"on":"to")?h(e):U(e),c=e.text(i);return{type:"sendCommand",event:o,details:s,to:i,start:r,end:e.endPos(),run:u=>N([i.ev(u),s?.ev(u)],([l,m])=>{F(l,c),O(l,f=>_(f,o,W(m)?m:{},u.me))})}}}function hr(t){t.commands.wait=(e,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(e.match("for")){e.match("a");let s=o.events=[];do{let a=e.cur();a.type==="NUMBER"||a.op&&a.value==="("?s.push(h(e)):s.push({event:ce(e),args:pt(e)})}while(e.match("or"));let i=o.from=e.match("from")?h(e):void 0,c=i?e.text(i):"me";o.run=a=>E(i?i.ev(a):a.me,u=>{if(!Q(u))throw new Error("Not a valid event target: "+c);return new Promise(l=>{for(let m of s)"event"in m?u.addEventListener(m.event,f=>{a.result=f;for(let p of m.args)a.locals[p]=w(f,p)||w(w(f,"detail"),p)||null;l()},{once:!0}):E(m.ev(a),f=>setTimeout(()=>{a.result=f,l()},T(f)))})})}else{let s;e.match("a")?e.req("tick"):s=o.time=h(e),o.run=i=>E(s?.ev(i),c=>new Promise(a=>setTimeout(a,s?T(c):0)))}return o.end=e.endPos(),o}}function yr(t){let e=t.pos(),n=t.cur(),r=[],o="",s=!1;for(;t.hasMore();){n=t.consume();let i=t.tok(0,!0);if(i.type==="IDENTIFIER"&&i.value==="end")break;s?n.type==="IDENTIFIER"||n.type==="NUMBER"?o+=n.value:(o&&r.push(o),o="",s=!1):n.type==="IDENTIFIER"&&n.value==="function"&&(s=!0)}return{source:t.src.substring(e,n.end+1),functions:r}}function gr(t){t.commands.js=(e,n,r)=>{let o=[];if(e.matchOp("(")&&!e.matchOp(")")){do o.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let{source:s}=yr(e);e.match("end");let i=new Function(...o,s);return{type:"jsCommand",source:s,inputs:o,start:r,end:e.endPos(),run:a=>E(Reflect.apply(i,globalThis,o.map(u=>le(u,a))),u=>{a.result=u})}},t.features.js=(e,n)=>{let{source:r,functions:o}=yr(e),s=new Function(`${r}
|
|
18
|
-
return { ${o.map(c=>`${c}:${c}`).join(",")} } `);return{type:"jsFeature",source:r,functions:o,start:n,end:e.endPos(),install:()=>void Object.assign(globalThis,s())}}}function wr(t){for(;;){let e=t();if(J(e))return e.then(n=>n??wr(t));if(e)return e}}var rs=t=>{if(t){if(W(t)&&Symbol.asyncIterator in Object(t)){let e=Reflect.get(Object(t),Symbol.asyncIterator);return typeof e=="function"?Reflect.apply(e,t,[]):void 0}return(Y(t)?t:Object.keys(Object(t)))[Symbol.iterator]()}};function vr(t){t.commands.repeat=t.commands.for=(e,n,r)=>{let o={type:"repeatCommand",until:!1,bottomTested:!1,forever:!1,body:[],start:r,end:r,run:()=>{}};if(n==="for"||e.match("for")){let v=o.identifier=e.reqType("IDENTIFIER").value;e.req("in"),o.expression=h(e);for(let C=o.expression;C;C=C.root)C.type==="collectionExpression"&&(C.varName=v)}else e.match("in")?(o.identifier="it",o.expression=h(e)):e.match("while")?o.condition=h(e):e.match("until")?(o.until=!0,e.match("event")?(o.event=ce(e),e.match("from")&&(o.from=h(e))):o.condition=h(e)):!e.commandBoundary(e.cur())&&e.cur().value!=="forever"?(o.times=h(e),e.req("times")):(e.match("forever"),o.forever=!0);e.match("index")?o.indexIdentifier=e.reqType("IDENTIFIER").value:e.match("indexed")&&(e.req("by"),o.indexIdentifier=e.reqType("IDENTIFIER").value);let s=o.body=D(e);if(o.forever&&e.hasMore()){let v=e.match("until")??e.match("while");v&&(o.forever=!1,o.bottomTested=!0,o.until=v.value==="until",o.condition=h(e))}e.match("else")&&(o.elseBranch=D(e)),e.hasMore()&&e.req("end"),o.end=e.endPos();let{identifier:i,indexIdentifier:c,expression:a,times:u,condition:l,until:m,bottomTested:f,forever:p,event:d,from:y,elseBranch:g}=o;return o.run=v=>N([a?.ev(v),y?.ev(v)],([C,S])=>{let R=rs(C)??(g?[][Symbol.iterator]():void 0),I=0,A=!1,M=!1;if(d){let L=S||v.me;Q(L)&&L.addEventListener(d,()=>M=!0,{once:!0})}let q=()=>!A&&g?E(j(g,v),L=>({signal:re(L)})):{signal:void 0},b=L=>{let H=I++;A=!0,C&&i?v.result=v.locals[i]=L:v.result=H,c&&(v.locals[c]=H);let X=v.meta.template;if(X&&C){let pe=`${i}_${r}`;X.loops[pe]??={identifier:i,indexIdentifier:c,source:C},X.out.push(`<!--hs-scope:${pe}:${H}-->`)}return E(j(s,v),pe=>{let rn=w(pe,"k");if(rn==="break")return{signal:void 0};if(rn==="return")return{signal:re(pe)};if(d)return new Promise(go=>setTimeout(go,0))})};return E(wr(()=>N([l?.ev(v),u?.ev(v)],([L,H])=>f&&I===0||p?b(void 0):m?(d?!M:L!==!0)?b(void 0):q():l?L?b(void 0):q():H?I<T(H)?b(void 0):q():R?E(R.next(),X=>w(X,"done")?q():b(w(X,"value"))):q())),L=>re(w(L,"signal")))}),o}}function Er(t){for(let e of["break","continue"]){let n={k:e};t.commands[e]=(r,o,s)=>({type:`${e}Command`,start:s,end:r.endPos(),run:()=>n})}}function br(t){t.commands.tell=(e,n,r)=>{let o=h(e),s=D(e);e.hasMore()&&!e.featureStart(e.cur())&&e.req("end");let i=(a,u,l)=>{for(;l<u.length;l++){a.you=u[l];let m=j(s,a);if(J(m))return m.then(f=>re(f)??i(a,u,l+1));if(m)return m}};return{type:"tellCommand",value:o,body:s,start:r,end:e.endPos(),run:a=>E(o.ev(a),u=>{let l=u==null?[]:Array.isArray(u)?u:u instanceof NodeList?Array.from(u):[u],m=a.you;return E(i(a,l,0),f=>(a.you=m,re(f)))})}}}function Bt(t,e){let n;if(typeof e=="string"){let u=document.createElement("template");u.innerHTML=e,n=u.content}else if(e instanceof DocumentFragment)n=e;else if(e instanceof Element)n=document.createDocumentFragment(),n.append(e.cloneNode(!0));else throw new Error("morph requires an HTML string, element, or document fragment");let r=n.firstElementChild;r&&!r.nextElementSibling&&r.tagName===t.tagName&&(Sr(t,r),n=r);let o=[...t.matches("[id]")?[t]:[],...t.querySelectorAll("[id]")],s=[...n.querySelectorAll("[id]")],i=is(o,s),c=new Map;Nr(c,i,t.parentElement,o),Nr(c,i,n,s);let a=document.createElement("div");a.hidden=!0,(document.body??t.parentElement)?.after(a),Tr({target:t,ids:c,persistent:i,pantry:a,futureMatches:new WeakSet},t,n),xe(a),a.remove()}function Tr(t,e,n){e instanceof HTMLTemplateElement&&n instanceof HTMLTemplateElement&&(e=e.content,n=n.content);let r=e.firstChild,o=n.firstChild;for(;o;){let s=o,i=r&&os(t,s,r);if(i&&i!==r)for(let c=r;c&&c!==i;){let a=c;c=c.nextSibling,a instanceof Element&&(t.ids.has(a)||Cr(t,a,s))?Wt(e,a,null):kr(t,a)}if(!i&&s instanceof Element&&t.persistent.has(s.id)){let c=`[id="${CSS.escape(s.id)}"]`,a=t.target.id===s.id?t.target:t.target.querySelector(c)??t.pantry.querySelector(c);if(a){for(let u=a.parentNode;u;u=u.parentNode){let l=t.ids.get(u);l?.delete(a.id),l?.size===0&&t.ids.delete(u)}Wt(e,a,r),i=a}}if(o=s.nextSibling,i&&s instanceof Element)xr(t,i,s),r=i.nextSibling;else if(s instanceof Element&&t.ids.has(s)){let c=document.createElement(s.tagName);e.insertBefore(c,r),xr(t,c,s),r=c.nextSibling}else e.insertBefore(s,r),s instanceof Element&&fe(s),r=s.nextSibling}for(;r;){let s=r;r=r.nextSibling,kr(t,s)}}function xr(t,e,n){e instanceof Element&&(Sr(e,n),e instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement&&e.defaultValue!==n.defaultValue&&(e.value=n.value),(!e.isEqualNode(n)||n.tagName==="TEMPLATE"||n.querySelector("template"))&&Tr(t,e,n),fe(e))}function os(t,e,n){if(!(e instanceof Element))return null;let r=t.ids.get(e),o=r?.size??0;if(e.id&&!r)return null;let s=null,i=0,c=10;for(let a=n;a;a=a.nextSibling){let u=t.ids.get(a);if(ss(a,e)){if(u&&r&&[...u].some(l=>r.has(l)))return a;if(!u){if(c>0&&a.isEqualNode(e))return a;s??=a}}if(i+=u?.size??0,i>o||a.contains(document.activeElement)||--c<1&&o===0)break}return s&&Cr(t,s,e)?null:s}function Cr(t,e,n){if(t.futureMatches.has(e))return!0;let r=n.nextSibling;for(let o=0;r&&o<10;r=r.nextSibling,o++)if(r instanceof Element&&e.isEqualNode(r))return t.futureMatches.add(e),!0;return!1}function kr(t,e){t.ids.has(e)?Wt(t.pantry,e,null):(e instanceof Element&&xe(e),e.remove())}function Wt(t,e,n){let r=w(t,"moveBefore");if(G(r))try{Reflect.apply(r,t,[e,n]);return}catch{}t.insertBefore(e,n)}function Sr(t,e){for(let{name:n,value:r}of e.attributes)t.getAttribute(n)!==r&&(t.setAttribute(n,r),n==="value"&&t instanceof HTMLInputElement&&t.type!=="file"&&(t.value=r));for(let{name:n}of[...t.attributes])e.hasAttribute(n)||t.removeAttribute(n)}function ss(t,e){return!(t instanceof Element)||t.tagName!==e.tagName||t.tagName==="SCRIPT"&&!t.isEqualNode(e)?!1:!t.id||t.id===e.id}function is(t,e){let n=new Set,r=new Map;for(let{id:s,tagName:i}of t)r.has(s)?n.add(s):s&&r.set(s,i);let o=new Set;for(let{id:s,tagName:i}of e)o.has(s)?n.add(s):r.get(s)===i&&o.add(s);for(let s of n)o.delete(s);return o}function Nr(t,e,n,r){for(let o of r)if(e.has(o.id))for(let s=o;s&&s!==n;s=s.parentElement){let i=t.get(s);i||t.set(s,i=new Set),i.add(o.id)}}function Pr(t){t.commands.morph=(e,n,r)=>{let o=h(e);e.req("to");let s=h(e);return{type:"morphCommand",target:o,content:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s.ev(c)],([a,u])=>{O(a,l=>{l instanceof Element&&Bt(l,u)})})}}}function Rr(t){t.commands.log=(e,n,r)=>{let o=[h(e)];for(;e.matchOp(",");)o.push(h(e));let s=e.match("with")?h(e):void 0;return{type:"logCommand",values:o,logger:s,start:r,end:e.endPos(),run:c=>N([s?.ev(c),...o.map(a=>a.ev(c))],([a,...u])=>{G(a)?a(...u):console.log(...u)})}}}function Ir(t){t.commands.get=t.commands.call=(e,n,r)=>{let o=h(e);return n==="call"&&o.type!=="functionCall"&&e.err("Must be a function invocation"),{type:"getCommand",value:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{i.result=c})}}}function Or(t){t.pseudo=(e,n)=>{let r=e.tok(1);if(!(r.op&&(r.value==="."||r.value==="(")))return;let o=ct(e);o.type!=="functionCall"&&e.err("Pseudo-commands must be function calls");let s=o.root,i="args"in o&&Array.isArray(o.args)?o.args:[],c;s&&!s.root&&(e.matchAny("the","to","on","with","into","from","at")?c=h(e):e.match("me")&&(c=U(e)));let a=s?.name??"",u=c?e.text(c):"",l=e.text(o),m=c;return{type:"pseudoCommand",value:o,target:c,start:n,end:e.endPos(),run:p=>m?N([m.ev(p),...i.map(d=>d.ev(p))],([d,...y])=>{F(d,u),p.result=at(w(d,a),d,y,p,l),Ye(d,a)}):E(o.ev(p),d=>{p.result=d})}}}function Ar(t){t.commands.ask=(e,n,r)=>{let o=h(e);return{type:"askCommand",message:o,start:r,end:e.endPos(),run:i=>E(o.ev(i),c=>{i.result=prompt(String(c))})}},t.commands.answer=(e,n,r)=>{let o=h(e),s;if(e.match("with")){let c=e.withFollow(["or"],()=>h(e));e.req("or"),s=[c,h(e)]}return{type:"answerCommand",message:o,choices:s,start:r,end:e.endPos(),run:c=>N([o.ev(c),s?.[0].ev(c),s?.[1].ev(c)],([a,u,l])=>{s?c.result=confirm(String(a))?u:l:alert(String(a))})}}}function Lr(t){t.commands.breakpoint=(e,n,r)=>({type:"breakpointCommand",start:r,end:e.endPos(),run:()=>{debugger}})}var Ut=(t,e,n)=>{let r=w(t,"slice");return G(r)?Reflect.apply(r,t,[e,n]):void 0},as=(t,e,n)=>({*[Symbol.iterator](){let r=new RegExp(t instanceof RegExp?t:String(t),e);for(let o=r.exec(n);o;o=r.exec(n))o[0].length===0&&r.lastIndex++,yield o}});function Fr(t){t.commands.pick=(e,n,r)=>{e.match("the");let o=e.matchAny("first","last","random","match","matches")??e.matchAny("item","items","character","characters");if(!o)return;let s=o.value==="first"||o.value==="last"||o.value==="random"||o.value==="match"||o.value==="matches"?o.value:"range",i={};(s==="match"||s==="matches")&&e.match("of"),e.withFollow(["of","from"],()=>{if(s==="first"||s==="last")i.count=h(e);else if(s==="random")e.cur().type==="NUMBER"&&(i.count=h(e));else if(s==="range")e.match("at")||e.match("from"),e.match("start")||(i.from=h(e)),(e.match("to")||e.matchOp(".."))&&(e.match("end")?i.toEnd=!0:i.to=h(e)),e.match("inclusive")?i.bounds="inclusive":e.match("exclusive")&&(i.bounds="exclusive");else{i.re=h(e);let g=e.matchOp("|")?e.reqType("IDENTIFIER").value:void 0;i.flags=s==="match"?g??"":g===void 0?"gu":"g"+g.replace("g","")}}),e.matchAny("of","from")||e.expected("of","from");let c=h(e),{count:a,from:u,to:l,toEnd:m,bounds:f,re:p,flags:d=""}=i;return{type:"pickCommand",variant:s,root:c,...i,start:r,end:e.endPos(),run:g=>N([c.ev(g),a?.ev(g),u?.ev(g),l?.ev(g),p?.ev(g)],([v,C,S,R,I])=>{if(v==null)g.result=v;else if(s==="first")g.result=Ut(v,0,T(C));else if(s==="last")g.result=Ut(v,-T(C));else if(s==="random"){let A=Y(v)?Array.from(v):[],M=()=>A.splice(Math.floor(Math.random()*A.length),1)[0];g.result=C==null?M():Array.from({length:Math.min(T(C),A.length)},M)}else if(s==="range"){let A=T(S??0)+(f==="exclusive"?1:0),M=m?T(w(v,"length")):R==null?void 0:T(R),q=M===void 0?A+1:M+(f==="inclusive"?1:0);g.result=Ut(v,A,q)}else s==="match"?g.result=new RegExp(I instanceof RegExp?I:String(I),d).exec(String(v)):g.result=as(I,d,String(v))})}}}var cs={json:"json",JSON:"json",Object:"json",response:"response",Response:"response",html:"html",HTML:"html",text:"text",Text:"text",String:"text"};function Mr(t){t.commands.fetch=(e,n,r)=>{let o=e.withFollow(["as"],()=>Mt(e)),s=()=>{if(!e.match("as"))return;e.match("a")||e.match("an");let m=Se(e)??e.err("Expected dotOrColonPath");return cs[m]??":"+m},i=s(),c;e.match("with")&&e.cur().value!=="{"?c=He(e):e.cur().op&&e.cur().value==="{"&&(c=De(e)),i??=s()??"text";let a=!1;e.match("do")?(e.req("not"),e.req("throw"),a=!0):e.cur().value==="don"&&e.tok(1,!0).value==="'"&&e.tok(2,!0).value==="t"&&(e.consume(),e.consume(),e.consume(),e.req("throw"),a=!0);let u=i;return{type:"fetchCommand",url:o,options:c,as:u,dontThrow:a,start:r,end:e.endPos(),run:m=>N([o.ev(m),c?.ev(m)],([f,p])=>{let d=m.me,y=W(p)?p:{};y.headers||={},y.conversion=u.startsWith(":")?u.slice(1):u;let g=new AbortController,v=()=>g.abort();Q(d)&&d.addEventListener("fetch:abort",v,{once:!0}),y.signal=g.signal,_(d,"hyperscript:beforeFetch",y,d),_(d,"fetch:beforeRequest",y,d);let C=!1;y.timeout&&setTimeout(()=>C||v(),T(y.timeout));let S=I=>{m.result=I,_(d,"fetch:afterRequest",{result:I}),C=!0},R=Reflect.apply(fetch,globalThis,[f,y]);return Promise.resolve(R).then(I=>{let A={response:I};_(d,"fetch:afterResponse",A);let M=A.response;if(!(M instanceof Response))throw new Error("fetch did not return a Response");if(!a&&u!=="response"&&Z.fetchThrowsOn.some(k=>k.test(String(M.status))))throw Object.assign(new Error(`fetch failed: ${M.status} ${M.statusText} (${f})`),{response:M,status:M.status});if(u==="response")return S(M);if(u==="json")return M.json().then(S);let q=u.startsWith(":")?u.slice(1):void 0,b=q?ge[q]:void 0;return b&&w(b,"_rawResponse")?S(b(M)):M.text().then(k=>S(u==="html"?ve(k):q?rt(k,q):k))}).catch(I=>{throw _(d,"fetch:error",{reason:I}),I}).finally(()=>Q(d)&&d.removeEventListener("fetch:abort",v))})}}}var us={top:"start",middle:"center",bottom:"end"},ls={left:"start",center:"center",right:"end"},qr=t=>{let e=t.matchAny("smoothly","instantly");return e?e.value==="smoothly"?"smooth":"instant":void 0};function _r(t){t.match("the");let e=t.matchAny("top","middle","bottom"),n=t.matchAny("left","center","right");(e||n)&&t.req("of");let r=$(t),o=t.matchAnyOp("+","-"),s=o?t.withFollow(["px"],()=>h(t)):void 0;t.match("px");let i=t.match("in")?$(t):void 0,c={block:e?us[e.value]:"start",inline:n?ls[n.value]:"nearest"},a=qr(t);return a&&(c.behavior=a),{target:r,offset:s,sign:o?.value==="-"?-1:o?1:0,options:c,container:i}}function jr(t,e){return N([t.target.ev(e),t.offset?.ev(e),t.container?.ev(e)],([n,r,o])=>{let s=t.sign*T(r??0);O(n,i=>{let c=i===window?document.body:i;c instanceof HTMLElement&&(o instanceof HTMLElement?o.scrollTo({top:c.offsetTop-o.offsetTop+s,left:c.offsetLeft-o.offsetLeft,behavior:t.options.behavior??"auto"}):(t.sign?ds(c,s,t.options):c).scrollIntoView(t.options))})})}function ds(t,e,n){let r=t.getBoundingClientRect(),o=i=>i==="start"||i==="end"?e:0,s=document.createElement("div");return Object.assign(s.style,{position:"absolute",top:r.top+window.scrollY+o(n.block)+"px",left:r.left+window.scrollX+o(n.inline)+"px",height:r.height+"px",width:r.width+"px",zIndex:String(Number.MIN_SAFE_INTEGER),opacity:"0"}),document.body.appendChild(s),setTimeout(()=>s.remove(),100),s}function Dr(t){t.commands.scroll=(e,n,r)=>{let o={type:"scrollCommand",start:r,end:r,run:()=>{}};if(e.match("to")){let s=o.to=_r(e);o.run=i=>jr(s,i)}else{let s=["up","down","left","right"],i=e.matchAny(...s),c;!i&&e.cur().value!=="by"&&(c=o.target=$(e),i=e.matchAny(...s)),e.req("by");let a=o.by=e.withFollow(["px"],()=>h(e));e.match("px");let u=o.behavior=qr(e),l=o.direction=i?.value??"down";o.run=m=>N([c?.ev(m),a.ev(m)],([f,p])=>{let d=T(p)*(l==="up"||l==="left"?-1:1),y=l==="left"||l==="right",g={top:y?0:d,left:y?d:0};u&&(g.behavior=u),(x(f)?f:document.documentElement).scrollBy(g)})}return o.end=e.endPos(),o}}function Hr(t){t.commands.go=(e,n,r)=>{let o={type:"goCommand",back:!1,newWindow:!1,start:r,end:r,run:()=>{}},s=()=>e.match("in")?(e.req("new"),e.req("window"),!0):!1,i=c=>{if(c==null)return;if(x(c))return c.scrollIntoView({block:"start",inline:"nearest"});let a=String(c);a.startsWith("#")?window.location.hash=a:o.newWindow?window.open(a):window.location.href=a};if(e.match("back"))o.back=!0,o.run=()=>window.history.back();else if(e.match("to"),e.match("url")){let c=o.url=Ge(e);o.newWindow=s(),o.run=()=>i(c)}else if(["the","top","middle","bottom","left","center","right"].includes(e.cur().value)){let c=o.scroll=_r(e);o.run=a=>jr(c,a)}else{let c=o.target=Mt(e);o.newWindow=s(),o.run=a=>E(c.ev(a),i)}return o.end=e.endPos(),o}}function $r(t){t.commands.set=(e,n,r)=>Vt(e,r)}function Vt(t,e){{if(t.cur().op&&t.cur().value==="{"){let s=De(t);t.req("on");let i=h(t);return{type:"setCommand",target:i,object:s,start:e,end:t.endPos(),run:a=>N([s.ev(a),i.ev(a)],([u,l])=>void Object.assign(Object(l),u))}}let n=t.withFollow(["to"],()=>ae(t));t.req("to");let r=h(t);return{type:"setCommand",target:n,value:r,start:e,end:t.endPos(),run:s=>N([n.lhs?.(s),r.ev(s)],([i,c])=>n.put?.(s,i,c))}}}function Wr(t){t.commands.default=(e,n,r)=>{let o=e.withFollow(["to"],()=>ae(e));e.req("to");let s=h(e);return{type:"defaultCommand",target:o,value:s,start:r,end:e.endPos(),run:c=>E(o.ev(c),a=>{if(!(a!=null&&a!==""))return N([o.lhs?.(c),s.ev(c)],([u,l])=>o.put?.(c,u,l))})}}}function Br(t){for(let e of["increment","decrement"]){let n=e==="increment"?1:-1;t.commands[e]=(r,o,s)=>{let i=r.withFollow(n<0?["by"]:[],()=>ae(r)),c=r.match("by")?h(r):void 0;return{type:`${e}Command`,target:i,amount:c,start:s,end:r.endPos(),run:u=>N([i.ev(u),c?.ev(u),i.lhs?.(u)],([l,m,f])=>{let p=(l?parseFloat(String(l)):0)+n*(c?parseFloat(String(m)):1);u.result=p,i.put?.(u,f,p)})}}}}function Gr(t,e){t.replaceChildren(ve(e)),z.process(t)}var fs=["arrayIndex","propertyAccess","possessive","ofExpression","attributeRef","styleRef","attributeRefAccess"],ms={into:"into",before:"before",after:"after",start:"start",end:"end"},ps={before:"before",after:"after",start:"prepend",end:"append"};function Ur(t){t.commands.put=(e,n,r)=>{let o=h(e),s=e.matchAny("into","before","after");!s&&e.match("at")&&(e.match("the"),s=e.matchAny("start","end"),e.req("of"));let i=ms[(s??e.expected("into","before","at start of","at end of","after")).value],c=_e(h(e)),a=e.text(c),u=(f,p)=>c.type==="symbol"?E(c.ev(f),d=>{x(d)||d instanceof Document?Gr(d,p):c.put?.(f,void 0,p)}):fs.includes(c.type)?E(c.lhs?.(f),d=>c.put?.(f,d,p)):E(c.ev(f),d=>{F(d,a),O(d,y=>{(x(y)||y instanceof Document)&&Gr(y,p)})}),l=(f,p,d)=>E(c.ev(f),y=>{if(F(y,a),Array.isArray(y)){d==="prepend"?y.unshift(p):y.push(p),P.wroteProperty(y);return}O(y,g=>{x(g)&&(g[d](p instanceof Node?p:ve(p)),z.process(g.parentElement??g))})});return{type:"putCommand",value:o,operation:i,target:c,start:r,end:e.endPos(),run:f=>E(o.ev(f),p=>i==="into"?u(f,p):l(f,p,ps[i]))}}}var Re=t=>Y(t)?Array.from(t):Array.from(Object(t)),Vr=t=>Array.isArray(t)||t instanceof NodeList?Re(t).map(Vr).join(""):t instanceof HTMLElement?t.outerHTML:t instanceof Node?"":String(t);function hs(t){let e={},n=r=>{let o=w(r,"name"),s=w(r,"value"),i=w(r,"type");if(typeof o!="string"||s==null||i==="radio"&&!w(r,"checked")||(i==="checkbox"?s=w(r,"checked")?[s]:void 0:r instanceof HTMLSelectElement&&r.multiple&&(s=Array.from(r.selectedOptions,a=>a.value)),s===void 0))return;let c=e[o];e[o]=c===void 0?s:(Array.isArray(c)?c:[c]).concat(s)};return O(t,r=>{w(r,"name")!=null&&w(r,"value")!=null?n(r):r instanceof Element&&r.querySelectorAll("input,select,textarea").forEach(n)}),e}function zr(t){Object.assign(ge,{Boolean:e=>!!e,Date:e=>typeof e=="number"||e instanceof Date?new Date(e):new Date(String(e)),Array:Re,JSON:e=>e instanceof Response?e.json():JSON.parse(String(e)),JSONString:e=>JSON.stringify(e),Object:e=>typeof e=="string"||e instanceof String?JSON.parse(String(e)):{...Object(e)},FormEncoded:e=>new URLSearchParams(Object(e)).toString(),Set:e=>new Set(Re(e)),Map:e=>new Map(Object.entries(Object(e))),Keys:e=>e instanceof Map?Array.from(e.keys()):Object.keys(Object(e)),Entries:e=>e instanceof Map?Array.from(e.entries()):Object.entries(Object(e)),Reversed:e=>Re(e).reverse(),Unique:e=>[...new Set(Re(e))],Flat:e=>Re(e).flat(),HTML:Vr}),Fe.push((e,n)=>{if(e==="Fixed"||e.startsWith("Fixed:"))return Number(n).toFixed(parseInt(e.split(":")[1])||0)},(e,n)=>e==="Values"?hs(n):void 0)}var Qr="=;expires=Thu, 01 Jan 1970 00:00:00 GMT",Ve=()=>document.cookie?document.cookie.split("; ").map(t=>{let e=t.indexOf("=");return{name:t.slice(0,e),value:decodeURIComponent(t.slice(e+1))}}):[],ys=new Proxy({},{get(t,e){if(e===Symbol.iterator){let n=Ve();return n[Symbol.iterator].bind(n)}if(!(typeof e!="string"||e==="then"))return e==="length"?Ve().length:e==="clear"?n=>void(document.cookie=n+Qr):e==="clearAll"?()=>Ve().forEach(n=>document.cookie=n.name+Qr):e!==""&&!Number.isNaN(Number(e))?Ve()[parseInt(e)]:Ve().find(n=>n.name===e)?.value},set(t,e,n){let r=[];if(typeof n=="string")r.push(encodeURIComponent(n),"samesite=lax");else{r.push(encodeURIComponent(String(w(n,"value"))));let o=(s,i)=>{let c=w(n,s);c&&r.push(`${i}=${c}`)};o("expires","expires"),o("maxAge","max-age"),o("partitioned","partitioned"),o("path","path"),o("samesite","samesite"),w(n,"secure")&&r.push("secure")}return document.cookie=String(e)+"="+r.join(";"),!0}});function Jr(t){Nt.cookies=ys}var zt=t=>Y(t)?Array.from(t):[];function gs(t){let e=t.pos(),n=t.matchAny("first","last","random");if(!n)return;t.matchAny("in","from","of");let r=$(t),o=n.value;return{type:"positionalExpression",operator:o,root:r,start:e,end:t.endPos(),ev:i=>E(r.ev(i),c=>{if(!c)return;let a=Array.isArray(c)?c:zt(w(c,"children")??c),u=o==="first"?0:o==="last"?a.length-1:Math.floor(Math.random()*a.length);return a[u]})}}function ws(t){let e=t.pos(),n=t.matchAny("next","previous");if(!n)return;let r=n.value==="next",o=Ft(t)??t.err("Expected leaf"),s=t.match("from")?t.withFollow(["in"],()=>$(t)):U(t),i=t.match("in")?$(t):void 0,c=!i&&t.match("within")?$(t):void 0,a=!!t.match("with");a&&t.req("wrapping");let u=t.text(o),l=(p,d,y)=>{let g=d instanceof Element||d instanceof Document?d:document.body,v=Array.from(g.querySelectorAll(y));if(!(p instanceof Node))return;let C=r?Node.DOCUMENT_POSITION_PRECEDING:Node.DOCUMENT_POSITION_FOLLOWING,S=r?v:v.reverse();return S.find(R=>R.compareDocumentPosition(p)===C)??(a?S[0]:void 0)},m=(p,d,y)=>{let g=zt(d).filter(R=>R===p||x(R)&&R.matches(y)),v=r?g:g.reverse(),C=v[v.indexOf(p)+1];if(v.includes(p)&&C!==void 0)return C;let S=v[0];return a&&x(S)&&S.matches(y)?S:void 0};return{type:"relativePositionalExpression",operator:n.value,thing:o,from:s,inElt:i,withinElt:c,wrapping:a,start:e,end:t.endPos(),ev:p=>N([o.ev(p),s.ev(p),i?.ev(p),c?.ev(p)],([d,y,g,v])=>{let C=w(d,"css");if(typeof C!="string")throw new Error("Expected a CSS value to be returned by "+u);return i?g&&m(y,g,C):l(y,v,C)})}}function vs(t){let e=t.pos();if(!t.match("closest"))return;let n=!!t.match("parent"),r=t.cur().type==="ATTRIBUTE_REF"?K(t):void 0,o=r?`[${r.name}]`:$(t).css??t.err("Expected a CSS expression"),s=t.match("to")?h(t):U(t),i={type:"closestExpr",css:o,parentSearch:n,to:s,start:e,end:t.endPos(),ev:c=>E(s.ev(c),a=>{if(a==null)return null;let u=[];return O(a,l=>{let m=n?w(l,"parentElement"):l;u.push(x(m)?m.closest(o):null)}),Ne(a)?u:u[0]}),lhs:c=>i.ev(c),put:(c,a,u)=>{a&&Ee(a,u)}};return r?_t(t,i,r):i}var Yr=["where","sorted","mapped","split","joined"];function Es(t,e){let n=t.matchAny(...Yr);if(!n)return;let r=n.value;r==="mapped"?t.req("to"):r!=="where"&&t.req("by");let o=t.withFollow(Yr,()=>h(t)),s=r==="sorted"&&!!t.match("descending"),i=(u,l)=>{let m=l.map(f=>(u.beingTested=f,a.varName&&(u.locals[a.varName]=f),o.ev(u)));return u.beingTested=null,m},c=(u,l)=>{if(!l)return l;if(r==="split")return E(o.ev(u),d=>String(l).split(String(d)));let m=zt(l);if(r==="joined")return E(o.ev(u),d=>m.join(String(d)));let f=i(u,m);if(r==="where")return m.filter((d,y)=>f[y]);if(r==="mapped")return f;let p=s?-1:1;return m.map((d,y)=>y).sort((d,y)=>f[d]==f[y]?0:(T(f[d])<T(f[y])?-1:1)*p).map(d=>m[d])},a={type:"collectionExpression",operator:r==="where"||r==="sorted"||r==="mapped"||r==="split"?r:"joined",root:e,operand:o,descending:s,start:e.start,end:t.endPos(),ev:u=>E(e.ev(u),l=>c(u,l))};return a}function bs(t){let e=t.pos();if(!t.matchOp("\\"))return;let n=[],r=t.matchType("IDENTIFIER");if(r)for(n.push(r.value);t.matchOp(",");)n.push(t.reqType("IDENTIFIER").value);t.reqOp("-"),t.reqOp(">");let o=h(t);return{type:"blockLiteral",params:n,expr:o,start:e,end:t.endPos(),ev:i=>(...c)=>(n.forEach((a,u)=>i.locals[a]=c[u]),o.ev(i))}}function xs(t){let e=t.pos();if(t.match("some"))return Ce(t,"some",e,h(t),n=>!qe(n),!1)}function ks(t,e){if(!t.matchOp(":"))return;let n=t.reqType("IDENTIFIER").value,r=!t.matchOp("!");return{type:"typeCheckExpression",root:e,suffix:n,start:e.start,end:t.endPos(),ev:s=>E(e.ev(s),i=>{if(nt(i,n,r))return i;throw new Error("Typecheck failed! Expected: "+n)})}}function Kr(t,e,n,r){if(_(t.me,"hyperscript:beep",{element:t.me,expression:e,value:r})){let o=r==null?"object (null)":w(w(r,"constructor"),"name")??"unknown",s=typeof r=="string"?`"${r}"`:Ne(r)?Array.from(r):r;console.log(`///_ BEEP! The expression (${n}) evaluates to:`,s,"of type "+o)}}function Ns(t){let e=t.pos();if(!t.match("beep!"))return;let n=$(t),r=t.text(n);return Ce(t,"beepExpression",e,n,(o,s)=>(Kr(s,n,r,o),o),!1)}function Ts(t,e,n){let r=[h(t)];for(;t.matchOp(",");)r.push(h(t));let o=r.map(s=>t.text(s));return{type:"beepCommand",values:r,start:n,end:t.endPos(),run:s=>N(r.map(i=>i.ev(s)),i=>i.forEach((c,a)=>Kr(s,r[a],o[a],c)))}}function Xr(t){t.leaves.push(vs,xs,bs),t.unaries.push(Ns,ws,gs),t.commands["beep!"]=Ts,t.postfixes.push(ks),t.collections.push(Es)}var Qt=t=>Se(t)??t.err("Expected dotOrColonPath");function Zr(t){t.features.def=(e,n)=>{let r=Qt(e),o=r.split("."),s=o.pop()??r,i=[];if(e.matchOp("(")&&!e.matchOp(")")){do i.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let c=D(e),a={type:"defFeature",name:r,displayName:`${s}(${i.join(", ")})`,params:i,body:c,...mt(e),start:n,end:e.endPos(),install:(u,l)=>{Tt(u,o,s,Object.assign((...f)=>{let p=B(l,a,u,null);i.forEach((y,g)=>p.locals[y]=f[g]);let d=E(st(p,c,a),y=>w(y,"value"));return J(d)&&a.finallyHandler?d.then(void 0,()=>{}):d},{hyperfunc:!0,hypername:r}))}};return a}}function eo(t){t.features.init=(e,n)=>{let r=!!e.match("immediately"),o=D(e),s={type:"initFeature",body:o,immediately:r,start:n,end:e.endPos(),install:i=>{let c=()=>void j(o,B(i,s,i,null));r?c():queueMicrotask(c)}};return s}}function to(t){t.features.behavior=(e,n)=>{let r=Qt(e),o=r.split("."),s=o.pop()??r,i=[];if(e.matchOp("(")&&!e.matchOp(")")){do i.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}let c=$e(e).features;for(let u of c)u.behavior=r;return{type:"behaviorFeature",name:r,params:i,features:c,start:n,end:e.endPos(),install:()=>Tt(null,o,s,(u,l,m)=>{if(W(u))for(let f of i)Te(u,r+"Scope")[f]=w(m,f);for(let f of c)f.install(u,l)})}}}function no(t){t.features.install=(e,n)=>{let r=Qt(e),o=ut(e),s={type:"installFeature",name:r,args:o,start:n,end:e.endPos(),install:(i,c)=>{let a=globalThis;for(let u of r.split("."))if(a=w(a,u),typeof a!="object"&&typeof a!="function")throw new Error("No such behavior defined as "+r);if(!G(a))throw new Error(r+" is not a behavior");a(i,c,o?.ev(B(i,s,i,null)))}};return s}}function ro(t){t.features.set=(e,n)=>{let r=Vt(e,n);"scope"in r.target&&r.target.scope==="local"&&e.err("variables declared at the feature level cannot be locally scoped (use :foo, ^foo, $foo, or an @attribute target instead).");let o={type:"setFeature",command:r,start:n,end:e.endPos(),install:s=>queueMicrotask(()=>void r.run(B(s,o,s,null)))};return o}}function Cs(t,e){if(typeof t!="object"||t===null)return{queue:[],executing:!1};let n=V(t).eventQueues??=new Map,r=n.get(e);return r||n.set(e,r={queue:[],executing:!1}),r}function Jt(t,e){let n=Cs(t.me,e);if(n.executing&&!e.every){if(e.queue==="none"||e.queue==="first"&&n.queue.length>0)return;e.queue!=="all"&&(n.queue.length=0),n.queue.push(t);return}n.executing=!0;let r=o=>{n.executing=!1;let s=n.queue.shift();if(s&&setTimeout(()=>Jt(s,e),1),o){let{error:i}=o;console.error(w(i,"message")??i),console.error(w(i,"stack")),_(t.me,"exception",{error:i})}};ye(()=>E(st(t,e.body,e),()=>r()),o=>r({error:o}))}function Ss(t,e){if(!Q(e))return;let n=V(e),r=n.listeners??=[],o=n.observers??=[],s=n.timers??=new Set;for(let i of t.events){let c={execCount:0},a=i.elsewhere?[document]:i.from?i.from.ev(B(e,t,e,null)):[e];O(a,u=>{if(!Q(u)){console.warn("'%s' feature ignored because target does not exists:",t.displayName,e);return}let l=i.on;if(i.mutationSpec&&u instanceof Node){l="hyperscript:mutation";let f=new MutationObserver(p=>_(u,l,{mutationList:p,observer:f}));f.observe(u,i.mutationSpec),o.push(f)}if(i.intersectionSpec&&u instanceof Element){l="hyperscript:intersection";let f=new IntersectionObserver(p=>{for(let d of p)_(u,l,{observer:f,entry:d,intersecting:d.isIntersecting,isIntersecting:d.isIntersecting,intersectionRatio:d.intersectionRatio})},i.intersectionSpec);f.observe(u),o.push(f)}if(i.resizeSpec&&u instanceof Element){l="hyperscript:resize";let f=new ResizeObserver(p=>{for(let d of p){let{width:y,height:g}=d.contentRect;_(u,l,{width:y,height:g,contentRect:d.contentRect,entry:d})}});f.observe(u),o.push(f)}let m=f=>{if(e instanceof Node&&u!==e&&!e.isConnected){u.removeEventListener(l,m);return}let p=B(e,t,e,f);if(!(i.elsewhere&&e instanceof Node&&f.target instanceof Node&&e.contains(f.target))){i.from&&(p.result=u);for(let d of i.args){let y=w(f,d);y!==void 0?p.locals[d]=y:p.detail!=null&&(p.locals[d]=w(p.detail,d))}if(i.filter){p.meta.context=f;try{if(!i.filter.ev(p))return}finally{p.meta.context=void 0}}if(i.inExpr?.css){let d=f.target instanceof Element?f.target:null;for(;d&&!d.matches(i.inExpr.css);)d=d.parentElement;if(!d)return;p.result=d}if(c.execCount++,i.startCount){let d=c.execCount;if(i.endCount?d<i.startCount||d>i.endCount:i.unbounded?d<i.startCount:d!==i.startCount)return}if(i.debounceTime){c.debounced&&(clearTimeout(c.debounced),s.delete(c.debounced)),s.add(c.debounced=setTimeout(()=>Jt(p,t),i.debounceTime));return}if(i.throttleTime){if(c.lastExec&&Date.now()<c.lastExec+i.throttleTime)return;c.lastExec=Date.now()}Jt(p,t)}};u.addEventListener(l,m),r.push({target:u,event:l,handler:m})})}}function Ps(t){if(!t.match("of"))return{attributes:!0,characterData:!0,childList:!0,attributeOldValue:!0,characterDataOldValue:!0};let e={};do if(t.match("anything"))Object.assign(e,{attributes:!0,subtree:!0,characterData:!0,childList:!0});else if(t.match("childList"))e.childList=!0;else if(t.match("attributes"))e.attributes=!0;else if(t.match("subtree"))e.subtree=!0;else if(t.match("characterData"))e.characterData=!0;else if(t.cur().type==="ATTRIBUTE_REF"){let n=t.consume().value;n.startsWith("@")||t.err("Only shorthand attribute references are allowed here"),(e.attributeFilter??=[]).push(n.substring(1))}else t.err("Unknown mutation config specification");while(t.match("or"));return(e.attributes||e.attributeFilter)&&(e.attributeOldValue=!0),e.characterData&&(e.characterDataOldValue=!0),e}function Rs(t){let e={};if(t.match("with")){let n=je(h(t));n instanceof Element&&(e.root=n)}if(t.match("having"))do t.match("margin")?e.rootMargin=Ge(t):t.match("threshold")?e.threshold=Number(je(h(t))):t.err("Unknown intersection config specification");while(t.match("and"));return e}function Is(t,e){let n=ce(t),r=pt(t),o;t.matchOp("[")&&(o=h(t),t.reqOp("]"));let s,i,c=!1;e?s=1:t.cur().type==="NUMBER"&&(s=parseInt(t.consume().value),t.match("to")?i=parseInt(t.consume().value):t.match("and")&&(c=!0,t.req("on")));let a={on:n,args:r,filter:o,startCount:s,endCount:i,unbounded:c,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?a.intersectionSpec=Rs(t):n==="mutation"&&(a.mutationSpec=Ps(t)),t.match("from")&&(t.match("elsewhere")?a.elsewhere=!0:a.from=t.withFollow(["or"],()=>h(t))),!a.from&&!a.elsewhere&&t.match("elsewhere")&&(a.elsewhere=!0),t.match("in")&&(a.inExpr=$(t));let u=()=>(t.req("at"),Number(je($(t))));return t.match("debounced")?a.debounceTime=u():t.match("throttled")&&(a.throttleTime=u()),a}function oo(t){t.features.on=(e,n)=>{let r=!!e.match("every"),o=!r&&!!e.match("first"),s=[];do s.push(Is(e,o));while(e.match("or"));let i="last";!r&&e.match("queue")&&(e.match("all")?i="all":e.match("first")?i="first":e.match("none")?i="none":e.req("last"));let c=D(e),a={type:"onFeature",displayName:"on "+s.map(u=>u.on).join(" or "),events:s,body:c,every:r,queue:i,...mt(e),start:n,end:e.endPos(),install:u=>Ss(a,u)};return a}}var Oe=new WeakMap,ao=new Map,Xt=new Map,vt=new Map,Zt=new Map,ze=new Set,Qe=new WeakMap,Os=0,me,Yt=!1;function ke(t){let e=Oe.get(t);return e||Oe.set(t,e={id:++Os}),e}var yt=t=>typeof t=="object"&&t!==null;function As(t,e){let n=me;me=t,P.tracking=!0;try{return e()}finally{me=n,P.tracking=n!==void 0}}var Kt=class{constructor(e,n,r){this.expression=e;this.handler=n;this.element=r}dependencies=new Map;stopped=!1;last;triggers=0;evaluate(){try{return this.next=As(this,this.expression),!0}catch(e){return console.error("Error in reactive expression:",e),!1}}next;handle(e){try{this.handler(e)}catch(n){console.error("Error in reactive handler:",n)}}initialize(){this.evaluate()&&(this.last=this.next),so(this),this.last!=null&&this.handle(this.last)}run(){if(++this.triggers>100){console.error("Reactivity loop detected: an effect triggered 100 consecutive times without settling. This usually means an effect is modifying a variable it also depends on.",this.element??this);return}io(this);let e=this.dependencies;this.dependencies=new Map;let n=this.evaluate();n||(this.dependencies=e),so(this),n&&!Object.is(this.next,this.last)&&(this.last=this.next,this.handle(this.next))}settled(){this.triggers=0}stop(){this.stopped||(this.stopped=!0,io(this),ze.delete(this))}};function Ls(t){t.stopped||(ze.add(t),!Yt&&(Yt=!0,queueMicrotask(()=>{Yt=!1;let e=Array.from(ze);ze.clear();for(let n of e)n.stopped||(n.element&&!n.element.isConnected?n.stop():n.run());if(ze.size===0)for(let n of e)n.settled()})))}var Ie=t=>t?.forEach(Ls);function co(t){for(let[e,n]of Zt)for(let r of t)if(e.contains(r)){Ie(n);break}}var gt;function Fs(){gt??=new MutationObserver(t=>{let e=new Set;for(let n of t){if(n.type==="attributes"){let r=Oe.get(n.target);r&&Ie(Xt.get(`${n.attributeName}:${r.id}`))}e.add(n.target)}co(e)}),gt.observe(document,{attributes:!0,childList:!0,subtree:!0}),document.addEventListener("input",wt,!0),document.addEventListener("change",wt,!0)}function wt(t){let e=t.target;if(!(e instanceof Element))return;let n=Oe.get(e);n&&Ie(vt.get(n.id)),co([e])}function Ms(t,e,n){let r=t.get(e);r||t.set(e,r=new Set),r.add(n)}function qs(t,e,n){let r=t.get(e);r?.delete(n),r?.size===0&&t.delete(e)}function uo(t,e){let n=!1;for(let r of t.dependencies.values())r.type==="global"?e(ao,r.name,t):r.type==="element"?e(ke(r.element).symbols??=new Map,r.name,t):(n=!0,r.type==="query"?e(Zt,r.root,t):r.type==="property"?e(vt,ke(r.object).id,t):e(Xt,`${r.name}:${ke(r.element).id}`,t));return n}function so(t){uo(t,Ms)&&Fs()}function io(t){uo(t,qs),gt&&!Xt.size&&!vt.size&&!Zt.size&&(gt.disconnect(),document.removeEventListener("input",wt,!0),document.removeEventListener("change",wt,!0))}function Ae(t,e,n){let r=new Kt(t,e,n);return r.initialize(),n&&(Qe.has(n)||Qe.set(n,new Set),Qe.get(n)?.add(r)),()=>r.stop()}function _s(){P.readGlobal=t=>void me?.dependencies.set("symbol:global:"+t,{type:"global",name:t}),P.readElement=(t,e)=>{yt(e)&&me?.dependencies.set(`symbol:element:${t}:${ke(e).id}`,{type:"element",name:t,element:e})},P.readProperty=t=>{yt(t)&&!w(t,"_hsSkipTracking")&&me?.dependencies.set("property:"+ke(t).id,{type:"property",object:t})},P.readAttribute=(t,e)=>{x(t)&&me?.dependencies.set(`attribute:${e}:${ke(t).id}`,{type:"attribute",name:e,element:t})},P.wroteGlobal=t=>Ie(ao.get(t)),P.wroteElement=(t,e)=>{yt(e)&&Ie(Oe.get(e)?.symbols?.get(t))},P.readQuery=t=>void me?.dependencies.set("query:"+ke(t).id,{type:"query",root:t}),P.wroteProperty=t=>{let e=yt(t)&&!w(t,"_hsSkipTracking")&&Oe.get(t);e&&Ie(vt.get(e.id))},P.stop=t=>{Qe.get(t)?.forEach(e=>e.stop()),Qe.delete(t)}}var js=t=>e=>{console.error(w(e,"message")??e),_(t,"exception",{error:e})};function Ds(t){t.features.when=(e,n)=>{let r=[];do r.push(e.withFollow(["or"],()=>h(e)));while(e.match("or"));for(let i of r)i.type==="symbol"&&"scope"in i&&i.scope==="local"&&i.name&&e.err(`Cannot watch local variable '${i.name}'. Local variables are not reactive. Use '$${i.name}' (global) or ':${i.name}' (element-scoped) instead.`);e.req("changes");let o=D(e),s={type:"whenFeature",displayName:"when ... changes",watched:r,body:o,start:n,end:e.endPos(),install:i=>queueMicrotask(()=>{let c=()=>B(i,s,i,null);for(let a of r)Ae(()=>a.ev(c()),u=>{let l=c();l.result=u,ye(()=>E(j(o,l),()=>{}),js(i))},x(i)?i:void 0)})};return s}}function Hs(t){t.features.live=(e,n)=>{let r=D(e),o={type:"liveFeature",displayName:"live",body:r,start:n,end:e.endPos(),install:s=>queueMicrotask(()=>Ae(()=>void j(r,B(s,o,s,null)),()=>{},x(s)?s:void 0))};return o}}function Gs(t){if(t instanceof HTMLInputElement){let n=t.getAttribute("type")??"text";return n==="checkbox"?"checked":n==="number"||n==="range"?"valueAsNumber":"value"}if(t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement)return"value";let e=t.getAttribute("contenteditable");if(e!==null&&e!=="false")return"textContent";if(t.tagName.includes("-")&&"value"in t)return"value";throw new Error(`bind cannot auto-detect a property for <${t.tagName.toLowerCase()}>. Use an explicit property (e.g. 'bind $var to #el's value').`)}function $s(t){if(t instanceof HTMLInputElement&&t.type==="radio")return{element:t,writable:!0,read:()=>ue(t,"checked")?t.value:void 0,write:n=>t.checked=n===t.value};let e=Gs(t);return{element:t,writable:!0,read:()=>{let n=ue(t,e);return e==="valueAsNumber"&&Number.isNaN(n)?null:n},write:n=>void Reflect.set(t,e,n)}}function Ws(t,e,n){let r=e.you||e.me;if(t.type==="classRef"&&"className"in t&&typeof t.className=="string")x(r)&&r.classList.toggle(t.className,!!n);else if(t.type==="attributeRef"&&typeof n=="boolean"&&t.name){if(!x(r))return;t.name.startsWith("aria-")?r.setAttribute(t.name,String(n)):r.toggleAttribute(t.name,n)}else E(t.lhs?.(e),o=>t.put?.(e,o,n))}function Bs(t,e,n){let r=()=>B(e,n,e,null);if(t.type==="classRef"&&"className"in t&&typeof t.className=="string"){let o=t.className;return{writable:!0,read:()=>(we(e,"class"),x(e)&&e.classList.contains(o)),write:s=>void(x(e)&&e.classList.toggle(o,!!s))}}return{writable:t.type==="attributeRef"||!!t.put,read:()=>t.ev(r()),write:o=>Ws(t,r(),o)}}function Us(t){t.features.bind=(e,n)=>{let r=e.withFollow(["and","with","to"],()=>h(e));e.matchAny("and","with","to")||e.expected("and","with","to");let o=h(e),s={type:"bindFeature",displayName:"bind",left:r,right:o,start:n,end:e.endPos(),install:i=>queueMicrotask(()=>{let c=x(i)?i:void 0,a=u=>{let l=u.ev(B(i,s,i,null));return x(l)?$s(l):Bs(u,i,s)};try{let u=a(r),l=a(o);if(!u.writable&&!l.writable)throw new Error("bind requires at least one writable side");u.writable&&Ae(l.read,u.write,c),l.writable&&Ae(u.read,l.write,c);for(let[m,f]of[[u,l],[l,u]]){let p=m.element?.closest("form");if(!p||!c)continue;let d=()=>setTimeout(()=>c.isConnected&&f.write(m.read()),0);p.addEventListener("reset",d),(V(c).listeners??=[]).push({target:p,event:"reset",handler:d})}}catch(u){console.error(w(u,"message")??u)}})};return s}}function lo(t){_s(),Ds(t),Hs(t),Us(t)}var fo="#text";function Vs(t){let e=[],n=0,r=0;for(let o of t.split(/(?<=\n)/)){n++;let s=o.trimStart(),i=r+o.length-s.length;if(r+=o.length,!s||/^(--|\/\/)(\s|$|[-/])/.test(s))continue;let c=i-(r-o.length);if(/^#[a-zA-Z]/.test(s))for(let a of de(s.slice(1)))a.start+=i+1,a.end+=i+1,a.line=n,a.column+=c+1,e.push(a);else{let a=s.replace(/\r?\n$/,`
|
|
19
|
-
`);
|
|
17
|
+
`,s)}}var qn=[],_n=[],Dt=new Set;function pe(e){if((e instanceof Element||e instanceof Document||e instanceof DocumentFragment)&&!Dt.has(e)){Dt.add(e);try{for(let n of qn)n(e);let t=Ln().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&&Gt(e),e.querySelectorAll(t).forEach(Gt);for(let n of _n)n(e)}finally{Dt.delete(e)}}}function Ne(e){let t=oe(e);if(t){j(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);P.stop(e),e.querySelectorAll("[data-hyperscript-powered]").forEach(Ne),j(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),Nt(e)}}z.process=pe;function ts(e){try{let t=An(e);return t.kind==="features"?{...t.program,errors:[]}:{...t.kind==="commands"?t.commands[0]:t.expression,errors:[]}}catch(t){if(t instanceof se)return{errors:[t]};throw t}}var Te=Object.assign(Rn,{config:Object.assign(K,{conversions:Object.assign(ve,{dynamicResolvers:qe})}),use(e){e(Te)},addBeforeProcessHook:e=>void qn.push(e),addAfterProcessHook:e=>void _n.push(e),addSourceTransform:e=>void Fn.push(e),register:$t,extensions:new Set,evaluate:Rn,parse:ts,process:pe,processNode:pe,cleanup:Ne,internals:{runtime:{cleanup:Ne,processNode:pe}},version:"7.6.0"});function jn(){if(Object.assign(globalThis,{_hyperscript:Te}),typeof document>"u")return;let e=()=>{pe(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),Tn(Te)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function Dn(e){e.unaries.push(t=>{let n=1;for(;t.tok(n).type==="IDENTIFIER"&&t.tok(n+1).op&&t.tok(n+1).value===".";)n+=2;let r=t.tok(n+1);if(!t.peek("new")||t.tok(n).type!=="IDENTIFIER"||!r.op||r.value!=="(")return;let o=t.pos();t.consume();let s=[t.consume().value];for(;t.matchOp(".");)s.push(t.consume().value);t.reqOp("(");let i=[];if(!t.matchOp(")")){do i.push(h(t));while(t.matchOp(","));t.reqOp(")")}return{type:"newExpression",path:s,args:i,start:o,end:t.endPos(),ev:a=>N(i.map(u=>u.ev(a)),u=>{let l=s.slice(1).reduce((m,f)=>w(m,f),de(s[0],a));if(!G(l))throw new Error(`'${s.join(".")}' is not a constructor`);return Reflect.construct(l,u)})}})}function ns(e,t){let n=e instanceof HTMLElement&&e.tagName==="SUMMARY"?e.parentElement:e;if(n instanceof HTMLDialogElement)n.open?n.close():t?n.showModal():n.show();else if(n instanceof HTMLDetailsElement)n.open=!n.open;else if(n instanceof HTMLSelectElement){if(document.activeElement===n)return n.blur();n.focus();try{n.showPicker()}catch{}}else if(n instanceof HTMLElement&&n.hasAttribute("popover"))n.togglePopover();else throw new Error("toggle needs a dialog, details, select or popover element")}function Hn(e){(e.fallbacks.toggle??=[]).push((t,n,r)=>{t.matchAny("the","my");let o=t.withFollow(["between","as"],()=>W(t));if(t.peek("between"))return;let s=t.match("as")?!!t.req("modal"):!!t.match("modal"),i=t.text(o);return{type:"toggleElementCommand",target:o,modal:s,start:r,end:t.endPos(),run:a=>E(o.ev(a),u=>{M(u,i),O(u,l=>ns(l,s))})}})}var Gn=(e,t,n)=>new Promise(r=>{let o=!1;e.addEventListener("transitionstart",()=>o=!0,{once:!0}),e.addEventListener("transitionend",()=>r(),{once:!0}),setTimeout(()=>o||r(),t),n?.()});function $n(e){e.commands.settle=(t,n,r)=>{let o=t.commandBoundary(t.cur())?U(t):h(t),s=t.text(o);return{type:"settleCommand",target:o,start:r,end:t.endPos(),run:c=>E(o.ev(c),a=>{M(a,s);let u=x(a)?[a]:Y(a)?Array.from(a).filter(x):[];return Promise.all(u.map(l=>Gn(l,500))).then(()=>{})})}}}function Wn(e){e.commands.transition=(t,n,r)=>{let o=[],s=[],i=[];do o.push(t.withFollow(["from","to"],()=>h(t))),s.push(t.match("from")?h(t):void 0),t.req("to"),i.push(t.match("initial")?"initial":h(t));while(!t.commandBoundary(t.cur())&&t.cur().value!=="over"&&t.cur().value!=="using");let c=t.match("over")?h(t):void 0,a=!c&&t.match("using")?h(t):void 0,u=o[0].root,l=u?t.text(u):"",m=(p,d)=>o.forEach((y,g)=>{d[g]!=null&&E(y.lhs?.(p),v=>y.put?.(p,v,d[g]))});return{type:"transitionCommand",properties:o,from:s,to:i,over:c,using:a,start:r,end:t.endPos(),run:p=>N([u?u.ev(p):p.me,c?.ev(p),a?.ev(p),N(s.map(d=>d?.ev(p)),d=>d),N(i.map(d=>d==="initial"?void 0:d.ev(p)),d=>d)],([d,y,g,v,C])=>{u&&M(d,l);let S=[];return O(d,R=>{if(!(R instanceof HTMLElement))return;let I=R.style.transition;R.style.transition=y?`all ${y}ms ease-in`:g?String(g):K.defaultTransition;let A=V(R).transitionInitials??={};o.forEach((q,b)=>{b in A||(A[b]=q.ev(p))}),Array.isArray(v)&&m(p,v);let F=i.map((q,b)=>q==="initial"?A[b]:w(C,String(b)));S.push(Gn(R,100,()=>setTimeout(()=>m(p,F),0)).then(()=>{R.style.transition=I}))}),Promise.all(S).then(()=>{})})}}}function Bn(e){e.commands.start=(t,n,r)=>{t.match("a"),t.req("view"),t.req("transition"),t.match("using");let o=t.matchType("STRING")?.value,s=D(t);t.hasMore()&&t.req("end");let i=!1;return{type:"viewTransitionCommand",body:s,transitionType:o,start:r,end:t.endPos(),run:a=>{if(!document.startViewTransition)return _(s,a);if(i)throw new Error("A view transition is already in progress");i=!0;let u=()=>{},l=new Promise(d=>u=d),m=()=>l,f=o?document.startViewTransition({update:m,types:[o]}):document.startViewTransition(m),p=d=>(i=!1,u(),d?(console.warn("hyperscript: view transition skipped due to early exit (return, halt, or break)"),f.finished.catch(()=>{}),f.skipTransition(),d):f.finished.then(()=>{}));return new Promise(d=>setTimeout(d,0)).then(()=>_(s,a)).then(d=>p(re(d)))}}}}function Un(e){e.commands.if=(t,n,r)=>{let o=h(t);t.match("then");let s=D(t),i,c=!1,a=t.match("else")??t.match("otherwise");if(a)if(c=t.peek("if")?.line===a.line,c){let l=pt(t);i=l?[l]:[]}else i=D(t);return t.hasMore()&&!c&&t.req("end"),{type:"ifCommand",condition:o,trueBranch:s,falseBranch:i,start:r,end:t.endPos(),run:l=>E(o.ev(l),m=>m?_(s,l):i&&_(i,l))}}}var Vn={k:"return",value:null};function zn(e){e.commands.halt=(t,n,r)=>{let o=!1;t.match("the")&&(t.req("event"),t.matchOp("'")&&t.req("s"),o=!0);let s=!!t.match("bubbling"),i=!s&&!!t.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:s,haltDefault:i,start:r,end:t.endPos(),run:a=>{let u=a.event;if(u instanceof Event&&(i||u.stopPropagation(),s||u.preventDefault()),!o)return Vn}}}}function Qn(e){e.commands.return=(t,n,r)=>{let o=t.commandBoundary(t.cur())?void 0:h(t);return{type:"returnCommand",value:o,start:r,end:t.endPos(),run:i=>E(o?o.ev(i):null,c=>(i.meta.returned=!0,i.meta.returnValue=c,{k:"return",value:c}))}},e.commands.exit=(t,n,r)=>({type:"exitCommand",start:r,end:t.endPos(),run:()=>Vn})}function Jn(e){e.commands.throw=(t,n,r)=>{let o=h(t);return{type:"throwCommand",value:o,start:r,end:t.endPos(),run:i=>E(o.ev(i),c=>{throw c})}}}function Xn(e){let t=te(e);if(!t)return;let n=[t];for(let r=te(e);r;r=te(e))n.push(r);return n}var Wt=(e,t)=>(e??[]).map(n=>E(n.ev(t),r=>String(w(r,"className")))),rs=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),Bt=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,Yn=(e,t,n,r,o)=>t?ct(e,t,n,s=>x(s)&&r(s),s=>x(s)&&o(s)):O(e,s=>x(s)&&r(s)),Ve=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),Zn=(e,t,n,r,o,s)=>s?Yn(t,n,r,i=>Ve(i,s,e),i=>Ve(i,s,!e)):N(o.map(i=>Yn(t,n,r,c=>c.classList.toggle(String(i),e),c=>c.classList.toggle(String(i),!e))),()=>{});function er(e){let t=Xn(e),n=t?void 0:X(e);return{refs:t,attribute:n,css:t||n?void 0:kn(e)}}function tr(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:s,css:i}=er(t),c;!o&&!s&&!i&&(c=t.withFollow(["to"],()=>h(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?h(t):U(t),u=t.match("when")?h(t):void 0,l=o||s?u:void 0,m=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:s,css:i,value:c,to:a,when:l,start:r,end:t.endPos(),run:p=>N([a.ev(p),i?.ev(p),c?.ev(p),...Wt(o,p)],([d,y,g,...v])=>{if(M(d,m),c){if(Array.isArray(d))d.push(g);else if(d instanceof Set)d.add(g);else throw d instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof d);P.wroteProperty(d)}else if(i)O(d,C=>{let S=Bt(C);S&&(S.cssText+=y)});else return Zn(!0,d,l,p,v,s)})}}}var os=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function nr(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:s,css:i}=er(t),c=o||s||i?void 0:h(t),a=t.match("from")?h(t):c?void 0:U(t),u;t.match("when")&&(c&&t.err("'when' clause is not supported when removing elements"),u=h(t));let l=a?t.text(a):"",m=c?t.text(c):"",f=(d,y,g)=>{if(g==null&&c?.del&&c.lhs&&!os(y)){let v=c;return E(c.lhs(d),C=>v.del?.(d,C))}if(M(y,m),Array.isArray(g)){let v=g.indexOf(y);v>-1&&g.splice(v,1),P.wroteProperty(g)}else g instanceof Set||g instanceof Map?(g.delete(y),P.wroteProperty(g)):O(y,v=>{x(v)&&v.parentElement&&(g==null||g instanceof Node&&g.contains(v))&&v.parentElement.removeChild(v)})};return{type:"removeCommand",classRefs:o,attributeRef:s,css:i,element:c,from:a,when:u,start:r,end:t.endPos(),run:d=>N([a?.ev(d),i?.ev(d),c?.ev(d),...Wt(o,d)],([y,g,v,...C])=>{if(c)return f(d,v,y);if(M(y,l),i){let S=rs(String(g));O(y,R=>S.forEach(I=>Bt(R)?.removeProperty(I)))}else return Zn(!1,y,u,d,C,s)})}}}var Kn=(e,t,n)=>(r,o,s)=>{s?o.style[e]=s:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},rr={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=V(t);n?t.style.display=n:e==="toggle"?rr.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:Kn("visibility","hidden","visible"),opacity:Kn("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function Ut(e,t){let n=t??K.defaultHideShowStrategy??"display";return K.hideShowStrategies[n]??rr[n]??e.err("Unknown show/hide strategy : "+n)}function or(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},s;if(t.cur().type==="STYLE_REF"){let y=o.styleProp=t.consume().value.slice(1);s=Ut(t,y),o.on=t.match("of")?t.withFollow(["with","between"],()=>h(t)):U(t)}else if(t.match("between")){let y=te(t);if(y)t.req("and"),o.between=[y,te(t)??t.err("Expected classRef")];else{let g=X(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[g,X(t)??t.err("Expected attributeRef")]}}else!(o.classRefs=Xn(t))&&!(o.attributeRef=X(t))&&(o.target=t.withFollow(["between"],()=>ce(t)));if(!o.styleProp&&!o.target&&(o.on=t.match("on")?h(t):U(t)),t.match("between")){let y=o.betweenValues=t.withFollow(["and"],()=>{let g=[h(t)];for(;t.matchOp(",");)g.push(h(t));return g});t.req("and"),y.push(h(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=h(t)):t.match("until")&&(o.until=ue(t),t.match("from")&&(o.from=h(t))),o.end=t.endPos();let{on:i,target:c,betweenValues:a,between:u,attributeRef:l,styleProp:m}=o,f=i?t.text(i):"",p=(y,g)=>y[(y.findIndex(v=>v==g)+1)%y.length],d=(y,g,v,C)=>{if(a&&c?.lhs&&c.put){let S=c;return N([c.ev(y),c.lhs(y)],([R,I])=>S.put?.(y,I,p(v,R)))}if(a&&m)return O(g,S=>{let R=Bt(S);if(!R||!x(S))return;let I=R.getPropertyValue(m)||getComputedStyle(S).getPropertyValue(m);R.setProperty(m,String(p(v,I)))});M(g,f),O(g,S=>{if(x(S))if(s)S instanceof HTMLElement&&s("toggle",S);else if(u){let[R,I]=u;if(R.type==="classRef"&&I.type==="classRef"){let[A,F]=[String(R.className),String(I.className)],q=S.classList.contains(A);S.classList.toggle(A,!q),S.classList.toggle(F,q)}else if(R.type==="attributeRef"&&I.type==="attributeRef"){let A=S.getAttribute(R.name)===String(R.value);Ve(S,A?R:I,!1),Ve(S,A?I:R,!0)}}else l?Ve(S,l,!S.hasAttribute(l.name)):C.forEach(R=>S.classList.toggle(String(R)))})};return o.run=y=>N([i?.ev(y),o.time?.ev(y),o.from?.ev(y),N((a??[]).map(g=>g.ev(y)),g=>g),...Wt(o.classRefs,y)],([g,v,C,S,...R])=>{let I=()=>d(y,g,Array.isArray(S)?S:[],R);if(o.time)return new Promise(A=>{I(),setTimeout(()=>{I(),A()},T(v))});if(o.until){let A=o.until,F=C||y.me;return new Promise(q=>{Q(F)&&F.addEventListener(A,()=>{I(),q()},{once:!0}),I()})}return E(I(),()=>{})}),o}}function ar(e){for(let t of["hide","show"])e.commands[t]=(n,r,o)=>{let s=n.cur(),i=s.value==="when"||s.value==="with"||n.commandBoundary(s)?U(n):h(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(d=>d.value).join(""));let u=n.match("when")?h(n):void 0,l=Ut(n,c),m=n.text(i),f=d=>y=>{y instanceof HTMLElement&&l(d,y,d==="show"?a:void 0)};return{type:`${t}Command`,target:i,strategy:c,arg:a,when:u,start:o,end:n.endPos(),run:d=>E(i.ev(d),y=>{if(M(y,m),u)return ct(y,u,d,f(t),f(t==="hide"?"show":"hide"));O(y,f(t))})}}}function cr(e){e.commands.take=(t,n,r)=>{let o=[];for(let v=te(t);v;v=te(t))o.push(v);let s=o.length>0,i=s?void 0:X(t)??t.err("Expected either a class reference or attribute expression"),c,a,u=v=>(o.length>1&&t.err(`\`${v}\` cannot be combined with multiple class refs`),te(t)??t.err("Expected classRef"));t.match("with")&&(s?c=u("with"):a=h(t));let l;t.match("from")&&(l=h(t),t.match("giving")&&((c||a)&&t.err("`giving` cannot be combined with `with`"),s?c=u("giving"):a=h(t)));let m=t.match("for")?h(t):U(t),f=t.text(m),p=l?t.text(l):"",d=c?.className,y=(v,C)=>O(v,S=>x(S)&&C(S));return{type:"takeCommand",classRefs:o,attributeRef:i,from:l,for:m,replacementClass:c,replacementValue:a,start:r,end:t.endPos(),run:v=>N([l?.ev(v),m.ev(v),a?.ev(v),...o.map(C=>C.ev(v))],([C,S,R,...I])=>{if(M(S,f),i){M(C,p),y(C,A=>R?A.setAttribute(i.name,String(R)):A.removeAttribute(i.name)),y(S,A=>A.setAttribute(i.name,i.value||""));return}o.forEach((A,F)=>{let q=String(A.className);y(l?C:I[F],b=>{b.classList.remove(q),d&&b.classList.add(d)}),y(S,b=>{b.classList.add(q),d&&b.classList.remove(d)})})})}}}var ss="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function ur(e){e.commands.measure=(t,n,r)=>{let o=U(t),s=[];if(!t.commandBoundary(t.cur())){let a=h(t);a.type==="symbol"&&a.name&&ss.includes(a.name)?s.push(a.name):a.type==="possessive"&&a.prop&&a.root?(o=a.root,s.push(a.prop)):a.type==="ofExpression"&&a.name&&a.root?(o=a.root,s.push(a.name)):o=a}for(;t.matchOp(",");)s.push(t.reqType("IDENTIFIER").value);let i=t.text(o);return{type:"measureCommand",target:o,properties:s,start:r,end:t.endPos(),run:a=>E(o.ev(a),u=>{M(u,i);let l=x(u)?u:Y(u)?Array.from(u).find(x):void 0;if(!l)throw new Error(`'${i}' is not an element`);let m=l.getBoundingClientRect(),f={top:l.scrollTop,left:l.scrollLeft,topMax:w(l,"scrollTopMax"),leftMax:w(l,"scrollLeftMax"),height:l.scrollHeight,width:l.scrollWidth},{x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R}=m,I={x:p,y:d,left:y,top:g,right:v,bottom:C,width:S,height:R,bounds:m,scrollLeft:f.left,scrollTop:f.top,scrollLeftMax:f.leftMax,scrollTopMax:f.topMax,scrollWidth:f.width,scrollHeight:f.height,scroll:f};a.result=I;for(let A of s){if(!(A in I))throw new Error("No such measurement as "+A);a.locals[A]=I[A]}})}}}function ze(e,t,n){for(let r of t)e.commands[r]=(o,s,i)=>{let c=o.commandBoundary(o.cur())?void 0:h(o);return{type:`${t[0]}Command`,target:c,start:i,end:o.endPos(),run:u=>E(c?.ev(u),l=>E(n(l||u.me),()=>{}))}}}var gt=e=>t=>{let n=w(t,e);G(n)&&Reflect.apply(n,t,[])},sr=e=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement,lr=e=>e instanceof HTMLInputElement&&(e.type==="checkbox"||e.type==="radio"),ir=(e,t)=>{if(sr(e))t(e);else if(e instanceof HTMLFormElement)e.querySelectorAll("input, textarea, select").forEach(n=>sr(n)&&t(n));else return!1;return!0},is=e=>{e instanceof HTMLSelectElement?e.selectedIndex=-1:lr(e)?e.checked=!1:e.value=""},as=e=>{if(e instanceof HTMLSelectElement)for(let t of e.options)t.selected=t.defaultSelected;else lr(e)?e.checked=e.defaultChecked:e.value=e.defaultValue},cs=e=>t=>O(t,n=>{n instanceof HTMLDialogElement?e?n.open||n.showModal():n.close():n instanceof HTMLDetailsElement?n.open=e:n instanceof HTMLElement&&n.hasAttribute("popover")?n[e?"showPopover":"hidePopover"]():gt(e?"open":"close")(n)});function dr(e){ze(e,["focus"],gt("focus")),ze(e,["blur"],gt("blur")),ze(e,["select"],gt("select")),ze(e,["empty","clear"],t=>{Array.isArray(t)||t instanceof Set||t instanceof Map?(Array.isArray(t)?t.splice(0):t.clear(),P.wroteProperty(t)):O(t,n=>ir(n,is)||x(n)&&n.replaceChildren())}),ze(e,["reset"],t=>O(t,n=>n instanceof HTMLFormElement?n.reset():ir(n,as)))}function fr(e){for(let t of[!0,!1]){let n=t?"open":"close";e.commands[n]=(r,o,s)=>{let i=!!r.match("fullscreen"),c=r.commandBoundary(r.cur())?void 0:h(r);return{type:`${n}Command`,target:c,start:s,end:r.endPos(),run:u=>E(c?.ev(u),l=>i?t?(x(l)?l:document.documentElement).requestFullscreen():document.exitFullscreen():cs(t)(l||u.me))}}}}function mr(e){e.commands.make=(t,n,r)=>{t.match("a")||t.match("an");let o=h(t),s=[],i=o.type==="queryRef"?o.css:void 0;if(i===void 0&&t.match("from"))do s.push(h(t));while(t.matchOp(","));let c=t.match("called")?qt(t)??t.err("Expected symbol"):void 0,a=()=>{let l="div",m={classes:[]};for(let[,p,d]of(i??"").matchAll(/(^|#|\.)([^#. ]+)/g))p===""?l=d.trim():p==="#"?m.id=d.trim():m.classes.push(d.trim());let f=document.createElement(l);return m.id!==void 0&&(f.id=m.id),f.classList.add(...m.classes),f};return{type:"makeCommand",value:o,args:s,called:c,start:r,end:t.endPos(),run:l=>N([i===void 0?o.ev(l):void 0,...s.map(m=>m.ev(l))],([m,...f])=>{l.result=i===void 0?Reflect.construct(G(m)?m:Object,f):a(),c?.put?.(l,void 0,l.result)})}}}function pr(e){e.commands.append=(t,n,r)=>{let o=h(t),s=t.match("to")?He(h(t)):void 0;return{type:"appendCommand",value:o,target:s,start:r,end:t.endPos(),run:c=>N([s?s.ev(c):de("result",c),o.ev(c),s?.lhs?.(c)],([a,u,l])=>{if(Array.isArray(a)||a instanceof Set)Array.isArray(a)?a.push(u):a.add(u),P.wroteProperty(a);else if(x(a))x(u)?a.insertAdjacentElement("beforeend",u):a.insertAdjacentHTML("beforeend",String(u)),z.process(a);else{let m=T(a||"")+T(u);if(!s)it("result",c,void 0,m);else if(s.put)s.put(c,l,m);else throw new Error("Unable to append a value!")}})}}}function hr(e){e.commands.swap=(t,n,r)=>{let o=t.withFollow(["with"],()=>ce(t));t.req("with");let s=ce(t);return{type:"swapCommand",first:o,second:s,start:r,end:t.endPos(),run:c=>N([o.ev(c),s.ev(c),o.lhs?.(c),s.lhs?.(c)],([a,u,l,m])=>{if(x(a)&&x(u)){let f=document.createComment("");a.replaceWith(f),u.replaceWith(a),f.replaceWith(u)}else o.put?.(c,l,u),s.put?.(c,m,a)})}}}function yr(e){e.commands.send=e.commands.trigger=(t,n,r)=>{let o=ue(t),s=dt(t),i=t.match(n==="trigger"?"on":"to")?h(t):U(t),c=t.text(i);return{type:"sendCommand",event:o,details:s,to:i,start:r,end:t.endPos(),run:u=>N([i.ev(u),s?.ev(u)],([l,m])=>{M(l,c),O(l,f=>j(f,o,B(m)?m:{},u.me))})}}}function gr(e){e.commands.wait=(t,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(t.match("for")){t.match("a");let s=o.events=[];do{let a=t.cur();a.type==="NUMBER"||a.op&&a.value==="("?s.push(h(t)):s.push({event:ue(t),args:yt(t)})}while(t.match("or"));let i=o.from=t.match("from")?h(t):void 0,c=i?t.text(i):"me";o.run=a=>E(i?i.ev(a):a.me,u=>{if(!Q(u))throw new Error("Not a valid event target: "+c);return new Promise(l=>{for(let m of s)"event"in m?u.addEventListener(m.event,f=>{a.result=f;for(let p of m.args)a.locals[p]=w(f,p)||w(w(f,"detail"),p)||null;l()},{once:!0}):E(m.ev(a),f=>setTimeout(()=>{a.result=f,l()},T(f)))})})}else{let s;t.match("a")?t.req("tick"):s=o.time=h(t),o.run=i=>E(s?.ev(i),c=>new Promise(a=>setTimeout(a,s?T(c):0)))}return o.end=t.endPos(),o}}function wr(e){let t=e.pos(),n=e.cur(),r=[],o="",s=!1;for(;e.hasMore();){n=e.consume();let i=e.tok(0,!0);if(i.type==="IDENTIFIER"&&i.value==="end")break;s?n.type==="IDENTIFIER"||n.type==="NUMBER"?o+=n.value:(o&&r.push(o),o="",s=!1):n.type==="IDENTIFIER"&&n.value==="function"&&(s=!0)}return{source:e.src.substring(t,n.end+1),functions:r}}function vr(e){e.commands.js=(t,n,r)=>{let o=[];if(t.matchOp("(")&&!t.matchOp(")")){do o.push(t.reqType("IDENTIFIER").value);while(t.matchOp(","));t.reqOp(")")}let{source:s}=wr(t);t.match("end");let i=new Function(...o,s);return{type:"jsCommand",source:s,inputs:o,start:r,end:t.endPos(),run:a=>E(Reflect.apply(i,globalThis,o.map(u=>de(u,a))),u=>{a.result=u})}},e.features.js=(t,n)=>{let{source:r,functions:o}=wr(t),s=new Function(`${r}
|
|
18
|
+
return { ${o.map(c=>`${c}:${c}`).join(",")} } `);return{type:"jsFeature",source:r,functions:o,start:n,end:t.endPos(),install:()=>void Object.assign(globalThis,s())}}}function Er(e){for(;;){let t=e();if(J(t))return t.then(n=>n??Er(e));if(t)return t}}var us=e=>{if(e){if(B(e)&&Symbol.asyncIterator in Object(e)){let t=Reflect.get(Object(e),Symbol.asyncIterator);return typeof t=="function"?Reflect.apply(t,e,[]):void 0}return(Y(e)?e:Object.keys(Object(e)))[Symbol.iterator]()}};function br(e){e.commands.repeat=e.commands.for=(t,n,r)=>{let o={type:"repeatCommand",until:!1,bottomTested:!1,forever:!1,body:[],start:r,end:r,run:()=>{}};if(n==="for"||t.match("for")){let v=o.identifier=t.reqType("IDENTIFIER").value;t.req("in"),o.expression=h(t);for(let C=o.expression;C;C=C.root)C.type==="collectionExpression"&&(C.varName=v)}else t.match("in")?(o.identifier="it",o.expression=h(t)):t.match("while")?o.condition=h(t):t.match("until")?(o.until=!0,t.match("event")?(o.event=ue(t),t.match("from")&&(o.from=h(t))):o.condition=h(t)):!t.commandBoundary(t.cur())&&t.cur().value!=="forever"?(o.times=h(t),t.req("times")):(t.match("forever"),o.forever=!0);t.match("index")?o.indexIdentifier=t.reqType("IDENTIFIER").value:t.match("indexed")&&(t.req("by"),o.indexIdentifier=t.reqType("IDENTIFIER").value);let s=o.body=D(t);if(o.forever&&t.hasMore()){let v=t.match("until")??t.match("while");v&&(o.forever=!1,o.bottomTested=!0,o.until=v.value==="until",o.condition=h(t))}t.match("else")&&(o.elseBranch=D(t)),t.hasMore()&&t.req("end"),o.end=t.endPos();let{identifier:i,indexIdentifier:c,expression:a,times:u,condition:l,until:m,bottomTested:f,forever:p,event:d,from:y,elseBranch:g}=o;return o.run=v=>N([a?.ev(v),y?.ev(v)],([C,S])=>{let R=us(C)??(g?[][Symbol.iterator]():void 0),I=0,A=!1,F=!1;if(d){let L=S||v.me;Q(L)&&L.addEventListener(d,()=>F=!0,{once:!0})}let q=()=>!A&&g?E(_(g,v),L=>({signal:re(L)})):{signal:void 0},b=L=>{let H=I++;A=!0,C&&i?v.result=v.locals[i]=L:v.result=H,c&&(v.locals[c]=H);let Z=v.meta.template;if(Z&&C){let ye=`${i}_${r}`;Z.loops[ye]??={identifier:i,indexIdentifier:c,source:C},Z.out.push(`<!--hs-scope:${ye}:${H}-->`)}return E(_(s,v),ye=>{let cn=w(ye,"k");if(cn==="break")return{signal:void 0};if(cn==="return")return{signal:re(ye)};if(d)return new Promise(vo=>setTimeout(vo,0))})};return E(Er(()=>N([l?.ev(v),u?.ev(v)],([L,H])=>f&&I===0||p?b(void 0):m?(d?!F:L!==!0)?b(void 0):q():l?L?b(void 0):q():H?I<T(H)?b(void 0):q():R?E(R.next(),Z=>w(Z,"done")?q():b(w(Z,"value"))):q())),L=>re(w(L,"signal")))}),o}}function xr(e){for(let t of["break","continue"]){let n={k:t};e.commands[t]=(r,o,s)=>({type:`${t}Command`,start:s,end:r.endPos(),run:()=>n})}}function kr(e){e.commands.tell=(t,n,r)=>{let o=h(t),s=D(t);t.hasMore()&&!t.featureStart(t.cur())&&t.req("end");let i=(a,u,l)=>{for(;l<u.length;l++){a.you=u[l];let m=_(s,a);if(J(m))return m.then(f=>re(f)??i(a,u,l+1));if(m)return m}};return{type:"tellCommand",value:o,body:s,start:r,end:t.endPos(),run:a=>E(o.ev(a),u=>{let l=u==null?[]:Array.isArray(u)?u:u instanceof NodeList?Array.from(u):[u],m=a.you;return E(i(a,l,0),f=>(a.you=m,re(f)))})}}}function zt(e,t){let n;if(typeof t=="string"){let u=document.createElement("template");u.innerHTML=t,n=u.content}else if(t instanceof DocumentFragment)n=t;else if(t instanceof Element)n=document.createDocumentFragment(),n.append(t.cloneNode(!0));else throw new Error("morph requires an HTML string, element, or document fragment");let r=n.firstElementChild;r&&!r.nextElementSibling&&r.tagName===e.tagName&&(Rr(e,r),n=r);let o=[...e.matches("[id]")?[e]:[],...e.querySelectorAll("[id]")],s=[...n.querySelectorAll("[id]")],i=fs(o,s),c=new Map;Cr(c,i,e.parentElement,o),Cr(c,i,n,s);let a=document.createElement("div");a.hidden=!0,(document.body??e.parentElement)?.after(a),Sr({target:e,ids:c,persistent:i,pantry:a,futureMatches:new WeakSet},e,n),Ne(a),a.remove()}function Sr(e,t,n){t instanceof HTMLTemplateElement&&n instanceof HTMLTemplateElement&&(t=t.content,n=n.content);let r=t.firstChild,o=n.firstChild;for(;o;){let s=o,i=r&&ls(e,s,r);if(i&&i!==r)for(let c=r;c&&c!==i;){let a=c;c=c.nextSibling,a instanceof Element&&(e.ids.has(a)||Pr(e,a,s))?Vt(t,a,null):Tr(e,a)}if(!i&&s instanceof Element&&e.persistent.has(s.id)){let c=`[id="${CSS.escape(s.id)}"]`,a=e.target.id===s.id?e.target:e.target.querySelector(c)??e.pantry.querySelector(c);if(a){for(let u=a.parentNode;u;u=u.parentNode){let l=e.ids.get(u);l?.delete(a.id),l?.size===0&&e.ids.delete(u)}Vt(t,a,r),i=a}}if(o=s.nextSibling,i&&s instanceof Element)Nr(e,i,s),r=i.nextSibling;else if(s instanceof Element&&e.ids.has(s)){let c=document.createElement(s.tagName);t.insertBefore(c,r),Nr(e,c,s),r=c.nextSibling}else t.insertBefore(s,r),s instanceof Element&&pe(s),r=s.nextSibling}for(;r;){let s=r;r=r.nextSibling,Tr(e,s)}}function Nr(e,t,n){t instanceof Element&&(Rr(t,n),t instanceof HTMLTextAreaElement&&n instanceof HTMLTextAreaElement&&t.defaultValue!==n.defaultValue&&(t.value=n.value),(!t.isEqualNode(n)||n.tagName==="TEMPLATE"||n.querySelector("template"))&&Sr(e,t,n),pe(t))}function ls(e,t,n){if(!(t instanceof Element))return null;let r=e.ids.get(t),o=r?.size??0;if(t.id&&!r)return null;let s=null,i=0,c=10;for(let a=n;a;a=a.nextSibling){let u=e.ids.get(a);if(ds(a,t)){if(u&&r&&[...u].some(l=>r.has(l)))return a;if(!u){if(c>0&&a.isEqualNode(t))return a;s??=a}}if(i+=u?.size??0,i>o||a.contains(document.activeElement)||--c<1&&o===0)break}return s&&Pr(e,s,t)?null:s}function Pr(e,t,n){if(e.futureMatches.has(t))return!0;let r=n.nextSibling;for(let o=0;r&&o<10;r=r.nextSibling,o++)if(r instanceof Element&&t.isEqualNode(r))return e.futureMatches.add(t),!0;return!1}function Tr(e,t){e.ids.has(t)?Vt(e.pantry,t,null):(t instanceof Element&&Ne(t),t.remove())}function Vt(e,t,n){let r=w(e,"moveBefore");if(G(r))try{Reflect.apply(r,e,[t,n]);return}catch{}e.insertBefore(t,n)}function Rr(e,t){for(let{name:n,value:r}of t.attributes)e.getAttribute(n)!==r&&(e.setAttribute(n,r),n==="value"&&e instanceof HTMLInputElement&&e.type!=="file"&&(e.value=r));for(let{name:n}of[...e.attributes])t.hasAttribute(n)||e.removeAttribute(n)}function ds(e,t){return!(e instanceof Element)||e.tagName!==t.tagName||e.tagName==="SCRIPT"&&!e.isEqualNode(t)?!1:!e.id||e.id===t.id}function fs(e,t){let n=new Set,r=new Map;for(let{id:s,tagName:i}of e)r.has(s)?n.add(s):s&&r.set(s,i);let o=new Set;for(let{id:s,tagName:i}of t)o.has(s)?n.add(s):r.get(s)===i&&o.add(s);for(let s of n)o.delete(s);return o}function Cr(e,t,n,r){for(let o of r)if(t.has(o.id))for(let s=o;s&&s!==n;s=s.parentElement){let i=e.get(s);i||e.set(s,i=new Set),i.add(o.id)}}function Ir(e){e.commands.morph=(t,n,r)=>{let o=h(t);t.req("to");let s=h(t);return{type:"morphCommand",target:o,content:s,start:r,end:t.endPos(),run:c=>N([o.ev(c),s.ev(c)],([a,u])=>{O(a,l=>{l instanceof Element&&zt(l,u)})})}}}function Or(e){e.commands.log=(t,n,r)=>{let o=[h(t)];for(;t.matchOp(",");)o.push(h(t));let s=t.match("with")?h(t):void 0;return{type:"logCommand",values:o,logger:s,start:r,end:t.endPos(),run:c=>N([s?.ev(c),...o.map(a=>a.ev(c))],([a,...u])=>{G(a)?a(...u):console.log(...u)})}}}function Ar(e){e.commands.get=e.commands.call=(t,n,r)=>{let o=h(t);return n==="call"&&o.type!=="functionCall"&&t.err("Must be a function invocation"),{type:"getCommand",value:o,start:r,end:t.endPos(),run:i=>E(o.ev(i),c=>{i.result=c})}}}function Lr(e){e.pseudo=(t,n)=>{let r=t.tok(1);if(!(r.op&&(r.value==="."||r.value==="(")))return;let o=lt(t);o.type!=="functionCall"&&t.err("Pseudo-commands must be function calls");let s=o.root,i="args"in o&&Array.isArray(o.args)?o.args:[],c;s&&!s.root&&(t.matchAny("the","to","on","with","into","from","at")?c=h(t):t.match("me")&&(c=U(t)));let a=s?.name??"",u=c?t.text(c):"",l=t.text(o),m=c;return{type:"pseudoCommand",value:o,target:c,start:n,end:t.endPos(),run:p=>m?N([m.ev(p),...i.map(d=>d.ev(p))],([d,...y])=>{M(d,u),p.result=ut(w(d,a),d,y,p,l),Xe(d,a)}):E(o.ev(p),d=>{p.result=d})}}}function Mr(e){e.commands.ask=(t,n,r)=>{let o=h(t);return{type:"askCommand",message:o,start:r,end:t.endPos(),run:i=>E(o.ev(i),c=>{i.result=prompt(String(c))})}},e.commands.answer=(t,n,r)=>{let o=h(t),s;if(t.match("with")){let c=t.withFollow(["or"],()=>h(t));t.req("or"),s=[c,h(t)]}return{type:"answerCommand",message:o,choices:s,start:r,end:t.endPos(),run:c=>N([o.ev(c),s?.[0].ev(c),s?.[1].ev(c)],([a,u,l])=>{s?c.result=confirm(String(a))?u:l:alert(String(a))})}}}function Fr(e){e.commands.breakpoint=(t,n,r)=>({type:"breakpointCommand",start:r,end:t.endPos(),run:()=>{debugger}})}var Qt=(e,t,n)=>{let r=w(e,"slice");return G(r)?Reflect.apply(r,e,[t,n]):void 0},ms=(e,t,n)=>({*[Symbol.iterator](){let r=new RegExp(e instanceof RegExp?e:String(e),t);for(let o=r.exec(n);o;o=r.exec(n))o[0].length===0&&r.lastIndex++,yield o}});function qr(e){e.commands.pick=(t,n,r)=>{t.match("the");let o=t.matchAny("first","last","random","match","matches")??t.matchAny("item","items","character","characters");if(!o)return;let s=o.value==="first"||o.value==="last"||o.value==="random"||o.value==="match"||o.value==="matches"?o.value:"range",i={};(s==="match"||s==="matches")&&t.match("of"),t.withFollow(["of","from"],()=>{if(s==="first"||s==="last")i.count=h(t);else if(s==="random")t.cur().type==="NUMBER"&&(i.count=h(t));else if(s==="range")t.match("at")||t.match("from"),t.match("start")||(i.from=h(t)),(t.match("to")||t.matchOp(".."))&&(t.match("end")?i.toEnd=!0:i.to=h(t)),t.match("inclusive")?i.bounds="inclusive":t.match("exclusive")&&(i.bounds="exclusive");else{i.re=h(t);let g=t.matchOp("|")?t.reqType("IDENTIFIER").value:void 0;i.flags=s==="match"?g??"":g===void 0?"gu":"g"+g.replace("g","")}}),t.matchAny("of","from")||t.expected("of","from");let c=h(t),{count:a,from:u,to:l,toEnd:m,bounds:f,re:p,flags:d=""}=i;return{type:"pickCommand",variant:s,root:c,...i,start:r,end:t.endPos(),run:g=>N([c.ev(g),a?.ev(g),u?.ev(g),l?.ev(g),p?.ev(g)],([v,C,S,R,I])=>{if(v==null)g.result=v;else if(s==="first")g.result=Qt(v,0,T(C));else if(s==="last")g.result=Qt(v,-T(C));else if(s==="random"){let A=Y(v)?Array.from(v):[],F=()=>A.splice(Math.floor(Math.random()*A.length),1)[0];g.result=C==null?F():Array.from({length:Math.min(T(C),A.length)},F)}else if(s==="range"){let A=T(S??0)+(f==="exclusive"?1:0),F=m?T(w(v,"length")):R==null?void 0:T(R),q=F===void 0?A+1:F+(f==="inclusive"?1:0);g.result=Qt(v,A,q)}else s==="match"?g.result=new RegExp(I instanceof RegExp?I:String(I),d).exec(String(v)):g.result=ms(I,d,String(v))})}}}var ps={json:"json",JSON:"json",Object:"json",response:"response",Response:"response",html:"html",HTML:"html",text:"text",Text:"text",String:"text"};function _r(e){e.commands.fetch=(t,n,r)=>{let o=t.withFollow(["as"],()=>Be(t)),s=()=>{if(!t.match("as"))return;t.match("a")||t.match("an");let m=me(t)??t.err("Expected dotOrColonPath");return ps[m]??":"+m},i=s(),c;t.match("with")&&t.cur().value!=="{"?c=$e(t):t.cur().op&&t.cur().value==="{"&&(c=Ge(t)),i??=s()??"text";let a=!1;t.match("do")?(t.req("not"),t.req("throw"),a=!0):t.cur().value==="don"&&t.tok(1,!0).value==="'"&&t.tok(2,!0).value==="t"&&(t.consume(),t.consume(),t.consume(),t.req("throw"),a=!0);let u=i;return{type:"fetchCommand",url:o,options:c,as:u,dontThrow:a,start:r,end:t.endPos(),run:m=>N([o.ev(m),c?.ev(m)],([f,p])=>{let d=m.me,y=B(p)?p:{};y.headers||={},y.conversion=u.startsWith(":")?u.slice(1):u;let g=new AbortController,v=()=>g.abort();Q(d)&&d.addEventListener("fetch:abort",v,{once:!0}),y.signal=g.signal,j(d,"hyperscript:beforeFetch",y,d),j(d,"fetch:beforeRequest",y,d);let C=!1;y.timeout&&setTimeout(()=>C||v(),T(y.timeout));let S=I=>{m.result=I,j(d,"fetch:afterRequest",{result:I}),C=!0},R=Reflect.apply(fetch,globalThis,[f,y]);return Promise.resolve(R).then(I=>{let A={response:I};j(d,"fetch:afterResponse",A);let F=A.response;if(!(F instanceof Response))throw new Error("fetch did not return a Response");if(!a&&u!=="response"&&K.fetchThrowsOn.some(k=>k.test(String(F.status))))throw Object.assign(new Error(`fetch failed: ${F.status} ${F.statusText} (${f})`),{response:F,status:F.status});if(u==="response")return S(F);if(u==="json")return F.json().then(S);let q=u.startsWith(":")?u.slice(1):void 0,b=q?ve[q]:void 0;return b&&w(b,"_rawResponse")?S(b(F)):F.text().then(k=>S(u==="html"?be(k):q?st(k,q):k))}).catch(I=>{throw j(d,"fetch:error",{reason:I}),I}).finally(()=>Q(d)&&d.removeEventListener("fetch:abort",v))})}}}var hs={top:"start",middle:"center",bottom:"end"},ys={left:"start",center:"center",right:"end"},jr=e=>{let t=e.matchAny("smoothly","instantly");return t?t.value==="smoothly"?"smooth":"instant":void 0};function Dr(e){e.match("the");let t=e.matchAny("top","middle","bottom"),n=e.matchAny("left","center","right");(t||n)&&e.req("of");let r=W(e),o=e.matchAnyOp("+","-"),s=o?e.withFollow(["px"],()=>h(e)):void 0;e.match("px");let i=e.match("in")?W(e):void 0,c={block:t?hs[t.value]:"start",inline:n?ys[n.value]:"nearest"},a=jr(e);return a&&(c.behavior=a),{target:r,offset:s,sign:o?.value==="-"?-1:o?1:0,options:c,container:i}}function Hr(e,t){return N([e.target.ev(t),e.offset?.ev(t),e.container?.ev(t)],([n,r,o])=>{let s=e.sign*T(r??0);O(n,i=>{let c=i===window?document.body:i;c instanceof HTMLElement&&(o instanceof HTMLElement?o.scrollTo({top:c.offsetTop-o.offsetTop+s,left:c.offsetLeft-o.offsetLeft,behavior:e.options.behavior??"auto"}):(e.sign?gs(c,s,e.options):c).scrollIntoView(e.options))})})}function gs(e,t,n){let r=e.getBoundingClientRect(),o=i=>i==="start"||i==="end"?t:0,s=document.createElement("div");return Object.assign(s.style,{position:"absolute",top:r.top+window.scrollY+o(n.block)+"px",left:r.left+window.scrollX+o(n.inline)+"px",height:r.height+"px",width:r.width+"px",zIndex:String(Number.MIN_SAFE_INTEGER),opacity:"0"}),document.body.appendChild(s),setTimeout(()=>s.remove(),100),s}function Gr(e){e.commands.scroll=(t,n,r)=>{let o={type:"scrollCommand",start:r,end:r,run:()=>{}};if(t.match("to")){let s=o.to=Dr(t);o.run=i=>Hr(s,i)}else{let s=["up","down","left","right"],i=t.matchAny(...s),c;!i&&t.cur().value!=="by"&&(c=o.target=W(t),i=t.matchAny(...s)),t.req("by");let a=o.by=t.withFollow(["px"],()=>h(t));t.match("px");let u=o.behavior=jr(t),l=o.direction=i?.value??"down";o.run=m=>N([c?.ev(m),a.ev(m)],([f,p])=>{let d=T(p)*(l==="up"||l==="left"?-1:1),y=l==="left"||l==="right",g={top:y?0:d,left:y?d:0};u&&(g.behavior=u),(x(f)?f:document.documentElement).scrollBy(g)})}return o.end=t.endPos(),o}}function $r(e){e.commands.go=(t,n,r)=>{let o={type:"goCommand",back:!1,newWindow:!1,start:r,end:r,run:()=>{}},s=()=>t.match("in")?(t.req("new"),t.req("window"),!0):!1,i=c=>{if(c==null)return;if(x(c))return c.scrollIntoView({block:"start",inline:"nearest"});let a=String(c);a.startsWith("#")?window.location.hash=a:o.newWindow?window.open(a):window.location.href=a};if(t.match("back"))o.back=!0,o.run=()=>window.history.back();else if(t.match("to"),t.match("url")){let c=o.url=We(t);o.newWindow=s(),o.run=()=>i(c)}else if(["the","top","middle","bottom","left","center","right"].includes(t.cur().value)){let c=o.scroll=Dr(t);o.run=a=>Hr(c,a)}else{let c=o.target=Be(t);o.newWindow=s(),o.run=a=>E(c.ev(a),i)}return o.end=t.endPos(),o}}function Br(e){e.commands.set=(t,n,r)=>Jt(t,r)}function Jt(e,t){{if(e.cur().op&&e.cur().value==="{"){let s=Ge(e);e.req("on");let i=h(e);return{type:"setCommand",target:i,object:s,start:t,end:e.endPos(),run:a=>N([s.ev(a),i.ev(a)],([u,l])=>void Object.assign(Object(l),u))}}let n=e.withFollow(["to"],()=>ce(e));e.req("to");let r=h(e);return{type:"setCommand",target:n,value:r,start:t,end:e.endPos(),run:s=>N([n.lhs?.(s),r.ev(s)],([i,c])=>n.put?.(s,i,c))}}}function Ur(e){e.commands.default=(t,n,r)=>{let o=t.withFollow(["to"],()=>ce(t));t.req("to");let s=h(t);return{type:"defaultCommand",target:o,value:s,start:r,end:t.endPos(),run:c=>E(o.ev(c),a=>{if(!(a!=null&&a!==""))return N([o.lhs?.(c),s.ev(c)],([u,l])=>o.put?.(c,u,l))})}}}function Vr(e){for(let t of["increment","decrement"]){let n=t==="increment"?1:-1;e.commands[t]=(r,o,s)=>{let i=r.withFollow(n<0?["by"]:[],()=>ce(r)),c=r.match("by")?h(r):void 0;return{type:`${t}Command`,target:i,amount:c,start:s,end:r.endPos(),run:u=>N([i.ev(u),c?.ev(u),i.lhs?.(u)],([l,m,f])=>{let p=(l?parseFloat(String(l)):0)+n*(c?parseFloat(String(m)):1);u.result=p,i.put?.(u,f,p)})}}}}function Wr(e,t){e.replaceChildren(be(t)),z.process(e)}var ws=["arrayIndex","propertyAccess","possessive","ofExpression","attributeRef","styleRef","attributeRefAccess"],vs={into:"into",before:"before",after:"after",start:"start",end:"end"},Es={before:"before",after:"after",start:"prepend",end:"append"};function zr(e){e.commands.put=(t,n,r)=>{let o=h(t),s=t.matchAny("into","before","after");!s&&t.match("at")&&(t.match("the"),s=t.matchAny("start","end"),t.req("of"));let i=vs[(s??t.expected("into","before","at start of","at end of","after")).value],c=He(h(t)),a=t.text(c),u=(f,p)=>c.type==="symbol"?E(c.ev(f),d=>{x(d)||d instanceof Document?Wr(d,p):c.put?.(f,void 0,p)}):ws.includes(c.type)?E(c.lhs?.(f),d=>c.put?.(f,d,p)):E(c.ev(f),d=>{M(d,a),O(d,y=>{(x(y)||y instanceof Document)&&Wr(y,p)})}),l=(f,p,d)=>E(c.ev(f),y=>{if(M(y,a),Array.isArray(y)){d==="prepend"?y.unshift(p):y.push(p),P.wroteProperty(y);return}O(y,g=>{x(g)&&(g[d](p instanceof Node?p:be(p)),z.process(g.parentElement??g))})});return{type:"putCommand",value:o,operation:i,target:c,start:r,end:t.endPos(),run:f=>E(o.ev(f),p=>i==="into"?u(f,p):l(f,p,Es[i]))}}}var Oe=e=>Y(e)?Array.from(e):Array.from(Object(e)),Qr=e=>Array.isArray(e)||e instanceof NodeList?Oe(e).map(Qr).join(""):e instanceof HTMLElement?e.outerHTML:e instanceof Node?"":String(e);function bs(e){let t={},n=r=>{let o=w(r,"name"),s=w(r,"value"),i=w(r,"type");if(typeof o!="string"||s==null||i==="radio"&&!w(r,"checked")||(i==="checkbox"?s=w(r,"checked")?[s]:void 0:r instanceof HTMLSelectElement&&r.multiple&&(s=Array.from(r.selectedOptions,a=>a.value)),s===void 0))return;let c=t[o];t[o]=c===void 0?s:(Array.isArray(c)?c:[c]).concat(s)};return O(e,r=>{w(r,"name")!=null&&w(r,"value")!=null?n(r):r instanceof Element&&r.querySelectorAll("input,select,textarea").forEach(n)}),t}function Jr(e){Object.assign(ve,{Boolean:t=>!!t,Date:t=>typeof t=="number"||t instanceof Date?new Date(t):new Date(String(t)),Array:Oe,JSON:t=>t instanceof Response?t.json():JSON.parse(String(t)),JSONString:t=>JSON.stringify(t),Object:t=>typeof t=="string"||t instanceof String?JSON.parse(String(t)):{...Object(t)},FormEncoded:t=>new URLSearchParams(Object(t)).toString(),Set:t=>new Set(Oe(t)),Map:t=>new Map(Object.entries(Object(t))),Keys:t=>t instanceof Map?Array.from(t.keys()):Object.keys(Object(t)),Entries:t=>t instanceof Map?Array.from(t.entries()):Object.entries(Object(t)),Reversed:t=>Oe(t).reverse(),Unique:t=>[...new Set(Oe(t))],Flat:t=>Oe(t).flat(),HTML:Qr}),qe.push((t,n)=>{if(t==="Fixed"||t.startsWith("Fixed:"))return Number(n).toFixed(parseInt(t.split(":")[1])||0)},(t,n)=>t==="Values"?bs(n):void 0)}var Yr="=;expires=Thu, 01 Jan 1970 00:00:00 GMT",Qe=()=>document.cookie?document.cookie.split("; ").map(e=>{let t=e.indexOf("=");return{name:e.slice(0,t),value:decodeURIComponent(e.slice(t+1))}}):[],xs=new Proxy({},{get(e,t){if(t===Symbol.iterator){let n=Qe();return n[Symbol.iterator].bind(n)}if(!(typeof t!="string"||t==="then"))return t==="length"?Qe().length:t==="clear"?n=>void(document.cookie=n+Yr):t==="clearAll"?()=>Qe().forEach(n=>document.cookie=n.name+Yr):t!==""&&!Number.isNaN(Number(t))?Qe()[parseInt(t)]:Qe().find(n=>n.name===t)?.value},set(e,t,n){let r=[];if(typeof n=="string")r.push(encodeURIComponent(n),"samesite=lax");else{r.push(encodeURIComponent(String(w(n,"value"))));let o=(s,i)=>{let c=w(n,s);c&&r.push(`${i}=${c}`)};o("expires","expires"),o("maxAge","max-age"),o("partitioned","partitioned"),o("path","path"),o("samesite","samesite"),w(n,"secure")&&r.push("secure")}return document.cookie=String(t)+"="+r.join(";"),!0}});function Kr(e){St.cookies=xs}var Yt=e=>Y(e)?Array.from(e):[];function ks(e){let t=e.pos(),n=e.matchAny("first","last","random");if(!n)return;e.matchAny("in","from","of");let r=W(e),o=n.value;return{type:"positionalExpression",operator:o,root:r,start:t,end:e.endPos(),ev:i=>E(r.ev(i),c=>{if(!c)return;let a=Array.isArray(c)?c:Yt(w(c,"children")??c),u=o==="first"?0:o==="last"?a.length-1:Math.floor(Math.random()*a.length);return a[u]})}}function Ns(e){let t=e.pos(),n=e.matchAny("next","previous");if(!n)return;let r=n.value==="next",o=Ft(e)??e.err("Expected leaf"),s=e.match("from")?e.withFollow(["in"],()=>W(e)):U(e),i=e.match("in")?W(e):void 0,c=!i&&e.match("within")?W(e):void 0,a=!!e.match("with");a&&e.req("wrapping");let u=e.text(o),l=(p,d,y)=>{let g=d instanceof Element||d instanceof Document?d:document.body,v=Array.from(g.querySelectorAll(y));if(!(p instanceof Node))return;let C=r?Node.DOCUMENT_POSITION_PRECEDING:Node.DOCUMENT_POSITION_FOLLOWING,S=r?v:v.reverse();return S.find(R=>R.compareDocumentPosition(p)===C)??(a?S[0]:void 0)},m=(p,d,y)=>{let g=Yt(d).filter(R=>R===p||x(R)&&R.matches(y)),v=r?g:g.reverse(),C=v[v.indexOf(p)+1];if(v.includes(p)&&C!==void 0)return C;let S=v[0];return a&&x(S)&&S.matches(y)?S:void 0};return{type:"relativePositionalExpression",operator:n.value,thing:o,from:s,inElt:i,withinElt:c,wrapping:a,start:t,end:e.endPos(),ev:p=>N([o.ev(p),s.ev(p),i?.ev(p),c?.ev(p)],([d,y,g,v])=>{let C=w(d,"css");if(typeof C!="string")throw new Error("Expected a CSS value to be returned by "+u);return i?g&&m(y,g,C):l(y,v,C)})}}function Ts(e){let t=e.pos();if(!e.match("closest"))return;let n=!!e.match("parent"),r=e.cur().type==="ATTRIBUTE_REF"?X(e):void 0,o=r?`[${r.name}]`:W(e).css??e.err("Expected a CSS expression"),s=e.match("to")?h(e):U(e),i={type:"closestExpr",css:o,parentSearch:n,to:s,start:t,end:e.endPos(),ev:c=>E(s.ev(c),a=>{if(a==null)return null;let u=[];return O(a,l=>{let m=n?w(l,"parentElement"):l;u.push(x(m)?m.closest(o):null)}),Se(a)?u:u[0]}),lhs:c=>i.ev(c),put:(c,a,u)=>{a&&xe(a,u)}};return r?_t(e,i,r):i}var Xr=["where","sorted","mapped","split","joined"];function Cs(e,t){let n=e.matchAny(...Xr);if(!n)return;let r=n.value;r==="mapped"?e.req("to"):r!=="where"&&e.req("by");let o=e.withFollow(Xr,()=>h(e)),s=r==="sorted"&&!!e.match("descending"),i=(u,l)=>{let m=l.map(f=>(u.beingTested=f,a.varName&&(u.locals[a.varName]=f),o.ev(u)));return u.beingTested=null,m},c=(u,l)=>{if(!l)return l;if(r==="split")return E(o.ev(u),d=>String(l).split(String(d)));let m=Yt(l);if(r==="joined")return E(o.ev(u),d=>m.join(String(d)));let f=i(u,m);if(r==="where")return m.filter((d,y)=>f[y]);if(r==="mapped")return f;let p=s?-1:1;return m.map((d,y)=>y).sort((d,y)=>f[d]==f[y]?0:(T(f[d])<T(f[y])?-1:1)*p).map(d=>m[d])},a={type:"collectionExpression",operator:r==="where"||r==="sorted"||r==="mapped"||r==="split"?r:"joined",root:t,operand:o,descending:s,start:t.start,end:e.endPos(),ev:u=>E(t.ev(u),l=>c(u,l))};return a}function Ss(e){let t=e.pos();if(!e.matchOp("\\"))return;let n=[],r=e.matchType("IDENTIFIER");if(r)for(n.push(r.value);e.matchOp(",");)n.push(e.reqType("IDENTIFIER").value);e.reqOp("-"),e.reqOp(">");let o=h(e);return{type:"blockLiteral",params:n,expr:o,start:t,end:e.endPos(),ev:i=>(...c)=>(n.forEach((a,u)=>i.locals[a]=c[u]),o.ev(i))}}function Ps(e){let t=e.pos();if(e.match("some"))return Re(e,"some",t,h(e),n=>!je(n),!1)}function Rs(e,t){if(!e.matchOp(":"))return;let n=e.reqType("IDENTIFIER").value,r=!e.matchOp("!");return{type:"typeCheckExpression",root:t,suffix:n,start:t.start,end:e.endPos(),ev:s=>E(t.ev(s),i=>{if(ot(i,n,r))return i;throw new Error("Typecheck failed! Expected: "+n)})}}function Zr(e,t,n,r){if(j(e.me,"hyperscript:beep",{element:e.me,expression:t,value:r})){let o=r==null?"object (null)":w(w(r,"constructor"),"name")??"unknown",s=typeof r=="string"?`"${r}"`:Se(r)?Array.from(r):r;console.log(`///_ BEEP! The expression (${n}) evaluates to:`,s,"of type "+o)}}function Is(e){let t=e.pos();if(!e.match("beep!"))return;let n=W(e),r=e.text(n);return Re(e,"beepExpression",t,n,(o,s)=>(Zr(s,n,r,o),o),!1)}function Os(e,t,n){let r=[h(e)];for(;e.matchOp(",");)r.push(h(e));let o=r.map(s=>e.text(s));return{type:"beepCommand",values:r,start:n,end:e.endPos(),run:s=>N(r.map(i=>i.ev(s)),i=>i.forEach((c,a)=>Zr(s,r[a],o[a],c)))}}function eo(e){e.leaves.push(Ts,Ps,Ss),e.unaries.push(Is,Ns,ks),e.commands["beep!"]=Os,e.postfixes.push(Rs),e.collections.push(Cs)}var Kt=e=>me(e)??e.err("Expected dotOrColonPath");function to(e){e.features.def=(t,n)=>{let r=Kt(t),o=r.split("."),s=o.pop()??r,i=[];if(t.matchOp("(")&&!t.matchOp(")")){do i.push(t.reqType("IDENTIFIER").value);while(t.matchOp(","));t.reqOp(")")}let c=D(t),a={type:"defFeature",name:r,displayName:`${s}(${i.join(", ")})`,params:i,body:c,...ht(t),start:n,end:t.endPos(),install:(u,l)=>{De(u,o,s,Object.assign((...f)=>{let p=$(l,a,u,null);i.forEach((y,g)=>p.locals[y]=f[g]);let d=E(at(p,c,a),y=>w(y,"value"));return J(d)&&a.finallyHandler?d.then(void 0,()=>{}):d},{hyperfunc:!0,hypername:r}))}};return a}}function no(e){e.features.init=(t,n)=>{let r=!!t.match("immediately"),o=D(t),s={type:"initFeature",body:o,immediately:r,start:n,end:t.endPos(),install:i=>{let c=()=>void _(o,$(i,s,i,null));r?c():queueMicrotask(c)}};return s}}function ro(e){e.features.behavior=(t,n)=>{let r=Kt(t),o=r.split("."),s=o.pop()??r,i=[];if(t.matchOp("(")&&!t.matchOp(")")){do i.push(t.reqType("IDENTIFIER").value);while(t.matchOp(","));t.reqOp(")")}let c=Ue(t).features;for(let u of c)u.behavior=r;return{type:"behaviorFeature",name:r,params:i,features:c,start:n,end:t.endPos(),install:()=>De(null,o,s,(u,l,m)=>{if(B(u))for(let f of i)Pe(u,r+"Scope")[f]=w(m,f);for(let f of c)f.install(u,l)})}}}function oo(e){e.features.install=(t,n)=>{let r=Kt(t),o=dt(t),s={type:"installFeature",name:r,args:o,start:n,end:t.endPos(),install:(i,c)=>{let a=globalThis;for(let u of r.split("."))if(a=w(a,u),typeof a!="object"&&typeof a!="function")throw new Error("No such behavior defined as "+r);if(!G(a))throw new Error(r+" is not a behavior");a(i,c,o?.ev($(i,s,i,null)))}};return s}}function so(e){e.features.set=(t,n)=>{let r=Jt(t,n);"scope"in r.target&&r.target.scope==="local"&&t.err("variables declared at the feature level cannot be locally scoped (use :foo, ^foo, $foo, or an @attribute target instead).");let o={type:"setFeature",command:r,start:n,end:t.endPos(),install:s=>queueMicrotask(()=>void r.run($(s,o,s,null)))};return o}}function As(e,t){if(typeof e!="object"||e===null)return{queue:[],executing:!1};let n=V(e).eventQueues??=new Map,r=n.get(t);return r||n.set(t,r={queue:[],executing:!1}),r}function Xt(e,t){let n=As(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 s=n.queue.shift();if(s&&setTimeout(()=>Xt(s,t),1),o){let{error:i}=o;console.error(w(i,"message")??i),console.error(w(i,"stack")),j(e.me,"exception",{error:i})}};we(()=>E(at(e,t.body,t),()=>r()),o=>r({error:o}))}function Ls(e,t){if(!Q(t))return;let n=V(t),r=n.listeners??=[],o=n.observers??=[],s=n.timers??=new Set;for(let i of e.events){let c={execCount:0},a=i.elsewhere?[document]:i.from?i.from.ev($(t,e,t,null)):[t];O(a,u=>{if(!Q(u)){console.warn("'%s' feature ignored because target does not exists:",e.displayName,t);return}let l=i.on;if(i.mutationSpec&&u instanceof Node){l="hyperscript:mutation";let f=new MutationObserver(p=>j(u,l,{mutationList:p,observer:f}));f.observe(u,i.mutationSpec),o.push(f)}if(i.intersectionSpec&&u instanceof Element){l="hyperscript:intersection";let f=new IntersectionObserver(p=>{for(let d of p)j(u,l,{observer:f,entry:d,intersecting:d.isIntersecting,isIntersecting:d.isIntersecting,intersectionRatio:d.intersectionRatio})},i.intersectionSpec);f.observe(u),o.push(f)}if(i.resizeSpec&&u instanceof Element){l="hyperscript:resize";let f=new ResizeObserver(p=>{for(let d of p){let{width:y,height:g}=d.contentRect;j(u,l,{width:y,height:g,contentRect:d.contentRect,entry:d})}});f.observe(u),o.push(f)}let m=f=>{if(t instanceof Node&&u!==t&&!t.isConnected){u.removeEventListener(l,m);return}let p=$(t,e,t,f);if(!(i.elsewhere&&t instanceof Node&&f.target instanceof Node&&t.contains(f.target))){i.from&&(p.result=u);for(let d of i.args){let y=w(f,d);y!==void 0?p.locals[d]=y:p.detail!=null&&(p.locals[d]=w(p.detail,d))}if(i.filter){p.meta.context=f;try{if(!i.filter.ev(p))return}finally{p.meta.context=void 0}}if(i.inExpr?.css){let d=f.target instanceof Element?f.target:null;for(;d&&!d.matches(i.inExpr.css);)d=d.parentElement;if(!d)return;p.result=d}if(c.execCount++,i.startCount){let d=c.execCount;if(i.endCount?d<i.startCount||d>i.endCount:i.unbounded?d<i.startCount:d!==i.startCount)return}if(i.debounceTime){c.debounced&&(clearTimeout(c.debounced),s.delete(c.debounced)),s.add(c.debounced=setTimeout(()=>Xt(p,e),i.debounceTime));return}if(i.throttleTime){if(c.lastExec&&Date.now()<c.lastExec+i.throttleTime)return;c.lastExec=Date.now()}Xt(p,e)}};u.addEventListener(l,m),r.push({target:u,event:l,handler:m})})}}function Ms(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 Fs(e){let t={};if(e.match("with")){let n=ke(h(e));n instanceof Element&&(t.root=n)}if(e.match("having"))do e.match("margin")?t.rootMargin=We(e):e.match("threshold")?t.threshold=Number(ke(h(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function qs(e,t){let n=ue(e),r=yt(e),o;e.matchOp("[")&&(o=h(e),e.reqOp("]"));let s,i,c=!1;t?s=1:e.cur().type==="NUMBER"&&(s=parseInt(e.consume().value),e.match("to")?i=parseInt(e.consume().value):e.match("and")&&(c=!0,e.req("on")));let a={on:n,args:r,filter:o,startCount:s,endCount:i,unbounded:c,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?a.intersectionSpec=Fs(e):n==="mutation"&&(a.mutationSpec=Ms(e)),e.match("from")&&(e.match("elsewhere")?a.elsewhere=!0:a.from=e.withFollow(["or"],()=>h(e))),!a.from&&!a.elsewhere&&e.match("elsewhere")&&(a.elsewhere=!0),e.match("in")&&(a.inExpr=W(e));let u=()=>(e.req("at"),Number(ke(W(e))));return e.match("debounced")?a.debounceTime=u():e.match("throttled")&&(a.throttleTime=u()),a}function io(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),s=[];do s.push(qs(t,o));while(t.match("or"));let i="last";!r&&t.match("queue")&&(t.match("all")?i="all":t.match("first")?i="first":t.match("none")?i="none":t.req("last"));let c=D(t),a={type:"onFeature",displayName:"on "+s.map(u=>u.on).join(" or "),events:s,body:c,every:r,queue:i,...ht(t),start:n,end:t.endPos(),install:u=>Ls(a,u)};return a}}var Le=new WeakMap,uo=new Map,tn=new Map,bt=new Map,nn=new Map,Je=new Set,Ye=new WeakMap,_s=0,he,Zt=!1;function Ce(e){let t=Le.get(e);return t||Le.set(e,t={id:++_s}),t}var wt=e=>typeof e=="object"&&e!==null;function js(e,t){let n=he;he=e,P.tracking=!0;try{return t()}finally{he=n,P.tracking=n!==void 0}}var en=class{constructor(t,n,r){this.expression=t;this.handler=n;this.element=r}dependencies=new Map;stopped=!1;last;triggers=0;evaluate(){try{return this.next=js(this,this.expression),!0}catch(t){return console.error("Error in reactive expression:",t),!1}}next;handle(t){try{this.handler(t)}catch(n){console.error("Error in reactive handler:",n)}}initialize(){this.evaluate()&&(this.last=this.next),ao(this),this.last!=null&&this.handle(this.last)}run(){if(++this.triggers>100){console.error("Reactivity loop detected: an effect triggered 100 consecutive times without settling. This usually means an effect is modifying a variable it also depends on.",this.element??this);return}co(this);let t=this.dependencies;this.dependencies=new Map;let n=this.evaluate();n||(this.dependencies=t),ao(this),n&&!Object.is(this.next,this.last)&&(this.last=this.next,this.handle(this.next))}settled(){this.triggers=0}stop(){this.stopped||(this.stopped=!0,co(this),Je.delete(this))}};function Ds(e){e.stopped||(Je.add(e),!Zt&&(Zt=!0,queueMicrotask(()=>{Zt=!1;let t=Array.from(Je);Je.clear();for(let n of t)n.stopped||(n.element&&!n.element.isConnected?n.stop():n.run());if(Je.size===0)for(let n of t)n.settled()})))}var Ae=e=>e?.forEach(Ds);function lo(e){for(let[t,n]of nn)for(let r of e)if(t.contains(r)){Ae(n);break}}var vt;function Hs(){vt??=new MutationObserver(e=>{let t=new Set;for(let n of e){if(n.type==="attributes"){let r=Le.get(n.target);r&&Ae(tn.get(`${n.attributeName}:${r.id}`))}t.add(n.target)}lo(t)}),vt.observe(document,{attributes:!0,childList:!0,subtree:!0}),document.addEventListener("input",Et,!0),document.addEventListener("change",Et,!0)}function Et(e){let t=e.target;if(!(t instanceof Element))return;let n=Le.get(t);n&&Ae(bt.get(n.id)),lo([t])}function Gs(e,t,n){let r=e.get(t);r||e.set(t,r=new Set),r.add(n)}function $s(e,t,n){let r=e.get(t);r?.delete(n),r?.size===0&&e.delete(t)}function fo(e,t){let n=!1;for(let r of e.dependencies.values())r.type==="global"?t(uo,r.name,e):r.type==="element"?t(Ce(r.element).symbols??=new Map,r.name,e):(n=!0,r.type==="query"?t(nn,r.root,e):r.type==="property"?t(bt,Ce(r.object).id,e):t(tn,`${r.name}:${Ce(r.element).id}`,e));return n}function ao(e){fo(e,Gs)&&Hs()}function co(e){fo(e,$s),vt&&!tn.size&&!bt.size&&!nn.size&&(vt.disconnect(),document.removeEventListener("input",Et,!0),document.removeEventListener("change",Et,!0))}function Me(e,t,n){let r=new en(e,t,n);return r.initialize(),n&&(Ye.has(n)||Ye.set(n,new Set),Ye.get(n)?.add(r)),()=>r.stop()}function Ws(){P.readGlobal=e=>void he?.dependencies.set("symbol:global:"+e,{type:"global",name:e}),P.readElement=(e,t)=>{wt(t)&&he?.dependencies.set(`symbol:element:${e}:${Ce(t).id}`,{type:"element",name:e,element:t})},P.readProperty=e=>{wt(e)&&!w(e,"_hsSkipTracking")&&he?.dependencies.set("property:"+Ce(e).id,{type:"property",object:e})},P.readAttribute=(e,t)=>{x(e)&&he?.dependencies.set(`attribute:${t}:${Ce(e).id}`,{type:"attribute",name:t,element:e})},P.wroteGlobal=e=>Ae(uo.get(e)),P.wroteElement=(e,t)=>{wt(t)&&Ae(Le.get(t)?.symbols?.get(e))},P.readQuery=e=>void he?.dependencies.set("query:"+Ce(e).id,{type:"query",root:e}),P.wroteProperty=e=>{let t=wt(e)&&!w(e,"_hsSkipTracking")&&Le.get(e);t&&Ae(bt.get(t.id))},P.stop=e=>{Ye.get(e)?.forEach(t=>t.stop()),Ye.delete(e)}}var Bs=e=>t=>{console.error(w(t,"message")??t),j(e,"exception",{error:t})};function Us(e){e.features.when=(t,n)=>{let r=[];do r.push(t.withFollow(["or"],()=>h(t)));while(t.match("or"));for(let i of r)i.type==="symbol"&&"scope"in i&&i.scope==="local"&&i.name&&t.err(`Cannot watch local variable '${i.name}'. Local variables are not reactive. Use '$${i.name}' (global) or ':${i.name}' (element-scoped) instead.`);t.req("changes");let o=D(t),s={type:"whenFeature",displayName:"when ... changes",watched:r,body:o,start:n,end:t.endPos(),install:i=>queueMicrotask(()=>{let c=()=>$(i,s,i,null);for(let a of r)Me(()=>a.ev(c()),u=>{let l=c();l.result=u,we(()=>E(_(o,l),()=>{}),Bs(i))},x(i)?i:void 0)})};return s}}function Vs(e){e.features.live=(t,n)=>{let r=D(t),o={type:"liveFeature",displayName:"live",body:r,start:n,end:t.endPos(),install:s=>queueMicrotask(()=>Me(()=>void _(r,$(s,o,s,null)),()=>{},x(s)?s:void 0))};return o}}function zs(e){if(e instanceof HTMLInputElement){let n=e.getAttribute("type")??"text";return n==="checkbox"?"checked":n==="number"||n==="range"?"valueAsNumber":"value"}if(e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement)return"value";let t=e.getAttribute("contenteditable");if(t!==null&&t!=="false")return"textContent";if(e.tagName.includes("-")&&"value"in e)return"value";throw new Error(`bind cannot auto-detect a property for <${e.tagName.toLowerCase()}>. Use an explicit property (e.g. 'bind $var to #el's value').`)}function Qs(e){if(e instanceof HTMLInputElement&&e.type==="radio")return{element:e,writable:!0,read:()=>le(e,"checked")?e.value:void 0,write:n=>e.checked=n===e.value};let t=zs(e);return{element:e,writable:!0,read:()=>{let n=le(e,t);return t==="valueAsNumber"&&Number.isNaN(n)?null:n},write:n=>void Reflect.set(e,t,n)}}function Js(e,t,n){let r=t.you||t.me;if(e.type==="classRef"&&"className"in e&&typeof e.className=="string")x(r)&&r.classList.toggle(e.className,!!n);else if(e.type==="attributeRef"&&typeof n=="boolean"&&e.name){if(!x(r))return;e.name.startsWith("aria-")?r.setAttribute(e.name,String(n)):r.toggleAttribute(e.name,n)}else E(e.lhs?.(t),o=>e.put?.(t,o,n))}function Ys(e,t,n){let r=()=>$(t,n,t,null);if(e.type==="classRef"&&"className"in e&&typeof e.className=="string"){let o=e.className;return{writable:!0,read:()=>(Ee(t,"class"),x(t)&&t.classList.contains(o)),write:s=>void(x(t)&&t.classList.toggle(o,!!s))}}return{writable:e.type==="attributeRef"||!!e.put,read:()=>e.ev(r()),write:o=>Js(e,r(),o)}}function Ks(e){e.features.bind=(t,n)=>{let r=t.withFollow(["and","with","to"],()=>h(t));t.matchAny("and","with","to")||t.expected("and","with","to");let o=h(t),s={type:"bindFeature",displayName:"bind",left:r,right:o,start:n,end:t.endPos(),install:i=>queueMicrotask(()=>{let c=x(i)?i:void 0,a=u=>{let l=u.ev($(i,s,i,null));return x(l)?Qs(l):Ys(u,i,s)};try{let u=a(r),l=a(o);if(!u.writable&&!l.writable)throw new Error("bind requires at least one writable side");u.writable&&Me(l.read,u.write,c),l.writable&&Me(u.read,l.write,c);for(let[m,f]of[[u,l],[l,u]]){let p=m.element?.closest("form");if(!p||!c)continue;let d=()=>setTimeout(()=>c.isConnected&&f.write(m.read()),0);p.addEventListener("reset",d),(V(c).listeners??=[]).push({target:p,event:"reset",handler:d})}}catch(u){console.error(w(u,"message")??u)}})};return s}}function mo(e){Ws(),Us(e),Vs(e),Ks(e)}var po="#text";function Xs(e){let t=[],n=0,r=0;for(let o of e.split(/(?<=\n)/)){n++;let s=o.trimStart(),i=r+o.length-s.length;if(r+=o.length,!s||/^(--|\/\/)(\s|$|[-/])/.test(s))continue;let c=i-(r-o.length);if(/^#[a-zA-Z]/.test(s))for(let a of fe(s.slice(1)))a.start+=i+1,a.end+=i+1,a.line=n,a.column+=c+1,t.push(a);else{let a=s.replace(/\r?\n$/,`
|
|
19
|
+
`);t.push({type:"IDENTIFIER",value:po,content:a,start:i,end:r,line:n,column:c})}}return t}var rn=[];function on(e,t){let n=rn=[],r=new Ie(e,Xs(t),t),o=D(r);return r.hasMore()&&r.err(),{commands:o,errors:n}}var ho=e=>String(e).replace(/[&<>"']/g,t=>`&${Zs[t]};`),Zs={"&":"amp","<":"lt",">":"gt",'"':"quot","'":"#039"};function ei(e,t){let n=e.child(fe(t),t),r=!n.match("unescaped"),o=h(n);if(!n.match("if"))return{value:o,escape:r};let s=h(n);return{value:o,condition:s,otherwise:n.match("else")?h(n):void 0,escape:r}}function ti(e,t){let{content:n="",line:r}=e.last,o=[];for(let c=0;c<n.length;){let a=n.indexOf("${",c);if(a===-1){o.push(n.slice(c));break}a>c&&o.push(n.slice(c,a));let u=1,l=a+2;for(;l<n.length&&u>0;l++)n[l]==="{"?u++:n[l]==="}"&&u--;if(u>0){let f=n.slice(a);rn.push({line:r,message:"Unterminated ${} expression",expr:f});break}let m=n.slice(a+2,l-1);try{o.push(ei(e,m))}catch(f){rn.push({line:r,message:f instanceof Error?f.message:String(f),expr:m})}c=l}let s=(c,a)=>typeof c=="string"?c:c.condition?E(c.condition.ev(a),u=>u?c.value.ev(a):c.otherwise?.ev(a)):c.value.ev(a),i=(c,a)=>typeof c=="string"?c:a==null?"":c.escape?ho(a):String(a);return{type:"templateText",parts:o,start:t,end:e.endPos(),run:c=>N(o.map(a=>s(a,c)),a=>{c.meta.template?.out.push(a.map((u,l)=>i(o[l],u)).join(""))})}}var ni=/<!--hs-scope:[^>]*-->/g;function sn(e,t,n){let r=[],o={};return t.meta.template={out:r,loops:o},E(_(e,t),()=>n(r.join(""),o))}function ri(e){let t=e.closest('[data-live-template], [dom-scope="isolated"]'),n=t&&oe(t)?.loops;if(n)for(let r=e;r&&r!==t;r=r.parentElement)for(let o=r.previousSibling;o;o=o.previousSibling){if(!(o instanceof Comment)||!o.data.startsWith("hs-scope:"))continue;let[,s,i]=o.data.split(":"),c=n[s];if(c){let a=parseInt(i),u=Pe(e);c.identifier&&(u[c.identifier]=Reflect.get(Object(c.source),a)),c.indexIdentifier&&(u[c.indexIdentifier]=a)}break}}function yo(e){z.enter=ri,e.commands[po]=(t,n,r)=>ti(t,r),e.commands.render=(t,n,r)=>{let o=h(t),s=t.match("with")?$e(t):void 0,i=!!t.match("here"),c=!i&&t.match("into")?h(t):void 0,a=t.text(o);return{type:"renderCommand",template:o,args:s,here:i,target:c,start:r,end:t.endPos(),run:l=>N([o.ev(l),s?.ev(l),c?.ev(l)],([m,f,p])=>{if(!x(m))throw new Error(a+" is not an element");let d;try{d=on(e,m.textContent??"")}catch(g){console.error("hyperscript template parse error:",g instanceof Error?g.message:g),l.result="";return}for(let g of d.errors)console.error(`hyperscript template error (line ${g.line}): ${g.message}`+(g.expr?" in ${"+g.expr+"}":""));let y=$(l.me,void 0,l.me,null);return Object.assign(y.locals,l.locals,f),sn(d.commands,y,(g,v)=>{l.result=g.replace(ni,"");for(let C of[i?l.me:void 0,p])x(C)&&(V(C).loops=v,C.innerHTML=g)})})}},e.leaves.push(t=>{let n=t.pos();if(!t.match("escape"))return;let r=t.reqType("IDENTIFIER").value,o=!!t.match("unescaped"),s=h(t);return{type:"escapeExpression",value:s,start:n,end:t.endPos(),ev:c=>E(s.ev(c),a=>{if(o)return a;if(a==null)return"";if(r!=="html")throw new Error("Unknown escape: "+r);return ho(a)})}})}function go(e){let t=new WeakSet;Te.addBeforeProcessHook(n=>{for(let r of n.querySelectorAll('script[type="text/hyperscript-template"][live]')){if(t.has(r))continue;t.add(r);let o=r.textContent??"",s=r.getAttribute("_")||r.getAttribute("data-script");r.removeAttribute("_"),r.removeAttribute("data-script");let i=document.createElement("div");i.style.display="contents",i.setAttribute("data-live-template",""),r.after(i),s&&(i.setAttribute("_",s),z.process(i));let c=()=>{let l;try{l=on(e,o).commands}catch(f){return console.error("live-template parse error:",f instanceof Error?f.message:f),""}let m=$(i,void 0,i,null);return sn(l,m,(f,p)=>(V(i).loops=p,f))},a=!1,u=l=>{if(J(l))return void l.then(u);if(a)return zt(i,l);i.innerHTML=String(l),z.process(i),a=!0};queueMicrotask(()=>E(c(),l=>{u(l),Me(c,u,i)}))}})}var wo=[io,to,no,ro,oo,so,vr,mo,go,Jr,eo,Kr,tr,nr,or,ar,cr,ur,dr,fr,mr,pr,hr,Br,Ur,Vr,zr,qr,Un,br,xr,kr,zn,Qn,Jn,yr,gr,_r,$r,Gr,Wn,$n,Bn,Or,Ar,Lr,Mr,Fr,yo,Ir,Dn,Hn];var an={};bo(an,{assignToNamespace:()=>De,commandList:()=>D,config:()=>K,dotOrColonPath:()=>me,evalStatic:()=>ke,expr:()=>h,makeContext:()=>$,runList:()=>_,urlOrExpression:()=>Be});$t(...wo);Object.assign(Te,{kit:an});jn();})();
|