subscript 10.4.9 → 10.4.10
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/if.js +6 -2
- package/feature/template.js +4 -1
- package/jessie.min.js +3 -3
- package/justin.min.js +2 -2
- package/package.json +1 -1
package/feature/if.js
CHANGED
|
@@ -11,12 +11,16 @@ export const block = () =>
|
|
|
11
11
|
export const body = () =>
|
|
12
12
|
parse.space() !== 123 ? expr(STATEMENT + .5) : (skip(), expr(STATEMENT - .5, 125) || null);
|
|
13
13
|
|
|
14
|
-
// Check for `else` after optional semicolon
|
|
14
|
+
// Check for `else` after optional semicolon. The preceding body may have
|
|
15
|
+
// triggered ASI (`x=1;\n`), leaving `parse.semi=true`. That sticky flag
|
|
16
|
+
// would cause the upcoming else-body's parse.step to bail at the first
|
|
17
|
+
// token (statement-precedence boundary), so we clear it once we've confirmed
|
|
18
|
+
// `else` — the else opens a fresh sub-statement.
|
|
15
19
|
const checkElse = () => {
|
|
16
20
|
const from = idx;
|
|
17
21
|
if (parse.space() === SEMI) skip();
|
|
18
22
|
parse.space();
|
|
19
|
-
if (word('else')) return skip(4), true;
|
|
23
|
+
if (word('else')) return skip(4), parse.semi = false, true;
|
|
20
24
|
return seek(from), false;
|
|
21
25
|
};
|
|
22
26
|
|
package/feature/template.js
CHANGED
|
@@ -19,9 +19,12 @@ const parseBody = () => {
|
|
|
19
19
|
return skip(), parts;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
+
// Collapse a single-part body to that part (string or expression); else keep as ['`', ...parts]
|
|
23
|
+
const wrapBody = p => p.length < 2 && p[0]?.[0] === undefined ? p[0] || [,''] : ['`', ...p];
|
|
24
|
+
|
|
22
25
|
const prev = lookup[BACKTICK];
|
|
23
26
|
// Tagged templates: decline when ASI with newline (return undefined to let ASI handle)
|
|
24
27
|
lookup[BACKTICK] = (a, prec) =>
|
|
25
28
|
a && prec < ACCESS ? (parse.asi && parse.newline ? void 0 : (skip(), ['``', a, ...parseBody()])) : // tagged
|
|
26
|
-
!a ? (skip(), (
|
|
29
|
+
!a ? (skip(), wrapBody(parseBody())) : // plain
|
|
27
30
|
prev?.(a, prec);
|
package/jessie.min.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var l,c,s=r=>(l=0,c=r,s.enter?.(),r=h(),c[l]?N():r||""),N=(r="Unexpected token",e=l,t=c.slice(0,e).split(`
|
|
2
2
|
`),o=t.pop(),n=c.slice(Math.max(0,e-40),e),p="\u032D",m=(c[e]||" ")+p,u=c.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
|
|
3
3
|
${c[e-41]!==`
|
|
4
|
-
`,""+n}${m}${u}`)},Br=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),I=(r,e=l,t)=>{for(;t=r(c.charCodeAt(l));)l+=t;return c.slice(e,l)},d=(r=1)=>c[l+=r],O=r=>l=r,h=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,h));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):N("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},Y=(r=l)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},
|
|
4
|
+
`,""+n}${m}${u}`)},Br=(r,e=l)=>(Array.isArray(r)&&(r.loc=e),r),I=(r,e=l,t)=>{for(;t=r(c.charCodeAt(l));)l+=t;return c.slice(e,l)},d=(r=1)=>c[l+=r],O=r=>l=r,h=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,h));)o=n;return e&&(t==e?(l++,s.exit?.(r,e)):N("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},Y=(r=l)=>{for(;c.charCodeAt(r)<=32;)r++;return c.charCodeAt(r)},Vt=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,k=(r,e=r.length)=>c.substr(l,e)===r&&!s.id(c.charCodeAt(l+e)),P=()=>(d(),h(0,41)),T=[],$={},S=(r,e=32,t,o=r.charCodeAt(0),n=r.length,p=T[o],m=r.toUpperCase()!==r,u,a)=>(e=$[r]=!p&&$[r]||e,T[o]=(y,g,E,w=l)=>(u=E,(E?r==E:(n<2||r.charCodeAt(1)===c.charCodeAt(l+1)&&(n<3||c.substr(l,n)==r))&&(!m||!s.id(c.charCodeAt(l+n)))&&(u=E=r))&&g<e&&(l+=n,(a=t(y))?Br(a,w):(l=w,u=0,!m&&!p&&!y&&N()),a)||p?.(y,g,u))),A=(r,e,t=!1)=>S(r,e,o=>o&&(n=>n&&[r,o,n])(h(e-(t?.5:0)))),_=(r,e,t)=>S(r,e,o=>t?o&&[r,o]:!o&&(o=h(e-.5))&&[r,o]),H=(r,e)=>S(r,200,t=>!t&&[,e]),fr=(r,e,t)=>S(r,e,(o,n)=>(n=h(e-(t?.5:0)),o?.[0]!==r&&(o=[r,o||null]),n?.[0]===r?o.push(...n.slice(1)):o.push(n||null),o)),j=(r,e)=>S(r[0],e,t=>!t&&[r,h(0,r.charCodeAt(1))||null]),ur=(r,e)=>S(r[0],e,t=>t&&[r,t,h(0,r.charCodeAt(1))||null]),C=(r,e,t,o=r.charCodeAt(0),n=r.length,p=T[o],m)=>T[o]=(u,a,y,g=l)=>!u&&(y?r==y:(n<2||c.substr(l,n)==r)&&(y=r))&&a<e&&!s.id(c.charCodeAt(l+n))&&(!s.prop||s.prop(l+n))&&(O(l+n),(m=t())?Br(m,g):O(g),m)||p?.(u,a,y);s.space=r=>{for(;(r=c.charCodeAt(l))<=32;)l++;return r};s.step=(r,e,t,o,n)=>(n=T[t])&&n(r,e)||(r?null:I(s.id)||null);var pr={},f=(r,e,t=pr[r])=>pr[r]=(...o)=>e(...o)||t?.(...o),i=r=>Array.isArray(r)?r[0]==null?(e=>()=>e)(r[1]):pr[r[0]]?.(...r.slice(1))??N(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:e=>e?.[r];var q=46,W=48,x=57,ye=69,Ce=101,we=43,ge=45,Z=95,Lr=110,Ee=97,Se=102,ke=65,Te=70,Mr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),lr=r=>{let e=Mr(I(t=>t===q&&c.charCodeAt(l+1)!==q||t>=W&&t<=x||t===Z||((t===ye||t===Ce)&&((t=c.charCodeAt(l+1))>=W&&t<=x||t===we||t===ge)?2:0)));return c.charCodeAt(l)===Lr?(d(),[,BigInt(e)]):(r=+e)!=r?N():[,r]},Ie={2:r=>r===48||r===49||r===Z,8:r=>r>=48&&r<=55||r===Z,16:r=>r>=W&&r<=x||r>=Ee&&r<=Se||r>=ke&&r<=Te||r===Z};s.number=null;T[q]=r=>!r&&c.charCodeAt(l+1)!==q&&lr();for(let r=W;r<=x;r++)T[r]=e=>e?void 0:lr();T[W]=r=>{if(r)return;let e=s.number;if(e){for(let[t,o]of Object.entries(e))if(t[0]==="0"&&c[l+1]?.toLowerCase()===t[1]){d(2);let n=Mr(I(Ie[o]));return c.charCodeAt(l)===Lr?(d(),[,BigInt("0"+t[1]+n)]):[,parseInt(n,o)]}}return lr()};var Ne=92,Ur=34,Dr=39,Fr=117,Gr=120,Re=123,_e=125,Xr=10,Oe=13,Pe={n:`
|
|
5
5
|
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},Kr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Hr=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(e||!s.string?.[n])return;d();let p=()=>{let m=c.charCodeAt(l+1);if(m===Xr)return 2;if(m===Oe)return c.charCodeAt(l+2)===Xr?3:2;if(m===Gr||m===Fr&&c.charCodeAt(l+2)!==Re){let u=m===Gr?2:4,a=0,y;for(let g=0;g<u;g++){if((y=Kr(c.charCodeAt(l+2+g)))<0)return o+=c[l+1],2;a=a*16+y}return o+=String.fromCharCode(a),2+u}if(m===Fr){let u=0,a=l+3,y;for(;(y=Kr(c.charCodeAt(a)))>=0;)u=u*16+y,a++;return a>l+3&&u<=1114111&&c.charCodeAt(a)===_e?(o+=String.fromCodePoint(u),a-l+1):(o+=c[l+1],2)}return o+=Pe[c[l+1]]||c[l+1],2};return I(m=>m-r&&(m!==Ne?(o+=c[l],1):p())),c[l]===n?d():N("Bad string"),[,o]};T[Ur]=Hr(Ur);T[Dr]=Hr(Dr);s.string={'"':!0};var ve=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>A(r,ve,!0));var Be=30,Le=40,Me=140;_("!",Me);A("||",Be);A("&&",Le);var Ue=50,De=60,Fe=70,Qr=100,Ge=140;A("|",Ue);A("&",Fe);A("^",De);A(">>",Qr);A("<<",Qr);_("~",Ge);var b=90;A("<",b);A(">",b);A("<=",b);A(">=",b);var $r=80;A("==",$r);A("!=",$r);var jr=110,mr=120,Wr=140;A("+",jr);A("-",jr);A("*",mr);A("/",mr);A("%",mr);_("+",Wr);_("-",Wr);var rr=150;S("++",rr,r=>r?["++",r,null]:["++",h(rr-1)]);S("--",rr,r=>r?["--",r,null]:["--",h(rr-1)]);var Xe=5,Ke=10;fr(",",Ke);fr(";",Xe,!0);var He=170;j("()",He);var cr=170;ur("[]",cr);A(".",cr);ur("()",cr);var Qe=32,$e=s.space;s.comment??={"//":`
|
|
6
6
|
`,"/*":"*/"};var ar;s.space=()=>{ar||(ar=Object.entries(s.comment).map(([n,p])=>[n,p,n.charCodeAt(0)]));for(var r;r=$e();){for(var e=0,t;t=ar[e++];)if(r===t[2]&&c.substr(l,t[0].length)===t[0]){var o=l+t[0].length;if(t[1]===`
|
|
7
7
|
`)for(;c.charCodeAt(o)>=Qe;)o++;else{for(;c[o]&&c.substr(o,t[1].length)!==t[1];)o++;c[o]&&(o+=t[1].length)}O(o),r=0;break}if(r)return r}return r};var zr=80;A("===",zr);A("!==",zr);var je=30;A("??",je);var We=130,ze=20;A("**",We,!0);A("**=",ze,!0);var Jr=90;A("in",Jr);A("of",Jr);var Je=20,Ve=100;A(">>>",Ve);A(">>>=",Je,!0);var dr=20;A("||=",dr,!0);A("&&=",dr,!0);A("??=",dr,!0);H("true",!0);H("false",!1);H("null",null);C("undefined",200,()=>[]);H("NaN",NaN);H("Infinity",1/0);var hr=20;S("?",hr,(r,e,t)=>r&&(e=h(hr-1))&&I(o=>o===58)&&(t=h(hr-1),["?",r,e,t]));var Ye=20;A("=>",Ye,!0);var Ze=20;_("...",Ze);var Vr=170;S("?.",Vr,(r,e)=>{if(!r)return;let t=s.space();return t===40?(d(),["?.()",r,h(0,41)||null]):t===91?(d(),["?.[]",r,h(0,93)]):(e=h(Vr),e?["?.",r,e]:void 0)});var z=140;_("typeof",z);_("void",z);_("delete",z);C("new",z,()=>k(".target")?(d(7),["new.target"]):["new",h(z)]);var qe=20,Yr=200;s.prop=r=>Y(r)!==58;j("[]",Yr);j("{}",Yr);A(":",qe-1,!0);var xe=170,er=96,be=36,rt=123,et=92,tt={n:`
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Zr=()=>{let r=[];for(let e="",t;(t=c.charCodeAt(l))!==er;)t?t===et?(d(),e+=tt[c[l]]||c[l],d()):t===be&&c.charCodeAt(l+1)===rt?(e&&r.push([,e]),e="",d(2),r.push(h(0,125))):(e+=c[l],d(),t=c.charCodeAt(l),t===er&&e&&r.push([,e])):N("Unterminated template");return d(),r},ot=T[er];T[er]=(r,e)=>r&&e<xe?s.asi&&s.newline?void 0:(d(),["``",r,...Zr()]):r?
|
|
9
|
-
`;var le=32,_r=10,Nt=59,Rt=125,_t=91,Ot=40,Rr=$.asi??$[";"],Pt=s._baseSpace??=s.space,vt=s._baseStep??=s.step,Ir=r=>Array.isArray(r)||typeof r=="string",Bt=(r,e)=>{for(;(e=c.charCodeAt(r))<=le;){if(e===_r)return!0;r++}return!1},Lt=(r=l,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=le;)if(e===_r)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=Pt();e<l;)if(c.charCodeAt(e++)===_r){s.newline=!0;break}if(r===Nt&&Bt(l+1)){O(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===Rt&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=Rr)return!1;if(r&&!Ir(r))return null;if(Ir(r)&&(s.semi||(t===_t||t===Ot)&&Lt()))return ue(r,e,o)??null;let n=s.newline;return vt(r,e,t,o)??(Ir(r)&&n?ue(r,e,o)??null:null)};var Nr=0,Mt=2e3,ue=s.asi=(r,e,t,o,n)=>{if(e>=Rr||Nr>=Mt)return;s.semi=!1;let p=l;Nr++;try{o=t(Rr-.5)}finally{Nr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var ce=(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?ce(r[1],e):(()=>{throw Error("Invalid assignment target")})(),me={"=":(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 me)f(r,(e,t)=>(t=i(t),ce(e,(o,n,p)=>me[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 Or=(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?Or(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Or(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Or(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var ae=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",ae);f(";",ae);var D=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",nr=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&&nr("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return D(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],D(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?nr("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&nr("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];return 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,e,t,o)=>r==null?nr("Empty ()"):r[0]==="()"&&r.length==2?Pr(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)),F=Pr;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 Ut=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(L(r)||Ut("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 Dt=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(L(r)||Dt("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]>>>=e(n))));var Ft=r=>r[0]?.[0]===","?r[0].slice(1):r,G=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Ft(n);if(o==="{}"){let m=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let w={};for(let R in e)m.includes(R)||(w[R]=e[R]);t[u[1]]=w;break}let a,y,g;typeof u=="string"?a=y=u:u[0]==="="?(typeof u[1]=="string"?a=y=u[1]:[,a,y]=u[1],g=u[2]):[,a,y]=u,m.push(a);let E=e[a];E===void 0&&g&&(E=i(g)(t)),G(y,E,t)}}else if(o==="[]"){let m=0;for(let u of p){if(u===null){m++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(m);break}let a=u,y;Array.isArray(u)&&u[0]==="="&&([,a,y]=u);let g=e[m++];g===void 0&&y&&(g=i(y)(t)),G(a,g,t)}}},vr=(...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=>G(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",vr);f("const",vr);f("var",vr);var ir=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=>G(t,e(o),o)}return L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(L(r)||ir("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 v=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let m=e?.[0]==="{}";return e=i(m?["{",e[1]]:e),u=>(...a)=>{let y={};t.forEach((E,w)=>y[E]=a[w]),n&&(y[n]=a.slice(o));let g=new Proxy(y,{get:(E,w)=>w in E?E[w]:u?.[w],set:(E,w,R)=>((w in E?E:u)[w]=R,!0),has:(E,w)=>w in E||(u?w in u:!1)});try{let E=e(g);return m?void 0:E}catch(E){if(E===v)return E[0];throw E}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),D(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return D(o)?void 0:r(t)?.[o]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),p=r[2];return D(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="?.[]"){let n=i(r[1]),p=i(r[2]);return m=>{let u=n(m),a=p(m);return D(a)?void 0:u?.[a]?.(...t(m))}}if(r[0]==="."){let n=i(r[1]),p=r[2];return D(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let u=n(m),a=p(m);return D(a)?void 0:u?.[a]?.(...t(m))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(m=>m(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var sr=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[sr,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[sr,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var Gt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!Gt(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let m of t.flatMap(u=>u(o)))if(m[0]===sr){let[,u,a]=m;p[u]={...p[u],...a,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(m=>m(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),u=>{let a=(...y)=>{let g={};o.forEach((w,R)=>g[w]=y[R]),n&&(g[n]=y.slice(p));let E=new Proxy(g,{get:(w,R)=>R in w?w[R]:u[R],set:(w,R,Ae)=>((R in w?w:u)[R]=Ae,!0),has:(w,R)=>R in w||R in u});try{return t(E)}catch(w){if(w===v)return w[0];throw w}};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 Xt=Symbol("static"),Kt=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?e(o):Object,p=function(...m){if(!(this instanceof p))return Kt("Class constructor must be called with new");let u=e?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,m),u};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),t){let m=Object.create(o);m.super=n;let u=t(m),a=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,g]of a)y==="constructor"?p.prototype.__constructor__=g:p.prototype[y]=g}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[Xt,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 M=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===M)break;if(n===X)continue;if(n===v)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===M)break;if(n===X)continue;if(n===v)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let m;for(t?.(p);o(p);n?.(p))try{m=e(p)}catch(u){if(u===M)break;if(u===X)continue;if(u===v)return u[0];throw u}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return Qt(o,n,e);if(t==="of")return Ht(o,n,e)}});var Ht=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u of e(n)){o?G(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===M)break;if(a===X)continue;if(a===v)return a[0];throw a}}return o||(n[r]=m),p}},Qt=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u in e(n)){o?G(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===M)break;if(a===X)continue;if(a===v)return a[0];throw a}}return o||(n[r]=m),p}};f("break",()=>()=>{throw M});f("continue",()=>()=>{throw X});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw v[0]=r?.(e),v}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(u=>u?.[0]==="catch"),o=e.find(u=>u?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,m=o?.[1]?i(o[1]):null;return u=>{let a;try{a=r?.(u)}catch(y){if(y===M||y===X||y===v)throw y;if(n!=null&&p){let g=n in u,E=u[n];u[n]=y;try{a=p(u)}finally{g?u[n]=E:delete u[n]}}else if(!p)throw y}finally{m?.(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,m=0;m<a.length;m++)try{p=a[m](t)}catch(y){if(y===M)return p;throw y}var m;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var de=new WeakMap,$t=(r,...e)=>typeof r=="string"?i(s(r)):de.get(r)||de.set(r,jt(r,e)).get(r),he=57344,jt=(r,e)=>{let t=r.reduce((p,m,u)=>p+(u?String.fromCharCode(he+u-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-he,u;if(m>=0&&m<e.length)return u=e[m],Wt(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Wt=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),zt=$t;export{ur as access,A as binary,i as compile,c as cur,zt as default,N as err,h as expr,j as group,Jt as id,l as idx,C as keyword,H as literal,Br as loc,T as lookup,fr as nary,I as next,f as operator,pr as operators,P as parens,s as parse,Y as peek,$ as prec,O as seek,d as skip,S as token,_ as unary,k as word};
|
|
8
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Zr=()=>{let r=[];for(let e="",t;(t=c.charCodeAt(l))!==er;)t?t===et?(d(),e+=tt[c[l]]||c[l],d()):t===be&&c.charCodeAt(l+1)===rt?(e&&r.push([,e]),e="",d(2),r.push(h(0,125))):(e+=c[l],d(),t=c.charCodeAt(l),t===er&&e&&r.push([,e])):N("Unterminated template");return d(),r},ot=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],nt=T[er];T[er]=(r,e)=>r&&e<xe?s.asi&&s.newline?void 0:(d(),["``",r,...Zr()]):r?nt?.(r,e):(d(),ot(Zr()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var it=92,st=117,pt=123,ft=125,ut=183,lt=s.id,qr=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,mt=(r=l+2,e,t=0,o=0)=>{if(c.charCodeAt(l)!==it||c.charCodeAt(l+1)!==st)return 0;if(c.charCodeAt(r)===pt){for(;qr(e=c.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>l+3&&t<=1114111&&c.charCodeAt(r)===ft?r-l+1:0}for(;o<4&&qr(c.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>lt(r)||r===ut||mt();var Ar=5,ct=10,yr=r=>{let e=l,t=h(ct-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(O(e),r):t[0]==="in"||t[0]==="of"?[t[0],[r,t[1]],t[2]]:t[0]===","?[r,...t.slice(1)]:[r,t]};C("let",Ar+1,()=>yr("let"));C("const",Ar+1,()=>yr("const"));C("var",Ar+1,()=>yr("var"));var tr=5,at=59,B=()=>(s.space()===123||N("Expected {"),d(),h(tr-.5,125)||null),U=()=>s.space()!==123?h(tr+.5):(d(),h(tr-.5,125)||null),dt=()=>{let r=l;return s.space()===at&&d(),s.space(),k("else")?(d(4),s.semi=!1,!0):(O(r),!1)};C("if",tr+1,()=>{s.space();let r=["if",P(),U()];return dt()&&r.push(U()),r});var ht=200;C("function",ht,()=>{s.space();let r=!1;c[l]==="*"&&(r=!0,d(),s.space());let e=I(s.id);return e&&s.space(),r?["function*",e,P()||null,B()]:["function",e,P()||null,B()]});var or=140,Cr=20;_("await",or);C("yield",or,()=>(s.space(),c[l]==="*"?(d(),s.space(),["yield*",h(Cr)]):["yield",h(Cr)]));C("async",or,()=>{if(s.space(),k("function"))return["async",h(or)];let r=h(Cr-.5);return r&&["async",r]});var wr=200;var At=90,yt=175;_("static",yt);A("instanceof",At);S("#",wr,r=>{if(r)return;let e=I(s.id);return e?"#"+e:void 0});C("class",wr,()=>{s.space();let r=I(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!k("extends"))return["class",r,null,B()];d(7),s.space()}return["class",r,h(wr),B()]});var gr=47,Ct=92;S("/",140,r=>{let e=c.charCodeAt(l);if(r||e===gr||e===42||e===43||e===63||e===61)return;let t=I(n=>n===Ct?2:n&&n!==gr);c.charCodeAt(l)===gr||N("Unterminated regex"),d();let o=I(n=>n===103||n===105||n===109||n===115||n===117||n===121);return o?["//",t,o]:["//",t]});var K=5,J=125,V=59;C("while",K+1,()=>(s.space(),["while",P(),U()]));C("do",K+1,()=>(r=>(s.space(),d(5),s.space(),["do",r,P()]))(U()));C("for",K+1,()=>(s.space(),k("await")?(d(5),s.space(),["for await",P(),U()]):["for",P(),U()]));C("break",K+1,()=>{s.asi&&(s.newline=!1);let r=l;s.space();let e=c.charCodeAt(l);if(!e||e===J||e===V||s.newline)return["break"];let t=I(s.id);if(!t)return["break"];s.space();let o=c.charCodeAt(l);return!o||o===J||o===V||s.newline?["break",t]:(O(r),["break"])});C("continue",K+1,()=>{s.asi&&(s.newline=!1);let r=l;s.space();let e=c.charCodeAt(l);if(!e||e===J||e===V||s.newline)return["continue"];let t=I(s.id);if(!t)return["continue"];s.space();let o=c.charCodeAt(l);return!o||o===J||o===V||s.newline?["continue",t]:(O(r),["continue"])});C("return",K+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",h(K)]});var Er=5;C("try",Er+1,()=>{let r=["try",B()];return s.space(),k("catch")&&(d(5),s.space(),r.push(["catch",Y()===40?P():null,B()])),s.space(),k("finally")&&(d(7),r.push(["finally",B()])),r});C("throw",Er+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",h(Er)]});var re=5,wt=20,xr=58,gt=59,ee=125,Sr=0,te=(r,e=r.length,t=r.charCodeAt(0),o=T[t])=>T[t]=(n,p,m)=>k(r)&&!n&&Sr||o?.(n,p,m);te("case");te("default");var br=r=>{let e=[];for(;(r=s.space())!==ee&&!k("case")&&!k("default");){if(r===gt){d();continue}e.push(h(re-.5))||N()}return e.length>1?[";",...e]:e[0]||null},Et=()=>{s.space()===123||N("Expected {"),d(),Sr++;let r=[];try{for(;s.space()!==ee;)if(k("case")){O(l+4),s.space();let e=h(wt-.5);s.space()===xr&&d(),r.push(["case",e,br()])}else k("default")?(O(l+7),s.space()===xr&&d(),r.push(["default",br()])):N("Expected case or default")}finally{Sr--}return d(),r};C("switch",re+1,()=>s.space()===40&&["switch",P(),...Et()]);var oe=5;C("debugger",oe+1,()=>["debugger"]);C("with",oe+1,()=>(s.space(),["with",P(),U()]));var kr=5,Q=10,ne=42,St=T[ne];T[ne]=(r,e)=>r?St?.(r,e):(d(),"*");S("from",Q+1,r=>r?r[0]!=="="&&r[0]!==","&&(s.space(),["from",r,h(Q+1)]):!1);S("as",Q+2,r=>r?(s.space(),["as",r,h(Q+2)]):!1);C("import",kr,()=>k(".meta")?(d(5),["import.meta"]):["import",h(Q)]);C("export",kr,()=>(s.space(),k("default")?(d(7),["export",["default",h(Q)]]):["export",h(kr)]));var Tr=20,kt=10,Tt=13,It=40,ie=41,se=123,pe=125,Nt=(r,e)=>{for(;r<e;){let t=c.charCodeAt(r++);if(t===kt||t===Tt)return!0}return!1},fe=r=>e=>{if(e)return;let t=l;if(s.space(),s.semi||Nt(t,l))return!1;let o=I(s.id);if(!o||(s.space(),c.charCodeAt(l)!==It))return!1;d();let n=h(0,ie);return s.space(),c.charCodeAt(l)!==se?!1:(d(),[r,o,n,h(0,pe)])};S("get",Tr-1,fe("get"));S("set",Tr-1,fe("set"));S("(",Tr-1,r=>{if(!r)return;let e;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),typeof r!="string"&&!(Array.isArray(r)&&r[0]===void 0))return;let t=h(0,ie)||null;if(s.space(),c.charCodeAt(l)!==se)return;d();let o=[":",r,["=>",["()",t],h(0,pe)||null]];return e?[e,o]:o});s.comment["#!"]=`
|
|
9
|
+
`;var le=32,_r=10,Rt=59,_t=125,Ot=91,Pt=40,Rr=$.asi??$[";"],vt=s._baseSpace??=s.space,Bt=s._baseStep??=s.step,Ir=r=>Array.isArray(r)||typeof r=="string",Lt=(r,e)=>{for(;(e=c.charCodeAt(r))<=le;){if(e===_r)return!0;r++}return!1},Mt=(r=l,e)=>{for(;r-- >0&&(e=c.charCodeAt(r))<=le;)if(e===_r)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=vt();e<l;)if(c.charCodeAt(e++)===_r){s.newline=!0;break}if(r===Rt&&Lt(l+1)){O(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===_t&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=Rr)return!1;if(r&&!Ir(r))return null;if(Ir(r)&&(s.semi||(t===Ot||t===Pt)&&Mt()))return ue(r,e,o)??null;let n=s.newline;return Bt(r,e,t,o)??(Ir(r)&&n?ue(r,e,o)??null:null)};var Nr=0,Ut=2e3,ue=s.asi=(r,e,t,o,n)=>{if(e>=Rr||Nr>=Ut)return;s.semi=!1;let p=l;Nr++;try{o=t(Rr-.5)}finally{Nr--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var ce=(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?ce(r[1],e):(()=>{throw Error("Invalid assignment target")})(),me={"=":(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 me)f(r,(e,t)=>(t=i(t),ce(e,(o,n,p)=>me[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 Or=(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?Or(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Or(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Or(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var ae=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",ae);f(";",ae);var D=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",nr=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&&nr("Missing index"),r=i(r),e=i(e),t=>{let o=e(t);return D(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=e[0]?e:e[1],D(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?nr("Empty ()"):i(r);let t=n=>n?.[0]===","&&n.slice(1).some(p=>p==null||t(p));t(e)&&nr("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];return 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,e,t,o)=>r==null?nr("Empty ()"):r[0]==="()"&&r.length==2?Pr(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)),F=Pr;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 Dt=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(L(r)||Dt("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 Ft=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(L(r)||Ft("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]>>>=e(n))));var Gt=r=>r[0]?.[0]===","?r[0].slice(1):r,G=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Gt(n);if(o==="{}"){let m=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let w={};for(let R in e)m.includes(R)||(w[R]=e[R]);t[u[1]]=w;break}let a,y,g;typeof u=="string"?a=y=u:u[0]==="="?(typeof u[1]=="string"?a=y=u[1]:[,a,y]=u[1],g=u[2]):[,a,y]=u,m.push(a);let E=e[a];E===void 0&&g&&(E=i(g)(t)),G(y,E,t)}}else if(o==="[]"){let m=0;for(let u of p){if(u===null){m++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(m);break}let a=u,y;Array.isArray(u)&&u[0]==="="&&([,a,y]=u);let g=e[m++];g===void 0&&y&&(g=i(y)(t)),G(a,g,t)}}},vr=(...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=>G(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",vr);f("const",vr);f("var",vr);var ir=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=>G(t,e(o),o)}return L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(L(r)||ir("Invalid assignment target"),e=i(e),F(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(L(r)||ir("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 v=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let m=e?.[0]==="{}";return e=i(m?["{",e[1]]:e),u=>(...a)=>{let y={};t.forEach((E,w)=>y[E]=a[w]),n&&(y[n]=a.slice(o));let g=new Proxy(y,{get:(E,w)=>w in E?E[w]:u?.[w],set:(E,w,R)=>((w in E?E:u)[w]=R,!0),has:(E,w)=>w in E||(u?w in u:!1)});try{let E=e(g);return m?void 0:E}catch(E){if(E===v)return E[0];throw E}}});f("...",r=>(r=i(r),e=>Object.entries(r(e))));f("?.",(r,e)=>(r=i(r),D(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=e(t);return D(o)?void 0:r(t)?.[o]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="?."){let n=i(r[1]),p=r[2];return D(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="?.[]"){let n=i(r[1]),p=i(r[2]);return m=>{let u=n(m),a=p(m);return D(a)?void 0:u?.[a]?.(...t(m))}}if(r[0]==="."){let n=i(r[1]),p=r[2];return D(p)?()=>{}:m=>n(m)?.[p]?.(...t(m))}if(r[0]==="[]"&&r.length===3){let n=i(r[1]),p=i(r[2]);return m=>{let u=n(m),a=p(m);return D(a)?void 0:u?.[a]?.(...t(m))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(m=>m(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var sr=Symbol("accessor");f("get",(r,e)=>(e=e?i(e):()=>{},t=>[[sr,r,{get:function(){let o=Object.create(t||{});return o.this=this,e(o)}}]]));f("set",(r,e,t)=>(t=t?i(t):()=>{},o=>[[sr,r,{set:function(n){let p=Object.create(o||{});p.this=this,p[e]=n,t(p)}}]]));var Xt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!Xt(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let m of t.flatMap(u=>u(o)))if(m[0]===sr){let[,u,a]=m;p[u]={...p[u],...a,configurable:!0,enumerable:!0}}else n[m[0]]=m[1];for(let m in p)Object.defineProperty(n,m,p[m]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(m=>m(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,m=o[o.length-1];return Array.isArray(m)&&m[0]==="..."&&(p=o.length-1,n=m[1],o.length--),u=>{let a=(...y)=>{let g={};o.forEach((w,R)=>g[w]=y[R]),n&&(g[n]=y.slice(p));let E=new Proxy(g,{get:(w,R)=>R in w?w[R]:u[R],set:(w,R,Ae)=>((R in w?w:u)[R]=Ae,!0),has:(w,R)=>R in w||R in u});try{return t(E)}catch(w){if(w===v)return w[0];throw w}};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 Kt=Symbol("static"),Ht=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?e(o):Object,p=function(...m){if(!(this instanceof p))return Ht("Class constructor must be called with new");let u=e?Reflect.construct(n,m,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,m),u};if(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n),t){let m=Object.create(o);m.super=n;let u=t(m),a=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,g]of a)y==="constructor"?p.prototype.__constructor__=g:p.prototype[y]=g}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[Kt,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 M=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===M)break;if(n===X)continue;if(n===v)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===M)break;if(n===X)continue;if(n===v)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let m;for(t?.(p);o(p);n?.(p))try{m=e(p)}catch(u){if(u===M)break;if(u===X)continue;if(u===v)return u[0];throw u}return m}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return $t(o,n,e);if(t==="of")return Qt(o,n,e)}});var Qt=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u of e(n)){o?G(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===M)break;if(a===X)continue;if(a===v)return a[0];throw a}}return o||(n[r]=m),p}},$t=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,m=o?null:n[r];for(let u in e(n)){o?G(r,u,n):n[r]=u;try{p=t(n)}catch(a){if(a===M)break;if(a===X)continue;if(a===v)return a[0];throw a}}return o||(n[r]=m),p}};f("break",()=>()=>{throw M});f("continue",()=>()=>{throw X});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw v[0]=r?.(e),v}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(u=>u?.[0]==="catch"),o=e.find(u=>u?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,m=o?.[1]?i(o[1]):null;return u=>{let a;try{a=r?.(u)}catch(y){if(y===M||y===X||y===v)throw y;if(n!=null&&p){let g=n in u,E=u[n];u[n]=y;try{a=p(u)}finally{g?u[n]=E:delete u[n]}}else if(!p)throw y}finally{m?.(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,m=0;m<a.length;m++)try{p=a[m](t)}catch(y){if(y===M)return p;throw y}var m;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var de=new WeakMap,jt=(r,...e)=>typeof r=="string"?i(s(r)):de.get(r)||de.set(r,Wt(r,e)).get(r),he=57344,Wt=(r,e)=>{let t=r.reduce((p,m,u)=>p+(u?String.fromCharCode(he+u-1):"")+m,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-he,u;if(m>=0&&m<e.length)return u=e[m],zt(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},zt=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Jt=jt;export{ur as access,A as binary,i as compile,c as cur,Jt as default,N as err,h as expr,j as group,Vt as id,l as idx,C as keyword,H as literal,Br as loc,T as lookup,fr as nary,I as next,f as operator,pr as operators,P as parens,s as parse,Y as peek,$ as prec,O as seek,d as skip,S as token,_ as unary,k as word};
|
package/justin.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var u,l,d=r=>(u=0,l=r,d.enter?.(),r=y(),l[u]?v():r||""),v=(r="Unexpected token",t=u,e=l.slice(0,t).split(`
|
|
2
2
|
`),o=e.pop(),i=l.slice(Math.max(0,t-40),t),p="\u032D",m=(l[t]||" ")+p,f=l.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
3
|
${l[t-41]!==`
|
|
4
|
-
`,""+i}${m}${f}`)},ir=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=u,e)=>{for(;e=r(l.charCodeAt(u));)u+=e;return l.slice(t,u)},C=(r=1)=>l[u+=r],M=r=>u=r,y=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,y));)o=i;return t&&(e==t?(u++,d.exit?.(r,t)):v("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},sr=(r=u)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},
|
|
4
|
+
`,""+i}${m}${f}`)},ir=(r,t=u)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=u,e)=>{for(;e=r(l.charCodeAt(u));)u+=e;return l.slice(t,u)},C=(r=1)=>l[u+=r],M=r=>u=r,y=(r=0,t)=>{let e,o,i;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(i=d.step(o,r,e,y));)o=i;return t&&(e==t?(u++,d.exit?.(r,t)):v("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},sr=(r=u)=>{for(;l.charCodeAt(r)<=32;)r++;return l.charCodeAt(r)},Lt=d.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,pr=(r,t=r.length)=>l.substr(u,t)===r&&!d.id(l.charCodeAt(u+t)),Pt=()=>(C(),y(0,41)),w=[],nr={},I=(r,t=32,e,o=r.charCodeAt(0),i=r.length,p=w[o],m=r.toUpperCase()!==r,f,A)=>(t=nr[r]=!p&&nr[r]||t,w[o]=(h,S,g,E=u)=>(f=g,(g?r==g:(i<2||r.charCodeAt(1)===l.charCodeAt(u+1)&&(i<3||l.substr(u,i)==r))&&(!m||!d.id(l.charCodeAt(u+i)))&&(f=g=r))&&S<t&&(u+=i,(A=e(h))?ir(A,E):(u=E,f=0,!m&&!p&&!h&&v()),A)||p?.(h,S,f))),c=(r,t,e=!1)=>I(r,t,o=>o&&(i=>i&&[r,o,i])(y(t-(e?.5:0)))),k=(r,t,e)=>I(r,t,o=>e?o&&[r,o]:!o&&(o=y(t-.5))&&[r,o]),P=(r,t)=>I(r,200,e=>!e&&[,t]),J=(r,t,e)=>I(r,t,(o,i)=>(i=y(t-(e?.5:0)),o?.[0]!==r&&(o=[r,o||null]),i?.[0]===r?o.push(...i.slice(1)):o.push(i||null),o)),U=(r,t)=>I(r[0],t,e=>!e&&[r,y(0,r.charCodeAt(1))||null]),V=(r,t)=>I(r[0],t,e=>e&&[r,e,y(0,r.charCodeAt(1))||null]),D=(r,t,e,o=r.charCodeAt(0),i=r.length,p=w[o],m)=>w[o]=(f,A,h,S=u)=>!f&&(h?r==h:(i<2||l.substr(u,i)==r)&&(h=r))&&A<t&&!d.id(l.charCodeAt(u+i))&&(!d.prop||d.prop(u+i))&&(M(u+i),(m=e())?ir(m,S):M(S),m)||p?.(f,A,h);d.space=r=>{for(;(r=l.charCodeAt(u))<=32;)u++;return r};d.step=(r,t,e,o,i)=>(i=w[e])&&i(r,t)||(r?null:L(d.id)||null);var z={},s=(r,t,e=z[r])=>z[r]=(...o)=>t(...o)||e?.(...o),n=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):z[r[0]]?.(...r.slice(1))??v(`Unknown operator: ${r[0]}`,r?.loc):r===void 0?()=>{}:t=>t?.[r];var G=46,_=48,X=57,Ur=69,_r=101,Br=43,ar=45,F=95,mr=110,Mr=97,Dr=102,Fr=65,Gr=70,fr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Y=r=>{let t=fr(L(e=>e===G&&l.charCodeAt(u+1)!==G||e>=_&&e<=X||e===F||((e===Ur||e===_r)&&((e=l.charCodeAt(u+1))>=_&&e<=X||e===Br||e===ar)?2:0)));return l.charCodeAt(u)===mr?(C(),[,BigInt(t)]):(r=+t)!=r?v():[,r]},Xr={2:r=>r===48||r===49||r===F,8:r=>r>=48&&r<=55||r===F,16:r=>r>=_&&r<=X||r>=Mr&&r<=Dr||r>=Fr&&r<=Gr||r===F};d.number=null;w[G]=r=>!r&&l.charCodeAt(u+1)!==G&&Y();for(let r=_;r<=X;r++)w[r]=t=>t?void 0:Y();w[_]=r=>{if(r)return;let t=d.number;if(t){for(let[e,o]of Object.entries(t))if(e[0]==="0"&&l[u+1]?.toLowerCase()===e[1]){C(2);let i=fr(L(Xr[o]));return l.charCodeAt(u)===mr?(C(),[,BigInt("0"+e[1]+i)]):[,parseInt(i,o)]}}return Y()};var $r=92,ur=34,lr=39,cr=117,dr=120,Qr=123,Hr=125,Ar=10,jr=13,Kr={n:`
|
|
5
5
|
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},hr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,gr=r=>(t,e,o="",i=String.fromCharCode(r))=>{if(t||!d.string?.[i])return;C();let p=()=>{let m=l.charCodeAt(u+1);if(m===Ar)return 2;if(m===jr)return l.charCodeAt(u+2)===Ar?3:2;if(m===dr||m===cr&&l.charCodeAt(u+2)!==Qr){let f=m===dr?2:4,A=0,h;for(let S=0;S<f;S++){if((h=hr(l.charCodeAt(u+2+S)))<0)return o+=l[u+1],2;A=A*16+h}return o+=String.fromCharCode(A),2+f}if(m===cr){let f=0,A=u+3,h;for(;(h=hr(l.charCodeAt(A)))>=0;)f=f*16+h,A++;return A>u+3&&f<=1114111&&l.charCodeAt(A)===Hr?(o+=String.fromCodePoint(f),A-u+1):(o+=l[u+1],2)}return o+=Kr[l[u+1]]||l[u+1],2};return L(m=>m-r&&(m!==$r?(o+=l[u],1):p())),l[u]===i?C():v("Bad string"),[,o]};w[ur]=gr(ur);w[lr]=gr(lr);d.string={'"':!0};var Wr=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,Wr,!0));var zr=30,Jr=40,Vr=140;k("!",Vr);c("||",zr);c("&&",Jr);var Yr=50,Zr=60,qr=70,yr=100,xr=140;c("|",Yr);c("&",qr);c("^",Zr);c(">>",yr);c("<<",yr);k("~",xr);var $=90;c("<",$);c(">",$);c("<=",$);c(">=",$);var Cr=80;c("==",Cr);c("!=",Cr);var Sr=110,Z=120,Er=140;c("+",Sr);c("-",Sr);c("*",Z);c("/",Z);c("%",Z);k("+",Er);k("-",Er);var Q=150;I("++",Q,r=>r?["++",r,null]:["++",y(Q-1)]);I("--",Q,r=>r?["--",r,null]:["--",y(Q-1)]);var br=5,rt=10;J(",",rt);J(";",br,!0);var tt=170;U("()",tt);var q=170;V("[]",q);c(".",q);V("()",q);var et=32,ot=d.space;d.comment??={"//":`
|
|
6
6
|
`,"/*":"*/"};var x;d.space=()=>{x||(x=Object.entries(d.comment).map(([i,p])=>[i,p,i.charCodeAt(0)]));for(var r;r=ot();){for(var t=0,e;e=x[t++];)if(r===e[2]&&l.substr(u,e[0].length)===e[0]){var o=u+e[0].length;if(e[1]===`
|
|
7
7
|
`)for(;l.charCodeAt(o)>=et;)o++;else{for(;l[o]&&l.substr(o,e[1].length)!==e[1];)o++;l[o]&&(o+=e[1].length)}M(o),r=0;break}if(r)return r}return r};var wr=80;c("===",wr);c("!==",wr);var nt=30;c("??",nt);var it=130,st=20;c("**",it,!0);c("**=",st,!0);var Ir=90;c("in",Ir);c("of",Ir);var pt=20,mt=100;c(">>>",mt);c(">>>=",pt,!0);var b=20;c("||=",b,!0);c("&&=",b,!0);c("??=",b,!0);P("true",!0);P("false",!1);P("null",null);D("undefined",200,()=>[]);P("NaN",NaN);P("Infinity",1/0);var rr=20;I("?",rr,(r,t,e)=>r&&(t=y(rr-1))&&L(o=>o===58)&&(e=y(rr-1),["?",r,t,e]));var ft=20;c("=>",ft,!0);var ut=20;k("...",ut);var kr=170;I("?.",kr,(r,t)=>{if(!r)return;let e=d.space();return e===40?(C(),["?.()",r,y(0,41)||null]):e===91?(C(),["?.[]",r,y(0,93)]):(t=y(kr),t?["?.",r,t]:void 0)});var B=140;k("typeof",B);k("void",B);k("delete",B);D("new",B,()=>pr(".target")?(C(7),["new.target"]):["new",y(B)]);var lt=20,vr=200;d.prop=r=>sr(r)!==58;U("[]",vr);U("{}",vr);c(":",lt-1,!0);var ct=170,H=96,dt=36,At=123,ht=92,gt={n:`
|
|
8
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Nr=()=>{let r=[];for(let t="",e;(e=l.charCodeAt(u))!==H;)e?e===ht?(C(),t+=gt[l[u]]||l[u],C()):e===dt&&l.charCodeAt(u+1)===At?(t&&r.push([,t]),t="",C(2),r.push(y(0,125))):(t+=l[u],C(),e=l.charCodeAt(u),e===H&&t&&r.push([,t])):v("Unterminated template");return C(),r},yt=w[H];w[H]=(r,t)=>r&&t<ct?d.asi&&d.newline?void 0:(C(),["``",r,...Nr()]):r?
|
|
8
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v"},Nr=()=>{let r=[];for(let t="",e;(e=l.charCodeAt(u))!==H;)e?e===ht?(C(),t+=gt[l[u]]||l[u],C()):e===dt&&l.charCodeAt(u+1)===At?(t&&r.push([,t]),t="",C(2),r.push(y(0,125))):(t+=l[u],C(),e=l.charCodeAt(u),e===H&&t&&r.push([,t])):v("Unterminated template");return C(),r},yt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Ct=w[H];w[H]=(r,t)=>r&&t<ct?d.asi&&d.newline?void 0:(C(),["``",r,...Nr()]):r?Ct?.(r,t):(C(),yt(Nr()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Rr=(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?Rr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Or={"=":(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 Or)s(r,(t,e)=>(e=n(e),Rr(t,(o,i,p)=>Or[r](o,i,e(p)))));s("!",r=>(r=n(r),t=>!r(t)));s("||",(r,t)=>(r=n(r),t=n(t),e=>r(e)||t(e)));s("&&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&&t(e)));s("~",r=>(r=n(r),t=>~r(t)));s("|",(r,t)=>(r=n(r),t=n(t),e=>r(e)|t(e)));s("&",(r,t)=>(r=n(r),t=n(t),e=>r(e)&t(e)));s("^",(r,t)=>(r=n(r),t=n(t),e=>r(e)^t(e)));s(">>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>t(e)));s("<<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<<t(e)));s(">",(r,t)=>(r=n(r),t=n(t),e=>r(e)>t(e)));s("<",(r,t)=>(r=n(r),t=n(t),e=>r(e)<t(e)));s(">=",(r,t)=>(r=n(r),t=n(t),e=>r(e)>=t(e)));s("<=",(r,t)=>(r=n(r),t=n(t),e=>r(e)<=t(e)));s("==",(r,t)=>(r=n(r),t=n(t),e=>r(e)==t(e)));s("!=",(r,t)=>(r=n(r),t=n(t),e=>r(e)!=t(e)));s("+",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)+t(e)):(r=n(r),e=>+r(e)));s("-",(r,t)=>t!==void 0?(r=n(r),t=n(t),e=>r(e)-t(e)):(r=n(r),e=>-r(e)));s("*",(r,t)=>(r=n(r),t=n(t),e=>r(e)*t(e)));s("/",(r,t)=>(r=n(r),t=n(t),e=>r(e)/t(e)));s("%",(r,t)=>(r=n(r),t=n(t),e=>r(e)%t(e)));var tr=(r,t,e,o)=>typeof r=="string"?i=>t(i,r):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o)):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i))):r[0]==="()"&&r.length===2?tr(r[1],t):(()=>{throw Error("Invalid increment target")})();s("++",(r,t)=>tr(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));s("--",(r,t)=>tr(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var Lr=(...r)=>(r=r.map(n),t=>{let e;for(let o of r)e=o(t);return e});s(",",Lr);s(";",Lr);var O=r=>r?.[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype",j=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=n(e[1]),o=>e(o)):(e=n(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&j("Missing index"),r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)[o]}));s(".",(r,t)=>(r=n(r),t=t[0]?t:t[1],O(t)?()=>{}:e=>r(e)[t]));s("()",(r,t)=>{if(t===void 0)return r==null?j("Empty ()"):n(r);let e=i=>i?.[0]===","&&i.slice(1).some(p=>p==null||e(p));e(t)&&j("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(p=>p(i))):(t=n(t),i=>[t(i)]):()=>[];return er(r,(i,p,m)=>i[p](...o(m)))});var N=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&N(r[1])||r[0]==="{}"),er=(r,t,e,o)=>r==null?j("Empty ()"):r[0]==="()"&&r.length==2?er(r[1],t):typeof r=="string"?i=>t(i,r,i):r[0]==="."?(e=n(r[1]),o=r[2],i=>t(e(i),o,i)):r[0]==="?."?(e=n(r[1]),o=r[2],i=>{let p=e(i);return p==null?void 0:t(p,o,i)}):r[0]==="[]"&&r.length===3?(e=n(r[1]),o=n(r[2]),i=>t(e(i),o(i),i)):r[0]==="?.[]"?(e=n(r[1]),o=n(r[2]),i=>{let p=e(i);return p==null?void 0:t(p,o(i),i)}):(r=n(r),i=>t([r(i)],0,i)),R=er;s("===",(r,t)=>(r=n(r),t=n(t),e=>r(e)===t(e)));s("!==",(r,t)=>(r=n(r),t=n(t),e=>r(e)!==t(e)));s("??",(r,t)=>(r=n(r),t=n(t),e=>r(e)??t(e)));var St=r=>{throw Error(r)};s("**",(r,t)=>(r=n(r),t=n(t),e=>r(e)**t(e)));s("**=",(r,t)=>(N(r)||St("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]**=t(i))));s("in",(r,t)=>(r=n(r),t=n(t),e=>r(e)in t(e)));var Et=r=>{throw Error(r)};s(">>>",(r,t)=>(r=n(r),t=n(t),e=>r(e)>>>t(e)));s(">>>=",(r,t)=>(N(r)||Et("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]>>>=t(i))));var wt=r=>r[0]?.[0]===","?r[0].slice(1):r,a=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...i]=r,p=wt(i);if(o==="{}"){let m=[];for(let f of p){if(Array.isArray(f)&&f[0]==="..."){let E={};for(let T in t)m.includes(T)||(E[T]=t[T]);e[f[1]]=E;break}let A,h,S;typeof f=="string"?A=h=f:f[0]==="="?(typeof f[1]=="string"?A=h=f[1]:[,A,h]=f[1],S=f[2]):[,A,h]=f,m.push(A);let g=t[A];g===void 0&&S&&(g=n(S)(e)),a(h,g,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,h;Array.isArray(f)&&f[0]==="="&&([,A,h]=f);let S=t[m++];S===void 0&&h&&(S=n(h)(e)),a(A,S,e)}}},or=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,i=n(o);return typeof e=="string"?p=>{p[e]=i(p)}:p=>a(e,i(p),p)}return n(t)}),t=>{for(let e of r)e(t)});s("let",or);s("const",or);s("var",or);var K=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=n(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>a(e,t(o),o)}return N(r)||K("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]=t(i))});s("||=",(r,t)=>(N(r)||K("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]||=t(i))));s("&&=",(r,t)=>(N(r)||K("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]&&=t(i))));s("??=",(r,t)=>(N(r)||K("Invalid assignment target"),t=n(t),R(r,(e,o,i)=>e[o]??=t(i))));s("?",(r,t,e)=>(r=n(r),t=n(t),e=n(e),o=>r(o)?t(o):e(o)));var It=[];s("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,i=null,p=e[e.length-1];Array.isArray(p)&&p[0]==="..."&&(o=e.length-1,i=p[1],e.length--);let m=t?.[0]==="{}";return t=n(m?["{",t[1]]:t),f=>(...A)=>{let h={};e.forEach((g,E)=>h[g]=A[E]),i&&(h[i]=A.slice(o));let S=new Proxy(h,{get:(g,E)=>E in g?g[E]:f?.[E],set:(g,E,T)=>((E in g?g:f)[E]=T,!0),has:(g,E)=>E in g||(f?E in f:!1)});try{let g=t(S);return m?void 0:g}catch(g){if(g===It)return g[0];throw g}}});s("...",r=>(r=n(r),t=>Object.entries(r(t))));s("?.",(r,t)=>(r=n(r),O(t)?()=>{}:e=>r(e)?.[t]));s("?.[]",(r,t)=>(r=n(r),t=n(t),e=>{let o=t(e);return O(o)?void 0:r(e)?.[o]}));s("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(n),i=>t.map(p=>p(i))):(t=n(t),i=>[t(i)]):()=>[];if(r[0]==="?."){let i=n(r[1]),p=r[2];return O(p)?()=>{}:m=>i(m)?.[p]?.(...e(m))}if(r[0]==="?.[]"){let i=n(r[1]),p=n(r[2]);return m=>{let f=i(m),A=p(m);return O(A)?void 0:f?.[A]?.(...e(m))}}if(r[0]==="."){let i=n(r[1]),p=r[2];return O(p)?()=>{}:m=>i(m)?.[p]?.(...e(m))}if(r[0]==="[]"&&r.length===3){let i=n(r[1]),p=n(r[2]);return m=>{let f=i(m),A=p(m);return O(A)?void 0:f?.[A]?.(...e(m))}}let o=n(r);return i=>o(i)?.(...e(i))});s("typeof",r=>(r=n(r),t=>typeof r(t)));s("void",r=>(r=n(r),t=>(r(t),void 0)));s("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});s("new",r=>{let t=n(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(i=>p=>i.map(m=>m(p)))(e.slice(1).map(n)):(i=>p=>[i(p)])(n(e)):()=>[];return i=>new(t(i))(...o(i))});var W=Symbol("accessor");s("get",(r,t)=>(t=t?n(t):()=>{},e=>[[W,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));s("set",(r,t,e)=>(e=e?n(e):()=>{},o=>[[W,r,{set:function(i){let p=Object.create(o||{});p.this=this,p[t]=i,e(p)}}]]));var kt=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);s("{}",(r,t)=>{if(t!==void 0)return;if(!kt(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={},p={};for(let m of e.flatMap(f=>f(o)))if(m[0]===W){let[,f,A]=m;p[f]={...p[f],...A,configurable:!0,enumerable:!0}}else i[m[0]]=m[1];for(let m in p)Object.defineProperty(i,m,p[m]);return i}});s("{",r=>(r=r?n(r):()=>{},t=>r(Object.create(t))));s(":",(r,t)=>(t=n(t),Array.isArray(r)?(r=n(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));s("`",(...r)=>(r=r.map(n),t=>r.map(e=>e(t)).join("")));s("``",(r,...t)=>{r=n(r);let e=[],o=[];for(let p of t)Array.isArray(p)&&p[0]===void 0?e.push(p[1]):o.push(n(p));let i=Object.assign([...e],{raw:e});return p=>r(p)(i,...o.map(m=>m(p)))});var Pr=new WeakMap,vt=(r,...t)=>typeof r=="string"?n(d(r)):Pr.get(r)||Pr.set(r,Nt(r,t)).get(r),Tr=57344,Nt=(r,t)=>{let e=r.reduce((p,m,f)=>p+(f?String.fromCharCode(Tr+f-1):"")+m,""),o=d(e),i=p=>{if(typeof p=="string"&&p.length===1){let m=p.charCodeAt(0)-Tr,f;if(m>=0&&m<t.length)return f=t[m],Ot(f)?f:[,f]}return Array.isArray(p)?p.map(i):p};return n(i(o))},Ot=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Rt=vt;export{V as access,c as binary,n as compile,l as cur,Rt as default,v as err,y as expr,U as group,Lt as id,u as idx,D as keyword,P as literal,ir as loc,w as lookup,J as nary,L as next,s as operator,z as operators,Pt as parens,d as parse,sr as peek,nr as prec,M as seek,C as skip,I as token,k as unary,pr as word};
|