@f2c/mcp 0.2.1 → 0.2.2

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/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- var j1=Object.create;var{getPrototypeOf:z1,defineProperty:N2,getOwnPropertyNames:A1}=Object;var V1=Object.prototype.hasOwnProperty;var O2=($,W,X)=>{X=$!=null?j1(z1($)):{};let H=W||!$||!$.__esModule?N2(X,"default",{value:$,enumerable:!0}):X;for(let Q of A1($))if(!V1.call(H,Q))N2(H,Q,{get:()=>$[Q],enumerable:!0});return H};var F4=($,W)=>()=>(W||$((W={exports:{}}).exports,W),W.exports);var b1=($,W)=>{for(var X in W)N2($,X,{get:W[X],enumerable:!0,configurable:!0,set:(H)=>W[X]=()=>H})};var J={};b1(J,{void:()=>$W,util:()=>U,unknown:()=>s1,union:()=>QW,undefined:()=>r1,tuple:()=>GW,transformer:()=>NW,symbol:()=>o1,string:()=>s2,strictObject:()=>HW,setErrorMap:()=>_1,set:()=>DW,record:()=>wW,quotelessJson:()=>N1,promise:()=>bW,preprocess:()=>qW,pipeline:()=>UW,ostring:()=>LW,optional:()=>OW,onumber:()=>KW,oboolean:()=>FW,objectUtil:()=>_2,object:()=>XW,number:()=>e2,nullable:()=>_W,null:()=>a1,never:()=>e1,nativeEnum:()=>VW,nan:()=>c1,map:()=>BW,makeIssue:()=>S$,literal:()=>zW,lazy:()=>jW,late:()=>u1,isValid:()=>a,isDirty:()=>h$,isAsync:()=>B$,isAborted:()=>x$,intersection:()=>YW,instanceof:()=>i1,getParsedType:()=>u,getErrorMap:()=>w$,function:()=>MW,enum:()=>AW,effect:()=>NW,discriminatedUnion:()=>JW,defaultErrorMap:()=>d,datetimeRegex:()=>r2,date:()=>d1,custom:()=>t2,coerce:()=>SW,boolean:()=>$0,bigint:()=>p1,array:()=>WW,any:()=>t1,addIssueToContext:()=>z,ZodVoid:()=>f$,ZodUnknown:()=>t,ZodUnion:()=>V$,ZodUndefined:()=>z$,ZodType:()=>q,ZodTuple:()=>c,ZodTransformer:()=>x,ZodSymbol:()=>R$,ZodString:()=>g,ZodSet:()=>Y$,ZodSchema:()=>q,ZodRecord:()=>k$,ZodReadonly:()=>L$,ZodPromise:()=>G$,ZodPipeline:()=>C$,ZodParsedType:()=>j,ZodOptional:()=>k,ZodObject:()=>K,ZodNumber:()=>s,ZodNullable:()=>r,ZodNull:()=>A$,ZodNever:()=>i,ZodNativeEnum:()=>_$,ZodNaN:()=>P$,ZodMap:()=>I$,ZodLiteral:()=>O$,ZodLazy:()=>N$,ZodIssueCode:()=>D,ZodIntersection:()=>b$,ZodFunction:()=>M$,ZodFirstPartyTypeKind:()=>M,ZodError:()=>f,ZodEnum:()=>$$,ZodEffects:()=>x,ZodDiscriminatedUnion:()=>l$,ZodDefault:()=>q$,ZodDate:()=>Q$,ZodCatch:()=>U$,ZodBranded:()=>m$,ZodBoolean:()=>j$,ZodBigInt:()=>e,ZodArray:()=>T,ZodAny:()=>J$,Schema:()=>q,ParseStatus:()=>E,OK:()=>v,NEVER:()=>EW,INVALID:()=>b,EMPTY_PATH:()=>q1,DIRTY:()=>H$,BRAND:()=>n1});var U;(function($){$.assertEqual=(Q)=>{};function W(Q){}$.assertIs=W;function X(Q){throw new Error}$.assertNever=X,$.arrayToEnum=(Q)=>{let Y={};for(let G of Q)Y[G]=G;return Y},$.getValidEnumValues=(Q)=>{let Y=$.objectKeys(Q).filter((w)=>typeof Q[Q[w]]!=="number"),G={};for(let w of Y)G[w]=Q[w];return $.objectValues(G)},$.objectValues=(Q)=>{return $.objectKeys(Q).map(function(Y){return Q[Y]})},$.objectKeys=typeof Object.keys==="function"?(Q)=>Object.keys(Q):(Q)=>{let Y=[];for(let G in Q)if(Object.prototype.hasOwnProperty.call(Q,G))Y.push(G);return Y},$.find=(Q,Y)=>{for(let G of Q)if(Y(G))return G;return},$.isInteger=typeof Number.isInteger==="function"?(Q)=>Number.isInteger(Q):(Q)=>typeof Q==="number"&&Number.isFinite(Q)&&Math.floor(Q)===Q;function H(Q,Y=" | "){return Q.map((G)=>typeof G==="string"?`'${G}'`:G).join(Y)}$.joinValues=H,$.jsonStringifyReplacer=(Q,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(U||(U={}));var _2;(function($){$.mergeShapes=(W,X)=>{return{...W,...X}}})(_2||(_2={}));var j=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),u=($)=>{switch(typeof $){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN($)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":if(Array.isArray($))return j.array;if($===null)return j.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return j.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return j.map;if(typeof Set!=="undefined"&&$ instanceof Set)return j.set;if(typeof Date!=="undefined"&&$ instanceof Date)return j.date;return j.object;default:return j.unknown}};var D=U.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),N1=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class f extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(X)=>{this.issues=[...this.issues,X]},this.addIssues=(X=[])=>{this.issues=[...this.issues,...X]};let W=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,W);else this.__proto__=W;this.name="ZodError",this.issues=$}format($){let W=$||function(Q){return Q.message},X={_errors:[]},H=(Q)=>{for(let Y of Q.issues)if(Y.code==="invalid_union")Y.unionErrors.map(H);else if(Y.code==="invalid_return_type")H(Y.returnTypeError);else if(Y.code==="invalid_arguments")H(Y.argumentsError);else if(Y.path.length===0)X._errors.push(W(Y));else{let G=X,w=0;while(w<Y.path.length){let B=Y.path[w];if(w!==Y.path.length-1)G[B]=G[B]||{_errors:[]};else G[B]=G[B]||{_errors:[]},G[B]._errors.push(W(Y));G=G[B],w++}}};return H(this),X}static assert($){if(!($ instanceof f))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(W)=>W.message){let W={},X=[];for(let H of this.issues)if(H.path.length>0)W[H.path[0]]=W[H.path[0]]||[],W[H.path[0]].push($(H));else X.push($(H));return{formErrors:X,fieldErrors:W}}get formErrors(){return this.flatten()}}f.create=($)=>{return new f($)};var O1=($,W)=>{let X;switch($.code){case D.invalid_type:if($.received===j.undefined)X="Required";else X=`Expected ${$.expected}, received ${$.received}`;break;case D.invalid_literal:X=`Invalid literal value, expected ${JSON.stringify($.expected,U.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:X=`Unrecognized key(s) in object: ${U.joinValues($.keys,", ")}`;break;case D.invalid_union:X="Invalid input";break;case D.invalid_union_discriminator:X=`Invalid discriminator value. Expected ${U.joinValues($.options)}`;break;case D.invalid_enum_value:X=`Invalid enum value. Expected ${U.joinValues($.options)}, received '${$.received}'`;break;case D.invalid_arguments:X="Invalid function arguments";break;case D.invalid_return_type:X="Invalid function return type";break;case D.invalid_date:X="Invalid date";break;case D.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(X=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")X=`${X} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)X=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)X=`Invalid input: must end with "${$.validation.endsWith}"`;else U.assertNever($.validation);else if($.validation!=="regex")X=`Invalid ${$.validation}`;else X="Invalid";break;case D.too_small:if($.type==="array")X=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")X=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")X=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")X=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else X="Invalid input";break;case D.too_big:if($.type==="array")X=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")X=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")X=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")X=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")X=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else X="Invalid input";break;case D.custom:X="Invalid input";break;case D.invalid_intersection_types:X="Intersection results could not be merged";break;case D.not_multiple_of:X=`Number must be a multiple of ${$.multipleOf}`;break;case D.not_finite:X="Number must be finite";break;default:X=W.defaultError,U.assertNever($)}return{message:X}},d=O1;var u2=d;function _1($){u2=$}function w$(){return u2}var S$=($)=>{let{data:W,path:X,errorMaps:H,issueData:Q}=$,Y=[...X,...Q.path||[]],G={...Q,path:Y};if(Q.message!==void 0)return{...Q,path:Y,message:Q.message};let w="",B=H.filter((A)=>!!A).slice().reverse();for(let A of B)w=A(G,{data:W,defaultError:w}).message;return{...Q,path:Y,message:w}},q1=[];function z($,W){let X=w$(),H=S$({issueData:W,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,X,X===d?void 0:d].filter((Q)=>!!Q)});$.common.issues.push(H)}class E{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,W){let X=[];for(let H of W){if(H.status==="aborted")return b;if(H.status==="dirty")$.dirty();X.push(H.value)}return{status:$.value,value:X}}static async mergeObjectAsync($,W){let X=[];for(let H of W){let Q=await H.key,Y=await H.value;X.push({key:Q,value:Y})}return E.mergeObjectSync($,X)}static mergeObjectSync($,W){let X={};for(let H of W){let{key:Q,value:Y}=H;if(Q.status==="aborted")return b;if(Y.status==="aborted")return b;if(Q.status==="dirty")$.dirty();if(Y.status==="dirty")$.dirty();if(Q.value!=="__proto__"&&(typeof Y.value!=="undefined"||H.alwaysSet))X[Q.value]=Y.value}return{status:$.value,value:X}}}var b=Object.freeze({status:"aborted"}),H$=($)=>({status:"dirty",value:$}),v=($)=>({status:"valid",value:$}),x$=($)=>$.status==="aborted",h$=($)=>$.status==="dirty",a=($)=>$.status==="valid",B$=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var V;(function($){$.errToObj=(W)=>typeof W==="string"?{message:W}:W||{},$.toString=(W)=>typeof W==="string"?W:W?.message})(V||(V={}));var Z$=function($,W,X,H){if(X==="a"&&!H)throw new TypeError("Private accessor was defined without a getter");if(typeof W==="function"?$!==W||!H:!W.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?H:X==="a"?H.call($):H?H.value:W.get($)},p2=function($,W,X,H,Q){if(H==="m")throw new TypeError("Private method is not writable");if(H==="a"&&!Q)throw new TypeError("Private accessor was defined without a setter");if(typeof W==="function"?$!==W||!Q:!W.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return H==="a"?Q.call($,X):Q?Q.value=X:W.set($,X),X},E$,v$;class y{constructor($,W,X,H){this._cachedPath=[],this.parent=$,this.data=W,this._path=X,this._key=H}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var i2=($,W)=>{if(a(W))return{success:!0,data:W.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let X=new f($.common.issues);return this._error=X,this._error}}}};function O($){if(!$)return{};let{errorMap:W,invalid_type_error:X,required_error:H,description:Q}=$;if(W&&(X||H))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(W)return{errorMap:W,description:Q};return{errorMap:(G,w)=>{let{message:B}=$;if(G.code==="invalid_enum_value")return{message:B??w.defaultError};if(typeof w.data==="undefined")return{message:B??H??w.defaultError};if(G.code!=="invalid_type")return{message:w.defaultError};return{message:B??X??w.defaultError}},description:Q}}class q{get description(){return this._def.description}_getType($){return u($.data)}_getOrReturnCtx($,W){return W||{common:$.parent.common,data:$.data,parsedType:u($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new E,ctx:{common:$.parent.common,data:$.data,parsedType:u($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let W=this._parse($);if(B$(W))throw new Error("Synchronous parse encountered promise.");return W}_parseAsync($){let W=this._parse($);return Promise.resolve(W)}parse($,W){let X=this.safeParse($,W);if(X.success)return X.data;throw X.error}safeParse($,W){let X={common:{issues:[],async:W?.async??!1,contextualErrorMap:W?.errorMap},path:W?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:u($)},H=this._parseSync({data:$,path:X.path,parent:X});return i2(X,H)}"~validate"($){let W={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:u($)};if(!this["~standard"].async)try{let X=this._parseSync({data:$,path:[],parent:W});return a(X)?{value:X.value}:{issues:W.common.issues}}catch(X){if(X?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;W.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:W}).then((X)=>a(X)?{value:X.value}:{issues:W.common.issues})}async parseAsync($,W){let X=await this.safeParseAsync($,W);if(X.success)return X.data;throw X.error}async safeParseAsync($,W){let X={common:{issues:[],contextualErrorMap:W?.errorMap,async:!0},path:W?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:u($)},H=this._parse({data:$,path:X.path,parent:X}),Q=await(B$(H)?H:Promise.resolve(H));return i2(X,Q)}refine($,W){let X=(H)=>{if(typeof W==="string"||typeof W==="undefined")return{message:W};else if(typeof W==="function")return W(H);else return W};return this._refinement((H,Q)=>{let Y=$(H),G=()=>Q.addIssue({code:D.custom,...X(H)});if(typeof Promise!=="undefined"&&Y instanceof Promise)return Y.then((w)=>{if(!w)return G(),!1;else return!0});if(!Y)return G(),!1;else return!0})}refinement($,W){return this._refinement((X,H)=>{if(!$(X))return H.addIssue(typeof W==="function"?W(X,H):W),!1;else return!0})}_refinement($){return new x({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(W)=>this["~validate"](W)}}optional(){return k.create(this,this._def)}nullable(){return r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return T.create(this)}promise(){return G$.create(this,this._def)}or($){return V$.create([this,$],this._def)}and($){return b$.create(this,$,this._def)}transform($){return new x({...O(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:$}})}default($){let W=typeof $==="function"?$:()=>$;return new q$({...O(this._def),innerType:this,defaultValue:W,typeName:M.ZodDefault})}brand(){return new m$({typeName:M.ZodBranded,type:this,...O(this._def)})}catch($){let W=typeof $==="function"?$:()=>$;return new U$({...O(this._def),innerType:this,catchValue:W,typeName:M.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return C$.create(this,$)}readonly(){return L$.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var U1=/^c[^\s-]{8,}$/i,L1=/^[0-9a-z]+$/,K1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,F1=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,S1=/^[a-z0-9_-]{21}$/i,E1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,v1=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,R1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,f1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",q2,k1=/^(?:(?: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])$/,I1=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,P1=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,C1=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,g1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,T1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,d2="((\\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])))",y1=new RegExp(`^${d2}$`);function o2($){let W="[0-5]\\d";if($.precision)W=`${W}\\.\\d{${$.precision}}`;else if($.precision==null)W=`${W}(\\.\\d+)?`;let X=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${W})${X}`}function x1($){return new RegExp(`^${o2($)}$`)}function r2($){let W=`${d2}T${o2($)}`,X=[];if(X.push($.local?"Z?":"Z"),$.offset)X.push("([+-]\\d{2}:?\\d{2})");return W=`${W}(${X.join("|")})`,new RegExp(`^${W}$`)}function h1($,W){if((W==="v4"||!W)&&k1.test($))return!0;if((W==="v6"||!W)&&P1.test($))return!0;return!1}function Z1($,W){if(!E1.test($))return!1;try{let[X]=$.split("."),H=X.replace(/-/g,"+").replace(/_/g,"/").padEnd(X.length+(4-X.length%4)%4,"="),Q=JSON.parse(atob(H));if(typeof Q!=="object"||Q===null)return!1;if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(W&&Q.alg!==W)return!1;return!0}catch{return!1}}function l1($,W){if((W==="v4"||!W)&&I1.test($))return!0;if((W==="v6"||!W)&&C1.test($))return!0;return!1}class g extends q{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==j.string){let Q=this._getOrReturnCtx($);return z(Q,{code:D.invalid_type,expected:j.string,received:Q.parsedType}),b}let X=new E,H=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if($.data.length<Q.value)H=this._getOrReturnCtx($,H),z(H,{code:D.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),X.dirty()}else if(Q.kind==="max"){if($.data.length>Q.value)H=this._getOrReturnCtx($,H),z(H,{code:D.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),X.dirty()}else if(Q.kind==="length"){let Y=$.data.length>Q.value,G=$.data.length<Q.value;if(Y||G){if(H=this._getOrReturnCtx($,H),Y)z(H,{code:D.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});else if(G)z(H,{code:D.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});X.dirty()}}else if(Q.kind==="email"){if(!R1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"email",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="emoji"){if(!q2)q2=new RegExp(f1,"u");if(!q2.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"emoji",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="uuid"){if(!F1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"uuid",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="nanoid"){if(!S1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"nanoid",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="cuid"){if(!U1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"cuid",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="cuid2"){if(!L1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"cuid2",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="ulid"){if(!K1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"ulid",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="url")try{new URL($.data)}catch{H=this._getOrReturnCtx($,H),z(H,{validation:"url",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="regex"){if(Q.regex.lastIndex=0,!Q.regex.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"regex",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="trim")$.data=$.data.trim();else if(Q.kind==="includes"){if(!$.data.includes(Q.value,Q.position))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:{includes:Q.value,position:Q.position},message:Q.message}),X.dirty()}else if(Q.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(Q.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(Q.kind==="startsWith"){if(!$.data.startsWith(Q.value))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:{startsWith:Q.value},message:Q.message}),X.dirty()}else if(Q.kind==="endsWith"){if(!$.data.endsWith(Q.value))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:{endsWith:Q.value},message:Q.message}),X.dirty()}else if(Q.kind==="datetime"){if(!r2(Q).test($.data))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:"datetime",message:Q.message}),X.dirty()}else if(Q.kind==="date"){if(!y1.test($.data))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:"date",message:Q.message}),X.dirty()}else if(Q.kind==="time"){if(!x1(Q).test($.data))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:"time",message:Q.message}),X.dirty()}else if(Q.kind==="duration"){if(!v1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"duration",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="ip"){if(!h1($.data,Q.version))H=this._getOrReturnCtx($,H),z(H,{validation:"ip",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="jwt"){if(!Z1($.data,Q.alg))H=this._getOrReturnCtx($,H),z(H,{validation:"jwt",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="cidr"){if(!l1($.data,Q.version))H=this._getOrReturnCtx($,H),z(H,{validation:"cidr",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="base64"){if(!g1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"base64",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="base64url"){if(!T1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"base64url",code:D.invalid_string,message:Q.message}),X.dirty()}else U.assertNever(Q);return{status:X.value,value:$.data}}_regex($,W,X){return this.refinement((H)=>$.test(H),{validation:W,code:D.invalid_string,...V.errToObj(X)})}_addCheck($){return new g({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...V.errToObj($)})}url($){return this._addCheck({kind:"url",...V.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...V.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...V.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...V.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...V.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...V.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...V.errToObj($)})}base64($){return this._addCheck({kind:"base64",...V.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...V.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...V.errToObj($)})}ip($){return this._addCheck({kind:"ip",...V.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...V.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision==="undefined"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...V.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision==="undefined"?null:$?.precision,...V.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...V.errToObj($)})}regex($,W){return this._addCheck({kind:"regex",regex:$,...V.errToObj(W)})}includes($,W){return this._addCheck({kind:"includes",value:$,position:W?.position,...V.errToObj(W?.message)})}startsWith($,W){return this._addCheck({kind:"startsWith",value:$,...V.errToObj(W)})}endsWith($,W){return this._addCheck({kind:"endsWith",value:$,...V.errToObj(W)})}min($,W){return this._addCheck({kind:"min",value:$,...V.errToObj(W)})}max($,W){return this._addCheck({kind:"max",value:$,...V.errToObj(W)})}length($,W){return this._addCheck({kind:"length",value:$,...V.errToObj(W)})}nonempty($){return this.min(1,V.errToObj($))}trim(){return new g({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new g({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new g({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxLength(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}}g.create=($)=>{return new g({checks:[],typeName:M.ZodString,coerce:$?.coerce??!1,...O($)})};function m1($,W){let X=($.toString().split(".")[1]||"").length,H=(W.toString().split(".")[1]||"").length,Q=X>H?X:H,Y=Number.parseInt($.toFixed(Q).replace(".","")),G=Number.parseInt(W.toFixed(Q).replace(".",""));return Y%G/10**Q}class s extends q{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==j.number){let Q=this._getOrReturnCtx($);return z(Q,{code:D.invalid_type,expected:j.number,received:Q.parsedType}),b}let X=void 0,H=new E;for(let Q of this._def.checks)if(Q.kind==="int"){if(!U.isInteger($.data))X=this._getOrReturnCtx($,X),z(X,{code:D.invalid_type,expected:"integer",received:"float",message:Q.message}),H.dirty()}else if(Q.kind==="min"){if(Q.inclusive?$.data<Q.value:$.data<=Q.value)X=this._getOrReturnCtx($,X),z(X,{code:D.too_small,minimum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),H.dirty()}else if(Q.kind==="max"){if(Q.inclusive?$.data>Q.value:$.data>=Q.value)X=this._getOrReturnCtx($,X),z(X,{code:D.too_big,maximum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),H.dirty()}else if(Q.kind==="multipleOf"){if(m1($.data,Q.value)!==0)X=this._getOrReturnCtx($,X),z(X,{code:D.not_multiple_of,multipleOf:Q.value,message:Q.message}),H.dirty()}else if(Q.kind==="finite"){if(!Number.isFinite($.data))X=this._getOrReturnCtx($,X),z(X,{code:D.not_finite,message:Q.message}),H.dirty()}else U.assertNever(Q);return{status:H.value,value:$.data}}gte($,W){return this.setLimit("min",$,!0,V.toString(W))}gt($,W){return this.setLimit("min",$,!1,V.toString(W))}lte($,W){return this.setLimit("max",$,!0,V.toString(W))}lt($,W){return this.setLimit("max",$,!1,V.toString(W))}setLimit($,W,X,H){return new s({...this._def,checks:[...this._def.checks,{kind:$,value:W,inclusive:X,message:V.toString(H)}]})}_addCheck($){return new s({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:V.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString($)})}multipleOf($,W){return this._addCheck({kind:"multipleOf",value:$,message:V.toString(W)})}finite($){return this._addCheck({kind:"finite",message:V.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString($)})}get minValue(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxValue(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&U.isInteger($.value))}get isFinite(){let $=null,W=null;for(let X of this._def.checks)if(X.kind==="finite"||X.kind==="int"||X.kind==="multipleOf")return!0;else if(X.kind==="min"){if(W===null||X.value>W)W=X.value}else if(X.kind==="max"){if($===null||X.value<$)$=X.value}return Number.isFinite(W)&&Number.isFinite($)}}s.create=($)=>{return new s({checks:[],typeName:M.ZodNumber,coerce:$?.coerce||!1,...O($)})};class e extends q{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==j.bigint)return this._getInvalidInput($);let X=void 0,H=new E;for(let Q of this._def.checks)if(Q.kind==="min"){if(Q.inclusive?$.data<Q.value:$.data<=Q.value)X=this._getOrReturnCtx($,X),z(X,{code:D.too_small,type:"bigint",minimum:Q.value,inclusive:Q.inclusive,message:Q.message}),H.dirty()}else if(Q.kind==="max"){if(Q.inclusive?$.data>Q.value:$.data>=Q.value)X=this._getOrReturnCtx($,X),z(X,{code:D.too_big,type:"bigint",maximum:Q.value,inclusive:Q.inclusive,message:Q.message}),H.dirty()}else if(Q.kind==="multipleOf"){if($.data%Q.value!==BigInt(0))X=this._getOrReturnCtx($,X),z(X,{code:D.not_multiple_of,multipleOf:Q.value,message:Q.message}),H.dirty()}else U.assertNever(Q);return{status:H.value,value:$.data}}_getInvalidInput($){let W=this._getOrReturnCtx($);return z(W,{code:D.invalid_type,expected:j.bigint,received:W.parsedType}),b}gte($,W){return this.setLimit("min",$,!0,V.toString(W))}gt($,W){return this.setLimit("min",$,!1,V.toString(W))}lte($,W){return this.setLimit("max",$,!0,V.toString(W))}lt($,W){return this.setLimit("max",$,!1,V.toString(W))}setLimit($,W,X,H){return new e({...this._def,checks:[...this._def.checks,{kind:$,value:W,inclusive:X,message:V.toString(H)}]})}_addCheck($){return new e({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString($)})}multipleOf($,W){return this._addCheck({kind:"multipleOf",value:$,message:V.toString(W)})}get minValue(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxValue(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}}e.create=($)=>{return new e({checks:[],typeName:M.ZodBigInt,coerce:$?.coerce??!1,...O($)})};class j$ extends q{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==j.boolean){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.boolean,received:X.parsedType}),b}return v($.data)}}j$.create=($)=>{return new j$({typeName:M.ZodBoolean,coerce:$?.coerce||!1,...O($)})};class Q$ extends q{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==j.date){let Q=this._getOrReturnCtx($);return z(Q,{code:D.invalid_type,expected:j.date,received:Q.parsedType}),b}if(Number.isNaN($.data.getTime())){let Q=this._getOrReturnCtx($);return z(Q,{code:D.invalid_date}),b}let X=new E,H=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if($.data.getTime()<Q.value)H=this._getOrReturnCtx($,H),z(H,{code:D.too_small,message:Q.message,inclusive:!0,exact:!1,minimum:Q.value,type:"date"}),X.dirty()}else if(Q.kind==="max"){if($.data.getTime()>Q.value)H=this._getOrReturnCtx($,H),z(H,{code:D.too_big,message:Q.message,inclusive:!0,exact:!1,maximum:Q.value,type:"date"}),X.dirty()}else U.assertNever(Q);return{status:X.value,value:new Date($.data.getTime())}}_addCheck($){return new Q$({...this._def,checks:[...this._def.checks,$]})}min($,W){return this._addCheck({kind:"min",value:$.getTime(),message:V.toString(W)})}max($,W){return this._addCheck({kind:"max",value:$.getTime(),message:V.toString(W)})}get minDate(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $!=null?new Date($):null}}Q$.create=($)=>{return new Q$({checks:[],coerce:$?.coerce||!1,typeName:M.ZodDate,...O($)})};class R$ extends q{_parse($){if(this._getType($)!==j.symbol){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.symbol,received:X.parsedType}),b}return v($.data)}}R$.create=($)=>{return new R$({typeName:M.ZodSymbol,...O($)})};class z$ extends q{_parse($){if(this._getType($)!==j.undefined){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.undefined,received:X.parsedType}),b}return v($.data)}}z$.create=($)=>{return new z$({typeName:M.ZodUndefined,...O($)})};class A$ extends q{_parse($){if(this._getType($)!==j.null){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.null,received:X.parsedType}),b}return v($.data)}}A$.create=($)=>{return new A$({typeName:M.ZodNull,...O($)})};class J$ extends q{constructor(){super(...arguments);this._any=!0}_parse($){return v($.data)}}J$.create=($)=>{return new J$({typeName:M.ZodAny,...O($)})};class t extends q{constructor(){super(...arguments);this._unknown=!0}_parse($){return v($.data)}}t.create=($)=>{return new t({typeName:M.ZodUnknown,...O($)})};class i extends q{_parse($){let W=this._getOrReturnCtx($);return z(W,{code:D.invalid_type,expected:j.never,received:W.parsedType}),b}}i.create=($)=>{return new i({typeName:M.ZodNever,...O($)})};class f$ extends q{_parse($){if(this._getType($)!==j.undefined){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.void,received:X.parsedType}),b}return v($.data)}}f$.create=($)=>{return new f$({typeName:M.ZodVoid,...O($)})};class T extends q{_parse($){let{ctx:W,status:X}=this._processInputParams($),H=this._def;if(W.parsedType!==j.array)return z(W,{code:D.invalid_type,expected:j.array,received:W.parsedType}),b;if(H.exactLength!==null){let Y=W.data.length>H.exactLength.value,G=W.data.length<H.exactLength.value;if(Y||G)z(W,{code:Y?D.too_big:D.too_small,minimum:G?H.exactLength.value:void 0,maximum:Y?H.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:H.exactLength.message}),X.dirty()}if(H.minLength!==null){if(W.data.length<H.minLength.value)z(W,{code:D.too_small,minimum:H.minLength.value,type:"array",inclusive:!0,exact:!1,message:H.minLength.message}),X.dirty()}if(H.maxLength!==null){if(W.data.length>H.maxLength.value)z(W,{code:D.too_big,maximum:H.maxLength.value,type:"array",inclusive:!0,exact:!1,message:H.maxLength.message}),X.dirty()}if(W.common.async)return Promise.all([...W.data].map((Y,G)=>{return H.type._parseAsync(new y(W,Y,W.path,G))})).then((Y)=>{return E.mergeArray(X,Y)});let Q=[...W.data].map((Y,G)=>{return H.type._parseSync(new y(W,Y,W.path,G))});return E.mergeArray(X,Q)}get element(){return this._def.type}min($,W){return new T({...this._def,minLength:{value:$,message:V.toString(W)}})}max($,W){return new T({...this._def,maxLength:{value:$,message:V.toString(W)}})}length($,W){return new T({...this._def,exactLength:{value:$,message:V.toString(W)}})}nonempty($){return this.min(1,$)}}T.create=($,W)=>{return new T({type:$,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...O(W)})};function D$($){if($ instanceof K){let W={};for(let X in $.shape){let H=$.shape[X];W[X]=k.create(D$(H))}return new K({...$._def,shape:()=>W})}else if($ instanceof T)return new T({...$._def,type:D$($.element)});else if($ instanceof k)return k.create(D$($.unwrap()));else if($ instanceof r)return r.create(D$($.unwrap()));else if($ instanceof c)return c.create($.items.map((W)=>D$(W)));else return $}class K extends q{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),W=U.objectKeys($);return this._cached={shape:$,keys:W},this._cached}_parse($){if(this._getType($)!==j.object){let B=this._getOrReturnCtx($);return z(B,{code:D.invalid_type,expected:j.object,received:B.parsedType}),b}let{status:X,ctx:H}=this._processInputParams($),{shape:Q,keys:Y}=this._getCached(),G=[];if(!(this._def.catchall instanceof i&&this._def.unknownKeys==="strip")){for(let B in H.data)if(!Y.includes(B))G.push(B)}let w=[];for(let B of Y){let A=Q[B],_=H.data[B];w.push({key:{status:"valid",value:B},value:A._parse(new y(H,_,H.path,B)),alwaysSet:B in H.data})}if(this._def.catchall instanceof i){let B=this._def.unknownKeys;if(B==="passthrough")for(let A of G)w.push({key:{status:"valid",value:A},value:{status:"valid",value:H.data[A]}});else if(B==="strict"){if(G.length>0)z(H,{code:D.unrecognized_keys,keys:G}),X.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let A of G){let _=H.data[A];w.push({key:{status:"valid",value:A},value:B._parse(new y(H,_,H.path,A)),alwaysSet:A in H.data})}}if(H.common.async)return Promise.resolve().then(async()=>{let B=[];for(let A of w){let _=await A.key,P=await A.value;B.push({key:_,value:P,alwaysSet:A.alwaysSet})}return B}).then((B)=>{return E.mergeObjectSync(X,B)});else return E.mergeObjectSync(X,w)}get shape(){return this._def.shape()}strict($){return V.errToObj,new K({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(W,X)=>{let H=this._def.errorMap?.(W,X).message??X.defaultError;if(W.code==="unrecognized_keys")return{message:V.errToObj($).message??H};return{message:H}}}:{}})}strip(){return new K({...this._def,unknownKeys:"strip"})}passthrough(){return new K({...this._def,unknownKeys:"passthrough"})}extend($){return new K({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new K({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:M.ZodObject})}setKey($,W){return this.augment({[$]:W})}catchall($){return new K({...this._def,catchall:$})}pick($){let W={};for(let X of U.objectKeys($))if($[X]&&this.shape[X])W[X]=this.shape[X];return new K({...this._def,shape:()=>W})}omit($){let W={};for(let X of U.objectKeys(this.shape))if(!$[X])W[X]=this.shape[X];return new K({...this._def,shape:()=>W})}deepPartial(){return D$(this)}partial($){let W={};for(let X of U.objectKeys(this.shape)){let H=this.shape[X];if($&&!$[X])W[X]=H;else W[X]=H.optional()}return new K({...this._def,shape:()=>W})}required($){let W={};for(let X of U.objectKeys(this.shape))if($&&!$[X])W[X]=this.shape[X];else{let Q=this.shape[X];while(Q instanceof k)Q=Q._def.innerType;W[X]=Q}return new K({...this._def,shape:()=>W})}keyof(){return a2(U.objectKeys(this.shape))}}K.create=($,W)=>{return new K({shape:()=>$,unknownKeys:"strip",catchall:i.create(),typeName:M.ZodObject,...O(W)})};K.strictCreate=($,W)=>{return new K({shape:()=>$,unknownKeys:"strict",catchall:i.create(),typeName:M.ZodObject,...O(W)})};K.lazycreate=($,W)=>{return new K({shape:$,unknownKeys:"strip",catchall:i.create(),typeName:M.ZodObject,...O(W)})};class V$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X=this._def.options;function H(Q){for(let G of Q)if(G.result.status==="valid")return G.result;for(let G of Q)if(G.result.status==="dirty")return W.common.issues.push(...G.ctx.common.issues),G.result;let Y=Q.map((G)=>new f(G.ctx.common.issues));return z(W,{code:D.invalid_union,unionErrors:Y}),b}if(W.common.async)return Promise.all(X.map(async(Q)=>{let Y={...W,common:{...W.common,issues:[]},parent:null};return{result:await Q._parseAsync({data:W.data,path:W.path,parent:Y}),ctx:Y}})).then(H);else{let Q=void 0,Y=[];for(let w of X){let B={...W,common:{...W.common,issues:[]},parent:null},A=w._parseSync({data:W.data,path:W.path,parent:B});if(A.status==="valid")return A;else if(A.status==="dirty"&&!Q)Q={result:A,ctx:B};if(B.common.issues.length)Y.push(B.common.issues)}if(Q)return W.common.issues.push(...Q.ctx.common.issues),Q.result;let G=Y.map((w)=>new f(w));return z(W,{code:D.invalid_union,unionErrors:G}),b}}get options(){return this._def.options}}V$.create=($,W)=>{return new V$({options:$,typeName:M.ZodUnion,...O(W)})};var o=($)=>{if($ instanceof N$)return o($.schema);else if($ instanceof x)return o($.innerType());else if($ instanceof O$)return[$.value];else if($ instanceof $$)return $.options;else if($ instanceof _$)return U.objectValues($.enum);else if($ instanceof q$)return o($._def.innerType);else if($ instanceof z$)return[void 0];else if($ instanceof A$)return[null];else if($ instanceof k)return[void 0,...o($.unwrap())];else if($ instanceof r)return[null,...o($.unwrap())];else if($ instanceof m$)return o($.unwrap());else if($ instanceof L$)return o($.unwrap());else if($ instanceof U$)return o($._def.innerType);else return[]};class l$ extends q{_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==j.object)return z(W,{code:D.invalid_type,expected:j.object,received:W.parsedType}),b;let X=this.discriminator,H=W.data[X],Q=this.optionsMap.get(H);if(!Q)return z(W,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[X]}),b;if(W.common.async)return Q._parseAsync({data:W.data,path:W.path,parent:W});else return Q._parseSync({data:W.data,path:W.path,parent:W})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,W,X){let H=new Map;for(let Q of W){let Y=o(Q.shape[$]);if(!Y.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let G of Y){if(H.has(G))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(G)}`);H.set(G,Q)}}return new l$({typeName:M.ZodDiscriminatedUnion,discriminator:$,options:W,optionsMap:H,...O(X)})}}function U2($,W){let X=u($),H=u(W);if($===W)return{valid:!0,data:$};else if(X===j.object&&H===j.object){let Q=U.objectKeys(W),Y=U.objectKeys($).filter((w)=>Q.indexOf(w)!==-1),G={...$,...W};for(let w of Y){let B=U2($[w],W[w]);if(!B.valid)return{valid:!1};G[w]=B.data}return{valid:!0,data:G}}else if(X===j.array&&H===j.array){if($.length!==W.length)return{valid:!1};let Q=[];for(let Y=0;Y<$.length;Y++){let G=$[Y],w=W[Y],B=U2(G,w);if(!B.valid)return{valid:!1};Q.push(B.data)}return{valid:!0,data:Q}}else if(X===j.date&&H===j.date&&+$===+W)return{valid:!0,data:$};else return{valid:!1}}class b$ extends q{_parse($){let{status:W,ctx:X}=this._processInputParams($),H=(Q,Y)=>{if(x$(Q)||x$(Y))return b;let G=U2(Q.value,Y.value);if(!G.valid)return z(X,{code:D.invalid_intersection_types}),b;if(h$(Q)||h$(Y))W.dirty();return{status:W.value,value:G.data}};if(X.common.async)return Promise.all([this._def.left._parseAsync({data:X.data,path:X.path,parent:X}),this._def.right._parseAsync({data:X.data,path:X.path,parent:X})]).then(([Q,Y])=>H(Q,Y));else return H(this._def.left._parseSync({data:X.data,path:X.path,parent:X}),this._def.right._parseSync({data:X.data,path:X.path,parent:X}))}}b$.create=($,W,X)=>{return new b$({left:$,right:W,typeName:M.ZodIntersection,...O(X)})};class c extends q{_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.parsedType!==j.array)return z(X,{code:D.invalid_type,expected:j.array,received:X.parsedType}),b;if(X.data.length<this._def.items.length)return z(X,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;if(!this._def.rest&&X.data.length>this._def.items.length)z(X,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W.dirty();let Q=[...X.data].map((Y,G)=>{let w=this._def.items[G]||this._def.rest;if(!w)return null;return w._parse(new y(X,Y,X.path,G))}).filter((Y)=>!!Y);if(X.common.async)return Promise.all(Q).then((Y)=>{return E.mergeArray(W,Y)});else return E.mergeArray(W,Q)}get items(){return this._def.items}rest($){return new c({...this._def,rest:$})}}c.create=($,W)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new c({items:$,typeName:M.ZodTuple,rest:null,...O(W)})};class k$ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.parsedType!==j.object)return z(X,{code:D.invalid_type,expected:j.object,received:X.parsedType}),b;let H=[],Q=this._def.keyType,Y=this._def.valueType;for(let G in X.data)H.push({key:Q._parse(new y(X,G,X.path,G)),value:Y._parse(new y(X,X.data[G],X.path,G)),alwaysSet:G in X.data});if(X.common.async)return E.mergeObjectAsync(W,H);else return E.mergeObjectSync(W,H)}get element(){return this._def.valueType}static create($,W,X){if(W instanceof q)return new k$({keyType:$,valueType:W,typeName:M.ZodRecord,...O(X)});return new k$({keyType:g.create(),valueType:$,typeName:M.ZodRecord,...O(W)})}}class I$ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.parsedType!==j.map)return z(X,{code:D.invalid_type,expected:j.map,received:X.parsedType}),b;let H=this._def.keyType,Q=this._def.valueType,Y=[...X.data.entries()].map(([G,w],B)=>{return{key:H._parse(new y(X,G,X.path,[B,"key"])),value:Q._parse(new y(X,w,X.path,[B,"value"]))}});if(X.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let w of Y){let B=await w.key,A=await w.value;if(B.status==="aborted"||A.status==="aborted")return b;if(B.status==="dirty"||A.status==="dirty")W.dirty();G.set(B.value,A.value)}return{status:W.value,value:G}})}else{let G=new Map;for(let w of Y){let{key:B,value:A}=w;if(B.status==="aborted"||A.status==="aborted")return b;if(B.status==="dirty"||A.status==="dirty")W.dirty();G.set(B.value,A.value)}return{status:W.value,value:G}}}}I$.create=($,W,X)=>{return new I$({valueType:W,keyType:$,typeName:M.ZodMap,...O(X)})};class Y$ extends q{_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.parsedType!==j.set)return z(X,{code:D.invalid_type,expected:j.set,received:X.parsedType}),b;let H=this._def;if(H.minSize!==null){if(X.data.size<H.minSize.value)z(X,{code:D.too_small,minimum:H.minSize.value,type:"set",inclusive:!0,exact:!1,message:H.minSize.message}),W.dirty()}if(H.maxSize!==null){if(X.data.size>H.maxSize.value)z(X,{code:D.too_big,maximum:H.maxSize.value,type:"set",inclusive:!0,exact:!1,message:H.maxSize.message}),W.dirty()}let Q=this._def.valueType;function Y(w){let B=new Set;for(let A of w){if(A.status==="aborted")return b;if(A.status==="dirty")W.dirty();B.add(A.value)}return{status:W.value,value:B}}let G=[...X.data.values()].map((w,B)=>Q._parse(new y(X,w,X.path,B)));if(X.common.async)return Promise.all(G).then((w)=>Y(w));else return Y(G)}min($,W){return new Y$({...this._def,minSize:{value:$,message:V.toString(W)}})}max($,W){return new Y$({...this._def,maxSize:{value:$,message:V.toString(W)}})}size($,W){return this.min($,W).max($,W)}nonempty($){return this.min(1,$)}}Y$.create=($,W)=>{return new Y$({valueType:$,minSize:null,maxSize:null,typeName:M.ZodSet,...O(W)})};class M$ extends q{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==j.function)return z(W,{code:D.invalid_type,expected:j.function,received:W.parsedType}),b;function X(G,w){return S$({data:G,path:W.path,errorMaps:[W.common.contextualErrorMap,W.schemaErrorMap,w$(),d].filter((B)=>!!B),issueData:{code:D.invalid_arguments,argumentsError:w}})}function H(G,w){return S$({data:G,path:W.path,errorMaps:[W.common.contextualErrorMap,W.schemaErrorMap,w$(),d].filter((B)=>!!B),issueData:{code:D.invalid_return_type,returnTypeError:w}})}let Q={errorMap:W.common.contextualErrorMap},Y=W.data;if(this._def.returns instanceof G$){let G=this;return v(async function(...w){let B=new f([]),A=await G._def.args.parseAsync(w,Q).catch((W$)=>{throw B.addIssue(X(w,W$)),B}),_=await Reflect.apply(Y,this,A);return await G._def.returns._def.type.parseAsync(_,Q).catch((W$)=>{throw B.addIssue(H(_,W$)),B})})}else{let G=this;return v(function(...w){let B=G._def.args.safeParse(w,Q);if(!B.success)throw new f([X(w,B.error)]);let A=Reflect.apply(Y,this,B.data),_=G._def.returns.safeParse(A,Q);if(!_.success)throw new f([H(A,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new M$({...this._def,args:c.create($).rest(t.create())})}returns($){return new M$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,W,X){return new M$({args:$?$:c.create([]).rest(t.create()),returns:W||t.create(),typeName:M.ZodFunction,...O(X)})}}class N$ extends q{get schema(){return this._def.getter()}_parse($){let{ctx:W}=this._processInputParams($);return this._def.getter()._parse({data:W.data,path:W.path,parent:W})}}N$.create=($,W)=>{return new N$({getter:$,typeName:M.ZodLazy,...O(W)})};class O$ extends q{_parse($){if($.data!==this._def.value){let W=this._getOrReturnCtx($);return z(W,{received:W.data,code:D.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:$.data}}get value(){return this._def.value}}O$.create=($,W)=>{return new O$({value:$,typeName:M.ZodLiteral,...O(W)})};function a2($,W){return new $$({values:$,typeName:M.ZodEnum,...O(W)})}class $$ extends q{constructor(){super(...arguments);E$.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let W=this._getOrReturnCtx($),X=this._def.values;return z(W,{expected:U.joinValues(X),received:W.parsedType,code:D.invalid_type}),b}if(!Z$(this,E$,"f"))p2(this,E$,new Set(this._def.values),"f");if(!Z$(this,E$,"f").has($.data)){let W=this._getOrReturnCtx($),X=this._def.values;return z(W,{received:W.data,code:D.invalid_enum_value,options:X}),b}return v($.data)}get options(){return this._def.values}get enum(){let $={};for(let W of this._def.values)$[W]=W;return $}get Values(){let $={};for(let W of this._def.values)$[W]=W;return $}get Enum(){let $={};for(let W of this._def.values)$[W]=W;return $}extract($,W=this._def){return $$.create($,{...this._def,...W})}exclude($,W=this._def){return $$.create(this.options.filter((X)=>!$.includes(X)),{...this._def,...W})}}E$=new WeakMap;$$.create=a2;class _$ extends q{constructor(){super(...arguments);v$.set(this,void 0)}_parse($){let W=U.getValidEnumValues(this._def.values),X=this._getOrReturnCtx($);if(X.parsedType!==j.string&&X.parsedType!==j.number){let H=U.objectValues(W);return z(X,{expected:U.joinValues(H),received:X.parsedType,code:D.invalid_type}),b}if(!Z$(this,v$,"f"))p2(this,v$,new Set(U.getValidEnumValues(this._def.values)),"f");if(!Z$(this,v$,"f").has($.data)){let H=U.objectValues(W);return z(X,{received:X.data,code:D.invalid_enum_value,options:H}),b}return v($.data)}get enum(){return this._def.values}}v$=new WeakMap;_$.create=($,W)=>{return new _$({values:$,typeName:M.ZodNativeEnum,...O(W)})};class G$ extends q{unwrap(){return this._def.type}_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==j.promise&&W.common.async===!1)return z(W,{code:D.invalid_type,expected:j.promise,received:W.parsedType}),b;let X=W.parsedType===j.promise?W.data:Promise.resolve(W.data);return v(X.then((H)=>{return this._def.type.parseAsync(H,{path:W.path,errorMap:W.common.contextualErrorMap})}))}}G$.create=($,W)=>{return new G$({type:$,typeName:M.ZodPromise,...O(W)})};class x extends q{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:W,ctx:X}=this._processInputParams($),H=this._def.effect||null,Q={addIssue:(Y)=>{if(z(X,Y),Y.fatal)W.abort();else W.dirty()},get path(){return X.path}};if(Q.addIssue=Q.addIssue.bind(Q),H.type==="preprocess"){let Y=H.transform(X.data,Q);if(X.common.async)return Promise.resolve(Y).then(async(G)=>{if(W.value==="aborted")return b;let w=await this._def.schema._parseAsync({data:G,path:X.path,parent:X});if(w.status==="aborted")return b;if(w.status==="dirty")return H$(w.value);if(W.value==="dirty")return H$(w.value);return w});else{if(W.value==="aborted")return b;let G=this._def.schema._parseSync({data:Y,path:X.path,parent:X});if(G.status==="aborted")return b;if(G.status==="dirty")return H$(G.value);if(W.value==="dirty")return H$(G.value);return G}}if(H.type==="refinement"){let Y=(G)=>{let w=H.refinement(G,Q);if(X.common.async)return Promise.resolve(w);if(w instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(X.common.async===!1){let G=this._def.schema._parseSync({data:X.data,path:X.path,parent:X});if(G.status==="aborted")return b;if(G.status==="dirty")W.dirty();return Y(G.value),{status:W.value,value:G.value}}else return this._def.schema._parseAsync({data:X.data,path:X.path,parent:X}).then((G)=>{if(G.status==="aborted")return b;if(G.status==="dirty")W.dirty();return Y(G.value).then(()=>{return{status:W.value,value:G.value}})})}if(H.type==="transform")if(X.common.async===!1){let Y=this._def.schema._parseSync({data:X.data,path:X.path,parent:X});if(!a(Y))return Y;let G=H.transform(Y.value,Q);if(G instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:W.value,value:G}}else return this._def.schema._parseAsync({data:X.data,path:X.path,parent:X}).then((Y)=>{if(!a(Y))return Y;return Promise.resolve(H.transform(Y.value,Q)).then((G)=>({status:W.value,value:G}))});U.assertNever(H)}}x.create=($,W,X)=>{return new x({schema:$,typeName:M.ZodEffects,effect:W,...O(X)})};x.createWithPreprocess=($,W,X)=>{return new x({schema:W,effect:{type:"preprocess",transform:$},typeName:M.ZodEffects,...O(X)})};class k extends q{_parse($){if(this._getType($)===j.undefined)return v(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}k.create=($,W)=>{return new k({innerType:$,typeName:M.ZodOptional,...O(W)})};class r extends q{_parse($){if(this._getType($)===j.null)return v(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}r.create=($,W)=>{return new r({innerType:$,typeName:M.ZodNullable,...O(W)})};class q$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X=W.data;if(W.parsedType===j.undefined)X=this._def.defaultValue();return this._def.innerType._parse({data:X,path:W.path,parent:W})}removeDefault(){return this._def.innerType}}q$.create=($,W)=>{return new q$({innerType:$,typeName:M.ZodDefault,defaultValue:typeof W.default==="function"?W.default:()=>W.default,...O(W)})};class U$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X={...W,common:{...W.common,issues:[]}},H=this._def.innerType._parse({data:X.data,path:X.path,parent:{...X}});if(B$(H))return H.then((Q)=>{return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new f(X.common.issues)},input:X.data})}});else return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new f(X.common.issues)},input:X.data})}}removeCatch(){return this._def.innerType}}U$.create=($,W)=>{return new U$({innerType:$,typeName:M.ZodCatch,catchValue:typeof W.catch==="function"?W.catch:()=>W.catch,...O(W)})};class P$ extends q{_parse($){if(this._getType($)!==j.nan){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.nan,received:X.parsedType}),b}return{status:"valid",value:$.data}}}P$.create=($)=>{return new P$({typeName:M.ZodNaN,...O($)})};var n1=Symbol("zod_brand");class m$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X=W.data;return this._def.type._parse({data:X,path:W.path,parent:W})}unwrap(){return this._def.type}}class C$ extends q{_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.common.async)return(async()=>{let Q=await this._def.in._parseAsync({data:X.data,path:X.path,parent:X});if(Q.status==="aborted")return b;if(Q.status==="dirty")return W.dirty(),H$(Q.value);else return this._def.out._parseAsync({data:Q.value,path:X.path,parent:X})})();else{let H=this._def.in._parseSync({data:X.data,path:X.path,parent:X});if(H.status==="aborted")return b;if(H.status==="dirty")return W.dirty(),{status:"dirty",value:H.value};else return this._def.out._parseSync({data:H.value,path:X.path,parent:X})}}static create($,W){return new C$({in:$,out:W,typeName:M.ZodPipeline})}}class L$ extends q{_parse($){let W=this._def.innerType._parse($),X=(H)=>{if(a(H))H.value=Object.freeze(H.value);return H};return B$(W)?W.then((H)=>X(H)):X(W)}unwrap(){return this._def.innerType}}L$.create=($,W)=>{return new L$({innerType:$,typeName:M.ZodReadonly,...O(W)})};function c2($,W){let X=typeof $==="function"?$(W):typeof $==="string"?{message:$}:$;return typeof X==="string"?{message:X}:X}function t2($,W={},X){if($)return J$.create().superRefine((H,Q)=>{let Y=$(H);if(Y instanceof Promise)return Y.then((G)=>{if(!G){let w=c2(W,H),B=w.fatal??X??!0;Q.addIssue({code:"custom",...w,fatal:B})}});if(!Y){let G=c2(W,H),w=G.fatal??X??!0;Q.addIssue({code:"custom",...G,fatal:w})}return});return J$.create()}var u1={object:K.lazycreate},M;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(M||(M={}));var i1=($,W={message:`Input not instance of ${$.name}`})=>t2((X)=>X instanceof $,W),s2=g.create,e2=s.create,c1=P$.create,p1=e.create,$0=j$.create,d1=Q$.create,o1=R$.create,r1=z$.create,a1=A$.create,t1=J$.create,s1=t.create,e1=i.create,$W=f$.create,WW=T.create,XW=K.create,HW=K.strictCreate,QW=V$.create,JW=l$.create,YW=b$.create,GW=c.create,wW=k$.create,BW=I$.create,DW=Y$.create,MW=M$.create,jW=N$.create,zW=O$.create,AW=$$.create,VW=_$.create,bW=G$.create,NW=x.create,OW=k.create,_W=r.create,qW=x.createWithPreprocess,UW=C$.create,LW=()=>s2().optional(),KW=()=>e2().optional(),FW=()=>$0().optional(),SW={string:($)=>g.create({...$,coerce:!0}),number:($)=>s.create({...$,coerce:!0}),boolean:($)=>j$.create({...$,coerce:!0}),bigint:($)=>e.create({...$,coerce:!0}),date:($)=>Q$.create({...$,coerce:!0})};var EW=b;var L2="2025-03-26",W0=[L2,"2024-11-05","2024-10-07"],n$="2.0",X0=J.union([J.string(),J.number().int()]),H0=J.string(),vW=J.object({progressToken:J.optional(X0)}).passthrough(),h=J.object({_meta:J.optional(vW)}).passthrough(),I=J.object({method:J.string(),params:J.optional(h)}),g$=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),p=J.object({method:J.string(),params:J.optional(g$)}),Z=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),u$=J.union([J.string(),J.number().int()]),Q0=J.object({jsonrpc:J.literal(n$),id:u$}).merge(I).strict(),J0=($)=>Q0.safeParse($).success,Y0=J.object({jsonrpc:J.literal(n$)}).merge(p).strict(),G0=($)=>Y0.safeParse($).success,w0=J.object({jsonrpc:J.literal(n$),id:u$,result:Z}).strict(),K2=($)=>w0.safeParse($).success,F;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(F||(F={}));var B0=J.object({jsonrpc:J.literal(n$),id:u$,error:J.object({code:J.number().int(),message:J.string(),data:J.optional(J.unknown())})}).strict(),D0=($)=>B0.safeParse($).success,M0=J.union([Q0,Y0,w0,B0]),i$=Z.strict(),c$=p.extend({method:J.literal("notifications/cancelled"),params:g$.extend({requestId:u$,reason:J.string().optional()})}),j0=J.object({name:J.string(),version:J.string()}).passthrough(),RW=J.object({experimental:J.optional(J.object({}).passthrough()),sampling:J.optional(J.object({}).passthrough()),roots:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),p$=I.extend({method:J.literal("initialize"),params:h.extend({protocolVersion:J.string(),capabilities:RW,clientInfo:j0})}),e4=($)=>p$.safeParse($).success,fW=J.object({experimental:J.optional(J.object({}).passthrough()),logging:J.optional(J.object({}).passthrough()),completions:J.optional(J.object({}).passthrough()),prompts:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough()),resources:J.optional(J.object({subscribe:J.optional(J.boolean()),listChanged:J.optional(J.boolean())}).passthrough()),tools:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),kW=Z.extend({protocolVersion:J.string(),capabilities:fW,serverInfo:j0,instructions:J.optional(J.string())}),F2=p.extend({method:J.literal("notifications/initialized")});var d$=I.extend({method:J.literal("ping")}),IW=J.object({progress:J.number(),total:J.optional(J.number()),message:J.optional(J.string())}).passthrough(),o$=p.extend({method:J.literal("notifications/progress"),params:g$.merge(IW).extend({progressToken:X0})}),r$=I.extend({params:h.extend({cursor:J.optional(H0)}).optional()}),a$=Z.extend({nextCursor:J.optional(H0)}),z0=J.object({uri:J.string(),mimeType:J.optional(J.string())}).passthrough(),A0=z0.extend({text:J.string()}),V0=z0.extend({blob:J.string().base64()}),PW=J.object({uri:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),CW=J.object({uriTemplate:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),t$=r$.extend({method:J.literal("resources/list")}),gW=a$.extend({resources:J.array(PW)}),s$=r$.extend({method:J.literal("resources/templates/list")}),TW=a$.extend({resourceTemplates:J.array(CW)}),e$=I.extend({method:J.literal("resources/read"),params:h.extend({uri:J.string()})}),yW=Z.extend({contents:J.array(J.union([A0,V0]))}),xW=p.extend({method:J.literal("notifications/resources/list_changed")}),hW=I.extend({method:J.literal("resources/subscribe"),params:h.extend({uri:J.string()})}),ZW=I.extend({method:J.literal("resources/unsubscribe"),params:h.extend({uri:J.string()})}),lW=p.extend({method:J.literal("notifications/resources/updated"),params:g$.extend({uri:J.string()})}),mW=J.object({name:J.string(),description:J.optional(J.string()),required:J.optional(J.boolean())}).passthrough(),nW=J.object({name:J.string(),description:J.optional(J.string()),arguments:J.optional(J.array(mW))}).passthrough(),$2=r$.extend({method:J.literal("prompts/list")}),uW=a$.extend({prompts:J.array(nW)}),W2=I.extend({method:J.literal("prompts/get"),params:h.extend({name:J.string(),arguments:J.optional(J.record(J.string()))})}),X2=J.object({type:J.literal("text"),text:J.string()}).passthrough(),H2=J.object({type:J.literal("image"),data:J.string().base64(),mimeType:J.string()}).passthrough(),Q2=J.object({type:J.literal("audio"),data:J.string().base64(),mimeType:J.string()}).passthrough(),b0=J.object({type:J.literal("resource"),resource:J.union([A0,V0])}).passthrough(),iW=J.object({role:J.enum(["user","assistant"]),content:J.union([X2,H2,Q2,b0])}).passthrough(),cW=Z.extend({description:J.optional(J.string()),messages:J.array(iW)}),pW=p.extend({method:J.literal("notifications/prompts/list_changed")}),dW=J.object({title:J.optional(J.string()),readOnlyHint:J.optional(J.boolean()),destructiveHint:J.optional(J.boolean()),idempotentHint:J.optional(J.boolean()),openWorldHint:J.optional(J.boolean())}).passthrough(),oW=J.object({name:J.string(),description:J.optional(J.string()),inputSchema:J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough(),outputSchema:J.optional(J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough()),annotations:J.optional(dW)}).passthrough(),J2=r$.extend({method:J.literal("tools/list")}),rW=a$.extend({tools:J.array(oW)}),N0=Z.extend({content:J.array(J.union([X2,H2,Q2,b0])).default([]),structuredContent:J.object({}).passthrough().optional(),isError:J.optional(J.boolean())}),$6=N0.or(Z.extend({toolResult:J.unknown()})),Y2=I.extend({method:J.literal("tools/call"),params:h.extend({name:J.string(),arguments:J.optional(J.record(J.unknown()))})}),aW=p.extend({method:J.literal("notifications/tools/list_changed")}),O0=J.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),tW=I.extend({method:J.literal("logging/setLevel"),params:h.extend({level:O0})}),sW=p.extend({method:J.literal("notifications/message"),params:g$.extend({level:O0,logger:J.optional(J.string()),data:J.unknown()})}),eW=J.object({name:J.string().optional()}).passthrough(),$4=J.object({hints:J.optional(J.array(eW)),costPriority:J.optional(J.number().min(0).max(1)),speedPriority:J.optional(J.number().min(0).max(1)),intelligencePriority:J.optional(J.number().min(0).max(1))}).passthrough(),W4=J.object({role:J.enum(["user","assistant"]),content:J.union([X2,H2,Q2])}).passthrough(),X4=I.extend({method:J.literal("sampling/createMessage"),params:h.extend({messages:J.array(W4),systemPrompt:J.optional(J.string()),includeContext:J.optional(J.enum(["none","thisServer","allServers"])),temperature:J.optional(J.number()),maxTokens:J.number().int(),stopSequences:J.optional(J.array(J.string())),metadata:J.optional(J.object({}).passthrough()),modelPreferences:J.optional($4)})}),S2=Z.extend({model:J.string(),stopReason:J.optional(J.enum(["endTurn","stopSequence","maxTokens"]).or(J.string())),role:J.enum(["user","assistant"]),content:J.discriminatedUnion("type",[X2,H2,Q2])}),H4=J.object({type:J.literal("ref/resource"),uri:J.string()}).passthrough(),Q4=J.object({type:J.literal("ref/prompt"),name:J.string()}).passthrough(),G2=I.extend({method:J.literal("completion/complete"),params:h.extend({ref:J.union([Q4,H4]),argument:J.object({name:J.string(),value:J.string()}).passthrough()})}),J4=Z.extend({completion:J.object({values:J.array(J.string()).max(100),total:J.optional(J.number().int()),hasMore:J.optional(J.boolean())}).passthrough()}),Y4=J.object({uri:J.string().startsWith("file://"),name:J.optional(J.string())}).passthrough(),G4=I.extend({method:J.literal("roots/list")}),E2=Z.extend({roots:J.array(Y4)}),w4=p.extend({method:J.literal("notifications/roots/list_changed")}),W6=J.union([d$,p$,G2,tW,W2,$2,t$,s$,e$,hW,ZW,Y2,J2]),X6=J.union([c$,o$,F2,w4]),H6=J.union([i$,S2,E2]),Q6=J.union([d$,X4,G4]),J6=J.union([c$,o$,sW,lW,xW,aW,pW]),Y6=J.union([i$,kW,J4,cW,uW,gW,TW,yW,N0,rW]);class S extends Error{constructor($,W,X){super(`MCP error ${$}: ${W}`);this.code=$,this.data=X,this.name="McpError"}}var B4=60000;class v2{constructor($){this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(c$,(W)=>{let X=this._requestHandlerAbortControllers.get(W.params.requestId);X===null||X===void 0||X.abort(W.params.reason)}),this.setNotificationHandler(o$,(W)=>{this._onprogress(W)}),this.setRequestHandler(d$,(W)=>({}))}_setupTimeout($,W,X,H,Q=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(H,W),startTime:Date.now(),timeout:W,maxTotalTimeout:X,resetTimeoutOnProgress:Q,onTimeout:H})}_resetTimeout($){let W=this._timeoutInfo.get($);if(!W)return!1;let X=Date.now()-W.startTime;if(W.maxTotalTimeout&&X>=W.maxTotalTimeout)throw this._timeoutInfo.delete($),new S(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:W.maxTotalTimeout,totalElapsed:X});return clearTimeout(W.timeoutId),W.timeoutId=setTimeout(W.onTimeout,W.timeout),!0}_cleanupTimeout($){let W=this._timeoutInfo.get($);if(W)clearTimeout(W.timeoutId),this._timeoutInfo.delete($)}async connect($){this._transport=$,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=(W)=>{this._onerror(W)},this._transport.onmessage=(W,X)=>{if(K2(W)||D0(W))this._onresponse(W);else if(J0(W))this._onrequest(W,X);else if(G0(W))this._onnotification(W);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(W)}`))},await this._transport.start()}_onclose(){var $;let W=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,($=this.onclose)===null||$===void 0||$.call(this);let X=new S(F.ConnectionClosed,"Connection closed");for(let H of W.values())H(X)}_onerror($){var W;(W=this.onerror)===null||W===void 0||W.call(this,$)}_onnotification($){var W;let X=(W=this._notificationHandlers.get($.method))!==null&&W!==void 0?W:this.fallbackNotificationHandler;if(X===void 0)return;Promise.resolve().then(()=>X($)).catch((H)=>this._onerror(new Error(`Uncaught error in notification handler: ${H}`)))}_onrequest($,W){var X,H,Q,Y;let G=(X=this._requestHandlers.get($.method))!==null&&X!==void 0?X:this.fallbackRequestHandler;if(G===void 0){(H=this._transport)===null||H===void 0||H.send({jsonrpc:"2.0",id:$.id,error:{code:F.MethodNotFound,message:"Method not found"}}).catch((A)=>this._onerror(new Error(`Failed to send an error response: ${A}`)));return}let w=new AbortController;this._requestHandlerAbortControllers.set($.id,w);let B={signal:w.signal,sessionId:(Q=this._transport)===null||Q===void 0?void 0:Q.sessionId,_meta:(Y=$.params)===null||Y===void 0?void 0:Y._meta,sendNotification:(A)=>this.notification(A,{relatedRequestId:$.id}),sendRequest:(A,_,P)=>this.request(A,_,{...P,relatedRequestId:$.id}),authInfo:W===null||W===void 0?void 0:W.authInfo,requestId:$.id};Promise.resolve().then(()=>G($,B)).then((A)=>{var _;if(w.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({result:A,jsonrpc:"2.0",id:$.id})},(A)=>{var _,P;if(w.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(A.code)?A.code:F.InternalError,message:(P=A.message)!==null&&P!==void 0?P:"Internal error"}})}).catch((A)=>this._onerror(new Error(`Failed to send response: ${A}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:W,...X}=$.params,H=Number(W),Q=this._progressHandlers.get(H);if(!Q){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let Y=this._responseHandlers.get(H),G=this._timeoutInfo.get(H);if(G&&Y&&G.resetTimeoutOnProgress)try{this._resetTimeout(H)}catch(w){Y(w);return}Q(X)}_onresponse($){let W=Number($.id),X=this._responseHandlers.get(W);if(X===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}if(this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),K2($))X($);else{let H=new S($.error.code,$.error.message,$.error.data);X(H)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,W,X){let{relatedRequestId:H,resumptionToken:Q,onresumptiontoken:Y}=X!==null&&X!==void 0?X:{};return new Promise((G,w)=>{var B,A,_,P,W$,b2;if(!this._transport){w(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(A=X===null||X===void 0?void 0:X.signal)===null||A===void 0||A.throwIfAborted();let n=this._requestMessageId++,l2={...$,jsonrpc:"2.0",id:n};if(X===null||X===void 0?void 0:X.onprogress)this._progressHandlers.set(n,X.onprogress),l2.params={...$.params,_meta:{...((_=$.params)===null||_===void 0?void 0:_._meta)||{},progressToken:n}};let m2=(C)=>{var X$;this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),(X$=this._transport)===null||X$===void 0||X$.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:n,reason:String(C)}},{relatedRequestId:H,resumptionToken:Q,onresumptiontoken:Y}).catch((F$)=>this._onerror(new Error(`Failed to send cancellation: ${F$}`))),w(C)};this._responseHandlers.set(n,(C)=>{var X$;if((X$=X===null||X===void 0?void 0:X.signal)===null||X$===void 0?void 0:X$.aborted)return;if(C instanceof Error)return w(C);try{let F$=W.parse(C.result);G(F$)}catch(F$){w(F$)}}),(P=X===null||X===void 0?void 0:X.signal)===null||P===void 0||P.addEventListener("abort",()=>{var C;m2((C=X===null||X===void 0?void 0:X.signal)===null||C===void 0?void 0:C.reason)});let n2=(W$=X===null||X===void 0?void 0:X.timeout)!==null&&W$!==void 0?W$:B4,M1=()=>m2(new S(F.RequestTimeout,"Request timed out",{timeout:n2}));this._setupTimeout(n,n2,X===null||X===void 0?void 0:X.maxTotalTimeout,M1,(b2=X===null||X===void 0?void 0:X.resetTimeoutOnProgress)!==null&&b2!==void 0?b2:!1),this._transport.send(l2,{relatedRequestId:H,resumptionToken:Q,onresumptiontoken:Y}).catch((C)=>{this._cleanupTimeout(n),w(C)})})}async notification($,W){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability($.method);let X={...$,jsonrpc:"2.0"};await this._transport.send(X,W)}setRequestHandler($,W){let X=$.shape.method.value;this.assertRequestHandlerCapability(X),this._requestHandlers.set(X,(H,Q)=>{return Promise.resolve(W($.parse(H),Q))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw new Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,W){this._notificationHandlers.set($.shape.method.value,(X)=>Promise.resolve(W($.parse(X))))}removeNotificationHandler($){this._notificationHandlers.delete($)}}function _0($,W){return Object.entries(W).reduce((X,[H,Q])=>{if(Q&&typeof Q==="object")X[H]=X[H]?{...X[H],...Q}:Q;else X[H]=Q;return X},{...$})}class R2 extends v2{constructor($,W){var X;super(W);this._serverInfo=$,this._capabilities=(X=W===null||W===void 0?void 0:W.capabilities)!==null&&X!==void 0?X:{},this._instructions=W===null||W===void 0?void 0:W.instructions,this.setRequestHandler(p$,(H)=>this._oninitialize(H)),this.setNotificationHandler(F2,()=>{var H;return(H=this.oninitialized)===null||H===void 0?void 0:H.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_0(this._capabilities,$)}assertCapabilityForMethod($){var W,X;switch($){case"sampling/createMessage":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.sampling))throw new Error(`Client does not support sampling (required for ${$})`);break;case"roots/list":if(!((X=this._clientCapabilities)===null||X===void 0?void 0:X.roots))throw new Error(`Client does not support listing roots (required for ${$})`);break;case"ping":break}}assertNotificationCapability($){switch($){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${$})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${$})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${$})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability($){switch($){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${$})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${$})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${$})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${$})`);break;case"ping":case"initialize":break}}async _oninitialize($){let W=$.params.protocolVersion;return this._clientCapabilities=$.params.capabilities,this._clientVersion=$.params.clientInfo,{protocolVersion:W0.includes(W)?W:L2,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},i$)}async createMessage($,W){return this.request({method:"sampling/createMessage",params:$},S2,W)}async listRoots($,W){return this.request({method:"roots/list",params:$},E2,W)}async sendLoggingMessage($){return this.notification({method:"notifications/message",params:$})}async sendResourceUpdated($){return this.notification({method:"notifications/resources/updated",params:$})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var U0=Symbol("Let zodToJsonSchema decide on which parser to use");var q0={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},L0=($)=>typeof $==="string"?{...q0,name:$}:{...q0,...$};var K0=($)=>{let W=L0($),X=W.name!==void 0?[...W.basePath,W.definitionPath,W.name]:W.basePath;return{...W,currentPath:X,propertyPath:void 0,seen:new Map(Object.entries(W.definitions).map(([H,Q])=>[Q._def,{def:Q._def,path:[...W.basePath,W.definitionPath,H],jsonSchema:void 0}]))}};function f2($,W,X,H){if(!H?.errorMessages)return;if(X)$.errorMessage={...$.errorMessage,[W]:X}}function L($,W,X,H,Q){$[W]=X,f2($,W,H,Q)}function F0(){return{}}function S0($,W){let X={type:"array"};if($.type?._def&&$.type?._def?.typeName!==M.ZodAny)X.items=N($.type._def,{...W,currentPath:[...W.currentPath,"items"]});if($.minLength)L(X,"minItems",$.minLength.value,$.minLength.message,W);if($.maxLength)L(X,"maxItems",$.maxLength.value,$.maxLength.message,W);if($.exactLength)L(X,"minItems",$.exactLength.value,$.exactLength.message,W),L(X,"maxItems",$.exactLength.value,$.exactLength.message,W);return X}function E0($,W){let X={type:"integer",format:"int64"};if(!$.checks)return X;for(let H of $.checks)switch(H.kind){case"min":if(W.target==="jsonSchema7")if(H.inclusive)L(X,"minimum",H.value,H.message,W);else L(X,"exclusiveMinimum",H.value,H.message,W);else{if(!H.inclusive)X.exclusiveMinimum=!0;L(X,"minimum",H.value,H.message,W)}break;case"max":if(W.target==="jsonSchema7")if(H.inclusive)L(X,"maximum",H.value,H.message,W);else L(X,"exclusiveMaximum",H.value,H.message,W);else{if(!H.inclusive)X.exclusiveMaximum=!0;L(X,"maximum",H.value,H.message,W)}break;case"multipleOf":L(X,"multipleOf",H.value,H.message,W);break}return X}function v0(){return{type:"boolean"}}function w2($,W){return N($.type._def,W)}var R0=($,W)=>{return N($.innerType._def,W)};function k2($,W,X){let H=X??W.dateStrategy;if(Array.isArray(H))return{anyOf:H.map((Q,Y)=>k2($,W,Q))};switch(H){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return D4($,W)}}var D4=($,W)=>{let X={type:"integer",format:"unix-time"};if(W.target==="openApi3")return X;for(let H of $.checks)switch(H.kind){case"min":L(X,"minimum",H.value,H.message,W);break;case"max":L(X,"maximum",H.value,H.message,W);break}return X};function f0($,W){return{...N($.innerType._def,W),default:$.defaultValue()}}function k0($,W){return W.effectStrategy==="input"?N($.schema._def,W):{}}function I0($){return{type:"string",enum:Array.from($.values)}}var M4=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function P0($,W){let X=[N($.left._def,{...W,currentPath:[...W.currentPath,"allOf","0"]}),N($.right._def,{...W,currentPath:[...W.currentPath,"allOf","1"]})].filter((Y)=>!!Y),H=W.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,Q=[];return X.forEach((Y)=>{if(M4(Y)){if(Q.push(...Y.allOf),Y.unevaluatedProperties===void 0)H=void 0}else{let G=Y;if("additionalProperties"in Y&&Y.additionalProperties===!1){let{additionalProperties:w,...B}=Y;G=B}else H=void 0;Q.push(G)}}),Q.length?{allOf:Q,...H}:void 0}function C0($,W){let X=typeof $.value;if(X!=="bigint"&&X!=="number"&&X!=="boolean"&&X!=="string")return{type:Array.isArray($.value)?"array":"object"};if(W.target==="openApi3")return{type:X==="bigint"?"integer":X,enum:[$.value]};return{type:X==="bigint"?"integer":X,const:$.value}}var I2=void 0,l={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(I2===void 0)I2=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return I2},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function B2($,W){let X={type:"string"};if($.checks)for(let H of $.checks)switch(H.kind){case"min":L(X,"minLength",typeof X.minLength==="number"?Math.max(X.minLength,H.value):H.value,H.message,W);break;case"max":L(X,"maxLength",typeof X.maxLength==="number"?Math.min(X.maxLength,H.value):H.value,H.message,W);break;case"email":switch(W.emailStrategy){case"format:email":m(X,"email",H.message,W);break;case"format:idn-email":m(X,"idn-email",H.message,W);break;case"pattern:zod":R(X,l.email,H.message,W);break}break;case"url":m(X,"uri",H.message,W);break;case"uuid":m(X,"uuid",H.message,W);break;case"regex":R(X,H.regex,H.message,W);break;case"cuid":R(X,l.cuid,H.message,W);break;case"cuid2":R(X,l.cuid2,H.message,W);break;case"startsWith":R(X,RegExp(`^${P2(H.value,W)}`),H.message,W);break;case"endsWith":R(X,RegExp(`${P2(H.value,W)}$`),H.message,W);break;case"datetime":m(X,"date-time",H.message,W);break;case"date":m(X,"date",H.message,W);break;case"time":m(X,"time",H.message,W);break;case"duration":m(X,"duration",H.message,W);break;case"length":L(X,"minLength",typeof X.minLength==="number"?Math.max(X.minLength,H.value):H.value,H.message,W),L(X,"maxLength",typeof X.maxLength==="number"?Math.min(X.maxLength,H.value):H.value,H.message,W);break;case"includes":{R(X,RegExp(P2(H.value,W)),H.message,W);break}case"ip":{if(H.version!=="v6")m(X,"ipv4",H.message,W);if(H.version!=="v4")m(X,"ipv6",H.message,W);break}case"base64url":R(X,l.base64url,H.message,W);break;case"jwt":R(X,l.jwt,H.message,W);break;case"cidr":{if(H.version!=="v6")R(X,l.ipv4Cidr,H.message,W);if(H.version!=="v4")R(X,l.ipv6Cidr,H.message,W);break}case"emoji":R(X,l.emoji(),H.message,W);break;case"ulid":{R(X,l.ulid,H.message,W);break}case"base64":{switch(W.base64Strategy){case"format:binary":{m(X,"binary",H.message,W);break}case"contentEncoding:base64":{L(X,"contentEncoding","base64",H.message,W);break}case"pattern:zod":{R(X,l.base64,H.message,W);break}}break}case"nanoid":R(X,l.nanoid,H.message,W);case"toLowerCase":case"toUpperCase":case"trim":break;default:((Q)=>{})(H)}return X}function P2($,W){return W.patternStrategy==="escape"?z4($):$}var j4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function z4($){let W="";for(let X=0;X<$.length;X++){if(!j4.has($[X]))W+="\\";W+=$[X]}return W}function m($,W,X,H){if($.format||$.anyOf?.some((Q)=>Q.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&H.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:W,...X&&H.errorMessages&&{errorMessage:{format:X}}})}else L($,"format",W,X,H)}function R($,W,X,H){if($.pattern||$.allOf?.some((Q)=>Q.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&H.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:g0(W,H),...X&&H.errorMessages&&{errorMessage:{pattern:X}}})}else L($,"pattern",g0(W,H),X,H)}function g0($,W){if(!W.applyRegexFlags||!$.flags)return $.source;let X={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},H=X.i?$.source.toLowerCase():$.source,Q="",Y=!1,G=!1,w=!1;for(let B=0;B<H.length;B++){if(Y){Q+=H[B],Y=!1;continue}if(X.i){if(G){if(H[B].match(/[a-z]/)){if(w)Q+=H[B],Q+=`${H[B-2]}-${H[B]}`.toUpperCase(),w=!1;else if(H[B+1]==="-"&&H[B+2]?.match(/[a-z]/))Q+=H[B],w=!0;else Q+=`${H[B]}${H[B].toUpperCase()}`;continue}}else if(H[B].match(/[a-z]/)){Q+=`[${H[B]}${H[B].toUpperCase()}]`;continue}}if(X.m){if(H[B]==="^"){Q+=`(^|(?<=[\r
2
+ var z1=Object.create;var{getPrototypeOf:V1,defineProperty:N2,getOwnPropertyNames:A1}=Object;var b1=Object.prototype.hasOwnProperty;var O2=($,W,X)=>{X=$!=null?z1(V1($)):{};let H=W||!$||!$.__esModule?N2(X,"default",{value:$,enumerable:!0}):X;for(let Q of A1($))if(!b1.call(H,Q))N2(H,Q,{get:()=>$[Q],enumerable:!0});return H};var E4=($,W)=>()=>(W||$((W={exports:{}}).exports,W),W.exports);var N1=($,W)=>{for(var X in W)N2($,X,{get:W[X],enumerable:!0,configurable:!0,set:(H)=>W[X]=()=>H})};var J={};N1(J,{void:()=>WW,util:()=>U,unknown:()=>e1,union:()=>JW,undefined:()=>a1,tuple:()=>wW,transformer:()=>OW,symbol:()=>r1,string:()=>s2,strictObject:()=>QW,setErrorMap:()=>q1,set:()=>MW,record:()=>BW,quotelessJson:()=>O1,promise:()=>NW,preprocess:()=>UW,pipeline:()=>LW,ostring:()=>KW,optional:()=>_W,onumber:()=>FW,oboolean:()=>SW,objectUtil:()=>_2,object:()=>HW,number:()=>e2,nullable:()=>qW,null:()=>t1,never:()=>$W,nativeEnum:()=>bW,nan:()=>p1,map:()=>DW,makeIssue:()=>S$,literal:()=>VW,lazy:()=>zW,late:()=>i1,isValid:()=>a,isDirty:()=>h$,isAsync:()=>B$,isAborted:()=>x$,intersection:()=>GW,instanceof:()=>c1,getParsedType:()=>u,getErrorMap:()=>w$,function:()=>jW,enum:()=>AW,effect:()=>OW,discriminatedUnion:()=>YW,defaultErrorMap:()=>d,datetimeRegex:()=>r2,date:()=>o1,custom:()=>t2,coerce:()=>EW,boolean:()=>$0,bigint:()=>d1,array:()=>XW,any:()=>s1,addIssueToContext:()=>z,ZodVoid:()=>f$,ZodUnknown:()=>t,ZodUnion:()=>A$,ZodUndefined:()=>z$,ZodType:()=>q,ZodTuple:()=>c,ZodTransformer:()=>x,ZodSymbol:()=>R$,ZodString:()=>g,ZodSet:()=>Y$,ZodSchema:()=>q,ZodRecord:()=>k$,ZodReadonly:()=>L$,ZodPromise:()=>G$,ZodPipeline:()=>C$,ZodParsedType:()=>j,ZodOptional:()=>k,ZodObject:()=>K,ZodNumber:()=>s,ZodNullable:()=>r,ZodNull:()=>V$,ZodNever:()=>i,ZodNativeEnum:()=>_$,ZodNaN:()=>P$,ZodMap:()=>I$,ZodLiteral:()=>O$,ZodLazy:()=>N$,ZodIssueCode:()=>D,ZodIntersection:()=>b$,ZodFunction:()=>M$,ZodFirstPartyTypeKind:()=>M,ZodError:()=>f,ZodEnum:()=>$$,ZodEffects:()=>x,ZodDiscriminatedUnion:()=>l$,ZodDefault:()=>q$,ZodDate:()=>Q$,ZodCatch:()=>U$,ZodBranded:()=>m$,ZodBoolean:()=>j$,ZodBigInt:()=>e,ZodArray:()=>T,ZodAny:()=>J$,Schema:()=>q,ParseStatus:()=>E,OK:()=>v,NEVER:()=>vW,INVALID:()=>b,EMPTY_PATH:()=>U1,DIRTY:()=>H$,BRAND:()=>u1});var U;(function($){$.assertEqual=(Q)=>{};function W(Q){}$.assertIs=W;function X(Q){throw new Error}$.assertNever=X,$.arrayToEnum=(Q)=>{let Y={};for(let G of Q)Y[G]=G;return Y},$.getValidEnumValues=(Q)=>{let Y=$.objectKeys(Q).filter((w)=>typeof Q[Q[w]]!=="number"),G={};for(let w of Y)G[w]=Q[w];return $.objectValues(G)},$.objectValues=(Q)=>{return $.objectKeys(Q).map(function(Y){return Q[Y]})},$.objectKeys=typeof Object.keys==="function"?(Q)=>Object.keys(Q):(Q)=>{let Y=[];for(let G in Q)if(Object.prototype.hasOwnProperty.call(Q,G))Y.push(G);return Y},$.find=(Q,Y)=>{for(let G of Q)if(Y(G))return G;return},$.isInteger=typeof Number.isInteger==="function"?(Q)=>Number.isInteger(Q):(Q)=>typeof Q==="number"&&Number.isFinite(Q)&&Math.floor(Q)===Q;function H(Q,Y=" | "){return Q.map((G)=>typeof G==="string"?`'${G}'`:G).join(Y)}$.joinValues=H,$.jsonStringifyReplacer=(Q,Y)=>{if(typeof Y==="bigint")return Y.toString();return Y}})(U||(U={}));var _2;(function($){$.mergeShapes=(W,X)=>{return{...W,...X}}})(_2||(_2={}));var j=U.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),u=($)=>{switch(typeof $){case"undefined":return j.undefined;case"string":return j.string;case"number":return Number.isNaN($)?j.nan:j.number;case"boolean":return j.boolean;case"function":return j.function;case"bigint":return j.bigint;case"symbol":return j.symbol;case"object":if(Array.isArray($))return j.array;if($===null)return j.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return j.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return j.map;if(typeof Set!=="undefined"&&$ instanceof Set)return j.set;if(typeof Date!=="undefined"&&$ instanceof Date)return j.date;return j.object;default:return j.unknown}};var D=U.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),O1=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")};class f extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(X)=>{this.issues=[...this.issues,X]},this.addIssues=(X=[])=>{this.issues=[...this.issues,...X]};let W=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,W);else this.__proto__=W;this.name="ZodError",this.issues=$}format($){let W=$||function(Q){return Q.message},X={_errors:[]},H=(Q)=>{for(let Y of Q.issues)if(Y.code==="invalid_union")Y.unionErrors.map(H);else if(Y.code==="invalid_return_type")H(Y.returnTypeError);else if(Y.code==="invalid_arguments")H(Y.argumentsError);else if(Y.path.length===0)X._errors.push(W(Y));else{let G=X,w=0;while(w<Y.path.length){let B=Y.path[w];if(w!==Y.path.length-1)G[B]=G[B]||{_errors:[]};else G[B]=G[B]||{_errors:[]},G[B]._errors.push(W(Y));G=G[B],w++}}};return H(this),X}static assert($){if(!($ instanceof f))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,U.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(W)=>W.message){let W={},X=[];for(let H of this.issues)if(H.path.length>0)W[H.path[0]]=W[H.path[0]]||[],W[H.path[0]].push($(H));else X.push($(H));return{formErrors:X,fieldErrors:W}}get formErrors(){return this.flatten()}}f.create=($)=>{return new f($)};var _1=($,W)=>{let X;switch($.code){case D.invalid_type:if($.received===j.undefined)X="Required";else X=`Expected ${$.expected}, received ${$.received}`;break;case D.invalid_literal:X=`Invalid literal value, expected ${JSON.stringify($.expected,U.jsonStringifyReplacer)}`;break;case D.unrecognized_keys:X=`Unrecognized key(s) in object: ${U.joinValues($.keys,", ")}`;break;case D.invalid_union:X="Invalid input";break;case D.invalid_union_discriminator:X=`Invalid discriminator value. Expected ${U.joinValues($.options)}`;break;case D.invalid_enum_value:X=`Invalid enum value. Expected ${U.joinValues($.options)}, received '${$.received}'`;break;case D.invalid_arguments:X="Invalid function arguments";break;case D.invalid_return_type:X="Invalid function return type";break;case D.invalid_date:X="Invalid date";break;case D.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(X=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")X=`${X} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)X=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)X=`Invalid input: must end with "${$.validation.endsWith}"`;else U.assertNever($.validation);else if($.validation!=="regex")X=`Invalid ${$.validation}`;else X="Invalid";break;case D.too_small:if($.type==="array")X=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")X=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")X=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")X=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else X="Invalid input";break;case D.too_big:if($.type==="array")X=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")X=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")X=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")X=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")X=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else X="Invalid input";break;case D.custom:X="Invalid input";break;case D.invalid_intersection_types:X="Intersection results could not be merged";break;case D.not_multiple_of:X=`Number must be a multiple of ${$.multipleOf}`;break;case D.not_finite:X="Number must be finite";break;default:X=W.defaultError,U.assertNever($)}return{message:X}},d=_1;var u2=d;function q1($){u2=$}function w$(){return u2}var S$=($)=>{let{data:W,path:X,errorMaps:H,issueData:Q}=$,Y=[...X,...Q.path||[]],G={...Q,path:Y};if(Q.message!==void 0)return{...Q,path:Y,message:Q.message};let w="",B=H.filter((V)=>!!V).slice().reverse();for(let V of B)w=V(G,{data:W,defaultError:w}).message;return{...Q,path:Y,message:w}},U1=[];function z($,W){let X=w$(),H=S$({issueData:W,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,X,X===d?void 0:d].filter((Q)=>!!Q)});$.common.issues.push(H)}class E{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,W){let X=[];for(let H of W){if(H.status==="aborted")return b;if(H.status==="dirty")$.dirty();X.push(H.value)}return{status:$.value,value:X}}static async mergeObjectAsync($,W){let X=[];for(let H of W){let Q=await H.key,Y=await H.value;X.push({key:Q,value:Y})}return E.mergeObjectSync($,X)}static mergeObjectSync($,W){let X={};for(let H of W){let{key:Q,value:Y}=H;if(Q.status==="aborted")return b;if(Y.status==="aborted")return b;if(Q.status==="dirty")$.dirty();if(Y.status==="dirty")$.dirty();if(Q.value!=="__proto__"&&(typeof Y.value!=="undefined"||H.alwaysSet))X[Q.value]=Y.value}return{status:$.value,value:X}}}var b=Object.freeze({status:"aborted"}),H$=($)=>({status:"dirty",value:$}),v=($)=>({status:"valid",value:$}),x$=($)=>$.status==="aborted",h$=($)=>$.status==="dirty",a=($)=>$.status==="valid",B$=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var A;(function($){$.errToObj=(W)=>typeof W==="string"?{message:W}:W||{},$.toString=(W)=>typeof W==="string"?W:W?.message})(A||(A={}));var Z$=function($,W,X,H){if(X==="a"&&!H)throw new TypeError("Private accessor was defined without a getter");if(typeof W==="function"?$!==W||!H:!W.has($))throw new TypeError("Cannot read private member from an object whose class did not declare it");return X==="m"?H:X==="a"?H.call($):H?H.value:W.get($)},p2=function($,W,X,H,Q){if(H==="m")throw new TypeError("Private method is not writable");if(H==="a"&&!Q)throw new TypeError("Private accessor was defined without a setter");if(typeof W==="function"?$!==W||!Q:!W.has($))throw new TypeError("Cannot write private member to an object whose class did not declare it");return H==="a"?Q.call($,X):Q?Q.value=X:W.set($,X),X},E$,v$;class y{constructor($,W,X,H){this._cachedPath=[],this.parent=$,this.data=W,this._path=X,this._key=H}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}var i2=($,W)=>{if(a(W))return{success:!0,data:W.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let X=new f($.common.issues);return this._error=X,this._error}}}};function O($){if(!$)return{};let{errorMap:W,invalid_type_error:X,required_error:H,description:Q}=$;if(W&&(X||H))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(W)return{errorMap:W,description:Q};return{errorMap:(G,w)=>{let{message:B}=$;if(G.code==="invalid_enum_value")return{message:B??w.defaultError};if(typeof w.data==="undefined")return{message:B??H??w.defaultError};if(G.code!=="invalid_type")return{message:w.defaultError};return{message:B??X??w.defaultError}},description:Q}}class q{get description(){return this._def.description}_getType($){return u($.data)}_getOrReturnCtx($,W){return W||{common:$.parent.common,data:$.data,parsedType:u($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new E,ctx:{common:$.parent.common,data:$.data,parsedType:u($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let W=this._parse($);if(B$(W))throw new Error("Synchronous parse encountered promise.");return W}_parseAsync($){let W=this._parse($);return Promise.resolve(W)}parse($,W){let X=this.safeParse($,W);if(X.success)return X.data;throw X.error}safeParse($,W){let X={common:{issues:[],async:W?.async??!1,contextualErrorMap:W?.errorMap},path:W?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:u($)},H=this._parseSync({data:$,path:X.path,parent:X});return i2(X,H)}"~validate"($){let W={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:u($)};if(!this["~standard"].async)try{let X=this._parseSync({data:$,path:[],parent:W});return a(X)?{value:X.value}:{issues:W.common.issues}}catch(X){if(X?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;W.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:W}).then((X)=>a(X)?{value:X.value}:{issues:W.common.issues})}async parseAsync($,W){let X=await this.safeParseAsync($,W);if(X.success)return X.data;throw X.error}async safeParseAsync($,W){let X={common:{issues:[],contextualErrorMap:W?.errorMap,async:!0},path:W?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:u($)},H=this._parse({data:$,path:X.path,parent:X}),Q=await(B$(H)?H:Promise.resolve(H));return i2(X,Q)}refine($,W){let X=(H)=>{if(typeof W==="string"||typeof W==="undefined")return{message:W};else if(typeof W==="function")return W(H);else return W};return this._refinement((H,Q)=>{let Y=$(H),G=()=>Q.addIssue({code:D.custom,...X(H)});if(typeof Promise!=="undefined"&&Y instanceof Promise)return Y.then((w)=>{if(!w)return G(),!1;else return!0});if(!Y)return G(),!1;else return!0})}refinement($,W){return this._refinement((X,H)=>{if(!$(X))return H.addIssue(typeof W==="function"?W(X,H):W),!1;else return!0})}_refinement($){return new x({schema:this,typeName:M.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(W)=>this["~validate"](W)}}optional(){return k.create(this,this._def)}nullable(){return r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return T.create(this)}promise(){return G$.create(this,this._def)}or($){return A$.create([this,$],this._def)}and($){return b$.create(this,$,this._def)}transform($){return new x({...O(this._def),schema:this,typeName:M.ZodEffects,effect:{type:"transform",transform:$}})}default($){let W=typeof $==="function"?$:()=>$;return new q$({...O(this._def),innerType:this,defaultValue:W,typeName:M.ZodDefault})}brand(){return new m$({typeName:M.ZodBranded,type:this,...O(this._def)})}catch($){let W=typeof $==="function"?$:()=>$;return new U$({...O(this._def),innerType:this,catchValue:W,typeName:M.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return C$.create(this,$)}readonly(){return L$.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var L1=/^c[^\s-]{8,}$/i,K1=/^[0-9a-z]+$/,F1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,S1=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,E1=/^[a-z0-9_-]{21}$/i,v1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,R1=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,f1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,k1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",q2,I1=/^(?:(?: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])$/,P1=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,C1=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,g1=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,T1=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,y1=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,d2="((\\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])))",x1=new RegExp(`^${d2}$`);function o2($){let W="[0-5]\\d";if($.precision)W=`${W}\\.\\d{${$.precision}}`;else if($.precision==null)W=`${W}(\\.\\d+)?`;let X=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${W})${X}`}function h1($){return new RegExp(`^${o2($)}$`)}function r2($){let W=`${d2}T${o2($)}`,X=[];if(X.push($.local?"Z?":"Z"),$.offset)X.push("([+-]\\d{2}:?\\d{2})");return W=`${W}(${X.join("|")})`,new RegExp(`^${W}$`)}function Z1($,W){if((W==="v4"||!W)&&I1.test($))return!0;if((W==="v6"||!W)&&C1.test($))return!0;return!1}function l1($,W){if(!v1.test($))return!1;try{let[X]=$.split("."),H=X.replace(/-/g,"+").replace(/_/g,"/").padEnd(X.length+(4-X.length%4)%4,"="),Q=JSON.parse(atob(H));if(typeof Q!=="object"||Q===null)return!1;if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(W&&Q.alg!==W)return!1;return!0}catch{return!1}}function m1($,W){if((W==="v4"||!W)&&P1.test($))return!0;if((W==="v6"||!W)&&g1.test($))return!0;return!1}class g extends q{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==j.string){let Q=this._getOrReturnCtx($);return z(Q,{code:D.invalid_type,expected:j.string,received:Q.parsedType}),b}let X=new E,H=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if($.data.length<Q.value)H=this._getOrReturnCtx($,H),z(H,{code:D.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),X.dirty()}else if(Q.kind==="max"){if($.data.length>Q.value)H=this._getOrReturnCtx($,H),z(H,{code:D.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),X.dirty()}else if(Q.kind==="length"){let Y=$.data.length>Q.value,G=$.data.length<Q.value;if(Y||G){if(H=this._getOrReturnCtx($,H),Y)z(H,{code:D.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});else if(G)z(H,{code:D.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});X.dirty()}}else if(Q.kind==="email"){if(!f1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"email",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="emoji"){if(!q2)q2=new RegExp(k1,"u");if(!q2.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"emoji",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="uuid"){if(!S1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"uuid",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="nanoid"){if(!E1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"nanoid",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="cuid"){if(!L1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"cuid",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="cuid2"){if(!K1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"cuid2",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="ulid"){if(!F1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"ulid",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="url")try{new URL($.data)}catch{H=this._getOrReturnCtx($,H),z(H,{validation:"url",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="regex"){if(Q.regex.lastIndex=0,!Q.regex.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"regex",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="trim")$.data=$.data.trim();else if(Q.kind==="includes"){if(!$.data.includes(Q.value,Q.position))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:{includes:Q.value,position:Q.position},message:Q.message}),X.dirty()}else if(Q.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(Q.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(Q.kind==="startsWith"){if(!$.data.startsWith(Q.value))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:{startsWith:Q.value},message:Q.message}),X.dirty()}else if(Q.kind==="endsWith"){if(!$.data.endsWith(Q.value))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:{endsWith:Q.value},message:Q.message}),X.dirty()}else if(Q.kind==="datetime"){if(!r2(Q).test($.data))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:"datetime",message:Q.message}),X.dirty()}else if(Q.kind==="date"){if(!x1.test($.data))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:"date",message:Q.message}),X.dirty()}else if(Q.kind==="time"){if(!h1(Q).test($.data))H=this._getOrReturnCtx($,H),z(H,{code:D.invalid_string,validation:"time",message:Q.message}),X.dirty()}else if(Q.kind==="duration"){if(!R1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"duration",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="ip"){if(!Z1($.data,Q.version))H=this._getOrReturnCtx($,H),z(H,{validation:"ip",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="jwt"){if(!l1($.data,Q.alg))H=this._getOrReturnCtx($,H),z(H,{validation:"jwt",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="cidr"){if(!m1($.data,Q.version))H=this._getOrReturnCtx($,H),z(H,{validation:"cidr",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="base64"){if(!T1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"base64",code:D.invalid_string,message:Q.message}),X.dirty()}else if(Q.kind==="base64url"){if(!y1.test($.data))H=this._getOrReturnCtx($,H),z(H,{validation:"base64url",code:D.invalid_string,message:Q.message}),X.dirty()}else U.assertNever(Q);return{status:X.value,value:$.data}}_regex($,W,X){return this.refinement((H)=>$.test(H),{validation:W,code:D.invalid_string,...A.errToObj(X)})}_addCheck($){return new g({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...A.errToObj($)})}url($){return this._addCheck({kind:"url",...A.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...A.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...A.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...A.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...A.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...A.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...A.errToObj($)})}base64($){return this._addCheck({kind:"base64",...A.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...A.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...A.errToObj($)})}ip($){return this._addCheck({kind:"ip",...A.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...A.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision==="undefined"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...A.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision==="undefined"?null:$?.precision,...A.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...A.errToObj($)})}regex($,W){return this._addCheck({kind:"regex",regex:$,...A.errToObj(W)})}includes($,W){return this._addCheck({kind:"includes",value:$,position:W?.position,...A.errToObj(W?.message)})}startsWith($,W){return this._addCheck({kind:"startsWith",value:$,...A.errToObj(W)})}endsWith($,W){return this._addCheck({kind:"endsWith",value:$,...A.errToObj(W)})}min($,W){return this._addCheck({kind:"min",value:$,...A.errToObj(W)})}max($,W){return this._addCheck({kind:"max",value:$,...A.errToObj(W)})}length($,W){return this._addCheck({kind:"length",value:$,...A.errToObj(W)})}nonempty($){return this.min(1,A.errToObj($))}trim(){return new g({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new g({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new g({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxLength(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}}g.create=($)=>{return new g({checks:[],typeName:M.ZodString,coerce:$?.coerce??!1,...O($)})};function n1($,W){let X=($.toString().split(".")[1]||"").length,H=(W.toString().split(".")[1]||"").length,Q=X>H?X:H,Y=Number.parseInt($.toFixed(Q).replace(".","")),G=Number.parseInt(W.toFixed(Q).replace(".",""));return Y%G/10**Q}class s extends q{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==j.number){let Q=this._getOrReturnCtx($);return z(Q,{code:D.invalid_type,expected:j.number,received:Q.parsedType}),b}let X=void 0,H=new E;for(let Q of this._def.checks)if(Q.kind==="int"){if(!U.isInteger($.data))X=this._getOrReturnCtx($,X),z(X,{code:D.invalid_type,expected:"integer",received:"float",message:Q.message}),H.dirty()}else if(Q.kind==="min"){if(Q.inclusive?$.data<Q.value:$.data<=Q.value)X=this._getOrReturnCtx($,X),z(X,{code:D.too_small,minimum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),H.dirty()}else if(Q.kind==="max"){if(Q.inclusive?$.data>Q.value:$.data>=Q.value)X=this._getOrReturnCtx($,X),z(X,{code:D.too_big,maximum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),H.dirty()}else if(Q.kind==="multipleOf"){if(n1($.data,Q.value)!==0)X=this._getOrReturnCtx($,X),z(X,{code:D.not_multiple_of,multipleOf:Q.value,message:Q.message}),H.dirty()}else if(Q.kind==="finite"){if(!Number.isFinite($.data))X=this._getOrReturnCtx($,X),z(X,{code:D.not_finite,message:Q.message}),H.dirty()}else U.assertNever(Q);return{status:H.value,value:$.data}}gte($,W){return this.setLimit("min",$,!0,A.toString(W))}gt($,W){return this.setLimit("min",$,!1,A.toString(W))}lte($,W){return this.setLimit("max",$,!0,A.toString(W))}lt($,W){return this.setLimit("max",$,!1,A.toString(W))}setLimit($,W,X,H){return new s({...this._def,checks:[...this._def.checks,{kind:$,value:W,inclusive:X,message:A.toString(H)}]})}_addCheck($){return new s({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:A.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:A.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:A.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:A.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:A.toString($)})}multipleOf($,W){return this._addCheck({kind:"multipleOf",value:$,message:A.toString(W)})}finite($){return this._addCheck({kind:"finite",message:A.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:A.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:A.toString($)})}get minValue(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxValue(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&U.isInteger($.value))}get isFinite(){let $=null,W=null;for(let X of this._def.checks)if(X.kind==="finite"||X.kind==="int"||X.kind==="multipleOf")return!0;else if(X.kind==="min"){if(W===null||X.value>W)W=X.value}else if(X.kind==="max"){if($===null||X.value<$)$=X.value}return Number.isFinite(W)&&Number.isFinite($)}}s.create=($)=>{return new s({checks:[],typeName:M.ZodNumber,coerce:$?.coerce||!1,...O($)})};class e extends q{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==j.bigint)return this._getInvalidInput($);let X=void 0,H=new E;for(let Q of this._def.checks)if(Q.kind==="min"){if(Q.inclusive?$.data<Q.value:$.data<=Q.value)X=this._getOrReturnCtx($,X),z(X,{code:D.too_small,type:"bigint",minimum:Q.value,inclusive:Q.inclusive,message:Q.message}),H.dirty()}else if(Q.kind==="max"){if(Q.inclusive?$.data>Q.value:$.data>=Q.value)X=this._getOrReturnCtx($,X),z(X,{code:D.too_big,type:"bigint",maximum:Q.value,inclusive:Q.inclusive,message:Q.message}),H.dirty()}else if(Q.kind==="multipleOf"){if($.data%Q.value!==BigInt(0))X=this._getOrReturnCtx($,X),z(X,{code:D.not_multiple_of,multipleOf:Q.value,message:Q.message}),H.dirty()}else U.assertNever(Q);return{status:H.value,value:$.data}}_getInvalidInput($){let W=this._getOrReturnCtx($);return z(W,{code:D.invalid_type,expected:j.bigint,received:W.parsedType}),b}gte($,W){return this.setLimit("min",$,!0,A.toString(W))}gt($,W){return this.setLimit("min",$,!1,A.toString(W))}lte($,W){return this.setLimit("max",$,!0,A.toString(W))}lt($,W){return this.setLimit("max",$,!1,A.toString(W))}setLimit($,W,X,H){return new e({...this._def,checks:[...this._def.checks,{kind:$,value:W,inclusive:X,message:A.toString(H)}]})}_addCheck($){return new e({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:A.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:A.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:A.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:A.toString($)})}multipleOf($,W){return this._addCheck({kind:"multipleOf",value:$,message:A.toString(W)})}get minValue(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $}get maxValue(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $}}e.create=($)=>{return new e({checks:[],typeName:M.ZodBigInt,coerce:$?.coerce??!1,...O($)})};class j$ extends q{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==j.boolean){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.boolean,received:X.parsedType}),b}return v($.data)}}j$.create=($)=>{return new j$({typeName:M.ZodBoolean,coerce:$?.coerce||!1,...O($)})};class Q$ extends q{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==j.date){let Q=this._getOrReturnCtx($);return z(Q,{code:D.invalid_type,expected:j.date,received:Q.parsedType}),b}if(Number.isNaN($.data.getTime())){let Q=this._getOrReturnCtx($);return z(Q,{code:D.invalid_date}),b}let X=new E,H=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if($.data.getTime()<Q.value)H=this._getOrReturnCtx($,H),z(H,{code:D.too_small,message:Q.message,inclusive:!0,exact:!1,minimum:Q.value,type:"date"}),X.dirty()}else if(Q.kind==="max"){if($.data.getTime()>Q.value)H=this._getOrReturnCtx($,H),z(H,{code:D.too_big,message:Q.message,inclusive:!0,exact:!1,maximum:Q.value,type:"date"}),X.dirty()}else U.assertNever(Q);return{status:X.value,value:new Date($.data.getTime())}}_addCheck($){return new Q$({...this._def,checks:[...this._def.checks,$]})}min($,W){return this._addCheck({kind:"min",value:$.getTime(),message:A.toString(W)})}max($,W){return this._addCheck({kind:"max",value:$.getTime(),message:A.toString(W)})}get minDate(){let $=null;for(let W of this._def.checks)if(W.kind==="min"){if($===null||W.value>$)$=W.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let W of this._def.checks)if(W.kind==="max"){if($===null||W.value<$)$=W.value}return $!=null?new Date($):null}}Q$.create=($)=>{return new Q$({checks:[],coerce:$?.coerce||!1,typeName:M.ZodDate,...O($)})};class R$ extends q{_parse($){if(this._getType($)!==j.symbol){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.symbol,received:X.parsedType}),b}return v($.data)}}R$.create=($)=>{return new R$({typeName:M.ZodSymbol,...O($)})};class z$ extends q{_parse($){if(this._getType($)!==j.undefined){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.undefined,received:X.parsedType}),b}return v($.data)}}z$.create=($)=>{return new z$({typeName:M.ZodUndefined,...O($)})};class V$ extends q{_parse($){if(this._getType($)!==j.null){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.null,received:X.parsedType}),b}return v($.data)}}V$.create=($)=>{return new V$({typeName:M.ZodNull,...O($)})};class J$ extends q{constructor(){super(...arguments);this._any=!0}_parse($){return v($.data)}}J$.create=($)=>{return new J$({typeName:M.ZodAny,...O($)})};class t extends q{constructor(){super(...arguments);this._unknown=!0}_parse($){return v($.data)}}t.create=($)=>{return new t({typeName:M.ZodUnknown,...O($)})};class i extends q{_parse($){let W=this._getOrReturnCtx($);return z(W,{code:D.invalid_type,expected:j.never,received:W.parsedType}),b}}i.create=($)=>{return new i({typeName:M.ZodNever,...O($)})};class f$ extends q{_parse($){if(this._getType($)!==j.undefined){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.void,received:X.parsedType}),b}return v($.data)}}f$.create=($)=>{return new f$({typeName:M.ZodVoid,...O($)})};class T extends q{_parse($){let{ctx:W,status:X}=this._processInputParams($),H=this._def;if(W.parsedType!==j.array)return z(W,{code:D.invalid_type,expected:j.array,received:W.parsedType}),b;if(H.exactLength!==null){let Y=W.data.length>H.exactLength.value,G=W.data.length<H.exactLength.value;if(Y||G)z(W,{code:Y?D.too_big:D.too_small,minimum:G?H.exactLength.value:void 0,maximum:Y?H.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:H.exactLength.message}),X.dirty()}if(H.minLength!==null){if(W.data.length<H.minLength.value)z(W,{code:D.too_small,minimum:H.minLength.value,type:"array",inclusive:!0,exact:!1,message:H.minLength.message}),X.dirty()}if(H.maxLength!==null){if(W.data.length>H.maxLength.value)z(W,{code:D.too_big,maximum:H.maxLength.value,type:"array",inclusive:!0,exact:!1,message:H.maxLength.message}),X.dirty()}if(W.common.async)return Promise.all([...W.data].map((Y,G)=>{return H.type._parseAsync(new y(W,Y,W.path,G))})).then((Y)=>{return E.mergeArray(X,Y)});let Q=[...W.data].map((Y,G)=>{return H.type._parseSync(new y(W,Y,W.path,G))});return E.mergeArray(X,Q)}get element(){return this._def.type}min($,W){return new T({...this._def,minLength:{value:$,message:A.toString(W)}})}max($,W){return new T({...this._def,maxLength:{value:$,message:A.toString(W)}})}length($,W){return new T({...this._def,exactLength:{value:$,message:A.toString(W)}})}nonempty($){return this.min(1,$)}}T.create=($,W)=>{return new T({type:$,minLength:null,maxLength:null,exactLength:null,typeName:M.ZodArray,...O(W)})};function D$($){if($ instanceof K){let W={};for(let X in $.shape){let H=$.shape[X];W[X]=k.create(D$(H))}return new K({...$._def,shape:()=>W})}else if($ instanceof T)return new T({...$._def,type:D$($.element)});else if($ instanceof k)return k.create(D$($.unwrap()));else if($ instanceof r)return r.create(D$($.unwrap()));else if($ instanceof c)return c.create($.items.map((W)=>D$(W)));else return $}class K extends q{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),W=U.objectKeys($);return this._cached={shape:$,keys:W},this._cached}_parse($){if(this._getType($)!==j.object){let B=this._getOrReturnCtx($);return z(B,{code:D.invalid_type,expected:j.object,received:B.parsedType}),b}let{status:X,ctx:H}=this._processInputParams($),{shape:Q,keys:Y}=this._getCached(),G=[];if(!(this._def.catchall instanceof i&&this._def.unknownKeys==="strip")){for(let B in H.data)if(!Y.includes(B))G.push(B)}let w=[];for(let B of Y){let V=Q[B],_=H.data[B];w.push({key:{status:"valid",value:B},value:V._parse(new y(H,_,H.path,B)),alwaysSet:B in H.data})}if(this._def.catchall instanceof i){let B=this._def.unknownKeys;if(B==="passthrough")for(let V of G)w.push({key:{status:"valid",value:V},value:{status:"valid",value:H.data[V]}});else if(B==="strict"){if(G.length>0)z(H,{code:D.unrecognized_keys,keys:G}),X.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let V of G){let _=H.data[V];w.push({key:{status:"valid",value:V},value:B._parse(new y(H,_,H.path,V)),alwaysSet:V in H.data})}}if(H.common.async)return Promise.resolve().then(async()=>{let B=[];for(let V of w){let _=await V.key,P=await V.value;B.push({key:_,value:P,alwaysSet:V.alwaysSet})}return B}).then((B)=>{return E.mergeObjectSync(X,B)});else return E.mergeObjectSync(X,w)}get shape(){return this._def.shape()}strict($){return A.errToObj,new K({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(W,X)=>{let H=this._def.errorMap?.(W,X).message??X.defaultError;if(W.code==="unrecognized_keys")return{message:A.errToObj($).message??H};return{message:H}}}:{}})}strip(){return new K({...this._def,unknownKeys:"strip"})}passthrough(){return new K({...this._def,unknownKeys:"passthrough"})}extend($){return new K({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new K({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:M.ZodObject})}setKey($,W){return this.augment({[$]:W})}catchall($){return new K({...this._def,catchall:$})}pick($){let W={};for(let X of U.objectKeys($))if($[X]&&this.shape[X])W[X]=this.shape[X];return new K({...this._def,shape:()=>W})}omit($){let W={};for(let X of U.objectKeys(this.shape))if(!$[X])W[X]=this.shape[X];return new K({...this._def,shape:()=>W})}deepPartial(){return D$(this)}partial($){let W={};for(let X of U.objectKeys(this.shape)){let H=this.shape[X];if($&&!$[X])W[X]=H;else W[X]=H.optional()}return new K({...this._def,shape:()=>W})}required($){let W={};for(let X of U.objectKeys(this.shape))if($&&!$[X])W[X]=this.shape[X];else{let Q=this.shape[X];while(Q instanceof k)Q=Q._def.innerType;W[X]=Q}return new K({...this._def,shape:()=>W})}keyof(){return a2(U.objectKeys(this.shape))}}K.create=($,W)=>{return new K({shape:()=>$,unknownKeys:"strip",catchall:i.create(),typeName:M.ZodObject,...O(W)})};K.strictCreate=($,W)=>{return new K({shape:()=>$,unknownKeys:"strict",catchall:i.create(),typeName:M.ZodObject,...O(W)})};K.lazycreate=($,W)=>{return new K({shape:$,unknownKeys:"strip",catchall:i.create(),typeName:M.ZodObject,...O(W)})};class A$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X=this._def.options;function H(Q){for(let G of Q)if(G.result.status==="valid")return G.result;for(let G of Q)if(G.result.status==="dirty")return W.common.issues.push(...G.ctx.common.issues),G.result;let Y=Q.map((G)=>new f(G.ctx.common.issues));return z(W,{code:D.invalid_union,unionErrors:Y}),b}if(W.common.async)return Promise.all(X.map(async(Q)=>{let Y={...W,common:{...W.common,issues:[]},parent:null};return{result:await Q._parseAsync({data:W.data,path:W.path,parent:Y}),ctx:Y}})).then(H);else{let Q=void 0,Y=[];for(let w of X){let B={...W,common:{...W.common,issues:[]},parent:null},V=w._parseSync({data:W.data,path:W.path,parent:B});if(V.status==="valid")return V;else if(V.status==="dirty"&&!Q)Q={result:V,ctx:B};if(B.common.issues.length)Y.push(B.common.issues)}if(Q)return W.common.issues.push(...Q.ctx.common.issues),Q.result;let G=Y.map((w)=>new f(w));return z(W,{code:D.invalid_union,unionErrors:G}),b}}get options(){return this._def.options}}A$.create=($,W)=>{return new A$({options:$,typeName:M.ZodUnion,...O(W)})};var o=($)=>{if($ instanceof N$)return o($.schema);else if($ instanceof x)return o($.innerType());else if($ instanceof O$)return[$.value];else if($ instanceof $$)return $.options;else if($ instanceof _$)return U.objectValues($.enum);else if($ instanceof q$)return o($._def.innerType);else if($ instanceof z$)return[void 0];else if($ instanceof V$)return[null];else if($ instanceof k)return[void 0,...o($.unwrap())];else if($ instanceof r)return[null,...o($.unwrap())];else if($ instanceof m$)return o($.unwrap());else if($ instanceof L$)return o($.unwrap());else if($ instanceof U$)return o($._def.innerType);else return[]};class l$ extends q{_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==j.object)return z(W,{code:D.invalid_type,expected:j.object,received:W.parsedType}),b;let X=this.discriminator,H=W.data[X],Q=this.optionsMap.get(H);if(!Q)return z(W,{code:D.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[X]}),b;if(W.common.async)return Q._parseAsync({data:W.data,path:W.path,parent:W});else return Q._parseSync({data:W.data,path:W.path,parent:W})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,W,X){let H=new Map;for(let Q of W){let Y=o(Q.shape[$]);if(!Y.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let G of Y){if(H.has(G))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(G)}`);H.set(G,Q)}}return new l$({typeName:M.ZodDiscriminatedUnion,discriminator:$,options:W,optionsMap:H,...O(X)})}}function U2($,W){let X=u($),H=u(W);if($===W)return{valid:!0,data:$};else if(X===j.object&&H===j.object){let Q=U.objectKeys(W),Y=U.objectKeys($).filter((w)=>Q.indexOf(w)!==-1),G={...$,...W};for(let w of Y){let B=U2($[w],W[w]);if(!B.valid)return{valid:!1};G[w]=B.data}return{valid:!0,data:G}}else if(X===j.array&&H===j.array){if($.length!==W.length)return{valid:!1};let Q=[];for(let Y=0;Y<$.length;Y++){let G=$[Y],w=W[Y],B=U2(G,w);if(!B.valid)return{valid:!1};Q.push(B.data)}return{valid:!0,data:Q}}else if(X===j.date&&H===j.date&&+$===+W)return{valid:!0,data:$};else return{valid:!1}}class b$ extends q{_parse($){let{status:W,ctx:X}=this._processInputParams($),H=(Q,Y)=>{if(x$(Q)||x$(Y))return b;let G=U2(Q.value,Y.value);if(!G.valid)return z(X,{code:D.invalid_intersection_types}),b;if(h$(Q)||h$(Y))W.dirty();return{status:W.value,value:G.data}};if(X.common.async)return Promise.all([this._def.left._parseAsync({data:X.data,path:X.path,parent:X}),this._def.right._parseAsync({data:X.data,path:X.path,parent:X})]).then(([Q,Y])=>H(Q,Y));else return H(this._def.left._parseSync({data:X.data,path:X.path,parent:X}),this._def.right._parseSync({data:X.data,path:X.path,parent:X}))}}b$.create=($,W,X)=>{return new b$({left:$,right:W,typeName:M.ZodIntersection,...O(X)})};class c extends q{_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.parsedType!==j.array)return z(X,{code:D.invalid_type,expected:j.array,received:X.parsedType}),b;if(X.data.length<this._def.items.length)return z(X,{code:D.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;if(!this._def.rest&&X.data.length>this._def.items.length)z(X,{code:D.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),W.dirty();let Q=[...X.data].map((Y,G)=>{let w=this._def.items[G]||this._def.rest;if(!w)return null;return w._parse(new y(X,Y,X.path,G))}).filter((Y)=>!!Y);if(X.common.async)return Promise.all(Q).then((Y)=>{return E.mergeArray(W,Y)});else return E.mergeArray(W,Q)}get items(){return this._def.items}rest($){return new c({...this._def,rest:$})}}c.create=($,W)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new c({items:$,typeName:M.ZodTuple,rest:null,...O(W)})};class k$ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.parsedType!==j.object)return z(X,{code:D.invalid_type,expected:j.object,received:X.parsedType}),b;let H=[],Q=this._def.keyType,Y=this._def.valueType;for(let G in X.data)H.push({key:Q._parse(new y(X,G,X.path,G)),value:Y._parse(new y(X,X.data[G],X.path,G)),alwaysSet:G in X.data});if(X.common.async)return E.mergeObjectAsync(W,H);else return E.mergeObjectSync(W,H)}get element(){return this._def.valueType}static create($,W,X){if(W instanceof q)return new k$({keyType:$,valueType:W,typeName:M.ZodRecord,...O(X)});return new k$({keyType:g.create(),valueType:$,typeName:M.ZodRecord,...O(W)})}}class I$ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.parsedType!==j.map)return z(X,{code:D.invalid_type,expected:j.map,received:X.parsedType}),b;let H=this._def.keyType,Q=this._def.valueType,Y=[...X.data.entries()].map(([G,w],B)=>{return{key:H._parse(new y(X,G,X.path,[B,"key"])),value:Q._parse(new y(X,w,X.path,[B,"value"]))}});if(X.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let w of Y){let B=await w.key,V=await w.value;if(B.status==="aborted"||V.status==="aborted")return b;if(B.status==="dirty"||V.status==="dirty")W.dirty();G.set(B.value,V.value)}return{status:W.value,value:G}})}else{let G=new Map;for(let w of Y){let{key:B,value:V}=w;if(B.status==="aborted"||V.status==="aborted")return b;if(B.status==="dirty"||V.status==="dirty")W.dirty();G.set(B.value,V.value)}return{status:W.value,value:G}}}}I$.create=($,W,X)=>{return new I$({valueType:W,keyType:$,typeName:M.ZodMap,...O(X)})};class Y$ extends q{_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.parsedType!==j.set)return z(X,{code:D.invalid_type,expected:j.set,received:X.parsedType}),b;let H=this._def;if(H.minSize!==null){if(X.data.size<H.minSize.value)z(X,{code:D.too_small,minimum:H.minSize.value,type:"set",inclusive:!0,exact:!1,message:H.minSize.message}),W.dirty()}if(H.maxSize!==null){if(X.data.size>H.maxSize.value)z(X,{code:D.too_big,maximum:H.maxSize.value,type:"set",inclusive:!0,exact:!1,message:H.maxSize.message}),W.dirty()}let Q=this._def.valueType;function Y(w){let B=new Set;for(let V of w){if(V.status==="aborted")return b;if(V.status==="dirty")W.dirty();B.add(V.value)}return{status:W.value,value:B}}let G=[...X.data.values()].map((w,B)=>Q._parse(new y(X,w,X.path,B)));if(X.common.async)return Promise.all(G).then((w)=>Y(w));else return Y(G)}min($,W){return new Y$({...this._def,minSize:{value:$,message:A.toString(W)}})}max($,W){return new Y$({...this._def,maxSize:{value:$,message:A.toString(W)}})}size($,W){return this.min($,W).max($,W)}nonempty($){return this.min(1,$)}}Y$.create=($,W)=>{return new Y$({valueType:$,minSize:null,maxSize:null,typeName:M.ZodSet,...O(W)})};class M$ extends q{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==j.function)return z(W,{code:D.invalid_type,expected:j.function,received:W.parsedType}),b;function X(G,w){return S$({data:G,path:W.path,errorMaps:[W.common.contextualErrorMap,W.schemaErrorMap,w$(),d].filter((B)=>!!B),issueData:{code:D.invalid_arguments,argumentsError:w}})}function H(G,w){return S$({data:G,path:W.path,errorMaps:[W.common.contextualErrorMap,W.schemaErrorMap,w$(),d].filter((B)=>!!B),issueData:{code:D.invalid_return_type,returnTypeError:w}})}let Q={errorMap:W.common.contextualErrorMap},Y=W.data;if(this._def.returns instanceof G$){let G=this;return v(async function(...w){let B=new f([]),V=await G._def.args.parseAsync(w,Q).catch((W$)=>{throw B.addIssue(X(w,W$)),B}),_=await Reflect.apply(Y,this,V);return await G._def.returns._def.type.parseAsync(_,Q).catch((W$)=>{throw B.addIssue(H(_,W$)),B})})}else{let G=this;return v(function(...w){let B=G._def.args.safeParse(w,Q);if(!B.success)throw new f([X(w,B.error)]);let V=Reflect.apply(Y,this,B.data),_=G._def.returns.safeParse(V,Q);if(!_.success)throw new f([H(V,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new M$({...this._def,args:c.create($).rest(t.create())})}returns($){return new M$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,W,X){return new M$({args:$?$:c.create([]).rest(t.create()),returns:W||t.create(),typeName:M.ZodFunction,...O(X)})}}class N$ extends q{get schema(){return this._def.getter()}_parse($){let{ctx:W}=this._processInputParams($);return this._def.getter()._parse({data:W.data,path:W.path,parent:W})}}N$.create=($,W)=>{return new N$({getter:$,typeName:M.ZodLazy,...O(W)})};class O$ extends q{_parse($){if($.data!==this._def.value){let W=this._getOrReturnCtx($);return z(W,{received:W.data,code:D.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:$.data}}get value(){return this._def.value}}O$.create=($,W)=>{return new O$({value:$,typeName:M.ZodLiteral,...O(W)})};function a2($,W){return new $$({values:$,typeName:M.ZodEnum,...O(W)})}class $$ extends q{constructor(){super(...arguments);E$.set(this,void 0)}_parse($){if(typeof $.data!=="string"){let W=this._getOrReturnCtx($),X=this._def.values;return z(W,{expected:U.joinValues(X),received:W.parsedType,code:D.invalid_type}),b}if(!Z$(this,E$,"f"))p2(this,E$,new Set(this._def.values),"f");if(!Z$(this,E$,"f").has($.data)){let W=this._getOrReturnCtx($),X=this._def.values;return z(W,{received:W.data,code:D.invalid_enum_value,options:X}),b}return v($.data)}get options(){return this._def.values}get enum(){let $={};for(let W of this._def.values)$[W]=W;return $}get Values(){let $={};for(let W of this._def.values)$[W]=W;return $}get Enum(){let $={};for(let W of this._def.values)$[W]=W;return $}extract($,W=this._def){return $$.create($,{...this._def,...W})}exclude($,W=this._def){return $$.create(this.options.filter((X)=>!$.includes(X)),{...this._def,...W})}}E$=new WeakMap;$$.create=a2;class _$ extends q{constructor(){super(...arguments);v$.set(this,void 0)}_parse($){let W=U.getValidEnumValues(this._def.values),X=this._getOrReturnCtx($);if(X.parsedType!==j.string&&X.parsedType!==j.number){let H=U.objectValues(W);return z(X,{expected:U.joinValues(H),received:X.parsedType,code:D.invalid_type}),b}if(!Z$(this,v$,"f"))p2(this,v$,new Set(U.getValidEnumValues(this._def.values)),"f");if(!Z$(this,v$,"f").has($.data)){let H=U.objectValues(W);return z(X,{received:X.data,code:D.invalid_enum_value,options:H}),b}return v($.data)}get enum(){return this._def.values}}v$=new WeakMap;_$.create=($,W)=>{return new _$({values:$,typeName:M.ZodNativeEnum,...O(W)})};class G$ extends q{unwrap(){return this._def.type}_parse($){let{ctx:W}=this._processInputParams($);if(W.parsedType!==j.promise&&W.common.async===!1)return z(W,{code:D.invalid_type,expected:j.promise,received:W.parsedType}),b;let X=W.parsedType===j.promise?W.data:Promise.resolve(W.data);return v(X.then((H)=>{return this._def.type.parseAsync(H,{path:W.path,errorMap:W.common.contextualErrorMap})}))}}G$.create=($,W)=>{return new G$({type:$,typeName:M.ZodPromise,...O(W)})};class x extends q{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===M.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:W,ctx:X}=this._processInputParams($),H=this._def.effect||null,Q={addIssue:(Y)=>{if(z(X,Y),Y.fatal)W.abort();else W.dirty()},get path(){return X.path}};if(Q.addIssue=Q.addIssue.bind(Q),H.type==="preprocess"){let Y=H.transform(X.data,Q);if(X.common.async)return Promise.resolve(Y).then(async(G)=>{if(W.value==="aborted")return b;let w=await this._def.schema._parseAsync({data:G,path:X.path,parent:X});if(w.status==="aborted")return b;if(w.status==="dirty")return H$(w.value);if(W.value==="dirty")return H$(w.value);return w});else{if(W.value==="aborted")return b;let G=this._def.schema._parseSync({data:Y,path:X.path,parent:X});if(G.status==="aborted")return b;if(G.status==="dirty")return H$(G.value);if(W.value==="dirty")return H$(G.value);return G}}if(H.type==="refinement"){let Y=(G)=>{let w=H.refinement(G,Q);if(X.common.async)return Promise.resolve(w);if(w instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(X.common.async===!1){let G=this._def.schema._parseSync({data:X.data,path:X.path,parent:X});if(G.status==="aborted")return b;if(G.status==="dirty")W.dirty();return Y(G.value),{status:W.value,value:G.value}}else return this._def.schema._parseAsync({data:X.data,path:X.path,parent:X}).then((G)=>{if(G.status==="aborted")return b;if(G.status==="dirty")W.dirty();return Y(G.value).then(()=>{return{status:W.value,value:G.value}})})}if(H.type==="transform")if(X.common.async===!1){let Y=this._def.schema._parseSync({data:X.data,path:X.path,parent:X});if(!a(Y))return Y;let G=H.transform(Y.value,Q);if(G instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:W.value,value:G}}else return this._def.schema._parseAsync({data:X.data,path:X.path,parent:X}).then((Y)=>{if(!a(Y))return Y;return Promise.resolve(H.transform(Y.value,Q)).then((G)=>({status:W.value,value:G}))});U.assertNever(H)}}x.create=($,W,X)=>{return new x({schema:$,typeName:M.ZodEffects,effect:W,...O(X)})};x.createWithPreprocess=($,W,X)=>{return new x({schema:W,effect:{type:"preprocess",transform:$},typeName:M.ZodEffects,...O(X)})};class k extends q{_parse($){if(this._getType($)===j.undefined)return v(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}k.create=($,W)=>{return new k({innerType:$,typeName:M.ZodOptional,...O(W)})};class r extends q{_parse($){if(this._getType($)===j.null)return v(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}}r.create=($,W)=>{return new r({innerType:$,typeName:M.ZodNullable,...O(W)})};class q$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X=W.data;if(W.parsedType===j.undefined)X=this._def.defaultValue();return this._def.innerType._parse({data:X,path:W.path,parent:W})}removeDefault(){return this._def.innerType}}q$.create=($,W)=>{return new q$({innerType:$,typeName:M.ZodDefault,defaultValue:typeof W.default==="function"?W.default:()=>W.default,...O(W)})};class U$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X={...W,common:{...W.common,issues:[]}},H=this._def.innerType._parse({data:X.data,path:X.path,parent:{...X}});if(B$(H))return H.then((Q)=>{return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new f(X.common.issues)},input:X.data})}});else return{status:"valid",value:H.status==="valid"?H.value:this._def.catchValue({get error(){return new f(X.common.issues)},input:X.data})}}removeCatch(){return this._def.innerType}}U$.create=($,W)=>{return new U$({innerType:$,typeName:M.ZodCatch,catchValue:typeof W.catch==="function"?W.catch:()=>W.catch,...O(W)})};class P$ extends q{_parse($){if(this._getType($)!==j.nan){let X=this._getOrReturnCtx($);return z(X,{code:D.invalid_type,expected:j.nan,received:X.parsedType}),b}return{status:"valid",value:$.data}}}P$.create=($)=>{return new P$({typeName:M.ZodNaN,...O($)})};var u1=Symbol("zod_brand");class m$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X=W.data;return this._def.type._parse({data:X,path:W.path,parent:W})}unwrap(){return this._def.type}}class C$ extends q{_parse($){let{status:W,ctx:X}=this._processInputParams($);if(X.common.async)return(async()=>{let Q=await this._def.in._parseAsync({data:X.data,path:X.path,parent:X});if(Q.status==="aborted")return b;if(Q.status==="dirty")return W.dirty(),H$(Q.value);else return this._def.out._parseAsync({data:Q.value,path:X.path,parent:X})})();else{let H=this._def.in._parseSync({data:X.data,path:X.path,parent:X});if(H.status==="aborted")return b;if(H.status==="dirty")return W.dirty(),{status:"dirty",value:H.value};else return this._def.out._parseSync({data:H.value,path:X.path,parent:X})}}static create($,W){return new C$({in:$,out:W,typeName:M.ZodPipeline})}}class L$ extends q{_parse($){let W=this._def.innerType._parse($),X=(H)=>{if(a(H))H.value=Object.freeze(H.value);return H};return B$(W)?W.then((H)=>X(H)):X(W)}unwrap(){return this._def.innerType}}L$.create=($,W)=>{return new L$({innerType:$,typeName:M.ZodReadonly,...O(W)})};function c2($,W){let X=typeof $==="function"?$(W):typeof $==="string"?{message:$}:$;return typeof X==="string"?{message:X}:X}function t2($,W={},X){if($)return J$.create().superRefine((H,Q)=>{let Y=$(H);if(Y instanceof Promise)return Y.then((G)=>{if(!G){let w=c2(W,H),B=w.fatal??X??!0;Q.addIssue({code:"custom",...w,fatal:B})}});if(!Y){let G=c2(W,H),w=G.fatal??X??!0;Q.addIssue({code:"custom",...G,fatal:w})}return});return J$.create()}var i1={object:K.lazycreate},M;(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(M||(M={}));var c1=($,W={message:`Input not instance of ${$.name}`})=>t2((X)=>X instanceof $,W),s2=g.create,e2=s.create,p1=P$.create,d1=e.create,$0=j$.create,o1=Q$.create,r1=R$.create,a1=z$.create,t1=V$.create,s1=J$.create,e1=t.create,$W=i.create,WW=f$.create,XW=T.create,HW=K.create,QW=K.strictCreate,JW=A$.create,YW=l$.create,GW=b$.create,wW=c.create,BW=k$.create,DW=I$.create,MW=Y$.create,jW=M$.create,zW=N$.create,VW=O$.create,AW=$$.create,bW=_$.create,NW=G$.create,OW=x.create,_W=k.create,qW=r.create,UW=x.createWithPreprocess,LW=C$.create,KW=()=>s2().optional(),FW=()=>e2().optional(),SW=()=>$0().optional(),EW={string:($)=>g.create({...$,coerce:!0}),number:($)=>s.create({...$,coerce:!0}),boolean:($)=>j$.create({...$,coerce:!0}),bigint:($)=>e.create({...$,coerce:!0}),date:($)=>Q$.create({...$,coerce:!0})};var vW=b;var L2="2025-03-26",W0=[L2,"2024-11-05","2024-10-07"],n$="2.0",X0=J.union([J.string(),J.number().int()]),H0=J.string(),RW=J.object({progressToken:J.optional(X0)}).passthrough(),h=J.object({_meta:J.optional(RW)}).passthrough(),I=J.object({method:J.string(),params:J.optional(h)}),g$=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),p=J.object({method:J.string(),params:J.optional(g$)}),Z=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),u$=J.union([J.string(),J.number().int()]),Q0=J.object({jsonrpc:J.literal(n$),id:u$}).merge(I).strict(),J0=($)=>Q0.safeParse($).success,Y0=J.object({jsonrpc:J.literal(n$)}).merge(p).strict(),G0=($)=>Y0.safeParse($).success,w0=J.object({jsonrpc:J.literal(n$),id:u$,result:Z}).strict(),K2=($)=>w0.safeParse($).success,F;(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(F||(F={}));var B0=J.object({jsonrpc:J.literal(n$),id:u$,error:J.object({code:J.number().int(),message:J.string(),data:J.optional(J.unknown())})}).strict(),D0=($)=>B0.safeParse($).success,M0=J.union([Q0,Y0,w0,B0]),i$=Z.strict(),c$=p.extend({method:J.literal("notifications/cancelled"),params:g$.extend({requestId:u$,reason:J.string().optional()})}),j0=J.object({name:J.string(),version:J.string()}).passthrough(),fW=J.object({experimental:J.optional(J.object({}).passthrough()),sampling:J.optional(J.object({}).passthrough()),roots:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),p$=I.extend({method:J.literal("initialize"),params:h.extend({protocolVersion:J.string(),capabilities:fW,clientInfo:j0})}),W6=($)=>p$.safeParse($).success,kW=J.object({experimental:J.optional(J.object({}).passthrough()),logging:J.optional(J.object({}).passthrough()),completions:J.optional(J.object({}).passthrough()),prompts:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough()),resources:J.optional(J.object({subscribe:J.optional(J.boolean()),listChanged:J.optional(J.boolean())}).passthrough()),tools:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),IW=Z.extend({protocolVersion:J.string(),capabilities:kW,serverInfo:j0,instructions:J.optional(J.string())}),F2=p.extend({method:J.literal("notifications/initialized")});var d$=I.extend({method:J.literal("ping")}),PW=J.object({progress:J.number(),total:J.optional(J.number()),message:J.optional(J.string())}).passthrough(),o$=p.extend({method:J.literal("notifications/progress"),params:g$.merge(PW).extend({progressToken:X0})}),r$=I.extend({params:h.extend({cursor:J.optional(H0)}).optional()}),a$=Z.extend({nextCursor:J.optional(H0)}),z0=J.object({uri:J.string(),mimeType:J.optional(J.string())}).passthrough(),V0=z0.extend({text:J.string()}),A0=z0.extend({blob:J.string().base64()}),CW=J.object({uri:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),gW=J.object({uriTemplate:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),t$=r$.extend({method:J.literal("resources/list")}),TW=a$.extend({resources:J.array(CW)}),s$=r$.extend({method:J.literal("resources/templates/list")}),yW=a$.extend({resourceTemplates:J.array(gW)}),e$=I.extend({method:J.literal("resources/read"),params:h.extend({uri:J.string()})}),xW=Z.extend({contents:J.array(J.union([V0,A0]))}),hW=p.extend({method:J.literal("notifications/resources/list_changed")}),ZW=I.extend({method:J.literal("resources/subscribe"),params:h.extend({uri:J.string()})}),lW=I.extend({method:J.literal("resources/unsubscribe"),params:h.extend({uri:J.string()})}),mW=p.extend({method:J.literal("notifications/resources/updated"),params:g$.extend({uri:J.string()})}),nW=J.object({name:J.string(),description:J.optional(J.string()),required:J.optional(J.boolean())}).passthrough(),uW=J.object({name:J.string(),description:J.optional(J.string()),arguments:J.optional(J.array(nW))}).passthrough(),$2=r$.extend({method:J.literal("prompts/list")}),iW=a$.extend({prompts:J.array(uW)}),W2=I.extend({method:J.literal("prompts/get"),params:h.extend({name:J.string(),arguments:J.optional(J.record(J.string()))})}),X2=J.object({type:J.literal("text"),text:J.string()}).passthrough(),H2=J.object({type:J.literal("image"),data:J.string().base64(),mimeType:J.string()}).passthrough(),Q2=J.object({type:J.literal("audio"),data:J.string().base64(),mimeType:J.string()}).passthrough(),b0=J.object({type:J.literal("resource"),resource:J.union([V0,A0])}).passthrough(),cW=J.object({role:J.enum(["user","assistant"]),content:J.union([X2,H2,Q2,b0])}).passthrough(),pW=Z.extend({description:J.optional(J.string()),messages:J.array(cW)}),dW=p.extend({method:J.literal("notifications/prompts/list_changed")}),oW=J.object({title:J.optional(J.string()),readOnlyHint:J.optional(J.boolean()),destructiveHint:J.optional(J.boolean()),idempotentHint:J.optional(J.boolean()),openWorldHint:J.optional(J.boolean())}).passthrough(),rW=J.object({name:J.string(),description:J.optional(J.string()),inputSchema:J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough(),outputSchema:J.optional(J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough()),annotations:J.optional(oW)}).passthrough(),J2=r$.extend({method:J.literal("tools/list")}),aW=a$.extend({tools:J.array(rW)}),N0=Z.extend({content:J.array(J.union([X2,H2,Q2,b0])).default([]),structuredContent:J.object({}).passthrough().optional(),isError:J.optional(J.boolean())}),X6=N0.or(Z.extend({toolResult:J.unknown()})),Y2=I.extend({method:J.literal("tools/call"),params:h.extend({name:J.string(),arguments:J.optional(J.record(J.unknown()))})}),tW=p.extend({method:J.literal("notifications/tools/list_changed")}),O0=J.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),sW=I.extend({method:J.literal("logging/setLevel"),params:h.extend({level:O0})}),eW=p.extend({method:J.literal("notifications/message"),params:g$.extend({level:O0,logger:J.optional(J.string()),data:J.unknown()})}),$4=J.object({name:J.string().optional()}).passthrough(),W4=J.object({hints:J.optional(J.array($4)),costPriority:J.optional(J.number().min(0).max(1)),speedPriority:J.optional(J.number().min(0).max(1)),intelligencePriority:J.optional(J.number().min(0).max(1))}).passthrough(),X4=J.object({role:J.enum(["user","assistant"]),content:J.union([X2,H2,Q2])}).passthrough(),H4=I.extend({method:J.literal("sampling/createMessage"),params:h.extend({messages:J.array(X4),systemPrompt:J.optional(J.string()),includeContext:J.optional(J.enum(["none","thisServer","allServers"])),temperature:J.optional(J.number()),maxTokens:J.number().int(),stopSequences:J.optional(J.array(J.string())),metadata:J.optional(J.object({}).passthrough()),modelPreferences:J.optional(W4)})}),S2=Z.extend({model:J.string(),stopReason:J.optional(J.enum(["endTurn","stopSequence","maxTokens"]).or(J.string())),role:J.enum(["user","assistant"]),content:J.discriminatedUnion("type",[X2,H2,Q2])}),Q4=J.object({type:J.literal("ref/resource"),uri:J.string()}).passthrough(),J4=J.object({type:J.literal("ref/prompt"),name:J.string()}).passthrough(),G2=I.extend({method:J.literal("completion/complete"),params:h.extend({ref:J.union([J4,Q4]),argument:J.object({name:J.string(),value:J.string()}).passthrough()})}),Y4=Z.extend({completion:J.object({values:J.array(J.string()).max(100),total:J.optional(J.number().int()),hasMore:J.optional(J.boolean())}).passthrough()}),G4=J.object({uri:J.string().startsWith("file://"),name:J.optional(J.string())}).passthrough(),w4=I.extend({method:J.literal("roots/list")}),E2=Z.extend({roots:J.array(G4)}),B4=p.extend({method:J.literal("notifications/roots/list_changed")}),H6=J.union([d$,p$,G2,sW,W2,$2,t$,s$,e$,ZW,lW,Y2,J2]),Q6=J.union([c$,o$,F2,B4]),J6=J.union([i$,S2,E2]),Y6=J.union([d$,H4,w4]),G6=J.union([c$,o$,eW,mW,hW,tW,dW]),w6=J.union([i$,IW,Y4,pW,iW,TW,yW,xW,N0,aW]);class S extends Error{constructor($,W,X){super(`MCP error ${$}: ${W}`);this.code=$,this.data=X,this.name="McpError"}}var D4=60000;class v2{constructor($){this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(c$,(W)=>{let X=this._requestHandlerAbortControllers.get(W.params.requestId);X===null||X===void 0||X.abort(W.params.reason)}),this.setNotificationHandler(o$,(W)=>{this._onprogress(W)}),this.setRequestHandler(d$,(W)=>({}))}_setupTimeout($,W,X,H,Q=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(H,W),startTime:Date.now(),timeout:W,maxTotalTimeout:X,resetTimeoutOnProgress:Q,onTimeout:H})}_resetTimeout($){let W=this._timeoutInfo.get($);if(!W)return!1;let X=Date.now()-W.startTime;if(W.maxTotalTimeout&&X>=W.maxTotalTimeout)throw this._timeoutInfo.delete($),new S(F.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:W.maxTotalTimeout,totalElapsed:X});return clearTimeout(W.timeoutId),W.timeoutId=setTimeout(W.onTimeout,W.timeout),!0}_cleanupTimeout($){let W=this._timeoutInfo.get($);if(W)clearTimeout(W.timeoutId),this._timeoutInfo.delete($)}async connect($){this._transport=$,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=(W)=>{this._onerror(W)},this._transport.onmessage=(W,X)=>{if(K2(W)||D0(W))this._onresponse(W);else if(J0(W))this._onrequest(W,X);else if(G0(W))this._onnotification(W);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(W)}`))},await this._transport.start()}_onclose(){var $;let W=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,($=this.onclose)===null||$===void 0||$.call(this);let X=new S(F.ConnectionClosed,"Connection closed");for(let H of W.values())H(X)}_onerror($){var W;(W=this.onerror)===null||W===void 0||W.call(this,$)}_onnotification($){var W;let X=(W=this._notificationHandlers.get($.method))!==null&&W!==void 0?W:this.fallbackNotificationHandler;if(X===void 0)return;Promise.resolve().then(()=>X($)).catch((H)=>this._onerror(new Error(`Uncaught error in notification handler: ${H}`)))}_onrequest($,W){var X,H,Q,Y;let G=(X=this._requestHandlers.get($.method))!==null&&X!==void 0?X:this.fallbackRequestHandler;if(G===void 0){(H=this._transport)===null||H===void 0||H.send({jsonrpc:"2.0",id:$.id,error:{code:F.MethodNotFound,message:"Method not found"}}).catch((V)=>this._onerror(new Error(`Failed to send an error response: ${V}`)));return}let w=new AbortController;this._requestHandlerAbortControllers.set($.id,w);let B={signal:w.signal,sessionId:(Q=this._transport)===null||Q===void 0?void 0:Q.sessionId,_meta:(Y=$.params)===null||Y===void 0?void 0:Y._meta,sendNotification:(V)=>this.notification(V,{relatedRequestId:$.id}),sendRequest:(V,_,P)=>this.request(V,_,{...P,relatedRequestId:$.id}),authInfo:W===null||W===void 0?void 0:W.authInfo,requestId:$.id};Promise.resolve().then(()=>G($,B)).then((V)=>{var _;if(w.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({result:V,jsonrpc:"2.0",id:$.id})},(V)=>{var _,P;if(w.signal.aborted)return;return(_=this._transport)===null||_===void 0?void 0:_.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(V.code)?V.code:F.InternalError,message:(P=V.message)!==null&&P!==void 0?P:"Internal error"}})}).catch((V)=>this._onerror(new Error(`Failed to send response: ${V}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:W,...X}=$.params,H=Number(W),Q=this._progressHandlers.get(H);if(!Q){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let Y=this._responseHandlers.get(H),G=this._timeoutInfo.get(H);if(G&&Y&&G.resetTimeoutOnProgress)try{this._resetTimeout(H)}catch(w){Y(w);return}Q(X)}_onresponse($){let W=Number($.id),X=this._responseHandlers.get(W);if(X===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}if(this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),K2($))X($);else{let H=new S($.error.code,$.error.message,$.error.data);X(H)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,W,X){let{relatedRequestId:H,resumptionToken:Q,onresumptiontoken:Y}=X!==null&&X!==void 0?X:{};return new Promise((G,w)=>{var B,V,_,P,W$,b2;if(!this._transport){w(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(V=X===null||X===void 0?void 0:X.signal)===null||V===void 0||V.throwIfAborted();let n=this._requestMessageId++,l2={...$,jsonrpc:"2.0",id:n};if(X===null||X===void 0?void 0:X.onprogress)this._progressHandlers.set(n,X.onprogress),l2.params={...$.params,_meta:{...((_=$.params)===null||_===void 0?void 0:_._meta)||{},progressToken:n}};let m2=(C)=>{var X$;this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),(X$=this._transport)===null||X$===void 0||X$.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:n,reason:String(C)}},{relatedRequestId:H,resumptionToken:Q,onresumptiontoken:Y}).catch((F$)=>this._onerror(new Error(`Failed to send cancellation: ${F$}`))),w(C)};this._responseHandlers.set(n,(C)=>{var X$;if((X$=X===null||X===void 0?void 0:X.signal)===null||X$===void 0?void 0:X$.aborted)return;if(C instanceof Error)return w(C);try{let F$=W.parse(C.result);G(F$)}catch(F$){w(F$)}}),(P=X===null||X===void 0?void 0:X.signal)===null||P===void 0||P.addEventListener("abort",()=>{var C;m2((C=X===null||X===void 0?void 0:X.signal)===null||C===void 0?void 0:C.reason)});let n2=(W$=X===null||X===void 0?void 0:X.timeout)!==null&&W$!==void 0?W$:D4,j1=()=>m2(new S(F.RequestTimeout,"Request timed out",{timeout:n2}));this._setupTimeout(n,n2,X===null||X===void 0?void 0:X.maxTotalTimeout,j1,(b2=X===null||X===void 0?void 0:X.resetTimeoutOnProgress)!==null&&b2!==void 0?b2:!1),this._transport.send(l2,{relatedRequestId:H,resumptionToken:Q,onresumptiontoken:Y}).catch((C)=>{this._cleanupTimeout(n),w(C)})})}async notification($,W){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability($.method);let X={...$,jsonrpc:"2.0"};await this._transport.send(X,W)}setRequestHandler($,W){let X=$.shape.method.value;this.assertRequestHandlerCapability(X),this._requestHandlers.set(X,(H,Q)=>{return Promise.resolve(W($.parse(H),Q))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw new Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,W){this._notificationHandlers.set($.shape.method.value,(X)=>Promise.resolve(W($.parse(X))))}removeNotificationHandler($){this._notificationHandlers.delete($)}}function _0($,W){return Object.entries(W).reduce((X,[H,Q])=>{if(Q&&typeof Q==="object")X[H]=X[H]?{...X[H],...Q}:Q;else X[H]=Q;return X},{...$})}class R2 extends v2{constructor($,W){var X;super(W);this._serverInfo=$,this._capabilities=(X=W===null||W===void 0?void 0:W.capabilities)!==null&&X!==void 0?X:{},this._instructions=W===null||W===void 0?void 0:W.instructions,this.setRequestHandler(p$,(H)=>this._oninitialize(H)),this.setNotificationHandler(F2,()=>{var H;return(H=this.oninitialized)===null||H===void 0?void 0:H.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=_0(this._capabilities,$)}assertCapabilityForMethod($){var W,X;switch($){case"sampling/createMessage":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.sampling))throw new Error(`Client does not support sampling (required for ${$})`);break;case"roots/list":if(!((X=this._clientCapabilities)===null||X===void 0?void 0:X.roots))throw new Error(`Client does not support listing roots (required for ${$})`);break;case"ping":break}}assertNotificationCapability($){switch($){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${$})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${$})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${$})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability($){switch($){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${$})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${$})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${$})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${$})`);break;case"ping":case"initialize":break}}async _oninitialize($){let W=$.params.protocolVersion;return this._clientCapabilities=$.params.capabilities,this._clientVersion=$.params.clientInfo,{protocolVersion:W0.includes(W)?W:L2,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},i$)}async createMessage($,W){return this.request({method:"sampling/createMessage",params:$},S2,W)}async listRoots($,W){return this.request({method:"roots/list",params:$},E2,W)}async sendLoggingMessage($){return this.notification({method:"notifications/message",params:$})}async sendResourceUpdated($){return this.notification({method:"notifications/resources/updated",params:$})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var U0=Symbol("Let zodToJsonSchema decide on which parser to use");var q0={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},L0=($)=>typeof $==="string"?{...q0,name:$}:{...q0,...$};var K0=($)=>{let W=L0($),X=W.name!==void 0?[...W.basePath,W.definitionPath,W.name]:W.basePath;return{...W,currentPath:X,propertyPath:void 0,seen:new Map(Object.entries(W.definitions).map(([H,Q])=>[Q._def,{def:Q._def,path:[...W.basePath,W.definitionPath,H],jsonSchema:void 0}]))}};function f2($,W,X,H){if(!H?.errorMessages)return;if(X)$.errorMessage={...$.errorMessage,[W]:X}}function L($,W,X,H,Q){$[W]=X,f2($,W,H,Q)}function F0(){return{}}function S0($,W){let X={type:"array"};if($.type?._def&&$.type?._def?.typeName!==M.ZodAny)X.items=N($.type._def,{...W,currentPath:[...W.currentPath,"items"]});if($.minLength)L(X,"minItems",$.minLength.value,$.minLength.message,W);if($.maxLength)L(X,"maxItems",$.maxLength.value,$.maxLength.message,W);if($.exactLength)L(X,"minItems",$.exactLength.value,$.exactLength.message,W),L(X,"maxItems",$.exactLength.value,$.exactLength.message,W);return X}function E0($,W){let X={type:"integer",format:"int64"};if(!$.checks)return X;for(let H of $.checks)switch(H.kind){case"min":if(W.target==="jsonSchema7")if(H.inclusive)L(X,"minimum",H.value,H.message,W);else L(X,"exclusiveMinimum",H.value,H.message,W);else{if(!H.inclusive)X.exclusiveMinimum=!0;L(X,"minimum",H.value,H.message,W)}break;case"max":if(W.target==="jsonSchema7")if(H.inclusive)L(X,"maximum",H.value,H.message,W);else L(X,"exclusiveMaximum",H.value,H.message,W);else{if(!H.inclusive)X.exclusiveMaximum=!0;L(X,"maximum",H.value,H.message,W)}break;case"multipleOf":L(X,"multipleOf",H.value,H.message,W);break}return X}function v0(){return{type:"boolean"}}function w2($,W){return N($.type._def,W)}var R0=($,W)=>{return N($.innerType._def,W)};function k2($,W,X){let H=X??W.dateStrategy;if(Array.isArray(H))return{anyOf:H.map((Q,Y)=>k2($,W,Q))};switch(H){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return M4($,W)}}var M4=($,W)=>{let X={type:"integer",format:"unix-time"};if(W.target==="openApi3")return X;for(let H of $.checks)switch(H.kind){case"min":L(X,"minimum",H.value,H.message,W);break;case"max":L(X,"maximum",H.value,H.message,W);break}return X};function f0($,W){return{...N($.innerType._def,W),default:$.defaultValue()}}function k0($,W){return W.effectStrategy==="input"?N($.schema._def,W):{}}function I0($){return{type:"string",enum:Array.from($.values)}}var j4=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function P0($,W){let X=[N($.left._def,{...W,currentPath:[...W.currentPath,"allOf","0"]}),N($.right._def,{...W,currentPath:[...W.currentPath,"allOf","1"]})].filter((Y)=>!!Y),H=W.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,Q=[];return X.forEach((Y)=>{if(j4(Y)){if(Q.push(...Y.allOf),Y.unevaluatedProperties===void 0)H=void 0}else{let G=Y;if("additionalProperties"in Y&&Y.additionalProperties===!1){let{additionalProperties:w,...B}=Y;G=B}else H=void 0;Q.push(G)}}),Q.length?{allOf:Q,...H}:void 0}function C0($,W){let X=typeof $.value;if(X!=="bigint"&&X!=="number"&&X!=="boolean"&&X!=="string")return{type:Array.isArray($.value)?"array":"object"};if(W.target==="openApi3")return{type:X==="bigint"?"integer":X,enum:[$.value]};return{type:X==="bigint"?"integer":X,const:$.value}}var I2=void 0,l={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>{if(I2===void 0)I2=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return I2},uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function B2($,W){let X={type:"string"};if($.checks)for(let H of $.checks)switch(H.kind){case"min":L(X,"minLength",typeof X.minLength==="number"?Math.max(X.minLength,H.value):H.value,H.message,W);break;case"max":L(X,"maxLength",typeof X.maxLength==="number"?Math.min(X.maxLength,H.value):H.value,H.message,W);break;case"email":switch(W.emailStrategy){case"format:email":m(X,"email",H.message,W);break;case"format:idn-email":m(X,"idn-email",H.message,W);break;case"pattern:zod":R(X,l.email,H.message,W);break}break;case"url":m(X,"uri",H.message,W);break;case"uuid":m(X,"uuid",H.message,W);break;case"regex":R(X,H.regex,H.message,W);break;case"cuid":R(X,l.cuid,H.message,W);break;case"cuid2":R(X,l.cuid2,H.message,W);break;case"startsWith":R(X,RegExp(`^${P2(H.value,W)}`),H.message,W);break;case"endsWith":R(X,RegExp(`${P2(H.value,W)}$`),H.message,W);break;case"datetime":m(X,"date-time",H.message,W);break;case"date":m(X,"date",H.message,W);break;case"time":m(X,"time",H.message,W);break;case"duration":m(X,"duration",H.message,W);break;case"length":L(X,"minLength",typeof X.minLength==="number"?Math.max(X.minLength,H.value):H.value,H.message,W),L(X,"maxLength",typeof X.maxLength==="number"?Math.min(X.maxLength,H.value):H.value,H.message,W);break;case"includes":{R(X,RegExp(P2(H.value,W)),H.message,W);break}case"ip":{if(H.version!=="v6")m(X,"ipv4",H.message,W);if(H.version!=="v4")m(X,"ipv6",H.message,W);break}case"base64url":R(X,l.base64url,H.message,W);break;case"jwt":R(X,l.jwt,H.message,W);break;case"cidr":{if(H.version!=="v6")R(X,l.ipv4Cidr,H.message,W);if(H.version!=="v4")R(X,l.ipv6Cidr,H.message,W);break}case"emoji":R(X,l.emoji(),H.message,W);break;case"ulid":{R(X,l.ulid,H.message,W);break}case"base64":{switch(W.base64Strategy){case"format:binary":{m(X,"binary",H.message,W);break}case"contentEncoding:base64":{L(X,"contentEncoding","base64",H.message,W);break}case"pattern:zod":{R(X,l.base64,H.message,W);break}}break}case"nanoid":R(X,l.nanoid,H.message,W);case"toLowerCase":case"toUpperCase":case"trim":break;default:((Q)=>{})(H)}return X}function P2($,W){return W.patternStrategy==="escape"?V4($):$}var z4=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function V4($){let W="";for(let X=0;X<$.length;X++){if(!z4.has($[X]))W+="\\";W+=$[X]}return W}function m($,W,X,H){if($.format||$.anyOf?.some((Q)=>Q.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&H.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:W,...X&&H.errorMessages&&{errorMessage:{format:X}}})}else L($,"format",W,X,H)}function R($,W,X,H){if($.pattern||$.allOf?.some((Q)=>Q.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&H.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:g0(W,H),...X&&H.errorMessages&&{errorMessage:{pattern:X}}})}else L($,"pattern",g0(W,H),X,H)}function g0($,W){if(!W.applyRegexFlags||!$.flags)return $.source;let X={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},H=X.i?$.source.toLowerCase():$.source,Q="",Y=!1,G=!1,w=!1;for(let B=0;B<H.length;B++){if(Y){Q+=H[B],Y=!1;continue}if(X.i){if(G){if(H[B].match(/[a-z]/)){if(w)Q+=H[B],Q+=`${H[B-2]}-${H[B]}`.toUpperCase(),w=!1;else if(H[B+1]==="-"&&H[B+2]?.match(/[a-z]/))Q+=H[B],w=!0;else Q+=`${H[B]}${H[B].toUpperCase()}`;continue}}else if(H[B].match(/[a-z]/)){Q+=`[${H[B]}${H[B].toUpperCase()}]`;continue}}if(X.m){if(H[B]==="^"){Q+=`(^|(?<=[\r
3
3
  ]))`;continue}else if(H[B]==="$"){Q+=`($|(?=[\r
4
4
  ]))`;continue}}if(X.s&&H[B]==="."){Q+=G?`${H[B]}\r
