subscript 10.7.1 → 10.7.3

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/README.md CHANGED
@@ -111,15 +111,17 @@ See [docs.md](./docs.md) for full API.
111
111
  ## Safety
112
112
 
113
113
  Blocked by default:
114
- - `__proto__`, `__defineGetter__`, `__defineSetter__`
114
+ - `__proto__` and any other `__*` property
115
115
  - `constructor`, `prototype`
116
- - Global access (only context is visible)
116
+ - Globals outside the supplied context
117
117
 
118
118
  ```js
119
- subscript('constructor.constructor("alert(1)")()')({})
120
- // undefined (blocked)
119
+ subscript('constructor')({}) // undefined
120
+ subscript('constructor.constructor("alert(1)")')({}) // undefined
121
121
  ```
122
122
 
123
+ Context values are capabilities. Do not pass reflection helpers such as `Reflect.get` or `Object.getOwnPropertyDescriptor` to untrusted expressions.
124
+
123
125
  ## Performance
124
126
 
125
127
  Parsing `a + b * c - d / e + f.g[0](h) + i.j`, 30k iterations — each iteration parses an unseen source, so source-keyed compile caches (`new Function`, angular-expressions) don't help:
package/eval/access.js CHANGED
@@ -1,8 +1,12 @@
1
1
  // Property access - eval half
2
2
  import { operator, compile } from '../parse.js';
3
3
 
4
- // Block prototype chain attacks
5
- export const unsafe = k => k?.[0] === '_' && k[1] === '_' || k === 'constructor' || k === 'prototype';
4
+ const isObject = value => value != null && (typeof value === 'object' || typeof value === 'function');
5
+ // Coerce object keys once and preserve Symbol results.
6
+ export const toKey = key => isObject(key) ? Reflect.ownKeys({ [key]: 0 })[0] : key;
7
+ export const unsafeName = key => typeof key === 'string' && (key[0] === '_' && key[1] === '_' || key === 'constructor' || key === 'prototype');
8
+ export const unsafe = key => unsafeName(toKey(key));
9
+ compile.id = node => node === undefined || unsafe(node) ? () => undefined : ctx => ctx?.[node];
6
10
 
7
11
  const err = msg => { throw Error(msg) };
