tjs-lang 0.2.7 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/demo/docs.json +32 -26
  2. package/demo/src/examples.ts +23 -83
  3. package/demo/src/playground-shared.ts +666 -0
  4. package/demo/src/tjs-playground.ts +65 -550
  5. package/demo/src/ts-examples.ts +5 -4
  6. package/demo/src/ts-playground.ts +50 -414
  7. package/dist/index.js +143 -160
  8. package/dist/index.js.map +12 -12
  9. package/dist/src/lang/emitters/js.d.ts +34 -2
  10. package/dist/src/lang/index.d.ts +1 -1
  11. package/dist/src/lang/types.d.ts +1 -1
  12. package/dist/src/types/Type.d.ts +3 -1
  13. package/dist/tjs-full.js +143 -160
  14. package/dist/tjs-full.js.map +12 -12
  15. package/dist/tjs-transpiler.js +122 -55
  16. package/dist/tjs-transpiler.js.map +9 -8
  17. package/dist/tjs-vm.js +14 -14
  18. package/dist/tjs-vm.js.map +5 -5
  19. package/docs/docs.json +792 -0
  20. package/docs/index.js +2652 -2835
  21. package/docs/index.js.map +11 -10
  22. package/editors/codemirror/ajs-language.ts +27 -1
  23. package/editors/codemirror/autocomplete.test.ts +3 -3
  24. package/package.json +1 -1
  25. package/src/lang/codegen.test.ts +11 -11
  26. package/src/lang/emitters/from-ts.ts +1 -1
  27. package/src/lang/emitters/js.ts +228 -4
  28. package/src/lang/index.ts +0 -3
  29. package/src/lang/inference.ts +40 -8
  30. package/src/lang/lang.test.ts +192 -35
  31. package/src/lang/roundtrip.test.ts +155 -0
  32. package/src/lang/runtime.ts +7 -0
  33. package/src/lang/types.ts +2 -0
  34. package/src/lang/typescript-syntax.test.ts +6 -4
  35. package/src/lang/wasm.test.ts +20 -0
  36. package/src/lang/wasm.ts +143 -0
  37. package/src/types/Type.test.ts +64 -0
  38. package/src/types/Type.ts +22 -1
  39. package/src/use-cases/transpiler-integration.test.ts +10 -10
  40. package/src/vm/atoms/batteries.ts +2 -0
package/dist/tjs-vm.js CHANGED
@@ -1,24 +1,24 @@
1
- import{s as q,validate as J1,filter as k1}from"tosijs-schema";class o{$error=!0;message;op;cause;constructor(Q,Z,Y){this.message=Q,this.op=Z,this.cause=Y}toString(){return`AgentError[${this.op}]: ${this.message}`}toJSON(){return{$error:!0,message:this.message,op:this.op}}}function kZ(Q){return Q instanceof o||Q&&Q.$error===!0}var A0=new Map,a8=3600000,o8=102400,X1="proc_";function W1(Q){return typeof Q==="string"&&Q.startsWith(X1)}function K1(Q){let Z=A0.get(Q);if(!Z)throw Error(`Procedure not found: ${Q}`);if(Date.now()>Z.expiresAt)throw A0.delete(Q),Error(`Procedure expired: ${Q}`);return Z.ast}function s8(){if(typeof crypto<"u"&&crypto.randomUUID)return X1+crypto.randomUUID();return X1+Math.random().toString(36).slice(2)+Date.now().toString(36)}var v1=new Set(["__proto__","constructor","prototype"]);function P1(Q){if(v1.has(Q))throw Error(`Security Error: Access to '${Q}' is forbidden`)}var r8=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","metadata.google.internal"]);function t8(Q){try{let Z=new URL(Q);if(Z.protocol!=="http:"&&Z.protocol!=="https:")return!0;let Y=Z.hostname.toLowerCase();if(r8.has(Y))return!0;if(Y.endsWith(".internal")||Y.endsWith(".local"))return!0;if(Y==="169.254.169.254")return!0;if(/^10\./.test(Y)||/^192\.168\./.test(Y)||/^172\.(1[6-9]|2\d|3[01])\./.test(Y))return!0;return!1}catch{return!0}}function e8(Q){if(/\([^)]*[+*][^)]*\)[+*]/.test(Q))return!0;if(/\(([^|)]+)\|\1\)[+*]/.test(Q))return!0;if(/\(\.\*\)\+/.test(Q))return!0;if(/\(\.\+\)\+/.test(Q))return!0;if(/\(\[.*\]\+\)\+/.test(Q))return!0;return!1}function R0(Q){return{...Q,state:Object.create(Q.state)}}function Q9(Q,Z){let Y={},J=new Set([...Object.keys(Q),...Object.keys(Z)]);for(let X of J){let K=Q[X],W=Z[X];if(W!==K)Y[X]=W}return Y}function U(Q,Z){if(Q&&typeof Q==="object"&&Q.$kind==="arg")return Z.args[Q.path];if(Q&&typeof Q==="object"&&Q.$expr)return x(Q,Z);if(typeof Q==="string"){if(Q.startsWith("args.")&&!("args"in Z.state))return Z.args[Q.replace("args.","")];if(Q.includes(".")){let Y=Q.split(".");for(let X of Y)if(v1.has(X))throw Error(`Security Error: Access to '${X}' is forbidden`);let J=Z.state[Y[0]];if(J!==void 0){for(let X=1;X<Y.length;X++)J=J?.[Y[X]];return J}}if(Q in Z.state)return Z.state[Q];return Q}if(Q&&typeof Q==="object"&&!Array.isArray(Q)&&Q.constructor===Object){let Y={};for(let J of Object.keys(Q))Y[J]=U(Q[J],Z);return Y}if(Array.isArray(Q))return Q.map((Y)=>U(Y,Z));return Q}function B0(Q,Z,Y){return new Proxy(Z,{get(J,X){if(X in J)return J[X];let K=Y?.[X];if(K)throw Error(`${Q}.${X} is not available. ${K}`);throw Error(`${Q}.${X} is not supported in AsyncJS. Check docs for available ${Q} methods.`)}})}function w0(Q){if(Q===null)return{type:"null"};if(Q===void 0)return{};if(typeof Q==="object"&&Q!==null&&"type"in Q&&typeof Q.type==="string")return Q;if(typeof Q==="object"&&Q!==null&&"schema"in Q&&typeof Q.schema==="object")return Q.schema;let Z=typeof Q;if(Z==="string")return{type:"string"};if(Z==="number")return Number.isInteger(Q)?{type:"integer"}:{type:"number"};if(Z==="boolean")return{type:"boolean"};if(Array.isArray(Q)){if(Q.length===0)return{type:"array"};return{type:"array",items:w0(Q[0])}}if(Z==="object"){let Y={},J=[];for(let[X,K]of Object.entries(Q))Y[X]=w0(K),J.push(X);return{type:"object",properties:Y,required:J}}return{}}var G0={Math:B0("Math",{PI:Math.PI,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,SQRT2:Math.SQRT2,SQRT1_2:Math.SQRT1_2,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc,sign:Math.sign,sqrt:Math.sqrt,cbrt:Math.cbrt,pow:Math.pow,exp:Math.exp,expm1:Math.expm1,log:Math.log,log2:Math.log2,log10:Math.log10,log1p:Math.log1p,sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,atan2:Math.atan2,sinh:Math.sinh,cosh:Math.cosh,tanh:Math.tanh,asinh:Math.asinh,acosh:Math.acosh,atanh:Math.atanh,hypot:Math.hypot,min:Math.min,max:Math.max,clz32:Math.clz32,imul:Math.imul,fround:Math.fround,random:()=>{if(typeof crypto<"u"&&crypto.getRandomValues){let Q=new Uint32Array(1);return crypto.getRandomValues(Q),Q[0]/4294967296}return Math.random()}}),JSON:B0("JSON",{parse:(Q)=>JSON.parse(Q),stringify:(Q,Z,Y)=>JSON.stringify(Q,Z,Y)}),console:B0("console",{log:(...Q)=>{return},warn:(...Q)=>{return},error:(...Q)=>{return},info:(...Q)=>{return}},{table:"Use console.log with JSON.stringify for structured data.",dir:"Use console.log instead.",trace:"Stack traces are not available in AsyncJS."}),Array:B0("Array",{isArray:(Q)=>Array.isArray(Q),from:(Q,Z,Y)=>Array.from(Q,Z,Y),of:(...Q)=>Array.of(...Q)},{prototype:"Prototype access is not allowed."}),Object:B0("Object",{keys:(Q)=>Object.keys(Q),values:(Q)=>Object.values(Q),entries:(Q)=>Object.entries(Q),fromEntries:(Q)=>Object.fromEntries(Q),assign:(Q,...Z)=>Object.assign({},Q,...Z),hasOwn:(Q,Z)=>Object.hasOwn(Q,Z)},{prototype:"Prototype access is not allowed.",create:"Use object literals instead.",defineProperty:"Property descriptors are not supported.",getPrototypeOf:"Prototype access is not allowed.",setPrototypeOf:"Prototype modification is not allowed."}),String:B0("String",{fromCharCode:(...Q)=>String.fromCharCode(...Q),fromCodePoint:(...Q)=>String.fromCodePoint(...Q)}),Number:B0("Number",{isNaN:Number.isNaN,isFinite:Number.isFinite,isInteger:Number.isInteger,isSafeInteger:Number.isSafeInteger,parseFloat,parseInt,MAX_VALUE:Number.MAX_VALUE,MIN_VALUE:Number.MIN_VALUE,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,POSITIVE_INFINITY:Number.POSITIVE_INFINITY,NEGATIVE_INFINITY:Number.NEGATIVE_INFINITY,NaN:Number.NaN,EPSILON:Number.EPSILON}),parseInt,parseFloat,isNaN,isFinite,encodeURI,decodeURI,encodeURIComponent,decodeURIComponent,undefined:void 0,null:null,NaN:NaN,Infinity:1/0,filter:(Q,Z)=>{let Y=w0(Z),J=k1(Q,Y);if(J instanceof Error)throw J;return J},Schema:{...q,response:(Q,Z)=>{let Y=Z?.schema!=null?Z.schema:w0(Z);return{type:"json_schema",json_schema:{name:Q,strict:!0,schema:Y}}},fromExample:(Q)=>w0(Q),isValid:(Q,Z)=>{if(Z?.schema!=null)return J1(Q,Z);return J1(Q,w0(Z))}},Set:(Q=[])=>{let Z=[...new globalThis.Set(Q)];return{add(Y){if(!Z.includes(Y))Z.push(Y);return this},remove(Y){let J=Z.indexOf(Y);if(J!==-1)Z.splice(J,1);return this},clear(){return Z.length=0,this},has(Y){return Z.includes(Y)},get size(){return Z.length},toArray(){return[...Z]},union(Y){let J=Y?.toArray?.()??Y??[];return G0.Set([...Z,...J])},intersection(Y){let J=Y?.toArray?.()??Y??[];return G0.Set(Z.filter((X)=>J.includes(X)))},diff(Y){let J=Y?.toArray?.()??Y??[];return G0.Set(Z.filter((X)=>!J.includes(X)))},forEach(Y){Z.forEach(Y)},map(Y){return G0.Set(Z.map(Y))},filter(Y){return G0.Set(Z.filter(Y))},toJSON(){return[...Z]}}},Date:(()=>{let Q=(Y)=>({get value(){return Y.toISOString()},get timestamp(){return Y.getTime()},get year(){return Y.getFullYear()},get month(){return Y.getMonth()+1},get day(){return Y.getDate()},get hours(){return Y.getHours()},get minutes(){return Y.getMinutes()},get seconds(){return Y.getSeconds()},get dayOfWeek(){return Y.getDay()},add({years:J=0,months:X=0,days:K=0,hours:W=0,minutes:H=0,seconds:G=0,ms:_=0}={}){let F=new globalThis.Date(Y.getTime());if(J)F.setFullYear(F.getFullYear()+J);if(X)F.setMonth(F.getMonth()+X);if(K)F.setDate(F.getDate()+K);if(W)F.setHours(F.getHours()+W);if(H)F.setMinutes(F.getMinutes()+H);if(G)F.setSeconds(F.getSeconds()+G);if(_)F.setMilliseconds(F.getMilliseconds()+_);return Q(F)},diff(J,X="ms"){let K=typeof J==="object"&&J.timestamp?J.timestamp:new globalThis.Date(J).getTime(),W=Y.getTime()-K;switch(X){case"seconds":return W/1000;case"minutes":return W/60000;case"hours":return W/3600000;case"days":return W/86400000;default:return W}},format(J="ISO"){if(J==="ISO")return Y.toISOString();if(J==="date")return Y.toISOString().split("T")[0];if(J==="time")return Y.toISOString().split("T")[1].split(".")[0];return J.replace("YYYY",String(Y.getFullYear())).replace("MM",String(Y.getMonth()+1).padStart(2,"0")).replace("DD",String(Y.getDate()).padStart(2,"0")).replace("HH",String(Y.getHours()).padStart(2,"0")).replace("mm",String(Y.getMinutes()).padStart(2,"0")).replace("ss",String(Y.getSeconds()).padStart(2,"0"))},isBefore(J){let X=typeof J==="object"&&J.timestamp?J.timestamp:new globalThis.Date(J).getTime();return Y.getTime()<X},isAfter(J){let X=typeof J==="object"&&J.timestamp?J.timestamp:new globalThis.Date(J).getTime();return Y.getTime()>X},toString(){return Y.toISOString()},toJSON(){return Y.toISOString()}}),Z=(Y)=>{let J=Y!==void 0?new globalThis.Date(Y):new globalThis.Date;if(isNaN(J.getTime()))throw Error(`Invalid date: ${Y}`);return Q(J)};return Z.now=()=>globalThis.Date.now(),Z.parse=(Y)=>Q(new globalThis.Date(Y)),Z})()},h0={RegExp:"RegExp is not available. Use string methods or the regexMatch atom.",Promise:"Promise is not needed. All operations are implicitly async.",Map:"Map is not available. Use plain objects instead.",WeakSet:"WeakSet is not available.",WeakMap:"WeakMap is not available.",Symbol:"Symbol is not available.",Proxy:"Proxy is not available.",Reflect:"Reflect is not available.",Function:"Function constructor is not available. Define functions normally.",eval:"eval is not available. Code is compiled, not evaluated.",setTimeout:"setTimeout is not available. Use the delay atom.",setInterval:"setInterval is not available. Use while loops with delay.",fetch:"fetch is not available. Use the httpFetch atom.",require:"require is not available. Atoms must be registered with the VM.",import:"import is not available. Atoms must be registered with the VM.",process:"process is not available. AsyncJS runs in a sandboxed environment.",window:"window is not available. AsyncJS runs in a sandboxed environment.",document:"document is not available. AsyncJS runs in a sandboxed environment.",global:"global is not available. AsyncJS runs in a sandboxed environment.",globalThis:"globalThis is not available. Use builtins directly."},Z9=0.01,C1=0.0001,b1=0.001,Y9=new Set(["concat","slice","map","filter","flatMap","flat","toReversed","toSorted","toSpliced","repeat","padStart","padEnd","split","join","replace","replaceAll","substring","substr","trim","trimStart","trimEnd","toLowerCase","toUpperCase","match","matchAll","parse","stringify"]);function x(Q,Z){if(Q===null||Q===void 0)return Q;if(typeof Q!=="object"||!("$expr"in Q))return Q;if(Z.fuel){if(Z.fuel.current-=Z9,Z.fuel.current<=0)throw Error("Out of Fuel")}switch(Q.$expr){case"literal":return Q.value;case"ident":{if(Q.name in Z.state)return Z.state[Q.name];if(Q.name in Z.args)return Z.args[Q.name];if(Q.name in G0)return G0[Q.name];if(Q.name in h0)throw Error(h0[Q.name]);return}case"member":{let Y=x(Q.object,Z);if(Q.optional&&(Y===null||Y===void 0))return;let J=Q.property;return P1(J),Y?.[J]}case"binary":{let Y=x(Q.left,Z),J=x(Q.right,Z);switch(Q.op){case"+":{let X=Y+J;if(typeof X==="string"&&Z.fuel){if(Z.fuel.current-=X.length*C1,Z.fuel.current<=0){Z.error=new o("Out of Fuel","expr.concat");return}}return X}case"-":return Y-J;case"*":return Y*J;case"/":return Y/J;case"%":return Y%J;case"**":return Y**J;case">":return Y>J;case"<":return Y<J;case">=":return Y>=J;case"<=":return Y<=J;case"==":return Y==J;case"!=":return Y!=J;case"===":return Y===J;case"!==":return Y!==J;default:throw Error(`Unknown binary operator: ${Q.op}`)}}case"unary":{let Y=x(Q.argument,Z);switch(Q.op){case"!":return!Y;case"-":return-Y;case"+":return+Y;case"typeof":return typeof Y;default:throw Error(`Unknown unary operator: ${Q.op}`)}}case"logical":{let Y=x(Q.left,Z);if(Q.op==="&&")return Y?x(Q.right,Z):Y;else if(Q.op==="??")return Y??x(Q.right,Z);else return Y?Y:x(Q.right,Z)}case"conditional":return x(Q.test,Z)?x(Q.consequent,Z):x(Q.alternate,Z);case"array":return Q.elements.map((Y)=>x(Y,Z));case"object":{let Y={};for(let J of Q.properties)Y[J.key]=x(J.value,Z);return Y}case"call":{if(Q.callee==="Error"){let J=Q.arguments.map((K)=>x(K,Z)),X=typeof J[0]==="string"?J[0]:"Error";Z.error=new o(X,"Error");return}if(Q.callee in G0){let J=G0[Q.callee];if(typeof J==="function"){let X=Q.arguments.map((K)=>x(K,Z));return J(...X)}}if(!Z.resolver(Q.callee)){if(Q.callee in h0)throw Error(h0[Q.callee]);throw Error(`Unknown function: ${Q.callee}`)}throw Error(`Atom calls in expressions not yet supported: ${Q.callee}`)}case"methodCall":{let Y=x(Q.object,Z);if(Q.optional&&(Y===null||Y===void 0))return;let J=Q.method;if(P1(J),Y===null||Y===void 0)throw Error(`Cannot call method '${J}' on ${Y}`);let X=Y[J];if(typeof X!=="function")throw Error(`'${J}' is not a function`);let K=Q.arguments.map((H)=>x(H,Z)),W=X.apply(Y,K);if(Z.fuel&&Y9.has(J)){let H=0;if(typeof W==="string")H=W.length*C1;else if(Array.isArray(W))H=W.length*b1;else if(typeof W==="object"&&W!==null)H=Object.keys(W).length*b1;if(Z.fuel.current-=H,Z.fuel.current<=0){Z.error=new o("Out of Fuel",`expr.${J}`);return}}return W}default:throw Error(`Unknown expression type: ${Q.$expr}`)}}function w(Q,Z,Y,J,X={}){let{docs:K="",timeoutMs:W=1000,cost:H=1}=typeof X==="string"?{docs:X}:X;return{op:Q,inputSchema:Z,outputSchema:Y,exec:async(_,F)=>{let{op:O,result:R,...$}=_;if(F.error)return;let M=F.trace?{...F.state}:null,L=F.fuel.current,B,I;try{let D=F.costOverrides?.[Q],v=D!==void 0?D:H,P=typeof v==="function"?v($,F):v;if((F.fuel.current-=P)<=0){F.error=new o("Out of Fuel",Q);return}let E,S=async()=>J(_,F);if(B=W>0?await Promise.race([S(),new Promise((k,y)=>{E=setTimeout(()=>y(Error(`Atom '${Q}' timed out`)),W)})]).finally(()=>clearTimeout(E)):await S(),_.result){if(F.consts.has(_.result))throw Error(`Cannot reassign const variable '${_.result}'`);if(B!==void 0&&Y&&!J1(B,Y)){F.error=new o(`Output validation failed for '${Q}'`,Q);return}if(F.state[_.result]=B,_.resultConst)F.consts.add(_.result)}}catch(D){I=D.message||String(D),F.error=new o(I,Q,D)}finally{if(F.trace&&M){let D=Q9(M,F.state);F.trace.push({op:Q,input:$,stateDiff:D,result:B,error:I,fuelBefore:L,fuelAfter:F.fuel.current,timestamp:new Date().toISOString()})}}},docs:K,timeoutMs:W,cost:H,create:(_)=>({op:Q,..._})}}var s=w("seq",q.object({steps:q.array(q.any)}),void 0,async({steps:Q},Z)=>{for(let Y of Q){if(Z.output!==void 0)return;if(Z.error)return;let J=Z.resolver(Y.op);if(!J)throw Error(`Unknown Atom: ${Y.op}`);await J.exec(Y,Z)}},{docs:"Sequence",timeoutMs:0,cost:0.1}),J9=w("if",q.object({condition:q.any,then:q.array(q.any),else:q.array(q.any).optional}),void 0,async(Q,Z)=>{if(x(Q.condition,Z))await s.exec({op:"seq",steps:Q.then},Z);else if(Q.else)await s.exec({op:"seq",steps:Q.else},Z)},{docs:"If/Else",timeoutMs:0,cost:0.1}),X9=w("while",q.object({condition:q.any,body:q.array(q.any)}),void 0,async(Q,Z)=>{while(x(Q.condition,Z)){if(Z.signal?.aborted)throw Error("Execution aborted");if((Z.fuel.current-=0.1)<=0)throw Error("Out of Fuel");if(await s.exec({op:"seq",steps:Q.body},Z),Z.output!==void 0)return}},{docs:"While Loop",timeoutMs:0,cost:0.1}),W9=w("return",void 0,q.any,async(Q,Z)=>{if(Z.error)return Z.output=Z.error,Z.error;if("value"in Q){let J=U(Q.value,Z);return Z.output=J,J}let Y={};if(Q.schema?.properties){for(let J of Object.keys(Q.schema.properties))Y[J]=Z.state[J];if(Q.filter!==!1){let J=k1(Y,Q.schema);if(!(J instanceof Error))Y=J}}return Z.output=Y,Y},{docs:"Return",cost:0.1}),K9=w("try",q.object({try:q.array(q.any),catch:q.array(q.any).optional,catchParam:q.string.optional}),void 0,async(Q,Z)=>{if(await s.exec({op:"seq",steps:Q.try},Z),Z.error&&Q.catch){let Y=Q.catchParam||"error";Z.state[Y]=Z.error.message,Z.state.errorOp=Z.error.op,Z.error=void 0,await s.exec({op:"seq",steps:Q.catch},Z)}},{docs:"Try/Catch",timeoutMs:0,cost:0.1}),H9=w("Error",q.object({args:q.array(q.any).optional}),void 0,async(Q,Z)=>{let Y=Q.args?.[0]??"Error";Z.error=new o(String(Y),"Error")},{docs:"Trigger error flow",cost:0.1}),z9=w("varSet",q.object({key:q.string,value:q.any}),void 0,async({key:Q,value:Z},Y)=>{if(Y.consts.has(Q))throw Error(`Cannot reassign const variable '${Q}'`);Y.state[Q]=U(Z,Y)},{docs:"Set Variable",cost:0.1}),G9=w("constSet",q.object({key:q.string,value:q.any}),void 0,async({key:Q,value:Z},Y)=>{if(Y.consts.has(Q))throw Error(`Cannot reassign const variable '${Q}'`);if(Q in Y.state)throw Error(`Cannot redeclare variable '${Q}' as const`);Y.state[Q]=U(Z,Y),Y.consts.add(Q)},{docs:"Set Const Variable (immutable)",cost:0.1}),_9=w("varGet",q.object({key:q.string}),q.any,async({key:Q},Z)=>{return U(Q,Z)},{docs:"Get Variable",cost:0.1}),q9=w("varsImport",q.object({keys:q.union([q.array(q.string),q.record(q.string)])}),void 0,async({keys:Q},Z)=>{if(Array.isArray(Q))for(let Y of Q)Z.state[Y]=U({$kind:"arg",path:Y},Z);else for(let[Y,J]of Object.entries(Q))Z.state[Y]=U({$kind:"arg",path:J},Z)},{docs:"Import variables from args into the current scope, with optional renaming.",cost:0.2}),F9=w("varsLet",q.record(q.any),void 0,async(Q,Z)=>{for(let Y of Object.keys(Q)){if(Y==="op"||Y==="result")continue;Z.state[Y]=U(Q[Y],Z)}},{docs:"Initialize a set of variables in the current scope from the step object properties.",cost:0.1}),R9=w("varsExport",q.object({keys:q.union([q.array(q.string),q.record(q.string)])}),q.record(q.any),async({keys:Q},Z)=>{let Y={};if(Array.isArray(Q))for(let J of Q)Y[J]=U(J,Z);else for(let[J,X]of Object.entries(Q))Y[J]=U(X,Z);return Y},{docs:"Export variables from the current scope, with optional renaming.",cost:0.2}),$9=w("scope",q.object({steps:q.array(q.any)}),void 0,async({steps:Q},Z)=>{let Y=R0(Z);if(await s.exec({op:"seq",steps:Q},Y),Y.output!==void 0)Z.output=Y.output},{docs:"Create new scope",timeoutMs:0,cost:0.1}),O9=w("map",q.object({items:q.array(q.any),as:q.string,steps:q.array(q.any)}),q.array(q.any),async({items:Q,as:Z,steps:Y},J)=>{let X=[],K=U(Q,J);if(!Array.isArray(K))throw Error("map: items is not an array");for(let W of K){if(J.signal?.aborted)throw Error("Execution aborted");let H=R0(J);H.state[Z]=W,await s.exec({op:"seq",steps:Y},H),X.push(H.state.result??null)}return X},{docs:"Map Array",timeoutMs:0,cost:1}),U9=w("filter",q.object({items:q.array(q.any),as:q.string,condition:q.any}),q.array(q.any),async({items:Q,as:Z,condition:Y},J)=>{let X=[],K=U(Q,J);if(!Array.isArray(K))throw Error("filter: items is not an array");for(let W of K){if(J.signal?.aborted)throw Error("Execution aborted");let H=R0(J);if(H.state[Z]=W,x(Y,H))X.push(W)}return X},{docs:"Filter Array",timeoutMs:0,cost:1}),M9=w("reduce",q.object({items:q.array(q.any),as:q.string,accumulator:q.string,initial:q.any,steps:q.array(q.any)}),q.any,async({items:Q,as:Z,accumulator:Y,initial:J,steps:X},K)=>{let W=U(Q,K),H=U(J,K);if(!Array.isArray(W))throw Error("reduce: items is not an array");let G=H;for(let _ of W){if(K.signal?.aborted)throw Error("Execution aborted");let F=R0(K);F.state[Z]=_,F.state[Y]=G,await s.exec({op:"seq",steps:X},F),G=F.state.result??G}return G},{docs:"Reduce Array",timeoutMs:0,cost:1}),I9=w("find",q.object({items:q.array(q.any),as:q.string,condition:q.any}),q.any,async({items:Q,as:Z,condition:Y},J)=>{let X=U(Q,J);if(!Array.isArray(X))throw Error("find: items is not an array");for(let K of X){if(J.signal?.aborted)throw Error("Execution aborted");let W=R0(J);if(W.state[Z]=K,x(Y,W))return K}return null},{docs:"Find in Array",timeoutMs:0,cost:1}),B9=w("push",q.object({list:q.array(q.any),item:q.any}),q.array(q.any),async({list:Q,item:Z},Y)=>{let J=U(Q,Y),X=U(Z,Y);if(Array.isArray(J))J.push(X);return J},{docs:"Push to Array",cost:1}),j9=w("len",q.object({list:q.any}),q.number,async({list:Q},Z)=>{let Y=U(Q,Z);return Array.isArray(Y)||typeof Y==="string"?Y.length:0},{docs:"Length",cost:1}),N9=w("split",q.object({str:q.string,sep:q.string}),q.array(q.string),async({str:Q,sep:Z},Y)=>U(Q,Y).split(U(Z,Y)),{docs:"Split String",cost:1}),L9=w("join",q.object({list:q.array(q.string),sep:q.string}),q.string,async({list:Q,sep:Z},Y)=>U(Q,Y).join(U(Z,Y)),{docs:"Join String",cost:1}),w9=w("template",q.object({tmpl:q.string,vars:q.record(q.any)}),q.string,async({tmpl:Q,vars:Z},Y)=>{return U(Q,Y).replace(/\{\{(\w+)\}\}/g,(X,K)=>String(U(Z[K],Y)??""))},{docs:"String Template",cost:1}),A9=w("regexMatch",q.object({pattern:q.string,value:q.any}),q.boolean,async({pattern:Q,value:Z},Y)=>{if(e8(Q))throw Error(`Suspicious regex pattern rejected (potential ReDoS): ${Q}`);let J=U(Z,Y);return new RegExp(Q).test(J)},{docs:"Returns true if the value matches the regex pattern.",cost:2}),D9=w("pick",q.object({obj:q.record(q.any),keys:q.array(q.string)}),q.record(q.any),async({obj:Q,keys:Z},Y)=>{let J=U(Q,Y),X=U(Z,Y),K={};if(J&&Array.isArray(X))X.forEach((W)=>K[W]=J[W]);return K},{docs:"Pick Keys",cost:1}),V9=w("omit",q.object({obj:q.record(q.any),keys:q.array(q.string)}),q.record(q.any),async({obj:Q,keys:Z},Y)=>{let J=U(Q,Y),X=new Set(U(Z,Y)),K={};if(J)Object.keys(J).forEach((W)=>{if(!X.has(W))K[W]=J[W]});return K},{docs:"Omit Keys",cost:1}),P9=w("merge",q.object({a:q.record(q.any),b:q.record(q.any)}),q.record(q.any),async({a:Q,b:Z},Y)=>({...U(Q,Y),...U(Z,Y)}),{docs:"Merge Objects",cost:1}),C9=w("keys",q.object({obj:q.record(q.any)}),q.array(q.string),async({obj:Q},Z)=>Object.keys(U(Q,Z)??{}),{docs:"Object Keys",cost:1}),T1=10,S1="X-Agent-Depth";function b9(Q,Z){try{let J=new URL(Q).hostname.toLowerCase();for(let X of Z){let K=X.toLowerCase();if(K.startsWith("*.")){let W=K.slice(1);if(J.endsWith(W)||J===K.slice(2))return!0}else if(J===K)return!0}return!1}catch{return!1}}var T9=w("httpFetch",q.object({url:q.string,method:q.string.optional,headers:q.record(q.string).optional,body:q.any.optional,responseType:q.string.optional}),q.any,async(Q,Z)=>{let Y=U(Q.url,Z),J=U(Q.method,Z),X=U(Q.headers,Z)||{},K=U(Q.body,Z),W=U(Q.responseType,Z),H=Z.context?.requestDepth??0;if(H>=T1)throw Error(`Agent request depth exceeded (max ${T1}). This prevents recursive agent loops.`);if(Z.capabilities.fetch)return Z.capabilities.fetch(Y,{method:J,headers:{...X,[S1]:String(H+1)},body:K,signal:Z.signal,responseType:W});let G=Z.context?.allowedFetchDomains;if(G){if(!b9(Y,G))throw Error(`Fetch blocked: domain not in allowlist. Allowed: ${G.join(", ")}`)}else{if(t8(Y))throw Error("Blocked URL: private/internal addresses not allowed in default fetch");try{let F=new URL(Y).hostname.toLowerCase();if(F!=="localhost"&&F!=="127.0.0.1"&&F!=="[::1]")throw Error("Fetch blocked: no allowedFetchDomains configured. Set ctx.context.allowedFetchDomains or provide a custom fetch capability.")}catch(_){if(_.message.includes("allowedFetchDomains"))throw _;throw Error(`Invalid URL: ${Y}`)}}if(typeof globalThis.fetch==="function"){let _=await globalThis.fetch(Y,{method:J,headers:{...X,[S1]:String(H+1)},body:K?JSON.stringify(K):void 0,signal:Z.signal});if(W==="dataUrl"){let O=await _.arrayBuffer(),R=new Uint8Array(O),$="";for(let B=0;B<R.length;B++)$+=String.fromCharCode(R[B]);let M=btoa($);return`data:${_.headers.get("content-type")||"application/octet-stream"};base64,${M}`}let F=_.headers.get("content-type");if(W==="json"||F&&F.includes("application/json"))return _.json();return _.text()}throw Error("Capability 'fetch' missing and no global fetch available")},{docs:"HTTP Fetch",timeoutMs:30000,cost:5}),S9=w("storeGet",q.object({key:q.string}),q.any,async({key:Q},Z)=>{let Y=U(Q,Z);return Z.capabilities.store?.get(Y)},{docs:"Store Get",cost:5}),E9=w("storeSet",q.object({key:q.string,value:q.any}),void 0,async({key:Q,value:Z},Y)=>{let J=U(Q,Y),X=U(Z,Y);return Y.capabilities.store?.set(J,X)},{docs:"Store Set",cost:5}),k9=w("storeQuery",q.object({query:q.any}),q.array(q.any),async({query:Q},Z)=>Z.capabilities.store?.query?.(U(Q,Z))??[],{docs:"Store Query",cost:5}),v9=w("storeVectorSearch",q.object({collection:q.string.optional,vector:q.array(q.number),k:q.number.optional}),q.array(q.any),async({collection:Q,vector:Z,k:Y},J)=>J.capabilities.store?.vectorSearch?.(U(Q,J),U(Z,J),U(Y,J))??[],{docs:"Vector Search",cost:(Q,Z)=>5+(U(Q.k,Z)??5)}),y9=w("llmPredict",q.object({prompt:q.string,options:q.any.optional}),q.string,async({prompt:Q,options:Z},Y)=>{if(!Y.capabilities.llm?.predict)throw Error("Capability 'llm.predict' missing");return Y.capabilities.llm.predict(U(Q,Y),U(Z,Y))},{docs:"LLM Predict",timeoutMs:120000,cost:100}),g9=w("agentRun",q.object({agentId:q.any,input:q.any}),q.any,async({agentId:Q,input:Z},Y)=>{let J=U(Q,Y),X=U(Z,Y),K=X;if(X&&typeof X==="object"&&!Array.isArray(X)){K={};for(let H in X)K[H]=U(X[H],Y)}if(W1(J)){let H=K1(J),G={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},_=Y.resolver("seq");if(!_)throw Error("seq atom not found");if(await _.exec(H,G),G.error)throw Error(G.error.message||"Sub-agent failed");return G.output}if(J&&typeof J==="object"&&"op"in J){let H={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},G=Y.resolver("seq");if(!G)throw Error("seq atom not found");if(await G.exec(J,H),H.error)throw Error(H.error.message||"Sub-agent failed");return H.output}if(!Y.capabilities.agent?.run)throw Error("Capability 'agent.run' missing");let W=await Y.capabilities.agent.run(J,K);if(W&&typeof W==="object"&&"fuelUsed"in W&&typeof W.fuelUsed==="number"){if(W.error)throw Error(W.error.message||"Sub-agent failed");return W.result}return W},{docs:"Run Sub-Agent (accepts procedure token, AST, or agent ID)",cost:1}),f9=w("transpileCode",q.object({code:q.string}),q.any,async({code:Q},Z)=>{if(!Z.capabilities.code?.transpile)throw Error("Capability 'code.transpile' missing. Enable code transpilation by providing the code capability.");let Y=U(Q,Z);try{return Z.capabilities.code.transpile(Y)}catch(J){throw Error(`Code transpilation failed: ${J.message}`)}},{docs:"Transpile AsyncJS code to AST",cost:1}),E1=10,h9=w("runCode",q.object({code:q.string,args:q.record(q.any).optional}),q.any,async({code:Q,args:Z},Y)=>{let J=Y.runCodeDepth??0;if(J>=E1)throw Error(`runCode recursion limit exceeded (max ${E1}). This prevents infinite loops from dynamically generated code calling runCode.`);if(!Y.capabilities.code?.transpile)throw Error("Capability 'code.transpile' missing. Enable dynamic code execution by providing the code capability.");let X=U(Q,Y),K=Z?U(Z,Y):{},W;try{W=Y.capabilities.code.transpile(X)}catch(G){throw Error(`Code transpilation failed: ${G.message}`)}if(W.op!=="seq")throw Error("Transpiled code must be a seq node");let H=R0(Y);if(H.args=K,H.output=void 0,H.runCodeDepth=J+1,await s.exec(W,H),H.error){Y.error=H.error;return}return H.output},{docs:"Run dynamically generated AsyncJS code",cost:1}),m9=w("jsonParse",q.object({str:q.string}),q.any,async({str:Q},Z)=>JSON.parse(U(Q,Z)),{docs:"Parse JSON",cost:1}),x9=w("jsonStringify",q.object({value:q.any}),q.string,async({value:Q},Z)=>JSON.stringify(U(Q,Z)),{docs:"Stringify JSON",cost:1}),u9=w("xmlParse",q.object({str:q.string}),q.any,async({str:Q},Z)=>{if(!Z.capabilities.xml?.parse)throw Error("Capability 'xml.parse' missing");return Z.capabilities.xml.parse(U(Q,Z))},{docs:"Parse XML",cost:1}),d9=w("memoize",q.object({key:q.string.optional,steps:q.array(q.any)}),q.any,async({key:Q,steps:Z},Y)=>{if(!Y.memo)Y.memo=new Map;let J=U(Q,Y)??await H1.exec({value:Z,algorithm:"SHA-256"},Y);if(Y.memo.has(J))return Y.memo.get(J);let X=R0(Y);await s.exec({op:"seq",steps:Z},X);let K=X.output??X.state.result;return Y.memo.set(J,K),K},{docs:"Memoize steps result in memory",cost:1}),l9=w("cache",q.object({key:q.string.optional,steps:q.array(q.any),ttlMs:q.number.optional}),q.any,async({key:Q,steps:Z,ttlMs:Y},J)=>{if(!J.capabilities.store)throw Error("Capability 'store' missing for caching");let K=`cache:${U(Q,J)??await H1.exec({value:Z,algorithm:"SHA-256"},J)}`,W=await J.capabilities.store.get(K);if(W)if(typeof W==="object"&&W._exp){if(Date.now()<W._exp)return W.val}else return W;let H=R0(J);await s.exec({op:"seq",steps:Z},H);let G=H.output??H.state.result,_=Date.now()+(Y??86400000);if((J.fuel.current-=5)<=0)throw Error("Out of Fuel");return await J.capabilities.store.set(K,{val:G,_exp:_}),G},{docs:"Cache steps result in store with TTL",cost:5}),p9=w("random",q.object({min:q.number.optional,max:q.number.optional,format:q.string.optional,length:q.number.optional}),q.any,async({min:Q,max:Z,format:Y,length:J},X)=>{let K=U(Y,X)??"float",W=U(J,X)??10,H=U(Q,X)??0,G=U(Z,X)??1;if(K==="base36"){let $="";if(typeof crypto<"u"&&crypto.getRandomValues){let M=new Uint8Array(W);crypto.getRandomValues(M);for(let L=0;L<W;L++)$+="0123456789abcdefghijklmnopqrstuvwxyz"[M[L]%36]}else for(let M=0;M<W;M++)$+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(Math.floor(Math.random()*36));return $}let _;if(typeof crypto<"u"&&crypto.getRandomValues){let R=new Uint32Array(1);crypto.getRandomValues(R),_=R[0]/4294967296}else _=Math.random();let F=G-H,O=_*F+H;if(K==="integer")return Math.floor(O);return O},{docs:"Generate Random",cost:1}),i9=w("uuid",void 0,q.string,async()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();if(typeof crypto<"u"&&crypto.getRandomValues){let Q=new Uint8Array(16);crypto.getRandomValues(Q),Q[6]=Q[6]&15|64,Q[8]=Q[8]&63|128;let Z=Array.from(Q,(Y)=>Y.toString(16).padStart(2,"0")).join("");return`${Z.slice(0,8)}-${Z.slice(8,12)}-${Z.slice(12,16)}-${Z.slice(16,20)}-${Z.slice(20)}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(Q)=>{let Z=Math.random()*16|0;return(Q==="x"?Z:Z&3|8).toString(16)})},{docs:"Generate UUID",cost:1}),H1=w("hash",q.object({value:q.any,algorithm:q.string.optional}),q.string,async({value:Q,algorithm:Z},Y)=>{let J=typeof Q==="string"?Q:JSON.stringify(U(Q,Y)),X=U(Z,Y)||"SHA-256";if(typeof crypto<"u"&&crypto.subtle){let H=new TextEncoder().encode(J),G=await crypto.subtle.digest(X,H);return Array.from(new Uint8Array(G)).map((F)=>F.toString(16).padStart(2,"0")).join("")}let K=0;for(let W=0;W<J.length;W++){let H=J.charCodeAt(W);K=(K<<5)-K+H,K|=0}return String(K)},{docs:"Hash a value",cost:1}),c9=w("consoleLog",q.object({message:q.any}),void 0,async({message:Q},Z)=>{let Y=U(Q,Z);if(Z.trace)Z.trace.push({op:"console.log",input:{message:Y},stateDiff:{},result:Y,fuelBefore:Z.fuel.current,fuelAfter:Z.fuel.current,timestamp:new Date().toISOString()})},{docs:"Log to trace",cost:0.1}),n9=w("consoleWarn",q.object({message:q.any}),void 0,async({message:Q},Z)=>{let Y=U(Q,Z),J=typeof Y==="string"?Y:JSON.stringify(Y);if(!Z.warnings)Z.warnings=[];if(Z.warnings.push(J),Z.trace)Z.trace.push({op:"console.warn",input:{message:Y},stateDiff:{},result:Y,fuelBefore:Z.fuel.current,fuelAfter:Z.fuel.current,timestamp:new Date().toISOString()})},{docs:"Add warning",cost:0.1}),a9=w("consoleError",q.object({message:q.any}),void 0,async({message:Q},Z)=>{let Y=U(Q,Z),J=typeof Y==="string"?Y:JSON.stringify(Y);Z.error=new o(J,"console.error")},{docs:"Emit error and stop",cost:0.1}),o9=w("storeProcedure",q.object({ast:q.any,ttl:q.number.optional,maxSize:q.number.optional}),q.string,async({ast:Q,ttl:Z,maxSize:Y},J)=>{let X=U(Q,J),K=Z?U(Z,J):a8,W=Y?U(Y,J):o8;if(!X||typeof X!=="object"||!X.op)throw Error('Invalid AST: must be an object with an "op" property');let H=JSON.stringify(X);if(H.length>W)throw Error(`AST too large: ${H.length} bytes exceeds limit of ${W} bytes. Consider reducing AST size or using a shorter TTL.`);let G=s8(),_=Date.now();return A0.set(G,{ast:X,createdAt:_,expiresAt:_+K}),G},{docs:"Store an AST and return a token for later execution",cost:1}),s9=w("releaseProcedure",q.object({token:q.string}),q.boolean,async({token:Q},Z)=>{let Y=U(Q,Z);return A0.delete(Y)},{docs:"Release a stored procedure by token",cost:0.1}),r9=w("clearExpiredProcedures",void 0,q.number,async()=>{let Q=Date.now(),Z=0;for(let[Y,J]of A0)if(Q>J.expiresAt)A0.delete(Y),Z++;return Z},{docs:"Clear all expired procedures and return count",cost:0.5}),y1={seq:s,if:J9,while:X9,return:W9,try:K9,Error:H9,varSet:z9,constSet:G9,varGet:_9,varsImport:q9,varsLet:F9,varsExport:R9,scope:$9,map:O9,filter:U9,reduce:M9,find:I9,push:B9,len:j9,split:N9,join:L9,template:w9,regexMatch:A9,pick:D9,omit:V9,merge:P9,keys:C9,httpFetch:T9,storeGet:S9,storeSet:E9,storeQuery:k9,storeVectorSearch:v9,llmPredict:y9,agentRun:g9,transpileCode:f9,runCode:h9,jsonParse:m9,jsonStringify:x9,xmlParse:u9,memoize:d9,cache:l9,random:p9,uuid:i9,hash:H1,consoleLog:c9,consoleWarn:n9,consoleError:a9,storeProcedure:o9,releaseProcedure:s9,clearExpiredProcedures:r9};var t9=new Set(["true","false","null","undefined","and","or","not"]);function e9(Q,Z){let Y=Q.replace(/"[^"]*"/g,'""').replace(/'[^']*'/g,"''"),J=[],X=/(?<![.])\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g,K;while((K=X.exec(Y))!==null)J.push(K[1]);let H=[...new Set(J)].filter((G)=>!t9.has(G)&&!(G in Z)&&!new RegExp(`\\b${G}\\s*\\(`).test(Y));if(H.length>0)console.warn(`[Agent99 Builder] Condition "${Q}" references variables not in vars mapping: ${H.join(", ")}. Add them to vars or use AsyncJS syntax (ajs\`...\`) which handles this automatically.`)}function m0(Q,Z){e9(Q,Z);let Y=QQ(Q),J=x1(Y,0,Z);if(J.pos<Y.length){let X=Y.slice(J.pos).join(" ");throw Error(`Unsupported condition syntax near '${X}' in: ${Q}
2
- Supported: comparisons, &&, ||, !, arithmetic, member access (a.b), literals`)}return J.node}function QQ(Q){let Z=[],Y=0;while(Y<Q.length){while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y>=Q.length)break;if(Q[Y]==='"'||Q[Y]==="'"){let J=Q[Y++],X="";while(Y<Q.length&&Q[Y]!==J)if(Q[Y]==="\\"&&Y+1<Q.length)Y++,X+=Q[Y++];else X+=Q[Y++];Y++,Z.push(JSON.stringify(X));continue}if(Q.slice(Y,Y+2).match(/^(&&|\|\||==|!=|>=|<=)$/)){Z.push(Q.slice(Y,Y+2)),Y+=2;continue}if("+-*/%><!().?:[]".includes(Q[Y])){Z.push(Q[Y]),Y++;continue}if(/\d/.test(Q[Y])){let J="";while(Y<Q.length&&/[\d.]/.test(Q[Y]))J+=Q[Y++];Z.push(J);continue}if(/[a-zA-Z_]/.test(Q[Y])){let J="";while(Y<Q.length&&/[a-zA-Z0-9_]/.test(Q[Y]))J+=Q[Y++];Z.push(J);continue}Y++}return Z}function x1(Q,Z,Y){return ZQ(Q,Z,Y)}function ZQ(Q,Z,Y){let{node:J,pos:X}=g1(Q,Z,Y);while(Q[X]==="||"){X++;let{node:K,pos:W}=g1(Q,X,Y);J={$expr:"logical",op:"||",left:J,right:K},X=W}return{node:J,pos:X}}function g1(Q,Z,Y){let{node:J,pos:X}=f1(Q,Z,Y);while(Q[X]==="&&"){X++;let{node:K,pos:W}=f1(Q,X,Y);J={$expr:"logical",op:"&&",left:J,right:K},X=W}return{node:J,pos:X}}function f1(Q,Z,Y){let{node:J,pos:X}=h1(Q,Z,Y),K=["==","!=",">","<",">=","<="];while(K.includes(Q[X])){let W=Q[X++],{node:H,pos:G}=h1(Q,X,Y);J={$expr:"binary",op:W,left:J,right:H},X=G}return{node:J,pos:X}}function h1(Q,Z,Y){let{node:J,pos:X}=m1(Q,Z,Y);while(Q[X]==="+"||Q[X]==="-"){let K=Q[X++],{node:W,pos:H}=m1(Q,X,Y);J={$expr:"binary",op:K,left:J,right:W},X=H}return{node:J,pos:X}}function m1(Q,Z,Y){let{node:J,pos:X}=z1(Q,Z,Y);while(Q[X]==="*"||Q[X]==="/"||Q[X]==="%"){let K=Q[X++],{node:W,pos:H}=z1(Q,X,Y);J={$expr:"binary",op:K,left:J,right:W},X=H}return{node:J,pos:X}}function z1(Q,Z,Y){if(Q[Z]==="!"||Q[Z]==="-"){let J=Q[Z++],{node:X,pos:K}=z1(Q,Z,Y);return{node:{$expr:"unary",op:J,argument:X},pos:K}}return YQ(Q,Z,Y)}function YQ(Q,Z,Y){let J=Q[Z];if(J==="("){let{node:X,pos:K}=x1(Q,Z+1,Y);return{node:X,pos:K+1}}if(J&&J.startsWith('"'))return{node:{$expr:"literal",value:JSON.parse(J)},pos:Z+1};if(J&&/^\d/.test(J))return{node:{$expr:"literal",value:parseFloat(J)},pos:Z+1};if(J==="true")return{node:{$expr:"literal",value:!0},pos:Z+1};if(J==="false")return{node:{$expr:"literal",value:!1},pos:Z+1};if(J==="null")return{node:{$expr:"literal",value:null},pos:Z+1};if(J&&/^[a-zA-Z_]/.test(J)){let X={$expr:"ident",name:J},K=Z+1;while(Q[K]==="."){K++;let W=Q[K++];X={$expr:"member",object:X,property:W}}return{node:X,pos:K}}return{node:{$expr:"literal",value:null},pos:Z+1}}class c{steps=[];atoms;proxy;constructor(Q){return this.atoms=Q,this.proxy=new Proxy(this,{get:(Z,Y,J)=>{if(Y in Z)return Z[Y];if(typeof Y==="string"&&Y in Z.atoms)return(X)=>{let K=Z.atoms[Y];return Z.add(K.create(X)),J};return}}),this.proxy}add(Q){return this.steps.push(Q),this.proxy}as(Q){if(this.steps.length===0)throw Error("No step to capture");let Z=this.steps[this.steps.length-1];return Z.result=Q,this.proxy}step(Q){return this.add(Q)}return(Q){let Z=this.atoms.return;if(!Z)throw Error("Atom 'return' not found");let Y=Q.schema??Q;return this.add(Z.create({schema:Y}))}toJSON(){return{op:"seq",steps:[...this.steps]}}varsImport(Q){return this.add(this.atoms.varsImport.create({keys:Q}))}varsExport(Q){return this.add(this.atoms.varsExport.create({keys:Q}))}if(Q,Z,Y,J){let X=new c(this.atoms);Y(X);let K;if(J){let G=new c(this.atoms);J(G),K=G.steps}let W=m0(Q,Z),H=this.atoms.if;return this.add(H.create({condition:W,then:X.steps,else:K}))}while(Q,Z,Y){let J=new c(this.atoms);Y(J);let X=m0(Q,Z),K=this.atoms.while;return this.add(K.create({condition:X,body:J.steps}))}scope(Q){let Z=new c(this.atoms);Q(Z);let Y=this.atoms.scope;return this.add(Y.create({steps:Z.steps}))}map(Q,Z,Y){let J=new c(this.atoms);Y(J);let X=this.atoms.map;return this.add(X.create({items:Q,as:Z,steps:J.steps}))}filter(Q,Z,Y,J={}){let X=m0(Y,J),K=this.atoms.filter;return this.add(K.create({items:Q,as:Z,condition:X}))}find(Q,Z,Y,J={}){let X=m0(Y,J),K=this.atoms.find;return this.add(K.create({items:Q,as:Z,condition:X}))}reduce(Q,Z,Y,J,X){let K=new c(this.atoms);X(K);let W=this.atoms.reduce;return this.add(W.create({items:Q,as:Z,accumulator:Y,initial:J,steps:K.steps}))}memoize(Q,Z){let Y=new c(this.atoms);Q(Y);let J=this.atoms.memoize;return this.add(J.create({key:Z,steps:Y.steps}))}cache(Q,Z,Y){let J=new c(this.atoms);Q(J);let X=this.atoms.cache;return this.add(X.create({key:Z,steps:J.steps,ttlMs:Y}))}try(Q){let Z=new c(this.atoms);Q.try(Z);let Y;if(Q.catch){let X=new c(this.atoms);Q.catch(X),Y=X.steps}let J=this.atoms.try;return this.add(J.create({try:Z.steps,catch:Y}))}}import{validate as bZ}from"tosijs-schema";var JQ=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],i1=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],XQ="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",c1="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",G1={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},_1="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",WQ={5:_1,"5module":_1+" export import",6:_1+" const class extends export import super"},KQ=/^in(stanceof)?$/,HQ=new RegExp("["+c1+"]"),zQ=new RegExp("["+c1+XQ+"]");function q1(Q,Z){var Y=65536;for(var J=0;J<Z.length;J+=2){if(Y+=Z[J],Y>Q)return!1;if(Y+=Z[J+1],Y>=Q)return!0}return!1}function X0(Q,Z){if(Q<65)return Q===36;if(Q<91)return!0;if(Q<97)return Q===95;if(Q<123)return!0;if(Q<=65535)return Q>=170&&HQ.test(String.fromCharCode(Q));if(Z===!1)return!1;return q1(Q,i1)}function O0(Q,Z){if(Q<48)return Q===36;if(Q<58)return!0;if(Q<65)return!1;if(Q<91)return!0;if(Q<97)return Q===95;if(Q<123)return!0;if(Q<=65535)return Q>=170&&zQ.test(String.fromCharCode(Q));if(Z===!1)return!1;return q1(Q,i1)||q1(Q,JQ)}var T=function(Z,Y){if(Y===void 0)Y={};this.label=Z,this.keyword=Y.keyword,this.beforeExpr=!!Y.beforeExpr,this.startsExpr=!!Y.startsExpr,this.isLoop=!!Y.isLoop,this.isAssign=!!Y.isAssign,this.prefix=!!Y.prefix,this.postfix=!!Y.postfix,this.binop=Y.binop||null,this.updateContext=null};function r(Q,Z){return new T(Q,{beforeExpr:!0,binop:Z})}var t={beforeExpr:!0},n={startsExpr:!0},U1={};function b(Q,Z){if(Z===void 0)Z={};return Z.keyword=Q,U1[Q]=new T(Q,Z)}var z={num:new T("num",n),regexp:new T("regexp",n),string:new T("string",n),name:new T("name",n),privateId:new T("privateId",n),eof:new T("eof"),bracketL:new T("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new T("]"),braceL:new T("{",{beforeExpr:!0,startsExpr:!0}),braceR:new T("}"),parenL:new T("(",{beforeExpr:!0,startsExpr:!0}),parenR:new T(")"),comma:new T(",",t),semi:new T(";",t),colon:new T(":",t),dot:new T("."),question:new T("?",t),questionDot:new T("?."),arrow:new T("=>",t),template:new T("template"),invalidTemplate:new T("invalidTemplate"),ellipsis:new T("...",t),backQuote:new T("`",n),dollarBraceL:new T("${",{beforeExpr:!0,startsExpr:!0}),eq:new T("=",{beforeExpr:!0,isAssign:!0}),assign:new T("_=",{beforeExpr:!0,isAssign:!0}),incDec:new T("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new T("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:r("||",1),logicalAND:r("&&",2),bitwiseOR:r("|",3),bitwiseXOR:r("^",4),bitwiseAND:r("&",5),equality:r("==/!=/===/!==",6),relational:r("</>/<=/>=",7),bitShift:r("<</>>/>>>",8),plusMin:new T("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:r("%",10),star:r("*",10),slash:r("/",10),starstar:new T("**",{beforeExpr:!0}),coalesce:r("??",1),_break:b("break"),_case:b("case",t),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",t),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",t),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",n),_if:b("if"),_return:b("return",t),_switch:b("switch"),_throw:b("throw",t),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",n),_super:b("super",n),_class:b("class",n),_extends:b("extends",t),_export:b("export"),_import:b("import",n),_null:b("null",n),_true:b("true",n),_false:b("false",n),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},a=/\r\n?|\n|\u2028|\u2029/,GQ=new RegExp(a.source,"g");function D0(Q){return Q===10||Q===13||Q===8232||Q===8233}function n1(Q,Z,Y){if(Y===void 0)Y=Q.length;for(var J=Z;J<Y;J++){var X=Q.charCodeAt(J);if(D0(X))return J<Y-1&&X===13&&Q.charCodeAt(J+1)===10?J+2:J+1}return-1}var a1=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,p=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,o1=Object.prototype,_Q=o1.hasOwnProperty,qQ=o1.toString,V0=Object.hasOwn||function(Q,Z){return _Q.call(Q,Z)},u1=Array.isArray||function(Q){return qQ.call(Q)==="[object Array]"},d1=Object.create(null);function $0(Q){return d1[Q]||(d1[Q]=new RegExp("^(?:"+Q.replace(/ /g,"|")+")$"))}function _0(Q){if(Q<=65535)return String.fromCharCode(Q);return Q-=65536,String.fromCharCode((Q>>10)+55296,(Q&1023)+56320)}var FQ=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,S0=function(Z,Y){this.line=Z,this.column=Y};S0.prototype.offset=function(Z){return new S0(this.line,this.column+Z)};var i0=function(Z,Y,J){if(this.start=Y,this.end=J,Z.sourceFile!==null)this.source=Z.sourceFile};function s1(Q,Z){for(var Y=1,J=0;;){var X=n1(Q,J,Z);if(X<0)return new S0(Y,Z-J);++Y,J=X}}var F1={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},l1=!1;function RQ(Q){var Z={};for(var Y in F1)Z[Y]=Q&&V0(Q,Y)?Q[Y]:F1[Y];if(Z.ecmaVersion==="latest")Z.ecmaVersion=1e8;else if(Z.ecmaVersion==null){if(!l1&&typeof console==="object"&&console.warn)l1=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
3
- Defaulting to 2020, but this will stop working in the future.`);Z.ecmaVersion=11}else if(Z.ecmaVersion>=2015)Z.ecmaVersion-=2009;if(Z.allowReserved==null)Z.allowReserved=Z.ecmaVersion<5;if(!Q||Q.allowHashBang==null)Z.allowHashBang=Z.ecmaVersion>=14;if(u1(Z.onToken)){var J=Z.onToken;Z.onToken=function(X){return J.push(X)}}if(u1(Z.onComment))Z.onComment=$Q(Z,Z.onComment);return Z}function $Q(Q,Z){return function(Y,J,X,K,W,H){var G={type:Y?"Block":"Line",value:J,start:X,end:K};if(Q.locations)G.loc=new i0(this,W,H);if(Q.ranges)G.range=[X,K];Z.push(G)}}var E0=1,P0=2,M1=4,r1=8,I1=16,t1=32,c0=64,e1=128,j0=256,k0=512,n0=E0|P0|j0;function B1(Q,Z){return P0|(Q?M1:0)|(Z?r1:0)}var u0=0,j1=1,F0=2,Q8=3,Z8=4,Y8=5,u=function(Z,Y,J){this.options=Z=RQ(Z),this.sourceFile=Z.sourceFile,this.keywords=$0(WQ[Z.ecmaVersion>=6?6:Z.sourceType==="module"?"5module":5]);var X="";if(Z.allowReserved!==!0){if(X=G1[Z.ecmaVersion>=6?6:Z.ecmaVersion===5?5:3],Z.sourceType==="module")X+=" await"}this.reservedWords=$0(X);var K=(X?X+" ":"")+G1.strict;if(this.reservedWordsStrict=$0(K),this.reservedWordsStrictBind=$0(K+" "+G1.strictBind),this.input=String(Y),this.containsEsc=!1,J)this.pos=J,this.lineStart=this.input.lastIndexOf(`
4
- `,J-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(a).length;else this.pos=this.lineStart=0,this.curLine=1;if(this.type=z.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=Z.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&Z.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(E0),this.regexpState=null,this.privateNameStack=[]},W0={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};u.prototype.parse=function(){var Z=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(Z)};W0.inFunction.get=function(){return(this.currentVarScope().flags&P0)>0};W0.inGenerator.get=function(){return(this.currentVarScope().flags&r1)>0};W0.inAsync.get=function(){return(this.currentVarScope().flags&M1)>0};W0.canAwait.get=function(){for(var Q=this.scopeStack.length-1;Q>=0;Q--){var Z=this.scopeStack[Q],Y=Z.flags;if(Y&(j0|k0))return!1;if(Y&P0)return(Y&M1)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};W0.allowSuper.get=function(){var Q=this.currentThisScope(),Z=Q.flags;return(Z&c0)>0||this.options.allowSuperOutsideMethod};W0.allowDirectSuper.get=function(){return(this.currentThisScope().flags&e1)>0};W0.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};W0.allowNewDotTarget.get=function(){for(var Q=this.scopeStack.length-1;Q>=0;Q--){var Z=this.scopeStack[Q],Y=Z.flags;if(Y&(j0|k0)||Y&P0&&!(Y&I1))return!0}return!1};W0.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&j0)>0};u.extend=function(){var Z=[],Y=arguments.length;while(Y--)Z[Y]=arguments[Y];var J=this;for(var X=0;X<Z.length;X++)J=Z[X](J);return J};u.parse=function(Z,Y){return new this(Y,Z).parse()};u.parseExpressionAt=function(Z,Y,J){var X=new this(J,Z,Y);return X.nextToken(),X.parseExpression()};u.tokenizer=function(Z,Y){return new this(Y,Z)};Object.defineProperties(u.prototype,W0);var i=u.prototype,OQ=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;i.strictDirective=function(Q){if(this.options.ecmaVersion<5)return!1;for(;;){p.lastIndex=Q,Q+=p.exec(this.input)[0].length;var Z=OQ.exec(this.input.slice(Q));if(!Z)return!1;if((Z[1]||Z[2])==="use strict"){p.lastIndex=Q+Z[0].length;var Y=p.exec(this.input),J=Y.index+Y[0].length,X=this.input.charAt(J);return X===";"||X==="}"||a.test(Y[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(X)||X==="!"&&this.input.charAt(J+1)==="=")}if(Q+=Z[0].length,p.lastIndex=Q,Q+=p.exec(this.input)[0].length,this.input[Q]===";")Q++}};i.eat=function(Q){if(this.type===Q)return this.next(),!0;else return!1};i.isContextual=function(Q){return this.type===z.name&&this.value===Q&&!this.containsEsc};i.eatContextual=function(Q){if(!this.isContextual(Q))return!1;return this.next(),!0};i.expectContextual=function(Q){if(!this.eatContextual(Q))this.unexpected()};i.canInsertSemicolon=function(){return this.type===z.eof||this.type===z.braceR||a.test(this.input.slice(this.lastTokEnd,this.start))};i.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};i.semicolon=function(){if(!this.eat(z.semi)&&!this.insertSemicolon())this.unexpected()};i.afterTrailingComma=function(Q,Z){if(this.type===Q){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!Z)this.next();return!0}};i.expect=function(Q){this.eat(Q)||this.unexpected()};i.unexpected=function(Q){this.raise(Q!=null?Q:this.start,"Unexpected token")};var a0=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};i.checkPatternErrors=function(Q,Z){if(!Q)return;if(Q.trailingComma>-1)this.raiseRecoverable(Q.trailingComma,"Comma is not permitted after the rest element");var Y=Z?Q.parenthesizedAssign:Q.parenthesizedBind;if(Y>-1)this.raiseRecoverable(Y,Z?"Assigning to rvalue":"Parenthesized pattern")};i.checkExpressionErrors=function(Q,Z){if(!Q)return!1;var{shorthandAssign:Y,doubleProto:J}=Q;if(!Z)return Y>=0||J>=0;if(Y>=0)this.raise(Y,"Shorthand property assignments are valid only in destructuring patterns");if(J>=0)this.raiseRecoverable(J,"Redefinition of __proto__ property")};i.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};i.isSimpleAssignTarget=function(Q){if(Q.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(Q.expression);return Q.type==="Identifier"||Q.type==="MemberExpression"};var N=u.prototype;N.parseTopLevel=function(Q){var Z=Object.create(null);if(!Q.body)Q.body=[];while(this.type!==z.eof){var Y=this.parseStatement(null,!0,Z);Q.body.push(Y)}if(this.inModule)for(var J=0,X=Object.keys(this.undefinedExports);J<X.length;J+=1){var K=X[J];this.raiseRecoverable(this.undefinedExports[K].start,"Export '"+K+"' is not defined")}return this.adaptDirectivePrologue(Q.body),this.next(),Q.sourceType=this.options.sourceType,this.finishNode(Q,"Program")};var N1={kind:"loop"},UQ={kind:"switch"};N.isLet=function(Q){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;p.lastIndex=this.pos;var Z=p.exec(this.input),Y=this.pos+Z[0].length,J=this.input.charCodeAt(Y);if(J===91||J===92)return!0;if(Q)return!1;if(J===123||J>55295&&J<56320)return!0;if(X0(J,!0)){var X=Y+1;while(O0(J=this.input.charCodeAt(X),!0))++X;if(J===92||J>55295&&J<56320)return!0;var K=this.input.slice(Y,X);if(!KQ.test(K))return!0}return!1};N.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;p.lastIndex=this.pos;var Q=p.exec(this.input),Z=this.pos+Q[0].length,Y;return!a.test(this.input.slice(this.pos,Z))&&this.input.slice(Z,Z+8)==="function"&&(Z+8===this.input.length||!(O0(Y=this.input.charCodeAt(Z+8))||Y>55295&&Y<56320))};N.isUsingKeyword=function(Q,Z){if(this.options.ecmaVersion<17||!this.isContextual(Q?"await":"using"))return!1;p.lastIndex=this.pos;var Y=p.exec(this.input),J=this.pos+Y[0].length;if(a.test(this.input.slice(this.pos,J)))return!1;if(Q){var X=J+5,K;if(this.input.slice(J,X)!=="using"||X===this.input.length||O0(K=this.input.charCodeAt(X))||K>55295&&K<56320)return!1;p.lastIndex=X;var W=p.exec(this.input);if(W&&a.test(this.input.slice(X,X+W[0].length)))return!1}if(Z){var H=J+2,G;if(this.input.slice(J,H)==="of"){if(H===this.input.length||!O0(G=this.input.charCodeAt(H))&&!(G>55295&&G<56320))return!1}}var _=this.input.charCodeAt(J);return X0(_,!0)||_===92};N.isAwaitUsing=function(Q){return this.isUsingKeyword(!0,Q)};N.isUsing=function(Q){return this.isUsingKeyword(!1,Q)};N.parseStatement=function(Q,Z,Y){var J=this.type,X=this.startNode(),K;if(this.isLet(Q))J=z._var,K="let";switch(J){case z._break:case z._continue:return this.parseBreakContinueStatement(X,J.keyword);case z._debugger:return this.parseDebuggerStatement(X);case z._do:return this.parseDoStatement(X);case z._for:return this.parseForStatement(X);case z._function:if(Q&&(this.strict||Q!=="if"&&Q!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(X,!1,!Q);case z._class:if(Q)this.unexpected();return this.parseClass(X,!0);case z._if:return this.parseIfStatement(X);case z._return:return this.parseReturnStatement(X);case z._switch:return this.parseSwitchStatement(X);case z._throw:return this.parseThrowStatement(X);case z._try:return this.parseTryStatement(X);case z._const:case z._var:if(K=K||this.value,Q&&K!=="var")this.unexpected();return this.parseVarStatement(X,K);case z._while:return this.parseWhileStatement(X);case z._with:return this.parseWithStatement(X);case z.braceL:return this.parseBlock(!0,X);case z.semi:return this.parseEmptyStatement(X);case z._export:case z._import:if(this.options.ecmaVersion>10&&J===z._import){p.lastIndex=this.pos;var W=p.exec(this.input),H=this.pos+W[0].length,G=this.input.charCodeAt(H);if(G===40||G===46)return this.parseExpressionStatement(X,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!Z)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return J===z._import?this.parseImport(X):this.parseExport(X,Y);default:if(this.isAsyncFunction()){if(Q)this.unexpected();return this.next(),this.parseFunctionStatement(X,!0,!Q)}var _=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(_){if(Z&&this.options.sourceType==="script")this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`");if(_==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(X,!1,_),this.semicolon(),this.finishNode(X,"VariableDeclaration")}var F=this.value,O=this.parseExpression();if(J===z.name&&O.type==="Identifier"&&this.eat(z.colon))return this.parseLabeledStatement(X,F,O,Q);else return this.parseExpressionStatement(X,O)}};N.parseBreakContinueStatement=function(Q,Z){var Y=Z==="break";if(this.next(),this.eat(z.semi)||this.insertSemicolon())Q.label=null;else if(this.type!==z.name)this.unexpected();else Q.label=this.parseIdent(),this.semicolon();var J=0;for(;J<this.labels.length;++J){var X=this.labels[J];if(Q.label==null||X.name===Q.label.name){if(X.kind!=null&&(Y||X.kind==="loop"))break;if(Q.label&&Y)break}}if(J===this.labels.length)this.raise(Q.start,"Unsyntactic "+Z);return this.finishNode(Q,Y?"BreakStatement":"ContinueStatement")};N.parseDebuggerStatement=function(Q){return this.next(),this.semicolon(),this.finishNode(Q,"DebuggerStatement")};N.parseDoStatement=function(Q){if(this.next(),this.labels.push(N1),Q.body=this.parseStatement("do"),this.labels.pop(),this.expect(z._while),Q.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(z.semi);else this.semicolon();return this.finishNode(Q,"DoWhileStatement")};N.parseForStatement=function(Q){this.next();var Z=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(N1),this.enterScope(0),this.expect(z.parenL),this.type===z.semi){if(Z>-1)this.unexpected(Z);return this.parseFor(Q,null)}var Y=this.isLet();if(this.type===z._var||this.type===z._const||Y){var J=this.startNode(),X=Y?"let":this.value;return this.next(),this.parseVar(J,!0,X),this.finishNode(J,"VariableDeclaration"),this.parseForAfterInit(Q,J,Z)}var K=this.isContextual("let"),W=!1,H=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(H){var G=this.startNode();if(this.next(),H==="await using")this.next();return this.parseVar(G,!0,H),this.finishNode(G,"VariableDeclaration"),this.parseForAfterInit(Q,G,Z)}var _=this.containsEsc,F=new a0,O=this.start,R=Z>-1?this.parseExprSubscripts(F,"await"):this.parseExpression(!0,F);if(this.type===z._in||(W=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(Z>-1){if(this.type===z._in)this.unexpected(Z);Q.await=!0}else if(W&&this.options.ecmaVersion>=8){if(R.start===O&&!_&&R.type==="Identifier"&&R.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)Q.await=!1}if(K&&W)this.raise(R.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(R,!1,F),this.checkLValPattern(R),this.parseForIn(Q,R)}else this.checkExpressionErrors(F,!0);if(Z>-1)this.unexpected(Z);return this.parseFor(Q,R)};N.parseForAfterInit=function(Q,Z,Y){if((this.type===z._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Z.declarations.length===1){if(this.options.ecmaVersion>=9)if(this.type===z._in){if(Y>-1)this.unexpected(Y)}else Q.await=Y>-1;return this.parseForIn(Q,Z)}if(Y>-1)this.unexpected(Y);return this.parseFor(Q,Z)};N.parseFunctionStatement=function(Q,Z,Y){return this.next(),this.parseFunction(Q,T0|(Y?0:R1),!1,Z)};N.parseIfStatement=function(Q){return this.next(),Q.test=this.parseParenExpression(),Q.consequent=this.parseStatement("if"),Q.alternate=this.eat(z._else)?this.parseStatement("if"):null,this.finishNode(Q,"IfStatement")};N.parseReturnStatement=function(Q){if(!this.inFunction&&!this.options.allowReturnOutsideFunction)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(z.semi)||this.insertSemicolon())Q.argument=null;else Q.argument=this.parseExpression(),this.semicolon();return this.finishNode(Q,"ReturnStatement")};N.parseSwitchStatement=function(Q){this.next(),Q.discriminant=this.parseParenExpression(),Q.cases=[],this.expect(z.braceL),this.labels.push(UQ),this.enterScope(0);var Z;for(var Y=!1;this.type!==z.braceR;)if(this.type===z._case||this.type===z._default){var J=this.type===z._case;if(Z)this.finishNode(Z,"SwitchCase");if(Q.cases.push(Z=this.startNode()),Z.consequent=[],this.next(),J)Z.test=this.parseExpression();else{if(Y)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Y=!0,Z.test=null}this.expect(z.colon)}else{if(!Z)this.unexpected();Z.consequent.push(this.parseStatement(null))}if(this.exitScope(),Z)this.finishNode(Z,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(Q,"SwitchStatement")};N.parseThrowStatement=function(Q){if(this.next(),a.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return Q.argument=this.parseExpression(),this.semicolon(),this.finishNode(Q,"ThrowStatement")};var MQ=[];N.parseCatchClauseParam=function(){var Q=this.parseBindingAtom(),Z=Q.type==="Identifier";return this.enterScope(Z?t1:0),this.checkLValPattern(Q,Z?Z8:F0),this.expect(z.parenR),Q};N.parseTryStatement=function(Q){if(this.next(),Q.block=this.parseBlock(),Q.handler=null,this.type===z._catch){var Z=this.startNode();if(this.next(),this.eat(z.parenL))Z.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();Z.param=null,this.enterScope(0)}Z.body=this.parseBlock(!1),this.exitScope(),Q.handler=this.finishNode(Z,"CatchClause")}if(Q.finalizer=this.eat(z._finally)?this.parseBlock():null,!Q.handler&&!Q.finalizer)this.raise(Q.start,"Missing catch or finally clause");return this.finishNode(Q,"TryStatement")};N.parseVarStatement=function(Q,Z,Y){return this.next(),this.parseVar(Q,!1,Z,Y),this.semicolon(),this.finishNode(Q,"VariableDeclaration")};N.parseWhileStatement=function(Q){return this.next(),Q.test=this.parseParenExpression(),this.labels.push(N1),Q.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(Q,"WhileStatement")};N.parseWithStatement=function(Q){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),Q.object=this.parseParenExpression(),Q.body=this.parseStatement("with"),this.finishNode(Q,"WithStatement")};N.parseEmptyStatement=function(Q){return this.next(),this.finishNode(Q,"EmptyStatement")};N.parseLabeledStatement=function(Q,Z,Y,J){for(var X=0,K=this.labels;X<K.length;X+=1){var W=K[X];if(W.name===Z)this.raise(Y.start,"Label '"+Z+"' is already declared")}var H=this.type.isLoop?"loop":this.type===z._switch?"switch":null;for(var G=this.labels.length-1;G>=0;G--){var _=this.labels[G];if(_.statementStart===Q.start)_.statementStart=this.start,_.kind=H;else break}return this.labels.push({name:Z,kind:H,statementStart:this.start}),Q.body=this.parseStatement(J?J.indexOf("label")===-1?J+"label":J:"label"),this.labels.pop(),Q.label=Y,this.finishNode(Q,"LabeledStatement")};N.parseExpressionStatement=function(Q,Z){return Q.expression=Z,this.semicolon(),this.finishNode(Q,"ExpressionStatement")};N.parseBlock=function(Q,Z,Y){if(Q===void 0)Q=!0;if(Z===void 0)Z=this.startNode();if(Z.body=[],this.expect(z.braceL),Q)this.enterScope(0);while(this.type!==z.braceR){var J=this.parseStatement(null);Z.body.push(J)}if(Y)this.strict=!1;if(this.next(),Q)this.exitScope();return this.finishNode(Z,"BlockStatement")};N.parseFor=function(Q,Z){return Q.init=Z,this.expect(z.semi),Q.test=this.type===z.semi?null:this.parseExpression(),this.expect(z.semi),Q.update=this.type===z.parenR?null:this.parseExpression(),this.expect(z.parenR),Q.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Q,"ForStatement")};N.parseForIn=function(Q,Z){var Y=this.type===z._in;if(this.next(),Z.type==="VariableDeclaration"&&Z.declarations[0].init!=null&&(!Y||this.options.ecmaVersion<8||this.strict||Z.kind!=="var"||Z.declarations[0].id.type!=="Identifier"))this.raise(Z.start,(Y?"for-in":"for-of")+" loop variable declaration may not have an initializer");return Q.left=Z,Q.right=Y?this.parseExpression():this.parseMaybeAssign(),this.expect(z.parenR),Q.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Q,Y?"ForInStatement":"ForOfStatement")};N.parseVar=function(Q,Z,Y,J){Q.declarations=[],Q.kind=Y;for(;;){var X=this.startNode();if(this.parseVarId(X,Y),this.eat(z.eq))X.init=this.parseMaybeAssign(Z);else if(!J&&Y==="const"&&!(this.type===z._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!J&&(Y==="using"||Y==="await using")&&this.options.ecmaVersion>=17&&this.type!==z._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Y+" declaration");else if(!J&&X.id.type!=="Identifier"&&!(Z&&(this.type===z._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else X.init=null;if(Q.declarations.push(this.finishNode(X,"VariableDeclarator")),!this.eat(z.comma))break}return Q};N.parseVarId=function(Q,Z){Q.id=Z==="using"||Z==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(Q.id,Z==="var"?j1:F0,!1)};var T0=1,R1=2,J8=4;N.parseFunction=function(Q,Z,Y,J,X){if(this.initFunction(Q),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!J){if(this.type===z.star&&Z&R1)this.unexpected();Q.generator=this.eat(z.star)}if(this.options.ecmaVersion>=8)Q.async=!!J;if(Z&T0){if(Q.id=Z&J8&&this.type!==z.name?null:this.parseIdent(),Q.id&&!(Z&R1))this.checkLValSimple(Q.id,this.strict||Q.generator||Q.async?this.treatFunctionsAsVar?j1:F0:Q8)}var K=this.yieldPos,W=this.awaitPos,H=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(B1(Q.async,Q.generator)),!(Z&T0))Q.id=this.type===z.name?this.parseIdent():null;return this.parseFunctionParams(Q),this.parseFunctionBody(Q,Y,!1,X),this.yieldPos=K,this.awaitPos=W,this.awaitIdentPos=H,this.finishNode(Q,Z&T0?"FunctionDeclaration":"FunctionExpression")};N.parseFunctionParams=function(Q){this.expect(z.parenL),Q.params=this.parseBindingList(z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};N.parseClass=function(Q,Z){this.next();var Y=this.strict;this.strict=!0,this.parseClassId(Q,Z),this.parseClassSuper(Q);var J=this.enterClassBody(),X=this.startNode(),K=!1;X.body=[],this.expect(z.braceL);while(this.type!==z.braceR){var W=this.parseClassElement(Q.superClass!==null);if(W){if(X.body.push(W),W.type==="MethodDefinition"&&W.kind==="constructor"){if(K)this.raiseRecoverable(W.start,"Duplicate constructor in the same class");K=!0}else if(W.key&&W.key.type==="PrivateIdentifier"&&IQ(J,W))this.raiseRecoverable(W.key.start,"Identifier '#"+W.key.name+"' has already been declared")}}return this.strict=Y,this.next(),Q.body=this.finishNode(X,"ClassBody"),this.exitClassBody(),this.finishNode(Q,Z?"ClassDeclaration":"ClassExpression")};N.parseClassElement=function(Q){if(this.eat(z.semi))return null;var Z=this.options.ecmaVersion,Y=this.startNode(),J="",X=!1,K=!1,W="method",H=!1;if(this.eatContextual("static")){if(Z>=13&&this.eat(z.braceL))return this.parseClassStaticBlock(Y),Y;if(this.isClassElementNameStart()||this.type===z.star)H=!0;else J="static"}if(Y.static=H,!J&&Z>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===z.star)&&!this.canInsertSemicolon())K=!0;else J="async";if(!J&&(Z>=9||!K)&&this.eat(z.star))X=!0;if(!J&&!K&&!X){var G=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())W=G;else J=G}if(J)Y.computed=!1,Y.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Y.key.name=J,this.finishNode(Y.key,"Identifier");else this.parseClassElementName(Y);if(Z<13||this.type===z.parenL||W!=="method"||X||K){var _=!Y.static&&d0(Y,"constructor"),F=_&&Q;if(_&&W!=="method")this.raise(Y.key.start,"Constructor can't have get/set modifier");Y.kind=_?"constructor":W,this.parseClassMethod(Y,X,K,F)}else this.parseClassField(Y);return Y};N.isClassElementNameStart=function(){return this.type===z.name||this.type===z.privateId||this.type===z.num||this.type===z.string||this.type===z.bracketL||this.type.keyword};N.parseClassElementName=function(Q){if(this.type===z.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");Q.computed=!1,Q.key=this.parsePrivateIdent()}else this.parsePropertyName(Q)};N.parseClassMethod=function(Q,Z,Y,J){var X=Q.key;if(Q.kind==="constructor"){if(Z)this.raise(X.start,"Constructor can't be a generator");if(Y)this.raise(X.start,"Constructor can't be an async method")}else if(Q.static&&d0(Q,"prototype"))this.raise(X.start,"Classes may not have a static property named prototype");var K=Q.value=this.parseMethod(Z,Y,J);if(Q.kind==="get"&&K.params.length!==0)this.raiseRecoverable(K.start,"getter should have no params");if(Q.kind==="set"&&K.params.length!==1)this.raiseRecoverable(K.start,"setter should have exactly one param");if(Q.kind==="set"&&K.params[0].type==="RestElement")this.raiseRecoverable(K.params[0].start,"Setter cannot use rest params");return this.finishNode(Q,"MethodDefinition")};N.parseClassField=function(Q){if(d0(Q,"constructor"))this.raise(Q.key.start,"Classes can't have a field named 'constructor'");else if(Q.static&&d0(Q,"prototype"))this.raise(Q.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(z.eq))this.enterScope(k0|c0),Q.value=this.parseMaybeAssign(),this.exitScope();else Q.value=null;return this.semicolon(),this.finishNode(Q,"PropertyDefinition")};N.parseClassStaticBlock=function(Q){Q.body=[];var Z=this.labels;this.labels=[],this.enterScope(j0|c0);while(this.type!==z.braceR){var Y=this.parseStatement(null);Q.body.push(Y)}return this.next(),this.exitScope(),this.labels=Z,this.finishNode(Q,"StaticBlock")};N.parseClassId=function(Q,Z){if(this.type===z.name){if(Q.id=this.parseIdent(),Z)this.checkLValSimple(Q.id,F0,!1)}else{if(Z===!0)this.unexpected();Q.id=null}};N.parseClassSuper=function(Q){Q.superClass=this.eat(z._extends)?this.parseExprSubscripts(null,!1):null};N.enterClassBody=function(){var Q={declared:Object.create(null),used:[]};return this.privateNameStack.push(Q),Q.declared};N.exitClassBody=function(){var Q=this.privateNameStack.pop(),Z=Q.declared,Y=Q.used;if(!this.options.checkPrivateFields)return;var J=this.privateNameStack.length,X=J===0?null:this.privateNameStack[J-1];for(var K=0;K<Y.length;++K){var W=Y[K];if(!V0(Z,W.name))if(X)X.used.push(W);else this.raiseRecoverable(W.start,"Private field '#"+W.name+"' must be declared in an enclosing class")}};function IQ(Q,Z){var Y=Z.key.name,J=Q[Y],X="true";if(Z.type==="MethodDefinition"&&(Z.kind==="get"||Z.kind==="set"))X=(Z.static?"s":"i")+Z.kind;if(J==="iget"&&X==="iset"||J==="iset"&&X==="iget"||J==="sget"&&X==="sset"||J==="sset"&&X==="sget")return Q[Y]="true",!1;else if(!J)return Q[Y]=X,!1;else return!0}function d0(Q,Z){var{computed:Y,key:J}=Q;return!Y&&(J.type==="Identifier"&&J.name===Z||J.type==="Literal"&&J.value===Z)}N.parseExportAllDeclaration=function(Q,Z){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))Q.exported=this.parseModuleExportName(),this.checkExport(Z,Q.exported,this.lastTokStart);else Q.exported=null;if(this.expectContextual("from"),this.type!==z.string)this.unexpected();if(Q.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Q.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Q,"ExportAllDeclaration")};N.parseExport=function(Q,Z){if(this.next(),this.eat(z.star))return this.parseExportAllDeclaration(Q,Z);if(this.eat(z._default))return this.checkExport(Z,"default",this.lastTokStart),Q.declaration=this.parseExportDefaultDeclaration(),this.finishNode(Q,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(Q.declaration=this.parseExportDeclaration(Q),Q.declaration.type==="VariableDeclaration")this.checkVariableExport(Z,Q.declaration.declarations);else this.checkExport(Z,Q.declaration.id,Q.declaration.id.start);if(Q.specifiers=[],Q.source=null,this.options.ecmaVersion>=16)Q.attributes=[]}else{if(Q.declaration=null,Q.specifiers=this.parseExportSpecifiers(Z),this.eatContextual("from")){if(this.type!==z.string)this.unexpected();if(Q.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Q.attributes=this.parseWithClause()}else{for(var Y=0,J=Q.specifiers;Y<J.length;Y+=1){var X=J[Y];if(this.checkUnreserved(X.local),this.checkLocalExport(X.local),X.local.type==="Literal")this.raise(X.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(Q.source=null,this.options.ecmaVersion>=16)Q.attributes=[]}this.semicolon()}return this.finishNode(Q,"ExportNamedDeclaration")};N.parseExportDeclaration=function(Q){return this.parseStatement(null)};N.parseExportDefaultDeclaration=function(){var Q;if(this.type===z._function||(Q=this.isAsyncFunction())){var Z=this.startNode();if(this.next(),Q)this.next();return this.parseFunction(Z,T0|J8,!1,Q)}else if(this.type===z._class){var Y=this.startNode();return this.parseClass(Y,"nullableID")}else{var J=this.parseMaybeAssign();return this.semicolon(),J}};N.checkExport=function(Q,Z,Y){if(!Q)return;if(typeof Z!=="string")Z=Z.type==="Identifier"?Z.name:Z.value;if(V0(Q,Z))this.raiseRecoverable(Y,"Duplicate export '"+Z+"'");Q[Z]=!0};N.checkPatternExport=function(Q,Z){var Y=Z.type;if(Y==="Identifier")this.checkExport(Q,Z,Z.start);else if(Y==="ObjectPattern")for(var J=0,X=Z.properties;J<X.length;J+=1){var K=X[J];this.checkPatternExport(Q,K)}else if(Y==="ArrayPattern")for(var W=0,H=Z.elements;W<H.length;W+=1){var G=H[W];if(G)this.checkPatternExport(Q,G)}else if(Y==="Property")this.checkPatternExport(Q,Z.value);else if(Y==="AssignmentPattern")this.checkPatternExport(Q,Z.left);else if(Y==="RestElement")this.checkPatternExport(Q,Z.argument)};N.checkVariableExport=function(Q,Z){if(!Q)return;for(var Y=0,J=Z;Y<J.length;Y+=1){var X=J[Y];this.checkPatternExport(Q,X.id)}};N.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};N.parseExportSpecifier=function(Q){var Z=this.startNode();return Z.local=this.parseModuleExportName(),Z.exported=this.eatContextual("as")?this.parseModuleExportName():Z.local,this.checkExport(Q,Z.exported,Z.exported.start),this.finishNode(Z,"ExportSpecifier")};N.parseExportSpecifiers=function(Q){var Z=[],Y=!0;this.expect(z.braceL);while(!this.eat(z.braceR)){if(!Y){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Y=!1;Z.push(this.parseExportSpecifier(Q))}return Z};N.parseImport=function(Q){if(this.next(),this.type===z.string)Q.specifiers=MQ,Q.source=this.parseExprAtom();else Q.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Q.source=this.type===z.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)Q.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Q,"ImportDeclaration")};N.parseImportSpecifier=function(){var Q=this.startNode();if(Q.imported=this.parseModuleExportName(),this.eatContextual("as"))Q.local=this.parseIdent();else this.checkUnreserved(Q.imported),Q.local=Q.imported;return this.checkLValSimple(Q.local,F0),this.finishNode(Q,"ImportSpecifier")};N.parseImportDefaultSpecifier=function(){var Q=this.startNode();return Q.local=this.parseIdent(),this.checkLValSimple(Q.local,F0),this.finishNode(Q,"ImportDefaultSpecifier")};N.parseImportNamespaceSpecifier=function(){var Q=this.startNode();return this.next(),this.expectContextual("as"),Q.local=this.parseIdent(),this.checkLValSimple(Q.local,F0),this.finishNode(Q,"ImportNamespaceSpecifier")};N.parseImportSpecifiers=function(){var Q=[],Z=!0;if(this.type===z.name){if(Q.push(this.parseImportDefaultSpecifier()),!this.eat(z.comma))return Q}if(this.type===z.star)return Q.push(this.parseImportNamespaceSpecifier()),Q;this.expect(z.braceL);while(!this.eat(z.braceR)){if(!Z){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Z=!1;Q.push(this.parseImportSpecifier())}return Q};N.parseWithClause=function(){var Q=[];if(!this.eat(z._with))return Q;this.expect(z.braceL);var Z={},Y=!0;while(!this.eat(z.braceR)){if(!Y){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Y=!1;var J=this.parseImportAttribute(),X=J.key.type==="Identifier"?J.key.name:J.key.value;if(V0(Z,X))this.raiseRecoverable(J.key.start,"Duplicate attribute key '"+X+"'");Z[X]=!0,Q.push(J)}return Q};N.parseImportAttribute=function(){var Q=this.startNode();if(Q.key=this.type===z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(z.colon),this.type!==z.string)this.unexpected();return Q.value=this.parseExprAtom(),this.finishNode(Q,"ImportAttribute")};N.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===z.string){var Q=this.parseLiteral(this.value);if(FQ.test(Q.value))this.raise(Q.start,"An export name cannot include a lone surrogate.");return Q}return this.parseIdent(!0)};N.adaptDirectivePrologue=function(Q){for(var Z=0;Z<Q.length&&this.isDirectiveCandidate(Q[Z]);++Z)Q[Z].directive=Q[Z].expression.raw.slice(1,-1)};N.isDirectiveCandidate=function(Q){return this.options.ecmaVersion>=5&&Q.type==="ExpressionStatement"&&Q.expression.type==="Literal"&&typeof Q.expression.value==="string"&&(this.input[Q.start]==='"'||this.input[Q.start]==="'")};var Q0=u.prototype;Q0.toAssignable=function(Q,Z,Y){if(this.options.ecmaVersion>=6&&Q)switch(Q.type){case"Identifier":if(this.inAsync&&Q.name==="await")this.raise(Q.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(Q.type="ObjectPattern",Y)this.checkPatternErrors(Y,!0);for(var J=0,X=Q.properties;J<X.length;J+=1){var K=X[J];if(this.toAssignable(K,Z),K.type==="RestElement"&&(K.argument.type==="ArrayPattern"||K.argument.type==="ObjectPattern"))this.raise(K.argument.start,"Unexpected token")}break;case"Property":if(Q.kind!=="init")this.raise(Q.key.start,"Object pattern can't contain getter or setter");this.toAssignable(Q.value,Z);break;case"ArrayExpression":if(Q.type="ArrayPattern",Y)this.checkPatternErrors(Y,!0);this.toAssignableList(Q.elements,Z);break;case"SpreadElement":if(Q.type="RestElement",this.toAssignable(Q.argument,Z),Q.argument.type==="AssignmentPattern")this.raise(Q.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(Q.operator!=="=")this.raise(Q.left.end,"Only '=' operator can be used for specifying default value.");Q.type="AssignmentPattern",delete Q.operator,this.toAssignable(Q.left,Z);break;case"ParenthesizedExpression":this.toAssignable(Q.expression,Z,Y);break;case"ChainExpression":this.raiseRecoverable(Q.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!Z)break;default:this.raise(Q.start,"Assigning to rvalue")}else if(Y)this.checkPatternErrors(Y,!0);return Q};Q0.toAssignableList=function(Q,Z){var Y=Q.length;for(var J=0;J<Y;J++){var X=Q[J];if(X)this.toAssignable(X,Z)}if(Y){var K=Q[Y-1];if(this.options.ecmaVersion===6&&Z&&K&&K.type==="RestElement"&&K.argument.type!=="Identifier")this.unexpected(K.argument.start)}return Q};Q0.parseSpread=function(Q){var Z=this.startNode();return this.next(),Z.argument=this.parseMaybeAssign(!1,Q),this.finishNode(Z,"SpreadElement")};Q0.parseRestBinding=function(){var Q=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==z.name)this.unexpected();return Q.argument=this.parseBindingAtom(),this.finishNode(Q,"RestElement")};Q0.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case z.bracketL:var Q=this.startNode();return this.next(),Q.elements=this.parseBindingList(z.bracketR,!0,!0),this.finishNode(Q,"ArrayPattern");case z.braceL:return this.parseObj(!0)}return this.parseIdent()};Q0.parseBindingList=function(Q,Z,Y,J){var X=[],K=!0;while(!this.eat(Q)){if(K)K=!1;else this.expect(z.comma);if(Z&&this.type===z.comma)X.push(null);else if(Y&&this.afterTrailingComma(Q))break;else if(this.type===z.ellipsis){var W=this.parseRestBinding();if(this.parseBindingListItem(W),X.push(W),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(Q);break}else X.push(this.parseAssignableListItem(J))}return X};Q0.parseAssignableListItem=function(Q){var Z=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(Z),Z};Q0.parseBindingListItem=function(Q){return Q};Q0.parseMaybeDefault=function(Q,Z,Y){if(Y=Y||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(z.eq))return Y;var J=this.startNodeAt(Q,Z);return J.left=Y,J.right=this.parseMaybeAssign(),this.finishNode(J,"AssignmentPattern")};Q0.checkLValSimple=function(Q,Z,Y){if(Z===void 0)Z=u0;var J=Z!==u0;switch(Q.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(Q.name))this.raiseRecoverable(Q.start,(J?"Binding ":"Assigning to ")+Q.name+" in strict mode");if(J){if(Z===F0&&Q.name==="let")this.raiseRecoverable(Q.start,"let is disallowed as a lexically bound name");if(Y){if(V0(Y,Q.name))this.raiseRecoverable(Q.start,"Argument name clash");Y[Q.name]=!0}if(Z!==Y8)this.declareName(Q.name,Z,Q.start)}break;case"ChainExpression":this.raiseRecoverable(Q.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(J)this.raiseRecoverable(Q.start,"Binding member expression");break;case"ParenthesizedExpression":if(J)this.raiseRecoverable(Q.start,"Binding parenthesized expression");return this.checkLValSimple(Q.expression,Z,Y);default:this.raise(Q.start,(J?"Binding":"Assigning to")+" rvalue")}};Q0.checkLValPattern=function(Q,Z,Y){if(Z===void 0)Z=u0;switch(Q.type){case"ObjectPattern":for(var J=0,X=Q.properties;J<X.length;J+=1){var K=X[J];this.checkLValInnerPattern(K,Z,Y)}break;case"ArrayPattern":for(var W=0,H=Q.elements;W<H.length;W+=1){var G=H[W];if(G)this.checkLValInnerPattern(G,Z,Y)}break;default:this.checkLValSimple(Q,Z,Y)}};Q0.checkLValInnerPattern=function(Q,Z,Y){if(Z===void 0)Z=u0;switch(Q.type){case"Property":this.checkLValInnerPattern(Q.value,Z,Y);break;case"AssignmentPattern":this.checkLValPattern(Q.left,Z,Y);break;case"RestElement":this.checkLValPattern(Q.argument,Z,Y);break;default:this.checkLValPattern(Q,Z,Y)}};var J0=function(Z,Y,J,X,K){this.token=Z,this.isExpr=!!Y,this.preserveSpace=!!J,this.override=X,this.generator=!!K},f={b_stat:new J0("{",!1),b_expr:new J0("{",!0),b_tmpl:new J0("${",!1),p_stat:new J0("(",!1),p_expr:new J0("(",!0),q_tmpl:new J0("`",!0,!0,function(Q){return Q.tryReadTemplateToken()}),f_stat:new J0("function",!1),f_expr:new J0("function",!0),f_expr_gen:new J0("function",!0,!1,null,!0),f_gen:new J0("function",!1,!1,null,!0)},C0=u.prototype;C0.initialContext=function(){return[f.b_stat]};C0.curContext=function(){return this.context[this.context.length-1]};C0.braceIsBlock=function(Q){var Z=this.curContext();if(Z===f.f_expr||Z===f.f_stat)return!0;if(Q===z.colon&&(Z===f.b_stat||Z===f.b_expr))return!Z.isExpr;if(Q===z._return||Q===z.name&&this.exprAllowed)return a.test(this.input.slice(this.lastTokEnd,this.start));if(Q===z._else||Q===z.semi||Q===z.eof||Q===z.parenR||Q===z.arrow)return!0;if(Q===z.braceL)return Z===f.b_stat;if(Q===z._var||Q===z._const||Q===z.name)return!1;return!this.exprAllowed};C0.inGeneratorContext=function(){for(var Q=this.context.length-1;Q>=1;Q--){var Z=this.context[Q];if(Z.token==="function")return Z.generator}return!1};C0.updateContext=function(Q){var Z,Y=this.type;if(Y.keyword&&Q===z.dot)this.exprAllowed=!1;else if(Z=Y.updateContext)Z.call(this,Q);else this.exprAllowed=Y.beforeExpr};C0.overrideContext=function(Q){if(this.curContext()!==Q)this.context[this.context.length-1]=Q};z.parenR.updateContext=z.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var Q=this.context.pop();if(Q===f.b_stat&&this.curContext().token==="function")Q=this.context.pop();this.exprAllowed=!Q.isExpr};z.braceL.updateContext=function(Q){this.context.push(this.braceIsBlock(Q)?f.b_stat:f.b_expr),this.exprAllowed=!0};z.dollarBraceL.updateContext=function(){this.context.push(f.b_tmpl),this.exprAllowed=!0};z.parenL.updateContext=function(Q){var Z=Q===z._if||Q===z._for||Q===z._with||Q===z._while;this.context.push(Z?f.p_stat:f.p_expr),this.exprAllowed=!0};z.incDec.updateContext=function(){};z._function.updateContext=z._class.updateContext=function(Q){if(Q.beforeExpr&&Q!==z._else&&!(Q===z.semi&&this.curContext()!==f.p_stat)&&!(Q===z._return&&a.test(this.input.slice(this.lastTokEnd,this.start)))&&!((Q===z.colon||Q===z.braceL)&&this.curContext()===f.b_stat))this.context.push(f.f_expr);else this.context.push(f.f_stat);this.exprAllowed=!1};z.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};z.backQuote.updateContext=function(){if(this.curContext()===f.q_tmpl)this.context.pop();else this.context.push(f.q_tmpl);this.exprAllowed=!1};z.star.updateContext=function(Q){if(Q===z._function){var Z=this.context.length-1;if(this.context[Z]===f.f_expr)this.context[Z]=f.f_expr_gen;else this.context[Z]=f.f_gen}this.exprAllowed=!0};z.name.updateContext=function(Q){var Z=!1;if(this.options.ecmaVersion>=6&&Q!==z.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())Z=!0}this.exprAllowed=Z};var A=u.prototype;A.checkPropClash=function(Q,Z,Y){if(this.options.ecmaVersion>=9&&Q.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(Q.computed||Q.method||Q.shorthand))return;var J=Q.key,X;switch(J.type){case"Identifier":X=J.name;break;case"Literal":X=String(J.value);break;default:return}var K=Q.kind;if(this.options.ecmaVersion>=6){if(X==="__proto__"&&K==="init"){if(Z.proto)if(Y){if(Y.doubleProto<0)Y.doubleProto=J.start}else this.raiseRecoverable(J.start,"Redefinition of __proto__ property");Z.proto=!0}return}X="$"+X;var W=Z[X];if(W){var H;if(K==="init")H=this.strict&&W.init||W.get||W.set;else H=W.init||W[K];if(H)this.raiseRecoverable(J.start,"Redefinition of property")}else W=Z[X]={init:!1,get:!1,set:!1};W[K]=!0};A.parseExpression=function(Q,Z){var Y=this.start,J=this.startLoc,X=this.parseMaybeAssign(Q,Z);if(this.type===z.comma){var K=this.startNodeAt(Y,J);K.expressions=[X];while(this.eat(z.comma))K.expressions.push(this.parseMaybeAssign(Q,Z));return this.finishNode(K,"SequenceExpression")}return X};A.parseMaybeAssign=function(Q,Z,Y){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(Q);else this.exprAllowed=!1;var J=!1,X=-1,K=-1,W=-1;if(Z)X=Z.parenthesizedAssign,K=Z.trailingComma,W=Z.doubleProto,Z.parenthesizedAssign=Z.trailingComma=-1;else Z=new a0,J=!0;var H=this.start,G=this.startLoc;if(this.type===z.parenL||this.type===z.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=Q==="await";var _=this.parseMaybeConditional(Q,Z);if(Y)_=Y.call(this,_,H,G);if(this.type.isAssign){var F=this.startNodeAt(H,G);if(F.operator=this.value,this.type===z.eq)_=this.toAssignable(_,!1,Z);if(!J)Z.parenthesizedAssign=Z.trailingComma=Z.doubleProto=-1;if(Z.shorthandAssign>=_.start)Z.shorthandAssign=-1;if(this.type===z.eq)this.checkLValPattern(_);else this.checkLValSimple(_);if(F.left=_,this.next(),F.right=this.parseMaybeAssign(Q),W>-1)Z.doubleProto=W;return this.finishNode(F,"AssignmentExpression")}else if(J)this.checkExpressionErrors(Z,!0);if(X>-1)Z.parenthesizedAssign=X;if(K>-1)Z.trailingComma=K;return _};A.parseMaybeConditional=function(Q,Z){var Y=this.start,J=this.startLoc,X=this.parseExprOps(Q,Z);if(this.checkExpressionErrors(Z))return X;if(this.eat(z.question)){var K=this.startNodeAt(Y,J);return K.test=X,K.consequent=this.parseMaybeAssign(),this.expect(z.colon),K.alternate=this.parseMaybeAssign(Q),this.finishNode(K,"ConditionalExpression")}return X};A.parseExprOps=function(Q,Z){var Y=this.start,J=this.startLoc,X=this.parseMaybeUnary(Z,!1,!1,Q);if(this.checkExpressionErrors(Z))return X;return X.start===Y&&X.type==="ArrowFunctionExpression"?X:this.parseExprOp(X,Y,J,-1,Q)};A.parseExprOp=function(Q,Z,Y,J,X){var K=this.type.binop;if(K!=null&&(!X||this.type!==z._in)){if(K>J){var W=this.type===z.logicalOR||this.type===z.logicalAND,H=this.type===z.coalesce;if(H)K=z.logicalAND.binop;var G=this.value;this.next();var _=this.start,F=this.startLoc,O=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,X),_,F,K,X),R=this.buildBinary(Z,Y,Q,O,G,W||H);if(W&&this.type===z.coalesce||H&&(this.type===z.logicalOR||this.type===z.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(R,Z,Y,J,X)}}return Q};A.buildBinary=function(Q,Z,Y,J,X,K){if(J.type==="PrivateIdentifier")this.raise(J.start,"Private identifier can only be left side of binary expression");var W=this.startNodeAt(Q,Z);return W.left=Y,W.operator=X,W.right=J,this.finishNode(W,K?"LogicalExpression":"BinaryExpression")};A.parseMaybeUnary=function(Q,Z,Y,J){var X=this.start,K=this.startLoc,W;if(this.isContextual("await")&&this.canAwait)W=this.parseAwait(J),Z=!0;else if(this.type.prefix){var H=this.startNode(),G=this.type===z.incDec;if(H.operator=this.value,H.prefix=!0,this.next(),H.argument=this.parseMaybeUnary(null,!0,G,J),this.checkExpressionErrors(Q,!0),G)this.checkLValSimple(H.argument);else if(this.strict&&H.operator==="delete"&&X8(H.argument))this.raiseRecoverable(H.start,"Deleting local variable in strict mode");else if(H.operator==="delete"&&$1(H.argument))this.raiseRecoverable(H.start,"Private fields can not be deleted");else Z=!0;W=this.finishNode(H,G?"UpdateExpression":"UnaryExpression")}else if(!Z&&this.type===z.privateId){if((J||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(W=this.parsePrivateIdent(),this.type!==z._in)this.unexpected()}else{if(W=this.parseExprSubscripts(Q,J),this.checkExpressionErrors(Q))return W;while(this.type.postfix&&!this.canInsertSemicolon()){var _=this.startNodeAt(X,K);_.operator=this.value,_.prefix=!1,_.argument=W,this.checkLValSimple(W),this.next(),W=this.finishNode(_,"UpdateExpression")}}if(!Y&&this.eat(z.starstar))if(Z)this.unexpected(this.lastTokStart);else return this.buildBinary(X,K,W,this.parseMaybeUnary(null,!1,!1,J),"**",!1);else return W};function X8(Q){return Q.type==="Identifier"||Q.type==="ParenthesizedExpression"&&X8(Q.expression)}function $1(Q){return Q.type==="MemberExpression"&&Q.property.type==="PrivateIdentifier"||Q.type==="ChainExpression"&&$1(Q.expression)||Q.type==="ParenthesizedExpression"&&$1(Q.expression)}A.parseExprSubscripts=function(Q,Z){var Y=this.start,J=this.startLoc,X=this.parseExprAtom(Q,Z);if(X.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return X;var K=this.parseSubscripts(X,Y,J,!1,Z);if(Q&&K.type==="MemberExpression"){if(Q.parenthesizedAssign>=K.start)Q.parenthesizedAssign=-1;if(Q.parenthesizedBind>=K.start)Q.parenthesizedBind=-1;if(Q.trailingComma>=K.start)Q.trailingComma=-1}return K};A.parseSubscripts=function(Q,Z,Y,J,X){var K=this.options.ecmaVersion>=8&&Q.type==="Identifier"&&Q.name==="async"&&this.lastTokEnd===Q.end&&!this.canInsertSemicolon()&&Q.end-Q.start===5&&this.potentialArrowAt===Q.start,W=!1;while(!0){var H=this.parseSubscript(Q,Z,Y,J,K,W,X);if(H.optional)W=!0;if(H===Q||H.type==="ArrowFunctionExpression"){if(W){var G=this.startNodeAt(Z,Y);G.expression=H,H=this.finishNode(G,"ChainExpression")}return H}Q=H}};A.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(z.arrow)};A.parseSubscriptAsyncArrow=function(Q,Z,Y,J){return this.parseArrowExpression(this.startNodeAt(Q,Z),Y,!0,J)};A.parseSubscript=function(Q,Z,Y,J,X,K,W){var H=this.options.ecmaVersion>=11,G=H&&this.eat(z.questionDot);if(J&&G)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var _=this.eat(z.bracketL);if(_||G&&this.type!==z.parenL&&this.type!==z.backQuote||this.eat(z.dot)){var F=this.startNodeAt(Z,Y);if(F.object=Q,_)F.property=this.parseExpression(),this.expect(z.bracketR);else if(this.type===z.privateId&&Q.type!=="Super")F.property=this.parsePrivateIdent();else F.property=this.parseIdent(this.options.allowReserved!=="never");if(F.computed=!!_,H)F.optional=G;Q=this.finishNode(F,"MemberExpression")}else if(!J&&this.eat(z.parenL)){var O=new a0,R=this.yieldPos,$=this.awaitPos,M=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var L=this.parseExprList(z.parenR,this.options.ecmaVersion>=8,!1,O);if(X&&!G&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(O,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=R,this.awaitPos=$,this.awaitIdentPos=M,this.parseSubscriptAsyncArrow(Z,Y,L,W)}this.checkExpressionErrors(O,!0),this.yieldPos=R||this.yieldPos,this.awaitPos=$||this.awaitPos,this.awaitIdentPos=M||this.awaitIdentPos;var B=this.startNodeAt(Z,Y);if(B.callee=Q,B.arguments=L,H)B.optional=G;Q=this.finishNode(B,"CallExpression")}else if(this.type===z.backQuote){if(G||K)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var I=this.startNodeAt(Z,Y);I.tag=Q,I.quasi=this.parseTemplate({isTagged:!0}),Q=this.finishNode(I,"TaggedTemplateExpression")}return Q};A.parseExprAtom=function(Q,Z,Y){if(this.type===z.slash)this.readRegexp();var J,X=this.potentialArrowAt===this.start;switch(this.type){case z._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(J=this.startNode(),this.next(),this.type===z.parenL&&!this.allowDirectSuper)this.raise(J.start,"super() call outside constructor of a subclass");if(this.type!==z.dot&&this.type!==z.bracketL&&this.type!==z.parenL)this.unexpected();return this.finishNode(J,"Super");case z._this:return J=this.startNode(),this.next(),this.finishNode(J,"ThisExpression");case z.name:var K=this.start,W=this.startLoc,H=this.containsEsc,G=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!H&&G.name==="async"&&!this.canInsertSemicolon()&&this.eat(z._function))return this.overrideContext(f.f_expr),this.parseFunction(this.startNodeAt(K,W),0,!1,!0,Z);if(X&&!this.canInsertSemicolon()){if(this.eat(z.arrow))return this.parseArrowExpression(this.startNodeAt(K,W),[G],!1,Z);if(this.options.ecmaVersion>=8&&G.name==="async"&&this.type===z.name&&!H&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(G=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(z.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(K,W),[G],!0,Z)}}return G;case z.regexp:var _=this.value;return J=this.parseLiteral(_.value),J.regex={pattern:_.pattern,flags:_.flags},J;case z.num:case z.string:return this.parseLiteral(this.value);case z._null:case z._true:case z._false:return J=this.startNode(),J.value=this.type===z._null?null:this.type===z._true,J.raw=this.type.keyword,this.next(),this.finishNode(J,"Literal");case z.parenL:var F=this.start,O=this.parseParenAndDistinguishExpression(X,Z);if(Q){if(Q.parenthesizedAssign<0&&!this.isSimpleAssignTarget(O))Q.parenthesizedAssign=F;if(Q.parenthesizedBind<0)Q.parenthesizedBind=F}return O;case z.bracketL:return J=this.startNode(),this.next(),J.elements=this.parseExprList(z.bracketR,!0,!0,Q),this.finishNode(J,"ArrayExpression");case z.braceL:return this.overrideContext(f.b_expr),this.parseObj(!1,Q);case z._function:return J=this.startNode(),this.next(),this.parseFunction(J,0);case z._class:return this.parseClass(this.startNode(),!1);case z._new:return this.parseNew();case z.backQuote:return this.parseTemplate();case z._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Y);else return this.unexpected();default:return this.parseExprAtomDefault()}};A.parseExprAtomDefault=function(){this.unexpected()};A.parseExprImport=function(Q){var Z=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===z.parenL&&!Q)return this.parseDynamicImport(Z);else if(this.type===z.dot){var Y=this.startNodeAt(Z.start,Z.loc&&Z.loc.start);return Y.name="import",Z.meta=this.finishNode(Y,"Identifier"),this.parseImportMeta(Z)}else this.unexpected()};A.parseDynamicImport=function(Q){if(this.next(),Q.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(z.parenR))if(this.expect(z.comma),!this.afterTrailingComma(z.parenR)){if(Q.options=this.parseMaybeAssign(),!this.eat(z.parenR)){if(this.expect(z.comma),!this.afterTrailingComma(z.parenR))this.unexpected()}}else Q.options=null;else Q.options=null;else if(!this.eat(z.parenR)){var Z=this.start;if(this.eat(z.comma)&&this.eat(z.parenR))this.raiseRecoverable(Z,"Trailing comma is not allowed in import()");else this.unexpected(Z)}return this.finishNode(Q,"ImportExpression")};A.parseImportMeta=function(Q){this.next();var Z=this.containsEsc;if(Q.property=this.parseIdent(!0),Q.property.name!=="meta")this.raiseRecoverable(Q.property.start,"The only valid meta property for import is 'import.meta'");if(Z)this.raiseRecoverable(Q.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(Q.start,"Cannot use 'import.meta' outside a module");return this.finishNode(Q,"MetaProperty")};A.parseLiteral=function(Q){var Z=this.startNode();if(Z.value=Q,Z.raw=this.input.slice(this.start,this.end),Z.raw.charCodeAt(Z.raw.length-1)===110)Z.bigint=Z.value!=null?Z.value.toString():Z.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(Z,"Literal")};A.parseParenExpression=function(){this.expect(z.parenL);var Q=this.parseExpression();return this.expect(z.parenR),Q};A.shouldParseArrow=function(Q){return!this.canInsertSemicolon()};A.parseParenAndDistinguishExpression=function(Q,Z){var Y=this.start,J=this.startLoc,X,K=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var W=this.start,H=this.startLoc,G=[],_=!0,F=!1,O=new a0,R=this.yieldPos,$=this.awaitPos,M;this.yieldPos=0,this.awaitPos=0;while(this.type!==z.parenR)if(_?_=!1:this.expect(z.comma),K&&this.afterTrailingComma(z.parenR,!0)){F=!0;break}else if(this.type===z.ellipsis){if(M=this.start,G.push(this.parseParenItem(this.parseRestBinding())),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else G.push(this.parseMaybeAssign(!1,O,this.parseParenItem));var L=this.lastTokEnd,B=this.lastTokEndLoc;if(this.expect(z.parenR),Q&&this.shouldParseArrow(G)&&this.eat(z.arrow))return this.checkPatternErrors(O,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=R,this.awaitPos=$,this.parseParenArrowList(Y,J,G,Z);if(!G.length||F)this.unexpected(this.lastTokStart);if(M)this.unexpected(M);if(this.checkExpressionErrors(O,!0),this.yieldPos=R||this.yieldPos,this.awaitPos=$||this.awaitPos,G.length>1)X=this.startNodeAt(W,H),X.expressions=G,this.finishNodeAt(X,"SequenceExpression",L,B);else X=G[0]}else X=this.parseParenExpression();if(this.options.preserveParens){var I=this.startNodeAt(Y,J);return I.expression=X,this.finishNode(I,"ParenthesizedExpression")}else return X};A.parseParenItem=function(Q){return Q};A.parseParenArrowList=function(Q,Z,Y,J){return this.parseArrowExpression(this.startNodeAt(Q,Z),Y,!1,J)};var BQ=[];A.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var Q=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===z.dot){var Z=this.startNodeAt(Q.start,Q.loc&&Q.loc.start);Z.name="new",Q.meta=this.finishNode(Z,"Identifier"),this.next();var Y=this.containsEsc;if(Q.property=this.parseIdent(!0),Q.property.name!=="target")this.raiseRecoverable(Q.property.start,"The only valid meta property for new is 'new.target'");if(Y)this.raiseRecoverable(Q.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(Q.start,"'new.target' can only be used in functions and class static block");return this.finishNode(Q,"MetaProperty")}var J=this.start,X=this.startLoc;if(Q.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),J,X,!0,!1),this.eat(z.parenL))Q.arguments=this.parseExprList(z.parenR,this.options.ecmaVersion>=8,!1);else Q.arguments=BQ;return this.finishNode(Q,"NewExpression")};A.parseTemplateElement=function(Q){var Z=Q.isTagged,Y=this.startNode();if(this.type===z.invalidTemplate){if(!Z)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Y.value={raw:this.value.replace(/\r\n?/g,`
1
+ import{s as q,validate as J1,filter as k1}from"tosijs-schema";class o{$error=!0;message;op;cause;constructor(Q,Z,Y){this.message=Q,this.op=Z,this.cause=Y}toString(){return`AgentError[${this.op}]: ${this.message}`}toJSON(){return{$error:!0,message:this.message,op:this.op}}}function kZ(Q){return Q instanceof o||Q&&Q.$error===!0}var w0=new Map,a8=3600000,o8=102400,X1="proc_";function W1(Q){return typeof Q==="string"&&Q.startsWith(X1)}function K1(Q){let Z=w0.get(Q);if(!Z)throw Error(`Procedure not found: ${Q}`);if(Date.now()>Z.expiresAt)throw w0.delete(Q),Error(`Procedure expired: ${Q}`);return Z.ast}function s8(){if(typeof crypto<"u"&&crypto.randomUUID)return X1+crypto.randomUUID();return X1+Math.random().toString(36).slice(2)+Date.now().toString(36)}var v1=new Set(["__proto__","constructor","prototype"]);function P1(Q){if(v1.has(Q))throw Error(`Security Error: Access to '${Q}' is forbidden`)}var r8=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","metadata.google.internal"]);function t8(Q){try{let Z=new URL(Q);if(Z.protocol!=="http:"&&Z.protocol!=="https:")return!0;let Y=Z.hostname.toLowerCase();if(r8.has(Y))return!0;if(Y.endsWith(".internal")||Y.endsWith(".local"))return!0;if(Y==="169.254.169.254")return!0;if(/^10\./.test(Y)||/^192\.168\./.test(Y)||/^172\.(1[6-9]|2\d|3[01])\./.test(Y))return!0;return!1}catch{return!0}}function e8(Q){if(/\([^)]*[+*][^)]*\)[+*]/.test(Q))return!0;if(/\(([^|)]+)\|\1\)[+*]/.test(Q))return!0;if(/\(\.\*\)\+/.test(Q))return!0;if(/\(\.\+\)\+/.test(Q))return!0;if(/\(\[.*\]\+\)\+/.test(Q))return!0;return!1}function $0(Q){return{...Q,state:Object.create(Q.state)}}function Q9(Q,Z){let Y={},J=new Set([...Object.keys(Q),...Object.keys(Z)]);for(let X of J){let K=Q[X],W=Z[X];if(W!==K)Y[X]=W}return Y}function U(Q,Z){if(Q&&typeof Q==="object"&&Q.$kind==="arg")return Z.args[Q.path];if(Q&&typeof Q==="object"&&Q.$expr)return x(Q,Z);if(typeof Q==="string"){if(Q.startsWith("args.")&&!("args"in Z.state))return Z.args[Q.replace("args.","")];if(Q.includes(".")){let Y=Q.split(".");for(let X of Y)if(v1.has(X))throw Error(`Security Error: Access to '${X}' is forbidden`);let J=Z.state[Y[0]];if(J!==void 0){for(let X=1;X<Y.length;X++)J=J?.[Y[X]];return J}}if(Q in Z.state)return Z.state[Q];return Q}if(Q&&typeof Q==="object"&&!Array.isArray(Q)&&Q.constructor===Object){let Y={};for(let J of Object.keys(Q))Y[J]=U(Q[J],Z);return Y}if(Array.isArray(Q))return Q.map((Y)=>U(Y,Z));return Q}function B0(Q,Z,Y){return new Proxy(Z,{get(J,X){if(X in J)return J[X];let K=Y?.[X];if(K)throw Error(`${Q}.${X} is not available. ${K}`);throw Error(`${Q}.${X} is not supported in AsyncJS. Check docs for available ${Q} methods.`)}})}function A0(Q){if(Q===null)return{type:"null"};if(Q===void 0)return{};if(typeof Q==="object"&&Q!==null&&"type"in Q&&typeof Q.type==="string")return Q;if(typeof Q==="object"&&Q!==null&&"schema"in Q&&typeof Q.schema==="object")return Q.schema;let Z=typeof Q;if(Z==="string")return{type:"string"};if(Z==="number")return Number.isInteger(Q)?{type:"integer"}:{type:"number"};if(Z==="boolean")return{type:"boolean"};if(Array.isArray(Q)){if(Q.length===0)return{type:"array"};return{type:"array",items:A0(Q[0])}}if(Z==="object"){let Y={},J=[];for(let[X,K]of Object.entries(Q))Y[X]=A0(K),J.push(X);return{type:"object",properties:Y,required:J}}return{}}var G0={Math:B0("Math",{PI:Math.PI,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,SQRT2:Math.SQRT2,SQRT1_2:Math.SQRT1_2,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc,sign:Math.sign,sqrt:Math.sqrt,cbrt:Math.cbrt,pow:Math.pow,exp:Math.exp,expm1:Math.expm1,log:Math.log,log2:Math.log2,log10:Math.log10,log1p:Math.log1p,sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,atan2:Math.atan2,sinh:Math.sinh,cosh:Math.cosh,tanh:Math.tanh,asinh:Math.asinh,acosh:Math.acosh,atanh:Math.atanh,hypot:Math.hypot,min:Math.min,max:Math.max,clz32:Math.clz32,imul:Math.imul,fround:Math.fround,random:()=>{if(typeof crypto<"u"&&crypto.getRandomValues){let Q=new Uint32Array(1);return crypto.getRandomValues(Q),Q[0]/4294967296}return Math.random()}}),JSON:B0("JSON",{parse:(Q)=>JSON.parse(Q),stringify:(Q,Z,Y)=>JSON.stringify(Q,Z,Y)}),console:B0("console",{log:(...Q)=>{return},warn:(...Q)=>{return},error:(...Q)=>{return},info:(...Q)=>{return}},{table:"Use console.log with JSON.stringify for structured data.",dir:"Use console.log instead.",trace:"Stack traces are not available in AsyncJS."}),Array:B0("Array",{isArray:(Q)=>Array.isArray(Q),from:(Q,Z,Y)=>Array.from(Q,Z,Y),of:(...Q)=>Array.of(...Q)},{prototype:"Prototype access is not allowed."}),Object:B0("Object",{keys:(Q)=>Object.keys(Q),values:(Q)=>Object.values(Q),entries:(Q)=>Object.entries(Q),fromEntries:(Q)=>Object.fromEntries(Q),assign:(Q,...Z)=>Object.assign({},Q,...Z),hasOwn:(Q,Z)=>Object.hasOwn(Q,Z)},{prototype:"Prototype access is not allowed.",create:"Use object literals instead.",defineProperty:"Property descriptors are not supported.",getPrototypeOf:"Prototype access is not allowed.",setPrototypeOf:"Prototype modification is not allowed."}),String:B0("String",{fromCharCode:(...Q)=>String.fromCharCode(...Q),fromCodePoint:(...Q)=>String.fromCodePoint(...Q)}),Number:B0("Number",{isNaN:Number.isNaN,isFinite:Number.isFinite,isInteger:Number.isInteger,isSafeInteger:Number.isSafeInteger,parseFloat,parseInt,MAX_VALUE:Number.MAX_VALUE,MIN_VALUE:Number.MIN_VALUE,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,MIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,POSITIVE_INFINITY:Number.POSITIVE_INFINITY,NEGATIVE_INFINITY:Number.NEGATIVE_INFINITY,NaN:Number.NaN,EPSILON:Number.EPSILON}),parseInt,parseFloat,isNaN,isFinite,encodeURI,decodeURI,encodeURIComponent,decodeURIComponent,undefined:void 0,null:null,NaN:NaN,Infinity:1/0,filter:(Q,Z)=>{let Y=A0(Z),J=k1(Q,Y);if(J instanceof Error)throw J;return J},Schema:{...q,response:(Q,Z)=>{let Y=Z?.schema!=null?Z.schema:A0(Z);return{type:"json_schema",json_schema:{name:Q,strict:!0,schema:Y}}},fromExample:(Q)=>A0(Q),isValid:(Q,Z)=>{if(Z?.schema!=null)return J1(Q,Z);return J1(Q,A0(Z))}},Set:(Q=[])=>{let Z=[...new globalThis.Set(Q)];return{add(Y){if(!Z.includes(Y))Z.push(Y);return this},remove(Y){let J=Z.indexOf(Y);if(J!==-1)Z.splice(J,1);return this},clear(){return Z.length=0,this},has(Y){return Z.includes(Y)},get size(){return Z.length},toArray(){return[...Z]},union(Y){let J=Y?.toArray?.()??Y??[];return G0.Set([...Z,...J])},intersection(Y){let J=Y?.toArray?.()??Y??[];return G0.Set(Z.filter((X)=>J.includes(X)))},diff(Y){let J=Y?.toArray?.()??Y??[];return G0.Set(Z.filter((X)=>!J.includes(X)))},forEach(Y){Z.forEach(Y)},map(Y){return G0.Set(Z.map(Y))},filter(Y){return G0.Set(Z.filter(Y))},toJSON(){return[...Z]}}},Date:(()=>{let Q=(Y)=>({get value(){return Y.toISOString()},get timestamp(){return Y.getTime()},get year(){return Y.getFullYear()},get month(){return Y.getMonth()+1},get day(){return Y.getDate()},get hours(){return Y.getHours()},get minutes(){return Y.getMinutes()},get seconds(){return Y.getSeconds()},get dayOfWeek(){return Y.getDay()},add({years:J=0,months:X=0,days:K=0,hours:W=0,minutes:H=0,seconds:G=0,ms:_=0}={}){let F=new globalThis.Date(Y.getTime());if(J)F.setFullYear(F.getFullYear()+J);if(X)F.setMonth(F.getMonth()+X);if(K)F.setDate(F.getDate()+K);if(W)F.setHours(F.getHours()+W);if(H)F.setMinutes(F.getMinutes()+H);if(G)F.setSeconds(F.getSeconds()+G);if(_)F.setMilliseconds(F.getMilliseconds()+_);return Q(F)},diff(J,X="ms"){let K=typeof J==="object"&&J.timestamp?J.timestamp:new globalThis.Date(J).getTime(),W=Y.getTime()-K;switch(X){case"seconds":return W/1000;case"minutes":return W/60000;case"hours":return W/3600000;case"days":return W/86400000;default:return W}},format(J="ISO"){if(J==="ISO")return Y.toISOString();if(J==="date")return Y.toISOString().split("T")[0];if(J==="time")return Y.toISOString().split("T")[1].split(".")[0];return J.replace("YYYY",String(Y.getFullYear())).replace("MM",String(Y.getMonth()+1).padStart(2,"0")).replace("DD",String(Y.getDate()).padStart(2,"0")).replace("HH",String(Y.getHours()).padStart(2,"0")).replace("mm",String(Y.getMinutes()).padStart(2,"0")).replace("ss",String(Y.getSeconds()).padStart(2,"0"))},isBefore(J){let X=typeof J==="object"&&J.timestamp?J.timestamp:new globalThis.Date(J).getTime();return Y.getTime()<X},isAfter(J){let X=typeof J==="object"&&J.timestamp?J.timestamp:new globalThis.Date(J).getTime();return Y.getTime()>X},toString(){return Y.toISOString()},toJSON(){return Y.toISOString()}}),Z=(Y)=>{let J=Y!==void 0?new globalThis.Date(Y):new globalThis.Date;if(isNaN(J.getTime()))throw Error(`Invalid date: ${Y}`);return Q(J)};return Z.now=()=>globalThis.Date.now(),Z.parse=(Y)=>Q(new globalThis.Date(Y)),Z})()},h0={RegExp:"RegExp is not available. Use string methods or the regexMatch atom.",Promise:"Promise is not needed. All operations are implicitly async.",Map:"Map is not available. Use plain objects instead.",WeakSet:"WeakSet is not available.",WeakMap:"WeakMap is not available.",Symbol:"Symbol is not available.",Proxy:"Proxy is not available.",Reflect:"Reflect is not available.",Function:"Function constructor is not available. Define functions normally.",eval:"eval is not available. Code is compiled, not evaluated.",setTimeout:"setTimeout is not available. Use the delay atom.",setInterval:"setInterval is not available. Use while loops with delay.",fetch:"fetch is not available. Use the httpFetch atom.",require:"require is not available. Atoms must be registered with the VM.",import:"import is not available. Atoms must be registered with the VM.",process:"process is not available. AsyncJS runs in a sandboxed environment.",window:"window is not available. AsyncJS runs in a sandboxed environment.",document:"document is not available. AsyncJS runs in a sandboxed environment.",global:"global is not available. AsyncJS runs in a sandboxed environment.",globalThis:"globalThis is not available. Use builtins directly."},Z9=0.01,C1=0.0001,b1=0.001,Y9=new Set(["concat","slice","map","filter","flatMap","flat","toReversed","toSorted","toSpliced","repeat","padStart","padEnd","split","join","replace","replaceAll","substring","substr","trim","trimStart","trimEnd","toLowerCase","toUpperCase","match","matchAll","parse","stringify"]);function x(Q,Z){if(Q===null||Q===void 0)return Q;if(typeof Q!=="object"||!("$expr"in Q))return Q;if(Z.fuel){if(Z.fuel.current-=Z9,Z.fuel.current<=0)throw Error("Out of Fuel")}switch(Q.$expr){case"literal":return Q.value;case"ident":{if(Q.name in Z.state)return Z.state[Q.name];if(Q.name in Z.args)return Z.args[Q.name];if(Q.name in G0)return G0[Q.name];if(Q.name in h0)throw Error(h0[Q.name]);return}case"member":{let Y=x(Q.object,Z);if(Q.optional&&(Y===null||Y===void 0))return;let J=Q.property;return P1(J),Y?.[J]}case"binary":{let Y=x(Q.left,Z),J=x(Q.right,Z);switch(Q.op){case"+":{let X=Y+J;if(typeof X==="string"&&Z.fuel){if(Z.fuel.current-=X.length*C1,Z.fuel.current<=0){Z.error=new o("Out of Fuel","expr.concat");return}}return X}case"-":return Y-J;case"*":return Y*J;case"/":return Y/J;case"%":return Y%J;case"**":return Y**J;case">":return Y>J;case"<":return Y<J;case">=":return Y>=J;case"<=":return Y<=J;case"==":return Y==J;case"!=":return Y!=J;case"===":return Y===J;case"!==":return Y!==J;default:throw Error(`Unknown binary operator: ${Q.op}`)}}case"unary":{let Y=x(Q.argument,Z);switch(Q.op){case"!":return!Y;case"-":return-Y;case"+":return+Y;case"typeof":return typeof Y;default:throw Error(`Unknown unary operator: ${Q.op}`)}}case"logical":{let Y=x(Q.left,Z);if(Q.op==="&&")return Y?x(Q.right,Z):Y;else if(Q.op==="??")return Y??x(Q.right,Z);else return Y?Y:x(Q.right,Z)}case"conditional":return x(Q.test,Z)?x(Q.consequent,Z):x(Q.alternate,Z);case"array":return Q.elements.map((Y)=>x(Y,Z));case"object":{let Y={};for(let J of Q.properties)Y[J.key]=x(J.value,Z);return Y}case"call":{if(Q.callee==="Error"){let J=Q.arguments.map((K)=>x(K,Z)),X=typeof J[0]==="string"?J[0]:"Error";Z.error=new o(X,"Error");return}if(Q.callee in G0){let J=G0[Q.callee];if(typeof J==="function"){let X=Q.arguments.map((K)=>x(K,Z));return J(...X)}}if(!Z.resolver(Q.callee)){if(Q.callee in h0)throw Error(h0[Q.callee]);throw Error(`Unknown function: ${Q.callee}`)}throw Error(`Atom calls in expressions not yet supported: ${Q.callee}`)}case"methodCall":{let Y=x(Q.object,Z);if(Q.optional&&(Y===null||Y===void 0))return;let J=Q.method;if(P1(J),Y===null||Y===void 0)throw Error(`Cannot call method '${J}' on ${Y}`);let X=Y[J];if(typeof X!=="function")throw Error(`'${J}' is not a function`);let K=Q.arguments.map((H)=>x(H,Z)),W=X.apply(Y,K);if(Z.fuel&&Y9.has(J)){let H=0;if(typeof W==="string")H=W.length*C1;else if(Array.isArray(W))H=W.length*b1;else if(typeof W==="object"&&W!==null)H=Object.keys(W).length*b1;if(Z.fuel.current-=H,Z.fuel.current<=0){Z.error=new o("Out of Fuel",`expr.${J}`);return}}return W}default:throw Error(`Unknown expression type: ${Q.$expr}`)}}function A(Q,Z,Y,J,X={}){let{docs:K="",timeoutMs:W=1000,cost:H=1}=typeof X==="string"?{docs:X}:X;return{op:Q,inputSchema:Z,outputSchema:Y,exec:async(_,F)=>{let{op:O,result:R,...$}=_;if(F.error)return;let M=F.trace?{...F.state}:null,L=F.fuel.current,B,I;try{let V=F.costOverrides?.[Q],v=V!==void 0?V:H,P=typeof v==="function"?v($,F):v;if((F.fuel.current-=P)<=0){F.error=new o("Out of Fuel",Q);return}let E,S=async()=>J(_,F);if(B=W>0?await Promise.race([S(),new Promise((k,y)=>{E=setTimeout(()=>y(Error(`Atom '${Q}' timed out`)),W)})]).finally(()=>clearTimeout(E)):await S(),_.result){if(F.consts.has(_.result))throw Error(`Cannot reassign const variable '${_.result}'`);if(B!==void 0&&Y&&!J1(B,Y)){F.error=new o(`Output validation failed for '${Q}'`,Q);return}if(F.state[_.result]=B,_.resultConst)F.consts.add(_.result)}}catch(V){I=V.message||String(V),F.error=new o(I,Q,V)}finally{if(F.trace&&M){let V=Q9(M,F.state);F.trace.push({op:Q,input:$,stateDiff:V,result:B,error:I,fuelBefore:L,fuelAfter:F.fuel.current,timestamp:new Date().toISOString()})}}},docs:K,timeoutMs:W,cost:H,create:(_)=>({op:Q,..._})}}var s=A("seq",q.object({steps:q.array(q.any)}),void 0,async({steps:Q},Z)=>{for(let Y of Q){if(Z.output!==void 0)return;if(Z.error)return;let J=Z.resolver(Y.op);if(!J)throw Error(`Unknown Atom: ${Y.op}`);await J.exec(Y,Z)}},{docs:"Sequence",timeoutMs:0,cost:0.1}),J9=A("if",q.object({condition:q.any,then:q.array(q.any),else:q.array(q.any).optional}),void 0,async(Q,Z)=>{if(x(Q.condition,Z))await s.exec({op:"seq",steps:Q.then},Z);else if(Q.else)await s.exec({op:"seq",steps:Q.else},Z)},{docs:"If/Else",timeoutMs:0,cost:0.1}),X9=A("while",q.object({condition:q.any,body:q.array(q.any)}),void 0,async(Q,Z)=>{while(x(Q.condition,Z)){if(Z.signal?.aborted)throw Error("Execution aborted");if((Z.fuel.current-=0.1)<=0)throw Error("Out of Fuel");if(await s.exec({op:"seq",steps:Q.body},Z),Z.output!==void 0)return}},{docs:"While Loop",timeoutMs:0,cost:0.1}),W9=A("return",void 0,q.any,async(Q,Z)=>{if(Z.error)return Z.output=Z.error,Z.error;if("value"in Q){let J=U(Q.value,Z);return Z.output=J,J}let Y={};if(Q.schema?.properties){for(let J of Object.keys(Q.schema.properties))Y[J]=Z.state[J];if(Q.filter!==!1){let J=k1(Y,Q.schema);if(!(J instanceof Error))Y=J}}return Z.output=Y,Y},{docs:"Return",cost:0.1}),K9=A("try",q.object({try:q.array(q.any),catch:q.array(q.any).optional,catchParam:q.string.optional}),void 0,async(Q,Z)=>{if(await s.exec({op:"seq",steps:Q.try},Z),Z.error&&Q.catch){let Y=Q.catchParam||"error";Z.state[Y]=Z.error.message,Z.state.errorOp=Z.error.op,Z.error=void 0,await s.exec({op:"seq",steps:Q.catch},Z)}},{docs:"Try/Catch",timeoutMs:0,cost:0.1}),H9=A("Error",q.object({args:q.array(q.any).optional}),void 0,async(Q,Z)=>{let Y=Q.args?.[0]??"Error";Z.error=new o(String(Y),"Error")},{docs:"Trigger error flow",cost:0.1}),z9=A("varSet",q.object({key:q.string,value:q.any}),void 0,async({key:Q,value:Z},Y)=>{if(Y.consts.has(Q))throw Error(`Cannot reassign const variable '${Q}'`);Y.state[Q]=U(Z,Y)},{docs:"Set Variable",cost:0.1}),G9=A("constSet",q.object({key:q.string,value:q.any}),void 0,async({key:Q,value:Z},Y)=>{if(Y.consts.has(Q))throw Error(`Cannot reassign const variable '${Q}'`);if(Q in Y.state)throw Error(`Cannot redeclare variable '${Q}' as const`);Y.state[Q]=U(Z,Y),Y.consts.add(Q)},{docs:"Set Const Variable (immutable)",cost:0.1}),_9=A("varGet",q.object({key:q.string}),q.any,async({key:Q},Z)=>{return U(Q,Z)},{docs:"Get Variable",cost:0.1}),q9=A("varsImport",q.object({keys:q.union([q.array(q.string),q.record(q.string)])}),void 0,async({keys:Q},Z)=>{if(Array.isArray(Q))for(let Y of Q)Z.state[Y]=U({$kind:"arg",path:Y},Z);else for(let[Y,J]of Object.entries(Q))Z.state[Y]=U({$kind:"arg",path:J},Z)},{docs:"Import variables from args into the current scope, with optional renaming.",cost:0.2}),F9=A("varsLet",q.record(q.any),void 0,async(Q,Z)=>{for(let Y of Object.keys(Q)){if(Y==="op"||Y==="result")continue;Z.state[Y]=U(Q[Y],Z)}},{docs:"Initialize a set of variables in the current scope from the step object properties.",cost:0.1}),R9=A("varsExport",q.object({keys:q.union([q.array(q.string),q.record(q.string)])}),q.record(q.any),async({keys:Q},Z)=>{let Y={};if(Array.isArray(Q))for(let J of Q)Y[J]=U(J,Z);else for(let[J,X]of Object.entries(Q))Y[J]=U(X,Z);return Y},{docs:"Export variables from the current scope, with optional renaming.",cost:0.2}),$9=A("scope",q.object({steps:q.array(q.any)}),void 0,async({steps:Q},Z)=>{let Y=$0(Z);if(await s.exec({op:"seq",steps:Q},Y),Y.output!==void 0)Z.output=Y.output},{docs:"Create new scope",timeoutMs:0,cost:0.1}),O9=A("map",q.object({items:q.array(q.any),as:q.string,steps:q.array(q.any)}),q.array(q.any),async({items:Q,as:Z,steps:Y},J)=>{let X=[],K=U(Q,J);if(!Array.isArray(K))throw Error("map: items is not an array");for(let W of K){if(J.signal?.aborted)throw Error("Execution aborted");let H=$0(J);H.state[Z]=W,await s.exec({op:"seq",steps:Y},H),X.push(H.state.result??null)}return X},{docs:"Map Array",timeoutMs:0,cost:1}),U9=A("filter",q.object({items:q.array(q.any),as:q.string,condition:q.any}),q.array(q.any),async({items:Q,as:Z,condition:Y},J)=>{let X=[],K=U(Q,J);if(!Array.isArray(K))throw Error("filter: items is not an array");for(let W of K){if(J.signal?.aborted)throw Error("Execution aborted");let H=$0(J);if(H.state[Z]=W,x(Y,H))X.push(W)}return X},{docs:"Filter Array",timeoutMs:0,cost:1}),M9=A("reduce",q.object({items:q.array(q.any),as:q.string,accumulator:q.string,initial:q.any,steps:q.array(q.any)}),q.any,async({items:Q,as:Z,accumulator:Y,initial:J,steps:X},K)=>{let W=U(Q,K),H=U(J,K);if(!Array.isArray(W))throw Error("reduce: items is not an array");let G=H;for(let _ of W){if(K.signal?.aborted)throw Error("Execution aborted");let F=$0(K);F.state[Z]=_,F.state[Y]=G,await s.exec({op:"seq",steps:X},F),G=F.state.result??G}return G},{docs:"Reduce Array",timeoutMs:0,cost:1}),I9=A("find",q.object({items:q.array(q.any),as:q.string,condition:q.any}),q.any,async({items:Q,as:Z,condition:Y},J)=>{let X=U(Q,J);if(!Array.isArray(X))throw Error("find: items is not an array");for(let K of X){if(J.signal?.aborted)throw Error("Execution aborted");let W=$0(J);if(W.state[Z]=K,x(Y,W))return K}return null},{docs:"Find in Array",timeoutMs:0,cost:1}),B9=A("push",q.object({list:q.array(q.any),item:q.any}),q.array(q.any),async({list:Q,item:Z},Y)=>{let J=U(Q,Y),X=U(Z,Y);if(Array.isArray(J))J.push(X);return J},{docs:"Push to Array",cost:1}),j9=A("len",q.object({list:q.any}),q.number,async({list:Q},Z)=>{let Y=U(Q,Z);return Array.isArray(Y)||typeof Y==="string"?Y.length:0},{docs:"Length",cost:1}),N9=A("split",q.object({str:q.string,sep:q.string}),q.array(q.string),async({str:Q,sep:Z},Y)=>U(Q,Y).split(U(Z,Y)),{docs:"Split String",cost:1}),L9=A("join",q.object({list:q.array(q.string),sep:q.string}),q.string,async({list:Q,sep:Z},Y)=>U(Q,Y).join(U(Z,Y)),{docs:"Join String",cost:1}),A9=A("template",q.object({tmpl:q.string,vars:q.record(q.any)}),q.string,async({tmpl:Q,vars:Z},Y)=>{return U(Q,Y).replace(/\{\{(\w+)\}\}/g,(X,K)=>String(U(Z[K],Y)??""))},{docs:"String Template",cost:1}),w9=A("regexMatch",q.object({pattern:q.string,value:q.any}),q.boolean,async({pattern:Q,value:Z},Y)=>{if(e8(Q))throw Error(`Suspicious regex pattern rejected (potential ReDoS): ${Q}`);let J=U(Z,Y);return new RegExp(Q).test(J)},{docs:"Returns true if the value matches the regex pattern.",cost:2}),D9=A("pick",q.object({obj:q.record(q.any),keys:q.array(q.string)}),q.record(q.any),async({obj:Q,keys:Z},Y)=>{let J=U(Q,Y),X=U(Z,Y),K={};if(J&&Array.isArray(X))X.forEach((W)=>K[W]=J[W]);return K},{docs:"Pick Keys",cost:1}),V9=A("omit",q.object({obj:q.record(q.any),keys:q.array(q.string)}),q.record(q.any),async({obj:Q,keys:Z},Y)=>{let J=U(Q,Y),X=new Set(U(Z,Y)),K={};if(J)Object.keys(J).forEach((W)=>{if(!X.has(W))K[W]=J[W]});return K},{docs:"Omit Keys",cost:1}),P9=A("merge",q.object({a:q.record(q.any),b:q.record(q.any)}),q.record(q.any),async({a:Q,b:Z},Y)=>({...U(Q,Y),...U(Z,Y)}),{docs:"Merge Objects",cost:1}),C9=A("keys",q.object({obj:q.record(q.any)}),q.array(q.string),async({obj:Q},Z)=>Object.keys(U(Q,Z)??{}),{docs:"Object Keys",cost:1}),T1=10,S1="X-Agent-Depth";function b9(Q,Z){try{let J=new URL(Q).hostname.toLowerCase();for(let X of Z){let K=X.toLowerCase();if(K.startsWith("*.")){let W=K.slice(1);if(J.endsWith(W)||J===K.slice(2))return!0}else if(J===K)return!0}return!1}catch{return!1}}var T9=A("httpFetch",q.object({url:q.string,method:q.string.optional,headers:q.record(q.string).optional,body:q.any.optional,responseType:q.string.optional}),q.any,async(Q,Z)=>{let Y=U(Q.url,Z),J=U(Q.method,Z),X=U(Q.headers,Z)||{},K=U(Q.body,Z),W=U(Q.responseType,Z),H=Z.context?.requestDepth??0;if(H>=T1)throw Error(`Agent request depth exceeded (max ${T1}). This prevents recursive agent loops.`);if(Z.capabilities.fetch)return Z.capabilities.fetch(Y,{method:J,headers:{...X,[S1]:String(H+1)},body:K,signal:Z.signal,responseType:W});let G=Z.context?.allowedFetchDomains;if(G){if(!b9(Y,G))throw Error(`Fetch blocked: domain not in allowlist. Allowed: ${G.join(", ")}`)}else{if(t8(Y))throw Error("Blocked URL: private/internal addresses not allowed in default fetch");try{let F=new URL(Y).hostname.toLowerCase();if(F!=="localhost"&&F!=="127.0.0.1"&&F!=="[::1]")throw Error("Fetch blocked: no allowedFetchDomains configured. Set ctx.context.allowedFetchDomains or provide a custom fetch capability.")}catch(_){if(_.message.includes("allowedFetchDomains"))throw _;throw Error(`Invalid URL: ${Y}`)}}if(typeof globalThis.fetch==="function"){let _=await globalThis.fetch(Y,{method:J,headers:{...X,[S1]:String(H+1)},body:K?JSON.stringify(K):void 0,signal:Z.signal});if(W==="dataUrl"){let O=await _.arrayBuffer(),R=new Uint8Array(O),$="";for(let B=0;B<R.length;B++)$+=String.fromCharCode(R[B]);let M=btoa($);return`data:${_.headers.get("content-type")||"application/octet-stream"};base64,${M}`}let F=_.headers.get("content-type");if(W==="json"||F&&F.includes("application/json"))return _.json();return _.text()}throw Error("Capability 'fetch' missing and no global fetch available")},{docs:"HTTP Fetch",timeoutMs:30000,cost:5}),S9=A("storeGet",q.object({key:q.string}),q.any,async({key:Q},Z)=>{let Y=U(Q,Z);return Z.capabilities.store?.get(Y)},{docs:"Store Get",cost:5}),E9=A("storeSet",q.object({key:q.string,value:q.any}),void 0,async({key:Q,value:Z},Y)=>{let J=U(Q,Y),X=U(Z,Y);return Y.capabilities.store?.set(J,X)},{docs:"Store Set",cost:5}),k9=A("storeQuery",q.object({query:q.any}),q.array(q.any),async({query:Q},Z)=>Z.capabilities.store?.query?.(U(Q,Z))??[],{docs:"Store Query",cost:5}),v9=A("storeVectorSearch",q.object({collection:q.string.optional,vector:q.array(q.number),k:q.number.optional}),q.array(q.any),async({collection:Q,vector:Z,k:Y},J)=>J.capabilities.store?.vectorSearch?.(U(Q,J),U(Z,J),U(Y,J))??[],{docs:"Vector Search",cost:(Q,Z)=>5+(U(Q.k,Z)??5)}),y9=A("llmPredict",q.object({prompt:q.string,options:q.any.optional}),q.string,async({prompt:Q,options:Z},Y)=>{if(!Y.capabilities.llm?.predict)throw Error("Capability 'llm.predict' missing");return Y.capabilities.llm.predict(U(Q,Y),U(Z,Y))},{docs:"LLM Predict",timeoutMs:120000,cost:100}),g9=A("agentRun",q.object({agentId:q.any,input:q.any}),q.any,async({agentId:Q,input:Z},Y)=>{let J=U(Q,Y),X=U(Z,Y),K=X;if(X&&typeof X==="object"&&!Array.isArray(X)){K={};for(let H in X)K[H]=U(X[H],Y)}if(W1(J)){let H=K1(J),G={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},_=Y.resolver("seq");if(!_)throw Error("seq atom not found");if(await _.exec(H,G),G.error)throw Error(G.error.message||"Sub-agent failed");return G.output}if(J&&typeof J==="object"&&"op"in J){let H={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},G=Y.resolver("seq");if(!G)throw Error("seq atom not found");if(await G.exec(J,H),H.error)throw Error(H.error.message||"Sub-agent failed");return H.output}if(!Y.capabilities.agent?.run)throw Error("Capability 'agent.run' missing");let W=await Y.capabilities.agent.run(J,K);if(W&&typeof W==="object"&&"fuelUsed"in W&&typeof W.fuelUsed==="number"){if(W.error)throw Error(W.error.message||"Sub-agent failed");return W.result}return W},{docs:"Run Sub-Agent (accepts procedure token, AST, or agent ID)",cost:1}),f9=A("transpileCode",q.object({code:q.string}),q.any,async({code:Q},Z)=>{if(!Z.capabilities.code?.transpile)throw Error("Capability 'code.transpile' missing. Enable code transpilation by providing the code capability.");let Y=U(Q,Z);try{return Z.capabilities.code.transpile(Y)}catch(J){throw Error(`Code transpilation failed: ${J.message}`)}},{docs:"Transpile AsyncJS code to AST",cost:1}),E1=10,h9=A("runCode",q.object({code:q.string,args:q.record(q.any).optional}),q.any,async({code:Q,args:Z},Y)=>{let J=Y.runCodeDepth??0;if(J>=E1)throw Error(`runCode recursion limit exceeded (max ${E1}). This prevents infinite loops from dynamically generated code calling runCode.`);if(!Y.capabilities.code?.transpile)throw Error("Capability 'code.transpile' missing. Enable dynamic code execution by providing the code capability.");let X=U(Q,Y),K=Z?U(Z,Y):{},W;try{W=Y.capabilities.code.transpile(X)}catch(G){throw Error(`Code transpilation failed: ${G.message}`)}if(W.op!=="seq")throw Error("Transpiled code must be a seq node");let H=$0(Y);if(H.args=K,H.output=void 0,H.runCodeDepth=J+1,await s.exec(W,H),H.error){Y.error=H.error;return}return H.output},{docs:"Run dynamically generated AsyncJS code",cost:1}),m9=A("jsonParse",q.object({str:q.string}),q.any,async({str:Q},Z)=>JSON.parse(U(Q,Z)),{docs:"Parse JSON",cost:1}),x9=A("jsonStringify",q.object({value:q.any}),q.string,async({value:Q},Z)=>JSON.stringify(U(Q,Z)),{docs:"Stringify JSON",cost:1}),u9=A("xmlParse",q.object({str:q.string}),q.any,async({str:Q},Z)=>{if(!Z.capabilities.xml?.parse)throw Error("Capability 'xml.parse' missing");return Z.capabilities.xml.parse(U(Q,Z))},{docs:"Parse XML",cost:1}),d9=A("memoize",q.object({key:q.string.optional,steps:q.array(q.any)}),q.any,async({key:Q,steps:Z},Y)=>{if(!Y.memo)Y.memo=new Map;let J=U(Q,Y)??await H1.exec({value:Z,algorithm:"SHA-256"},Y);if(Y.memo.has(J))return Y.memo.get(J);let X=$0(Y);await s.exec({op:"seq",steps:Z},X);let K=X.output??X.state.result;return Y.memo.set(J,K),K},{docs:"Memoize steps result in memory",cost:1}),l9=A("cache",q.object({key:q.string.optional,steps:q.array(q.any),ttlMs:q.number.optional}),q.any,async({key:Q,steps:Z,ttlMs:Y},J)=>{if(!J.capabilities.store)throw Error("Capability 'store' missing for caching");let K=`cache:${U(Q,J)??await H1.exec({value:Z,algorithm:"SHA-256"},J)}`,W=await J.capabilities.store.get(K);if(W)if(typeof W==="object"&&W._exp){if(Date.now()<W._exp)return W.val}else return W;let H=$0(J);await s.exec({op:"seq",steps:Z},H);let G=H.output??H.state.result,_=Date.now()+(Y??86400000);if((J.fuel.current-=5)<=0)throw Error("Out of Fuel");return await J.capabilities.store.set(K,{val:G,_exp:_}),G},{docs:"Cache steps result in store with TTL",cost:5}),p9=A("random",q.object({min:q.number.optional,max:q.number.optional,format:q.string.optional,length:q.number.optional}),q.any,async({min:Q,max:Z,format:Y,length:J},X)=>{let K=U(Y,X)??"float",W=U(J,X)??10,H=U(Q,X)??0,G=U(Z,X)??1;if(K==="base36"){let $="";if(typeof crypto<"u"&&crypto.getRandomValues){let M=new Uint8Array(W);crypto.getRandomValues(M);for(let L=0;L<W;L++)$+="0123456789abcdefghijklmnopqrstuvwxyz"[M[L]%36]}else for(let M=0;M<W;M++)$+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(Math.floor(Math.random()*36));return $}let _;if(typeof crypto<"u"&&crypto.getRandomValues){let R=new Uint32Array(1);crypto.getRandomValues(R),_=R[0]/4294967296}else _=Math.random();let F=G-H,O=_*F+H;if(K==="integer")return Math.floor(O);return O},{docs:"Generate Random",cost:1}),i9=A("uuid",void 0,q.string,async()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();if(typeof crypto<"u"&&crypto.getRandomValues){let Q=new Uint8Array(16);crypto.getRandomValues(Q),Q[6]=Q[6]&15|64,Q[8]=Q[8]&63|128;let Z=Array.from(Q,(Y)=>Y.toString(16).padStart(2,"0")).join("");return`${Z.slice(0,8)}-${Z.slice(8,12)}-${Z.slice(12,16)}-${Z.slice(16,20)}-${Z.slice(20)}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(Q)=>{let Z=Math.random()*16|0;return(Q==="x"?Z:Z&3|8).toString(16)})},{docs:"Generate UUID",cost:1}),H1=A("hash",q.object({value:q.any,algorithm:q.string.optional}),q.string,async({value:Q,algorithm:Z},Y)=>{let J=typeof Q==="string"?Q:JSON.stringify(U(Q,Y)),X=U(Z,Y)||"SHA-256";if(typeof crypto<"u"&&crypto.subtle){let H=new TextEncoder().encode(J),G=await crypto.subtle.digest(X,H);return Array.from(new Uint8Array(G)).map((F)=>F.toString(16).padStart(2,"0")).join("")}let K=0;for(let W=0;W<J.length;W++){let H=J.charCodeAt(W);K=(K<<5)-K+H,K|=0}return String(K)},{docs:"Hash a value",cost:1}),c9=A("consoleLog",q.object({message:q.any}),void 0,async({message:Q},Z)=>{let Y=U(Q,Z);if(Z.trace)Z.trace.push({op:"console.log",input:{message:Y},stateDiff:{},result:Y,fuelBefore:Z.fuel.current,fuelAfter:Z.fuel.current,timestamp:new Date().toISOString()})},{docs:"Log to trace",cost:0.1}),n9=A("consoleWarn",q.object({message:q.any}),void 0,async({message:Q},Z)=>{let Y=U(Q,Z),J=typeof Y==="string"?Y:JSON.stringify(Y);if(!Z.warnings)Z.warnings=[];if(Z.warnings.push(J),Z.trace)Z.trace.push({op:"console.warn",input:{message:Y},stateDiff:{},result:Y,fuelBefore:Z.fuel.current,fuelAfter:Z.fuel.current,timestamp:new Date().toISOString()})},{docs:"Add warning",cost:0.1}),a9=A("consoleError",q.object({message:q.any}),void 0,async({message:Q},Z)=>{let Y=U(Q,Z),J=typeof Y==="string"?Y:JSON.stringify(Y);Z.error=new o(J,"console.error")},{docs:"Emit error and stop",cost:0.1}),o9=A("storeProcedure",q.object({ast:q.any,ttl:q.number.optional,maxSize:q.number.optional}),q.string,async({ast:Q,ttl:Z,maxSize:Y},J)=>{let X=U(Q,J),K=Z?U(Z,J):a8,W=Y?U(Y,J):o8;if(!X||typeof X!=="object"||!X.op)throw Error('Invalid AST: must be an object with an "op" property');let H=JSON.stringify(X);if(H.length>W)throw Error(`AST too large: ${H.length} bytes exceeds limit of ${W} bytes. Consider reducing AST size or using a shorter TTL.`);let G=s8(),_=Date.now();return w0.set(G,{ast:X,createdAt:_,expiresAt:_+K}),G},{docs:"Store an AST and return a token for later execution",cost:1}),s9=A("releaseProcedure",q.object({token:q.string}),q.boolean,async({token:Q},Z)=>{let Y=U(Q,Z);return w0.delete(Y)},{docs:"Release a stored procedure by token",cost:0.1}),r9=A("clearExpiredProcedures",void 0,q.number,async()=>{let Q=Date.now(),Z=0;for(let[Y,J]of w0)if(Q>J.expiresAt)w0.delete(Y),Z++;return Z},{docs:"Clear all expired procedures and return count",cost:0.5}),y1={seq:s,if:J9,while:X9,return:W9,try:K9,Error:H9,varSet:z9,constSet:G9,varGet:_9,varsImport:q9,varsLet:F9,varsExport:R9,scope:$9,map:O9,filter:U9,reduce:M9,find:I9,push:B9,len:j9,split:N9,join:L9,template:A9,regexMatch:w9,pick:D9,omit:V9,merge:P9,keys:C9,httpFetch:T9,storeGet:S9,storeSet:E9,storeQuery:k9,storeVectorSearch:v9,llmPredict:y9,agentRun:g9,transpileCode:f9,runCode:h9,jsonParse:m9,jsonStringify:x9,xmlParse:u9,memoize:d9,cache:l9,random:p9,uuid:i9,hash:H1,consoleLog:c9,consoleWarn:n9,consoleError:a9,storeProcedure:o9,releaseProcedure:s9,clearExpiredProcedures:r9};var t9=new Set(["true","false","null","undefined","and","or","not"]);function e9(Q,Z){let Y=Q.replace(/"[^"]*"/g,'""').replace(/'[^']*'/g,"''"),J=[],X=/(?<![.])\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g,K;while((K=X.exec(Y))!==null)J.push(K[1]);let H=[...new Set(J)].filter((G)=>!t9.has(G)&&!(G in Z)&&!new RegExp(`\\b${G}\\s*\\(`).test(Y));if(H.length>0)console.warn(`[Agent99 Builder] Condition "${Q}" references variables not in vars mapping: ${H.join(", ")}. Add them to vars or use AsyncJS syntax (ajs\`...\`) which handles this automatically.`)}function m0(Q,Z){e9(Q,Z);let Y=QQ(Q),J=x1(Y,0,Z);if(J.pos<Y.length){let X=Y.slice(J.pos).join(" ");throw Error(`Unsupported condition syntax near '${X}' in: ${Q}
2
+ Supported: comparisons, &&, ||, !, arithmetic, member access (a.b), literals`)}return J.node}function QQ(Q){let Z=[],Y=0;while(Y<Q.length){while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y>=Q.length)break;if(Q[Y]==='"'||Q[Y]==="'"){let J=Q[Y++],X="";while(Y<Q.length&&Q[Y]!==J)if(Q[Y]==="\\"&&Y+1<Q.length)Y++,X+=Q[Y++];else X+=Q[Y++];Y++,Z.push(JSON.stringify(X));continue}if(Q.slice(Y,Y+2).match(/^(&&|\|\||==|!=|>=|<=)$/)){Z.push(Q.slice(Y,Y+2)),Y+=2;continue}if("+-*/%><!().?:[]".includes(Q[Y])){Z.push(Q[Y]),Y++;continue}if(/\d/.test(Q[Y])){let J="";while(Y<Q.length&&/[\d.]/.test(Q[Y]))J+=Q[Y++];Z.push(J);continue}if(/[a-zA-Z_]/.test(Q[Y])){let J="";while(Y<Q.length&&/[a-zA-Z0-9_]/.test(Q[Y]))J+=Q[Y++];Z.push(J);continue}Y++}return Z}function x1(Q,Z,Y){return ZQ(Q,Z,Y)}function ZQ(Q,Z,Y){let{node:J,pos:X}=g1(Q,Z,Y);while(Q[X]==="||"){X++;let{node:K,pos:W}=g1(Q,X,Y);J={$expr:"logical",op:"||",left:J,right:K},X=W}return{node:J,pos:X}}function g1(Q,Z,Y){let{node:J,pos:X}=f1(Q,Z,Y);while(Q[X]==="&&"){X++;let{node:K,pos:W}=f1(Q,X,Y);J={$expr:"logical",op:"&&",left:J,right:K},X=W}return{node:J,pos:X}}function f1(Q,Z,Y){let{node:J,pos:X}=h1(Q,Z,Y),K=["==","!=",">","<",">=","<="];while(K.includes(Q[X])){let W=Q[X++],{node:H,pos:G}=h1(Q,X,Y);J={$expr:"binary",op:W,left:J,right:H},X=G}return{node:J,pos:X}}function h1(Q,Z,Y){let{node:J,pos:X}=m1(Q,Z,Y);while(Q[X]==="+"||Q[X]==="-"){let K=Q[X++],{node:W,pos:H}=m1(Q,X,Y);J={$expr:"binary",op:K,left:J,right:W},X=H}return{node:J,pos:X}}function m1(Q,Z,Y){let{node:J,pos:X}=z1(Q,Z,Y);while(Q[X]==="*"||Q[X]==="/"||Q[X]==="%"){let K=Q[X++],{node:W,pos:H}=z1(Q,X,Y);J={$expr:"binary",op:K,left:J,right:W},X=H}return{node:J,pos:X}}function z1(Q,Z,Y){if(Q[Z]==="!"||Q[Z]==="-"){let J=Q[Z++],{node:X,pos:K}=z1(Q,Z,Y);return{node:{$expr:"unary",op:J,argument:X},pos:K}}return YQ(Q,Z,Y)}function YQ(Q,Z,Y){let J=Q[Z];if(J==="("){let{node:X,pos:K}=x1(Q,Z+1,Y);return{node:X,pos:K+1}}if(J&&J.startsWith('"'))return{node:{$expr:"literal",value:JSON.parse(J)},pos:Z+1};if(J&&/^\d/.test(J))return{node:{$expr:"literal",value:parseFloat(J)},pos:Z+1};if(J==="true")return{node:{$expr:"literal",value:!0},pos:Z+1};if(J==="false")return{node:{$expr:"literal",value:!1},pos:Z+1};if(J==="null")return{node:{$expr:"literal",value:null},pos:Z+1};if(J&&/^[a-zA-Z_]/.test(J)){let X={$expr:"ident",name:J},K=Z+1;while(Q[K]==="."){K++;let W=Q[K++];X={$expr:"member",object:X,property:W}}return{node:X,pos:K}}return{node:{$expr:"literal",value:null},pos:Z+1}}class c{steps=[];atoms;proxy;constructor(Q){return this.atoms=Q,this.proxy=new Proxy(this,{get:(Z,Y,J)=>{if(Y in Z)return Z[Y];if(typeof Y==="string"&&Y in Z.atoms)return(X)=>{let K=Z.atoms[Y];return Z.add(K.create(X)),J};return}}),this.proxy}add(Q){return this.steps.push(Q),this.proxy}as(Q){if(this.steps.length===0)throw Error("No step to capture");let Z=this.steps[this.steps.length-1];return Z.result=Q,this.proxy}step(Q){return this.add(Q)}return(Q){let Z=this.atoms.return;if(!Z)throw Error("Atom 'return' not found");let Y=Q.schema??Q;return this.add(Z.create({schema:Y}))}toJSON(){return{op:"seq",steps:[...this.steps]}}varsImport(Q){return this.add(this.atoms.varsImport.create({keys:Q}))}varsExport(Q){return this.add(this.atoms.varsExport.create({keys:Q}))}if(Q,Z,Y,J){let X=new c(this.atoms);Y(X);let K;if(J){let G=new c(this.atoms);J(G),K=G.steps}let W=m0(Q,Z),H=this.atoms.if;return this.add(H.create({condition:W,then:X.steps,else:K}))}while(Q,Z,Y){let J=new c(this.atoms);Y(J);let X=m0(Q,Z),K=this.atoms.while;return this.add(K.create({condition:X,body:J.steps}))}scope(Q){let Z=new c(this.atoms);Q(Z);let Y=this.atoms.scope;return this.add(Y.create({steps:Z.steps}))}map(Q,Z,Y){let J=new c(this.atoms);Y(J);let X=this.atoms.map;return this.add(X.create({items:Q,as:Z,steps:J.steps}))}filter(Q,Z,Y,J={}){let X=m0(Y,J),K=this.atoms.filter;return this.add(K.create({items:Q,as:Z,condition:X}))}find(Q,Z,Y,J={}){let X=m0(Y,J),K=this.atoms.find;return this.add(K.create({items:Q,as:Z,condition:X}))}reduce(Q,Z,Y,J,X){let K=new c(this.atoms);X(K);let W=this.atoms.reduce;return this.add(W.create({items:Q,as:Z,accumulator:Y,initial:J,steps:K.steps}))}memoize(Q,Z){let Y=new c(this.atoms);Q(Y);let J=this.atoms.memoize;return this.add(J.create({key:Z,steps:Y.steps}))}cache(Q,Z,Y){let J=new c(this.atoms);Q(J);let X=this.atoms.cache;return this.add(X.create({key:Z,steps:J.steps,ttlMs:Y}))}try(Q){let Z=new c(this.atoms);Q.try(Z);let Y;if(Q.catch){let X=new c(this.atoms);Q.catch(X),Y=X.steps}let J=this.atoms.try;return this.add(J.create({try:Z.steps,catch:Y}))}}import{validate as bZ}from"tosijs-schema";var JQ=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],i1=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],XQ="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",c1="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",G1={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},_1="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",WQ={5:_1,"5module":_1+" export import",6:_1+" const class extends export import super"},KQ=/^in(stanceof)?$/,HQ=new RegExp("["+c1+"]"),zQ=new RegExp("["+c1+XQ+"]");function q1(Q,Z){var Y=65536;for(var J=0;J<Z.length;J+=2){if(Y+=Z[J],Y>Q)return!1;if(Y+=Z[J+1],Y>=Q)return!0}return!1}function X0(Q,Z){if(Q<65)return Q===36;if(Q<91)return!0;if(Q<97)return Q===95;if(Q<123)return!0;if(Q<=65535)return Q>=170&&HQ.test(String.fromCharCode(Q));if(Z===!1)return!1;return q1(Q,i1)}function U0(Q,Z){if(Q<48)return Q===36;if(Q<58)return!0;if(Q<65)return!1;if(Q<91)return!0;if(Q<97)return Q===95;if(Q<123)return!0;if(Q<=65535)return Q>=170&&zQ.test(String.fromCharCode(Q));if(Z===!1)return!1;return q1(Q,i1)||q1(Q,JQ)}var T=function(Z,Y){if(Y===void 0)Y={};this.label=Z,this.keyword=Y.keyword,this.beforeExpr=!!Y.beforeExpr,this.startsExpr=!!Y.startsExpr,this.isLoop=!!Y.isLoop,this.isAssign=!!Y.isAssign,this.prefix=!!Y.prefix,this.postfix=!!Y.postfix,this.binop=Y.binop||null,this.updateContext=null};function r(Q,Z){return new T(Q,{beforeExpr:!0,binop:Z})}var t={beforeExpr:!0},n={startsExpr:!0},U1={};function b(Q,Z){if(Z===void 0)Z={};return Z.keyword=Q,U1[Q]=new T(Q,Z)}var z={num:new T("num",n),regexp:new T("regexp",n),string:new T("string",n),name:new T("name",n),privateId:new T("privateId",n),eof:new T("eof"),bracketL:new T("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new T("]"),braceL:new T("{",{beforeExpr:!0,startsExpr:!0}),braceR:new T("}"),parenL:new T("(",{beforeExpr:!0,startsExpr:!0}),parenR:new T(")"),comma:new T(",",t),semi:new T(";",t),colon:new T(":",t),dot:new T("."),question:new T("?",t),questionDot:new T("?."),arrow:new T("=>",t),template:new T("template"),invalidTemplate:new T("invalidTemplate"),ellipsis:new T("...",t),backQuote:new T("`",n),dollarBraceL:new T("${",{beforeExpr:!0,startsExpr:!0}),eq:new T("=",{beforeExpr:!0,isAssign:!0}),assign:new T("_=",{beforeExpr:!0,isAssign:!0}),incDec:new T("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new T("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:r("||",1),logicalAND:r("&&",2),bitwiseOR:r("|",3),bitwiseXOR:r("^",4),bitwiseAND:r("&",5),equality:r("==/!=/===/!==",6),relational:r("</>/<=/>=",7),bitShift:r("<</>>/>>>",8),plusMin:new T("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:r("%",10),star:r("*",10),slash:r("/",10),starstar:new T("**",{beforeExpr:!0}),coalesce:r("??",1),_break:b("break"),_case:b("case",t),_catch:b("catch"),_continue:b("continue"),_debugger:b("debugger"),_default:b("default",t),_do:b("do",{isLoop:!0,beforeExpr:!0}),_else:b("else",t),_finally:b("finally"),_for:b("for",{isLoop:!0}),_function:b("function",n),_if:b("if"),_return:b("return",t),_switch:b("switch"),_throw:b("throw",t),_try:b("try"),_var:b("var"),_const:b("const"),_while:b("while",{isLoop:!0}),_with:b("with"),_new:b("new",{beforeExpr:!0,startsExpr:!0}),_this:b("this",n),_super:b("super",n),_class:b("class",n),_extends:b("extends",t),_export:b("export"),_import:b("import",n),_null:b("null",n),_true:b("true",n),_false:b("false",n),_in:b("in",{beforeExpr:!0,binop:7}),_instanceof:b("instanceof",{beforeExpr:!0,binop:7}),_typeof:b("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:b("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:b("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},a=/\r\n?|\n|\u2028|\u2029/,GQ=new RegExp(a.source,"g");function D0(Q){return Q===10||Q===13||Q===8232||Q===8233}function n1(Q,Z,Y){if(Y===void 0)Y=Q.length;for(var J=Z;J<Y;J++){var X=Q.charCodeAt(J);if(D0(X))return J<Y-1&&X===13&&Q.charCodeAt(J+1)===10?J+2:J+1}return-1}var a1=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,p=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,o1=Object.prototype,_Q=o1.hasOwnProperty,qQ=o1.toString,V0=Object.hasOwn||function(Q,Z){return _Q.call(Q,Z)},u1=Array.isArray||function(Q){return qQ.call(Q)==="[object Array]"},d1=Object.create(null);function O0(Q){return d1[Q]||(d1[Q]=new RegExp("^(?:"+Q.replace(/ /g,"|")+")$"))}function _0(Q){if(Q<=65535)return String.fromCharCode(Q);return Q-=65536,String.fromCharCode((Q>>10)+55296,(Q&1023)+56320)}var FQ=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,S0=function(Z,Y){this.line=Z,this.column=Y};S0.prototype.offset=function(Z){return new S0(this.line,this.column+Z)};var i0=function(Z,Y,J){if(this.start=Y,this.end=J,Z.sourceFile!==null)this.source=Z.sourceFile};function s1(Q,Z){for(var Y=1,J=0;;){var X=n1(Q,J,Z);if(X<0)return new S0(Y,Z-J);++Y,J=X}}var F1={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},l1=!1;function RQ(Q){var Z={};for(var Y in F1)Z[Y]=Q&&V0(Q,Y)?Q[Y]:F1[Y];if(Z.ecmaVersion==="latest")Z.ecmaVersion=1e8;else if(Z.ecmaVersion==null){if(!l1&&typeof console==="object"&&console.warn)l1=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
3
+ Defaulting to 2020, but this will stop working in the future.`);Z.ecmaVersion=11}else if(Z.ecmaVersion>=2015)Z.ecmaVersion-=2009;if(Z.allowReserved==null)Z.allowReserved=Z.ecmaVersion<5;if(!Q||Q.allowHashBang==null)Z.allowHashBang=Z.ecmaVersion>=14;if(u1(Z.onToken)){var J=Z.onToken;Z.onToken=function(X){return J.push(X)}}if(u1(Z.onComment))Z.onComment=$Q(Z,Z.onComment);return Z}function $Q(Q,Z){return function(Y,J,X,K,W,H){var G={type:Y?"Block":"Line",value:J,start:X,end:K};if(Q.locations)G.loc=new i0(this,W,H);if(Q.ranges)G.range=[X,K];Z.push(G)}}var E0=1,P0=2,M1=4,r1=8,I1=16,t1=32,c0=64,e1=128,j0=256,k0=512,n0=E0|P0|j0;function B1(Q,Z){return P0|(Q?M1:0)|(Z?r1:0)}var u0=0,j1=1,F0=2,Q8=3,Z8=4,Y8=5,u=function(Z,Y,J){this.options=Z=RQ(Z),this.sourceFile=Z.sourceFile,this.keywords=O0(WQ[Z.ecmaVersion>=6?6:Z.sourceType==="module"?"5module":5]);var X="";if(Z.allowReserved!==!0){if(X=G1[Z.ecmaVersion>=6?6:Z.ecmaVersion===5?5:3],Z.sourceType==="module")X+=" await"}this.reservedWords=O0(X);var K=(X?X+" ":"")+G1.strict;if(this.reservedWordsStrict=O0(K),this.reservedWordsStrictBind=O0(K+" "+G1.strictBind),this.input=String(Y),this.containsEsc=!1,J)this.pos=J,this.lineStart=this.input.lastIndexOf(`
4
+ `,J-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(a).length;else this.pos=this.lineStart=0,this.curLine=1;if(this.type=z.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=Z.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&Z.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(E0),this.regexpState=null,this.privateNameStack=[]},W0={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};u.prototype.parse=function(){var Z=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(Z)};W0.inFunction.get=function(){return(this.currentVarScope().flags&P0)>0};W0.inGenerator.get=function(){return(this.currentVarScope().flags&r1)>0};W0.inAsync.get=function(){return(this.currentVarScope().flags&M1)>0};W0.canAwait.get=function(){for(var Q=this.scopeStack.length-1;Q>=0;Q--){var Z=this.scopeStack[Q],Y=Z.flags;if(Y&(j0|k0))return!1;if(Y&P0)return(Y&M1)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};W0.allowSuper.get=function(){var Q=this.currentThisScope(),Z=Q.flags;return(Z&c0)>0||this.options.allowSuperOutsideMethod};W0.allowDirectSuper.get=function(){return(this.currentThisScope().flags&e1)>0};W0.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};W0.allowNewDotTarget.get=function(){for(var Q=this.scopeStack.length-1;Q>=0;Q--){var Z=this.scopeStack[Q],Y=Z.flags;if(Y&(j0|k0)||Y&P0&&!(Y&I1))return!0}return!1};W0.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&j0)>0};u.extend=function(){var Z=[],Y=arguments.length;while(Y--)Z[Y]=arguments[Y];var J=this;for(var X=0;X<Z.length;X++)J=Z[X](J);return J};u.parse=function(Z,Y){return new this(Y,Z).parse()};u.parseExpressionAt=function(Z,Y,J){var X=new this(J,Z,Y);return X.nextToken(),X.parseExpression()};u.tokenizer=function(Z,Y){return new this(Y,Z)};Object.defineProperties(u.prototype,W0);var i=u.prototype,OQ=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;i.strictDirective=function(Q){if(this.options.ecmaVersion<5)return!1;for(;;){p.lastIndex=Q,Q+=p.exec(this.input)[0].length;var Z=OQ.exec(this.input.slice(Q));if(!Z)return!1;if((Z[1]||Z[2])==="use strict"){p.lastIndex=Q+Z[0].length;var Y=p.exec(this.input),J=Y.index+Y[0].length,X=this.input.charAt(J);return X===";"||X==="}"||a.test(Y[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(X)||X==="!"&&this.input.charAt(J+1)==="=")}if(Q+=Z[0].length,p.lastIndex=Q,Q+=p.exec(this.input)[0].length,this.input[Q]===";")Q++}};i.eat=function(Q){if(this.type===Q)return this.next(),!0;else return!1};i.isContextual=function(Q){return this.type===z.name&&this.value===Q&&!this.containsEsc};i.eatContextual=function(Q){if(!this.isContextual(Q))return!1;return this.next(),!0};i.expectContextual=function(Q){if(!this.eatContextual(Q))this.unexpected()};i.canInsertSemicolon=function(){return this.type===z.eof||this.type===z.braceR||a.test(this.input.slice(this.lastTokEnd,this.start))};i.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};i.semicolon=function(){if(!this.eat(z.semi)&&!this.insertSemicolon())this.unexpected()};i.afterTrailingComma=function(Q,Z){if(this.type===Q){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!Z)this.next();return!0}};i.expect=function(Q){this.eat(Q)||this.unexpected()};i.unexpected=function(Q){this.raise(Q!=null?Q:this.start,"Unexpected token")};var a0=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};i.checkPatternErrors=function(Q,Z){if(!Q)return;if(Q.trailingComma>-1)this.raiseRecoverable(Q.trailingComma,"Comma is not permitted after the rest element");var Y=Z?Q.parenthesizedAssign:Q.parenthesizedBind;if(Y>-1)this.raiseRecoverable(Y,Z?"Assigning to rvalue":"Parenthesized pattern")};i.checkExpressionErrors=function(Q,Z){if(!Q)return!1;var{shorthandAssign:Y,doubleProto:J}=Q;if(!Z)return Y>=0||J>=0;if(Y>=0)this.raise(Y,"Shorthand property assignments are valid only in destructuring patterns");if(J>=0)this.raiseRecoverable(J,"Redefinition of __proto__ property")};i.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos))this.raise(this.yieldPos,"Yield expression cannot be a default value");if(this.awaitPos)this.raise(this.awaitPos,"Await expression cannot be a default value")};i.isSimpleAssignTarget=function(Q){if(Q.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(Q.expression);return Q.type==="Identifier"||Q.type==="MemberExpression"};var N=u.prototype;N.parseTopLevel=function(Q){var Z=Object.create(null);if(!Q.body)Q.body=[];while(this.type!==z.eof){var Y=this.parseStatement(null,!0,Z);Q.body.push(Y)}if(this.inModule)for(var J=0,X=Object.keys(this.undefinedExports);J<X.length;J+=1){var K=X[J];this.raiseRecoverable(this.undefinedExports[K].start,"Export '"+K+"' is not defined")}return this.adaptDirectivePrologue(Q.body),this.next(),Q.sourceType=this.options.sourceType,this.finishNode(Q,"Program")};var N1={kind:"loop"},UQ={kind:"switch"};N.isLet=function(Q){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;p.lastIndex=this.pos;var Z=p.exec(this.input),Y=this.pos+Z[0].length,J=this.input.charCodeAt(Y);if(J===91||J===92)return!0;if(Q)return!1;if(J===123||J>55295&&J<56320)return!0;if(X0(J,!0)){var X=Y+1;while(U0(J=this.input.charCodeAt(X),!0))++X;if(J===92||J>55295&&J<56320)return!0;var K=this.input.slice(Y,X);if(!KQ.test(K))return!0}return!1};N.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;p.lastIndex=this.pos;var Q=p.exec(this.input),Z=this.pos+Q[0].length,Y;return!a.test(this.input.slice(this.pos,Z))&&this.input.slice(Z,Z+8)==="function"&&(Z+8===this.input.length||!(U0(Y=this.input.charCodeAt(Z+8))||Y>55295&&Y<56320))};N.isUsingKeyword=function(Q,Z){if(this.options.ecmaVersion<17||!this.isContextual(Q?"await":"using"))return!1;p.lastIndex=this.pos;var Y=p.exec(this.input),J=this.pos+Y[0].length;if(a.test(this.input.slice(this.pos,J)))return!1;if(Q){var X=J+5,K;if(this.input.slice(J,X)!=="using"||X===this.input.length||U0(K=this.input.charCodeAt(X))||K>55295&&K<56320)return!1;p.lastIndex=X;var W=p.exec(this.input);if(W&&a.test(this.input.slice(X,X+W[0].length)))return!1}if(Z){var H=J+2,G;if(this.input.slice(J,H)==="of"){if(H===this.input.length||!U0(G=this.input.charCodeAt(H))&&!(G>55295&&G<56320))return!1}}var _=this.input.charCodeAt(J);return X0(_,!0)||_===92};N.isAwaitUsing=function(Q){return this.isUsingKeyword(!0,Q)};N.isUsing=function(Q){return this.isUsingKeyword(!1,Q)};N.parseStatement=function(Q,Z,Y){var J=this.type,X=this.startNode(),K;if(this.isLet(Q))J=z._var,K="let";switch(J){case z._break:case z._continue:return this.parseBreakContinueStatement(X,J.keyword);case z._debugger:return this.parseDebuggerStatement(X);case z._do:return this.parseDoStatement(X);case z._for:return this.parseForStatement(X);case z._function:if(Q&&(this.strict||Q!=="if"&&Q!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(X,!1,!Q);case z._class:if(Q)this.unexpected();return this.parseClass(X,!0);case z._if:return this.parseIfStatement(X);case z._return:return this.parseReturnStatement(X);case z._switch:return this.parseSwitchStatement(X);case z._throw:return this.parseThrowStatement(X);case z._try:return this.parseTryStatement(X);case z._const:case z._var:if(K=K||this.value,Q&&K!=="var")this.unexpected();return this.parseVarStatement(X,K);case z._while:return this.parseWhileStatement(X);case z._with:return this.parseWithStatement(X);case z.braceL:return this.parseBlock(!0,X);case z.semi:return this.parseEmptyStatement(X);case z._export:case z._import:if(this.options.ecmaVersion>10&&J===z._import){p.lastIndex=this.pos;var W=p.exec(this.input),H=this.pos+W[0].length,G=this.input.charCodeAt(H);if(G===40||G===46)return this.parseExpressionStatement(X,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!Z)this.raise(this.start,"'import' and 'export' may only appear at the top level");if(!this.inModule)this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}return J===z._import?this.parseImport(X):this.parseExport(X,Y);default:if(this.isAsyncFunction()){if(Q)this.unexpected();return this.next(),this.parseFunctionStatement(X,!0,!Q)}var _=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(_){if(Z&&this.options.sourceType==="script")this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`");if(_==="await using"){if(!this.canAwait)this.raise(this.start,"Await using cannot appear outside of async function");this.next()}return this.next(),this.parseVar(X,!1,_),this.semicolon(),this.finishNode(X,"VariableDeclaration")}var F=this.value,O=this.parseExpression();if(J===z.name&&O.type==="Identifier"&&this.eat(z.colon))return this.parseLabeledStatement(X,F,O,Q);else return this.parseExpressionStatement(X,O)}};N.parseBreakContinueStatement=function(Q,Z){var Y=Z==="break";if(this.next(),this.eat(z.semi)||this.insertSemicolon())Q.label=null;else if(this.type!==z.name)this.unexpected();else Q.label=this.parseIdent(),this.semicolon();var J=0;for(;J<this.labels.length;++J){var X=this.labels[J];if(Q.label==null||X.name===Q.label.name){if(X.kind!=null&&(Y||X.kind==="loop"))break;if(Q.label&&Y)break}}if(J===this.labels.length)this.raise(Q.start,"Unsyntactic "+Z);return this.finishNode(Q,Y?"BreakStatement":"ContinueStatement")};N.parseDebuggerStatement=function(Q){return this.next(),this.semicolon(),this.finishNode(Q,"DebuggerStatement")};N.parseDoStatement=function(Q){if(this.next(),this.labels.push(N1),Q.body=this.parseStatement("do"),this.labels.pop(),this.expect(z._while),Q.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(z.semi);else this.semicolon();return this.finishNode(Q,"DoWhileStatement")};N.parseForStatement=function(Q){this.next();var Z=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(N1),this.enterScope(0),this.expect(z.parenL),this.type===z.semi){if(Z>-1)this.unexpected(Z);return this.parseFor(Q,null)}var Y=this.isLet();if(this.type===z._var||this.type===z._const||Y){var J=this.startNode(),X=Y?"let":this.value;return this.next(),this.parseVar(J,!0,X),this.finishNode(J,"VariableDeclaration"),this.parseForAfterInit(Q,J,Z)}var K=this.isContextual("let"),W=!1,H=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(H){var G=this.startNode();if(this.next(),H==="await using")this.next();return this.parseVar(G,!0,H),this.finishNode(G,"VariableDeclaration"),this.parseForAfterInit(Q,G,Z)}var _=this.containsEsc,F=new a0,O=this.start,R=Z>-1?this.parseExprSubscripts(F,"await"):this.parseExpression(!0,F);if(this.type===z._in||(W=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(Z>-1){if(this.type===z._in)this.unexpected(Z);Q.await=!0}else if(W&&this.options.ecmaVersion>=8){if(R.start===O&&!_&&R.type==="Identifier"&&R.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)Q.await=!1}if(K&&W)this.raise(R.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(R,!1,F),this.checkLValPattern(R),this.parseForIn(Q,R)}else this.checkExpressionErrors(F,!0);if(Z>-1)this.unexpected(Z);return this.parseFor(Q,R)};N.parseForAfterInit=function(Q,Z,Y){if((this.type===z._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Z.declarations.length===1){if(this.options.ecmaVersion>=9)if(this.type===z._in){if(Y>-1)this.unexpected(Y)}else Q.await=Y>-1;return this.parseForIn(Q,Z)}if(Y>-1)this.unexpected(Y);return this.parseFor(Q,Z)};N.parseFunctionStatement=function(Q,Z,Y){return this.next(),this.parseFunction(Q,T0|(Y?0:R1),!1,Z)};N.parseIfStatement=function(Q){return this.next(),Q.test=this.parseParenExpression(),Q.consequent=this.parseStatement("if"),Q.alternate=this.eat(z._else)?this.parseStatement("if"):null,this.finishNode(Q,"IfStatement")};N.parseReturnStatement=function(Q){if(!this.inFunction&&!this.options.allowReturnOutsideFunction)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(z.semi)||this.insertSemicolon())Q.argument=null;else Q.argument=this.parseExpression(),this.semicolon();return this.finishNode(Q,"ReturnStatement")};N.parseSwitchStatement=function(Q){this.next(),Q.discriminant=this.parseParenExpression(),Q.cases=[],this.expect(z.braceL),this.labels.push(UQ),this.enterScope(0);var Z;for(var Y=!1;this.type!==z.braceR;)if(this.type===z._case||this.type===z._default){var J=this.type===z._case;if(Z)this.finishNode(Z,"SwitchCase");if(Q.cases.push(Z=this.startNode()),Z.consequent=[],this.next(),J)Z.test=this.parseExpression();else{if(Y)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Y=!0,Z.test=null}this.expect(z.colon)}else{if(!Z)this.unexpected();Z.consequent.push(this.parseStatement(null))}if(this.exitScope(),Z)this.finishNode(Z,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(Q,"SwitchStatement")};N.parseThrowStatement=function(Q){if(this.next(),a.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return Q.argument=this.parseExpression(),this.semicolon(),this.finishNode(Q,"ThrowStatement")};var MQ=[];N.parseCatchClauseParam=function(){var Q=this.parseBindingAtom(),Z=Q.type==="Identifier";return this.enterScope(Z?t1:0),this.checkLValPattern(Q,Z?Z8:F0),this.expect(z.parenR),Q};N.parseTryStatement=function(Q){if(this.next(),Q.block=this.parseBlock(),Q.handler=null,this.type===z._catch){var Z=this.startNode();if(this.next(),this.eat(z.parenL))Z.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();Z.param=null,this.enterScope(0)}Z.body=this.parseBlock(!1),this.exitScope(),Q.handler=this.finishNode(Z,"CatchClause")}if(Q.finalizer=this.eat(z._finally)?this.parseBlock():null,!Q.handler&&!Q.finalizer)this.raise(Q.start,"Missing catch or finally clause");return this.finishNode(Q,"TryStatement")};N.parseVarStatement=function(Q,Z,Y){return this.next(),this.parseVar(Q,!1,Z,Y),this.semicolon(),this.finishNode(Q,"VariableDeclaration")};N.parseWhileStatement=function(Q){return this.next(),Q.test=this.parseParenExpression(),this.labels.push(N1),Q.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(Q,"WhileStatement")};N.parseWithStatement=function(Q){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),Q.object=this.parseParenExpression(),Q.body=this.parseStatement("with"),this.finishNode(Q,"WithStatement")};N.parseEmptyStatement=function(Q){return this.next(),this.finishNode(Q,"EmptyStatement")};N.parseLabeledStatement=function(Q,Z,Y,J){for(var X=0,K=this.labels;X<K.length;X+=1){var W=K[X];if(W.name===Z)this.raise(Y.start,"Label '"+Z+"' is already declared")}var H=this.type.isLoop?"loop":this.type===z._switch?"switch":null;for(var G=this.labels.length-1;G>=0;G--){var _=this.labels[G];if(_.statementStart===Q.start)_.statementStart=this.start,_.kind=H;else break}return this.labels.push({name:Z,kind:H,statementStart:this.start}),Q.body=this.parseStatement(J?J.indexOf("label")===-1?J+"label":J:"label"),this.labels.pop(),Q.label=Y,this.finishNode(Q,"LabeledStatement")};N.parseExpressionStatement=function(Q,Z){return Q.expression=Z,this.semicolon(),this.finishNode(Q,"ExpressionStatement")};N.parseBlock=function(Q,Z,Y){if(Q===void 0)Q=!0;if(Z===void 0)Z=this.startNode();if(Z.body=[],this.expect(z.braceL),Q)this.enterScope(0);while(this.type!==z.braceR){var J=this.parseStatement(null);Z.body.push(J)}if(Y)this.strict=!1;if(this.next(),Q)this.exitScope();return this.finishNode(Z,"BlockStatement")};N.parseFor=function(Q,Z){return Q.init=Z,this.expect(z.semi),Q.test=this.type===z.semi?null:this.parseExpression(),this.expect(z.semi),Q.update=this.type===z.parenR?null:this.parseExpression(),this.expect(z.parenR),Q.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Q,"ForStatement")};N.parseForIn=function(Q,Z){var Y=this.type===z._in;if(this.next(),Z.type==="VariableDeclaration"&&Z.declarations[0].init!=null&&(!Y||this.options.ecmaVersion<8||this.strict||Z.kind!=="var"||Z.declarations[0].id.type!=="Identifier"))this.raise(Z.start,(Y?"for-in":"for-of")+" loop variable declaration may not have an initializer");return Q.left=Z,Q.right=Y?this.parseExpression():this.parseMaybeAssign(),this.expect(z.parenR),Q.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Q,Y?"ForInStatement":"ForOfStatement")};N.parseVar=function(Q,Z,Y,J){Q.declarations=[],Q.kind=Y;for(;;){var X=this.startNode();if(this.parseVarId(X,Y),this.eat(z.eq))X.init=this.parseMaybeAssign(Z);else if(!J&&Y==="const"&&!(this.type===z._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!J&&(Y==="using"||Y==="await using")&&this.options.ecmaVersion>=17&&this.type!==z._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Y+" declaration");else if(!J&&X.id.type!=="Identifier"&&!(Z&&(this.type===z._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else X.init=null;if(Q.declarations.push(this.finishNode(X,"VariableDeclarator")),!this.eat(z.comma))break}return Q};N.parseVarId=function(Q,Z){Q.id=Z==="using"||Z==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(Q.id,Z==="var"?j1:F0,!1)};var T0=1,R1=2,J8=4;N.parseFunction=function(Q,Z,Y,J,X){if(this.initFunction(Q),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!J){if(this.type===z.star&&Z&R1)this.unexpected();Q.generator=this.eat(z.star)}if(this.options.ecmaVersion>=8)Q.async=!!J;if(Z&T0){if(Q.id=Z&J8&&this.type!==z.name?null:this.parseIdent(),Q.id&&!(Z&R1))this.checkLValSimple(Q.id,this.strict||Q.generator||Q.async?this.treatFunctionsAsVar?j1:F0:Q8)}var K=this.yieldPos,W=this.awaitPos,H=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(B1(Q.async,Q.generator)),!(Z&T0))Q.id=this.type===z.name?this.parseIdent():null;return this.parseFunctionParams(Q),this.parseFunctionBody(Q,Y,!1,X),this.yieldPos=K,this.awaitPos=W,this.awaitIdentPos=H,this.finishNode(Q,Z&T0?"FunctionDeclaration":"FunctionExpression")};N.parseFunctionParams=function(Q){this.expect(z.parenL),Q.params=this.parseBindingList(z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};N.parseClass=function(Q,Z){this.next();var Y=this.strict;this.strict=!0,this.parseClassId(Q,Z),this.parseClassSuper(Q);var J=this.enterClassBody(),X=this.startNode(),K=!1;X.body=[],this.expect(z.braceL);while(this.type!==z.braceR){var W=this.parseClassElement(Q.superClass!==null);if(W){if(X.body.push(W),W.type==="MethodDefinition"&&W.kind==="constructor"){if(K)this.raiseRecoverable(W.start,"Duplicate constructor in the same class");K=!0}else if(W.key&&W.key.type==="PrivateIdentifier"&&IQ(J,W))this.raiseRecoverable(W.key.start,"Identifier '#"+W.key.name+"' has already been declared")}}return this.strict=Y,this.next(),Q.body=this.finishNode(X,"ClassBody"),this.exitClassBody(),this.finishNode(Q,Z?"ClassDeclaration":"ClassExpression")};N.parseClassElement=function(Q){if(this.eat(z.semi))return null;var Z=this.options.ecmaVersion,Y=this.startNode(),J="",X=!1,K=!1,W="method",H=!1;if(this.eatContextual("static")){if(Z>=13&&this.eat(z.braceL))return this.parseClassStaticBlock(Y),Y;if(this.isClassElementNameStart()||this.type===z.star)H=!0;else J="static"}if(Y.static=H,!J&&Z>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===z.star)&&!this.canInsertSemicolon())K=!0;else J="async";if(!J&&(Z>=9||!K)&&this.eat(z.star))X=!0;if(!J&&!K&&!X){var G=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())W=G;else J=G}if(J)Y.computed=!1,Y.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Y.key.name=J,this.finishNode(Y.key,"Identifier");else this.parseClassElementName(Y);if(Z<13||this.type===z.parenL||W!=="method"||X||K){var _=!Y.static&&d0(Y,"constructor"),F=_&&Q;if(_&&W!=="method")this.raise(Y.key.start,"Constructor can't have get/set modifier");Y.kind=_?"constructor":W,this.parseClassMethod(Y,X,K,F)}else this.parseClassField(Y);return Y};N.isClassElementNameStart=function(){return this.type===z.name||this.type===z.privateId||this.type===z.num||this.type===z.string||this.type===z.bracketL||this.type.keyword};N.parseClassElementName=function(Q){if(this.type===z.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");Q.computed=!1,Q.key=this.parsePrivateIdent()}else this.parsePropertyName(Q)};N.parseClassMethod=function(Q,Z,Y,J){var X=Q.key;if(Q.kind==="constructor"){if(Z)this.raise(X.start,"Constructor can't be a generator");if(Y)this.raise(X.start,"Constructor can't be an async method")}else if(Q.static&&d0(Q,"prototype"))this.raise(X.start,"Classes may not have a static property named prototype");var K=Q.value=this.parseMethod(Z,Y,J);if(Q.kind==="get"&&K.params.length!==0)this.raiseRecoverable(K.start,"getter should have no params");if(Q.kind==="set"&&K.params.length!==1)this.raiseRecoverable(K.start,"setter should have exactly one param");if(Q.kind==="set"&&K.params[0].type==="RestElement")this.raiseRecoverable(K.params[0].start,"Setter cannot use rest params");return this.finishNode(Q,"MethodDefinition")};N.parseClassField=function(Q){if(d0(Q,"constructor"))this.raise(Q.key.start,"Classes can't have a field named 'constructor'");else if(Q.static&&d0(Q,"prototype"))this.raise(Q.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(z.eq))this.enterScope(k0|c0),Q.value=this.parseMaybeAssign(),this.exitScope();else Q.value=null;return this.semicolon(),this.finishNode(Q,"PropertyDefinition")};N.parseClassStaticBlock=function(Q){Q.body=[];var Z=this.labels;this.labels=[],this.enterScope(j0|c0);while(this.type!==z.braceR){var Y=this.parseStatement(null);Q.body.push(Y)}return this.next(),this.exitScope(),this.labels=Z,this.finishNode(Q,"StaticBlock")};N.parseClassId=function(Q,Z){if(this.type===z.name){if(Q.id=this.parseIdent(),Z)this.checkLValSimple(Q.id,F0,!1)}else{if(Z===!0)this.unexpected();Q.id=null}};N.parseClassSuper=function(Q){Q.superClass=this.eat(z._extends)?this.parseExprSubscripts(null,!1):null};N.enterClassBody=function(){var Q={declared:Object.create(null),used:[]};return this.privateNameStack.push(Q),Q.declared};N.exitClassBody=function(){var Q=this.privateNameStack.pop(),Z=Q.declared,Y=Q.used;if(!this.options.checkPrivateFields)return;var J=this.privateNameStack.length,X=J===0?null:this.privateNameStack[J-1];for(var K=0;K<Y.length;++K){var W=Y[K];if(!V0(Z,W.name))if(X)X.used.push(W);else this.raiseRecoverable(W.start,"Private field '#"+W.name+"' must be declared in an enclosing class")}};function IQ(Q,Z){var Y=Z.key.name,J=Q[Y],X="true";if(Z.type==="MethodDefinition"&&(Z.kind==="get"||Z.kind==="set"))X=(Z.static?"s":"i")+Z.kind;if(J==="iget"&&X==="iset"||J==="iset"&&X==="iget"||J==="sget"&&X==="sset"||J==="sset"&&X==="sget")return Q[Y]="true",!1;else if(!J)return Q[Y]=X,!1;else return!0}function d0(Q,Z){var{computed:Y,key:J}=Q;return!Y&&(J.type==="Identifier"&&J.name===Z||J.type==="Literal"&&J.value===Z)}N.parseExportAllDeclaration=function(Q,Z){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))Q.exported=this.parseModuleExportName(),this.checkExport(Z,Q.exported,this.lastTokStart);else Q.exported=null;if(this.expectContextual("from"),this.type!==z.string)this.unexpected();if(Q.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Q.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Q,"ExportAllDeclaration")};N.parseExport=function(Q,Z){if(this.next(),this.eat(z.star))return this.parseExportAllDeclaration(Q,Z);if(this.eat(z._default))return this.checkExport(Z,"default",this.lastTokStart),Q.declaration=this.parseExportDefaultDeclaration(),this.finishNode(Q,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(Q.declaration=this.parseExportDeclaration(Q),Q.declaration.type==="VariableDeclaration")this.checkVariableExport(Z,Q.declaration.declarations);else this.checkExport(Z,Q.declaration.id,Q.declaration.id.start);if(Q.specifiers=[],Q.source=null,this.options.ecmaVersion>=16)Q.attributes=[]}else{if(Q.declaration=null,Q.specifiers=this.parseExportSpecifiers(Z),this.eatContextual("from")){if(this.type!==z.string)this.unexpected();if(Q.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Q.attributes=this.parseWithClause()}else{for(var Y=0,J=Q.specifiers;Y<J.length;Y+=1){var X=J[Y];if(this.checkUnreserved(X.local),this.checkLocalExport(X.local),X.local.type==="Literal")this.raise(X.local.start,"A string literal cannot be used as an exported binding without `from`.")}if(Q.source=null,this.options.ecmaVersion>=16)Q.attributes=[]}this.semicolon()}return this.finishNode(Q,"ExportNamedDeclaration")};N.parseExportDeclaration=function(Q){return this.parseStatement(null)};N.parseExportDefaultDeclaration=function(){var Q;if(this.type===z._function||(Q=this.isAsyncFunction())){var Z=this.startNode();if(this.next(),Q)this.next();return this.parseFunction(Z,T0|J8,!1,Q)}else if(this.type===z._class){var Y=this.startNode();return this.parseClass(Y,"nullableID")}else{var J=this.parseMaybeAssign();return this.semicolon(),J}};N.checkExport=function(Q,Z,Y){if(!Q)return;if(typeof Z!=="string")Z=Z.type==="Identifier"?Z.name:Z.value;if(V0(Q,Z))this.raiseRecoverable(Y,"Duplicate export '"+Z+"'");Q[Z]=!0};N.checkPatternExport=function(Q,Z){var Y=Z.type;if(Y==="Identifier")this.checkExport(Q,Z,Z.start);else if(Y==="ObjectPattern")for(var J=0,X=Z.properties;J<X.length;J+=1){var K=X[J];this.checkPatternExport(Q,K)}else if(Y==="ArrayPattern")for(var W=0,H=Z.elements;W<H.length;W+=1){var G=H[W];if(G)this.checkPatternExport(Q,G)}else if(Y==="Property")this.checkPatternExport(Q,Z.value);else if(Y==="AssignmentPattern")this.checkPatternExport(Q,Z.left);else if(Y==="RestElement")this.checkPatternExport(Q,Z.argument)};N.checkVariableExport=function(Q,Z){if(!Q)return;for(var Y=0,J=Z;Y<J.length;Y+=1){var X=J[Y];this.checkPatternExport(Q,X.id)}};N.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};N.parseExportSpecifier=function(Q){var Z=this.startNode();return Z.local=this.parseModuleExportName(),Z.exported=this.eatContextual("as")?this.parseModuleExportName():Z.local,this.checkExport(Q,Z.exported,Z.exported.start),this.finishNode(Z,"ExportSpecifier")};N.parseExportSpecifiers=function(Q){var Z=[],Y=!0;this.expect(z.braceL);while(!this.eat(z.braceR)){if(!Y){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Y=!1;Z.push(this.parseExportSpecifier(Q))}return Z};N.parseImport=function(Q){if(this.next(),this.type===z.string)Q.specifiers=MQ,Q.source=this.parseExprAtom();else Q.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Q.source=this.type===z.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)Q.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Q,"ImportDeclaration")};N.parseImportSpecifier=function(){var Q=this.startNode();if(Q.imported=this.parseModuleExportName(),this.eatContextual("as"))Q.local=this.parseIdent();else this.checkUnreserved(Q.imported),Q.local=Q.imported;return this.checkLValSimple(Q.local,F0),this.finishNode(Q,"ImportSpecifier")};N.parseImportDefaultSpecifier=function(){var Q=this.startNode();return Q.local=this.parseIdent(),this.checkLValSimple(Q.local,F0),this.finishNode(Q,"ImportDefaultSpecifier")};N.parseImportNamespaceSpecifier=function(){var Q=this.startNode();return this.next(),this.expectContextual("as"),Q.local=this.parseIdent(),this.checkLValSimple(Q.local,F0),this.finishNode(Q,"ImportNamespaceSpecifier")};N.parseImportSpecifiers=function(){var Q=[],Z=!0;if(this.type===z.name){if(Q.push(this.parseImportDefaultSpecifier()),!this.eat(z.comma))return Q}if(this.type===z.star)return Q.push(this.parseImportNamespaceSpecifier()),Q;this.expect(z.braceL);while(!this.eat(z.braceR)){if(!Z){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Z=!1;Q.push(this.parseImportSpecifier())}return Q};N.parseWithClause=function(){var Q=[];if(!this.eat(z._with))return Q;this.expect(z.braceL);var Z={},Y=!0;while(!this.eat(z.braceR)){if(!Y){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Y=!1;var J=this.parseImportAttribute(),X=J.key.type==="Identifier"?J.key.name:J.key.value;if(V0(Z,X))this.raiseRecoverable(J.key.start,"Duplicate attribute key '"+X+"'");Z[X]=!0,Q.push(J)}return Q};N.parseImportAttribute=function(){var Q=this.startNode();if(Q.key=this.type===z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(z.colon),this.type!==z.string)this.unexpected();return Q.value=this.parseExprAtom(),this.finishNode(Q,"ImportAttribute")};N.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===z.string){var Q=this.parseLiteral(this.value);if(FQ.test(Q.value))this.raise(Q.start,"An export name cannot include a lone surrogate.");return Q}return this.parseIdent(!0)};N.adaptDirectivePrologue=function(Q){for(var Z=0;Z<Q.length&&this.isDirectiveCandidate(Q[Z]);++Z)Q[Z].directive=Q[Z].expression.raw.slice(1,-1)};N.isDirectiveCandidate=function(Q){return this.options.ecmaVersion>=5&&Q.type==="ExpressionStatement"&&Q.expression.type==="Literal"&&typeof Q.expression.value==="string"&&(this.input[Q.start]==='"'||this.input[Q.start]==="'")};var Q0=u.prototype;Q0.toAssignable=function(Q,Z,Y){if(this.options.ecmaVersion>=6&&Q)switch(Q.type){case"Identifier":if(this.inAsync&&Q.name==="await")this.raise(Q.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(Q.type="ObjectPattern",Y)this.checkPatternErrors(Y,!0);for(var J=0,X=Q.properties;J<X.length;J+=1){var K=X[J];if(this.toAssignable(K,Z),K.type==="RestElement"&&(K.argument.type==="ArrayPattern"||K.argument.type==="ObjectPattern"))this.raise(K.argument.start,"Unexpected token")}break;case"Property":if(Q.kind!=="init")this.raise(Q.key.start,"Object pattern can't contain getter or setter");this.toAssignable(Q.value,Z);break;case"ArrayExpression":if(Q.type="ArrayPattern",Y)this.checkPatternErrors(Y,!0);this.toAssignableList(Q.elements,Z);break;case"SpreadElement":if(Q.type="RestElement",this.toAssignable(Q.argument,Z),Q.argument.type==="AssignmentPattern")this.raise(Q.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(Q.operator!=="=")this.raise(Q.left.end,"Only '=' operator can be used for specifying default value.");Q.type="AssignmentPattern",delete Q.operator,this.toAssignable(Q.left,Z);break;case"ParenthesizedExpression":this.toAssignable(Q.expression,Z,Y);break;case"ChainExpression":this.raiseRecoverable(Q.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!Z)break;default:this.raise(Q.start,"Assigning to rvalue")}else if(Y)this.checkPatternErrors(Y,!0);return Q};Q0.toAssignableList=function(Q,Z){var Y=Q.length;for(var J=0;J<Y;J++){var X=Q[J];if(X)this.toAssignable(X,Z)}if(Y){var K=Q[Y-1];if(this.options.ecmaVersion===6&&Z&&K&&K.type==="RestElement"&&K.argument.type!=="Identifier")this.unexpected(K.argument.start)}return Q};Q0.parseSpread=function(Q){var Z=this.startNode();return this.next(),Z.argument=this.parseMaybeAssign(!1,Q),this.finishNode(Z,"SpreadElement")};Q0.parseRestBinding=function(){var Q=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==z.name)this.unexpected();return Q.argument=this.parseBindingAtom(),this.finishNode(Q,"RestElement")};Q0.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case z.bracketL:var Q=this.startNode();return this.next(),Q.elements=this.parseBindingList(z.bracketR,!0,!0),this.finishNode(Q,"ArrayPattern");case z.braceL:return this.parseObj(!0)}return this.parseIdent()};Q0.parseBindingList=function(Q,Z,Y,J){var X=[],K=!0;while(!this.eat(Q)){if(K)K=!1;else this.expect(z.comma);if(Z&&this.type===z.comma)X.push(null);else if(Y&&this.afterTrailingComma(Q))break;else if(this.type===z.ellipsis){var W=this.parseRestBinding();if(this.parseBindingListItem(W),X.push(W),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(Q);break}else X.push(this.parseAssignableListItem(J))}return X};Q0.parseAssignableListItem=function(Q){var Z=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(Z),Z};Q0.parseBindingListItem=function(Q){return Q};Q0.parseMaybeDefault=function(Q,Z,Y){if(Y=Y||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(z.eq))return Y;var J=this.startNodeAt(Q,Z);return J.left=Y,J.right=this.parseMaybeAssign(),this.finishNode(J,"AssignmentPattern")};Q0.checkLValSimple=function(Q,Z,Y){if(Z===void 0)Z=u0;var J=Z!==u0;switch(Q.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(Q.name))this.raiseRecoverable(Q.start,(J?"Binding ":"Assigning to ")+Q.name+" in strict mode");if(J){if(Z===F0&&Q.name==="let")this.raiseRecoverable(Q.start,"let is disallowed as a lexically bound name");if(Y){if(V0(Y,Q.name))this.raiseRecoverable(Q.start,"Argument name clash");Y[Q.name]=!0}if(Z!==Y8)this.declareName(Q.name,Z,Q.start)}break;case"ChainExpression":this.raiseRecoverable(Q.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(J)this.raiseRecoverable(Q.start,"Binding member expression");break;case"ParenthesizedExpression":if(J)this.raiseRecoverable(Q.start,"Binding parenthesized expression");return this.checkLValSimple(Q.expression,Z,Y);default:this.raise(Q.start,(J?"Binding":"Assigning to")+" rvalue")}};Q0.checkLValPattern=function(Q,Z,Y){if(Z===void 0)Z=u0;switch(Q.type){case"ObjectPattern":for(var J=0,X=Q.properties;J<X.length;J+=1){var K=X[J];this.checkLValInnerPattern(K,Z,Y)}break;case"ArrayPattern":for(var W=0,H=Q.elements;W<H.length;W+=1){var G=H[W];if(G)this.checkLValInnerPattern(G,Z,Y)}break;default:this.checkLValSimple(Q,Z,Y)}};Q0.checkLValInnerPattern=function(Q,Z,Y){if(Z===void 0)Z=u0;switch(Q.type){case"Property":this.checkLValInnerPattern(Q.value,Z,Y);break;case"AssignmentPattern":this.checkLValPattern(Q.left,Z,Y);break;case"RestElement":this.checkLValPattern(Q.argument,Z,Y);break;default:this.checkLValPattern(Q,Z,Y)}};var J0=function(Z,Y,J,X,K){this.token=Z,this.isExpr=!!Y,this.preserveSpace=!!J,this.override=X,this.generator=!!K},f={b_stat:new J0("{",!1),b_expr:new J0("{",!0),b_tmpl:new J0("${",!1),p_stat:new J0("(",!1),p_expr:new J0("(",!0),q_tmpl:new J0("`",!0,!0,function(Q){return Q.tryReadTemplateToken()}),f_stat:new J0("function",!1),f_expr:new J0("function",!0),f_expr_gen:new J0("function",!0,!1,null,!0),f_gen:new J0("function",!1,!1,null,!0)},C0=u.prototype;C0.initialContext=function(){return[f.b_stat]};C0.curContext=function(){return this.context[this.context.length-1]};C0.braceIsBlock=function(Q){var Z=this.curContext();if(Z===f.f_expr||Z===f.f_stat)return!0;if(Q===z.colon&&(Z===f.b_stat||Z===f.b_expr))return!Z.isExpr;if(Q===z._return||Q===z.name&&this.exprAllowed)return a.test(this.input.slice(this.lastTokEnd,this.start));if(Q===z._else||Q===z.semi||Q===z.eof||Q===z.parenR||Q===z.arrow)return!0;if(Q===z.braceL)return Z===f.b_stat;if(Q===z._var||Q===z._const||Q===z.name)return!1;return!this.exprAllowed};C0.inGeneratorContext=function(){for(var Q=this.context.length-1;Q>=1;Q--){var Z=this.context[Q];if(Z.token==="function")return Z.generator}return!1};C0.updateContext=function(Q){var Z,Y=this.type;if(Y.keyword&&Q===z.dot)this.exprAllowed=!1;else if(Z=Y.updateContext)Z.call(this,Q);else this.exprAllowed=Y.beforeExpr};C0.overrideContext=function(Q){if(this.curContext()!==Q)this.context[this.context.length-1]=Q};z.parenR.updateContext=z.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var Q=this.context.pop();if(Q===f.b_stat&&this.curContext().token==="function")Q=this.context.pop();this.exprAllowed=!Q.isExpr};z.braceL.updateContext=function(Q){this.context.push(this.braceIsBlock(Q)?f.b_stat:f.b_expr),this.exprAllowed=!0};z.dollarBraceL.updateContext=function(){this.context.push(f.b_tmpl),this.exprAllowed=!0};z.parenL.updateContext=function(Q){var Z=Q===z._if||Q===z._for||Q===z._with||Q===z._while;this.context.push(Z?f.p_stat:f.p_expr),this.exprAllowed=!0};z.incDec.updateContext=function(){};z._function.updateContext=z._class.updateContext=function(Q){if(Q.beforeExpr&&Q!==z._else&&!(Q===z.semi&&this.curContext()!==f.p_stat)&&!(Q===z._return&&a.test(this.input.slice(this.lastTokEnd,this.start)))&&!((Q===z.colon||Q===z.braceL)&&this.curContext()===f.b_stat))this.context.push(f.f_expr);else this.context.push(f.f_stat);this.exprAllowed=!1};z.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};z.backQuote.updateContext=function(){if(this.curContext()===f.q_tmpl)this.context.pop();else this.context.push(f.q_tmpl);this.exprAllowed=!1};z.star.updateContext=function(Q){if(Q===z._function){var Z=this.context.length-1;if(this.context[Z]===f.f_expr)this.context[Z]=f.f_expr_gen;else this.context[Z]=f.f_gen}this.exprAllowed=!0};z.name.updateContext=function(Q){var Z=!1;if(this.options.ecmaVersion>=6&&Q!==z.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())Z=!0}this.exprAllowed=Z};var w=u.prototype;w.checkPropClash=function(Q,Z,Y){if(this.options.ecmaVersion>=9&&Q.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(Q.computed||Q.method||Q.shorthand))return;var J=Q.key,X;switch(J.type){case"Identifier":X=J.name;break;case"Literal":X=String(J.value);break;default:return}var K=Q.kind;if(this.options.ecmaVersion>=6){if(X==="__proto__"&&K==="init"){if(Z.proto)if(Y){if(Y.doubleProto<0)Y.doubleProto=J.start}else this.raiseRecoverable(J.start,"Redefinition of __proto__ property");Z.proto=!0}return}X="$"+X;var W=Z[X];if(W){var H;if(K==="init")H=this.strict&&W.init||W.get||W.set;else H=W.init||W[K];if(H)this.raiseRecoverable(J.start,"Redefinition of property")}else W=Z[X]={init:!1,get:!1,set:!1};W[K]=!0};w.parseExpression=function(Q,Z){var Y=this.start,J=this.startLoc,X=this.parseMaybeAssign(Q,Z);if(this.type===z.comma){var K=this.startNodeAt(Y,J);K.expressions=[X];while(this.eat(z.comma))K.expressions.push(this.parseMaybeAssign(Q,Z));return this.finishNode(K,"SequenceExpression")}return X};w.parseMaybeAssign=function(Q,Z,Y){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(Q);else this.exprAllowed=!1;var J=!1,X=-1,K=-1,W=-1;if(Z)X=Z.parenthesizedAssign,K=Z.trailingComma,W=Z.doubleProto,Z.parenthesizedAssign=Z.trailingComma=-1;else Z=new a0,J=!0;var H=this.start,G=this.startLoc;if(this.type===z.parenL||this.type===z.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=Q==="await";var _=this.parseMaybeConditional(Q,Z);if(Y)_=Y.call(this,_,H,G);if(this.type.isAssign){var F=this.startNodeAt(H,G);if(F.operator=this.value,this.type===z.eq)_=this.toAssignable(_,!1,Z);if(!J)Z.parenthesizedAssign=Z.trailingComma=Z.doubleProto=-1;if(Z.shorthandAssign>=_.start)Z.shorthandAssign=-1;if(this.type===z.eq)this.checkLValPattern(_);else this.checkLValSimple(_);if(F.left=_,this.next(),F.right=this.parseMaybeAssign(Q),W>-1)Z.doubleProto=W;return this.finishNode(F,"AssignmentExpression")}else if(J)this.checkExpressionErrors(Z,!0);if(X>-1)Z.parenthesizedAssign=X;if(K>-1)Z.trailingComma=K;return _};w.parseMaybeConditional=function(Q,Z){var Y=this.start,J=this.startLoc,X=this.parseExprOps(Q,Z);if(this.checkExpressionErrors(Z))return X;if(this.eat(z.question)){var K=this.startNodeAt(Y,J);return K.test=X,K.consequent=this.parseMaybeAssign(),this.expect(z.colon),K.alternate=this.parseMaybeAssign(Q),this.finishNode(K,"ConditionalExpression")}return X};w.parseExprOps=function(Q,Z){var Y=this.start,J=this.startLoc,X=this.parseMaybeUnary(Z,!1,!1,Q);if(this.checkExpressionErrors(Z))return X;return X.start===Y&&X.type==="ArrowFunctionExpression"?X:this.parseExprOp(X,Y,J,-1,Q)};w.parseExprOp=function(Q,Z,Y,J,X){var K=this.type.binop;if(K!=null&&(!X||this.type!==z._in)){if(K>J){var W=this.type===z.logicalOR||this.type===z.logicalAND,H=this.type===z.coalesce;if(H)K=z.logicalAND.binop;var G=this.value;this.next();var _=this.start,F=this.startLoc,O=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,X),_,F,K,X),R=this.buildBinary(Z,Y,Q,O,G,W||H);if(W&&this.type===z.coalesce||H&&(this.type===z.logicalOR||this.type===z.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(R,Z,Y,J,X)}}return Q};w.buildBinary=function(Q,Z,Y,J,X,K){if(J.type==="PrivateIdentifier")this.raise(J.start,"Private identifier can only be left side of binary expression");var W=this.startNodeAt(Q,Z);return W.left=Y,W.operator=X,W.right=J,this.finishNode(W,K?"LogicalExpression":"BinaryExpression")};w.parseMaybeUnary=function(Q,Z,Y,J){var X=this.start,K=this.startLoc,W;if(this.isContextual("await")&&this.canAwait)W=this.parseAwait(J),Z=!0;else if(this.type.prefix){var H=this.startNode(),G=this.type===z.incDec;if(H.operator=this.value,H.prefix=!0,this.next(),H.argument=this.parseMaybeUnary(null,!0,G,J),this.checkExpressionErrors(Q,!0),G)this.checkLValSimple(H.argument);else if(this.strict&&H.operator==="delete"&&X8(H.argument))this.raiseRecoverable(H.start,"Deleting local variable in strict mode");else if(H.operator==="delete"&&$1(H.argument))this.raiseRecoverable(H.start,"Private fields can not be deleted");else Z=!0;W=this.finishNode(H,G?"UpdateExpression":"UnaryExpression")}else if(!Z&&this.type===z.privateId){if((J||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(W=this.parsePrivateIdent(),this.type!==z._in)this.unexpected()}else{if(W=this.parseExprSubscripts(Q,J),this.checkExpressionErrors(Q))return W;while(this.type.postfix&&!this.canInsertSemicolon()){var _=this.startNodeAt(X,K);_.operator=this.value,_.prefix=!1,_.argument=W,this.checkLValSimple(W),this.next(),W=this.finishNode(_,"UpdateExpression")}}if(!Y&&this.eat(z.starstar))if(Z)this.unexpected(this.lastTokStart);else return this.buildBinary(X,K,W,this.parseMaybeUnary(null,!1,!1,J),"**",!1);else return W};function X8(Q){return Q.type==="Identifier"||Q.type==="ParenthesizedExpression"&&X8(Q.expression)}function $1(Q){return Q.type==="MemberExpression"&&Q.property.type==="PrivateIdentifier"||Q.type==="ChainExpression"&&$1(Q.expression)||Q.type==="ParenthesizedExpression"&&$1(Q.expression)}w.parseExprSubscripts=function(Q,Z){var Y=this.start,J=this.startLoc,X=this.parseExprAtom(Q,Z);if(X.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return X;var K=this.parseSubscripts(X,Y,J,!1,Z);if(Q&&K.type==="MemberExpression"){if(Q.parenthesizedAssign>=K.start)Q.parenthesizedAssign=-1;if(Q.parenthesizedBind>=K.start)Q.parenthesizedBind=-1;if(Q.trailingComma>=K.start)Q.trailingComma=-1}return K};w.parseSubscripts=function(Q,Z,Y,J,X){var K=this.options.ecmaVersion>=8&&Q.type==="Identifier"&&Q.name==="async"&&this.lastTokEnd===Q.end&&!this.canInsertSemicolon()&&Q.end-Q.start===5&&this.potentialArrowAt===Q.start,W=!1;while(!0){var H=this.parseSubscript(Q,Z,Y,J,K,W,X);if(H.optional)W=!0;if(H===Q||H.type==="ArrowFunctionExpression"){if(W){var G=this.startNodeAt(Z,Y);G.expression=H,H=this.finishNode(G,"ChainExpression")}return H}Q=H}};w.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(z.arrow)};w.parseSubscriptAsyncArrow=function(Q,Z,Y,J){return this.parseArrowExpression(this.startNodeAt(Q,Z),Y,!0,J)};w.parseSubscript=function(Q,Z,Y,J,X,K,W){var H=this.options.ecmaVersion>=11,G=H&&this.eat(z.questionDot);if(J&&G)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var _=this.eat(z.bracketL);if(_||G&&this.type!==z.parenL&&this.type!==z.backQuote||this.eat(z.dot)){var F=this.startNodeAt(Z,Y);if(F.object=Q,_)F.property=this.parseExpression(),this.expect(z.bracketR);else if(this.type===z.privateId&&Q.type!=="Super")F.property=this.parsePrivateIdent();else F.property=this.parseIdent(this.options.allowReserved!=="never");if(F.computed=!!_,H)F.optional=G;Q=this.finishNode(F,"MemberExpression")}else if(!J&&this.eat(z.parenL)){var O=new a0,R=this.yieldPos,$=this.awaitPos,M=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var L=this.parseExprList(z.parenR,this.options.ecmaVersion>=8,!1,O);if(X&&!G&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(O,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=R,this.awaitPos=$,this.awaitIdentPos=M,this.parseSubscriptAsyncArrow(Z,Y,L,W)}this.checkExpressionErrors(O,!0),this.yieldPos=R||this.yieldPos,this.awaitPos=$||this.awaitPos,this.awaitIdentPos=M||this.awaitIdentPos;var B=this.startNodeAt(Z,Y);if(B.callee=Q,B.arguments=L,H)B.optional=G;Q=this.finishNode(B,"CallExpression")}else if(this.type===z.backQuote){if(G||K)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var I=this.startNodeAt(Z,Y);I.tag=Q,I.quasi=this.parseTemplate({isTagged:!0}),Q=this.finishNode(I,"TaggedTemplateExpression")}return Q};w.parseExprAtom=function(Q,Z,Y){if(this.type===z.slash)this.readRegexp();var J,X=this.potentialArrowAt===this.start;switch(this.type){case z._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(J=this.startNode(),this.next(),this.type===z.parenL&&!this.allowDirectSuper)this.raise(J.start,"super() call outside constructor of a subclass");if(this.type!==z.dot&&this.type!==z.bracketL&&this.type!==z.parenL)this.unexpected();return this.finishNode(J,"Super");case z._this:return J=this.startNode(),this.next(),this.finishNode(J,"ThisExpression");case z.name:var K=this.start,W=this.startLoc,H=this.containsEsc,G=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!H&&G.name==="async"&&!this.canInsertSemicolon()&&this.eat(z._function))return this.overrideContext(f.f_expr),this.parseFunction(this.startNodeAt(K,W),0,!1,!0,Z);if(X&&!this.canInsertSemicolon()){if(this.eat(z.arrow))return this.parseArrowExpression(this.startNodeAt(K,W),[G],!1,Z);if(this.options.ecmaVersion>=8&&G.name==="async"&&this.type===z.name&&!H&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(G=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(z.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(K,W),[G],!0,Z)}}return G;case z.regexp:var _=this.value;return J=this.parseLiteral(_.value),J.regex={pattern:_.pattern,flags:_.flags},J;case z.num:case z.string:return this.parseLiteral(this.value);case z._null:case z._true:case z._false:return J=this.startNode(),J.value=this.type===z._null?null:this.type===z._true,J.raw=this.type.keyword,this.next(),this.finishNode(J,"Literal");case z.parenL:var F=this.start,O=this.parseParenAndDistinguishExpression(X,Z);if(Q){if(Q.parenthesizedAssign<0&&!this.isSimpleAssignTarget(O))Q.parenthesizedAssign=F;if(Q.parenthesizedBind<0)Q.parenthesizedBind=F}return O;case z.bracketL:return J=this.startNode(),this.next(),J.elements=this.parseExprList(z.bracketR,!0,!0,Q),this.finishNode(J,"ArrayExpression");case z.braceL:return this.overrideContext(f.b_expr),this.parseObj(!1,Q);case z._function:return J=this.startNode(),this.next(),this.parseFunction(J,0);case z._class:return this.parseClass(this.startNode(),!1);case z._new:return this.parseNew();case z.backQuote:return this.parseTemplate();case z._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Y);else return this.unexpected();default:return this.parseExprAtomDefault()}};w.parseExprAtomDefault=function(){this.unexpected()};w.parseExprImport=function(Q){var Z=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===z.parenL&&!Q)return this.parseDynamicImport(Z);else if(this.type===z.dot){var Y=this.startNodeAt(Z.start,Z.loc&&Z.loc.start);return Y.name="import",Z.meta=this.finishNode(Y,"Identifier"),this.parseImportMeta(Z)}else this.unexpected()};w.parseDynamicImport=function(Q){if(this.next(),Q.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(z.parenR))if(this.expect(z.comma),!this.afterTrailingComma(z.parenR)){if(Q.options=this.parseMaybeAssign(),!this.eat(z.parenR)){if(this.expect(z.comma),!this.afterTrailingComma(z.parenR))this.unexpected()}}else Q.options=null;else Q.options=null;else if(!this.eat(z.parenR)){var Z=this.start;if(this.eat(z.comma)&&this.eat(z.parenR))this.raiseRecoverable(Z,"Trailing comma is not allowed in import()");else this.unexpected(Z)}return this.finishNode(Q,"ImportExpression")};w.parseImportMeta=function(Q){this.next();var Z=this.containsEsc;if(Q.property=this.parseIdent(!0),Q.property.name!=="meta")this.raiseRecoverable(Q.property.start,"The only valid meta property for import is 'import.meta'");if(Z)this.raiseRecoverable(Q.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(Q.start,"Cannot use 'import.meta' outside a module");return this.finishNode(Q,"MetaProperty")};w.parseLiteral=function(Q){var Z=this.startNode();if(Z.value=Q,Z.raw=this.input.slice(this.start,this.end),Z.raw.charCodeAt(Z.raw.length-1)===110)Z.bigint=Z.value!=null?Z.value.toString():Z.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(Z,"Literal")};w.parseParenExpression=function(){this.expect(z.parenL);var Q=this.parseExpression();return this.expect(z.parenR),Q};w.shouldParseArrow=function(Q){return!this.canInsertSemicolon()};w.parseParenAndDistinguishExpression=function(Q,Z){var Y=this.start,J=this.startLoc,X,K=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var W=this.start,H=this.startLoc,G=[],_=!0,F=!1,O=new a0,R=this.yieldPos,$=this.awaitPos,M;this.yieldPos=0,this.awaitPos=0;while(this.type!==z.parenR)if(_?_=!1:this.expect(z.comma),K&&this.afterTrailingComma(z.parenR,!0)){F=!0;break}else if(this.type===z.ellipsis){if(M=this.start,G.push(this.parseParenItem(this.parseRestBinding())),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else G.push(this.parseMaybeAssign(!1,O,this.parseParenItem));var L=this.lastTokEnd,B=this.lastTokEndLoc;if(this.expect(z.parenR),Q&&this.shouldParseArrow(G)&&this.eat(z.arrow))return this.checkPatternErrors(O,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=R,this.awaitPos=$,this.parseParenArrowList(Y,J,G,Z);if(!G.length||F)this.unexpected(this.lastTokStart);if(M)this.unexpected(M);if(this.checkExpressionErrors(O,!0),this.yieldPos=R||this.yieldPos,this.awaitPos=$||this.awaitPos,G.length>1)X=this.startNodeAt(W,H),X.expressions=G,this.finishNodeAt(X,"SequenceExpression",L,B);else X=G[0]}else X=this.parseParenExpression();if(this.options.preserveParens){var I=this.startNodeAt(Y,J);return I.expression=X,this.finishNode(I,"ParenthesizedExpression")}else return X};w.parseParenItem=function(Q){return Q};w.parseParenArrowList=function(Q,Z,Y,J){return this.parseArrowExpression(this.startNodeAt(Q,Z),Y,!1,J)};var BQ=[];w.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var Q=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===z.dot){var Z=this.startNodeAt(Q.start,Q.loc&&Q.loc.start);Z.name="new",Q.meta=this.finishNode(Z,"Identifier"),this.next();var Y=this.containsEsc;if(Q.property=this.parseIdent(!0),Q.property.name!=="target")this.raiseRecoverable(Q.property.start,"The only valid meta property for new is 'new.target'");if(Y)this.raiseRecoverable(Q.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(Q.start,"'new.target' can only be used in functions and class static block");return this.finishNode(Q,"MetaProperty")}var J=this.start,X=this.startLoc;if(Q.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),J,X,!0,!1),this.eat(z.parenL))Q.arguments=this.parseExprList(z.parenR,this.options.ecmaVersion>=8,!1);else Q.arguments=BQ;return this.finishNode(Q,"NewExpression")};w.parseTemplateElement=function(Q){var Z=Q.isTagged,Y=this.startNode();if(this.type===z.invalidTemplate){if(!Z)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Y.value={raw:this.value.replace(/\r\n?/g,`
5
5
  `),cooked:null}}else Y.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
6
- `),cooked:this.value};return this.next(),Y.tail=this.type===z.backQuote,this.finishNode(Y,"TemplateElement")};A.parseTemplate=function(Q){if(Q===void 0)Q={};var Z=Q.isTagged;if(Z===void 0)Z=!1;var Y=this.startNode();this.next(),Y.expressions=[];var J=this.parseTemplateElement({isTagged:Z});Y.quasis=[J];while(!J.tail){if(this.type===z.eof)this.raise(this.pos,"Unterminated template literal");this.expect(z.dollarBraceL),Y.expressions.push(this.parseExpression()),this.expect(z.braceR),Y.quasis.push(J=this.parseTemplateElement({isTagged:Z}))}return this.next(),this.finishNode(Y,"TemplateLiteral")};A.isAsyncProp=function(Q){return!Q.computed&&Q.key.type==="Identifier"&&Q.key.name==="async"&&(this.type===z.name||this.type===z.num||this.type===z.string||this.type===z.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===z.star)&&!a.test(this.input.slice(this.lastTokEnd,this.start))};A.parseObj=function(Q,Z){var Y=this.startNode(),J=!0,X={};Y.properties=[],this.next();while(!this.eat(z.braceR)){if(!J){if(this.expect(z.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(z.braceR))break}else J=!1;var K=this.parseProperty(Q,Z);if(!Q)this.checkPropClash(K,X,Z);Y.properties.push(K)}return this.finishNode(Y,Q?"ObjectPattern":"ObjectExpression")};A.parseProperty=function(Q,Z){var Y=this.startNode(),J,X,K,W;if(this.options.ecmaVersion>=9&&this.eat(z.ellipsis)){if(Q){if(Y.argument=this.parseIdent(!1),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Y,"RestElement")}if(Y.argument=this.parseMaybeAssign(!1,Z),this.type===z.comma&&Z&&Z.trailingComma<0)Z.trailingComma=this.start;return this.finishNode(Y,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Y.method=!1,Y.shorthand=!1,Q||Z)K=this.start,W=this.startLoc;if(!Q)J=this.eat(z.star)}var H=this.containsEsc;if(this.parsePropertyName(Y),!Q&&!H&&this.options.ecmaVersion>=8&&!J&&this.isAsyncProp(Y))X=!0,J=this.options.ecmaVersion>=9&&this.eat(z.star),this.parsePropertyName(Y);else X=!1;return this.parsePropertyValue(Y,Q,J,X,K,W,Z,H),this.finishNode(Y,"Property")};A.parseGetterSetter=function(Q){var Z=Q.key.name;this.parsePropertyName(Q),Q.value=this.parseMethod(!1),Q.kind=Z;var Y=Q.kind==="get"?0:1;if(Q.value.params.length!==Y){var J=Q.value.start;if(Q.kind==="get")this.raiseRecoverable(J,"getter should have no params");else this.raiseRecoverable(J,"setter should have exactly one param")}else if(Q.kind==="set"&&Q.value.params[0].type==="RestElement")this.raiseRecoverable(Q.value.params[0].start,"Setter cannot use rest params")};A.parsePropertyValue=function(Q,Z,Y,J,X,K,W,H){if((Y||J)&&this.type===z.colon)this.unexpected();if(this.eat(z.colon))Q.value=Z?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,W),Q.kind="init";else if(this.options.ecmaVersion>=6&&this.type===z.parenL){if(Z)this.unexpected();Q.method=!0,Q.value=this.parseMethod(Y,J),Q.kind="init"}else if(!Z&&!H&&this.options.ecmaVersion>=5&&!Q.computed&&Q.key.type==="Identifier"&&(Q.key.name==="get"||Q.key.name==="set")&&(this.type!==z.comma&&this.type!==z.braceR&&this.type!==z.eq)){if(Y||J)this.unexpected();this.parseGetterSetter(Q)}else if(this.options.ecmaVersion>=6&&!Q.computed&&Q.key.type==="Identifier"){if(Y||J)this.unexpected();if(this.checkUnreserved(Q.key),Q.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=X;if(Z)Q.value=this.parseMaybeDefault(X,K,this.copyNode(Q.key));else if(this.type===z.eq&&W){if(W.shorthandAssign<0)W.shorthandAssign=this.start;Q.value=this.parseMaybeDefault(X,K,this.copyNode(Q.key))}else Q.value=this.copyNode(Q.key);Q.kind="init",Q.shorthand=!0}else this.unexpected()};A.parsePropertyName=function(Q){if(this.options.ecmaVersion>=6)if(this.eat(z.bracketL))return Q.computed=!0,Q.key=this.parseMaybeAssign(),this.expect(z.bracketR),Q.key;else Q.computed=!1;return Q.key=this.type===z.num||this.type===z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};A.initFunction=function(Q){if(Q.id=null,this.options.ecmaVersion>=6)Q.generator=Q.expression=!1;if(this.options.ecmaVersion>=8)Q.async=!1};A.parseMethod=function(Q,Z,Y){var J=this.startNode(),X=this.yieldPos,K=this.awaitPos,W=this.awaitIdentPos;if(this.initFunction(J),this.options.ecmaVersion>=6)J.generator=Q;if(this.options.ecmaVersion>=8)J.async=!!Z;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(B1(Z,J.generator)|c0|(Y?e1:0)),this.expect(z.parenL),J.params=this.parseBindingList(z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(J,!1,!0,!1),this.yieldPos=X,this.awaitPos=K,this.awaitIdentPos=W,this.finishNode(J,"FunctionExpression")};A.parseArrowExpression=function(Q,Z,Y,J){var X=this.yieldPos,K=this.awaitPos,W=this.awaitIdentPos;if(this.enterScope(B1(Y,!1)|I1),this.initFunction(Q),this.options.ecmaVersion>=8)Q.async=!!Y;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,Q.params=this.toAssignableList(Z,!0),this.parseFunctionBody(Q,!0,!1,J),this.yieldPos=X,this.awaitPos=K,this.awaitIdentPos=W,this.finishNode(Q,"ArrowFunctionExpression")};A.parseFunctionBody=function(Q,Z,Y,J){var X=Z&&this.type!==z.braceL,K=this.strict,W=!1;if(X)Q.body=this.parseMaybeAssign(J),Q.expression=!0,this.checkParams(Q,!1);else{var H=this.options.ecmaVersion>=7&&!this.isSimpleParamList(Q.params);if(!K||H){if(W=this.strictDirective(this.end),W&&H)this.raiseRecoverable(Q.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var G=this.labels;if(this.labels=[],W)this.strict=!0;if(this.checkParams(Q,!K&&!W&&!Z&&!Y&&this.isSimpleParamList(Q.params)),this.strict&&Q.id)this.checkLValSimple(Q.id,Y8);Q.body=this.parseBlock(!1,void 0,W&&!K),Q.expression=!1,this.adaptDirectivePrologue(Q.body.body),this.labels=G}this.exitScope()};A.isSimpleParamList=function(Q){for(var Z=0,Y=Q;Z<Y.length;Z+=1){var J=Y[Z];if(J.type!=="Identifier")return!1}return!0};A.checkParams=function(Q,Z){var Y=Object.create(null);for(var J=0,X=Q.params;J<X.length;J+=1){var K=X[J];this.checkLValInnerPattern(K,j1,Z?null:Y)}};A.parseExprList=function(Q,Z,Y,J){var X=[],K=!0;while(!this.eat(Q)){if(!K){if(this.expect(z.comma),Z&&this.afterTrailingComma(Q))break}else K=!1;var W=void 0;if(Y&&this.type===z.comma)W=null;else if(this.type===z.ellipsis){if(W=this.parseSpread(J),J&&this.type===z.comma&&J.trailingComma<0)J.trailingComma=this.start}else W=this.parseMaybeAssign(!1,J);X.push(W)}return X};A.checkUnreserved=function(Q){var{start:Z,end:Y,name:J}=Q;if(this.inGenerator&&J==="yield")this.raiseRecoverable(Z,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&J==="await")this.raiseRecoverable(Z,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&n0)&&J==="arguments")this.raiseRecoverable(Z,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(J==="arguments"||J==="await"))this.raise(Z,"Cannot use "+J+" in class static initialization block");if(this.keywords.test(J))this.raise(Z,"Unexpected keyword '"+J+"'");if(this.options.ecmaVersion<6&&this.input.slice(Z,Y).indexOf("\\")!==-1)return;var X=this.strict?this.reservedWordsStrict:this.reservedWords;if(X.test(J)){if(!this.inAsync&&J==="await")this.raiseRecoverable(Z,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(Z,"The keyword '"+J+"' is reserved")}};A.parseIdent=function(Q){var Z=this.parseIdentNode();if(this.next(!!Q),this.finishNode(Z,"Identifier"),!Q){if(this.checkUnreserved(Z),Z.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Z.start}return Z};A.parseIdentNode=function(){var Q=this.startNode();if(this.type===z.name)Q.name=this.value;else if(this.type.keyword){if(Q.name=this.type.keyword,(Q.name==="class"||Q.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=z.name}else this.unexpected();return Q};A.parsePrivateIdent=function(){var Q=this.startNode();if(this.type===z.privateId)Q.name=this.value;else this.unexpected();if(this.next(),this.finishNode(Q,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(Q.start,"Private field '#"+Q.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(Q);return Q};A.parseYield=function(Q){if(!this.yieldPos)this.yieldPos=this.start;var Z=this.startNode();if(this.next(),this.type===z.semi||this.canInsertSemicolon()||this.type!==z.star&&!this.type.startsExpr)Z.delegate=!1,Z.argument=null;else Z.delegate=this.eat(z.star),Z.argument=this.parseMaybeAssign(Q);return this.finishNode(Z,"YieldExpression")};A.parseAwait=function(Q){if(!this.awaitPos)this.awaitPos=this.start;var Z=this.startNode();return this.next(),Z.argument=this.parseMaybeUnary(null,!0,!1,Q),this.finishNode(Z,"AwaitExpression")};var l0=u.prototype;l0.raise=function(Q,Z){var Y=s1(this.input,Q);if(Z+=" ("+Y.line+":"+Y.column+")",this.sourceFile)Z+=" in "+this.sourceFile;var J=SyntaxError(Z);throw J.pos=Q,J.loc=Y,J.raisedAt=this.pos,J};l0.raiseRecoverable=l0.raise;l0.curPosition=function(){if(this.options.locations)return new S0(this.curLine,this.pos-this.lineStart)};var U0=u.prototype,jQ=function(Z){this.flags=Z,this.var=[],this.lexical=[],this.functions=[]};U0.enterScope=function(Q){this.scopeStack.push(new jQ(Q))};U0.exitScope=function(){this.scopeStack.pop()};U0.treatFunctionsAsVarInScope=function(Q){return Q.flags&P0||!this.inModule&&Q.flags&E0};U0.declareName=function(Q,Z,Y){var J=!1;if(Z===F0){var X=this.currentScope();if(J=X.lexical.indexOf(Q)>-1||X.functions.indexOf(Q)>-1||X.var.indexOf(Q)>-1,X.lexical.push(Q),this.inModule&&X.flags&E0)delete this.undefinedExports[Q]}else if(Z===Z8){var K=this.currentScope();K.lexical.push(Q)}else if(Z===Q8){var W=this.currentScope();if(this.treatFunctionsAsVar)J=W.lexical.indexOf(Q)>-1;else J=W.lexical.indexOf(Q)>-1||W.var.indexOf(Q)>-1;W.functions.push(Q)}else for(var H=this.scopeStack.length-1;H>=0;--H){var G=this.scopeStack[H];if(G.lexical.indexOf(Q)>-1&&!(G.flags&t1&&G.lexical[0]===Q)||!this.treatFunctionsAsVarInScope(G)&&G.functions.indexOf(Q)>-1){J=!0;break}if(G.var.push(Q),this.inModule&&G.flags&E0)delete this.undefinedExports[Q];if(G.flags&n0)break}if(J)this.raiseRecoverable(Y,"Identifier '"+Q+"' has already been declared")};U0.checkLocalExport=function(Q){if(this.scopeStack[0].lexical.indexOf(Q.name)===-1&&this.scopeStack[0].var.indexOf(Q.name)===-1)this.undefinedExports[Q.name]=Q};U0.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};U0.currentVarScope=function(){for(var Q=this.scopeStack.length-1;;Q--){var Z=this.scopeStack[Q];if(Z.flags&(n0|k0|j0))return Z}};U0.currentThisScope=function(){for(var Q=this.scopeStack.length-1;;Q--){var Z=this.scopeStack[Q];if(Z.flags&(n0|k0|j0)&&!(Z.flags&I1))return Z}};var o0=function(Z,Y,J){if(this.type="",this.start=Y,this.end=0,Z.options.locations)this.loc=new i0(Z,J);if(Z.options.directSourceFile)this.sourceFile=Z.options.directSourceFile;if(Z.options.ranges)this.range=[Y,0]},v0=u.prototype;v0.startNode=function(){return new o0(this,this.start,this.startLoc)};v0.startNodeAt=function(Q,Z){return new o0(this,Q,Z)};function W8(Q,Z,Y,J){if(Q.type=Z,Q.end=Y,this.options.locations)Q.loc.end=J;if(this.options.ranges)Q.range[1]=Y;return Q}v0.finishNode=function(Q,Z){return W8.call(this,Q,Z,this.lastTokEnd,this.lastTokEndLoc)};v0.finishNodeAt=function(Q,Z,Y,J){return W8.call(this,Q,Z,Y,J)};v0.copyNode=function(Q){var Z=new o0(this,Q.start,this.startLoc);for(var Y in Q)Z[Y]=Q[Y];return Z};var NQ="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",K8="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",H8=K8+" Extended_Pictographic",z8=H8,G8=z8+" EBase EComp EMod EPres ExtPict",_8=G8,LQ=_8,wQ={9:K8,10:H8,11:z8,12:G8,13:_8,14:LQ},AQ="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",DQ={9:"",10:"",11:"",12:"",13:"",14:AQ},p1="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",q8="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",F8=q8+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",R8=F8+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",$8=R8+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",O8=$8+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",VQ=O8+" "+NQ,PQ={9:q8,10:F8,11:R8,12:$8,13:O8,14:VQ},U8={};function CQ(Q){var Z=U8[Q]={binary:$0(wQ[Q]+" "+p1),binaryOfStrings:$0(DQ[Q]),nonBinary:{General_Category:$0(p1),Script:$0(PQ[Q])}};Z.nonBinary.Script_Extensions=Z.nonBinary.Script,Z.nonBinary.gc=Z.nonBinary.General_Category,Z.nonBinary.sc=Z.nonBinary.Script,Z.nonBinary.scx=Z.nonBinary.Script_Extensions}for(b0=0,x0=[9,10,11,12,13,14];b0<x0.length;b0+=1)O1=x0[b0],CQ(O1);var O1,b0,x0,j=u.prototype,p0=function(Z,Y){this.parent=Z,this.base=Y||this};p0.prototype.separatedFrom=function(Z){for(var Y=this;Y;Y=Y.parent)for(var J=Z;J;J=J.parent)if(Y.base===J.base&&Y!==J)return!0;return!1};p0.prototype.sibling=function(){return new p0(this.parent,this.base)};var K0=function(Z){this.parser=Z,this.validFlags="gim"+(Z.options.ecmaVersion>=6?"uy":"")+(Z.options.ecmaVersion>=9?"s":"")+(Z.options.ecmaVersion>=13?"d":"")+(Z.options.ecmaVersion>=15?"v":""),this.unicodeProperties=U8[Z.options.ecmaVersion>=14?14:Z.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};K0.prototype.reset=function(Z,Y,J){var X=J.indexOf("v")!==-1,K=J.indexOf("u")!==-1;if(this.start=Z|0,this.source=Y+"",this.flags=J,X&&this.parser.options.ecmaVersion>=15)this.switchU=!0,this.switchV=!0,this.switchN=!0;else this.switchU=K&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=K&&this.parser.options.ecmaVersion>=9};K0.prototype.raise=function(Z){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+Z)};K0.prototype.at=function(Z,Y){if(Y===void 0)Y=!1;var J=this.source,X=J.length;if(Z>=X)return-1;var K=J.charCodeAt(Z);if(!(Y||this.switchU)||K<=55295||K>=57344||Z+1>=X)return K;var W=J.charCodeAt(Z+1);return W>=56320&&W<=57343?(K<<10)+W-56613888:K};K0.prototype.nextIndex=function(Z,Y){if(Y===void 0)Y=!1;var J=this.source,X=J.length;if(Z>=X)return X;var K=J.charCodeAt(Z),W;if(!(Y||this.switchU)||K<=55295||K>=57344||Z+1>=X||(W=J.charCodeAt(Z+1))<56320||W>57343)return Z+1;return Z+2};K0.prototype.current=function(Z){if(Z===void 0)Z=!1;return this.at(this.pos,Z)};K0.prototype.lookahead=function(Z){if(Z===void 0)Z=!1;return this.at(this.nextIndex(this.pos,Z),Z)};K0.prototype.advance=function(Z){if(Z===void 0)Z=!1;this.pos=this.nextIndex(this.pos,Z)};K0.prototype.eat=function(Z,Y){if(Y===void 0)Y=!1;if(this.current(Y)===Z)return this.advance(Y),!0;return!1};K0.prototype.eatChars=function(Z,Y){if(Y===void 0)Y=!1;var J=this.pos;for(var X=0,K=Z;X<K.length;X+=1){var W=K[X],H=this.at(J,Y);if(H===-1||H!==W)return!1;J=this.nextIndex(J,Y)}return this.pos=J,!0};j.validateRegExpFlags=function(Q){var{validFlags:Z,flags:Y}=Q,J=!1,X=!1;for(var K=0;K<Y.length;K++){var W=Y.charAt(K);if(Z.indexOf(W)===-1)this.raise(Q.start,"Invalid regular expression flag");if(Y.indexOf(W,K+1)>-1)this.raise(Q.start,"Duplicate regular expression flag");if(W==="u")J=!0;if(W==="v")X=!0}if(this.options.ecmaVersion>=15&&J&&X)this.raise(Q.start,"Invalid regular expression flag")};function bQ(Q){for(var Z in Q)return!0;return!1}j.validateRegExpPattern=function(Q){if(this.regexp_pattern(Q),!Q.switchN&&this.options.ecmaVersion>=9&&bQ(Q.groupNames))Q.switchN=!0,this.regexp_pattern(Q)};j.regexp_pattern=function(Q){if(Q.pos=0,Q.lastIntValue=0,Q.lastStringValue="",Q.lastAssertionIsQuantifiable=!1,Q.numCapturingParens=0,Q.maxBackReference=0,Q.groupNames=Object.create(null),Q.backReferenceNames.length=0,Q.branchID=null,this.regexp_disjunction(Q),Q.pos!==Q.source.length){if(Q.eat(41))Q.raise("Unmatched ')'");if(Q.eat(93)||Q.eat(125))Q.raise("Lone quantifier brackets")}if(Q.maxBackReference>Q.numCapturingParens)Q.raise("Invalid escape");for(var Z=0,Y=Q.backReferenceNames;Z<Y.length;Z+=1){var J=Y[Z];if(!Q.groupNames[J])Q.raise("Invalid named capture referenced")}};j.regexp_disjunction=function(Q){var Z=this.options.ecmaVersion>=16;if(Z)Q.branchID=new p0(Q.branchID,null);this.regexp_alternative(Q);while(Q.eat(124)){if(Z)Q.branchID=Q.branchID.sibling();this.regexp_alternative(Q)}if(Z)Q.branchID=Q.branchID.parent;if(this.regexp_eatQuantifier(Q,!0))Q.raise("Nothing to repeat");if(Q.eat(123))Q.raise("Lone quantifier brackets")};j.regexp_alternative=function(Q){while(Q.pos<Q.source.length&&this.regexp_eatTerm(Q));};j.regexp_eatTerm=function(Q){if(this.regexp_eatAssertion(Q)){if(Q.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(Q)){if(Q.switchU)Q.raise("Invalid quantifier")}return!0}if(Q.switchU?this.regexp_eatAtom(Q):this.regexp_eatExtendedAtom(Q))return this.regexp_eatQuantifier(Q),!0;return!1};j.regexp_eatAssertion=function(Q){var Z=Q.pos;if(Q.lastAssertionIsQuantifiable=!1,Q.eat(94)||Q.eat(36))return!0;if(Q.eat(92)){if(Q.eat(66)||Q.eat(98))return!0;Q.pos=Z}if(Q.eat(40)&&Q.eat(63)){var Y=!1;if(this.options.ecmaVersion>=9)Y=Q.eat(60);if(Q.eat(61)||Q.eat(33)){if(this.regexp_disjunction(Q),!Q.eat(41))Q.raise("Unterminated group");return Q.lastAssertionIsQuantifiable=!Y,!0}}return Q.pos=Z,!1};j.regexp_eatQuantifier=function(Q,Z){if(Z===void 0)Z=!1;if(this.regexp_eatQuantifierPrefix(Q,Z))return Q.eat(63),!0;return!1};j.regexp_eatQuantifierPrefix=function(Q,Z){return Q.eat(42)||Q.eat(43)||Q.eat(63)||this.regexp_eatBracedQuantifier(Q,Z)};j.regexp_eatBracedQuantifier=function(Q,Z){var Y=Q.pos;if(Q.eat(123)){var J=0,X=-1;if(this.regexp_eatDecimalDigits(Q)){if(J=Q.lastIntValue,Q.eat(44)&&this.regexp_eatDecimalDigits(Q))X=Q.lastIntValue;if(Q.eat(125)){if(X!==-1&&X<J&&!Z)Q.raise("numbers out of order in {} quantifier");return!0}}if(Q.switchU&&!Z)Q.raise("Incomplete quantifier");Q.pos=Y}return!1};j.regexp_eatAtom=function(Q){return this.regexp_eatPatternCharacters(Q)||Q.eat(46)||this.regexp_eatReverseSolidusAtomEscape(Q)||this.regexp_eatCharacterClass(Q)||this.regexp_eatUncapturingGroup(Q)||this.regexp_eatCapturingGroup(Q)};j.regexp_eatReverseSolidusAtomEscape=function(Q){var Z=Q.pos;if(Q.eat(92)){if(this.regexp_eatAtomEscape(Q))return!0;Q.pos=Z}return!1};j.regexp_eatUncapturingGroup=function(Q){var Z=Q.pos;if(Q.eat(40)){if(Q.eat(63)){if(this.options.ecmaVersion>=16){var Y=this.regexp_eatModifiers(Q),J=Q.eat(45);if(Y||J){for(var X=0;X<Y.length;X++){var K=Y.charAt(X);if(Y.indexOf(K,X+1)>-1)Q.raise("Duplicate regular expression modifiers")}if(J){var W=this.regexp_eatModifiers(Q);if(!Y&&!W&&Q.current()===58)Q.raise("Invalid regular expression modifiers");for(var H=0;H<W.length;H++){var G=W.charAt(H);if(W.indexOf(G,H+1)>-1||Y.indexOf(G)>-1)Q.raise("Duplicate regular expression modifiers")}}}}if(Q.eat(58)){if(this.regexp_disjunction(Q),Q.eat(41))return!0;Q.raise("Unterminated group")}}Q.pos=Z}return!1};j.regexp_eatCapturingGroup=function(Q){if(Q.eat(40)){if(this.options.ecmaVersion>=9)this.regexp_groupSpecifier(Q);else if(Q.current()===63)Q.raise("Invalid group");if(this.regexp_disjunction(Q),Q.eat(41))return Q.numCapturingParens+=1,!0;Q.raise("Unterminated group")}return!1};j.regexp_eatModifiers=function(Q){var Z="",Y=0;while((Y=Q.current())!==-1&&TQ(Y))Z+=_0(Y),Q.advance();return Z};function TQ(Q){return Q===105||Q===109||Q===115}j.regexp_eatExtendedAtom=function(Q){return Q.eat(46)||this.regexp_eatReverseSolidusAtomEscape(Q)||this.regexp_eatCharacterClass(Q)||this.regexp_eatUncapturingGroup(Q)||this.regexp_eatCapturingGroup(Q)||this.regexp_eatInvalidBracedQuantifier(Q)||this.regexp_eatExtendedPatternCharacter(Q)};j.regexp_eatInvalidBracedQuantifier=function(Q){if(this.regexp_eatBracedQuantifier(Q,!0))Q.raise("Nothing to repeat");return!1};j.regexp_eatSyntaxCharacter=function(Q){var Z=Q.current();if(M8(Z))return Q.lastIntValue=Z,Q.advance(),!0;return!1};function M8(Q){return Q===36||Q>=40&&Q<=43||Q===46||Q===63||Q>=91&&Q<=94||Q>=123&&Q<=125}j.regexp_eatPatternCharacters=function(Q){var Z=Q.pos,Y=0;while((Y=Q.current())!==-1&&!M8(Y))Q.advance();return Q.pos!==Z};j.regexp_eatExtendedPatternCharacter=function(Q){var Z=Q.current();if(Z!==-1&&Z!==36&&!(Z>=40&&Z<=43)&&Z!==46&&Z!==63&&Z!==91&&Z!==94&&Z!==124)return Q.advance(),!0;return!1};j.regexp_groupSpecifier=function(Q){if(Q.eat(63)){if(!this.regexp_eatGroupName(Q))Q.raise("Invalid group");var Z=this.options.ecmaVersion>=16,Y=Q.groupNames[Q.lastStringValue];if(Y)if(Z)for(var J=0,X=Y;J<X.length;J+=1){var K=X[J];if(!K.separatedFrom(Q.branchID))Q.raise("Duplicate capture group name")}else Q.raise("Duplicate capture group name");if(Z)(Y||(Q.groupNames[Q.lastStringValue]=[])).push(Q.branchID);else Q.groupNames[Q.lastStringValue]=!0}};j.regexp_eatGroupName=function(Q){if(Q.lastStringValue="",Q.eat(60)){if(this.regexp_eatRegExpIdentifierName(Q)&&Q.eat(62))return!0;Q.raise("Invalid capture group name")}return!1};j.regexp_eatRegExpIdentifierName=function(Q){if(Q.lastStringValue="",this.regexp_eatRegExpIdentifierStart(Q)){Q.lastStringValue+=_0(Q.lastIntValue);while(this.regexp_eatRegExpIdentifierPart(Q))Q.lastStringValue+=_0(Q.lastIntValue);return!0}return!1};j.regexp_eatRegExpIdentifierStart=function(Q){var Z=Q.pos,Y=this.options.ecmaVersion>=11,J=Q.current(Y);if(Q.advance(Y),J===92&&this.regexp_eatRegExpUnicodeEscapeSequence(Q,Y))J=Q.lastIntValue;if(SQ(J))return Q.lastIntValue=J,!0;return Q.pos=Z,!1};function SQ(Q){return X0(Q,!0)||Q===36||Q===95}j.regexp_eatRegExpIdentifierPart=function(Q){var Z=Q.pos,Y=this.options.ecmaVersion>=11,J=Q.current(Y);if(Q.advance(Y),J===92&&this.regexp_eatRegExpUnicodeEscapeSequence(Q,Y))J=Q.lastIntValue;if(EQ(J))return Q.lastIntValue=J,!0;return Q.pos=Z,!1};function EQ(Q){return O0(Q,!0)||Q===36||Q===95||Q===8204||Q===8205}j.regexp_eatAtomEscape=function(Q){if(this.regexp_eatBackReference(Q)||this.regexp_eatCharacterClassEscape(Q)||this.regexp_eatCharacterEscape(Q)||Q.switchN&&this.regexp_eatKGroupName(Q))return!0;if(Q.switchU){if(Q.current()===99)Q.raise("Invalid unicode escape");Q.raise("Invalid escape")}return!1};j.regexp_eatBackReference=function(Q){var Z=Q.pos;if(this.regexp_eatDecimalEscape(Q)){var Y=Q.lastIntValue;if(Q.switchU){if(Y>Q.maxBackReference)Q.maxBackReference=Y;return!0}if(Y<=Q.numCapturingParens)return!0;Q.pos=Z}return!1};j.regexp_eatKGroupName=function(Q){if(Q.eat(107)){if(this.regexp_eatGroupName(Q))return Q.backReferenceNames.push(Q.lastStringValue),!0;Q.raise("Invalid named reference")}return!1};j.regexp_eatCharacterEscape=function(Q){return this.regexp_eatControlEscape(Q)||this.regexp_eatCControlLetter(Q)||this.regexp_eatZero(Q)||this.regexp_eatHexEscapeSequence(Q)||this.regexp_eatRegExpUnicodeEscapeSequence(Q,!1)||!Q.switchU&&this.regexp_eatLegacyOctalEscapeSequence(Q)||this.regexp_eatIdentityEscape(Q)};j.regexp_eatCControlLetter=function(Q){var Z=Q.pos;if(Q.eat(99)){if(this.regexp_eatControlLetter(Q))return!0;Q.pos=Z}return!1};j.regexp_eatZero=function(Q){if(Q.current()===48&&!s0(Q.lookahead()))return Q.lastIntValue=0,Q.advance(),!0;return!1};j.regexp_eatControlEscape=function(Q){var Z=Q.current();if(Z===116)return Q.lastIntValue=9,Q.advance(),!0;if(Z===110)return Q.lastIntValue=10,Q.advance(),!0;if(Z===118)return Q.lastIntValue=11,Q.advance(),!0;if(Z===102)return Q.lastIntValue=12,Q.advance(),!0;if(Z===114)return Q.lastIntValue=13,Q.advance(),!0;return!1};j.regexp_eatControlLetter=function(Q){var Z=Q.current();if(I8(Z))return Q.lastIntValue=Z%32,Q.advance(),!0;return!1};function I8(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}j.regexp_eatRegExpUnicodeEscapeSequence=function(Q,Z){if(Z===void 0)Z=!1;var Y=Q.pos,J=Z||Q.switchU;if(Q.eat(117)){if(this.regexp_eatFixedHexDigits(Q,4)){var X=Q.lastIntValue;if(J&&X>=55296&&X<=56319){var K=Q.pos;if(Q.eat(92)&&Q.eat(117)&&this.regexp_eatFixedHexDigits(Q,4)){var W=Q.lastIntValue;if(W>=56320&&W<=57343)return Q.lastIntValue=(X-55296)*1024+(W-56320)+65536,!0}Q.pos=K,Q.lastIntValue=X}return!0}if(J&&Q.eat(123)&&this.regexp_eatHexDigits(Q)&&Q.eat(125)&&kQ(Q.lastIntValue))return!0;if(J)Q.raise("Invalid unicode escape");Q.pos=Y}return!1};function kQ(Q){return Q>=0&&Q<=1114111}j.regexp_eatIdentityEscape=function(Q){if(Q.switchU){if(this.regexp_eatSyntaxCharacter(Q))return!0;if(Q.eat(47))return Q.lastIntValue=47,!0;return!1}var Z=Q.current();if(Z!==99&&(!Q.switchN||Z!==107))return Q.lastIntValue=Z,Q.advance(),!0;return!1};j.regexp_eatDecimalEscape=function(Q){Q.lastIntValue=0;var Z=Q.current();if(Z>=49&&Z<=57){do Q.lastIntValue=10*Q.lastIntValue+(Z-48),Q.advance();while((Z=Q.current())>=48&&Z<=57);return!0}return!1};var B8=0,q0=1,e=2;j.regexp_eatCharacterClassEscape=function(Q){var Z=Q.current();if(vQ(Z))return Q.lastIntValue=-1,Q.advance(),q0;var Y=!1;if(Q.switchU&&this.options.ecmaVersion>=9&&((Y=Z===80)||Z===112)){Q.lastIntValue=-1,Q.advance();var J;if(Q.eat(123)&&(J=this.regexp_eatUnicodePropertyValueExpression(Q))&&Q.eat(125)){if(Y&&J===e)Q.raise("Invalid property name");return J}Q.raise("Invalid property name")}return B8};function vQ(Q){return Q===100||Q===68||Q===115||Q===83||Q===119||Q===87}j.regexp_eatUnicodePropertyValueExpression=function(Q){var Z=Q.pos;if(this.regexp_eatUnicodePropertyName(Q)&&Q.eat(61)){var Y=Q.lastStringValue;if(this.regexp_eatUnicodePropertyValue(Q)){var J=Q.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(Q,Y,J),q0}}if(Q.pos=Z,this.regexp_eatLoneUnicodePropertyNameOrValue(Q)){var X=Q.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(Q,X)}return B8};j.regexp_validateUnicodePropertyNameAndValue=function(Q,Z,Y){if(!V0(Q.unicodeProperties.nonBinary,Z))Q.raise("Invalid property name");if(!Q.unicodeProperties.nonBinary[Z].test(Y))Q.raise("Invalid property value")};j.regexp_validateUnicodePropertyNameOrValue=function(Q,Z){if(Q.unicodeProperties.binary.test(Z))return q0;if(Q.switchV&&Q.unicodeProperties.binaryOfStrings.test(Z))return e;Q.raise("Invalid property name")};j.regexp_eatUnicodePropertyName=function(Q){var Z=0;Q.lastStringValue="";while(j8(Z=Q.current()))Q.lastStringValue+=_0(Z),Q.advance();return Q.lastStringValue!==""};function j8(Q){return I8(Q)||Q===95}j.regexp_eatUnicodePropertyValue=function(Q){var Z=0;Q.lastStringValue="";while(yQ(Z=Q.current()))Q.lastStringValue+=_0(Z),Q.advance();return Q.lastStringValue!==""};function yQ(Q){return j8(Q)||s0(Q)}j.regexp_eatLoneUnicodePropertyNameOrValue=function(Q){return this.regexp_eatUnicodePropertyValue(Q)};j.regexp_eatCharacterClass=function(Q){if(Q.eat(91)){var Z=Q.eat(94),Y=this.regexp_classContents(Q);if(!Q.eat(93))Q.raise("Unterminated character class");if(Z&&Y===e)Q.raise("Negated character class may contain strings");return!0}return!1};j.regexp_classContents=function(Q){if(Q.current()===93)return q0;if(Q.switchV)return this.regexp_classSetExpression(Q);return this.regexp_nonEmptyClassRanges(Q),q0};j.regexp_nonEmptyClassRanges=function(Q){while(this.regexp_eatClassAtom(Q)){var Z=Q.lastIntValue;if(Q.eat(45)&&this.regexp_eatClassAtom(Q)){var Y=Q.lastIntValue;if(Q.switchU&&(Z===-1||Y===-1))Q.raise("Invalid character class");if(Z!==-1&&Y!==-1&&Z>Y)Q.raise("Range out of order in character class")}}};j.regexp_eatClassAtom=function(Q){var Z=Q.pos;if(Q.eat(92)){if(this.regexp_eatClassEscape(Q))return!0;if(Q.switchU){var Y=Q.current();if(Y===99||w8(Y))Q.raise("Invalid class escape");Q.raise("Invalid escape")}Q.pos=Z}var J=Q.current();if(J!==93)return Q.lastIntValue=J,Q.advance(),!0;return!1};j.regexp_eatClassEscape=function(Q){var Z=Q.pos;if(Q.eat(98))return Q.lastIntValue=8,!0;if(Q.switchU&&Q.eat(45))return Q.lastIntValue=45,!0;if(!Q.switchU&&Q.eat(99)){if(this.regexp_eatClassControlLetter(Q))return!0;Q.pos=Z}return this.regexp_eatCharacterClassEscape(Q)||this.regexp_eatCharacterEscape(Q)};j.regexp_classSetExpression=function(Q){var Z=q0,Y;if(this.regexp_eatClassSetRange(Q));else if(Y=this.regexp_eatClassSetOperand(Q)){if(Y===e)Z=e;var J=Q.pos;while(Q.eatChars([38,38])){if(Q.current()!==38&&(Y=this.regexp_eatClassSetOperand(Q))){if(Y!==e)Z=q0;continue}Q.raise("Invalid character in character class")}if(J!==Q.pos)return Z;while(Q.eatChars([45,45])){if(this.regexp_eatClassSetOperand(Q))continue;Q.raise("Invalid character in character class")}if(J!==Q.pos)return Z}else Q.raise("Invalid character in character class");for(;;){if(this.regexp_eatClassSetRange(Q))continue;if(Y=this.regexp_eatClassSetOperand(Q),!Y)return Z;if(Y===e)Z=e}};j.regexp_eatClassSetRange=function(Q){var Z=Q.pos;if(this.regexp_eatClassSetCharacter(Q)){var Y=Q.lastIntValue;if(Q.eat(45)&&this.regexp_eatClassSetCharacter(Q)){var J=Q.lastIntValue;if(Y!==-1&&J!==-1&&Y>J)Q.raise("Range out of order in character class");return!0}Q.pos=Z}return!1};j.regexp_eatClassSetOperand=function(Q){if(this.regexp_eatClassSetCharacter(Q))return q0;return this.regexp_eatClassStringDisjunction(Q)||this.regexp_eatNestedClass(Q)};j.regexp_eatNestedClass=function(Q){var Z=Q.pos;if(Q.eat(91)){var Y=Q.eat(94),J=this.regexp_classContents(Q);if(Q.eat(93)){if(Y&&J===e)Q.raise("Negated character class may contain strings");return J}Q.pos=Z}if(Q.eat(92)){var X=this.regexp_eatCharacterClassEscape(Q);if(X)return X;Q.pos=Z}return null};j.regexp_eatClassStringDisjunction=function(Q){var Z=Q.pos;if(Q.eatChars([92,113])){if(Q.eat(123)){var Y=this.regexp_classStringDisjunctionContents(Q);if(Q.eat(125))return Y}else Q.raise("Invalid escape");Q.pos=Z}return null};j.regexp_classStringDisjunctionContents=function(Q){var Z=this.regexp_classString(Q);while(Q.eat(124))if(this.regexp_classString(Q)===e)Z=e;return Z};j.regexp_classString=function(Q){var Z=0;while(this.regexp_eatClassSetCharacter(Q))Z++;return Z===1?q0:e};j.regexp_eatClassSetCharacter=function(Q){var Z=Q.pos;if(Q.eat(92)){if(this.regexp_eatCharacterEscape(Q)||this.regexp_eatClassSetReservedPunctuator(Q))return!0;if(Q.eat(98))return Q.lastIntValue=8,!0;return Q.pos=Z,!1}var Y=Q.current();if(Y<0||Y===Q.lookahead()&&gQ(Y))return!1;if(fQ(Y))return!1;return Q.advance(),Q.lastIntValue=Y,!0};function gQ(Q){return Q===33||Q>=35&&Q<=38||Q>=42&&Q<=44||Q===46||Q>=58&&Q<=64||Q===94||Q===96||Q===126}function fQ(Q){return Q===40||Q===41||Q===45||Q===47||Q>=91&&Q<=93||Q>=123&&Q<=125}j.regexp_eatClassSetReservedPunctuator=function(Q){var Z=Q.current();if(hQ(Z))return Q.lastIntValue=Z,Q.advance(),!0;return!1};function hQ(Q){return Q===33||Q===35||Q===37||Q===38||Q===44||Q===45||Q>=58&&Q<=62||Q===64||Q===96||Q===126}j.regexp_eatClassControlLetter=function(Q){var Z=Q.current();if(s0(Z)||Z===95)return Q.lastIntValue=Z%32,Q.advance(),!0;return!1};j.regexp_eatHexEscapeSequence=function(Q){var Z=Q.pos;if(Q.eat(120)){if(this.regexp_eatFixedHexDigits(Q,2))return!0;if(Q.switchU)Q.raise("Invalid escape");Q.pos=Z}return!1};j.regexp_eatDecimalDigits=function(Q){var Z=Q.pos,Y=0;Q.lastIntValue=0;while(s0(Y=Q.current()))Q.lastIntValue=10*Q.lastIntValue+(Y-48),Q.advance();return Q.pos!==Z};function s0(Q){return Q>=48&&Q<=57}j.regexp_eatHexDigits=function(Q){var Z=Q.pos,Y=0;Q.lastIntValue=0;while(N8(Y=Q.current()))Q.lastIntValue=16*Q.lastIntValue+L8(Y),Q.advance();return Q.pos!==Z};function N8(Q){return Q>=48&&Q<=57||Q>=65&&Q<=70||Q>=97&&Q<=102}function L8(Q){if(Q>=65&&Q<=70)return 10+(Q-65);if(Q>=97&&Q<=102)return 10+(Q-97);return Q-48}j.regexp_eatLegacyOctalEscapeSequence=function(Q){if(this.regexp_eatOctalDigit(Q)){var Z=Q.lastIntValue;if(this.regexp_eatOctalDigit(Q)){var Y=Q.lastIntValue;if(Z<=3&&this.regexp_eatOctalDigit(Q))Q.lastIntValue=Z*64+Y*8+Q.lastIntValue;else Q.lastIntValue=Z*8+Y}else Q.lastIntValue=Z;return!0}return!1};j.regexp_eatOctalDigit=function(Q){var Z=Q.current();if(w8(Z))return Q.lastIntValue=Z-48,Q.advance(),!0;return Q.lastIntValue=0,!1};function w8(Q){return Q>=48&&Q<=55}j.regexp_eatFixedHexDigits=function(Q,Z){var Y=Q.pos;Q.lastIntValue=0;for(var J=0;J<Z;++J){var X=Q.current();if(!N8(X))return Q.pos=Y,!1;Q.lastIntValue=16*Q.lastIntValue+L8(X),Q.advance()}return!0};var L1=function(Z){if(this.type=Z.type,this.value=Z.value,this.start=Z.start,this.end=Z.end,Z.options.locations)this.loc=new i0(Z,Z.startLoc,Z.endLoc);if(Z.options.ranges)this.range=[Z.start,Z.end]},C=u.prototype;C.next=function(Q){if(!Q&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new L1(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};C.getToken=function(){return this.next(),new L1(this)};if(typeof Symbol<"u")C[Symbol.iterator]=function(){var Q=this;return{next:function(){var Z=Q.getToken();return{done:Z.type===z.eof,value:Z}}}};C.nextToken=function(){var Q=this.curContext();if(!Q||!Q.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(z.eof);if(Q.override)return Q.override(this);else this.readToken(this.fullCharCodeAtPos())};C.readToken=function(Q){if(X0(Q,this.options.ecmaVersion>=6)||Q===92)return this.readWord();return this.getTokenFromCode(Q)};C.fullCharCodeAtPos=function(){var Q=this.input.charCodeAt(this.pos);if(Q<=55295||Q>=56320)return Q;var Z=this.input.charCodeAt(this.pos+1);return Z<=56319||Z>=57344?Q:(Q<<10)+Z-56613888};C.skipBlockComment=function(){var Q=this.options.onComment&&this.curPosition(),Z=this.pos,Y=this.input.indexOf("*/",this.pos+=2);if(Y===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Y+2,this.options.locations)for(var J=void 0,X=Z;(J=n1(this.input,X,this.pos))>-1;)++this.curLine,X=this.lineStart=J;if(this.options.onComment)this.options.onComment(!0,this.input.slice(Z+2,Y),Z,this.pos,Q,this.curPosition())};C.skipLineComment=function(Q){var Z=this.pos,Y=this.options.onComment&&this.curPosition(),J=this.input.charCodeAt(this.pos+=Q);while(this.pos<this.input.length&&!D0(J))J=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(Z+Q,this.pos),Z,this.pos,Y,this.curPosition())};C.skipSpace=function(){Q:while(this.pos<this.input.length){var Q=this.input.charCodeAt(this.pos);switch(Q){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10)++this.pos;case 10:case 8232:case 8233:if(++this.pos,this.options.locations)++this.curLine,this.lineStart=this.pos;break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break Q}break;default:if(Q>8&&Q<14||Q>=5760&&a1.test(String.fromCharCode(Q)))++this.pos;else break Q}}};C.finishToken=function(Q,Z){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Y=this.type;this.type=Q,this.value=Z,this.updateContext(Y)};C.readToken_dot=function(){var Q=this.input.charCodeAt(this.pos+1);if(Q>=48&&Q<=57)return this.readNumber(!0);var Z=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&Q===46&&Z===46)return this.pos+=3,this.finishToken(z.ellipsis);else return++this.pos,this.finishToken(z.dot)};C.readToken_slash=function(){var Q=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(Q===61)return this.finishOp(z.assign,2);return this.finishOp(z.slash,1)};C.readToken_mult_modulo_exp=function(Q){var Z=this.input.charCodeAt(this.pos+1),Y=1,J=Q===42?z.star:z.modulo;if(this.options.ecmaVersion>=7&&Q===42&&Z===42)++Y,J=z.starstar,Z=this.input.charCodeAt(this.pos+2);if(Z===61)return this.finishOp(z.assign,Y+1);return this.finishOp(J,Y)};C.readToken_pipe_amp=function(Q){var Z=this.input.charCodeAt(this.pos+1);if(Z===Q){if(this.options.ecmaVersion>=12){var Y=this.input.charCodeAt(this.pos+2);if(Y===61)return this.finishOp(z.assign,3)}return this.finishOp(Q===124?z.logicalOR:z.logicalAND,2)}if(Z===61)return this.finishOp(z.assign,2);return this.finishOp(Q===124?z.bitwiseOR:z.bitwiseAND,1)};C.readToken_caret=function(){var Q=this.input.charCodeAt(this.pos+1);if(Q===61)return this.finishOp(z.assign,2);return this.finishOp(z.bitwiseXOR,1)};C.readToken_plus_min=function(Q){var Z=this.input.charCodeAt(this.pos+1);if(Z===Q){if(Z===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||a.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(z.incDec,2)}if(Z===61)return this.finishOp(z.assign,2);return this.finishOp(z.plusMin,1)};C.readToken_lt_gt=function(Q){var Z=this.input.charCodeAt(this.pos+1),Y=1;if(Z===Q){if(Y=Q===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Y)===61)return this.finishOp(z.assign,Y+1);return this.finishOp(z.bitShift,Y)}if(Z===33&&Q===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45)return this.skipLineComment(4),this.skipSpace(),this.nextToken();if(Z===61)Y=2;return this.finishOp(z.relational,Y)};C.readToken_eq_excl=function(Q){var Z=this.input.charCodeAt(this.pos+1);if(Z===61)return this.finishOp(z.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(Q===61&&Z===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(z.arrow);return this.finishOp(Q===61?z.eq:z.prefix,1)};C.readToken_question=function(){var Q=this.options.ecmaVersion;if(Q>=11){var Z=this.input.charCodeAt(this.pos+1);if(Z===46){var Y=this.input.charCodeAt(this.pos+2);if(Y<48||Y>57)return this.finishOp(z.questionDot,2)}if(Z===63){if(Q>=12){var J=this.input.charCodeAt(this.pos+2);if(J===61)return this.finishOp(z.assign,3)}return this.finishOp(z.coalesce,2)}}return this.finishOp(z.question,1)};C.readToken_numberSign=function(){var Q=this.options.ecmaVersion,Z=35;if(Q>=13){if(++this.pos,Z=this.fullCharCodeAtPos(),X0(Z,!0)||Z===92)return this.finishToken(z.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+_0(Z)+"'")};C.getTokenFromCode=function(Q){switch(Q){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(z.parenL);case 41:return++this.pos,this.finishToken(z.parenR);case 59:return++this.pos,this.finishToken(z.semi);case 44:return++this.pos,this.finishToken(z.comma);case 91:return++this.pos,this.finishToken(z.bracketL);case 93:return++this.pos,this.finishToken(z.bracketR);case 123:return++this.pos,this.finishToken(z.braceL);case 125:return++this.pos,this.finishToken(z.braceR);case 58:return++this.pos,this.finishToken(z.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(z.backQuote);case 48:var Z=this.input.charCodeAt(this.pos+1);if(Z===120||Z===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(Z===111||Z===79)return this.readRadixNumber(8);if(Z===98||Z===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(Q);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(Q);case 124:case 38:return this.readToken_pipe_amp(Q);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(Q);case 60:case 62:return this.readToken_lt_gt(Q);case 61:case 33:return this.readToken_eq_excl(Q);case 63:return this.readToken_question();case 126:return this.finishOp(z.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+_0(Q)+"'")};C.finishOp=function(Q,Z){var Y=this.input.slice(this.pos,this.pos+Z);return this.pos+=Z,this.finishToken(Q,Y)};C.readRegexp=function(){var Q,Z,Y=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Y,"Unterminated regular expression");var J=this.input.charAt(this.pos);if(a.test(J))this.raise(Y,"Unterminated regular expression");if(!Q){if(J==="[")Z=!0;else if(J==="]"&&Z)Z=!1;else if(J==="/"&&!Z)break;Q=J==="\\"}else Q=!1;++this.pos}var X=this.input.slice(Y,this.pos);++this.pos;var K=this.pos,W=this.readWord1();if(this.containsEsc)this.unexpected(K);var H=this.regexpState||(this.regexpState=new K0(this));H.reset(Y,X,W),this.validateRegExpFlags(H),this.validateRegExpPattern(H);var G=null;try{G=new RegExp(X,W)}catch(_){}return this.finishToken(z.regexp,{pattern:X,flags:W,value:G})};C.readInt=function(Q,Z,Y){var J=this.options.ecmaVersion>=12&&Z===void 0,X=Y&&this.input.charCodeAt(this.pos)===48,K=this.pos,W=0,H=0;for(var G=0,_=Z==null?1/0:Z;G<_;++G,++this.pos){var F=this.input.charCodeAt(this.pos),O=void 0;if(J&&F===95){if(X)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(H===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(G===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");H=F;continue}if(F>=97)O=F-97+10;else if(F>=65)O=F-65+10;else if(F>=48&&F<=57)O=F-48;else O=1/0;if(O>=Q)break;H=F,W=W*Q+O}if(J&&H===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===K||Z!=null&&this.pos-K!==Z)return null;return W};function mQ(Q,Z){if(Z)return parseInt(Q,8);return parseFloat(Q.replace(/_/g,""))}function A8(Q){if(typeof BigInt!=="function")return null;return BigInt(Q.replace(/_/g,""))}C.readRadixNumber=function(Q){var Z=this.pos;this.pos+=2;var Y=this.readInt(Q);if(Y==null)this.raise(this.start+2,"Expected number in radix "+Q);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Y=A8(this.input.slice(Z,this.pos)),++this.pos;else if(X0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(z.num,Y)};C.readNumber=function(Q){var Z=this.pos;if(!Q&&this.readInt(10,void 0,!0)===null)this.raise(Z,"Invalid number");var Y=this.pos-Z>=2&&this.input.charCodeAt(Z)===48;if(Y&&this.strict)this.raise(Z,"Invalid number");var J=this.input.charCodeAt(this.pos);if(!Y&&!Q&&this.options.ecmaVersion>=11&&J===110){var X=A8(this.input.slice(Z,this.pos));if(++this.pos,X0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(z.num,X)}if(Y&&/[89]/.test(this.input.slice(Z,this.pos)))Y=!1;if(J===46&&!Y)++this.pos,this.readInt(10),J=this.input.charCodeAt(this.pos);if((J===69||J===101)&&!Y){if(J=this.input.charCodeAt(++this.pos),J===43||J===45)++this.pos;if(this.readInt(10)===null)this.raise(Z,"Invalid number")}if(X0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var K=mQ(this.input.slice(Z,this.pos),Y);return this.finishToken(z.num,K)};C.readCodePoint=function(){var Q=this.input.charCodeAt(this.pos),Z;if(Q===123){if(this.options.ecmaVersion<6)this.unexpected();var Y=++this.pos;if(Z=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,Z>1114111)this.invalidStringToken(Y,"Code point out of bounds")}else Z=this.readHexChar(4);return Z};C.readString=function(Q){var Z="",Y=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var J=this.input.charCodeAt(this.pos);if(J===Q)break;if(J===92)Z+=this.input.slice(Y,this.pos),Z+=this.readEscapedChar(!1),Y=this.pos;else if(J===8232||J===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(D0(J))this.raise(this.start,"Unterminated string constant");++this.pos}}return Z+=this.input.slice(Y,this.pos++),this.finishToken(z.string,Z)};var D8={};C.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(Q){if(Q===D8)this.readInvalidTemplateToken();else throw Q}this.inTemplateElement=!1};C.invalidStringToken=function(Q,Z){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw D8;else this.raise(Q,Z)};C.readTmplToken=function(){var Q="",Z=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Y=this.input.charCodeAt(this.pos);if(Y===96||Y===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===z.template||this.type===z.invalidTemplate))if(Y===36)return this.pos+=2,this.finishToken(z.dollarBraceL);else return++this.pos,this.finishToken(z.backQuote);return Q+=this.input.slice(Z,this.pos),this.finishToken(z.template,Q)}if(Y===92)Q+=this.input.slice(Z,this.pos),Q+=this.readEscapedChar(!0),Z=this.pos;else if(D0(Y)){switch(Q+=this.input.slice(Z,this.pos),++this.pos,Y){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:Q+=`
6
+ `),cooked:this.value};return this.next(),Y.tail=this.type===z.backQuote,this.finishNode(Y,"TemplateElement")};w.parseTemplate=function(Q){if(Q===void 0)Q={};var Z=Q.isTagged;if(Z===void 0)Z=!1;var Y=this.startNode();this.next(),Y.expressions=[];var J=this.parseTemplateElement({isTagged:Z});Y.quasis=[J];while(!J.tail){if(this.type===z.eof)this.raise(this.pos,"Unterminated template literal");this.expect(z.dollarBraceL),Y.expressions.push(this.parseExpression()),this.expect(z.braceR),Y.quasis.push(J=this.parseTemplateElement({isTagged:Z}))}return this.next(),this.finishNode(Y,"TemplateLiteral")};w.isAsyncProp=function(Q){return!Q.computed&&Q.key.type==="Identifier"&&Q.key.name==="async"&&(this.type===z.name||this.type===z.num||this.type===z.string||this.type===z.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===z.star)&&!a.test(this.input.slice(this.lastTokEnd,this.start))};w.parseObj=function(Q,Z){var Y=this.startNode(),J=!0,X={};Y.properties=[],this.next();while(!this.eat(z.braceR)){if(!J){if(this.expect(z.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(z.braceR))break}else J=!1;var K=this.parseProperty(Q,Z);if(!Q)this.checkPropClash(K,X,Z);Y.properties.push(K)}return this.finishNode(Y,Q?"ObjectPattern":"ObjectExpression")};w.parseProperty=function(Q,Z){var Y=this.startNode(),J,X,K,W;if(this.options.ecmaVersion>=9&&this.eat(z.ellipsis)){if(Q){if(Y.argument=this.parseIdent(!1),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Y,"RestElement")}if(Y.argument=this.parseMaybeAssign(!1,Z),this.type===z.comma&&Z&&Z.trailingComma<0)Z.trailingComma=this.start;return this.finishNode(Y,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Y.method=!1,Y.shorthand=!1,Q||Z)K=this.start,W=this.startLoc;if(!Q)J=this.eat(z.star)}var H=this.containsEsc;if(this.parsePropertyName(Y),!Q&&!H&&this.options.ecmaVersion>=8&&!J&&this.isAsyncProp(Y))X=!0,J=this.options.ecmaVersion>=9&&this.eat(z.star),this.parsePropertyName(Y);else X=!1;return this.parsePropertyValue(Y,Q,J,X,K,W,Z,H),this.finishNode(Y,"Property")};w.parseGetterSetter=function(Q){var Z=Q.key.name;this.parsePropertyName(Q),Q.value=this.parseMethod(!1),Q.kind=Z;var Y=Q.kind==="get"?0:1;if(Q.value.params.length!==Y){var J=Q.value.start;if(Q.kind==="get")this.raiseRecoverable(J,"getter should have no params");else this.raiseRecoverable(J,"setter should have exactly one param")}else if(Q.kind==="set"&&Q.value.params[0].type==="RestElement")this.raiseRecoverable(Q.value.params[0].start,"Setter cannot use rest params")};w.parsePropertyValue=function(Q,Z,Y,J,X,K,W,H){if((Y||J)&&this.type===z.colon)this.unexpected();if(this.eat(z.colon))Q.value=Z?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,W),Q.kind="init";else if(this.options.ecmaVersion>=6&&this.type===z.parenL){if(Z)this.unexpected();Q.method=!0,Q.value=this.parseMethod(Y,J),Q.kind="init"}else if(!Z&&!H&&this.options.ecmaVersion>=5&&!Q.computed&&Q.key.type==="Identifier"&&(Q.key.name==="get"||Q.key.name==="set")&&(this.type!==z.comma&&this.type!==z.braceR&&this.type!==z.eq)){if(Y||J)this.unexpected();this.parseGetterSetter(Q)}else if(this.options.ecmaVersion>=6&&!Q.computed&&Q.key.type==="Identifier"){if(Y||J)this.unexpected();if(this.checkUnreserved(Q.key),Q.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=X;if(Z)Q.value=this.parseMaybeDefault(X,K,this.copyNode(Q.key));else if(this.type===z.eq&&W){if(W.shorthandAssign<0)W.shorthandAssign=this.start;Q.value=this.parseMaybeDefault(X,K,this.copyNode(Q.key))}else Q.value=this.copyNode(Q.key);Q.kind="init",Q.shorthand=!0}else this.unexpected()};w.parsePropertyName=function(Q){if(this.options.ecmaVersion>=6)if(this.eat(z.bracketL))return Q.computed=!0,Q.key=this.parseMaybeAssign(),this.expect(z.bracketR),Q.key;else Q.computed=!1;return Q.key=this.type===z.num||this.type===z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};w.initFunction=function(Q){if(Q.id=null,this.options.ecmaVersion>=6)Q.generator=Q.expression=!1;if(this.options.ecmaVersion>=8)Q.async=!1};w.parseMethod=function(Q,Z,Y){var J=this.startNode(),X=this.yieldPos,K=this.awaitPos,W=this.awaitIdentPos;if(this.initFunction(J),this.options.ecmaVersion>=6)J.generator=Q;if(this.options.ecmaVersion>=8)J.async=!!Z;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(B1(Z,J.generator)|c0|(Y?e1:0)),this.expect(z.parenL),J.params=this.parseBindingList(z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(J,!1,!0,!1),this.yieldPos=X,this.awaitPos=K,this.awaitIdentPos=W,this.finishNode(J,"FunctionExpression")};w.parseArrowExpression=function(Q,Z,Y,J){var X=this.yieldPos,K=this.awaitPos,W=this.awaitIdentPos;if(this.enterScope(B1(Y,!1)|I1),this.initFunction(Q),this.options.ecmaVersion>=8)Q.async=!!Y;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,Q.params=this.toAssignableList(Z,!0),this.parseFunctionBody(Q,!0,!1,J),this.yieldPos=X,this.awaitPos=K,this.awaitIdentPos=W,this.finishNode(Q,"ArrowFunctionExpression")};w.parseFunctionBody=function(Q,Z,Y,J){var X=Z&&this.type!==z.braceL,K=this.strict,W=!1;if(X)Q.body=this.parseMaybeAssign(J),Q.expression=!0,this.checkParams(Q,!1);else{var H=this.options.ecmaVersion>=7&&!this.isSimpleParamList(Q.params);if(!K||H){if(W=this.strictDirective(this.end),W&&H)this.raiseRecoverable(Q.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var G=this.labels;if(this.labels=[],W)this.strict=!0;if(this.checkParams(Q,!K&&!W&&!Z&&!Y&&this.isSimpleParamList(Q.params)),this.strict&&Q.id)this.checkLValSimple(Q.id,Y8);Q.body=this.parseBlock(!1,void 0,W&&!K),Q.expression=!1,this.adaptDirectivePrologue(Q.body.body),this.labels=G}this.exitScope()};w.isSimpleParamList=function(Q){for(var Z=0,Y=Q;Z<Y.length;Z+=1){var J=Y[Z];if(J.type!=="Identifier")return!1}return!0};w.checkParams=function(Q,Z){var Y=Object.create(null);for(var J=0,X=Q.params;J<X.length;J+=1){var K=X[J];this.checkLValInnerPattern(K,j1,Z?null:Y)}};w.parseExprList=function(Q,Z,Y,J){var X=[],K=!0;while(!this.eat(Q)){if(!K){if(this.expect(z.comma),Z&&this.afterTrailingComma(Q))break}else K=!1;var W=void 0;if(Y&&this.type===z.comma)W=null;else if(this.type===z.ellipsis){if(W=this.parseSpread(J),J&&this.type===z.comma&&J.trailingComma<0)J.trailingComma=this.start}else W=this.parseMaybeAssign(!1,J);X.push(W)}return X};w.checkUnreserved=function(Q){var{start:Z,end:Y,name:J}=Q;if(this.inGenerator&&J==="yield")this.raiseRecoverable(Z,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&J==="await")this.raiseRecoverable(Z,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&n0)&&J==="arguments")this.raiseRecoverable(Z,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(J==="arguments"||J==="await"))this.raise(Z,"Cannot use "+J+" in class static initialization block");if(this.keywords.test(J))this.raise(Z,"Unexpected keyword '"+J+"'");if(this.options.ecmaVersion<6&&this.input.slice(Z,Y).indexOf("\\")!==-1)return;var X=this.strict?this.reservedWordsStrict:this.reservedWords;if(X.test(J)){if(!this.inAsync&&J==="await")this.raiseRecoverable(Z,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(Z,"The keyword '"+J+"' is reserved")}};w.parseIdent=function(Q){var Z=this.parseIdentNode();if(this.next(!!Q),this.finishNode(Z,"Identifier"),!Q){if(this.checkUnreserved(Z),Z.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Z.start}return Z};w.parseIdentNode=function(){var Q=this.startNode();if(this.type===z.name)Q.name=this.value;else if(this.type.keyword){if(Q.name=this.type.keyword,(Q.name==="class"||Q.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=z.name}else this.unexpected();return Q};w.parsePrivateIdent=function(){var Q=this.startNode();if(this.type===z.privateId)Q.name=this.value;else this.unexpected();if(this.next(),this.finishNode(Q,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(Q.start,"Private field '#"+Q.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(Q);return Q};w.parseYield=function(Q){if(!this.yieldPos)this.yieldPos=this.start;var Z=this.startNode();if(this.next(),this.type===z.semi||this.canInsertSemicolon()||this.type!==z.star&&!this.type.startsExpr)Z.delegate=!1,Z.argument=null;else Z.delegate=this.eat(z.star),Z.argument=this.parseMaybeAssign(Q);return this.finishNode(Z,"YieldExpression")};w.parseAwait=function(Q){if(!this.awaitPos)this.awaitPos=this.start;var Z=this.startNode();return this.next(),Z.argument=this.parseMaybeUnary(null,!0,!1,Q),this.finishNode(Z,"AwaitExpression")};var l0=u.prototype;l0.raise=function(Q,Z){var Y=s1(this.input,Q);if(Z+=" ("+Y.line+":"+Y.column+")",this.sourceFile)Z+=" in "+this.sourceFile;var J=SyntaxError(Z);throw J.pos=Q,J.loc=Y,J.raisedAt=this.pos,J};l0.raiseRecoverable=l0.raise;l0.curPosition=function(){if(this.options.locations)return new S0(this.curLine,this.pos-this.lineStart)};var M0=u.prototype,jQ=function(Z){this.flags=Z,this.var=[],this.lexical=[],this.functions=[]};M0.enterScope=function(Q){this.scopeStack.push(new jQ(Q))};M0.exitScope=function(){this.scopeStack.pop()};M0.treatFunctionsAsVarInScope=function(Q){return Q.flags&P0||!this.inModule&&Q.flags&E0};M0.declareName=function(Q,Z,Y){var J=!1;if(Z===F0){var X=this.currentScope();if(J=X.lexical.indexOf(Q)>-1||X.functions.indexOf(Q)>-1||X.var.indexOf(Q)>-1,X.lexical.push(Q),this.inModule&&X.flags&E0)delete this.undefinedExports[Q]}else if(Z===Z8){var K=this.currentScope();K.lexical.push(Q)}else if(Z===Q8){var W=this.currentScope();if(this.treatFunctionsAsVar)J=W.lexical.indexOf(Q)>-1;else J=W.lexical.indexOf(Q)>-1||W.var.indexOf(Q)>-1;W.functions.push(Q)}else for(var H=this.scopeStack.length-1;H>=0;--H){var G=this.scopeStack[H];if(G.lexical.indexOf(Q)>-1&&!(G.flags&t1&&G.lexical[0]===Q)||!this.treatFunctionsAsVarInScope(G)&&G.functions.indexOf(Q)>-1){J=!0;break}if(G.var.push(Q),this.inModule&&G.flags&E0)delete this.undefinedExports[Q];if(G.flags&n0)break}if(J)this.raiseRecoverable(Y,"Identifier '"+Q+"' has already been declared")};M0.checkLocalExport=function(Q){if(this.scopeStack[0].lexical.indexOf(Q.name)===-1&&this.scopeStack[0].var.indexOf(Q.name)===-1)this.undefinedExports[Q.name]=Q};M0.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};M0.currentVarScope=function(){for(var Q=this.scopeStack.length-1;;Q--){var Z=this.scopeStack[Q];if(Z.flags&(n0|k0|j0))return Z}};M0.currentThisScope=function(){for(var Q=this.scopeStack.length-1;;Q--){var Z=this.scopeStack[Q];if(Z.flags&(n0|k0|j0)&&!(Z.flags&I1))return Z}};var o0=function(Z,Y,J){if(this.type="",this.start=Y,this.end=0,Z.options.locations)this.loc=new i0(Z,J);if(Z.options.directSourceFile)this.sourceFile=Z.options.directSourceFile;if(Z.options.ranges)this.range=[Y,0]},v0=u.prototype;v0.startNode=function(){return new o0(this,this.start,this.startLoc)};v0.startNodeAt=function(Q,Z){return new o0(this,Q,Z)};function W8(Q,Z,Y,J){if(Q.type=Z,Q.end=Y,this.options.locations)Q.loc.end=J;if(this.options.ranges)Q.range[1]=Y;return Q}v0.finishNode=function(Q,Z){return W8.call(this,Q,Z,this.lastTokEnd,this.lastTokEndLoc)};v0.finishNodeAt=function(Q,Z,Y,J){return W8.call(this,Q,Z,Y,J)};v0.copyNode=function(Q){var Z=new o0(this,Q.start,this.startLoc);for(var Y in Q)Z[Y]=Q[Y];return Z};var NQ="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",K8="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",H8=K8+" Extended_Pictographic",z8=H8,G8=z8+" EBase EComp EMod EPres ExtPict",_8=G8,LQ=_8,AQ={9:K8,10:H8,11:z8,12:G8,13:_8,14:LQ},wQ="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",DQ={9:"",10:"",11:"",12:"",13:"",14:wQ},p1="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",q8="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",F8=q8+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",R8=F8+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",$8=R8+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",O8=$8+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",VQ=O8+" "+NQ,PQ={9:q8,10:F8,11:R8,12:$8,13:O8,14:VQ},U8={};function CQ(Q){var Z=U8[Q]={binary:O0(AQ[Q]+" "+p1),binaryOfStrings:O0(DQ[Q]),nonBinary:{General_Category:O0(p1),Script:O0(PQ[Q])}};Z.nonBinary.Script_Extensions=Z.nonBinary.Script,Z.nonBinary.gc=Z.nonBinary.General_Category,Z.nonBinary.sc=Z.nonBinary.Script,Z.nonBinary.scx=Z.nonBinary.Script_Extensions}for(b0=0,x0=[9,10,11,12,13,14];b0<x0.length;b0+=1)O1=x0[b0],CQ(O1);var O1,b0,x0,j=u.prototype,p0=function(Z,Y){this.parent=Z,this.base=Y||this};p0.prototype.separatedFrom=function(Z){for(var Y=this;Y;Y=Y.parent)for(var J=Z;J;J=J.parent)if(Y.base===J.base&&Y!==J)return!0;return!1};p0.prototype.sibling=function(){return new p0(this.parent,this.base)};var K0=function(Z){this.parser=Z,this.validFlags="gim"+(Z.options.ecmaVersion>=6?"uy":"")+(Z.options.ecmaVersion>=9?"s":"")+(Z.options.ecmaVersion>=13?"d":"")+(Z.options.ecmaVersion>=15?"v":""),this.unicodeProperties=U8[Z.options.ecmaVersion>=14?14:Z.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};K0.prototype.reset=function(Z,Y,J){var X=J.indexOf("v")!==-1,K=J.indexOf("u")!==-1;if(this.start=Z|0,this.source=Y+"",this.flags=J,X&&this.parser.options.ecmaVersion>=15)this.switchU=!0,this.switchV=!0,this.switchN=!0;else this.switchU=K&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=K&&this.parser.options.ecmaVersion>=9};K0.prototype.raise=function(Z){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+Z)};K0.prototype.at=function(Z,Y){if(Y===void 0)Y=!1;var J=this.source,X=J.length;if(Z>=X)return-1;var K=J.charCodeAt(Z);if(!(Y||this.switchU)||K<=55295||K>=57344||Z+1>=X)return K;var W=J.charCodeAt(Z+1);return W>=56320&&W<=57343?(K<<10)+W-56613888:K};K0.prototype.nextIndex=function(Z,Y){if(Y===void 0)Y=!1;var J=this.source,X=J.length;if(Z>=X)return X;var K=J.charCodeAt(Z),W;if(!(Y||this.switchU)||K<=55295||K>=57344||Z+1>=X||(W=J.charCodeAt(Z+1))<56320||W>57343)return Z+1;return Z+2};K0.prototype.current=function(Z){if(Z===void 0)Z=!1;return this.at(this.pos,Z)};K0.prototype.lookahead=function(Z){if(Z===void 0)Z=!1;return this.at(this.nextIndex(this.pos,Z),Z)};K0.prototype.advance=function(Z){if(Z===void 0)Z=!1;this.pos=this.nextIndex(this.pos,Z)};K0.prototype.eat=function(Z,Y){if(Y===void 0)Y=!1;if(this.current(Y)===Z)return this.advance(Y),!0;return!1};K0.prototype.eatChars=function(Z,Y){if(Y===void 0)Y=!1;var J=this.pos;for(var X=0,K=Z;X<K.length;X+=1){var W=K[X],H=this.at(J,Y);if(H===-1||H!==W)return!1;J=this.nextIndex(J,Y)}return this.pos=J,!0};j.validateRegExpFlags=function(Q){var{validFlags:Z,flags:Y}=Q,J=!1,X=!1;for(var K=0;K<Y.length;K++){var W=Y.charAt(K);if(Z.indexOf(W)===-1)this.raise(Q.start,"Invalid regular expression flag");if(Y.indexOf(W,K+1)>-1)this.raise(Q.start,"Duplicate regular expression flag");if(W==="u")J=!0;if(W==="v")X=!0}if(this.options.ecmaVersion>=15&&J&&X)this.raise(Q.start,"Invalid regular expression flag")};function bQ(Q){for(var Z in Q)return!0;return!1}j.validateRegExpPattern=function(Q){if(this.regexp_pattern(Q),!Q.switchN&&this.options.ecmaVersion>=9&&bQ(Q.groupNames))Q.switchN=!0,this.regexp_pattern(Q)};j.regexp_pattern=function(Q){if(Q.pos=0,Q.lastIntValue=0,Q.lastStringValue="",Q.lastAssertionIsQuantifiable=!1,Q.numCapturingParens=0,Q.maxBackReference=0,Q.groupNames=Object.create(null),Q.backReferenceNames.length=0,Q.branchID=null,this.regexp_disjunction(Q),Q.pos!==Q.source.length){if(Q.eat(41))Q.raise("Unmatched ')'");if(Q.eat(93)||Q.eat(125))Q.raise("Lone quantifier brackets")}if(Q.maxBackReference>Q.numCapturingParens)Q.raise("Invalid escape");for(var Z=0,Y=Q.backReferenceNames;Z<Y.length;Z+=1){var J=Y[Z];if(!Q.groupNames[J])Q.raise("Invalid named capture referenced")}};j.regexp_disjunction=function(Q){var Z=this.options.ecmaVersion>=16;if(Z)Q.branchID=new p0(Q.branchID,null);this.regexp_alternative(Q);while(Q.eat(124)){if(Z)Q.branchID=Q.branchID.sibling();this.regexp_alternative(Q)}if(Z)Q.branchID=Q.branchID.parent;if(this.regexp_eatQuantifier(Q,!0))Q.raise("Nothing to repeat");if(Q.eat(123))Q.raise("Lone quantifier brackets")};j.regexp_alternative=function(Q){while(Q.pos<Q.source.length&&this.regexp_eatTerm(Q));};j.regexp_eatTerm=function(Q){if(this.regexp_eatAssertion(Q)){if(Q.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(Q)){if(Q.switchU)Q.raise("Invalid quantifier")}return!0}if(Q.switchU?this.regexp_eatAtom(Q):this.regexp_eatExtendedAtom(Q))return this.regexp_eatQuantifier(Q),!0;return!1};j.regexp_eatAssertion=function(Q){var Z=Q.pos;if(Q.lastAssertionIsQuantifiable=!1,Q.eat(94)||Q.eat(36))return!0;if(Q.eat(92)){if(Q.eat(66)||Q.eat(98))return!0;Q.pos=Z}if(Q.eat(40)&&Q.eat(63)){var Y=!1;if(this.options.ecmaVersion>=9)Y=Q.eat(60);if(Q.eat(61)||Q.eat(33)){if(this.regexp_disjunction(Q),!Q.eat(41))Q.raise("Unterminated group");return Q.lastAssertionIsQuantifiable=!Y,!0}}return Q.pos=Z,!1};j.regexp_eatQuantifier=function(Q,Z){if(Z===void 0)Z=!1;if(this.regexp_eatQuantifierPrefix(Q,Z))return Q.eat(63),!0;return!1};j.regexp_eatQuantifierPrefix=function(Q,Z){return Q.eat(42)||Q.eat(43)||Q.eat(63)||this.regexp_eatBracedQuantifier(Q,Z)};j.regexp_eatBracedQuantifier=function(Q,Z){var Y=Q.pos;if(Q.eat(123)){var J=0,X=-1;if(this.regexp_eatDecimalDigits(Q)){if(J=Q.lastIntValue,Q.eat(44)&&this.regexp_eatDecimalDigits(Q))X=Q.lastIntValue;if(Q.eat(125)){if(X!==-1&&X<J&&!Z)Q.raise("numbers out of order in {} quantifier");return!0}}if(Q.switchU&&!Z)Q.raise("Incomplete quantifier");Q.pos=Y}return!1};j.regexp_eatAtom=function(Q){return this.regexp_eatPatternCharacters(Q)||Q.eat(46)||this.regexp_eatReverseSolidusAtomEscape(Q)||this.regexp_eatCharacterClass(Q)||this.regexp_eatUncapturingGroup(Q)||this.regexp_eatCapturingGroup(Q)};j.regexp_eatReverseSolidusAtomEscape=function(Q){var Z=Q.pos;if(Q.eat(92)){if(this.regexp_eatAtomEscape(Q))return!0;Q.pos=Z}return!1};j.regexp_eatUncapturingGroup=function(Q){var Z=Q.pos;if(Q.eat(40)){if(Q.eat(63)){if(this.options.ecmaVersion>=16){var Y=this.regexp_eatModifiers(Q),J=Q.eat(45);if(Y||J){for(var X=0;X<Y.length;X++){var K=Y.charAt(X);if(Y.indexOf(K,X+1)>-1)Q.raise("Duplicate regular expression modifiers")}if(J){var W=this.regexp_eatModifiers(Q);if(!Y&&!W&&Q.current()===58)Q.raise("Invalid regular expression modifiers");for(var H=0;H<W.length;H++){var G=W.charAt(H);if(W.indexOf(G,H+1)>-1||Y.indexOf(G)>-1)Q.raise("Duplicate regular expression modifiers")}}}}if(Q.eat(58)){if(this.regexp_disjunction(Q),Q.eat(41))return!0;Q.raise("Unterminated group")}}Q.pos=Z}return!1};j.regexp_eatCapturingGroup=function(Q){if(Q.eat(40)){if(this.options.ecmaVersion>=9)this.regexp_groupSpecifier(Q);else if(Q.current()===63)Q.raise("Invalid group");if(this.regexp_disjunction(Q),Q.eat(41))return Q.numCapturingParens+=1,!0;Q.raise("Unterminated group")}return!1};j.regexp_eatModifiers=function(Q){var Z="",Y=0;while((Y=Q.current())!==-1&&TQ(Y))Z+=_0(Y),Q.advance();return Z};function TQ(Q){return Q===105||Q===109||Q===115}j.regexp_eatExtendedAtom=function(Q){return Q.eat(46)||this.regexp_eatReverseSolidusAtomEscape(Q)||this.regexp_eatCharacterClass(Q)||this.regexp_eatUncapturingGroup(Q)||this.regexp_eatCapturingGroup(Q)||this.regexp_eatInvalidBracedQuantifier(Q)||this.regexp_eatExtendedPatternCharacter(Q)};j.regexp_eatInvalidBracedQuantifier=function(Q){if(this.regexp_eatBracedQuantifier(Q,!0))Q.raise("Nothing to repeat");return!1};j.regexp_eatSyntaxCharacter=function(Q){var Z=Q.current();if(M8(Z))return Q.lastIntValue=Z,Q.advance(),!0;return!1};function M8(Q){return Q===36||Q>=40&&Q<=43||Q===46||Q===63||Q>=91&&Q<=94||Q>=123&&Q<=125}j.regexp_eatPatternCharacters=function(Q){var Z=Q.pos,Y=0;while((Y=Q.current())!==-1&&!M8(Y))Q.advance();return Q.pos!==Z};j.regexp_eatExtendedPatternCharacter=function(Q){var Z=Q.current();if(Z!==-1&&Z!==36&&!(Z>=40&&Z<=43)&&Z!==46&&Z!==63&&Z!==91&&Z!==94&&Z!==124)return Q.advance(),!0;return!1};j.regexp_groupSpecifier=function(Q){if(Q.eat(63)){if(!this.regexp_eatGroupName(Q))Q.raise("Invalid group");var Z=this.options.ecmaVersion>=16,Y=Q.groupNames[Q.lastStringValue];if(Y)if(Z)for(var J=0,X=Y;J<X.length;J+=1){var K=X[J];if(!K.separatedFrom(Q.branchID))Q.raise("Duplicate capture group name")}else Q.raise("Duplicate capture group name");if(Z)(Y||(Q.groupNames[Q.lastStringValue]=[])).push(Q.branchID);else Q.groupNames[Q.lastStringValue]=!0}};j.regexp_eatGroupName=function(Q){if(Q.lastStringValue="",Q.eat(60)){if(this.regexp_eatRegExpIdentifierName(Q)&&Q.eat(62))return!0;Q.raise("Invalid capture group name")}return!1};j.regexp_eatRegExpIdentifierName=function(Q){if(Q.lastStringValue="",this.regexp_eatRegExpIdentifierStart(Q)){Q.lastStringValue+=_0(Q.lastIntValue);while(this.regexp_eatRegExpIdentifierPart(Q))Q.lastStringValue+=_0(Q.lastIntValue);return!0}return!1};j.regexp_eatRegExpIdentifierStart=function(Q){var Z=Q.pos,Y=this.options.ecmaVersion>=11,J=Q.current(Y);if(Q.advance(Y),J===92&&this.regexp_eatRegExpUnicodeEscapeSequence(Q,Y))J=Q.lastIntValue;if(SQ(J))return Q.lastIntValue=J,!0;return Q.pos=Z,!1};function SQ(Q){return X0(Q,!0)||Q===36||Q===95}j.regexp_eatRegExpIdentifierPart=function(Q){var Z=Q.pos,Y=this.options.ecmaVersion>=11,J=Q.current(Y);if(Q.advance(Y),J===92&&this.regexp_eatRegExpUnicodeEscapeSequence(Q,Y))J=Q.lastIntValue;if(EQ(J))return Q.lastIntValue=J,!0;return Q.pos=Z,!1};function EQ(Q){return U0(Q,!0)||Q===36||Q===95||Q===8204||Q===8205}j.regexp_eatAtomEscape=function(Q){if(this.regexp_eatBackReference(Q)||this.regexp_eatCharacterClassEscape(Q)||this.regexp_eatCharacterEscape(Q)||Q.switchN&&this.regexp_eatKGroupName(Q))return!0;if(Q.switchU){if(Q.current()===99)Q.raise("Invalid unicode escape");Q.raise("Invalid escape")}return!1};j.regexp_eatBackReference=function(Q){var Z=Q.pos;if(this.regexp_eatDecimalEscape(Q)){var Y=Q.lastIntValue;if(Q.switchU){if(Y>Q.maxBackReference)Q.maxBackReference=Y;return!0}if(Y<=Q.numCapturingParens)return!0;Q.pos=Z}return!1};j.regexp_eatKGroupName=function(Q){if(Q.eat(107)){if(this.regexp_eatGroupName(Q))return Q.backReferenceNames.push(Q.lastStringValue),!0;Q.raise("Invalid named reference")}return!1};j.regexp_eatCharacterEscape=function(Q){return this.regexp_eatControlEscape(Q)||this.regexp_eatCControlLetter(Q)||this.regexp_eatZero(Q)||this.regexp_eatHexEscapeSequence(Q)||this.regexp_eatRegExpUnicodeEscapeSequence(Q,!1)||!Q.switchU&&this.regexp_eatLegacyOctalEscapeSequence(Q)||this.regexp_eatIdentityEscape(Q)};j.regexp_eatCControlLetter=function(Q){var Z=Q.pos;if(Q.eat(99)){if(this.regexp_eatControlLetter(Q))return!0;Q.pos=Z}return!1};j.regexp_eatZero=function(Q){if(Q.current()===48&&!s0(Q.lookahead()))return Q.lastIntValue=0,Q.advance(),!0;return!1};j.regexp_eatControlEscape=function(Q){var Z=Q.current();if(Z===116)return Q.lastIntValue=9,Q.advance(),!0;if(Z===110)return Q.lastIntValue=10,Q.advance(),!0;if(Z===118)return Q.lastIntValue=11,Q.advance(),!0;if(Z===102)return Q.lastIntValue=12,Q.advance(),!0;if(Z===114)return Q.lastIntValue=13,Q.advance(),!0;return!1};j.regexp_eatControlLetter=function(Q){var Z=Q.current();if(I8(Z))return Q.lastIntValue=Z%32,Q.advance(),!0;return!1};function I8(Q){return Q>=65&&Q<=90||Q>=97&&Q<=122}j.regexp_eatRegExpUnicodeEscapeSequence=function(Q,Z){if(Z===void 0)Z=!1;var Y=Q.pos,J=Z||Q.switchU;if(Q.eat(117)){if(this.regexp_eatFixedHexDigits(Q,4)){var X=Q.lastIntValue;if(J&&X>=55296&&X<=56319){var K=Q.pos;if(Q.eat(92)&&Q.eat(117)&&this.regexp_eatFixedHexDigits(Q,4)){var W=Q.lastIntValue;if(W>=56320&&W<=57343)return Q.lastIntValue=(X-55296)*1024+(W-56320)+65536,!0}Q.pos=K,Q.lastIntValue=X}return!0}if(J&&Q.eat(123)&&this.regexp_eatHexDigits(Q)&&Q.eat(125)&&kQ(Q.lastIntValue))return!0;if(J)Q.raise("Invalid unicode escape");Q.pos=Y}return!1};function kQ(Q){return Q>=0&&Q<=1114111}j.regexp_eatIdentityEscape=function(Q){if(Q.switchU){if(this.regexp_eatSyntaxCharacter(Q))return!0;if(Q.eat(47))return Q.lastIntValue=47,!0;return!1}var Z=Q.current();if(Z!==99&&(!Q.switchN||Z!==107))return Q.lastIntValue=Z,Q.advance(),!0;return!1};j.regexp_eatDecimalEscape=function(Q){Q.lastIntValue=0;var Z=Q.current();if(Z>=49&&Z<=57){do Q.lastIntValue=10*Q.lastIntValue+(Z-48),Q.advance();while((Z=Q.current())>=48&&Z<=57);return!0}return!1};var B8=0,q0=1,e=2;j.regexp_eatCharacterClassEscape=function(Q){var Z=Q.current();if(vQ(Z))return Q.lastIntValue=-1,Q.advance(),q0;var Y=!1;if(Q.switchU&&this.options.ecmaVersion>=9&&((Y=Z===80)||Z===112)){Q.lastIntValue=-1,Q.advance();var J;if(Q.eat(123)&&(J=this.regexp_eatUnicodePropertyValueExpression(Q))&&Q.eat(125)){if(Y&&J===e)Q.raise("Invalid property name");return J}Q.raise("Invalid property name")}return B8};function vQ(Q){return Q===100||Q===68||Q===115||Q===83||Q===119||Q===87}j.regexp_eatUnicodePropertyValueExpression=function(Q){var Z=Q.pos;if(this.regexp_eatUnicodePropertyName(Q)&&Q.eat(61)){var Y=Q.lastStringValue;if(this.regexp_eatUnicodePropertyValue(Q)){var J=Q.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(Q,Y,J),q0}}if(Q.pos=Z,this.regexp_eatLoneUnicodePropertyNameOrValue(Q)){var X=Q.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(Q,X)}return B8};j.regexp_validateUnicodePropertyNameAndValue=function(Q,Z,Y){if(!V0(Q.unicodeProperties.nonBinary,Z))Q.raise("Invalid property name");if(!Q.unicodeProperties.nonBinary[Z].test(Y))Q.raise("Invalid property value")};j.regexp_validateUnicodePropertyNameOrValue=function(Q,Z){if(Q.unicodeProperties.binary.test(Z))return q0;if(Q.switchV&&Q.unicodeProperties.binaryOfStrings.test(Z))return e;Q.raise("Invalid property name")};j.regexp_eatUnicodePropertyName=function(Q){var Z=0;Q.lastStringValue="";while(j8(Z=Q.current()))Q.lastStringValue+=_0(Z),Q.advance();return Q.lastStringValue!==""};function j8(Q){return I8(Q)||Q===95}j.regexp_eatUnicodePropertyValue=function(Q){var Z=0;Q.lastStringValue="";while(yQ(Z=Q.current()))Q.lastStringValue+=_0(Z),Q.advance();return Q.lastStringValue!==""};function yQ(Q){return j8(Q)||s0(Q)}j.regexp_eatLoneUnicodePropertyNameOrValue=function(Q){return this.regexp_eatUnicodePropertyValue(Q)};j.regexp_eatCharacterClass=function(Q){if(Q.eat(91)){var Z=Q.eat(94),Y=this.regexp_classContents(Q);if(!Q.eat(93))Q.raise("Unterminated character class");if(Z&&Y===e)Q.raise("Negated character class may contain strings");return!0}return!1};j.regexp_classContents=function(Q){if(Q.current()===93)return q0;if(Q.switchV)return this.regexp_classSetExpression(Q);return this.regexp_nonEmptyClassRanges(Q),q0};j.regexp_nonEmptyClassRanges=function(Q){while(this.regexp_eatClassAtom(Q)){var Z=Q.lastIntValue;if(Q.eat(45)&&this.regexp_eatClassAtom(Q)){var Y=Q.lastIntValue;if(Q.switchU&&(Z===-1||Y===-1))Q.raise("Invalid character class");if(Z!==-1&&Y!==-1&&Z>Y)Q.raise("Range out of order in character class")}}};j.regexp_eatClassAtom=function(Q){var Z=Q.pos;if(Q.eat(92)){if(this.regexp_eatClassEscape(Q))return!0;if(Q.switchU){var Y=Q.current();if(Y===99||A8(Y))Q.raise("Invalid class escape");Q.raise("Invalid escape")}Q.pos=Z}var J=Q.current();if(J!==93)return Q.lastIntValue=J,Q.advance(),!0;return!1};j.regexp_eatClassEscape=function(Q){var Z=Q.pos;if(Q.eat(98))return Q.lastIntValue=8,!0;if(Q.switchU&&Q.eat(45))return Q.lastIntValue=45,!0;if(!Q.switchU&&Q.eat(99)){if(this.regexp_eatClassControlLetter(Q))return!0;Q.pos=Z}return this.regexp_eatCharacterClassEscape(Q)||this.regexp_eatCharacterEscape(Q)};j.regexp_classSetExpression=function(Q){var Z=q0,Y;if(this.regexp_eatClassSetRange(Q));else if(Y=this.regexp_eatClassSetOperand(Q)){if(Y===e)Z=e;var J=Q.pos;while(Q.eatChars([38,38])){if(Q.current()!==38&&(Y=this.regexp_eatClassSetOperand(Q))){if(Y!==e)Z=q0;continue}Q.raise("Invalid character in character class")}if(J!==Q.pos)return Z;while(Q.eatChars([45,45])){if(this.regexp_eatClassSetOperand(Q))continue;Q.raise("Invalid character in character class")}if(J!==Q.pos)return Z}else Q.raise("Invalid character in character class");for(;;){if(this.regexp_eatClassSetRange(Q))continue;if(Y=this.regexp_eatClassSetOperand(Q),!Y)return Z;if(Y===e)Z=e}};j.regexp_eatClassSetRange=function(Q){var Z=Q.pos;if(this.regexp_eatClassSetCharacter(Q)){var Y=Q.lastIntValue;if(Q.eat(45)&&this.regexp_eatClassSetCharacter(Q)){var J=Q.lastIntValue;if(Y!==-1&&J!==-1&&Y>J)Q.raise("Range out of order in character class");return!0}Q.pos=Z}return!1};j.regexp_eatClassSetOperand=function(Q){if(this.regexp_eatClassSetCharacter(Q))return q0;return this.regexp_eatClassStringDisjunction(Q)||this.regexp_eatNestedClass(Q)};j.regexp_eatNestedClass=function(Q){var Z=Q.pos;if(Q.eat(91)){var Y=Q.eat(94),J=this.regexp_classContents(Q);if(Q.eat(93)){if(Y&&J===e)Q.raise("Negated character class may contain strings");return J}Q.pos=Z}if(Q.eat(92)){var X=this.regexp_eatCharacterClassEscape(Q);if(X)return X;Q.pos=Z}return null};j.regexp_eatClassStringDisjunction=function(Q){var Z=Q.pos;if(Q.eatChars([92,113])){if(Q.eat(123)){var Y=this.regexp_classStringDisjunctionContents(Q);if(Q.eat(125))return Y}else Q.raise("Invalid escape");Q.pos=Z}return null};j.regexp_classStringDisjunctionContents=function(Q){var Z=this.regexp_classString(Q);while(Q.eat(124))if(this.regexp_classString(Q)===e)Z=e;return Z};j.regexp_classString=function(Q){var Z=0;while(this.regexp_eatClassSetCharacter(Q))Z++;return Z===1?q0:e};j.regexp_eatClassSetCharacter=function(Q){var Z=Q.pos;if(Q.eat(92)){if(this.regexp_eatCharacterEscape(Q)||this.regexp_eatClassSetReservedPunctuator(Q))return!0;if(Q.eat(98))return Q.lastIntValue=8,!0;return Q.pos=Z,!1}var Y=Q.current();if(Y<0||Y===Q.lookahead()&&gQ(Y))return!1;if(fQ(Y))return!1;return Q.advance(),Q.lastIntValue=Y,!0};function gQ(Q){return Q===33||Q>=35&&Q<=38||Q>=42&&Q<=44||Q===46||Q>=58&&Q<=64||Q===94||Q===96||Q===126}function fQ(Q){return Q===40||Q===41||Q===45||Q===47||Q>=91&&Q<=93||Q>=123&&Q<=125}j.regexp_eatClassSetReservedPunctuator=function(Q){var Z=Q.current();if(hQ(Z))return Q.lastIntValue=Z,Q.advance(),!0;return!1};function hQ(Q){return Q===33||Q===35||Q===37||Q===38||Q===44||Q===45||Q>=58&&Q<=62||Q===64||Q===96||Q===126}j.regexp_eatClassControlLetter=function(Q){var Z=Q.current();if(s0(Z)||Z===95)return Q.lastIntValue=Z%32,Q.advance(),!0;return!1};j.regexp_eatHexEscapeSequence=function(Q){var Z=Q.pos;if(Q.eat(120)){if(this.regexp_eatFixedHexDigits(Q,2))return!0;if(Q.switchU)Q.raise("Invalid escape");Q.pos=Z}return!1};j.regexp_eatDecimalDigits=function(Q){var Z=Q.pos,Y=0;Q.lastIntValue=0;while(s0(Y=Q.current()))Q.lastIntValue=10*Q.lastIntValue+(Y-48),Q.advance();return Q.pos!==Z};function s0(Q){return Q>=48&&Q<=57}j.regexp_eatHexDigits=function(Q){var Z=Q.pos,Y=0;Q.lastIntValue=0;while(N8(Y=Q.current()))Q.lastIntValue=16*Q.lastIntValue+L8(Y),Q.advance();return Q.pos!==Z};function N8(Q){return Q>=48&&Q<=57||Q>=65&&Q<=70||Q>=97&&Q<=102}function L8(Q){if(Q>=65&&Q<=70)return 10+(Q-65);if(Q>=97&&Q<=102)return 10+(Q-97);return Q-48}j.regexp_eatLegacyOctalEscapeSequence=function(Q){if(this.regexp_eatOctalDigit(Q)){var Z=Q.lastIntValue;if(this.regexp_eatOctalDigit(Q)){var Y=Q.lastIntValue;if(Z<=3&&this.regexp_eatOctalDigit(Q))Q.lastIntValue=Z*64+Y*8+Q.lastIntValue;else Q.lastIntValue=Z*8+Y}else Q.lastIntValue=Z;return!0}return!1};j.regexp_eatOctalDigit=function(Q){var Z=Q.current();if(A8(Z))return Q.lastIntValue=Z-48,Q.advance(),!0;return Q.lastIntValue=0,!1};function A8(Q){return Q>=48&&Q<=55}j.regexp_eatFixedHexDigits=function(Q,Z){var Y=Q.pos;Q.lastIntValue=0;for(var J=0;J<Z;++J){var X=Q.current();if(!N8(X))return Q.pos=Y,!1;Q.lastIntValue=16*Q.lastIntValue+L8(X),Q.advance()}return!0};var L1=function(Z){if(this.type=Z.type,this.value=Z.value,this.start=Z.start,this.end=Z.end,Z.options.locations)this.loc=new i0(Z,Z.startLoc,Z.endLoc);if(Z.options.ranges)this.range=[Z.start,Z.end]},C=u.prototype;C.next=function(Q){if(!Q&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new L1(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};C.getToken=function(){return this.next(),new L1(this)};if(typeof Symbol<"u")C[Symbol.iterator]=function(){var Q=this;return{next:function(){var Z=Q.getToken();return{done:Z.type===z.eof,value:Z}}}};C.nextToken=function(){var Q=this.curContext();if(!Q||!Q.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(z.eof);if(Q.override)return Q.override(this);else this.readToken(this.fullCharCodeAtPos())};C.readToken=function(Q){if(X0(Q,this.options.ecmaVersion>=6)||Q===92)return this.readWord();return this.getTokenFromCode(Q)};C.fullCharCodeAtPos=function(){var Q=this.input.charCodeAt(this.pos);if(Q<=55295||Q>=56320)return Q;var Z=this.input.charCodeAt(this.pos+1);return Z<=56319||Z>=57344?Q:(Q<<10)+Z-56613888};C.skipBlockComment=function(){var Q=this.options.onComment&&this.curPosition(),Z=this.pos,Y=this.input.indexOf("*/",this.pos+=2);if(Y===-1)this.raise(this.pos-2,"Unterminated comment");if(this.pos=Y+2,this.options.locations)for(var J=void 0,X=Z;(J=n1(this.input,X,this.pos))>-1;)++this.curLine,X=this.lineStart=J;if(this.options.onComment)this.options.onComment(!0,this.input.slice(Z+2,Y),Z,this.pos,Q,this.curPosition())};C.skipLineComment=function(Q){var Z=this.pos,Y=this.options.onComment&&this.curPosition(),J=this.input.charCodeAt(this.pos+=Q);while(this.pos<this.input.length&&!D0(J))J=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(Z+Q,this.pos),Z,this.pos,Y,this.curPosition())};C.skipSpace=function(){Q:while(this.pos<this.input.length){var Q=this.input.charCodeAt(this.pos);switch(Q){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10)++this.pos;case 10:case 8232:case 8233:if(++this.pos,this.options.locations)++this.curLine,this.lineStart=this.pos;break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break Q}break;default:if(Q>8&&Q<14||Q>=5760&&a1.test(String.fromCharCode(Q)))++this.pos;else break Q}}};C.finishToken=function(Q,Z){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Y=this.type;this.type=Q,this.value=Z,this.updateContext(Y)};C.readToken_dot=function(){var Q=this.input.charCodeAt(this.pos+1);if(Q>=48&&Q<=57)return this.readNumber(!0);var Z=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&Q===46&&Z===46)return this.pos+=3,this.finishToken(z.ellipsis);else return++this.pos,this.finishToken(z.dot)};C.readToken_slash=function(){var Q=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(Q===61)return this.finishOp(z.assign,2);return this.finishOp(z.slash,1)};C.readToken_mult_modulo_exp=function(Q){var Z=this.input.charCodeAt(this.pos+1),Y=1,J=Q===42?z.star:z.modulo;if(this.options.ecmaVersion>=7&&Q===42&&Z===42)++Y,J=z.starstar,Z=this.input.charCodeAt(this.pos+2);if(Z===61)return this.finishOp(z.assign,Y+1);return this.finishOp(J,Y)};C.readToken_pipe_amp=function(Q){var Z=this.input.charCodeAt(this.pos+1);if(Z===Q){if(this.options.ecmaVersion>=12){var Y=this.input.charCodeAt(this.pos+2);if(Y===61)return this.finishOp(z.assign,3)}return this.finishOp(Q===124?z.logicalOR:z.logicalAND,2)}if(Z===61)return this.finishOp(z.assign,2);return this.finishOp(Q===124?z.bitwiseOR:z.bitwiseAND,1)};C.readToken_caret=function(){var Q=this.input.charCodeAt(this.pos+1);if(Q===61)return this.finishOp(z.assign,2);return this.finishOp(z.bitwiseXOR,1)};C.readToken_plus_min=function(Q){var Z=this.input.charCodeAt(this.pos+1);if(Z===Q){if(Z===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||a.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(z.incDec,2)}if(Z===61)return this.finishOp(z.assign,2);return this.finishOp(z.plusMin,1)};C.readToken_lt_gt=function(Q){var Z=this.input.charCodeAt(this.pos+1),Y=1;if(Z===Q){if(Y=Q===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Y)===61)return this.finishOp(z.assign,Y+1);return this.finishOp(z.bitShift,Y)}if(Z===33&&Q===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45)return this.skipLineComment(4),this.skipSpace(),this.nextToken();if(Z===61)Y=2;return this.finishOp(z.relational,Y)};C.readToken_eq_excl=function(Q){var Z=this.input.charCodeAt(this.pos+1);if(Z===61)return this.finishOp(z.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(Q===61&&Z===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(z.arrow);return this.finishOp(Q===61?z.eq:z.prefix,1)};C.readToken_question=function(){var Q=this.options.ecmaVersion;if(Q>=11){var Z=this.input.charCodeAt(this.pos+1);if(Z===46){var Y=this.input.charCodeAt(this.pos+2);if(Y<48||Y>57)return this.finishOp(z.questionDot,2)}if(Z===63){if(Q>=12){var J=this.input.charCodeAt(this.pos+2);if(J===61)return this.finishOp(z.assign,3)}return this.finishOp(z.coalesce,2)}}return this.finishOp(z.question,1)};C.readToken_numberSign=function(){var Q=this.options.ecmaVersion,Z=35;if(Q>=13){if(++this.pos,Z=this.fullCharCodeAtPos(),X0(Z,!0)||Z===92)return this.finishToken(z.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+_0(Z)+"'")};C.getTokenFromCode=function(Q){switch(Q){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(z.parenL);case 41:return++this.pos,this.finishToken(z.parenR);case 59:return++this.pos,this.finishToken(z.semi);case 44:return++this.pos,this.finishToken(z.comma);case 91:return++this.pos,this.finishToken(z.bracketL);case 93:return++this.pos,this.finishToken(z.bracketR);case 123:return++this.pos,this.finishToken(z.braceL);case 125:return++this.pos,this.finishToken(z.braceR);case 58:return++this.pos,this.finishToken(z.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(z.backQuote);case 48:var Z=this.input.charCodeAt(this.pos+1);if(Z===120||Z===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(Z===111||Z===79)return this.readRadixNumber(8);if(Z===98||Z===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(Q);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(Q);case 124:case 38:return this.readToken_pipe_amp(Q);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(Q);case 60:case 62:return this.readToken_lt_gt(Q);case 61:case 33:return this.readToken_eq_excl(Q);case 63:return this.readToken_question();case 126:return this.finishOp(z.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+_0(Q)+"'")};C.finishOp=function(Q,Z){var Y=this.input.slice(this.pos,this.pos+Z);return this.pos+=Z,this.finishToken(Q,Y)};C.readRegexp=function(){var Q,Z,Y=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Y,"Unterminated regular expression");var J=this.input.charAt(this.pos);if(a.test(J))this.raise(Y,"Unterminated regular expression");if(!Q){if(J==="[")Z=!0;else if(J==="]"&&Z)Z=!1;else if(J==="/"&&!Z)break;Q=J==="\\"}else Q=!1;++this.pos}var X=this.input.slice(Y,this.pos);++this.pos;var K=this.pos,W=this.readWord1();if(this.containsEsc)this.unexpected(K);var H=this.regexpState||(this.regexpState=new K0(this));H.reset(Y,X,W),this.validateRegExpFlags(H),this.validateRegExpPattern(H);var G=null;try{G=new RegExp(X,W)}catch(_){}return this.finishToken(z.regexp,{pattern:X,flags:W,value:G})};C.readInt=function(Q,Z,Y){var J=this.options.ecmaVersion>=12&&Z===void 0,X=Y&&this.input.charCodeAt(this.pos)===48,K=this.pos,W=0,H=0;for(var G=0,_=Z==null?1/0:Z;G<_;++G,++this.pos){var F=this.input.charCodeAt(this.pos),O=void 0;if(J&&F===95){if(X)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(H===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(G===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");H=F;continue}if(F>=97)O=F-97+10;else if(F>=65)O=F-65+10;else if(F>=48&&F<=57)O=F-48;else O=1/0;if(O>=Q)break;H=F,W=W*Q+O}if(J&&H===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===K||Z!=null&&this.pos-K!==Z)return null;return W};function mQ(Q,Z){if(Z)return parseInt(Q,8);return parseFloat(Q.replace(/_/g,""))}function w8(Q){if(typeof BigInt!=="function")return null;return BigInt(Q.replace(/_/g,""))}C.readRadixNumber=function(Q){var Z=this.pos;this.pos+=2;var Y=this.readInt(Q);if(Y==null)this.raise(this.start+2,"Expected number in radix "+Q);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Y=w8(this.input.slice(Z,this.pos)),++this.pos;else if(X0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(z.num,Y)};C.readNumber=function(Q){var Z=this.pos;if(!Q&&this.readInt(10,void 0,!0)===null)this.raise(Z,"Invalid number");var Y=this.pos-Z>=2&&this.input.charCodeAt(Z)===48;if(Y&&this.strict)this.raise(Z,"Invalid number");var J=this.input.charCodeAt(this.pos);if(!Y&&!Q&&this.options.ecmaVersion>=11&&J===110){var X=w8(this.input.slice(Z,this.pos));if(++this.pos,X0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(z.num,X)}if(Y&&/[89]/.test(this.input.slice(Z,this.pos)))Y=!1;if(J===46&&!Y)++this.pos,this.readInt(10),J=this.input.charCodeAt(this.pos);if((J===69||J===101)&&!Y){if(J=this.input.charCodeAt(++this.pos),J===43||J===45)++this.pos;if(this.readInt(10)===null)this.raise(Z,"Invalid number")}if(X0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var K=mQ(this.input.slice(Z,this.pos),Y);return this.finishToken(z.num,K)};C.readCodePoint=function(){var Q=this.input.charCodeAt(this.pos),Z;if(Q===123){if(this.options.ecmaVersion<6)this.unexpected();var Y=++this.pos;if(Z=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,Z>1114111)this.invalidStringToken(Y,"Code point out of bounds")}else Z=this.readHexChar(4);return Z};C.readString=function(Q){var Z="",Y=++this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated string constant");var J=this.input.charCodeAt(this.pos);if(J===Q)break;if(J===92)Z+=this.input.slice(Y,this.pos),Z+=this.readEscapedChar(!1),Y=this.pos;else if(J===8232||J===8233){if(this.options.ecmaVersion<10)this.raise(this.start,"Unterminated string constant");if(++this.pos,this.options.locations)this.curLine++,this.lineStart=this.pos}else{if(D0(J))this.raise(this.start,"Unterminated string constant");++this.pos}}return Z+=this.input.slice(Y,this.pos++),this.finishToken(z.string,Z)};var D8={};C.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(Q){if(Q===D8)this.readInvalidTemplateToken();else throw Q}this.inTemplateElement=!1};C.invalidStringToken=function(Q,Z){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw D8;else this.raise(Q,Z)};C.readTmplToken=function(){var Q="",Z=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(this.start,"Unterminated template");var Y=this.input.charCodeAt(this.pos);if(Y===96||Y===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===z.template||this.type===z.invalidTemplate))if(Y===36)return this.pos+=2,this.finishToken(z.dollarBraceL);else return++this.pos,this.finishToken(z.backQuote);return Q+=this.input.slice(Z,this.pos),this.finishToken(z.template,Q)}if(Y===92)Q+=this.input.slice(Z,this.pos),Q+=this.readEscapedChar(!0),Z=this.pos;else if(D0(Y)){switch(Q+=this.input.slice(Z,this.pos),++this.pos,Y){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:Q+=`
7
7
  `;break;default:Q+=String.fromCharCode(Y);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;Z=this.pos}else++this.pos}};C.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(z.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
8
8
  `)++this.pos;case`
9
9
  `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};C.readEscapedChar=function(Q){var Z=this.input.charCodeAt(++this.pos);switch(++this.pos,Z){case 110:return`
10
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return _0(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(Q){var Y=this.pos-1;this.invalidStringToken(Y,"Invalid escape sequence in template string")}default:if(Z>=48&&Z<=55){var J=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],X=parseInt(J,8);if(X>255)J=J.slice(0,-1),X=parseInt(J,8);if(this.pos+=J.length-1,Z=this.input.charCodeAt(this.pos),(J!=="0"||Z===56||Z===57)&&(this.strict||Q))this.invalidStringToken(this.pos-1-J.length,Q?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(X)}if(D0(Z)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(Z)}};C.readHexChar=function(Q){var Z=this.pos,Y=this.readInt(16,Q);if(Y===null)this.invalidStringToken(Z,"Bad character escape sequence");return Y};C.readWord1=function(){this.containsEsc=!1;var Q="",Z=!0,Y=this.pos,J=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var X=this.fullCharCodeAtPos();if(O0(X,J))this.pos+=X<=65535?1:2;else if(X===92){this.containsEsc=!0,Q+=this.input.slice(Y,this.pos);var K=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var W=this.readCodePoint();if(!(Z?X0:O0)(W,J))this.invalidStringToken(K,"Invalid Unicode escape");Q+=_0(W),Y=this.pos}else break;Z=!1}return Q+this.input.slice(Y,this.pos)};C.readWord=function(){var Q=this.readWord1(),Z=z.name;if(this.keywords.test(Q))Z=U1[Q];return this.finishToken(Z,Q)};var xQ="8.15.0";u.acorn={Parser:u,version:xQ,defaultOptions:F1,Position:S0,SourceLocation:i0,getLineInfo:s1,Node:o0,TokenType:T,tokTypes:z,keywordTypes:U1,TokContext:J0,tokContexts:f,isIdentifierChar:O0,isIdentifierStart:X0,Token:L1,isNewLine:D0,lineBreak:a,lineBreakG:GQ,nonASCIIwhitespace:a1};function V8(Q,Z){return u.parse(Q,Z)}function P8(Q,Z,Y){return u.parseExpressionAt(Q,Z,Y)}class h extends Error{line;column;source;filename;constructor(Q,Z,Y,J){let X=`${J||"<source>"}:${Z.line}:${Z.column}`;super(`${Q} at ${X}`);this.name="TranspileError",this.line=Z.line,this.column=Z.column,this.source=Y,this.filename=J}}class M0 extends h{constructor(Q,Z,Y,J){super(Q,Z,Y,J);this.name="SyntaxError"}formatWithContext(Q=2){if(!this.source)return this.message;let Z=this.source.split(`
10
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return _0(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:if(this.options.locations)this.lineStart=this.pos,++this.curLine;return"";case 56:case 57:if(this.strict)this.invalidStringToken(this.pos-1,"Invalid escape sequence");if(Q){var Y=this.pos-1;this.invalidStringToken(Y,"Invalid escape sequence in template string")}default:if(Z>=48&&Z<=55){var J=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],X=parseInt(J,8);if(X>255)J=J.slice(0,-1),X=parseInt(J,8);if(this.pos+=J.length-1,Z=this.input.charCodeAt(this.pos),(J!=="0"||Z===56||Z===57)&&(this.strict||Q))this.invalidStringToken(this.pos-1-J.length,Q?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(X)}if(D0(Z)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(Z)}};C.readHexChar=function(Q){var Z=this.pos,Y=this.readInt(16,Q);if(Y===null)this.invalidStringToken(Z,"Bad character escape sequence");return Y};C.readWord1=function(){this.containsEsc=!1;var Q="",Z=!0,Y=this.pos,J=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var X=this.fullCharCodeAtPos();if(U0(X,J))this.pos+=X<=65535?1:2;else if(X===92){this.containsEsc=!0,Q+=this.input.slice(Y,this.pos);var K=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var W=this.readCodePoint();if(!(Z?X0:U0)(W,J))this.invalidStringToken(K,"Invalid Unicode escape");Q+=_0(W),Y=this.pos}else break;Z=!1}return Q+this.input.slice(Y,this.pos)};C.readWord=function(){var Q=this.readWord1(),Z=z.name;if(this.keywords.test(Q))Z=U1[Q];return this.finishToken(Z,Q)};var xQ="8.15.0";u.acorn={Parser:u,version:xQ,defaultOptions:F1,Position:S0,SourceLocation:i0,getLineInfo:s1,Node:o0,TokenType:T,tokTypes:z,keywordTypes:U1,TokContext:J0,tokContexts:f,isIdentifierChar:U0,isIdentifierStart:X0,Token:L1,isNewLine:D0,lineBreak:a,lineBreakG:GQ,nonASCIIwhitespace:a1};function V8(Q,Z){return u.parse(Q,Z)}function P8(Q,Z,Y){return u.parseExpressionAt(Q,Z,Y)}class h extends Error{line;column;source;filename;constructor(Q,Z,Y,J){let X=`${J||"<source>"}:${Z.line}:${Z.column}`;super(`${Q} at ${X}`);this.name="TranspileError",this.line=Z.line,this.column=Z.column,this.source=Y,this.filename=J}}class I0 extends h{constructor(Q,Z,Y,J){super(Q,Z,Y,J);this.name="SyntaxError"}formatWithContext(Q=2){if(!this.source)return this.message;let Z=this.source.split(`
11
11
  `),Y=this.line-1,J=Math.max(0,Y-Q),X=Math.min(Z.length-1,Y+Q),K=[],W=String(X+1).length;for(let H=J;H<=X;H++){let G=String(H+1).padStart(W),_=H===Y?">":" ";if(K.push(`${_} ${G} | ${Z[H]}`),H===Y){let F=" ".repeat(W+4+this.column);K.push(`${F}^ ${this.message.split(" at ")[0]}`)}}return K.join(`
12
- `)}}function Z0(Q){return{depth:Q.depth+1,locals:new Map,parent:Q,parameters:Q.parameters,atoms:Q.atoms,warnings:Q.warnings,source:Q.source,filename:Q.filename,options:Q.options}}function m(Q){if(Q.loc)return{line:Q.loc.start.line,column:Q.loc.start.column};return{line:1,column:0}}function A1(Q,Z){let Y="",J=0,X,K,W="normal",H=[],G=[{type:"top-level",braceDepth:0}],_=0,F=()=>G[G.length-1]?.type||"top-level",O=()=>{let R=G[G.length-1];return R?.type==="class-body"&&_===R.braceDepth+1};while(J<Q.length){let R=Q[J],$=Q[J+1];switch(W){case"single-string":if(Y+=R,R==="\\"&&J+1<Q.length){Y+=$,J+=2;continue}if(R==="'")W="normal";J++;continue;case"double-string":if(Y+=R,R==="\\"&&J+1<Q.length){Y+=$,J+=2;continue}if(R==='"')W="normal";J++;continue;case"template-string":if(Y+=R,R==="\\"&&J+1<Q.length){Y+=$,J+=2;continue}if(R==="$"&&$==="{"){Y+=$,J+=2,H.push(1),W="normal";continue}if(R==="`")W="normal";J++;continue;case"line-comment":if(Y+=R,R===`
13
- `)W="normal";J++;continue;case"block-comment":if(Y+=R,R==="*"&&$==="/"){Y+=$,J+=2,W="normal";continue}J++;continue;case"regex":if(Y+=R,R==="\\"&&J+1<Q.length){Y+=$,J+=2;continue}if(R==="["){J++;while(J<Q.length&&Q[J]!=="]")if(Y+=Q[J],Q[J]==="\\"&&J+1<Q.length)Y+=Q[J+1],J+=2;else J++;if(J<Q.length)Y+=Q[J],J++;continue}if(R==="/"){J++;while(J<Q.length&&/[gimsuy]/.test(Q[J]))Y+=Q[J],J++;W="normal";continue}J++;continue;case"normal":if(H.length>0){if(R==="{")H[H.length-1]++;else if(R==="}"){if(H[H.length-1]--,H[H.length-1]===0){H.pop(),Y+=R,J++,W="template-string";continue}}}if(R==="'"){Y+=R,J++,W="single-string";continue}if(R==='"'){Y+=R,J++,W="double-string";continue}if(R==="`"){Y+=R,J++,W="template-string";continue}if(R==="/"&&$==="/"){Y+=R+$,J+=2,W="line-comment";continue}if(R==="/"&&$==="*"){Y+=R+$,J+=2,W="block-comment";continue}if(R==="/"){let I=Y.trimEnd();if(!I[I.length-1]||/[=(!,;:{[&|?+\-*%<>~^]$/.test(I)||/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)\s*$/.test(I)){Y+=R,J++,W="regex";continue}}break}if(R==="{"){_++,Y+=R,J++;continue}if(R==="}"){_--;let I=G[G.length-1];if(I&&_===I.braceDepth)G.pop();Y+=R,J++;continue}let M=Q.slice(J).match(/^class\s+\w+(?:\s+extends\s+\w+)?\s*\{/);if(M){let I=M[0].slice(0,-1);Y+=I,J+=I.length,G.push({type:"class-body",braceDepth:_});continue}let L=Q.slice(J).match(/^function\s+(\w+)\s*\(/);if(L){let I=L[1],D=L[0].length,v=Q[J+D],P=null,E=J+D;if(v==="?"||v==="!")if(P=v,E++,P==="!")Z.unsafeFunctions.add(I);else Z.safeFunctions.add(I);Y+=`function ${I}(`,J=E;let S=t0(Q,J,"(",")");if(!S){Y+=Q[J],J++;continue}let{content:k,endPos:y}=S;J=y;let Y0=w1(k,Z,!0);Y+=Y0+")";let d=J;while(d<Q.length&&/\s/.test(Q[d]))d++;let L0=Q.slice(d,d+2);if(L0==="->"||L0==="-?"||L0==="-!"){d+=2;while(d<Q.length&&/\s/.test(Q[d]))d++;let V1=r0(Q,d);if(V1){let{type:c8,endPos:n8}=V1;if(X===void 0){if(X=c8,L0==="-?")K="safe";else if(L0==="-!")K="unsafe"}J=n8}}continue}let B=Q.slice(J).match(/^(constructor|(?:get|set)\s+\w+|async\s+\w+|\w+)\s*\(/);if(B&&O()){let I=B[1],D=B[0].length,v=J+D;Y+=I+"(",J=v;let P=t0(Q,J,"(",")");if(!P){Y+=Q[J],J++;continue}let{content:E,endPos:S}=P;J=S;let k=w1(E,Z,!0);Y+=k+")";let y=J;while(y<Q.length&&/\s/.test(Q[y]))y++;if(Q.slice(y,y+2)==="->"){y+=2;while(y<Q.length&&/\s/.test(Q[y]))y++;let d=r0(Q,y);if(d)J=d.endPos}else if(Q[y]===":"){y++;while(y<Q.length&&/\s/.test(Q[y]))y++;let d=r0(Q,y);if(d)J=d.endPos}continue}if(Q[J]==="("){let I=t0(Q,J+1,"(",")");if(!I){Y+=Q[J],J++;continue}let{content:D,endPos:v}=I,P=v;while(P<Q.length&&/\s/.test(Q[P]))P++;let E,S=Q.slice(P,P+2);if(S==="->"||S==="-?"||S==="-!"){P+=2;while(P<Q.length&&/\s/.test(Q[P]))P++;let k=r0(Q,P);if(k){E=k.type,P=k.endPos;while(P<Q.length&&/\s/.test(Q[P]))P++}}if(Q.slice(P,P+2)==="=>"){let k=null,y=D,Y0=D.trimStart();if(Y0.startsWith("?")&&(Y0.length===1||/\s/.test(Y0[1])))k="?",y=Y0.slice(1);else if(Y0.startsWith("!")&&(Y0.length===1||/\s/.test(Y0[1])))k="!",y=Y0.slice(1);let d=w1(y,Z,!1);Y+=`(${k==="?"?"/* safe */ ":k==="!"?"/* unsafe */ ":""}${d})`,J=v;while(J<P&&/\s/.test(Q[J]))Y+=Q[J],J++;if(E)J=P}else{let k=A1(D,Z);Y+=`(${k.source})`,J=v}continue}Y+=Q[J],J++}return{source:Y,returnType:X,returnSafety:K}}function t0(Q,Z,Y,J){let X=1,K=Z,W=!1,H="";while(K<Q.length&&X>0){let G=Q[K];if(!W&&(G==="'"||G==='"'||G==="`"))W=!0,H=G;else if(W&&G===H&&Q[K-1]!=="\\")W=!1;else if(!W){if(G===Y)X++;else if(G===J)X--}K++}if(X!==0)return null;return{content:Q.slice(Z,K-1),endPos:K}}function dQ(Q,Z){let Y=Z;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y>=Q.length)return null;let J=Y,X=Q[Y];if(X==="{"||X==="["){let W=X==="{"?"}":"]",H=t0(Q,Y+1,X,W);if(!H)return null;return{value:Q.slice(J,H.endPos),endPos:H.endPos}}if(X==="'"||X==='"'||X==="`"){Y++;while(Y<Q.length){if(Q[Y]===X&&Q[Y-1]!=="\\")return Y++,{value:Q.slice(J,Y),endPos:Y};Y++}return null}if(/[-+\d]/.test(X)){while(Y<Q.length&&/[\d.eE+-]/.test(Q[Y]))Y++;return{value:Q.slice(J,Y),endPos:Y}}let K=Q.slice(Y).match(/^(true|false|null|undefined)\b/);if(K)return{value:K[1],endPos:Y+K[1].length};return null}function y0(Q){return Q.replace(/(?<!\|)\|(?!\|)/g," || ")}function r0(Q,Z){let Y=Z,J=0,X=!1,K="",W=!1,H=(G)=>({type:y0(Q.slice(Z,G).trim()),endPos:G});while(Y<Q.length){let G=Q[Y];if(!X&&(G==="'"||G==='"'||G==="`")){X=!0,K=G,W=!0,Y++;continue}if(X){if(G===K&&Q[Y-1]!=="\\"){if(X=!1,Y++,J===0){let _=Y;while(_<Q.length&&/\s/.test(Q[_]))_++;if(Q[_]==="{"){if(!Q.slice(_+1).match(/^\s*(\w+)\s*:/))return H(Y)}if(Q[_]!=="|"&&Q[_]!=="&")return H(Y)}continue}Y++;continue}if(G==="{"||G==="["||G==="("){J++,W=!0,Y++;continue}if(G==="}"||G==="]"||G===")"){if(J--,J===0){Y++;let _=Y;while(_<Q.length&&/\s/.test(Q[_]))_++;if(Q[_]==="|"||Q[_]==="&")continue;return H(Y)}Y++;continue}if(J===0&&G==="{"){if(W)return H(Y);if(Q.slice(Y+1).match(/^\s*(\w+)\s*:/)){J++,W=!0,Y++;continue}return H(Y)}if(J===0&&(G==="|"||G==="&")){if(Y++,Y<Q.length&&Q[Y]==="|")Y++;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;continue}if(J===0&&(/\d/.test(G)||G==="-"&&/\d/.test(Q[Y+1]))){let _=Y;if(Q[_]==="-")_++;while(_<Q.length&&/\d/.test(Q[_]))_++;if(_<Q.length&&Q[_]==="."&&/\d/.test(Q[_+1])){_++;while(_<Q.length&&/\d/.test(Q[_]))_++}if(_<Q.length&&(Q[_]==="e"||Q[_]==="E")){if(_++,_<Q.length&&(Q[_]==="+"||Q[_]==="-"))_++;while(_<Q.length&&/\d/.test(Q[_]))_++}W=!0,Y=_;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y<Q.length&&Q[Y]==="{")return{type:y0(Q.slice(Z,_).trim()),endPos:_};if(Q[Y]!=="|"&&Q[Y]!=="&")return{type:y0(Q.slice(Z,_).trim()),endPos:_};continue}if(J===0&&/[a-zA-Z_]/.test(G)){let _=Y;while(_<Q.length&&/\w/.test(Q[_]))_++;W=!0,Y=_;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y<Q.length&&Q[Y]==="{"){if(!Q.slice(Y+1).match(/^\s*(\w+)\s*:/)){let O=_;while(O>Z&&/\s/.test(Q[O-1]))O--;return{type:y0(Q.slice(Z,O).trim()),endPos:_}}}if(Q[Y]!=="|"&&Q[Y]!=="&")return{type:y0(Q.slice(Z,_).trim()),endPos:_};continue}Y++}if(W)return H(Y);return null}function w1(Q,Z,Y){let J=A1(Q,{originalSource:Q,requiredParams:Z.requiredParams,unsafeFunctions:Z.unsafeFunctions,safeFunctions:Z.safeFunctions}).source,X=Z1(J),K=!1,W=new Set,H=(_)=>{if(Y&&/^\w+$/.test(_)){if(W.has(_))throw Error(`Duplicate parameter name '${_}'`);W.add(_)}};return X.map((_)=>{let F=_.trim();if(!F)return _;if(Y&&F.startsWith("{")&&F.endsWith("}")){let $=F.slice(1,-1);return`{ ${C8($,Z)} }`}if(Y&&F.startsWith("[")&&F.endsWith("]")){let $=F.slice(1,-1);return`[ ${C8($,Z)} ]`}let O=F.match(/^(\w+)\s*\?\s*:\s*(.+)$/);if(O){let[,$,M]=O;return H($),K=!0,`${$} = ${M}`}if(!lQ(F)){let $=F.match(/^(\w+)\s*=/);if($)H($[1]);return K=!0,_}let R=pQ(F);if(R!==-1){let $=F.slice(0,R).trim(),M=F.slice(R+1).trim();if(H($),K&&Y&&/^\w+$/.test($))throw Error(`Required parameter '${$}' cannot follow optional parameter`);if(Y&&/^\w+$/.test($))Z.requiredParams.add($);return`${$} = ${M}`}return _}).join(",")}function C8(Q,Z){return Z1(Q).map((X)=>{let K=X.trim();if(!K)return X;let W=K.match(/^(\w+)\s*:\s*(\{[\s\S]*\})$/);if(W){let[,_,F]=W;Z.requiredParams.add(_);let O=e0(F);return`${_} = ${O}`}let H=K.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(H){let[,_,F]=H;Z.requiredParams.add(_);let O=Q1(F);return`${_} = ${O}`}let G=K.match(/^(\w+)\s*:\s*([\s\S]+)$/);if(G){let[,_,F]=G;return Z.requiredParams.add(_),`${_} = ${F}`}return X}).join(", ")}function e0(Q){let Z=Q.slice(1,-1).trim();return`{ ${Z1(Z).map((X)=>{let K=X.trim();if(!K)return X;let W=K.match(/^(\w+)\s*:\s*(\{[\s\S]*\})$/);if(W){let[,O,R]=W;return`${O}: ${e0(R)}`}let H=K.match(/^(\w+)\s*=\s*(\{[\s\S]*\})$/);if(H){let[,O,R]=H;return`${O}: ${e0(R)}`}let G=K.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(G){let[,O,R]=G;return`${O}: ${Q1(R)}`}let _=K.match(/^(\w+)\s*=\s*(\[[\s\S]*\])$/);if(_){let[,O,R]=_;return`${O}: ${Q1(R)}`}let F=K.match(/^(\w+)\s*=\s*([\s\S]+)$/);if(F){let[,O,R]=F;return`${O}: ${R}`}return X}).join(", ")} }`}function Q1(Q){let Z=Q.slice(1,-1).trim();return`[ ${Z1(Z).map((X)=>{let K=X.trim();if(!K)return X;if(K.startsWith("{")&&K.endsWith("}"))return e0(K);if(K.startsWith("[")&&K.endsWith("]"))return Q1(K);return X}).join(", ")} ]`}function lQ(Q){let Z=0,Y=!1,J=!1,X=!1,K="";for(let W=0;W<Q.length;W++){let H=Q[W];if(!X&&(H==="'"||H==='"'||H==="`")){X=!0,K=H;continue}if(X){if(H===K&&Q[W-1]!=="\\")X=!1;continue}if(H==="("||H==="{"||H==="[")Z++;else if(H===")"||H==="}"||H==="]")Z--;else if(Z===0){if(H===":")Y=!0;if(H==="="&&Q[W+1]!==">")J=!0}}return Y&&!J}function pQ(Q){let Z=0,Y=!1,J="";for(let X=0;X<Q.length;X++){let K=Q[X];if(!Y&&(K==="'"||K==='"'||K==="`")){Y=!0,J=K;continue}if(Y){if(K===J&&Q[X-1]!=="\\")Y=!1;continue}if(K==="("||K==="{"||K==="[")Z++;else if(K===")"||K==="}"||K==="]")Z--;else if(Z===0&&K===":")return X}return-1}function iQ(Q,Z={}){let Y=Q,J,X=new Set,K=new Set,W=new Set,H={tjsEquals:!1,tjsClass:!1,tjsDate:!1,tjsNoeval:!1,tjsStandard:!1,tjsSafeEval:!1},G=Q.match(/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*safety\s+(none|inputs|all)\b/);if(G)J=G[2],Q=Q.replace(/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*safety\s+(none|inputs|all)\s*/,"$1");let _=/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*(TjsStrict|TjsEquals|TjsClass|TjsDate|TjsNoeval|TjsStandard|TjsSafeEval)\b/,F;while(F=Q.match(_)){let B=F[2];if(B==="TjsStrict")H.tjsEquals=!0,H.tjsClass=!0,H.tjsDate=!0,H.tjsNoeval=!0,H.tjsStandard=!0;else if(B==="TjsEquals")H.tjsEquals=!0;else if(B==="TjsClass")H.tjsClass=!0;else if(B==="TjsDate")H.tjsDate=!0;else if(B==="TjsNoeval")H.tjsNoeval=!0;else if(B==="TjsStandard")H.tjsStandard=!0;else if(B==="TjsSafeEval")H.tjsSafeEval=!0;Q=Q.replace(new RegExp(`^(\\s*(?:\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/\\s*)*)\\s*${B}\\s*`),"$1")}if(H.tjsStandard)Q=rQ(Q);if(Q=sQ(Q),H.tjsEquals&&!Z.vmTarget)Q=tQ(Q);Q=ZZ(Q),Q=YZ(Q),Q=JZ(Q),Q=XZ(Q),Q=KZ(Q);let{source:O,returnType:R,returnSafety:$}=A1(Q,{originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W});Q=O,Q=cQ(Q);let M=nQ(Q);Q=M.source;let L=HZ(Q,Z.dangerouslySkipTests);if(Q=L.source,H.tjsClass)Q=zZ(Q);if(H.tjsDate)Q=GZ(Q);if(H.tjsNoeval)Q=_Z(Q);return{source:Q,returnType:R,returnSafety:$,moduleSafety:J,tjsModes:H,originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W,wasmBlocks:M.blocks,tests:L.tests,testErrors:L.errors}}function cQ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\btry\s*\{/);if(J){let K=Y+J[0].length-1+1,W=1,H=K;while(H<Q.length&&W>0){let _=Q[H];if(_==="{")W++;else if(_==="}")W--;H++}if(W!==0){Z+=Q[Y],Y++;continue}if(Q.slice(H).match(/^\s*(catch|finally)\b/))Z+=Q.slice(Y,H),Y=H;else{let _=Q.slice(K,H-1);Z+=`try {${_}} catch (__try_err) { return { $error: true, message: __try_err?.message || String(__try_err), op: 'try', cause: __try_err, stack: globalThis.__tjs?.getStack?.() } }`,Y=H}}else Z+=Q[Y],Y++}return Z}function nQ(Q){let Z=[],Y="",J=0,X=0;while(J<Q.length){let K=Q.slice(J).match(/^\bwasm\s*\{/);if(K){let W=J,H=J+K[0].length,G=1,_=H;while(_<Q.length&&G>0){let S=Q[_];if(S==="{")G++;else if(S==="}")G--;_++}if(G!==0){Y+=Q[J],J++;continue}let F=Q.slice(H,_-1),O,R=_,$=Q.slice(_).match(/^\s*fallback\s*\{/);if($){let S=_+$[0].length;G=1;let k=S;while(k<Q.length&&G>0){let y=Q[k];if(y==="{")G++;else if(y==="}")G--;k++}if(G===0)O=Q.slice(S,k-1),R=k}let L=aQ(F).map((S)=>{let k=oQ(Q,W,S);return k?`${S}: ${k}`:S}),B={id:`__tjs_wasm_${X}`,body:F,fallback:O,captures:L,start:W,end:R};Z.push(B);let I=O??F,D=L.map((S)=>S.split(":")[0].trim()),v=D.length>0?D.join(", "):"",P=D.length>0?`globalThis.${B.id}(${v})`:`globalThis.${B.id}()`,E=`(globalThis.${B.id} ? ${P} : (() => {${I}})())`;Y+=E,J=R,X++}else Y+=Q[J],J++}return{source:Y,blocks:Z}}function aQ(Q){let Z=Q.replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,""),Y=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,J=new Set,X;while((X=Y.exec(Z))!==null)J.add(X[1]);let K=new Set,W=/\b(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=W.exec(Z))!==null)K.add(X[1]);let H=/\bfor\s*\(\s*(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=H.exec(Z))!==null)K.add(X[1]);let G=new Set(["if","else","for","while","do","switch","case","break","continue","return","function","let","const","var","new","this","true","false","null","undefined","typeof","instanceof","in","of","try","catch","finally","throw","async","await","class","extends","super","import","export","default","from","as","static","get","set","yield","console","Math","Array","Object","String","Number","Boolean","Date","JSON","Promise","Map","Set","WeakMap","WeakSet","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","ArrayBuffer","DataView","Error","TypeError","RangeError","length","push","pop","shift","unshift","slice","splice","map","filter","reduce","forEach","find","findIndex","indexOf","includes","globalThis","window","document","Infinity","NaN","isNaN","isFinite","parseInt","parseFloat","encodeURI","decodeURI","eval"]),_=[];for(let F of J)if(!K.has(F)&&!G.has(F))_.push(F);return _.sort()}function oQ(Q,Z,Y){let J=Q.slice(0,Z),X=/function\s+\w+\s*\(([^)]*)\)\s*(?:->.*?)?\s*\{[^}]*$/,K=J.match(X);if(!K){let W=/(?:const|let|var)?\s*\w+\s*=\s*(?:async\s*)?\(([^)]*)\)\s*(?:=>|->)?\s*\{[^}]*$/,H=J.match(W);if(!H)return;return b8(H[1],Y)}return b8(K[1],Y)}function b8(Q,Z){let Y=Q.split(",").map((J)=>J.trim());for(let J of Y){let X=J.match(new RegExp(`^${Z}\\s*:\\s*([A-Za-z][A-Za-z0-9]*)`));if(X)return X[1];let K=J.match(new RegExp(`^${Z}\\s*=\\s*(Float32Array|Float64Array|Int32Array|Uint8Array|Int8Array|Int16Array|Uint16Array|Uint32Array)`));if(K)return K[1]}return}function Z1(Q){let Z=[],Y="",J=0,X=!1,K=!1,W=0;while(W<Q.length){let H=Q[W],G=Q[W+1];if(!K&&H==="/"&&G==="/"){X=!0,Y+="//",W+=2;continue}if(!X&&H==="/"&&G==="*"){K=!0,Y+="/*",W+=2;continue}if(X&&H===`
12
+ `)}}function Z0(Q){return{depth:Q.depth+1,locals:new Map,parent:Q,parameters:Q.parameters,atoms:Q.atoms,warnings:Q.warnings,source:Q.source,filename:Q.filename,options:Q.options}}function m(Q){if(Q.loc)return{line:Q.loc.start.line,column:Q.loc.start.column};return{line:1,column:0}}function w1(Q,Z){let Y="",J=0,X,K,W="normal",H=[],G=[{type:"top-level",braceDepth:0}],_=0,F=()=>G[G.length-1]?.type||"top-level",O=()=>{let R=G[G.length-1];return R?.type==="class-body"&&_===R.braceDepth+1};while(J<Q.length){let R=Q[J],$=Q[J+1];switch(W){case"single-string":if(Y+=R,R==="\\"&&J+1<Q.length){Y+=$,J+=2;continue}if(R==="'")W="normal";J++;continue;case"double-string":if(Y+=R,R==="\\"&&J+1<Q.length){Y+=$,J+=2;continue}if(R==='"')W="normal";J++;continue;case"template-string":if(Y+=R,R==="\\"&&J+1<Q.length){Y+=$,J+=2;continue}if(R==="$"&&$==="{"){Y+=$,J+=2,H.push(1),W="normal";continue}if(R==="`")W="normal";J++;continue;case"line-comment":if(Y+=R,R===`
13
+ `)W="normal";J++;continue;case"block-comment":if(Y+=R,R==="*"&&$==="/"){Y+=$,J+=2,W="normal";continue}J++;continue;case"regex":if(Y+=R,R==="\\"&&J+1<Q.length){Y+=$,J+=2;continue}if(R==="["){J++;while(J<Q.length&&Q[J]!=="]")if(Y+=Q[J],Q[J]==="\\"&&J+1<Q.length)Y+=Q[J+1],J+=2;else J++;if(J<Q.length)Y+=Q[J],J++;continue}if(R==="/"){J++;while(J<Q.length&&/[gimsuy]/.test(Q[J]))Y+=Q[J],J++;W="normal";continue}J++;continue;case"normal":if(H.length>0){if(R==="{")H[H.length-1]++;else if(R==="}"){if(H[H.length-1]--,H[H.length-1]===0){H.pop(),Y+=R,J++,W="template-string";continue}}}if(R==="'"){Y+=R,J++,W="single-string";continue}if(R==='"'){Y+=R,J++,W="double-string";continue}if(R==="`"){Y+=R,J++,W="template-string";continue}if(R==="/"&&$==="/"){Y+=R+$,J+=2,W="line-comment";continue}if(R==="/"&&$==="*"){Y+=R+$,J+=2,W="block-comment";continue}if(R==="/"){let I=Y.trimEnd();if(!I[I.length-1]||/[=(!,;:{[&|?+\-*%<>~^]$/.test(I)||/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)\s*$/.test(I)){Y+=R,J++,W="regex";continue}}break}if(R==="{"){_++,Y+=R,J++;continue}if(R==="}"){_--;let I=G[G.length-1];if(I&&_===I.braceDepth)G.pop();Y+=R,J++;continue}let M=Q.slice(J).match(/^class\s+\w+(?:\s+extends\s+\w+)?\s*\{/);if(M){let I=M[0].slice(0,-1);Y+=I,J+=I.length,G.push({type:"class-body",braceDepth:_});continue}let L=Q.slice(J).match(/^function\s+(\w+)\s*\(/);if(L){let I=L[1],V=L[0].length,v=Q[J+V],P=null,E=J+V;if(v==="?"||v==="!")if(P=v,E++,P==="!")Z.unsafeFunctions.add(I);else Z.safeFunctions.add(I);Y+=`function ${I}(`,J=E;let S=t0(Q,J,"(",")");if(!S){Y+=Q[J],J++;continue}let{content:k,endPos:y}=S;J=y;let Y0=A1(k,Z,!0);Y+=Y0+")";let d=J;while(d<Q.length&&/\s/.test(Q[d]))d++;let L0=Q.slice(d,d+2);if(L0==="->"||L0==="-?"||L0==="-!"){d+=2;while(d<Q.length&&/\s/.test(Q[d]))d++;let V1=r0(Q,d);if(V1){let{type:c8,endPos:n8}=V1;if(X===void 0){if(X=c8,L0==="-?")K="safe";else if(L0==="-!")K="unsafe"}J=n8}}continue}let B=Q.slice(J).match(/^(constructor|(?:get|set)\s+\w+|async\s+\w+|\w+)\s*\(/);if(B&&O()){let I=B[1],V=B[0].length,v=J+V;Y+=I+"(",J=v;let P=t0(Q,J,"(",")");if(!P){Y+=Q[J],J++;continue}let{content:E,endPos:S}=P;J=S;let k=A1(E,Z,!0);Y+=k+")";let y=J;while(y<Q.length&&/\s/.test(Q[y]))y++;if(Q.slice(y,y+2)==="->"){y+=2;while(y<Q.length&&/\s/.test(Q[y]))y++;let d=r0(Q,y);if(d)J=d.endPos}else if(Q[y]===":"){y++;while(y<Q.length&&/\s/.test(Q[y]))y++;let d=r0(Q,y);if(d)J=d.endPos}continue}if(Q[J]==="("){let I=t0(Q,J+1,"(",")");if(!I){Y+=Q[J],J++;continue}let{content:V,endPos:v}=I,P=v;while(P<Q.length&&/\s/.test(Q[P]))P++;let E,S=Q.slice(P,P+2);if(S==="->"||S==="-?"||S==="-!"){P+=2;while(P<Q.length&&/\s/.test(Q[P]))P++;let k=r0(Q,P);if(k){E=k.type,P=k.endPos;while(P<Q.length&&/\s/.test(Q[P]))P++}}if(Q.slice(P,P+2)==="=>"){let k=null,y=V,Y0=V.trimStart();if(Y0.startsWith("?")&&(Y0.length===1||/\s/.test(Y0[1])))k="?",y=Y0.slice(1);else if(Y0.startsWith("!")&&(Y0.length===1||/\s/.test(Y0[1])))k="!",y=Y0.slice(1);let d=A1(y,Z,!1);Y+=`(${k==="?"?"/* safe */ ":k==="!"?"/* unsafe */ ":""}${d})`,J=v;while(J<P&&/\s/.test(Q[J]))Y+=Q[J],J++;if(E)J=P}else{let k=w1(V,Z);Y+=`(${k.source})`,J=v}continue}Y+=Q[J],J++}return{source:Y,returnType:X,returnSafety:K}}function t0(Q,Z,Y,J){let X=1,K=Z,W=!1,H="";while(K<Q.length&&X>0){let G=Q[K];if(!W&&(G==="'"||G==='"'||G==="`"))W=!0,H=G;else if(W&&G===H&&Q[K-1]!=="\\")W=!1;else if(!W){if(G===Y)X++;else if(G===J)X--}K++}if(X!==0)return null;return{content:Q.slice(Z,K-1),endPos:K}}function dQ(Q,Z){let Y=Z;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y>=Q.length)return null;let J=Y,X=Q[Y];if(X==="{"||X==="["){let W=X==="{"?"}":"]",H=t0(Q,Y+1,X,W);if(!H)return null;return{value:Q.slice(J,H.endPos),endPos:H.endPos}}if(X==="'"||X==='"'||X==="`"){Y++;while(Y<Q.length){if(Q[Y]===X&&Q[Y-1]!=="\\")return Y++,{value:Q.slice(J,Y),endPos:Y};Y++}return null}if(/[-+\d]/.test(X)){while(Y<Q.length&&/[\d.eE+-]/.test(Q[Y]))Y++;return{value:Q.slice(J,Y),endPos:Y}}let K=Q.slice(Y).match(/^(true|false|null|undefined)\b/);if(K)return{value:K[1],endPos:Y+K[1].length};return null}function y0(Q){return Q.replace(/(?<!\|)\|(?!\|)/g," || ")}function r0(Q,Z){let Y=Z,J=0,X=!1,K="",W=!1,H=(G)=>({type:y0(Q.slice(Z,G).trim()),endPos:G});while(Y<Q.length){let G=Q[Y];if(!X&&(G==="'"||G==='"'||G==="`")){X=!0,K=G,W=!0,Y++;continue}if(X){if(G===K&&Q[Y-1]!=="\\"){if(X=!1,Y++,J===0){let _=Y;while(_<Q.length&&/\s/.test(Q[_]))_++;if(Q[_]==="{"){if(!Q.slice(_+1).match(/^\s*(\w+)\s*:/))return H(Y)}if(Q[_]!=="|"&&Q[_]!=="&")return H(Y)}continue}Y++;continue}if(G==="{"||G==="["||G==="("){J++,W=!0,Y++;continue}if(G==="}"||G==="]"||G===")"){if(J--,J===0){Y++;let _=Y;while(_<Q.length&&/\s/.test(Q[_]))_++;if(Q[_]==="|"||Q[_]==="&")continue;return H(Y)}Y++;continue}if(J===0&&G==="{"){if(W)return H(Y);if(Q.slice(Y+1).match(/^\s*(\w+)\s*:/)){J++,W=!0,Y++;continue}return H(Y)}if(J===0&&(G==="|"||G==="&")){if(Y++,Y<Q.length&&Q[Y]==="|")Y++;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;continue}if(J===0&&(/\d/.test(G)||G==="-"&&/\d/.test(Q[Y+1]))){let _=Y;if(Q[_]==="-")_++;while(_<Q.length&&/\d/.test(Q[_]))_++;if(_<Q.length&&Q[_]==="."&&/\d/.test(Q[_+1])){_++;while(_<Q.length&&/\d/.test(Q[_]))_++}if(_<Q.length&&(Q[_]==="e"||Q[_]==="E")){if(_++,_<Q.length&&(Q[_]==="+"||Q[_]==="-"))_++;while(_<Q.length&&/\d/.test(Q[_]))_++}W=!0,Y=_;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y<Q.length&&Q[Y]==="{")return{type:y0(Q.slice(Z,_).trim()),endPos:_};if(Q[Y]!=="|"&&Q[Y]!=="&")return{type:y0(Q.slice(Z,_).trim()),endPos:_};continue}if(J===0&&/[a-zA-Z_]/.test(G)){let _=Y;while(_<Q.length&&/\w/.test(Q[_]))_++;W=!0,Y=_;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y<Q.length&&Q[Y]==="{"){if(!Q.slice(Y+1).match(/^\s*(\w+)\s*:/)){let O=_;while(O>Z&&/\s/.test(Q[O-1]))O--;return{type:y0(Q.slice(Z,O).trim()),endPos:_}}}if(Q[Y]!=="|"&&Q[Y]!=="&")return{type:y0(Q.slice(Z,_).trim()),endPos:_};continue}Y++}if(W)return H(Y);return null}function A1(Q,Z,Y){let J=w1(Q,{originalSource:Q,requiredParams:Z.requiredParams,unsafeFunctions:Z.unsafeFunctions,safeFunctions:Z.safeFunctions}).source,X=Z1(J),K=!1,W=new Set,H=(_)=>{if(Y&&/^\w+$/.test(_)){if(W.has(_))throw Error(`Duplicate parameter name '${_}'`);W.add(_)}};return X.map((_)=>{let F=_.trim();if(!F)return _;if(Y&&F.startsWith("{")&&F.endsWith("}")){let $=F.slice(1,-1);return`{ ${C8($,Z)} }`}if(Y&&F.startsWith("[")&&F.endsWith("]")){let $=F.slice(1,-1);return`[ ${C8($,Z)} ]`}let O=F.match(/^(\w+)\s*\?\s*:\s*(.+)$/);if(O){let[,$,M]=O;return H($),K=!0,`${$} = ${M}`}if(!lQ(F)){let $=F.match(/^(\w+)\s*=/);if($)H($[1]);return K=!0,_}let R=pQ(F);if(R!==-1){let $=F.slice(0,R).trim(),M=F.slice(R+1).trim();if(H($),K&&Y&&/^\w+$/.test($))throw Error(`Required parameter '${$}' cannot follow optional parameter`);if(Y&&/^\w+$/.test($))Z.requiredParams.add($);return`${$} = ${M}`}return _}).join(",")}function C8(Q,Z){return Z1(Q).map((X)=>{let K=X.trim();if(!K)return X;let W=K.match(/^(\w+)\s*:\s*(\{[\s\S]*\})$/);if(W){let[,_,F]=W;Z.requiredParams.add(_);let O=e0(F);return`${_} = ${O}`}let H=K.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(H){let[,_,F]=H;Z.requiredParams.add(_);let O=Q1(F);return`${_} = ${O}`}let G=K.match(/^(\w+)\s*:\s*([\s\S]+)$/);if(G){let[,_,F]=G;return Z.requiredParams.add(_),`${_} = ${F}`}return X}).join(", ")}function e0(Q){let Z=Q.slice(1,-1).trim();return`{ ${Z1(Z).map((X)=>{let K=X.trim();if(!K)return X;let W=K.match(/^(\w+)\s*:\s*(\{[\s\S]*\})$/);if(W){let[,O,R]=W;return`${O}: ${e0(R)}`}let H=K.match(/^(\w+)\s*=\s*(\{[\s\S]*\})$/);if(H){let[,O,R]=H;return`${O}: ${e0(R)}`}let G=K.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(G){let[,O,R]=G;return`${O}: ${Q1(R)}`}let _=K.match(/^(\w+)\s*=\s*(\[[\s\S]*\])$/);if(_){let[,O,R]=_;return`${O}: ${Q1(R)}`}let F=K.match(/^(\w+)\s*=\s*([\s\S]+)$/);if(F){let[,O,R]=F;return`${O}: ${R}`}return X}).join(", ")} }`}function Q1(Q){let Z=Q.slice(1,-1).trim();return`[ ${Z1(Z).map((X)=>{let K=X.trim();if(!K)return X;if(K.startsWith("{")&&K.endsWith("}"))return e0(K);if(K.startsWith("[")&&K.endsWith("]"))return Q1(K);return X}).join(", ")} ]`}function lQ(Q){let Z=0,Y=!1,J=!1,X=!1,K="";for(let W=0;W<Q.length;W++){let H=Q[W];if(!X&&(H==="'"||H==='"'||H==="`")){X=!0,K=H;continue}if(X){if(H===K&&Q[W-1]!=="\\")X=!1;continue}if(H==="("||H==="{"||H==="[")Z++;else if(H===")"||H==="}"||H==="]")Z--;else if(Z===0){if(H===":")Y=!0;if(H==="="&&Q[W+1]!==">")J=!0}}return Y&&!J}function pQ(Q){let Z=0,Y=!1,J="";for(let X=0;X<Q.length;X++){let K=Q[X];if(!Y&&(K==="'"||K==='"'||K==="`")){Y=!0,J=K;continue}if(Y){if(K===J&&Q[X-1]!=="\\")Y=!1;continue}if(K==="("||K==="{"||K==="[")Z++;else if(K===")"||K==="}"||K==="]")Z--;else if(Z===0&&K===":")return X}return-1}function iQ(Q,Z={}){let Y=Q,J,X=new Set,K=new Set,W=new Set,H={tjsEquals:!1,tjsClass:!1,tjsDate:!1,tjsNoeval:!1,tjsStandard:!1,tjsSafeEval:!1},G=Q.match(/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*safety\s+(none|inputs|all)\b/);if(G)J=G[2],Q=Q.replace(/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*safety\s+(none|inputs|all)\s*/,"$1");let _=/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*(TjsStrict|TjsEquals|TjsClass|TjsDate|TjsNoeval|TjsStandard|TjsSafeEval)\b/,F;while(F=Q.match(_)){let B=F[2];if(B==="TjsStrict")H.tjsEquals=!0,H.tjsClass=!0,H.tjsDate=!0,H.tjsNoeval=!0,H.tjsStandard=!0;else if(B==="TjsEquals")H.tjsEquals=!0;else if(B==="TjsClass")H.tjsClass=!0;else if(B==="TjsDate")H.tjsDate=!0;else if(B==="TjsNoeval")H.tjsNoeval=!0;else if(B==="TjsStandard")H.tjsStandard=!0;else if(B==="TjsSafeEval")H.tjsSafeEval=!0;Q=Q.replace(new RegExp(`^(\\s*(?:\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/\\s*)*)\\s*${B}\\s*`),"$1")}if(H.tjsStandard)Q=rQ(Q);if(Q=sQ(Q),H.tjsEquals&&!Z.vmTarget)Q=tQ(Q);Q=ZZ(Q),Q=YZ(Q),Q=JZ(Q),Q=XZ(Q),Q=KZ(Q);let{source:O,returnType:R,returnSafety:$}=w1(Q,{originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W});Q=O,Q=cQ(Q);let M=nQ(Q);Q=M.source;let L=HZ(Q,Z.dangerouslySkipTests);if(Q=L.source,H.tjsClass)Q=zZ(Q);if(H.tjsDate)Q=GZ(Q);if(H.tjsNoeval)Q=_Z(Q);return{source:Q,returnType:R,returnSafety:$,moduleSafety:J,tjsModes:H,originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W,wasmBlocks:M.blocks,tests:L.tests,testErrors:L.errors}}function cQ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\btry\s*\{/);if(J){let K=Y+J[0].length-1+1,W=1,H=K;while(H<Q.length&&W>0){let _=Q[H];if(_==="{")W++;else if(_==="}")W--;H++}if(W!==0){Z+=Q[Y],Y++;continue}if(Q.slice(H).match(/^\s*(catch|finally)\b/))Z+=Q.slice(Y,H),Y=H;else{let _=Q.slice(K,H-1);Z+=`try {${_}} catch (__try_err) { return { $error: true, message: __try_err?.message || String(__try_err), op: 'try', cause: __try_err, stack: globalThis.__tjs?.getStack?.() } }`,Y=H}}else Z+=Q[Y],Y++}return Z}function nQ(Q){let Z=[],Y="",J=0,X=0;while(J<Q.length){let K=Q.slice(J).match(/^\bwasm\s*\{/);if(K){let W=J,H=J+K[0].length,G=1,_=H;while(_<Q.length&&G>0){let S=Q[_];if(S==="{")G++;else if(S==="}")G--;_++}if(G!==0){Y+=Q[J],J++;continue}let F=Q.slice(H,_-1),O,R=_,$=Q.slice(_).match(/^\s*fallback\s*\{/);if($){let S=_+$[0].length;G=1;let k=S;while(k<Q.length&&G>0){let y=Q[k];if(y==="{")G++;else if(y==="}")G--;k++}if(G===0)O=Q.slice(S,k-1),R=k}let L=aQ(F).map((S)=>{let k=oQ(Q,W,S);return k?`${S}: ${k}`:S}),B={id:`__tjs_wasm_${X}`,body:F,fallback:O,captures:L,start:W,end:R};Z.push(B);let I=O??F,V=L.map((S)=>S.split(":")[0].trim()),v=V.length>0?V.join(", "):"",P=V.length>0?`globalThis.${B.id}(${v})`:`globalThis.${B.id}()`,E=`(globalThis.${B.id} ? ${P} : (() => {${I}})())`;Y+=E,J=R,X++}else Y+=Q[J],J++}return{source:Y,blocks:Z}}function aQ(Q){let Z=Q.replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,""),Y=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,J=new Set,X;while((X=Y.exec(Z))!==null)J.add(X[1]);let K=new Set,W=/\b(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=W.exec(Z))!==null)K.add(X[1]);let H=/\bfor\s*\(\s*(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=H.exec(Z))!==null)K.add(X[1]);let G=new Set(["if","else","for","while","do","switch","case","break","continue","return","function","let","const","var","new","this","true","false","null","undefined","typeof","instanceof","in","of","try","catch","finally","throw","async","await","class","extends","super","import","export","default","from","as","static","get","set","yield","console","Math","Array","Object","String","Number","Boolean","Date","JSON","Promise","Map","Set","WeakMap","WeakSet","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","ArrayBuffer","DataView","Error","TypeError","RangeError","length","push","pop","shift","unshift","slice","splice","map","filter","reduce","forEach","find","findIndex","indexOf","includes","globalThis","window","document","Infinity","NaN","isNaN","isFinite","parseInt","parseFloat","encodeURI","decodeURI","eval"]),_=[];for(let F of J)if(!K.has(F)&&!G.has(F))_.push(F);return _.sort()}function oQ(Q,Z,Y){let J=Q.slice(0,Z),X=/function\s+\w+\s*\(([^)]*)\)\s*(?:->.*?)?\s*\{[^}]*$/,K=J.match(X);if(!K){let W=/(?:const|let|var)?\s*\w+\s*=\s*(?:async\s*)?\(([^)]*)\)\s*(?:=>|->)?\s*\{[^}]*$/,H=J.match(W);if(!H)return;return b8(H[1],Y)}return b8(K[1],Y)}function b8(Q,Z){let Y=Q.split(",").map((J)=>J.trim());for(let J of Y){let X=J.match(new RegExp(`^${Z}\\s*:\\s*([A-Za-z][A-Za-z0-9]*)`));if(X)return X[1];let K=J.match(new RegExp(`^${Z}\\s*=\\s*(Float32Array|Float64Array|Int32Array|Uint8Array|Int8Array|Int16Array|Uint16Array|Uint32Array)`));if(K)return K[1]}return}function Z1(Q){let Z=[],Y="",J=0,X=!1,K=!1,W=0;while(W<Q.length){let H=Q[W],G=Q[W+1];if(!K&&H==="/"&&G==="/"){X=!0,Y+="//",W+=2;continue}if(!X&&H==="/"&&G==="*"){K=!0,Y+="/*",W+=2;continue}if(X&&H===`
14
14
  `){X=!1,Y+=H,W++;continue}if(K&&H==="*"&&G==="/"){K=!1,Y+="*/",W+=2;continue}if(X||K){Y+=H,W++;continue}if(H==="("||H==="{"||H==="[")J++,Y+=H;else if(H===")"||H==="}"||H==="]")J--,Y+=H;else if(H===","&&J===0)Z.push(Y),Y="";else Y+=H;W++}if(Y.trim())Z.push(Y);return Z}function sQ(Q){let Y=new RegExp(`([\\w][\\w.\\[\\]()]*|null|undefined|true|false|\\d+(?:\\.\\d+)?|'[^']*'|"[^"]*")\\s+IsNot\\s+([\\w][\\w.\\[\\]()]*|null|undefined|true|false|\\d+(?:\\.\\d+)?|'[^']*'|"[^"]*")`,"g");Q=Q.replace(Y,"IsNot($1, $2)");let J=new RegExp(`([\\w][\\w.\\[\\]()]*|null|undefined|true|false|\\d+(?:\\.\\d+)?|'[^']*'|"[^"]*")\\s+Is\\s+([\\w][\\w.\\[\\]()]*|null|undefined|true|false|\\d+(?:\\.\\d+)?|'[^']*'|"[^"]*")`,"g");return Q=Q.replace(J,"Is($1, $2)"),Q}function rQ(Q){let Z=/^[\s]*[([/+\-`]/,Y=/[{([,;:+\-*/%=&|?<>!~^]\s*$|^\s*$/,J=/\b(return|throw|yield|await|case|default|extends|new|typeof|void|delete|in|of|instanceof)\s*$/,X=Q.split(`
15
15
  `),K=[];for(let W=0;W<X.length;W++){let H=X[W],G=W>0?X[W-1]:"";if(W>0&&Z.test(H)){let _=G.replace(/\/\/.*$/,"").replace(/\/\*.*\*\/\s*$/,"");if(!Y.test(_)&&!J.test(_)){let F=H.match(/^(\s*)/),O=F?F[1]:"",R=H.slice(O.length);K.push(O+";"+R);continue}}K.push(H)}return K.join(`
16
16
  `)}function tQ(Q){let Z=[],Y=0,J="normal",X=[];while(Y<Q.length){let W=Q[Y],H=Q[Y+1];switch(J){case"single-string":if(W==="\\"&&Y+1<Q.length){Y+=2;continue}if(W==="'")J="normal";Y++;continue;case"double-string":if(W==="\\"&&Y+1<Q.length){Y+=2;continue}if(W==='"')J="normal";Y++;continue;case"template-string":if(W==="\\"&&Y+1<Q.length){Y+=2;continue}if(W==="$"&&H==="{"){Y+=2,X.push(1),J="normal";continue}if(W==="`")J="normal";Y++;continue;case"line-comment":if(W===`
17
- `)J="normal";Y++;continue;case"block-comment":if(W==="*"&&H==="/"){Y+=2,J="normal";continue}Y++;continue;case"regex":if(W==="\\"&&Y+1<Q.length){Y+=2;continue}if(W==="["){Y++;while(Y<Q.length&&Q[Y]!=="]")if(Q[Y]==="\\"&&Y+1<Q.length)Y+=2;else Y++;if(Y<Q.length)Y++;continue}if(W==="/"){Y++;while(Y<Q.length&&/[gimsuy]/.test(Q[Y]))Y++;J="normal";continue}Y++;continue;case"normal":if(X.length>0){if(W==="{")X[X.length-1]++;else if(W==="}"){if(X[X.length-1]--,X[X.length-1]===0){X.pop(),Y++,J="template-string";continue}}}if(W==="'"){Y++,J="single-string";continue}if(W==='"'){Y++,J="double-string";continue}if(W==="`"){Y++,J="template-string";continue}if(W==="/"&&H==="/"){Y+=2,J="line-comment";continue}if(W==="/"&&H==="*"){Y+=2,J="block-comment";continue}if(W==="/"){let G=Y-1;while(G>=0&&/\s/.test(Q[G]))G--;let _=G>=0?Q[G]:"";if(!_||/[=(!,;:{[&|?+\-*%<>~^]/.test(_)||G>=5&&/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)$/.test(Q.slice(Math.max(0,G-10),G+1))){Y++,J="regex";continue}}if(W==="="&&H==="="&&Q[Y+2]!=="="&&Q[Y-1]!=="!"){Z.push({pos:Y,op:"=="}),Y+=2;continue}if(W==="!"&&H==="="&&Q[Y+2]!=="="){Z.push({pos:Y,op:"!="}),Y+=2;continue}break}Y++}if(Z.length===0)return Q;let K=Q;for(let W=Z.length-1;W>=0;W--){let{pos:H,op:G}=Z[W],_=G==="=="?"Is":"IsNot",F=eQ(K,H),O=QZ(K,H+2),R=K.slice(F,H).trim(),$=K.slice(H+2,O).trim();if(R&&$){let M=K.slice(0,F),L=K.slice(O),I=/[a-zA-Z0-9_$]$/.test(M)?" ":"";K=`${M}${I}${_}(${R}, ${$})${L}`}}return K}function eQ(Q,Z){let Y=Z-1;while(Y>=0&&/\s/.test(Q[Y]))Y--;if(Y<0)return 0;let J=0,X=!1,K="";while(Y>=0){let W=Q[Y],H=Y>0?Q[Y-1]:"";if(X){if(W===K&&H!=="\\")X=!1;Y--;continue}if((W==='"'||W==="'"||W==="`")&&H!=="\\"){X=!0,K=W,Y--;continue}if(W===")"||W==="]"){J++,Y--;continue}if(W==="("||W==="["){if(J>0){J--,Y--;continue}return Y+1}if(J>0){Y--;continue}if(W===";"||W==="{"||W==="}")return Y+1;if(/[a-z]/.test(W)){let G=Y+1,_=Y;while(_>0&&/[a-z]/i.test(Q[_-1]))_--;let F=Q.slice(_,G),O=_>0?Q[_-1]:"";if(!/[a-zA-Z0-9_$]/.test(O)){if(["return","throw","case","typeof","void","delete","await","yield","new"].includes(F))return G}}if(W===">"&&H==="=")return Y+1;if(W==="="&&H!=="="&&H!=="!"&&H!=="<"&&H!==">")return Y+1;if(W==="&"&&H==="&")return Y+1;if(W==="|"&&H==="|")return Y+1;if(W==="?"||W===":")return Y+1;if(W===",")return Y+1;Y--}return 0}function QZ(Q,Z){let Y=Z;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y>=Q.length)return Q.length;let J=0,X=!1,K="";while(Y<Q.length){let W=Q[Y],H=Y+1<Q.length?Q[Y+1]:"";if(X){if(W===K&&Q[Y-1]!=="\\")X=!1;Y++;continue}if((W==='"'||W==="'"||W==="`")&&Q[Y-1]!=="\\"){X=!0,K=W,Y++;continue}if(W==="("||W==="["||W==="{"){J++,Y++;continue}if(W===")"||W==="]"||W==="}"){if(J>0){J--,Y++;continue}return Y}if(J>0){Y++;continue}if(W===";")return Y;if(W==="&"&&H==="&")return Y;if(W==="|"&&H==="|")return Y;if(W==="?")return Y;if(W===":")return Y;if(W===",")return Y;if((W==="="||W==="!")&&H==="="&&Q[Y+2]!=="=")return Y;Y++}return Q.length}function ZZ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\bType\s+([A-Z][a-zA-Z0-9_]*)\s*/);if(J){let X=J[1],K=Y+J[0].length,W=X,H=!1,G=Q.slice(K).match(/^(['"`])([^]*?)\1\s*/);if(G){let R=K+G[0].length,$=Q[R],M=$===void 0||R>=Q.length||$!=="="&&$!=="{";if($==="="||$==="{")W=G[2],H=!0,K=R;else if(M){let L=G[0].trim(),B=G[0].slice(L.length);Z+=`const ${X} = Type('${X}', ${L})${B}`,Y=R;continue}}let _,F=K,O=Q.slice(K).match(/^=\s*/);if(O){K+=O[0].length;let R=Q.slice(K).match(/^(\+?\d+(?:\.\d+)?|['"`][^'"`]*['"`]|\{[^}]*\}|\[[^\]]*\]|true|false|null)/);if(R){_=R[0],K+=R[0].length,F=K;let $=Q.slice(K).match(/^\s*/);if($)K+=$[0].length}}if(Q[K]==="{"){let R=K+1,$=1,M=R;while(M<Q.length&&$>0){let E=Q[M];if(E==="{")$++;else if(E==="}")$--;M++}if($!==0){Z+=Q[Y],Y++;continue}let L=Q.slice(R,M-1).trim(),B=M,I=L.match(/description\s*:\s*(['"`])([^]*?)\1/);if(I&&!H)W=I[2];let D,v=L.match(/example\s*:\s*/);if(v){let E=v.index+v[0].length,S=dQ(L,E);if(S)D=S.value.trim()}let P=L.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/);if(P&&D){let E=P[1].trim(),S=P[2].trim(),k=_?`, ${_}`:"";Z+=`const ${X} = Type('${W}', (${E}) => { if (!globalThis.__tjs?.validate(${E}, globalThis.__tjs?.infer(${D}))) return false; ${S} }, ${D}${k})`}else if(P){let E=P[1].trim(),S=P[2].trim(),k=_?`, undefined, ${_}`:"";Z+=`const ${X} = Type('${W}', (${E}) => { ${S} }${k})`}else if(D){let E=_?`, ${_}`:"";Z+=`const ${X} = Type('${W}', undefined, ${D}${E})`}else if(_)Z+=`const ${X} = Type('${W}', ${_})`;else Z+=`const ${X} = Type('${W}')`;Y=B;continue}else if(_){Z+=`const ${X} = Type('${W}', ${_})`,Y=F;continue}else if(!G){let R=Q.slice(K).match(/^(['"`][^]*?['"`]|\+?\d+(?:\.\d+)?|true|false|null|\{[^]*?\}|\[[^]*?\])/);if(R){let $=R[0];Z+=`const ${X} = Type('${X}', ${$})`,Y=K+R[0].length;continue}}}Z+=Q[Y],Y++}return Z}function YZ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\bGeneric\s+([A-Z][a-zA-Z0-9_]*)\s*<([^>]+)>\s*\{/);if(J){let X=J[1],K=J[2],H=Y+J[0].length-1+1,G=1,_=H;while(_<Q.length&&G>0){let B=Q[_];if(B==="{")G++;else if(B==="}")G--;_++}if(G!==0){Z+=Q[Y],Y++;continue}let F=Q.slice(H,_-1).trim(),O=_,R=K.split(",").map((B)=>{let I=B.trim().split("=").map((D)=>D.trim());if(I.length===2)return`['${I[0]}', ${I[1]}]`;return`'${I[0]}'`}),$=F.match(/description\s*:\s*(['"`])([^]*?)\1/),M=F.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/),L=$?$[2]:X;if(M){let B=M[1].trim().split(",").map((E)=>E.trim()),I=M[2].trim(),D=B[0]||"x",v=B.slice(1),P=v.map((E)=>`check${E}`);v.forEach((E,S)=>{I=I.replace(new RegExp(`\\b${E}\\s*\\(`,"g"),`${P[S]}(`)}),Z+=`const ${X} = Generic([${R.join(", ")}], (${D}, ${P.join(", ")}) => { ${I} }, '${L}')`}else Z+=`const ${X} = Generic([${R.join(", ")}], () => true, '${L}')`;Y=O;continue}Z+=Q[Y],Y++}return Z}function JZ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\bUnion\s+([A-Z][a-zA-Z0-9_]*)\s+(['"`])([^]*?)\2\s*/);if(J){let X=J[1],K=J[3],W=Y+J[0].length;if(Q[W]==="{"){let H=W+1,G=1,_=H;while(_<Q.length&&G>0){let $=Q[_];if($==="{")G++;else if($==="}")G--;_++}if(G!==0){Z+=Q[Y],Y++;continue}let F=Q.slice(H,_-1).trim(),O=_,R=T8(F);Z+=`const ${X} = Union('${K}', [${R.join(", ")}])`,Y=O;continue}else{let H=Q.indexOf(`
18
- `,W);if(H===-1)H=Q.length;let G=Q.slice(W,H).trim();if(G){let _=T8(G);Z+=`const ${X} = Union('${K}', [${_.join(", ")}])`,Y=H;continue}}}Z+=Q[Y],Y++}return Z}function T8(Q){let Z=[],Y=Q.split("|").map((J)=>J.trim());for(let J of Y){if(!J)continue;Z.push(J)}return Z}function XZ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\bEnum\s+([A-Z][a-zA-Z0-9_]*)\s+(['"`])([^]*?)\2\s*\{/);if(J){let X=J[1],K=J[3],H=Y+J[0].length-1+1,G=1,_=H;while(_<Q.length&&G>0){let M=Q[_];if(M==="{")G++;else if(M==="}")G--;_++}if(G!==0){Z+=Q[Y],Y++;continue}let F=Q.slice(H,_-1).trim(),O=_,$=WZ(F).map(([M,L])=>`${M}: ${L}`).join(", ");Z+=`const ${X} = Enum('${K}', { ${$} })`,Y=O;continue}Z+=Q[Y],Y++}return Z}function WZ(Q){let Z=[],Y=0,J=Q.split(/[\n,]/).map((X)=>X.trim()).filter((X)=>X&&!X.startsWith("//"));for(let X of J){let K=X.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*(?:=\s*(.+))?$/);if(K){let W=K[1],H=K[2]?.trim();if(H!==void 0){Z.push([W,H]);let G=Number(H);if(!isNaN(G))Y=G+1}else Z.push([W,String(Y)]),Y++}}return Z}function KZ(Q){return Q.replace(/(?<=^|[;\n{])\s*([A-Z][a-zA-Z0-9_]*)\s*=(?!=)/gm,(Z,Y)=>{return Z.replace(Y,`const ${Y}`)})}function S8(Q,Z={}){let{filename:Y="<source>",colonShorthand:J=!0,vmTarget:X=!1}=Z,{source:K,returnType:W,returnSafety:H,moduleSafety:G,originalSource:_,requiredParams:F,unsafeFunctions:O,safeFunctions:R,wasmBlocks:$,tests:M,testErrors:L}=J?iQ(Q,{vmTarget:X}):{source:Q,returnType:void 0,returnSafety:void 0,moduleSafety:void 0,originalSource:Q,requiredParams:new Set,unsafeFunctions:new Set,safeFunctions:new Set,wasmBlocks:[],tests:[],testErrors:[]};try{return{ast:V8(K,{ecmaVersion:2022,sourceType:"module",locations:!0,allowReturnOutsideFunction:!1}),returnType:W,returnSafety:H,moduleSafety:G,originalSource:_,requiredParams:F,unsafeFunctions:O,safeFunctions:R,wasmBlocks:$,tests:M,testErrors:L}}catch(B){let I=B.loc||{line:1,column:0};throw new M0(B.message.replace(/\s*\(\d+:\d+\)$/,""),I,_,Y)}}function E8(Q,Z){for(let J of Q.body){if(J.type==="ImportDeclaration")throw new M0("Imports are not supported. All atoms must be registered with the VM.",J.loc?.start||{line:1,column:0},void 0,Z);if(J.type==="ExportNamedDeclaration"||J.type==="ExportDefaultDeclaration")throw new M0("Exports are not supported. The function is automatically exported.",J.loc?.start||{line:1,column:0},void 0,Z);if(J.type==="ClassDeclaration")throw new M0("Classes are not supported. Agent99 uses functional composition.",J.loc?.start||{line:1,column:0},void 0,Z)}let Y=Q.body.filter((J)=>J.type==="FunctionDeclaration");if(Y.length===0)throw new M0("Source must contain a function declaration",{line:1,column:0},void 0,Z);if(Y.length>1){let J=Y[1];throw new M0("Only a single function per agent is allowed",J.loc?.start||{line:1,column:0},void 0,Z)}return Y[0]}function k8(Q,Z){let Y={params:{}};if(!Z.loc)return Y;let J=Q.substring(0,Z.start),X=[...J.matchAll(/\/\*#([\s\S]*?)\*\//g)];if(X.length>0){let F=X[X.length-1],O=J.substring(F.index+F[0].length);if(/^(?:\s|\/\/[^\n]*)*$/.test(O)){let R=F[1],$=R.split(`
17
+ `)J="normal";Y++;continue;case"block-comment":if(W==="*"&&H==="/"){Y+=2,J="normal";continue}Y++;continue;case"regex":if(W==="\\"&&Y+1<Q.length){Y+=2;continue}if(W==="["){Y++;while(Y<Q.length&&Q[Y]!=="]")if(Q[Y]==="\\"&&Y+1<Q.length)Y+=2;else Y++;if(Y<Q.length)Y++;continue}if(W==="/"){Y++;while(Y<Q.length&&/[gimsuy]/.test(Q[Y]))Y++;J="normal";continue}Y++;continue;case"normal":if(X.length>0){if(W==="{")X[X.length-1]++;else if(W==="}"){if(X[X.length-1]--,X[X.length-1]===0){X.pop(),Y++,J="template-string";continue}}}if(W==="'"){Y++,J="single-string";continue}if(W==='"'){Y++,J="double-string";continue}if(W==="`"){Y++,J="template-string";continue}if(W==="/"&&H==="/"){Y+=2,J="line-comment";continue}if(W==="/"&&H==="*"){Y+=2,J="block-comment";continue}if(W==="/"){let G=Y-1;while(G>=0&&/\s/.test(Q[G]))G--;let _=G>=0?Q[G]:"";if(!_||/[=(!,;:{[&|?+\-*%<>~^]/.test(_)||G>=5&&/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)$/.test(Q.slice(Math.max(0,G-10),G+1))){Y++,J="regex";continue}}if(W==="="&&H==="="&&Q[Y+2]!=="="&&Q[Y-1]!=="!"){Z.push({pos:Y,op:"=="}),Y+=2;continue}if(W==="!"&&H==="="&&Q[Y+2]!=="="){Z.push({pos:Y,op:"!="}),Y+=2;continue}break}Y++}if(Z.length===0)return Q;let K=Q;for(let W=Z.length-1;W>=0;W--){let{pos:H,op:G}=Z[W],_=G==="=="?"Is":"IsNot",F=eQ(K,H),O=QZ(K,H+2),R=K.slice(F,H).trim(),$=K.slice(H+2,O).trim();if(R&&$){let M=K.slice(0,F),L=K.slice(O),I=/[a-zA-Z0-9_$]$/.test(M)?" ":"";K=`${M}${I}${_}(${R}, ${$})${L}`}}return K}function eQ(Q,Z){let Y=Z-1;while(Y>=0&&/\s/.test(Q[Y]))Y--;if(Y<0)return 0;let J=0,X=!1,K="";while(Y>=0){let W=Q[Y],H=Y>0?Q[Y-1]:"";if(X){if(W===K&&H!=="\\")X=!1;Y--;continue}if((W==='"'||W==="'"||W==="`")&&H!=="\\"){X=!0,K=W,Y--;continue}if(W===")"||W==="]"){J++,Y--;continue}if(W==="("||W==="["){if(J>0){J--,Y--;continue}return Y+1}if(J>0){Y--;continue}if(W===";"||W==="{"||W==="}")return Y+1;if(/[a-z]/.test(W)){let G=Y+1,_=Y;while(_>0&&/[a-z]/i.test(Q[_-1]))_--;let F=Q.slice(_,G),O=_>0?Q[_-1]:"";if(!/[a-zA-Z0-9_$]/.test(O)){if(["return","throw","case","typeof","void","delete","await","yield","new"].includes(F))return G}}if(W===">"&&H==="=")return Y+1;if(W==="="&&H!=="="&&H!=="!"&&H!=="<"&&H!==">")return Y+1;if(W==="&"&&H==="&")return Y+1;if(W==="|"&&H==="|")return Y+1;if(W==="?"||W===":")return Y+1;if(W===",")return Y+1;Y--}return 0}function QZ(Q,Z){let Y=Z;while(Y<Q.length&&/\s/.test(Q[Y]))Y++;if(Y>=Q.length)return Q.length;let J=0,X=!1,K="";while(Y<Q.length){let W=Q[Y],H=Y+1<Q.length?Q[Y+1]:"";if(X){if(W===K&&Q[Y-1]!=="\\")X=!1;Y++;continue}if((W==='"'||W==="'"||W==="`")&&Q[Y-1]!=="\\"){X=!0,K=W,Y++;continue}if(W==="("||W==="["||W==="{"){J++,Y++;continue}if(W===")"||W==="]"||W==="}"){if(J>0){J--,Y++;continue}return Y}if(J>0){Y++;continue}if(W===";")return Y;if(W==="&"&&H==="&")return Y;if(W==="|"&&H==="|")return Y;if(W==="?")return Y;if(W===":")return Y;if(W===",")return Y;if((W==="="||W==="!")&&H==="="&&Q[Y+2]!=="=")return Y;Y++}return Q.length}function ZZ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\bType\s+([A-Z][a-zA-Z0-9_]*)\s*/);if(J){let X=J[1],K=Y+J[0].length,W=X,H=!1,G=Q.slice(K).match(/^(['"`])([^]*?)\1\s*/);if(G){let R=K+G[0].length,$=Q[R],M=$===void 0||R>=Q.length||$!=="="&&$!=="{";if($==="="||$==="{")W=G[2],H=!0,K=R;else if(M){let L=G[0].trim(),B=G[0].slice(L.length);Z+=`const ${X} = Type('${X}', ${L})${B}`,Y=R;continue}}let _,F=K,O=Q.slice(K).match(/^=\s*/);if(O){K+=O[0].length;let R=Q.slice(K).match(/^(\+?\d+(?:\.\d+)?|['"`][^'"`]*['"`]|\{[^}]*\}|\[[^\]]*\]|true|false|null)/);if(R){_=R[0],K+=R[0].length,F=K;let $=Q.slice(K).match(/^\s*/);if($)K+=$[0].length}}if(Q[K]==="{"){let R=K+1,$=1,M=R;while(M<Q.length&&$>0){let E=Q[M];if(E==="{")$++;else if(E==="}")$--;M++}if($!==0){Z+=Q[Y],Y++;continue}let L=Q.slice(R,M-1).trim(),B=M,I=L.match(/description\s*:\s*(['"`])([^]*?)\1/);if(I&&!H)W=I[2];let V,v=L.match(/example\s*:\s*/);if(v){let E=v.index+v[0].length,S=dQ(L,E);if(S)V=S.value.trim()}let P=L.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/);if(P&&V){let E=P[1].trim(),S=P[2].trim(),k=_?`, ${_}`:"";Z+=`const ${X} = Type('${W}', (${E}) => { if (!globalThis.__tjs?.validate(${E}, globalThis.__tjs?.infer(${V}))) return false; ${S} }, ${V}${k})`}else if(P){let E=P[1].trim(),S=P[2].trim(),k=_?`, undefined, ${_}`:"";Z+=`const ${X} = Type('${W}', (${E}) => { ${S} }${k})`}else if(V){let E=_?`, ${_}`:"";Z+=`const ${X} = Type('${W}', undefined, ${V}${E})`}else if(_)Z+=`const ${X} = Type('${W}', ${_})`;else Z+=`const ${X} = Type('${W}')`;Y=B;continue}else if(_){Z+=`const ${X} = Type('${W}', ${_})`,Y=F;continue}else if(!G){let R=Q.slice(K).match(/^(['"`][^]*?['"`]|\+?\d+(?:\.\d+)?|true|false|null|\{[^]*?\}|\[[^]*?\])/);if(R){let $=R[0];Z+=`const ${X} = Type('${X}', ${$})`,Y=K+R[0].length;continue}}}Z+=Q[Y],Y++}return Z}function YZ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\bGeneric\s+([A-Z][a-zA-Z0-9_]*)\s*<([^>]+)>\s*\{/);if(J){let X=J[1],K=J[2],H=Y+J[0].length-1+1,G=1,_=H;while(_<Q.length&&G>0){let B=Q[_];if(B==="{")G++;else if(B==="}")G--;_++}if(G!==0){Z+=Q[Y],Y++;continue}let F=Q.slice(H,_-1).trim(),O=_,R=K.split(",").map((B)=>{let I=B.trim().split("=").map((V)=>V.trim());if(I.length===2)return`['${I[0]}', ${I[1]}]`;return`'${I[0]}'`}),$=F.match(/description\s*:\s*(['"`])([^]*?)\1/),M=F.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/),L=$?$[2]:X;if(M){let B=M[1].trim().split(",").map((E)=>E.trim()),I=M[2].trim(),V=B[0]||"x",v=B.slice(1),P=v.map((E)=>`check${E}`);v.forEach((E,S)=>{I=I.replace(new RegExp(`\\b${E}\\s*\\(`,"g"),`${P[S]}(`)}),Z+=`const ${X} = Generic([${R.join(", ")}], (${V}, ${P.join(", ")}) => { ${I} }, '${L}')`}else Z+=`const ${X} = Generic([${R.join(", ")}], () => true, '${L}')`;Y=O;continue}Z+=Q[Y],Y++}return Z}function JZ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\bUnion\s+([A-Z][a-zA-Z0-9_]*)\s+(['"`])([^]*?)\2\s*/);if(J){let X=J[1],K=J[3],W=Y+J[0].length;if(Q[W]==="{"){let H=W+1,G=1,_=H;while(_<Q.length&&G>0){let $=Q[_];if($==="{")G++;else if($==="}")G--;_++}if(G!==0){Z+=Q[Y],Y++;continue}let F=Q.slice(H,_-1).trim(),O=_,R=T8(F);Z+=`const ${X} = Union('${K}', [${R.join(", ")}])`,Y=O;continue}else{let H=Q.indexOf(`
18
+ `,W);if(H===-1)H=Q.length;let G=Q.slice(W,H).trim();if(G){let _=T8(G);Z+=`const ${X} = Union('${K}', [${_.join(", ")}])`,Y=H;continue}}}Z+=Q[Y],Y++}return Z}function T8(Q){let Z=[],Y=Q.split("|").map((J)=>J.trim());for(let J of Y){if(!J)continue;Z.push(J)}return Z}function XZ(Q){let Z="",Y=0;while(Y<Q.length){let J=Q.slice(Y).match(/^\bEnum\s+([A-Z][a-zA-Z0-9_]*)\s+(['"`])([^]*?)\2\s*\{/);if(J){let X=J[1],K=J[3],H=Y+J[0].length-1+1,G=1,_=H;while(_<Q.length&&G>0){let M=Q[_];if(M==="{")G++;else if(M==="}")G--;_++}if(G!==0){Z+=Q[Y],Y++;continue}let F=Q.slice(H,_-1).trim(),O=_,$=WZ(F).map(([M,L])=>`${M}: ${L}`).join(", ");Z+=`const ${X} = Enum('${K}', { ${$} })`,Y=O;continue}Z+=Q[Y],Y++}return Z}function WZ(Q){let Z=[],Y=0,J=Q.split(/[\n,]/).map((X)=>X.trim()).filter((X)=>X&&!X.startsWith("//"));for(let X of J){let K=X.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*(?:=\s*(.+))?$/);if(K){let W=K[1],H=K[2]?.trim();if(H!==void 0){Z.push([W,H]);let G=Number(H);if(!isNaN(G))Y=G+1}else Z.push([W,String(Y)]),Y++}}return Z}function KZ(Q){return Q.replace(/(?<=^|[;\n{])\s*([A-Z][a-zA-Z0-9_]*)\s*=(?!=)/gm,(Z,Y)=>{return Z.replace(Y,`const ${Y}`)})}function S8(Q,Z={}){let{filename:Y="<source>",colonShorthand:J=!0,vmTarget:X=!1}=Z,{source:K,returnType:W,returnSafety:H,moduleSafety:G,originalSource:_,requiredParams:F,unsafeFunctions:O,safeFunctions:R,wasmBlocks:$,tests:M,testErrors:L}=J?iQ(Q,{vmTarget:X}):{source:Q,returnType:void 0,returnSafety:void 0,moduleSafety:void 0,originalSource:Q,requiredParams:new Set,unsafeFunctions:new Set,safeFunctions:new Set,wasmBlocks:[],tests:[],testErrors:[]};try{return{ast:V8(K,{ecmaVersion:2022,sourceType:"module",locations:!0,allowReturnOutsideFunction:!1}),returnType:W,returnSafety:H,moduleSafety:G,originalSource:_,requiredParams:F,unsafeFunctions:O,safeFunctions:R,wasmBlocks:$,tests:M,testErrors:L}}catch(B){let I=B.loc||{line:1,column:0};throw new I0(B.message.replace(/\s*\(\d+:\d+\)$/,""),I,_,Y)}}function E8(Q,Z){for(let J of Q.body){if(J.type==="ImportDeclaration")throw new I0("Imports are not supported. All atoms must be registered with the VM.",J.loc?.start||{line:1,column:0},void 0,Z);if(J.type==="ExportNamedDeclaration"||J.type==="ExportDefaultDeclaration")throw new I0("Exports are not supported. The function is automatically exported.",J.loc?.start||{line:1,column:0},void 0,Z);if(J.type==="ClassDeclaration")throw new I0("Classes are not supported. Agent99 uses functional composition.",J.loc?.start||{line:1,column:0},void 0,Z)}let Y=Q.body.filter((J)=>J.type==="FunctionDeclaration");if(Y.length===0)throw new I0("Source must contain a function declaration",{line:1,column:0},void 0,Z);if(Y.length>1){let J=Y[1];throw new I0("Only a single function per agent is allowed",J.loc?.start||{line:1,column:0},void 0,Z)}return Y[0]}function k8(Q,Z){let Y={params:{}};if(!Z.loc)return Y;let J=Q.substring(0,Z.start),X=[...J.matchAll(/\/\*#([\s\S]*?)\*\//g)];if(X.length>0){let F=X[X.length-1],O=J.substring(F.index+F[0].length);if(/^(?:\s|\/\/[^\n]*)*$/.test(O)){let R=F[1],$=R.split(`
19
19
  `),M=$.filter((L)=>L.trim().length>0).reduce((L,B)=>{let I=B.match(/^(\s*)/)?.[1].length||0;return Math.min(L,I)},1/0);if(M>0&&M<1/0)R=$.map((L)=>L.slice(M)).join(`
20
- `);return Y.description=R.trim(),Y}}let K=J.match(/\/\*\*[\s\S]*?\*\/\s*$/);if(!K)return Y;let W=K[0],H=W.match(/\/\*\*\s*\n?\s*\*?\s*([^@\n][^\n]*)/m);if(H)Y.description=H[1].trim();let G=/@param\s+(?:\{[^}]+\}\s+)?(\w+)\s*-?\s*(.*)/g,_;while((_=G.exec(W))!==null)Y.params[_[1]]=_[2].trim();return Y}function HZ(Q,Z=!1){let Y=[],J=[],X="",K=0;while(K<Q.length){let W=Q.slice(K).match(/^\btest\s+/);if(W){let H=K,G=K+W[0].length,_,F=Q.slice(G).match(/^(['"`])([^]*?)\1\s*/);if(F)_=F[2],G+=F[0].length;if(Q[G]==="{"){let O=G+1,R=1,$=O;while($<Q.length&&R>0){let M=Q[$];if(M==="{")R++;else if(M==="}")R--;$++}if(R===0){let M=Q.slice(O,$-1).trim(),L=$;if(Y.push({description:_,body:M,start:H,end:L}),!Z)try{Function(M)()}catch(D){let v=_||`test at position ${H}`;J.push(`Test failed: ${v}
21
- ${D.message||D}`)}let I=(Q.slice(H,L).match(/\n/g)||[]).length;X+=`
22
- `.repeat(I),K=L;continue}}}X+=Q[K],K++}return{source:X,tests:Y,errors:J}}function zZ(Q){let Z=/\bclass\s+(\w+)(\s+extends\s+\w+)?\s*\{/g,Y="",J=0,X;while((X=Z.exec(Q))!==null){let K=X[1],W=X[2]||"",H=X.index,G=H+X[0].length-1,_=1,F=G+1;while(F<Q.length&&_>0){let O=Q[F];if(O==="{")_++;else if(O==="}")_--;F++}if(_===0){let O=F,R=Q.slice(G,O);Y+=Q.slice(J,H),Y+=`let ${K} = class ${K}${W} ${R}; `,Y+=`${K} = new Proxy(${K}, { apply(t, _, a) { return Reflect.construct(t, a) } });`,J=O}}return Y+=Q.slice(J),Y}function GZ(Q){let Z=[{pattern:/\bnew\s+Date\b/,message:"new Date() is not allowed in TjsDate mode. Use Timestamp.now() or Timestamp.from()"},{pattern:/\bDate\.now\b/,message:"Date.now() is not allowed in TjsDate mode. Use Timestamp.now()"},{pattern:/\bDate\.parse\b/,message:"Date.parse() is not allowed in TjsDate mode. Use Timestamp.parse()"},{pattern:/\bDate\.UTC\b/,message:"Date.UTC() is not allowed in TjsDate mode. Use Timestamp.from()"}];for(let{pattern:Y,message:J}of Z)if(Y.test(Q))throw Error(J);return Q}function _Z(Q){if(/(?<![A-Za-z_$])\beval\s*\(/.test(Q))throw Error("eval() is not allowed in TjsNoeval mode. Use Eval() from TJS runtime for safe evaluation.");if(/\bnew\s+Function\s*\(/.test(Q))throw Error("new Function() is not allowed in TjsNoeval mode. Use SafeFunction() from TJS runtime.");return Q}function H0(Q){switch(Q.type){case"Literal":{let Z=Q.value;if(Z===null)return{kind:"null"};if(typeof Z==="string")return{kind:"string"};if(typeof Z==="number")return{kind:"number"};if(typeof Z==="boolean")return{kind:"boolean"};return{kind:"any"}}case"ArrayExpression":{let Z=Q.elements;if(Z.length===0)return{kind:"array",items:{kind:"any"}};return{kind:"array",items:H0(Z[0])}}case"ObjectExpression":{let Z=Q.properties,Y={};for(let J of Z)if(J.type==="Property"&&J.key.type==="Identifier"){let X=J.key.name;Y[X]=H0(J.value)}return{kind:"object",shape:Y}}case"LogicalExpression":{let{operator:Z,left:Y,right:J}=Q;if(Z==="||"){let X=H0(Y),K=H0(J);if(K.kind==="null")return{...X,nullable:!0};if(X.kind==="null")return{...K,nullable:!0};return{kind:"union",members:[X,K]}}if(Z==="&&")return H0(J);if(Z==="??")return H0(J);return{kind:"any"}}case"Identifier":{if(Q.name==="undefined")return{kind:"undefined"};return{kind:"any"}}case"UnaryExpression":{if(Q.operator==="-"&&Q.argument.type==="Literal"){if(typeof Q.argument.value==="number")return{kind:"number"}}return{kind:"any"}}default:return{kind:"any"}}}function D1(Q,Z){if(Q.type==="Identifier")return{name:Q.name,type:{kind:"any"},required:!0};if(Q.type==="AssignmentPattern"){let{left:Y,right:J}=Q;if(Y.type!=="Identifier")throw new h("Only simple parameter names are supported",m(Q));let X=Y.name,K=Z?.has(X)??!1,W=H0(J),H=I0(J);return{name:X,type:W,required:K,default:K?null:H,example:H,loc:{start:Q.start,end:Q.end}}}if(Q.type==="ObjectPattern"){let Y=Q.properties,J={},X={};for(let K of Y)if(K.type==="Property"){let W=K.key.type==="Identifier"?K.key.name:String(K.key.value);if(K.value.type==="Identifier")J[W]={kind:"any"},X[W]={name:W,type:{kind:"any"},required:!0};else if(K.value.type==="AssignmentPattern"){let H=D1(K.value,Z),G=Z?.has(W)??!1;J[W]=H.type,X[W]={name:W,type:H.type,required:G,default:G?null:H.example,example:H.example}}}return{name:"__destructured__",type:{kind:"object",shape:J,destructuredParams:X},required:!0}}throw new h(`Unsupported parameter pattern: ${Q.type}`,m(Q))}function I0(Q){switch(Q.type){case"Literal":return Q.value;case"ArrayExpression":return Q.elements.map((Z)=>Z?I0(Z):null);case"ObjectExpression":{let Z={};for(let Y of Q.properties)if(Y.type==="Property"&&Y.key.type==="Identifier")Z[Y.key.name]=I0(Y.value);return Z}case"UnaryExpression":if(Q.operator==="-"){let Z=I0(Q.argument);return typeof Z==="number"?-Z:void 0}return;case"LogicalExpression":{let{operator:Z,left:Y,right:J}=Q;if(Z==="&&"){if(Y.type==="Literal"&&Y.value===null)return null}if(Z==="||")return I0(Y)??I0(J);if(Z==="??")return I0(Y)??I0(J);return}default:return}}function v8(Q){try{let Z=P8(Q,0,{ecmaVersion:2022});return H0(Z)}catch{return{kind:"any"}}}function Y1(Q){switch(Q.kind){case"string":return{type:"string"};case"number":return{type:"number"};case"boolean":return{type:"boolean"};case"null":return{};case"undefined":return{};case"any":return{};case"array":return{type:"array",items:Q.items?Y1(Q.items):{}};case"object":if(Q.shape){let Z={};for(let[Y,J]of Object.entries(Q.shape))Z[Y]=Y1(J);return{type:"object",properties:Z,additionalProperties:!1}}return{type:"object"};case"union":if(Q.members)return{oneOf:Q.members.map(Y1)};return{};default:return{}}}function qZ(Q){let Z={},Y=[];for(let[J,X]of Object.entries(Q))if(Z[J]=Y1(X.type),X.required)Y.push(J);return{type:"object",properties:Z,required:Y.length>0?Y:void 0,additionalProperties:!1}}function g8(Q,Z,Y,J={},X){let K=k8(Z,Q),W=new Map;for(let B of Q.params){let I=D1(B,X);if(I.name==="__destructured__"&&I.type.kind==="object"&&I.type.destructuredParams)for(let[D,v]of Object.entries(I.type.destructuredParams))W.set(D,{...v,description:K.params[D]});else I.description=K.params[I.name],W.set(I.name,I)}let H;if(Y)H=v8(Y);let G={depth:0,locals:new Map,parameters:W,atoms:new Set(Object.keys(J.atoms||{})),warnings:[],source:Z,filename:J.filename||"<source>",options:J},_=z0(Q.body,G),F=[],O=[],R=[];for(let[B,I]of W.entries())if(I.required)O.push(B);else if(I.default!==void 0)R.push({name:B,defaultValue:I.default});else O.push(B);if(O.length>0)F.push({op:"varsImport",keys:O});for(let{name:B,defaultValue:I}of R)F.push({op:"varsImport",keys:[B]}),F.push({op:"if",condition:{$expr:"binary",op:"==",left:{$expr:"ident",name:B},right:{$expr:"literal",value:null}},then:[{op:"varSet",key:B,value:I}]});F.push(..._);let $=Object.fromEntries(W),M={name:Q.id?.name||"anonymous",description:K.description,parameters:$,returns:H},L=qZ($);return{ast:{op:"seq",steps:F,inputSchema:L},signature:M,warnings:G.warnings}}function z0(Q,Z){let Y=[];for(let J of Q.body){let X=g0(J,Z);if(X)if(Array.isArray(X))Y.push(...X);else Y.push(X)}return Y}function g0(Q,Z){switch(Q.type){case"VariableDeclaration":return FZ(Q,Z);case"ExpressionStatement":return RZ(Q,Z);case"IfStatement":return OZ(Q,Z);case"WhileStatement":return UZ(Q,Z);case"ForOfStatement":return MZ(Q,Z);case"TryStatement":return IZ(Q,Z);case"ReturnStatement":return BZ(Q,Z);case"ThrowStatement":throw new h("'throw' is not supported in AsyncJS. Use Error('message') to trigger error flow",m(Q),Z.source,Z.filename);case"BlockStatement":return{op:"scope",steps:z0(Q,Z0(Z))};case"EmptyStatement":return null;default:throw new h(`Unsupported statement type: ${Q.type}`,m(Q),Z.source,Z.filename)}}function FZ(Q,Z){let Y=[],J=Q.kind==="const",X=J?"constSet":"varSet";for(let K of Q.declarations){if(K.id.type!=="Identifier")throw new h("Only simple variable names are supported",m(K),Z.source,Z.filename);let W=K.id.name;if(K.init){let{step:H,resultVar:G}=N0(K.init,Z,W,J);if(H)Y.push(H);else if(G!==W)Y.push({op:X,key:W,value:G});let _=H0(K.init);Z.locals.set(W,_)}else{if(J)throw new h("const declarations must be initialized",m(K),Z.source,Z.filename);Y.push({op:"varSet",key:W,value:null}),Z.locals.set(W,{kind:"any",nullable:!0})}}return Y}function RZ(Q,Z){let Y=Q.expression;if(Y.type==="AssignmentExpression")return $Z(Y,Z);if(Y.type==="CallExpression"){let{step:J,resultVar:X}=N0(Y,Z);if(J)return J;if(X)return{op:"varSet",key:"_",value:X};return null}return Z.warnings.push({message:"Expression statement has no effect",line:m(Q).line,column:m(Q).column}),null}function $Z(Q,Z){if(Q.left.type!=="Identifier")throw new h("Only simple variable assignment is supported",m(Q),Z.source,Z.filename);let Y=Q.left.name,{step:J,resultVar:X}=N0(Q.right,Z,Y);if(J)return J;return{op:"varSet",key:Y,value:X}}function OZ(Q,Z){let Y=g(Q.test,Z),J=Q.consequent.type==="BlockStatement"?z0(Q.consequent,Z0(Z)):[g0(Q.consequent,Z)].filter(Boolean),X;if(Q.alternate)X=Q.alternate.type==="BlockStatement"?z0(Q.alternate,Z0(Z)):[g0(Q.alternate,Z)].filter(Boolean);return{op:"if",condition:Y,then:J,...X&&{else:X}}}function UZ(Q,Z){let Y=g(Q.test,Z),J=Q.body.type==="BlockStatement"?z0(Q.body,Z0(Z)):[g0(Q.body,Z)].filter(Boolean);return{op:"while",condition:Y,body:J}}function MZ(Q,Z){let Y;if(Q.left.type==="VariableDeclaration"){let W=Q.left.declarations[0];if(W.id.type!=="Identifier")throw new h("Only simple variable names are supported in for...of",m(Q.left),Z.source,Z.filename);Y=W.id.name}else if(Q.left.type==="Identifier")Y=Q.left.name;else throw new h("Unsupported for...of left-hand side",m(Q.left),Z.source,Z.filename);let J=l(Q.right,Z),X=Z0(Z);X.locals.set(Y,{kind:"any"});let K=Q.body.type==="BlockStatement"?z0(Q.body,X):[g0(Q.body,X)].filter(Boolean);return{op:"map",items:J,as:Y,steps:K}}function IZ(Q,Z){let Y=z0(Q.block,Z0(Z)),J,X;if(Q.handler){let K=Z0(Z);if(Q.handler.param?.type==="Identifier")X=Q.handler.param.name,K.locals.set(X,{kind:"any"});J=z0(Q.handler.body,K)}return{op:"try",try:Y,...J&&{catch:J},...X&&{catchParam:X}}}function BZ(Q,Z){if(!Q.argument)return{op:"return",value:{}};let{step:Y,resultVar:J}=N0(Q.argument,Z,"__returnVal__");if(Y)return[Y,{op:"return",value:J}];return{op:"return",value:l(Q.argument,Z)}}var f8=new Set(["Math","JSON","Array","Object","String","Number","console","Date","Schema"]),jZ=new Set(["parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","Set","Date","filter"]),f0=new Set(["RegExp","Promise","Map","WeakSet","WeakMap","Symbol","Proxy","Reflect","Function","eval","setTimeout","setInterval","fetch","require","import","process","window","document","global","globalThis"]),NZ=new Set(["toUpperCase","toLowerCase","trim","trimStart","trimEnd","charAt","charCodeAt","codePointAt","concat","includes","indexOf","lastIndexOf","startsWith","endsWith","slice","substring","substr","replace","replaceAll","match","search","padStart","padEnd","repeat","normalize","localeCompare","toString","valueOf","at","reverse","sort","fill","copyWithin","flat","flatMap","every","some","forEach","add","remove","has","clear","toArray","union","intersection","diff","format","isBefore","isAfter"]);function LZ(Q){if(Q.callee.type==="Identifier"){let Z=Q.callee.name;return jZ.has(Z)||f0.has(Z)}if(Q.callee.type==="MemberExpression"){let Z=Q.callee;if(Z.object.type==="Identifier"){let Y=Z.object.name;if(f8.has(Y)||f0.has(Y))return!0}if(Z.property.type==="Identifier"){let Y=Z.property.name;if(NZ.has(Y))return!0}}return!1}function wZ(Q){if(Q.object.type==="Identifier"){let Z=Q.object.name;return f8.has(Z)||f0.has(Z)}return!1}var y8={RegExp:"RegExp is not available. Use string methods or the regexMatch atom.",Promise:"Promise is not needed. All operations are implicitly async.",Map:"Map is not available. Use plain objects instead.",WeakSet:"WeakSet is not available.",WeakMap:"WeakMap is not available.",Symbol:"Symbol is not available.",Proxy:"Proxy is not available.",Reflect:"Reflect is not available.",Function:"Function constructor is not available. Define functions normally.",eval:"eval is not available. Code is compiled, not evaluated.",setTimeout:"setTimeout is not available. Use the delay atom.",setInterval:"setInterval is not available. Use while loops with delay.",fetch:"fetch is not available. Use the httpFetch atom.",require:"require is not available. Atoms must be registered with the VM.",import:"import is not available. Atoms must be registered with the VM.",process:"process is not available. AsyncJS runs in a sandboxed environment.",window:"window is not available. AsyncJS runs in a sandboxed environment.",document:"document is not available. AsyncJS runs in a sandboxed environment.",global:"global is not available. AsyncJS runs in a sandboxed environment.",globalThis:"globalThis is not available. Use builtins directly."};function AZ(Q){if(Q.callee.type==="Identifier"){let Z=Q.callee.name;if(f0.has(Z))return y8[Z]||`${Z} is not available in AsyncJS.`}if(Q.callee.type==="MemberExpression"){let Z=Q.callee;if(Z.object.type==="Identifier"){let Y=Z.object.name;if(f0.has(Y))return y8[Y]||`${Y} is not available in AsyncJS.`}}return null}function h8(Q){return{Date:" Use Date() or Date('2024-01-15') instead - no 'new' needed.",Set:" Use Set([items]) instead - no 'new' needed.",Map:" Use plain objects instead of Map.",Array:" Use array literals like [1, 2, 3] instead.",Object:" Use object literals like { key: value } instead.",Error:" Return an error object like { error: 'message' } instead.",RegExp:" Use string methods or the regexMatch atom.",Promise:" Not needed - all operations are implicitly async.",WeakSet:" WeakSet is not available.",WeakMap:" WeakMap is not available."}[Q]||" Use factory functions or object literals instead."}function N0(Q,Z,Y,J){let X=J?"constSet":"varSet";if(Q.type==="ChainExpression")return N0(Q.expression,Z,Y,J);if(Q.type==="NewExpression"){let W=Q,H="constructor";if(W.callee.type==="Identifier")H=W.callee.name;let G=h8(H);throw new h(`The 'new' keyword is not supported in AsyncJS.${G}`,m(Q),Z.source,Z.filename)}if(Q.type==="CallExpression"){let W=AZ(Q);if(W)throw new h(W,m(Q),Z.source,Z.filename)}if(Q.type==="CallExpression"&&LZ(Q)){let W=g(Q,Z);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}if(Q.type==="MemberExpression"&&wZ(Q)){let W=g(Q,Z);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}if(Q.type==="CallExpression")return DZ(Q,Z,Y,J);if(Q.type==="TemplateLiteral")return PZ(Q,Z,Y,J);if(Q.type==="BinaryExpression"||Q.type==="LogicalExpression"||Q.type==="UnaryExpression"){let W=g(Q,Z);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}return{step:null,resultVar:l(Q,Z)}}function DZ(Q,Z,Y,J){let X,K=!1,W;if(Q.callee.type==="Identifier")X=Q.callee.name;else if(Q.callee.type==="MemberExpression"){let G=Q.callee;if(G.property.type==="Identifier")X=G.property.name,K=!0,W=l(G.object,Z);else throw new h("Computed method names are not supported",m(Q),Z.source,Z.filename)}else throw new h("Only named function calls are supported",m(Q),Z.source,Z.filename);if(K)return VZ(X,W,Q.arguments,Z,Y,J);if(X==="console"&&Q.callee.type==="MemberExpression");let H=CZ(Q,Z);return{step:{op:X,...H,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function VZ(Q,Z,Y,J,X,K){switch(Q){case"map":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],G=H?.type==="Identifier"?H.name:"item",_=Z0(J);_.locals.set(G,{kind:"any"});let F;if(W.body.type==="BlockStatement")F=z0(W.body,_);else{let{step:O,resultVar:R}=N0(W.body,_,"result");F=O?[O]:[{op:"varSet",key:"result",value:R}]}return{step:{op:"map",items:Z,as:G,steps:F,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"filter":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],G=H?.type==="Identifier"?H.name:"item",_=Z0(J);_.locals.set(G,{kind:"any"});let F;if(W.body.type==="BlockStatement")throw new h("filter callback must be an expression, not a block",m(Y[0]),J.source,J.filename);else F=g(W.body,_);return{step:{op:"filter",items:Z,as:G,condition:F,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"find":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],G=H?.type==="Identifier"?H.name:"item",_=Z0(J);_.locals.set(G,{kind:"any"});let F;if(W.body.type==="BlockStatement")throw new h("find callback must be an expression, not a block",m(Y[0]),J.source,J.filename);else F=g(W.body,_);return{step:{op:"find",items:Z,as:G,condition:F,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"reduce":if(Y.length>=2&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],G=W.params[1],_=H?.type==="Identifier"?H.name:"acc",F=G?.type==="Identifier"?G.name:"item",O=Z0(J);O.locals.set(_,{kind:"any"}),O.locals.set(F,{kind:"any"});let R;if(W.body.type==="BlockStatement")R=z0(W.body,O);else{let{step:M,resultVar:L}=N0(W.body,O,"result");R=M?[M]:[{op:"varSet",key:"result",value:L}]}let $=l(Y[1],J);return{step:{op:"reduce",items:Z,as:F,accumulator:_,initial:$,steps:R,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"slice":break;case"push":return{step:{op:"push",list:Z,item:l(Y[0],J),...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X};case"join":return{step:{op:"join",list:Z,sep:Y.length>0?l(Y[0],J):"",...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X};case"split":return{step:{op:"split",str:Z,sep:Y.length>0?l(Y[0],J):"",...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}return J.warnings.push({message:`Unknown method '${Q}' - treating as atom call`,line:0,column:0}),{step:{op:Q,receiver:Z,args:Y.map((W)=>l(W,J)),...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}function PZ(Q,Z,Y,J){let X="",K={};for(let W=0;W<Q.quasis.length;W++)if(X+=Q.quasis[W].value.cooked||Q.quasis[W].value.raw,W<Q.expressions.length){let H=Q.expressions[W],G=`_${W}`;K[G]=l(H,Z),X+=`{{${G}}}`}return{step:{op:"template",tmpl:X,vars:K,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function g(Q,Z){switch(Q.type){case"Literal":return{$expr:"literal",value:Q.value};case"Identifier":return{$expr:"ident",name:Q.name};case"MemberExpression":{let Y=Q,J=g(Y.object,Z),X=Y.optional===!0;if(Y.computed){let W=Y.property;if(W.type==="Literal")return{$expr:"member",object:J,property:String(W.value),computed:!0,...X&&{optional:!0}};throw new h("Computed member access with variables not yet supported",m(Q),Z.source,Z.filename)}let K=Y.property.name;return{$expr:"member",object:J,property:K,...X&&{optional:!0}}}case"ChainExpression":return g(Q.expression,Z);case"BinaryExpression":{let Y=Q;return{$expr:"binary",op:Y.operator,left:g(Y.left,Z),right:g(Y.right,Z)}}case"LogicalExpression":{let Y=Q;return{$expr:"logical",op:Y.operator,left:g(Y.left,Z),right:g(Y.right,Z)}}case"UnaryExpression":{let Y=Q;return{$expr:"unary",op:Y.operator,argument:g(Y.argument,Z)}}case"ConditionalExpression":{let Y=Q;return{$expr:"conditional",test:g(Y.test,Z),consequent:g(Y.consequent,Z),alternate:g(Y.alternate,Z)}}case"ArrayExpression":return{$expr:"array",elements:Q.elements.filter((J)=>J!==null).map((J)=>g(J,Z))};case"ObjectExpression":{let Y=Q,J=[];for(let X of Y.properties)if(X.type==="Property"){let K=X.key.type==="Identifier"?X.key.name:String(X.key.value);J.push({key:K,value:g(X.value,Z)})}return{$expr:"object",properties:J}}case"CallExpression":{let Y=Q;if(Y.callee.type==="MemberExpression"){let J=Y.callee,X=J.property.type==="Identifier"?J.property.name:String(J.property.value),K=J.optional===!0||Y.optional===!0;return{$expr:"methodCall",object:g(J.object,Z),method:X,arguments:Y.arguments.map((W)=>g(W,Z)),...K&&{optional:!0}}}if(Y.callee.type==="Identifier")return{$expr:"call",callee:Y.callee.name,arguments:Y.arguments.map((X)=>g(X,Z))};throw new h("Complex function calls in expressions should be lifted to statements",m(Q),Z.source,Z.filename)}case"NewExpression":{let Y=Q,J="constructor";if(Y.callee.type==="Identifier")J=Y.callee.name;let X=h8(J);throw new h(`The 'new' keyword is not supported in AsyncJS.${X}`,m(Q),Z.source,Z.filename)}case"TemplateLiteral":throw new h("Template literals inside expressions are not supported. Assign to a variable first: const msg = `hello ${name}`; then use msg",m(Q),Z.source,Z.filename);default:throw new h(`Unsupported expression type in condition: ${Q.type}`,m(Q),Z.source,Z.filename)}}function l(Q,Z){switch(Q.type){case"Literal":return Q.value;case"Identifier":return Q.name;case"MemberExpression":{let Y=Q;if(Y.optional===!0)return g(Q,Z);let X=l(Y.object,Z);if(X&&typeof X==="object"&&X.$expr){let W=Y.computed?String(Y.property.value):Y.property.name;return{$expr:"member",object:X,property:W,...Y.computed&&{computed:!0}}}if(Y.computed)return`${X}[${l(Y.property,Z)}]`;let K=Y.property.name;if(typeof X==="string")return`${X}.${K}`;if(X&&X.$kind==="arg")return{$kind:"arg",path:`${X.path}.${K}`};return`${X}.${K}`}case"ChainExpression":return l(Q.expression,Z);case"ArrayExpression":return Q.elements.map((Y)=>Y?l(Y,Z):null);case"ObjectExpression":{let Y={};for(let J of Q.properties)if(J.type==="Property"){let X=J.key.type==="Identifier"?J.key.name:String(J.key.value);Y[X]=l(J.value,Z)}return Y}case"TemplateLiteral":return g(Q,Z);case"CallExpression":return g(Q,Z);case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"ConditionalExpression":return g(Q,Z);default:return null}}function CZ(Q,Z){if(Q.arguments.length===1&&Q.arguments[0].type==="ObjectExpression"){let Y=Q.arguments[0],J={};for(let X of Y.properties)if(X.type==="Property"){let K=X.key.type==="Identifier"?X.key.name:String(X.key.value);J[K]=l(X.value,Z)}return J}return{args:Q.arguments.map((Y)=>l(Y,Z))}}function m8(Q,Z={}){let{ast:Y,returnType:J,originalSource:X,requiredParams:K}=S8(Q,{filename:Z.filename,colonShorthand:!0,vmTarget:!0}),W=E8(Y,Z.filename),{ast:H,signature:G,warnings:_}=g8(W,X,J,Z,K);return{ast:H,signature:G,warnings:_}}var TZ=10;class SZ{atoms;constructor(Q={}){this.atoms={...y1,...Q}}get builder(){return new c(this.atoms)}get Agent(){return new c(this.atoms)}get A99(){return this.Agent}resolve(Q){return this.atoms[Q]}getTools(Q="all"){let Z=Object.values(this.atoms);if(Array.isArray(Q))Z=Z.filter((Y)=>Q.includes(Y.op));else if(Q==="flow"){let Y=["seq","if","while","return","try","varSet","varGet","scope"];Z=Z.filter((J)=>Y.includes(J.op))}return Z.map((Y)=>({type:"function",function:{name:Y.op,description:Y.docs,parameters:Y.inputSchema?.schema??{}}}))}async run(Q,Z={},Y={}){let J;if(typeof Q==="string")if(W1(Q))J=K1(Q);else try{J=m8(Q).ast}catch($){throw Error(`AJS transpilation failed: ${$.message}`)}else J=Q;let X=Y.fuel??1000,K=Y.timeoutMs??X*TZ,W=Y.capabilities??{},H=[];if(!W.store){let $=new Map,M=!1;W.store={get:async(L)=>{if(!M)M=!0,H.push("Using default in-memory store (not suitable for production)");return $.get(L)},set:async(L,B)=>{if(!M)M=!0,H.push("Using default in-memory store (not suitable for production)");$.set(L,B)}}}let G=new AbortController,_=setTimeout(()=>G.abort(),K);if(Y.signal)Y.signal.addEventListener("abort",()=>G.abort());let F={fuel:{current:X},args:Z,state:{},consts:new Set,capabilities:W,resolver:($)=>this.resolve($),output:void 0,signal:G.signal,costOverrides:Y.costOverrides,context:Y.context,warnings:H};if(Y.trace)F.trace=[];if(J.op!=="seq")throw Error("Root AST must be 'seq'. Ensure you're passing a transpiled agent (use ajs`...` or transpile()).");let O=J.inputSchema;if(O&&!bZ(Z,O)){let $=new o("Input validation failed: args do not match expected schema","vm.run");return{result:$,error:$,fuelUsed:0,trace:F.trace,warnings:H.length>0?H:void 0}}try{await Promise.race([this.resolve("seq")?.exec(J,F),new Promise(($,M)=>{if(G.signal.addEventListener("abort",()=>{M(Error(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))}),G.signal.aborted)M(Error(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))})])}catch($){if($.message?.includes("timeout")||$.message?.includes("aborted")||G.signal.aborted)F.error=new o(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`,"vm.run");else throw $}finally{clearTimeout(_)}if(F.error&&F.output===void 0)F.output=F.error;let R=[...H,...F.warnings??[]];return{result:F.output,error:F.error,fuelUsed:X-F.fuel.current,trace:F.trace,warnings:R.length>0?R:void 0}}}import{s as V}from"tosijs-schema";var x8=w("storeVectorize",V.object({text:V.string,model:V.string.optional}),V.array(V.number),async({text:Q},Z)=>{let Y=Z.capabilities.vector;if(!Y)throw Error("Capability 'vector' missing. Ensure vector battery is loaded.");let J=U(Q,Z);return Y.embed(J)},{docs:"Generate embeddings using vector battery",cost:20}),u8=w("storeCreateCollection",V.object({collection:V.string,dimension:V.number.optional}),void 0,async({collection:Q,dimension:Z},Y)=>{let J=Y.capabilities.store;if(!J?.createCollection)throw Error("Capability 'store' missing or does not support createCollection.");let X=U(Q,Y),K=U(Z,Y);return J.createCollection(X,void 0,K)},{docs:"Create a vector store collection",cost:5}),d8=w("storeVectorAdd",V.object({collection:V.string,doc:V.any}),void 0,async({collection:Q,doc:Z},Y)=>{let J=Y.capabilities.store;if(!J?.vectorAdd)throw Error("Capability 'store' missing or does not support vectorAdd.");let X=U(Q,Y),K=U(Z,Y);return J.vectorAdd(X,K)},{docs:"Add a document to a vector store collection",cost:5}),l8=w("storeSearch",V.object({collection:V.string,queryVector:V.array(V.number),k:V.number.optional,filter:V.record(V.any).optional}),V.array(V.any),async({collection:Q,queryVector:Z,k:Y,filter:J},X)=>{let K=X.capabilities.store;if(!K?.vectorSearch)throw Error("Capability 'store' missing or does not support vectorSearch.");let W=U(Q,X),H=U(Z,X),G=U(Y,X)??5,_=U(J,X);return K.vectorSearch(W,H,G,_)},{docs:"Search vector store",cost:(Q,Z)=>5+(U(Q.k,Z)??5)}),p8=w("llmPredictBattery",V.object({system:V.string.optional,user:V.string,tools:V.array(V.any).optional,responseFormat:V.any.optional}),V.object({content:V.string.optional,tool_calls:V.array(V.any).optional}),async({system:Q,user:Z,tools:Y,responseFormat:J},X)=>{let K=X.capabilities.llmBattery;if(!K?.predict)throw Error("Capability 'llmBattery' missing or invalid.");let W=U(Q,X)??"You are a helpful agent.",H=U(Z,X),G=U(Y,X),_=U(J,X);return K.predict(W,H,G,_)},{docs:"Generate completion using LLM battery",cost:100}),i8=w("llmVision",V.object({system:V.string.optional,prompt:V.string,images:V.array(V.string),responseFormat:V.any.optional}),V.object({content:V.string.optional,tool_calls:V.array(V.any).optional}),async({system:Q,prompt:Z,images:Y,responseFormat:J},X)=>{let K=X.capabilities.llmBattery;if(!K?.predict)throw Error("Capability 'llmBattery' missing or invalid.");let W=U(Q,X)??"You analyze images accurately and concisely.",H=U(Z,X),G=U(Y,X)??[],_=U(J,X);return K.predict(W,{text:H,images:G},void 0,_)},{docs:"Analyze images using a vision model",timeoutMs:120000,cost:150});var W6={storeCreateCollection:u8,storeSearch:l8,storeVectorAdd:d8,storeVectorize:x8,llmPredictBattery:p8,llmVision:i8};export{u9 as xmlParse,X9 as whileLoop,v9 as vectorSearch,F9 as varsLet,q9 as varsImport,R9 as varsExport,z9 as varSet,_9 as varGet,i9 as uuid,K9 as tryCatch,f9 as transpileCode,w9 as template,E9 as storeSet,k9 as storeQuery,o9 as storeProcedure,S9 as storeGet,N9 as split,s as seq,$9 as scope,h9 as runCode,W9 as ret,U as resolveValue,K1 as resolveProcedureToken,s9 as releaseProcedure,A9 as regexMatch,M9 as reduce,p9 as random,B9 as push,A0 as procedureStore,D9 as pick,V9 as omit,P9 as merge,d9 as memoize,O9 as map,y9 as llmPredict,j9 as len,C9 as keys,x9 as jsonStringify,m9 as jsonParse,L9 as join,W1 as isProcedureToken,kZ as isAgentError,J9 as iff,H1 as hash,I9 as find,U9 as filter,T9 as fetch,x as evaluateExpr,H9 as errorAtom,w as defineAtom,R0 as createChildScope,y1 as coreAtoms,G9 as constSet,n9 as consoleWarn,c9 as consoleLog,a9 as consoleError,r9 as clearExpiredProcedures,l9 as cache,G0 as builtins,W6 as batteryAtoms,g9 as agentRun,X1 as PROCEDURE_TOKEN_PREFIX,a8 as DEFAULT_PROCEDURE_TTL,o8 as DEFAULT_MAX_AST_SIZE,SZ as AgentVM,o as AgentError};
20
+ `);return Y.description=R.trim(),Y}}let K=J.match(/\/\*\*[\s\S]*?\*\/\s*$/);if(!K)return Y;let W=K[0],H=W.match(/\/\*\*\s*\n?\s*\*?\s*([^@\n][^\n]*)/m);if(H)Y.description=H[1].trim();let G=/@param\s+(?:\{[^}]+\}\s+)?(\w+)\s*-?\s*(.*)/g,_;while((_=G.exec(W))!==null)Y.params[_[1]]=_[2].trim();return Y}function HZ(Q,Z=!1){let Y=[],J=[],X="",K=0;while(K<Q.length){let W=Q.slice(K).match(/^\btest\s+/);if(W){let H=K,G=K+W[0].length,_,F=Q.slice(G).match(/^(['"`])([^]*?)\1\s*/);if(F)_=F[2],G+=F[0].length;if(Q[G]==="{"){let O=G+1,R=1,$=O;while($<Q.length&&R>0){let M=Q[$];if(M==="{")R++;else if(M==="}")R--;$++}if(R===0){let M=Q.slice(O,$-1).trim(),L=$;if(Y.push({description:_,body:M,start:H,end:L}),!Z)try{Function(M)()}catch(V){let v=_||`test at position ${H}`;J.push(`Test failed: ${v}
21
+ ${V.message||V}`)}let I=(Q.slice(H,L).match(/\n/g)||[]).length;X+=`
22
+ `.repeat(I),K=L;continue}}}X+=Q[K],K++}return{source:X,tests:Y,errors:J}}function zZ(Q){let Z=/\bclass\s+(\w+)(\s+extends\s+\w+)?\s*\{/g,Y="",J=0,X;while((X=Z.exec(Q))!==null){let K=X[1],W=X[2]||"",H=X.index,G=H+X[0].length-1,_=1,F=G+1;while(F<Q.length&&_>0){let O=Q[F];if(O==="{")_++;else if(O==="}")_--;F++}if(_===0){let O=F,R=Q.slice(G,O);Y+=Q.slice(J,H),Y+=`let ${K} = class ${K}${W} ${R}; `,Y+=`${K} = new Proxy(${K}, { apply(t, _, a) { return Reflect.construct(t, a) } });`,J=O}}return Y+=Q.slice(J),Y}function GZ(Q){let Z=[{pattern:/\bnew\s+Date\b/,message:"new Date() is not allowed in TjsDate mode. Use Timestamp.now() or Timestamp.from()"},{pattern:/\bDate\.now\b/,message:"Date.now() is not allowed in TjsDate mode. Use Timestamp.now()"},{pattern:/\bDate\.parse\b/,message:"Date.parse() is not allowed in TjsDate mode. Use Timestamp.parse()"},{pattern:/\bDate\.UTC\b/,message:"Date.UTC() is not allowed in TjsDate mode. Use Timestamp.from()"}];for(let{pattern:Y,message:J}of Z)if(Y.test(Q))throw Error(J);return Q}function _Z(Q){if(/(?<![A-Za-z_$])\beval\s*\(/.test(Q))throw Error("eval() is not allowed in TjsNoeval mode. Use Eval() from TJS runtime for safe evaluation.");if(/\bnew\s+Function\s*\(/.test(Q))throw Error("new Function() is not allowed in TjsNoeval mode. Use SafeFunction() from TJS runtime.");return Q}function H0(Q){switch(Q.type){case"Literal":{let Z=Q.value;if(Z===null)return{kind:"null"};if(typeof Z==="string")return{kind:"string"};if(typeof Z==="number"){let Y=Q.raw;if(Y&&Y.includes("."))return{kind:"number"};return{kind:"integer"}}if(typeof Z==="boolean")return{kind:"boolean"};return{kind:"any"}}case"ArrayExpression":{let Z=Q.elements;if(Z.length===0)return{kind:"array",items:{kind:"any"}};return{kind:"array",items:H0(Z[0])}}case"ObjectExpression":{let Z=Q.properties,Y={};for(let J of Z)if(J.type==="Property"&&J.key.type==="Identifier"){let X=J.key.name;Y[X]=H0(J.value)}return{kind:"object",shape:Y}}case"LogicalExpression":{let{operator:Z,left:Y,right:J}=Q;if(Z==="||"){let X=H0(Y),K=H0(J);if(K.kind==="null")return{...X,nullable:!0};if(X.kind==="null")return{...K,nullable:!0};return{kind:"union",members:[X,K]}}if(Z==="&&")return H0(J);if(Z==="??")return H0(J);return{kind:"any"}}case"Identifier":{if(Q.name==="undefined")return{kind:"undefined"};return{kind:"any"}}case"UnaryExpression":{let{operator:Z,argument:Y}=Q;if(Z==="+"&&Y.type==="Literal"){if(typeof Y.value==="number")return{kind:"non-negative-integer"}}if(Z==="-"&&Y.type==="Literal"){if(typeof Y.value==="number"){let X=Y.raw;if(X&&X.includes("."))return{kind:"number"};return{kind:"integer"}}}return{kind:"any"}}default:return{kind:"any"}}}function D1(Q,Z){if(Q.type==="Identifier")return{name:Q.name,type:{kind:"any"},required:!0};if(Q.type==="AssignmentPattern"){let{left:Y,right:J}=Q;if(Y.type!=="Identifier")throw new h("Only simple parameter names are supported",m(Q));let X=Y.name,K=Z?.has(X)??!1,W=H0(J),H=R0(J);return{name:X,type:W,required:K,default:K?null:H,example:H,loc:{start:Q.start,end:Q.end}}}if(Q.type==="ObjectPattern"){let Y=Q.properties,J={},X={};for(let K of Y)if(K.type==="Property"){let W=K.key.type==="Identifier"?K.key.name:String(K.key.value);if(K.value.type==="Identifier")J[W]={kind:"any"},X[W]={name:W,type:{kind:"any"},required:!0};else if(K.value.type==="AssignmentPattern"){let H=D1(K.value,Z),G=Z?.has(W)??!1;J[W]=H.type,X[W]={name:W,type:H.type,required:G,default:G?null:H.example,example:H.example}}}return{name:"__destructured__",type:{kind:"object",shape:J,destructuredParams:X},required:!0}}throw new h(`Unsupported parameter pattern: ${Q.type}`,m(Q))}function R0(Q){switch(Q.type){case"Literal":return Q.value;case"ArrayExpression":return Q.elements.map((Z)=>Z?R0(Z):null);case"ObjectExpression":{let Z={};for(let Y of Q.properties)if(Y.type==="Property"&&Y.key.type==="Identifier")Z[Y.key.name]=R0(Y.value);return Z}case"UnaryExpression":if(Q.operator==="-"){let Z=R0(Q.argument);return typeof Z==="number"?-Z:void 0}if(Q.operator==="+"){let Z=R0(Q.argument);return typeof Z==="number"?+Z:void 0}return;case"LogicalExpression":{let{operator:Z,left:Y,right:J}=Q;if(Z==="&&"){if(Y.type==="Literal"&&Y.value===null)return null}if(Z==="||")return R0(Y)??R0(J);if(Z==="??")return R0(Y)??R0(J);return}default:return}}function v8(Q){try{let Z=P8(Q,0,{ecmaVersion:2022});return H0(Z)}catch{return{kind:"any"}}}function Y1(Q){switch(Q.kind){case"string":return{type:"string"};case"number":return{type:"number"};case"boolean":return{type:"boolean"};case"null":return{};case"undefined":return{};case"any":return{};case"array":return{type:"array",items:Q.items?Y1(Q.items):{}};case"object":if(Q.shape){let Z={};for(let[Y,J]of Object.entries(Q.shape))Z[Y]=Y1(J);return{type:"object",properties:Z,additionalProperties:!1}}return{type:"object"};case"union":if(Q.members)return{oneOf:Q.members.map(Y1)};return{};default:return{}}}function qZ(Q){let Z={},Y=[];for(let[J,X]of Object.entries(Q))if(Z[J]=Y1(X.type),X.required)Y.push(J);return{type:"object",properties:Z,required:Y.length>0?Y:void 0,additionalProperties:!1}}function g8(Q,Z,Y,J={},X){let K=k8(Z,Q),W=new Map;for(let B of Q.params){let I=D1(B,X);if(I.name==="__destructured__"&&I.type.kind==="object"&&I.type.destructuredParams)for(let[V,v]of Object.entries(I.type.destructuredParams))W.set(V,{...v,description:K.params[V]});else I.description=K.params[I.name],W.set(I.name,I)}let H;if(Y)H=v8(Y);let G={depth:0,locals:new Map,parameters:W,atoms:new Set(Object.keys(J.atoms||{})),warnings:[],source:Z,filename:J.filename||"<source>",options:J},_=z0(Q.body,G),F=[],O=[],R=[];for(let[B,I]of W.entries())if(I.required)O.push(B);else if(I.default!==void 0)R.push({name:B,defaultValue:I.default});else O.push(B);if(O.length>0)F.push({op:"varsImport",keys:O});for(let{name:B,defaultValue:I}of R)F.push({op:"varsImport",keys:[B]}),F.push({op:"if",condition:{$expr:"binary",op:"==",left:{$expr:"ident",name:B},right:{$expr:"literal",value:null}},then:[{op:"varSet",key:B,value:I}]});F.push(..._);let $=Object.fromEntries(W),M={name:Q.id?.name||"anonymous",description:K.description,parameters:$,returns:H},L=qZ($);return{ast:{op:"seq",steps:F,inputSchema:L},signature:M,warnings:G.warnings}}function z0(Q,Z){let Y=[];for(let J of Q.body){let X=g0(J,Z);if(X)if(Array.isArray(X))Y.push(...X);else Y.push(X)}return Y}function g0(Q,Z){switch(Q.type){case"VariableDeclaration":return FZ(Q,Z);case"ExpressionStatement":return RZ(Q,Z);case"IfStatement":return OZ(Q,Z);case"WhileStatement":return UZ(Q,Z);case"ForOfStatement":return MZ(Q,Z);case"TryStatement":return IZ(Q,Z);case"ReturnStatement":return BZ(Q,Z);case"ThrowStatement":throw new h("'throw' is not supported in AsyncJS. Use Error('message') to trigger error flow",m(Q),Z.source,Z.filename);case"BlockStatement":return{op:"scope",steps:z0(Q,Z0(Z))};case"EmptyStatement":return null;default:throw new h(`Unsupported statement type: ${Q.type}`,m(Q),Z.source,Z.filename)}}function FZ(Q,Z){let Y=[],J=Q.kind==="const",X=J?"constSet":"varSet";for(let K of Q.declarations){if(K.id.type!=="Identifier")throw new h("Only simple variable names are supported",m(K),Z.source,Z.filename);let W=K.id.name;if(K.init){let{step:H,resultVar:G}=N0(K.init,Z,W,J);if(H)Y.push(H);else if(G!==W)Y.push({op:X,key:W,value:G});let _=H0(K.init);Z.locals.set(W,_)}else{if(J)throw new h("const declarations must be initialized",m(K),Z.source,Z.filename);Y.push({op:"varSet",key:W,value:null}),Z.locals.set(W,{kind:"any",nullable:!0})}}return Y}function RZ(Q,Z){let Y=Q.expression;if(Y.type==="AssignmentExpression")return $Z(Y,Z);if(Y.type==="CallExpression"){let{step:J,resultVar:X}=N0(Y,Z);if(J)return J;if(X)return{op:"varSet",key:"_",value:X};return null}return Z.warnings.push({message:"Expression statement has no effect",line:m(Q).line,column:m(Q).column}),null}function $Z(Q,Z){if(Q.left.type!=="Identifier")throw new h("Only simple variable assignment is supported",m(Q),Z.source,Z.filename);let Y=Q.left.name,{step:J,resultVar:X}=N0(Q.right,Z,Y);if(J)return J;return{op:"varSet",key:Y,value:X}}function OZ(Q,Z){let Y=g(Q.test,Z),J=Q.consequent.type==="BlockStatement"?z0(Q.consequent,Z0(Z)):[g0(Q.consequent,Z)].filter(Boolean),X;if(Q.alternate)X=Q.alternate.type==="BlockStatement"?z0(Q.alternate,Z0(Z)):[g0(Q.alternate,Z)].filter(Boolean);return{op:"if",condition:Y,then:J,...X&&{else:X}}}function UZ(Q,Z){let Y=g(Q.test,Z),J=Q.body.type==="BlockStatement"?z0(Q.body,Z0(Z)):[g0(Q.body,Z)].filter(Boolean);return{op:"while",condition:Y,body:J}}function MZ(Q,Z){let Y;if(Q.left.type==="VariableDeclaration"){let W=Q.left.declarations[0];if(W.id.type!=="Identifier")throw new h("Only simple variable names are supported in for...of",m(Q.left),Z.source,Z.filename);Y=W.id.name}else if(Q.left.type==="Identifier")Y=Q.left.name;else throw new h("Unsupported for...of left-hand side",m(Q.left),Z.source,Z.filename);let J=l(Q.right,Z),X=Z0(Z);X.locals.set(Y,{kind:"any"});let K=Q.body.type==="BlockStatement"?z0(Q.body,X):[g0(Q.body,X)].filter(Boolean);return{op:"map",items:J,as:Y,steps:K}}function IZ(Q,Z){let Y=z0(Q.block,Z0(Z)),J,X;if(Q.handler){let K=Z0(Z);if(Q.handler.param?.type==="Identifier")X=Q.handler.param.name,K.locals.set(X,{kind:"any"});J=z0(Q.handler.body,K)}return{op:"try",try:Y,...J&&{catch:J},...X&&{catchParam:X}}}function BZ(Q,Z){if(!Q.argument)return{op:"return",value:{}};let{step:Y,resultVar:J}=N0(Q.argument,Z,"__returnVal__");if(Y)return[Y,{op:"return",value:J}];return{op:"return",value:l(Q.argument,Z)}}var f8=new Set(["Math","JSON","Array","Object","String","Number","console","Date","Schema"]),jZ=new Set(["parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","Set","Date","filter"]),f0=new Set(["RegExp","Promise","Map","WeakSet","WeakMap","Symbol","Proxy","Reflect","Function","eval","setTimeout","setInterval","fetch","require","import","process","window","document","global","globalThis"]),NZ=new Set(["toUpperCase","toLowerCase","trim","trimStart","trimEnd","charAt","charCodeAt","codePointAt","concat","includes","indexOf","lastIndexOf","startsWith","endsWith","slice","substring","substr","replace","replaceAll","match","search","padStart","padEnd","repeat","normalize","localeCompare","toString","valueOf","at","reverse","sort","fill","copyWithin","flat","flatMap","every","some","forEach","add","remove","has","clear","toArray","union","intersection","diff","format","isBefore","isAfter"]);function LZ(Q){if(Q.callee.type==="Identifier"){let Z=Q.callee.name;return jZ.has(Z)||f0.has(Z)}if(Q.callee.type==="MemberExpression"){let Z=Q.callee;if(Z.object.type==="Identifier"){let Y=Z.object.name;if(f8.has(Y)||f0.has(Y))return!0}if(Z.property.type==="Identifier"){let Y=Z.property.name;if(NZ.has(Y))return!0}}return!1}function AZ(Q){if(Q.object.type==="Identifier"){let Z=Q.object.name;return f8.has(Z)||f0.has(Z)}return!1}var y8={RegExp:"RegExp is not available. Use string methods or the regexMatch atom.",Promise:"Promise is not needed. All operations are implicitly async.",Map:"Map is not available. Use plain objects instead.",WeakSet:"WeakSet is not available.",WeakMap:"WeakMap is not available.",Symbol:"Symbol is not available.",Proxy:"Proxy is not available.",Reflect:"Reflect is not available.",Function:"Function constructor is not available. Define functions normally.",eval:"eval is not available. Code is compiled, not evaluated.",setTimeout:"setTimeout is not available. Use the delay atom.",setInterval:"setInterval is not available. Use while loops with delay.",fetch:"fetch is not available. Use the httpFetch atom.",require:"require is not available. Atoms must be registered with the VM.",import:"import is not available. Atoms must be registered with the VM.",process:"process is not available. AsyncJS runs in a sandboxed environment.",window:"window is not available. AsyncJS runs in a sandboxed environment.",document:"document is not available. AsyncJS runs in a sandboxed environment.",global:"global is not available. AsyncJS runs in a sandboxed environment.",globalThis:"globalThis is not available. Use builtins directly."};function wZ(Q){if(Q.callee.type==="Identifier"){let Z=Q.callee.name;if(f0.has(Z))return y8[Z]||`${Z} is not available in AsyncJS.`}if(Q.callee.type==="MemberExpression"){let Z=Q.callee;if(Z.object.type==="Identifier"){let Y=Z.object.name;if(f0.has(Y))return y8[Y]||`${Y} is not available in AsyncJS.`}}return null}function h8(Q){return{Date:" Use Date() or Date('2024-01-15') instead - no 'new' needed.",Set:" Use Set([items]) instead - no 'new' needed.",Map:" Use plain objects instead of Map.",Array:" Use array literals like [1, 2, 3] instead.",Object:" Use object literals like { key: value } instead.",Error:" Return an error object like { error: 'message' } instead.",RegExp:" Use string methods or the regexMatch atom.",Promise:" Not needed - all operations are implicitly async.",WeakSet:" WeakSet is not available.",WeakMap:" WeakMap is not available."}[Q]||" Use factory functions or object literals instead."}function N0(Q,Z,Y,J){let X=J?"constSet":"varSet";if(Q.type==="ChainExpression")return N0(Q.expression,Z,Y,J);if(Q.type==="NewExpression"){let W=Q,H="constructor";if(W.callee.type==="Identifier")H=W.callee.name;let G=h8(H);throw new h(`The 'new' keyword is not supported in AsyncJS.${G}`,m(Q),Z.source,Z.filename)}if(Q.type==="CallExpression"){let W=wZ(Q);if(W)throw new h(W,m(Q),Z.source,Z.filename)}if(Q.type==="CallExpression"&&LZ(Q)){let W=g(Q,Z);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}if(Q.type==="MemberExpression"&&AZ(Q)){let W=g(Q,Z);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}if(Q.type==="CallExpression")return DZ(Q,Z,Y,J);if(Q.type==="TemplateLiteral")return PZ(Q,Z,Y,J);if(Q.type==="BinaryExpression"||Q.type==="LogicalExpression"||Q.type==="UnaryExpression"){let W=g(Q,Z);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}return{step:null,resultVar:l(Q,Z)}}function DZ(Q,Z,Y,J){let X,K=!1,W;if(Q.callee.type==="Identifier")X=Q.callee.name;else if(Q.callee.type==="MemberExpression"){let G=Q.callee;if(G.property.type==="Identifier")X=G.property.name,K=!0,W=l(G.object,Z);else throw new h("Computed method names are not supported",m(Q),Z.source,Z.filename)}else throw new h("Only named function calls are supported",m(Q),Z.source,Z.filename);if(K)return VZ(X,W,Q.arguments,Z,Y,J);if(X==="console"&&Q.callee.type==="MemberExpression");let H=CZ(Q,Z);return{step:{op:X,...H,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function VZ(Q,Z,Y,J,X,K){switch(Q){case"map":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],G=H?.type==="Identifier"?H.name:"item",_=Z0(J);_.locals.set(G,{kind:"any"});let F;if(W.body.type==="BlockStatement")F=z0(W.body,_);else{let{step:O,resultVar:R}=N0(W.body,_,"result");F=O?[O]:[{op:"varSet",key:"result",value:R}]}return{step:{op:"map",items:Z,as:G,steps:F,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"filter":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],G=H?.type==="Identifier"?H.name:"item",_=Z0(J);_.locals.set(G,{kind:"any"});let F;if(W.body.type==="BlockStatement")throw new h("filter callback must be an expression, not a block",m(Y[0]),J.source,J.filename);else F=g(W.body,_);return{step:{op:"filter",items:Z,as:G,condition:F,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"find":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],G=H?.type==="Identifier"?H.name:"item",_=Z0(J);_.locals.set(G,{kind:"any"});let F;if(W.body.type==="BlockStatement")throw new h("find callback must be an expression, not a block",m(Y[0]),J.source,J.filename);else F=g(W.body,_);return{step:{op:"find",items:Z,as:G,condition:F,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"reduce":if(Y.length>=2&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],G=W.params[1],_=H?.type==="Identifier"?H.name:"acc",F=G?.type==="Identifier"?G.name:"item",O=Z0(J);O.locals.set(_,{kind:"any"}),O.locals.set(F,{kind:"any"});let R;if(W.body.type==="BlockStatement")R=z0(W.body,O);else{let{step:M,resultVar:L}=N0(W.body,O,"result");R=M?[M]:[{op:"varSet",key:"result",value:L}]}let $=l(Y[1],J);return{step:{op:"reduce",items:Z,as:F,accumulator:_,initial:$,steps:R,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"slice":break;case"push":return{step:{op:"push",list:Z,item:l(Y[0],J),...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X};case"join":return{step:{op:"join",list:Z,sep:Y.length>0?l(Y[0],J):"",...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X};case"split":return{step:{op:"split",str:Z,sep:Y.length>0?l(Y[0],J):"",...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}return J.warnings.push({message:`Unknown method '${Q}' - treating as atom call`,line:0,column:0}),{step:{op:Q,receiver:Z,args:Y.map((W)=>l(W,J)),...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}function PZ(Q,Z,Y,J){let X="",K={};for(let W=0;W<Q.quasis.length;W++)if(X+=Q.quasis[W].value.cooked||Q.quasis[W].value.raw,W<Q.expressions.length){let H=Q.expressions[W],G=`_${W}`;K[G]=l(H,Z),X+=`{{${G}}}`}return{step:{op:"template",tmpl:X,vars:K,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function g(Q,Z){switch(Q.type){case"Literal":return{$expr:"literal",value:Q.value};case"Identifier":return{$expr:"ident",name:Q.name};case"MemberExpression":{let Y=Q,J=g(Y.object,Z),X=Y.optional===!0;if(Y.computed){let W=Y.property;if(W.type==="Literal")return{$expr:"member",object:J,property:String(W.value),computed:!0,...X&&{optional:!0}};throw new h("Computed member access with variables not yet supported",m(Q),Z.source,Z.filename)}let K=Y.property.name;return{$expr:"member",object:J,property:K,...X&&{optional:!0}}}case"ChainExpression":return g(Q.expression,Z);case"BinaryExpression":{let Y=Q;return{$expr:"binary",op:Y.operator,left:g(Y.left,Z),right:g(Y.right,Z)}}case"LogicalExpression":{let Y=Q;return{$expr:"logical",op:Y.operator,left:g(Y.left,Z),right:g(Y.right,Z)}}case"UnaryExpression":{let Y=Q;return{$expr:"unary",op:Y.operator,argument:g(Y.argument,Z)}}case"ConditionalExpression":{let Y=Q;return{$expr:"conditional",test:g(Y.test,Z),consequent:g(Y.consequent,Z),alternate:g(Y.alternate,Z)}}case"ArrayExpression":return{$expr:"array",elements:Q.elements.filter((J)=>J!==null).map((J)=>g(J,Z))};case"ObjectExpression":{let Y=Q,J=[];for(let X of Y.properties)if(X.type==="Property"){let K=X.key.type==="Identifier"?X.key.name:String(X.key.value);J.push({key:K,value:g(X.value,Z)})}return{$expr:"object",properties:J}}case"CallExpression":{let Y=Q;if(Y.callee.type==="MemberExpression"){let J=Y.callee,X=J.property.type==="Identifier"?J.property.name:String(J.property.value),K=J.optional===!0||Y.optional===!0;return{$expr:"methodCall",object:g(J.object,Z),method:X,arguments:Y.arguments.map((W)=>g(W,Z)),...K&&{optional:!0}}}if(Y.callee.type==="Identifier")return{$expr:"call",callee:Y.callee.name,arguments:Y.arguments.map((X)=>g(X,Z))};throw new h("Complex function calls in expressions should be lifted to statements",m(Q),Z.source,Z.filename)}case"NewExpression":{let Y=Q,J="constructor";if(Y.callee.type==="Identifier")J=Y.callee.name;let X=h8(J);throw new h(`The 'new' keyword is not supported in AsyncJS.${X}`,m(Q),Z.source,Z.filename)}case"TemplateLiteral":throw new h("Template literals inside expressions are not supported. Assign to a variable first: const msg = `hello ${name}`; then use msg",m(Q),Z.source,Z.filename);default:throw new h(`Unsupported expression type in condition: ${Q.type}`,m(Q),Z.source,Z.filename)}}function l(Q,Z){switch(Q.type){case"Literal":return Q.value;case"Identifier":return Q.name;case"MemberExpression":{let Y=Q;if(Y.optional===!0)return g(Q,Z);let X=l(Y.object,Z);if(X&&typeof X==="object"&&X.$expr){let W=Y.computed?String(Y.property.value):Y.property.name;return{$expr:"member",object:X,property:W,...Y.computed&&{computed:!0}}}if(Y.computed)return`${X}[${l(Y.property,Z)}]`;let K=Y.property.name;if(typeof X==="string")return`${X}.${K}`;if(X&&X.$kind==="arg")return{$kind:"arg",path:`${X.path}.${K}`};return`${X}.${K}`}case"ChainExpression":return l(Q.expression,Z);case"ArrayExpression":return Q.elements.map((Y)=>Y?l(Y,Z):null);case"ObjectExpression":{let Y={};for(let J of Q.properties)if(J.type==="Property"){let X=J.key.type==="Identifier"?J.key.name:String(J.key.value);Y[X]=l(J.value,Z)}return Y}case"TemplateLiteral":return g(Q,Z);case"CallExpression":return g(Q,Z);case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"ConditionalExpression":return g(Q,Z);default:return null}}function CZ(Q,Z){if(Q.arguments.length===1&&Q.arguments[0].type==="ObjectExpression"){let Y=Q.arguments[0],J={};for(let X of Y.properties)if(X.type==="Property"){let K=X.key.type==="Identifier"?X.key.name:String(X.key.value);J[K]=l(X.value,Z)}return J}return{args:Q.arguments.map((Y)=>l(Y,Z))}}function m8(Q,Z={}){let{ast:Y,returnType:J,originalSource:X,requiredParams:K}=S8(Q,{filename:Z.filename,colonShorthand:!0,vmTarget:!0}),W=E8(Y,Z.filename),{ast:H,signature:G,warnings:_}=g8(W,X,J,Z,K);return{ast:H,signature:G,warnings:_}}var TZ=10;class SZ{atoms;constructor(Q={}){this.atoms={...y1,...Q}}get builder(){return new c(this.atoms)}get Agent(){return new c(this.atoms)}get A99(){return this.Agent}resolve(Q){return this.atoms[Q]}getTools(Q="all"){let Z=Object.values(this.atoms);if(Array.isArray(Q))Z=Z.filter((Y)=>Q.includes(Y.op));else if(Q==="flow"){let Y=["seq","if","while","return","try","varSet","varGet","scope"];Z=Z.filter((J)=>Y.includes(J.op))}return Z.map((Y)=>({type:"function",function:{name:Y.op,description:Y.docs,parameters:Y.inputSchema?.schema??{}}}))}async run(Q,Z={},Y={}){let J;if(typeof Q==="string")if(W1(Q))J=K1(Q);else try{J=m8(Q).ast}catch($){throw Error(`AJS transpilation failed: ${$.message}`)}else J=Q;let X=Y.fuel??1000,K=Y.timeoutMs??X*TZ,W=Y.capabilities??{},H=[];if(!W.store){let $=new Map,M=!1;W.store={get:async(L)=>{if(!M)M=!0,H.push("Using default in-memory store (not suitable for production)");return $.get(L)},set:async(L,B)=>{if(!M)M=!0,H.push("Using default in-memory store (not suitable for production)");$.set(L,B)}}}let G=new AbortController,_=setTimeout(()=>G.abort(),K);if(Y.signal)Y.signal.addEventListener("abort",()=>G.abort());let F={fuel:{current:X},args:Z,state:{},consts:new Set,capabilities:W,resolver:($)=>this.resolve($),output:void 0,signal:G.signal,costOverrides:Y.costOverrides,context:Y.context,warnings:H};if(Y.trace)F.trace=[];if(J.op!=="seq")throw Error("Root AST must be 'seq'. Ensure you're passing a transpiled agent (use ajs`...` or transpile()).");let O=J.inputSchema;if(O&&!bZ(Z,O)){let $=new o("Input validation failed: args do not match expected schema","vm.run");return{result:$,error:$,fuelUsed:0,trace:F.trace,warnings:H.length>0?H:void 0}}try{await Promise.race([this.resolve("seq")?.exec(J,F),new Promise(($,M)=>{if(G.signal.addEventListener("abort",()=>{M(Error(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))}),G.signal.aborted)M(Error(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))})])}catch($){if($.message?.includes("timeout")||$.message?.includes("aborted")||G.signal.aborted)F.error=new o(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`,"vm.run");else throw $}finally{clearTimeout(_)}if(F.error&&F.output===void 0)F.output=F.error;let R=[...H,...F.warnings??[]];return{result:F.output,error:F.error,fuelUsed:X-F.fuel.current,trace:F.trace,warnings:R.length>0?R:void 0}}}import{s as D}from"tosijs-schema";var x8=A("storeVectorize",D.object({text:D.string,model:D.string.optional}),D.array(D.number),async({text:Q},Z)=>{let Y=Z.capabilities.vector;if(!Y)throw Error("Capability 'vector' missing. Ensure vector battery is loaded.");let J=U(Q,Z);return Y.embed(J)},{docs:"Generate embeddings using vector battery",cost:20}),u8=A("storeCreateCollection",D.object({collection:D.string,dimension:D.number.optional}),void 0,async({collection:Q,dimension:Z},Y)=>{let J=Y.capabilities.store;if(!J?.createCollection)throw Error("Capability 'store' missing or does not support createCollection.");let X=U(Q,Y),K=U(Z,Y);return J.createCollection(X,void 0,K)},{docs:"Create a vector store collection",cost:5}),d8=A("storeVectorAdd",D.object({collection:D.string,doc:D.any}),void 0,async({collection:Q,doc:Z},Y)=>{let J=Y.capabilities.store;if(!J?.vectorAdd)throw Error("Capability 'store' missing or does not support vectorAdd.");let X=U(Q,Y),K=U(Z,Y);return J.vectorAdd(X,K)},{docs:"Add a document to a vector store collection",cost:5}),l8=A("storeSearch",D.object({collection:D.string,queryVector:D.array(D.number),k:D.number.optional,filter:D.record(D.any).optional}),D.array(D.any),async({collection:Q,queryVector:Z,k:Y,filter:J},X)=>{let K=X.capabilities.store;if(!K?.vectorSearch)throw Error("Capability 'store' missing or does not support vectorSearch.");let W=U(Q,X),H=U(Z,X),G=U(Y,X)??5,_=U(J,X);return K.vectorSearch(W,H,G,_)},{docs:"Search vector store",cost:(Q,Z)=>5+(U(Q.k,Z)??5)}),p8=A("llmPredictBattery",D.object({system:D.string.optional,user:D.string,tools:D.array(D.any).optional,responseFormat:D.any.optional}),D.object({role:D.string.optional,content:D.string.optional,tool_calls:D.array(D.any).optional}),async({system:Q,user:Z,tools:Y,responseFormat:J},X)=>{let K=X.capabilities.llmBattery;if(!K?.predict)throw Error("Capability 'llmBattery' missing or invalid.");let W=U(Q,X)??"You are a helpful agent.",H=U(Z,X),G=U(Y,X),_=U(J,X);return K.predict(W,H,G,_)},{docs:"Generate completion using LLM battery",cost:100}),i8=A("llmVision",D.object({system:D.string.optional,prompt:D.string,images:D.array(D.string),responseFormat:D.any.optional}),D.object({role:D.string.optional,content:D.string.optional,tool_calls:D.array(D.any).optional}),async({system:Q,prompt:Z,images:Y,responseFormat:J},X)=>{let K=X.capabilities.llmBattery;if(!K?.predict)throw Error("Capability 'llmBattery' missing or invalid.");let W=U(Q,X)??"You analyze images accurately and concisely.",H=U(Z,X),G=U(Y,X)??[],_=U(J,X);return K.predict(W,{text:H,images:G},void 0,_)},{docs:"Analyze images using a vision model",timeoutMs:120000,cost:150});var W6={storeCreateCollection:u8,storeSearch:l8,storeVectorAdd:d8,storeVectorize:x8,llmPredictBattery:p8,llmVision:i8};export{u9 as xmlParse,X9 as whileLoop,v9 as vectorSearch,F9 as varsLet,q9 as varsImport,R9 as varsExport,z9 as varSet,_9 as varGet,i9 as uuid,K9 as tryCatch,f9 as transpileCode,A9 as template,E9 as storeSet,k9 as storeQuery,o9 as storeProcedure,S9 as storeGet,N9 as split,s as seq,$9 as scope,h9 as runCode,W9 as ret,U as resolveValue,K1 as resolveProcedureToken,s9 as releaseProcedure,w9 as regexMatch,M9 as reduce,p9 as random,B9 as push,w0 as procedureStore,D9 as pick,V9 as omit,P9 as merge,d9 as memoize,O9 as map,y9 as llmPredict,j9 as len,C9 as keys,x9 as jsonStringify,m9 as jsonParse,L9 as join,W1 as isProcedureToken,kZ as isAgentError,J9 as iff,H1 as hash,I9 as find,U9 as filter,T9 as fetch,x as evaluateExpr,H9 as errorAtom,A as defineAtom,$0 as createChildScope,y1 as coreAtoms,G9 as constSet,n9 as consoleWarn,c9 as consoleLog,a9 as consoleError,r9 as clearExpiredProcedures,l9 as cache,G0 as builtins,W6 as batteryAtoms,g9 as agentRun,X1 as PROCEDURE_TOKEN_PREFIX,a8 as DEFAULT_PROCEDURE_TTL,o8 as DEFAULT_MAX_AST_SIZE,SZ as AgentVM,o as AgentError};
23
23
 
24
- //# debugId=0D3FEE0D51E660AF64756E2164756E21
24
+ //# debugId=1A03EE85AA598C3764756E2164756E21