5
5
  `:`[${H[B]}\r
6
- ]`;continue}if(Q+=H[B],H[B]==="\\")Y=!0;else if(G&&H[B]==="]")G=!1;else if(!G&&H[B]==="[")G=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${W.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),$.source}return Q}function D2($,W){if(W.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(W.target==="openApi3"&&$.keyType?._def.typeName===M.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((H,Q)=>({...H,[Q]:N($.valueType._def,{...W,currentPath:[...W.currentPath,"properties",Q]})??{}}),{}),additionalProperties:W.rejectedAdditionalProperties};let X={type:"object",additionalProperties:N($.valueType._def,{...W,currentPath:[...W.currentPath,"additionalProperties"]})??W.allowedAdditionalProperties};if(W.target==="openApi3")return X;if($.keyType?._def.typeName===M.ZodString&&$.keyType._def.checks?.length){let{type:H,...Q}=B2($.keyType._def,W);return{...X,propertyNames:Q}}else if($.keyType?._def.typeName===M.ZodEnum)return{...X,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===M.ZodBranded&&$.keyType._def.type._def.typeName===M.ZodString&&$.keyType._def.type._def.checks?.length){let{type:H,...Q}=w2($.keyType._def,W);return{...X,propertyNames:Q}}return X}function T0($,W){if(W.mapStrategy==="record")return D2($,W);let X=N($.keyType._def,{...W,currentPath:[...W.currentPath,"items","items","0"]})||{},H=N($.valueType._def,{...W,currentPath:[...W.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[X,H],minItems:2,maxItems:2}}}function y0($){let W=$.values,H=Object.keys($.values).filter((Y)=>{return typeof W[W[Y]]!=="number"}).map((Y)=>W[Y]),Q=Array.from(new Set(H.map((Y)=>typeof Y)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:H}}function x0(){return{not:{}}}function h0($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var T$={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function l0($,W){if(W.target==="openApi3")return Z0($,W);let X=$.options instanceof Map?Array.from($.options.values()):$.options;if(X.every((H)=>(H._def.typeName in T$)&&(!H._def.checks||!H._def.checks.length))){let H=X.reduce((Q,Y)=>{let G=T$[Y._def.typeName];return G&&!Q.includes(G)?[...Q,G]:Q},[]);return{type:H.length>1?H:H[0]}}else if(X.every((H)=>H._def.typeName==="ZodLiteral"&&!H.description)){let H=X.reduce((Q,Y)=>{let G=typeof Y._def.value;switch(G){case"string":case"number":case"boolean":return[...Q,G];case"bigint":return[...Q,"integer"];case"object":if(Y._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(H.length===X.length){let Q=H.filter((Y,G,w)=>w.indexOf(Y)===G);return{type:Q.length>1?Q:Q[0],enum:X.reduce((Y,G)=>{return Y.includes(G._def.value)?Y:[...Y,G._def.value]},[])}}}else if(X.every((H)=>H._def.typeName==="ZodEnum"))return{type:"string",enum:X.reduce((H,Q)=>[...H,...Q._def.values.filter((Y)=>!H.includes(Y))],[])};return Z0($,W)}var Z0=($,W)=>{let X=($.options instanceof Map?Array.from($.options.values()):$.options).map((H,Q)=>N(H._def,{...W,currentPath:[...W.currentPath,"anyOf",`${Q}`]})).filter((H)=>!!H&&(!W.strictUnions||typeof H==="object"&&Object.keys(H).length>0));return X.length?{anyOf:X}:void 0};function m0($,W){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(W.target==="openApi3")return{type:T$[$.innerType._def.typeName],nullable:!0};return{type:[T$[$.innerType._def.typeName],"null"]}}if(W.target==="openApi3"){let H=N($.innerType._def,{...W,currentPath:[...W.currentPath]});if(H&&"$ref"in H)return{allOf:[H],nullable:!0};return H&&{...H,nullable:!0}}let X=N($.innerType._def,{...W,currentPath:[...W.currentPath,"anyOf","0"]});return X&&{anyOf:[X,{type:"null"}]}}function n0($,W){let X={type:"number"};if(!$.checks)return X;for(let H of $.checks)switch(H.kind){case"int":X.type="integer",f2(X,"type",H.message,W);break;case"min":if(W.target==="jsonSchema7")if(H.inclusive)L(X,"minimum",H.value,H.message,W);else L(X,"exclusiveMinimum",H.value,H.message,W);else{if(!H.inclusive)X.exclusiveMinimum=!0;L(X,"minimum",H.value,H.message,W)}break;case"max":if(W.target==="jsonSchema7")if(H.inclusive)L(X,"maximum",H.value,H.message,W);else L(X,"exclusiveMaximum",H.value,H.message,W);else{if(!H.inclusive)X.exclusiveMaximum=!0;L(X,"maximum",H.value,H.message,W)}break;case"multipleOf":L(X,"multipleOf",H.value,H.message,W);break}return X}function u0($,W){let X=W.target==="openAi",H={type:"object",properties:{}},Q=[],Y=$.shape();for(let w in Y){let B=Y[w];if(B===void 0||B._def===void 0)continue;let A=V4(B);if(A&&X){if(B instanceof k)B=B._def.innerType;if(!B.isNullable())B=B.nullable();A=!1}let _=N(B._def,{...W,currentPath:[...W.currentPath,"properties",w],propertyPath:[...W.currentPath,"properties",w]});if(_===void 0)continue;if(H.properties[w]=_,!A)Q.push(w)}if(Q.length)H.required=Q;let G=A4($,W);if(G!==void 0)H.additionalProperties=G;return H}function A4($,W){if($.catchall._def.typeName!=="ZodNever")return N($.catchall._def,{...W,currentPath:[...W.currentPath,"additionalProperties"]});switch($.unknownKeys){case"passthrough":return W.allowedAdditionalProperties;case"strict":return W.rejectedAdditionalProperties;case"strip":return W.removeAdditionalStrategy==="strict"?W.allowedAdditionalProperties:W.rejectedAdditionalProperties}}function V4($){try{return $.isOptional()}catch{return!0}}var i0=($,W)=>{if(W.currentPath.toString()===W.propertyPath?.toString())return N($.innerType._def,W);let X=N($.innerType._def,{...W,currentPath:[...W.currentPath,"anyOf","1"]});return X?{anyOf:[{not:{}},X]}:{}};var c0=($,W)=>{if(W.pipeStrategy==="input")return N($.in._def,W);else if(W.pipeStrategy==="output")return N($.out._def,W);let X=N($.in._def,{...W,currentPath:[...W.currentPath,"allOf","0"]}),H=N($.out._def,{...W,currentPath:[...W.currentPath,"allOf",X?"1":"0"]});return{allOf:[X,H].filter((Q)=>Q!==void 0)}};function p0($,W){return N($.type._def,W)}function d0($,W){let H={type:"array",uniqueItems:!0,items:N($.valueType._def,{...W,currentPath:[...W.currentPath,"items"]})};if($.minSize)L(H,"minItems",$.minSize.value,$.minSize.message,W);if($.maxSize)L(H,"maxItems",$.maxSize.value,$.maxSize.message,W);return H}function o0($,W){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((X,H)=>N(X._def,{...W,currentPath:[...W.currentPath,"items",`${H}`]})).reduce((X,H)=>H===void 0?X:[...X,H],[]),additionalItems:N($.rest._def,{...W,currentPath:[...W.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((X,H)=>N(X._def,{...W,currentPath:[...W.currentPath,"items",`${H}`]})).reduce((X,H)=>H===void 0?X:[...X,H],[])}}function r0(){return{not:{}}}function a0(){return{}}var t0=($,W)=>{return N($.innerType._def,W)};var s0=($,W,X)=>{switch(W){case M.ZodString:return B2($,X);case M.ZodNumber:return n0($,X);case M.ZodObject:return u0($,X);case M.ZodBigInt:return E0($,X);case M.ZodBoolean:return v0();case M.ZodDate:return k2($,X);case M.ZodUndefined:return r0();case M.ZodNull:return h0(X);case M.ZodArray:return S0($,X);case M.ZodUnion:case M.ZodDiscriminatedUnion:return l0($,X);case M.ZodIntersection:return P0($,X);case M.ZodTuple:return o0($,X);case M.ZodRecord:return D2($,X);case M.ZodLiteral:return C0($,X);case M.ZodEnum:return I0($);case M.ZodNativeEnum:return y0($);case M.ZodNullable:return m0($,X);case M.ZodOptional:return i0($,X);case M.ZodMap:return T0($,X);case M.ZodSet:return d0($,X);case M.ZodLazy:return()=>$.getter()._def;case M.ZodPromise:return p0($,X);case M.ZodNaN:case M.ZodNever:return x0();case M.ZodEffects:return k0($,X);case M.ZodAny:return F0();case M.ZodUnknown:return a0();case M.ZodDefault:return f0($,X);case M.ZodBranded:return w2($,X);case M.ZodReadonly:return t0($,X);case M.ZodCatch:return R0($,X);case M.ZodPipeline:return c0($,X);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return((H)=>{return})(W)}};function N($,W,X=!1){let H=W.seen.get($);if(W.override){let w=W.override?.($,W,H,X);if(w!==U0)return w}if(H&&!X){let w=b4(H,W);if(w!==void 0)return w}let Q={def:$,path:W.currentPath,jsonSchema:void 0};W.seen.set($,Q);let Y=s0($,$.typeName,W),G=typeof Y==="function"?N(Y(),W):Y;if(G)O4($,W,G);if(W.postProcess){let w=W.postProcess(G,$,W);return Q.jsonSchema=G,w}return Q.jsonSchema=G,G}var b4=($,W)=>{switch(W.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:N4(W.currentPath,$.path)};case"none":case"seen":{if($.path.length<W.currentPath.length&&$.path.every((X,H)=>W.currentPath[H]===X))return console.warn(`Recursive reference detected at ${W.currentPath.join("/")}! Defaulting to any`),{};return W.$refStrategy==="seen"?{}:void 0}}},N4=($,W)=>{let X=0;for(;X<$.length&&X<W.length;X++)if($[X]!==W[X])break;return[($.length-X).toString(),...W.slice(X)].join("/")},O4=($,W,X)=>{if($.description){if(X.description=$.description,W.markdownDescription)X.markdownDescription=$.description}return X};var M2=($,W)=>{let X=K0(W),H=typeof W==="object"&&W.definitions?Object.entries(W.definitions).reduce((B,[A,_])=>({...B,[A]:N(_._def,{...X,currentPath:[...X.basePath,X.definitionPath,A]},!0)??{}}),{}):void 0,Q=typeof W==="string"?W:W?.nameStrategy==="title"?void 0:W?.name,Y=N($._def,Q===void 0?X:{...X,currentPath:[...X.basePath,X.definitionPath,Q]},!1)??{},G=typeof W==="object"&&W.name!==void 0&&W.nameStrategy==="title"?W.name:void 0;if(G!==void 0)Y.title=G;let w=Q===void 0?H?{...Y,[X.definitionPath]:H}:Y:{$ref:[...X.$refStrategy==="relative"?[]:X.basePath,X.definitionPath,Q].join("/"),[X.definitionPath]:{...H,[Q]:Y}};if(X.target==="jsonSchema7")w.$schema="http://json-schema.org/draft-07/schema#";else if(X.target==="jsonSchema2019-09"||X.target==="openAi")w.$schema="https://json-schema.org/draft/2019-09/schema#";if(X.target==="openAi"&&(("anyOf"in w)||("oneOf"in w)||("allOf"in w)||("type"in w)&&Array.isArray(w.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return w};var C2;(function($){$.Completable="McpCompletable"})(C2||(C2={}));class y$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X=W.data;return this._def.type._parse({data:X,path:W.path,parent:W})}unwrap(){return this._def.type}}y$.create=($,W)=>{return new y$({type:$,typeName:C2.Completable,complete:W.complete,..._4(W)})};function _4($){if(!$)return{};let{errorMap:W,invalid_type_error:X,required_error:H,description:Q}=$;if(W&&(X||H))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(W)return{errorMap:W,description:Q};return{errorMap:(G,w)=>{var B,A;let{message:_}=$;if(G.code==="invalid_enum_value")return{message:_!==null&&_!==void 0?_:w.defaultError};if(typeof w.data==="undefined")return{message:(B=_!==null&&_!==void 0?_:H)!==null&&B!==void 0?B:w.defaultError};if(G.code!=="invalid_type")return{message:w.defaultError};return{message:(A=_!==null&&_!==void 0?_:X)!==null&&A!==void 0?A:w.defaultError}},description:Q}}class g2{constructor($,W){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new R2($,W)}async connect($){return await this.server.connect($)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(J2.shape.method.value),this.server.assertCanSetRequestHandler(Y2.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(J2,()=>({tools:Object.entries(this._registeredTools).filter(([,$])=>$.enabled).map(([$,W])=>{let X={name:$,description:W.description,inputSchema:W.inputSchema?M2(W.inputSchema,{strictUnions:!0}):q4,annotations:W.annotations};if(W.outputSchema)X.outputSchema=M2(W.outputSchema,{strictUnions:!0});return X})})),this.server.setRequestHandler(Y2,async($,W)=>{let X=this._registeredTools[$.params.name];if(!X)throw new S(F.InvalidParams,`Tool ${$.params.name} not found`);if(!X.enabled)throw new S(F.InvalidParams,`Tool ${$.params.name} disabled`);let H;if(X.inputSchema){let Q=await X.inputSchema.safeParseAsync($.params.arguments);if(!Q.success)throw new S(F.InvalidParams,`Invalid arguments for tool ${$.params.name}: ${Q.error.message}`);let Y=Q.data,G=X.callback;try{H=await Promise.resolve(G(Y,W))}catch(w){H={content:[{type:"text",text:w instanceof Error?w.message:String(w)}],isError:!0}}}else{let Q=X.callback;try{H=await Promise.resolve(Q(W))}catch(Y){H={content:[{type:"text",text:Y instanceof Error?Y.message:String(Y)}],isError:!0}}}if(X.outputSchema){if(!H.structuredContent)throw new S(F.InvalidParams,`Tool ${$.params.name} has an output schema but no structured content was provided`);let Q=await X.outputSchema.safeParseAsync(H.structuredContent);if(!Q.success)throw new S(F.InvalidParams,`Invalid structured content for tool ${$.params.name}: ${Q.error.message}`)}return H}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(G2.shape.method.value),this.server.setRequestHandler(G2,async($)=>{switch($.params.ref.type){case"ref/prompt":return this.handlePromptCompletion($,$.params.ref);case"ref/resource":return this.handleResourceCompletion($,$.params.ref);default:throw new S(F.InvalidParams,`Invalid completion reference: ${$.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion($,W){let X=this._registeredPrompts[W.name];if(!X)throw new S(F.InvalidParams,`Prompt ${W.name} not found`);if(!X.enabled)throw new S(F.InvalidParams,`Prompt ${W.name} disabled`);if(!X.argsSchema)return j2;let H=X.argsSchema.shape[$.params.argument.name];if(!(H instanceof y$))return j2;let Y=await H._def.complete($.params.argument.value);return $1(Y)}async handleResourceCompletion($,W){let X=Object.values(this._registeredResourceTemplates).find((Y)=>Y.resourceTemplate.uriTemplate.toString()===W.uri);if(!X){if(this._registeredResources[W.uri])return j2;throw new S(F.InvalidParams,`Resource template ${$.params.ref.uri} not found`)}let H=X.resourceTemplate.completeCallback($.params.argument.name);if(!H)return j2;let Q=await H($.params.argument.value);return $1(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(t$.shape.method.value),this.server.assertCanSetRequestHandler(s$.shape.method.value),this.server.assertCanSetRequestHandler(e$.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(t$,async($,W)=>{let X=Object.entries(this._registeredResources).filter(([Q,Y])=>Y.enabled).map(([Q,Y])=>({uri:Q,name:Y.name,...Y.metadata})),H=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let Y=await Q.resourceTemplate.listCallback(W);for(let G of Y.resources)H.push({...G,...Q.metadata})}return{resources:[...X,...H]}}),this.server.setRequestHandler(s$,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([W,X])=>({name:W,uriTemplate:X.resourceTemplate.uriTemplate.toString(),...X.metadata}))}}),this.server.setRequestHandler(e$,async($,W)=>{let X=new URL($.params.uri),H=this._registeredResources[X.toString()];if(H){if(!H.enabled)throw new S(F.InvalidParams,`Resource ${X} disabled`);return H.readCallback(X,W)}for(let Q of Object.values(this._registeredResourceTemplates)){let Y=Q.resourceTemplate.uriTemplate.match(X.toString());if(Y)return Q.readCallback(X,Y,W)}throw new S(F.InvalidParams,`Resource ${X} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler($2.shape.method.value),this.server.assertCanSetRequestHandler(W2.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler($2,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,$])=>$.enabled).map(([$,W])=>{return{name:$,description:W.description,arguments:W.argsSchema?L4(W.argsSchema):void 0}})})),this.server.setRequestHandler(W2,async($,W)=>{let X=this._registeredPrompts[$.params.name];if(!X)throw new S(F.InvalidParams,`Prompt ${$.params.name} not found`);if(!X.enabled)throw new S(F.InvalidParams,`Prompt ${$.params.name} disabled`);if(X.argsSchema){let H=await X.argsSchema.safeParseAsync($.params.arguments);if(!H.success)throw new S(F.InvalidParams,`Invalid arguments for prompt ${$.params.name}: ${H.error.message}`);let Q=H.data,Y=X.callback;return await Promise.resolve(Y(Q,W))}else{let H=X.callback;return await Promise.resolve(H(W))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource($,W,...X){let H;if(typeof X[0]==="object")H=X.shift();let Q=X[0];if(typeof W==="string"){if(this._registeredResources[W])throw new Error(`Resource ${W} is already registered`);let Y={name:$,metadata:H,readCallback:Q,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({uri:null}),update:(G)=>{if(typeof G.uri!=="undefined"&&G.uri!==W){if(delete this._registeredResources[W],G.uri)this._registeredResources[G.uri]=Y}if(typeof G.name!=="undefined")Y.name=G.name;if(typeof G.metadata!=="undefined")Y.metadata=G.metadata;if(typeof G.callback!=="undefined")Y.readCallback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=Y,this.setResourceRequestHandlers(),this.sendResourceListChanged(),Y}else{if(this._registeredResourceTemplates[$])throw new Error(`Resource template ${$} is already registered`);let Y={resourceTemplate:W,metadata:H,readCallback:Q,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(G)=>{if(typeof G.name!=="undefined"&&G.name!==$){if(delete this._registeredResourceTemplates[$],G.name)this._registeredResourceTemplates[G.name]=Y}if(typeof G.template!=="undefined")Y.resourceTemplate=G.template;if(typeof G.metadata!=="undefined")Y.metadata=G.metadata;if(typeof G.callback!=="undefined")Y.readCallback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[$]=Y,this.setResourceRequestHandlers(),this.sendResourceListChanged(),Y}}_createRegisteredTool($,W,X,H,Q,Y){let G={description:W,inputSchema:X===void 0?void 0:J.object(X),outputSchema:H===void 0?void 0:J.object(H),annotations:Q,callback:Y,enabled:!0,disable:()=>G.update({enabled:!1}),enable:()=>G.update({enabled:!0}),remove:()=>G.update({name:null}),update:(w)=>{if(typeof w.name!=="undefined"&&w.name!==$){if(delete this._registeredTools[$],w.name)this._registeredTools[w.name]=G}if(typeof w.description!=="undefined")G.description=w.description;if(typeof w.paramsSchema!=="undefined")G.inputSchema=J.object(w.paramsSchema);if(typeof w.callback!=="undefined")G.callback=w.callback;if(typeof w.annotations!=="undefined")G.annotations=w.annotations;if(typeof w.enabled!=="undefined")G.enabled=w.enabled;this.sendToolListChanged()}};return this._registeredTools[$]=G,this.setToolRequestHandlers(),this.sendToolListChanged(),G}tool($,...W){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let X,H,Q,Y;if(typeof W[0]==="string")X=W.shift();if(W.length>1){let w=W[0];if(e0(w)){if(H=W.shift(),W.length>1&&typeof W[0]==="object"&&W[0]!==null&&!e0(W[0]))Y=W.shift()}else if(typeof w==="object"&&w!==null)Y=W.shift()}let G=W[0];return this._createRegisteredTool($,X,H,Q,Y,G)}registerTool($,W,X){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let{description:H,inputSchema:Q,outputSchema:Y,annotations:G}=W;return this._createRegisteredTool($,H,Q,Y,G,X)}prompt($,...W){if(this._registeredPrompts[$])throw new Error(`Prompt ${$} is already registered`);let X;if(typeof W[0]==="string")X=W.shift();let H;if(W.length>1)H=W.shift();let Q=W[0],Y={description:X,argsSchema:H===void 0?void 0:J.object(H),callback:Q,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(G)=>{if(typeof G.name!=="undefined"&&G.name!==$){if(delete this._registeredPrompts[$],G.name)this._registeredPrompts[G.name]=Y}if(typeof G.description!=="undefined")Y.description=G.description;if(typeof G.argsSchema!=="undefined")Y.argsSchema=J.object(G.argsSchema);if(typeof G.callback!=="undefined")Y.callback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[$]=Y,this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var q4={type:"object"};function e0($){if(typeof $!=="object"||$===null)return!1;return Object.keys($).length===0||Object.values($).some(U4)}function U4($){return $!==null&&typeof $==="object"&&"parse"in $&&typeof $.parse==="function"&&"safeParse"in $&&typeof $.safeParse==="function"}function L4($){return Object.entries($.shape).map(([W,X])=>({name:W,description:X.description,required:!X.isOptional()}))}function $1($){return{completion:{values:$.slice(0,100),total:$.length,hasMore:$.length>100}}}var j2={completion:{values:[],hasMore:!1}};var z2=process.env.personalToken||process.env.FIGMA_API_KEY||"",W1="F2C MCP",X1=process.env.FIGMA_VERSION||"0.0.1";class H1{f2cHost="https://f2c-figma-api.yy.com/api";personalToken=z2;async nodeToCode($){let W={fileKey:$.fileKey,nodeIds:$.ids,personal_token:$.personalToken||this.personalToken,option:{cssFramework:"inlinecss",imgFormat:$.imgFormat||"png",scaleSize:$.scaleSize||2},format:"files"};if($.format==="react-cssmodules")W.option.cssFramework="cssmodules";else if($.format==="react-tailwind")W.option.cssFramework="tailwindcss";let X=this.opToUrl(`${this.f2cHost}/nodes`,W);return this.fetch(X,"json")}async fetch($,W="json"){try{let H=await fetch($,{method:"GET"});if(!H.ok)throw new Error(`HTTP error! status: ${H.status}`);return W==="text"?await H.text():await H.json()}catch(X){throw console.error("HTTP error",X),X}}opToUrl($,W={}){if(Object.keys(W).length===0)return $;let X=new URL($);for(let[H,Q]of Object.entries(W))if(typeof Q==="object"&&Q!==null)for(let[Y,G]of Object.entries(Q))X.searchParams.append(`${H}[${Y}]`,G);else X.searchParams.append(H,Q);return X.toString()}}var Q1=new H1;var A2=O2(require("fs")),K$=O2(require("path"));class J1{imgFormat="png";setImgFormat($){this.imgFormat=$}async downloadImage($,W){try{if(!A2.default.existsSync(W.localPath))A2.default.mkdirSync(W.localPath,{recursive:!0});let X=`${W.fileName}.${this.imgFormat}`,H=K$.default.join(W.localPath,X),Q=await fetch($);if(!Q.ok)throw new Error(`下载失败: ${Q.status} ${Q.statusText}`);let Y=await Q.arrayBuffer();return A2.default.writeFileSync(H,new Uint8Array(Y)),K$.default.join(K$.default.basename(W.localPath),X).replace(/\\/g,"/")}catch(X){throw console.error("图片下载错误:",X),X}}async processContent($,W){W=K$.default.join(W,"images");try{let X=/https:\/\/figma-alpha-api\.s3\.us-west-2\.amazonaws\.com\/images\/[a-f0-9-]+/g,H=$.match(X);if(!H)return $;let Q=$;for(let Y of H){let G=K$.default.basename(Y),w=await this.downloadImage(Y,{localPath:W,fileName:G});Q=Q.replace(Y,w)}return Q}catch(X){throw console.error("内容处理错误:",X),X}}}var T2=new J1;var Y1=($)=>{$.tool("figma_to_code","Transform Figma designs into production-ready code. This tool converts selected Figma nodes into HTML, React with CSS Modules, or React with Tailwind CSS, enabling seamless design-to-code workflow.",{fileKey:J.string().describe("The Figma file identifier found in the file URL (e.g., https://www.figma.com/file/XXXXXXXXXXXX/). Extract the XXXXXXXXXXXX portion as the fileKey."),ids:J.string().describe('Comma-separated list of Figma node IDs for conversion. To obtain node IDs, select elements in Figma, right-click and select "Copy/Paste as" → "Copy ID".'),format:J.enum(["html","react-cssmodules","react-tailwind"]).default("html").describe('Specify the output format: "html" generates semantic HTML/CSS, "react-cssmodules" creates React components with scoped CSS modules, "react-tailwind" produces React components with utility-first Tailwind classes.'),personalToken:J.string().optional().describe("Figma personal access token for API authentication"),localPath:J.string().optional().describe("Absolute path for image asset storage. Directory will be created if non-existent. Path must follow OS-specific format without special character escaping."),imgFormat:J.enum(["png","jpg","svg"]).default("png").describe('Export format for image assets: "png" for lossless quality, "jpg" for compressed files, or "svg" for vector graphics.'),scaleSize:J.number().min(1).max(4).default(2).describe("Image export scale factor (1-4). Higher values yield better quality at the cost of larger file sizes.")},async(W,X)=>{console.log(X);try{let H=await Q1.nodeToCode(W)||[];if(W.localPath)T2.setImgFormat(W.imgFormat),await Promise.all(H.map(async(Q)=>{Q.content=await T2.processContent(Q.content,W.localPath)}));return{content:[{type:"text",text:JSON.stringify(H)}]}}catch(H){return console.error("Tool execution error:",H),{content:[{type:"text",text:`Error: ${H.message}`}]}}})};class G1{figmaHost="https://api.figma.com/v1";personalToken=z2;async files($){let W;if($.ids)W=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/nodes`,$);else W=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}`,$);return this.fetch(W)}async images($){let W=this.opToUrl(`${this.figmaHost}/images/${$.fileKey}`,$);return this.fetch(W)}async imageFills($){let W=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/images`,$);return this.fetch(W)}async meta($){let W=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/meta`,$);return this.fetch(W)}async fetch($,W="json"){try{let X={method:"GET",headers:{"X-FIGMA-TOKEN":this.personalToken}},H=await fetch($,X);if(!H.ok)throw new Error(`HTTP error! status: ${H.status}`);return W==="text"?await H.text():await H.json()}catch(X){throw console.error("HTTP error",X),X}}opToUrl($,W={},X=["fileKey","personalToken"]){if(Object.keys(W).length===0)return $;if(W.personalToken)this.personalToken=W.personalToken;let H=new URL($);for(let[Q,Y]of Object.entries(W))if(!X.includes(Q))H.searchParams.append(Q,Y);return H.toString()}}var y2=new G1;var w1=($)=>{$.tool("figma_get_file_data","Get detailed information about a Figma file",{fileKey:J.string().describe("Unique identifier of the Figma file"),ids:J.string().describe("List of node IDs to retrieve, comma separated"),personalToken:J.string().optional().describe("Your Figma personal access token"),version:J.string().optional().describe("Specify the version to return"),depth:J.number().optional().describe("Specify the depth of nodes to return"),geometry:J.enum(["paths"]).optional().describe("Specify whether to include geometry path data"),plugin_data:J.string().optional().describe("Specify plugin data to return"),branch_data:J.boolean().optional().describe("Specify whether to return branch data")},async(W)=>{try{let X=await y2.files(W);return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error: ${X.message}`}]}}}),$.tool("figma_get_images","Get images of Figma nodes",{fileKey:J.string().describe("Unique identifier of the Figma file"),ids:J.string().describe("Node IDs to get images for, comma separated"),format:J.enum(["jpg","png","svg","pdf"]).optional().describe("Image format, e.g., png, jpg, svg"),scale:J.number().optional().describe("Image scale factor"),svg_include_id:J.boolean().optional().describe("Whether SVG includes ID"),svg_simplify_stroke:J.boolean().optional().describe("Whether to simplify SVG strokes"),use_absolute_bounds:J.boolean().optional().describe("Whether to use absolute bounds"),version:J.string().optional().describe("Specify the version to return"),personalToken:J.string().optional().describe("Your Figma personal access token")},async(W)=>{try{let X=await y2.images(W);return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error: ${X.message}`}]}}})};var V2=new g2({name:W1,version:X1},{capabilities:{logging:{}}});w1(V2);Y1(V2);var h2=O2(require("node:process"));class x2{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
7
- `);if($===-1)return null;let W=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),K4(W)}clear(){this._buffer=void 0}}function K4($){return M0.parse(JSON.parse($))}function B1($){return JSON.stringify($)+`
8
- `}class Z2{constructor($=h2.default.stdin,W=h2.default.stdout){this._stdin=$,this._stdout=W,this._readBuffer=new x2,this._started=!1,this._ondata=(X)=>{this._readBuffer.append(X),this.processReadBuffer()},this._onerror=(X)=>{var H;(H=this.onerror)===null||H===void 0||H.call(this,X)}}async start(){if(this._started)throw new 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(){var $,W;while(!0)try{let X=this._readBuffer.readMessage();if(X===null)break;($=this.onmessage)===null||$===void 0||$.call(this,X)}catch(X){(W=this.onerror)===null||W===void 0||W.call(this,X)}}async close(){var $;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)===null||$===void 0||$.call(this)}send($){return new Promise((W)=>{let X=B1($);if(this._stdout.write(X))W();else this._stdout.once("drain",W)})}}async function D1($){try{let W=new Z2;await $.connect(W)}catch(W){console.log(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${W.message}`}})),process.exit(1)}}D1(V2);
6
+ ]`;continue}if(Q+=H[B],H[B]==="\\")Y=!0;else if(G&&H[B]==="]")G=!1;else if(!G&&H[B]==="[")G=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${W.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),$.source}return Q}function D2($,W){if(W.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(W.target==="openApi3"&&$.keyType?._def.typeName===M.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((H,Q)=>({...H,[Q]:N($.valueType._def,{...W,currentPath:[...W.currentPath,"properties",Q]})??{}}),{}),additionalProperties:W.rejectedAdditionalProperties};let X={type:"object",additionalProperties:N($.valueType._def,{...W,currentPath:[...W.currentPath,"additionalProperties"]})??W.allowedAdditionalProperties};if(W.target==="openApi3")return X;if($.keyType?._def.typeName===M.ZodString&&$.keyType._def.checks?.length){let{type:H,...Q}=B2($.keyType._def,W);return{...X,propertyNames:Q}}else if($.keyType?._def.typeName===M.ZodEnum)return{...X,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===M.ZodBranded&&$.keyType._def.type._def.typeName===M.ZodString&&$.keyType._def.type._def.checks?.length){let{type:H,...Q}=w2($.keyType._def,W);return{...X,propertyNames:Q}}return X}function T0($,W){if(W.mapStrategy==="record")return D2($,W);let X=N($.keyType._def,{...W,currentPath:[...W.currentPath,"items","items","0"]})||{},H=N($.valueType._def,{...W,currentPath:[...W.currentPath,"items","items","1"]})||{};return{type:"array",maxItems:125,items:{type:"array",items:[X,H],minItems:2,maxItems:2}}}function y0($){let W=$.values,H=Object.keys($.values).filter((Y)=>{return typeof W[W[Y]]!=="number"}).map((Y)=>W[Y]),Q=Array.from(new Set(H.map((Y)=>typeof Y)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:H}}function x0(){return{not:{}}}function h0($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var T$={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function l0($,W){if(W.target==="openApi3")return Z0($,W);let X=$.options instanceof Map?Array.from($.options.values()):$.options;if(X.every((H)=>(H._def.typeName in T$)&&(!H._def.checks||!H._def.checks.length))){let H=X.reduce((Q,Y)=>{let G=T$[Y._def.typeName];return G&&!Q.includes(G)?[...Q,G]:Q},[]);return{type:H.length>1?H:H[0]}}else if(X.every((H)=>H._def.typeName==="ZodLiteral"&&!H.description)){let H=X.reduce((Q,Y)=>{let G=typeof Y._def.value;switch(G){case"string":case"number":case"boolean":return[...Q,G];case"bigint":return[...Q,"integer"];case"object":if(Y._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(H.length===X.length){let Q=H.filter((Y,G,w)=>w.indexOf(Y)===G);return{type:Q.length>1?Q:Q[0],enum:X.reduce((Y,G)=>{return Y.includes(G._def.value)?Y:[...Y,G._def.value]},[])}}}else if(X.every((H)=>H._def.typeName==="ZodEnum"))return{type:"string",enum:X.reduce((H,Q)=>[...H,...Q._def.values.filter((Y)=>!H.includes(Y))],[])};return Z0($,W)}var Z0=($,W)=>{let X=($.options instanceof Map?Array.from($.options.values()):$.options).map((H,Q)=>N(H._def,{...W,currentPath:[...W.currentPath,"anyOf",`${Q}`]})).filter((H)=>!!H&&(!W.strictUnions||typeof H==="object"&&Object.keys(H).length>0));return X.length?{anyOf:X}:void 0};function m0($,W){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(W.target==="openApi3")return{type:T$[$.innerType._def.typeName],nullable:!0};return{type:[T$[$.innerType._def.typeName],"null"]}}if(W.target==="openApi3"){let H=N($.innerType._def,{...W,currentPath:[...W.currentPath]});if(H&&"$ref"in H)return{allOf:[H],nullable:!0};return H&&{...H,nullable:!0}}let X=N($.innerType._def,{...W,currentPath:[...W.currentPath,"anyOf","0"]});return X&&{anyOf:[X,{type:"null"}]}}function n0($,W){let X={type:"number"};if(!$.checks)return X;for(let H of $.checks)switch(H.kind){case"int":X.type="integer",f2(X,"type",H.message,W);break;case"min":if(W.target==="jsonSchema7")if(H.inclusive)L(X,"minimum",H.value,H.message,W);else L(X,"exclusiveMinimum",H.value,H.message,W);else{if(!H.inclusive)X.exclusiveMinimum=!0;L(X,"minimum",H.value,H.message,W)}break;case"max":if(W.target==="jsonSchema7")if(H.inclusive)L(X,"maximum",H.value,H.message,W);else L(X,"exclusiveMaximum",H.value,H.message,W);else{if(!H.inclusive)X.exclusiveMaximum=!0;L(X,"maximum",H.value,H.message,W)}break;case"multipleOf":L(X,"multipleOf",H.value,H.message,W);break}return X}function u0($,W){let X=W.target==="openAi",H={type:"object",properties:{}},Q=[],Y=$.shape();for(let w in Y){let B=Y[w];if(B===void 0||B._def===void 0)continue;let V=b4(B);if(V&&X){if(B instanceof k)B=B._def.innerType;if(!B.isNullable())B=B.nullable();V=!1}let _=N(B._def,{...W,currentPath:[...W.currentPath,"properties",w],propertyPath:[...W.currentPath,"properties",w]});if(_===void 0)continue;if(H.properties[w]=_,!V)Q.push(w)}if(Q.length)H.required=Q;let G=A4($,W);if(G!==void 0)H.additionalProperties=G;return H}function A4($,W){if($.catchall._def.typeName!=="ZodNever")return N($.catchall._def,{...W,currentPath:[...W.currentPath,"additionalProperties"]});switch($.unknownKeys){case"passthrough":return W.allowedAdditionalProperties;case"strict":return W.rejectedAdditionalProperties;case"strip":return W.removeAdditionalStrategy==="strict"?W.allowedAdditionalProperties:W.rejectedAdditionalProperties}}function b4($){try{return $.isOptional()}catch{return!0}}var i0=($,W)=>{if(W.currentPath.toString()===W.propertyPath?.toString())return N($.innerType._def,W);let X=N($.innerType._def,{...W,currentPath:[...W.currentPath,"anyOf","1"]});return X?{anyOf:[{not:{}},X]}:{}};var c0=($,W)=>{if(W.pipeStrategy==="input")return N($.in._def,W);else if(W.pipeStrategy==="output")return N($.out._def,W);let X=N($.in._def,{...W,currentPath:[...W.currentPath,"allOf","0"]}),H=N($.out._def,{...W,currentPath:[...W.currentPath,"allOf",X?"1":"0"]});return{allOf:[X,H].filter((Q)=>Q!==void 0)}};function p0($,W){return N($.type._def,W)}function d0($,W){let H={type:"array",uniqueItems:!0,items:N($.valueType._def,{...W,currentPath:[...W.currentPath,"items"]})};if($.minSize)L(H,"minItems",$.minSize.value,$.minSize.message,W);if($.maxSize)L(H,"maxItems",$.maxSize.value,$.maxSize.message,W);return H}function o0($,W){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((X,H)=>N(X._def,{...W,currentPath:[...W.currentPath,"items",`${H}`]})).reduce((X,H)=>H===void 0?X:[...X,H],[]),additionalItems:N($.rest._def,{...W,currentPath:[...W.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((X,H)=>N(X._def,{...W,currentPath:[...W.currentPath,"items",`${H}`]})).reduce((X,H)=>H===void 0?X:[...X,H],[])}}function r0(){return{not:{}}}function a0(){return{}}var t0=($,W)=>{return N($.innerType._def,W)};var s0=($,W,X)=>{switch(W){case M.ZodString:return B2($,X);case M.ZodNumber:return n0($,X);case M.ZodObject:return u0($,X);case M.ZodBigInt:return E0($,X);case M.ZodBoolean:return v0();case M.ZodDate:return k2($,X);case M.ZodUndefined:return r0();case M.ZodNull:return h0(X);case M.ZodArray:return S0($,X);case M.ZodUnion:case M.ZodDiscriminatedUnion:return l0($,X);case M.ZodIntersection:return P0($,X);case M.ZodTuple:return o0($,X);case M.ZodRecord:return D2($,X);case M.ZodLiteral:return C0($,X);case M.ZodEnum:return I0($);case M.ZodNativeEnum:return y0($);case M.ZodNullable:return m0($,X);case M.ZodOptional:return i0($,X);case M.ZodMap:return T0($,X);case M.ZodSet:return d0($,X);case M.ZodLazy:return()=>$.getter()._def;case M.ZodPromise:return p0($,X);case M.ZodNaN:case M.ZodNever:return x0();case M.ZodEffects:return k0($,X);case M.ZodAny:return F0();case M.ZodUnknown:return a0();case M.ZodDefault:return f0($,X);case M.ZodBranded:return w2($,X);case M.ZodReadonly:return t0($,X);case M.ZodCatch:return R0($,X);case M.ZodPipeline:return c0($,X);case M.ZodFunction:case M.ZodVoid:case M.ZodSymbol:return;default:return((H)=>{return})(W)}};function N($,W,X=!1){let H=W.seen.get($);if(W.override){let w=W.override?.($,W,H,X);if(w!==U0)return w}if(H&&!X){let w=N4(H,W);if(w!==void 0)return w}let Q={def:$,path:W.currentPath,jsonSchema:void 0};W.seen.set($,Q);let Y=s0($,$.typeName,W),G=typeof Y==="function"?N(Y(),W):Y;if(G)_4($,W,G);if(W.postProcess){let w=W.postProcess(G,$,W);return Q.jsonSchema=G,w}return Q.jsonSchema=G,G}var N4=($,W)=>{switch(W.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:O4(W.currentPath,$.path)};case"none":case"seen":{if($.path.length<W.currentPath.length&&$.path.every((X,H)=>W.currentPath[H]===X))return console.warn(`Recursive reference detected at ${W.currentPath.join("/")}! Defaulting to any`),{};return W.$refStrategy==="seen"?{}:void 0}}},O4=($,W)=>{let X=0;for(;X<$.length&&X<W.length;X++)if($[X]!==W[X])break;return[($.length-X).toString(),...W.slice(X)].join("/")},_4=($,W,X)=>{if($.description){if(X.description=$.description,W.markdownDescription)X.markdownDescription=$.description}return X};var M2=($,W)=>{let X=K0(W),H=typeof W==="object"&&W.definitions?Object.entries(W.definitions).reduce((B,[V,_])=>({...B,[V]:N(_._def,{...X,currentPath:[...X.basePath,X.definitionPath,V]},!0)??{}}),{}):void 0,Q=typeof W==="string"?W:W?.nameStrategy==="title"?void 0:W?.name,Y=N($._def,Q===void 0?X:{...X,currentPath:[...X.basePath,X.definitionPath,Q]},!1)??{},G=typeof W==="object"&&W.name!==void 0&&W.nameStrategy==="title"?W.name:void 0;if(G!==void 0)Y.title=G;let w=Q===void 0?H?{...Y,[X.definitionPath]:H}:Y:{$ref:[...X.$refStrategy==="relative"?[]:X.basePath,X.definitionPath,Q].join("/"),[X.definitionPath]:{...H,[Q]:Y}};if(X.target==="jsonSchema7")w.$schema="http://json-schema.org/draft-07/schema#";else if(X.target==="jsonSchema2019-09"||X.target==="openAi")w.$schema="https://json-schema.org/draft/2019-09/schema#";if(X.target==="openAi"&&(("anyOf"in w)||("oneOf"in w)||("allOf"in w)||("type"in w)&&Array.isArray(w.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return w};var C2;(function($){$.Completable="McpCompletable"})(C2||(C2={}));class y$ extends q{_parse($){let{ctx:W}=this._processInputParams($),X=W.data;return this._def.type._parse({data:X,path:W.path,parent:W})}unwrap(){return this._def.type}}y$.create=($,W)=>{return new y$({type:$,typeName:C2.Completable,complete:W.complete,...q4(W)})};function q4($){if(!$)return{};let{errorMap:W,invalid_type_error:X,required_error:H,description:Q}=$;if(W&&(X||H))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(W)return{errorMap:W,description:Q};return{errorMap:(G,w)=>{var B,V;let{message:_}=$;if(G.code==="invalid_enum_value")return{message:_!==null&&_!==void 0?_:w.defaultError};if(typeof w.data==="undefined")return{message:(B=_!==null&&_!==void 0?_:H)!==null&&B!==void 0?B:w.defaultError};if(G.code!=="invalid_type")return{message:w.defaultError};return{message:(V=_!==null&&_!==void 0?_:X)!==null&&V!==void 0?V:w.defaultError}},description:Q}}class g2{constructor($,W){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new R2($,W)}async connect($){return await this.server.connect($)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(J2.shape.method.value),this.server.assertCanSetRequestHandler(Y2.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(J2,()=>({tools:Object.entries(this._registeredTools).filter(([,$])=>$.enabled).map(([$,W])=>{let X={name:$,description:W.description,inputSchema:W.inputSchema?M2(W.inputSchema,{strictUnions:!0}):U4,annotations:W.annotations};if(W.outputSchema)X.outputSchema=M2(W.outputSchema,{strictUnions:!0});return X})})),this.server.setRequestHandler(Y2,async($,W)=>{let X=this._registeredTools[$.params.name];if(!X)throw new S(F.InvalidParams,`Tool ${$.params.name} not found`);if(!X.enabled)throw new S(F.InvalidParams,`Tool ${$.params.name} disabled`);let H;if(X.inputSchema){let Q=await X.inputSchema.safeParseAsync($.params.arguments);if(!Q.success)throw new S(F.InvalidParams,`Invalid arguments for tool ${$.params.name}: ${Q.error.message}`);let Y=Q.data,G=X.callback;try{H=await Promise.resolve(G(Y,W))}catch(w){H={content:[{type:"text",text:w instanceof Error?w.message:String(w)}],isError:!0}}}else{let Q=X.callback;try{H=await Promise.resolve(Q(W))}catch(Y){H={content:[{type:"text",text:Y instanceof Error?Y.message:String(Y)}],isError:!0}}}if(X.outputSchema){if(!H.structuredContent)throw new S(F.InvalidParams,`Tool ${$.params.name} has an output schema but no structured content was provided`);let Q=await X.outputSchema.safeParseAsync(H.structuredContent);if(!Q.success)throw new S(F.InvalidParams,`Invalid structured content for tool ${$.params.name}: ${Q.error.message}`)}return H}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(G2.shape.method.value),this.server.setRequestHandler(G2,async($)=>{switch($.params.ref.type){case"ref/prompt":return this.handlePromptCompletion($,$.params.ref);case"ref/resource":return this.handleResourceCompletion($,$.params.ref);default:throw new S(F.InvalidParams,`Invalid completion reference: ${$.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion($,W){let X=this._registeredPrompts[W.name];if(!X)throw new S(F.InvalidParams,`Prompt ${W.name} not found`);if(!X.enabled)throw new S(F.InvalidParams,`Prompt ${W.name} disabled`);if(!X.argsSchema)return j2;let H=X.argsSchema.shape[$.params.argument.name];if(!(H instanceof y$))return j2;let Y=await H._def.complete($.params.argument.value);return $1(Y)}async handleResourceCompletion($,W){let X=Object.values(this._registeredResourceTemplates).find((Y)=>Y.resourceTemplate.uriTemplate.toString()===W.uri);if(!X){if(this._registeredResources[W.uri])return j2;throw new S(F.InvalidParams,`Resource template ${$.params.ref.uri} not found`)}let H=X.resourceTemplate.completeCallback($.params.argument.name);if(!H)return j2;let Q=await H($.params.argument.value);return $1(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(t$.shape.method.value),this.server.assertCanSetRequestHandler(s$.shape.method.value),this.server.assertCanSetRequestHandler(e$.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(t$,async($,W)=>{let X=Object.entries(this._registeredResources).filter(([Q,Y])=>Y.enabled).map(([Q,Y])=>({uri:Q,name:Y.name,...Y.metadata})),H=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let Y=await Q.resourceTemplate.listCallback(W);for(let G of Y.resources)H.push({...G,...Q.metadata})}return{resources:[...X,...H]}}),this.server.setRequestHandler(s$,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([W,X])=>({name:W,uriTemplate:X.resourceTemplate.uriTemplate.toString(),...X.metadata}))}}),this.server.setRequestHandler(e$,async($,W)=>{let X=new URL($.params.uri),H=this._registeredResources[X.toString()];if(H){if(!H.enabled)throw new S(F.InvalidParams,`Resource ${X} disabled`);return H.readCallback(X,W)}for(let Q of Object.values(this._registeredResourceTemplates)){let Y=Q.resourceTemplate.uriTemplate.match(X.toString());if(Y)return Q.readCallback(X,Y,W)}throw new S(F.InvalidParams,`Resource ${X} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler($2.shape.method.value),this.server.assertCanSetRequestHandler(W2.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler($2,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,$])=>$.enabled).map(([$,W])=>{return{name:$,description:W.description,arguments:W.argsSchema?K4(W.argsSchema):void 0}})})),this.server.setRequestHandler(W2,async($,W)=>{let X=this._registeredPrompts[$.params.name];if(!X)throw new S(F.InvalidParams,`Prompt ${$.params.name} not found`);if(!X.enabled)throw new S(F.InvalidParams,`Prompt ${$.params.name} disabled`);if(X.argsSchema){let H=await X.argsSchema.safeParseAsync($.params.arguments);if(!H.success)throw new S(F.InvalidParams,`Invalid arguments for prompt ${$.params.name}: ${H.error.message}`);let Q=H.data,Y=X.callback;return await Promise.resolve(Y(Q,W))}else{let H=X.callback;return await Promise.resolve(H(W))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource($,W,...X){let H;if(typeof X[0]==="object")H=X.shift();let Q=X[0];if(typeof W==="string"){if(this._registeredResources[W])throw new Error(`Resource ${W} is already registered`);let Y={name:$,metadata:H,readCallback:Q,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({uri:null}),update:(G)=>{if(typeof G.uri!=="undefined"&&G.uri!==W){if(delete this._registeredResources[W],G.uri)this._registeredResources[G.uri]=Y}if(typeof G.name!=="undefined")Y.name=G.name;if(typeof G.metadata!=="undefined")Y.metadata=G.metadata;if(typeof G.callback!=="undefined")Y.readCallback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=Y,this.setResourceRequestHandlers(),this.sendResourceListChanged(),Y}else{if(this._registeredResourceTemplates[$])throw new Error(`Resource template ${$} is already registered`);let Y={resourceTemplate:W,metadata:H,readCallback:Q,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(G)=>{if(typeof G.name!=="undefined"&&G.name!==$){if(delete this._registeredResourceTemplates[$],G.name)this._registeredResourceTemplates[G.name]=Y}if(typeof G.template!=="undefined")Y.resourceTemplate=G.template;if(typeof G.metadata!=="undefined")Y.metadata=G.metadata;if(typeof G.callback!=="undefined")Y.readCallback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[$]=Y,this.setResourceRequestHandlers(),this.sendResourceListChanged(),Y}}_createRegisteredTool($,W,X,H,Q,Y){let G={description:W,inputSchema:X===void 0?void 0:J.object(X),outputSchema:H===void 0?void 0:J.object(H),annotations:Q,callback:Y,enabled:!0,disable:()=>G.update({enabled:!1}),enable:()=>G.update({enabled:!0}),remove:()=>G.update({name:null}),update:(w)=>{if(typeof w.name!=="undefined"&&w.name!==$){if(delete this._registeredTools[$],w.name)this._registeredTools[w.name]=G}if(typeof w.description!=="undefined")G.description=w.description;if(typeof w.paramsSchema!=="undefined")G.inputSchema=J.object(w.paramsSchema);if(typeof w.callback!=="undefined")G.callback=w.callback;if(typeof w.annotations!=="undefined")G.annotations=w.annotations;if(typeof w.enabled!=="undefined")G.enabled=w.enabled;this.sendToolListChanged()}};return this._registeredTools[$]=G,this.setToolRequestHandlers(),this.sendToolListChanged(),G}tool($,...W){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let X,H,Q,Y;if(typeof W[0]==="string")X=W.shift();if(W.length>1){let w=W[0];if(e0(w)){if(H=W.shift(),W.length>1&&typeof W[0]==="object"&&W[0]!==null&&!e0(W[0]))Y=W.shift()}else if(typeof w==="object"&&w!==null)Y=W.shift()}let G=W[0];return this._createRegisteredTool($,X,H,Q,Y,G)}registerTool($,W,X){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let{description:H,inputSchema:Q,outputSchema:Y,annotations:G}=W;return this._createRegisteredTool($,H,Q,Y,G,X)}prompt($,...W){if(this._registeredPrompts[$])throw new Error(`Prompt ${$} is already registered`);let X;if(typeof W[0]==="string")X=W.shift();let H;if(W.length>1)H=W.shift();let Q=W[0],Y={description:X,argsSchema:H===void 0?void 0:J.object(H),callback:Q,enabled:!0,disable:()=>Y.update({enabled:!1}),enable:()=>Y.update({enabled:!0}),remove:()=>Y.update({name:null}),update:(G)=>{if(typeof G.name!=="undefined"&&G.name!==$){if(delete this._registeredPrompts[$],G.name)this._registeredPrompts[G.name]=Y}if(typeof G.description!=="undefined")Y.description=G.description;if(typeof G.argsSchema!=="undefined")Y.argsSchema=J.object(G.argsSchema);if(typeof G.callback!=="undefined")Y.callback=G.callback;if(typeof G.enabled!=="undefined")Y.enabled=G.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[$]=Y,this.setPromptRequestHandlers(),this.sendPromptListChanged(),Y}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var U4={type:"object"};function e0($){if(typeof $!=="object"||$===null)return!1;return Object.keys($).length===0||Object.values($).some(L4)}function L4($){return $!==null&&typeof $==="object"&&"parse"in $&&typeof $.parse==="function"&&"safeParse"in $&&typeof $.safeParse==="function"}function K4($){return Object.entries($.shape).map(([W,X])=>({name:W,description:X.description,required:!X.isOptional()}))}function $1($){return{completion:{values:$.slice(0,100),total:$.length,hasMore:$.length>100}}}var j2={completion:{values:[],hasMore:!1}};var W1=process.argv.find(($)=>$.startsWith("--figma-api-key=")),F4=W1?W1.split("=")[1]:"",z2=F4||process.env.personalToken||process.env.FIGMA_API_KEY||"",X1="F2C MCP",H1=process.env.FIGMA_VERSION||"0.0.1";class Q1{f2cHost="https://f2c-figma-api.yy.com/api";personalToken=z2;async nodeToCode($){let W={fileKey:$.fileKey,nodeIds:$.ids,personal_token:$.personalToken||this.personalToken,option:{cssFramework:"inlinecss",imgFormat:$.imgFormat||"png",scaleSize:$.scaleSize||2},format:"files"};if($.format==="react-cssmodules")W.option.cssFramework="cssmodules";else if($.format==="react-tailwind")W.option.cssFramework="tailwindcss";let X=this.opToUrl(`${this.f2cHost}/nodes`,W);return this.fetch(X,"json")}async fetch($,W="json"){try{let H=await fetch($,{method:"GET"});if(!H.ok)throw new Error(`HTTP error! status: ${H.status}`);return W==="text"?await H.text():await H.json()}catch(X){throw console.error("HTTP error",X),X}}opToUrl($,W={}){if(Object.keys(W).length===0)return $;let X=new URL($);for(let[H,Q]of Object.entries(W))if(typeof Q==="object"&&Q!==null)for(let[Y,G]of Object.entries(Q))X.searchParams.append(`${H}[${Y}]`,G);else X.searchParams.append(H,Q);return X.toString()}}var J1=new Q1;var V2=O2(require("fs")),K$=O2(require("path"));class Y1{imgFormat="png";setImgFormat($){this.imgFormat=$}async downloadImage($,W){try{if(!V2.default.existsSync(W.localPath))V2.default.mkdirSync(W.localPath,{recursive:!0});let X=`${W.fileName}.${this.imgFormat}`,H=K$.default.join(W.localPath,X),Q=await fetch($);if(!Q.ok)throw new Error(`下载失败: ${Q.status} ${Q.statusText}`);let Y=await Q.arrayBuffer();return V2.default.writeFileSync(H,new Uint8Array(Y)),K$.default.join(K$.default.basename(W.localPath),X).replace(/\\/g,"/")}catch(X){throw console.error("图片下载错误:",X),X}}async processContent($,W){W=K$.default.join(W,"images");try{let X=/https:\/\/figma-alpha-api\.s3\.us-west-2\.amazonaws\.com\/images\/[a-f0-9-]+/g,H=$.match(X);if(!H)return $;let Q=$;for(let Y of H){let G=K$.default.basename(Y),w=await this.downloadImage(Y,{localPath:W,fileName:G});Q=Q.replace(Y,w)}return Q}catch(X){throw console.error("内容处理错误:",X),X}}}var T2=new Y1;var G1=($)=>{$.tool("figma_to_code","Transform Figma designs into production-ready code. This tool converts selected Figma nodes into HTML, React with CSS Modules, or React with Tailwind CSS, enabling seamless design-to-code workflow.",{fileKey:J.string().describe("The Figma file identifier found in the file URL (e.g., https://www.figma.com/file/XXXXXXXXXXXX/). Extract the XXXXXXXXXXXX portion as the fileKey."),ids:J.string().describe('Comma-separated list of Figma node IDs for conversion. To obtain node IDs, select elements in Figma, right-click and select "Copy/Paste as" → "Copy ID".'),format:J.enum(["html","react-cssmodules","react-tailwind"]).default("html").describe('Specify the output format: "html" generates semantic HTML/CSS, "react-cssmodules" creates React components with scoped CSS modules, "react-tailwind" produces React components with utility-first Tailwind classes.'),personalToken:J.string().optional().describe("Figma personal access token for API authentication.The parameters are not required when the tool is called."),localPath:J.string().optional().describe("Absolute path for image asset storage. Directory will be created if non-existent. Path must follow OS-specific format without special character escaping."),imgFormat:J.enum(["png","jpg","svg"]).default("png").describe('Export format for image assets: "png" for lossless quality, "jpg" for compressed files, or "svg" for vector graphics.'),scaleSize:J.number().min(1).max(4).default(2).describe("Image export scale factor (1-4). Higher values yield better quality at the cost of larger file sizes.")},async(W,X)=>{console.log(X);try{let H=await J1.nodeToCode(W)||[];if(W.localPath)T2.setImgFormat(W.imgFormat),await Promise.all(H.map(async(Q)=>{Q.content=await T2.processContent(Q.content,W.localPath)}));return{content:[{type:"text",text:JSON.stringify(H)}]}}catch(H){return console.error("Tool execution error:",H),{content:[{type:"text",text:`Error: ${H.message}`}]}}})};class w1{figmaHost="https://api.figma.com/v1";personalToken=z2;async files($){let W;if($.ids)W=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/nodes`,$);else W=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}`,$);return this.fetch(W)}async images($){let W=this.opToUrl(`${this.figmaHost}/images/${$.fileKey}`,$);return this.fetch(W)}async imageFills($){let W=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/images`,$);return this.fetch(W)}async meta($){let W=this.opToUrl(`${this.figmaHost}/files/${$.fileKey}/meta`,$);return this.fetch(W)}async fetch($,W="json"){try{let X={method:"GET",headers:{"X-FIGMA-TOKEN":this.personalToken}},H=await fetch($,X);if(!H.ok)throw new Error(`HTTP error! status: ${H.status}`);return W==="text"?await H.text():await H.json()}catch(X){throw console.error("HTTP error",X),X}}opToUrl($,W={},X=["fileKey","personalToken"]){if(Object.keys(W).length===0)return $;if(W.personalToken)this.personalToken=W.personalToken;let H=new URL($);for(let[Q,Y]of Object.entries(W))if(!X.includes(Q))H.searchParams.append(Q,Y);return H.toString()}}var y2=new w1;var B1=($)=>{$.tool("figma_get_file_data","Get detailed information about a Figma file",{fileKey:J.string().describe("Unique identifier of the Figma file"),ids:J.string().describe("List of node IDs to retrieve, comma separated"),personalToken:J.string().optional().describe("Your Figma personal access token, The parameters are not required when the tool is called."),version:J.string().optional().describe("Specify the version to return"),depth:J.number().optional().describe("Specify the depth of nodes to return"),geometry:J.enum(["paths"]).optional().describe("Specify whether to include geometry path data"),plugin_data:J.string().optional().describe("Specify plugin data to return"),branch_data:J.boolean().optional().describe("Specify whether to return branch data")},async(W)=>{try{let X=await y2.files(W);return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error: ${X.message}`}]}}}),$.tool("figma_get_images","Get images of Figma nodes",{fileKey:J.string().describe("Unique identifier of the Figma file"),ids:J.string().describe("Node IDs to get images for, comma separated"),format:J.enum(["jpg","png","svg","pdf"]).optional().describe("Image format, e.g., png, jpg, svg"),scale:J.number().optional().describe("Image scale factor"),svg_include_id:J.boolean().optional().describe("Whether SVG includes ID"),svg_simplify_stroke:J.boolean().optional().describe("Whether to simplify SVG strokes"),use_absolute_bounds:J.boolean().optional().describe("Whether to use absolute bounds"),version:J.string().optional().describe("Specify the version to return"),personalToken:J.string().optional().describe("Your Figma personal access token, The parameters are not required when the tool is called.")},async(W)=>{try{let X=await y2.images(W);return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error: ${X.message}`}]}}})};var A2=new g2({name:X1,version:H1},{capabilities:{logging:{}}});B1(A2);G1(A2);var h2=O2(require("node:process"));class x2{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
7
+ `);if($===-1)return null;let W=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),S4(W)}clear(){this._buffer=void 0}}function S4($){return M0.parse(JSON.parse($))}function D1($){return JSON.stringify($)+`
8
+ `}class Z2{constructor($=h2.default.stdin,W=h2.default.stdout){this._stdin=$,this._stdout=W,this._readBuffer=new x2,this._started=!1,this._ondata=(X)=>{this._readBuffer.append(X),this.processReadBuffer()},this._onerror=(X)=>{var H;(H=this.onerror)===null||H===void 0||H.call(this,X)}}async start(){if(this._started)throw new 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(){var $,W;while(!0)try{let X=this._readBuffer.readMessage();if(X===null)break;($=this.onmessage)===null||$===void 0||$.call(this,X)}catch(X){(W=this.onerror)===null||W===void 0||W.call(this,X)}}async close(){var $;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)===null||$===void 0||$.call(this)}send($){return new Promise((W)=>{let X=D1($);if(this._stdout.write(X))W();else this._stdout.once("drain",W)})}}async function M1($){try{let W=new Z2;await $.connect(W)}catch(W){console.log(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${W.message}`}})),process.exit(1)}}M1(A2);
9
9
 
10
- //# debugId=2A68865B8F31A1B864756E2164756E21
10
+ //# debugId=0ED25847C34FFE4A64756E2164756E21
11
11
  //# sourceMappingURL=cli.js.map