subscript 10.8.3 → 10.8.5
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/op/logical.js +0 -1
- package/jessie.min.js +7 -7
- package/justin.min.js +4 -4
- package/package.json +1 -1
- package/parse.js +34 -23
- package/subscript.min.js +4 -4
package/feature/op/logical.js
CHANGED
package/jessie.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),o=t.pop(),n=m.slice(Math.max(0,e-40),e),p="\u032D",c=(m[e]||" ")+p,
|
|
3
|
-
${n}${c}${
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},ee=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,te=r=>{if(m.charCodeAt(r)!==oe)return;let e=m.charCodeAt(r+1);if(e===br||e===Zr&&m.charCodeAt(r+2)!==ne){let t=e===br?2:4,o=0,n;for(let p=0;p<t;p++){if((n=ee(m.charCodeAt(r+2+p)))<0)return;o=o*16+n}return[o,2+t]}if(e===Zr){let t=0,o=r+3,n;for(;(n=ee(m.charCodeAt(o)))>=0;)t=t*16+n,o++;if(o>r+3&&t<=1114111&&m.charCodeAt(o)===tt)return[t,o-r+1]}},it=()=>{let r=m.charCodeAt(
|
|
5
|
-
`,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=wt();){for(t in e=s.comment)if(r===t.charCodeAt(0)&&(t.length<2||m.charCodeAt(
|
|
6
|
-
`?n:n+o.length),r=0;break}if(r)return r}return r};var ce=80;
|
|
7
|
-
`;var Ge=32,Kr=10,go=59,Eo=125,De=91,Ke=40,or=v.asi??v[";"],So=s._baseSpace??=s.space,ko=s._baseStep??=s.step,Mr=r=>Array.isArray(r)||typeof r=="string",To=(v[";"]??5)+1,Dr=r=>Array.isArray(r)&&(v[r[0]]<=To||r[0]==="{}"&&Dr(r[1])),No=(r,e)=>{for(;(e=m.charCodeAt(r))<=Ge;){if(e===Kr)return!0;r++}return!1},Ro=(r=l,e)=>{for(;r-- >0&&(e=m.charCodeAt(r))<=Ge;)if(e===Kr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=l,r=So();e<l;)if(m.charCodeAt(e++)===Kr){s.newline=!0;break}if(r===go&&No(l+1)){k(l+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===Eo&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=or)return!1;if(r&&!Mr(r))return null;if(Mr(r)){let p=(t===De||t===Ke)&&Ro();if(s.semi||t===De&&(p||Dr(r))||t===Ke&&(Dr(r)||p&&e>=or))return Fe(r,e,o)??null}let n=s.newline;return ko(r,e,t,o)??(Mr(r)&&n?Fe(r,e,o)??null:null)};var Ur=0,Io=2e3,Fe=s.asi=(r,e,t,o,n)=>{if(e>=or||Ur>=Io)return;s.semi=!1;let p=l;Ur++;try{o=t(or-.5)}finally{Ur--}if(!(!o||l===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var He=(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?He(r[1],e):(()=>{throw Error("Invalid assignment target")})(),xe={"=":(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 xe)f(r,(e,t)=>(t=i(t),He(e,(o,n,p)=>xe[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 Fr=(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?Fr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Fr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Fr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var Qe=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",Qe);f(";",Qe);var Xe=r=>r!=null&&(typeof r=="object"||typeof r=="function"),M=r=>Xe(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Oo=r=>P(M(r));i.id=r=>r===void 0||Oo(r)?()=>{}:e=>e?.[r];var 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=M(e(t));return P(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=M(e[0]?e:e[1]),P(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?nr("Empty ()"):i(r);let t=p=>p?.[0]===","&&p.slice(1).some(c=>c==null||t(c));t(e)&&nr("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),p=>e.map(c=>c(p))):(e=i(e),p=>[e(p)]):()=>[],n=Hr(r);return n<0?()=>{}:xr(r,n?(p,c,u)=>(c=M(c),P(c)?void 0:p[c](...o(u))):(p,c,u)=>p[c](...o(u)))});var K=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&K(r[1])||r[0]==="{}"),xr=(r,e,t,o)=>r==null?nr("Empty ()"):r[0]==="()"&&r.length==2?xr(r[1],e):typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="?."?(t=i(r[1]),o=r[2],n=>{let p=t(n);return p==null?void 0:e(p,o,n)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="?.[]"?(t=i(r[1]),o=i(r[2]),n=>{let p=t(n);return p==null?void 0:e(p,o(n),n)}):(r=i(r),n=>e([r(n)],0,n)),Gr=r=>Xe(r)?1:P(r)?-1:0,Hr=(r,e=r?.[0],t=r?.[2])=>typeof r=="string"?Gr(r):e==="()"&&r.length==2?Hr(r[1]):e==="."||e==="?."?Gr(t):(e==="[]"||e==="?.[]")&&r.length===3?Array.isArray(t)&&t[0]==null?Gr(t[1]):1:0,x=(r,e,t=Hr(r))=>t<0?()=>{}:xr(r,t?(o,n,p)=>(n=M(n),P(n)?void 0:e(o,n,p)):e);f("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));f("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));f("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var _o=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(K(r)||_o("Invalid assignment target"),e=i(e),x(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 Po=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(K(r)||Po("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]>>>=e(n))));var Lo=r=>r[0]?.[0]===","?r[0].slice(1):r,H=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Lo(n);if(o==="{}"){let c=[];for(let u of p){if(Array.isArray(u)&&u[0]==="..."){let g={};for(let O in e)!c.includes(O)&&!P(O)&&(g[O]=e[O]);t[u[1]]=g;break}let d,y,I;typeof u=="string"?d=y=u:u[0]==="="?(typeof u[1]=="string"?d=y=u[1]:[,d,y]=u[1],I=u[2]):[,d,y]=u,c.push(d=M(d));let S=P(d)?void 0:e[d];S===void 0&&I&&(S=i(I)(t)),H(y,S,t)}}else if(o==="[]"){let c=0;for(let u of p){if(u===null){c++;continue}if(Array.isArray(u)&&u[0]==="..."){t[u[1]]=e.slice(c);break}let d=u,y;Array.isArray(u)&&u[0]==="="&&([,d,y]=u);let I=e[c++];I===void 0&&y&&(I=i(y)(t)),H(d,I,t)}}},Qr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,o]=e,n=i(o);return typeof t=="string"?p=>{p[t]=n(p)}:p=>H(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Qr);f("const",Qr);f("var",Qr);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=>H(t,e(o),o)}return K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]??=e(n))));f("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),o=>r(o)?e(o):t(o)));var B=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let c=e?.[0]==="{}";return e=i(c?["{",e[1]]:e),u=>(...d)=>{let y={};t.forEach((S,g)=>y[S]=d[g]),n&&(y[n]=d.slice(o));let I=new Proxy(y,{get:(S,g)=>g in S?S[g]:u?.[g],set:(S,g,O)=>((g in S?S:u)[g]=O,!0),has:(S,g)=>g in S||(u?g in u:!1)});try{let S=e(I);return c?void 0:S}catch(S){if(S===B)return S[0];throw S}}});f("...",r=>(r=i(r),e=>{let t=r(e),o=[];for(let n of Object.keys(t))P(n)||o.push([n,t[n]]);return o}));f("?.",(r,e)=>(r=i(r),e=M(e),P(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=r(t);if(o==null)return;let n=M(e(t));return P(n)?void 0:o[n]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="."||r[0]==="?."){let n=r[0]==="?.",p=i(r[1]),c=M(r[2]);return P(c)?()=>{}:n?u=>p(u)?.[c]?.(...t(u)):u=>p(u)[c]?.(...t(u))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",p=i(r[1]),c=i(r[2]);return u=>{let d=p(u);if(n&&d==null)return;let y=M(c(u));return P(y)?void 0:d[y]?.(...t(u))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(c=>c(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var 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 vo=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!vo(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let c of t.flatMap(u=>u(o)))if(c[0]===sr){let[,u,d]=c;p[u]={...p[u],...d,configurable:!0,enumerable:!0}}else n[c[0]]=c[1];for(let c in p)Object.defineProperty(n,c,p[c]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(c=>c(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,c=o[o.length-1];return Array.isArray(c)&&c[0]==="..."&&(p=o.length-1,n=c[1],o.length--),u=>{let d=(...y)=>{let I={};o.forEach((g,O)=>I[g]=y[O]),n&&(I[n]=y.slice(p));let S=new Proxy(I,{get:(g,O)=>O in g?g[O]:u[O],set:(g,O,We)=>((O in g?g:u)[O]=We,!0),has:(g,O)=>O in g||O in u});try{return t(S)}catch(g){if(g===B)return g[0];throw g}};return r&&(u[r]=d),d}});f("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});f("async",r=>{let e=i(r);return t=>{let o=e(t);return async function(...n){return o(...n)}}});f("await",r=>(r=i(r),async e=>await r(e)));f("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));f("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var Bo=Symbol("static"),Mo=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?.(o),p=function(...c){if(!(this instanceof p))return Mo("Class constructor must be called with new");let u=e?Reflect.construct(n,c,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(u,c),u};if(e&&(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n)),t){let c=Object.create(o);e&&(c.super=n);let u=t(c),d=Array.isArray(u)&&typeof u[0]?.[0]=="string"?u:[];for(let[y,I]of d)y==="constructor"?p.prototype.__constructor__=I:p.prototype[y]=I}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[Bo,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 F=Symbol("break"),Q=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===F)break;if(n===Q)continue;if(n===B)return n[0];throw n}return o}));f("do",(r,e)=>(r=i(r),e=i(e),t=>{let o;do try{o=r(t)}catch(n){if(n===F)break;if(n===Q)continue;if(n===B)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let c;for(t?.(p);o(p);n?.(p))try{c=e(p)}catch(u){if(u===F)break;if(u===Q)continue;if(u===B)return u[0];throw u}return c}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return Do(o,n,e);if(t==="of")return Uo(o,n,e)}});var Uo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let u of e(n)){o?H(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===F)break;if(d===Q)continue;if(d===B)return d[0];throw d}}return o||(n[r]=c),p}},Do=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let u in e(n)){o?H(r,u,n):n[r]=u;try{p=t(n)}catch(d){if(d===F)break;if(d===Q)continue;if(d===B)return d[0];throw d}}return o||(n[r]=c),p}};f("break",()=>()=>{throw F});f("continue",()=>()=>{throw Q});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw B[0]=r?.(e),B}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(u=>u?.[0]==="catch"),o=e.find(u=>u?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,c=o?.[1]?i(o[1]):null;return u=>{let d;try{d=r?.(u)}catch(y){if(y===F||y===Q||y===B)throw y;if(n!=null&&p){let I=n in u,S=u[n];u[n]=y;try{d=p(u)}finally{I?u[n]=S:delete u[n]}}else if(!p)throw y}finally{c?.(u)}return d}});f("throw",r=>(r=i(r),e=>{throw r(e)}));f("switch",(r,...e)=>(r=i(r),e.length?(e=e.map(t=>[t[0]==="case"?i(t[1]):null,(t[0]==="case"?t[2]:t[1])?.[0]===";"?(t[0]==="case"?t[2]:t[1]).slice(1).map(i):(t[0]==="case"?t[2]:t[1])?[i(t[0]==="case"?t[2]:t[1])]:[]]),t=>{let o=r(t),n=!1,p;for(let[u,d]of e)if(n||u===null||u(t)===o)for(n=!0,c=0;c<d.length;c++)try{p=d[c](t)}catch(y){if(y===F)return p;throw y}var c;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var je=new WeakMap,Ko=(r,...e)=>typeof r=="string"?i(s(r)):je.get(r)||je.set(r,Fo(r,e)).get(r),$e=57344,Fo=(r,e)=>{let t=r.reduce((p,c,u)=>p+(u?String.fromCharCode($e+u-1):"")+c,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let c=p.charCodeAt(0)-$e,u;if(c>=0&&c<e.length)return u=e[c],Go(u)?u:[,u]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Go=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),xo=Ko;export{lr as access,A as binary,i as compile,m as cur,xo as default,R as err,a as expr,z as group,Ho as id,l as idx,w as keyword,$ as literal,qe as loc,N as lookup,jr as member,fr as nary,T as next,f as operator,pr as operators,L as parens,s as parse,U as peek,v as prec,ur as propName,k as seek,h as skip,C as token,_ as unary,E as word};
|
|
1
|
+
var u,m,s=r=>(u=0,m=r,s.enter?.(),r=a(),m[u]?I():r||""),I=(r="Unexpected token",e=u,t=m.slice(0,e).split(`
|
|
2
|
+
`),o=t.pop(),n=m.slice(Math.max(0,e-40),e),p="\u032D",c=(m[e]||" ")+p,l=m.slice(e+1,e+20))=>{throw SyntaxError(`${r} at ${t.length+1}:${o.length+1}
|
|
3
|
+
${n}${c}${l}`)},qe=(r,e=u)=>(Array.isArray(r)&&(r.loc=e),r),N=(r,e=u,t)=>{for(;t=r(m.charCodeAt(u));)u+=t;return m.slice(e,u)},d=(r=1)=>m[u+=r],T=r=>u=r,a=(r=0,e)=>{let t,o,n;for(e&&s.enter?.(r,e);(t=s.space())&&t!==e&&(n=s.step(o,r,t,a));)o=n;return e&&(t==e?(u++,s.exit?.(r,e)):I("Unclosed "+String.fromCharCode(e-(e>42?2:1)))),o},U=(r=u)=>{for(;m.charCodeAt(r)<=32;)r++;return m.charCodeAt(r)},Ho=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)=>m.substr(u,e)===r&&!s.id(m.charCodeAt(u+e)),L=()=>(d(),a(0,41)),R=[],v={},E=(r,e=32,t,o=r.charCodeAt(0))=>$r({op:r,l:r.length,p:v[r]=!R[o]&&v[r]||e,map:t,word:r.toUpperCase()!==r,kw:!1}),h=(r,e,t=!1)=>E(r,e,(o,n)=>o&&(n=a(e-(t?.5:0)))&&[r,o,n]),_=(r,e,t)=>E(r,e,o=>t?o&&[r,o]:!o&&(o=a(e-.5))&&[r,o]),$=(r,e)=>E(r,200,t=>!t&&[,e]),fr=(r,e,t,o)=>E(r,e,(n,p,c=n)=>(p=a(e-(t?.5:0)),n?.[0]!==r&&(n=[r,n||null]),p?.[0]===r?n.push(...p.slice(1)):p?n.push(p):o||U()===r.charCodeAt(0)?n.push(null):c&&n.length===2&&(n=n[1]),n)),z=(r,e)=>E(r[0],e,t=>!t&&[r,a(0,r.charCodeAt(1))||null]),lr=(r,e)=>E(r[0],e,t=>t&&[r,t,a(0,r.charCodeAt(1))||null]),ur=(r,e)=>(s.space(),e=m.charCodeAt(u),s.id(e)&&(e<48||e>57)?N(s.id):a(r)),jr=(r,e)=>E(r,e,(t,o)=>t&&(o=ur(e))&&[r,t,o]),y=(r,e,t)=>(v[r]??=e,$r({op:r,l:r.length,p:e,map:t,word:!0,kw:!0})),Xr=(r,e,t=[],o=r.filter(p=>p.l<2),n=(p,c,l,A=u,w,C,S,g=t[m.charCodeAt(u+1)]||o)=>{for(S=0;C=g[S++];)if(!(C.kw&&p)&&!(l?C.op!==l:!((C.l<3||m.substr(u,C.l)===C.op)&&(!C.word||!s.id(m.charCodeAt(u+C.l)))&&(l=C.op)))&&!(c>=C.p)&&!(C.kw&&s.prop&&!s.prop(u+C.l))){if(u+=C.l,w=C.map(p))return qe(w,A);u=A,l=0,C.word||p||e||g[S]||I()}return e?.(p,c,l)})=>{for(let p of r)p.l>1&&(t[p.op.charCodeAt(1)]||=[]).push(p);return t.forEach(p=>p.push(...o)),n.ops=r,n.tail=e,n},$r=(r,e=r.op.charCodeAt(0),t=R[e])=>R[e]=t?.ops?Xr([r,...t.ops].sort((o,n)=>n.l-o.l),t.tail):Xr([r],t);s.space=r=>{for(;(r=m.charCodeAt(u))<=32;)u++;return r};s.step=(r,e,t,o,n)=>(n=R[t])&&n(r,e)||(r?null:N(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))??I(`Unknown operator: ${r[0]}`,r?.loc):i.id(r);i.id=r=>r===void 0?()=>{}:e=>e?.[r];var cr=46,X=48,W=57,Wr=69,qr=101,ze=43,Je=45,zr=95,Ve=97,Ye=102,Ze=65,be=70,Jr=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),rt=r=>r===cr&&(r=m.charCodeAt(u+1))!==cr&&!(s.id(r)&&r>W&&r!==qr&&r!==Wr)||r>=X&&r<=W||r===zr||((r===Wr||r===qr)&&((r=m.charCodeAt(u+1))>=X&&r<=W||r===ze||r===Je)?2:0),mr=r=>(r=+Jr(N(rt)))!=r?I():[,r],et=r=>e=>e===zr||e>=X&&e<=W&&e-X<r||r===16&&(e>=Ve&&e<=Ye||e>=Ze&&e<=be);s.number=null;R[cr]=r=>!r&&m.charCodeAt(u+1)>=X&&m.charCodeAt(u+1)<=W&&mr();for(let r=X;r<=W;r++)R[r]=e=>e?void 0:mr();R[X]=(r,e)=>{if(!r){for(let t in s.number)if(t[0]==="0"&&(m.charCodeAt(u+1)|32)===t.charCodeAt(1)){d(2);let o=Jr(N(et(e=s.number[t])));return[,parseInt(o,e)]}return mr()}};var oe=92,Vr=34,Yr=39,Zr=117,br=120,ne=123,tt=125,re=10,ot=13,nt={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},ee=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,te=r=>{if(m.charCodeAt(r)!==oe)return;let e=m.charCodeAt(r+1);if(e===br||e===Zr&&m.charCodeAt(r+2)!==ne){let t=e===br?2:4,o=0,n;for(let p=0;p<t;p++){if((n=ee(m.charCodeAt(r+2+p)))<0)return;o=o*16+n}return[o,2+t]}if(e===Zr){let t=0,o=r+3,n;for(;(n=ee(m.charCodeAt(o)))>=0;)t=t*16+n,o++;if(o>r+3&&t<=1114111&&m.charCodeAt(o)===tt)return[t,o-r+1]}},it=()=>{let r=m.charCodeAt(u+1);if(r===re)return["",2];if(r===ot)return["",m.charCodeAt(u+2)===re?3:2];let e=te(u);if(e){let[t,o]=e;if(t>=55296&&t<=56319){let n=te(u+o);n&&n[0]>=56320&&n[0]<=57343&&(t=65536+(t-55296)*1024+n[0]-56320,o+=n[1])}return[String.fromCodePoint(t),o]}return[nt[m[u+1]]||m[u+1],2]},ar=(r,e=!1)=>{let t=u,o,n;for(;(n=m.charCodeAt(u))-r&&!(e&&(n===0||n===36&&m.charCodeAt(u+1)===ne));){if(n!==oe){d();continue}o||(o=[]),o.push(m.slice(t,u));let[c,l]=it();o.push(c),d(l),t=u}let p=m.slice(t,u);return o?(o.push(p),o.join("")):p},ie=r=>(e,t,o="",n=String.fromCharCode(r))=>{if(!(e||!s.string?.[n]))return d(),o+=ar(r),m[u]===n?d():I("Bad string"),[,o]};R[Vr]=ie(Vr);R[Yr]=ie(Yr);s.string={'"':!0};var st=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>h(r,st,!0));var pt=30,ft=40,lt=140;_("!",lt);h("||",pt);h("&&",ft);var ut=50,ct=60,mt=70,se=100,at=140;h("|",ut);h("&",mt);h("^",ct);h(">>",se);h("<<",se);_("~",at);var Y=90;h("<",Y);h(">",Y);h("<=",Y);h(">=",Y);var pe=80;h("==",pe);h("!=",pe);var fe=110,dr=120,le=140;h("+",fe);h("-",fe);h("*",dr);h("/",dr);h("%",dr);_("+",le);_("-",le);var Z=150;E("++",Z,r=>r?["++",r,null]:["++",a(Z-1)]);E("--",Z,r=>r?["--",r,null]:["--",a(Z-1)]);var dt=5,ht=10;fr(",",ht);fr(";",dt,!0,!0);var At=170;z("()",At);var ue=170,yt=160;lr("[]",ue);jr(".",ue);lr("()",yt);var wt=s.space;s.comment??={"//":`
|
|
5
|
+
`,"/*":"*/"};s.space=()=>{for(var r,e,t,o,n;r=wt();){for(t in e=s.comment)if(r===t.charCodeAt(0)&&(t.length<2||m.charCodeAt(u+1)===t.charCodeAt(1))&&(t.length<3||m.substr(u,t.length)===t)){o=e[t],n=m.indexOf(o,u+t.length),T(n<0?m.length:o===`
|
|
6
|
+
`?n:n+o.length),r=0;break}if(r)return r}return r};var ce=80;h("===",ce);h("!==",ce);var Ct=30;h("??",Ct);var gt=130,Et=20;h("**",gt,!0);h("**=",Et,!0);var St=90;h("in",St);var kt=20,Tt=100;h(">>>",Tt);h(">>>=",kt,!0);var hr=20;h("||=",hr,!0);h("&&=",hr,!0);h("??=",hr,!0);$("true",!0);$("false",!1);$("null",null);y("undefined",200,()=>[]);$("NaN",NaN);$("Infinity",1/0);var Ar=20;E("?",Ar,(r,e,t)=>r&&(e=a(Ar-1))&&N(o=>o===58)&&(t=a(Ar-1),["?",r,e,t]));var Nt=20;h("=>",Nt,!0);var Rt=20;_("...",Rt);var me=170;E("?.",me,(r,e)=>{if(!r)return;let t=s.space();return t===40?(d(),["?.()",r,a(0,41)||null]):t===91?(d(),["?.[]",r,a(0,93)]):(e=ur(me),e?["?.",r,e]:void 0)});var yr=140,ae=160,It=ae+1;_("typeof",yr);_("void",yr);_("delete",yr);var Ot=r=>s.space()===40?(d(),["()",r,a(0,41)||null]):r;y("new",It,()=>k(".target")?(d(7),["new.target"]):["new",Ot(a(ae))]);var _t=20,de=200;s.prop=r=>U(r)!==58;z("[]",de);z("{}",de);h(":",_t-1,!0);var Pt=170,b=96,Lt=36,vt=123,he=()=>{let r=[];for(;;){r.push([,ar(b,!0)]);let e=m.charCodeAt(u);if(e===b)return d(),r;(e!==Lt||m.charCodeAt(u+1)!==vt)&&I("Unterminated template"),d(2),r.push(a(0,125))}},Bt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Mt=R[b];R[b]=(r,e)=>r&&e<Pt?s.asi&&s.newline?void 0:(d(),["``",r,...he()]):r?Mt?.(r,e):(d(),Bt(he()));s.string["'"]=!0;s.number={"0x":16,"0b":2,"0o":8};var Ut=92,Dt=117,Kt=123,Ft=125,Gt=183,xt=s.id,Ae=r=>r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102,Ht=(r=u+2,e,t=0,o=0)=>{if(m.charCodeAt(u)!==Ut||m.charCodeAt(u+1)!==Dt)return 0;if(m.charCodeAt(r)===Kt){for(;Ae(e=m.charCodeAt(++r));)t=t*16+(e<=57?e-48:(e&31)+9);return r>u+3&&t<=1114111&&m.charCodeAt(r)===Ft?r-u+1:0}for(;o<4&&Ae(m.charCodeAt(r+o));)o++;return o===4?6:0};s.id=r=>xt(r)||r===Gt||Ht();var wr=5,we=10,Cr=r=>{let e=u,t=a(we-1);return t==null?r:r==="let"&&(t==="in"||t==="of")?(T(e),r):t[0]===","?[r,...t.slice(1)]:[r,t]};y("let",wr+1,()=>Cr("let"));y("const",wr+1,()=>Cr("const"));y("var",wr+1,()=>Cr("var"));var ye=r=>Array.isArray(r)&&r[0]==="="&&typeof r[1]=="string";y("using",200,()=>{let r=u;s.space();let e=m.charCodeAt(u);if(s.id(e)&&(e<48||e>57)){let t=u;if(N(s.id),s.space(),m.charCodeAt(u)===61&&m.charCodeAt(u+1)!==61&&m.charCodeAt(u+1)!==62){T(t);let o=a(we-1);if(o[0]===","?o.slice(1).every(ye):ye(o))return o[0]===","?["using",...o.slice(1)]:["using",o]}}return T(r),"using"});var rr=5,Qt=59,D=()=>(s.space()===123||I("Expected {"),d(),a(rr-.5,125)||null),G=()=>s.space()!==123?a(rr+.5):(d(),a(rr-.5,125)||null),gr=(r,e=u)=>(s.space()===Qt&&d(),s.space(),k(r)?(d(r.length),s.semi=!1,!0):(T(e),!1));y("if",rr+1,()=>{s.space();let r=["if",L(),G()];return gr("else")&&r.push(G()),r});var Xt=200;y("function",Xt,()=>{s.space();let r=!1;m[u]==="*"&&(r=!0,d(),s.space());let e=N(s.id);return e&&s.space(),r?["function*",e,L()||null,D()]:["function",e,L()||null,D()]});var Ce=200,Sr=140,Er=20,ge=40;_("await",Sr);var jt=10,$t=13,Ee=r=>{let e;for(;(e=m.charCodeAt(r))<=32;){if(e===jt||e===$t)return!0;r++}return!1};y("yield",Sr,()=>Ee(u)?["yield"]:(s.space(),m[u]==="*"?(d(),s.space(),["yield*",a(Er)]):["yield",a(Er)]));y("async",Ce,()=>{if(Ee(u))return;if(s.space(),k("function"))return["async",a(Sr)];let r=u,e=a(Ce-.5);if(e?.[0]===":")return[":",e[1],["async",e[2]]];if(e&&U()===ge)return["async",e];if((e||U()===ge)&&(T(r),e=a(Er-.5))?.[0]==="=>")return["async",e]});var Se=200;var Wt=90,qt=175,zt=160,Jt=zt-.5;_("static",qt);h("instanceof",Wt);E("#",Se,r=>{if(r)return;let e=N(s.id);return e?"#"+e:void 0});y("class",Se,()=>{s.space();let r=N(s.id)||null;if(r==="extends")r=null,s.space();else{if(s.space(),!k("extends"))return["class",r,null,D()];d(7),s.space()}return["class",r,a(Jt),D()]});var kr=47,Vt=92,Yt=91,Zt=93;E("/",140,r=>{let e=m.charCodeAt(u);if(r||e===kr||e===42||e===43||e===63)return;let t=!1,o=N(p=>p===Vt?2:p===Yt?(t=!0,1):p===Zt?(t=!1,1):p&&(t||p!==kr));m.charCodeAt(u)===kr||I("Unterminated regex"),d();let n=N(p=>p===103||p===105||p===109||p===115||p===117||p===121);return n?["//",o,n]:["//",o]});var j=5,J=125,V=59,ke=90,Tr=0;E("of",ke,(r,e)=>Tr&&r&&(e=a(ke))&&["of",r,e]);y("while",j+1,()=>(s.space(),["while",L(),G()]));y("do",j+1,r=>(r=G(),gr("while")||I("Expected while"),s.space(),r=["do",r,L()],s.asi&&(s.newline=!0),r));var Te={let:1,const:1,var:1},Re=(r,e=r,t)=>{if(Te[r?.[0]]&&Array.isArray(r[1]))return(e=Re(r[1]))?.[0]==="in"||e?.[0]==="of"?[e[0],[r[0],e[1]],r.length>2?[",",e[2],...r.slice(2)]:e[2]]:r;for(;Array.isArray(e)&&v[e[0]]<v.in&&!Te[e[0]];)t=e,e=e[1];return t&&Array.isArray(e)&&(e[0]==="in"||e[0]==="of")?(t[1]=e[2],[e[0],e[1],r]):r},Ne=()=>{Tr++;try{return Re(L())}finally{Tr--}};y("for",j+1,()=>(s.space(),k("await")?(d(5),s.space(),["for await",Ne(),G()]):["for",Ne(),G()]));y("break",j+1,()=>{s.asi&&(s.newline=!1);let r=u,e=s.space();if(!e||e===J||e===V||s.newline)return["break"];let t=N(s.id);if(!t)return["break"];let o=s.space();return!o||o===J||o===V||s.newline?["break",t]:(T(r),["break"])});y("continue",j+1,()=>{s.asi&&(s.newline=!1);let r=u,e=s.space();if(!e||e===J||e===V||s.newline)return["continue"];let t=N(s.id);if(!t)return["continue"];let o=s.space();return!o||o===J||o===V||s.newline?["continue",t]:(T(r),["continue"])});y("return",j+1,()=>{s.asi&&(s.newline=!1);let r=s.space();return!r||r===J||r===V||s.newline?["return"]:["return",a(j)]});var Nr=5;y("try",Nr+1,()=>{let r=["try",D()];return s.space(),k("catch")&&(d(5),s.space(),r.push(["catch",U()===40?L():null,D()])),s.space(),k("finally")&&(d(7),r.push(["finally",D()])),r});y("throw",Nr+1,()=>{if(s.asi&&(s.newline=!1),s.space(),s.newline)throw SyntaxError("Unexpected newline after throw");return["throw",a(Nr)]});var _e=5,bt=20,Ie=58,ro=59,Rr=125,Ir=0,Pe=(r,e=r.length,t=r.charCodeAt(0),o=R[t])=>R[t]=(n,p,c)=>k(r)&&!n&&Ir&&(!s.prop||s.prop(u+e))||o?.(n,p,c);Pe("case");Pe("default");var Oe=r=>{let e=[];for(;(r=s.space())!==Rr&&!k("case")&&!k("default");){if(r===ro){d();continue}s.semi=!1,e.push(a(_e+.5))||I()}return e.length>1?[";",...e]:e[0]||null},eo=()=>{s.space()===123||I("Expected {"),d(),Ir++;let r=[];try{for(;s.space()!==Rr;)if(k("case")){T(u+4),s.space(),s.semi=!1;let e=a(bt-.5);s.space()===Ie&&d(),r.push(["case",e,Oe()])}else k("default")?(T(u+7),s.space()===Ie&&d(),r.push(["default",Oe()])):I("Expected case or default")}finally{Ir--}return d(),s.exit?.(0,Rr),r};y("switch",_e+1,()=>s.space()===40&&["switch",L(),...eo()]);var Or=5,to=20;y("debugger",Or+1,()=>["debugger"]);y("with",Or+1,()=>(s.space(),["with",L(),G()]));var oo=["if","for","while","do","switch","try"];E(":",to-1,r=>typeof r=="string"&&(s.space(),oo.some(e=>k(e)))&&[":",r,a(Or)]);var _r=5,q=10,Le=42,no=34,io=39,ve=(r=U())=>r===no||r===io,so=(r=U())=>ve(r)||s.id(r),po=R[Le];R[Le]=(r,e)=>r?po?.(r,e):(d(),"*");E("from",q+1,r=>r?r[0]!=="="&&r[0]!==","&&ve()&&(s.space(),["from",r,a(q+1)]):!1);E("as",q+2,r=>r?so()&&(s.space(),["as",r,a(q+2)]):!1);y("import",_r,()=>k(".meta")?(d(5),["import.meta"]):["import",a(q)]);y("export",_r,()=>(s.space(),k("default")?(d(7),["export",["default",a(q)]]):["export",a(_r)]));var fo=20,er=200,lo=10,uo=13,co=34,mo=35,ao=39,Be=40,Lr=41,ho=91,vr=123,Br=125,Ao=(r,e)=>{for(;r<e;){let t=m.charCodeAt(r++);if(t===lo||t===uo)return!0}return!1},yo=r=>r===co||r===ao||r===ho||r===mo,Me=()=>N(s.id)||(yo(m.charCodeAt(u))?a(er-.5):null),wo=r=>typeof r=="string"||Array.isArray(r)&&(r[0]===void 0||r[0]==="[]"),tr=r=>e=>{let t=s.newline,o=s.semi,n=r(e);return n||(s.newline=t,s.semi=o),n},Ue=r=>e=>{if(e)return;let t=u;if(s.space(),s.semi||Ao(t,u))return!1;let o=Me();if(!o||(s.space(),m.charCodeAt(u)!==Be))return!1;d();let n=a(0,Lr);return s.space(),m.charCodeAt(u)!==vr?!1:(d(),[r,o,n,a(0,Br)])};E("get",er,tr(Ue("get")));E("set",er,tr(Ue("set")));var Pr=r=>r==null||typeof r=="string"||Array.isArray(r)&&(r[0]===","?r.slice(1).every(Pr):r[0]==="="?typeof r[1]=="string"||Pr(r[1]):r[0]==="..."||r[0]==="{}"||r[0]==="[]"),Co=v["*"];E("*",er,tr(r=>{let e=r&&s.newline;if(r&&!e)return;let t=u,o=Me();if(!o)return r?(T(t),void 0):!1;if(s.space(),m.charCodeAt(u)!==Be)return r?(T(t),void 0):!1;d();let n=a(0,Lr)||null;if(r&&!Pr(n))return T(t),void 0;if(s.space(),m.charCodeAt(u)!==vr)return r?(T(t),void 0):!1;d();let p=[":",o,["function*",null,n,a(0,Br)||null]];return r?r[0]===";"?(r.push(p),r):[";",r,p]:p}));v["*"]=Co;E("(",fo-1,tr(r=>{if(!r)return;let e,t;if(Array.isArray(r)&&r[0]==="static"&&(e="static",r=r[1]),Array.isArray(r)&&r[0]==="async"&&(t=!0,r=r[1]),!wo(r))return;let o=a(0,Lr)||null;if(s.space(),m.charCodeAt(u)!==vr)return;d();let n=["function",null,o,a(0,Br)||null];t&&(n=["async",n]);let p=[":",r,n];return e?[e,p]:p}));s.comment["#!"]=`
|
|
7
|
+
`;var Ge=32,Kr=10,go=59,Eo=125,De=91,Ke=40,or=v.asi??v[";"],So=s._baseSpace??=s.space,ko=s._baseStep??=s.step,Mr=r=>Array.isArray(r)||typeof r=="string",To=(v[";"]??5)+1,Dr=r=>Array.isArray(r)&&(v[r[0]]<=To||r[0]==="{}"&&Dr(r[1])),No=(r,e)=>{for(;(e=m.charCodeAt(r))<=Ge;){if(e===Kr)return!0;r++}return!1},Ro=(r=u,e)=>{for(;r-- >0&&(e=m.charCodeAt(r))<=Ge;)if(e===Kr)return!0;return!1};s.space=(r,e)=>{for(;;){for(e=u,r=So();e<u;)if(m.charCodeAt(e++)===Kr){s.newline=!0;break}if(r===go&&No(u+1)){T(u+1),s.newline=s.semi=!0;continue}return r}};s.enter=()=>s.newline=s.semi=!1;s.exit=(r,e)=>{e===Eo&&(s.newline=!0,s.semi=!1)};s.step=(r,e,t,o)=>{if(s.semi&&e>=or)return!1;if(r&&!Mr(r))return null;if(Mr(r)){let p=(t===De||t===Ke)&&Ro();if(s.semi||t===De&&(p||Dr(r))||t===Ke&&(Dr(r)||p&&e>=or))return Fe(r,e,o)??null}let n=s.newline;return ko(r,e,t,o)??(Mr(r)&&n?Fe(r,e,o)??null:null)};var Ur=0,Io=2e3,Fe=s.asi=(r,e,t,o,n)=>{if(e>=or||Ur>=Io)return;s.semi=!1;let p=u;Ur++;try{o=t(or-.5)}finally{Ur--}if(!(!o||u===p))return n=o?.[0]===";"?o.slice(1):[o],r?.[0]===";"?(r.push(...n),r):[";",r,...n]};var He=(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?He(r[1],e):(()=>{throw Error("Invalid assignment target")})(),xe={"=":(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 xe)f(r,(e,t)=>(t=i(t),He(e,(o,n,p)=>xe[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 Fr=(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?Fr(r[1],e):(()=>{throw Error("Invalid increment target")})();f("++",(r,e)=>Fr(r,e===null?(t,o)=>t[o]++:(t,o)=>++t[o]));f("--",(r,e)=>Fr(r,e===null?(t,o)=>t[o]--:(t,o)=>--t[o]));var Qe=(...r)=>(r=r.map(i),e=>{let t;for(let o of r)t=o(e);return t});f(",",Qe);f(";",Qe);var Xe=r=>r!=null&&(typeof r=="object"||typeof r=="function"),M=r=>Xe(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Oo=r=>P(M(r));i.id=r=>r===void 0||Oo(r)?()=>{}:e=>e?.[r];var 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=M(e(t));return P(o)?void 0:r(t)[o]}));f(".",(r,e)=>(r=i(r),e=M(e[0]?e:e[1]),P(e)?()=>{}:t=>r(t)[e]));f("()",(r,e)=>{if(e===void 0)return r==null?nr("Empty ()"):i(r);let t=p=>p?.[0]===","&&p.slice(1).some(c=>c==null||t(c));t(e)&&nr("Empty argument");let o=e?e[0]===","?(e=e.slice(1).map(i),p=>e.map(c=>c(p))):(e=i(e),p=>[e(p)]):()=>[],n=Hr(r);return n<0?()=>{}:xr(r,n?(p,c,l)=>(c=M(c),P(c)?void 0:p[c](...o(l))):(p,c,l)=>p[c](...o(l)))});var K=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&K(r[1])||r[0]==="{}"),xr=(r,e,t,o)=>r==null?nr("Empty ()"):r[0]==="()"&&r.length==2?xr(r[1],e):typeof r=="string"?n=>e(n,r,n):r[0]==="."?(t=i(r[1]),o=r[2],n=>e(t(n),o,n)):r[0]==="?."?(t=i(r[1]),o=r[2],n=>{let p=t(n);return p==null?void 0:e(p,o,n)}):r[0]==="[]"&&r.length===3?(t=i(r[1]),o=i(r[2]),n=>e(t(n),o(n),n)):r[0]==="?.[]"?(t=i(r[1]),o=i(r[2]),n=>{let p=t(n);return p==null?void 0:e(p,o(n),n)}):(r=i(r),n=>e([r(n)],0,n)),Gr=r=>Xe(r)?1:P(r)?-1:0,Hr=(r,e=r?.[0],t=r?.[2])=>typeof r=="string"?Gr(r):e==="()"&&r.length==2?Hr(r[1]):e==="."||e==="?."?Gr(t):(e==="[]"||e==="?.[]")&&r.length===3?Array.isArray(t)&&t[0]==null?Gr(t[1]):1:0,x=(r,e,t=Hr(r))=>t<0?()=>{}:xr(r,t?(o,n,p)=>(n=M(n),P(n)?void 0:e(o,n,p)):e);f("===",(r,e)=>(r=i(r),e=i(e),t=>r(t)===e(t)));f("!==",(r,e)=>(r=i(r),e=i(e),t=>r(t)!==e(t)));f("??",(r,e)=>(r=i(r),e=i(e),t=>r(t)??e(t)));var _o=r=>{throw Error(r)};f("**",(r,e)=>(r=i(r),e=i(e),t=>r(t)**e(t)));f("**=",(r,e)=>(K(r)||_o("Invalid assignment target"),e=i(e),x(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 Po=r=>{throw Error(r)};f(">>>",(r,e)=>(r=i(r),e=i(e),t=>r(t)>>>e(t)));f(">>>=",(r,e)=>(K(r)||Po("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]>>>=e(n))));var Lo=r=>r[0]?.[0]===","?r[0].slice(1):r,H=(r,e,t)=>{if(typeof r=="string"){t[r]=e;return}let[o,...n]=r,p=Lo(n);if(o==="{}"){let c=[];for(let l of p){if(Array.isArray(l)&&l[0]==="..."){let g={};for(let O in e)!c.includes(O)&&!P(O)&&(g[O]=e[O]);t[l[1]]=g;break}let A,w,C;typeof l=="string"?A=w=l:l[0]==="="?(typeof l[1]=="string"?A=w=l[1]:[,A,w]=l[1],C=l[2]):[,A,w]=l,c.push(A=M(A));let S=P(A)?void 0:e[A];S===void 0&&C&&(S=i(C)(t)),H(w,S,t)}}else if(o==="[]"){let c=0;for(let l of p){if(l===null){c++;continue}if(Array.isArray(l)&&l[0]==="..."){t[l[1]]=e.slice(c);break}let A=l,w;Array.isArray(l)&&l[0]==="="&&([,A,w]=l);let C=e[c++];C===void 0&&w&&(C=i(w)(t)),H(A,C,t)}}},Qr=(...r)=>(r=r.map(e=>{if(typeof e=="string")return t=>{t[e]=void 0};if(e[0]==="="){let[,t,o]=e,n=i(o);return typeof t=="string"?p=>{p[t]=n(p)}:p=>H(t,n(p),p)}return i(e)}),e=>{for(let t of r)t(e)});f("let",Qr);f("const",Qr);f("var",Qr);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=>H(t,e(o),o)}return K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]=e(n))});f("||=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]||=e(n))));f("&&=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]&&=e(n))));f("??=",(r,e)=>(K(r)||ir("Invalid assignment target"),e=i(e),x(r,(t,o,n)=>t[o]??=e(n))));f("?",(r,e,t)=>(r=i(r),e=i(e),t=i(t),o=>r(o)?e(o):t(o)));var B=[];f("=>",(r,e)=>{r=r?.[0]==="()"?r[1]:r;let t=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,p=t[t.length-1];Array.isArray(p)&&p[0]==="..."&&(o=t.length-1,n=p[1],t.length--);let c=e?.[0]==="{}";return e=i(c?["{",e[1]]:e),l=>(...A)=>{let w={};t.forEach((S,g)=>w[S]=A[g]),n&&(w[n]=A.slice(o));let C=new Proxy(w,{get:(S,g)=>g in S?S[g]:l?.[g],set:(S,g,O)=>((g in S?S:l)[g]=O,!0),has:(S,g)=>g in S||(l?g in l:!1)});try{let S=e(C);return c?void 0:S}catch(S){if(S===B)return S[0];throw S}}});f("...",r=>(r=i(r),e=>{let t=r(e),o=[];for(let n of Object.keys(t))P(n)||o.push([n,t[n]]);return o}));f("?.",(r,e)=>(r=i(r),e=M(e),P(e)?()=>{}:t=>r(t)?.[e]));f("?.[]",(r,e)=>(r=i(r),e=i(e),t=>{let o=r(t);if(o==null)return;let n=M(e(t));return P(n)?void 0:o[n]}));f("?.()",(r,e)=>{let t=e?e[0]===","?(e=e.slice(1).map(i),n=>e.map(p=>p(n))):(e=i(e),n=>[e(n)]):()=>[];if(r[0]==="."||r[0]==="?."){let n=r[0]==="?.",p=i(r[1]),c=M(r[2]);return P(c)?()=>{}:n?l=>p(l)?.[c]?.(...t(l)):l=>p(l)[c]?.(...t(l))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",p=i(r[1]),c=i(r[2]);return l=>{let A=p(l);if(n&&A==null)return;let w=M(c(l));return P(w)?void 0:A[w]?.(...t(l))}}let o=i(r);return n=>o(n)?.(...t(n))});f("typeof",r=>(r=i(r),e=>typeof r(e)));f("void",r=>(r=i(r),e=>(r(e),void 0)));f("delete",r=>{if(r[0]==="."){let e=i(r[1]),t=r[2];return o=>delete e(o)[t]}if(r[0]==="[]"){let e=i(r[1]),t=i(r[2]);return o=>delete e(o)[t(o)]}return()=>!0});f("new",r=>{let e=i(r?.[0]==="()"?r[1]:r),t=r?.[0]==="()"?r[2]:null,o=t?t[0]===","?(n=>p=>n.map(c=>c(p)))(t.slice(1).map(i)):(n=>p=>[n(p)])(i(t)):()=>[];return n=>new(e(n))(...o(n))});var 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 vo=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);f("{}",(r,e)=>{if(e!==void 0)return;if(!vo(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let t=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},p={};for(let c of t.flatMap(l=>l(o)))if(c[0]===sr){let[,l,A]=c;p[l]={...p[l],...A,configurable:!0,enumerable:!0}}else n[c[0]]=c[1];for(let c in p)Object.defineProperty(n,c,p[c]);return n}});f("{",r=>(r=r?i(r):()=>{},e=>r(Object.create(e))));f(":",(r,e)=>(e=i(e),Array.isArray(r)?(r=i(r),t=>[[r(t),e(t)]]):t=>[[r,e(t)]]));f("`",(...r)=>(r=r.map(i),e=>r.map(t=>t(e)).join("")));f("``",(r,...e)=>{r=i(r);let t=[],o=[];for(let p of e)Array.isArray(p)&&p[0]===void 0?t.push(p[1]):o.push(i(p));let n=Object.assign([...t],{raw:t});return p=>r(p)(n,...o.map(c=>c(p)))});f("function",(r,e,t)=>{t=t?i(t):()=>{};let o=e?e[0]===","?e.slice(1):[e]:[],n=null,p=-1,c=o[o.length-1];return Array.isArray(c)&&c[0]==="..."&&(p=o.length-1,n=c[1],o.length--),l=>{let A=(...w)=>{let C={};o.forEach((g,O)=>C[g]=w[O]),n&&(C[n]=w.slice(p));let S=new Proxy(C,{get:(g,O)=>O in g?g[O]:l[O],set:(g,O,We)=>((O in g?g:l)[O]=We,!0),has:(g,O)=>O in g||O in l});try{return t(S)}catch(g){if(g===B)return g[0];throw g}};return r&&(l[r]=A),A}});f("function*",(r,e,t)=>{throw Error("Generator functions are not supported in evaluation")});f("async",r=>{let e=i(r);return t=>{let o=e(t);return async function(...n){return o(...n)}}});f("await",r=>(r=i(r),async e=>await r(e)));f("yield",r=>(r=r?i(r):null,e=>{throw{__yield__:r?r(e):void 0}}));f("yield*",r=>(r=i(r),e=>{throw{__yield_all__:r(e)}}));var Bo=Symbol("static"),Mo=r=>{throw Error(r)};f("instanceof",(r,e)=>(r=i(r),e=i(e),t=>r(t)instanceof e(t)));f("class",(r,e,t)=>(e=e?i(e):null,t=t?i(t):null,o=>{let n=e?.(o),p=function(...c){if(!(this instanceof p))return Mo("Class constructor must be called with new");let l=e?Reflect.construct(n,c,p):this;return p.prototype.__constructor__&&p.prototype.__constructor__.apply(l,c),l};if(e&&(Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n)),t){let c=Object.create(o);e&&(c.super=n);let l=t(c),A=Array.isArray(l)&&typeof l[0]?.[0]=="string"?l:[];for(let[w,C]of A)w==="constructor"?p.prototype.__constructor__=C:p.prototype[w]=C}return r&&(o[r]=p),p}));f("static",r=>(r=i(r),e=>[[Bo,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 F=Symbol("break"),Q=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===F)break;if(n===Q)continue;if(n===B)return n[0];throw n}return o}));f("do",(r,e)=>(r=i(r),e=i(e),t=>{let o;do try{o=r(t)}catch(n){if(n===F)break;if(n===Q)continue;if(n===B)return n[0];throw n}while(e(t));return o}));f("for",(r,e)=>{if(Array.isArray(r)&&r[0]===";"){let[,t,o,n]=r;return t=t?i(t):null,o=o?i(o):()=>!0,n=n?i(n):null,e=i(e),p=>{let c;for(t?.(p);o(p);n?.(p))try{c=e(p)}catch(l){if(l===F)break;if(l===Q)continue;if(l===B)return l[0];throw l}return c}}if(Array.isArray(r)&&(r[0]==="in"||r[0]==="of")){let[t,o,n]=r;if(Array.isArray(o)&&(o[0]==="let"||o[0]==="const"||o[0]==="var")&&(o=o[1]),t==="in")return Do(o,n,e);if(t==="of")return Uo(o,n,e)}});var Uo=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let l of e(n)){o?H(r,l,n):n[r]=l;try{p=t(n)}catch(A){if(A===F)break;if(A===Q)continue;if(A===B)return A[0];throw A}}return o||(n[r]=c),p}},Do=(r,e,t)=>{e=i(e),t=i(t);let o=Array.isArray(r);return n=>{let p,c=o?null:n[r];for(let l in e(n)){o?H(r,l,n):n[r]=l;try{p=t(n)}catch(A){if(A===F)break;if(A===Q)continue;if(A===B)return A[0];throw A}}return o||(n[r]=c),p}};f("break",()=>()=>{throw F});f("continue",()=>()=>{throw Q});f("return",r=>(r=r!==void 0?i(r):null,e=>{throw B[0]=r?.(e),B}));f("try",(r,...e)=>{r=r?i(r):null;let t=e.find(l=>l?.[0]==="catch"),o=e.find(l=>l?.[0]==="finally"),n=t?.[1],p=t?.[2]?i(t[2]):null,c=o?.[1]?i(o[1]):null;return l=>{let A;try{A=r?.(l)}catch(w){if(w===F||w===Q||w===B)throw w;if(n!=null&&p){let C=n in l,S=l[n];l[n]=w;try{A=p(l)}finally{C?l[n]=S:delete l[n]}}else if(!p)throw w}finally{c?.(l)}return A}});f("throw",r=>(r=i(r),e=>{throw r(e)}));f("switch",(r,...e)=>(r=i(r),e.length?(e=e.map(t=>[t[0]==="case"?i(t[1]):null,(t[0]==="case"?t[2]:t[1])?.[0]===";"?(t[0]==="case"?t[2]:t[1]).slice(1).map(i):(t[0]==="case"?t[2]:t[1])?[i(t[0]==="case"?t[2]:t[1])]:[]]),t=>{let o=r(t),n=!1,p;for(let[l,A]of e)if(n||l===null||l(t)===o)for(n=!0,c=0;c<A.length;c++)try{p=A[c](t)}catch(w){if(w===F)return p;throw w}var c;return p}):t=>r(t)));f("import",()=>()=>{});f("export",()=>()=>{});f("from",(r,e)=>()=>{});f("as",(r,e)=>()=>{});f("default",r=>i(r));var je=new WeakMap,Ko=(r,...e)=>typeof r=="string"?i(s(r)):je.get(r)||je.set(r,Fo(r,e)).get(r),$e=57344,Fo=(r,e)=>{let t=r.reduce((p,c,l)=>p+(l?String.fromCharCode($e+l-1):"")+c,""),o=s(t),n=p=>{if(typeof p=="string"&&p.length===1){let c=p.charCodeAt(0)-$e,l;if(c>=0&&c<e.length)return l=e[c],Go(l)?l:[,l]}return Array.isArray(p)?p.map(n):p};return i(n(o))},Go=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),xo=Ko;export{lr as access,h as binary,i as compile,m as cur,xo as default,I as err,a as expr,z as group,Ho as id,u as idx,y as keyword,$ as literal,qe as loc,R as lookup,jr as member,fr as nary,N as next,f as operator,pr as operators,L as parens,s as parse,U as peek,v as prec,ur as propName,T as seek,d as skip,E as token,_ as unary,k as word};
|
package/justin.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var l,u,d=r=>(l=0,u=r,d.enter?.(),r=
|
|
1
|
+
var l,u,d=r=>(l=0,u=r,d.enter?.(),r=g(),u[l]?R():r||""),R=(r="Unexpected token",t=l,e=u.slice(0,t).split(`
|
|
2
2
|
`),o=e.pop(),n=u.slice(Math.max(0,t-40),t),s="\u032D",f=(u[t]||" ")+s,m=u.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
|
-
${n}${f}${m}`)},jr=(r,t=l)=>(Array.isArray(r)&&(r.loc=t),r),
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},
|
|
3
|
+
${n}${f}${m}`)},jr=(r,t=l)=>(Array.isArray(r)&&(r.loc=t),r),L=(r,t=l,e)=>{for(;e=r(u.charCodeAt(l));)l+=e;return u.slice(t,l)},S=(r=1)=>u[l+=r],mr=r=>l=r,g=(r=0,t)=>{let e,o,n;for(t&&d.enter?.(r,t);(e=d.space())&&e!==t&&(n=d.step(o,r,e,g));)o=n;return t&&(e==t?(l++,d.exit?.(r,t)):R("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},W=(r=l)=>{for(;u.charCodeAt(r)<=32;)r++;return u.charCodeAt(r)},Kt=d.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,fr=(r,t=r.length)=>u.substr(l,t)===r&&!d.id(u.charCodeAt(l+t)),$t=()=>(S(),g(0,41)),I=[],Q={},N=(r,t=32,e,o=r.charCodeAt(0))=>ur({op:r,l:r.length,p:Q[r]=!I[o]&&Q[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),c=(r,t,e=!1)=>N(r,t,(o,n)=>o&&(n=g(t-(e?.5:0)))&&[r,o,n]),k=(r,t,e)=>N(r,t,o=>e?o&&[r,o]:!o&&(o=g(t-.5))&&[r,o]),T=(r,t)=>N(r,200,e=>!e&&[,t]),q=(r,t,e,o)=>N(r,t,(n,s,f=n)=>(s=g(t-(e?.5:0)),n?.[0]!==r&&(n=[r,n||null]),s?.[0]===r?n.push(...s.slice(1)):s?n.push(s):o||W()===r.charCodeAt(0)?n.push(null):f&&n.length===2&&(n=n[1]),n)),U=(r,t)=>N(r[0],t,e=>!e&&[r,g(0,r.charCodeAt(1))||null]),z=(r,t)=>N(r[0],t,e=>e&&[r,e,g(0,r.charCodeAt(1))||null]),J=(r,t)=>(d.space(),t=u.charCodeAt(l),d.id(t)&&(t<48||t>57)?L(d.id):g(r)),lr=(r,t)=>N(r,t,(e,o)=>e&&(o=J(t))&&[r,e,o]),B=(r,t,e)=>(Q[r]??=t,ur({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),pr=(r,t,e=[],o=r.filter(s=>s.l<2),n=(s,f,m,C=l,y,h,A,E=e[u.charCodeAt(l+1)]||o)=>{for(A=0;h=E[A++];)if(!(h.kw&&s)&&!(m?h.op!==m:!((h.l<3||u.substr(l,h.l)===h.op)&&(!h.word||!d.id(u.charCodeAt(l+h.l)))&&(m=h.op)))&&!(f>=h.p)&&!(h.kw&&d.prop&&!d.prop(l+h.l))){if(l+=h.l,y=h.map(s))return jr(y,C);l=C,m=0,h.word||s||t||E[A]||R()}return t?.(s,f,m)})=>{for(let s of r)s.l>1&&(e[s.op.charCodeAt(1)]||=[]).push(s);return e.forEach(s=>s.push(...o)),n.ops=r,n.tail=t,n},ur=(r,t=r.op.charCodeAt(0),e=I[t])=>I[t]=e?.ops?pr([r,...e.ops].sort((o,n)=>n.l-o.l),e.tail):pr([r],e);d.space=r=>{for(;(r=u.charCodeAt(l))<=32;)l++;return r};d.step=(r,t,e,o,n)=>(n=I[e])&&n(r,t)||(r?null:L(d.id)||null);var H={},p=(r,t,e=H[r])=>H[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):H[r[0]]?.(...r.slice(1))??R(`Unknown operator: ${r[0]}`,r?.loc):i.id(r);i.id=r=>r===void 0?()=>{}:t=>t?.[r];var V=46,P=48,F=57,cr=69,dr=101,Qr=43,Hr=45,hr=95,Wr=97,qr=102,zr=65,Jr=70,Ar=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Vr=r=>r===V&&(r=u.charCodeAt(l+1))!==V&&!(d.id(r)&&r>F&&r!==dr&&r!==cr)||r>=P&&r<=F||r===hr||((r===cr||r===dr)&&((r=u.charCodeAt(l+1))>=P&&r<=F||r===Qr||r===Hr)?2:0),Y=r=>(r=+Ar(L(Vr)))!=r?R():[,r],Yr=r=>t=>t===hr||t>=P&&t<=F&&t-P<r||r===16&&(t>=Wr&&t<=qr||t>=zr&&t<=Jr);d.number=null;I[V]=r=>!r&&u.charCodeAt(l+1)>=P&&u.charCodeAt(l+1)<=F&&Y();for(let r=P;r<=F;r++)I[r]=t=>t?void 0:Y();I[P]=(r,t)=>{if(!r){for(let e in d.number)if(e[0]==="0"&&(u.charCodeAt(l+1)|32)===e.charCodeAt(1)){S(2);let o=Ar(L(Yr(t=d.number[e])));return[,parseInt(o,t)]}return Y()}};var Nr=92,gr=34,Cr=39,yr=117,Sr=120,kr=123,Zr=125,Er=10,xr=13,br={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},wr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,Ir=r=>{if(u.charCodeAt(r)!==Nr)return;let t=u.charCodeAt(r+1);if(t===Sr||t===yr&&u.charCodeAt(r+2)!==kr){let e=t===Sr?2:4,o=0,n;for(let s=0;s<e;s++){if((n=wr(u.charCodeAt(r+2+s)))<0)return;o=o*16+n}return[o,2+e]}if(t===yr){let e=0,o=r+3,n;for(;(n=wr(u.charCodeAt(o)))>=0;)e=e*16+n,o++;if(o>r+3&&e<=1114111&&u.charCodeAt(o)===Zr)return[e,o-r+1]}},rt=()=>{let r=u.charCodeAt(l+1);if(r===Er)return["",2];if(r===xr)return["",u.charCodeAt(l+2)===Er?3:2];let t=Ir(l);if(t){let[e,o]=t;if(e>=55296&&e<=56319){let n=Ir(l+o);n&&n[0]>=56320&&n[0]<=57343&&(e=65536+(e-55296)*1024+n[0]-56320,o+=n[1])}return[String.fromCodePoint(e),o]}return[br[u[l+1]]||u[l+1],2]},Z=(r,t=!1)=>{let e=l,o,n;for(;(n=u.charCodeAt(l))-r&&!(t&&(n===0||n===36&&u.charCodeAt(l+1)===kr));){if(n!==Nr){S();continue}o||(o=[]),o.push(u.slice(e,l));let[f,m]=rt();o.push(f),S(m),e=l}let s=u.slice(e,l);return o?(o.push(s),o.join("")):s},Or=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(!(t||!d.string?.[n]))return S(),o+=Z(r),u[l]===n?S():R("Bad string"),[,o]};I[gr]=Or(gr);I[Cr]=Or(Cr);d.string={'"':!0};var tt=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,tt,!0));var et=30,ot=40,nt=140;k("!",nt);c("||",et);c("&&",ot);var it=50,st=60,pt=70,Rr=100,mt=140;c("|",it);c("&",pt);c("^",st);c(">>",Rr);c("<<",Rr);k("~",mt);var G=90;c("<",G);c(">",G);c("<=",G);c(">=",G);var ar=80;c("==",ar);c("!=",ar);var vr=110,x=120,Lr=140;c("+",vr);c("-",vr);c("*",x);c("/",x);c("%",x);k("+",Lr);k("-",Lr);var M=150;N("++",M,r=>r?["++",r,null]:["++",g(M-1)]);N("--",M,r=>r?["--",r,null]:["--",g(M-1)]);var ft=5,lt=10;q(",",lt);q(";",ft,!0,!0);var ut=170;U("()",ut);var Pr=170,ct=160;z("[]",Pr);lr(".",Pr);z("()",ct);var dt=d.space;d.comment??={"//":`
|
|
5
5
|
`,"/*":"*/"};d.space=()=>{for(var r,t,e,o,n;r=dt();){for(e in t=d.comment)if(r===e.charCodeAt(0)&&(e.length<2||u.charCodeAt(l+1)===e.charCodeAt(1))&&(e.length<3||u.substr(l,e.length)===e)){o=t[e],n=u.indexOf(o,l+e.length),mr(n<0?u.length:o===`
|
|
6
|
-
`?n:n+o.length),r=0;break}if(r)return r}return r};var Dr=80;c("===",Dr);c("!==",Dr);var ht=30;c("??",ht);var At=130,gt=20;c("**",At,!0);c("**=",gt,!0);var Ct=90;c("in",Ct);var yt=20,St=100;c(">>>",St);c(">>>=",yt,!0);var b=20;c("||=",b,!0);c("&&=",b,!0);c("??=",b,!0);T("true",!0);T("false",!1);T("null",null);B("undefined",200,()=>[]);T("NaN",NaN);T("Infinity",1/0);var rr=20;I("?",rr,(r,t,e)=>r&&(t=A(rr-1))&&a(o=>o===58)&&(e=A(rr-1),["?",r,t,e]));var wt=20;c("=>",wt,!0);var Et=20;N("...",Et);var Tr=170;I("?.",Tr,(r,t)=>{if(!r)return;let e=d.space();return e===40?(y(),["?.()",r,A(0,41)||null]):e===91?(y(),["?.[]",r,A(0,93)]):(t=J(Tr),t?["?.",r,t]:void 0)});var tr=140,Fr=160,It=Fr+1;N("typeof",tr);N("void",tr);N("delete",tr);var Nt=r=>d.space()===40?(y(),["()",r,A(0,41)||null]):r;B("new",It,()=>fr(".target")?(y(7),["new.target"]):["new",Nt(A(Fr))]);var kt=20,Ur=200;d.prop=r=>W(r)!==58;U("[]",Ur);U("{}",Ur);c(":",kt-1,!0);var Ot=170,X=96,Rt=36,vt=123,_r=()=>{let r=[];for(;;){r.push([,Z(X,!0)]);let t=u.charCodeAt(l);if(t===X)return y(),r;(t!==Rt||u.charCodeAt(l+1)!==vt)&&O("Unterminated template"),y(2),r.push(A(0,125))}},Lt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],at=E[X];E[X]=(r,t)=>r&&t<Ot?d.asi&&d.newline?void 0:(y(),["``",r,..._r()]):r?at?.(r,t):(y(),Lt(_r()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Gr=(r,t,e,o)=>typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="()"&&r.length===2?Gr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Br={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Br)p(r,(t,e)=>(e=i(e),Gr(t,(o,n,s)=>Br[r](o,n,e(s)))));p("!",r=>(r=i(r),t=>!r(t)));p("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));p("~",r=>(r=i(r),t=>~r(t)));p("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));p("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var er=(r,t,e,o)=>typeof r=="string"?n=>t(n,r):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n))):r[0]==="()"&&r.length===2?er(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>er(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>er(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var Mr=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});p(",",Mr);p(";",Mr);var Xr=r=>r!=null&&(typeof r=="object"||typeof r=="function"),k=r=>Xr(r)?Reflect.ownKeys({[r]:0})[0]:r,S=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Pt=r=>S(k(r));i.id=r=>r===void 0||Pt(r)?()=>{}:t=>t?.[r];var K=r=>{throw Error(r)};p("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&K("Missing index"),r=i(r),t=i(t),e=>{let o=k(t(e));return S(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=i(r),t=k(t[0]?t:t[1]),S(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?K("Empty ()"):i(r);let e=s=>s?.[0]===","&&s.slice(1).some(f=>f==null||e(f));e(t)&&K("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),s=>t.map(f=>f(s))):(t=i(t),s=>[t(s)]):()=>[],n=ir(r);return n<0?()=>{}:nr(r,n?(s,f,m)=>(f=k(f),S(f)?void 0:s[f](...o(m))):(s,f,m)=>s[f](...o(m)))});var R=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&R(r[1])||r[0]==="{}"),nr=(r,t,e,o)=>r==null?K("Empty ()"):r[0]==="()"&&r.length==2?nr(r[1],t):typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="?."?(e=i(r[1]),o=r[2],n=>{let s=e(n);return s==null?void 0:t(s,o,n)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="?.[]"?(e=i(r[1]),o=i(r[2]),n=>{let s=e(n);return s==null?void 0:t(s,o(n),n)}):(r=i(r),n=>t([r(n)],0,n)),or=r=>Xr(r)?1:S(r)?-1:0,ir=(r,t=r?.[0],e=r?.[2])=>typeof r=="string"?or(r):t==="()"&&r.length==2?ir(r[1]):t==="."||t==="?."?or(e):(t==="[]"||t==="?.[]")&&r.length===3?Array.isArray(e)&&e[0]==null?or(e[1]):1:0,L=(r,t,e=ir(r))=>e<0?()=>{}:nr(r,e?(o,n,s)=>(n=k(n),S(n)?void 0:t(o,n,s)):t);p("===",(r,t)=>(r=i(r),t=i(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=i(r),t=i(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=i(r),t=i(t),e=>r(e)??t(e)));var Dt=r=>{throw Error(r)};p("**",(r,t)=>(r=i(r),t=i(t),e=>r(e)**t(e)));p("**=",(r,t)=>(R(r)||Dt("Invalid assignment target"),t=i(t),L(r,(e,o,n)=>e[o]**=t(n))));p("in",(r,t)=>(r=i(r),t=i(t),e=>r(e)in t(e)));var Tt=r=>{throw Error(r)};p(">>>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(R(r)||Tt("Invalid assignment target"),t=i(t),L(r,(e,o,n)=>e[o]>>>=t(n))));var Ft=r=>r[0]?.[0]===","?r[0].slice(1):r,_=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...n]=r,s=Ft(n);if(o==="{}"){let f=[];for(let m of s){if(Array.isArray(m)&&m[0]==="..."){let w={};for(let D in t)!f.includes(D)&&!S(D)&&(w[D]=t[D]);e[m[1]]=w;break}let h,g,v;typeof m=="string"?h=g=m:m[0]==="="?(typeof m[1]=="string"?h=g=m[1]:[,h,g]=m[1],v=m[2]):[,h,g]=m,f.push(h=k(h));let C=S(h)?void 0:t[h];C===void 0&&v&&(C=i(v)(e)),_(g,C,e)}}else if(o==="[]"){let f=0;for(let m of s){if(m===null){f++;continue}if(Array.isArray(m)&&m[0]==="..."){e[m[1]]=t.slice(f);break}let h=m,g;Array.isArray(m)&&m[0]==="="&&([,h,g]=m);let v=t[f++];v===void 0&&g&&(v=i(g)(e)),_(h,v,e)}}},sr=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,n=i(o);return typeof e=="string"?s=>{s[e]=n(s)}:s=>_(e,n(s),s)}return i(t)}),t=>{for(let e of r)e(t)});p("let",sr);p("const",sr);p("var",sr);var $=r=>{throw Error(r)};p("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=i(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>_(e,t(o),o)}return R(r)||$("Invalid assignment target"),t=i(t),L(r,(e,o,n)=>e[o]=t(n))});p("||=",(r,t)=>(R(r)||$("Invalid assignment target"),t=i(t),L(r,(e,o,n)=>e[o]||=t(n))));p("&&=",(r,t)=>(R(r)||$("Invalid assignment target"),t=i(t),L(r,(e,o,n)=>e[o]&&=t(n))));p("??=",(r,t)=>(R(r)||$("Invalid assignment target"),t=i(t),L(r,(e,o,n)=>e[o]??=t(n))));p("?",(r,t,e)=>(r=i(r),t=i(t),e=i(e),o=>r(o)?t(o):e(o)));var Ut=[];p("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,n=s[1],e.length--);let f=t?.[0]==="{}";return t=i(f?["{",t[1]]:t),m=>(...h)=>{let g={};e.forEach((C,w)=>g[C]=h[w]),n&&(g[n]=h.slice(o));let v=new Proxy(g,{get:(C,w)=>w in C?C[w]:m?.[w],set:(C,w,D)=>((w in C?C:m)[w]=D,!0),has:(C,w)=>w in C||(m?w in m:!1)});try{let C=t(v);return f?void 0:C}catch(C){if(C===Ut)return C[0];throw C}}});p("...",r=>(r=i(r),t=>{let e=r(t),o=[];for(let n of Object.keys(e))S(n)||o.push([n,e[n]]);return o}));p("?.",(r,t)=>(r=i(r),t=k(t),S(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=i(r),t=i(t),e=>{let o=r(e);if(o==null)return;let n=k(t(e));return S(n)?void 0:o[n]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];if(r[0]==="."||r[0]==="?."){let n=r[0]==="?.",s=i(r[1]),f=k(r[2]);return S(f)?()=>{}:n?m=>s(m)?.[f]?.(...e(m)):m=>s(m)[f]?.(...e(m))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",s=i(r[1]),f=i(r[2]);return m=>{let h=s(m);if(n&&h==null)return;let g=k(f(m));return S(g)?void 0:h[g]?.(...e(m))}}let o=i(r);return n=>o(n)?.(...e(n))});p("typeof",r=>(r=i(r),t=>typeof r(t)));p("void",r=>(r=i(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=i(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=i(r[1]),e=i(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=i(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(n=>s=>n.map(f=>f(s)))(e.slice(1).map(i)):(n=>s=>[n(s)])(i(e)):()=>[];return n=>new(t(n))(...o(n))});var j=Symbol("accessor");p("get",(r,t)=>(t=t?i(t):()=>{},e=>[[j,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?i(e):()=>{},o=>[[j,r,{set:function(n){let s=Object.create(o||{});s.this=this,s[t]=n,e(s)}}]]));var _t=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!_t(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},s={};for(let f of e.flatMap(m=>m(o)))if(f[0]===j){let[,m,h]=f;s[m]={...s[m],...h,configurable:!0,enumerable:!0}}else n[f[0]]=f[1];for(let f in s)Object.defineProperty(n,f,s[f]);return n}});p("{",r=>(r=r?i(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=i(t),Array.isArray(r)?(r=i(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(i),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=i(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(i(s));let n=Object.assign([...e],{raw:e});return s=>r(s)(n,...o.map(f=>f(s)))});var Kr=new WeakMap,Bt=(r,...t)=>typeof r=="string"?i(d(r)):Kr.get(r)||Kr.set(r,Gt(r,t)).get(r),$r=57344,Gt=(r,t)=>{let e=r.reduce((s,f,m)=>s+(m?String.fromCharCode($r+m-1):"")+f,""),o=d(e),n=s=>{if(typeof s=="string"&&s.length===1){let f=s.charCodeAt(0)-$r,m;if(f>=0&&f<t.length)return m=t[f],Mt(m)?m:[,m]}return Array.isArray(s)?s.map(n):s};return i(n(o))},Mt=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Xt=Bt;export{z as access,c as binary,i as compile,u as cur,Xt as default,O as err,A as expr,U as group,Kt as id,l as idx,B as keyword,T as literal,jr as loc,E as lookup,lr as member,q as nary,a as next,p as operator,H as operators,$t as parens,d as parse,W as peek,Q as prec,J as propName,mr as seek,y as skip,I as token,N as unary,fr as word};
|
|
6
|
+
`?n:n+o.length),r=0;break}if(r)return r}return r};var Dr=80;c("===",Dr);c("!==",Dr);var ht=30;c("??",ht);var At=130,gt=20;c("**",At,!0);c("**=",gt,!0);var Ct=90;c("in",Ct);var yt=20,St=100;c(">>>",St);c(">>>=",yt,!0);var b=20;c("||=",b,!0);c("&&=",b,!0);c("??=",b,!0);T("true",!0);T("false",!1);T("null",null);B("undefined",200,()=>[]);T("NaN",NaN);T("Infinity",1/0);var rr=20;N("?",rr,(r,t,e)=>r&&(t=g(rr-1))&&L(o=>o===58)&&(e=g(rr-1),["?",r,t,e]));var Et=20;c("=>",Et,!0);var wt=20;k("...",wt);var Tr=170;N("?.",Tr,(r,t)=>{if(!r)return;let e=d.space();return e===40?(S(),["?.()",r,g(0,41)||null]):e===91?(S(),["?.[]",r,g(0,93)]):(t=J(Tr),t?["?.",r,t]:void 0)});var tr=140,Fr=160,It=Fr+1;k("typeof",tr);k("void",tr);k("delete",tr);var Nt=r=>d.space()===40?(S(),["()",r,g(0,41)||null]):r;B("new",It,()=>fr(".target")?(S(7),["new.target"]):["new",Nt(g(Fr))]);var kt=20,Ur=200;d.prop=r=>W(r)!==58;U("[]",Ur);U("{}",Ur);c(":",kt-1,!0);var Ot=170,X=96,Rt=36,at=123,_r=()=>{let r=[];for(;;){r.push([,Z(X,!0)]);let t=u.charCodeAt(l);if(t===X)return S(),r;(t!==Rt||u.charCodeAt(l+1)!==at)&&R("Unterminated template"),S(2),r.push(g(0,125))}},vt=r=>r.length<2&&r[0]?.[0]===void 0?r[0]||[,""]:["`",...r],Lt=I[X];I[X]=(r,t)=>r&&t<Ot?d.asi&&d.newline?void 0:(S(),["``",r,..._r()]):r?Lt?.(r,t):(S(),vt(_r()));d.string["'"]=!0;d.number={"0x":16,"0b":2,"0o":8};var Gr=(r,t,e,o)=>typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="()"&&r.length===2?Gr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),Br={"=":(r,t,e)=>r[t]=e,"+=":(r,t,e)=>r[t]+=e,"-=":(r,t,e)=>r[t]-=e,"*=":(r,t,e)=>r[t]*=e,"/=":(r,t,e)=>r[t]/=e,"%=":(r,t,e)=>r[t]%=e,"|=":(r,t,e)=>r[t]|=e,"&=":(r,t,e)=>r[t]&=e,"^=":(r,t,e)=>r[t]^=e,">>=":(r,t,e)=>r[t]>>=e,"<<=":(r,t,e)=>r[t]<<=e};for(let r in Br)p(r,(t,e)=>(e=i(e),Gr(t,(o,n,s)=>Br[r](o,n,e(s)))));p("!",r=>(r=i(r),t=>!r(t)));p("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));p("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));p("~",r=>(r=i(r),t=>~r(t)));p("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));p("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));p("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));p(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));p("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));p(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));p("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));p(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));p("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));p("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));p("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));p("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));p("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));p("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));p("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));p("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var er=(r,t,e,o)=>typeof r=="string"?n=>t(n,r):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o)):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n))):r[0]==="()"&&r.length===2?er(r[1],t):(()=>{throw Error("Invalid increment target")})();p("++",(r,t)=>er(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));p("--",(r,t)=>er(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var Mr=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});p(",",Mr);p(";",Mr);var Xr=r=>r!=null&&(typeof r=="object"||typeof r=="function"),O=r=>Xr(r)?Reflect.ownKeys({[r]:0})[0]:r,w=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Pt=r=>w(O(r));i.id=r=>r===void 0||Pt(r)?()=>{}:t=>t?.[r];var K=r=>{throw Error(r)};p("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&K("Missing index"),r=i(r),t=i(t),e=>{let o=O(t(e));return w(o)?void 0:r(e)[o]}));p(".",(r,t)=>(r=i(r),t=O(t[0]?t:t[1]),w(t)?()=>{}:e=>r(e)[t]));p("()",(r,t)=>{if(t===void 0)return r==null?K("Empty ()"):i(r);let e=s=>s?.[0]===","&&s.slice(1).some(f=>f==null||e(f));e(t)&&K("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),s=>t.map(f=>f(s))):(t=i(t),s=>[t(s)]):()=>[],n=ir(r);return n<0?()=>{}:nr(r,n?(s,f,m)=>(f=O(f),w(f)?void 0:s[f](...o(m))):(s,f,m)=>s[f](...o(m)))});var a=r=>typeof r=="string"||Array.isArray(r)&&(r[0]==="."||r[0]==="?."||r[0]==="[]"&&r.length===3||r[0]==="?.[]"||r[0]==="()"&&r.length===2&&a(r[1])||r[0]==="{}"),nr=(r,t,e,o)=>r==null?K("Empty ()"):r[0]==="()"&&r.length==2?nr(r[1],t):typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="?."?(e=i(r[1]),o=r[2],n=>{let s=e(n);return s==null?void 0:t(s,o,n)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="?.[]"?(e=i(r[1]),o=i(r[2]),n=>{let s=e(n);return s==null?void 0:t(s,o(n),n)}):(r=i(r),n=>t([r(n)],0,n)),or=r=>Xr(r)?1:w(r)?-1:0,ir=(r,t=r?.[0],e=r?.[2])=>typeof r=="string"?or(r):t==="()"&&r.length==2?ir(r[1]):t==="."||t==="?."?or(e):(t==="[]"||t==="?.[]")&&r.length===3?Array.isArray(e)&&e[0]==null?or(e[1]):1:0,v=(r,t,e=ir(r))=>e<0?()=>{}:nr(r,e?(o,n,s)=>(n=O(n),w(n)?void 0:t(o,n,s)):t);p("===",(r,t)=>(r=i(r),t=i(t),e=>r(e)===t(e)));p("!==",(r,t)=>(r=i(r),t=i(t),e=>r(e)!==t(e)));p("??",(r,t)=>(r=i(r),t=i(t),e=>r(e)??t(e)));var Dt=r=>{throw Error(r)};p("**",(r,t)=>(r=i(r),t=i(t),e=>r(e)**t(e)));p("**=",(r,t)=>(a(r)||Dt("Invalid assignment target"),t=i(t),v(r,(e,o,n)=>e[o]**=t(n))));p("in",(r,t)=>(r=i(r),t=i(t),e=>r(e)in t(e)));var Tt=r=>{throw Error(r)};p(">>>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>>t(e)));p(">>>=",(r,t)=>(a(r)||Tt("Invalid assignment target"),t=i(t),v(r,(e,o,n)=>e[o]>>>=t(n))));var Ft=r=>r[0]?.[0]===","?r[0].slice(1):r,_=(r,t,e)=>{if(typeof r=="string"){e[r]=t;return}let[o,...n]=r,s=Ft(n);if(o==="{}"){let f=[];for(let m of s){if(Array.isArray(m)&&m[0]==="..."){let E={};for(let D in t)!f.includes(D)&&!w(D)&&(E[D]=t[D]);e[m[1]]=E;break}let C,y,h;typeof m=="string"?C=y=m:m[0]==="="?(typeof m[1]=="string"?C=y=m[1]:[,C,y]=m[1],h=m[2]):[,C,y]=m,f.push(C=O(C));let A=w(C)?void 0:t[C];A===void 0&&h&&(A=i(h)(e)),_(y,A,e)}}else if(o==="[]"){let f=0;for(let m of s){if(m===null){f++;continue}if(Array.isArray(m)&&m[0]==="..."){e[m[1]]=t.slice(f);break}let C=m,y;Array.isArray(m)&&m[0]==="="&&([,C,y]=m);let h=t[f++];h===void 0&&y&&(h=i(y)(e)),_(C,h,e)}}},sr=(...r)=>(r=r.map(t=>{if(typeof t=="string")return e=>{e[t]=void 0};if(t[0]==="="){let[,e,o]=t,n=i(o);return typeof e=="string"?s=>{s[e]=n(s)}:s=>_(e,n(s),s)}return i(t)}),t=>{for(let e of r)e(t)});p("let",sr);p("const",sr);p("var",sr);var $=r=>{throw Error(r)};p("=",(r,t)=>{if(Array.isArray(r)&&(r[0]==="let"||r[0]==="const"||r[0]==="var")){let e=r[1];return t=i(t),typeof e=="string"?o=>{o[e]=t(o)}:o=>_(e,t(o),o)}return a(r)||$("Invalid assignment target"),t=i(t),v(r,(e,o,n)=>e[o]=t(n))});p("||=",(r,t)=>(a(r)||$("Invalid assignment target"),t=i(t),v(r,(e,o,n)=>e[o]||=t(n))));p("&&=",(r,t)=>(a(r)||$("Invalid assignment target"),t=i(t),v(r,(e,o,n)=>e[o]&&=t(n))));p("??=",(r,t)=>(a(r)||$("Invalid assignment target"),t=i(t),v(r,(e,o,n)=>e[o]??=t(n))));p("?",(r,t,e)=>(r=i(r),t=i(t),e=i(e),o=>r(o)?t(o):e(o)));var Ut=[];p("=>",(r,t)=>{r=r?.[0]==="()"?r[1]:r;let e=r?r[0]===","?r.slice(1):[r]:[],o=-1,n=null,s=e[e.length-1];Array.isArray(s)&&s[0]==="..."&&(o=e.length-1,n=s[1],e.length--);let f=t?.[0]==="{}";return t=i(f?["{",t[1]]:t),m=>(...C)=>{let y={};e.forEach((A,E)=>y[A]=C[E]),n&&(y[n]=C.slice(o));let h=new Proxy(y,{get:(A,E)=>E in A?A[E]:m?.[E],set:(A,E,D)=>((E in A?A:m)[E]=D,!0),has:(A,E)=>E in A||(m?E in m:!1)});try{let A=t(h);return f?void 0:A}catch(A){if(A===Ut)return A[0];throw A}}});p("...",r=>(r=i(r),t=>{let e=r(t),o=[];for(let n of Object.keys(e))w(n)||o.push([n,e[n]]);return o}));p("?.",(r,t)=>(r=i(r),t=O(t),w(t)?()=>{}:e=>r(e)?.[t]));p("?.[]",(r,t)=>(r=i(r),t=i(t),e=>{let o=r(e);if(o==null)return;let n=O(t(e));return w(n)?void 0:o[n]}));p("?.()",(r,t)=>{let e=t?t[0]===","?(t=t.slice(1).map(i),n=>t.map(s=>s(n))):(t=i(t),n=>[t(n)]):()=>[];if(r[0]==="."||r[0]==="?."){let n=r[0]==="?.",s=i(r[1]),f=O(r[2]);return w(f)?()=>{}:n?m=>s(m)?.[f]?.(...e(m)):m=>s(m)[f]?.(...e(m))}if((r[0]==="[]"||r[0]==="?.[]")&&r.length===3){let n=r[0]==="?.[]",s=i(r[1]),f=i(r[2]);return m=>{let C=s(m);if(n&&C==null)return;let y=O(f(m));return w(y)?void 0:C[y]?.(...e(m))}}let o=i(r);return n=>o(n)?.(...e(n))});p("typeof",r=>(r=i(r),t=>typeof r(t)));p("void",r=>(r=i(r),t=>(r(t),void 0)));p("delete",r=>{if(r[0]==="."){let t=i(r[1]),e=r[2];return o=>delete t(o)[e]}if(r[0]==="[]"){let t=i(r[1]),e=i(r[2]);return o=>delete t(o)[e(o)]}return()=>!0});p("new",r=>{let t=i(r?.[0]==="()"?r[1]:r),e=r?.[0]==="()"?r[2]:null,o=e?e[0]===","?(n=>s=>n.map(f=>f(s)))(e.slice(1).map(i)):(n=>s=>[n(s)])(i(e)):()=>[];return n=>new(t(n))(...o(n))});var j=Symbol("accessor");p("get",(r,t)=>(t=t?i(t):()=>{},e=>[[j,r,{get:function(){let o=Object.create(e||{});return o.this=this,t(o)}}]]));p("set",(r,t,e)=>(e=e?i(e):()=>{},o=>[[j,r,{set:function(n){let s=Object.create(o||{});s.this=this,s[t]=n,e(s)}}]]));var _t=r=>r==null||typeof r=="string"||[":",",","...","get","set"].includes(r[0]);p("{}",(r,t)=>{if(t!==void 0)return;if(!_t(r))return i(["{",r]);r=r?r[0]!==","?[r]:r.slice(1):[];let e=r.map(o=>i(typeof o=="string"?[":",o,o]:o));return o=>{let n={},s={};for(let f of e.flatMap(m=>m(o)))if(f[0]===j){let[,m,C]=f;s[m]={...s[m],...C,configurable:!0,enumerable:!0}}else n[f[0]]=f[1];for(let f in s)Object.defineProperty(n,f,s[f]);return n}});p("{",r=>(r=r?i(r):()=>{},t=>r(Object.create(t))));p(":",(r,t)=>(t=i(t),Array.isArray(r)?(r=i(r),e=>[[r(e),t(e)]]):e=>[[r,t(e)]]));p("`",(...r)=>(r=r.map(i),t=>r.map(e=>e(t)).join("")));p("``",(r,...t)=>{r=i(r);let e=[],o=[];for(let s of t)Array.isArray(s)&&s[0]===void 0?e.push(s[1]):o.push(i(s));let n=Object.assign([...e],{raw:e});return s=>r(s)(n,...o.map(f=>f(s)))});var Kr=new WeakMap,Bt=(r,...t)=>typeof r=="string"?i(d(r)):Kr.get(r)||Kr.set(r,Gt(r,t)).get(r),$r=57344,Gt=(r,t)=>{let e=r.reduce((s,f,m)=>s+(m?String.fromCharCode($r+m-1):"")+f,""),o=d(e),n=s=>{if(typeof s=="string"&&s.length===1){let f=s.charCodeAt(0)-$r,m;if(f>=0&&f<t.length)return m=t[f],Mt(m)?m:[,m]}return Array.isArray(s)?s.map(n):s};return i(n(o))},Mt=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),Xt=Bt;export{z as access,c as binary,i as compile,u as cur,Xt as default,R as err,g as expr,U as group,Kt as id,l as idx,B as keyword,T as literal,jr as loc,I as lookup,lr as member,q as nary,L as next,p as operator,H as operators,$t as parens,d as parse,W as peek,Q as prec,J as propName,mr as seek,S as skip,N as token,k as unary,fr as word};
|
package/package.json
CHANGED
package/parse.js
CHANGED
|
@@ -136,33 +136,44 @@ export let idx, cur,
|
|
|
136
136
|
op, l: op.length, p, map, word: true, kw: true
|
|
137
137
|
}));
|
|
138
138
|
|
|
139
|
-
// One dispatcher per first char
|
|
140
|
-
//
|
|
141
|
-
//
|
|
142
|
-
//
|
|
139
|
+
// One dispatcher per first char. Its op descriptors are filed by second char, so
|
|
140
|
+
// a position tries only what can be spelled there: the ops whose second char is
|
|
141
|
+
// the next one, longest first (newest first within one length), then the
|
|
142
|
+
// one-char ops. After them comes whatever handler the char had before
|
|
143
|
+
// token()/keyword() (number, string, custom lookup[c] assignments). curOp carries
|
|
144
|
+
// a committed text-match down the list: once an op's text matches, only same-name
|
|
143
145
|
// descriptors (overrides) may retry, until a failed map resets the commitment.
|
|
144
|
-
const dispatch = (ops, tail,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
146
|
+
const dispatch = (ops, tail, by = [], one = ops.filter(d => d.l < 2),
|
|
147
|
+
fn = (a, curPrec, curOp, from = idx, r, d, i, list = by[cur.charCodeAt(idx + 1)] || one) => {
|
|
148
|
+
for (i = 0; (d = list[i++]);) {
|
|
149
|
+
if (d.kw && a) continue;
|
|
150
|
+
if (curOp ? d.op !== curOp :
|
|
151
|
+
!((d.l < 3 || cur.substr(idx, d.l) === d.op) &&
|
|
152
|
+
(!d.word || !parse.id(cur.charCodeAt(idx + d.l))) &&
|
|
153
|
+
(curOp = d.op))) continue;
|
|
154
|
+
if (curPrec >= d.p) continue;
|
|
155
|
+
if (d.kw && parse.prop && !parse.prop(idx + d.l)) continue;
|
|
156
|
+
idx += d.l;
|
|
157
|
+
if (r = d.map(a)) return loc(r, from);
|
|
158
|
+
idx = from, curOp = 0;
|
|
159
|
+
d.word || a || tail || list[i] || err();
|
|
160
|
+
}
|
|
161
|
+
return tail?.(a, curPrec, curOp);
|
|
162
|
+
}) => {
|
|
163
|
+
for (const d of ops) if (d.l > 1) (by[d.op.charCodeAt(1)] ||= []).push(d);
|
|
164
|
+
by.forEach(list => list.push(...one));
|
|
165
|
+
return fn.ops = ops, fn.tail = tail, fn;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// add op descriptor for its first char; pre-token handler stays as tail.
|
|
169
|
+
// Longest first: the longest operator spelled at a position is the token there
|
|
170
|
+
// (`<<` in `a < b << c`, not `<` cut short by its precedence), whatever order
|
|
171
|
+
// features load in. The sort is stable, so within one length the newest stays
|
|
172
|
+
// ahead: an override precedes what it overrides.
|
|
162
173
|
// Copy-on-write: each registration makes a fresh dispatcher, so a saved
|
|
163
174
|
// lookup[c] restored later (tests, embedders) still excludes it.
|
|
164
175
|
const register = (d, c = d.op.charCodeAt(0), fn = lookup[c]) =>
|
|
165
|
-
lookup[c] = fn?.ops ? dispatch([d, ...fn.ops], fn.tail) : dispatch([d], fn);
|
|
176
|
+
lookup[c] = fn?.ops ? dispatch([d, ...fn.ops].sort((a, b) => b.l - a.l), fn.tail) : dispatch([d], fn);
|
|
166
177
|
|
|
167
178
|
// Skip space chars, return first non-space character.
|
|
168
179
|
// Wrappers (comment, asi) compose by reading the previous parse.space first.
|
package/subscript.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var p,
|
|
2
|
-
`),o=e.pop(),n=
|
|
3
|
-
${n}${
|
|
4
|
-
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},
|
|
1
|
+
var l,p,m=r=>(l=0,p=r,m.enter?.(),r=A(),p[l]?E():r||""),E=(r="Unexpected token",t=l,e=p.slice(0,t).split(`
|
|
2
|
+
`),o=e.pop(),n=p.slice(Math.max(0,t-40),t),s="\u032D",f=(p[t]||" ")+s,d=p.slice(t+1,t+20))=>{throw SyntaxError(`${r} at ${e.length+1}:${o.length+1}
|
|
3
|
+
${n}${f}${d}`)},Sr=(r,t=l)=>(Array.isArray(r)&&(r.loc=t),r),R=(r,t=l,e)=>{for(;e=r(p.charCodeAt(l));)l+=e;return p.slice(t,l)},S=(r=1)=>p[l+=r],jr=r=>l=r,A=(r=0,t)=>{let e,o,n;for(t&&m.enter?.(r,t);(e=m.space())&&e!==t&&(n=m.step(o,r,e,A));)o=n;return t&&(e==t?(l++,m.exit?.(r,t)):E("Unclosed "+String.fromCharCode(t-(t>42?2:1)))),o},wr=(r=l)=>{for(;p.charCodeAt(r)<=32;)r++;return p.charCodeAt(r)},ar=m.id=r=>r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||r==36||r==95||r>=192&&r!=215&&r!=247,br=(r,t=r.length)=>p.substr(l,t)===r&&!m.id(p.charCodeAt(l+t)),rt=()=>(S(),A(0,41)),C=[],L={},g=(r,t=32,e,o=r.charCodeAt(0))=>q({op:r,l:r.length,p:L[r]=!C[o]&&L[r]||t,map:e,word:r.toUpperCase()!==r,kw:!1}),c=(r,t,e=!1)=>g(r,t,(o,n)=>o&&(n=A(t-(e?.5:0)))&&[r,o,n]),w=(r,t,e)=>g(r,t,o=>e?o&&[r,o]:!o&&(o=A(t-.5))&&[r,o]),tt=(r,t)=>g(r,200,e=>!e&&[,t]),M=(r,t,e,o)=>g(r,t,(n,s,f=n)=>(s=A(t-(e?.5:0)),n?.[0]!==r&&(n=[r,n||null]),s?.[0]===r?n.push(...s.slice(1)):s?n.push(s):o||wr()===r.charCodeAt(0)?n.push(null):f&&n.length===2&&(n=n[1]),n)),v=(r,t)=>g(r[0],t,e=>!e&&[r,A(0,r.charCodeAt(1))||null]),x=(r,t)=>g(r[0],t,e=>e&&[r,e,A(0,r.charCodeAt(1))||null]),yr=(r,t)=>(m.space(),t=p.charCodeAt(l),m.id(t)&&(t<48||t>57)?R(m.id):A(r)),W=(r,t)=>g(r,t,(e,o)=>e&&(o=yr(t))&&[r,e,o]),et=(r,t,e)=>(L[r]??=t,q({op:r,l:r.length,p:t,map:e,word:!0,kw:!0})),K=(r,t,e=[],o=r.filter(s=>s.l<2),n=(s,f,d,Q=l,G,h,T,H=e[p.charCodeAt(l+1)]||o)=>{for(T=0;h=H[T++];)if(!(h.kw&&s)&&!(d?h.op!==d:!((h.l<3||p.substr(l,h.l)===h.op)&&(!h.word||!m.id(p.charCodeAt(l+h.l)))&&(d=h.op)))&&!(f>=h.p)&&!(h.kw&&m.prop&&!m.prop(l+h.l))){if(l+=h.l,G=h.map(s))return Sr(G,Q);l=Q,d=0,h.word||s||t||H[T]||E()}return t?.(s,f,d)})=>{for(let s of r)s.l>1&&(e[s.op.charCodeAt(1)]||=[]).push(s);return e.forEach(s=>s.push(...o)),n.ops=r,n.tail=t,n},q=(r,t=r.op.charCodeAt(0),e=C[t])=>C[t]=e?.ops?K([r,...e.ops].sort((o,n)=>n.l-o.l),e.tail):K([r],e);m.space=r=>{for(;(r=p.charCodeAt(l))<=32;)l++;return r};m.step=(r,t,e,o,n)=>(n=C[e])&&n(r,t)||(r?null:R(m.id)||null);var N={},u=(r,t,e=N[r])=>N[r]=(...o)=>t(...o)||e?.(...o),i=r=>Array.isArray(r)?r[0]==null?(t=>()=>t)(r[1]):N[r[0]]?.(...r.slice(1))??E(`Unknown operator: ${r[0]}`,r?.loc):i.id(r);i.id=r=>r===void 0?()=>{}:t=>t?.[r];var O=46,y=48,D=57,z=69,J=101,Dr=43,Rr=45,V=95,Pr=97,_r=102,Fr=65,Ur=70,Y=r=>r.indexOf("_")<0?r:r.replaceAll("_",""),Ir=r=>r===O&&(r=p.charCodeAt(l+1))!==O&&!(m.id(r)&&r>D&&r!==J&&r!==z)||r>=y&&r<=D||r===V||((r===z||r===J)&&((r=p.charCodeAt(l+1))>=y&&r<=D||r===Dr||r===Rr)?2:0),$=r=>(r=+Y(R(Ir)))!=r?E():[,r],Tr=r=>t=>t===V||t>=y&&t<=D&&t-y<r||r===16&&(t>=Pr&&t<=_r||t>=Fr&&t<=Ur);m.number=null;C[O]=r=>!r&&p.charCodeAt(l+1)>=y&&p.charCodeAt(l+1)<=D&&$();for(let r=y;r<=D;r++)C[r]=t=>t?void 0:$();C[y]=(r,t)=>{if(!r){for(let e in m.number)if(e[0]==="0"&&(p.charCodeAt(l+1)|32)===e.charCodeAt(1)){S(2);let o=Y(R(Tr(t=m.number[e])));return[,parseInt(o,t)]}return $()}};var or=92,Z=34,j=39,a=117,b=120,nr=123,Lr=125,rr=10,Nr=13,Mr={n:`
|
|
4
|
+
`,r:"\r",t:" ",b:"\b",f:"\f",v:"\v",0:"\0"},tr=r=>r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1,er=r=>{if(p.charCodeAt(r)!==or)return;let t=p.charCodeAt(r+1);if(t===b||t===a&&p.charCodeAt(r+2)!==nr){let e=t===b?2:4,o=0,n;for(let s=0;s<e;s++){if((n=tr(p.charCodeAt(r+2+s)))<0)return;o=o*16+n}return[o,2+e]}if(t===a){let e=0,o=r+3,n;for(;(n=tr(p.charCodeAt(o)))>=0;)e=e*16+n,o++;if(o>r+3&&e<=1114111&&p.charCodeAt(o)===Lr)return[e,o-r+1]}},xr=()=>{let r=p.charCodeAt(l+1);if(r===rr)return["",2];if(r===Nr)return["",p.charCodeAt(l+2)===rr?3:2];let t=er(l);if(t){let[e,o]=t;if(e>=55296&&e<=56319){let n=er(l+o);n&&n[0]>=56320&&n[0]<=57343&&(e=65536+(e-55296)*1024+n[0]-56320,o+=n[1])}return[String.fromCodePoint(e),o]}return[Mr[p[l+1]]||p[l+1],2]},Or=(r,t=!1)=>{let e=l,o,n;for(;(n=p.charCodeAt(l))-r&&!(t&&(n===0||n===36&&p.charCodeAt(l+1)===nr));){if(n!==or){S();continue}o||(o=[]),o.push(p.slice(e,l));let[f,d]=xr();o.push(f),S(d),e=l}let s=p.slice(e,l);return o?(o.push(s),o.join("")):s},ir=r=>(t,e,o="",n=String.fromCharCode(r))=>{if(!(t||!m.string?.[n]))return S(),o+=Or(r),p[l]===n?S():E("Bad string"),[,o]};C[Z]=ir(Z);C[j]=ir(j);m.string={'"':!0};var $r=20;"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map(r=>c(r,$r,!0));var Xr=30,kr=40,Br=140;w("!",Br);c("||",Xr);c("&&",kr);var Qr=50,Gr=60,Hr=70,sr=100,Kr=140;c("|",Qr);c("&",Hr);c("^",Gr);c(">>",sr);c("<<",sr);w("~",Kr);var _=90;c("<",_);c(">",_);c("<=",_);c(">=",_);var lr=80;c("==",lr);c("!=",lr);var pr=110,X=120,ur=140;c("+",pr);c("-",pr);c("*",X);c("/",X);c("%",X);w("+",ur);w("-",ur);var F=150;g("++",F,r=>r?["++",r,null]:["++",A(F-1)]);g("--",F,r=>r?["--",r,null]:["--",A(F-1)]);var vr=5,Wr=10;M(",",Wr);M(";",vr,!0,!0);var qr=170;v("()",qr);var mr=170,zr=160;x("[]",mr);W(".",mr);x("()",zr);var cr=(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?cr(r[1],t):(()=>{throw Error("Invalid assignment target")})(),fr={"=":(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 fr)u(r,(t,e)=>(e=i(e),cr(t,(o,n,s)=>fr[r](o,n,e(s)))));u("!",r=>(r=i(r),t=>!r(t)));u("||",(r,t)=>(r=i(r),t=i(t),e=>r(e)||t(e)));u("&&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&&t(e)));u("~",r=>(r=i(r),t=>~r(t)));u("|",(r,t)=>(r=i(r),t=i(t),e=>r(e)|t(e)));u("&",(r,t)=>(r=i(r),t=i(t),e=>r(e)&t(e)));u("^",(r,t)=>(r=i(r),t=i(t),e=>r(e)^t(e)));u(">>",(r,t)=>(r=i(r),t=i(t),e=>r(e)>>t(e)));u("<<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<<t(e)));u(">",(r,t)=>(r=i(r),t=i(t),e=>r(e)>t(e)));u("<",(r,t)=>(r=i(r),t=i(t),e=>r(e)<t(e)));u(">=",(r,t)=>(r=i(r),t=i(t),e=>r(e)>=t(e)));u("<=",(r,t)=>(r=i(r),t=i(t),e=>r(e)<=t(e)));u("==",(r,t)=>(r=i(r),t=i(t),e=>r(e)==t(e)));u("!=",(r,t)=>(r=i(r),t=i(t),e=>r(e)!=t(e)));u("+",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)+t(e)):(r=i(r),e=>+r(e)));u("-",(r,t)=>t!==void 0?(r=i(r),t=i(t),e=>r(e)-t(e)):(r=i(r),e=>-r(e)));u("*",(r,t)=>(r=i(r),t=i(t),e=>r(e)*t(e)));u("/",(r,t)=>(r=i(r),t=i(t),e=>r(e)/t(e)));u("%",(r,t)=>(r=i(r),t=i(t),e=>r(e)%t(e)));var k=(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?k(r[1],t):(()=>{throw Error("Invalid increment target")})();u("++",(r,t)=>k(r,t===null?(e,o)=>e[o]++:(e,o)=>++e[o]));u("--",(r,t)=>k(r,t===null?(e,o)=>e[o]--:(e,o)=>--e[o]));var dr=(...r)=>(r=r.map(i),t=>{let e;for(let o of r)e=o(t);return e});u(",",dr);u(";",dr);var hr=r=>r!=null&&(typeof r=="object"||typeof r=="function"),I=r=>hr(r)?Reflect.ownKeys({[r]:0})[0]:r,P=r=>typeof r=="string"&&(r[0]==="_"&&r[1]==="_"||r==="constructor"||r==="prototype"),Jr=r=>P(I(r));i.id=r=>r===void 0||Jr(r)?()=>{}:t=>t?.[r];var U=r=>{throw Error(r)};u("[]",(r,t)=>t===void 0?(r=r?r[0]===","?r.slice(1):[r]:[],r=r.map(e=>e==null?(()=>{}):e[0]==="..."?(e=i(e[1]),o=>e(o)):(e=i(e),o=>[e(o)])),e=>r.flatMap(o=>o(e))):(t==null&&U("Missing index"),r=i(r),t=i(t),e=>{let o=I(t(e));return P(o)?void 0:r(e)[o]}));u(".",(r,t)=>(r=i(r),t=I(t[0]?t:t[1]),P(t)?()=>{}:e=>r(e)[t]));u("()",(r,t)=>{if(t===void 0)return r==null?U("Empty ()"):i(r);let e=s=>s?.[0]===","&&s.slice(1).some(f=>f==null||e(f));e(t)&&U("Empty argument");let o=t?t[0]===","?(t=t.slice(1).map(i),s=>t.map(f=>f(s))):(t=i(t),s=>[t(s)]):()=>[],n=Cr(r);return n<0?()=>{}:Ar(r,n?(s,f,d)=>(f=I(f),P(f)?void 0:s[f](...o(d))):(s,f,d)=>s[f](...o(d)))});var Ar=(r,t,e,o)=>r==null?U("Empty ()"):r[0]==="()"&&r.length==2?Ar(r[1],t):typeof r=="string"?n=>t(n,r,n):r[0]==="."?(e=i(r[1]),o=r[2],n=>t(e(n),o,n)):r[0]==="?."?(e=i(r[1]),o=r[2],n=>{let s=e(n);return s==null?void 0:t(s,o,n)}):r[0]==="[]"&&r.length===3?(e=i(r[1]),o=i(r[2]),n=>t(e(n),o(n),n)):r[0]==="?.[]"?(e=i(r[1]),o=i(r[2]),n=>{let s=e(n);return s==null?void 0:t(s,o(n),n)}):(r=i(r),n=>t([r(n)],0,n)),B=r=>hr(r)?1:P(r)?-1:0,Cr=(r,t=r?.[0],e=r?.[2])=>typeof r=="string"?B(r):t==="()"&&r.length==2?Cr(r[1]):t==="."||t==="?."?B(e):(t==="[]"||t==="?.[]")&&r.length===3?Array.isArray(e)&&e[0]==null?B(e[1]):1:0;var gr=new WeakMap,Vr=(r,...t)=>typeof r=="string"?i(m(r)):gr.get(r)||gr.set(r,Yr(r,t)).get(r),Er=57344,Yr=(r,t)=>{let e=r.reduce((s,f,d)=>s+(d?String.fromCharCode(Er+d-1):"")+f,""),o=m(e),n=s=>{if(typeof s=="string"&&s.length===1){let f=s.charCodeAt(0)-Er,d;if(f>=0&&f<t.length)return d=t[f],Zr(d)?d:[,d]}return Array.isArray(s)?s.map(n):s};return i(n(o))},Zr=r=>typeof r=="string"||Array.isArray(r)&&(typeof r[0]=="string"||r[0]===void 0),bt=Vr;export{x as access,c as binary,i as compile,p as cur,bt as default,E as err,A as expr,v as group,ar as id,l as idx,et as keyword,tt as literal,Sr as loc,C as lookup,W as member,M as nary,R as next,u as operator,N as operators,rt as parens,m as parse,wr as peek,L as prec,yr as propName,jr as seek,S as skip,g as token,w as unary,br as word};
|