@mcpcloud/runtime 0.12.3 → 0.12.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/adapters/node.d.ts +12 -0
- package/dist/compat-stdio.js +1 -1
- package/dist/compat-worker.js +1 -1
- package/dist/container-host.js +10 -10
- package/dist/index.js +22 -22
- package/dist/node.d.ts +1 -0
- package/dist/node.js +7 -7
- package/dist/sandbox/codeModeTool.d.ts +3 -1
- package/dist/stdio.js +12 -12
- package/package.json +1 -1
package/dist/stdio.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
/*! @mcpcloud/runtime v0.12.
|
|
2
|
-
var A3=Object.create;var{getPrototypeOf:j3,defineProperty:t1,getOwnPropertyNames:S3}=Object;var b3=Object.prototype.hasOwnProperty;function T3(W){return this[W]}var k3,v3,x3=(W,X,
|
|
3
|
-
Then, failed to dispose scope: ${
|
|
4
|
-
Attempted to suspend at:`);this.suspended=new z3(`(${this.suspendedCount++})`),H1("asyncify.handleSleep: suspending:",this.suspended),K.then((q)=>{this.suspended=void 0,H1("asyncify.handleSleep: resolved:",q),
|
|
1
|
+
/*! @mcpcloud/runtime v0.12.4 — (c) MCPCloud.sh. All rights reserved. SEE LICENSE: https://www.npmjs.com/package/@mcpcloud/runtime */
|
|
2
|
+
var A3=Object.create;var{getPrototypeOf:j3,defineProperty:t1,getOwnPropertyNames:S3}=Object;var b3=Object.prototype.hasOwnProperty;function T3(W){return this[W]}var k3,v3,x3=(W,X,Q)=>{var Y=W!=null&&typeof W==="object";if(Y){var K=X?k3??=new WeakMap:v3??=new WeakMap,q=K.get(W);if(q)return q}Q=W!=null?A3(j3(W)):{};let J=X||!W||!W.__esModule?t1(Q,"default",{value:W,enumerable:!0}):Q;for(let G of S3(W))if(!b3.call(J,G))t1(J,G,{get:T3.bind(W,G),enumerable:!0});if(Y)K.set(W,J);return J};var g3=(W,X)=>()=>(X||W((X={exports:{}}).exports,X),X.exports);var h3=(W)=>W;function y3(W,X){this[W]=h3.bind(null,X)}var a1=(W,X)=>{for(var Q in X)t1(W,Q,{get:X[Q],enumerable:!0,configurable:!0,set:y3.bind(X,Q)})};var s1=(W,X)=>()=>(W&&(X=W(W=0)),X);var S0,a9,m1,b0,$1;var u1=s1(()=>{S0={JS_EVAL_TYPE_GLOBAL:0,JS_EVAL_TYPE_MODULE:1,JS_EVAL_TYPE_DIRECT:2,JS_EVAL_TYPE_INDIRECT:3,JS_EVAL_TYPE_MASK:3,JS_EVAL_FLAG_STRICT:8,JS_EVAL_FLAG_STRIP:16,JS_EVAL_FLAG_COMPILE_ONLY:32,JS_EVAL_FLAG_BACKTRACE_BARRIER:64},a9={BaseObjects:1,Date:2,Eval:4,StringNormalize:8,RegExp:16,RegExpCompiler:32,JSON:64,Proxy:128,MapSet:256,TypedArrays:512,Promise:1024,BigInt:2048,BigFloat:4096,BigDecimal:8192,OperatorOverloading:16384,BignumExt:32768},m1={Pending:0,Fulfilled:1,Rejected:2},b0={JS_GPN_STRING_MASK:1,JS_GPN_SYMBOL_MASK:2,JS_GPN_PRIVATE_MASK:4,JS_GPN_ENUM_ONLY:16,JS_GPN_SET_ENUM:32,QTS_GPN_NUMBER_MASK:64,QTS_STANDARD_COMPLIANT_NUMBER:128},$1={IsStrictlyEqual:0,IsSameValue:1,IsSameValueZero:2}});function H1(...W){Y4&&console.log("quickjs-emscripten:",...W)}function*L3(W){return yield W}function M7(W){return L3(G4(W))}function eW(W,X){return(...Q)=>{let Y=X.call(W,K4,...Q);return G4(Y)}}function F7(W,X){let Q=X.call(W,K4);return G4(Q)}function G4(W){function X(Q){return Q.done?Q.value:Q.value instanceof Promise?Q.value.then((Y)=>X(W.next(Y)),(Y)=>X(W.throw(Y))):X(W.next(Q.value))}return X(W.next())}function s9(W,X){let Q;try{W.dispose()}catch(Y){Q=Y}if(X&&Q)throw Object.assign(X,{message:`${X.message}
|
|
3
|
+
Then, failed to dispose scope: ${Q.message}`,disposeError:Q}),X;if(X||Q)throw X||Q}function O7(W){let X=W?Array.from(W):[];function Q(){return X.forEach((K)=>K.alive?K.dispose():void 0)}function Y(){return X.some((K)=>K.alive)}return Object.defineProperty(X,Q4,{configurable:!0,enumerable:!1,value:Q}),Object.defineProperty(X,"dispose",{configurable:!0,enumerable:!1,value:Q}),Object.defineProperty(X,"alive",{configurable:!0,enumerable:!1,get:Y}),X}function l1(W){return!!(W&&(typeof W=="object"||typeof W=="function")&&("alive"in W)&&typeof W.alive=="boolean"&&("dispose"in W)&&typeof W.dispose=="function")}function Z7(W){if(!W)return 0;let X=0;for(let[Q,Y]of Object.entries(W)){if(!(Q in a9))throw new B3(Q);Y&&(X|=a9[Q])}return X}function R7(W){if(typeof W=="number")return W;if(W===void 0)return 0;let{type:X,strict:Q,strip:Y,compileOnly:K,backtraceBarrier:q}=W,J=0;return X==="global"&&(J|=S0.JS_EVAL_TYPE_GLOBAL),X==="module"&&(J|=S0.JS_EVAL_TYPE_MODULE),Q&&(J|=S0.JS_EVAL_FLAG_STRICT),Y&&(J|=S0.JS_EVAL_FLAG_STRIP),K&&(J|=S0.JS_EVAL_FLAG_COMPILE_ONLY),q&&(J|=S0.JS_EVAL_FLAG_BACKTRACE_BARRIER),J}function E7(W){if(typeof W=="number")return W;if(W===void 0)return 0;let{strings:X,symbols:Q,quickjsPrivate:Y,onlyEnumerable:K,numbers:q,numbersAsStrings:J}=W,G=0;return X&&(G|=b0.JS_GPN_STRING_MASK),Q&&(G|=b0.JS_GPN_SYMBOL_MASK),Y&&(G|=b0.JS_GPN_PRIVATE_MASK),K&&(G|=b0.JS_GPN_ENUM_ONLY),q&&(G|=b0.QTS_GPN_NUMBER_MASK),J&&(G|=b0.QTS_STANDARD_COMPLIANT_NUMBER),G}function I7(...W){let X=[];for(let Q of W)Q!==void 0&&(X=X.concat(Q));return X}function e9(W){return W>>8}function z4(W,X){X.interruptHandler&&W.setInterruptHandler(X.interruptHandler),X.maxStackSizeBytes!==void 0&&W.setMaxStackSize(X.maxStackSizeBytes),X.memoryLimitBytes!==void 0&&W.setMemoryLimit(X.memoryLimitBytes)}function B4(W,X){X.moduleLoader&&W.setModuleLoader(X.moduleLoader),X.shouldInterrupt&&W.setInterruptHandler(X.shouldInterrupt),X.memoryLimitBytes!==void 0&&W.setMemoryLimit(X.memoryLimitBytes),X.maxStackSizeBytes!==void 0&&W.setMaxStackSize(X.maxStackSizeBytes)}var H7,U7=(W,X)=>{for(var Q in X)H7(W,Q,{get:X[Q],enumerable:!0})},Y4=!1,L7,W4,G3,X4,q3,J3,z3,D7,w7,B3,$3,H3,U3,C0,K4,V0,Q4,W3,X0,T0,X3,D0,q4,V7,N7,m0,P7,D3=class{constructor(W){this.module=W}toPointerArray(W){let X=new Int32Array(W.map((K)=>K.value)),Q=X.length*X.BYTES_PER_ELEMENT,Y=this.module._malloc(Q);return new Uint8Array(this.module.HEAPU8.buffer,Y,Q).set(new Uint8Array(X.buffer)),new X0(Y,void 0,(K)=>this.module._free(K))}newTypedArray(W,X){let Q=new W(Array(X).fill(0)),Y=Q.length*Q.BYTES_PER_ELEMENT,K=this.module._malloc(Y),q=new W(this.module.HEAPU8.buffer,K,X);return q.set(Q),new X0({typedArray:q,ptr:K},void 0,(J)=>this.module._free(J.ptr))}newMutablePointerArray(W){return this.newTypedArray(Int32Array,W)}newHeapCharPointer(W){let X=this.module.lengthBytesUTF8(W),Q=X+1,Y=this.module._malloc(Q);return this.module.stringToUTF8(W,Y,Q),new X0({ptr:Y,strlen:X},void 0,(K)=>this.module._free(K.ptr))}newHeapBufferPointer(W){let X=W.byteLength,Q=this.module._malloc(X);return this.module.HEAPU8.set(W,Q),new X0({pointer:Q,numBytes:X},void 0,(Y)=>this.module._free(Y.pointer))}consumeHeapCharPointer(W){let X=this.module.UTF8ToString(W);return this.module._free(W),X}},ZG,RG,C7,Q3=-2147483648,Y3=2147483647,p1=0,_7=class{constructor(){this.nextId=Q3,this.freelist=[],this.groups=new Map}put(W){let X=this.allocateId(),Q=e9(X),Y=this.groups.get(Q);return Y||(Y=new Map,this.groups.set(Q,Y)),Y.set(X,W),X}get(W){if(W===p1)throw new C0("no host reference id defined");let X=e9(W),Q=this.groups.get(X);if(!Q)throw new C0(`host reference id ${W} is not defined`);let Y=Q.get(W);if(!Y)throw new C0(`host reference id ${W} is not defined`);return Y}delete(W){if(W===p1)throw new C0("no host reference id defined");let X=e9(W),Q=this.groups.get(X);if(!Q)throw new C0(`host reference id ${W} is not defined`);Q.delete(W),Q.size===0&&this.groups.delete(X),this.freelist.push(W)}allocateId(){if(this.freelist.length>0)return this.freelist.shift();if(this.nextId===p1&&this.nextId++,this.nextId>Y3)throw new U3(`HostRefMap: too many host refs created without disposing. Max simultaneous host refs: ${Y3-Q3}`);return this.nextId++}},K3,A7,j7,S7,b7=class{constructor(W){this.freeHostRef=W.freeHostRef,this.callFunction=W.callFunction,this.shouldInterrupt=W.shouldInterrupt,this.loadModuleSource=W.loadModuleSource,this.normalizeModule=W.normalizeModule}},J4=class{constructor(W){this.contextCallbacks=new Map,this.runtimeCallbacks=new Map,this.suspendedCount=0,this.cToHostCallbacks=new b7({freeHostRef:(X,Q,Y)=>{let K=this.runtimeCallbacks.get(Q);if(!K)throw Error(`QuickJSRuntime(rt = ${Q}) not found when trying to free HostRef(id = ${Y})`);K.freeHostRef(Q,Y)},callFunction:(X,Q,Y,K,q,J)=>this.handleAsyncify(X,()=>{try{let G=this.contextCallbacks.get(Q);if(!G)throw Error(`QuickJSContext(ctx = ${Q}) not found for C function call "${J}"`);return G.callFunction(Q,Y,K,q,J)}catch(G){return console.error("[C to host error: returning null]",G),0}}),shouldInterrupt:(X,Q)=>this.handleAsyncify(X,()=>{try{let Y=this.runtimeCallbacks.get(Q);if(!Y)throw Error(`QuickJSRuntime(rt = ${Q}) not found for C interrupt`);return Y.shouldInterrupt(Q)}catch(Y){return console.error("[C to host interrupt: returning error]",Y),1}}),loadModuleSource:(X,Q,Y,K)=>this.handleAsyncify(X,()=>{try{let q=this.runtimeCallbacks.get(Q);if(!q)throw Error(`QuickJSRuntime(rt = ${Q}) not found for C module loader`);let J=q.loadModuleSource;if(!J)throw Error(`QuickJSRuntime(rt = ${Q}) does not support module loading`);return J(Q,Y,K)}catch(q){return console.error("[C to host module loader error: returning null]",q),0}}),normalizeModule:(X,Q,Y,K,q)=>this.handleAsyncify(X,()=>{try{let J=this.runtimeCallbacks.get(Q);if(!J)throw Error(`QuickJSRuntime(rt = ${Q}) not found for C module loader`);let G=J.normalizeModule;if(!G)throw Error(`QuickJSRuntime(rt = ${Q}) does not support module loading`);return G(Q,Y,K,q)}catch(J){return console.error("[C to host module loader error: returning null]",J),0}})}),this.module=W,this.module.callbacks=this.cToHostCallbacks}setRuntimeCallbacks(W,X){this.runtimeCallbacks.set(W,X)}deleteRuntime(W){this.runtimeCallbacks.delete(W)}setContextCallbacks(W,X){this.contextCallbacks.set(W,X)}deleteContext(W){this.contextCallbacks.delete(W)}handleAsyncify(W,X){if(W)return W.handleSleep((Y)=>{try{let K=X();if(!(K instanceof Promise)){H1("asyncify.handleSleep: not suspending:",K),Y(K);return}if(this.suspended)throw new J3(`Already suspended at: ${this.suspended.stack}
|
|
4
|
+
Attempted to suspend at:`);this.suspended=new z3(`(${this.suspendedCount++})`),H1("asyncify.handleSleep: suspending:",this.suspended),K.then((q)=>{this.suspended=void 0,H1("asyncify.handleSleep: resolved:",q),Y(q)},(q)=>{H1("asyncify.handleSleep: rejected:",q),console.error("QuickJS: cannot handle error in suspended function",q),this.suspended=void 0})}catch(K){throw H1("asyncify.handleSleep: error:",K),this.suspended=void 0,K}});let Q=X();if(Q instanceof Promise)throw Error("Promise return value not supported in non-asyncify context.");return Q}},w3=class{constructor(W,X){this.module=W,this.ffi=X,this.callbacks=new J4(W)}newRuntime(W={}){let X=new X0(this.ffi.QTS_NewRuntime(),void 0,(Y)=>{this.ffi.QTS_FreeRuntime(Y),this.callbacks.deleteRuntime(Y)}),Q=new S7({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:X});return z4(Q,W),W.moduleLoader&&Q.setModuleLoader(W.moduleLoader),Q}newContext(W={}){let X=this.newRuntime(),Q=X.newContext({...W,ownedLifetimes:I7(X,W.ownedLifetimes)});return X.context=Q,Q}evalCode(W,X={}){return D0.withScope((Q)=>{let Y=Q.manage(this.newContext());B4(Y.runtime,X);let K=Y.evalCode(W,"eval.js");if(X.memoryLimitBytes!==void 0&&Y.runtime.setMemoryLimit(-1),K.error)throw Y.dump(Q.manage(K.error));return Y.dump(Q.manage(K.value))})}getWasmMemory(){let W=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!W)throw Error("Variant does not support getting WebAssembly.Memory");return W}getFFI(){return this.ffi}};var M3=s1(()=>{u1();u1();H7=Object.defineProperty;L7={};U7(L7,{QuickJSAsyncifyError:()=>J3,QuickJSAsyncifySuspended:()=>z3,QuickJSEmptyGetOwnPropertyNames:()=>H3,QuickJSEmscriptenModuleError:()=>w7,QuickJSHostRefInvalid:()=>C0,QuickJSHostRefRangeExceeded:()=>U3,QuickJSMemoryLeakDetected:()=>D7,QuickJSNotImplemented:()=>q3,QuickJSPromisePending:()=>$3,QuickJSUnknownIntrinsic:()=>B3,QuickJSUnwrapError:()=>W4,QuickJSUseAfterFree:()=>X4,QuickJSWrongOwner:()=>G3});W4=class extends Error{constructor(W,X){let Q=typeof W=="object"&&W&&"message"in W?String(W.message):String(W);super(Q);this.cause=W,this.context=X,this.name="QuickJSUnwrapError"}},G3=class extends Error{constructor(){super(...arguments);this.name="QuickJSWrongOwner"}},X4=class extends Error{constructor(){super(...arguments);this.name="QuickJSUseAfterFree"}},q3=class extends Error{constructor(){super(...arguments);this.name="QuickJSNotImplemented"}},J3=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifyError"}},z3=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifySuspended"}},D7=class extends Error{constructor(){super(...arguments);this.name="QuickJSMemoryLeakDetected"}},w7=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmscriptenModuleError"}},B3=class extends TypeError{constructor(){super(...arguments);this.name="QuickJSUnknownIntrinsic"}},$3=class extends Error{constructor(){super(...arguments);this.name="QuickJSPromisePending"}},H3=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmptyGetOwnPropertyNames"}},U3=class extends Error{constructor(){super(...arguments);this.name="QuickJSHostRefRangeExceeded"}},C0=class extends Error{constructor(){super(...arguments);this.name="QuickJSHostRefInvalid"}};K4=L3;K4.of=M7;V0=class{[Symbol.dispose](){return this.dispose()}},Q4=Symbol.dispose??Symbol.for("Symbol.dispose"),W3=V0.prototype;W3[Q4]||(W3[Q4]=function(){return this.dispose()});X0=class W extends V0{constructor(X,Q,Y,K){super();this._value=X,this.copier=Q,this.disposer=Y,this._owner=K,this._alive=!0,this._constructorStack=Y4?Error("Lifetime constructed").stack:void 0}get alive(){return this._alive}get value(){return this.assertAlive(),this._value}get owner(){return this._owner}get dupable(){return!!this.copier}dup(){if(this.assertAlive(),!this.copier)throw Error("Non-dupable lifetime");return new W(this.copier(this._value),this.copier,this.disposer,this._owner)}consume(X){this.assertAlive();let Q=X(this);return this.dispose(),Q}map(X){return this.assertAlive(),X(this)}tap(X){return X(this),this}dispose(){this.assertAlive(),this.disposer&&this.disposer(this._value),this._alive=!1}assertAlive(){if(!this.alive)throw this._constructorStack?new X4(`Lifetime not alive
|
|
5
5
|
${this._constructorStack}
|
|
6
|
-
Lifetime used`):new X4("Lifetime not alive")}},T0=class extends X0{constructor(W,X){super(W,void 0,void 0,X)}get dupable(){return!0}dup(){return this}dispose(){}},X3=class extends X0{constructor(W,X,Y,Q){super(W,X,Y,Q)}dispose(){this._alive=!1}};D0=class W extends V0{constructor(){super(...arguments);this._disposables=new X0(new Set),this.manage=(X)=>(this._disposables.value.add(X),X)}static withScope(X){let Y=new W,Q;try{return X(Y)}catch(K){throw Q=K,K}finally{s9(Y,Q)}}static withScopeMaybeAsync(X,Y){return F7(void 0,function*(Q){let K=new W,q;try{return yield*Q.of(Y.call(X,Q,K))}catch(J){throw q=J,J}finally{s9(K,q)}})}static async withScopeAsync(X){let Y=new W,Q;try{return await X(Y)}catch(K){throw Q=K,K}finally{s9(Y,Q)}}get alive(){return this._disposables.alive}dispose(){let X=Array.from(this._disposables.value.values()).reverse();for(let Y of X)Y.alive&&Y.dispose();this._disposables.dispose()}};q4=class W extends V0{static success(X){return new V7(X)}static fail(X,Y){return new N7(X,Y)}static is(X){return X instanceof W}},V7=class extends q4{constructor(W){super();this.value=W}get alive(){return l1(this.value)?this.value.alive:!0}dispose(){l1(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr(W){return this.value}},N7=class extends q4{constructor(W,X){super();this.error=W,this.onUnwrap=X}get alive(){return l1(this.error)?this.error.alive:!0}dispose(){l1(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr(W){return W}},m0=q4,P7=class extends V0{constructor(W){super();this.resolve=(X)=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,X||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=(X)=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,X||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=W.context,this.owner=W.context.runtime,this.handle=W.promiseHandle,this.settled=new Promise((X)=>{this.onSettled=X}),this.resolveHandle=W.resolveHandle,this.rejectHandle=W.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},ZG=Symbol("Unstable"),RG=Object.freeze({BaseObjects:!0,Date:!0,Eval:!0,StringNormalize:!0,RegExp:!0,JSON:!0,Proxy:!0,MapSet:!0,TypedArrays:!0,Promise:!0});C7=class extends V0{constructor(W,X){super();this.handle=W,this.context=X,this._isDone=!1,this.owner=X.runtime}[Symbol.iterator](){return this}next(W){if(!this.alive||this._isDone)return{done:!0,value:void 0};let X=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(X,W)}return(W){if(!this.alive)return{done:!0,value:void 0};let X=this.context.getProp(this.handle,"return");if(X===this.context.undefined&&W===void 0)return this.dispose(),{done:!0,value:void 0};let Y=this.callIteratorMethod(X,W);return X.dispose(),this.dispose(),Y}throw(W){if(!this.alive)return{done:!0,value:void 0};let X=W instanceof X0?W:this.context.newError(W),Y=this.context.getProp(this.handle,"throw"),Q=this.callIteratorMethod(Y,W);return X.alive&&X.dispose(),Y.dispose(),this.dispose(),Q}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod(W,X){let Y=X?this.context.callFunction(W,this.handle,X):this.context.callFunction(W,this.handle);if(Y.error)return this.dispose(),{value:Y};let Q=this.context.getProp(Y.value,"done").consume((q)=>this.context.dump(q)),K=this.context.getProp(Y.value,"value");return Y.value.dispose(),Q&&this.dispose(),{value:m0.success(K),done:Q}}};K3=class extends V0{constructor(W,X,Y){if(Y===p1)throw new C0("cannot create HostRef with undefined id");super();this.runtime=W,this.handle=X,this.id=Y}get alive(){return this.handle.alive}dispose(){this.handle.dispose()}get value(){return this.runtime.hostRefs.get(this.id)}},A7=class extends D3{constructor(W){super(W.module);this.scope=new D0,this.copyJSValue=(X)=>this.ffi.QTS_DupValuePointer(this.ctx.value,X),this.freeJSValue=(X)=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,X)},W.ownedLifetimes?.forEach((X)=>this.scope.manage(X)),this.owner=W.owner,this.module=W.module,this.ffi=W.ffi,this.rt=W.rt,this.ctx=this.scope.manage(W.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage(W){return this.scope.manage(W)}consumeJSCharPointer(W){let X=this.module.UTF8ToString(W);return this.ffi.QTS_FreeCString(this.ctx.value,W),X}heapValueHandle(W,X){let Y=X?(Q)=>{X(),this.freeJSValue(Q)}:this.freeJSValue;return new X0(W,this.copyJSValue,Y,this.owner)}staticHeapValueHandle(W){return this.manage(this.heapValueHandle(W)),new T0(W,this.owner)}},j7=class extends V0{constructor(W){super();this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.cToHostCallbacks={callFunction:(X,Y,Q,K,q)=>{if(X!==this.ctx.value)throw Error("QuickJSContext instance received C -> JS call with mismatched ctx");let J=this.getFunction(q);return D0.withScopeMaybeAsync(this,function*(G,H){let D=H.manage(new X3(Y,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),O=Array(Q);for(let V=0;V<Q;V++){let R=this.ffi.QTS_ArgvGetJSValueConstPointer(K,V);O[V]=H.manage(new X3(R,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let V=yield*G(J.apply(D,O));if(V){if("error"in V&&V.error)throw this.runtime.debugLog("throw error",V.error),V.error;let R=H.manage(V instanceof X0?V:V.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,R.value)}return 0}catch(V){return this.errorToHandle(V).consume((R)=>this.ffi.QTS_Throw(this.ctx.value,R.value))}})}},this.runtime=W.runtime,this.module=W.module,this.ffi=W.ffi,this.rt=W.rt,this.ctx=W.ctx,this.memory=new A7({...W,owner:this.runtime}),W.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let W=this.ffi.QTS_GetUndefined();return this._undefined=new T0(W)}get null(){if(this._null)return this._null;let W=this.ffi.QTS_GetNull();return this._null=new T0(W)}get true(){if(this._true)return this._true;let W=this.ffi.QTS_GetTrue();return this._true=new T0(W)}get false(){if(this._false)return this._false;let W=this.ffi.QTS_GetFalse();return this._false=new T0(W)}get global(){if(this._global)return this._global;let W=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle(W),this._global}newNumber(W){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,W))}newString(W){let X=this.memory.newHeapCharPointer(W).consume((Y)=>this.ffi.QTS_NewString(this.ctx.value,Y.value.ptr));return this.memory.heapValueHandle(X)}newUniqueSymbol(W){let X=(typeof W=="symbol"?W.description:W)??"",Y=this.memory.newHeapCharPointer(X).consume((Q)=>this.ffi.QTS_NewSymbol(this.ctx.value,Q.value.ptr,0));return this.memory.heapValueHandle(Y)}newSymbolFor(W){let X=(typeof W=="symbol"?W.description:W)??"",Y=this.memory.newHeapCharPointer(X).consume((Q)=>this.ffi.QTS_NewSymbol(this.ctx.value,Q.value.ptr,1));return this.memory.heapValueHandle(Y)}getWellKnownSymbol(W){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,W)}newBigInt(W){if(!this._BigInt){let Q=this.getProp(this.global,"BigInt");this.memory.manage(Q),this._BigInt=new T0(Q.value,this.runtime)}let X=this._BigInt,Y=String(W);return this.newString(Y).consume((Q)=>this.unwrapResult(this.callFunction(X,this.undefined,Q)))}newObject(W){W&&this.runtime.assertOwned(W);let X=W?this.ffi.QTS_NewObjectProto(this.ctx.value,W.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(X)}newArray(){let W=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle(W)}newArrayBuffer(W){let X=new Uint8Array(W),Y=this.memory.newHeapBufferPointer(X),Q=this.ffi.QTS_NewArrayBuffer(this.ctx.value,Y.value.pointer,X.length);return this.memory.heapValueHandle(Q)}newPromise(W){let X=D0.withScope((Y)=>{let Q=Y.manage(this.memory.newMutablePointerArray(2)),K=this.ffi.QTS_NewPromiseCapability(this.ctx.value,Q.value.ptr),q=this.memory.heapValueHandle(K),[J,G]=Array.from(Q.value.typedArray).map((H)=>this.memory.heapValueHandle(H));return new P7({context:this,promiseHandle:q,resolveHandle:J,rejectHandle:G})});return W&&typeof W=="function"&&(W=new Promise(W)),W&&Promise.resolve(W).then(X.resolve,(Y)=>Y instanceof X0?X.reject(Y):this.newError(Y).consume(X.reject)),X}newFunction(W,X){let Y=typeof W=="function"?W:X;if(!Y)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof W=="string"?W:void 0,length:Y.length,isConstructor:!1,fn:Y})}newConstructorFunction(W,X){let Y=typeof W=="function"?W:X;if(!Y)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof W=="string"?W:void 0,length:Y.length,isConstructor:!0,fn:Y})}newFunctionWithOptions(W){let{name:X,length:Y,isConstructor:Q,fn:K}=W,q=this.runtime.hostRefs.put(K);try{return this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,X??"",Y,Q,q))}catch(J){throw this.runtime.hostRefs.delete(q),J}}newError(W){let X=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return W&&typeof W=="object"?(W.name!==void 0&&this.newString(W.name).consume((Y)=>this.setProp(X,"name",Y)),W.message!==void 0&&this.newString(W.message).consume((Y)=>this.setProp(X,"message",Y))):typeof W=="string"?this.newString(W).consume((Y)=>this.setProp(X,"message",Y)):W!==void 0&&this.newString(String(W)).consume((Y)=>this.setProp(X,"message",Y)),X}newHostRef(W){let X=this.runtime.hostRefs.put(W);try{let Y=this.memory.heapValueHandle(this.ffi.QTS_NewHostRef(this.ctx.value,X));return new K3(this.runtime,Y,X)}catch(Y){throw this.runtime.hostRefs.delete(X),Y}}toHostRef(W){let X=this.ffi.QTS_GetHostRefId(W.value);if(X!==0)return this.runtime.hostRefs.get(X),new K3(this.runtime,W.dup(),X)}unwrapHostRef(W){let X=this.ffi.QTS_GetHostRefId(W.value);if(X===0)throw new C0("handle is not a HostRef");return this.runtime.hostRefs.get(X)}typeof(W){return this.runtime.assertOwned(W),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,W.value))}getNumber(W){return this.runtime.assertOwned(W),this.ffi.QTS_GetFloat64(this.ctx.value,W.value)}getString(W){return this.runtime.assertOwned(W),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,W.value))}getSymbol(W){this.runtime.assertOwned(W);let X=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,W.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,W.value)?Symbol.for(X):Symbol(X)}getBigInt(W){this.runtime.assertOwned(W);let X=this.getString(W);return BigInt(X)}getArrayBuffer(W){this.runtime.assertOwned(W);let X=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,W.value),Y=this.ffi.QTS_GetArrayBuffer(this.ctx.value,W.value);if(!Y)throw Error("Couldn't allocate memory to get ArrayBuffer");return new X0(this.module.HEAPU8.subarray(Y,Y+X),void 0,()=>this.module._free(Y))}getPromiseState(W){this.runtime.assertOwned(W);let X=this.ffi.QTS_PromiseState(this.ctx.value,W.value);if(X<0)return{type:"fulfilled",value:W,notAPromise:!0};if(X===m1.Pending)return{type:"pending",get error(){return new $3("Cannot unwrap a pending promise")}};let Y=this.ffi.QTS_PromiseResult(this.ctx.value,W.value),Q=this.memory.heapValueHandle(Y);if(X===m1.Fulfilled)return{type:"fulfilled",value:Q};if(X===m1.Rejected)return{type:"rejected",error:Q};throw Q.dispose(),Error(`Unknown JSPromiseStateEnum: ${X}`)}resolvePromise(W){this.runtime.assertOwned(W);let X=D0.withScope((Y)=>{let Q=Y.manage(this.getProp(this.global,"Promise")),K=Y.manage(this.getProp(Q,"resolve"));return this.callFunction(K,Q,W)});return X.error?Promise.resolve(X):new Promise((Y)=>{D0.withScope((Q)=>{let K=Q.manage(this.newFunction("resolve",(H)=>{Y(this.success(H&&H.dup()))})),q=Q.manage(this.newFunction("reject",(H)=>{Y(this.fail(H&&H.dup()))})),J=Q.manage(X.value),G=Q.manage(this.getProp(J,"then"));this.callFunction(G,J,K,q).unwrap().dispose()})})}isEqual(W,X,Y=$1.IsStrictlyEqual){if(W===X)return!0;this.runtime.assertOwned(W),this.runtime.assertOwned(X);let Q=this.ffi.QTS_IsEqual(this.ctx.value,W.value,X.value,Y);if(Q===-1)throw new q3("WASM variant does not expose equality");return!!Q}eq(W,X){return this.isEqual(W,X,$1.IsStrictlyEqual)}sameValue(W,X){return this.isEqual(W,X,$1.IsSameValue)}sameValueZero(W,X){return this.isEqual(W,X,$1.IsSameValueZero)}getProp(W,X){this.runtime.assertOwned(W);let Y;return typeof X=="number"&&X>=0?Y=this.ffi.QTS_GetPropNumber(this.ctx.value,W.value,X):Y=this.borrowPropertyKey(X).consume((Q)=>this.ffi.QTS_GetProp(this.ctx.value,W.value,Q.value)),this.memory.heapValueHandle(Y)}getLength(W){if(this.runtime.assertOwned(W),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,W.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames(W,X={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned(W),W.value;let Y=E7(X);if(Y===0)throw new H3("No options set, will return an empty array");return D0.withScope((Q)=>{let K=Q.manage(this.memory.newMutablePointerArray(1)),q=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,K.value.ptr,this.uint32Out.value.ptr,W.value,Y);if(q)return this.fail(this.memory.heapValueHandle(q));let J=this.uint32Out.value.typedArray[0],G=K.value.typedArray[0],H=new Uint32Array(this.module.HEAP8.buffer,G,J),D=Array.from(H).map((O)=>this.memory.heapValueHandle(O));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,G),this.success(O7(D))})}getIterator(W){let X=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return D0.withScope((Y)=>{let Q=Y.manage(this.getProp(W,X)),K=this.callFunction(Q,W);return K.error?K:this.success(new C7(K.value,this))})}setProp(W,X,Y){this.runtime.assertOwned(W),this.borrowPropertyKey(X).consume((Q)=>this.ffi.QTS_SetProp(this.ctx.value,W.value,Q.value,Y.value))}defineProp(W,X,Y){this.runtime.assertOwned(W),D0.withScope((Q)=>{let K=Q.manage(this.borrowPropertyKey(X)),q=Y.value||this.undefined,J=!!Y.configurable,G=!!Y.enumerable,H=!!Y.value,D=Y.get?Q.manage(this.newFunction(Y.get.name,Y.get)):this.undefined,O=Y.set?Q.manage(this.newFunction(Y.set.name,Y.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,W.value,K.value,q.value,D.value,O.value,J,G,H)})}callFunction(W,X,...Y){this.runtime.assertOwned(W);let Q,K=Y[0];K===void 0||Array.isArray(K)?Q=K??[]:Q=Y;let q=this.memory.toPointerArray(Q).consume((G)=>this.ffi.QTS_Call(this.ctx.value,W.value,X.value,Q.length,G.value)),J=this.ffi.QTS_ResolveException(this.ctx.value,q);return J?(this.ffi.QTS_FreeValuePointer(this.ctx.value,q),this.fail(this.memory.heapValueHandle(J))):this.success(this.memory.heapValueHandle(q))}callMethod(W,X,Y=[]){return this.getProp(W,X).consume((Q)=>this.callFunction(Q,W,Y))}evalCode(W,X="eval.js",Y){let Q=Y===void 0?1:0,K=R7(Y),q=this.memory.newHeapCharPointer(W).consume((G)=>this.ffi.QTS_Eval(this.ctx.value,G.value.ptr,G.value.strlen,X,Q,K)),J=this.ffi.QTS_ResolveException(this.ctx.value,q);return J?(this.ffi.QTS_FreeValuePointer(this.ctx.value,q),this.fail(this.memory.heapValueHandle(J))):this.success(this.memory.heapValueHandle(q))}throw(W){return this.errorToHandle(W).consume((X)=>this.ffi.QTS_Throw(this.ctx.value,X.value))}borrowPropertyKey(W){return typeof W=="number"?this.newNumber(W):typeof W=="string"?this.newString(W):new T0(W.value,this.runtime)}getMemory(W){if(W===this.rt.value)return this.memory;throw Error("Private API. Cannot get memory from a different runtime")}dump(W){this.runtime.assertOwned(W);let X=this.typeof(W);if(X==="string")return this.getString(W);if(X==="number")return this.getNumber(W);if(X==="bigint")return this.getBigInt(W);if(X==="undefined")return;if(X==="symbol")return this.getSymbol(W);let Y=this.getPromiseState(W);if(Y.type==="fulfilled"&&!Y.notAPromise)return W.dispose(),{type:Y.type,value:Y.value.consume(this.dump)};if(Y.type==="pending")return W.dispose(),{type:Y.type};if(Y.type==="rejected")return W.dispose(),{type:Y.type,error:Y.error.consume(this.dump)};let Q=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,W.value));try{return JSON.parse(Q)}catch{return Q}}unwrapResult(W){if(W.error){let X="context"in W.error?W.error.context:this,Y=W.error.consume((Q)=>this.dump(Q));if(Y&&typeof Y=="object"&&typeof Y.message=="string"){let{message:Q,name:K,stack:q,...J}=Y,G=new W4(Y,X);typeof K=="string"&&(G.name=Y.name),G.message=Q;let H=G.stack;throw typeof q=="string"&&(G.stack=`${K}: ${Q}
|
|
7
|
-
${Y.stack}Host: ${H}`),Object.assign(G,J),G}throw new W4(Y)}return W.value}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getFunction(W){let X=this.runtime.hostRefs.get(W);if(typeof X!="function")throw Error(`Host reference ${W} is not a function`);return X}errorToHandle(W){return W instanceof X0?W:this.newError(W)}encodeBinaryJSON(W){let X=this.ffi.QTS_bjson_encode(this.ctx.value,W.value);return this.memory.heapValueHandle(X)}decodeBinaryJSON(W){let X=this.ffi.QTS_bjson_decode(this.ctx.value,W.value);return this.memory.heapValueHandle(X)}success(W){return m0.success(W)}fail(W){return m0.fail(W,(X)=>this.unwrapResult(X))}},S7=class extends V0{constructor(W){super();this.scope=new D0,this.contextMap=new Map,this.hostRefs=new _7,this._debugMode=!1,this.cToHostCallbacks={freeHostRef:(X,Y)=>{if(X!==this.rt.value)throw Error("Runtime pointer mismatch");this.hostRefs.delete(Y)},shouldInterrupt:(X)=>{if(X!==this.rt.value)throw Error("QuickJSContext instance received C -> JS interrupt with mismatched rt");let Y=this.interruptHandler;if(!Y)throw Error("QuickJSContext had no interrupt handler");return Y(this)?1:0},loadModuleSource:eW(this,function*(X,Y,Q,K){let q=this.moduleLoader;if(!q)throw Error("Runtime has no module loader");if(Y!==this.rt.value)throw Error("Runtime pointer mismatch");let J=this.contextMap.get(Q)??this.newContext({contextPointer:Q});try{let G=yield*X(q(K,J));if(typeof G=="object"&&"error"in G&&G.error)throw this.debugLog("cToHostLoadModule: loader returned error",G.error),G.error;let H=typeof G=="string"?G:("value"in G)?G.value:G;return this.memory.newHeapCharPointer(H).value.ptr}catch(G){return this.debugLog("cToHostLoadModule: caught error",G),J.throw(G),0}}),normalizeModule:eW(this,function*(X,Y,Q,K,q){let J=this.moduleNormalizer;if(!J)throw Error("Runtime has no module normalizer");if(Y!==this.rt.value)throw Error("Runtime pointer mismatch");let G=this.contextMap.get(Q)??this.newContext({contextPointer:Q});try{let H=yield*X(J(K,q,G));if(typeof H=="object"&&"error"in H&&H.error)throw this.debugLog("cToHostNormalizeModule: normalizer returned error",H.error),H.error;let D=typeof H=="string"?H:H.value;return G.getMemory(this.rt.value).newHeapCharPointer(D).value.ptr}catch(H){return this.debugLog("normalizeModule: caught error",H),G.throw(H),0}})},W.ownedLifetimes?.forEach((X)=>this.scope.manage(X)),this.module=W.module,this.memory=new D3(this.module),this.ffi=W.ffi,this.rt=W.rt,this.callbacks=W.callbacks,this.scope.manage(this.rt),this.callbacks.setRuntimeCallbacks(this.rt.value,this.cToHostCallbacks),this.executePendingJobs=this.executePendingJobs.bind(this),Q4&&this.setDebugMode(!0)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}newContext(W={}){let X=Z7(W.intrinsics),Y=new X0(W.contextPointer||this.ffi.QTS_NewContext(this.rt.value,X),void 0,(K)=>{this.contextMap.delete(K),this.callbacks.deleteContext(K),this.ffi.QTS_FreeContext(K)}),Q=new j7({module:this.module,ctx:Y,ffi:this.ffi,rt:this.rt,ownedLifetimes:W.ownedLifetimes,runtime:this,callbacks:this.callbacks});return this.contextMap.set(Y.value,Q),Q}setModuleLoader(W,X){this.moduleLoader=W,this.moduleNormalizer=X,this.ffi.QTS_RuntimeEnableModuleLoader(this.rt.value,this.moduleNormalizer?1:0)}removeModuleLoader(){this.moduleLoader=void 0,this.ffi.QTS_RuntimeDisableModuleLoader(this.rt.value)}hasPendingJob(){return!!this.ffi.QTS_IsJobPending(this.rt.value)}setInterruptHandler(W){let X=this.interruptHandler;this.interruptHandler=W,X||this.ffi.QTS_RuntimeEnableInterruptHandler(this.rt.value)}removeInterruptHandler(){this.interruptHandler&&(this.ffi.QTS_RuntimeDisableInterruptHandler(this.rt.value),this.interruptHandler=void 0)}executePendingJobs(W=-1){let X=this.memory.newMutablePointerArray(1),Y=this.ffi.QTS_ExecutePendingJob(this.rt.value,W??-1,X.value.ptr),Q=X.value.typedArray[0];if(X.dispose(),Q===0)return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value,Y),m0.success(0);let K=this.contextMap.get(Q)??this.newContext({contextPointer:Q}),q=K.getMemory(this.rt.value).heapValueHandle(Y);if(K.typeof(q)==="number"){let J=K.getNumber(q);return q.dispose(),m0.success(J)}else{let J=Object.assign(q,{context:K});return m0.fail(J,(G)=>K.unwrapResult(G))}}setMemoryLimit(W){if(W<0&&W!==-1)throw Error("Cannot set memory limit to negative number. To unset, pass -1");this.ffi.QTS_RuntimeSetMemoryLimit(this.rt.value,W)}computeMemoryUsage(){let W=this.getSystemContext().getMemory(this.rt.value);return W.heapValueHandle(this.ffi.QTS_RuntimeComputeMemoryUsage(this.rt.value,W.ctx.value))}dumpMemoryUsage(){return this.memory.consumeHeapCharPointer(this.ffi.QTS_RuntimeDumpMemoryUsage(this.rt.value))}setMaxStackSize(W){if(W<0)throw Error("Cannot set memory limit to negative number. To unset, pass 0.");this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value,W)}assertOwned(W){if(W.owner&&W.owner.rt!==this.rt)throw new G3(`Handle is not owned by this runtime: ${W.owner.rt.value} != ${this.rt.value}`)}setDebugMode(W){this._debugMode=W,this.ffi.DEBUG&&this.rt.alive&&this.ffi.QTS_SetDebugLogEnabled(this.rt.value,W?1:0)}isDebugMode(){return this._debugMode}debugLog(...W){this._debugMode&&console.log("quickjs-emscripten:",...W)}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getSystemContext(){return this.context||(this.context=this.scope.manage(this.newContext())),this.context}}});var F3={};a1(F3,{applyModuleEvalRuntimeOptions:()=>B4,applyBaseRuntimeOptions:()=>z4,QuickJSWASMModule:()=>w3,QuickJSModuleCallbacks:()=>J4});var O3=s1(()=>{M3()});var E3=g3((d1,R3)=>{(function(W,X){typeof d1==="object"&&typeof R3<"u"?X(d1):typeof define==="function"&&define.amd?define(["exports"],X):(W=typeof globalThis<"u"?globalThis:W||self,X(W.jmespath={}))})(d1,function(W){let X=(z)=>{return z!==null&&Object.prototype.toString.call(z)==="[object Object]"},Y=(z,B)=>{if(z===B)return!0;if(typeof z!==typeof B)return!1;if(Array.isArray(z)&&Array.isArray(B)){if(z.length!==B.length)return!1;for(let $=0;$<z.length;$+=1)if(!Y(z[$],B[$]))return!1;return!0}if(X(z)&&X(B)){let $=Object.entries(z),L=new Set(Object.keys(B));if($.length!==L.size)return!1;for(let[F,N]of $){if(!Y(N,B[F]))return!1;L.delete(F)}return L.size===0}return!1},Q=(z)=>{if(z===""||z===!1||z===null||z===void 0)return!0;if(Array.isArray(z)&&z.length===0)return!0;if(X(z)){for(let B in z)if(z.hasOwnProperty(B))return!1;return!0}return!1},K=(z)=>{return z>="a"&&z<="z"||z>="A"&&z<="Z"||z==="_"},q=(z)=>{return z>="0"&&z<="9"||z==="-"},J=(z)=>{return z>="a"&&z<="z"||z>="A"&&z<="Z"||z>="0"&&z<="9"||z==="_"};var G;(function(z){z.TOK_EOF="EOF",z.TOK_UNQUOTEDIDENTIFIER="UnquotedIdentifier",z.TOK_QUOTEDIDENTIFIER="QuotedIdentifier",z.TOK_RBRACKET="Rbracket",z.TOK_RPAREN="Rparen",z.TOK_COMMA="Comma",z.TOK_COLON="Colon",z.TOK_RBRACE="Rbrace",z.TOK_NUMBER="Number",z.TOK_CURRENT="Current",z.TOK_ROOT="Root",z.TOK_EXPREF="Expref",z.TOK_PIPE="Pipe",z.TOK_OR="Or",z.TOK_AND="And",z.TOK_EQ="EQ",z.TOK_GT="GT",z.TOK_LT="LT",z.TOK_GTE="GTE",z.TOK_LTE="LTE",z.TOK_NE="NE",z.TOK_FLATTEN="Flatten",z.TOK_STAR="Star",z.TOK_FILTER="Filter",z.TOK_DOT="Dot",z.TOK_NOT="Not",z.TOK_LBRACE="Lbrace",z.TOK_LBRACKET="Lbracket",z.TOK_LPAREN="Lparen",z.TOK_LITERAL="Literal"})(G||(G={}));let H={"(":G.TOK_LPAREN,")":G.TOK_RPAREN,"*":G.TOK_STAR,",":G.TOK_COMMA,".":G.TOK_DOT,":":G.TOK_COLON,"@":G.TOK_CURRENT,["$"]:G.TOK_ROOT,"]":G.TOK_RBRACKET,"{":G.TOK_LBRACE,"}":G.TOK_RBRACE},D={"!":!0,"<":!0,"=":!0,">":!0},O={"\t":!0,"\n":!0,"\r":!0," ":!0};class V{constructor(){this._current=0}tokenize(z){let B=[];this._current=0;let $,L,F;while(this._current<z.length)if(K(z[this._current]))$=this._current,L=this.consumeUnquotedIdentifier(z),B.push({start:$,type:G.TOK_UNQUOTEDIDENTIFIER,value:L});else if(H[z[this._current]]!==void 0)B.push({start:this._current,type:H[z[this._current]],value:z[this._current]}),this._current+=1;else if(q(z[this._current]))F=this.consumeNumber(z),B.push(F);else if(z[this._current]==="[")F=this.consumeLBracket(z),B.push(F);else if(z[this._current]==='"')$=this._current,L=this.consumeQuotedIdentifier(z),B.push({start:$,type:G.TOK_QUOTEDIDENTIFIER,value:L});else if(z[this._current]==="'")$=this._current,L=this.consumeRawStringLiteral(z),B.push({start:$,type:G.TOK_LITERAL,value:L});else if(z[this._current]==="`"){$=this._current;let N=this.consumeLiteral(z);B.push({start:$,type:G.TOK_LITERAL,value:N})}else if(D[z[this._current]]!==void 0)F=this.consumeOperator(z),F&&B.push(F);else if(O[z[this._current]]!==void 0)this._current+=1;else if(z[this._current]==="&")if($=this._current,this._current+=1,z[this._current]==="&")this._current+=1,B.push({start:$,type:G.TOK_AND,value:"&&"});else B.push({start:$,type:G.TOK_EXPREF,value:"&"});else if(z[this._current]==="|")if($=this._current,this._current+=1,z[this._current]==="|")this._current+=1,B.push({start:$,type:G.TOK_OR,value:"||"});else B.push({start:$,type:G.TOK_PIPE,value:"|"});else{let N=Error(`Unknown character: ${z[this._current]}`);throw N.name="LexerError",N}return B}consumeUnquotedIdentifier(z){let B=this._current;this._current+=1;while(this._current<z.length&&J(z[this._current]))this._current+=1;return z.slice(B,this._current)}consumeQuotedIdentifier(z){let B=this._current;this._current+=1;let $=z.length;while(z[this._current]!=='"'&&this._current<$){let L=this._current;if(z[L]==="\\"&&(z[L+1]==="\\"||z[L+1]==='"'))L+=2;else L+=1;this._current=L}return this._current+=1,JSON.parse(z.slice(B,this._current))}consumeRawStringLiteral(z){let B=this._current;this._current+=1;let $=z.length;while(z[this._current]!=="'"&&this._current<$){let F=this._current;if(z[F]==="\\"&&(z[F+1]==="\\"||z[F+1]==="'"))F+=2;else F+=1;this._current=F}return this._current+=1,z.slice(B+1,this._current-1).replace("\\'","'")}consumeNumber(z){let B=this._current;this._current+=1;let $=z.length;while(q(z[this._current])&&this._current<$)this._current+=1;let L=parseInt(z.slice(B,this._current),10);return{start:B,value:L,type:G.TOK_NUMBER}}consumeLBracket(z){let B=this._current;if(this._current+=1,z[this._current]==="?")return this._current+=1,{start:B,type:G.TOK_FILTER,value:"[?"};if(z[this._current]==="]")return this._current+=1,{start:B,type:G.TOK_FLATTEN,value:"[]"};return{start:B,type:G.TOK_LBRACKET,value:"["}}consumeOperator(z){let B=this._current,$=z[B];if(this._current+=1,$==="!"){if(z[this._current]==="=")return this._current+=1,{start:B,type:G.TOK_NE,value:"!="};return{start:B,type:G.TOK_NOT,value:"!"}}if($==="<"){if(z[this._current]==="=")return this._current+=1,{start:B,type:G.TOK_LTE,value:"<="};return{start:B,type:G.TOK_LT,value:"<"}}if($===">"){if(z[this._current]==="=")return this._current+=1,{start:B,type:G.TOK_GTE,value:">="};return{start:B,type:G.TOK_GT,value:">"}}if($==="="&&z[this._current]==="=")return this._current+=1,{start:B,type:G.TOK_EQ,value:"=="}}consumeLiteral(z){this._current+=1;let B=this._current,$=z.length;while(z[this._current]!=="`"&&this._current<$){let N=this._current;if(z[N]==="\\"&&(z[N+1]==="\\"||z[N+1]==="`"))N+=2;else N+=1;this._current=N}let L=z.slice(B,this._current).trimLeft();L=L.replace("\\`","`");let F=this.looksLikeJSON(L)?JSON.parse(L):JSON.parse(`"${L}"`);return this._current+=1,F}looksLikeJSON(z){let $=["true","false","null"],L="-0123456789";if(z==="")return!1;if('[{"'.includes(z[0]))return!0;if($.includes(z))return!0;if("-0123456789".includes(z[0]))try{return JSON.parse(z),!0}catch(F){return!1}return!1}}let R=new V,P={[G.TOK_EOF]:0,[G.TOK_UNQUOTEDIDENTIFIER]:0,[G.TOK_QUOTEDIDENTIFIER]:0,[G.TOK_RBRACKET]:0,[G.TOK_RPAREN]:0,[G.TOK_COMMA]:0,[G.TOK_RBRACE]:0,[G.TOK_NUMBER]:0,[G.TOK_CURRENT]:0,[G.TOK_EXPREF]:0,[G.TOK_ROOT]:0,[G.TOK_PIPE]:1,[G.TOK_OR]:2,[G.TOK_AND]:3,[G.TOK_EQ]:5,[G.TOK_GT]:5,[G.TOK_LT]:5,[G.TOK_GTE]:5,[G.TOK_LTE]:5,[G.TOK_NE]:5,[G.TOK_FLATTEN]:9,[G.TOK_STAR]:20,[G.TOK_FILTER]:21,[G.TOK_DOT]:40,[G.TOK_NOT]:45,[G.TOK_LBRACE]:50,[G.TOK_LBRACKET]:55,[G.TOK_LPAREN]:60};class b{constructor(){this.index=0,this.tokens=[]}parse(z){this.loadTokens(z),this.index=0;let B=this.expression(0);if(this.lookahead(0)!==G.TOK_EOF){let $=this.lookaheadToken(0);this.errorToken($,`Unexpected token type: ${$.type}, value: ${$.value}`)}return B}loadTokens(z){this.tokens=[...R.tokenize(z),{type:G.TOK_EOF,value:"",start:z.length}]}expression(z){let B=this.lookaheadToken(0);this.advance();let $=this.nud(B),L=this.lookahead(0);while(z<P[L])this.advance(),$=this.led(L,$),L=this.lookahead(0);return $}lookahead(z){return this.tokens[this.index+z].type}lookaheadToken(z){return this.tokens[this.index+z]}advance(){this.index+=1}nud(z){let B,$,L;switch(z.type){case G.TOK_LITERAL:return{type:"Literal",value:z.value};case G.TOK_UNQUOTEDIDENTIFIER:return{type:"Field",name:z.value};case G.TOK_QUOTEDIDENTIFIER:let F={type:"Field",name:z.value};if(this.lookahead(0)===G.TOK_LPAREN)throw Error("Quoted identifier not allowed for function names.");else return F;case G.TOK_NOT:return $=this.expression(P.Not),{type:"NotExpression",children:[$]};case G.TOK_STAR:return B={type:"Identity"},$=this.lookahead(0)===G.TOK_RBRACKET&&{type:"Identity"}||this.parseProjectionRHS(P.Star),{type:"ValueProjection",children:[B,$]};case G.TOK_FILTER:return this.led(z.type,{type:"Identity"});case G.TOK_LBRACE:return this.parseMultiselectHash();case G.TOK_FLATTEN:return B={type:G.TOK_FLATTEN,children:[{type:"Identity"}]},$=this.parseProjectionRHS(P.Flatten),{type:"Projection",children:[B,$]};case G.TOK_LBRACKET:if(this.lookahead(0)===G.TOK_NUMBER||this.lookahead(0)===G.TOK_COLON)return $=this.parseIndexExpression(),this.projectIfSlice({type:"Identity"},$);if(this.lookahead(0)===G.TOK_STAR&&this.lookahead(1)===G.TOK_RBRACKET)return this.advance(),this.advance(),$=this.parseProjectionRHS(P.Star),{children:[{type:"Identity"},$],type:"Projection"};return this.parseMultiselectList();case G.TOK_CURRENT:return{type:G.TOK_CURRENT};case G.TOK_ROOT:return{type:G.TOK_ROOT};case G.TOK_EXPREF:return L=this.expression(P.Expref),{type:"ExpressionReference",children:[L]};case G.TOK_LPAREN:let N=[];while(this.lookahead(0)!==G.TOK_RPAREN){if(this.lookahead(0)===G.TOK_CURRENT)L={type:G.TOK_CURRENT},this.advance();else L=this.expression(0);N.push(L)}return this.match(G.TOK_RPAREN),N[0];default:this.errorToken(z)}}led(z,B){let $;switch(z){case G.TOK_DOT:let L=P.Dot;if(this.lookahead(0)!==G.TOK_STAR)return $=this.parseDotRHS(L),{type:"Subexpression",children:[B,$]};return this.advance(),$=this.parseProjectionRHS(L),{type:"ValueProjection",children:[B,$]};case G.TOK_PIPE:return $=this.expression(P.Pipe),{type:G.TOK_PIPE,children:[B,$]};case G.TOK_OR:return $=this.expression(P.Or),{type:"OrExpression",children:[B,$]};case G.TOK_AND:return $=this.expression(P.And),{type:"AndExpression",children:[B,$]};case G.TOK_LPAREN:let F=B.name,N=[],_;while(this.lookahead(0)!==G.TOK_RPAREN){if(this.lookahead(0)===G.TOK_CURRENT)_={type:G.TOK_CURRENT},this.advance();else _=this.expression(0);if(this.lookahead(0)===G.TOK_COMMA)this.match(G.TOK_COMMA);N.push(_)}return this.match(G.TOK_RPAREN),{name:F,type:"Function",children:N};case G.TOK_FILTER:let p=this.expression(0);return this.match(G.TOK_RBRACKET),$=this.lookahead(0)===G.TOK_FLATTEN&&{type:"Identity"}||this.parseProjectionRHS(P.Filter),{type:"FilterProjection",children:[B,$,p]};case G.TOK_FLATTEN:let $0={type:G.TOK_FLATTEN,children:[B]},l=this.parseProjectionRHS(P.Flatten);return{type:"Projection",children:[$0,l]};case G.TOK_EQ:case G.TOK_NE:case G.TOK_GT:case G.TOK_GTE:case G.TOK_LT:case G.TOK_LTE:return this.parseComparator(B,z);case G.TOK_LBRACKET:let C=this.lookaheadToken(0);if(C.type===G.TOK_NUMBER||C.type===G.TOK_COLON)return $=this.parseIndexExpression(),this.projectIfSlice(B,$);return this.match(G.TOK_STAR),this.match(G.TOK_RBRACKET),$=this.parseProjectionRHS(P.Star),{type:"Projection",children:[B,$]};default:return this.errorToken(this.lookaheadToken(0))}}match(z){if(this.lookahead(0)===z){this.advance();return}else{let B=this.lookaheadToken(0);this.errorToken(B,`Expected ${z}, got: ${B.type}`)}}errorToken(z,B=""){let $=Error(B||`Invalid token (${z.type}): "${z.value}"`);throw $.name="ParserError",$}parseIndexExpression(){if(this.lookahead(0)===G.TOK_COLON||this.lookahead(1)===G.TOK_COLON)return this.parseSliceExpression();let z={type:"Index",value:this.lookaheadToken(0).value};return this.advance(),this.match(G.TOK_RBRACKET),z}projectIfSlice(z,B){let $={type:"IndexExpression",children:[z,B]};if(B.type==="Slice")return{children:[$,this.parseProjectionRHS(P.Star)],type:"Projection"};return $}parseSliceExpression(){let z=[null,null,null],B=0,$=this.lookahead(0);while($!==G.TOK_RBRACKET&&B<3){if($===G.TOK_COLON)B+=1,this.advance();else if($===G.TOK_NUMBER)z[B]=this.lookaheadToken(0).value,this.advance();else{let L=this.lookaheadToken(0);this.errorToken(L,`Syntax error, unexpected token: ${L.value}(${L.type})`)}$=this.lookahead(0)}return this.match(G.TOK_RBRACKET),{children:z,type:"Slice"}}parseComparator(z,B){let $=this.expression(P[B]);return{type:"Comparator",name:B,children:[z,$]}}parseDotRHS(z){let B=this.lookahead(0);if([G.TOK_UNQUOTEDIDENTIFIER,G.TOK_QUOTEDIDENTIFIER,G.TOK_STAR].includes(B))return this.expression(z);if(B===G.TOK_LBRACKET)return this.match(G.TOK_LBRACKET),this.parseMultiselectList();if(B===G.TOK_LBRACE)return this.match(G.TOK_LBRACE),this.parseMultiselectHash();let L=this.lookaheadToken(0);this.errorToken(L,`Syntax error, unexpected token: ${L.value}(${L.type})`)}parseProjectionRHS(z){if(P[this.lookahead(0)]<10)return{type:"Identity"};if(this.lookahead(0)===G.TOK_LBRACKET)return this.expression(z);if(this.lookahead(0)===G.TOK_FILTER)return this.expression(z);if(this.lookahead(0)===G.TOK_DOT)return this.match(G.TOK_DOT),this.parseDotRHS(z);let B=this.lookaheadToken(0);this.errorToken(B,`Syntax error, unexpected token: ${B.value}(${B.type})`)}parseMultiselectList(){let z=[];while(this.lookahead(0)!==G.TOK_RBRACKET){let B=this.expression(0);if(z.push(B),this.lookahead(0)===G.TOK_COMMA){if(this.match(G.TOK_COMMA),this.lookahead(0)===G.TOK_RBRACKET)throw Error("Unexpected token Rbracket")}}return this.match(G.TOK_RBRACKET),{type:"MultiSelectList",children:z}}parseMultiselectHash(){let z=[],B=[G.TOK_UNQUOTEDIDENTIFIER,G.TOK_QUOTEDIDENTIFIER],$,L,F;for(;;){if($=this.lookaheadToken(0),!B.includes($.type))throw Error(`Expecting an identifier token, got: ${$.type}`);if(L=$.value,this.advance(),this.match(G.TOK_COLON),F=this.expression(0),z.push({value:F,type:"KeyValuePair",name:L}),this.lookahead(0)===G.TOK_COMMA)this.match(G.TOK_COMMA);else if(this.lookahead(0)===G.TOK_RBRACE){this.match(G.TOK_RBRACE);break}}return{type:"MultiSelectHash",children:z}}}let N0=new b;var M;(function(z){z[z.TYPE_NUMBER=0]="TYPE_NUMBER",z[z.TYPE_ANY=1]="TYPE_ANY",z[z.TYPE_STRING=2]="TYPE_STRING",z[z.TYPE_ARRAY=3]="TYPE_ARRAY",z[z.TYPE_OBJECT=4]="TYPE_OBJECT",z[z.TYPE_BOOLEAN=5]="TYPE_BOOLEAN",z[z.TYPE_EXPREF=6]="TYPE_EXPREF",z[z.TYPE_NULL=7]="TYPE_NULL",z[z.TYPE_ARRAY_NUMBER=8]="TYPE_ARRAY_NUMBER",z[z.TYPE_ARRAY_STRING=9]="TYPE_ARRAY_STRING"})(M||(M={}));class k0{constructor(z){this.TYPE_NAME_TABLE={[M.TYPE_NUMBER]:"number",[M.TYPE_ANY]:"any",[M.TYPE_STRING]:"string",[M.TYPE_ARRAY]:"array",[M.TYPE_OBJECT]:"object",[M.TYPE_BOOLEAN]:"boolean",[M.TYPE_EXPREF]:"expression",[M.TYPE_NULL]:"null",[M.TYPE_ARRAY_NUMBER]:"Array<number>",[M.TYPE_ARRAY_STRING]:"Array<string>"},this.functionAbs=([B])=>{return Math.abs(B)},this.functionAvg=([B])=>{let $=0;for(let L=0;L<B.length;L+=1)$+=B[L];return $/B.length},this.functionCeil=([B])=>{return Math.ceil(B)},this.functionContains=(B)=>{let[$,L]=B;return $.includes(L)},this.functionEndsWith=(B)=>{let[$,L]=B;return $.includes(L,$.length-L.length)},this.functionFloor=([B])=>{return Math.floor(B)},this.functionJoin=(B)=>{let[$,L]=B;return L.join($)},this.functionKeys=([B])=>{return Object.keys(B)},this.functionLength=([B])=>{if(!X(B))return B.length;return Object.keys(B).length},this.functionMap=(B)=>{if(!this._interpreter)return[];let $=[],L=this._interpreter,F=B[0],N=B[1];for(let _=0;_<N.length;_+=1)$.push(L.visit(F,N[_]));return $},this.functionMax=([B])=>{if(!B.length)return null;if(this.getTypeName(B[0])===M.TYPE_NUMBER)return Math.max(...B);let L=B,F=L[0];for(let N=1;N<L.length;N+=1)if(F.localeCompare(L[N])<0)F=L[N];return F},this.functionMaxBy=(B)=>{let $=B[1],L=B[0],F=this.createKeyFunction($,[M.TYPE_NUMBER,M.TYPE_STRING]),N=-1/0,_,j;for(let p=0;p<L.length;p+=1)if(j=F&&F(L[p]),j!==void 0&&j>N)N=j,_=L[p];return _},this.functionMerge=(B)=>{let $={};for(let L=0;L<B.length;L+=1){let F=B[L];$=Object.assign($,F)}return $},this.functionMin=([B])=>{if(!B.length)return null;if(this.getTypeName(B[0])===M.TYPE_NUMBER)return Math.min(...B);let L=B,F=L[0];for(let N=1;N<L.length;N+=1)if(L[N].localeCompare(F)<0)F=L[N];return F},this.functionMinBy=(B)=>{let $=B[1],L=B[0],F=this.createKeyFunction($,[M.TYPE_NUMBER,M.TYPE_STRING]),N=1/0,_,j;for(let p=0;p<L.length;p+=1)if(j=F&&F(L[p]),j!==void 0&&j<N)N=j,_=L[p];return _},this.functionNotNull=(B)=>{for(let $=0;$<B.length;$+=1)if(this.getTypeName(B[$])!==M.TYPE_NULL)return B[$];return null},this.functionReverse=([B])=>{if(this.getTypeName(B)===M.TYPE_STRING){let F=B,N="";for(let _=F.length-1;_>=0;_-=1)N+=F[_];return N}let L=B.slice(0);return L.reverse(),L},this.functionSort=([B])=>{return[...B].sort()},this.functionSortBy=(B)=>{if(!this._interpreter)return[];let $=B[0].slice(0);if($.length===0)return $;let L=this._interpreter,F=B[1],N=this.getTypeName(L.visit(F,$[0]));if(N!==void 0&&![M.TYPE_NUMBER,M.TYPE_STRING].includes(N))throw Error(`TypeError: unexpected type (${this.TYPE_NAME_TABLE[N]})`);let _=[];for(let j=0;j<$.length;j+=1)_.push([j,$[j]]);_.sort((j,p)=>{let $0=L.visit(F,j[1]),l=L.visit(F,p[1]);if(this.getTypeName($0)!==N)throw Error(`TypeError: expected (${this.TYPE_NAME_TABLE[N]}), received ${this.TYPE_NAME_TABLE[this.getTypeName($0)]}`);else if(this.getTypeName(l)!==N)throw Error(`TypeError: expected (${this.TYPE_NAME_TABLE[N]}), received ${this.TYPE_NAME_TABLE[this.getTypeName(l)]}`);if($0>l)return 1;return $0<l?-1:j[0]-p[0]});for(let j=0;j<_.length;j+=1)$[j]=_[j][1];return $},this.functionStartsWith=([B,$])=>{return B.startsWith($)},this.functionSum=([B])=>{return B.reduce(($,L)=>$+L,0)},this.functionToArray=([B])=>{if(this.getTypeName(B)===M.TYPE_ARRAY)return B;return[B]},this.functionToNumber=([B])=>{let $=this.getTypeName(B),L;if($===M.TYPE_NUMBER)return B;if($===M.TYPE_STRING){if(L=+B,!isNaN(L))return L}return null},this.functionToString=([B])=>{if(this.getTypeName(B)===M.TYPE_STRING)return B;return JSON.stringify(B)},this.functionType=([B])=>{switch(this.getTypeName(B)){case M.TYPE_NUMBER:return"number";case M.TYPE_STRING:return"string";case M.TYPE_ARRAY:return"array";case M.TYPE_OBJECT:return"object";case M.TYPE_BOOLEAN:return"boolean";case M.TYPE_EXPREF:return"expref";case M.TYPE_NULL:return"null";default:return}},this.functionValues=([B])=>{return Object.values(B)},this.functionTable={abs:{_func:this.functionAbs,_signature:[{types:[M.TYPE_NUMBER]}]},avg:{_func:this.functionAvg,_signature:[{types:[M.TYPE_ARRAY_NUMBER]}]},ceil:{_func:this.functionCeil,_signature:[{types:[M.TYPE_NUMBER]}]},contains:{_func:this.functionContains,_signature:[{types:[M.TYPE_STRING,M.TYPE_ARRAY]},{types:[M.TYPE_ANY]}]},ends_with:{_func:this.functionEndsWith,_signature:[{types:[M.TYPE_STRING]},{types:[M.TYPE_STRING]}]},floor:{_func:this.functionFloor,_signature:[{types:[M.TYPE_NUMBER]}]},join:{_func:this.functionJoin,_signature:[{types:[M.TYPE_STRING]},{types:[M.TYPE_ARRAY_STRING]}]},keys:{_func:this.functionKeys,_signature:[{types:[M.TYPE_OBJECT]}]},length:{_func:this.functionLength,_signature:[{types:[M.TYPE_STRING,M.TYPE_ARRAY,M.TYPE_OBJECT]}]},map:{_func:this.functionMap,_signature:[{types:[M.TYPE_EXPREF]},{types:[M.TYPE_ARRAY]}]},max:{_func:this.functionMax,_signature:[{types:[M.TYPE_ARRAY_NUMBER,M.TYPE_ARRAY_STRING]}]},max_by:{_func:this.functionMaxBy,_signature:[{types:[M.TYPE_ARRAY]},{types:[M.TYPE_EXPREF]}]},merge:{_func:this.functionMerge,_signature:[{types:[M.TYPE_OBJECT],variadic:!0}]},min:{_func:this.functionMin,_signature:[{types:[M.TYPE_ARRAY_NUMBER,M.TYPE_ARRAY_STRING]}]},min_by:{_func:this.functionMinBy,_signature:[{types:[M.TYPE_ARRAY]},{types:[M.TYPE_EXPREF]}]},not_null:{_func:this.functionNotNull,_signature:[{types:[M.TYPE_ANY],variadic:!0}]},reverse:{_func:this.functionReverse,_signature:[{types:[M.TYPE_STRING,M.TYPE_ARRAY]}]},sort:{_func:this.functionSort,_signature:[{types:[M.TYPE_ARRAY_STRING,M.TYPE_ARRAY_NUMBER]}]},sort_by:{_func:this.functionSortBy,_signature:[{types:[M.TYPE_ARRAY]},{types:[M.TYPE_EXPREF]}]},starts_with:{_func:this.functionStartsWith,_signature:[{types:[M.TYPE_STRING]},{types:[M.TYPE_STRING]}]},sum:{_func:this.functionSum,_signature:[{types:[M.TYPE_ARRAY_NUMBER]}]},to_array:{_func:this.functionToArray,_signature:[{types:[M.TYPE_ANY]}]},to_number:{_func:this.functionToNumber,_signature:[{types:[M.TYPE_ANY]}]},to_string:{_func:this.functionToString,_signature:[{types:[M.TYPE_ANY]}]},type:{_func:this.functionType,_signature:[{types:[M.TYPE_ANY]}]},values:{_func:this.functionValues,_signature:[{types:[M.TYPE_OBJECT]}]}},this._interpreter=z}registerFunction(z,B,$){if(z in this.functionTable)throw Error(`Function already defined: ${z}()`);this.functionTable[z]={_func:B.bind(this),_signature:$}}callFunction(z,B){let $=this.functionTable[z];if($===void 0)throw Error(`Unknown function: ${z}()`);return this.validateArgs(z,B,$._signature),$._func.call(this,B)}validateInputSignatures(z,B){for(let $=0;$<B.length;$+=1)if("variadic"in B[$]&&$!==B.length-1)throw Error(`ArgumentError: ${z}() 'variadic' argument ${$+1} must occur last`)}validateArgs(z,B,$){var L,F;let N;this.validateInputSignatures(z,$);let _=$.filter((U0)=>{var L0;return(L0=!U0.optional)!==null&&L0!==void 0?L0:!1}).length,j=(F=(L=$[$.length-1])===null||L===void 0?void 0:L.variadic)!==null&&F!==void 0?F:!1,p=B.length<_,$0=B.length>$.length,l=p&&(!j&&_>1||j)?"at least ":"";if(j&&p||!j&&(p||$0))throw N=$.length>1,Error(`ArgumentError: ${z}() takes ${l}${_} argument${N&&"s"||""} but received ${B.length}`);let C,r,P0;for(let U0=0;U0<$.length;U0+=1){P0=!1,C=$[U0].types,r=this.getTypeName(B[U0]);let L0;for(L0=0;L0<C.length;L0+=1)if(r!==void 0&&this.typeMatches(r,C[L0],B[U0])){P0=!0;break}if(!P0&&r!==void 0){let D1=C.map((w1)=>{return this.TYPE_NAME_TABLE[w1]}).join(" | ");throw Error(`TypeError: ${z}() expected argument ${U0+1} to be type (${D1}) but received type ${this.TYPE_NAME_TABLE[r]} instead.`)}}}typeMatches(z,B,$){if(B===M.TYPE_ANY)return!0;if(B===M.TYPE_ARRAY_STRING||B===M.TYPE_ARRAY_NUMBER||B===M.TYPE_ARRAY){if(B===M.TYPE_ARRAY)return z===M.TYPE_ARRAY;if(z===M.TYPE_ARRAY){let L;if(B===M.TYPE_ARRAY_NUMBER)L=M.TYPE_NUMBER;else if(B===M.TYPE_ARRAY_STRING)L=M.TYPE_STRING;for(let F=0;F<$.length;F+=1){let N=this.getTypeName($[F]);if(N!==void 0&&L!==void 0&&!this.typeMatches(N,L,$[F]))return!1}return!0}}else return z===B;return!1}getTypeName(z){switch(Object.prototype.toString.call(z)){case"[object String]":return M.TYPE_STRING;case"[object Number]":return M.TYPE_NUMBER;case"[object Array]":return M.TYPE_ARRAY;case"[object Boolean]":return M.TYPE_BOOLEAN;case"[object Null]":return M.TYPE_NULL;case"[object Object]":if(z.jmespathType===G.TOK_EXPREF)return M.TYPE_EXPREF;return M.TYPE_OBJECT;default:return}}createKeyFunction(z,B){if(!this._interpreter)return;let $=this._interpreter;return(F)=>{let N=$.visit(z,F);if(!B.includes(this.getTypeName(N))){let _=`TypeError: expected one of (${B.map((j)=>this.TYPE_NAME_TABLE[j]).join(" | ")}), received ${this.TYPE_NAME_TABLE[this.getTypeName(N)]}`;throw Error(_)}return N}}}class U1{constructor(){this._rootValue=null,this.runtime=new k0(this)}search(z,B){return this._rootValue=B,this.visit(z,B)}visit(z,B){let $,L,F,N,_,j,p,$0,l,C,r;switch(z.type){case"Field":if(B===null)return null;if(X(B)){if(j=B[z.name],j===void 0)return null;return j}return null;case"Subexpression":F=this.visit(z.children[0],B);for(C=1;C<z.children.length;C+=1)if(F=this.visit(z.children[1],F),F===null)return null;return F;case"IndexExpression":return p=this.visit(z.children[0],B),$0=this.visit(z.children[1],p),$0;case"Index":if(!Array.isArray(B))return null;let P0=z.value;if(P0<0)P0=B.length+P0;if(F=B[P0],F===void 0)F=null;return F;case"Slice":if(!Array.isArray(B))return null;let U0=[...z.children],L0=this.computeSliceParams(B.length,U0),[D1,w1,o1]=L0;if(F=[],o1>0)for(C=D1;C<w1;C+=o1)F.push(B[C]);else for(C=D1;C>w1;C+=o1)F.push(B[C]);return F;case"Projection":if(r=this.visit(z.children[0],B),!Array.isArray(r))return null;l=[];for(C=0;C<r.length;C+=1)if(L=this.visit(z.children[1],r[C]),L!==null)l.push(L);return l;case"ValueProjection":if(r=this.visit(z.children[0],B),!X(r))return null;l=[];let Z4=Object.values(r);for(C=0;C<Z4.length;C+=1)if(L=this.visit(z.children[1],Z4[C]),L!==null)l.push(L);return l;case"FilterProjection":if(r=this.visit(z.children[0],B),!Array.isArray(r))return null;let i1=[],R4=[];for(C=0;C<r.length;C+=1)if($=this.visit(z.children[2],r[C]),!Q($))i1.push(r[C]);for(let _0=0;_0<i1.length;_0+=1)if(L=this.visit(z.children[1],i1[_0]),L!==null)R4.push(L);return R4;case"Comparator":switch(N=this.visit(z.children[0],B),_=this.visit(z.children[1],B),z.name){case G.TOK_EQ:F=Y(N,_);break;case G.TOK_NE:F=!Y(N,_);break;case G.TOK_GT:F=N>_;break;case G.TOK_GTE:F=N>=_;break;case G.TOK_LT:F=N<_;break;case G.TOK_LTE:F=N<=_;break;default:throw Error(`Unknown comparator: ${z.name}`)}return F;case G.TOK_FLATTEN:let r1=this.visit(z.children[0],B);if(!Array.isArray(r1))return null;let M1=[];for(C=0;C<r1.length;C+=1)if(L=r1[C],Array.isArray(L))M1=[...M1,...L];else M1.push(L);return M1;case"Identity":return B;case"MultiSelectList":if(B===null)return null;l=[];for(C=0;C<z.children.length;C+=1)l.push(this.visit(z.children[C],B));return l;case"MultiSelectHash":if(B===null)return null;l={};let n1;for(C=0;C<z.children.length;C+=1)n1=z.children[C],l[n1.name]=this.visit(n1.value,B);return l;case"OrExpression":if($=this.visit(z.children[0],B),Q($))$=this.visit(z.children[1],B);return $;case"AndExpression":if(N=this.visit(z.children[0],B),Q(N))return N;return this.visit(z.children[1],B);case"NotExpression":return N=this.visit(z.children[0],B),Q(N);case"Literal":return z.value;case G.TOK_PIPE:return p=this.visit(z.children[0],B),this.visit(z.children[1],p);case G.TOK_CURRENT:return B;case G.TOK_ROOT:return this._rootValue;case"Function":let E4=[];for(let _0=0;_0<z.children.length;_0+=1)E4.push(this.visit(z.children[_0],B));return this.runtime.callFunction(z.name,E4);case"ExpressionReference":let I4=z.children[0];return I4.jmespathType=G.TOK_EXPREF,I4;default:throw Error(`Unknown node type: ${z.type}`)}}computeSliceParams(z,B){let[$,L,F]=B;if(F===null)F=1;else if(F===0){let _=Error("Invalid slice, step cannot be 0");throw _.name="RuntimeError",_}let N=F<0?!0:!1;return $=$===null?N?z-1:0:this.capSliceRange(z,$,F),L=L===null?N?-1:z:this.capSliceRange(z,L,F),[$,L,F]}capSliceRange(z,B,$){let L=B;if(L<0){if(L+=z,L<0)L=$<0?-1:0}else if(L>=z)L=$<0?z-1:z;return L}}let Y0=new U1,x=M.TYPE_ANY,o=M.TYPE_ARRAY,u0=M.TYPE_ARRAY_NUMBER,p0=M.TYPE_ARRAY_STRING,L1=M.TYPE_BOOLEAN,H4=M.TYPE_EXPREF,U4=M.TYPE_NULL,L4=M.TYPE_NUMBER,D4=M.TYPE_OBJECT,w4=M.TYPE_STRING;function M4(z){return N0.parse(z)}function F4(z){return R.tokenize(z)}let O4=(z,B,$)=>{Y0.runtime.registerFunction(z,B,$)};function V4(z,B){let $=N0.parse(B);return Y0.search($,z)}let N4=Y0,P4={compile:M4,registerFunction:O4,search:V4,tokenize:F4,TreeInterpreter:N4,TYPE_ANY:x,TYPE_ARRAY_NUMBER:u0,TYPE_ARRAY_STRING:p0,TYPE_ARRAY:o,TYPE_BOOLEAN:L1,TYPE_EXPREF:H4,TYPE_NULL:U4,TYPE_NUMBER:L4,TYPE_OBJECT:D4,TYPE_STRING:w4};W.TYPE_ANY=x,W.TYPE_ARRAY=o,W.TYPE_ARRAY_NUMBER=u0,W.TYPE_ARRAY_STRING=p0,W.TYPE_BOOLEAN=L1,W.TYPE_EXPREF=H4,W.TYPE_NULL=U4,W.TYPE_NUMBER=L4,W.TYPE_OBJECT=D4,W.TYPE_STRING=w4,W.TreeInterpreter=N4,W.compile=M4,W.default=P4,W.jmespath=P4,W.registerFunction=O4,W.search=V4,W.tokenize=F4,Object.defineProperty(W,"__esModule",{value:!0})})});import sW from"node:process";var C4;function w(W,X,Y){function Q(G,H){if(!G._zod)Object.defineProperty(G,"_zod",{value:{def:H,constr:J,traits:new Set},enumerable:!1});if(G._zod.traits.has(W))return;G._zod.traits.add(W),X(G,H);let D=J.prototype,O=Object.keys(D);for(let V=0;V<O.length;V++){let R=O[V];if(!(R in G))G[R]=D[R].bind(G)}}let K=Y?.Parent??Object;class q extends K{}Object.defineProperty(q,"name",{value:W});function J(G){var H;let D=Y?.Parent?new q:this;Q(D,G),(H=D._zod).deferred??(H.deferred=[]);for(let O of D._zod.deferred)O();return D}return Object.defineProperty(J,"init",{value:Q}),Object.defineProperty(J,Symbol.hasInstance,{value:(G)=>{if(Y?.Parent&&G instanceof Y.Parent)return!0;return G?._zod?.traits?.has(W)}}),Object.defineProperty(J,"name",{value:W}),J}var l7=Symbol("zod_brand");class w0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class l0 extends Error{constructor(W){super(`Encountered unidirectional transform during encode: ${W}`);this.name="ZodEncodeError"}}(C4=globalThis).__zod_globalConfig??(C4.__zod_globalConfig={});var v0=globalThis.__zod_globalConfig;function K0(W){if(W)Object.assign(v0,W);return v0}var S={};a1(S,{unwrapMessage:()=>d0,uint8ArrayToHex:()=>BX,uint8ArrayToBase64url:()=>JX,uint8ArrayToBase64:()=>k4,stringifyPrimitive:()=>N1,slugify:()=>X9,shallowClone:()=>A4,safeExtend:()=>XX,required:()=>KX,randomString:()=>r3,propertyKeyTypes:()=>Q9,promiseAllObject:()=>i3,primitiveTypes:()=>j4,prefixIssues:()=>O0,pick:()=>s3,partial:()=>QX,parsedType:()=>J9,optionalKeys:()=>K9,omit:()=>e3,objectClone:()=>l3,numKeys:()=>n3,nullish:()=>i0,normalizeParams:()=>I,mergeDefs:()=>M0,merge:()=>YX,jsonStringifyReplacer:()=>x0,joinValues:()=>F1,issue:()=>h0,isPlainObject:()=>R0,isObject:()=>A0,hexToUint8Array:()=>zX,getSizableOrigin:()=>b4,getParsedType:()=>t3,getLengthableOrigin:()=>n0,getEnumValues:()=>o0,getElementAtPath:()=>o3,floatSafeRemainder:()=>W9,finalizeIssue:()=>J0,extend:()=>WX,explicitlyAborted:()=>q9,escapeRegex:()=>F0,esc:()=>O1,defineLazy:()=>T,createTransparentProxy:()=>a3,cloneDef:()=>d3,clone:()=>H0,cleanRegex:()=>r0,cleanEnum:()=>GX,captureStackTrace:()=>V1,cached:()=>g0,base64urlToUint8Array:()=>qX,base64ToUint8Array:()=>T4,assignProp:()=>Z0,assertNotEqual:()=>c3,assertNever:()=>u3,assertIs:()=>m3,assertEqual:()=>f3,assert:()=>p3,allowsEval:()=>Y9,aborted:()=>E0,NUMBER_FORMAT_RANGES:()=>G9,Class:()=>v4,BIGINT_FORMAT_RANGES:()=>S4});function f3(W){return W}function c3(W){return W}function m3(W){}function u3(W){throw Error("Unexpected value in exhaustive check")}function p3(W){}function o0(W){let X=Object.values(W).filter((Q)=>typeof Q==="number");return Object.entries(W).filter(([Q,K])=>X.indexOf(+Q)===-1).map(([Q,K])=>K)}function F1(W,X="|"){return W.map((Y)=>N1(Y)).join(X)}function x0(W,X){if(typeof X==="bigint")return X.toString();return X}function g0(W){return{get value(){{let Y=W();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function i0(W){return W===null||W===void 0}function r0(W){let X=W.startsWith("^")?1:0,Y=W.endsWith("$")?W.length-1:W.length;return W.slice(X,Y)}function W9(W,X){let Y=W/X,Q=Math.round(Y),K=Number.EPSILON*Math.max(Math.abs(Y),1);if(Math.abs(Y-Q)<K)return 0;return Y-Q}var _4=Symbol("evaluating");function T(W,X,Y){let Q=void 0;Object.defineProperty(W,X,{get(){if(Q===_4)return;if(Q===void 0)Q=_4,Q=Y();return Q},set(K){Object.defineProperty(W,X,{value:K})},configurable:!0})}function l3(W){return Object.create(Object.getPrototypeOf(W),Object.getOwnPropertyDescriptors(W))}function Z0(W,X,Y){Object.defineProperty(W,X,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function M0(...W){let X={};for(let Y of W){let Q=Object.getOwnPropertyDescriptors(Y);Object.assign(X,Q)}return Object.defineProperties({},X)}function d3(W){return M0(W._zod.def)}function o3(W,X){if(!X)return W;return X.reduce((Y,Q)=>Y?.[Q],W)}function i3(W){let X=Object.keys(W),Y=X.map((Q)=>W[Q]);return Promise.all(Y).then((Q)=>{let K={};for(let q=0;q<X.length;q++)K[X[q]]=Q[q];return K})}function r3(W=10){let Y="";for(let Q=0;Q<W;Q++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function O1(W){return JSON.stringify(W)}function X9(W){return W.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var V1="captureStackTrace"in Error?Error.captureStackTrace:(...W)=>{};function A0(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}var Y9=g0(()=>{if(v0.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(W){return!1}});function R0(W){if(A0(W)===!1)return!1;let X=W.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let Y=X.prototype;if(A0(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function A4(W){if(R0(W))return{...W};if(Array.isArray(W))return[...W];if(W instanceof Map)return new Map(W);if(W instanceof Set)return new Set(W);return W}function n3(W){let X=0;for(let Y in W)if(Object.prototype.hasOwnProperty.call(W,Y))X++;return X}var t3=(W)=>{let X=typeof W;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(W)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(W))return"array";if(W===null)return"null";if(W.then&&typeof W.then==="function"&&W.catch&&typeof W.catch==="function")return"promise";if(typeof Map<"u"&&W instanceof Map)return"map";if(typeof Set<"u"&&W instanceof Set)return"set";if(typeof Date<"u"&&W instanceof Date)return"date";if(typeof File<"u"&&W instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},Q9=new Set(["string","number","symbol"]),j4=new Set(["string","number","bigint","boolean","symbol","undefined"]);function F0(W){return W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function H0(W,X,Y){let Q=new W._zod.constr(X??W._zod.def);if(!X||Y?.parent)Q._zod.parent=W;return Q}function I(W){let X=W;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function a3(W){let X;return new Proxy({},{get(Y,Q,K){return X??(X=W()),Reflect.get(X,Q,K)},set(Y,Q,K,q){return X??(X=W()),Reflect.set(X,Q,K,q)},has(Y,Q){return X??(X=W()),Reflect.has(X,Q)},deleteProperty(Y,Q){return X??(X=W()),Reflect.deleteProperty(X,Q)},ownKeys(Y){return X??(X=W()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Y,Q){return X??(X=W()),Reflect.getOwnPropertyDescriptor(X,Q)},defineProperty(Y,Q,K){return X??(X=W()),Reflect.defineProperty(X,Q,K)}})}function N1(W){if(typeof W==="bigint")return W.toString()+"n";if(typeof W==="string")return`"${W}"`;return`${W}`}function K9(W){return Object.keys(W).filter((X)=>{return W[X]._zod.optin==="optional"&&W[X]._zod.optout==="optional"})}var G9={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},S4={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function s3(W,X){let Y=W._zod.def,Q=Y.checks;if(Q&&Q.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let q=M0(W._zod.def,{get shape(){let J={};for(let G in X){if(!(G in Y.shape))throw Error(`Unrecognized key: "${G}"`);if(!X[G])continue;J[G]=Y.shape[G]}return Z0(this,"shape",J),J},checks:[]});return H0(W,q)}function e3(W,X){let Y=W._zod.def,Q=Y.checks;if(Q&&Q.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let q=M0(W._zod.def,{get shape(){let J={...W._zod.def.shape};for(let G in X){if(!(G in Y.shape))throw Error(`Unrecognized key: "${G}"`);if(!X[G])continue;delete J[G]}return Z0(this,"shape",J),J},checks:[]});return H0(W,q)}function WX(W,X){if(!R0(X))throw Error("Invalid input to extend: expected a plain object");let Y=W._zod.def.checks;if(Y&&Y.length>0){let q=W._zod.def.shape;for(let J in X)if(Object.getOwnPropertyDescriptor(q,J)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let K=M0(W._zod.def,{get shape(){let q={...W._zod.def.shape,...X};return Z0(this,"shape",q),q}});return H0(W,K)}function XX(W,X){if(!R0(X))throw Error("Invalid input to safeExtend: expected a plain object");let Y=M0(W._zod.def,{get shape(){let Q={...W._zod.def.shape,...X};return Z0(this,"shape",Q),Q}});return H0(W,Y)}function YX(W,X){if(W._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let Y=M0(W._zod.def,{get shape(){let Q={...W._zod.def.shape,...X._zod.def.shape};return Z0(this,"shape",Q),Q},get catchall(){return X._zod.def.catchall},checks:X._zod.def.checks??[]});return H0(W,Y)}function QX(W,X,Y){let K=X._zod.def.checks;if(K&&K.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let J=M0(X._zod.def,{get shape(){let G=X._zod.def.shape,H={...G};if(Y)for(let D in Y){if(!(D in G))throw Error(`Unrecognized key: "${D}"`);if(!Y[D])continue;H[D]=W?new W({type:"optional",innerType:G[D]}):G[D]}else for(let D in G)H[D]=W?new W({type:"optional",innerType:G[D]}):G[D];return Z0(this,"shape",H),H},checks:[]});return H0(X,J)}function KX(W,X,Y){let Q=M0(X._zod.def,{get shape(){let K=X._zod.def.shape,q={...K};if(Y)for(let J in Y){if(!(J in q))throw Error(`Unrecognized key: "${J}"`);if(!Y[J])continue;q[J]=new W({type:"nonoptional",innerType:K[J]})}else for(let J in K)q[J]=new W({type:"nonoptional",innerType:K[J]});return Z0(this,"shape",q),q}});return H0(X,Q)}function E0(W,X=0){if(W.aborted===!0)return!0;for(let Y=X;Y<W.issues.length;Y++)if(W.issues[Y]?.continue!==!0)return!0;return!1}function q9(W,X=0){if(W.aborted===!0)return!0;for(let Y=X;Y<W.issues.length;Y++)if(W.issues[Y]?.continue===!1)return!0;return!1}function O0(W,X){return X.map((Y)=>{var Q;return(Q=Y).path??(Q.path=[]),Y.path.unshift(W),Y})}function d0(W){return typeof W==="string"?W:W?.message}function J0(W,X,Y){let Q=W.message?W.message:d0(W.inst?._zod.def?.error?.(W))??d0(X?.error?.(W))??d0(Y.customError?.(W))??d0(Y.localeError?.(W))??"Invalid input",{inst:K,continue:q,input:J,...G}=W;if(G.path??(G.path=[]),G.message=Q,X?.reportInput)G.input=J;return G}function b4(W){if(W instanceof Set)return"set";if(W instanceof Map)return"map";if(W instanceof File)return"file";return"unknown"}function n0(W){if(Array.isArray(W))return"array";if(typeof W==="string")return"string";return"unknown"}function J9(W){let X=typeof W;switch(X){case"number":return Number.isNaN(W)?"nan":"number";case"object":{if(W===null)return"null";if(Array.isArray(W))return"array";let Y=W;if(Y&&Object.getPrototypeOf(Y)!==Object.prototype&&"constructor"in Y&&Y.constructor)return Y.constructor.name}}return X}function h0(...W){let[X,Y,Q]=W;if(typeof X==="string")return{message:X,code:"custom",input:Y,inst:Q};return{...X}}function GX(W){return Object.entries(W).filter(([X,Y])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function T4(W){let X=atob(W),Y=new Uint8Array(X.length);for(let Q=0;Q<X.length;Q++)Y[Q]=X.charCodeAt(Q);return Y}function k4(W){let X="";for(let Y=0;Y<W.length;Y++)X+=String.fromCharCode(W[Y]);return btoa(X)}function qX(W){let X=W.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-X.length%4)%4);return T4(X+Y)}function JX(W){return k4(W).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function zX(W){let X=W.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let Y=new Uint8Array(X.length/2);for(let Q=0;Q<X.length;Q+=2)Y[Q/2]=Number.parseInt(X.slice(Q,Q+2),16);return Y}function BX(W){return Array.from(W).map((X)=>X.toString(16).padStart(2,"0")).join("")}class v4{constructor(...W){}}var x4=(W,X)=>{W.name="$ZodError",Object.defineProperty(W,"_zod",{value:W._zod,enumerable:!1}),Object.defineProperty(W,"issues",{value:X,enumerable:!1}),W.message=JSON.stringify(X,x0,2),Object.defineProperty(W,"toString",{value:()=>W.message,enumerable:!1})},P1=w("$ZodError",x4),z9=w("$ZodError",x4,{Parent:Error});function g4(W,X=(Y)=>Y.message){let Y={},Q=[];for(let K of W.issues)if(K.path.length>0)Y[K.path[0]]=Y[K.path[0]]||[],Y[K.path[0]].push(X(K));else Q.push(X(K));return{formErrors:Q,fieldErrors:Y}}function h4(W,X=(Y)=>Y.message){let Y={_errors:[]},Q=(K,q=[])=>{for(let J of K.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map((G)=>Q({issues:G},[...q,...J.path]));else if(J.code==="invalid_key")Q({issues:J.issues},[...q,...J.path]);else if(J.code==="invalid_element")Q({issues:J.issues},[...q,...J.path]);else{let G=[...q,...J.path];if(G.length===0)Y._errors.push(X(J));else{let H=Y,D=0;while(D<G.length){let O=G[D];if(D!==G.length-1)H[O]=H[O]||{_errors:[]};else H[O]=H[O]||{_errors:[]},H[O]._errors.push(X(J));H=H[O],D++}}}};return Q(W),Y}var Z1=(W)=>(X,Y,Q,K)=>{let q=Q?{...Q,async:!1}:{async:!1},J=X._zod.run({value:Y,issues:[]},q);if(J instanceof Promise)throw new w0;if(J.issues.length){let G=new(K?.Err??W)(J.issues.map((H)=>J0(H,q,K0())));throw V1(G,K?.callee),G}return J.value};var R1=(W)=>async(X,Y,Q,K)=>{let q=Q?{...Q,async:!0}:{async:!0},J=X._zod.run({value:Y,issues:[]},q);if(J instanceof Promise)J=await J;if(J.issues.length){let G=new(K?.Err??W)(J.issues.map((H)=>J0(H,q,K0())));throw V1(G,K?.callee),G}return J.value};var t0=(W)=>(X,Y,Q)=>{let K=Q?{...Q,async:!1}:{async:!1},q=X._zod.run({value:Y,issues:[]},K);if(q instanceof Promise)throw new w0;return q.issues.length?{success:!1,error:new(W??P1)(q.issues.map((J)=>J0(J,K,K0())))}:{success:!0,data:q.value}},y4=t0(z9),a0=(W)=>async(X,Y,Q)=>{let K=Q?{...Q,async:!0}:{async:!0},q=X._zod.run({value:Y,issues:[]},K);if(q instanceof Promise)q=await q;return q.issues.length?{success:!1,error:new W(q.issues.map((J)=>J0(J,K,K0())))}:{success:!0,data:q.value}},f4=a0(z9),c4=(W)=>(X,Y,Q)=>{let K=Q?{...Q,direction:"backward"}:{direction:"backward"};return Z1(W)(X,Y,K)};var m4=(W)=>(X,Y,Q)=>{return Z1(W)(X,Y,Q)};var u4=(W)=>async(X,Y,Q)=>{let K=Q?{...Q,direction:"backward"}:{direction:"backward"};return R1(W)(X,Y,K)};var p4=(W)=>async(X,Y,Q)=>{return R1(W)(X,Y,Q)};var l4=(W)=>(X,Y,Q)=>{let K=Q?{...Q,direction:"backward"}:{direction:"backward"};return t0(W)(X,Y,K)};var d4=(W)=>(X,Y,Q)=>{return t0(W)(X,Y,Q)};var o4=(W)=>async(X,Y,Q)=>{let K=Q?{...Q,direction:"backward"}:{direction:"backward"};return a0(W)(X,Y,K)};var i4=(W)=>async(X,Y,Q)=>{return a0(W)(X,Y,Q)};var r4=/^[cC][0-9a-z]{6,}$/,n4=/^[0-9a-z]+$/,t4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,a4=/^[0-9a-vA-V]{20}$/,s4=/^[A-Za-z0-9]{27}$/,e4=/^[a-zA-Z0-9_-]{21}$/,W8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var X8=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,B9=(W)=>{if(!W)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${W}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Y8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var HX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Q8(){return new RegExp(HX,"u")}var K8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,G8=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var q8=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,J8=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,z8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$9=/^[A-Za-z0-9_-]*$/;var B8=/^https?$/,$8=/^\+[1-9]\d{6,14}$/,H8="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",U8=new RegExp(`^${H8}$`);function L8(W){return typeof W.precision==="number"?W.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":W.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${W.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function D8(W){return new RegExp(`^${L8(W)}$`)}function w8(W){let X=L8({precision:W.precision}),Y=["Z"];if(W.local)Y.push("");if(W.offset)Y.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Q=`${X}(?:${Y.join("|")})`;return new RegExp(`^${H8}T(?:${Q})$`)}var M8=(W)=>{let X=W?`[\\s\\S]{${W?.minimum??0},${W?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var F8=/^-?\d+$/,E1=/^-?\d+(?:\.\d+)?$/,O8=/^(?:true|false)$/i,V8=/^null$/i;var N8=/^[^A-Z]*$/,P8=/^[^a-z]*$/;var t=w("$ZodCheck",(W,X)=>{var Y;W._zod??(W._zod={}),W._zod.def=X,(Y=W._zod).onattach??(Y.onattach=[])}),Z8={number:"number",bigint:"bigint",object:"date"},H9=w("$ZodCheckLessThan",(W,X)=>{t.init(W,X);let Y=Z8[typeof X.value];W._zod.onattach.push((Q)=>{let K=Q._zod.bag,q=(X.inclusive?K.maximum:K.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<q)if(X.inclusive)K.maximum=X.value;else K.exclusiveMaximum=X.value}),W._zod.check=(Q)=>{if(X.inclusive?Q.value<=X.value:Q.value<X.value)return;Q.issues.push({origin:Y,code:"too_big",maximum:typeof X.value==="object"?X.value.getTime():X.value,input:Q.value,inclusive:X.inclusive,inst:W,continue:!X.abort})}}),U9=w("$ZodCheckGreaterThan",(W,X)=>{t.init(W,X);let Y=Z8[typeof X.value];W._zod.onattach.push((Q)=>{let K=Q._zod.bag,q=(X.inclusive?K.minimum:K.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>q)if(X.inclusive)K.minimum=X.value;else K.exclusiveMinimum=X.value}),W._zod.check=(Q)=>{if(X.inclusive?Q.value>=X.value:Q.value>X.value)return;Q.issues.push({origin:Y,code:"too_small",minimum:typeof X.value==="object"?X.value.getTime():X.value,input:Q.value,inclusive:X.inclusive,inst:W,continue:!X.abort})}}),R8=w("$ZodCheckMultipleOf",(W,X)=>{t.init(W,X),W._zod.onattach.push((Y)=>{var Q;(Q=Y._zod.bag).multipleOf??(Q.multipleOf=X.value)}),W._zod.check=(Y)=>{if(typeof Y.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof Y.value==="bigint"?Y.value%X.value===BigInt(0):W9(Y.value,X.value)===0)return;Y.issues.push({origin:typeof Y.value,code:"not_multiple_of",divisor:X.value,input:Y.value,inst:W,continue:!X.abort})}}),E8=w("$ZodCheckNumberFormat",(W,X)=>{t.init(W,X),X.format=X.format||"float64";let Y=X.format?.includes("int"),Q=Y?"int":"number",[K,q]=G9[X.format];W._zod.onattach.push((J)=>{let G=J._zod.bag;if(G.format=X.format,G.minimum=K,G.maximum=q,Y)G.pattern=F8}),W._zod.check=(J)=>{let G=J.value;if(Y){if(!Number.isInteger(G)){J.issues.push({expected:Q,format:X.format,code:"invalid_type",continue:!1,input:G,inst:W});return}if(!Number.isSafeInteger(G)){if(G>0)J.issues.push({input:G,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Q,inclusive:!0,continue:!X.abort});else J.issues.push({input:G,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Q,inclusive:!0,continue:!X.abort});return}}if(G<K)J.issues.push({origin:"number",input:G,code:"too_small",minimum:K,inclusive:!0,inst:W,continue:!X.abort});if(G>q)J.issues.push({origin:"number",input:G,code:"too_big",maximum:q,inclusive:!0,inst:W,continue:!X.abort})}});var I8=w("$ZodCheckMaxLength",(W,X)=>{var Y;t.init(W,X),(Y=W._zod.def).when??(Y.when=(Q)=>{let K=Q.value;return!i0(K)&&K.length!==void 0}),W._zod.onattach.push((Q)=>{let K=Q._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<K)Q._zod.bag.maximum=X.maximum}),W._zod.check=(Q)=>{let K=Q.value;if(K.length<=X.maximum)return;let J=n0(K);Q.issues.push({origin:J,code:"too_big",maximum:X.maximum,inclusive:!0,input:K,inst:W,continue:!X.abort})}}),C8=w("$ZodCheckMinLength",(W,X)=>{var Y;t.init(W,X),(Y=W._zod.def).when??(Y.when=(Q)=>{let K=Q.value;return!i0(K)&&K.length!==void 0}),W._zod.onattach.push((Q)=>{let K=Q._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>K)Q._zod.bag.minimum=X.minimum}),W._zod.check=(Q)=>{let K=Q.value;if(K.length>=X.minimum)return;let J=n0(K);Q.issues.push({origin:J,code:"too_small",minimum:X.minimum,inclusive:!0,input:K,inst:W,continue:!X.abort})}}),_8=w("$ZodCheckLengthEquals",(W,X)=>{var Y;t.init(W,X),(Y=W._zod.def).when??(Y.when=(Q)=>{let K=Q.value;return!i0(K)&&K.length!==void 0}),W._zod.onattach.push((Q)=>{let K=Q._zod.bag;K.minimum=X.length,K.maximum=X.length,K.length=X.length}),W._zod.check=(Q)=>{let K=Q.value,q=K.length;if(q===X.length)return;let J=n0(K),G=q>X.length;Q.issues.push({origin:J,...G?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:Q.value,inst:W,continue:!X.abort})}}),s0=w("$ZodCheckStringFormat",(W,X)=>{var Y,Q;if(t.init(W,X),W._zod.onattach.push((K)=>{let q=K._zod.bag;if(q.format=X.format,X.pattern)q.patterns??(q.patterns=new Set),q.patterns.add(X.pattern)}),X.pattern)(Y=W._zod).check??(Y.check=(K)=>{if(X.pattern.lastIndex=0,X.pattern.test(K.value))return;K.issues.push({origin:"string",code:"invalid_format",format:X.format,input:K.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:W,continue:!X.abort})});else(Q=W._zod).check??(Q.check=()=>{})}),A8=w("$ZodCheckRegex",(W,X)=>{s0.init(W,X),W._zod.check=(Y)=>{if(X.pattern.lastIndex=0,X.pattern.test(Y.value))return;Y.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Y.value,pattern:X.pattern.toString(),inst:W,continue:!X.abort})}}),j8=w("$ZodCheckLowerCase",(W,X)=>{X.pattern??(X.pattern=N8),s0.init(W,X)}),S8=w("$ZodCheckUpperCase",(W,X)=>{X.pattern??(X.pattern=P8),s0.init(W,X)}),b8=w("$ZodCheckIncludes",(W,X)=>{t.init(W,X);let Y=F0(X.includes),Q=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Y}`:Y);X.pattern=Q,W._zod.onattach.push((K)=>{let q=K._zod.bag;q.patterns??(q.patterns=new Set),q.patterns.add(Q)}),W._zod.check=(K)=>{if(K.value.includes(X.includes,X.position))return;K.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:K.value,inst:W,continue:!X.abort})}}),T8=w("$ZodCheckStartsWith",(W,X)=>{t.init(W,X);let Y=new RegExp(`^${F0(X.prefix)}.*`);X.pattern??(X.pattern=Y),W._zod.onattach.push((Q)=>{let K=Q._zod.bag;K.patterns??(K.patterns=new Set),K.patterns.add(Y)}),W._zod.check=(Q)=>{if(Q.value.startsWith(X.prefix))return;Q.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:Q.value,inst:W,continue:!X.abort})}}),k8=w("$ZodCheckEndsWith",(W,X)=>{t.init(W,X);let Y=new RegExp(`.*${F0(X.suffix)}$`);X.pattern??(X.pattern=Y),W._zod.onattach.push((Q)=>{let K=Q._zod.bag;K.patterns??(K.patterns=new Set),K.patterns.add(Y)}),W._zod.check=(Q)=>{if(Q.value.endsWith(X.suffix))return;Q.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:Q.value,inst:W,continue:!X.abort})}});var v8=w("$ZodCheckOverwrite",(W,X)=>{t.init(W,X),W._zod.check=(Y)=>{Y.value=X.tx(Y.value)}});class L9{constructor(W=[]){if(this.content=[],this.indent=0,this)this.args=W}indented(W){this.indent+=1,W(this),this.indent-=1}write(W){if(typeof W==="function"){W(this,{execution:"sync"}),W(this,{execution:"async"});return}let Y=W.split(`
|
|
8
|
-
`).filter((q)=>q),
|
|
9
|
-
`))}}var g8={major:4,minor:4,patch:3};var g=w("$ZodType",(W,X)=>{var Y;W??(W={}),W._zod.def=X,W._zod.bag=W._zod.bag||{},W._zod.version=g8;let Q=[...W._zod.def.checks??[]];if(W._zod.traits.has("$ZodCheck"))Q.unshift(W);for(let K of Q)for(let q of K._zod.onattach)q(W);if(Q.length===0)(Y=W._zod).deferred??(Y.deferred=[]),W._zod.deferred?.push(()=>{W._zod.run=W._zod.parse});else{let K=(J,G,H)=>{let D=E0(J),O;for(let V of G){if(V._zod.def.when){if(q9(J))continue;if(!V._zod.def.when(J))continue}else if(D)continue;let R=J.issues.length,P=V._zod.check(J);if(P instanceof Promise&&H?.async===!1)throw new w0;if(O||P instanceof Promise)O=(O??Promise.resolve()).then(async()=>{if(await P,J.issues.length===R)return;if(!D)D=E0(J,R)});else{if(J.issues.length===R)continue;if(!D)D=E0(J,R)}}if(O)return O.then(()=>{return J});return J},q=(J,G,H)=>{if(E0(J))return J.aborted=!0,J;let D=K(G,Q,H);if(D instanceof Promise){if(H.async===!1)throw new w0;return D.then((O)=>W._zod.parse(O,H))}return W._zod.parse(D,H)};W._zod.run=(J,G)=>{if(G.skipChecks)return W._zod.parse(J,G);if(G.direction==="backward"){let D=W._zod.parse({value:J.value,issues:[]},{...G,skipChecks:!0});if(D instanceof Promise)return D.then((O)=>{return q(O,J,G)});return q(D,J,G)}let H=W._zod.parse(J,G);if(H instanceof Promise){if(G.async===!1)throw new w0;return H.then((D)=>K(D,Q,G))}return K(H,Q,G)}}T(W,"~standard",()=>({validate:(K)=>{try{let q=y4(W,K);return q.success?{value:q.data}:{issues:q.error?.issues}}catch(q){return f4(W,K).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),A1=w("$ZodString",(W,X)=>{g.init(W,X),W._zod.pattern=[...W?._zod.bag?.patterns??[]].pop()??M8(W._zod.bag),W._zod.parse=(Y,Q)=>{if(X.coerce)try{Y.value=String(Y.value)}catch(K){}if(typeof Y.value==="string")return Y;return Y.issues.push({expected:"string",code:"invalid_type",input:Y.value,inst:W}),Y}}),h=w("$ZodStringFormat",(W,X)=>{s0.init(W,X),A1.init(W,X)}),d8=w("$ZodGUID",(W,X)=>{X.pattern??(X.pattern=X8),h.init(W,X)}),o8=w("$ZodUUID",(W,X)=>{if(X.version){let Q={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(Q===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=B9(Q))}else X.pattern??(X.pattern=B9());h.init(W,X)}),i8=w("$ZodEmail",(W,X)=>{X.pattern??(X.pattern=Y8),h.init(W,X)}),r8=w("$ZodURL",(W,X)=>{h.init(W,X),W._zod.check=(Y)=>{try{let Q=Y.value.trim();if(!X.normalize&&X.protocol?.source===B8.source){if(!/^https?:\/\//i.test(Q)){Y.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:Y.value,inst:W,continue:!X.abort});return}}let K=new URL(Q);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(K.hostname))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:Y.value,inst:W,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(K.protocol.endsWith(":")?K.protocol.slice(0,-1):K.protocol))Y.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Y.value,inst:W,continue:!X.abort})}if(X.normalize)Y.value=K.href;else Y.value=Q;return}catch(Q){Y.issues.push({code:"invalid_format",format:"url",input:Y.value,inst:W,continue:!X.abort})}}}),n8=w("$ZodEmoji",(W,X)=>{X.pattern??(X.pattern=Q8()),h.init(W,X)}),t8=w("$ZodNanoID",(W,X)=>{X.pattern??(X.pattern=e4),h.init(W,X)}),a8=w("$ZodCUID",(W,X)=>{X.pattern??(X.pattern=r4),h.init(W,X)}),s8=w("$ZodCUID2",(W,X)=>{X.pattern??(X.pattern=n4),h.init(W,X)}),e8=w("$ZodULID",(W,X)=>{X.pattern??(X.pattern=t4),h.init(W,X)}),W6=w("$ZodXID",(W,X)=>{X.pattern??(X.pattern=a4),h.init(W,X)}),X6=w("$ZodKSUID",(W,X)=>{X.pattern??(X.pattern=s4),h.init(W,X)}),Y6=w("$ZodISODateTime",(W,X)=>{X.pattern??(X.pattern=w8(X)),h.init(W,X)}),Q6=w("$ZodISODate",(W,X)=>{X.pattern??(X.pattern=U8),h.init(W,X)}),K6=w("$ZodISOTime",(W,X)=>{X.pattern??(X.pattern=D8(X)),h.init(W,X)}),G6=w("$ZodISODuration",(W,X)=>{X.pattern??(X.pattern=W8),h.init(W,X)}),q6=w("$ZodIPv4",(W,X)=>{X.pattern??(X.pattern=K8),h.init(W,X),W._zod.bag.format="ipv4"}),J6=w("$ZodIPv6",(W,X)=>{X.pattern??(X.pattern=G8),h.init(W,X),W._zod.bag.format="ipv6",W._zod.check=(Y)=>{try{new URL(`http://[${Y.value}]`)}catch{Y.issues.push({code:"invalid_format",format:"ipv6",input:Y.value,inst:W,continue:!X.abort})}}});var z6=w("$ZodCIDRv4",(W,X)=>{X.pattern??(X.pattern=q8),h.init(W,X)}),B6=w("$ZodCIDRv6",(W,X)=>{X.pattern??(X.pattern=J8),h.init(W,X),W._zod.check=(Y)=>{let Q=Y.value.split("/");try{if(Q.length!==2)throw Error();let[K,q]=Q;if(!q)throw Error();let J=Number(q);if(`${J}`!==q)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${K}]`)}catch{Y.issues.push({code:"invalid_format",format:"cidrv6",input:Y.value,inst:W,continue:!X.abort})}}});function $6(W){if(W==="")return!0;if(/\s/.test(W))return!1;if(W.length%4!==0)return!1;try{return atob(W),!0}catch{return!1}}var H6=w("$ZodBase64",(W,X)=>{X.pattern??(X.pattern=z8),h.init(W,X),W._zod.bag.contentEncoding="base64",W._zod.check=(Y)=>{if($6(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64",input:Y.value,inst:W,continue:!X.abort})}});function UX(W){if(!$9.test(W))return!1;let X=W.replace(/[-_]/g,(Q)=>Q==="-"?"+":"/"),Y=X.padEnd(Math.ceil(X.length/4)*4,"=");return $6(Y)}var U6=w("$ZodBase64URL",(W,X)=>{X.pattern??(X.pattern=$9),h.init(W,X),W._zod.bag.contentEncoding="base64url",W._zod.check=(Y)=>{if(UX(Y.value))return;Y.issues.push({code:"invalid_format",format:"base64url",input:Y.value,inst:W,continue:!X.abort})}}),L6=w("$ZodE164",(W,X)=>{X.pattern??(X.pattern=$8),h.init(W,X)});function LX(W,X=null){try{let Y=W.split(".");if(Y.length!==3)return!1;let[Q]=Y;if(!Q)return!1;let K=JSON.parse(atob(Q));if("typ"in K&&K?.typ!=="JWT")return!1;if(!K.alg)return!1;if(X&&(!("alg"in K)||K.alg!==X))return!1;return!0}catch{return!1}}var D6=w("$ZodJWT",(W,X)=>{h.init(W,X),W._zod.check=(Y)=>{if(LX(Y.value,X.alg))return;Y.issues.push({code:"invalid_format",format:"jwt",input:Y.value,inst:W,continue:!X.abort})}});var w9=w("$ZodNumber",(W,X)=>{g.init(W,X),W._zod.pattern=W._zod.bag.pattern??E1,W._zod.parse=(Y,Q)=>{if(X.coerce)try{Y.value=Number(Y.value)}catch(J){}let K=Y.value;if(typeof K==="number"&&!Number.isNaN(K)&&Number.isFinite(K))return Y;let q=typeof K==="number"?Number.isNaN(K)?"NaN":!Number.isFinite(K)?"Infinity":void 0:void 0;return Y.issues.push({expected:"number",code:"invalid_type",input:K,inst:W,...q?{received:q}:{}}),Y}}),w6=w("$ZodNumberFormat",(W,X)=>{E8.init(W,X),w9.init(W,X)}),M6=w("$ZodBoolean",(W,X)=>{g.init(W,X),W._zod.pattern=O8,W._zod.parse=(Y,Q)=>{if(X.coerce)try{Y.value=Boolean(Y.value)}catch(q){}let K=Y.value;if(typeof K==="boolean")return Y;return Y.issues.push({expected:"boolean",code:"invalid_type",input:K,inst:W}),Y}});var F6=w("$ZodNull",(W,X)=>{g.init(W,X),W._zod.pattern=V8,W._zod.values=new Set([null]),W._zod.parse=(Y,Q)=>{let K=Y.value;if(K===null)return Y;return Y.issues.push({expected:"null",code:"invalid_type",input:K,inst:W}),Y}});var O6=w("$ZodUnknown",(W,X)=>{g.init(W,X),W._zod.parse=(Y)=>Y}),V6=w("$ZodNever",(W,X)=>{g.init(W,X),W._zod.parse=(Y,Q)=>{return Y.issues.push({expected:"never",code:"invalid_type",input:Y.value,inst:W}),Y}});function h8(W,X,Y){if(W.issues.length)X.issues.push(...O0(Y,W.issues));X.value[Y]=W.value}var N6=w("$ZodArray",(W,X)=>{g.init(W,X),W._zod.parse=(Y,Q)=>{let K=Y.value;if(!Array.isArray(K))return Y.issues.push({expected:"array",code:"invalid_type",input:K,inst:W}),Y;Y.value=Array(K.length);let q=[];for(let J=0;J<K.length;J++){let G=K[J],H=X.element._zod.run({value:G,issues:[]},Q);if(H instanceof Promise)q.push(H.then((D)=>h8(D,Y,J)));else h8(H,Y,J)}if(q.length)return Promise.all(q).then(()=>Y);return Y}});function _1(W,X,Y,Q,K,q){let J=Y in Q;if(W.issues.length){if(K&&q&&!J)return;X.issues.push(...O0(Y,W.issues))}if(!J&&!K){if(!W.issues.length)X.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[Y]});return}if(W.value===void 0){if(J)X.value[Y]=void 0}else X.value[Y]=W.value}function P6(W){let X=Object.keys(W.shape);for(let Q of X)if(!W.shape?.[Q]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Q}": expected a Zod schema`);let Y=K9(W.shape);return{...W,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Y)}}function Z6(W,X,Y,Q,K,q){let J=[],G=K.keySet,H=K.catchall._zod,D=H.def.type,O=H.optin==="optional",V=H.optout==="optional";for(let R in X){if(R==="__proto__")continue;if(G.has(R))continue;if(D==="never"){J.push(R);continue}let P=H.run({value:X[R],issues:[]},Q);if(P instanceof Promise)W.push(P.then((b)=>_1(b,Y,R,X,O,V)));else _1(P,Y,R,X,O,V)}if(J.length)Y.issues.push({code:"unrecognized_keys",keys:J,input:X,inst:q});if(!W.length)return Y;return Promise.all(W).then(()=>{return Y})}var DX=w("$ZodObject",(W,X)=>{if(g.init(W,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let G=X.shape;Object.defineProperty(X,"shape",{get:()=>{let H={...G};return Object.defineProperty(X,"shape",{value:H}),H}})}let Q=g0(()=>P6(X));T(W._zod,"propValues",()=>{let G=X.shape,H={};for(let D in G){let O=G[D]._zod;if(O.values){H[D]??(H[D]=new Set);for(let V of O.values)H[D].add(V)}}return H});let K=A0,q=X.catchall,J;W._zod.parse=(G,H)=>{J??(J=Q.value);let D=G.value;if(!K(D))return G.issues.push({expected:"object",code:"invalid_type",input:D,inst:W}),G;G.value={};let O=[],V=J.shape;for(let R of J.keys){let P=V[R],b=P._zod.optin==="optional",N0=P._zod.optout==="optional",M=P._zod.run({value:D[R],issues:[]},H);if(M instanceof Promise)O.push(M.then((k0)=>_1(k0,G,R,D,b,N0)));else _1(M,G,R,D,b,N0)}if(!q)return O.length?Promise.all(O).then(()=>G):G;return Z6(O,D,G,H,Q.value,W)}}),R6=w("$ZodObjectJIT",(W,X)=>{DX.init(W,X);let Y=W._zod.parse,Q=g0(()=>P6(X)),K=(R)=>{let P=new L9(["shape","payload","ctx"]),b=Q.value,N0=(Y0)=>{let x=O1(Y0);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};P.write("const input = payload.value;");let M=Object.create(null),k0=0;for(let Y0 of b.keys)M[Y0]=`key_${k0++}`;P.write("const newResult = {};");for(let Y0 of b.keys){let x=M[Y0],o=O1(Y0),u0=R[Y0],p0=u0?._zod?.optin==="optional",L1=u0?._zod?.optout==="optional";if(P.write(`const ${x} = ${N0(Y0)};`),p0&&L1)P.write(`
|
|
6
|
+
Lifetime used`):new X4("Lifetime not alive")}},T0=class extends X0{constructor(W,X){super(W,void 0,void 0,X)}get dupable(){return!0}dup(){return this}dispose(){}},X3=class extends X0{constructor(W,X,Q,Y){super(W,X,Q,Y)}dispose(){this._alive=!1}};D0=class W extends V0{constructor(){super(...arguments);this._disposables=new X0(new Set),this.manage=(X)=>(this._disposables.value.add(X),X)}static withScope(X){let Q=new W,Y;try{return X(Q)}catch(K){throw Y=K,K}finally{s9(Q,Y)}}static withScopeMaybeAsync(X,Q){return F7(void 0,function*(Y){let K=new W,q;try{return yield*Y.of(Q.call(X,Y,K))}catch(J){throw q=J,J}finally{s9(K,q)}})}static async withScopeAsync(X){let Q=new W,Y;try{return await X(Q)}catch(K){throw Y=K,K}finally{s9(Q,Y)}}get alive(){return this._disposables.alive}dispose(){let X=Array.from(this._disposables.value.values()).reverse();for(let Q of X)Q.alive&&Q.dispose();this._disposables.dispose()}};q4=class W extends V0{static success(X){return new V7(X)}static fail(X,Q){return new N7(X,Q)}static is(X){return X instanceof W}},V7=class extends q4{constructor(W){super();this.value=W}get alive(){return l1(this.value)?this.value.alive:!0}dispose(){l1(this.value)&&this.value.dispose()}unwrap(){return this.value}unwrapOr(W){return this.value}},N7=class extends q4{constructor(W,X){super();this.error=W,this.onUnwrap=X}get alive(){return l1(this.error)?this.error.alive:!0}dispose(){l1(this.error)&&this.error.dispose()}unwrap(){throw this.onUnwrap(this),this.error}unwrapOr(W){return W}},m0=q4,P7=class extends V0{constructor(W){super();this.resolve=(X)=>{this.resolveHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.resolveHandle,this.context.undefined,X||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.reject=(X)=>{this.rejectHandle.alive&&(this.context.unwrapResult(this.context.callFunction(this.rejectHandle,this.context.undefined,X||this.context.undefined)).dispose(),this.disposeResolvers(),this.onSettled())},this.dispose=()=>{this.handle.alive&&this.handle.dispose(),this.disposeResolvers()},this.context=W.context,this.owner=W.context.runtime,this.handle=W.promiseHandle,this.settled=new Promise((X)=>{this.onSettled=X}),this.resolveHandle=W.resolveHandle,this.rejectHandle=W.rejectHandle}get alive(){return this.handle.alive||this.resolveHandle.alive||this.rejectHandle.alive}disposeResolvers(){this.resolveHandle.alive&&this.resolveHandle.dispose(),this.rejectHandle.alive&&this.rejectHandle.dispose()}},ZG=Symbol("Unstable"),RG=Object.freeze({BaseObjects:!0,Date:!0,Eval:!0,StringNormalize:!0,RegExp:!0,JSON:!0,Proxy:!0,MapSet:!0,TypedArrays:!0,Promise:!0});C7=class extends V0{constructor(W,X){super();this.handle=W,this.context=X,this._isDone=!1,this.owner=X.runtime}[Symbol.iterator](){return this}next(W){if(!this.alive||this._isDone)return{done:!0,value:void 0};let X=this._next??(this._next=this.context.getProp(this.handle,"next"));return this.callIteratorMethod(X,W)}return(W){if(!this.alive)return{done:!0,value:void 0};let X=this.context.getProp(this.handle,"return");if(X===this.context.undefined&&W===void 0)return this.dispose(),{done:!0,value:void 0};let Q=this.callIteratorMethod(X,W);return X.dispose(),this.dispose(),Q}throw(W){if(!this.alive)return{done:!0,value:void 0};let X=W instanceof X0?W:this.context.newError(W),Q=this.context.getProp(this.handle,"throw"),Y=this.callIteratorMethod(Q,W);return X.alive&&X.dispose(),Q.dispose(),this.dispose(),Y}get alive(){return this.handle.alive}dispose(){this._isDone=!0,this.handle.dispose(),this._next?.dispose()}callIteratorMethod(W,X){let Q=X?this.context.callFunction(W,this.handle,X):this.context.callFunction(W,this.handle);if(Q.error)return this.dispose(),{value:Q};let Y=this.context.getProp(Q.value,"done").consume((q)=>this.context.dump(q)),K=this.context.getProp(Q.value,"value");return Q.value.dispose(),Y&&this.dispose(),{value:m0.success(K),done:Y}}};K3=class extends V0{constructor(W,X,Q){if(Q===p1)throw new C0("cannot create HostRef with undefined id");super();this.runtime=W,this.handle=X,this.id=Q}get alive(){return this.handle.alive}dispose(){this.handle.dispose()}get value(){return this.runtime.hostRefs.get(this.id)}},A7=class extends D3{constructor(W){super(W.module);this.scope=new D0,this.copyJSValue=(X)=>this.ffi.QTS_DupValuePointer(this.ctx.value,X),this.freeJSValue=(X)=>{this.ffi.QTS_FreeValuePointer(this.ctx.value,X)},W.ownedLifetimes?.forEach((X)=>this.scope.manage(X)),this.owner=W.owner,this.module=W.module,this.ffi=W.ffi,this.rt=W.rt,this.ctx=this.scope.manage(W.ctx)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}[Symbol.dispose](){return this.dispose()}manage(W){return this.scope.manage(W)}consumeJSCharPointer(W){let X=this.module.UTF8ToString(W);return this.ffi.QTS_FreeCString(this.ctx.value,W),X}heapValueHandle(W,X){let Q=X?(Y)=>{X(),this.freeJSValue(Y)}:this.freeJSValue;return new X0(W,this.copyJSValue,Q,this.owner)}staticHeapValueHandle(W){return this.manage(this.heapValueHandle(W)),new T0(W,this.owner)}},j7=class extends V0{constructor(W){super();this._undefined=void 0,this._null=void 0,this._false=void 0,this._true=void 0,this._global=void 0,this._BigInt=void 0,this._Symbol=void 0,this._SymbolIterator=void 0,this._SymbolAsyncIterator=void 0,this.cToHostCallbacks={callFunction:(X,Q,Y,K,q)=>{if(X!==this.ctx.value)throw Error("QuickJSContext instance received C -> JS call with mismatched ctx");let J=this.getFunction(q);return D0.withScopeMaybeAsync(this,function*(G,H){let D=H.manage(new X3(Q,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime)),O=Array(Y);for(let V=0;V<Y;V++){let R=this.ffi.QTS_ArgvGetJSValueConstPointer(K,V);O[V]=H.manage(new X3(R,this.memory.copyJSValue,this.memory.freeJSValue,this.runtime))}try{let V=yield*G(J.apply(D,O));if(V){if("error"in V&&V.error)throw this.runtime.debugLog("throw error",V.error),V.error;let R=H.manage(V instanceof X0?V:V.value);return this.ffi.QTS_DupValuePointer(this.ctx.value,R.value)}return 0}catch(V){return this.errorToHandle(V).consume((R)=>this.ffi.QTS_Throw(this.ctx.value,R.value))}})}},this.runtime=W.runtime,this.module=W.module,this.ffi=W.ffi,this.rt=W.rt,this.ctx=W.ctx,this.memory=new A7({...W,owner:this.runtime}),W.callbacks.setContextCallbacks(this.ctx.value,this.cToHostCallbacks),this.dump=this.dump.bind(this),this.getString=this.getString.bind(this),this.getNumber=this.getNumber.bind(this),this.resolvePromise=this.resolvePromise.bind(this),this.uint32Out=this.memory.manage(this.memory.newTypedArray(Uint32Array,1))}get alive(){return this.memory.alive}dispose(){this.memory.dispose()}get undefined(){if(this._undefined)return this._undefined;let W=this.ffi.QTS_GetUndefined();return this._undefined=new T0(W)}get null(){if(this._null)return this._null;let W=this.ffi.QTS_GetNull();return this._null=new T0(W)}get true(){if(this._true)return this._true;let W=this.ffi.QTS_GetTrue();return this._true=new T0(W)}get false(){if(this._false)return this._false;let W=this.ffi.QTS_GetFalse();return this._false=new T0(W)}get global(){if(this._global)return this._global;let W=this.ffi.QTS_GetGlobalObject(this.ctx.value);return this._global=this.memory.staticHeapValueHandle(W),this._global}newNumber(W){return this.memory.heapValueHandle(this.ffi.QTS_NewFloat64(this.ctx.value,W))}newString(W){let X=this.memory.newHeapCharPointer(W).consume((Q)=>this.ffi.QTS_NewString(this.ctx.value,Q.value.ptr));return this.memory.heapValueHandle(X)}newUniqueSymbol(W){let X=(typeof W=="symbol"?W.description:W)??"",Q=this.memory.newHeapCharPointer(X).consume((Y)=>this.ffi.QTS_NewSymbol(this.ctx.value,Y.value.ptr,0));return this.memory.heapValueHandle(Q)}newSymbolFor(W){let X=(typeof W=="symbol"?W.description:W)??"",Q=this.memory.newHeapCharPointer(X).consume((Y)=>this.ffi.QTS_NewSymbol(this.ctx.value,Y.value.ptr,1));return this.memory.heapValueHandle(Q)}getWellKnownSymbol(W){return this._Symbol??(this._Symbol=this.memory.manage(this.getProp(this.global,"Symbol"))),this.getProp(this._Symbol,W)}newBigInt(W){if(!this._BigInt){let Y=this.getProp(this.global,"BigInt");this.memory.manage(Y),this._BigInt=new T0(Y.value,this.runtime)}let X=this._BigInt,Q=String(W);return this.newString(Q).consume((Y)=>this.unwrapResult(this.callFunction(X,this.undefined,Y)))}newObject(W){W&&this.runtime.assertOwned(W);let X=W?this.ffi.QTS_NewObjectProto(this.ctx.value,W.value):this.ffi.QTS_NewObject(this.ctx.value);return this.memory.heapValueHandle(X)}newArray(){let W=this.ffi.QTS_NewArray(this.ctx.value);return this.memory.heapValueHandle(W)}newArrayBuffer(W){let X=new Uint8Array(W),Q=this.memory.newHeapBufferPointer(X),Y=this.ffi.QTS_NewArrayBuffer(this.ctx.value,Q.value.pointer,X.length);return this.memory.heapValueHandle(Y)}newPromise(W){let X=D0.withScope((Q)=>{let Y=Q.manage(this.memory.newMutablePointerArray(2)),K=this.ffi.QTS_NewPromiseCapability(this.ctx.value,Y.value.ptr),q=this.memory.heapValueHandle(K),[J,G]=Array.from(Y.value.typedArray).map((H)=>this.memory.heapValueHandle(H));return new P7({context:this,promiseHandle:q,resolveHandle:J,rejectHandle:G})});return W&&typeof W=="function"&&(W=new Promise(W)),W&&Promise.resolve(W).then(X.resolve,(Q)=>Q instanceof X0?X.reject(Q):this.newError(Q).consume(X.reject)),X}newFunction(W,X){let Q=typeof W=="function"?W:X;if(!Q)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof W=="string"?W:void 0,length:Q.length,isConstructor:!1,fn:Q})}newConstructorFunction(W,X){let Q=typeof W=="function"?W:X;if(!Q)throw TypeError("Expected a function");return this.newFunctionWithOptions({name:typeof W=="string"?W:void 0,length:Q.length,isConstructor:!0,fn:Q})}newFunctionWithOptions(W){let{name:X,length:Q,isConstructor:Y,fn:K}=W,q=this.runtime.hostRefs.put(K);try{return this.memory.heapValueHandle(this.ffi.QTS_NewFunction(this.ctx.value,X??"",Q,Y,q))}catch(J){throw this.runtime.hostRefs.delete(q),J}}newError(W){let X=this.memory.heapValueHandle(this.ffi.QTS_NewError(this.ctx.value));return W&&typeof W=="object"?(W.name!==void 0&&this.newString(W.name).consume((Q)=>this.setProp(X,"name",Q)),W.message!==void 0&&this.newString(W.message).consume((Q)=>this.setProp(X,"message",Q))):typeof W=="string"?this.newString(W).consume((Q)=>this.setProp(X,"message",Q)):W!==void 0&&this.newString(String(W)).consume((Q)=>this.setProp(X,"message",Q)),X}newHostRef(W){let X=this.runtime.hostRefs.put(W);try{let Q=this.memory.heapValueHandle(this.ffi.QTS_NewHostRef(this.ctx.value,X));return new K3(this.runtime,Q,X)}catch(Q){throw this.runtime.hostRefs.delete(X),Q}}toHostRef(W){let X=this.ffi.QTS_GetHostRefId(W.value);if(X!==0)return this.runtime.hostRefs.get(X),new K3(this.runtime,W.dup(),X)}unwrapHostRef(W){let X=this.ffi.QTS_GetHostRefId(W.value);if(X===0)throw new C0("handle is not a HostRef");return this.runtime.hostRefs.get(X)}typeof(W){return this.runtime.assertOwned(W),this.memory.consumeHeapCharPointer(this.ffi.QTS_Typeof(this.ctx.value,W.value))}getNumber(W){return this.runtime.assertOwned(W),this.ffi.QTS_GetFloat64(this.ctx.value,W.value)}getString(W){return this.runtime.assertOwned(W),this.memory.consumeJSCharPointer(this.ffi.QTS_GetString(this.ctx.value,W.value))}getSymbol(W){this.runtime.assertOwned(W);let X=this.memory.consumeJSCharPointer(this.ffi.QTS_GetSymbolDescriptionOrKey(this.ctx.value,W.value));return this.ffi.QTS_IsGlobalSymbol(this.ctx.value,W.value)?Symbol.for(X):Symbol(X)}getBigInt(W){this.runtime.assertOwned(W);let X=this.getString(W);return BigInt(X)}getArrayBuffer(W){this.runtime.assertOwned(W);let X=this.ffi.QTS_GetArrayBufferLength(this.ctx.value,W.value),Q=this.ffi.QTS_GetArrayBuffer(this.ctx.value,W.value);if(!Q)throw Error("Couldn't allocate memory to get ArrayBuffer");return new X0(this.module.HEAPU8.subarray(Q,Q+X),void 0,()=>this.module._free(Q))}getPromiseState(W){this.runtime.assertOwned(W);let X=this.ffi.QTS_PromiseState(this.ctx.value,W.value);if(X<0)return{type:"fulfilled",value:W,notAPromise:!0};if(X===m1.Pending)return{type:"pending",get error(){return new $3("Cannot unwrap a pending promise")}};let Q=this.ffi.QTS_PromiseResult(this.ctx.value,W.value),Y=this.memory.heapValueHandle(Q);if(X===m1.Fulfilled)return{type:"fulfilled",value:Y};if(X===m1.Rejected)return{type:"rejected",error:Y};throw Y.dispose(),Error(`Unknown JSPromiseStateEnum: ${X}`)}resolvePromise(W){this.runtime.assertOwned(W);let X=D0.withScope((Q)=>{let Y=Q.manage(this.getProp(this.global,"Promise")),K=Q.manage(this.getProp(Y,"resolve"));return this.callFunction(K,Y,W)});return X.error?Promise.resolve(X):new Promise((Q)=>{D0.withScope((Y)=>{let K=Y.manage(this.newFunction("resolve",(H)=>{Q(this.success(H&&H.dup()))})),q=Y.manage(this.newFunction("reject",(H)=>{Q(this.fail(H&&H.dup()))})),J=Y.manage(X.value),G=Y.manage(this.getProp(J,"then"));this.callFunction(G,J,K,q).unwrap().dispose()})})}isEqual(W,X,Q=$1.IsStrictlyEqual){if(W===X)return!0;this.runtime.assertOwned(W),this.runtime.assertOwned(X);let Y=this.ffi.QTS_IsEqual(this.ctx.value,W.value,X.value,Q);if(Y===-1)throw new q3("WASM variant does not expose equality");return!!Y}eq(W,X){return this.isEqual(W,X,$1.IsStrictlyEqual)}sameValue(W,X){return this.isEqual(W,X,$1.IsSameValue)}sameValueZero(W,X){return this.isEqual(W,X,$1.IsSameValueZero)}getProp(W,X){this.runtime.assertOwned(W);let Q;return typeof X=="number"&&X>=0?Q=this.ffi.QTS_GetPropNumber(this.ctx.value,W.value,X):Q=this.borrowPropertyKey(X).consume((Y)=>this.ffi.QTS_GetProp(this.ctx.value,W.value,Y.value)),this.memory.heapValueHandle(Q)}getLength(W){if(this.runtime.assertOwned(W),!(this.ffi.QTS_GetLength(this.ctx.value,this.uint32Out.value.ptr,W.value)<0))return this.uint32Out.value.typedArray[0]}getOwnPropertyNames(W,X={strings:!0,numbersAsStrings:!0}){this.runtime.assertOwned(W),W.value;let Q=E7(X);if(Q===0)throw new H3("No options set, will return an empty array");return D0.withScope((Y)=>{let K=Y.manage(this.memory.newMutablePointerArray(1)),q=this.ffi.QTS_GetOwnPropertyNames(this.ctx.value,K.value.ptr,this.uint32Out.value.ptr,W.value,Q);if(q)return this.fail(this.memory.heapValueHandle(q));let J=this.uint32Out.value.typedArray[0],G=K.value.typedArray[0],H=new Uint32Array(this.module.HEAP8.buffer,G,J),D=Array.from(H).map((O)=>this.memory.heapValueHandle(O));return this.ffi.QTS_FreeVoidPointer(this.ctx.value,G),this.success(O7(D))})}getIterator(W){let X=this._SymbolIterator??(this._SymbolIterator=this.memory.manage(this.getWellKnownSymbol("iterator")));return D0.withScope((Q)=>{let Y=Q.manage(this.getProp(W,X)),K=this.callFunction(Y,W);return K.error?K:this.success(new C7(K.value,this))})}setProp(W,X,Q){this.runtime.assertOwned(W),this.borrowPropertyKey(X).consume((Y)=>this.ffi.QTS_SetProp(this.ctx.value,W.value,Y.value,Q.value))}defineProp(W,X,Q){this.runtime.assertOwned(W),D0.withScope((Y)=>{let K=Y.manage(this.borrowPropertyKey(X)),q=Q.value||this.undefined,J=!!Q.configurable,G=!!Q.enumerable,H=!!Q.value,D=Q.get?Y.manage(this.newFunction(Q.get.name,Q.get)):this.undefined,O=Q.set?Y.manage(this.newFunction(Q.set.name,Q.set)):this.undefined;this.ffi.QTS_DefineProp(this.ctx.value,W.value,K.value,q.value,D.value,O.value,J,G,H)})}callFunction(W,X,...Q){this.runtime.assertOwned(W);let Y,K=Q[0];K===void 0||Array.isArray(K)?Y=K??[]:Y=Q;let q=this.memory.toPointerArray(Y).consume((G)=>this.ffi.QTS_Call(this.ctx.value,W.value,X.value,Y.length,G.value)),J=this.ffi.QTS_ResolveException(this.ctx.value,q);return J?(this.ffi.QTS_FreeValuePointer(this.ctx.value,q),this.fail(this.memory.heapValueHandle(J))):this.success(this.memory.heapValueHandle(q))}callMethod(W,X,Q=[]){return this.getProp(W,X).consume((Y)=>this.callFunction(Y,W,Q))}evalCode(W,X="eval.js",Q){let Y=Q===void 0?1:0,K=R7(Q),q=this.memory.newHeapCharPointer(W).consume((G)=>this.ffi.QTS_Eval(this.ctx.value,G.value.ptr,G.value.strlen,X,Y,K)),J=this.ffi.QTS_ResolveException(this.ctx.value,q);return J?(this.ffi.QTS_FreeValuePointer(this.ctx.value,q),this.fail(this.memory.heapValueHandle(J))):this.success(this.memory.heapValueHandle(q))}throw(W){return this.errorToHandle(W).consume((X)=>this.ffi.QTS_Throw(this.ctx.value,X.value))}borrowPropertyKey(W){return typeof W=="number"?this.newNumber(W):typeof W=="string"?this.newString(W):new T0(W.value,this.runtime)}getMemory(W){if(W===this.rt.value)return this.memory;throw Error("Private API. Cannot get memory from a different runtime")}dump(W){this.runtime.assertOwned(W);let X=this.typeof(W);if(X==="string")return this.getString(W);if(X==="number")return this.getNumber(W);if(X==="bigint")return this.getBigInt(W);if(X==="undefined")return;if(X==="symbol")return this.getSymbol(W);let Q=this.getPromiseState(W);if(Q.type==="fulfilled"&&!Q.notAPromise)return W.dispose(),{type:Q.type,value:Q.value.consume(this.dump)};if(Q.type==="pending")return W.dispose(),{type:Q.type};if(Q.type==="rejected")return W.dispose(),{type:Q.type,error:Q.error.consume(this.dump)};let Y=this.memory.consumeJSCharPointer(this.ffi.QTS_Dump(this.ctx.value,W.value));try{return JSON.parse(Y)}catch{return Y}}unwrapResult(W){if(W.error){let X="context"in W.error?W.error.context:this,Q=W.error.consume((Y)=>this.dump(Y));if(Q&&typeof Q=="object"&&typeof Q.message=="string"){let{message:Y,name:K,stack:q,...J}=Q,G=new W4(Q,X);typeof K=="string"&&(G.name=Q.name),G.message=Y;let H=G.stack;throw typeof q=="string"&&(G.stack=`${K}: ${Y}
|
|
7
|
+
${Q.stack}Host: ${H}`),Object.assign(G,J),G}throw new W4(Q)}return W.value}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { ctx: ${this.ctx.value} rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getFunction(W){let X=this.runtime.hostRefs.get(W);if(typeof X!="function")throw Error(`Host reference ${W} is not a function`);return X}errorToHandle(W){return W instanceof X0?W:this.newError(W)}encodeBinaryJSON(W){let X=this.ffi.QTS_bjson_encode(this.ctx.value,W.value);return this.memory.heapValueHandle(X)}decodeBinaryJSON(W){let X=this.ffi.QTS_bjson_decode(this.ctx.value,W.value);return this.memory.heapValueHandle(X)}success(W){return m0.success(W)}fail(W){return m0.fail(W,(X)=>this.unwrapResult(X))}},S7=class extends V0{constructor(W){super();this.scope=new D0,this.contextMap=new Map,this.hostRefs=new _7,this._debugMode=!1,this.cToHostCallbacks={freeHostRef:(X,Q)=>{if(X!==this.rt.value)throw Error("Runtime pointer mismatch");this.hostRefs.delete(Q)},shouldInterrupt:(X)=>{if(X!==this.rt.value)throw Error("QuickJSContext instance received C -> JS interrupt with mismatched rt");let Q=this.interruptHandler;if(!Q)throw Error("QuickJSContext had no interrupt handler");return Q(this)?1:0},loadModuleSource:eW(this,function*(X,Q,Y,K){let q=this.moduleLoader;if(!q)throw Error("Runtime has no module loader");if(Q!==this.rt.value)throw Error("Runtime pointer mismatch");let J=this.contextMap.get(Y)??this.newContext({contextPointer:Y});try{let G=yield*X(q(K,J));if(typeof G=="object"&&"error"in G&&G.error)throw this.debugLog("cToHostLoadModule: loader returned error",G.error),G.error;let H=typeof G=="string"?G:("value"in G)?G.value:G;return this.memory.newHeapCharPointer(H).value.ptr}catch(G){return this.debugLog("cToHostLoadModule: caught error",G),J.throw(G),0}}),normalizeModule:eW(this,function*(X,Q,Y,K,q){let J=this.moduleNormalizer;if(!J)throw Error("Runtime has no module normalizer");if(Q!==this.rt.value)throw Error("Runtime pointer mismatch");let G=this.contextMap.get(Y)??this.newContext({contextPointer:Y});try{let H=yield*X(J(K,q,G));if(typeof H=="object"&&"error"in H&&H.error)throw this.debugLog("cToHostNormalizeModule: normalizer returned error",H.error),H.error;let D=typeof H=="string"?H:H.value;return G.getMemory(this.rt.value).newHeapCharPointer(D).value.ptr}catch(H){return this.debugLog("normalizeModule: caught error",H),G.throw(H),0}})},W.ownedLifetimes?.forEach((X)=>this.scope.manage(X)),this.module=W.module,this.memory=new D3(this.module),this.ffi=W.ffi,this.rt=W.rt,this.callbacks=W.callbacks,this.scope.manage(this.rt),this.callbacks.setRuntimeCallbacks(this.rt.value,this.cToHostCallbacks),this.executePendingJobs=this.executePendingJobs.bind(this),Y4&&this.setDebugMode(!0)}get alive(){return this.scope.alive}dispose(){return this.scope.dispose()}newContext(W={}){let X=Z7(W.intrinsics),Q=new X0(W.contextPointer||this.ffi.QTS_NewContext(this.rt.value,X),void 0,(K)=>{this.contextMap.delete(K),this.callbacks.deleteContext(K),this.ffi.QTS_FreeContext(K)}),Y=new j7({module:this.module,ctx:Q,ffi:this.ffi,rt:this.rt,ownedLifetimes:W.ownedLifetimes,runtime:this,callbacks:this.callbacks});return this.contextMap.set(Q.value,Y),Y}setModuleLoader(W,X){this.moduleLoader=W,this.moduleNormalizer=X,this.ffi.QTS_RuntimeEnableModuleLoader(this.rt.value,this.moduleNormalizer?1:0)}removeModuleLoader(){this.moduleLoader=void 0,this.ffi.QTS_RuntimeDisableModuleLoader(this.rt.value)}hasPendingJob(){return!!this.ffi.QTS_IsJobPending(this.rt.value)}setInterruptHandler(W){let X=this.interruptHandler;this.interruptHandler=W,X||this.ffi.QTS_RuntimeEnableInterruptHandler(this.rt.value)}removeInterruptHandler(){this.interruptHandler&&(this.ffi.QTS_RuntimeDisableInterruptHandler(this.rt.value),this.interruptHandler=void 0)}executePendingJobs(W=-1){let X=this.memory.newMutablePointerArray(1),Q=this.ffi.QTS_ExecutePendingJob(this.rt.value,W??-1,X.value.ptr),Y=X.value.typedArray[0];if(X.dispose(),Y===0)return this.ffi.QTS_FreeValuePointerRuntime(this.rt.value,Q),m0.success(0);let K=this.contextMap.get(Y)??this.newContext({contextPointer:Y}),q=K.getMemory(this.rt.value).heapValueHandle(Q);if(K.typeof(q)==="number"){let J=K.getNumber(q);return q.dispose(),m0.success(J)}else{let J=Object.assign(q,{context:K});return m0.fail(J,(G)=>K.unwrapResult(G))}}setMemoryLimit(W){if(W<0&&W!==-1)throw Error("Cannot set memory limit to negative number. To unset, pass -1");this.ffi.QTS_RuntimeSetMemoryLimit(this.rt.value,W)}computeMemoryUsage(){let W=this.getSystemContext().getMemory(this.rt.value);return W.heapValueHandle(this.ffi.QTS_RuntimeComputeMemoryUsage(this.rt.value,W.ctx.value))}dumpMemoryUsage(){return this.memory.consumeHeapCharPointer(this.ffi.QTS_RuntimeDumpMemoryUsage(this.rt.value))}setMaxStackSize(W){if(W<0)throw Error("Cannot set memory limit to negative number. To unset, pass 0.");this.ffi.QTS_RuntimeSetMaxStackSize(this.rt.value,W)}assertOwned(W){if(W.owner&&W.owner.rt!==this.rt)throw new G3(`Handle is not owned by this runtime: ${W.owner.rt.value} != ${this.rt.value}`)}setDebugMode(W){this._debugMode=W,this.ffi.DEBUG&&this.rt.alive&&this.ffi.QTS_SetDebugLogEnabled(this.rt.value,W?1:0)}isDebugMode(){return this._debugMode}debugLog(...W){this._debugMode&&console.log("quickjs-emscripten:",...W)}[Symbol.for("nodejs.util.inspect.custom")](){return this.alive?`${this.constructor.name} { rt: ${this.rt.value} }`:`${this.constructor.name} { disposed }`}getSystemContext(){return this.context||(this.context=this.scope.manage(this.newContext())),this.context}}});var F3={};a1(F3,{applyModuleEvalRuntimeOptions:()=>B4,applyBaseRuntimeOptions:()=>z4,QuickJSWASMModule:()=>w3,QuickJSModuleCallbacks:()=>J4});var O3=s1(()=>{M3()});var E3=g3((d1,R3)=>{(function(W,X){typeof d1==="object"&&typeof R3<"u"?X(d1):typeof define==="function"&&define.amd?define(["exports"],X):(W=typeof globalThis<"u"?globalThis:W||self,X(W.jmespath={}))})(d1,function(W){let X=(z)=>{return z!==null&&Object.prototype.toString.call(z)==="[object Object]"},Q=(z,B)=>{if(z===B)return!0;if(typeof z!==typeof B)return!1;if(Array.isArray(z)&&Array.isArray(B)){if(z.length!==B.length)return!1;for(let $=0;$<z.length;$+=1)if(!Q(z[$],B[$]))return!1;return!0}if(X(z)&&X(B)){let $=Object.entries(z),L=new Set(Object.keys(B));if($.length!==L.size)return!1;for(let[F,N]of $){if(!Q(N,B[F]))return!1;L.delete(F)}return L.size===0}return!1},Y=(z)=>{if(z===""||z===!1||z===null||z===void 0)return!0;if(Array.isArray(z)&&z.length===0)return!0;if(X(z)){for(let B in z)if(z.hasOwnProperty(B))return!1;return!0}return!1},K=(z)=>{return z>="a"&&z<="z"||z>="A"&&z<="Z"||z==="_"},q=(z)=>{return z>="0"&&z<="9"||z==="-"},J=(z)=>{return z>="a"&&z<="z"||z>="A"&&z<="Z"||z>="0"&&z<="9"||z==="_"};var G;(function(z){z.TOK_EOF="EOF",z.TOK_UNQUOTEDIDENTIFIER="UnquotedIdentifier",z.TOK_QUOTEDIDENTIFIER="QuotedIdentifier",z.TOK_RBRACKET="Rbracket",z.TOK_RPAREN="Rparen",z.TOK_COMMA="Comma",z.TOK_COLON="Colon",z.TOK_RBRACE="Rbrace",z.TOK_NUMBER="Number",z.TOK_CURRENT="Current",z.TOK_ROOT="Root",z.TOK_EXPREF="Expref",z.TOK_PIPE="Pipe",z.TOK_OR="Or",z.TOK_AND="And",z.TOK_EQ="EQ",z.TOK_GT="GT",z.TOK_LT="LT",z.TOK_GTE="GTE",z.TOK_LTE="LTE",z.TOK_NE="NE",z.TOK_FLATTEN="Flatten",z.TOK_STAR="Star",z.TOK_FILTER="Filter",z.TOK_DOT="Dot",z.TOK_NOT="Not",z.TOK_LBRACE="Lbrace",z.TOK_LBRACKET="Lbracket",z.TOK_LPAREN="Lparen",z.TOK_LITERAL="Literal"})(G||(G={}));let H={"(":G.TOK_LPAREN,")":G.TOK_RPAREN,"*":G.TOK_STAR,",":G.TOK_COMMA,".":G.TOK_DOT,":":G.TOK_COLON,"@":G.TOK_CURRENT,["$"]:G.TOK_ROOT,"]":G.TOK_RBRACKET,"{":G.TOK_LBRACE,"}":G.TOK_RBRACE},D={"!":!0,"<":!0,"=":!0,">":!0},O={"\t":!0,"\n":!0,"\r":!0," ":!0};class V{constructor(){this._current=0}tokenize(z){let B=[];this._current=0;let $,L,F;while(this._current<z.length)if(K(z[this._current]))$=this._current,L=this.consumeUnquotedIdentifier(z),B.push({start:$,type:G.TOK_UNQUOTEDIDENTIFIER,value:L});else if(H[z[this._current]]!==void 0)B.push({start:this._current,type:H[z[this._current]],value:z[this._current]}),this._current+=1;else if(q(z[this._current]))F=this.consumeNumber(z),B.push(F);else if(z[this._current]==="[")F=this.consumeLBracket(z),B.push(F);else if(z[this._current]==='"')$=this._current,L=this.consumeQuotedIdentifier(z),B.push({start:$,type:G.TOK_QUOTEDIDENTIFIER,value:L});else if(z[this._current]==="'")$=this._current,L=this.consumeRawStringLiteral(z),B.push({start:$,type:G.TOK_LITERAL,value:L});else if(z[this._current]==="`"){$=this._current;let N=this.consumeLiteral(z);B.push({start:$,type:G.TOK_LITERAL,value:N})}else if(D[z[this._current]]!==void 0)F=this.consumeOperator(z),F&&B.push(F);else if(O[z[this._current]]!==void 0)this._current+=1;else if(z[this._current]==="&")if($=this._current,this._current+=1,z[this._current]==="&")this._current+=1,B.push({start:$,type:G.TOK_AND,value:"&&"});else B.push({start:$,type:G.TOK_EXPREF,value:"&"});else if(z[this._current]==="|")if($=this._current,this._current+=1,z[this._current]==="|")this._current+=1,B.push({start:$,type:G.TOK_OR,value:"||"});else B.push({start:$,type:G.TOK_PIPE,value:"|"});else{let N=Error(`Unknown character: ${z[this._current]}`);throw N.name="LexerError",N}return B}consumeUnquotedIdentifier(z){let B=this._current;this._current+=1;while(this._current<z.length&&J(z[this._current]))this._current+=1;return z.slice(B,this._current)}consumeQuotedIdentifier(z){let B=this._current;this._current+=1;let $=z.length;while(z[this._current]!=='"'&&this._current<$){let L=this._current;if(z[L]==="\\"&&(z[L+1]==="\\"||z[L+1]==='"'))L+=2;else L+=1;this._current=L}return this._current+=1,JSON.parse(z.slice(B,this._current))}consumeRawStringLiteral(z){let B=this._current;this._current+=1;let $=z.length;while(z[this._current]!=="'"&&this._current<$){let F=this._current;if(z[F]==="\\"&&(z[F+1]==="\\"||z[F+1]==="'"))F+=2;else F+=1;this._current=F}return this._current+=1,z.slice(B+1,this._current-1).replace("\\'","'")}consumeNumber(z){let B=this._current;this._current+=1;let $=z.length;while(q(z[this._current])&&this._current<$)this._current+=1;let L=parseInt(z.slice(B,this._current),10);return{start:B,value:L,type:G.TOK_NUMBER}}consumeLBracket(z){let B=this._current;if(this._current+=1,z[this._current]==="?")return this._current+=1,{start:B,type:G.TOK_FILTER,value:"[?"};if(z[this._current]==="]")return this._current+=1,{start:B,type:G.TOK_FLATTEN,value:"[]"};return{start:B,type:G.TOK_LBRACKET,value:"["}}consumeOperator(z){let B=this._current,$=z[B];if(this._current+=1,$==="!"){if(z[this._current]==="=")return this._current+=1,{start:B,type:G.TOK_NE,value:"!="};return{start:B,type:G.TOK_NOT,value:"!"}}if($==="<"){if(z[this._current]==="=")return this._current+=1,{start:B,type:G.TOK_LTE,value:"<="};return{start:B,type:G.TOK_LT,value:"<"}}if($===">"){if(z[this._current]==="=")return this._current+=1,{start:B,type:G.TOK_GTE,value:">="};return{start:B,type:G.TOK_GT,value:">"}}if($==="="&&z[this._current]==="=")return this._current+=1,{start:B,type:G.TOK_EQ,value:"=="}}consumeLiteral(z){this._current+=1;let B=this._current,$=z.length;while(z[this._current]!=="`"&&this._current<$){let N=this._current;if(z[N]==="\\"&&(z[N+1]==="\\"||z[N+1]==="`"))N+=2;else N+=1;this._current=N}let L=z.slice(B,this._current).trimLeft();L=L.replace("\\`","`");let F=this.looksLikeJSON(L)?JSON.parse(L):JSON.parse(`"${L}"`);return this._current+=1,F}looksLikeJSON(z){let $=["true","false","null"],L="-0123456789";if(z==="")return!1;if('[{"'.includes(z[0]))return!0;if($.includes(z))return!0;if("-0123456789".includes(z[0]))try{return JSON.parse(z),!0}catch(F){return!1}return!1}}let R=new V,P={[G.TOK_EOF]:0,[G.TOK_UNQUOTEDIDENTIFIER]:0,[G.TOK_QUOTEDIDENTIFIER]:0,[G.TOK_RBRACKET]:0,[G.TOK_RPAREN]:0,[G.TOK_COMMA]:0,[G.TOK_RBRACE]:0,[G.TOK_NUMBER]:0,[G.TOK_CURRENT]:0,[G.TOK_EXPREF]:0,[G.TOK_ROOT]:0,[G.TOK_PIPE]:1,[G.TOK_OR]:2,[G.TOK_AND]:3,[G.TOK_EQ]:5,[G.TOK_GT]:5,[G.TOK_LT]:5,[G.TOK_GTE]:5,[G.TOK_LTE]:5,[G.TOK_NE]:5,[G.TOK_FLATTEN]:9,[G.TOK_STAR]:20,[G.TOK_FILTER]:21,[G.TOK_DOT]:40,[G.TOK_NOT]:45,[G.TOK_LBRACE]:50,[G.TOK_LBRACKET]:55,[G.TOK_LPAREN]:60};class b{constructor(){this.index=0,this.tokens=[]}parse(z){this.loadTokens(z),this.index=0;let B=this.expression(0);if(this.lookahead(0)!==G.TOK_EOF){let $=this.lookaheadToken(0);this.errorToken($,`Unexpected token type: ${$.type}, value: ${$.value}`)}return B}loadTokens(z){this.tokens=[...R.tokenize(z),{type:G.TOK_EOF,value:"",start:z.length}]}expression(z){let B=this.lookaheadToken(0);this.advance();let $=this.nud(B),L=this.lookahead(0);while(z<P[L])this.advance(),$=this.led(L,$),L=this.lookahead(0);return $}lookahead(z){return this.tokens[this.index+z].type}lookaheadToken(z){return this.tokens[this.index+z]}advance(){this.index+=1}nud(z){let B,$,L;switch(z.type){case G.TOK_LITERAL:return{type:"Literal",value:z.value};case G.TOK_UNQUOTEDIDENTIFIER:return{type:"Field",name:z.value};case G.TOK_QUOTEDIDENTIFIER:let F={type:"Field",name:z.value};if(this.lookahead(0)===G.TOK_LPAREN)throw Error("Quoted identifier not allowed for function names.");else return F;case G.TOK_NOT:return $=this.expression(P.Not),{type:"NotExpression",children:[$]};case G.TOK_STAR:return B={type:"Identity"},$=this.lookahead(0)===G.TOK_RBRACKET&&{type:"Identity"}||this.parseProjectionRHS(P.Star),{type:"ValueProjection",children:[B,$]};case G.TOK_FILTER:return this.led(z.type,{type:"Identity"});case G.TOK_LBRACE:return this.parseMultiselectHash();case G.TOK_FLATTEN:return B={type:G.TOK_FLATTEN,children:[{type:"Identity"}]},$=this.parseProjectionRHS(P.Flatten),{type:"Projection",children:[B,$]};case G.TOK_LBRACKET:if(this.lookahead(0)===G.TOK_NUMBER||this.lookahead(0)===G.TOK_COLON)return $=this.parseIndexExpression(),this.projectIfSlice({type:"Identity"},$);if(this.lookahead(0)===G.TOK_STAR&&this.lookahead(1)===G.TOK_RBRACKET)return this.advance(),this.advance(),$=this.parseProjectionRHS(P.Star),{children:[{type:"Identity"},$],type:"Projection"};return this.parseMultiselectList();case G.TOK_CURRENT:return{type:G.TOK_CURRENT};case G.TOK_ROOT:return{type:G.TOK_ROOT};case G.TOK_EXPREF:return L=this.expression(P.Expref),{type:"ExpressionReference",children:[L]};case G.TOK_LPAREN:let N=[];while(this.lookahead(0)!==G.TOK_RPAREN){if(this.lookahead(0)===G.TOK_CURRENT)L={type:G.TOK_CURRENT},this.advance();else L=this.expression(0);N.push(L)}return this.match(G.TOK_RPAREN),N[0];default:this.errorToken(z)}}led(z,B){let $;switch(z){case G.TOK_DOT:let L=P.Dot;if(this.lookahead(0)!==G.TOK_STAR)return $=this.parseDotRHS(L),{type:"Subexpression",children:[B,$]};return this.advance(),$=this.parseProjectionRHS(L),{type:"ValueProjection",children:[B,$]};case G.TOK_PIPE:return $=this.expression(P.Pipe),{type:G.TOK_PIPE,children:[B,$]};case G.TOK_OR:return $=this.expression(P.Or),{type:"OrExpression",children:[B,$]};case G.TOK_AND:return $=this.expression(P.And),{type:"AndExpression",children:[B,$]};case G.TOK_LPAREN:let F=B.name,N=[],_;while(this.lookahead(0)!==G.TOK_RPAREN){if(this.lookahead(0)===G.TOK_CURRENT)_={type:G.TOK_CURRENT},this.advance();else _=this.expression(0);if(this.lookahead(0)===G.TOK_COMMA)this.match(G.TOK_COMMA);N.push(_)}return this.match(G.TOK_RPAREN),{name:F,type:"Function",children:N};case G.TOK_FILTER:let p=this.expression(0);return this.match(G.TOK_RBRACKET),$=this.lookahead(0)===G.TOK_FLATTEN&&{type:"Identity"}||this.parseProjectionRHS(P.Filter),{type:"FilterProjection",children:[B,$,p]};case G.TOK_FLATTEN:let $0={type:G.TOK_FLATTEN,children:[B]},l=this.parseProjectionRHS(P.Flatten);return{type:"Projection",children:[$0,l]};case G.TOK_EQ:case G.TOK_NE:case G.TOK_GT:case G.TOK_GTE:case G.TOK_LT:case G.TOK_LTE:return this.parseComparator(B,z);case G.TOK_LBRACKET:let C=this.lookaheadToken(0);if(C.type===G.TOK_NUMBER||C.type===G.TOK_COLON)return $=this.parseIndexExpression(),this.projectIfSlice(B,$);return this.match(G.TOK_STAR),this.match(G.TOK_RBRACKET),$=this.parseProjectionRHS(P.Star),{type:"Projection",children:[B,$]};default:return this.errorToken(this.lookaheadToken(0))}}match(z){if(this.lookahead(0)===z){this.advance();return}else{let B=this.lookaheadToken(0);this.errorToken(B,`Expected ${z}, got: ${B.type}`)}}errorToken(z,B=""){let $=Error(B||`Invalid token (${z.type}): "${z.value}"`);throw $.name="ParserError",$}parseIndexExpression(){if(this.lookahead(0)===G.TOK_COLON||this.lookahead(1)===G.TOK_COLON)return this.parseSliceExpression();let z={type:"Index",value:this.lookaheadToken(0).value};return this.advance(),this.match(G.TOK_RBRACKET),z}projectIfSlice(z,B){let $={type:"IndexExpression",children:[z,B]};if(B.type==="Slice")return{children:[$,this.parseProjectionRHS(P.Star)],type:"Projection"};return $}parseSliceExpression(){let z=[null,null,null],B=0,$=this.lookahead(0);while($!==G.TOK_RBRACKET&&B<3){if($===G.TOK_COLON)B+=1,this.advance();else if($===G.TOK_NUMBER)z[B]=this.lookaheadToken(0).value,this.advance();else{let L=this.lookaheadToken(0);this.errorToken(L,`Syntax error, unexpected token: ${L.value}(${L.type})`)}$=this.lookahead(0)}return this.match(G.TOK_RBRACKET),{children:z,type:"Slice"}}parseComparator(z,B){let $=this.expression(P[B]);return{type:"Comparator",name:B,children:[z,$]}}parseDotRHS(z){let B=this.lookahead(0);if([G.TOK_UNQUOTEDIDENTIFIER,G.TOK_QUOTEDIDENTIFIER,G.TOK_STAR].includes(B))return this.expression(z);if(B===G.TOK_LBRACKET)return this.match(G.TOK_LBRACKET),this.parseMultiselectList();if(B===G.TOK_LBRACE)return this.match(G.TOK_LBRACE),this.parseMultiselectHash();let L=this.lookaheadToken(0);this.errorToken(L,`Syntax error, unexpected token: ${L.value}(${L.type})`)}parseProjectionRHS(z){if(P[this.lookahead(0)]<10)return{type:"Identity"};if(this.lookahead(0)===G.TOK_LBRACKET)return this.expression(z);if(this.lookahead(0)===G.TOK_FILTER)return this.expression(z);if(this.lookahead(0)===G.TOK_DOT)return this.match(G.TOK_DOT),this.parseDotRHS(z);let B=this.lookaheadToken(0);this.errorToken(B,`Syntax error, unexpected token: ${B.value}(${B.type})`)}parseMultiselectList(){let z=[];while(this.lookahead(0)!==G.TOK_RBRACKET){let B=this.expression(0);if(z.push(B),this.lookahead(0)===G.TOK_COMMA){if(this.match(G.TOK_COMMA),this.lookahead(0)===G.TOK_RBRACKET)throw Error("Unexpected token Rbracket")}}return this.match(G.TOK_RBRACKET),{type:"MultiSelectList",children:z}}parseMultiselectHash(){let z=[],B=[G.TOK_UNQUOTEDIDENTIFIER,G.TOK_QUOTEDIDENTIFIER],$,L,F;for(;;){if($=this.lookaheadToken(0),!B.includes($.type))throw Error(`Expecting an identifier token, got: ${$.type}`);if(L=$.value,this.advance(),this.match(G.TOK_COLON),F=this.expression(0),z.push({value:F,type:"KeyValuePair",name:L}),this.lookahead(0)===G.TOK_COMMA)this.match(G.TOK_COMMA);else if(this.lookahead(0)===G.TOK_RBRACE){this.match(G.TOK_RBRACE);break}}return{type:"MultiSelectHash",children:z}}}let N0=new b;var M;(function(z){z[z.TYPE_NUMBER=0]="TYPE_NUMBER",z[z.TYPE_ANY=1]="TYPE_ANY",z[z.TYPE_STRING=2]="TYPE_STRING",z[z.TYPE_ARRAY=3]="TYPE_ARRAY",z[z.TYPE_OBJECT=4]="TYPE_OBJECT",z[z.TYPE_BOOLEAN=5]="TYPE_BOOLEAN",z[z.TYPE_EXPREF=6]="TYPE_EXPREF",z[z.TYPE_NULL=7]="TYPE_NULL",z[z.TYPE_ARRAY_NUMBER=8]="TYPE_ARRAY_NUMBER",z[z.TYPE_ARRAY_STRING=9]="TYPE_ARRAY_STRING"})(M||(M={}));class k0{constructor(z){this.TYPE_NAME_TABLE={[M.TYPE_NUMBER]:"number",[M.TYPE_ANY]:"any",[M.TYPE_STRING]:"string",[M.TYPE_ARRAY]:"array",[M.TYPE_OBJECT]:"object",[M.TYPE_BOOLEAN]:"boolean",[M.TYPE_EXPREF]:"expression",[M.TYPE_NULL]:"null",[M.TYPE_ARRAY_NUMBER]:"Array<number>",[M.TYPE_ARRAY_STRING]:"Array<string>"},this.functionAbs=([B])=>{return Math.abs(B)},this.functionAvg=([B])=>{let $=0;for(let L=0;L<B.length;L+=1)$+=B[L];return $/B.length},this.functionCeil=([B])=>{return Math.ceil(B)},this.functionContains=(B)=>{let[$,L]=B;return $.includes(L)},this.functionEndsWith=(B)=>{let[$,L]=B;return $.includes(L,$.length-L.length)},this.functionFloor=([B])=>{return Math.floor(B)},this.functionJoin=(B)=>{let[$,L]=B;return L.join($)},this.functionKeys=([B])=>{return Object.keys(B)},this.functionLength=([B])=>{if(!X(B))return B.length;return Object.keys(B).length},this.functionMap=(B)=>{if(!this._interpreter)return[];let $=[],L=this._interpreter,F=B[0],N=B[1];for(let _=0;_<N.length;_+=1)$.push(L.visit(F,N[_]));return $},this.functionMax=([B])=>{if(!B.length)return null;if(this.getTypeName(B[0])===M.TYPE_NUMBER)return Math.max(...B);let L=B,F=L[0];for(let N=1;N<L.length;N+=1)if(F.localeCompare(L[N])<0)F=L[N];return F},this.functionMaxBy=(B)=>{let $=B[1],L=B[0],F=this.createKeyFunction($,[M.TYPE_NUMBER,M.TYPE_STRING]),N=-1/0,_,j;for(let p=0;p<L.length;p+=1)if(j=F&&F(L[p]),j!==void 0&&j>N)N=j,_=L[p];return _},this.functionMerge=(B)=>{let $={};for(let L=0;L<B.length;L+=1){let F=B[L];$=Object.assign($,F)}return $},this.functionMin=([B])=>{if(!B.length)return null;if(this.getTypeName(B[0])===M.TYPE_NUMBER)return Math.min(...B);let L=B,F=L[0];for(let N=1;N<L.length;N+=1)if(L[N].localeCompare(F)<0)F=L[N];return F},this.functionMinBy=(B)=>{let $=B[1],L=B[0],F=this.createKeyFunction($,[M.TYPE_NUMBER,M.TYPE_STRING]),N=1/0,_,j;for(let p=0;p<L.length;p+=1)if(j=F&&F(L[p]),j!==void 0&&j<N)N=j,_=L[p];return _},this.functionNotNull=(B)=>{for(let $=0;$<B.length;$+=1)if(this.getTypeName(B[$])!==M.TYPE_NULL)return B[$];return null},this.functionReverse=([B])=>{if(this.getTypeName(B)===M.TYPE_STRING){let F=B,N="";for(let _=F.length-1;_>=0;_-=1)N+=F[_];return N}let L=B.slice(0);return L.reverse(),L},this.functionSort=([B])=>{return[...B].sort()},this.functionSortBy=(B)=>{if(!this._interpreter)return[];let $=B[0].slice(0);if($.length===0)return $;let L=this._interpreter,F=B[1],N=this.getTypeName(L.visit(F,$[0]));if(N!==void 0&&![M.TYPE_NUMBER,M.TYPE_STRING].includes(N))throw Error(`TypeError: unexpected type (${this.TYPE_NAME_TABLE[N]})`);let _=[];for(let j=0;j<$.length;j+=1)_.push([j,$[j]]);_.sort((j,p)=>{let $0=L.visit(F,j[1]),l=L.visit(F,p[1]);if(this.getTypeName($0)!==N)throw Error(`TypeError: expected (${this.TYPE_NAME_TABLE[N]}), received ${this.TYPE_NAME_TABLE[this.getTypeName($0)]}`);else if(this.getTypeName(l)!==N)throw Error(`TypeError: expected (${this.TYPE_NAME_TABLE[N]}), received ${this.TYPE_NAME_TABLE[this.getTypeName(l)]}`);if($0>l)return 1;return $0<l?-1:j[0]-p[0]});for(let j=0;j<_.length;j+=1)$[j]=_[j][1];return $},this.functionStartsWith=([B,$])=>{return B.startsWith($)},this.functionSum=([B])=>{return B.reduce(($,L)=>$+L,0)},this.functionToArray=([B])=>{if(this.getTypeName(B)===M.TYPE_ARRAY)return B;return[B]},this.functionToNumber=([B])=>{let $=this.getTypeName(B),L;if($===M.TYPE_NUMBER)return B;if($===M.TYPE_STRING){if(L=+B,!isNaN(L))return L}return null},this.functionToString=([B])=>{if(this.getTypeName(B)===M.TYPE_STRING)return B;return JSON.stringify(B)},this.functionType=([B])=>{switch(this.getTypeName(B)){case M.TYPE_NUMBER:return"number";case M.TYPE_STRING:return"string";case M.TYPE_ARRAY:return"array";case M.TYPE_OBJECT:return"object";case M.TYPE_BOOLEAN:return"boolean";case M.TYPE_EXPREF:return"expref";case M.TYPE_NULL:return"null";default:return}},this.functionValues=([B])=>{return Object.values(B)},this.functionTable={abs:{_func:this.functionAbs,_signature:[{types:[M.TYPE_NUMBER]}]},avg:{_func:this.functionAvg,_signature:[{types:[M.TYPE_ARRAY_NUMBER]}]},ceil:{_func:this.functionCeil,_signature:[{types:[M.TYPE_NUMBER]}]},contains:{_func:this.functionContains,_signature:[{types:[M.TYPE_STRING,M.TYPE_ARRAY]},{types:[M.TYPE_ANY]}]},ends_with:{_func:this.functionEndsWith,_signature:[{types:[M.TYPE_STRING]},{types:[M.TYPE_STRING]}]},floor:{_func:this.functionFloor,_signature:[{types:[M.TYPE_NUMBER]}]},join:{_func:this.functionJoin,_signature:[{types:[M.TYPE_STRING]},{types:[M.TYPE_ARRAY_STRING]}]},keys:{_func:this.functionKeys,_signature:[{types:[M.TYPE_OBJECT]}]},length:{_func:this.functionLength,_signature:[{types:[M.TYPE_STRING,M.TYPE_ARRAY,M.TYPE_OBJECT]}]},map:{_func:this.functionMap,_signature:[{types:[M.TYPE_EXPREF]},{types:[M.TYPE_ARRAY]}]},max:{_func:this.functionMax,_signature:[{types:[M.TYPE_ARRAY_NUMBER,M.TYPE_ARRAY_STRING]}]},max_by:{_func:this.functionMaxBy,_signature:[{types:[M.TYPE_ARRAY]},{types:[M.TYPE_EXPREF]}]},merge:{_func:this.functionMerge,_signature:[{types:[M.TYPE_OBJECT],variadic:!0}]},min:{_func:this.functionMin,_signature:[{types:[M.TYPE_ARRAY_NUMBER,M.TYPE_ARRAY_STRING]}]},min_by:{_func:this.functionMinBy,_signature:[{types:[M.TYPE_ARRAY]},{types:[M.TYPE_EXPREF]}]},not_null:{_func:this.functionNotNull,_signature:[{types:[M.TYPE_ANY],variadic:!0}]},reverse:{_func:this.functionReverse,_signature:[{types:[M.TYPE_STRING,M.TYPE_ARRAY]}]},sort:{_func:this.functionSort,_signature:[{types:[M.TYPE_ARRAY_STRING,M.TYPE_ARRAY_NUMBER]}]},sort_by:{_func:this.functionSortBy,_signature:[{types:[M.TYPE_ARRAY]},{types:[M.TYPE_EXPREF]}]},starts_with:{_func:this.functionStartsWith,_signature:[{types:[M.TYPE_STRING]},{types:[M.TYPE_STRING]}]},sum:{_func:this.functionSum,_signature:[{types:[M.TYPE_ARRAY_NUMBER]}]},to_array:{_func:this.functionToArray,_signature:[{types:[M.TYPE_ANY]}]},to_number:{_func:this.functionToNumber,_signature:[{types:[M.TYPE_ANY]}]},to_string:{_func:this.functionToString,_signature:[{types:[M.TYPE_ANY]}]},type:{_func:this.functionType,_signature:[{types:[M.TYPE_ANY]}]},values:{_func:this.functionValues,_signature:[{types:[M.TYPE_OBJECT]}]}},this._interpreter=z}registerFunction(z,B,$){if(z in this.functionTable)throw Error(`Function already defined: ${z}()`);this.functionTable[z]={_func:B.bind(this),_signature:$}}callFunction(z,B){let $=this.functionTable[z];if($===void 0)throw Error(`Unknown function: ${z}()`);return this.validateArgs(z,B,$._signature),$._func.call(this,B)}validateInputSignatures(z,B){for(let $=0;$<B.length;$+=1)if("variadic"in B[$]&&$!==B.length-1)throw Error(`ArgumentError: ${z}() 'variadic' argument ${$+1} must occur last`)}validateArgs(z,B,$){var L,F;let N;this.validateInputSignatures(z,$);let _=$.filter((U0)=>{var L0;return(L0=!U0.optional)!==null&&L0!==void 0?L0:!1}).length,j=(F=(L=$[$.length-1])===null||L===void 0?void 0:L.variadic)!==null&&F!==void 0?F:!1,p=B.length<_,$0=B.length>$.length,l=p&&(!j&&_>1||j)?"at least ":"";if(j&&p||!j&&(p||$0))throw N=$.length>1,Error(`ArgumentError: ${z}() takes ${l}${_} argument${N&&"s"||""} but received ${B.length}`);let C,r,P0;for(let U0=0;U0<$.length;U0+=1){P0=!1,C=$[U0].types,r=this.getTypeName(B[U0]);let L0;for(L0=0;L0<C.length;L0+=1)if(r!==void 0&&this.typeMatches(r,C[L0],B[U0])){P0=!0;break}if(!P0&&r!==void 0){let D1=C.map((w1)=>{return this.TYPE_NAME_TABLE[w1]}).join(" | ");throw Error(`TypeError: ${z}() expected argument ${U0+1} to be type (${D1}) but received type ${this.TYPE_NAME_TABLE[r]} instead.`)}}}typeMatches(z,B,$){if(B===M.TYPE_ANY)return!0;if(B===M.TYPE_ARRAY_STRING||B===M.TYPE_ARRAY_NUMBER||B===M.TYPE_ARRAY){if(B===M.TYPE_ARRAY)return z===M.TYPE_ARRAY;if(z===M.TYPE_ARRAY){let L;if(B===M.TYPE_ARRAY_NUMBER)L=M.TYPE_NUMBER;else if(B===M.TYPE_ARRAY_STRING)L=M.TYPE_STRING;for(let F=0;F<$.length;F+=1){let N=this.getTypeName($[F]);if(N!==void 0&&L!==void 0&&!this.typeMatches(N,L,$[F]))return!1}return!0}}else return z===B;return!1}getTypeName(z){switch(Object.prototype.toString.call(z)){case"[object String]":return M.TYPE_STRING;case"[object Number]":return M.TYPE_NUMBER;case"[object Array]":return M.TYPE_ARRAY;case"[object Boolean]":return M.TYPE_BOOLEAN;case"[object Null]":return M.TYPE_NULL;case"[object Object]":if(z.jmespathType===G.TOK_EXPREF)return M.TYPE_EXPREF;return M.TYPE_OBJECT;default:return}}createKeyFunction(z,B){if(!this._interpreter)return;let $=this._interpreter;return(F)=>{let N=$.visit(z,F);if(!B.includes(this.getTypeName(N))){let _=`TypeError: expected one of (${B.map((j)=>this.TYPE_NAME_TABLE[j]).join(" | ")}), received ${this.TYPE_NAME_TABLE[this.getTypeName(N)]}`;throw Error(_)}return N}}}class U1{constructor(){this._rootValue=null,this.runtime=new k0(this)}search(z,B){return this._rootValue=B,this.visit(z,B)}visit(z,B){let $,L,F,N,_,j,p,$0,l,C,r;switch(z.type){case"Field":if(B===null)return null;if(X(B)){if(j=B[z.name],j===void 0)return null;return j}return null;case"Subexpression":F=this.visit(z.children[0],B);for(C=1;C<z.children.length;C+=1)if(F=this.visit(z.children[1],F),F===null)return null;return F;case"IndexExpression":return p=this.visit(z.children[0],B),$0=this.visit(z.children[1],p),$0;case"Index":if(!Array.isArray(B))return null;let P0=z.value;if(P0<0)P0=B.length+P0;if(F=B[P0],F===void 0)F=null;return F;case"Slice":if(!Array.isArray(B))return null;let U0=[...z.children],L0=this.computeSliceParams(B.length,U0),[D1,w1,o1]=L0;if(F=[],o1>0)for(C=D1;C<w1;C+=o1)F.push(B[C]);else for(C=D1;C>w1;C+=o1)F.push(B[C]);return F;case"Projection":if(r=this.visit(z.children[0],B),!Array.isArray(r))return null;l=[];for(C=0;C<r.length;C+=1)if(L=this.visit(z.children[1],r[C]),L!==null)l.push(L);return l;case"ValueProjection":if(r=this.visit(z.children[0],B),!X(r))return null;l=[];let Z4=Object.values(r);for(C=0;C<Z4.length;C+=1)if(L=this.visit(z.children[1],Z4[C]),L!==null)l.push(L);return l;case"FilterProjection":if(r=this.visit(z.children[0],B),!Array.isArray(r))return null;let i1=[],R4=[];for(C=0;C<r.length;C+=1)if($=this.visit(z.children[2],r[C]),!Y($))i1.push(r[C]);for(let _0=0;_0<i1.length;_0+=1)if(L=this.visit(z.children[1],i1[_0]),L!==null)R4.push(L);return R4;case"Comparator":switch(N=this.visit(z.children[0],B),_=this.visit(z.children[1],B),z.name){case G.TOK_EQ:F=Q(N,_);break;case G.TOK_NE:F=!Q(N,_);break;case G.TOK_GT:F=N>_;break;case G.TOK_GTE:F=N>=_;break;case G.TOK_LT:F=N<_;break;case G.TOK_LTE:F=N<=_;break;default:throw Error(`Unknown comparator: ${z.name}`)}return F;case G.TOK_FLATTEN:let r1=this.visit(z.children[0],B);if(!Array.isArray(r1))return null;let M1=[];for(C=0;C<r1.length;C+=1)if(L=r1[C],Array.isArray(L))M1=[...M1,...L];else M1.push(L);return M1;case"Identity":return B;case"MultiSelectList":if(B===null)return null;l=[];for(C=0;C<z.children.length;C+=1)l.push(this.visit(z.children[C],B));return l;case"MultiSelectHash":if(B===null)return null;l={};let n1;for(C=0;C<z.children.length;C+=1)n1=z.children[C],l[n1.name]=this.visit(n1.value,B);return l;case"OrExpression":if($=this.visit(z.children[0],B),Y($))$=this.visit(z.children[1],B);return $;case"AndExpression":if(N=this.visit(z.children[0],B),Y(N))return N;return this.visit(z.children[1],B);case"NotExpression":return N=this.visit(z.children[0],B),Y(N);case"Literal":return z.value;case G.TOK_PIPE:return p=this.visit(z.children[0],B),this.visit(z.children[1],p);case G.TOK_CURRENT:return B;case G.TOK_ROOT:return this._rootValue;case"Function":let E4=[];for(let _0=0;_0<z.children.length;_0+=1)E4.push(this.visit(z.children[_0],B));return this.runtime.callFunction(z.name,E4);case"ExpressionReference":let I4=z.children[0];return I4.jmespathType=G.TOK_EXPREF,I4;default:throw Error(`Unknown node type: ${z.type}`)}}computeSliceParams(z,B){let[$,L,F]=B;if(F===null)F=1;else if(F===0){let _=Error("Invalid slice, step cannot be 0");throw _.name="RuntimeError",_}let N=F<0?!0:!1;return $=$===null?N?z-1:0:this.capSliceRange(z,$,F),L=L===null?N?-1:z:this.capSliceRange(z,L,F),[$,L,F]}capSliceRange(z,B,$){let L=B;if(L<0){if(L+=z,L<0)L=$<0?-1:0}else if(L>=z)L=$<0?z-1:z;return L}}let Q0=new U1,x=M.TYPE_ANY,o=M.TYPE_ARRAY,u0=M.TYPE_ARRAY_NUMBER,p0=M.TYPE_ARRAY_STRING,L1=M.TYPE_BOOLEAN,H4=M.TYPE_EXPREF,U4=M.TYPE_NULL,L4=M.TYPE_NUMBER,D4=M.TYPE_OBJECT,w4=M.TYPE_STRING;function M4(z){return N0.parse(z)}function F4(z){return R.tokenize(z)}let O4=(z,B,$)=>{Q0.runtime.registerFunction(z,B,$)};function V4(z,B){let $=N0.parse(B);return Q0.search($,z)}let N4=Q0,P4={compile:M4,registerFunction:O4,search:V4,tokenize:F4,TreeInterpreter:N4,TYPE_ANY:x,TYPE_ARRAY_NUMBER:u0,TYPE_ARRAY_STRING:p0,TYPE_ARRAY:o,TYPE_BOOLEAN:L1,TYPE_EXPREF:H4,TYPE_NULL:U4,TYPE_NUMBER:L4,TYPE_OBJECT:D4,TYPE_STRING:w4};W.TYPE_ANY=x,W.TYPE_ARRAY=o,W.TYPE_ARRAY_NUMBER=u0,W.TYPE_ARRAY_STRING=p0,W.TYPE_BOOLEAN=L1,W.TYPE_EXPREF=H4,W.TYPE_NULL=U4,W.TYPE_NUMBER=L4,W.TYPE_OBJECT=D4,W.TYPE_STRING=w4,W.TreeInterpreter=N4,W.compile=M4,W.default=P4,W.jmespath=P4,W.registerFunction=O4,W.search=V4,W.tokenize=F4,Object.defineProperty(W,"__esModule",{value:!0})})});import sW from"node:process";var C4;function w(W,X,Q){function Y(G,H){if(!G._zod)Object.defineProperty(G,"_zod",{value:{def:H,constr:J,traits:new Set},enumerable:!1});if(G._zod.traits.has(W))return;G._zod.traits.add(W),X(G,H);let D=J.prototype,O=Object.keys(D);for(let V=0;V<O.length;V++){let R=O[V];if(!(R in G))G[R]=D[R].bind(G)}}let K=Q?.Parent??Object;class q extends K{}Object.defineProperty(q,"name",{value:W});function J(G){var H;let D=Q?.Parent?new q:this;Y(D,G),(H=D._zod).deferred??(H.deferred=[]);for(let O of D._zod.deferred)O();return D}return Object.defineProperty(J,"init",{value:Y}),Object.defineProperty(J,Symbol.hasInstance,{value:(G)=>{if(Q?.Parent&&G instanceof Q.Parent)return!0;return G?._zod?.traits?.has(W)}}),Object.defineProperty(J,"name",{value:W}),J}var l7=Symbol("zod_brand");class w0 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class l0 extends Error{constructor(W){super(`Encountered unidirectional transform during encode: ${W}`);this.name="ZodEncodeError"}}(C4=globalThis).__zod_globalConfig??(C4.__zod_globalConfig={});var v0=globalThis.__zod_globalConfig;function K0(W){if(W)Object.assign(v0,W);return v0}var S={};a1(S,{unwrapMessage:()=>d0,uint8ArrayToHex:()=>BX,uint8ArrayToBase64url:()=>JX,uint8ArrayToBase64:()=>k4,stringifyPrimitive:()=>N1,slugify:()=>X9,shallowClone:()=>A4,safeExtend:()=>XX,required:()=>KX,randomString:()=>r3,propertyKeyTypes:()=>Y9,promiseAllObject:()=>i3,primitiveTypes:()=>j4,prefixIssues:()=>O0,pick:()=>s3,partial:()=>YX,parsedType:()=>J9,optionalKeys:()=>K9,omit:()=>e3,objectClone:()=>l3,numKeys:()=>n3,nullish:()=>i0,normalizeParams:()=>I,mergeDefs:()=>M0,merge:()=>QX,jsonStringifyReplacer:()=>x0,joinValues:()=>F1,issue:()=>h0,isPlainObject:()=>R0,isObject:()=>A0,hexToUint8Array:()=>zX,getSizableOrigin:()=>b4,getParsedType:()=>t3,getLengthableOrigin:()=>n0,getEnumValues:()=>o0,getElementAtPath:()=>o3,floatSafeRemainder:()=>W9,finalizeIssue:()=>J0,extend:()=>WX,explicitlyAborted:()=>q9,escapeRegex:()=>F0,esc:()=>O1,defineLazy:()=>T,createTransparentProxy:()=>a3,cloneDef:()=>d3,clone:()=>H0,cleanRegex:()=>r0,cleanEnum:()=>GX,captureStackTrace:()=>V1,cached:()=>g0,base64urlToUint8Array:()=>qX,base64ToUint8Array:()=>T4,assignProp:()=>Z0,assertNotEqual:()=>c3,assertNever:()=>u3,assertIs:()=>m3,assertEqual:()=>f3,assert:()=>p3,allowsEval:()=>Q9,aborted:()=>E0,NUMBER_FORMAT_RANGES:()=>G9,Class:()=>v4,BIGINT_FORMAT_RANGES:()=>S4});function f3(W){return W}function c3(W){return W}function m3(W){}function u3(W){throw Error("Unexpected value in exhaustive check")}function p3(W){}function o0(W){let X=Object.values(W).filter((Y)=>typeof Y==="number");return Object.entries(W).filter(([Y,K])=>X.indexOf(+Y)===-1).map(([Y,K])=>K)}function F1(W,X="|"){return W.map((Q)=>N1(Q)).join(X)}function x0(W,X){if(typeof X==="bigint")return X.toString();return X}function g0(W){return{get value(){{let Q=W();return Object.defineProperty(this,"value",{value:Q}),Q}throw Error("cached value already set")}}}function i0(W){return W===null||W===void 0}function r0(W){let X=W.startsWith("^")?1:0,Q=W.endsWith("$")?W.length-1:W.length;return W.slice(X,Q)}function W9(W,X){let Q=W/X,Y=Math.round(Q),K=Number.EPSILON*Math.max(Math.abs(Q),1);if(Math.abs(Q-Y)<K)return 0;return Q-Y}var _4=Symbol("evaluating");function T(W,X,Q){let Y=void 0;Object.defineProperty(W,X,{get(){if(Y===_4)return;if(Y===void 0)Y=_4,Y=Q();return Y},set(K){Object.defineProperty(W,X,{value:K})},configurable:!0})}function l3(W){return Object.create(Object.getPrototypeOf(W),Object.getOwnPropertyDescriptors(W))}function Z0(W,X,Q){Object.defineProperty(W,X,{value:Q,writable:!0,enumerable:!0,configurable:!0})}function M0(...W){let X={};for(let Q of W){let Y=Object.getOwnPropertyDescriptors(Q);Object.assign(X,Y)}return Object.defineProperties({},X)}function d3(W){return M0(W._zod.def)}function o3(W,X){if(!X)return W;return X.reduce((Q,Y)=>Q?.[Y],W)}function i3(W){let X=Object.keys(W),Q=X.map((Y)=>W[Y]);return Promise.all(Q).then((Y)=>{let K={};for(let q=0;q<X.length;q++)K[X[q]]=Y[q];return K})}function r3(W=10){let Q="";for(let Y=0;Y<W;Y++)Q+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Q}function O1(W){return JSON.stringify(W)}function X9(W){return W.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var V1="captureStackTrace"in Error?Error.captureStackTrace:(...W)=>{};function A0(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}var Q9=g0(()=>{if(v0.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(W){return!1}});function R0(W){if(A0(W)===!1)return!1;let X=W.constructor;if(X===void 0)return!0;if(typeof X!=="function")return!0;let Q=X.prototype;if(A0(Q)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Q,"isPrototypeOf")===!1)return!1;return!0}function A4(W){if(R0(W))return{...W};if(Array.isArray(W))return[...W];if(W instanceof Map)return new Map(W);if(W instanceof Set)return new Set(W);return W}function n3(W){let X=0;for(let Q in W)if(Object.prototype.hasOwnProperty.call(W,Q))X++;return X}var t3=(W)=>{let X=typeof W;switch(X){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(W)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(W))return"array";if(W===null)return"null";if(W.then&&typeof W.then==="function"&&W.catch&&typeof W.catch==="function")return"promise";if(typeof Map<"u"&&W instanceof Map)return"map";if(typeof Set<"u"&&W instanceof Set)return"set";if(typeof Date<"u"&&W instanceof Date)return"date";if(typeof File<"u"&&W instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${X}`)}},Y9=new Set(["string","number","symbol"]),j4=new Set(["string","number","bigint","boolean","symbol","undefined"]);function F0(W){return W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function H0(W,X,Q){let Y=new W._zod.constr(X??W._zod.def);if(!X||Q?.parent)Y._zod.parent=W;return Y}function I(W){let X=W;if(!X)return{};if(typeof X==="string")return{error:()=>X};if(X?.message!==void 0){if(X?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");X.error=X.message}if(delete X.message,typeof X.error==="string")return{...X,error:()=>X.error};return X}function a3(W){let X;return new Proxy({},{get(Q,Y,K){return X??(X=W()),Reflect.get(X,Y,K)},set(Q,Y,K,q){return X??(X=W()),Reflect.set(X,Y,K,q)},has(Q,Y){return X??(X=W()),Reflect.has(X,Y)},deleteProperty(Q,Y){return X??(X=W()),Reflect.deleteProperty(X,Y)},ownKeys(Q){return X??(X=W()),Reflect.ownKeys(X)},getOwnPropertyDescriptor(Q,Y){return X??(X=W()),Reflect.getOwnPropertyDescriptor(X,Y)},defineProperty(Q,Y,K){return X??(X=W()),Reflect.defineProperty(X,Y,K)}})}function N1(W){if(typeof W==="bigint")return W.toString()+"n";if(typeof W==="string")return`"${W}"`;return`${W}`}function K9(W){return Object.keys(W).filter((X)=>{return W[X]._zod.optin==="optional"&&W[X]._zod.optout==="optional"})}var G9={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},S4={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function s3(W,X){let Q=W._zod.def,Y=Q.checks;if(Y&&Y.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let q=M0(W._zod.def,{get shape(){let J={};for(let G in X){if(!(G in Q.shape))throw Error(`Unrecognized key: "${G}"`);if(!X[G])continue;J[G]=Q.shape[G]}return Z0(this,"shape",J),J},checks:[]});return H0(W,q)}function e3(W,X){let Q=W._zod.def,Y=Q.checks;if(Y&&Y.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let q=M0(W._zod.def,{get shape(){let J={...W._zod.def.shape};for(let G in X){if(!(G in Q.shape))throw Error(`Unrecognized key: "${G}"`);if(!X[G])continue;delete J[G]}return Z0(this,"shape",J),J},checks:[]});return H0(W,q)}function WX(W,X){if(!R0(X))throw Error("Invalid input to extend: expected a plain object");let Q=W._zod.def.checks;if(Q&&Q.length>0){let q=W._zod.def.shape;for(let J in X)if(Object.getOwnPropertyDescriptor(q,J)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let K=M0(W._zod.def,{get shape(){let q={...W._zod.def.shape,...X};return Z0(this,"shape",q),q}});return H0(W,K)}function XX(W,X){if(!R0(X))throw Error("Invalid input to safeExtend: expected a plain object");let Q=M0(W._zod.def,{get shape(){let Y={...W._zod.def.shape,...X};return Z0(this,"shape",Y),Y}});return H0(W,Q)}function QX(W,X){if(W._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let Q=M0(W._zod.def,{get shape(){let Y={...W._zod.def.shape,...X._zod.def.shape};return Z0(this,"shape",Y),Y},get catchall(){return X._zod.def.catchall},checks:X._zod.def.checks??[]});return H0(W,Q)}function YX(W,X,Q){let K=X._zod.def.checks;if(K&&K.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let J=M0(X._zod.def,{get shape(){let G=X._zod.def.shape,H={...G};if(Q)for(let D in Q){if(!(D in G))throw Error(`Unrecognized key: "${D}"`);if(!Q[D])continue;H[D]=W?new W({type:"optional",innerType:G[D]}):G[D]}else for(let D in G)H[D]=W?new W({type:"optional",innerType:G[D]}):G[D];return Z0(this,"shape",H),H},checks:[]});return H0(X,J)}function KX(W,X,Q){let Y=M0(X._zod.def,{get shape(){let K=X._zod.def.shape,q={...K};if(Q)for(let J in Q){if(!(J in q))throw Error(`Unrecognized key: "${J}"`);if(!Q[J])continue;q[J]=new W({type:"nonoptional",innerType:K[J]})}else for(let J in K)q[J]=new W({type:"nonoptional",innerType:K[J]});return Z0(this,"shape",q),q}});return H0(X,Y)}function E0(W,X=0){if(W.aborted===!0)return!0;for(let Q=X;Q<W.issues.length;Q++)if(W.issues[Q]?.continue!==!0)return!0;return!1}function q9(W,X=0){if(W.aborted===!0)return!0;for(let Q=X;Q<W.issues.length;Q++)if(W.issues[Q]?.continue===!1)return!0;return!1}function O0(W,X){return X.map((Q)=>{var Y;return(Y=Q).path??(Y.path=[]),Q.path.unshift(W),Q})}function d0(W){return typeof W==="string"?W:W?.message}function J0(W,X,Q){let Y=W.message?W.message:d0(W.inst?._zod.def?.error?.(W))??d0(X?.error?.(W))??d0(Q.customError?.(W))??d0(Q.localeError?.(W))??"Invalid input",{inst:K,continue:q,input:J,...G}=W;if(G.path??(G.path=[]),G.message=Y,X?.reportInput)G.input=J;return G}function b4(W){if(W instanceof Set)return"set";if(W instanceof Map)return"map";if(W instanceof File)return"file";return"unknown"}function n0(W){if(Array.isArray(W))return"array";if(typeof W==="string")return"string";return"unknown"}function J9(W){let X=typeof W;switch(X){case"number":return Number.isNaN(W)?"nan":"number";case"object":{if(W===null)return"null";if(Array.isArray(W))return"array";let Q=W;if(Q&&Object.getPrototypeOf(Q)!==Object.prototype&&"constructor"in Q&&Q.constructor)return Q.constructor.name}}return X}function h0(...W){let[X,Q,Y]=W;if(typeof X==="string")return{message:X,code:"custom",input:Q,inst:Y};return{...X}}function GX(W){return Object.entries(W).filter(([X,Q])=>{return Number.isNaN(Number.parseInt(X,10))}).map((X)=>X[1])}function T4(W){let X=atob(W),Q=new Uint8Array(X.length);for(let Y=0;Y<X.length;Y++)Q[Y]=X.charCodeAt(Y);return Q}function k4(W){let X="";for(let Q=0;Q<W.length;Q++)X+=String.fromCharCode(W[Q]);return btoa(X)}function qX(W){let X=W.replace(/-/g,"+").replace(/_/g,"/"),Q="=".repeat((4-X.length%4)%4);return T4(X+Q)}function JX(W){return k4(W).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function zX(W){let X=W.replace(/^0x/,"");if(X.length%2!==0)throw Error("Invalid hex string length");let Q=new Uint8Array(X.length/2);for(let Y=0;Y<X.length;Y+=2)Q[Y/2]=Number.parseInt(X.slice(Y,Y+2),16);return Q}function BX(W){return Array.from(W).map((X)=>X.toString(16).padStart(2,"0")).join("")}class v4{constructor(...W){}}var x4=(W,X)=>{W.name="$ZodError",Object.defineProperty(W,"_zod",{value:W._zod,enumerable:!1}),Object.defineProperty(W,"issues",{value:X,enumerable:!1}),W.message=JSON.stringify(X,x0,2),Object.defineProperty(W,"toString",{value:()=>W.message,enumerable:!1})},P1=w("$ZodError",x4),z9=w("$ZodError",x4,{Parent:Error});function g4(W,X=(Q)=>Q.message){let Q={},Y=[];for(let K of W.issues)if(K.path.length>0)Q[K.path[0]]=Q[K.path[0]]||[],Q[K.path[0]].push(X(K));else Y.push(X(K));return{formErrors:Y,fieldErrors:Q}}function h4(W,X=(Q)=>Q.message){let Q={_errors:[]},Y=(K,q=[])=>{for(let J of K.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map((G)=>Y({issues:G},[...q,...J.path]));else if(J.code==="invalid_key")Y({issues:J.issues},[...q,...J.path]);else if(J.code==="invalid_element")Y({issues:J.issues},[...q,...J.path]);else{let G=[...q,...J.path];if(G.length===0)Q._errors.push(X(J));else{let H=Q,D=0;while(D<G.length){let O=G[D];if(D!==G.length-1)H[O]=H[O]||{_errors:[]};else H[O]=H[O]||{_errors:[]},H[O]._errors.push(X(J));H=H[O],D++}}}};return Y(W),Q}var Z1=(W)=>(X,Q,Y,K)=>{let q=Y?{...Y,async:!1}:{async:!1},J=X._zod.run({value:Q,issues:[]},q);if(J instanceof Promise)throw new w0;if(J.issues.length){let G=new(K?.Err??W)(J.issues.map((H)=>J0(H,q,K0())));throw V1(G,K?.callee),G}return J.value};var R1=(W)=>async(X,Q,Y,K)=>{let q=Y?{...Y,async:!0}:{async:!0},J=X._zod.run({value:Q,issues:[]},q);if(J instanceof Promise)J=await J;if(J.issues.length){let G=new(K?.Err??W)(J.issues.map((H)=>J0(H,q,K0())));throw V1(G,K?.callee),G}return J.value};var t0=(W)=>(X,Q,Y)=>{let K=Y?{...Y,async:!1}:{async:!1},q=X._zod.run({value:Q,issues:[]},K);if(q instanceof Promise)throw new w0;return q.issues.length?{success:!1,error:new(W??P1)(q.issues.map((J)=>J0(J,K,K0())))}:{success:!0,data:q.value}},y4=t0(z9),a0=(W)=>async(X,Q,Y)=>{let K=Y?{...Y,async:!0}:{async:!0},q=X._zod.run({value:Q,issues:[]},K);if(q instanceof Promise)q=await q;return q.issues.length?{success:!1,error:new W(q.issues.map((J)=>J0(J,K,K0())))}:{success:!0,data:q.value}},f4=a0(z9),c4=(W)=>(X,Q,Y)=>{let K=Y?{...Y,direction:"backward"}:{direction:"backward"};return Z1(W)(X,Q,K)};var m4=(W)=>(X,Q,Y)=>{return Z1(W)(X,Q,Y)};var u4=(W)=>async(X,Q,Y)=>{let K=Y?{...Y,direction:"backward"}:{direction:"backward"};return R1(W)(X,Q,K)};var p4=(W)=>async(X,Q,Y)=>{return R1(W)(X,Q,Y)};var l4=(W)=>(X,Q,Y)=>{let K=Y?{...Y,direction:"backward"}:{direction:"backward"};return t0(W)(X,Q,K)};var d4=(W)=>(X,Q,Y)=>{return t0(W)(X,Q,Y)};var o4=(W)=>async(X,Q,Y)=>{let K=Y?{...Y,direction:"backward"}:{direction:"backward"};return a0(W)(X,Q,K)};var i4=(W)=>async(X,Q,Y)=>{return a0(W)(X,Q,Y)};var r4=/^[cC][0-9a-z]{6,}$/,n4=/^[0-9a-z]+$/,t4=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,a4=/^[0-9a-vA-V]{20}$/,s4=/^[A-Za-z0-9]{27}$/,e4=/^[a-zA-Z0-9_-]{21}$/,W8=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var X8=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,B9=(W)=>{if(!W)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${W}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Q8=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var HX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Y8(){return new RegExp(HX,"u")}var K8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,G8=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var q8=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,J8=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,z8=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,$9=/^[A-Za-z0-9_-]*$/;var B8=/^https?$/,$8=/^\+[1-9]\d{6,14}$/,H8="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",U8=new RegExp(`^${H8}$`);function L8(W){return typeof W.precision==="number"?W.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":W.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${W.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function D8(W){return new RegExp(`^${L8(W)}$`)}function w8(W){let X=L8({precision:W.precision}),Q=["Z"];if(W.local)Q.push("");if(W.offset)Q.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let Y=`${X}(?:${Q.join("|")})`;return new RegExp(`^${H8}T(?:${Y})$`)}var M8=(W)=>{let X=W?`[\\s\\S]{${W?.minimum??0},${W?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${X}$`)};var F8=/^-?\d+$/,E1=/^-?\d+(?:\.\d+)?$/,O8=/^(?:true|false)$/i,V8=/^null$/i;var N8=/^[^A-Z]*$/,P8=/^[^a-z]*$/;var t=w("$ZodCheck",(W,X)=>{var Q;W._zod??(W._zod={}),W._zod.def=X,(Q=W._zod).onattach??(Q.onattach=[])}),Z8={number:"number",bigint:"bigint",object:"date"},H9=w("$ZodCheckLessThan",(W,X)=>{t.init(W,X);let Q=Z8[typeof X.value];W._zod.onattach.push((Y)=>{let K=Y._zod.bag,q=(X.inclusive?K.maximum:K.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(X.value<q)if(X.inclusive)K.maximum=X.value;else K.exclusiveMaximum=X.value}),W._zod.check=(Y)=>{if(X.inclusive?Y.value<=X.value:Y.value<X.value)return;Y.issues.push({origin:Q,code:"too_big",maximum:typeof X.value==="object"?X.value.getTime():X.value,input:Y.value,inclusive:X.inclusive,inst:W,continue:!X.abort})}}),U9=w("$ZodCheckGreaterThan",(W,X)=>{t.init(W,X);let Q=Z8[typeof X.value];W._zod.onattach.push((Y)=>{let K=Y._zod.bag,q=(X.inclusive?K.minimum:K.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(X.value>q)if(X.inclusive)K.minimum=X.value;else K.exclusiveMinimum=X.value}),W._zod.check=(Y)=>{if(X.inclusive?Y.value>=X.value:Y.value>X.value)return;Y.issues.push({origin:Q,code:"too_small",minimum:typeof X.value==="object"?X.value.getTime():X.value,input:Y.value,inclusive:X.inclusive,inst:W,continue:!X.abort})}}),R8=w("$ZodCheckMultipleOf",(W,X)=>{t.init(W,X),W._zod.onattach.push((Q)=>{var Y;(Y=Q._zod.bag).multipleOf??(Y.multipleOf=X.value)}),W._zod.check=(Q)=>{if(typeof Q.value!==typeof X.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof Q.value==="bigint"?Q.value%X.value===BigInt(0):W9(Q.value,X.value)===0)return;Q.issues.push({origin:typeof Q.value,code:"not_multiple_of",divisor:X.value,input:Q.value,inst:W,continue:!X.abort})}}),E8=w("$ZodCheckNumberFormat",(W,X)=>{t.init(W,X),X.format=X.format||"float64";let Q=X.format?.includes("int"),Y=Q?"int":"number",[K,q]=G9[X.format];W._zod.onattach.push((J)=>{let G=J._zod.bag;if(G.format=X.format,G.minimum=K,G.maximum=q,Q)G.pattern=F8}),W._zod.check=(J)=>{let G=J.value;if(Q){if(!Number.isInteger(G)){J.issues.push({expected:Y,format:X.format,code:"invalid_type",continue:!1,input:G,inst:W});return}if(!Number.isSafeInteger(G)){if(G>0)J.issues.push({input:G,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Y,inclusive:!0,continue:!X.abort});else J.issues.push({input:G,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:Y,inclusive:!0,continue:!X.abort});return}}if(G<K)J.issues.push({origin:"number",input:G,code:"too_small",minimum:K,inclusive:!0,inst:W,continue:!X.abort});if(G>q)J.issues.push({origin:"number",input:G,code:"too_big",maximum:q,inclusive:!0,inst:W,continue:!X.abort})}});var I8=w("$ZodCheckMaxLength",(W,X)=>{var Q;t.init(W,X),(Q=W._zod.def).when??(Q.when=(Y)=>{let K=Y.value;return!i0(K)&&K.length!==void 0}),W._zod.onattach.push((Y)=>{let K=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(X.maximum<K)Y._zod.bag.maximum=X.maximum}),W._zod.check=(Y)=>{let K=Y.value;if(K.length<=X.maximum)return;let J=n0(K);Y.issues.push({origin:J,code:"too_big",maximum:X.maximum,inclusive:!0,input:K,inst:W,continue:!X.abort})}}),C8=w("$ZodCheckMinLength",(W,X)=>{var Q;t.init(W,X),(Q=W._zod.def).when??(Q.when=(Y)=>{let K=Y.value;return!i0(K)&&K.length!==void 0}),W._zod.onattach.push((Y)=>{let K=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(X.minimum>K)Y._zod.bag.minimum=X.minimum}),W._zod.check=(Y)=>{let K=Y.value;if(K.length>=X.minimum)return;let J=n0(K);Y.issues.push({origin:J,code:"too_small",minimum:X.minimum,inclusive:!0,input:K,inst:W,continue:!X.abort})}}),_8=w("$ZodCheckLengthEquals",(W,X)=>{var Q;t.init(W,X),(Q=W._zod.def).when??(Q.when=(Y)=>{let K=Y.value;return!i0(K)&&K.length!==void 0}),W._zod.onattach.push((Y)=>{let K=Y._zod.bag;K.minimum=X.length,K.maximum=X.length,K.length=X.length}),W._zod.check=(Y)=>{let K=Y.value,q=K.length;if(q===X.length)return;let J=n0(K),G=q>X.length;Y.issues.push({origin:J,...G?{code:"too_big",maximum:X.length}:{code:"too_small",minimum:X.length},inclusive:!0,exact:!0,input:Y.value,inst:W,continue:!X.abort})}}),s0=w("$ZodCheckStringFormat",(W,X)=>{var Q,Y;if(t.init(W,X),W._zod.onattach.push((K)=>{let q=K._zod.bag;if(q.format=X.format,X.pattern)q.patterns??(q.patterns=new Set),q.patterns.add(X.pattern)}),X.pattern)(Q=W._zod).check??(Q.check=(K)=>{if(X.pattern.lastIndex=0,X.pattern.test(K.value))return;K.issues.push({origin:"string",code:"invalid_format",format:X.format,input:K.value,...X.pattern?{pattern:X.pattern.toString()}:{},inst:W,continue:!X.abort})});else(Y=W._zod).check??(Y.check=()=>{})}),A8=w("$ZodCheckRegex",(W,X)=>{s0.init(W,X),W._zod.check=(Q)=>{if(X.pattern.lastIndex=0,X.pattern.test(Q.value))return;Q.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Q.value,pattern:X.pattern.toString(),inst:W,continue:!X.abort})}}),j8=w("$ZodCheckLowerCase",(W,X)=>{X.pattern??(X.pattern=N8),s0.init(W,X)}),S8=w("$ZodCheckUpperCase",(W,X)=>{X.pattern??(X.pattern=P8),s0.init(W,X)}),b8=w("$ZodCheckIncludes",(W,X)=>{t.init(W,X);let Q=F0(X.includes),Y=new RegExp(typeof X.position==="number"?`^.{${X.position}}${Q}`:Q);X.pattern=Y,W._zod.onattach.push((K)=>{let q=K._zod.bag;q.patterns??(q.patterns=new Set),q.patterns.add(Y)}),W._zod.check=(K)=>{if(K.value.includes(X.includes,X.position))return;K.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:X.includes,input:K.value,inst:W,continue:!X.abort})}}),T8=w("$ZodCheckStartsWith",(W,X)=>{t.init(W,X);let Q=new RegExp(`^${F0(X.prefix)}.*`);X.pattern??(X.pattern=Q),W._zod.onattach.push((Y)=>{let K=Y._zod.bag;K.patterns??(K.patterns=new Set),K.patterns.add(Q)}),W._zod.check=(Y)=>{if(Y.value.startsWith(X.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:X.prefix,input:Y.value,inst:W,continue:!X.abort})}}),k8=w("$ZodCheckEndsWith",(W,X)=>{t.init(W,X);let Q=new RegExp(`.*${F0(X.suffix)}$`);X.pattern??(X.pattern=Q),W._zod.onattach.push((Y)=>{let K=Y._zod.bag;K.patterns??(K.patterns=new Set),K.patterns.add(Q)}),W._zod.check=(Y)=>{if(Y.value.endsWith(X.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:X.suffix,input:Y.value,inst:W,continue:!X.abort})}});var v8=w("$ZodCheckOverwrite",(W,X)=>{t.init(W,X),W._zod.check=(Q)=>{Q.value=X.tx(Q.value)}});class L9{constructor(W=[]){if(this.content=[],this.indent=0,this)this.args=W}indented(W){this.indent+=1,W(this),this.indent-=1}write(W){if(typeof W==="function"){W(this,{execution:"sync"}),W(this,{execution:"async"});return}let Q=W.split(`
|
|
8
|
+
`).filter((q)=>q),Y=Math.min(...Q.map((q)=>q.length-q.trimStart().length)),K=Q.map((q)=>q.slice(Y)).map((q)=>" ".repeat(this.indent*2)+q);for(let q of K)this.content.push(q)}compile(){let W=Function,X=this?.args,Y=[...(this?.content??[""]).map((K)=>` ${K}`)];return new W(...X,Y.join(`
|
|
9
|
+
`))}}var g8={major:4,minor:4,patch:3};var g=w("$ZodType",(W,X)=>{var Q;W??(W={}),W._zod.def=X,W._zod.bag=W._zod.bag||{},W._zod.version=g8;let Y=[...W._zod.def.checks??[]];if(W._zod.traits.has("$ZodCheck"))Y.unshift(W);for(let K of Y)for(let q of K._zod.onattach)q(W);if(Y.length===0)(Q=W._zod).deferred??(Q.deferred=[]),W._zod.deferred?.push(()=>{W._zod.run=W._zod.parse});else{let K=(J,G,H)=>{let D=E0(J),O;for(let V of G){if(V._zod.def.when){if(q9(J))continue;if(!V._zod.def.when(J))continue}else if(D)continue;let R=J.issues.length,P=V._zod.check(J);if(P instanceof Promise&&H?.async===!1)throw new w0;if(O||P instanceof Promise)O=(O??Promise.resolve()).then(async()=>{if(await P,J.issues.length===R)return;if(!D)D=E0(J,R)});else{if(J.issues.length===R)continue;if(!D)D=E0(J,R)}}if(O)return O.then(()=>{return J});return J},q=(J,G,H)=>{if(E0(J))return J.aborted=!0,J;let D=K(G,Y,H);if(D instanceof Promise){if(H.async===!1)throw new w0;return D.then((O)=>W._zod.parse(O,H))}return W._zod.parse(D,H)};W._zod.run=(J,G)=>{if(G.skipChecks)return W._zod.parse(J,G);if(G.direction==="backward"){let D=W._zod.parse({value:J.value,issues:[]},{...G,skipChecks:!0});if(D instanceof Promise)return D.then((O)=>{return q(O,J,G)});return q(D,J,G)}let H=W._zod.parse(J,G);if(H instanceof Promise){if(G.async===!1)throw new w0;return H.then((D)=>K(D,Y,G))}return K(H,Y,G)}}T(W,"~standard",()=>({validate:(K)=>{try{let q=y4(W,K);return q.success?{value:q.data}:{issues:q.error?.issues}}catch(q){return f4(W,K).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),A1=w("$ZodString",(W,X)=>{g.init(W,X),W._zod.pattern=[...W?._zod.bag?.patterns??[]].pop()??M8(W._zod.bag),W._zod.parse=(Q,Y)=>{if(X.coerce)try{Q.value=String(Q.value)}catch(K){}if(typeof Q.value==="string")return Q;return Q.issues.push({expected:"string",code:"invalid_type",input:Q.value,inst:W}),Q}}),h=w("$ZodStringFormat",(W,X)=>{s0.init(W,X),A1.init(W,X)}),d8=w("$ZodGUID",(W,X)=>{X.pattern??(X.pattern=X8),h.init(W,X)}),o8=w("$ZodUUID",(W,X)=>{if(X.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[X.version];if(Y===void 0)throw Error(`Invalid UUID version: "${X.version}"`);X.pattern??(X.pattern=B9(Y))}else X.pattern??(X.pattern=B9());h.init(W,X)}),i8=w("$ZodEmail",(W,X)=>{X.pattern??(X.pattern=Q8),h.init(W,X)}),r8=w("$ZodURL",(W,X)=>{h.init(W,X),W._zod.check=(Q)=>{try{let Y=Q.value.trim();if(!X.normalize&&X.protocol?.source===B8.source){if(!/^https?:\/\//i.test(Y)){Q.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:Q.value,inst:W,continue:!X.abort});return}}let K=new URL(Y);if(X.hostname){if(X.hostname.lastIndex=0,!X.hostname.test(K.hostname))Q.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:X.hostname.source,input:Q.value,inst:W,continue:!X.abort})}if(X.protocol){if(X.protocol.lastIndex=0,!X.protocol.test(K.protocol.endsWith(":")?K.protocol.slice(0,-1):K.protocol))Q.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:X.protocol.source,input:Q.value,inst:W,continue:!X.abort})}if(X.normalize)Q.value=K.href;else Q.value=Y;return}catch(Y){Q.issues.push({code:"invalid_format",format:"url",input:Q.value,inst:W,continue:!X.abort})}}}),n8=w("$ZodEmoji",(W,X)=>{X.pattern??(X.pattern=Y8()),h.init(W,X)}),t8=w("$ZodNanoID",(W,X)=>{X.pattern??(X.pattern=e4),h.init(W,X)}),a8=w("$ZodCUID",(W,X)=>{X.pattern??(X.pattern=r4),h.init(W,X)}),s8=w("$ZodCUID2",(W,X)=>{X.pattern??(X.pattern=n4),h.init(W,X)}),e8=w("$ZodULID",(W,X)=>{X.pattern??(X.pattern=t4),h.init(W,X)}),W6=w("$ZodXID",(W,X)=>{X.pattern??(X.pattern=a4),h.init(W,X)}),X6=w("$ZodKSUID",(W,X)=>{X.pattern??(X.pattern=s4),h.init(W,X)}),Q6=w("$ZodISODateTime",(W,X)=>{X.pattern??(X.pattern=w8(X)),h.init(W,X)}),Y6=w("$ZodISODate",(W,X)=>{X.pattern??(X.pattern=U8),h.init(W,X)}),K6=w("$ZodISOTime",(W,X)=>{X.pattern??(X.pattern=D8(X)),h.init(W,X)}),G6=w("$ZodISODuration",(W,X)=>{X.pattern??(X.pattern=W8),h.init(W,X)}),q6=w("$ZodIPv4",(W,X)=>{X.pattern??(X.pattern=K8),h.init(W,X),W._zod.bag.format="ipv4"}),J6=w("$ZodIPv6",(W,X)=>{X.pattern??(X.pattern=G8),h.init(W,X),W._zod.bag.format="ipv6",W._zod.check=(Q)=>{try{new URL(`http://[${Q.value}]`)}catch{Q.issues.push({code:"invalid_format",format:"ipv6",input:Q.value,inst:W,continue:!X.abort})}}});var z6=w("$ZodCIDRv4",(W,X)=>{X.pattern??(X.pattern=q8),h.init(W,X)}),B6=w("$ZodCIDRv6",(W,X)=>{X.pattern??(X.pattern=J8),h.init(W,X),W._zod.check=(Q)=>{let Y=Q.value.split("/");try{if(Y.length!==2)throw Error();let[K,q]=Y;if(!q)throw Error();let J=Number(q);if(`${J}`!==q)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${K}]`)}catch{Q.issues.push({code:"invalid_format",format:"cidrv6",input:Q.value,inst:W,continue:!X.abort})}}});function $6(W){if(W==="")return!0;if(/\s/.test(W))return!1;if(W.length%4!==0)return!1;try{return atob(W),!0}catch{return!1}}var H6=w("$ZodBase64",(W,X)=>{X.pattern??(X.pattern=z8),h.init(W,X),W._zod.bag.contentEncoding="base64",W._zod.check=(Q)=>{if($6(Q.value))return;Q.issues.push({code:"invalid_format",format:"base64",input:Q.value,inst:W,continue:!X.abort})}});function UX(W){if(!$9.test(W))return!1;let X=W.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),Q=X.padEnd(Math.ceil(X.length/4)*4,"=");return $6(Q)}var U6=w("$ZodBase64URL",(W,X)=>{X.pattern??(X.pattern=$9),h.init(W,X),W._zod.bag.contentEncoding="base64url",W._zod.check=(Q)=>{if(UX(Q.value))return;Q.issues.push({code:"invalid_format",format:"base64url",input:Q.value,inst:W,continue:!X.abort})}}),L6=w("$ZodE164",(W,X)=>{X.pattern??(X.pattern=$8),h.init(W,X)});function LX(W,X=null){try{let Q=W.split(".");if(Q.length!==3)return!1;let[Y]=Q;if(!Y)return!1;let K=JSON.parse(atob(Y));if("typ"in K&&K?.typ!=="JWT")return!1;if(!K.alg)return!1;if(X&&(!("alg"in K)||K.alg!==X))return!1;return!0}catch{return!1}}var D6=w("$ZodJWT",(W,X)=>{h.init(W,X),W._zod.check=(Q)=>{if(LX(Q.value,X.alg))return;Q.issues.push({code:"invalid_format",format:"jwt",input:Q.value,inst:W,continue:!X.abort})}});var w9=w("$ZodNumber",(W,X)=>{g.init(W,X),W._zod.pattern=W._zod.bag.pattern??E1,W._zod.parse=(Q,Y)=>{if(X.coerce)try{Q.value=Number(Q.value)}catch(J){}let K=Q.value;if(typeof K==="number"&&!Number.isNaN(K)&&Number.isFinite(K))return Q;let q=typeof K==="number"?Number.isNaN(K)?"NaN":!Number.isFinite(K)?"Infinity":void 0:void 0;return Q.issues.push({expected:"number",code:"invalid_type",input:K,inst:W,...q?{received:q}:{}}),Q}}),w6=w("$ZodNumberFormat",(W,X)=>{E8.init(W,X),w9.init(W,X)}),M6=w("$ZodBoolean",(W,X)=>{g.init(W,X),W._zod.pattern=O8,W._zod.parse=(Q,Y)=>{if(X.coerce)try{Q.value=Boolean(Q.value)}catch(q){}let K=Q.value;if(typeof K==="boolean")return Q;return Q.issues.push({expected:"boolean",code:"invalid_type",input:K,inst:W}),Q}});var F6=w("$ZodNull",(W,X)=>{g.init(W,X),W._zod.pattern=V8,W._zod.values=new Set([null]),W._zod.parse=(Q,Y)=>{let K=Q.value;if(K===null)return Q;return Q.issues.push({expected:"null",code:"invalid_type",input:K,inst:W}),Q}});var O6=w("$ZodUnknown",(W,X)=>{g.init(W,X),W._zod.parse=(Q)=>Q}),V6=w("$ZodNever",(W,X)=>{g.init(W,X),W._zod.parse=(Q,Y)=>{return Q.issues.push({expected:"never",code:"invalid_type",input:Q.value,inst:W}),Q}});function h8(W,X,Q){if(W.issues.length)X.issues.push(...O0(Q,W.issues));X.value[Q]=W.value}var N6=w("$ZodArray",(W,X)=>{g.init(W,X),W._zod.parse=(Q,Y)=>{let K=Q.value;if(!Array.isArray(K))return Q.issues.push({expected:"array",code:"invalid_type",input:K,inst:W}),Q;Q.value=Array(K.length);let q=[];for(let J=0;J<K.length;J++){let G=K[J],H=X.element._zod.run({value:G,issues:[]},Y);if(H instanceof Promise)q.push(H.then((D)=>h8(D,Q,J)));else h8(H,Q,J)}if(q.length)return Promise.all(q).then(()=>Q);return Q}});function _1(W,X,Q,Y,K,q){let J=Q in Y;if(W.issues.length){if(K&&q&&!J)return;X.issues.push(...O0(Q,W.issues))}if(!J&&!K){if(!W.issues.length)X.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[Q]});return}if(W.value===void 0){if(J)X.value[Q]=void 0}else X.value[Q]=W.value}function P6(W){let X=Object.keys(W.shape);for(let Y of X)if(!W.shape?.[Y]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Y}": expected a Zod schema`);let Q=K9(W.shape);return{...W,keys:X,keySet:new Set(X),numKeys:X.length,optionalKeys:new Set(Q)}}function Z6(W,X,Q,Y,K,q){let J=[],G=K.keySet,H=K.catchall._zod,D=H.def.type,O=H.optin==="optional",V=H.optout==="optional";for(let R in X){if(R==="__proto__")continue;if(G.has(R))continue;if(D==="never"){J.push(R);continue}let P=H.run({value:X[R],issues:[]},Y);if(P instanceof Promise)W.push(P.then((b)=>_1(b,Q,R,X,O,V)));else _1(P,Q,R,X,O,V)}if(J.length)Q.issues.push({code:"unrecognized_keys",keys:J,input:X,inst:q});if(!W.length)return Q;return Promise.all(W).then(()=>{return Q})}var DX=w("$ZodObject",(W,X)=>{if(g.init(W,X),!Object.getOwnPropertyDescriptor(X,"shape")?.get){let G=X.shape;Object.defineProperty(X,"shape",{get:()=>{let H={...G};return Object.defineProperty(X,"shape",{value:H}),H}})}let Y=g0(()=>P6(X));T(W._zod,"propValues",()=>{let G=X.shape,H={};for(let D in G){let O=G[D]._zod;if(O.values){H[D]??(H[D]=new Set);for(let V of O.values)H[D].add(V)}}return H});let K=A0,q=X.catchall,J;W._zod.parse=(G,H)=>{J??(J=Y.value);let D=G.value;if(!K(D))return G.issues.push({expected:"object",code:"invalid_type",input:D,inst:W}),G;G.value={};let O=[],V=J.shape;for(let R of J.keys){let P=V[R],b=P._zod.optin==="optional",N0=P._zod.optout==="optional",M=P._zod.run({value:D[R],issues:[]},H);if(M instanceof Promise)O.push(M.then((k0)=>_1(k0,G,R,D,b,N0)));else _1(M,G,R,D,b,N0)}if(!q)return O.length?Promise.all(O).then(()=>G):G;return Z6(O,D,G,H,Y.value,W)}}),R6=w("$ZodObjectJIT",(W,X)=>{DX.init(W,X);let Q=W._zod.parse,Y=g0(()=>P6(X)),K=(R)=>{let P=new L9(["shape","payload","ctx"]),b=Y.value,N0=(Q0)=>{let x=O1(Q0);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};P.write("const input = payload.value;");let M=Object.create(null),k0=0;for(let Q0 of b.keys)M[Q0]=`key_${k0++}`;P.write("const newResult = {};");for(let Q0 of b.keys){let x=M[Q0],o=O1(Q0),u0=R[Q0],p0=u0?._zod?.optin==="optional",L1=u0?._zod?.optout==="optional";if(P.write(`const ${x} = ${N0(Q0)};`),p0&&L1)P.write(`
|
|
10
10
|
if (${x}.issues.length) {
|
|
11
11
|
if (${o} in input) {
|
|
12
12
|
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
@@ -65,13 +65,13 @@ ${Y.stack}Host: ${H}`),Object.assign(G,J),G}throw new W4(Y)}return W.value}[Symb
|
|
|
65
65
|
newResult[${o}] = ${x}.value;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
`)}P.write("payload.value = newResult;"),P.write("return payload;");let U1=P.compile();return(Y0,x)=>U1(R,Y0,x)},q,J=A0,G=!v0.jitless,D=G&&Y9.value,O=X.catchall,V;W._zod.parse=(R,P)=>{V??(V=Q.value);let b=R.value;if(!J(b))return R.issues.push({expected:"object",code:"invalid_type",input:b,inst:W}),R;if(G&&D&&P?.async===!1&&P.jitless!==!0){if(!q)q=K(X.shape);if(R=q(R,P),!O)return R;return Z6([],b,R,P,V,W)}return Y(R,P)}});function y8(W,X,Y,Q){for(let q of W)if(q.issues.length===0)return X.value=q.value,X;let K=W.filter((q)=>!E0(q));if(K.length===1)return X.value=K[0].value,K[0];return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:W.map((q)=>q.issues.map((J)=>J0(J,Q,K0())))}),X}var M9=w("$ZodUnion",(W,X)=>{g.init(W,X),T(W._zod,"optin",()=>X.options.some((Q)=>Q._zod.optin==="optional")?"optional":void 0),T(W._zod,"optout",()=>X.options.some((Q)=>Q._zod.optout==="optional")?"optional":void 0),T(W._zod,"values",()=>{if(X.options.every((Q)=>Q._zod.values))return new Set(X.options.flatMap((Q)=>Array.from(Q._zod.values)));return}),T(W._zod,"pattern",()=>{if(X.options.every((Q)=>Q._zod.pattern)){let Q=X.options.map((K)=>K._zod.pattern);return new RegExp(`^(${Q.map((K)=>r0(K.source)).join("|")})$`)}return});let Y=X.options.length===1?X.options[0]._zod.run:null;W._zod.parse=(Q,K)=>{if(Y)return Y(Q,K);let q=!1,J=[];for(let G of X.options){let H=G._zod.run({value:Q.value,issues:[]},K);if(H instanceof Promise)J.push(H),q=!0;else{if(H.issues.length===0)return H;J.push(H)}}if(!q)return y8(J,Q,W,K);return Promise.all(J).then((G)=>{return y8(G,Q,W,K)})}});var E6=w("$ZodDiscriminatedUnion",(W,X)=>{X.inclusive=!1,M9.init(W,X);let Y=W._zod.parse;T(W._zod,"propValues",()=>{let K={};for(let q of X.options){let J=q._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(q)}"`);for(let[G,H]of Object.entries(J)){if(!K[G])K[G]=new Set;for(let D of H)K[G].add(D)}}return K});let Q=g0(()=>{let K=X.options,q=new Map;for(let J of K){let G=J._zod.propValues?.[X.discriminator];if(!G||G.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let H of G){if(q.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);q.set(H,J)}}return q});W._zod.parse=(K,q)=>{let J=K.value;if(!A0(J))return K.issues.push({code:"invalid_type",expected:"object",input:J,inst:W}),K;let G=Q.value.get(J?.[X.discriminator]);if(G)return G._zod.run(K,q);if(X.unionFallback||q.direction==="backward")return Y(K,q);return K.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,options:Array.from(Q.value.keys()),input:J,path:[X.discriminator],inst:W}),K}}),I6=w("$ZodIntersection",(W,X)=>{g.init(W,X),W._zod.parse=(Y,Q)=>{let K=Y.value,q=X.left._zod.run({value:K,issues:[]},Q),J=X.right._zod.run({value:K,issues:[]},Q);if(q instanceof Promise||J instanceof Promise)return Promise.all([q,J]).then(([H,D])=>{return f8(Y,H,D)});return f8(Y,q,J)}});function D9(W,X){if(W===X)return{valid:!0,data:W};if(W instanceof Date&&X instanceof Date&&+W===+X)return{valid:!0,data:W};if(R0(W)&&R0(X)){let Y=Object.keys(X),Q=Object.keys(W).filter((q)=>Y.indexOf(q)!==-1),K={...W,...X};for(let q of Q){let J=D9(W[q],X[q]);if(!J.valid)return{valid:!1,mergeErrorPath:[q,...J.mergeErrorPath]};K[q]=J.data}return{valid:!0,data:K}}if(Array.isArray(W)&&Array.isArray(X)){if(W.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let Q=0;Q<W.length;Q++){let K=W[Q],q=X[Q],J=D9(K,q);if(!J.valid)return{valid:!1,mergeErrorPath:[Q,...J.mergeErrorPath]};Y.push(J.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function f8(W,X,Y){let Q=new Map,K;for(let G of X.issues)if(G.code==="unrecognized_keys"){K??(K=G);for(let H of G.keys){if(!Q.has(H))Q.set(H,{});Q.get(H).l=!0}}else W.issues.push(G);for(let G of Y.issues)if(G.code==="unrecognized_keys")for(let H of G.keys){if(!Q.has(H))Q.set(H,{});Q.get(H).r=!0}else W.issues.push(G);let q=[...Q].filter(([,G])=>G.l&&G.r).map(([G])=>G);if(q.length&&K)W.issues.push({...K,keys:q});if(E0(W))return W;let J=D9(X.value,Y.value);if(!J.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(J.mergeErrorPath)}`);return W.value=J.data,W}var C6=w("$ZodRecord",(W,X)=>{g.init(W,X),W._zod.parse=(Y,Q)=>{let K=Y.value;if(!R0(K))return Y.issues.push({expected:"record",code:"invalid_type",input:K,inst:W}),Y;let q=[],J=X.keyType._zod.values;if(J){Y.value={};let G=new Set;for(let D of J)if(typeof D==="string"||typeof D==="number"||typeof D==="symbol"){G.add(typeof D==="number"?D.toString():D);let O=X.keyType._zod.run({value:D,issues:[]},Q);if(O instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(O.issues.length){Y.issues.push({code:"invalid_key",origin:"record",issues:O.issues.map((P)=>J0(P,Q,K0())),input:D,path:[D],inst:W});continue}let V=O.value,R=X.valueType._zod.run({value:K[D],issues:[]},Q);if(R instanceof Promise)q.push(R.then((P)=>{if(P.issues.length)Y.issues.push(...O0(D,P.issues));Y.value[V]=P.value}));else{if(R.issues.length)Y.issues.push(...O0(D,R.issues));Y.value[V]=R.value}}let H;for(let D in K)if(!G.has(D))H=H??[],H.push(D);if(H&&H.length>0)Y.issues.push({code:"unrecognized_keys",input:K,inst:W,keys:H})}else{Y.value={};for(let G of Reflect.ownKeys(K)){if(G==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(K,G))continue;let H=X.keyType._zod.run({value:G,issues:[]},Q);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof G==="string"&&E1.test(G)&&H.issues.length){let V=X.keyType._zod.run({value:Number(G),issues:[]},Q);if(V instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(V.issues.length===0)H=V}if(H.issues.length){if(X.mode==="loose")Y.value[G]=K[G];else Y.issues.push({code:"invalid_key",origin:"record",issues:H.issues.map((V)=>J0(V,Q,K0())),input:G,path:[G],inst:W});continue}let O=X.valueType._zod.run({value:K[G],issues:[]},Q);if(O instanceof Promise)q.push(O.then((V)=>{if(V.issues.length)Y.issues.push(...O0(G,V.issues));Y.value[H.value]=V.value}));else{if(O.issues.length)Y.issues.push(...O0(G,O.issues));Y.value[H.value]=O.value}}}if(q.length)return Promise.all(q).then(()=>Y);return Y}});var _6=w("$ZodEnum",(W,X)=>{g.init(W,X);let Y=o0(X.entries),Q=new Set(Y);W._zod.values=Q,W._zod.pattern=new RegExp(`^(${Y.filter((K)=>Q9.has(typeof K)).map((K)=>typeof K==="string"?F0(K):K.toString()).join("|")})$`),W._zod.parse=(K,q)=>{let J=K.value;if(Q.has(J))return K;return K.issues.push({code:"invalid_value",values:Y,input:J,inst:W}),K}}),A6=w("$ZodLiteral",(W,X)=>{if(g.init(W,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");let Y=new Set(X.values);W._zod.values=Y,W._zod.pattern=new RegExp(`^(${X.values.map((Q)=>typeof Q==="string"?F0(Q):Q?F0(Q.toString()):String(Q)).join("|")})$`),W._zod.parse=(Q,K)=>{let q=Q.value;if(Y.has(q))return Q;return Q.issues.push({code:"invalid_value",values:X.values,input:q,inst:W}),Q}});var j6=w("$ZodTransform",(W,X)=>{g.init(W,X),W._zod.optin="optional",W._zod.parse=(Y,Q)=>{if(Q.direction==="backward")throw new l0(W.constructor.name);let K=X.transform(Y.value,Y);if(Q.async)return(K instanceof Promise?K:Promise.resolve(K)).then((J)=>{return Y.value=J,Y.fallback=!0,Y});if(K instanceof Promise)throw new w0;return Y.value=K,Y.fallback=!0,Y}});function c8(W,X){if(X===void 0&&(W.issues.length||W.fallback))return{issues:[],value:void 0};return W}var F9=w("$ZodOptional",(W,X)=>{g.init(W,X),W._zod.optin="optional",W._zod.optout="optional",T(W._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),T(W._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${r0(Y.source)})?$`):void 0}),W._zod.parse=(Y,Q)=>{if(X.innerType._zod.optin==="optional"){let K=Y.value,q=X.innerType._zod.run(Y,Q);if(q instanceof Promise)return q.then((J)=>c8(J,K));return c8(q,K)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,Q)}}),S6=w("$ZodExactOptional",(W,X)=>{F9.init(W,X),T(W._zod,"values",()=>X.innerType._zod.values),T(W._zod,"pattern",()=>X.innerType._zod.pattern),W._zod.parse=(Y,Q)=>{return X.innerType._zod.run(Y,Q)}}),b6=w("$ZodNullable",(W,X)=>{g.init(W,X),T(W._zod,"optin",()=>X.innerType._zod.optin),T(W._zod,"optout",()=>X.innerType._zod.optout),T(W._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${r0(Y.source)}|null)$`):void 0}),T(W._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),W._zod.parse=(Y,Q)=>{if(Y.value===null)return Y;return X.innerType._zod.run(Y,Q)}}),T6=w("$ZodDefault",(W,X)=>{g.init(W,X),W._zod.optin="optional",T(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Y,Q)=>{if(Q.direction==="backward")return X.innerType._zod.run(Y,Q);if(Y.value===void 0)return Y.value=X.defaultValue,Y;let K=X.innerType._zod.run(Y,Q);if(K instanceof Promise)return K.then((q)=>m8(q,X));return m8(K,X)}});function m8(W,X){if(W.value===void 0)W.value=X.defaultValue;return W}var k6=w("$ZodPrefault",(W,X)=>{g.init(W,X),W._zod.optin="optional",T(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Y,Q)=>{if(Q.direction==="backward")return X.innerType._zod.run(Y,Q);if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,Q)}}),v6=w("$ZodNonOptional",(W,X)=>{g.init(W,X),T(W._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((Q)=>Q!==void 0)):void 0}),W._zod.parse=(Y,Q)=>{let K=X.innerType._zod.run(Y,Q);if(K instanceof Promise)return K.then((q)=>u8(q,W));return u8(K,W)}});function u8(W,X){if(!W.issues.length&&W.value===void 0)W.issues.push({code:"invalid_type",expected:"nonoptional",input:W.value,inst:X});return W}var x6=w("$ZodCatch",(W,X)=>{g.init(W,X),W._zod.optin="optional",T(W._zod,"optout",()=>X.innerType._zod.optout),T(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Y,Q)=>{if(Q.direction==="backward")return X.innerType._zod.run(Y,Q);let K=X.innerType._zod.run(Y,Q);if(K instanceof Promise)return K.then((q)=>{if(Y.value=q.value,q.issues.length)Y.value=X.catchValue({...Y,error:{issues:q.issues.map((J)=>J0(J,Q,K0()))},input:Y.value}),Y.issues=[],Y.fallback=!0;return Y});if(Y.value=K.value,K.issues.length)Y.value=X.catchValue({...Y,error:{issues:K.issues.map((q)=>J0(q,Q,K0()))},input:Y.value}),Y.issues=[],Y.fallback=!0;return Y}});var O9=w("$ZodPipe",(W,X)=>{g.init(W,X),T(W._zod,"values",()=>X.in._zod.values),T(W._zod,"optin",()=>X.in._zod.optin),T(W._zod,"optout",()=>X.out._zod.optout),T(W._zod,"propValues",()=>X.in._zod.propValues),W._zod.parse=(Y,Q)=>{if(Q.direction==="backward"){let q=X.out._zod.run(Y,Q);if(q instanceof Promise)return q.then((J)=>C1(J,X.in,Q));return C1(q,X.in,Q)}let K=X.in._zod.run(Y,Q);if(K instanceof Promise)return K.then((q)=>C1(q,X.out,Q));return C1(K,X.out,Q)}});function C1(W,X,Y){if(W.issues.length)return W.aborted=!0,W;return X._zod.run({value:W.value,issues:W.issues,fallback:W.fallback},Y)}var g6=w("$ZodPreprocess",(W,X)=>{O9.init(W,X)}),h6=w("$ZodReadonly",(W,X)=>{g.init(W,X),T(W._zod,"propValues",()=>X.innerType._zod.propValues),T(W._zod,"values",()=>X.innerType._zod.values),T(W._zod,"optin",()=>X.innerType?._zod?.optin),T(W._zod,"optout",()=>X.innerType?._zod?.optout),W._zod.parse=(Y,Q)=>{if(Q.direction==="backward")return X.innerType._zod.run(Y,Q);let K=X.innerType._zod.run(Y,Q);if(K instanceof Promise)return K.then(p8);return p8(K)}});function p8(W){return W.value=Object.freeze(W.value),W}var y6=w("$ZodCustom",(W,X)=>{t.init(W,X),g.init(W,X),W._zod.parse=(Y,Q)=>{return Y},W._zod.check=(Y)=>{let Q=Y.value,K=X.fn(Q);if(K instanceof Promise)return K.then((q)=>l8(q,Y,Q,W));l8(K,Y,Q,W);return}});function l8(W,X,Y,Q){if(!W){let K={code:"custom",input:Y,inst:Q,path:[...Q._zod.def.path??[]],continue:!Q._zod.def.abort};if(Q._zod.def.params)K.params=Q._zod.def.params;X.issues.push(h0(K))}}var wX=()=>{let W={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function X(K){return W[K]??null}let Y={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},Q={nan:"NaN"};return(K)=>{switch(K.code){case"invalid_type":{let q=Q[K.expected]??K.expected,J=J9(K.input),G=Q[J]??J;return`Invalid input: expected ${q}, received ${G}`}case"invalid_value":if(K.values.length===1)return`Invalid input: expected ${N1(K.values[0])}`;return`Invalid option: expected one of ${F1(K.values,"|")}`;case"too_big":{let q=K.inclusive?"<=":"<",J=X(K.origin);if(J)return`Too big: expected ${K.origin??"value"} to have ${q}${K.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${K.origin??"value"} to be ${q}${K.maximum.toString()}`}case"too_small":{let q=K.inclusive?">=":">",J=X(K.origin);if(J)return`Too small: expected ${K.origin} to have ${q}${K.minimum.toString()} ${J.unit}`;return`Too small: expected ${K.origin} to be ${q}${K.minimum.toString()}`}case"invalid_format":{let q=K;if(q.format==="starts_with")return`Invalid string: must start with "${q.prefix}"`;if(q.format==="ends_with")return`Invalid string: must end with "${q.suffix}"`;if(q.format==="includes")return`Invalid string: must include "${q.includes}"`;if(q.format==="regex")return`Invalid string: must match pattern ${q.pattern}`;return`Invalid ${Y[q.format]??K.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${K.divisor}`;case"unrecognized_keys":return`Unrecognized key${K.keys.length>1?"s":""}: ${F1(K.keys,", ")}`;case"invalid_key":return`Invalid key in ${K.origin}`;case"invalid_union":if(K.options&&Array.isArray(K.options)&&K.options.length>0)return`Invalid discriminator value. Expected ${K.options.map((J)=>`'${J}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${K.origin}`;default:return"Invalid input"}}};function V9(){return{localeError:wX()}}var f6,z5=Symbol("ZodOutput"),B5=Symbol("ZodInput");class c6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(W,...X){let Y=X[0];if(this._map.set(W,Y),Y&&typeof Y==="object"&&"id"in Y)this._idmap.set(Y.id,W);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(W){let X=this._map.get(W);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(W),this}get(W){let X=W._zod.parent;if(X){let Y={...this.get(X)??{}};delete Y.id;let Q={...Y,...this._map.get(W)};return Object.keys(Q).length?Q:void 0}return this._map.get(W)}has(W){return this._map.has(W)}}function MX(){return new c6}(f6=globalThis).__zod_globalRegistry??(f6.__zod_globalRegistry=MX());var j0=globalThis.__zod_globalRegistry;function m6(W,X){return new W({type:"string",...I(X)})}function u6(W,X){return new W({type:"string",format:"email",check:"string_format",abort:!1,...I(X)})}function N9(W,X){return new W({type:"string",format:"guid",check:"string_format",abort:!1,...I(X)})}function p6(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,...I(X)})}function l6(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(X)})}function d6(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(X)})}function o6(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(X)})}function i6(W,X){return new W({type:"string",format:"url",check:"string_format",abort:!1,...I(X)})}function r6(W,X){return new W({type:"string",format:"emoji",check:"string_format",abort:!1,...I(X)})}function n6(W,X){return new W({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(X)})}function t6(W,X){return new W({type:"string",format:"cuid",check:"string_format",abort:!1,...I(X)})}function a6(W,X){return new W({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(X)})}function s6(W,X){return new W({type:"string",format:"ulid",check:"string_format",abort:!1,...I(X)})}function e6(W,X){return new W({type:"string",format:"xid",check:"string_format",abort:!1,...I(X)})}function W2(W,X){return new W({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(X)})}function X2(W,X){return new W({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(X)})}function Y2(W,X){return new W({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(X)})}function Q2(W,X){return new W({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(X)})}function K2(W,X){return new W({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(X)})}function G2(W,X){return new W({type:"string",format:"base64",check:"string_format",abort:!1,...I(X)})}function q2(W,X){return new W({type:"string",format:"base64url",check:"string_format",abort:!1,...I(X)})}function J2(W,X){return new W({type:"string",format:"e164",check:"string_format",abort:!1,...I(X)})}function z2(W,X){return new W({type:"string",format:"jwt",check:"string_format",abort:!1,...I(X)})}function B2(W,X){return new W({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(X)})}function $2(W,X){return new W({type:"string",format:"date",check:"string_format",...I(X)})}function H2(W,X){return new W({type:"string",format:"time",check:"string_format",precision:null,...I(X)})}function U2(W,X){return new W({type:"string",format:"duration",check:"string_format",...I(X)})}function L2(W,X){return new W({type:"number",checks:[],...I(X)})}function D2(W,X){return new W({type:"number",check:"number_format",abort:!1,format:"safeint",...I(X)})}function w2(W,X){return new W({type:"boolean",...I(X)})}function M2(W,X){return new W({type:"null",...I(X)})}function F2(W){return new W({type:"unknown"})}function O2(W,X){return new W({type:"never",...I(X)})}function j1(W,X){return new H9({check:"less_than",...I(X),value:W,inclusive:!1})}function e0(W,X){return new H9({check:"less_than",...I(X),value:W,inclusive:!0})}function S1(W,X){return new U9({check:"greater_than",...I(X),value:W,inclusive:!1})}function W1(W,X){return new U9({check:"greater_than",...I(X),value:W,inclusive:!0})}function b1(W,X){return new R8({check:"multiple_of",...I(X),value:W})}function T1(W,X){return new I8({check:"max_length",...I(X),maximum:W})}function y0(W,X){return new C8({check:"min_length",...I(X),minimum:W})}function k1(W,X){return new _8({check:"length_equals",...I(X),length:W})}function P9(W,X){return new A8({check:"string_format",format:"regex",...I(X),pattern:W})}function Z9(W){return new j8({check:"string_format",format:"lowercase",...I(W)})}function R9(W){return new S8({check:"string_format",format:"uppercase",...I(W)})}function E9(W,X){return new b8({check:"string_format",format:"includes",...I(X),includes:W})}function I9(W,X){return new T8({check:"string_format",format:"starts_with",...I(X),prefix:W})}function C9(W,X){return new k8({check:"string_format",format:"ends_with",...I(X),suffix:W})}function I0(W){return new v8({check:"overwrite",tx:W})}function _9(W){return I0((X)=>X.normalize(W))}function A9(){return I0((W)=>W.trim())}function j9(){return I0((W)=>W.toLowerCase())}function S9(){return I0((W)=>W.toUpperCase())}function b9(){return I0((W)=>X9(W))}function V2(W,X,Y){return new W({type:"array",element:X,...I(Y)})}function N2(W,X,Y){let Q=I(Y);return Q.abort??(Q.abort=!0),new W({type:"custom",check:"custom",fn:X,...Q})}function P2(W,X,Y){return new W({type:"custom",check:"custom",fn:X,...I(Y)})}function Z2(W,X){let Y=FX((Q)=>{return Q.addIssue=(K)=>{if(typeof K==="string")Q.issues.push(h0(K,Q.value,Y._zod.def));else{let q=K;if(q.fatal)q.continue=!1;q.code??(q.code="custom"),q.input??(q.input=Q.value),q.inst??(q.inst=Y),q.continue??(q.continue=!Y._zod.def.abort),Q.issues.push(h0(q))}},W(Q.value,Q)},X);return Y}function FX(W,X){let Y=new t({check:"custom",...I(X)});return Y._zod.check=W,Y}function T9(W){let X=W?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:W.processors??{},metadataRegistry:W?.metadata??j0,target:X,unrepresentable:W?.unrepresentable??"throw",override:W?.override??(()=>{}),io:W?.io??"output",counter:0,seen:new Map,cycles:W?.cycles??"ref",reused:W?.reused??"inline",external:W?.external??void 0}}function d(W,X,Y={path:[],schemaPath:[]}){var Q;let K=W._zod.def,q=X.seen.get(W);if(q){if(q.count++,Y.schemaPath.includes(W))q.cycle=Y.path;return q.schema}let J={schema:{},count:1,cycle:void 0,path:Y.path};X.seen.set(W,J);let G=W._zod.toJSONSchema?.();if(G)J.schema=G;else{let O={...Y,schemaPath:[...Y.schemaPath,W],path:Y.path};if(W._zod.processJSONSchema)W._zod.processJSONSchema(X,J.schema,O);else{let R=J.schema,P=X.processors[K.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${K.type}`);P(W,X,R,O)}let V=W._zod.parent;if(V){if(!J.ref)J.ref=V;d(V,X,O),X.seen.get(V).isParent=!0}}let H=X.metadataRegistry.get(W);if(H)Object.assign(J.schema,H);if(X.io==="input"&&e(W))delete J.schema.examples,delete J.schema.default;if(X.io==="input"&&"_prefault"in J.schema)(Q=J.schema).default??(Q.default=J.schema._prefault);return delete J.schema._prefault,X.seen.get(W).schema}function k9(W,X){let Y=W.seen.get(X);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let Q=new Map;for(let J of W.seen.entries()){let G=W.metadataRegistry.get(J[0])?.id;if(G){let H=Q.get(G);if(H&&H!==J[0])throw Error(`Duplicate schema id "${G}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);Q.set(G,J[0])}}let K=(J)=>{let G=W.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let V=W.external.registry.get(J[0])?.id,R=W.external.uri??((b)=>b);if(V)return{ref:R(V)};let P=J[1].defId??J[1].schema.id??`schema${W.counter++}`;return J[1].defId=P,{defId:P,ref:`${R("__shared")}#/${G}/${P}`}}if(J[1]===Y)return{ref:"#"};let D=`${"#"}/${G}/`,O=J[1].schema.id??`__schema${W.counter++}`;return{defId:O,ref:D+O}},q=(J)=>{if(J[1].schema.$ref)return;let G=J[1],{ref:H,defId:D}=K(J);if(G.def={...G.schema},D)G.defId=D;let O=G.schema;for(let V in O)delete O[V];O.$ref=H};if(W.cycles==="throw")for(let J of W.seen.entries()){let G=J[1];if(G.cycle)throw Error(`Cycle detected: #/${G.cycle?.join("/")}/<root>
|
|
68
|
+
`)}P.write("payload.value = newResult;"),P.write("return payload;");let U1=P.compile();return(Q0,x)=>U1(R,Q0,x)},q,J=A0,G=!v0.jitless,D=G&&Q9.value,O=X.catchall,V;W._zod.parse=(R,P)=>{V??(V=Y.value);let b=R.value;if(!J(b))return R.issues.push({expected:"object",code:"invalid_type",input:b,inst:W}),R;if(G&&D&&P?.async===!1&&P.jitless!==!0){if(!q)q=K(X.shape);if(R=q(R,P),!O)return R;return Z6([],b,R,P,V,W)}return Q(R,P)}});function y8(W,X,Q,Y){for(let q of W)if(q.issues.length===0)return X.value=q.value,X;let K=W.filter((q)=>!E0(q));if(K.length===1)return X.value=K[0].value,K[0];return X.issues.push({code:"invalid_union",input:X.value,inst:Q,errors:W.map((q)=>q.issues.map((J)=>J0(J,Y,K0())))}),X}var M9=w("$ZodUnion",(W,X)=>{g.init(W,X),T(W._zod,"optin",()=>X.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),T(W._zod,"optout",()=>X.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),T(W._zod,"values",()=>{if(X.options.every((Y)=>Y._zod.values))return new Set(X.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),T(W._zod,"pattern",()=>{if(X.options.every((Y)=>Y._zod.pattern)){let Y=X.options.map((K)=>K._zod.pattern);return new RegExp(`^(${Y.map((K)=>r0(K.source)).join("|")})$`)}return});let Q=X.options.length===1?X.options[0]._zod.run:null;W._zod.parse=(Y,K)=>{if(Q)return Q(Y,K);let q=!1,J=[];for(let G of X.options){let H=G._zod.run({value:Y.value,issues:[]},K);if(H instanceof Promise)J.push(H),q=!0;else{if(H.issues.length===0)return H;J.push(H)}}if(!q)return y8(J,Y,W,K);return Promise.all(J).then((G)=>{return y8(G,Y,W,K)})}});var E6=w("$ZodDiscriminatedUnion",(W,X)=>{X.inclusive=!1,M9.init(W,X);let Q=W._zod.parse;T(W._zod,"propValues",()=>{let K={};for(let q of X.options){let J=q._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(q)}"`);for(let[G,H]of Object.entries(J)){if(!K[G])K[G]=new Set;for(let D of H)K[G].add(D)}}return K});let Y=g0(()=>{let K=X.options,q=new Map;for(let J of K){let G=J._zod.propValues?.[X.discriminator];if(!G||G.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let H of G){if(q.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);q.set(H,J)}}return q});W._zod.parse=(K,q)=>{let J=K.value;if(!A0(J))return K.issues.push({code:"invalid_type",expected:"object",input:J,inst:W}),K;let G=Y.value.get(J?.[X.discriminator]);if(G)return G._zod.run(K,q);if(X.unionFallback||q.direction==="backward")return Q(K,q);return K.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,options:Array.from(Y.value.keys()),input:J,path:[X.discriminator],inst:W}),K}}),I6=w("$ZodIntersection",(W,X)=>{g.init(W,X),W._zod.parse=(Q,Y)=>{let K=Q.value,q=X.left._zod.run({value:K,issues:[]},Y),J=X.right._zod.run({value:K,issues:[]},Y);if(q instanceof Promise||J instanceof Promise)return Promise.all([q,J]).then(([H,D])=>{return f8(Q,H,D)});return f8(Q,q,J)}});function D9(W,X){if(W===X)return{valid:!0,data:W};if(W instanceof Date&&X instanceof Date&&+W===+X)return{valid:!0,data:W};if(R0(W)&&R0(X)){let Q=Object.keys(X),Y=Object.keys(W).filter((q)=>Q.indexOf(q)!==-1),K={...W,...X};for(let q of Y){let J=D9(W[q],X[q]);if(!J.valid)return{valid:!1,mergeErrorPath:[q,...J.mergeErrorPath]};K[q]=J.data}return{valid:!0,data:K}}if(Array.isArray(W)&&Array.isArray(X)){if(W.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Q=[];for(let Y=0;Y<W.length;Y++){let K=W[Y],q=X[Y],J=D9(K,q);if(!J.valid)return{valid:!1,mergeErrorPath:[Y,...J.mergeErrorPath]};Q.push(J.data)}return{valid:!0,data:Q}}return{valid:!1,mergeErrorPath:[]}}function f8(W,X,Q){let Y=new Map,K;for(let G of X.issues)if(G.code==="unrecognized_keys"){K??(K=G);for(let H of G.keys){if(!Y.has(H))Y.set(H,{});Y.get(H).l=!0}}else W.issues.push(G);for(let G of Q.issues)if(G.code==="unrecognized_keys")for(let H of G.keys){if(!Y.has(H))Y.set(H,{});Y.get(H).r=!0}else W.issues.push(G);let q=[...Y].filter(([,G])=>G.l&&G.r).map(([G])=>G);if(q.length&&K)W.issues.push({...K,keys:q});if(E0(W))return W;let J=D9(X.value,Q.value);if(!J.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(J.mergeErrorPath)}`);return W.value=J.data,W}var C6=w("$ZodRecord",(W,X)=>{g.init(W,X),W._zod.parse=(Q,Y)=>{let K=Q.value;if(!R0(K))return Q.issues.push({expected:"record",code:"invalid_type",input:K,inst:W}),Q;let q=[],J=X.keyType._zod.values;if(J){Q.value={};let G=new Set;for(let D of J)if(typeof D==="string"||typeof D==="number"||typeof D==="symbol"){G.add(typeof D==="number"?D.toString():D);let O=X.keyType._zod.run({value:D,issues:[]},Y);if(O instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(O.issues.length){Q.issues.push({code:"invalid_key",origin:"record",issues:O.issues.map((P)=>J0(P,Y,K0())),input:D,path:[D],inst:W});continue}let V=O.value,R=X.valueType._zod.run({value:K[D],issues:[]},Y);if(R instanceof Promise)q.push(R.then((P)=>{if(P.issues.length)Q.issues.push(...O0(D,P.issues));Q.value[V]=P.value}));else{if(R.issues.length)Q.issues.push(...O0(D,R.issues));Q.value[V]=R.value}}let H;for(let D in K)if(!G.has(D))H=H??[],H.push(D);if(H&&H.length>0)Q.issues.push({code:"unrecognized_keys",input:K,inst:W,keys:H})}else{Q.value={};for(let G of Reflect.ownKeys(K)){if(G==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(K,G))continue;let H=X.keyType._zod.run({value:G,issues:[]},Y);if(H instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof G==="string"&&E1.test(G)&&H.issues.length){let V=X.keyType._zod.run({value:Number(G),issues:[]},Y);if(V instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(V.issues.length===0)H=V}if(H.issues.length){if(X.mode==="loose")Q.value[G]=K[G];else Q.issues.push({code:"invalid_key",origin:"record",issues:H.issues.map((V)=>J0(V,Y,K0())),input:G,path:[G],inst:W});continue}let O=X.valueType._zod.run({value:K[G],issues:[]},Y);if(O instanceof Promise)q.push(O.then((V)=>{if(V.issues.length)Q.issues.push(...O0(G,V.issues));Q.value[H.value]=V.value}));else{if(O.issues.length)Q.issues.push(...O0(G,O.issues));Q.value[H.value]=O.value}}}if(q.length)return Promise.all(q).then(()=>Q);return Q}});var _6=w("$ZodEnum",(W,X)=>{g.init(W,X);let Q=o0(X.entries),Y=new Set(Q);W._zod.values=Y,W._zod.pattern=new RegExp(`^(${Q.filter((K)=>Y9.has(typeof K)).map((K)=>typeof K==="string"?F0(K):K.toString()).join("|")})$`),W._zod.parse=(K,q)=>{let J=K.value;if(Y.has(J))return K;return K.issues.push({code:"invalid_value",values:Q,input:J,inst:W}),K}}),A6=w("$ZodLiteral",(W,X)=>{if(g.init(W,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");let Q=new Set(X.values);W._zod.values=Q,W._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?F0(Y):Y?F0(Y.toString()):String(Y)).join("|")})$`),W._zod.parse=(Y,K)=>{let q=Y.value;if(Q.has(q))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:q,inst:W}),Y}});var j6=w("$ZodTransform",(W,X)=>{g.init(W,X),W._zod.optin="optional",W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")throw new l0(W.constructor.name);let K=X.transform(Q.value,Q);if(Y.async)return(K instanceof Promise?K:Promise.resolve(K)).then((J)=>{return Q.value=J,Q.fallback=!0,Q});if(K instanceof Promise)throw new w0;return Q.value=K,Q.fallback=!0,Q}});function c8(W,X){if(X===void 0&&(W.issues.length||W.fallback))return{issues:[],value:void 0};return W}var F9=w("$ZodOptional",(W,X)=>{g.init(W,X),W._zod.optin="optional",W._zod.optout="optional",T(W._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),T(W._zod,"pattern",()=>{let Q=X.innerType._zod.pattern;return Q?new RegExp(`^(${r0(Q.source)})?$`):void 0}),W._zod.parse=(Q,Y)=>{if(X.innerType._zod.optin==="optional"){let K=Q.value,q=X.innerType._zod.run(Q,Y);if(q instanceof Promise)return q.then((J)=>c8(J,K));return c8(q,K)}if(Q.value===void 0)return Q;return X.innerType._zod.run(Q,Y)}}),S6=w("$ZodExactOptional",(W,X)=>{F9.init(W,X),T(W._zod,"values",()=>X.innerType._zod.values),T(W._zod,"pattern",()=>X.innerType._zod.pattern),W._zod.parse=(Q,Y)=>{return X.innerType._zod.run(Q,Y)}}),b6=w("$ZodNullable",(W,X)=>{g.init(W,X),T(W._zod,"optin",()=>X.innerType._zod.optin),T(W._zod,"optout",()=>X.innerType._zod.optout),T(W._zod,"pattern",()=>{let Q=X.innerType._zod.pattern;return Q?new RegExp(`^(${r0(Q.source)}|null)$`):void 0}),T(W._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),W._zod.parse=(Q,Y)=>{if(Q.value===null)return Q;return X.innerType._zod.run(Q,Y)}}),T6=w("$ZodDefault",(W,X)=>{g.init(W,X),W._zod.optin="optional",T(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(Q,Y);if(Q.value===void 0)return Q.value=X.defaultValue,Q;let K=X.innerType._zod.run(Q,Y);if(K instanceof Promise)return K.then((q)=>m8(q,X));return m8(K,X)}});function m8(W,X){if(W.value===void 0)W.value=X.defaultValue;return W}var k6=w("$ZodPrefault",(W,X)=>{g.init(W,X),W._zod.optin="optional",T(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(Q,Y);if(Q.value===void 0)Q.value=X.defaultValue;return X.innerType._zod.run(Q,Y)}}),v6=w("$ZodNonOptional",(W,X)=>{g.init(W,X),T(W._zod,"values",()=>{let Q=X.innerType._zod.values;return Q?new Set([...Q].filter((Y)=>Y!==void 0)):void 0}),W._zod.parse=(Q,Y)=>{let K=X.innerType._zod.run(Q,Y);if(K instanceof Promise)return K.then((q)=>u8(q,W));return u8(K,W)}});function u8(W,X){if(!W.issues.length&&W.value===void 0)W.issues.push({code:"invalid_type",expected:"nonoptional",input:W.value,inst:X});return W}var x6=w("$ZodCatch",(W,X)=>{g.init(W,X),W._zod.optin="optional",T(W._zod,"optout",()=>X.innerType._zod.optout),T(W._zod,"values",()=>X.innerType._zod.values),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(Q,Y);let K=X.innerType._zod.run(Q,Y);if(K instanceof Promise)return K.then((q)=>{if(Q.value=q.value,q.issues.length)Q.value=X.catchValue({...Q,error:{issues:q.issues.map((J)=>J0(J,Y,K0()))},input:Q.value}),Q.issues=[],Q.fallback=!0;return Q});if(Q.value=K.value,K.issues.length)Q.value=X.catchValue({...Q,error:{issues:K.issues.map((q)=>J0(q,Y,K0()))},input:Q.value}),Q.issues=[],Q.fallback=!0;return Q}});var O9=w("$ZodPipe",(W,X)=>{g.init(W,X),T(W._zod,"values",()=>X.in._zod.values),T(W._zod,"optin",()=>X.in._zod.optin),T(W._zod,"optout",()=>X.out._zod.optout),T(W._zod,"propValues",()=>X.in._zod.propValues),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward"){let q=X.out._zod.run(Q,Y);if(q instanceof Promise)return q.then((J)=>C1(J,X.in,Y));return C1(q,X.in,Y)}let K=X.in._zod.run(Q,Y);if(K instanceof Promise)return K.then((q)=>C1(q,X.out,Y));return C1(K,X.out,Y)}});function C1(W,X,Q){if(W.issues.length)return W.aborted=!0,W;return X._zod.run({value:W.value,issues:W.issues,fallback:W.fallback},Q)}var g6=w("$ZodPreprocess",(W,X)=>{O9.init(W,X)}),h6=w("$ZodReadonly",(W,X)=>{g.init(W,X),T(W._zod,"propValues",()=>X.innerType._zod.propValues),T(W._zod,"values",()=>X.innerType._zod.values),T(W._zod,"optin",()=>X.innerType?._zod?.optin),T(W._zod,"optout",()=>X.innerType?._zod?.optout),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")return X.innerType._zod.run(Q,Y);let K=X.innerType._zod.run(Q,Y);if(K instanceof Promise)return K.then(p8);return p8(K)}});function p8(W){return W.value=Object.freeze(W.value),W}var y6=w("$ZodCustom",(W,X)=>{t.init(W,X),g.init(W,X),W._zod.parse=(Q,Y)=>{return Q},W._zod.check=(Q)=>{let Y=Q.value,K=X.fn(Y);if(K instanceof Promise)return K.then((q)=>l8(q,Q,Y,W));l8(K,Q,Y,W);return}});function l8(W,X,Q,Y){if(!W){let K={code:"custom",input:Q,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)K.params=Y._zod.def.params;X.issues.push(h0(K))}}var wX=()=>{let W={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function X(K){return W[K]??null}let Q={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},Y={nan:"NaN"};return(K)=>{switch(K.code){case"invalid_type":{let q=Y[K.expected]??K.expected,J=J9(K.input),G=Y[J]??J;return`Invalid input: expected ${q}, received ${G}`}case"invalid_value":if(K.values.length===1)return`Invalid input: expected ${N1(K.values[0])}`;return`Invalid option: expected one of ${F1(K.values,"|")}`;case"too_big":{let q=K.inclusive?"<=":"<",J=X(K.origin);if(J)return`Too big: expected ${K.origin??"value"} to have ${q}${K.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${K.origin??"value"} to be ${q}${K.maximum.toString()}`}case"too_small":{let q=K.inclusive?">=":">",J=X(K.origin);if(J)return`Too small: expected ${K.origin} to have ${q}${K.minimum.toString()} ${J.unit}`;return`Too small: expected ${K.origin} to be ${q}${K.minimum.toString()}`}case"invalid_format":{let q=K;if(q.format==="starts_with")return`Invalid string: must start with "${q.prefix}"`;if(q.format==="ends_with")return`Invalid string: must end with "${q.suffix}"`;if(q.format==="includes")return`Invalid string: must include "${q.includes}"`;if(q.format==="regex")return`Invalid string: must match pattern ${q.pattern}`;return`Invalid ${Q[q.format]??K.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${K.divisor}`;case"unrecognized_keys":return`Unrecognized key${K.keys.length>1?"s":""}: ${F1(K.keys,", ")}`;case"invalid_key":return`Invalid key in ${K.origin}`;case"invalid_union":if(K.options&&Array.isArray(K.options)&&K.options.length>0)return`Invalid discriminator value. Expected ${K.options.map((J)=>`'${J}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${K.origin}`;default:return"Invalid input"}}};function V9(){return{localeError:wX()}}var f6,z5=Symbol("ZodOutput"),B5=Symbol("ZodInput");class c6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(W,...X){let Q=X[0];if(this._map.set(W,Q),Q&&typeof Q==="object"&&"id"in Q)this._idmap.set(Q.id,W);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(W){let X=this._map.get(W);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(W),this}get(W){let X=W._zod.parent;if(X){let Q={...this.get(X)??{}};delete Q.id;let Y={...Q,...this._map.get(W)};return Object.keys(Y).length?Y:void 0}return this._map.get(W)}has(W){return this._map.has(W)}}function MX(){return new c6}(f6=globalThis).__zod_globalRegistry??(f6.__zod_globalRegistry=MX());var j0=globalThis.__zod_globalRegistry;function m6(W,X){return new W({type:"string",...I(X)})}function u6(W,X){return new W({type:"string",format:"email",check:"string_format",abort:!1,...I(X)})}function N9(W,X){return new W({type:"string",format:"guid",check:"string_format",abort:!1,...I(X)})}function p6(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,...I(X)})}function l6(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(X)})}function d6(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(X)})}function o6(W,X){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(X)})}function i6(W,X){return new W({type:"string",format:"url",check:"string_format",abort:!1,...I(X)})}function r6(W,X){return new W({type:"string",format:"emoji",check:"string_format",abort:!1,...I(X)})}function n6(W,X){return new W({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(X)})}function t6(W,X){return new W({type:"string",format:"cuid",check:"string_format",abort:!1,...I(X)})}function a6(W,X){return new W({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(X)})}function s6(W,X){return new W({type:"string",format:"ulid",check:"string_format",abort:!1,...I(X)})}function e6(W,X){return new W({type:"string",format:"xid",check:"string_format",abort:!1,...I(X)})}function W2(W,X){return new W({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(X)})}function X2(W,X){return new W({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(X)})}function Q2(W,X){return new W({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(X)})}function Y2(W,X){return new W({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(X)})}function K2(W,X){return new W({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(X)})}function G2(W,X){return new W({type:"string",format:"base64",check:"string_format",abort:!1,...I(X)})}function q2(W,X){return new W({type:"string",format:"base64url",check:"string_format",abort:!1,...I(X)})}function J2(W,X){return new W({type:"string",format:"e164",check:"string_format",abort:!1,...I(X)})}function z2(W,X){return new W({type:"string",format:"jwt",check:"string_format",abort:!1,...I(X)})}function B2(W,X){return new W({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(X)})}function $2(W,X){return new W({type:"string",format:"date",check:"string_format",...I(X)})}function H2(W,X){return new W({type:"string",format:"time",check:"string_format",precision:null,...I(X)})}function U2(W,X){return new W({type:"string",format:"duration",check:"string_format",...I(X)})}function L2(W,X){return new W({type:"number",checks:[],...I(X)})}function D2(W,X){return new W({type:"number",check:"number_format",abort:!1,format:"safeint",...I(X)})}function w2(W,X){return new W({type:"boolean",...I(X)})}function M2(W,X){return new W({type:"null",...I(X)})}function F2(W){return new W({type:"unknown"})}function O2(W,X){return new W({type:"never",...I(X)})}function j1(W,X){return new H9({check:"less_than",...I(X),value:W,inclusive:!1})}function e0(W,X){return new H9({check:"less_than",...I(X),value:W,inclusive:!0})}function S1(W,X){return new U9({check:"greater_than",...I(X),value:W,inclusive:!1})}function W1(W,X){return new U9({check:"greater_than",...I(X),value:W,inclusive:!0})}function b1(W,X){return new R8({check:"multiple_of",...I(X),value:W})}function T1(W,X){return new I8({check:"max_length",...I(X),maximum:W})}function y0(W,X){return new C8({check:"min_length",...I(X),minimum:W})}function k1(W,X){return new _8({check:"length_equals",...I(X),length:W})}function P9(W,X){return new A8({check:"string_format",format:"regex",...I(X),pattern:W})}function Z9(W){return new j8({check:"string_format",format:"lowercase",...I(W)})}function R9(W){return new S8({check:"string_format",format:"uppercase",...I(W)})}function E9(W,X){return new b8({check:"string_format",format:"includes",...I(X),includes:W})}function I9(W,X){return new T8({check:"string_format",format:"starts_with",...I(X),prefix:W})}function C9(W,X){return new k8({check:"string_format",format:"ends_with",...I(X),suffix:W})}function I0(W){return new v8({check:"overwrite",tx:W})}function _9(W){return I0((X)=>X.normalize(W))}function A9(){return I0((W)=>W.trim())}function j9(){return I0((W)=>W.toLowerCase())}function S9(){return I0((W)=>W.toUpperCase())}function b9(){return I0((W)=>X9(W))}function V2(W,X,Q){return new W({type:"array",element:X,...I(Q)})}function N2(W,X,Q){let Y=I(Q);return Y.abort??(Y.abort=!0),new W({type:"custom",check:"custom",fn:X,...Y})}function P2(W,X,Q){return new W({type:"custom",check:"custom",fn:X,...I(Q)})}function Z2(W,X){let Q=FX((Y)=>{return Y.addIssue=(K)=>{if(typeof K==="string")Y.issues.push(h0(K,Y.value,Q._zod.def));else{let q=K;if(q.fatal)q.continue=!1;q.code??(q.code="custom"),q.input??(q.input=Y.value),q.inst??(q.inst=Q),q.continue??(q.continue=!Q._zod.def.abort),Y.issues.push(h0(q))}},W(Y.value,Y)},X);return Q}function FX(W,X){let Q=new t({check:"custom",...I(X)});return Q._zod.check=W,Q}function T9(W){let X=W?.target??"draft-2020-12";if(X==="draft-4")X="draft-04";if(X==="draft-7")X="draft-07";return{processors:W.processors??{},metadataRegistry:W?.metadata??j0,target:X,unrepresentable:W?.unrepresentable??"throw",override:W?.override??(()=>{}),io:W?.io??"output",counter:0,seen:new Map,cycles:W?.cycles??"ref",reused:W?.reused??"inline",external:W?.external??void 0}}function d(W,X,Q={path:[],schemaPath:[]}){var Y;let K=W._zod.def,q=X.seen.get(W);if(q){if(q.count++,Q.schemaPath.includes(W))q.cycle=Q.path;return q.schema}let J={schema:{},count:1,cycle:void 0,path:Q.path};X.seen.set(W,J);let G=W._zod.toJSONSchema?.();if(G)J.schema=G;else{let O={...Q,schemaPath:[...Q.schemaPath,W],path:Q.path};if(W._zod.processJSONSchema)W._zod.processJSONSchema(X,J.schema,O);else{let R=J.schema,P=X.processors[K.type];if(!P)throw Error(`[toJSONSchema]: Non-representable type encountered: ${K.type}`);P(W,X,R,O)}let V=W._zod.parent;if(V){if(!J.ref)J.ref=V;d(V,X,O),X.seen.get(V).isParent=!0}}let H=X.metadataRegistry.get(W);if(H)Object.assign(J.schema,H);if(X.io==="input"&&e(W))delete J.schema.examples,delete J.schema.default;if(X.io==="input"&&"_prefault"in J.schema)(Y=J.schema).default??(Y.default=J.schema._prefault);return delete J.schema._prefault,X.seen.get(W).schema}function k9(W,X){let Q=W.seen.get(X);if(!Q)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=new Map;for(let J of W.seen.entries()){let G=W.metadataRegistry.get(J[0])?.id;if(G){let H=Y.get(G);if(H&&H!==J[0])throw Error(`Duplicate schema id "${G}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);Y.set(G,J[0])}}let K=(J)=>{let G=W.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let V=W.external.registry.get(J[0])?.id,R=W.external.uri??((b)=>b);if(V)return{ref:R(V)};let P=J[1].defId??J[1].schema.id??`schema${W.counter++}`;return J[1].defId=P,{defId:P,ref:`${R("__shared")}#/${G}/${P}`}}if(J[1]===Q)return{ref:"#"};let D=`${"#"}/${G}/`,O=J[1].schema.id??`__schema${W.counter++}`;return{defId:O,ref:D+O}},q=(J)=>{if(J[1].schema.$ref)return;let G=J[1],{ref:H,defId:D}=K(J);if(G.def={...G.schema},D)G.defId=D;let O=G.schema;for(let V in O)delete O[V];O.$ref=H};if(W.cycles==="throw")for(let J of W.seen.entries()){let G=J[1];if(G.cycle)throw Error(`Cycle detected: #/${G.cycle?.join("/")}/<root>
|
|
69
69
|
|
|
70
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of W.seen.entries()){let G=J[1];if(X===J[0]){q(J);continue}if(W.external){let D=W.external.registry.get(J[0])?.id;if(X!==J[0]&&D){q(J);continue}}if(W.metadataRegistry.get(J[0])?.id){q(J);continue}if(G.cycle){q(J);continue}if(G.count>1){if(W.reused==="ref"){q(J);continue}}}}function v9(W,X){let Y=W.seen.get(X);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let Q=(G)=>{let H=W.seen.get(G);if(H.ref===null)return;let D=H.def??H.schema,O={...D},V=H.ref;if(H.ref=null,V){Q(V);let P=W.seen.get(V),b=P.schema;if(b.$ref&&(W.target==="draft-07"||W.target==="draft-04"||W.target==="openapi-3.0"))D.allOf=D.allOf??[],D.allOf.push(b);else Object.assign(D,b);if(Object.assign(D,O),G._zod.parent===V)for(let M in D){if(M==="$ref"||M==="allOf")continue;if(!(M in O))delete D[M]}if(b.$ref&&P.def)for(let M in D){if(M==="$ref"||M==="allOf")continue;if(M in P.def&&JSON.stringify(D[M])===JSON.stringify(P.def[M]))delete D[M]}}let R=G._zod.parent;if(R&&R!==V){Q(R);let P=W.seen.get(R);if(P?.schema.$ref){if(D.$ref=P.schema.$ref,P.def)for(let b in D){if(b==="$ref"||b==="allOf")continue;if(b in P.def&&JSON.stringify(D[b])===JSON.stringify(P.def[b]))delete D[b]}}}W.override({zodSchema:G,jsonSchema:D,path:H.path??[]})};for(let G of[...W.seen.entries()].reverse())Q(G[0]);let K={};if(W.target==="draft-2020-12")K.$schema="https://json-schema.org/draft/2020-12/schema";else if(W.target==="draft-07")K.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="draft-04")K.$schema="http://json-schema.org/draft-04/schema#";else if(W.target==="openapi-3.0");if(W.external?.uri){let G=W.external.registry.get(X)?.id;if(!G)throw Error("Schema is missing an `id` property");K.$id=W.external.uri(G)}Object.assign(K,Y.def??Y.schema);let q=W.metadataRegistry.get(X)?.id;if(q!==void 0&&K.id===q)delete K.id;let J=W.external?.defs??{};for(let G of W.seen.entries()){let H=G[1];if(H.def&&H.defId){if(H.def.id===H.defId)delete H.def.id;J[H.defId]=H.def}}if(W.external);else if(Object.keys(J).length>0)if(W.target==="draft-2020-12")K.$defs=J;else K.definitions=J;try{let G=JSON.parse(JSON.stringify(K));return Object.defineProperty(G,"~standard",{value:{...X["~standard"],jsonSchema:{input:X1(X,"input",W.processors),output:X1(X,"output",W.processors)}},enumerable:!1,writable:!1}),G}catch(G){throw Error("Error converting schema to JSON.")}}function e(W,X){let Y=X??{seen:new Set};if(Y.seen.has(W))return!1;Y.seen.add(W);let Q=W._zod.def;if(Q.type==="transform")return!0;if(Q.type==="array")return e(Q.element,Y);if(Q.type==="set")return e(Q.valueType,Y);if(Q.type==="lazy")return e(Q.getter(),Y);if(Q.type==="promise"||Q.type==="optional"||Q.type==="nonoptional"||Q.type==="nullable"||Q.type==="readonly"||Q.type==="default"||Q.type==="prefault")return e(Q.innerType,Y);if(Q.type==="intersection")return e(Q.left,Y)||e(Q.right,Y);if(Q.type==="record"||Q.type==="map")return e(Q.keyType,Y)||e(Q.valueType,Y);if(Q.type==="pipe"){if(W._zod.traits.has("$ZodCodec"))return!0;return e(Q.in,Y)||e(Q.out,Y)}if(Q.type==="object"){for(let K in Q.shape)if(e(Q.shape[K],Y))return!0;return!1}if(Q.type==="union"){for(let K of Q.options)if(e(K,Y))return!0;return!1}if(Q.type==="tuple"){for(let K of Q.items)if(e(K,Y))return!0;if(Q.rest&&e(Q.rest,Y))return!0;return!1}return!1}var R2=(W,X={})=>(Y)=>{let Q=T9({...Y,processors:X});return d(W,Q),k9(Q,W),v9(Q,W)},X1=(W,X,Y={})=>(Q)=>{let{libraryOptions:K,target:q}=Q??{},J=T9({...K??{},target:q,io:X,processors:Y});return d(W,J),k9(J,W),v9(J,W)};var OX={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},E2=(W,X,Y,Q)=>{let K=Y;K.type="string";let{minimum:q,maximum:J,format:G,patterns:H,contentEncoding:D}=W._zod.bag;if(typeof q==="number")K.minLength=q;if(typeof J==="number")K.maxLength=J;if(G){if(K.format=OX[G]??G,K.format==="")delete K.format;if(G==="time")delete K.format}if(D)K.contentEncoding=D;if(H&&H.size>0){let O=[...H];if(O.length===1)K.pattern=O[0].source;else if(O.length>1)K.allOf=[...O.map((V)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:V.source}))]}},I2=(W,X,Y,Q)=>{let K=Y,{minimum:q,maximum:J,format:G,multipleOf:H,exclusiveMaximum:D,exclusiveMinimum:O}=W._zod.bag;if(typeof G==="string"&&G.includes("int"))K.type="integer";else K.type="number";let V=typeof O==="number"&&O>=(q??Number.NEGATIVE_INFINITY),R=typeof D==="number"&&D<=(J??Number.POSITIVE_INFINITY),P=X.target==="draft-04"||X.target==="openapi-3.0";if(V)if(P)K.minimum=O,K.exclusiveMinimum=!0;else K.exclusiveMinimum=O;else if(typeof q==="number")K.minimum=q;if(R)if(P)K.maximum=D,K.exclusiveMaximum=!0;else K.exclusiveMaximum=D;else if(typeof J==="number")K.maximum=J;if(typeof H==="number")K.multipleOf=H},C2=(W,X,Y,Q)=>{Y.type="boolean"};var _2=(W,X,Y,Q)=>{if(X.target==="openapi-3.0")Y.type="string",Y.nullable=!0,Y.enum=[null];else Y.type="null"};var A2=(W,X,Y,Q)=>{Y.not={}};var j2=(W,X,Y,Q)=>{};var S2=(W,X,Y,Q)=>{let K=W._zod.def,q=o0(K.entries);if(q.every((J)=>typeof J==="number"))Y.type="number";if(q.every((J)=>typeof J==="string"))Y.type="string";Y.enum=q},b2=(W,X,Y,Q)=>{let K=W._zod.def,q=[];for(let J of K.values)if(J===void 0){if(X.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof J==="bigint")if(X.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else q.push(Number(J));else q.push(J);if(q.length===0);else if(q.length===1){let J=q[0];if(Y.type=J===null?"null":typeof J,X.target==="draft-04"||X.target==="openapi-3.0")Y.enum=[J];else Y.const=J}else{if(q.every((J)=>typeof J==="number"))Y.type="number";if(q.every((J)=>typeof J==="string"))Y.type="string";if(q.every((J)=>typeof J==="boolean"))Y.type="boolean";if(q.every((J)=>J===null))Y.type="null";Y.enum=q}};var T2=(W,X,Y,Q)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var k2=(W,X,Y,Q)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var v2=(W,X,Y,Q)=>{let K=Y,q=W._zod.def,{minimum:J,maximum:G}=W._zod.bag;if(typeof J==="number")K.minItems=J;if(typeof G==="number")K.maxItems=G;K.type="array",K.items=d(q.element,X,{...Q,path:[...Q.path,"items"]})},x2=(W,X,Y,Q)=>{let K=Y,q=W._zod.def;K.type="object",K.properties={};let J=q.shape;for(let D in J)K.properties[D]=d(J[D],X,{...Q,path:[...Q.path,"properties",D]});let G=new Set(Object.keys(J)),H=new Set([...G].filter((D)=>{let O=q.shape[D]._zod;if(X.io==="input")return O.optin===void 0;else return O.optout===void 0}));if(H.size>0)K.required=Array.from(H);if(q.catchall?._zod.def.type==="never")K.additionalProperties=!1;else if(!q.catchall){if(X.io==="output")K.additionalProperties=!1}else if(q.catchall)K.additionalProperties=d(q.catchall,X,{...Q,path:[...Q.path,"additionalProperties"]})},g2=(W,X,Y,Q)=>{let K=W._zod.def,q=K.inclusive===!1,J=K.options.map((G,H)=>d(G,X,{...Q,path:[...Q.path,q?"oneOf":"anyOf",H]}));if(q)Y.oneOf=J;else Y.anyOf=J},h2=(W,X,Y,Q)=>{let K=W._zod.def,q=d(K.left,X,{...Q,path:[...Q.path,"allOf",0]}),J=d(K.right,X,{...Q,path:[...Q.path,"allOf",1]}),G=(D)=>("allOf"in D)&&Object.keys(D).length===1,H=[...G(q)?q.allOf:[q],...G(J)?J.allOf:[J]];Y.allOf=H};var y2=(W,X,Y,Q)=>{let K=Y,q=W._zod.def;K.type="object";let J=q.keyType,H=J._zod.bag?.patterns;if(q.mode==="loose"&&H&&H.size>0){let O=d(q.valueType,X,{...Q,path:[...Q.path,"patternProperties","*"]});K.patternProperties={};for(let V of H)K.patternProperties[V.source]=O}else{if(X.target==="draft-07"||X.target==="draft-2020-12")K.propertyNames=d(q.keyType,X,{...Q,path:[...Q.path,"propertyNames"]});K.additionalProperties=d(q.valueType,X,{...Q,path:[...Q.path,"additionalProperties"]})}let D=J._zod.values;if(D){let O=[...D].filter((V)=>typeof V==="string"||typeof V==="number");if(O.length>0)K.required=O}},f2=(W,X,Y,Q)=>{let K=W._zod.def,q=d(K.innerType,X,Q),J=X.seen.get(W);if(X.target==="openapi-3.0")J.ref=K.innerType,Y.nullable=!0;else Y.anyOf=[q,{type:"null"}]},c2=(W,X,Y,Q)=>{let K=W._zod.def;d(K.innerType,X,Q);let q=X.seen.get(W);q.ref=K.innerType},m2=(W,X,Y,Q)=>{let K=W._zod.def;d(K.innerType,X,Q);let q=X.seen.get(W);q.ref=K.innerType,Y.default=JSON.parse(JSON.stringify(K.defaultValue))},u2=(W,X,Y,Q)=>{let K=W._zod.def;d(K.innerType,X,Q);let q=X.seen.get(W);if(q.ref=K.innerType,X.io==="input")Y._prefault=JSON.parse(JSON.stringify(K.defaultValue))},p2=(W,X,Y,Q)=>{let K=W._zod.def;d(K.innerType,X,Q);let q=X.seen.get(W);q.ref=K.innerType;let J;try{J=K.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}Y.default=J},l2=(W,X,Y,Q)=>{let K=W._zod.def,q=K.in._zod.traits.has("$ZodTransform"),J=X.io==="input"?q?K.out:K.in:K.out;d(J,X,Q);let G=X.seen.get(W);G.ref=J},d2=(W,X,Y,Q)=>{let K=W._zod.def;d(K.innerType,X,Q);let q=X.seen.get(W);q.ref=K.innerType,Y.readOnly=!0};var x9=(W,X,Y,Q)=>{let K=W._zod.def;d(K.innerType,X,Q);let q=X.seen.get(W);q.ref=K.innerType};var Q1={};a1(Q1,{time:()=>y9,duration:()=>f9,datetime:()=>g9,date:()=>h9,ZodISOTime:()=>r2,ZodISODuration:()=>n2,ZodISODateTime:()=>o2,ZodISODate:()=>i2});var o2=w("ZodISODateTime",(W,X)=>{Y6.init(W,X),f.init(W,X)});function g9(W){return B2(o2,W)}var i2=w("ZodISODate",(W,X)=>{Q6.init(W,X),f.init(W,X)});function h9(W){return $2(i2,W)}var r2=w("ZodISOTime",(W,X)=>{K6.init(W,X),f.init(W,X)});function y9(W){return H2(r2,W)}var n2=w("ZodISODuration",(W,X)=>{G6.init(W,X),f.init(W,X)});function f9(W){return U2(n2,W)}var _X=(W,X)=>{P1.init(W,X),W.name="ZodError",Object.defineProperties(W,{format:{value:(Y)=>h4(W,Y)},flatten:{value:(Y)=>g4(W,Y)},addIssue:{value:(Y)=>{W.issues.push(Y),W.message=JSON.stringify(W.issues,x0,2)}},addIssues:{value:(Y)=>{W.issues.push(...Y),W.message=JSON.stringify(W.issues,x0,2)}},isEmpty:{get(){return W.issues.length===0}}})};var G0=w("ZodError",_X,{Parent:Error});var t2=Z1(G0),a2=R1(G0),s2=t0(G0),e2=a0(G0),WW=c4(G0),XW=m4(G0),YW=u4(G0),QW=p4(G0),KW=l4(G0),GW=d4(G0),qW=o4(G0),JW=i4(G0);var zW=new WeakMap;function K1(W,X,Y){let Q=Object.getPrototypeOf(W),K=zW.get(Q);if(!K)K=new Set,zW.set(Q,K);if(K.has(X))return;K.add(X);for(let q in Y){let J=Y[q];Object.defineProperty(Q,q,{configurable:!0,enumerable:!1,get(){let G=J.bind(this);return Object.defineProperty(this,q,{configurable:!0,writable:!0,enumerable:!0,value:G}),G},set(G){Object.defineProperty(this,q,{configurable:!0,writable:!0,enumerable:!0,value:G})}})}}var u=w("ZodType",(W,X)=>{return g.init(W,X),Object.assign(W["~standard"],{jsonSchema:{input:X1(W,"input"),output:X1(W,"output")}}),W.toJSONSchema=R2(W,{}),W.def=X,W.type=X.type,Object.defineProperty(W,"_def",{value:X}),W.parse=(Y,Q)=>t2(W,Y,Q,{callee:W.parse}),W.safeParse=(Y,Q)=>s2(W,Y,Q),W.parseAsync=async(Y,Q)=>a2(W,Y,Q,{callee:W.parseAsync}),W.safeParseAsync=async(Y,Q)=>e2(W,Y,Q),W.spa=W.safeParseAsync,W.encode=(Y,Q)=>WW(W,Y,Q),W.decode=(Y,Q)=>XW(W,Y,Q),W.encodeAsync=async(Y,Q)=>YW(W,Y,Q),W.decodeAsync=async(Y,Q)=>QW(W,Y,Q),W.safeEncode=(Y,Q)=>KW(W,Y,Q),W.safeDecode=(Y,Q)=>GW(W,Y,Q),W.safeEncodeAsync=async(Y,Q)=>qW(W,Y,Q),W.safeDecodeAsync=async(Y,Q)=>JW(W,Y,Q),K1(W,"ZodType",{check(...Y){let Q=this.def;return this.clone(S.mergeDefs(Q,{checks:[...Q.checks??[],...Y.map((K)=>typeof K==="function"?{_zod:{check:K,def:{check:"custom"},onattach:[]}}:K)]}),{parent:!0})},with(...Y){return this.check(...Y)},clone(Y,Q){return H0(this,Y,Q)},brand(){return this},register(Y,Q){return Y.add(this,Q),this},refine(Y,Q){return this.check(FY(Y,Q))},superRefine(Y,Q){return this.check(OY(Y,Q))},overwrite(Y){return this.check(I0(Y))},optional(){return m(this)},exactOptional(){return GY(this)},nullable(){return UW(this)},nullish(){return m(UW(this))},nonoptional(Y){return HY(this,Y)},array(){return A(this)},or(Y){return y([this,Y])},and(Y){return x1(this,Y)},transform(Y){return LW(this,VW(Y))},default(Y){return zY(this,Y)},prefault(Y){return $Y(this,Y)},catch(Y){return LY(this,Y)},pipe(Y){return LW(this,Y)},readonly(){return MY(this)},describe(Y){let Q=this.clone();return j0.add(Q,{description:Y}),Q},meta(...Y){if(Y.length===0)return j0.get(this);let Q=this.clone();return j0.add(Q,Y[0]),Q},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(Y){return Y(this)}}),Object.defineProperty(W,"description",{get(){return j0.get(W)?.description},configurable:!0}),W}),DW=w("_ZodString",(W,X)=>{A1.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,K,q)=>E2(W,Q,K,q);let Y=W._zod.bag;W.format=Y.format??null,W.minLength=Y.minimum??null,W.maxLength=Y.maximum??null,K1(W,"_ZodString",{regex(...Q){return this.check(P9(...Q))},includes(...Q){return this.check(E9(...Q))},startsWith(...Q){return this.check(I9(...Q))},endsWith(...Q){return this.check(C9(...Q))},min(...Q){return this.check(y0(...Q))},max(...Q){return this.check(T1(...Q))},length(...Q){return this.check(k1(...Q))},nonempty(...Q){return this.check(y0(1,...Q))},lowercase(Q){return this.check(Z9(Q))},uppercase(Q){return this.check(R9(Q))},trim(){return this.check(A9())},normalize(...Q){return this.check(_9(...Q))},toLowerCase(){return this.check(j9())},toUpperCase(){return this.check(S9())},slugify(){return this.check(b9())}})}),jX=w("ZodString",(W,X)=>{A1.init(W,X),DW.init(W,X),W.email=(Y)=>W.check(u6(SX,Y)),W.url=(Y)=>W.check(i6(bX,Y)),W.jwt=(Y)=>W.check(z2(oX,Y)),W.emoji=(Y)=>W.check(r6(TX,Y)),W.guid=(Y)=>W.check(N9(BW,Y)),W.uuid=(Y)=>W.check(p6(v1,Y)),W.uuidv4=(Y)=>W.check(l6(v1,Y)),W.uuidv6=(Y)=>W.check(d6(v1,Y)),W.uuidv7=(Y)=>W.check(o6(v1,Y)),W.nanoid=(Y)=>W.check(n6(kX,Y)),W.guid=(Y)=>W.check(N9(BW,Y)),W.cuid=(Y)=>W.check(t6(vX,Y)),W.cuid2=(Y)=>W.check(a6(xX,Y)),W.ulid=(Y)=>W.check(s6(gX,Y)),W.base64=(Y)=>W.check(G2(pX,Y)),W.base64url=(Y)=>W.check(q2(lX,Y)),W.xid=(Y)=>W.check(e6(hX,Y)),W.ksuid=(Y)=>W.check(W2(yX,Y)),W.ipv4=(Y)=>W.check(X2(fX,Y)),W.ipv6=(Y)=>W.check(Y2(cX,Y)),W.cidrv4=(Y)=>W.check(Q2(mX,Y)),W.cidrv6=(Y)=>W.check(K2(uX,Y)),W.e164=(Y)=>W.check(J2(dX,Y)),W.datetime=(Y)=>W.check(g9(Y)),W.date=(Y)=>W.check(h9(Y)),W.time=(Y)=>W.check(y9(Y)),W.duration=(Y)=>W.check(f9(Y))});function U(W){return m6(jX,W)}var f=w("ZodStringFormat",(W,X)=>{h.init(W,X),DW.init(W,X)}),SX=w("ZodEmail",(W,X)=>{i8.init(W,X),f.init(W,X)});var BW=w("ZodGUID",(W,X)=>{d8.init(W,X),f.init(W,X)});var v1=w("ZodUUID",(W,X)=>{o8.init(W,X),f.init(W,X)});var bX=w("ZodURL",(W,X)=>{r8.init(W,X),f.init(W,X)});var TX=w("ZodEmoji",(W,X)=>{n8.init(W,X),f.init(W,X)});var kX=w("ZodNanoID",(W,X)=>{t8.init(W,X),f.init(W,X)});var vX=w("ZodCUID",(W,X)=>{a8.init(W,X),f.init(W,X)});var xX=w("ZodCUID2",(W,X)=>{s8.init(W,X),f.init(W,X)});var gX=w("ZodULID",(W,X)=>{e8.init(W,X),f.init(W,X)});var hX=w("ZodXID",(W,X)=>{W6.init(W,X),f.init(W,X)});var yX=w("ZodKSUID",(W,X)=>{X6.init(W,X),f.init(W,X)});var fX=w("ZodIPv4",(W,X)=>{q6.init(W,X),f.init(W,X)});var cX=w("ZodIPv6",(W,X)=>{J6.init(W,X),f.init(W,X)});var mX=w("ZodCIDRv4",(W,X)=>{z6.init(W,X),f.init(W,X)});var uX=w("ZodCIDRv6",(W,X)=>{B6.init(W,X),f.init(W,X)});var pX=w("ZodBase64",(W,X)=>{H6.init(W,X),f.init(W,X)});var lX=w("ZodBase64URL",(W,X)=>{U6.init(W,X),f.init(W,X)});var dX=w("ZodE164",(W,X)=>{L6.init(W,X),f.init(W,X)});var oX=w("ZodJWT",(W,X)=>{D6.init(W,X),f.init(W,X)});var wW=w("ZodNumber",(W,X)=>{w9.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,K,q)=>I2(W,Q,K,q),K1(W,"ZodNumber",{gt(Q,K){return this.check(S1(Q,K))},gte(Q,K){return this.check(W1(Q,K))},min(Q,K){return this.check(W1(Q,K))},lt(Q,K){return this.check(j1(Q,K))},lte(Q,K){return this.check(e0(Q,K))},max(Q,K){return this.check(e0(Q,K))},int(Q){return this.check($W(Q))},safe(Q){return this.check($W(Q))},positive(Q){return this.check(S1(0,Q))},nonnegative(Q){return this.check(W1(0,Q))},negative(Q){return this.check(j1(0,Q))},nonpositive(Q){return this.check(e0(0,Q))},multipleOf(Q,K){return this.check(b1(Q,K))},step(Q,K){return this.check(b1(Q,K))},finite(){return this}});let Y=W._zod.bag;W.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,W.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,W.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),W.isFinite=!0,W.format=Y.format??null});function k(W){return L2(wW,W)}var iX=w("ZodNumberFormat",(W,X)=>{w6.init(W,X),wW.init(W,X)});function $W(W){return D2(iX,W)}var rX=w("ZodBoolean",(W,X)=>{M6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>C2(W,Y,Q,K)});function n(W){return w2(rX,W)}var nX=w("ZodNull",(W,X)=>{F6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>_2(W,Y,Q,K)});function MW(W){return M2(nX,W)}var tX=w("ZodUnknown",(W,X)=>{O6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>j2(W,Y,Q,K)});function c(){return F2(tX)}var aX=w("ZodNever",(W,X)=>{V6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>A2(W,Y,Q,K)});function sX(W){return O2(aX,W)}var eX=w("ZodArray",(W,X)=>{N6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>v2(W,Y,Q,K),W.element=X.element,K1(W,"ZodArray",{min(Y,Q){return this.check(y0(Y,Q))},nonempty(Y){return this.check(y0(1,Y))},max(Y,Q){return this.check(T1(Y,Q))},length(Y,Q){return this.check(k1(Y,Q))},unwrap(){return this.element}})});function A(W,X){return V2(eX,W,X)}var FW=w("ZodObject",(W,X)=>{R6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>x2(W,Y,Q,K),S.defineLazy(W,"shape",()=>{return X.shape}),K1(W,"ZodObject",{keyof(){return Q0(Object.keys(this._zod.def.shape))},catchall(Y){return this.clone({...this._zod.def,catchall:Y})},passthrough(){return this.clone({...this._zod.def,catchall:c()})},loose(){return this.clone({...this._zod.def,catchall:c()})},strict(){return this.clone({...this._zod.def,catchall:sX()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(Y){return S.extend(this,Y)},safeExtend(Y){return S.safeExtend(this,Y)},merge(Y){return S.merge(this,Y)},pick(Y){return S.pick(this,Y)},omit(Y){return S.omit(this,Y)},partial(...Y){return S.partial(NW,this,Y[0])},required(...Y){return S.required(PW,this,Y[0])}})});function Z(W,X){let Y={type:"object",shape:W??{},...S.normalizeParams(X)};return new FW(Y)}function W0(W,X){return new FW({type:"object",shape:W,catchall:c(),...S.normalizeParams(X)})}var OW=w("ZodUnion",(W,X)=>{M9.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>g2(W,Y,Q,K),W.options=X.options});function y(W,X){return new OW({type:"union",options:W,...S.normalizeParams(X)})}var WY=w("ZodDiscriminatedUnion",(W,X)=>{OW.init(W,X),E6.init(W,X)});function m9(W,X,Y){return new WY({type:"union",options:X,discriminator:W,...S.normalizeParams(Y)})}var XY=w("ZodIntersection",(W,X)=>{I6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>h2(W,Y,Q,K)});function x1(W,X){return new XY({type:"intersection",left:W,right:X})}var HW=w("ZodRecord",(W,X)=>{C6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>y2(W,Y,Q,K),W.keyType=X.keyType,W.valueType=X.valueType});function v(W,X,Y){if(!X||!X._zod)return new HW({type:"record",keyType:U(),valueType:W,...S.normalizeParams(X)});return new HW({type:"record",keyType:W,valueType:X,...S.normalizeParams(Y)})}var c9=w("ZodEnum",(W,X)=>{_6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,K,q)=>S2(W,Q,K,q),W.enum=X.entries,W.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));W.extract=(Q,K)=>{let q={};for(let J of Q)if(Y.has(J))q[J]=X.entries[J];else throw Error(`Key ${J} not found in enum`);return new c9({...X,checks:[],...S.normalizeParams(K),entries:q})},W.exclude=(Q,K)=>{let q={...X.entries};for(let J of Q)if(Y.has(J))delete q[J];else throw Error(`Key ${J} not found in enum`);return new c9({...X,checks:[],...S.normalizeParams(K),entries:q})}});function Q0(W,X){let Y=Array.isArray(W)?Object.fromEntries(W.map((Q)=>[Q,Q])):W;return new c9({type:"enum",entries:Y,...S.normalizeParams(X)})}var YY=w("ZodLiteral",(W,X)=>{A6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>b2(W,Y,Q,K),W.values=new Set(X.values),Object.defineProperty(W,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function E(W,X){return new YY({type:"literal",values:Array.isArray(W)?W:[W],...S.normalizeParams(X)})}var QY=w("ZodTransform",(W,X)=>{j6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>k2(W,Y,Q,K),W._zod.parse=(Y,Q)=>{if(Q.direction==="backward")throw new l0(W.constructor.name);Y.addIssue=(q)=>{if(typeof q==="string")Y.issues.push(S.issue(q,Y.value,X));else{let J=q;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=Y.value),J.inst??(J.inst=W),Y.issues.push(S.issue(J))}};let K=X.transform(Y.value,Y);if(K instanceof Promise)return K.then((q)=>{return Y.value=q,Y.fallback=!0,Y});return Y.value=K,Y.fallback=!0,Y}});function VW(W){return new QY({type:"transform",transform:W})}var NW=w("ZodOptional",(W,X)=>{F9.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>x9(W,Y,Q,K),W.unwrap=()=>W._zod.def.innerType});function m(W){return new NW({type:"optional",innerType:W})}var KY=w("ZodExactOptional",(W,X)=>{S6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>x9(W,Y,Q,K),W.unwrap=()=>W._zod.def.innerType});function GY(W){return new KY({type:"optional",innerType:W})}var qY=w("ZodNullable",(W,X)=>{b6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>f2(W,Y,Q,K),W.unwrap=()=>W._zod.def.innerType});function UW(W){return new qY({type:"nullable",innerType:W})}var JY=w("ZodDefault",(W,X)=>{T6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>m2(W,Y,Q,K),W.unwrap=()=>W._zod.def.innerType,W.removeDefault=W.unwrap});function zY(W,X){return new JY({type:"default",innerType:W,get defaultValue(){return typeof X==="function"?X():S.shallowClone(X)}})}var BY=w("ZodPrefault",(W,X)=>{k6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>u2(W,Y,Q,K),W.unwrap=()=>W._zod.def.innerType});function $Y(W,X){return new BY({type:"prefault",innerType:W,get defaultValue(){return typeof X==="function"?X():S.shallowClone(X)}})}var PW=w("ZodNonOptional",(W,X)=>{v6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>c2(W,Y,Q,K),W.unwrap=()=>W._zod.def.innerType});function HY(W,X){return new PW({type:"nonoptional",innerType:W,...S.normalizeParams(X)})}var UY=w("ZodCatch",(W,X)=>{x6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>p2(W,Y,Q,K),W.unwrap=()=>W._zod.def.innerType,W.removeCatch=W.unwrap});function LY(W,X){return new UY({type:"catch",innerType:W,catchValue:typeof X==="function"?X:()=>X})}var ZW=w("ZodPipe",(W,X)=>{O9.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>l2(W,Y,Q,K),W.in=X.in,W.out=X.out});function LW(W,X){return new ZW({type:"pipe",in:W,out:X})}var DY=w("ZodPreprocess",(W,X)=>{ZW.init(W,X),g6.init(W,X)}),wY=w("ZodReadonly",(W,X)=>{h6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>d2(W,Y,Q,K),W.unwrap=()=>W._zod.def.innerType});function MY(W){return new wY({type:"readonly",innerType:W})}var RW=w("ZodCustom",(W,X)=>{y6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,Q,K)=>T2(W,Y,Q,K)});function EW(W,X){return N2(RW,W??(()=>!0),X)}function FY(W,X={}){return P2(RW,W,X)}function OY(W,X){return Z2(W,X)}function u9(W,X){return new DY({type:"pipe",in:VW(W),out:X})}K0(V9());var VY="io.modelcontextprotocol/related-task",h1="2.0",i=EW((W)=>W!==null&&(typeof W==="object"||typeof W==="function")),CW=y([U(),k().int()]),_W=U(),XG=W0({ttl:k().optional(),pollInterval:k().optional()}),NY=Z({ttl:k().optional()}),PY=Z({taskId:U()}),p9=W0({progressToken:CW.optional(),[VY]:PY.optional()}),q0=Z({_meta:p9.optional()}),y1=q0.extend({task:NY.optional()});var a=Z({method:U(),params:q0.loose().optional()}),z0=Z({_meta:p9.optional()}),B0=Z({method:U(),params:z0.loose().optional()}),s=W0({_meta:p9.optional()}),f1=y([U(),k().int()]),ZY=Z({jsonrpc:E(h1),id:f1,...a.shape}).strict();var RY=Z({jsonrpc:E(h1),...B0.shape}).strict();var AW=Z({jsonrpc:E(h1),id:f1,result:s}).strict();var IW;(function(W){W[W.ConnectionClosed=-32000]="ConnectionClosed",W[W.RequestTimeout=-32001]="RequestTimeout",W[W.ParseError=-32700]="ParseError",W[W.InvalidRequest=-32600]="InvalidRequest",W[W.MethodNotFound=-32601]="MethodNotFound",W[W.InvalidParams=-32602]="InvalidParams",W[W.InternalError=-32603]="InternalError",W[W.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(IW||(IW={}));var jW=Z({jsonrpc:E(h1),id:f1.optional(),error:Z({code:k().int(),message:U(),data:c().optional()})}).strict();var SW=y([ZY,RY,AW,jW]),YG=y([AW,jW]),bW=s.strict(),EY=z0.extend({requestId:f1.optional(),reason:U().optional()}),TW=B0.extend({method:E("notifications/cancelled"),params:EY}),IY=Z({src:U(),mimeType:U().optional(),sizes:A(U()).optional(),theme:Q0(["light","dark"]).optional()}),G1=Z({icons:A(IY).optional()}),f0=Z({name:U(),title:U().optional()}),kW=f0.extend({...f0.shape,...G1.shape,version:U(),websiteUrl:U().optional(),description:U().optional()}),CY=x1(Z({applyDefaults:n().optional()}),v(U(),c())),_Y=u9((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)){if(Object.keys(W).length===0)return{form:{}}}return W},x1(Z({form:CY.optional(),url:i.optional()}),v(U(),c()).optional())),AY=W0({list:i.optional(),cancel:i.optional(),requests:W0({sampling:W0({createMessage:i.optional()}).optional(),elicitation:W0({create:i.optional()}).optional()}).optional()}),jY=W0({list:i.optional(),cancel:i.optional(),requests:W0({tools:W0({call:i.optional()}).optional()}).optional()}),SY=Z({experimental:v(U(),i).optional(),sampling:Z({context:i.optional(),tools:i.optional()}).optional(),elicitation:_Y.optional(),roots:Z({listChanged:n().optional()}).optional(),tasks:AY.optional(),extensions:v(U(),i).optional()}),bY=q0.extend({protocolVersion:U(),capabilities:SY,clientInfo:kW}),TY=a.extend({method:E("initialize"),params:bY});var kY=Z({experimental:v(U(),i).optional(),logging:i.optional(),completions:i.optional(),prompts:Z({listChanged:n().optional()}).optional(),resources:Z({subscribe:n().optional(),listChanged:n().optional()}).optional(),tools:Z({listChanged:n().optional()}).optional(),tasks:jY.optional(),extensions:v(U(),i).optional()}),vY=s.extend({protocolVersion:U(),capabilities:kY,serverInfo:kW,instructions:U().optional()}),xY=B0.extend({method:E("notifications/initialized"),params:z0.optional()});var vW=a.extend({method:E("ping"),params:q0.optional()}),gY=Z({progress:k(),total:m(k()),message:m(U())}),hY=Z({...z0.shape,...gY.shape,progressToken:CW}),xW=B0.extend({method:E("notifications/progress"),params:hY}),yY=q0.extend({cursor:_W.optional()}),q1=a.extend({params:yY.optional()}),J1=s.extend({nextCursor:_W.optional()}),fY=Q0(["working","input_required","completed","failed","cancelled"]),z1=Z({taskId:U(),status:fY,ttl:y([k(),MW()]),createdAt:U(),lastUpdatedAt:U(),pollInterval:m(k()),statusMessage:m(U())}),gW=s.extend({task:z1}),cY=z0.merge(z1),hW=B0.extend({method:E("notifications/tasks/status"),params:cY}),yW=a.extend({method:E("tasks/get"),params:q0.extend({taskId:U()})}),fW=s.merge(z1),cW=a.extend({method:E("tasks/result"),params:q0.extend({taskId:U()})}),QG=s.loose(),mW=q1.extend({method:E("tasks/list")}),uW=J1.extend({tasks:A(z1)}),pW=a.extend({method:E("tasks/cancel"),params:q0.extend({taskId:U()})}),KG=s.merge(z1),lW=Z({uri:U(),mimeType:m(U()),_meta:v(U(),c()).optional()}),dW=lW.extend({text:U()}),l9=U().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),oW=lW.extend({blob:l9}),B1=Q0(["user","assistant"]),c0=Z({audience:A(B1).optional(),priority:k().min(0).max(1).optional(),lastModified:Q1.datetime({offset:!0}).optional()}),iW=Z({...f0.shape,...G1.shape,uri:U(),description:m(U()),mimeType:m(U()),size:m(k()),annotations:c0.optional(),_meta:m(W0({}))}),mY=Z({...f0.shape,...G1.shape,uriTemplate:U(),description:m(U()),mimeType:m(U()),annotations:c0.optional(),_meta:m(W0({}))}),uY=q1.extend({method:E("resources/list")}),pY=J1.extend({resources:A(iW)}),lY=q1.extend({method:E("resources/templates/list")}),dY=J1.extend({resourceTemplates:A(mY)}),d9=q0.extend({uri:U()}),oY=d9,iY=a.extend({method:E("resources/read"),params:oY}),rY=s.extend({contents:A(y([dW,oW]))}),nY=B0.extend({method:E("notifications/resources/list_changed"),params:z0.optional()}),tY=d9,aY=a.extend({method:E("resources/subscribe"),params:tY}),sY=d9,eY=a.extend({method:E("resources/unsubscribe"),params:sY}),WQ=z0.extend({uri:U()}),XQ=B0.extend({method:E("notifications/resources/updated"),params:WQ}),YQ=Z({name:U(),description:m(U()),required:m(n())}),QQ=Z({...f0.shape,...G1.shape,description:m(U()),arguments:m(A(YQ)),_meta:m(W0({}))}),KQ=q1.extend({method:E("prompts/list")}),GQ=J1.extend({prompts:A(QQ)}),qQ=q0.extend({name:U(),arguments:v(U(),U()).optional()}),JQ=a.extend({method:E("prompts/get"),params:qQ}),o9=Z({type:E("text"),text:U(),annotations:c0.optional(),_meta:v(U(),c()).optional()}),i9=Z({type:E("image"),data:l9,mimeType:U(),annotations:c0.optional(),_meta:v(U(),c()).optional()}),r9=Z({type:E("audio"),data:l9,mimeType:U(),annotations:c0.optional(),_meta:v(U(),c()).optional()}),zQ=Z({type:E("tool_use"),name:U(),id:U(),input:v(U(),c()),_meta:v(U(),c()).optional()}),BQ=Z({type:E("resource"),resource:y([dW,oW]),annotations:c0.optional(),_meta:v(U(),c()).optional()}),$Q=iW.extend({type:E("resource_link")}),n9=y([o9,i9,r9,$Q,BQ]),HQ=Z({role:B1,content:n9}),UQ=s.extend({description:U().optional(),messages:A(HQ)}),LQ=B0.extend({method:E("notifications/prompts/list_changed"),params:z0.optional()}),DQ=Z({title:U().optional(),readOnlyHint:n().optional(),destructiveHint:n().optional(),idempotentHint:n().optional(),openWorldHint:n().optional()}),wQ=Z({taskSupport:Q0(["required","optional","forbidden"]).optional()}),rW=Z({...f0.shape,...G1.shape,description:U().optional(),inputSchema:Z({type:E("object"),properties:v(U(),i).optional(),required:A(U()).optional()}).catchall(c()),outputSchema:Z({type:E("object"),properties:v(U(),i).optional(),required:A(U()).optional()}).catchall(c()).optional(),annotations:DQ.optional(),execution:wQ.optional(),_meta:v(U(),c()).optional()}),MQ=q1.extend({method:E("tools/list")}),FQ=J1.extend({tools:A(rW)}),nW=s.extend({content:A(n9).default([]),structuredContent:v(U(),c()).optional(),isError:n().optional()}),GG=nW.or(s.extend({toolResult:c()})),OQ=y1.extend({name:U(),arguments:v(U(),c()).optional()}),VQ=a.extend({method:E("tools/call"),params:OQ}),NQ=B0.extend({method:E("notifications/tools/list_changed"),params:z0.optional()}),qG=Z({autoRefresh:n().default(!0),debounceMs:k().int().nonnegative().default(300)}),tW=Q0(["debug","info","notice","warning","error","critical","alert","emergency"]),PQ=q0.extend({level:tW}),ZQ=a.extend({method:E("logging/setLevel"),params:PQ}),RQ=z0.extend({level:tW,logger:U().optional(),data:c()}),EQ=B0.extend({method:E("notifications/message"),params:RQ}),IQ=Z({name:U().optional()}),CQ=Z({hints:A(IQ).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),_Q=Z({mode:Q0(["auto","required","none"]).optional()}),AQ=Z({type:E("tool_result"),toolUseId:U().describe("The unique identifier for the corresponding tool call."),content:A(n9).default([]),structuredContent:Z({}).loose().optional(),isError:n().optional(),_meta:v(U(),c()).optional()}),jQ=m9("type",[o9,i9,r9]),g1=m9("type",[o9,i9,r9,zQ,AQ]),SQ=Z({role:B1,content:y([g1,A(g1)]),_meta:v(U(),c()).optional()}),bQ=y1.extend({messages:A(SQ),modelPreferences:CQ.optional(),systemPrompt:U().optional(),includeContext:Q0(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:A(U()).optional(),metadata:i.optional(),tools:A(rW).optional(),toolChoice:_Q.optional()}),TQ=a.extend({method:E("sampling/createMessage"),params:bQ}),kQ=s.extend({model:U(),stopReason:m(Q0(["endTurn","stopSequence","maxTokens"]).or(U())),role:B1,content:jQ}),vQ=s.extend({model:U(),stopReason:m(Q0(["endTurn","stopSequence","maxTokens","toolUse"]).or(U())),role:B1,content:y([g1,A(g1)])}),xQ=Z({type:E("boolean"),title:U().optional(),description:U().optional(),default:n().optional()}),gQ=Z({type:E("string"),title:U().optional(),description:U().optional(),minLength:k().optional(),maxLength:k().optional(),format:Q0(["email","uri","date","date-time"]).optional(),default:U().optional()}),hQ=Z({type:Q0(["number","integer"]),title:U().optional(),description:U().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),yQ=Z({type:E("string"),title:U().optional(),description:U().optional(),enum:A(U()),default:U().optional()}),fQ=Z({type:E("string"),title:U().optional(),description:U().optional(),oneOf:A(Z({const:U(),title:U()})),default:U().optional()}),cQ=Z({type:E("string"),title:U().optional(),description:U().optional(),enum:A(U()),enumNames:A(U()).optional(),default:U().optional()}),mQ=y([yQ,fQ]),uQ=Z({type:E("array"),title:U().optional(),description:U().optional(),minItems:k().optional(),maxItems:k().optional(),items:Z({type:E("string"),enum:A(U())}),default:A(U()).optional()}),pQ=Z({type:E("array"),title:U().optional(),description:U().optional(),minItems:k().optional(),maxItems:k().optional(),items:Z({anyOf:A(Z({const:U(),title:U()}))}),default:A(U()).optional()}),lQ=y([uQ,pQ]),dQ=y([cQ,mQ,lQ]),oQ=y([dQ,xQ,gQ,hQ]),iQ=y1.extend({mode:E("form").optional(),message:U(),requestedSchema:Z({type:E("object"),properties:v(U(),oQ),required:A(U()).optional()})}),rQ=y1.extend({mode:E("url"),message:U(),elicitationId:U(),url:U().url()}),nQ=y([iQ,rQ]),tQ=a.extend({method:E("elicitation/create"),params:nQ}),aQ=z0.extend({elicitationId:U()}),sQ=B0.extend({method:E("notifications/elicitation/complete"),params:aQ}),eQ=s.extend({action:Q0(["accept","decline","cancel"]),content:u9((W)=>W===null?void 0:W,v(U(),y([U(),k(),n(),A(U())])).optional())}),W7=Z({type:E("ref/resource"),uri:U()});var X7=Z({type:E("ref/prompt"),name:U()}),Y7=q0.extend({ref:y([X7,W7]),argument:Z({name:U(),value:U()}),context:Z({arguments:v(U(),U()).optional()}).optional()}),Q7=a.extend({method:E("completion/complete"),params:Y7});var K7=s.extend({completion:W0({values:A(U()).max(100),total:m(k().int()),hasMore:m(n())})}),G7=Z({uri:U().startsWith("file://"),name:U().optional(),_meta:v(U(),c()).optional()}),q7=a.extend({method:E("roots/list"),params:q0.optional()}),J7=s.extend({roots:A(G7)}),z7=B0.extend({method:E("notifications/roots/list_changed"),params:z0.optional()}),JG=y([vW,TY,Q7,ZQ,JQ,KQ,uY,lY,iY,aY,eY,VQ,MQ,yW,cW,mW,pW]),zG=y([TW,xW,xY,z7,hW]),BG=y([bW,kQ,vQ,eQ,J7,fW,uW,gW]),$G=y([vW,TQ,tQ,q7,yW,cW,mW,pW]),HG=y([TW,xW,EQ,XQ,nY,NQ,LQ,hW,sQ]),UG=y([bW,vY,K7,UQ,GQ,pY,dY,rY,nW,FQ,fW,uW,gW]);var B7=10485760;class t9{constructor(W){this._maxBufferSize=W?.maxBufferSize??B7}append(W){if((this._buffer?.length??0)+W.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,W]):W}readMessage(){if(!this._buffer)return null;let W=this._buffer.indexOf(`
|
|
70
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let J of W.seen.entries()){let G=J[1];if(X===J[0]){q(J);continue}if(W.external){let D=W.external.registry.get(J[0])?.id;if(X!==J[0]&&D){q(J);continue}}if(W.metadataRegistry.get(J[0])?.id){q(J);continue}if(G.cycle){q(J);continue}if(G.count>1){if(W.reused==="ref"){q(J);continue}}}}function v9(W,X){let Q=W.seen.get(X);if(!Q)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(G)=>{let H=W.seen.get(G);if(H.ref===null)return;let D=H.def??H.schema,O={...D},V=H.ref;if(H.ref=null,V){Y(V);let P=W.seen.get(V),b=P.schema;if(b.$ref&&(W.target==="draft-07"||W.target==="draft-04"||W.target==="openapi-3.0"))D.allOf=D.allOf??[],D.allOf.push(b);else Object.assign(D,b);if(Object.assign(D,O),G._zod.parent===V)for(let M in D){if(M==="$ref"||M==="allOf")continue;if(!(M in O))delete D[M]}if(b.$ref&&P.def)for(let M in D){if(M==="$ref"||M==="allOf")continue;if(M in P.def&&JSON.stringify(D[M])===JSON.stringify(P.def[M]))delete D[M]}}let R=G._zod.parent;if(R&&R!==V){Y(R);let P=W.seen.get(R);if(P?.schema.$ref){if(D.$ref=P.schema.$ref,P.def)for(let b in D){if(b==="$ref"||b==="allOf")continue;if(b in P.def&&JSON.stringify(D[b])===JSON.stringify(P.def[b]))delete D[b]}}}W.override({zodSchema:G,jsonSchema:D,path:H.path??[]})};for(let G of[...W.seen.entries()].reverse())Y(G[0]);let K={};if(W.target==="draft-2020-12")K.$schema="https://json-schema.org/draft/2020-12/schema";else if(W.target==="draft-07")K.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="draft-04")K.$schema="http://json-schema.org/draft-04/schema#";else if(W.target==="openapi-3.0");if(W.external?.uri){let G=W.external.registry.get(X)?.id;if(!G)throw Error("Schema is missing an `id` property");K.$id=W.external.uri(G)}Object.assign(K,Q.def??Q.schema);let q=W.metadataRegistry.get(X)?.id;if(q!==void 0&&K.id===q)delete K.id;let J=W.external?.defs??{};for(let G of W.seen.entries()){let H=G[1];if(H.def&&H.defId){if(H.def.id===H.defId)delete H.def.id;J[H.defId]=H.def}}if(W.external);else if(Object.keys(J).length>0)if(W.target==="draft-2020-12")K.$defs=J;else K.definitions=J;try{let G=JSON.parse(JSON.stringify(K));return Object.defineProperty(G,"~standard",{value:{...X["~standard"],jsonSchema:{input:X1(X,"input",W.processors),output:X1(X,"output",W.processors)}},enumerable:!1,writable:!1}),G}catch(G){throw Error("Error converting schema to JSON.")}}function e(W,X){let Q=X??{seen:new Set};if(Q.seen.has(W))return!1;Q.seen.add(W);let Y=W._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return e(Y.element,Q);if(Y.type==="set")return e(Y.valueType,Q);if(Y.type==="lazy")return e(Y.getter(),Q);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return e(Y.innerType,Q);if(Y.type==="intersection")return e(Y.left,Q)||e(Y.right,Q);if(Y.type==="record"||Y.type==="map")return e(Y.keyType,Q)||e(Y.valueType,Q);if(Y.type==="pipe"){if(W._zod.traits.has("$ZodCodec"))return!0;return e(Y.in,Q)||e(Y.out,Q)}if(Y.type==="object"){for(let K in Y.shape)if(e(Y.shape[K],Q))return!0;return!1}if(Y.type==="union"){for(let K of Y.options)if(e(K,Q))return!0;return!1}if(Y.type==="tuple"){for(let K of Y.items)if(e(K,Q))return!0;if(Y.rest&&e(Y.rest,Q))return!0;return!1}return!1}var R2=(W,X={})=>(Q)=>{let Y=T9({...Q,processors:X});return d(W,Y),k9(Y,W),v9(Y,W)},X1=(W,X,Q={})=>(Y)=>{let{libraryOptions:K,target:q}=Y??{},J=T9({...K??{},target:q,io:X,processors:Q});return d(W,J),k9(J,W),v9(J,W)};var OX={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},E2=(W,X,Q,Y)=>{let K=Q;K.type="string";let{minimum:q,maximum:J,format:G,patterns:H,contentEncoding:D}=W._zod.bag;if(typeof q==="number")K.minLength=q;if(typeof J==="number")K.maxLength=J;if(G){if(K.format=OX[G]??G,K.format==="")delete K.format;if(G==="time")delete K.format}if(D)K.contentEncoding=D;if(H&&H.size>0){let O=[...H];if(O.length===1)K.pattern=O[0].source;else if(O.length>1)K.allOf=[...O.map((V)=>({...X.target==="draft-07"||X.target==="draft-04"||X.target==="openapi-3.0"?{type:"string"}:{},pattern:V.source}))]}},I2=(W,X,Q,Y)=>{let K=Q,{minimum:q,maximum:J,format:G,multipleOf:H,exclusiveMaximum:D,exclusiveMinimum:O}=W._zod.bag;if(typeof G==="string"&&G.includes("int"))K.type="integer";else K.type="number";let V=typeof O==="number"&&O>=(q??Number.NEGATIVE_INFINITY),R=typeof D==="number"&&D<=(J??Number.POSITIVE_INFINITY),P=X.target==="draft-04"||X.target==="openapi-3.0";if(V)if(P)K.minimum=O,K.exclusiveMinimum=!0;else K.exclusiveMinimum=O;else if(typeof q==="number")K.minimum=q;if(R)if(P)K.maximum=D,K.exclusiveMaximum=!0;else K.exclusiveMaximum=D;else if(typeof J==="number")K.maximum=J;if(typeof H==="number")K.multipleOf=H},C2=(W,X,Q,Y)=>{Q.type="boolean"};var _2=(W,X,Q,Y)=>{if(X.target==="openapi-3.0")Q.type="string",Q.nullable=!0,Q.enum=[null];else Q.type="null"};var A2=(W,X,Q,Y)=>{Q.not={}};var j2=(W,X,Q,Y)=>{};var S2=(W,X,Q,Y)=>{let K=W._zod.def,q=o0(K.entries);if(q.every((J)=>typeof J==="number"))Q.type="number";if(q.every((J)=>typeof J==="string"))Q.type="string";Q.enum=q},b2=(W,X,Q,Y)=>{let K=W._zod.def,q=[];for(let J of K.values)if(J===void 0){if(X.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof J==="bigint")if(X.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else q.push(Number(J));else q.push(J);if(q.length===0);else if(q.length===1){let J=q[0];if(Q.type=J===null?"null":typeof J,X.target==="draft-04"||X.target==="openapi-3.0")Q.enum=[J];else Q.const=J}else{if(q.every((J)=>typeof J==="number"))Q.type="number";if(q.every((J)=>typeof J==="string"))Q.type="string";if(q.every((J)=>typeof J==="boolean"))Q.type="boolean";if(q.every((J)=>J===null))Q.type="null";Q.enum=q}};var T2=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var k2=(W,X,Q,Y)=>{if(X.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var v2=(W,X,Q,Y)=>{let K=Q,q=W._zod.def,{minimum:J,maximum:G}=W._zod.bag;if(typeof J==="number")K.minItems=J;if(typeof G==="number")K.maxItems=G;K.type="array",K.items=d(q.element,X,{...Y,path:[...Y.path,"items"]})},x2=(W,X,Q,Y)=>{let K=Q,q=W._zod.def;K.type="object",K.properties={};let J=q.shape;for(let D in J)K.properties[D]=d(J[D],X,{...Y,path:[...Y.path,"properties",D]});let G=new Set(Object.keys(J)),H=new Set([...G].filter((D)=>{let O=q.shape[D]._zod;if(X.io==="input")return O.optin===void 0;else return O.optout===void 0}));if(H.size>0)K.required=Array.from(H);if(q.catchall?._zod.def.type==="never")K.additionalProperties=!1;else if(!q.catchall){if(X.io==="output")K.additionalProperties=!1}else if(q.catchall)K.additionalProperties=d(q.catchall,X,{...Y,path:[...Y.path,"additionalProperties"]})},g2=(W,X,Q,Y)=>{let K=W._zod.def,q=K.inclusive===!1,J=K.options.map((G,H)=>d(G,X,{...Y,path:[...Y.path,q?"oneOf":"anyOf",H]}));if(q)Q.oneOf=J;else Q.anyOf=J},h2=(W,X,Q,Y)=>{let K=W._zod.def,q=d(K.left,X,{...Y,path:[...Y.path,"allOf",0]}),J=d(K.right,X,{...Y,path:[...Y.path,"allOf",1]}),G=(D)=>("allOf"in D)&&Object.keys(D).length===1,H=[...G(q)?q.allOf:[q],...G(J)?J.allOf:[J]];Q.allOf=H};var y2=(W,X,Q,Y)=>{let K=Q,q=W._zod.def;K.type="object";let J=q.keyType,H=J._zod.bag?.patterns;if(q.mode==="loose"&&H&&H.size>0){let O=d(q.valueType,X,{...Y,path:[...Y.path,"patternProperties","*"]});K.patternProperties={};for(let V of H)K.patternProperties[V.source]=O}else{if(X.target==="draft-07"||X.target==="draft-2020-12")K.propertyNames=d(q.keyType,X,{...Y,path:[...Y.path,"propertyNames"]});K.additionalProperties=d(q.valueType,X,{...Y,path:[...Y.path,"additionalProperties"]})}let D=J._zod.values;if(D){let O=[...D].filter((V)=>typeof V==="string"||typeof V==="number");if(O.length>0)K.required=O}},f2=(W,X,Q,Y)=>{let K=W._zod.def,q=d(K.innerType,X,Y),J=X.seen.get(W);if(X.target==="openapi-3.0")J.ref=K.innerType,Q.nullable=!0;else Q.anyOf=[q,{type:"null"}]},c2=(W,X,Q,Y)=>{let K=W._zod.def;d(K.innerType,X,Y);let q=X.seen.get(W);q.ref=K.innerType},m2=(W,X,Q,Y)=>{let K=W._zod.def;d(K.innerType,X,Y);let q=X.seen.get(W);q.ref=K.innerType,Q.default=JSON.parse(JSON.stringify(K.defaultValue))},u2=(W,X,Q,Y)=>{let K=W._zod.def;d(K.innerType,X,Y);let q=X.seen.get(W);if(q.ref=K.innerType,X.io==="input")Q._prefault=JSON.parse(JSON.stringify(K.defaultValue))},p2=(W,X,Q,Y)=>{let K=W._zod.def;d(K.innerType,X,Y);let q=X.seen.get(W);q.ref=K.innerType;let J;try{J=K.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}Q.default=J},l2=(W,X,Q,Y)=>{let K=W._zod.def,q=K.in._zod.traits.has("$ZodTransform"),J=X.io==="input"?q?K.out:K.in:K.out;d(J,X,Y);let G=X.seen.get(W);G.ref=J},d2=(W,X,Q,Y)=>{let K=W._zod.def;d(K.innerType,X,Y);let q=X.seen.get(W);q.ref=K.innerType,Q.readOnly=!0};var x9=(W,X,Q,Y)=>{let K=W._zod.def;d(K.innerType,X,Y);let q=X.seen.get(W);q.ref=K.innerType};var Y1={};a1(Y1,{time:()=>y9,duration:()=>f9,datetime:()=>g9,date:()=>h9,ZodISOTime:()=>r2,ZodISODuration:()=>n2,ZodISODateTime:()=>o2,ZodISODate:()=>i2});var o2=w("ZodISODateTime",(W,X)=>{Q6.init(W,X),f.init(W,X)});function g9(W){return B2(o2,W)}var i2=w("ZodISODate",(W,X)=>{Y6.init(W,X),f.init(W,X)});function h9(W){return $2(i2,W)}var r2=w("ZodISOTime",(W,X)=>{K6.init(W,X),f.init(W,X)});function y9(W){return H2(r2,W)}var n2=w("ZodISODuration",(W,X)=>{G6.init(W,X),f.init(W,X)});function f9(W){return U2(n2,W)}var _X=(W,X)=>{P1.init(W,X),W.name="ZodError",Object.defineProperties(W,{format:{value:(Q)=>h4(W,Q)},flatten:{value:(Q)=>g4(W,Q)},addIssue:{value:(Q)=>{W.issues.push(Q),W.message=JSON.stringify(W.issues,x0,2)}},addIssues:{value:(Q)=>{W.issues.push(...Q),W.message=JSON.stringify(W.issues,x0,2)}},isEmpty:{get(){return W.issues.length===0}}})};var G0=w("ZodError",_X,{Parent:Error});var t2=Z1(G0),a2=R1(G0),s2=t0(G0),e2=a0(G0),WW=c4(G0),XW=m4(G0),QW=u4(G0),YW=p4(G0),KW=l4(G0),GW=d4(G0),qW=o4(G0),JW=i4(G0);var zW=new WeakMap;function K1(W,X,Q){let Y=Object.getPrototypeOf(W),K=zW.get(Y);if(!K)K=new Set,zW.set(Y,K);if(K.has(X))return;K.add(X);for(let q in Q){let J=Q[q];Object.defineProperty(Y,q,{configurable:!0,enumerable:!1,get(){let G=J.bind(this);return Object.defineProperty(this,q,{configurable:!0,writable:!0,enumerable:!0,value:G}),G},set(G){Object.defineProperty(this,q,{configurable:!0,writable:!0,enumerable:!0,value:G})}})}}var u=w("ZodType",(W,X)=>{return g.init(W,X),Object.assign(W["~standard"],{jsonSchema:{input:X1(W,"input"),output:X1(W,"output")}}),W.toJSONSchema=R2(W,{}),W.def=X,W.type=X.type,Object.defineProperty(W,"_def",{value:X}),W.parse=(Q,Y)=>t2(W,Q,Y,{callee:W.parse}),W.safeParse=(Q,Y)=>s2(W,Q,Y),W.parseAsync=async(Q,Y)=>a2(W,Q,Y,{callee:W.parseAsync}),W.safeParseAsync=async(Q,Y)=>e2(W,Q,Y),W.spa=W.safeParseAsync,W.encode=(Q,Y)=>WW(W,Q,Y),W.decode=(Q,Y)=>XW(W,Q,Y),W.encodeAsync=async(Q,Y)=>QW(W,Q,Y),W.decodeAsync=async(Q,Y)=>YW(W,Q,Y),W.safeEncode=(Q,Y)=>KW(W,Q,Y),W.safeDecode=(Q,Y)=>GW(W,Q,Y),W.safeEncodeAsync=async(Q,Y)=>qW(W,Q,Y),W.safeDecodeAsync=async(Q,Y)=>JW(W,Q,Y),K1(W,"ZodType",{check(...Q){let Y=this.def;return this.clone(S.mergeDefs(Y,{checks:[...Y.checks??[],...Q.map((K)=>typeof K==="function"?{_zod:{check:K,def:{check:"custom"},onattach:[]}}:K)]}),{parent:!0})},with(...Q){return this.check(...Q)},clone(Q,Y){return H0(this,Q,Y)},brand(){return this},register(Q,Y){return Q.add(this,Y),this},refine(Q,Y){return this.check(FQ(Q,Y))},superRefine(Q,Y){return this.check(OQ(Q,Y))},overwrite(Q){return this.check(I0(Q))},optional(){return m(this)},exactOptional(){return GQ(this)},nullable(){return UW(this)},nullish(){return m(UW(this))},nonoptional(Q){return HQ(this,Q)},array(){return A(this)},or(Q){return y([this,Q])},and(Q){return x1(this,Q)},transform(Q){return LW(this,VW(Q))},default(Q){return zQ(this,Q)},prefault(Q){return $Q(this,Q)},catch(Q){return LQ(this,Q)},pipe(Q){return LW(this,Q)},readonly(){return MQ(this)},describe(Q){let Y=this.clone();return j0.add(Y,{description:Q}),Y},meta(...Q){if(Q.length===0)return j0.get(this);let Y=this.clone();return j0.add(Y,Q[0]),Y},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(Q){return Q(this)}}),Object.defineProperty(W,"description",{get(){return j0.get(W)?.description},configurable:!0}),W}),DW=w("_ZodString",(W,X)=>{A1.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,K,q)=>E2(W,Y,K,q);let Q=W._zod.bag;W.format=Q.format??null,W.minLength=Q.minimum??null,W.maxLength=Q.maximum??null,K1(W,"_ZodString",{regex(...Y){return this.check(P9(...Y))},includes(...Y){return this.check(E9(...Y))},startsWith(...Y){return this.check(I9(...Y))},endsWith(...Y){return this.check(C9(...Y))},min(...Y){return this.check(y0(...Y))},max(...Y){return this.check(T1(...Y))},length(...Y){return this.check(k1(...Y))},nonempty(...Y){return this.check(y0(1,...Y))},lowercase(Y){return this.check(Z9(Y))},uppercase(Y){return this.check(R9(Y))},trim(){return this.check(A9())},normalize(...Y){return this.check(_9(...Y))},toLowerCase(){return this.check(j9())},toUpperCase(){return this.check(S9())},slugify(){return this.check(b9())}})}),jX=w("ZodString",(W,X)=>{A1.init(W,X),DW.init(W,X),W.email=(Q)=>W.check(u6(SX,Q)),W.url=(Q)=>W.check(i6(bX,Q)),W.jwt=(Q)=>W.check(z2(oX,Q)),W.emoji=(Q)=>W.check(r6(TX,Q)),W.guid=(Q)=>W.check(N9(BW,Q)),W.uuid=(Q)=>W.check(p6(v1,Q)),W.uuidv4=(Q)=>W.check(l6(v1,Q)),W.uuidv6=(Q)=>W.check(d6(v1,Q)),W.uuidv7=(Q)=>W.check(o6(v1,Q)),W.nanoid=(Q)=>W.check(n6(kX,Q)),W.guid=(Q)=>W.check(N9(BW,Q)),W.cuid=(Q)=>W.check(t6(vX,Q)),W.cuid2=(Q)=>W.check(a6(xX,Q)),W.ulid=(Q)=>W.check(s6(gX,Q)),W.base64=(Q)=>W.check(G2(pX,Q)),W.base64url=(Q)=>W.check(q2(lX,Q)),W.xid=(Q)=>W.check(e6(hX,Q)),W.ksuid=(Q)=>W.check(W2(yX,Q)),W.ipv4=(Q)=>W.check(X2(fX,Q)),W.ipv6=(Q)=>W.check(Q2(cX,Q)),W.cidrv4=(Q)=>W.check(Y2(mX,Q)),W.cidrv6=(Q)=>W.check(K2(uX,Q)),W.e164=(Q)=>W.check(J2(dX,Q)),W.datetime=(Q)=>W.check(g9(Q)),W.date=(Q)=>W.check(h9(Q)),W.time=(Q)=>W.check(y9(Q)),W.duration=(Q)=>W.check(f9(Q))});function U(W){return m6(jX,W)}var f=w("ZodStringFormat",(W,X)=>{h.init(W,X),DW.init(W,X)}),SX=w("ZodEmail",(W,X)=>{i8.init(W,X),f.init(W,X)});var BW=w("ZodGUID",(W,X)=>{d8.init(W,X),f.init(W,X)});var v1=w("ZodUUID",(W,X)=>{o8.init(W,X),f.init(W,X)});var bX=w("ZodURL",(W,X)=>{r8.init(W,X),f.init(W,X)});var TX=w("ZodEmoji",(W,X)=>{n8.init(W,X),f.init(W,X)});var kX=w("ZodNanoID",(W,X)=>{t8.init(W,X),f.init(W,X)});var vX=w("ZodCUID",(W,X)=>{a8.init(W,X),f.init(W,X)});var xX=w("ZodCUID2",(W,X)=>{s8.init(W,X),f.init(W,X)});var gX=w("ZodULID",(W,X)=>{e8.init(W,X),f.init(W,X)});var hX=w("ZodXID",(W,X)=>{W6.init(W,X),f.init(W,X)});var yX=w("ZodKSUID",(W,X)=>{X6.init(W,X),f.init(W,X)});var fX=w("ZodIPv4",(W,X)=>{q6.init(W,X),f.init(W,X)});var cX=w("ZodIPv6",(W,X)=>{J6.init(W,X),f.init(W,X)});var mX=w("ZodCIDRv4",(W,X)=>{z6.init(W,X),f.init(W,X)});var uX=w("ZodCIDRv6",(W,X)=>{B6.init(W,X),f.init(W,X)});var pX=w("ZodBase64",(W,X)=>{H6.init(W,X),f.init(W,X)});var lX=w("ZodBase64URL",(W,X)=>{U6.init(W,X),f.init(W,X)});var dX=w("ZodE164",(W,X)=>{L6.init(W,X),f.init(W,X)});var oX=w("ZodJWT",(W,X)=>{D6.init(W,X),f.init(W,X)});var wW=w("ZodNumber",(W,X)=>{w9.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,K,q)=>I2(W,Y,K,q),K1(W,"ZodNumber",{gt(Y,K){return this.check(S1(Y,K))},gte(Y,K){return this.check(W1(Y,K))},min(Y,K){return this.check(W1(Y,K))},lt(Y,K){return this.check(j1(Y,K))},lte(Y,K){return this.check(e0(Y,K))},max(Y,K){return this.check(e0(Y,K))},int(Y){return this.check($W(Y))},safe(Y){return this.check($W(Y))},positive(Y){return this.check(S1(0,Y))},nonnegative(Y){return this.check(W1(0,Y))},negative(Y){return this.check(j1(0,Y))},nonpositive(Y){return this.check(e0(0,Y))},multipleOf(Y,K){return this.check(b1(Y,K))},step(Y,K){return this.check(b1(Y,K))},finite(){return this}});let Q=W._zod.bag;W.minValue=Math.max(Q.minimum??Number.NEGATIVE_INFINITY,Q.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,W.maxValue=Math.min(Q.maximum??Number.POSITIVE_INFINITY,Q.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,W.isInt=(Q.format??"").includes("int")||Number.isSafeInteger(Q.multipleOf??0.5),W.isFinite=!0,W.format=Q.format??null});function k(W){return L2(wW,W)}var iX=w("ZodNumberFormat",(W,X)=>{w6.init(W,X),wW.init(W,X)});function $W(W){return D2(iX,W)}var rX=w("ZodBoolean",(W,X)=>{M6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>C2(W,Q,Y,K)});function n(W){return w2(rX,W)}var nX=w("ZodNull",(W,X)=>{F6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>_2(W,Q,Y,K)});function MW(W){return M2(nX,W)}var tX=w("ZodUnknown",(W,X)=>{O6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>j2(W,Q,Y,K)});function c(){return F2(tX)}var aX=w("ZodNever",(W,X)=>{V6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>A2(W,Q,Y,K)});function sX(W){return O2(aX,W)}var eX=w("ZodArray",(W,X)=>{N6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>v2(W,Q,Y,K),W.element=X.element,K1(W,"ZodArray",{min(Q,Y){return this.check(y0(Q,Y))},nonempty(Q){return this.check(y0(1,Q))},max(Q,Y){return this.check(T1(Q,Y))},length(Q,Y){return this.check(k1(Q,Y))},unwrap(){return this.element}})});function A(W,X){return V2(eX,W,X)}var FW=w("ZodObject",(W,X)=>{R6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>x2(W,Q,Y,K),S.defineLazy(W,"shape",()=>{return X.shape}),K1(W,"ZodObject",{keyof(){return Y0(Object.keys(this._zod.def.shape))},catchall(Q){return this.clone({...this._zod.def,catchall:Q})},passthrough(){return this.clone({...this._zod.def,catchall:c()})},loose(){return this.clone({...this._zod.def,catchall:c()})},strict(){return this.clone({...this._zod.def,catchall:sX()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(Q){return S.extend(this,Q)},safeExtend(Q){return S.safeExtend(this,Q)},merge(Q){return S.merge(this,Q)},pick(Q){return S.pick(this,Q)},omit(Q){return S.omit(this,Q)},partial(...Q){return S.partial(NW,this,Q[0])},required(...Q){return S.required(PW,this,Q[0])}})});function Z(W,X){let Q={type:"object",shape:W??{},...S.normalizeParams(X)};return new FW(Q)}function W0(W,X){return new FW({type:"object",shape:W,catchall:c(),...S.normalizeParams(X)})}var OW=w("ZodUnion",(W,X)=>{M9.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>g2(W,Q,Y,K),W.options=X.options});function y(W,X){return new OW({type:"union",options:W,...S.normalizeParams(X)})}var WQ=w("ZodDiscriminatedUnion",(W,X)=>{OW.init(W,X),E6.init(W,X)});function m9(W,X,Q){return new WQ({type:"union",options:X,discriminator:W,...S.normalizeParams(Q)})}var XQ=w("ZodIntersection",(W,X)=>{I6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>h2(W,Q,Y,K)});function x1(W,X){return new XQ({type:"intersection",left:W,right:X})}var HW=w("ZodRecord",(W,X)=>{C6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>y2(W,Q,Y,K),W.keyType=X.keyType,W.valueType=X.valueType});function v(W,X,Q){if(!X||!X._zod)return new HW({type:"record",keyType:U(),valueType:W,...S.normalizeParams(X)});return new HW({type:"record",keyType:W,valueType:X,...S.normalizeParams(Q)})}var c9=w("ZodEnum",(W,X)=>{_6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Y,K,q)=>S2(W,Y,K,q),W.enum=X.entries,W.options=Object.values(X.entries);let Q=new Set(Object.keys(X.entries));W.extract=(Y,K)=>{let q={};for(let J of Y)if(Q.has(J))q[J]=X.entries[J];else throw Error(`Key ${J} not found in enum`);return new c9({...X,checks:[],...S.normalizeParams(K),entries:q})},W.exclude=(Y,K)=>{let q={...X.entries};for(let J of Y)if(Q.has(J))delete q[J];else throw Error(`Key ${J} not found in enum`);return new c9({...X,checks:[],...S.normalizeParams(K),entries:q})}});function Y0(W,X){let Q=Array.isArray(W)?Object.fromEntries(W.map((Y)=>[Y,Y])):W;return new c9({type:"enum",entries:Q,...S.normalizeParams(X)})}var QQ=w("ZodLiteral",(W,X)=>{A6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>b2(W,Q,Y,K),W.values=new Set(X.values),Object.defineProperty(W,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function E(W,X){return new QQ({type:"literal",values:Array.isArray(W)?W:[W],...S.normalizeParams(X)})}var YQ=w("ZodTransform",(W,X)=>{j6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>k2(W,Q,Y,K),W._zod.parse=(Q,Y)=>{if(Y.direction==="backward")throw new l0(W.constructor.name);Q.addIssue=(q)=>{if(typeof q==="string")Q.issues.push(S.issue(q,Q.value,X));else{let J=q;if(J.fatal)J.continue=!1;J.code??(J.code="custom"),J.input??(J.input=Q.value),J.inst??(J.inst=W),Q.issues.push(S.issue(J))}};let K=X.transform(Q.value,Q);if(K instanceof Promise)return K.then((q)=>{return Q.value=q,Q.fallback=!0,Q});return Q.value=K,Q.fallback=!0,Q}});function VW(W){return new YQ({type:"transform",transform:W})}var NW=w("ZodOptional",(W,X)=>{F9.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>x9(W,Q,Y,K),W.unwrap=()=>W._zod.def.innerType});function m(W){return new NW({type:"optional",innerType:W})}var KQ=w("ZodExactOptional",(W,X)=>{S6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>x9(W,Q,Y,K),W.unwrap=()=>W._zod.def.innerType});function GQ(W){return new KQ({type:"optional",innerType:W})}var qQ=w("ZodNullable",(W,X)=>{b6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>f2(W,Q,Y,K),W.unwrap=()=>W._zod.def.innerType});function UW(W){return new qQ({type:"nullable",innerType:W})}var JQ=w("ZodDefault",(W,X)=>{T6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>m2(W,Q,Y,K),W.unwrap=()=>W._zod.def.innerType,W.removeDefault=W.unwrap});function zQ(W,X){return new JQ({type:"default",innerType:W,get defaultValue(){return typeof X==="function"?X():S.shallowClone(X)}})}var BQ=w("ZodPrefault",(W,X)=>{k6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>u2(W,Q,Y,K),W.unwrap=()=>W._zod.def.innerType});function $Q(W,X){return new BQ({type:"prefault",innerType:W,get defaultValue(){return typeof X==="function"?X():S.shallowClone(X)}})}var PW=w("ZodNonOptional",(W,X)=>{v6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>c2(W,Q,Y,K),W.unwrap=()=>W._zod.def.innerType});function HQ(W,X){return new PW({type:"nonoptional",innerType:W,...S.normalizeParams(X)})}var UQ=w("ZodCatch",(W,X)=>{x6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>p2(W,Q,Y,K),W.unwrap=()=>W._zod.def.innerType,W.removeCatch=W.unwrap});function LQ(W,X){return new UQ({type:"catch",innerType:W,catchValue:typeof X==="function"?X:()=>X})}var ZW=w("ZodPipe",(W,X)=>{O9.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>l2(W,Q,Y,K),W.in=X.in,W.out=X.out});function LW(W,X){return new ZW({type:"pipe",in:W,out:X})}var DQ=w("ZodPreprocess",(W,X)=>{ZW.init(W,X),g6.init(W,X)}),wQ=w("ZodReadonly",(W,X)=>{h6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>d2(W,Q,Y,K),W.unwrap=()=>W._zod.def.innerType});function MQ(W){return new wQ({type:"readonly",innerType:W})}var RW=w("ZodCustom",(W,X)=>{y6.init(W,X),u.init(W,X),W._zod.processJSONSchema=(Q,Y,K)=>T2(W,Q,Y,K)});function EW(W,X){return N2(RW,W??(()=>!0),X)}function FQ(W,X={}){return P2(RW,W,X)}function OQ(W,X){return Z2(W,X)}function u9(W,X){return new DQ({type:"pipe",in:VW(W),out:X})}K0(V9());var VQ="io.modelcontextprotocol/related-task",h1="2.0",i=EW((W)=>W!==null&&(typeof W==="object"||typeof W==="function")),CW=y([U(),k().int()]),_W=U(),XG=W0({ttl:k().optional(),pollInterval:k().optional()}),NQ=Z({ttl:k().optional()}),PQ=Z({taskId:U()}),p9=W0({progressToken:CW.optional(),[VQ]:PQ.optional()}),q0=Z({_meta:p9.optional()}),y1=q0.extend({task:NQ.optional()});var a=Z({method:U(),params:q0.loose().optional()}),z0=Z({_meta:p9.optional()}),B0=Z({method:U(),params:z0.loose().optional()}),s=W0({_meta:p9.optional()}),f1=y([U(),k().int()]),ZQ=Z({jsonrpc:E(h1),id:f1,...a.shape}).strict();var RQ=Z({jsonrpc:E(h1),...B0.shape}).strict();var AW=Z({jsonrpc:E(h1),id:f1,result:s}).strict();var IW;(function(W){W[W.ConnectionClosed=-32000]="ConnectionClosed",W[W.RequestTimeout=-32001]="RequestTimeout",W[W.ParseError=-32700]="ParseError",W[W.InvalidRequest=-32600]="InvalidRequest",W[W.MethodNotFound=-32601]="MethodNotFound",W[W.InvalidParams=-32602]="InvalidParams",W[W.InternalError=-32603]="InternalError",W[W.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(IW||(IW={}));var jW=Z({jsonrpc:E(h1),id:f1.optional(),error:Z({code:k().int(),message:U(),data:c().optional()})}).strict();var SW=y([ZQ,RQ,AW,jW]),QG=y([AW,jW]),bW=s.strict(),EQ=z0.extend({requestId:f1.optional(),reason:U().optional()}),TW=B0.extend({method:E("notifications/cancelled"),params:EQ}),IQ=Z({src:U(),mimeType:U().optional(),sizes:A(U()).optional(),theme:Y0(["light","dark"]).optional()}),G1=Z({icons:A(IQ).optional()}),f0=Z({name:U(),title:U().optional()}),kW=f0.extend({...f0.shape,...G1.shape,version:U(),websiteUrl:U().optional(),description:U().optional()}),CQ=x1(Z({applyDefaults:n().optional()}),v(U(),c())),_Q=u9((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)){if(Object.keys(W).length===0)return{form:{}}}return W},x1(Z({form:CQ.optional(),url:i.optional()}),v(U(),c()).optional())),AQ=W0({list:i.optional(),cancel:i.optional(),requests:W0({sampling:W0({createMessage:i.optional()}).optional(),elicitation:W0({create:i.optional()}).optional()}).optional()}),jQ=W0({list:i.optional(),cancel:i.optional(),requests:W0({tools:W0({call:i.optional()}).optional()}).optional()}),SQ=Z({experimental:v(U(),i).optional(),sampling:Z({context:i.optional(),tools:i.optional()}).optional(),elicitation:_Q.optional(),roots:Z({listChanged:n().optional()}).optional(),tasks:AQ.optional(),extensions:v(U(),i).optional()}),bQ=q0.extend({protocolVersion:U(),capabilities:SQ,clientInfo:kW}),TQ=a.extend({method:E("initialize"),params:bQ});var kQ=Z({experimental:v(U(),i).optional(),logging:i.optional(),completions:i.optional(),prompts:Z({listChanged:n().optional()}).optional(),resources:Z({subscribe:n().optional(),listChanged:n().optional()}).optional(),tools:Z({listChanged:n().optional()}).optional(),tasks:jQ.optional(),extensions:v(U(),i).optional()}),vQ=s.extend({protocolVersion:U(),capabilities:kQ,serverInfo:kW,instructions:U().optional()}),xQ=B0.extend({method:E("notifications/initialized"),params:z0.optional()});var vW=a.extend({method:E("ping"),params:q0.optional()}),gQ=Z({progress:k(),total:m(k()),message:m(U())}),hQ=Z({...z0.shape,...gQ.shape,progressToken:CW}),xW=B0.extend({method:E("notifications/progress"),params:hQ}),yQ=q0.extend({cursor:_W.optional()}),q1=a.extend({params:yQ.optional()}),J1=s.extend({nextCursor:_W.optional()}),fQ=Y0(["working","input_required","completed","failed","cancelled"]),z1=Z({taskId:U(),status:fQ,ttl:y([k(),MW()]),createdAt:U(),lastUpdatedAt:U(),pollInterval:m(k()),statusMessage:m(U())}),gW=s.extend({task:z1}),cQ=z0.merge(z1),hW=B0.extend({method:E("notifications/tasks/status"),params:cQ}),yW=a.extend({method:E("tasks/get"),params:q0.extend({taskId:U()})}),fW=s.merge(z1),cW=a.extend({method:E("tasks/result"),params:q0.extend({taskId:U()})}),YG=s.loose(),mW=q1.extend({method:E("tasks/list")}),uW=J1.extend({tasks:A(z1)}),pW=a.extend({method:E("tasks/cancel"),params:q0.extend({taskId:U()})}),KG=s.merge(z1),lW=Z({uri:U(),mimeType:m(U()),_meta:v(U(),c()).optional()}),dW=lW.extend({text:U()}),l9=U().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),oW=lW.extend({blob:l9}),B1=Y0(["user","assistant"]),c0=Z({audience:A(B1).optional(),priority:k().min(0).max(1).optional(),lastModified:Y1.datetime({offset:!0}).optional()}),iW=Z({...f0.shape,...G1.shape,uri:U(),description:m(U()),mimeType:m(U()),size:m(k()),annotations:c0.optional(),_meta:m(W0({}))}),mQ=Z({...f0.shape,...G1.shape,uriTemplate:U(),description:m(U()),mimeType:m(U()),annotations:c0.optional(),_meta:m(W0({}))}),uQ=q1.extend({method:E("resources/list")}),pQ=J1.extend({resources:A(iW)}),lQ=q1.extend({method:E("resources/templates/list")}),dQ=J1.extend({resourceTemplates:A(mQ)}),d9=q0.extend({uri:U()}),oQ=d9,iQ=a.extend({method:E("resources/read"),params:oQ}),rQ=s.extend({contents:A(y([dW,oW]))}),nQ=B0.extend({method:E("notifications/resources/list_changed"),params:z0.optional()}),tQ=d9,aQ=a.extend({method:E("resources/subscribe"),params:tQ}),sQ=d9,eQ=a.extend({method:E("resources/unsubscribe"),params:sQ}),WY=z0.extend({uri:U()}),XY=B0.extend({method:E("notifications/resources/updated"),params:WY}),QY=Z({name:U(),description:m(U()),required:m(n())}),YY=Z({...f0.shape,...G1.shape,description:m(U()),arguments:m(A(QY)),_meta:m(W0({}))}),KY=q1.extend({method:E("prompts/list")}),GY=J1.extend({prompts:A(YY)}),qY=q0.extend({name:U(),arguments:v(U(),U()).optional()}),JY=a.extend({method:E("prompts/get"),params:qY}),o9=Z({type:E("text"),text:U(),annotations:c0.optional(),_meta:v(U(),c()).optional()}),i9=Z({type:E("image"),data:l9,mimeType:U(),annotations:c0.optional(),_meta:v(U(),c()).optional()}),r9=Z({type:E("audio"),data:l9,mimeType:U(),annotations:c0.optional(),_meta:v(U(),c()).optional()}),zY=Z({type:E("tool_use"),name:U(),id:U(),input:v(U(),c()),_meta:v(U(),c()).optional()}),BY=Z({type:E("resource"),resource:y([dW,oW]),annotations:c0.optional(),_meta:v(U(),c()).optional()}),$Y=iW.extend({type:E("resource_link")}),n9=y([o9,i9,r9,$Y,BY]),HY=Z({role:B1,content:n9}),UY=s.extend({description:U().optional(),messages:A(HY)}),LY=B0.extend({method:E("notifications/prompts/list_changed"),params:z0.optional()}),DY=Z({title:U().optional(),readOnlyHint:n().optional(),destructiveHint:n().optional(),idempotentHint:n().optional(),openWorldHint:n().optional()}),wY=Z({taskSupport:Y0(["required","optional","forbidden"]).optional()}),rW=Z({...f0.shape,...G1.shape,description:U().optional(),inputSchema:Z({type:E("object"),properties:v(U(),i).optional(),required:A(U()).optional()}).catchall(c()),outputSchema:Z({type:E("object"),properties:v(U(),i).optional(),required:A(U()).optional()}).catchall(c()).optional(),annotations:DY.optional(),execution:wY.optional(),_meta:v(U(),c()).optional()}),MY=q1.extend({method:E("tools/list")}),FY=J1.extend({tools:A(rW)}),nW=s.extend({content:A(n9).default([]),structuredContent:v(U(),c()).optional(),isError:n().optional()}),GG=nW.or(s.extend({toolResult:c()})),OY=y1.extend({name:U(),arguments:v(U(),c()).optional()}),VY=a.extend({method:E("tools/call"),params:OY}),NY=B0.extend({method:E("notifications/tools/list_changed"),params:z0.optional()}),qG=Z({autoRefresh:n().default(!0),debounceMs:k().int().nonnegative().default(300)}),tW=Y0(["debug","info","notice","warning","error","critical","alert","emergency"]),PY=q0.extend({level:tW}),ZY=a.extend({method:E("logging/setLevel"),params:PY}),RY=z0.extend({level:tW,logger:U().optional(),data:c()}),EY=B0.extend({method:E("notifications/message"),params:RY}),IY=Z({name:U().optional()}),CY=Z({hints:A(IY).optional(),costPriority:k().min(0).max(1).optional(),speedPriority:k().min(0).max(1).optional(),intelligencePriority:k().min(0).max(1).optional()}),_Y=Z({mode:Y0(["auto","required","none"]).optional()}),AY=Z({type:E("tool_result"),toolUseId:U().describe("The unique identifier for the corresponding tool call."),content:A(n9).default([]),structuredContent:Z({}).loose().optional(),isError:n().optional(),_meta:v(U(),c()).optional()}),jY=m9("type",[o9,i9,r9]),g1=m9("type",[o9,i9,r9,zY,AY]),SY=Z({role:B1,content:y([g1,A(g1)]),_meta:v(U(),c()).optional()}),bY=y1.extend({messages:A(SY),modelPreferences:CY.optional(),systemPrompt:U().optional(),includeContext:Y0(["none","thisServer","allServers"]).optional(),temperature:k().optional(),maxTokens:k().int(),stopSequences:A(U()).optional(),metadata:i.optional(),tools:A(rW).optional(),toolChoice:_Y.optional()}),TY=a.extend({method:E("sampling/createMessage"),params:bY}),kY=s.extend({model:U(),stopReason:m(Y0(["endTurn","stopSequence","maxTokens"]).or(U())),role:B1,content:jY}),vY=s.extend({model:U(),stopReason:m(Y0(["endTurn","stopSequence","maxTokens","toolUse"]).or(U())),role:B1,content:y([g1,A(g1)])}),xY=Z({type:E("boolean"),title:U().optional(),description:U().optional(),default:n().optional()}),gY=Z({type:E("string"),title:U().optional(),description:U().optional(),minLength:k().optional(),maxLength:k().optional(),format:Y0(["email","uri","date","date-time"]).optional(),default:U().optional()}),hY=Z({type:Y0(["number","integer"]),title:U().optional(),description:U().optional(),minimum:k().optional(),maximum:k().optional(),default:k().optional()}),yY=Z({type:E("string"),title:U().optional(),description:U().optional(),enum:A(U()),default:U().optional()}),fY=Z({type:E("string"),title:U().optional(),description:U().optional(),oneOf:A(Z({const:U(),title:U()})),default:U().optional()}),cY=Z({type:E("string"),title:U().optional(),description:U().optional(),enum:A(U()),enumNames:A(U()).optional(),default:U().optional()}),mY=y([yY,fY]),uY=Z({type:E("array"),title:U().optional(),description:U().optional(),minItems:k().optional(),maxItems:k().optional(),items:Z({type:E("string"),enum:A(U())}),default:A(U()).optional()}),pY=Z({type:E("array"),title:U().optional(),description:U().optional(),minItems:k().optional(),maxItems:k().optional(),items:Z({anyOf:A(Z({const:U(),title:U()}))}),default:A(U()).optional()}),lY=y([uY,pY]),dY=y([cY,mY,lY]),oY=y([dY,xY,gY,hY]),iY=y1.extend({mode:E("form").optional(),message:U(),requestedSchema:Z({type:E("object"),properties:v(U(),oY),required:A(U()).optional()})}),rY=y1.extend({mode:E("url"),message:U(),elicitationId:U(),url:U().url()}),nY=y([iY,rY]),tY=a.extend({method:E("elicitation/create"),params:nY}),aY=z0.extend({elicitationId:U()}),sY=B0.extend({method:E("notifications/elicitation/complete"),params:aY}),eY=s.extend({action:Y0(["accept","decline","cancel"]),content:u9((W)=>W===null?void 0:W,v(U(),y([U(),k(),n(),A(U())])).optional())}),W7=Z({type:E("ref/resource"),uri:U()});var X7=Z({type:E("ref/prompt"),name:U()}),Q7=q0.extend({ref:y([X7,W7]),argument:Z({name:U(),value:U()}),context:Z({arguments:v(U(),U()).optional()}).optional()}),Y7=a.extend({method:E("completion/complete"),params:Q7});var K7=s.extend({completion:W0({values:A(U()).max(100),total:m(k().int()),hasMore:m(n())})}),G7=Z({uri:U().startsWith("file://"),name:U().optional(),_meta:v(U(),c()).optional()}),q7=a.extend({method:E("roots/list"),params:q0.optional()}),J7=s.extend({roots:A(G7)}),z7=B0.extend({method:E("notifications/roots/list_changed"),params:z0.optional()}),JG=y([vW,TQ,Y7,ZY,JY,KY,uQ,lQ,iQ,aQ,eQ,VY,MY,yW,cW,mW,pW]),zG=y([TW,xW,xQ,z7,hW]),BG=y([bW,kY,vY,eY,J7,fW,uW,gW]),$G=y([vW,TY,tY,q7,yW,cW,mW,pW]),HG=y([TW,xW,EY,XY,nQ,NY,LY,hW,sY]),UG=y([bW,vQ,K7,UY,GY,pQ,dQ,rQ,nW,FY,fW,uW,gW]);var B7=10485760;class t9{constructor(W){this._maxBufferSize=W?.maxBufferSize??B7}append(W){if((this._buffer?.length??0)+W.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,W]):W}readMessage(){if(!this._buffer)return null;let W=this._buffer.indexOf(`
|
|
71
71
|
`);if(W===-1)return null;let X=this._buffer.toString("utf8",0,W).replace(/\r$/,"");return this._buffer=this._buffer.subarray(W+1),$7(X)}clear(){this._buffer=void 0}}function $7(W){return SW.parse(JSON.parse(W))}function aW(W){return JSON.stringify(W)+`
|
|
72
|
-
`}class c1{constructor(W=sW.stdin,X=sW.stdout,
|
|
72
|
+
`}class c1{constructor(W=sW.stdin,X=sW.stdout,Q){this._stdin=W,this._stdout=X,this._started=!1,this._ondata=(Y)=>{try{this._readBuffer.append(Y),this.processReadBuffer()}catch(K){this.onerror?.(K),this.close().catch(()=>{})}},this._onerror=(Y)=>{this.onerror?.(Y)},this._readBuffer=new t9({maxBufferSize:Q?.maxBufferSize})}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;this.onmessage?.(W)}catch(W){this.onerror?.(W)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(W){return new Promise((X)=>{let Q=aW(W);if(this._stdout.write(Q))X();else this._stdout.once("drain",X)})}}import{existsSync as c7}from"node:fs";u1();async function V3(W){let X=$4(await W),[Q,Y,{QuickJSWASMModule:K}]=await Promise.all([X.importModuleLoader().then($4),X.importFFI(),Promise.resolve().then(() => (O3(),F3)).then($4)]),q=await Q();q.type="sync";let J=new Y(q);return new K(q,J)}function $4(W){return W&&"default"in W&&W.default?W.default&&"default"in W.default&&W.default.default?W.default.default:W.default:W}var P3="engine";function T7(W){let X=(Q)=>new URL(Q,W).href;return{type:"sync",importFFI:()=>import(X("ffi.mjs")).then((Q)=>Q.QuickJSFFI),importModuleLoader:()=>import(X("emscripten-module.mjs")).then((Q)=>Q.default)}}var N3=null;function Z3(W){return()=>{return N3??=V3(T7(W)),N3}}var k7=x3(E3(),1);var x7="__mcpcloud_call_tool",Hq=`globalThis.tool = (name, args) =>
|
|
73
73
|
globalThis.${x7}(String(name), JSON.stringify(args ?? {}))
|
|
74
74
|
.then((json) => JSON.parse(json));`;var g7=6,h7=["log","warn","error","info","debug"],y7="__mcpcloud_console",Dq=`globalThis.console = {
|
|
75
75
|
${h7.map((W)=>` ${W}: (...args) => globalThis.${y7}(${JSON.stringify(W)}, JSON.stringify(args.slice(0, ${g7}).map((value) => (value instanceof Error ? { __mcpcloudError: value.name + ': ' + value.message } : value)))),`).join(`
|
|
76
76
|
`)}
|
|
77
|
-
};`;var f7=
|
|
77
|
+
};`;var f7=Symbol.for("@mcpcloud/runtime.codeModeEngineProvider");function I3(W){globalThis[f7]=W}var C3=[`./${P3}/`,"../engine/vendor/","../../engine/vendor/"];function m7(W=new URL(import.meta.url)){for(let X of C3){let Q=new URL(X,W);if(c7(new URL("emscripten-module.wasm",Q)))return Q}throw Error(`Code Mode engine not found. Looked for emscripten-module.wasm in: ${C3.join(", ")} (relative to ${W.href}).`)}function _3(){I3(()=>Z3(m7())())}async function u7(W,X){_3();let Q=W.createServer(X),Y=new c1;await Q.connect(Y)}export{u7 as startStdioServer,c1 as StdioServerTransport};
|