tjs-lang 0.6.38 → 0.6.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tjs-vm.js CHANGED
@@ -1,54 +1,55 @@
1
- import{s as $,validate as O1,filter as p1}from"tosijs-schema";var p0=Symbol.for("tjs.equals");function n0(Z,Q){if(Z!==null&&typeof Z==="object"&&typeof Z[p0]==="function")return Z[p0](Q);if(Q!==null&&typeof Q==="object"&&typeof Q[p0]==="function")return Q[p0](Z);if(Z!==null&&typeof Z==="object"&&typeof Z.Equals==="function")return Z.Equals(Q);if(Q!==null&&typeof Q==="object"&&typeof Q.Equals==="function")return Q.Equals(Z);if(Z===Q)return!0;if((Z===null||Z===void 0)&&(Q===null||Q===void 0))return!0;if(Z===null||Z===void 0||Q===null||Q===void 0)return!1;if(typeof Z!==typeof Q)return!1;if(typeof Z!=="object")return!1;if(Array.isArray(Z)&&Array.isArray(Q)){if(Z.length!==Q.length)return!1;return Z.every((X,K)=>n0(X,Q[K]))}if(Array.isArray(Z)!==Array.isArray(Q))return!1;let Y=Object.keys(Z),J=Object.keys(Q);if(Y.length!==J.length)return!1;return Y.every((X)=>n0(Z[X],Q[X]))}class o{$error=!0;message;op;cause;constructor(Z,Q,Y){this.message=Z,this.op=Q,this.cause=Y}toString(){return`AgentError[${this.op}]: ${this.message}`}toJSON(){return{$error:!0,message:this.message,op:this.op}}}function P9(Z){return Z instanceof o||Z&&Z.$error===!0}var C0=new Map,S9=3600000,b9=102400,U1="proc_";function I1(Z){return typeof Z==="string"&&Z.startsWith(U1)}function M1(Z){let Q=C0.get(Z);if(!Q)throw Error(`Procedure not found: ${Z}`);if(Date.now()>Q.expiresAt)throw C0.delete(Z),Error(`Procedure expired: ${Z}`);return Q.ast}function E9(){if(typeof crypto<"u"&&crypto.randomUUID)return U1+crypto.randomUUID();return U1+Math.random().toString(36).slice(2)+Date.now().toString(36)}var i1=new Set(["__proto__","constructor","prototype"]);function h1(Z){if(i1.has(Z))throw Error(`Security Error: Access to '${Z}' is forbidden`)}var v9=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","metadata.google.internal"]);function k9(Z){try{let Q=new URL(Z);if(Q.protocol!=="http:"&&Q.protocol!=="https:")return!0;let Y=Q.hostname.toLowerCase();if(v9.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 g9(Z){if(/\([^)]*[+*][^)]*\)[+*]/.test(Z))return!0;if(/\(([^|)]+)\|\1\)[+*]/.test(Z))return!0;if(/\(\.\*\)\+/.test(Z))return!0;if(/\(\.\+\)\+/.test(Z))return!0;if(/\(\[.*\]\+\)\+/.test(Z))return!0;return!1}function B0(Z){return{...Z,state:Object.create(Z.state)}}function y9(Z,Q){let Y={},J=new Set([...Object.keys(Z),...Object.keys(Q)]);for(let X of J){let K=Z[X],W=Q[X];if(W!==K)Y[X]=W}return Y}function M(Z,Q){if(Z&&typeof Z==="object"&&Z.$kind==="arg")return Q.args[Z.path];if(Z&&typeof Z==="object"&&Z.$expr)return d(Z,Q);if(typeof Z==="string"){if(Z.startsWith("args.")&&!("args"in Q.state))return Q.args[Z.replace("args.","")];if(Z.includes(".")){let Y=Z.split(".");for(let X of Y)if(i1.has(X))throw Error(`Security Error: Access to '${X}' is forbidden`);let J=Q.state[Y[0]];if(J!==void 0){for(let X=1;X<Y.length;X++)J=J?.[Y[X]];return J}}if(Z in Q.state)return Q.state[Z];return Z}if(Z&&typeof Z==="object"&&!Array.isArray(Z)&&Z.constructor===Object){let Y={};for(let J of Object.keys(Z))Y[J]=M(Z[J],Q);return Y}if(Array.isArray(Z))return Z.map((Y)=>M(Y,Q));return Z}function w0(Z,Q,Y){return new Proxy(Q,{get(J,X){if(X in J)return J[X];let K=Y?.[X];if(K)throw Error(`${Z}.${X} is not available. ${K}`);throw Error(`${Z}.${X} is not supported in AsyncJS. Check docs for available ${Z} methods.`)}})}function T0(Z){if(Z===null)return{type:"null"};if(Z===void 0)return{};if(typeof Z==="object"&&Z!==null&&"type"in Z&&typeof Z.type==="string")return Z;if(typeof Z==="object"&&Z!==null&&"schema"in Z&&typeof Z.schema==="object")return Z.schema;let Q=typeof Z;if(Q==="string")return{type:"string"};if(Q==="number")return Number.isInteger(Z)?{type:"integer"}:{type:"number"};if(Q==="boolean")return{type:"boolean"};if(Array.isArray(Z)){if(Z.length===0)return{type:"array"};return{type:"array",items:T0(Z[0])}}if(Q==="object"){let Y={},J=[];for(let[X,K]of Object.entries(Z))Y[X]=T0(K),J.push(X);return{type:"object",properties:Y,required:J}}return{}}var R0={Math:w0("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 Z=new Uint32Array(1);return crypto.getRandomValues(Z),Z[0]/4294967296}return Math.random()}}),JSON:w0("JSON",{parse:(Z)=>JSON.parse(Z),stringify:(Z,Q,Y)=>JSON.stringify(Z,Q,Y)}),console:w0("console",{log:(...Z)=>{return},warn:(...Z)=>{return},error:(...Z)=>{return},info:(...Z)=>{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:w0("Array",{isArray:(Z)=>Array.isArray(Z),from:(Z,Q,Y)=>Array.from(Z,Q,Y),of:(...Z)=>Array.of(...Z)},{prototype:"Prototype access is not allowed."}),Object:w0("Object",{keys:(Z)=>Object.keys(Z),values:(Z)=>Object.values(Z),entries:(Z)=>Object.entries(Z),fromEntries:(Z)=>Object.fromEntries(Z),assign:(Z,...Q)=>Object.assign({},Z,...Q),hasOwn:(Z,Q)=>Object.hasOwn(Z,Q)},{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:w0("String",{fromCharCode:(...Z)=>String.fromCharCode(...Z),fromCodePoint:(...Z)=>String.fromCodePoint(...Z)}),Number:w0("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:(Z,Q)=>{let Y=T0(Q),J=p1(Z,Y);if(J instanceof Error)throw J;return J},Schema:{...$,response:(Z,Q)=>{let Y=Q?.schema!=null?Q.schema:T0(Q);return{type:"json_schema",json_schema:{name:Z,strict:!0,schema:Y}}},fromExample:(Z)=>T0(Z),isValid:(Z,Q)=>{if(Q?.schema!=null)return O1(Z,Q);return O1(Z,T0(Q))}},Set:(Z=[])=>{let Q=[...new globalThis.Set(Z)];return{add(Y){if(!Q.includes(Y))Q.push(Y);return this},remove(Y){let J=Q.indexOf(Y);if(J!==-1)Q.splice(J,1);return this},clear(){return Q.length=0,this},has(Y){return Q.includes(Y)},get size(){return Q.length},toArray(){return[...Q]},union(Y){let J=Y?.toArray?.()??Y??[];return R0.Set([...Q,...J])},intersection(Y){let J=Y?.toArray?.()??Y??[];return R0.Set(Q.filter((X)=>J.includes(X)))},diff(Y){let J=Y?.toArray?.()??Y??[];return R0.Set(Q.filter((X)=>!J.includes(X)))},forEach(Y){Q.forEach(Y)},map(Y){return R0.Set(Q.map(Y))},filter(Y){return R0.Set(Q.filter(Y))},toJSON(){return[...Q]}}},Date:(()=>{let Z=(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:z=0,ms:_=0}={}){let q=new globalThis.Date(Y.getTime());if(J)q.setFullYear(q.getFullYear()+J);if(X)q.setMonth(q.getMonth()+X);if(K)q.setDate(q.getDate()+K);if(W)q.setHours(q.getHours()+W);if(H)q.setMinutes(q.getMinutes()+H);if(z)q.setSeconds(q.getSeconds()+z);if(_)q.setMilliseconds(q.getMilliseconds()+_);return Z(q)},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()}}),Q=(Y)=>{let J=Y!==void 0?new globalThis.Date(Y):new globalThis.Date;if(isNaN(J.getTime()))throw Error(`Invalid date: ${Y}`);return Z(J)};return Q.now=()=>globalThis.Date.now(),Q.parse=(Y)=>Z(new globalThis.Date(Y)),Q})()},i0={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."},f9=0.01,x1=0.0001,m1=0.001,h9=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 d(Z,Q){if(Z===null||Z===void 0)return Z;if(typeof Z!=="object"||!("$expr"in Z))return Z;if(Q.fuel){if(Q.fuel.current-=f9,Q.fuel.current<=0)throw Error("Out of Fuel")}switch(Z.$expr){case"literal":return Z.value;case"ident":{if(Z.name in Q.state)return Q.state[Z.name];if(Z.name in Q.args)return Q.args[Z.name];if(Z.name in R0)return R0[Z.name];if(Z.name in i0)throw Error(i0[Z.name]);return}case"member":{let Y=d(Z.object,Q);if(Z.optional&&(Y===null||Y===void 0))return;let J=Z.property;return h1(J),Y?.[J]}case"binary":{let Y=d(Z.left,Q),J=d(Z.right,Q);switch(Z.op){case"+":{let X=Y+J;if(typeof X==="string"&&Q.fuel){if(Q.fuel.current-=X.length*x1,Q.fuel.current<=0){Q.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 n0(Y,J);case"!=":return!n0(Y,J);case"===":return Y===J;case"!==":return Y!==J;default:throw Error(`Unknown binary operator: ${Z.op}`)}}case"unary":{let Y=d(Z.argument,Q);switch(Z.op){case"!":return!Y;case"-":return-Y;case"+":return+Y;case"typeof":return typeof Y;default:throw Error(`Unknown unary operator: ${Z.op}`)}}case"logical":{let Y=d(Z.left,Q);if(Z.op==="&&")return Y?d(Z.right,Q):Y;else if(Z.op==="??")return Y??d(Z.right,Q);else return Y?Y:d(Z.right,Q)}case"conditional":return d(Z.test,Q)?d(Z.consequent,Q):d(Z.alternate,Q);case"array":return Z.elements.map((Y)=>d(Y,Q));case"object":{let Y={};for(let J of Z.properties)Y[J.key]=d(J.value,Q);return Y}case"call":{if(Z.callee==="Error"){let J=Z.arguments.map((K)=>d(K,Q)),X=typeof J[0]==="string"?J[0]:"Error";Q.error=new o(X,"Error");return}if(Z.callee in R0){let J=R0[Z.callee];if(typeof J==="function"){let X=Z.arguments.map((K)=>d(K,Q));return J(...X)}}if(!Q.resolver(Z.callee)){if(Z.callee in i0)throw Error(i0[Z.callee]);throw Error(`Unknown function: ${Z.callee}`)}throw Error(`Atom calls in expressions not yet supported: ${Z.callee}`)}case"methodCall":{let Y=d(Z.object,Q);if(Z.optional&&(Y===null||Y===void 0))return;let J=Z.method;if(h1(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=Z.arguments.map((H)=>d(H,Q)),W=X.apply(Y,K);if(Q.fuel&&h9.has(J)){let H=0;if(typeof W==="string")H=W.length*x1;else if(Array.isArray(W))H=W.length*m1;else if(typeof W==="object"&&W!==null)H=Object.keys(W).length*m1;if(Q.fuel.current-=H,Q.fuel.current<=0){Q.error=new o("Out of Fuel",`expr.${J}`);return}}return W}default:throw Error(`Unknown expression type: ${Z.$expr}`)}}function C(Z,Q,Y,J,X={}){let{docs:K="",timeoutMs:W=1000,cost:H=1}=typeof X==="string"?{docs:X}:X;return{op:Z,inputSchema:Q,outputSchema:Y,exec:async(_,q)=>{let{op:R,result:F,...O}=_;if(q.error)return;let U=q.trace?{...q.state}:null,N=q.fuel.current,L,B;try{let w=q.costOverrides?.[Z],I=w!==void 0?w:H,j=typeof I==="function"?I(O,q):I;if((q.fuel.current-=j)<=0){q.error=new o("Out of Fuel",Z);return}let E,P=async()=>J(_,q);if(L=W>0?await Promise.race([P(),new Promise((A,T)=>{E=setTimeout(()=>T(Error(`Atom '${Z}' timed out`)),W)})]).finally(()=>clearTimeout(E)):await P(),_.result){if(q.consts.has(_.result))throw Error(`Cannot reassign const variable '${_.result}'`);if(L!==void 0&&Y&&!O1(L,Y)){q.error=new o(`Output validation failed for '${Z}'`,Z);return}if(q.state[_.result]=L,_.resultConst)q.consts.add(_.result)}}catch(w){B=w.message||String(w),q.error=new o(B,Z,w)}finally{if(q.trace&&U){let w=y9(U,q.state);q.trace.push({op:Z,input:O,stateDiff:w,result:L,error:B,fuelBefore:N,fuelAfter:q.fuel.current,timestamp:new Date().toISOString()})}}},docs:K,timeoutMs:W,cost:H,create:(_)=>({op:Z,..._})}}var Q0=C("seq",$.object({steps:$.array($.any)}),void 0,async({steps:Z},Q)=>{for(let Y of Z){if(Q.output!==void 0)return;if(Q.error)return;let J=Q.resolver(Y.op);if(!J)throw Error(`Unknown Atom: ${Y.op}`);await J.exec(Y,Q)}},{docs:"Sequence",timeoutMs:0,cost:0.1}),x9=C("if",$.object({condition:$.any,then:$.array($.any),else:$.array($.any).optional}),void 0,async(Z,Q)=>{if(d(Z.condition,Q))await Q0.exec({op:"seq",steps:Z.then},Q);else if(Z.else)await Q0.exec({op:"seq",steps:Z.else},Q)},{docs:"If/Else",timeoutMs:0,cost:0.1}),m9=C("while",$.object({condition:$.any,body:$.array($.any)}),void 0,async(Z,Q)=>{while(d(Z.condition,Q)){if(Q.signal?.aborted)throw Error("Execution aborted");if((Q.fuel.current-=0.1)<=0)throw Error("Out of Fuel");if(await Q0.exec({op:"seq",steps:Z.body},Q),Q.output!==void 0)return}},{docs:"While Loop",timeoutMs:0,cost:0.1}),u9=C("return",void 0,$.any,async(Z,Q)=>{if(Q.error)return Q.output=Q.error,Q.error;if("value"in Z){let J=M(Z.value,Q);if(J!==void 0&&J!==null&&!P9(J)&&(typeof J!=="object"||Array.isArray(J))){let X=new o(`Agent must return an object, got ${Array.isArray(J)?"array":typeof J}`,"return");return Q.error=X,Q.output=X,X}return Q.output=J,J}let Y={};if(Z.schema?.properties){for(let J of Object.keys(Z.schema.properties))Y[J]=Q.state[J];if(Z.filter!==!1){let J=p1(Y,Z.schema);if(!(J instanceof Error))Y=J}}return Q.output=Y,Y},{docs:"Return",cost:0.1}),l9=C("try",$.object({try:$.array($.any),catch:$.array($.any).optional,catchParam:$.string.optional}),void 0,async(Z,Q)=>{if(await Q0.exec({op:"seq",steps:Z.try},Q),Q.error&&Z.catch){let Y=Z.catchParam||"error";Q.state[Y]=Q.error.message,Q.state.errorOp=Q.error.op,Q.error=void 0,await Q0.exec({op:"seq",steps:Z.catch},Q)}},{docs:"Try/Catch",timeoutMs:0,cost:0.1}),d9=C("Error",$.object({args:$.array($.any).optional}),void 0,async(Z,Q)=>{let Y=Z.args?.[0]??"Error";Q.error=new o(String(Y),"Error")},{docs:"Trigger error flow",cost:0.1}),p9=C("varSet",$.object({key:$.string,value:$.any}),void 0,async({key:Z,value:Q},Y)=>{if(Y.consts.has(Z))throw Error(`Cannot reassign const variable '${Z}'`);Y.state[Z]=M(Q,Y)},{docs:"Set Variable",cost:0.1}),i9=C("constSet",$.object({key:$.string,value:$.any}),void 0,async({key:Z,value:Q},Y)=>{if(Y.consts.has(Z))throw Error(`Cannot reassign const variable '${Z}'`);if(Z in Y.state)throw Error(`Cannot redeclare variable '${Z}' as const`);Y.state[Z]=M(Q,Y),Y.consts.add(Z)},{docs:"Set Const Variable (immutable)",cost:0.1}),n9=C("varGet",$.object({key:$.string}),$.any,async({key:Z},Q)=>{return M(Z,Q)},{docs:"Get Variable",cost:0.1}),c9=C("varsImport",$.object({keys:$.union([$.array($.string),$.record($.string)])}),void 0,async({keys:Z},Q)=>{if(Array.isArray(Z))for(let Y of Z)Q.state[Y]=M({$kind:"arg",path:Y},Q);else for(let[Y,J]of Object.entries(Z))Q.state[Y]=M({$kind:"arg",path:J},Q)},{docs:"Import variables from args into the current scope, with optional renaming.",cost:0.2}),o9=C("varsLet",$.record($.any),void 0,async(Z,Q)=>{for(let Y of Object.keys(Z)){if(Y==="op"||Y==="result")continue;Q.state[Y]=M(Z[Y],Q)}},{docs:"Initialize a set of variables in the current scope from the step object properties.",cost:0.1}),a9=C("varsExport",$.object({keys:$.union([$.array($.string),$.record($.string)])}),$.record($.any),async({keys:Z},Q)=>{let Y={};if(Array.isArray(Z))for(let J of Z)Y[J]=M(J,Q);else for(let[J,X]of Object.entries(Z))Y[J]=M(X,Q);return Y},{docs:"Export variables from the current scope, with optional renaming.",cost:0.2}),s9=C("scope",$.object({steps:$.array($.any)}),void 0,async({steps:Z},Q)=>{let Y=B0(Q);if(await Q0.exec({op:"seq",steps:Z},Y),Y.output!==void 0)Q.output=Y.output},{docs:"Create new scope",timeoutMs:0,cost:0.1}),r9=C("map",$.object({items:$.array($.any),as:$.string,steps:$.array($.any)}),$.array($.any),async({items:Z,as:Q,steps:Y},J)=>{let X=[],K=M(Z,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=B0(J);H.state[Q]=W,await Q0.exec({op:"seq",steps:Y},H),X.push(H.state.result??null)}return X},{docs:"Map Array",timeoutMs:0,cost:1}),t9=C("filter",$.object({items:$.array($.any),as:$.string,condition:$.any}),$.array($.any),async({items:Z,as:Q,condition:Y},J)=>{let X=[],K=M(Z,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=B0(J);if(H.state[Q]=W,d(Y,H))X.push(W)}return X},{docs:"Filter Array",timeoutMs:0,cost:1}),e9=C("reduce",$.object({items:$.array($.any),as:$.string,accumulator:$.string,initial:$.any,steps:$.array($.any)}),$.any,async({items:Z,as:Q,accumulator:Y,initial:J,steps:X},K)=>{let W=M(Z,K),H=M(J,K);if(!Array.isArray(W))throw Error("reduce: items is not an array");let z=H;for(let _ of W){if(K.signal?.aborted)throw Error("Execution aborted");let q=B0(K);q.state[Q]=_,q.state[Y]=z,await Q0.exec({op:"seq",steps:X},q),z=q.state.result??z}return z},{docs:"Reduce Array",timeoutMs:0,cost:1}),ZZ=C("find",$.object({items:$.array($.any),as:$.string,condition:$.any}),$.any,async({items:Z,as:Q,condition:Y},J)=>{let X=M(Z,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=B0(J);if(W.state[Q]=K,d(Y,W))return K}return null},{docs:"Find in Array",timeoutMs:0,cost:1}),QZ=C("push",$.object({list:$.array($.any),item:$.any}),$.array($.any),async({list:Z,item:Q},Y)=>{let J=M(Z,Y),X=M(Q,Y);if(Array.isArray(J))J.push(X);return J},{docs:"Push to Array",cost:1}),YZ=C("len",$.object({list:$.any}),$.number,async({list:Z},Q)=>{let Y=M(Z,Q);return Array.isArray(Y)||typeof Y==="string"?Y.length:0},{docs:"Length",cost:1}),JZ=C("split",$.object({str:$.string,sep:$.string}),$.array($.string),async({str:Z,sep:Q},Y)=>M(Z,Y).split(M(Q,Y)),{docs:"Split String",cost:1}),XZ=C("join",$.object({list:$.array($.string),sep:$.string}),$.string,async({list:Z,sep:Q},Y)=>M(Z,Y).join(M(Q,Y)),{docs:"Join String",cost:1}),WZ=C("template",$.object({tmpl:$.string,vars:$.record($.any)}),$.string,async({tmpl:Z,vars:Q},Y)=>{return M(Z,Y).replace(/\{\{(\w+)\}\}/g,(X,K)=>String(M(Q[K],Y)??""))},{docs:"String Template",cost:1}),KZ=C("regexMatch",$.object({pattern:$.string,value:$.any}),$.boolean,async({pattern:Z,value:Q},Y)=>{if(g9(Z))throw Error(`Suspicious regex pattern rejected (potential ReDoS): ${Z}`);let J=M(Q,Y);return new RegExp(Z).test(J)},{docs:"Returns true if the value matches the regex pattern.",cost:2}),HZ=C("pick",$.object({obj:$.record($.any),keys:$.array($.string)}),$.record($.any),async({obj:Z,keys:Q},Y)=>{let J=M(Z,Y),X=M(Q,Y),K={};if(J&&Array.isArray(X))X.forEach((W)=>K[W]=J[W]);return K},{docs:"Pick Keys",cost:1}),zZ=C("omit",$.object({obj:$.record($.any),keys:$.array($.string)}),$.record($.any),async({obj:Z,keys:Q},Y)=>{let J=M(Z,Y),X=new Set(M(Q,Y)),K={};if(J)Object.keys(J).forEach((W)=>{if(!X.has(W))K[W]=J[W]});return K},{docs:"Omit Keys",cost:1}),GZ=C("merge",$.object({a:$.record($.any),b:$.record($.any)}),$.record($.any),async({a:Z,b:Q},Y)=>({...M(Z,Y),...M(Q,Y)}),{docs:"Merge Objects",cost:1}),_Z=C("keys",$.object({obj:$.record($.any)}),$.array($.string),async({obj:Z},Q)=>Object.keys(M(Z,Q)??{}),{docs:"Object Keys",cost:1}),u1=10,l1="X-Agent-Depth";function qZ(Z,Q){try{let J=new URL(Z).hostname.toLowerCase();for(let X of Q){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 FZ=C("httpFetch",$.object({url:$.string,method:$.string.optional,headers:$.record($.string).optional,body:$.any.optional,responseType:$.string.optional}),$.any,async(Z,Q)=>{let Y=M(Z.url,Q),J=M(Z.method,Q),X=M(Z.headers,Q)||{},K=M(Z.body,Q),W=M(Z.responseType,Q),H=Q.context?.requestDepth??0;if(H>=u1)throw Error(`Agent request depth exceeded (max ${u1}). This prevents recursive agent loops.`);if(Q.capabilities.fetch)return Q.capabilities.fetch(Y,{method:J,headers:{...X,[l1]:String(H+1)},body:K,signal:Q.signal,responseType:W});let z=Q.context?.allowedFetchDomains;if(z){if(!qZ(Y,z))throw Error(`Fetch blocked: domain not in allowlist. Allowed: ${z.join(", ")}`)}else{if(k9(Y))throw Error("Blocked URL: private/internal addresses not allowed in default fetch");try{let q=new URL(Y).hostname.toLowerCase();if(q!=="localhost"&&q!=="127.0.0.1"&&q!=="[::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,[l1]:String(H+1)},body:K?JSON.stringify(K):void 0,signal:Q.signal});if(W==="dataUrl"){let R=await _.arrayBuffer(),F=new Uint8Array(R),O="";for(let L=0;L<F.length;L++)O+=String.fromCharCode(F[L]);let U=btoa(O);return`data:${_.headers.get("content-type")||"application/octet-stream"};base64,${U}`}let q=_.headers.get("content-type");if(W==="json"||q&&q.includes("application/json"))return _.json();return _.text()}throw Error("Capability 'fetch' missing and no global fetch available")},{docs:"HTTP Fetch",timeoutMs:30000,cost:5}),$Z=C("storeGet",$.object({key:$.string}),$.any,async({key:Z},Q)=>{let Y=M(Z,Q);return Q.capabilities.store?.get(Y)},{docs:"Store Get",cost:5}),RZ=C("storeSet",$.object({key:$.string,value:$.any}),void 0,async({key:Z,value:Q},Y)=>{let J=M(Z,Y),X=M(Q,Y);return Y.capabilities.store?.set(J,X)},{docs:"Store Set",cost:5}),OZ=C("storeQuery",$.object({query:$.any}),$.array($.any),async({query:Z},Q)=>Q.capabilities.store?.query?.(M(Z,Q))??[],{docs:"Store Query",cost:5}),UZ=C("storeVectorSearch",$.object({collection:$.string.optional,vector:$.array($.number),k:$.number.optional}),$.array($.any),async({collection:Z,vector:Q,k:Y},J)=>J.capabilities.store?.vectorSearch?.(M(Z,J),M(Q,J),M(Y,J))??[],{docs:"Vector Search",cost:(Z,Q)=>5+(M(Z.k,Q)??5)}),IZ=C("llmPredict",$.object({prompt:$.string,options:$.any.optional}),$.string,async({prompt:Z,options:Q},Y)=>{if(!Y.capabilities.llm?.predict)throw Error("Capability 'llm.predict' missing");return Y.capabilities.llm.predict(M(Z,Y),M(Q,Y))},{docs:"LLM Predict",timeoutMs:120000,cost:100}),MZ=C("agentRun",$.object({agentId:$.any,input:$.any}),$.any,async({agentId:Z,input:Q},Y)=>{let J=M(Z,Y),X=M(Q,Y),K=X;if(X&&typeof X==="object"&&!Array.isArray(X)){K={};for(let H in X)K[H]=M(X[H],Y)}if(I1(J)){let H=M1(J),z={...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,z),z.error)throw Error(z.error.message||"Sub-agent failed");return z.output}if(J&&typeof J==="object"&&"op"in J){let H={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},z=Y.resolver("seq");if(!z)throw Error("seq atom not found");if(await z.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}),BZ=C("transpileCode",$.object({code:$.string}),$.any,async({code:Z},Q)=>{if(!Q.capabilities.code?.transpile)throw Error("Capability 'code.transpile' missing. Enable code transpilation by providing the code capability.");let Y=M(Z,Q);try{return Q.capabilities.code.transpile(Y)}catch(J){throw Error(`Code transpilation failed: ${J.message}`)}},{docs:"Transpile AsyncJS code to AST",cost:1}),d1=10,LZ=C("runCode",$.object({code:$.string,args:$.record($.any).optional}),$.any,async({code:Z,args:Q},Y)=>{let J=Y.runCodeDepth??0;if(J>=d1)throw Error(`runCode recursion limit exceeded (max ${d1}). 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=M(Z,Y),K=Q?M(Q,Y):{},W;try{W=Y.capabilities.code.transpile(X)}catch(z){throw Error(`Code transpilation failed: ${z.message}`)}if(W.op!=="seq")throw Error("Transpiled code must be a seq node");let H=B0(Y);if(H.args=K,H.output=void 0,H.runCodeDepth=J+1,await Q0.exec(W,H),H.error){Y.error=H.error;return}return H.output},{docs:"Run dynamically generated AsyncJS code",cost:1}),NZ=C("jsonParse",$.object({str:$.string}),$.any,async({str:Z},Q)=>JSON.parse(M(Z,Q)),{docs:"Parse JSON",cost:1}),jZ=C("jsonStringify",$.object({value:$.any}),$.string,async({value:Z},Q)=>JSON.stringify(M(Z,Q)),{docs:"Stringify JSON",cost:1}),wZ=C("xmlParse",$.object({str:$.string}),$.any,async({str:Z},Q)=>{if(!Q.capabilities.xml?.parse)throw Error("Capability 'xml.parse' missing");return Q.capabilities.xml.parse(M(Z,Q))},{docs:"Parse XML",cost:1}),AZ=C("memoize",$.object({key:$.string.optional,steps:$.array($.any)}),$.any,async({key:Z,steps:Q},Y)=>{if(!Y.memo)Y.memo=new Map;let J=M(Z,Y)??await B1.exec({value:Q,algorithm:"SHA-256"},Y);if(Y.memo.has(J))return Y.memo.get(J);let X=B0(Y);await Q0.exec({op:"seq",steps:Q},X);let K=X.output??X.state.result;return Y.memo.set(J,K),K},{docs:"Memoize steps result in memory",cost:1}),VZ=C("cache",$.object({key:$.string.optional,steps:$.array($.any),ttlMs:$.number.optional}),$.any,async({key:Z,steps:Q,ttlMs:Y},J)=>{if(!J.capabilities.store)throw Error("Capability 'store' missing for caching");let K=`cache:${M(Z,J)??await B1.exec({value:Q,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=B0(J);await Q0.exec({op:"seq",steps:Q},H);let z=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:z,_exp:_}),z},{docs:"Cache steps result in store with TTL",cost:5}),DZ=C("random",$.object({min:$.number.optional,max:$.number.optional,format:$.string.optional,length:$.number.optional}),$.any,async({min:Z,max:Q,format:Y,length:J},X)=>{let K=M(Y,X)??"float",W=M(J,X)??10,H=M(Z,X)??0,z=M(Q,X)??1;if(K==="base36"){let O="";if(typeof crypto<"u"&&crypto.getRandomValues){let U=new Uint8Array(W);crypto.getRandomValues(U);for(let N=0;N<W;N++)O+="0123456789abcdefghijklmnopqrstuvwxyz"[U[N]%36]}else for(let U=0;U<W;U++)O+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(Math.floor(Math.random()*36));return O}let _;if(typeof crypto<"u"&&crypto.getRandomValues){let F=new Uint32Array(1);crypto.getRandomValues(F),_=F[0]/4294967296}else _=Math.random();let q=z-H,R=_*q+H;if(K==="integer")return Math.floor(R);return R},{docs:"Generate Random",cost:1}),TZ=C("uuid",void 0,$.string,async()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();if(typeof crypto<"u"&&crypto.getRandomValues){let Z=new Uint8Array(16);crypto.getRandomValues(Z),Z[6]=Z[6]&15|64,Z[8]=Z[8]&63|128;let Q=Array.from(Z,(Y)=>Y.toString(16).padStart(2,"0")).join("");return`${Q.slice(0,8)}-${Q.slice(8,12)}-${Q.slice(12,16)}-${Q.slice(16,20)}-${Q.slice(20)}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(Z)=>{let Q=Math.random()*16|0;return(Z==="x"?Q:Q&3|8).toString(16)})},{docs:"Generate UUID",cost:1}),B1=C("hash",$.object({value:$.any,algorithm:$.string.optional}),$.string,async({value:Z,algorithm:Q},Y)=>{let J=typeof Z==="string"?Z:JSON.stringify(M(Z,Y)),X=M(Q,Y)||"SHA-256";if(typeof crypto<"u"&&crypto.subtle){let H=new TextEncoder().encode(J),z=await crypto.subtle.digest(X,H);return Array.from(new Uint8Array(z)).map((q)=>q.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}),CZ=C("consoleLog",$.object({message:$.any}),void 0,async({message:Z},Q)=>{let Y=M(Z,Q);if(Q.trace)Q.trace.push({op:"console.log",input:{message:Y},stateDiff:{},result:Y,fuelBefore:Q.fuel.current,fuelAfter:Q.fuel.current,timestamp:new Date().toISOString()})},{docs:"Log to trace",cost:0.1}),PZ=C("consoleWarn",$.object({message:$.any}),void 0,async({message:Z},Q)=>{let Y=M(Z,Q),J=typeof Y==="string"?Y:JSON.stringify(Y);if(!Q.warnings)Q.warnings=[];if(Q.warnings.push(J),Q.trace)Q.trace.push({op:"console.warn",input:{message:Y},stateDiff:{},result:Y,fuelBefore:Q.fuel.current,fuelAfter:Q.fuel.current,timestamp:new Date().toISOString()})},{docs:"Add warning",cost:0.1}),SZ=C("consoleError",$.object({message:$.any}),void 0,async({message:Z},Q)=>{let Y=M(Z,Q),J=typeof Y==="string"?Y:JSON.stringify(Y);Q.error=new o(J,"console.error")},{docs:"Emit error and stop",cost:0.1}),bZ=C("storeProcedure",$.object({ast:$.any,ttl:$.number.optional,maxSize:$.number.optional}),$.string,async({ast:Z,ttl:Q,maxSize:Y},J)=>{let X=M(Z,J),K=Q?M(Q,J):S9,W=Y?M(Y,J):b9;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 z=E9(),_=Date.now();return C0.set(z,{ast:X,createdAt:_,expiresAt:_+K}),z},{docs:"Store an AST and return a token for later execution",cost:1}),EZ=C("releaseProcedure",$.object({token:$.string}),$.boolean,async({token:Z},Q)=>{let Y=M(Z,Q);return C0.delete(Y)},{docs:"Release a stored procedure by token",cost:0.1}),vZ=C("clearExpiredProcedures",void 0,$.number,async()=>{let Z=Date.now(),Q=0;for(let[Y,J]of C0)if(Z>J.expiresAt)C0.delete(Y),Q++;return Q},{docs:"Clear all expired procedures and return count",cost:0.5}),n1={seq:Q0,if:x9,while:m9,return:u9,try:l9,Error:d9,varSet:p9,constSet:i9,varGet:n9,varsImport:c9,varsLet:o9,varsExport:a9,scope:s9,map:r9,filter:t9,reduce:e9,find:ZZ,push:QZ,len:YZ,split:JZ,join:XZ,template:WZ,regexMatch:KZ,pick:HZ,omit:zZ,merge:GZ,keys:_Z,httpFetch:FZ,storeGet:$Z,storeSet:RZ,storeQuery:OZ,storeVectorSearch:UZ,llmPredict:IZ,agentRun:MZ,transpileCode:BZ,runCode:LZ,jsonParse:NZ,jsonStringify:jZ,xmlParse:wZ,memoize:AZ,cache:VZ,random:DZ,uuid:TZ,hash:B1,consoleLog:CZ,consoleWarn:PZ,consoleError:SZ,storeProcedure:bZ,releaseProcedure:EZ,clearExpiredProcedures:vZ};var kZ=new Set(["true","false","null","undefined","and","or","not"]);function gZ(Z,Q){let Y=Z.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((z)=>!kZ.has(z)&&!(z in Q)&&!new RegExp(`\\b${z}\\s*\\(`).test(Y));if(H.length>0)console.warn(`[Agent99 Builder] Condition "${Z}" references variables not in vars mapping: ${H.join(", ")}. Add them to vars or use AsyncJS syntax (ajs\`...\`) which handles this automatically.`)}function c0(Z,Q){gZ(Z,Q);let Y=yZ(Z),J=r1(Y,0,Q);if(J.pos<Y.length){let X=Y.slice(J.pos).join(" ");throw Error(`Unsupported condition syntax near '${X}' in: ${Z}
2
- Supported: comparisons, &&, ||, !, arithmetic, member access (a.b), literals`)}return J.node}function yZ(Z){let Q=[],Y=0;while(Y<Z.length){while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y>=Z.length)break;if(Z[Y]==='"'||Z[Y]==="'"){let J=Z[Y++],X="";while(Y<Z.length&&Z[Y]!==J)if(Z[Y]==="\\"&&Y+1<Z.length)Y++,X+=Z[Y++];else X+=Z[Y++];Y++,Q.push(JSON.stringify(X));continue}if(Z.slice(Y,Y+2).match(/^(&&|\|\||==|!=|>=|<=)$/)){Q.push(Z.slice(Y,Y+2)),Y+=2;continue}if("+-*/%><!().?:[]".includes(Z[Y])){Q.push(Z[Y]),Y++;continue}if(/\d/.test(Z[Y])){let J="";while(Y<Z.length&&/[\d.]/.test(Z[Y]))J+=Z[Y++];Q.push(J);continue}if(/[a-zA-Z_]/.test(Z[Y])){let J="";while(Y<Z.length&&/[a-zA-Z0-9_]/.test(Z[Y]))J+=Z[Y++];Q.push(J);continue}Y++}return Q}function r1(Z,Q,Y){return fZ(Z,Q,Y)}function fZ(Z,Q,Y){let{node:J,pos:X}=c1(Z,Q,Y);while(Z[X]==="||"){X++;let{node:K,pos:W}=c1(Z,X,Y);J={$expr:"logical",op:"||",left:J,right:K},X=W}return{node:J,pos:X}}function c1(Z,Q,Y){let{node:J,pos:X}=o1(Z,Q,Y);while(Z[X]==="&&"){X++;let{node:K,pos:W}=o1(Z,X,Y);J={$expr:"logical",op:"&&",left:J,right:K},X=W}return{node:J,pos:X}}function o1(Z,Q,Y){let{node:J,pos:X}=a1(Z,Q,Y),K=["==","!=",">","<",">=","<="];while(K.includes(Z[X])){let W=Z[X++],{node:H,pos:z}=a1(Z,X,Y);J={$expr:"binary",op:W,left:J,right:H},X=z}return{node:J,pos:X}}function a1(Z,Q,Y){let{node:J,pos:X}=s1(Z,Q,Y);while(Z[X]==="+"||Z[X]==="-"){let K=Z[X++],{node:W,pos:H}=s1(Z,X,Y);J={$expr:"binary",op:K,left:J,right:W},X=H}return{node:J,pos:X}}function s1(Z,Q,Y){let{node:J,pos:X}=L1(Z,Q,Y);while(Z[X]==="*"||Z[X]==="/"||Z[X]==="%"){let K=Z[X++],{node:W,pos:H}=L1(Z,X,Y);J={$expr:"binary",op:K,left:J,right:W},X=H}return{node:J,pos:X}}function L1(Z,Q,Y){if(Z[Q]==="!"||Z[Q]==="-"){let J=Z[Q++],{node:X,pos:K}=L1(Z,Q,Y);return{node:{$expr:"unary",op:J,argument:X},pos:K}}return hZ(Z,Q,Y)}function hZ(Z,Q,Y){let J=Z[Q];if(J==="("){let{node:X,pos:K}=r1(Z,Q+1,Y);return{node:X,pos:K+1}}if(J&&J.startsWith('"'))return{node:{$expr:"literal",value:JSON.parse(J)},pos:Q+1};if(J&&/^\d/.test(J))return{node:{$expr:"literal",value:parseFloat(J)},pos:Q+1};if(J==="true")return{node:{$expr:"literal",value:!0},pos:Q+1};if(J==="false")return{node:{$expr:"literal",value:!1},pos:Q+1};if(J==="null")return{node:{$expr:"literal",value:null},pos:Q+1};if(J&&/^[a-zA-Z_]/.test(J)){let X={$expr:"ident",name:J},K=Q+1;while(Z[K]==="."){K++;let W=Z[K++];X={$expr:"member",object:X,property:W}}return{node:X,pos:K}}return{node:{$expr:"literal",value:null},pos:Q+1}}class a{steps=[];atoms;proxy;constructor(Z){return this.atoms=Z,this.proxy=new Proxy(this,{get:(Q,Y,J)=>{if(Y in Q)return Q[Y];if(typeof Y==="string"&&Y in Q.atoms)return(X)=>{let K=Q.atoms[Y];return Q.add(K.create(X)),J};return}}),this.proxy}add(Z){return this.steps.push(Z),this.proxy}as(Z){if(this.steps.length===0)throw Error("No step to capture");let Q=this.steps[this.steps.length-1];return Q.result=Z,this.proxy}step(Z){return this.add(Z)}return(Z){let Q=this.atoms.return;if(!Q)throw Error("Atom 'return' not found");let Y=Z.schema??Z;return this.add(Q.create({schema:Y}))}toJSON(){return{op:"seq",steps:[...this.steps]}}varsImport(Z){return this.add(this.atoms.varsImport.create({keys:Z}))}varsExport(Z){return this.add(this.atoms.varsExport.create({keys:Z}))}if(Z,Q,Y,J){let X=new a(this.atoms);Y(X);let K;if(J){let z=new a(this.atoms);J(z),K=z.steps}let W=c0(Z,Q),H=this.atoms.if;return this.add(H.create({condition:W,then:X.steps,else:K}))}while(Z,Q,Y){let J=new a(this.atoms);Y(J);let X=c0(Z,Q),K=this.atoms.while;return this.add(K.create({condition:X,body:J.steps}))}scope(Z){let Q=new a(this.atoms);Z(Q);let Y=this.atoms.scope;return this.add(Y.create({steps:Q.steps}))}map(Z,Q,Y){let J=new a(this.atoms);Y(J);let X=this.atoms.map;return this.add(X.create({items:Z,as:Q,steps:J.steps}))}filter(Z,Q,Y,J={}){let X=c0(Y,J),K=this.atoms.filter;return this.add(K.create({items:Z,as:Q,condition:X}))}find(Z,Q,Y,J={}){let X=c0(Y,J),K=this.atoms.find;return this.add(K.create({items:Z,as:Q,condition:X}))}reduce(Z,Q,Y,J,X){let K=new a(this.atoms);X(K);let W=this.atoms.reduce;return this.add(W.create({items:Z,as:Q,accumulator:Y,initial:J,steps:K.steps}))}memoize(Z,Q){let Y=new a(this.atoms);Z(Y);let J=this.atoms.memoize;return this.add(J.create({key:Q,steps:Y.steps}))}cache(Z,Q,Y){let J=new a(this.atoms);Z(J);let X=this.atoms.cache;return this.add(X.create({key:Q,steps:J.steps,ttlMs:Y}))}try(Z){let Q=new a(this.atoms);Z.try(Q);let Y;if(Z.catch){let X=new a(this.atoms);Z.catch(X),Y=X.steps}let J=this.atoms.try;return this.add(J.create({try:Q.steps,catch:Y}))}}import{validate as r6}from"tosijs-schema";var xZ=[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],Y8=[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],mZ="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",J8="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",N1={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"},j1="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",uZ={5:j1,"5module":j1+" export import",6:j1+" const class extends export import super"},lZ=/^in(stanceof)?$/,dZ=new RegExp("["+J8+"]"),pZ=new RegExp("["+J8+mZ+"]");function w1(Z,Q){var Y=65536;for(var J=0;J<Q.length;J+=2){if(Y+=Q[J],Y>Z)return!1;if(Y+=Q[J+1],Y>=Z)return!0}return!1}function G0(Z,Q){if(Z<65)return Z===36;if(Z<91)return!0;if(Z<97)return Z===95;if(Z<123)return!0;if(Z<=65535)return Z>=170&&dZ.test(String.fromCharCode(Z));if(Q===!1)return!1;return w1(Z,Y8)}function N0(Z,Q){if(Z<48)return Z===36;if(Z<58)return!0;if(Z<65)return!1;if(Z<91)return!0;if(Z<97)return Z===95;if(Z<123)return!0;if(Z<=65535)return Z>=170&&pZ.test(String.fromCharCode(Z));if(Q===!1)return!1;return w1(Z,Y8)||w1(Z,xZ)}var y=function(Q,Y){if(Y===void 0)Y={};this.label=Q,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 Y0(Z,Q){return new y(Z,{beforeExpr:!0,binop:Q})}var J0={beforeExpr:!0},s={startsExpr:!0},C1={};function g(Z,Q){if(Q===void 0)Q={};return Q.keyword=Z,C1[Z]=new y(Z,Q)}var G={num:new y("num",s),regexp:new y("regexp",s),string:new y("string",s),name:new y("name",s),privateId:new y("privateId",s),eof:new y("eof"),bracketL:new y("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new y("]"),braceL:new y("{",{beforeExpr:!0,startsExpr:!0}),braceR:new y("}"),parenL:new y("(",{beforeExpr:!0,startsExpr:!0}),parenR:new y(")"),comma:new y(",",J0),semi:new y(";",J0),colon:new y(":",J0),dot:new y("."),question:new y("?",J0),questionDot:new y("?."),arrow:new y("=>",J0),template:new y("template"),invalidTemplate:new y("invalidTemplate"),ellipsis:new y("...",J0),backQuote:new y("`",s),dollarBraceL:new y("${",{beforeExpr:!0,startsExpr:!0}),eq:new y("=",{beforeExpr:!0,isAssign:!0}),assign:new y("_=",{beforeExpr:!0,isAssign:!0}),incDec:new y("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new y("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Y0("||",1),logicalAND:Y0("&&",2),bitwiseOR:Y0("|",3),bitwiseXOR:Y0("^",4),bitwiseAND:Y0("&",5),equality:Y0("==/!=/===/!==",6),relational:Y0("</>/<=/>=",7),bitShift:Y0("<</>>/>>>",8),plusMin:new y("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Y0("%",10),star:Y0("*",10),slash:Y0("/",10),starstar:new y("**",{beforeExpr:!0}),coalesce:Y0("??",1),_break:g("break"),_case:g("case",J0),_catch:g("catch"),_continue:g("continue"),_debugger:g("debugger"),_default:g("default",J0),_do:g("do",{isLoop:!0,beforeExpr:!0}),_else:g("else",J0),_finally:g("finally"),_for:g("for",{isLoop:!0}),_function:g("function",s),_if:g("if"),_return:g("return",J0),_switch:g("switch"),_throw:g("throw",J0),_try:g("try"),_var:g("var"),_const:g("const"),_while:g("while",{isLoop:!0}),_with:g("with"),_new:g("new",{beforeExpr:!0,startsExpr:!0}),_this:g("this",s),_super:g("super",s),_class:g("class",s),_extends:g("extends",J0),_export:g("export"),_import:g("import",s),_null:g("null",s),_true:g("true",s),_false:g("false",s),_in:g("in",{beforeExpr:!0,binop:7}),_instanceof:g("instanceof",{beforeExpr:!0,binop:7}),_typeof:g("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:g("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:g("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},r=/\r\n?|\n|\u2028|\u2029/,iZ=new RegExp(r.source,"g");function P0(Z){return Z===10||Z===13||Z===8232||Z===8233}function X8(Z,Q,Y){if(Y===void 0)Y=Z.length;for(var J=Q;J<Y;J++){var X=Z.charCodeAt(J);if(P0(X))return J<Y-1&&X===13&&Z.charCodeAt(J+1)===10?J+2:J+1}return-1}var W8=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,n=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,K8=Object.prototype,nZ=K8.hasOwnProperty,cZ=K8.toString,S0=Object.hasOwn||function(Z,Q){return nZ.call(Z,Q)},t1=Array.isArray||function(Z){return cZ.call(Z)==="[object Array]"},e1=Object.create(null);function L0(Z){return e1[Z]||(e1[Z]=new RegExp("^(?:"+Z.replace(/ /g,"|")+")$"))}function O0(Z){if(Z<=65535)return String.fromCharCode(Z);return Z-=65536,String.fromCharCode((Z>>10)+55296,(Z&1023)+56320)}var oZ=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,g0=function(Q,Y){this.line=Q,this.column=Y};g0.prototype.offset=function(Q){return new g0(this.line,this.column+Q)};var e0=function(Q,Y,J){if(this.start=Y,this.end=J,Q.sourceFile!==null)this.source=Q.sourceFile};function H8(Z,Q){for(var Y=1,J=0;;){var X=X8(Z,J,Q);if(X<0)return new g0(Y,Q-J);++Y,J=X}}var A1={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},Z8=!1;function aZ(Z){var Q={};for(var Y in A1)Q[Y]=Z&&S0(Z,Y)?Z[Y]:A1[Y];if(Q.ecmaVersion==="latest")Q.ecmaVersion=1e8;else if(Q.ecmaVersion==null){if(!Z8&&typeof console==="object"&&console.warn)Z8=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
3
- Defaulting to 2020, but this will stop working in the future.`);Q.ecmaVersion=11}else if(Q.ecmaVersion>=2015)Q.ecmaVersion-=2009;if(Q.allowReserved==null)Q.allowReserved=Q.ecmaVersion<5;if(!Z||Z.allowHashBang==null)Q.allowHashBang=Q.ecmaVersion>=14;if(t1(Q.onToken)){var J=Q.onToken;Q.onToken=function(X){return J.push(X)}}if(t1(Q.onComment))Q.onComment=sZ(Q,Q.onComment);return Q}function sZ(Z,Q){return function(Y,J,X,K,W,H){var z={type:Y?"Block":"Line",value:J,start:X,end:K};if(Z.locations)z.loc=new e0(this,W,H);if(Z.ranges)z.range=[X,K];Q.push(z)}}var y0=1,b0=2,P1=4,z8=8,S1=16,G8=32,Z1=64,_8=128,A0=256,f0=512,Q1=y0|b0|A0;function b1(Z,Q){return b0|(Z?P1:0)|(Q?z8:0)}var a0=0,E1=1,I0=2,q8=3,F8=4,$8=5,p=function(Q,Y,J){this.options=Q=aZ(Q),this.sourceFile=Q.sourceFile,this.keywords=L0(uZ[Q.ecmaVersion>=6?6:Q.sourceType==="module"?"5module":5]);var X="";if(Q.allowReserved!==!0){if(X=N1[Q.ecmaVersion>=6?6:Q.ecmaVersion===5?5:3],Q.sourceType==="module")X+=" await"}this.reservedWords=L0(X);var K=(X?X+" ":"")+N1.strict;if(this.reservedWordsStrict=L0(K),this.reservedWordsStrictBind=L0(K+" "+N1.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(r).length;else this.pos=this.lineStart=0,this.curLine=1;if(this.type=G.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=Q.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&&Q.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(y0),this.regexpState=null,this.privateNameStack=[]},_0={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}};p.prototype.parse=function(){var Q=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(Q)};_0.inFunction.get=function(){return(this.currentVarScope().flags&b0)>0};_0.inGenerator.get=function(){return(this.currentVarScope().flags&z8)>0};_0.inAsync.get=function(){return(this.currentVarScope().flags&P1)>0};_0.canAwait.get=function(){for(var Z=this.scopeStack.length-1;Z>=0;Z--){var Q=this.scopeStack[Z],Y=Q.flags;if(Y&(A0|f0))return!1;if(Y&b0)return(Y&P1)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};_0.allowSuper.get=function(){var Z=this.currentThisScope(),Q=Z.flags;return(Q&Z1)>0||this.options.allowSuperOutsideMethod};_0.allowDirectSuper.get=function(){return(this.currentThisScope().flags&_8)>0};_0.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};_0.allowNewDotTarget.get=function(){for(var Z=this.scopeStack.length-1;Z>=0;Z--){var Q=this.scopeStack[Z],Y=Q.flags;if(Y&(A0|f0)||Y&b0&&!(Y&S1))return!0}return!1};_0.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&A0)>0};p.extend=function(){var Q=[],Y=arguments.length;while(Y--)Q[Y]=arguments[Y];var J=this;for(var X=0;X<Q.length;X++)J=Q[X](J);return J};p.parse=function(Q,Y){return new this(Y,Q).parse()};p.parseExpressionAt=function(Q,Y,J){var X=new this(J,Q,Y);return X.nextToken(),X.parseExpression()};p.tokenizer=function(Q,Y){return new this(Y,Q)};Object.defineProperties(p.prototype,_0);var c=p.prototype,rZ=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;c.strictDirective=function(Z){if(this.options.ecmaVersion<5)return!1;for(;;){n.lastIndex=Z,Z+=n.exec(this.input)[0].length;var Q=rZ.exec(this.input.slice(Z));if(!Q)return!1;if((Q[1]||Q[2])==="use strict"){n.lastIndex=Z+Q[0].length;var Y=n.exec(this.input),J=Y.index+Y[0].length,X=this.input.charAt(J);return X===";"||X==="}"||r.test(Y[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(X)||X==="!"&&this.input.charAt(J+1)==="=")}if(Z+=Q[0].length,n.lastIndex=Z,Z+=n.exec(this.input)[0].length,this.input[Z]===";")Z++}};c.eat=function(Z){if(this.type===Z)return this.next(),!0;else return!1};c.isContextual=function(Z){return this.type===G.name&&this.value===Z&&!this.containsEsc};c.eatContextual=function(Z){if(!this.isContextual(Z))return!1;return this.next(),!0};c.expectContextual=function(Z){if(!this.eatContextual(Z))this.unexpected()};c.canInsertSemicolon=function(){return this.type===G.eof||this.type===G.braceR||r.test(this.input.slice(this.lastTokEnd,this.start))};c.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};c.semicolon=function(){if(!this.eat(G.semi)&&!this.insertSemicolon())this.unexpected()};c.afterTrailingComma=function(Z,Q){if(this.type===Z){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!Q)this.next();return!0}};c.expect=function(Z){this.eat(Z)||this.unexpected()};c.unexpected=function(Z){this.raise(Z!=null?Z:this.start,"Unexpected token")};var Y1=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};c.checkPatternErrors=function(Z,Q){if(!Z)return;if(Z.trailingComma>-1)this.raiseRecoverable(Z.trailingComma,"Comma is not permitted after the rest element");var Y=Q?Z.parenthesizedAssign:Z.parenthesizedBind;if(Y>-1)this.raiseRecoverable(Y,Q?"Assigning to rvalue":"Parenthesized pattern")};c.checkExpressionErrors=function(Z,Q){if(!Z)return!1;var{shorthandAssign:Y,doubleProto:J}=Z;if(!Q)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")};c.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")};c.isSimpleAssignTarget=function(Z){if(Z.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(Z.expression);return Z.type==="Identifier"||Z.type==="MemberExpression"};var D=p.prototype;D.parseTopLevel=function(Z){var Q=Object.create(null);if(!Z.body)Z.body=[];while(this.type!==G.eof){var Y=this.parseStatement(null,!0,Q);Z.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(Z.body),this.next(),Z.sourceType=this.options.sourceType,this.finishNode(Z,"Program")};var v1={kind:"loop"},tZ={kind:"switch"};D.isLet=function(Z){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;n.lastIndex=this.pos;var Q=n.exec(this.input),Y=this.pos+Q[0].length,J=this.input.charCodeAt(Y);if(J===91||J===92)return!0;if(Z)return!1;if(J===123||J>55295&&J<56320)return!0;if(G0(J,!0)){var X=Y+1;while(N0(J=this.input.charCodeAt(X),!0))++X;if(J===92||J>55295&&J<56320)return!0;var K=this.input.slice(Y,X);if(!lZ.test(K))return!0}return!1};D.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;n.lastIndex=this.pos;var Z=n.exec(this.input),Q=this.pos+Z[0].length,Y;return!r.test(this.input.slice(this.pos,Q))&&this.input.slice(Q,Q+8)==="function"&&(Q+8===this.input.length||!(N0(Y=this.input.charCodeAt(Q+8))||Y>55295&&Y<56320))};D.isUsingKeyword=function(Z,Q){if(this.options.ecmaVersion<17||!this.isContextual(Z?"await":"using"))return!1;n.lastIndex=this.pos;var Y=n.exec(this.input),J=this.pos+Y[0].length;if(r.test(this.input.slice(this.pos,J)))return!1;if(Z){var X=J+5,K;if(this.input.slice(J,X)!=="using"||X===this.input.length||N0(K=this.input.charCodeAt(X))||K>55295&&K<56320)return!1;n.lastIndex=X;var W=n.exec(this.input);if(W&&r.test(this.input.slice(X,X+W[0].length)))return!1}if(Q){var H=J+2,z;if(this.input.slice(J,H)==="of"){if(H===this.input.length||!N0(z=this.input.charCodeAt(H))&&!(z>55295&&z<56320))return!1}}var _=this.input.charCodeAt(J);return G0(_,!0)||_===92};D.isAwaitUsing=function(Z){return this.isUsingKeyword(!0,Z)};D.isUsing=function(Z){return this.isUsingKeyword(!1,Z)};D.parseStatement=function(Z,Q,Y){var J=this.type,X=this.startNode(),K;if(this.isLet(Z))J=G._var,K="let";switch(J){case G._break:case G._continue:return this.parseBreakContinueStatement(X,J.keyword);case G._debugger:return this.parseDebuggerStatement(X);case G._do:return this.parseDoStatement(X);case G._for:return this.parseForStatement(X);case G._function:if(Z&&(this.strict||Z!=="if"&&Z!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(X,!1,!Z);case G._class:if(Z)this.unexpected();return this.parseClass(X,!0);case G._if:return this.parseIfStatement(X);case G._return:return this.parseReturnStatement(X);case G._switch:return this.parseSwitchStatement(X);case G._throw:return this.parseThrowStatement(X);case G._try:return this.parseTryStatement(X);case G._const:case G._var:if(K=K||this.value,Z&&K!=="var")this.unexpected();return this.parseVarStatement(X,K);case G._while:return this.parseWhileStatement(X);case G._with:return this.parseWithStatement(X);case G.braceL:return this.parseBlock(!0,X);case G.semi:return this.parseEmptyStatement(X);case G._export:case G._import:if(this.options.ecmaVersion>10&&J===G._import){n.lastIndex=this.pos;var W=n.exec(this.input),H=this.pos+W[0].length,z=this.input.charCodeAt(H);if(z===40||z===46)return this.parseExpressionStatement(X,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!Q)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===G._import?this.parseImport(X):this.parseExport(X,Y);default:if(this.isAsyncFunction()){if(Z)this.unexpected();return this.next(),this.parseFunctionStatement(X,!0,!Z)}var _=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(_){if(Q&&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 q=this.value,R=this.parseExpression();if(J===G.name&&R.type==="Identifier"&&this.eat(G.colon))return this.parseLabeledStatement(X,q,R,Z);else return this.parseExpressionStatement(X,R)}};D.parseBreakContinueStatement=function(Z,Q){var Y=Q==="break";if(this.next(),this.eat(G.semi)||this.insertSemicolon())Z.label=null;else if(this.type!==G.name)this.unexpected();else Z.label=this.parseIdent(),this.semicolon();var J=0;for(;J<this.labels.length;++J){var X=this.labels[J];if(Z.label==null||X.name===Z.label.name){if(X.kind!=null&&(Y||X.kind==="loop"))break;if(Z.label&&Y)break}}if(J===this.labels.length)this.raise(Z.start,"Unsyntactic "+Q);return this.finishNode(Z,Y?"BreakStatement":"ContinueStatement")};D.parseDebuggerStatement=function(Z){return this.next(),this.semicolon(),this.finishNode(Z,"DebuggerStatement")};D.parseDoStatement=function(Z){if(this.next(),this.labels.push(v1),Z.body=this.parseStatement("do"),this.labels.pop(),this.expect(G._while),Z.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(G.semi);else this.semicolon();return this.finishNode(Z,"DoWhileStatement")};D.parseForStatement=function(Z){this.next();var Q=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(v1),this.enterScope(0),this.expect(G.parenL),this.type===G.semi){if(Q>-1)this.unexpected(Q);return this.parseFor(Z,null)}var Y=this.isLet();if(this.type===G._var||this.type===G._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(Z,J,Q)}var K=this.isContextual("let"),W=!1,H=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(H){var z=this.startNode();if(this.next(),H==="await using")this.next();return this.parseVar(z,!0,H),this.finishNode(z,"VariableDeclaration"),this.parseForAfterInit(Z,z,Q)}var _=this.containsEsc,q=new Y1,R=this.start,F=Q>-1?this.parseExprSubscripts(q,"await"):this.parseExpression(!0,q);if(this.type===G._in||(W=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(Q>-1){if(this.type===G._in)this.unexpected(Q);Z.await=!0}else if(W&&this.options.ecmaVersion>=8){if(F.start===R&&!_&&F.type==="Identifier"&&F.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)Z.await=!1}if(K&&W)this.raise(F.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(F,!1,q),this.checkLValPattern(F),this.parseForIn(Z,F)}else this.checkExpressionErrors(q,!0);if(Q>-1)this.unexpected(Q);return this.parseFor(Z,F)};D.parseForAfterInit=function(Z,Q,Y){if((this.type===G._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Q.declarations.length===1){if(this.options.ecmaVersion>=9)if(this.type===G._in){if(Y>-1)this.unexpected(Y)}else Z.await=Y>-1;return this.parseForIn(Z,Q)}if(Y>-1)this.unexpected(Y);return this.parseFor(Z,Q)};D.parseFunctionStatement=function(Z,Q,Y){return this.next(),this.parseFunction(Z,k0|(Y?0:V1),!1,Q)};D.parseIfStatement=function(Z){return this.next(),Z.test=this.parseParenExpression(),Z.consequent=this.parseStatement("if"),Z.alternate=this.eat(G._else)?this.parseStatement("if"):null,this.finishNode(Z,"IfStatement")};D.parseReturnStatement=function(Z){if(!this.inFunction&&!this.options.allowReturnOutsideFunction)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(G.semi)||this.insertSemicolon())Z.argument=null;else Z.argument=this.parseExpression(),this.semicolon();return this.finishNode(Z,"ReturnStatement")};D.parseSwitchStatement=function(Z){this.next(),Z.discriminant=this.parseParenExpression(),Z.cases=[],this.expect(G.braceL),this.labels.push(tZ),this.enterScope(0);var Q;for(var Y=!1;this.type!==G.braceR;)if(this.type===G._case||this.type===G._default){var J=this.type===G._case;if(Q)this.finishNode(Q,"SwitchCase");if(Z.cases.push(Q=this.startNode()),Q.consequent=[],this.next(),J)Q.test=this.parseExpression();else{if(Y)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Y=!0,Q.test=null}this.expect(G.colon)}else{if(!Q)this.unexpected();Q.consequent.push(this.parseStatement(null))}if(this.exitScope(),Q)this.finishNode(Q,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(Z,"SwitchStatement")};D.parseThrowStatement=function(Z){if(this.next(),r.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return Z.argument=this.parseExpression(),this.semicolon(),this.finishNode(Z,"ThrowStatement")};var eZ=[];D.parseCatchClauseParam=function(){var Z=this.parseBindingAtom(),Q=Z.type==="Identifier";return this.enterScope(Q?G8:0),this.checkLValPattern(Z,Q?F8:I0),this.expect(G.parenR),Z};D.parseTryStatement=function(Z){if(this.next(),Z.block=this.parseBlock(),Z.handler=null,this.type===G._catch){var Q=this.startNode();if(this.next(),this.eat(G.parenL))Q.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();Q.param=null,this.enterScope(0)}Q.body=this.parseBlock(!1),this.exitScope(),Z.handler=this.finishNode(Q,"CatchClause")}if(Z.finalizer=this.eat(G._finally)?this.parseBlock():null,!Z.handler&&!Z.finalizer)this.raise(Z.start,"Missing catch or finally clause");return this.finishNode(Z,"TryStatement")};D.parseVarStatement=function(Z,Q,Y){return this.next(),this.parseVar(Z,!1,Q,Y),this.semicolon(),this.finishNode(Z,"VariableDeclaration")};D.parseWhileStatement=function(Z){return this.next(),Z.test=this.parseParenExpression(),this.labels.push(v1),Z.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(Z,"WhileStatement")};D.parseWithStatement=function(Z){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),Z.object=this.parseParenExpression(),Z.body=this.parseStatement("with"),this.finishNode(Z,"WithStatement")};D.parseEmptyStatement=function(Z){return this.next(),this.finishNode(Z,"EmptyStatement")};D.parseLabeledStatement=function(Z,Q,Y,J){for(var X=0,K=this.labels;X<K.length;X+=1){var W=K[X];if(W.name===Q)this.raise(Y.start,"Label '"+Q+"' is already declared")}var H=this.type.isLoop?"loop":this.type===G._switch?"switch":null;for(var z=this.labels.length-1;z>=0;z--){var _=this.labels[z];if(_.statementStart===Z.start)_.statementStart=this.start,_.kind=H;else break}return this.labels.push({name:Q,kind:H,statementStart:this.start}),Z.body=this.parseStatement(J?J.indexOf("label")===-1?J+"label":J:"label"),this.labels.pop(),Z.label=Y,this.finishNode(Z,"LabeledStatement")};D.parseExpressionStatement=function(Z,Q){return Z.expression=Q,this.semicolon(),this.finishNode(Z,"ExpressionStatement")};D.parseBlock=function(Z,Q,Y){if(Z===void 0)Z=!0;if(Q===void 0)Q=this.startNode();if(Q.body=[],this.expect(G.braceL),Z)this.enterScope(0);while(this.type!==G.braceR){var J=this.parseStatement(null);Q.body.push(J)}if(Y)this.strict=!1;if(this.next(),Z)this.exitScope();return this.finishNode(Q,"BlockStatement")};D.parseFor=function(Z,Q){return Z.init=Q,this.expect(G.semi),Z.test=this.type===G.semi?null:this.parseExpression(),this.expect(G.semi),Z.update=this.type===G.parenR?null:this.parseExpression(),this.expect(G.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,"ForStatement")};D.parseForIn=function(Z,Q){var Y=this.type===G._in;if(this.next(),Q.type==="VariableDeclaration"&&Q.declarations[0].init!=null&&(!Y||this.options.ecmaVersion<8||this.strict||Q.kind!=="var"||Q.declarations[0].id.type!=="Identifier"))this.raise(Q.start,(Y?"for-in":"for-of")+" loop variable declaration may not have an initializer");return Z.left=Q,Z.right=Y?this.parseExpression():this.parseMaybeAssign(),this.expect(G.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,Y?"ForInStatement":"ForOfStatement")};D.parseVar=function(Z,Q,Y,J){Z.declarations=[],Z.kind=Y;for(;;){var X=this.startNode();if(this.parseVarId(X,Y),this.eat(G.eq))X.init=this.parseMaybeAssign(Q);else if(!J&&Y==="const"&&!(this.type===G._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!J&&(Y==="using"||Y==="await using")&&this.options.ecmaVersion>=17&&this.type!==G._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Y+" declaration");else if(!J&&X.id.type!=="Identifier"&&!(Q&&(this.type===G._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else X.init=null;if(Z.declarations.push(this.finishNode(X,"VariableDeclarator")),!this.eat(G.comma))break}return Z};D.parseVarId=function(Z,Q){Z.id=Q==="using"||Q==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(Z.id,Q==="var"?E1:I0,!1)};var k0=1,V1=2,R8=4;D.parseFunction=function(Z,Q,Y,J,X){if(this.initFunction(Z),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!J){if(this.type===G.star&&Q&V1)this.unexpected();Z.generator=this.eat(G.star)}if(this.options.ecmaVersion>=8)Z.async=!!J;if(Q&k0){if(Z.id=Q&R8&&this.type!==G.name?null:this.parseIdent(),Z.id&&!(Q&V1))this.checkLValSimple(Z.id,this.strict||Z.generator||Z.async?this.treatFunctionsAsVar?E1:I0:q8)}var K=this.yieldPos,W=this.awaitPos,H=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(b1(Z.async,Z.generator)),!(Q&k0))Z.id=this.type===G.name?this.parseIdent():null;return this.parseFunctionParams(Z),this.parseFunctionBody(Z,Y,!1,X),this.yieldPos=K,this.awaitPos=W,this.awaitIdentPos=H,this.finishNode(Z,Q&k0?"FunctionDeclaration":"FunctionExpression")};D.parseFunctionParams=function(Z){this.expect(G.parenL),Z.params=this.parseBindingList(G.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};D.parseClass=function(Z,Q){this.next();var Y=this.strict;this.strict=!0,this.parseClassId(Z,Q),this.parseClassSuper(Z);var J=this.enterClassBody(),X=this.startNode(),K=!1;X.body=[],this.expect(G.braceL);while(this.type!==G.braceR){var W=this.parseClassElement(Z.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"&&Z6(J,W))this.raiseRecoverable(W.key.start,"Identifier '#"+W.key.name+"' has already been declared")}}return this.strict=Y,this.next(),Z.body=this.finishNode(X,"ClassBody"),this.exitClassBody(),this.finishNode(Z,Q?"ClassDeclaration":"ClassExpression")};D.parseClassElement=function(Z){if(this.eat(G.semi))return null;var Q=this.options.ecmaVersion,Y=this.startNode(),J="",X=!1,K=!1,W="method",H=!1;if(this.eatContextual("static")){if(Q>=13&&this.eat(G.braceL))return this.parseClassStaticBlock(Y),Y;if(this.isClassElementNameStart()||this.type===G.star)H=!0;else J="static"}if(Y.static=H,!J&&Q>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===G.star)&&!this.canInsertSemicolon())K=!0;else J="async";if(!J&&(Q>=9||!K)&&this.eat(G.star))X=!0;if(!J&&!K&&!X){var z=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())W=z;else J=z}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(Q<13||this.type===G.parenL||W!=="method"||X||K){var _=!Y.static&&s0(Y,"constructor"),q=_&&Z;if(_&&W!=="method")this.raise(Y.key.start,"Constructor can't have get/set modifier");Y.kind=_?"constructor":W,this.parseClassMethod(Y,X,K,q)}else this.parseClassField(Y);return Y};D.isClassElementNameStart=function(){return this.type===G.name||this.type===G.privateId||this.type===G.num||this.type===G.string||this.type===G.bracketL||this.type.keyword};D.parseClassElementName=function(Z){if(this.type===G.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");Z.computed=!1,Z.key=this.parsePrivateIdent()}else this.parsePropertyName(Z)};D.parseClassMethod=function(Z,Q,Y,J){var X=Z.key;if(Z.kind==="constructor"){if(Q)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(Z.static&&s0(Z,"prototype"))this.raise(X.start,"Classes may not have a static property named prototype");var K=Z.value=this.parseMethod(Q,Y,J);if(Z.kind==="get"&&K.params.length!==0)this.raiseRecoverable(K.start,"getter should have no params");if(Z.kind==="set"&&K.params.length!==1)this.raiseRecoverable(K.start,"setter should have exactly one param");if(Z.kind==="set"&&K.params[0].type==="RestElement")this.raiseRecoverable(K.params[0].start,"Setter cannot use rest params");return this.finishNode(Z,"MethodDefinition")};D.parseClassField=function(Z){if(s0(Z,"constructor"))this.raise(Z.key.start,"Classes can't have a field named 'constructor'");else if(Z.static&&s0(Z,"prototype"))this.raise(Z.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(G.eq))this.enterScope(f0|Z1),Z.value=this.parseMaybeAssign(),this.exitScope();else Z.value=null;return this.semicolon(),this.finishNode(Z,"PropertyDefinition")};D.parseClassStaticBlock=function(Z){Z.body=[];var Q=this.labels;this.labels=[],this.enterScope(A0|Z1);while(this.type!==G.braceR){var Y=this.parseStatement(null);Z.body.push(Y)}return this.next(),this.exitScope(),this.labels=Q,this.finishNode(Z,"StaticBlock")};D.parseClassId=function(Z,Q){if(this.type===G.name){if(Z.id=this.parseIdent(),Q)this.checkLValSimple(Z.id,I0,!1)}else{if(Q===!0)this.unexpected();Z.id=null}};D.parseClassSuper=function(Z){Z.superClass=this.eat(G._extends)?this.parseExprSubscripts(null,!1):null};D.enterClassBody=function(){var Z={declared:Object.create(null),used:[]};return this.privateNameStack.push(Z),Z.declared};D.exitClassBody=function(){var Z=this.privateNameStack.pop(),Q=Z.declared,Y=Z.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(!S0(Q,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 Z6(Z,Q){var Y=Q.key.name,J=Z[Y],X="true";if(Q.type==="MethodDefinition"&&(Q.kind==="get"||Q.kind==="set"))X=(Q.static?"s":"i")+Q.kind;if(J==="iget"&&X==="iset"||J==="iset"&&X==="iget"||J==="sget"&&X==="sset"||J==="sset"&&X==="sget")return Z[Y]="true",!1;else if(!J)return Z[Y]=X,!1;else return!0}function s0(Z,Q){var{computed:Y,key:J}=Z;return!Y&&(J.type==="Identifier"&&J.name===Q||J.type==="Literal"&&J.value===Q)}D.parseExportAllDeclaration=function(Z,Q){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))Z.exported=this.parseModuleExportName(),this.checkExport(Q,Z.exported,this.lastTokStart);else Z.exported=null;if(this.expectContextual("from"),this.type!==G.string)this.unexpected();if(Z.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ExportAllDeclaration")};D.parseExport=function(Z,Q){if(this.next(),this.eat(G.star))return this.parseExportAllDeclaration(Z,Q);if(this.eat(G._default))return this.checkExport(Q,"default",this.lastTokStart),Z.declaration=this.parseExportDefaultDeclaration(),this.finishNode(Z,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(Z.declaration=this.parseExportDeclaration(Z),Z.declaration.type==="VariableDeclaration")this.checkVariableExport(Q,Z.declaration.declarations);else this.checkExport(Q,Z.declaration.id,Z.declaration.id.start);if(Z.specifiers=[],Z.source=null,this.options.ecmaVersion>=16)Z.attributes=[]}else{if(Z.declaration=null,Z.specifiers=this.parseExportSpecifiers(Q),this.eatContextual("from")){if(this.type!==G.string)this.unexpected();if(Z.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause()}else{for(var Y=0,J=Z.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(Z.source=null,this.options.ecmaVersion>=16)Z.attributes=[]}this.semicolon()}return this.finishNode(Z,"ExportNamedDeclaration")};D.parseExportDeclaration=function(Z){return this.parseStatement(null)};D.parseExportDefaultDeclaration=function(){var Z;if(this.type===G._function||(Z=this.isAsyncFunction())){var Q=this.startNode();if(this.next(),Z)this.next();return this.parseFunction(Q,k0|R8,!1,Z)}else if(this.type===G._class){var Y=this.startNode();return this.parseClass(Y,"nullableID")}else{var J=this.parseMaybeAssign();return this.semicolon(),J}};D.checkExport=function(Z,Q,Y){if(!Z)return;if(typeof Q!=="string")Q=Q.type==="Identifier"?Q.name:Q.value;if(S0(Z,Q))this.raiseRecoverable(Y,"Duplicate export '"+Q+"'");Z[Q]=!0};D.checkPatternExport=function(Z,Q){var Y=Q.type;if(Y==="Identifier")this.checkExport(Z,Q,Q.start);else if(Y==="ObjectPattern")for(var J=0,X=Q.properties;J<X.length;J+=1){var K=X[J];this.checkPatternExport(Z,K)}else if(Y==="ArrayPattern")for(var W=0,H=Q.elements;W<H.length;W+=1){var z=H[W];if(z)this.checkPatternExport(Z,z)}else if(Y==="Property")this.checkPatternExport(Z,Q.value);else if(Y==="AssignmentPattern")this.checkPatternExport(Z,Q.left);else if(Y==="RestElement")this.checkPatternExport(Z,Q.argument)};D.checkVariableExport=function(Z,Q){if(!Z)return;for(var Y=0,J=Q;Y<J.length;Y+=1){var X=J[Y];this.checkPatternExport(Z,X.id)}};D.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};D.parseExportSpecifier=function(Z){var Q=this.startNode();return Q.local=this.parseModuleExportName(),Q.exported=this.eatContextual("as")?this.parseModuleExportName():Q.local,this.checkExport(Z,Q.exported,Q.exported.start),this.finishNode(Q,"ExportSpecifier")};D.parseExportSpecifiers=function(Z){var Q=[],Y=!0;this.expect(G.braceL);while(!this.eat(G.braceR)){if(!Y){if(this.expect(G.comma),this.afterTrailingComma(G.braceR))break}else Y=!1;Q.push(this.parseExportSpecifier(Z))}return Q};D.parseImport=function(Z){if(this.next(),this.type===G.string)Z.specifiers=eZ,Z.source=this.parseExprAtom();else Z.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Z.source=this.type===G.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ImportDeclaration")};D.parseImportSpecifier=function(){var Z=this.startNode();if(Z.imported=this.parseModuleExportName(),this.eatContextual("as"))Z.local=this.parseIdent();else this.checkUnreserved(Z.imported),Z.local=Z.imported;return this.checkLValSimple(Z.local,I0),this.finishNode(Z,"ImportSpecifier")};D.parseImportDefaultSpecifier=function(){var Z=this.startNode();return Z.local=this.parseIdent(),this.checkLValSimple(Z.local,I0),this.finishNode(Z,"ImportDefaultSpecifier")};D.parseImportNamespaceSpecifier=function(){var Z=this.startNode();return this.next(),this.expectContextual("as"),Z.local=this.parseIdent(),this.checkLValSimple(Z.local,I0),this.finishNode(Z,"ImportNamespaceSpecifier")};D.parseImportSpecifiers=function(){var Z=[],Q=!0;if(this.type===G.name){if(Z.push(this.parseImportDefaultSpecifier()),!this.eat(G.comma))return Z}if(this.type===G.star)return Z.push(this.parseImportNamespaceSpecifier()),Z;this.expect(G.braceL);while(!this.eat(G.braceR)){if(!Q){if(this.expect(G.comma),this.afterTrailingComma(G.braceR))break}else Q=!1;Z.push(this.parseImportSpecifier())}return Z};D.parseWithClause=function(){var Z=[];if(!this.eat(G._with))return Z;this.expect(G.braceL);var Q={},Y=!0;while(!this.eat(G.braceR)){if(!Y){if(this.expect(G.comma),this.afterTrailingComma(G.braceR))break}else Y=!1;var J=this.parseImportAttribute(),X=J.key.type==="Identifier"?J.key.name:J.key.value;if(S0(Q,X))this.raiseRecoverable(J.key.start,"Duplicate attribute key '"+X+"'");Q[X]=!0,Z.push(J)}return Z};D.parseImportAttribute=function(){var Z=this.startNode();if(Z.key=this.type===G.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(G.colon),this.type!==G.string)this.unexpected();return Z.value=this.parseExprAtom(),this.finishNode(Z,"ImportAttribute")};D.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===G.string){var Z=this.parseLiteral(this.value);if(oZ.test(Z.value))this.raise(Z.start,"An export name cannot include a lone surrogate.");return Z}return this.parseIdent(!0)};D.adaptDirectivePrologue=function(Z){for(var Q=0;Q<Z.length&&this.isDirectiveCandidate(Z[Q]);++Q)Z[Q].directive=Z[Q].expression.raw.slice(1,-1)};D.isDirectiveCandidate=function(Z){return this.options.ecmaVersion>=5&&Z.type==="ExpressionStatement"&&Z.expression.type==="Literal"&&typeof Z.expression.value==="string"&&(this.input[Z.start]==='"'||this.input[Z.start]==="'")};var W0=p.prototype;W0.toAssignable=function(Z,Q,Y){if(this.options.ecmaVersion>=6&&Z)switch(Z.type){case"Identifier":if(this.inAsync&&Z.name==="await")this.raise(Z.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(Z.type="ObjectPattern",Y)this.checkPatternErrors(Y,!0);for(var J=0,X=Z.properties;J<X.length;J+=1){var K=X[J];if(this.toAssignable(K,Q),K.type==="RestElement"&&(K.argument.type==="ArrayPattern"||K.argument.type==="ObjectPattern"))this.raise(K.argument.start,"Unexpected token")}break;case"Property":if(Z.kind!=="init")this.raise(Z.key.start,"Object pattern can't contain getter or setter");this.toAssignable(Z.value,Q);break;case"ArrayExpression":if(Z.type="ArrayPattern",Y)this.checkPatternErrors(Y,!0);this.toAssignableList(Z.elements,Q);break;case"SpreadElement":if(Z.type="RestElement",this.toAssignable(Z.argument,Q),Z.argument.type==="AssignmentPattern")this.raise(Z.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(Z.operator!=="=")this.raise(Z.left.end,"Only '=' operator can be used for specifying default value.");Z.type="AssignmentPattern",delete Z.operator,this.toAssignable(Z.left,Q);break;case"ParenthesizedExpression":this.toAssignable(Z.expression,Q,Y);break;case"ChainExpression":this.raiseRecoverable(Z.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!Q)break;default:this.raise(Z.start,"Assigning to rvalue")}else if(Y)this.checkPatternErrors(Y,!0);return Z};W0.toAssignableList=function(Z,Q){var Y=Z.length;for(var J=0;J<Y;J++){var X=Z[J];if(X)this.toAssignable(X,Q)}if(Y){var K=Z[Y-1];if(this.options.ecmaVersion===6&&Q&&K&&K.type==="RestElement"&&K.argument.type!=="Identifier")this.unexpected(K.argument.start)}return Z};W0.parseSpread=function(Z){var Q=this.startNode();return this.next(),Q.argument=this.parseMaybeAssign(!1,Z),this.finishNode(Q,"SpreadElement")};W0.parseRestBinding=function(){var Z=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==G.name)this.unexpected();return Z.argument=this.parseBindingAtom(),this.finishNode(Z,"RestElement")};W0.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case G.bracketL:var Z=this.startNode();return this.next(),Z.elements=this.parseBindingList(G.bracketR,!0,!0),this.finishNode(Z,"ArrayPattern");case G.braceL:return this.parseObj(!0)}return this.parseIdent()};W0.parseBindingList=function(Z,Q,Y,J){var X=[],K=!0;while(!this.eat(Z)){if(K)K=!1;else this.expect(G.comma);if(Q&&this.type===G.comma)X.push(null);else if(Y&&this.afterTrailingComma(Z))break;else if(this.type===G.ellipsis){var W=this.parseRestBinding();if(this.parseBindingListItem(W),X.push(W),this.type===G.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(Z);break}else X.push(this.parseAssignableListItem(J))}return X};W0.parseAssignableListItem=function(Z){var Q=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(Q),Q};W0.parseBindingListItem=function(Z){return Z};W0.parseMaybeDefault=function(Z,Q,Y){if(Y=Y||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(G.eq))return Y;var J=this.startNodeAt(Z,Q);return J.left=Y,J.right=this.parseMaybeAssign(),this.finishNode(J,"AssignmentPattern")};W0.checkLValSimple=function(Z,Q,Y){if(Q===void 0)Q=a0;var J=Q!==a0;switch(Z.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(Z.name))this.raiseRecoverable(Z.start,(J?"Binding ":"Assigning to ")+Z.name+" in strict mode");if(J){if(Q===I0&&Z.name==="let")this.raiseRecoverable(Z.start,"let is disallowed as a lexically bound name");if(Y){if(S0(Y,Z.name))this.raiseRecoverable(Z.start,"Argument name clash");Y[Z.name]=!0}if(Q!==$8)this.declareName(Z.name,Q,Z.start)}break;case"ChainExpression":this.raiseRecoverable(Z.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(J)this.raiseRecoverable(Z.start,"Binding member expression");break;case"ParenthesizedExpression":if(J)this.raiseRecoverable(Z.start,"Binding parenthesized expression");return this.checkLValSimple(Z.expression,Q,Y);default:this.raise(Z.start,(J?"Binding":"Assigning to")+" rvalue")}};W0.checkLValPattern=function(Z,Q,Y){if(Q===void 0)Q=a0;switch(Z.type){case"ObjectPattern":for(var J=0,X=Z.properties;J<X.length;J+=1){var K=X[J];this.checkLValInnerPattern(K,Q,Y)}break;case"ArrayPattern":for(var W=0,H=Z.elements;W<H.length;W+=1){var z=H[W];if(z)this.checkLValInnerPattern(z,Q,Y)}break;default:this.checkLValSimple(Z,Q,Y)}};W0.checkLValInnerPattern=function(Z,Q,Y){if(Q===void 0)Q=a0;switch(Z.type){case"Property":this.checkLValInnerPattern(Z.value,Q,Y);break;case"AssignmentPattern":this.checkLValPattern(Z.left,Q,Y);break;case"RestElement":this.checkLValPattern(Z.argument,Q,Y);break;default:this.checkLValPattern(Z,Q,Y)}};var H0=function(Q,Y,J,X,K){this.token=Q,this.isExpr=!!Y,this.preserveSpace=!!J,this.override=X,this.generator=!!K},m={b_stat:new H0("{",!1),b_expr:new H0("{",!0),b_tmpl:new H0("${",!1),p_stat:new H0("(",!1),p_expr:new H0("(",!0),q_tmpl:new H0("`",!0,!0,function(Z){return Z.tryReadTemplateToken()}),f_stat:new H0("function",!1),f_expr:new H0("function",!0),f_expr_gen:new H0("function",!0,!1,null,!0),f_gen:new H0("function",!1,!1,null,!0)},E0=p.prototype;E0.initialContext=function(){return[m.b_stat]};E0.curContext=function(){return this.context[this.context.length-1]};E0.braceIsBlock=function(Z){var Q=this.curContext();if(Q===m.f_expr||Q===m.f_stat)return!0;if(Z===G.colon&&(Q===m.b_stat||Q===m.b_expr))return!Q.isExpr;if(Z===G._return||Z===G.name&&this.exprAllowed)return r.test(this.input.slice(this.lastTokEnd,this.start));if(Z===G._else||Z===G.semi||Z===G.eof||Z===G.parenR||Z===G.arrow)return!0;if(Z===G.braceL)return Q===m.b_stat;if(Z===G._var||Z===G._const||Z===G.name)return!1;return!this.exprAllowed};E0.inGeneratorContext=function(){for(var Z=this.context.length-1;Z>=1;Z--){var Q=this.context[Z];if(Q.token==="function")return Q.generator}return!1};E0.updateContext=function(Z){var Q,Y=this.type;if(Y.keyword&&Z===G.dot)this.exprAllowed=!1;else if(Q=Y.updateContext)Q.call(this,Z);else this.exprAllowed=Y.beforeExpr};E0.overrideContext=function(Z){if(this.curContext()!==Z)this.context[this.context.length-1]=Z};G.parenR.updateContext=G.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var Z=this.context.pop();if(Z===m.b_stat&&this.curContext().token==="function")Z=this.context.pop();this.exprAllowed=!Z.isExpr};G.braceL.updateContext=function(Z){this.context.push(this.braceIsBlock(Z)?m.b_stat:m.b_expr),this.exprAllowed=!0};G.dollarBraceL.updateContext=function(){this.context.push(m.b_tmpl),this.exprAllowed=!0};G.parenL.updateContext=function(Z){var Q=Z===G._if||Z===G._for||Z===G._with||Z===G._while;this.context.push(Q?m.p_stat:m.p_expr),this.exprAllowed=!0};G.incDec.updateContext=function(){};G._function.updateContext=G._class.updateContext=function(Z){if(Z.beforeExpr&&Z!==G._else&&!(Z===G.semi&&this.curContext()!==m.p_stat)&&!(Z===G._return&&r.test(this.input.slice(this.lastTokEnd,this.start)))&&!((Z===G.colon||Z===G.braceL)&&this.curContext()===m.b_stat))this.context.push(m.f_expr);else this.context.push(m.f_stat);this.exprAllowed=!1};G.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};G.backQuote.updateContext=function(){if(this.curContext()===m.q_tmpl)this.context.pop();else this.context.push(m.q_tmpl);this.exprAllowed=!1};G.star.updateContext=function(Z){if(Z===G._function){var Q=this.context.length-1;if(this.context[Q]===m.f_expr)this.context[Q]=m.f_expr_gen;else this.context[Q]=m.f_gen}this.exprAllowed=!0};G.name.updateContext=function(Z){var Q=!1;if(this.options.ecmaVersion>=6&&Z!==G.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())Q=!0}this.exprAllowed=Q};var b=p.prototype;b.checkPropClash=function(Z,Q,Y){if(this.options.ecmaVersion>=9&&Z.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(Z.computed||Z.method||Z.shorthand))return;var J=Z.key,X;switch(J.type){case"Identifier":X=J.name;break;case"Literal":X=String(J.value);break;default:return}var K=Z.kind;if(this.options.ecmaVersion>=6){if(X==="__proto__"&&K==="init"){if(Q.proto)if(Y){if(Y.doubleProto<0)Y.doubleProto=J.start}else this.raiseRecoverable(J.start,"Redefinition of __proto__ property");Q.proto=!0}return}X="$"+X;var W=Q[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=Q[X]={init:!1,get:!1,set:!1};W[K]=!0};b.parseExpression=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseMaybeAssign(Z,Q);if(this.type===G.comma){var K=this.startNodeAt(Y,J);K.expressions=[X];while(this.eat(G.comma))K.expressions.push(this.parseMaybeAssign(Z,Q));return this.finishNode(K,"SequenceExpression")}return X};b.parseMaybeAssign=function(Z,Q,Y){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(Z);else this.exprAllowed=!1;var J=!1,X=-1,K=-1,W=-1;if(Q)X=Q.parenthesizedAssign,K=Q.trailingComma,W=Q.doubleProto,Q.parenthesizedAssign=Q.trailingComma=-1;else Q=new Y1,J=!0;var H=this.start,z=this.startLoc;if(this.type===G.parenL||this.type===G.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=Z==="await";var _=this.parseMaybeConditional(Z,Q);if(Y)_=Y.call(this,_,H,z);if(this.type.isAssign){var q=this.startNodeAt(H,z);if(q.operator=this.value,this.type===G.eq)_=this.toAssignable(_,!1,Q);if(!J)Q.parenthesizedAssign=Q.trailingComma=Q.doubleProto=-1;if(Q.shorthandAssign>=_.start)Q.shorthandAssign=-1;if(this.type===G.eq)this.checkLValPattern(_);else this.checkLValSimple(_);if(q.left=_,this.next(),q.right=this.parseMaybeAssign(Z),W>-1)Q.doubleProto=W;return this.finishNode(q,"AssignmentExpression")}else if(J)this.checkExpressionErrors(Q,!0);if(X>-1)Q.parenthesizedAssign=X;if(K>-1)Q.trailingComma=K;return _};b.parseMaybeConditional=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseExprOps(Z,Q);if(this.checkExpressionErrors(Q))return X;if(this.eat(G.question)){var K=this.startNodeAt(Y,J);return K.test=X,K.consequent=this.parseMaybeAssign(),this.expect(G.colon),K.alternate=this.parseMaybeAssign(Z),this.finishNode(K,"ConditionalExpression")}return X};b.parseExprOps=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseMaybeUnary(Q,!1,!1,Z);if(this.checkExpressionErrors(Q))return X;return X.start===Y&&X.type==="ArrowFunctionExpression"?X:this.parseExprOp(X,Y,J,-1,Z)};b.parseExprOp=function(Z,Q,Y,J,X){var K=this.type.binop;if(K!=null&&(!X||this.type!==G._in)){if(K>J){var W=this.type===G.logicalOR||this.type===G.logicalAND,H=this.type===G.coalesce;if(H)K=G.logicalAND.binop;var z=this.value;this.next();var _=this.start,q=this.startLoc,R=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,X),_,q,K,X),F=this.buildBinary(Q,Y,Z,R,z,W||H);if(W&&this.type===G.coalesce||H&&(this.type===G.logicalOR||this.type===G.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(F,Q,Y,J,X)}}return Z};b.buildBinary=function(Z,Q,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(Z,Q);return W.left=Y,W.operator=X,W.right=J,this.finishNode(W,K?"LogicalExpression":"BinaryExpression")};b.parseMaybeUnary=function(Z,Q,Y,J){var X=this.start,K=this.startLoc,W;if(this.isContextual("await")&&this.canAwait)W=this.parseAwait(J),Q=!0;else if(this.type.prefix){var H=this.startNode(),z=this.type===G.incDec;if(H.operator=this.value,H.prefix=!0,this.next(),H.argument=this.parseMaybeUnary(null,!0,z,J),this.checkExpressionErrors(Z,!0),z)this.checkLValSimple(H.argument);else if(this.strict&&H.operator==="delete"&&O8(H.argument))this.raiseRecoverable(H.start,"Deleting local variable in strict mode");else if(H.operator==="delete"&&D1(H.argument))this.raiseRecoverable(H.start,"Private fields can not be deleted");else Q=!0;W=this.finishNode(H,z?"UpdateExpression":"UnaryExpression")}else if(!Q&&this.type===G.privateId){if((J||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(W=this.parsePrivateIdent(),this.type!==G._in)this.unexpected()}else{if(W=this.parseExprSubscripts(Z,J),this.checkExpressionErrors(Z))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(G.starstar))if(Q)this.unexpected(this.lastTokStart);else return this.buildBinary(X,K,W,this.parseMaybeUnary(null,!1,!1,J),"**",!1);else return W};function O8(Z){return Z.type==="Identifier"||Z.type==="ParenthesizedExpression"&&O8(Z.expression)}function D1(Z){return Z.type==="MemberExpression"&&Z.property.type==="PrivateIdentifier"||Z.type==="ChainExpression"&&D1(Z.expression)||Z.type==="ParenthesizedExpression"&&D1(Z.expression)}b.parseExprSubscripts=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseExprAtom(Z,Q);if(X.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return X;var K=this.parseSubscripts(X,Y,J,!1,Q);if(Z&&K.type==="MemberExpression"){if(Z.parenthesizedAssign>=K.start)Z.parenthesizedAssign=-1;if(Z.parenthesizedBind>=K.start)Z.parenthesizedBind=-1;if(Z.trailingComma>=K.start)Z.trailingComma=-1}return K};b.parseSubscripts=function(Z,Q,Y,J,X){var K=this.options.ecmaVersion>=8&&Z.type==="Identifier"&&Z.name==="async"&&this.lastTokEnd===Z.end&&!this.canInsertSemicolon()&&Z.end-Z.start===5&&this.potentialArrowAt===Z.start,W=!1;while(!0){var H=this.parseSubscript(Z,Q,Y,J,K,W,X);if(H.optional)W=!0;if(H===Z||H.type==="ArrowFunctionExpression"){if(W){var z=this.startNodeAt(Q,Y);z.expression=H,H=this.finishNode(z,"ChainExpression")}return H}Z=H}};b.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(G.arrow)};b.parseSubscriptAsyncArrow=function(Z,Q,Y,J){return this.parseArrowExpression(this.startNodeAt(Z,Q),Y,!0,J)};b.parseSubscript=function(Z,Q,Y,J,X,K,W){var H=this.options.ecmaVersion>=11,z=H&&this.eat(G.questionDot);if(J&&z)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var _=this.eat(G.bracketL);if(_||z&&this.type!==G.parenL&&this.type!==G.backQuote||this.eat(G.dot)){var q=this.startNodeAt(Q,Y);if(q.object=Z,_)q.property=this.parseExpression(),this.expect(G.bracketR);else if(this.type===G.privateId&&Z.type!=="Super")q.property=this.parsePrivateIdent();else q.property=this.parseIdent(this.options.allowReserved!=="never");if(q.computed=!!_,H)q.optional=z;Z=this.finishNode(q,"MemberExpression")}else if(!J&&this.eat(G.parenL)){var R=new Y1,F=this.yieldPos,O=this.awaitPos,U=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var N=this.parseExprList(G.parenR,this.options.ecmaVersion>=8,!1,R);if(X&&!z&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(R,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=F,this.awaitPos=O,this.awaitIdentPos=U,this.parseSubscriptAsyncArrow(Q,Y,N,W)}this.checkExpressionErrors(R,!0),this.yieldPos=F||this.yieldPos,this.awaitPos=O||this.awaitPos,this.awaitIdentPos=U||this.awaitIdentPos;var L=this.startNodeAt(Q,Y);if(L.callee=Z,L.arguments=N,H)L.optional=z;Z=this.finishNode(L,"CallExpression")}else if(this.type===G.backQuote){if(z||K)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var B=this.startNodeAt(Q,Y);B.tag=Z,B.quasi=this.parseTemplate({isTagged:!0}),Z=this.finishNode(B,"TaggedTemplateExpression")}return Z};b.parseExprAtom=function(Z,Q,Y){if(this.type===G.slash)this.readRegexp();var J,X=this.potentialArrowAt===this.start;switch(this.type){case G._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(J=this.startNode(),this.next(),this.type===G.parenL&&!this.allowDirectSuper)this.raise(J.start,"super() call outside constructor of a subclass");if(this.type!==G.dot&&this.type!==G.bracketL&&this.type!==G.parenL)this.unexpected();return this.finishNode(J,"Super");case G._this:return J=this.startNode(),this.next(),this.finishNode(J,"ThisExpression");case G.name:var K=this.start,W=this.startLoc,H=this.containsEsc,z=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!H&&z.name==="async"&&!this.canInsertSemicolon()&&this.eat(G._function))return this.overrideContext(m.f_expr),this.parseFunction(this.startNodeAt(K,W),0,!1,!0,Q);if(X&&!this.canInsertSemicolon()){if(this.eat(G.arrow))return this.parseArrowExpression(this.startNodeAt(K,W),[z],!1,Q);if(this.options.ecmaVersion>=8&&z.name==="async"&&this.type===G.name&&!H&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(z=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(G.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(K,W),[z],!0,Q)}}return z;case G.regexp:var _=this.value;return J=this.parseLiteral(_.value),J.regex={pattern:_.pattern,flags:_.flags},J;case G.num:case G.string:return this.parseLiteral(this.value);case G._null:case G._true:case G._false:return J=this.startNode(),J.value=this.type===G._null?null:this.type===G._true,J.raw=this.type.keyword,this.next(),this.finishNode(J,"Literal");case G.parenL:var q=this.start,R=this.parseParenAndDistinguishExpression(X,Q);if(Z){if(Z.parenthesizedAssign<0&&!this.isSimpleAssignTarget(R))Z.parenthesizedAssign=q;if(Z.parenthesizedBind<0)Z.parenthesizedBind=q}return R;case G.bracketL:return J=this.startNode(),this.next(),J.elements=this.parseExprList(G.bracketR,!0,!0,Z),this.finishNode(J,"ArrayExpression");case G.braceL:return this.overrideContext(m.b_expr),this.parseObj(!1,Z);case G._function:return J=this.startNode(),this.next(),this.parseFunction(J,0);case G._class:return this.parseClass(this.startNode(),!1);case G._new:return this.parseNew();case G.backQuote:return this.parseTemplate();case G._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Y);else return this.unexpected();default:return this.parseExprAtomDefault()}};b.parseExprAtomDefault=function(){this.unexpected()};b.parseExprImport=function(Z){var Q=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===G.parenL&&!Z)return this.parseDynamicImport(Q);else if(this.type===G.dot){var Y=this.startNodeAt(Q.start,Q.loc&&Q.loc.start);return Y.name="import",Q.meta=this.finishNode(Y,"Identifier"),this.parseImportMeta(Q)}else this.unexpected()};b.parseDynamicImport=function(Z){if(this.next(),Z.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(G.parenR))if(this.expect(G.comma),!this.afterTrailingComma(G.parenR)){if(Z.options=this.parseMaybeAssign(),!this.eat(G.parenR)){if(this.expect(G.comma),!this.afterTrailingComma(G.parenR))this.unexpected()}}else Z.options=null;else Z.options=null;else if(!this.eat(G.parenR)){var Q=this.start;if(this.eat(G.comma)&&this.eat(G.parenR))this.raiseRecoverable(Q,"Trailing comma is not allowed in import()");else this.unexpected(Q)}return this.finishNode(Z,"ImportExpression")};b.parseImportMeta=function(Z){this.next();var Q=this.containsEsc;if(Z.property=this.parseIdent(!0),Z.property.name!=="meta")this.raiseRecoverable(Z.property.start,"The only valid meta property for import is 'import.meta'");if(Q)this.raiseRecoverable(Z.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(Z.start,"Cannot use 'import.meta' outside a module");return this.finishNode(Z,"MetaProperty")};b.parseLiteral=function(Z){var Q=this.startNode();if(Q.value=Z,Q.raw=this.input.slice(this.start,this.end),Q.raw.charCodeAt(Q.raw.length-1)===110)Q.bigint=Q.value!=null?Q.value.toString():Q.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(Q,"Literal")};b.parseParenExpression=function(){this.expect(G.parenL);var Z=this.parseExpression();return this.expect(G.parenR),Z};b.shouldParseArrow=function(Z){return!this.canInsertSemicolon()};b.parseParenAndDistinguishExpression=function(Z,Q){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,z=[],_=!0,q=!1,R=new Y1,F=this.yieldPos,O=this.awaitPos,U;this.yieldPos=0,this.awaitPos=0;while(this.type!==G.parenR)if(_?_=!1:this.expect(G.comma),K&&this.afterTrailingComma(G.parenR,!0)){q=!0;break}else if(this.type===G.ellipsis){if(U=this.start,z.push(this.parseParenItem(this.parseRestBinding())),this.type===G.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else z.push(this.parseMaybeAssign(!1,R,this.parseParenItem));var N=this.lastTokEnd,L=this.lastTokEndLoc;if(this.expect(G.parenR),Z&&this.shouldParseArrow(z)&&this.eat(G.arrow))return this.checkPatternErrors(R,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=F,this.awaitPos=O,this.parseParenArrowList(Y,J,z,Q);if(!z.length||q)this.unexpected(this.lastTokStart);if(U)this.unexpected(U);if(this.checkExpressionErrors(R,!0),this.yieldPos=F||this.yieldPos,this.awaitPos=O||this.awaitPos,z.length>1)X=this.startNodeAt(W,H),X.expressions=z,this.finishNodeAt(X,"SequenceExpression",N,L);else X=z[0]}else X=this.parseParenExpression();if(this.options.preserveParens){var B=this.startNodeAt(Y,J);return B.expression=X,this.finishNode(B,"ParenthesizedExpression")}else return X};b.parseParenItem=function(Z){return Z};b.parseParenArrowList=function(Z,Q,Y,J){return this.parseArrowExpression(this.startNodeAt(Z,Q),Y,!1,J)};var Q6=[];b.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var Z=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===G.dot){var Q=this.startNodeAt(Z.start,Z.loc&&Z.loc.start);Q.name="new",Z.meta=this.finishNode(Q,"Identifier"),this.next();var Y=this.containsEsc;if(Z.property=this.parseIdent(!0),Z.property.name!=="target")this.raiseRecoverable(Z.property.start,"The only valid meta property for new is 'new.target'");if(Y)this.raiseRecoverable(Z.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(Z.start,"'new.target' can only be used in functions and class static block");return this.finishNode(Z,"MetaProperty")}var J=this.start,X=this.startLoc;if(Z.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),J,X,!0,!1),this.eat(G.parenL))Z.arguments=this.parseExprList(G.parenR,this.options.ecmaVersion>=8,!1);else Z.arguments=Q6;return this.finishNode(Z,"NewExpression")};b.parseTemplateElement=function(Z){var Q=Z.isTagged,Y=this.startNode();if(this.type===G.invalidTemplate){if(!Q)this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal");Y.value={raw:this.value.replace(/\r\n?/g,`
1
+ import{s as $,validate as U1,filter as i1}from"tosijs-schema";var i0=Symbol.for("tjs.equals");function c0(Z,Q){if(Z!==null&&typeof Z==="object"&&typeof Z[i0]==="function")return Z[i0](Q);if(Q!==null&&typeof Q==="object"&&typeof Q[i0]==="function")return Q[i0](Z);if(Z!==null&&typeof Z==="object"&&typeof Z.Equals==="function")return Z.Equals(Q);if(Q!==null&&typeof Q==="object"&&typeof Q.Equals==="function")return Q.Equals(Z);if(Z===Q)return!0;if((Z===null||Z===void 0)&&(Q===null||Q===void 0))return!0;if(Z===null||Z===void 0||Q===null||Q===void 0)return!1;if(typeof Z!==typeof Q)return!1;if(typeof Z!=="object")return!1;if(Array.isArray(Z)&&Array.isArray(Q)){if(Z.length!==Q.length)return!1;return Z.every((X,H)=>c0(X,Q[H]))}if(Array.isArray(Z)!==Array.isArray(Q))return!1;let Y=Object.keys(Z),J=Object.keys(Q);if(Y.length!==J.length)return!1;return Y.every((X)=>c0(Z[X],Q[X]))}class s{$error=!0;message;op;cause;constructor(Z,Q,Y){this.message=Z,this.op=Q,this.cause=Y}toString(){return`AgentError[${this.op}]: ${this.message}`}toJSON(){return{$error:!0,message:this.message,op:this.op}}}function P9(Z){return Z instanceof s||Z&&Z.$error===!0}var C0=new Map,S9=3600000,b9=102400,I1="proc_";function M1(Z){return typeof Z==="string"&&Z.startsWith(I1)}function B1(Z){let Q=C0.get(Z);if(!Q)throw Error(`Procedure not found: ${Z}`);if(Date.now()>Q.expiresAt)throw C0.delete(Z),Error(`Procedure expired: ${Z}`);return Q.ast}function E9(){if(typeof crypto<"u"&&crypto.randomUUID)return I1+crypto.randomUUID();return I1+Math.random().toString(36).slice(2)+Date.now().toString(36)}var n1=new Set(["__proto__","constructor","prototype"]);function x1(Z){if(n1.has(Z))throw Error(`Security Error: Access to '${Z}' is forbidden`)}var v9=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","metadata.google.internal"]);function k9(Z){try{let Q=new URL(Z);if(Q.protocol!=="http:"&&Q.protocol!=="https:")return!0;let Y=Q.hostname.toLowerCase();if(v9.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 g9(Z){if(/\([^)]*[+*][^)]*\)[+*]/.test(Z))return!0;if(/\(([^|)]+)\|\1\)[+*]/.test(Z))return!0;if(/\(\.\*\)\+/.test(Z))return!0;if(/\(\.\+\)\+/.test(Z))return!0;if(/\(\[.*\]\+\)\+/.test(Z))return!0;return!1}function B0(Z){return{...Z,state:Object.create(Z.state)}}function y9(Z,Q){let Y={},J=new Set([...Object.keys(Z),...Object.keys(Q)]);for(let X of J){let H=Z[X],K=Q[X];if(K!==H)Y[X]=K}return Y}function M(Z,Q){if(Z&&typeof Z==="object"&&Z.$kind==="arg")return Q.args[Z.path];if(Z&&typeof Z==="object"&&Z.$expr)return p(Z,Q);if(typeof Z==="string"){if(Z.startsWith("args.")&&!("args"in Q.state))return Q.args[Z.replace("args.","")];if(Z.includes(".")){let Y=Z.split(".");for(let X of Y)if(n1.has(X))throw Error(`Security Error: Access to '${X}' is forbidden`);let J=Q.state[Y[0]];if(J!==void 0){for(let X=1;X<Y.length;X++)J=J?.[Y[X]];return J}}if(Z in Q.state)return Q.state[Z];return Z}if(Z&&typeof Z==="object"&&!Array.isArray(Z)&&Z.constructor===Object){let Y={};for(let J of Object.keys(Z))Y[J]=M(Z[J],Q);return Y}if(Array.isArray(Z))return Z.map((Y)=>M(Y,Q));return Z}function A0(Z,Q,Y){return new Proxy(Q,{get(J,X){if(X in J)return J[X];let H=Y?.[X];if(H)throw Error(`${Z}.${X} is not available. ${H}`);throw Error(`${Z}.${X} is not supported in AsyncJS. Check docs for available ${Z} methods.`)}})}function T0(Z){if(Z===null)return{type:"null"};if(Z===void 0)return{};if(typeof Z==="object"&&Z!==null&&"type"in Z&&typeof Z.type==="string")return Z;if(typeof Z==="object"&&Z!==null&&"schema"in Z&&typeof Z.schema==="object")return Z.schema;let Q=typeof Z;if(Q==="string")return{type:"string"};if(Q==="number")return Number.isInteger(Z)?{type:"integer"}:{type:"number"};if(Q==="boolean")return{type:"boolean"};if(Array.isArray(Z)){if(Z.length===0)return{type:"array"};return{type:"array",items:T0(Z[0])}}if(Q==="object"){let Y={},J=[];for(let[X,H]of Object.entries(Z))Y[X]=T0(H),J.push(X);return{type:"object",properties:Y,required:J}}return{}}var R0={Math:A0("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 Z=new Uint32Array(1);return crypto.getRandomValues(Z),Z[0]/4294967296}return Math.random()}}),JSON:A0("JSON",{parse:(Z)=>JSON.parse(Z),stringify:(Z,Q,Y)=>JSON.stringify(Z,Q,Y)}),console:A0("console",{log:(...Z)=>{return},warn:(...Z)=>{return},error:(...Z)=>{return},info:(...Z)=>{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:A0("Array",{isArray:(Z)=>Array.isArray(Z),from:(Z,Q,Y)=>Array.from(Z,Q,Y),of:(...Z)=>Array.of(...Z)},{prototype:"Prototype access is not allowed."}),Object:A0("Object",{keys:(Z)=>Object.keys(Z),values:(Z)=>Object.values(Z),entries:(Z)=>Object.entries(Z),fromEntries:(Z)=>Object.fromEntries(Z),assign:(Z,...Q)=>Object.assign({},Z,...Q),hasOwn:(Z,Q)=>Object.hasOwn(Z,Q)},{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:A0("String",{fromCharCode:(...Z)=>String.fromCharCode(...Z),fromCodePoint:(...Z)=>String.fromCodePoint(...Z)}),Number:A0("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:(Z,Q)=>{let Y=T0(Q),J=i1(Z,Y);if(J instanceof Error)throw J;return J},Schema:{...$,response:(Z,Q)=>{let Y=Q?.schema!=null?Q.schema:T0(Q);return{type:"json_schema",json_schema:{name:Z,strict:!0,schema:Y}}},fromExample:(Z)=>T0(Z),isValid:(Z,Q)=>{if(Q?.schema!=null)return U1(Z,Q);return U1(Z,T0(Q))}},Set:(Z=[])=>{let Q=[...new globalThis.Set(Z)];return{add(Y){if(!Q.includes(Y))Q.push(Y);return this},remove(Y){let J=Q.indexOf(Y);if(J!==-1)Q.splice(J,1);return this},clear(){return Q.length=0,this},has(Y){return Q.includes(Y)},get size(){return Q.length},toArray(){return[...Q]},union(Y){let J=Y?.toArray?.()??Y??[];return R0.Set([...Q,...J])},intersection(Y){let J=Y?.toArray?.()??Y??[];return R0.Set(Q.filter((X)=>J.includes(X)))},diff(Y){let J=Y?.toArray?.()??Y??[];return R0.Set(Q.filter((X)=>!J.includes(X)))},forEach(Y){Q.forEach(Y)},map(Y){return R0.Set(Q.map(Y))},filter(Y){return R0.Set(Q.filter(Y))},toJSON(){return[...Q]}}},Date:(()=>{let Z=(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:H=0,hours:K=0,minutes:W=0,seconds:z=0,ms:_=0}={}){let q=new globalThis.Date(Y.getTime());if(J)q.setFullYear(q.getFullYear()+J);if(X)q.setMonth(q.getMonth()+X);if(H)q.setDate(q.getDate()+H);if(K)q.setHours(q.getHours()+K);if(W)q.setMinutes(q.getMinutes()+W);if(z)q.setSeconds(q.getSeconds()+z);if(_)q.setMilliseconds(q.getMilliseconds()+_);return Z(q)},diff(J,X="ms"){let H=typeof J==="object"&&J.timestamp?J.timestamp:new globalThis.Date(J).getTime(),K=Y.getTime()-H;switch(X){case"seconds":return K/1000;case"minutes":return K/60000;case"hours":return K/3600000;case"days":return K/86400000;default:return K}},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()}}),Q=(Y)=>{let J=Y!==void 0?new globalThis.Date(Y):new globalThis.Date;if(isNaN(J.getTime()))throw Error(`Invalid date: ${Y}`);return Z(J)};return Q.now=()=>globalThis.Date.now(),Q.parse=(Y)=>Z(new globalThis.Date(Y)),Q})()},n0={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."},f9=0.01,m1=0.0001,u1=0.001,h9=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 p(Z,Q){if(Z===null||Z===void 0)return Z;if(typeof Z!=="object"||!("$expr"in Z))return Z;if(Q.fuel){if(Q.fuel.current-=f9,Q.fuel.current<=0)throw Error("Out of Fuel")}switch(Z.$expr){case"literal":return Z.value;case"ident":{if(Z.name in Q.state)return Q.state[Z.name];if(Z.name in Q.args)return Q.args[Z.name];if(Z.name in R0)return R0[Z.name];if(Z.name in n0)throw Error(n0[Z.name]);return}case"member":{let Y=p(Z.object,Q);if(Z.optional&&(Y===null||Y===void 0))return;let J=Z.property;return x1(J),Y?.[J]}case"binary":{let Y=p(Z.left,Q),J=p(Z.right,Q);switch(Z.op){case"+":{let X=Y+J;if(typeof X==="string"&&Q.fuel){if(Q.fuel.current-=X.length*m1,Q.fuel.current<=0){Q.error=new s("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 c0(Y,J);case"!=":return!c0(Y,J);case"===":return Y===J;case"!==":return Y!==J;default:throw Error(`Unknown binary operator: ${Z.op}`)}}case"unary":{let Y=p(Z.argument,Q);switch(Z.op){case"!":return!Y;case"-":return-Y;case"+":return+Y;case"typeof":return typeof Y;default:throw Error(`Unknown unary operator: ${Z.op}`)}}case"logical":{let Y=p(Z.left,Q);if(Z.op==="&&")return Y?p(Z.right,Q):Y;else if(Z.op==="??")return Y??p(Z.right,Q);else return Y?Y:p(Z.right,Q)}case"conditional":return p(Z.test,Q)?p(Z.consequent,Q):p(Z.alternate,Q);case"array":return Z.elements.map((Y)=>p(Y,Q));case"object":{let Y={};for(let J of Z.properties)Y[J.key]=p(J.value,Q);return Y}case"call":{if(Z.callee==="Error"){let J=Z.arguments.map((H)=>p(H,Q)),X=typeof J[0]==="string"?J[0]:"Error";Q.error=new s(X,"Error");return}if(Z.callee in R0){let J=R0[Z.callee];if(typeof J==="function"){let X=Z.arguments.map((H)=>p(H,Q));return J(...X)}}if(!Q.resolver(Z.callee)){if(Z.callee in n0)throw Error(n0[Z.callee]);throw Error(`Unknown function: ${Z.callee}`)}throw Error(`Atom calls in expressions not yet supported: ${Z.callee}`)}case"methodCall":{let Y=p(Z.object,Q);if(Z.optional&&(Y===null||Y===void 0))return;let J=Z.method;if(x1(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 H=Z.arguments.map((W)=>p(W,Q)),K=X.apply(Y,H);if(Q.fuel&&h9.has(J)){let W=0;if(typeof K==="string")W=K.length*m1;else if(Array.isArray(K))W=K.length*u1;else if(typeof K==="object"&&K!==null)W=Object.keys(K).length*u1;if(Q.fuel.current-=W,Q.fuel.current<=0){Q.error=new s("Out of Fuel",`expr.${J}`);return}}return K}default:throw Error(`Unknown expression type: ${Z.$expr}`)}}function C(Z,Q,Y,J,X={}){let{docs:H="",timeoutMs:K=1000,cost:W=1}=typeof X==="string"?{docs:X}:X;return{op:Z,inputSchema:Q,outputSchema:Y,exec:async(_,q)=>{let{op:R,result:F,...O}=_;if(q.error)return;let U=q.trace?{...q.state}:null,L=q.fuel.current,B,j;try{let N=q.costOverrides?.[Z],I=N!==void 0?N:W,w=typeof I==="function"?I(O,q):I;if((q.fuel.current-=w)<=0){q.error=new s("Out of Fuel",Z);return}let S,A=async()=>J(_,q);if(B=K>0?await Promise.race([A(),new Promise((T,E)=>{S=setTimeout(()=>E(Error(`Atom '${Z}' timed out`)),K)})]).finally(()=>clearTimeout(S)):await A(),_.result){if(q.consts.has(_.result))throw Error(`Cannot reassign const variable '${_.result}'`);if(B!==void 0&&Y&&!U1(B,Y)){q.error=new s(`Output validation failed for '${Z}'`,Z);return}if(q.state[_.result]=B,_.resultConst)q.consts.add(_.result)}}catch(N){j=N.message||String(N),q.error=new s(j,Z,N)}finally{if(q.trace&&U){let N=y9(U,q.state);q.trace.push({op:Z,input:O,stateDiff:N,result:B,error:j,fuelBefore:L,fuelAfter:q.fuel.current,timestamp:new Date().toISOString()})}}},docs:H,timeoutMs:K,cost:W,create:(_)=>({op:Z,..._})}}var Q0=C("seq",$.object({steps:$.array($.any)}),void 0,async({steps:Z},Q)=>{for(let Y of Z){if(Q.output!==void 0)return;if(Q.error)return;let J=Q.resolver(Y.op);if(!J)throw Error(`Unknown Atom: ${Y.op}`);await J.exec(Y,Q)}},{docs:"Sequence",timeoutMs:0,cost:0.1}),x9=C("if",$.object({condition:$.any,then:$.array($.any),else:$.array($.any).optional}),void 0,async(Z,Q)=>{if(p(Z.condition,Q))await Q0.exec({op:"seq",steps:Z.then},Q);else if(Z.else)await Q0.exec({op:"seq",steps:Z.else},Q)},{docs:"If/Else",timeoutMs:0,cost:0.1}),m9=C("while",$.object({condition:$.any,body:$.array($.any)}),void 0,async(Z,Q)=>{while(p(Z.condition,Q)){if(Q.signal?.aborted)throw Error("Execution aborted");if((Q.fuel.current-=0.1)<=0)throw Error("Out of Fuel");if(await Q0.exec({op:"seq",steps:Z.body},Q),Q.output!==void 0)return}},{docs:"While Loop",timeoutMs:0,cost:0.1}),u9=C("return",void 0,$.any,async(Z,Q)=>{if(Q.error)return Q.output=Q.error,Q.error;if("value"in Z){let J=M(Z.value,Q);if(J!==void 0&&J!==null&&!P9(J)&&(typeof J!=="object"||Array.isArray(J))){let X=new s(`Agent must return an object, got ${Array.isArray(J)?"array":typeof J}`,"return");return Q.error=X,Q.output=X,X}return Q.output=J,J}let Y={};if(Z.schema?.properties){for(let J of Object.keys(Z.schema.properties))Y[J]=Q.state[J];if(Z.filter!==!1){let J=i1(Y,Z.schema);if(!(J instanceof Error))Y=J}}return Q.output=Y,Y},{docs:"Return",cost:0.1}),l9=C("try",$.object({try:$.array($.any),catch:$.array($.any).optional,catchParam:$.string.optional}),void 0,async(Z,Q)=>{if(await Q0.exec({op:"seq",steps:Z.try},Q),Q.error&&Z.catch){let Y=Z.catchParam||"error";Q.state[Y]=Q.error.message,Q.state.errorOp=Q.error.op,Q.error=void 0,await Q0.exec({op:"seq",steps:Z.catch},Q)}},{docs:"Try/Catch",timeoutMs:0,cost:0.1}),d9=C("Error",$.object({args:$.array($.any).optional}),void 0,async(Z,Q)=>{let Y=Z.args?.[0]??"Error";Q.error=new s(String(Y),"Error")},{docs:"Trigger error flow",cost:0.1}),p9=C("varSet",$.object({key:$.string,value:$.any}),void 0,async({key:Z,value:Q},Y)=>{if(Y.consts.has(Z))throw Error(`Cannot reassign const variable '${Z}'`);Y.state[Z]=M(Q,Y)},{docs:"Set Variable",cost:0.1}),i9=C("constSet",$.object({key:$.string,value:$.any}),void 0,async({key:Z,value:Q},Y)=>{if(Y.consts.has(Z))throw Error(`Cannot reassign const variable '${Z}'`);if(Z in Y.state)throw Error(`Cannot redeclare variable '${Z}' as const`);Y.state[Z]=M(Q,Y),Y.consts.add(Z)},{docs:"Set Const Variable (immutable)",cost:0.1}),n9=C("varGet",$.object({key:$.string}),$.any,async({key:Z},Q)=>{return M(Z,Q)},{docs:"Get Variable",cost:0.1}),c9=C("varsImport",$.object({keys:$.union([$.array($.string),$.record($.string)])}),void 0,async({keys:Z},Q)=>{if(Array.isArray(Z))for(let Y of Z)Q.state[Y]=M({$kind:"arg",path:Y},Q);else for(let[Y,J]of Object.entries(Z))Q.state[Y]=M({$kind:"arg",path:J},Q)},{docs:"Import variables from args into the current scope, with optional renaming.",cost:0.2}),o9=C("varsLet",$.record($.any),void 0,async(Z,Q)=>{for(let Y of Object.keys(Z)){if(Y==="op"||Y==="result")continue;Q.state[Y]=M(Z[Y],Q)}},{docs:"Initialize a set of variables in the current scope from the step object properties.",cost:0.1}),a9=C("varsExport",$.object({keys:$.union([$.array($.string),$.record($.string)])}),$.record($.any),async({keys:Z},Q)=>{let Y={};if(Array.isArray(Z))for(let J of Z)Y[J]=M(J,Q);else for(let[J,X]of Object.entries(Z))Y[J]=M(X,Q);return Y},{docs:"Export variables from the current scope, with optional renaming.",cost:0.2}),s9=C("scope",$.object({steps:$.array($.any)}),void 0,async({steps:Z},Q)=>{let Y=B0(Q);if(await Q0.exec({op:"seq",steps:Z},Y),Y.output!==void 0)Q.output=Y.output},{docs:"Create new scope",timeoutMs:0,cost:0.1}),r9=C("map",$.object({items:$.array($.any),as:$.string,steps:$.array($.any)}),$.array($.any),async({items:Z,as:Q,steps:Y},J)=>{let X=[],H=M(Z,J);if(!Array.isArray(H))throw Error("map: items is not an array");for(let K of H){if(J.signal?.aborted)throw Error("Execution aborted");let W=B0(J);W.state[Q]=K,await Q0.exec({op:"seq",steps:Y},W),X.push(W.state.result??null)}return X},{docs:"Map Array",timeoutMs:0,cost:1}),t9=C("filter",$.object({items:$.array($.any),as:$.string,condition:$.any}),$.array($.any),async({items:Z,as:Q,condition:Y},J)=>{let X=[],H=M(Z,J);if(!Array.isArray(H))throw Error("filter: items is not an array");for(let K of H){if(J.signal?.aborted)throw Error("Execution aborted");let W=B0(J);if(W.state[Q]=K,p(Y,W))X.push(K)}return X},{docs:"Filter Array",timeoutMs:0,cost:1}),e9=C("reduce",$.object({items:$.array($.any),as:$.string,accumulator:$.string,initial:$.any,steps:$.array($.any)}),$.any,async({items:Z,as:Q,accumulator:Y,initial:J,steps:X},H)=>{let K=M(Z,H),W=M(J,H);if(!Array.isArray(K))throw Error("reduce: items is not an array");let z=W;for(let _ of K){if(H.signal?.aborted)throw Error("Execution aborted");let q=B0(H);q.state[Q]=_,q.state[Y]=z,await Q0.exec({op:"seq",steps:X},q),z=q.state.result??z}return z},{docs:"Reduce Array",timeoutMs:0,cost:1}),ZZ=C("find",$.object({items:$.array($.any),as:$.string,condition:$.any}),$.any,async({items:Z,as:Q,condition:Y},J)=>{let X=M(Z,J);if(!Array.isArray(X))throw Error("find: items is not an array");for(let H of X){if(J.signal?.aborted)throw Error("Execution aborted");let K=B0(J);if(K.state[Q]=H,p(Y,K))return H}return null},{docs:"Find in Array",timeoutMs:0,cost:1}),QZ=C("push",$.object({list:$.array($.any),item:$.any}),$.array($.any),async({list:Z,item:Q},Y)=>{let J=M(Z,Y),X=M(Q,Y);if(Array.isArray(J))J.push(X);return J},{docs:"Push to Array",cost:1}),YZ=C("len",$.object({list:$.any}),$.number,async({list:Z},Q)=>{let Y=M(Z,Q);return Array.isArray(Y)||typeof Y==="string"?Y.length:0},{docs:"Length",cost:1}),JZ=C("split",$.object({str:$.string,sep:$.string}),$.array($.string),async({str:Z,sep:Q},Y)=>M(Z,Y).split(M(Q,Y)),{docs:"Split String",cost:1}),XZ=C("join",$.object({list:$.array($.string),sep:$.string}),$.string,async({list:Z,sep:Q},Y)=>M(Z,Y).join(M(Q,Y)),{docs:"Join String",cost:1}),KZ=C("template",$.object({tmpl:$.string,vars:$.record($.any)}),$.string,async({tmpl:Z,vars:Q},Y)=>{return M(Z,Y).replace(/\{\{(\w+)\}\}/g,(X,H)=>String(M(Q[H],Y)??""))},{docs:"String Template",cost:1}),HZ=C("regexMatch",$.object({pattern:$.string,value:$.any}),$.boolean,async({pattern:Z,value:Q},Y)=>{if(g9(Z))throw Error(`Suspicious regex pattern rejected (potential ReDoS): ${Z}`);let J=M(Q,Y);return new RegExp(Z).test(J)},{docs:"Returns true if the value matches the regex pattern.",cost:2}),WZ=C("pick",$.object({obj:$.record($.any),keys:$.array($.string)}),$.record($.any),async({obj:Z,keys:Q},Y)=>{let J=M(Z,Y),X=M(Q,Y),H={};if(J&&Array.isArray(X))X.forEach((K)=>H[K]=J[K]);return H},{docs:"Pick Keys",cost:1}),zZ=C("omit",$.object({obj:$.record($.any),keys:$.array($.string)}),$.record($.any),async({obj:Z,keys:Q},Y)=>{let J=M(Z,Y),X=new Set(M(Q,Y)),H={};if(J)Object.keys(J).forEach((K)=>{if(!X.has(K))H[K]=J[K]});return H},{docs:"Omit Keys",cost:1}),GZ=C("merge",$.object({a:$.record($.any),b:$.record($.any)}),$.record($.any),async({a:Z,b:Q},Y)=>({...M(Z,Y),...M(Q,Y)}),{docs:"Merge Objects",cost:1}),_Z=C("keys",$.object({obj:$.record($.any)}),$.array($.string),async({obj:Z},Q)=>Object.keys(M(Z,Q)??{}),{docs:"Object Keys",cost:1}),l1=10,d1="X-Agent-Depth";function qZ(Z,Q){try{let J=new URL(Z).hostname.toLowerCase();for(let X of Q){let H=X.toLowerCase();if(H.startsWith("*.")){let K=H.slice(1);if(J.endsWith(K)||J===H.slice(2))return!0}else if(J===H)return!0}return!1}catch{return!1}}var FZ=C("httpFetch",$.object({url:$.string,method:$.string.optional,headers:$.record($.string).optional,body:$.any.optional,responseType:$.string.optional}),$.any,async(Z,Q)=>{let Y=M(Z.url,Q),J=M(Z.method,Q),X=M(Z.headers,Q)||{},H=M(Z.body,Q),K=M(Z.responseType,Q),W=Q.context?.requestDepth??0;if(W>=l1)throw Error(`Agent request depth exceeded (max ${l1}). This prevents recursive agent loops.`);if(Q.capabilities.fetch)return Q.capabilities.fetch(Y,{method:J,headers:{...X,[d1]:String(W+1)},body:H,signal:Q.signal,responseType:K});let z=Q.context?.allowedFetchDomains;if(z){if(!qZ(Y,z))throw Error(`Fetch blocked: domain not in allowlist. Allowed: ${z.join(", ")}`)}else{if(k9(Y))throw Error("Blocked URL: private/internal addresses not allowed in default fetch");try{let q=new URL(Y).hostname.toLowerCase();if(q!=="localhost"&&q!=="127.0.0.1"&&q!=="[::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,[d1]:String(W+1)},body:H?JSON.stringify(H):void 0,signal:Q.signal});if(K==="dataUrl"){let R=await _.arrayBuffer(),F=new Uint8Array(R),O="";for(let B=0;B<F.length;B++)O+=String.fromCharCode(F[B]);let U=btoa(O);return`data:${_.headers.get("content-type")||"application/octet-stream"};base64,${U}`}let q=_.headers.get("content-type");if(K==="json"||q&&q.includes("application/json"))return _.json();return _.text()}throw Error("Capability 'fetch' missing and no global fetch available")},{docs:"HTTP Fetch",timeoutMs:30000,cost:5}),$Z=C("storeGet",$.object({key:$.string}),$.any,async({key:Z},Q)=>{let Y=M(Z,Q);return Q.capabilities.store?.get(Y)},{docs:"Store Get",cost:5}),RZ=C("storeSet",$.object({key:$.string,value:$.any}),void 0,async({key:Z,value:Q},Y)=>{let J=M(Z,Y),X=M(Q,Y);return Y.capabilities.store?.set(J,X)},{docs:"Store Set",cost:5}),OZ=C("storeQuery",$.object({query:$.any}),$.array($.any),async({query:Z},Q)=>Q.capabilities.store?.query?.(M(Z,Q))??[],{docs:"Store Query",cost:5}),UZ=C("storeVectorSearch",$.object({collection:$.string.optional,vector:$.array($.number),k:$.number.optional}),$.array($.any),async({collection:Z,vector:Q,k:Y},J)=>J.capabilities.store?.vectorSearch?.(M(Z,J),M(Q,J),M(Y,J))??[],{docs:"Vector Search",cost:(Z,Q)=>5+(M(Z.k,Q)??5)}),IZ=C("llmPredict",$.object({prompt:$.string,options:$.any.optional}),$.string,async({prompt:Z,options:Q},Y)=>{if(!Y.capabilities.llm?.predict)throw Error("Capability 'llm.predict' missing");return Y.capabilities.llm.predict(M(Z,Y),M(Q,Y))},{docs:"LLM Predict",timeoutMs:120000,cost:100}),MZ=C("agentRun",$.object({agentId:$.any,input:$.any}),$.any,async({agentId:Z,input:Q},Y)=>{let J=M(Z,Y),X=M(Q,Y),H=X;if(X&&typeof X==="object"&&!Array.isArray(X)){H={};for(let W in X)H[W]=M(X[W],Y)}if(M1(J)){let W=B1(J),z={...Y,args:H,state:{},consts:new Set,output:void 0,error:void 0},_=Y.resolver("seq");if(!_)throw Error("seq atom not found");if(await _.exec(W,z),z.error)throw Error(z.error.message||"Sub-agent failed");return z.output}if(J&&typeof J==="object"&&"op"in J){let W={...Y,args:H,state:{},consts:new Set,output:void 0,error:void 0},z=Y.resolver("seq");if(!z)throw Error("seq atom not found");if(await z.exec(J,W),W.error)throw Error(W.error.message||"Sub-agent failed");return W.output}if(!Y.capabilities.agent?.run)throw Error("Capability 'agent.run' missing");let K=await Y.capabilities.agent.run(J,H);if(K&&typeof K==="object"&&"fuelUsed"in K&&typeof K.fuelUsed==="number"){if(K.error)throw Error(K.error.message||"Sub-agent failed");return K.result}return K},{docs:"Run Sub-Agent (accepts procedure token, AST, or agent ID)",cost:1}),BZ=C("transpileCode",$.object({code:$.string}),$.any,async({code:Z},Q)=>{if(!Q.capabilities.code?.transpile)throw Error("Capability 'code.transpile' missing. Enable code transpilation by providing the code capability.");let Y=M(Z,Q);try{return Q.capabilities.code.transpile(Y)}catch(J){throw Error(`Code transpilation failed: ${J.message}`)}},{docs:"Transpile AsyncJS code to AST",cost:1}),p1=10,LZ=C("runCode",$.object({code:$.string,args:$.record($.any).optional}),$.any,async({code:Z,args:Q},Y)=>{let J=Y.runCodeDepth??0;if(J>=p1)throw Error(`runCode recursion limit exceeded (max ${p1}). 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=M(Z,Y),H=Q?M(Q,Y):{},K;try{K=Y.capabilities.code.transpile(X)}catch(z){throw Error(`Code transpilation failed: ${z.message}`)}if(K.op!=="seq")throw Error("Transpiled code must be a seq node");let W=B0(Y);if(W.args=H,W.output=void 0,W.runCodeDepth=J+1,await Q0.exec(K,W),W.error){Y.error=W.error;return}return W.output},{docs:"Run dynamically generated AsyncJS code",cost:1}),jZ=C("jsonParse",$.object({str:$.string}),$.any,async({str:Z},Q)=>JSON.parse(M(Z,Q)),{docs:"Parse JSON",cost:1}),NZ=C("jsonStringify",$.object({value:$.any}),$.string,async({value:Z},Q)=>JSON.stringify(M(Z,Q)),{docs:"Stringify JSON",cost:1}),wZ=C("xmlParse",$.object({str:$.string}),$.any,async({str:Z},Q)=>{if(!Q.capabilities.xml?.parse)throw Error("Capability 'xml.parse' missing");return Q.capabilities.xml.parse(M(Z,Q))},{docs:"Parse XML",cost:1}),AZ=C("memoize",$.object({key:$.string.optional,steps:$.array($.any)}),$.any,async({key:Z,steps:Q},Y)=>{if(!Y.memo)Y.memo=new Map;let J=M(Z,Y)??await L1.exec({value:Q,algorithm:"SHA-256"},Y);if(Y.memo.has(J))return Y.memo.get(J);let X=B0(Y);await Q0.exec({op:"seq",steps:Q},X);let H=X.output??X.state.result;return Y.memo.set(J,H),H},{docs:"Memoize steps result in memory",cost:1}),VZ=C("cache",$.object({key:$.string.optional,steps:$.array($.any),ttlMs:$.number.optional}),$.any,async({key:Z,steps:Q,ttlMs:Y},J)=>{if(!J.capabilities.store)throw Error("Capability 'store' missing for caching");let H=`cache:${M(Z,J)??await L1.exec({value:Q,algorithm:"SHA-256"},J)}`,K=await J.capabilities.store.get(H);if(K)if(typeof K==="object"&&K._exp){if(Date.now()<K._exp)return K.val}else return K;let W=B0(J);await Q0.exec({op:"seq",steps:Q},W);let z=W.output??W.state.result,_=Date.now()+(Y??86400000);if((J.fuel.current-=5)<=0)throw Error("Out of Fuel");return await J.capabilities.store.set(H,{val:z,_exp:_}),z},{docs:"Cache steps result in store with TTL",cost:5}),DZ=C("random",$.object({min:$.number.optional,max:$.number.optional,format:$.string.optional,length:$.number.optional}),$.any,async({min:Z,max:Q,format:Y,length:J},X)=>{let H=M(Y,X)??"float",K=M(J,X)??10,W=M(Z,X)??0,z=M(Q,X)??1;if(H==="base36"){let O="";if(typeof crypto<"u"&&crypto.getRandomValues){let U=new Uint8Array(K);crypto.getRandomValues(U);for(let L=0;L<K;L++)O+="0123456789abcdefghijklmnopqrstuvwxyz"[U[L]%36]}else for(let U=0;U<K;U++)O+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(Math.floor(Math.random()*36));return O}let _;if(typeof crypto<"u"&&crypto.getRandomValues){let F=new Uint32Array(1);crypto.getRandomValues(F),_=F[0]/4294967296}else _=Math.random();let q=z-W,R=_*q+W;if(H==="integer")return Math.floor(R);return R},{docs:"Generate Random",cost:1}),TZ=C("uuid",void 0,$.string,async()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();if(typeof crypto<"u"&&crypto.getRandomValues){let Z=new Uint8Array(16);crypto.getRandomValues(Z),Z[6]=Z[6]&15|64,Z[8]=Z[8]&63|128;let Q=Array.from(Z,(Y)=>Y.toString(16).padStart(2,"0")).join("");return`${Q.slice(0,8)}-${Q.slice(8,12)}-${Q.slice(12,16)}-${Q.slice(16,20)}-${Q.slice(20)}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(Z)=>{let Q=Math.random()*16|0;return(Z==="x"?Q:Q&3|8).toString(16)})},{docs:"Generate UUID",cost:1}),L1=C("hash",$.object({value:$.any,algorithm:$.string.optional}),$.string,async({value:Z,algorithm:Q},Y)=>{let J=typeof Z==="string"?Z:JSON.stringify(M(Z,Y)),X=M(Q,Y)||"SHA-256";if(typeof crypto<"u"&&crypto.subtle){let W=new TextEncoder().encode(J),z=await crypto.subtle.digest(X,W);return Array.from(new Uint8Array(z)).map((q)=>q.toString(16).padStart(2,"0")).join("")}let H=0;for(let K=0;K<J.length;K++){let W=J.charCodeAt(K);H=(H<<5)-H+W,H|=0}return String(H)},{docs:"Hash a value",cost:1}),CZ=C("consoleLog",$.object({message:$.any}),void 0,async({message:Z},Q)=>{let Y=M(Z,Q);if(Q.trace)Q.trace.push({op:"console.log",input:{message:Y},stateDiff:{},result:Y,fuelBefore:Q.fuel.current,fuelAfter:Q.fuel.current,timestamp:new Date().toISOString()})},{docs:"Log to trace",cost:0.1}),PZ=C("consoleWarn",$.object({message:$.any}),void 0,async({message:Z},Q)=>{let Y=M(Z,Q),J=typeof Y==="string"?Y:JSON.stringify(Y);if(!Q.warnings)Q.warnings=[];if(Q.warnings.push(J),Q.trace)Q.trace.push({op:"console.warn",input:{message:Y},stateDiff:{},result:Y,fuelBefore:Q.fuel.current,fuelAfter:Q.fuel.current,timestamp:new Date().toISOString()})},{docs:"Add warning",cost:0.1}),SZ=C("consoleError",$.object({message:$.any}),void 0,async({message:Z},Q)=>{let Y=M(Z,Q),J=typeof Y==="string"?Y:JSON.stringify(Y);Q.error=new s(J,"console.error")},{docs:"Emit error and stop",cost:0.1}),bZ=C("storeProcedure",$.object({ast:$.any,ttl:$.number.optional,maxSize:$.number.optional}),$.string,async({ast:Z,ttl:Q,maxSize:Y},J)=>{let X=M(Z,J),H=Q?M(Q,J):S9,K=Y?M(Y,J):b9;if(!X||typeof X!=="object"||!X.op)throw Error('Invalid AST: must be an object with an "op" property');let W=JSON.stringify(X);if(W.length>K)throw Error(`AST too large: ${W.length} bytes exceeds limit of ${K} bytes. Consider reducing AST size or using a shorter TTL.`);let z=E9(),_=Date.now();return C0.set(z,{ast:X,createdAt:_,expiresAt:_+H}),z},{docs:"Store an AST and return a token for later execution",cost:1}),EZ=C("releaseProcedure",$.object({token:$.string}),$.boolean,async({token:Z},Q)=>{let Y=M(Z,Q);return C0.delete(Y)},{docs:"Release a stored procedure by token",cost:0.1}),vZ=C("clearExpiredProcedures",void 0,$.number,async()=>{let Z=Date.now(),Q=0;for(let[Y,J]of C0)if(Z>J.expiresAt)C0.delete(Y),Q++;return Q},{docs:"Clear all expired procedures and return count",cost:0.5}),c1={seq:Q0,if:x9,while:m9,return:u9,try:l9,Error:d9,varSet:p9,constSet:i9,varGet:n9,varsImport:c9,varsLet:o9,varsExport:a9,scope:s9,map:r9,filter:t9,reduce:e9,find:ZZ,push:QZ,len:YZ,split:JZ,join:XZ,template:KZ,regexMatch:HZ,pick:WZ,omit:zZ,merge:GZ,keys:_Z,httpFetch:FZ,storeGet:$Z,storeSet:RZ,storeQuery:OZ,storeVectorSearch:UZ,llmPredict:IZ,agentRun:MZ,transpileCode:BZ,runCode:LZ,jsonParse:jZ,jsonStringify:NZ,xmlParse:wZ,memoize:AZ,cache:VZ,random:DZ,uuid:TZ,hash:L1,consoleLog:CZ,consoleWarn:PZ,consoleError:SZ,storeProcedure:bZ,releaseProcedure:EZ,clearExpiredProcedures:vZ};var kZ=new Set(["true","false","null","undefined","and","or","not"]);function gZ(Z,Q){let Y=Z.replace(/"[^"]*"/g,'""').replace(/'[^']*'/g,"''"),J=[],X=/(?<![.])\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g,H;while((H=X.exec(Y))!==null)J.push(H[1]);let W=[...new Set(J)].filter((z)=>!kZ.has(z)&&!(z in Q)&&!new RegExp(`\\b${z}\\s*\\(`).test(Y));if(W.length>0)console.warn(`[Agent99 Builder] Condition "${Z}" references variables not in vars mapping: ${W.join(", ")}. Add them to vars or use AsyncJS syntax (ajs\`...\`) which handles this automatically.`)}function o0(Z,Q){gZ(Z,Q);let Y=yZ(Z),J=t1(Y,0,Q);if(J.pos<Y.length){let X=Y.slice(J.pos).join(" ");throw Error(`Unsupported condition syntax near '${X}' in: ${Z}
2
+ Supported: comparisons, &&, ||, !, arithmetic, member access (a.b), literals`)}return J.node}function yZ(Z){let Q=[],Y=0;while(Y<Z.length){while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y>=Z.length)break;if(Z[Y]==='"'||Z[Y]==="'"){let J=Z[Y++],X="";while(Y<Z.length&&Z[Y]!==J)if(Z[Y]==="\\"&&Y+1<Z.length)Y++,X+=Z[Y++];else X+=Z[Y++];Y++,Q.push(JSON.stringify(X));continue}if(Z.slice(Y,Y+2).match(/^(&&|\|\||==|!=|>=|<=)$/)){Q.push(Z.slice(Y,Y+2)),Y+=2;continue}if("+-*/%><!().?:[]".includes(Z[Y])){Q.push(Z[Y]),Y++;continue}if(/\d/.test(Z[Y])){let J="";while(Y<Z.length&&/[\d.]/.test(Z[Y]))J+=Z[Y++];Q.push(J);continue}if(/[a-zA-Z_]/.test(Z[Y])){let J="";while(Y<Z.length&&/[a-zA-Z0-9_]/.test(Z[Y]))J+=Z[Y++];Q.push(J);continue}Y++}return Q}function t1(Z,Q,Y){return fZ(Z,Q,Y)}function fZ(Z,Q,Y){let{node:J,pos:X}=o1(Z,Q,Y);while(Z[X]==="||"){X++;let{node:H,pos:K}=o1(Z,X,Y);J={$expr:"logical",op:"||",left:J,right:H},X=K}return{node:J,pos:X}}function o1(Z,Q,Y){let{node:J,pos:X}=a1(Z,Q,Y);while(Z[X]==="&&"){X++;let{node:H,pos:K}=a1(Z,X,Y);J={$expr:"logical",op:"&&",left:J,right:H},X=K}return{node:J,pos:X}}function a1(Z,Q,Y){let{node:J,pos:X}=s1(Z,Q,Y),H=["==","!=",">","<",">=","<="];while(H.includes(Z[X])){let K=Z[X++],{node:W,pos:z}=s1(Z,X,Y);J={$expr:"binary",op:K,left:J,right:W},X=z}return{node:J,pos:X}}function s1(Z,Q,Y){let{node:J,pos:X}=r1(Z,Q,Y);while(Z[X]==="+"||Z[X]==="-"){let H=Z[X++],{node:K,pos:W}=r1(Z,X,Y);J={$expr:"binary",op:H,left:J,right:K},X=W}return{node:J,pos:X}}function r1(Z,Q,Y){let{node:J,pos:X}=j1(Z,Q,Y);while(Z[X]==="*"||Z[X]==="/"||Z[X]==="%"){let H=Z[X++],{node:K,pos:W}=j1(Z,X,Y);J={$expr:"binary",op:H,left:J,right:K},X=W}return{node:J,pos:X}}function j1(Z,Q,Y){if(Z[Q]==="!"||Z[Q]==="-"){let J=Z[Q++],{node:X,pos:H}=j1(Z,Q,Y);return{node:{$expr:"unary",op:J,argument:X},pos:H}}return hZ(Z,Q,Y)}function hZ(Z,Q,Y){let J=Z[Q];if(J==="("){let{node:X,pos:H}=t1(Z,Q+1,Y);return{node:X,pos:H+1}}if(J&&J.startsWith('"'))return{node:{$expr:"literal",value:JSON.parse(J)},pos:Q+1};if(J&&/^\d/.test(J))return{node:{$expr:"literal",value:parseFloat(J)},pos:Q+1};if(J==="true")return{node:{$expr:"literal",value:!0},pos:Q+1};if(J==="false")return{node:{$expr:"literal",value:!1},pos:Q+1};if(J==="null")return{node:{$expr:"literal",value:null},pos:Q+1};if(J&&/^[a-zA-Z_]/.test(J)){let X={$expr:"ident",name:J},H=Q+1;while(Z[H]==="."){H++;let K=Z[H++];X={$expr:"member",object:X,property:K}}return{node:X,pos:H}}return{node:{$expr:"literal",value:null},pos:Q+1}}class r{steps=[];atoms;proxy;constructor(Z){return this.atoms=Z,this.proxy=new Proxy(this,{get:(Q,Y,J)=>{if(Y in Q)return Q[Y];if(typeof Y==="string"&&Y in Q.atoms)return(X)=>{let H=Q.atoms[Y];return Q.add(H.create(X)),J};return}}),this.proxy}add(Z){return this.steps.push(Z),this.proxy}as(Z){if(this.steps.length===0)throw Error("No step to capture");let Q=this.steps[this.steps.length-1];return Q.result=Z,this.proxy}step(Z){return this.add(Z)}return(Z){let Q=this.atoms.return;if(!Q)throw Error("Atom 'return' not found");let Y=Z.schema??Z;return this.add(Q.create({schema:Y}))}toJSON(){return{op:"seq",steps:[...this.steps]}}varsImport(Z){return this.add(this.atoms.varsImport.create({keys:Z}))}varsExport(Z){return this.add(this.atoms.varsExport.create({keys:Z}))}if(Z,Q,Y,J){let X=new r(this.atoms);Y(X);let H;if(J){let z=new r(this.atoms);J(z),H=z.steps}let K=o0(Z,Q),W=this.atoms.if;return this.add(W.create({condition:K,then:X.steps,else:H}))}while(Z,Q,Y){let J=new r(this.atoms);Y(J);let X=o0(Z,Q),H=this.atoms.while;return this.add(H.create({condition:X,body:J.steps}))}scope(Z){let Q=new r(this.atoms);Z(Q);let Y=this.atoms.scope;return this.add(Y.create({steps:Q.steps}))}map(Z,Q,Y){let J=new r(this.atoms);Y(J);let X=this.atoms.map;return this.add(X.create({items:Z,as:Q,steps:J.steps}))}filter(Z,Q,Y,J={}){let X=o0(Y,J),H=this.atoms.filter;return this.add(H.create({items:Z,as:Q,condition:X}))}find(Z,Q,Y,J={}){let X=o0(Y,J),H=this.atoms.find;return this.add(H.create({items:Z,as:Q,condition:X}))}reduce(Z,Q,Y,J,X){let H=new r(this.atoms);X(H);let K=this.atoms.reduce;return this.add(K.create({items:Z,as:Q,accumulator:Y,initial:J,steps:H.steps}))}memoize(Z,Q){let Y=new r(this.atoms);Z(Y);let J=this.atoms.memoize;return this.add(J.create({key:Q,steps:Y.steps}))}cache(Z,Q,Y){let J=new r(this.atoms);Z(J);let X=this.atoms.cache;return this.add(X.create({key:Q,steps:J.steps,ttlMs:Y}))}try(Z){let Q=new r(this.atoms);Z.try(Q);let Y;if(Z.catch){let X=new r(this.atoms);Z.catch(X),Y=X.steps}let J=this.atoms.try;return this.add(J.create({try:Q.steps,catch:Y}))}}import{validate as r6}from"tosijs-schema";var xZ=[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],J8=[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],mZ="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",X8="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",N1={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"},w1="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",uZ={5:w1,"5module":w1+" export import",6:w1+" const class extends export import super"},lZ=/^in(stanceof)?$/,dZ=new RegExp("["+X8+"]"),pZ=new RegExp("["+X8+mZ+"]");function A1(Z,Q){var Y=65536;for(var J=0;J<Q.length;J+=2){if(Y+=Q[J],Y>Z)return!1;if(Y+=Q[J+1],Y>=Z)return!0}return!1}function G0(Z,Q){if(Z<65)return Z===36;if(Z<91)return!0;if(Z<97)return Z===95;if(Z<123)return!0;if(Z<=65535)return Z>=170&&dZ.test(String.fromCharCode(Z));if(Q===!1)return!1;return A1(Z,J8)}function j0(Z,Q){if(Z<48)return Z===36;if(Z<58)return!0;if(Z<65)return!1;if(Z<91)return!0;if(Z<97)return Z===95;if(Z<123)return!0;if(Z<=65535)return Z>=170&&pZ.test(String.fromCharCode(Z));if(Q===!1)return!1;return A1(Z,J8)||A1(Z,xZ)}var h=function(Q,Y){if(Y===void 0)Y={};this.label=Q,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 Y0(Z,Q){return new h(Z,{beforeExpr:!0,binop:Q})}var J0={beforeExpr:!0},t={startsExpr:!0},P1={};function y(Z,Q){if(Q===void 0)Q={};return Q.keyword=Z,P1[Z]=new h(Z,Q)}var G={num:new h("num",t),regexp:new h("regexp",t),string:new h("string",t),name:new h("name",t),privateId:new h("privateId",t),eof:new h("eof"),bracketL:new h("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new h("]"),braceL:new h("{",{beforeExpr:!0,startsExpr:!0}),braceR:new h("}"),parenL:new h("(",{beforeExpr:!0,startsExpr:!0}),parenR:new h(")"),comma:new h(",",J0),semi:new h(";",J0),colon:new h(":",J0),dot:new h("."),question:new h("?",J0),questionDot:new h("?."),arrow:new h("=>",J0),template:new h("template"),invalidTemplate:new h("invalidTemplate"),ellipsis:new h("...",J0),backQuote:new h("`",t),dollarBraceL:new h("${",{beforeExpr:!0,startsExpr:!0}),eq:new h("=",{beforeExpr:!0,isAssign:!0}),assign:new h("_=",{beforeExpr:!0,isAssign:!0}),incDec:new h("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new h("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Y0("||",1),logicalAND:Y0("&&",2),bitwiseOR:Y0("|",3),bitwiseXOR:Y0("^",4),bitwiseAND:Y0("&",5),equality:Y0("==/!=/===/!==",6),relational:Y0("</>/<=/>=",7),bitShift:Y0("<</>>/>>>",8),plusMin:new h("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Y0("%",10),star:Y0("*",10),slash:Y0("/",10),starstar:new h("**",{beforeExpr:!0}),coalesce:Y0("??",1),_break:y("break"),_case:y("case",J0),_catch:y("catch"),_continue:y("continue"),_debugger:y("debugger"),_default:y("default",J0),_do:y("do",{isLoop:!0,beforeExpr:!0}),_else:y("else",J0),_finally:y("finally"),_for:y("for",{isLoop:!0}),_function:y("function",t),_if:y("if"),_return:y("return",J0),_switch:y("switch"),_throw:y("throw",J0),_try:y("try"),_var:y("var"),_const:y("const"),_while:y("while",{isLoop:!0}),_with:y("with"),_new:y("new",{beforeExpr:!0,startsExpr:!0}),_this:y("this",t),_super:y("super",t),_class:y("class",t),_extends:y("extends",J0),_export:y("export"),_import:y("import",t),_null:y("null",t),_true:y("true",t),_false:y("false",t),_in:y("in",{beforeExpr:!0,binop:7}),_instanceof:y("instanceof",{beforeExpr:!0,binop:7}),_typeof:y("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:y("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:y("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},e=/\r\n?|\n|\u2028|\u2029/,iZ=new RegExp(e.source,"g");function P0(Z){return Z===10||Z===13||Z===8232||Z===8233}function K8(Z,Q,Y){if(Y===void 0)Y=Z.length;for(var J=Q;J<Y;J++){var X=Z.charCodeAt(J);if(P0(X))return J<Y-1&&X===13&&Z.charCodeAt(J+1)===10?J+2:J+1}return-1}var H8=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,o=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,W8=Object.prototype,nZ=W8.hasOwnProperty,cZ=W8.toString,S0=Object.hasOwn||function(Z,Q){return nZ.call(Z,Q)},e1=Array.isArray||function(Z){return cZ.call(Z)==="[object Array]"},Z8=Object.create(null);function L0(Z){return Z8[Z]||(Z8[Z]=new RegExp("^(?:"+Z.replace(/ /g,"|")+")$"))}function O0(Z){if(Z<=65535)return String.fromCharCode(Z);return Z-=65536,String.fromCharCode((Z>>10)+55296,(Z&1023)+56320)}var oZ=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,y0=function(Q,Y){this.line=Q,this.column=Y};y0.prototype.offset=function(Q){return new y0(this.line,this.column+Q)};var Z1=function(Q,Y,J){if(this.start=Y,this.end=J,Q.sourceFile!==null)this.source=Q.sourceFile};function z8(Z,Q){for(var Y=1,J=0;;){var X=K8(Z,J,Q);if(X<0)return new y0(Y,Q-J);++Y,J=X}}var V1={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},Q8=!1;function aZ(Z){var Q={};for(var Y in V1)Q[Y]=Z&&S0(Z,Y)?Z[Y]:V1[Y];if(Q.ecmaVersion==="latest")Q.ecmaVersion=1e8;else if(Q.ecmaVersion==null){if(!Q8&&typeof console==="object"&&console.warn)Q8=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
3
+ Defaulting to 2020, but this will stop working in the future.`);Q.ecmaVersion=11}else if(Q.ecmaVersion>=2015)Q.ecmaVersion-=2009;if(Q.allowReserved==null)Q.allowReserved=Q.ecmaVersion<5;if(!Z||Z.allowHashBang==null)Q.allowHashBang=Q.ecmaVersion>=14;if(e1(Q.onToken)){var J=Q.onToken;Q.onToken=function(X){return J.push(X)}}if(e1(Q.onComment))Q.onComment=sZ(Q,Q.onComment);return Q}function sZ(Z,Q){return function(Y,J,X,H,K,W){var z={type:Y?"Block":"Line",value:J,start:X,end:H};if(Z.locations)z.loc=new Z1(this,K,W);if(Z.ranges)z.range=[X,H];Q.push(z)}}var f0=1,b0=2,S1=4,G8=8,b1=16,_8=32,Q1=64,q8=128,V0=256,h0=512,Y1=f0|b0|V0;function E1(Z,Q){return b0|(Z?S1:0)|(Q?G8:0)}var s0=0,v1=1,I0=2,F8=3,$8=4,R8=5,i=function(Q,Y,J){this.options=Q=aZ(Q),this.sourceFile=Q.sourceFile,this.keywords=L0(uZ[Q.ecmaVersion>=6?6:Q.sourceType==="module"?"5module":5]);var X="";if(Q.allowReserved!==!0){if(X=N1[Q.ecmaVersion>=6?6:Q.ecmaVersion===5?5:3],Q.sourceType==="module")X+=" await"}this.reservedWords=L0(X);var H=(X?X+" ":"")+N1.strict;if(this.reservedWordsStrict=L0(H),this.reservedWordsStrictBind=L0(H+" "+N1.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(e).length;else this.pos=this.lineStart=0,this.curLine=1;if(this.type=G.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=Q.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&&Q.allowHashBang&&this.input.slice(0,2)==="#!")this.skipLineComment(2);this.scopeStack=[],this.enterScope(f0),this.regexpState=null,this.privateNameStack=[]},_0={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}};i.prototype.parse=function(){var Q=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(Q)};_0.inFunction.get=function(){return(this.currentVarScope().flags&b0)>0};_0.inGenerator.get=function(){return(this.currentVarScope().flags&G8)>0};_0.inAsync.get=function(){return(this.currentVarScope().flags&S1)>0};_0.canAwait.get=function(){for(var Z=this.scopeStack.length-1;Z>=0;Z--){var Q=this.scopeStack[Z],Y=Q.flags;if(Y&(V0|h0))return!1;if(Y&b0)return(Y&S1)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};_0.allowSuper.get=function(){var Z=this.currentThisScope(),Q=Z.flags;return(Q&Q1)>0||this.options.allowSuperOutsideMethod};_0.allowDirectSuper.get=function(){return(this.currentThisScope().flags&q8)>0};_0.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};_0.allowNewDotTarget.get=function(){for(var Z=this.scopeStack.length-1;Z>=0;Z--){var Q=this.scopeStack[Z],Y=Q.flags;if(Y&(V0|h0)||Y&b0&&!(Y&b1))return!0}return!1};_0.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&V0)>0};i.extend=function(){var Q=[],Y=arguments.length;while(Y--)Q[Y]=arguments[Y];var J=this;for(var X=0;X<Q.length;X++)J=Q[X](J);return J};i.parse=function(Q,Y){return new this(Y,Q).parse()};i.parseExpressionAt=function(Q,Y,J){var X=new this(J,Q,Y);return X.nextToken(),X.parseExpression()};i.tokenizer=function(Q,Y){return new this(Y,Q)};Object.defineProperties(i.prototype,_0);var a=i.prototype,rZ=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;a.strictDirective=function(Z){if(this.options.ecmaVersion<5)return!1;for(;;){o.lastIndex=Z,Z+=o.exec(this.input)[0].length;var Q=rZ.exec(this.input.slice(Z));if(!Q)return!1;if((Q[1]||Q[2])==="use strict"){o.lastIndex=Z+Q[0].length;var Y=o.exec(this.input),J=Y.index+Y[0].length,X=this.input.charAt(J);return X===";"||X==="}"||e.test(Y[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(X)||X==="!"&&this.input.charAt(J+1)==="=")}if(Z+=Q[0].length,o.lastIndex=Z,Z+=o.exec(this.input)[0].length,this.input[Z]===";")Z++}};a.eat=function(Z){if(this.type===Z)return this.next(),!0;else return!1};a.isContextual=function(Z){return this.type===G.name&&this.value===Z&&!this.containsEsc};a.eatContextual=function(Z){if(!this.isContextual(Z))return!1;return this.next(),!0};a.expectContextual=function(Z){if(!this.eatContextual(Z))this.unexpected()};a.canInsertSemicolon=function(){return this.type===G.eof||this.type===G.braceR||e.test(this.input.slice(this.lastTokEnd,this.start))};a.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};a.semicolon=function(){if(!this.eat(G.semi)&&!this.insertSemicolon())this.unexpected()};a.afterTrailingComma=function(Z,Q){if(this.type===Z){if(this.options.onTrailingComma)this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc);if(!Q)this.next();return!0}};a.expect=function(Z){this.eat(Z)||this.unexpected()};a.unexpected=function(Z){this.raise(Z!=null?Z:this.start,"Unexpected token")};var J1=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};a.checkPatternErrors=function(Z,Q){if(!Z)return;if(Z.trailingComma>-1)this.raiseRecoverable(Z.trailingComma,"Comma is not permitted after the rest element");var Y=Q?Z.parenthesizedAssign:Z.parenthesizedBind;if(Y>-1)this.raiseRecoverable(Y,Q?"Assigning to rvalue":"Parenthesized pattern")};a.checkExpressionErrors=function(Z,Q){if(!Z)return!1;var{shorthandAssign:Y,doubleProto:J}=Z;if(!Q)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")};a.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")};a.isSimpleAssignTarget=function(Z){if(Z.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(Z.expression);return Z.type==="Identifier"||Z.type==="MemberExpression"};var D=i.prototype;D.parseTopLevel=function(Z){var Q=Object.create(null);if(!Z.body)Z.body=[];while(this.type!==G.eof){var Y=this.parseStatement(null,!0,Q);Z.body.push(Y)}if(this.inModule)for(var J=0,X=Object.keys(this.undefinedExports);J<X.length;J+=1){var H=X[J];this.raiseRecoverable(this.undefinedExports[H].start,"Export '"+H+"' is not defined")}return this.adaptDirectivePrologue(Z.body),this.next(),Z.sourceType=this.options.sourceType,this.finishNode(Z,"Program")};var k1={kind:"loop"},tZ={kind:"switch"};D.isLet=function(Z){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;o.lastIndex=this.pos;var Q=o.exec(this.input),Y=this.pos+Q[0].length,J=this.input.charCodeAt(Y);if(J===91||J===92)return!0;if(Z)return!1;if(J===123||J>55295&&J<56320)return!0;if(G0(J,!0)){var X=Y+1;while(j0(J=this.input.charCodeAt(X),!0))++X;if(J===92||J>55295&&J<56320)return!0;var H=this.input.slice(Y,X);if(!lZ.test(H))return!0}return!1};D.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;o.lastIndex=this.pos;var Z=o.exec(this.input),Q=this.pos+Z[0].length,Y;return!e.test(this.input.slice(this.pos,Q))&&this.input.slice(Q,Q+8)==="function"&&(Q+8===this.input.length||!(j0(Y=this.input.charCodeAt(Q+8))||Y>55295&&Y<56320))};D.isUsingKeyword=function(Z,Q){if(this.options.ecmaVersion<17||!this.isContextual(Z?"await":"using"))return!1;o.lastIndex=this.pos;var Y=o.exec(this.input),J=this.pos+Y[0].length;if(e.test(this.input.slice(this.pos,J)))return!1;if(Z){var X=J+5,H;if(this.input.slice(J,X)!=="using"||X===this.input.length||j0(H=this.input.charCodeAt(X))||H>55295&&H<56320)return!1;o.lastIndex=X;var K=o.exec(this.input);if(K&&e.test(this.input.slice(X,X+K[0].length)))return!1}if(Q){var W=J+2,z;if(this.input.slice(J,W)==="of"){if(W===this.input.length||!j0(z=this.input.charCodeAt(W))&&!(z>55295&&z<56320))return!1}}var _=this.input.charCodeAt(J);return G0(_,!0)||_===92};D.isAwaitUsing=function(Z){return this.isUsingKeyword(!0,Z)};D.isUsing=function(Z){return this.isUsingKeyword(!1,Z)};D.parseStatement=function(Z,Q,Y){var J=this.type,X=this.startNode(),H;if(this.isLet(Z))J=G._var,H="let";switch(J){case G._break:case G._continue:return this.parseBreakContinueStatement(X,J.keyword);case G._debugger:return this.parseDebuggerStatement(X);case G._do:return this.parseDoStatement(X);case G._for:return this.parseForStatement(X);case G._function:if(Z&&(this.strict||Z!=="if"&&Z!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(X,!1,!Z);case G._class:if(Z)this.unexpected();return this.parseClass(X,!0);case G._if:return this.parseIfStatement(X);case G._return:return this.parseReturnStatement(X);case G._switch:return this.parseSwitchStatement(X);case G._throw:return this.parseThrowStatement(X);case G._try:return this.parseTryStatement(X);case G._const:case G._var:if(H=H||this.value,Z&&H!=="var")this.unexpected();return this.parseVarStatement(X,H);case G._while:return this.parseWhileStatement(X);case G._with:return this.parseWithStatement(X);case G.braceL:return this.parseBlock(!0,X);case G.semi:return this.parseEmptyStatement(X);case G._export:case G._import:if(this.options.ecmaVersion>10&&J===G._import){o.lastIndex=this.pos;var K=o.exec(this.input),W=this.pos+K[0].length,z=this.input.charCodeAt(W);if(z===40||z===46)return this.parseExpressionStatement(X,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!Q)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===G._import?this.parseImport(X):this.parseExport(X,Y);default:if(this.isAsyncFunction()){if(Z)this.unexpected();return this.next(),this.parseFunctionStatement(X,!0,!Z)}var _=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(_){if(Q&&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 q=this.value,R=this.parseExpression();if(J===G.name&&R.type==="Identifier"&&this.eat(G.colon))return this.parseLabeledStatement(X,q,R,Z);else return this.parseExpressionStatement(X,R)}};D.parseBreakContinueStatement=function(Z,Q){var Y=Q==="break";if(this.next(),this.eat(G.semi)||this.insertSemicolon())Z.label=null;else if(this.type!==G.name)this.unexpected();else Z.label=this.parseIdent(),this.semicolon();var J=0;for(;J<this.labels.length;++J){var X=this.labels[J];if(Z.label==null||X.name===Z.label.name){if(X.kind!=null&&(Y||X.kind==="loop"))break;if(Z.label&&Y)break}}if(J===this.labels.length)this.raise(Z.start,"Unsyntactic "+Q);return this.finishNode(Z,Y?"BreakStatement":"ContinueStatement")};D.parseDebuggerStatement=function(Z){return this.next(),this.semicolon(),this.finishNode(Z,"DebuggerStatement")};D.parseDoStatement=function(Z){if(this.next(),this.labels.push(k1),Z.body=this.parseStatement("do"),this.labels.pop(),this.expect(G._while),Z.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(G.semi);else this.semicolon();return this.finishNode(Z,"DoWhileStatement")};D.parseForStatement=function(Z){this.next();var Q=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(k1),this.enterScope(0),this.expect(G.parenL),this.type===G.semi){if(Q>-1)this.unexpected(Q);return this.parseFor(Z,null)}var Y=this.isLet();if(this.type===G._var||this.type===G._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(Z,J,Q)}var H=this.isContextual("let"),K=!1,W=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(W){var z=this.startNode();if(this.next(),W==="await using")this.next();return this.parseVar(z,!0,W),this.finishNode(z,"VariableDeclaration"),this.parseForAfterInit(Z,z,Q)}var _=this.containsEsc,q=new J1,R=this.start,F=Q>-1?this.parseExprSubscripts(q,"await"):this.parseExpression(!0,q);if(this.type===G._in||(K=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(Q>-1){if(this.type===G._in)this.unexpected(Q);Z.await=!0}else if(K&&this.options.ecmaVersion>=8){if(F.start===R&&!_&&F.type==="Identifier"&&F.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)Z.await=!1}if(H&&K)this.raise(F.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable(F,!1,q),this.checkLValPattern(F),this.parseForIn(Z,F)}else this.checkExpressionErrors(q,!0);if(Q>-1)this.unexpected(Q);return this.parseFor(Z,F)};D.parseForAfterInit=function(Z,Q,Y){if((this.type===G._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Q.declarations.length===1){if(this.options.ecmaVersion>=9)if(this.type===G._in){if(Y>-1)this.unexpected(Y)}else Z.await=Y>-1;return this.parseForIn(Z,Q)}if(Y>-1)this.unexpected(Y);return this.parseFor(Z,Q)};D.parseFunctionStatement=function(Z,Q,Y){return this.next(),this.parseFunction(Z,g0|(Y?0:D1),!1,Q)};D.parseIfStatement=function(Z){return this.next(),Z.test=this.parseParenExpression(),Z.consequent=this.parseStatement("if"),Z.alternate=this.eat(G._else)?this.parseStatement("if"):null,this.finishNode(Z,"IfStatement")};D.parseReturnStatement=function(Z){if(!this.inFunction&&!this.options.allowReturnOutsideFunction)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(G.semi)||this.insertSemicolon())Z.argument=null;else Z.argument=this.parseExpression(),this.semicolon();return this.finishNode(Z,"ReturnStatement")};D.parseSwitchStatement=function(Z){this.next(),Z.discriminant=this.parseParenExpression(),Z.cases=[],this.expect(G.braceL),this.labels.push(tZ),this.enterScope(0);var Q;for(var Y=!1;this.type!==G.braceR;)if(this.type===G._case||this.type===G._default){var J=this.type===G._case;if(Q)this.finishNode(Q,"SwitchCase");if(Z.cases.push(Q=this.startNode()),Q.consequent=[],this.next(),J)Q.test=this.parseExpression();else{if(Y)this.raiseRecoverable(this.lastTokStart,"Multiple default clauses");Y=!0,Q.test=null}this.expect(G.colon)}else{if(!Q)this.unexpected();Q.consequent.push(this.parseStatement(null))}if(this.exitScope(),Q)this.finishNode(Q,"SwitchCase");return this.next(),this.labels.pop(),this.finishNode(Z,"SwitchStatement")};D.parseThrowStatement=function(Z){if(this.next(),e.test(this.input.slice(this.lastTokEnd,this.start)))this.raise(this.lastTokEnd,"Illegal newline after throw");return Z.argument=this.parseExpression(),this.semicolon(),this.finishNode(Z,"ThrowStatement")};var eZ=[];D.parseCatchClauseParam=function(){var Z=this.parseBindingAtom(),Q=Z.type==="Identifier";return this.enterScope(Q?_8:0),this.checkLValPattern(Z,Q?$8:I0),this.expect(G.parenR),Z};D.parseTryStatement=function(Z){if(this.next(),Z.block=this.parseBlock(),Z.handler=null,this.type===G._catch){var Q=this.startNode();if(this.next(),this.eat(G.parenL))Q.param=this.parseCatchClauseParam();else{if(this.options.ecmaVersion<10)this.unexpected();Q.param=null,this.enterScope(0)}Q.body=this.parseBlock(!1),this.exitScope(),Z.handler=this.finishNode(Q,"CatchClause")}if(Z.finalizer=this.eat(G._finally)?this.parseBlock():null,!Z.handler&&!Z.finalizer)this.raise(Z.start,"Missing catch or finally clause");return this.finishNode(Z,"TryStatement")};D.parseVarStatement=function(Z,Q,Y){return this.next(),this.parseVar(Z,!1,Q,Y),this.semicolon(),this.finishNode(Z,"VariableDeclaration")};D.parseWhileStatement=function(Z){return this.next(),Z.test=this.parseParenExpression(),this.labels.push(k1),Z.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(Z,"WhileStatement")};D.parseWithStatement=function(Z){if(this.strict)this.raise(this.start,"'with' in strict mode");return this.next(),Z.object=this.parseParenExpression(),Z.body=this.parseStatement("with"),this.finishNode(Z,"WithStatement")};D.parseEmptyStatement=function(Z){return this.next(),this.finishNode(Z,"EmptyStatement")};D.parseLabeledStatement=function(Z,Q,Y,J){for(var X=0,H=this.labels;X<H.length;X+=1){var K=H[X];if(K.name===Q)this.raise(Y.start,"Label '"+Q+"' is already declared")}var W=this.type.isLoop?"loop":this.type===G._switch?"switch":null;for(var z=this.labels.length-1;z>=0;z--){var _=this.labels[z];if(_.statementStart===Z.start)_.statementStart=this.start,_.kind=W;else break}return this.labels.push({name:Q,kind:W,statementStart:this.start}),Z.body=this.parseStatement(J?J.indexOf("label")===-1?J+"label":J:"label"),this.labels.pop(),Z.label=Y,this.finishNode(Z,"LabeledStatement")};D.parseExpressionStatement=function(Z,Q){return Z.expression=Q,this.semicolon(),this.finishNode(Z,"ExpressionStatement")};D.parseBlock=function(Z,Q,Y){if(Z===void 0)Z=!0;if(Q===void 0)Q=this.startNode();if(Q.body=[],this.expect(G.braceL),Z)this.enterScope(0);while(this.type!==G.braceR){var J=this.parseStatement(null);Q.body.push(J)}if(Y)this.strict=!1;if(this.next(),Z)this.exitScope();return this.finishNode(Q,"BlockStatement")};D.parseFor=function(Z,Q){return Z.init=Q,this.expect(G.semi),Z.test=this.type===G.semi?null:this.parseExpression(),this.expect(G.semi),Z.update=this.type===G.parenR?null:this.parseExpression(),this.expect(G.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,"ForStatement")};D.parseForIn=function(Z,Q){var Y=this.type===G._in;if(this.next(),Q.type==="VariableDeclaration"&&Q.declarations[0].init!=null&&(!Y||this.options.ecmaVersion<8||this.strict||Q.kind!=="var"||Q.declarations[0].id.type!=="Identifier"))this.raise(Q.start,(Y?"for-in":"for-of")+" loop variable declaration may not have an initializer");return Z.left=Q,Z.right=Y?this.parseExpression():this.parseMaybeAssign(),this.expect(G.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,Y?"ForInStatement":"ForOfStatement")};D.parseVar=function(Z,Q,Y,J){Z.declarations=[],Z.kind=Y;for(;;){var X=this.startNode();if(this.parseVarId(X,Y),this.eat(G.eq))X.init=this.parseMaybeAssign(Q);else if(!J&&Y==="const"&&!(this.type===G._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!J&&(Y==="using"||Y==="await using")&&this.options.ecmaVersion>=17&&this.type!==G._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Y+" declaration");else if(!J&&X.id.type!=="Identifier"&&!(Q&&(this.type===G._in||this.isContextual("of"))))this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value");else X.init=null;if(Z.declarations.push(this.finishNode(X,"VariableDeclarator")),!this.eat(G.comma))break}return Z};D.parseVarId=function(Z,Q){Z.id=Q==="using"||Q==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(Z.id,Q==="var"?v1:I0,!1)};var g0=1,D1=2,O8=4;D.parseFunction=function(Z,Q,Y,J,X){if(this.initFunction(Z),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!J){if(this.type===G.star&&Q&D1)this.unexpected();Z.generator=this.eat(G.star)}if(this.options.ecmaVersion>=8)Z.async=!!J;if(Q&g0){if(Z.id=Q&O8&&this.type!==G.name?null:this.parseIdent(),Z.id&&!(Q&D1))this.checkLValSimple(Z.id,this.strict||Z.generator||Z.async?this.treatFunctionsAsVar?v1:I0:F8)}var H=this.yieldPos,K=this.awaitPos,W=this.awaitIdentPos;if(this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(E1(Z.async,Z.generator)),!(Q&g0))Z.id=this.type===G.name?this.parseIdent():null;return this.parseFunctionParams(Z),this.parseFunctionBody(Z,Y,!1,X),this.yieldPos=H,this.awaitPos=K,this.awaitIdentPos=W,this.finishNode(Z,Q&g0?"FunctionDeclaration":"FunctionExpression")};D.parseFunctionParams=function(Z){this.expect(G.parenL),Z.params=this.parseBindingList(G.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};D.parseClass=function(Z,Q){this.next();var Y=this.strict;this.strict=!0,this.parseClassId(Z,Q),this.parseClassSuper(Z);var J=this.enterClassBody(),X=this.startNode(),H=!1;X.body=[],this.expect(G.braceL);while(this.type!==G.braceR){var K=this.parseClassElement(Z.superClass!==null);if(K){if(X.body.push(K),K.type==="MethodDefinition"&&K.kind==="constructor"){if(H)this.raiseRecoverable(K.start,"Duplicate constructor in the same class");H=!0}else if(K.key&&K.key.type==="PrivateIdentifier"&&Z6(J,K))this.raiseRecoverable(K.key.start,"Identifier '#"+K.key.name+"' has already been declared")}}return this.strict=Y,this.next(),Z.body=this.finishNode(X,"ClassBody"),this.exitClassBody(),this.finishNode(Z,Q?"ClassDeclaration":"ClassExpression")};D.parseClassElement=function(Z){if(this.eat(G.semi))return null;var Q=this.options.ecmaVersion,Y=this.startNode(),J="",X=!1,H=!1,K="method",W=!1;if(this.eatContextual("static")){if(Q>=13&&this.eat(G.braceL))return this.parseClassStaticBlock(Y),Y;if(this.isClassElementNameStart()||this.type===G.star)W=!0;else J="static"}if(Y.static=W,!J&&Q>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===G.star)&&!this.canInsertSemicolon())H=!0;else J="async";if(!J&&(Q>=9||!H)&&this.eat(G.star))X=!0;if(!J&&!H&&!X){var z=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())K=z;else J=z}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(Q<13||this.type===G.parenL||K!=="method"||X||H){var _=!Y.static&&r0(Y,"constructor"),q=_&&Z;if(_&&K!=="method")this.raise(Y.key.start,"Constructor can't have get/set modifier");Y.kind=_?"constructor":K,this.parseClassMethod(Y,X,H,q)}else this.parseClassField(Y);return Y};D.isClassElementNameStart=function(){return this.type===G.name||this.type===G.privateId||this.type===G.num||this.type===G.string||this.type===G.bracketL||this.type.keyword};D.parseClassElementName=function(Z){if(this.type===G.privateId){if(this.value==="constructor")this.raise(this.start,"Classes can't have an element named '#constructor'");Z.computed=!1,Z.key=this.parsePrivateIdent()}else this.parsePropertyName(Z)};D.parseClassMethod=function(Z,Q,Y,J){var X=Z.key;if(Z.kind==="constructor"){if(Q)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(Z.static&&r0(Z,"prototype"))this.raise(X.start,"Classes may not have a static property named prototype");var H=Z.value=this.parseMethod(Q,Y,J);if(Z.kind==="get"&&H.params.length!==0)this.raiseRecoverable(H.start,"getter should have no params");if(Z.kind==="set"&&H.params.length!==1)this.raiseRecoverable(H.start,"setter should have exactly one param");if(Z.kind==="set"&&H.params[0].type==="RestElement")this.raiseRecoverable(H.params[0].start,"Setter cannot use rest params");return this.finishNode(Z,"MethodDefinition")};D.parseClassField=function(Z){if(r0(Z,"constructor"))this.raise(Z.key.start,"Classes can't have a field named 'constructor'");else if(Z.static&&r0(Z,"prototype"))this.raise(Z.key.start,"Classes can't have a static field named 'prototype'");if(this.eat(G.eq))this.enterScope(h0|Q1),Z.value=this.parseMaybeAssign(),this.exitScope();else Z.value=null;return this.semicolon(),this.finishNode(Z,"PropertyDefinition")};D.parseClassStaticBlock=function(Z){Z.body=[];var Q=this.labels;this.labels=[],this.enterScope(V0|Q1);while(this.type!==G.braceR){var Y=this.parseStatement(null);Z.body.push(Y)}return this.next(),this.exitScope(),this.labels=Q,this.finishNode(Z,"StaticBlock")};D.parseClassId=function(Z,Q){if(this.type===G.name){if(Z.id=this.parseIdent(),Q)this.checkLValSimple(Z.id,I0,!1)}else{if(Q===!0)this.unexpected();Z.id=null}};D.parseClassSuper=function(Z){Z.superClass=this.eat(G._extends)?this.parseExprSubscripts(null,!1):null};D.enterClassBody=function(){var Z={declared:Object.create(null),used:[]};return this.privateNameStack.push(Z),Z.declared};D.exitClassBody=function(){var Z=this.privateNameStack.pop(),Q=Z.declared,Y=Z.used;if(!this.options.checkPrivateFields)return;var J=this.privateNameStack.length,X=J===0?null:this.privateNameStack[J-1];for(var H=0;H<Y.length;++H){var K=Y[H];if(!S0(Q,K.name))if(X)X.used.push(K);else this.raiseRecoverable(K.start,"Private field '#"+K.name+"' must be declared in an enclosing class")}};function Z6(Z,Q){var Y=Q.key.name,J=Z[Y],X="true";if(Q.type==="MethodDefinition"&&(Q.kind==="get"||Q.kind==="set"))X=(Q.static?"s":"i")+Q.kind;if(J==="iget"&&X==="iset"||J==="iset"&&X==="iget"||J==="sget"&&X==="sset"||J==="sset"&&X==="sget")return Z[Y]="true",!1;else if(!J)return Z[Y]=X,!1;else return!0}function r0(Z,Q){var{computed:Y,key:J}=Z;return!Y&&(J.type==="Identifier"&&J.name===Q||J.type==="Literal"&&J.value===Q)}D.parseExportAllDeclaration=function(Z,Q){if(this.options.ecmaVersion>=11)if(this.eatContextual("as"))Z.exported=this.parseModuleExportName(),this.checkExport(Q,Z.exported,this.lastTokStart);else Z.exported=null;if(this.expectContextual("from"),this.type!==G.string)this.unexpected();if(Z.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ExportAllDeclaration")};D.parseExport=function(Z,Q){if(this.next(),this.eat(G.star))return this.parseExportAllDeclaration(Z,Q);if(this.eat(G._default))return this.checkExport(Q,"default",this.lastTokStart),Z.declaration=this.parseExportDefaultDeclaration(),this.finishNode(Z,"ExportDefaultDeclaration");if(this.shouldParseExportStatement()){if(Z.declaration=this.parseExportDeclaration(Z),Z.declaration.type==="VariableDeclaration")this.checkVariableExport(Q,Z.declaration.declarations);else this.checkExport(Q,Z.declaration.id,Z.declaration.id.start);if(Z.specifiers=[],Z.source=null,this.options.ecmaVersion>=16)Z.attributes=[]}else{if(Z.declaration=null,Z.specifiers=this.parseExportSpecifiers(Q),this.eatContextual("from")){if(this.type!==G.string)this.unexpected();if(Z.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause()}else{for(var Y=0,J=Z.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(Z.source=null,this.options.ecmaVersion>=16)Z.attributes=[]}this.semicolon()}return this.finishNode(Z,"ExportNamedDeclaration")};D.parseExportDeclaration=function(Z){return this.parseStatement(null)};D.parseExportDefaultDeclaration=function(){var Z;if(this.type===G._function||(Z=this.isAsyncFunction())){var Q=this.startNode();if(this.next(),Z)this.next();return this.parseFunction(Q,g0|O8,!1,Z)}else if(this.type===G._class){var Y=this.startNode();return this.parseClass(Y,"nullableID")}else{var J=this.parseMaybeAssign();return this.semicolon(),J}};D.checkExport=function(Z,Q,Y){if(!Z)return;if(typeof Q!=="string")Q=Q.type==="Identifier"?Q.name:Q.value;if(S0(Z,Q))this.raiseRecoverable(Y,"Duplicate export '"+Q+"'");Z[Q]=!0};D.checkPatternExport=function(Z,Q){var Y=Q.type;if(Y==="Identifier")this.checkExport(Z,Q,Q.start);else if(Y==="ObjectPattern")for(var J=0,X=Q.properties;J<X.length;J+=1){var H=X[J];this.checkPatternExport(Z,H)}else if(Y==="ArrayPattern")for(var K=0,W=Q.elements;K<W.length;K+=1){var z=W[K];if(z)this.checkPatternExport(Z,z)}else if(Y==="Property")this.checkPatternExport(Z,Q.value);else if(Y==="AssignmentPattern")this.checkPatternExport(Z,Q.left);else if(Y==="RestElement")this.checkPatternExport(Z,Q.argument)};D.checkVariableExport=function(Z,Q){if(!Z)return;for(var Y=0,J=Q;Y<J.length;Y+=1){var X=J[Y];this.checkPatternExport(Z,X.id)}};D.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};D.parseExportSpecifier=function(Z){var Q=this.startNode();return Q.local=this.parseModuleExportName(),Q.exported=this.eatContextual("as")?this.parseModuleExportName():Q.local,this.checkExport(Z,Q.exported,Q.exported.start),this.finishNode(Q,"ExportSpecifier")};D.parseExportSpecifiers=function(Z){var Q=[],Y=!0;this.expect(G.braceL);while(!this.eat(G.braceR)){if(!Y){if(this.expect(G.comma),this.afterTrailingComma(G.braceR))break}else Y=!1;Q.push(this.parseExportSpecifier(Z))}return Q};D.parseImport=function(Z){if(this.next(),this.type===G.string)Z.specifiers=eZ,Z.source=this.parseExprAtom();else Z.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Z.source=this.type===G.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ImportDeclaration")};D.parseImportSpecifier=function(){var Z=this.startNode();if(Z.imported=this.parseModuleExportName(),this.eatContextual("as"))Z.local=this.parseIdent();else this.checkUnreserved(Z.imported),Z.local=Z.imported;return this.checkLValSimple(Z.local,I0),this.finishNode(Z,"ImportSpecifier")};D.parseImportDefaultSpecifier=function(){var Z=this.startNode();return Z.local=this.parseIdent(),this.checkLValSimple(Z.local,I0),this.finishNode(Z,"ImportDefaultSpecifier")};D.parseImportNamespaceSpecifier=function(){var Z=this.startNode();return this.next(),this.expectContextual("as"),Z.local=this.parseIdent(),this.checkLValSimple(Z.local,I0),this.finishNode(Z,"ImportNamespaceSpecifier")};D.parseImportSpecifiers=function(){var Z=[],Q=!0;if(this.type===G.name){if(Z.push(this.parseImportDefaultSpecifier()),!this.eat(G.comma))return Z}if(this.type===G.star)return Z.push(this.parseImportNamespaceSpecifier()),Z;this.expect(G.braceL);while(!this.eat(G.braceR)){if(!Q){if(this.expect(G.comma),this.afterTrailingComma(G.braceR))break}else Q=!1;Z.push(this.parseImportSpecifier())}return Z};D.parseWithClause=function(){var Z=[];if(!this.eat(G._with))return Z;this.expect(G.braceL);var Q={},Y=!0;while(!this.eat(G.braceR)){if(!Y){if(this.expect(G.comma),this.afterTrailingComma(G.braceR))break}else Y=!1;var J=this.parseImportAttribute(),X=J.key.type==="Identifier"?J.key.name:J.key.value;if(S0(Q,X))this.raiseRecoverable(J.key.start,"Duplicate attribute key '"+X+"'");Q[X]=!0,Z.push(J)}return Z};D.parseImportAttribute=function(){var Z=this.startNode();if(Z.key=this.type===G.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(G.colon),this.type!==G.string)this.unexpected();return Z.value=this.parseExprAtom(),this.finishNode(Z,"ImportAttribute")};D.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===G.string){var Z=this.parseLiteral(this.value);if(oZ.test(Z.value))this.raise(Z.start,"An export name cannot include a lone surrogate.");return Z}return this.parseIdent(!0)};D.adaptDirectivePrologue=function(Z){for(var Q=0;Q<Z.length&&this.isDirectiveCandidate(Z[Q]);++Q)Z[Q].directive=Z[Q].expression.raw.slice(1,-1)};D.isDirectiveCandidate=function(Z){return this.options.ecmaVersion>=5&&Z.type==="ExpressionStatement"&&Z.expression.type==="Literal"&&typeof Z.expression.value==="string"&&(this.input[Z.start]==='"'||this.input[Z.start]==="'")};var K0=i.prototype;K0.toAssignable=function(Z,Q,Y){if(this.options.ecmaVersion>=6&&Z)switch(Z.type){case"Identifier":if(this.inAsync&&Z.name==="await")this.raise(Z.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":if(Z.type="ObjectPattern",Y)this.checkPatternErrors(Y,!0);for(var J=0,X=Z.properties;J<X.length;J+=1){var H=X[J];if(this.toAssignable(H,Q),H.type==="RestElement"&&(H.argument.type==="ArrayPattern"||H.argument.type==="ObjectPattern"))this.raise(H.argument.start,"Unexpected token")}break;case"Property":if(Z.kind!=="init")this.raise(Z.key.start,"Object pattern can't contain getter or setter");this.toAssignable(Z.value,Q);break;case"ArrayExpression":if(Z.type="ArrayPattern",Y)this.checkPatternErrors(Y,!0);this.toAssignableList(Z.elements,Q);break;case"SpreadElement":if(Z.type="RestElement",this.toAssignable(Z.argument,Q),Z.argument.type==="AssignmentPattern")this.raise(Z.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":if(Z.operator!=="=")this.raise(Z.left.end,"Only '=' operator can be used for specifying default value.");Z.type="AssignmentPattern",delete Z.operator,this.toAssignable(Z.left,Q);break;case"ParenthesizedExpression":this.toAssignable(Z.expression,Q,Y);break;case"ChainExpression":this.raiseRecoverable(Z.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!Q)break;default:this.raise(Z.start,"Assigning to rvalue")}else if(Y)this.checkPatternErrors(Y,!0);return Z};K0.toAssignableList=function(Z,Q){var Y=Z.length;for(var J=0;J<Y;J++){var X=Z[J];if(X)this.toAssignable(X,Q)}if(Y){var H=Z[Y-1];if(this.options.ecmaVersion===6&&Q&&H&&H.type==="RestElement"&&H.argument.type!=="Identifier")this.unexpected(H.argument.start)}return Z};K0.parseSpread=function(Z){var Q=this.startNode();return this.next(),Q.argument=this.parseMaybeAssign(!1,Z),this.finishNode(Q,"SpreadElement")};K0.parseRestBinding=function(){var Z=this.startNode();if(this.next(),this.options.ecmaVersion===6&&this.type!==G.name)this.unexpected();return Z.argument=this.parseBindingAtom(),this.finishNode(Z,"RestElement")};K0.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case G.bracketL:var Z=this.startNode();return this.next(),Z.elements=this.parseBindingList(G.bracketR,!0,!0),this.finishNode(Z,"ArrayPattern");case G.braceL:return this.parseObj(!0)}return this.parseIdent()};K0.parseBindingList=function(Z,Q,Y,J){var X=[],H=!0;while(!this.eat(Z)){if(H)H=!1;else this.expect(G.comma);if(Q&&this.type===G.comma)X.push(null);else if(Y&&this.afterTrailingComma(Z))break;else if(this.type===G.ellipsis){var K=this.parseRestBinding();if(this.parseBindingListItem(K),X.push(K),this.type===G.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(Z);break}else X.push(this.parseAssignableListItem(J))}return X};K0.parseAssignableListItem=function(Z){var Q=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(Q),Q};K0.parseBindingListItem=function(Z){return Z};K0.parseMaybeDefault=function(Z,Q,Y){if(Y=Y||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(G.eq))return Y;var J=this.startNodeAt(Z,Q);return J.left=Y,J.right=this.parseMaybeAssign(),this.finishNode(J,"AssignmentPattern")};K0.checkLValSimple=function(Z,Q,Y){if(Q===void 0)Q=s0;var J=Q!==s0;switch(Z.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(Z.name))this.raiseRecoverable(Z.start,(J?"Binding ":"Assigning to ")+Z.name+" in strict mode");if(J){if(Q===I0&&Z.name==="let")this.raiseRecoverable(Z.start,"let is disallowed as a lexically bound name");if(Y){if(S0(Y,Z.name))this.raiseRecoverable(Z.start,"Argument name clash");Y[Z.name]=!0}if(Q!==R8)this.declareName(Z.name,Q,Z.start)}break;case"ChainExpression":this.raiseRecoverable(Z.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(J)this.raiseRecoverable(Z.start,"Binding member expression");break;case"ParenthesizedExpression":if(J)this.raiseRecoverable(Z.start,"Binding parenthesized expression");return this.checkLValSimple(Z.expression,Q,Y);default:this.raise(Z.start,(J?"Binding":"Assigning to")+" rvalue")}};K0.checkLValPattern=function(Z,Q,Y){if(Q===void 0)Q=s0;switch(Z.type){case"ObjectPattern":for(var J=0,X=Z.properties;J<X.length;J+=1){var H=X[J];this.checkLValInnerPattern(H,Q,Y)}break;case"ArrayPattern":for(var K=0,W=Z.elements;K<W.length;K+=1){var z=W[K];if(z)this.checkLValInnerPattern(z,Q,Y)}break;default:this.checkLValSimple(Z,Q,Y)}};K0.checkLValInnerPattern=function(Z,Q,Y){if(Q===void 0)Q=s0;switch(Z.type){case"Property":this.checkLValInnerPattern(Z.value,Q,Y);break;case"AssignmentPattern":this.checkLValPattern(Z.left,Q,Y);break;case"RestElement":this.checkLValPattern(Z.argument,Q,Y);break;default:this.checkLValPattern(Z,Q,Y)}};var W0=function(Q,Y,J,X,H){this.token=Q,this.isExpr=!!Y,this.preserveSpace=!!J,this.override=X,this.generator=!!H},u={b_stat:new W0("{",!1),b_expr:new W0("{",!0),b_tmpl:new W0("${",!1),p_stat:new W0("(",!1),p_expr:new W0("(",!0),q_tmpl:new W0("`",!0,!0,function(Z){return Z.tryReadTemplateToken()}),f_stat:new W0("function",!1),f_expr:new W0("function",!0),f_expr_gen:new W0("function",!0,!1,null,!0),f_gen:new W0("function",!1,!1,null,!0)},E0=i.prototype;E0.initialContext=function(){return[u.b_stat]};E0.curContext=function(){return this.context[this.context.length-1]};E0.braceIsBlock=function(Z){var Q=this.curContext();if(Q===u.f_expr||Q===u.f_stat)return!0;if(Z===G.colon&&(Q===u.b_stat||Q===u.b_expr))return!Q.isExpr;if(Z===G._return||Z===G.name&&this.exprAllowed)return e.test(this.input.slice(this.lastTokEnd,this.start));if(Z===G._else||Z===G.semi||Z===G.eof||Z===G.parenR||Z===G.arrow)return!0;if(Z===G.braceL)return Q===u.b_stat;if(Z===G._var||Z===G._const||Z===G.name)return!1;return!this.exprAllowed};E0.inGeneratorContext=function(){for(var Z=this.context.length-1;Z>=1;Z--){var Q=this.context[Z];if(Q.token==="function")return Q.generator}return!1};E0.updateContext=function(Z){var Q,Y=this.type;if(Y.keyword&&Z===G.dot)this.exprAllowed=!1;else if(Q=Y.updateContext)Q.call(this,Z);else this.exprAllowed=Y.beforeExpr};E0.overrideContext=function(Z){if(this.curContext()!==Z)this.context[this.context.length-1]=Z};G.parenR.updateContext=G.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var Z=this.context.pop();if(Z===u.b_stat&&this.curContext().token==="function")Z=this.context.pop();this.exprAllowed=!Z.isExpr};G.braceL.updateContext=function(Z){this.context.push(this.braceIsBlock(Z)?u.b_stat:u.b_expr),this.exprAllowed=!0};G.dollarBraceL.updateContext=function(){this.context.push(u.b_tmpl),this.exprAllowed=!0};G.parenL.updateContext=function(Z){var Q=Z===G._if||Z===G._for||Z===G._with||Z===G._while;this.context.push(Q?u.p_stat:u.p_expr),this.exprAllowed=!0};G.incDec.updateContext=function(){};G._function.updateContext=G._class.updateContext=function(Z){if(Z.beforeExpr&&Z!==G._else&&!(Z===G.semi&&this.curContext()!==u.p_stat)&&!(Z===G._return&&e.test(this.input.slice(this.lastTokEnd,this.start)))&&!((Z===G.colon||Z===G.braceL)&&this.curContext()===u.b_stat))this.context.push(u.f_expr);else this.context.push(u.f_stat);this.exprAllowed=!1};G.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};G.backQuote.updateContext=function(){if(this.curContext()===u.q_tmpl)this.context.pop();else this.context.push(u.q_tmpl);this.exprAllowed=!1};G.star.updateContext=function(Z){if(Z===G._function){var Q=this.context.length-1;if(this.context[Q]===u.f_expr)this.context[Q]=u.f_expr_gen;else this.context[Q]=u.f_gen}this.exprAllowed=!0};G.name.updateContext=function(Z){var Q=!1;if(this.options.ecmaVersion>=6&&Z!==G.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())Q=!0}this.exprAllowed=Q};var b=i.prototype;b.checkPropClash=function(Z,Q,Y){if(this.options.ecmaVersion>=9&&Z.type==="SpreadElement")return;if(this.options.ecmaVersion>=6&&(Z.computed||Z.method||Z.shorthand))return;var J=Z.key,X;switch(J.type){case"Identifier":X=J.name;break;case"Literal":X=String(J.value);break;default:return}var H=Z.kind;if(this.options.ecmaVersion>=6){if(X==="__proto__"&&H==="init"){if(Q.proto)if(Y){if(Y.doubleProto<0)Y.doubleProto=J.start}else this.raiseRecoverable(J.start,"Redefinition of __proto__ property");Q.proto=!0}return}X="$"+X;var K=Q[X];if(K){var W;if(H==="init")W=this.strict&&K.init||K.get||K.set;else W=K.init||K[H];if(W)this.raiseRecoverable(J.start,"Redefinition of property")}else K=Q[X]={init:!1,get:!1,set:!1};K[H]=!0};b.parseExpression=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseMaybeAssign(Z,Q);if(this.type===G.comma){var H=this.startNodeAt(Y,J);H.expressions=[X];while(this.eat(G.comma))H.expressions.push(this.parseMaybeAssign(Z,Q));return this.finishNode(H,"SequenceExpression")}return X};b.parseMaybeAssign=function(Z,Q,Y){if(this.isContextual("yield"))if(this.inGenerator)return this.parseYield(Z);else this.exprAllowed=!1;var J=!1,X=-1,H=-1,K=-1;if(Q)X=Q.parenthesizedAssign,H=Q.trailingComma,K=Q.doubleProto,Q.parenthesizedAssign=Q.trailingComma=-1;else Q=new J1,J=!0;var W=this.start,z=this.startLoc;if(this.type===G.parenL||this.type===G.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=Z==="await";var _=this.parseMaybeConditional(Z,Q);if(Y)_=Y.call(this,_,W,z);if(this.type.isAssign){var q=this.startNodeAt(W,z);if(q.operator=this.value,this.type===G.eq)_=this.toAssignable(_,!1,Q);if(!J)Q.parenthesizedAssign=Q.trailingComma=Q.doubleProto=-1;if(Q.shorthandAssign>=_.start)Q.shorthandAssign=-1;if(this.type===G.eq)this.checkLValPattern(_);else this.checkLValSimple(_);if(q.left=_,this.next(),q.right=this.parseMaybeAssign(Z),K>-1)Q.doubleProto=K;return this.finishNode(q,"AssignmentExpression")}else if(J)this.checkExpressionErrors(Q,!0);if(X>-1)Q.parenthesizedAssign=X;if(H>-1)Q.trailingComma=H;return _};b.parseMaybeConditional=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseExprOps(Z,Q);if(this.checkExpressionErrors(Q))return X;if(this.eat(G.question)){var H=this.startNodeAt(Y,J);return H.test=X,H.consequent=this.parseMaybeAssign(),this.expect(G.colon),H.alternate=this.parseMaybeAssign(Z),this.finishNode(H,"ConditionalExpression")}return X};b.parseExprOps=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseMaybeUnary(Q,!1,!1,Z);if(this.checkExpressionErrors(Q))return X;return X.start===Y&&X.type==="ArrowFunctionExpression"?X:this.parseExprOp(X,Y,J,-1,Z)};b.parseExprOp=function(Z,Q,Y,J,X){var H=this.type.binop;if(H!=null&&(!X||this.type!==G._in)){if(H>J){var K=this.type===G.logicalOR||this.type===G.logicalAND,W=this.type===G.coalesce;if(W)H=G.logicalAND.binop;var z=this.value;this.next();var _=this.start,q=this.startLoc,R=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,X),_,q,H,X),F=this.buildBinary(Q,Y,Z,R,z,K||W);if(K&&this.type===G.coalesce||W&&(this.type===G.logicalOR||this.type===G.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp(F,Q,Y,J,X)}}return Z};b.buildBinary=function(Z,Q,Y,J,X,H){if(J.type==="PrivateIdentifier")this.raise(J.start,"Private identifier can only be left side of binary expression");var K=this.startNodeAt(Z,Q);return K.left=Y,K.operator=X,K.right=J,this.finishNode(K,H?"LogicalExpression":"BinaryExpression")};b.parseMaybeUnary=function(Z,Q,Y,J){var X=this.start,H=this.startLoc,K;if(this.isContextual("await")&&this.canAwait)K=this.parseAwait(J),Q=!0;else if(this.type.prefix){var W=this.startNode(),z=this.type===G.incDec;if(W.operator=this.value,W.prefix=!0,this.next(),W.argument=this.parseMaybeUnary(null,!0,z,J),this.checkExpressionErrors(Z,!0),z)this.checkLValSimple(W.argument);else if(this.strict&&W.operator==="delete"&&U8(W.argument))this.raiseRecoverable(W.start,"Deleting local variable in strict mode");else if(W.operator==="delete"&&T1(W.argument))this.raiseRecoverable(W.start,"Private fields can not be deleted");else Q=!0;K=this.finishNode(W,z?"UpdateExpression":"UnaryExpression")}else if(!Q&&this.type===G.privateId){if((J||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(K=this.parsePrivateIdent(),this.type!==G._in)this.unexpected()}else{if(K=this.parseExprSubscripts(Z,J),this.checkExpressionErrors(Z))return K;while(this.type.postfix&&!this.canInsertSemicolon()){var _=this.startNodeAt(X,H);_.operator=this.value,_.prefix=!1,_.argument=K,this.checkLValSimple(K),this.next(),K=this.finishNode(_,"UpdateExpression")}}if(!Y&&this.eat(G.starstar))if(Q)this.unexpected(this.lastTokStart);else return this.buildBinary(X,H,K,this.parseMaybeUnary(null,!1,!1,J),"**",!1);else return K};function U8(Z){return Z.type==="Identifier"||Z.type==="ParenthesizedExpression"&&U8(Z.expression)}function T1(Z){return Z.type==="MemberExpression"&&Z.property.type==="PrivateIdentifier"||Z.type==="ChainExpression"&&T1(Z.expression)||Z.type==="ParenthesizedExpression"&&T1(Z.expression)}b.parseExprSubscripts=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseExprAtom(Z,Q);if(X.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return X;var H=this.parseSubscripts(X,Y,J,!1,Q);if(Z&&H.type==="MemberExpression"){if(Z.parenthesizedAssign>=H.start)Z.parenthesizedAssign=-1;if(Z.parenthesizedBind>=H.start)Z.parenthesizedBind=-1;if(Z.trailingComma>=H.start)Z.trailingComma=-1}return H};b.parseSubscripts=function(Z,Q,Y,J,X){var H=this.options.ecmaVersion>=8&&Z.type==="Identifier"&&Z.name==="async"&&this.lastTokEnd===Z.end&&!this.canInsertSemicolon()&&Z.end-Z.start===5&&this.potentialArrowAt===Z.start,K=!1;while(!0){var W=this.parseSubscript(Z,Q,Y,J,H,K,X);if(W.optional)K=!0;if(W===Z||W.type==="ArrowFunctionExpression"){if(K){var z=this.startNodeAt(Q,Y);z.expression=W,W=this.finishNode(z,"ChainExpression")}return W}Z=W}};b.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(G.arrow)};b.parseSubscriptAsyncArrow=function(Z,Q,Y,J){return this.parseArrowExpression(this.startNodeAt(Z,Q),Y,!0,J)};b.parseSubscript=function(Z,Q,Y,J,X,H,K){var W=this.options.ecmaVersion>=11,z=W&&this.eat(G.questionDot);if(J&&z)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var _=this.eat(G.bracketL);if(_||z&&this.type!==G.parenL&&this.type!==G.backQuote||this.eat(G.dot)){var q=this.startNodeAt(Q,Y);if(q.object=Z,_)q.property=this.parseExpression(),this.expect(G.bracketR);else if(this.type===G.privateId&&Z.type!=="Super")q.property=this.parsePrivateIdent();else q.property=this.parseIdent(this.options.allowReserved!=="never");if(q.computed=!!_,W)q.optional=z;Z=this.finishNode(q,"MemberExpression")}else if(!J&&this.eat(G.parenL)){var R=new J1,F=this.yieldPos,O=this.awaitPos,U=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var L=this.parseExprList(G.parenR,this.options.ecmaVersion>=8,!1,R);if(X&&!z&&this.shouldParseAsyncArrow()){if(this.checkPatternErrors(R,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0)this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function");return this.yieldPos=F,this.awaitPos=O,this.awaitIdentPos=U,this.parseSubscriptAsyncArrow(Q,Y,L,K)}this.checkExpressionErrors(R,!0),this.yieldPos=F||this.yieldPos,this.awaitPos=O||this.awaitPos,this.awaitIdentPos=U||this.awaitIdentPos;var B=this.startNodeAt(Q,Y);if(B.callee=Z,B.arguments=L,W)B.optional=z;Z=this.finishNode(B,"CallExpression")}else if(this.type===G.backQuote){if(z||H)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var j=this.startNodeAt(Q,Y);j.tag=Z,j.quasi=this.parseTemplate({isTagged:!0}),Z=this.finishNode(j,"TaggedTemplateExpression")}return Z};b.parseExprAtom=function(Z,Q,Y){if(this.type===G.slash)this.readRegexp();var J,X=this.potentialArrowAt===this.start;switch(this.type){case G._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(J=this.startNode(),this.next(),this.type===G.parenL&&!this.allowDirectSuper)this.raise(J.start,"super() call outside constructor of a subclass");if(this.type!==G.dot&&this.type!==G.bracketL&&this.type!==G.parenL)this.unexpected();return this.finishNode(J,"Super");case G._this:return J=this.startNode(),this.next(),this.finishNode(J,"ThisExpression");case G.name:var H=this.start,K=this.startLoc,W=this.containsEsc,z=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!W&&z.name==="async"&&!this.canInsertSemicolon()&&this.eat(G._function))return this.overrideContext(u.f_expr),this.parseFunction(this.startNodeAt(H,K),0,!1,!0,Q);if(X&&!this.canInsertSemicolon()){if(this.eat(G.arrow))return this.parseArrowExpression(this.startNodeAt(H,K),[z],!1,Q);if(this.options.ecmaVersion>=8&&z.name==="async"&&this.type===G.name&&!W&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(z=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(G.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(H,K),[z],!0,Q)}}return z;case G.regexp:var _=this.value;return J=this.parseLiteral(_.value),J.regex={pattern:_.pattern,flags:_.flags},J;case G.num:case G.string:return this.parseLiteral(this.value);case G._null:case G._true:case G._false:return J=this.startNode(),J.value=this.type===G._null?null:this.type===G._true,J.raw=this.type.keyword,this.next(),this.finishNode(J,"Literal");case G.parenL:var q=this.start,R=this.parseParenAndDistinguishExpression(X,Q);if(Z){if(Z.parenthesizedAssign<0&&!this.isSimpleAssignTarget(R))Z.parenthesizedAssign=q;if(Z.parenthesizedBind<0)Z.parenthesizedBind=q}return R;case G.bracketL:return J=this.startNode(),this.next(),J.elements=this.parseExprList(G.bracketR,!0,!0,Z),this.finishNode(J,"ArrayExpression");case G.braceL:return this.overrideContext(u.b_expr),this.parseObj(!1,Z);case G._function:return J=this.startNode(),this.next(),this.parseFunction(J,0);case G._class:return this.parseClass(this.startNode(),!1);case G._new:return this.parseNew();case G.backQuote:return this.parseTemplate();case G._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Y);else return this.unexpected();default:return this.parseExprAtomDefault()}};b.parseExprAtomDefault=function(){this.unexpected()};b.parseExprImport=function(Z){var Q=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===G.parenL&&!Z)return this.parseDynamicImport(Q);else if(this.type===G.dot){var Y=this.startNodeAt(Q.start,Q.loc&&Q.loc.start);return Y.name="import",Q.meta=this.finishNode(Y,"Identifier"),this.parseImportMeta(Q)}else this.unexpected()};b.parseDynamicImport=function(Z){if(this.next(),Z.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(G.parenR))if(this.expect(G.comma),!this.afterTrailingComma(G.parenR)){if(Z.options=this.parseMaybeAssign(),!this.eat(G.parenR)){if(this.expect(G.comma),!this.afterTrailingComma(G.parenR))this.unexpected()}}else Z.options=null;else Z.options=null;else if(!this.eat(G.parenR)){var Q=this.start;if(this.eat(G.comma)&&this.eat(G.parenR))this.raiseRecoverable(Q,"Trailing comma is not allowed in import()");else this.unexpected(Q)}return this.finishNode(Z,"ImportExpression")};b.parseImportMeta=function(Z){this.next();var Q=this.containsEsc;if(Z.property=this.parseIdent(!0),Z.property.name!=="meta")this.raiseRecoverable(Z.property.start,"The only valid meta property for import is 'import.meta'");if(Q)this.raiseRecoverable(Z.start,"'import.meta' must not contain escaped characters");if(this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere)this.raiseRecoverable(Z.start,"Cannot use 'import.meta' outside a module");return this.finishNode(Z,"MetaProperty")};b.parseLiteral=function(Z){var Q=this.startNode();if(Q.value=Z,Q.raw=this.input.slice(this.start,this.end),Q.raw.charCodeAt(Q.raw.length-1)===110)Q.bigint=Q.value!=null?Q.value.toString():Q.raw.slice(0,-1).replace(/_/g,"");return this.next(),this.finishNode(Q,"Literal")};b.parseParenExpression=function(){this.expect(G.parenL);var Z=this.parseExpression();return this.expect(G.parenR),Z};b.shouldParseArrow=function(Z){return!this.canInsertSemicolon()};b.parseParenAndDistinguishExpression=function(Z,Q){var Y=this.start,J=this.startLoc,X,H=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var K=this.start,W=this.startLoc,z=[],_=!0,q=!1,R=new J1,F=this.yieldPos,O=this.awaitPos,U;this.yieldPos=0,this.awaitPos=0;while(this.type!==G.parenR)if(_?_=!1:this.expect(G.comma),H&&this.afterTrailingComma(G.parenR,!0)){q=!0;break}else if(this.type===G.ellipsis){if(U=this.start,z.push(this.parseParenItem(this.parseRestBinding())),this.type===G.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else z.push(this.parseMaybeAssign(!1,R,this.parseParenItem));var L=this.lastTokEnd,B=this.lastTokEndLoc;if(this.expect(G.parenR),Z&&this.shouldParseArrow(z)&&this.eat(G.arrow))return this.checkPatternErrors(R,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=F,this.awaitPos=O,this.parseParenArrowList(Y,J,z,Q);if(!z.length||q)this.unexpected(this.lastTokStart);if(U)this.unexpected(U);if(this.checkExpressionErrors(R,!0),this.yieldPos=F||this.yieldPos,this.awaitPos=O||this.awaitPos,z.length>1)X=this.startNodeAt(K,W),X.expressions=z,this.finishNodeAt(X,"SequenceExpression",L,B);else X=z[0]}else X=this.parseParenExpression();if(this.options.preserveParens){var j=this.startNodeAt(Y,J);return j.expression=X,this.finishNode(j,"ParenthesizedExpression")}else return X};b.parseParenItem=function(Z){return Z};b.parseParenArrowList=function(Z,Q,Y,J){return this.parseArrowExpression(this.startNodeAt(Z,Q),Y,!1,J)};var Q6=[];b.parseNew=function(){if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword new");var Z=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===G.dot){var Q=this.startNodeAt(Z.start,Z.loc&&Z.loc.start);Q.name="new",Z.meta=this.finishNode(Q,"Identifier"),this.next();var Y=this.containsEsc;if(Z.property=this.parseIdent(!0),Z.property.name!=="target")this.raiseRecoverable(Z.property.start,"The only valid meta property for new is 'new.target'");if(Y)this.raiseRecoverable(Z.start,"'new.target' must not contain escaped characters");if(!this.allowNewDotTarget)this.raiseRecoverable(Z.start,"'new.target' can only be used in functions and class static block");return this.finishNode(Z,"MetaProperty")}var J=this.start,X=this.startLoc;if(Z.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),J,X,!0,!1),this.eat(G.parenL))Z.arguments=this.parseExprList(G.parenR,this.options.ecmaVersion>=8,!1);else Z.arguments=Q6;return this.finishNode(Z,"NewExpression")};b.parseTemplateElement=function(Z){var Q=Z.isTagged,Y=this.startNode();if(this.type===G.invalidTemplate){if(!Q)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===G.backQuote,this.finishNode(Y,"TemplateElement")};b.parseTemplate=function(Z){if(Z===void 0)Z={};var Q=Z.isTagged;if(Q===void 0)Q=!1;var Y=this.startNode();this.next(),Y.expressions=[];var J=this.parseTemplateElement({isTagged:Q});Y.quasis=[J];while(!J.tail){if(this.type===G.eof)this.raise(this.pos,"Unterminated template literal");this.expect(G.dollarBraceL),Y.expressions.push(this.parseExpression()),this.expect(G.braceR),Y.quasis.push(J=this.parseTemplateElement({isTagged:Q}))}return this.next(),this.finishNode(Y,"TemplateLiteral")};b.isAsyncProp=function(Z){return!Z.computed&&Z.key.type==="Identifier"&&Z.key.name==="async"&&(this.type===G.name||this.type===G.num||this.type===G.string||this.type===G.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===G.star)&&!r.test(this.input.slice(this.lastTokEnd,this.start))};b.parseObj=function(Z,Q){var Y=this.startNode(),J=!0,X={};Y.properties=[],this.next();while(!this.eat(G.braceR)){if(!J){if(this.expect(G.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(G.braceR))break}else J=!1;var K=this.parseProperty(Z,Q);if(!Z)this.checkPropClash(K,X,Q);Y.properties.push(K)}return this.finishNode(Y,Z?"ObjectPattern":"ObjectExpression")};b.parseProperty=function(Z,Q){var Y=this.startNode(),J,X,K,W;if(this.options.ecmaVersion>=9&&this.eat(G.ellipsis)){if(Z){if(Y.argument=this.parseIdent(!1),this.type===G.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Y,"RestElement")}if(Y.argument=this.parseMaybeAssign(!1,Q),this.type===G.comma&&Q&&Q.trailingComma<0)Q.trailingComma=this.start;return this.finishNode(Y,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Y.method=!1,Y.shorthand=!1,Z||Q)K=this.start,W=this.startLoc;if(!Z)J=this.eat(G.star)}var H=this.containsEsc;if(this.parsePropertyName(Y),!Z&&!H&&this.options.ecmaVersion>=8&&!J&&this.isAsyncProp(Y))X=!0,J=this.options.ecmaVersion>=9&&this.eat(G.star),this.parsePropertyName(Y);else X=!1;return this.parsePropertyValue(Y,Z,J,X,K,W,Q,H),this.finishNode(Y,"Property")};b.parseGetterSetter=function(Z){var Q=Z.key.name;this.parsePropertyName(Z),Z.value=this.parseMethod(!1),Z.kind=Q;var Y=Z.kind==="get"?0:1;if(Z.value.params.length!==Y){var J=Z.value.start;if(Z.kind==="get")this.raiseRecoverable(J,"getter should have no params");else this.raiseRecoverable(J,"setter should have exactly one param")}else if(Z.kind==="set"&&Z.value.params[0].type==="RestElement")this.raiseRecoverable(Z.value.params[0].start,"Setter cannot use rest params")};b.parsePropertyValue=function(Z,Q,Y,J,X,K,W,H){if((Y||J)&&this.type===G.colon)this.unexpected();if(this.eat(G.colon))Z.value=Q?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,W),Z.kind="init";else if(this.options.ecmaVersion>=6&&this.type===G.parenL){if(Q)this.unexpected();Z.method=!0,Z.value=this.parseMethod(Y,J),Z.kind="init"}else if(!Q&&!H&&this.options.ecmaVersion>=5&&!Z.computed&&Z.key.type==="Identifier"&&(Z.key.name==="get"||Z.key.name==="set")&&(this.type!==G.comma&&this.type!==G.braceR&&this.type!==G.eq)){if(Y||J)this.unexpected();this.parseGetterSetter(Z)}else if(this.options.ecmaVersion>=6&&!Z.computed&&Z.key.type==="Identifier"){if(Y||J)this.unexpected();if(this.checkUnreserved(Z.key),Z.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=X;if(Q)Z.value=this.parseMaybeDefault(X,K,this.copyNode(Z.key));else if(this.type===G.eq&&W){if(W.shorthandAssign<0)W.shorthandAssign=this.start;Z.value=this.parseMaybeDefault(X,K,this.copyNode(Z.key))}else Z.value=this.copyNode(Z.key);Z.kind="init",Z.shorthand=!0}else this.unexpected()};b.parsePropertyName=function(Z){if(this.options.ecmaVersion>=6)if(this.eat(G.bracketL))return Z.computed=!0,Z.key=this.parseMaybeAssign(),this.expect(G.bracketR),Z.key;else Z.computed=!1;return Z.key=this.type===G.num||this.type===G.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};b.initFunction=function(Z){if(Z.id=null,this.options.ecmaVersion>=6)Z.generator=Z.expression=!1;if(this.options.ecmaVersion>=8)Z.async=!1};b.parseMethod=function(Z,Q,Y){var J=this.startNode(),X=this.yieldPos,K=this.awaitPos,W=this.awaitIdentPos;if(this.initFunction(J),this.options.ecmaVersion>=6)J.generator=Z;if(this.options.ecmaVersion>=8)J.async=!!Q;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(b1(Q,J.generator)|Z1|(Y?_8:0)),this.expect(G.parenL),J.params=this.parseBindingList(G.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")};b.parseArrowExpression=function(Z,Q,Y,J){var X=this.yieldPos,K=this.awaitPos,W=this.awaitIdentPos;if(this.enterScope(b1(Y,!1)|S1),this.initFunction(Z),this.options.ecmaVersion>=8)Z.async=!!Y;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,Z.params=this.toAssignableList(Q,!0),this.parseFunctionBody(Z,!0,!1,J),this.yieldPos=X,this.awaitPos=K,this.awaitIdentPos=W,this.finishNode(Z,"ArrowFunctionExpression")};b.parseFunctionBody=function(Z,Q,Y,J){var X=Q&&this.type!==G.braceL,K=this.strict,W=!1;if(X)Z.body=this.parseMaybeAssign(J),Z.expression=!0,this.checkParams(Z,!1);else{var H=this.options.ecmaVersion>=7&&!this.isSimpleParamList(Z.params);if(!K||H){if(W=this.strictDirective(this.end),W&&H)this.raiseRecoverable(Z.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var z=this.labels;if(this.labels=[],W)this.strict=!0;if(this.checkParams(Z,!K&&!W&&!Q&&!Y&&this.isSimpleParamList(Z.params)),this.strict&&Z.id)this.checkLValSimple(Z.id,$8);Z.body=this.parseBlock(!1,void 0,W&&!K),Z.expression=!1,this.adaptDirectivePrologue(Z.body.body),this.labels=z}this.exitScope()};b.isSimpleParamList=function(Z){for(var Q=0,Y=Z;Q<Y.length;Q+=1){var J=Y[Q];if(J.type!=="Identifier")return!1}return!0};b.checkParams=function(Z,Q){var Y=Object.create(null);for(var J=0,X=Z.params;J<X.length;J+=1){var K=X[J];this.checkLValInnerPattern(K,E1,Q?null:Y)}};b.parseExprList=function(Z,Q,Y,J){var X=[],K=!0;while(!this.eat(Z)){if(!K){if(this.expect(G.comma),Q&&this.afterTrailingComma(Z))break}else K=!1;var W=void 0;if(Y&&this.type===G.comma)W=null;else if(this.type===G.ellipsis){if(W=this.parseSpread(J),J&&this.type===G.comma&&J.trailingComma<0)J.trailingComma=this.start}else W=this.parseMaybeAssign(!1,J);X.push(W)}return X};b.checkUnreserved=function(Z){var{start:Q,end:Y,name:J}=Z;if(this.inGenerator&&J==="yield")this.raiseRecoverable(Q,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&J==="await")this.raiseRecoverable(Q,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&Q1)&&J==="arguments")this.raiseRecoverable(Q,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(J==="arguments"||J==="await"))this.raise(Q,"Cannot use "+J+" in class static initialization block");if(this.keywords.test(J))this.raise(Q,"Unexpected keyword '"+J+"'");if(this.options.ecmaVersion<6&&this.input.slice(Q,Y).indexOf("\\")!==-1)return;var X=this.strict?this.reservedWordsStrict:this.reservedWords;if(X.test(J)){if(!this.inAsync&&J==="await")this.raiseRecoverable(Q,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(Q,"The keyword '"+J+"' is reserved")}};b.parseIdent=function(Z){var Q=this.parseIdentNode();if(this.next(!!Z),this.finishNode(Q,"Identifier"),!Z){if(this.checkUnreserved(Q),Q.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Q.start}return Q};b.parseIdentNode=function(){var Z=this.startNode();if(this.type===G.name)Z.name=this.value;else if(this.type.keyword){if(Z.name=this.type.keyword,(Z.name==="class"||Z.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=G.name}else this.unexpected();return Z};b.parsePrivateIdent=function(){var Z=this.startNode();if(this.type===G.privateId)Z.name=this.value;else this.unexpected();if(this.next(),this.finishNode(Z,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(Z.start,"Private field '#"+Z.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(Z);return Z};b.parseYield=function(Z){if(!this.yieldPos)this.yieldPos=this.start;var Q=this.startNode();if(this.next(),this.type===G.semi||this.canInsertSemicolon()||this.type!==G.star&&!this.type.startsExpr)Q.delegate=!1,Q.argument=null;else Q.delegate=this.eat(G.star),Q.argument=this.parseMaybeAssign(Z);return this.finishNode(Q,"YieldExpression")};b.parseAwait=function(Z){if(!this.awaitPos)this.awaitPos=this.start;var Q=this.startNode();return this.next(),Q.argument=this.parseMaybeUnary(null,!0,!1,Z),this.finishNode(Q,"AwaitExpression")};var r0=p.prototype;r0.raise=function(Z,Q){var Y=H8(this.input,Z);if(Q+=" ("+Y.line+":"+Y.column+")",this.sourceFile)Q+=" in "+this.sourceFile;var J=SyntaxError(Q);throw J.pos=Z,J.loc=Y,J.raisedAt=this.pos,J};r0.raiseRecoverable=r0.raise;r0.curPosition=function(){if(this.options.locations)return new g0(this.curLine,this.pos-this.lineStart)};var j0=p.prototype,Y6=function(Q){this.flags=Q,this.var=[],this.lexical=[],this.functions=[]};j0.enterScope=function(Z){this.scopeStack.push(new Y6(Z))};j0.exitScope=function(){this.scopeStack.pop()};j0.treatFunctionsAsVarInScope=function(Z){return Z.flags&b0||!this.inModule&&Z.flags&y0};j0.declareName=function(Z,Q,Y){var J=!1;if(Q===I0){var X=this.currentScope();if(J=X.lexical.indexOf(Z)>-1||X.functions.indexOf(Z)>-1||X.var.indexOf(Z)>-1,X.lexical.push(Z),this.inModule&&X.flags&y0)delete this.undefinedExports[Z]}else if(Q===F8){var K=this.currentScope();K.lexical.push(Z)}else if(Q===q8){var W=this.currentScope();if(this.treatFunctionsAsVar)J=W.lexical.indexOf(Z)>-1;else J=W.lexical.indexOf(Z)>-1||W.var.indexOf(Z)>-1;W.functions.push(Z)}else for(var H=this.scopeStack.length-1;H>=0;--H){var z=this.scopeStack[H];if(z.lexical.indexOf(Z)>-1&&!(z.flags&G8&&z.lexical[0]===Z)||!this.treatFunctionsAsVarInScope(z)&&z.functions.indexOf(Z)>-1){J=!0;break}if(z.var.push(Z),this.inModule&&z.flags&y0)delete this.undefinedExports[Z];if(z.flags&Q1)break}if(J)this.raiseRecoverable(Y,"Identifier '"+Z+"' has already been declared")};j0.checkLocalExport=function(Z){if(this.scopeStack[0].lexical.indexOf(Z.name)===-1&&this.scopeStack[0].var.indexOf(Z.name)===-1)this.undefinedExports[Z.name]=Z};j0.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};j0.currentVarScope=function(){for(var Z=this.scopeStack.length-1;;Z--){var Q=this.scopeStack[Z];if(Q.flags&(Q1|f0|A0))return Q}};j0.currentThisScope=function(){for(var Z=this.scopeStack.length-1;;Z--){var Q=this.scopeStack[Z];if(Q.flags&(Q1|f0|A0)&&!(Q.flags&S1))return Q}};var J1=function(Q,Y,J){if(this.type="",this.start=Y,this.end=0,Q.options.locations)this.loc=new e0(Q,J);if(Q.options.directSourceFile)this.sourceFile=Q.options.directSourceFile;if(Q.options.ranges)this.range=[Y,0]},h0=p.prototype;h0.startNode=function(){return new J1(this,this.start,this.startLoc)};h0.startNodeAt=function(Z,Q){return new J1(this,Z,Q)};function U8(Z,Q,Y,J){if(Z.type=Q,Z.end=Y,this.options.locations)Z.loc.end=J;if(this.options.ranges)Z.range[1]=Y;return Z}h0.finishNode=function(Z,Q){return U8.call(this,Z,Q,this.lastTokEnd,this.lastTokEndLoc)};h0.finishNodeAt=function(Z,Q,Y,J){return U8.call(this,Z,Q,Y,J)};h0.copyNode=function(Z){var Q=new J1(this,Z.start,this.startLoc);for(var Y in Z)Q[Y]=Z[Y];return Q};var J6="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",I8="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",M8=I8+" Extended_Pictographic",B8=M8,L8=B8+" EBase EComp EMod EPres ExtPict",N8=L8,X6=N8,W6={9:I8,10:M8,11:B8,12:L8,13:N8,14:X6},K6="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",H6={9:"",10:"",11:"",12:"",13:"",14:K6},Q8="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",j8="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",w8=j8+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",A8=w8+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",V8=A8+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",D8=V8+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",z6=D8+" "+J6,G6={9:j8,10:w8,11:A8,12:V8,13:D8,14:z6},T8={};function _6(Z){var Q=T8[Z]={binary:L0(W6[Z]+" "+Q8),binaryOfStrings:L0(H6[Z]),nonBinary:{General_Category:L0(Q8),Script:L0(G6[Z])}};Q.nonBinary.Script_Extensions=Q.nonBinary.Script,Q.nonBinary.gc=Q.nonBinary.General_Category,Q.nonBinary.sc=Q.nonBinary.Script,Q.nonBinary.scx=Q.nonBinary.Script_Extensions}for(v0=0,o0=[9,10,11,12,13,14];v0<o0.length;v0+=1)T1=o0[v0],_6(T1);var T1,v0,o0,V=p.prototype,t0=function(Q,Y){this.parent=Q,this.base=Y||this};t0.prototype.separatedFrom=function(Q){for(var Y=this;Y;Y=Y.parent)for(var J=Q;J;J=J.parent)if(Y.base===J.base&&Y!==J)return!0;return!1};t0.prototype.sibling=function(){return new t0(this.parent,this.base)};var q0=function(Q){this.parser=Q,this.validFlags="gim"+(Q.options.ecmaVersion>=6?"uy":"")+(Q.options.ecmaVersion>=9?"s":"")+(Q.options.ecmaVersion>=13?"d":"")+(Q.options.ecmaVersion>=15?"v":""),this.unicodeProperties=T8[Q.options.ecmaVersion>=14?14:Q.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};q0.prototype.reset=function(Q,Y,J){var X=J.indexOf("v")!==-1,K=J.indexOf("u")!==-1;if(this.start=Q|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};q0.prototype.raise=function(Q){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+Q)};q0.prototype.at=function(Q,Y){if(Y===void 0)Y=!1;var J=this.source,X=J.length;if(Q>=X)return-1;var K=J.charCodeAt(Q);if(!(Y||this.switchU)||K<=55295||K>=57344||Q+1>=X)return K;var W=J.charCodeAt(Q+1);return W>=56320&&W<=57343?(K<<10)+W-56613888:K};q0.prototype.nextIndex=function(Q,Y){if(Y===void 0)Y=!1;var J=this.source,X=J.length;if(Q>=X)return X;var K=J.charCodeAt(Q),W;if(!(Y||this.switchU)||K<=55295||K>=57344||Q+1>=X||(W=J.charCodeAt(Q+1))<56320||W>57343)return Q+1;return Q+2};q0.prototype.current=function(Q){if(Q===void 0)Q=!1;return this.at(this.pos,Q)};q0.prototype.lookahead=function(Q){if(Q===void 0)Q=!1;return this.at(this.nextIndex(this.pos,Q),Q)};q0.prototype.advance=function(Q){if(Q===void 0)Q=!1;this.pos=this.nextIndex(this.pos,Q)};q0.prototype.eat=function(Q,Y){if(Y===void 0)Y=!1;if(this.current(Y)===Q)return this.advance(Y),!0;return!1};q0.prototype.eatChars=function(Q,Y){if(Y===void 0)Y=!1;var J=this.pos;for(var X=0,K=Q;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};V.validateRegExpFlags=function(Z){var{validFlags:Q,flags:Y}=Z,J=!1,X=!1;for(var K=0;K<Y.length;K++){var W=Y.charAt(K);if(Q.indexOf(W)===-1)this.raise(Z.start,"Invalid regular expression flag");if(Y.indexOf(W,K+1)>-1)this.raise(Z.start,"Duplicate regular expression flag");if(W==="u")J=!0;if(W==="v")X=!0}if(this.options.ecmaVersion>=15&&J&&X)this.raise(Z.start,"Invalid regular expression flag")};function q6(Z){for(var Q in Z)return!0;return!1}V.validateRegExpPattern=function(Z){if(this.regexp_pattern(Z),!Z.switchN&&this.options.ecmaVersion>=9&&q6(Z.groupNames))Z.switchN=!0,this.regexp_pattern(Z)};V.regexp_pattern=function(Z){if(Z.pos=0,Z.lastIntValue=0,Z.lastStringValue="",Z.lastAssertionIsQuantifiable=!1,Z.numCapturingParens=0,Z.maxBackReference=0,Z.groupNames=Object.create(null),Z.backReferenceNames.length=0,Z.branchID=null,this.regexp_disjunction(Z),Z.pos!==Z.source.length){if(Z.eat(41))Z.raise("Unmatched ')'");if(Z.eat(93)||Z.eat(125))Z.raise("Lone quantifier brackets")}if(Z.maxBackReference>Z.numCapturingParens)Z.raise("Invalid escape");for(var Q=0,Y=Z.backReferenceNames;Q<Y.length;Q+=1){var J=Y[Q];if(!Z.groupNames[J])Z.raise("Invalid named capture referenced")}};V.regexp_disjunction=function(Z){var Q=this.options.ecmaVersion>=16;if(Q)Z.branchID=new t0(Z.branchID,null);this.regexp_alternative(Z);while(Z.eat(124)){if(Q)Z.branchID=Z.branchID.sibling();this.regexp_alternative(Z)}if(Q)Z.branchID=Z.branchID.parent;if(this.regexp_eatQuantifier(Z,!0))Z.raise("Nothing to repeat");if(Z.eat(123))Z.raise("Lone quantifier brackets")};V.regexp_alternative=function(Z){while(Z.pos<Z.source.length&&this.regexp_eatTerm(Z));};V.regexp_eatTerm=function(Z){if(this.regexp_eatAssertion(Z)){if(Z.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(Z)){if(Z.switchU)Z.raise("Invalid quantifier")}return!0}if(Z.switchU?this.regexp_eatAtom(Z):this.regexp_eatExtendedAtom(Z))return this.regexp_eatQuantifier(Z),!0;return!1};V.regexp_eatAssertion=function(Z){var Q=Z.pos;if(Z.lastAssertionIsQuantifiable=!1,Z.eat(94)||Z.eat(36))return!0;if(Z.eat(92)){if(Z.eat(66)||Z.eat(98))return!0;Z.pos=Q}if(Z.eat(40)&&Z.eat(63)){var Y=!1;if(this.options.ecmaVersion>=9)Y=Z.eat(60);if(Z.eat(61)||Z.eat(33)){if(this.regexp_disjunction(Z),!Z.eat(41))Z.raise("Unterminated group");return Z.lastAssertionIsQuantifiable=!Y,!0}}return Z.pos=Q,!1};V.regexp_eatQuantifier=function(Z,Q){if(Q===void 0)Q=!1;if(this.regexp_eatQuantifierPrefix(Z,Q))return Z.eat(63),!0;return!1};V.regexp_eatQuantifierPrefix=function(Z,Q){return Z.eat(42)||Z.eat(43)||Z.eat(63)||this.regexp_eatBracedQuantifier(Z,Q)};V.regexp_eatBracedQuantifier=function(Z,Q){var Y=Z.pos;if(Z.eat(123)){var J=0,X=-1;if(this.regexp_eatDecimalDigits(Z)){if(J=Z.lastIntValue,Z.eat(44)&&this.regexp_eatDecimalDigits(Z))X=Z.lastIntValue;if(Z.eat(125)){if(X!==-1&&X<J&&!Q)Z.raise("numbers out of order in {} quantifier");return!0}}if(Z.switchU&&!Q)Z.raise("Incomplete quantifier");Z.pos=Y}return!1};V.regexp_eatAtom=function(Z){return this.regexp_eatPatternCharacters(Z)||Z.eat(46)||this.regexp_eatReverseSolidusAtomEscape(Z)||this.regexp_eatCharacterClass(Z)||this.regexp_eatUncapturingGroup(Z)||this.regexp_eatCapturingGroup(Z)};V.regexp_eatReverseSolidusAtomEscape=function(Z){var Q=Z.pos;if(Z.eat(92)){if(this.regexp_eatAtomEscape(Z))return!0;Z.pos=Q}return!1};V.regexp_eatUncapturingGroup=function(Z){var Q=Z.pos;if(Z.eat(40)){if(Z.eat(63)){if(this.options.ecmaVersion>=16){var Y=this.regexp_eatModifiers(Z),J=Z.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)Z.raise("Duplicate regular expression modifiers")}if(J){var W=this.regexp_eatModifiers(Z);if(!Y&&!W&&Z.current()===58)Z.raise("Invalid regular expression modifiers");for(var H=0;H<W.length;H++){var z=W.charAt(H);if(W.indexOf(z,H+1)>-1||Y.indexOf(z)>-1)Z.raise("Duplicate regular expression modifiers")}}}}if(Z.eat(58)){if(this.regexp_disjunction(Z),Z.eat(41))return!0;Z.raise("Unterminated group")}}Z.pos=Q}return!1};V.regexp_eatCapturingGroup=function(Z){if(Z.eat(40)){if(this.options.ecmaVersion>=9)this.regexp_groupSpecifier(Z);else if(Z.current()===63)Z.raise("Invalid group");if(this.regexp_disjunction(Z),Z.eat(41))return Z.numCapturingParens+=1,!0;Z.raise("Unterminated group")}return!1};V.regexp_eatModifiers=function(Z){var Q="",Y=0;while((Y=Z.current())!==-1&&F6(Y))Q+=O0(Y),Z.advance();return Q};function F6(Z){return Z===105||Z===109||Z===115}V.regexp_eatExtendedAtom=function(Z){return Z.eat(46)||this.regexp_eatReverseSolidusAtomEscape(Z)||this.regexp_eatCharacterClass(Z)||this.regexp_eatUncapturingGroup(Z)||this.regexp_eatCapturingGroup(Z)||this.regexp_eatInvalidBracedQuantifier(Z)||this.regexp_eatExtendedPatternCharacter(Z)};V.regexp_eatInvalidBracedQuantifier=function(Z){if(this.regexp_eatBracedQuantifier(Z,!0))Z.raise("Nothing to repeat");return!1};V.regexp_eatSyntaxCharacter=function(Z){var Q=Z.current();if(C8(Q))return Z.lastIntValue=Q,Z.advance(),!0;return!1};function C8(Z){return Z===36||Z>=40&&Z<=43||Z===46||Z===63||Z>=91&&Z<=94||Z>=123&&Z<=125}V.regexp_eatPatternCharacters=function(Z){var Q=Z.pos,Y=0;while((Y=Z.current())!==-1&&!C8(Y))Z.advance();return Z.pos!==Q};V.regexp_eatExtendedPatternCharacter=function(Z){var Q=Z.current();if(Q!==-1&&Q!==36&&!(Q>=40&&Q<=43)&&Q!==46&&Q!==63&&Q!==91&&Q!==94&&Q!==124)return Z.advance(),!0;return!1};V.regexp_groupSpecifier=function(Z){if(Z.eat(63)){if(!this.regexp_eatGroupName(Z))Z.raise("Invalid group");var Q=this.options.ecmaVersion>=16,Y=Z.groupNames[Z.lastStringValue];if(Y)if(Q)for(var J=0,X=Y;J<X.length;J+=1){var K=X[J];if(!K.separatedFrom(Z.branchID))Z.raise("Duplicate capture group name")}else Z.raise("Duplicate capture group name");if(Q)(Y||(Z.groupNames[Z.lastStringValue]=[])).push(Z.branchID);else Z.groupNames[Z.lastStringValue]=!0}};V.regexp_eatGroupName=function(Z){if(Z.lastStringValue="",Z.eat(60)){if(this.regexp_eatRegExpIdentifierName(Z)&&Z.eat(62))return!0;Z.raise("Invalid capture group name")}return!1};V.regexp_eatRegExpIdentifierName=function(Z){if(Z.lastStringValue="",this.regexp_eatRegExpIdentifierStart(Z)){Z.lastStringValue+=O0(Z.lastIntValue);while(this.regexp_eatRegExpIdentifierPart(Z))Z.lastStringValue+=O0(Z.lastIntValue);return!0}return!1};V.regexp_eatRegExpIdentifierStart=function(Z){var Q=Z.pos,Y=this.options.ecmaVersion>=11,J=Z.current(Y);if(Z.advance(Y),J===92&&this.regexp_eatRegExpUnicodeEscapeSequence(Z,Y))J=Z.lastIntValue;if($6(J))return Z.lastIntValue=J,!0;return Z.pos=Q,!1};function $6(Z){return G0(Z,!0)||Z===36||Z===95}V.regexp_eatRegExpIdentifierPart=function(Z){var Q=Z.pos,Y=this.options.ecmaVersion>=11,J=Z.current(Y);if(Z.advance(Y),J===92&&this.regexp_eatRegExpUnicodeEscapeSequence(Z,Y))J=Z.lastIntValue;if(R6(J))return Z.lastIntValue=J,!0;return Z.pos=Q,!1};function R6(Z){return N0(Z,!0)||Z===36||Z===95||Z===8204||Z===8205}V.regexp_eatAtomEscape=function(Z){if(this.regexp_eatBackReference(Z)||this.regexp_eatCharacterClassEscape(Z)||this.regexp_eatCharacterEscape(Z)||Z.switchN&&this.regexp_eatKGroupName(Z))return!0;if(Z.switchU){if(Z.current()===99)Z.raise("Invalid unicode escape");Z.raise("Invalid escape")}return!1};V.regexp_eatBackReference=function(Z){var Q=Z.pos;if(this.regexp_eatDecimalEscape(Z)){var Y=Z.lastIntValue;if(Z.switchU){if(Y>Z.maxBackReference)Z.maxBackReference=Y;return!0}if(Y<=Z.numCapturingParens)return!0;Z.pos=Q}return!1};V.regexp_eatKGroupName=function(Z){if(Z.eat(107)){if(this.regexp_eatGroupName(Z))return Z.backReferenceNames.push(Z.lastStringValue),!0;Z.raise("Invalid named reference")}return!1};V.regexp_eatCharacterEscape=function(Z){return this.regexp_eatControlEscape(Z)||this.regexp_eatCControlLetter(Z)||this.regexp_eatZero(Z)||this.regexp_eatHexEscapeSequence(Z)||this.regexp_eatRegExpUnicodeEscapeSequence(Z,!1)||!Z.switchU&&this.regexp_eatLegacyOctalEscapeSequence(Z)||this.regexp_eatIdentityEscape(Z)};V.regexp_eatCControlLetter=function(Z){var Q=Z.pos;if(Z.eat(99)){if(this.regexp_eatControlLetter(Z))return!0;Z.pos=Q}return!1};V.regexp_eatZero=function(Z){if(Z.current()===48&&!X1(Z.lookahead()))return Z.lastIntValue=0,Z.advance(),!0;return!1};V.regexp_eatControlEscape=function(Z){var Q=Z.current();if(Q===116)return Z.lastIntValue=9,Z.advance(),!0;if(Q===110)return Z.lastIntValue=10,Z.advance(),!0;if(Q===118)return Z.lastIntValue=11,Z.advance(),!0;if(Q===102)return Z.lastIntValue=12,Z.advance(),!0;if(Q===114)return Z.lastIntValue=13,Z.advance(),!0;return!1};V.regexp_eatControlLetter=function(Z){var Q=Z.current();if(P8(Q))return Z.lastIntValue=Q%32,Z.advance(),!0;return!1};function P8(Z){return Z>=65&&Z<=90||Z>=97&&Z<=122}V.regexp_eatRegExpUnicodeEscapeSequence=function(Z,Q){if(Q===void 0)Q=!1;var Y=Z.pos,J=Q||Z.switchU;if(Z.eat(117)){if(this.regexp_eatFixedHexDigits(Z,4)){var X=Z.lastIntValue;if(J&&X>=55296&&X<=56319){var K=Z.pos;if(Z.eat(92)&&Z.eat(117)&&this.regexp_eatFixedHexDigits(Z,4)){var W=Z.lastIntValue;if(W>=56320&&W<=57343)return Z.lastIntValue=(X-55296)*1024+(W-56320)+65536,!0}Z.pos=K,Z.lastIntValue=X}return!0}if(J&&Z.eat(123)&&this.regexp_eatHexDigits(Z)&&Z.eat(125)&&O6(Z.lastIntValue))return!0;if(J)Z.raise("Invalid unicode escape");Z.pos=Y}return!1};function O6(Z){return Z>=0&&Z<=1114111}V.regexp_eatIdentityEscape=function(Z){if(Z.switchU){if(this.regexp_eatSyntaxCharacter(Z))return!0;if(Z.eat(47))return Z.lastIntValue=47,!0;return!1}var Q=Z.current();if(Q!==99&&(!Z.switchN||Q!==107))return Z.lastIntValue=Q,Z.advance(),!0;return!1};V.regexp_eatDecimalEscape=function(Z){Z.lastIntValue=0;var Q=Z.current();if(Q>=49&&Q<=57){do Z.lastIntValue=10*Z.lastIntValue+(Q-48),Z.advance();while((Q=Z.current())>=48&&Q<=57);return!0}return!1};var S8=0,U0=1,X0=2;V.regexp_eatCharacterClassEscape=function(Z){var Q=Z.current();if(U6(Q))return Z.lastIntValue=-1,Z.advance(),U0;var Y=!1;if(Z.switchU&&this.options.ecmaVersion>=9&&((Y=Q===80)||Q===112)){Z.lastIntValue=-1,Z.advance();var J;if(Z.eat(123)&&(J=this.regexp_eatUnicodePropertyValueExpression(Z))&&Z.eat(125)){if(Y&&J===X0)Z.raise("Invalid property name");return J}Z.raise("Invalid property name")}return S8};function U6(Z){return Z===100||Z===68||Z===115||Z===83||Z===119||Z===87}V.regexp_eatUnicodePropertyValueExpression=function(Z){var Q=Z.pos;if(this.regexp_eatUnicodePropertyName(Z)&&Z.eat(61)){var Y=Z.lastStringValue;if(this.regexp_eatUnicodePropertyValue(Z)){var J=Z.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(Z,Y,J),U0}}if(Z.pos=Q,this.regexp_eatLoneUnicodePropertyNameOrValue(Z)){var X=Z.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(Z,X)}return S8};V.regexp_validateUnicodePropertyNameAndValue=function(Z,Q,Y){if(!S0(Z.unicodeProperties.nonBinary,Q))Z.raise("Invalid property name");if(!Z.unicodeProperties.nonBinary[Q].test(Y))Z.raise("Invalid property value")};V.regexp_validateUnicodePropertyNameOrValue=function(Z,Q){if(Z.unicodeProperties.binary.test(Q))return U0;if(Z.switchV&&Z.unicodeProperties.binaryOfStrings.test(Q))return X0;Z.raise("Invalid property name")};V.regexp_eatUnicodePropertyName=function(Z){var Q=0;Z.lastStringValue="";while(b8(Q=Z.current()))Z.lastStringValue+=O0(Q),Z.advance();return Z.lastStringValue!==""};function b8(Z){return P8(Z)||Z===95}V.regexp_eatUnicodePropertyValue=function(Z){var Q=0;Z.lastStringValue="";while(I6(Q=Z.current()))Z.lastStringValue+=O0(Q),Z.advance();return Z.lastStringValue!==""};function I6(Z){return b8(Z)||X1(Z)}V.regexp_eatLoneUnicodePropertyNameOrValue=function(Z){return this.regexp_eatUnicodePropertyValue(Z)};V.regexp_eatCharacterClass=function(Z){if(Z.eat(91)){var Q=Z.eat(94),Y=this.regexp_classContents(Z);if(!Z.eat(93))Z.raise("Unterminated character class");if(Q&&Y===X0)Z.raise("Negated character class may contain strings");return!0}return!1};V.regexp_classContents=function(Z){if(Z.current()===93)return U0;if(Z.switchV)return this.regexp_classSetExpression(Z);return this.regexp_nonEmptyClassRanges(Z),U0};V.regexp_nonEmptyClassRanges=function(Z){while(this.regexp_eatClassAtom(Z)){var Q=Z.lastIntValue;if(Z.eat(45)&&this.regexp_eatClassAtom(Z)){var Y=Z.lastIntValue;if(Z.switchU&&(Q===-1||Y===-1))Z.raise("Invalid character class");if(Q!==-1&&Y!==-1&&Q>Y)Z.raise("Range out of order in character class")}}};V.regexp_eatClassAtom=function(Z){var Q=Z.pos;if(Z.eat(92)){if(this.regexp_eatClassEscape(Z))return!0;if(Z.switchU){var Y=Z.current();if(Y===99||k8(Y))Z.raise("Invalid class escape");Z.raise("Invalid escape")}Z.pos=Q}var J=Z.current();if(J!==93)return Z.lastIntValue=J,Z.advance(),!0;return!1};V.regexp_eatClassEscape=function(Z){var Q=Z.pos;if(Z.eat(98))return Z.lastIntValue=8,!0;if(Z.switchU&&Z.eat(45))return Z.lastIntValue=45,!0;if(!Z.switchU&&Z.eat(99)){if(this.regexp_eatClassControlLetter(Z))return!0;Z.pos=Q}return this.regexp_eatCharacterClassEscape(Z)||this.regexp_eatCharacterEscape(Z)};V.regexp_classSetExpression=function(Z){var Q=U0,Y;if(this.regexp_eatClassSetRange(Z));else if(Y=this.regexp_eatClassSetOperand(Z)){if(Y===X0)Q=X0;var J=Z.pos;while(Z.eatChars([38,38])){if(Z.current()!==38&&(Y=this.regexp_eatClassSetOperand(Z))){if(Y!==X0)Q=U0;continue}Z.raise("Invalid character in character class")}if(J!==Z.pos)return Q;while(Z.eatChars([45,45])){if(this.regexp_eatClassSetOperand(Z))continue;Z.raise("Invalid character in character class")}if(J!==Z.pos)return Q}else Z.raise("Invalid character in character class");for(;;){if(this.regexp_eatClassSetRange(Z))continue;if(Y=this.regexp_eatClassSetOperand(Z),!Y)return Q;if(Y===X0)Q=X0}};V.regexp_eatClassSetRange=function(Z){var Q=Z.pos;if(this.regexp_eatClassSetCharacter(Z)){var Y=Z.lastIntValue;if(Z.eat(45)&&this.regexp_eatClassSetCharacter(Z)){var J=Z.lastIntValue;if(Y!==-1&&J!==-1&&Y>J)Z.raise("Range out of order in character class");return!0}Z.pos=Q}return!1};V.regexp_eatClassSetOperand=function(Z){if(this.regexp_eatClassSetCharacter(Z))return U0;return this.regexp_eatClassStringDisjunction(Z)||this.regexp_eatNestedClass(Z)};V.regexp_eatNestedClass=function(Z){var Q=Z.pos;if(Z.eat(91)){var Y=Z.eat(94),J=this.regexp_classContents(Z);if(Z.eat(93)){if(Y&&J===X0)Z.raise("Negated character class may contain strings");return J}Z.pos=Q}if(Z.eat(92)){var X=this.regexp_eatCharacterClassEscape(Z);if(X)return X;Z.pos=Q}return null};V.regexp_eatClassStringDisjunction=function(Z){var Q=Z.pos;if(Z.eatChars([92,113])){if(Z.eat(123)){var Y=this.regexp_classStringDisjunctionContents(Z);if(Z.eat(125))return Y}else Z.raise("Invalid escape");Z.pos=Q}return null};V.regexp_classStringDisjunctionContents=function(Z){var Q=this.regexp_classString(Z);while(Z.eat(124))if(this.regexp_classString(Z)===X0)Q=X0;return Q};V.regexp_classString=function(Z){var Q=0;while(this.regexp_eatClassSetCharacter(Z))Q++;return Q===1?U0:X0};V.regexp_eatClassSetCharacter=function(Z){var Q=Z.pos;if(Z.eat(92)){if(this.regexp_eatCharacterEscape(Z)||this.regexp_eatClassSetReservedPunctuator(Z))return!0;if(Z.eat(98))return Z.lastIntValue=8,!0;return Z.pos=Q,!1}var Y=Z.current();if(Y<0||Y===Z.lookahead()&&M6(Y))return!1;if(B6(Y))return!1;return Z.advance(),Z.lastIntValue=Y,!0};function M6(Z){return Z===33||Z>=35&&Z<=38||Z>=42&&Z<=44||Z===46||Z>=58&&Z<=64||Z===94||Z===96||Z===126}function B6(Z){return Z===40||Z===41||Z===45||Z===47||Z>=91&&Z<=93||Z>=123&&Z<=125}V.regexp_eatClassSetReservedPunctuator=function(Z){var Q=Z.current();if(L6(Q))return Z.lastIntValue=Q,Z.advance(),!0;return!1};function L6(Z){return Z===33||Z===35||Z===37||Z===38||Z===44||Z===45||Z>=58&&Z<=62||Z===64||Z===96||Z===126}V.regexp_eatClassControlLetter=function(Z){var Q=Z.current();if(X1(Q)||Q===95)return Z.lastIntValue=Q%32,Z.advance(),!0;return!1};V.regexp_eatHexEscapeSequence=function(Z){var Q=Z.pos;if(Z.eat(120)){if(this.regexp_eatFixedHexDigits(Z,2))return!0;if(Z.switchU)Z.raise("Invalid escape");Z.pos=Q}return!1};V.regexp_eatDecimalDigits=function(Z){var Q=Z.pos,Y=0;Z.lastIntValue=0;while(X1(Y=Z.current()))Z.lastIntValue=10*Z.lastIntValue+(Y-48),Z.advance();return Z.pos!==Q};function X1(Z){return Z>=48&&Z<=57}V.regexp_eatHexDigits=function(Z){var Q=Z.pos,Y=0;Z.lastIntValue=0;while(E8(Y=Z.current()))Z.lastIntValue=16*Z.lastIntValue+v8(Y),Z.advance();return Z.pos!==Q};function E8(Z){return Z>=48&&Z<=57||Z>=65&&Z<=70||Z>=97&&Z<=102}function v8(Z){if(Z>=65&&Z<=70)return 10+(Z-65);if(Z>=97&&Z<=102)return 10+(Z-97);return Z-48}V.regexp_eatLegacyOctalEscapeSequence=function(Z){if(this.regexp_eatOctalDigit(Z)){var Q=Z.lastIntValue;if(this.regexp_eatOctalDigit(Z)){var Y=Z.lastIntValue;if(Q<=3&&this.regexp_eatOctalDigit(Z))Z.lastIntValue=Q*64+Y*8+Z.lastIntValue;else Z.lastIntValue=Q*8+Y}else Z.lastIntValue=Q;return!0}return!1};V.regexp_eatOctalDigit=function(Z){var Q=Z.current();if(k8(Q))return Z.lastIntValue=Q-48,Z.advance(),!0;return Z.lastIntValue=0,!1};function k8(Z){return Z>=48&&Z<=55}V.regexp_eatFixedHexDigits=function(Z,Q){var Y=Z.pos;Z.lastIntValue=0;for(var J=0;J<Q;++J){var X=Z.current();if(!E8(X))return Z.pos=Y,!1;Z.lastIntValue=16*Z.lastIntValue+v8(X),Z.advance()}return!0};var k1=function(Q){if(this.type=Q.type,this.value=Q.value,this.start=Q.start,this.end=Q.end,Q.options.locations)this.loc=new e0(Q,Q.startLoc,Q.endLoc);if(Q.options.ranges)this.range=[Q.start,Q.end]},k=p.prototype;k.next=function(Z){if(!Z&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new k1(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};k.getToken=function(){return this.next(),new k1(this)};if(typeof Symbol<"u")k[Symbol.iterator]=function(){var Z=this;return{next:function(){var Q=Z.getToken();return{done:Q.type===G.eof,value:Q}}}};k.nextToken=function(){var Z=this.curContext();if(!Z||!Z.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(G.eof);if(Z.override)return Z.override(this);else this.readToken(this.fullCharCodeAtPos())};k.readToken=function(Z){if(G0(Z,this.options.ecmaVersion>=6)||Z===92)return this.readWord();return this.getTokenFromCode(Z)};k.fullCharCodeAtPos=function(){var Z=this.input.charCodeAt(this.pos);if(Z<=55295||Z>=56320)return Z;var Q=this.input.charCodeAt(this.pos+1);return Q<=56319||Q>=57344?Z:(Z<<10)+Q-56613888};k.skipBlockComment=function(){var Z=this.options.onComment&&this.curPosition(),Q=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=Q;(J=X8(this.input,X,this.pos))>-1;)++this.curLine,X=this.lineStart=J;if(this.options.onComment)this.options.onComment(!0,this.input.slice(Q+2,Y),Q,this.pos,Z,this.curPosition())};k.skipLineComment=function(Z){var Q=this.pos,Y=this.options.onComment&&this.curPosition(),J=this.input.charCodeAt(this.pos+=Z);while(this.pos<this.input.length&&!P0(J))J=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(Q+Z,this.pos),Q,this.pos,Y,this.curPosition())};k.skipSpace=function(){Z:while(this.pos<this.input.length){var Z=this.input.charCodeAt(this.pos);switch(Z){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 Z}break;default:if(Z>8&&Z<14||Z>=5760&&W8.test(String.fromCharCode(Z)))++this.pos;else break Z}}};k.finishToken=function(Z,Q){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Y=this.type;this.type=Z,this.value=Q,this.updateContext(Y)};k.readToken_dot=function(){var Z=this.input.charCodeAt(this.pos+1);if(Z>=48&&Z<=57)return this.readNumber(!0);var Q=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&Z===46&&Q===46)return this.pos+=3,this.finishToken(G.ellipsis);else return++this.pos,this.finishToken(G.dot)};k.readToken_slash=function(){var Z=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(Z===61)return this.finishOp(G.assign,2);return this.finishOp(G.slash,1)};k.readToken_mult_modulo_exp=function(Z){var Q=this.input.charCodeAt(this.pos+1),Y=1,J=Z===42?G.star:G.modulo;if(this.options.ecmaVersion>=7&&Z===42&&Q===42)++Y,J=G.starstar,Q=this.input.charCodeAt(this.pos+2);if(Q===61)return this.finishOp(G.assign,Y+1);return this.finishOp(J,Y)};k.readToken_pipe_amp=function(Z){var Q=this.input.charCodeAt(this.pos+1);if(Q===Z){if(this.options.ecmaVersion>=12){var Y=this.input.charCodeAt(this.pos+2);if(Y===61)return this.finishOp(G.assign,3)}return this.finishOp(Z===124?G.logicalOR:G.logicalAND,2)}if(Q===61)return this.finishOp(G.assign,2);return this.finishOp(Z===124?G.bitwiseOR:G.bitwiseAND,1)};k.readToken_caret=function(){var Z=this.input.charCodeAt(this.pos+1);if(Z===61)return this.finishOp(G.assign,2);return this.finishOp(G.bitwiseXOR,1)};k.readToken_plus_min=function(Z){var Q=this.input.charCodeAt(this.pos+1);if(Q===Z){if(Q===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||r.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(G.incDec,2)}if(Q===61)return this.finishOp(G.assign,2);return this.finishOp(G.plusMin,1)};k.readToken_lt_gt=function(Z){var Q=this.input.charCodeAt(this.pos+1),Y=1;if(Q===Z){if(Y=Z===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Y)===61)return this.finishOp(G.assign,Y+1);return this.finishOp(G.bitShift,Y)}if(Q===33&&Z===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(Q===61)Y=2;return this.finishOp(G.relational,Y)};k.readToken_eq_excl=function(Z){var Q=this.input.charCodeAt(this.pos+1);if(Q===61)return this.finishOp(G.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(Z===61&&Q===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(G.arrow);return this.finishOp(Z===61?G.eq:G.prefix,1)};k.readToken_question=function(){var Z=this.options.ecmaVersion;if(Z>=11){var Q=this.input.charCodeAt(this.pos+1);if(Q===46){var Y=this.input.charCodeAt(this.pos+2);if(Y<48||Y>57)return this.finishOp(G.questionDot,2)}if(Q===63){if(Z>=12){var J=this.input.charCodeAt(this.pos+2);if(J===61)return this.finishOp(G.assign,3)}return this.finishOp(G.coalesce,2)}}return this.finishOp(G.question,1)};k.readToken_numberSign=function(){var Z=this.options.ecmaVersion,Q=35;if(Z>=13){if(++this.pos,Q=this.fullCharCodeAtPos(),G0(Q,!0)||Q===92)return this.finishToken(G.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+O0(Q)+"'")};k.getTokenFromCode=function(Z){switch(Z){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(G.parenL);case 41:return++this.pos,this.finishToken(G.parenR);case 59:return++this.pos,this.finishToken(G.semi);case 44:return++this.pos,this.finishToken(G.comma);case 91:return++this.pos,this.finishToken(G.bracketL);case 93:return++this.pos,this.finishToken(G.bracketR);case 123:return++this.pos,this.finishToken(G.braceL);case 125:return++this.pos,this.finishToken(G.braceR);case 58:return++this.pos,this.finishToken(G.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(G.backQuote);case 48:var Q=this.input.charCodeAt(this.pos+1);if(Q===120||Q===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(Q===111||Q===79)return this.readRadixNumber(8);if(Q===98||Q===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(Z);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(Z);case 124:case 38:return this.readToken_pipe_amp(Z);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(Z);case 60:case 62:return this.readToken_lt_gt(Z);case 61:case 33:return this.readToken_eq_excl(Z);case 63:return this.readToken_question();case 126:return this.finishOp(G.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+O0(Z)+"'")};k.finishOp=function(Z,Q){var Y=this.input.slice(this.pos,this.pos+Q);return this.pos+=Q,this.finishToken(Z,Y)};k.readRegexp=function(){var Z,Q,Y=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Y,"Unterminated regular expression");var J=this.input.charAt(this.pos);if(r.test(J))this.raise(Y,"Unterminated regular expression");if(!Z){if(J==="[")Q=!0;else if(J==="]"&&Q)Q=!1;else if(J==="/"&&!Q)break;Z=J==="\\"}else Z=!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 q0(this));H.reset(Y,X,W),this.validateRegExpFlags(H),this.validateRegExpPattern(H);var z=null;try{z=new RegExp(X,W)}catch(_){}return this.finishToken(G.regexp,{pattern:X,flags:W,value:z})};k.readInt=function(Z,Q,Y){var J=this.options.ecmaVersion>=12&&Q===void 0,X=Y&&this.input.charCodeAt(this.pos)===48,K=this.pos,W=0,H=0;for(var z=0,_=Q==null?1/0:Q;z<_;++z,++this.pos){var q=this.input.charCodeAt(this.pos),R=void 0;if(J&&q===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(z===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");H=q;continue}if(q>=97)R=q-97+10;else if(q>=65)R=q-65+10;else if(q>=48&&q<=57)R=q-48;else R=1/0;if(R>=Z)break;H=q,W=W*Z+R}if(J&&H===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===K||Q!=null&&this.pos-K!==Q)return null;return W};function N6(Z,Q){if(Q)return parseInt(Z,8);return parseFloat(Z.replace(/_/g,""))}function g8(Z){if(typeof BigInt!=="function")return null;return BigInt(Z.replace(/_/g,""))}k.readRadixNumber=function(Z){var Q=this.pos;this.pos+=2;var Y=this.readInt(Z);if(Y==null)this.raise(this.start+2,"Expected number in radix "+Z);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Y=g8(this.input.slice(Q,this.pos)),++this.pos;else if(G0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(G.num,Y)};k.readNumber=function(Z){var Q=this.pos;if(!Z&&this.readInt(10,void 0,!0)===null)this.raise(Q,"Invalid number");var Y=this.pos-Q>=2&&this.input.charCodeAt(Q)===48;if(Y&&this.strict)this.raise(Q,"Invalid number");var J=this.input.charCodeAt(this.pos);if(!Y&&!Z&&this.options.ecmaVersion>=11&&J===110){var X=g8(this.input.slice(Q,this.pos));if(++this.pos,G0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(G.num,X)}if(Y&&/[89]/.test(this.input.slice(Q,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(Q,"Invalid number")}if(G0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var K=N6(this.input.slice(Q,this.pos),Y);return this.finishToken(G.num,K)};k.readCodePoint=function(){var Z=this.input.charCodeAt(this.pos),Q;if(Z===123){if(this.options.ecmaVersion<6)this.unexpected();var Y=++this.pos;if(Q=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,Q>1114111)this.invalidStringToken(Y,"Code point out of bounds")}else Q=this.readHexChar(4);return Q};k.readString=function(Z){var Q="",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===Z)break;if(J===92)Q+=this.input.slice(Y,this.pos),Q+=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(P0(J))this.raise(this.start,"Unterminated string constant");++this.pos}}return Q+=this.input.slice(Y,this.pos++),this.finishToken(G.string,Q)};var y8={};k.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(Z){if(Z===y8)this.readInvalidTemplateToken();else throw Z}this.inTemplateElement=!1};k.invalidStringToken=function(Z,Q){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw y8;else this.raise(Z,Q)};k.readTmplToken=function(){var Z="",Q=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===G.template||this.type===G.invalidTemplate))if(Y===36)return this.pos+=2,this.finishToken(G.dollarBraceL);else return++this.pos,this.finishToken(G.backQuote);return Z+=this.input.slice(Q,this.pos),this.finishToken(G.template,Z)}if(Y===92)Z+=this.input.slice(Q,this.pos),Z+=this.readEscapedChar(!0),Q=this.pos;else if(P0(Y)){switch(Z+=this.input.slice(Q,this.pos),++this.pos,Y){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:Z+=`
7
- `;break;default:Z+=String.fromCharCode(Y);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;Q=this.pos}else++this.pos}};k.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(G.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
6
+ `),cooked:this.value};return this.next(),Y.tail=this.type===G.backQuote,this.finishNode(Y,"TemplateElement")};b.parseTemplate=function(Z){if(Z===void 0)Z={};var Q=Z.isTagged;if(Q===void 0)Q=!1;var Y=this.startNode();this.next(),Y.expressions=[];var J=this.parseTemplateElement({isTagged:Q});Y.quasis=[J];while(!J.tail){if(this.type===G.eof)this.raise(this.pos,"Unterminated template literal");this.expect(G.dollarBraceL),Y.expressions.push(this.parseExpression()),this.expect(G.braceR),Y.quasis.push(J=this.parseTemplateElement({isTagged:Q}))}return this.next(),this.finishNode(Y,"TemplateLiteral")};b.isAsyncProp=function(Z){return!Z.computed&&Z.key.type==="Identifier"&&Z.key.name==="async"&&(this.type===G.name||this.type===G.num||this.type===G.string||this.type===G.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===G.star)&&!e.test(this.input.slice(this.lastTokEnd,this.start))};b.parseObj=function(Z,Q){var Y=this.startNode(),J=!0,X={};Y.properties=[],this.next();while(!this.eat(G.braceR)){if(!J){if(this.expect(G.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(G.braceR))break}else J=!1;var H=this.parseProperty(Z,Q);if(!Z)this.checkPropClash(H,X,Q);Y.properties.push(H)}return this.finishNode(Y,Z?"ObjectPattern":"ObjectExpression")};b.parseProperty=function(Z,Q){var Y=this.startNode(),J,X,H,K;if(this.options.ecmaVersion>=9&&this.eat(G.ellipsis)){if(Z){if(Y.argument=this.parseIdent(!1),this.type===G.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Y,"RestElement")}if(Y.argument=this.parseMaybeAssign(!1,Q),this.type===G.comma&&Q&&Q.trailingComma<0)Q.trailingComma=this.start;return this.finishNode(Y,"SpreadElement")}if(this.options.ecmaVersion>=6){if(Y.method=!1,Y.shorthand=!1,Z||Q)H=this.start,K=this.startLoc;if(!Z)J=this.eat(G.star)}var W=this.containsEsc;if(this.parsePropertyName(Y),!Z&&!W&&this.options.ecmaVersion>=8&&!J&&this.isAsyncProp(Y))X=!0,J=this.options.ecmaVersion>=9&&this.eat(G.star),this.parsePropertyName(Y);else X=!1;return this.parsePropertyValue(Y,Z,J,X,H,K,Q,W),this.finishNode(Y,"Property")};b.parseGetterSetter=function(Z){var Q=Z.key.name;this.parsePropertyName(Z),Z.value=this.parseMethod(!1),Z.kind=Q;var Y=Z.kind==="get"?0:1;if(Z.value.params.length!==Y){var J=Z.value.start;if(Z.kind==="get")this.raiseRecoverable(J,"getter should have no params");else this.raiseRecoverable(J,"setter should have exactly one param")}else if(Z.kind==="set"&&Z.value.params[0].type==="RestElement")this.raiseRecoverable(Z.value.params[0].start,"Setter cannot use rest params")};b.parsePropertyValue=function(Z,Q,Y,J,X,H,K,W){if((Y||J)&&this.type===G.colon)this.unexpected();if(this.eat(G.colon))Z.value=Q?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,K),Z.kind="init";else if(this.options.ecmaVersion>=6&&this.type===G.parenL){if(Q)this.unexpected();Z.method=!0,Z.value=this.parseMethod(Y,J),Z.kind="init"}else if(!Q&&!W&&this.options.ecmaVersion>=5&&!Z.computed&&Z.key.type==="Identifier"&&(Z.key.name==="get"||Z.key.name==="set")&&(this.type!==G.comma&&this.type!==G.braceR&&this.type!==G.eq)){if(Y||J)this.unexpected();this.parseGetterSetter(Z)}else if(this.options.ecmaVersion>=6&&!Z.computed&&Z.key.type==="Identifier"){if(Y||J)this.unexpected();if(this.checkUnreserved(Z.key),Z.key.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=X;if(Q)Z.value=this.parseMaybeDefault(X,H,this.copyNode(Z.key));else if(this.type===G.eq&&K){if(K.shorthandAssign<0)K.shorthandAssign=this.start;Z.value=this.parseMaybeDefault(X,H,this.copyNode(Z.key))}else Z.value=this.copyNode(Z.key);Z.kind="init",Z.shorthand=!0}else this.unexpected()};b.parsePropertyName=function(Z){if(this.options.ecmaVersion>=6)if(this.eat(G.bracketL))return Z.computed=!0,Z.key=this.parseMaybeAssign(),this.expect(G.bracketR),Z.key;else Z.computed=!1;return Z.key=this.type===G.num||this.type===G.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};b.initFunction=function(Z){if(Z.id=null,this.options.ecmaVersion>=6)Z.generator=Z.expression=!1;if(this.options.ecmaVersion>=8)Z.async=!1};b.parseMethod=function(Z,Q,Y){var J=this.startNode(),X=this.yieldPos,H=this.awaitPos,K=this.awaitIdentPos;if(this.initFunction(J),this.options.ecmaVersion>=6)J.generator=Z;if(this.options.ecmaVersion>=8)J.async=!!Q;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(E1(Q,J.generator)|Q1|(Y?q8:0)),this.expect(G.parenL),J.params=this.parseBindingList(G.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(J,!1,!0,!1),this.yieldPos=X,this.awaitPos=H,this.awaitIdentPos=K,this.finishNode(J,"FunctionExpression")};b.parseArrowExpression=function(Z,Q,Y,J){var X=this.yieldPos,H=this.awaitPos,K=this.awaitIdentPos;if(this.enterScope(E1(Y,!1)|b1),this.initFunction(Z),this.options.ecmaVersion>=8)Z.async=!!Y;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,Z.params=this.toAssignableList(Q,!0),this.parseFunctionBody(Z,!0,!1,J),this.yieldPos=X,this.awaitPos=H,this.awaitIdentPos=K,this.finishNode(Z,"ArrowFunctionExpression")};b.parseFunctionBody=function(Z,Q,Y,J){var X=Q&&this.type!==G.braceL,H=this.strict,K=!1;if(X)Z.body=this.parseMaybeAssign(J),Z.expression=!0,this.checkParams(Z,!1);else{var W=this.options.ecmaVersion>=7&&!this.isSimpleParamList(Z.params);if(!H||W){if(K=this.strictDirective(this.end),K&&W)this.raiseRecoverable(Z.start,"Illegal 'use strict' directive in function with non-simple parameter list")}var z=this.labels;if(this.labels=[],K)this.strict=!0;if(this.checkParams(Z,!H&&!K&&!Q&&!Y&&this.isSimpleParamList(Z.params)),this.strict&&Z.id)this.checkLValSimple(Z.id,R8);Z.body=this.parseBlock(!1,void 0,K&&!H),Z.expression=!1,this.adaptDirectivePrologue(Z.body.body),this.labels=z}this.exitScope()};b.isSimpleParamList=function(Z){for(var Q=0,Y=Z;Q<Y.length;Q+=1){var J=Y[Q];if(J.type!=="Identifier")return!1}return!0};b.checkParams=function(Z,Q){var Y=Object.create(null);for(var J=0,X=Z.params;J<X.length;J+=1){var H=X[J];this.checkLValInnerPattern(H,v1,Q?null:Y)}};b.parseExprList=function(Z,Q,Y,J){var X=[],H=!0;while(!this.eat(Z)){if(!H){if(this.expect(G.comma),Q&&this.afterTrailingComma(Z))break}else H=!1;var K=void 0;if(Y&&this.type===G.comma)K=null;else if(this.type===G.ellipsis){if(K=this.parseSpread(J),J&&this.type===G.comma&&J.trailingComma<0)J.trailingComma=this.start}else K=this.parseMaybeAssign(!1,J);X.push(K)}return X};b.checkUnreserved=function(Z){var{start:Q,end:Y,name:J}=Z;if(this.inGenerator&&J==="yield")this.raiseRecoverable(Q,"Cannot use 'yield' as identifier inside a generator");if(this.inAsync&&J==="await")this.raiseRecoverable(Q,"Cannot use 'await' as identifier inside an async function");if(!(this.currentThisScope().flags&Y1)&&J==="arguments")this.raiseRecoverable(Q,"Cannot use 'arguments' in class field initializer");if(this.inClassStaticBlock&&(J==="arguments"||J==="await"))this.raise(Q,"Cannot use "+J+" in class static initialization block");if(this.keywords.test(J))this.raise(Q,"Unexpected keyword '"+J+"'");if(this.options.ecmaVersion<6&&this.input.slice(Q,Y).indexOf("\\")!==-1)return;var X=this.strict?this.reservedWordsStrict:this.reservedWords;if(X.test(J)){if(!this.inAsync&&J==="await")this.raiseRecoverable(Q,"Cannot use keyword 'await' outside an async function");this.raiseRecoverable(Q,"The keyword '"+J+"' is reserved")}};b.parseIdent=function(Z){var Q=this.parseIdentNode();if(this.next(!!Z),this.finishNode(Q,"Identifier"),!Z){if(this.checkUnreserved(Q),Q.name==="await"&&!this.awaitIdentPos)this.awaitIdentPos=Q.start}return Q};b.parseIdentNode=function(){var Z=this.startNode();if(this.type===G.name)Z.name=this.value;else if(this.type.keyword){if(Z.name=this.type.keyword,(Z.name==="class"||Z.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46))this.context.pop();this.type=G.name}else this.unexpected();return Z};b.parsePrivateIdent=function(){var Z=this.startNode();if(this.type===G.privateId)Z.name=this.value;else this.unexpected();if(this.next(),this.finishNode(Z,"PrivateIdentifier"),this.options.checkPrivateFields)if(this.privateNameStack.length===0)this.raise(Z.start,"Private field '#"+Z.name+"' must be declared in an enclosing class");else this.privateNameStack[this.privateNameStack.length-1].used.push(Z);return Z};b.parseYield=function(Z){if(!this.yieldPos)this.yieldPos=this.start;var Q=this.startNode();if(this.next(),this.type===G.semi||this.canInsertSemicolon()||this.type!==G.star&&!this.type.startsExpr)Q.delegate=!1,Q.argument=null;else Q.delegate=this.eat(G.star),Q.argument=this.parseMaybeAssign(Z);return this.finishNode(Q,"YieldExpression")};b.parseAwait=function(Z){if(!this.awaitPos)this.awaitPos=this.start;var Q=this.startNode();return this.next(),Q.argument=this.parseMaybeUnary(null,!0,!1,Z),this.finishNode(Q,"AwaitExpression")};var t0=i.prototype;t0.raise=function(Z,Q){var Y=z8(this.input,Z);if(Q+=" ("+Y.line+":"+Y.column+")",this.sourceFile)Q+=" in "+this.sourceFile;var J=SyntaxError(Q);throw J.pos=Z,J.loc=Y,J.raisedAt=this.pos,J};t0.raiseRecoverable=t0.raise;t0.curPosition=function(){if(this.options.locations)return new y0(this.curLine,this.pos-this.lineStart)};var N0=i.prototype,Y6=function(Q){this.flags=Q,this.var=[],this.lexical=[],this.functions=[]};N0.enterScope=function(Z){this.scopeStack.push(new Y6(Z))};N0.exitScope=function(){this.scopeStack.pop()};N0.treatFunctionsAsVarInScope=function(Z){return Z.flags&b0||!this.inModule&&Z.flags&f0};N0.declareName=function(Z,Q,Y){var J=!1;if(Q===I0){var X=this.currentScope();if(J=X.lexical.indexOf(Z)>-1||X.functions.indexOf(Z)>-1||X.var.indexOf(Z)>-1,X.lexical.push(Z),this.inModule&&X.flags&f0)delete this.undefinedExports[Z]}else if(Q===$8){var H=this.currentScope();H.lexical.push(Z)}else if(Q===F8){var K=this.currentScope();if(this.treatFunctionsAsVar)J=K.lexical.indexOf(Z)>-1;else J=K.lexical.indexOf(Z)>-1||K.var.indexOf(Z)>-1;K.functions.push(Z)}else for(var W=this.scopeStack.length-1;W>=0;--W){var z=this.scopeStack[W];if(z.lexical.indexOf(Z)>-1&&!(z.flags&_8&&z.lexical[0]===Z)||!this.treatFunctionsAsVarInScope(z)&&z.functions.indexOf(Z)>-1){J=!0;break}if(z.var.push(Z),this.inModule&&z.flags&f0)delete this.undefinedExports[Z];if(z.flags&Y1)break}if(J)this.raiseRecoverable(Y,"Identifier '"+Z+"' has already been declared")};N0.checkLocalExport=function(Z){if(this.scopeStack[0].lexical.indexOf(Z.name)===-1&&this.scopeStack[0].var.indexOf(Z.name)===-1)this.undefinedExports[Z.name]=Z};N0.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};N0.currentVarScope=function(){for(var Z=this.scopeStack.length-1;;Z--){var Q=this.scopeStack[Z];if(Q.flags&(Y1|h0|V0))return Q}};N0.currentThisScope=function(){for(var Z=this.scopeStack.length-1;;Z--){var Q=this.scopeStack[Z];if(Q.flags&(Y1|h0|V0)&&!(Q.flags&b1))return Q}};var X1=function(Q,Y,J){if(this.type="",this.start=Y,this.end=0,Q.options.locations)this.loc=new Z1(Q,J);if(Q.options.directSourceFile)this.sourceFile=Q.options.directSourceFile;if(Q.options.ranges)this.range=[Y,0]},x0=i.prototype;x0.startNode=function(){return new X1(this,this.start,this.startLoc)};x0.startNodeAt=function(Z,Q){return new X1(this,Z,Q)};function I8(Z,Q,Y,J){if(Z.type=Q,Z.end=Y,this.options.locations)Z.loc.end=J;if(this.options.ranges)Z.range[1]=Y;return Z}x0.finishNode=function(Z,Q){return I8.call(this,Z,Q,this.lastTokEnd,this.lastTokEndLoc)};x0.finishNodeAt=function(Z,Q,Y,J){return I8.call(this,Z,Q,Y,J)};x0.copyNode=function(Z){var Q=new X1(this,Z.start,this.startLoc);for(var Y in Z)Q[Y]=Z[Y];return Q};var J6="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",M8="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",B8=M8+" Extended_Pictographic",L8=B8,j8=L8+" EBase EComp EMod EPres ExtPict",N8=j8,X6=N8,K6={9:M8,10:B8,11:L8,12:j8,13:N8,14:X6},H6="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",W6={9:"",10:"",11:"",12:"",13:"",14:H6},Y8="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",w8="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",A8=w8+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",V8=A8+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",D8=V8+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",T8=D8+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",z6=T8+" "+J6,G6={9:w8,10:A8,11:V8,12:D8,13:T8,14:z6},C8={};function _6(Z){var Q=C8[Z]={binary:L0(K6[Z]+" "+Y8),binaryOfStrings:L0(W6[Z]),nonBinary:{General_Category:L0(Y8),Script:L0(G6[Z])}};Q.nonBinary.Script_Extensions=Q.nonBinary.Script,Q.nonBinary.gc=Q.nonBinary.General_Category,Q.nonBinary.sc=Q.nonBinary.Script,Q.nonBinary.scx=Q.nonBinary.Script_Extensions}for(k0=0,a0=[9,10,11,12,13,14];k0<a0.length;k0+=1)C1=a0[k0],_6(C1);var C1,k0,a0,V=i.prototype,e0=function(Q,Y){this.parent=Q,this.base=Y||this};e0.prototype.separatedFrom=function(Q){for(var Y=this;Y;Y=Y.parent)for(var J=Q;J;J=J.parent)if(Y.base===J.base&&Y!==J)return!0;return!1};e0.prototype.sibling=function(){return new e0(this.parent,this.base)};var q0=function(Q){this.parser=Q,this.validFlags="gim"+(Q.options.ecmaVersion>=6?"uy":"")+(Q.options.ecmaVersion>=9?"s":"")+(Q.options.ecmaVersion>=13?"d":"")+(Q.options.ecmaVersion>=15?"v":""),this.unicodeProperties=C8[Q.options.ecmaVersion>=14?14:Q.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};q0.prototype.reset=function(Q,Y,J){var X=J.indexOf("v")!==-1,H=J.indexOf("u")!==-1;if(this.start=Q|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=H&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=H&&this.parser.options.ecmaVersion>=9};q0.prototype.raise=function(Q){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+Q)};q0.prototype.at=function(Q,Y){if(Y===void 0)Y=!1;var J=this.source,X=J.length;if(Q>=X)return-1;var H=J.charCodeAt(Q);if(!(Y||this.switchU)||H<=55295||H>=57344||Q+1>=X)return H;var K=J.charCodeAt(Q+1);return K>=56320&&K<=57343?(H<<10)+K-56613888:H};q0.prototype.nextIndex=function(Q,Y){if(Y===void 0)Y=!1;var J=this.source,X=J.length;if(Q>=X)return X;var H=J.charCodeAt(Q),K;if(!(Y||this.switchU)||H<=55295||H>=57344||Q+1>=X||(K=J.charCodeAt(Q+1))<56320||K>57343)return Q+1;return Q+2};q0.prototype.current=function(Q){if(Q===void 0)Q=!1;return this.at(this.pos,Q)};q0.prototype.lookahead=function(Q){if(Q===void 0)Q=!1;return this.at(this.nextIndex(this.pos,Q),Q)};q0.prototype.advance=function(Q){if(Q===void 0)Q=!1;this.pos=this.nextIndex(this.pos,Q)};q0.prototype.eat=function(Q,Y){if(Y===void 0)Y=!1;if(this.current(Y)===Q)return this.advance(Y),!0;return!1};q0.prototype.eatChars=function(Q,Y){if(Y===void 0)Y=!1;var J=this.pos;for(var X=0,H=Q;X<H.length;X+=1){var K=H[X],W=this.at(J,Y);if(W===-1||W!==K)return!1;J=this.nextIndex(J,Y)}return this.pos=J,!0};V.validateRegExpFlags=function(Z){var{validFlags:Q,flags:Y}=Z,J=!1,X=!1;for(var H=0;H<Y.length;H++){var K=Y.charAt(H);if(Q.indexOf(K)===-1)this.raise(Z.start,"Invalid regular expression flag");if(Y.indexOf(K,H+1)>-1)this.raise(Z.start,"Duplicate regular expression flag");if(K==="u")J=!0;if(K==="v")X=!0}if(this.options.ecmaVersion>=15&&J&&X)this.raise(Z.start,"Invalid regular expression flag")};function q6(Z){for(var Q in Z)return!0;return!1}V.validateRegExpPattern=function(Z){if(this.regexp_pattern(Z),!Z.switchN&&this.options.ecmaVersion>=9&&q6(Z.groupNames))Z.switchN=!0,this.regexp_pattern(Z)};V.regexp_pattern=function(Z){if(Z.pos=0,Z.lastIntValue=0,Z.lastStringValue="",Z.lastAssertionIsQuantifiable=!1,Z.numCapturingParens=0,Z.maxBackReference=0,Z.groupNames=Object.create(null),Z.backReferenceNames.length=0,Z.branchID=null,this.regexp_disjunction(Z),Z.pos!==Z.source.length){if(Z.eat(41))Z.raise("Unmatched ')'");if(Z.eat(93)||Z.eat(125))Z.raise("Lone quantifier brackets")}if(Z.maxBackReference>Z.numCapturingParens)Z.raise("Invalid escape");for(var Q=0,Y=Z.backReferenceNames;Q<Y.length;Q+=1){var J=Y[Q];if(!Z.groupNames[J])Z.raise("Invalid named capture referenced")}};V.regexp_disjunction=function(Z){var Q=this.options.ecmaVersion>=16;if(Q)Z.branchID=new e0(Z.branchID,null);this.regexp_alternative(Z);while(Z.eat(124)){if(Q)Z.branchID=Z.branchID.sibling();this.regexp_alternative(Z)}if(Q)Z.branchID=Z.branchID.parent;if(this.regexp_eatQuantifier(Z,!0))Z.raise("Nothing to repeat");if(Z.eat(123))Z.raise("Lone quantifier brackets")};V.regexp_alternative=function(Z){while(Z.pos<Z.source.length&&this.regexp_eatTerm(Z));};V.regexp_eatTerm=function(Z){if(this.regexp_eatAssertion(Z)){if(Z.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(Z)){if(Z.switchU)Z.raise("Invalid quantifier")}return!0}if(Z.switchU?this.regexp_eatAtom(Z):this.regexp_eatExtendedAtom(Z))return this.regexp_eatQuantifier(Z),!0;return!1};V.regexp_eatAssertion=function(Z){var Q=Z.pos;if(Z.lastAssertionIsQuantifiable=!1,Z.eat(94)||Z.eat(36))return!0;if(Z.eat(92)){if(Z.eat(66)||Z.eat(98))return!0;Z.pos=Q}if(Z.eat(40)&&Z.eat(63)){var Y=!1;if(this.options.ecmaVersion>=9)Y=Z.eat(60);if(Z.eat(61)||Z.eat(33)){if(this.regexp_disjunction(Z),!Z.eat(41))Z.raise("Unterminated group");return Z.lastAssertionIsQuantifiable=!Y,!0}}return Z.pos=Q,!1};V.regexp_eatQuantifier=function(Z,Q){if(Q===void 0)Q=!1;if(this.regexp_eatQuantifierPrefix(Z,Q))return Z.eat(63),!0;return!1};V.regexp_eatQuantifierPrefix=function(Z,Q){return Z.eat(42)||Z.eat(43)||Z.eat(63)||this.regexp_eatBracedQuantifier(Z,Q)};V.regexp_eatBracedQuantifier=function(Z,Q){var Y=Z.pos;if(Z.eat(123)){var J=0,X=-1;if(this.regexp_eatDecimalDigits(Z)){if(J=Z.lastIntValue,Z.eat(44)&&this.regexp_eatDecimalDigits(Z))X=Z.lastIntValue;if(Z.eat(125)){if(X!==-1&&X<J&&!Q)Z.raise("numbers out of order in {} quantifier");return!0}}if(Z.switchU&&!Q)Z.raise("Incomplete quantifier");Z.pos=Y}return!1};V.regexp_eatAtom=function(Z){return this.regexp_eatPatternCharacters(Z)||Z.eat(46)||this.regexp_eatReverseSolidusAtomEscape(Z)||this.regexp_eatCharacterClass(Z)||this.regexp_eatUncapturingGroup(Z)||this.regexp_eatCapturingGroup(Z)};V.regexp_eatReverseSolidusAtomEscape=function(Z){var Q=Z.pos;if(Z.eat(92)){if(this.regexp_eatAtomEscape(Z))return!0;Z.pos=Q}return!1};V.regexp_eatUncapturingGroup=function(Z){var Q=Z.pos;if(Z.eat(40)){if(Z.eat(63)){if(this.options.ecmaVersion>=16){var Y=this.regexp_eatModifiers(Z),J=Z.eat(45);if(Y||J){for(var X=0;X<Y.length;X++){var H=Y.charAt(X);if(Y.indexOf(H,X+1)>-1)Z.raise("Duplicate regular expression modifiers")}if(J){var K=this.regexp_eatModifiers(Z);if(!Y&&!K&&Z.current()===58)Z.raise("Invalid regular expression modifiers");for(var W=0;W<K.length;W++){var z=K.charAt(W);if(K.indexOf(z,W+1)>-1||Y.indexOf(z)>-1)Z.raise("Duplicate regular expression modifiers")}}}}if(Z.eat(58)){if(this.regexp_disjunction(Z),Z.eat(41))return!0;Z.raise("Unterminated group")}}Z.pos=Q}return!1};V.regexp_eatCapturingGroup=function(Z){if(Z.eat(40)){if(this.options.ecmaVersion>=9)this.regexp_groupSpecifier(Z);else if(Z.current()===63)Z.raise("Invalid group");if(this.regexp_disjunction(Z),Z.eat(41))return Z.numCapturingParens+=1,!0;Z.raise("Unterminated group")}return!1};V.regexp_eatModifiers=function(Z){var Q="",Y=0;while((Y=Z.current())!==-1&&F6(Y))Q+=O0(Y),Z.advance();return Q};function F6(Z){return Z===105||Z===109||Z===115}V.regexp_eatExtendedAtom=function(Z){return Z.eat(46)||this.regexp_eatReverseSolidusAtomEscape(Z)||this.regexp_eatCharacterClass(Z)||this.regexp_eatUncapturingGroup(Z)||this.regexp_eatCapturingGroup(Z)||this.regexp_eatInvalidBracedQuantifier(Z)||this.regexp_eatExtendedPatternCharacter(Z)};V.regexp_eatInvalidBracedQuantifier=function(Z){if(this.regexp_eatBracedQuantifier(Z,!0))Z.raise("Nothing to repeat");return!1};V.regexp_eatSyntaxCharacter=function(Z){var Q=Z.current();if(P8(Q))return Z.lastIntValue=Q,Z.advance(),!0;return!1};function P8(Z){return Z===36||Z>=40&&Z<=43||Z===46||Z===63||Z>=91&&Z<=94||Z>=123&&Z<=125}V.regexp_eatPatternCharacters=function(Z){var Q=Z.pos,Y=0;while((Y=Z.current())!==-1&&!P8(Y))Z.advance();return Z.pos!==Q};V.regexp_eatExtendedPatternCharacter=function(Z){var Q=Z.current();if(Q!==-1&&Q!==36&&!(Q>=40&&Q<=43)&&Q!==46&&Q!==63&&Q!==91&&Q!==94&&Q!==124)return Z.advance(),!0;return!1};V.regexp_groupSpecifier=function(Z){if(Z.eat(63)){if(!this.regexp_eatGroupName(Z))Z.raise("Invalid group");var Q=this.options.ecmaVersion>=16,Y=Z.groupNames[Z.lastStringValue];if(Y)if(Q)for(var J=0,X=Y;J<X.length;J+=1){var H=X[J];if(!H.separatedFrom(Z.branchID))Z.raise("Duplicate capture group name")}else Z.raise("Duplicate capture group name");if(Q)(Y||(Z.groupNames[Z.lastStringValue]=[])).push(Z.branchID);else Z.groupNames[Z.lastStringValue]=!0}};V.regexp_eatGroupName=function(Z){if(Z.lastStringValue="",Z.eat(60)){if(this.regexp_eatRegExpIdentifierName(Z)&&Z.eat(62))return!0;Z.raise("Invalid capture group name")}return!1};V.regexp_eatRegExpIdentifierName=function(Z){if(Z.lastStringValue="",this.regexp_eatRegExpIdentifierStart(Z)){Z.lastStringValue+=O0(Z.lastIntValue);while(this.regexp_eatRegExpIdentifierPart(Z))Z.lastStringValue+=O0(Z.lastIntValue);return!0}return!1};V.regexp_eatRegExpIdentifierStart=function(Z){var Q=Z.pos,Y=this.options.ecmaVersion>=11,J=Z.current(Y);if(Z.advance(Y),J===92&&this.regexp_eatRegExpUnicodeEscapeSequence(Z,Y))J=Z.lastIntValue;if($6(J))return Z.lastIntValue=J,!0;return Z.pos=Q,!1};function $6(Z){return G0(Z,!0)||Z===36||Z===95}V.regexp_eatRegExpIdentifierPart=function(Z){var Q=Z.pos,Y=this.options.ecmaVersion>=11,J=Z.current(Y);if(Z.advance(Y),J===92&&this.regexp_eatRegExpUnicodeEscapeSequence(Z,Y))J=Z.lastIntValue;if(R6(J))return Z.lastIntValue=J,!0;return Z.pos=Q,!1};function R6(Z){return j0(Z,!0)||Z===36||Z===95||Z===8204||Z===8205}V.regexp_eatAtomEscape=function(Z){if(this.regexp_eatBackReference(Z)||this.regexp_eatCharacterClassEscape(Z)||this.regexp_eatCharacterEscape(Z)||Z.switchN&&this.regexp_eatKGroupName(Z))return!0;if(Z.switchU){if(Z.current()===99)Z.raise("Invalid unicode escape");Z.raise("Invalid escape")}return!1};V.regexp_eatBackReference=function(Z){var Q=Z.pos;if(this.regexp_eatDecimalEscape(Z)){var Y=Z.lastIntValue;if(Z.switchU){if(Y>Z.maxBackReference)Z.maxBackReference=Y;return!0}if(Y<=Z.numCapturingParens)return!0;Z.pos=Q}return!1};V.regexp_eatKGroupName=function(Z){if(Z.eat(107)){if(this.regexp_eatGroupName(Z))return Z.backReferenceNames.push(Z.lastStringValue),!0;Z.raise("Invalid named reference")}return!1};V.regexp_eatCharacterEscape=function(Z){return this.regexp_eatControlEscape(Z)||this.regexp_eatCControlLetter(Z)||this.regexp_eatZero(Z)||this.regexp_eatHexEscapeSequence(Z)||this.regexp_eatRegExpUnicodeEscapeSequence(Z,!1)||!Z.switchU&&this.regexp_eatLegacyOctalEscapeSequence(Z)||this.regexp_eatIdentityEscape(Z)};V.regexp_eatCControlLetter=function(Z){var Q=Z.pos;if(Z.eat(99)){if(this.regexp_eatControlLetter(Z))return!0;Z.pos=Q}return!1};V.regexp_eatZero=function(Z){if(Z.current()===48&&!K1(Z.lookahead()))return Z.lastIntValue=0,Z.advance(),!0;return!1};V.regexp_eatControlEscape=function(Z){var Q=Z.current();if(Q===116)return Z.lastIntValue=9,Z.advance(),!0;if(Q===110)return Z.lastIntValue=10,Z.advance(),!0;if(Q===118)return Z.lastIntValue=11,Z.advance(),!0;if(Q===102)return Z.lastIntValue=12,Z.advance(),!0;if(Q===114)return Z.lastIntValue=13,Z.advance(),!0;return!1};V.regexp_eatControlLetter=function(Z){var Q=Z.current();if(S8(Q))return Z.lastIntValue=Q%32,Z.advance(),!0;return!1};function S8(Z){return Z>=65&&Z<=90||Z>=97&&Z<=122}V.regexp_eatRegExpUnicodeEscapeSequence=function(Z,Q){if(Q===void 0)Q=!1;var Y=Z.pos,J=Q||Z.switchU;if(Z.eat(117)){if(this.regexp_eatFixedHexDigits(Z,4)){var X=Z.lastIntValue;if(J&&X>=55296&&X<=56319){var H=Z.pos;if(Z.eat(92)&&Z.eat(117)&&this.regexp_eatFixedHexDigits(Z,4)){var K=Z.lastIntValue;if(K>=56320&&K<=57343)return Z.lastIntValue=(X-55296)*1024+(K-56320)+65536,!0}Z.pos=H,Z.lastIntValue=X}return!0}if(J&&Z.eat(123)&&this.regexp_eatHexDigits(Z)&&Z.eat(125)&&O6(Z.lastIntValue))return!0;if(J)Z.raise("Invalid unicode escape");Z.pos=Y}return!1};function O6(Z){return Z>=0&&Z<=1114111}V.regexp_eatIdentityEscape=function(Z){if(Z.switchU){if(this.regexp_eatSyntaxCharacter(Z))return!0;if(Z.eat(47))return Z.lastIntValue=47,!0;return!1}var Q=Z.current();if(Q!==99&&(!Z.switchN||Q!==107))return Z.lastIntValue=Q,Z.advance(),!0;return!1};V.regexp_eatDecimalEscape=function(Z){Z.lastIntValue=0;var Q=Z.current();if(Q>=49&&Q<=57){do Z.lastIntValue=10*Z.lastIntValue+(Q-48),Z.advance();while((Q=Z.current())>=48&&Q<=57);return!0}return!1};var b8=0,U0=1,X0=2;V.regexp_eatCharacterClassEscape=function(Z){var Q=Z.current();if(U6(Q))return Z.lastIntValue=-1,Z.advance(),U0;var Y=!1;if(Z.switchU&&this.options.ecmaVersion>=9&&((Y=Q===80)||Q===112)){Z.lastIntValue=-1,Z.advance();var J;if(Z.eat(123)&&(J=this.regexp_eatUnicodePropertyValueExpression(Z))&&Z.eat(125)){if(Y&&J===X0)Z.raise("Invalid property name");return J}Z.raise("Invalid property name")}return b8};function U6(Z){return Z===100||Z===68||Z===115||Z===83||Z===119||Z===87}V.regexp_eatUnicodePropertyValueExpression=function(Z){var Q=Z.pos;if(this.regexp_eatUnicodePropertyName(Z)&&Z.eat(61)){var Y=Z.lastStringValue;if(this.regexp_eatUnicodePropertyValue(Z)){var J=Z.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(Z,Y,J),U0}}if(Z.pos=Q,this.regexp_eatLoneUnicodePropertyNameOrValue(Z)){var X=Z.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(Z,X)}return b8};V.regexp_validateUnicodePropertyNameAndValue=function(Z,Q,Y){if(!S0(Z.unicodeProperties.nonBinary,Q))Z.raise("Invalid property name");if(!Z.unicodeProperties.nonBinary[Q].test(Y))Z.raise("Invalid property value")};V.regexp_validateUnicodePropertyNameOrValue=function(Z,Q){if(Z.unicodeProperties.binary.test(Q))return U0;if(Z.switchV&&Z.unicodeProperties.binaryOfStrings.test(Q))return X0;Z.raise("Invalid property name")};V.regexp_eatUnicodePropertyName=function(Z){var Q=0;Z.lastStringValue="";while(E8(Q=Z.current()))Z.lastStringValue+=O0(Q),Z.advance();return Z.lastStringValue!==""};function E8(Z){return S8(Z)||Z===95}V.regexp_eatUnicodePropertyValue=function(Z){var Q=0;Z.lastStringValue="";while(I6(Q=Z.current()))Z.lastStringValue+=O0(Q),Z.advance();return Z.lastStringValue!==""};function I6(Z){return E8(Z)||K1(Z)}V.regexp_eatLoneUnicodePropertyNameOrValue=function(Z){return this.regexp_eatUnicodePropertyValue(Z)};V.regexp_eatCharacterClass=function(Z){if(Z.eat(91)){var Q=Z.eat(94),Y=this.regexp_classContents(Z);if(!Z.eat(93))Z.raise("Unterminated character class");if(Q&&Y===X0)Z.raise("Negated character class may contain strings");return!0}return!1};V.regexp_classContents=function(Z){if(Z.current()===93)return U0;if(Z.switchV)return this.regexp_classSetExpression(Z);return this.regexp_nonEmptyClassRanges(Z),U0};V.regexp_nonEmptyClassRanges=function(Z){while(this.regexp_eatClassAtom(Z)){var Q=Z.lastIntValue;if(Z.eat(45)&&this.regexp_eatClassAtom(Z)){var Y=Z.lastIntValue;if(Z.switchU&&(Q===-1||Y===-1))Z.raise("Invalid character class");if(Q!==-1&&Y!==-1&&Q>Y)Z.raise("Range out of order in character class")}}};V.regexp_eatClassAtom=function(Z){var Q=Z.pos;if(Z.eat(92)){if(this.regexp_eatClassEscape(Z))return!0;if(Z.switchU){var Y=Z.current();if(Y===99||g8(Y))Z.raise("Invalid class escape");Z.raise("Invalid escape")}Z.pos=Q}var J=Z.current();if(J!==93)return Z.lastIntValue=J,Z.advance(),!0;return!1};V.regexp_eatClassEscape=function(Z){var Q=Z.pos;if(Z.eat(98))return Z.lastIntValue=8,!0;if(Z.switchU&&Z.eat(45))return Z.lastIntValue=45,!0;if(!Z.switchU&&Z.eat(99)){if(this.regexp_eatClassControlLetter(Z))return!0;Z.pos=Q}return this.regexp_eatCharacterClassEscape(Z)||this.regexp_eatCharacterEscape(Z)};V.regexp_classSetExpression=function(Z){var Q=U0,Y;if(this.regexp_eatClassSetRange(Z));else if(Y=this.regexp_eatClassSetOperand(Z)){if(Y===X0)Q=X0;var J=Z.pos;while(Z.eatChars([38,38])){if(Z.current()!==38&&(Y=this.regexp_eatClassSetOperand(Z))){if(Y!==X0)Q=U0;continue}Z.raise("Invalid character in character class")}if(J!==Z.pos)return Q;while(Z.eatChars([45,45])){if(this.regexp_eatClassSetOperand(Z))continue;Z.raise("Invalid character in character class")}if(J!==Z.pos)return Q}else Z.raise("Invalid character in character class");for(;;){if(this.regexp_eatClassSetRange(Z))continue;if(Y=this.regexp_eatClassSetOperand(Z),!Y)return Q;if(Y===X0)Q=X0}};V.regexp_eatClassSetRange=function(Z){var Q=Z.pos;if(this.regexp_eatClassSetCharacter(Z)){var Y=Z.lastIntValue;if(Z.eat(45)&&this.regexp_eatClassSetCharacter(Z)){var J=Z.lastIntValue;if(Y!==-1&&J!==-1&&Y>J)Z.raise("Range out of order in character class");return!0}Z.pos=Q}return!1};V.regexp_eatClassSetOperand=function(Z){if(this.regexp_eatClassSetCharacter(Z))return U0;return this.regexp_eatClassStringDisjunction(Z)||this.regexp_eatNestedClass(Z)};V.regexp_eatNestedClass=function(Z){var Q=Z.pos;if(Z.eat(91)){var Y=Z.eat(94),J=this.regexp_classContents(Z);if(Z.eat(93)){if(Y&&J===X0)Z.raise("Negated character class may contain strings");return J}Z.pos=Q}if(Z.eat(92)){var X=this.regexp_eatCharacterClassEscape(Z);if(X)return X;Z.pos=Q}return null};V.regexp_eatClassStringDisjunction=function(Z){var Q=Z.pos;if(Z.eatChars([92,113])){if(Z.eat(123)){var Y=this.regexp_classStringDisjunctionContents(Z);if(Z.eat(125))return Y}else Z.raise("Invalid escape");Z.pos=Q}return null};V.regexp_classStringDisjunctionContents=function(Z){var Q=this.regexp_classString(Z);while(Z.eat(124))if(this.regexp_classString(Z)===X0)Q=X0;return Q};V.regexp_classString=function(Z){var Q=0;while(this.regexp_eatClassSetCharacter(Z))Q++;return Q===1?U0:X0};V.regexp_eatClassSetCharacter=function(Z){var Q=Z.pos;if(Z.eat(92)){if(this.regexp_eatCharacterEscape(Z)||this.regexp_eatClassSetReservedPunctuator(Z))return!0;if(Z.eat(98))return Z.lastIntValue=8,!0;return Z.pos=Q,!1}var Y=Z.current();if(Y<0||Y===Z.lookahead()&&M6(Y))return!1;if(B6(Y))return!1;return Z.advance(),Z.lastIntValue=Y,!0};function M6(Z){return Z===33||Z>=35&&Z<=38||Z>=42&&Z<=44||Z===46||Z>=58&&Z<=64||Z===94||Z===96||Z===126}function B6(Z){return Z===40||Z===41||Z===45||Z===47||Z>=91&&Z<=93||Z>=123&&Z<=125}V.regexp_eatClassSetReservedPunctuator=function(Z){var Q=Z.current();if(L6(Q))return Z.lastIntValue=Q,Z.advance(),!0;return!1};function L6(Z){return Z===33||Z===35||Z===37||Z===38||Z===44||Z===45||Z>=58&&Z<=62||Z===64||Z===96||Z===126}V.regexp_eatClassControlLetter=function(Z){var Q=Z.current();if(K1(Q)||Q===95)return Z.lastIntValue=Q%32,Z.advance(),!0;return!1};V.regexp_eatHexEscapeSequence=function(Z){var Q=Z.pos;if(Z.eat(120)){if(this.regexp_eatFixedHexDigits(Z,2))return!0;if(Z.switchU)Z.raise("Invalid escape");Z.pos=Q}return!1};V.regexp_eatDecimalDigits=function(Z){var Q=Z.pos,Y=0;Z.lastIntValue=0;while(K1(Y=Z.current()))Z.lastIntValue=10*Z.lastIntValue+(Y-48),Z.advance();return Z.pos!==Q};function K1(Z){return Z>=48&&Z<=57}V.regexp_eatHexDigits=function(Z){var Q=Z.pos,Y=0;Z.lastIntValue=0;while(v8(Y=Z.current()))Z.lastIntValue=16*Z.lastIntValue+k8(Y),Z.advance();return Z.pos!==Q};function v8(Z){return Z>=48&&Z<=57||Z>=65&&Z<=70||Z>=97&&Z<=102}function k8(Z){if(Z>=65&&Z<=70)return 10+(Z-65);if(Z>=97&&Z<=102)return 10+(Z-97);return Z-48}V.regexp_eatLegacyOctalEscapeSequence=function(Z){if(this.regexp_eatOctalDigit(Z)){var Q=Z.lastIntValue;if(this.regexp_eatOctalDigit(Z)){var Y=Z.lastIntValue;if(Q<=3&&this.regexp_eatOctalDigit(Z))Z.lastIntValue=Q*64+Y*8+Z.lastIntValue;else Z.lastIntValue=Q*8+Y}else Z.lastIntValue=Q;return!0}return!1};V.regexp_eatOctalDigit=function(Z){var Q=Z.current();if(g8(Q))return Z.lastIntValue=Q-48,Z.advance(),!0;return Z.lastIntValue=0,!1};function g8(Z){return Z>=48&&Z<=55}V.regexp_eatFixedHexDigits=function(Z,Q){var Y=Z.pos;Z.lastIntValue=0;for(var J=0;J<Q;++J){var X=Z.current();if(!v8(X))return Z.pos=Y,!1;Z.lastIntValue=16*Z.lastIntValue+k8(X),Z.advance()}return!0};var g1=function(Q){if(this.type=Q.type,this.value=Q.value,this.start=Q.start,this.end=Q.end,Q.options.locations)this.loc=new Z1(Q,Q.startLoc,Q.endLoc);if(Q.options.ranges)this.range=[Q.start,Q.end]},g=i.prototype;g.next=function(Z){if(!Z&&this.type.keyword&&this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword);if(this.options.onToken)this.options.onToken(new g1(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};g.getToken=function(){return this.next(),new g1(this)};if(typeof Symbol<"u")g[Symbol.iterator]=function(){var Z=this;return{next:function(){var Q=Z.getToken();return{done:Q.type===G.eof,value:Q}}}};g.nextToken=function(){var Z=this.curContext();if(!Z||!Z.preserveSpace)this.skipSpace();if(this.start=this.pos,this.options.locations)this.startLoc=this.curPosition();if(this.pos>=this.input.length)return this.finishToken(G.eof);if(Z.override)return Z.override(this);else this.readToken(this.fullCharCodeAtPos())};g.readToken=function(Z){if(G0(Z,this.options.ecmaVersion>=6)||Z===92)return this.readWord();return this.getTokenFromCode(Z)};g.fullCharCodeAtPos=function(){var Z=this.input.charCodeAt(this.pos);if(Z<=55295||Z>=56320)return Z;var Q=this.input.charCodeAt(this.pos+1);return Q<=56319||Q>=57344?Z:(Z<<10)+Q-56613888};g.skipBlockComment=function(){var Z=this.options.onComment&&this.curPosition(),Q=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=Q;(J=K8(this.input,X,this.pos))>-1;)++this.curLine,X=this.lineStart=J;if(this.options.onComment)this.options.onComment(!0,this.input.slice(Q+2,Y),Q,this.pos,Z,this.curPosition())};g.skipLineComment=function(Z){var Q=this.pos,Y=this.options.onComment&&this.curPosition(),J=this.input.charCodeAt(this.pos+=Z);while(this.pos<this.input.length&&!P0(J))J=this.input.charCodeAt(++this.pos);if(this.options.onComment)this.options.onComment(!1,this.input.slice(Q+Z,this.pos),Q,this.pos,Y,this.curPosition())};g.skipSpace=function(){Z:while(this.pos<this.input.length){var Z=this.input.charCodeAt(this.pos);switch(Z){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 Z}break;default:if(Z>8&&Z<14||Z>=5760&&H8.test(String.fromCharCode(Z)))++this.pos;else break Z}}};g.finishToken=function(Z,Q){if(this.end=this.pos,this.options.locations)this.endLoc=this.curPosition();var Y=this.type;this.type=Z,this.value=Q,this.updateContext(Y)};g.readToken_dot=function(){var Z=this.input.charCodeAt(this.pos+1);if(Z>=48&&Z<=57)return this.readNumber(!0);var Q=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&Z===46&&Q===46)return this.pos+=3,this.finishToken(G.ellipsis);else return++this.pos,this.finishToken(G.dot)};g.readToken_slash=function(){var Z=this.input.charCodeAt(this.pos+1);if(this.exprAllowed)return++this.pos,this.readRegexp();if(Z===61)return this.finishOp(G.assign,2);return this.finishOp(G.slash,1)};g.readToken_mult_modulo_exp=function(Z){var Q=this.input.charCodeAt(this.pos+1),Y=1,J=Z===42?G.star:G.modulo;if(this.options.ecmaVersion>=7&&Z===42&&Q===42)++Y,J=G.starstar,Q=this.input.charCodeAt(this.pos+2);if(Q===61)return this.finishOp(G.assign,Y+1);return this.finishOp(J,Y)};g.readToken_pipe_amp=function(Z){var Q=this.input.charCodeAt(this.pos+1);if(Q===Z){if(this.options.ecmaVersion>=12){var Y=this.input.charCodeAt(this.pos+2);if(Y===61)return this.finishOp(G.assign,3)}return this.finishOp(Z===124?G.logicalOR:G.logicalAND,2)}if(Q===61)return this.finishOp(G.assign,2);return this.finishOp(Z===124?G.bitwiseOR:G.bitwiseAND,1)};g.readToken_caret=function(){var Z=this.input.charCodeAt(this.pos+1);if(Z===61)return this.finishOp(G.assign,2);return this.finishOp(G.bitwiseXOR,1)};g.readToken_plus_min=function(Z){var Q=this.input.charCodeAt(this.pos+1);if(Q===Z){if(Q===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||e.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(G.incDec,2)}if(Q===61)return this.finishOp(G.assign,2);return this.finishOp(G.plusMin,1)};g.readToken_lt_gt=function(Z){var Q=this.input.charCodeAt(this.pos+1),Y=1;if(Q===Z){if(Y=Z===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+Y)===61)return this.finishOp(G.assign,Y+1);return this.finishOp(G.bitShift,Y)}if(Q===33&&Z===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(Q===61)Y=2;return this.finishOp(G.relational,Y)};g.readToken_eq_excl=function(Z){var Q=this.input.charCodeAt(this.pos+1);if(Q===61)return this.finishOp(G.equality,this.input.charCodeAt(this.pos+2)===61?3:2);if(Z===61&&Q===62&&this.options.ecmaVersion>=6)return this.pos+=2,this.finishToken(G.arrow);return this.finishOp(Z===61?G.eq:G.prefix,1)};g.readToken_question=function(){var Z=this.options.ecmaVersion;if(Z>=11){var Q=this.input.charCodeAt(this.pos+1);if(Q===46){var Y=this.input.charCodeAt(this.pos+2);if(Y<48||Y>57)return this.finishOp(G.questionDot,2)}if(Q===63){if(Z>=12){var J=this.input.charCodeAt(this.pos+2);if(J===61)return this.finishOp(G.assign,3)}return this.finishOp(G.coalesce,2)}}return this.finishOp(G.question,1)};g.readToken_numberSign=function(){var Z=this.options.ecmaVersion,Q=35;if(Z>=13){if(++this.pos,Q=this.fullCharCodeAtPos(),G0(Q,!0)||Q===92)return this.finishToken(G.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+O0(Q)+"'")};g.getTokenFromCode=function(Z){switch(Z){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(G.parenL);case 41:return++this.pos,this.finishToken(G.parenR);case 59:return++this.pos,this.finishToken(G.semi);case 44:return++this.pos,this.finishToken(G.comma);case 91:return++this.pos,this.finishToken(G.bracketL);case 93:return++this.pos,this.finishToken(G.bracketR);case 123:return++this.pos,this.finishToken(G.braceL);case 125:return++this.pos,this.finishToken(G.braceR);case 58:return++this.pos,this.finishToken(G.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(G.backQuote);case 48:var Q=this.input.charCodeAt(this.pos+1);if(Q===120||Q===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(Q===111||Q===79)return this.readRadixNumber(8);if(Q===98||Q===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(Z);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(Z);case 124:case 38:return this.readToken_pipe_amp(Z);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(Z);case 60:case 62:return this.readToken_lt_gt(Z);case 61:case 33:return this.readToken_eq_excl(Z);case 63:return this.readToken_question();case 126:return this.finishOp(G.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+O0(Z)+"'")};g.finishOp=function(Z,Q){var Y=this.input.slice(this.pos,this.pos+Q);return this.pos+=Q,this.finishToken(Z,Y)};g.readRegexp=function(){var Z,Q,Y=this.pos;for(;;){if(this.pos>=this.input.length)this.raise(Y,"Unterminated regular expression");var J=this.input.charAt(this.pos);if(e.test(J))this.raise(Y,"Unterminated regular expression");if(!Z){if(J==="[")Q=!0;else if(J==="]"&&Q)Q=!1;else if(J==="/"&&!Q)break;Z=J==="\\"}else Z=!1;++this.pos}var X=this.input.slice(Y,this.pos);++this.pos;var H=this.pos,K=this.readWord1();if(this.containsEsc)this.unexpected(H);var W=this.regexpState||(this.regexpState=new q0(this));W.reset(Y,X,K),this.validateRegExpFlags(W),this.validateRegExpPattern(W);var z=null;try{z=new RegExp(X,K)}catch(_){}return this.finishToken(G.regexp,{pattern:X,flags:K,value:z})};g.readInt=function(Z,Q,Y){var J=this.options.ecmaVersion>=12&&Q===void 0,X=Y&&this.input.charCodeAt(this.pos)===48,H=this.pos,K=0,W=0;for(var z=0,_=Q==null?1/0:Q;z<_;++z,++this.pos){var q=this.input.charCodeAt(this.pos),R=void 0;if(J&&q===95){if(X)this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals");if(W===95)this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore");if(z===0)this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits");W=q;continue}if(q>=97)R=q-97+10;else if(q>=65)R=q-65+10;else if(q>=48&&q<=57)R=q-48;else R=1/0;if(R>=Z)break;W=q,K=K*Z+R}if(J&&W===95)this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits");if(this.pos===H||Q!=null&&this.pos-H!==Q)return null;return K};function j6(Z,Q){if(Q)return parseInt(Z,8);return parseFloat(Z.replace(/_/g,""))}function y8(Z){if(typeof BigInt!=="function")return null;return BigInt(Z.replace(/_/g,""))}g.readRadixNumber=function(Z){var Q=this.pos;this.pos+=2;var Y=this.readInt(Z);if(Y==null)this.raise(this.start+2,"Expected number in radix "+Z);if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110)Y=y8(this.input.slice(Q,this.pos)),++this.pos;else if(G0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(G.num,Y)};g.readNumber=function(Z){var Q=this.pos;if(!Z&&this.readInt(10,void 0,!0)===null)this.raise(Q,"Invalid number");var Y=this.pos-Q>=2&&this.input.charCodeAt(Q)===48;if(Y&&this.strict)this.raise(Q,"Invalid number");var J=this.input.charCodeAt(this.pos);if(!Y&&!Z&&this.options.ecmaVersion>=11&&J===110){var X=y8(this.input.slice(Q,this.pos));if(++this.pos,G0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(G.num,X)}if(Y&&/[89]/.test(this.input.slice(Q,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(Q,"Invalid number")}if(G0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var H=j6(this.input.slice(Q,this.pos),Y);return this.finishToken(G.num,H)};g.readCodePoint=function(){var Z=this.input.charCodeAt(this.pos),Q;if(Z===123){if(this.options.ecmaVersion<6)this.unexpected();var Y=++this.pos;if(Q=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,Q>1114111)this.invalidStringToken(Y,"Code point out of bounds")}else Q=this.readHexChar(4);return Q};g.readString=function(Z){var Q="",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===Z)break;if(J===92)Q+=this.input.slice(Y,this.pos),Q+=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(P0(J))this.raise(this.start,"Unterminated string constant");++this.pos}}return Q+=this.input.slice(Y,this.pos++),this.finishToken(G.string,Q)};var f8={};g.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(Z){if(Z===f8)this.readInvalidTemplateToken();else throw Z}this.inTemplateElement=!1};g.invalidStringToken=function(Z,Q){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw f8;else this.raise(Z,Q)};g.readTmplToken=function(){var Z="",Q=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===G.template||this.type===G.invalidTemplate))if(Y===36)return this.pos+=2,this.finishToken(G.dollarBraceL);else return++this.pos,this.finishToken(G.backQuote);return Z+=this.input.slice(Q,this.pos),this.finishToken(G.template,Z)}if(Y===92)Z+=this.input.slice(Q,this.pos),Z+=this.readEscapedChar(!0),Q=this.pos;else if(P0(Y)){switch(Z+=this.input.slice(Q,this.pos),++this.pos,Y){case 13:if(this.input.charCodeAt(this.pos)===10)++this.pos;case 10:Z+=`
7
+ `;break;default:Z+=String.fromCharCode(Y);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;Q=this.pos}else++this.pos}};g.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(G.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
8
8
  `)++this.pos;case`
9
- `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};k.readEscapedChar=function(Z){var Q=this.input.charCodeAt(++this.pos);switch(++this.pos,Q){case 110:return`
10
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return O0(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(Z){var Y=this.pos-1;this.invalidStringToken(Y,"Invalid escape sequence in template string")}default:if(Q>=48&&Q<=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,Q=this.input.charCodeAt(this.pos),(J!=="0"||Q===56||Q===57)&&(this.strict||Z))this.invalidStringToken(this.pos-1-J.length,Z?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(X)}if(P0(Q)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(Q)}};k.readHexChar=function(Z){var Q=this.pos,Y=this.readInt(16,Z);if(Y===null)this.invalidStringToken(Q,"Bad character escape sequence");return Y};k.readWord1=function(){this.containsEsc=!1;var Z="",Q=!0,Y=this.pos,J=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var X=this.fullCharCodeAtPos();if(N0(X,J))this.pos+=X<=65535?1:2;else if(X===92){this.containsEsc=!0,Z+=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(!(Q?G0:N0)(W,J))this.invalidStringToken(K,"Invalid Unicode escape");Z+=O0(W),Y=this.pos}else break;Q=!1}return Z+this.input.slice(Y,this.pos)};k.readWord=function(){var Z=this.readWord1(),Q=G.name;if(this.keywords.test(Z))Q=C1[Z];return this.finishToken(Q,Z)};var j6="8.15.0";p.acorn={Parser:p,version:j6,defaultOptions:A1,Position:g0,SourceLocation:e0,getLineInfo:H8,Node:J1,TokenType:y,tokTypes:G,keywordTypes:C1,TokContext:H0,tokContexts:m,isIdentifierChar:N0,isIdentifierStart:G0,Token:k1,isNewLine:P0,lineBreak:r,lineBreakG:iZ,nonASCIIwhitespace:W8};function f8(Z,Q){return p.parse(Z,Q)}function h8(Z,Q,Y){return p.parseExpressionAt(Z,Q,Y)}class u extends Error{line;column;source;filename;constructor(Z,Q,Y,J){let X=`${J||"<source>"}:${Q.line}:${Q.column}`;super(`${Z} at ${X}`);this.name="TranspileError",this.line=Q.line,this.column=Q.column,this.source=Y,this.filename=J}}class t extends u{constructor(Z,Q,Y,J){super(Z,Q,Y,J);this.name="SyntaxError"}formatWithContext(Z=2){if(!this.source)return this.message;let Q=this.source.split(`
11
- `),Y=this.line-1,J=Math.max(0,Y-Z),X=Math.min(Q.length-1,Y+Z),K=[],W=String(X+1).length;for(let H=J;H<=X;H++){let z=String(H+1).padStart(W),_=H===Y?">":" ";if(K.push(`${_} ${z} | ${Q[H]}`),H===Y){let q=" ".repeat(W+4+this.column);K.push(`${q}^ ${this.message.split(" at ")[0]}`)}}return K.join(`
12
- `)}}function K0(Z){return{depth:Z.depth+1,locals:new Map,parent:Z,parameters:Z.parameters,atoms:Z.atoms,warnings:Z.warnings,source:Z.source,filename:Z.filename,options:Z.options}}function l(Z){if(Z.loc)return{line:Z.loc.start.line,column:Z.loc.start.column};return{line:1,column:0}}function G1(Z,Q){let Y="",J=0,X,K,W="normal",H=[],z=[{type:"top-level",braceDepth:0}],_=0,q=()=>z[z.length-1]?.type||"top-level",R=()=>{let F=z[z.length-1];return F?.type==="class-body"&&_===F.braceDepth+1};while(J<Z.length){let F=Z[J],O=Z[J+1];switch(W){case"single-string":if(Y+=F,F==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if(F==="'")W="normal";J++;continue;case"double-string":if(Y+=F,F==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if(F==='"')W="normal";J++;continue;case"template-string":if(Y+=F,F==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if(F==="$"&&O==="{"){Y+=O,J+=2,H.push(1),W="normal";continue}if(F==="`")W="normal";J++;continue;case"line-comment":if(Y+=F,F===`
13
- `)W="normal";J++;continue;case"block-comment":if(Y+=F,F==="*"&&O==="/"){Y+=O,J+=2,W="normal";continue}J++;continue;case"regex":if(Y+=F,F==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if(F==="["){J++;while(J<Z.length&&Z[J]!=="]")if(Y+=Z[J],Z[J]==="\\"&&J+1<Z.length)Y+=Z[J+1],J+=2;else J++;if(J<Z.length)Y+=Z[J],J++;continue}if(F==="/"){J++;while(J<Z.length&&/[gimsuy]/.test(Z[J]))Y+=Z[J],J++;W="normal";continue}J++;continue;case"normal":if(H.length>0){if(F==="{")H[H.length-1]++;else if(F==="}"){if(H[H.length-1]--,H[H.length-1]===0){H.pop(),Y+=F,J++,W="template-string";continue}}}if(F==="'"){Y+=F,J++,W="single-string";continue}if(F==='"'){Y+=F,J++,W="double-string";continue}if(F==="`"){Y+=F,J++,W="template-string";continue}if(F==="/"&&O==="/"){Y+=F+O,J+=2,W="line-comment";continue}if(F==="/"&&O==="*"){Y+=F+O,J+=2,W="block-comment";continue}if(F==="/"){let B=Y.trimEnd();if(!B[B.length-1]||/[=(!,;:{[&|?+\-*%<>~^]$/.test(B)||/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)\s*$/.test(B)){Y+=F,J++,W="regex";continue}}break}if(F==="{"){_++,Y+=F,J++;continue}if(F==="}"){_--;let B=z[z.length-1];if(B&&_===B.braceDepth)z.pop();Y+=F,J++;continue}let U=Z.slice(J).match(/^class\s+\w+(?:\s+extends\s+\w+)?\s*\{/);if(U){let B=U[0].slice(0,-1);Y+=B,J+=B.length,z.push({type:"class-body",braceDepth:_});continue}let N=Z.slice(J).match(/^function\s+(\w+)\s*\(/);if(N){let B=N[1],w=N[0].length,I=Z[J+w],j=null,E=J+w;if(I==="?"||I==="!")if(j=I,E++,j==="!")Q.unsafeFunctions.add(B);else Q.safeFunctions.add(B);Y+=`function ${B}(`,J=E;let P=K1(Z,J,"(",")");if(!P){Y+=Z[J],J++;continue}let{content:A,endPos:T}=P;J=T;let S=g1(A,Q,!0);Y+=S+")";let h=J;while(h<Z.length&&/\s/.test(Z[h]))h++;let f=Z.slice(h,h+2);if(f==="->"||f==="-?"||f==="-!"){h+=2;while(h<Z.length&&/\s/.test(Z[h]))h++;let Z0=W1(Z,h);if(Z0){let{type:e,endPos:D0}=Z0;if(X===void 0){if(X=e,f==="-?")K="safe";else if(f==="-!")K="unsafe"}J=D0}}continue}let L=Z.slice(J).match(/^(constructor|(?:get|set)\s+\w+|async\s+\w+|\w+)\s*\(/);if(L&&R()){let B=L[1],w=L[0].length,I=J+w;Y+=B+"(",J=I;let j=K1(Z,J,"(",")");if(!j){Y+=Z[J],J++;continue}let{content:E,endPos:P}=j;J=P;let A=g1(E,Q,!0);Y+=A+")";let T=J;while(T<Z.length&&/\s/.test(Z[T]))T++;let S=Z.slice(T,T+2);if(S==="->"||S==="-!"||S==="-?"){T+=2;while(T<Z.length&&/\s/.test(Z[T]))T++;let h=W1(Z,T);if(h)J=h.endPos}else if(Z[T]===":"){T++;while(T<Z.length&&/\s/.test(Z[T]))T++;let h=W1(Z,T);if(h)J=h.endPos}continue}if(Z[J]==="("){let B=K1(Z,J+1,"(",")");if(!B){Y+=Z[J],J++;continue}let{content:w,endPos:I}=B,j=I;while(j<Z.length&&/\s/.test(Z[j]))j++;let E,P=Z.slice(j,j+2);if(P==="->"||P==="-?"||P==="-!"){j+=2;while(j<Z.length&&/\s/.test(Z[j]))j++;let A=W1(Z,j);if(A){E=A.type,j=A.endPos;while(j<Z.length&&/\s/.test(Z[j]))j++}}if(Z.slice(j,j+2)==="=>"){let A=null,T=w,S=w.trimStart();if(S.startsWith("?")&&(S.length===1||/\s/.test(S[1])))A="?",T=S.slice(1);else if(S.startsWith("!")&&(S.length===1||/\s/.test(S[1])))A="!",T=S.slice(1);let h=g1(T,Q,!1);Y+=`(${A==="?"?"/* safe */ ":A==="!"?"/* unsafe */ ":""}${h})`,J=I;while(J<j&&/\s/.test(Z[J]))Y+=Z[J],J++;if(E)J=j}else{let A=G1(w,Q);Y+=`(${A.source})`,J=I}continue}Y+=Z[J],J++}return{source:Y,returnType:X,returnSafety:K}}function K1(Z,Q,Y,J){let X=1,K=Q,W=!1,H="";while(K<Z.length&&X>0){let z=Z[K];if(!W&&(z==="'"||z==='"'||z==="`"))W=!0,H=z;else if(W&&z===H&&Z[K-1]!=="\\")W=!1;else if(!W){if(z===Y)X++;else if(z===J)X--}K++}if(X!==0)return null;return{content:Z.slice(Q,K-1),endPos:K}}function u8(Z,Q){let Y=Q;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y>=Z.length)return null;let J=Y,X=Z[Y];if(X==="{"||X==="["){let W=X==="{"?"}":"]",H=K1(Z,Y+1,X,W);if(!H)return null;return{value:Z.slice(J,H.endPos),endPos:H.endPos}}if(X==="'"||X==='"'||X==="`"){Y++;while(Y<Z.length){if(Z[Y]===X&&Z[Y-1]!=="\\")return Y++,{value:Z.slice(J,Y),endPos:Y};Y++}return null}if(/[-+\d]/.test(X)){while(Y<Z.length&&/[\d.eE+-]/.test(Z[Y]))Y++;return{value:Z.slice(J,Y),endPos:Y}}let K=Z.slice(Y).match(/^(true|false|null|undefined)\b/);if(K)return{value:K[1],endPos:Y+K[1].length};return null}function x0(Z){return Z.replace(/(?<!\|)\|(?!\|)/g," || ")}function W1(Z,Q){let Y=Q,J=0,X=!1,K="",W=!1,H=(z)=>({type:x0(Z.slice(Q,z).trim()),endPos:z});while(Y<Z.length){let z=Z[Y];if(!X&&(z==="'"||z==='"'||z==="`")){X=!0,K=z,W=!0,Y++;continue}if(X){if(z===K&&Z[Y-1]!=="\\"){if(X=!1,Y++,J===0){let _=Y;while(_<Z.length&&/\s/.test(Z[_]))_++;if(Z[_]==="{"){if(!Z.slice(_+1).match(/^\s*(\w+)\s*:/))return H(Y)}if(Z[_]!=="|"&&Z[_]!=="&")return H(Y)}continue}Y++;continue}if(z==="{"||z==="["||z==="("){J++,W=!0,Y++;continue}if(z==="}"||z==="]"||z===")"){if(J--,J===0){Y++;let _=Y;while(_<Z.length&&/\s/.test(Z[_]))_++;if(Z[_]==="|"||Z[_]==="&")continue;return H(Y)}Y++;continue}if(J===0&&z==="{"){if(W)return H(Y);if(Z.slice(Y+1).match(/^\s*(\w+)\s*:/)){J++,W=!0,Y++;continue}return H(Y)}if(J===0&&(z==="|"||z==="&")){if(Y++,Y<Z.length&&Z[Y]==="|")Y++;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;continue}if(J===0&&(/\d/.test(z)||z==="-"&&/\d/.test(Z[Y+1]))){let _=Y;if(Z[_]==="-")_++;while(_<Z.length&&/\d/.test(Z[_]))_++;if(_<Z.length&&Z[_]==="."&&/\d/.test(Z[_+1])){_++;while(_<Z.length&&/\d/.test(Z[_]))_++}if(_<Z.length&&(Z[_]==="e"||Z[_]==="E")){if(_++,_<Z.length&&(Z[_]==="+"||Z[_]==="-"))_++;while(_<Z.length&&/\d/.test(Z[_]))_++}W=!0,Y=_;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y<Z.length&&Z[Y]==="{")return{type:x0(Z.slice(Q,_).trim()),endPos:_};if(Z[Y]!=="|"&&Z[Y]!=="&")return{type:x0(Z.slice(Q,_).trim()),endPos:_};continue}if(J===0&&/[a-zA-Z_]/.test(z)){let _=Y;while(_<Z.length&&/\w/.test(Z[_]))_++;W=!0,Y=_;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y<Z.length&&Z[Y]==="("){J++,Y++;continue}if(Y<Z.length&&Z[Y]==="{"){if(!Z.slice(Y+1).match(/^\s*(\w+)\s*:/)){let R=_;while(R>Q&&/\s/.test(Z[R-1]))R--;return{type:x0(Z.slice(Q,R).trim()),endPos:_}}}if(Z[Y]!=="|"&&Z[Y]!=="&")return{type:x0(Z.slice(Q,_).trim()),endPos:_};continue}Y++}if(W)return H(Y);return null}function _1(Z){let Q=[],Y="",J=0,X=!1,K=!1,W=0;while(W<Z.length){let H=Z[W],z=Z[W+1];if(!K&&H==="/"&&z==="/"){X=!0,Y+="//",W+=2;continue}if(!X&&H==="/"&&z==="*"){K=!0,Y+="/*",W+=2;continue}if(X&&H===`
14
- `){X=!1,Y+=H,W++;continue}if(K&&H==="*"&&z==="/"){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)Q.push(Y),Y="";else Y+=H;W++}if(Y.trim())Q.push(Y);return Q}function g1(Z,Q,Y){let J=G1(Z,{originalSource:Z,requiredParams:Q.requiredParams,unsafeFunctions:Q.unsafeFunctions,safeFunctions:Q.safeFunctions}).source,X=_1(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 q=_.trim();if(!q)return _;if(Y&&q.startsWith("{")&&q.endsWith("}")){let O=q.slice(1,-1);return`{ ${x8(O,Q)} }`}if(Y&&q.startsWith("[")&&q.endsWith("]")){let O=q.slice(1,-1);return`[ ${x8(O,Q)} ]`}if(q.startsWith("...")){let O=m8(q);if(O!==-1)return q.slice(0,O).trim();return _}let R=q.match(/^(\w+)\s*\?\s*:\s*(.+)$/);if(R){let[,O,U]=R;return H(O),K=!0,`${O} = ${U}`}if(!A6(q)){let O=q.match(/^(\w+)\s*=/);if(O)H(O[1]);return K=!0,_}let F=m8(q);if(F!==-1){let O=q.slice(0,F).trim(),U=q.slice(F+1).trim();if(H(O),K&&Y&&/^\w+$/.test(O));if(Y&&/^\w+$/.test(O))Q.requiredParams.add(O);return`${O} = ${U}`}return _}).join(",")}function x8(Z,Q){return _1(Z).map((X)=>{let K=X.trim();if(!K)return X;let W=K.match(/^(\w+)\s*:\s*(\{[\s\S]*\})$/);if(W){let[,_,q]=W;Q.requiredParams.add(_);let R=H1(q);return`${_} = ${R}`}let H=K.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(H){let[,_,q]=H;Q.requiredParams.add(_);let R=z1(q);return`${_} = ${R}`}let z=K.match(/^(\w+)\s*:\s*([\s\S]+)$/);if(z){let[,_,q]=z;return Q.requiredParams.add(_),`${_} = ${q}`}return X}).join(", ")}function H1(Z){let Q=Z.slice(1,-1).trim();return`{ ${_1(Q).map((X)=>{let K=X.trim();if(!K)return X;let W=K.match(/^(\w+)\s*:\s*(\{[\s\S]*\})$/);if(W){let[,R,F]=W;return`${R}: ${H1(F)}`}let H=K.match(/^(\w+)\s*=\s*(\{[\s\S]*\})$/);if(H){let[,R,F]=H;return`${R}: ${H1(F)}`}let z=K.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(z){let[,R,F]=z;return`${R}: ${z1(F)}`}let _=K.match(/^(\w+)\s*=\s*(\[[\s\S]*\])$/);if(_){let[,R,F]=_;return`${R}: ${z1(F)}`}let q=K.match(/^(\w+)\s*=\s*([\s\S]+)$/);if(q){let[,R,F]=q;return`${R}: ${F}`}return X}).join(", ")} }`}function z1(Z){let Q=Z.slice(1,-1).trim();return`[ ${_1(Q).map((X)=>{let K=X.trim();if(!K)return X;if(K.startsWith("{")&&K.endsWith("}"))return H1(K);if(K.startsWith("[")&&K.endsWith("]"))return z1(K);return X}).join(", ")} ]`}function A6(Z){let Q=0,Y=!1,J=!1,X=!1,K="";for(let W=0;W<Z.length;W++){let H=Z[W];if(!X&&(H==="'"||H==='"'||H==="`")){X=!0,K=H;continue}if(X){if(H===K&&Z[W-1]!=="\\")X=!1;continue}if(H==="("||H==="{"||H==="[")Q++;else if(H===")"||H==="}"||H==="]")Q--;else if(Q===0){if(H===":")Y=!0;if(H==="="&&Z[W+1]!==">")J=!0}}return Y&&!J}function m8(Z){let Q=0,Y=!1,J="";for(let X=0;X<Z.length;X++){let K=Z[X];if(!Y&&(K==="'"||K==='"'||K==="`")){Y=!0,J=K;continue}if(Y){if(K===J&&Z[X-1]!=="\\")Y=!1;continue}if(K==="("||K==="{"||K==="[")Q++;else if(K===")"||K==="}"||K==="]")Q--;else if(Q===0&&K===":")return X}return-1}function V6(Z,Q){let Y=Z.match(Q);if(!Y)return null;let J=Y.index+Y[0].length-1,X=1,K=J+1;while(K<Z.length&&X>0){if(Z[K]==="{")X++;else if(Z[K]==="}")X--;K++}if(X!==0)return null;let W=Z.slice(J,K),H=[Y[0].slice(0,-1)+W,W];return H.index=Y.index,H}function i8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.slice(Y).match(/^\btry\s*\{/);if(J){let K=Y+J[0].length-1+1,W=1,H=K;while(H<Z.length&&W>0){let _=Z[H];if(_==="{")W++;else if(_==="}")W--;H++}if(W!==0){Q+=Z[Y],Y++;continue}if(Z.slice(H).match(/^\s*(catch|finally)\b/))Q+=Z.slice(Y,H),Y=H;else{let _=Z.slice(K,H-1);Q+=`try {${_}} catch (__try_err) { return new (__tjs?.MonadicError ?? Error)(__try_err?.message || String(__try_err), 'try', undefined, undefined, __tjs?.getStack?.()) }`,Y=H}}else Q+=Z[Y],Y++}return Q}function n8(Z){let Q=[],Y="",J=0,X=0;while(J<Z.length){let K=Z.slice(J).match(/^\bwasm\s*\{/);if(K){let W=J,H=J+K[0].length,z=1,_=H;while(_<Z.length&&z>0){let P=Z[_];if(P==="{")z++;else if(P==="}")z--;_++}if(z!==0){Y+=Z[J],J++;continue}let q=Z.slice(H,_-1),R,F=_,O=Z.slice(_).match(/^\s*fallback\s*\{/);if(O){let P=_+O[0].length;z=1;let A=P;while(A<Z.length&&z>0){let T=Z[A];if(T==="{")z++;else if(T==="}")z--;A++}if(z===0)R=Z.slice(P,A-1),F=A}let N=T6(q).map((P)=>{let A=C6(Z,W,P);return A?`${P}: ${A}`:P}),L={id:`__tjs_wasm_${X}`,body:q,fallback:R,captures:N,start:W,end:F};Q.push(L);let B=R??q,w=N.map((P)=>P.split(":")[0].trim()),I=w.length>0?w.join(", "):"",j=w.length>0?`globalThis.${L.id}(${I})`:`globalThis.${L.id}()`,E=`(globalThis.${L.id} ? ${j} : (() => {${B}})())`;Y+=E,J=F,X++}else Y+=Z[J],J++}return{source:Y,blocks:Q}}function D6(Z){return Z.startsWith("f32x4_")||Z.startsWith("v128_")}function T6(Z){let Q=Z.replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,""),Y=new Set,J=/\.([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,X;while((X=J.exec(Q))!==null)Y.add(X[1]);let K=/(?<!\.)(\b[a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W=new Set;while((X=K.exec(Q))!==null)W.add(X[1]);for(let F of Y){if(!W.has(F))continue;let O=new RegExp(`(?<!\\.)\\b${F}\\b`,"g"),U=new RegExp(`\\.${F}\\b`,"g"),N=Q.match(O)?.length||0,L=Q.match(U)?.length||0;if(N<=L)W.delete(F)}let H=new Set,z=/\b(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=z.exec(Q))!==null)H.add(X[1]);let _=/\bfor\s*\(\s*(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=_.exec(Q))!==null)H.add(X[1]);let q=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","wasmBuffer"]),R=[];for(let F of W)if(!H.has(F)&&!q.has(F)&&!D6(F))R.push(F);return R.sort()}function C6(Z,Q,Y){let J=Z.slice(0,Q),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 l8(H[1],Y)}return l8(K[1],Y)}function l8(Z,Q){let Y=Z.split(",").map((J)=>J.trim());for(let J of Y){let X=J.match(new RegExp(`^${Q}\\s*:\\s*([A-Za-z][A-Za-z0-9]*)`));if(X)return X[1];let K=J.match(new RegExp(`^${Q}\\s*=\\s*(Float32Array|Float64Array|Int32Array|Uint8Array|Int8Array|Int16Array|Uint16Array|Uint32Array)`));if(K)return K[1]}return}function c8(Z){let Y=new RegExp(`([\\w][\\w.\\[\\]()]*|null|undefined|true|false|\\d+(?:\\.\\d+)?|'[^']*'|"[^"]*")\\s+IsNot\\s+([\\w][\\w.\\[\\]()]*|null|undefined|true|false|\\d+(?:\\.\\d+)?|'[^']*'|"[^"]*")`,"g");Z=Z.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 Z=Z.replace(J,"Is($1, $2)"),Z}function o8(Z){let Q=/^[\s]*[([/+\-`]/,Y=/[{([,;:+\-*/%=&|?<>!~^]\s*$|^\s*$/,J=/\b(return|throw|yield|await|case|default|extends|new|typeof|void|delete|in|of|instanceof)\s*$/,X=Z.split(`
15
- `),K=[];for(let W=0;W<X.length;W++){let H=X[W],z=W>0?X[W-1]:"";if(W>0&&Q.test(H)){let _=z.replace(/\/\/.*$/,"").replace(/\/\*.*\*\/\s*$/,"");if(!Y.test(_)&&!J.test(_)){let q=H.match(/^(\s*)/),R=q?q[1]:"",F=H.slice(R.length);K.push(R+";"+F);continue}}K.push(H)}return K.join(`
16
- `)}function a8(Z){Z=Z.replace(/\btypeof\s+([a-zA-Z_$][\w$.]*(?:\?\.[\w$]+)*)/g,"TypeOf($1)");let Q=[],Y=0,J="normal",X=[];while(Y<Z.length){let W=Z[Y],H=Z[Y+1];switch(J){case"single-string":if(W==="\\"&&Y+1<Z.length){Y+=2;continue}if(W==="'")J="normal";Y++;continue;case"double-string":if(W==="\\"&&Y+1<Z.length){Y+=2;continue}if(W==='"')J="normal";Y++;continue;case"template-string":if(W==="\\"&&Y+1<Z.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<Z.length){Y+=2;continue}if(W==="["){Y++;while(Y<Z.length&&Z[Y]!=="]")if(Z[Y]==="\\"&&Y+1<Z.length)Y+=2;else Y++;if(Y<Z.length)Y++;continue}if(W==="/"){Y++;while(Y<Z.length&&/[gimsuy]/.test(Z[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 z=Y-1;while(z>=0&&/\s/.test(Z[z]))z--;let _=z>=0?Z[z]:"";if(!_||/[=(!,;:{[&|?+\-*%<>~^]/.test(_)||z>=5&&/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)$/.test(Z.slice(Math.max(0,z-10),z+1))){Y++,J="regex";continue}}if(W==="="&&H==="="&&Z[Y+2]!=="="&&Z[Y-1]!=="!"){Q.push({pos:Y,op:"=="}),Y+=2;continue}if(W==="!"&&H==="="&&Z[Y+2]!=="="){Q.push({pos:Y,op:"!="}),Y+=2;continue}break}Y++}if(Q.length===0)return Z;let K=Z;for(let W=Q.length-1;W>=0;W--){let{pos:H,op:z}=Q[W],_=z==="=="?"Eq":"NotEq",q=P6(K,H),R=S6(K,H+2),F=K.slice(q,H).trim(),O=K.slice(H+2,R).trim();if(F&&O){let U=K.slice(0,q),N=K.slice(R),B=/[a-zA-Z0-9_$]$/.test(U)?" ":"";K=`${U}${B}${_}(${F}, ${O})${N}`}}return K}function P6(Z,Q){let Y=Q-1;while(Y>=0&&/\s/.test(Z[Y]))Y--;if(Y<0)return 0;let J=0,X=!1,K="";while(Y>=0){let W=Z[Y],H=Y>0?Z[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==="]"||W==="}"){J++,Y--;continue}if(W==="("||W==="["){if(J>0){J--,Y--;continue}return Y+1}if(W==="{"){if(J>0){J--,Y--;continue}return Y+1}if(J>0){Y--;continue}if(W===";")return Y+1;if(/[a-z]/.test(W)){let z=Y+1,_=Y;while(_>0&&/[a-z]/i.test(Z[_-1]))_--;let q=Z.slice(_,z),R=_>0?Z[_-1]:"";if(!/[a-zA-Z0-9_$]/.test(R)){if(["return","throw","case","typeof","void","delete","await","yield"].includes(q))return z;if(q==="new")return _}}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 S6(Z,Q){let Y=Q;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y>=Z.length)return Z.length;let J=0,X=!1,K="";while(Y<Z.length){let W=Z[Y],H=Y+1<Z.length?Z[Y+1]:"";if(X){if(W===K&&Z[Y-1]!=="\\")X=!1;Y++;continue}if((W==='"'||W==="'"||W==="`")&&Z[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==="="&&Z[Y+2]!=="=")return Y;Y++}return Z.length}function s8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.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,z=Z.slice(K).match(/^(['"`])([^]*?)\1\s*/);if(z){let F=K+z[0].length,O=Z[F],U=O===void 0||F>=Z.length||O!=="="&&O!=="{";if(O==="="||O==="{")W=z[2],H=!0,K=F;else if(U){let N=z[0].trim(),L=z[0].slice(N.length);Q+=`const ${X} = Type('${X}', ${N})${L}`,Y=F;continue}}let _,q=K,R=Z.slice(K).match(/^=\s*/);if(R){K+=R[0].length;let F=Z.slice(K).match(/^(\+?\d+(?:\.\d+)?|['"`][^'"`]*['"`]|\{[^}]*\}|\[[^\]]*\]|true|false|null)/);if(F){_=F[0],K+=F[0].length,q=K;let O=Z.slice(K).match(/^\s*/);if(O)K+=O[0].length}}if(Z[K]==="{"){let F=K+1,O=1,U=F;while(U<Z.length&&O>0){let E=Z[U];if(E==="{")O++;else if(E==="}")O--;U++}if(O!==0){Q+=Z[Y],Y++;continue}let N=Z.slice(F,U-1).trim(),L=U,B=N.match(/description\s*:\s*(['"`])([^]*?)\1/);if(B&&!H)W=B[2];let w,I=N.match(/example\s*:\s*/);if(I){let E=I.index+I[0].length,P=u8(N,E);if(P)w=P.value.trim()}let j=N.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/);if(j&&w){let E=j[1].trim(),P=j[2].trim(),A=_?`, ${_}`:"";Q+=`const ${X} = Type('${W}', (${E}) => { if (!globalThis.__tjs?.validate(${E}, globalThis.__tjs?.infer(${w}))) return false; ${P} }, ${w}${A})`}else if(j){let E=j[1].trim(),P=j[2].trim(),A=_?`, undefined, ${_}`:"";Q+=`const ${X} = Type('${W}', (${E}) => { ${P} }${A})`}else if(w){let E=_?`, ${_}`:"";Q+=`const ${X} = Type('${W}', undefined, ${w}${E})`}else if(_)Q+=`const ${X} = Type('${W}', ${_})`;else Q+=`const ${X} = Type('${W}')`;Y=L;continue}else if(_){Q+=`const ${X} = Type('${W}', ${_})`,Y=q;continue}else if(!z){let F=Z.slice(K).match(/^(['"`][^]*?['"`]|\+?\d+(?:\.\d+)?|true|false|null|\{[^]*?\}|\[[^]*?\])/);if(F){let O=F[0];Q+=`const ${X} = Type('${X}', ${O})`,Y=K+F[0].length;continue}}}Q+=Z[Y],Y++}return Q}function r8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.slice(Y).match(/^\bFunctionPredicate\s+([A-Z_][a-zA-Z0-9_]*)\s*(?:<([^>]+)>)?\s*/);if(J){let X=J[1],K=J[2],W=Y+J[0].length;if(Z[W]==="{"){let H=1,z=W+1;while(z<Z.length&&H>0){if(Z[z]==="{")H++;else if(Z[z]==="}")H--;z++}if(H===0){let _=Z.slice(W+1,z-1).trim(),q=V6(_,/params\s*:\s*\{/),R=_.match(/returns\s*:\s*(.+?)(?:\n|$)/),F=_.match(/returnContract\s*:\s*['"](\w+)['"]/),O=_.match(/description\s*:\s*(['"])([^]*?)\1/),U=[];if(q)U.push(`params: ${q[1]}`);if(R)U.push(`returns: ${R[1].trim()}`);if(F)U.push(`returnContract: '${F[1]}'`);let N=O?O[2]:X;if(K){let L=K.split(",").map((w)=>{let I=w.trim().split("=").map((j)=>j.trim());if(I.length===2){let j=I[1]==="any"||I[1]==="undefined"?"null":I[1];return`['${I[0]}', ${j}]`}return`'${I[0]}'`}),B=K.split(",").map((w)=>w.trim().split("=")[0].trim());Q+=`const ${X} = FunctionPredicate('${N}', [${L.join(", ")}], (${B.join(", ")}) => ({ ${U.join(", ")} }))`}else Q+=`const ${X} = FunctionPredicate('${N}', { ${U.join(", ")} })`;Y=z;continue}}if(Z[W]==="("){let H=1,z=W+1;while(z<Z.length&&H>0){if(Z[z]==="(")H++;else if(Z[z]===")")H--;z++}if(H===0){let _=Z.slice(W+1,z-1).trim(),q=_.indexOf(",");if(q!==-1){let R=_.slice(0,q).trim(),F=_.slice(q+1).trim();Q+=`const ${X} = FunctionPredicate(${F}, ${R})`}else Q+=`const ${X} = FunctionPredicate('${X}', ${_})`;Y=z;continue}}}Q+=Z[Y],Y++}return Q}function t8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.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,z=1,_=H;while(_<Z.length&&z>0){let w=Z[_];if(w==="{")z++;else if(w==="}")z--;_++}if(z!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,F=K.split(",").map((w)=>{let I=w.trim().split("=").map((j)=>j.trim());if(I.length===2){let j=I[1]==="any"||I[1]==="undefined"?"null":I[1];return`['${I[0]}', ${j}]`}return`'${I[0]}'`}),O=q,U=O.search(/\bdeclaration\s*\{/);if(U!==-1){let w=O.indexOf("{",U),I=1,j=w+1;while(j<O.length&&I>0){if(O[j]==="{")I++;else if(O[j]==="}")I--;j++}O=O.slice(0,U)+O.slice(j)}let N=O.match(/description\s*:\s*(['"`])([^]*?)\1/),L=O.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/),B=N?N[2]:X;if(L){let w=L[1].trim().split(",").map((A)=>A.trim()),I=L[2].trim(),j=w[0]||"x",E=w.slice(1),P=E.map((A)=>`check${A}`);E.forEach((A,T)=>{I=I.replace(new RegExp(`\\b${A}\\s*\\(`,"g"),`${P[T]}(`)}),Q+=`const ${X} = Generic([${F.join(", ")}], (${j}, ${P.join(", ")}) => { ${I} }, '${B}')`}else Q+=`const ${X} = Generic([${F.join(", ")}], () => true, '${B}')`;Y=R;continue}Q+=Z[Y],Y++}return Q}function e8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.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(Z[W]==="{"){let H=W+1,z=1,_=H;while(_<Z.length&&z>0){let O=Z[_];if(O==="{")z++;else if(O==="}")z--;_++}if(z!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,F=d8(q);Q+=`const ${X} = Union('${K}', [${F.join(", ")}])`,Y=R;continue}else{let H=Z.indexOf(`
18
- `,W);if(H===-1)H=Z.length;let z=Z.slice(W,H).trim();if(z){let _=d8(z);Q+=`const ${X} = Union('${K}', [${_.join(", ")}])`,Y=H;continue}}}Q+=Z[Y],Y++}return Q}function d8(Z){let Q=[],Y=Z.split("|").map((J)=>J.trim());for(let J of Y){if(!J)continue;Q.push(J)}return Q}function Z9(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.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,z=1,_=H;while(_<Z.length&&z>0){let U=Z[_];if(U==="{")z++;else if(U==="}")z--;_++}if(z!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,O=b6(q).map(([U,N])=>`${U}: ${N}`).join(", ");Q+=`const ${X} = Enum('${K}', { ${O} })`,Y=R;continue}Q+=Z[Y],Y++}return Q}function b6(Z){let Q=[],Y=0,J=Z.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){Q.push([W,H]);let z=Number(H);if(!isNaN(z))Y=z+1}else Q.push([W,String(Y)]),Y++}}return Q}function Q9(Z){let Q=new Map,Y="",J=0;while(J<Z.length){let X=Z.slice(J),K=X.match(/^(\s*)extend\s+([A-Z]\w*)\s*\{/);if(!K){if(J===0||Z[J-1]===`
19
- `||Z[J-1]===";"||Z[J-1]==="}"){let I=X.match(/^(\s*)extend\s+([A-Z]\w*)\s*\{/)}Y+=Z[J],J++;continue}let W=K[1],H=K[2],z=J+K[0].length-1,_=u0(Z,z),q=Z.slice(z+1,_-1).trim(),R=[],F=0,O=Z.slice(z+1,_-1);while(F<O.length){let I=O.slice(F).match(/^(\s*)(async\s+)?(\w+)\s*\(/);if(!I){F++;continue}let j=I[1],E=!!I[2],P=I[3],A=F+I[0].length-1,T=1,S=A+1;while(S<O.length&&T>0){if(O[S]==="(")T++;if(O[S]===")")T--;S++}let h=O.slice(A+1,S-1),f=S;while(f<O.length&&/\s/.test(O[f]))f++;if(O[f]==="="&&O[f+1]===">"){let M0=m0(Z,z+1+F);throw new t(`Arrow functions are not allowed in extend blocks (method '${P}' in extend ${H}). Use regular function syntax instead, as extension methods need 'this' binding.`,M0)}if(O[f]!=="{"){F++;continue}let Z0=u0(O,f),e=O.slice(F,Z0).trim(),D0=h.split(",").map((M0)=>M0.trim()).filter((M0)=>M0.length>0).map((M0)=>{let R1=M0.match(/^(\w+)\s*:\s*(.+)$/);if(R1)return`${R1[1]} = ${R1[2]}`;return M0}).join(", "),$1=E?"async ":"",C9=O.slice(f+1,Z0-1);R.push({name:P,isAsync:E,fullText:`${P}: ${$1}function(${D0}) {${C9}}`}),F=Z0}let U=!Q.has(H);if(U)Q.set(H,new Set);let N=Q.get(H);for(let w of R)N.add(w.name);let L=R.map((w)=>` ${w.fullText}`).join(`,
20
- `),B;if(U)B=`${W}const __ext_${H} = {
21
- ${L}
22
- ${W}}
23
- `;else B=`${W}Object.assign(__ext_${H}, {
24
- ${L}
25
- ${W}})
26
- `;for(let w of R)B+=`${W}if (__tjs?.registerExtension) { __tjs.registerExtension('${H}', '${w.name}', __ext_${H}.${w.name}) }
27
- `;Y+=B,J=_}if(J<=Z.length&&Y.length<Z.length);return{source:Y,extensions:Q}}function Y9(Z,Q){if(Q.size===0)return Z;let Y=new Map;for(let[X,K]of Q)for(let W of K){if(!Y.has(W))Y.set(W,[]);Y.get(W).push(X)}let J=Z;for(let[X,K]of Y){if(!K.includes("String"))continue;let W=new RegExp(`('(?:[^'\\\\]|\\\\.)*')\\.(${X})\\((\\))?`,"g");J=J.replace(W,(_,q,R,F)=>{return F?`__ext_String.${R}.call(${q})`:`__ext_String.${R}.call(${q}, `});let H=new RegExp(`("(?:[^"\\\\]|\\\\.)*")\\.(${X})\\((\\))?`,"g");J=J.replace(H,(_,q,R,F)=>{return F?`__ext_String.${R}.call(${q})`:`__ext_String.${R}.call(${q}, `});let z=new RegExp("(`(?:[^`\\\\]|\\\\.)*`)\\."+X+"\\((\\))?","g");J=J.replace(z,(_,q,R)=>{return R?`__ext_String.${X}.call(${q})`:`__ext_String.${X}.call(${q}, `})}for(let[X,K]of Y){if(!K.includes("Array"))continue;let W=`].${X}(`,H=0,z;while((z=J.indexOf(W,H))!==-1){let _=1,q=z-1,R=!1;while(q>=0&&_>0){let F=J[q];if(R){if(F===R&&(q===0||J[q-1]!=="\\"))R=!1}else{if(F==="]")_++;if(F==="[")_--;if(F==="'"||F==='"'||F==="`")R=F}q--}if(_===0){let F=J.slice(q+1,z+1),O=J.slice(0,q+1),U=J.slice(z+W.length);if(U[0]===")")J=`${O}__ext_Array.${X}.call(${F})${U.slice(1)}`;else J=`${O}__ext_Array.${X}.call(${F}, ${U}`}H=z+1}}for(let[X,K]of Y){if(!K.includes("Number"))continue;let W=new RegExp(`(\\d+(?:\\.\\d+)?)\\.(${X})\\((\\))?`,"g");J=J.replace(W,(H,z,_,q)=>{return q?`__ext_Number.${_}.call(${z})`:`__ext_Number.${_}.call(${z}, `})}return J}function m0(Z,Q){let Y=1,J=0;for(let X=0;X<Q&&X<Z.length;X++)if(Z[X]===`
28
- `)Y++,J=0;else J++;return{line:Y,column:J}}function J9(Z,Q){let Y=Q.trim();if(/^['"`]/.test(Y))return`typeof ${Z} === 'string'`;if(Y==="true"||Y==="false")return`typeof ${Z} === 'boolean'`;if(Y==="null")return`${Z} === null`;if(Y==="undefined")return`${Z} === undefined`;if(Y.startsWith("["))return`Array.isArray(${Z})`;if(Y.startsWith("{"))return`(typeof ${Z} === 'object' && ${Z} !== null && !Array.isArray(${Z}))`;if(/^\+\d+/.test(Y))return`(typeof ${Z} === 'number' && Number.isInteger(${Z}) && ${Z} >= 0)`;if(/^-?\d+\.\d+/.test(Y))return`typeof ${Z} === 'number'`;if(/^-?\d+$/.test(Y))return`(typeof ${Z} === 'number' && Number.isInteger(${Z}))`;return"true"}function q1(Z){let Q=Z.trim();if(/^['"`]/.test(Q))return"string";if(Q==="true"||Q==="false")return"boolean";if(Q==="null")return"null";if(Q==="undefined")return"undefined";if(Q.startsWith("["))return"array";if(Q.startsWith("{"))return"object";if(/^\+\d+/.test(Q))return"non-negative-integer";if(/^-?\d+\.\d+/.test(Q))return"number";if(/^-?\d+$/.test(Q))return"integer";return"any"}function y1(Z,Q){let Y=[],J=0,X="",K=!1;for(let H=0;H<Z.length;H++){let z=Z[H];if(!K&&(z==="'"||z==='"'||z==="`")){K=z,X+=z;continue}if(K){if(X+=z,z==="\\"){if(H++,H<Z.length)X+=Z[H];continue}if(z===K)K=!1;continue}if(z==="("||z==="["||z==="{"){J++,X+=z;continue}if(z===")"||z==="]"||z==="}"){J--,X+=z;continue}if(z===","&&J===0){let _=p8(X.trim(),Q);if(_)Y.push(_);X="";continue}X+=z}let W=X.trim();if(W){let H=p8(W,Q);if(H)Y.push(H)}return Y}function p8(Z,Q){let Y=Z.replace(/^\/\*\s*unsafe\s*\*\/\s*/,"");if(Y.startsWith("..."))return null;let J=Y.indexOf("=");if(J===-1)return{name:Y.trim(),defaultValue:"",required:!0};let X=Y.slice(0,J).trim(),K=Y.slice(J+1).trim();return{name:X,defaultValue:K,required:Q.has(X)}}function u0(Z,Q){let Y=1,J=Q+1,X=!1,K=!1,W=!1;while(J<Z.length&&Y>0){let H=Z[J],z=J+1<Z.length?Z[J+1]:"";if(K){if(H===`
29
- `)K=!1;J++;continue}if(W){if(H==="*"&&z==="/"){W=!1,J+=2;continue}J++;continue}if(X){if(H==="\\"){J+=2;continue}if(H===X)X=!1;J++;continue}if(H==="/"&&z==="/"){K=!0,J+=2;continue}if(H==="/"&&z==="*"){W=!0,J+=2;continue}if(H==="'"||H==='"'||H==="`"){X=H,J++;continue}if(H==="{")Y++;if(H==="}")Y--;J++}return J}function X9(Z,Q){let Y=new Set,J=/(?:^|(?<=[\n;{}]))\s*(export\s+)?(async\s+)?function\s+(\w+)\s*\(/gm,X=new Map,K,W=[];while((K=J.exec(Z))!==null){let R=!!K[1],F=!!K[2],O=K[3],U=K.index,N=U,B=K[0].indexOf("function");if(B>=0)N=U+B;W.push({name:O,fullMatchStart:U,funcKeywordStart:N,exported:R,isAsync:F})}for(let R of W)if(!X.has(R.name))X.set(R.name,[]);let H=new Map;for(let R of W)H.set(R.name,(H.get(R.name)||0)+1);let z=new Set;for(let[R,F]of H)if(F>1)z.add(R);if(z.size===0)return{source:Z,polymorphicNames:Y};for(let R of W){if(!z.has(R.name))continue;let F=Z.indexOf("(",R.funcKeywordStart);if(F===-1)continue;let O=1,U=F+1;while(U<Z.length&&O>0){if(Z[U]==="(")O++;if(Z[U]===")")O--;U++}let N=U-1,L=Z.slice(F+1,N),B=U;while(B<Z.length&&Z[B]!=="{")B++;if(B>=Z.length)continue;let w=u0(Z,B),I=R.fullMatchStart;while(I>0&&Z[I-1]===" ")I--;let j=X.get(R.name),E=y1(L,Q);if(L.includes("...")){let A=m0(Z,R.funcKeywordStart);throw new t(`Rest parameters are not supported in polymorphic function '${R.name}'. Use separate function names instead.`,A)}j.push({index:j.length+1,start:I,end:w,text:Z.slice(I,w),exported:R.exported,isAsync:R.isAsync,params:E})}for(let[R,F]of X){if(F.length<2)continue;let O=F.filter((U)=>U.isAsync).length;if(O>0&&O<F.length){let U=m0(Z,F[0].start);throw new t(`Polymorphic function '${R}': all variants must be either sync or async, not mixed.`,U)}for(let U=0;U<F.length;U++)for(let N=U+1;N<F.length;N++){let L=F[U],B=F[N];if(L.params.length!==B.params.length)continue;let w=!0;for(let I=0;I<L.params.length;I++){let j=L.params[I].defaultValue?q1(L.params[I].defaultValue):"any",E=B.params[I].defaultValue?q1(B.params[I].defaultValue):"any";if(j!==E){w=!1;break}}if(w){let I=m0(Z,B.start);throw new t(`Polymorphic function '${R}': variants ${U+1} and ${N+1} have ambiguous signatures (same parameter types at every position). Overloads must differ by arity or parameter types.`,I)}}}let _=[];for(let[R,F]of X){if(F.length<2)continue;for(let O of F)_.push({name:R,variant:O})}_.sort((R,F)=>F.variant.start-R.variant.start);let q=Z;for(let{name:R,variant:F}of _){let O=F.isAsync?"async ":"",U=F.text.replace(new RegExp(`(?:export\\s+)?${O?O.replace(/\s+$/,"\\s+"):""}function\\s+${R}\\s*\\(`),`${O}function ${R}$$${F.index}(`);q=q.slice(0,F.start)+U+q.slice(F.end)}for(let[R,F]of X){if(F.length<2)continue;Y.add(R);let O=F[0].isAsync,U=F.some((j)=>j.exported),N=O?"async ":"",L=U?"export ":"",B=[...F].sort((j,E)=>{if(j.params.length!==E.params.length)return 0;let P=0,A=0;for(let T of j.params){let S=T.defaultValue?q1(T.defaultValue):"any";if(S==="non-negative-integer")P+=3;else if(S==="integer")P+=2;else if(S!=="any")P+=1}for(let T of E.params){let S=T.defaultValue?q1(T.defaultValue):"any";if(S==="non-negative-integer")A+=3;else if(S==="integer")A+=2;else if(S!=="any")A+=1}return A-P}),w=[];for(let j of B){let E=[`__args.length === ${j.params.length}`],P=[];for(let A=0;A<j.params.length;A++){let T=j.params[A];if(P.push(`__args[${A}]`),T.defaultValue){let S=J9(`__args[${A}]`,T.defaultValue);if(S!=="true")E.push(S)}}w.push(` if (${E.join(" && ")}) return ${R}$${j.index}(${P.join(", ")})`)}let I=`
30
- ${L}${N}function ${R}(...__args) {
31
- ${w.join(`
9
+ `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};g.readEscapedChar=function(Z){var Q=this.input.charCodeAt(++this.pos);switch(++this.pos,Q){case 110:return`
10
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return O0(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(Z){var Y=this.pos-1;this.invalidStringToken(Y,"Invalid escape sequence in template string")}default:if(Q>=48&&Q<=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,Q=this.input.charCodeAt(this.pos),(J!=="0"||Q===56||Q===57)&&(this.strict||Z))this.invalidStringToken(this.pos-1-J.length,Z?"Octal literal in template string":"Octal literal in strict mode");return String.fromCharCode(X)}if(P0(Q)){if(this.options.locations)this.lineStart=this.pos,++this.curLine;return""}return String.fromCharCode(Q)}};g.readHexChar=function(Z){var Q=this.pos,Y=this.readInt(16,Z);if(Y===null)this.invalidStringToken(Q,"Bad character escape sequence");return Y};g.readWord1=function(){this.containsEsc=!1;var Z="",Q=!0,Y=this.pos,J=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var X=this.fullCharCodeAtPos();if(j0(X,J))this.pos+=X<=65535?1:2;else if(X===92){this.containsEsc=!0,Z+=this.input.slice(Y,this.pos);var H=this.pos;if(this.input.charCodeAt(++this.pos)!==117)this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX");++this.pos;var K=this.readCodePoint();if(!(Q?G0:j0)(K,J))this.invalidStringToken(H,"Invalid Unicode escape");Z+=O0(K),Y=this.pos}else break;Q=!1}return Z+this.input.slice(Y,this.pos)};g.readWord=function(){var Z=this.readWord1(),Q=G.name;if(this.keywords.test(Z))Q=P1[Z];return this.finishToken(Q,Z)};var N6="8.15.0";i.acorn={Parser:i,version:N6,defaultOptions:V1,Position:y0,SourceLocation:Z1,getLineInfo:z8,Node:X1,TokenType:h,tokTypes:G,keywordTypes:P1,TokContext:W0,tokContexts:u,isIdentifierChar:j0,isIdentifierStart:G0,Token:g1,isNewLine:P0,lineBreak:e,lineBreakG:iZ,nonASCIIwhitespace:H8};function h8(Z,Q){return i.parse(Z,Q)}function x8(Z,Q,Y){return i.parseExpressionAt(Z,Q,Y)}class l extends Error{line;column;source;filename;constructor(Z,Q,Y,J){let X=`${J||"<source>"}:${Q.line}:${Q.column}`;super(`${Z} at ${X}`);this.name="TranspileError",this.line=Q.line,this.column=Q.column,this.source=Y,this.filename=J}}class Z0 extends l{constructor(Z,Q,Y,J){super(Z,Q,Y,J);this.name="SyntaxError"}formatWithContext(Z=2){if(!this.source)return this.message;let Q=this.source.split(`
11
+ `),Y=this.line-1,J=Math.max(0,Y-Z),X=Math.min(Q.length-1,Y+Z),H=[],K=String(X+1).length;for(let W=J;W<=X;W++){let z=String(W+1).padStart(K),_=W===Y?">":" ";if(H.push(`${_} ${z} | ${Q[W]}`),W===Y){let q=" ".repeat(K+4+this.column);H.push(`${q}^ ${this.message.split(" at ")[0]}`)}}return H.join(`
12
+ `)}}function H0(Z){return{depth:Z.depth+1,locals:new Map,parent:Z,parameters:Z.parameters,atoms:Z.atoms,warnings:Z.warnings,source:Z.source,filename:Z.filename,options:Z.options}}function d(Z){if(Z.loc)return{line:Z.loc.start.line,column:Z.loc.start.column};return{line:1,column:0}}function _1(Z,Q){let Y="",J=0,X,H,K="normal",W=[],z=[{type:"top-level",braceDepth:0}],_=0,q=()=>z[z.length-1]?.type||"top-level",R=()=>{let F=z[z.length-1];return F?.type==="class-body"&&_===F.braceDepth+1};while(J<Z.length){let F=Z[J],O=Z[J+1];switch(K){case"single-string":if(Y+=F,F==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if(F==="'")K="normal";J++;continue;case"double-string":if(Y+=F,F==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if(F==='"')K="normal";J++;continue;case"template-string":if(Y+=F,F==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if(F==="$"&&O==="{"){Y+=O,J+=2,W.push(1),K="normal";continue}if(F==="`")K="normal";J++;continue;case"line-comment":if(Y+=F,F===`
13
+ `)K="normal";J++;continue;case"block-comment":if(Y+=F,F==="*"&&O==="/"){Y+=O,J+=2,K="normal";continue}J++;continue;case"regex":if(Y+=F,F==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if(F==="["){J++;while(J<Z.length&&Z[J]!=="]")if(Y+=Z[J],Z[J]==="\\"&&J+1<Z.length)Y+=Z[J+1],J+=2;else J++;if(J<Z.length)Y+=Z[J],J++;continue}if(F==="/"){J++;while(J<Z.length&&/[gimsuy]/.test(Z[J]))Y+=Z[J],J++;K="normal";continue}J++;continue;case"normal":if(W.length>0){if(F==="{")W[W.length-1]++;else if(F==="}"){if(W[W.length-1]--,W[W.length-1]===0){W.pop(),Y+=F,J++,K="template-string";continue}}}if(F==="'"){Y+=F,J++,K="single-string";continue}if(F==='"'){Y+=F,J++,K="double-string";continue}if(F==="`"){Y+=F,J++,K="template-string";continue}if(F==="/"&&O==="/"){Y+=F+O,J+=2,K="line-comment";continue}if(F==="/"&&O==="*"){Y+=F+O,J+=2,K="block-comment";continue}if(F==="/"){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+=F,J++,K="regex";continue}}break}if(F==="{"){_++,Y+=F,J++;continue}if(F==="}"){_--;let I=z[z.length-1];if(I&&_===I.braceDepth)z.pop();Y+=F,J++;continue}let U=Z.slice(J).match(/^class\s+\w+(?:\s+extends\s+\w+)?\s*\{/);if(U){let I=U[0].slice(0,-1);Y+=I,J+=I.length,z.push({type:"class-body",braceDepth:_});continue}let L=Z.slice(J).match(/^function\s+(\w+)\s*\(/);if(L){let I=L[1],w=L[0].length,S=Z[J+w],A=null,T=J+w;if(S==="?"||S==="!")if(A=S,T++,A==="!")Q.unsafeFunctions.add(I);else Q.safeFunctions.add(I);Y+=`function ${I}(`,J=T;let E=W1(Z,J,"(",")");if(!E){Y+=Z[J],J++;continue}let{content:P,endPos:f}=E;J=f;let k=y1(P,Q,!0);Y+=k+")";let x=J;while(x<Z.length&&/\s/.test(Z[x]))x++;let n=Z.slice(x,x+2);if(n==="->"||n==="-?"||n==="-!"){x+=2;while(x<Z.length&&/\s/.test(Z[x]))x++;let w0=H1(Z,x);if(w0){let{type:v0,endPos:R1}=w0;if(X===void 0){if(X=v0,n==="-?")H="safe";else if(n==="-!")H="unsafe"}J=R1}}continue}let B=Z.slice(J).match(/^(constructor|(?:get|set)\s+\w+|async\s+\w+|\w+)\s*\(/),j=(()=>{for(let I=Y.length-1;I>=0;I--)if(!/\s/.test(Y[I]))return Y[I];return`
14
+ `})(),N=j!=="="&&j!==","&&j!=="("&&j!=="["&&j!==">";if(B&&R()&&!N){let I=B[1].length;Y+=Z.slice(J,J+I),J+=I;continue}if(B&&R()&&N){let I=B[1],w=B[0].length,S=J+w;Y+=I+"(",J=S;let A=W1(Z,J,"(",")");if(!A){Y+=Z[J],J++;continue}let{content:T,endPos:E}=A;J=E;let P=y1(T,Q,!0);Y+=P+")";let f=J;while(f<Z.length&&/\s/.test(Z[f]))f++;let k=Z.slice(f,f+2);if(k==="->"||k==="-!"||k==="-?"){f+=2;while(f<Z.length&&/\s/.test(Z[f]))f++;let x=H1(Z,f);if(x)J=x.endPos}else if(Z[f]===":"){f++;while(f<Z.length&&/\s/.test(Z[f]))f++;let x=H1(Z,f);if(x)J=x.endPos}continue}if(Z[J]==="("){let I=W1(Z,J+1,"(",")");if(!I){Y+=Z[J],J++;continue}let{content:w,endPos:S}=I,A=S;while(A<Z.length&&/\s/.test(Z[A]))A++;let T,E=Z.slice(A,A+2);if(E==="->"||E==="-?"||E==="-!"){A+=2;while(A<Z.length&&/\s/.test(Z[A]))A++;let P=H1(Z,A);if(P){T=P.type,A=P.endPos;while(A<Z.length&&/\s/.test(Z[A]))A++}}if(Z.slice(A,A+2)==="=>"){let P=null,f=w,k=w.trimStart();if(k.startsWith("?")&&(k.length===1||/\s/.test(k[1])))P="?",f=k.slice(1);else if(k.startsWith("!")&&(k.length===1||/\s/.test(k[1])))P="!",f=k.slice(1);let x=y1(f,Q,!1);Y+=`(${P==="?"?"/* safe */ ":P==="!"?"/* unsafe */ ":""}${x})`,J=S;while(J<A&&/\s/.test(Z[J]))Y+=Z[J],J++;if(T)J=A}else{let P=_1(w,Q);Y+=`(${P.source})`,J=S}continue}Y+=Z[J],J++}return{source:Y,returnType:X,returnSafety:H}}function W1(Z,Q,Y,J){let X=1,H=Q,K=!1,W="";while(H<Z.length&&X>0){let z=Z[H];if(!K&&(z==="'"||z==='"'||z==="`"))K=!0,W=z;else if(K&&z===W&&Z[H-1]!=="\\")K=!1;else if(!K){if(z===Y)X++;else if(z===J)X--}H++}if(X!==0)return null;return{content:Z.slice(Q,H-1),endPos:H}}function l8(Z,Q){let Y=Q;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y>=Z.length)return null;let J=Y,X=Z[Y];if(X==="{"||X==="["){let K=X==="{"?"}":"]",W=W1(Z,Y+1,X,K);if(!W)return null;return{value:Z.slice(J,W.endPos),endPos:W.endPos}}if(X==="'"||X==='"'||X==="`"){Y++;while(Y<Z.length){if(Z[Y]===X&&Z[Y-1]!=="\\")return Y++,{value:Z.slice(J,Y),endPos:Y};Y++}return null}if(/[-+\d]/.test(X)){while(Y<Z.length&&/[\d.eE+-]/.test(Z[Y]))Y++;return{value:Z.slice(J,Y),endPos:Y}}let H=Z.slice(Y).match(/^(true|false|null|undefined)\b/);if(H)return{value:H[1],endPos:Y+H[1].length};return null}function m0(Z){return Z.replace(/(?<!\|)\|(?!\|)/g," || ")}function H1(Z,Q){let Y=Q,J=0,X=!1,H="",K=!1,W=(z)=>({type:m0(Z.slice(Q,z).trim()),endPos:z});while(Y<Z.length){let z=Z[Y];if(!X&&(z==="'"||z==='"'||z==="`")){X=!0,H=z,K=!0,Y++;continue}if(X){if(z===H&&Z[Y-1]!=="\\"){if(X=!1,Y++,J===0){let _=Y;while(_<Z.length&&/\s/.test(Z[_]))_++;if(Z[_]==="{"){if(!Z.slice(_+1).match(/^\s*(\w+)\s*:/))return W(Y)}if(Z[_]!=="|"&&Z[_]!=="&")return W(Y)}continue}Y++;continue}if(z==="{"||z==="["||z==="("){J++,K=!0,Y++;continue}if(z==="}"||z==="]"||z===")"){if(J--,J===0){Y++;let _=Y;while(_<Z.length&&/\s/.test(Z[_]))_++;if(Z[_]==="|"||Z[_]==="&")continue;return W(Y)}Y++;continue}if(J===0&&z==="{"){if(K)return W(Y);if(Z.slice(Y+1).match(/^\s*(\w+)\s*:/)){J++,K=!0,Y++;continue}return W(Y)}if(J===0&&(z==="|"||z==="&")){if(Y++,Y<Z.length&&Z[Y]==="|")Y++;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;continue}if(J===0&&(/\d/.test(z)||z==="-"&&/\d/.test(Z[Y+1]))){let _=Y;if(Z[_]==="-")_++;while(_<Z.length&&/\d/.test(Z[_]))_++;if(_<Z.length&&Z[_]==="."&&/\d/.test(Z[_+1])){_++;while(_<Z.length&&/\d/.test(Z[_]))_++}if(_<Z.length&&(Z[_]==="e"||Z[_]==="E")){if(_++,_<Z.length&&(Z[_]==="+"||Z[_]==="-"))_++;while(_<Z.length&&/\d/.test(Z[_]))_++}K=!0,Y=_;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y<Z.length&&Z[Y]==="{")return{type:m0(Z.slice(Q,_).trim()),endPos:_};if(Z[Y]!=="|"&&Z[Y]!=="&")return{type:m0(Z.slice(Q,_).trim()),endPos:_};continue}if(J===0&&/[a-zA-Z_]/.test(z)){let _=Y;while(_<Z.length&&/\w/.test(Z[_]))_++;K=!0,Y=_;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y<Z.length&&Z[Y]==="("){J++,Y++;continue}if(Y<Z.length&&Z[Y]==="{"){if(!Z.slice(Y+1).match(/^\s*(\w+)\s*:/)){let R=_;while(R>Q&&/\s/.test(Z[R-1]))R--;return{type:m0(Z.slice(Q,R).trim()),endPos:_}}}if(Z[Y]!=="|"&&Z[Y]!=="&")return{type:m0(Z.slice(Q,_).trim()),endPos:_};continue}Y++}if(K)return W(Y);return null}function q1(Z){let Q=[],Y="",J=0,X=!1,H=!1,K=0;while(K<Z.length){let W=Z[K],z=Z[K+1];if(!H&&W==="/"&&z==="/"){X=!0,Y+="//",K+=2;continue}if(!X&&W==="/"&&z==="*"){H=!0,Y+="/*",K+=2;continue}if(X&&W===`
15
+ `){X=!1,Y+=W,K++;continue}if(H&&W==="*"&&z==="/"){H=!1,Y+="*/",K+=2;continue}if(X||H){Y+=W,K++;continue}if(W==="("||W==="{"||W==="[")J++,Y+=W;else if(W===")"||W==="}"||W==="]")J--,Y+=W;else if(W===","&&J===0)Q.push(Y),Y="";else Y+=W;K++}if(Y.trim())Q.push(Y);return Q}function y1(Z,Q,Y){let J=_1(Z,{originalSource:Z,requiredParams:Q.requiredParams,unsafeFunctions:Q.unsafeFunctions,safeFunctions:Q.safeFunctions}).source,X=q1(J),H=!1,K=new Set,W=(_)=>{if(Y&&/^\w+$/.test(_)){if(K.has(_))throw Error(`Duplicate parameter name '${_}'`);K.add(_)}};return X.map((_)=>{let q=_.trim();if(!q)return _;if(Y&&q.startsWith("{")&&q.endsWith("}")){let O=q.slice(1,-1);return`{ ${m8(O,Q)} }`}if(Y&&q.startsWith("[")&&q.endsWith("]")){let O=q.slice(1,-1);return`[ ${m8(O,Q)} ]`}if(q.startsWith("...")){let O=u8(q);if(O!==-1)return q.slice(0,O).trim();return _}let R=q.match(/^(\w+)\s*\?\s*:\s*(.+)$/);if(R){let[,O,U]=R;return W(O),H=!0,`${O} = ${U}`}if(!A6(q)){let O=q.match(/^(\w+)\s*=/);if(O)W(O[1]);return H=!0,_}let F=u8(q);if(F!==-1){let O=q.slice(0,F).trim(),U=q.slice(F+1).trim();if(W(O),H&&Y&&/^\w+$/.test(O));if(Y&&/^\w+$/.test(O))Q.requiredParams.add(O);return`${O} = ${U}`}return _}).join(",")}function m8(Z,Q){return q1(Z).map((X)=>{let H=X.trim();if(!H)return X;let K=H.match(/^(\w+)\s*:\s*(\{[\s\S]*\})$/);if(K){let[,_,q]=K;Q.requiredParams.add(_);let R=z1(q);return`${_} = ${R}`}let W=H.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(W){let[,_,q]=W;Q.requiredParams.add(_);let R=G1(q);return`${_} = ${R}`}let z=H.match(/^(\w+)\s*:\s*([\s\S]+)$/);if(z){let[,_,q]=z;return Q.requiredParams.add(_),`${_} = ${q}`}return X}).join(", ")}function z1(Z){let Q=Z.slice(1,-1).trim();return`{ ${q1(Q).map((X)=>{let H=X.trim();if(!H)return X;let K=H.match(/^(\w+)\s*:\s*(\{[\s\S]*\})$/);if(K){let[,R,F]=K;return`${R}: ${z1(F)}`}let W=H.match(/^(\w+)\s*=\s*(\{[\s\S]*\})$/);if(W){let[,R,F]=W;return`${R}: ${z1(F)}`}let z=H.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(z){let[,R,F]=z;return`${R}: ${G1(F)}`}let _=H.match(/^(\w+)\s*=\s*(\[[\s\S]*\])$/);if(_){let[,R,F]=_;return`${R}: ${G1(F)}`}let q=H.match(/^(\w+)\s*=\s*([\s\S]+)$/);if(q){let[,R,F]=q;return`${R}: ${F}`}return X}).join(", ")} }`}function G1(Z){let Q=Z.slice(1,-1).trim();return`[ ${q1(Q).map((X)=>{let H=X.trim();if(!H)return X;if(H.startsWith("{")&&H.endsWith("}"))return z1(H);if(H.startsWith("[")&&H.endsWith("]"))return G1(H);return X}).join(", ")} ]`}function A6(Z){let Q=0,Y=!1,J=!1,X=!1,H="";for(let K=0;K<Z.length;K++){let W=Z[K];if(!X&&(W==="'"||W==='"'||W==="`")){X=!0,H=W;continue}if(X){if(W===H&&Z[K-1]!=="\\")X=!1;continue}if(W==="("||W==="{"||W==="[")Q++;else if(W===")"||W==="}"||W==="]")Q--;else if(Q===0){if(W===":")Y=!0;if(W==="="&&Z[K+1]!==">")J=!0}}return Y&&!J}function u8(Z){let Q=0,Y=!1,J="";for(let X=0;X<Z.length;X++){let H=Z[X];if(!Y&&(H==="'"||H==='"'||H==="`")){Y=!0,J=H;continue}if(Y){if(H===J&&Z[X-1]!=="\\")Y=!1;continue}if(H==="("||H==="{"||H==="[")Q++;else if(H===")"||H==="}"||H==="]")Q--;else if(Q===0&&H===":")return X}return-1}function V6(Z,Q){let Y=Z.match(Q);if(!Y)return null;let J=Y.index+Y[0].length-1,X=1,H=J+1;while(H<Z.length&&X>0){if(Z[H]==="{")X++;else if(Z[H]==="}")X--;H++}if(X!==0)return null;let K=Z.slice(J,H),W=[Y[0].slice(0,-1)+K,K];return W.index=Y.index,W}function n8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.slice(Y).match(/^\btry\s*\{/);if(J){let H=Y+J[0].length-1+1,K=1,W=H;while(W<Z.length&&K>0){let _=Z[W];if(_==="{")K++;else if(_==="}")K--;W++}if(K!==0){Q+=Z[Y],Y++;continue}if(Z.slice(W).match(/^\s*(catch|finally)\b/))Q+=Z.slice(Y,W),Y=W;else{let _=Z.slice(H,W-1);Q+=`try {${_}} catch (__try_err) { return new (__tjs?.MonadicError ?? Error)(__try_err?.message || String(__try_err), 'try', undefined, undefined, __tjs?.getStack?.()) }`,Y=W}}else Q+=Z[Y],Y++}return Q}function c8(Z){let Q=[],Y="",J=0,X=0;while(J<Z.length){let H=Z.slice(J).match(/^\bwasm\s*\{/);if(H){let K=J,W=J+H[0].length,z=1,_=W;while(_<Z.length&&z>0){let A=Z[_];if(A==="{")z++;else if(A==="}")z--;_++}if(z!==0){Y+=Z[J],J++;continue}let q=Z.slice(W,_-1),R,F=_,O=Z.slice(_).match(/^\s*fallback\s*\{/);if(O){let A=_+O[0].length;z=1;let T=A;while(T<Z.length&&z>0){let E=Z[T];if(E==="{")z++;else if(E==="}")z--;T++}if(z===0)R=Z.slice(A,T-1),F=T}let L=T6(q).map((A)=>{let T=C6(Z,K,A);return T?`${A}: ${T}`:A}),B={id:`__tjs_wasm_${X}`,body:q,fallback:R,captures:L,start:K,end:F};Q.push(B);let j=R??q,N=L.map((A)=>A.split(":")[0].trim()),I=N.length>0?N.join(", "):"",w=N.length>0?`globalThis.${B.id}(${I})`:`globalThis.${B.id}()`,S=`(globalThis.${B.id} ? ${w} : (() => {${j}})())`;Y+=S,J=F,X++}else Y+=Z[J],J++}return{source:Y,blocks:Q}}function D6(Z){return Z.startsWith("f32x4_")||Z.startsWith("v128_")}function T6(Z){let Q=Z.replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,""),Y=new Set,J=/\.([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,X;while((X=J.exec(Q))!==null)Y.add(X[1]);let H=/(?<!\.)(\b[a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,K=new Set;while((X=H.exec(Q))!==null)K.add(X[1]);for(let F of Y){if(!K.has(F))continue;let O=new RegExp(`(?<!\\.)\\b${F}\\b`,"g"),U=new RegExp(`\\.${F}\\b`,"g"),L=Q.match(O)?.length||0,B=Q.match(U)?.length||0;if(L<=B)K.delete(F)}let W=new Set,z=/\b(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=z.exec(Q))!==null)W.add(X[1]);let _=/\bfor\s*\(\s*(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=_.exec(Q))!==null)W.add(X[1]);let q=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","wasmBuffer"]),R=[];for(let F of K)if(!W.has(F)&&!q.has(F)&&!D6(F))R.push(F);return R.sort()}function C6(Z,Q,Y){let J=Z.slice(0,Q),X=/function\s+\w+\s*\(([^)]*)\)\s*(?:->.*?)?\s*\{[^}]*$/,H=J.match(X);if(!H){let K=/(?:const|let|var)?\s*\w+\s*=\s*(?:async\s*)?\(([^)]*)\)\s*(?:=>|->)?\s*\{[^}]*$/,W=J.match(K);if(!W)return;return d8(W[1],Y)}return d8(H[1],Y)}function d8(Z,Q){let Y=Z.split(",").map((J)=>J.trim());for(let J of Y){let X=J.match(new RegExp(`^${Q}\\s*:\\s*([A-Za-z][A-Za-z0-9]*)`));if(X)return X[1];let H=J.match(new RegExp(`^${Q}\\s*=\\s*(Float32Array|Float64Array|Int32Array|Uint8Array|Int8Array|Int16Array|Uint16Array|Uint32Array)`));if(H)return H[1]}return}function o8(Z){let Y=new RegExp(`([\\w][\\w.\\[\\]()]*|null|undefined|true|false|\\d+(?:\\.\\d+)?|'[^']*'|"[^"]*")\\s+IsNot\\s+([\\w][\\w.\\[\\]()]*|null|undefined|true|false|\\d+(?:\\.\\d+)?|'[^']*'|"[^"]*")`,"g");Z=Z.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 Z=Z.replace(J,"Is($1, $2)"),Z}function a8(Z){let Q=/^[\s]*[([/+\-`]/,Y=/[{([,;:+\-*/%=&|?<>!~^]\s*$|^\s*$/,J=/\b(return|throw|yield|await|case|default|extends|new|typeof|void|delete|in|of|instanceof)\s*$/,X=Z.split(`
16
+ `),H=[];for(let K=0;K<X.length;K++){let W=X[K],z=K>0?X[K-1]:"";if(K>0&&Q.test(W)){let _=z.replace(/\/\/.*$/,"").replace(/\/\*.*\*\/\s*$/,"");if(!Y.test(_)&&!J.test(_)){let q=W.match(/^(\s*)/),R=q?q[1]:"",F=W.slice(R.length);H.push(R+";"+F);continue}}H.push(W)}return H.join(`
17
+ `)}function s8(Z){Z=Z.replace(/\btypeof\s+([a-zA-Z_$][\w$.]*(?:\?\.[\w$]+)*)/g,"TypeOf($1)");let Q=[],Y=0,J="normal",X=[];while(Y<Z.length){let K=Z[Y],W=Z[Y+1];switch(J){case"single-string":if(K==="\\"&&Y+1<Z.length){Y+=2;continue}if(K==="'")J="normal";Y++;continue;case"double-string":if(K==="\\"&&Y+1<Z.length){Y+=2;continue}if(K==='"')J="normal";Y++;continue;case"template-string":if(K==="\\"&&Y+1<Z.length){Y+=2;continue}if(K==="$"&&W==="{"){Y+=2,X.push(1),J="normal";continue}if(K==="`")J="normal";Y++;continue;case"line-comment":if(K===`
18
+ `)J="normal";Y++;continue;case"block-comment":if(K==="*"&&W==="/"){Y+=2,J="normal";continue}Y++;continue;case"regex":if(K==="\\"&&Y+1<Z.length){Y+=2;continue}if(K==="["){Y++;while(Y<Z.length&&Z[Y]!=="]")if(Z[Y]==="\\"&&Y+1<Z.length)Y+=2;else Y++;if(Y<Z.length)Y++;continue}if(K==="/"){Y++;while(Y<Z.length&&/[gimsuy]/.test(Z[Y]))Y++;J="normal";continue}Y++;continue;case"normal":if(X.length>0){if(K==="{")X[X.length-1]++;else if(K==="}"){if(X[X.length-1]--,X[X.length-1]===0){X.pop(),Y++,J="template-string";continue}}}if(K==="'"){Y++,J="single-string";continue}if(K==='"'){Y++,J="double-string";continue}if(K==="`"){Y++,J="template-string";continue}if(K==="/"&&W==="/"){Y+=2,J="line-comment";continue}if(K==="/"&&W==="*"){Y+=2,J="block-comment";continue}if(K==="/"){let z=Y-1;while(z>=0&&/\s/.test(Z[z]))z--;let _=z>=0?Z[z]:"";if(!_||/[=(!,;:{[&|?+\-*%<>~^]/.test(_)||z>=5&&/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)$/.test(Z.slice(Math.max(0,z-10),z+1))){Y++,J="regex";continue}}if(K==="="&&W==="="&&Z[Y+2]!=="="&&Z[Y-1]!=="!"){Q.push({pos:Y,op:"=="}),Y+=2;continue}if(K==="!"&&W==="="&&Z[Y+2]!=="="){Q.push({pos:Y,op:"!="}),Y+=2;continue}break}Y++}if(Q.length===0)return Z;let H=Z;for(let K=Q.length-1;K>=0;K--){let{pos:W,op:z}=Q[K],_=z==="=="?"Eq":"NotEq",q=P6(H,W),R=S6(H,W+2),F=H.slice(q,W).trim(),O=H.slice(W+2,R).trim();if(F&&O){let U=H.slice(0,q),L=H.slice(R),j=/[a-zA-Z0-9_$]$/.test(U)?" ":"";H=`${U}${j}${_}(${F}, ${O})${L}`}}return H}function P6(Z,Q){let Y=Q-1;while(Y>=0&&/\s/.test(Z[Y]))Y--;if(Y<0)return 0;let J=0,X=!1,H="";while(Y>=0){let K=Z[Y],W=Y>0?Z[Y-1]:"";if(X){if(K===H&&W!=="\\")X=!1;Y--;continue}if((K==='"'||K==="'"||K==="`")&&W!=="\\"){X=!0,H=K,Y--;continue}if(K===")"||K==="]"||K==="}"){J++,Y--;continue}if(K==="("||K==="["){if(J>0){J--,Y--;continue}return Y+1}if(K==="{"){if(J>0){J--,Y--;continue}return Y+1}if(J>0){Y--;continue}if(K===";")return Y+1;if(/[a-z]/.test(K)){let z=Y+1,_=Y;while(_>0&&/[a-z]/i.test(Z[_-1]))_--;let q=Z.slice(_,z),R=_>0?Z[_-1]:"";if(!/[a-zA-Z0-9_$]/.test(R)){if(["return","throw","case","typeof","void","delete","await","yield"].includes(q))return z;if(q==="new")return _}}if(K===">"&&W==="=")return Y+1;if(K==="="&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")return Y+1;if(K==="&"&&W==="&")return Y+1;if(K==="|"&&W==="|")return Y+1;if(K==="?"||K===":")return Y+1;if(K===",")return Y+1;Y--}return 0}function S6(Z,Q){let Y=Q;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Y>=Z.length)return Z.length;let J=0,X=!1,H="";while(Y<Z.length){let K=Z[Y],W=Y+1<Z.length?Z[Y+1]:"";if(X){if(K===H&&Z[Y-1]!=="\\")X=!1;Y++;continue}if((K==='"'||K==="'"||K==="`")&&Z[Y-1]!=="\\"){X=!0,H=K,Y++;continue}if(K==="("||K==="["||K==="{"){J++,Y++;continue}if(K===")"||K==="]"||K==="}"){if(J>0){J--,Y++;continue}return Y}if(J>0){Y++;continue}if(K===";")return Y;if(K==="&"&&W==="&")return Y;if(K==="|"&&W==="|")return Y;if(K==="?")return Y;if(K===":")return Y;if(K===",")return Y;if((K==="="||K==="!")&&W==="="&&Z[Y+2]!=="=")return Y;Y++}return Z.length}function r8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.slice(Y).match(/^\bType\s+([A-Z_][a-zA-Z0-9_]*)\s*/);if(J){let X=J[1],H=Y+J[0].length,K=X,W=!1,z=Z.slice(H).match(/^(['"`])([^]*?)\1\s*/);if(z){let F=H+z[0].length,O=Z[F],U=O===void 0||F>=Z.length||O!=="="&&O!=="{";if(O==="="||O==="{")K=z[2],W=!0,H=F;else if(U){let L=z[0].trim(),B=z[0].slice(L.length);Q+=`const ${X} = Type('${X}', ${L})${B}`,Y=F;continue}}let _,q=H,R=Z.slice(H).match(/^=\s*/);if(R){H+=R[0].length;let F=Z.slice(H).match(/^(\+?\d+(?:\.\d+)?|['"`][^'"`]*['"`]|\{[^}]*\}|\[[^\]]*\]|true|false|null)/);if(F){_=F[0],H+=F[0].length,q=H;let O=Z.slice(H).match(/^\s*/);if(O)H+=O[0].length}}if(Z[H]==="{"){let F=H+1,O=1,U=F;while(U<Z.length&&O>0){let S=Z[U];if(S==="{")O++;else if(S==="}")O--;U++}if(O!==0){Q+=Z[Y],Y++;continue}let L=Z.slice(F,U-1).trim(),B=U,j=L.match(/description\s*:\s*(['"`])([^]*?)\1/);if(j&&!W)K=j[2];let N,I=L.match(/example\s*:\s*/);if(I){let S=I.index+I[0].length,A=l8(L,S);if(A)N=A.value.trim()}let w=L.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/);if(w&&N){let S=w[1].trim(),A=w[2].trim(),T=_?`, ${_}`:"";Q+=`const ${X} = Type('${K}', (${S}) => { if (!globalThis.__tjs?.validate(${S}, globalThis.__tjs?.infer(${N}))) return false; ${A} }, ${N}${T})`}else if(w){let S=w[1].trim(),A=w[2].trim(),T=_?`, undefined, ${_}`:"";Q+=`const ${X} = Type('${K}', (${S}) => { ${A} }${T})`}else if(N){let S=_?`, ${_}`:"";Q+=`const ${X} = Type('${K}', undefined, ${N}${S})`}else if(_)Q+=`const ${X} = Type('${K}', ${_})`;else Q+=`const ${X} = Type('${K}')`;Y=B;continue}else if(_){Q+=`const ${X} = Type('${K}', ${_})`,Y=q;continue}else if(!z){let F=Z.slice(H).match(/^(['"`][^]*?['"`]|\+?\d+(?:\.\d+)?|true|false|null|\{[^]*?\}|\[[^]*?\])/);if(F){let O=F[0];Q+=`const ${X} = Type('${X}', ${O})`,Y=H+F[0].length;continue}}}Q+=Z[Y],Y++}return Q}function t8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.slice(Y).match(/^\bFunctionPredicate\s+([A-Z_][a-zA-Z0-9_]*)\s*(?:<([^>]+)>)?\s*/);if(J){let X=J[1],H=J[2],K=Y+J[0].length;if(Z[K]==="{"){let W=1,z=K+1;while(z<Z.length&&W>0){if(Z[z]==="{")W++;else if(Z[z]==="}")W--;z++}if(W===0){let _=Z.slice(K+1,z-1).trim(),q=V6(_,/params\s*:\s*\{/),R=_.match(/returns\s*:\s*(.+?)(?:\n|$)/),F=_.match(/returnContract\s*:\s*['"](\w+)['"]/),O=_.match(/description\s*:\s*(['"])([^]*?)\1/),U=[];if(q)U.push(`params: ${q[1]}`);if(R)U.push(`returns: ${R[1].trim()}`);if(F)U.push(`returnContract: '${F[1]}'`);let L=O?O[2]:X;if(H){let B=H.split(",").map((N)=>{let I=N.trim().split("=").map((w)=>w.trim());if(I.length===2){let w=I[1]==="any"||I[1]==="undefined"?"null":I[1];return`['${I[0]}', ${w}]`}return`'${I[0]}'`}),j=H.split(",").map((N)=>N.trim().split("=")[0].trim());Q+=`const ${X} = FunctionPredicate('${L}', [${B.join(", ")}], (${j.join(", ")}) => ({ ${U.join(", ")} }))`}else Q+=`const ${X} = FunctionPredicate('${L}', { ${U.join(", ")} })`;Y=z;continue}}if(Z[K]==="("){let W=1,z=K+1;while(z<Z.length&&W>0){if(Z[z]==="(")W++;else if(Z[z]===")")W--;z++}if(W===0){let _=Z.slice(K+1,z-1).trim(),q=_.indexOf(",");if(q!==-1){let R=_.slice(0,q).trim(),F=_.slice(q+1).trim();Q+=`const ${X} = FunctionPredicate(${F}, ${R})`}else Q+=`const ${X} = FunctionPredicate('${X}', ${_})`;Y=z;continue}}}Q+=Z[Y],Y++}return Q}function e8(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.slice(Y).match(/^\bGeneric\s+([A-Z][a-zA-Z0-9_]*)\s*<([^>]+)>\s*\{/);if(J){let X=J[1],H=J[2],W=Y+J[0].length-1+1,z=1,_=W;while(_<Z.length&&z>0){let N=Z[_];if(N==="{")z++;else if(N==="}")z--;_++}if(z!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(W,_-1).trim(),R=_,F=H.split(",").map((N)=>{let I=N.trim().split("=").map((w)=>w.trim());if(I.length===2){let w=I[1]==="any"||I[1]==="undefined"?"null":I[1];return`['${I[0]}', ${w}]`}return`'${I[0]}'`}),O=q,U=O.search(/\bdeclaration\s*\{/);if(U!==-1){let N=O.indexOf("{",U),I=1,w=N+1;while(w<O.length&&I>0){if(O[w]==="{")I++;else if(O[w]==="}")I--;w++}O=O.slice(0,U)+O.slice(w)}let L=O.match(/description\s*:\s*(['"`])([^]*?)\1/),B=O.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/),j=L?L[2]:X;if(B){let N=B[1].trim().split(",").map((T)=>T.trim()),I=B[2].trim(),w=N[0]||"x",S=N.slice(1),A=S.map((T)=>`check${T}`);S.forEach((T,E)=>{I=I.replace(new RegExp(`\\b${T}\\s*\\(`,"g"),`${A[E]}(`)}),Q+=`const ${X} = Generic([${F.join(", ")}], (${w}, ${A.join(", ")}) => { ${I} }, '${j}')`}else Q+=`const ${X} = Generic([${F.join(", ")}], () => true, '${j}')`;Y=R;continue}Q+=Z[Y],Y++}return Q}function Z9(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.slice(Y).match(/^\bUnion\s+([A-Z][a-zA-Z0-9_]*)\s+(['"`])([^]*?)\2\s*/);if(J){let X=J[1],H=J[3],K=Y+J[0].length;if(Z[K]==="{"){let W=K+1,z=1,_=W;while(_<Z.length&&z>0){let O=Z[_];if(O==="{")z++;else if(O==="}")z--;_++}if(z!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(W,_-1).trim(),R=_,F=p8(q);Q+=`const ${X} = Union('${H}', [${F.join(", ")}])`,Y=R;continue}else{let W=Z.indexOf(`
19
+ `,K);if(W===-1)W=Z.length;let z=Z.slice(K,W).trim();if(z){let _=p8(z);Q+=`const ${X} = Union('${H}', [${_.join(", ")}])`,Y=W;continue}}}Q+=Z[Y],Y++}return Q}function p8(Z){let Q=[],Y=Z.split("|").map((J)=>J.trim());for(let J of Y){if(!J)continue;Q.push(J)}return Q}function Q9(Z){let Q="",Y=0;while(Y<Z.length){let J=Z.slice(Y).match(/^\bEnum\s+([A-Z][a-zA-Z0-9_]*)\s+(['"`])([^]*?)\2\s*\{/);if(J){let X=J[1],H=J[3],W=Y+J[0].length-1+1,z=1,_=W;while(_<Z.length&&z>0){let U=Z[_];if(U==="{")z++;else if(U==="}")z--;_++}if(z!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(W,_-1).trim(),R=_,O=b6(q).map(([U,L])=>`${U}: ${L}`).join(", ");Q+=`const ${X} = Enum('${H}', { ${O} })`,Y=R;continue}Q+=Z[Y],Y++}return Q}function b6(Z){let Q=[],Y=0,J=Z.split(/[\n,]/).map((X)=>X.trim()).filter((X)=>X&&!X.startsWith("//"));for(let X of J){let H=X.match(/^([A-Za-z_][A-Za-z0-9_]*)\s*(?:=\s*(.+))?$/);if(H){let K=H[1],W=H[2]?.trim();if(W!==void 0){Q.push([K,W]);let z=Number(W);if(!isNaN(z))Y=z+1}else Q.push([K,String(Y)]),Y++}}return Q}function Y9(Z){let Q=new Map,Y="",J=0;while(J<Z.length){let X=Z.slice(J),H=X.match(/^(\s*)extend\s+([A-Z]\w*)\s*\{/);if(!H){if(J===0||Z[J-1]===`
20
+ `||Z[J-1]===";"||Z[J-1]==="}"){let I=X.match(/^(\s*)extend\s+([A-Z]\w*)\s*\{/)}Y+=Z[J],J++;continue}let K=H[1],W=H[2],z=J+H[0].length-1,_=l0(Z,z),q=Z.slice(z+1,_-1).trim(),R=[],F=0,O=Z.slice(z+1,_-1);while(F<O.length){let I=O.slice(F).match(/^(\s*)(async\s+)?(\w+)\s*\(/);if(!I){F++;continue}let w=I[1],S=!!I[2],A=I[3],T=F+I[0].length-1,E=1,P=T+1;while(P<O.length&&E>0){if(O[P]==="(")E++;if(O[P]===")")E--;P++}let f=O.slice(T+1,P-1),k=P;while(k<O.length&&/\s/.test(O[k]))k++;if(O[k]==="="&&O[k+1]===">"){let M0=u0(Z,z+1+F);throw new Z0(`Arrow functions are not allowed in extend blocks (method '${A}' in extend ${W}). Use regular function syntax instead, as extension methods need 'this' binding.`,M0)}if(O[k]!=="{"){F++;continue}let x=l0(O,k),n=O.slice(F,x).trim(),w0=f.split(",").map((M0)=>M0.trim()).filter((M0)=>M0.length>0).map((M0)=>{let O1=M0.match(/^(\w+)\s*:\s*(.+)$/);if(O1)return`${O1[1]} = ${O1[2]}`;return M0}).join(", "),v0=S?"async ":"",R1=O.slice(k+1,x-1);R.push({name:A,isAsync:S,fullText:`${A}: ${v0}function(${w0}) {${R1}}`}),F=x}let U=!Q.has(W);if(U)Q.set(W,new Set);let L=Q.get(W);for(let N of R)L.add(N.name);let B=R.map((N)=>` ${N.fullText}`).join(`,
21
+ `),j;if(U)j=`${K}const __ext_${W} = {
22
+ ${B}
23
+ ${K}}
24
+ `;else j=`${K}Object.assign(__ext_${W}, {
25
+ ${B}
26
+ ${K}})
27
+ `;for(let N of R)j+=`${K}if (__tjs?.registerExtension) { __tjs.registerExtension('${W}', '${N.name}', __ext_${W}.${N.name}) }
28
+ `;Y+=j,J=_}if(J<=Z.length&&Y.length<Z.length);return{source:Y,extensions:Q}}function J9(Z,Q){if(Q.size===0)return Z;let Y=new Map;for(let[X,H]of Q)for(let K of H){if(!Y.has(K))Y.set(K,[]);Y.get(K).push(X)}let J=Z;for(let[X,H]of Y){if(!H.includes("String"))continue;let K=new RegExp(`('(?:[^'\\\\]|\\\\.)*')\\.(${X})\\((\\))?`,"g");J=J.replace(K,(_,q,R,F)=>{return F?`__ext_String.${R}.call(${q})`:`__ext_String.${R}.call(${q}, `});let W=new RegExp(`("(?:[^"\\\\]|\\\\.)*")\\.(${X})\\((\\))?`,"g");J=J.replace(W,(_,q,R,F)=>{return F?`__ext_String.${R}.call(${q})`:`__ext_String.${R}.call(${q}, `});let z=new RegExp("(`(?:[^`\\\\]|\\\\.)*`)\\."+X+"\\((\\))?","g");J=J.replace(z,(_,q,R)=>{return R?`__ext_String.${X}.call(${q})`:`__ext_String.${X}.call(${q}, `})}for(let[X,H]of Y){if(!H.includes("Array"))continue;let K=`].${X}(`,W=0,z;while((z=J.indexOf(K,W))!==-1){let _=1,q=z-1,R=!1;while(q>=0&&_>0){let F=J[q];if(R){if(F===R&&(q===0||J[q-1]!=="\\"))R=!1}else{if(F==="]")_++;if(F==="[")_--;if(F==="'"||F==='"'||F==="`")R=F}q--}if(_===0){let F=J.slice(q+1,z+1),O=J.slice(0,q+1),U=J.slice(z+K.length);if(U[0]===")")J=`${O}__ext_Array.${X}.call(${F})${U.slice(1)}`;else J=`${O}__ext_Array.${X}.call(${F}, ${U}`}W=z+1}}for(let[X,H]of Y){if(!H.includes("Number"))continue;let K=new RegExp(`(\\d+(?:\\.\\d+)?)\\.(${X})\\((\\))?`,"g");J=J.replace(K,(W,z,_,q)=>{return q?`__ext_Number.${_}.call(${z})`:`__ext_Number.${_}.call(${z}, `})}return J}function u0(Z,Q){let Y=1,J=0;for(let X=0;X<Q&&X<Z.length;X++)if(Z[X]===`
29
+ `)Y++,J=0;else J++;return{line:Y,column:J}}function X9(Z,Q){let Y=Q.trim();if(/^['"`]/.test(Y))return`typeof ${Z} === 'string'`;if(Y==="true"||Y==="false")return`typeof ${Z} === 'boolean'`;if(Y==="null")return`${Z} === null`;if(Y==="undefined")return`${Z} === undefined`;if(Y.startsWith("["))return`Array.isArray(${Z})`;if(Y.startsWith("{"))return`(typeof ${Z} === 'object' && ${Z} !== null && !Array.isArray(${Z}))`;if(/^\+\d+/.test(Y))return`(typeof ${Z} === 'number' && Number.isInteger(${Z}) && ${Z} >= 0)`;if(/^-?\d+\.\d+/.test(Y))return`typeof ${Z} === 'number'`;if(/^-?\d+$/.test(Y))return`(typeof ${Z} === 'number' && Number.isInteger(${Z}))`;return"true"}function F1(Z){let Q=Z.trim();if(/^['"`]/.test(Q))return"string";if(Q==="true"||Q==="false")return"boolean";if(Q==="null")return"null";if(Q==="undefined")return"undefined";if(Q.startsWith("["))return"array";if(Q.startsWith("{"))return"object";if(/^\+\d+/.test(Q))return"non-negative-integer";if(/^-?\d+\.\d+/.test(Q))return"number";if(/^-?\d+$/.test(Q))return"integer";return"any"}function f1(Z,Q){let Y=[],J=0,X="",H=!1;for(let W=0;W<Z.length;W++){let z=Z[W];if(!H&&(z==="'"||z==='"'||z==="`")){H=z,X+=z;continue}if(H){if(X+=z,z==="\\"){if(W++,W<Z.length)X+=Z[W];continue}if(z===H)H=!1;continue}if(z==="("||z==="["||z==="{"){J++,X+=z;continue}if(z===")"||z==="]"||z==="}"){J--,X+=z;continue}if(z===","&&J===0){let _=i8(X.trim(),Q);if(_)Y.push(_);X="";continue}X+=z}let K=X.trim();if(K){let W=i8(K,Q);if(W)Y.push(W)}return Y}function i8(Z,Q){let Y=Z.replace(/^\/\*\s*unsafe\s*\*\/\s*/,"");if(Y.startsWith("..."))return null;let J=Y.indexOf("=");if(J===-1)return{name:Y.trim(),defaultValue:"",required:!0};let X=Y.slice(0,J).trim(),H=Y.slice(J+1).trim();return{name:X,defaultValue:H,required:Q.has(X)}}function l0(Z,Q){let Y=1,J=Q+1,X=!1,H=!1,K=!1;while(J<Z.length&&Y>0){let W=Z[J],z=J+1<Z.length?Z[J+1]:"";if(H){if(W===`
30
+ `)H=!1;J++;continue}if(K){if(W==="*"&&z==="/"){K=!1,J+=2;continue}J++;continue}if(X){if(W==="\\"){J+=2;continue}if(W===X)X=!1;J++;continue}if(W==="/"&&z==="/"){H=!0,J+=2;continue}if(W==="/"&&z==="*"){K=!0,J+=2;continue}if(W==="'"||W==='"'||W==="`"){X=W,J++;continue}if(W==="{")Y++;if(W==="}")Y--;J++}return J}function K9(Z,Q){let Y=new Set,J=/(?:^|(?<=[\n;{}]))\s*(export\s+)?(async\s+)?function\s+(\w+)\s*\(/gm,X=new Map,H,K=[];while((H=J.exec(Z))!==null){let R=!!H[1],F=!!H[2],O=H[3],U=H.index,L=U,j=H[0].indexOf("function");if(j>=0)L=U+j;K.push({name:O,fullMatchStart:U,funcKeywordStart:L,exported:R,isAsync:F})}for(let R of K)if(!X.has(R.name))X.set(R.name,[]);let W=new Map;for(let R of K)W.set(R.name,(W.get(R.name)||0)+1);let z=new Set;for(let[R,F]of W)if(F>1)z.add(R);if(z.size===0)return{source:Z,polymorphicNames:Y};for(let R of K){if(!z.has(R.name))continue;let F=Z.indexOf("(",R.funcKeywordStart);if(F===-1)continue;let O=1,U=F+1;while(U<Z.length&&O>0){if(Z[U]==="(")O++;if(Z[U]===")")O--;U++}let L=U-1,B=Z.slice(F+1,L),j=U;while(j<Z.length&&Z[j]!=="{")j++;if(j>=Z.length)continue;let N=l0(Z,j),I=R.fullMatchStart;while(I>0&&Z[I-1]===" ")I--;let w=X.get(R.name),S=f1(B,Q);if(B.includes("...")){let T=u0(Z,R.funcKeywordStart);throw new Z0(`Rest parameters are not supported in polymorphic function '${R.name}'. Use separate function names instead.`,T)}w.push({index:w.length+1,start:I,end:N,text:Z.slice(I,N),exported:R.exported,isAsync:R.isAsync,params:S})}for(let[R,F]of X){if(F.length<2)continue;let O=F.filter((U)=>U.isAsync).length;if(O>0&&O<F.length){let U=u0(Z,F[0].start);throw new Z0(`Polymorphic function '${R}': all variants must be either sync or async, not mixed.`,U)}for(let U=0;U<F.length;U++)for(let L=U+1;L<F.length;L++){let B=F[U],j=F[L];if(B.params.length!==j.params.length)continue;let N=!0;for(let I=0;I<B.params.length;I++){let w=B.params[I].defaultValue?F1(B.params[I].defaultValue):"any",S=j.params[I].defaultValue?F1(j.params[I].defaultValue):"any";if(w!==S){N=!1;break}}if(N){let I=u0(Z,j.start);throw new Z0(`Polymorphic function '${R}': variants ${U+1} and ${L+1} have ambiguous signatures (same parameter types at every position). Overloads must differ by arity or parameter types.`,I)}}}let _=[];for(let[R,F]of X){if(F.length<2)continue;for(let O of F)_.push({name:R,variant:O})}_.sort((R,F)=>F.variant.start-R.variant.start);let q=Z;for(let{name:R,variant:F}of _){let O=F.isAsync?"async ":"",U=F.text.replace(new RegExp(`(?:export\\s+)?${O?O.replace(/\s+$/,"\\s+"):""}function\\s+${R}\\s*\\(`),`${O}function ${R}$$${F.index}(`);q=q.slice(0,F.start)+U+q.slice(F.end)}for(let[R,F]of X){if(F.length<2)continue;Y.add(R);let O=F[0].isAsync,U=F.some((w)=>w.exported),L=O?"async ":"",B=U?"export ":"",j=[...F].sort((w,S)=>{if(w.params.length!==S.params.length)return 0;let A=0,T=0;for(let E of w.params){let P=E.defaultValue?F1(E.defaultValue):"any";if(P==="non-negative-integer")A+=3;else if(P==="integer")A+=2;else if(P!=="any")A+=1}for(let E of S.params){let P=E.defaultValue?F1(E.defaultValue):"any";if(P==="non-negative-integer")T+=3;else if(P==="integer")T+=2;else if(P!=="any")T+=1}return T-A}),N=[];for(let w of j){let S=[`__args.length === ${w.params.length}`],A=[];for(let T=0;T<w.params.length;T++){let E=w.params[T];if(A.push(`__args[${T}]`),E.defaultValue){let P=X9(`__args[${T}]`,E.defaultValue);if(P!=="true")S.push(P)}}N.push(` if (${S.join(" && ")}) return ${R}$${w.index}(${A.join(", ")})`)}let I=`
31
+ ${B}${L}function ${R}(...__args) {
32
+ ${N.join(`
32
33
  `)}
33
34
  return __tjs.typeError('${R}', 'no matching overload', __args)
34
35
  }
35
- `;q+=I}return{source:q,polymorphicNames:Y}}function W9(Z){return Z.replace(/(?<=^|[;\n{])\s*([A-Z][a-zA-Z0-9_]*)\s*=(?!=)/gm,(Q,Y)=>{return Q.replace(Y,`const ${Y}`)})}function K9(Z,Q=!1){let Y=[],J=[],X="",K=0;while(K<Z.length){let W=Z.slice(K).match(/^\btest\s+/);if(W){let H=K,z=K+W[0].length,_,q=Z.slice(z).match(/^(['"`])([^]*?)\1\s*/);if(q)_=q[2],z+=q[0].length;if(Z[z]==="{"){let R=z+1,F=1,O=R;while(O<Z.length&&F>0){let U=Z[O];if(U==="{")F++;else if(U==="}")F--;O++}if(F===0){let U=Z.slice(R,O-1).trim(),N=O,L=(Z.slice(0,H).match(/\n/g)||[]).length+1;if(Y.push({description:_,body:U,start:H,end:N,line:L}),!Q)try{Function(U)()}catch(I){let j=_||`test at line ${L}`;J.push(`Test failed: ${j} (line ${L})
36
- ${I.message||I}`)}let w=(Z.slice(H,N).match(/\n/g)||[]).length;X+=`
37
- `.repeat(w),K=N;continue}}}X+=Z[K],K++}return{source:X,tests:Y,errors:J}}function H9(Z,Q){let Y=new Set,J=/\bclass\s+(\w+)(\s+extends\s+\w+)?\s*\{/g,X,K=[];while((X=J.exec(Z))!==null){let H=X[1],z=X[2]?.trim()||"",_=X.index+X[0].length-1,q=u0(Z,_),R=Z.slice(_,q);K.push({className:H,extendsClause:z,bodyStart:_,bodyEnd:q,body:R})}let W=Z;for(let H=K.length-1;H>=0;H--){let{className:z,extendsClause:_,bodyStart:q,bodyEnd:R,body:F}=K[H],O=/\bconstructor\s*\(/g,U,N=[];while((U=O.exec(F))!==null)N.push(U.index);if(N.length<2)continue;Y.add(z);let L=[];for(let A=0;A<N.length;A++){let T=N[A],S=F.indexOf("(",T),h=1,f=S+1;while(f<F.length&&h>0){if(F[f]==="(")h++;if(F[f]===")")h--;f++}let Z0=F.slice(S+1,f-1),e=f;while(e<F.length&&F[e]!=="{")e++;let D0=u0(F,e),$1=F.slice(e+1,D0-1);L.push({index:A+1,paramStr:Z0,bodyText:$1,fullStart:T,fullEnd:D0})}let B=F.slice(0,L[0].fullEnd),w=L[L.length-1].fullEnd;B+=F.slice(w);let I=F;for(let A=L.length-1;A>=1;A--){let T=L[A],S=T.fullStart;while(S>0&&I[S-1]===" ")S--;if(S>0&&I[S-1]===`
38
- `)S--;I=I.slice(0,S)+I.slice(T.fullEnd)}let j="";for(let A=1;A<L.length;A++){let T=L[A],S=y1(T.paramStr,Q);if(T.paramStr.includes("...")){let f=m0(Z,q+T.fullStart);throw new t(`Rest parameters are not supported in polymorphic constructors for '${z}'.`,f)}j+=`
39
- function ${z}$ctor$${T.index}(${T.paramStr}) {`,j+=`
40
- const __obj = Object.create(${z}.prototype)`,j+=`
41
- ;(function() {${T.bodyText}}).call(__obj)`,j+=`
42
- return __obj`,j+=`
36
+ `;q+=I}return{source:q,polymorphicNames:Y}}function H9(Z){return Z.replace(/(?<=^|[;\n{])\s*([A-Z][a-zA-Z0-9_]*)\s*=(?!=)/gm,(Q,Y)=>{return Q.replace(Y,`const ${Y}`)})}function W9(Z,Q=!1){let Y=[],J=[],X="",H=0;while(H<Z.length){let K=Z.slice(H).match(/^\btest\s+/);if(K){let W=H,z=H+K[0].length,_,q=Z.slice(z).match(/^(['"`])([^]*?)\1\s*/);if(q)_=q[2],z+=q[0].length;if(Z[z]==="{"){let R=z+1,F=1,O=R;while(O<Z.length&&F>0){let U=Z[O];if(U==="{")F++;else if(U==="}")F--;O++}if(F===0){let U=Z.slice(R,O-1).trim(),L=O,B=(Z.slice(0,W).match(/\n/g)||[]).length+1;if(Y.push({description:_,body:U,start:W,end:L,line:B}),!Q)try{Function(U)()}catch(I){let w=_||`test at line ${B}`;J.push(`Test failed: ${w} (line ${B})
37
+ ${I.message||I}`)}let N=(Z.slice(W,L).match(/\n/g)||[]).length;X+=`
38
+ `.repeat(N),H=L;continue}}}X+=Z[H],H++}return{source:X,tests:Y,errors:J}}function z9(Z,Q){let Y=new Set,J=/\bclass\s+(\w+)(\s+extends\s+\w+)?\s*\{/g,X,H=[];while((X=J.exec(Z))!==null){let W=X[1],z=X[2]?.trim()||"",_=X.index+X[0].length-1,q=l0(Z,_),R=Z.slice(_,q);H.push({className:W,extendsClause:z,bodyStart:_,bodyEnd:q,body:R})}let K=Z;for(let W=H.length-1;W>=0;W--){let{className:z,extendsClause:_,bodyStart:q,bodyEnd:R,body:F}=H[W],O=/\bconstructor\s*\(/g,U,L=[];while((U=O.exec(F))!==null)L.push(U.index);if(L.length<2)continue;Y.add(z);let B=[];for(let T=0;T<L.length;T++){let E=L[T],P=F.indexOf("(",E),f=1,k=P+1;while(k<F.length&&f>0){if(F[k]==="(")f++;if(F[k]===")")f--;k++}let x=F.slice(P+1,k-1),n=k;while(n<F.length&&F[n]!=="{")n++;let w0=l0(F,n),v0=F.slice(n+1,w0-1);B.push({index:T+1,paramStr:x,bodyText:v0,fullStart:E,fullEnd:w0})}let j=F.slice(0,B[0].fullEnd),N=B[B.length-1].fullEnd;j+=F.slice(N);let I=F;for(let T=B.length-1;T>=1;T--){let E=B[T],P=E.fullStart;while(P>0&&I[P-1]===" ")P--;if(P>0&&I[P-1]===`
39
+ `)P--;I=I.slice(0,P)+I.slice(E.fullEnd)}let w="";for(let T=1;T<B.length;T++){let E=B[T],P=f1(E.paramStr,Q);if(E.paramStr.includes("...")){let k=u0(Z,q+E.fullStart);throw new Z0(`Rest parameters are not supported in polymorphic constructors for '${z}'.`,k)}w+=`
40
+ function ${z}$ctor$${E.index}(${E.paramStr}) {`,w+=`
41
+ const __obj = Object.create(${z}.prototype)`,w+=`
42
+ ;(function() {${E.bodyText}}).call(__obj)`,w+=`
43
+ return __obj`,w+=`
43
44
  }
44
- `}let E=[];for(let A=0;A<L.length;A++){let T=L[A],S=y1(T.paramStr,Q),h=[`a.length === ${S.length}`];for(let f=0;f<S.length;f++){let Z0=S[f];if(Z0.defaultValue){let e=J9(`a[${f}]`,Z0.defaultValue);if(e!=="true")h.push(e)}}if(A===0)E.push(` if (${h.join(" && ")}) return Reflect.construct(t, a)`);else{let f=S.map((Z0,e)=>`a[${e}]`).join(", ");E.push(` if (${h.join(" && ")}) return ${z}$ctor$${T.index}(${f})`)}}j+=`
45
+ `}let S=[];for(let T=0;T<B.length;T++){let E=B[T],P=f1(E.paramStr,Q),f=[`a.length === ${P.length}`];for(let k=0;k<P.length;k++){let x=P[k];if(x.defaultValue){let n=X9(`a[${k}]`,x.defaultValue);if(n!=="true")f.push(n)}}if(T===0)S.push(` if (${f.join(" && ")}) return Reflect.construct(t, a)`);else{let k=P.map((x,n)=>`a[${n}]`).join(", ");S.push(` if (${f.join(" && ")}) return ${z}$ctor$${E.index}(${k})`)}}w+=`
45
46
  function ${z}$dispatch(t, a) {
46
- `,j+=E.join(`
47
+ `,w+=S.join(`
47
48
  `)+`
48
- `,j+=` return __tjs.typeError('${z}', 'no matching constructor', a)
49
- `,j+=`}
50
- `,W=W.slice(0,q)+I+W.slice(R);let P=q+I.length;W=W.slice(0,P)+j+W.slice(P)}return{source:W,polyCtorClasses:Y}}function z9(Z,Q=new Set){let Y=/\bclass\s+(\w+)(\s+extends\s+\w+)?\s*\{/g,J="",X=0,K;while((K=Y.exec(Z))!==null){let W=K[1],H=K[2]||"",z=K.index,_=z+K[0].length-1,q=1,R=_+1;while(R<Z.length&&q>0){let F=Z[R];if(F==="{")q++;else if(F==="}")q--;R++}if(q===0){let F=R,O=Z.slice(_,F);if(J+=Z.slice(X,z),J+=`let ${W} = class ${W}${H} ${O}; `,Q.has(W))J+=`${W} = new Proxy(${W}, { apply(t, _, a) { return ${W}$dispatch(t, a) }, construct(t, a) { return ${W}$dispatch(t, a) } });`;else J+=`${W} = new Proxy(${W}, { apply(t, _, a) { return Reflect.construct(t, a) } });`;X=F}}return J+=Z.slice(X),J}function G9(Z){let Q=[{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 Q)if(Y.test(Z))throw Error(J);return Z}function _9(Z){let Q=new Set,Y=/\bconst!\s+(\w+)\b/g,J;while((J=Y.exec(Z))!==null)Q.add(J[1]);if(Q.size===0)return Z;Z=Z.replace(/\bconst!\s+/g,"const ");let X=Z.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\n]*/g,"");for(let K of Q){if(new RegExp(`\\b${K}\\s*(?:\\.[\\w]+|\\[[^\\]]+\\])\\s*(?:=(?!=)|\\+\\+|--|\\+=|-=|\\*=|\\/=|%=|&&=|\\|\\|=|\\?\\?=|<<=|>>=|>>>=|\\^=|&=|\\|=)`,"g").test(X))throw Error(`Cannot mutate immutable binding '${K}'. const! bindings are read-only at compile time.`);if(new RegExp(`(?:\\+\\+|--)\\s*${K}\\s*(?:\\.[\\w]+|\\[[^\\]]+\\])`,"g").test(X))throw Error(`Cannot mutate immutable binding '${K}'. const! bindings are read-only at compile time.`);if(new RegExp(`\\bdelete\\s+${K}\\s*(?:\\.[\\w]+|\\[[^\\]]+\\])`,"g").test(X))throw Error(`Cannot mutate immutable binding '${K}'. const! bindings are read-only at compile time.`);if(new RegExp(`\\b${K}\\s*\\.\\s*(?:${"push|pop|splice|shift|unshift|sort|reverse|fill|copyWithin|set"})\\s*\\(`,"g").test(X))throw Error(`Cannot call mutating method on immutable binding '${K}'. const! bindings are read-only at compile time.`)}return Z}function q9(Z){if(/(?<![a-zA-Z_$])\bvar\s+/.test(Z))throw Error("var is not allowed in TjsNoVar mode. Use const or let instead.");return Z}function F9(Z){if(/(?<![A-Za-z_$])\beval\s*\(/.test(Z))throw Error("eval() is not allowed in TjsNoeval mode. Use Eval() from TJS runtime for safe evaluation.");if(/\bnew\s+Function\s*\(/.test(Z))throw Error("new Function() is not allowed in TjsNoeval mode. Use SafeFunction() from TJS runtime.");return Z}function E6(Z,Q={}){let Y=Z,J,X=new Set,K=new Set,W=new Set,H={tjsEquals:!1,tjsClass:!1,tjsDate:!1,tjsNoeval:!1,tjsStandard:!1,tjsSafeEval:!1,tjsNoVar:!1},z=Z.match(/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*safety\s+(none|inputs|all)\b/);if(z)J=z[2],Z=Z.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|TjsNoVar|TjsStandard|TjsSafeEval)\b/,q;while(q=Z.match(_)){let I=q[2];if(I==="TjsStrict")H.tjsEquals=!0,H.tjsClass=!0,H.tjsDate=!0,H.tjsNoeval=!0,H.tjsNoVar=!0,H.tjsStandard=!0;else if(I==="TjsEquals")H.tjsEquals=!0;else if(I==="TjsClass")H.tjsClass=!0;else if(I==="TjsDate")H.tjsDate=!0;else if(I==="TjsNoeval")H.tjsNoeval=!0;else if(I==="TjsNoVar")H.tjsNoVar=!0;else if(I==="TjsStandard")H.tjsStandard=!0;else if(I==="TjsSafeEval")H.tjsSafeEval=!0;Z=Z.replace(new RegExp(`^(\\s*(?:\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/\\s*)*)\\s*${I}\\s*`),"$1")}if(H.tjsStandard)Z=o8(Z);if(Z=_9(Z),Z=c8(Z),H.tjsEquals&&!Q.vmTarget)Z=a8(Z);Z=s8(Z),Z=t8(Z),Z=r8(Z),Z=e8(Z),Z=Z9(Z),Z=W9(Z);let{source:R,returnType:F,returnSafety:O}=G1(Z,{originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W});Z=R;let U=Q9(Z);Z=U.source,Z=i8(Z);let N=X9(Z,X);Z=N.source;let L=n8(Z);Z=L.source;let B=K9(Z,Q.dangerouslySkipTests);Z=B.source;let w=H9(Z,X);Z=w.source;for(let I of w.polyCtorClasses)K.add(`${I}$dispatch`);if(H.tjsClass)Z=z9(Z,w.polyCtorClasses);if(H.tjsDate)Z=G9(Z);if(H.tjsNoeval)Z=F9(Z);if(H.tjsNoVar)Z=q9(Z);return Z=Y9(Z,U.extensions),{source:Z,returnType:F,returnSafety:O,moduleSafety:J,tjsModes:H,originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W,wasmBlocks:L.blocks,tests:B.tests,testErrors:B.errors,polymorphicNames:N.polymorphicNames,extensions:U.extensions}}function $9(Z,Q={}){let{filename:Y="<source>",colonShorthand:J=!0,vmTarget:X=!1}=Q,{source:K,returnType:W,returnSafety:H,moduleSafety:z,originalSource:_,requiredParams:q,unsafeFunctions:R,safeFunctions:F,wasmBlocks:O,tests:U,testErrors:N}=J?E6(Z,{vmTarget:X}):{source:Z,returnType:void 0,returnSafety:void 0,moduleSafety:void 0,originalSource:Z,requiredParams:new Set,unsafeFunctions:new Set,safeFunctions:new Set,wasmBlocks:[],tests:[],testErrors:[]};try{return{ast:f8(K,{ecmaVersion:2022,sourceType:"module",locations:!0,allowReturnOutsideFunction:!1}),returnType:W,returnSafety:H,moduleSafety:z,originalSource:_,requiredParams:q,unsafeFunctions:R,safeFunctions:F,wasmBlocks:O,tests:U,testErrors:N}}catch(L){let B=L.loc||{line:1,column:0};throw new t(L.message.replace(/\s*\(\d+:\d+\)$/,""),B,_,Y)}}function R9(Z,Q){for(let J of Z.body){if(J.type==="ImportDeclaration")throw new t("Imports are not supported. All atoms must be registered with the VM.",J.loc?.start||{line:1,column:0},void 0,Q);if(J.type==="ExportNamedDeclaration"||J.type==="ExportDefaultDeclaration")throw new t("Exports are not supported. The function is automatically exported.",J.loc?.start||{line:1,column:0},void 0,Q);if(J.type==="ClassDeclaration")throw new t("Classes are not supported. Agent99 uses functional composition.",J.loc?.start||{line:1,column:0},void 0,Q)}let Y=Z.body.filter((J)=>J.type==="FunctionDeclaration");if(Y.length===0)throw new t("Source must contain a function declaration",{line:1,column:0},void 0,Q);if(Y.length>1){let J=Y[1];throw new t("Only a single function per agent is allowed",J.loc?.start||{line:1,column:0},void 0,Q)}return Y[0]}function O9(Z,Q){let Y={params:{}};if(!Q.loc)return Y;let J=Z.substring(0,Q.start),X=[...J.matchAll(/\/\*#([\s\S]*?)\*\//g)];if(X.length>0){let q=X[X.length-1],R=J.substring(q.index+q[0].length);if(/^(?:\s|\/\/[^\n]*)*$/.test(R)){let F=q[1],O=F.split(`
51
- `),U=O.filter((N)=>N.trim().length>0).reduce((N,L)=>{let B=L.match(/^(\s*)/)?.[1].length||0;return Math.min(N,B)},1/0);if(U>0&&U<1/0)F=O.map((N)=>N.slice(U)).join(`
52
- `);return Y.description=F.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 z=/@param\s+(?:\{[^}]+\}\s+)?(\w+)\s*-?\s*(.*)/g,_;while((_=z.exec(W))!==null)Y.params[_[1]]=_[2].trim();return Y}function z0(Z){switch(Z.type){case"Literal":{let Q=Z.value;if(Q===null)return{kind:"null"};if(typeof Q==="string")return{kind:"string"};if(typeof Q==="number"){let Y=Z.raw;if(Y&&Y.includes("."))return{kind:"number"};return{kind:"integer"}}if(typeof Q==="boolean")return{kind:"boolean"};return{kind:"any"}}case"ArrayExpression":{let Q=Z.elements;if(Q.length===0)return{kind:"array",items:{kind:"any"}};let Y=Q.filter((W)=>W!=null).map((W)=>z0(W));if(Y.length===0)return{kind:"array",items:{kind:"any"}};let J=new Map;for(let W of Y){let H=JSON.stringify(W);if(!J.has(H))J.set(H,W)}let X=[...J.values()];return{kind:"array",items:X.length===1?X[0]:{kind:"union",members:X}}}case"ObjectExpression":{let Q=Z.properties,Y={};for(let J of Q)if(J.type==="Property"&&J.key.type==="Identifier"){let X=J.key.name;Y[X]=z0(J.value)}return{kind:"object",shape:Y}}case"LogicalExpression":{let{operator:Q,left:Y,right:J}=Z;if(Q==="||")return z0(Y);if(Q==="&&")return z0(J);if(Q==="??")return z0(J);return{kind:"any"}}case"BinaryExpression":{let{operator:Q,left:Y,right:J}=Z;if(Q==="|"){let X=z0(Y),K=z0(J);if(K.kind==="null")return{...X,nullable:!0};if(X.kind==="null")return{...K,nullable:!0};return{kind:"union",members:[X,K]}}return{kind:"any"}}case"Identifier":{if(Z.name==="undefined")return{kind:"undefined"};return{kind:"any"}}case"UnaryExpression":{let{operator:Q,argument:Y}=Z;if(Q==="+"&&Y.type==="Literal"){if(typeof Y.value==="number")return{kind:"non-negative-integer"}}if(Q==="-"&&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 f1(Z,Q){if(Z.type==="Identifier")return{name:Z.name,type:{kind:"any"},required:!0};if(Z.type==="AssignmentPattern"){let{left:Y,right:J}=Z;if(Y.type!=="Identifier")throw new u("Only simple parameter names are supported",l(Z));let X=Y.name,K=Q?.has(X)??!1,W=z0(J),H=F0(J);return{name:X,type:W,required:K,default:K?null:H,example:H,loc:{start:Z.start,end:Z.end}}}if(Z.type==="ObjectPattern"){let Y=Z.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=f1(K.value,Q),z=Q?.has(W)??!1;J[W]=H.type,X[W]={name:W,type:H.type,required:z,default:z?null:H.example,example:H.example}}}return{name:"__destructured__",type:{kind:"object",shape:J,destructuredParams:X},required:!0}}throw new u(`Unsupported parameter pattern: ${Z.type}`,l(Z))}function F0(Z){switch(Z.type){case"Literal":return Z.value;case"ArrayExpression":return Z.elements.map((Q)=>Q?F0(Q):null);case"ObjectExpression":{let Q={};for(let Y of Z.properties)if(Y.type==="Property"&&Y.key.type==="Identifier")Q[Y.key.name]=F0(Y.value);return Q}case"UnaryExpression":if(Z.operator==="-"){let Q=F0(Z.argument);return typeof Q==="number"?-Q:void 0}if(Z.operator==="+"){let Q=F0(Z.argument);return typeof Q==="number"?+Q:void 0}return;case"BinaryExpression":{let{operator:Q,left:Y}=Z;if(Q==="|")return F0(Y);return}case"LogicalExpression":{let{operator:Q,left:Y,right:J}=Z;if(Q==="&&"){if(Y.type==="Literal"&&Y.value===null)return null}if(Q==="||")return F0(Y)??F0(J);if(Q==="??")return F0(Y)??F0(J);return}default:return}}function U9(Z){try{let Q=h8(Z,0,{ecmaVersion:2022});return z0(Q)}catch{return{kind:"any"}}}function F1(Z){switch(Z.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:Z.items?F1(Z.items):{}};case"object":if(Z.shape){let Q={};for(let[Y,J]of Object.entries(Z.shape))Q[Y]=F1(J);return{type:"object",properties:Q,additionalProperties:!1}}return{type:"object"};case"union":if(Z.members)return{oneOf:Z.members.map(F1)};return{};default:return{}}}function v6(Z){let Q={},Y=[];for(let[J,X]of Object.entries(Z))if(Q[J]=F1(X.type),X.required)Y.push(J);return{type:"object",properties:Q,required:Y.length>0?Y:void 0,additionalProperties:!1}}function M9(Z,Q,Y,J={},X){let K=O9(Q,Z),W=new Map;for(let L of Z.params){let B=f1(L,X);if(B.name==="__destructured__"&&B.type.kind==="object"&&B.type.destructuredParams)for(let[w,I]of Object.entries(B.type.destructuredParams))W.set(w,{...I,description:K.params[w]});else B.description=K.params[B.name],W.set(B.name,B)}let H;if(Y)H=U9(Y);let z={depth:0,locals:new Map,parameters:W,atoms:new Set(Object.keys(J.atoms||{})),warnings:[],source:Q,filename:J.filename||"<source>",options:J},_=$0(Z.body,z),q=[],R=[],F=[];for(let[L,B]of W.entries())if(B.required)R.push(L);else if(B.default!==void 0)F.push({name:L,defaultValue:B.default});else R.push(L);if(R.length>0)q.push({op:"varsImport",keys:R});for(let{name:L,defaultValue:B}of F)q.push({op:"varsImport",keys:[L]}),q.push({op:"if",condition:{$expr:"binary",op:"==",left:{$expr:"ident",name:L},right:{$expr:"literal",value:null}},then:[{op:"varSet",key:L,value:B}]});q.push(..._);let O=Object.fromEntries(W),U={name:Z.id?.name||"anonymous",description:K.description,parameters:O,returns:H},N=v6(O);return{ast:{op:"seq",steps:q,inputSchema:N},signature:U,warnings:z.warnings}}function $0(Z,Q){let Y=[];for(let J of Z.body){let X=l0(J,Q);if(X)if(Array.isArray(X))Y.push(...X);else Y.push(X)}return Y}function l0(Z,Q){switch(Z.type){case"VariableDeclaration":return k6(Z,Q);case"ExpressionStatement":return g6(Z,Q);case"IfStatement":return f6(Z,Q);case"WhileStatement":return h6(Z,Q);case"ForOfStatement":return x6(Z,Q);case"TryStatement":return m6(Z,Q);case"ReturnStatement":return u6(Z,Q);case"ThrowStatement":throw new u("'throw' is not supported in AsyncJS. Use Error('message') to trigger error flow",l(Z),Q.source,Q.filename);case"BlockStatement":return{op:"scope",steps:$0(Z,K0(Q))};case"EmptyStatement":return null;default:throw new u(`Unsupported statement type: ${Z.type}`,l(Z),Q.source,Q.filename)}}function k6(Z,Q){let Y=[],J=Z.kind==="const",X=J?"constSet":"varSet";for(let K of Z.declarations){if(K.id.type!=="Identifier")throw new u("Only simple variable names are supported",l(K),Q.source,Q.filename);let W=K.id.name;if(K.init){let{step:H,resultVar:z}=V0(K.init,Q,W,J);if(H)Y.push(H);else if(z!==W)Y.push({op:X,key:W,value:z});let _=z0(K.init);Q.locals.set(W,_)}else{if(J)throw new u("const declarations must be initialized",l(K),Q.source,Q.filename);Y.push({op:"varSet",key:W,value:null}),Q.locals.set(W,{kind:"any",nullable:!0})}}return Y}function g6(Z,Q){let Y=Z.expression;if(Y.type==="AssignmentExpression")return y6(Y,Q);if(Y.type==="CallExpression"){let{step:J,resultVar:X}=V0(Y,Q);if(J)return J;if(X)return{op:"varSet",key:"_",value:X};return null}return Q.warnings.push({message:"Expression statement has no effect",line:l(Z).line,column:l(Z).column}),null}function y6(Z,Q){if(Z.left.type!=="Identifier")throw new u("Only simple variable assignment is supported",l(Z),Q.source,Q.filename);let Y=Z.left.name,{step:J,resultVar:X}=V0(Z.right,Q,Y);if(J)return J;return{op:"varSet",key:Y,value:X}}function f6(Z,Q){let Y=x(Z.test,Q),J=Z.consequent.type==="BlockStatement"?$0(Z.consequent,K0(Q)):[l0(Z.consequent,Q)].filter(Boolean),X;if(Z.alternate)X=Z.alternate.type==="BlockStatement"?$0(Z.alternate,K0(Q)):[l0(Z.alternate,Q)].filter(Boolean);return{op:"if",condition:Y,then:J,...X&&{else:X}}}function h6(Z,Q){let Y=x(Z.test,Q),J=Z.body.type==="BlockStatement"?$0(Z.body,K0(Q)):[l0(Z.body,Q)].filter(Boolean);return{op:"while",condition:Y,body:J}}function x6(Z,Q){let Y;if(Z.left.type==="VariableDeclaration"){let W=Z.left.declarations[0];if(W.id.type!=="Identifier")throw new u("Only simple variable names are supported in for...of",l(Z.left),Q.source,Q.filename);Y=W.id.name}else if(Z.left.type==="Identifier")Y=Z.left.name;else throw new u("Unsupported for...of left-hand side",l(Z.left),Q.source,Q.filename);let J=i(Z.right,Q),X=K0(Q);X.locals.set(Y,{kind:"any"});let K=Z.body.type==="BlockStatement"?$0(Z.body,X):[l0(Z.body,X)].filter(Boolean);return{op:"map",items:J,as:Y,steps:K}}function m6(Z,Q){let Y=$0(Z.block,K0(Q)),J,X;if(Z.handler){let K=K0(Q);if(Z.handler.param?.type==="Identifier")X=Z.handler.param.name,K.locals.set(X,{kind:"any"});J=$0(Z.handler.body,K)}return{op:"try",try:Y,...J&&{catch:J},...X&&{catchParam:X}}}function u6(Z,Q){if(!Z.argument)return{op:"return",value:{}};let{step:Y,resultVar:J}=V0(Z.argument,Q,"__returnVal__");if(Y)return[Y,{op:"return",value:J}];return{op:"return",value:i(Z.argument,Q)}}var B9=new Set(["Math","JSON","Array","Object","String","Number","console","Date","Schema"]),l6=new Set(["parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","Set","Date","filter"]),d0=new Set(["RegExp","Promise","Map","WeakSet","WeakMap","Symbol","Proxy","Reflect","Function","eval","setTimeout","setInterval","fetch","require","import","process","window","document","global","globalThis"]),d6=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 p6(Z){if(Z.callee.type==="Identifier"){let Q=Z.callee.name;return l6.has(Q)||d0.has(Q)}if(Z.callee.type==="MemberExpression"){let Q=Z.callee;if(Q.object.type==="Identifier"){let Y=Q.object.name;if(B9.has(Y)||d0.has(Y))return!0}if(Q.property.type==="Identifier"){let Y=Q.property.name;if(d6.has(Y))return!0}}return!1}function i6(Z){if(Z.object.type==="Identifier"){let Q=Z.object.name;return B9.has(Q)||d0.has(Q)}return!1}var I9={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 n6(Z){if(Z.callee.type==="Identifier"){let Q=Z.callee.name;if(d0.has(Q))return I9[Q]||`${Q} is not available in AsyncJS.`}if(Z.callee.type==="MemberExpression"){let Q=Z.callee;if(Q.object.type==="Identifier"){let Y=Q.object.name;if(d0.has(Y))return I9[Y]||`${Y} is not available in AsyncJS.`}}return null}function L9(Z){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."}[Z]||" Use factory functions or object literals instead."}function V0(Z,Q,Y,J){let X=J?"constSet":"varSet";if(Z.type==="ChainExpression")return V0(Z.expression,Q,Y,J);if(Z.type==="NewExpression"){let W=Z,H="constructor";if(W.callee.type==="Identifier")H=W.callee.name;let z=L9(H);throw new u(`The 'new' keyword is not supported in AsyncJS.${z}`,l(Z),Q.source,Q.filename)}if(Z.type==="CallExpression"){let W=n6(Z);if(W)throw new u(W,l(Z),Q.source,Q.filename)}if(Z.type==="CallExpression"&&p6(Z)){let W=x(Z,Q);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}if(Z.type==="MemberExpression"&&i6(Z)){let W=x(Z,Q);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}if(Z.type==="CallExpression")return c6(Z,Q,Y,J);if(Z.type==="TemplateLiteral")return a6(Z,Q,Y,J);if(Z.type==="BinaryExpression"||Z.type==="LogicalExpression"||Z.type==="UnaryExpression"){let W=x(Z,Q);if(Y)return{step:{op:X,key:Y,value:W},resultVar:Y};return{step:null,resultVar:W}}return{step:null,resultVar:i(Z,Q)}}function c6(Z,Q,Y,J){let X,K=!1,W;if(Z.callee.type==="Identifier")X=Z.callee.name;else if(Z.callee.type==="MemberExpression"){let z=Z.callee;if(z.property.type==="Identifier")X=z.property.name,K=!0,W=i(z.object,Q);else throw new u("Computed method names are not supported",l(Z),Q.source,Q.filename)}else throw new u("Only named function calls are supported",l(Z),Q.source,Q.filename);if(K)return o6(X,W,Z.arguments,Q,Y,J);if(X==="console"&&Z.callee.type==="MemberExpression");let H=s6(Z,Q);return{step:{op:X,...H,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function o6(Z,Q,Y,J,X,K){switch(Z){case"map":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let W=Y[0],H=W.params[0],z=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(z,{kind:"any"});let q;if(W.body.type==="BlockStatement")q=$0(W.body,_);else{let{step:R,resultVar:F}=V0(W.body,_,"result");q=R?[R]:[{op:"varSet",key:"result",value:F}]}return{step:{op:"map",items:Q,as:z,steps:q,...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],z=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(z,{kind:"any"});let q;if(W.body.type==="BlockStatement")throw new u("filter callback must be an expression, not a block",l(Y[0]),J.source,J.filename);else q=x(W.body,_);return{step:{op:"filter",items:Q,as:z,condition:q,...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],z=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(z,{kind:"any"});let q;if(W.body.type==="BlockStatement")throw new u("find callback must be an expression, not a block",l(Y[0]),J.source,J.filename);else q=x(W.body,_);return{step:{op:"find",items:Q,as:z,condition:q,...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],z=W.params[1],_=H?.type==="Identifier"?H.name:"acc",q=z?.type==="Identifier"?z.name:"item",R=K0(J);R.locals.set(_,{kind:"any"}),R.locals.set(q,{kind:"any"});let F;if(W.body.type==="BlockStatement")F=$0(W.body,R);else{let{step:U,resultVar:N}=V0(W.body,R,"result");F=U?[U]:[{op:"varSet",key:"result",value:N}]}let O=i(Y[1],J);return{step:{op:"reduce",items:Q,as:q,accumulator:_,initial:O,steps:F,...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}break;case"slice":break;case"push":return{step:{op:"push",list:Q,item:i(Y[0],J),...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X};case"join":return{step:{op:"join",list:Q,sep:Y.length>0?i(Y[0],J):"",...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X};case"split":return{step:{op:"split",str:Q,sep:Y.length>0?i(Y[0],J):"",...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}return J.warnings.push({message:`Unknown method '${Z}' - treating as atom call`,line:0,column:0}),{step:{op:Z,receiver:Q,args:Y.map((W)=>i(W,J)),...X&&{result:X},...X&&K&&{resultConst:!0}},resultVar:X}}function a6(Z,Q,Y,J){let X="",K={};for(let W=0;W<Z.quasis.length;W++)if(X+=Z.quasis[W].value.cooked||Z.quasis[W].value.raw,W<Z.expressions.length){let H=Z.expressions[W],z=`_${W}`;K[z]=i(H,Q),X+=`{{${z}}}`}return{step:{op:"template",tmpl:X,vars:K,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function x(Z,Q){switch(Z.type){case"Literal":return{$expr:"literal",value:Z.value};case"Identifier":return{$expr:"ident",name:Z.name};case"MemberExpression":{let Y=Z,J=x(Y.object,Q),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 u("Computed member access with variables not yet supported",l(Z),Q.source,Q.filename)}let K=Y.property.name;return{$expr:"member",object:J,property:K,...X&&{optional:!0}}}case"ChainExpression":return x(Z.expression,Q);case"BinaryExpression":{let Y=Z;return{$expr:"binary",op:Y.operator,left:x(Y.left,Q),right:x(Y.right,Q)}}case"LogicalExpression":{let Y=Z;return{$expr:"logical",op:Y.operator,left:x(Y.left,Q),right:x(Y.right,Q)}}case"UnaryExpression":{let Y=Z;return{$expr:"unary",op:Y.operator,argument:x(Y.argument,Q)}}case"ConditionalExpression":{let Y=Z;return{$expr:"conditional",test:x(Y.test,Q),consequent:x(Y.consequent,Q),alternate:x(Y.alternate,Q)}}case"ArrayExpression":return{$expr:"array",elements:Z.elements.filter((J)=>J!==null).map((J)=>x(J,Q))};case"ObjectExpression":{let Y=Z,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:x(X.value,Q)})}return{$expr:"object",properties:J}}case"CallExpression":{let Y=Z;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:x(J.object,Q),method:X,arguments:Y.arguments.map((W)=>x(W,Q)),...K&&{optional:!0}}}if(Y.callee.type==="Identifier")return{$expr:"call",callee:Y.callee.name,arguments:Y.arguments.map((X)=>x(X,Q))};throw new u("Complex function calls in expressions should be lifted to statements",l(Z),Q.source,Q.filename)}case"NewExpression":{let Y=Z,J="constructor";if(Y.callee.type==="Identifier")J=Y.callee.name;let X=L9(J);throw new u(`The 'new' keyword is not supported in AsyncJS.${X}`,l(Z),Q.source,Q.filename)}case"TemplateLiteral":throw new u("Template literals inside expressions are not supported. Assign to a variable first: const msg = `hello ${name}`; then use msg",l(Z),Q.source,Q.filename);default:throw new u(`Unsupported expression type in condition: ${Z.type}`,l(Z),Q.source,Q.filename)}}function i(Z,Q){switch(Z.type){case"Literal":return Z.value;case"Identifier":return Z.name;case"MemberExpression":{let Y=Z;if(Y.optional===!0)return x(Z,Q);let X=i(Y.object,Q);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}[${i(Y.property,Q)}]`;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 i(Z.expression,Q);case"ArrayExpression":return Z.elements.map((Y)=>Y?i(Y,Q):null);case"ObjectExpression":{let Y={};for(let J of Z.properties)if(J.type==="Property"){let X=J.key.type==="Identifier"?J.key.name:String(J.key.value);Y[X]=i(J.value,Q)}return Y}case"TemplateLiteral":return x(Z,Q);case"CallExpression":return x(Z,Q);case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"ConditionalExpression":return x(Z,Q);default:return null}}function s6(Z,Q){if(Z.arguments.length===1&&Z.arguments[0].type==="ObjectExpression"){let Y=Z.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]=i(X.value,Q)}return J}return{args:Z.arguments.map((Y)=>i(Y,Q))}}function N9(Z,Q={}){let{ast:Y,returnType:J,originalSource:X,requiredParams:K}=$9(Z,{filename:Q.filename,colonShorthand:!0,vmTarget:!0}),W=R9(Y,Q.filename),{ast:H,signature:z,warnings:_}=M9(W,X,J,Q,K);return{ast:H,signature:z,warnings:_}}var t6=10;class e6{atoms;constructor(Z={}){this.atoms={...n1,...Z}}get builder(){return new a(this.atoms)}get Agent(){return new a(this.atoms)}get A99(){return this.Agent}resolve(Z){return this.atoms[Z]}getTools(Z="all"){let Q=Object.values(this.atoms);if(Array.isArray(Z))Q=Q.filter((Y)=>Z.includes(Y.op));else if(Z==="flow"){let Y=["seq","if","while","return","try","varSet","varGet","scope"];Q=Q.filter((J)=>Y.includes(J.op))}return Q.map((Y)=>({type:"function",function:{name:Y.op,description:Y.docs,parameters:Y.inputSchema?.schema??{}}}))}async run(Z,Q={},Y={}){let J;if(typeof Z==="string")if(I1(Z))J=M1(Z);else try{J=N9(Z).ast}catch(O){throw Error(`AJS transpilation failed: ${O.message}`)}else J=Z;let X=Y.fuel??1000,K=Y.timeoutMs??X*t6,W=Y.capabilities??{},H=[];if(!W.store){let O=new Map,U=!1;W.store={get:async(N)=>{if(!U)U=!0,H.push("Using default in-memory store (not suitable for production)");return O.get(N)},set:async(N,L)=>{if(!U)U=!0,H.push("Using default in-memory store (not suitable for production)");O.set(N,L)}}}let z=new AbortController,_=setTimeout(()=>z.abort(),K);if(Y.signal)Y.signal.addEventListener("abort",()=>z.abort());let q={fuel:{current:X},args:Q,state:{},consts:new Set,capabilities:W,resolver:(O)=>this.resolve(O),output:void 0,signal:z.signal,costOverrides:Y.costOverrides,context:Y.context,warnings:H};if(Y.trace)q.trace=[];if(J.op!=="seq")throw Error("Root AST must be 'seq'. Ensure you're passing a transpiled agent (use ajs`...` or transpile()).");let R=J.inputSchema;if(R&&!r6(Q,R)){let O=new o("Input validation failed: args do not match expected schema","vm.run");return{result:O,error:O,fuelUsed:0,trace:q.trace,warnings:H.length>0?H:void 0}}try{await Promise.race([this.resolve("seq")?.exec(J,q),new Promise((O,U)=>{if(z.signal.addEventListener("abort",()=>{U(Error(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))}),z.signal.aborted)U(Error(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))})])}catch(O){if(O.message?.includes("timeout")||O.message?.includes("aborted")||z.signal.aborted)q.error=new o(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`,"vm.run");else throw O}finally{clearTimeout(_)}if(q.error&&q.output===void 0)q.output=q.error;let F=[...H,...q.warnings??[]];return{result:q.output,error:q.error,fuelUsed:X-q.fuel.current,trace:q.trace,warnings:F.length>0?F:void 0}}}import{s as v}from"tosijs-schema";var j9=C("storeVectorize",v.object({text:v.string,model:v.string.optional}),v.array(v.number),async({text:Z},Q)=>{let Y=Q.capabilities.vector;if(!Y)throw Error("Capability 'vector' missing. Ensure vector battery is loaded.");let J=M(Z,Q);return Y.embed(J)},{docs:"Generate embeddings using vector battery",cost:20}),w9=C("storeCreateCollection",v.object({collection:v.string,dimension:v.number.optional}),void 0,async({collection:Z,dimension:Q},Y)=>{let J=Y.capabilities.store;if(!J?.createCollection)throw Error("Capability 'store' missing or does not support createCollection.");let X=M(Z,Y),K=M(Q,Y);return J.createCollection(X,void 0,K)},{docs:"Create a vector store collection",cost:5}),A9=C("storeVectorAdd",v.object({collection:v.string,doc:v.any}),void 0,async({collection:Z,doc:Q},Y)=>{let J=Y.capabilities.store;if(!J?.vectorAdd)throw Error("Capability 'store' missing or does not support vectorAdd.");let X=M(Z,Y),K=M(Q,Y);return J.vectorAdd(X,K)},{docs:"Add a document to a vector store collection",cost:5}),V9=C("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:Z,queryVector:Q,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=M(Z,X),H=M(Q,X),z=M(Y,X)??5,_=M(J,X);return K.vectorSearch(W,H,z,_)},{docs:"Search vector store",cost:(Z,Q)=>5+(M(Z.k,Q)??5)}),D9=C("llmPredictBattery",v.object({system:v.string.optional,user:v.string,tools:v.array(v.any).optional,responseFormat:v.any.optional}),v.object({role:v.string.optional,content:v.string.optional,tool_calls:v.array(v.any).optional}),async({system:Z,user:Q,tools:Y,responseFormat:J},X)=>{let K=X.capabilities.llmBattery;if(!K?.predict)throw Error("Capability 'llmBattery' missing or invalid.");let W=M(Z,X)??"You are a helpful agent.",H=M(Q,X),z=M(Y,X),_=M(J,X);return K.predict(W,H,z,_)},{docs:"Generate completion using LLM battery",cost:100}),T9=C("llmVision",v.object({system:v.string.optional,prompt:v.string,images:v.array(v.string),responseFormat:v.any.optional}),v.object({role:v.string.optional,content:v.string.optional,tool_calls:v.array(v.any).optional}),async({system:Z,prompt:Q,images:Y,responseFormat:J},X)=>{let K=X.capabilities.llmBattery;if(!K?.predict)throw Error("Capability 'llmBattery' missing or invalid.");let W=M(Z,X)??"You analyze images accurately and concisely.",H=M(Q,X),z=M(Y,X)??[],_=M(J,X);return K.predict(W,{text:H,images:z},void 0,_)},{docs:"Analyze images using a vision model",timeoutMs:120000,cost:150});var E7={storeCreateCollection:w9,storeSearch:V9,storeVectorAdd:A9,storeVectorize:j9,llmPredictBattery:D9,llmVision:T9};export{wZ as xmlParse,m9 as whileLoop,UZ as vectorSearch,o9 as varsLet,c9 as varsImport,a9 as varsExport,p9 as varSet,n9 as varGet,TZ as uuid,l9 as tryCatch,BZ as transpileCode,WZ as template,RZ as storeSet,OZ as storeQuery,bZ as storeProcedure,$Z as storeGet,JZ as split,Q0 as seq,s9 as scope,LZ as runCode,u9 as ret,M as resolveValue,M1 as resolveProcedureToken,EZ as releaseProcedure,KZ as regexMatch,e9 as reduce,DZ as random,QZ as push,C0 as procedureStore,HZ as pick,zZ as omit,GZ as merge,AZ as memoize,r9 as map,IZ as llmPredict,YZ as len,_Z as keys,jZ as jsonStringify,NZ as jsonParse,XZ as join,I1 as isProcedureToken,P9 as isAgentError,x9 as iff,B1 as hash,ZZ as find,t9 as filter,FZ as fetch,d as evaluateExpr,d9 as errorAtom,C as defineAtom,B0 as createChildScope,n1 as coreAtoms,i9 as constSet,PZ as consoleWarn,CZ as consoleLog,SZ as consoleError,vZ as clearExpiredProcedures,VZ as cache,R0 as builtins,E7 as batteryAtoms,MZ as agentRun,U1 as PROCEDURE_TOKEN_PREFIX,S9 as DEFAULT_PROCEDURE_TTL,b9 as DEFAULT_MAX_AST_SIZE,e6 as AgentVM,o as AgentError};
49
+ `,w+=` return __tjs.typeError('${z}', 'no matching constructor', a)
50
+ `,w+=`}
51
+ `,K=K.slice(0,q)+I+K.slice(R);let A=q+I.length;K=K.slice(0,A)+w+K.slice(A)}return{source:K,polyCtorClasses:Y}}function G9(Z,Q=new Set){let Y=/\bclass\s+(\w+)(\s+extends\s+\w+)?\s*\{/g,J="",X=0,H;while((H=Y.exec(Z))!==null){let K=H[1],W=H[2]||"",z=H.index,_=z+H[0].length-1,q=1,R=_+1;while(R<Z.length&&q>0){let F=Z[R];if(F==="{")q++;else if(F==="}")q--;R++}if(q===0){let F=R,O=Z.slice(_,F);if(J+=Z.slice(X,z),J+=`let ${K} = class ${K}${W} ${O}; `,Q.has(K))J+=`${K} = new Proxy(${K}, { apply(t, _, a) { return ${K}$dispatch(t, a) }, construct(t, a) { return ${K}$dispatch(t, a) } });`;else J+=`${K} = new Proxy(${K}, { apply(t, _, a) { return Reflect.construct(t, a) } });`;X=F}}return J+=Z.slice(X),J}function _9(Z){let Q=[{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 Q)if(Y.test(Z))throw Error(J);return Z}function q9(Z){let Q=new Set,Y=/\bconst!\s+(\w+)\b/g,J;while((J=Y.exec(Z))!==null)Q.add(J[1]);if(Q.size===0)return Z;Z=Z.replace(/\bconst!\s+/g,"const ");let X=Z.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/[^\n]*/g,"");for(let H of Q){if(new RegExp(`\\b${H}\\s*(?:\\.[\\w]+|\\[[^\\]]+\\])\\s*(?:=(?!=)|\\+\\+|--|\\+=|-=|\\*=|\\/=|%=|&&=|\\|\\|=|\\?\\?=|<<=|>>=|>>>=|\\^=|&=|\\|=)`,"g").test(X))throw Error(`Cannot mutate immutable binding '${H}'. const! bindings are read-only at compile time.`);if(new RegExp(`(?:\\+\\+|--)\\s*${H}\\s*(?:\\.[\\w]+|\\[[^\\]]+\\])`,"g").test(X))throw Error(`Cannot mutate immutable binding '${H}'. const! bindings are read-only at compile time.`);if(new RegExp(`\\bdelete\\s+${H}\\s*(?:\\.[\\w]+|\\[[^\\]]+\\])`,"g").test(X))throw Error(`Cannot mutate immutable binding '${H}'. const! bindings are read-only at compile time.`);if(new RegExp(`\\b${H}\\s*\\.\\s*(?:${"push|pop|splice|shift|unshift|sort|reverse|fill|copyWithin|set"})\\s*\\(`,"g").test(X))throw Error(`Cannot call mutating method on immutable binding '${H}'. const! bindings are read-only at compile time.`)}return Z}function F9(Z){if(/(?<![a-zA-Z_$])\bvar\s+/.test(Z))throw Error("var is not allowed in TjsNoVar mode. Use const or let instead.");return Z}function $9(Z){if(/(?<![A-Za-z_$])\beval\s*\(/.test(Z))throw Error("eval() is not allowed in TjsNoeval mode. Use Eval() from TJS runtime for safe evaluation.");if(/\bnew\s+Function\s*\(/.test(Z))throw Error("new Function() is not allowed in TjsNoeval mode. Use SafeFunction() from TJS runtime.");return Z}function E6(Z,Q={}){let Y=Z,J,X=new Set,H=new Set,K=new Set,W={tjsEquals:!1,tjsClass:!1,tjsDate:!1,tjsNoeval:!1,tjsStandard:!1,tjsSafeEval:!1,tjsNoVar:!1},z=Z.match(/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*safety\s+(none|inputs|all)\b/);if(z)J=z[2],Z=Z.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|TjsNoVar|TjsStandard|TjsSafeEval)\b/,q;while(q=Z.match(_)){let I=q[2];if(I==="TjsStrict")W.tjsEquals=!0,W.tjsClass=!0,W.tjsDate=!0,W.tjsNoeval=!0,W.tjsNoVar=!0,W.tjsStandard=!0;else if(I==="TjsEquals")W.tjsEquals=!0;else if(I==="TjsClass")W.tjsClass=!0;else if(I==="TjsDate")W.tjsDate=!0;else if(I==="TjsNoeval")W.tjsNoeval=!0;else if(I==="TjsNoVar")W.tjsNoVar=!0;else if(I==="TjsStandard")W.tjsStandard=!0;else if(I==="TjsSafeEval")W.tjsSafeEval=!0;Z=Z.replace(new RegExp(`^(\\s*(?:\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/\\s*)*)\\s*${I}\\s*`),"$1")}if(W.tjsStandard)Z=a8(Z);if(Z=q9(Z),Z=o8(Z),W.tjsEquals&&!Q.vmTarget)Z=s8(Z);Z=r8(Z),Z=e8(Z),Z=t8(Z),Z=Z9(Z),Z=Q9(Z),Z=H9(Z);let{source:R,returnType:F,returnSafety:O}=_1(Z,{originalSource:Y,requiredParams:X,unsafeFunctions:H,safeFunctions:K});Z=R;let U=Y9(Z);Z=U.source,Z=n8(Z);let L=K9(Z,X);Z=L.source;let B=c8(Z);Z=B.source;let j=W9(Z,Q.dangerouslySkipTests);Z=j.source;let N=z9(Z,X);Z=N.source;for(let I of N.polyCtorClasses)H.add(`${I}$dispatch`);if(W.tjsClass)Z=G9(Z,N.polyCtorClasses);if(W.tjsDate)Z=_9(Z);if(W.tjsNoeval)Z=$9(Z);if(W.tjsNoVar)Z=F9(Z);return Z=J9(Z,U.extensions),{source:Z,returnType:F,returnSafety:O,moduleSafety:J,tjsModes:W,originalSource:Y,requiredParams:X,unsafeFunctions:H,safeFunctions:K,wasmBlocks:B.blocks,tests:j.tests,testErrors:j.errors,polymorphicNames:L.polymorphicNames,extensions:U.extensions}}function R9(Z,Q={}){let{filename:Y="<source>",colonShorthand:J=!0,vmTarget:X=!1}=Q,{source:H,returnType:K,returnSafety:W,moduleSafety:z,originalSource:_,requiredParams:q,unsafeFunctions:R,safeFunctions:F,wasmBlocks:O,tests:U,testErrors:L}=J?E6(Z,{vmTarget:X}):{source:Z,returnType:void 0,returnSafety:void 0,moduleSafety:void 0,originalSource:Z,requiredParams:new Set,unsafeFunctions:new Set,safeFunctions:new Set,wasmBlocks:[],tests:[],testErrors:[]};try{return{ast:h8(H,{ecmaVersion:2022,sourceType:"module",locations:!0,allowReturnOutsideFunction:!1}),returnType:K,returnSafety:W,moduleSafety:z,originalSource:_,requiredParams:q,unsafeFunctions:R,safeFunctions:F,wasmBlocks:O,tests:U,testErrors:L}}catch(B){let j=B.loc||{line:1,column:0};throw new Z0(B.message.replace(/\s*\(\d+:\d+\)$/,""),j,_,Y)}}function O9(Z,Q){for(let J of Z.body){if(J.type==="ImportDeclaration")throw new Z0("Imports are not supported. All atoms must be registered with the VM.",J.loc?.start||{line:1,column:0},void 0,Q);if(J.type==="ExportNamedDeclaration"||J.type==="ExportDefaultDeclaration")throw new Z0("Exports are not supported. The function is automatically exported.",J.loc?.start||{line:1,column:0},void 0,Q);if(J.type==="ClassDeclaration")throw new Z0("Classes are not supported. Agent99 uses functional composition.",J.loc?.start||{line:1,column:0},void 0,Q)}let Y=Z.body.filter((J)=>J.type==="FunctionDeclaration");if(Y.length===0)throw new Z0("Source must contain a function declaration",{line:1,column:0},void 0,Q);if(Y.length>1){let J=Y[1];throw new Z0("Only a single function per agent is allowed",J.loc?.start||{line:1,column:0},void 0,Q)}return Y[0]}function U9(Z,Q){let Y={params:{}};if(!Q.loc)return Y;let J=Z.substring(0,Q.start),X=[...J.matchAll(/\/\*#([\s\S]*?)\*\//g)];if(X.length>0){let q=X[X.length-1],R=J.substring(q.index+q[0].length);if(/^(?:\s|\/\/[^\n]*)*$/.test(R)){let F=q[1],O=F.split(`
52
+ `),U=O.filter((L)=>L.trim().length>0).reduce((L,B)=>{let j=B.match(/^(\s*)/)?.[1].length||0;return Math.min(L,j)},1/0);if(U>0&&U<1/0)F=O.map((L)=>L.slice(U)).join(`
53
+ `);return Y.description=F.trim(),Y}}let H=J.match(/\/\*\*[\s\S]*?\*\/\s*$/);if(!H)return Y;let K=H[0],W=K.match(/\/\*\*\s*\n?\s*\*?\s*([^@\n][^\n]*)/m);if(W)Y.description=W[1].trim();let z=/@param\s+(?:\{[^}]+\}\s+)?(\w+)\s*-?\s*(.*)/g,_;while((_=z.exec(K))!==null)Y.params[_[1]]=_[2].trim();return Y}function z0(Z){switch(Z.type){case"Literal":{let Q=Z.value;if(Q===null)return{kind:"null"};if(typeof Q==="string")return{kind:"string"};if(typeof Q==="number"){let Y=Z.raw;if(Y&&Y.includes("."))return{kind:"number"};return{kind:"integer"}}if(typeof Q==="boolean")return{kind:"boolean"};return{kind:"any"}}case"ArrayExpression":{let Q=Z.elements;if(Q.length===0)return{kind:"array",items:{kind:"any"}};let Y=Q.filter((K)=>K!=null).map((K)=>z0(K));if(Y.length===0)return{kind:"array",items:{kind:"any"}};let J=new Map;for(let K of Y){let W=JSON.stringify(K);if(!J.has(W))J.set(W,K)}let X=[...J.values()];return{kind:"array",items:X.length===1?X[0]:{kind:"union",members:X}}}case"ObjectExpression":{let Q=Z.properties,Y={};for(let J of Q)if(J.type==="Property"&&J.key.type==="Identifier"){let X=J.key.name;Y[X]=z0(J.value)}return{kind:"object",shape:Y}}case"LogicalExpression":{let{operator:Q,left:Y,right:J}=Z;if(Q==="||")return z0(Y);if(Q==="&&")return z0(J);if(Q==="??")return z0(J);return{kind:"any"}}case"BinaryExpression":{let{operator:Q,left:Y,right:J}=Z;if(Q==="|"){let X=z0(Y),H=z0(J);if(H.kind==="null")return{...X,nullable:!0};if(X.kind==="null")return{...H,nullable:!0};return{kind:"union",members:[X,H]}}return{kind:"any"}}case"Identifier":{if(Z.name==="undefined")return{kind:"undefined"};return{kind:"any"}}case"UnaryExpression":{let{operator:Q,argument:Y}=Z;if(Q==="+"&&Y.type==="Literal"){if(typeof Y.value==="number")return{kind:"non-negative-integer"}}if(Q==="-"&&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 h1(Z,Q){if(Z.type==="Identifier")return{name:Z.name,type:{kind:"any"},required:!0};if(Z.type==="AssignmentPattern"){let{left:Y,right:J}=Z;if(Y.type!=="Identifier")throw new l("Only simple parameter names are supported",d(Z));let X=Y.name,H=Q?.has(X)??!1,K=z0(J),W=F0(J);return{name:X,type:K,required:H,default:H?null:W,example:W,loc:{start:Z.start,end:Z.end}}}if(Z.type==="ObjectPattern"){let Y=Z.properties,J={},X={};for(let H of Y)if(H.type==="Property"){let K=H.key.type==="Identifier"?H.key.name:String(H.key.value);if(H.value.type==="Identifier")J[K]={kind:"any"},X[K]={name:K,type:{kind:"any"},required:!0};else if(H.value.type==="AssignmentPattern"){let W=h1(H.value,Q),z=Q?.has(K)??!1;J[K]=W.type,X[K]={name:K,type:W.type,required:z,default:z?null:W.example,example:W.example}}}return{name:"__destructured__",type:{kind:"object",shape:J,destructuredParams:X},required:!0}}throw new l(`Unsupported parameter pattern: ${Z.type}`,d(Z))}function F0(Z){switch(Z.type){case"Literal":return Z.value;case"ArrayExpression":return Z.elements.map((Q)=>Q?F0(Q):null);case"ObjectExpression":{let Q={};for(let Y of Z.properties)if(Y.type==="Property"&&Y.key.type==="Identifier")Q[Y.key.name]=F0(Y.value);return Q}case"UnaryExpression":if(Z.operator==="-"){let Q=F0(Z.argument);return typeof Q==="number"?-Q:void 0}if(Z.operator==="+"){let Q=F0(Z.argument);return typeof Q==="number"?+Q:void 0}return;case"BinaryExpression":{let{operator:Q,left:Y}=Z;if(Q==="|")return F0(Y);return}case"LogicalExpression":{let{operator:Q,left:Y,right:J}=Z;if(Q==="&&"){if(Y.type==="Literal"&&Y.value===null)return null}if(Q==="||")return F0(Y)??F0(J);if(Q==="??")return F0(Y)??F0(J);return}default:return}}function I9(Z){try{let Q=x8(Z,0,{ecmaVersion:2022});return z0(Q)}catch{return{kind:"any"}}}function $1(Z){switch(Z.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:Z.items?$1(Z.items):{}};case"object":if(Z.shape){let Q={};for(let[Y,J]of Object.entries(Z.shape))Q[Y]=$1(J);return{type:"object",properties:Q,additionalProperties:!1}}return{type:"object"};case"union":if(Z.members)return{oneOf:Z.members.map($1)};return{};default:return{}}}function v6(Z){let Q={},Y=[];for(let[J,X]of Object.entries(Z))if(Q[J]=$1(X.type),X.required)Y.push(J);return{type:"object",properties:Q,required:Y.length>0?Y:void 0,additionalProperties:!1}}function B9(Z,Q,Y,J={},X){let H=U9(Q,Z),K=new Map;for(let B of Z.params){let j=h1(B,X);if(j.name==="__destructured__"&&j.type.kind==="object"&&j.type.destructuredParams)for(let[N,I]of Object.entries(j.type.destructuredParams))K.set(N,{...I,description:H.params[N]});else j.description=H.params[j.name],K.set(j.name,j)}let W;if(Y)W=I9(Y);let z={depth:0,locals:new Map,parameters:K,atoms:new Set(Object.keys(J.atoms||{})),warnings:[],source:Q,filename:J.filename||"<source>",options:J},_=$0(Z.body,z),q=[],R=[],F=[];for(let[B,j]of K.entries())if(j.required)R.push(B);else if(j.default!==void 0)F.push({name:B,defaultValue:j.default});else R.push(B);if(R.length>0)q.push({op:"varsImport",keys:R});for(let{name:B,defaultValue:j}of F)q.push({op:"varsImport",keys:[B]}),q.push({op:"if",condition:{$expr:"binary",op:"==",left:{$expr:"ident",name:B},right:{$expr:"literal",value:null}},then:[{op:"varSet",key:B,value:j}]});q.push(..._);let O=Object.fromEntries(K),U={name:Z.id?.name||"anonymous",description:H.description,parameters:O,returns:W},L=v6(O);return{ast:{op:"seq",steps:q,inputSchema:L},signature:U,warnings:z.warnings}}function $0(Z,Q){let Y=[];for(let J of Z.body){let X=d0(J,Q);if(X)if(Array.isArray(X))Y.push(...X);else Y.push(X)}return Y}function d0(Z,Q){switch(Z.type){case"VariableDeclaration":return k6(Z,Q);case"ExpressionStatement":return g6(Z,Q);case"IfStatement":return f6(Z,Q);case"WhileStatement":return h6(Z,Q);case"ForOfStatement":return x6(Z,Q);case"TryStatement":return m6(Z,Q);case"ReturnStatement":return u6(Z,Q);case"ThrowStatement":throw new l("'throw' is not supported in AsyncJS. Use Error('message') to trigger error flow",d(Z),Q.source,Q.filename);case"BlockStatement":return{op:"scope",steps:$0(Z,H0(Q))};case"EmptyStatement":return null;default:throw new l(`Unsupported statement type: ${Z.type}`,d(Z),Q.source,Q.filename)}}function k6(Z,Q){let Y=[],J=Z.kind==="const",X=J?"constSet":"varSet";for(let H of Z.declarations){if(H.id.type!=="Identifier")throw new l("Only simple variable names are supported",d(H),Q.source,Q.filename);let K=H.id.name;if(H.init){let{step:W,resultVar:z}=D0(H.init,Q,K,J);if(W)Y.push(W);else if(z!==K)Y.push({op:X,key:K,value:z});let _=z0(H.init);Q.locals.set(K,_)}else{if(J)throw new l("const declarations must be initialized",d(H),Q.source,Q.filename);Y.push({op:"varSet",key:K,value:null}),Q.locals.set(K,{kind:"any",nullable:!0})}}return Y}function g6(Z,Q){let Y=Z.expression;if(Y.type==="AssignmentExpression")return y6(Y,Q);if(Y.type==="CallExpression"){let{step:J,resultVar:X}=D0(Y,Q);if(J)return J;if(X)return{op:"varSet",key:"_",value:X};return null}return Q.warnings.push({message:"Expression statement has no effect",line:d(Z).line,column:d(Z).column}),null}function y6(Z,Q){if(Z.left.type!=="Identifier")throw new l("Only simple variable assignment is supported",d(Z),Q.source,Q.filename);let Y=Z.left.name,{step:J,resultVar:X}=D0(Z.right,Q,Y);if(J)return J;return{op:"varSet",key:Y,value:X}}function f6(Z,Q){let Y=m(Z.test,Q),J=Z.consequent.type==="BlockStatement"?$0(Z.consequent,H0(Q)):[d0(Z.consequent,Q)].filter(Boolean),X;if(Z.alternate)X=Z.alternate.type==="BlockStatement"?$0(Z.alternate,H0(Q)):[d0(Z.alternate,Q)].filter(Boolean);return{op:"if",condition:Y,then:J,...X&&{else:X}}}function h6(Z,Q){let Y=m(Z.test,Q),J=Z.body.type==="BlockStatement"?$0(Z.body,H0(Q)):[d0(Z.body,Q)].filter(Boolean);return{op:"while",condition:Y,body:J}}function x6(Z,Q){let Y;if(Z.left.type==="VariableDeclaration"){let K=Z.left.declarations[0];if(K.id.type!=="Identifier")throw new l("Only simple variable names are supported in for...of",d(Z.left),Q.source,Q.filename);Y=K.id.name}else if(Z.left.type==="Identifier")Y=Z.left.name;else throw new l("Unsupported for...of left-hand side",d(Z.left),Q.source,Q.filename);let J=c(Z.right,Q),X=H0(Q);X.locals.set(Y,{kind:"any"});let H=Z.body.type==="BlockStatement"?$0(Z.body,X):[d0(Z.body,X)].filter(Boolean);return{op:"map",items:J,as:Y,steps:H}}function m6(Z,Q){let Y=$0(Z.block,H0(Q)),J,X;if(Z.handler){let H=H0(Q);if(Z.handler.param?.type==="Identifier")X=Z.handler.param.name,H.locals.set(X,{kind:"any"});J=$0(Z.handler.body,H)}return{op:"try",try:Y,...J&&{catch:J},...X&&{catchParam:X}}}function u6(Z,Q){if(!Z.argument)return{op:"return",value:{}};let{step:Y,resultVar:J}=D0(Z.argument,Q,"__returnVal__");if(Y)return[Y,{op:"return",value:J}];return{op:"return",value:c(Z.argument,Q)}}var L9=new Set(["Math","JSON","Array","Object","String","Number","console","Date","Schema"]),l6=new Set(["parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","Set","Date","filter"]),p0=new Set(["RegExp","Promise","Map","WeakSet","WeakMap","Symbol","Proxy","Reflect","Function","eval","setTimeout","setInterval","fetch","require","import","process","window","document","global","globalThis"]),d6=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 p6(Z){if(Z.callee.type==="Identifier"){let Q=Z.callee.name;return l6.has(Q)||p0.has(Q)}if(Z.callee.type==="MemberExpression"){let Q=Z.callee;if(Q.object.type==="Identifier"){let Y=Q.object.name;if(L9.has(Y)||p0.has(Y))return!0}if(Q.property.type==="Identifier"){let Y=Q.property.name;if(d6.has(Y))return!0}}return!1}function i6(Z){if(Z.object.type==="Identifier"){let Q=Z.object.name;return L9.has(Q)||p0.has(Q)}return!1}var M9={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 n6(Z){if(Z.callee.type==="Identifier"){let Q=Z.callee.name;if(p0.has(Q))return M9[Q]||`${Q} is not available in AsyncJS.`}if(Z.callee.type==="MemberExpression"){let Q=Z.callee;if(Q.object.type==="Identifier"){let Y=Q.object.name;if(p0.has(Y))return M9[Y]||`${Y} is not available in AsyncJS.`}}return null}function j9(Z){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."}[Z]||" Use factory functions or object literals instead."}function D0(Z,Q,Y,J){let X=J?"constSet":"varSet";if(Z.type==="ChainExpression")return D0(Z.expression,Q,Y,J);if(Z.type==="NewExpression"){let K=Z,W="constructor";if(K.callee.type==="Identifier")W=K.callee.name;let z=j9(W);throw new l(`The 'new' keyword is not supported in AsyncJS.${z}`,d(Z),Q.source,Q.filename)}if(Z.type==="CallExpression"){let K=n6(Z);if(K)throw new l(K,d(Z),Q.source,Q.filename)}if(Z.type==="CallExpression"&&p6(Z)){let K=m(Z,Q);if(Y)return{step:{op:X,key:Y,value:K},resultVar:Y};return{step:null,resultVar:K}}if(Z.type==="MemberExpression"&&i6(Z)){let K=m(Z,Q);if(Y)return{step:{op:X,key:Y,value:K},resultVar:Y};return{step:null,resultVar:K}}if(Z.type==="CallExpression")return c6(Z,Q,Y,J);if(Z.type==="TemplateLiteral")return a6(Z,Q,Y,J);if(Z.type==="BinaryExpression"||Z.type==="LogicalExpression"||Z.type==="UnaryExpression"){let K=m(Z,Q);if(Y)return{step:{op:X,key:Y,value:K},resultVar:Y};return{step:null,resultVar:K}}return{step:null,resultVar:c(Z,Q)}}function c6(Z,Q,Y,J){let X,H=!1,K;if(Z.callee.type==="Identifier")X=Z.callee.name;else if(Z.callee.type==="MemberExpression"){let z=Z.callee;if(z.property.type==="Identifier")X=z.property.name,H=!0,K=c(z.object,Q);else throw new l("Computed method names are not supported",d(Z),Q.source,Q.filename)}else throw new l("Only named function calls are supported",d(Z),Q.source,Q.filename);if(H)return o6(X,K,Z.arguments,Q,Y,J);if(X==="console"&&Z.callee.type==="MemberExpression");let W=s6(Z,Q);return{step:{op:X,...W,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function o6(Z,Q,Y,J,X,H){switch(Z){case"map":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let K=Y[0],W=K.params[0],z=W?.type==="Identifier"?W.name:"item",_=H0(J);_.locals.set(z,{kind:"any"});let q;if(K.body.type==="BlockStatement")q=$0(K.body,_);else{let{step:R,resultVar:F}=D0(K.body,_,"result");q=R?[R]:[{op:"varSet",key:"result",value:F}]}return{step:{op:"map",items:Q,as:z,steps:q,...X&&{result:X},...X&&H&&{resultConst:!0}},resultVar:X}}break;case"filter":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let K=Y[0],W=K.params[0],z=W?.type==="Identifier"?W.name:"item",_=H0(J);_.locals.set(z,{kind:"any"});let q;if(K.body.type==="BlockStatement")throw new l("filter callback must be an expression, not a block",d(Y[0]),J.source,J.filename);else q=m(K.body,_);return{step:{op:"filter",items:Q,as:z,condition:q,...X&&{result:X},...X&&H&&{resultConst:!0}},resultVar:X}}break;case"find":if(Y.length>0&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let K=Y[0],W=K.params[0],z=W?.type==="Identifier"?W.name:"item",_=H0(J);_.locals.set(z,{kind:"any"});let q;if(K.body.type==="BlockStatement")throw new l("find callback must be an expression, not a block",d(Y[0]),J.source,J.filename);else q=m(K.body,_);return{step:{op:"find",items:Q,as:z,condition:q,...X&&{result:X},...X&&H&&{resultConst:!0}},resultVar:X}}break;case"reduce":if(Y.length>=2&&(Y[0].type==="ArrowFunctionExpression"||Y[0].type==="FunctionExpression")){let K=Y[0],W=K.params[0],z=K.params[1],_=W?.type==="Identifier"?W.name:"acc",q=z?.type==="Identifier"?z.name:"item",R=H0(J);R.locals.set(_,{kind:"any"}),R.locals.set(q,{kind:"any"});let F;if(K.body.type==="BlockStatement")F=$0(K.body,R);else{let{step:U,resultVar:L}=D0(K.body,R,"result");F=U?[U]:[{op:"varSet",key:"result",value:L}]}let O=c(Y[1],J);return{step:{op:"reduce",items:Q,as:q,accumulator:_,initial:O,steps:F,...X&&{result:X},...X&&H&&{resultConst:!0}},resultVar:X}}break;case"slice":break;case"push":return{step:{op:"push",list:Q,item:c(Y[0],J),...X&&{result:X},...X&&H&&{resultConst:!0}},resultVar:X};case"join":return{step:{op:"join",list:Q,sep:Y.length>0?c(Y[0],J):"",...X&&{result:X},...X&&H&&{resultConst:!0}},resultVar:X};case"split":return{step:{op:"split",str:Q,sep:Y.length>0?c(Y[0],J):"",...X&&{result:X},...X&&H&&{resultConst:!0}},resultVar:X}}return J.warnings.push({message:`Unknown method '${Z}' - treating as atom call`,line:0,column:0}),{step:{op:Z,receiver:Q,args:Y.map((K)=>c(K,J)),...X&&{result:X},...X&&H&&{resultConst:!0}},resultVar:X}}function a6(Z,Q,Y,J){let X="",H={};for(let K=0;K<Z.quasis.length;K++)if(X+=Z.quasis[K].value.cooked||Z.quasis[K].value.raw,K<Z.expressions.length){let W=Z.expressions[K],z=`_${K}`;H[z]=c(W,Q),X+=`{{${z}}}`}return{step:{op:"template",tmpl:X,vars:H,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function m(Z,Q){switch(Z.type){case"Literal":return{$expr:"literal",value:Z.value};case"Identifier":return{$expr:"ident",name:Z.name};case"MemberExpression":{let Y=Z,J=m(Y.object,Q),X=Y.optional===!0;if(Y.computed){let K=Y.property;if(K.type==="Literal")return{$expr:"member",object:J,property:String(K.value),computed:!0,...X&&{optional:!0}};throw new l("Computed member access with variables not yet supported",d(Z),Q.source,Q.filename)}let H=Y.property.name;return{$expr:"member",object:J,property:H,...X&&{optional:!0}}}case"ChainExpression":return m(Z.expression,Q);case"BinaryExpression":{let Y=Z;return{$expr:"binary",op:Y.operator,left:m(Y.left,Q),right:m(Y.right,Q)}}case"LogicalExpression":{let Y=Z;return{$expr:"logical",op:Y.operator,left:m(Y.left,Q),right:m(Y.right,Q)}}case"UnaryExpression":{let Y=Z;return{$expr:"unary",op:Y.operator,argument:m(Y.argument,Q)}}case"ConditionalExpression":{let Y=Z;return{$expr:"conditional",test:m(Y.test,Q),consequent:m(Y.consequent,Q),alternate:m(Y.alternate,Q)}}case"ArrayExpression":return{$expr:"array",elements:Z.elements.filter((J)=>J!==null).map((J)=>m(J,Q))};case"ObjectExpression":{let Y=Z,J=[];for(let X of Y.properties)if(X.type==="Property"){let H=X.key.type==="Identifier"?X.key.name:String(X.key.value);J.push({key:H,value:m(X.value,Q)})}return{$expr:"object",properties:J}}case"CallExpression":{let Y=Z;if(Y.callee.type==="MemberExpression"){let J=Y.callee,X=J.property.type==="Identifier"?J.property.name:String(J.property.value),H=J.optional===!0||Y.optional===!0;return{$expr:"methodCall",object:m(J.object,Q),method:X,arguments:Y.arguments.map((K)=>m(K,Q)),...H&&{optional:!0}}}if(Y.callee.type==="Identifier")return{$expr:"call",callee:Y.callee.name,arguments:Y.arguments.map((X)=>m(X,Q))};throw new l("Complex function calls in expressions should be lifted to statements",d(Z),Q.source,Q.filename)}case"NewExpression":{let Y=Z,J="constructor";if(Y.callee.type==="Identifier")J=Y.callee.name;let X=j9(J);throw new l(`The 'new' keyword is not supported in AsyncJS.${X}`,d(Z),Q.source,Q.filename)}case"TemplateLiteral":throw new l("Template literals inside expressions are not supported. Assign to a variable first: const msg = `hello ${name}`; then use msg",d(Z),Q.source,Q.filename);default:throw new l(`Unsupported expression type in condition: ${Z.type}`,d(Z),Q.source,Q.filename)}}function c(Z,Q){switch(Z.type){case"Literal":return Z.value;case"Identifier":return Z.name;case"MemberExpression":{let Y=Z;if(Y.optional===!0)return m(Z,Q);let X=c(Y.object,Q);if(X&&typeof X==="object"&&X.$expr){let K=Y.computed?String(Y.property.value):Y.property.name;return{$expr:"member",object:X,property:K,...Y.computed&&{computed:!0}}}if(Y.computed)return`${X}[${c(Y.property,Q)}]`;let H=Y.property.name;if(typeof X==="string")return`${X}.${H}`;if(X&&X.$kind==="arg")return{$kind:"arg",path:`${X.path}.${H}`};return`${X}.${H}`}case"ChainExpression":return c(Z.expression,Q);case"ArrayExpression":return Z.elements.map((Y)=>Y?c(Y,Q):null);case"ObjectExpression":{let Y={};for(let J of Z.properties)if(J.type==="Property"){let X=J.key.type==="Identifier"?J.key.name:String(J.key.value);Y[X]=c(J.value,Q)}return Y}case"TemplateLiteral":return m(Z,Q);case"CallExpression":return m(Z,Q);case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"ConditionalExpression":return m(Z,Q);default:return null}}function s6(Z,Q){if(Z.arguments.length===1&&Z.arguments[0].type==="ObjectExpression"){let Y=Z.arguments[0],J={};for(let X of Y.properties)if(X.type==="Property"){let H=X.key.type==="Identifier"?X.key.name:String(X.key.value);J[H]=c(X.value,Q)}return J}return{args:Z.arguments.map((Y)=>c(Y,Q))}}function N9(Z,Q={}){let{ast:Y,returnType:J,originalSource:X,requiredParams:H}=R9(Z,{filename:Q.filename,colonShorthand:!0,vmTarget:!0}),K=O9(Y,Q.filename),{ast:W,signature:z,warnings:_}=B9(K,X,J,Q,H);return{ast:W,signature:z,warnings:_}}var t6=10;class e6{atoms;constructor(Z={}){this.atoms={...c1,...Z}}get builder(){return new r(this.atoms)}get Agent(){return new r(this.atoms)}get A99(){return this.Agent}resolve(Z){return this.atoms[Z]}getTools(Z="all"){let Q=Object.values(this.atoms);if(Array.isArray(Z))Q=Q.filter((Y)=>Z.includes(Y.op));else if(Z==="flow"){let Y=["seq","if","while","return","try","varSet","varGet","scope"];Q=Q.filter((J)=>Y.includes(J.op))}return Q.map((Y)=>({type:"function",function:{name:Y.op,description:Y.docs,parameters:Y.inputSchema?.schema??{}}}))}async run(Z,Q={},Y={}){let J;if(typeof Z==="string")if(M1(Z))J=B1(Z);else try{J=N9(Z).ast}catch(O){throw Error(`AJS transpilation failed: ${O.message}`)}else J=Z;let X=Y.fuel??1000,H=Y.timeoutMs??X*t6,K=Y.capabilities??{},W=[];if(!K.store){let O=new Map,U=!1;K.store={get:async(L)=>{if(!U)U=!0,W.push("Using default in-memory store (not suitable for production)");return O.get(L)},set:async(L,B)=>{if(!U)U=!0,W.push("Using default in-memory store (not suitable for production)");O.set(L,B)}}}let z=new AbortController,_=setTimeout(()=>z.abort(),H);if(Y.signal)Y.signal.addEventListener("abort",()=>z.abort());let q={fuel:{current:X},args:Q,state:{},consts:new Set,capabilities:K,resolver:(O)=>this.resolve(O),output:void 0,signal:z.signal,costOverrides:Y.costOverrides,context:Y.context,warnings:W};if(Y.trace)q.trace=[];if(J.op!=="seq")throw Error("Root AST must be 'seq'. Ensure you're passing a transpiled agent (use ajs`...` or transpile()).");let R=J.inputSchema;if(R&&!r6(Q,R)){let O=new s("Input validation failed: args do not match expected schema","vm.run");return{result:O,error:O,fuelUsed:0,trace:q.trace,warnings:W.length>0?W:void 0}}try{await Promise.race([this.resolve("seq")?.exec(J,q),new Promise((O,U)=>{if(z.signal.addEventListener("abort",()=>{U(Error(`Execution timeout after ${H}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))}),z.signal.aborted)U(Error(`Execution timeout after ${H}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))})])}catch(O){if(O.message?.includes("timeout")||O.message?.includes("aborted")||z.signal.aborted)q.error=new s(`Execution timeout after ${H}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`,"vm.run");else throw O}finally{clearTimeout(_)}if(q.error&&q.output===void 0)q.output=q.error;let F=[...W,...q.warnings??[]];return{result:q.output,error:q.error,fuelUsed:X-q.fuel.current,trace:q.trace,warnings:F.length>0?F:void 0}}}import{s as v}from"tosijs-schema";var w9=C("storeVectorize",v.object({text:v.string,model:v.string.optional}),v.array(v.number),async({text:Z},Q)=>{let Y=Q.capabilities.vector;if(!Y)throw Error("Capability 'vector' missing. Ensure vector battery is loaded.");let J=M(Z,Q);return Y.embed(J)},{docs:"Generate embeddings using vector battery",cost:20}),A9=C("storeCreateCollection",v.object({collection:v.string,dimension:v.number.optional}),void 0,async({collection:Z,dimension:Q},Y)=>{let J=Y.capabilities.store;if(!J?.createCollection)throw Error("Capability 'store' missing or does not support createCollection.");let X=M(Z,Y),H=M(Q,Y);return J.createCollection(X,void 0,H)},{docs:"Create a vector store collection",cost:5}),V9=C("storeVectorAdd",v.object({collection:v.string,doc:v.any}),void 0,async({collection:Z,doc:Q},Y)=>{let J=Y.capabilities.store;if(!J?.vectorAdd)throw Error("Capability 'store' missing or does not support vectorAdd.");let X=M(Z,Y),H=M(Q,Y);return J.vectorAdd(X,H)},{docs:"Add a document to a vector store collection",cost:5}),D9=C("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:Z,queryVector:Q,k:Y,filter:J},X)=>{let H=X.capabilities.store;if(!H?.vectorSearch)throw Error("Capability 'store' missing or does not support vectorSearch.");let K=M(Z,X),W=M(Q,X),z=M(Y,X)??5,_=M(J,X);return H.vectorSearch(K,W,z,_)},{docs:"Search vector store",cost:(Z,Q)=>5+(M(Z.k,Q)??5)}),T9=C("llmPredictBattery",v.object({system:v.string.optional,user:v.string,tools:v.array(v.any).optional,responseFormat:v.any.optional}),v.object({role:v.string.optional,content:v.string.optional,tool_calls:v.array(v.any).optional}),async({system:Z,user:Q,tools:Y,responseFormat:J},X)=>{let H=X.capabilities.llmBattery;if(!H?.predict)throw Error("Capability 'llmBattery' missing or invalid.");let K=M(Z,X)??"You are a helpful agent.",W=M(Q,X),z=M(Y,X),_=M(J,X);return H.predict(K,W,z,_)},{docs:"Generate completion using LLM battery",cost:100}),C9=C("llmVision",v.object({system:v.string.optional,prompt:v.string,images:v.array(v.string),responseFormat:v.any.optional}),v.object({role:v.string.optional,content:v.string.optional,tool_calls:v.array(v.any).optional}),async({system:Z,prompt:Q,images:Y,responseFormat:J},X)=>{let H=X.capabilities.llmBattery;if(!H?.predict)throw Error("Capability 'llmBattery' missing or invalid.");let K=M(Z,X)??"You analyze images accurately and concisely.",W=M(Q,X),z=M(Y,X)??[],_=M(J,X);return H.predict(K,{text:W,images:z},void 0,_)},{docs:"Analyze images using a vision model",timeoutMs:120000,cost:150});var E7={storeCreateCollection:A9,storeSearch:D9,storeVectorAdd:V9,storeVectorize:w9,llmPredictBattery:T9,llmVision:C9};export{wZ as xmlParse,m9 as whileLoop,UZ as vectorSearch,o9 as varsLet,c9 as varsImport,a9 as varsExport,p9 as varSet,n9 as varGet,TZ as uuid,l9 as tryCatch,BZ as transpileCode,KZ as template,RZ as storeSet,OZ as storeQuery,bZ as storeProcedure,$Z as storeGet,JZ as split,Q0 as seq,s9 as scope,LZ as runCode,u9 as ret,M as resolveValue,B1 as resolveProcedureToken,EZ as releaseProcedure,HZ as regexMatch,e9 as reduce,DZ as random,QZ as push,C0 as procedureStore,WZ as pick,zZ as omit,GZ as merge,AZ as memoize,r9 as map,IZ as llmPredict,YZ as len,_Z as keys,NZ as jsonStringify,jZ as jsonParse,XZ as join,M1 as isProcedureToken,P9 as isAgentError,x9 as iff,L1 as hash,ZZ as find,t9 as filter,FZ as fetch,p as evaluateExpr,d9 as errorAtom,C as defineAtom,B0 as createChildScope,c1 as coreAtoms,i9 as constSet,PZ as consoleWarn,CZ as consoleLog,SZ as consoleError,vZ as clearExpiredProcedures,VZ as cache,R0 as builtins,E7 as batteryAtoms,MZ as agentRun,I1 as PROCEDURE_TOKEN_PREFIX,S9 as DEFAULT_PROCEDURE_TTL,b9 as DEFAULT_MAX_AST_SIZE,e6 as AgentVM,s as AgentError};
53
54
 
54
- //# debugId=E54E48D3CC2A63B364756E2164756E21
55
+ //# debugId=AAB00DA871B99F8664756E2164756E21