subscript 10.7.2 → 10.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/feature/accessor.js +24 -10
- package/feature/async.js +14 -15
- package/feature/class.js +2 -0
- package/feature/string.js +30 -17
- package/jessie.min.js +7 -7
- package/justin.min.js +6 -6
- package/package.json +1 -1
- package/subscript.min.js +4 -4
package/feature/accessor.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* { get x() { body } } → ['{}', ['get', 'x', body]]
|
|
5
5
|
* { set x(v) { body } } → ['{}', ['set', 'x', 'v', body]]
|
|
6
6
|
* { *g() { body } } → ['{}', [':', 'g', ['function*', null, params, body]]]
|
|
7
|
+
* { m(p) { body } } → ['{}', [':', 'm', ['function', null, params, body]]]
|
|
7
8
|
*/
|
|
8
9
|
import { token, expr, skip, next, parse, cur, idx, prec, seek } from '../parse.js';
|
|
9
10
|
|
|
@@ -26,6 +27,15 @@ const isMethodKey = a =>
|
|
|
26
27
|
typeof a === 'string' ||
|
|
27
28
|
(Array.isArray(a) && (a[0] === undefined || a[0] === '[]'));
|
|
28
29
|
|
|
30
|
+
// The token dispatcher rewinds idx on failure; speculative member parsing
|
|
31
|
+
// must also restore the ASI flags before an expression handler retries.
|
|
32
|
+
const speculate = handler => a => {
|
|
33
|
+
const newline = parse.newline, semi = parse.semi;
|
|
34
|
+
const node = handler(a);
|
|
35
|
+
if (!node) { parse.newline = newline; parse.semi = semi; }
|
|
36
|
+
return node;
|
|
37
|
+
};
|
|
38
|
+
|
|
29
39
|
// Shared parser for get/set — returns false if not valid accessor pattern (falls through to identifier)
|
|
30
40
|
// Returns false (not undefined) to signal "fall through without setting reserved"
|
|
31
41
|
const accessor = (kind) => a => {
|
|
@@ -45,14 +55,16 @@ const accessor = (kind) => a => {
|
|
|
45
55
|
return [kind, name, params, expr(0, CBRACE)];
|
|
46
56
|
};
|
|
47
57
|
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
// TOKEN, like `#` and `*`, so they fire inside `static`'s operand (unary prec
|
|
59
|
+
// 175): static get x() {} → ['static', ['get', 'x', params, body]]
|
|
60
|
+
token('get', TOKEN, speculate(accessor('get')));
|
|
61
|
+
token('set', TOKEN, speculate(accessor('set')));
|
|
50
62
|
|
|
51
63
|
// Generator method: { *g() {} } / class { *g() {} } / static *g() {}
|
|
52
64
|
// → [':', key, ['function*', null, params, body]] (≡ g: function* () {})
|
|
53
65
|
// Prefix-only: infix `*` falls through to multiplication. Registered at TOKEN
|
|
54
|
-
// so it fires inside `static`'s operand
|
|
55
|
-
//
|
|
66
|
+
// so it fires inside `static`'s operand; prefix `*` is never valid JS outside
|
|
67
|
+
// member position, so the wide precedence can't misparse.
|
|
56
68
|
// token() re-registration would clobber prec['*'] (multiplication) in the
|
|
57
69
|
// introspection registry (loop.js reads it) — save/restore.
|
|
58
70
|
// A param list is method-shaped when every item could bind: identifier,
|
|
@@ -62,7 +74,7 @@ const paramish = n => n == null || typeof n === 'string' ||
|
|
|
62
74
|
n[0] === '=' ? typeof n[1] === 'string' || paramish(n[1]) :
|
|
63
75
|
n[0] === '...' || n[0] === '{}' || n[0] === '[]'));
|
|
64
76
|
const multPrec = prec['*'];
|
|
65
|
-
token('*', TOKEN, a => {
|
|
77
|
+
token('*', TOKEN, speculate(a => {
|
|
66
78
|
// Infix `*` is multiplication — EXCEPT at a member boundary: class bodies
|
|
67
79
|
// have no separators, so `ctor() {} *g() {}` reaches here with the previous
|
|
68
80
|
// member as `a` (ASI can't split on `*`: `x \n * y` must stay a product).
|
|
@@ -83,14 +95,16 @@ token('*', TOKEN, a => {
|
|
|
83
95
|
skip();
|
|
84
96
|
const node = [':', name, ['function*', null, params, expr(0, CBRACE) || null]];
|
|
85
97
|
return a ? (a[0] === ';' ? (a.push(node), a) : [';', a, node]) : node;
|
|
86
|
-
});
|
|
98
|
+
}));
|
|
87
99
|
prec['*'] = multPrec;
|
|
88
100
|
|
|
89
101
|
// Method shorthand: { foo() {} } / { async foo() {} } / class { static foo() {} }
|
|
90
|
-
// → [':', key, ['
|
|
102
|
+
// → [':', key, ['function', null, params, body]] (≡ foo: function () {})
|
|
103
|
+
// A function, not an arrow: the body is statement-shaped (`{ f() }` returns
|
|
104
|
+
// undefined, an arrow's `f()` would be its value) and `this` is the receiver.
|
|
91
105
|
// Accepts identifier, string-literal node [, "..."], ['async', key] from
|
|
92
106
|
// async.js, or ['static', key] from unary('static').
|
|
93
|
-
token('(', ASSIGN - 1, a => {
|
|
107
|
+
token('(', ASSIGN - 1, speculate(a => {
|
|
94
108
|
if (!a) return;
|
|
95
109
|
// ['static', key] from unary('static'): unwrap, re-wrap the resulting method node.
|
|
96
110
|
// ['async', key] from async.js: unwrap, wrap the method value in async.
|
|
@@ -104,8 +118,8 @@ token('(', ASSIGN - 1, a => {
|
|
|
104
118
|
// Not followed by { - not method shorthand, fall through
|
|
105
119
|
if (cur.charCodeAt(idx) !== OBRACE) return;
|
|
106
120
|
skip();
|
|
107
|
-
let value = ['
|
|
121
|
+
let value = ['function', null, params, expr(0, CBRACE) || null];
|
|
108
122
|
if (isAsync) value = ['async', value];
|
|
109
123
|
const node = [':', a, value];
|
|
110
124
|
return wrap ? [wrap, node] : node;
|
|
111
|
-
});
|
|
125
|
+
}));
|
package/feature/async.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Async/await/yield: async function, async arrow, await, yield expressions - parse half
|
|
2
|
-
import { parse, unary, expr, skip, seek, keyword, cur, idx, word,
|
|
2
|
+
import { parse, unary, expr, skip, seek, keyword, cur, idx, word, peek } from '../parse.js';
|
|
3
3
|
|
|
4
|
-
const PREFIX = 140, ASSIGN = 20, OPAREN = 40;
|
|
4
|
+
const TOKEN = 200, PREFIX = 140, ASSIGN = 20, OPAREN = 40;
|
|
5
5
|
|
|
6
6
|
// await expr → ['await', expr]
|
|
7
7
|
unary('await', PREFIX);
|
|
@@ -26,20 +26,19 @@ keyword('yield', PREFIX, () => {
|
|
|
26
26
|
// async function name() {} → ['async', ['function', name, params, body]]
|
|
27
27
|
// async () => {} → ['async', ['=>', params, body]]
|
|
28
28
|
// async x => {} → ['async', ['=>', x, body]]
|
|
29
|
-
|
|
29
|
+
// async key( → ['async', key] (accessor.js's `(` builds the method)
|
|
30
|
+
// async *g() {} → [':', 'g', ['async', ['function*', ...]]]
|
|
31
|
+
// Restricted production: a LineTerminator after `async` makes it an identifier.
|
|
32
|
+
// TOKEN, like the other member-position prefixes, so it fires inside `static`.
|
|
33
|
+
keyword('async', TOKEN, () => {
|
|
34
|
+
if (nlAhead(idx)) return;
|
|
30
35
|
parse.space();
|
|
31
|
-
// async function - check for 'function' word
|
|
32
36
|
if (word('function')) return ['async', expr(PREFIX)];
|
|
33
|
-
//
|
|
34
|
-
// async name => → arrow with single param
|
|
37
|
+
// member head: key, #key, [key], "key", or a whole *g() {} method
|
|
35
38
|
const from = idx;
|
|
36
|
-
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
// async arrow: async () => or async x =>
|
|
43
|
-
const params = expr(ASSIGN - .5);
|
|
44
|
-
return params && ['async', params];
|
|
39
|
+
let m = expr(TOKEN - .5);
|
|
40
|
+
if (m?.[0] === ':') return [':', m[1], ['async', m[2]]];
|
|
41
|
+
if (m && peek() === OPAREN) return ['async', m];
|
|
42
|
+
// arrow: async x => / async (...) =>
|
|
43
|
+
if ((m || peek() === OPAREN) && (seek(from), m = expr(ASSIGN - .5))?.[0] === '=>') return ['async', m];
|
|
45
44
|
});
|
package/feature/class.js
CHANGED
|
@@ -9,6 +9,8 @@ const HERITAGE = CALL - .5;
|
|
|
9
9
|
// static member → ['static', member]
|
|
10
10
|
// STATIC > ACCESS (170) so `static m` doesn't pull `(` into the operand as a
|
|
11
11
|
// function call — leaves the `(` for the outer method-shorthand handler.
|
|
12
|
+
// STATIC < TOKEN (200) so the member-position prefixes (`#`, `*`, `async`,
|
|
13
|
+
// `get`/`set`) fire inside the operand: `static async m()`, `static get x()`.
|
|
12
14
|
unary('static', STATIC);
|
|
13
15
|
|
|
14
16
|
// instanceof: object instanceof Constructor
|
package/feature/string.js
CHANGED
|
@@ -13,31 +13,44 @@ const hex = c =>
|
|
|
13
13
|
c >= 65 && c <= 70 ? c - 55 :
|
|
14
14
|
c >= 97 && c <= 102 ? c - 87 : -1;
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const n = cur.charCodeAt(idx + 1);
|
|
22
|
-
if (n === LF) return ['', 2];
|
|
23
|
-
if (n === CR) return ['', cur.charCodeAt(idx + 2) === LF ? 3 : 2];
|
|
24
|
-
// \xHH or \uHHHH
|
|
25
|
-
if (n === X || (n === U && cur.charCodeAt(idx + 2) !== LBRACE)) {
|
|
16
|
+
// Read a numeric escape without changing parser state.
|
|
17
|
+
const escapePoint = start => {
|
|
18
|
+
if (cur.charCodeAt(start) !== BSLASH) return;
|
|
19
|
+
const n = cur.charCodeAt(start + 1);
|
|
20
|
+
if (n === X || (n === U && cur.charCodeAt(start + 2) !== LBRACE)) {
|
|
26
21
|
const w = n === X ? 2 : 4;
|
|
27
22
|
let cp = 0, h;
|
|
28
23
|
for (let k = 0; k < w; k++) {
|
|
29
|
-
if ((h = hex(cur.charCodeAt(
|
|
24
|
+
if ((h = hex(cur.charCodeAt(start + 2 + k))) < 0) return;
|
|
30
25
|
cp = cp * 16 + h;
|
|
31
26
|
}
|
|
32
|
-
return [
|
|
27
|
+
return [cp, 2 + w];
|
|
33
28
|
}
|
|
34
|
-
// \u{H...H}
|
|
35
29
|
if (n === U) {
|
|
36
|
-
let cp = 0, k =
|
|
30
|
+
let cp = 0, k = start + 3, h;
|
|
37
31
|
while ((h = hex(cur.charCodeAt(k))) >= 0) cp = cp * 16 + h, k++;
|
|
38
|
-
if (k >
|
|
39
|
-
return [
|
|
40
|
-
|
|
32
|
+
if (k > start + 3 && cp <= 0x10ffff && cur.charCodeAt(k) === RBRACE)
|
|
33
|
+
return [cp, k - start + 1];
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Decode one escape (or an adjacent surrogate pair). Shared with templates.
|
|
38
|
+
// Pair before constructing text so Unicode encoders see one scalar value.
|
|
39
|
+
const decodeEscape = () => {
|
|
40
|
+
const n = cur.charCodeAt(idx + 1);
|
|
41
|
+
if (n === LF) return ['', 2];
|
|
42
|
+
if (n === CR) return ['', cur.charCodeAt(idx + 2) === LF ? 3 : 2];
|
|
43
|
+
const p = escapePoint(idx);
|
|
44
|
+
if (p) {
|
|
45
|
+
let [cp, w] = p;
|
|
46
|
+
if (cp >= 0xD800 && cp <= 0xDBFF) {
|
|
47
|
+
const q = escapePoint(idx + w);
|
|
48
|
+
if (q && q[0] >= 0xDC00 && q[0] <= 0xDFFF) {
|
|
49
|
+
cp = 0x10000 + (cp - 0xD800) * 1024 + q[0] - 0xDC00;
|
|
50
|
+
w += q[1];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [String.fromCodePoint(cp), w];
|
|
41
54
|
}
|
|
42
55
|
return [esc[cur[idx + 1]] || cur[idx + 1], 2];
|
|
43
56
|
};
|
package/jessie.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),o=t.pop(),n=m.slice(Math.max(0,e-40),e),p="\u032D",c=(m[e]||" ")+p,
|
|
3
|
-
${n}${c}${
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},
|
|
5
|
-
`,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=
|
|
6
|
-
`?n:n+o.length),r=0;break}if(r)return r}return r};var
|
|
7
|
-
`;var _e=32,Ur=10,lo=59,uo=125,Re=91,Ie=40,er=v.asi??v[";"],co=s._baseSpace??=s.space,mo=s._baseStep??=s.step,vr=r=>Array.isArray(r)||typeof r=="string",ao=(v[";"]??5)+1,Mr=r=>Array.isArray(r)&&(v[r[0]]<=ao||r[0]==="{}"&&Mr(r[1])),ho=(r,e)=>{for(;(e=m.charCodeAt(r))<=_e;){if(e===Ur)return!0;r++}return!1},Ao=(r=l,e)=>{for(;r-- >0&&(e=m.charCodeAt(r))<=_e;)if(e===Ur)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=co();e<l;)if(m.charCodeAt(e++)===Ur){s.newline=!0;break}if(r===lo&&ho(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===uo&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=er)return!1;if(r&&!vr(r))return null;if(vr(r)){let p=(t===Re||t===Ie)&&Ao();if(s.semi||t===Re&&(p||Mr(r))||t===Ie&&(Mr(r)||p&&e>=er))return Oe(r,e,o)??null}let n=s.newline;return mo(r,e,t,o)??(vr(r)&&n?Oe(r,e,o)??null:null)};var Br=0,yo=2e3,Oe=s.asi=(r,e,t,o,n)=>{if(e>=er||Br>=yo)return;s.semi=!1;let p=l;Br++;try{o=t(er-.5)}finally{Br--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var Pe=(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?Pe(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Le={"=":(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 Le)f(r,(e,t)=>(t=i(t),Pe(e,(o,n,p)=>Le[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 Kr=(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?Kr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Kr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Kr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var ve=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",ve);f(";",ve);var Be=r=>r!=null&&(typeof r=="object"||typeof r=="function"),M=r=>Be(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),wo=r=>P(M(r));i.id=r=>r===void 0||wo(r)?()=>{}:e=>e?.[r];var tr=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&&tr("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?tr("Empty ()"):i(r);let t=p=>p?.[0]===","&&p.slice(1).some(c=>c==null||t(c));t(e)&&tr("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=Fr(r);return n<0?()=>{}:Gr(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]==="{}"),Gr=(r,e,t,o)=>r==null?tr("Empty ()"):r[0]==="()"&&r.length==2?Gr(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)),Dr=r=>Be(r)?1:P(r)?-1:0,Fr=(r,e=r?.[0],t=r?.[2])=>typeof r=="string"?Dr(r):e==="()"&&r.length==2?Fr(r[1]):e==="."||e==="?."?Dr(t):(e==="[]"||e==="?.[]")&&r.length===3?Array.isArray(t)&&t[0]==null?Dr(t[1]):1:0,F=(r,e,t=Fr(r))=>t<0?()=>{}:Gr(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 Co=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(K(r)||Co("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 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))));var Eo=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=Eo(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)}}},Hr=(...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",Hr);f("const",Hr);f("var",Hr);var or=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)||or("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(K(r)||or("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(K(r)||or("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(K(r)||or("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 nr=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[nr,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[nr,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var So=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!So(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]===nr){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,Ke)=>((I in C?C:u)[I]=Ke,!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 ko=Symbol("static"),To=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 To("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=>[[ko,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 Ro(o,n,e);if(t==="of")return No(o,n,e)}});var No=(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}},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 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 Me=new WeakMap,Io=(r,...e)=>typeof r=="string"?i(s(r)):Me.get(r)||Me.set(r,Oo(r,e)).get(r),Ue=57344,Oo=(r,e)=>{let t=r.reduce((p,c,u)=>p+(u?String.fromCharCode(Ue+u-1):"")+c,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let c=p.charCodeAt(0)-Ue,u;if(c>=0&&c<e.length)return u=e[c],_o(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},_o=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Lo=Io;export{pr as access,A as binary,i as compile,m as cur,Lo as default,O as err,d as expr,J as group,Po as id,l as idx,w as keyword,j as literal,De as loc,N as lookup,Qr as member,sr as nary,E as next,f as operator,ir as operators,L as parens,s as parse,z as peek,v as prec,fr as propName,T as seek,h as skip,g as token,_ as unary,S as word};
|
|
1
|
+
var u,m,s=r=>(u=0,m=r,s.enter?.(),r=d(),m[u]?O():r||""),O=(r="Unexpected token",e=u,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,l=m.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
|
|
3
|
+
${n}${c}${l}`)},Xe=(r,e=u)=>(Array.isArray(r)&&(r.loc=e),r),E=(r,e=u,t)=>{for(;t=r(m.charCodeAt(u));)u+=t;return m.slice(e,u)},h=(r=1)=>m[u+=r],T=r=>u=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?(u++,s.exit?.(r,e)):O("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},x=(r=u)=>{for(;m.charCodeAt(r)<=32;)r++;return m.charCodeAt(r)},Mo=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(u,e)===r&&!s.id(m.charCodeAt(u+e)),L=()=>(h(),d(0,41)),N=[],v={},g=(r,e=32,t,o=r.charCodeAt(0))=>$r({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||x()===r.charCodeAt(0)?n.push(null):c&&n.length===2&&(n=n[1]),n)),z=(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(u),s.id(e)&&(e<48||e>57)?E(s.id):d(r)),Qr=(r,e)=>g(r,e,(t,o)=>t&&(o=lr(e))&&[r,t,o]),w=(r,e,t)=>(v[r]??=e,$r({op:r,l:r.length,p:e,map:t,word:!0,kw:!0})),Xr=(r,e,t=(o,n,p,c=u,l,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(u+1)&&(a.l<3||m.substr(u,a.l)===a.op))&&(!a.word||!s.id(m.charCodeAt(u+a.l)))&&(p=a.op)))&&!(n>=a.p)&&!(a.kw&&s.prop&&!s.prop(u+a.l))){if(u+=a.l,l=a.map(o))return Xe(l,c);u=c,p=0,a.word||o||e||r[y]||O()}return e?.(o,n,p)})=>(t.ops=r,t.tail=e,t),$r=(r,e=r.op.charCodeAt(0),t=N[e])=>N[e]=t?.ops?Xr([r,...t.ops],t.tail):Xr([r],t);s.space=r=>{for(;(r=m.charCodeAt(u))<=32;)u++;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,W=57,jr=69,Wr=101,Qe=43,$e=45,qr=95,je=97,We=102,qe=65,ze=70,zr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Je=r=>r===ur&&(r=m.charCodeAt(u+1))!==ur&&!(s.id(r)&&r>W&&r!==Wr&&r!==jr)||r>=Q&&r<=W||r===qr||((r===jr||r===Wr)&&((r=m.charCodeAt(u+1))>=Q&&r<=W||r===Qe||r===$e)?2:0),cr=r=>(r=+zr(E(Je)))!=r?O():[,r],Ve=r=>e=>e===qr||e>=Q&&e<=W&&e-Q<r||r===16&&(e>=je&&e<=We||e>=qe&&e<=ze);s.number=null;N[ur]=r=>!r&&m.charCodeAt(u+1)>=Q&&m.charCodeAt(u+1)<=W&&cr();for(let r=Q;r<=W;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(u+1)|32)===t.charCodeAt(1)){h(2);let o=zr(E(Ve(e=s.number[t])));return[,parseInt(o,e)]}return cr()}};var te=92,Jr=34,Vr=39,Yr=117,Zr=120,Ye=123,Ze=125,br=10,be=13,rt={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,ee=r=>{if(m.charCodeAt(r)!==te)return;let e=m.charCodeAt(r+1);if(e===Zr||e===Yr&&m.charCodeAt(r+2)!==Ye){let t=e===Zr?2:4,o=0,n;for(let p=0;p<t;p++){if((n=re(m.charCodeAt(r+2+p)))<0)return;o=o*16+n}return[o,2+t]}if(e===Yr){let t=0,o=r+3,n;for(;(n=re(m.charCodeAt(o)))>=0;)t=t*16+n,o++;if(o>r+3&&t<=1114111&&m.charCodeAt(o)===Ze)return[t,o-r+1]}},mr=()=>{let r=m.charCodeAt(u+1);if(r===br)return["",2];if(r===be)return["",m.charCodeAt(u+2)===br?3:2];let e=ee(u);if(e){let[t,o]=e;if(t>=55296&&t<=56319){let n=ee(u+o);n&&n[0]>=56320&&n[0]<=57343&&(t=65536+(t-55296)*1024+n[0]-56320,o+=n[1])}return[String.fromCodePoint(t),o]}return[rt[m[u+1]]||m[u+1],2]},oe=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(e||!s.string?.[n])return;h();let p=()=>{let[c,l]=mr();return o+=c,l};return E(c=>c-r&&(c!==te?(o+=m[u],1):p())),m[u]===n?h():O("Bad string"),[,o]};N[Jr]=oe(Jr);N[Vr]=oe(Vr);s.string={'"':!0};var et=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,et,!0));var tt=30,ot=40,nt=140;_("!",nt);A("||",tt);A("&&",ot);var it=50,st=60,pt=70,ne=100,ft=140;A("|",it);A("&",pt);A("^",st);A(">>",ne);A("<<",ne);_("~",ft);var Y=90;A("<",Y);A(">",Y);A("<=",Y);A(">=",Y);var ie=80;A("==",ie);A("!=",ie);var se=110,ar=120,pe=140;A("+",se);A("-",se);A("*",ar);A("/",ar);A("%",ar);_("+",pe);_("-",pe);var Z=150;g("++",Z,r=>r?["++",r,null]:["++",d(Z-1)]);g("--",Z,r=>r?["--",r,null]:["--",d(Z-1)]);var lt=5,ut=10;pr(",",ut);pr(";",lt,!0,!0);var ct=170;z("()",ct);var fe=170,mt=160;fr("[]",fe);Qr(".",fe);fr("()",mt);var at=s.space;s.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=at();){for(t in e=s.comment)if(r===t.charCodeAt(0)&&(t.length<2||m.charCodeAt(u+1)===t.charCodeAt(1))&&(t.length<3||m.substr(u,t.length)===t)){o=e[t],n=m.indexOf(o,u+t.length),T(n<0?m.length:o===`
|
|
6
|
+
`?n:n+o.length),r=0;break}if(r)return r}return r};var le=80;A("===",le);A("!==",le);var dt=30;A("??",dt);var ht=130,At=20;A("**",ht,!0);A("**=",At,!0);var ue=90;A("in",ue);A("of",ue);var yt=20,wt=100;A(">>>",wt);A(">>>=",yt,!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 Ct=20;A("=>",Ct,!0);var gt=20;_("...",gt);var ce=170;g("?.",ce,(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(ce),e?["?.",r,e]:void 0)});var Ar=140,me=160,Et=me+1;_("typeof",Ar);_("void",Ar);_("delete",Ar);var St=r=>s.space()===40?(h(),["()",r,d(0,41)||null]):r;w("new",Et,()=>S(".target")?(h(7),["new.target"]):["new",St(d(me))]);var kt=20,ae=200;s.prop=r=>x(r)!==58;z("[]",ae);z("{}",ae);A(":",kt-1,!0);var Tt=170,yr=96,Nt=36,Rt=123,It=92,de=()=>{let r=[],e="",t,o;for(;(t=m.charCodeAt(u))!==yr;)t?t===It?(o=mr(),e+=o[0],h(o[1])):t===Nt&&m.charCodeAt(u+1)===Rt?(r.push([,e]),e="",h(2),r.push(d(0,125))):(e+=m[u],h()):O("Unterminated template");return r.push([,e]),h(),r},Ot=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],_t=N[yr];N[yr]=(r,e)=>r&&e<Tt?s.asi&&s.newline?void 0:(h(),["``",r,...de()]):r?_t?.(r,e):(h(),Ot(de()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var Lt=92,Pt=117,vt=123,Bt=125,Mt=183,Ut=s.id,he=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,Dt=(r=u+2,e,t=0,o=0)=>{if(m.charCodeAt(u)!==Lt||m.charCodeAt(u+1)!==Pt)return 0;if(m.charCodeAt(r)===vt){for(;he(e=m.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>u+3&&t<=1114111&&m.charCodeAt(r)===Bt?r-u+1:0}for(;o<4&&he(m.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>Ut(r)||r===Mt||Dt();var wr=5,ye=10,Cr=r=>{let e=u,t=d(ye-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 Ae=r=>Array.isArray(r)&&r[0]==="="&&typeof r[1]=="string";w("using",200,()=>{let r=u;s.space();let e=m.charCodeAt(u);if(s.id(e)&&(e<48||e>57)){let t=u;if(E(s.id),s.space(),m.charCodeAt(u)===61&&m.charCodeAt(u+1)!==61&&m.charCodeAt(u+1)!==62){T(t);let o=d(ye-1);if(o[0]===","?o.slice(1).every(Ae):Ae(o))return o[0]===","?["using",...o.slice(1)]:["using",o]}}return T(r),"using"});var b=5,Kt=59,U=()=>(s.space()===123||O("Expected {"),h(),d(b-.5,125)||null),F=()=>s.space()!==123?d(b+.5):(h(),d(b-.5,125)||null),Ft=()=>{let r=u;return s.space()===Kt&&h(),s.space(),S("else")?(h(4),s.semi=!1,!0):(T(r),!1)};w("if",b+1,()=>{s.space();let r=["if",L(),F()];return Ft()&&r.push(F()),r});var Gt=200;w("function",Gt,()=>{s.space();let r=!1;m[u]==="*"&&(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 we=200,Er=140,gr=20,Ce=40;_("await",Er);var xt=10,Ht=13,ge=r=>{let e;for(;(e=m.charCodeAt(r))<=32;){if(e===xt||e===Ht)return!0;r++}return!1};w("yield",Er,()=>ge(u)?["yield"]:(s.space(),m[u]==="*"?(h(),s.space(),["yield*",d(gr)]):["yield",d(gr)]));w("async",we,()=>{if(ge(u))return;if(s.space(),S("function"))return["async",d(Er)];let r=u,e=d(we-.5);if(e?.[0]===":")return[":",e[1],["async",e[2]]];if(e&&x()===Ce)return["async",e];if((e||x()===Ce)&&(T(r),e=d(gr-.5))?.[0]==="=>")return["async",e]});var Ee=200;var Xt=90,Qt=175,$t=160,jt=$t-.5;_("static",Qt);A("instanceof",Xt);g("#",Ee,r=>{if(r)return;let e=E(s.id);return e?"#"+e:void 0});w("class",Ee,()=>{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 Sr=47,Wt=92,qt=91,zt=93;g("/",140,r=>{let e=m.charCodeAt(u);if(r||e===Sr||e===42||e===43||e===63)return;let t=!1,o=E(p=>p===Wt?2:p===qt?(t=!0,1):p===zt?(t=!1,1):p&&(t||p!==Sr));m.charCodeAt(u)===Sr||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,J=125,V=59;w("while",$+1,()=>(s.space(),["while",L(),F()]));w("do",$+1,r=>(r=F(),s.space(),h(5),s.space(),["do",r,L()]));var Se={let:1,const:1,var:1},kr=(r,e=r,t)=>{if(Se[r?.[0]]&&Array.isArray(r[1]))return(e=kr(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&&!Se[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",kr(L()),F()]):["for",kr(L()),F()]));w("break",$+1,()=>{s.asi&&(s.newline=!1);let r=u,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"])});w("continue",$+1,()=>{s.asi&&(s.newline=!1);let r=u,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"])});w("return",$+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",d($)]});var Tr=5;w("try",Tr+1,()=>{let r=["try",U()];return s.space(),S("catch")&&(h(5),s.space(),r.push(["catch",x()===40?L():null,U()])),s.space(),S("finally")&&(h(7),r.push(["finally",U()])),r});w("throw",Tr+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",d(Tr)]});var Ne=5,Jt=20,ke=58,Vt=59,Nr=125,Rr=0,Re=(r,e=r.length,t=r.charCodeAt(0),o=N[t])=>N[t]=(n,p,c)=>S(r)&&!n&&Rr&&(!s.prop||s.prop(u+e))||o?.(n,p,c);Re("case");Re("default");var Te=r=>{let e=[];for(;(r=s.space())!==Nr&&!S("case")&&!S("default");){if(r===Vt){h();continue}s.semi=!1,e.push(d(Ne+.5))||O()}return e.length>1?[";",...e]:e[0]||null},Yt=()=>{s.space()===123||O("Expected {"),h(),Rr++;let r=[];try{for(;s.space()!==Nr;)if(S("case")){T(u+4),s.space(),s.semi=!1;let e=d(Jt-.5);s.space()===ke&&h(),r.push(["case",e,Te()])}else S("default")?(T(u+7),s.space()===ke&&h(),r.push(["default",Te()])):O("Expected case or default")}finally{Rr--}return h(),s.exit?.(0,Nr),r};w("switch",Ne+1,()=>s.space()===40&&["switch",L(),...Yt()]);var Ir=5,Zt=20;w("debugger",Ir+1,()=>["debugger"]);w("with",Ir+1,()=>(s.space(),["with",L(),F()]));var bt=["if","for","while","do","switch","try"];g(":",Zt-1,r=>typeof r=="string"&&(s.space(),bt.some(e=>S(e)))&&[":",r,d(Ir)]);var Or=5,q=10,Ie=42,ro=N[Ie];N[Ie]=(r,e)=>r?ro?.(r,e):(h(),"*");g("from",q+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,d(q+1)]):!1);g("as",q+2,r=>r?(s.space(),["as",r,d(q+2)]):!1);w("import",Or,()=>S(".meta")?(h(5),["import.meta"]):["import",d(q)]);w("export",Or,()=>(s.space(),S("default")?(h(7),["export",["default",d(q)]]):["export",d(Or)]));var eo=20,rr=200,to=10,oo=13,no=34,io=35,so=39,Oe=40,Lr=41,po=91,Pr=123,vr=125,fo=(r,e)=>{for(;r<e;){let t=m.charCodeAt(r++);if(t===to||t===oo)return!0}return!1},lo=r=>r===no||r===so||r===po||r===io,_e=()=>E(s.id)||(lo(m.charCodeAt(u))?d(rr-.5):null),uo=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},Le=r=>e=>{if(e)return;let t=u;if(s.space(),s.semi||fo(t,u))return!1;let o=_e();if(!o||(s.space(),m.charCodeAt(u)!==Oe))return!1;h();let n=d(0,Lr);return s.space(),m.charCodeAt(u)!==Pr?!1:(h(),[r,o,n,d(0,vr)])};g("get",rr,er(Le("get")));g("set",rr,er(Le("set")));var _r=r=>r==null||typeof r=="string"||Array.isArray(r)&&(r[0]===","?r.slice(1).every(_r):r[0]==="="?typeof r[1]=="string"||_r(r[1]):r[0]==="..."||r[0]==="{}"||r[0]==="[]"),co=v["*"];g("*",rr,er(r=>{let e=r&&s.newline;if(r&&!e)return;let t=u,o=_e();if(!o)return r?(T(t),void 0):!1;if(s.space(),m.charCodeAt(u)!==Oe)return r?(T(t),void 0):!1;h();let n=d(0,Lr)||null;if(r&&!_r(n))return T(t),void 0;if(s.space(),m.charCodeAt(u)!==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["*"]=co;g("(",eo-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]),!uo(r))return;let o=d(0,Lr)||null;if(s.space(),m.charCodeAt(u)!==Pr)return;h();let n=["function",null,o,d(0,vr)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p}));s.comment["#!"]=`
|
|
7
|
+
`;var Me=32,Dr=10,mo=59,ao=125,Pe=91,ve=40,tr=v.asi??v[";"],ho=s._baseSpace??=s.space,Ao=s._baseStep??=s.step,Br=r=>Array.isArray(r)||typeof r=="string",yo=(v[";"]??5)+1,Ur=r=>Array.isArray(r)&&(v[r[0]]<=yo||r[0]==="{}"&&Ur(r[1])),wo=(r,e)=>{for(;(e=m.charCodeAt(r))<=Me;){if(e===Dr)return!0;r++}return!1},Co=(r=u,e)=>{for(;r-- >0&&(e=m.charCodeAt(r))<=Me;)if(e===Dr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=u,r=ho();e<u;)if(m.charCodeAt(e++)===Dr){s.newline=!0;break}if(r===mo&&wo(u+1)){T(u+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===ao&&(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===Pe||t===ve)&&Co();if(s.semi||t===Pe&&(p||Ur(r))||t===ve&&(Ur(r)||p&&e>=tr))return Be(r,e,o)??null}let n=s.newline;return Ao(r,e,t,o)??(Br(r)&&n?Be(r,e,o)??null:null)};var Mr=0,go=2e3,Be=s.asi=(r,e,t,o,n)=>{if(e>=tr||Mr>=go)return;s.semi=!1;let p=u;Mr++;try{o=t(tr-.5)}finally{Mr--}if(!(!o||u===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var De=(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?De(r[1],e):(()=>{throw Error("Invalid assignment target")})(),Ue={"=":(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 Ue)f(r,(e,t)=>(t=i(t),De(e,(o,n,p)=>Ue[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 Kr=(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?Kr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Kr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Kr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var Ke=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",Ke);f(";",Ke);var Fe=r=>r!=null&&(typeof r=="object"||typeof r=="function"),M=r=>Fe(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Eo=r=>P(M(r));i.id=r=>r===void 0||Eo(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=xr(r);return n<0?()=>{}:Gr(r,n?(p,c,l)=>(c=M(c),P(c)?void 0:p[c](...o(l))):(p,c,l)=>p[c](...o(l)))});var D=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&D(r[1])||r[0]==="{}"),Gr=(r,e,t,o)=>r==null?or("Empty ()"):r[0]==="()"&&r.length==2?Gr(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)),Fr=r=>Fe(r)?1:P(r)?-1:0,xr=(r,e=r?.[0],t=r?.[2])=>typeof r=="string"?Fr(r):e==="()"&&r.length==2?xr(r[1]):e==="."||e==="?."?Fr(t):(e==="[]"||e==="?.[]")&&r.length===3?Array.isArray(t)&&t[0]==null?Fr(t[1]):1:0,G=(r,e,t=xr(r))=>t<0?()=>{}:Gr(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 So=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(D(r)||So("Invalid assignment target"),e=i(e),G(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 ko=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(D(r)||ko("Invalid assignment target"),e=i(e),G(r,(t,o,n)=>t[o]>>>=e(n))));var To=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=To(n);if(o==="{}"){let c=[];for(let l of p){if(Array.isArray(l)&&l[0]==="..."){let C={};for(let I in e)!c.includes(I)&&!P(I)&&(C[I]=e[I]);t[l[1]]=C;break}let a,y,R;typeof l=="string"?a=y=l:l[0]==="="?(typeof l[1]=="string"?a=y=l[1]:[,a,y]=l[1],R=l[2]):[,a,y]=l,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 l of p){if(l===null){c++;continue}if(Array.isArray(l)&&l[0]==="..."){t[l[1]]=e.slice(c);break}let a=l,y;Array.isArray(l)&&l[0]==="="&&([,a,y]=l);let R=e[c++];R===void 0&&y&&(R=i(y)(t)),H(a,R,t)}}},Hr=(...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",Hr);f("const",Hr);f("var",Hr);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 D(r)||nr("Invalid assignment target"),e=i(e),G(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(D(r)||nr("Invalid assignment target"),e=i(e),G(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(D(r)||nr("Invalid assignment target"),e=i(e),G(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(D(r)||nr("Invalid assignment target"),e=i(e),G(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),l=>(...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]:l?.[C],set:(k,C,I)=>((C in k?k:l)[C]=I,!0),has:(k,C)=>C in k||(l?C in l:!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?l=>p(l)?.[c]?.(...t(l)):l=>p(l)[c]?.(...t(l))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",p=i(r[1]),c=i(r[2]);return l=>{let a=p(l);if(n&&a==null)return;let y=M(c(l));return P(y)?void 0:a[y]?.(...t(l))}}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 No=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!No(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(l=>l(o)))if(c[0]===ir){let[,l,a]=c;p[l]={...p[l],...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--),l=>{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]:l[I],set:(C,I,He)=>((I in C?C:l)[I]=He,!0),has:(C,I)=>I in C||I in l});try{return t(k)}catch(C){if(C===B)return C[0];throw C}};return r&&(l[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 Ro=Symbol("static"),Io=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 Io("Class constructor must be called with new");let l=e?Reflect.construct(n,c,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(l,c),l};if(e&&(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n)),t){let c=Object.create(o);e&&(c.super=n);let l=t(c),a=Array.isArray(l)&&typeof l[0]?.[0]=="string"?l:[];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=>[[Ro,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 K=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===K)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===K)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(l){if(l===K)break;if(l===X)continue;if(l===B)return l[0];throw l}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 _o(o,n,e);if(t==="of")return Oo(o,n,e)}});var Oo=(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 l of e(n)){o?H(r,l,n):n[r]=l;try{p=t(n)}catch(a){if(a===K)break;if(a===X)continue;if(a===B)return a[0];throw a}}return o||(n[r]=c),p}},_o=(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 l in e(n)){o?H(r,l,n):n[r]=l;try{p=t(n)}catch(a){if(a===K)break;if(a===X)continue;if(a===B)return a[0];throw a}}return o||(n[r]=c),p}};f("break",()=>()=>{throw K});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(l=>l?.[0]==="catch"),o=e.find(l=>l?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,c=o?.[1]?i(o[1]):null;return l=>{let a;try{a=r?.(l)}catch(y){if(y===K||y===X||y===B)throw y;if(n!=null&&p){let R=n in l,k=l[n];l[n]=y;try{a=p(l)}finally{R?l[n]=k:delete l[n]}}else if(!p)throw y}finally{c?.(l)}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[l,a]of e)if(n||l===null||l(t)===o)for(n=!0,c=0;c<a.length;c++)try{p=a[c](t)}catch(y){if(y===K)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 Ge=new WeakMap,Lo=(r,...e)=>typeof r=="string"?i(s(r)):Ge.get(r)||Ge.set(r,Po(r,e)).get(r),xe=57344,Po=(r,e)=>{let t=r.reduce((p,c,l)=>p+(l?String.fromCharCode(xe+l-1):"")+c,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let c=p.charCodeAt(0)-xe,l;if(c>=0&&c<e.length)return l=e[c],vo(l)?l:[,l]}return Array.isArray(p)?p.map(n):p};return i(n(o))},vo=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Bo=Lo;export{fr as access,A as binary,i as compile,m as cur,Bo as default,O as err,d as expr,z as group,Mo as id,u as idx,w as keyword,j as literal,Xe as loc,N as lookup,Qr as member,pr as nary,E as next,f as operator,sr as operators,L as parens,s as parse,x 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 u,c,d=r=>(u=0,c=r,d.enter?.(),r=
|
|
2
|
-
`),o=e.pop(),
|
|
3
|
-
${
|
|
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,
|
|
5
|
-
`,"/*":"*/"};d.space=()=>{for(var r,t,e,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};
|
|
1
|
+
var u,c,d=r=>(u=0,c=r,d.enter?.(),r=h(),c[u]?O():r||""),O=(r="Unexpected token",t=u,e=c.slice(0,t).split(`
|
|
2
|
+
`),o=e.pop(),n=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
|
+
${n}${f}${m}`)},jr=(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,h=(r=0,t)=>{let e,o,n;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(n=d.step(o,r,e,h));)o=n;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)},Kt=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)),$t=()=>(C(),h(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,n)=>o&&(n=h(t-(e?.5:0)))&&[r,o,n]),N=(r,t,e)=>I(r,t,o=>e?o&&[r,o]:!o&&(o=h(t-.5))&&[r,o]),F=(r,t)=>I(r,200,e=>!e&&[,t]),W=(r,t,e,o)=>I(r,t,(n,s,f=n)=>(s=h(t-(e?.5:0)),n?.[0]!==r&&(n=[r,n||null]),s?.[0]===r?n.push(...s.slice(1)):s?n.push(s):o||H()===r.charCodeAt(0)?n.push(null):f&&n.length===2&&(n=n[1]),n)),_=(r,t)=>I(r[0],t,e=>!e&&[r,h(0,r.charCodeAt(1))||null]),q=(r,t)=>I(r[0],t,e=>e&&[r,e,h(0,r.charCodeAt(1))||null]),z=(r,t)=>(d.space(),t=c.charCodeAt(u),d.id(t)&&(t<48||t>57)?v(d.id):h(r)),ur=(r,t)=>I(r,t,(e,o)=>e&&(o=z(t))&&[r,e,o]),B=(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,n,s,f=u,m,A,g)=>{for(g=0;A=r[g++];)if(!(A.kw&&o)&&!(s?A.op!==s:!((A.l<2||A.op.charCodeAt(1)===c.charCodeAt(u+1)&&(A.l<3||c.substr(u,A.l)===A.op))&&(!A.word||!d.id(c.charCodeAt(u+A.l)))&&(s=A.op)))&&!(n>=A.p)&&!(A.kw&&d.prop&&!d.prop(u+A.l))){if(u+=A.l,m=A.map(o))return jr(m,f);u=f,s=0,A.word||o||t||r[g]||O()}return t?.(o,n,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,n)=>(n=w[e])&&n(r,t)||(r?null:v(d.id)||null);var Q={},p=(r,t,e=Q[r])=>Q[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):Q[r[0]]?.(...r.slice(1))??O(`Unknown operator: ${r[0]}`,r?.loc):i.id(r);i.id=r=>r===void 0?()=>{}:t=>t?.[r];var J=46,D=48,U=57,cr=69,dr=101,Qr=43,Hr=45,Ar=95,Wr=97,qr=102,zr=65,Jr=70,hr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Vr=r=>r===J&&(r=c.charCodeAt(u+1))!==J&&!(d.id(r)&&r>U&&r!==dr&&r!==cr)||r>=D&&r<=U||r===Ar||((r===cr||r===dr)&&((r=c.charCodeAt(u+1))>=D&&r<=U||r===Qr||r===Hr)?2:0),V=r=>(r=+hr(v(Vr)))!=r?O():[,r],Yr=r=>t=>t===Ar||t>=D&&t<=U&&t-D<r||r===16&&(t>=Wr&&t<=qr||t>=zr&&t<=Jr);d.number=null;w[J]=r=>!r&&c.charCodeAt(u+1)>=D&&c.charCodeAt(u+1)<=U&&V();for(let r=D;r<=U;r++)w[r]=t=>t?void 0:V();w[D]=(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=hr(v(Yr(t=d.number[e])));return[,parseInt(o,t)]}return V()}};var Nr=92,gr=34,yr=39,Cr=117,Sr=120,Zr=123,xr=125,Er=10,br=13,rt={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,Ir=r=>{if(c.charCodeAt(r)!==Nr)return;let t=c.charCodeAt(r+1);if(t===Sr||t===Cr&&c.charCodeAt(r+2)!==Zr){let e=t===Sr?2:4,o=0,n;for(let s=0;s<e;s++){if((n=wr(c.charCodeAt(r+2+s)))<0)return;o=o*16+n}return[o,2+e]}if(t===Cr){let e=0,o=r+3,n;for(;(n=wr(c.charCodeAt(o)))>=0;)e=e*16+n,o++;if(o>r+3&&e<=1114111&&c.charCodeAt(o)===xr)return[e,o-r+1]}},Y=()=>{let r=c.charCodeAt(u+1);if(r===Er)return["",2];if(r===br)return["",c.charCodeAt(u+2)===Er?3:2];let t=Ir(u);if(t){let[e,o]=t;if(e>=55296&&e<=56319){let n=Ir(u+o);n&&n[0]>=56320&&n[0]<=57343&&(e=65536+(e-55296)*1024+n[0]-56320,o+=n[1])}return[String.fromCodePoint(e),o]}return[rt[c[u+1]]||c[u+1],2]},kr=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(t||!d.string?.[n])return;C();let s=()=>{let[f,m]=Y();return o+=f,m};return v(f=>f-r&&(f!==Nr?(o+=c[u],1):s())),c[u]===n?C():O("Bad string"),[,o]};w[gr]=kr(gr);w[yr]=kr(yr);d.string={'"':!0};var tt=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>l(r,tt,!0));var et=30,ot=40,nt=140;N("!",nt);l("||",et);l("&&",ot);var it=50,st=60,pt=70,Or=100,mt=140;l("|",it);l("&",pt);l("^",st);l(">>",Or);l("<<",Or);N("~",mt);var G=90;l("<",G);l(">",G);l("<=",G);l(">=",G);var Lr=80;l("==",Lr);l("!=",Lr);var Rr=110,Z=120,vr=140;l("+",Rr);l("-",Rr);l("*",Z);l("/",Z);l("%",Z);N("+",vr);N("-",vr);var M=150;I("++",M,r=>r?["++",r,null]:["++",h(M-1)]);I("--",M,r=>r?["--",r,null]:["--",h(M-1)]);var ft=5,ut=10;W(",",ut);W(";",ft,!0,!0);var lt=170;_("()",lt);var Pr=170,ct=160;q("[]",Pr);ur(".",Pr);q("()",ct);var dt=d.space;d.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};d.space=()=>{for(var r,t,e,o,n;r=dt();){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],n=c.indexOf(o,u+e.length),mr(n<0?c.length:o===`
|
|
6
|
+
`?n:n+o.length),r=0;break}if(r)return r}return r};var Dr=80;l("===",Dr);l("!==",Dr);var At=30;l("??",At);var ht=130,gt=20;l("**",ht,!0);l("**=",gt,!0);var Tr=90;l("in",Tr);l("of",Tr);var yt=20,Ct=100;l(">>>",Ct);l(">>>=",yt,!0);var x=20;l("||=",x,!0);l("&&=",x,!0);l("??=",x,!0);F("true",!0);F("false",!1);F("null",null);B("undefined",200,()=>[]);F("NaN",NaN);F("Infinity",1/0);var b=20;I("?",b,(r,t,e)=>r&&(t=h(b-1))&&v(o=>o===58)&&(e=h(b-1),["?",r,t,e]));var St=20;l("=>",St,!0);var Et=20;N("...",Et);var Fr=170;I("?.",Fr,(r,t)=>{if(!r)return;let e=d.space();return e===40?(C(),["?.()",r,h(0,41)||null]):e===91?(C(),["?.[]",r,h(0,93)]):(t=z(Fr),t?["?.",r,t]:void 0)});var rr=140,Ur=160,wt=Ur+1;N("typeof",rr);N("void",rr);N("delete",rr);var It=r=>d.space()===40?(C(),["()",r,h(0,41)||null]):r;B("new",wt,()=>fr(".target")?(C(7),["new.target"]):["new",It(h(Ur))]);var Nt=20,_r=200;d.prop=r=>H(r)!==58;_("[]",_r);_("{}",_r);l(":",Nt-1,!0);var kt=170,tr=96,Ot=36,Lt=123,Rt=92,ar=()=>{let r=[],t="",e,o;for(;(e=c.charCodeAt(u))!==tr;)e?e===Rt?(o=Y(),t+=o[0],C(o[1])):e===Ot&&c.charCodeAt(u+1)===Lt?(r.push([,t]),t="",C(2),r.push(h(0,125))):(t+=c[u],C()):O("Unterminated template");return r.push([,t]),C(),r},vt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Pt=w[tr];w[tr]=(r,t)=>r&&t<kt?d.asi&&d.newline?void 0:(C(),["``",r,...ar()]):r?Pt?.(r,t):(C(),vt(ar()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Gr=(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?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=i(e),Gr(t,(o,n,s)=>Br[r](o,n,e(s)))));p("!",r=>(r=i(r),t=>!r(t)));p("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));p("~",r=>(r=i(r),t=>~r(t)));p("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));p("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var er=(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?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(i),t=>{let e;for(let o of r)e=o(t);return e});p(",",Mr);p(";",Mr);var Xr=r=>r!=null&&(typeof r=="object"||typeof r=="function"),k=r=>Xr(r)?Reflect.ownKeys({[r]:0})[0]:r,S=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Dt=r=>S(k(r));i.id=r=>r===void 0||Dt(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=i(e[1]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&X("Missing index"),r=i(r),t=i(t),e=>{let o=k(t(e));return S(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=i(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 ()"):i(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(i),s=>t.map(f=>f(s))):(t=i(t),s=>[t(s)]):()=>[],n=ir(r);return n<0?()=>{}:nr(r,n?(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"?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)),or=r=>Xr(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,n,s)=>(n=k(n),S(n)?void 0:t(o,n,s)):t);p("===",(r,t)=>(r=i(r),t=i(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=i(r),t=i(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=i(r),t=i(t),e=>r(e)??t(e)));var Tt=r=>{throw Error(r)};p("**",(r,t)=>(r=i(r),t=i(t),e=>r(e)**t(e)));p("**=",(r,t)=>(L(r)||Tt("Invalid assignment target"),t=i(t),P(r,(e,o,n)=>e[o]**=t(n))));p("in",(r,t)=>(r=i(r),t=i(t),e=>r(e)in t(e)));var Ft=r=>{throw Error(r)};p(">>>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(L(r)||Ft("Invalid assignment target"),t=i(t),P(r,(e,o,n)=>e[o]>>>=t(n))));var Ut=r=>r[0]?.[0]===","?r[0].slice(1):r,a=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...n]=r,s=Ut(n);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 A,g,R;typeof m=="string"?A=g=m:m[0]==="="?(typeof m[1]=="string"?A=g=m[1]:[,A,g]=m[1],R=m[2]):[,A,g]=m,f.push(A=k(A));let y=S(A)?void 0:t[A];y===void 0&&R&&(y=i(R)(e)),a(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 A=m,g;Array.isArray(m)&&m[0]==="="&&([,A,g]=m);let R=t[f++];R===void 0&&g&&(R=i(g)(e)),a(A,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,n=i(o);return typeof e=="string"?s=>{s[e]=n(s)}:s=>a(e,n(s),s)}return i(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=i(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>a(e,t(o),o)}return L(r)||K("Invalid assignment target"),t=i(t),P(r,(e,o,n)=>e[o]=t(n))});p("||=",(r,t)=>(L(r)||K("Invalid assignment target"),t=i(t),P(r,(e,o,n)=>e[o]||=t(n))));p("&&=",(r,t)=>(L(r)||K("Invalid assignment target"),t=i(t),P(r,(e,o,n)=>e[o]&&=t(n))));p("??=",(r,t)=>(L(r)||K("Invalid assignment target"),t=i(t),P(r,(e,o,n)=>e[o]??=t(n))));p("?",(r,t,e)=>(r=i(r),t=i(t),e=i(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,n=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,n=s[1],e.length--);let f=t?.[0]==="{}";return t=i(f?["{",t[1]]:t),m=>(...A)=>{let g={};e.forEach((y,E)=>g[y]=A[E]),n&&(g[n]=A.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=i(r),t=>{let e=r(t),o=[];for(let n of Object.keys(e))S(n)||o.push([n,e[n]]);return o}));p("?.",(r,t)=>(r=i(r),t=k(t),S(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=i(r),t=i(t),e=>{let o=r(e);if(o==null)return;let n=k(t(e));return S(n)?void 0:o[n]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];if(r[0]==="."||r[0]==="?."){let n=r[0]==="?.",s=i(r[1]),f=k(r[2]);return S(f)?()=>{}:n?m=>s(m)?.[f]?.(...e(m)):m=>s(m)[f]?.(...e(m))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",s=i(r[1]),f=i(r[2]);return m=>{let A=s(m);if(n&&A==null)return;let g=k(f(m));return S(g)?void 0:A[g]?.(...e(m))}}let o=i(r);return n=>o(n)?.(...e(n))});p("typeof",r=>(r=i(r),t=>typeof r(t)));p("void",r=>(r=i(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=i(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=i(r[1]),e=i(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=i(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(n=>s=>n.map(f=>f(s)))(e.slice(1).map(i)):(n=>s=>[n(s)])(i(e)):()=>[];return n=>new(t(n))(...o(n))});var $=Symbol("accessor");p("get",(r,t)=>(t=t?i(t):()=>{},e=>[[$,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?i(e):()=>{},o=>[[$,r,{set:function(n){let s=Object.create(o||{});s.this=this,s[t]=n,e(s)}}]]));var at=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!at(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},s={};for(let f of e.flatMap(m=>m(o)))if(f[0]===$){let[,m,A]=f;s[m]={...s[m],...A,configurable:!0,enumerable:!0}}else n[f[0]]=f[1];for(let f in s)Object.defineProperty(n,f,s[f]);return n}});p("{",r=>(r=r?i(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=i(t),Array.isArray(r)?(r=i(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(i),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=i(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(i(s));let n=Object.assign([...e],{raw:e});return s=>r(s)(n,...o.map(f=>f(s)))});var Kr=new WeakMap,Bt=(r,...t)=>typeof r=="string"?i(d(r)):Kr.get(r)||Kr.set(r,Gt(r,t)).get(r),$r=57344,Gt=(r,t)=>{let e=r.reduce((s,f,m)=>s+(m?String.fromCharCode($r+m-1):"")+f,""),o=d(e),n=s=>{if(typeof s=="string"&&s.length===1){let f=s.charCodeAt(0)-$r,m;if(f>=0&&f<t.length)return m=t[f],Mt(m)?m:[,m]}return Array.isArray(s)?s.map(n):s};return i(n(o))},Mt=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Xt=Bt;export{q as access,l as binary,i as compile,c as cur,Xt as default,O as err,h as expr,_ as group,Kt as id,u as idx,B as keyword,F as literal,jr as loc,w as lookup,ur as member,W as nary,v as next,p as operator,Q as operators,$t as parens,d as parse,H as peek,j as prec,z as propName,mr as seek,C as skip,I as token,N as unary,fr as word};
|
package/package.json
CHANGED
package/subscript.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),o=e.pop(),
|
|
3
|
-
${
|
|
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,
|
|
1
|
+
var p,l,f=r=>(p=0,l=r,f.enter?.(),r=A(),l[p]?E():r||""),E=(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",u=(l[t]||" ")+s,d=l.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
|
+
${n}${u}${d}`)},Ar=(r,t=p)=>(Array.isArray(r)&&(r.loc=t),r),S=(r,t=p,e)=>{for(;e=r(l.charCodeAt(p));)p+=e;return l.slice(t,p)},D=(r=1)=>l[p+=r],Jr=r=>p=r,A=(r=0,t)=>{let e,o,n;for(t&&f.enter?.(r,t);(e=f.space())&&e!==t&&(n=f.step(o,r,e,A));)o=n;return t&&(e==t?(p++,f.exit?.(r,t)):E("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},Cr=(r=p)=>{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(p,t)===r&&!f.id(l.charCodeAt(p+t)),Zr=()=>(D(),A(0,41)),C=[],L={},g=(r,t=32,e,o=r.charCodeAt(0))=>K({op:r,l:r.length,p:L[r]=!C[o]&&L[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),c=(r,t,e=!1)=>g(r,t,(o,n)=>o&&(n=A(t-(e?.5:0)))&&[r,o,n]),y=(r,t,e)=>g(r,t,o=>e?o&&[r,o]:!o&&(o=A(t-.5))&&[r,o]),jr=(r,t)=>g(r,200,e=>!e&&[,t]),M=(r,t,e,o)=>g(r,t,(n,s,u=n)=>(s=A(t-(e?.5:0)),n?.[0]!==r&&(n=[r,n||null]),s?.[0]===r?n.push(...s.slice(1)):s?n.push(s):o||Cr()===r.charCodeAt(0)?n.push(null):u&&n.length===2&&(n=n[1]),n)),G=(r,t)=>g(r[0],t,e=>!e&&[r,A(0,r.charCodeAt(1))||null]),x=(r,t)=>g(r[0],t,e=>e&&[r,e,A(0,r.charCodeAt(1))||null]),gr=(r,t)=>(f.space(),t=l.charCodeAt(p),f.id(t)&&(t<48||t>57)?S(f.id):A(r)),H=(r,t)=>g(r,t,(e,o)=>e&&(o=gr(t))&&[r,e,o]),ar=(r,t,e)=>(L[r]??=t,K({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),Q=(r,t,e=(o,n,s,u=p,d,h,T)=>{for(T=0;h=r[T++];)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||!f.id(l.charCodeAt(p+h.l)))&&(s=h.op)))&&!(n>=h.p)&&!(h.kw&&f.prop&&!f.prop(p+h.l))){if(p+=h.l,d=h.map(o))return Ar(d,u);p=u,s=0,h.word||o||t||r[T]||E()}return t?.(o,n,s)})=>(e.ops=r,e.tail=t,e),K=(r,t=r.op.charCodeAt(0),e=C[t])=>C[t]=e?.ops?Q([r,...e.ops],e.tail):Q([r],e);f.space=r=>{for(;(r=l.charCodeAt(p))<=32;)p++;return r};f.step=(r,t,e,o,n)=>(n=C[e])&&n(r,t)||(r?null:S(f.id)||null);var N={},m=(r,t,e=N[r])=>N[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):N[r[0]]?.(...r.slice(1))??E(`Unknown operator: ${r[0]}`,r?.loc):i.id(r);i.id=r=>r===void 0?()=>{}:t=>t?.[r];var O=46,w=48,R=57,v=69,W=101,Er=43,Sr=45,q=95,yr=97,wr=102,Dr=65,Rr=70,z=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Pr=r=>r===O&&(r=l.charCodeAt(p+1))!==O&&!(f.id(r)&&r>R&&r!==W&&r!==v)||r>=w&&r<=R||r===q||((r===v||r===W)&&((r=l.charCodeAt(p+1))>=w&&r<=R||r===Er||r===Sr)?2:0),$=r=>(r=+z(S(Pr)))!=r?E():[,r],_r=r=>t=>t===q||t>=w&&t<=R&&t-w<r||r===16&&(t>=yr&&t<=wr||t>=Dr&&t<=Rr);f.number=null;C[O]=r=>!r&&l.charCodeAt(p+1)>=w&&l.charCodeAt(p+1)<=R&&$();for(let r=w;r<=R;r++)C[r]=t=>t?void 0:$();C[w]=(r,t)=>{if(!r){for(let e in f.number)if(e[0]==="0"&&(l.charCodeAt(p+1)|32)===e.charCodeAt(1)){D(2);let o=z(S(_r(t=f.number[e])));return[,parseInt(o,t)]}return $()}};var rr=92,J=34,V=39,Y=117,Z=120,Fr=123,Ur=125,j=10,Ir=13,Tr={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,b=r=>{if(l.charCodeAt(r)!==rr)return;let t=l.charCodeAt(r+1);if(t===Z||t===Y&&l.charCodeAt(r+2)!==Fr){let e=t===Z?2:4,o=0,n;for(let s=0;s<e;s++){if((n=a(l.charCodeAt(r+2+s)))<0)return;o=o*16+n}return[o,2+e]}if(t===Y){let e=0,o=r+3,n;for(;(n=a(l.charCodeAt(o)))>=0;)e=e*16+n,o++;if(o>r+3&&e<=1114111&&l.charCodeAt(o)===Ur)return[e,o-r+1]}},Lr=()=>{let r=l.charCodeAt(p+1);if(r===j)return["",2];if(r===Ir)return["",l.charCodeAt(p+2)===j?3:2];let t=b(p);if(t){let[e,o]=t;if(e>=55296&&e<=56319){let n=b(p+o);n&&n[0]>=56320&&n[0]<=57343&&(e=65536+(e-55296)*1024+n[0]-56320,o+=n[1])}return[String.fromCodePoint(e),o]}return[Tr[l[p+1]]||l[p+1],2]},tr=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(t||!f.string?.[n])return;D();let s=()=>{let[u,d]=Lr();return o+=u,d};return S(u=>u-r&&(u!==rr?(o+=l[p],1):s())),l[p]===n?D():E("Bad string"),[,o]};C[J]=tr(J);C[V]=tr(V);f.string={'"':!0};var Nr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Nr,!0));var Mr=30,xr=40,Or=140;y("!",Or);c("||",Mr);c("&&",xr);var $r=50,Xr=60,Br=70,er=100,kr=140;c("|",$r);c("&",Br);c("^",Xr);c(">>",er);c("<<",er);y("~",kr);var _=90;c("<",_);c(">",_);c("<=",_);c(">=",_);var or=80;c("==",or);c("!=",or);var nr=110,X=120,ir=140;c("+",nr);c("-",nr);c("*",X);c("/",X);c("%",X);y("+",ir);y("-",ir);var F=150;g("++",F,r=>r?["++",r,null]:["++",A(F-1)]);g("--",F,r=>r?["--",r,null]:["--",A(F-1)]);var Qr=5,Gr=10;M(",",Gr);M(";",Qr,!0,!0);var Hr=170;G("()",Hr);var sr=170,Kr=160;x("[]",sr);H(".",sr);x("()",Kr);var lr=(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?lr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),pr={"=":(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 pr)m(r,(t,e)=>(e=i(e),lr(t,(o,n,s)=>pr[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 B=(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?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 mr=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});m(",",mr);m(";",mr);var ur=r=>r!=null&&(typeof r=="object"||typeof r=="function"),I=r=>ur(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),vr=r=>P(I(r));i.id=r=>r===void 0||vr(r)?()=>{}:t=>t?.[r];var 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=I(t(e));return P(o)?void 0:r(e)[o]}));m(".",(r,t)=>(r=i(r),t=I(t[0]?t:t[1]),P(t)?()=>{}:e=>r(e)[t]));m("()",(r,t)=>{if(t===void 0)return r==null?U("Empty ()"):i(r);let e=s=>s?.[0]===","&&s.slice(1).some(u=>u==null||e(u));e(t)&&U("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),s=>t.map(u=>u(s))):(t=i(t),s=>[t(s)]):()=>[],n=cr(r);return n<0?()=>{}:fr(r,n?(s,u,d)=>(u=I(u),P(u)?void 0:s[u](...o(d))):(s,u,d)=>s[u](...o(d)))});var fr=(r,t,e,o)=>r==null?U("Empty ()"):r[0]==="()"&&r.length==2?fr(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)),k=r=>ur(r)?1:P(r)?-1:0,cr=(r,t=r?.[0],e=r?.[2])=>typeof r=="string"?k(r):t==="()"&&r.length==2?cr(r[1]):t==="."||t==="?."?k(e):(t==="[]"||t==="?.[]")&&r.length===3?Array.isArray(e)&&e[0]==null?k(e[1]):1:0;var dr=new WeakMap,Wr=(r,...t)=>typeof r=="string"?i(f(r)):dr.get(r)||dr.set(r,qr(r,t)).get(r),hr=57344,qr=(r,t)=>{let e=r.reduce((s,u,d)=>s+(d?String.fromCharCode(hr+d-1):"")+u,""),o=f(e),n=s=>{if(typeof s=="string"&&s.length===1){let u=s.charCodeAt(0)-hr,d;if(u>=0&&u<t.length)return d=t[u],zr(d)?d:[,d]}return Array.isArray(s)?s.map(n):s};return i(n(o))},zr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Yt=Wr;export{x as access,c as binary,i as compile,l as cur,Yt as default,E as err,A as expr,G as group,Vr as id,p as idx,ar as keyword,jr as literal,Ar as loc,C as lookup,H as member,M as nary,S as next,m as operator,N as operators,Zr as parens,f as parse,Cr as peek,L as prec,gr as propName,Jr as seek,D as skip,g as token,y as unary,Yr as word};
|