@hyperfixi/engine 7.3.0 → 7.4.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 +40 -0
- package/README.md +22 -4
- package/dist/common.js +131 -12
- package/dist/common.min.js +9 -9
- package/dist/core.js +131 -12
- package/dist/core.min.js +9 -9
- package/dist/full.js +134 -15
- package/dist/full.min.js +11 -11
- package/dist/htmx-compat.d.ts +6 -0
- package/dist/hyperfixi-hs.dev.js +134 -15
- package/dist/hyperfixi-hs.js +11 -11
- package/dist/index.js +134 -15
- package/dist/minimal.js +131 -12
- package/dist/minimal.min.js +9 -9
- package/dist/runtime.d.ts +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [7.4.0] - 2026-10-21
|
|
11
|
+
|
|
12
|
+
Content htmx or fixi swaps in runs its hyperscript, as it does on upstream `_hyperscript`: the
|
|
13
|
+
engine has upstream's htmx integration in every bundle, and loading the engine twice no longer
|
|
14
|
+
binds every handler twice. A minor: new behavior and a deprecated option, nothing removed.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- **`@hyperfixi/engine`: content htmx or fixi swaps in runs its hyperscript, and htmx content a
|
|
19
|
+
script puts in issues its requests.** Upstream `_hyperscript` has this integration in its core
|
|
20
|
+
runtime and the engine had none: a `_="on click …"` that htmx swapped in did nothing, and an
|
|
21
|
+
`hx-get` that a script `put` into the page was never wired. The engine now has upstream's
|
|
22
|
+
integration (0.9.93's `htmx-compat.js`), installed by `boot()` in every bundle, the Vite
|
|
23
|
+
plugin's included: `htmx:load` (htmx 2) and `htmx:after:process` (htmx 4) process the content,
|
|
24
|
+
an after-process hook hands what a script inserts to `htmx.process`, and on htmx 4 it
|
|
25
|
+
registers upstream's `hs-include` extension (`hs-include=":id"` sends element-scoped variables
|
|
26
|
+
with the request; `htmx.config.extensions = "hs-include"` enables it). Two additions upstream
|
|
27
|
+
lacks: fixi (`fx:swapped` processes the swapped content), and pages with their own hooks
|
|
28
|
+
between the two (`htmx.onLoad(el => _hyperscript.process(el))`,
|
|
29
|
+
`_hyperscript.addAfterProcessHook(el => htmx.process(el))`, the workarounds until now) no longer
|
|
30
|
+
recurse, where upstream recurses until the stack runs out. The workarounds can be removed. The
|
|
31
|
+
first vendoring of upstream's suite left out its htmx tests (`integration/htmx.js`,
|
|
32
|
+
`ext/hs-include.js`), which is how the gap shipped; the gate now runs them and passes all 19
|
|
33
|
+
(1422/1486). `hyperfixi-hs.js` grows 0.7 KB gzipped, to 34.9 KB.
|
|
34
|
+
- **`@hyperfixi/engine`: loading the engine twice no longer binds every handler twice.** Element
|
|
35
|
+
state was private to each copy of the engine, so the second copy initialised every element
|
|
36
|
+
again and one click ran its handler twice. htmx 4's boosted swaps run body scripts again, so
|
|
37
|
+
boost, then back, did it on a page that loads the engine at the end of its body. The state is
|
|
38
|
+
now `elt._hyperscript`, where upstream keeps it and a second copy finds it (two more of
|
|
39
|
+
upstream's tests pass).
|
|
40
|
+
- **Examples: sortable-list's Add Task added a blank task and threw.** Its script read the input
|
|
41
|
+
with `first #new-item-input`, which is null (`first` of one element), and now reads the element
|
|
42
|
+
itself. tell-command's code sample shows its `on click`.
|
|
43
|
+
|
|
44
|
+
### Deprecated
|
|
45
|
+
|
|
46
|
+
- **`@hyperfixi/vite-plugin`'s `htmx` option does nothing.** It added a listener for htmx 2's
|
|
47
|
+
event names, which htmx 4 does not fire; the engine's integration covers every bundle. The
|
|
48
|
+
option is still accepted, so existing configs build.
|
|
49
|
+
|
|
10
50
|
## [7.3.0] - 2026-10-21
|
|
11
51
|
|
|
12
52
|
`@hyperfixi/mcp-server` lists its 14 core tools by default and keeps the other 70 in toolsets
|
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ core's `dist/hyperfixi.js` is this package's `hyperfixi-hs.js`. It is also publi
|
|
|
11
11
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
14
|
-
The script-tag bundle, hyperscript and nothing else (34.
|
|
14
|
+
The script-tag bundle, hyperscript and nothing else (34.9 KB gzipped). It installs as
|
|
15
15
|
`window._hyperscript` and `window.hyperfixi`, and reads the document when it is ready:
|
|
16
16
|
|
|
17
17
|
```html
|
|
@@ -57,6 +57,20 @@ A script is rewritten as it is read. The element keeps the text its author wrote
|
|
|
57
57
|
error in the rewritten script carries that text (`error.written`). `@lokascript/hyperscript-adapter`
|
|
58
58
|
uses the hook when the host has it.
|
|
59
59
|
|
|
60
|
+
### htmx and fixi
|
|
61
|
+
|
|
62
|
+
Load htmx (2 or 4) or fixi beside any bundle and nothing else is needed: once the engine has
|
|
63
|
+
processed the document it processes content they swap in, and hands htmx the content a script
|
|
64
|
+
puts in, so its `hx-*` attributes work. On htmx 4 it registers upstream's `hs-include`
|
|
65
|
+
extension (`hs-include=":userId"` sends an element-scoped variable with the request; enable it
|
|
66
|
+
with `htmx.config.extensions = "hs-include"`). This is upstream's integration
|
|
67
|
+
(`src/htmx-compat.ts`), with two additions: fixi (on `fx:swapped`), and a hand-off to htmx that
|
|
68
|
+
does not recurse when a page also hands htmx's content to the engine itself
|
|
69
|
+
(`htmx.onLoad(el => _hyperscript.process(el))`), as it does on upstream. As on upstream, the
|
|
70
|
+
engine looks for htmx once, when it has processed the document: load htmx with a script tag
|
|
71
|
+
(plain or `defer`, not `async`) for the hand-off and `hs-include`; swapped-in content is processed
|
|
72
|
+
whenever htmx loads.
|
|
73
|
+
|
|
60
74
|
## Layout
|
|
61
75
|
|
|
62
76
|
| File | What it holds |
|
|
@@ -153,7 +167,7 @@ commands) 18.4 KB, `full` 34.1 KB, `core` (no commands) 13.8 KB.
|
|
|
153
167
|
|
|
154
168
|
## The script-tag bundle: `hyperfixi-hs.js`
|
|
155
169
|
|
|
156
|
-
`dist/hyperfixi-hs.js` (minified, 34.
|
|
170
|
+
`dist/hyperfixi-hs.js` (minified, 34.9 KB gzipped; `hyperfixi-hs.dev.js` is the readable build) is the first product on this engine:
|
|
157
171
|
hyperscript and nothing else, every module, no htmx attributes, English only. It installs
|
|
158
172
|
`window._hyperscript`, as upstream does, and the same object as `window.hyperfixi`. The name
|
|
159
173
|
paired with core's `hyperfixi-hx.js` (hyperscript plus htmx, retired in Phase C3). Since C-R4b
|
|
@@ -185,8 +199,12 @@ gallery for `packages/core/test-pages/`. One behavior of core's is not in this e
|
|
|
185
199
|
engine want `increment #count's textContent`. The examples write the second, which every
|
|
186
200
|
bundle runs to the same count (the bundle matrix's Counter row).
|
|
187
201
|
|
|
188
|
-
|
|
189
|
-
`
|
|
202
|
+
Since 2026-10-21 the gate also runs upstream's htmx tests (`integration/htmx.js` and
|
|
203
|
+
`ext/hs-include.js`, 19), which the first vendoring left out, so the whole suite is 1,486. The
|
|
204
|
+
engine failed 10 of them until it had upstream's htmx integration; it passes all 19.
|
|
205
|
+
|
|
206
|
+
The 64 known failures: upstream's internal-API surface (`internals.tokenizer`,
|
|
207
|
+
`evalStatically`, source info, error collection: 45), sockets and workers (17, upstream
|
|
190
208
|
extensions that are not built), and two collection-expression tests that need upstream's
|
|
191
209
|
component extension. Upstream's one failure is a test that expects its worker extension to be
|
|
192
210
|
absent.
|
package/dist/common.js
CHANGED
|
@@ -37,13 +37,22 @@
|
|
|
37
37
|
enter(_elt) {
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
var windowHolders = /* @__PURE__ */ new WeakMap();
|
|
41
|
+
function holder(elt) {
|
|
42
|
+
if (elt.window !== elt) return elt;
|
|
43
|
+
let h = windowHolders.get(elt);
|
|
44
|
+
if (!h) windowHolders.set(elt, h = {});
|
|
45
|
+
return h;
|
|
46
|
+
}
|
|
47
|
+
var peekData = (elt) => holder(elt)._hyperscript;
|
|
48
|
+
function dropData(elt) {
|
|
49
|
+
const h = holder(elt);
|
|
50
|
+
const had = h._hyperscript !== void 0;
|
|
51
|
+
delete h._hyperscript;
|
|
52
|
+
return had;
|
|
53
|
+
}
|
|
43
54
|
function dataOf(elt) {
|
|
44
|
-
|
|
45
|
-
if (!d) store.set(elt, d = {});
|
|
46
|
-
return d;
|
|
55
|
+
return holder(elt)._hyperscript ??= {};
|
|
47
56
|
}
|
|
48
57
|
var rx = {
|
|
49
58
|
/** True while an effect is evaluating: reads are then recorded as its dependencies. */
|
|
@@ -2400,6 +2409,108 @@
|
|
|
2400
2409
|
};
|
|
2401
2410
|
}
|
|
2402
2411
|
|
|
2412
|
+
// src/htmx-compat.ts
|
|
2413
|
+
var installed = /* @__PURE__ */ new WeakSet();
|
|
2414
|
+
function installHtmxCompat(hs) {
|
|
2415
|
+
if (installed.has(hs)) return;
|
|
2416
|
+
installed.add(hs);
|
|
2417
|
+
let fromHtmx = false;
|
|
2418
|
+
const asHtmx = (f) => {
|
|
2419
|
+
const was = fromHtmx;
|
|
2420
|
+
fromHtmx = true;
|
|
2421
|
+
try {
|
|
2422
|
+
f();
|
|
2423
|
+
} finally {
|
|
2424
|
+
fromHtmx = was;
|
|
2425
|
+
}
|
|
2426
|
+
};
|
|
2427
|
+
document.addEventListener(
|
|
2428
|
+
"htmx:load",
|
|
2429
|
+
(evt) => asHtmx(() => hs.process(evt.detail?.elt))
|
|
2430
|
+
);
|
|
2431
|
+
document.addEventListener("htmx:after:process", (evt) => asHtmx(() => hs.process(evt.target)));
|
|
2432
|
+
document.addEventListener("fx:swapped", (evt) => {
|
|
2433
|
+
const target = evt.detail?.cfg?.target;
|
|
2434
|
+
hs.process(
|
|
2435
|
+
target instanceof Element && target.isConnected ? target.parentElement ?? target : document.body
|
|
2436
|
+
);
|
|
2437
|
+
});
|
|
2438
|
+
const htmx = Reflect.get(globalThis, "htmx");
|
|
2439
|
+
if (typeof htmx?.process !== "function") return;
|
|
2440
|
+
hs.addAfterProcessHook((elt) => {
|
|
2441
|
+
if (!fromHtmx) asHtmx(() => htmx.process(elt));
|
|
2442
|
+
});
|
|
2443
|
+
if (htmx.version?.startsWith("4")) {
|
|
2444
|
+
htmx.registerExtension?.("hs-include", {
|
|
2445
|
+
htmx_config_request(elt, detail) {
|
|
2446
|
+
const ctx = detail?.ctx;
|
|
2447
|
+
if (!ctx) return;
|
|
2448
|
+
const found = findHsInclude(ctx.sourceElement || elt);
|
|
2449
|
+
if (!found) return;
|
|
2450
|
+
const vars = resolveSpecifiers(found.value, found.scopeElt);
|
|
2451
|
+
const body = ctx.request?.body;
|
|
2452
|
+
if (body instanceof FormData) for (const k in vars) body.set(k, vars[k]);
|
|
2453
|
+
}
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
function findHsInclude(sourceElt) {
|
|
2458
|
+
const attr = sourceElt.getAttribute("hs-include");
|
|
2459
|
+
if (attr !== null) return { value: attr, scopeElt: sourceElt };
|
|
2460
|
+
for (let elt = sourceElt.parentElement; elt; elt = elt.parentElement) {
|
|
2461
|
+
const inherited2 = elt.getAttribute("hs-include:inherited");
|
|
2462
|
+
if (inherited2 !== null) return { value: inherited2, scopeElt: elt };
|
|
2463
|
+
}
|
|
2464
|
+
return null;
|
|
2465
|
+
}
|
|
2466
|
+
var readScope = (elt) => elt && peekData(elt)?.scopes?.elementScope || {};
|
|
2467
|
+
function serialize(value) {
|
|
2468
|
+
if (value == null) return "";
|
|
2469
|
+
if (typeof value === "object") {
|
|
2470
|
+
try {
|
|
2471
|
+
return JSON.stringify(value);
|
|
2472
|
+
} catch {
|
|
2473
|
+
return "";
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
return String(value);
|
|
2477
|
+
}
|
|
2478
|
+
function resolveInherited(scopeKey, startElt) {
|
|
2479
|
+
for (let elt = startElt; elt; elt = elt.parentElement) {
|
|
2480
|
+
const scope = readScope(elt);
|
|
2481
|
+
if (scopeKey in scope) return scope[scopeKey];
|
|
2482
|
+
}
|
|
2483
|
+
return void 0;
|
|
2484
|
+
}
|
|
2485
|
+
function resolveSpecifiers(attrValue, scopeElt) {
|
|
2486
|
+
const result = {};
|
|
2487
|
+
const raw = attrValue.trim();
|
|
2488
|
+
if (raw === "*") {
|
|
2489
|
+
const scope = readScope(scopeElt);
|
|
2490
|
+
for (const k of Object.keys(scope)) result[k[0] === ":" ? k.slice(1) : k] = serialize(scope[k]);
|
|
2491
|
+
return result;
|
|
2492
|
+
}
|
|
2493
|
+
for (let part of raw.split(",")) {
|
|
2494
|
+
part = part.trim();
|
|
2495
|
+
if (!part) continue;
|
|
2496
|
+
if (part[0] === ":") {
|
|
2497
|
+
const scope = readScope(scopeElt);
|
|
2498
|
+
if (part in scope) result[part.slice(1)] = serialize(scope[part]);
|
|
2499
|
+
} else if (part[0] === "^") {
|
|
2500
|
+
const value = resolveInherited(":" + part.slice(1), scopeElt);
|
|
2501
|
+
if (value !== void 0) result[part.slice(1)] = serialize(value);
|
|
2502
|
+
} else if (part[0] === "#") {
|
|
2503
|
+
const colon = part.lastIndexOf(":");
|
|
2504
|
+
if (colon > 0) {
|
|
2505
|
+
const scope = readScope(document.querySelector(part.slice(0, colon)));
|
|
2506
|
+
const name = part.slice(colon + 1);
|
|
2507
|
+
if (":" + name in scope) result[name] = serialize(scope[":" + name]);
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2511
|
+
return result;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2403
2514
|
// src/parser.ts
|
|
2404
2515
|
var ParseError = class extends Error {
|
|
2405
2516
|
constructor(message, token, source, expected) {
|
|
@@ -2681,14 +2792,21 @@
|
|
|
2681
2792
|
}
|
|
2682
2793
|
var beforeProcess = [];
|
|
2683
2794
|
var afterProcess = [];
|
|
2795
|
+
var processing = /* @__PURE__ */ new Set();
|
|
2684
2796
|
function processNode(node) {
|
|
2685
2797
|
if (!(node instanceof Element || node instanceof Document || node instanceof DocumentFragment))
|
|
2686
2798
|
return;
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2799
|
+
if (processing.has(node)) return;
|
|
2800
|
+
processing.add(node);
|
|
2801
|
+
try {
|
|
2802
|
+
for (const hook of beforeProcess) hook(node);
|
|
2803
|
+
const selector = attributes().map((a) => `[${a}]`).join(", ") + ", [type='text/hyperscript']";
|
|
2804
|
+
if (node instanceof Element && node.matches(selector)) initElement(node);
|
|
2805
|
+
node.querySelectorAll(selector).forEach(initElement);
|
|
2806
|
+
for (const hook of afterProcess) hook(node);
|
|
2807
|
+
} finally {
|
|
2808
|
+
processing.delete(node);
|
|
2809
|
+
}
|
|
2692
2810
|
}
|
|
2693
2811
|
function cleanup(elt) {
|
|
2694
2812
|
const data = peekData(elt);
|
|
@@ -2734,7 +2852,7 @@
|
|
|
2734
2852
|
cleanup,
|
|
2735
2853
|
/** The part of upstream's `internals` that pages and tests reach for. */
|
|
2736
2854
|
internals: { runtime: { cleanup, processNode } },
|
|
2737
|
-
version: false ? "dev" : "7.
|
|
2855
|
+
version: false ? "dev" : "7.4.0"
|
|
2738
2856
|
});
|
|
2739
2857
|
function boot() {
|
|
2740
2858
|
Object.assign(globalThis, { _hyperscript: api });
|
|
@@ -2742,6 +2860,7 @@
|
|
|
2742
2860
|
const start = () => {
|
|
2743
2861
|
processNode(document.documentElement);
|
|
2744
2862
|
document.dispatchEvent(new Event("hyperscript:ready"));
|
|
2863
|
+
installHtmxCompat(api);
|
|
2745
2864
|
};
|
|
2746
2865
|
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", start);
|
|
2747
2866
|
else setTimeout(start);
|
package/dist/common.min.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use strict";(()=>{var
|
|
2
|
-
`,r:"\r",t:" ",v:"\v"},V=e=>e>="a"&&e<="z"||e>="A"&&e<="Z",B=e=>e>="0"&&e<="9",
|
|
3
|
-
`,
|
|
4
|
-
`?(i++,o=0):o++,s),p=y=>({type:y,value:"",start:r,end:r+1,line:i,column:o}),f=(y,w)=>(y.value=w,y.end=r,y),d=y=>{let w="";for(;a()&&y(a());)w+=c();return w},m=()=>t&&u===0,h=()=>V(s)||B(s)||")\"'`}]".includes(s),E=(y,w)=>{let A=p(y),L=c();if(a()==="{"){if(A.template=!0,L+=c(),L+=d(
|
|
5
|
-
`),c();else if(Ve(y))n.push(f(p("WHITESPACE"),d(Ve)));else if(!h()&&y==="."&&(V(w)||w==="{"||w==="-"))n.push(E("CLASS_REF",!0));else if(!h()&&y==="#"&&(V(w)||w==="{"))n.push(E("ID_REF",!1));else if(y==="@"||y==="["&&w==="@")n.push(D());else if(y==="*"&&V(w)){let A=p("STYLE_REF");n.push(f(A,c()+d(L=>V(L)||L==="-")))}else if(m()&&(V(y)||y==="\\"))n.push(P());else if(!m()&&(V(y)||y==="_"||y==="$"))n.push(M());else if(B(y))n.push(O());else if(!m()&&(y==='"'||y==="`"))n.push(N());else if(!m()&&y==="'")n.push(te()?N():I());else if(ht.has(y))s==="$"&&y==="{"&&u++,y==="}"&&u--,n.push(I());else if(m()||y==="`"){let A=p("RESERVED");n.push(f(A,c()))}else throw new Error("Unknown token: "+y+" ")}return n}function g(e){return e.match("the"),xn(e)}function xn(e){let t=wt(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=bn(o.value,t,wt(e));return t}function bn(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>x(t.ev(o),i=>!!i===r?i:n.ev(o))}}var kn={"+":(e,t)=>Array.isArray(e)?e.concat(t):b(e)+b(t),"-":(e,t)=>b(e)-b(t),"*":(e,t)=>b(e)*b(t),"/":(e,t)=>b(e)/b(t),mod:(e,t)=>b(e)%b(t)};function Qe(e){let t=Xe(e),n,r=()=>e.matchAnyOp("+","-","*","/")??e.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&e.err("You must parenthesize math operations with different operators");let i=t,s=Xe(e),u=kn[o.value];t={type:"mathOperator",operator:o.value,left:i,right:s,start:i.start,end:s.end,ev:l=>T([i.ev(l),s.ev(l)],([c,p])=>u(c,p))}}return t}function Xe(e){let t=z(e);for(let n=!0;n;){n=!1;for(let r of e.g.collections){let o=r(e,t);if(o){t=o,n=!0;break}}}return t}function z(e){e.match("the");let t=e.pos();if(e.match("not"))return Ze(e,"logicalNot",t,z(e),n=>!n);if(e.match("no"))return Ze(e,"noExpression",t,Xe(e),We);for(let n of e.g.unaries){let r=n(e);if(r)return H(e,r)}return Tn(e)}function Ze(e,t,n,r,o,i=t!=="negativeNumber"){let s={type:t,root:r,start:n,end:e.endPos(),ev:u=>x(r.ev(u),a=>o(a,u))};return i?H(e,s):s}var Nn="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function Tn(e){let t=xt(e),n=e.matchAny(...Nn)??e.matchOp("%");if(n)return gt(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return gt(e,"timeExpression",t,r);for(let o of e.g.postfixes){let i=o(e,t);if(i)return i}return t}function gt(e,t,n,r){let o=s=>typeof r=="number"?b(s)*r:`${s}${r}`,i={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:s=>x(n.ev(s),o)};return n.stat&&(i.stat=()=>o(ye(n))),i}function xt(e){let t=e.pos();return e.matchOp("-")?Ze(e,"negativeNumber",t,xt(e),n=>-b(n)):Ae(e)}function Ae(e){let t=Sn(e);return t?H(e,t):e.err("Unexpected value: "+e.cur().value)}function se(e){return e.match("the"),Ke(e,Ae(e))}function Ke(e,t){let n=Oe(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function Oe(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&Cn(t.expr);)t=t.expr;return t}var Cn=e=>q(v(e,"ev"));function ye(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function Pn(e){let t=e.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(t)return{operator:t.value,right:!0,isType:!1};let n=(a,l=!0,c=!1)=>({operator:a,right:l,isType:c}),r=()=>e.match("equal")&&e.match("to"),o=(a,l)=>(e.req("than"),e.match("or")?(e.req("equal"),e.req("to"),n(l)):n(a));if(e.match("is")||e.match("am")){let a=!!e.match("not"),l=a?"not ":"";return e.match("in")?n(l+"in"):e.match("a")||e.match("an")?n(l+"a",!1,!0):e.match("empty")?n(l+"empty",!1):e.match("between")?n(l+"between"):!a&&e.match("less")?o("<","<="):!a&&e.match("greater")?o(">",">="):e.match("really")?(r(),n(a?"!==":"===")):e.match("equal")?(e.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(e.match("equals"))return n("==");if(e.match("really"))return e.req("equals"),n("===");if(e.matchAny("exist","exists"))return n("exist",!1);let i=!!e.matchAny("do","does");i&&e.req("not");let s=i?"not ":"",u=(a,l)=>e.match(a)??(i&&a!=="match"&&a!=="contain"?void 0:e.match(l));if(u("match","matches"))return n(s+"match");if(u("contain","contains"))return n(s+"contain");if(i&&e.match("exist"))return n("not exist",!1);if(u("include","includes"))return n(s+"include");if(e.match(i?"start":"starts"))return e.req("with"),n(s+"start with");if(e.match(i?"end":"ends"))return e.req("with"),n(s+"end with");if(u("precede","precedes"))return n(s+"precede");if(u("follow","follows"))return n(s+"follow");i&&e.expected("matches","contains","starts with","ends with","precede","follow")}function wt(e){let t=Qe(e),n=Pn(e);if(!n)return t;let{operator:r}=n,o,i=!0,s,u;n.isType?(o=e.reqType("IDENTIFIER").value,i=!e.matchOp("!")):n.right&&(s=Qe(e),r.endsWith("match")&&(u=s.css));let a;r.endsWith("between")&&(e.req("and"),a=Qe(e));let l=!1;e.match("ignoring")&&(e.req("case"),l=!0);let c=d=>l&&typeof d=="string"?d.toLowerCase():d,p=s?.type==="symbol"&&"scope"in s&&s.scope==="local"&&s.name!=="undefined"&&s.name!=="null"?s.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:s,right2:a,typeName:o,ignoringCase:l,start:t.start,end:e.endPos(),ev:d=>T([t.ev(d),u??s?.ev(d),a?.ev(d)],([m,h,E])=>{if(o){let N=lt(m,o,i);return r==="a"?N:!N}if(p&&h===void 0&&(r==="is"||r==="is not")){let N=!!ce(m,p);return r==="is"?N:!N}return bt(r,c(m),c(h),E)})}}function vt(e,t){let n=v(e,"contains")??v(e,"includes");if(!q(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function Rn(e,t){let n=v(e,"match")??v(e,"matches");if(!q(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var Et=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function bt(e,t,n,r){if(e==="not between")return b(t)<b(n)||b(t)>b(r);if(e.startsWith("not "))return!bt(e.slice(4),t,n,r);switch(e){case"is":case"==":return t==n;case"is not":case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return b(t)<b(n);case">":return b(t)>b(n);case"<=":return b(t)<=b(n);case">=":return b(t)>=b(n);case"match":return t!=null&&Rn(t,n);case"in":return n!=null&&vt(n,t);case"contain":case"include":return t!=null&&vt(t,n);case"start with":return t!=null&&String(t).startsWith(String(n));case"end with":return t!=null&&String(t).endsWith(String(n));case"between":return b(t)>=b(n)&&b(t)<=b(r);case"precede":return Et(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return Et(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return We(t);case"exist":return ct(t)}throw new Error("Unknown comparison : "+e)}function Sn(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),Ye("number",parseFloat(t.value),t);case"STRING":return In(e);case"ID_REF":return Mn(e);case"CLASS_REF":return Z(e);case"ATTRIBUTE_REF":return Q(e);case"STYLE_REF":return Rt(e)}if(t.op){if(t.value==="(")return An(e);if(t.value==="[")return Ln(e);if(t.value==="{")return et(e);if(t.value==="<")return _n(e)}let n=e.match("true")??e.match("false");if(n)return Ye("boolean",n.value==="true",n);let r=e.match("null");if(r)return Ye("null",null,r);for(let o of e.g.leaves){let i=o(e);if(i)return i}return Ct(e)}function Ye(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function An(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>g(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var On=(e,t)=>T(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function kt(e,t){let n=e.child(he(t,!0),t),r=[],o="";do{o+=n.lastWs();let i=n.cur();if(i.value==="$"){n.consume();let s=n.matchOp("{");r.push(o,g(n)),o="",s&&n.reqOp("}")}else i.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function In(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=kt(e,n);r.ev=i=>On(o,i)}else r.stat=()=>n;return r}function Ln(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(g(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>T(n.map(o=>o.ev(r)),o=>o)}}function et(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let i=e.matchType("STRING");if(i)n.push(i.value);else if(e.matchOp("["))n.push(g(e)),e.reqOp("]");else{let s="";for(let u=e.matchType("IDENTIFIER")??e.matchOp("-");u;u=e.matchType("IDENTIFIER")??e.matchOp("-"))s+=u.value;n.push(s)}e.reqOp(":"),r.push(g(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:i=>T([...n.map(s=>typeof s=="string"?s:s.ev(i)),...r.map(s=>s.ev(i))],s=>Object.fromEntries(n.map((u,a)=>[String(s[a]),s[n.length+a]])))}}function Nt(e){if(!e.matchOp("("))return;let t=e.last.start,n=Fn(e,t);return e.reqOp(")"),n.end=e.endPos(),n}function Fn(e,t=e.pos()){let n=[],r=[];if(e.cur().type==="IDENTIFIER")do n.push(e.reqType("IDENTIFIER").value),e.reqOp(":"),r.push(g(e));while(e.matchOp(","));return{type:"namedArgumentList",names:n,values:r,start:t,end:e.endPos(),ev:o=>T(r.map(i=>i.ev(o)),i=>Object.fromEntries([["_namedArgList_",!0],...n.map((s,u)=>[s,i[u]])]))}}function Tt(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function Ct(e){let t=e.pos(),n;e.match("global")?n="global":e.match("element")?(n="element",e.matchOp("'")&&e.req("s")):e.match("dom")?n="inherited":e.match("local")&&(n="local");let r=e.matchOp(":"),o=!r&&e.matchOp("^"),i=e.matchType("IDENTIFIER");if(!i?.value)return;let s=(r?":":o?"^":"")+i.value,a=n??{$:"global",":":"element","^":"inherited"}[s[0]]??"local",l;return a==="inherited"&&e.match("on")&&(l=e.withFollow(["to","into","before","after","then"],()=>g(e))),{type:"symbol",name:s,scope:a,...l?{on:l}:{},start:t,end:e.endPos(),ev:c=>$e(s,c,a,l?.ev(c)),lhs:()=>{},put:(c,p,f)=>Ue(s,c,a,f,l?.ev(c))}}var Pt=(e,t)=>{let n=t.value.substring(2);return g(e.child(he(n),n))};function Mn(e){let t=e.consume(),n=(o,i)=>He(o.me).getElementById(String(i)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,i,s)=>x(r.ev(o),u=>u&&me(u,s))};if(t.template){let o=r.expr=Pt(e,t);r.ev=i=>x(o.ev(i),s=>n(i,s))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=i=>n(i,o)}return r}function Z(e){let t=e.matchType("CLASS_REF");if(!t)return;let n={type:"classRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(r,o,i)=>x(n.ev(r),s=>me(Array.from(s instanceof G?s:[]),i))};if(t.template){let r=n.expr=Pt(e,t);n.ev=o=>x(r.ev(o),i=>new G("."+i,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new G(r,o.me,!0)}return n}var Je=class extends G{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>R(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(R);n.forEach((o,i)=>o.setAttribute("data-hs-query-id",String(i)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function _n(e){let t=e.pos();e.consume();let n=e.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");e.reqOp("/"),e.reqOp(">");let r={type:"queryRef",css:n,start:t,end:e.endPos(),ev:o=>new G(n,o.me),lhs:()=>{},put:(o,i,s)=>x(r.ev(o),u=>me(Array.from(u instanceof G?u:[]),s))};if(/\$[^=]/.test(n)){let o=r.parts=kt(e,n);r.ev=i=>T(o.map(s=>typeof s=="string"?s:s.ev(i)),s=>new Je(i.me,s))}return r}function Q(e){let t=e.matchType("ATTRIBUTE_REF");if(!t)return;let n=t.value.startsWith("[")?t.value.slice(2,-1):t.value.slice(1),[r,o]=n.split("="),i=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:i,css:`[${n}]`,start:t.start,end:t.end,ev:s=>le(s.you||s.me,r),lhs:()=>{},put:(s,u,a)=>de(s.you||s.me,r,a)}}function Rt(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?Te:Ne)(o.you||o.me,r),lhs:()=>{},put:(o,i,s)=>Ce(o.you||o.me,r,s)}}function St(e){let t=e.pos();if(!e.matchOp("{"))return;let n=[""],r=[];for(;e.hasMore();){if(e.matchOp("\\"))e.consume();else{if(e.matchOp("}"))break;if(e.match("$")){let o=e.matchOp("{");r.push(g(e)),o&&e.reqOp("}"),n.push("")}else n[n.length-1]+=e.text(e.consume())}n[n.length-1]+=e.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:t,end:e.endPos(),ev:o=>T(r.map(i=>i.ev(o)),i=>n.map((s,u)=>s+(u in i?`${i[u]}`:"")).join(""))}}function j(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function At(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 K(e,t="Expected event name"){return e.matchType("STRING")?.value??At(e)??e.err(t)}function H(e,t){return Dn(e,t)??Hn(e,t)??Un(e,t)??jn(e,t)??Gn(e,t)??Wn(e,t)??$n(e,t)??Bn(e,t)??qn(e,t)??t}function qn(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function Dn(e,t){if(!e.matchOp("."))return;let n=e.reqType("IDENTIFIER").value,r=e.text(t),o={type:"propertyAccess",root:t,prop:n,start:t.start,end:e.endPos(),ev:i=>x(o.root.ev(i),s=>ce(s,n)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{S(s,r),Pe(s,n,u)},del:(i,s)=>{S(s,r),C(s,u=>{_(u)&&delete u[n],k.wroteProperty(u)})}};return H(e,o)}function Hn(e,t){if(!e.match("of"))return;let n=z(e),r,o=t;for(;o.root;)r=o,o=o.root;let s={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],u=o.name;if(!s||u===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),l={property:ce,attribute:le,style:Ne,computed:Te}[s],c={type:"ofExpression",root:n,name:u,kind:s,start:t.start,end:e.endPos(),ev:p=>x(c.root.ev(p),f=>l(f,u)),lhs:p=>c.root.ev(p),put:(p,f,d)=>{S(f,a),s==="attribute"?de(f,u,d):s==="property"?Pe(f,u,d):Ce(f,u,d)},del:(p,f)=>{S(f,a),C(f,d=>{s==="attribute"?R(d)&&d.removeAttribute(u):s==="property"?(_(d)&&delete d[u],k.wroteProperty(d)):d instanceof HTMLElement&&d.style.removeProperty(u)})}};return r?(r.root=c,H(e,t)):H(e,c)}function jn(e,t){let n=e.matchOp("'"),r=t.type==="symbol"&&["my","its","your"].includes(t.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(e.cur().type);if(!n&&!r)return;n&&e.req("s");let o=Q(e)??Rt(e),i=o?void 0:e.reqType("IDENTIFIER").value,s=e.text(t),u=l=>i!==void 0?ce(l,i):o?.type==="attributeRef"?le(l,o.name):o?.type==="computedStyleRef"?Te(l,o.name):o&&Ne(l,o.name),a={type:"possessive",root:t,prop:i,attribute:o,start:t.start,end:e.endPos(),ev:l=>x(a.root.ev(l),u),lhs:l=>a.root.ev(l),put:(l,c,p)=>{S(c,s),i!==void 0?Pe(c,i,p):o?.type==="attributeRef"?de(c,o.name,p):o&&Ce(c,o.name,p)}};return H(e,a)}function Gn(e,t){if(!e.match("in"))return;let n=z(e),r=(s,u)=>{if(s==null)return[];let a=[],l=v(s,"css");if(typeof l=="string")C(u,c=>R(c)&&a.push(...je(c,l)));else if(R(s)){let c=!1;if(C(u,p=>{p instanceof Node&&p.contains(s)&&(c=!0)}),c)return s}else C(s,c=>C(u,p=>c===p&&a.push(c)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:s=>T([o.root.ev(s),n.ev(s)],([u,a])=>r(u,a)),lhs:s=>o.ev(s),put:(s,u,a)=>me(u,a)},i;if(e.peek("where"))for(let s of e.g.collections)i??=s(e,o);return H(e,i??o)}function Wn(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let i=At(e)??e.err("Expected dotOrColonPath"),s={type:"asExpression",root:o,conversion:i,start:o.start,end:e.endPos(),ev:u=>x(s.root.ev(u),a=>dt(a,i))};return s},r=n(t);for(;e.matchOp("|");)r=n(r);return H(e,r)}function $n(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(g(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",i={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:s=>{let u=i.root,a=u.prop,l=a===void 0?void 0:u.root;return T([(l??u).ev(s),...n.map(c=>c.ev(s))],([c,...p])=>{if(!l||a===void 0)return Se(c,void 0,p,s,r);S(c,o);let f=Se(v(c,a),c,p,s,r);return be(c,a),f})}};return H(e,i)}function Se(e,t,n,r,o){if(!q(e))throw S(e,o),new Error(`'${o}' is not a function`);return v(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function Un(e,t){let n=Q(e);return n&&Vn(e,t,n)}function Vn(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:i=>x(o.root.ev(i),s=>le(s,n.name)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{S(s,r),de(s,n.name,u)}};return o}function Bn(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=g(e),o=!1,i;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(i=g(e))),e.reqOp("]");let s=e.text(t),u=(c,p)=>b(p)<0?b(v(c,"length"))+b(p):b(p),a=(c,p,f)=>{let d=v(c,"slice");return q(d)?Reflect.apply(d,c,[p,f]):void 0},l={type:"arrayIndex",root:t,first:r,second:i,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:c=>T([l.root.ev(c),r.ev(c),i?.ev(c)],([p,f,d])=>p==null?null:n?a(p,0,u(p,f)+1):o?d==null?a(p,b(f)):a(p,b(f),u(p,d)+1):v(p,String(f))),lhs:c=>T([l.root.ev(c),r.ev(c)],p=>p),put:(c,p,f)=>{let[d,m]=Array.isArray(p)?p:[];S(d,s),_(d)&&(d[String(m)]=f)},del:(c,p)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[f,d]=Array.isArray(p)?p:[];S(f,s),Array.isArray(f)?f.splice(u(f,d),1):_(f)&&delete f[String(d)],k.wroteProperty(f)}};return H(e,l)}function Ie(e){let t=e.pos();if(e.matchOp("(")){let a=Ie(e)??e.err("Expected command");return e.reqOp(")"),a}let n=e.cur(),r=e.g.commands[n.value],o;if(r?o=e.match(n.value)&&r(e,n.value,t):n.type==="IDENTIFIER"&&(o=e.g.pseudo?.(e,t)),!o||!e.match("unless"))return o;let i=o,s=g(e);return{type:"unlessStatementModifier",command:i,condition:s,start:t,end:e.endPos(),run:a=>x(s.ev(a),l=>l?void 0:i.run(a))}}function Y(e){let t=[];for(;e.hasMore();){let n=Ie(e);if(!n)break;t.push(n),e.match("then")}return t}function Ot(e){let t=e.pos();if(e.matchOp("(")){let o=Ot(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 tt(e){let t=e.pos(),n=[];for(;e.hasMore();){let r=e.cur();if(e.featureStart(r)||r.value==="(")n.push(Ot(e)),e.match("end");else{if(r.value==="end")break;e.err()}}return{type:"hyperscript",features:n,start:t,end:e.endPos()}}function It(e){let t={};return e.match("catch")&&(t.errorSymbol=e.reqType("IDENTIFIER").value,t.errorHandler=Y(e)),e.match("finally")&&(t.finallyHandler=Y(e)),t}function Le(e){let t=[],n=e.tok(1).value,r=e.tok(2).value;if(e.cur().value==="("&&(n===")"||r===","||r===")")){e.matchOp("(");do t.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}return t}function Lt(e){e.commands.if=(t,n,r)=>{let o=g(t);t.match("then");let i=Y(t),s,u=!1,a=t.match("else")??t.match("otherwise");if(a)if(u=t.peek("if")?.line===a.line,u){let c=Ie(t);s=c?[c]:[]}else s=Y(t);return t.hasMore()&&!u&&t.req("end"),{type:"ifCommand",condition:o,trueBranch:i,falseBranch:s,start:r,end:t.endPos(),run:c=>x(o.ev(c),p=>p?$(i,c):s&&$(s,c))}}}var zn={k:"return",value:null};function Ft(e){e.commands.halt=(t,n,r)=>{let o=!1;t.match("the")&&(t.req("event"),t.matchOp("'")&&t.req("s"),o=!0);let i=!!t.match("bubbling"),s=!i&&!!t.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:i,haltDefault:s,start:r,end:t.endPos(),run:a=>{let l=a.event;if(l instanceof Event&&(s||l.stopPropagation(),i||l.preventDefault()),!o)return zn}}}}function qt(e){let t=Z(e);if(!t)return;let n=[t];for(let r=Z(e);r;r=Z(e))n.push(r);return n}var nt=(e,t)=>(e??[]).map(n=>x(n.ev(t),r=>String(v(r,"className")))),Qn=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),rt=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,Mt=(e,t,n,r,o)=>t?Re(e,t,n,i=>R(i)&&r(i),i=>R(i)&&o(i)):C(e,i=>R(i)&&r(i)),ge=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),Dt=(e,t,n,r,o,i)=>i?Mt(t,n,r,s=>ge(s,i,e),s=>ge(s,i,!e)):T(o.map(s=>Mt(t,n,r,u=>u.classList.toggle(String(s),e),u=>u.classList.toggle(String(s),!e))),()=>{});function Ht(e){let t=qt(e),n=t?void 0:Q(e);return{refs:t,attribute:n,css:t||n?void 0:St(e)}}function jt(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ht(t),u;!o&&!i&&!s&&(u=t.withFollow(["to"],()=>g(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?g(t):j(t),l=t.match("when")?g(t):void 0,c=o||i?l:void 0,p=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:i,css:s,value:u,to:a,when:c,start:r,end:t.endPos(),run:d=>T([a.ev(d),s?.ev(d),u?.ev(d),...nt(o,d)],([m,h,E,...N])=>{if(S(m,p),u){if(Array.isArray(m))m.push(E);else if(m instanceof Set)m.add(E);else throw m instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof m);k.wroteProperty(m)}else if(s)C(m,M=>{let P=rt(M);P&&(P.cssText+=h)});else return Dt(!0,m,c,d,N,i)})}}}var Yn=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function Gt(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ht(t),u=o||i||s?void 0:g(t),a=t.match("from")?g(t):u?void 0:j(t),l;t.match("when")&&(u&&t.err("'when' clause is not supported when removing elements"),l=g(t));let c=a?t.text(a):"",p=u?t.text(u):"",f=(m,h,E)=>{if(E==null&&u?.del&&u.lhs&&!Yn(h)){let N=u;return x(u.lhs(m),M=>N.del?.(m,M))}if(S(h,p),Array.isArray(E)){let N=E.indexOf(h);N>-1&&E.splice(N,1),k.wroteProperty(E)}else E instanceof Set||E instanceof Map?(E.delete(h),k.wroteProperty(E)):C(h,N=>{R(N)&&N.parentElement&&(E==null||E instanceof Node&&E.contains(N))&&N.parentElement.removeChild(N)})};return{type:"removeCommand",classRefs:o,attributeRef:i,css:s,element:u,from:a,when:l,start:r,end:t.endPos(),run:m=>T([a?.ev(m),s?.ev(m),u?.ev(m),...nt(o,m)],([h,E,N,...M])=>{if(u)return f(m,N,h);if(S(h,c),s){let P=Qn(String(E));C(h,O=>P.forEach(I=>rt(O)?.removeProperty(I)))}else return Dt(!1,h,l,m,M,i)})}}}var _t=(e,t,n)=>(r,o,i)=>{i?o.style[e]=i:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},Wt={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=X(t);n?t.style.display=n:e==="toggle"?Wt.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:_t("visibility","hidden","visible"),opacity:_t("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function ot(e,t){let n=t??J.defaultHideShowStrategy??"display";return J.hideShowStrategies[n]??Wt[n]??e.err("Unknown show/hide strategy : "+n)}function $t(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},i;if(t.cur().type==="STYLE_REF"){let h=o.styleProp=t.consume().value.slice(1);i=ot(t,h),o.on=t.match("of")?t.withFollow(["with","between"],()=>g(t)):j(t)}else if(t.match("between")){let h=Z(t);if(h)t.req("and"),o.between=[h,Z(t)??t.err("Expected classRef")];else{let E=Q(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[E,Q(t)??t.err("Expected attributeRef")]}}else if(!(o.classRefs=qt(t))&&!(o.attributeRef=Q(t))){let h=t.g.toggleElement;if(!h)o.target=t.withFollow(["between"],()=>se(t));else{let E=t.withFollow(["between","as"],()=>z(t));if(!t.peek("between"))return h(t,E,r);o.target=Ke(t,E)}}if(!o.styleProp&&!o.target&&(o.on=t.match("on")?g(t):j(t)),t.match("between")){let h=o.betweenValues=t.withFollow(["and"],()=>{let E=[g(t)];for(;t.matchOp(",");)E.push(g(t));return E});t.req("and"),h.push(g(t))}o.target&&!o.betweenValues&&t.err("toggle <expression> requires 'between' with values"),t.peek("for")&&!t.peek("in",2)?(t.match("for"),o.time=g(t)):t.match("until")&&(o.until=K(t),t.match("from")&&(o.from=g(t))),o.end=t.endPos();let{on:s,target:u,betweenValues:a,between:l,attributeRef:c,styleProp:p}=o,f=s?t.text(s):"",d=(h,E)=>h[(h.findIndex(N=>N==E)+1)%h.length],m=(h,E,N,M)=>{if(a&&u?.lhs&&u.put){let P=u;return T([u.ev(h),u.lhs(h)],([O,I])=>P.put?.(h,I,d(N,O)))}if(a&&p)return C(E,P=>{let O=rt(P);if(!O||!R(P))return;let I=O.getPropertyValue(p)||getComputedStyle(P).getPropertyValue(p);O.setProperty(p,String(d(N,I)))});S(E,f),C(E,P=>{if(R(P))if(i)P instanceof HTMLElement&&i("toggle",P);else if(l){let[O,I]=l;if(O.type==="classRef"&&I.type==="classRef"){let[D,te]=[String(O.className),String(I.className)],ne=P.classList.contains(D);P.classList.toggle(D,!ne),P.classList.toggle(te,ne)}else if(O.type==="attributeRef"&&I.type==="attributeRef"){let D=P.getAttribute(O.name)===String(O.value);ge(P,D?O:I,!1),ge(P,D?I:O,!0)}}else c?ge(P,c,!P.hasAttribute(c.name)):M.forEach(O=>P.classList.toggle(String(O)))})};return o.run=h=>T([s?.ev(h),o.time?.ev(h),o.from?.ev(h),T((a??[]).map(E=>E.ev(h)),E=>E),...nt(o.classRefs,h)],([E,N,M,P,...O])=>{let I=()=>m(h,E,Array.isArray(P)?P:[],O);if(o.time)return new Promise(D=>{I(),setTimeout(()=>{I(),D()},b(N))});if(o.until){let D=o.until,te=M||h.me;return new Promise(ne=>{W(te)&&te.addEventListener(D,()=>{I(),ne()},{once:!0}),I()})}return x(I(),()=>{})}),o}}function Ut(e){for(let t of["hide","show"])e.commands[t]=(n,r,o)=>{let i=n.cur(),s=i.value==="when"||i.value==="with"||n.commandBoundary(i)?j(n):g(n),u;n.match("with")&&(u=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;t==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(m=>m.value).join(""));let l=n.match("when")?g(n):void 0,c=ot(n,u),p=n.text(s),f=m=>h=>{h instanceof HTMLElement&&c(m,h,m==="show"?a:void 0)};return{type:`${t}Command`,target:s,strategy:u,arg:a,when:l,start:o,end:n.endPos(),run:m=>x(s.ev(m),h=>{if(S(h,p),l)return Re(h,l,m,f(t),f(t==="hide"?"show":"hide"));C(h,f(t))})}}}var Lr="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function Vt(e){e.commands.send=e.commands.trigger=(t,n,r)=>{let o=K(t),i=Nt(t),s=t.match(n==="trigger"?"on":"to")?g(t):j(t),u=t.text(s);return{type:"sendCommand",event:o,details:i,to:s,start:r,end:t.endPos(),run:l=>T([s.ev(l),i?.ev(l)],([c,p])=>{S(c,u),C(c,f=>F(f,o,_(p)?p:{},l.me))})}}}function Bt(e){e.commands.wait=(t,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(t.match("for")){t.match("a");let i=o.events=[];do{let a=t.cur();a.type==="NUMBER"||a.op&&a.value==="("?i.push(g(t)):i.push({event:K(t),args:Le(t)})}while(t.match("or"));let s=o.from=t.match("from")?g(t):void 0,u=s?t.text(s):"me";o.run=a=>x(s?s.ev(a):a.me,l=>{if(!W(l))throw new Error("Not a valid event target: "+u);return new Promise(c=>{for(let p of i)"event"in p?l.addEventListener(p.event,f=>{a.result=f;for(let d of p.args)a.locals[d]=v(f,d)||v(v(f,"detail"),d)||null;c()},{once:!0}):x(p.ev(a),f=>setTimeout(()=>{a.result=f,c()},b(f)))})})}else{let i;t.match("a")?t.req("tick"):i=o.time=g(t),o.run=s=>x(i?.ev(s),u=>new Promise(a=>setTimeout(a,i?b(u):0)))}return o.end=t.endPos(),o}}function zt(e){e.commands.log=(t,n,r)=>{let o=[g(t)];for(;t.matchOp(",");)o.push(g(t));let i=t.match("with")?g(t):void 0;return{type:"logCommand",values:o,logger:i,start:r,end:t.endPos(),run:u=>T([i?.ev(u),...o.map(a=>a.ev(u))],([a,...l])=>{q(a)?a(...l):console.log(...l)})}}}function Qt(e){e.commands.get=e.commands.call=(t,n,r)=>{let o=g(t);return n==="call"&&o.type!=="functionCall"&&t.err("Must be a function invocation"),{type:"getCommand",value:o,start:r,end:t.endPos(),run:s=>x(o.ev(s),u=>{s.result=u})}}}function Yt(e){e.pseudo=(t,n)=>{let r=t.tok(1);if(!(r.op&&(r.value==="."||r.value==="(")))return;let o=Ae(t);o.type!=="functionCall"&&t.err("Pseudo-commands must be function calls");let i=o.root,s="args"in o&&Array.isArray(o.args)?o.args:[],u;i&&!i.root&&(t.matchAny("the","to","on","with","into","from","at")?u=g(t):t.match("me")&&(u=j(t)));let a=i?.name??"",l=u?t.text(u):"",c=t.text(o),p=u;return{type:"pseudoCommand",value:o,target:u,start:n,end:t.endPos(),run:d=>p?T([p.ev(d),...s.map(m=>m.ev(d))],([m,...h])=>{S(m,l),d.result=Se(v(m,a),m,h,d,c),be(m,a)}):x(o.ev(d),m=>{d.result=m})}}}function Zt(e){e.commands.set=(t,n,r)=>Xn(t,r)}function Xn(e,t){{if(e.cur().op&&e.cur().value==="{"){let i=et(e);e.req("on");let s=g(e);return{type:"setCommand",target:s,object:i,start:t,end:e.endPos(),run:a=>T([i.ev(a),s.ev(a)],([l,c])=>void Object.assign(Object(c),l))}}let n=e.withFollow(["to"],()=>se(e));e.req("to");let r=g(e);return{type:"setCommand",target:n,value:r,start:t,end:e.endPos(),run:i=>T([n.lhs?.(i),r.ev(i)],([s,u])=>n.put?.(i,s,u))}}}function Jt(e){for(let t of["increment","decrement"]){let n=t==="increment"?1:-1;e.commands[t]=(r,o,i)=>{let s=r.withFollow(n<0?["by"]:[],()=>se(r)),u=r.match("by")?g(r):void 0;return{type:`${t}Command`,target:s,amount:u,start:i,end:r.endPos(),run:l=>T([s.ev(l),u?.ev(l),s.lhs?.(l)],([c,p,f])=>{let d=(c?parseFloat(String(c)):0)+n*(u?parseFloat(String(p)):1);l.result=d,s.put?.(l,f,d)})}}}}function Xt(e,t){e.replaceChildren(fe(t)),U.process(e)}var Zn=["arrayIndex","propertyAccess","possessive","ofExpression","attributeRef","styleRef","attributeRefAccess"],Jn={into:"into",before:"before",after:"after",start:"start",end:"end"},Kn={before:"before",after:"after",start:"prepend",end:"append"};function Kt(e){e.commands.put=(t,n,r)=>{let o=g(t),i=t.matchAny("into","before","after");!i&&t.match("at")&&(t.match("the"),i=t.matchAny("start","end"),t.req("of"));let s=Jn[(i??t.expected("into","before","at start of","at end of","after")).value],u=Oe(g(t)),a=t.text(u),l=(f,d)=>u.type==="symbol"?x(u.ev(f),m=>{R(m)||m instanceof Document?Xt(m,d):u.put?.(f,void 0,d)}):Zn.includes(u.type)?x(u.lhs?.(f),m=>u.put?.(f,m,d)):x(u.ev(f),m=>{S(m,a),C(m,h=>{(R(h)||h instanceof Document)&&Xt(h,d)})}),c=(f,d,m)=>x(u.ev(f),h=>{if(S(h,a),Array.isArray(h)){m==="prepend"?h.unshift(d):h.push(d),k.wroteProperty(h);return}C(h,E=>{R(E)&&(E[m](d instanceof Node?d:fe(d)),U.process(E.parentElement??E))})});return{type:"putCommand",value:o,operation:s,target:u,start:r,end:t.endPos(),run:f=>x(o.ev(f),d=>s==="into"?l(f,d):c(f,d,Kn[s]))}}}var ee=class extends Error{constructor(n,r,o,i){super(n);this.token=r;this.source=o;this.expected=i}written},en=()=>({commands:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),Fe=class e{constructor(t,n,r){this.g=t;this.tokens=n;this.src=r;let o=r.length;this.eof={type:"EOF",value:"<<<EOF>>>",start:o,end:o,line:0,column:0},this.last=this.eof,this.skipWs()}i=0;follows=[];eof;last;child(t,n){return new e(this.g,t,n)}tok(t=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(t--===0)return this.tokens[r]??this.eof;r++}}cur(){return this.tokens[this.i]??this.eof}hasMore(){return this.i<this.tokens.length}pos(){return this.cur().start}endPos(){return this.last.end}text(t){return this.src.substring(t.start,t.end)}match(t,n="IDENTIFIER"){if(this.follows.includes(t))return;let r=this.cur();if(r.value===t&&r.type===n)return this.consume()}matchOp(t){let n=this.cur();if(n.op&&n.value===t)return this.consume()}matchType(...t){if(t.includes(this.cur().type))return this.consume()}matchAny(...t){for(let n of t){let r=this.match(n);if(r)return r}}matchAnyOp(...t){for(let n of t){let r=this.matchOp(n);if(r)return r}}req(t){return this.match(t)??this.expected(t)}reqOp(t){return this.matchOp(t)??this.expected(t)}reqType(...t){return this.matchType(...t)??this.expected(...t)}peek(t,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===t&&o.type===r)return o}consume(){return this.hasMore()?(this.last=this.tokens[this.i++],this.skipWs(),this.last):this.eof}skipWs(){for(;this.tokens[this.i]?.type==="WHITESPACE";)this.i++}consumeUntil(t,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let t=this.tokens[this.i-1];return t?.type==="WHITESPACE"?t.value:""}pushFollow(...t){return this.follows.push(...t),t.length}popFollow(t=1){this.follows.length-=t}withFollow(t,n){let r=this.pushFollow(...t);try{return n()}finally{this.popFollow(r)}}withoutFollows(t){let n=this.follows;this.follows=[];try{return t()}finally{this.follows=n}}err(t,n){let r=this.cur();throw new ee(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 st(e){let t=e.source.split(`
|
|
1
|
+
"use strict";(()=>{var oe=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function",x=(e,t)=>oe(e)?e.then(t):t(e),C=(e,t)=>e.some(oe)?Promise.all(e).then(t):t(e),M=e=>e!=null,q=e=>typeof e=="function",v=(e,t)=>M(e)?e[t]:void 0,ie=(e,t,n)=>{M(e)&&(e[t]=n)},R=e=>e instanceof Element,W=e=>q(v(e,"addEventListener"));var b=e=>e;var K={attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",hideShowStrategies:{},fetchThrowsOn:[/^4/,/^5/]},He=Object.assign(Object.create(null),{String:e=>String(e),Int:e=>parseInt(String(e)),Float:e=>parseFloat(String(e)),Number:e=>Number(e),Fragment:e=>fe(e)}),De=[],U={process(e){},enter(e){}},dt=new WeakMap;function je(e){if(e.window!==e)return e;let t=dt.get(e);return t||dt.set(e,t={}),t}var J=e=>je(e)._hyperscript;function mt(e){let t=je(e),n=t._hyperscript!==void 0;return delete t._hyperscript,n}function X(e){return je(e)._hyperscript??={}}var k={tracking:!1,readGlobal(e){},readElement(e,t){},readProperty(e,t){},readAttribute(e,t){},readQuery(e){},wroteGlobal(e){},wroteElement(e,t){},wroteProperty(e){},stop(e){}},Ee=e=>(k.tracking&&typeof e=="object"&&e!==null&&k.readProperty(e,"__mutation__"),e),Nn={Array:["push","pop","shift","unshift","splice","sort","reverse","fill","copyWithin"],Set:["add","delete","clear"],Map:["set","delete","clear"]};function xe(e,t){let n=v(v(e,"constructor"),"name");typeof n=="string"&&Nn[n]?.includes(t)&&k.wroteProperty(e)}var Ge=e=>{if(e instanceof Node){let t=e.getRootNode();if(t instanceof Document||t instanceof ShadowRoot)return t}return document},Cn=e=>e.replace(/[:&()[\]/]/g,t=>"\\"+t);function We(e,t){return k.tracking&&k.readQuery(e),e.querySelectorAll(t)}var G=class{constructor(t,n,r=!1){this.raw=t;this.relativeTo=n;this.escape=r}get css(){return this.escape?Cn(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 We(Ge(this.relativeTo),this.css)}[Symbol.iterator](){return this.select()[Symbol.iterator]()}},$e=e=>e instanceof G||Array.isArray(e)||e instanceof NodeList||e instanceof HTMLCollection||e instanceof FileList;function T(e,t){if($e(e))for(let n of e)t(n);else t(e)}var be=(e,t)=>{if(e==null)return;let n=t(e);if(n!==void 0)return n;if($e(e))return Array.from(e,t)},ce=(e,t)=>(k.tracking&&k.readProperty(e,t),be(e,n=>v(n,t))),le=(e,t)=>(k.tracking&&k.readAttribute(e,t),be(e,n=>R(n)?n.getAttribute(t):void 0)),ke=(e,t)=>be(e,n=>v(v(n,"style"),t)),Ne=(e,t)=>be(e,n=>R(n)?getComputedStyle(n).getPropertyValue(t):void 0),de=(e,t,n)=>T(e,r=>{R(r)&&(n==null?r.removeAttribute(t):r.setAttribute(t,String(n)))}),Ce=(e,t,n)=>T(e,r=>ie(v(r,"style"),t,n)),Te=(e,t,n)=>T(e,r=>{ie(r,t,n),k.wroteProperty(r)});function S(e,t){if(e==null)throw new Error(`'${t}' is null`)}var Ue=e=>e==null||v(e,"length")===0;function pt(e){if(e==null)return!1;if($e(e)){for(let t of e)return!0;return!1}return!0}function ht(e,t,n){if(e==null&&n||Object.prototype.toString.call(e).slice(8,-1)===t)return!0;let r=v(globalThis,t);return q(r)&&e instanceof r}function yt(e,t){for(let r of De){let o=r(t,e);if(o!==void 0)return o}if(e==null)return null;let n=He[t];if(n)return n(e);throw new Error("Unknown conversion : "+t)}function fe(e){let t=document.createDocumentFragment();return e==null?t.append("null"):T(e,n=>{if(n instanceof Node)t.append(n);else{let r=document.createElement("template");r.innerHTML=n===null?"":String(n),t.append(r.content)}}),t}function me(e,t){T(e,n=>{if(!R(n))return;let r=n.parentElement;n.replaceWith(t instanceof Node?t.cloneNode(!0):fe(t)),r&&U.process(r)})}function F(e,t,n={},r){if(!W(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 gt=(e,t="elementScope")=>(X(e).scopes??={})[t]??={},Tn=Object.create(null,{selection:{get:()=>getSelection()?.toString(),enumerable:!0},clipboard:{get:()=>navigator.clipboard.readText(),set:e=>void navigator.clipboard.writeText(String(e))}});function pe(e,t,n,r){let o=v(r,"detail"),i=Object.create(Tn);for(let s=R(e)?e:null;s;s=s.parentElement)Object.assign(i,J(s)?.features);return{meta:{owner:e,feature:t},locals:i,me:n,you:void 0,result:void 0,beingTested:null,event:r,target:v(r,"target")??null,detail:o??null,sender:v(o,"sender")??null,body:typeof document>"u"?null:document.body}}var qe=["meta","it","result","locals","event","target","detail","sender","body"],ae=e=>{let t=e.meta.owner,n=e.meta.feature?.behavior;return M(t)?gt(t,n?n+"Scope":void 0):{}};function wt(e,t,n){let r=R(n)?n:R(t.meta.owner)?t.meta.owner:null;for(;r;){let o=J(r)?.scopes?.elementScope;if(o&&e in o)return{value:o[e],element:r};let i=r.getAttribute("dom-scope");if(i==="isolated")break;let s=i?.match(/^closest\s+(.+)/),u=i?.match(/^parent\s+of\s+(.+)/);s?r=r.parentElement?.closest(s[1])??null:u?r=r.closest(u[1])?.parentElement??null:r=r.parentElement}return{value:void 0,element:null}}function Ve(e,t,n,r){if(e==="me"||e==="my"||e==="I")return t.me;if(e==="it"||e==="its")return t.beingTested??t.result;if(e==="result")return t.result;if(e==="you"||e==="your"||e==="yourself")return t.you;let o=t.meta.owner,i=()=>(k.tracking&&k.readGlobal(e),Ee(v(globalThis,e)));if(n==="global")return i();if(n==="element")return k.tracking&&k.readElement(e,o),Ee(ae(t)[e]);if(n==="inherited"){let l=wt(e,t,r);return k.tracking&&k.readElement(e,l.element??(R(r)?r:o)),Ee(l.value)}let s=t.meta.context;if(s!=null){let l=v(s,e);if(l!==void 0)return l;let c=v(v(s,"detail"),e);if(c!==void 0)return c}let u=qe.includes(e)?v(t,e):t.locals[e];if(u!==void 0)return u;let a=ae(t)[e];return a!==void 0?(k.tracking&&k.readElement(e,o),Ee(a)):i()}function Be(e,t,n,r,o){if(n==="global")ie(globalThis,e,r),k.wroteGlobal(e);else if(n==="element")ae(t)[e]=r,k.wroteElement(e,t.meta.owner);else if(n==="inherited"){let s=wt(e,t,o).element??(R(o)?o:t.meta.owner);M(s)&&(gt(s)[e]=r),k.wroteElement(e,s)}else!qe.includes(e)&&t.locals[e]!==void 0?t.locals[e]=r:ae(t)[e]!==void 0?(ae(t)[e]=r,k.wroteElement(e,t.meta.owner)):qe.includes(e)?ie(t,e,r):t.locals[e]=r}function $(e,t,n=0){for(let r=n;r<e.length;r++){let o=e[r].run(t);if(oe(o))return o.then(i=>i||$(e,t,r+1));if(o)return o}}function ue(e,t){try{let n=e();return oe(n)?n.then(void 0,t):n}catch(n){return t(n)}}function vt(e,t,n){let{errorSymbol:r,errorHandler:o,finallyHandler:i}=n,s=()=>ue(()=>x($(t,e),a=>{let l=v(a,"k");if(l==="break"||l==="continue")throw new Error(`Command \`${l}\` cannot be used outside of a \`repeat\` loop.`);return ft(a)}),a=>{if(!o||!r)throw a;return e.locals[r]=a,$(o,e)});if(!i)return s();let u=()=>ue(()=>x($(i,e),()=>{}),a=>console.error(" Exception in finally block: ",a));return ue(()=>x(s(),a=>x(u(),()=>ft(a))),a=>x(u(),()=>{throw a}))}var ft=e=>{let t=v(e,"k");if(t==="return")return{k:"return",value:v(e,"value")};if(t==="break"||t==="continue")return{k:t}};function Pe(e,t,n,r,o){let i=[];T(e,a=>i.push(a));let s=i.map(a=>(n.beingTested=a,t.ev(n)));n.beingTested=null;let u=a=>{n.result=i.filter((l,c)=>((a[c]?r:o)(l),a[c]))};return s.some(oe)?Promise.all(s).then(u):u(s)}var Et=new Set("+ - * / . .. \\ : % | ! ? # & $ ; , ( ) < > <= >= == === != !== { } [ ] = ~ ^".split(" ")),xt={b:"\b",f:"\f",n:`
|
|
2
|
+
`,r:"\r",t:" ",v:"\v"},V=e=>e>="a"&&e<="z"||e>="A"&&e<="Z",B=e=>e>="0"&&e<="9",ze=e=>e===" "||e===" "||e==="\r"||e===`
|
|
3
|
+
`,Qe=e=>V(e)||B(e)||e==="-"||e==="_"||e===":",Ye=e=>V(e)||B(e)||e==="_"||e==="$";function he(e,t=!1){let n=[],r=0,o=0,i=1,s="<START>",u=0,a=()=>e.charAt(r),l=y=>e.charAt(r+y),c=()=>(s=e.charAt(r++),s===`
|
|
4
|
+
`?(i++,o=0):o++,s),p=y=>({type:y,value:"",start:r,end:r+1,line:i,column:o}),f=(y,w)=>(y.value=w,y.end=r,y),d=y=>{let w="";for(;a()&&y(a());)w+=c();return w},m=()=>t&&u===0,h=()=>V(s)||B(s)||")\"'`}]".includes(s),E=(y,w)=>{let A=p(y),L=c();if(a()==="{"){if(A.template=!0,L+=c(),L+=d(bn=>bn!=="}"),a()!=="}")throw new Error("Unterminated "+(w?"class":"id")+" reference");let ve=c();w&&(L+=ve)}else if(w)for(;Qe(a())||a()==="\\";)a()==="\\"&&c(),L+=c();else L+=d(Qe);return f(A,L)},N=()=>{let y=p("STRING"),w=c();y.template=w==="`";let A="";for(;a()&&a()!==w;)if(a()==="\\"){c();let L=c();if(L in xt)A+=xt[L];else if(y.template&&L==="$")A+="\\$";else if(L==="x"){let ve=a()&&l(1)?parseInt(c()+c(),16):NaN;if(Number.isNaN(ve))throw new Error(`Invalid hexadecimal escape at [Line: ${y.line}, Column: ${y.column}]`);A+=String.fromCharCode(ve)}else A+=L}else A+=c();if(a()!==w)throw new Error(`Unterminated string at [Line: ${y.line}, Column: ${y.column}]`);return c(),f(y,A)},_=()=>{let y=p("IDENTIFIER"),w=c()+d(Ye);return a()==="!"&&w==="beep"&&(w+=c()),f(y,w)},P=()=>{let y=p("IDENTIFIER"),w=c(),A=w==="\\";for(A&&(w="");(Ye(a())||"\\{}".includes(a()||" "))&&!(a()==="$"&&!A);)a()==="\\"?(A=!0,c()):(A=!1,w+=c());return f(y,w)},I=()=>{let y=p("NUMBER"),w=c()+d(B);return a()==="."&&B(l(1))&&(w+=c()),w+=d(B),(a()==="e"||a()==="E")&&(B(l(1))?w+=c():l(1)==="-"&&(w+=c()+c())),f(y,w+d(B))},O=()=>{let y=p("OP");y.op=!0;let w=c();for(;a()&&Et.has(w+a());)w+=c();return f(y,w)},H=()=>{let y=p("ATTRIBUTE_REF"),w=c();return w==="["?(w+=d(A=>A!=="]"),a()==="]"&&(w+=c())):(w+=d(Qe),a()==="="&&(w+=c(),a()==='"'||a()==="'"?w+=N().value:Ye(a())&&(w+=_().value))),f(y,w)},ne=()=>{let y=n.at(-1);return y?y.type==="IDENTIFIER"||y.type==="CLASS_REF"||y.type==="ID_REF"?!1:!(y.op&&(y.value===">"||y.value===")")):!0},re=()=>{let y=a(),w=l(2);return(y==="-"||y==="/")&&l(1)===y&&(ze(w)||w===""||w===y)};for(;r<e.length;){let y=a(),w=l(1);if(re())d(A=>A!=="\r"&&A!==`
|
|
5
|
+
`),c();else if(ze(y))n.push(f(p("WHITESPACE"),d(ze)));else if(!h()&&y==="."&&(V(w)||w==="{"||w==="-"))n.push(E("CLASS_REF",!0));else if(!h()&&y==="#"&&(V(w)||w==="{"))n.push(E("ID_REF",!1));else if(y==="@"||y==="["&&w==="@")n.push(H());else if(y==="*"&&V(w)){let A=p("STYLE_REF");n.push(f(A,c()+d(L=>V(L)||L==="-")))}else if(m()&&(V(y)||y==="\\"))n.push(P());else if(!m()&&(V(y)||y==="_"||y==="$"))n.push(_());else if(B(y))n.push(I());else if(!m()&&(y==='"'||y==="`"))n.push(N());else if(!m()&&y==="'")n.push(ne()?N():O());else if(Et.has(y))s==="$"&&y==="{"&&u++,y==="}"&&u--,n.push(O());else if(m()||y==="`"){let A=p("RESERVED");n.push(f(A,c()))}else throw new Error("Unknown token: "+y+" ")}return n}function g(e){return e.match("the"),Pn(e)}function Pn(e){let t=kt(e),n,r=()=>e.match("and")??e.match("or");for(let o=r();o;o=r())n??=o.value,n!==o.value&&e.err("You must parenthesize logical operations with different operators"),t=Rn(o.value,t,kt(e));return t}function Rn(e,t,n){let r=e==="or";return{type:"logicalOperator",operator:e,left:t,right:n,start:t.start,end:n.end,ev:o=>x(t.ev(o),i=>!!i===r?i:n.ev(o))}}var Sn={"+":(e,t)=>Array.isArray(e)?e.concat(t):b(e)+b(t),"-":(e,t)=>b(e)-b(t),"*":(e,t)=>b(e)*b(t),"/":(e,t)=>b(e)/b(t),mod:(e,t)=>b(e)%b(t)};function Je(e){let t=Ze(e),n,r=()=>e.matchAnyOp("+","-","*","/")??e.match("mod");for(let o=r();o;o=r()){n??=o.value,n!==o.value&&e.err("You must parenthesize math operations with different operators");let i=t,s=Ze(e),u=Sn[o.value];t={type:"mathOperator",operator:o.value,left:i,right:s,start:i.start,end:s.end,ev:l=>C([i.ev(l),s.ev(l)],([c,p])=>u(c,p))}}return t}function Ze(e){let t=z(e);for(let n=!0;n;){n=!1;for(let r of e.g.collections){let o=r(e,t);if(o){t=o,n=!0;break}}}return t}function z(e){e.match("the");let t=e.pos();if(e.match("not"))return Ke(e,"logicalNot",t,z(e),n=>!n);if(e.match("no"))return Ke(e,"noExpression",t,Ze(e),Ue);for(let n of e.g.unaries){let r=n(e);if(r)return D(e,r)}return In(e)}function Ke(e,t,n,r,o,i=t!=="negativeNumber"){let s={type:t,root:r,start:n,end:e.endPos(),ev:u=>x(r.ev(u),a=>o(a,u))};return i?D(e,s):s}var An="em ex cap ch ic rem lh rlh vw vh vi vb vmin vmax cm mm Q pc pt px".split(" ");function In(e){let t=Tt(e),n=e.matchAny(...An)??e.matchOp("%");if(n)return bt(e,"stringPostfixExpression",t,n.value);let r=e.matchAny("s","seconds")?1e3:e.matchAny("ms","milliseconds")?1:0;if(r)return bt(e,"timeExpression",t,r);for(let o of e.g.postfixes){let i=o(e,t);if(i)return i}return t}function bt(e,t,n,r){let o=s=>typeof r=="number"?b(s)*r:`${s}${r}`,i={type:t,root:n,suffix:r,start:n.start,end:e.endPos(),ev:s=>x(n.ev(s),o)};return n.stat&&(i.stat=()=>o(ye(n))),i}function Tt(e){let t=e.pos();return e.matchOp("-")?Ke(e,"negativeNumber",t,Tt(e),n=>-b(n)):Se(e)}function Se(e){let t=_n(e);return t?D(e,t):e.err("Unexpected value: "+e.cur().value)}function se(e){return e.match("the"),tt(e,Se(e))}function tt(e,t){let n=Ae(t);return n.put||e.err(`A target expression must be writable. The expression type '${n.type}' is not.`),n}function Ae(e){let t=e;for(;t.type==="parenthesized"&&"expr"in t&&On(t.expr);)t=t.expr;return t}var On=e=>q(v(e,"ev"));function ye(e){if(e.stat)return e.stat();throw new Error("This expression cannot be evaluated statically: "+e.type)}function Ln(e){let t=e.matchAnyOp("<",">","<=",">=","==","===","!=","!==");if(t)return{operator:t.value,right:!0,isType:!1};let n=(a,l=!0,c=!1)=>({operator:a,right:l,isType:c}),r=()=>e.match("equal")&&e.match("to"),o=(a,l)=>(e.req("than"),e.match("or")?(e.req("equal"),e.req("to"),n(l)):n(a));if(e.match("is")||e.match("am")){let a=!!e.match("not"),l=a?"not ":"";return e.match("in")?n(l+"in"):e.match("a")||e.match("an")?n(l+"a",!1,!0):e.match("empty")?n(l+"empty",!1):e.match("between")?n(l+"between"):!a&&e.match("less")?o("<","<="):!a&&e.match("greater")?o(">",">="):e.match("really")?(r(),n(a?"!==":"===")):e.match("equal")?(e.match("to"),n(a?"!=":"==")):n(a?"is not":"is")}if(e.match("equals"))return n("==");if(e.match("really"))return e.req("equals"),n("===");if(e.matchAny("exist","exists"))return n("exist",!1);let i=!!e.matchAny("do","does");i&&e.req("not");let s=i?"not ":"",u=(a,l)=>e.match(a)??(i&&a!=="match"&&a!=="contain"?void 0:e.match(l));if(u("match","matches"))return n(s+"match");if(u("contain","contains"))return n(s+"contain");if(i&&e.match("exist"))return n("not exist",!1);if(u("include","includes"))return n(s+"include");if(e.match(i?"start":"starts"))return e.req("with"),n(s+"start with");if(e.match(i?"end":"ends"))return e.req("with"),n(s+"end with");if(u("precede","precedes"))return n(s+"precede");if(u("follow","follows"))return n(s+"follow");i&&e.expected("matches","contains","starts with","ends with","precede","follow")}function kt(e){let t=Je(e),n=Ln(e);if(!n)return t;let{operator:r}=n,o,i=!0,s,u;n.isType?(o=e.reqType("IDENTIFIER").value,i=!e.matchOp("!")):n.right&&(s=Je(e),r.endsWith("match")&&(u=s.css));let a;r.endsWith("between")&&(e.req("and"),a=Je(e));let l=!1;e.match("ignoring")&&(e.req("case"),l=!0);let c=d=>l&&typeof d=="string"?d.toLowerCase():d,p=s?.type==="symbol"&&"scope"in s&&s.scope==="local"&&s.name!=="undefined"&&s.name!=="null"?s.name:void 0;return{type:"comparisonOperator",operator:r,left:t,right:s,right2:a,typeName:o,ignoringCase:l,start:t.start,end:e.endPos(),ev:d=>C([t.ev(d),u??s?.ev(d),a?.ev(d)],([m,h,E])=>{if(o){let N=ht(m,o,i);return r==="a"?N:!N}if(p&&h===void 0&&(r==="is"||r==="is not")){let N=!!ce(m,p);return r==="is"?N:!N}return Pt(r,c(m),c(h),E)})}}function Nt(e,t){let n=v(e,"contains")??v(e,"includes");if(!q(n))throw new Error("The value does not have a contains or includes method on it");return!!Reflect.apply(n,e,[t])}function Fn(e,t){let n=v(e,"match")??v(e,"matches");if(!q(n))throw new Error("The value does not have a match or matches method on it");return!!Reflect.apply(n,e,[t])}var Ct=(e,t,n)=>e instanceof Node&&t instanceof Node&&(e.compareDocumentPosition(t)&n)!==0;function Pt(e,t,n,r){if(e==="not between")return b(t)<b(n)||b(t)>b(r);if(e.startsWith("not "))return!Pt(e.slice(4),t,n,r);switch(e){case"is":case"==":return t==n;case"is not":case"!=":return t!=n;case"===":return t===n;case"!==":return t!==n;case"<":return b(t)<b(n);case">":return b(t)>b(n);case"<=":return b(t)<=b(n);case">=":return b(t)>=b(n);case"match":return t!=null&&Fn(t,n);case"in":return n!=null&&Nt(n,t);case"contain":case"include":return t!=null&&Nt(t,n);case"start with":return t!=null&&String(t).startsWith(String(n));case"end with":return t!=null&&String(t).endsWith(String(n));case"between":return b(t)>=b(n)&&b(t)<=b(r);case"precede":return Ct(t,n,Node.DOCUMENT_POSITION_FOLLOWING);case"follow":return Ct(t,n,Node.DOCUMENT_POSITION_PRECEDING);case"empty":return Ue(t);case"exist":return pt(t)}throw new Error("Unknown comparison : "+e)}function _n(e){let t=e.cur();switch(t.type){case"NUMBER":return e.consume(),Xe("number",parseFloat(t.value),t);case"STRING":return Hn(e);case"ID_REF":return Gn(e);case"CLASS_REF":return Z(e);case"ATTRIBUTE_REF":return Q(e);case"STYLE_REF":return Lt(e)}if(t.op){if(t.value==="(")return Mn(e);if(t.value==="[")return Dn(e);if(t.value==="{")return nt(e);if(t.value==="<")return Wn(e)}let n=e.match("true")??e.match("false");if(n)return Xe("boolean",n.value==="true",n);let r=e.match("null");if(r)return Xe("null",null,r);for(let o of e.g.leaves){let i=o(e);if(i)return i}return It(e)}function Xe(e,t,n){return{type:e,value:t,start:n.start,end:n.end,ev:()=>t,stat:()=>t}}function Mn(e){let t=e.pos();e.consume();let n=e.withoutFollows(()=>g(e));return e.reqOp(")"),{type:"parenthesized",expr:n,start:t,end:e.endPos(),ev:r=>n.ev(r)}}var qn=(e,t)=>C(e.map(n=>typeof n=="string"?n:n.ev(t)),n=>n.map(r=>r===void 0?"":`${r}`).join(""));function Rt(e,t){let n=e.child(he(t,!0),t),r=[],o="";do{o+=n.lastWs();let i=n.cur();if(i.value==="$"){n.consume();let s=n.matchOp("{");r.push(o,g(n)),o="",s&&n.reqOp("}")}else i.value==="\\"?(n.consume(),n.consume()):n.hasMore()&&(o+=n.consume().value)}while(n.hasMore());return r.push(o+n.lastWs()),r}function Hn(e){let t=e.consume(),n=t.value,r={type:"string",value:n,start:t.start,end:t.end,ev:()=>n};if(t.template){let o=r.parts=Rt(e,n);r.ev=i=>qn(o,i)}else r.stat=()=>n;return r}function Dn(e){let t=e.pos();e.consume();let n=[];if(!e.matchOp("]")){do n.push(g(e));while(e.matchOp(","));e.reqOp("]")}return{type:"arrayLiteral",values:n,start:t,end:e.endPos(),ev:r=>C(n.map(o=>o.ev(r)),o=>o)}}function nt(e){let t=e.pos();e.consume();let n=[],r=[],o=()=>e.cur().op&&e.cur().value==="}";if(!e.matchOp("}")){do{let i=e.matchType("STRING");if(i)n.push(i.value);else if(e.matchOp("["))n.push(g(e)),e.reqOp("]");else{let s="";for(let u=e.matchType("IDENTIFIER")??e.matchOp("-");u;u=e.matchType("IDENTIFIER")??e.matchOp("-"))s+=u.value;n.push(s)}e.reqOp(":"),r.push(g(e))}while(e.matchOp(",")&&!o());e.reqOp("}")}return{type:"objectLiteral",keys:n,values:r,start:t,end:e.endPos(),ev:i=>C([...n.map(s=>typeof s=="string"?s:s.ev(i)),...r.map(s=>s.ev(i))],s=>Object.fromEntries(n.map((u,a)=>[String(s[a]),s[n.length+a]])))}}function St(e){if(!e.matchOp("("))return;let t=e.last.start,n=jn(e,t);return e.reqOp(")"),n.end=e.endPos(),n}function jn(e,t=e.pos()){let n=[],r=[];if(e.cur().type==="IDENTIFIER")do n.push(e.reqType("IDENTIFIER").value),e.reqOp(":"),r.push(g(e));while(e.matchOp(","));return{type:"namedArgumentList",names:n,values:r,start:t,end:e.endPos(),ev:o=>C(r.map(i=>i.ev(o)),i=>Object.fromEntries([["_namedArgList_",!0],...n.map((s,u)=>[s,i[u]])]))}}function At(e){return e.matchType("STRING")?.value??e.consumeUntil(void 0,"WHITESPACE").map(t=>t.value).join("")}function It(e){let t=e.pos(),n;e.match("global")?n="global":e.match("element")?(n="element",e.matchOp("'")&&e.req("s")):e.match("dom")?n="inherited":e.match("local")&&(n="local");let r=e.matchOp(":"),o=!r&&e.matchOp("^"),i=e.matchType("IDENTIFIER");if(!i?.value)return;let s=(r?":":o?"^":"")+i.value,a=n??{$:"global",":":"element","^":"inherited"}[s[0]]??"local",l;return a==="inherited"&&e.match("on")&&(l=e.withFollow(["to","into","before","after","then"],()=>g(e))),{type:"symbol",name:s,scope:a,...l?{on:l}:{},start:t,end:e.endPos(),ev:c=>Ve(s,c,a,l?.ev(c)),lhs:()=>{},put:(c,p,f)=>Be(s,c,a,f,l?.ev(c))}}var Ot=(e,t)=>{let n=t.value.substring(2);return g(e.child(he(n),n))};function Gn(e){let t=e.consume(),n=(o,i)=>Ge(o.me).getElementById(String(i)),r={type:"idRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(o,i,s)=>x(r.ev(o),u=>u&&me(u,s))};if(t.template){let o=r.expr=Ot(e,t);r.ev=i=>x(o.ev(i),s=>n(i,s))}else{let o=r.value=t.value.substring(1);r.css=t.value,r.ev=i=>n(i,o)}return r}function Z(e){let t=e.matchType("CLASS_REF");if(!t)return;let n={type:"classRef",start:t.start,end:t.end,ev:()=>null,lhs:()=>{},put:(r,o,i)=>x(n.ev(r),s=>me(Array.from(s instanceof G?s:[]),i))};if(t.template){let r=n.expr=Ot(e,t);n.ev=o=>x(r.ev(o),i=>new G("."+i,o.me,!0))}else{let r=n.css=t.value;n.className=r.slice(1),n.ev=o=>new G(r,o.me,!0)}return n}var et=class extends G{constructor(n,r){super("",n);this.parts=r}get css(){let n=0;return this.parts.map(r=>R(r)?`[data-hs-query-id='${n++}']`:`${r??""}`).join("")}select(){let n=this.parts.filter(R);n.forEach((o,i)=>o.setAttribute("data-hs-query-id",String(i)));let r=super.select();return n.forEach(o=>o.removeAttribute("data-hs-query-id")),r}};function Wn(e){let t=e.pos();e.consume();let n=e.consumeUntil("/").map(o=>o.type==="STRING"?`"${o.value}"`:o.value).join("");e.reqOp("/"),e.reqOp(">");let r={type:"queryRef",css:n,start:t,end:e.endPos(),ev:o=>new G(n,o.me),lhs:()=>{},put:(o,i,s)=>x(r.ev(o),u=>me(Array.from(u instanceof G?u:[]),s))};if(/\$[^=]/.test(n)){let o=r.parts=Rt(e,n);r.ev=i=>C(o.map(s=>typeof s=="string"?s:s.ev(i)),s=>new et(i.me,s))}return r}function Q(e){let t=e.matchType("ATTRIBUTE_REF");if(!t)return;let n=t.value.startsWith("[")?t.value.slice(2,-1):t.value.slice(1),[r,o]=n.split("="),i=o&&/^["']/.test(o)?o.slice(1,-1):o;return{type:"attributeRef",name:r,value:i,css:`[${n}]`,start:t.start,end:t.end,ev:s=>le(s.you||s.me,r),lhs:()=>{},put:(s,u,a)=>de(s.you||s.me,r,a)}}function Lt(e){let t=e.matchType("STYLE_REF");if(!t)return;let n=t.value.startsWith("*computed-"),r=t.value.slice(n?10:1);return{type:n?"computedStyleRef":"styleRef",name:r,start:t.start,end:t.end,ev:o=>(n?Ne:ke)(o.you||o.me,r),lhs:()=>{},put:(o,i,s)=>Ce(o.you||o.me,r,s)}}function Ft(e){let t=e.pos();if(!e.matchOp("{"))return;let n=[""],r=[];for(;e.hasMore();){if(e.matchOp("\\"))e.consume();else{if(e.matchOp("}"))break;if(e.match("$")){let o=e.matchOp("{");r.push(g(e)),o&&e.reqOp("}"),n.push("")}else n[n.length-1]+=e.text(e.consume())}n[n.length-1]+=e.lastWs()}return{type:"styleLiteral",parts:n,exprs:r,start:t,end:e.endPos(),ev:o=>C(r.map(i=>i.ev(o)),i=>n.map((s,u)=>s+(u in i?`${i[u]}`:"")).join(""))}}function j(e){let t=e.endPos();return{type:"implicitMeTarget",start:t,end:t,ev:n=>n.you||n.me}}function _t(e){let t=e.matchType("IDENTIFIER");if(!t)return;let n=[t.value],r=e.matchOp(".")??e.matchOp(":");if(r)do n.push(e.reqType("IDENTIFIER","NUMBER").value);while(e.matchOp(r.value));return n.join(r?.value??"")}function ee(e,t="Expected event name"){return e.matchType("STRING")?.value??_t(e)??e.err(t)}function D(e,t){return Un(e,t)??Vn(e,t)??Jn(e,t)??Bn(e,t)??zn(e,t)??Qn(e,t)??Yn(e,t)??Zn(e,t)??$n(e,t)??t}function $n(e,t){for(let n of e.g.indirects){let r=n(e,t);if(r)return r}}function Un(e,t){if(!e.matchOp("."))return;let n=e.reqType("IDENTIFIER").value,r=e.text(t),o={type:"propertyAccess",root:t,prop:n,start:t.start,end:e.endPos(),ev:i=>x(o.root.ev(i),s=>ce(s,n)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{S(s,r),Te(s,n,u)},del:(i,s)=>{S(s,r),T(s,u=>{M(u)&&delete u[n],k.wroteProperty(u)})}};return D(e,o)}function Vn(e,t){if(!e.match("of"))return;let n=z(e),r,o=t;for(;o.root;)r=o,o=o.root;let s={symbol:"property",attributeRef:"attribute",styleRef:"style",computedStyleRef:"computed"}[o.type],u=o.name;if(!s||u===void 0)return e.err("Cannot take a property of a non-symbol: "+o.type);let a=e.text(n),l={property:ce,attribute:le,style:ke,computed:Ne}[s],c={type:"ofExpression",root:n,name:u,kind:s,start:t.start,end:e.endPos(),ev:p=>x(c.root.ev(p),f=>l(f,u)),lhs:p=>c.root.ev(p),put:(p,f,d)=>{S(f,a),s==="attribute"?de(f,u,d):s==="property"?Te(f,u,d):Ce(f,u,d)},del:(p,f)=>{S(f,a),T(f,d=>{s==="attribute"?R(d)&&d.removeAttribute(u):s==="property"?(M(d)&&delete d[u],k.wroteProperty(d)):d instanceof HTMLElement&&d.style.removeProperty(u)})}};return r?(r.root=c,D(e,t)):D(e,c)}function Bn(e,t){let n=e.matchOp("'"),r=t.type==="symbol"&&["my","its","your"].includes(t.name??"")&&["IDENTIFIER","ATTRIBUTE_REF","STYLE_REF"].includes(e.cur().type);if(!n&&!r)return;n&&e.req("s");let o=Q(e)??Lt(e),i=o?void 0:e.reqType("IDENTIFIER").value,s=e.text(t),u=l=>i!==void 0?ce(l,i):o?.type==="attributeRef"?le(l,o.name):o?.type==="computedStyleRef"?Ne(l,o.name):o&&ke(l,o.name),a={type:"possessive",root:t,prop:i,attribute:o,start:t.start,end:e.endPos(),ev:l=>x(a.root.ev(l),u),lhs:l=>a.root.ev(l),put:(l,c,p)=>{S(c,s),i!==void 0?Te(c,i,p):o?.type==="attributeRef"?de(c,o.name,p):o&&Ce(c,o.name,p)}};return D(e,a)}function zn(e,t){if(!e.match("in"))return;let n=z(e),r=(s,u)=>{if(s==null)return[];let a=[],l=v(s,"css");if(typeof l=="string")T(u,c=>R(c)&&a.push(...We(c,l)));else if(R(s)){let c=!1;if(T(u,p=>{p instanceof Node&&p.contains(s)&&(c=!0)}),c)return s}else T(s,c=>T(u,p=>c===p&&a.push(c)));return a},o={type:"inExpression",root:t,target:n,start:t.start,end:e.endPos(),ev:s=>C([o.root.ev(s),n.ev(s)],([u,a])=>r(u,a)),lhs:s=>o.ev(s),put:(s,u,a)=>me(u,a)},i;if(e.peek("where"))for(let s of e.g.collections)i??=s(e,o);return D(e,i??o)}function Qn(e,t){if(!e.match("as"))return;e.match("a")||e.match("an");let n=o=>{let i=_t(e)??e.err("Expected dotOrColonPath"),s={type:"asExpression",root:o,conversion:i,start:o.start,end:e.endPos(),ev:u=>x(s.root.ev(u),a=>yt(a,i))};return s},r=n(t);for(;e.matchOp("|");)r=n(r);return D(e,r)}function Yn(e,t){if(!e.matchOp("("))return;let n=[];if(!e.matchOp(")")){do n.push(g(e));while(e.matchOp(","));e.reqOp(")")}let r=e.text(t),o=t.root?e.text(t.root):"",i={type:"functionCall",root:t,args:n,start:t.start,end:e.endPos(),ev:s=>{let u=i.root,a=u.prop,l=a===void 0?void 0:u.root;return C([(l??u).ev(s),...n.map(c=>c.ev(s))],([c,...p])=>{if(!l||a===void 0)return Re(c,void 0,p,s,r);S(c,o);let f=Re(v(c,a),c,p,s,r);return xe(c,a),f})}};return D(e,i)}function Re(e,t,n,r,o){if(!q(e))throw S(e,o),new Error(`'${o}' is not a function`);return v(e,"hyperfunc")&&n.push(r),Reflect.apply(e,t,n)}function Jn(e,t){let n=Q(e);return n&&Xn(e,t,n)}function Xn(e,t,n){let r=e.text(t),o={type:"attributeRefAccess",root:t,attribute:n,start:t.start,end:e.endPos(),ev:i=>x(o.root.ev(i),s=>le(s,n.name)),lhs:i=>o.root.ev(i),put:(i,s,u)=>{S(s,r),de(s,n.name,u)}};return o}function Zn(e,t){if(!e.matchOp("["))return;let n=!!e.matchOp(".."),r=g(e),o=!1,i;!n&&e.matchOp("..")&&(o=!0,e.cur().op&&e.cur().value==="]"||(i=g(e))),e.reqOp("]");let s=e.text(t),u=(c,p)=>b(p)<0?b(v(c,"length"))+b(p):b(p),a=(c,p,f)=>{let d=v(c,"slice");return q(d)?Reflect.apply(d,c,[p,f]):void 0},l={type:"arrayIndex",root:t,first:r,second:i,andBefore:n,andAfter:o,start:t.start,end:e.endPos(),ev:c=>C([l.root.ev(c),r.ev(c),i?.ev(c)],([p,f,d])=>p==null?null:n?a(p,0,u(p,f)+1):o?d==null?a(p,b(f)):a(p,b(f),u(p,d)+1):v(p,String(f))),lhs:c=>C([l.root.ev(c),r.ev(c)],p=>p),put:(c,p,f)=>{let[d,m]=Array.isArray(p)?p:[];S(d,s),M(d)&&(d[String(m)]=f)},del:(c,p)=>{if(n||o)throw new Error("Cannot remove a slice - use a single index");let[f,d]=Array.isArray(p)?p:[];S(f,s),Array.isArray(f)?f.splice(u(f,d),1):M(f)&&delete f[String(d)],k.wroteProperty(f)}};return D(e,l)}function Ie(e){let t=e.pos();if(e.matchOp("(")){let a=Ie(e)??e.err("Expected command");return e.reqOp(")"),a}let n=e.cur(),r=e.g.commands[n.value],o;if(r?o=e.match(n.value)&&r(e,n.value,t):n.type==="IDENTIFIER"&&(o=e.g.pseudo?.(e,t)),!o||!e.match("unless"))return o;let i=o,s=g(e);return{type:"unlessStatementModifier",command:i,condition:s,start:t,end:e.endPos(),run:a=>x(s.ev(a),l=>l?void 0:i.run(a))}}function Y(e){let t=[];for(;e.hasMore();){let n=Ie(e);if(!n)break;t.push(n),e.match("then")}return t}function Mt(e){let t=e.pos();if(e.matchOp("(")){let o=Mt(e);return e.reqOp(")"),o}let n=e.cur(),r=e.g.features[n.value];return!r||!e.match(n.value)?e.err("Expected feature"):r(e,t)}function rt(e){let t=e.pos(),n=[];for(;e.hasMore();){let r=e.cur();if(e.featureStart(r)||r.value==="(")n.push(Mt(e)),e.match("end");else{if(r.value==="end")break;e.err()}}return{type:"hyperscript",features:n,start:t,end:e.endPos()}}function qt(e){let t={};return e.match("catch")&&(t.errorSymbol=e.reqType("IDENTIFIER").value,t.errorHandler=Y(e)),e.match("finally")&&(t.finallyHandler=Y(e)),t}function Oe(e){let t=[],n=e.tok(1).value,r=e.tok(2).value;if(e.cur().value==="("&&(n===")"||r===","||r===")")){e.matchOp("(");do t.push(e.reqType("IDENTIFIER").value);while(e.matchOp(","));e.reqOp(")")}return t}function Ht(e){e.commands.if=(t,n,r)=>{let o=g(t);t.match("then");let i=Y(t),s,u=!1,a=t.match("else")??t.match("otherwise");if(a)if(u=t.peek("if")?.line===a.line,u){let c=Ie(t);s=c?[c]:[]}else s=Y(t);return t.hasMore()&&!u&&t.req("end"),{type:"ifCommand",condition:o,trueBranch:i,falseBranch:s,start:r,end:t.endPos(),run:c=>x(o.ev(c),p=>p?$(i,c):s&&$(s,c))}}}var Kn={k:"return",value:null};function Dt(e){e.commands.halt=(t,n,r)=>{let o=!1;t.match("the")&&(t.req("event"),t.matchOp("'")&&t.req("s"),o=!0);let i=!!t.match("bubbling"),s=!i&&!!t.match("default");return{type:"haltCommand",keepExecuting:o,bubbling:i,haltDefault:s,start:r,end:t.endPos(),run:a=>{let l=a.event;if(l instanceof Event&&(s||l.stopPropagation(),i||l.preventDefault()),!o)return Kn}}}}function Wt(e){let t=Z(e);if(!t)return;let n=[t];for(let r=Z(e);r;r=Z(e))n.push(r);return n}var ot=(e,t)=>(e??[]).map(n=>x(n.ev(t),r=>String(v(r,"className")))),er=e=>e.split(";").map(t=>t.split(":")[0].trim()).filter(Boolean),st=e=>e instanceof HTMLElement||e instanceof SVGElement?e.style:void 0,jt=(e,t,n,r,o)=>t?Pe(e,t,n,i=>R(i)&&r(i),i=>R(i)&&o(i)):T(e,i=>R(i)&&r(i)),ge=(e,{name:t,value:n},r)=>r?e.setAttribute(t,String(n)):e.removeAttribute(t),$t=(e,t,n,r,o,i)=>i?jt(t,n,r,s=>ge(s,i,e),s=>ge(s,i,!e)):C(o.map(s=>jt(t,n,r,u=>u.classList.toggle(String(s),e),u=>u.classList.toggle(String(s),!e))),()=>{});function Ut(e){let t=Wt(e),n=t?void 0:Q(e);return{refs:t,attribute:n,css:t||n?void 0:Ft(e)}}function Vt(e){e.commands.add=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ut(t),u;!o&&!i&&!s&&(u=t.withFollow(["to"],()=>g(t)),t.cur().value!=="to"&&t.err("Expected either a class reference or attribute expression"));let a=t.match("to")?g(t):j(t),l=t.match("when")?g(t):void 0,c=o||i?l:void 0,p=t.text(a);return{type:"addCommand",classRefs:o,attributeRef:i,css:s,value:u,to:a,when:c,start:r,end:t.endPos(),run:d=>C([a.ev(d),s?.ev(d),u?.ev(d),...ot(o,d)],([m,h,E,...N])=>{if(S(m,p),u){if(Array.isArray(m))m.push(E);else if(m instanceof Set)m.add(E);else throw m instanceof Map?new Error("Use 'set myMap[key] to value' for Maps"):new Error("Cannot add to "+typeof m);k.wroteProperty(m)}else if(s)T(m,_=>{let P=st(_);P&&(P.cssText+=h)});else return $t(!0,m,c,d,N,i)})}}}var tr=e=>e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection;function Bt(e){e.commands.remove=(t,n,r)=>{let{refs:o,attribute:i,css:s}=Ut(t),u=o||i||s?void 0:g(t),a=t.match("from")?g(t):u?void 0:j(t),l;t.match("when")&&(u&&t.err("'when' clause is not supported when removing elements"),l=g(t));let c=a?t.text(a):"",p=u?t.text(u):"",f=(m,h,E)=>{if(E==null&&u?.del&&u.lhs&&!tr(h)){let N=u;return x(u.lhs(m),_=>N.del?.(m,_))}if(S(h,p),Array.isArray(E)){let N=E.indexOf(h);N>-1&&E.splice(N,1),k.wroteProperty(E)}else E instanceof Set||E instanceof Map?(E.delete(h),k.wroteProperty(E)):T(h,N=>{R(N)&&N.parentElement&&(E==null||E instanceof Node&&E.contains(N))&&N.parentElement.removeChild(N)})};return{type:"removeCommand",classRefs:o,attributeRef:i,css:s,element:u,from:a,when:l,start:r,end:t.endPos(),run:m=>C([a?.ev(m),s?.ev(m),u?.ev(m),...ot(o,m)],([h,E,N,..._])=>{if(u)return f(m,N,h);if(S(h,c),s){let P=er(String(E));T(h,I=>P.forEach(O=>st(I)?.removeProperty(O)))}else return $t(!1,h,l,m,_,i)})}}}var Gt=(e,t,n)=>(r,o,i)=>{i?o.style[e]=i:r==="toggle"?o.style[e]=getComputedStyle(o)[e]===t?n:t:o.style[e]=r==="hide"?t:n},zt={display(e,t,n){if(!n&&t instanceof HTMLDialogElement){e==="hide"||e==="toggle"&&t.open?t.close():t.open||t.show();return}let r=X(t);n?t.style.display=n:e==="toggle"?zt.display(getComputedStyle(t).display==="none"?"show":"hide",t):e==="hide"?(r.originalDisplay??=t.style.display,t.style.display="none"):r.originalDisplay&&r.originalDisplay!=="none"?t.style.display=r.originalDisplay:t.style.removeProperty("display")},visibility:Gt("visibility","hidden","visible"),opacity:Gt("opacity","0","1"),hidden(e,t){(e==="toggle"?!t.hasAttribute("hidden"):e==="hide")?t.setAttribute("hidden",""):t.removeAttribute("hidden")}};function it(e,t){let n=t??K.defaultHideShowStrategy??"display";return K.hideShowStrategies[n]??zt[n]??e.err("Unknown show/hide strategy : "+n)}function Qt(e){e.commands.toggle=(t,n,r)=>{t.matchAny("the","my");let o={type:"toggleCommand",start:r,end:r,run:()=>{}},i;if(t.cur().type==="STYLE_REF"){let h=o.styleProp=t.consume().value.slice(1);i=it(t,h),o.on=t.match("of")?t.withFollow(["with","between"],()=>g(t)):j(t)}else if(t.match("between")){let h=Z(t);if(h)t.req("and"),o.between=[h,Z(t)??t.err("Expected classRef")];else{let E=Q(t)??t.err("Expected either a class reference or attribute expression");t.req("and"),o.between=[E,Q(t)??t.err("Expected attributeRef")]}}else if(!(o.classRefs=Wt(t))&&!(o.attributeRef=Q(t))){let h=t.g.toggleElement;if(!h)o.target=t.withFollow(["between"],()=>se(t));else{let E=t.withFollow(["between","as"],()=>z(t));if(!t.peek("between"))return h(t,E,r);o.target=tt(t,E)}}if(!o.styleProp&&!o.target&&(o.on=t.match("on")?g(t):j(t)),t.match("between")){let h=o.betweenValues=t.withFollow(["and"],()=>{let E=[g(t)];for(;t.matchOp(",");)E.push(g(t));return E});t.req("and"),h.push(g(t))}o.target&&!o.betweenValues&&t.err("toggle <expression> requires 'between' with values"),t.peek("for")&&!t.peek("in",2)?(t.match("for"),o.time=g(t)):t.match("until")&&(o.until=ee(t),t.match("from")&&(o.from=g(t))),o.end=t.endPos();let{on:s,target:u,betweenValues:a,between:l,attributeRef:c,styleProp:p}=o,f=s?t.text(s):"",d=(h,E)=>h[(h.findIndex(N=>N==E)+1)%h.length],m=(h,E,N,_)=>{if(a&&u?.lhs&&u.put){let P=u;return C([u.ev(h),u.lhs(h)],([I,O])=>P.put?.(h,O,d(N,I)))}if(a&&p)return T(E,P=>{let I=st(P);if(!I||!R(P))return;let O=I.getPropertyValue(p)||getComputedStyle(P).getPropertyValue(p);I.setProperty(p,String(d(N,O)))});S(E,f),T(E,P=>{if(R(P))if(i)P instanceof HTMLElement&&i("toggle",P);else if(l){let[I,O]=l;if(I.type==="classRef"&&O.type==="classRef"){let[H,ne]=[String(I.className),String(O.className)],re=P.classList.contains(H);P.classList.toggle(H,!re),P.classList.toggle(ne,re)}else if(I.type==="attributeRef"&&O.type==="attributeRef"){let H=P.getAttribute(I.name)===String(I.value);ge(P,H?I:O,!1),ge(P,H?O:I,!0)}}else c?ge(P,c,!P.hasAttribute(c.name)):_.forEach(I=>P.classList.toggle(String(I)))})};return o.run=h=>C([s?.ev(h),o.time?.ev(h),o.from?.ev(h),C((a??[]).map(E=>E.ev(h)),E=>E),...ot(o.classRefs,h)],([E,N,_,P,...I])=>{let O=()=>m(h,E,Array.isArray(P)?P:[],I);if(o.time)return new Promise(H=>{O(),setTimeout(()=>{O(),H()},b(N))});if(o.until){let H=o.until,ne=_||h.me;return new Promise(re=>{W(ne)&&ne.addEventListener(H,()=>{O(),re()},{once:!0}),O()})}return x(O(),()=>{})}),o}}function Yt(e){for(let t of["hide","show"])e.commands[t]=(n,r,o)=>{let i=n.cur(),s=i.value==="when"||i.value==="with"||n.commandBoundary(i)?j(n):g(n),u;n.match("with")&&(u=n.reqType("IDENTIFIER","STYLE_REF").value.replace(/^\*/,""));let a;t==="show"&&n.matchOp(":")&&(a=n.consumeUntil(void 0,"WHITESPACE").map(m=>m.value).join(""));let l=n.match("when")?g(n):void 0,c=it(n,u),p=n.text(s),f=m=>h=>{h instanceof HTMLElement&&c(m,h,m==="show"?a:void 0)};return{type:`${t}Command`,target:s,strategy:u,arg:a,when:l,start:o,end:n.endPos(),run:m=>x(s.ev(m),h=>{if(S(h,p),l)return Pe(h,l,m,f(t),f(t==="hide"?"show":"hide"));T(h,f(t))})}}}var Wr="x y left top right bottom width height bounds scrollLeft scrollTop scrollLeftMax scrollTopMax scrollWidth scrollHeight scroll".split(" ");function Jt(e){e.commands.send=e.commands.trigger=(t,n,r)=>{let o=ee(t),i=St(t),s=t.match(n==="trigger"?"on":"to")?g(t):j(t),u=t.text(s);return{type:"sendCommand",event:o,details:i,to:s,start:r,end:t.endPos(),run:l=>C([s.ev(l),i?.ev(l)],([c,p])=>{S(c,u),T(c,f=>F(f,o,M(p)?p:{},l.me))})}}}function Xt(e){e.commands.wait=(t,n,r)=>{let o={type:"waitCommand",start:r,end:r,run:()=>{}};if(t.match("for")){t.match("a");let i=o.events=[];do{let a=t.cur();a.type==="NUMBER"||a.op&&a.value==="("?i.push(g(t)):i.push({event:ee(t),args:Oe(t)})}while(t.match("or"));let s=o.from=t.match("from")?g(t):void 0,u=s?t.text(s):"me";o.run=a=>x(s?s.ev(a):a.me,l=>{if(!W(l))throw new Error("Not a valid event target: "+u);return new Promise(c=>{for(let p of i)"event"in p?l.addEventListener(p.event,f=>{a.result=f;for(let d of p.args)a.locals[d]=v(f,d)||v(v(f,"detail"),d)||null;c()},{once:!0}):x(p.ev(a),f=>setTimeout(()=>{a.result=f,c()},b(f)))})})}else{let i;t.match("a")?t.req("tick"):i=o.time=g(t),o.run=s=>x(i?.ev(s),u=>new Promise(a=>setTimeout(a,i?b(u):0)))}return o.end=t.endPos(),o}}function Zt(e){e.commands.log=(t,n,r)=>{let o=[g(t)];for(;t.matchOp(",");)o.push(g(t));let i=t.match("with")?g(t):void 0;return{type:"logCommand",values:o,logger:i,start:r,end:t.endPos(),run:u=>C([i?.ev(u),...o.map(a=>a.ev(u))],([a,...l])=>{q(a)?a(...l):console.log(...l)})}}}function Kt(e){e.commands.get=e.commands.call=(t,n,r)=>{let o=g(t);return n==="call"&&o.type!=="functionCall"&&t.err("Must be a function invocation"),{type:"getCommand",value:o,start:r,end:t.endPos(),run:s=>x(o.ev(s),u=>{s.result=u})}}}function en(e){e.pseudo=(t,n)=>{let r=t.tok(1);if(!(r.op&&(r.value==="."||r.value==="(")))return;let o=Se(t);o.type!=="functionCall"&&t.err("Pseudo-commands must be function calls");let i=o.root,s="args"in o&&Array.isArray(o.args)?o.args:[],u;i&&!i.root&&(t.matchAny("the","to","on","with","into","from","at")?u=g(t):t.match("me")&&(u=j(t)));let a=i?.name??"",l=u?t.text(u):"",c=t.text(o),p=u;return{type:"pseudoCommand",value:o,target:u,start:n,end:t.endPos(),run:d=>p?C([p.ev(d),...s.map(m=>m.ev(d))],([m,...h])=>{S(m,l),d.result=Re(v(m,a),m,h,d,c),xe(m,a)}):x(o.ev(d),m=>{d.result=m})}}}function nn(e){e.commands.set=(t,n,r)=>nr(t,r)}function nr(e,t){{if(e.cur().op&&e.cur().value==="{"){let i=nt(e);e.req("on");let s=g(e);return{type:"setCommand",target:s,object:i,start:t,end:e.endPos(),run:a=>C([i.ev(a),s.ev(a)],([l,c])=>void Object.assign(Object(c),l))}}let n=e.withFollow(["to"],()=>se(e));e.req("to");let r=g(e);return{type:"setCommand",target:n,value:r,start:t,end:e.endPos(),run:i=>C([n.lhs?.(i),r.ev(i)],([s,u])=>n.put?.(i,s,u))}}}function rn(e){for(let t of["increment","decrement"]){let n=t==="increment"?1:-1;e.commands[t]=(r,o,i)=>{let s=r.withFollow(n<0?["by"]:[],()=>se(r)),u=r.match("by")?g(r):void 0;return{type:`${t}Command`,target:s,amount:u,start:i,end:r.endPos(),run:l=>C([s.ev(l),u?.ev(l),s.lhs?.(l)],([c,p,f])=>{let d=(c?parseFloat(String(c)):0)+n*(u?parseFloat(String(p)):1);l.result=d,s.put?.(l,f,d)})}}}}function tn(e,t){e.replaceChildren(fe(t)),U.process(e)}var rr=["arrayIndex","propertyAccess","possessive","ofExpression","attributeRef","styleRef","attributeRefAccess"],or={into:"into",before:"before",after:"after",start:"start",end:"end"},sr={before:"before",after:"after",start:"prepend",end:"append"};function on(e){e.commands.put=(t,n,r)=>{let o=g(t),i=t.matchAny("into","before","after");!i&&t.match("at")&&(t.match("the"),i=t.matchAny("start","end"),t.req("of"));let s=or[(i??t.expected("into","before","at start of","at end of","after")).value],u=Ae(g(t)),a=t.text(u),l=(f,d)=>u.type==="symbol"?x(u.ev(f),m=>{R(m)||m instanceof Document?tn(m,d):u.put?.(f,void 0,d)}):rr.includes(u.type)?x(u.lhs?.(f),m=>u.put?.(f,m,d)):x(u.ev(f),m=>{S(m,a),T(m,h=>{(R(h)||h instanceof Document)&&tn(h,d)})}),c=(f,d,m)=>x(u.ev(f),h=>{if(S(h,a),Array.isArray(h)){m==="prepend"?h.unshift(d):h.push(d),k.wroteProperty(h);return}T(h,E=>{R(E)&&(E[m](d instanceof Node?d:fe(d)),U.process(E.parentElement??E))})});return{type:"putCommand",value:o,operation:s,target:u,start:r,end:t.endPos(),run:f=>x(o.ev(f),d=>s==="into"?l(f,d):c(f,d,sr[s]))}}}var sn=new WeakSet;function an(e){if(sn.has(e))return;sn.add(e);let t=!1,n=o=>{let i=t;t=!0;try{o()}finally{t=i}};document.addEventListener("htmx:load",o=>n(()=>e.process(o.detail?.elt))),document.addEventListener("htmx:after:process",o=>n(()=>e.process(o.target))),document.addEventListener("fx:swapped",o=>{let i=o.detail?.cfg?.target;e.process(i instanceof Element&&i.isConnected?i.parentElement??i:document.body)});let r=Reflect.get(globalThis,"htmx");typeof r?.process=="function"&&(e.addAfterProcessHook(o=>{t||n(()=>r.process(o))}),r.version?.startsWith("4")&&r.registerExtension?.("hs-include",{htmx_config_request(o,i){let s=i?.ctx;if(!s)return;let u=ir(s.sourceElement||o);if(!u)return;let a=ur(u.value,u.scopeElt),l=s.request?.body;if(l instanceof FormData)for(let c in a)l.set(c,a[c])}}))}function ir(e){let t=e.getAttribute("hs-include");if(t!==null)return{value:t,scopeElt:e};for(let n=e.parentElement;n;n=n.parentElement){let r=n.getAttribute("hs-include:inherited");if(r!==null)return{value:r,scopeElt:n}}return null}var Fe=e=>e&&J(e)?.scopes?.elementScope||{};function Le(e){if(e==null)return"";if(typeof e=="object")try{return JSON.stringify(e)}catch{return""}return String(e)}function ar(e,t){for(let n=t;n;n=n.parentElement){let r=Fe(n);if(e in r)return r[e]}}function ur(e,t){let n={},r=e.trim();if(r==="*"){let o=Fe(t);for(let i of Object.keys(o))n[i[0]===":"?i.slice(1):i]=Le(o[i]);return n}for(let o of r.split(","))if(o=o.trim(),!!o){if(o[0]===":"){let i=Fe(t);o in i&&(n[o.slice(1)]=Le(i[o]))}else if(o[0]==="^"){let i=ar(":"+o.slice(1),t);i!==void 0&&(n[o.slice(1)]=Le(i))}else if(o[0]==="#"){let i=o.lastIndexOf(":");if(i>0){let s=Fe(document.querySelector(o.slice(0,i))),u=o.slice(i+1);":"+u in s&&(n[u]=Le(s[":"+u]))}}}return n}var te=class extends Error{constructor(n,r,o,i){super(n);this.token=r;this.source=o;this.expected=i}written},un=()=>({commands:Object.create(null),features:Object.create(null),leaves:[],indirects:[],unaries:[],postfixes:[],collections:[]}),_e=class e{constructor(t,n,r){this.g=t;this.tokens=n;this.src=r;let o=r.length;this.eof={type:"EOF",value:"<<<EOF>>>",start:o,end:o,line:0,column:0},this.last=this.eof,this.skipWs()}i=0;follows=[];eof;last;child(t,n){return new e(this.g,t,n)}tok(t=0,n=!1){let r=this.i;for(;;){if(!n)for(;this.tokens[r]?.type==="WHITESPACE";)r++;if(t--===0)return this.tokens[r]??this.eof;r++}}cur(){return this.tokens[this.i]??this.eof}hasMore(){return this.i<this.tokens.length}pos(){return this.cur().start}endPos(){return this.last.end}text(t){return this.src.substring(t.start,t.end)}match(t,n="IDENTIFIER"){if(this.follows.includes(t))return;let r=this.cur();if(r.value===t&&r.type===n)return this.consume()}matchOp(t){let n=this.cur();if(n.op&&n.value===t)return this.consume()}matchType(...t){if(t.includes(this.cur().type))return this.consume()}matchAny(...t){for(let n of t){let r=this.match(n);if(r)return r}}matchAnyOp(...t){for(let n of t){let r=this.matchOp(n);if(r)return r}}req(t){return this.match(t)??this.expected(t)}reqOp(t){return this.matchOp(t)??this.expected(t)}reqType(...t){return this.matchType(...t)??this.expected(...t)}peek(t,n=0,r="IDENTIFIER"){let o=this.tok(n);if(o.value===t&&o.type===r)return o}consume(){return this.hasMore()?(this.last=this.tokens[this.i++],this.skipWs(),this.last):this.eof}skipWs(){for(;this.tokens[this.i]?.type==="WHITESPACE";)this.i++}consumeUntil(t,n){let r=[],o=this.cur();for(;(n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF";)r.push(o),this.i++,o=this.cur();return this.skipWs(),r}lastWs(){let t=this.tokens[this.i-1];return t?.type==="WHITESPACE"?t.value:""}pushFollow(...t){return this.follows.push(...t),t.length}popFollow(t=1){this.follows.length-=t}withFollow(t,n){let r=this.pushFollow(...t);try{return n()}finally{this.popFollow(r)}}withoutFollows(t){let n=this.follows;this.follows=[];try{return t()}finally{this.follows=n}}err(t,n){let r=this.cur();throw new te(t??"Unexpected Token : "+r.value,r,this.src,n)}expected(...t){this.err(t.length===1?`Expected '${t[0]}' but found '${this.cur().value}'`:"Expected one of: "+t.map(n=>`'${n}'`).join(", "),t)}commandStart(t){return t.value in this.g.commands}featureStart(t){return t.value in this.g.features}commandBoundary(t){return["end","then","else","otherwise",")"].includes(t.value)||this.commandStart(t)||this.featureStart(t)||t.type==="EOF"}};function at(e){let t=e.source.split(`
|
|
6
6
|
`),n=e.token.line?e.token.line-1:t.length-1,r=t[n]??"",o=e.token.line?e.token.column:Math.max(0,r.length-1),i=String(n+1).length,s=" ".repeat(i+5+o);return` ${n+1} | ${r}
|
|
7
7
|
`+s+"^".repeat(Math.max(1,e.token.value.length))+`
|
|
8
8
|
`+s+e.message+`
|
|
9
|
-
`}var
|
|
9
|
+
`}var dn=un();function fn(...e){for(let t of e)t(dn)}var mn=e=>new _e(dn,he(e),e);function cr(e){let t=mn(e),n=rt(t);return t.hasMore()&&t.err(),n}function pn(e){let t=mn(e),n=t.cur(),r=t.commandStart(n)?{kind:"commands",commands:Y(t)}:t.featureStart(n)?{kind:"features",program:rt(t)}:{kind:"expression",expression:g(t)};return t.hasMore()&&t.err(),r}function cn(e,t){let n;try{n=pn(e)}catch(i){throw i instanceof te?new Error(i.message+`
|
|
10
10
|
|
|
11
|
-
`+
|
|
11
|
+
`+at(i)):i}let r=document.body;if(n.kind==="features"){for(let i of n.program.features)i.install(r,r);return}let o=Object.assign(pe(r,void 0,r,null),t);return n.kind==="expression"?n.expression.ev(o):x($(n.commands,o),i=>{let s=v(i,"k")==="return"?v(i,"value"):void 0;return s!==void 0?s:o.result})}var hn=()=>K.attributes.replaceAll(" ","").split(","),yn=e=>e instanceof HTMLScriptElement&&e.type==="text/hyperscript";function lr(e){for(let t of hn())if(e.hasAttribute(t))return e.getAttribute(t);return yn(e)?e.innerText:null}var dr=e=>{let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return t},gn=[];function ln(e){if(e.closest(K.disableSelector))return;let t=lr(e);if(!t)return;let n=dr(t);if(J(e)?.initialized){if(J(e)?.scriptHash===n)return U.enter(e);Me(e)}if(!F(e,"hyperscript:before:init"))return;Object.assign(X(e),{initialized:!0,scriptHash:n});let r=yn(e)?document.body:e,o=t;try{for(let s of gn)o=s(o,e)??o;let{features:i}=cr(o);U.enter(e);for(let s of i)s.install(r,e);e.setAttribute("data-hyperscript-powered","true"),F(e,"hyperscript:after:init"),setTimeout(()=>F(r,"load",{hyperscript:!0}),1)}catch(i){if(i instanceof te){o!==t&&(i.written=t),F(e,"hyperscript:parse-error",{errors:[i]});let s=i.written?`
|
|
12
12
|
rewritten from: ${i.written}
|
|
13
13
|
`:"";console.error("hyperscript: 1 parse error(s) on:",e,`
|
|
14
14
|
|
|
15
|
-
`+
|
|
15
|
+
`+at(i)+s)}else F(e,"exception",{error:i}),console.error("hyperscript errors were found on the following element:",e,`
|
|
16
16
|
|
|
17
|
-
`,i)}}var
|
|
17
|
+
`,i)}}var wn=[],vn=[],ut=new Set;function we(e){if((e instanceof Element||e instanceof Document||e instanceof DocumentFragment)&&!ut.has(e)){ut.add(e);try{for(let n of wn)n(e);let t=hn().map(n=>`[${n}]`).join(", ")+", [type='text/hyperscript']";e instanceof Element&&e.matches(t)&&ln(e),e.querySelectorAll(t).forEach(ln);for(let n of vn)n(e)}finally{ut.delete(e)}}}function Me(e){let t=J(e);if(t){F(e,"hyperscript:before:cleanup");for(let{target:n,event:r,handler:o}of t.listeners??[])n.removeEventListener(r,o);for(let n of t.observers??[])n.disconnect();for(let n of t.timers??[])clearTimeout(n);k.stop(e),e.querySelectorAll("[data-hyperscript-powered]").forEach(Me),F(e,"hyperscript:after:cleanup"),e.removeAttribute("data-hyperscript-powered"),mt(e)}}U.process=we;function fr(e){try{let t=pn(e);return t.kind==="features"?{...t.program,errors:[]}:{...t.kind==="commands"?t.commands[0]:t.expression,errors:[]}}catch(t){if(t instanceof te)return{errors:[t]};throw t}}var ct=Object.assign(cn,{config:Object.assign(K,{conversions:Object.assign(He,{dynamicResolvers:De})}),use(e){e(ct)},addBeforeProcessHook:e=>void wn.push(e),addAfterProcessHook:e=>void vn.push(e),addSourceTransform:e=>void gn.push(e),evaluate:cn,parse:fr,process:we,processNode:we,cleanup:Me,internals:{runtime:{cleanup:Me,processNode:we}},version:"7.4.0"});function En(){if(Object.assign(globalThis,{_hyperscript:ct}),typeof document>"u")return;let e=()=>{we(document.documentElement),document.dispatchEvent(new Event("hyperscript:ready")),an(ct)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):setTimeout(e)}function mr(e,t){if(typeof e!="object"||e===null)return{queue:[],executing:!1};let n=X(e).eventQueues??=new Map,r=n.get(t);return r||n.set(t,r={queue:[],executing:!1}),r}function lt(e,t){let n=mr(e.me,t);if(n.executing&&!t.every){if(t.queue==="none"||t.queue==="first"&&n.queue.length>0)return;t.queue!=="all"&&(n.queue.length=0),n.queue.push(e);return}n.executing=!0;let r=o=>{n.executing=!1;let i=n.queue.shift();if(i&&setTimeout(()=>lt(i,t),1),o){let{error:s}=o;console.error(v(s,"message")??s),console.error(v(s,"stack")),F(e.me,"exception",{error:s})}};ue(()=>x(vt(e,t.body,t),()=>r()),o=>r({error:o}))}function pr(e,t){if(!W(t))return;let n=X(t),r=n.listeners??=[],o=n.observers??=[],i=n.timers??=new Set;for(let s of e.events){let u={execCount:0},a=s.elsewhere?[document]:s.from?s.from.ev(pe(t,e,t,null)):[t];T(a,l=>{if(!W(l)){console.warn("'%s' feature ignored because target does not exists:",e.displayName,t);return}let c=s.on;if(s.mutationSpec&&l instanceof Node){c="hyperscript:mutation";let f=new MutationObserver(d=>F(l,c,{mutationList:d,observer:f}));f.observe(l,s.mutationSpec),o.push(f)}if(s.intersectionSpec&&l instanceof Element){c="hyperscript:intersection";let f=new IntersectionObserver(d=>{for(let m of d)F(l,c,{observer:f,entry:m,intersecting:m.isIntersecting,isIntersecting:m.isIntersecting,intersectionRatio:m.intersectionRatio})},s.intersectionSpec);f.observe(l),o.push(f)}if(s.resizeSpec&&l instanceof Element){c="hyperscript:resize";let f=new ResizeObserver(d=>{for(let m of d){let{width:h,height:E}=m.contentRect;F(l,c,{width:h,height:E,contentRect:m.contentRect,entry:m})}});f.observe(l),o.push(f)}let p=f=>{if(t instanceof Node&&l!==t&&!t.isConnected){l.removeEventListener(c,p);return}let d=pe(t,e,t,f);if(!(s.elsewhere&&t instanceof Node&&f.target instanceof Node&&t.contains(f.target))){s.from&&(d.result=l);for(let m of s.args){let h=v(f,m);h!==void 0?d.locals[m]=h:d.detail!=null&&(d.locals[m]=v(d.detail,m))}if(s.filter){d.meta.context=f;try{if(!s.filter.ev(d))return}finally{d.meta.context=void 0}}if(s.inExpr?.css){let m=f.target instanceof Element?f.target:null;for(;m&&!m.matches(s.inExpr.css);)m=m.parentElement;if(!m)return;d.result=m}if(u.execCount++,s.startCount){let m=u.execCount;if(s.endCount?m<s.startCount||m>s.endCount:s.unbounded?m<s.startCount:m!==s.startCount)return}if(s.debounceTime){u.debounced&&(clearTimeout(u.debounced),i.delete(u.debounced)),i.add(u.debounced=setTimeout(()=>lt(d,e),s.debounceTime));return}if(s.throttleTime){if(u.lastExec&&Date.now()<u.lastExec+s.throttleTime)return;u.lastExec=Date.now()}lt(d,e)}};l.addEventListener(c,p),r.push({target:l,event:c,handler:p})})}}function hr(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 yr(e){let t={};if(e.match("with")){let n=ye(g(e));n instanceof Element&&(t.root=n)}if(e.match("having"))do e.match("margin")?t.rootMargin=At(e):e.match("threshold")?t.threshold=Number(ye(g(e))):e.err("Unknown intersection config specification");while(e.match("and"));return t}function gr(e,t){let n=ee(e),r=Oe(e),o;e.matchOp("[")&&(o=g(e),e.reqOp("]"));let i,s,u=!1;t?i=1:e.cur().type==="NUMBER"&&(i=parseInt(e.consume().value),e.match("to")?s=parseInt(e.consume().value):e.match("and")&&(u=!0,e.req("on")));let a={on:n,args:r,filter:o,startCount:i,endCount:s,unbounded:u,elsewhere:!1,resizeSpec:n==="resize"};n==="intersection"?a.intersectionSpec=yr(e):n==="mutation"&&(a.mutationSpec=hr(e)),e.match("from")&&(e.match("elsewhere")?a.elsewhere=!0:a.from=e.withFollow(["or"],()=>g(e))),!a.from&&!a.elsewhere&&e.match("elsewhere")&&(a.elsewhere=!0),e.match("in")&&(a.inExpr=z(e));let l=()=>(e.req("at"),Number(ye(z(e))));return e.match("debounced")?a.debounceTime=l():e.match("throttled")&&(a.throttleTime=l()),a}function xn(e){e.features.on=(t,n)=>{let r=!!t.match("every"),o=!r&&!!t.match("first"),i=[];do i.push(gr(t,o));while(t.match("or"));let s="last";!r&&t.match("queue")&&(t.match("all")?s="all":t.match("first")?s="first":t.match("none")?s="none":t.req("last"));let u=Y(t),a={type:"onFeature",displayName:"on "+i.map(l=>l.on).join(" or "),events:i,body:u,every:r,queue:s,...qt(t),start:n,end:t.endPos(),install:l=>pr(a,l)};return a}}fn(xn,Vt,Bt,Qt,Yt,nn,on,rn,Ht,Dt,Jt,Xt,Zt,Kt,en);En();})();
|