8
12
  operator('[]', (a, b) => {
@@ -15,9 +19,9 @@ operator('[]', (a, b) => {
15
19
  // Member access: a[b]
16
20
  if (b == null) err('Missing index');
17
21
  a = compile(a); b = compile(b);
18
- return ctx => { const k = b(ctx); return unsafe(k) ? undefined : a(ctx)[k]; };
22
+ return ctx => { const k = toKey(b(ctx)); return unsafeName(k) ? undefined : a(ctx)[k]; };
19
23
  });
20
- operator('.', (a, b) => (a = compile(a), b = !b[0] ? b[1] : b, unsafe(b) ? () => undefined : ctx => a(ctx)[b]));
24
+ operator('.', (a, b) => (a = compile(a), b = toKey(!b[0] ? b[1] : b), unsafeName(b) ? () => undefined : ctx => a(ctx)[b]));
21
25
  operator('()', (a, b) => {
22
26
  // Group: (expr) - no second argument means grouping, not call
23
27
  if (b === undefined) return a == null ? err('Empty ()') : compile(a);
@@ -28,7 +32,10 @@ operator('()', (a, b) => {
28
32
  b[0] === ',' ? (b = b.slice(1).map(compile), ctx => b.map(arg => arg(ctx))) :
29
33
  (b = compile(b), ctx => [b(ctx)]);
30
34
  // Inline call handling for x(), a.b(), a[b](), (x)()
31
- return call(a, (obj, path, ctx) => obj[path](...args(ctx)));
35
+ const guard = callGuard(a);
36
+ return guard < 0 ? () => undefined : call(a, guard ?
37
+ (obj, path, ctx) => (path = toKey(path), unsafeName(path) ? undefined : obj[path](...args(ctx))) :
38
+ (obj, path, ctx) => obj[path](...args(ctx)));
32
39
  });
33
40
 
34
41
  // Left-value check (valid assignment target)
@@ -53,5 +60,16 @@ const call = (a, fn, obj, path) => (
53
60
  (a = compile(a), ctx => fn([a(ctx)], 0, ctx))
54
61
  );
55
62
 
56
- // Export as prop for backward compatibility with other features
57
- export const prop = call;
63
+ // Calls bypass member-read compilation to preserve `this`. Classify the key
64
+ // once: -1 blocked, 0 statically safe, 1 dynamic (guard at evaluation time).
65
+ const keyGuard = key => isObject(key) ? 1 : unsafeName(key) ? -1 : 0;
66
+ const callGuard = (a, op = a?.[0], key = a?.[2]) =>
67
+ typeof a === 'string' ? keyGuard(a) :
68
+ op === '()' && a.length == 2 ? callGuard(a[1]) :
69
+ op === '.' || op === '?.' ? keyGuard(key) :
70
+ (op === '[]' || op === '?.[]') && a.length === 3 ?
71
+ Array.isArray(key) && key[0] == null ? keyGuard(key[1]) : 1 : 0;
72
+
73
+ // Guard property references used by assignment-style operators too.
74
+ export const prop = (a, fn, guard = callGuard(a)) => guard < 0 ? () => undefined : call(a, guard ?
75
+ (obj, key, ctx) => (key = toKey(key), unsafeName(key) ? undefined : fn(obj, key, ctx)) : fn);
package/eval/class.js CHANGED
@@ -9,18 +9,20 @@ operator('class', (name, base, body) => {
9
9
  base = base ? compile(base) : null;
10
10
  body = body ? compile(body) : null;
11
11
  return ctx => {
12
- const Parent = base ? base(ctx) : Object;
12
+ const Parent = base?.(ctx);
13
13
  const cls = function(...args) {
14
14
  if (!(this instanceof cls)) return err('Class constructor must be called with new');
15
15
  const instance = base ? Reflect.construct(Parent, args, cls) : this;
16
16
  if (cls.prototype.__constructor__) cls.prototype.__constructor__.apply(instance, args);
17
17
  return instance;
18
18
  };
19
- Object.setPrototypeOf(cls.prototype, Parent.prototype);
20
- Object.setPrototypeOf(cls, Parent);
19
+ if (base) {
20
+ Object.setPrototypeOf(cls.prototype, Parent.prototype);
21
+ Object.setPrototypeOf(cls, Parent);
22
+ }
21
23
  if (body) {
22
24
  const methods = Object.create(ctx);
23
- methods['super'] = Parent;
25
+ if (base) methods['super'] = Parent;
24
26
  const entries = body(methods);
25
27
  const items = Array.isArray(entries) && typeof entries[0]?.[0] === 'string' ? entries : [];
26
28
  for (const [k, v] of items) {
@@ -1,23 +1,34 @@
1
1
  // Optional chaining operators - eval half
2
2
  import { operator, compile } from '../../parse.js';
3
- import { unsafe } from '../access.js';
3
+ import { toKey, unsafeName } from '../access.js';
4
4
 
5
- operator('?.', (a, b) => (a = compile(a), unsafe(b) ? () => undefined : ctx => a(ctx)?.[b]));
6
- operator('?.[]', (a, b) => (a = compile(a), b = compile(b), ctx => { const k = b(ctx); return unsafe(k) ? undefined : a(ctx)?.[k]; }));
5
+ operator('?.', (a, b) => (a = compile(a), b = toKey(b), unsafeName(b) ? () => undefined : ctx => a(ctx)?.[b]));
6
+ operator('?.[]', (a, b) => (a = compile(a), b = compile(b), ctx => {
7
+ const obj = a(ctx);
8
+ if (obj == null) return undefined;
9
+ const key = toKey(b(ctx));
10
+ return unsafeName(key) ? undefined : obj[key];
11
+ }));
7
12
  operator('?.()', (a, b) => {
8
13
  const args = !b ? () => [] :
9
14
  b[0] === ',' ? (b = b.slice(1).map(compile), ctx => b.map(arg => arg(ctx))) :
10
15
  (b = compile(b), ctx => [b(ctx)]);
11
16
 
12
- // ?.() always null-short-circuits, so . and ?. produce identical code.
13
- // The only real distinction is static key vs dynamic key.
17
+ // Preserve whether the member access itself is optional.
14
18
  if (a[0] === '.' || a[0] === '?.') {
15
- const obj = compile(a[1]), key = a[2];
16
- return unsafe(key) ? () => undefined : ctx => obj(ctx)?.[key]?.(...args(ctx));
19
+ const optional = a[0] === '?.', obj = compile(a[1]), key = toKey(a[2]);
20
+ return unsafeName(key) ? () => undefined : optional ?
21
+ ctx => obj(ctx)?.[key]?.(...args(ctx)) :
22
+ ctx => obj(ctx)[key]?.(...args(ctx));
17
23
  }
18
24
  if ((a[0] === '[]' || a[0] === '?.[]') && a.length === 3) {
19
- const obj = compile(a[1]), key = compile(a[2]);
20
- return ctx => { const k = key(ctx); return unsafe(k) ? undefined : obj(ctx)?.[k]?.(...args(ctx)); };
25
+ const optional = a[0] === '?.[]', obj = compile(a[1]), key = compile(a[2]);
26
+ return ctx => {
27
+ const value = obj(ctx);
28
+ if (optional && value == null) return undefined;
29
+ const k = toKey(key(ctx));
30
+ return unsafeName(k) ? undefined : value[k]?.(...args(ctx));
31
+ };
21
32
  }
22
33
  const fn = compile(a);
23
34
  return ctx => fn(ctx)?.(...args(ctx));
package/eval/op/spread.js CHANGED
@@ -1,4 +1,9 @@
1
1
  // Spread/rest operator - eval half (for arrays/objects spread)
2
2
  import { operator, compile } from '../../parse.js';
3
+ import { unsafeName } from '../access.js';
3
4
 
4
- operator('...', a => (a = compile(a), ctx => Object.entries(a(ctx))));
5
+ operator('...', a => (a = compile(a), ctx => {
6
+ const obj = a(ctx), entries = [];
7
+ for (const key of Object.keys(obj)) if (!unsafeName(key)) entries.push([key, obj[key]]);
8
+ return entries;
9
+ }));
package/eval/prop.js CHANGED
@@ -1,16 +1,2 @@
1
- // Minimal property access - eval half
2
- import { operator, compile } from '../parse.js';
3
-
4
- const err = msg => { throw Error(msg) };
5
- operator('[]', (a, b) => (b == null && err('Missing index'), a = compile(a), b = compile(b), ctx => a(ctx)[b(ctx)]));
6
- operator('.', (a, b) => (a = compile(a), b = !b[0] ? b[1] : b, ctx => a(ctx)[b]));
7
- operator('()', (a, b) => {
8
- // Group: (expr) - no second argument means grouping, not call
9
- if (b === undefined) return a == null ? err('Empty ()') : compile(a);
10
- // Function call: a(b,c)
11
- const args = !b ? () => [] :
12
- b[0] === ',' ? (b = b.slice(1).map(compile), ctx => b.map(arg => arg(ctx))) :
13
- (b = compile(b), ctx => [b(ctx)]);
14
- a = compile(a);
15
- return ctx => a(ctx)(...args(ctx));
16
- });
1
+ // Minimal property syntax uses the canonical guarded runtime.
2
+ export * from './access.js';
package/eval/var.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // Variable declarations: let, const, var - eval half
2
2
  import { operator, compile } from '../parse.js';
3
+ import { toKey, unsafeName } from './access.js';
3
4
 
4
5
  // Flatten comma into array: [',', a, b, c] → [a, b, c]
5
6
  const flatten = items => items[0]?.[0] === ',' ? items[0].slice(1) : items;
@@ -15,7 +16,7 @@ export const destructure = (pattern, value, ctx) => {
15
16
  // Rest: {...rest}
16
17
  if (Array.isArray(item) && item[0] === '...') {
17
18
  const rest = {};
18
- for (const k in value) if (!used.includes(k)) rest[k] = value[k];
19
+ for (const k in value) if (!used.includes(k) && !unsafeName(k)) rest[k] = value[k];
19
20
  ctx[item[1]] = rest;
20
21
  break;
21
22
  }
@@ -26,8 +27,8 @@ export const destructure = (pattern, value, ctx) => {
26
27
  if (typeof item === 'string') { key = binding = item }
27
28
  else if (item[0] === '=') { typeof item[1] === 'string' ? (key = binding = item[1]) : ([, key, binding] = item[1]); def = item[2] }
28
29
  else { [, key, binding] = item }
29
- used.push(key);
30
- let val = value[key];
30
+ used.push(key = toKey(key));
31
+ let val = unsafeName(key) ? undefined : value[key];
31
32
  if (val === undefined && def) val = compile(def)(ctx);
32
33
  destructure(binding, val, ctx);
33
34
  }
@@ -26,6 +26,15 @@ const isMethodKey = a =>
26
26
  typeof a === 'string' ||
27
27
  (Array.isArray(a) && (a[0] === undefined || a[0] === '[]'));
28
28
 
29
+ // The token dispatcher rewinds idx on failure; speculative member parsing
30
+ // must also restore the ASI flags before an expression handler retries.
31
+ const speculate = handler => a => {
32
+ const newline = parse.newline, semi = parse.semi;
33
+ const node = handler(a);
34
+ if (!node) { parse.newline = newline; parse.semi = semi; }
35
+ return node;
36
+ };
37
+
29
38
  // Shared parser for get/set — returns false if not valid accessor pattern (falls through to identifier)
30
39
  // Returns false (not undefined) to signal "fall through without setting reserved"
31
40
  const accessor = (kind) => a => {
@@ -45,8 +54,8 @@ const accessor = (kind) => a => {
45
54
  return [kind, name, params, expr(0, CBRACE)];
46
55
  };
47
56
 
48
- token('get', ASSIGN - 1, accessor('get'));
49
- token('set', ASSIGN - 1, accessor('set'));
57
+ token('get', ASSIGN - 1, speculate(accessor('get')));
58
+ token('set', ASSIGN - 1, speculate(accessor('set')));
50
59
 
51
60
  // Generator method: { *g() {} } / class { *g() {} } / static *g() {}
52
61
  // → [':', key, ['function*', null, params, body]] (≡ g: function* () {})
@@ -62,7 +71,7 @@ const paramish = n => n == null || typeof n === 'string' ||
62
71
  n[0] === '=' ? typeof n[1] === 'string' || paramish(n[1]) :
63
72
  n[0] === '...' || n[0] === '{}' || n[0] === '[]'));
64
73
  const multPrec = prec['*'];
65
- token('*', TOKEN, a => {
74
+ token('*', TOKEN, speculate(a => {
66
75
  // Infix `*` is multiplication — EXCEPT at a member boundary: class bodies
67
76
  // have no separators, so `ctor() {} *g() {}` reaches here with the previous
68
77
  // member as `a` (ASI can't split on `*`: `x \n * y` must stay a product).
@@ -83,14 +92,14 @@ token('*', TOKEN, a => {
83
92
  skip();
84
93
  const node = [':', name, ['function*', null, params, expr(0, CBRACE) || null]];
85
94
  return a ? (a[0] === ';' ? (a.push(node), a) : [';', a, node]) : node;
86
- });
95
+ }));
87
96
  prec['*'] = multPrec;
88
97
 
89
98
  // Method shorthand: { foo() {} } / { async foo() {} } / class { static foo() {} }
90
99
  // → [':', key, ['=>', ['()', params], body]]
91
100
  // Accepts identifier, string-literal node [, "..."], ['async', key] from
92
101
  // async.js, or ['static', key] from unary('static').
93
- token('(', ASSIGN - 1, a => {
102
+ token('(', ASSIGN - 1, speculate(a => {
94
103
  if (!a) return;
95
104
  // ['static', key] from unary('static'): unwrap, re-wrap the resulting method node.
96
105
  // ['async', key] from async.js: unwrap, wrap the method value in async.
@@ -108,4 +117,4 @@ token('(', ASSIGN - 1, a => {
108
117
  if (isAsync) value = ['async', value];
109
118
  const node = [':', a, value];
110
119
  return wrap ? [wrap, node] : node;
111
- });
120
+ }));
package/jessie.min.js CHANGED
@@ -1,7 +1,7 @@
1
- var l,c,s=r=>(l=0,c=r,s.enter?.(),r=a(),c[l]?I():r||""),I=(r="Unexpected token",e=l,t=c.slice(0,e).split(`
2
- `),o=t.pop(),n=c.slice(Math.max(0,e-40),e),p="\u032D",m=(c[e]||" ")+p,u=c.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
3
- ${n}${m}${u}`)},Be=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),E=(r,e=l,t)=>{for(;t=r(c.charCodeAt(l));)l+=t;return c.slice(e,l)},h=(r=1)=>c[l+=r],T=r=>l=r,a=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,a));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):I("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},W=(r=l)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Ro=s.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,S=(r,e=r.length)=>c.substr(l,e)===r&&!s.id(c.charCodeAt(l+e)),L=()=>(h(),a(0,41)),N=[],v={},g=(r,e=32,t,o=r.charCodeAt(0))=>Hr({op:r,l:r.length,p:v[r]=!N[o]&&v[r]||e,map:t,word:r.toUpperCase()!==r,kw:!1}),A=(r,e,t=!1)=>g(r,e,(o,n)=>o&&(n=a(e-(t?.5:0)))&&[r,o,n]),_=(r,e,t)=>g(r,e,o=>t?o&&[r,o]:!o&&(o=a(e-.5))&&[r,o]),$=(r,e)=>g(r,200,t=>!t&&[,e]),ir=(r,e,t,o)=>g(r,e,(n,p,m=n)=>(p=a(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),p?.[0]===r?n.push(...p.slice(1)):p?n.push(p):o||W()===r.charCodeAt(0)?n.push(null):m&&n.length===2&&(n=n[1]),n)),z=(r,e)=>g(r[0],e,t=>!t&&[r,a(0,r.charCodeAt(1))||null]),sr=(r,e)=>g(r[0],e,t=>t&&[r,t,a(0,r.charCodeAt(1))||null]),pr=(r,e)=>(s.space(),e=c.charCodeAt(l),s.id(e)&&(e<48||e>57)?E(s.id):a(r)),Gr=(r,e)=>g(r,e,(t,o)=>t&&(o=pr(e))&&[r,t,o]),y=(r,e,t)=>(v[r]??=e,Hr({op:r,l:r.length,p:e,map:t,word:!0,kw:!0})),Fr=(r,e,t=(o,n,p,m=l,u,d,w)=>{for(w=0;d=r[w++];)if(!(d.kw&&o)&&!(p?d.op!==p:!((d.l<2||d.op.charCodeAt(1)===c.charCodeAt(l+1)&&(d.l<3||c.substr(l,d.l)===d.op))&&(!d.word||!s.id(c.charCodeAt(l+d.l)))&&(p=d.op)))&&!(n>=d.p)&&!(d.kw&&s.prop&&!s.prop(l+d.l))){if(l+=d.l,u=d.map(o))return Be(u,m);l=m,p=0,d.word||o||e||r[w]||I()}return e?.(o,n,p)})=>(t.ops=r,t.tail=e,t),Hr=(r,e=r.op.charCodeAt(0),t=N[e])=>N[e]=t?.ops?Fr([r,...t.ops],t.tail):Fr([r],t);s.space=r=>{for(;(r=c.charCodeAt(l))<=32;)l++;return r};s.step=(r,e,t,o,n)=>(n=N[t])&&n(r,e)||(r?null:E(s.id)||null);var nr={},f=(r,e,t=nr[r])=>nr[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):nr[r[0]]?.(...r.slice(1))??I(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var fr=46,H=48,x=57,Xr=69,Qr=101,Me=43,Ue=45,$r=95,Ke=97,De=102,Fe=65,Ge=70,xr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),He=r=>r===fr&&(r=c.charCodeAt(l+1))!==fr&&!(s.id(r)&&r>x&&r!==Qr&&r!==Xr)||r>=H&&r<=x||r===$r||((r===Xr||r===Qr)&&((r=c.charCodeAt(l+1))>=H&&r<=x||r===Me||r===Ue)?2:0),lr=r=>(r=+xr(E(He)))!=r?I():[,r],Xe=r=>e=>e===$r||e>=H&&e<=x&&e-H<r||r===16&&(e>=Ke&&e<=De||e>=Fe&&e<=Ge);s.number=null;N[fr]=r=>!r&&c.charCodeAt(l+1)>=H&&c.charCodeAt(l+1)<=x&&lr();for(let r=H;r<=x;r++)N[r]=e=>e?void 0:lr();N[H]=(r,e)=>{if(!r){for(let t in s.number)if(t[0]==="0"&&(c.charCodeAt(l+1)|32)===t.charCodeAt(1)){h(2);let o=xr(E(Xe(e=s.number[t])));return[,parseInt(o,e)]}return lr()}};var Qe=92,jr=34,Wr=39,zr=117,Jr=120,$e=123,xe=125,Vr=10,je=13,We={n:`
4
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Yr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,ur=()=>{let r=c.charCodeAt(l+1);if(r===Vr)return["",2];if(r===je)return["",c.charCodeAt(l+2)===Vr?3:2];if(r===Jr||r===zr&&c.charCodeAt(l+2)!==$e){let e=r===Jr?2:4,t=0,o;for(let n=0;n<e;n++){if((o=Yr(c.charCodeAt(l+2+n)))<0)return[c[l+1],2];t=t*16+o}return[String.fromCharCode(t),2+e]}if(r===zr){let e=0,t=l+3,o;for(;(o=Yr(c.charCodeAt(t)))>=0;)e=e*16+o,t++;return t>l+3&&e<=1114111&&c.charCodeAt(t)===xe?[String.fromCodePoint(e),t-l+1]:[c[l+1],2]}return[We[c[l+1]]||c[l+1],2]},Zr=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(e||!s.string?.[n])return;h();let p=()=>{let[m,u]=ur();return o+=m,u};return E(m=>m-r&&(m!==Qe?(o+=c[l],1):p())),c[l]===n?h():I("Bad string"),[,o]};N[jr]=Zr(jr);N[Wr]=Zr(Wr);s.string={'"':!0};var ze=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,ze,!0));var Je=30,Ve=40,Ye=140;_("!",Ye);A("||",Je);A("&&",Ve);var Ze=50,qe=60,be=70,qr=100,rt=140;A("|",Ze);A("&",be);A("^",qe);A(">>",qr);A("<<",qr);_("~",rt);var Y=90;A("<",Y);A(">",Y);A("<=",Y);A(">=",Y);var br=80;A("==",br);A("!=",br);var re=110,cr=120,ee=140;A("+",re);A("-",re);A("*",cr);A("/",cr);A("%",cr);_("+",ee);_("-",ee);var Z=150;g("++",Z,r=>r?["++",r,null]:["++",a(Z-1)]);g("--",Z,r=>r?["--",r,null]:["--",a(Z-1)]);var et=5,tt=10;ir(",",tt);ir(";",et,!0,!0);var ot=170;z("()",ot);var te=170,nt=160;sr("[]",te);Gr(".",te);sr("()",nt);var it=s.space;s.comment??={"//":`
5
- `,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=it();){for(t in e=s.comment)if(r===t.charCodeAt(0)&&(t.length<2||c.charCodeAt(l+1)===t.charCodeAt(1))&&(t.length<3||c.substr(l,t.length)===t)){o=e[t],n=c.indexOf(o,l+t.length),T(n<0?c.length:o===`
6
- `?n:n+o.length),r=0;break}if(r)return r}return r};var oe=80;A("===",oe);A("!==",oe);var st=30;A("??",st);var pt=130,ft=20;A("**",pt,!0);A("**=",ft,!0);var ne=90;A("in",ne);A("of",ne);var lt=20,ut=100;A(">>>",ut);A(">>>=",lt,!0);var mr=20;A("||=",mr,!0);A("&&=",mr,!0);A("??=",mr,!0);$("true",!0);$("false",!1);$("null",null);y("undefined",200,()=>[]);$("NaN",NaN);$("Infinity",1/0);var ar=20;g("?",ar,(r,e,t)=>r&&(e=a(ar-1))&&E(o=>o===58)&&(t=a(ar-1),["?",r,e,t]));var ct=20;A("=>",ct,!0);var mt=20;_("...",mt);var ie=170;g("?.",ie,(r,e)=>{if(!r)return;let t=s.space();return t===40?(h(),["?.()",r,a(0,41)||null]):t===91?(h(),["?.[]",r,a(0,93)]):(e=pr(ie),e?["?.",r,e]:void 0)});var dr=140,se=160,at=se+1;_("typeof",dr);_("void",dr);_("delete",dr);var dt=r=>s.space()===40?(h(),["()",r,a(0,41)||null]):r;y("new",at,()=>S(".target")?(h(7),["new.target"]):["new",dt(a(se))]);var ht=20,pe=200;s.prop=r=>W(r)!==58;z("[]",pe);z("{}",pe);A(":",ht-1,!0);var At=170,hr=96,yt=36,wt=123,Ct=92,fe=()=>{let r=[],e="",t,o;for(;(t=c.charCodeAt(l))!==hr;)t?t===Ct?(o=ur(),e+=o[0],h(o[1])):t===yt&&c.charCodeAt(l+1)===wt?(r.push([,e]),e="",h(2),r.push(a(0,125))):(e+=c[l],h()):I("Unterminated template");return r.push([,e]),h(),r},gt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Et=N[hr];N[hr]=(r,e)=>r&&e<At?s.asi&&s.newline?void 0:(h(),["``",r,...fe()]):r?Et?.(r,e):(h(),gt(fe()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var St=92,kt=117,Tt=123,Nt=125,Rt=183,It=s.id,le=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,Ot=(r=l+2,e,t=0,o=0)=>{if(c.charCodeAt(l)!==St||c.charCodeAt(l+1)!==kt)return 0;if(c.charCodeAt(r)===Tt){for(;le(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&c.charCodeAt(r)===Nt?r-l+1:0}for(;o<4&&le(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>It(r)||r===Rt||Ot();var Ar=5,ce=10,yr=r=>{let e=l,t=a(ce-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(T(e),r):t[0]===","?[r,...t.slice(1)]:[r,t]};y("let",Ar+1,()=>yr("let"));y("const",Ar+1,()=>yr("const"));y("var",Ar+1,()=>yr("var"));var ue=r=>Array.isArray(r)&&r[0]==="="&&typeof r[1]=="string";y("using",200,()=>{let r=l;s.space();let e=c.charCodeAt(l);if(s.id(e)&&(e<48||e>57)){let t=l;if(E(s.id),s.space(),c.charCodeAt(l)===61&&c.charCodeAt(l+1)!==61&&c.charCodeAt(l+1)!==62){T(t);let o=a(ce-1);if(o[0]===","?o.slice(1).every(ue):ue(o))return o[0]===","?["using",...o.slice(1)]:["using",o]}}return T(r),"using"});var q=5,_t=59,B=()=>(s.space()===123||I("Expected {"),h(),a(q-.5,125)||null),K=()=>s.space()!==123?a(q+.5):(h(),a(q-.5,125)||null),Lt=()=>{let r=l;return s.space()===_t&&h(),s.space(),S("else")?(h(4),s.semi=!1,!0):(T(r),!1)};y("if",q+1,()=>{s.space();let r=["if",L(),K()];return Lt()&&r.push(K()),r});var vt=200;y("function",vt,()=>{s.space();let r=!1;c[l]==="*"&&(r=!0,h(),s.space());let e=E(s.id);return e&&s.space(),r?["function*",e,L()||null,B()]:["function",e,L()||null,B()]});var b=140,wr=20,Pt=40;_("await",b);var Bt=10,Mt=13,Ut=r=>{let e;for(;(e=c.charCodeAt(r))<=32;){if(e===Bt||e===Mt)return!0;r++}return!1};y("yield",b,()=>Ut(l)?["yield"]:(s.space(),c[l]==="*"?(h(),s.space(),["yield*",a(wr)]):["yield",a(wr)]));y("async",b,()=>{if(s.space(),S("function"))return["async",a(b)];let r=l,e=E(s.id);if(e){if(s.space(),c.charCodeAt(l)===Pt)return["async",e];T(r)}let t=a(wr-.5);return t&&["async",t]});var me=200;var Kt=90,Dt=175,Ft=160,Gt=Ft-.5;_("static",Dt);A("instanceof",Kt);g("#",me,r=>{if(r)return;let e=E(s.id);return e?"#"+e:void 0});y("class",me,()=>{s.space();let r=E(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!S("extends"))return["class",r,null,B()];h(7),s.space()}return["class",r,a(Gt),B()]});var Cr=47,Ht=92,Xt=91,Qt=93;g("/",140,r=>{let e=c.charCodeAt(l);if(r||e===Cr||e===42||e===43||e===63)return;let t=!1,o=E(p=>p===Ht?2:p===Xt?(t=!0,1):p===Qt?(t=!1,1):p&&(t||p!==Cr));c.charCodeAt(l)===Cr||I("Unterminated regex"),h();let n=E(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var X=5,J=125,V=59;y("while",X+1,()=>(s.space(),["while",L(),K()]));y("do",X+1,r=>(r=K(),s.space(),h(5),s.space(),["do",r,L()]));var ae={let:1,const:1,var:1},gr=(r,e=r,t)=>{if(ae[r?.[0]]&&Array.isArray(r[1]))return(e=gr(r[1]))?.[0]==="in"||e?.[0]==="of"?[e[0],[r[0],e[1]],r.length>2?[",",e[2],...r.slice(2)]:e[2]]:r;for(;Array.isArray(e)&&v[e[0]]<v.in&&!ae[e[0]];)t=e,e=e[1];return t&&Array.isArray(e)&&(e[0]==="in"||e[0]==="of")?(t[1]=e[2],[e[0],e[1],r]):r};y("for",X+1,()=>(s.space(),S("await")?(h(5),s.space(),["for await",gr(L()),K()]):["for",gr(L()),K()]));y("break",X+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["break"];let t=E(s.id);if(!t)return["break"];let o=s.space();return!o||o===J||o===V||s.newline?["break",t]:(T(r),["break"])});y("continue",X+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===J||e===V||s.newline)return["continue"];let t=E(s.id);if(!t)return["continue"];let o=s.space();return!o||o===J||o===V||s.newline?["continue",t]:(T(r),["continue"])});y("return",X+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",a(X)]});var Er=5;y("try",Er+1,()=>{let r=["try",B()];return s.space(),S("catch")&&(h(5),s.space(),r.push(["catch",W()===40?L():null,B()])),s.space(),S("finally")&&(h(7),r.push(["finally",B()])),r});y("throw",Er+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",a(Er)]});var Ae=5,$t=20,de=58,xt=59,Sr=125,kr=0,ye=(r,e=r.length,t=r.charCodeAt(0),o=N[t])=>N[t]=(n,p,m)=>S(r)&&!n&&kr&&(!s.prop||s.prop(l+e))||o?.(n,p,m);ye("case");ye("default");var he=r=>{let e=[];for(;(r=s.space())!==Sr&&!S("case")&&!S("default");){if(r===xt){h();continue}s.semi=!1,e.push(a(Ae+.5))||I()}return e.length>1?[";",...e]:e[0]||null},jt=()=>{s.space()===123||I("Expected {"),h(),kr++;let r=[];try{for(;s.space()!==Sr;)if(S("case")){T(l+4),s.space(),s.semi=!1;let e=a($t-.5);s.space()===de&&h(),r.push(["case",e,he()])}else S("default")?(T(l+7),s.space()===de&&h(),r.push(["default",he()])):I("Expected case or default")}finally{kr--}return h(),s.exit?.(0,Sr),r};y("switch",Ae+1,()=>s.space()===40&&["switch",L(),...jt()]);var Tr=5,Wt=20;y("debugger",Tr+1,()=>["debugger"]);y("with",Tr+1,()=>(s.space(),["with",L(),K()]));var zt=["if","for","while","do","switch","try"];g(":",Wt-1,r=>typeof r=="string"&&(s.space(),zt.some(e=>S(e)))&&[":",r,a(Tr)]);var Nr=5,j=10,we=42,Jt=N[we];N[we]=(r,e)=>r?Jt?.(r,e):(h(),"*");g("from",j+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,a(j+1)]):!1);g("as",j+2,r=>r?(s.space(),["as",r,a(j+2)]):!1);y("import",Nr,()=>S(".meta")?(h(5),["import.meta"]):["import",a(j)]);y("export",Nr,()=>(s.space(),S("default")?(h(7),["export",["default",a(j)]]):["export",a(Nr)]));var Ir=20,Ce=200,Vt=10,Yt=13,Zt=34,qt=35,bt=39,ge=40,Or=41,ro=91,_r=123,Lr=125,eo=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===Vt||t===Yt)return!0}return!1},to=r=>r===Zt||r===bt||r===ro||r===qt,Ee=()=>E(s.id)||(to(c.charCodeAt(l))?a(Ce-.5):null),oo=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),Se=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||eo(t,l))return!1;let o=Ee();if(!o||(s.space(),c.charCodeAt(l)!==ge))return!1;h();let n=a(0,Or);return s.space(),c.charCodeAt(l)!==_r?!1:(h(),[r,o,n,a(0,Lr)])};g("get",Ir-1,Se("get"));g("set",Ir-1,Se("set"));var Rr=r=>r==null||typeof r=="string"||Array.isArray(r)&&(r[0]===","?r.slice(1).every(Rr):r[0]==="="?typeof r[1]=="string"||Rr(r[1]):r[0]==="..."||r[0]==="{}"||r[0]==="[]"),no=v["*"];g("*",Ce,r=>{let e=r&&s.newline;if(r&&!e)return;let t=l,o=Ee();if(!o)return r?(T(t),void 0):!1;if(s.space(),c.charCodeAt(l)!==ge)return r?(T(t),void 0):!1;h();let n=a(0,Or)||null;if(r&&!Rr(n))return T(t),void 0;if(s.space(),c.charCodeAt(l)!==_r)return r?(T(t),void 0):!1;h();let p=[":",o,["function*",null,n,a(0,Lr)||null]];return r?r[0]===";"?(r.push(p),r):[";",r,p]:p});v["*"]=no;g("(",Ir-1,r=>{if(!r)return;let e,t;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),Array.isArray(r)&&r[0]==="async"&&(t=!0,r=r[1]),!oo(r))return;let o=a(0,Or)||null;if(s.space(),c.charCodeAt(l)!==_r)return;h();let n=["=>",["()",o],a(0,Lr)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p});s.comment["#!"]=`
7
- `;var Re=32,Mr=10,io=59,so=125,ke=91,Te=40,rr=v.asi??v[";"],po=s._baseSpace??=s.space,fo=s._baseStep??=s.step,vr=r=>Array.isArray(r)||typeof r=="string",lo=(v[";"]??5)+1,Br=r=>Array.isArray(r)&&(v[r[0]]<=lo||r[0]==="{}"&&Br(r[1])),uo=(r,e)=>{for(;(e=c.charCodeAt(r))<=Re;){if(e===Mr)return!0;r++}return!1},co=(r=l,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=Re;)if(e===Mr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=po();e<l;)if(c.charCodeAt(e++)===Mr){s.newline=!0;break}if(r===io&&uo(l+1)){T(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===so&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=rr)return!1;if(r&&!vr(r))return null;if(vr(r)){let p=(t===ke||t===Te)&&co();if(s.semi||t===ke&&(p||Br(r))||t===Te&&(Br(r)||p&&e>=rr))return Ne(r,e,o)??null}let n=s.newline;return fo(r,e,t,o)??(vr(r)&&n?Ne(r,e,o)??null:null)};var Pr=0,mo=2e3,Ne=s.asi=(r,e,t,o,n)=>{if(e>=rr||Pr>=mo)return;s.semi=!1;let p=l;Pr++;try{o=t(rr-.5)}finally{Pr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var Oe=(r,e,t,o)=>typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="()"&&r.length===2?Oe(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Ie={"=":(r,e,t)=>r[e]=t,"+=":(r,e,t)=>r[e]+=t,"-=":(r,e,t)=>r[e]-=t,"*=":(r,e,t)=>r[e]*=t,"/=":(r,e,t)=>r[e]/=t,"%=":(r,e,t)=>r[e]%=t,"|=":(r,e,t)=>r[e]|=t,"&=":(r,e,t)=>r[e]&=t,"^=":(r,e,t)=>r[e]^=t,">>=":(r,e,t)=>r[e]>>=t,"<<=":(r,e,t)=>r[e]<<=t};for(let r in Ie)f(r,(e,t)=>(t=i(t),Oe(e,(o,n,p)=>Ie[r](o,n,t(p)))));f("!",r=>(r=i(r),e=>!r(e)));f("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));f("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));f("~",r=>(r=i(r),e=>~r(e)));f("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));f("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));f("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));f(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));f("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));f(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));f("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));f(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));f("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));f("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));f("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));f("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));f("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));f("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));f("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));f("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var Ur=(r,e,t,o)=>typeof r=="string"?n=>e(n,r):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n))):r[0]==="()"&&r.length===2?Ur(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Ur(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Ur(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var _e=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",_e);f(";",_e);var Q=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",er=r=>{throw Error(r)};f("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=i(t[1]),o=>t(o)):(t=i(t),o=>[t(o)])),t=>r.flatMap(o=>o(t))):(e==null&&er("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return Q(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],Q(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?er("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&er("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];return Kr(r,(n,p,m)=>n[p](...o(m)))});var M=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&M(r[1])||r[0]==="{}"),Kr=(r,e,t,o)=>r==null?er("Empty ()"):r[0]==="()"&&r.length==2?Kr(r[1],e):typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="?."?(t=i(r[1]),o=r[2],n=>{let p=t(n);return p==null?void 0:e(p,o,n)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="?.[]"?(t=i(r[1]),o=i(r[2]),n=>{let p=t(n);return p==null?void 0:e(p,o(n),n)}):(r=i(r),n=>e([r(n)],0,n)),D=Kr;f("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));f("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));f("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var ao=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(M(r)||ao("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]**=e(n))));f("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var ho=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(M(r)||ho("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]>>>=e(n))));var Ao=r=>r[0]?.[0]===","?r[0].slice(1):r,F=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Ao(n);if(o==="{}"){let m=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let C={};for(let O in e)m.includes(O)||(C[O]=e[O]);t[u[1]]=C;break}let d,w,R;typeof u=="string"?d=w=u:u[0]==="="?(typeof u[1]=="string"?d=w=u[1]:[,d,w]=u[1],R=u[2]):[,d,w]=u,m.push(d);let k=e[d];k===void 0&&R&&(k=i(R)(t)),F(w,k,t)}}else if(o==="[]"){let m=0;for(let u of p){if(u===null){m++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(m);break}let d=u,w;Array.isArray(u)&&u[0]==="="&&([,d,w]=u);let R=e[m++];R===void 0&&w&&(R=i(w)(t)),F(d,R,t)}}},Dr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,o]=e,n=i(o);return typeof t=="string"?p=>{p[t]=n(p)}:p=>F(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Dr);f("const",Dr);f("var",Dr);var tr=r=>{throw Error(r)};f("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=i(e),typeof t=="string"?o=>{o[t]=e(o)}:o=>F(t,e(o),o)}return M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(M(r)||tr("Invalid assignment target"),e=i(e),D(r,(t,o,n)=>t[o]??=e(n))));f("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),o=>r(o)?e(o):t(o)));var P=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let m=e?.[0]==="{}";return e=i(m?["{",e[1]]:e),u=>(...d)=>{let w={};t.forEach((k,C)=>w[k]=d[C]),n&&(w[n]=d.slice(o));let R=new Proxy(w,{get:(k,C)=>C in k?k[C]:u?.[C],set:(k,C,O)=>((C in k?k:u)[C]=O,!0),has:(k,C)=>C in k||(u?C in u:!1)});try{let k=e(R);return m?void 0:k}catch(k){if(k===P)return k[0];throw k}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),Q(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return Q(o)?void 0:r(t)?.[o]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="."||r[0]==="?."){let n=i(r[1]),p=r[2];return Q(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let u=p(m);return Q(u)?void 0:n(m)?.[u]?.(...t(m))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(m=>m(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var or=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[or,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[or,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var yo=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!yo(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let m of t.flatMap(u=>u(o)))if(m[0]===or){let[,u,d]=m;p[u]={...p[u],...d,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(m=>m(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),u=>{let d=(...w)=>{let R={};o.forEach((C,O)=>R[C]=w[O]),n&&(R[n]=w.slice(p));let k=new Proxy(R,{get:(C,O)=>O in C?C[O]:u[O],set:(C,O,Pe)=>((O in C?C:u)[O]=Pe,!0),has:(C,O)=>O in C||O in u});try{return t(k)}catch(C){if(C===P)return C[0];throw C}};return r&&(u[r]=d),d}});f("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});f("async",r=>{let e=i(r);return t=>{let o=e(t);return async function(...n){return o(...n)}}});f("await",r=>(r=i(r),async e=>await r(e)));f("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));f("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var wo=Symbol("static"),Co=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?e(o):Object,p=function(...m){if(!(this instanceof p))return Co("Class constructor must be called with new");let u=e?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,m),u};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),t){let m=Object.create(o);m.super=n;let u=t(m),d=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[w,R]of d)w==="constructor"?p.prototype.__constructor__=R:p.prototype[w]=R}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[wo,r(e)]]));f("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});f("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,o=>r(o)?e(o):t?.(o)));var U=Symbol("break"),G=Symbol("continue");f("while",(r,e)=>(r=i(r),e=i(e),t=>{let o;for(;r(t);)try{o=e(t)}catch(n){if(n===U)break;if(n===G)continue;if(n===P)return n[0];throw n}return o}));f("do",(r,e)=>(r=i(r),e=i(e),t=>{let o;do try{o=r(t)}catch(n){if(n===U)break;if(n===G)continue;if(n===P)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let m;for(t?.(p);o(p);n?.(p))try{m=e(p)}catch(u){if(u===U)break;if(u===G)continue;if(u===P)return u[0];throw u}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return Eo(o,n,e);if(t==="of")return go(o,n,e)}});var go=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u of e(n)){o?F(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===U)break;if(d===G)continue;if(d===P)return d[0];throw d}}return o||(n[r]=m),p}},Eo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u in e(n)){o?F(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===U)break;if(d===G)continue;if(d===P)return d[0];throw d}}return o||(n[r]=m),p}};f("break",()=>()=>{throw U});f("continue",()=>()=>{throw G});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw P[0]=r?.(e),P}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(u=>u?.[0]==="catch"),o=e.find(u=>u?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,m=o?.[1]?i(o[1]):null;return u=>{let d;try{d=r?.(u)}catch(w){if(w===U||w===G||w===P)throw w;if(n!=null&&p){let R=n in u,k=u[n];u[n]=w;try{d=p(u)}finally{R?u[n]=k:delete u[n]}}else if(!p)throw w}finally{m?.(u)}return d}});f("throw",r=>(r=i(r),e=>{throw r(e)}));f("switch",(r,...e)=>(r=i(r),e.length?(e=e.map(t=>[t[0]==="case"?i(t[1]):null,(t[0]==="case"?t[2]:t[1])?.[0]===";"?(t[0]==="case"?t[2]:t[1]).slice(1).map(i):(t[0]==="case"?t[2]:t[1])?[i(t[0]==="case"?t[2]:t[1])]:[]]),t=>{let o=r(t),n=!1,p;for(let[u,d]of e)if(n||u===null||u(t)===o)for(n=!0,m=0;m<d.length;m++)try{p=d[m](t)}catch(w){if(w===U)return p;throw w}var m;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var Le=new WeakMap,So=(r,...e)=>typeof r=="string"?i(s(r)):Le.get(r)||Le.set(r,ko(r,e)).get(r),ve=57344,ko=(r,e)=>{let t=r.reduce((p,m,u)=>p+(u?String.fromCharCode(ve+u-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-ve,u;if(m>=0&&m<e.length)return u=e[m],To(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},To=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),No=So;export{sr as access,A as binary,i as compile,c as cur,No as default,I as err,a as expr,z as group,Ro as id,l as idx,y as keyword,$ as literal,Be as loc,N as lookup,Gr as member,ir as nary,E as next,f as operator,nr as operators,L as parens,s as parse,W as peek,v as prec,pr as propName,T as seek,h as skip,g as token,_ as unary,S as word};
1
+ var l,m,s=r=>(l=0,m=r,s.enter?.(),r=d(),m[l]?O():r||""),O=(r="Unexpected token",e=l,t=m.slice(0,e).split(`
2
+ `),o=t.pop(),n=m.slice(Math.max(0,e-40),e),p="\u032D",c=(m[e]||" ")+p,u=m.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
3
+ ${n}${c}${u}`)},Ge=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),E=(r,e=l,t)=>{for(;t=r(m.charCodeAt(l));)l+=t;return m.slice(e,l)},h=(r=1)=>m[l+=r],T=r=>l=r,d=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,d));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):O("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},z=(r=l)=>{for(;m.charCodeAt(r)<=32;)r++;return m.charCodeAt(r)},vo=s.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,S=(r,e=r.length)=>m.substr(l,e)===r&&!s.id(m.charCodeAt(l+e)),L=()=>(h(),d(0,41)),N=[],v={},g=(r,e=32,t,o=r.charCodeAt(0))=>jr({op:r,l:r.length,p:v[r]=!N[o]&&v[r]||e,map:t,word:r.toUpperCase()!==r,kw:!1}),A=(r,e,t=!1)=>g(r,e,(o,n)=>o&&(n=d(e-(t?.5:0)))&&[r,o,n]),_=(r,e,t)=>g(r,e,o=>t?o&&[r,o]:!o&&(o=d(e-.5))&&[r,o]),j=(r,e)=>g(r,200,t=>!t&&[,e]),pr=(r,e,t,o)=>g(r,e,(n,p,c=n)=>(p=d(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),p?.[0]===r?n.push(...p.slice(1)):p?n.push(p):o||z()===r.charCodeAt(0)?n.push(null):c&&n.length===2&&(n=n[1]),n)),J=(r,e)=>g(r[0],e,t=>!t&&[r,d(0,r.charCodeAt(1))||null]),fr=(r,e)=>g(r[0],e,t=>t&&[r,t,d(0,r.charCodeAt(1))||null]),lr=(r,e)=>(s.space(),e=m.charCodeAt(l),s.id(e)&&(e<48||e>57)?E(s.id):d(r)),$r=(r,e)=>g(r,e,(t,o)=>t&&(o=lr(e))&&[r,t,o]),w=(r,e,t)=>(v[r]??=e,jr({op:r,l:r.length,p:e,map:t,word:!0,kw:!0})),Qr=(r,e,t=(o,n,p,c=l,u,a,y)=>{for(y=0;a=r[y++];)if(!(a.kw&&o)&&!(p?a.op!==p:!((a.l<2||a.op.charCodeAt(1)===m.charCodeAt(l+1)&&(a.l<3||m.substr(l,a.l)===a.op))&&(!a.word||!s.id(m.charCodeAt(l+a.l)))&&(p=a.op)))&&!(n>=a.p)&&!(a.kw&&s.prop&&!s.prop(l+a.l))){if(l+=a.l,u=a.map(o))return Ge(u,c);l=c,p=0,a.word||o||e||r[y]||O()}return e?.(o,n,p)})=>(t.ops=r,t.tail=e,t),jr=(r,e=r.op.charCodeAt(0),t=N[e])=>N[e]=t?.ops?Qr([r,...t.ops],t.tail):Qr([r],t);s.space=r=>{for(;(r=m.charCodeAt(l))<=32;)l++;return r};s.step=(r,e,t,o,n)=>(n=N[t])&&n(r,e)||(r?null:E(s.id)||null);var sr={},f=(r,e,t=sr[r])=>sr[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):sr[r[0]]?.(...r.slice(1))??O(`Unknown operator: ${r[0]}`,r?.loc):i.id(r);i.id=r=>r===void 0?()=>{}:e=>e?.[r];var ur=46,Q=48,x=57,xr=69,Wr=101,Fe=43,He=45,zr=95,Xe=97,Qe=102,$e=65,je=70,Jr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),xe=r=>r===ur&&(r=m.charCodeAt(l+1))!==ur&&!(s.id(r)&&r>x&&r!==Wr&&r!==xr)||r>=Q&&r<=x||r===zr||((r===xr||r===Wr)&&((r=m.charCodeAt(l+1))>=Q&&r<=x||r===Fe||r===He)?2:0),cr=r=>(r=+Jr(E(xe)))!=r?O():[,r],We=r=>e=>e===zr||e>=Q&&e<=x&&e-Q<r||r===16&&(e>=Xe&&e<=Qe||e>=$e&&e<=je);s.number=null;N[ur]=r=>!r&&m.charCodeAt(l+1)>=Q&&m.charCodeAt(l+1)<=x&&cr();for(let r=Q;r<=x;r++)N[r]=e=>e?void 0:cr();N[Q]=(r,e)=>{if(!r){for(let t in s.number)if(t[0]==="0"&&(m.charCodeAt(l+1)|32)===t.charCodeAt(1)){h(2);let o=Jr(E(We(e=s.number[t])));return[,parseInt(o,e)]}return cr()}};var ze=92,Vr=34,Yr=39,Zr=117,qr=120,Je=123,Ve=125,br=10,Ye=13,Ze={n:`
4
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},re=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,mr=()=>{let r=m.charCodeAt(l+1);if(r===br)return["",2];if(r===Ye)return["",m.charCodeAt(l+2)===br?3:2];if(r===qr||r===Zr&&m.charCodeAt(l+2)!==Je){let e=r===qr?2:4,t=0,o;for(let n=0;n<e;n++){if((o=re(m.charCodeAt(l+2+n)))<0)return[m[l+1],2];t=t*16+o}return[String.fromCharCode(t),2+e]}if(r===Zr){let e=0,t=l+3,o;for(;(o=re(m.charCodeAt(t)))>=0;)e=e*16+o,t++;return t>l+3&&e<=1114111&&m.charCodeAt(t)===Ve?[String.fromCodePoint(e),t-l+1]:[m[l+1],2]}return[Ze[m[l+1]]||m[l+1],2]},ee=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(e||!s.string?.[n])return;h();let p=()=>{let[c,u]=mr();return o+=c,u};return E(c=>c-r&&(c!==ze?(o+=m[l],1):p())),m[l]===n?h():O("Bad string"),[,o]};N[Vr]=ee(Vr);N[Yr]=ee(Yr);s.string={'"':!0};var qe=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,qe,!0));var be=30,rt=40,et=140;_("!",et);A("||",be);A("&&",rt);var tt=50,ot=60,nt=70,te=100,it=140;A("|",tt);A("&",nt);A("^",ot);A(">>",te);A("<<",te);_("~",it);var Z=90;A("<",Z);A(">",Z);A("<=",Z);A(">=",Z);var oe=80;A("==",oe);A("!=",oe);var ne=110,ar=120,ie=140;A("+",ne);A("-",ne);A("*",ar);A("/",ar);A("%",ar);_("+",ie);_("-",ie);var q=150;g("++",q,r=>r?["++",r,null]:["++",d(q-1)]);g("--",q,r=>r?["--",r,null]:["--",d(q-1)]);var st=5,pt=10;pr(",",pt);pr(";",st,!0,!0);var ft=170;J("()",ft);var se=170,lt=160;fr("[]",se);$r(".",se);fr("()",lt);var ut=s.space;s.comment??={"//":`
5
+ `,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=ut();){for(t in e=s.comment)if(r===t.charCodeAt(0)&&(t.length<2||m.charCodeAt(l+1)===t.charCodeAt(1))&&(t.length<3||m.substr(l,t.length)===t)){o=e[t],n=m.indexOf(o,l+t.length),T(n<0?m.length:o===`
6
+ `?n:n+o.length),r=0;break}if(r)return r}return r};var pe=80;A("===",pe);A("!==",pe);var ct=30;A("??",ct);var mt=130,at=20;A("**",mt,!0);A("**=",at,!0);var fe=90;A("in",fe);A("of",fe);var dt=20,ht=100;A(">>>",ht);A(">>>=",dt,!0);var dr=20;A("||=",dr,!0);A("&&=",dr,!0);A("??=",dr,!0);j("true",!0);j("false",!1);j("null",null);w("undefined",200,()=>[]);j("NaN",NaN);j("Infinity",1/0);var hr=20;g("?",hr,(r,e,t)=>r&&(e=d(hr-1))&&E(o=>o===58)&&(t=d(hr-1),["?",r,e,t]));var At=20;A("=>",At,!0);var yt=20;_("...",yt);var le=170;g("?.",le,(r,e)=>{if(!r)return;let t=s.space();return t===40?(h(),["?.()",r,d(0,41)||null]):t===91?(h(),["?.[]",r,d(0,93)]):(e=lr(le),e?["?.",r,e]:void 0)});var Ar=140,ue=160,wt=ue+1;_("typeof",Ar);_("void",Ar);_("delete",Ar);var Ct=r=>s.space()===40?(h(),["()",r,d(0,41)||null]):r;w("new",wt,()=>S(".target")?(h(7),["new.target"]):["new",Ct(d(ue))]);var gt=20,ce=200;s.prop=r=>z(r)!==58;J("[]",ce);J("{}",ce);A(":",gt-1,!0);var Et=170,yr=96,St=36,kt=123,Tt=92,me=()=>{let r=[],e="",t,o;for(;(t=m.charCodeAt(l))!==yr;)t?t===Tt?(o=mr(),e+=o[0],h(o[1])):t===St&&m.charCodeAt(l+1)===kt?(r.push([,e]),e="",h(2),r.push(d(0,125))):(e+=m[l],h()):O("Unterminated template");return r.push([,e]),h(),r},Nt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Rt=N[yr];N[yr]=(r,e)=>r&&e<Et?s.asi&&s.newline?void 0:(h(),["``",r,...me()]):r?Rt?.(r,e):(h(),Nt(me()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var It=92,Ot=117,_t=123,Lt=125,Pt=183,vt=s.id,ae=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,Bt=(r=l+2,e,t=0,o=0)=>{if(m.charCodeAt(l)!==It||m.charCodeAt(l+1)!==Ot)return 0;if(m.charCodeAt(r)===_t){for(;ae(e=m.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&m.charCodeAt(r)===Lt?r-l+1:0}for(;o<4&&ae(m.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>vt(r)||r===Pt||Bt();var wr=5,he=10,Cr=r=>{let e=l,t=d(he-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(T(e),r):t[0]===","?[r,...t.slice(1)]:[r,t]};w("let",wr+1,()=>Cr("let"));w("const",wr+1,()=>Cr("const"));w("var",wr+1,()=>Cr("var"));var de=r=>Array.isArray(r)&&r[0]==="="&&typeof r[1]=="string";w("using",200,()=>{let r=l;s.space();let e=m.charCodeAt(l);if(s.id(e)&&(e<48||e>57)){let t=l;if(E(s.id),s.space(),m.charCodeAt(l)===61&&m.charCodeAt(l+1)!==61&&m.charCodeAt(l+1)!==62){T(t);let o=d(he-1);if(o[0]===","?o.slice(1).every(de):de(o))return o[0]===","?["using",...o.slice(1)]:["using",o]}}return T(r),"using"});var b=5,Mt=59,U=()=>(s.space()===123||O("Expected {"),h(),d(b-.5,125)||null),G=()=>s.space()!==123?d(b+.5):(h(),d(b-.5,125)||null),Ut=()=>{let r=l;return s.space()===Mt&&h(),s.space(),S("else")?(h(4),s.semi=!1,!0):(T(r),!1)};w("if",b+1,()=>{s.space();let r=["if",L(),G()];return Ut()&&r.push(G()),r});var Kt=200;w("function",Kt,()=>{s.space();let r=!1;m[l]==="*"&&(r=!0,h(),s.space());let e=E(s.id);return e&&s.space(),r?["function*",e,L()||null,U()]:["function",e,L()||null,U()]});var rr=140,gr=20,Dt=40;_("await",rr);var Gt=10,Ft=13,Ht=r=>{let e;for(;(e=m.charCodeAt(r))<=32;){if(e===Gt||e===Ft)return!0;r++}return!1};w("yield",rr,()=>Ht(l)?["yield"]:(s.space(),m[l]==="*"?(h(),s.space(),["yield*",d(gr)]):["yield",d(gr)]));w("async",rr,()=>{if(s.space(),S("function"))return["async",d(rr)];let r=l,e=E(s.id);if(e){if(s.space(),m.charCodeAt(l)===Dt)return["async",e];T(r)}let t=d(gr-.5);return t&&["async",t]});var Ae=200;var Xt=90,Qt=175,$t=160,jt=$t-.5;_("static",Qt);A("instanceof",Xt);g("#",Ae,r=>{if(r)return;let e=E(s.id);return e?"#"+e:void 0});w("class",Ae,()=>{s.space();let r=E(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!S("extends"))return["class",r,null,U()];h(7),s.space()}return["class",r,d(jt),U()]});var Er=47,xt=92,Wt=91,zt=93;g("/",140,r=>{let e=m.charCodeAt(l);if(r||e===Er||e===42||e===43||e===63)return;let t=!1,o=E(p=>p===xt?2:p===Wt?(t=!0,1):p===zt?(t=!1,1):p&&(t||p!==Er));m.charCodeAt(l)===Er||O("Unterminated regex"),h();let n=E(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var $=5,V=125,Y=59;w("while",$+1,()=>(s.space(),["while",L(),G()]));w("do",$+1,r=>(r=G(),s.space(),h(5),s.space(),["do",r,L()]));var ye={let:1,const:1,var:1},Sr=(r,e=r,t)=>{if(ye[r?.[0]]&&Array.isArray(r[1]))return(e=Sr(r[1]))?.[0]==="in"||e?.[0]==="of"?[e[0],[r[0],e[1]],r.length>2?[",",e[2],...r.slice(2)]:e[2]]:r;for(;Array.isArray(e)&&v[e[0]]<v.in&&!ye[e[0]];)t=e,e=e[1];return t&&Array.isArray(e)&&(e[0]==="in"||e[0]==="of")?(t[1]=e[2],[e[0],e[1],r]):r};w("for",$+1,()=>(s.space(),S("await")?(h(5),s.space(),["for await",Sr(L()),G()]):["for",Sr(L()),G()]));w("break",$+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===V||e===Y||s.newline)return["break"];let t=E(s.id);if(!t)return["break"];let o=s.space();return!o||o===V||o===Y||s.newline?["break",t]:(T(r),["break"])});w("continue",$+1,()=>{s.asi&&(s.newline=!1);let r=l,e=s.space();if(!e||e===V||e===Y||s.newline)return["continue"];let t=E(s.id);if(!t)return["continue"];let o=s.space();return!o||o===V||o===Y||s.newline?["continue",t]:(T(r),["continue"])});w("return",$+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===V||r===Y||s.newline?["return"]:["return",d($)]});var kr=5;w("try",kr+1,()=>{let r=["try",U()];return s.space(),S("catch")&&(h(5),s.space(),r.push(["catch",z()===40?L():null,U()])),s.space(),S("finally")&&(h(7),r.push(["finally",U()])),r});w("throw",kr+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",d(kr)]});var ge=5,Jt=20,we=58,Vt=59,Tr=125,Nr=0,Ee=(r,e=r.length,t=r.charCodeAt(0),o=N[t])=>N[t]=(n,p,c)=>S(r)&&!n&&Nr&&(!s.prop||s.prop(l+e))||o?.(n,p,c);Ee("case");Ee("default");var Ce=r=>{let e=[];for(;(r=s.space())!==Tr&&!S("case")&&!S("default");){if(r===Vt){h();continue}s.semi=!1,e.push(d(ge+.5))||O()}return e.length>1?[";",...e]:e[0]||null},Yt=()=>{s.space()===123||O("Expected {"),h(),Nr++;let r=[];try{for(;s.space()!==Tr;)if(S("case")){T(l+4),s.space(),s.semi=!1;let e=d(Jt-.5);s.space()===we&&h(),r.push(["case",e,Ce()])}else S("default")?(T(l+7),s.space()===we&&h(),r.push(["default",Ce()])):O("Expected case or default")}finally{Nr--}return h(),s.exit?.(0,Tr),r};w("switch",ge+1,()=>s.space()===40&&["switch",L(),...Yt()]);var Rr=5,Zt=20;w("debugger",Rr+1,()=>["debugger"]);w("with",Rr+1,()=>(s.space(),["with",L(),G()]));var qt=["if","for","while","do","switch","try"];g(":",Zt-1,r=>typeof r=="string"&&(s.space(),qt.some(e=>S(e)))&&[":",r,d(Rr)]);var Ir=5,W=10,Se=42,bt=N[Se];N[Se]=(r,e)=>r?bt?.(r,e):(h(),"*");g("from",W+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,d(W+1)]):!1);g("as",W+2,r=>r?(s.space(),["as",r,d(W+2)]):!1);w("import",Ir,()=>S(".meta")?(h(5),["import.meta"]):["import",d(W)]);w("export",Ir,()=>(s.space(),S("default")?(h(7),["export",["default",d(W)]]):["export",d(Ir)]));var _r=20,ke=200,ro=10,eo=13,to=34,oo=35,no=39,Te=40,Lr=41,io=91,Pr=123,vr=125,so=(r,e)=>{for(;r<e;){let t=m.charCodeAt(r++);if(t===ro||t===eo)return!0}return!1},po=r=>r===to||r===no||r===io||r===oo,Ne=()=>E(s.id)||(po(m.charCodeAt(l))?d(ke-.5):null),fo=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),er=r=>e=>{let t=s.newline,o=s.semi,n=r(e);return n||(s.newline=t,s.semi=o),n},Re=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||so(t,l))return!1;let o=Ne();if(!o||(s.space(),m.charCodeAt(l)!==Te))return!1;h();let n=d(0,Lr);return s.space(),m.charCodeAt(l)!==Pr?!1:(h(),[r,o,n,d(0,vr)])};g("get",_r-1,er(Re("get")));g("set",_r-1,er(Re("set")));var Or=r=>r==null||typeof r=="string"||Array.isArray(r)&&(r[0]===","?r.slice(1).every(Or):r[0]==="="?typeof r[1]=="string"||Or(r[1]):r[0]==="..."||r[0]==="{}"||r[0]==="[]"),lo=v["*"];g("*",ke,er(r=>{let e=r&&s.newline;if(r&&!e)return;let t=l,o=Ne();if(!o)return r?(T(t),void 0):!1;if(s.space(),m.charCodeAt(l)!==Te)return r?(T(t),void 0):!1;h();let n=d(0,Lr)||null;if(r&&!Or(n))return T(t),void 0;if(s.space(),m.charCodeAt(l)!==Pr)return r?(T(t),void 0):!1;h();let p=[":",o,["function*",null,n,d(0,vr)||null]];return r?r[0]===";"?(r.push(p),r):[";",r,p]:p}));v["*"]=lo;g("(",_r-1,er(r=>{if(!r)return;let e,t;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),Array.isArray(r)&&r[0]==="async"&&(t=!0,r=r[1]),!fo(r))return;let o=d(0,Lr)||null;if(s.space(),m.charCodeAt(l)!==Pr)return;h();let n=["=>",["()",o],d(0,vr)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p}));s.comment["#!"]=`
7
+ `;var Le=32,Kr=10,uo=59,co=125,Ie=91,Oe=40,tr=v.asi??v[";"],mo=s._baseSpace??=s.space,ao=s._baseStep??=s.step,Br=r=>Array.isArray(r)||typeof r=="string",ho=(v[";"]??5)+1,Ur=r=>Array.isArray(r)&&(v[r[0]]<=ho||r[0]==="{}"&&Ur(r[1])),Ao=(r,e)=>{for(;(e=m.charCodeAt(r))<=Le;){if(e===Kr)return!0;r++}return!1},yo=(r=l,e)=>{for(;r-- >0&&(e=m.charCodeAt(r))<=Le;)if(e===Kr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=mo();e<l;)if(m.charCodeAt(e++)===Kr){s.newline=!0;break}if(r===uo&&Ao(l+1)){T(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===co&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=tr)return!1;if(r&&!Br(r))return null;if(Br(r)){let p=(t===Ie||t===Oe)&&yo();if(s.semi||t===Ie&&(p||Ur(r))||t===Oe&&(Ur(r)||p&&e>=tr))return _e(r,e,o)??null}let n=s.newline;return ao(r,e,t,o)??(Br(r)&&n?_e(r,e,o)??null:null)};var Mr=0,wo=2e3,_e=s.asi=(r,e,t,o,n)=>{if(e>=tr||Mr>=wo)return;s.semi=!1;let p=l;Mr++;try{o=t(tr-.5)}finally{Mr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var ve=(r,e,t,o)=>typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="()"&&r.length===2?ve(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Pe={"=":(r,e,t)=>r[e]=t,"+=":(r,e,t)=>r[e]+=t,"-=":(r,e,t)=>r[e]-=t,"*=":(r,e,t)=>r[e]*=t,"/=":(r,e,t)=>r[e]/=t,"%=":(r,e,t)=>r[e]%=t,"|=":(r,e,t)=>r[e]|=t,"&=":(r,e,t)=>r[e]&=t,"^=":(r,e,t)=>r[e]^=t,">>=":(r,e,t)=>r[e]>>=t,"<<=":(r,e,t)=>r[e]<<=t};for(let r in Pe)f(r,(e,t)=>(t=i(t),ve(e,(o,n,p)=>Pe[r](o,n,t(p)))));f("!",r=>(r=i(r),e=>!r(e)));f("||",(r,e)=>(r=i(r),e=i(e),t=>r(t)||e(t)));f("&&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&&e(t)));f("~",r=>(r=i(r),e=>~r(e)));f("|",(r,e)=>(r=i(r),e=i(e),t=>r(t)|e(t)));f("&",(r,e)=>(r=i(r),e=i(e),t=>r(t)&e(t)));f("^",(r,e)=>(r=i(r),e=i(e),t=>r(t)^e(t)));f(">>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>e(t)));f("<<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<<e(t)));f(">",(r,e)=>(r=i(r),e=i(e),t=>r(t)>e(t)));f("<",(r,e)=>(r=i(r),e=i(e),t=>r(t)<e(t)));f(">=",(r,e)=>(r=i(r),e=i(e),t=>r(t)>=e(t)));f("<=",(r,e)=>(r=i(r),e=i(e),t=>r(t)<=e(t)));f("==",(r,e)=>(r=i(r),e=i(e),t=>r(t)==e(t)));f("!=",(r,e)=>(r=i(r),e=i(e),t=>r(t)!=e(t)));f("+",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)+e(t)):(r=i(r),t=>+r(t)));f("-",(r,e)=>e!==void 0?(r=i(r),e=i(e),t=>r(t)-e(t)):(r=i(r),t=>-r(t)));f("*",(r,e)=>(r=i(r),e=i(e),t=>r(t)*e(t)));f("/",(r,e)=>(r=i(r),e=i(e),t=>r(t)/e(t)));f("%",(r,e)=>(r=i(r),e=i(e),t=>r(t)%e(t)));var Dr=(r,e,t,o)=>typeof r=="string"?n=>e(n,r):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o)):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n))):r[0]==="()"&&r.length===2?Dr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Dr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Dr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var Be=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",Be);f(";",Be);var Me=r=>r!=null&&(typeof r=="object"||typeof r=="function"),M=r=>Me(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Co=r=>P(M(r));i.id=r=>r===void 0||Co(r)?()=>{}:e=>e?.[r];var or=r=>{throw Error(r)};f("[]",(r,e)=>e===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(t=>t==null?(()=>{}):t[0]==="..."?(t=i(t[1]),o=>t(o)):(t=i(t),o=>[t(o)])),t=>r.flatMap(o=>o(t))):(e==null&&or("Missing index"),r=i(r),e=i(e),t=>{let o=M(e(t));return P(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=M(e[0]?e:e[1]),P(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?or("Empty ()"):i(r);let t=p=>p?.[0]===","&&p.slice(1).some(c=>c==null||t(c));t(e)&&or("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),p=>e.map(c=>c(p))):(e=i(e),p=>[e(p)]):()=>[],n=Hr(r);return n<0?()=>{}:Fr(r,n?(p,c,u)=>(c=M(c),P(c)?void 0:p[c](...o(u))):(p,c,u)=>p[c](...o(u)))});var K=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&K(r[1])||r[0]==="{}"),Fr=(r,e,t,o)=>r==null?or("Empty ()"):r[0]==="()"&&r.length==2?Fr(r[1],e):typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="?."?(t=i(r[1]),o=r[2],n=>{let p=t(n);return p==null?void 0:e(p,o,n)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="?.[]"?(t=i(r[1]),o=i(r[2]),n=>{let p=t(n);return p==null?void 0:e(p,o(n),n)}):(r=i(r),n=>e([r(n)],0,n)),Gr=r=>Me(r)?1:P(r)?-1:0,Hr=(r,e=r?.[0],t=r?.[2])=>typeof r=="string"?Gr(r):e==="()"&&r.length==2?Hr(r[1]):e==="."||e==="?."?Gr(t):(e==="[]"||e==="?.[]")&&r.length===3?Array.isArray(t)&&t[0]==null?Gr(t[1]):1:0,F=(r,e,t=Hr(r))=>t<0?()=>{}:Fr(r,t?(o,n,p)=>(n=M(n),P(n)?void 0:e(o,n,p)):e);f("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));f("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));f("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var go=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(K(r)||go("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]**=e(n))));f("in",(r,e)=>(r=i(r),e=i(e),t=>r(t)in e(t)));var Eo=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(K(r)||Eo("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]>>>=e(n))));var So=r=>r[0]?.[0]===","?r[0].slice(1):r,H=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=So(n);if(o==="{}"){let c=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let C={};for(let I in e)!c.includes(I)&&!P(I)&&(C[I]=e[I]);t[u[1]]=C;break}let a,y,R;typeof u=="string"?a=y=u:u[0]==="="?(typeof u[1]=="string"?a=y=u[1]:[,a,y]=u[1],R=u[2]):[,a,y]=u,c.push(a=M(a));let k=P(a)?void 0:e[a];k===void 0&&R&&(k=i(R)(t)),H(y,k,t)}}else if(o==="[]"){let c=0;for(let u of p){if(u===null){c++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(c);break}let a=u,y;Array.isArray(u)&&u[0]==="="&&([,a,y]=u);let R=e[c++];R===void 0&&y&&(R=i(y)(t)),H(a,R,t)}}},Xr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,o]=e,n=i(o);return typeof t=="string"?p=>{p[t]=n(p)}:p=>H(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Xr);f("const",Xr);f("var",Xr);var nr=r=>{throw Error(r)};f("=",(r,e)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let t=r[1];return e=i(e),typeof t=="string"?o=>{o[t]=e(o)}:o=>H(t,e(o),o)}return K(r)||nr("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(K(r)||nr("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(K(r)||nr("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(K(r)||nr("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]??=e(n))));f("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),o=>r(o)?e(o):t(o)));var B=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let c=e?.[0]==="{}";return e=i(c?["{",e[1]]:e),u=>(...a)=>{let y={};t.forEach((k,C)=>y[k]=a[C]),n&&(y[n]=a.slice(o));let R=new Proxy(y,{get:(k,C)=>C in k?k[C]:u?.[C],set:(k,C,I)=>((C in k?k:u)[C]=I,!0),has:(k,C)=>C in k||(u?C in u:!1)});try{let k=e(R);return c?void 0:k}catch(k){if(k===B)return k[0];throw k}}});f("...",r=>(r=i(r),e=>{let t=r(e),o=[];for(let n of Object.keys(t))P(n)||o.push([n,t[n]]);return o}));f("?.",(r,e)=>(r=i(r),e=M(e),P(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=r(t);if(o==null)return;let n=M(e(t));return P(n)?void 0:o[n]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="."||r[0]==="?."){let n=r[0]==="?.",p=i(r[1]),c=M(r[2]);return P(c)?()=>{}:n?u=>p(u)?.[c]?.(...t(u)):u=>p(u)[c]?.(...t(u))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",p=i(r[1]),c=i(r[2]);return u=>{let a=p(u);if(n&&a==null)return;let y=M(c(u));return P(y)?void 0:a[y]?.(...t(u))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(c=>c(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var ir=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[ir,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[ir,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var ko=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!ko(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let c of t.flatMap(u=>u(o)))if(c[0]===ir){let[,u,a]=c;p[u]={...p[u],...a,configurable:!0,enumerable:!0}}else n[c[0]]=c[1];for(let c in p)Object.defineProperty(n,c,p[c]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(c=>c(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,c=o[o.length-1];return Array.isArray(c)&&c[0]==="..."&&(p=o.length-1,n=c[1],o.length--),u=>{let a=(...y)=>{let R={};o.forEach((C,I)=>R[C]=y[I]),n&&(R[n]=y.slice(p));let k=new Proxy(R,{get:(C,I)=>I in C?C[I]:u[I],set:(C,I,De)=>((I in C?C:u)[I]=De,!0),has:(C,I)=>I in C||I in u});try{return t(k)}catch(C){if(C===B)return C[0];throw C}};return r&&(u[r]=a),a}});f("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});f("async",r=>{let e=i(r);return t=>{let o=e(t);return async function(...n){return o(...n)}}});f("await",r=>(r=i(r),async e=>await r(e)));f("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));f("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var To=Symbol("static"),No=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?.(o),p=function(...c){if(!(this instanceof p))return No("Class constructor must be called with new");let u=e?Reflect.construct(n,c,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,c),u};if(e&&(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n)),t){let c=Object.create(o);e&&(c.super=n);let u=t(c),a=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,R]of a)y==="constructor"?p.prototype.__constructor__=R:p.prototype[y]=R}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[To,r(e)]]));f("//",(r,e)=>{let t=new RegExp(r,e||"");return()=>t});f("if",(r,e,t)=>(r=i(r),e=i(e),t=t!==void 0?i(t):null,o=>r(o)?e(o):t?.(o)));var D=Symbol("break"),X=Symbol("continue");f("while",(r,e)=>(r=i(r),e=i(e),t=>{let o;for(;r(t);)try{o=e(t)}catch(n){if(n===D)break;if(n===X)continue;if(n===B)return n[0];throw n}return o}));f("do",(r,e)=>(r=i(r),e=i(e),t=>{let o;do try{o=r(t)}catch(n){if(n===D)break;if(n===X)continue;if(n===B)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let c;for(t?.(p);o(p);n?.(p))try{c=e(p)}catch(u){if(u===D)break;if(u===X)continue;if(u===B)return u[0];throw u}return c}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return Io(o,n,e);if(t==="of")return Ro(o,n,e)}});var Ro=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let u of e(n)){o?H(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===D)break;if(a===X)continue;if(a===B)return a[0];throw a}}return o||(n[r]=c),p}},Io=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let u in e(n)){o?H(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===D)break;if(a===X)continue;if(a===B)return a[0];throw a}}return o||(n[r]=c),p}};f("break",()=>()=>{throw D});f("continue",()=>()=>{throw X});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw B[0]=r?.(e),B}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(u=>u?.[0]==="catch"),o=e.find(u=>u?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,c=o?.[1]?i(o[1]):null;return u=>{let a;try{a=r?.(u)}catch(y){if(y===D||y===X||y===B)throw y;if(n!=null&&p){let R=n in u,k=u[n];u[n]=y;try{a=p(u)}finally{R?u[n]=k:delete u[n]}}else if(!p)throw y}finally{c?.(u)}return a}});f("throw",r=>(r=i(r),e=>{throw r(e)}));f("switch",(r,...e)=>(r=i(r),e.length?(e=e.map(t=>[t[0]==="case"?i(t[1]):null,(t[0]==="case"?t[2]:t[1])?.[0]===";"?(t[0]==="case"?t[2]:t[1]).slice(1).map(i):(t[0]==="case"?t[2]:t[1])?[i(t[0]==="case"?t[2]:t[1])]:[]]),t=>{let o=r(t),n=!1,p;for(let[u,a]of e)if(n||u===null||u(t)===o)for(n=!0,c=0;c<a.length;c++)try{p=a[c](t)}catch(y){if(y===D)return p;throw y}var c;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var Ue=new WeakMap,Oo=(r,...e)=>typeof r=="string"?i(s(r)):Ue.get(r)||Ue.set(r,_o(r,e)).get(r),Ke=57344,_o=(r,e)=>{let t=r.reduce((p,c,u)=>p+(u?String.fromCharCode(Ke+u-1):"")+c,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let c=p.charCodeAt(0)-Ke,u;if(c>=0&&c<e.length)return u=e[c],Lo(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Lo=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Po=Oo;export{fr as access,A as binary,i as compile,m as cur,Po as default,O as err,d as expr,J as group,vo as id,l as idx,w as keyword,j as literal,Ge as loc,N as lookup,$r as member,pr as nary,E as next,f as operator,sr as operators,L as parens,s as parse,z as peek,v as prec,lr as propName,T as seek,h as skip,g as token,_ as unary,S as word};
package/justin.min.js CHANGED
@@ -1,6 +1,6 @@
1
- var m,c,d=r=>(m=0,c=r,d.enter?.(),r=A(),c[m]?I():r||""),I=(r="Unexpected token",t=m,e=c.slice(0,t).split(`
2
- `),o=e.pop(),i=c.slice(Math.max(0,t-40),t),s="\u032D",f=(c[t]||" ")+s,l=c.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
3
- ${i}${f}${l}`)},Dr=(r,t=m)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=m,e)=>{for(;e=r(c.charCodeAt(m));)m+=e;return c.slice(t,m)},y=(r=1)=>c[m+=r],ir=r=>m=r,A=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,A));)o=i;return t&&(e==t?(m++,d.exit?.(r,t)):I("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},K=(r=m)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Bt=d.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,pr=(r,t=r.length)=>c.substr(m,t)===r&&!d.id(c.charCodeAt(m+t)),Mt=()=>(y(),A(0,41)),E=[],Q={},w=(r,t=32,e,o=r.charCodeAt(0))=>mr({op:r,l:r.length,p:Q[r]=!E[o]&&Q[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),u=(r,t,e=!1)=>w(r,t,(o,i)=>o&&(i=A(t-(e?.5:0)))&&[r,o,i]),k=(r,t,e)=>w(r,t,o=>e?o&&[r,o]:!o&&(o=A(t-.5))&&[r,o]),a=(r,t)=>w(r,200,e=>!e&&[,t]),W=(r,t,e,o)=>w(r,t,(i,s,f=i)=>(s=A(t-(e?.5:0)),i?.[0]!==r&&(i=[r,i||null]),s?.[0]===r?i.push(...s.slice(1)):s?i.push(s):o||K()===r.charCodeAt(0)?i.push(null):f&&i.length===2&&(i=i[1]),i)),_=(r,t)=>w(r[0],t,e=>!e&&[r,A(0,r.charCodeAt(1))||null]),j=(r,t)=>w(r[0],t,e=>e&&[r,e,A(0,r.charCodeAt(1))||null]),z=(r,t)=>(d.space(),t=c.charCodeAt(m),d.id(t)&&(t<48||t>57)?L(d.id):A(r)),sr=(r,t)=>w(r,t,(e,o)=>e&&(o=z(t))&&[r,e,o]),M=(r,t,e)=>(Q[r]??=t,mr({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),nr=(r,t,e=(o,i,s,f=m,l,h,C)=>{for(C=0;h=r[C++];)if(!(h.kw&&o)&&!(s?h.op!==s:!((h.l<2||h.op.charCodeAt(1)===c.charCodeAt(m+1)&&(h.l<3||c.substr(m,h.l)===h.op))&&(!h.word||!d.id(c.charCodeAt(m+h.l)))&&(s=h.op)))&&!(i>=h.p)&&!(h.kw&&d.prop&&!d.prop(m+h.l))){if(m+=h.l,l=h.map(o))return Dr(l,f);m=f,s=0,h.word||o||t||r[C]||I()}return t?.(o,i,s)})=>(e.ops=r,e.tail=t,e),mr=(r,t=r.op.charCodeAt(0),e=E[t])=>E[t]=e?.ops?nr([r,...e.ops],e.tail):nr([r],e);d.space=r=>{for(;(r=c.charCodeAt(m))<=32;)m++;return r};d.step=(r,t,e,o,i)=>(i=E[e])&&i(r,t)||(r?null:L(d.id)||null);var H={},p=(r,t,e=H[r])=>H[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):H[r[0]]?.(...r.slice(1))??I(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var J=46,R=48,T=57,fr=69,lr=101,Fr=43,Gr=45,ur=95,Xr=97,$r=102,Qr=65,Hr=70,cr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Kr=r=>r===J&&(r=c.charCodeAt(m+1))!==J&&!(d.id(r)&&r>T&&r!==lr&&r!==fr)||r>=R&&r<=T||r===ur||((r===fr||r===lr)&&((r=c.charCodeAt(m+1))>=R&&r<=T||r===Fr||r===Gr)?2:0),V=r=>(r=+cr(L(Kr)))!=r?I():[,r],Wr=r=>t=>t===ur||t>=R&&t<=T&&t-R<r||r===16&&(t>=Xr&&t<=$r||t>=Qr&&t<=Hr);d.number=null;E[J]=r=>!r&&c.charCodeAt(m+1)>=R&&c.charCodeAt(m+1)<=T&&V();for(let r=R;r<=T;r++)E[r]=t=>t?void 0:V();E[R]=(r,t)=>{if(!r){for(let e in d.number)if(e[0]==="0"&&(c.charCodeAt(m+1)|32)===e.charCodeAt(1)){y(2);let o=cr(L(Wr(t=d.number[e])));return[,parseInt(o,t)]}return V()}};var jr=92,dr=34,hr=39,Ar=117,gr=120,zr=123,Jr=125,yr=10,Vr=13,Yr={n:`
4
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Cr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Y=()=>{let r=c.charCodeAt(m+1);if(r===yr)return["",2];if(r===Vr)return["",c.charCodeAt(m+2)===yr?3:2];if(r===gr||r===Ar&&c.charCodeAt(m+2)!==zr){let t=r===gr?2:4,e=0,o;for(let i=0;i<t;i++){if((o=Cr(c.charCodeAt(m+2+i)))<0)return[c[m+1],2];e=e*16+o}return[String.fromCharCode(e),2+t]}if(r===Ar){let t=0,e=m+3,o;for(;(o=Cr(c.charCodeAt(e)))>=0;)t=t*16+o,e++;return e>m+3&&t<=1114111&&c.charCodeAt(e)===Jr?[String.fromCodePoint(t),e-m+1]:[c[m+1],2]}return[Yr[c[m+1]]||c[m+1],2]},Sr=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!d.string?.[i])return;y();let s=()=>{let[f,l]=Y();return o+=f,l};return L(f=>f-r&&(f!==jr?(o+=c[m],1):s())),c[m]===i?y():I("Bad string"),[,o]};E[dr]=Sr(dr);E[hr]=Sr(hr);d.string={'"':!0};var Zr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>u(r,Zr,!0));var qr=30,xr=40,br=140;k("!",br);u("||",qr);u("&&",xr);var rt=50,tt=60,et=70,Er=100,ot=140;u("|",rt);u("&",et);u("^",tt);u(">>",Er);u("<<",Er);k("~",ot);var D=90;u("<",D);u(">",D);u("<=",D);u(">=",D);var wr=80;u("==",wr);u("!=",wr);var kr=110,Z=120,Ir=140;u("+",kr);u("-",kr);u("*",Z);u("/",Z);u("%",Z);k("+",Ir);k("-",Ir);var F=150;w("++",F,r=>r?["++",r,null]:["++",A(F-1)]);w("--",F,r=>r?["--",r,null]:["--",A(F-1)]);var nt=5,it=10;W(",",it);W(";",nt,!0,!0);var pt=170;_("()",pt);var Nr=170,st=160;j("[]",Nr);sr(".",Nr);j("()",st);var mt=d.space;d.comment??={"//":`
5
- `,"/*":"*/"};d.space=()=>{for(var r,t,e,o,i;r=mt();){for(e in t=d.comment)if(r===e.charCodeAt(0)&&(e.length<2||c.charCodeAt(m+1)===e.charCodeAt(1))&&(e.length<3||c.substr(m,e.length)===e)){o=t[e],i=c.indexOf(o,m+e.length),ir(i<0?c.length:o===`
6
- `?i:i+o.length),r=0;break}if(r)return r}return r};var vr=80;u("===",vr);u("!==",vr);var ft=30;u("??",ft);var lt=130,ut=20;u("**",lt,!0);u("**=",ut,!0);var Lr=90;u("in",Lr);u("of",Lr);var ct=20,dt=100;u(">>>",dt);u(">>>=",ct,!0);var q=20;u("||=",q,!0);u("&&=",q,!0);u("??=",q,!0);a("true",!0);a("false",!1);a("null",null);M("undefined",200,()=>[]);a("NaN",NaN);a("Infinity",1/0);var x=20;w("?",x,(r,t,e)=>r&&(t=A(x-1))&&L(o=>o===58)&&(e=A(x-1),["?",r,t,e]));var ht=20;u("=>",ht,!0);var At=20;k("...",At);var Or=170;w("?.",Or,(r,t)=>{if(!r)return;let e=d.space();return e===40?(y(),["?.()",r,A(0,41)||null]):e===91?(y(),["?.[]",r,A(0,93)]):(t=z(Or),t?["?.",r,t]:void 0)});var b=140,Rr=160,gt=Rr+1;k("typeof",b);k("void",b);k("delete",b);var yt=r=>d.space()===40?(y(),["()",r,A(0,41)||null]):r;M("new",gt,()=>pr(".target")?(y(7),["new.target"]):["new",yt(A(Rr))]);var Ct=20,Pr=200;d.prop=r=>K(r)!==58;_("[]",Pr);_("{}",Pr);u(":",Ct-1,!0);var St=170,rr=96,Et=36,wt=123,kt=92,ar=()=>{let r=[],t="",e,o;for(;(e=c.charCodeAt(m))!==rr;)e?e===kt?(o=Y(),t+=o[0],y(o[1])):e===Et&&c.charCodeAt(m+1)===wt?(r.push([,t]),t="",y(2),r.push(A(0,125))):(t+=c[m],y()):I("Unterminated template");return r.push([,t]),y(),r},It=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Nt=E[rr];E[rr]=(r,t)=>r&&t<St?d.asi&&d.newline?void 0:(y(),["``",r,...ar()]):r?Nt?.(r,t):(y(),It(ar()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Ur=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?Ur(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Tr={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Tr)p(r,(t,e)=>(e=n(e),Ur(t,(o,i,s)=>Tr[r](o,i,e(s)))));p("!",r=>(r=n(r),t=>!r(t)));p("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));p("~",r=>(r=n(r),t=>~r(t)));p("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));p("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var tr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?tr(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>tr(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>tr(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var _r=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});p(",",_r);p(";",_r);var P=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",G=r=>{throw Error(r)};p("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&G("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return P(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],P(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?G("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(s=>s==null||e(s));e(t)&&G("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(s=>s(i))):(t=n(t),i=>[t(i)]):()=>[];return er(r,(i,s,f)=>i[s](...o(f)))});var N=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&N(r[1])||r[0]==="{}"),er=(r,t,e,o)=>r==null?G("Empty ()"):r[0]==="()"&&r.length==2?er(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let s=e(i);return s==null?void 0:t(s,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let s=e(i);return s==null?void 0:t(s,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),O=er;p("===",(r,t)=>(r=n(r),t=n(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=n(r),t=n(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=n(r),t=n(t),e=>r(e)??t(e)));var vt=r=>{throw Error(r)};p("**",(r,t)=>(r=n(r),t=n(t),e=>r(e)**t(e)));p("**=",(r,t)=>(N(r)||vt("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]**=t(i))));p("in",(r,t)=>(r=n(r),t=n(t),e=>r(e)in t(e)));var Lt=r=>{throw Error(r)};p(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(N(r)||Lt("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]>>>=t(i))));var Ot=r=>r[0]?.[0]===","?r[0].slice(1):r,B=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,s=Ot(i);if(o==="{}"){let f=[];for(let l of s){if(Array.isArray(l)&&l[0]==="..."){let S={};for(let U in t)f.includes(U)||(S[U]=t[U]);e[l[1]]=S;break}let h,C,v;typeof l=="string"?h=C=l:l[0]==="="?(typeof l[1]=="string"?h=C=l[1]:[,h,C]=l[1],v=l[2]):[,h,C]=l,f.push(h);let g=t[h];g===void 0&&v&&(g=n(v)(e)),B(C,g,e)}}else if(o==="[]"){let f=0;for(let l of s){if(l===null){f++;continue}if(Array.isArray(l)&&l[0]==="..."){e[l[1]]=t.slice(f);break}let h=l,C;Array.isArray(l)&&l[0]==="="&&([,h,C]=l);let v=t[f++];v===void 0&&C&&(v=n(C)(e)),B(h,v,e)}}},or=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,i=n(o);return typeof e=="string"?s=>{s[e]=i(s)}:s=>B(e,i(s),s)}return n(t)}),t=>{for(let e of r)e(t)});p("let",or);p("const",or);p("var",or);var X=r=>{throw Error(r)};p("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=n(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>B(e,t(o),o)}return N(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]=t(i))});p("||=",(r,t)=>(N(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]||=t(i))));p("&&=",(r,t)=>(N(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]&&=t(i))));p("??=",(r,t)=>(N(r)||X("Invalid assignment target"),t=n(t),O(r,(e,o,i)=>e[o]??=t(i))));p("?",(r,t,e)=>(r=n(r),t=n(t),e=n(e),o=>r(o)?t(o):e(o)));var Rt=[];p("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,i=s[1],e.length--);let f=t?.[0]==="{}";return t=n(f?["{",t[1]]:t),l=>(...h)=>{let C={};e.forEach((g,S)=>C[g]=h[S]),i&&(C[i]=h.slice(o));let v=new Proxy(C,{get:(g,S)=>S in g?g[S]:l?.[S],set:(g,S,U)=>((S in g?g:l)[S]=U,!0),has:(g,S)=>S in g||(l?S in l:!1)});try{let g=t(v);return f?void 0:g}catch(g){if(g===Rt)return g[0];throw g}}});p("...",r=>(r=n(r),t=>Object.entries(r(t))));p("?.",(r,t)=>(r=n(r),P(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return P(o)?void 0:r(e)?.[o]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(s=>s(i))):(t=n(t),i=>[t(i)]):()=>[];if(r[0]==="."||r[0]==="?."){let i=n(r[1]),s=r[2];return P(s)?()=>{}:f=>i(f)?.[s]?.(...e(f))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let i=n(r[1]),s=n(r[2]);return f=>{let l=s(f);return P(l)?void 0:i(f)?.[l]?.(...e(f))}}let o=n(r);return i=>o(i)?.(...e(i))});p("typeof",r=>(r=n(r),t=>typeof r(t)));p("void",r=>(r=n(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=n(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=n(r[1]),e=n(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=n(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(i=>s=>i.map(f=>f(s)))(e.slice(1).map(n)):(i=>s=>[i(s)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var $=Symbol("accessor");p("get",(r,t)=>(t=t?n(t):()=>{},e=>[[$,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[$,r,{set:function(i){let s=Object.create(o||{});s.this=this,s[t]=i,e(s)}}]]));var Pt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!Pt(r))return n(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>n(typeof o=="string"?[":",o,o]:o));return o=>{let i={},s={};for(let f of e.flatMap(l=>l(o)))if(f[0]===$){let[,l,h]=f;s[l]={...s[l],...h,configurable:!0,enumerable:!0}}else i[f[0]]=f[1];for(let f in s)Object.defineProperty(i,f,s[f]);return i}});p("{",r=>(r=r?n(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=n(t),Array.isArray(r)?(r=n(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(n),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=n(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(n(s));let i=Object.assign([...e],{raw:e});return s=>r(s)(i,...o.map(f=>f(s)))});var Br=new WeakMap,at=(r,...t)=>typeof r=="string"?n(d(r)):Br.get(r)||Br.set(r,Tt(r,t)).get(r),Mr=57344,Tt=(r,t)=>{let e=r.reduce((s,f,l)=>s+(l?String.fromCharCode(Mr+l-1):"")+f,""),o=d(e),i=s=>{if(typeof s=="string"&&s.length===1){let f=s.charCodeAt(0)-Mr,l;if(f>=0&&f<t.length)return l=t[f],Ut(l)?l:[,l]}return Array.isArray(s)?s.map(i):s};return n(i(o))},Ut=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),_t=at;export{j as access,u as binary,n as compile,c as cur,_t as default,I as err,A as expr,_ as group,Bt as id,m as idx,M as keyword,a as literal,Dr as loc,E as lookup,sr as member,W as nary,L as next,p as operator,H as operators,Mt as parens,d as parse,K as peek,Q as prec,z as propName,ir as seek,y as skip,w as token,k as unary,pr as word};
1
+ var u,c,d=r=>(u=0,c=r,d.enter?.(),r=A(),c[u]?O():r||""),O=(r="Unexpected token",t=u,e=c.slice(0,t).split(`
2
+ `),o=e.pop(),i=c.slice(Math.max(0,t-40),t),s="\u032D",f=(c[t]||" ")+s,m=c.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
3
+ ${i}${f}${m}`)},Kr=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),v=(r,t=u,e)=>{for(;e=r(c.charCodeAt(u));)u+=e;return c.slice(t,u)},C=(r=1)=>c[u+=r],mr=r=>u=r,A=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,A));)o=i;return t&&(e==t?(u++,d.exit?.(r,t)):O("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},H=(r=u)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Xt=d.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,fr=(r,t=r.length)=>c.substr(u,t)===r&&!d.id(c.charCodeAt(u+t)),Kt=()=>(C(),A(0,41)),w=[],j={},I=(r,t=32,e,o=r.charCodeAt(0))=>lr({op:r,l:r.length,p:j[r]=!w[o]&&j[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),l=(r,t,e=!1)=>I(r,t,(o,i)=>o&&(i=A(t-(e?.5:0)))&&[r,o,i]),N=(r,t,e)=>I(r,t,o=>e?o&&[r,o]:!o&&(o=A(t-.5))&&[r,o]),U=(r,t)=>I(r,200,e=>!e&&[,t]),W=(r,t,e,o)=>I(r,t,(i,s,f=i)=>(s=A(t-(e?.5:0)),i?.[0]!==r&&(i=[r,i||null]),s?.[0]===r?i.push(...s.slice(1)):s?i.push(s):o||H()===r.charCodeAt(0)?i.push(null):f&&i.length===2&&(i=i[1]),i)),B=(r,t)=>I(r[0],t,e=>!e&&[r,A(0,r.charCodeAt(1))||null]),z=(r,t)=>I(r[0],t,e=>e&&[r,e,A(0,r.charCodeAt(1))||null]),J=(r,t)=>(d.space(),t=c.charCodeAt(u),d.id(t)&&(t<48||t>57)?v(d.id):A(r)),ur=(r,t)=>I(r,t,(e,o)=>e&&(o=J(t))&&[r,e,o]),M=(r,t,e)=>(j[r]??=t,lr({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),pr=(r,t,e=(o,i,s,f=u,m,h,g)=>{for(g=0;h=r[g++];)if(!(h.kw&&o)&&!(s?h.op!==s:!((h.l<2||h.op.charCodeAt(1)===c.charCodeAt(u+1)&&(h.l<3||c.substr(u,h.l)===h.op))&&(!h.word||!d.id(c.charCodeAt(u+h.l)))&&(s=h.op)))&&!(i>=h.p)&&!(h.kw&&d.prop&&!d.prop(u+h.l))){if(u+=h.l,m=h.map(o))return Kr(m,f);u=f,s=0,h.word||o||t||r[g]||O()}return t?.(o,i,s)})=>(e.ops=r,e.tail=t,e),lr=(r,t=r.op.charCodeAt(0),e=w[t])=>w[t]=e?.ops?pr([r,...e.ops],e.tail):pr([r],e);d.space=r=>{for(;(r=c.charCodeAt(u))<=32;)u++;return r};d.step=(r,t,e,o,i)=>(i=w[e])&&i(r,t)||(r?null:v(d.id)||null);var Q={},p=(r,t,e=Q[r])=>Q[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):Q[r[0]]?.(...r.slice(1))??O(`Unknown operator: ${r[0]}`,r?.loc):n.id(r);n.id=r=>r===void 0?()=>{}:t=>t?.[r];var V=46,a=48,_=57,cr=69,dr=101,$r=43,jr=45,hr=95,Qr=97,Hr=102,Wr=65,zr=70,Ar=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Jr=r=>r===V&&(r=c.charCodeAt(u+1))!==V&&!(d.id(r)&&r>_&&r!==dr&&r!==cr)||r>=a&&r<=_||r===hr||((r===cr||r===dr)&&((r=c.charCodeAt(u+1))>=a&&r<=_||r===$r||r===jr)?2:0),Y=r=>(r=+Ar(v(Jr)))!=r?O():[,r],Vr=r=>t=>t===hr||t>=a&&t<=_&&t-a<r||r===16&&(t>=Qr&&t<=Hr||t>=Wr&&t<=zr);d.number=null;w[V]=r=>!r&&c.charCodeAt(u+1)>=a&&c.charCodeAt(u+1)<=_&&Y();for(let r=a;r<=_;r++)w[r]=t=>t?void 0:Y();w[a]=(r,t)=>{if(!r){for(let e in d.number)if(e[0]==="0"&&(c.charCodeAt(u+1)|32)===e.charCodeAt(1)){C(2);let o=Ar(v(Vr(t=d.number[e])));return[,parseInt(o,t)]}return Y()}};var Yr=92,gr=34,yr=39,Cr=117,Sr=120,Zr=123,qr=125,Er=10,xr=13,br={n:`
4
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},wr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Z=()=>{let r=c.charCodeAt(u+1);if(r===Er)return["",2];if(r===xr)return["",c.charCodeAt(u+2)===Er?3:2];if(r===Sr||r===Cr&&c.charCodeAt(u+2)!==Zr){let t=r===Sr?2:4,e=0,o;for(let i=0;i<t;i++){if((o=wr(c.charCodeAt(u+2+i)))<0)return[c[u+1],2];e=e*16+o}return[String.fromCharCode(e),2+t]}if(r===Cr){let t=0,e=u+3,o;for(;(o=wr(c.charCodeAt(e)))>=0;)t=t*16+o,e++;return e>u+3&&t<=1114111&&c.charCodeAt(e)===qr?[String.fromCodePoint(t),e-u+1]:[c[u+1],2]}return[br[c[u+1]]||c[u+1],2]},Ir=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!d.string?.[i])return;C();let s=()=>{let[f,m]=Z();return o+=f,m};return v(f=>f-r&&(f!==Yr?(o+=c[u],1):s())),c[u]===i?C():O("Bad string"),[,o]};w[gr]=Ir(gr);w[yr]=Ir(yr);d.string={'"':!0};var rt=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>l(r,rt,!0));var tt=30,et=40,ot=140;N("!",ot);l("||",tt);l("&&",et);var nt=50,it=60,st=70,Nr=100,pt=140;l("|",nt);l("&",st);l("^",it);l(">>",Nr);l("<<",Nr);N("~",pt);var D=90;l("<",D);l(">",D);l("<=",D);l(">=",D);var kr=80;l("==",kr);l("!=",kr);var Or=110,q=120,Lr=140;l("+",Or);l("-",Or);l("*",q);l("/",q);l("%",q);N("+",Lr);N("-",Lr);var F=150;I("++",F,r=>r?["++",r,null]:["++",A(F-1)]);I("--",F,r=>r?["--",r,null]:["--",A(F-1)]);var mt=5,ft=10;W(",",ft);W(";",mt,!0,!0);var ut=170;B("()",ut);var Rr=170,lt=160;z("[]",Rr);ur(".",Rr);z("()",lt);var ct=d.space;d.comment??={"//":`
5
+ `,"/*":"*/"};d.space=()=>{for(var r,t,e,o,i;r=ct();){for(e in t=d.comment)if(r===e.charCodeAt(0)&&(e.length<2||c.charCodeAt(u+1)===e.charCodeAt(1))&&(e.length<3||c.substr(u,e.length)===e)){o=t[e],i=c.indexOf(o,u+e.length),mr(i<0?c.length:o===`
6
+ `?i:i+o.length),r=0;break}if(r)return r}return r};var vr=80;l("===",vr);l("!==",vr);var dt=30;l("??",dt);var ht=130,At=20;l("**",ht,!0);l("**=",At,!0);var Pr=90;l("in",Pr);l("of",Pr);var gt=20,yt=100;l(">>>",yt);l(">>>=",gt,!0);var x=20;l("||=",x,!0);l("&&=",x,!0);l("??=",x,!0);U("true",!0);U("false",!1);U("null",null);M("undefined",200,()=>[]);U("NaN",NaN);U("Infinity",1/0);var b=20;I("?",b,(r,t,e)=>r&&(t=A(b-1))&&v(o=>o===58)&&(e=A(b-1),["?",r,t,e]));var Ct=20;l("=>",Ct,!0);var St=20;N("...",St);var ar=170;I("?.",ar,(r,t)=>{if(!r)return;let e=d.space();return e===40?(C(),["?.()",r,A(0,41)||null]):e===91?(C(),["?.[]",r,A(0,93)]):(t=J(ar),t?["?.",r,t]:void 0)});var rr=140,Tr=160,Et=Tr+1;N("typeof",rr);N("void",rr);N("delete",rr);var wt=r=>d.space()===40?(C(),["()",r,A(0,41)||null]):r;M("new",Et,()=>fr(".target")?(C(7),["new.target"]):["new",wt(A(Tr))]);var It=20,Ur=200;d.prop=r=>H(r)!==58;B("[]",Ur);B("{}",Ur);l(":",It-1,!0);var Nt=170,tr=96,kt=36,Ot=123,Lt=92,_r=()=>{let r=[],t="",e,o;for(;(e=c.charCodeAt(u))!==tr;)e?e===Lt?(o=Z(),t+=o[0],C(o[1])):e===kt&&c.charCodeAt(u+1)===Ot?(r.push([,t]),t="",C(2),r.push(A(0,125))):(t+=c[u],C()):O("Unterminated template");return r.push([,t]),C(),r},Rt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],vt=w[tr];w[tr]=(r,t)=>r&&t<Nt?d.asi&&d.newline?void 0:(C(),["``",r,..._r()]):r?vt?.(r,t):(C(),Rt(_r()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Gr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?Gr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Br={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Br)p(r,(t,e)=>(e=n(e),Gr(t,(o,i,s)=>Br[r](o,i,e(s)))));p("!",r=>(r=n(r),t=>!r(t)));p("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));p("~",r=>(r=n(r),t=>~r(t)));p("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));p("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var er=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?er(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>er(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>er(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var Mr=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});p(",",Mr);p(";",Mr);var Dr=r=>r!=null&&(typeof r=="object"||typeof r=="function"),k=r=>Dr(r)?Reflect.ownKeys({[r]:0})[0]:r,S=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Pt=r=>S(k(r));n.id=r=>r===void 0||Pt(r)?()=>{}:t=>t?.[r];var X=r=>{throw Error(r)};p("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&X("Missing index"),r=n(r),t=n(t),e=>{let o=k(t(e));return S(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=n(r),t=k(t[0]?t:t[1]),S(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?X("Empty ()"):n(r);let e=s=>s?.[0]===","&&s.slice(1).some(f=>f==null||e(f));e(t)&&X("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),s=>t.map(f=>f(s))):(t=n(t),s=>[t(s)]):()=>[],i=ir(r);return i<0?()=>{}:nr(r,i?(s,f,m)=>(f=k(f),S(f)?void 0:s[f](...o(m))):(s,f,m)=>s[f](...o(m)))});var L=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&L(r[1])||r[0]==="{}"),nr=(r,t,e,o)=>r==null?X("Empty ()"):r[0]==="()"&&r.length==2?nr(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let s=e(i);return s==null?void 0:t(s,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let s=e(i);return s==null?void 0:t(s,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),or=r=>Dr(r)?1:S(r)?-1:0,ir=(r,t=r?.[0],e=r?.[2])=>typeof r=="string"?or(r):t==="()"&&r.length==2?ir(r[1]):t==="."||t==="?."?or(e):(t==="[]"||t==="?.[]")&&r.length===3?Array.isArray(e)&&e[0]==null?or(e[1]):1:0,P=(r,t,e=ir(r))=>e<0?()=>{}:nr(r,e?(o,i,s)=>(i=k(i),S(i)?void 0:t(o,i,s)):t);p("===",(r,t)=>(r=n(r),t=n(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=n(r),t=n(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=n(r),t=n(t),e=>r(e)??t(e)));var at=r=>{throw Error(r)};p("**",(r,t)=>(r=n(r),t=n(t),e=>r(e)**t(e)));p("**=",(r,t)=>(L(r)||at("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]**=t(i))));p("in",(r,t)=>(r=n(r),t=n(t),e=>r(e)in t(e)));var Tt=r=>{throw Error(r)};p(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(L(r)||Tt("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]>>>=t(i))));var Ut=r=>r[0]?.[0]===","?r[0].slice(1):r,G=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,s=Ut(i);if(o==="{}"){let f=[];for(let m of s){if(Array.isArray(m)&&m[0]==="..."){let E={};for(let T in t)!f.includes(T)&&!S(T)&&(E[T]=t[T]);e[m[1]]=E;break}let h,g,R;typeof m=="string"?h=g=m:m[0]==="="?(typeof m[1]=="string"?h=g=m[1]:[,h,g]=m[1],R=m[2]):[,h,g]=m,f.push(h=k(h));let y=S(h)?void 0:t[h];y===void 0&&R&&(y=n(R)(e)),G(g,y,e)}}else if(o==="[]"){let f=0;for(let m of s){if(m===null){f++;continue}if(Array.isArray(m)&&m[0]==="..."){e[m[1]]=t.slice(f);break}let h=m,g;Array.isArray(m)&&m[0]==="="&&([,h,g]=m);let R=t[f++];R===void 0&&g&&(R=n(g)(e)),G(h,R,e)}}},sr=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,i=n(o);return typeof e=="string"?s=>{s[e]=i(s)}:s=>G(e,i(s),s)}return n(t)}),t=>{for(let e of r)e(t)});p("let",sr);p("const",sr);p("var",sr);var K=r=>{throw Error(r)};p("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=n(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>G(e,t(o),o)}return L(r)||K("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]=t(i))});p("||=",(r,t)=>(L(r)||K("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]||=t(i))));p("&&=",(r,t)=>(L(r)||K("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]&&=t(i))));p("??=",(r,t)=>(L(r)||K("Invalid assignment target"),t=n(t),P(r,(e,o,i)=>e[o]??=t(i))));p("?",(r,t,e)=>(r=n(r),t=n(t),e=n(e),o=>r(o)?t(o):e(o)));var _t=[];p("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,i=s[1],e.length--);let f=t?.[0]==="{}";return t=n(f?["{",t[1]]:t),m=>(...h)=>{let g={};e.forEach((y,E)=>g[y]=h[E]),i&&(g[i]=h.slice(o));let R=new Proxy(g,{get:(y,E)=>E in y?y[E]:m?.[E],set:(y,E,T)=>((E in y?y:m)[E]=T,!0),has:(y,E)=>E in y||(m?E in m:!1)});try{let y=t(R);return f?void 0:y}catch(y){if(y===_t)return y[0];throw y}}});p("...",r=>(r=n(r),t=>{let e=r(t),o=[];for(let i of Object.keys(e))S(i)||o.push([i,e[i]]);return o}));p("?.",(r,t)=>(r=n(r),t=k(t),S(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=r(e);if(o==null)return;let i=k(t(e));return S(i)?void 0:o[i]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(s=>s(i))):(t=n(t),i=>[t(i)]):()=>[];if(r[0]==="."||r[0]==="?."){let i=r[0]==="?.",s=n(r[1]),f=k(r[2]);return S(f)?()=>{}:i?m=>s(m)?.[f]?.(...e(m)):m=>s(m)[f]?.(...e(m))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let i=r[0]==="?.[]",s=n(r[1]),f=n(r[2]);return m=>{let h=s(m);if(i&&h==null)return;let g=k(f(m));return S(g)?void 0:h[g]?.(...e(m))}}let o=n(r);return i=>o(i)?.(...e(i))});p("typeof",r=>(r=n(r),t=>typeof r(t)));p("void",r=>(r=n(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=n(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=n(r[1]),e=n(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=n(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(i=>s=>i.map(f=>f(s)))(e.slice(1).map(n)):(i=>s=>[i(s)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var $=Symbol("accessor");p("get",(r,t)=>(t=t?n(t):()=>{},e=>[[$,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[$,r,{set:function(i){let s=Object.create(o||{});s.this=this,s[t]=i,e(s)}}]]));var Bt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!Bt(r))return n(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>n(typeof o=="string"?[":",o,o]:o));return o=>{let i={},s={};for(let f of e.flatMap(m=>m(o)))if(f[0]===$){let[,m,h]=f;s[m]={...s[m],...h,configurable:!0,enumerable:!0}}else i[f[0]]=f[1];for(let f in s)Object.defineProperty(i,f,s[f]);return i}});p("{",r=>(r=r?n(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=n(t),Array.isArray(r)?(r=n(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(n),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=n(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(n(s));let i=Object.assign([...e],{raw:e});return s=>r(s)(i,...o.map(f=>f(s)))});var Fr=new WeakMap,Gt=(r,...t)=>typeof r=="string"?n(d(r)):Fr.get(r)||Fr.set(r,Mt(r,t)).get(r),Xr=57344,Mt=(r,t)=>{let e=r.reduce((s,f,m)=>s+(m?String.fromCharCode(Xr+m-1):"")+f,""),o=d(e),i=s=>{if(typeof s=="string"&&s.length===1){let f=s.charCodeAt(0)-Xr,m;if(f>=0&&f<t.length)return m=t[f],Dt(m)?m:[,m]}return Array.isArray(s)?s.map(i):s};return n(i(o))},Dt=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Ft=Gt;export{z as access,l as binary,n as compile,c as cur,Ft as default,O as err,A as expr,B as group,Xt as id,u as idx,M as keyword,U as literal,Kr as loc,w as lookup,ur as member,W as nary,v as next,p as operator,Q as operators,Kt as parens,d as parse,H as peek,j as prec,J as propName,mr as seek,C as skip,I as token,N as unary,fr as word};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "subscript",
3
- "version": "10.7.1",
3
+ "version": "10.7.3",
4
4
  "description": "Modular expression parser & evaluator",
5
5
  "main": "subscript.js",
6
6
  "module": "subscript.js",
package/parse.js CHANGED
@@ -189,9 +189,12 @@ export const operator = (op, fn, prev = operators[op]) =>
189
189
  // Compile AST to evaluator function
190
190
  // Note: [, value] serializes to [null, value] in JSON, both forms accepted
191
191
  export const compile = node => (
192
- !Array.isArray(node) ? (node === undefined ? () => undefined : ctx => ctx?.[node]) :
192
+ !Array.isArray(node) ? compile.id(node) :
193
193
  node[0] == null ? (v => () => v)(node[1]) : // == catches both undefined and null
194
194
  operators[node[0]]?.(...node.slice(1)) ?? err(`Unknown operator: ${node[0]}`, node?.loc)
195
195
  );
196
196
 
197
+ // Identifier compiler hook. Eval layers can replace context lookup policy.
198
+ compile.id = node => node === undefined ? () => undefined : ctx => ctx?.[node];
199
+
197
200
  export default parse;
package/subscript.d.ts CHANGED
@@ -35,6 +35,9 @@ export function propName(prec: number): AST;
35
35
  export const operators: Record<string, Operator>;
36
36
  export function operator(op: string, fn: Operator): void;
37
37
  export function compile(node: AST): Evaluator;
38
+ export namespace compile {
39
+ let id: (node: Identifier | undefined) => Evaluator;
40
+ }
38
41
 
39
42
  // Default export
40
43
  export default parse;
package/subscript.min.js CHANGED
@@ -1,4 +1,4 @@
1
- var p,l,u=r=>(p=0,l=r,u.enter?.(),r=C(),l[p]?y():r||""),y=(r="Unexpected token",t=p,e=l.slice(0,t).split(`
2
- `),o=e.pop(),n=l.slice(Math.max(0,t-40),t),s="\u032D",c=(l[t]||" ")+s,A=l.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
3
- ${n}${c}${A}`)},mr=(r,t=p)=>(Array.isArray(r)&&(r.loc=t),r),E=(r,t=p,e)=>{for(;e=r(l.charCodeAt(p));)p+=e;return l.slice(t,p)},k=(r=1)=>l[p+=r],Gr=r=>p=r,C=(r=0,t)=>{let e,o,n;for(t&&u.enter?.(r,t);(e=u.space())&&e!==t&&(n=u.step(o,r,e,C));)o=n;return t&&(e==t?(p++,u.exit?.(r,t)):y("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},ur=(r=p)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},Wr=u.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,zr=(r,t=r.length)=>l.substr(p,t)===r&&!u.id(l.charCodeAt(p+t)),Jr=()=>(k(),C(0,41)),d=[],T={},g=(r,t=32,e,o=r.charCodeAt(0))=>v({op:r,l:r.length,p:T[r]=!d[o]&&T[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),f=(r,t,e=!1)=>g(r,t,(o,n)=>o&&(n=C(t-(e?.5:0)))&&[r,o,n]),S=(r,t,e)=>g(r,t,o=>e?o&&[r,o]:!o&&(o=C(t-.5))&&[r,o]),Kr=(r,t)=>g(r,200,e=>!e&&[,t]),D=(r,t,e,o)=>g(r,t,(n,s,c=n)=>(s=C(t-(e?.5:0)),n?.[0]!==r&&(n=[r,n||null]),s?.[0]===r?n.push(...s.slice(1)):s?n.push(s):o||ur()===r.charCodeAt(0)?n.push(null):c&&n.length===2&&(n=n[1]),n)),B=(r,t)=>g(r[0],t,e=>!e&&[r,C(0,r.charCodeAt(1))||null]),M=(r,t)=>g(r[0],t,e=>e&&[r,e,C(0,r.charCodeAt(1))||null]),fr=(r,t)=>(u.space(),t=l.charCodeAt(p),u.id(t)&&(t<48||t>57)?E(u.id):C(r)),Q=(r,t)=>g(r,t,(e,o)=>e&&(o=fr(t))&&[r,e,o]),Vr=(r,t,e)=>(T[r]??=t,v({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),X=(r,t,e=(o,n,s,c=p,A,h,I)=>{for(I=0;h=r[I++];)if(!(h.kw&&o)&&!(s?h.op!==s:!((h.l<2||h.op.charCodeAt(1)===l.charCodeAt(p+1)&&(h.l<3||l.substr(p,h.l)===h.op))&&(!h.word||!u.id(l.charCodeAt(p+h.l)))&&(s=h.op)))&&!(n>=h.p)&&!(h.kw&&u.prop&&!u.prop(p+h.l))){if(p+=h.l,A=h.map(o))return mr(A,c);p=c,s=0,h.word||o||t||r[I]||y()}return t?.(o,n,s)})=>(e.ops=r,e.tail=t,e),v=(r,t=r.op.charCodeAt(0),e=d[t])=>d[t]=e?.ops?X([r,...e.ops],e.tail):X([r],e);u.space=r=>{for(;(r=l.charCodeAt(p))<=32;)p++;return r};u.step=(r,t,e,o,n)=>(n=d[e])&&n(r,t)||(r?null:E(u.id)||null);var L={},m=(r,t,e=L[r])=>L[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):L[r[0]]?.(...r.slice(1))??y(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var N=46,w=48,R=57,H=69,G=101,cr=43,hr=45,W=95,Ar=97,Cr=102,dr=65,gr=70,z=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),yr=r=>r===N&&(r=l.charCodeAt(p+1))!==N&&!(u.id(r)&&r>R&&r!==G&&r!==H)||r>=w&&r<=R||r===W||((r===H||r===G)&&((r=l.charCodeAt(p+1))>=w&&r<=R||r===cr||r===hr)?2:0),F=r=>(r=+z(E(yr)))!=r?y():[,r],Er=r=>t=>t===W||t>=w&&t<=R&&t-w<r||r===16&&(t>=Ar&&t<=Cr||t>=dr&&t<=gr);u.number=null;d[N]=r=>!r&&l.charCodeAt(p+1)>=w&&l.charCodeAt(p+1)<=R&&F();for(let r=w;r<=R;r++)d[r]=t=>t?void 0:F();d[w]=(r,t)=>{if(!r){for(let e in u.number)if(e[0]==="0"&&(l.charCodeAt(p+1)|32)===e.charCodeAt(1)){k(2);let o=z(E(Er(t=u.number[e])));return[,parseInt(o,t)]}return F()}};var Sr=92,J=34,K=39,V=117,Y=120,wr=123,kr=125,Z=10,Rr=13,_r={n:`
4
- `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},q=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Pr=()=>{let r=l.charCodeAt(p+1);if(r===Z)return["",2];if(r===Rr)return["",l.charCodeAt(p+2)===Z?3:2];if(r===Y||r===V&&l.charCodeAt(p+2)!==wr){let t=r===Y?2:4,e=0,o;for(let n=0;n<t;n++){if((o=q(l.charCodeAt(p+2+n)))<0)return[l[p+1],2];e=e*16+o}return[String.fromCharCode(e),2+t]}if(r===V){let t=0,e=p+3,o;for(;(o=q(l.charCodeAt(e)))>=0;)t=t*16+o,e++;return e>p+3&&t<=1114111&&l.charCodeAt(e)===kr?[String.fromCodePoint(t),e-p+1]:[l[p+1],2]}return[_r[l[p+1]]||l[p+1],2]},x=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(t||!u.string?.[n])return;k();let s=()=>{let[c,A]=Pr();return o+=c,A};return E(c=>c-r&&(c!==Sr?(o+=l[p],1):s())),l[p]===n?k():y("Bad string"),[,o]};d[J]=x(J);d[K]=x(K);u.string={'"':!0};var Ur=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>f(r,Ur,!0));var Ir=30,Tr=40,Lr=140;S("!",Lr);f("||",Ir);f("&&",Tr);var Dr=50,Mr=60,Nr=70,j=100,Fr=140;f("|",Dr);f("&",Nr);f("^",Mr);f(">>",j);f("<<",j);S("~",Fr);var _=90;f("<",_);f(">",_);f("<=",_);f(">=",_);var a=80;f("==",a);f("!=",a);var b=110,$=120,rr=140;f("+",b);f("-",b);f("*",$);f("/",$);f("%",$);S("+",rr);S("-",rr);var P=150;g("++",P,r=>r?["++",r,null]:["++",C(P-1)]);g("--",P,r=>r?["--",r,null]:["--",C(P-1)]);var $r=5,Or=10;D(",",Or);D(";",$r,!0,!0);var Xr=170;B("()",Xr);var tr=170,Br=160;M("[]",tr);Q(".",tr);M("()",Br);var or=(r,t,e,o)=>typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="()"&&r.length===2?or(r[1],t):(()=>{throw Error("Invalid assignment target")})(),er={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in er)m(r,(t,e)=>(e=i(e),or(t,(o,n,s)=>er[r](o,n,e(s)))));m("!",r=>(r=i(r),t=>!r(t)));m("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));m("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));m("~",r=>(r=i(r),t=>~r(t)));m("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));m("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));m("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));m(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));m("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));m(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));m("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));m(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));m("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));m("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));m("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));m("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));m("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));m("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));m("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));m("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var O=(r,t,e,o)=>typeof r=="string"?n=>t(n,r):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n))):r[0]==="()"&&r.length===2?O(r[1],t):(()=>{throw Error("Invalid increment target")})();m("++",(r,t)=>O(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));m("--",(r,t)=>O(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var nr=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});m(",",nr);m(";",nr);var ir=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",U=r=>{throw Error(r)};m("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&U("Missing index"),r=i(r),t=i(t),e=>{let o=t(e);return ir(o)?void 0:r(e)[o]}));m(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],ir(t)?()=>{}:e=>r(e)[t]));m("()",(r,t)=>{if(t===void 0)return r==null?U("Empty ()"):i(r);let e=n=>n?.[0]===","&&n.slice(1).some(s=>s==null||e(s));e(t)&&U("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];return pr(r,(n,s,c)=>n[s](...o(c)))});var pr=(r,t,e,o)=>r==null?U("Empty ()"):r[0]==="()"&&r.length==2?pr(r[1],t):typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="?."?(e=i(r[1]),o=r[2],n=>{let s=e(n);return s==null?void 0:t(s,o,n)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="?.[]"?(e=i(r[1]),o=i(r[2]),n=>{let s=e(n);return s==null?void 0:t(s,o(n),n)}):(r=i(r),n=>t([r(n)],0,n));var sr=new WeakMap,Qr=(r,...t)=>typeof r=="string"?i(u(r)):sr.get(r)||sr.set(r,vr(r,t)).get(r),lr=57344,vr=(r,t)=>{let e=r.reduce((s,c,A)=>s+(A?String.fromCharCode(lr+A-1):"")+c,""),o=u(e),n=s=>{if(typeof s=="string"&&s.length===1){let c=s.charCodeAt(0)-lr,A;if(c>=0&&c<t.length)return A=t[c],Hr(A)?A:[,A]}return Array.isArray(s)?s.map(n):s};return i(n(o))},Hr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),zt=Qr;export{M as access,f as binary,i as compile,l as cur,zt as default,y as err,C as expr,B as group,Wr as id,p as idx,Vr as keyword,Kr as literal,mr as loc,d as lookup,Q as member,D as nary,E as next,m as operator,L as operators,Jr as parens,u as parse,ur as peek,T as prec,fr as propName,Gr as seek,k as skip,g as token,S as unary,zr as word};
1
+ var s,l,f=r=>(s=0,l=r,f.enter?.(),r=A(),l[s]?E():r||""),E=(r="Unexpected token",t=s,e=l.slice(0,t).split(`
2
+ `),o=e.pop(),i=l.slice(Math.max(0,t-40),t),p="\u032D",u=(l[t]||" ")+p,d=l.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
3
+ ${i}${u}${d}`)},dr=(r,t=s)=>(Array.isArray(r)&&(r.loc=t),r),S=(r,t=s,e)=>{for(;e=r(l.charCodeAt(s));)s+=e;return l.slice(t,s)},R=(r=1)=>l[s+=r],Jr=r=>s=r,A=(r=0,t)=>{let e,o,i;for(t&&f.enter?.(r,t);(e=f.space())&&e!==t&&(i=f.step(o,r,e,A));)o=i;return t&&(e==t?(s++,f.exit?.(r,t)):E("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},hr=(r=s)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},Vr=f.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,Yr=(r,t=r.length)=>l.substr(s,t)===r&&!f.id(l.charCodeAt(s+t)),Zr=()=>(R(),A(0,41)),C=[],D={},g=(r,t=32,e,o=r.charCodeAt(0))=>v({op:r,l:r.length,p:D[r]=!C[o]&&D[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),c=(r,t,e=!1)=>g(r,t,(o,i)=>o&&(i=A(t-(e?.5:0)))&&[r,o,i]),y=(r,t,e)=>g(r,t,o=>e?o&&[r,o]:!o&&(o=A(t-.5))&&[r,o]),qr=(r,t)=>g(r,200,e=>!e&&[,t]),F=(r,t,e,o)=>g(r,t,(i,p,u=i)=>(p=A(t-(e?.5:0)),i?.[0]!==r&&(i=[r,i||null]),p?.[0]===r?i.push(...p.slice(1)):p?i.push(p):o||hr()===r.charCodeAt(0)?i.push(null):u&&i.length===2&&(i=i[1]),i)),H=(r,t)=>g(r[0],t,e=>!e&&[r,A(0,r.charCodeAt(1))||null]),O=(r,t)=>g(r[0],t,e=>e&&[r,e,A(0,r.charCodeAt(1))||null]),Ar=(r,t)=>(f.space(),t=l.charCodeAt(s),f.id(t)&&(t<48||t>57)?S(f.id):A(r)),K=(r,t)=>g(r,t,(e,o)=>e&&(o=Ar(t))&&[r,e,o]),jr=(r,t,e)=>(D[r]??=t,v({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),G=(r,t,e=(o,i,p,u=s,d,h,N)=>{for(N=0;h=r[N++];)if(!(h.kw&&o)&&!(p?h.op!==p:!((h.l<2||h.op.charCodeAt(1)===l.charCodeAt(s+1)&&(h.l<3||l.substr(s,h.l)===h.op))&&(!h.word||!f.id(l.charCodeAt(s+h.l)))&&(p=h.op)))&&!(i>=h.p)&&!(h.kw&&f.prop&&!f.prop(s+h.l))){if(s+=h.l,d=h.map(o))return dr(d,u);s=u,p=0,h.word||o||t||r[N]||E()}return t?.(o,i,p)})=>(e.ops=r,e.tail=t,e),v=(r,t=r.op.charCodeAt(0),e=C[t])=>C[t]=e?.ops?G([r,...e.ops],e.tail):G([r],e);f.space=r=>{for(;(r=l.charCodeAt(s))<=32;)s++;return r};f.step=(r,t,e,o,i)=>(i=C[e])&&i(r,t)||(r?null:S(f.id)||null);var M={},m=(r,t,e=M[r])=>M[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):M[r[0]]?.(...r.slice(1))??E(`Unknown operator: ${r[0]}`,r?.loc):n.id(r);n.id=r=>r===void 0?()=>{}:t=>t?.[r];var $=46,w=48,_=57,W=69,x=101,Cr=43,gr=45,z=95,Er=97,Sr=102,yr=65,wr=70,J=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Rr=r=>r===$&&(r=l.charCodeAt(s+1))!==$&&!(f.id(r)&&r>_&&r!==x&&r!==W)||r>=w&&r<=_||r===z||((r===W||r===x)&&((r=l.charCodeAt(s+1))>=w&&r<=_||r===Cr||r===gr)?2:0),X=r=>(r=+J(S(Rr)))!=r?E():[,r],_r=r=>t=>t===z||t>=w&&t<=_&&t-w<r||r===16&&(t>=Er&&t<=Sr||t>=yr&&t<=wr);f.number=null;C[$]=r=>!r&&l.charCodeAt(s+1)>=w&&l.charCodeAt(s+1)<=_&&X();for(let r=w;r<=_;r++)C[r]=t=>t?void 0:X();C[w]=(r,t)=>{if(!r){for(let e in f.number)if(e[0]==="0"&&(l.charCodeAt(s+1)|32)===e.charCodeAt(1)){R(2);let o=J(S(_r(t=f.number[e])));return[,parseInt(o,t)]}return X()}};var Pr=92,V=34,Y=39,Z=117,q=120,Ur=123,Ir=125,j=10,Tr=13,Lr={n:`
4
+ `,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},a=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Nr=()=>{let r=l.charCodeAt(s+1);if(r===j)return["",2];if(r===Tr)return["",l.charCodeAt(s+2)===j?3:2];if(r===q||r===Z&&l.charCodeAt(s+2)!==Ur){let t=r===q?2:4,e=0,o;for(let i=0;i<t;i++){if((o=a(l.charCodeAt(s+2+i)))<0)return[l[s+1],2];e=e*16+o}return[String.fromCharCode(e),2+t]}if(r===Z){let t=0,e=s+3,o;for(;(o=a(l.charCodeAt(e)))>=0;)t=t*16+o,e++;return e>s+3&&t<=1114111&&l.charCodeAt(e)===Ir?[String.fromCodePoint(t),e-s+1]:[l[s+1],2]}return[Lr[l[s+1]]||l[s+1],2]},b=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!f.string?.[i])return;R();let p=()=>{let[u,d]=Nr();return o+=u,d};return S(u=>u-r&&(u!==Pr?(o+=l[s],1):p())),l[s]===i?R():E("Bad string"),[,o]};C[V]=b(V);C[Y]=b(Y);f.string={'"':!0};var Dr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Dr,!0));var Mr=30,Fr=40,Or=140;y("!",Or);c("||",Mr);c("&&",Fr);var $r=50,Xr=60,kr=70,rr=100,Br=140;c("|",$r);c("&",kr);c("^",Xr);c(">>",rr);c("<<",rr);y("~",Br);var U=90;c("<",U);c(">",U);c("<=",U);c(">=",U);var tr=80;c("==",tr);c("!=",tr);var er=110,k=120,or=140;c("+",er);c("-",er);c("*",k);c("/",k);c("%",k);y("+",or);y("-",or);var I=150;g("++",I,r=>r?["++",r,null]:["++",A(I-1)]);g("--",I,r=>r?["--",r,null]:["--",A(I-1)]);var Qr=5,Gr=10;F(",",Gr);F(";",Qr,!0,!0);var Hr=170;H("()",Hr);var nr=170,Kr=160;O("[]",nr);K(".",nr);O("()",Kr);var sr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="()"&&r.length===2?sr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),ir={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in ir)m(r,(t,e)=>(e=n(e),sr(t,(o,i,p)=>ir[r](o,i,e(p)))));m("!",r=>(r=n(r),t=>!r(t)));m("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));m("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));m("~",r=>(r=n(r),t=>~r(t)));m("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));m("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));m("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));m(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));m("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));m(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));m("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));m(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));m("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));m("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));m("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));m("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));m("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));m("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));m("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));m("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var B=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?B(r[1],t):(()=>{throw Error("Invalid increment target")})();m("++",(r,t)=>B(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));m("--",(r,t)=>B(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var pr=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});m(",",pr);m(";",pr);var lr=r=>r!=null&&(typeof r=="object"||typeof r=="function"),L=r=>lr(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),vr=r=>P(L(r));n.id=r=>r===void 0||vr(r)?()=>{}:t=>t?.[r];var T=r=>{throw Error(r)};m("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&T("Missing index"),r=n(r),t=n(t),e=>{let o=L(t(e));return P(o)?void 0:r(e)[o]}));m(".",(r,t)=>(r=n(r),t=L(t[0]?t:t[1]),P(t)?()=>{}:e=>r(e)[t]));m("()",(r,t)=>{if(t===void 0)return r==null?T("Empty ()"):n(r);let e=p=>p?.[0]===","&&p.slice(1).some(u=>u==null||e(u));e(t)&&T("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),p=>t.map(u=>u(p))):(t=n(t),p=>[t(p)]):()=>[],i=ur(r);return i<0?()=>{}:mr(r,i?(p,u,d)=>(u=L(u),P(u)?void 0:p[u](...o(d))):(p,u,d)=>p[u](...o(d)))});var mr=(r,t,e,o)=>r==null?T("Empty ()"):r[0]==="()"&&r.length==2?mr(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let p=e(i);return p==null?void 0:t(p,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let p=e(i);return p==null?void 0:t(p,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),Q=r=>lr(r)?1:P(r)?-1:0,ur=(r,t=r?.[0],e=r?.[2])=>typeof r=="string"?Q(r):t==="()"&&r.length==2?ur(r[1]):t==="."||t==="?."?Q(e):(t==="[]"||t==="?.[]")&&r.length===3?Array.isArray(e)&&e[0]==null?Q(e[1]):1:0;var fr=new WeakMap,Wr=(r,...t)=>typeof r=="string"?n(f(r)):fr.get(r)||fr.set(r,xr(r,t)).get(r),cr=57344,xr=(r,t)=>{let e=r.reduce((p,u,d)=>p+(d?String.fromCharCode(cr+d-1):"")+u,""),o=f(e),i=p=>{if(typeof p=="string"&&p.length===1){let u=p.charCodeAt(0)-cr,d;if(u>=0&&u<t.length)return d=t[u],zr(d)?d:[,d]}return Array.isArray(p)?p.map(i):p};return n(i(o))},zr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Yt=Wr;export{O as access,c as binary,n as compile,l as cur,Yt as default,E as err,A as expr,H as group,Vr as id,s as idx,jr as keyword,qr as literal,dr as loc,C as lookup,K as member,F as nary,S as next,m as operator,M as operators,Zr as parens,f as parse,hr as peek,D as prec,Ar as propName,Jr as seek,R as skip,g as token,y as unary,Yr as word};