tjs-lang 0.5.2 → 0.5.4

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,22 +1,22 @@
1
- import{s as F,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 e{$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 a6(Z){return Z instanceof e||Z&&Z.$error===!0}var C0=new Map,V9=3600000,D9=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 T9(){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 C9=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","metadata.google.internal"]);function P9(Z){try{let Q=new URL(Z);if(Q.protocol!=="http:"&&Q.protocol!=="https:")return!0;let Y=Q.hostname.toLowerCase();if(C9.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 S9(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 b9(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 l(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 $0={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:{...F,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 $0.Set([...Q,...J])},intersection(Y){let J=Y?.toArray?.()??Y??[];return $0.Set(Q.filter((X)=>J.includes(X)))},diff(Y){let J=Y?.toArray?.()??Y??[];return $0.Set(Q.filter((X)=>!J.includes(X)))},forEach(Y){Q.forEach(Y)},map(Y){return $0.Set(Q.map(Y))},filter(Y){return $0.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:G=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(G)q.setSeconds(q.getSeconds()+G);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."},E9=0.01,x1=0.0001,m1=0.001,k9=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 l(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-=E9,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 $0)return $0[Z.name];if(Z.name in i0)throw Error(i0[Z.name]);return}case"member":{let Y=l(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=l(Z.left,Q),J=l(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 e("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=l(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=l(Z.left,Q);if(Z.op==="&&")return Y?l(Z.right,Q):Y;else if(Z.op==="??")return Y??l(Z.right,Q);else return Y?Y:l(Z.right,Q)}case"conditional":return l(Z.test,Q)?l(Z.consequent,Q):l(Z.alternate,Q);case"array":return Z.elements.map((Y)=>l(Y,Q));case"object":{let Y={};for(let J of Z.properties)Y[J.key]=l(J.value,Q);return Y}case"call":{if(Z.callee==="Error"){let J=Z.arguments.map((K)=>l(K,Q)),X=typeof J[0]==="string"?J[0]:"Error";Q.error=new e(X,"Error");return}if(Z.callee in $0){let J=$0[Z.callee];if(typeof J==="function"){let X=Z.arguments.map((K)=>l(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=l(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)=>l(H,Q)),W=X.apply(Y,K);if(Q.fuel&&k9.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 e("Out of Fuel",`expr.${J}`);return}}return W}default:throw Error(`Unknown expression type: ${Z.$expr}`)}}function T(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:$,...O}=_;if(q.error)return;let U=q.trace?{...q.state}:null,L=q.fuel.current,B,I;try{let V=q.costOverrides?.[Z],j=V!==void 0?V:H,N=typeof j==="function"?j(O,q):j;if((q.fuel.current-=N)<=0){q.error=new e("Out of Fuel",Z);return}let S,P=async()=>J(_,q);if(B=W>0?await Promise.race([P(),new Promise((D,C)=>{S=setTimeout(()=>C(Error(`Atom '${Z}' timed out`)),W)})]).finally(()=>clearTimeout(S)):await P(),_.result){if(q.consts.has(_.result))throw Error(`Cannot reassign const variable '${_.result}'`);if(B!==void 0&&Y&&!O1(B,Y)){q.error=new e(`Output validation failed for '${Z}'`,Z);return}if(q.state[_.result]=B,_.resultConst)q.consts.add(_.result)}}catch(V){I=V.message||String(V),q.error=new e(I,Z,V)}finally{if(q.trace&&U){let V=b9(U,q.state);q.trace.push({op:Z,input:O,stateDiff:V,result:B,error:I,fuelBefore:L,fuelAfter:q.fuel.current,timestamp:new Date().toISOString()})}}},docs:K,timeoutMs:W,cost:H,create:(_)=>({op:Z,..._})}}var Q0=T("seq",F.object({steps:F.array(F.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}),v9=T("if",F.object({condition:F.any,then:F.array(F.any),else:F.array(F.any).optional}),void 0,async(Z,Q)=>{if(l(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}),g9=T("while",F.object({condition:F.any,body:F.array(F.any)}),void 0,async(Z,Q)=>{while(l(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}),y9=T("return",void 0,F.any,async(Z,Q)=>{if(Q.error)return Q.output=Q.error,Q.error;if("value"in Z){let J=M(Z.value,Q);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}),f9=T("try",F.object({try:F.array(F.any),catch:F.array(F.any).optional,catchParam:F.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}),h9=T("Error",F.object({args:F.array(F.any).optional}),void 0,async(Z,Q)=>{let Y=Z.args?.[0]??"Error";Q.error=new e(String(Y),"Error")},{docs:"Trigger error flow",cost:0.1}),x9=T("varSet",F.object({key:F.string,value:F.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}),m9=T("constSet",F.object({key:F.string,value:F.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}),u9=T("varGet",F.object({key:F.string}),F.any,async({key:Z},Q)=>{return M(Z,Q)},{docs:"Get Variable",cost:0.1}),d9=T("varsImport",F.object({keys:F.union([F.array(F.string),F.record(F.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}),l9=T("varsLet",F.record(F.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}),p9=T("varsExport",F.object({keys:F.union([F.array(F.string),F.record(F.string)])}),F.record(F.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}),i9=T("scope",F.object({steps:F.array(F.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}),n9=T("map",F.object({items:F.array(F.any),as:F.string,steps:F.array(F.any)}),F.array(F.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}),c9=T("filter",F.object({items:F.array(F.any),as:F.string,condition:F.any}),F.array(F.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,l(Y,H))X.push(W)}return X},{docs:"Filter Array",timeoutMs:0,cost:1}),o9=T("reduce",F.object({items:F.array(F.any),as:F.string,accumulator:F.string,initial:F.any,steps:F.array(F.any)}),F.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 G=H;for(let _ of W){if(K.signal?.aborted)throw Error("Execution aborted");let q=B0(K);q.state[Q]=_,q.state[Y]=G,await Q0.exec({op:"seq",steps:X},q),G=q.state.result??G}return G},{docs:"Reduce Array",timeoutMs:0,cost:1}),a9=T("find",F.object({items:F.array(F.any),as:F.string,condition:F.any}),F.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,l(Y,W))return K}return null},{docs:"Find in Array",timeoutMs:0,cost:1}),s9=T("push",F.object({list:F.array(F.any),item:F.any}),F.array(F.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}),r9=T("len",F.object({list:F.any}),F.number,async({list:Z},Q)=>{let Y=M(Z,Q);return Array.isArray(Y)||typeof Y==="string"?Y.length:0},{docs:"Length",cost:1}),t9=T("split",F.object({str:F.string,sep:F.string}),F.array(F.string),async({str:Z,sep:Q},Y)=>M(Z,Y).split(M(Q,Y)),{docs:"Split String",cost:1}),e9=T("join",F.object({list:F.array(F.string),sep:F.string}),F.string,async({list:Z,sep:Q},Y)=>M(Z,Y).join(M(Q,Y)),{docs:"Join String",cost:1}),ZZ=T("template",F.object({tmpl:F.string,vars:F.record(F.any)}),F.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}),QZ=T("regexMatch",F.object({pattern:F.string,value:F.any}),F.boolean,async({pattern:Z,value:Q},Y)=>{if(S9(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}),YZ=T("pick",F.object({obj:F.record(F.any),keys:F.array(F.string)}),F.record(F.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}),JZ=T("omit",F.object({obj:F.record(F.any),keys:F.array(F.string)}),F.record(F.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}),XZ=T("merge",F.object({a:F.record(F.any),b:F.record(F.any)}),F.record(F.any),async({a:Z,b:Q},Y)=>({...M(Z,Y),...M(Q,Y)}),{docs:"Merge Objects",cost:1}),WZ=T("keys",F.object({obj:F.record(F.any)}),F.array(F.string),async({obj:Z},Q)=>Object.keys(M(Z,Q)??{}),{docs:"Object Keys",cost:1}),u1=10,d1="X-Agent-Depth";function KZ(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 HZ=T("httpFetch",F.object({url:F.string,method:F.string.optional,headers:F.record(F.string).optional,body:F.any.optional,responseType:F.string.optional}),F.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,[d1]:String(H+1)},body:K,signal:Q.signal,responseType:W});let G=Q.context?.allowedFetchDomains;if(G){if(!KZ(Y,G))throw Error(`Fetch blocked: domain not in allowlist. Allowed: ${G.join(", ")}`)}else{if(P9(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(H+1)},body:K?JSON.stringify(K):void 0,signal:Q.signal});if(W==="dataUrl"){let R=await _.arrayBuffer(),$=new Uint8Array(R),O="";for(let B=0;B<$.length;B++)O+=String.fromCharCode($[B]);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}),zZ=T("storeGet",F.object({key:F.string}),F.any,async({key:Z},Q)=>{let Y=M(Z,Q);return Q.capabilities.store?.get(Y)},{docs:"Store Get",cost:5}),GZ=T("storeSet",F.object({key:F.string,value:F.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}),_Z=T("storeQuery",F.object({query:F.any}),F.array(F.any),async({query:Z},Q)=>Q.capabilities.store?.query?.(M(Z,Q))??[],{docs:"Store Query",cost:5}),qZ=T("storeVectorSearch",F.object({collection:F.string.optional,vector:F.array(F.number),k:F.number.optional}),F.array(F.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)}),FZ=T("llmPredict",F.object({prompt:F.string,options:F.any.optional}),F.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}),$Z=T("agentRun",F.object({agentId:F.any,input:F.any}),F.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),G={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},_=Y.resolver("seq");if(!_)throw Error("seq atom not found");if(await _.exec(H,G),G.error)throw Error(G.error.message||"Sub-agent failed");return G.output}if(J&&typeof J==="object"&&"op"in J){let H={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},G=Y.resolver("seq");if(!G)throw Error("seq atom not found");if(await G.exec(J,H),H.error)throw Error(H.error.message||"Sub-agent failed");return H.output}if(!Y.capabilities.agent?.run)throw Error("Capability 'agent.run' missing");let W=await Y.capabilities.agent.run(J,K);if(W&&typeof W==="object"&&"fuelUsed"in W&&typeof W.fuelUsed==="number"){if(W.error)throw Error(W.error.message||"Sub-agent failed");return W.result}return W},{docs:"Run Sub-Agent (accepts procedure token, AST, or agent ID)",cost:1}),RZ=T("transpileCode",F.object({code:F.string}),F.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}),l1=10,OZ=T("runCode",F.object({code:F.string,args:F.record(F.any).optional}),F.any,async({code:Z,args:Q},Y)=>{let J=Y.runCodeDepth??0;if(J>=l1)throw Error(`runCode recursion limit exceeded (max ${l1}). 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(G){throw Error(`Code transpilation failed: ${G.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}),UZ=T("jsonParse",F.object({str:F.string}),F.any,async({str:Z},Q)=>JSON.parse(M(Z,Q)),{docs:"Parse JSON",cost:1}),IZ=T("jsonStringify",F.object({value:F.any}),F.string,async({value:Z},Q)=>JSON.stringify(M(Z,Q)),{docs:"Stringify JSON",cost:1}),MZ=T("xmlParse",F.object({str:F.string}),F.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}),BZ=T("memoize",F.object({key:F.string.optional,steps:F.array(F.any)}),F.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}),LZ=T("cache",F.object({key:F.string.optional,steps:F.array(F.any),ttlMs:F.number.optional}),F.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 G=H.output??H.state.result,_=Date.now()+(Y??86400000);if((J.fuel.current-=5)<=0)throw Error("Out of Fuel");return await J.capabilities.store.set(K,{val:G,_exp:_}),G},{docs:"Cache steps result in store with TTL",cost:5}),jZ=T("random",F.object({min:F.number.optional,max:F.number.optional,format:F.string.optional,length:F.number.optional}),F.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,G=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 L=0;L<W;L++)O+="0123456789abcdefghijklmnopqrstuvwxyz"[U[L]%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 $=new Uint32Array(1);crypto.getRandomValues($),_=$[0]/4294967296}else _=Math.random();let q=G-H,R=_*q+H;if(K==="integer")return Math.floor(R);return R},{docs:"Generate Random",cost:1}),NZ=T("uuid",void 0,F.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=T("hash",F.object({value:F.any,algorithm:F.string.optional}),F.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),G=await crypto.subtle.digest(X,H);return Array.from(new Uint8Array(G)).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}),wZ=T("consoleLog",F.object({message:F.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}),AZ=T("consoleWarn",F.object({message:F.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}),VZ=T("consoleError",F.object({message:F.any}),void 0,async({message:Z},Q)=>{let Y=M(Z,Q),J=typeof Y==="string"?Y:JSON.stringify(Y);Q.error=new e(J,"console.error")},{docs:"Emit error and stop",cost:0.1}),DZ=T("storeProcedure",F.object({ast:F.any,ttl:F.number.optional,maxSize:F.number.optional}),F.string,async({ast:Z,ttl:Q,maxSize:Y},J)=>{let X=M(Z,J),K=Q?M(Q,J):V9,W=Y?M(Y,J):D9;if(!X||typeof X!=="object"||!X.op)throw Error('Invalid AST: must be an object with an "op" property');let H=JSON.stringify(X);if(H.length>W)throw Error(`AST too large: ${H.length} bytes exceeds limit of ${W} bytes. Consider reducing AST size or using a shorter TTL.`);let G=T9(),_=Date.now();return C0.set(G,{ast:X,createdAt:_,expiresAt:_+K}),G},{docs:"Store an AST and return a token for later execution",cost:1}),TZ=T("releaseProcedure",F.object({token:F.string}),F.boolean,async({token:Z},Q)=>{let Y=M(Z,Q);return C0.delete(Y)},{docs:"Release a stored procedure by token",cost:0.1}),CZ=T("clearExpiredProcedures",void 0,F.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:v9,while:g9,return:y9,try:f9,Error:h9,varSet:x9,constSet:m9,varGet:u9,varsImport:d9,varsLet:l9,varsExport:p9,scope:i9,map:n9,filter:c9,reduce:o9,find:a9,push:s9,len:r9,split:t9,join:e9,template:ZZ,regexMatch:QZ,pick:YZ,omit:JZ,merge:XZ,keys:WZ,httpFetch:HZ,storeGet:zZ,storeSet:GZ,storeQuery:_Z,storeVectorSearch:qZ,llmPredict:FZ,agentRun:$Z,transpileCode:RZ,runCode:OZ,jsonParse:UZ,jsonStringify:IZ,xmlParse:MZ,memoize:BZ,cache:LZ,random:jZ,uuid:NZ,hash:B1,consoleLog:wZ,consoleWarn:AZ,consoleError:VZ,storeProcedure:DZ,releaseProcedure:TZ,clearExpiredProcedures:CZ};var PZ=new Set(["true","false","null","undefined","and","or","not"]);function SZ(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((G)=>!PZ.has(G)&&!(G in Q)&&!new RegExp(`\\b${G}\\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){SZ(Z,Q);let Y=bZ(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 bZ(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 EZ(Z,Q,Y)}function EZ(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:G}=a1(Z,X,Y);J={$expr:"binary",op:W,left:J,right:H},X=G}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 kZ(Z,Q,Y)}function kZ(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 o{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 o(this.atoms);Y(X);let K;if(J){let G=new o(this.atoms);J(G),K=G.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 o(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 o(this.atoms);Z(Q);let Y=this.atoms.scope;return this.add(Y.create({steps:Q.steps}))}map(Z,Q,Y){let J=new o(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 o(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 o(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 o(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 o(this.atoms);Z.try(Q);let Y;if(Z.catch){let X=new o(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 i6}from"tosijs-schema";var vZ=[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],gZ="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",J8="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",j1={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"},N1="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",yZ={5:N1,"5module":N1+" export import",6:N1+" const class extends export import super"},fZ=/^in(stanceof)?$/,hZ=new RegExp("["+J8+"]"),xZ=new RegExp("["+J8+gZ+"]");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 z0(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&&hZ.test(String.fromCharCode(Z));if(Q===!1)return!1;return w1(Z,Y8)}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&&xZ.test(String.fromCharCode(Z));if(Q===!1)return!1;return w1(Z,Y8)||w1(Z,vZ)}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},a={startsExpr:!0},C1={};function g(Z,Q){if(Q===void 0)Q={};return Q.keyword=Z,C1[Z]=new y(Z,Q)}var z={num:new y("num",a),regexp:new y("regexp",a),string:new y("string",a),name:new y("name",a),privateId:new y("privateId",a),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("`",a),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",a),_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",a),_super:g("super",a),_class:g("class",a),_extends:g("extends",J0),_export:g("export"),_import:g("import",a),_null:g("null",a),_true:g("true",a),_false:g("false",a),_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})},s=/\r\n?|\n|\u2028|\u2029/,mZ=new RegExp(s.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,uZ=K8.hasOwnProperty,dZ=K8.toString,S0=Object.hasOwn||function(Z,Q){return uZ.call(Z,Q)},t1=Array.isArray||function(Z){return dZ.call(Z)==="[object Array]"},e1=Object.create(null);function L0(Z){return e1[Z]||(e1[Z]=new RegExp("^(?:"+Z.replace(/ /g,"|")+")$"))}function R0(Z){if(Z<=65535)return String.fromCharCode(Z);return Z-=65536,String.fromCharCode((Z>>10)+55296,(Z&1023)+56320)}var lZ=/(?:[\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 pZ(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=iZ(Q,Q.onComment);return Q}function iZ(Z,Q){return function(Y,J,X,K,W,H){var G={type:Y?"Block":"Line",value:J,start:X,end:K};if(Z.locations)G.loc=new e0(this,W,H);if(Z.ranges)G.range=[X,K];Q.push(G)}}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,U0=2,q8=3,F8=4,$8=5,p=function(Q,Y,J){this.options=Q=pZ(Q),this.sourceFile=Q.sourceFile,this.keywords=L0(yZ[Q.ecmaVersion>=6?6:Q.sourceType==="module"?"5module":5]);var X="";if(Q.allowReserved!==!0){if(X=j1[Q.ecmaVersion>=6?6:Q.ecmaVersion===5?5:3],Q.sourceType==="module")X+=" await"}this.reservedWords=L0(X);var K=(X?X+" ":"")+j1.strict;if(this.reservedWordsStrict=L0(K),this.reservedWordsStrictBind=L0(K+" "+j1.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(s).length;else this.pos=this.lineStart=0,this.curLine=1;if(this.type=z.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=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=[]},G0={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)};G0.inFunction.get=function(){return(this.currentVarScope().flags&b0)>0};G0.inGenerator.get=function(){return(this.currentVarScope().flags&z8)>0};G0.inAsync.get=function(){return(this.currentVarScope().flags&P1)>0};G0.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};G0.allowSuper.get=function(){var Z=this.currentThisScope(),Q=Z.flags;return(Q&Z1)>0||this.options.allowSuperOutsideMethod};G0.allowDirectSuper.get=function(){return(this.currentThisScope().flags&_8)>0};G0.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};G0.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};G0.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,G0);var c=p.prototype,nZ=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;c.strictDirective=function(Z){if(this.options.ecmaVersion<5)return!1;for(;;){n.lastIndex=Z,Z+=n.exec(this.input)[0].length;var Q=nZ.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==="}"||s.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===z.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===z.eof||this.type===z.braceR||s.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(z.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 A=p.prototype;A.parseTopLevel=function(Z){var Q=Object.create(null);if(!Z.body)Z.body=[];while(this.type!==z.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 k1={kind:"loop"},cZ={kind:"switch"};A.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(z0(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 K=this.input.slice(Y,X);if(!fZ.test(K))return!0}return!1};A.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!s.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))};A.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(s.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||j0(K=this.input.charCodeAt(X))||K>55295&&K<56320)return!1;n.lastIndex=X;var W=n.exec(this.input);if(W&&s.test(this.input.slice(X,X+W[0].length)))return!1}if(Q){var H=J+2,G;if(this.input.slice(J,H)==="of"){if(H===this.input.length||!j0(G=this.input.charCodeAt(H))&&!(G>55295&&G<56320))return!1}}var _=this.input.charCodeAt(J);return z0(_,!0)||_===92};A.isAwaitUsing=function(Z){return this.isUsingKeyword(!0,Z)};A.isUsing=function(Z){return this.isUsingKeyword(!1,Z)};A.parseStatement=function(Z,Q,Y){var J=this.type,X=this.startNode(),K;if(this.isLet(Z))J=z._var,K="let";switch(J){case z._break:case z._continue:return this.parseBreakContinueStatement(X,J.keyword);case z._debugger:return this.parseDebuggerStatement(X);case z._do:return this.parseDoStatement(X);case z._for:return this.parseForStatement(X);case z._function:if(Z&&(this.strict||Z!=="if"&&Z!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(X,!1,!Z);case z._class:if(Z)this.unexpected();return this.parseClass(X,!0);case z._if:return this.parseIfStatement(X);case z._return:return this.parseReturnStatement(X);case z._switch:return this.parseSwitchStatement(X);case z._throw:return this.parseThrowStatement(X);case z._try:return this.parseTryStatement(X);case z._const:case z._var:if(K=K||this.value,Z&&K!=="var")this.unexpected();return this.parseVarStatement(X,K);case z._while:return this.parseWhileStatement(X);case z._with:return this.parseWithStatement(X);case z.braceL:return this.parseBlock(!0,X);case z.semi:return this.parseEmptyStatement(X);case z._export:case z._import:if(this.options.ecmaVersion>10&&J===z._import){n.lastIndex=this.pos;var W=n.exec(this.input),H=this.pos+W[0].length,G=this.input.charCodeAt(H);if(G===40||G===46)return this.parseExpressionStatement(X,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!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===z._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===z.name&&R.type==="Identifier"&&this.eat(z.colon))return this.parseLabeledStatement(X,q,R,Z);else return this.parseExpressionStatement(X,R)}};A.parseBreakContinueStatement=function(Z,Q){var Y=Q==="break";if(this.next(),this.eat(z.semi)||this.insertSemicolon())Z.label=null;else if(this.type!==z.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")};A.parseDebuggerStatement=function(Z){return this.next(),this.semicolon(),this.finishNode(Z,"DebuggerStatement")};A.parseDoStatement=function(Z){if(this.next(),this.labels.push(k1),Z.body=this.parseStatement("do"),this.labels.pop(),this.expect(z._while),Z.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(z.semi);else this.semicolon();return this.finishNode(Z,"DoWhileStatement")};A.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(z.parenL),this.type===z.semi){if(Q>-1)this.unexpected(Q);return this.parseFor(Z,null)}var Y=this.isLet();if(this.type===z._var||this.type===z._const||Y){var J=this.startNode(),X=Y?"let":this.value;return this.next(),this.parseVar(J,!0,X),this.finishNode(J,"VariableDeclaration"),this.parseForAfterInit(Z,J,Q)}var K=this.isContextual("let"),W=!1,H=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(H){var G=this.startNode();if(this.next(),H==="await using")this.next();return this.parseVar(G,!0,H),this.finishNode(G,"VariableDeclaration"),this.parseForAfterInit(Z,G,Q)}var _=this.containsEsc,q=new Y1,R=this.start,$=Q>-1?this.parseExprSubscripts(q,"await"):this.parseExpression(!0,q);if(this.type===z._in||(W=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(Q>-1){if(this.type===z._in)this.unexpected(Q);Z.await=!0}else if(W&&this.options.ecmaVersion>=8){if($.start===R&&!_&&$.type==="Identifier"&&$.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)Z.await=!1}if(K&&W)this.raise($.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable($,!1,q),this.checkLValPattern($),this.parseForIn(Z,$)}else this.checkExpressionErrors(q,!0);if(Q>-1)this.unexpected(Q);return this.parseFor(Z,$)};A.parseForAfterInit=function(Z,Q,Y){if((this.type===z._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Q.declarations.length===1){if(this.options.ecmaVersion>=9)if(this.type===z._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)};A.parseFunctionStatement=function(Z,Q,Y){return this.next(),this.parseFunction(Z,v0|(Y?0:V1),!1,Q)};A.parseIfStatement=function(Z){return this.next(),Z.test=this.parseParenExpression(),Z.consequent=this.parseStatement("if"),Z.alternate=this.eat(z._else)?this.parseStatement("if"):null,this.finishNode(Z,"IfStatement")};A.parseReturnStatement=function(Z){if(!this.inFunction&&!this.options.allowReturnOutsideFunction)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(z.semi)||this.insertSemicolon())Z.argument=null;else Z.argument=this.parseExpression(),this.semicolon();return this.finishNode(Z,"ReturnStatement")};A.parseSwitchStatement=function(Z){this.next(),Z.discriminant=this.parseParenExpression(),Z.cases=[],this.expect(z.braceL),this.labels.push(cZ),this.enterScope(0);var Q;for(var Y=!1;this.type!==z.braceR;)if(this.type===z._case||this.type===z._default){var J=this.type===z._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(z.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")};A.parseThrowStatement=function(Z){if(this.next(),s.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 oZ=[];A.parseCatchClauseParam=function(){var Z=this.parseBindingAtom(),Q=Z.type==="Identifier";return this.enterScope(Q?G8:0),this.checkLValPattern(Z,Q?F8:U0),this.expect(z.parenR),Z};A.parseTryStatement=function(Z){if(this.next(),Z.block=this.parseBlock(),Z.handler=null,this.type===z._catch){var Q=this.startNode();if(this.next(),this.eat(z.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(z._finally)?this.parseBlock():null,!Z.handler&&!Z.finalizer)this.raise(Z.start,"Missing catch or finally clause");return this.finishNode(Z,"TryStatement")};A.parseVarStatement=function(Z,Q,Y){return this.next(),this.parseVar(Z,!1,Q,Y),this.semicolon(),this.finishNode(Z,"VariableDeclaration")};A.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")};A.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")};A.parseEmptyStatement=function(Z){return this.next(),this.finishNode(Z,"EmptyStatement")};A.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===z._switch?"switch":null;for(var G=this.labels.length-1;G>=0;G--){var _=this.labels[G];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")};A.parseExpressionStatement=function(Z,Q){return Z.expression=Q,this.semicolon(),this.finishNode(Z,"ExpressionStatement")};A.parseBlock=function(Z,Q,Y){if(Z===void 0)Z=!0;if(Q===void 0)Q=this.startNode();if(Q.body=[],this.expect(z.braceL),Z)this.enterScope(0);while(this.type!==z.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")};A.parseFor=function(Z,Q){return Z.init=Q,this.expect(z.semi),Z.test=this.type===z.semi?null:this.parseExpression(),this.expect(z.semi),Z.update=this.type===z.parenR?null:this.parseExpression(),this.expect(z.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,"ForStatement")};A.parseForIn=function(Z,Q){var Y=this.type===z._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(z.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,Y?"ForInStatement":"ForOfStatement")};A.parseVar=function(Z,Q,Y,J){Z.declarations=[],Z.kind=Y;for(;;){var X=this.startNode();if(this.parseVarId(X,Y),this.eat(z.eq))X.init=this.parseMaybeAssign(Q);else if(!J&&Y==="const"&&!(this.type===z._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!J&&(Y==="using"||Y==="await using")&&this.options.ecmaVersion>=17&&this.type!==z._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Y+" declaration");else if(!J&&X.id.type!=="Identifier"&&!(Q&&(this.type===z._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(z.comma))break}return Z};A.parseVarId=function(Z,Q){Z.id=Q==="using"||Q==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(Z.id,Q==="var"?E1:U0,!1)};var v0=1,V1=2,R8=4;A.parseFunction=function(Z,Q,Y,J,X){if(this.initFunction(Z),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!J){if(this.type===z.star&&Q&V1)this.unexpected();Z.generator=this.eat(z.star)}if(this.options.ecmaVersion>=8)Z.async=!!J;if(Q&v0){if(Z.id=Q&R8&&this.type!==z.name?null:this.parseIdent(),Z.id&&!(Q&V1))this.checkLValSimple(Z.id,this.strict||Z.generator||Z.async?this.treatFunctionsAsVar?E1:U0: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&v0))Z.id=this.type===z.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&v0?"FunctionDeclaration":"FunctionExpression")};A.parseFunctionParams=function(Z){this.expect(z.parenL),Z.params=this.parseBindingList(z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};A.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(z.braceL);while(this.type!==z.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"&&aZ(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")};A.parseClassElement=function(Z){if(this.eat(z.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(z.braceL))return this.parseClassStaticBlock(Y),Y;if(this.isClassElementNameStart()||this.type===z.star)H=!0;else J="static"}if(Y.static=H,!J&&Q>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===z.star)&&!this.canInsertSemicolon())K=!0;else J="async";if(!J&&(Q>=9||!K)&&this.eat(z.star))X=!0;if(!J&&!K&&!X){var G=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())W=G;else J=G}if(J)Y.computed=!1,Y.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Y.key.name=J,this.finishNode(Y.key,"Identifier");else this.parseClassElementName(Y);if(Q<13||this.type===z.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};A.isClassElementNameStart=function(){return this.type===z.name||this.type===z.privateId||this.type===z.num||this.type===z.string||this.type===z.bracketL||this.type.keyword};A.parseClassElementName=function(Z){if(this.type===z.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)};A.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")};A.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(z.eq))this.enterScope(f0|Z1),Z.value=this.parseMaybeAssign(),this.exitScope();else Z.value=null;return this.semicolon(),this.finishNode(Z,"PropertyDefinition")};A.parseClassStaticBlock=function(Z){Z.body=[];var Q=this.labels;this.labels=[],this.enterScope(A0|Z1);while(this.type!==z.braceR){var Y=this.parseStatement(null);Z.body.push(Y)}return this.next(),this.exitScope(),this.labels=Q,this.finishNode(Z,"StaticBlock")};A.parseClassId=function(Z,Q){if(this.type===z.name){if(Z.id=this.parseIdent(),Q)this.checkLValSimple(Z.id,U0,!1)}else{if(Q===!0)this.unexpected();Z.id=null}};A.parseClassSuper=function(Z){Z.superClass=this.eat(z._extends)?this.parseExprSubscripts(null,!1):null};A.enterClassBody=function(){var Z={declared:Object.create(null),used:[]};return this.privateNameStack.push(Z),Z.declared};A.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 aZ(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)}A.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!==z.string)this.unexpected();if(Z.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ExportAllDeclaration")};A.parseExport=function(Z,Q){if(this.next(),this.eat(z.star))return this.parseExportAllDeclaration(Z,Q);if(this.eat(z._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!==z.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")};A.parseExportDeclaration=function(Z){return this.parseStatement(null)};A.parseExportDefaultDeclaration=function(){var Z;if(this.type===z._function||(Z=this.isAsyncFunction())){var Q=this.startNode();if(this.next(),Z)this.next();return this.parseFunction(Q,v0|R8,!1,Z)}else if(this.type===z._class){var Y=this.startNode();return this.parseClass(Y,"nullableID")}else{var J=this.parseMaybeAssign();return this.semicolon(),J}};A.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};A.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 G=H[W];if(G)this.checkPatternExport(Z,G)}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)};A.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)}};A.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};A.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")};A.parseExportSpecifiers=function(Z){var Q=[],Y=!0;this.expect(z.braceL);while(!this.eat(z.braceR)){if(!Y){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Y=!1;Q.push(this.parseExportSpecifier(Z))}return Q};A.parseImport=function(Z){if(this.next(),this.type===z.string)Z.specifiers=oZ,Z.source=this.parseExprAtom();else Z.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Z.source=this.type===z.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ImportDeclaration")};A.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,U0),this.finishNode(Z,"ImportSpecifier")};A.parseImportDefaultSpecifier=function(){var Z=this.startNode();return Z.local=this.parseIdent(),this.checkLValSimple(Z.local,U0),this.finishNode(Z,"ImportDefaultSpecifier")};A.parseImportNamespaceSpecifier=function(){var Z=this.startNode();return this.next(),this.expectContextual("as"),Z.local=this.parseIdent(),this.checkLValSimple(Z.local,U0),this.finishNode(Z,"ImportNamespaceSpecifier")};A.parseImportSpecifiers=function(){var Z=[],Q=!0;if(this.type===z.name){if(Z.push(this.parseImportDefaultSpecifier()),!this.eat(z.comma))return Z}if(this.type===z.star)return Z.push(this.parseImportNamespaceSpecifier()),Z;this.expect(z.braceL);while(!this.eat(z.braceR)){if(!Q){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Q=!1;Z.push(this.parseImportSpecifier())}return Z};A.parseWithClause=function(){var Z=[];if(!this.eat(z._with))return Z;this.expect(z.braceL);var Q={},Y=!0;while(!this.eat(z.braceR)){if(!Y){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Y=!1;var J=this.parseImportAttribute(),X=J.key.type==="Identifier"?J.key.name:J.key.value;if(S0(Q,X))this.raiseRecoverable(J.key.start,"Duplicate attribute key '"+X+"'");Q[X]=!0,Z.push(J)}return Z};A.parseImportAttribute=function(){var Z=this.startNode();if(Z.key=this.type===z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(z.colon),this.type!==z.string)this.unexpected();return Z.value=this.parseExprAtom(),this.finishNode(Z,"ImportAttribute")};A.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===z.string){var Z=this.parseLiteral(this.value);if(lZ.test(Z.value))this.raise(Z.start,"An export name cannot include a lone surrogate.");return Z}return this.parseIdent(!0)};A.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)};A.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!==z.name)this.unexpected();return Z.argument=this.parseBindingAtom(),this.finishNode(Z,"RestElement")};W0.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case z.bracketL:var Z=this.startNode();return this.next(),Z.elements=this.parseBindingList(z.bracketR,!0,!0),this.finishNode(Z,"ArrayPattern");case z.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(z.comma);if(Q&&this.type===z.comma)X.push(null);else if(Y&&this.afterTrailingComma(Z))break;else if(this.type===z.ellipsis){var W=this.parseRestBinding();if(this.parseBindingListItem(W),X.push(W),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(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(z.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===U0&&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 G=H[W];if(G)this.checkLValInnerPattern(G,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===z.colon&&(Q===m.b_stat||Q===m.b_expr))return!Q.isExpr;if(Z===z._return||Z===z.name&&this.exprAllowed)return s.test(this.input.slice(this.lastTokEnd,this.start));if(Z===z._else||Z===z.semi||Z===z.eof||Z===z.parenR||Z===z.arrow)return!0;if(Z===z.braceL)return Q===m.b_stat;if(Z===z._var||Z===z._const||Z===z.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===z.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};z.parenR.updateContext=z.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};z.braceL.updateContext=function(Z){this.context.push(this.braceIsBlock(Z)?m.b_stat:m.b_expr),this.exprAllowed=!0};z.dollarBraceL.updateContext=function(){this.context.push(m.b_tmpl),this.exprAllowed=!0};z.parenL.updateContext=function(Z){var Q=Z===z._if||Z===z._for||Z===z._with||Z===z._while;this.context.push(Q?m.p_stat:m.p_expr),this.exprAllowed=!0};z.incDec.updateContext=function(){};z._function.updateContext=z._class.updateContext=function(Z){if(Z.beforeExpr&&Z!==z._else&&!(Z===z.semi&&this.curContext()!==m.p_stat)&&!(Z===z._return&&s.test(this.input.slice(this.lastTokEnd,this.start)))&&!((Z===z.colon||Z===z.braceL)&&this.curContext()===m.b_stat))this.context.push(m.f_expr);else this.context.push(m.f_stat);this.exprAllowed=!1};z.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};z.backQuote.updateContext=function(){if(this.curContext()===m.q_tmpl)this.context.pop();else this.context.push(m.q_tmpl);this.exprAllowed=!1};z.star.updateContext=function(Z){if(Z===z._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};z.name.updateContext=function(Z){var Q=!1;if(this.options.ecmaVersion>=6&&Z!==z.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())Q=!0}this.exprAllowed=Q};var E=p.prototype;E.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};E.parseExpression=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseMaybeAssign(Z,Q);if(this.type===z.comma){var K=this.startNodeAt(Y,J);K.expressions=[X];while(this.eat(z.comma))K.expressions.push(this.parseMaybeAssign(Z,Q));return this.finishNode(K,"SequenceExpression")}return X};E.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,G=this.startLoc;if(this.type===z.parenL||this.type===z.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=Z==="await";var _=this.parseMaybeConditional(Z,Q);if(Y)_=Y.call(this,_,H,G);if(this.type.isAssign){var q=this.startNodeAt(H,G);if(q.operator=this.value,this.type===z.eq)_=this.toAssignable(_,!1,Q);if(!J)Q.parenthesizedAssign=Q.trailingComma=Q.doubleProto=-1;if(Q.shorthandAssign>=_.start)Q.shorthandAssign=-1;if(this.type===z.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 _};E.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(z.question)){var K=this.startNodeAt(Y,J);return K.test=X,K.consequent=this.parseMaybeAssign(),this.expect(z.colon),K.alternate=this.parseMaybeAssign(Z),this.finishNode(K,"ConditionalExpression")}return X};E.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)};E.parseExprOp=function(Z,Q,Y,J,X){var K=this.type.binop;if(K!=null&&(!X||this.type!==z._in)){if(K>J){var W=this.type===z.logicalOR||this.type===z.logicalAND,H=this.type===z.coalesce;if(H)K=z.logicalAND.binop;var G=this.value;this.next();var _=this.start,q=this.startLoc,R=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,X),_,q,K,X),$=this.buildBinary(Q,Y,Z,R,G,W||H);if(W&&this.type===z.coalesce||H&&(this.type===z.logicalOR||this.type===z.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp($,Q,Y,J,X)}}return Z};E.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")};E.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(),G=this.type===z.incDec;if(H.operator=this.value,H.prefix=!0,this.next(),H.argument=this.parseMaybeUnary(null,!0,G,J),this.checkExpressionErrors(Z,!0),G)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,G?"UpdateExpression":"UnaryExpression")}else if(!Q&&this.type===z.privateId){if((J||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(W=this.parsePrivateIdent(),this.type!==z._in)this.unexpected()}else{if(W=this.parseExprSubscripts(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(z.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)}E.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};E.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 G=this.startNodeAt(Q,Y);G.expression=H,H=this.finishNode(G,"ChainExpression")}return H}Z=H}};E.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(z.arrow)};E.parseSubscriptAsyncArrow=function(Z,Q,Y,J){return this.parseArrowExpression(this.startNodeAt(Z,Q),Y,!0,J)};E.parseSubscript=function(Z,Q,Y,J,X,K,W){var H=this.options.ecmaVersion>=11,G=H&&this.eat(z.questionDot);if(J&&G)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var _=this.eat(z.bracketL);if(_||G&&this.type!==z.parenL&&this.type!==z.backQuote||this.eat(z.dot)){var q=this.startNodeAt(Q,Y);if(q.object=Z,_)q.property=this.parseExpression(),this.expect(z.bracketR);else if(this.type===z.privateId&&Z.type!=="Super")q.property=this.parsePrivateIdent();else q.property=this.parseIdent(this.options.allowReserved!=="never");if(q.computed=!!_,H)q.optional=G;Z=this.finishNode(q,"MemberExpression")}else if(!J&&this.eat(z.parenL)){var R=new Y1,$=this.yieldPos,O=this.awaitPos,U=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var L=this.parseExprList(z.parenR,this.options.ecmaVersion>=8,!1,R);if(X&&!G&&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=$,this.awaitPos=O,this.awaitIdentPos=U,this.parseSubscriptAsyncArrow(Q,Y,L,W)}this.checkExpressionErrors(R,!0),this.yieldPos=$||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,H)B.optional=G;Z=this.finishNode(B,"CallExpression")}else if(this.type===z.backQuote){if(G||K)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var I=this.startNodeAt(Q,Y);I.tag=Z,I.quasi=this.parseTemplate({isTagged:!0}),Z=this.finishNode(I,"TaggedTemplateExpression")}return Z};E.parseExprAtom=function(Z,Q,Y){if(this.type===z.slash)this.readRegexp();var J,X=this.potentialArrowAt===this.start;switch(this.type){case z._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(J=this.startNode(),this.next(),this.type===z.parenL&&!this.allowDirectSuper)this.raise(J.start,"super() call outside constructor of a subclass");if(this.type!==z.dot&&this.type!==z.bracketL&&this.type!==z.parenL)this.unexpected();return this.finishNode(J,"Super");case z._this:return J=this.startNode(),this.next(),this.finishNode(J,"ThisExpression");case z.name:var K=this.start,W=this.startLoc,H=this.containsEsc,G=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!H&&G.name==="async"&&!this.canInsertSemicolon()&&this.eat(z._function))return this.overrideContext(m.f_expr),this.parseFunction(this.startNodeAt(K,W),0,!1,!0,Q);if(X&&!this.canInsertSemicolon()){if(this.eat(z.arrow))return this.parseArrowExpression(this.startNodeAt(K,W),[G],!1,Q);if(this.options.ecmaVersion>=8&&G.name==="async"&&this.type===z.name&&!H&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(G=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(z.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(K,W),[G],!0,Q)}}return G;case z.regexp:var _=this.value;return J=this.parseLiteral(_.value),J.regex={pattern:_.pattern,flags:_.flags},J;case z.num:case z.string:return this.parseLiteral(this.value);case z._null:case z._true:case z._false:return J=this.startNode(),J.value=this.type===z._null?null:this.type===z._true,J.raw=this.type.keyword,this.next(),this.finishNode(J,"Literal");case z.parenL:var 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 z.bracketL:return J=this.startNode(),this.next(),J.elements=this.parseExprList(z.bracketR,!0,!0,Z),this.finishNode(J,"ArrayExpression");case z.braceL:return this.overrideContext(m.b_expr),this.parseObj(!1,Z);case z._function:return J=this.startNode(),this.next(),this.parseFunction(J,0);case z._class:return this.parseClass(this.startNode(),!1);case z._new:return this.parseNew();case z.backQuote:return this.parseTemplate();case z._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Y);else return this.unexpected();default:return this.parseExprAtomDefault()}};E.parseExprAtomDefault=function(){this.unexpected()};E.parseExprImport=function(Z){var Q=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===z.parenL&&!Z)return this.parseDynamicImport(Q);else if(this.type===z.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()};E.parseDynamicImport=function(Z){if(this.next(),Z.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(z.parenR))if(this.expect(z.comma),!this.afterTrailingComma(z.parenR)){if(Z.options=this.parseMaybeAssign(),!this.eat(z.parenR)){if(this.expect(z.comma),!this.afterTrailingComma(z.parenR))this.unexpected()}}else Z.options=null;else Z.options=null;else if(!this.eat(z.parenR)){var Q=this.start;if(this.eat(z.comma)&&this.eat(z.parenR))this.raiseRecoverable(Q,"Trailing comma is not allowed in import()");else this.unexpected(Q)}return this.finishNode(Z,"ImportExpression")};E.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")};E.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")};E.parseParenExpression=function(){this.expect(z.parenL);var Z=this.parseExpression();return this.expect(z.parenR),Z};E.shouldParseArrow=function(Z){return!this.canInsertSemicolon()};E.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,G=[],_=!0,q=!1,R=new Y1,$=this.yieldPos,O=this.awaitPos,U;this.yieldPos=0,this.awaitPos=0;while(this.type!==z.parenR)if(_?_=!1:this.expect(z.comma),K&&this.afterTrailingComma(z.parenR,!0)){q=!0;break}else if(this.type===z.ellipsis){if(U=this.start,G.push(this.parseParenItem(this.parseRestBinding())),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else G.push(this.parseMaybeAssign(!1,R,this.parseParenItem));var L=this.lastTokEnd,B=this.lastTokEndLoc;if(this.expect(z.parenR),Z&&this.shouldParseArrow(G)&&this.eat(z.arrow))return this.checkPatternErrors(R,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=$,this.awaitPos=O,this.parseParenArrowList(Y,J,G,Q);if(!G.length||q)this.unexpected(this.lastTokStart);if(U)this.unexpected(U);if(this.checkExpressionErrors(R,!0),this.yieldPos=$||this.yieldPos,this.awaitPos=O||this.awaitPos,G.length>1)X=this.startNodeAt(W,H),X.expressions=G,this.finishNodeAt(X,"SequenceExpression",L,B);else X=G[0]}else X=this.parseParenExpression();if(this.options.preserveParens){var I=this.startNodeAt(Y,J);return I.expression=X,this.finishNode(I,"ParenthesizedExpression")}else return X};E.parseParenItem=function(Z){return Z};E.parseParenArrowList=function(Z,Q,Y,J){return this.parseArrowExpression(this.startNodeAt(Z,Q),Y,!1,J)};var sZ=[];E.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===z.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(z.parenL))Z.arguments=this.parseExprList(z.parenR,this.options.ecmaVersion>=8,!1);else Z.arguments=sZ;return this.finishNode(Z,"NewExpression")};E.parseTemplateElement=function(Z){var Q=Z.isTagged,Y=this.startNode();if(this.type===z.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 F,validate as O1,filter as p1}from"tosijs-schema";var p0=Symbol.for("tjs.equals");function c0(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)=>c0(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)=>c0(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 V9(Z){return Z instanceof o||Z&&Z.$error===!0}var C0=new Map,D9=3600000,T9=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 C9(){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 P9=new Set(["localhost","127.0.0.1","0.0.0.0","[::1]","metadata.google.internal"]);function S9(Z){try{let Q=new URL(Z);if(Q.protocol!=="http:"&&Q.protocol!=="https:")return!0;let Y=Q.hostname.toLowerCase();if(P9.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 b9(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 E9(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 l(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:{...F,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:G=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(G)q.setSeconds(q.getSeconds()+G);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."},k9=0.01,x1=0.0001,m1=0.001,v9=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 l(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-=k9,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=l(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=l(Z.left,Q),J=l(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 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=l(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=l(Z.left,Q);if(Z.op==="&&")return Y?l(Z.right,Q):Y;else if(Z.op==="??")return Y??l(Z.right,Q);else return Y?Y:l(Z.right,Q)}case"conditional":return l(Z.test,Q)?l(Z.consequent,Q):l(Z.alternate,Q);case"array":return Z.elements.map((Y)=>l(Y,Q));case"object":{let Y={};for(let J of Z.properties)Y[J.key]=l(J.value,Q);return Y}case"call":{if(Z.callee==="Error"){let J=Z.arguments.map((K)=>l(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)=>l(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=l(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)=>l(H,Q)),W=X.apply(Y,K);if(Q.fuel&&v9.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 T(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:$,...O}=_;if(q.error)return;let U=q.trace?{...q.state}:null,L=q.fuel.current,B,I;try{let V=q.costOverrides?.[Z],j=V!==void 0?V:H,N=typeof j==="function"?j(O,q):j;if((q.fuel.current-=N)<=0){q.error=new o("Out of Fuel",Z);return}let S,P=async()=>J(_,q);if(B=W>0?await Promise.race([P(),new Promise((D,C)=>{S=setTimeout(()=>C(Error(`Atom '${Z}' timed out`)),W)})]).finally(()=>clearTimeout(S)):await P(),_.result){if(q.consts.has(_.result))throw Error(`Cannot reassign const variable '${_.result}'`);if(B!==void 0&&Y&&!O1(B,Y)){q.error=new o(`Output validation failed for '${Z}'`,Z);return}if(q.state[_.result]=B,_.resultConst)q.consts.add(_.result)}}catch(V){I=V.message||String(V),q.error=new o(I,Z,V)}finally{if(q.trace&&U){let V=E9(U,q.state);q.trace.push({op:Z,input:O,stateDiff:V,result:B,error:I,fuelBefore:L,fuelAfter:q.fuel.current,timestamp:new Date().toISOString()})}}},docs:K,timeoutMs:W,cost:H,create:(_)=>({op:Z,..._})}}var Q0=T("seq",F.object({steps:F.array(F.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}),g9=T("if",F.object({condition:F.any,then:F.array(F.any),else:F.array(F.any).optional}),void 0,async(Z,Q)=>{if(l(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}),y9=T("while",F.object({condition:F.any,body:F.array(F.any)}),void 0,async(Z,Q)=>{while(l(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}),f9=T("return",void 0,F.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&&!V9(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}),h9=T("try",F.object({try:F.array(F.any),catch:F.array(F.any).optional,catchParam:F.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}),x9=T("Error",F.object({args:F.array(F.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}),m9=T("varSet",F.object({key:F.string,value:F.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}),u9=T("constSet",F.object({key:F.string,value:F.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}),d9=T("varGet",F.object({key:F.string}),F.any,async({key:Z},Q)=>{return M(Z,Q)},{docs:"Get Variable",cost:0.1}),l9=T("varsImport",F.object({keys:F.union([F.array(F.string),F.record(F.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}),p9=T("varsLet",F.record(F.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}),i9=T("varsExport",F.object({keys:F.union([F.array(F.string),F.record(F.string)])}),F.record(F.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}),c9=T("scope",F.object({steps:F.array(F.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}),n9=T("map",F.object({items:F.array(F.any),as:F.string,steps:F.array(F.any)}),F.array(F.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}),o9=T("filter",F.object({items:F.array(F.any),as:F.string,condition:F.any}),F.array(F.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,l(Y,H))X.push(W)}return X},{docs:"Filter Array",timeoutMs:0,cost:1}),a9=T("reduce",F.object({items:F.array(F.any),as:F.string,accumulator:F.string,initial:F.any,steps:F.array(F.any)}),F.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 G=H;for(let _ of W){if(K.signal?.aborted)throw Error("Execution aborted");let q=B0(K);q.state[Q]=_,q.state[Y]=G,await Q0.exec({op:"seq",steps:X},q),G=q.state.result??G}return G},{docs:"Reduce Array",timeoutMs:0,cost:1}),s9=T("find",F.object({items:F.array(F.any),as:F.string,condition:F.any}),F.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,l(Y,W))return K}return null},{docs:"Find in Array",timeoutMs:0,cost:1}),r9=T("push",F.object({list:F.array(F.any),item:F.any}),F.array(F.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}),t9=T("len",F.object({list:F.any}),F.number,async({list:Z},Q)=>{let Y=M(Z,Q);return Array.isArray(Y)||typeof Y==="string"?Y.length:0},{docs:"Length",cost:1}),e9=T("split",F.object({str:F.string,sep:F.string}),F.array(F.string),async({str:Z,sep:Q},Y)=>M(Z,Y).split(M(Q,Y)),{docs:"Split String",cost:1}),ZZ=T("join",F.object({list:F.array(F.string),sep:F.string}),F.string,async({list:Z,sep:Q},Y)=>M(Z,Y).join(M(Q,Y)),{docs:"Join String",cost:1}),QZ=T("template",F.object({tmpl:F.string,vars:F.record(F.any)}),F.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}),YZ=T("regexMatch",F.object({pattern:F.string,value:F.any}),F.boolean,async({pattern:Z,value:Q},Y)=>{if(b9(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}),JZ=T("pick",F.object({obj:F.record(F.any),keys:F.array(F.string)}),F.record(F.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}),XZ=T("omit",F.object({obj:F.record(F.any),keys:F.array(F.string)}),F.record(F.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}),WZ=T("merge",F.object({a:F.record(F.any),b:F.record(F.any)}),F.record(F.any),async({a:Z,b:Q},Y)=>({...M(Z,Y),...M(Q,Y)}),{docs:"Merge Objects",cost:1}),KZ=T("keys",F.object({obj:F.record(F.any)}),F.array(F.string),async({obj:Z},Q)=>Object.keys(M(Z,Q)??{}),{docs:"Object Keys",cost:1}),u1=10,d1="X-Agent-Depth";function HZ(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 zZ=T("httpFetch",F.object({url:F.string,method:F.string.optional,headers:F.record(F.string).optional,body:F.any.optional,responseType:F.string.optional}),F.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,[d1]:String(H+1)},body:K,signal:Q.signal,responseType:W});let G=Q.context?.allowedFetchDomains;if(G){if(!HZ(Y,G))throw Error(`Fetch blocked: domain not in allowlist. Allowed: ${G.join(", ")}`)}else{if(S9(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(H+1)},body:K?JSON.stringify(K):void 0,signal:Q.signal});if(W==="dataUrl"){let R=await _.arrayBuffer(),$=new Uint8Array(R),O="";for(let B=0;B<$.length;B++)O+=String.fromCharCode($[B]);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}),GZ=T("storeGet",F.object({key:F.string}),F.any,async({key:Z},Q)=>{let Y=M(Z,Q);return Q.capabilities.store?.get(Y)},{docs:"Store Get",cost:5}),_Z=T("storeSet",F.object({key:F.string,value:F.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}),qZ=T("storeQuery",F.object({query:F.any}),F.array(F.any),async({query:Z},Q)=>Q.capabilities.store?.query?.(M(Z,Q))??[],{docs:"Store Query",cost:5}),FZ=T("storeVectorSearch",F.object({collection:F.string.optional,vector:F.array(F.number),k:F.number.optional}),F.array(F.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)}),$Z=T("llmPredict",F.object({prompt:F.string,options:F.any.optional}),F.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}),RZ=T("agentRun",F.object({agentId:F.any,input:F.any}),F.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),G={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},_=Y.resolver("seq");if(!_)throw Error("seq atom not found");if(await _.exec(H,G),G.error)throw Error(G.error.message||"Sub-agent failed");return G.output}if(J&&typeof J==="object"&&"op"in J){let H={...Y,args:K,state:{},consts:new Set,output:void 0,error:void 0},G=Y.resolver("seq");if(!G)throw Error("seq atom not found");if(await G.exec(J,H),H.error)throw Error(H.error.message||"Sub-agent failed");return H.output}if(!Y.capabilities.agent?.run)throw Error("Capability 'agent.run' missing");let W=await Y.capabilities.agent.run(J,K);if(W&&typeof W==="object"&&"fuelUsed"in W&&typeof W.fuelUsed==="number"){if(W.error)throw Error(W.error.message||"Sub-agent failed");return W.result}return W},{docs:"Run Sub-Agent (accepts procedure token, AST, or agent ID)",cost:1}),OZ=T("transpileCode",F.object({code:F.string}),F.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}),l1=10,UZ=T("runCode",F.object({code:F.string,args:F.record(F.any).optional}),F.any,async({code:Z,args:Q},Y)=>{let J=Y.runCodeDepth??0;if(J>=l1)throw Error(`runCode recursion limit exceeded (max ${l1}). 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(G){throw Error(`Code transpilation failed: ${G.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}),IZ=T("jsonParse",F.object({str:F.string}),F.any,async({str:Z},Q)=>JSON.parse(M(Z,Q)),{docs:"Parse JSON",cost:1}),MZ=T("jsonStringify",F.object({value:F.any}),F.string,async({value:Z},Q)=>JSON.stringify(M(Z,Q)),{docs:"Stringify JSON",cost:1}),BZ=T("xmlParse",F.object({str:F.string}),F.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}),LZ=T("memoize",F.object({key:F.string.optional,steps:F.array(F.any)}),F.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}),jZ=T("cache",F.object({key:F.string.optional,steps:F.array(F.any),ttlMs:F.number.optional}),F.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 G=H.output??H.state.result,_=Date.now()+(Y??86400000);if((J.fuel.current-=5)<=0)throw Error("Out of Fuel");return await J.capabilities.store.set(K,{val:G,_exp:_}),G},{docs:"Cache steps result in store with TTL",cost:5}),NZ=T("random",F.object({min:F.number.optional,max:F.number.optional,format:F.string.optional,length:F.number.optional}),F.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,G=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 L=0;L<W;L++)O+="0123456789abcdefghijklmnopqrstuvwxyz"[U[L]%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 $=new Uint32Array(1);crypto.getRandomValues($),_=$[0]/4294967296}else _=Math.random();let q=G-H,R=_*q+H;if(K==="integer")return Math.floor(R);return R},{docs:"Generate Random",cost:1}),wZ=T("uuid",void 0,F.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=T("hash",F.object({value:F.any,algorithm:F.string.optional}),F.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),G=await crypto.subtle.digest(X,H);return Array.from(new Uint8Array(G)).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}),AZ=T("consoleLog",F.object({message:F.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}),VZ=T("consoleWarn",F.object({message:F.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}),DZ=T("consoleError",F.object({message:F.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}),TZ=T("storeProcedure",F.object({ast:F.any,ttl:F.number.optional,maxSize:F.number.optional}),F.string,async({ast:Z,ttl:Q,maxSize:Y},J)=>{let X=M(Z,J),K=Q?M(Q,J):D9,W=Y?M(Y,J):T9;if(!X||typeof X!=="object"||!X.op)throw Error('Invalid AST: must be an object with an "op" property');let H=JSON.stringify(X);if(H.length>W)throw Error(`AST too large: ${H.length} bytes exceeds limit of ${W} bytes. Consider reducing AST size or using a shorter TTL.`);let G=C9(),_=Date.now();return C0.set(G,{ast:X,createdAt:_,expiresAt:_+K}),G},{docs:"Store an AST and return a token for later execution",cost:1}),CZ=T("releaseProcedure",F.object({token:F.string}),F.boolean,async({token:Z},Q)=>{let Y=M(Z,Q);return C0.delete(Y)},{docs:"Release a stored procedure by token",cost:0.1}),PZ=T("clearExpiredProcedures",void 0,F.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:g9,while:y9,return:f9,try:h9,Error:x9,varSet:m9,constSet:u9,varGet:d9,varsImport:l9,varsLet:p9,varsExport:i9,scope:c9,map:n9,filter:o9,reduce:a9,find:s9,push:r9,len:t9,split:e9,join:ZZ,template:QZ,regexMatch:YZ,pick:JZ,omit:XZ,merge:WZ,keys:KZ,httpFetch:zZ,storeGet:GZ,storeSet:_Z,storeQuery:qZ,storeVectorSearch:FZ,llmPredict:$Z,agentRun:RZ,transpileCode:OZ,runCode:UZ,jsonParse:IZ,jsonStringify:MZ,xmlParse:BZ,memoize:LZ,cache:jZ,random:NZ,uuid:wZ,hash:B1,consoleLog:AZ,consoleWarn:VZ,consoleError:DZ,storeProcedure:TZ,releaseProcedure:CZ,clearExpiredProcedures:PZ};var SZ=new Set(["true","false","null","undefined","and","or","not"]);function bZ(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((G)=>!SZ.has(G)&&!(G in Q)&&!new RegExp(`\\b${G}\\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 n0(Z,Q){bZ(Z,Q);let Y=EZ(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 EZ(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 kZ(Z,Q,Y)}function kZ(Z,Q,Y){let{node:J,pos:X}=n1(Z,Q,Y);while(Z[X]==="||"){X++;let{node:K,pos:W}=n1(Z,X,Y);J={$expr:"logical",op:"||",left:J,right:K},X=W}return{node:J,pos:X}}function n1(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:G}=a1(Z,X,Y);J={$expr:"binary",op:W,left:J,right:H},X=G}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 vZ(Z,Q,Y)}function vZ(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 G=new a(this.atoms);J(G),K=G.steps}let W=n0(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=n0(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=n0(Y,J),K=this.atoms.filter;return this.add(K.create({items:Z,as:Q,condition:X}))}find(Z,Q,Y,J={}){let X=n0(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 n6}from"tosijs-schema";var gZ=[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],yZ="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",J8="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",j1={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"},N1="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",fZ={5:N1,"5module":N1+" export import",6:N1+" const class extends export import super"},hZ=/^in(stanceof)?$/,xZ=new RegExp("["+J8+"]"),mZ=new RegExp("["+J8+yZ+"]");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&&xZ.test(String.fromCharCode(Z));if(Q===!1)return!1;return w1(Z,Y8)}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&&mZ.test(String.fromCharCode(Z));if(Q===!1)return!1;return w1(Z,Y8)||w1(Z,gZ)}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 z={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/,uZ=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]/,c=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,K8=Object.prototype,dZ=K8.hasOwnProperty,lZ=K8.toString,S0=Object.hasOwn||function(Z,Q){return dZ.call(Z,Q)},t1=Array.isArray||function(Z){return lZ.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 pZ=/(?:[\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 iZ(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=cZ(Q,Q.onComment);return Q}function cZ(Z,Q){return function(Y,J,X,K,W,H){var G={type:Y?"Block":"Line",value:J,start:X,end:K};if(Z.locations)G.loc=new e0(this,W,H);if(Z.ranges)G.range=[X,K];Q.push(G)}}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=iZ(Q),this.sourceFile=Q.sourceFile,this.keywords=L0(fZ[Q.ecmaVersion>=6?6:Q.sourceType==="module"?"5module":5]);var X="";if(Q.allowReserved!==!0){if(X=j1[Q.ecmaVersion>=6?6:Q.ecmaVersion===5?5:3],Q.sourceType==="module")X+=" await"}this.reservedWords=L0(X);var K=(X?X+" ":"")+j1.strict;if(this.reservedWordsStrict=L0(K),this.reservedWordsStrictBind=L0(K+" "+j1.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=z.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule=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 n=p.prototype,nZ=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;n.strictDirective=function(Z){if(this.options.ecmaVersion<5)return!1;for(;;){c.lastIndex=Z,Z+=c.exec(this.input)[0].length;var Q=nZ.exec(this.input.slice(Z));if(!Q)return!1;if((Q[1]||Q[2])==="use strict"){c.lastIndex=Z+Q[0].length;var Y=c.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,c.lastIndex=Z,Z+=c.exec(this.input)[0].length,this.input[Z]===";")Z++}};n.eat=function(Z){if(this.type===Z)return this.next(),!0;else return!1};n.isContextual=function(Z){return this.type===z.name&&this.value===Z&&!this.containsEsc};n.eatContextual=function(Z){if(!this.isContextual(Z))return!1;return this.next(),!0};n.expectContextual=function(Z){if(!this.eatContextual(Z))this.unexpected()};n.canInsertSemicolon=function(){return this.type===z.eof||this.type===z.braceR||r.test(this.input.slice(this.lastTokEnd,this.start))};n.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon)this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc);return!0}};n.semicolon=function(){if(!this.eat(z.semi)&&!this.insertSemicolon())this.unexpected()};n.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}};n.expect=function(Z){this.eat(Z)||this.unexpected()};n.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};n.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")};n.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")};n.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")};n.isSimpleAssignTarget=function(Z){if(Z.type==="ParenthesizedExpression")return this.isSimpleAssignTarget(Z.expression);return Z.type==="Identifier"||Z.type==="MemberExpression"};var A=p.prototype;A.parseTopLevel=function(Z){var Q=Object.create(null);if(!Z.body)Z.body=[];while(this.type!==z.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 k1={kind:"loop"},oZ={kind:"switch"};A.isLet=function(Z){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;c.lastIndex=this.pos;var Q=c.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 K=this.input.slice(Y,X);if(!hZ.test(K))return!0}return!1};A.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;c.lastIndex=this.pos;var Z=c.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||!(j0(Y=this.input.charCodeAt(Q+8))||Y>55295&&Y<56320))};A.isUsingKeyword=function(Z,Q){if(this.options.ecmaVersion<17||!this.isContextual(Z?"await":"using"))return!1;c.lastIndex=this.pos;var Y=c.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||j0(K=this.input.charCodeAt(X))||K>55295&&K<56320)return!1;c.lastIndex=X;var W=c.exec(this.input);if(W&&r.test(this.input.slice(X,X+W[0].length)))return!1}if(Q){var H=J+2,G;if(this.input.slice(J,H)==="of"){if(H===this.input.length||!j0(G=this.input.charCodeAt(H))&&!(G>55295&&G<56320))return!1}}var _=this.input.charCodeAt(J);return G0(_,!0)||_===92};A.isAwaitUsing=function(Z){return this.isUsingKeyword(!0,Z)};A.isUsing=function(Z){return this.isUsingKeyword(!1,Z)};A.parseStatement=function(Z,Q,Y){var J=this.type,X=this.startNode(),K;if(this.isLet(Z))J=z._var,K="let";switch(J){case z._break:case z._continue:return this.parseBreakContinueStatement(X,J.keyword);case z._debugger:return this.parseDebuggerStatement(X);case z._do:return this.parseDoStatement(X);case z._for:return this.parseForStatement(X);case z._function:if(Z&&(this.strict||Z!=="if"&&Z!=="label")&&this.options.ecmaVersion>=6)this.unexpected();return this.parseFunctionStatement(X,!1,!Z);case z._class:if(Z)this.unexpected();return this.parseClass(X,!0);case z._if:return this.parseIfStatement(X);case z._return:return this.parseReturnStatement(X);case z._switch:return this.parseSwitchStatement(X);case z._throw:return this.parseThrowStatement(X);case z._try:return this.parseTryStatement(X);case z._const:case z._var:if(K=K||this.value,Z&&K!=="var")this.unexpected();return this.parseVarStatement(X,K);case z._while:return this.parseWhileStatement(X);case z._with:return this.parseWithStatement(X);case z.braceL:return this.parseBlock(!0,X);case z.semi:return this.parseEmptyStatement(X);case z._export:case z._import:if(this.options.ecmaVersion>10&&J===z._import){c.lastIndex=this.pos;var W=c.exec(this.input),H=this.pos+W[0].length,G=this.input.charCodeAt(H);if(G===40||G===46)return this.parseExpressionStatement(X,this.parseExpression())}if(!this.options.allowImportExportEverywhere){if(!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===z._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===z.name&&R.type==="Identifier"&&this.eat(z.colon))return this.parseLabeledStatement(X,q,R,Z);else return this.parseExpressionStatement(X,R)}};A.parseBreakContinueStatement=function(Z,Q){var Y=Q==="break";if(this.next(),this.eat(z.semi)||this.insertSemicolon())Z.label=null;else if(this.type!==z.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")};A.parseDebuggerStatement=function(Z){return this.next(),this.semicolon(),this.finishNode(Z,"DebuggerStatement")};A.parseDoStatement=function(Z){if(this.next(),this.labels.push(k1),Z.body=this.parseStatement("do"),this.labels.pop(),this.expect(z._while),Z.test=this.parseParenExpression(),this.options.ecmaVersion>=6)this.eat(z.semi);else this.semicolon();return this.finishNode(Z,"DoWhileStatement")};A.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(z.parenL),this.type===z.semi){if(Q>-1)this.unexpected(Q);return this.parseFor(Z,null)}var Y=this.isLet();if(this.type===z._var||this.type===z._const||Y){var J=this.startNode(),X=Y?"let":this.value;return this.next(),this.parseVar(J,!0,X),this.finishNode(J,"VariableDeclaration"),this.parseForAfterInit(Z,J,Q)}var K=this.isContextual("let"),W=!1,H=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(H){var G=this.startNode();if(this.next(),H==="await using")this.next();return this.parseVar(G,!0,H),this.finishNode(G,"VariableDeclaration"),this.parseForAfterInit(Z,G,Q)}var _=this.containsEsc,q=new Y1,R=this.start,$=Q>-1?this.parseExprSubscripts(q,"await"):this.parseExpression(!0,q);if(this.type===z._in||(W=this.options.ecmaVersion>=6&&this.isContextual("of"))){if(Q>-1){if(this.type===z._in)this.unexpected(Q);Z.await=!0}else if(W&&this.options.ecmaVersion>=8){if($.start===R&&!_&&$.type==="Identifier"&&$.name==="async")this.unexpected();else if(this.options.ecmaVersion>=9)Z.await=!1}if(K&&W)this.raise($.start,"The left-hand side of a for-of loop may not start with 'let'.");return this.toAssignable($,!1,q),this.checkLValPattern($),this.parseForIn(Z,$)}else this.checkExpressionErrors(q,!0);if(Q>-1)this.unexpected(Q);return this.parseFor(Z,$)};A.parseForAfterInit=function(Z,Q,Y){if((this.type===z._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&Q.declarations.length===1){if(this.options.ecmaVersion>=9)if(this.type===z._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)};A.parseFunctionStatement=function(Z,Q,Y){return this.next(),this.parseFunction(Z,v0|(Y?0:V1),!1,Q)};A.parseIfStatement=function(Z){return this.next(),Z.test=this.parseParenExpression(),Z.consequent=this.parseStatement("if"),Z.alternate=this.eat(z._else)?this.parseStatement("if"):null,this.finishNode(Z,"IfStatement")};A.parseReturnStatement=function(Z){if(!this.inFunction&&!this.options.allowReturnOutsideFunction)this.raise(this.start,"'return' outside of function");if(this.next(),this.eat(z.semi)||this.insertSemicolon())Z.argument=null;else Z.argument=this.parseExpression(),this.semicolon();return this.finishNode(Z,"ReturnStatement")};A.parseSwitchStatement=function(Z){this.next(),Z.discriminant=this.parseParenExpression(),Z.cases=[],this.expect(z.braceL),this.labels.push(oZ),this.enterScope(0);var Q;for(var Y=!1;this.type!==z.braceR;)if(this.type===z._case||this.type===z._default){var J=this.type===z._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(z.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")};A.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 aZ=[];A.parseCatchClauseParam=function(){var Z=this.parseBindingAtom(),Q=Z.type==="Identifier";return this.enterScope(Q?G8:0),this.checkLValPattern(Z,Q?F8:I0),this.expect(z.parenR),Z};A.parseTryStatement=function(Z){if(this.next(),Z.block=this.parseBlock(),Z.handler=null,this.type===z._catch){var Q=this.startNode();if(this.next(),this.eat(z.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(z._finally)?this.parseBlock():null,!Z.handler&&!Z.finalizer)this.raise(Z.start,"Missing catch or finally clause");return this.finishNode(Z,"TryStatement")};A.parseVarStatement=function(Z,Q,Y){return this.next(),this.parseVar(Z,!1,Q,Y),this.semicolon(),this.finishNode(Z,"VariableDeclaration")};A.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")};A.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")};A.parseEmptyStatement=function(Z){return this.next(),this.finishNode(Z,"EmptyStatement")};A.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===z._switch?"switch":null;for(var G=this.labels.length-1;G>=0;G--){var _=this.labels[G];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")};A.parseExpressionStatement=function(Z,Q){return Z.expression=Q,this.semicolon(),this.finishNode(Z,"ExpressionStatement")};A.parseBlock=function(Z,Q,Y){if(Z===void 0)Z=!0;if(Q===void 0)Q=this.startNode();if(Q.body=[],this.expect(z.braceL),Z)this.enterScope(0);while(this.type!==z.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")};A.parseFor=function(Z,Q){return Z.init=Q,this.expect(z.semi),Z.test=this.type===z.semi?null:this.parseExpression(),this.expect(z.semi),Z.update=this.type===z.parenR?null:this.parseExpression(),this.expect(z.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,"ForStatement")};A.parseForIn=function(Z,Q){var Y=this.type===z._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(z.parenR),Z.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(Z,Y?"ForInStatement":"ForOfStatement")};A.parseVar=function(Z,Q,Y,J){Z.declarations=[],Z.kind=Y;for(;;){var X=this.startNode();if(this.parseVarId(X,Y),this.eat(z.eq))X.init=this.parseMaybeAssign(Q);else if(!J&&Y==="const"&&!(this.type===z._in||this.options.ecmaVersion>=6&&this.isContextual("of")))this.unexpected();else if(!J&&(Y==="using"||Y==="await using")&&this.options.ecmaVersion>=17&&this.type!==z._in&&!this.isContextual("of"))this.raise(this.lastTokEnd,"Missing initializer in "+Y+" declaration");else if(!J&&X.id.type!=="Identifier"&&!(Q&&(this.type===z._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(z.comma))break}return Z};A.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 v0=1,V1=2,R8=4;A.parseFunction=function(Z,Q,Y,J,X){if(this.initFunction(Z),this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!J){if(this.type===z.star&&Q&V1)this.unexpected();Z.generator=this.eat(z.star)}if(this.options.ecmaVersion>=8)Z.async=!!J;if(Q&v0){if(Z.id=Q&R8&&this.type!==z.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&v0))Z.id=this.type===z.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&v0?"FunctionDeclaration":"FunctionExpression")};A.parseFunctionParams=function(Z){this.expect(z.parenL),Z.params=this.parseBindingList(z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};A.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(z.braceL);while(this.type!==z.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"&&sZ(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")};A.parseClassElement=function(Z){if(this.eat(z.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(z.braceL))return this.parseClassStaticBlock(Y),Y;if(this.isClassElementNameStart()||this.type===z.star)H=!0;else J="static"}if(Y.static=H,!J&&Q>=8&&this.eatContextual("async"))if((this.isClassElementNameStart()||this.type===z.star)&&!this.canInsertSemicolon())K=!0;else J="async";if(!J&&(Q>=9||!K)&&this.eat(z.star))X=!0;if(!J&&!K&&!X){var G=this.value;if(this.eatContextual("get")||this.eatContextual("set"))if(this.isClassElementNameStart())W=G;else J=G}if(J)Y.computed=!1,Y.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),Y.key.name=J,this.finishNode(Y.key,"Identifier");else this.parseClassElementName(Y);if(Q<13||this.type===z.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};A.isClassElementNameStart=function(){return this.type===z.name||this.type===z.privateId||this.type===z.num||this.type===z.string||this.type===z.bracketL||this.type.keyword};A.parseClassElementName=function(Z){if(this.type===z.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)};A.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")};A.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(z.eq))this.enterScope(f0|Z1),Z.value=this.parseMaybeAssign(),this.exitScope();else Z.value=null;return this.semicolon(),this.finishNode(Z,"PropertyDefinition")};A.parseClassStaticBlock=function(Z){Z.body=[];var Q=this.labels;this.labels=[],this.enterScope(A0|Z1);while(this.type!==z.braceR){var Y=this.parseStatement(null);Z.body.push(Y)}return this.next(),this.exitScope(),this.labels=Q,this.finishNode(Z,"StaticBlock")};A.parseClassId=function(Z,Q){if(this.type===z.name){if(Z.id=this.parseIdent(),Q)this.checkLValSimple(Z.id,I0,!1)}else{if(Q===!0)this.unexpected();Z.id=null}};A.parseClassSuper=function(Z){Z.superClass=this.eat(z._extends)?this.parseExprSubscripts(null,!1):null};A.enterClassBody=function(){var Z={declared:Object.create(null),used:[]};return this.privateNameStack.push(Z),Z.declared};A.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 sZ(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)}A.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!==z.string)this.unexpected();if(Z.source=this.parseExprAtom(),this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ExportAllDeclaration")};A.parseExport=function(Z,Q){if(this.next(),this.eat(z.star))return this.parseExportAllDeclaration(Z,Q);if(this.eat(z._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!==z.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")};A.parseExportDeclaration=function(Z){return this.parseStatement(null)};A.parseExportDefaultDeclaration=function(){var Z;if(this.type===z._function||(Z=this.isAsyncFunction())){var Q=this.startNode();if(this.next(),Z)this.next();return this.parseFunction(Q,v0|R8,!1,Z)}else if(this.type===z._class){var Y=this.startNode();return this.parseClass(Y,"nullableID")}else{var J=this.parseMaybeAssign();return this.semicolon(),J}};A.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};A.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 G=H[W];if(G)this.checkPatternExport(Z,G)}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)};A.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)}};A.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};A.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")};A.parseExportSpecifiers=function(Z){var Q=[],Y=!0;this.expect(z.braceL);while(!this.eat(z.braceR)){if(!Y){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Y=!1;Q.push(this.parseExportSpecifier(Z))}return Q};A.parseImport=function(Z){if(this.next(),this.type===z.string)Z.specifiers=aZ,Z.source=this.parseExprAtom();else Z.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),Z.source=this.type===z.string?this.parseExprAtom():this.unexpected();if(this.options.ecmaVersion>=16)Z.attributes=this.parseWithClause();return this.semicolon(),this.finishNode(Z,"ImportDeclaration")};A.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")};A.parseImportDefaultSpecifier=function(){var Z=this.startNode();return Z.local=this.parseIdent(),this.checkLValSimple(Z.local,I0),this.finishNode(Z,"ImportDefaultSpecifier")};A.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")};A.parseImportSpecifiers=function(){var Z=[],Q=!0;if(this.type===z.name){if(Z.push(this.parseImportDefaultSpecifier()),!this.eat(z.comma))return Z}if(this.type===z.star)return Z.push(this.parseImportNamespaceSpecifier()),Z;this.expect(z.braceL);while(!this.eat(z.braceR)){if(!Q){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Q=!1;Z.push(this.parseImportSpecifier())}return Z};A.parseWithClause=function(){var Z=[];if(!this.eat(z._with))return Z;this.expect(z.braceL);var Q={},Y=!0;while(!this.eat(z.braceR)){if(!Y){if(this.expect(z.comma),this.afterTrailingComma(z.braceR))break}else Y=!1;var J=this.parseImportAttribute(),X=J.key.type==="Identifier"?J.key.name:J.key.value;if(S0(Q,X))this.raiseRecoverable(J.key.start,"Duplicate attribute key '"+X+"'");Q[X]=!0,Z.push(J)}return Z};A.parseImportAttribute=function(){var Z=this.startNode();if(Z.key=this.type===z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(z.colon),this.type!==z.string)this.unexpected();return Z.value=this.parseExprAtom(),this.finishNode(Z,"ImportAttribute")};A.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===z.string){var Z=this.parseLiteral(this.value);if(pZ.test(Z.value))this.raise(Z.start,"An export name cannot include a lone surrogate.");return Z}return this.parseIdent(!0)};A.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)};A.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!==z.name)this.unexpected();return Z.argument=this.parseBindingAtom(),this.finishNode(Z,"RestElement")};W0.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case z.bracketL:var Z=this.startNode();return this.next(),Z.elements=this.parseBindingList(z.bracketR,!0,!0),this.finishNode(Z,"ArrayPattern");case z.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(z.comma);if(Q&&this.type===z.comma)X.push(null);else if(Y&&this.afterTrailingComma(Z))break;else if(this.type===z.ellipsis){var W=this.parseRestBinding();if(this.parseBindingListItem(W),X.push(W),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");this.expect(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(z.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 G=H[W];if(G)this.checkLValInnerPattern(G,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===z.colon&&(Q===m.b_stat||Q===m.b_expr))return!Q.isExpr;if(Z===z._return||Z===z.name&&this.exprAllowed)return r.test(this.input.slice(this.lastTokEnd,this.start));if(Z===z._else||Z===z.semi||Z===z.eof||Z===z.parenR||Z===z.arrow)return!0;if(Z===z.braceL)return Q===m.b_stat;if(Z===z._var||Z===z._const||Z===z.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===z.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};z.parenR.updateContext=z.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};z.braceL.updateContext=function(Z){this.context.push(this.braceIsBlock(Z)?m.b_stat:m.b_expr),this.exprAllowed=!0};z.dollarBraceL.updateContext=function(){this.context.push(m.b_tmpl),this.exprAllowed=!0};z.parenL.updateContext=function(Z){var Q=Z===z._if||Z===z._for||Z===z._with||Z===z._while;this.context.push(Q?m.p_stat:m.p_expr),this.exprAllowed=!0};z.incDec.updateContext=function(){};z._function.updateContext=z._class.updateContext=function(Z){if(Z.beforeExpr&&Z!==z._else&&!(Z===z.semi&&this.curContext()!==m.p_stat)&&!(Z===z._return&&r.test(this.input.slice(this.lastTokEnd,this.start)))&&!((Z===z.colon||Z===z.braceL)&&this.curContext()===m.b_stat))this.context.push(m.f_expr);else this.context.push(m.f_stat);this.exprAllowed=!1};z.colon.updateContext=function(){if(this.curContext().token==="function")this.context.pop();this.exprAllowed=!0};z.backQuote.updateContext=function(){if(this.curContext()===m.q_tmpl)this.context.pop();else this.context.push(m.q_tmpl);this.exprAllowed=!1};z.star.updateContext=function(Z){if(Z===z._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};z.name.updateContext=function(Z){var Q=!1;if(this.options.ecmaVersion>=6&&Z!==z.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())Q=!0}this.exprAllowed=Q};var E=p.prototype;E.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};E.parseExpression=function(Z,Q){var Y=this.start,J=this.startLoc,X=this.parseMaybeAssign(Z,Q);if(this.type===z.comma){var K=this.startNodeAt(Y,J);K.expressions=[X];while(this.eat(z.comma))K.expressions.push(this.parseMaybeAssign(Z,Q));return this.finishNode(K,"SequenceExpression")}return X};E.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,G=this.startLoc;if(this.type===z.parenL||this.type===z.name)this.potentialArrowAt=this.start,this.potentialArrowInForAwait=Z==="await";var _=this.parseMaybeConditional(Z,Q);if(Y)_=Y.call(this,_,H,G);if(this.type.isAssign){var q=this.startNodeAt(H,G);if(q.operator=this.value,this.type===z.eq)_=this.toAssignable(_,!1,Q);if(!J)Q.parenthesizedAssign=Q.trailingComma=Q.doubleProto=-1;if(Q.shorthandAssign>=_.start)Q.shorthandAssign=-1;if(this.type===z.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 _};E.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(z.question)){var K=this.startNodeAt(Y,J);return K.test=X,K.consequent=this.parseMaybeAssign(),this.expect(z.colon),K.alternate=this.parseMaybeAssign(Z),this.finishNode(K,"ConditionalExpression")}return X};E.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)};E.parseExprOp=function(Z,Q,Y,J,X){var K=this.type.binop;if(K!=null&&(!X||this.type!==z._in)){if(K>J){var W=this.type===z.logicalOR||this.type===z.logicalAND,H=this.type===z.coalesce;if(H)K=z.logicalAND.binop;var G=this.value;this.next();var _=this.start,q=this.startLoc,R=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,X),_,q,K,X),$=this.buildBinary(Q,Y,Z,R,G,W||H);if(W&&this.type===z.coalesce||H&&(this.type===z.logicalOR||this.type===z.logicalAND))this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses");return this.parseExprOp($,Q,Y,J,X)}}return Z};E.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")};E.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(),G=this.type===z.incDec;if(H.operator=this.value,H.prefix=!0,this.next(),H.argument=this.parseMaybeUnary(null,!0,G,J),this.checkExpressionErrors(Z,!0),G)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,G?"UpdateExpression":"UnaryExpression")}else if(!Q&&this.type===z.privateId){if((J||this.privateNameStack.length===0)&&this.options.checkPrivateFields)this.unexpected();if(W=this.parsePrivateIdent(),this.type!==z._in)this.unexpected()}else{if(W=this.parseExprSubscripts(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(z.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)}E.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};E.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 G=this.startNodeAt(Q,Y);G.expression=H,H=this.finishNode(G,"ChainExpression")}return H}Z=H}};E.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(z.arrow)};E.parseSubscriptAsyncArrow=function(Z,Q,Y,J){return this.parseArrowExpression(this.startNodeAt(Z,Q),Y,!0,J)};E.parseSubscript=function(Z,Q,Y,J,X,K,W){var H=this.options.ecmaVersion>=11,G=H&&this.eat(z.questionDot);if(J&&G)this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var _=this.eat(z.bracketL);if(_||G&&this.type!==z.parenL&&this.type!==z.backQuote||this.eat(z.dot)){var q=this.startNodeAt(Q,Y);if(q.object=Z,_)q.property=this.parseExpression(),this.expect(z.bracketR);else if(this.type===z.privateId&&Z.type!=="Super")q.property=this.parsePrivateIdent();else q.property=this.parseIdent(this.options.allowReserved!=="never");if(q.computed=!!_,H)q.optional=G;Z=this.finishNode(q,"MemberExpression")}else if(!J&&this.eat(z.parenL)){var R=new Y1,$=this.yieldPos,O=this.awaitPos,U=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var L=this.parseExprList(z.parenR,this.options.ecmaVersion>=8,!1,R);if(X&&!G&&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=$,this.awaitPos=O,this.awaitIdentPos=U,this.parseSubscriptAsyncArrow(Q,Y,L,W)}this.checkExpressionErrors(R,!0),this.yieldPos=$||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,H)B.optional=G;Z=this.finishNode(B,"CallExpression")}else if(this.type===z.backQuote){if(G||K)this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var I=this.startNodeAt(Q,Y);I.tag=Z,I.quasi=this.parseTemplate({isTagged:!0}),Z=this.finishNode(I,"TaggedTemplateExpression")}return Z};E.parseExprAtom=function(Z,Q,Y){if(this.type===z.slash)this.readRegexp();var J,X=this.potentialArrowAt===this.start;switch(this.type){case z._super:if(!this.allowSuper)this.raise(this.start,"'super' keyword outside a method");if(J=this.startNode(),this.next(),this.type===z.parenL&&!this.allowDirectSuper)this.raise(J.start,"super() call outside constructor of a subclass");if(this.type!==z.dot&&this.type!==z.bracketL&&this.type!==z.parenL)this.unexpected();return this.finishNode(J,"Super");case z._this:return J=this.startNode(),this.next(),this.finishNode(J,"ThisExpression");case z.name:var K=this.start,W=this.startLoc,H=this.containsEsc,G=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!H&&G.name==="async"&&!this.canInsertSemicolon()&&this.eat(z._function))return this.overrideContext(m.f_expr),this.parseFunction(this.startNodeAt(K,W),0,!1,!0,Q);if(X&&!this.canInsertSemicolon()){if(this.eat(z.arrow))return this.parseArrowExpression(this.startNodeAt(K,W),[G],!1,Q);if(this.options.ecmaVersion>=8&&G.name==="async"&&this.type===z.name&&!H&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc)){if(G=this.parseIdent(!1),this.canInsertSemicolon()||!this.eat(z.arrow))this.unexpected();return this.parseArrowExpression(this.startNodeAt(K,W),[G],!0,Q)}}return G;case z.regexp:var _=this.value;return J=this.parseLiteral(_.value),J.regex={pattern:_.pattern,flags:_.flags},J;case z.num:case z.string:return this.parseLiteral(this.value);case z._null:case z._true:case z._false:return J=this.startNode(),J.value=this.type===z._null?null:this.type===z._true,J.raw=this.type.keyword,this.next(),this.finishNode(J,"Literal");case z.parenL:var 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 z.bracketL:return J=this.startNode(),this.next(),J.elements=this.parseExprList(z.bracketR,!0,!0,Z),this.finishNode(J,"ArrayExpression");case z.braceL:return this.overrideContext(m.b_expr),this.parseObj(!1,Z);case z._function:return J=this.startNode(),this.next(),this.parseFunction(J,0);case z._class:return this.parseClass(this.startNode(),!1);case z._new:return this.parseNew();case z.backQuote:return this.parseTemplate();case z._import:if(this.options.ecmaVersion>=11)return this.parseExprImport(Y);else return this.unexpected();default:return this.parseExprAtomDefault()}};E.parseExprAtomDefault=function(){this.unexpected()};E.parseExprImport=function(Z){var Q=this.startNode();if(this.containsEsc)this.raiseRecoverable(this.start,"Escape sequence in keyword import");if(this.next(),this.type===z.parenL&&!Z)return this.parseDynamicImport(Q);else if(this.type===z.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()};E.parseDynamicImport=function(Z){if(this.next(),Z.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)if(!this.eat(z.parenR))if(this.expect(z.comma),!this.afterTrailingComma(z.parenR)){if(Z.options=this.parseMaybeAssign(),!this.eat(z.parenR)){if(this.expect(z.comma),!this.afterTrailingComma(z.parenR))this.unexpected()}}else Z.options=null;else Z.options=null;else if(!this.eat(z.parenR)){var Q=this.start;if(this.eat(z.comma)&&this.eat(z.parenR))this.raiseRecoverable(Q,"Trailing comma is not allowed in import()");else this.unexpected(Q)}return this.finishNode(Z,"ImportExpression")};E.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")};E.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")};E.parseParenExpression=function(){this.expect(z.parenL);var Z=this.parseExpression();return this.expect(z.parenR),Z};E.shouldParseArrow=function(Z){return!this.canInsertSemicolon()};E.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,G=[],_=!0,q=!1,R=new Y1,$=this.yieldPos,O=this.awaitPos,U;this.yieldPos=0,this.awaitPos=0;while(this.type!==z.parenR)if(_?_=!1:this.expect(z.comma),K&&this.afterTrailingComma(z.parenR,!0)){q=!0;break}else if(this.type===z.ellipsis){if(U=this.start,G.push(this.parseParenItem(this.parseRestBinding())),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else G.push(this.parseMaybeAssign(!1,R,this.parseParenItem));var L=this.lastTokEnd,B=this.lastTokEndLoc;if(this.expect(z.parenR),Z&&this.shouldParseArrow(G)&&this.eat(z.arrow))return this.checkPatternErrors(R,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=$,this.awaitPos=O,this.parseParenArrowList(Y,J,G,Q);if(!G.length||q)this.unexpected(this.lastTokStart);if(U)this.unexpected(U);if(this.checkExpressionErrors(R,!0),this.yieldPos=$||this.yieldPos,this.awaitPos=O||this.awaitPos,G.length>1)X=this.startNodeAt(W,H),X.expressions=G,this.finishNodeAt(X,"SequenceExpression",L,B);else X=G[0]}else X=this.parseParenExpression();if(this.options.preserveParens){var I=this.startNodeAt(Y,J);return I.expression=X,this.finishNode(I,"ParenthesizedExpression")}else return X};E.parseParenItem=function(Z){return Z};E.parseParenArrowList=function(Z,Q,Y,J){return this.parseArrowExpression(this.startNodeAt(Z,Q),Y,!1,J)};var rZ=[];E.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===z.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(z.parenL))Z.arguments=this.parseExprList(z.parenR,this.options.ecmaVersion>=8,!1);else Z.arguments=rZ;return this.finishNode(Z,"NewExpression")};E.parseTemplateElement=function(Z){var Q=Z.isTagged,Y=this.startNode();if(this.type===z.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===z.backQuote,this.finishNode(Y,"TemplateElement")};E.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===z.eof)this.raise(this.pos,"Unterminated template literal");this.expect(z.dollarBraceL),Y.expressions.push(this.parseExpression()),this.expect(z.braceR),Y.quasis.push(J=this.parseTemplateElement({isTagged:Q}))}return this.next(),this.finishNode(Y,"TemplateLiteral")};E.isAsyncProp=function(Z){return!Z.computed&&Z.key.type==="Identifier"&&Z.key.name==="async"&&(this.type===z.name||this.type===z.num||this.type===z.string||this.type===z.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===z.star)&&!s.test(this.input.slice(this.lastTokEnd,this.start))};E.parseObj=function(Z,Q){var Y=this.startNode(),J=!0,X={};Y.properties=[],this.next();while(!this.eat(z.braceR)){if(!J){if(this.expect(z.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(z.braceR))break}else J=!1;var K=this.parseProperty(Z,Q);if(!Z)this.checkPropClash(K,X,Q);Y.properties.push(K)}return this.finishNode(Y,Z?"ObjectPattern":"ObjectExpression")};E.parseProperty=function(Z,Q){var Y=this.startNode(),J,X,K,W;if(this.options.ecmaVersion>=9&&this.eat(z.ellipsis)){if(Z){if(Y.argument=this.parseIdent(!1),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Y,"RestElement")}if(Y.argument=this.parseMaybeAssign(!1,Q),this.type===z.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(z.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(z.star),this.parsePropertyName(Y);else X=!1;return this.parsePropertyValue(Y,Z,J,X,K,W,Q,H),this.finishNode(Y,"Property")};E.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")};E.parsePropertyValue=function(Z,Q,Y,J,X,K,W,H){if((Y||J)&&this.type===z.colon)this.unexpected();if(this.eat(z.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===z.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!==z.comma&&this.type!==z.braceR&&this.type!==z.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===z.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()};E.parsePropertyName=function(Z){if(this.options.ecmaVersion>=6)if(this.eat(z.bracketL))return Z.computed=!0,Z.key=this.parseMaybeAssign(),this.expect(z.bracketR),Z.key;else Z.computed=!1;return Z.key=this.type===z.num||this.type===z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};E.initFunction=function(Z){if(Z.id=null,this.options.ecmaVersion>=6)Z.generator=Z.expression=!1;if(this.options.ecmaVersion>=8)Z.async=!1};E.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(z.parenL),J.params=this.parseBindingList(z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(J,!1,!0,!1),this.yieldPos=X,this.awaitPos=K,this.awaitIdentPos=W,this.finishNode(J,"FunctionExpression")};E.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")};E.parseFunctionBody=function(Z,Q,Y,J){var X=Q&&this.type!==z.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 G=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=G}this.exitScope()};E.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};E.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)}};E.parseExprList=function(Z,Q,Y,J){var X=[],K=!0;while(!this.eat(Z)){if(!K){if(this.expect(z.comma),Q&&this.afterTrailingComma(Z))break}else K=!1;var W=void 0;if(Y&&this.type===z.comma)W=null;else if(this.type===z.ellipsis){if(W=this.parseSpread(J),J&&this.type===z.comma&&J.trailingComma<0)J.trailingComma=this.start}else W=this.parseMaybeAssign(!1,J);X.push(W)}return X};E.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")}};E.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};E.parseIdentNode=function(){var Z=this.startNode();if(this.type===z.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=z.name}else this.unexpected();return Z};E.parsePrivateIdent=function(){var Z=this.startNode();if(this.type===z.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};E.parseYield=function(Z){if(!this.yieldPos)this.yieldPos=this.start;var Q=this.startNode();if(this.next(),this.type===z.semi||this.canInsertSemicolon()||this.type!==z.star&&!this.type.startsExpr)Q.delegate=!1,Q.argument=null;else Q.delegate=this.eat(z.star),Q.argument=this.parseMaybeAssign(Z);return this.finishNode(Q,"YieldExpression")};E.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 N0=p.prototype,rZ=function(Q){this.flags=Q,this.var=[],this.lexical=[],this.functions=[]};N0.enterScope=function(Z){this.scopeStack.push(new rZ(Z))};N0.exitScope=function(){this.scopeStack.pop()};N0.treatFunctionsAsVarInScope=function(Z){return Z.flags&b0||!this.inModule&&Z.flags&y0};N0.declareName=function(Z,Q,Y){var J=!1;if(Q===U0){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 G=this.scopeStack[H];if(G.lexical.indexOf(Z)>-1&&!(G.flags&G8&&G.lexical[0]===Z)||!this.treatFunctionsAsVarInScope(G)&&G.functions.indexOf(Z)>-1){J=!0;break}if(G.var.push(Z),this.inModule&&G.flags&y0)delete this.undefinedExports[Z];if(G.flags&Q1)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&(Q1|f0|A0))return Q}};N0.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 tZ="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",j8=L8,eZ=j8,Z6={9:I8,10:M8,11:B8,12:L8,13:j8,14:eZ},Q6="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Y6={9:"",10:"",11:"",12:"",13:"",14:Q6},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",N8="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=N8+" 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",J6=D8+" "+tZ,X6={9:N8,10:w8,11:A8,12:V8,13:D8,14:J6},T8={};function W6(Z){var Q=T8[Z]={binary:L0(Z6[Z]+" "+Q8),binaryOfStrings:L0(Y6[Z]),nonBinary:{General_Category:L0(Q8),Script:L0(X6[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,o0=[9,10,11,12,13,14];k0<o0.length;k0+=1)T1=o0[k0],W6(T1);var T1,k0,o0,w=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 _0=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};_0.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};_0.prototype.raise=function(Q){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+Q)};_0.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};_0.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};_0.prototype.current=function(Q){if(Q===void 0)Q=!1;return this.at(this.pos,Q)};_0.prototype.lookahead=function(Q){if(Q===void 0)Q=!1;return this.at(this.nextIndex(this.pos,Q),Q)};_0.prototype.advance=function(Q){if(Q===void 0)Q=!1;this.pos=this.nextIndex(this.pos,Q)};_0.prototype.eat=function(Q,Y){if(Y===void 0)Y=!1;if(this.current(Y)===Q)return this.advance(Y),!0;return!1};_0.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};w.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 K6(Z){for(var Q in Z)return!0;return!1}w.validateRegExpPattern=function(Z){if(this.regexp_pattern(Z),!Z.switchN&&this.options.ecmaVersion>=9&&K6(Z.groupNames))Z.switchN=!0,this.regexp_pattern(Z)};w.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")}};w.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")};w.regexp_alternative=function(Z){while(Z.pos<Z.source.length&&this.regexp_eatTerm(Z));};w.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};w.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};w.regexp_eatQuantifier=function(Z,Q){if(Q===void 0)Q=!1;if(this.regexp_eatQuantifierPrefix(Z,Q))return Z.eat(63),!0;return!1};w.regexp_eatQuantifierPrefix=function(Z,Q){return Z.eat(42)||Z.eat(43)||Z.eat(63)||this.regexp_eatBracedQuantifier(Z,Q)};w.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};w.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)};w.regexp_eatReverseSolidusAtomEscape=function(Z){var Q=Z.pos;if(Z.eat(92)){if(this.regexp_eatAtomEscape(Z))return!0;Z.pos=Q}return!1};w.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 G=W.charAt(H);if(W.indexOf(G,H+1)>-1||Y.indexOf(G)>-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};w.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};w.regexp_eatModifiers=function(Z){var Q="",Y=0;while((Y=Z.current())!==-1&&H6(Y))Q+=R0(Y),Z.advance();return Q};function H6(Z){return Z===105||Z===109||Z===115}w.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)};w.regexp_eatInvalidBracedQuantifier=function(Z){if(this.regexp_eatBracedQuantifier(Z,!0))Z.raise("Nothing to repeat");return!1};w.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}w.regexp_eatPatternCharacters=function(Z){var Q=Z.pos,Y=0;while((Y=Z.current())!==-1&&!C8(Y))Z.advance();return Z.pos!==Q};w.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};w.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}};w.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};w.regexp_eatRegExpIdentifierName=function(Z){if(Z.lastStringValue="",this.regexp_eatRegExpIdentifierStart(Z)){Z.lastStringValue+=R0(Z.lastIntValue);while(this.regexp_eatRegExpIdentifierPart(Z))Z.lastStringValue+=R0(Z.lastIntValue);return!0}return!1};w.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(z6(J))return Z.lastIntValue=J,!0;return Z.pos=Q,!1};function z6(Z){return z0(Z,!0)||Z===36||Z===95}w.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(G6(J))return Z.lastIntValue=J,!0;return Z.pos=Q,!1};function G6(Z){return j0(Z,!0)||Z===36||Z===95||Z===8204||Z===8205}w.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};w.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};w.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};w.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)};w.regexp_eatCControlLetter=function(Z){var Q=Z.pos;if(Z.eat(99)){if(this.regexp_eatControlLetter(Z))return!0;Z.pos=Q}return!1};w.regexp_eatZero=function(Z){if(Z.current()===48&&!X1(Z.lookahead()))return Z.lastIntValue=0,Z.advance(),!0;return!1};w.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};w.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}w.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)&&_6(Z.lastIntValue))return!0;if(J)Z.raise("Invalid unicode escape");Z.pos=Y}return!1};function _6(Z){return Z>=0&&Z<=1114111}w.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};w.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,O0=1,X0=2;w.regexp_eatCharacterClassEscape=function(Z){var Q=Z.current();if(q6(Q))return Z.lastIntValue=-1,Z.advance(),O0;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 q6(Z){return Z===100||Z===68||Z===115||Z===83||Z===119||Z===87}w.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),O0}}if(Z.pos=Q,this.regexp_eatLoneUnicodePropertyNameOrValue(Z)){var X=Z.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(Z,X)}return S8};w.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")};w.regexp_validateUnicodePropertyNameOrValue=function(Z,Q){if(Z.unicodeProperties.binary.test(Q))return O0;if(Z.switchV&&Z.unicodeProperties.binaryOfStrings.test(Q))return X0;Z.raise("Invalid property name")};w.regexp_eatUnicodePropertyName=function(Z){var Q=0;Z.lastStringValue="";while(b8(Q=Z.current()))Z.lastStringValue+=R0(Q),Z.advance();return Z.lastStringValue!==""};function b8(Z){return P8(Z)||Z===95}w.regexp_eatUnicodePropertyValue=function(Z){var Q=0;Z.lastStringValue="";while(F6(Q=Z.current()))Z.lastStringValue+=R0(Q),Z.advance();return Z.lastStringValue!==""};function F6(Z){return b8(Z)||X1(Z)}w.regexp_eatLoneUnicodePropertyNameOrValue=function(Z){return this.regexp_eatUnicodePropertyValue(Z)};w.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};w.regexp_classContents=function(Z){if(Z.current()===93)return O0;if(Z.switchV)return this.regexp_classSetExpression(Z);return this.regexp_nonEmptyClassRanges(Z),O0};w.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")}}};w.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||v8(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};w.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)};w.regexp_classSetExpression=function(Z){var Q=O0,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=O0;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}};w.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};w.regexp_eatClassSetOperand=function(Z){if(this.regexp_eatClassSetCharacter(Z))return O0;return this.regexp_eatClassStringDisjunction(Z)||this.regexp_eatNestedClass(Z)};w.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};w.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};w.regexp_classStringDisjunctionContents=function(Z){var Q=this.regexp_classString(Z);while(Z.eat(124))if(this.regexp_classString(Z)===X0)Q=X0;return Q};w.regexp_classString=function(Z){var Q=0;while(this.regexp_eatClassSetCharacter(Z))Q++;return Q===1?O0:X0};w.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()&&$6(Y))return!1;if(R6(Y))return!1;return Z.advance(),Z.lastIntValue=Y,!0};function $6(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 R6(Z){return Z===40||Z===41||Z===45||Z===47||Z>=91&&Z<=93||Z>=123&&Z<=125}w.regexp_eatClassSetReservedPunctuator=function(Z){var Q=Z.current();if(O6(Q))return Z.lastIntValue=Q,Z.advance(),!0;return!1};function O6(Z){return Z===33||Z===35||Z===37||Z===38||Z===44||Z===45||Z>=58&&Z<=62||Z===64||Z===96||Z===126}w.regexp_eatClassControlLetter=function(Z){var Q=Z.current();if(X1(Q)||Q===95)return Z.lastIntValue=Q%32,Z.advance(),!0;return!1};w.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};w.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}w.regexp_eatHexDigits=function(Z){var Q=Z.pos,Y=0;Z.lastIntValue=0;while(E8(Y=Z.current()))Z.lastIntValue=16*Z.lastIntValue+k8(Y),Z.advance();return Z.pos!==Q};function E8(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}w.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};w.regexp_eatOctalDigit=function(Z){var Q=Z.current();if(v8(Q))return Z.lastIntValue=Q-48,Z.advance(),!0;return Z.lastIntValue=0,!1};function v8(Z){return Z>=48&&Z<=55}w.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+k8(X),Z.advance()}return!0};var v1=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]},v=p.prototype;v.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 v1(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};v.getToken=function(){return this.next(),new v1(this)};if(typeof Symbol<"u")v[Symbol.iterator]=function(){var Z=this;return{next:function(){var Q=Z.getToken();return{done:Q.type===z.eof,value:Q}}}};v.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(z.eof);if(Z.override)return Z.override(this);else this.readToken(this.fullCharCodeAtPos())};v.readToken=function(Z){if(z0(Z,this.options.ecmaVersion>=6)||Z===92)return this.readWord();return this.getTokenFromCode(Z)};v.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};v.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())};v.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())};v.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}}};v.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)};v.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(z.ellipsis);else return++this.pos,this.finishToken(z.dot)};v.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(z.assign,2);return this.finishOp(z.slash,1)};v.readToken_mult_modulo_exp=function(Z){var Q=this.input.charCodeAt(this.pos+1),Y=1,J=Z===42?z.star:z.modulo;if(this.options.ecmaVersion>=7&&Z===42&&Q===42)++Y,J=z.starstar,Q=this.input.charCodeAt(this.pos+2);if(Q===61)return this.finishOp(z.assign,Y+1);return this.finishOp(J,Y)};v.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(z.assign,3)}return this.finishOp(Z===124?z.logicalOR:z.logicalAND,2)}if(Q===61)return this.finishOp(z.assign,2);return this.finishOp(Z===124?z.bitwiseOR:z.bitwiseAND,1)};v.readToken_caret=function(){var Z=this.input.charCodeAt(this.pos+1);if(Z===61)return this.finishOp(z.assign,2);return this.finishOp(z.bitwiseXOR,1)};v.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||s.test(this.input.slice(this.lastTokEnd,this.pos))))return this.skipLineComment(3),this.skipSpace(),this.nextToken();return this.finishOp(z.incDec,2)}if(Q===61)return this.finishOp(z.assign,2);return this.finishOp(z.plusMin,1)};v.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(z.assign,Y+1);return this.finishOp(z.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(z.relational,Y)};v.readToken_eq_excl=function(Z){var Q=this.input.charCodeAt(this.pos+1);if(Q===61)return this.finishOp(z.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(z.arrow);return this.finishOp(Z===61?z.eq:z.prefix,1)};v.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(z.questionDot,2)}if(Q===63){if(Z>=12){var J=this.input.charCodeAt(this.pos+2);if(J===61)return this.finishOp(z.assign,3)}return this.finishOp(z.coalesce,2)}}return this.finishOp(z.question,1)};v.readToken_numberSign=function(){var Z=this.options.ecmaVersion,Q=35;if(Z>=13){if(++this.pos,Q=this.fullCharCodeAtPos(),z0(Q,!0)||Q===92)return this.finishToken(z.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+R0(Q)+"'")};v.getTokenFromCode=function(Z){switch(Z){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(z.parenL);case 41:return++this.pos,this.finishToken(z.parenR);case 59:return++this.pos,this.finishToken(z.semi);case 44:return++this.pos,this.finishToken(z.comma);case 91:return++this.pos,this.finishToken(z.bracketL);case 93:return++this.pos,this.finishToken(z.bracketR);case 123:return++this.pos,this.finishToken(z.braceL);case 125:return++this.pos,this.finishToken(z.braceR);case 58:return++this.pos,this.finishToken(z.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(z.backQuote);case 48:var 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(z.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+R0(Z)+"'")};v.finishOp=function(Z,Q){var Y=this.input.slice(this.pos,this.pos+Q);return this.pos+=Q,this.finishToken(Z,Y)};v.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(s.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 _0(this));H.reset(Y,X,W),this.validateRegExpFlags(H),this.validateRegExpPattern(H);var G=null;try{G=new RegExp(X,W)}catch(_){}return this.finishToken(z.regexp,{pattern:X,flags:W,value:G})};v.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 G=0,_=Q==null?1/0:Q;G<_;++G,++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(G===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 U6(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,""))}v.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(z0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(z.num,Y)};v.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,z0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");return this.finishToken(z.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(z0(this.fullCharCodeAtPos()))this.raise(this.pos,"Identifier directly after number");var K=U6(this.input.slice(Q,this.pos),Y);return this.finishToken(z.num,K)};v.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};v.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(z.string,Q)};var y8={};v.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(Z){if(Z===y8)this.readInvalidTemplateToken();else throw Z}this.inTemplateElement=!1};v.invalidStringToken=function(Z,Q){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw y8;else this.raise(Z,Q)};v.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===z.template||this.type===z.invalidTemplate))if(Y===36)return this.pos+=2,this.finishToken(z.dollarBraceL);else return++this.pos,this.finishToken(z.backQuote);return Z+=this.input.slice(Q,this.pos),this.finishToken(z.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+=`
6
+ `),cooked:this.value};return this.next(),Y.tail=this.type===z.backQuote,this.finishNode(Y,"TemplateElement")};E.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===z.eof)this.raise(this.pos,"Unterminated template literal");this.expect(z.dollarBraceL),Y.expressions.push(this.parseExpression()),this.expect(z.braceR),Y.quasis.push(J=this.parseTemplateElement({isTagged:Q}))}return this.next(),this.finishNode(Y,"TemplateLiteral")};E.isAsyncProp=function(Z){return!Z.computed&&Z.key.type==="Identifier"&&Z.key.name==="async"&&(this.type===z.name||this.type===z.num||this.type===z.string||this.type===z.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===z.star)&&!r.test(this.input.slice(this.lastTokEnd,this.start))};E.parseObj=function(Z,Q){var Y=this.startNode(),J=!0,X={};Y.properties=[],this.next();while(!this.eat(z.braceR)){if(!J){if(this.expect(z.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(z.braceR))break}else J=!1;var K=this.parseProperty(Z,Q);if(!Z)this.checkPropClash(K,X,Q);Y.properties.push(K)}return this.finishNode(Y,Z?"ObjectPattern":"ObjectExpression")};E.parseProperty=function(Z,Q){var Y=this.startNode(),J,X,K,W;if(this.options.ecmaVersion>=9&&this.eat(z.ellipsis)){if(Z){if(Y.argument=this.parseIdent(!1),this.type===z.comma)this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");return this.finishNode(Y,"RestElement")}if(Y.argument=this.parseMaybeAssign(!1,Q),this.type===z.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(z.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(z.star),this.parsePropertyName(Y);else X=!1;return this.parsePropertyValue(Y,Z,J,X,K,W,Q,H),this.finishNode(Y,"Property")};E.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")};E.parsePropertyValue=function(Z,Q,Y,J,X,K,W,H){if((Y||J)&&this.type===z.colon)this.unexpected();if(this.eat(z.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===z.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!==z.comma&&this.type!==z.braceR&&this.type!==z.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===z.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()};E.parsePropertyName=function(Z){if(this.options.ecmaVersion>=6)if(this.eat(z.bracketL))return Z.computed=!0,Z.key=this.parseMaybeAssign(),this.expect(z.bracketR),Z.key;else Z.computed=!1;return Z.key=this.type===z.num||this.type===z.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};E.initFunction=function(Z){if(Z.id=null,this.options.ecmaVersion>=6)Z.generator=Z.expression=!1;if(this.options.ecmaVersion>=8)Z.async=!1};E.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(z.parenL),J.params=this.parseBindingList(z.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(J,!1,!0,!1),this.yieldPos=X,this.awaitPos=K,this.awaitIdentPos=W,this.finishNode(J,"FunctionExpression")};E.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")};E.parseFunctionBody=function(Z,Q,Y,J){var X=Q&&this.type!==z.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 G=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=G}this.exitScope()};E.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};E.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)}};E.parseExprList=function(Z,Q,Y,J){var X=[],K=!0;while(!this.eat(Z)){if(!K){if(this.expect(z.comma),Q&&this.afterTrailingComma(Z))break}else K=!1;var W=void 0;if(Y&&this.type===z.comma)W=null;else if(this.type===z.ellipsis){if(W=this.parseSpread(J),J&&this.type===z.comma&&J.trailingComma<0)J.trailingComma=this.start}else W=this.parseMaybeAssign(!1,J);X.push(W)}return X};E.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")}};E.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};E.parseIdentNode=function(){var Z=this.startNode();if(this.type===z.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=z.name}else this.unexpected();return Z};E.parsePrivateIdent=function(){var Z=this.startNode();if(this.type===z.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};E.parseYield=function(Z){if(!this.yieldPos)this.yieldPos=this.start;var Q=this.startNode();if(this.next(),this.type===z.semi||this.canInsertSemicolon()||this.type!==z.star&&!this.type.startsExpr)Q.delegate=!1,Q.argument=null;else Q.delegate=this.eat(z.star),Q.argument=this.parseMaybeAssign(Z);return this.finishNode(Q,"YieldExpression")};E.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 N0=p.prototype,tZ=function(Q){this.flags=Q,this.var=[],this.lexical=[],this.functions=[]};N0.enterScope=function(Z){this.scopeStack.push(new tZ(Z))};N0.exitScope=function(){this.scopeStack.pop()};N0.treatFunctionsAsVarInScope=function(Z){return Z.flags&b0||!this.inModule&&Z.flags&y0};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&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 G=this.scopeStack[H];if(G.lexical.indexOf(Z)>-1&&!(G.flags&G8&&G.lexical[0]===Z)||!this.treatFunctionsAsVarInScope(G)&&G.functions.indexOf(Z)>-1){J=!0;break}if(G.var.push(Z),this.inModule&&G.flags&y0)delete this.undefinedExports[Z];if(G.flags&Q1)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&(Q1|f0|A0))return Q}};N0.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 eZ="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",j8=L8,Z6=j8,Q6={9:I8,10:M8,11:B8,12:L8,13:j8,14:Z6},Y6="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",J6={9:"",10:"",11:"",12:"",13:"",14:Y6},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",N8="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=N8+" 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",X6=D8+" "+eZ,W6={9:N8,10:w8,11:A8,12:V8,13:D8,14:X6},T8={};function K6(Z){var Q=T8[Z]={binary:L0(Q6[Z]+" "+Q8),binaryOfStrings:L0(J6[Z]),nonBinary:{General_Category:L0(Q8),Script:L0(W6[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,o0=[9,10,11,12,13,14];k0<o0.length;k0+=1)T1=o0[k0],K6(T1);var T1,k0,o0,w=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};w.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 H6(Z){for(var Q in Z)return!0;return!1}w.validateRegExpPattern=function(Z){if(this.regexp_pattern(Z),!Z.switchN&&this.options.ecmaVersion>=9&&H6(Z.groupNames))Z.switchN=!0,this.regexp_pattern(Z)};w.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")}};w.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")};w.regexp_alternative=function(Z){while(Z.pos<Z.source.length&&this.regexp_eatTerm(Z));};w.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};w.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};w.regexp_eatQuantifier=function(Z,Q){if(Q===void 0)Q=!1;if(this.regexp_eatQuantifierPrefix(Z,Q))return Z.eat(63),!0;return!1};w.regexp_eatQuantifierPrefix=function(Z,Q){return Z.eat(42)||Z.eat(43)||Z.eat(63)||this.regexp_eatBracedQuantifier(Z,Q)};w.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};w.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)};w.regexp_eatReverseSolidusAtomEscape=function(Z){var Q=Z.pos;if(Z.eat(92)){if(this.regexp_eatAtomEscape(Z))return!0;Z.pos=Q}return!1};w.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 G=W.charAt(H);if(W.indexOf(G,H+1)>-1||Y.indexOf(G)>-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};w.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};w.regexp_eatModifiers=function(Z){var Q="",Y=0;while((Y=Z.current())!==-1&&z6(Y))Q+=O0(Y),Z.advance();return Q};function z6(Z){return Z===105||Z===109||Z===115}w.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)};w.regexp_eatInvalidBracedQuantifier=function(Z){if(this.regexp_eatBracedQuantifier(Z,!0))Z.raise("Nothing to repeat");return!1};w.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}w.regexp_eatPatternCharacters=function(Z){var Q=Z.pos,Y=0;while((Y=Z.current())!==-1&&!C8(Y))Z.advance();return Z.pos!==Q};w.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};w.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}};w.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};w.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};w.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(G6(J))return Z.lastIntValue=J,!0;return Z.pos=Q,!1};function G6(Z){return G0(Z,!0)||Z===36||Z===95}w.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(_6(J))return Z.lastIntValue=J,!0;return Z.pos=Q,!1};function _6(Z){return j0(Z,!0)||Z===36||Z===95||Z===8204||Z===8205}w.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};w.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};w.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};w.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)};w.regexp_eatCControlLetter=function(Z){var Q=Z.pos;if(Z.eat(99)){if(this.regexp_eatControlLetter(Z))return!0;Z.pos=Q}return!1};w.regexp_eatZero=function(Z){if(Z.current()===48&&!X1(Z.lookahead()))return Z.lastIntValue=0,Z.advance(),!0;return!1};w.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};w.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}w.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)&&q6(Z.lastIntValue))return!0;if(J)Z.raise("Invalid unicode escape");Z.pos=Y}return!1};function q6(Z){return Z>=0&&Z<=1114111}w.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};w.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;w.regexp_eatCharacterClassEscape=function(Z){var Q=Z.current();if(F6(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 F6(Z){return Z===100||Z===68||Z===115||Z===83||Z===119||Z===87}w.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};w.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")};w.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")};w.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}w.regexp_eatUnicodePropertyValue=function(Z){var Q=0;Z.lastStringValue="";while($6(Q=Z.current()))Z.lastStringValue+=O0(Q),Z.advance();return Z.lastStringValue!==""};function $6(Z){return b8(Z)||X1(Z)}w.regexp_eatLoneUnicodePropertyNameOrValue=function(Z){return this.regexp_eatUnicodePropertyValue(Z)};w.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};w.regexp_classContents=function(Z){if(Z.current()===93)return U0;if(Z.switchV)return this.regexp_classSetExpression(Z);return this.regexp_nonEmptyClassRanges(Z),U0};w.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")}}};w.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||v8(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};w.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)};w.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}};w.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};w.regexp_eatClassSetOperand=function(Z){if(this.regexp_eatClassSetCharacter(Z))return U0;return this.regexp_eatClassStringDisjunction(Z)||this.regexp_eatNestedClass(Z)};w.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};w.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};w.regexp_classStringDisjunctionContents=function(Z){var Q=this.regexp_classString(Z);while(Z.eat(124))if(this.regexp_classString(Z)===X0)Q=X0;return Q};w.regexp_classString=function(Z){var Q=0;while(this.regexp_eatClassSetCharacter(Z))Q++;return Q===1?U0:X0};w.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()&&R6(Y))return!1;if(O6(Y))return!1;return Z.advance(),Z.lastIntValue=Y,!0};function R6(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 O6(Z){return Z===40||Z===41||Z===45||Z===47||Z>=91&&Z<=93||Z>=123&&Z<=125}w.regexp_eatClassSetReservedPunctuator=function(Z){var Q=Z.current();if(U6(Q))return Z.lastIntValue=Q,Z.advance(),!0;return!1};function U6(Z){return Z===33||Z===35||Z===37||Z===38||Z===44||Z===45||Z>=58&&Z<=62||Z===64||Z===96||Z===126}w.regexp_eatClassControlLetter=function(Z){var Q=Z.current();if(X1(Q)||Q===95)return Z.lastIntValue=Q%32,Z.advance(),!0;return!1};w.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};w.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}w.regexp_eatHexDigits=function(Z){var Q=Z.pos,Y=0;Z.lastIntValue=0;while(E8(Y=Z.current()))Z.lastIntValue=16*Z.lastIntValue+k8(Y),Z.advance();return Z.pos!==Q};function E8(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}w.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};w.regexp_eatOctalDigit=function(Z){var Q=Z.current();if(v8(Q))return Z.lastIntValue=Q-48,Z.advance(),!0;return Z.lastIntValue=0,!1};function v8(Z){return Z>=48&&Z<=55}w.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+k8(X),Z.advance()}return!0};var v1=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]},v=p.prototype;v.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 v1(this));this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};v.getToken=function(){return this.next(),new v1(this)};if(typeof Symbol<"u")v[Symbol.iterator]=function(){var Z=this;return{next:function(){var Q=Z.getToken();return{done:Q.type===z.eof,value:Q}}}};v.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(z.eof);if(Z.override)return Z.override(this);else this.readToken(this.fullCharCodeAtPos())};v.readToken=function(Z){if(G0(Z,this.options.ecmaVersion>=6)||Z===92)return this.readWord();return this.getTokenFromCode(Z)};v.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};v.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())};v.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())};v.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}}};v.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)};v.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(z.ellipsis);else return++this.pos,this.finishToken(z.dot)};v.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(z.assign,2);return this.finishOp(z.slash,1)};v.readToken_mult_modulo_exp=function(Z){var Q=this.input.charCodeAt(this.pos+1),Y=1,J=Z===42?z.star:z.modulo;if(this.options.ecmaVersion>=7&&Z===42&&Q===42)++Y,J=z.starstar,Q=this.input.charCodeAt(this.pos+2);if(Q===61)return this.finishOp(z.assign,Y+1);return this.finishOp(J,Y)};v.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(z.assign,3)}return this.finishOp(Z===124?z.logicalOR:z.logicalAND,2)}if(Q===61)return this.finishOp(z.assign,2);return this.finishOp(Z===124?z.bitwiseOR:z.bitwiseAND,1)};v.readToken_caret=function(){var Z=this.input.charCodeAt(this.pos+1);if(Z===61)return this.finishOp(z.assign,2);return this.finishOp(z.bitwiseXOR,1)};v.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(z.incDec,2)}if(Q===61)return this.finishOp(z.assign,2);return this.finishOp(z.plusMin,1)};v.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(z.assign,Y+1);return this.finishOp(z.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(z.relational,Y)};v.readToken_eq_excl=function(Z){var Q=this.input.charCodeAt(this.pos+1);if(Q===61)return this.finishOp(z.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(z.arrow);return this.finishOp(Z===61?z.eq:z.prefix,1)};v.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(z.questionDot,2)}if(Q===63){if(Z>=12){var J=this.input.charCodeAt(this.pos+2);if(J===61)return this.finishOp(z.assign,3)}return this.finishOp(z.coalesce,2)}}return this.finishOp(z.question,1)};v.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(z.privateId,this.readWord1())}this.raise(this.pos,"Unexpected character '"+O0(Q)+"'")};v.getTokenFromCode=function(Z){switch(Z){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(z.parenL);case 41:return++this.pos,this.finishToken(z.parenR);case 59:return++this.pos,this.finishToken(z.semi);case 44:return++this.pos,this.finishToken(z.comma);case 91:return++this.pos,this.finishToken(z.bracketL);case 93:return++this.pos,this.finishToken(z.bracketR);case 123:return++this.pos,this.finishToken(z.braceL);case 125:return++this.pos,this.finishToken(z.braceR);case 58:return++this.pos,this.finishToken(z.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(z.backQuote);case 48:var 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(z.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+O0(Z)+"'")};v.finishOp=function(Z,Q){var Y=this.input.slice(this.pos,this.pos+Q);return this.pos+=Q,this.finishToken(Z,Y)};v.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 G=null;try{G=new RegExp(X,W)}catch(_){}return this.finishToken(z.regexp,{pattern:X,flags:W,value:G})};v.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 G=0,_=Q==null?1/0:Q;G<_;++G,++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(G===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 I6(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,""))}v.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(z.num,Y)};v.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(z.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=I6(this.input.slice(Q,this.pos),Y);return this.finishToken(z.num,K)};v.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};v.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(z.string,Q)};var y8={};v.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(Z){if(Z===y8)this.readInvalidTemplateToken();else throw Z}this.inTemplateElement=!1};v.invalidStringToken=function(Z,Q){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw y8;else this.raise(Z,Q)};v.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===z.template||this.type===z.invalidTemplate))if(Y===36)return this.pos+=2,this.finishToken(z.dollarBraceL);else return++this.pos,this.finishToken(z.backQuote);return Z+=this.input.slice(Q,this.pos),this.finishToken(z.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
7
  `;break;default:Z+=String.fromCharCode(Y);break}if(this.options.locations)++this.curLine,this.lineStart=this.pos;Q=this.pos}else++this.pos}};v.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(z.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":if(this.input[this.pos+1]===`
8
8
  `)++this.pos;case`
9
9
  `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};v.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 R0(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)}};v.readHexChar=function(Z){var Q=this.pos,Y=this.readInt(16,Z);if(Y===null)this.invalidStringToken(Q,"Bad character escape sequence");return Y};v.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 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?z0:j0)(W,J))this.invalidStringToken(K,"Invalid Unicode escape");Z+=R0(W),Y=this.pos}else break;Q=!1}return Z+this.input.slice(Y,this.pos)};v.readWord=function(){var Z=this.readWord1(),Q=z.name;if(this.keywords.test(Z))Q=C1[Z];return this.finishToken(Q,Z)};var I6="8.15.0";p.acorn={Parser:p,version:I6,defaultOptions:A1,Position:g0,SourceLocation:e0,getLineInfo:H8,Node:J1,TokenType:y,tokTypes:z,keywordTypes:C1,TokContext:H0,tokContexts:m,isIdentifierChar:j0,isIdentifierStart:z0,Token:v1,isNewLine:P0,lineBreak:s,lineBreakG:mZ,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 r 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(`
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)}};v.readHexChar=function(Z){var Q=this.pos,Y=this.readInt(16,Z);if(Y===null)this.invalidStringToken(Q,"Bad character escape sequence");return Y};v.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 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:j0)(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)};v.readWord=function(){var Z=this.readWord1(),Q=z.name;if(this.keywords.test(Z))Q=C1[Z];return this.finishToken(Q,Z)};var M6="8.15.0";p.acorn={Parser:p,version:M6,defaultOptions:A1,Position:g0,SourceLocation:e0,getLineInfo:H8,Node:J1,TokenType:y,tokTypes:z,keywordTypes:C1,TokContext:H0,tokContexts:m,isIdentifierChar:j0,isIdentifierStart:G0,Token:v1,isNewLine:P0,lineBreak:r,lineBreakG:uZ,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
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 G=String(H+1).padStart(W),_=H===Y?">":" ";if(K.push(`${_} ${G} | ${Q[H]}`),H===Y){let q=" ".repeat(W+4+this.column);K.push(`${q}^ ${this.message.split(" at ")[0]}`)}}return K.join(`
12
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 d(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=[],G=[{type:"top-level",braceDepth:0}],_=0,q=()=>G[G.length-1]?.type||"top-level",R=()=>{let $=G[G.length-1];return $?.type==="class-body"&&_===$.braceDepth+1};while(J<Z.length){let $=Z[J],O=Z[J+1];switch(W){case"single-string":if(Y+=$,$==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if($==="'")W="normal";J++;continue;case"double-string":if(Y+=$,$==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if($==='"')W="normal";J++;continue;case"template-string":if(Y+=$,$==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if($==="$"&&O==="{"){Y+=O,J+=2,H.push(1),W="normal";continue}if($==="`")W="normal";J++;continue;case"line-comment":if(Y+=$,$===`
13
- `)W="normal";J++;continue;case"block-comment":if(Y+=$,$==="*"&&O==="/"){Y+=O,J+=2,W="normal";continue}J++;continue;case"regex":if(Y+=$,$==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if($==="["){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($==="/"){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($==="{")H[H.length-1]++;else if($==="}"){if(H[H.length-1]--,H[H.length-1]===0){H.pop(),Y+=$,J++,W="template-string";continue}}}if($==="'"){Y+=$,J++,W="single-string";continue}if($==='"'){Y+=$,J++,W="double-string";continue}if($==="`"){Y+=$,J++,W="template-string";continue}if($==="/"&&O==="/"){Y+=$+O,J+=2,W="line-comment";continue}if($==="/"&&O==="*"){Y+=$+O,J+=2,W="block-comment";continue}if($==="/"){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+=$,J++,W="regex";continue}}break}if($==="{"){_++,Y+=$,J++;continue}if($==="}"){_--;let I=G[G.length-1];if(I&&_===I.braceDepth)G.pop();Y+=$,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,G.push({type:"class-body",braceDepth:_});continue}let L=Z.slice(J).match(/^function\s+(\w+)\s*\(/);if(L){let I=L[1],V=L[0].length,j=Z[J+V],N=null,S=J+V;if(j==="?"||j==="!")if(N=j,S++,N==="!")Q.unsafeFunctions.add(I);else Q.safeFunctions.add(I);Y+=`function ${I}(`,J=S;let P=K1(Z,J,"(",")");if(!P){Y+=Z[J],J++;continue}let{content:D,endPos:C}=P;J=C;let b=g1(D,Q,!0);Y+=b+")";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:t,endPos:D0}=Z0;if(X===void 0){if(X=t,f==="-?")K="safe";else if(f==="-!")K="unsafe"}J=D0}}continue}let B=Z.slice(J).match(/^(constructor|(?:get|set)\s+\w+|async\s+\w+|\w+)\s*\(/);if(B&&R()){let I=B[1],V=B[0].length,j=J+V;Y+=I+"(",J=j;let N=K1(Z,J,"(",")");if(!N){Y+=Z[J],J++;continue}let{content:S,endPos:P}=N;J=P;let D=g1(S,Q,!0);Y+=D+")";let C=J;while(C<Z.length&&/\s/.test(Z[C]))C++;if(Z.slice(C,C+2)==="->"){C+=2;while(C<Z.length&&/\s/.test(Z[C]))C++;let h=W1(Z,C);if(h)J=h.endPos}else if(Z[C]===":"){C++;while(C<Z.length&&/\s/.test(Z[C]))C++;let h=W1(Z,C);if(h)J=h.endPos}continue}if(Z[J]==="("){let I=K1(Z,J+1,"(",")");if(!I){Y+=Z[J],J++;continue}let{content:V,endPos:j}=I,N=j;while(N<Z.length&&/\s/.test(Z[N]))N++;let S,P=Z.slice(N,N+2);if(P==="->"||P==="-?"||P==="-!"){N+=2;while(N<Z.length&&/\s/.test(Z[N]))N++;let D=W1(Z,N);if(D){S=D.type,N=D.endPos;while(N<Z.length&&/\s/.test(Z[N]))N++}}if(Z.slice(N,N+2)==="=>"){let D=null,C=V,b=V.trimStart();if(b.startsWith("?")&&(b.length===1||/\s/.test(b[1])))D="?",C=b.slice(1);else if(b.startsWith("!")&&(b.length===1||/\s/.test(b[1])))D="!",C=b.slice(1);let h=g1(C,Q,!1);Y+=`(${D==="?"?"/* safe */ ":D==="!"?"/* unsafe */ ":""}${h})`,J=j;while(J<N&&/\s/.test(Z[J]))Y+=Z[J],J++;if(S)J=N}else{let D=G1(V,Q);Y+=`(${D.source})`,J=j}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 G=Z[K];if(!W&&(G==="'"||G==='"'||G==="`"))W=!0,H=G;else if(W&&G===H&&Z[K-1]!=="\\")W=!1;else if(!W){if(G===Y)X++;else if(G===J)X--}K++}if(X!==0)return null;return{content:Z.slice(Q,K-1),endPos:K}}function m8(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=(G)=>({type:x0(Z.slice(Q,G).trim()),endPos:G});while(Y<Z.length){let G=Z[Y];if(!X&&(G==="'"||G==='"'||G==="`")){X=!0,K=G,W=!0,Y++;continue}if(X){if(G===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(G==="{"||G==="["||G==="("){J++,W=!0,Y++;continue}if(G==="}"||G==="]"||G===")"){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&&G==="{"){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&&(G==="|"||G==="&")){if(Y++,Y<Z.length&&Z[Y]==="|")Y++;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;continue}if(J===0&&(/\d/.test(G)||G==="-"&&/\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(G)){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]==="{"){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],G=Z[W+1];if(!K&&H==="/"&&G==="/"){X=!0,Y+="//",W+=2;continue}if(!X&&H==="/"&&G==="*"){K=!0,Y+="/*",W+=2;continue}if(X&&H===`
14
- `){X=!1,Y+=H,W++;continue}if(K&&H==="*"&&G==="/"){K=!1,Y+="*/",W+=2;continue}if(X||K){Y+=H,W++;continue}if(H==="("||H==="{"||H==="[")J++,Y+=H;else if(H===")"||H==="}"||H==="]")J--,Y+=H;else if(H===","&&J===0)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)} ]`}let R=q.match(/^(\w+)\s*\?\s*:\s*(.+)$/);if(R){let[,O,U]=R;return H(O),K=!0,`${O} = ${U}`}if(!B6(q)){let O=q.match(/^(\w+)\s*=/);if(O)H(O[1]);return K=!0,_}let $=L6(q);if($!==-1){let O=q.slice(0,$).trim(),U=q.slice($+1).trim();if(H(O),K&&Y&&/^\w+$/.test(O))throw Error(`Required parameter '${O}' cannot follow optional parameter`);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 G=K.match(/^(\w+)\s*:\s*([\s\S]+)$/);if(G){let[,_,q]=G;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,$]=W;return`${R}: ${H1($)}`}let H=K.match(/^(\w+)\s*=\s*(\{[\s\S]*\})$/);if(H){let[,R,$]=H;return`${R}: ${H1($)}`}let G=K.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(G){let[,R,$]=G;return`${R}: ${z1($)}`}let _=K.match(/^(\w+)\s*=\s*(\[[\s\S]*\])$/);if(_){let[,R,$]=_;return`${R}: ${z1($)}`}let q=K.match(/^(\w+)\s*=\s*([\s\S]+)$/);if(q){let[,R,$]=q;return`${R}: ${$}`}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 B6(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 L6(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 p8(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 { $error: true, message: __try_err?.message || String(__try_err), op: 'try', cause: __try_err, stack: globalThis.__tjs?.getStack?.() } }`,Y=H}}else Q+=Z[Y],Y++}return Q}function i8(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,G=1,_=H;while(_<Z.length&&G>0){let P=Z[_];if(P==="{")G++;else if(P==="}")G--;_++}if(G!==0){Y+=Z[J],J++;continue}let q=Z.slice(H,_-1),R,$=_,O=Z.slice(_).match(/^\s*fallback\s*\{/);if(O){let P=_+O[0].length;G=1;let D=P;while(D<Z.length&&G>0){let C=Z[D];if(C==="{")G++;else if(C==="}")G--;D++}if(G===0)R=Z.slice(P,D-1),$=D}let L=j6(q).map((P)=>{let D=N6(Z,W,P);return D?`${P}: ${D}`:P}),B={id:`__tjs_wasm_${X}`,body:q,fallback:R,captures:L,start:W,end:$};Q.push(B);let I=R??q,V=L.map((P)=>P.split(":")[0].trim()),j=V.length>0?V.join(", "):"",N=V.length>0?`globalThis.${B.id}(${j})`:`globalThis.${B.id}()`,S=`(globalThis.${B.id} ? ${N} : (() => {${I}})())`;Y+=S,J=$,X++}else Y+=Z[J],J++}return{source:Y,blocks:Q}}function j6(Z){let Q=Z.replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,""),Y=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,J=new Set,X;while((X=Y.exec(Q))!==null)J.add(X[1]);let K=new Set,W=/\b(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=W.exec(Q))!==null)K.add(X[1]);let H=/\bfor\s*\(\s*(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=H.exec(Q))!==null)K.add(X[1]);let G=new Set(["if","else","for","while","do","switch","case","break","continue","return","function","let","const","var","new","this","true","false","null","undefined","typeof","instanceof","in","of","try","catch","finally","throw","async","await","class","extends","super","import","export","default","from","as","static","get","set","yield","console","Math","Array","Object","String","Number","Boolean","Date","JSON","Promise","Map","Set","WeakMap","WeakSet","Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","ArrayBuffer","DataView","Error","TypeError","RangeError","length","push","pop","shift","unshift","slice","splice","map","filter","reduce","forEach","find","findIndex","indexOf","includes","globalThis","window","document","Infinity","NaN","isNaN","isFinite","parseInt","parseFloat","encodeURI","decodeURI","eval"]),_=[];for(let q of J)if(!K.has(q)&&!G.has(q))_.push(q);return _.sort()}function N6(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 u8(H[1],Y)}return u8(K[1],Y)}function u8(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 n8(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 c8(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(`
13
+ `)W="normal";J++;continue;case"block-comment":if(Y+=$,$==="*"&&O==="/"){Y+=O,J+=2,W="normal";continue}J++;continue;case"regex":if(Y+=$,$==="\\"&&J+1<Z.length){Y+=O,J+=2;continue}if($==="["){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($==="/"){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($==="{")H[H.length-1]++;else if($==="}"){if(H[H.length-1]--,H[H.length-1]===0){H.pop(),Y+=$,J++,W="template-string";continue}}}if($==="'"){Y+=$,J++,W="single-string";continue}if($==='"'){Y+=$,J++,W="double-string";continue}if($==="`"){Y+=$,J++,W="template-string";continue}if($==="/"&&O==="/"){Y+=$+O,J+=2,W="line-comment";continue}if($==="/"&&O==="*"){Y+=$+O,J+=2,W="block-comment";continue}if($==="/"){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+=$,J++,W="regex";continue}}break}if($==="{"){_++,Y+=$,J++;continue}if($==="}"){_--;let I=G[G.length-1];if(I&&_===I.braceDepth)G.pop();Y+=$,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,G.push({type:"class-body",braceDepth:_});continue}let L=Z.slice(J).match(/^function\s+(\w+)\s*\(/);if(L){let I=L[1],V=L[0].length,j=Z[J+V],N=null,S=J+V;if(j==="?"||j==="!")if(N=j,S++,N==="!")Q.unsafeFunctions.add(I);else Q.safeFunctions.add(I);Y+=`function ${I}(`,J=S;let P=K1(Z,J,"(",")");if(!P){Y+=Z[J],J++;continue}let{content:D,endPos:C}=P;J=C;let b=g1(D,Q,!0);Y+=b+")";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 B=Z.slice(J).match(/^(constructor|(?:get|set)\s+\w+|async\s+\w+|\w+)\s*\(/);if(B&&R()){let I=B[1],V=B[0].length,j=J+V;Y+=I+"(",J=j;let N=K1(Z,J,"(",")");if(!N){Y+=Z[J],J++;continue}let{content:S,endPos:P}=N;J=P;let D=g1(S,Q,!0);Y+=D+")";let C=J;while(C<Z.length&&/\s/.test(Z[C]))C++;if(Z.slice(C,C+2)==="->"){C+=2;while(C<Z.length&&/\s/.test(Z[C]))C++;let h=W1(Z,C);if(h)J=h.endPos}else if(Z[C]===":"){C++;while(C<Z.length&&/\s/.test(Z[C]))C++;let h=W1(Z,C);if(h)J=h.endPos}continue}if(Z[J]==="("){let I=K1(Z,J+1,"(",")");if(!I){Y+=Z[J],J++;continue}let{content:V,endPos:j}=I,N=j;while(N<Z.length&&/\s/.test(Z[N]))N++;let S,P=Z.slice(N,N+2);if(P==="->"||P==="-?"||P==="-!"){N+=2;while(N<Z.length&&/\s/.test(Z[N]))N++;let D=W1(Z,N);if(D){S=D.type,N=D.endPos;while(N<Z.length&&/\s/.test(Z[N]))N++}}if(Z.slice(N,N+2)==="=>"){let D=null,C=V,b=V.trimStart();if(b.startsWith("?")&&(b.length===1||/\s/.test(b[1])))D="?",C=b.slice(1);else if(b.startsWith("!")&&(b.length===1||/\s/.test(b[1])))D="!",C=b.slice(1);let h=g1(C,Q,!1);Y+=`(${D==="?"?"/* safe */ ":D==="!"?"/* unsafe */ ":""}${h})`,J=j;while(J<N&&/\s/.test(Z[J]))Y+=Z[J],J++;if(S)J=N}else{let D=G1(V,Q);Y+=`(${D.source})`,J=j}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 G=Z[K];if(!W&&(G==="'"||G==='"'||G==="`"))W=!0,H=G;else if(W&&G===H&&Z[K-1]!=="\\")W=!1;else if(!W){if(G===Y)X++;else if(G===J)X--}K++}if(X!==0)return null;return{content:Z.slice(Q,K-1),endPos:K}}function m8(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=(G)=>({type:x0(Z.slice(Q,G).trim()),endPos:G});while(Y<Z.length){let G=Z[Y];if(!X&&(G==="'"||G==='"'||G==="`")){X=!0,K=G,W=!0,Y++;continue}if(X){if(G===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(G==="{"||G==="["||G==="("){J++,W=!0,Y++;continue}if(G==="}"||G==="]"||G===")"){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&&G==="{"){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&&(G==="|"||G==="&")){if(Y++,Y<Z.length&&Z[Y]==="|")Y++;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;continue}if(J===0&&(/\d/.test(G)||G==="-"&&/\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(G)){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]==="{"){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],G=Z[W+1];if(!K&&H==="/"&&G==="/"){X=!0,Y+="//",W+=2;continue}if(!X&&H==="/"&&G==="*"){K=!0,Y+="/*",W+=2;continue}if(X&&H===`
14
+ `){X=!1,Y+=H,W++;continue}if(K&&H==="*"&&G==="/"){K=!1,Y+="*/",W+=2;continue}if(X||K){Y+=H,W++;continue}if(H==="("||H==="{"||H==="[")J++,Y+=H;else if(H===")"||H==="}"||H==="]")J--,Y+=H;else if(H===","&&J===0)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)} ]`}let R=q.match(/^(\w+)\s*\?\s*:\s*(.+)$/);if(R){let[,O,U]=R;return H(O),K=!0,`${O} = ${U}`}if(!L6(q)){let O=q.match(/^(\w+)\s*=/);if(O)H(O[1]);return K=!0,_}let $=j6(q);if($!==-1){let O=q.slice(0,$).trim(),U=q.slice($+1).trim();if(H(O),K&&Y&&/^\w+$/.test(O))throw Error(`Required parameter '${O}' cannot follow optional parameter`);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 G=K.match(/^(\w+)\s*:\s*([\s\S]+)$/);if(G){let[,_,q]=G;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,$]=W;return`${R}: ${H1($)}`}let H=K.match(/^(\w+)\s*=\s*(\{[\s\S]*\})$/);if(H){let[,R,$]=H;return`${R}: ${H1($)}`}let G=K.match(/^(\w+)\s*:\s*(\[[\s\S]*\])$/);if(G){let[,R,$]=G;return`${R}: ${z1($)}`}let _=K.match(/^(\w+)\s*=\s*(\[[\s\S]*\])$/);if(_){let[,R,$]=_;return`${R}: ${z1($)}`}let q=K.match(/^(\w+)\s*=\s*([\s\S]+)$/);if(q){let[,R,$]=q;return`${R}: ${$}`}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 L6(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 j6(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 p8(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 i8(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,G=1,_=H;while(_<Z.length&&G>0){let P=Z[_];if(P==="{")G++;else if(P==="}")G--;_++}if(G!==0){Y+=Z[J],J++;continue}let q=Z.slice(H,_-1),R,$=_,O=Z.slice(_).match(/^\s*fallback\s*\{/);if(O){let P=_+O[0].length;G=1;let D=P;while(D<Z.length&&G>0){let C=Z[D];if(C==="{")G++;else if(C==="}")G--;D++}if(G===0)R=Z.slice(P,D-1),$=D}let L=w6(q).map((P)=>{let D=A6(Z,W,P);return D?`${P}: ${D}`:P}),B={id:`__tjs_wasm_${X}`,body:q,fallback:R,captures:L,start:W,end:$};Q.push(B);let I=R??q,V=L.map((P)=>P.split(":")[0].trim()),j=V.length>0?V.join(", "):"",N=V.length>0?`globalThis.${B.id}(${j})`:`globalThis.${B.id}()`,S=`(globalThis.${B.id} ? ${N} : (() => {${I}})())`;Y+=S,J=$,X++}else Y+=Z[J],J++}return{source:Y,blocks:Q}}function N6(Z){return Z.startsWith("f32x4_")||Z.startsWith("v128_")}function w6(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 $ of Y){if(!W.has($))continue;let O=new RegExp(`(?<!\\.)\\b${$}\\b`,"g"),U=new RegExp(`\\.${$}\\b`,"g"),L=Q.match(O)?.length||0,B=Q.match(U)?.length||0;if(L<=B)W.delete($)}let H=new Set,G=/\b(?:let|const|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g;while((X=G.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 $ of W)if(!H.has($)&&!q.has($)&&!N6($))R.push($);return R.sort()}function A6(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 u8(H[1],Y)}return u8(K[1],Y)}function u8(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 n8(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
15
  `),K=[];for(let W=0;W<X.length;W++){let H=X[W],G=W>0?X[W-1]:"";if(W>0&&Q.test(H)){let _=G.replace(/\/\/.*$/,"").replace(/\/\*.*\*\/\s*$/,"");if(!Y.test(_)&&!J.test(_)){let q=H.match(/^(\s*)/),R=q?q[1]:"",$=H.slice(R.length);K.push(R+";"+$);continue}}K.push(H)}return K.join(`
16
16
  `)}function o8(Z){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 G=Y-1;while(G>=0&&/\s/.test(Z[G]))G--;let _=G>=0?Z[G]:"";if(!_||/[=(!,;:{[&|?+\-*%<>~^]/.test(_)||G>=5&&/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)$/.test(Z.slice(Math.max(0,G-10),G+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:G}=Q[W],_=G==="=="?"Is":"IsNot",q=w6(K,H),R=A6(K,H+2),$=K.slice(q,H).trim(),O=K.slice(H+2,R).trim();if($&&O){let U=K.slice(0,q),L=K.slice(R),I=/[a-zA-Z0-9_$]$/.test(U)?" ":"";K=`${U}${I}${_}(${$}, ${O})${L}`}}return K}function w6(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==="]"){J++,Y--;continue}if(W==="("||W==="["){if(J>0){J--,Y--;continue}return Y+1}if(J>0){Y--;continue}if(W===";"||W==="{"||W==="}")return Y+1;if(/[a-z]/.test(W)){let G=Y+1,_=Y;while(_>0&&/[a-z]/i.test(Z[_-1]))_--;let q=Z.slice(_,G),R=_>0?Z[_-1]:"";if(!/[a-zA-Z0-9_$]/.test(R)){if(["return","throw","case","typeof","void","delete","await","yield","new"].includes(q))return G}}if(W===">"&&H==="=")return Y+1;if(W==="="&&H!=="="&&H!=="!"&&H!=="<"&&H!==">")return Y+1;if(W==="&"&&H==="&")return Y+1;if(W==="|"&&H==="|")return Y+1;if(W==="?"||W===":")return Y+1;if(W===",")return Y+1;Y--}return 0}function A6(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 a8(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,G=Z.slice(K).match(/^(['"`])([^]*?)\1\s*/);if(G){let $=K+G[0].length,O=Z[$],U=O===void 0||$>=Z.length||O!=="="&&O!=="{";if(O==="="||O==="{")W=G[2],H=!0,K=$;else if(U){let L=G[0].trim(),B=G[0].slice(L.length);Q+=`const ${X} = Type('${X}', ${L})${B}`,Y=$;continue}}let _,q=K,R=Z.slice(K).match(/^=\s*/);if(R){K+=R[0].length;let $=Z.slice(K).match(/^(\+?\d+(?:\.\d+)?|['"`][^'"`]*['"`]|\{[^}]*\}|\[[^\]]*\]|true|false|null)/);if($){_=$[0],K+=$[0].length,q=K;let O=Z.slice(K).match(/^\s*/);if(O)K+=O[0].length}}if(Z[K]==="{"){let $=K+1,O=1,U=$;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($,U-1).trim(),B=U,I=L.match(/description\s*:\s*(['"`])([^]*?)\1/);if(I&&!H)W=I[2];let V,j=L.match(/example\s*:\s*/);if(j){let S=j.index+j[0].length,P=m8(L,S);if(P)V=P.value.trim()}let N=L.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/);if(N&&V){let S=N[1].trim(),P=N[2].trim(),D=_?`, ${_}`:"";Q+=`const ${X} = Type('${W}', (${S}) => { if (!globalThis.__tjs?.validate(${S}, globalThis.__tjs?.infer(${V}))) return false; ${P} }, ${V}${D})`}else if(N){let S=N[1].trim(),P=N[2].trim(),D=_?`, undefined, ${_}`:"";Q+=`const ${X} = Type('${W}', (${S}) => { ${P} }${D})`}else if(V){let S=_?`, ${_}`:"";Q+=`const ${X} = Type('${W}', undefined, ${V}${S})`}else if(_)Q+=`const ${X} = Type('${W}', ${_})`;else Q+=`const ${X} = Type('${W}')`;Y=B;continue}else if(_){Q+=`const ${X} = Type('${W}', ${_})`,Y=q;continue}else if(!G){let $=Z.slice(K).match(/^(['"`][^]*?['"`]|\+?\d+(?:\.\d+)?|true|false|null|\{[^]*?\}|\[[^]*?\])/);if($){let O=$[0];Q+=`const ${X} = Type('${X}', ${O})`,Y=K+$[0].length;continue}}}Q+=Z[Y],Y++}return Q}function s8(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,G=1,_=H;while(_<Z.length&&G>0){let B=Z[_];if(B==="{")G++;else if(B==="}")G--;_++}if(G!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,$=K.split(",").map((B)=>{let I=B.trim().split("=").map((V)=>V.trim());if(I.length===2)return`['${I[0]}', ${I[1]}]`;return`'${I[0]}'`}),O=q.match(/description\s*:\s*(['"`])([^]*?)\1/),U=q.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/),L=O?O[2]:X;if(U){let B=U[1].trim().split(",").map((S)=>S.trim()),I=U[2].trim(),V=B[0]||"x",j=B.slice(1),N=j.map((S)=>`check${S}`);j.forEach((S,P)=>{I=I.replace(new RegExp(`\\b${S}\\s*\\(`,"g"),`${N[P]}(`)}),Q+=`const ${X} = Generic([${$.join(", ")}], (${V}, ${N.join(", ")}) => { ${I} }, '${L}')`}else Q+=`const ${X} = Generic([${$.join(", ")}], () => true, '${L}')`;Y=R;continue}Q+=Z[Y],Y++}return Q}function r8(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,G=1,_=H;while(_<Z.length&&G>0){let O=Z[_];if(O==="{")G++;else if(O==="}")G--;_++}if(G!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,$=d8(q);Q+=`const ${X} = Union('${K}', [${$.join(", ")}])`,Y=R;continue}else{let H=Z.indexOf(`
18
- `,W);if(H===-1)H=Z.length;let G=Z.slice(W,H).trim();if(G){let _=d8(G);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 t8(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,G=1,_=H;while(_<Z.length&&G>0){let U=Z[_];if(U==="{")G++;else if(U==="}")G--;_++}if(G!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,O=V6(q).map(([U,L])=>`${U}: ${L}`).join(", ");Q+=`const ${X} = Enum('${K}', { ${O} })`,Y=R;continue}Q+=Z[Y],Y++}return Q}function V6(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 G=Number(H);if(!isNaN(G))Y=G+1}else Q.push([W,String(Y)]),Y++}}return Q}function e8(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 j=X.match(/^(\s*)extend\s+([A-Z]\w*)\s*\{/)}Y+=Z[J],J++;continue}let W=K[1],H=K[2],G=J+K[0].length-1,_=u0(Z,G),q=Z.slice(G+1,_-1).trim(),R=[],$=0,O=Z.slice(G+1,_-1);while($<O.length){let j=O.slice($).match(/^(\s*)(async\s+)?(\w+)\s*\(/);if(!j){$++;continue}let N=j[1],S=!!j[2],P=j[3],D=$+j[0].length-1,C=1,b=D+1;while(b<O.length&&C>0){if(O[b]==="(")C++;if(O[b]===")")C--;b++}let h=O.slice(D+1,b-1),f=b;while(f<O.length&&/\s/.test(O[f]))f++;if(O[f]==="="&&O[f+1]===">"){let M0=m0(Z,G+1+$);throw new r(`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]!=="{"){$++;continue}let Z0=u0(O,f),t=O.slice($,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=S?"async ":"",A9=O.slice(f+1,Z0-1);R.push({name:P,isAsync:S,fullText:`${P}: ${$1}function(${D0}) {${A9}}`}),$=Z0}let U=!Q.has(H);if(U)Q.set(H,new Set);let L=Q.get(H);for(let V of R)L.add(V.name);let B=R.map((V)=>` ${V.fullText}`).join(`,
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 G=Y-1;while(G>=0&&/\s/.test(Z[G]))G--;let _=G>=0?Z[G]:"";if(!_||/[=(!,;:{[&|?+\-*%<>~^]/.test(_)||G>=5&&/\b(return|case|throw|in|of|typeof|instanceof|new|delete|void)$/.test(Z.slice(Math.max(0,G-10),G+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:G}=Q[W],_=G==="=="?"Is":"IsNot",q=V6(K,H),R=D6(K,H+2),$=K.slice(q,H).trim(),O=K.slice(H+2,R).trim();if($&&O){let U=K.slice(0,q),L=K.slice(R),I=/[a-zA-Z0-9_$]$/.test(U)?" ":"";K=`${U}${I}${_}(${$}, ${O})${L}`}}return K}function V6(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==="]"){J++,Y--;continue}if(W==="("||W==="["){if(J>0){J--,Y--;continue}return Y+1}if(J>0){Y--;continue}if(W===";"||W==="{"||W==="}")return Y+1;if(/[a-z]/.test(W)){let G=Y+1,_=Y;while(_>0&&/[a-z]/i.test(Z[_-1]))_--;let q=Z.slice(_,G),R=_>0?Z[_-1]:"";if(!/[a-zA-Z0-9_$]/.test(R)){if(["return","throw","case","typeof","void","delete","await","yield","new"].includes(q))return G}}if(W===">"&&H==="=")return Y+1;if(W==="="&&H!=="="&&H!=="!"&&H!=="<"&&H!==">")return Y+1;if(W==="&"&&H==="&")return Y+1;if(W==="|"&&H==="|")return Y+1;if(W==="?"||W===":")return Y+1;if(W===",")return Y+1;Y--}return 0}function D6(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 a8(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,G=Z.slice(K).match(/^(['"`])([^]*?)\1\s*/);if(G){let $=K+G[0].length,O=Z[$],U=O===void 0||$>=Z.length||O!=="="&&O!=="{";if(O==="="||O==="{")W=G[2],H=!0,K=$;else if(U){let L=G[0].trim(),B=G[0].slice(L.length);Q+=`const ${X} = Type('${X}', ${L})${B}`,Y=$;continue}}let _,q=K,R=Z.slice(K).match(/^=\s*/);if(R){K+=R[0].length;let $=Z.slice(K).match(/^(\+?\d+(?:\.\d+)?|['"`][^'"`]*['"`]|\{[^}]*\}|\[[^\]]*\]|true|false|null)/);if($){_=$[0],K+=$[0].length,q=K;let O=Z.slice(K).match(/^\s*/);if(O)K+=O[0].length}}if(Z[K]==="{"){let $=K+1,O=1,U=$;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($,U-1).trim(),B=U,I=L.match(/description\s*:\s*(['"`])([^]*?)\1/);if(I&&!H)W=I[2];let V,j=L.match(/example\s*:\s*/);if(j){let S=j.index+j[0].length,P=m8(L,S);if(P)V=P.value.trim()}let N=L.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/);if(N&&V){let S=N[1].trim(),P=N[2].trim(),D=_?`, ${_}`:"";Q+=`const ${X} = Type('${W}', (${S}) => { if (!globalThis.__tjs?.validate(${S}, globalThis.__tjs?.infer(${V}))) return false; ${P} }, ${V}${D})`}else if(N){let S=N[1].trim(),P=N[2].trim(),D=_?`, undefined, ${_}`:"";Q+=`const ${X} = Type('${W}', (${S}) => { ${P} }${D})`}else if(V){let S=_?`, ${_}`:"";Q+=`const ${X} = Type('${W}', undefined, ${V}${S})`}else if(_)Q+=`const ${X} = Type('${W}', ${_})`;else Q+=`const ${X} = Type('${W}')`;Y=B;continue}else if(_){Q+=`const ${X} = Type('${W}', ${_})`,Y=q;continue}else if(!G){let $=Z.slice(K).match(/^(['"`][^]*?['"`]|\+?\d+(?:\.\d+)?|true|false|null|\{[^]*?\}|\[[^]*?\])/);if($){let O=$[0];Q+=`const ${X} = Type('${X}', ${O})`,Y=K+$[0].length;continue}}}Q+=Z[Y],Y++}return Q}function s8(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,G=1,_=H;while(_<Z.length&&G>0){let B=Z[_];if(B==="{")G++;else if(B==="}")G--;_++}if(G!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,$=K.split(",").map((B)=>{let I=B.trim().split("=").map((V)=>V.trim());if(I.length===2)return`['${I[0]}', ${I[1]}]`;return`'${I[0]}'`}),O=q.match(/description\s*:\s*(['"`])([^]*?)\1/),U=q.match(/predicate\s*\(([^)]*)\)\s*\{([^]*)\}/),L=O?O[2]:X;if(U){let B=U[1].trim().split(",").map((S)=>S.trim()),I=U[2].trim(),V=B[0]||"x",j=B.slice(1),N=j.map((S)=>`check${S}`);j.forEach((S,P)=>{I=I.replace(new RegExp(`\\b${S}\\s*\\(`,"g"),`${N[P]}(`)}),Q+=`const ${X} = Generic([${$.join(", ")}], (${V}, ${N.join(", ")}) => { ${I} }, '${L}')`}else Q+=`const ${X} = Generic([${$.join(", ")}], () => true, '${L}')`;Y=R;continue}Q+=Z[Y],Y++}return Q}function r8(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,G=1,_=H;while(_<Z.length&&G>0){let O=Z[_];if(O==="{")G++;else if(O==="}")G--;_++}if(G!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,$=d8(q);Q+=`const ${X} = Union('${K}', [${$.join(", ")}])`,Y=R;continue}else{let H=Z.indexOf(`
18
+ `,W);if(H===-1)H=Z.length;let G=Z.slice(W,H).trim();if(G){let _=d8(G);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 t8(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,G=1,_=H;while(_<Z.length&&G>0){let U=Z[_];if(U==="{")G++;else if(U==="}")G--;_++}if(G!==0){Q+=Z[Y],Y++;continue}let q=Z.slice(H,_-1).trim(),R=_,O=T6(q).map(([U,L])=>`${U}: ${L}`).join(", ");Q+=`const ${X} = Enum('${K}', { ${O} })`,Y=R;continue}Q+=Z[Y],Y++}return Q}function T6(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 G=Number(H);if(!isNaN(G))Y=G+1}else Q.push([W,String(Y)]),Y++}}return Q}function e8(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 j=X.match(/^(\s*)extend\s+([A-Z]\w*)\s*\{/)}Y+=Z[J],J++;continue}let W=K[1],H=K[2],G=J+K[0].length-1,_=u0(Z,G),q=Z.slice(G+1,_-1).trim(),R=[],$=0,O=Z.slice(G+1,_-1);while($<O.length){let j=O.slice($).match(/^(\s*)(async\s+)?(\w+)\s*\(/);if(!j){$++;continue}let N=j[1],S=!!j[2],P=j[3],D=$+j[0].length-1,C=1,b=D+1;while(b<O.length&&C>0){if(O[b]==="(")C++;if(O[b]===")")C--;b++}let h=O.slice(D+1,b-1),f=b;while(f<O.length&&/\s/.test(O[f]))f++;if(O[f]==="="&&O[f+1]===">"){let M0=m0(Z,G+1+$);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]!=="{"){$++;continue}let Z0=u0(O,f),e=O.slice($,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=S?"async ":"",A9=O.slice(f+1,Z0-1);R.push({name:P,isAsync:S,fullText:`${P}: ${$1}function(${D0}) {${A9}}`}),$=Z0}let U=!Q.has(H);if(U)Q.set(H,new Set);let L=Q.get(H);for(let V of R)L.add(V.name);let B=R.map((V)=>` ${V.fullText}`).join(`,
20
20
  `),I;if(U)I=`${W}const __ext_${H} = {
21
21
  ${B}
22
22
  ${W}}
@@ -26,7 +26,7 @@ ${W}})
26
26
  `;for(let V of R)I+=`${W}if (__tjs?.registerExtension) { __tjs.registerExtension('${H}', '${V.name}', __ext_${H}.${V.name}) }
27
27
  `;Y+=I,J=_}if(J<=Z.length&&Y.length<Z.length);return{source:Y,extensions:Q}}function Z9(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,$)=>{return $?`__ext_String.${R}.call(${q})`:`__ext_String.${R}.call(${q}, `});let H=new RegExp(`("(?:[^"\\\\]|\\\\.)*")\\.(${X})\\((\\))?`,"g");J=J.replace(H,(_,q,R,$)=>{return $?`__ext_String.${R}.call(${q})`:`__ext_String.${R}.call(${q}, `});let G=new RegExp("(`(?:[^`\\\\]|\\\\.)*`)\\."+X+"\\((\\))?","g");J=J.replace(G,(_,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,G;while((G=J.indexOf(W,H))!==-1){let _=1,q=G-1,R=!1;while(q>=0&&_>0){let $=J[q];if(R){if($===R&&(q===0||J[q-1]!=="\\"))R=!1}else{if($==="]")_++;if($==="[")_--;if($==="'"||$==='"'||$==="`")R=$}q--}if(_===0){let $=J.slice(q+1,G+1),O=J.slice(0,q+1),U=J.slice(G+W.length);if(U[0]===")")J=`${O}__ext_Array.${X}.call(${$})${U.slice(1)}`;else J=`${O}__ext_Array.${X}.call(${$}, ${U}`}H=G+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,G,_,q)=>{return q?`__ext_Number.${_}.call(${G})`:`__ext_Number.${_}.call(${G}, `})}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
28
  `)Y++,J=0;else J++;return{line:Y,column:J}}function Q9(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 G=Z[H];if(!K&&(G==="'"||G==='"'||G==="`")){K=G,X+=G;continue}if(K){if(X+=G,G==="\\"){if(H++,H<Z.length)X+=Z[H];continue}if(G===K)K=!1;continue}if(G==="("||G==="["||G==="{"){J++,X+=G;continue}if(G===")"||G==="]"||G==="}"){J--,X+=G;continue}if(G===","&&J===0){let _=l8(X.trim(),Q);if(_)Y.push(_);X="";continue}X+=G}let W=X.trim();if(W){let H=l8(W,Q);if(H)Y.push(H)}return Y}function l8(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],G=J+1<Z.length?Z[J+1]:"";if(K){if(H===`
29
- `)K=!1;J++;continue}if(W){if(H==="*"&&G==="/"){W=!1,J+=2;continue}J++;continue}if(X){if(H==="\\"){J+=2;continue}if(H===X)X=!1;J++;continue}if(H==="/"&&G==="/"){K=!0,J+=2;continue}if(H==="/"&&G==="*"){W=!0,J+=2;continue}if(H==="'"||H==='"'||H==="`"){X=H,J++;continue}if(H==="{")Y++;if(H==="}")Y--;J++}return J}function Y9(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],$=!!K[2],O=K[3],U=K.index,L=U,I=K[0].indexOf("function");if(I>=0)L=U+I;W.push({name:O,fullMatchStart:U,funcKeywordStart:L,exported:R,isAsync:$})}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 G=new Set;for(let[R,$]of H)if($>1)G.add(R);if(G.size===0)return{source:Z,polymorphicNames:Y};for(let R of W){if(!G.has(R.name))continue;let $=Z.indexOf("(",R.funcKeywordStart);if($===-1)continue;let O=1,U=$+1;while(U<Z.length&&O>0){if(Z[U]==="(")O++;if(Z[U]===")")O--;U++}let L=U-1,B=Z.slice($+1,L),I=U;while(I<Z.length&&Z[I]!=="{")I++;if(I>=Z.length)continue;let V=u0(Z,I),j=R.fullMatchStart;while(j>0&&Z[j-1]===" ")j--;let N=X.get(R.name),S=y1(B,Q);if(B.includes("...")){let D=m0(Z,R.funcKeywordStart);throw new r(`Rest parameters are not supported in polymorphic function '${R.name}'. Use separate function names instead.`,D)}N.push({index:N.length+1,start:j,end:V,text:Z.slice(j,V),exported:R.exported,isAsync:R.isAsync,params:S})}for(let[R,$]of X){if($.length<2)continue;let O=$.filter((U)=>U.isAsync).length;if(O>0&&O<$.length){let U=m0(Z,$[0].start);throw new r(`Polymorphic function '${R}': all variants must be either sync or async, not mixed.`,U)}for(let U=0;U<$.length;U++)for(let L=U+1;L<$.length;L++){let B=$[U],I=$[L];if(B.params.length!==I.params.length)continue;let V=!0;for(let j=0;j<B.params.length;j++){let N=B.params[j].defaultValue?q1(B.params[j].defaultValue):"any",S=I.params[j].defaultValue?q1(I.params[j].defaultValue):"any";if(N!==S){V=!1;break}}if(V){let j=m0(Z,I.start);throw new r(`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.`,j)}}}let _=[];for(let[R,$]of X){if($.length<2)continue;for(let O of $)_.push({name:R,variant:O})}_.sort((R,$)=>$.variant.start-R.variant.start);let q=Z;for(let{name:R,variant:$}of _){let O=$.isAsync?"async ":"",U=$.text.replace(new RegExp(`(?:export\\s+)?${O?O.replace(/\s+$/,"\\s+"):""}function\\s+${R}\\s*\\(`),`${O}function ${R}$$${$.index}(`);q=q.slice(0,$.start)+U+q.slice($.end)}for(let[R,$]of X){if($.length<2)continue;Y.add(R);let O=$[0].isAsync,U=$.some((N)=>N.exported),L=O?"async ":"",B=U?"export ":"",I=[...$].sort((N,S)=>{if(N.params.length!==S.params.length)return 0;let P=0,D=0;for(let C of N.params){let b=C.defaultValue?q1(C.defaultValue):"any";if(b==="non-negative-integer")P+=3;else if(b==="integer")P+=2;else if(b!=="any")P+=1}for(let C of S.params){let b=C.defaultValue?q1(C.defaultValue):"any";if(b==="non-negative-integer")D+=3;else if(b==="integer")D+=2;else if(b!=="any")D+=1}return D-P}),V=[];for(let N of I){let S=[`__args.length === ${N.params.length}`],P=[];for(let D=0;D<N.params.length;D++){let C=N.params[D];if(P.push(`__args[${D}]`),C.defaultValue){let b=Q9(`__args[${D}]`,C.defaultValue);if(b!=="true")S.push(b)}}V.push(` if (${S.join(" && ")}) return ${R}$${N.index}(${P.join(", ")})`)}let j=`
29
+ `)K=!1;J++;continue}if(W){if(H==="*"&&G==="/"){W=!1,J+=2;continue}J++;continue}if(X){if(H==="\\"){J+=2;continue}if(H===X)X=!1;J++;continue}if(H==="/"&&G==="/"){K=!0,J+=2;continue}if(H==="/"&&G==="*"){W=!0,J+=2;continue}if(H==="'"||H==='"'||H==="`"){X=H,J++;continue}if(H==="{")Y++;if(H==="}")Y--;J++}return J}function Y9(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],$=!!K[2],O=K[3],U=K.index,L=U,I=K[0].indexOf("function");if(I>=0)L=U+I;W.push({name:O,fullMatchStart:U,funcKeywordStart:L,exported:R,isAsync:$})}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 G=new Set;for(let[R,$]of H)if($>1)G.add(R);if(G.size===0)return{source:Z,polymorphicNames:Y};for(let R of W){if(!G.has(R.name))continue;let $=Z.indexOf("(",R.funcKeywordStart);if($===-1)continue;let O=1,U=$+1;while(U<Z.length&&O>0){if(Z[U]==="(")O++;if(Z[U]===")")O--;U++}let L=U-1,B=Z.slice($+1,L),I=U;while(I<Z.length&&Z[I]!=="{")I++;if(I>=Z.length)continue;let V=u0(Z,I),j=R.fullMatchStart;while(j>0&&Z[j-1]===" ")j--;let N=X.get(R.name),S=y1(B,Q);if(B.includes("...")){let D=m0(Z,R.funcKeywordStart);throw new t(`Rest parameters are not supported in polymorphic function '${R.name}'. Use separate function names instead.`,D)}N.push({index:N.length+1,start:j,end:V,text:Z.slice(j,V),exported:R.exported,isAsync:R.isAsync,params:S})}for(let[R,$]of X){if($.length<2)continue;let O=$.filter((U)=>U.isAsync).length;if(O>0&&O<$.length){let U=m0(Z,$[0].start);throw new t(`Polymorphic function '${R}': all variants must be either sync or async, not mixed.`,U)}for(let U=0;U<$.length;U++)for(let L=U+1;L<$.length;L++){let B=$[U],I=$[L];if(B.params.length!==I.params.length)continue;let V=!0;for(let j=0;j<B.params.length;j++){let N=B.params[j].defaultValue?q1(B.params[j].defaultValue):"any",S=I.params[j].defaultValue?q1(I.params[j].defaultValue):"any";if(N!==S){V=!1;break}}if(V){let j=m0(Z,I.start);throw new t(`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.`,j)}}}let _=[];for(let[R,$]of X){if($.length<2)continue;for(let O of $)_.push({name:R,variant:O})}_.sort((R,$)=>$.variant.start-R.variant.start);let q=Z;for(let{name:R,variant:$}of _){let O=$.isAsync?"async ":"",U=$.text.replace(new RegExp(`(?:export\\s+)?${O?O.replace(/\s+$/,"\\s+"):""}function\\s+${R}\\s*\\(`),`${O}function ${R}$$${$.index}(`);q=q.slice(0,$.start)+U+q.slice($.end)}for(let[R,$]of X){if($.length<2)continue;Y.add(R);let O=$[0].isAsync,U=$.some((N)=>N.exported),L=O?"async ":"",B=U?"export ":"",I=[...$].sort((N,S)=>{if(N.params.length!==S.params.length)return 0;let P=0,D=0;for(let C of N.params){let b=C.defaultValue?q1(C.defaultValue):"any";if(b==="non-negative-integer")P+=3;else if(b==="integer")P+=2;else if(b!=="any")P+=1}for(let C of S.params){let b=C.defaultValue?q1(C.defaultValue):"any";if(b==="non-negative-integer")D+=3;else if(b==="integer")D+=2;else if(b!=="any")D+=1}return D-P}),V=[];for(let N of I){let S=[`__args.length === ${N.params.length}`],P=[];for(let D=0;D<N.params.length;D++){let C=N.params[D];if(P.push(`__args[${D}]`),C.defaultValue){let b=Q9(`__args[${D}]`,C.defaultValue);if(b!=="true")S.push(b)}}V.push(` if (${S.join(" && ")}) return ${R}$${N.index}(${P.join(", ")})`)}let j=`
30
30
  ${B}${L}function ${R}(...__args) {
31
31
  ${V.join(`
32
32
  `)}
@@ -34,21 +34,21 @@ ${V.join(`
34
34
  }
35
35
  `;q+=j}return{source:q,polymorphicNames:Y}}function J9(Z){return Z.replace(/(?<=^|[;\n{])\s*([A-Z][a-zA-Z0-9_]*)\s*=(?!=)/gm,(Q,Y)=>{return Q.replace(Y,`const ${Y}`)})}function X9(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,G=K+W[0].length,_,q=Z.slice(G).match(/^(['"`])([^]*?)\1\s*/);if(q)_=q[2],G+=q[0].length;if(Z[G]==="{"){let R=G+1,$=1,O=R;while(O<Z.length&&$>0){let U=Z[O];if(U==="{")$++;else if(U==="}")$--;O++}if($===0){let U=Z.slice(R,O-1).trim(),L=O,B=(Z.slice(0,H).match(/\n/g)||[]).length+1;if(Y.push({description:_,body:U,start:H,end:L,line:B}),!Q)try{Function(U)()}catch(j){let N=_||`test at line ${B}`;J.push(`Test failed: ${N} (line ${B})
36
36
  ${j.message||j}`)}let V=(Z.slice(H,L).match(/\n/g)||[]).length;X+=`
37
- `.repeat(V),K=L;continue}}}X+=Z[K],K++}return{source:X,tests:Y,errors:J}}function W9(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],G=X[2]?.trim()||"",_=X.index+X[0].length-1,q=u0(Z,_),R=Z.slice(_,q);K.push({className:H,extendsClause:G,bodyStart:_,bodyEnd:q,body:R})}let W=Z;for(let H=K.length-1;H>=0;H--){let{className:G,extendsClause:_,bodyStart:q,bodyEnd:R,body:$}=K[H],O=/\bconstructor\s*\(/g,U,L=[];while((U=O.exec($))!==null)L.push(U.index);if(L.length<2)continue;Y.add(G);let B=[];for(let D=0;D<L.length;D++){let C=L[D],b=$.indexOf("(",C),h=1,f=b+1;while(f<$.length&&h>0){if($[f]==="(")h++;if($[f]===")")h--;f++}let Z0=$.slice(b+1,f-1),t=f;while(t<$.length&&$[t]!=="{")t++;let D0=u0($,t),$1=$.slice(t+1,D0-1);B.push({index:D+1,paramStr:Z0,bodyText:$1,fullStart:C,fullEnd:D0})}let I=$.slice(0,B[0].fullEnd),V=B[B.length-1].fullEnd;I+=$.slice(V);let j=$;for(let D=B.length-1;D>=1;D--){let C=B[D],b=C.fullStart;while(b>0&&j[b-1]===" ")b--;if(b>0&&j[b-1]===`
38
- `)b--;j=j.slice(0,b)+j.slice(C.fullEnd)}let N="";for(let D=1;D<B.length;D++){let C=B[D],b=y1(C.paramStr,Q);if(C.paramStr.includes("...")){let f=m0(Z,q+C.fullStart);throw new r(`Rest parameters are not supported in polymorphic constructors for '${G}'.`,f)}N+=`
37
+ `.repeat(V),K=L;continue}}}X+=Z[K],K++}return{source:X,tests:Y,errors:J}}function W9(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],G=X[2]?.trim()||"",_=X.index+X[0].length-1,q=u0(Z,_),R=Z.slice(_,q);K.push({className:H,extendsClause:G,bodyStart:_,bodyEnd:q,body:R})}let W=Z;for(let H=K.length-1;H>=0;H--){let{className:G,extendsClause:_,bodyStart:q,bodyEnd:R,body:$}=K[H],O=/\bconstructor\s*\(/g,U,L=[];while((U=O.exec($))!==null)L.push(U.index);if(L.length<2)continue;Y.add(G);let B=[];for(let D=0;D<L.length;D++){let C=L[D],b=$.indexOf("(",C),h=1,f=b+1;while(f<$.length&&h>0){if($[f]==="(")h++;if($[f]===")")h--;f++}let Z0=$.slice(b+1,f-1),e=f;while(e<$.length&&$[e]!=="{")e++;let D0=u0($,e),$1=$.slice(e+1,D0-1);B.push({index:D+1,paramStr:Z0,bodyText:$1,fullStart:C,fullEnd:D0})}let I=$.slice(0,B[0].fullEnd),V=B[B.length-1].fullEnd;I+=$.slice(V);let j=$;for(let D=B.length-1;D>=1;D--){let C=B[D],b=C.fullStart;while(b>0&&j[b-1]===" ")b--;if(b>0&&j[b-1]===`
38
+ `)b--;j=j.slice(0,b)+j.slice(C.fullEnd)}let N="";for(let D=1;D<B.length;D++){let C=B[D],b=y1(C.paramStr,Q);if(C.paramStr.includes("...")){let f=m0(Z,q+C.fullStart);throw new t(`Rest parameters are not supported in polymorphic constructors for '${G}'.`,f)}N+=`
39
39
  function ${G}$ctor$${C.index}(${C.paramStr}) {`,N+=`
40
40
  const __obj = Object.create(${G}.prototype)`,N+=`
41
41
  ;(function() {${C.bodyText}}).call(__obj)`,N+=`
42
42
  return __obj`,N+=`
43
43
  }
44
- `}let S=[];for(let D=0;D<B.length;D++){let C=B[D],b=y1(C.paramStr,Q),h=[`a.length === ${b.length}`];for(let f=0;f<b.length;f++){let Z0=b[f];if(Z0.defaultValue){let t=Q9(`a[${f}]`,Z0.defaultValue);if(t!=="true")h.push(t)}}if(D===0)S.push(` if (${h.join(" && ")}) return Reflect.construct(t, a)`);else{let f=b.map((Z0,t)=>`a[${t}]`).join(", ");S.push(` if (${h.join(" && ")}) return ${G}$ctor$${C.index}(${f})`)}}N+=`
44
+ `}let S=[];for(let D=0;D<B.length;D++){let C=B[D],b=y1(C.paramStr,Q),h=[`a.length === ${b.length}`];for(let f=0;f<b.length;f++){let Z0=b[f];if(Z0.defaultValue){let e=Q9(`a[${f}]`,Z0.defaultValue);if(e!=="true")h.push(e)}}if(D===0)S.push(` if (${h.join(" && ")}) return Reflect.construct(t, a)`);else{let f=b.map((Z0,e)=>`a[${e}]`).join(", ");S.push(` if (${h.join(" && ")}) return ${G}$ctor$${C.index}(${f})`)}}N+=`
45
45
  function ${G}$dispatch(t, a) {
46
46
  `,N+=S.join(`
47
47
  `)+`
48
48
  `,N+=` return __tjs.typeError('${G}', 'no matching constructor', a)
49
49
  `,N+=`}
50
- `,W=W.slice(0,q)+j+W.slice(R);let P=q+j.length;W=W.slice(0,P)+N+W.slice(P)}return{source:W,polyCtorClasses:Y}}function K9(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]||"",G=K.index,_=G+K[0].length-1,q=1,R=_+1;while(R<Z.length&&q>0){let $=Z[R];if($==="{")q++;else if($==="}")q--;R++}if(q===0){let $=R,O=Z.slice(_,$);if(J+=Z.slice(X,G),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=$}}return J+=Z.slice(X),J}function H9(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 z9(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 D6(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},G=Z.match(/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*safety\s+(none|inputs|all)\b/);if(G)J=G[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|TjsStandard|TjsSafeEval)\b/,q;while(q=Z.match(_)){let j=q[2];if(j==="TjsStrict")H.tjsEquals=!0,H.tjsClass=!0,H.tjsDate=!0,H.tjsNoeval=!0,H.tjsStandard=!0;else if(j==="TjsEquals")H.tjsEquals=!0;else if(j==="TjsClass")H.tjsClass=!0;else if(j==="TjsDate")H.tjsDate=!0;else if(j==="TjsNoeval")H.tjsNoeval=!0;else if(j==="TjsStandard")H.tjsStandard=!0;else if(j==="TjsSafeEval")H.tjsSafeEval=!0;Z=Z.replace(new RegExp(`^(\\s*(?:\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/\\s*)*)\\s*${j}\\s*`),"$1")}if(H.tjsStandard)Z=c8(Z);if(Z=n8(Z),H.tjsEquals&&!Q.vmTarget)Z=o8(Z);Z=a8(Z),Z=s8(Z),Z=r8(Z),Z=t8(Z),Z=J9(Z);let{source:R,returnType:$,returnSafety:O}=G1(Z,{originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W});Z=R;let U=e8(Z);Z=U.source,Z=p8(Z);let L=Y9(Z,X);Z=L.source;let B=i8(Z);Z=B.source;let I=X9(Z,Q.dangerouslySkipTests);Z=I.source;let V=W9(Z,X);Z=V.source;for(let j of V.polyCtorClasses)K.add(`${j}$dispatch`);if(H.tjsClass)Z=K9(Z,V.polyCtorClasses);if(H.tjsDate)Z=H9(Z);if(H.tjsNoeval)Z=z9(Z);return Z=Z9(Z,U.extensions),{source:Z,returnType:$,returnSafety:O,moduleSafety:J,tjsModes:H,originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W,wasmBlocks:B.blocks,tests:I.tests,testErrors:I.errors,polymorphicNames:L.polymorphicNames,extensions:U.extensions}}function G9(Z,Q={}){let{filename:Y="<source>",colonShorthand:J=!0,vmTarget:X=!1}=Q,{source:K,returnType:W,returnSafety:H,moduleSafety:G,originalSource:_,requiredParams:q,unsafeFunctions:R,safeFunctions:$,wasmBlocks:O,tests:U,testErrors:L}=J?D6(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:G,originalSource:_,requiredParams:q,unsafeFunctions:R,safeFunctions:$,wasmBlocks:O,tests:U,testErrors:L}}catch(B){let I=B.loc||{line:1,column:0};throw new r(B.message.replace(/\s*\(\d+:\d+\)$/,""),I,_,Y)}}function _9(Z,Q){for(let J of Z.body){if(J.type==="ImportDeclaration")throw new r("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 r("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 r("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 r("Source must contain a function declaration",{line:1,column:0},void 0,Q);if(Y.length>1){let J=Y[1];throw new r("Only a single function per agent is allowed",J.loc?.start||{line:1,column:0},void 0,Q)}return Y[0]}function q9(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 $=q[1],O=$.split(`
50
+ `,W=W.slice(0,q)+j+W.slice(R);let P=q+j.length;W=W.slice(0,P)+N+W.slice(P)}return{source:W,polyCtorClasses:Y}}function K9(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]||"",G=K.index,_=G+K[0].length-1,q=1,R=_+1;while(R<Z.length&&q>0){let $=Z[R];if($==="{")q++;else if($==="}")q--;R++}if(q===0){let $=R,O=Z.slice(_,$);if(J+=Z.slice(X,G),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=$}}return J+=Z.slice(X),J}function H9(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 z9(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 C6(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},G=Z.match(/^(\s*(?:\/\/[^\n]*\n|\/\*[\s\S]*?\*\/\s*)*)\s*safety\s+(none|inputs|all)\b/);if(G)J=G[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|TjsStandard|TjsSafeEval)\b/,q;while(q=Z.match(_)){let j=q[2];if(j==="TjsStrict")H.tjsEquals=!0,H.tjsClass=!0,H.tjsDate=!0,H.tjsNoeval=!0,H.tjsStandard=!0;else if(j==="TjsEquals")H.tjsEquals=!0;else if(j==="TjsClass")H.tjsClass=!0;else if(j==="TjsDate")H.tjsDate=!0;else if(j==="TjsNoeval")H.tjsNoeval=!0;else if(j==="TjsStandard")H.tjsStandard=!0;else if(j==="TjsSafeEval")H.tjsSafeEval=!0;Z=Z.replace(new RegExp(`^(\\s*(?:\\/\\/[^\\n]*\\n|\\/\\*[\\s\\S]*?\\*\\/\\s*)*)\\s*${j}\\s*`),"$1")}if(H.tjsStandard)Z=n8(Z);if(Z=c8(Z),H.tjsEquals&&!Q.vmTarget)Z=o8(Z);Z=a8(Z),Z=s8(Z),Z=r8(Z),Z=t8(Z),Z=J9(Z);let{source:R,returnType:$,returnSafety:O}=G1(Z,{originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W});Z=R;let U=e8(Z);Z=U.source,Z=p8(Z);let L=Y9(Z,X);Z=L.source;let B=i8(Z);Z=B.source;let I=X9(Z,Q.dangerouslySkipTests);Z=I.source;let V=W9(Z,X);Z=V.source;for(let j of V.polyCtorClasses)K.add(`${j}$dispatch`);if(H.tjsClass)Z=K9(Z,V.polyCtorClasses);if(H.tjsDate)Z=H9(Z);if(H.tjsNoeval)Z=z9(Z);return Z=Z9(Z,U.extensions),{source:Z,returnType:$,returnSafety:O,moduleSafety:J,tjsModes:H,originalSource:Y,requiredParams:X,unsafeFunctions:K,safeFunctions:W,wasmBlocks:B.blocks,tests:I.tests,testErrors:I.errors,polymorphicNames:L.polymorphicNames,extensions:U.extensions}}function G9(Z,Q={}){let{filename:Y="<source>",colonShorthand:J=!0,vmTarget:X=!1}=Q,{source:K,returnType:W,returnSafety:H,moduleSafety:G,originalSource:_,requiredParams:q,unsafeFunctions:R,safeFunctions:$,wasmBlocks:O,tests:U,testErrors:L}=J?C6(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:G,originalSource:_,requiredParams:q,unsafeFunctions:R,safeFunctions:$,wasmBlocks:O,tests:U,testErrors:L}}catch(B){let I=B.loc||{line:1,column:0};throw new t(B.message.replace(/\s*\(\d+:\d+\)$/,""),I,_,Y)}}function _9(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 q9(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 $=q[1],O=$.split(`
51
51
  `),U=O.filter((L)=>L.trim().length>0).reduce((L,B)=>{let I=B.match(/^(\s*)/)?.[1].length||0;return Math.min(L,I)},1/0);if(U>0&&U<1/0)$=O.map((L)=>L.slice(U)).join(`
52
- `);return Y.description=$.trim(),Y}}let K=J.match(/\/\*\*[\s\S]*?\*\/\s*$/);if(!K)return Y;let W=K[0],H=W.match(/\/\*\*\s*\n?\s*\*?\s*([^@\n][^\n]*)/m);if(H)Y.description=H[1].trim();let G=/@param\s+(?:\{[^}]+\}\s+)?(\w+)\s*-?\s*(.*)/g,_;while((_=G.exec(W))!==null)Y.params[_[1]]=_[2].trim();return Y}function q0(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"}};return{kind:"array",items:q0(Q[0])}}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]=q0(J.value)}return{kind:"object",shape:Y}}case"LogicalExpression":{let{operator:Q,left:Y,right:J}=Z;if(Q==="||"){let X=q0(Y),K=q0(J);if(K.kind==="null")return{...X,nullable:!0};if(X.kind==="null")return{...K,nullable:!0};return{kind:"union",members:[X,K]}}if(Q==="&&")return q0(J);if(Q==="??")return q0(J);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",d(Z));let X=Y.name,K=Q?.has(X)??!1,W=q0(J),H=I0(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),G=Q?.has(W)??!1;J[W]=H.type,X[W]={name:W,type:H.type,required:G,default:G?null:H.example,example:H.example}}}return{name:"__destructured__",type:{kind:"object",shape:J,destructuredParams:X},required:!0}}throw new u(`Unsupported parameter pattern: ${Z.type}`,d(Z))}function I0(Z){switch(Z.type){case"Literal":return Z.value;case"ArrayExpression":return Z.elements.map((Q)=>Q?I0(Q):null);case"ObjectExpression":{let Q={};for(let Y of Z.properties)if(Y.type==="Property"&&Y.key.type==="Identifier")Q[Y.key.name]=I0(Y.value);return Q}case"UnaryExpression":if(Z.operator==="-"){let Q=I0(Z.argument);return typeof Q==="number"?-Q:void 0}if(Z.operator==="+"){let Q=I0(Z.argument);return typeof Q==="number"?+Q:void 0}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 I0(Y)??I0(J);if(Q==="??")return I0(Y)??I0(J);return}default:return}}function F9(Z){try{let Q=h8(Z,0,{ecmaVersion:2022});return q0(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 T6(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 R9(Z,Q,Y,J={},X){let K=q9(Q,Z),W=new Map;for(let B of Z.params){let I=f1(B,X);if(I.name==="__destructured__"&&I.type.kind==="object"&&I.type.destructuredParams)for(let[V,j]of Object.entries(I.type.destructuredParams))W.set(V,{...j,description:K.params[V]});else I.description=K.params[I.name],W.set(I.name,I)}let H;if(Y)H=F9(Y);let G={depth:0,locals:new Map,parameters:W,atoms:new Set(Object.keys(J.atoms||{})),warnings:[],source:Q,filename:J.filename||"<source>",options:J},_=F0(Z.body,G),q=[],R=[],$=[];for(let[B,I]of W.entries())if(I.required)R.push(B);else if(I.default!==void 0)$.push({name:B,defaultValue:I.default});else R.push(B);if(R.length>0)q.push({op:"varsImport",keys:R});for(let{name:B,defaultValue:I}of $)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:I}]});q.push(..._);let O=Object.fromEntries(W),U={name:Z.id?.name||"anonymous",description:K.description,parameters:O,returns:H},L=T6(O);return{ast:{op:"seq",steps:q,inputSchema:L},signature:U,warnings:G.warnings}}function F0(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 C6(Z,Q);case"ExpressionStatement":return P6(Z,Q);case"IfStatement":return b6(Z,Q);case"WhileStatement":return E6(Z,Q);case"ForOfStatement":return k6(Z,Q);case"TryStatement":return v6(Z,Q);case"ReturnStatement":return g6(Z,Q);case"ThrowStatement":throw new u("'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:F0(Z,K0(Q))};case"EmptyStatement":return null;default:throw new u(`Unsupported statement type: ${Z.type}`,d(Z),Q.source,Q.filename)}}function C6(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",d(K),Q.source,Q.filename);let W=K.id.name;if(K.init){let{step:H,resultVar:G}=V0(K.init,Q,W,J);if(H)Y.push(H);else if(G!==W)Y.push({op:X,key:W,value:G});let _=q0(K.init);Q.locals.set(W,_)}else{if(J)throw new u("const declarations must be initialized",d(K),Q.source,Q.filename);Y.push({op:"varSet",key:W,value:null}),Q.locals.set(W,{kind:"any",nullable:!0})}}return Y}function P6(Z,Q){let Y=Z.expression;if(Y.type==="AssignmentExpression")return S6(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:d(Z).line,column:d(Z).column}),null}function S6(Z,Q){if(Z.left.type!=="Identifier")throw new u("Only simple variable assignment is supported",d(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 b6(Z,Q){let Y=x(Z.test,Q),J=Z.consequent.type==="BlockStatement"?F0(Z.consequent,K0(Q)):[d0(Z.consequent,Q)].filter(Boolean),X;if(Z.alternate)X=Z.alternate.type==="BlockStatement"?F0(Z.alternate,K0(Q)):[d0(Z.alternate,Q)].filter(Boolean);return{op:"if",condition:Y,then:J,...X&&{else:X}}}function E6(Z,Q){let Y=x(Z.test,Q),J=Z.body.type==="BlockStatement"?F0(Z.body,K0(Q)):[d0(Z.body,Q)].filter(Boolean);return{op:"while",condition:Y,body:J}}function k6(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",d(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",d(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"?F0(Z.body,X):[d0(Z.body,X)].filter(Boolean);return{op:"map",items:J,as:Y,steps:K}}function v6(Z,Q){let Y=F0(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=F0(Z.handler.body,K)}return{op:"try",try:Y,...J&&{catch:J},...X&&{catchParam:X}}}function g6(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 O9=new Set(["Math","JSON","Array","Object","String","Number","console","Date","Schema"]),y6=new Set(["parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","Set","Date","filter"]),l0=new Set(["RegExp","Promise","Map","WeakSet","WeakMap","Symbol","Proxy","Reflect","Function","eval","setTimeout","setInterval","fetch","require","import","process","window","document","global","globalThis"]),f6=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 h6(Z){if(Z.callee.type==="Identifier"){let Q=Z.callee.name;return y6.has(Q)||l0.has(Q)}if(Z.callee.type==="MemberExpression"){let Q=Z.callee;if(Q.object.type==="Identifier"){let Y=Q.object.name;if(O9.has(Y)||l0.has(Y))return!0}if(Q.property.type==="Identifier"){let Y=Q.property.name;if(f6.has(Y))return!0}}return!1}function x6(Z){if(Z.object.type==="Identifier"){let Q=Z.object.name;return O9.has(Q)||l0.has(Q)}return!1}var $9={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 m6(Z){if(Z.callee.type==="Identifier"){let Q=Z.callee.name;if(l0.has(Q))return $9[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(l0.has(Y))return $9[Y]||`${Y} is not available in AsyncJS.`}}return null}function U9(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 G=U9(H);throw new u(`The 'new' keyword is not supported in AsyncJS.${G}`,d(Z),Q.source,Q.filename)}if(Z.type==="CallExpression"){let W=m6(Z);if(W)throw new u(W,d(Z),Q.source,Q.filename)}if(Z.type==="CallExpression"&&h6(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"&&x6(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 u6(Z,Q,Y,J);if(Z.type==="TemplateLiteral")return l6(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 u6(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 G=Z.callee;if(G.property.type==="Identifier")X=G.property.name,K=!0,W=i(G.object,Q);else throw new u("Computed method names are not supported",d(Z),Q.source,Q.filename)}else throw new u("Only named function calls are supported",d(Z),Q.source,Q.filename);if(K)return d6(X,W,Z.arguments,Q,Y,J);if(X==="console"&&Z.callee.type==="MemberExpression");let H=p6(Z,Q);return{step:{op:X,...H,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function d6(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],G=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(G,{kind:"any"});let q;if(W.body.type==="BlockStatement")q=F0(W.body,_);else{let{step:R,resultVar:$}=V0(W.body,_,"result");q=R?[R]:[{op:"varSet",key:"result",value:$}]}return{step:{op:"map",items:Q,as:G,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],G=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(G,{kind:"any"});let q;if(W.body.type==="BlockStatement")throw new u("filter callback must be an expression, not a block",d(Y[0]),J.source,J.filename);else q=x(W.body,_);return{step:{op:"filter",items:Q,as:G,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],G=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(G,{kind:"any"});let q;if(W.body.type==="BlockStatement")throw new u("find callback must be an expression, not a block",d(Y[0]),J.source,J.filename);else q=x(W.body,_);return{step:{op:"find",items:Q,as:G,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],G=W.params[1],_=H?.type==="Identifier"?H.name:"acc",q=G?.type==="Identifier"?G.name:"item",R=K0(J);R.locals.set(_,{kind:"any"}),R.locals.set(q,{kind:"any"});let $;if(W.body.type==="BlockStatement")$=F0(W.body,R);else{let{step:U,resultVar:L}=V0(W.body,R,"result");$=U?[U]:[{op:"varSet",key:"result",value:L}]}let O=i(Y[1],J);return{step:{op:"reduce",items:Q,as:q,accumulator:_,initial:O,steps:$,...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 l6(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],G=`_${W}`;K[G]=i(H,Q),X+=`{{${G}}}`}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",d(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",d(Z),Q.source,Q.filename)}case"NewExpression":{let Y=Z,J="constructor";if(Y.callee.type==="Identifier")J=Y.callee.name;let X=U9(J);throw new u(`The 'new' keyword is not supported in AsyncJS.${X}`,d(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",d(Z),Q.source,Q.filename);default:throw new u(`Unsupported expression type in condition: ${Z.type}`,d(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 p6(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 I9(Z,Q={}){let{ast:Y,returnType:J,originalSource:X,requiredParams:K}=G9(Z,{filename:Q.filename,colonShorthand:!0,vmTarget:!0}),W=_9(Y,Q.filename),{ast:H,signature:G,warnings:_}=R9(W,X,J,Q,K);return{ast:H,signature:G,warnings:_}}var n6=10;class c6{atoms;constructor(Z={}){this.atoms={...n1,...Z}}get builder(){return new o(this.atoms)}get Agent(){return new o(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=I9(Z).ast}catch(O){throw Error(`AJS transpilation failed: ${O.message}`)}else J=Z;let X=Y.fuel??1000,K=Y.timeoutMs??X*n6,W=Y.capabilities??{},H=[];if(!W.store){let O=new Map,U=!1;W.store={get:async(L)=>{if(!U)U=!0,H.push("Using default in-memory store (not suitable for production)");return O.get(L)},set:async(L,B)=>{if(!U)U=!0,H.push("Using default in-memory store (not suitable for production)");O.set(L,B)}}}let G=new AbortController,_=setTimeout(()=>G.abort(),K);if(Y.signal)Y.signal.addEventListener("abort",()=>G.abort());let q={fuel:{current:X},args:Q,state:{},consts:new Set,capabilities:W,resolver:(O)=>this.resolve(O),output:void 0,signal:G.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&&!i6(Q,R)){let O=new e("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(G.signal.addEventListener("abort",()=>{U(Error(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))}),G.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")||G.signal.aborted)q.error=new e(`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 $=[...H,...q.warnings??[]];return{result:q.output,error:q.error,fuelUsed:X-q.fuel.current,trace:q.trace,warnings:$.length>0?$:void 0}}}import{s as k}from"tosijs-schema";var M9=T("storeVectorize",k.object({text:k.string,model:k.string.optional}),k.array(k.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}),B9=T("storeCreateCollection",k.object({collection:k.string,dimension:k.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}),L9=T("storeVectorAdd",k.object({collection:k.string,doc:k.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}),j9=T("storeSearch",k.object({collection:k.string,queryVector:k.array(k.number),k:k.number.optional,filter:k.record(k.any).optional}),k.array(k.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),G=M(Y,X)??5,_=M(J,X);return K.vectorSearch(W,H,G,_)},{docs:"Search vector store",cost:(Z,Q)=>5+(M(Z.k,Q)??5)}),N9=T("llmPredictBattery",k.object({system:k.string.optional,user:k.string,tools:k.array(k.any).optional,responseFormat:k.any.optional}),k.object({role:k.string.optional,content:k.string.optional,tool_calls:k.array(k.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),G=M(Y,X),_=M(J,X);return K.predict(W,H,G,_)},{docs:"Generate completion using LLM battery",cost:100}),w9=T("llmVision",k.object({system:k.string.optional,prompt:k.string,images:k.array(k.string),responseFormat:k.any.optional}),k.object({role:k.string.optional,content:k.string.optional,tool_calls:k.array(k.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),G=M(Y,X)??[],_=M(J,X);return K.predict(W,{text:H,images:G},void 0,_)},{docs:"Analyze images using a vision model",timeoutMs:120000,cost:150});var T7={storeCreateCollection:B9,storeSearch:j9,storeVectorAdd:L9,storeVectorize:M9,llmPredictBattery:N9,llmVision:w9};export{MZ as xmlParse,g9 as whileLoop,qZ as vectorSearch,l9 as varsLet,d9 as varsImport,p9 as varsExport,x9 as varSet,u9 as varGet,NZ as uuid,f9 as tryCatch,RZ as transpileCode,ZZ as template,GZ as storeSet,_Z as storeQuery,DZ as storeProcedure,zZ as storeGet,t9 as split,Q0 as seq,i9 as scope,OZ as runCode,y9 as ret,M as resolveValue,M1 as resolveProcedureToken,TZ as releaseProcedure,QZ as regexMatch,o9 as reduce,jZ as random,s9 as push,C0 as procedureStore,YZ as pick,JZ as omit,XZ as merge,BZ as memoize,n9 as map,FZ as llmPredict,r9 as len,WZ as keys,IZ as jsonStringify,UZ as jsonParse,e9 as join,I1 as isProcedureToken,a6 as isAgentError,v9 as iff,B1 as hash,a9 as find,c9 as filter,HZ as fetch,l as evaluateExpr,h9 as errorAtom,T as defineAtom,B0 as createChildScope,n1 as coreAtoms,m9 as constSet,AZ as consoleWarn,wZ as consoleLog,VZ as consoleError,CZ as clearExpiredProcedures,LZ as cache,$0 as builtins,T7 as batteryAtoms,$Z as agentRun,U1 as PROCEDURE_TOKEN_PREFIX,V9 as DEFAULT_PROCEDURE_TTL,D9 as DEFAULT_MAX_AST_SIZE,c6 as AgentVM,e as AgentError};
52
+ `);return Y.description=$.trim(),Y}}let K=J.match(/\/\*\*[\s\S]*?\*\/\s*$/);if(!K)return Y;let W=K[0],H=W.match(/\/\*\*\s*\n?\s*\*?\s*([^@\n][^\n]*)/m);if(H)Y.description=H[1].trim();let G=/@param\s+(?:\{[^}]+\}\s+)?(\w+)\s*-?\s*(.*)/g,_;while((_=G.exec(W))!==null)Y.params[_[1]]=_[2].trim();return Y}function 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"}};return{kind:"array",items:z0(Q[0])}}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",d(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),G=Q?.has(W)??!1;J[W]=H.type,X[W]={name:W,type:H.type,required:G,default:G?null:H.example,example:H.example}}}return{name:"__destructured__",type:{kind:"object",shape:J,destructuredParams:X},required:!0}}throw new u(`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 F9(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 P6(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 R9(Z,Q,Y,J={},X){let K=q9(Q,Z),W=new Map;for(let B of Z.params){let I=f1(B,X);if(I.name==="__destructured__"&&I.type.kind==="object"&&I.type.destructuredParams)for(let[V,j]of Object.entries(I.type.destructuredParams))W.set(V,{...j,description:K.params[V]});else I.description=K.params[I.name],W.set(I.name,I)}let H;if(Y)H=F9(Y);let G={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,G),q=[],R=[],$=[];for(let[B,I]of W.entries())if(I.required)R.push(B);else if(I.default!==void 0)$.push({name:B,defaultValue:I.default});else R.push(B);if(R.length>0)q.push({op:"varsImport",keys:R});for(let{name:B,defaultValue:I}of $)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:I}]});q.push(..._);let O=Object.fromEntries(W),U={name:Z.id?.name||"anonymous",description:K.description,parameters:O,returns:H},L=P6(O);return{ast:{op:"seq",steps:q,inputSchema:L},signature:U,warnings:G.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 S6(Z,Q);case"ExpressionStatement":return b6(Z,Q);case"IfStatement":return k6(Z,Q);case"WhileStatement":return v6(Z,Q);case"ForOfStatement":return g6(Z,Q);case"TryStatement":return y6(Z,Q);case"ReturnStatement":return f6(Z,Q);case"ThrowStatement":throw new u("'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,K0(Q))};case"EmptyStatement":return null;default:throw new u(`Unsupported statement type: ${Z.type}`,d(Z),Q.source,Q.filename)}}function S6(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",d(K),Q.source,Q.filename);let W=K.id.name;if(K.init){let{step:H,resultVar:G}=V0(K.init,Q,W,J);if(H)Y.push(H);else if(G!==W)Y.push({op:X,key:W,value:G});let _=z0(K.init);Q.locals.set(W,_)}else{if(J)throw new u("const declarations must be initialized",d(K),Q.source,Q.filename);Y.push({op:"varSet",key:W,value:null}),Q.locals.set(W,{kind:"any",nullable:!0})}}return Y}function b6(Z,Q){let Y=Z.expression;if(Y.type==="AssignmentExpression")return E6(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:d(Z).line,column:d(Z).column}),null}function E6(Z,Q){if(Z.left.type!=="Identifier")throw new u("Only simple variable assignment is supported",d(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 k6(Z,Q){let Y=x(Z.test,Q),J=Z.consequent.type==="BlockStatement"?$0(Z.consequent,K0(Q)):[d0(Z.consequent,Q)].filter(Boolean),X;if(Z.alternate)X=Z.alternate.type==="BlockStatement"?$0(Z.alternate,K0(Q)):[d0(Z.alternate,Q)].filter(Boolean);return{op:"if",condition:Y,then:J,...X&&{else:X}}}function v6(Z,Q){let Y=x(Z.test,Q),J=Z.body.type==="BlockStatement"?$0(Z.body,K0(Q)):[d0(Z.body,Q)].filter(Boolean);return{op:"while",condition:Y,body:J}}function g6(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",d(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",d(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):[d0(Z.body,X)].filter(Boolean);return{op:"map",items:J,as:Y,steps:K}}function y6(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 f6(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 O9=new Set(["Math","JSON","Array","Object","String","Number","console","Date","Schema"]),h6=new Set(["parseInt","parseFloat","isNaN","isFinite","encodeURI","decodeURI","encodeURIComponent","decodeURIComponent","Set","Date","filter"]),l0=new Set(["RegExp","Promise","Map","WeakSet","WeakMap","Symbol","Proxy","Reflect","Function","eval","setTimeout","setInterval","fetch","require","import","process","window","document","global","globalThis"]),x6=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 m6(Z){if(Z.callee.type==="Identifier"){let Q=Z.callee.name;return h6.has(Q)||l0.has(Q)}if(Z.callee.type==="MemberExpression"){let Q=Z.callee;if(Q.object.type==="Identifier"){let Y=Q.object.name;if(O9.has(Y)||l0.has(Y))return!0}if(Q.property.type==="Identifier"){let Y=Q.property.name;if(x6.has(Y))return!0}}return!1}function u6(Z){if(Z.object.type==="Identifier"){let Q=Z.object.name;return O9.has(Q)||l0.has(Q)}return!1}var $9={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 d6(Z){if(Z.callee.type==="Identifier"){let Q=Z.callee.name;if(l0.has(Q))return $9[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(l0.has(Y))return $9[Y]||`${Y} is not available in AsyncJS.`}}return null}function U9(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 G=U9(H);throw new u(`The 'new' keyword is not supported in AsyncJS.${G}`,d(Z),Q.source,Q.filename)}if(Z.type==="CallExpression"){let W=d6(Z);if(W)throw new u(W,d(Z),Q.source,Q.filename)}if(Z.type==="CallExpression"&&m6(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"&&u6(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 l6(Z,Q,Y,J);if(Z.type==="TemplateLiteral")return i6(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 l6(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 G=Z.callee;if(G.property.type==="Identifier")X=G.property.name,K=!0,W=i(G.object,Q);else throw new u("Computed method names are not supported",d(Z),Q.source,Q.filename)}else throw new u("Only named function calls are supported",d(Z),Q.source,Q.filename);if(K)return p6(X,W,Z.arguments,Q,Y,J);if(X==="console"&&Z.callee.type==="MemberExpression");let H=c6(Z,Q);return{step:{op:X,...H,...Y&&{result:Y},...Y&&J&&{resultConst:!0}},resultVar:Y}}function p6(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],G=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(G,{kind:"any"});let q;if(W.body.type==="BlockStatement")q=$0(W.body,_);else{let{step:R,resultVar:$}=V0(W.body,_,"result");q=R?[R]:[{op:"varSet",key:"result",value:$}]}return{step:{op:"map",items:Q,as:G,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],G=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(G,{kind:"any"});let q;if(W.body.type==="BlockStatement")throw new u("filter callback must be an expression, not a block",d(Y[0]),J.source,J.filename);else q=x(W.body,_);return{step:{op:"filter",items:Q,as:G,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],G=H?.type==="Identifier"?H.name:"item",_=K0(J);_.locals.set(G,{kind:"any"});let q;if(W.body.type==="BlockStatement")throw new u("find callback must be an expression, not a block",d(Y[0]),J.source,J.filename);else q=x(W.body,_);return{step:{op:"find",items:Q,as:G,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],G=W.params[1],_=H?.type==="Identifier"?H.name:"acc",q=G?.type==="Identifier"?G.name:"item",R=K0(J);R.locals.set(_,{kind:"any"}),R.locals.set(q,{kind:"any"});let $;if(W.body.type==="BlockStatement")$=$0(W.body,R);else{let{step:U,resultVar:L}=V0(W.body,R,"result");$=U?[U]:[{op:"varSet",key:"result",value:L}]}let O=i(Y[1],J);return{step:{op:"reduce",items:Q,as:q,accumulator:_,initial:O,steps:$,...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 i6(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],G=`_${W}`;K[G]=i(H,Q),X+=`{{${G}}}`}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",d(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",d(Z),Q.source,Q.filename)}case"NewExpression":{let Y=Z,J="constructor";if(Y.callee.type==="Identifier")J=Y.callee.name;let X=U9(J);throw new u(`The 'new' keyword is not supported in AsyncJS.${X}`,d(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",d(Z),Q.source,Q.filename);default:throw new u(`Unsupported expression type in condition: ${Z.type}`,d(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 c6(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 I9(Z,Q={}){let{ast:Y,returnType:J,originalSource:X,requiredParams:K}=G9(Z,{filename:Q.filename,colonShorthand:!0,vmTarget:!0}),W=_9(Y,Q.filename),{ast:H,signature:G,warnings:_}=R9(W,X,J,Q,K);return{ast:H,signature:G,warnings:_}}var o6=10;class a6{atoms;constructor(Z={}){this.atoms={...c1,...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=I9(Z).ast}catch(O){throw Error(`AJS transpilation failed: ${O.message}`)}else J=Z;let X=Y.fuel??1000,K=Y.timeoutMs??X*o6,W=Y.capabilities??{},H=[];if(!W.store){let O=new Map,U=!1;W.store={get:async(L)=>{if(!U)U=!0,H.push("Using default in-memory store (not suitable for production)");return O.get(L)},set:async(L,B)=>{if(!U)U=!0,H.push("Using default in-memory store (not suitable for production)");O.set(L,B)}}}let G=new AbortController,_=setTimeout(()=>G.abort(),K);if(Y.signal)Y.signal.addEventListener("abort",()=>G.abort());let q={fuel:{current:X},args:Q,state:{},consts:new Set,capabilities:W,resolver:(O)=>this.resolve(O),output:void 0,signal:G.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&&!n6(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(G.signal.addEventListener("abort",()=>{U(Error(`Execution timeout after ${K}ms (fuel: ${X}). Consider increasing fuel or optimizing your agent.`))}),G.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")||G.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 $=[...H,...q.warnings??[]];return{result:q.output,error:q.error,fuelUsed:X-q.fuel.current,trace:q.trace,warnings:$.length>0?$:void 0}}}import{s as k}from"tosijs-schema";var M9=T("storeVectorize",k.object({text:k.string,model:k.string.optional}),k.array(k.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}),B9=T("storeCreateCollection",k.object({collection:k.string,dimension:k.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}),L9=T("storeVectorAdd",k.object({collection:k.string,doc:k.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}),j9=T("storeSearch",k.object({collection:k.string,queryVector:k.array(k.number),k:k.number.optional,filter:k.record(k.any).optional}),k.array(k.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),G=M(Y,X)??5,_=M(J,X);return K.vectorSearch(W,H,G,_)},{docs:"Search vector store",cost:(Z,Q)=>5+(M(Z.k,Q)??5)}),N9=T("llmPredictBattery",k.object({system:k.string.optional,user:k.string,tools:k.array(k.any).optional,responseFormat:k.any.optional}),k.object({role:k.string.optional,content:k.string.optional,tool_calls:k.array(k.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),G=M(Y,X),_=M(J,X);return K.predict(W,H,G,_)},{docs:"Generate completion using LLM battery",cost:100}),w9=T("llmVision",k.object({system:k.string.optional,prompt:k.string,images:k.array(k.string),responseFormat:k.any.optional}),k.object({role:k.string.optional,content:k.string.optional,tool_calls:k.array(k.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),G=M(Y,X)??[],_=M(J,X);return K.predict(W,{text:H,images:G},void 0,_)},{docs:"Analyze images using a vision model",timeoutMs:120000,cost:150});var C7={storeCreateCollection:B9,storeSearch:j9,storeVectorAdd:L9,storeVectorize:M9,llmPredictBattery:N9,llmVision:w9};export{BZ as xmlParse,y9 as whileLoop,FZ as vectorSearch,p9 as varsLet,l9 as varsImport,i9 as varsExport,m9 as varSet,d9 as varGet,wZ as uuid,h9 as tryCatch,OZ as transpileCode,QZ as template,_Z as storeSet,qZ as storeQuery,TZ as storeProcedure,GZ as storeGet,e9 as split,Q0 as seq,c9 as scope,UZ as runCode,f9 as ret,M as resolveValue,M1 as resolveProcedureToken,CZ as releaseProcedure,YZ as regexMatch,a9 as reduce,NZ as random,r9 as push,C0 as procedureStore,JZ as pick,XZ as omit,WZ as merge,LZ as memoize,n9 as map,$Z as llmPredict,t9 as len,KZ as keys,MZ as jsonStringify,IZ as jsonParse,ZZ as join,I1 as isProcedureToken,V9 as isAgentError,g9 as iff,B1 as hash,s9 as find,o9 as filter,zZ as fetch,l as evaluateExpr,x9 as errorAtom,T as defineAtom,B0 as createChildScope,c1 as coreAtoms,u9 as constSet,VZ as consoleWarn,AZ as consoleLog,DZ as consoleError,PZ as clearExpiredProcedures,jZ as cache,R0 as builtins,C7 as batteryAtoms,RZ as agentRun,U1 as PROCEDURE_TOKEN_PREFIX,D9 as DEFAULT_PROCEDURE_TTL,T9 as DEFAULT_MAX_AST_SIZE,a6 as AgentVM,o as AgentError};
53
53
 
54
- //# debugId=53D109A349322FC564756E2164756E21
54
+ //# debugId=75F064089D6505A164756E2164756E21