@mcpcloud/runtime 0.7.1 → 0.12.1
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/codeModeHost.d.ts +25 -0
- package/dist/compat-stdio.js +48 -23
- package/dist/compat-worker.js +58 -89
- package/dist/container-host.js +12 -2
- package/dist/engine/emscripten-module.cloudflare.cjs +21 -0
- package/dist/engine/emscripten-module.cloudflare.d.cts +3 -0
- package/dist/engine/emscripten-module.d.mts +3 -0
- package/dist/engine/emscripten-module.d.ts +11 -0
- package/dist/engine/emscripten-module.mjs +26 -0
- package/dist/engine/emscripten-module.wasm +0 -0
- package/dist/engine/ffi.d.mts +4 -0
- package/dist/engine/ffi.d.ts +85 -0
- package/dist/engine/ffi.mjs +1 -0
- package/dist/engine/manifest.json +51 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +71 -85
- package/dist/node.js +12 -2
- package/dist/projection.d.ts +9 -0
- package/dist/sandbox/bindings.d.ts +116 -0
- package/dist/sandbox/codeModeTool.d.ts +114 -0
- package/dist/sandbox/console.d.ts +51 -0
- package/dist/sandbox/createSandbox.d.ts +16 -1
- package/dist/sandbox/nodeEngine.d.ts +30 -0
- package/dist/sandbox/shape.d.ts +68 -0
- package/dist/sandbox/types.d.ts +80 -2
- package/dist/server.d.ts +13 -0
- package/dist/stdio.js +59 -24
- package/dist/validation.d.ts +16 -0
- package/package.json +1 -1
package/dist/stdio.js
CHANGED
|
@@ -1,42 +1,77 @@
|
|
|
1
|
-
/*! @mcpcloud/runtime v0.
|
|
2
|
-
var T4=Object.defineProperty;var _4=(W)=>W;function Z4(W,Q){this[W]=_4.bind(null,Q)}var YY=(W,Q)=>{for(var Y in Q)T4(W,Y,{get:Q[Y],enumerable:!0,configurable:!0,set:Z4.bind(Q,Y)})};import E4 from"node:process";var J2=Object.freeze({status:"aborted"});function K(W,Q,Y){function X(w,q){if(!w._zod)Object.defineProperty(w,"_zod",{value:{def:q,constr:H,traits:new Set},enumerable:!1});if(w._zod.traits.has(W))return;w._zod.traits.add(W),Q(w,q);let L=H.prototype,B=Object.keys(L);for(let z=0;z<B.length;z++){let I=B[z];if(!(I in w))w[I]=L[I].bind(w)}}let G=Y?.Parent??Object;class J extends G{}Object.defineProperty(J,"name",{value:W});function H(w){var q;let L=Y?.Parent?new J:this;X(L,w),(q=L._zod).deferred??(q.deferred=[]);for(let B of L._zod.deferred)B();return L}return Object.defineProperty(H,"init",{value:X}),Object.defineProperty(H,Symbol.hasInstance,{value:(w)=>{if(Y?.Parent&&w instanceof Y.Parent)return!0;return w?._zod?.traits?.has(W)}}),Object.defineProperty(H,"name",{value:W}),H}var H2=Symbol("zod_brand");class a extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class MW extends Error{constructor(W){super(`Encountered unidirectional transform during encode: ${W}`);this.name="ZodEncodeError"}}var vW={};function r(W){if(W)Object.assign(vW,W);return vW}var D={};YY(D,{unwrapMessage:()=>zW,uint8ArrayToHex:()=>Q6,uint8ArrayToBase64url:()=>s4,uint8ArrayToBase64:()=>qY,stringifyPrimitive:()=>cW,slugify:()=>wQ,shallowClone:()=>GY,safeExtend:()=>d4,required:()=>t4,randomString:()=>y4,propertyKeyTypes:()=>qQ,promiseAllObject:()=>u4,primitiveTypes:()=>JY,prefixIssues:()=>QW,pick:()=>l4,partial:()=>i4,parsedType:()=>BQ,optionalKeys:()=>KQ,omit:()=>r4,objectClone:()=>h4,numKeys:()=>m4,nullish:()=>IW,normalizeParams:()=>U,mergeDefs:()=>s,merge:()=>n4,jsonStringifyReplacer:()=>AW,joinValues:()=>gW,issue:()=>KW,isPlainObject:()=>XW,isObject:()=>HW,hexToUint8Array:()=>W6,getSizableOrigin:()=>wY,getParsedType:()=>f4,getLengthableOrigin:()=>OW,getEnumValues:()=>UW,getElementAtPath:()=>c4,floatSafeRemainder:()=>HQ,finalizeIssue:()=>t,extend:()=>p4,escapeRegex:()=>WW,esc:()=>hW,defineLazy:()=>F,createTransparentProxy:()=>o4,cloneDef:()=>x4,clone:()=>i,cleanRegex:()=>VW,cleanEnum:()=>e4,captureStackTrace:()=>xW,cached:()=>qW,base64urlToUint8Array:()=>a4,base64ToUint8Array:()=>AY,assignProp:()=>YW,assertNotEqual:()=>j4,assertNever:()=>v4,assertIs:()=>k4,assertEqual:()=>C4,assert:()=>g4,allowsEval:()=>AQ,aborted:()=>GW,NUMBER_FORMAT_RANGES:()=>LQ,Class:()=>KY,BIGINT_FORMAT_RANGES:()=>HY});function C4(W){return W}function j4(W){return W}function k4(W){}function v4(W){throw Error("Unexpected value in exhaustive check")}function g4(W){}function UW(W){let Q=Object.values(W).filter((X)=>typeof X==="number");return Object.entries(W).filter(([X,G])=>Q.indexOf(+X)===-1).map(([X,G])=>G)}function gW(W,Q="|"){return W.map((Y)=>cW(Y)).join(Q)}function AW(W,Q){if(typeof Q==="bigint")return Q.toString();return Q}function qW(W){return{get value(){{let Y=W();return Object.defineProperty(this,"value",{value:Y}),Y}throw Error("cached value already set")}}}function IW(W){return W===null||W===void 0}function VW(W){let Q=W.startsWith("^")?1:0,Y=W.endsWith("$")?W.length-1:W.length;return W.slice(Q,Y)}function HQ(W,Q){let Y=(W.toString().split(".")[1]||"").length,X=Q.toString(),G=(X.split(".")[1]||"").length;if(G===0&&/\d?e-\d?/.test(X)){let q=X.match(/\d?e-(\d?)/);if(q?.[1])G=Number.parseInt(q[1])}let J=Y>G?Y:G,H=Number.parseInt(W.toFixed(J).replace(".","")),w=Number.parseInt(Q.toFixed(J).replace(".",""));return H%w/10**J}var XY=Symbol("evaluating");function F(W,Q,Y){let X=void 0;Object.defineProperty(W,Q,{get(){if(X===XY)return;if(X===void 0)X=XY,X=Y();return X},set(G){Object.defineProperty(W,Q,{value:G})},configurable:!0})}function h4(W){return Object.create(Object.getPrototypeOf(W),Object.getOwnPropertyDescriptors(W))}function YW(W,Q,Y){Object.defineProperty(W,Q,{value:Y,writable:!0,enumerable:!0,configurable:!0})}function s(...W){let Q={};for(let Y of W){let X=Object.getOwnPropertyDescriptors(Y);Object.assign(Q,X)}return Object.defineProperties({},Q)}function x4(W){return s(W._zod.def)}function c4(W,Q){if(!Q)return W;return Q.reduce((Y,X)=>Y?.[X],W)}function u4(W){let Q=Object.keys(W),Y=Q.map((X)=>W[X]);return Promise.all(Y).then((X)=>{let G={};for(let J=0;J<Q.length;J++)G[Q[J]]=X[J];return G})}function y4(W=10){let Y="";for(let X=0;X<W;X++)Y+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return Y}function hW(W){return JSON.stringify(W)}function wQ(W){return W.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var xW="captureStackTrace"in Error?Error.captureStackTrace:(...W)=>{};function HW(W){return typeof W==="object"&&W!==null&&!Array.isArray(W)}var AQ=qW(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(W){return!1}});function XW(W){if(HW(W)===!1)return!1;let Q=W.constructor;if(Q===void 0)return!0;if(typeof Q!=="function")return!0;let Y=Q.prototype;if(HW(Y)===!1)return!1;if(Object.prototype.hasOwnProperty.call(Y,"isPrototypeOf")===!1)return!1;return!0}function GY(W){if(XW(W))return{...W};if(Array.isArray(W))return[...W];return W}function m4(W){let Q=0;for(let Y in W)if(Object.prototype.hasOwnProperty.call(W,Y))Q++;return Q}var f4=(W)=>{let Q=typeof W;switch(Q){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: ${Q}`)}},qQ=new Set(["string","number","symbol"]),JY=new Set(["string","number","bigint","boolean","symbol","undefined"]);function WW(W){return W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function i(W,Q,Y){let X=new W._zod.constr(Q??W._zod.def);if(!Q||Y?.parent)X._zod.parent=W;return X}function U(W){let Q=W;if(!Q)return{};if(typeof Q==="string")return{error:()=>Q};if(Q?.message!==void 0){if(Q?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Q.error=Q.message}if(delete Q.message,typeof Q.error==="string")return{...Q,error:()=>Q.error};return Q}function o4(W){let Q;return new Proxy({},{get(Y,X,G){return Q??(Q=W()),Reflect.get(Q,X,G)},set(Y,X,G,J){return Q??(Q=W()),Reflect.set(Q,X,G,J)},has(Y,X){return Q??(Q=W()),Reflect.has(Q,X)},deleteProperty(Y,X){return Q??(Q=W()),Reflect.deleteProperty(Q,X)},ownKeys(Y){return Q??(Q=W()),Reflect.ownKeys(Q)},getOwnPropertyDescriptor(Y,X){return Q??(Q=W()),Reflect.getOwnPropertyDescriptor(Q,X)},defineProperty(Y,X,G){return Q??(Q=W()),Reflect.defineProperty(Q,X,G)}})}function cW(W){if(typeof W==="bigint")return W.toString()+"n";if(typeof W==="string")return`"${W}"`;return`${W}`}function KQ(W){return Object.keys(W).filter((Q)=>{return W[Q]._zod.optin==="optional"&&W[Q]._zod.optout==="optional"})}var LQ={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]},HY={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function l4(W,Q){let Y=W._zod.def,X=Y.checks;if(X&&X.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let J=s(W._zod.def,{get shape(){let H={};for(let w in Q){if(!(w in Y.shape))throw Error(`Unrecognized key: "${w}"`);if(!Q[w])continue;H[w]=Y.shape[w]}return YW(this,"shape",H),H},checks:[]});return i(W,J)}function r4(W,Q){let Y=W._zod.def,X=Y.checks;if(X&&X.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let J=s(W._zod.def,{get shape(){let H={...W._zod.def.shape};for(let w in Q){if(!(w in Y.shape))throw Error(`Unrecognized key: "${w}"`);if(!Q[w])continue;delete H[w]}return YW(this,"shape",H),H},checks:[]});return i(W,J)}function p4(W,Q){if(!XW(Q))throw Error("Invalid input to extend: expected a plain object");let Y=W._zod.def.checks;if(Y&&Y.length>0){let J=W._zod.def.shape;for(let H in Q)if(Object.getOwnPropertyDescriptor(J,H)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let G=s(W._zod.def,{get shape(){let J={...W._zod.def.shape,...Q};return YW(this,"shape",J),J}});return i(W,G)}function d4(W,Q){if(!XW(Q))throw Error("Invalid input to safeExtend: expected a plain object");let Y=s(W._zod.def,{get shape(){let X={...W._zod.def.shape,...Q};return YW(this,"shape",X),X}});return i(W,Y)}function n4(W,Q){let Y=s(W._zod.def,{get shape(){let X={...W._zod.def.shape,...Q._zod.def.shape};return YW(this,"shape",X),X},get catchall(){return Q._zod.def.catchall},checks:[]});return i(W,Y)}function i4(W,Q,Y){let G=Q._zod.def.checks;if(G&&G.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let H=s(Q._zod.def,{get shape(){let w=Q._zod.def.shape,q={...w};if(Y)for(let L in Y){if(!(L in w))throw Error(`Unrecognized key: "${L}"`);if(!Y[L])continue;q[L]=W?new W({type:"optional",innerType:w[L]}):w[L]}else for(let L in w)q[L]=W?new W({type:"optional",innerType:w[L]}):w[L];return YW(this,"shape",q),q},checks:[]});return i(Q,H)}function t4(W,Q,Y){let X=s(Q._zod.def,{get shape(){let G=Q._zod.def.shape,J={...G};if(Y)for(let H in Y){if(!(H in J))throw Error(`Unrecognized key: "${H}"`);if(!Y[H])continue;J[H]=new W({type:"nonoptional",innerType:G[H]})}else for(let H in G)J[H]=new W({type:"nonoptional",innerType:G[H]});return YW(this,"shape",J),J}});return i(Q,X)}function GW(W,Q=0){if(W.aborted===!0)return!0;for(let Y=Q;Y<W.issues.length;Y++)if(W.issues[Y]?.continue!==!0)return!0;return!1}function QW(W,Q){return Q.map((Y)=>{var X;return(X=Y).path??(X.path=[]),Y.path.unshift(W),Y})}function zW(W){return typeof W==="string"?W:W?.message}function t(W,Q,Y){let X={...W,path:W.path??[]};if(!W.message){let G=zW(W.inst?._zod.def?.error?.(W))??zW(Q?.error?.(W))??zW(Y.customError?.(W))??zW(Y.localeError?.(W))??"Invalid input";X.message=G}if(delete X.inst,delete X.continue,!Q?.reportInput)delete X.input;return X}function wY(W){if(W instanceof Set)return"set";if(W instanceof Map)return"map";if(W instanceof File)return"file";return"unknown"}function OW(W){if(Array.isArray(W))return"array";if(typeof W==="string")return"string";return"unknown"}function BQ(W){let Q=typeof W;switch(Q){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 Q}function KW(...W){let[Q,Y,X]=W;if(typeof Q==="string")return{message:Q,code:"custom",input:Y,inst:X};return{...Q}}function e4(W){return Object.entries(W).filter(([Q,Y])=>{return Number.isNaN(Number.parseInt(Q,10))}).map((Q)=>Q[1])}function AY(W){let Q=atob(W),Y=new Uint8Array(Q.length);for(let X=0;X<Q.length;X++)Y[X]=Q.charCodeAt(X);return Y}function qY(W){let Q="";for(let Y=0;Y<W.length;Y++)Q+=String.fromCharCode(W[Y]);return btoa(Q)}function a4(W){let Q=W.replace(/-/g,"+").replace(/_/g,"/"),Y="=".repeat((4-Q.length%4)%4);return AY(Q+Y)}function s4(W){return qY(W).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function W6(W){let Q=W.replace(/^0x/,"");if(Q.length%2!==0)throw Error("Invalid hex string length");let Y=new Uint8Array(Q.length/2);for(let X=0;X<Q.length;X+=2)Y[X/2]=Number.parseInt(Q.slice(X,X+2),16);return Y}function Q6(W){return Array.from(W).map((Q)=>Q.toString(16).padStart(2,"0")).join("")}class KY{constructor(...W){}}var LY=(W,Q)=>{W.name="$ZodError",Object.defineProperty(W,"_zod",{value:W._zod,enumerable:!1}),Object.defineProperty(W,"issues",{value:Q,enumerable:!1}),W.message=JSON.stringify(Q,AW,2),Object.defineProperty(W,"toString",{value:()=>W.message,enumerable:!1})},uW=K("$ZodError",LY),NQ=K("$ZodError",LY,{Parent:Error});function BY(W,Q=(Y)=>Y.message){let Y={},X=[];for(let G of W.issues)if(G.path.length>0)Y[G.path[0]]=Y[G.path[0]]||[],Y[G.path[0]].push(Q(G));else X.push(Q(G));return{formErrors:X,fieldErrors:Y}}function NY(W,Q=(Y)=>Y.message){let Y={_errors:[]},X=(G)=>{for(let J of G.issues)if(J.code==="invalid_union"&&J.errors.length)J.errors.map((H)=>X({issues:H}));else if(J.code==="invalid_key")X({issues:J.issues});else if(J.code==="invalid_element")X({issues:J.issues});else if(J.path.length===0)Y._errors.push(Q(J));else{let H=Y,w=0;while(w<J.path.length){let q=J.path[w];if(w!==J.path.length-1)H[q]=H[q]||{_errors:[]};else H[q]=H[q]||{_errors:[]},H[q]._errors.push(Q(J));H=H[q],w++}}};return X(W),Y}var yW=(W)=>(Q,Y,X,G)=>{let J=X?Object.assign(X,{async:!1}):{async:!1},H=Q._zod.run({value:Y,issues:[]},J);if(H instanceof Promise)throw new a;if(H.issues.length){let w=new(G?.Err??W)(H.issues.map((q)=>t(q,J,r())));throw xW(w,G?.callee),w}return H.value};var mW=(W)=>async(Q,Y,X,G)=>{let J=X?Object.assign(X,{async:!0}):{async:!0},H=Q._zod.run({value:Y,issues:[]},J);if(H instanceof Promise)H=await H;if(H.issues.length){let w=new(G?.Err??W)(H.issues.map((q)=>t(q,J,r())));throw xW(w,G?.callee),w}return H.value};var DW=(W)=>(Q,Y,X)=>{let G=X?{...X,async:!1}:{async:!1},J=Q._zod.run({value:Y,issues:[]},G);if(J instanceof Promise)throw new a;return J.issues.length?{success:!1,error:new(W??uW)(J.issues.map((H)=>t(H,G,r())))}:{success:!0,data:J.value}},MY=DW(NQ),FW=(W)=>async(Q,Y,X)=>{let G=X?Object.assign(X,{async:!0}):{async:!0},J=Q._zod.run({value:Y,issues:[]},G);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new W(J.issues.map((H)=>t(H,G,r())))}:{success:!0,data:J.value}},zY=FW(NQ),UY=(W)=>(Q,Y,X)=>{let G=X?Object.assign(X,{direction:"backward"}):{direction:"backward"};return yW(W)(Q,Y,G)};var IY=(W)=>(Q,Y,X)=>{return yW(W)(Q,Y,X)};var VY=(W)=>async(Q,Y,X)=>{let G=X?Object.assign(X,{direction:"backward"}):{direction:"backward"};return mW(W)(Q,Y,G)};var OY=(W)=>async(Q,Y,X)=>{return mW(W)(Q,Y,X)};var DY=(W)=>(Q,Y,X)=>{let G=X?Object.assign(X,{direction:"backward"}):{direction:"backward"};return DW(W)(Q,Y,G)};var FY=(W)=>(Q,Y,X)=>{return DW(W)(Q,Y,X)};var $Y=(W)=>async(Q,Y,X)=>{let G=X?Object.assign(X,{direction:"backward"}):{direction:"backward"};return FW(W)(Q,Y,G)};var PY=(W)=>async(Q,Y,X)=>{return FW(W)(Q,Y,X)};var EY=/^[cC][^\s-]{8,}$/,RY=/^[0-9a-z]+$/,SY=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bY=/^[0-9a-vA-V]{20}$/,TY=/^[A-Za-z0-9]{27}$/,_Y=/^[a-zA-Z0-9_-]{21}$/,ZY=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var CY=/^([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})$/,MQ=(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 jY=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var X6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function kY(){return new RegExp(X6,"u")}var vY=/^(?:(?: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])$/,gY=/^(([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 hY=/^((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])$/,xY=/^(([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])$/,cY=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,zQ=/^[A-Za-z0-9_-]*$/;var uY=/^\+[1-9]\d{6,14}$/,yY="(?:(?:\\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])))",mY=new RegExp(`^${yY}$`);function fY(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 oY(W){return new RegExp(`^${fY(W)}$`)}function lY(W){let Q=fY({precision:W.precision}),Y=["Z"];if(W.local)Y.push("");if(W.offset)Y.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let X=`${Q}(?:${Y.join("|")})`;return new RegExp(`^${yY}T(?:${X})$`)}var rY=(W)=>{let Q=W?`[\\s\\S]{${W?.minimum??0},${W?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Q}$`)};var pY=/^-?\d+$/,fW=/^-?\d+(?:\.\d+)?$/,dY=/^(?:true|false)$/i,nY=/^null$/i;var iY=/^[^A-Z]*$/,tY=/^[^a-z]*$/;var g=K("$ZodCheck",(W,Q)=>{var Y;W._zod??(W._zod={}),W._zod.def=Q,(Y=W._zod).onattach??(Y.onattach=[])}),eY={number:"number",bigint:"bigint",object:"date"},UQ=K("$ZodCheckLessThan",(W,Q)=>{g.init(W,Q);let Y=eY[typeof Q.value];W._zod.onattach.push((X)=>{let G=X._zod.bag,J=(Q.inclusive?G.maximum:G.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Q.value<J)if(Q.inclusive)G.maximum=Q.value;else G.exclusiveMaximum=Q.value}),W._zod.check=(X)=>{if(Q.inclusive?X.value<=Q.value:X.value<Q.value)return;X.issues.push({origin:Y,code:"too_big",maximum:typeof Q.value==="object"?Q.value.getTime():Q.value,input:X.value,inclusive:Q.inclusive,inst:W,continue:!Q.abort})}}),IQ=K("$ZodCheckGreaterThan",(W,Q)=>{g.init(W,Q);let Y=eY[typeof Q.value];W._zod.onattach.push((X)=>{let G=X._zod.bag,J=(Q.inclusive?G.minimum:G.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Q.value>J)if(Q.inclusive)G.minimum=Q.value;else G.exclusiveMinimum=Q.value}),W._zod.check=(X)=>{if(Q.inclusive?X.value>=Q.value:X.value>Q.value)return;X.issues.push({origin:Y,code:"too_small",minimum:typeof Q.value==="object"?Q.value.getTime():Q.value,input:X.value,inclusive:Q.inclusive,inst:W,continue:!Q.abort})}}),aY=K("$ZodCheckMultipleOf",(W,Q)=>{g.init(W,Q),W._zod.onattach.push((Y)=>{var X;(X=Y._zod.bag).multipleOf??(X.multipleOf=Q.value)}),W._zod.check=(Y)=>{if(typeof Y.value!==typeof Q.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof Y.value==="bigint"?Y.value%Q.value===BigInt(0):HQ(Y.value,Q.value)===0)return;Y.issues.push({origin:typeof Y.value,code:"not_multiple_of",divisor:Q.value,input:Y.value,inst:W,continue:!Q.abort})}}),sY=K("$ZodCheckNumberFormat",(W,Q)=>{g.init(W,Q),Q.format=Q.format||"float64";let Y=Q.format?.includes("int"),X=Y?"int":"number",[G,J]=LQ[Q.format];W._zod.onattach.push((H)=>{let w=H._zod.bag;if(w.format=Q.format,w.minimum=G,w.maximum=J,Y)w.pattern=pY}),W._zod.check=(H)=>{let w=H.value;if(Y){if(!Number.isInteger(w)){H.issues.push({expected:X,format:Q.format,code:"invalid_type",continue:!1,input:w,inst:W});return}if(!Number.isSafeInteger(w)){if(w>0)H.issues.push({input:w,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:X,inclusive:!0,continue:!Q.abort});else H.issues.push({input:w,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:W,origin:X,inclusive:!0,continue:!Q.abort});return}}if(w<G)H.issues.push({origin:"number",input:w,code:"too_small",minimum:G,inclusive:!0,inst:W,continue:!Q.abort});if(w>J)H.issues.push({origin:"number",input:w,code:"too_big",maximum:J,inclusive:!0,inst:W,continue:!Q.abort})}});var W0=K("$ZodCheckMaxLength",(W,Q)=>{var Y;g.init(W,Q),(Y=W._zod.def).when??(Y.when=(X)=>{let G=X.value;return!IW(G)&&G.length!==void 0}),W._zod.onattach.push((X)=>{let G=X._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Q.maximum<G)X._zod.bag.maximum=Q.maximum}),W._zod.check=(X)=>{let G=X.value;if(G.length<=Q.maximum)return;let H=OW(G);X.issues.push({origin:H,code:"too_big",maximum:Q.maximum,inclusive:!0,input:G,inst:W,continue:!Q.abort})}}),Q0=K("$ZodCheckMinLength",(W,Q)=>{var Y;g.init(W,Q),(Y=W._zod.def).when??(Y.when=(X)=>{let G=X.value;return!IW(G)&&G.length!==void 0}),W._zod.onattach.push((X)=>{let G=X._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Q.minimum>G)X._zod.bag.minimum=Q.minimum}),W._zod.check=(X)=>{let G=X.value;if(G.length>=Q.minimum)return;let H=OW(G);X.issues.push({origin:H,code:"too_small",minimum:Q.minimum,inclusive:!0,input:G,inst:W,continue:!Q.abort})}}),Y0=K("$ZodCheckLengthEquals",(W,Q)=>{var Y;g.init(W,Q),(Y=W._zod.def).when??(Y.when=(X)=>{let G=X.value;return!IW(G)&&G.length!==void 0}),W._zod.onattach.push((X)=>{let G=X._zod.bag;G.minimum=Q.length,G.maximum=Q.length,G.length=Q.length}),W._zod.check=(X)=>{let G=X.value,J=G.length;if(J===Q.length)return;let H=OW(G),w=J>Q.length;X.issues.push({origin:H,...w?{code:"too_big",maximum:Q.length}:{code:"too_small",minimum:Q.length},inclusive:!0,exact:!0,input:X.value,inst:W,continue:!Q.abort})}}),$W=K("$ZodCheckStringFormat",(W,Q)=>{var Y,X;if(g.init(W,Q),W._zod.onattach.push((G)=>{let J=G._zod.bag;if(J.format=Q.format,Q.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(Q.pattern)}),Q.pattern)(Y=W._zod).check??(Y.check=(G)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(G.value))return;G.issues.push({origin:"string",code:"invalid_format",format:Q.format,input:G.value,...Q.pattern?{pattern:Q.pattern.toString()}:{},inst:W,continue:!Q.abort})});else(X=W._zod).check??(X.check=()=>{})}),X0=K("$ZodCheckRegex",(W,Q)=>{$W.init(W,Q),W._zod.check=(Y)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(Y.value))return;Y.issues.push({origin:"string",code:"invalid_format",format:"regex",input:Y.value,pattern:Q.pattern.toString(),inst:W,continue:!Q.abort})}}),G0=K("$ZodCheckLowerCase",(W,Q)=>{Q.pattern??(Q.pattern=iY),$W.init(W,Q)}),J0=K("$ZodCheckUpperCase",(W,Q)=>{Q.pattern??(Q.pattern=tY),$W.init(W,Q)}),H0=K("$ZodCheckIncludes",(W,Q)=>{g.init(W,Q);let Y=WW(Q.includes),X=new RegExp(typeof Q.position==="number"?`^.{${Q.position}}${Y}`:Y);Q.pattern=X,W._zod.onattach.push((G)=>{let J=G._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(X)}),W._zod.check=(G)=>{if(G.value.includes(Q.includes,Q.position))return;G.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Q.includes,input:G.value,inst:W,continue:!Q.abort})}}),w0=K("$ZodCheckStartsWith",(W,Q)=>{g.init(W,Q);let Y=new RegExp(`^${WW(Q.prefix)}.*`);Q.pattern??(Q.pattern=Y),W._zod.onattach.push((X)=>{let G=X._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Y)}),W._zod.check=(X)=>{if(X.value.startsWith(Q.prefix))return;X.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Q.prefix,input:X.value,inst:W,continue:!Q.abort})}}),A0=K("$ZodCheckEndsWith",(W,Q)=>{g.init(W,Q);let Y=new RegExp(`.*${WW(Q.suffix)}$`);Q.pattern??(Q.pattern=Y),W._zod.onattach.push((X)=>{let G=X._zod.bag;G.patterns??(G.patterns=new Set),G.patterns.add(Y)}),W._zod.check=(X)=>{if(X.value.endsWith(Q.suffix))return;X.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Q.suffix,input:X.value,inst:W,continue:!Q.abort})}});var q0=K("$ZodCheckOverwrite",(W,Q)=>{g.init(W,Q),W._zod.check=(Y)=>{Y.value=Q.tx(Y.value)}});class VQ{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(`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (${n} in input) {
|
|
7
|
-
payload.issues = payload.issues.concat(${m}.issues.map(iss => ({
|
|
1
|
+
/*! @mcpcloud/runtime v0.12.1 — (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,Y)=>{var Q=W!=null&&typeof W==="object";if(Q){var K=X?k3??=new WeakMap:v3??=new WeakMap,q=K.get(W);if(q)return q}Y=W!=null?A3(j3(W)):{};let J=X||!W||!W.__esModule?t1(Y,"default",{value:W,enumerable:!0}):Y;for(let G of S3(W))if(!b3.call(J,G))t1(J,G,{get:T3.bind(W,G),enumerable:!0});if(Q)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 Y in X)t1(W,Y,{get:X[Y],enumerable:!0,configurable:!0,set:y3.bind(X,Y)})};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){Q4&&console.log("quickjs-emscripten:",...W)}function*L3(W){return yield W}function M7(W){return L3(G4(W))}function eW(W,X){return(...Y)=>{let Q=X.call(W,K4,...Y);return G4(Q)}}function F7(W,X){let Y=X.call(W,K4);return G4(Y)}function G4(W){function X(Y){return Y.done?Y.value:Y.value instanceof Promise?Y.value.then((Q)=>X(W.next(Q)),(Q)=>X(W.throw(Q))):X(W.next(Y.value))}return X(W.next())}function s9(W,X){let Y;try{W.dispose()}catch(Q){Y=Q}if(X&&Y)throw Object.assign(X,{message:`${X.message}
|
|
3
|
+
Then, failed to dispose scope: ${Y.message}`,disposeError:Y}),X;if(X||Y)throw X||Y}function O7(W){let X=W?Array.from(W):[];function Y(){return X.forEach((K)=>K.alive?K.dispose():void 0)}function Q(){return X.some((K)=>K.alive)}return Object.defineProperty(X,Y4,{configurable:!0,enumerable:!1,value:Y}),Object.defineProperty(X,"dispose",{configurable:!0,enumerable:!1,value:Y}),Object.defineProperty(X,"alive",{configurable:!0,enumerable:!1,get:Q}),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[Y,Q]of Object.entries(W)){if(!(Y in a9))throw new B3(Y);Q&&(X|=a9[Y])}return X}function R7(W){if(typeof W=="number")return W;if(W===void 0)return 0;let{type:X,strict:Y,strip:Q,compileOnly:K,backtraceBarrier:q}=W,J=0;return X==="global"&&(J|=S0.JS_EVAL_TYPE_GLOBAL),X==="module"&&(J|=S0.JS_EVAL_TYPE_MODULE),Y&&(J|=S0.JS_EVAL_FLAG_STRICT),Q&&(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:Y,quickjsPrivate:Q,onlyEnumerable:K,numbers:q,numbersAsStrings:J}=W,G=0;return X&&(G|=b0.JS_GPN_STRING_MASK),Y&&(G|=b0.JS_GPN_SYMBOL_MASK),Q&&(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 Y of W)Y!==void 0&&(X=X.concat(Y));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 Y in X)H7(W,Y,{get:X[Y],enumerable:!0})},Q4=!1,L7,W4,G3,X4,q3,J3,z3,D7,w7,B3,$3,H3,U3,C0,K4,V0,Y4,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)),Y=X.length*X.BYTES_PER_ELEMENT,Q=this.module._malloc(Y);return new Uint8Array(this.module.HEAPU8.buffer,Q,Y).set(new Uint8Array(X.buffer)),new X0(Q,void 0,(K)=>this.module._free(K))}newTypedArray(W,X){let Y=new W(Array(X).fill(0)),Q=Y.length*Y.BYTES_PER_ELEMENT,K=this.module._malloc(Q),q=new W(this.module.HEAPU8.buffer,K,X);return q.set(Y),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),Y=X+1,Q=this.module._malloc(Y);return this.module.stringToUTF8(W,Q,Y),new X0({ptr:Q,strlen:X},void 0,(K)=>this.module._free(K.ptr))}newHeapBufferPointer(W){let X=W.byteLength,Y=this.module._malloc(X);return this.module.HEAPU8.set(W,Y),new X0({pointer:Y,numBytes:X},void 0,(Q)=>this.module._free(Q.pointer))}consumeHeapCharPointer(W){let X=this.module.UTF8ToString(W);return this.module._free(W),X}},ZG,RG,C7,Y3=-2147483648,Q3=2147483647,p1=0,_7=class{constructor(){this.nextId=Y3,this.freelist=[],this.groups=new Map}put(W){let X=this.allocateId(),Y=e9(X),Q=this.groups.get(Y);return Q||(Q=new Map,this.groups.set(Y,Q)),Q.set(X,W),X}get(W){if(W===p1)throw new C0("no host reference id defined");let X=e9(W),Y=this.groups.get(X);if(!Y)throw new C0(`host reference id ${W} is not defined`);let Q=Y.get(W);if(!Q)throw new C0(`host reference id ${W} is not defined`);return Q}delete(W){if(W===p1)throw new C0("no host reference id defined");let X=e9(W),Y=this.groups.get(X);if(!Y)throw new C0(`host reference id ${W} is not defined`);Y.delete(W),Y.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>Q3)throw new U3(`HostRefMap: too many host refs created without disposing. Max simultaneous host refs: ${Q3-Y3}`);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,Y,Q)=>{let K=this.runtimeCallbacks.get(Y);if(!K)throw Error(`QuickJSRuntime(rt = ${Y}) not found when trying to free HostRef(id = ${Q})`);K.freeHostRef(Y,Q)},callFunction:(X,Y,Q,K,q,J)=>this.handleAsyncify(X,()=>{try{let G=this.contextCallbacks.get(Y);if(!G)throw Error(`QuickJSContext(ctx = ${Y}) not found for C function call "${J}"`);return G.callFunction(Y,Q,K,q,J)}catch(G){return console.error("[C to host error: returning null]",G),0}}),shouldInterrupt:(X,Y)=>this.handleAsyncify(X,()=>{try{let Q=this.runtimeCallbacks.get(Y);if(!Q)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C interrupt`);return Q.shouldInterrupt(Y)}catch(Q){return console.error("[C to host interrupt: returning error]",Q),1}}),loadModuleSource:(X,Y,Q,K)=>this.handleAsyncify(X,()=>{try{let q=this.runtimeCallbacks.get(Y);if(!q)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C module loader`);let J=q.loadModuleSource;if(!J)throw Error(`QuickJSRuntime(rt = ${Y}) does not support module loading`);return J(Y,Q,K)}catch(q){return console.error("[C to host module loader error: returning null]",q),0}}),normalizeModule:(X,Y,Q,K,q)=>this.handleAsyncify(X,()=>{try{let J=this.runtimeCallbacks.get(Y);if(!J)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C module loader`);let G=J.normalizeModule;if(!G)throw Error(`QuickJSRuntime(rt = ${Y}) does not support module loading`);return G(Y,Q,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((Q)=>{try{let K=X();if(!(K instanceof Promise)){H1("asyncify.handleSleep: not suspending:",K),Q(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),Q(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 Y=X();if(Y instanceof Promise)throw Error("Promise return value not supported in non-asyncify context.");return Y}},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,(Q)=>{this.ffi.QTS_FreeRuntime(Q),this.callbacks.deleteRuntime(Q)}),Y=new S7({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:X});return z4(Y,W),W.moduleLoader&&Y.setModuleLoader(W.moduleLoader),Y}newContext(W={}){let X=this.newRuntime(),Y=X.newContext({...W,ownedLifetimes:I7(X,W.ownedLifetimes)});return X.context=Y,Y}evalCode(W,X={}){return D0.withScope((Y)=>{let Q=Y.manage(this.newContext());B4(Q.runtime,X);let K=Q.evalCode(W,"eval.js");if(X.memoryLimitBytes!==void 0&&Q.runtime.setMemoryLimit(-1),K.error)throw Q.dump(Y.manage(K.error));return Q.dump(Y.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 Y=typeof W=="object"&&W&&"message"in W?String(W.message):String(W);super(Y);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()}},Y4=Symbol.dispose??Symbol.for("Symbol.dispose"),W3=V0.prototype;W3[Y4]||(W3[Y4]=function(){return this.dispose()});X0=class W extends V0{constructor(X,Y,Q,K){super();this._value=X,this.copier=Y,this.disposer=Q,this._owner=K,this._alive=!0,this._constructorStack=Q4?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 Y=X(this);return this.dispose(),Y}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
|
+
${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),Q=Math.min(...Y.map((q)=>q.length-q.trimStart().length)),K=Y.map((q)=>q.slice(Q)).map((q)=>" ".repeat(this.indent*2)+q);for(let q of K)this.content.push(q)}compile(){let W=Function,X=this?.args,Q=[...(this?.content??[""]).map((K)=>` ${K}`)];return new W(...X,Q.join(`
|
|
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(`
|
|
10
|
+
if (${x}.issues.length) {
|
|
11
|
+
if (${o} in input) {
|
|
12
|
+
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
8
13
|
...iss,
|
|
9
|
-
path: iss.path ? [${
|
|
14
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
10
15
|
})));
|
|
11
16
|
}
|
|
12
17
|
}
|
|
13
18
|
|
|
14
|
-
if (${
|
|
15
|
-
if (${
|
|
16
|
-
newResult[${
|
|
19
|
+
if (${x}.value === undefined) {
|
|
20
|
+
if (${o} in input) {
|
|
21
|
+
newResult[${o}] = undefined;
|
|
17
22
|
}
|
|
18
23
|
} else {
|
|
19
|
-
newResult[${
|
|
24
|
+
newResult[${o}] = ${x}.value;
|
|
20
25
|
}
|
|
21
26
|
|
|
22
|
-
`);else
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
`);else if(!p0)P.write(`
|
|
28
|
+
const ${x}_present = ${o} in input;
|
|
29
|
+
if (${x}.issues.length) {
|
|
30
|
+
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
25
31
|
...iss,
|
|
26
|
-
path: iss.path ? [${
|
|
32
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
33
|
+
})));
|
|
34
|
+
}
|
|
35
|
+
if (!${x}_present && !${x}.issues.length) {
|
|
36
|
+
payload.issues.push({
|
|
37
|
+
code: "invalid_type",
|
|
38
|
+
expected: "nonoptional",
|
|
39
|
+
input: undefined,
|
|
40
|
+
path: [${o}]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (${x}_present) {
|
|
45
|
+
if (${x}.value === undefined) {
|
|
46
|
+
newResult[${o}] = undefined;
|
|
47
|
+
} else {
|
|
48
|
+
newResult[${o}] = ${x}.value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
`);else P.write(`
|
|
53
|
+
if (${x}.issues.length) {
|
|
54
|
+
payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
|
|
55
|
+
...iss,
|
|
56
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
27
57
|
})));
|
|
28
58
|
}
|
|
29
59
|
|
|
30
|
-
if (${
|
|
31
|
-
if (${
|
|
32
|
-
newResult[${
|
|
60
|
+
if (${x}.value === undefined) {
|
|
61
|
+
if (${o} in input) {
|
|
62
|
+
newResult[${o}] = undefined;
|
|
33
63
|
}
|
|
34
64
|
} else {
|
|
35
|
-
newResult[${
|
|
65
|
+
newResult[${o}] = ${x}.value;
|
|
36
66
|
}
|
|
37
67
|
|
|
38
|
-
`)}V.write("payload.value = newResult;"),V.write("return payload;");let S4=V.compile();return(e,m)=>S4(I,e,m)},J,H=HW,w=!vW.jitless,L=w&&AQ.value,B=Q.catchall,z;W._zod.parse=(I,V)=>{z??(z=X.value);let c=I.value;if(!H(c))return I.issues.push({expected:"object",code:"invalid_type",input:c,inst:W}),I;if(w&&L&&V?.async===!1&&V.jitless!==!0){if(!J)J=G(Q.shape);if(I=J(I,V),!B)return I;return e0([],c,I,V,z,W)}return Y(I,V)}});function N0(W,Q,Y,X){for(let J of W)if(J.issues.length===0)return Q.value=J.value,Q;let G=W.filter((J)=>!GW(J));if(G.length===1)return Q.value=G[0].value,G[0];return Q.issues.push({code:"invalid_union",input:Q.value,inst:Y,errors:W.map((J)=>J.issues.map((H)=>t(H,X,r())))}),Q}var FQ=K("$ZodUnion",(W,Q)=>{E.init(W,Q),F(W._zod,"optin",()=>Q.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),F(W._zod,"optout",()=>Q.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),F(W._zod,"values",()=>{if(Q.options.every((G)=>G._zod.values))return new Set(Q.options.flatMap((G)=>Array.from(G._zod.values)));return}),F(W._zod,"pattern",()=>{if(Q.options.every((G)=>G._zod.pattern)){let G=Q.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>VW(J.source)).join("|")})$`)}return});let Y=Q.options.length===1,X=Q.options[0]._zod.run;W._zod.parse=(G,J)=>{if(Y)return X(G,J);let H=!1,w=[];for(let q of Q.options){let L=q._zod.run({value:G.value,issues:[]},J);if(L instanceof Promise)w.push(L),H=!0;else{if(L.issues.length===0)return L;w.push(L)}}if(!H)return N0(w,G,W,J);return Promise.all(w).then((q)=>{return N0(q,G,W,J)})}});var s0=K("$ZodDiscriminatedUnion",(W,Q)=>{Q.inclusive=!1,FQ.init(W,Q);let Y=W._zod.parse;F(W._zod,"propValues",()=>{let G={};for(let J of Q.options){let H=J._zod.propValues;if(!H||Object.keys(H).length===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(J)}"`);for(let[w,q]of Object.entries(H)){if(!G[w])G[w]=new Set;for(let L of q)G[w].add(L)}}return G});let X=qW(()=>{let G=Q.options,J=new Map;for(let H of G){let w=H._zod.propValues?.[Q.discriminator];if(!w||w.size===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(H)}"`);for(let q of w){if(J.has(q))throw Error(`Duplicate discriminator value "${String(q)}"`);J.set(q,H)}}return J});W._zod.parse=(G,J)=>{let H=G.value;if(!HW(H))return G.issues.push({code:"invalid_type",expected:"object",input:H,inst:W}),G;let w=X.value.get(H?.[Q.discriminator]);if(w)return w._zod.run(G,J);if(Q.unionFallback)return Y(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Q.discriminator,input:H,path:[Q.discriminator],inst:W}),G}}),W1=K("$ZodIntersection",(W,Q)=>{E.init(W,Q),W._zod.parse=(Y,X)=>{let G=Y.value,J=Q.left._zod.run({value:G,issues:[]},X),H=Q.right._zod.run({value:G,issues:[]},X);if(J instanceof Promise||H instanceof Promise)return Promise.all([J,H]).then(([q,L])=>{return M0(Y,q,L)});return M0(Y,J,H)}});function OQ(W,Q){if(W===Q)return{valid:!0,data:W};if(W instanceof Date&&Q instanceof Date&&+W===+Q)return{valid:!0,data:W};if(XW(W)&&XW(Q)){let Y=Object.keys(Q),X=Object.keys(W).filter((J)=>Y.indexOf(J)!==-1),G={...W,...Q};for(let J of X){let H=OQ(W[J],Q[J]);if(!H.valid)return{valid:!1,mergeErrorPath:[J,...H.mergeErrorPath]};G[J]=H.data}return{valid:!0,data:G}}if(Array.isArray(W)&&Array.isArray(Q)){if(W.length!==Q.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let X=0;X<W.length;X++){let G=W[X],J=Q[X],H=OQ(G,J);if(!H.valid)return{valid:!1,mergeErrorPath:[X,...H.mergeErrorPath]};Y.push(H.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function M0(W,Q,Y){let X=new Map,G;for(let w of Q.issues)if(w.code==="unrecognized_keys"){G??(G=w);for(let q of w.keys){if(!X.has(q))X.set(q,{});X.get(q).l=!0}}else W.issues.push(w);for(let w of Y.issues)if(w.code==="unrecognized_keys")for(let q of w.keys){if(!X.has(q))X.set(q,{});X.get(q).r=!0}else W.issues.push(w);let J=[...X].filter(([,w])=>w.l&&w.r).map(([w])=>w);if(J.length&&G)W.issues.push({...G,keys:J});if(GW(W))return W;let H=OQ(Q.value,Y.value);if(!H.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(H.mergeErrorPath)}`);return W.value=H.data,W}var Q1=K("$ZodRecord",(W,Q)=>{E.init(W,Q),W._zod.parse=(Y,X)=>{let G=Y.value;if(!XW(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:W}),Y;let J=[],H=Q.keyType._zod.values;if(H){Y.value={};let w=new Set;for(let L of H)if(typeof L==="string"||typeof L==="number"||typeof L==="symbol"){w.add(typeof L==="number"?L.toString():L);let B=Q.valueType._zod.run({value:G[L],issues:[]},X);if(B instanceof Promise)J.push(B.then((z)=>{if(z.issues.length)Y.issues.push(...QW(L,z.issues));Y.value[L]=z.value}));else{if(B.issues.length)Y.issues.push(...QW(L,B.issues));Y.value[L]=B.value}}let q;for(let L in G)if(!w.has(L))q=q??[],q.push(L);if(q&&q.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:W,keys:q})}else{Y.value={};for(let w of Reflect.ownKeys(G)){if(w==="__proto__")continue;let q=Q.keyType._zod.run({value:w,issues:[]},X);if(q instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof w==="string"&&fW.test(w)&&q.issues.length){let z=Q.keyType._zod.run({value:Number(w),issues:[]},X);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(z.issues.length===0)q=z}if(q.issues.length){if(Q.mode==="loose")Y.value[w]=G[w];else Y.issues.push({code:"invalid_key",origin:"record",issues:q.issues.map((z)=>t(z,X,r())),input:w,path:[w],inst:W});continue}let B=Q.valueType._zod.run({value:G[w],issues:[]},X);if(B instanceof Promise)J.push(B.then((z)=>{if(z.issues.length)Y.issues.push(...QW(w,z.issues));Y.value[q.value]=z.value}));else{if(B.issues.length)Y.issues.push(...QW(w,B.issues));Y.value[q.value]=B.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var Y1=K("$ZodEnum",(W,Q)=>{E.init(W,Q);let Y=UW(Q.entries),X=new Set(Y);W._zod.values=X,W._zod.pattern=new RegExp(`^(${Y.filter((G)=>qQ.has(typeof G)).map((G)=>typeof G==="string"?WW(G):G.toString()).join("|")})$`),W._zod.parse=(G,J)=>{let H=G.value;if(X.has(H))return G;return G.issues.push({code:"invalid_value",values:Y,input:H,inst:W}),G}}),X1=K("$ZodLiteral",(W,Q)=>{if(E.init(W,Q),Q.values.length===0)throw Error("Cannot create literal schema with no valid values");let Y=new Set(Q.values);W._zod.values=Y,W._zod.pattern=new RegExp(`^(${Q.values.map((X)=>typeof X==="string"?WW(X):X?WW(X.toString()):String(X)).join("|")})$`),W._zod.parse=(X,G)=>{let J=X.value;if(Y.has(J))return X;return X.issues.push({code:"invalid_value",values:Q.values,input:J,inst:W}),X}});var G1=K("$ZodTransform",(W,Q)=>{E.init(W,Q),W._zod.parse=(Y,X)=>{if(X.direction==="backward")throw new MW(W.constructor.name);let G=Q.transform(Y.value,Y);if(X.async)return(G instanceof Promise?G:Promise.resolve(G)).then((H)=>{return Y.value=H,Y});if(G instanceof Promise)throw new a;return Y.value=G,Y}});function z0(W,Q){if(W.issues.length&&Q===void 0)return{issues:[],value:void 0};return W}var $Q=K("$ZodOptional",(W,Q)=>{E.init(W,Q),W._zod.optin="optional",W._zod.optout="optional",F(W._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,void 0]):void 0}),F(W._zod,"pattern",()=>{let Y=Q.innerType._zod.pattern;return Y?new RegExp(`^(${VW(Y.source)})?$`):void 0}),W._zod.parse=(Y,X)=>{if(Q.innerType._zod.optin==="optional"){let G=Q.innerType._zod.run(Y,X);if(G instanceof Promise)return G.then((J)=>z0(J,Y.value));return z0(G,Y.value)}if(Y.value===void 0)return Y;return Q.innerType._zod.run(Y,X)}}),J1=K("$ZodExactOptional",(W,Q)=>{$Q.init(W,Q),F(W._zod,"values",()=>Q.innerType._zod.values),F(W._zod,"pattern",()=>Q.innerType._zod.pattern),W._zod.parse=(Y,X)=>{return Q.innerType._zod.run(Y,X)}}),H1=K("$ZodNullable",(W,Q)=>{E.init(W,Q),F(W._zod,"optin",()=>Q.innerType._zod.optin),F(W._zod,"optout",()=>Q.innerType._zod.optout),F(W._zod,"pattern",()=>{let Y=Q.innerType._zod.pattern;return Y?new RegExp(`^(${VW(Y.source)}|null)$`):void 0}),F(W._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,null]):void 0}),W._zod.parse=(Y,X)=>{if(Y.value===null)return Y;return Q.innerType._zod.run(Y,X)}}),w1=K("$ZodDefault",(W,Q)=>{E.init(W,Q),W._zod.optin="optional",F(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(Y,X)=>{if(X.direction==="backward")return Q.innerType._zod.run(Y,X);if(Y.value===void 0)return Y.value=Q.defaultValue,Y;let G=Q.innerType._zod.run(Y,X);if(G instanceof Promise)return G.then((J)=>U0(J,Q));return U0(G,Q)}});function U0(W,Q){if(W.value===void 0)W.value=Q.defaultValue;return W}var A1=K("$ZodPrefault",(W,Q)=>{E.init(W,Q),W._zod.optin="optional",F(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(Y,X)=>{if(X.direction==="backward")return Q.innerType._zod.run(Y,X);if(Y.value===void 0)Y.value=Q.defaultValue;return Q.innerType._zod.run(Y,X)}}),q1=K("$ZodNonOptional",(W,Q)=>{E.init(W,Q),F(W._zod,"values",()=>{let Y=Q.innerType._zod.values;return Y?new Set([...Y].filter((X)=>X!==void 0)):void 0}),W._zod.parse=(Y,X)=>{let G=Q.innerType._zod.run(Y,X);if(G instanceof Promise)return G.then((J)=>I0(J,W));return I0(G,W)}});function I0(W,Q){if(!W.issues.length&&W.value===void 0)W.issues.push({code:"invalid_type",expected:"nonoptional",input:W.value,inst:Q});return W}var K1=K("$ZodCatch",(W,Q)=>{E.init(W,Q),F(W._zod,"optin",()=>Q.innerType._zod.optin),F(W._zod,"optout",()=>Q.innerType._zod.optout),F(W._zod,"values",()=>Q.innerType._zod.values),W._zod.parse=(Y,X)=>{if(X.direction==="backward")return Q.innerType._zod.run(Y,X);let G=Q.innerType._zod.run(Y,X);if(G instanceof Promise)return G.then((J)=>{if(Y.value=J.value,J.issues.length)Y.value=Q.catchValue({...Y,error:{issues:J.issues.map((H)=>t(H,X,r()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=G.value,G.issues.length)Y.value=Q.catchValue({...Y,error:{issues:G.issues.map((J)=>t(J,X,r()))},input:Y.value}),Y.issues=[];return Y}});var L1=K("$ZodPipe",(W,Q)=>{E.init(W,Q),F(W._zod,"values",()=>Q.in._zod.values),F(W._zod,"optin",()=>Q.in._zod.optin),F(W._zod,"optout",()=>Q.out._zod.optout),F(W._zod,"propValues",()=>Q.in._zod.propValues),W._zod.parse=(Y,X)=>{if(X.direction==="backward"){let J=Q.out._zod.run(Y,X);if(J instanceof Promise)return J.then((H)=>lW(H,Q.in,X));return lW(J,Q.in,X)}let G=Q.in._zod.run(Y,X);if(G instanceof Promise)return G.then((J)=>lW(J,Q.out,X));return lW(G,Q.out,X)}});function lW(W,Q,Y){if(W.issues.length)return W.aborted=!0,W;return Q._zod.run({value:W.value,issues:W.issues},Y)}var B1=K("$ZodReadonly",(W,Q)=>{E.init(W,Q),F(W._zod,"propValues",()=>Q.innerType._zod.propValues),F(W._zod,"values",()=>Q.innerType._zod.values),F(W._zod,"optin",()=>Q.innerType?._zod?.optin),F(W._zod,"optout",()=>Q.innerType?._zod?.optout),W._zod.parse=(Y,X)=>{if(X.direction==="backward")return Q.innerType._zod.run(Y,X);let G=Q.innerType._zod.run(Y,X);if(G instanceof Promise)return G.then(V0);return V0(G)}});function V0(W){return W.value=Object.freeze(W.value),W}var N1=K("$ZodCustom",(W,Q)=>{g.init(W,Q),E.init(W,Q),W._zod.parse=(Y,X)=>{return Y},W._zod.check=(Y)=>{let X=Y.value,G=Q.fn(X);if(G instanceof Promise)return G.then((J)=>O0(J,Y,X,W));O0(G,Y,X,W);return}});function O0(W,Q,Y,X){if(!W){let G={code:"custom",input:Y,inst:X,path:[...X._zod.def.path??[]],continue:!X._zod.def.abort};if(X._zod.def.params)G.params=X._zod.def.params;Q.issues.push(KW(G))}}var w6=()=>{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 Q(G){return W[G]??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"},X={nan:"NaN"};return(G)=>{switch(G.code){case"invalid_type":{let J=X[G.expected]??G.expected,H=BQ(G.input),w=X[H]??H;return`Invalid input: expected ${J}, received ${w}`}case"invalid_value":if(G.values.length===1)return`Invalid input: expected ${cW(G.values[0])}`;return`Invalid option: expected one of ${gW(G.values,"|")}`;case"too_big":{let J=G.inclusive?"<=":"<",H=Q(G.origin);if(H)return`Too big: expected ${G.origin??"value"} to have ${J}${G.maximum.toString()} ${H.unit??"elements"}`;return`Too big: expected ${G.origin??"value"} to be ${J}${G.maximum.toString()}`}case"too_small":{let J=G.inclusive?">=":">",H=Q(G.origin);if(H)return`Too small: expected ${G.origin} to have ${J}${G.minimum.toString()} ${H.unit}`;return`Too small: expected ${G.origin} to be ${J}${G.minimum.toString()}`}case"invalid_format":{let J=G;if(J.format==="starts_with")return`Invalid string: must start with "${J.prefix}"`;if(J.format==="ends_with")return`Invalid string: must end with "${J.suffix}"`;if(J.format==="includes")return`Invalid string: must include "${J.includes}"`;if(J.format==="regex")return`Invalid string: must match pattern ${J.pattern}`;return`Invalid ${Y[J.format]??G.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${G.divisor}`;case"unrecognized_keys":return`Unrecognized key${G.keys.length>1?"s":""}: ${gW(G.keys,", ")}`;case"invalid_key":return`Invalid key in ${G.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${G.origin}`;default:return"Invalid input"}}};function PQ(){return{localeError:w6()}}var M1,P2=Symbol("ZodOutput"),E2=Symbol("ZodInput");class z1{constructor(){this._map=new WeakMap,this._idmap=new Map}add(W,...Q){let Y=Q[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 Q=this._map.get(W);if(Q&&typeof Q==="object"&&"id"in Q)this._idmap.delete(Q.id);return this._map.delete(W),this}get(W){let Q=W._zod.parent;if(Q){let Y={...this.get(Q)??{}};delete Y.id;let X={...Y,...this._map.get(W)};return Object.keys(X).length?X:void 0}return this._map.get(W)}has(W){return this._map.has(W)}}function A6(){return new z1}(M1=globalThis).__zod_globalRegistry??(M1.__zod_globalRegistry=A6());var wW=globalThis.__zod_globalRegistry;function U1(W,Q){return new W({type:"string",...U(Q)})}function I1(W,Q){return new W({type:"string",format:"email",check:"string_format",abort:!1,...U(Q)})}function EQ(W,Q){return new W({type:"string",format:"guid",check:"string_format",abort:!1,...U(Q)})}function V1(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,...U(Q)})}function O1(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...U(Q)})}function D1(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...U(Q)})}function F1(W,Q){return new W({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...U(Q)})}function $1(W,Q){return new W({type:"string",format:"url",check:"string_format",abort:!1,...U(Q)})}function P1(W,Q){return new W({type:"string",format:"emoji",check:"string_format",abort:!1,...U(Q)})}function E1(W,Q){return new W({type:"string",format:"nanoid",check:"string_format",abort:!1,...U(Q)})}function R1(W,Q){return new W({type:"string",format:"cuid",check:"string_format",abort:!1,...U(Q)})}function S1(W,Q){return new W({type:"string",format:"cuid2",check:"string_format",abort:!1,...U(Q)})}function b1(W,Q){return new W({type:"string",format:"ulid",check:"string_format",abort:!1,...U(Q)})}function T1(W,Q){return new W({type:"string",format:"xid",check:"string_format",abort:!1,...U(Q)})}function _1(W,Q){return new W({type:"string",format:"ksuid",check:"string_format",abort:!1,...U(Q)})}function Z1(W,Q){return new W({type:"string",format:"ipv4",check:"string_format",abort:!1,...U(Q)})}function C1(W,Q){return new W({type:"string",format:"ipv6",check:"string_format",abort:!1,...U(Q)})}function j1(W,Q){return new W({type:"string",format:"cidrv4",check:"string_format",abort:!1,...U(Q)})}function k1(W,Q){return new W({type:"string",format:"cidrv6",check:"string_format",abort:!1,...U(Q)})}function v1(W,Q){return new W({type:"string",format:"base64",check:"string_format",abort:!1,...U(Q)})}function g1(W,Q){return new W({type:"string",format:"base64url",check:"string_format",abort:!1,...U(Q)})}function h1(W,Q){return new W({type:"string",format:"e164",check:"string_format",abort:!1,...U(Q)})}function x1(W,Q){return new W({type:"string",format:"jwt",check:"string_format",abort:!1,...U(Q)})}function c1(W,Q){return new W({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...U(Q)})}function u1(W,Q){return new W({type:"string",format:"date",check:"string_format",...U(Q)})}function y1(W,Q){return new W({type:"string",format:"time",check:"string_format",precision:null,...U(Q)})}function m1(W,Q){return new W({type:"string",format:"duration",check:"string_format",...U(Q)})}function f1(W,Q){return new W({type:"number",checks:[],...U(Q)})}function o1(W,Q){return new W({type:"number",check:"number_format",abort:!1,format:"safeint",...U(Q)})}function l1(W,Q){return new W({type:"boolean",...U(Q)})}function r1(W,Q){return new W({type:"null",...U(Q)})}function p1(W){return new W({type:"unknown"})}function d1(W,Q){return new W({type:"never",...U(Q)})}function dW(W,Q){return new UQ({check:"less_than",...U(Q),value:W,inclusive:!1})}function PW(W,Q){return new UQ({check:"less_than",...U(Q),value:W,inclusive:!0})}function nW(W,Q){return new IQ({check:"greater_than",...U(Q),value:W,inclusive:!1})}function EW(W,Q){return new IQ({check:"greater_than",...U(Q),value:W,inclusive:!0})}function iW(W,Q){return new aY({check:"multiple_of",...U(Q),value:W})}function tW(W,Q){return new W0({check:"max_length",...U(Q),maximum:W})}function LW(W,Q){return new Q0({check:"min_length",...U(Q),minimum:W})}function eW(W,Q){return new Y0({check:"length_equals",...U(Q),length:W})}function RQ(W,Q){return new X0({check:"string_format",format:"regex",...U(Q),pattern:W})}function SQ(W){return new G0({check:"string_format",format:"lowercase",...U(W)})}function bQ(W){return new J0({check:"string_format",format:"uppercase",...U(W)})}function TQ(W,Q){return new H0({check:"string_format",format:"includes",...U(Q),includes:W})}function _Q(W,Q){return new w0({check:"string_format",format:"starts_with",...U(Q),prefix:W})}function ZQ(W,Q){return new A0({check:"string_format",format:"ends_with",...U(Q),suffix:W})}function JW(W){return new q0({check:"overwrite",tx:W})}function CQ(W){return JW((Q)=>Q.normalize(W))}function jQ(){return JW((W)=>W.trim())}function kQ(){return JW((W)=>W.toLowerCase())}function vQ(){return JW((W)=>W.toUpperCase())}function gQ(){return JW((W)=>wQ(W))}function n1(W,Q,Y){return new W({type:"array",element:Q,...U(Y)})}function i1(W,Q,Y){let X=U(Y);return X.abort??(X.abort=!0),new W({type:"custom",check:"custom",fn:Q,...X})}function t1(W,Q,Y){return new W({type:"custom",check:"custom",fn:Q,...U(Y)})}function e1(W){let Q=q6((Y)=>{return Y.addIssue=(X)=>{if(typeof X==="string")Y.issues.push(KW(X,Y.value,Q._zod.def));else{let G=X;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=Q),G.continue??(G.continue=!Q._zod.def.abort),Y.issues.push(KW(G))}},W(Y.value,Y)});return Q}function q6(W,Q){let Y=new g({check:"custom",...U(Q)});return Y._zod.check=W,Y}function hQ(W){let Q=W?.target??"draft-2020-12";if(Q==="draft-4")Q="draft-04";if(Q==="draft-7")Q="draft-07";return{processors:W.processors??{},metadataRegistry:W?.metadata??wW,target:Q,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 C(W,Q,Y={path:[],schemaPath:[]}){var X;let G=W._zod.def,J=Q.seen.get(W);if(J){if(J.count++,Y.schemaPath.includes(W))J.cycle=Y.path;return J.schema}let H={schema:{},count:1,cycle:void 0,path:Y.path};Q.seen.set(W,H);let w=W._zod.toJSONSchema?.();if(w)H.schema=w;else{let B={...Y,schemaPath:[...Y.schemaPath,W],path:Y.path};if(W._zod.processJSONSchema)W._zod.processJSONSchema(Q,H.schema,B);else{let I=H.schema,V=Q.processors[G.type];if(!V)throw Error(`[toJSONSchema]: Non-representable type encountered: ${G.type}`);V(W,Q,I,B)}let z=W._zod.parent;if(z){if(!H.ref)H.ref=z;C(z,Q,B),Q.seen.get(z).isParent=!0}}let q=Q.metadataRegistry.get(W);if(q)Object.assign(H.schema,q);if(Q.io==="input"&&u(W))delete H.schema.examples,delete H.schema.default;if(Q.io==="input"&&H.schema._prefault)(X=H.schema).default??(X.default=H.schema._prefault);return delete H.schema._prefault,Q.seen.get(W).schema}function xQ(W,Q){let Y=W.seen.get(Q);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let X=new Map;for(let H of W.seen.entries()){let w=W.metadataRegistry.get(H[0])?.id;if(w){let q=X.get(w);if(q&&q!==H[0])throw Error(`Duplicate schema id "${w}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);X.set(w,H[0])}}let G=(H)=>{let w=W.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let z=W.external.registry.get(H[0])?.id,I=W.external.uri??((c)=>c);if(z)return{ref:I(z)};let V=H[1].defId??H[1].schema.id??`schema${W.counter++}`;return H[1].defId=V,{defId:V,ref:`${I("__shared")}#/${w}/${V}`}}if(H[1]===Y)return{ref:"#"};let L=`${"#"}/${w}/`,B=H[1].schema.id??`__schema${W.counter++}`;return{defId:B,ref:L+B}},J=(H)=>{if(H[1].schema.$ref)return;let w=H[1],{ref:q,defId:L}=G(H);if(w.def={...w.schema},L)w.defId=L;let B=w.schema;for(let z in B)delete B[z];B.$ref=q};if(W.cycles==="throw")for(let H of W.seen.entries()){let w=H[1];if(w.cycle)throw Error(`Cycle detected: #/${w.cycle?.join("/")}/<root>
|
|
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>
|
|
39
69
|
|
|
40
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let H of W.seen.entries()){let w=H[1];if(Q===H[0]){J(H);continue}if(W.external){let L=W.external.registry.get(H[0])?.id;if(Q!==H[0]&&L){J(H);continue}}if(W.metadataRegistry.get(H[0])?.id){J(H);continue}if(w.cycle){J(H);continue}if(w.count>1){if(W.reused==="ref"){J(H);continue}}}}function cQ(W,Q){let Y=W.seen.get(Q);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let X=(H)=>{let w=W.seen.get(H);if(w.ref===null)return;let q=w.def??w.schema,L={...q},B=w.ref;if(w.ref=null,B){X(B);let I=W.seen.get(B),V=I.schema;if(V.$ref&&(W.target==="draft-07"||W.target==="draft-04"||W.target==="openapi-3.0"))q.allOf=q.allOf??[],q.allOf.push(V);else Object.assign(q,V);if(Object.assign(q,L),H._zod.parent===B)for(let v in q){if(v==="$ref"||v==="allOf")continue;if(!(v in L))delete q[v]}if(V.$ref&&I.def)for(let v in q){if(v==="$ref"||v==="allOf")continue;if(v in I.def&&JSON.stringify(q[v])===JSON.stringify(I.def[v]))delete q[v]}}let z=H._zod.parent;if(z&&z!==B){X(z);let I=W.seen.get(z);if(I?.schema.$ref){if(q.$ref=I.schema.$ref,I.def)for(let V in q){if(V==="$ref"||V==="allOf")continue;if(V in I.def&&JSON.stringify(q[V])===JSON.stringify(I.def[V]))delete q[V]}}}W.override({zodSchema:H,jsonSchema:q,path:w.path??[]})};for(let H of[...W.seen.entries()].reverse())X(H[0]);let G={};if(W.target==="draft-2020-12")G.$schema="https://json-schema.org/draft/2020-12/schema";else if(W.target==="draft-07")G.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="draft-04")G.$schema="http://json-schema.org/draft-04/schema#";else if(W.target==="openapi-3.0");if(W.external?.uri){let H=W.external.registry.get(Q)?.id;if(!H)throw Error("Schema is missing an `id` property");G.$id=W.external.uri(H)}Object.assign(G,Y.def??Y.schema);let J=W.external?.defs??{};for(let H of W.seen.entries()){let w=H[1];if(w.def&&w.defId)J[w.defId]=w.def}if(W.external);else if(Object.keys(J).length>0)if(W.target==="draft-2020-12")G.$defs=J;else G.definitions=J;try{let H=JSON.parse(JSON.stringify(G));return Object.defineProperty(H,"~standard",{value:{...Q["~standard"],jsonSchema:{input:RW(Q,"input",W.processors),output:RW(Q,"output",W.processors)}},enumerable:!1,writable:!1}),H}catch(H){throw Error("Error converting schema to JSON.")}}function u(W,Q){let Y=Q??{seen:new Set};if(Y.seen.has(W))return!1;Y.seen.add(W);let X=W._zod.def;if(X.type==="transform")return!0;if(X.type==="array")return u(X.element,Y);if(X.type==="set")return u(X.valueType,Y);if(X.type==="lazy")return u(X.getter(),Y);if(X.type==="promise"||X.type==="optional"||X.type==="nonoptional"||X.type==="nullable"||X.type==="readonly"||X.type==="default"||X.type==="prefault")return u(X.innerType,Y);if(X.type==="intersection")return u(X.left,Y)||u(X.right,Y);if(X.type==="record"||X.type==="map")return u(X.keyType,Y)||u(X.valueType,Y);if(X.type==="pipe")return u(X.in,Y)||u(X.out,Y);if(X.type==="object"){for(let G in X.shape)if(u(X.shape[G],Y))return!0;return!1}if(X.type==="union"){for(let G of X.options)if(u(G,Y))return!0;return!1}if(X.type==="tuple"){for(let G of X.items)if(u(G,Y))return!0;if(X.rest&&u(X.rest,Y))return!0;return!1}return!1}var a1=(W,Q={})=>(Y)=>{let X=hQ({...Y,processors:Q});return C(W,X),xQ(X,W),cQ(X,W)},RW=(W,Q,Y={})=>(X)=>{let{libraryOptions:G,target:J}=X??{},H=hQ({...G??{},target:J,io:Q,processors:Y});return C(W,H),xQ(H,W),cQ(H,W)};var K6={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s1=(W,Q,Y,X)=>{let G=Y;G.type="string";let{minimum:J,maximum:H,format:w,patterns:q,contentEncoding:L}=W._zod.bag;if(typeof J==="number")G.minLength=J;if(typeof H==="number")G.maxLength=H;if(w){if(G.format=K6[w]??w,G.format==="")delete G.format;if(w==="time")delete G.format}if(L)G.contentEncoding=L;if(q&&q.size>0){let B=[...q];if(B.length===1)G.pattern=B[0].source;else if(B.length>1)G.allOf=[...B.map((z)=>({...Q.target==="draft-07"||Q.target==="draft-04"||Q.target==="openapi-3.0"?{type:"string"}:{},pattern:z.source}))]}},W3=(W,Q,Y,X)=>{let G=Y,{minimum:J,maximum:H,format:w,multipleOf:q,exclusiveMaximum:L,exclusiveMinimum:B}=W._zod.bag;if(typeof w==="string"&&w.includes("int"))G.type="integer";else G.type="number";if(typeof B==="number")if(Q.target==="draft-04"||Q.target==="openapi-3.0")G.minimum=B,G.exclusiveMinimum=!0;else G.exclusiveMinimum=B;if(typeof J==="number"){if(G.minimum=J,typeof B==="number"&&Q.target!=="draft-04")if(B>=J)delete G.minimum;else delete G.exclusiveMinimum}if(typeof L==="number")if(Q.target==="draft-04"||Q.target==="openapi-3.0")G.maximum=L,G.exclusiveMaximum=!0;else G.exclusiveMaximum=L;if(typeof H==="number"){if(G.maximum=H,typeof L==="number"&&Q.target!=="draft-04")if(L<=H)delete G.maximum;else delete G.exclusiveMaximum}if(typeof q==="number")G.multipleOf=q},Q3=(W,Q,Y,X)=>{Y.type="boolean"};var Y3=(W,Q,Y,X)=>{if(Q.target==="openapi-3.0")Y.type="string",Y.nullable=!0,Y.enum=[null];else Y.type="null"};var X3=(W,Q,Y,X)=>{Y.not={}};var G3=(W,Q,Y,X)=>{};var J3=(W,Q,Y,X)=>{let G=W._zod.def,J=UW(G.entries);if(J.every((H)=>typeof H==="number"))Y.type="number";if(J.every((H)=>typeof H==="string"))Y.type="string";Y.enum=J},H3=(W,Q,Y,X)=>{let G=W._zod.def,J=[];for(let H of G.values)if(H===void 0){if(Q.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof H==="bigint")if(Q.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else J.push(Number(H));else J.push(H);if(J.length===0);else if(J.length===1){let H=J[0];if(Y.type=H===null?"null":typeof H,Q.target==="draft-04"||Q.target==="openapi-3.0")Y.enum=[H];else Y.const=H}else{if(J.every((H)=>typeof H==="number"))Y.type="number";if(J.every((H)=>typeof H==="string"))Y.type="string";if(J.every((H)=>typeof H==="boolean"))Y.type="boolean";if(J.every((H)=>H===null))Y.type="null";Y.enum=J}};var w3=(W,Q,Y,X)=>{if(Q.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")};var A3=(W,Q,Y,X)=>{if(Q.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")};var q3=(W,Q,Y,X)=>{let G=Y,J=W._zod.def,{minimum:H,maximum:w}=W._zod.bag;if(typeof H==="number")G.minItems=H;if(typeof w==="number")G.maxItems=w;G.type="array",G.items=C(J.element,Q,{...X,path:[...X.path,"items"]})},K3=(W,Q,Y,X)=>{let G=Y,J=W._zod.def;G.type="object",G.properties={};let H=J.shape;for(let L in H)G.properties[L]=C(H[L],Q,{...X,path:[...X.path,"properties",L]});let w=new Set(Object.keys(H)),q=new Set([...w].filter((L)=>{let B=J.shape[L]._zod;if(Q.io==="input")return B.optin===void 0;else return B.optout===void 0}));if(q.size>0)G.required=Array.from(q);if(J.catchall?._zod.def.type==="never")G.additionalProperties=!1;else if(!J.catchall){if(Q.io==="output")G.additionalProperties=!1}else if(J.catchall)G.additionalProperties=C(J.catchall,Q,{...X,path:[...X.path,"additionalProperties"]})},L3=(W,Q,Y,X)=>{let G=W._zod.def,J=G.inclusive===!1,H=G.options.map((w,q)=>C(w,Q,{...X,path:[...X.path,J?"oneOf":"anyOf",q]}));if(J)Y.oneOf=H;else Y.anyOf=H},B3=(W,Q,Y,X)=>{let G=W._zod.def,J=C(G.left,Q,{...X,path:[...X.path,"allOf",0]}),H=C(G.right,Q,{...X,path:[...X.path,"allOf",1]}),w=(L)=>("allOf"in L)&&Object.keys(L).length===1,q=[...w(J)?J.allOf:[J],...w(H)?H.allOf:[H]];Y.allOf=q};var N3=(W,Q,Y,X)=>{let G=Y,J=W._zod.def;G.type="object";let H=J.keyType,q=H._zod.bag?.patterns;if(J.mode==="loose"&&q&&q.size>0){let B=C(J.valueType,Q,{...X,path:[...X.path,"patternProperties","*"]});G.patternProperties={};for(let z of q)G.patternProperties[z.source]=B}else{if(Q.target==="draft-07"||Q.target==="draft-2020-12")G.propertyNames=C(J.keyType,Q,{...X,path:[...X.path,"propertyNames"]});G.additionalProperties=C(J.valueType,Q,{...X,path:[...X.path,"additionalProperties"]})}let L=H._zod.values;if(L){let B=[...L].filter((z)=>typeof z==="string"||typeof z==="number");if(B.length>0)G.required=B}},M3=(W,Q,Y,X)=>{let G=W._zod.def,J=C(G.innerType,Q,X),H=Q.seen.get(W);if(Q.target==="openapi-3.0")H.ref=G.innerType,Y.nullable=!0;else Y.anyOf=[J,{type:"null"}]},z3=(W,Q,Y,X)=>{let G=W._zod.def;C(G.innerType,Q,X);let J=Q.seen.get(W);J.ref=G.innerType},U3=(W,Q,Y,X)=>{let G=W._zod.def;C(G.innerType,Q,X);let J=Q.seen.get(W);J.ref=G.innerType,Y.default=JSON.parse(JSON.stringify(G.defaultValue))},I3=(W,Q,Y,X)=>{let G=W._zod.def;C(G.innerType,Q,X);let J=Q.seen.get(W);if(J.ref=G.innerType,Q.io==="input")Y._prefault=JSON.parse(JSON.stringify(G.defaultValue))},V3=(W,Q,Y,X)=>{let G=W._zod.def;C(G.innerType,Q,X);let J=Q.seen.get(W);J.ref=G.innerType;let H;try{H=G.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}Y.default=H},O3=(W,Q,Y,X)=>{let G=W._zod.def,J=Q.io==="input"?G.in._zod.def.type==="transform"?G.out:G.in:G.out;C(J,Q,X);let H=Q.seen.get(W);H.ref=J},D3=(W,Q,Y,X)=>{let G=W._zod.def;C(G.innerType,Q,X);let J=Q.seen.get(W);J.ref=G.innerType,Y.readOnly=!0};var uQ=(W,Q,Y,X)=>{let G=W._zod.def;C(G.innerType,Q,X);let J=Q.seen.get(W);J.ref=G.innerType};var bW={};YY(bW,{time:()=>fQ,duration:()=>oQ,datetime:()=>yQ,date:()=>mQ,ZodISOTime:()=>P3,ZodISODuration:()=>E3,ZodISODateTime:()=>F3,ZodISODate:()=>$3});var F3=K("ZodISODateTime",(W,Q)=>{C0.init(W,Q),b.init(W,Q)});function yQ(W){return c1(F3,W)}var $3=K("ZodISODate",(W,Q)=>{j0.init(W,Q),b.init(W,Q)});function mQ(W){return u1($3,W)}var P3=K("ZodISOTime",(W,Q)=>{k0.init(W,Q),b.init(W,Q)});function fQ(W){return y1(P3,W)}var E3=K("ZodISODuration",(W,Q)=>{v0.init(W,Q),b.init(W,Q)});function oQ(W){return m1(E3,W)}var R3=(W,Q)=>{uW.init(W,Q),W.name="ZodError",Object.defineProperties(W,{format:{value:(Y)=>NY(W,Y)},flatten:{value:(Y)=>BY(W,Y)},addIssue:{value:(Y)=>{W.issues.push(Y),W.message=JSON.stringify(W.issues,AW,2)}},addIssues:{value:(Y)=>{W.issues.push(...Y),W.message=JSON.stringify(W.issues,AW,2)}},isEmpty:{get(){return W.issues.length===0}}})},W8=K("ZodError",R3),o=K("ZodError",R3,{Parent:Error});var S3=yW(o),b3=mW(o),T3=DW(o),_3=FW(o),Z3=UY(o),C3=IY(o),j3=VY(o),k3=OY(o),v3=DY(o),g3=FY(o),h3=$Y(o),x3=PY(o);var Z=K("ZodType",(W,Q)=>{return E.init(W,Q),Object.assign(W["~standard"],{jsonSchema:{input:RW(W,"input"),output:RW(W,"output")}}),W.toJSONSchema=a1(W,{}),W.def=Q,W.type=Q.type,Object.defineProperty(W,"_def",{value:Q}),W.check=(...Y)=>{return W.clone(D.mergeDefs(Q,{checks:[...Q.checks??[],...Y.map((X)=>typeof X==="function"?{_zod:{check:X,def:{check:"custom"},onattach:[]}}:X)]}),{parent:!0})},W.with=W.check,W.clone=(Y,X)=>i(W,Y,X),W.brand=()=>W,W.register=(Y,X)=>{return Y.add(W,X),W},W.parse=(Y,X)=>S3(W,Y,X,{callee:W.parse}),W.safeParse=(Y,X)=>T3(W,Y,X),W.parseAsync=async(Y,X)=>b3(W,Y,X,{callee:W.parseAsync}),W.safeParseAsync=async(Y,X)=>_3(W,Y,X),W.spa=W.safeParseAsync,W.encode=(Y,X)=>Z3(W,Y,X),W.decode=(Y,X)=>C3(W,Y,X),W.encodeAsync=async(Y,X)=>j3(W,Y,X),W.decodeAsync=async(Y,X)=>k3(W,Y,X),W.safeEncode=(Y,X)=>v3(W,Y,X),W.safeDecode=(Y,X)=>g3(W,Y,X),W.safeEncodeAsync=async(Y,X)=>h3(W,Y,X),W.safeDecodeAsync=async(Y,X)=>x3(W,Y,X),W.refine=(Y,X)=>W.check(q9(Y,X)),W.superRefine=(Y)=>W.check(K9(Y)),W.overwrite=(Y)=>W.check(JW(Y)),W.optional=()=>_(W),W.exactOptional=()=>e6(W),W.nullable=()=>y3(W),W.nullish=()=>_(y3(W)),W.nonoptional=(Y)=>X9(W,Y),W.array=()=>O(W),W.or=(Y)=>S([W,Y]),W.and=(Y)=>sW(W,Y),W.transform=(Y)=>rQ(W,p3(Y)),W.default=(Y)=>W9(W,Y),W.prefault=(Y)=>Y9(W,Y),W.catch=(Y)=>J9(W,Y),W.pipe=(Y)=>rQ(W,Y),W.readonly=()=>A9(W),W.describe=(Y)=>{let X=W.clone();return wW.add(X,{description:Y}),X},Object.defineProperty(W,"description",{get(){return wW.get(W)?.description},configurable:!0}),W.meta=(...Y)=>{if(Y.length===0)return wW.get(W);let X=W.clone();return wW.add(X,Y[0]),X},W.isOptional=()=>W.safeParse(void 0).success,W.isNullable=()=>W.safeParse(null).success,W.apply=(Y)=>Y(W),W}),m3=K("_ZodString",(W,Q)=>{pW.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(X,G,J)=>s1(W,X,G,J);let Y=W._zod.bag;W.format=Y.format??null,W.minLength=Y.minimum??null,W.maxLength=Y.maximum??null,W.regex=(...X)=>W.check(RQ(...X)),W.includes=(...X)=>W.check(TQ(...X)),W.startsWith=(...X)=>W.check(_Q(...X)),W.endsWith=(...X)=>W.check(ZQ(...X)),W.min=(...X)=>W.check(LW(...X)),W.max=(...X)=>W.check(tW(...X)),W.length=(...X)=>W.check(eW(...X)),W.nonempty=(...X)=>W.check(LW(1,...X)),W.lowercase=(X)=>W.check(SQ(X)),W.uppercase=(X)=>W.check(bQ(X)),W.trim=()=>W.check(jQ()),W.normalize=(...X)=>W.check(CQ(...X)),W.toLowerCase=()=>W.check(kQ()),W.toUpperCase=()=>W.check(vQ()),W.slugify=()=>W.check(gQ())}),D6=K("ZodString",(W,Q)=>{pW.init(W,Q),m3.init(W,Q),W.email=(Y)=>W.check(I1(F6,Y)),W.url=(Y)=>W.check($1($6,Y)),W.jwt=(Y)=>W.check(x1(x6,Y)),W.emoji=(Y)=>W.check(P1(P6,Y)),W.guid=(Y)=>W.check(EQ(c3,Y)),W.uuid=(Y)=>W.check(V1(aW,Y)),W.uuidv4=(Y)=>W.check(O1(aW,Y)),W.uuidv6=(Y)=>W.check(D1(aW,Y)),W.uuidv7=(Y)=>W.check(F1(aW,Y)),W.nanoid=(Y)=>W.check(E1(E6,Y)),W.guid=(Y)=>W.check(EQ(c3,Y)),W.cuid=(Y)=>W.check(R1(R6,Y)),W.cuid2=(Y)=>W.check(S1(S6,Y)),W.ulid=(Y)=>W.check(b1(b6,Y)),W.base64=(Y)=>W.check(v1(v6,Y)),W.base64url=(Y)=>W.check(g1(g6,Y)),W.xid=(Y)=>W.check(T1(T6,Y)),W.ksuid=(Y)=>W.check(_1(_6,Y)),W.ipv4=(Y)=>W.check(Z1(Z6,Y)),W.ipv6=(Y)=>W.check(C1(C6,Y)),W.cidrv4=(Y)=>W.check(j1(j6,Y)),W.cidrv6=(Y)=>W.check(k1(k6,Y)),W.e164=(Y)=>W.check(h1(h6,Y)),W.datetime=(Y)=>W.check(yQ(Y)),W.date=(Y)=>W.check(mQ(Y)),W.time=(Y)=>W.check(fQ(Y)),W.duration=(Y)=>W.check(oQ(Y))});function A(W){return U1(D6,W)}var b=K("ZodStringFormat",(W,Q)=>{R.init(W,Q),m3.init(W,Q)}),F6=K("ZodEmail",(W,Q)=>{$0.init(W,Q),b.init(W,Q)});var c3=K("ZodGUID",(W,Q)=>{D0.init(W,Q),b.init(W,Q)});var aW=K("ZodUUID",(W,Q)=>{F0.init(W,Q),b.init(W,Q)});var $6=K("ZodURL",(W,Q)=>{P0.init(W,Q),b.init(W,Q)});var P6=K("ZodEmoji",(W,Q)=>{E0.init(W,Q),b.init(W,Q)});var E6=K("ZodNanoID",(W,Q)=>{R0.init(W,Q),b.init(W,Q)});var R6=K("ZodCUID",(W,Q)=>{S0.init(W,Q),b.init(W,Q)});var S6=K("ZodCUID2",(W,Q)=>{b0.init(W,Q),b.init(W,Q)});var b6=K("ZodULID",(W,Q)=>{T0.init(W,Q),b.init(W,Q)});var T6=K("ZodXID",(W,Q)=>{_0.init(W,Q),b.init(W,Q)});var _6=K("ZodKSUID",(W,Q)=>{Z0.init(W,Q),b.init(W,Q)});var Z6=K("ZodIPv4",(W,Q)=>{g0.init(W,Q),b.init(W,Q)});var C6=K("ZodIPv6",(W,Q)=>{h0.init(W,Q),b.init(W,Q)});var j6=K("ZodCIDRv4",(W,Q)=>{x0.init(W,Q),b.init(W,Q)});var k6=K("ZodCIDRv6",(W,Q)=>{c0.init(W,Q),b.init(W,Q)});var v6=K("ZodBase64",(W,Q)=>{y0.init(W,Q),b.init(W,Q)});var g6=K("ZodBase64URL",(W,Q)=>{m0.init(W,Q),b.init(W,Q)});var h6=K("ZodE164",(W,Q)=>{f0.init(W,Q),b.init(W,Q)});var x6=K("ZodJWT",(W,Q)=>{o0.init(W,Q),b.init(W,Q)});var f3=K("ZodNumber",(W,Q)=>{DQ.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(X,G,J)=>W3(W,X,G,J),W.gt=(X,G)=>W.check(nW(X,G)),W.gte=(X,G)=>W.check(EW(X,G)),W.min=(X,G)=>W.check(EW(X,G)),W.lt=(X,G)=>W.check(dW(X,G)),W.lte=(X,G)=>W.check(PW(X,G)),W.max=(X,G)=>W.check(PW(X,G)),W.int=(X)=>W.check(u3(X)),W.safe=(X)=>W.check(u3(X)),W.positive=(X)=>W.check(nW(0,X)),W.nonnegative=(X)=>W.check(EW(0,X)),W.negative=(X)=>W.check(dW(0,X)),W.nonpositive=(X)=>W.check(PW(0,X)),W.multipleOf=(X,G)=>W.check(iW(X,G)),W.step=(X,G)=>W.check(iW(X,G)),W.finite=()=>W;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 $(W){return f1(f3,W)}var c6=K("ZodNumberFormat",(W,Q)=>{l0.init(W,Q),f3.init(W,Q)});function u3(W){return o1(c6,W)}var u6=K("ZodBoolean",(W,Q)=>{r0.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>Q3(W,Y,X,G)});function k(W){return l1(u6,W)}var y6=K("ZodNull",(W,Q)=>{p0.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>Y3(W,Y,X,G)});function o3(W){return r1(y6,W)}var m6=K("ZodUnknown",(W,Q)=>{d0.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>G3(W,Y,X,G)});function T(){return p1(m6)}var f6=K("ZodNever",(W,Q)=>{n0.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>X3(W,Y,X,G)});function o6(W){return d1(f6,W)}var l6=K("ZodArray",(W,Q)=>{i0.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>q3(W,Y,X,G),W.element=Q.element,W.min=(Y,X)=>W.check(LW(Y,X)),W.nonempty=(Y)=>W.check(LW(1,Y)),W.max=(Y,X)=>W.check(tW(Y,X)),W.length=(Y,X)=>W.check(eW(Y,X)),W.unwrap=()=>W.element});function O(W,Q){return n1(l6,W,Q)}var l3=K("ZodObject",(W,Q)=>{a0.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>K3(W,Y,X,G),D.defineLazy(W,"shape",()=>{return Q.shape}),W.keyof=()=>f(Object.keys(W._zod.def.shape)),W.catchall=(Y)=>W.clone({...W._zod.def,catchall:Y}),W.passthrough=()=>W.clone({...W._zod.def,catchall:T()}),W.loose=()=>W.clone({...W._zod.def,catchall:T()}),W.strict=()=>W.clone({...W._zod.def,catchall:o6()}),W.strip=()=>W.clone({...W._zod.def,catchall:void 0}),W.extend=(Y)=>{return D.extend(W,Y)},W.safeExtend=(Y)=>{return D.safeExtend(W,Y)},W.merge=(Y)=>D.merge(W,Y),W.pick=(Y)=>D.pick(W,Y),W.omit=(Y)=>D.omit(W,Y),W.partial=(...Y)=>D.partial(d3,W,Y[0]),W.required=(...Y)=>D.required(n3,W,Y[0])});function N(W,Q){let Y={type:"object",shape:W??{},...D.normalizeParams(Q)};return new l3(Y)}function y(W,Q){return new l3({type:"object",shape:W,catchall:T(),...D.normalizeParams(Q)})}var r3=K("ZodUnion",(W,Q)=>{FQ.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>L3(W,Y,X,G),W.options=Q.options});function S(W,Q){return new r3({type:"union",options:W,...D.normalizeParams(Q)})}var r6=K("ZodDiscriminatedUnion",(W,Q)=>{r3.init(W,Q),s0.init(W,Q)});function pQ(W,Q,Y){return new r6({type:"union",options:Q,discriminator:W,...D.normalizeParams(Y)})}var p6=K("ZodIntersection",(W,Q)=>{W1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>B3(W,Y,X,G)});function sW(W,Q){return new p6({type:"intersection",left:W,right:Q})}var d6=K("ZodRecord",(W,Q)=>{Q1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>N3(W,Y,X,G),W.keyType=Q.keyType,W.valueType=Q.valueType});function P(W,Q,Y){return new d6({type:"record",keyType:W,valueType:Q,...D.normalizeParams(Y)})}var lQ=K("ZodEnum",(W,Q)=>{Y1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(X,G,J)=>J3(W,X,G,J),W.enum=Q.entries,W.options=Object.values(Q.entries);let Y=new Set(Object.keys(Q.entries));W.extract=(X,G)=>{let J={};for(let H of X)if(Y.has(H))J[H]=Q.entries[H];else throw Error(`Key ${H} not found in enum`);return new lQ({...Q,checks:[],...D.normalizeParams(G),entries:J})},W.exclude=(X,G)=>{let J={...Q.entries};for(let H of X)if(Y.has(H))delete J[H];else throw Error(`Key ${H} not found in enum`);return new lQ({...Q,checks:[],...D.normalizeParams(G),entries:J})}});function f(W,Q){let Y=Array.isArray(W)?Object.fromEntries(W.map((X)=>[X,X])):W;return new lQ({type:"enum",entries:Y,...D.normalizeParams(Q)})}var n6=K("ZodLiteral",(W,Q)=>{X1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>H3(W,Y,X,G),W.values=new Set(Q.values),Object.defineProperty(W,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});function M(W,Q){return new n6({type:"literal",values:Array.isArray(W)?W:[W],...D.normalizeParams(Q)})}var i6=K("ZodTransform",(W,Q)=>{G1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>A3(W,Y,X,G),W._zod.parse=(Y,X)=>{if(X.direction==="backward")throw new MW(W.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(D.issue(J,Y.value,Q));else{let H=J;if(H.fatal)H.continue=!1;H.code??(H.code="custom"),H.input??(H.input=Y.value),H.inst??(H.inst=W),Y.issues.push(D.issue(H))}};let G=Q.transform(Y.value,Y);if(G instanceof Promise)return G.then((J)=>{return Y.value=J,Y});return Y.value=G,Y}});function p3(W){return new i6({type:"transform",transform:W})}var d3=K("ZodOptional",(W,Q)=>{$Q.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>uQ(W,Y,X,G),W.unwrap=()=>W._zod.def.innerType});function _(W){return new d3({type:"optional",innerType:W})}var t6=K("ZodExactOptional",(W,Q)=>{J1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>uQ(W,Y,X,G),W.unwrap=()=>W._zod.def.innerType});function e6(W){return new t6({type:"optional",innerType:W})}var a6=K("ZodNullable",(W,Q)=>{H1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>M3(W,Y,X,G),W.unwrap=()=>W._zod.def.innerType});function y3(W){return new a6({type:"nullable",innerType:W})}var s6=K("ZodDefault",(W,Q)=>{w1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>U3(W,Y,X,G),W.unwrap=()=>W._zod.def.innerType,W.removeDefault=W.unwrap});function W9(W,Q){return new s6({type:"default",innerType:W,get defaultValue(){return typeof Q==="function"?Q():D.shallowClone(Q)}})}var Q9=K("ZodPrefault",(W,Q)=>{A1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>I3(W,Y,X,G),W.unwrap=()=>W._zod.def.innerType});function Y9(W,Q){return new Q9({type:"prefault",innerType:W,get defaultValue(){return typeof Q==="function"?Q():D.shallowClone(Q)}})}var n3=K("ZodNonOptional",(W,Q)=>{q1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>z3(W,Y,X,G),W.unwrap=()=>W._zod.def.innerType});function X9(W,Q){return new n3({type:"nonoptional",innerType:W,...D.normalizeParams(Q)})}var G9=K("ZodCatch",(W,Q)=>{K1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>V3(W,Y,X,G),W.unwrap=()=>W._zod.def.innerType,W.removeCatch=W.unwrap});function J9(W,Q){return new G9({type:"catch",innerType:W,catchValue:typeof Q==="function"?Q:()=>Q})}var H9=K("ZodPipe",(W,Q)=>{L1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>O3(W,Y,X,G),W.in=Q.in,W.out=Q.out});function rQ(W,Q){return new H9({type:"pipe",in:W,out:Q})}var w9=K("ZodReadonly",(W,Q)=>{B1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>D3(W,Y,X,G),W.unwrap=()=>W._zod.def.innerType});function A9(W){return new w9({type:"readonly",innerType:W})}var i3=K("ZodCustom",(W,Q)=>{N1.init(W,Q),Z.init(W,Q),W._zod.processJSONSchema=(Y,X,G)=>w3(W,Y,X,G)});function t3(W,Q){return i1(i3,W??(()=>!0),Q)}function q9(W,Q={}){return t1(i3,W,Q)}function K9(W){return e1(W)}function dQ(W,Q){return rQ(p3(W),Q)}r(PQ());var L9="io.modelcontextprotocol/related-task",QQ="2.0",j=t3((W)=>W!==null&&(typeof W==="object"||typeof W==="function")),a3=S([A(),$().int()]),s3=A(),IG=y({ttl:$().optional(),pollInterval:$().optional()}),B9=N({ttl:$().optional()}),N9=N({taskId:A()}),nQ=y({progressToken:a3.optional(),[L9]:N9.optional()}),l=N({_meta:nQ.optional()}),YQ=l.extend({task:B9.optional()});var h=N({method:A(),params:l.loose().optional()}),p=N({_meta:nQ.optional()}),d=N({method:A(),params:p.loose().optional()}),x=y({_meta:nQ.optional()}),XQ=S([A(),$().int()]),M9=N({jsonrpc:M(QQ),id:XQ,...h.shape}).strict();var z9=N({jsonrpc:M(QQ),...d.shape}).strict();var W4=N({jsonrpc:M(QQ),id:XQ,result:x}).strict();var e3;(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"})(e3||(e3={}));var Q4=N({jsonrpc:M(QQ),id:XQ.optional(),error:N({code:$().int(),message:A(),data:T().optional()})}).strict();var Y4=S([M9,z9,W4,Q4]),VG=S([W4,Q4]),X4=x.strict(),U9=p.extend({requestId:XQ.optional(),reason:A().optional()}),G4=d.extend({method:M("notifications/cancelled"),params:U9}),I9=N({src:A(),mimeType:A().optional(),sizes:O(A()).optional(),theme:f(["light","dark"]).optional()}),TW=N({icons:O(I9).optional()}),BW=N({name:A(),title:A().optional()}),J4=BW.extend({...BW.shape,...TW.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),V9=sW(N({applyDefaults:k().optional()}),P(A(),T())),O9=dQ((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)){if(Object.keys(W).length===0)return{form:{}}}return W},sW(N({form:V9.optional(),url:j.optional()}),P(A(),T()).optional())),D9=y({list:j.optional(),cancel:j.optional(),requests:y({sampling:y({createMessage:j.optional()}).optional(),elicitation:y({create:j.optional()}).optional()}).optional()}),F9=y({list:j.optional(),cancel:j.optional(),requests:y({tools:y({call:j.optional()}).optional()}).optional()}),$9=N({experimental:P(A(),j).optional(),sampling:N({context:j.optional(),tools:j.optional()}).optional(),elicitation:O9.optional(),roots:N({listChanged:k().optional()}).optional(),tasks:D9.optional(),extensions:P(A(),j).optional()}),P9=l.extend({protocolVersion:A(),capabilities:$9,clientInfo:J4}),E9=h.extend({method:M("initialize"),params:P9});var R9=N({experimental:P(A(),j).optional(),logging:j.optional(),completions:j.optional(),prompts:N({listChanged:k().optional()}).optional(),resources:N({subscribe:k().optional(),listChanged:k().optional()}).optional(),tools:N({listChanged:k().optional()}).optional(),tasks:F9.optional(),extensions:P(A(),j).optional()}),S9=x.extend({protocolVersion:A(),capabilities:R9,serverInfo:J4,instructions:A().optional()}),b9=d.extend({method:M("notifications/initialized"),params:p.optional()});var H4=h.extend({method:M("ping"),params:l.optional()}),T9=N({progress:$(),total:_($()),message:_(A())}),_9=N({...p.shape,...T9.shape,progressToken:a3}),w4=d.extend({method:M("notifications/progress"),params:_9}),Z9=l.extend({cursor:s3.optional()}),_W=h.extend({params:Z9.optional()}),ZW=x.extend({nextCursor:s3.optional()}),C9=f(["working","input_required","completed","failed","cancelled"]),CW=N({taskId:A(),status:C9,ttl:S([$(),o3()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:_($()),statusMessage:_(A())}),A4=x.extend({task:CW}),j9=p.merge(CW),q4=d.extend({method:M("notifications/tasks/status"),params:j9}),K4=h.extend({method:M("tasks/get"),params:l.extend({taskId:A()})}),L4=x.merge(CW),B4=h.extend({method:M("tasks/result"),params:l.extend({taskId:A()})}),OG=x.loose(),N4=_W.extend({method:M("tasks/list")}),M4=ZW.extend({tasks:O(CW)}),z4=h.extend({method:M("tasks/cancel"),params:l.extend({taskId:A()})}),DG=x.merge(CW),U4=N({uri:A(),mimeType:_(A()),_meta:P(A(),T()).optional()}),I4=U4.extend({text:A()}),iQ=A().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),V4=U4.extend({blob:iQ}),jW=f(["user","assistant"]),NW=N({audience:O(jW).optional(),priority:$().min(0).max(1).optional(),lastModified:bW.datetime({offset:!0}).optional()}),O4=N({...BW.shape,...TW.shape,uri:A(),description:_(A()),mimeType:_(A()),size:_($()),annotations:NW.optional(),_meta:_(y({}))}),k9=N({...BW.shape,...TW.shape,uriTemplate:A(),description:_(A()),mimeType:_(A()),annotations:NW.optional(),_meta:_(y({}))}),v9=_W.extend({method:M("resources/list")}),g9=ZW.extend({resources:O(O4)}),h9=_W.extend({method:M("resources/templates/list")}),x9=ZW.extend({resourceTemplates:O(k9)}),tQ=l.extend({uri:A()}),c9=tQ,u9=h.extend({method:M("resources/read"),params:c9}),y9=x.extend({contents:O(S([I4,V4]))}),m9=d.extend({method:M("notifications/resources/list_changed"),params:p.optional()}),f9=tQ,o9=h.extend({method:M("resources/subscribe"),params:f9}),l9=tQ,r9=h.extend({method:M("resources/unsubscribe"),params:l9}),p9=p.extend({uri:A()}),d9=d.extend({method:M("notifications/resources/updated"),params:p9}),n9=N({name:A(),description:_(A()),required:_(k())}),i9=N({...BW.shape,...TW.shape,description:_(A()),arguments:_(O(n9)),_meta:_(y({}))}),t9=_W.extend({method:M("prompts/list")}),e9=ZW.extend({prompts:O(i9)}),a9=l.extend({name:A(),arguments:P(A(),A()).optional()}),s9=h.extend({method:M("prompts/get"),params:a9}),eQ=N({type:M("text"),text:A(),annotations:NW.optional(),_meta:P(A(),T()).optional()}),aQ=N({type:M("image"),data:iQ,mimeType:A(),annotations:NW.optional(),_meta:P(A(),T()).optional()}),sQ=N({type:M("audio"),data:iQ,mimeType:A(),annotations:NW.optional(),_meta:P(A(),T()).optional()}),WX=N({type:M("tool_use"),name:A(),id:A(),input:P(A(),T()),_meta:P(A(),T()).optional()}),QX=N({type:M("resource"),resource:S([I4,V4]),annotations:NW.optional(),_meta:P(A(),T()).optional()}),YX=O4.extend({type:M("resource_link")}),WY=S([eQ,aQ,sQ,YX,QX]),XX=N({role:jW,content:WY}),GX=x.extend({description:A().optional(),messages:O(XX)}),JX=d.extend({method:M("notifications/prompts/list_changed"),params:p.optional()}),HX=N({title:A().optional(),readOnlyHint:k().optional(),destructiveHint:k().optional(),idempotentHint:k().optional(),openWorldHint:k().optional()}),wX=N({taskSupport:f(["required","optional","forbidden"]).optional()}),D4=N({...BW.shape,...TW.shape,description:A().optional(),inputSchema:N({type:M("object"),properties:P(A(),j).optional(),required:O(A()).optional()}).catchall(T()),outputSchema:N({type:M("object"),properties:P(A(),j).optional(),required:O(A()).optional()}).catchall(T()).optional(),annotations:HX.optional(),execution:wX.optional(),_meta:P(A(),T()).optional()}),AX=_W.extend({method:M("tools/list")}),qX=ZW.extend({tools:O(D4)}),F4=x.extend({content:O(WY).default([]),structuredContent:P(A(),T()).optional(),isError:k().optional()}),FG=F4.or(x.extend({toolResult:T()})),KX=YQ.extend({name:A(),arguments:P(A(),T()).optional()}),LX=h.extend({method:M("tools/call"),params:KX}),BX=d.extend({method:M("notifications/tools/list_changed"),params:p.optional()}),$G=N({autoRefresh:k().default(!0),debounceMs:$().int().nonnegative().default(300)}),$4=f(["debug","info","notice","warning","error","critical","alert","emergency"]),NX=l.extend({level:$4}),MX=h.extend({method:M("logging/setLevel"),params:NX}),zX=p.extend({level:$4,logger:A().optional(),data:T()}),UX=d.extend({method:M("notifications/message"),params:zX}),IX=N({name:A().optional()}),VX=N({hints:O(IX).optional(),costPriority:$().min(0).max(1).optional(),speedPriority:$().min(0).max(1).optional(),intelligencePriority:$().min(0).max(1).optional()}),OX=N({mode:f(["auto","required","none"]).optional()}),DX=N({type:M("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:O(WY).default([]),structuredContent:N({}).loose().optional(),isError:k().optional(),_meta:P(A(),T()).optional()}),FX=pQ("type",[eQ,aQ,sQ]),WQ=pQ("type",[eQ,aQ,sQ,WX,DX]),$X=N({role:jW,content:S([WQ,O(WQ)]),_meta:P(A(),T()).optional()}),PX=YQ.extend({messages:O($X),modelPreferences:VX.optional(),systemPrompt:A().optional(),includeContext:f(["none","thisServer","allServers"]).optional(),temperature:$().optional(),maxTokens:$().int(),stopSequences:O(A()).optional(),metadata:j.optional(),tools:O(D4).optional(),toolChoice:OX.optional()}),EX=h.extend({method:M("sampling/createMessage"),params:PX}),RX=x.extend({model:A(),stopReason:_(f(["endTurn","stopSequence","maxTokens"]).or(A())),role:jW,content:FX}),SX=x.extend({model:A(),stopReason:_(f(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:jW,content:S([WQ,O(WQ)])}),bX=N({type:M("boolean"),title:A().optional(),description:A().optional(),default:k().optional()}),TX=N({type:M("string"),title:A().optional(),description:A().optional(),minLength:$().optional(),maxLength:$().optional(),format:f(["email","uri","date","date-time"]).optional(),default:A().optional()}),_X=N({type:f(["number","integer"]),title:A().optional(),description:A().optional(),minimum:$().optional(),maximum:$().optional(),default:$().optional()}),ZX=N({type:M("string"),title:A().optional(),description:A().optional(),enum:O(A()),default:A().optional()}),CX=N({type:M("string"),title:A().optional(),description:A().optional(),oneOf:O(N({const:A(),title:A()})),default:A().optional()}),jX=N({type:M("string"),title:A().optional(),description:A().optional(),enum:O(A()),enumNames:O(A()).optional(),default:A().optional()}),kX=S([ZX,CX]),vX=N({type:M("array"),title:A().optional(),description:A().optional(),minItems:$().optional(),maxItems:$().optional(),items:N({type:M("string"),enum:O(A())}),default:O(A()).optional()}),gX=N({type:M("array"),title:A().optional(),description:A().optional(),minItems:$().optional(),maxItems:$().optional(),items:N({anyOf:O(N({const:A(),title:A()}))}),default:O(A()).optional()}),hX=S([vX,gX]),xX=S([jX,kX,hX]),cX=S([xX,bX,TX,_X]),uX=YQ.extend({mode:M("form").optional(),message:A(),requestedSchema:N({type:M("object"),properties:P(A(),cX),required:O(A()).optional()})}),yX=YQ.extend({mode:M("url"),message:A(),elicitationId:A(),url:A().url()}),mX=S([uX,yX]),fX=h.extend({method:M("elicitation/create"),params:mX}),oX=p.extend({elicitationId:A()}),lX=d.extend({method:M("notifications/elicitation/complete"),params:oX}),rX=x.extend({action:f(["accept","decline","cancel"]),content:dQ((W)=>W===null?void 0:W,P(A(),S([A(),$(),k(),O(A())])).optional())}),pX=N({type:M("ref/resource"),uri:A()});var dX=N({type:M("ref/prompt"),name:A()}),nX=l.extend({ref:S([dX,pX]),argument:N({name:A(),value:A()}),context:N({arguments:P(A(),A()).optional()}).optional()}),iX=h.extend({method:M("completion/complete"),params:nX});var tX=x.extend({completion:y({values:O(A()).max(100),total:_($().int()),hasMore:_(k())})}),eX=N({uri:A().startsWith("file://"),name:A().optional(),_meta:P(A(),T()).optional()}),aX=h.extend({method:M("roots/list"),params:l.optional()}),sX=x.extend({roots:O(eX)}),W2=d.extend({method:M("notifications/roots/list_changed"),params:p.optional()}),PG=S([H4,E9,iX,MX,s9,t9,v9,h9,u9,o9,r9,LX,AX,K4,B4,N4,z4]),EG=S([G4,w4,b9,W2,q4]),RG=S([X4,RX,SX,rX,sX,L4,M4,A4]),SG=S([H4,EX,fX,aX,K4,B4,N4,z4]),bG=S([G4,w4,UX,d9,m9,BX,JX,q4,lX]),TG=S([X4,S9,tX,GX,e9,g9,x9,y9,F4,qX,L4,M4,A4]);class QY{append(W){this._buffer=this._buffer?Buffer.concat([this._buffer,W]):W}readMessage(){if(!this._buffer)return null;let W=this._buffer.indexOf(`
|
|
41
|
-
`);if(W===-1)return null;let
|
|
42
|
-
`}class
|
|
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(`
|
|
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,Y){this._stdin=W,this._stdout=X,this._started=!1,this._ondata=(Q)=>{try{this._readBuffer.append(Q),this.processReadBuffer()}catch(K){this.onerror?.(K),this.close().catch(()=>{})}},this._onerror=(Q)=>{this.onerror?.(Q)},this._readBuffer=new t9({maxBufferSize:Y?.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 Y=aW(W);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}import{existsSync as c7}from"node:fs";u1();async function V3(W){let X=$4(await W),[Y,Q,{QuickJSWASMModule:K}]=await Promise.all([X.importModuleLoader().then($4),X.importFFI(),Promise.resolve().then(() => (O3(),F3)).then($4)]),q=await Y();q.type="sync";let J=new Q(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=(Y)=>new URL(Y,W).href;return{type:"sync",importFFI:()=>import(X("ffi.mjs")).then((Y)=>Y.QuickJSFFI),importModuleLoader:()=>import(X("emscripten-module.mjs")).then((Y)=>Y.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
|
+
globalThis.${x7}(String(name), JSON.stringify(args ?? {}))
|
|
74
|
+
.then((json) => JSON.parse(json));`;var g7=6,h7=["log","warn","error","info","debug"],y7="__mcpcloud_console",Dq=`globalThis.console = {
|
|
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
|
+
`)}
|
|
77
|
+
};`;var f7=null;function I3(W){f7=W}var C3=[`./${P3}/`,"../engine/vendor/","../../engine/vendor/"];function m7(W=new URL(import.meta.url)){for(let X of C3){let Y=new URL(X,W);if(c7(new URL("emscripten-module.wasm",Y)))return Y}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 Y=W.createServer(X),Q=new c1;await Y.connect(Q)}export{u7 as startStdioServer,c1 as StdioServerTransport};
|