subscript 10.4.0 → 10.4.1
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/asi.js +10 -5
- package/jessie.min.js +7 -7
- package/package.json +1 -1
package/feature/asi.js
CHANGED
|
@@ -13,7 +13,6 @@ const lvl = prec.asi ?? prec[';'];
|
|
|
13
13
|
// would leave previous ASI layers active.
|
|
14
14
|
const baseSpace = parse._baseSpace ??= parse.space;
|
|
15
15
|
const baseStep = parse._baseStep ??= parse.step;
|
|
16
|
-
let lineBreak = false;
|
|
17
16
|
|
|
18
17
|
// LF immediately preceding the next non-space at i (used to detect `;\n`).
|
|
19
18
|
const hasLineBreak = (i, c) => {
|
|
@@ -24,19 +23,25 @@ const hasLineBreak = (i, c) => {
|
|
|
24
23
|
return false;
|
|
25
24
|
};
|
|
26
25
|
|
|
26
|
+
// True iff an LF immediately precedes idx (only whitespace between).
|
|
27
|
+
// Computed on demand — robust against nested expr() calls eating the LF.
|
|
28
|
+
const lineBreak = (i = idx, c) => {
|
|
29
|
+
while (i-- > 0 && (c = cur.charCodeAt(i)) <= SPACE) if (c === LF) return true;
|
|
30
|
+
return false;
|
|
31
|
+
};
|
|
32
|
+
|
|
27
33
|
// Override space: scan whitespace region for LFs (parse.js's space is
|
|
28
34
|
// LF-agnostic), and swallow `;\n` runs into ASI machinery (avoids deep nary `;`
|
|
29
35
|
// recursion on long files). parse.semi records that a hard terminator was
|
|
30
36
|
// consumed, so the surrounding expression knows to terminate.
|
|
31
37
|
parse.space = (cc, from) => {
|
|
32
|
-
lineBreak = false;
|
|
33
38
|
for (;;) {
|
|
34
39
|
from = idx;
|
|
35
40
|
cc = baseSpace();
|
|
36
|
-
while (from < idx) if (cur.charCodeAt(from++) === LF) { parse.newline =
|
|
41
|
+
while (from < idx) if (cur.charCodeAt(from++) === LF) { parse.newline = true; break; }
|
|
37
42
|
if (cc === SEMI && hasLineBreak(idx + 1)) {
|
|
38
43
|
seek(idx + 1);
|
|
39
|
-
parse.newline = parse.semi =
|
|
44
|
+
parse.newline = parse.semi = true;
|
|
40
45
|
continue;
|
|
41
46
|
}
|
|
42
47
|
return cc;
|
|
@@ -55,7 +60,7 @@ parse.exit = (p, end) => { if (end === BLOCK_END) parse.newline = true; };
|
|
|
55
60
|
// `[`/`(` on a new line; fire ASI when no operator continues across newline.
|
|
56
61
|
parse.step = (a, p, cc, expr) => {
|
|
57
62
|
if (parse.semi && p >= lvl) return false;
|
|
58
|
-
if (a && (parse.semi || ((cc === BRACKET || cc === PAREN) && lineBreak))) return asi(a, p, expr) ?? null;
|
|
63
|
+
if (a && (parse.semi || ((cc === BRACKET || cc === PAREN) && lineBreak()))) return asi(a, p, expr) ?? null;
|
|
59
64
|
const nl = parse.newline;
|
|
60
65
|
return baseStep(a, p, cc, expr) ?? (a && nl ? asi(a, p, expr) ?? null : null);
|
|
61
66
|
};
|
package/jessie.min.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
1
|
+
var u,c,l=r=>(u=0,c=r,l.enter?.(),r=a(),c[u]?R():r||""),R=(r="Unexpected token",t=u,e=c.slice(0,t).split(`
|
|
2
2
|
`),o=e.pop(),n=c.slice(Math.max(0,t-40),t),p="\u032D",m=(c[t]||" ")+p,f=c.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
3
|
${c[t-41]!==`
|
|
4
|
-
`,""+n}${m}${f}`)},vr=(r,t=
|
|
5
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Dr=r=>(t,e,o="")=>{if(!(t||!
|
|
6
|
-
`,"/*":"*/"};var
|
|
7
|
-
`)for(;c.charCodeAt(o)>=Dt;)o++;else{for(;c[o]&&c.substr(o,e[1].length)!==e[1];)o++;c[o]&&(o+=e[1].length)}O(o),r=0;break}if(r)return r}return r};var Hr=80;y("===",Hr);y("!==",Hr);var Gt=30;y("??",Gt);var Xt=130,Kt=20;y("**",Xt,!0);y("**=",Kt,!0);var jr=90;y("in",jr);y("of",jr);var Ht=20,jt=100;y(">>>",jt);y(">>>=",Ht,!0);var
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Wr=()=>{let r=[];for(let t="",e;(e=c.charCodeAt(
|
|
9
|
-
`;var Ee=32,st=10,Se=59,ke=125,Ie=91,Te=40,_r=$.asi??$[";"],Ne=u._baseSpace??=u.space,Re=u._baseStep??=u.step,ir=!1,_e=(r,t)=>{for(;(t=c.charCodeAt(r))<=Ee;){if(t===st)return!0;r++}return!1};u.space=(r,t)=>{for(ir=!1;;){for(t=l,r=Ne();t<l;)if(c.charCodeAt(t++)===st){u.newline=ir=!0;break}if(r===Se&&_e(l+1)){O(l+1),u.newline=u.semi=ir=!0;continue}return r}};u.enter=()=>u.newline=u.semi=!1;u.exit=(r,t)=>{t===ke&&(u.newline=!0)};u.step=(r,t,e,o)=>{if(u.semi&&t>=_r)return!1;if(r&&(u.semi||(e===Ie||e===Te)&&ir))return it(r,t,o)??null;let n=u.newline;return Re(r,t,e,o)??(r&&n?it(r,t,o)??null:null)};var Rr=0,Oe=100,it=u.asi=(r,t,e,o,n)=>{if(t>=_r||Rr>=Oe)return;u.semi=!1;let p=l;Rr++;try{o=e(_r-.5)}finally{Rr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var ft=(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?ft(r[1],t):(()=>{throw Error("Invalid assignment target")})(),pt={"=":(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 pt)s(r,(t,e)=>(e=i(e),ft(t,(o,n,p)=>pt[r](o,n,e(p)))));s("!",r=>(r=i(r),t=>!r(t)));s("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));s("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));s("~",r=>(r=i(r),t=>~r(t)));s("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));s("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));s("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));s(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));s("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));s(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));s("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));s(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));s("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));s("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));s("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));s("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));s("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));s("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));s("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));s("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var Or=(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?Or(r[1],t):(()=>{throw Error("Invalid increment target")})();s("++",(r,t)=>Or(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));s("--",(r,t)=>Or(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var lt=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});s(",",lt);s(";",lt);var F=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",sr=r=>{throw Error(r)};s("[]",(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&&sr("Missing index"),r=i(r),t=i(t),e=>{let o=t(e);return F(o)?void 0:r(e)[o]}));s(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],F(t)?()=>{}:e=>r(e)[t]));s("()",(r,t)=>{if(t===void 0)return r==null?sr("Empty ()"):i(r);let e=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||e(p));e(t)&&sr("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(p=>p(n))):(t=i(t),n=>[t(n)]):()=>[];return Pr(r,(n,p,m)=>n[p](...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]==="{}"),Pr=(r,t,e,o)=>r==null?sr("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 p=e(n);return p==null?void 0:t(p,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 p=e(n);return p==null?void 0:t(p,o(n),n)}):(r=i(r),n=>t([r(n)],0,n)),G=Pr;s("===",(r,t)=>(r=i(r),t=i(t),e=>r(e)===t(e)));s("!==",(r,t)=>(r=i(r),t=i(t),e=>r(e)!==t(e)));s("??",(r,t)=>(r=i(r),t=i(t),e=>r(e)??t(e)));var Pe=r=>{throw Error(r)};s("**",(r,t)=>(r=i(r),t=i(t),e=>r(e)**t(e)));s("**=",(r,t)=>(L(r)||Pe("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]**=t(n))));s("in",(r,t)=>(r=i(r),t=i(t),e=>r(e)in t(e)));var ve=r=>{throw Error(r)};s(">>>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>>t(e)));s(">>>=",(r,t)=>(L(r)||ve("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]>>>=t(n))));var Be=r=>r[0]?.[0]===","?r[0].slice(1):r,X=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...n]=r,p=Be(n);if(o==="{}"){let m=[];for(let f of p){if(Array.isArray(f)&&f[0]==="..."){let C={};for(let _ in t)m.includes(_)||(C[_]=t[_]);e[f[1]]=C;break}let A,g,S;typeof f=="string"?A=g=f:f[0]==="="?(typeof f[1]=="string"?A=g=f[1]:[,A,g]=f[1],S=f[2]):[,A,g]=f,m.push(A);let E=t[A];E===void 0&&S&&(E=i(S)(e)),X(g,E,e)}}else if(o==="[]"){let m=0;for(let f of p){if(f===null){m++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(m);break}let A=f,g;Array.isArray(f)&&f[0]==="="&&([,A,g]=f);let S=t[m++];S===void 0&&g&&(S=i(g)(e)),X(A,S,e)}}},ut=(...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"?p=>{p[e]=n(p)}:p=>X(e,n(p),p)}return i(t)}),t=>{for(let e of r)e(t)});s("let",ut);s("const",ut);s("var",r=>typeof r=="string"?t=>{t[r]=void 0}:()=>{});var pr=r=>{throw Error(r)};s("=",(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=>X(e,t(o),o)}return L(r)||pr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]=t(n))});s("||=",(r,t)=>(L(r)||pr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]||=t(n))));s("&&=",(r,t)=>(L(r)||pr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]&&=t(n))));s("??=",(r,t)=>(L(r)||pr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]??=t(n))));s("?",(r,t,e)=>(r=i(r),t=i(t),e=i(e),o=>r(o)?t(o):e(o)));var B=[];s("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=e[e.length-1];Array.isArray(p)&&p[0]==="..."&&(o=e.length-1,n=p[1],e.length--);let m=t?.[0]==="{}";return t=i(m?["{",t[1]]:t),f=>(...A)=>{let g={};e.forEach((E,C)=>g[E]=A[C]),n&&(g[n]=A.slice(o));let S=new Proxy(g,{get:(E,C)=>C in E?E[C]:f?.[C],set:(E,C,_)=>((C in E?E:f)[C]=_,!0),has:(E,C)=>C in E||(f?C in f:!1)});try{let E=t(S);return m?void 0:E}catch(E){if(E===B)return E[0];throw E}}});s("...",r=>(r=i(r),t=>Object.entries(r(t))));s("?.",(r,t)=>(r=i(r),F(t)?()=>{}:e=>r(e)?.[t]));s("?.[]",(r,t)=>(r=i(r),t=i(t),e=>{let o=t(e);return F(o)?void 0:r(e)?.[o]}));s("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(p=>p(n))):(t=i(t),n=>[t(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),p=r[2];return F(p)?()=>{}:m=>n(m)?.[p]?.(...e(m))}if(r[0]==="?.[]"){let n=i(r[1]),p=i(r[2]);return m=>{let f=n(m),A=p(m);return F(A)?void 0:f?.[A]?.(...e(m))}}if(r[0]==="."){let n=i(r[1]),p=r[2];return F(p)?()=>{}:m=>n(m)?.[p]?.(...e(m))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let f=n(m),A=p(m);return F(A)?void 0:f?.[A]?.(...e(m))}}let o=i(r);return n=>o(n)?.(...e(n))});s("typeof",r=>(r=i(r),t=>typeof r(t)));s("void",r=>(r=i(r),t=>(r(t),void 0)));s("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});s("new",r=>{let t=i(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(n=>p=>n.map(m=>m(p)))(e.slice(1).map(i)):(n=>p=>[n(p)])(i(e)):()=>[];return n=>new(t(n))(...o(n))});var fr=Symbol("accessor");s("get",(r,t)=>(t=t?i(t):()=>{},e=>[[fr,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));s("set",(r,t,e)=>(e=e?i(e):()=>{},o=>[[fr,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[t]=n,e(p)}}]]));var Me=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);s("{}",(r,t)=>{if(t!==void 0)return;if(!Me(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={},p={};for(let m of e.flatMap(f=>f(o)))if(m[0]===fr){let[,f,A]=m;p[f]={...p[f],...A,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});s("{",r=>(r=r?i(r):()=>{},t=>r(Object.create(t))));s(":",(r,t)=>(t=i(t),Array.isArray(r)?(r=i(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));s("`",(...r)=>(r=r.map(i),t=>r.map(e=>e(t)).join("")));s("``",(r,...t)=>{r=i(r);let e=[],o=[];for(let p of t)Array.isArray(p)&&p[0]===void 0?e.push(p[1]):o.push(i(p));let n=Object.assign([...e],{raw:e});return p=>r(p)(n,...o.map(m=>m(p)))});s("function",(r,t,e)=>{e=e?i(e):()=>{};let o=t?t[0]===","?t.slice(1):[t]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),f=>{let A=(...g)=>{let S={};o.forEach((C,_)=>S[C]=g[_]),n&&(S[n]=g.slice(p));let E=new Proxy(S,{get:(C,_)=>_ in C?C[_]:f[_],set:(C,_,dt)=>((_ in C?C:f)[_]=dt,!0),has:(C,_)=>_ in C||_ in f});try{return e(E)}catch(C){if(C===B)return C[0];throw C}};return r&&(f[r]=A),A}});s("function*",(r,t,e)=>{throw Error("Generator functions are not supported in evaluation")});s("async",r=>{let t=i(r);return e=>{let o=t(e);return async function(...n){return o(...n)}}});s("await",r=>(r=i(r),async t=>await r(t)));s("yield",r=>(r=r?i(r):null,t=>{throw{__yield__:r?r(t):void 0}}));s("yield*",r=>(r=i(r),t=>{throw{__yield_all__:r(t)}}));var Le=Symbol("static"),Ue=r=>{throw Error(r)};s("instanceof",(r,t)=>(r=i(r),t=i(t),e=>r(e)instanceof t(e)));s("class",(r,t,e)=>(t=t?i(t):null,e=e?i(e):null,o=>{let n=t?t(o):Object,p=function(...m){if(!(this instanceof p))return Ue("Class constructor must be called with new");let f=t?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(f,m),f};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),e){let m=Object.create(o);m.super=n;let f=e(m),A=Array.isArray(f)&&typeof f[0]?.[0]=="string"?f:[];for(let[g,S]of A)g==="constructor"?p.prototype.__constructor__=S:p.prototype[g]=S}return r&&(o[r]=p),p}));s("static",r=>(r=i(r),t=>[[Le,r(t)]]));s("//",(r,t)=>{let e=new RegExp(r,t||"");return()=>e});s("if",(r,t,e)=>(r=i(r),t=i(t),e=e!==void 0?i(e):null,o=>r(o)?t(o):e?.(o)));var U=Symbol("break"),K=Symbol("continue");s("while",(r,t)=>(r=i(r),t=i(t),e=>{let o;for(;r(e);)try{o=t(e)}catch(n){if(n===U)break;if(n===K)continue;if(n===B)return n[0];throw n}return o}));s("do",(r,t)=>(r=i(r),t=i(t),e=>{let o;do try{o=r(e)}catch(n){if(n===U)break;if(n===K)continue;if(n===B)return n[0];throw n}while(t(e));return o}));s("for",(r,t)=>{if(Array.isArray(r)&&r[0]===";"){let[,e,o,n]=r;return e=e?i(e):null,o=o?i(o):()=>!0,n=n?i(n):null,t=i(t),p=>{let m;for(e?.(p);o(p);n?.(p))try{m=t(p)}catch(f){if(f===U)break;if(f===K)continue;if(f===B)return f[0];throw f}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[e,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),e==="in")return Fe(o,n,t);if(e==="of")return De(o,n,t)}});var De=(r,t,e)=>{t=i(t),e=i(e);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let f of t(n)){o?X(r,f,n):n[r]=f;try{p=e(n)}catch(A){if(A===U)break;if(A===K)continue;if(A===B)return A[0];throw A}}return o||(n[r]=m),p}},Fe=(r,t,e)=>{t=i(t),e=i(e);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let f in t(n)){o?X(r,f,n):n[r]=f;try{p=e(n)}catch(A){if(A===U)break;if(A===K)continue;if(A===B)return A[0];throw A}}return o||(n[r]=m),p}};s("break",()=>()=>{throw U});s("continue",()=>()=>{throw K});s("return",r=>(r=r!==void 0?i(r):null,t=>{throw B[0]=r?.(t),B}));s("try",(r,...t)=>{r=r?i(r):null;let e=t.find(f=>f?.[0]==="catch"),o=t.find(f=>f?.[0]==="finally"),n=e?.[1],p=e?.[2]?i(e[2]):null,m=o?.[1]?i(o[1]):null;return f=>{let A;try{A=r?.(f)}catch(g){if(g===U||g===K||g===B)throw g;if(n!=null&&p){let S=n in f,E=f[n];f[n]=g;try{A=p(f)}finally{S?f[n]=E:delete f[n]}}else if(!p)throw g}finally{m?.(f)}return A}});s("throw",r=>(r=i(r),t=>{throw r(t)}));s("switch",(r,...t)=>(r=i(r),t.length?(t=t.map(e=>[e[0]==="case"?i(e[1]):null,(e[0]==="case"?e[2]:e[1])?.[0]===";"?(e[0]==="case"?e[2]:e[1]).slice(1).map(i):(e[0]==="case"?e[2]:e[1])?[i(e[0]==="case"?e[2]:e[1])]:[]]),e=>{let o=r(e),n=!1,p;for(let[f,A]of t)if(n||f===null||f(e)===o)for(n=!0,m=0;m<A.length;m++)try{p=A[m](e)}catch(g){if(g===U)return p;throw g}var m;return p}):e=>r(e)));s("import",()=>()=>{});s("export",()=>()=>{});s("from",(r,t)=>()=>{});s("as",(r,t)=>()=>{});s("default",r=>i(r));var mt=new WeakMap,Ge=(r,...t)=>typeof r=="string"?i(u(r)):mt.get(r)||mt.set(r,Xe(r,t)).get(r),ct=57344,Xe=(r,t)=>{let e=r.reduce((p,m,f)=>p+(f?String.fromCharCode(ct+f-1):"")+m,""),o=u(e),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-ct,f;if(m>=0&&m<t.length)return f=t[m],Ke(f)?f:[,f]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Ke=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),He=Ge;export{cr as access,y as binary,i as compile,c as cur,He as default,R as err,a as expr,W as group,je as id,l as idx,w as keyword,Q as literal,vr as loc,T as lookup,mr as nary,N as next,s as operator,ur as operators,v as parens,u as parse,Z as peek,$ as prec,O as seek,h as skip,d as space,lr as step,k as token,P as unary,I as word};
|
|
4
|
+
`,""+n}${m}${f}`)},vr=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),N=(r,t=u,e)=>{for(;e=r(c.charCodeAt(u));)u+=e;return c.slice(t,u)},h=(r=1)=>c[u+=r],O=r=>u=r,a=(r=0,t)=>{let e,o,n;for(t&&l.enter?.(r,t);(e=d())&&e!==t&&(n=fr(o,r,e,a));)o=n;return t&&(e==t?(u++,l.exit?.(r,t)):R("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},fr=(r,t,e,o,n)=>(n=T[e])&&n(r,t)||(r?null:N(l.id)||null),d=r=>{for(;(r=c.charCodeAt(u))<=32;)u++;return r},Z=(r=u)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},je=l.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,I=(r,t=r.length)=>c.substr(u,t)===r&&!l.id(c.charCodeAt(u+t)),v=()=>(h(),a(0,41)),T=[],$={},k=(r,t=32,e,o=r.charCodeAt(0),n=r.length,p=T[o],m=r.toUpperCase()!==r,f,A)=>(t=$[r]=!p&&$[r]||t,T[o]=(g,S,E,C=u)=>(f=E,(E?r==E:(n<2||r.charCodeAt(1)===c.charCodeAt(u+1)&&(n<3||c.substr(u,n)==r))&&(!m||!l.id(c.charCodeAt(u+n)))&&(f=E=r))&&S<t&&(u+=n,(A=e(g))?vr(A,C):(u=C,f=0,!m&&!p&&!g&&R()),A)||p?.(g,S,f))),y=(r,t,e=!1)=>k(r,t,o=>o&&(n=>n&&[r,o,n])(a(t-(e?.5:0)))),P=(r,t,e)=>k(r,t,o=>e?o&&[r,o]:!o&&(o=a(t-.5))&&[r,o]),Q=(r,t)=>k(r,200,e=>!e&&[,t]),lr=(r,t,e)=>k(r,t,(o,n)=>(n=a(t-(e?.5:0)),o?.[0]!==r&&(o=[r,o||null]),n?.[0]===r?o.push(...n.slice(1)):o.push(n||null),o)),W=(r,t)=>k(r[0],t,e=>!e&&[r,a(0,r.charCodeAt(1))||null]),mr=(r,t)=>k(r[0],t,e=>e&&[r,e,a(0,r.charCodeAt(1))||null]),w=(r,t,e,o=r.charCodeAt(0),n=r.length,p=T[o],m)=>T[o]=(f,A,g,S=u)=>!f&&(g?r==g:(n<2||c.substr(u,n)==r)&&(g=r))&&A<t&&!l.id(c.charCodeAt(u+n))&&(!l.prop||l.prop(u+n))&&(O(u+n),(m=e())?vr(m,S):O(S),m)||p?.(f,A,g);Object.defineProperty(l,"space",{configurable:!0,enumerable:!0,get:()=>d,set:r=>d=r});Object.defineProperty(l,"step",{configurable:!0,enumerable:!0,get:()=>fr,set:r=>fr=r});var ur={},s=(r,t,e=ur[r])=>ur[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):ur[r[0]]?.(...r.slice(1))??R(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var x=46,z=48,b=57,at=69,ht=101,At=43,yt=45,q=95,Br=110,gt=97,wt=102,Ct=65,Et=70,Mr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),cr=r=>{let t=Mr(N(e=>e===x&&c.charCodeAt(u+1)!==x||e>=z&&e<=b||e===q||((e===at||e===ht)&&((e=c.charCodeAt(u+1))>=z&&e<=b||e===At||e===yt)?2:0)));return c.charCodeAt(u)===Br?(h(),[,BigInt(t)]):(r=+t)!=r?R():[,r]},St={2:r=>r===48||r===49||r===q,8:r=>r>=48&&r<=55||r===q,16:r=>r>=z&&r<=b||r>=gt&&r<=wt||r>=Ct&&r<=Et||r===q};l.number=null;T[x]=r=>!r&&c.charCodeAt(u+1)!==x&&cr();for(let r=z;r<=b;r++)T[r]=t=>t?void 0:cr();T[z]=r=>{if(r)return;let t=l.number;if(t){for(let[e,o]of Object.entries(t))if(e[0]==="0"&&c[u+1]?.toLowerCase()===e[1]){h(2);let n=Mr(N(St[o]));return c.charCodeAt(u)===Br?(h(),[,BigInt("0"+e[1]+n)]):[,parseInt(n,o)]}}return cr()};var kt=92,Lr=34,Ur=39,It={n:`
|
|
5
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Dr=r=>(t,e,o="")=>{if(!(t||!l.string?.[String.fromCharCode(r)]))return h(),N(n=>n-r&&(n===kt?(o+=It[c[u+1]]||c[u+1],2):(o+=c[u],1))),c[u]===String.fromCharCode(r)?h():R("Bad string"),[,o]};T[Lr]=Dr(Lr);T[Ur]=Dr(Ur);l.string={'"':!0};var Tt=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>y(r,Tt,!0));var Nt=30,Rt=40,_t=140;P("!",_t);y("||",Nt);y("&&",Rt);var Ot=50,Pt=60,vt=70,Fr=100,Bt=140;y("|",Ot);y("&",vt);y("^",Pt);y(">>",Fr);y("<<",Fr);P("~",Bt);var rr=90;y("<",rr);y(">",rr);y("<=",rr);y(">=",rr);var Gr=80;y("==",Gr);y("!=",Gr);var Xr=110,dr=120,Kr=140;y("+",Xr);y("-",Xr);y("*",dr);y("/",dr);y("%",dr);P("+",Kr);P("-",Kr);var tr=150;k("++",tr,r=>r?["++",r,null]:["++",a(tr-1)]);k("--",tr,r=>r?["--",r,null]:["--",a(tr-1)]);var Mt=5,Lt=10;lr(",",Lt);lr(";",Mt,!0);var Ut=170;W("()",Ut);var ar=170;mr("[]",ar);y(".",ar);mr("()",ar);var Dt=32,Ft=l.space;l.comment??={"//":`
|
|
6
|
+
`,"/*":"*/"};var hr;l.space=()=>{hr||(hr=Object.entries(l.comment).map(([n,p])=>[n,p,n.charCodeAt(0)]));for(var r;r=Ft();){for(var t=0,e;e=hr[t++];)if(r===e[2]&&c.substr(u,e[0].length)===e[0]){var o=u+e[0].length;if(e[1]===`
|
|
7
|
+
`)for(;c.charCodeAt(o)>=Dt;)o++;else{for(;c[o]&&c.substr(o,e[1].length)!==e[1];)o++;c[o]&&(o+=e[1].length)}O(o),r=0;break}if(r)return r}return r};var Hr=80;y("===",Hr);y("!==",Hr);var Gt=30;y("??",Gt);var Xt=130,Kt=20;y("**",Xt,!0);y("**=",Kt,!0);var jr=90;y("in",jr);y("of",jr);var Ht=20,jt=100;y(">>>",jt);y(">>>=",Ht,!0);var Ar=20;y("||=",Ar,!0);y("&&=",Ar,!0);y("??=",Ar,!0);Q("true",!0);Q("false",!1);Q("null",null);w("undefined",200,()=>[]);Q("NaN",NaN);Q("Infinity",1/0);var yr=20;k("?",yr,(r,t,e)=>r&&(t=a(yr-1))&&N(o=>o===58)&&(e=a(yr-1),["?",r,t,e]));var Qt=20;y("=>",Qt,!0);var $t=140;P("...",$t);var Qr=170;k("?.",Qr,(r,t)=>{if(!r)return;let e=d();return e===40?(h(),["?.()",r,a(0,41)||null]):e===91?(h(),["?.[]",r,a(0,93)]):(t=a(Qr),t?["?.",r,t]:void 0)});var J=140;P("typeof",J);P("void",J);P("delete",J);w("new",J,()=>I(".target")?(h(7),["new.target"]):["new",a(J)]);var Wt=20,$r=200;l.prop=r=>Z(r)!==58;W("[]",$r);W("{}",$r);y(":",Wt-1,!0);var zt=170,er=96,Jt=36,Vt=123,Yt=92,Zt={n:`
|
|
8
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Wr=()=>{let r=[];for(let t="",e;(e=c.charCodeAt(u))!==er;)e?e===Yt?(h(),t+=Zt[c[u]]||c[u],h()):e===Jt&&c.charCodeAt(u+1)===Vt?(t&&r.push([,t]),t="",h(2),r.push(a(0,125))):(t+=c[u],h(),e=c.charCodeAt(u),e===er&&t&&r.push([,t])):R("Unterminated template");return h(),r},qt=T[er];T[er]=(r,t)=>r&&t<zt?l.asi&&l.newline?void 0:(h(),["``",r,...Wr()]):r?qt?.(r,t):(h(),(e=>e.length<2&&e[0]?.[0]===void 0?e[0]||[,""]:["`",...e])(Wr()));l.string["'"]=!0;l.number={"0x":16,"0b":2,"0o":8};var xt=92,bt=117,re=123,te=125,ee=183,oe=l.id,zr=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,ne=(r=u+2,t,e=0,o=0)=>{if(c.charCodeAt(u)!==xt||c.charCodeAt(u+1)!==bt)return 0;if(c.charCodeAt(r)===re){for(;zr(t=c.charCodeAt(++r));)e=e*16+(t<=57?t-48:(t&31)+9);return r>u+3&&e<=1114111&&c.charCodeAt(r)===te?r-u+1:0}for(;o<4&&zr(c.charCodeAt(r+o));)o++;return o===4?6:0};l.id=r=>oe(r)||r===ee||ne();var gr=5,ie=10,se=20,Jr=r=>{if(r==="let"){let e=u;if(d(),I("in")){O(e);return}O(e)}let t=a(ie-1);return t?.[0]==="in"||t?.[0]==="of"?[t[0],[r,t[1]],t[2]]:t?.[0]===","?[r,...t.slice(1)]:[r,t]};w("let",gr+1,()=>Jr("let"));w("const",gr+1,()=>Jr("const"));w("var",gr,()=>(d(),["var",a(se)]));var or=5,pe=59,M=()=>(d()===123||R("Expected {"),h(),a(or-.5,125)||null),D=()=>d()!==123?a(or+.5):(h(),a(or-.5,125)||null),fe=()=>{let r=u;return d()===pe&&h(),d(),I("else")?(h(4),!0):(O(r),!1)};w("if",or+1,()=>{d();let r=["if",v(),D()];return fe()&&r.push(D()),r});var ue=200;w("function",ue,()=>{d();let r=!1;c[u]==="*"&&(r=!0,h(),d());let t=N(l.id);return t&&d(),r?["function*",t,v()||null,M()]:["function",t,v()||null,M()]});var nr=140,wr=20;P("await",nr);w("yield",nr,()=>(d(),c[u]==="*"?(h(),d(),["yield*",a(wr)]):["yield",a(wr)]));w("async",nr,()=>{if(d(),I("function"))return["async",a(nr)];let r=a(wr-.5);return r&&["async",r]});var Cr=200,le=140,me=90;P("static",le);y("instanceof",me);k("#",Cr,r=>{if(r)return;let t=N(l.id);return t?"#"+t:void 0});w("class",Cr,()=>{d();let r=N(l.id)||null;if(r==="extends")r=null,d();else{if(d(),!I("extends"))return["class",r,null,M()];h(7),d()}return["class",r,a(Cr),M()]});var ce=140,Er=47,de=92,ae=r=>r===de?2:r&&r!==Er,he=r=>r===103||r===105||r===109||r===115||r===117||r===121;k("/",ce,r=>{if(r)return;let t=c.charCodeAt(u);if(t===Er||t===42||t===43||t===63||t===61)return;let e=N(ae);c.charCodeAt(u)===Er||R("Unterminated regex"),h();let o=N(he);try{new RegExp(e,o)}catch(n){R("Invalid regex: "+n.message)}return o?["//",e,o]:["//",e]});var H=5,V=125,Y=59;w("while",H+1,()=>(d(),["while",v(),D()]));w("do",H+1,()=>(r=>(d(),h(5),d(),["do",r,v()]))(D()));w("for",H+1,()=>(d(),I("await")?(h(5),d(),["for await",v(),D()]):["for",v(),D()]));w("break",H+1,()=>{l.asi&&(l.newline=!1);let r=u;d();let t=c.charCodeAt(u);if(!t||t===V||t===Y||l.newline)return["break"];let e=N(l.id);if(!e)return["break"];d();let o=c.charCodeAt(u);return!o||o===V||o===Y||l.newline?["break",e]:(O(r),["break"])});w("continue",H+1,()=>{l.asi&&(l.newline=!1);let r=u;d();let t=c.charCodeAt(u);if(!t||t===V||t===Y||l.newline)return["continue"];let e=N(l.id);if(!e)return["continue"];d();let o=c.charCodeAt(u);return!o||o===V||o===Y||l.newline?["continue",e]:(O(r),["continue"])});w("return",H+1,()=>{l.asi&&(l.newline=!1);let r=d();return!r||r===V||r===Y||l.newline?["return"]:["return",a(H)]});var Sr=5;w("try",Sr+1,()=>{let r=["try",M()];return d(),I("catch")&&(h(5),d(),r.push(["catch",Z()===40?v():null,M()])),d(),I("finally")&&(h(7),r.push(["finally",M()])),r});w("throw",Sr+1,()=>{if(l.asi&&(l.newline=!1),d(),l.newline)throw SyntaxError("Unexpected newline after throw");return["throw",a(Sr)]});var Zr=5,Ae=20,Vr=58,ye=59,qr=125,kr=0,xr=(r,t=r.length,e=r.charCodeAt(0),o=T[e])=>T[e]=(n,p,m)=>I(r)&&!n&&kr||o?.(n,p,m);xr("case");xr("default");var Yr=r=>{let t=[];for(;(r=d())!==qr&&!I("case")&&!I("default");){if(r===ye){h();continue}t.push(a(Zr-.5))||R()}return t.length>1?[";",...t]:t[0]||null},ge=()=>{d()===123||R("Expected {"),h(),kr++;let r=[];try{for(;d()!==qr;)if(I("case")){O(u+4),d();let t=a(Ae-.5);d()===Vr&&h(),r.push(["case",t,Yr()])}else I("default")?(O(u+7),d()===Vr&&h(),r.push(["default",Yr()])):R("Expected case or default")}finally{kr--}return h(),r};w("switch",Zr+1,()=>d()===40&&["switch",v(),...ge()]);var br=5;w("debugger",br+1,()=>["debugger"]);w("with",br+1,()=>(d(),["with",v(),D()]));var Ir=5,j=10,rt=42,we=T[rt];T[rt]=(r,t)=>r?we?.(r,t):(h(),"*");k("from",j+1,r=>r?r[0]!=="="&&r[0]!==","&&(d(),["from",r,a(j+1)]):!1);k("as",j+2,r=>r?(d(),["as",r,a(j+2)]):!1);w("import",Ir,()=>I(".meta")?(h(5),["import.meta"]):["import",a(j)]);w("export",Ir,()=>(d(),["export",a(Ir)]));w("default",j+1,()=>d()!==58&&(d(),["default",a(j)]));var Tr=20,Ce=40,tt=41,et=123,ot=125,nt=r=>t=>{if(t)return;d();let e=N(l.id);if(!e||(d(),c.charCodeAt(u)!==Ce))return!1;h();let o=a(0,tt);return d(),c.charCodeAt(u)!==et?!1:(h(),[r,e,o,a(0,ot)])};k("get",Tr-1,nt("get"));k("set",Tr-1,nt("set"));k("(",Tr-1,r=>{if(!r||typeof r!="string")return;let t=a(0,tt)||null;if(d(),c.charCodeAt(u)===et)return h(),[":",r,["=>",["()",t],a(0,ot)||null]]});l.comment["#!"]=`
|
|
9
|
+
`;var st=32,_r=10,Ee=59,Se=125,ke=91,Ie=40,Rr=$.asi??$[";"],Te=l._baseSpace??=l.space,Ne=l._baseStep??=l.step,Re=(r,t)=>{for(;(t=c.charCodeAt(r))<=st;){if(t===_r)return!0;r++}return!1},_e=(r=u,t)=>{for(;r-- >0&&(t=c.charCodeAt(r))<=st;)if(t===_r)return!0;return!1};l.space=(r,t)=>{for(;;){for(t=u,r=Te();t<u;)if(c.charCodeAt(t++)===_r){l.newline=!0;break}if(r===Ee&&Re(u+1)){O(u+1),l.newline=l.semi=!0;continue}return r}};l.enter=()=>l.newline=l.semi=!1;l.exit=(r,t)=>{t===Se&&(l.newline=!0)};l.step=(r,t,e,o)=>{if(l.semi&&t>=Rr)return!1;if(r&&(l.semi||(e===ke||e===Ie)&&_e()))return it(r,t,o)??null;let n=l.newline;return Ne(r,t,e,o)??(r&&n?it(r,t,o)??null:null)};var Nr=0,Oe=100,it=l.asi=(r,t,e,o,n)=>{if(t>=Rr||Nr>=Oe)return;l.semi=!1;let p=u;Nr++;try{o=e(Rr-.5)}finally{Nr--}if(!(!o||u===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var ft=(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?ft(r[1],t):(()=>{throw Error("Invalid assignment target")})(),pt={"=":(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 pt)s(r,(t,e)=>(e=i(e),ft(t,(o,n,p)=>pt[r](o,n,e(p)))));s("!",r=>(r=i(r),t=>!r(t)));s("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));s("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));s("~",r=>(r=i(r),t=>~r(t)));s("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));s("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));s("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));s(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));s("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));s(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));s("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));s(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));s("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));s("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));s("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));s("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));s("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));s("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));s("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));s("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var Or=(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?Or(r[1],t):(()=>{throw Error("Invalid increment target")})();s("++",(r,t)=>Or(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));s("--",(r,t)=>Or(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var ut=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});s(",",ut);s(";",ut);var F=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",ir=r=>{throw Error(r)};s("[]",(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&&ir("Missing index"),r=i(r),t=i(t),e=>{let o=t(e);return F(o)?void 0:r(e)[o]}));s(".",(r,t)=>(r=i(r),t=t[0]?t:t[1],F(t)?()=>{}:e=>r(e)[t]));s("()",(r,t)=>{if(t===void 0)return r==null?ir("Empty ()"):i(r);let e=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||e(p));e(t)&&ir("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(p=>p(n))):(t=i(t),n=>[t(n)]):()=>[];return Pr(r,(n,p,m)=>n[p](...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]==="{}"),Pr=(r,t,e,o)=>r==null?ir("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 p=e(n);return p==null?void 0:t(p,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 p=e(n);return p==null?void 0:t(p,o(n),n)}):(r=i(r),n=>t([r(n)],0,n)),G=Pr;s("===",(r,t)=>(r=i(r),t=i(t),e=>r(e)===t(e)));s("!==",(r,t)=>(r=i(r),t=i(t),e=>r(e)!==t(e)));s("??",(r,t)=>(r=i(r),t=i(t),e=>r(e)??t(e)));var Pe=r=>{throw Error(r)};s("**",(r,t)=>(r=i(r),t=i(t),e=>r(e)**t(e)));s("**=",(r,t)=>(L(r)||Pe("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]**=t(n))));s("in",(r,t)=>(r=i(r),t=i(t),e=>r(e)in t(e)));var ve=r=>{throw Error(r)};s(">>>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>>t(e)));s(">>>=",(r,t)=>(L(r)||ve("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]>>>=t(n))));var Be=r=>r[0]?.[0]===","?r[0].slice(1):r,X=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...n]=r,p=Be(n);if(o==="{}"){let m=[];for(let f of p){if(Array.isArray(f)&&f[0]==="..."){let C={};for(let _ in t)m.includes(_)||(C[_]=t[_]);e[f[1]]=C;break}let A,g,S;typeof f=="string"?A=g=f:f[0]==="="?(typeof f[1]=="string"?A=g=f[1]:[,A,g]=f[1],S=f[2]):[,A,g]=f,m.push(A);let E=t[A];E===void 0&&S&&(E=i(S)(e)),X(g,E,e)}}else if(o==="[]"){let m=0;for(let f of p){if(f===null){m++;continue}if(Array.isArray(f)&&f[0]==="..."){e[f[1]]=t.slice(m);break}let A=f,g;Array.isArray(f)&&f[0]==="="&&([,A,g]=f);let S=t[m++];S===void 0&&g&&(S=i(g)(e)),X(A,S,e)}}},lt=(...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"?p=>{p[e]=n(p)}:p=>X(e,n(p),p)}return i(t)}),t=>{for(let e of r)e(t)});s("let",lt);s("const",lt);s("var",r=>typeof r=="string"?t=>{t[r]=void 0}:()=>{});var sr=r=>{throw Error(r)};s("=",(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=>X(e,t(o),o)}return L(r)||sr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]=t(n))});s("||=",(r,t)=>(L(r)||sr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]||=t(n))));s("&&=",(r,t)=>(L(r)||sr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]&&=t(n))));s("??=",(r,t)=>(L(r)||sr("Invalid assignment target"),t=i(t),G(r,(e,o,n)=>e[o]??=t(n))));s("?",(r,t,e)=>(r=i(r),t=i(t),e=i(e),o=>r(o)?t(o):e(o)));var B=[];s("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=e[e.length-1];Array.isArray(p)&&p[0]==="..."&&(o=e.length-1,n=p[1],e.length--);let m=t?.[0]==="{}";return t=i(m?["{",t[1]]:t),f=>(...A)=>{let g={};e.forEach((E,C)=>g[E]=A[C]),n&&(g[n]=A.slice(o));let S=new Proxy(g,{get:(E,C)=>C in E?E[C]:f?.[C],set:(E,C,_)=>((C in E?E:f)[C]=_,!0),has:(E,C)=>C in E||(f?C in f:!1)});try{let E=t(S);return m?void 0:E}catch(E){if(E===B)return E[0];throw E}}});s("...",r=>(r=i(r),t=>Object.entries(r(t))));s("?.",(r,t)=>(r=i(r),F(t)?()=>{}:e=>r(e)?.[t]));s("?.[]",(r,t)=>(r=i(r),t=i(t),e=>{let o=t(e);return F(o)?void 0:r(e)?.[o]}));s("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(p=>p(n))):(t=i(t),n=>[t(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),p=r[2];return F(p)?()=>{}:m=>n(m)?.[p]?.(...e(m))}if(r[0]==="?.[]"){let n=i(r[1]),p=i(r[2]);return m=>{let f=n(m),A=p(m);return F(A)?void 0:f?.[A]?.(...e(m))}}if(r[0]==="."){let n=i(r[1]),p=r[2];return F(p)?()=>{}:m=>n(m)?.[p]?.(...e(m))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let f=n(m),A=p(m);return F(A)?void 0:f?.[A]?.(...e(m))}}let o=i(r);return n=>o(n)?.(...e(n))});s("typeof",r=>(r=i(r),t=>typeof r(t)));s("void",r=>(r=i(r),t=>(r(t),void 0)));s("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});s("new",r=>{let t=i(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(n=>p=>n.map(m=>m(p)))(e.slice(1).map(i)):(n=>p=>[n(p)])(i(e)):()=>[];return n=>new(t(n))(...o(n))});var pr=Symbol("accessor");s("get",(r,t)=>(t=t?i(t):()=>{},e=>[[pr,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));s("set",(r,t,e)=>(e=e?i(e):()=>{},o=>[[pr,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[t]=n,e(p)}}]]));var Me=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);s("{}",(r,t)=>{if(t!==void 0)return;if(!Me(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={},p={};for(let m of e.flatMap(f=>f(o)))if(m[0]===pr){let[,f,A]=m;p[f]={...p[f],...A,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});s("{",r=>(r=r?i(r):()=>{},t=>r(Object.create(t))));s(":",(r,t)=>(t=i(t),Array.isArray(r)?(r=i(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));s("`",(...r)=>(r=r.map(i),t=>r.map(e=>e(t)).join("")));s("``",(r,...t)=>{r=i(r);let e=[],o=[];for(let p of t)Array.isArray(p)&&p[0]===void 0?e.push(p[1]):o.push(i(p));let n=Object.assign([...e],{raw:e});return p=>r(p)(n,...o.map(m=>m(p)))});s("function",(r,t,e)=>{e=e?i(e):()=>{};let o=t?t[0]===","?t.slice(1):[t]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),f=>{let A=(...g)=>{let S={};o.forEach((C,_)=>S[C]=g[_]),n&&(S[n]=g.slice(p));let E=new Proxy(S,{get:(C,_)=>_ in C?C[_]:f[_],set:(C,_,dt)=>((_ in C?C:f)[_]=dt,!0),has:(C,_)=>_ in C||_ in f});try{return e(E)}catch(C){if(C===B)return C[0];throw C}};return r&&(f[r]=A),A}});s("function*",(r,t,e)=>{throw Error("Generator functions are not supported in evaluation")});s("async",r=>{let t=i(r);return e=>{let o=t(e);return async function(...n){return o(...n)}}});s("await",r=>(r=i(r),async t=>await r(t)));s("yield",r=>(r=r?i(r):null,t=>{throw{__yield__:r?r(t):void 0}}));s("yield*",r=>(r=i(r),t=>{throw{__yield_all__:r(t)}}));var Le=Symbol("static"),Ue=r=>{throw Error(r)};s("instanceof",(r,t)=>(r=i(r),t=i(t),e=>r(e)instanceof t(e)));s("class",(r,t,e)=>(t=t?i(t):null,e=e?i(e):null,o=>{let n=t?t(o):Object,p=function(...m){if(!(this instanceof p))return Ue("Class constructor must be called with new");let f=t?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(f,m),f};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),e){let m=Object.create(o);m.super=n;let f=e(m),A=Array.isArray(f)&&typeof f[0]?.[0]=="string"?f:[];for(let[g,S]of A)g==="constructor"?p.prototype.__constructor__=S:p.prototype[g]=S}return r&&(o[r]=p),p}));s("static",r=>(r=i(r),t=>[[Le,r(t)]]));s("//",(r,t)=>{let e=new RegExp(r,t||"");return()=>e});s("if",(r,t,e)=>(r=i(r),t=i(t),e=e!==void 0?i(e):null,o=>r(o)?t(o):e?.(o)));var U=Symbol("break"),K=Symbol("continue");s("while",(r,t)=>(r=i(r),t=i(t),e=>{let o;for(;r(e);)try{o=t(e)}catch(n){if(n===U)break;if(n===K)continue;if(n===B)return n[0];throw n}return o}));s("do",(r,t)=>(r=i(r),t=i(t),e=>{let o;do try{o=r(e)}catch(n){if(n===U)break;if(n===K)continue;if(n===B)return n[0];throw n}while(t(e));return o}));s("for",(r,t)=>{if(Array.isArray(r)&&r[0]===";"){let[,e,o,n]=r;return e=e?i(e):null,o=o?i(o):()=>!0,n=n?i(n):null,t=i(t),p=>{let m;for(e?.(p);o(p);n?.(p))try{m=t(p)}catch(f){if(f===U)break;if(f===K)continue;if(f===B)return f[0];throw f}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[e,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),e==="in")return Fe(o,n,t);if(e==="of")return De(o,n,t)}});var De=(r,t,e)=>{t=i(t),e=i(e);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let f of t(n)){o?X(r,f,n):n[r]=f;try{p=e(n)}catch(A){if(A===U)break;if(A===K)continue;if(A===B)return A[0];throw A}}return o||(n[r]=m),p}},Fe=(r,t,e)=>{t=i(t),e=i(e);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let f in t(n)){o?X(r,f,n):n[r]=f;try{p=e(n)}catch(A){if(A===U)break;if(A===K)continue;if(A===B)return A[0];throw A}}return o||(n[r]=m),p}};s("break",()=>()=>{throw U});s("continue",()=>()=>{throw K});s("return",r=>(r=r!==void 0?i(r):null,t=>{throw B[0]=r?.(t),B}));s("try",(r,...t)=>{r=r?i(r):null;let e=t.find(f=>f?.[0]==="catch"),o=t.find(f=>f?.[0]==="finally"),n=e?.[1],p=e?.[2]?i(e[2]):null,m=o?.[1]?i(o[1]):null;return f=>{let A;try{A=r?.(f)}catch(g){if(g===U||g===K||g===B)throw g;if(n!=null&&p){let S=n in f,E=f[n];f[n]=g;try{A=p(f)}finally{S?f[n]=E:delete f[n]}}else if(!p)throw g}finally{m?.(f)}return A}});s("throw",r=>(r=i(r),t=>{throw r(t)}));s("switch",(r,...t)=>(r=i(r),t.length?(t=t.map(e=>[e[0]==="case"?i(e[1]):null,(e[0]==="case"?e[2]:e[1])?.[0]===";"?(e[0]==="case"?e[2]:e[1]).slice(1).map(i):(e[0]==="case"?e[2]:e[1])?[i(e[0]==="case"?e[2]:e[1])]:[]]),e=>{let o=r(e),n=!1,p;for(let[f,A]of t)if(n||f===null||f(e)===o)for(n=!0,m=0;m<A.length;m++)try{p=A[m](e)}catch(g){if(g===U)return p;throw g}var m;return p}):e=>r(e)));s("import",()=>()=>{});s("export",()=>()=>{});s("from",(r,t)=>()=>{});s("as",(r,t)=>()=>{});s("default",r=>i(r));var mt=new WeakMap,Ge=(r,...t)=>typeof r=="string"?i(l(r)):mt.get(r)||mt.set(r,Xe(r,t)).get(r),ct=57344,Xe=(r,t)=>{let e=r.reduce((p,m,f)=>p+(f?String.fromCharCode(ct+f-1):"")+m,""),o=l(e),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-ct,f;if(m>=0&&m<t.length)return f=t[m],Ke(f)?f:[,f]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Ke=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),He=Ge;export{mr as access,y as binary,i as compile,c as cur,He as default,R as err,a as expr,W as group,je as id,u as idx,w as keyword,Q as literal,vr as loc,T as lookup,lr as nary,N as next,s as operator,ur as operators,v as parens,l as parse,Z as peek,$ as prec,O as seek,h as skip,d as space,fr as step,k as token,P as unary,I as word};
|