figura-cli 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/mcp.js +3 -3
- package/package.json +1 -1
- package/skills/figura-brand/SKILL.md +8 -2
package/dist/index.js
CHANGED
|
@@ -182,7 +182,7 @@ you by scanning your repo ("introduce my repo to Figura").
|
|
|
182
182
|
Both forms print WHICH team they're bound to and from where. In a repo that isn't
|
|
183
183
|
linked to a team, \`brand set\` refuses the global ~/.figura fallback — run
|
|
184
184
|
\`figura link\` first, or pass --allow-global to override.`;async function W0(){let i=[];for await(let a of process.stdin)i.push(Buffer.from(a));return Buffer.concat(i).toString("utf8")}async function Zu(i){if((i[0]&&!i[0].startsWith("-")?i[0]:void 0)==="set")return f0(i.slice(1));let{flags:n}=B(i);if(K(n,"help")||K(n,"h")){process.stdout.write(Yu+`
|
|
185
|
-
`);return}let{token:c,apiUrl:p}=await P(n,{announce:!0}),s;try{s=await D("/v1/brand",{token:c,apiUrl:p,source:L})}catch(m){J(M(m))}if(K(n,"json")){k(s);return}let o=[];o.push(`name: ${s.name??""}${s.isCustom?"":" (default)"}`),o.push(`product: ${s.appDescription??""}`),o.push(`tokens: ${(s.tokensBlock??"").length} chars`),o.push(`surfaces: ${(s.surfaces??[]).join(", ")||"(none)"}`),o.push(`forbidden: ${(s.forbidden??"").length} chars`),process.stdout.write(o.join(`
|
|
185
|
+
`);return}let{token:c,apiUrl:p}=await P(n,{announce:!0}),s;try{s=await D("/v1/brand",{token:c,apiUrl:p,source:L})}catch(m){J(M(m))}if(K(n,"json")){k(s);return}let o=[];o.push(`name: ${s.name??""}${s.isCustom?"":" (default)"}`),o.push(`product: ${s.appDescription??""}`),o.push(`tokens: ${(s.tokensBlock??"").length} chars`),o.push(`surfaces: ${(s.surfaces??[]).join(", ")||"(none)"}`),o.push(`forbidden: ${(s.forbidden??"").length} chars`),o.push(`platform: ${s.platformProfile??"(unknown — Studio uses its own defaults)"}`),process.stdout.write(o.join(`
|
|
186
186
|
`)+`
|
|
187
187
|
`)}async function f0(i){let{flags:a}=B(i);if(K(a,"help")||K(a,"h")){process.stdout.write(Yu+`
|
|
188
188
|
`);return}let{token:n,apiUrl:c}=await P(a,{mutate:!0}),p=G(a,"name");if(!p)J("--name is required for `brand set`.");let s={name:p},o=G(a,"description");if(o!==void 0)s.appDescription=o;let m=G(a,"tokens");if(m==="-")s.tokensBlock=await W0();else if(m&&m.startsWith("@"))try{s.tokensBlock=Z0(m.slice(1),"utf8")}catch(l){J(`could not read --tokens file ${m.slice(1)}: ${M(l)}`)}else if(m!==void 0)s.tokensBlock=m;let x;try{x=await D("/brand",{method:"PUT",body:s,token:n,apiUrl:c,source:L})}catch(l){J(M(l))}if(K(a,"json")){k(x);return}process.stdout.write(`Brand saved: ${x.name}
|
package/dist/mcp.js
CHANGED
|
@@ -32,7 +32,7 @@ import{createRequire as rq}from"node:module";var nq=Object.create;var{getPrototy
|
|
|
32
32
|
`);return J===-1?"":Y.stack.slice(J+1)})();try{if(!W.stack)W.stack=X;else if(X){let J=X.indexOf(`
|
|
33
33
|
`),G=J===-1?-1:X.indexOf(`
|
|
34
34
|
`,J+1),b=G===-1?"":X.slice(G+1);if(!String(W.stack).endsWith(b))W.stack+=`
|
|
35
|
-
`+X}}catch(J){}}throw W}}_request(x,Q){if(typeof x==="string")Q=Q||{},Q.url=x;else Q=x||{};Q=p1(this.defaults,Q);let{transitional:W,paramsSerializer:Y,headers:X}=Q;if(W!==void 0)x6.assertOptions(W,{silentJSONParsing:Q1.transitional(Q1.boolean),forcedJSONParsing:Q1.transitional(Q1.boolean),clarifyTimeoutError:Q1.transitional(Q1.boolean),legacyInterceptorReqResOrdering:Q1.transitional(Q1.boolean),advertiseZstdAcceptEncoding:Q1.transitional(Q1.boolean),validateStatusUndefinedResolves:Q1.transitional(Q1.boolean)},!1);if(Y!=null)if(H.isFunction(Y))Q.paramsSerializer={serialize:Y};else x6.assertOptions(Y,{encode:Q1.function,serialize:Q1.function},!0);if(Q.allowAbsoluteUrls!==void 0);else if(this.defaults.allowAbsoluteUrls!==void 0)Q.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls;else Q.allowAbsoluteUrls=!0;x6.assertOptions(Q,{baseUrl:Q1.spelling("baseURL"),withXsrfToken:Q1.spelling("withXSRFToken")},!0),Q.method=(Q.method||this.defaults.method||"get").toLowerCase();let J=X&&H.merge(X.common,X[Q.method]);X&&H.forEach(["delete","get","head","post","put","patch","query","common"],(B)=>{delete X[B]}),Q.headers=V0.concat(J,X);let G=[],b=!0;this.interceptors.request.forEach(function(V){if(typeof V.runWhen==="function"&&V.runWhen(Q)===!1)return;b=b&&V.synchronous;let N=Q.transitional||D4;if(N&&N.legacyInterceptorReqResOrdering)G.unshift(V.fulfilled,V.rejected);else G.push(V.fulfilled,V.rejected)});let $=[];this.interceptors.response.forEach(function(V){$.push(V.fulfilled,V.rejected)});let z,v=0,w;if(!b){let B=[C9.bind(this),void 0];B.unshift(...G),B.push(...$),w=B.length,z=Promise.resolve(Q);while(v<w)z=z.then(B[v++],B[v++]);return z}w=G.length;let K=Q;while(v<w){let B=G[v++],V=G[v++];try{K=B(K)}catch(N){V.call(this,N);break}}try{z=C9.call(this,K)}catch(B){return Promise.reject(B)}v=0,w=$.length;while(v<w)z=z.then($[v++],$[v++]);return z}getUri(x){x=p1(this.defaults,x);let Q=e4(x.baseURL,x.url,x.allowAbsoluteUrls,x);return t4(Q,x.params,x.paramsSerializer)}}H.forEach(["delete","get","head","options"],function(Q){Q6.prototype[Q]=function(W,Y){return this.request(p1(Y||{},{method:Q,url:W,data:Y&&H.hasOwnProp(Y,"data")?Y.data:void 0}))}});H.forEach(["post","put","patch","query"],function(Q){function W(Y){return function(J,G,b){return this.request(p1(b||{},{method:Q,headers:Y?{"Content-Type":"multipart/form-data"}:{},url:J,data:G}))}}if(Q6.prototype[Q]=W(),Q!=="query")Q6.prototype[Q+"Form"]=W(!0)});var W6=Q6;class T5{constructor(x){if(typeof x!=="function")throw TypeError("executor must be a function.");let Q;this.promise=new Promise(function(X){Q=X});let W=this;this.promise.then((Y)=>{if(!W._listeners)return;let X=W._listeners.length;while(X-- >0)W._listeners[X](Y);W._listeners=null}),this.promise.then=(Y)=>{let X,J=new Promise((G)=>{W.subscribe(G),X=G}).then(Y);return J.cancel=function(){W.unsubscribe(X)},J},x(function(X,J,G){if(W.reason)return;W.reason=new L1(X,J,G),Q(W.reason)})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(x){if(this.reason){x(this.reason);return}if(this._listeners)this._listeners.push(x);else this._listeners=[x]}unsubscribe(x){if(!this._listeners)return;let Q=this._listeners.indexOf(x);if(Q!==-1)this._listeners.splice(Q,1)}toAbortSignal(){let x=new AbortController,Q=(W)=>{x.abort(W)};return this.subscribe(Q),x.signal.unsubscribe=()=>this.unsubscribe(Q),x.signal}static source(){let x;return{token:new T5(function(Y){x=Y}),cancel:x}}}var k$=T5;function k5(x){return function(W){return x.apply(null,W)}}function _5(x){return H.isObject(x)&&x.isAxiosError===!0}var u5={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(u5).forEach(([x,Q])=>{u5[Q]=x});var _$=u5;function u$(x){let Q=new W6(x),W=E8(W6.prototype.request,Q);return H.extend(W,W6.prototype,Q,{allOwnKeys:!0}),H.extend(W,Q,null,{allOwnKeys:!0}),W.create=function(X){return u$(p1(x,X))},W}var C0=u$(kx);C0.Axios=W6;C0.CanceledError=L1;C0.CancelToken=k$;C0.isCancel=p8;C0.VERSION=z4;C0.toFormData=M4;C0.AxiosError=j;C0.Cancel=C0.CanceledError;C0.all=function(Q){return Promise.all(Q)};C0.spread=k5;C0.isAxiosError=_5;C0.mergeConfig=p1;C0.AxiosHeaders=V0;C0.formToJSON=(x)=>M9(H.isHTMLForm(x)?new FormData(x):x);C0.getAdapter=Z9.getAdapter;C0.HttpStatusCode=_$;C0.default=C0;var k9=C0;var C={};G9(C,{void:()=>qD,util:()=>e,unknown:()=>HD,union:()=>UD,undefined:()=>wD,tuple:()=>MD,transformer:()=>iD,symbol:()=>vD,string:()=>o$,strictObject:()=>FD,setErrorMap:()=>TM,set:()=>OD,record:()=>DD,quotelessJson:()=>ZM,promise:()=>PD,preprocess:()=>TD,pipeline:()=>kD,ostring:()=>_D,optional:()=>ZD,onumber:()=>uD,oboolean:()=>lD,objectUtil:()=>l5,object:()=>m5,number:()=>a$,nullable:()=>CD,null:()=>BD,never:()=>VD,nativeEnum:()=>RD,nan:()=>bD,map:()=>jD,makeIssue:()=>Y6,literal:()=>SD,lazy:()=>ID,late:()=>JD,isValid:()=>O4,isDirty:()=>u9,isAsync:()=>gx,isAborted:()=>_9,intersection:()=>LD,instanceof:()=>GD,getParsedType:()=>Y4,getErrorMap:()=>fx,function:()=>AD,enum:()=>ED,effect:()=>iD,discriminatedUnion:()=>cD,defaultErrorMap:()=>w4,datetimeRegex:()=>g$,date:()=>zD,custom:()=>h$,coerce:()=>pD,boolean:()=>d$,bigint:()=>$D,array:()=>ND,any:()=>KD,addIssueToContext:()=>P,ZodVoid:()=>J6,ZodUnknown:()=>A4,ZodUnion:()=>rx,ZodUndefined:()=>ax,ZodType:()=>r,ZodTuple:()=>J4,ZodTransformer:()=>g1,ZodSymbol:()=>X6,ZodString:()=>n1,ZodSet:()=>zx,ZodSchema:()=>r,ZodRecord:()=>G6,ZodReadonly:()=>Y8,ZodPromise:()=>vx,ZodPipeline:()=>z6,ZodParsedType:()=>E,ZodOptional:()=>M1,ZodObject:()=>O0,ZodNumber:()=>I4,ZodNullable:()=>K4,ZodNull:()=>dx,ZodNever:()=>X4,ZodNativeEnum:()=>x8,ZodNaN:()=>$6,ZodMap:()=>b6,ZodLiteral:()=>ex,ZodLazy:()=>tx,ZodIssueCode:()=>A,ZodIntersection:()=>sx,ZodFunction:()=>hx,ZodFirstPartyTypeKind:()=>I,ZodError:()=>K1,ZodEnum:()=>E4,ZodEffects:()=>g1,ZodDiscriminatedUnion:()=>l9,ZodDefault:()=>Q8,ZodDate:()=>bx,ZodCatch:()=>W8,ZodBranded:()=>p9,ZodBoolean:()=>ox,ZodBigInt:()=>S4,ZodArray:()=>m1,ZodAny:()=>$x,Schema:()=>r,ParseStatus:()=>o0,OK:()=>W1,NEVER:()=>nD,INVALID:()=>p,EMPTY_PATH:()=>kM,DIRTY:()=>Gx,BRAND:()=>XD});var e;(function(x){x.assertEqual=(X)=>{};function Q(X){}x.assertIs=Q;function W(X){throw Error()}x.assertNever=W,x.arrayToEnum=(X)=>{let J={};for(let G of X)J[G]=G;return J},x.getValidEnumValues=(X)=>{let J=x.objectKeys(X).filter((b)=>typeof X[X[b]]!=="number"),G={};for(let b of J)G[b]=X[b];return x.objectValues(G)},x.objectValues=(X)=>{return x.objectKeys(X).map(function(J){return X[J]})},x.objectKeys=typeof Object.keys==="function"?(X)=>Object.keys(X):(X)=>{let J=[];for(let G in X)if(Object.prototype.hasOwnProperty.call(X,G))J.push(G);return J},x.find=(X,J)=>{for(let G of X)if(J(G))return G;return},x.isInteger=typeof Number.isInteger==="function"?(X)=>Number.isInteger(X):(X)=>typeof X==="number"&&Number.isFinite(X)&&Math.floor(X)===X;function Y(X,J=" | "){return X.map((G)=>typeof G==="string"?`'${G}'`:G).join(J)}x.joinValues=Y,x.jsonStringifyReplacer=(X,J)=>{if(typeof J==="bigint")return J.toString();return J}})(e||(e={}));var l5;(function(x){x.mergeShapes=(Q,W)=>{return{...Q,...W}}})(l5||(l5={}));var E=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Y4=(x)=>{switch(typeof x){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(x)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":if(Array.isArray(x))return E.array;if(x===null)return E.null;if(x.then&&typeof x.then==="function"&&x.catch&&typeof x.catch==="function")return E.promise;if(typeof Map<"u"&&x instanceof Map)return E.map;if(typeof Set<"u"&&x instanceof Set)return E.set;if(typeof Date<"u"&&x instanceof Date)return E.date;return E.object;default:return E.unknown}};var A=e.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"]),ZM=(x)=>{return JSON.stringify(x,null,2).replace(/"([^"]+)":/g,"$1:")};class K1 extends Error{get errors(){return this.issues}constructor(x){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=x}format(x){let Q=x||function(X){return X.message},W={_errors:[]},Y=(X)=>{for(let J of X.issues)if(J.code==="invalid_union")J.unionErrors.map(Y);else if(J.code==="invalid_return_type")Y(J.returnTypeError);else if(J.code==="invalid_arguments")Y(J.argumentsError);else if(J.path.length===0)W._errors.push(Q(J));else{let G=W,b=0;while(b<J.path.length){let $=J.path[b];if(b!==J.path.length-1)G[$]=G[$]||{_errors:[]};else G[$]=G[$]||{_errors:[]},G[$]._errors.push(Q(J));G=G[$],b++}}};return Y(this),W}static assert(x){if(!(x instanceof K1))throw Error(`Not a ZodError: ${x}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(x=(Q)=>Q.message){let Q={},W=[];for(let Y of this.issues)if(Y.path.length>0){let X=Y.path[0];Q[X]=Q[X]||[],Q[X].push(x(Y))}else W.push(x(Y));return{formErrors:W,fieldErrors:Q}}get formErrors(){return this.flatten()}}K1.create=(x)=>{return new K1(x)};var CM=(x,Q)=>{let W;switch(x.code){case A.invalid_type:if(x.received===E.undefined)W="Required";else W=`Expected ${x.expected}, received ${x.received}`;break;case A.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify(x.expected,e.jsonStringifyReplacer)}`;break;case A.unrecognized_keys:W=`Unrecognized key(s) in object: ${e.joinValues(x.keys,", ")}`;break;case A.invalid_union:W="Invalid input";break;case A.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${e.joinValues(x.options)}`;break;case A.invalid_enum_value:W=`Invalid enum value. Expected ${e.joinValues(x.options)}, received '${x.received}'`;break;case A.invalid_arguments:W="Invalid function arguments";break;case A.invalid_return_type:W="Invalid function return type";break;case A.invalid_date:W="Invalid date";break;case A.invalid_string:if(typeof x.validation==="object")if("includes"in x.validation){if(W=`Invalid input: must include "${x.validation.includes}"`,typeof x.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${x.validation.position}`}else if("startsWith"in x.validation)W=`Invalid input: must start with "${x.validation.startsWith}"`;else if("endsWith"in x.validation)W=`Invalid input: must end with "${x.validation.endsWith}"`;else e.assertNever(x.validation);else if(x.validation!=="regex")W=`Invalid ${x.validation}`;else W="Invalid";break;case A.too_small:if(x.type==="array")W=`Array must contain ${x.exact?"exactly":x.inclusive?"at least":"more than"} ${x.minimum} element(s)`;else if(x.type==="string")W=`String must contain ${x.exact?"exactly":x.inclusive?"at least":"over"} ${x.minimum} character(s)`;else if(x.type==="number")W=`Number must be ${x.exact?"exactly equal to ":x.inclusive?"greater than or equal to ":"greater than "}${x.minimum}`;else if(x.type==="bigint")W=`Number must be ${x.exact?"exactly equal to ":x.inclusive?"greater than or equal to ":"greater than "}${x.minimum}`;else if(x.type==="date")W=`Date must be ${x.exact?"exactly equal to ":x.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(x.minimum))}`;else W="Invalid input";break;case A.too_big:if(x.type==="array")W=`Array must contain ${x.exact?"exactly":x.inclusive?"at most":"less than"} ${x.maximum} element(s)`;else if(x.type==="string")W=`String must contain ${x.exact?"exactly":x.inclusive?"at most":"under"} ${x.maximum} character(s)`;else if(x.type==="number")W=`Number must be ${x.exact?"exactly":x.inclusive?"less than or equal to":"less than"} ${x.maximum}`;else if(x.type==="bigint")W=`BigInt must be ${x.exact?"exactly":x.inclusive?"less than or equal to":"less than"} ${x.maximum}`;else if(x.type==="date")W=`Date must be ${x.exact?"exactly":x.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(x.maximum))}`;else W="Invalid input";break;case A.custom:W="Invalid input";break;case A.invalid_intersection_types:W="Intersection results could not be merged";break;case A.not_multiple_of:W=`Number must be a multiple of ${x.multipleOf}`;break;case A.not_finite:W="Number must be finite";break;default:W=Q.defaultError,e.assertNever(x)}return{message:W}},w4=CM;var l$=w4;function TM(x){l$=x}function fx(){return l$}var Y6=(x)=>{let{data:Q,path:W,errorMaps:Y,issueData:X}=x,J=[...W,...X.path||[]],G={...X,path:J};if(X.message!==void 0)return{...X,path:J,message:X.message};let b="",$=Y.filter((z)=>!!z).slice().reverse();for(let z of $)b=z(G,{data:Q,defaultError:b}).message;return{...X,path:J,message:b}},kM=[];function P(x,Q){let W=fx(),Y=Y6({issueData:Q,data:x.data,path:x.path,errorMaps:[x.common.contextualErrorMap,x.schemaErrorMap,W,W===w4?void 0:w4].filter((X)=>!!X)});x.common.issues.push(Y)}class o0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(x,Q){let W=[];for(let Y of Q){if(Y.status==="aborted")return p;if(Y.status==="dirty")x.dirty();W.push(Y.value)}return{status:x.value,value:W}}static async mergeObjectAsync(x,Q){let W=[];for(let Y of Q){let X=await Y.key,J=await Y.value;W.push({key:X,value:J})}return o0.mergeObjectSync(x,W)}static mergeObjectSync(x,Q){let W={};for(let Y of Q){let{key:X,value:J}=Y;if(X.status==="aborted")return p;if(J.status==="aborted")return p;if(X.status==="dirty")x.dirty();if(J.status==="dirty")x.dirty();if(X.value!=="__proto__"&&(typeof J.value<"u"||Y.alwaysSet))W[X.value]=J.value}return{status:x.value,value:W}}}var p=Object.freeze({status:"aborted"}),Gx=(x)=>({status:"dirty",value:x}),W1=(x)=>({status:"valid",value:x}),_9=(x)=>x.status==="aborted",u9=(x)=>x.status==="dirty",O4=(x)=>x.status==="valid",gx=(x)=>typeof Promise<"u"&&x instanceof Promise;var T;(function(x){x.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},x.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(T||(T={}));class f1{constructor(x,Q,W,Y){this._cachedPath=[],this.parent=x,this.data=Q,this._path=W,this._key=Y}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 p$=(x,Q)=>{if(O4(Q))return{success:!0,data:Q.value};else{if(!x.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new K1(x.common.issues);return this._error=W,this._error}}}};function y(x){if(!x)return{};let{errorMap:Q,invalid_type_error:W,required_error:Y,description:X}=x;if(Q&&(W||Y))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:X};return{errorMap:(G,b)=>{let{message:$}=x;if(G.code==="invalid_enum_value")return{message:$??b.defaultError};if(typeof b.data>"u")return{message:$??Y??b.defaultError};if(G.code!=="invalid_type")return{message:b.defaultError};return{message:$??W??b.defaultError}},description:X}}class r{get description(){return this._def.description}_getType(x){return Y4(x.data)}_getOrReturnCtx(x,Q){return Q||{common:x.parent.common,data:x.data,parsedType:Y4(x.data),schemaErrorMap:this._def.errorMap,path:x.path,parent:x.parent}}_processInputParams(x){return{status:new o0,ctx:{common:x.parent.common,data:x.data,parsedType:Y4(x.data),schemaErrorMap:this._def.errorMap,path:x.path,parent:x.parent}}}_parseSync(x){let Q=this._parse(x);if(gx(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(x){let Q=this._parse(x);return Promise.resolve(Q)}parse(x,Q){let W=this.safeParse(x,Q);if(W.success)return W.data;throw W.error}safeParse(x,Q){let W={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:x,parsedType:Y4(x)},Y=this._parseSync({data:x,path:W.path,parent:W});return p$(W,Y)}"~validate"(x){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:x,parsedType:Y4(x)};if(!this["~standard"].async)try{let W=this._parseSync({data:x,path:[],parent:Q});return O4(W)?{value:W.value}:{issues:Q.common.issues}}catch(W){if(W?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:x,path:[],parent:Q}).then((W)=>O4(W)?{value:W.value}:{issues:Q.common.issues})}async parseAsync(x,Q){let W=await this.safeParseAsync(x,Q);if(W.success)return W.data;throw W.error}async safeParseAsync(x,Q){let W={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:x,parsedType:Y4(x)},Y=this._parse({data:x,path:W.path,parent:W}),X=await(gx(Y)?Y:Promise.resolve(Y));return p$(W,X)}refine(x,Q){let W=(Y)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(Y);else return Q};return this._refinement((Y,X)=>{let J=x(Y),G=()=>X.addIssue({code:A.custom,...W(Y)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((b)=>{if(!b)return G(),!1;else return!0});if(!J)return G(),!1;else return!0})}refinement(x,Q){return this._refinement((W,Y)=>{if(!x(W))return Y.addIssue(typeof Q==="function"?Q(W,Y):Q),!1;else return!0})}_refinement(x){return new g1({schema:this,typeName:I.ZodEffects,effect:{type:"refinement",refinement:x}})}superRefine(x){return this._refinement(x)}constructor(x){this.spa=this.safeParseAsync,this._def=x,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:(Q)=>this["~validate"](Q)}}optional(){return M1.create(this,this._def)}nullable(){return K4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return m1.create(this)}promise(){return vx.create(this,this._def)}or(x){return rx.create([this,x],this._def)}and(x){return sx.create(this,x,this._def)}transform(x){return new g1({...y(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:x}})}default(x){let Q=typeof x==="function"?x:()=>x;return new Q8({...y(this._def),innerType:this,defaultValue:Q,typeName:I.ZodDefault})}brand(){return new p9({typeName:I.ZodBranded,type:this,...y(this._def)})}catch(x){let Q=typeof x==="function"?x:()=>x;return new W8({...y(this._def),innerType:this,catchValue:Q,typeName:I.ZodCatch})}describe(x){return new this.constructor({...this._def,description:x})}pipe(x){return z6.create(this,x)}readonly(){return Y8.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var _M=/^c[^\s-]{8,}$/i,uM=/^[0-9a-z]+$/,lM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pM=/^[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,nM=/^[a-z0-9_-]{21}$/i,mM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fM=/^[-+]?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)?)??$/,gM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",p5,hM=/^(?:(?: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])$/,oM=/^(?:(?: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])$/,aM=/^(([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]))$/,dM=/^(([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])$/,rM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,m$="((\\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])))",tM=new RegExp(`^${m$}$`);function f$(x){let Q="[0-5]\\d";if(x.precision)Q=`${Q}\\.\\d{${x.precision}}`;else if(x.precision==null)Q=`${Q}(\\.\\d+)?`;let W=x.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${W}`}function eM(x){return new RegExp(`^${f$(x)}$`)}function g$(x){let Q=`${m$}T${f$(x)}`,W=[];if(W.push(x.local?"Z?":"Z"),x.offset)W.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${W.join("|")})`,new RegExp(`^${Q}$`)}function xD(x,Q){if((Q==="v4"||!Q)&&hM.test(x))return!0;if((Q==="v6"||!Q)&&aM.test(x))return!0;return!1}function QD(x,Q){if(!mM.test(x))return!1;try{let[W]=x.split(".");if(!W)return!1;let Y=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),X=JSON.parse(atob(Y));if(typeof X!=="object"||X===null)return!1;if("typ"in X&&X?.typ!=="JWT")return!1;if(!X.alg)return!1;if(Q&&X.alg!==Q)return!1;return!0}catch{return!1}}function WD(x,Q){if((Q==="v4"||!Q)&&oM.test(x))return!0;if((Q==="v6"||!Q)&&dM.test(x))return!0;return!1}class n1 extends r{_parse(x){if(this._def.coerce)x.data=String(x.data);if(this._getType(x)!==E.string){let X=this._getOrReturnCtx(x);return P(X,{code:A.invalid_type,expected:E.string,received:X.parsedType}),p}let W=new o0,Y=void 0;for(let X of this._def.checks)if(X.kind==="min"){if(x.data.length<X.value)Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.too_small,minimum:X.value,type:"string",inclusive:!0,exact:!1,message:X.message}),W.dirty()}else if(X.kind==="max"){if(x.data.length>X.value)Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.too_big,maximum:X.value,type:"string",inclusive:!0,exact:!1,message:X.message}),W.dirty()}else if(X.kind==="length"){let J=x.data.length>X.value,G=x.data.length<X.value;if(J||G){if(Y=this._getOrReturnCtx(x,Y),J)P(Y,{code:A.too_big,maximum:X.value,type:"string",inclusive:!0,exact:!0,message:X.message});else if(G)P(Y,{code:A.too_small,minimum:X.value,type:"string",inclusive:!0,exact:!0,message:X.message});W.dirty()}}else if(X.kind==="email"){if(!gM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"email",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="emoji"){if(!p5)p5=new RegExp(yM,"u");if(!p5.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"emoji",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="uuid"){if(!pM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"uuid",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="nanoid"){if(!nM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"nanoid",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="cuid"){if(!_M.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"cuid",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="cuid2"){if(!uM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"cuid2",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="ulid"){if(!lM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"ulid",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="url")try{new URL(x.data)}catch{Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"url",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="regex"){if(X.regex.lastIndex=0,!X.regex.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"regex",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="trim")x.data=x.data.trim();else if(X.kind==="includes"){if(!x.data.includes(X.value,X.position))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:{includes:X.value,position:X.position},message:X.message}),W.dirty()}else if(X.kind==="toLowerCase")x.data=x.data.toLowerCase();else if(X.kind==="toUpperCase")x.data=x.data.toUpperCase();else if(X.kind==="startsWith"){if(!x.data.startsWith(X.value))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:{startsWith:X.value},message:X.message}),W.dirty()}else if(X.kind==="endsWith"){if(!x.data.endsWith(X.value))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:{endsWith:X.value},message:X.message}),W.dirty()}else if(X.kind==="datetime"){if(!g$(X).test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:"datetime",message:X.message}),W.dirty()}else if(X.kind==="date"){if(!tM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:"date",message:X.message}),W.dirty()}else if(X.kind==="time"){if(!eM(X).test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:"time",message:X.message}),W.dirty()}else if(X.kind==="duration"){if(!fM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"duration",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="ip"){if(!xD(x.data,X.version))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"ip",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="jwt"){if(!QD(x.data,X.alg))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"jwt",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="cidr"){if(!WD(x.data,X.version))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"cidr",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="base64"){if(!rM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"base64",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="base64url"){if(!sM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"base64url",code:A.invalid_string,message:X.message}),W.dirty()}else e.assertNever(X);return{status:W.value,value:x.data}}_regex(x,Q,W){return this.refinement((Y)=>x.test(Y),{validation:Q,code:A.invalid_string,...T.errToObj(W)})}_addCheck(x){return new n1({...this._def,checks:[...this._def.checks,x]})}email(x){return this._addCheck({kind:"email",...T.errToObj(x)})}url(x){return this._addCheck({kind:"url",...T.errToObj(x)})}emoji(x){return this._addCheck({kind:"emoji",...T.errToObj(x)})}uuid(x){return this._addCheck({kind:"uuid",...T.errToObj(x)})}nanoid(x){return this._addCheck({kind:"nanoid",...T.errToObj(x)})}cuid(x){return this._addCheck({kind:"cuid",...T.errToObj(x)})}cuid2(x){return this._addCheck({kind:"cuid2",...T.errToObj(x)})}ulid(x){return this._addCheck({kind:"ulid",...T.errToObj(x)})}base64(x){return this._addCheck({kind:"base64",...T.errToObj(x)})}base64url(x){return this._addCheck({kind:"base64url",...T.errToObj(x)})}jwt(x){return this._addCheck({kind:"jwt",...T.errToObj(x)})}ip(x){return this._addCheck({kind:"ip",...T.errToObj(x)})}cidr(x){return this._addCheck({kind:"cidr",...T.errToObj(x)})}datetime(x){if(typeof x==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:x});return this._addCheck({kind:"datetime",precision:typeof x?.precision>"u"?null:x?.precision,offset:x?.offset??!1,local:x?.local??!1,...T.errToObj(x?.message)})}date(x){return this._addCheck({kind:"date",message:x})}time(x){if(typeof x==="string")return this._addCheck({kind:"time",precision:null,message:x});return this._addCheck({kind:"time",precision:typeof x?.precision>"u"?null:x?.precision,...T.errToObj(x?.message)})}duration(x){return this._addCheck({kind:"duration",...T.errToObj(x)})}regex(x,Q){return this._addCheck({kind:"regex",regex:x,...T.errToObj(Q)})}includes(x,Q){return this._addCheck({kind:"includes",value:x,position:Q?.position,...T.errToObj(Q?.message)})}startsWith(x,Q){return this._addCheck({kind:"startsWith",value:x,...T.errToObj(Q)})}endsWith(x,Q){return this._addCheck({kind:"endsWith",value:x,...T.errToObj(Q)})}min(x,Q){return this._addCheck({kind:"min",value:x,...T.errToObj(Q)})}max(x,Q){return this._addCheck({kind:"max",value:x,...T.errToObj(Q)})}length(x,Q){return this._addCheck({kind:"length",value:x,...T.errToObj(Q)})}nonempty(x){return this.min(1,T.errToObj(x))}trim(){return new n1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((x)=>x.kind==="datetime")}get isDate(){return!!this._def.checks.find((x)=>x.kind==="date")}get isTime(){return!!this._def.checks.find((x)=>x.kind==="time")}get isDuration(){return!!this._def.checks.find((x)=>x.kind==="duration")}get isEmail(){return!!this._def.checks.find((x)=>x.kind==="email")}get isURL(){return!!this._def.checks.find((x)=>x.kind==="url")}get isEmoji(){return!!this._def.checks.find((x)=>x.kind==="emoji")}get isUUID(){return!!this._def.checks.find((x)=>x.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((x)=>x.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((x)=>x.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((x)=>x.kind==="cuid2")}get isULID(){return!!this._def.checks.find((x)=>x.kind==="ulid")}get isIP(){return!!this._def.checks.find((x)=>x.kind==="ip")}get isCIDR(){return!!this._def.checks.find((x)=>x.kind==="cidr")}get isBase64(){return!!this._def.checks.find((x)=>x.kind==="base64")}get isBase64url(){return!!this._def.checks.find((x)=>x.kind==="base64url")}get minLength(){let x=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(x===null||Q.value>x)x=Q.value}return x}get maxLength(){let x=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(x===null||Q.value<x)x=Q.value}return x}}n1.create=(x)=>{return new n1({checks:[],typeName:I.ZodString,coerce:x?.coerce??!1,...y(x)})};function YD(x,Q){let W=(x.toString().split(".")[1]||"").length,Y=(Q.toString().split(".")[1]||"").length,X=W>Y?W:Y,J=Number.parseInt(x.toFixed(X).replace(".","")),G=Number.parseInt(Q.toFixed(X).replace(".",""));return J%G/10**X}class I4 extends r{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(x){if(this._def.coerce)x.data=Number(x.data);if(this._getType(x)!==E.number){let X=this._getOrReturnCtx(x);return P(X,{code:A.invalid_type,expected:E.number,received:X.parsedType}),p}let W=void 0,Y=new o0;for(let X of this._def.checks)if(X.kind==="int"){if(!e.isInteger(x.data))W=this._getOrReturnCtx(x,W),P(W,{code:A.invalid_type,expected:"integer",received:"float",message:X.message}),Y.dirty()}else if(X.kind==="min"){if(X.inclusive?x.data<X.value:x.data<=X.value)W=this._getOrReturnCtx(x,W),P(W,{code:A.too_small,minimum:X.value,type:"number",inclusive:X.inclusive,exact:!1,message:X.message}),Y.dirty()}else if(X.kind==="max"){if(X.inclusive?x.data>X.value:x.data>=X.value)W=this._getOrReturnCtx(x,W),P(W,{code:A.too_big,maximum:X.value,type:"number",inclusive:X.inclusive,exact:!1,message:X.message}),Y.dirty()}else if(X.kind==="multipleOf"){if(YD(x.data,X.value)!==0)W=this._getOrReturnCtx(x,W),P(W,{code:A.not_multiple_of,multipleOf:X.value,message:X.message}),Y.dirty()}else if(X.kind==="finite"){if(!Number.isFinite(x.data))W=this._getOrReturnCtx(x,W),P(W,{code:A.not_finite,message:X.message}),Y.dirty()}else e.assertNever(X);return{status:Y.value,value:x.data}}gte(x,Q){return this.setLimit("min",x,!0,T.toString(Q))}gt(x,Q){return this.setLimit("min",x,!1,T.toString(Q))}lte(x,Q){return this.setLimit("max",x,!0,T.toString(Q))}lt(x,Q){return this.setLimit("max",x,!1,T.toString(Q))}setLimit(x,Q,W,Y){return new I4({...this._def,checks:[...this._def.checks,{kind:x,value:Q,inclusive:W,message:T.toString(Y)}]})}_addCheck(x){return new I4({...this._def,checks:[...this._def.checks,x]})}int(x){return this._addCheck({kind:"int",message:T.toString(x)})}positive(x){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(x)})}negative(x){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(x)})}nonpositive(x){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(x)})}nonnegative(x){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(x)})}multipleOf(x,Q){return this._addCheck({kind:"multipleOf",value:x,message:T.toString(Q)})}finite(x){return this._addCheck({kind:"finite",message:T.toString(x)})}safe(x){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(x)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(x)})}get minValue(){let x=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(x===null||Q.value>x)x=Q.value}return x}get maxValue(){let x=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(x===null||Q.value<x)x=Q.value}return x}get isInt(){return!!this._def.checks.find((x)=>x.kind==="int"||x.kind==="multipleOf"&&e.isInteger(x.value))}get isFinite(){let x=null,Q=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(Q===null||W.value>Q)Q=W.value}else if(W.kind==="max"){if(x===null||W.value<x)x=W.value}return Number.isFinite(Q)&&Number.isFinite(x)}}I4.create=(x)=>{return new I4({checks:[],typeName:I.ZodNumber,coerce:x?.coerce||!1,...y(x)})};class S4 extends r{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(x){if(this._def.coerce)try{x.data=BigInt(x.data)}catch{return this._getInvalidInput(x)}if(this._getType(x)!==E.bigint)return this._getInvalidInput(x);let W=void 0,Y=new o0;for(let X of this._def.checks)if(X.kind==="min"){if(X.inclusive?x.data<X.value:x.data<=X.value)W=this._getOrReturnCtx(x,W),P(W,{code:A.too_small,type:"bigint",minimum:X.value,inclusive:X.inclusive,message:X.message}),Y.dirty()}else if(X.kind==="max"){if(X.inclusive?x.data>X.value:x.data>=X.value)W=this._getOrReturnCtx(x,W),P(W,{code:A.too_big,type:"bigint",maximum:X.value,inclusive:X.inclusive,message:X.message}),Y.dirty()}else if(X.kind==="multipleOf"){if(x.data%X.value!==BigInt(0))W=this._getOrReturnCtx(x,W),P(W,{code:A.not_multiple_of,multipleOf:X.value,message:X.message}),Y.dirty()}else e.assertNever(X);return{status:Y.value,value:x.data}}_getInvalidInput(x){let Q=this._getOrReturnCtx(x);return P(Q,{code:A.invalid_type,expected:E.bigint,received:Q.parsedType}),p}gte(x,Q){return this.setLimit("min",x,!0,T.toString(Q))}gt(x,Q){return this.setLimit("min",x,!1,T.toString(Q))}lte(x,Q){return this.setLimit("max",x,!0,T.toString(Q))}lt(x,Q){return this.setLimit("max",x,!1,T.toString(Q))}setLimit(x,Q,W,Y){return new S4({...this._def,checks:[...this._def.checks,{kind:x,value:Q,inclusive:W,message:T.toString(Y)}]})}_addCheck(x){return new S4({...this._def,checks:[...this._def.checks,x]})}positive(x){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(x)})}negative(x){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(x)})}nonpositive(x){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(x)})}nonnegative(x){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(x)})}multipleOf(x,Q){return this._addCheck({kind:"multipleOf",value:x,message:T.toString(Q)})}get minValue(){let x=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(x===null||Q.value>x)x=Q.value}return x}get maxValue(){let x=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(x===null||Q.value<x)x=Q.value}return x}}S4.create=(x)=>{return new S4({checks:[],typeName:I.ZodBigInt,coerce:x?.coerce??!1,...y(x)})};class ox extends r{_parse(x){if(this._def.coerce)x.data=Boolean(x.data);if(this._getType(x)!==E.boolean){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.boolean,received:W.parsedType}),p}return W1(x.data)}}ox.create=(x)=>{return new ox({typeName:I.ZodBoolean,coerce:x?.coerce||!1,...y(x)})};class bx extends r{_parse(x){if(this._def.coerce)x.data=new Date(x.data);if(this._getType(x)!==E.date){let X=this._getOrReturnCtx(x);return P(X,{code:A.invalid_type,expected:E.date,received:X.parsedType}),p}if(Number.isNaN(x.data.getTime())){let X=this._getOrReturnCtx(x);return P(X,{code:A.invalid_date}),p}let W=new o0,Y=void 0;for(let X of this._def.checks)if(X.kind==="min"){if(x.data.getTime()<X.value)Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.too_small,message:X.message,inclusive:!0,exact:!1,minimum:X.value,type:"date"}),W.dirty()}else if(X.kind==="max"){if(x.data.getTime()>X.value)Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.too_big,message:X.message,inclusive:!0,exact:!1,maximum:X.value,type:"date"}),W.dirty()}else e.assertNever(X);return{status:W.value,value:new Date(x.data.getTime())}}_addCheck(x){return new bx({...this._def,checks:[...this._def.checks,x]})}min(x,Q){return this._addCheck({kind:"min",value:x.getTime(),message:T.toString(Q)})}max(x,Q){return this._addCheck({kind:"max",value:x.getTime(),message:T.toString(Q)})}get minDate(){let x=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(x===null||Q.value>x)x=Q.value}return x!=null?new Date(x):null}get maxDate(){let x=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(x===null||Q.value<x)x=Q.value}return x!=null?new Date(x):null}}bx.create=(x)=>{return new bx({checks:[],coerce:x?.coerce||!1,typeName:I.ZodDate,...y(x)})};class X6 extends r{_parse(x){if(this._getType(x)!==E.symbol){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.symbol,received:W.parsedType}),p}return W1(x.data)}}X6.create=(x)=>{return new X6({typeName:I.ZodSymbol,...y(x)})};class ax extends r{_parse(x){if(this._getType(x)!==E.undefined){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.undefined,received:W.parsedType}),p}return W1(x.data)}}ax.create=(x)=>{return new ax({typeName:I.ZodUndefined,...y(x)})};class dx extends r{_parse(x){if(this._getType(x)!==E.null){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.null,received:W.parsedType}),p}return W1(x.data)}}dx.create=(x)=>{return new dx({typeName:I.ZodNull,...y(x)})};class $x extends r{constructor(){super(...arguments);this._any=!0}_parse(x){return W1(x.data)}}$x.create=(x)=>{return new $x({typeName:I.ZodAny,...y(x)})};class A4 extends r{constructor(){super(...arguments);this._unknown=!0}_parse(x){return W1(x.data)}}A4.create=(x)=>{return new A4({typeName:I.ZodUnknown,...y(x)})};class X4 extends r{_parse(x){let Q=this._getOrReturnCtx(x);return P(Q,{code:A.invalid_type,expected:E.never,received:Q.parsedType}),p}}X4.create=(x)=>{return new X4({typeName:I.ZodNever,...y(x)})};class J6 extends r{_parse(x){if(this._getType(x)!==E.undefined){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.void,received:W.parsedType}),p}return W1(x.data)}}J6.create=(x)=>{return new J6({typeName:I.ZodVoid,...y(x)})};class m1 extends r{_parse(x){let{ctx:Q,status:W}=this._processInputParams(x),Y=this._def;if(Q.parsedType!==E.array)return P(Q,{code:A.invalid_type,expected:E.array,received:Q.parsedType}),p;if(Y.exactLength!==null){let J=Q.data.length>Y.exactLength.value,G=Q.data.length<Y.exactLength.value;if(J||G)P(Q,{code:J?A.too_big:A.too_small,minimum:G?Y.exactLength.value:void 0,maximum:J?Y.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Y.exactLength.message}),W.dirty()}if(Y.minLength!==null){if(Q.data.length<Y.minLength.value)P(Q,{code:A.too_small,minimum:Y.minLength.value,type:"array",inclusive:!0,exact:!1,message:Y.minLength.message}),W.dirty()}if(Y.maxLength!==null){if(Q.data.length>Y.maxLength.value)P(Q,{code:A.too_big,maximum:Y.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Y.maxLength.message}),W.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((J,G)=>{return Y.type._parseAsync(new f1(Q,J,Q.path,G))})).then((J)=>{return o0.mergeArray(W,J)});let X=[...Q.data].map((J,G)=>{return Y.type._parseSync(new f1(Q,J,Q.path,G))});return o0.mergeArray(W,X)}get element(){return this._def.type}min(x,Q){return new m1({...this._def,minLength:{value:x,message:T.toString(Q)}})}max(x,Q){return new m1({...this._def,maxLength:{value:x,message:T.toString(Q)}})}length(x,Q){return new m1({...this._def,exactLength:{value:x,message:T.toString(Q)}})}nonempty(x){return this.min(1,x)}}m1.create=(x,Q)=>{return new m1({type:x,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...y(Q)})};function yx(x){if(x instanceof O0){let Q={};for(let W in x.shape){let Y=x.shape[W];Q[W]=M1.create(yx(Y))}return new O0({...x._def,shape:()=>Q})}else if(x instanceof m1)return new m1({...x._def,type:yx(x.element)});else if(x instanceof M1)return M1.create(yx(x.unwrap()));else if(x instanceof K4)return K4.create(yx(x.unwrap()));else if(x instanceof J4)return J4.create(x.items.map((Q)=>yx(Q)));else return x}class O0 extends r{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let x=this._def.shape(),Q=e.objectKeys(x);return this._cached={shape:x,keys:Q},this._cached}_parse(x){if(this._getType(x)!==E.object){let $=this._getOrReturnCtx(x);return P($,{code:A.invalid_type,expected:E.object,received:$.parsedType}),p}let{status:W,ctx:Y}=this._processInputParams(x),{shape:X,keys:J}=this._getCached(),G=[];if(!(this._def.catchall instanceof X4&&this._def.unknownKeys==="strip")){for(let $ in Y.data)if(!J.includes($))G.push($)}let b=[];for(let $ of J){let z=X[$],v=Y.data[$];b.push({key:{status:"valid",value:$},value:z._parse(new f1(Y,v,Y.path,$)),alwaysSet:$ in Y.data})}if(this._def.catchall instanceof X4){let $=this._def.unknownKeys;if($==="passthrough")for(let z of G)b.push({key:{status:"valid",value:z},value:{status:"valid",value:Y.data[z]}});else if($==="strict"){if(G.length>0)P(Y,{code:A.unrecognized_keys,keys:G}),W.dirty()}else if($==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let $=this._def.catchall;for(let z of G){let v=Y.data[z];b.push({key:{status:"valid",value:z},value:$._parse(new f1(Y,v,Y.path,z)),alwaysSet:z in Y.data})}}if(Y.common.async)return Promise.resolve().then(async()=>{let $=[];for(let z of b){let v=await z.key,w=await z.value;$.push({key:v,value:w,alwaysSet:z.alwaysSet})}return $}).then(($)=>{return o0.mergeObjectSync(W,$)});else return o0.mergeObjectSync(W,b)}get shape(){return this._def.shape()}strict(x){return T.errToObj,new O0({...this._def,unknownKeys:"strict",...x!==void 0?{errorMap:(Q,W)=>{let Y=this._def.errorMap?.(Q,W).message??W.defaultError;if(Q.code==="unrecognized_keys")return{message:T.errToObj(x).message??Y};return{message:Y}}}:{}})}strip(){return new O0({...this._def,unknownKeys:"strip"})}passthrough(){return new O0({...this._def,unknownKeys:"passthrough"})}extend(x){return new O0({...this._def,shape:()=>({...this._def.shape(),...x})})}merge(x){return new O0({unknownKeys:x._def.unknownKeys,catchall:x._def.catchall,shape:()=>({...this._def.shape(),...x._def.shape()}),typeName:I.ZodObject})}setKey(x,Q){return this.augment({[x]:Q})}catchall(x){return new O0({...this._def,catchall:x})}pick(x){let Q={};for(let W of e.objectKeys(x))if(x[W]&&this.shape[W])Q[W]=this.shape[W];return new O0({...this._def,shape:()=>Q})}omit(x){let Q={};for(let W of e.objectKeys(this.shape))if(!x[W])Q[W]=this.shape[W];return new O0({...this._def,shape:()=>Q})}deepPartial(){return yx(this)}partial(x){let Q={};for(let W of e.objectKeys(this.shape)){let Y=this.shape[W];if(x&&!x[W])Q[W]=Y;else Q[W]=Y.optional()}return new O0({...this._def,shape:()=>Q})}required(x){let Q={};for(let W of e.objectKeys(this.shape))if(x&&!x[W])Q[W]=this.shape[W];else{let X=this.shape[W];while(X instanceof M1)X=X._def.innerType;Q[W]=X}return new O0({...this._def,shape:()=>Q})}keyof(){return y$(e.objectKeys(this.shape))}}O0.create=(x,Q)=>{return new O0({shape:()=>x,unknownKeys:"strip",catchall:X4.create(),typeName:I.ZodObject,...y(Q)})};O0.strictCreate=(x,Q)=>{return new O0({shape:()=>x,unknownKeys:"strict",catchall:X4.create(),typeName:I.ZodObject,...y(Q)})};O0.lazycreate=(x,Q)=>{return new O0({shape:x,unknownKeys:"strip",catchall:X4.create(),typeName:I.ZodObject,...y(Q)})};class rx extends r{_parse(x){let{ctx:Q}=this._processInputParams(x),W=this._def.options;function Y(X){for(let G of X)if(G.result.status==="valid")return G.result;for(let G of X)if(G.result.status==="dirty")return Q.common.issues.push(...G.ctx.common.issues),G.result;let J=X.map((G)=>new K1(G.ctx.common.issues));return P(Q,{code:A.invalid_union,unionErrors:J}),p}if(Q.common.async)return Promise.all(W.map(async(X)=>{let J={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await X._parseAsync({data:Q.data,path:Q.path,parent:J}),ctx:J}})).then(Y);else{let X=void 0,J=[];for(let b of W){let $={...Q,common:{...Q.common,issues:[]},parent:null},z=b._parseSync({data:Q.data,path:Q.path,parent:$});if(z.status==="valid")return z;else if(z.status==="dirty"&&!X)X={result:z,ctx:$};if($.common.issues.length)J.push($.common.issues)}if(X)return Q.common.issues.push(...X.ctx.common.issues),X.result;let G=J.map((b)=>new K1(b));return P(Q,{code:A.invalid_union,unionErrors:G}),p}}get options(){return this._def.options}}rx.create=(x,Q)=>{return new rx({options:x,typeName:I.ZodUnion,...y(Q)})};var B4=(x)=>{if(x instanceof tx)return B4(x.schema);else if(x instanceof g1)return B4(x.innerType());else if(x instanceof ex)return[x.value];else if(x instanceof E4)return x.options;else if(x instanceof x8)return e.objectValues(x.enum);else if(x instanceof Q8)return B4(x._def.innerType);else if(x instanceof ax)return[void 0];else if(x instanceof dx)return[null];else if(x instanceof M1)return[void 0,...B4(x.unwrap())];else if(x instanceof K4)return[null,...B4(x.unwrap())];else if(x instanceof p9)return B4(x.unwrap());else if(x instanceof Y8)return B4(x.unwrap());else if(x instanceof W8)return B4(x._def.innerType);else return[]};class l9 extends r{_parse(x){let{ctx:Q}=this._processInputParams(x);if(Q.parsedType!==E.object)return P(Q,{code:A.invalid_type,expected:E.object,received:Q.parsedType}),p;let W=this.discriminator,Y=Q.data[W],X=this.optionsMap.get(Y);if(!X)return P(Q,{code:A.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),p;if(Q.common.async)return X._parseAsync({data:Q.data,path:Q.path,parent:Q});else return X._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(x,Q,W){let Y=new Map;for(let X of Q){let J=B4(X.shape[x]);if(!J.length)throw Error(`A discriminator value for key \`${x}\` could not be extracted from all schema options`);for(let G of J){if(Y.has(G))throw Error(`Discriminator property ${String(x)} has duplicate value ${String(G)}`);Y.set(G,X)}}return new l9({typeName:I.ZodDiscriminatedUnion,discriminator:x,options:Q,optionsMap:Y,...y(W)})}}function n5(x,Q){let W=Y4(x),Y=Y4(Q);if(x===Q)return{valid:!0,data:x};else if(W===E.object&&Y===E.object){let X=e.objectKeys(Q),J=e.objectKeys(x).filter((b)=>X.indexOf(b)!==-1),G={...x,...Q};for(let b of J){let $=n5(x[b],Q[b]);if(!$.valid)return{valid:!1};G[b]=$.data}return{valid:!0,data:G}}else if(W===E.array&&Y===E.array){if(x.length!==Q.length)return{valid:!1};let X=[];for(let J=0;J<x.length;J++){let G=x[J],b=Q[J],$=n5(G,b);if(!$.valid)return{valid:!1};X.push($.data)}return{valid:!0,data:X}}else if(W===E.date&&Y===E.date&&+x===+Q)return{valid:!0,data:x};else return{valid:!1}}class sx extends r{_parse(x){let{status:Q,ctx:W}=this._processInputParams(x),Y=(X,J)=>{if(_9(X)||_9(J))return p;let G=n5(X.value,J.value);if(!G.valid)return P(W,{code:A.invalid_intersection_types}),p;if(u9(X)||u9(J))Q.dirty();return{status:Q.value,value:G.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([X,J])=>Y(X,J));else return Y(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}}sx.create=(x,Q,W)=>{return new sx({left:x,right:Q,typeName:I.ZodIntersection,...y(W)})};class J4 extends r{_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.parsedType!==E.array)return P(W,{code:A.invalid_type,expected:E.array,received:W.parsedType}),p;if(W.data.length<this._def.items.length)return P(W,{code:A.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;if(!this._def.rest&&W.data.length>this._def.items.length)P(W,{code:A.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let X=[...W.data].map((J,G)=>{let b=this._def.items[G]||this._def.rest;if(!b)return null;return b._parse(new f1(W,J,W.path,G))}).filter((J)=>!!J);if(W.common.async)return Promise.all(X).then((J)=>{return o0.mergeArray(Q,J)});else return o0.mergeArray(Q,X)}get items(){return this._def.items}rest(x){return new J4({...this._def,rest:x})}}J4.create=(x,Q)=>{if(!Array.isArray(x))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new J4({items:x,typeName:I.ZodTuple,rest:null,...y(Q)})};class G6 extends r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.parsedType!==E.object)return P(W,{code:A.invalid_type,expected:E.object,received:W.parsedType}),p;let Y=[],X=this._def.keyType,J=this._def.valueType;for(let G in W.data)Y.push({key:X._parse(new f1(W,G,W.path,G)),value:J._parse(new f1(W,W.data[G],W.path,G)),alwaysSet:G in W.data});if(W.common.async)return o0.mergeObjectAsync(Q,Y);else return o0.mergeObjectSync(Q,Y)}get element(){return this._def.valueType}static create(x,Q,W){if(Q instanceof r)return new G6({keyType:x,valueType:Q,typeName:I.ZodRecord,...y(W)});return new G6({keyType:n1.create(),valueType:x,typeName:I.ZodRecord,...y(Q)})}}class b6 extends r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.parsedType!==E.map)return P(W,{code:A.invalid_type,expected:E.map,received:W.parsedType}),p;let Y=this._def.keyType,X=this._def.valueType,J=[...W.data.entries()].map(([G,b],$)=>{return{key:Y._parse(new f1(W,G,W.path,[$,"key"])),value:X._parse(new f1(W,b,W.path,[$,"value"]))}});if(W.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let b of J){let $=await b.key,z=await b.value;if($.status==="aborted"||z.status==="aborted")return p;if($.status==="dirty"||z.status==="dirty")Q.dirty();G.set($.value,z.value)}return{status:Q.value,value:G}})}else{let G=new Map;for(let b of J){let{key:$,value:z}=b;if($.status==="aborted"||z.status==="aborted")return p;if($.status==="dirty"||z.status==="dirty")Q.dirty();G.set($.value,z.value)}return{status:Q.value,value:G}}}}b6.create=(x,Q,W)=>{return new b6({valueType:Q,keyType:x,typeName:I.ZodMap,...y(W)})};class zx extends r{_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.parsedType!==E.set)return P(W,{code:A.invalid_type,expected:E.set,received:W.parsedType}),p;let Y=this._def;if(Y.minSize!==null){if(W.data.size<Y.minSize.value)P(W,{code:A.too_small,minimum:Y.minSize.value,type:"set",inclusive:!0,exact:!1,message:Y.minSize.message}),Q.dirty()}if(Y.maxSize!==null){if(W.data.size>Y.maxSize.value)P(W,{code:A.too_big,maximum:Y.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Y.maxSize.message}),Q.dirty()}let X=this._def.valueType;function J(b){let $=new Set;for(let z of b){if(z.status==="aborted")return p;if(z.status==="dirty")Q.dirty();$.add(z.value)}return{status:Q.value,value:$}}let G=[...W.data.values()].map((b,$)=>X._parse(new f1(W,b,W.path,$)));if(W.common.async)return Promise.all(G).then((b)=>J(b));else return J(G)}min(x,Q){return new zx({...this._def,minSize:{value:x,message:T.toString(Q)}})}max(x,Q){return new zx({...this._def,maxSize:{value:x,message:T.toString(Q)}})}size(x,Q){return this.min(x,Q).max(x,Q)}nonempty(x){return this.min(1,x)}}zx.create=(x,Q)=>{return new zx({valueType:x,minSize:null,maxSize:null,typeName:I.ZodSet,...y(Q)})};class hx extends r{constructor(){super(...arguments);this.validate=this.implement}_parse(x){let{ctx:Q}=this._processInputParams(x);if(Q.parsedType!==E.function)return P(Q,{code:A.invalid_type,expected:E.function,received:Q.parsedType}),p;function W(G,b){return Y6({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,fx(),w4].filter(($)=>!!$),issueData:{code:A.invalid_arguments,argumentsError:b}})}function Y(G,b){return Y6({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,fx(),w4].filter(($)=>!!$),issueData:{code:A.invalid_return_type,returnTypeError:b}})}let X={errorMap:Q.common.contextualErrorMap},J=Q.data;if(this._def.returns instanceof vx){let G=this;return W1(async function(...b){let $=new K1([]),z=await G._def.args.parseAsync(b,X).catch((K)=>{throw $.addIssue(W(b,K)),$}),v=await Reflect.apply(J,this,z);return await G._def.returns._def.type.parseAsync(v,X).catch((K)=>{throw $.addIssue(Y(v,K)),$})})}else{let G=this;return W1(function(...b){let $=G._def.args.safeParse(b,X);if(!$.success)throw new K1([W(b,$.error)]);let z=Reflect.apply(J,this,$.data),v=G._def.returns.safeParse(z,X);if(!v.success)throw new K1([Y(z,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...x){return new hx({...this._def,args:J4.create(x).rest(A4.create())})}returns(x){return new hx({...this._def,returns:x})}implement(x){return this.parse(x)}strictImplement(x){return this.parse(x)}static create(x,Q,W){return new hx({args:x?x:J4.create([]).rest(A4.create()),returns:Q||A4.create(),typeName:I.ZodFunction,...y(W)})}}class tx extends r{get schema(){return this._def.getter()}_parse(x){let{ctx:Q}=this._processInputParams(x);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}}tx.create=(x,Q)=>{return new tx({getter:x,typeName:I.ZodLazy,...y(Q)})};class ex extends r{_parse(x){if(x.data!==this._def.value){let Q=this._getOrReturnCtx(x);return P(Q,{received:Q.data,code:A.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:x.data}}get value(){return this._def.value}}ex.create=(x,Q)=>{return new ex({value:x,typeName:I.ZodLiteral,...y(Q)})};function y$(x,Q){return new E4({values:x,typeName:I.ZodEnum,...y(Q)})}class E4 extends r{_parse(x){if(typeof x.data!=="string"){let Q=this._getOrReturnCtx(x),W=this._def.values;return P(Q,{expected:e.joinValues(W),received:Q.parsedType,code:A.invalid_type}),p}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(x.data)){let Q=this._getOrReturnCtx(x),W=this._def.values;return P(Q,{received:Q.data,code:A.invalid_enum_value,options:W}),p}return W1(x.data)}get options(){return this._def.values}get enum(){let x={};for(let Q of this._def.values)x[Q]=Q;return x}get Values(){let x={};for(let Q of this._def.values)x[Q]=Q;return x}get Enum(){let x={};for(let Q of this._def.values)x[Q]=Q;return x}extract(x,Q=this._def){return E4.create(x,{...this._def,...Q})}exclude(x,Q=this._def){return E4.create(this.options.filter((W)=>!x.includes(W)),{...this._def,...Q})}}E4.create=y$;class x8 extends r{_parse(x){let Q=e.getValidEnumValues(this._def.values),W=this._getOrReturnCtx(x);if(W.parsedType!==E.string&&W.parsedType!==E.number){let Y=e.objectValues(Q);return P(W,{expected:e.joinValues(Y),received:W.parsedType,code:A.invalid_type}),p}if(!this._cache)this._cache=new Set(e.getValidEnumValues(this._def.values));if(!this._cache.has(x.data)){let Y=e.objectValues(Q);return P(W,{received:W.data,code:A.invalid_enum_value,options:Y}),p}return W1(x.data)}get enum(){return this._def.values}}x8.create=(x,Q)=>{return new x8({values:x,typeName:I.ZodNativeEnum,...y(Q)})};class vx extends r{unwrap(){return this._def.type}_parse(x){let{ctx:Q}=this._processInputParams(x);if(Q.parsedType!==E.promise&&Q.common.async===!1)return P(Q,{code:A.invalid_type,expected:E.promise,received:Q.parsedType}),p;let W=Q.parsedType===E.promise?Q.data:Promise.resolve(Q.data);return W1(W.then((Y)=>{return this._def.type.parseAsync(Y,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}}vx.create=(x,Q)=>{return new vx({type:x,typeName:I.ZodPromise,...y(Q)})};class g1 extends r{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(x){let{status:Q,ctx:W}=this._processInputParams(x),Y=this._def.effect||null,X={addIssue:(J)=>{if(P(W,J),J.fatal)Q.abort();else Q.dirty()},get path(){return W.path}};if(X.addIssue=X.addIssue.bind(X),Y.type==="preprocess"){let J=Y.transform(W.data,X);if(W.common.async)return Promise.resolve(J).then(async(G)=>{if(Q.value==="aborted")return p;let b=await this._def.schema._parseAsync({data:G,path:W.path,parent:W});if(b.status==="aborted")return p;if(b.status==="dirty")return Gx(b.value);if(Q.value==="dirty")return Gx(b.value);return b});else{if(Q.value==="aborted")return p;let G=this._def.schema._parseSync({data:J,path:W.path,parent:W});if(G.status==="aborted")return p;if(G.status==="dirty")return Gx(G.value);if(Q.value==="dirty")return Gx(G.value);return G}}if(Y.type==="refinement"){let J=(G)=>{let b=Y.refinement(G,X);if(W.common.async)return Promise.resolve(b);if(b instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(W.common.async===!1){let G=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(G.status==="aborted")return p;if(G.status==="dirty")Q.dirty();return J(G.value),{status:Q.value,value:G.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((G)=>{if(G.status==="aborted")return p;if(G.status==="dirty")Q.dirty();return J(G.value).then(()=>{return{status:Q.value,value:G.value}})})}if(Y.type==="transform")if(W.common.async===!1){let J=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!O4(J))return p;let G=Y.transform(J.value,X);if(G instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:G}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((J)=>{if(!O4(J))return p;return Promise.resolve(Y.transform(J.value,X)).then((G)=>({status:Q.value,value:G}))});e.assertNever(Y)}}g1.create=(x,Q,W)=>{return new g1({schema:x,typeName:I.ZodEffects,effect:Q,...y(W)})};g1.createWithPreprocess=(x,Q,W)=>{return new g1({schema:Q,effect:{type:"preprocess",transform:x},typeName:I.ZodEffects,...y(W)})};class M1 extends r{_parse(x){if(this._getType(x)===E.undefined)return W1(void 0);return this._def.innerType._parse(x)}unwrap(){return this._def.innerType}}M1.create=(x,Q)=>{return new M1({innerType:x,typeName:I.ZodOptional,...y(Q)})};class K4 extends r{_parse(x){if(this._getType(x)===E.null)return W1(null);return this._def.innerType._parse(x)}unwrap(){return this._def.innerType}}K4.create=(x,Q)=>{return new K4({innerType:x,typeName:I.ZodNullable,...y(Q)})};class Q8 extends r{_parse(x){let{ctx:Q}=this._processInputParams(x),W=Q.data;if(Q.parsedType===E.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}}Q8.create=(x,Q)=>{return new Q8({innerType:x,typeName:I.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...y(Q)})};class W8 extends r{_parse(x){let{ctx:Q}=this._processInputParams(x),W={...Q,common:{...Q.common,issues:[]}},Y=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(gx(Y))return Y.then((X)=>{return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new K1(W.common.issues)},input:W.data})}});else return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new K1(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}}W8.create=(x,Q)=>{return new W8({innerType:x,typeName:I.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...y(Q)})};class $6 extends r{_parse(x){if(this._getType(x)!==E.nan){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.nan,received:W.parsedType}),p}return{status:"valid",value:x.data}}}$6.create=(x)=>{return new $6({typeName:I.ZodNaN,...y(x)})};var XD=Symbol("zod_brand");class p9 extends r{_parse(x){let{ctx:Q}=this._processInputParams(x),W=Q.data;return this._def.type._parse({data:W,path:Q.path,parent:Q})}unwrap(){return this._def.type}}class z6 extends r{_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.common.async)return(async()=>{let X=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(X.status==="aborted")return p;if(X.status==="dirty")return Q.dirty(),Gx(X.value);else return this._def.out._parseAsync({data:X.value,path:W.path,parent:W})})();else{let Y=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(Y.status==="aborted")return p;if(Y.status==="dirty")return Q.dirty(),{status:"dirty",value:Y.value};else return this._def.out._parseSync({data:Y.value,path:W.path,parent:W})}}static create(x,Q){return new z6({in:x,out:Q,typeName:I.ZodPipeline})}}class Y8 extends r{_parse(x){let Q=this._def.innerType._parse(x),W=(Y)=>{if(O4(Y))Y.value=Object.freeze(Y.value);return Y};return gx(Q)?Q.then((Y)=>W(Y)):W(Q)}unwrap(){return this._def.innerType}}Y8.create=(x,Q)=>{return new Y8({innerType:x,typeName:I.ZodReadonly,...y(Q)})};function n$(x,Q){let W=typeof x==="function"?x(Q):typeof x==="string"?{message:x}:x;return typeof W==="string"?{message:W}:W}function h$(x,Q={},W){if(x)return $x.create().superRefine((Y,X)=>{let J=x(Y);if(J instanceof Promise)return J.then((G)=>{if(!G){let b=n$(Q,Y),$=b.fatal??W??!0;X.addIssue({code:"custom",...b,fatal:$})}});if(!J){let G=n$(Q,Y),b=G.fatal??W??!0;X.addIssue({code:"custom",...G,fatal:b})}return});return $x.create()}var JD={object:O0.lazycreate},I;(function(x){x.ZodString="ZodString",x.ZodNumber="ZodNumber",x.ZodNaN="ZodNaN",x.ZodBigInt="ZodBigInt",x.ZodBoolean="ZodBoolean",x.ZodDate="ZodDate",x.ZodSymbol="ZodSymbol",x.ZodUndefined="ZodUndefined",x.ZodNull="ZodNull",x.ZodAny="ZodAny",x.ZodUnknown="ZodUnknown",x.ZodNever="ZodNever",x.ZodVoid="ZodVoid",x.ZodArray="ZodArray",x.ZodObject="ZodObject",x.ZodUnion="ZodUnion",x.ZodDiscriminatedUnion="ZodDiscriminatedUnion",x.ZodIntersection="ZodIntersection",x.ZodTuple="ZodTuple",x.ZodRecord="ZodRecord",x.ZodMap="ZodMap",x.ZodSet="ZodSet",x.ZodFunction="ZodFunction",x.ZodLazy="ZodLazy",x.ZodLiteral="ZodLiteral",x.ZodEnum="ZodEnum",x.ZodEffects="ZodEffects",x.ZodNativeEnum="ZodNativeEnum",x.ZodOptional="ZodOptional",x.ZodNullable="ZodNullable",x.ZodDefault="ZodDefault",x.ZodCatch="ZodCatch",x.ZodPromise="ZodPromise",x.ZodBranded="ZodBranded",x.ZodPipeline="ZodPipeline",x.ZodReadonly="ZodReadonly"})(I||(I={}));var GD=(x,Q={message:`Input not instance of ${x.name}`})=>h$((W)=>W instanceof x,Q),o$=n1.create,a$=I4.create,bD=$6.create,$D=S4.create,d$=ox.create,zD=bx.create,vD=X6.create,wD=ax.create,BD=dx.create,KD=$x.create,HD=A4.create,VD=X4.create,qD=J6.create,ND=m1.create,m5=O0.create,FD=O0.strictCreate,UD=rx.create,cD=l9.create,LD=sx.create,MD=J4.create,DD=G6.create,jD=b6.create,OD=zx.create,AD=hx.create,ID=tx.create,SD=ex.create,ED=E4.create,RD=x8.create,PD=vx.create,iD=g1.create,ZD=M1.create,CD=K4.create,TD=g1.createWithPreprocess,kD=z6.create,_D=()=>o$().optional(),uD=()=>a$().optional(),lD=()=>d$().optional(),pD={string:(x)=>n1.create({...x,coerce:!0}),number:(x)=>I4.create({...x,coerce:!0}),boolean:(x)=>ox.create({...x,coerce:!0}),bigint:(x)=>S4.create({...x,coerce:!0}),date:(x)=>bx.create({...x,coerce:!0})};var nD=p;var mD=Object.freeze({status:"aborted"});function D(x,Q,W){function Y(b,$){var z;Object.defineProperty(b,"_zod",{value:b._zod??{},enumerable:!1}),(z=b._zod).traits??(z.traits=new Set),b._zod.traits.add(x),Q(b,$);for(let v in G.prototype)if(!(v in b))Object.defineProperty(b,v,{value:G.prototype[v].bind(b)});b._zod.constr=G,b._zod.def=$}let X=W?.Parent??Object;class J extends X{}Object.defineProperty(J,"name",{value:x});function G(b){var $;let z=W?.Parent?new J:this;Y(z,b),($=z._zod).deferred??($.deferred=[]);for(let v of z._zod.deferred)v();return z}return Object.defineProperty(G,"init",{value:Y}),Object.defineProperty(G,Symbol.hasInstance,{value:(b)=>{if(W?.Parent&&b instanceof W.Parent)return!0;return b?._zod?.traits?.has(x)}}),Object.defineProperty(G,"name",{value:x}),G}var fD=Symbol("zod_brand");class R4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var n9={};function D1(x){if(x)Object.assign(n9,x);return n9}var Q0={};G9(Q0,{unwrapMessage:()=>v6,stringifyPrimitive:()=>g9,required:()=>Gj,randomString:()=>sD,propertyKeyTypes:()=>a5,promiseAllObject:()=>rD,primitiveTypes:()=>r$,prefixIssues:()=>G4,pick:()=>Qj,partial:()=>Jj,optionalKeys:()=>d5,omit:()=>Wj,numKeys:()=>tD,nullish:()=>K6,normalizeParams:()=>n,merge:()=>Xj,jsonStringifyReplacer:()=>g5,joinValues:()=>m9,issue:()=>s5,isPlainObject:()=>J8,isObject:()=>X8,getSizableOrigin:()=>t$,getParsedType:()=>eD,getLengthableOrigin:()=>V6,getEnumValues:()=>w6,getElementAtPath:()=>dD,floatSafeRemainder:()=>y5,finalizeIssue:()=>y1,extend:()=>Yj,escapeRegex:()=>P4,esc:()=>wx,defineLazy:()=>q0,createTransparentProxy:()=>xj,clone:()=>j1,cleanRegex:()=>H6,cleanEnum:()=>bj,captureStackTrace:()=>f9,cached:()=>B6,assignProp:()=>h5,assertNotEqual:()=>yD,assertNever:()=>oD,assertIs:()=>hD,assertEqual:()=>gD,assert:()=>aD,allowsEval:()=>o5,aborted:()=>Bx,NUMBER_FORMAT_RANGES:()=>r5,Class:()=>e$,BIGINT_FORMAT_RANGES:()=>s$});function gD(x){return x}function yD(x){return x}function hD(x){}function oD(x){throw Error()}function aD(x){}function w6(x){let Q=Object.values(x).filter((Y)=>typeof Y==="number");return Object.entries(x).filter(([Y,X])=>Q.indexOf(+Y)===-1).map(([Y,X])=>X)}function m9(x,Q="|"){return x.map((W)=>g9(W)).join(Q)}function g5(x,Q){if(typeof Q==="bigint")return Q.toString();return Q}function B6(x){return{get value(){{let W=x();return Object.defineProperty(this,"value",{value:W}),W}throw Error("cached value already set")}}}function K6(x){return x===null||x===void 0}function H6(x){let Q=x.startsWith("^")?1:0,W=x.endsWith("$")?x.length-1:x.length;return x.slice(Q,W)}function y5(x,Q){let W=(x.toString().split(".")[1]||"").length,Y=(Q.toString().split(".")[1]||"").length,X=W>Y?W:Y,J=Number.parseInt(x.toFixed(X).replace(".","")),G=Number.parseInt(Q.toFixed(X).replace(".",""));return J%G/10**X}function q0(x,Q,W){Object.defineProperty(x,Q,{get(){{let X=W();return x[Q]=X,X}throw Error("cached value already set")},set(X){Object.defineProperty(x,Q,{value:X})},configurable:!0})}function h5(x,Q,W){Object.defineProperty(x,Q,{value:W,writable:!0,enumerable:!0,configurable:!0})}function dD(x,Q){if(!Q)return x;return Q.reduce((W,Y)=>W?.[Y],x)}function rD(x){let Q=Object.keys(x),W=Q.map((Y)=>x[Y]);return Promise.all(W).then((Y)=>{let X={};for(let J=0;J<Q.length;J++)X[Q[J]]=Y[J];return X})}function sD(x=10){let W="";for(let Y=0;Y<x;Y++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function wx(x){return JSON.stringify(x)}var f9=Error.captureStackTrace?Error.captureStackTrace:(...x)=>{};function X8(x){return typeof x==="object"&&x!==null&&!Array.isArray(x)}var o5=B6(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(x){return!1}});function J8(x){if(X8(x)===!1)return!1;let Q=x.constructor;if(Q===void 0)return!0;let W=Q.prototype;if(X8(W)===!1)return!1;if(Object.prototype.hasOwnProperty.call(W,"isPrototypeOf")===!1)return!1;return!0}function tD(x){let Q=0;for(let W in x)if(Object.prototype.hasOwnProperty.call(x,W))Q++;return Q}var eD=(x)=>{let Q=typeof x;switch(Q){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(x)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(x))return"array";if(x===null)return"null";if(x.then&&typeof x.then==="function"&&x.catch&&typeof x.catch==="function")return"promise";if(typeof Map<"u"&&x instanceof Map)return"map";if(typeof Set<"u"&&x instanceof Set)return"set";if(typeof Date<"u"&&x instanceof Date)return"date";if(typeof File<"u"&&x instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${Q}`)}},a5=new Set(["string","number","symbol"]),r$=new Set(["string","number","bigint","boolean","symbol","undefined"]);function P4(x){return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function j1(x,Q,W){let Y=new x._zod.constr(Q??x._zod.def);if(!Q||W?.parent)Y._zod.parent=x;return Y}function n(x){let Q=x;if(!Q)return{};if(typeof Q==="string")return{error:()=>Q};if(Q?.message!==void 0){if(Q?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Q.error=Q.message}if(delete Q.message,typeof Q.error==="string")return{...Q,error:()=>Q.error};return Q}function xj(x){let Q;return new Proxy({},{get(W,Y,X){return Q??(Q=x()),Reflect.get(Q,Y,X)},set(W,Y,X,J){return Q??(Q=x()),Reflect.set(Q,Y,X,J)},has(W,Y){return Q??(Q=x()),Reflect.has(Q,Y)},deleteProperty(W,Y){return Q??(Q=x()),Reflect.deleteProperty(Q,Y)},ownKeys(W){return Q??(Q=x()),Reflect.ownKeys(Q)},getOwnPropertyDescriptor(W,Y){return Q??(Q=x()),Reflect.getOwnPropertyDescriptor(Q,Y)},defineProperty(W,Y,X){return Q??(Q=x()),Reflect.defineProperty(Q,Y,X)}})}function g9(x){if(typeof x==="bigint")return x.toString()+"n";if(typeof x==="string")return`"${x}"`;return`${x}`}function d5(x){return Object.keys(x).filter((Q)=>{return x[Q]._zod.optin==="optional"&&x[Q]._zod.optout==="optional"})}var r5={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},s$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Qj(x,Q){let W={},Y=x._zod.def;for(let X in Q){if(!(X in Y.shape))throw Error(`Unrecognized key: "${X}"`);if(!Q[X])continue;W[X]=Y.shape[X]}return j1(x,{...x._zod.def,shape:W,checks:[]})}function Wj(x,Q){let W={...x._zod.def.shape},Y=x._zod.def;for(let X in Q){if(!(X in Y.shape))throw Error(`Unrecognized key: "${X}"`);if(!Q[X])continue;delete W[X]}return j1(x,{...x._zod.def,shape:W,checks:[]})}function Yj(x,Q){if(!J8(Q))throw Error("Invalid input to extend: expected a plain object");let W={...x._zod.def,get shape(){let Y={...x._zod.def.shape,...Q};return h5(this,"shape",Y),Y},checks:[]};return j1(x,W)}function Xj(x,Q){return j1(x,{...x._zod.def,get shape(){let W={...x._zod.def.shape,...Q._zod.def.shape};return h5(this,"shape",W),W},catchall:Q._zod.def.catchall,checks:[]})}function Jj(x,Q,W){let Y=Q._zod.def.shape,X={...Y};if(W)for(let J in W){if(!(J in Y))throw Error(`Unrecognized key: "${J}"`);if(!W[J])continue;X[J]=x?new x({type:"optional",innerType:Y[J]}):Y[J]}else for(let J in Y)X[J]=x?new x({type:"optional",innerType:Y[J]}):Y[J];return j1(Q,{...Q._zod.def,shape:X,checks:[]})}function Gj(x,Q,W){let Y=Q._zod.def.shape,X={...Y};if(W)for(let J in W){if(!(J in X))throw Error(`Unrecognized key: "${J}"`);if(!W[J])continue;X[J]=new x({type:"nonoptional",innerType:Y[J]})}else for(let J in Y)X[J]=new x({type:"nonoptional",innerType:Y[J]});return j1(Q,{...Q._zod.def,shape:X,checks:[]})}function Bx(x,Q=0){for(let W=Q;W<x.issues.length;W++)if(x.issues[W]?.continue!==!0)return!0;return!1}function G4(x,Q){return Q.map((W)=>{var Y;return(Y=W).path??(Y.path=[]),W.path.unshift(x),W})}function v6(x){return typeof x==="string"?x:x?.message}function y1(x,Q,W){let Y={...x,path:x.path??[]};if(!x.message){let X=v6(x.inst?._zod.def?.error?.(x))??v6(Q?.error?.(x))??v6(W.customError?.(x))??v6(W.localeError?.(x))??"Invalid input";Y.message=X}if(delete Y.inst,delete Y.continue,!Q?.reportInput)delete Y.input;return Y}function t$(x){if(x instanceof Set)return"set";if(x instanceof Map)return"map";if(x instanceof File)return"file";return"unknown"}function V6(x){if(Array.isArray(x))return"array";if(typeof x==="string")return"string";return"unknown"}function s5(...x){let[Q,W,Y]=x;if(typeof Q==="string")return{message:Q,code:"custom",input:W,inst:Y};return{...Q}}function bj(x){return Object.entries(x).filter(([Q,W])=>{return Number.isNaN(Number.parseInt(Q,10))}).map((Q)=>Q[1])}class e${constructor(...x){}}var xz=(x,Q)=>{x.name="$ZodError",Object.defineProperty(x,"_zod",{value:x._zod,enumerable:!1}),Object.defineProperty(x,"issues",{value:Q,enumerable:!1}),Object.defineProperty(x,"message",{get(){return JSON.stringify(Q,g5,2)},enumerable:!0}),Object.defineProperty(x,"toString",{value:()=>x.message,enumerable:!1})},y9=D("$ZodError",xz),q6=D("$ZodError",xz,{Parent:Error});function t5(x,Q=(W)=>W.message){let W={},Y=[];for(let X of x.issues)if(X.path.length>0)W[X.path[0]]=W[X.path[0]]||[],W[X.path[0]].push(Q(X));else Y.push(Q(X));return{formErrors:Y,fieldErrors:W}}function e5(x,Q){let W=Q||function(J){return J.message},Y={_errors:[]},X=(J)=>{for(let G of J.issues)if(G.code==="invalid_union"&&G.errors.length)G.errors.map((b)=>X({issues:b}));else if(G.code==="invalid_key")X({issues:G.issues});else if(G.code==="invalid_element")X({issues:G.issues});else if(G.path.length===0)Y._errors.push(W(G));else{let b=Y,$=0;while($<G.path.length){let z=G.path[$];if($!==G.path.length-1)b[z]=b[z]||{_errors:[]};else b[z]=b[z]||{_errors:[]},b[z]._errors.push(W(G));b=b[z],$++}}};return X(x),Y}var xQ=(x)=>(Q,W,Y,X)=>{let J=Y?Object.assign(Y,{async:!1}):{async:!1},G=Q._zod.run({value:W,issues:[]},J);if(G instanceof Promise)throw new R4;if(G.issues.length){let b=new(X?.Err??x)(G.issues.map(($)=>y1($,J,D1())));throw f9(b,X?.callee),b}return G.value},QQ=xQ(q6),WQ=(x)=>async(Q,W,Y,X)=>{let J=Y?Object.assign(Y,{async:!0}):{async:!0},G=Q._zod.run({value:W,issues:[]},J);if(G instanceof Promise)G=await G;if(G.issues.length){let b=new(X?.Err??x)(G.issues.map(($)=>y1($,J,D1())));throw f9(b,X?.callee),b}return G.value},YQ=WQ(q6),XQ=(x)=>(Q,W,Y)=>{let X=Y?{...Y,async:!1}:{async:!1},J=Q._zod.run({value:W,issues:[]},X);if(J instanceof Promise)throw new R4;return J.issues.length?{success:!1,error:new(x??y9)(J.issues.map((G)=>y1(G,X,D1())))}:{success:!0,data:J.value}},Kx=XQ(q6),JQ=(x)=>async(Q,W,Y)=>{let X=Y?Object.assign(Y,{async:!0}):{async:!0},J=Q._zod.run({value:W,issues:[]},X);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new x(J.issues.map((G)=>y1(G,X,D1())))}:{success:!0,data:J.value}},Hx=JQ(q6);var Qz=/^[cC][^\s-]{8,}$/,Wz=/^[0-9a-z]+$/,Yz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Xz=/^[0-9a-vA-V]{20}$/,Jz=/^[A-Za-z0-9]{27}$/,Gz=/^[a-zA-Z0-9_-]{21}$/,bz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var $z=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,GQ=(x)=>{if(!x)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${x}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var zz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function vz(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var wz=/^(?:(?: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])$/,Bz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Kz=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Hz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bQ=/^[A-Za-z0-9_-]*$/,qz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Nz=/^\+(?:[0-9]){6,14}[0-9]$/,Fz="(?:(?:\\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])))",Uz=new RegExp(`^${Fz}$`);function cz(x){return typeof x.precision==="number"?x.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":x.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${x.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Lz(x){return new RegExp(`^${cz(x)}$`)}function Mz(x){let Q=cz({precision:x.precision}),W=["Z"];if(x.local)W.push("");if(x.offset)W.push("([+-]\\d{2}:\\d{2})");let Y=`${Q}(?:${W.join("|")})`;return new RegExp(`^${Fz}T(?:${Y})$`)}var Dz=(x)=>{let Q=x?`[\\s\\S]{${x?.minimum??0},${x?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Q}$`)};var jz=/^\d+$/,Oz=/^-?\d+(?:\.\d+)?/i,Az=/true|false/i,Iz=/null/i;var Sz=/^[^A-Z]*$/,Ez=/^[^a-z]*$/;var a0=D("$ZodCheck",(x,Q)=>{var W;x._zod??(x._zod={}),x._zod.def=Q,(W=x._zod).onattach??(W.onattach=[])}),Rz={number:"number",bigint:"bigint",object:"date"},$Q=D("$ZodCheckLessThan",(x,Q)=>{a0.init(x,Q);let W=Rz[typeof Q.value];x._zod.onattach.push((Y)=>{let X=Y._zod.bag,J=(Q.inclusive?X.maximum:X.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Q.value<J)if(Q.inclusive)X.maximum=Q.value;else X.exclusiveMaximum=Q.value}),x._zod.check=(Y)=>{if(Q.inclusive?Y.value<=Q.value:Y.value<Q.value)return;Y.issues.push({origin:W,code:"too_big",maximum:Q.value,input:Y.value,inclusive:Q.inclusive,inst:x,continue:!Q.abort})}}),zQ=D("$ZodCheckGreaterThan",(x,Q)=>{a0.init(x,Q);let W=Rz[typeof Q.value];x._zod.onattach.push((Y)=>{let X=Y._zod.bag,J=(Q.inclusive?X.minimum:X.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Q.value>J)if(Q.inclusive)X.minimum=Q.value;else X.exclusiveMinimum=Q.value}),x._zod.check=(Y)=>{if(Q.inclusive?Y.value>=Q.value:Y.value>Q.value)return;Y.issues.push({origin:W,code:"too_small",minimum:Q.value,input:Y.value,inclusive:Q.inclusive,inst:x,continue:!Q.abort})}}),Pz=D("$ZodCheckMultipleOf",(x,Q)=>{a0.init(x,Q),x._zod.onattach.push((W)=>{var Y;(Y=W._zod.bag).multipleOf??(Y.multipleOf=Q.value)}),x._zod.check=(W)=>{if(typeof W.value!==typeof Q.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%Q.value===BigInt(0):y5(W.value,Q.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:Q.value,input:W.value,inst:x,continue:!Q.abort})}}),iz=D("$ZodCheckNumberFormat",(x,Q)=>{a0.init(x,Q),Q.format=Q.format||"float64";let W=Q.format?.includes("int"),Y=W?"int":"number",[X,J]=r5[Q.format];x._zod.onattach.push((G)=>{let b=G._zod.bag;if(b.format=Q.format,b.minimum=X,b.maximum=J,W)b.pattern=jz}),x._zod.check=(G)=>{let b=G.value;if(W){if(!Number.isInteger(b)){G.issues.push({expected:Y,format:Q.format,code:"invalid_type",input:b,inst:x});return}if(!Number.isSafeInteger(b)){if(b>0)G.issues.push({input:b,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:x,origin:Y,continue:!Q.abort});else G.issues.push({input:b,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:x,origin:Y,continue:!Q.abort});return}}if(b<X)G.issues.push({origin:"number",input:b,code:"too_small",minimum:X,inclusive:!0,inst:x,continue:!Q.abort});if(b>J)G.issues.push({origin:"number",input:b,code:"too_big",maximum:J,inst:x})}});var Zz=D("$ZodCheckMaxLength",(x,Q)=>{var W;a0.init(x,Q),(W=x._zod.def).when??(W.when=(Y)=>{let X=Y.value;return!K6(X)&&X.length!==void 0}),x._zod.onattach.push((Y)=>{let X=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Q.maximum<X)Y._zod.bag.maximum=Q.maximum}),x._zod.check=(Y)=>{let X=Y.value;if(X.length<=Q.maximum)return;let G=V6(X);Y.issues.push({origin:G,code:"too_big",maximum:Q.maximum,inclusive:!0,input:X,inst:x,continue:!Q.abort})}}),Cz=D("$ZodCheckMinLength",(x,Q)=>{var W;a0.init(x,Q),(W=x._zod.def).when??(W.when=(Y)=>{let X=Y.value;return!K6(X)&&X.length!==void 0}),x._zod.onattach.push((Y)=>{let X=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Q.minimum>X)Y._zod.bag.minimum=Q.minimum}),x._zod.check=(Y)=>{let X=Y.value;if(X.length>=Q.minimum)return;let G=V6(X);Y.issues.push({origin:G,code:"too_small",minimum:Q.minimum,inclusive:!0,input:X,inst:x,continue:!Q.abort})}}),Tz=D("$ZodCheckLengthEquals",(x,Q)=>{var W;a0.init(x,Q),(W=x._zod.def).when??(W.when=(Y)=>{let X=Y.value;return!K6(X)&&X.length!==void 0}),x._zod.onattach.push((Y)=>{let X=Y._zod.bag;X.minimum=Q.length,X.maximum=Q.length,X.length=Q.length}),x._zod.check=(Y)=>{let X=Y.value,J=X.length;if(J===Q.length)return;let G=V6(X),b=J>Q.length;Y.issues.push({origin:G,...b?{code:"too_big",maximum:Q.length}:{code:"too_small",minimum:Q.length},inclusive:!0,exact:!0,input:Y.value,inst:x,continue:!Q.abort})}}),N6=D("$ZodCheckStringFormat",(x,Q)=>{var W,Y;if(a0.init(x,Q),x._zod.onattach.push((X)=>{let J=X._zod.bag;if(J.format=Q.format,Q.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(Q.pattern)}),Q.pattern)(W=x._zod).check??(W.check=(X)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(X.value))return;X.issues.push({origin:"string",code:"invalid_format",format:Q.format,input:X.value,...Q.pattern?{pattern:Q.pattern.toString()}:{},inst:x,continue:!Q.abort})});else(Y=x._zod).check??(Y.check=()=>{})}),kz=D("$ZodCheckRegex",(x,Q)=>{N6.init(x,Q),x._zod.check=(W)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:Q.pattern.toString(),inst:x,continue:!Q.abort})}}),_z=D("$ZodCheckLowerCase",(x,Q)=>{Q.pattern??(Q.pattern=Sz),N6.init(x,Q)}),uz=D("$ZodCheckUpperCase",(x,Q)=>{Q.pattern??(Q.pattern=Ez),N6.init(x,Q)}),lz=D("$ZodCheckIncludes",(x,Q)=>{a0.init(x,Q);let W=P4(Q.includes),Y=new RegExp(typeof Q.position==="number"?`^.{${Q.position}}${W}`:W);Q.pattern=Y,x._zod.onattach.push((X)=>{let J=X._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(Y)}),x._zod.check=(X)=>{if(X.value.includes(Q.includes,Q.position))return;X.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Q.includes,input:X.value,inst:x,continue:!Q.abort})}}),pz=D("$ZodCheckStartsWith",(x,Q)=>{a0.init(x,Q);let W=new RegExp(`^${P4(Q.prefix)}.*`);Q.pattern??(Q.pattern=W),x._zod.onattach.push((Y)=>{let X=Y._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),x._zod.check=(Y)=>{if(Y.value.startsWith(Q.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Q.prefix,input:Y.value,inst:x,continue:!Q.abort})}}),nz=D("$ZodCheckEndsWith",(x,Q)=>{a0.init(x,Q);let W=new RegExp(`.*${P4(Q.suffix)}$`);Q.pattern??(Q.pattern=W),x._zod.onattach.push((Y)=>{let X=Y._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),x._zod.check=(Y)=>{if(Y.value.endsWith(Q.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Q.suffix,input:Y.value,inst:x,continue:!Q.abort})}});var mz=D("$ZodCheckOverwrite",(x,Q)=>{a0.init(x,Q),x._zod.check=(W)=>{W.value=Q.tx(W.value)}});class vQ{constructor(x=[]){if(this.content=[],this.indent=0,this)this.args=x}indented(x){this.indent+=1,x(this),this.indent-=1}write(x){if(typeof x==="function"){x(this,{execution:"sync"}),x(this,{execution:"async"});return}let W=x.split(`
|
|
35
|
+
`+X}}catch(J){}}throw W}}_request(x,Q){if(typeof x==="string")Q=Q||{},Q.url=x;else Q=x||{};Q=p1(this.defaults,Q);let{transitional:W,paramsSerializer:Y,headers:X}=Q;if(W!==void 0)x6.assertOptions(W,{silentJSONParsing:Q1.transitional(Q1.boolean),forcedJSONParsing:Q1.transitional(Q1.boolean),clarifyTimeoutError:Q1.transitional(Q1.boolean),legacyInterceptorReqResOrdering:Q1.transitional(Q1.boolean),advertiseZstdAcceptEncoding:Q1.transitional(Q1.boolean),validateStatusUndefinedResolves:Q1.transitional(Q1.boolean)},!1);if(Y!=null)if(H.isFunction(Y))Q.paramsSerializer={serialize:Y};else x6.assertOptions(Y,{encode:Q1.function,serialize:Q1.function},!0);if(Q.allowAbsoluteUrls!==void 0);else if(this.defaults.allowAbsoluteUrls!==void 0)Q.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls;else Q.allowAbsoluteUrls=!0;x6.assertOptions(Q,{baseUrl:Q1.spelling("baseURL"),withXsrfToken:Q1.spelling("withXSRFToken")},!0),Q.method=(Q.method||this.defaults.method||"get").toLowerCase();let J=X&&H.merge(X.common,X[Q.method]);X&&H.forEach(["delete","get","head","post","put","patch","query","common"],(B)=>{delete X[B]}),Q.headers=V0.concat(J,X);let G=[],b=!0;this.interceptors.request.forEach(function(V){if(typeof V.runWhen==="function"&&V.runWhen(Q)===!1)return;b=b&&V.synchronous;let N=Q.transitional||D4;if(N&&N.legacyInterceptorReqResOrdering)G.unshift(V.fulfilled,V.rejected);else G.push(V.fulfilled,V.rejected)});let $=[];this.interceptors.response.forEach(function(V){$.push(V.fulfilled,V.rejected)});let z,v=0,w;if(!b){let B=[C9.bind(this),void 0];B.unshift(...G),B.push(...$),w=B.length,z=Promise.resolve(Q);while(v<w)z=z.then(B[v++],B[v++]);return z}w=G.length;let K=Q;while(v<w){let B=G[v++],V=G[v++];try{K=B(K)}catch(N){V.call(this,N);break}}try{z=C9.call(this,K)}catch(B){return Promise.reject(B)}v=0,w=$.length;while(v<w)z=z.then($[v++],$[v++]);return z}getUri(x){x=p1(this.defaults,x);let Q=e4(x.baseURL,x.url,x.allowAbsoluteUrls,x);return t4(Q,x.params,x.paramsSerializer)}}H.forEach(["delete","get","head","options"],function(Q){Q6.prototype[Q]=function(W,Y){return this.request(p1(Y||{},{method:Q,url:W,data:Y&&H.hasOwnProp(Y,"data")?Y.data:void 0}))}});H.forEach(["post","put","patch","query"],function(Q){function W(Y){return function(J,G,b){return this.request(p1(b||{},{method:Q,headers:Y?{"Content-Type":"multipart/form-data"}:{},url:J,data:G}))}}if(Q6.prototype[Q]=W(),Q!=="query")Q6.prototype[Q+"Form"]=W(!0)});var W6=Q6;class T5{constructor(x){if(typeof x!=="function")throw TypeError("executor must be a function.");let Q;this.promise=new Promise(function(X){Q=X});let W=this;this.promise.then((Y)=>{if(!W._listeners)return;let X=W._listeners.length;while(X-- >0)W._listeners[X](Y);W._listeners=null}),this.promise.then=(Y)=>{let X,J=new Promise((G)=>{W.subscribe(G),X=G}).then(Y);return J.cancel=function(){W.unsubscribe(X)},J},x(function(X,J,G){if(W.reason)return;W.reason=new L1(X,J,G),Q(W.reason)})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(x){if(this.reason){x(this.reason);return}if(this._listeners)this._listeners.push(x);else this._listeners=[x]}unsubscribe(x){if(!this._listeners)return;let Q=this._listeners.indexOf(x);if(Q!==-1)this._listeners.splice(Q,1)}toAbortSignal(){let x=new AbortController,Q=(W)=>{x.abort(W)};return this.subscribe(Q),x.signal.unsubscribe=()=>this.unsubscribe(Q),x.signal}static source(){let x;return{token:new T5(function(Y){x=Y}),cancel:x}}}var k$=T5;function k5(x){return function(W){return x.apply(null,W)}}function _5(x){return H.isObject(x)&&x.isAxiosError===!0}var u5={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(u5).forEach(([x,Q])=>{u5[Q]=x});var _$=u5;function u$(x){let Q=new W6(x),W=E8(W6.prototype.request,Q);return H.extend(W,W6.prototype,Q,{allOwnKeys:!0}),H.extend(W,Q,null,{allOwnKeys:!0}),W.create=function(X){return u$(p1(x,X))},W}var C0=u$(kx);C0.Axios=W6;C0.CanceledError=L1;C0.CancelToken=k$;C0.isCancel=p8;C0.VERSION=z4;C0.toFormData=M4;C0.AxiosError=j;C0.Cancel=C0.CanceledError;C0.all=function(Q){return Promise.all(Q)};C0.spread=k5;C0.isAxiosError=_5;C0.mergeConfig=p1;C0.AxiosHeaders=V0;C0.formToJSON=(x)=>M9(H.isHTMLForm(x)?new FormData(x):x);C0.getAdapter=Z9.getAdapter;C0.HttpStatusCode=_$;C0.default=C0;var k9=C0;var Z={};G9(Z,{void:()=>qD,util:()=>e,unknown:()=>HD,union:()=>UD,undefined:()=>wD,tuple:()=>MD,transformer:()=>iD,symbol:()=>vD,string:()=>o$,strictObject:()=>FD,setErrorMap:()=>TM,set:()=>OD,record:()=>DD,quotelessJson:()=>ZM,promise:()=>PD,preprocess:()=>TD,pipeline:()=>kD,ostring:()=>_D,optional:()=>ZD,onumber:()=>uD,oboolean:()=>lD,objectUtil:()=>l5,object:()=>m5,number:()=>a$,nullable:()=>CD,null:()=>BD,never:()=>VD,nativeEnum:()=>RD,nan:()=>bD,map:()=>jD,makeIssue:()=>Y6,literal:()=>SD,lazy:()=>ID,late:()=>JD,isValid:()=>O4,isDirty:()=>u9,isAsync:()=>gx,isAborted:()=>_9,intersection:()=>LD,instanceof:()=>GD,getParsedType:()=>Y4,getErrorMap:()=>fx,function:()=>AD,enum:()=>ED,effect:()=>iD,discriminatedUnion:()=>cD,defaultErrorMap:()=>w4,datetimeRegex:()=>g$,date:()=>zD,custom:()=>h$,coerce:()=>pD,boolean:()=>d$,bigint:()=>$D,array:()=>ND,any:()=>KD,addIssueToContext:()=>P,ZodVoid:()=>J6,ZodUnknown:()=>A4,ZodUnion:()=>rx,ZodUndefined:()=>ax,ZodType:()=>r,ZodTuple:()=>J4,ZodTransformer:()=>g1,ZodSymbol:()=>X6,ZodString:()=>n1,ZodSet:()=>zx,ZodSchema:()=>r,ZodRecord:()=>G6,ZodReadonly:()=>Y8,ZodPromise:()=>vx,ZodPipeline:()=>z6,ZodParsedType:()=>E,ZodOptional:()=>M1,ZodObject:()=>O0,ZodNumber:()=>I4,ZodNullable:()=>K4,ZodNull:()=>dx,ZodNever:()=>X4,ZodNativeEnum:()=>x8,ZodNaN:()=>$6,ZodMap:()=>b6,ZodLiteral:()=>ex,ZodLazy:()=>tx,ZodIssueCode:()=>A,ZodIntersection:()=>sx,ZodFunction:()=>hx,ZodFirstPartyTypeKind:()=>I,ZodError:()=>K1,ZodEnum:()=>E4,ZodEffects:()=>g1,ZodDiscriminatedUnion:()=>l9,ZodDefault:()=>Q8,ZodDate:()=>bx,ZodCatch:()=>W8,ZodBranded:()=>p9,ZodBoolean:()=>ox,ZodBigInt:()=>S4,ZodArray:()=>m1,ZodAny:()=>$x,Schema:()=>r,ParseStatus:()=>o0,OK:()=>W1,NEVER:()=>nD,INVALID:()=>p,EMPTY_PATH:()=>kM,DIRTY:()=>Gx,BRAND:()=>XD});var e;(function(x){x.assertEqual=(X)=>{};function Q(X){}x.assertIs=Q;function W(X){throw Error()}x.assertNever=W,x.arrayToEnum=(X)=>{let J={};for(let G of X)J[G]=G;return J},x.getValidEnumValues=(X)=>{let J=x.objectKeys(X).filter((b)=>typeof X[X[b]]!=="number"),G={};for(let b of J)G[b]=X[b];return x.objectValues(G)},x.objectValues=(X)=>{return x.objectKeys(X).map(function(J){return X[J]})},x.objectKeys=typeof Object.keys==="function"?(X)=>Object.keys(X):(X)=>{let J=[];for(let G in X)if(Object.prototype.hasOwnProperty.call(X,G))J.push(G);return J},x.find=(X,J)=>{for(let G of X)if(J(G))return G;return},x.isInteger=typeof Number.isInteger==="function"?(X)=>Number.isInteger(X):(X)=>typeof X==="number"&&Number.isFinite(X)&&Math.floor(X)===X;function Y(X,J=" | "){return X.map((G)=>typeof G==="string"?`'${G}'`:G).join(J)}x.joinValues=Y,x.jsonStringifyReplacer=(X,J)=>{if(typeof J==="bigint")return J.toString();return J}})(e||(e={}));var l5;(function(x){x.mergeShapes=(Q,W)=>{return{...Q,...W}}})(l5||(l5={}));var E=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Y4=(x)=>{switch(typeof x){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(x)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":if(Array.isArray(x))return E.array;if(x===null)return E.null;if(x.then&&typeof x.then==="function"&&x.catch&&typeof x.catch==="function")return E.promise;if(typeof Map<"u"&&x instanceof Map)return E.map;if(typeof Set<"u"&&x instanceof Set)return E.set;if(typeof Date<"u"&&x instanceof Date)return E.date;return E.object;default:return E.unknown}};var A=e.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"]),ZM=(x)=>{return JSON.stringify(x,null,2).replace(/"([^"]+)":/g,"$1:")};class K1 extends Error{get errors(){return this.issues}constructor(x){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let Q=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Q);else this.__proto__=Q;this.name="ZodError",this.issues=x}format(x){let Q=x||function(X){return X.message},W={_errors:[]},Y=(X)=>{for(let J of X.issues)if(J.code==="invalid_union")J.unionErrors.map(Y);else if(J.code==="invalid_return_type")Y(J.returnTypeError);else if(J.code==="invalid_arguments")Y(J.argumentsError);else if(J.path.length===0)W._errors.push(Q(J));else{let G=W,b=0;while(b<J.path.length){let $=J.path[b];if(b!==J.path.length-1)G[$]=G[$]||{_errors:[]};else G[$]=G[$]||{_errors:[]},G[$]._errors.push(Q(J));G=G[$],b++}}};return Y(this),W}static assert(x){if(!(x instanceof K1))throw Error(`Not a ZodError: ${x}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(x=(Q)=>Q.message){let Q={},W=[];for(let Y of this.issues)if(Y.path.length>0){let X=Y.path[0];Q[X]=Q[X]||[],Q[X].push(x(Y))}else W.push(x(Y));return{formErrors:W,fieldErrors:Q}}get formErrors(){return this.flatten()}}K1.create=(x)=>{return new K1(x)};var CM=(x,Q)=>{let W;switch(x.code){case A.invalid_type:if(x.received===E.undefined)W="Required";else W=`Expected ${x.expected}, received ${x.received}`;break;case A.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify(x.expected,e.jsonStringifyReplacer)}`;break;case A.unrecognized_keys:W=`Unrecognized key(s) in object: ${e.joinValues(x.keys,", ")}`;break;case A.invalid_union:W="Invalid input";break;case A.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${e.joinValues(x.options)}`;break;case A.invalid_enum_value:W=`Invalid enum value. Expected ${e.joinValues(x.options)}, received '${x.received}'`;break;case A.invalid_arguments:W="Invalid function arguments";break;case A.invalid_return_type:W="Invalid function return type";break;case A.invalid_date:W="Invalid date";break;case A.invalid_string:if(typeof x.validation==="object")if("includes"in x.validation){if(W=`Invalid input: must include "${x.validation.includes}"`,typeof x.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${x.validation.position}`}else if("startsWith"in x.validation)W=`Invalid input: must start with "${x.validation.startsWith}"`;else if("endsWith"in x.validation)W=`Invalid input: must end with "${x.validation.endsWith}"`;else e.assertNever(x.validation);else if(x.validation!=="regex")W=`Invalid ${x.validation}`;else W="Invalid";break;case A.too_small:if(x.type==="array")W=`Array must contain ${x.exact?"exactly":x.inclusive?"at least":"more than"} ${x.minimum} element(s)`;else if(x.type==="string")W=`String must contain ${x.exact?"exactly":x.inclusive?"at least":"over"} ${x.minimum} character(s)`;else if(x.type==="number")W=`Number must be ${x.exact?"exactly equal to ":x.inclusive?"greater than or equal to ":"greater than "}${x.minimum}`;else if(x.type==="bigint")W=`Number must be ${x.exact?"exactly equal to ":x.inclusive?"greater than or equal to ":"greater than "}${x.minimum}`;else if(x.type==="date")W=`Date must be ${x.exact?"exactly equal to ":x.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(x.minimum))}`;else W="Invalid input";break;case A.too_big:if(x.type==="array")W=`Array must contain ${x.exact?"exactly":x.inclusive?"at most":"less than"} ${x.maximum} element(s)`;else if(x.type==="string")W=`String must contain ${x.exact?"exactly":x.inclusive?"at most":"under"} ${x.maximum} character(s)`;else if(x.type==="number")W=`Number must be ${x.exact?"exactly":x.inclusive?"less than or equal to":"less than"} ${x.maximum}`;else if(x.type==="bigint")W=`BigInt must be ${x.exact?"exactly":x.inclusive?"less than or equal to":"less than"} ${x.maximum}`;else if(x.type==="date")W=`Date must be ${x.exact?"exactly":x.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(x.maximum))}`;else W="Invalid input";break;case A.custom:W="Invalid input";break;case A.invalid_intersection_types:W="Intersection results could not be merged";break;case A.not_multiple_of:W=`Number must be a multiple of ${x.multipleOf}`;break;case A.not_finite:W="Number must be finite";break;default:W=Q.defaultError,e.assertNever(x)}return{message:W}},w4=CM;var l$=w4;function TM(x){l$=x}function fx(){return l$}var Y6=(x)=>{let{data:Q,path:W,errorMaps:Y,issueData:X}=x,J=[...W,...X.path||[]],G={...X,path:J};if(X.message!==void 0)return{...X,path:J,message:X.message};let b="",$=Y.filter((z)=>!!z).slice().reverse();for(let z of $)b=z(G,{data:Q,defaultError:b}).message;return{...X,path:J,message:b}},kM=[];function P(x,Q){let W=fx(),Y=Y6({issueData:Q,data:x.data,path:x.path,errorMaps:[x.common.contextualErrorMap,x.schemaErrorMap,W,W===w4?void 0:w4].filter((X)=>!!X)});x.common.issues.push(Y)}class o0{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(x,Q){let W=[];for(let Y of Q){if(Y.status==="aborted")return p;if(Y.status==="dirty")x.dirty();W.push(Y.value)}return{status:x.value,value:W}}static async mergeObjectAsync(x,Q){let W=[];for(let Y of Q){let X=await Y.key,J=await Y.value;W.push({key:X,value:J})}return o0.mergeObjectSync(x,W)}static mergeObjectSync(x,Q){let W={};for(let Y of Q){let{key:X,value:J}=Y;if(X.status==="aborted")return p;if(J.status==="aborted")return p;if(X.status==="dirty")x.dirty();if(J.status==="dirty")x.dirty();if(X.value!=="__proto__"&&(typeof J.value<"u"||Y.alwaysSet))W[X.value]=J.value}return{status:x.value,value:W}}}var p=Object.freeze({status:"aborted"}),Gx=(x)=>({status:"dirty",value:x}),W1=(x)=>({status:"valid",value:x}),_9=(x)=>x.status==="aborted",u9=(x)=>x.status==="dirty",O4=(x)=>x.status==="valid",gx=(x)=>typeof Promise<"u"&&x instanceof Promise;var T;(function(x){x.errToObj=(Q)=>typeof Q==="string"?{message:Q}:Q||{},x.toString=(Q)=>typeof Q==="string"?Q:Q?.message})(T||(T={}));class f1{constructor(x,Q,W,Y){this._cachedPath=[],this.parent=x,this.data=Q,this._path=W,this._key=Y}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 p$=(x,Q)=>{if(O4(Q))return{success:!0,data:Q.value};else{if(!x.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new K1(x.common.issues);return this._error=W,this._error}}}};function y(x){if(!x)return{};let{errorMap:Q,invalid_type_error:W,required_error:Y,description:X}=x;if(Q&&(W||Y))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Q)return{errorMap:Q,description:X};return{errorMap:(G,b)=>{let{message:$}=x;if(G.code==="invalid_enum_value")return{message:$??b.defaultError};if(typeof b.data>"u")return{message:$??Y??b.defaultError};if(G.code!=="invalid_type")return{message:b.defaultError};return{message:$??W??b.defaultError}},description:X}}class r{get description(){return this._def.description}_getType(x){return Y4(x.data)}_getOrReturnCtx(x,Q){return Q||{common:x.parent.common,data:x.data,parsedType:Y4(x.data),schemaErrorMap:this._def.errorMap,path:x.path,parent:x.parent}}_processInputParams(x){return{status:new o0,ctx:{common:x.parent.common,data:x.data,parsedType:Y4(x.data),schemaErrorMap:this._def.errorMap,path:x.path,parent:x.parent}}}_parseSync(x){let Q=this._parse(x);if(gx(Q))throw Error("Synchronous parse encountered promise.");return Q}_parseAsync(x){let Q=this._parse(x);return Promise.resolve(Q)}parse(x,Q){let W=this.safeParse(x,Q);if(W.success)return W.data;throw W.error}safeParse(x,Q){let W={common:{issues:[],async:Q?.async??!1,contextualErrorMap:Q?.errorMap},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:x,parsedType:Y4(x)},Y=this._parseSync({data:x,path:W.path,parent:W});return p$(W,Y)}"~validate"(x){let Q={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:x,parsedType:Y4(x)};if(!this["~standard"].async)try{let W=this._parseSync({data:x,path:[],parent:Q});return O4(W)?{value:W.value}:{issues:Q.common.issues}}catch(W){if(W?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Q.common={issues:[],async:!0}}return this._parseAsync({data:x,path:[],parent:Q}).then((W)=>O4(W)?{value:W.value}:{issues:Q.common.issues})}async parseAsync(x,Q){let W=await this.safeParseAsync(x,Q);if(W.success)return W.data;throw W.error}async safeParseAsync(x,Q){let W={common:{issues:[],contextualErrorMap:Q?.errorMap,async:!0},path:Q?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:x,parsedType:Y4(x)},Y=this._parse({data:x,path:W.path,parent:W}),X=await(gx(Y)?Y:Promise.resolve(Y));return p$(W,X)}refine(x,Q){let W=(Y)=>{if(typeof Q==="string"||typeof Q>"u")return{message:Q};else if(typeof Q==="function")return Q(Y);else return Q};return this._refinement((Y,X)=>{let J=x(Y),G=()=>X.addIssue({code:A.custom,...W(Y)});if(typeof Promise<"u"&&J instanceof Promise)return J.then((b)=>{if(!b)return G(),!1;else return!0});if(!J)return G(),!1;else return!0})}refinement(x,Q){return this._refinement((W,Y)=>{if(!x(W))return Y.addIssue(typeof Q==="function"?Q(W,Y):Q),!1;else return!0})}_refinement(x){return new g1({schema:this,typeName:I.ZodEffects,effect:{type:"refinement",refinement:x}})}superRefine(x){return this._refinement(x)}constructor(x){this.spa=this.safeParseAsync,this._def=x,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:(Q)=>this["~validate"](Q)}}optional(){return M1.create(this,this._def)}nullable(){return K4.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return m1.create(this)}promise(){return vx.create(this,this._def)}or(x){return rx.create([this,x],this._def)}and(x){return sx.create(this,x,this._def)}transform(x){return new g1({...y(this._def),schema:this,typeName:I.ZodEffects,effect:{type:"transform",transform:x}})}default(x){let Q=typeof x==="function"?x:()=>x;return new Q8({...y(this._def),innerType:this,defaultValue:Q,typeName:I.ZodDefault})}brand(){return new p9({typeName:I.ZodBranded,type:this,...y(this._def)})}catch(x){let Q=typeof x==="function"?x:()=>x;return new W8({...y(this._def),innerType:this,catchValue:Q,typeName:I.ZodCatch})}describe(x){return new this.constructor({...this._def,description:x})}pipe(x){return z6.create(this,x)}readonly(){return Y8.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}var _M=/^c[^\s-]{8,}$/i,uM=/^[0-9a-z]+$/,lM=/^[0-9A-HJKMNP-TV-Z]{26}$/i,pM=/^[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,nM=/^[a-z0-9_-]{21}$/i,mM=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,fM=/^[-+]?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)?)??$/,gM=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yM="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",p5,hM=/^(?:(?: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])$/,oM=/^(?:(?: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])$/,aM=/^(([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]))$/,dM=/^(([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])$/,rM=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sM=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,m$="((\\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])))",tM=new RegExp(`^${m$}$`);function f$(x){let Q="[0-5]\\d";if(x.precision)Q=`${Q}\\.\\d{${x.precision}}`;else if(x.precision==null)Q=`${Q}(\\.\\d+)?`;let W=x.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Q})${W}`}function eM(x){return new RegExp(`^${f$(x)}$`)}function g$(x){let Q=`${m$}T${f$(x)}`,W=[];if(W.push(x.local?"Z?":"Z"),x.offset)W.push("([+-]\\d{2}:?\\d{2})");return Q=`${Q}(${W.join("|")})`,new RegExp(`^${Q}$`)}function xD(x,Q){if((Q==="v4"||!Q)&&hM.test(x))return!0;if((Q==="v6"||!Q)&&aM.test(x))return!0;return!1}function QD(x,Q){if(!mM.test(x))return!1;try{let[W]=x.split(".");if(!W)return!1;let Y=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),X=JSON.parse(atob(Y));if(typeof X!=="object"||X===null)return!1;if("typ"in X&&X?.typ!=="JWT")return!1;if(!X.alg)return!1;if(Q&&X.alg!==Q)return!1;return!0}catch{return!1}}function WD(x,Q){if((Q==="v4"||!Q)&&oM.test(x))return!0;if((Q==="v6"||!Q)&&dM.test(x))return!0;return!1}class n1 extends r{_parse(x){if(this._def.coerce)x.data=String(x.data);if(this._getType(x)!==E.string){let X=this._getOrReturnCtx(x);return P(X,{code:A.invalid_type,expected:E.string,received:X.parsedType}),p}let W=new o0,Y=void 0;for(let X of this._def.checks)if(X.kind==="min"){if(x.data.length<X.value)Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.too_small,minimum:X.value,type:"string",inclusive:!0,exact:!1,message:X.message}),W.dirty()}else if(X.kind==="max"){if(x.data.length>X.value)Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.too_big,maximum:X.value,type:"string",inclusive:!0,exact:!1,message:X.message}),W.dirty()}else if(X.kind==="length"){let J=x.data.length>X.value,G=x.data.length<X.value;if(J||G){if(Y=this._getOrReturnCtx(x,Y),J)P(Y,{code:A.too_big,maximum:X.value,type:"string",inclusive:!0,exact:!0,message:X.message});else if(G)P(Y,{code:A.too_small,minimum:X.value,type:"string",inclusive:!0,exact:!0,message:X.message});W.dirty()}}else if(X.kind==="email"){if(!gM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"email",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="emoji"){if(!p5)p5=new RegExp(yM,"u");if(!p5.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"emoji",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="uuid"){if(!pM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"uuid",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="nanoid"){if(!nM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"nanoid",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="cuid"){if(!_M.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"cuid",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="cuid2"){if(!uM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"cuid2",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="ulid"){if(!lM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"ulid",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="url")try{new URL(x.data)}catch{Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"url",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="regex"){if(X.regex.lastIndex=0,!X.regex.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"regex",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="trim")x.data=x.data.trim();else if(X.kind==="includes"){if(!x.data.includes(X.value,X.position))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:{includes:X.value,position:X.position},message:X.message}),W.dirty()}else if(X.kind==="toLowerCase")x.data=x.data.toLowerCase();else if(X.kind==="toUpperCase")x.data=x.data.toUpperCase();else if(X.kind==="startsWith"){if(!x.data.startsWith(X.value))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:{startsWith:X.value},message:X.message}),W.dirty()}else if(X.kind==="endsWith"){if(!x.data.endsWith(X.value))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:{endsWith:X.value},message:X.message}),W.dirty()}else if(X.kind==="datetime"){if(!g$(X).test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:"datetime",message:X.message}),W.dirty()}else if(X.kind==="date"){if(!tM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:"date",message:X.message}),W.dirty()}else if(X.kind==="time"){if(!eM(X).test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.invalid_string,validation:"time",message:X.message}),W.dirty()}else if(X.kind==="duration"){if(!fM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"duration",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="ip"){if(!xD(x.data,X.version))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"ip",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="jwt"){if(!QD(x.data,X.alg))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"jwt",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="cidr"){if(!WD(x.data,X.version))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"cidr",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="base64"){if(!rM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"base64",code:A.invalid_string,message:X.message}),W.dirty()}else if(X.kind==="base64url"){if(!sM.test(x.data))Y=this._getOrReturnCtx(x,Y),P(Y,{validation:"base64url",code:A.invalid_string,message:X.message}),W.dirty()}else e.assertNever(X);return{status:W.value,value:x.data}}_regex(x,Q,W){return this.refinement((Y)=>x.test(Y),{validation:Q,code:A.invalid_string,...T.errToObj(W)})}_addCheck(x){return new n1({...this._def,checks:[...this._def.checks,x]})}email(x){return this._addCheck({kind:"email",...T.errToObj(x)})}url(x){return this._addCheck({kind:"url",...T.errToObj(x)})}emoji(x){return this._addCheck({kind:"emoji",...T.errToObj(x)})}uuid(x){return this._addCheck({kind:"uuid",...T.errToObj(x)})}nanoid(x){return this._addCheck({kind:"nanoid",...T.errToObj(x)})}cuid(x){return this._addCheck({kind:"cuid",...T.errToObj(x)})}cuid2(x){return this._addCheck({kind:"cuid2",...T.errToObj(x)})}ulid(x){return this._addCheck({kind:"ulid",...T.errToObj(x)})}base64(x){return this._addCheck({kind:"base64",...T.errToObj(x)})}base64url(x){return this._addCheck({kind:"base64url",...T.errToObj(x)})}jwt(x){return this._addCheck({kind:"jwt",...T.errToObj(x)})}ip(x){return this._addCheck({kind:"ip",...T.errToObj(x)})}cidr(x){return this._addCheck({kind:"cidr",...T.errToObj(x)})}datetime(x){if(typeof x==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:x});return this._addCheck({kind:"datetime",precision:typeof x?.precision>"u"?null:x?.precision,offset:x?.offset??!1,local:x?.local??!1,...T.errToObj(x?.message)})}date(x){return this._addCheck({kind:"date",message:x})}time(x){if(typeof x==="string")return this._addCheck({kind:"time",precision:null,message:x});return this._addCheck({kind:"time",precision:typeof x?.precision>"u"?null:x?.precision,...T.errToObj(x?.message)})}duration(x){return this._addCheck({kind:"duration",...T.errToObj(x)})}regex(x,Q){return this._addCheck({kind:"regex",regex:x,...T.errToObj(Q)})}includes(x,Q){return this._addCheck({kind:"includes",value:x,position:Q?.position,...T.errToObj(Q?.message)})}startsWith(x,Q){return this._addCheck({kind:"startsWith",value:x,...T.errToObj(Q)})}endsWith(x,Q){return this._addCheck({kind:"endsWith",value:x,...T.errToObj(Q)})}min(x,Q){return this._addCheck({kind:"min",value:x,...T.errToObj(Q)})}max(x,Q){return this._addCheck({kind:"max",value:x,...T.errToObj(Q)})}length(x,Q){return this._addCheck({kind:"length",value:x,...T.errToObj(Q)})}nonempty(x){return this.min(1,T.errToObj(x))}trim(){return new n1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new n1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new n1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((x)=>x.kind==="datetime")}get isDate(){return!!this._def.checks.find((x)=>x.kind==="date")}get isTime(){return!!this._def.checks.find((x)=>x.kind==="time")}get isDuration(){return!!this._def.checks.find((x)=>x.kind==="duration")}get isEmail(){return!!this._def.checks.find((x)=>x.kind==="email")}get isURL(){return!!this._def.checks.find((x)=>x.kind==="url")}get isEmoji(){return!!this._def.checks.find((x)=>x.kind==="emoji")}get isUUID(){return!!this._def.checks.find((x)=>x.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((x)=>x.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((x)=>x.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((x)=>x.kind==="cuid2")}get isULID(){return!!this._def.checks.find((x)=>x.kind==="ulid")}get isIP(){return!!this._def.checks.find((x)=>x.kind==="ip")}get isCIDR(){return!!this._def.checks.find((x)=>x.kind==="cidr")}get isBase64(){return!!this._def.checks.find((x)=>x.kind==="base64")}get isBase64url(){return!!this._def.checks.find((x)=>x.kind==="base64url")}get minLength(){let x=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(x===null||Q.value>x)x=Q.value}return x}get maxLength(){let x=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(x===null||Q.value<x)x=Q.value}return x}}n1.create=(x)=>{return new n1({checks:[],typeName:I.ZodString,coerce:x?.coerce??!1,...y(x)})};function YD(x,Q){let W=(x.toString().split(".")[1]||"").length,Y=(Q.toString().split(".")[1]||"").length,X=W>Y?W:Y,J=Number.parseInt(x.toFixed(X).replace(".","")),G=Number.parseInt(Q.toFixed(X).replace(".",""));return J%G/10**X}class I4 extends r{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(x){if(this._def.coerce)x.data=Number(x.data);if(this._getType(x)!==E.number){let X=this._getOrReturnCtx(x);return P(X,{code:A.invalid_type,expected:E.number,received:X.parsedType}),p}let W=void 0,Y=new o0;for(let X of this._def.checks)if(X.kind==="int"){if(!e.isInteger(x.data))W=this._getOrReturnCtx(x,W),P(W,{code:A.invalid_type,expected:"integer",received:"float",message:X.message}),Y.dirty()}else if(X.kind==="min"){if(X.inclusive?x.data<X.value:x.data<=X.value)W=this._getOrReturnCtx(x,W),P(W,{code:A.too_small,minimum:X.value,type:"number",inclusive:X.inclusive,exact:!1,message:X.message}),Y.dirty()}else if(X.kind==="max"){if(X.inclusive?x.data>X.value:x.data>=X.value)W=this._getOrReturnCtx(x,W),P(W,{code:A.too_big,maximum:X.value,type:"number",inclusive:X.inclusive,exact:!1,message:X.message}),Y.dirty()}else if(X.kind==="multipleOf"){if(YD(x.data,X.value)!==0)W=this._getOrReturnCtx(x,W),P(W,{code:A.not_multiple_of,multipleOf:X.value,message:X.message}),Y.dirty()}else if(X.kind==="finite"){if(!Number.isFinite(x.data))W=this._getOrReturnCtx(x,W),P(W,{code:A.not_finite,message:X.message}),Y.dirty()}else e.assertNever(X);return{status:Y.value,value:x.data}}gte(x,Q){return this.setLimit("min",x,!0,T.toString(Q))}gt(x,Q){return this.setLimit("min",x,!1,T.toString(Q))}lte(x,Q){return this.setLimit("max",x,!0,T.toString(Q))}lt(x,Q){return this.setLimit("max",x,!1,T.toString(Q))}setLimit(x,Q,W,Y){return new I4({...this._def,checks:[...this._def.checks,{kind:x,value:Q,inclusive:W,message:T.toString(Y)}]})}_addCheck(x){return new I4({...this._def,checks:[...this._def.checks,x]})}int(x){return this._addCheck({kind:"int",message:T.toString(x)})}positive(x){return this._addCheck({kind:"min",value:0,inclusive:!1,message:T.toString(x)})}negative(x){return this._addCheck({kind:"max",value:0,inclusive:!1,message:T.toString(x)})}nonpositive(x){return this._addCheck({kind:"max",value:0,inclusive:!0,message:T.toString(x)})}nonnegative(x){return this._addCheck({kind:"min",value:0,inclusive:!0,message:T.toString(x)})}multipleOf(x,Q){return this._addCheck({kind:"multipleOf",value:x,message:T.toString(Q)})}finite(x){return this._addCheck({kind:"finite",message:T.toString(x)})}safe(x){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:T.toString(x)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:T.toString(x)})}get minValue(){let x=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(x===null||Q.value>x)x=Q.value}return x}get maxValue(){let x=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(x===null||Q.value<x)x=Q.value}return x}get isInt(){return!!this._def.checks.find((x)=>x.kind==="int"||x.kind==="multipleOf"&&e.isInteger(x.value))}get isFinite(){let x=null,Q=null;for(let W of this._def.checks)if(W.kind==="finite"||W.kind==="int"||W.kind==="multipleOf")return!0;else if(W.kind==="min"){if(Q===null||W.value>Q)Q=W.value}else if(W.kind==="max"){if(x===null||W.value<x)x=W.value}return Number.isFinite(Q)&&Number.isFinite(x)}}I4.create=(x)=>{return new I4({checks:[],typeName:I.ZodNumber,coerce:x?.coerce||!1,...y(x)})};class S4 extends r{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(x){if(this._def.coerce)try{x.data=BigInt(x.data)}catch{return this._getInvalidInput(x)}if(this._getType(x)!==E.bigint)return this._getInvalidInput(x);let W=void 0,Y=new o0;for(let X of this._def.checks)if(X.kind==="min"){if(X.inclusive?x.data<X.value:x.data<=X.value)W=this._getOrReturnCtx(x,W),P(W,{code:A.too_small,type:"bigint",minimum:X.value,inclusive:X.inclusive,message:X.message}),Y.dirty()}else if(X.kind==="max"){if(X.inclusive?x.data>X.value:x.data>=X.value)W=this._getOrReturnCtx(x,W),P(W,{code:A.too_big,type:"bigint",maximum:X.value,inclusive:X.inclusive,message:X.message}),Y.dirty()}else if(X.kind==="multipleOf"){if(x.data%X.value!==BigInt(0))W=this._getOrReturnCtx(x,W),P(W,{code:A.not_multiple_of,multipleOf:X.value,message:X.message}),Y.dirty()}else e.assertNever(X);return{status:Y.value,value:x.data}}_getInvalidInput(x){let Q=this._getOrReturnCtx(x);return P(Q,{code:A.invalid_type,expected:E.bigint,received:Q.parsedType}),p}gte(x,Q){return this.setLimit("min",x,!0,T.toString(Q))}gt(x,Q){return this.setLimit("min",x,!1,T.toString(Q))}lte(x,Q){return this.setLimit("max",x,!0,T.toString(Q))}lt(x,Q){return this.setLimit("max",x,!1,T.toString(Q))}setLimit(x,Q,W,Y){return new S4({...this._def,checks:[...this._def.checks,{kind:x,value:Q,inclusive:W,message:T.toString(Y)}]})}_addCheck(x){return new S4({...this._def,checks:[...this._def.checks,x]})}positive(x){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:T.toString(x)})}negative(x){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:T.toString(x)})}nonpositive(x){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:T.toString(x)})}nonnegative(x){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:T.toString(x)})}multipleOf(x,Q){return this._addCheck({kind:"multipleOf",value:x,message:T.toString(Q)})}get minValue(){let x=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(x===null||Q.value>x)x=Q.value}return x}get maxValue(){let x=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(x===null||Q.value<x)x=Q.value}return x}}S4.create=(x)=>{return new S4({checks:[],typeName:I.ZodBigInt,coerce:x?.coerce??!1,...y(x)})};class ox extends r{_parse(x){if(this._def.coerce)x.data=Boolean(x.data);if(this._getType(x)!==E.boolean){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.boolean,received:W.parsedType}),p}return W1(x.data)}}ox.create=(x)=>{return new ox({typeName:I.ZodBoolean,coerce:x?.coerce||!1,...y(x)})};class bx extends r{_parse(x){if(this._def.coerce)x.data=new Date(x.data);if(this._getType(x)!==E.date){let X=this._getOrReturnCtx(x);return P(X,{code:A.invalid_type,expected:E.date,received:X.parsedType}),p}if(Number.isNaN(x.data.getTime())){let X=this._getOrReturnCtx(x);return P(X,{code:A.invalid_date}),p}let W=new o0,Y=void 0;for(let X of this._def.checks)if(X.kind==="min"){if(x.data.getTime()<X.value)Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.too_small,message:X.message,inclusive:!0,exact:!1,minimum:X.value,type:"date"}),W.dirty()}else if(X.kind==="max"){if(x.data.getTime()>X.value)Y=this._getOrReturnCtx(x,Y),P(Y,{code:A.too_big,message:X.message,inclusive:!0,exact:!1,maximum:X.value,type:"date"}),W.dirty()}else e.assertNever(X);return{status:W.value,value:new Date(x.data.getTime())}}_addCheck(x){return new bx({...this._def,checks:[...this._def.checks,x]})}min(x,Q){return this._addCheck({kind:"min",value:x.getTime(),message:T.toString(Q)})}max(x,Q){return this._addCheck({kind:"max",value:x.getTime(),message:T.toString(Q)})}get minDate(){let x=null;for(let Q of this._def.checks)if(Q.kind==="min"){if(x===null||Q.value>x)x=Q.value}return x!=null?new Date(x):null}get maxDate(){let x=null;for(let Q of this._def.checks)if(Q.kind==="max"){if(x===null||Q.value<x)x=Q.value}return x!=null?new Date(x):null}}bx.create=(x)=>{return new bx({checks:[],coerce:x?.coerce||!1,typeName:I.ZodDate,...y(x)})};class X6 extends r{_parse(x){if(this._getType(x)!==E.symbol){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.symbol,received:W.parsedType}),p}return W1(x.data)}}X6.create=(x)=>{return new X6({typeName:I.ZodSymbol,...y(x)})};class ax extends r{_parse(x){if(this._getType(x)!==E.undefined){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.undefined,received:W.parsedType}),p}return W1(x.data)}}ax.create=(x)=>{return new ax({typeName:I.ZodUndefined,...y(x)})};class dx extends r{_parse(x){if(this._getType(x)!==E.null){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.null,received:W.parsedType}),p}return W1(x.data)}}dx.create=(x)=>{return new dx({typeName:I.ZodNull,...y(x)})};class $x extends r{constructor(){super(...arguments);this._any=!0}_parse(x){return W1(x.data)}}$x.create=(x)=>{return new $x({typeName:I.ZodAny,...y(x)})};class A4 extends r{constructor(){super(...arguments);this._unknown=!0}_parse(x){return W1(x.data)}}A4.create=(x)=>{return new A4({typeName:I.ZodUnknown,...y(x)})};class X4 extends r{_parse(x){let Q=this._getOrReturnCtx(x);return P(Q,{code:A.invalid_type,expected:E.never,received:Q.parsedType}),p}}X4.create=(x)=>{return new X4({typeName:I.ZodNever,...y(x)})};class J6 extends r{_parse(x){if(this._getType(x)!==E.undefined){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.void,received:W.parsedType}),p}return W1(x.data)}}J6.create=(x)=>{return new J6({typeName:I.ZodVoid,...y(x)})};class m1 extends r{_parse(x){let{ctx:Q,status:W}=this._processInputParams(x),Y=this._def;if(Q.parsedType!==E.array)return P(Q,{code:A.invalid_type,expected:E.array,received:Q.parsedType}),p;if(Y.exactLength!==null){let J=Q.data.length>Y.exactLength.value,G=Q.data.length<Y.exactLength.value;if(J||G)P(Q,{code:J?A.too_big:A.too_small,minimum:G?Y.exactLength.value:void 0,maximum:J?Y.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Y.exactLength.message}),W.dirty()}if(Y.minLength!==null){if(Q.data.length<Y.minLength.value)P(Q,{code:A.too_small,minimum:Y.minLength.value,type:"array",inclusive:!0,exact:!1,message:Y.minLength.message}),W.dirty()}if(Y.maxLength!==null){if(Q.data.length>Y.maxLength.value)P(Q,{code:A.too_big,maximum:Y.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Y.maxLength.message}),W.dirty()}if(Q.common.async)return Promise.all([...Q.data].map((J,G)=>{return Y.type._parseAsync(new f1(Q,J,Q.path,G))})).then((J)=>{return o0.mergeArray(W,J)});let X=[...Q.data].map((J,G)=>{return Y.type._parseSync(new f1(Q,J,Q.path,G))});return o0.mergeArray(W,X)}get element(){return this._def.type}min(x,Q){return new m1({...this._def,minLength:{value:x,message:T.toString(Q)}})}max(x,Q){return new m1({...this._def,maxLength:{value:x,message:T.toString(Q)}})}length(x,Q){return new m1({...this._def,exactLength:{value:x,message:T.toString(Q)}})}nonempty(x){return this.min(1,x)}}m1.create=(x,Q)=>{return new m1({type:x,minLength:null,maxLength:null,exactLength:null,typeName:I.ZodArray,...y(Q)})};function yx(x){if(x instanceof O0){let Q={};for(let W in x.shape){let Y=x.shape[W];Q[W]=M1.create(yx(Y))}return new O0({...x._def,shape:()=>Q})}else if(x instanceof m1)return new m1({...x._def,type:yx(x.element)});else if(x instanceof M1)return M1.create(yx(x.unwrap()));else if(x instanceof K4)return K4.create(yx(x.unwrap()));else if(x instanceof J4)return J4.create(x.items.map((Q)=>yx(Q)));else return x}class O0 extends r{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let x=this._def.shape(),Q=e.objectKeys(x);return this._cached={shape:x,keys:Q},this._cached}_parse(x){if(this._getType(x)!==E.object){let $=this._getOrReturnCtx(x);return P($,{code:A.invalid_type,expected:E.object,received:$.parsedType}),p}let{status:W,ctx:Y}=this._processInputParams(x),{shape:X,keys:J}=this._getCached(),G=[];if(!(this._def.catchall instanceof X4&&this._def.unknownKeys==="strip")){for(let $ in Y.data)if(!J.includes($))G.push($)}let b=[];for(let $ of J){let z=X[$],v=Y.data[$];b.push({key:{status:"valid",value:$},value:z._parse(new f1(Y,v,Y.path,$)),alwaysSet:$ in Y.data})}if(this._def.catchall instanceof X4){let $=this._def.unknownKeys;if($==="passthrough")for(let z of G)b.push({key:{status:"valid",value:z},value:{status:"valid",value:Y.data[z]}});else if($==="strict"){if(G.length>0)P(Y,{code:A.unrecognized_keys,keys:G}),W.dirty()}else if($==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let $=this._def.catchall;for(let z of G){let v=Y.data[z];b.push({key:{status:"valid",value:z},value:$._parse(new f1(Y,v,Y.path,z)),alwaysSet:z in Y.data})}}if(Y.common.async)return Promise.resolve().then(async()=>{let $=[];for(let z of b){let v=await z.key,w=await z.value;$.push({key:v,value:w,alwaysSet:z.alwaysSet})}return $}).then(($)=>{return o0.mergeObjectSync(W,$)});else return o0.mergeObjectSync(W,b)}get shape(){return this._def.shape()}strict(x){return T.errToObj,new O0({...this._def,unknownKeys:"strict",...x!==void 0?{errorMap:(Q,W)=>{let Y=this._def.errorMap?.(Q,W).message??W.defaultError;if(Q.code==="unrecognized_keys")return{message:T.errToObj(x).message??Y};return{message:Y}}}:{}})}strip(){return new O0({...this._def,unknownKeys:"strip"})}passthrough(){return new O0({...this._def,unknownKeys:"passthrough"})}extend(x){return new O0({...this._def,shape:()=>({...this._def.shape(),...x})})}merge(x){return new O0({unknownKeys:x._def.unknownKeys,catchall:x._def.catchall,shape:()=>({...this._def.shape(),...x._def.shape()}),typeName:I.ZodObject})}setKey(x,Q){return this.augment({[x]:Q})}catchall(x){return new O0({...this._def,catchall:x})}pick(x){let Q={};for(let W of e.objectKeys(x))if(x[W]&&this.shape[W])Q[W]=this.shape[W];return new O0({...this._def,shape:()=>Q})}omit(x){let Q={};for(let W of e.objectKeys(this.shape))if(!x[W])Q[W]=this.shape[W];return new O0({...this._def,shape:()=>Q})}deepPartial(){return yx(this)}partial(x){let Q={};for(let W of e.objectKeys(this.shape)){let Y=this.shape[W];if(x&&!x[W])Q[W]=Y;else Q[W]=Y.optional()}return new O0({...this._def,shape:()=>Q})}required(x){let Q={};for(let W of e.objectKeys(this.shape))if(x&&!x[W])Q[W]=this.shape[W];else{let X=this.shape[W];while(X instanceof M1)X=X._def.innerType;Q[W]=X}return new O0({...this._def,shape:()=>Q})}keyof(){return y$(e.objectKeys(this.shape))}}O0.create=(x,Q)=>{return new O0({shape:()=>x,unknownKeys:"strip",catchall:X4.create(),typeName:I.ZodObject,...y(Q)})};O0.strictCreate=(x,Q)=>{return new O0({shape:()=>x,unknownKeys:"strict",catchall:X4.create(),typeName:I.ZodObject,...y(Q)})};O0.lazycreate=(x,Q)=>{return new O0({shape:x,unknownKeys:"strip",catchall:X4.create(),typeName:I.ZodObject,...y(Q)})};class rx extends r{_parse(x){let{ctx:Q}=this._processInputParams(x),W=this._def.options;function Y(X){for(let G of X)if(G.result.status==="valid")return G.result;for(let G of X)if(G.result.status==="dirty")return Q.common.issues.push(...G.ctx.common.issues),G.result;let J=X.map((G)=>new K1(G.ctx.common.issues));return P(Q,{code:A.invalid_union,unionErrors:J}),p}if(Q.common.async)return Promise.all(W.map(async(X)=>{let J={...Q,common:{...Q.common,issues:[]},parent:null};return{result:await X._parseAsync({data:Q.data,path:Q.path,parent:J}),ctx:J}})).then(Y);else{let X=void 0,J=[];for(let b of W){let $={...Q,common:{...Q.common,issues:[]},parent:null},z=b._parseSync({data:Q.data,path:Q.path,parent:$});if(z.status==="valid")return z;else if(z.status==="dirty"&&!X)X={result:z,ctx:$};if($.common.issues.length)J.push($.common.issues)}if(X)return Q.common.issues.push(...X.ctx.common.issues),X.result;let G=J.map((b)=>new K1(b));return P(Q,{code:A.invalid_union,unionErrors:G}),p}}get options(){return this._def.options}}rx.create=(x,Q)=>{return new rx({options:x,typeName:I.ZodUnion,...y(Q)})};var B4=(x)=>{if(x instanceof tx)return B4(x.schema);else if(x instanceof g1)return B4(x.innerType());else if(x instanceof ex)return[x.value];else if(x instanceof E4)return x.options;else if(x instanceof x8)return e.objectValues(x.enum);else if(x instanceof Q8)return B4(x._def.innerType);else if(x instanceof ax)return[void 0];else if(x instanceof dx)return[null];else if(x instanceof M1)return[void 0,...B4(x.unwrap())];else if(x instanceof K4)return[null,...B4(x.unwrap())];else if(x instanceof p9)return B4(x.unwrap());else if(x instanceof Y8)return B4(x.unwrap());else if(x instanceof W8)return B4(x._def.innerType);else return[]};class l9 extends r{_parse(x){let{ctx:Q}=this._processInputParams(x);if(Q.parsedType!==E.object)return P(Q,{code:A.invalid_type,expected:E.object,received:Q.parsedType}),p;let W=this.discriminator,Y=Q.data[W],X=this.optionsMap.get(Y);if(!X)return P(Q,{code:A.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),p;if(Q.common.async)return X._parseAsync({data:Q.data,path:Q.path,parent:Q});else return X._parseSync({data:Q.data,path:Q.path,parent:Q})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(x,Q,W){let Y=new Map;for(let X of Q){let J=B4(X.shape[x]);if(!J.length)throw Error(`A discriminator value for key \`${x}\` could not be extracted from all schema options`);for(let G of J){if(Y.has(G))throw Error(`Discriminator property ${String(x)} has duplicate value ${String(G)}`);Y.set(G,X)}}return new l9({typeName:I.ZodDiscriminatedUnion,discriminator:x,options:Q,optionsMap:Y,...y(W)})}}function n5(x,Q){let W=Y4(x),Y=Y4(Q);if(x===Q)return{valid:!0,data:x};else if(W===E.object&&Y===E.object){let X=e.objectKeys(Q),J=e.objectKeys(x).filter((b)=>X.indexOf(b)!==-1),G={...x,...Q};for(let b of J){let $=n5(x[b],Q[b]);if(!$.valid)return{valid:!1};G[b]=$.data}return{valid:!0,data:G}}else if(W===E.array&&Y===E.array){if(x.length!==Q.length)return{valid:!1};let X=[];for(let J=0;J<x.length;J++){let G=x[J],b=Q[J],$=n5(G,b);if(!$.valid)return{valid:!1};X.push($.data)}return{valid:!0,data:X}}else if(W===E.date&&Y===E.date&&+x===+Q)return{valid:!0,data:x};else return{valid:!1}}class sx extends r{_parse(x){let{status:Q,ctx:W}=this._processInputParams(x),Y=(X,J)=>{if(_9(X)||_9(J))return p;let G=n5(X.value,J.value);if(!G.valid)return P(W,{code:A.invalid_intersection_types}),p;if(u9(X)||u9(J))Q.dirty();return{status:Q.value,value:G.data}};if(W.common.async)return Promise.all([this._def.left._parseAsync({data:W.data,path:W.path,parent:W}),this._def.right._parseAsync({data:W.data,path:W.path,parent:W})]).then(([X,J])=>Y(X,J));else return Y(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}}sx.create=(x,Q,W)=>{return new sx({left:x,right:Q,typeName:I.ZodIntersection,...y(W)})};class J4 extends r{_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.parsedType!==E.array)return P(W,{code:A.invalid_type,expected:E.array,received:W.parsedType}),p;if(W.data.length<this._def.items.length)return P(W,{code:A.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),p;if(!this._def.rest&&W.data.length>this._def.items.length)P(W,{code:A.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q.dirty();let X=[...W.data].map((J,G)=>{let b=this._def.items[G]||this._def.rest;if(!b)return null;return b._parse(new f1(W,J,W.path,G))}).filter((J)=>!!J);if(W.common.async)return Promise.all(X).then((J)=>{return o0.mergeArray(Q,J)});else return o0.mergeArray(Q,X)}get items(){return this._def.items}rest(x){return new J4({...this._def,rest:x})}}J4.create=(x,Q)=>{if(!Array.isArray(x))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new J4({items:x,typeName:I.ZodTuple,rest:null,...y(Q)})};class G6 extends r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.parsedType!==E.object)return P(W,{code:A.invalid_type,expected:E.object,received:W.parsedType}),p;let Y=[],X=this._def.keyType,J=this._def.valueType;for(let G in W.data)Y.push({key:X._parse(new f1(W,G,W.path,G)),value:J._parse(new f1(W,W.data[G],W.path,G)),alwaysSet:G in W.data});if(W.common.async)return o0.mergeObjectAsync(Q,Y);else return o0.mergeObjectSync(Q,Y)}get element(){return this._def.valueType}static create(x,Q,W){if(Q instanceof r)return new G6({keyType:x,valueType:Q,typeName:I.ZodRecord,...y(W)});return new G6({keyType:n1.create(),valueType:x,typeName:I.ZodRecord,...y(Q)})}}class b6 extends r{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.parsedType!==E.map)return P(W,{code:A.invalid_type,expected:E.map,received:W.parsedType}),p;let Y=this._def.keyType,X=this._def.valueType,J=[...W.data.entries()].map(([G,b],$)=>{return{key:Y._parse(new f1(W,G,W.path,[$,"key"])),value:X._parse(new f1(W,b,W.path,[$,"value"]))}});if(W.common.async){let G=new Map;return Promise.resolve().then(async()=>{for(let b of J){let $=await b.key,z=await b.value;if($.status==="aborted"||z.status==="aborted")return p;if($.status==="dirty"||z.status==="dirty")Q.dirty();G.set($.value,z.value)}return{status:Q.value,value:G}})}else{let G=new Map;for(let b of J){let{key:$,value:z}=b;if($.status==="aborted"||z.status==="aborted")return p;if($.status==="dirty"||z.status==="dirty")Q.dirty();G.set($.value,z.value)}return{status:Q.value,value:G}}}}b6.create=(x,Q,W)=>{return new b6({valueType:Q,keyType:x,typeName:I.ZodMap,...y(W)})};class zx extends r{_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.parsedType!==E.set)return P(W,{code:A.invalid_type,expected:E.set,received:W.parsedType}),p;let Y=this._def;if(Y.minSize!==null){if(W.data.size<Y.minSize.value)P(W,{code:A.too_small,minimum:Y.minSize.value,type:"set",inclusive:!0,exact:!1,message:Y.minSize.message}),Q.dirty()}if(Y.maxSize!==null){if(W.data.size>Y.maxSize.value)P(W,{code:A.too_big,maximum:Y.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Y.maxSize.message}),Q.dirty()}let X=this._def.valueType;function J(b){let $=new Set;for(let z of b){if(z.status==="aborted")return p;if(z.status==="dirty")Q.dirty();$.add(z.value)}return{status:Q.value,value:$}}let G=[...W.data.values()].map((b,$)=>X._parse(new f1(W,b,W.path,$)));if(W.common.async)return Promise.all(G).then((b)=>J(b));else return J(G)}min(x,Q){return new zx({...this._def,minSize:{value:x,message:T.toString(Q)}})}max(x,Q){return new zx({...this._def,maxSize:{value:x,message:T.toString(Q)}})}size(x,Q){return this.min(x,Q).max(x,Q)}nonempty(x){return this.min(1,x)}}zx.create=(x,Q)=>{return new zx({valueType:x,minSize:null,maxSize:null,typeName:I.ZodSet,...y(Q)})};class hx extends r{constructor(){super(...arguments);this.validate=this.implement}_parse(x){let{ctx:Q}=this._processInputParams(x);if(Q.parsedType!==E.function)return P(Q,{code:A.invalid_type,expected:E.function,received:Q.parsedType}),p;function W(G,b){return Y6({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,fx(),w4].filter(($)=>!!$),issueData:{code:A.invalid_arguments,argumentsError:b}})}function Y(G,b){return Y6({data:G,path:Q.path,errorMaps:[Q.common.contextualErrorMap,Q.schemaErrorMap,fx(),w4].filter(($)=>!!$),issueData:{code:A.invalid_return_type,returnTypeError:b}})}let X={errorMap:Q.common.contextualErrorMap},J=Q.data;if(this._def.returns instanceof vx){let G=this;return W1(async function(...b){let $=new K1([]),z=await G._def.args.parseAsync(b,X).catch((K)=>{throw $.addIssue(W(b,K)),$}),v=await Reflect.apply(J,this,z);return await G._def.returns._def.type.parseAsync(v,X).catch((K)=>{throw $.addIssue(Y(v,K)),$})})}else{let G=this;return W1(function(...b){let $=G._def.args.safeParse(b,X);if(!$.success)throw new K1([W(b,$.error)]);let z=Reflect.apply(J,this,$.data),v=G._def.returns.safeParse(z,X);if(!v.success)throw new K1([Y(z,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...x){return new hx({...this._def,args:J4.create(x).rest(A4.create())})}returns(x){return new hx({...this._def,returns:x})}implement(x){return this.parse(x)}strictImplement(x){return this.parse(x)}static create(x,Q,W){return new hx({args:x?x:J4.create([]).rest(A4.create()),returns:Q||A4.create(),typeName:I.ZodFunction,...y(W)})}}class tx extends r{get schema(){return this._def.getter()}_parse(x){let{ctx:Q}=this._processInputParams(x);return this._def.getter()._parse({data:Q.data,path:Q.path,parent:Q})}}tx.create=(x,Q)=>{return new tx({getter:x,typeName:I.ZodLazy,...y(Q)})};class ex extends r{_parse(x){if(x.data!==this._def.value){let Q=this._getOrReturnCtx(x);return P(Q,{received:Q.data,code:A.invalid_literal,expected:this._def.value}),p}return{status:"valid",value:x.data}}get value(){return this._def.value}}ex.create=(x,Q)=>{return new ex({value:x,typeName:I.ZodLiteral,...y(Q)})};function y$(x,Q){return new E4({values:x,typeName:I.ZodEnum,...y(Q)})}class E4 extends r{_parse(x){if(typeof x.data!=="string"){let Q=this._getOrReturnCtx(x),W=this._def.values;return P(Q,{expected:e.joinValues(W),received:Q.parsedType,code:A.invalid_type}),p}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(x.data)){let Q=this._getOrReturnCtx(x),W=this._def.values;return P(Q,{received:Q.data,code:A.invalid_enum_value,options:W}),p}return W1(x.data)}get options(){return this._def.values}get enum(){let x={};for(let Q of this._def.values)x[Q]=Q;return x}get Values(){let x={};for(let Q of this._def.values)x[Q]=Q;return x}get Enum(){let x={};for(let Q of this._def.values)x[Q]=Q;return x}extract(x,Q=this._def){return E4.create(x,{...this._def,...Q})}exclude(x,Q=this._def){return E4.create(this.options.filter((W)=>!x.includes(W)),{...this._def,...Q})}}E4.create=y$;class x8 extends r{_parse(x){let Q=e.getValidEnumValues(this._def.values),W=this._getOrReturnCtx(x);if(W.parsedType!==E.string&&W.parsedType!==E.number){let Y=e.objectValues(Q);return P(W,{expected:e.joinValues(Y),received:W.parsedType,code:A.invalid_type}),p}if(!this._cache)this._cache=new Set(e.getValidEnumValues(this._def.values));if(!this._cache.has(x.data)){let Y=e.objectValues(Q);return P(W,{received:W.data,code:A.invalid_enum_value,options:Y}),p}return W1(x.data)}get enum(){return this._def.values}}x8.create=(x,Q)=>{return new x8({values:x,typeName:I.ZodNativeEnum,...y(Q)})};class vx extends r{unwrap(){return this._def.type}_parse(x){let{ctx:Q}=this._processInputParams(x);if(Q.parsedType!==E.promise&&Q.common.async===!1)return P(Q,{code:A.invalid_type,expected:E.promise,received:Q.parsedType}),p;let W=Q.parsedType===E.promise?Q.data:Promise.resolve(Q.data);return W1(W.then((Y)=>{return this._def.type.parseAsync(Y,{path:Q.path,errorMap:Q.common.contextualErrorMap})}))}}vx.create=(x,Q)=>{return new vx({type:x,typeName:I.ZodPromise,...y(Q)})};class g1 extends r{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===I.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(x){let{status:Q,ctx:W}=this._processInputParams(x),Y=this._def.effect||null,X={addIssue:(J)=>{if(P(W,J),J.fatal)Q.abort();else Q.dirty()},get path(){return W.path}};if(X.addIssue=X.addIssue.bind(X),Y.type==="preprocess"){let J=Y.transform(W.data,X);if(W.common.async)return Promise.resolve(J).then(async(G)=>{if(Q.value==="aborted")return p;let b=await this._def.schema._parseAsync({data:G,path:W.path,parent:W});if(b.status==="aborted")return p;if(b.status==="dirty")return Gx(b.value);if(Q.value==="dirty")return Gx(b.value);return b});else{if(Q.value==="aborted")return p;let G=this._def.schema._parseSync({data:J,path:W.path,parent:W});if(G.status==="aborted")return p;if(G.status==="dirty")return Gx(G.value);if(Q.value==="dirty")return Gx(G.value);return G}}if(Y.type==="refinement"){let J=(G)=>{let b=Y.refinement(G,X);if(W.common.async)return Promise.resolve(b);if(b instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return G};if(W.common.async===!1){let G=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(G.status==="aborted")return p;if(G.status==="dirty")Q.dirty();return J(G.value),{status:Q.value,value:G.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((G)=>{if(G.status==="aborted")return p;if(G.status==="dirty")Q.dirty();return J(G.value).then(()=>{return{status:Q.value,value:G.value}})})}if(Y.type==="transform")if(W.common.async===!1){let J=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!O4(J))return p;let G=Y.transform(J.value,X);if(G instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Q.value,value:G}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((J)=>{if(!O4(J))return p;return Promise.resolve(Y.transform(J.value,X)).then((G)=>({status:Q.value,value:G}))});e.assertNever(Y)}}g1.create=(x,Q,W)=>{return new g1({schema:x,typeName:I.ZodEffects,effect:Q,...y(W)})};g1.createWithPreprocess=(x,Q,W)=>{return new g1({schema:Q,effect:{type:"preprocess",transform:x},typeName:I.ZodEffects,...y(W)})};class M1 extends r{_parse(x){if(this._getType(x)===E.undefined)return W1(void 0);return this._def.innerType._parse(x)}unwrap(){return this._def.innerType}}M1.create=(x,Q)=>{return new M1({innerType:x,typeName:I.ZodOptional,...y(Q)})};class K4 extends r{_parse(x){if(this._getType(x)===E.null)return W1(null);return this._def.innerType._parse(x)}unwrap(){return this._def.innerType}}K4.create=(x,Q)=>{return new K4({innerType:x,typeName:I.ZodNullable,...y(Q)})};class Q8 extends r{_parse(x){let{ctx:Q}=this._processInputParams(x),W=Q.data;if(Q.parsedType===E.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:Q.path,parent:Q})}removeDefault(){return this._def.innerType}}Q8.create=(x,Q)=>{return new Q8({innerType:x,typeName:I.ZodDefault,defaultValue:typeof Q.default==="function"?Q.default:()=>Q.default,...y(Q)})};class W8 extends r{_parse(x){let{ctx:Q}=this._processInputParams(x),W={...Q,common:{...Q.common,issues:[]}},Y=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(gx(Y))return Y.then((X)=>{return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new K1(W.common.issues)},input:W.data})}});else return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new K1(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}}W8.create=(x,Q)=>{return new W8({innerType:x,typeName:I.ZodCatch,catchValue:typeof Q.catch==="function"?Q.catch:()=>Q.catch,...y(Q)})};class $6 extends r{_parse(x){if(this._getType(x)!==E.nan){let W=this._getOrReturnCtx(x);return P(W,{code:A.invalid_type,expected:E.nan,received:W.parsedType}),p}return{status:"valid",value:x.data}}}$6.create=(x)=>{return new $6({typeName:I.ZodNaN,...y(x)})};var XD=Symbol("zod_brand");class p9 extends r{_parse(x){let{ctx:Q}=this._processInputParams(x),W=Q.data;return this._def.type._parse({data:W,path:Q.path,parent:Q})}unwrap(){return this._def.type}}class z6 extends r{_parse(x){let{status:Q,ctx:W}=this._processInputParams(x);if(W.common.async)return(async()=>{let X=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(X.status==="aborted")return p;if(X.status==="dirty")return Q.dirty(),Gx(X.value);else return this._def.out._parseAsync({data:X.value,path:W.path,parent:W})})();else{let Y=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(Y.status==="aborted")return p;if(Y.status==="dirty")return Q.dirty(),{status:"dirty",value:Y.value};else return this._def.out._parseSync({data:Y.value,path:W.path,parent:W})}}static create(x,Q){return new z6({in:x,out:Q,typeName:I.ZodPipeline})}}class Y8 extends r{_parse(x){let Q=this._def.innerType._parse(x),W=(Y)=>{if(O4(Y))Y.value=Object.freeze(Y.value);return Y};return gx(Q)?Q.then((Y)=>W(Y)):W(Q)}unwrap(){return this._def.innerType}}Y8.create=(x,Q)=>{return new Y8({innerType:x,typeName:I.ZodReadonly,...y(Q)})};function n$(x,Q){let W=typeof x==="function"?x(Q):typeof x==="string"?{message:x}:x;return typeof W==="string"?{message:W}:W}function h$(x,Q={},W){if(x)return $x.create().superRefine((Y,X)=>{let J=x(Y);if(J instanceof Promise)return J.then((G)=>{if(!G){let b=n$(Q,Y),$=b.fatal??W??!0;X.addIssue({code:"custom",...b,fatal:$})}});if(!J){let G=n$(Q,Y),b=G.fatal??W??!0;X.addIssue({code:"custom",...G,fatal:b})}return});return $x.create()}var JD={object:O0.lazycreate},I;(function(x){x.ZodString="ZodString",x.ZodNumber="ZodNumber",x.ZodNaN="ZodNaN",x.ZodBigInt="ZodBigInt",x.ZodBoolean="ZodBoolean",x.ZodDate="ZodDate",x.ZodSymbol="ZodSymbol",x.ZodUndefined="ZodUndefined",x.ZodNull="ZodNull",x.ZodAny="ZodAny",x.ZodUnknown="ZodUnknown",x.ZodNever="ZodNever",x.ZodVoid="ZodVoid",x.ZodArray="ZodArray",x.ZodObject="ZodObject",x.ZodUnion="ZodUnion",x.ZodDiscriminatedUnion="ZodDiscriminatedUnion",x.ZodIntersection="ZodIntersection",x.ZodTuple="ZodTuple",x.ZodRecord="ZodRecord",x.ZodMap="ZodMap",x.ZodSet="ZodSet",x.ZodFunction="ZodFunction",x.ZodLazy="ZodLazy",x.ZodLiteral="ZodLiteral",x.ZodEnum="ZodEnum",x.ZodEffects="ZodEffects",x.ZodNativeEnum="ZodNativeEnum",x.ZodOptional="ZodOptional",x.ZodNullable="ZodNullable",x.ZodDefault="ZodDefault",x.ZodCatch="ZodCatch",x.ZodPromise="ZodPromise",x.ZodBranded="ZodBranded",x.ZodPipeline="ZodPipeline",x.ZodReadonly="ZodReadonly"})(I||(I={}));var GD=(x,Q={message:`Input not instance of ${x.name}`})=>h$((W)=>W instanceof x,Q),o$=n1.create,a$=I4.create,bD=$6.create,$D=S4.create,d$=ox.create,zD=bx.create,vD=X6.create,wD=ax.create,BD=dx.create,KD=$x.create,HD=A4.create,VD=X4.create,qD=J6.create,ND=m1.create,m5=O0.create,FD=O0.strictCreate,UD=rx.create,cD=l9.create,LD=sx.create,MD=J4.create,DD=G6.create,jD=b6.create,OD=zx.create,AD=hx.create,ID=tx.create,SD=ex.create,ED=E4.create,RD=x8.create,PD=vx.create,iD=g1.create,ZD=M1.create,CD=K4.create,TD=g1.createWithPreprocess,kD=z6.create,_D=()=>o$().optional(),uD=()=>a$().optional(),lD=()=>d$().optional(),pD={string:(x)=>n1.create({...x,coerce:!0}),number:(x)=>I4.create({...x,coerce:!0}),boolean:(x)=>ox.create({...x,coerce:!0}),bigint:(x)=>S4.create({...x,coerce:!0}),date:(x)=>bx.create({...x,coerce:!0})};var nD=p;var mD=Object.freeze({status:"aborted"});function D(x,Q,W){function Y(b,$){var z;Object.defineProperty(b,"_zod",{value:b._zod??{},enumerable:!1}),(z=b._zod).traits??(z.traits=new Set),b._zod.traits.add(x),Q(b,$);for(let v in G.prototype)if(!(v in b))Object.defineProperty(b,v,{value:G.prototype[v].bind(b)});b._zod.constr=G,b._zod.def=$}let X=W?.Parent??Object;class J extends X{}Object.defineProperty(J,"name",{value:x});function G(b){var $;let z=W?.Parent?new J:this;Y(z,b),($=z._zod).deferred??($.deferred=[]);for(let v of z._zod.deferred)v();return z}return Object.defineProperty(G,"init",{value:Y}),Object.defineProperty(G,Symbol.hasInstance,{value:(b)=>{if(W?.Parent&&b instanceof W.Parent)return!0;return b?._zod?.traits?.has(x)}}),Object.defineProperty(G,"name",{value:x}),G}var fD=Symbol("zod_brand");class R4 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}var n9={};function D1(x){if(x)Object.assign(n9,x);return n9}var Q0={};G9(Q0,{unwrapMessage:()=>v6,stringifyPrimitive:()=>g9,required:()=>Gj,randomString:()=>sD,propertyKeyTypes:()=>a5,promiseAllObject:()=>rD,primitiveTypes:()=>r$,prefixIssues:()=>G4,pick:()=>Qj,partial:()=>Jj,optionalKeys:()=>d5,omit:()=>Wj,numKeys:()=>tD,nullish:()=>K6,normalizeParams:()=>n,merge:()=>Xj,jsonStringifyReplacer:()=>g5,joinValues:()=>m9,issue:()=>s5,isPlainObject:()=>J8,isObject:()=>X8,getSizableOrigin:()=>t$,getParsedType:()=>eD,getLengthableOrigin:()=>V6,getEnumValues:()=>w6,getElementAtPath:()=>dD,floatSafeRemainder:()=>y5,finalizeIssue:()=>y1,extend:()=>Yj,escapeRegex:()=>P4,esc:()=>wx,defineLazy:()=>q0,createTransparentProxy:()=>xj,clone:()=>j1,cleanRegex:()=>H6,cleanEnum:()=>bj,captureStackTrace:()=>f9,cached:()=>B6,assignProp:()=>h5,assertNotEqual:()=>yD,assertNever:()=>oD,assertIs:()=>hD,assertEqual:()=>gD,assert:()=>aD,allowsEval:()=>o5,aborted:()=>Bx,NUMBER_FORMAT_RANGES:()=>r5,Class:()=>e$,BIGINT_FORMAT_RANGES:()=>s$});function gD(x){return x}function yD(x){return x}function hD(x){}function oD(x){throw Error()}function aD(x){}function w6(x){let Q=Object.values(x).filter((Y)=>typeof Y==="number");return Object.entries(x).filter(([Y,X])=>Q.indexOf(+Y)===-1).map(([Y,X])=>X)}function m9(x,Q="|"){return x.map((W)=>g9(W)).join(Q)}function g5(x,Q){if(typeof Q==="bigint")return Q.toString();return Q}function B6(x){return{get value(){{let W=x();return Object.defineProperty(this,"value",{value:W}),W}throw Error("cached value already set")}}}function K6(x){return x===null||x===void 0}function H6(x){let Q=x.startsWith("^")?1:0,W=x.endsWith("$")?x.length-1:x.length;return x.slice(Q,W)}function y5(x,Q){let W=(x.toString().split(".")[1]||"").length,Y=(Q.toString().split(".")[1]||"").length,X=W>Y?W:Y,J=Number.parseInt(x.toFixed(X).replace(".","")),G=Number.parseInt(Q.toFixed(X).replace(".",""));return J%G/10**X}function q0(x,Q,W){Object.defineProperty(x,Q,{get(){{let X=W();return x[Q]=X,X}throw Error("cached value already set")},set(X){Object.defineProperty(x,Q,{value:X})},configurable:!0})}function h5(x,Q,W){Object.defineProperty(x,Q,{value:W,writable:!0,enumerable:!0,configurable:!0})}function dD(x,Q){if(!Q)return x;return Q.reduce((W,Y)=>W?.[Y],x)}function rD(x){let Q=Object.keys(x),W=Q.map((Y)=>x[Y]);return Promise.all(W).then((Y)=>{let X={};for(let J=0;J<Q.length;J++)X[Q[J]]=Y[J];return X})}function sD(x=10){let W="";for(let Y=0;Y<x;Y++)W+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return W}function wx(x){return JSON.stringify(x)}var f9=Error.captureStackTrace?Error.captureStackTrace:(...x)=>{};function X8(x){return typeof x==="object"&&x!==null&&!Array.isArray(x)}var o5=B6(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(x){return!1}});function J8(x){if(X8(x)===!1)return!1;let Q=x.constructor;if(Q===void 0)return!0;let W=Q.prototype;if(X8(W)===!1)return!1;if(Object.prototype.hasOwnProperty.call(W,"isPrototypeOf")===!1)return!1;return!0}function tD(x){let Q=0;for(let W in x)if(Object.prototype.hasOwnProperty.call(x,W))Q++;return Q}var eD=(x)=>{let Q=typeof x;switch(Q){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(x)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(x))return"array";if(x===null)return"null";if(x.then&&typeof x.then==="function"&&x.catch&&typeof x.catch==="function")return"promise";if(typeof Map<"u"&&x instanceof Map)return"map";if(typeof Set<"u"&&x instanceof Set)return"set";if(typeof Date<"u"&&x instanceof Date)return"date";if(typeof File<"u"&&x instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${Q}`)}},a5=new Set(["string","number","symbol"]),r$=new Set(["string","number","bigint","boolean","symbol","undefined"]);function P4(x){return x.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function j1(x,Q,W){let Y=new x._zod.constr(Q??x._zod.def);if(!Q||W?.parent)Y._zod.parent=x;return Y}function n(x){let Q=x;if(!Q)return{};if(typeof Q==="string")return{error:()=>Q};if(Q?.message!==void 0){if(Q?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");Q.error=Q.message}if(delete Q.message,typeof Q.error==="string")return{...Q,error:()=>Q.error};return Q}function xj(x){let Q;return new Proxy({},{get(W,Y,X){return Q??(Q=x()),Reflect.get(Q,Y,X)},set(W,Y,X,J){return Q??(Q=x()),Reflect.set(Q,Y,X,J)},has(W,Y){return Q??(Q=x()),Reflect.has(Q,Y)},deleteProperty(W,Y){return Q??(Q=x()),Reflect.deleteProperty(Q,Y)},ownKeys(W){return Q??(Q=x()),Reflect.ownKeys(Q)},getOwnPropertyDescriptor(W,Y){return Q??(Q=x()),Reflect.getOwnPropertyDescriptor(Q,Y)},defineProperty(W,Y,X){return Q??(Q=x()),Reflect.defineProperty(Q,Y,X)}})}function g9(x){if(typeof x==="bigint")return x.toString()+"n";if(typeof x==="string")return`"${x}"`;return`${x}`}function d5(x){return Object.keys(x).filter((Q)=>{return x[Q]._zod.optin==="optional"&&x[Q]._zod.optout==="optional"})}var r5={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},s$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Qj(x,Q){let W={},Y=x._zod.def;for(let X in Q){if(!(X in Y.shape))throw Error(`Unrecognized key: "${X}"`);if(!Q[X])continue;W[X]=Y.shape[X]}return j1(x,{...x._zod.def,shape:W,checks:[]})}function Wj(x,Q){let W={...x._zod.def.shape},Y=x._zod.def;for(let X in Q){if(!(X in Y.shape))throw Error(`Unrecognized key: "${X}"`);if(!Q[X])continue;delete W[X]}return j1(x,{...x._zod.def,shape:W,checks:[]})}function Yj(x,Q){if(!J8(Q))throw Error("Invalid input to extend: expected a plain object");let W={...x._zod.def,get shape(){let Y={...x._zod.def.shape,...Q};return h5(this,"shape",Y),Y},checks:[]};return j1(x,W)}function Xj(x,Q){return j1(x,{...x._zod.def,get shape(){let W={...x._zod.def.shape,...Q._zod.def.shape};return h5(this,"shape",W),W},catchall:Q._zod.def.catchall,checks:[]})}function Jj(x,Q,W){let Y=Q._zod.def.shape,X={...Y};if(W)for(let J in W){if(!(J in Y))throw Error(`Unrecognized key: "${J}"`);if(!W[J])continue;X[J]=x?new x({type:"optional",innerType:Y[J]}):Y[J]}else for(let J in Y)X[J]=x?new x({type:"optional",innerType:Y[J]}):Y[J];return j1(Q,{...Q._zod.def,shape:X,checks:[]})}function Gj(x,Q,W){let Y=Q._zod.def.shape,X={...Y};if(W)for(let J in W){if(!(J in X))throw Error(`Unrecognized key: "${J}"`);if(!W[J])continue;X[J]=new x({type:"nonoptional",innerType:Y[J]})}else for(let J in Y)X[J]=new x({type:"nonoptional",innerType:Y[J]});return j1(Q,{...Q._zod.def,shape:X,checks:[]})}function Bx(x,Q=0){for(let W=Q;W<x.issues.length;W++)if(x.issues[W]?.continue!==!0)return!0;return!1}function G4(x,Q){return Q.map((W)=>{var Y;return(Y=W).path??(Y.path=[]),W.path.unshift(x),W})}function v6(x){return typeof x==="string"?x:x?.message}function y1(x,Q,W){let Y={...x,path:x.path??[]};if(!x.message){let X=v6(x.inst?._zod.def?.error?.(x))??v6(Q?.error?.(x))??v6(W.customError?.(x))??v6(W.localeError?.(x))??"Invalid input";Y.message=X}if(delete Y.inst,delete Y.continue,!Q?.reportInput)delete Y.input;return Y}function t$(x){if(x instanceof Set)return"set";if(x instanceof Map)return"map";if(x instanceof File)return"file";return"unknown"}function V6(x){if(Array.isArray(x))return"array";if(typeof x==="string")return"string";return"unknown"}function s5(...x){let[Q,W,Y]=x;if(typeof Q==="string")return{message:Q,code:"custom",input:W,inst:Y};return{...Q}}function bj(x){return Object.entries(x).filter(([Q,W])=>{return Number.isNaN(Number.parseInt(Q,10))}).map((Q)=>Q[1])}class e${constructor(...x){}}var xz=(x,Q)=>{x.name="$ZodError",Object.defineProperty(x,"_zod",{value:x._zod,enumerable:!1}),Object.defineProperty(x,"issues",{value:Q,enumerable:!1}),Object.defineProperty(x,"message",{get(){return JSON.stringify(Q,g5,2)},enumerable:!0}),Object.defineProperty(x,"toString",{value:()=>x.message,enumerable:!1})},y9=D("$ZodError",xz),q6=D("$ZodError",xz,{Parent:Error});function t5(x,Q=(W)=>W.message){let W={},Y=[];for(let X of x.issues)if(X.path.length>0)W[X.path[0]]=W[X.path[0]]||[],W[X.path[0]].push(Q(X));else Y.push(Q(X));return{formErrors:Y,fieldErrors:W}}function e5(x,Q){let W=Q||function(J){return J.message},Y={_errors:[]},X=(J)=>{for(let G of J.issues)if(G.code==="invalid_union"&&G.errors.length)G.errors.map((b)=>X({issues:b}));else if(G.code==="invalid_key")X({issues:G.issues});else if(G.code==="invalid_element")X({issues:G.issues});else if(G.path.length===0)Y._errors.push(W(G));else{let b=Y,$=0;while($<G.path.length){let z=G.path[$];if($!==G.path.length-1)b[z]=b[z]||{_errors:[]};else b[z]=b[z]||{_errors:[]},b[z]._errors.push(W(G));b=b[z],$++}}};return X(x),Y}var xQ=(x)=>(Q,W,Y,X)=>{let J=Y?Object.assign(Y,{async:!1}):{async:!1},G=Q._zod.run({value:W,issues:[]},J);if(G instanceof Promise)throw new R4;if(G.issues.length){let b=new(X?.Err??x)(G.issues.map(($)=>y1($,J,D1())));throw f9(b,X?.callee),b}return G.value},QQ=xQ(q6),WQ=(x)=>async(Q,W,Y,X)=>{let J=Y?Object.assign(Y,{async:!0}):{async:!0},G=Q._zod.run({value:W,issues:[]},J);if(G instanceof Promise)G=await G;if(G.issues.length){let b=new(X?.Err??x)(G.issues.map(($)=>y1($,J,D1())));throw f9(b,X?.callee),b}return G.value},YQ=WQ(q6),XQ=(x)=>(Q,W,Y)=>{let X=Y?{...Y,async:!1}:{async:!1},J=Q._zod.run({value:W,issues:[]},X);if(J instanceof Promise)throw new R4;return J.issues.length?{success:!1,error:new(x??y9)(J.issues.map((G)=>y1(G,X,D1())))}:{success:!0,data:J.value}},Kx=XQ(q6),JQ=(x)=>async(Q,W,Y)=>{let X=Y?Object.assign(Y,{async:!0}):{async:!0},J=Q._zod.run({value:W,issues:[]},X);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new x(J.issues.map((G)=>y1(G,X,D1())))}:{success:!0,data:J.value}},Hx=JQ(q6);var Qz=/^[cC][^\s-]{8,}$/,Wz=/^[0-9a-z]+$/,Yz=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Xz=/^[0-9a-vA-V]{20}$/,Jz=/^[A-Za-z0-9]{27}$/,Gz=/^[a-zA-Z0-9_-]{21}$/,bz=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var $z=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,GQ=(x)=>{if(!x)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${x}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var zz=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function vz(){return new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")}var wz=/^(?:(?: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])$/,Bz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Kz=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Hz=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Vz=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,bQ=/^[A-Za-z0-9_-]*$/,qz=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;var Nz=/^\+(?:[0-9]){6,14}[0-9]$/,Fz="(?:(?:\\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])))",Uz=new RegExp(`^${Fz}$`);function cz(x){return typeof x.precision==="number"?x.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":x.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${x.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Lz(x){return new RegExp(`^${cz(x)}$`)}function Mz(x){let Q=cz({precision:x.precision}),W=["Z"];if(x.local)W.push("");if(x.offset)W.push("([+-]\\d{2}:\\d{2})");let Y=`${Q}(?:${W.join("|")})`;return new RegExp(`^${Fz}T(?:${Y})$`)}var Dz=(x)=>{let Q=x?`[\\s\\S]{${x?.minimum??0},${x?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Q}$`)};var jz=/^\d+$/,Oz=/^-?\d+(?:\.\d+)?/i,Az=/true|false/i,Iz=/null/i;var Sz=/^[^A-Z]*$/,Ez=/^[^a-z]*$/;var a0=D("$ZodCheck",(x,Q)=>{var W;x._zod??(x._zod={}),x._zod.def=Q,(W=x._zod).onattach??(W.onattach=[])}),Rz={number:"number",bigint:"bigint",object:"date"},$Q=D("$ZodCheckLessThan",(x,Q)=>{a0.init(x,Q);let W=Rz[typeof Q.value];x._zod.onattach.push((Y)=>{let X=Y._zod.bag,J=(Q.inclusive?X.maximum:X.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(Q.value<J)if(Q.inclusive)X.maximum=Q.value;else X.exclusiveMaximum=Q.value}),x._zod.check=(Y)=>{if(Q.inclusive?Y.value<=Q.value:Y.value<Q.value)return;Y.issues.push({origin:W,code:"too_big",maximum:Q.value,input:Y.value,inclusive:Q.inclusive,inst:x,continue:!Q.abort})}}),zQ=D("$ZodCheckGreaterThan",(x,Q)=>{a0.init(x,Q);let W=Rz[typeof Q.value];x._zod.onattach.push((Y)=>{let X=Y._zod.bag,J=(Q.inclusive?X.minimum:X.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(Q.value>J)if(Q.inclusive)X.minimum=Q.value;else X.exclusiveMinimum=Q.value}),x._zod.check=(Y)=>{if(Q.inclusive?Y.value>=Q.value:Y.value>Q.value)return;Y.issues.push({origin:W,code:"too_small",minimum:Q.value,input:Y.value,inclusive:Q.inclusive,inst:x,continue:!Q.abort})}}),Pz=D("$ZodCheckMultipleOf",(x,Q)=>{a0.init(x,Q),x._zod.onattach.push((W)=>{var Y;(Y=W._zod.bag).multipleOf??(Y.multipleOf=Q.value)}),x._zod.check=(W)=>{if(typeof W.value!==typeof Q.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof W.value==="bigint"?W.value%Q.value===BigInt(0):y5(W.value,Q.value)===0)return;W.issues.push({origin:typeof W.value,code:"not_multiple_of",divisor:Q.value,input:W.value,inst:x,continue:!Q.abort})}}),iz=D("$ZodCheckNumberFormat",(x,Q)=>{a0.init(x,Q),Q.format=Q.format||"float64";let W=Q.format?.includes("int"),Y=W?"int":"number",[X,J]=r5[Q.format];x._zod.onattach.push((G)=>{let b=G._zod.bag;if(b.format=Q.format,b.minimum=X,b.maximum=J,W)b.pattern=jz}),x._zod.check=(G)=>{let b=G.value;if(W){if(!Number.isInteger(b)){G.issues.push({expected:Y,format:Q.format,code:"invalid_type",input:b,inst:x});return}if(!Number.isSafeInteger(b)){if(b>0)G.issues.push({input:b,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:x,origin:Y,continue:!Q.abort});else G.issues.push({input:b,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:x,origin:Y,continue:!Q.abort});return}}if(b<X)G.issues.push({origin:"number",input:b,code:"too_small",minimum:X,inclusive:!0,inst:x,continue:!Q.abort});if(b>J)G.issues.push({origin:"number",input:b,code:"too_big",maximum:J,inst:x})}});var Zz=D("$ZodCheckMaxLength",(x,Q)=>{var W;a0.init(x,Q),(W=x._zod.def).when??(W.when=(Y)=>{let X=Y.value;return!K6(X)&&X.length!==void 0}),x._zod.onattach.push((Y)=>{let X=Y._zod.bag.maximum??Number.POSITIVE_INFINITY;if(Q.maximum<X)Y._zod.bag.maximum=Q.maximum}),x._zod.check=(Y)=>{let X=Y.value;if(X.length<=Q.maximum)return;let G=V6(X);Y.issues.push({origin:G,code:"too_big",maximum:Q.maximum,inclusive:!0,input:X,inst:x,continue:!Q.abort})}}),Cz=D("$ZodCheckMinLength",(x,Q)=>{var W;a0.init(x,Q),(W=x._zod.def).when??(W.when=(Y)=>{let X=Y.value;return!K6(X)&&X.length!==void 0}),x._zod.onattach.push((Y)=>{let X=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(Q.minimum>X)Y._zod.bag.minimum=Q.minimum}),x._zod.check=(Y)=>{let X=Y.value;if(X.length>=Q.minimum)return;let G=V6(X);Y.issues.push({origin:G,code:"too_small",minimum:Q.minimum,inclusive:!0,input:X,inst:x,continue:!Q.abort})}}),Tz=D("$ZodCheckLengthEquals",(x,Q)=>{var W;a0.init(x,Q),(W=x._zod.def).when??(W.when=(Y)=>{let X=Y.value;return!K6(X)&&X.length!==void 0}),x._zod.onattach.push((Y)=>{let X=Y._zod.bag;X.minimum=Q.length,X.maximum=Q.length,X.length=Q.length}),x._zod.check=(Y)=>{let X=Y.value,J=X.length;if(J===Q.length)return;let G=V6(X),b=J>Q.length;Y.issues.push({origin:G,...b?{code:"too_big",maximum:Q.length}:{code:"too_small",minimum:Q.length},inclusive:!0,exact:!0,input:Y.value,inst:x,continue:!Q.abort})}}),N6=D("$ZodCheckStringFormat",(x,Q)=>{var W,Y;if(a0.init(x,Q),x._zod.onattach.push((X)=>{let J=X._zod.bag;if(J.format=Q.format,Q.pattern)J.patterns??(J.patterns=new Set),J.patterns.add(Q.pattern)}),Q.pattern)(W=x._zod).check??(W.check=(X)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(X.value))return;X.issues.push({origin:"string",code:"invalid_format",format:Q.format,input:X.value,...Q.pattern?{pattern:Q.pattern.toString()}:{},inst:x,continue:!Q.abort})});else(Y=x._zod).check??(Y.check=()=>{})}),kz=D("$ZodCheckRegex",(x,Q)=>{N6.init(x,Q),x._zod.check=(W)=>{if(Q.pattern.lastIndex=0,Q.pattern.test(W.value))return;W.issues.push({origin:"string",code:"invalid_format",format:"regex",input:W.value,pattern:Q.pattern.toString(),inst:x,continue:!Q.abort})}}),_z=D("$ZodCheckLowerCase",(x,Q)=>{Q.pattern??(Q.pattern=Sz),N6.init(x,Q)}),uz=D("$ZodCheckUpperCase",(x,Q)=>{Q.pattern??(Q.pattern=Ez),N6.init(x,Q)}),lz=D("$ZodCheckIncludes",(x,Q)=>{a0.init(x,Q);let W=P4(Q.includes),Y=new RegExp(typeof Q.position==="number"?`^.{${Q.position}}${W}`:W);Q.pattern=Y,x._zod.onattach.push((X)=>{let J=X._zod.bag;J.patterns??(J.patterns=new Set),J.patterns.add(Y)}),x._zod.check=(X)=>{if(X.value.includes(Q.includes,Q.position))return;X.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:Q.includes,input:X.value,inst:x,continue:!Q.abort})}}),pz=D("$ZodCheckStartsWith",(x,Q)=>{a0.init(x,Q);let W=new RegExp(`^${P4(Q.prefix)}.*`);Q.pattern??(Q.pattern=W),x._zod.onattach.push((Y)=>{let X=Y._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),x._zod.check=(Y)=>{if(Y.value.startsWith(Q.prefix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:Q.prefix,input:Y.value,inst:x,continue:!Q.abort})}}),nz=D("$ZodCheckEndsWith",(x,Q)=>{a0.init(x,Q);let W=new RegExp(`.*${P4(Q.suffix)}$`);Q.pattern??(Q.pattern=W),x._zod.onattach.push((Y)=>{let X=Y._zod.bag;X.patterns??(X.patterns=new Set),X.patterns.add(W)}),x._zod.check=(Y)=>{if(Y.value.endsWith(Q.suffix))return;Y.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:Q.suffix,input:Y.value,inst:x,continue:!Q.abort})}});var mz=D("$ZodCheckOverwrite",(x,Q)=>{a0.init(x,Q),x._zod.check=(W)=>{W.value=Q.tx(W.value)}});class vQ{constructor(x=[]){if(this.content=[],this.indent=0,this)this.args=x}indented(x){this.indent+=1,x(this),this.indent-=1}write(x){if(typeof x==="function"){x(this,{execution:"sync"}),x(this,{execution:"async"});return}let W=x.split(`
|
|
36
36
|
`).filter((J)=>J),Y=Math.min(...W.map((J)=>J.length-J.trimStart().length)),X=W.map((J)=>J.slice(Y)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of X)this.content.push(J)}compile(){let x=Function,Q=this?.args,Y=[...(this?.content??[""]).map((X)=>` ${X}`)];return new x(...Q,Y.join(`
|
|
37
37
|
`))}}var gz={major:4,minor:0,patch:0};var B0=D("$ZodType",(x,Q)=>{var W;x??(x={}),x._zod.def=Q,x._zod.bag=x._zod.bag||{},x._zod.version=gz;let Y=[...x._zod.def.checks??[]];if(x._zod.traits.has("$ZodCheck"))Y.unshift(x);for(let X of Y)for(let J of X._zod.onattach)J(x);if(Y.length===0)(W=x._zod).deferred??(W.deferred=[]),x._zod.deferred?.push(()=>{x._zod.run=x._zod.parse});else{let X=(J,G,b)=>{let $=Bx(J),z;for(let v of G){if(v._zod.def.when){if(!v._zod.def.when(J))continue}else if($)continue;let w=J.issues.length,K=v._zod.check(J);if(K instanceof Promise&&b?.async===!1)throw new R4;if(z||K instanceof Promise)z=(z??Promise.resolve()).then(async()=>{if(await K,J.issues.length===w)return;if(!$)$=Bx(J,w)});else{if(J.issues.length===w)continue;if(!$)$=Bx(J,w)}}if(z)return z.then(()=>{return J});return J};x._zod.run=(J,G)=>{let b=x._zod.parse(J,G);if(b instanceof Promise){if(G.async===!1)throw new R4;return b.then(($)=>X($,Y,G))}return X(b,Y,G)}}x["~standard"]={validate:(X)=>{try{let J=Kx(x,X);return J.success?{value:J.data}:{issues:J.error?.issues}}catch(J){return Hx(x,X).then((G)=>G.success?{value:G.data}:{issues:G.error?.issues})}},vendor:"zod",version:1}}),F6=D("$ZodString",(x,Q)=>{B0.init(x,Q),x._zod.pattern=[...x?._zod.bag?.patterns??[]].pop()??Dz(x._zod.bag),x._zod.parse=(W,Y)=>{if(Q.coerce)try{W.value=String(W.value)}catch(X){}if(typeof W.value==="string")return W;return W.issues.push({expected:"string",code:"invalid_type",input:W.value,inst:x}),W}}),N0=D("$ZodStringFormat",(x,Q)=>{N6.init(x,Q),F6.init(x,Q)}),BQ=D("$ZodGUID",(x,Q)=>{Q.pattern??(Q.pattern=$z),N0.init(x,Q)}),KQ=D("$ZodUUID",(x,Q)=>{if(Q.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[Q.version];if(Y===void 0)throw Error(`Invalid UUID version: "${Q.version}"`);Q.pattern??(Q.pattern=GQ(Y))}else Q.pattern??(Q.pattern=GQ());N0.init(x,Q)}),HQ=D("$ZodEmail",(x,Q)=>{Q.pattern??(Q.pattern=zz),N0.init(x,Q)}),VQ=D("$ZodURL",(x,Q)=>{N0.init(x,Q),x._zod.check=(W)=>{try{let Y=W.value,X=new URL(Y),J=X.href;if(Q.hostname){if(Q.hostname.lastIndex=0,!Q.hostname.test(X.hostname))W.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:qz.source,input:W.value,inst:x,continue:!Q.abort})}if(Q.protocol){if(Q.protocol.lastIndex=0,!Q.protocol.test(X.protocol.endsWith(":")?X.protocol.slice(0,-1):X.protocol))W.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:Q.protocol.source,input:W.value,inst:x,continue:!Q.abort})}if(!Y.endsWith("/")&&J.endsWith("/"))W.value=J.slice(0,-1);else W.value=J;return}catch(Y){W.issues.push({code:"invalid_format",format:"url",input:W.value,inst:x,continue:!Q.abort})}}}),qQ=D("$ZodEmoji",(x,Q)=>{Q.pattern??(Q.pattern=vz()),N0.init(x,Q)}),NQ=D("$ZodNanoID",(x,Q)=>{Q.pattern??(Q.pattern=Gz),N0.init(x,Q)}),FQ=D("$ZodCUID",(x,Q)=>{Q.pattern??(Q.pattern=Qz),N0.init(x,Q)}),UQ=D("$ZodCUID2",(x,Q)=>{Q.pattern??(Q.pattern=Wz),N0.init(x,Q)}),cQ=D("$ZodULID",(x,Q)=>{Q.pattern??(Q.pattern=Yz),N0.init(x,Q)}),LQ=D("$ZodXID",(x,Q)=>{Q.pattern??(Q.pattern=Xz),N0.init(x,Q)}),MQ=D("$ZodKSUID",(x,Q)=>{Q.pattern??(Q.pattern=Jz),N0.init(x,Q)}),xv=D("$ZodISODateTime",(x,Q)=>{Q.pattern??(Q.pattern=Mz(Q)),N0.init(x,Q)}),Qv=D("$ZodISODate",(x,Q)=>{Q.pattern??(Q.pattern=Uz),N0.init(x,Q)}),Wv=D("$ZodISOTime",(x,Q)=>{Q.pattern??(Q.pattern=Lz(Q)),N0.init(x,Q)}),Yv=D("$ZodISODuration",(x,Q)=>{Q.pattern??(Q.pattern=bz),N0.init(x,Q)}),DQ=D("$ZodIPv4",(x,Q)=>{Q.pattern??(Q.pattern=wz),N0.init(x,Q),x._zod.onattach.push((W)=>{let Y=W._zod.bag;Y.format="ipv4"})}),jQ=D("$ZodIPv6",(x,Q)=>{Q.pattern??(Q.pattern=Bz),N0.init(x,Q),x._zod.onattach.push((W)=>{let Y=W._zod.bag;Y.format="ipv6"}),x._zod.check=(W)=>{try{new URL(`http://[${W.value}]`)}catch{W.issues.push({code:"invalid_format",format:"ipv6",input:W.value,inst:x,continue:!Q.abort})}}}),OQ=D("$ZodCIDRv4",(x,Q)=>{Q.pattern??(Q.pattern=Kz),N0.init(x,Q)}),AQ=D("$ZodCIDRv6",(x,Q)=>{Q.pattern??(Q.pattern=Hz),N0.init(x,Q),x._zod.check=(W)=>{let[Y,X]=W.value.split("/");try{if(!X)throw Error();let J=Number(X);if(`${J}`!==X)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${Y}]`)}catch{W.issues.push({code:"invalid_format",format:"cidrv6",input:W.value,inst:x,continue:!Q.abort})}}});function Xv(x){if(x==="")return!0;if(x.length%4!==0)return!1;try{return atob(x),!0}catch{return!1}}var IQ=D("$ZodBase64",(x,Q)=>{Q.pattern??(Q.pattern=Vz),N0.init(x,Q),x._zod.onattach.push((W)=>{W._zod.bag.contentEncoding="base64"}),x._zod.check=(W)=>{if(Xv(W.value))return;W.issues.push({code:"invalid_format",format:"base64",input:W.value,inst:x,continue:!Q.abort})}});function zj(x){if(!bQ.test(x))return!1;let Q=x.replace(/[-_]/g,(Y)=>Y==="-"?"+":"/"),W=Q.padEnd(Math.ceil(Q.length/4)*4,"=");return Xv(W)}var SQ=D("$ZodBase64URL",(x,Q)=>{Q.pattern??(Q.pattern=bQ),N0.init(x,Q),x._zod.onattach.push((W)=>{W._zod.bag.contentEncoding="base64url"}),x._zod.check=(W)=>{if(zj(W.value))return;W.issues.push({code:"invalid_format",format:"base64url",input:W.value,inst:x,continue:!Q.abort})}}),EQ=D("$ZodE164",(x,Q)=>{Q.pattern??(Q.pattern=Nz),N0.init(x,Q)});function vj(x,Q=null){try{let W=x.split(".");if(W.length!==3)return!1;let[Y]=W;if(!Y)return!1;let X=JSON.parse(atob(Y));if("typ"in X&&X?.typ!=="JWT")return!1;if(!X.alg)return!1;if(Q&&(!("alg"in X)||X.alg!==Q))return!1;return!0}catch{return!1}}var RQ=D("$ZodJWT",(x,Q)=>{N0.init(x,Q),x._zod.check=(W)=>{if(vj(W.value,Q.alg))return;W.issues.push({code:"invalid_format",format:"jwt",input:W.value,inst:x,continue:!Q.abort})}});var a9=D("$ZodNumber",(x,Q)=>{B0.init(x,Q),x._zod.pattern=x._zod.bag.pattern??Oz,x._zod.parse=(W,Y)=>{if(Q.coerce)try{W.value=Number(W.value)}catch(G){}let X=W.value;if(typeof X==="number"&&!Number.isNaN(X)&&Number.isFinite(X))return W;let J=typeof X==="number"?Number.isNaN(X)?"NaN":!Number.isFinite(X)?"Infinity":void 0:void 0;return W.issues.push({expected:"number",code:"invalid_type",input:X,inst:x,...J?{received:J}:{}}),W}}),PQ=D("$ZodNumber",(x,Q)=>{iz.init(x,Q),a9.init(x,Q)}),iQ=D("$ZodBoolean",(x,Q)=>{B0.init(x,Q),x._zod.pattern=Az,x._zod.parse=(W,Y)=>{if(Q.coerce)try{W.value=Boolean(W.value)}catch(J){}let X=W.value;if(typeof X==="boolean")return W;return W.issues.push({expected:"boolean",code:"invalid_type",input:X,inst:x}),W}});var ZQ=D("$ZodNull",(x,Q)=>{B0.init(x,Q),x._zod.pattern=Iz,x._zod.values=new Set([null]),x._zod.parse=(W,Y)=>{let X=W.value;if(X===null)return W;return W.issues.push({expected:"null",code:"invalid_type",input:X,inst:x}),W}});var CQ=D("$ZodUnknown",(x,Q)=>{B0.init(x,Q),x._zod.parse=(W)=>W}),TQ=D("$ZodNever",(x,Q)=>{B0.init(x,Q),x._zod.parse=(W,Y)=>{return W.issues.push({expected:"never",code:"invalid_type",input:W.value,inst:x}),W}});function yz(x,Q,W){if(x.issues.length)Q.issues.push(...G4(W,x.issues));Q.value[W]=x.value}var kQ=D("$ZodArray",(x,Q)=>{B0.init(x,Q),x._zod.parse=(W,Y)=>{let X=W.value;if(!Array.isArray(X))return W.issues.push({expected:"array",code:"invalid_type",input:X,inst:x}),W;W.value=Array(X.length);let J=[];for(let G=0;G<X.length;G++){let b=X[G],$=Q.element._zod.run({value:b,issues:[]},Y);if($ instanceof Promise)J.push($.then((z)=>yz(z,W,G)));else yz($,W,G)}if(J.length)return Promise.all(J).then(()=>W);return W}});function o9(x,Q,W){if(x.issues.length)Q.issues.push(...G4(W,x.issues));Q.value[W]=x.value}function hz(x,Q,W,Y){if(x.issues.length)if(Y[W]===void 0)if(W in Y)Q.value[W]=void 0;else Q.value[W]=x.value;else Q.issues.push(...G4(W,x.issues));else if(x.value===void 0){if(W in Y)Q.value[W]=void 0}else Q.value[W]=x.value}var d9=D("$ZodObject",(x,Q)=>{B0.init(x,Q);let W=B6(()=>{let w=Object.keys(Q.shape);for(let B of w)if(!(Q.shape[B]instanceof B0))throw Error(`Invalid element at key "${B}": expected a Zod schema`);let K=d5(Q.shape);return{shape:Q.shape,keys:w,keySet:new Set(w),numKeys:w.length,optionalKeys:new Set(K)}});q0(x._zod,"propValues",()=>{let w=Q.shape,K={};for(let B in w){let V=w[B]._zod;if(V.values){K[B]??(K[B]=new Set);for(let N of V.values)K[B].add(N)}}return K});let Y=(w)=>{let K=new vQ(["shape","payload","ctx"]),B=W.value,V=(U)=>{let M=wx(U);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};K.write("const input = payload.value;");let N=Object.create(null),F=0;for(let U of B.keys)N[U]=`key_${F++}`;K.write("const newResult = {}");for(let U of B.keys)if(B.optionalKeys.has(U)){let M=N[U];K.write(`const ${M} = ${V(U)};`);let S=wx(U);K.write(`
|
|
38
38
|
if (${M}.issues.length) {
|
|
@@ -59,10 +59,10 @@ import{createRequire as rq}from"node:module";var nq=Object.create;var{getPrototy
|
|
|
59
59
|
path: iss.path ? [${wx(U)}, ...iss.path] : [${wx(U)}]
|
|
60
60
|
})));`),K.write(`newResult[${wx(U)}] = ${M}.value`)}K.write("payload.value = newResult;"),K.write("return payload;");let q=K.compile();return(U,M)=>q(w,U,M)},X,J=X8,G=!n9.jitless,$=G&&o5.value,z=Q.catchall,v;x._zod.parse=(w,K)=>{v??(v=W.value);let B=w.value;if(!J(B))return w.issues.push({expected:"object",code:"invalid_type",input:B,inst:x}),w;let V=[];if(G&&$&&K?.async===!1&&K.jitless!==!0){if(!X)X=Y(Q.shape);w=X(w,K)}else{w.value={};let M=v.shape;for(let S of v.keys){let i=M[S],g=i._zod.run({value:B[S],issues:[]},K),w0=i._zod.optin==="optional"&&i._zod.optout==="optional";if(g instanceof Promise)V.push(g.then((d)=>w0?hz(d,w,S,B):o9(d,w,S)));else if(w0)hz(g,w,S,B);else o9(g,w,S)}}if(!z)return V.length?Promise.all(V).then(()=>w):w;let N=[],F=v.keySet,q=z._zod,U=q.def.type;for(let M of Object.keys(B)){if(F.has(M))continue;if(U==="never"){N.push(M);continue}let S=q.run({value:B[M],issues:[]},K);if(S instanceof Promise)V.push(S.then((i)=>o9(i,w,M)));else o9(S,w,M)}if(N.length)w.issues.push({code:"unrecognized_keys",keys:N,input:B,inst:x});if(!V.length)return w;return Promise.all(V).then(()=>{return w})}});function oz(x,Q,W,Y){for(let X of x)if(X.issues.length===0)return Q.value=X.value,Q;return Q.issues.push({code:"invalid_union",input:Q.value,inst:W,errors:x.map((X)=>X.issues.map((J)=>y1(J,Y,D1())))}),Q}var r9=D("$ZodUnion",(x,Q)=>{B0.init(x,Q),q0(x._zod,"optin",()=>Q.options.some((W)=>W._zod.optin==="optional")?"optional":void 0),q0(x._zod,"optout",()=>Q.options.some((W)=>W._zod.optout==="optional")?"optional":void 0),q0(x._zod,"values",()=>{if(Q.options.every((W)=>W._zod.values))return new Set(Q.options.flatMap((W)=>Array.from(W._zod.values)));return}),q0(x._zod,"pattern",()=>{if(Q.options.every((W)=>W._zod.pattern)){let W=Q.options.map((Y)=>Y._zod.pattern);return new RegExp(`^(${W.map((Y)=>H6(Y.source)).join("|")})$`)}return}),x._zod.parse=(W,Y)=>{let X=!1,J=[];for(let G of Q.options){let b=G._zod.run({value:W.value,issues:[]},Y);if(b instanceof Promise)J.push(b),X=!0;else{if(b.issues.length===0)return b;J.push(b)}}if(!X)return oz(J,W,x,Y);return Promise.all(J).then((G)=>{return oz(G,W,x,Y)})}}),_Q=D("$ZodDiscriminatedUnion",(x,Q)=>{r9.init(x,Q);let W=x._zod.parse;q0(x._zod,"propValues",()=>{let X={};for(let J of Q.options){let G=J._zod.propValues;if(!G||Object.keys(G).length===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(J)}"`);for(let[b,$]of Object.entries(G)){if(!X[b])X[b]=new Set;for(let z of $)X[b].add(z)}}return X});let Y=B6(()=>{let X=Q.options,J=new Map;for(let G of X){let b=G._zod.propValues[Q.discriminator];if(!b||b.size===0)throw Error(`Invalid discriminated union option at index "${Q.options.indexOf(G)}"`);for(let $ of b){if(J.has($))throw Error(`Duplicate discriminator value "${String($)}"`);J.set($,G)}}return J});x._zod.parse=(X,J)=>{let G=X.value;if(!X8(G))return X.issues.push({code:"invalid_type",expected:"object",input:G,inst:x}),X;let b=Y.value.get(G?.[Q.discriminator]);if(b)return b._zod.run(X,J);if(Q.unionFallback)return W(X,J);return X.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:G,path:[Q.discriminator],inst:x}),X}}),uQ=D("$ZodIntersection",(x,Q)=>{B0.init(x,Q),x._zod.parse=(W,Y)=>{let X=W.value,J=Q.left._zod.run({value:X,issues:[]},Y),G=Q.right._zod.run({value:X,issues:[]},Y);if(J instanceof Promise||G instanceof Promise)return Promise.all([J,G]).then(([$,z])=>{return az(W,$,z)});return az(W,J,G)}});function wQ(x,Q){if(x===Q)return{valid:!0,data:x};if(x instanceof Date&&Q instanceof Date&&+x===+Q)return{valid:!0,data:x};if(J8(x)&&J8(Q)){let W=Object.keys(Q),Y=Object.keys(x).filter((J)=>W.indexOf(J)!==-1),X={...x,...Q};for(let J of Y){let G=wQ(x[J],Q[J]);if(!G.valid)return{valid:!1,mergeErrorPath:[J,...G.mergeErrorPath]};X[J]=G.data}return{valid:!0,data:X}}if(Array.isArray(x)&&Array.isArray(Q)){if(x.length!==Q.length)return{valid:!1,mergeErrorPath:[]};let W=[];for(let Y=0;Y<x.length;Y++){let X=x[Y],J=Q[Y],G=wQ(X,J);if(!G.valid)return{valid:!1,mergeErrorPath:[Y,...G.mergeErrorPath]};W.push(G.data)}return{valid:!0,data:W}}return{valid:!1,mergeErrorPath:[]}}function az(x,Q,W){if(Q.issues.length)x.issues.push(...Q.issues);if(W.issues.length)x.issues.push(...W.issues);if(Bx(x))return x;let Y=wQ(Q.value,W.value);if(!Y.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(Y.mergeErrorPath)}`);return x.value=Y.data,x}var lQ=D("$ZodRecord",(x,Q)=>{B0.init(x,Q),x._zod.parse=(W,Y)=>{let X=W.value;if(!J8(X))return W.issues.push({expected:"record",code:"invalid_type",input:X,inst:x}),W;let J=[];if(Q.keyType._zod.values){let G=Q.keyType._zod.values;W.value={};for(let $ of G)if(typeof $==="string"||typeof $==="number"||typeof $==="symbol"){let z=Q.valueType._zod.run({value:X[$],issues:[]},Y);if(z instanceof Promise)J.push(z.then((v)=>{if(v.issues.length)W.issues.push(...G4($,v.issues));W.value[$]=v.value}));else{if(z.issues.length)W.issues.push(...G4($,z.issues));W.value[$]=z.value}}let b;for(let $ in X)if(!G.has($))b=b??[],b.push($);if(b&&b.length>0)W.issues.push({code:"unrecognized_keys",input:X,inst:x,keys:b})}else{W.value={};for(let G of Reflect.ownKeys(X)){if(G==="__proto__")continue;let b=Q.keyType._zod.run({value:G,issues:[]},Y);if(b instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(b.issues.length){W.issues.push({origin:"record",code:"invalid_key",issues:b.issues.map((z)=>y1(z,Y,D1())),input:G,path:[G],inst:x}),W.value[b.value]=b.value;continue}let $=Q.valueType._zod.run({value:X[G],issues:[]},Y);if($ instanceof Promise)J.push($.then((z)=>{if(z.issues.length)W.issues.push(...G4(G,z.issues));W.value[b.value]=z.value}));else{if($.issues.length)W.issues.push(...G4(G,$.issues));W.value[b.value]=$.value}}}if(J.length)return Promise.all(J).then(()=>W);return W}});var pQ=D("$ZodEnum",(x,Q)=>{B0.init(x,Q);let W=w6(Q.entries);x._zod.values=new Set(W),x._zod.pattern=new RegExp(`^(${W.filter((Y)=>a5.has(typeof Y)).map((Y)=>typeof Y==="string"?P4(Y):Y.toString()).join("|")})$`),x._zod.parse=(Y,X)=>{let J=Y.value;if(x._zod.values.has(J))return Y;return Y.issues.push({code:"invalid_value",values:W,input:J,inst:x}),Y}}),nQ=D("$ZodLiteral",(x,Q)=>{B0.init(x,Q),x._zod.values=new Set(Q.values),x._zod.pattern=new RegExp(`^(${Q.values.map((W)=>typeof W==="string"?P4(W):W?W.toString():String(W)).join("|")})$`),x._zod.parse=(W,Y)=>{let X=W.value;if(x._zod.values.has(X))return W;return W.issues.push({code:"invalid_value",values:Q.values,input:X,inst:x}),W}});var mQ=D("$ZodTransform",(x,Q)=>{B0.init(x,Q),x._zod.parse=(W,Y)=>{let X=Q.transform(W.value,W);if(Y.async)return(X instanceof Promise?X:Promise.resolve(X)).then((G)=>{return W.value=G,W});if(X instanceof Promise)throw new R4;return W.value=X,W}}),fQ=D("$ZodOptional",(x,Q)=>{B0.init(x,Q),x._zod.optin="optional",x._zod.optout="optional",q0(x._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,void 0]):void 0}),q0(x._zod,"pattern",()=>{let W=Q.innerType._zod.pattern;return W?new RegExp(`^(${H6(W.source)})?$`):void 0}),x._zod.parse=(W,Y)=>{if(Q.innerType._zod.optin==="optional")return Q.innerType._zod.run(W,Y);if(W.value===void 0)return W;return Q.innerType._zod.run(W,Y)}}),gQ=D("$ZodNullable",(x,Q)=>{B0.init(x,Q),q0(x._zod,"optin",()=>Q.innerType._zod.optin),q0(x._zod,"optout",()=>Q.innerType._zod.optout),q0(x._zod,"pattern",()=>{let W=Q.innerType._zod.pattern;return W?new RegExp(`^(${H6(W.source)}|null)$`):void 0}),q0(x._zod,"values",()=>{return Q.innerType._zod.values?new Set([...Q.innerType._zod.values,null]):void 0}),x._zod.parse=(W,Y)=>{if(W.value===null)return W;return Q.innerType._zod.run(W,Y)}}),yQ=D("$ZodDefault",(x,Q)=>{B0.init(x,Q),x._zod.optin="optional",q0(x._zod,"values",()=>Q.innerType._zod.values),x._zod.parse=(W,Y)=>{if(W.value===void 0)return W.value=Q.defaultValue,W;let X=Q.innerType._zod.run(W,Y);if(X instanceof Promise)return X.then((J)=>dz(J,Q));return dz(X,Q)}});function dz(x,Q){if(x.value===void 0)x.value=Q.defaultValue;return x}var hQ=D("$ZodPrefault",(x,Q)=>{B0.init(x,Q),x._zod.optin="optional",q0(x._zod,"values",()=>Q.innerType._zod.values),x._zod.parse=(W,Y)=>{if(W.value===void 0)W.value=Q.defaultValue;return Q.innerType._zod.run(W,Y)}}),oQ=D("$ZodNonOptional",(x,Q)=>{B0.init(x,Q),q0(x._zod,"values",()=>{let W=Q.innerType._zod.values;return W?new Set([...W].filter((Y)=>Y!==void 0)):void 0}),x._zod.parse=(W,Y)=>{let X=Q.innerType._zod.run(W,Y);if(X instanceof Promise)return X.then((J)=>rz(J,x));return rz(X,x)}});function rz(x,Q){if(!x.issues.length&&x.value===void 0)x.issues.push({code:"invalid_type",expected:"nonoptional",input:x.value,inst:Q});return x}var aQ=D("$ZodCatch",(x,Q)=>{B0.init(x,Q),x._zod.optin="optional",q0(x._zod,"optout",()=>Q.innerType._zod.optout),q0(x._zod,"values",()=>Q.innerType._zod.values),x._zod.parse=(W,Y)=>{let X=Q.innerType._zod.run(W,Y);if(X instanceof Promise)return X.then((J)=>{if(W.value=J.value,J.issues.length)W.value=Q.catchValue({...W,error:{issues:J.issues.map((G)=>y1(G,Y,D1()))},input:W.value}),W.issues=[];return W});if(W.value=X.value,X.issues.length)W.value=Q.catchValue({...W,error:{issues:X.issues.map((J)=>y1(J,Y,D1()))},input:W.value}),W.issues=[];return W}});var dQ=D("$ZodPipe",(x,Q)=>{B0.init(x,Q),q0(x._zod,"values",()=>Q.in._zod.values),q0(x._zod,"optin",()=>Q.in._zod.optin),q0(x._zod,"optout",()=>Q.out._zod.optout),x._zod.parse=(W,Y)=>{let X=Q.in._zod.run(W,Y);if(X instanceof Promise)return X.then((J)=>sz(J,Q,Y));return sz(X,Q,Y)}});function sz(x,Q,W){if(Bx(x))return x;return Q.out._zod.run({value:x.value,issues:x.issues},W)}var rQ=D("$ZodReadonly",(x,Q)=>{B0.init(x,Q),q0(x._zod,"propValues",()=>Q.innerType._zod.propValues),q0(x._zod,"values",()=>Q.innerType._zod.values),q0(x._zod,"optin",()=>Q.innerType._zod.optin),q0(x._zod,"optout",()=>Q.innerType._zod.optout),x._zod.parse=(W,Y)=>{let X=Q.innerType._zod.run(W,Y);if(X instanceof Promise)return X.then(tz);return tz(X)}});function tz(x){return x.value=Object.freeze(x.value),x}var sQ=D("$ZodCustom",(x,Q)=>{a0.init(x,Q),B0.init(x,Q),x._zod.parse=(W,Y)=>{return W},x._zod.check=(W)=>{let Y=W.value,X=Q.fn(Y);if(X instanceof Promise)return X.then((J)=>ez(J,W,Y,x));ez(X,W,Y,x);return}});function ez(x,Q,W,Y){if(!x){let X={code:"custom",input:W,inst:Y,path:[...Y._zod.def.path??[]],continue:!Y._zod.def.abort};if(Y._zod.def.params)X.params=Y._zod.def.params;Q.issues.push(s5(X))}}var wj=(x)=>{let Q=typeof x;switch(Q){case"number":return Number.isNaN(x)?"NaN":"number";case"object":{if(Array.isArray(x))return"array";if(x===null)return"null";if(Object.getPrototypeOf(x)!==Object.prototype&&x.constructor)return x.constructor.name}}return Q},Bj=()=>{let x={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function Q(Y){return x[Y]??null}let W={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(Y)=>{switch(Y.code){case"invalid_type":return`Invalid input: expected ${Y.expected}, received ${wj(Y.input)}`;case"invalid_value":if(Y.values.length===1)return`Invalid input: expected ${g9(Y.values[0])}`;return`Invalid option: expected one of ${m9(Y.values,"|")}`;case"too_big":{let X=Y.inclusive?"<=":"<",J=Q(Y.origin);if(J)return`Too big: expected ${Y.origin??"value"} to have ${X}${Y.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${Y.origin??"value"} to be ${X}${Y.maximum.toString()}`}case"too_small":{let X=Y.inclusive?">=":">",J=Q(Y.origin);if(J)return`Too small: expected ${Y.origin} to have ${X}${Y.minimum.toString()} ${J.unit}`;return`Too small: expected ${Y.origin} to be ${X}${Y.minimum.toString()}`}case"invalid_format":{let X=Y;if(X.format==="starts_with")return`Invalid string: must start with "${X.prefix}"`;if(X.format==="ends_with")return`Invalid string: must end with "${X.suffix}"`;if(X.format==="includes")return`Invalid string: must include "${X.includes}"`;if(X.format==="regex")return`Invalid string: must match pattern ${X.pattern}`;return`Invalid ${W[X.format]??Y.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${Y.divisor}`;case"unrecognized_keys":return`Unrecognized key${Y.keys.length>1?"s":""}: ${m9(Y.keys,", ")}`;case"invalid_key":return`Invalid key in ${Y.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${Y.origin}`;default:return"Invalid input"}}};function tQ(){return{localeError:Bj()}}var Kj=Symbol("ZodOutput"),Hj=Symbol("ZodInput");class s9{constructor(){this._map=new Map,this._idmap=new Map}add(x,...Q){let W=Q[0];if(this._map.set(x,W),W&&typeof W==="object"&&"id"in W){if(this._idmap.has(W.id))throw Error(`ID ${W.id} already exists in the registry`);this._idmap.set(W.id,x)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(x){let Q=this._map.get(x);if(Q&&typeof Q==="object"&&"id"in Q)this._idmap.delete(Q.id);return this._map.delete(x),this}get(x){let Q=x._zod.parent;if(Q){let W={...this.get(Q)??{}};return delete W.id,{...W,...this._map.get(x)}}return this._map.get(x)}has(x){return this._map.has(x)}}function Jv(){return new s9}var i4=Jv();function eQ(x,Q){return new x({type:"string",...n(Q)})}function xW(x,Q){return new x({type:"string",format:"email",check:"string_format",abort:!1,...n(Q)})}function t9(x,Q){return new x({type:"string",format:"guid",check:"string_format",abort:!1,...n(Q)})}function QW(x,Q){return new x({type:"string",format:"uuid",check:"string_format",abort:!1,...n(Q)})}function WW(x,Q){return new x({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...n(Q)})}function YW(x,Q){return new x({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...n(Q)})}function XW(x,Q){return new x({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...n(Q)})}function JW(x,Q){return new x({type:"string",format:"url",check:"string_format",abort:!1,...n(Q)})}function GW(x,Q){return new x({type:"string",format:"emoji",check:"string_format",abort:!1,...n(Q)})}function bW(x,Q){return new x({type:"string",format:"nanoid",check:"string_format",abort:!1,...n(Q)})}function $W(x,Q){return new x({type:"string",format:"cuid",check:"string_format",abort:!1,...n(Q)})}function zW(x,Q){return new x({type:"string",format:"cuid2",check:"string_format",abort:!1,...n(Q)})}function vW(x,Q){return new x({type:"string",format:"ulid",check:"string_format",abort:!1,...n(Q)})}function wW(x,Q){return new x({type:"string",format:"xid",check:"string_format",abort:!1,...n(Q)})}function BW(x,Q){return new x({type:"string",format:"ksuid",check:"string_format",abort:!1,...n(Q)})}function KW(x,Q){return new x({type:"string",format:"ipv4",check:"string_format",abort:!1,...n(Q)})}function HW(x,Q){return new x({type:"string",format:"ipv6",check:"string_format",abort:!1,...n(Q)})}function VW(x,Q){return new x({type:"string",format:"cidrv4",check:"string_format",abort:!1,...n(Q)})}function qW(x,Q){return new x({type:"string",format:"cidrv6",check:"string_format",abort:!1,...n(Q)})}function NW(x,Q){return new x({type:"string",format:"base64",check:"string_format",abort:!1,...n(Q)})}function FW(x,Q){return new x({type:"string",format:"base64url",check:"string_format",abort:!1,...n(Q)})}function UW(x,Q){return new x({type:"string",format:"e164",check:"string_format",abort:!1,...n(Q)})}function cW(x,Q){return new x({type:"string",format:"jwt",check:"string_format",abort:!1,...n(Q)})}function Gv(x,Q){return new x({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...n(Q)})}function bv(x,Q){return new x({type:"string",format:"date",check:"string_format",...n(Q)})}function $v(x,Q){return new x({type:"string",format:"time",check:"string_format",precision:null,...n(Q)})}function zv(x,Q){return new x({type:"string",format:"duration",check:"string_format",...n(Q)})}function LW(x,Q){return new x({type:"number",checks:[],...n(Q)})}function MW(x,Q){return new x({type:"number",check:"number_format",abort:!1,format:"safeint",...n(Q)})}function DW(x,Q){return new x({type:"boolean",...n(Q)})}function jW(x,Q){return new x({type:"null",...n(Q)})}function OW(x){return new x({type:"unknown"})}function AW(x,Q){return new x({type:"never",...n(Q)})}function e9(x,Q){return new $Q({check:"less_than",...n(Q),value:x,inclusive:!1})}function U6(x,Q){return new $Q({check:"less_than",...n(Q),value:x,inclusive:!0})}function x3(x,Q){return new zQ({check:"greater_than",...n(Q),value:x,inclusive:!1})}function c6(x,Q){return new zQ({check:"greater_than",...n(Q),value:x,inclusive:!0})}function Q3(x,Q){return new Pz({check:"multiple_of",...n(Q),value:x})}function W3(x,Q){return new Zz({check:"max_length",...n(Q),maximum:x})}function G8(x,Q){return new Cz({check:"min_length",...n(Q),minimum:x})}function Y3(x,Q){return new Tz({check:"length_equals",...n(Q),length:x})}function IW(x,Q){return new kz({check:"string_format",format:"regex",...n(Q),pattern:x})}function SW(x){return new _z({check:"string_format",format:"lowercase",...n(x)})}function EW(x){return new uz({check:"string_format",format:"uppercase",...n(x)})}function RW(x,Q){return new lz({check:"string_format",format:"includes",...n(Q),includes:x})}function PW(x,Q){return new pz({check:"string_format",format:"starts_with",...n(Q),prefix:x})}function iW(x,Q){return new nz({check:"string_format",format:"ends_with",...n(Q),suffix:x})}function Vx(x){return new mz({check:"overwrite",tx:x})}function ZW(x){return Vx((Q)=>Q.normalize(x))}function CW(){return Vx((x)=>x.trim())}function TW(){return Vx((x)=>x.toLowerCase())}function kW(){return Vx((x)=>x.toUpperCase())}function vv(x,Q,W){return new x({type:"array",element:Q,...n(W)})}function _W(x,Q,W){let Y=n(W);return Y.abort??(Y.abort=!0),new x({type:"custom",check:"custom",fn:Q,...Y})}function uW(x,Q,W){return new x({type:"custom",check:"custom",fn:Q,...n(W)})}class lW{constructor(x){this.counter=0,this.metadataRegistry=x?.metadata??i4,this.target=x?.target??"draft-2020-12",this.unrepresentable=x?.unrepresentable??"throw",this.override=x?.override??(()=>{}),this.io=x?.io??"output",this.seen=new Map}process(x,Q={path:[],schemaPath:[]}){var W;let Y=x._zod.def,X={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},J=this.seen.get(x);if(J){if(J.count++,Q.schemaPath.includes(x))J.cycle=Q.path;return J.schema}let G={schema:{},count:1,cycle:void 0,path:Q.path};this.seen.set(x,G);let b=x._zod.toJSONSchema?.();if(b)G.schema=b;else{let v={...Q,schemaPath:[...Q.schemaPath,x],path:Q.path},w=x._zod.parent;if(w)G.ref=w,this.process(w,v),this.seen.get(w).isParent=!0;else{let K=G.schema;switch(Y.type){case"string":{let B=K;B.type="string";let{minimum:V,maximum:N,format:F,patterns:q,contentEncoding:U}=x._zod.bag;if(typeof V==="number")B.minLength=V;if(typeof N==="number")B.maxLength=N;if(F){if(B.format=X[F]??F,B.format==="")delete B.format}if(U)B.contentEncoding=U;if(q&&q.size>0){let M=[...q];if(M.length===1)B.pattern=M[0].source;else if(M.length>1)G.schema.allOf=[...M.map((S)=>({...this.target==="draft-7"?{type:"string"}:{},pattern:S.source}))]}break}case"number":{let B=K,{minimum:V,maximum:N,format:F,multipleOf:q,exclusiveMaximum:U,exclusiveMinimum:M}=x._zod.bag;if(typeof F==="string"&&F.includes("int"))B.type="integer";else B.type="number";if(typeof M==="number")B.exclusiveMinimum=M;if(typeof V==="number"){if(B.minimum=V,typeof M==="number")if(M>=V)delete B.minimum;else delete B.exclusiveMinimum}if(typeof U==="number")B.exclusiveMaximum=U;if(typeof N==="number"){if(B.maximum=N,typeof U==="number")if(U<=N)delete B.maximum;else delete B.exclusiveMaximum}if(typeof q==="number")B.multipleOf=q;break}case"boolean":{let B=K;B.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema");break}case"null":{K.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema");break}case"never":{K.not={};break}case"date":{if(this.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema");break}case"array":{let B=K,{minimum:V,maximum:N}=x._zod.bag;if(typeof V==="number")B.minItems=V;if(typeof N==="number")B.maxItems=N;B.type="array",B.items=this.process(Y.element,{...v,path:[...v.path,"items"]});break}case"object":{let B=K;B.type="object",B.properties={};let V=Y.shape;for(let q in V)B.properties[q]=this.process(V[q],{...v,path:[...v.path,"properties",q]});let N=new Set(Object.keys(V)),F=new Set([...N].filter((q)=>{let U=Y.shape[q]._zod;if(this.io==="input")return U.optin===void 0;else return U.optout===void 0}));if(F.size>0)B.required=Array.from(F);if(Y.catchall?._zod.def.type==="never")B.additionalProperties=!1;else if(!Y.catchall){if(this.io==="output")B.additionalProperties=!1}else if(Y.catchall)B.additionalProperties=this.process(Y.catchall,{...v,path:[...v.path,"additionalProperties"]});break}case"union":{let B=K;B.anyOf=Y.options.map((V,N)=>this.process(V,{...v,path:[...v.path,"anyOf",N]}));break}case"intersection":{let B=K,V=this.process(Y.left,{...v,path:[...v.path,"allOf",0]}),N=this.process(Y.right,{...v,path:[...v.path,"allOf",1]}),F=(U)=>("allOf"in U)&&Object.keys(U).length===1,q=[...F(V)?V.allOf:[V],...F(N)?N.allOf:[N]];B.allOf=q;break}case"tuple":{let B=K;B.type="array";let V=Y.items.map((q,U)=>this.process(q,{...v,path:[...v.path,"prefixItems",U]}));if(this.target==="draft-2020-12")B.prefixItems=V;else B.items=V;if(Y.rest){let q=this.process(Y.rest,{...v,path:[...v.path,"items"]});if(this.target==="draft-2020-12")B.items=q;else B.additionalItems=q}if(Y.rest)B.items=this.process(Y.rest,{...v,path:[...v.path,"items"]});let{minimum:N,maximum:F}=x._zod.bag;if(typeof N==="number")B.minItems=N;if(typeof F==="number")B.maxItems=F;break}case"record":{let B=K;B.type="object",B.propertyNames=this.process(Y.keyType,{...v,path:[...v.path,"propertyNames"]}),B.additionalProperties=this.process(Y.valueType,{...v,path:[...v.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema");break}case"enum":{let B=K,V=w6(Y.entries);if(V.every((N)=>typeof N==="number"))B.type="number";if(V.every((N)=>typeof N==="string"))B.type="string";B.enum=V;break}case"literal":{let B=K,V=[];for(let N of Y.values)if(N===void 0){if(this.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof N==="bigint")if(this.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else V.push(Number(N));else V.push(N);if(V.length===0);else if(V.length===1){let N=V[0];B.type=N===null?"null":typeof N,B.const=N}else{if(V.every((N)=>typeof N==="number"))B.type="number";if(V.every((N)=>typeof N==="string"))B.type="string";if(V.every((N)=>typeof N==="boolean"))B.type="string";if(V.every((N)=>N===null))B.type="null";B.enum=V}break}case"file":{let B=K,V={type:"string",format:"binary",contentEncoding:"binary"},{minimum:N,maximum:F,mime:q}=x._zod.bag;if(N!==void 0)V.minLength=N;if(F!==void 0)V.maxLength=F;if(q)if(q.length===1)V.contentMediaType=q[0],Object.assign(B,V);else B.anyOf=q.map((U)=>{return{...V,contentMediaType:U}});else Object.assign(B,V);break}case"transform":{if(this.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{let B=this.process(Y.innerType,v);K.anyOf=[B,{type:"null"}];break}case"nonoptional":{this.process(Y.innerType,v),G.ref=Y.innerType;break}case"success":{let B=K;B.type="boolean";break}case"default":{this.process(Y.innerType,v),G.ref=Y.innerType,K.default=JSON.parse(JSON.stringify(Y.defaultValue));break}case"prefault":{if(this.process(Y.innerType,v),G.ref=Y.innerType,this.io==="input")K._prefault=JSON.parse(JSON.stringify(Y.defaultValue));break}case"catch":{this.process(Y.innerType,v),G.ref=Y.innerType;let B;try{B=Y.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}K.default=B;break}case"nan":{if(this.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{let B=K,V=x._zod.pattern;if(!V)throw Error("Pattern not found in template literal");B.type="string",B.pattern=V.source;break}case"pipe":{let B=this.io==="input"?Y.in._zod.def.type==="transform"?Y.out:Y.in:Y.out;this.process(B,v),G.ref=B;break}case"readonly":{this.process(Y.innerType,v),G.ref=Y.innerType,K.readOnly=!0;break}case"promise":{this.process(Y.innerType,v),G.ref=Y.innerType;break}case"optional":{this.process(Y.innerType,v),G.ref=Y.innerType;break}case"lazy":{let B=x._zod.innerType;this.process(B,v),G.ref=B;break}case"custom":{if(this.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema");break}default:}}}let $=this.metadataRegistry.get(x);if($)Object.assign(G.schema,$);if(this.io==="input"&&k0(x))delete G.schema.examples,delete G.schema.default;if(this.io==="input"&&G.schema._prefault)(W=G.schema).default??(W.default=G.schema._prefault);return delete G.schema._prefault,this.seen.get(x).schema}emit(x,Q){let W={cycles:Q?.cycles??"ref",reused:Q?.reused??"inline",external:Q?.external??void 0},Y=this.seen.get(x);if(!Y)throw Error("Unprocessed schema. This is a bug in Zod.");let X=(z)=>{let v=this.target==="draft-2020-12"?"$defs":"definitions";if(W.external){let V=W.external.registry.get(z[0])?.id,N=W.external.uri??((q)=>q);if(V)return{ref:N(V)};let F=z[1].defId??z[1].schema.id??`schema${this.counter++}`;return z[1].defId=F,{defId:F,ref:`${N("__shared")}#/${v}/${F}`}}if(z[1]===Y)return{ref:"#"};let K=`${"#"}/${v}/`,B=z[1].schema.id??`__schema${this.counter++}`;return{defId:B,ref:K+B}},J=(z)=>{if(z[1].schema.$ref)return;let v=z[1],{ref:w,defId:K}=X(z);if(v.def={...v.schema},K)v.defId=K;let B=v.schema;for(let V in B)delete B[V];B.$ref=w};if(W.cycles==="throw")for(let z of this.seen.entries()){let v=z[1];if(v.cycle)throw Error(`Cycle detected: #/${v.cycle?.join("/")}/<root>
|
|
61
61
|
|
|
62
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let z of this.seen.entries()){let v=z[1];if(x===z[0]){J(z);continue}if(W.external){let K=W.external.registry.get(z[0])?.id;if(x!==z[0]&&K){J(z);continue}}if(this.metadataRegistry.get(z[0])?.id){J(z);continue}if(v.cycle){J(z);continue}if(v.count>1){if(W.reused==="ref"){J(z);continue}}}let G=(z,v)=>{let w=this.seen.get(z),K=w.def??w.schema,B={...K};if(w.ref===null)return;let V=w.ref;if(w.ref=null,V){G(V,v);let N=this.seen.get(V).schema;if(N.$ref&&v.target==="draft-7")K.allOf=K.allOf??[],K.allOf.push(N);else Object.assign(K,N),Object.assign(K,B)}if(!w.isParent)this.override({zodSchema:z,jsonSchema:K,path:w.path??[]})};for(let z of[...this.seen.entries()].reverse())G(z[0],{target:this.target});let b={};if(this.target==="draft-2020-12")b.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")b.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);if(W.external?.uri){let z=W.external.registry.get(x)?.id;if(!z)throw Error("Schema is missing an `id` property");b.$id=W.external.uri(z)}Object.assign(b,Y.def);let $=W.external?.defs??{};for(let z of this.seen.entries()){let v=z[1];if(v.def&&v.defId)$[v.defId]=v.def}if(W.external);else if(Object.keys($).length>0)if(this.target==="draft-2020-12")b.$defs=$;else b.definitions=$;try{return JSON.parse(JSON.stringify(b))}catch(z){throw Error("Error converting schema to JSON.")}}}function pW(x,Q){if(x instanceof s9){let Y=new lW(Q),X={};for(let b of x._idmap.entries()){let[$,z]=b;Y.process(z)}let J={},G={registry:x,uri:Q?.uri,defs:X};for(let b of x._idmap.entries()){let[$,z]=b;J[$]=Y.emit(z,{...Q,external:G})}if(Object.keys(X).length>0){let b=Y.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[b]:X}}return{schemas:J}}let W=new lW(Q);return W.process(x),W.emit(x,Q)}function k0(x,Q){let W=Q??{seen:new Set};if(W.seen.has(x))return!1;W.seen.add(x);let X=x._zod.def;switch(X.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return k0(X.element,W);case"object":{for(let J in X.shape)if(k0(X.shape[J],W))return!0;return!1}case"union":{for(let J of X.options)if(k0(J,W))return!0;return!1}case"intersection":return k0(X.left,W)||k0(X.right,W);case"tuple":{for(let J of X.items)if(k0(J,W))return!0;if(X.rest&&k0(X.rest,W))return!0;return!1}case"record":return k0(X.keyType,W)||k0(X.valueType,W);case"map":return k0(X.keyType,W)||k0(X.valueType,W);case"set":return k0(X.valueType,W);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return k0(X.innerType,W);case"lazy":return k0(X.getter(),W);case"default":return k0(X.innerType,W);case"prefault":return k0(X.innerType,W);case"custom":return!1;case"transform":return!0;case"pipe":return k0(X.in,W)||k0(X.out,W);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${X.type}`)}var dj=D("ZodMiniType",(x,Q)=>{if(!x._zod)throw Error("Uninitialized schema in ZodMiniType.");B0.init(x,Q),x.def=Q,x.parse=(W,Y)=>QQ(x,W,Y,{callee:x.parse}),x.safeParse=(W,Y)=>Kx(x,W,Y),x.parseAsync=async(W,Y)=>YQ(x,W,Y,{callee:x.parseAsync}),x.safeParseAsync=async(W,Y)=>Hx(x,W,Y),x.check=(...W)=>{return x.clone({...Q,checks:[...Q.checks??[],...W.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]})},x.clone=(W,Y)=>j1(x,W,Y),x.brand=()=>x,x.register=(W,Y)=>{return W.add(x,Y),x}});var rj=D("ZodMiniObject",(x,Q)=>{d9.init(x,Q),dj.init(x,Q),Q0.defineLazy(x,"shape",()=>Q.shape)});function nW(x,Q){let W={type:"object",get shape(){return Q0.assignProp(this,"shape",{...x}),this.shape},...Q0.normalizeParams(Q)};return new rj(W)}function P1(x){return!!x._zod}function Nx(x){let Q=Object.values(x);if(Q.length===0)return nW({});let W=Q.every(P1),Y=Q.every((X)=>!P1(X));if(W)return nW(x);if(Y)return m5(x);throw Error("Mixed Zod versions detected in object shape.")}function Z4(x,Q){if(P1(x))return Kx(x,Q);return x.safeParse(Q)}async function X3(x,Q){if(P1(x))return await Hx(x,Q);return await x.safeParseAsync(Q)}function C4(x){if(!x)return;let Q;if(P1(x))Q=x._zod?.def?.shape;else Q=x.shape;if(!Q)return;if(typeof Q==="function")try{return Q()}catch{return}return Q}function b8(x){if(!x)return;if(typeof x==="object"){let Q=x,W=x;if(!Q._def&&!W._zod){let Y=Object.values(x);if(Y.length>0&&Y.every((X)=>typeof X==="object"&&X!==null&&(X._def!==void 0||X._zod!==void 0||typeof X.parse==="function")))return Nx(x)}}if(P1(x)){let W=x._zod?.def;if(W&&(W.type==="object"||W.shape!==void 0))return x}else if(x.shape!==void 0)return x;return}function J3(x){if(x&&typeof x==="object"){if("message"in x&&typeof x.message==="string")return x.message;if("issues"in x&&Array.isArray(x.issues)&&x.issues.length>0){let Q=x.issues[0];if(Q&&typeof Q==="object"&&"message"in Q)return String(Q.message)}try{return JSON.stringify(x)}catch{return String(x)}}return String(x)}function Bv(x){return x.description}function Kv(x){if(P1(x))return x._zod?.def?.type==="optional";let Q=x;if(typeof x.isOptional==="function")return x.isOptional();return Q._def?.typeName==="ZodOptional"}function G3(x){if(P1(x)){let J=x._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let W=x._def;if(W){if(W.value!==void 0)return W.value;if(Array.isArray(W.values)&&W.values.length>0)return W.values[0]}let Y=x.value;if(Y!==void 0)return Y;return}var L6={};G9(L6,{time:()=>gW,duration:()=>yW,datetime:()=>mW,date:()=>fW,ZodISOTime:()=>qv,ZodISODuration:()=>Nv,ZodISODateTime:()=>Hv,ZodISODate:()=>Vv});var Hv=D("ZodISODateTime",(x,Q)=>{xv.init(x,Q),L0.init(x,Q)});function mW(x){return Gv(Hv,x)}var Vv=D("ZodISODate",(x,Q)=>{Qv.init(x,Q),L0.init(x,Q)});function fW(x){return bv(Vv,x)}var qv=D("ZodISOTime",(x,Q)=>{Wv.init(x,Q),L0.init(x,Q)});function gW(x){return $v(qv,x)}var Nv=D("ZodISODuration",(x,Q)=>{Yv.init(x,Q),L0.init(x,Q)});function yW(x){return zv(Nv,x)}var Fv=(x,Q)=>{y9.init(x,Q),x.name="ZodError",Object.defineProperties(x,{format:{value:(W)=>e5(x,W)},flatten:{value:(W)=>t5(x,W)},addIssue:{value:(W)=>x.issues.push(W)},addIssues:{value:(W)=>x.issues.push(...W)},isEmpty:{get(){return x.issues.length===0}}})},qm=D("ZodError",Fv),M6=D("ZodError",Fv,{Parent:Error});var Uv=xQ(M6),cv=WQ(M6),Lv=XQ(M6),Mv=JQ(M6);var A0=D("ZodType",(x,Q)=>{return B0.init(x,Q),x.def=Q,Object.defineProperty(x,"_def",{value:Q}),x.check=(...W)=>{return x.clone({...Q,checks:[...Q.checks??[],...W.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]})},x.clone=(W,Y)=>j1(x,W,Y),x.brand=()=>x,x.register=(W,Y)=>{return W.add(x,Y),x},x.parse=(W,Y)=>Uv(x,W,Y,{callee:x.parse}),x.safeParse=(W,Y)=>Lv(x,W,Y),x.parseAsync=async(W,Y)=>cv(x,W,Y,{callee:x.parseAsync}),x.safeParseAsync=async(W,Y)=>Mv(x,W,Y),x.spa=x.safeParseAsync,x.refine=(W,Y)=>x.check(oO(W,Y)),x.superRefine=(W)=>x.check(aO(W)),x.overwrite=(W)=>x.check(Vx(W)),x.optional=()=>D0(x),x.nullable=()=>Ov(x),x.nullish=()=>D0(Ov(x)),x.nonoptional=(W)=>pO(x,W),x.array=()=>W0(x),x.or=(W)=>U0([x,W]),x.and=(W)=>$3(x,W),x.transform=(W)=>oW(x,Pv(W)),x.default=(W)=>_O(x,W),x.prefault=(W)=>lO(x,W),x.catch=(W)=>mO(x,W),x.pipe=(W)=>oW(x,W),x.readonly=()=>yO(x),x.describe=(W)=>{let Y=x.clone();return i4.add(Y,{description:W}),Y},Object.defineProperty(x,"description",{get(){return i4.get(x)?.description},configurable:!0}),x.meta=(...W)=>{if(W.length===0)return i4.get(x);let Y=x.clone();return i4.add(Y,W[0]),Y},x.isOptional=()=>x.safeParse(void 0).success,x.isNullable=()=>x.safeParse(null).success,x}),Av=D("_ZodString",(x,Q)=>{F6.init(x,Q),A0.init(x,Q);let W=x._zod.bag;x.format=W.format??null,x.minLength=W.minimum??null,x.maxLength=W.maximum??null,x.regex=(...Y)=>x.check(IW(...Y)),x.includes=(...Y)=>x.check(RW(...Y)),x.startsWith=(...Y)=>x.check(PW(...Y)),x.endsWith=(...Y)=>x.check(iW(...Y)),x.min=(...Y)=>x.check(G8(...Y)),x.max=(...Y)=>x.check(W3(...Y)),x.length=(...Y)=>x.check(Y3(...Y)),x.nonempty=(...Y)=>x.check(G8(1,...Y)),x.lowercase=(Y)=>x.check(SW(Y)),x.uppercase=(Y)=>x.check(EW(Y)),x.trim=()=>x.check(CW()),x.normalize=(...Y)=>x.check(ZW(...Y)),x.toLowerCase=()=>x.check(TW()),x.toUpperCase=()=>x.check(kW())}),JO=D("ZodString",(x,Q)=>{F6.init(x,Q),Av.init(x,Q),x.email=(W)=>x.check(xW(GO,W)),x.url=(W)=>x.check(JW(bO,W)),x.jwt=(W)=>x.check(cW(MO,W)),x.emoji=(W)=>x.check(GW($O,W)),x.guid=(W)=>x.check(t9(Dv,W)),x.uuid=(W)=>x.check(QW(b3,W)),x.uuidv4=(W)=>x.check(WW(b3,W)),x.uuidv6=(W)=>x.check(YW(b3,W)),x.uuidv7=(W)=>x.check(XW(b3,W)),x.nanoid=(W)=>x.check(bW(zO,W)),x.guid=(W)=>x.check(t9(Dv,W)),x.cuid=(W)=>x.check($W(vO,W)),x.cuid2=(W)=>x.check(zW(wO,W)),x.ulid=(W)=>x.check(vW(BO,W)),x.base64=(W)=>x.check(NW(UO,W)),x.base64url=(W)=>x.check(FW(cO,W)),x.xid=(W)=>x.check(wW(KO,W)),x.ksuid=(W)=>x.check(BW(HO,W)),x.ipv4=(W)=>x.check(KW(VO,W)),x.ipv6=(W)=>x.check(HW(qO,W)),x.cidrv4=(W)=>x.check(VW(NO,W)),x.cidrv6=(W)=>x.check(qW(FO,W)),x.e164=(W)=>x.check(UW(LO,W)),x.datetime=(W)=>x.check(mW(W)),x.date=(W)=>x.check(fW(W)),x.time=(W)=>x.check(gW(W)),x.duration=(W)=>x.check(yW(W))});function L(x){return eQ(JO,x)}var L0=D("ZodStringFormat",(x,Q)=>{N0.init(x,Q),Av.init(x,Q)}),GO=D("ZodEmail",(x,Q)=>{HQ.init(x,Q),L0.init(x,Q)});var Dv=D("ZodGUID",(x,Q)=>{BQ.init(x,Q),L0.init(x,Q)});var b3=D("ZodUUID",(x,Q)=>{KQ.init(x,Q),L0.init(x,Q)});var bO=D("ZodURL",(x,Q)=>{VQ.init(x,Q),L0.init(x,Q)});var $O=D("ZodEmoji",(x,Q)=>{qQ.init(x,Q),L0.init(x,Q)});var zO=D("ZodNanoID",(x,Q)=>{NQ.init(x,Q),L0.init(x,Q)});var vO=D("ZodCUID",(x,Q)=>{FQ.init(x,Q),L0.init(x,Q)});var wO=D("ZodCUID2",(x,Q)=>{UQ.init(x,Q),L0.init(x,Q)});var BO=D("ZodULID",(x,Q)=>{cQ.init(x,Q),L0.init(x,Q)});var KO=D("ZodXID",(x,Q)=>{LQ.init(x,Q),L0.init(x,Q)});var HO=D("ZodKSUID",(x,Q)=>{MQ.init(x,Q),L0.init(x,Q)});var VO=D("ZodIPv4",(x,Q)=>{DQ.init(x,Q),L0.init(x,Q)});var qO=D("ZodIPv6",(x,Q)=>{jQ.init(x,Q),L0.init(x,Q)});var NO=D("ZodCIDRv4",(x,Q)=>{OQ.init(x,Q),L0.init(x,Q)});var FO=D("ZodCIDRv6",(x,Q)=>{AQ.init(x,Q),L0.init(x,Q)});var UO=D("ZodBase64",(x,Q)=>{IQ.init(x,Q),L0.init(x,Q)});var cO=D("ZodBase64URL",(x,Q)=>{SQ.init(x,Q),L0.init(x,Q)});var LO=D("ZodE164",(x,Q)=>{EQ.init(x,Q),L0.init(x,Q)});var MO=D("ZodJWT",(x,Q)=>{RQ.init(x,Q),L0.init(x,Q)});var Iv=D("ZodNumber",(x,Q)=>{a9.init(x,Q),A0.init(x,Q),x.gt=(Y,X)=>x.check(x3(Y,X)),x.gte=(Y,X)=>x.check(c6(Y,X)),x.min=(Y,X)=>x.check(c6(Y,X)),x.lt=(Y,X)=>x.check(e9(Y,X)),x.lte=(Y,X)=>x.check(U6(Y,X)),x.max=(Y,X)=>x.check(U6(Y,X)),x.int=(Y)=>x.check(jv(Y)),x.safe=(Y)=>x.check(jv(Y)),x.positive=(Y)=>x.check(x3(0,Y)),x.nonnegative=(Y)=>x.check(c6(0,Y)),x.negative=(Y)=>x.check(e9(0,Y)),x.nonpositive=(Y)=>x.check(U6(0,Y)),x.multipleOf=(Y,X)=>x.check(Q3(Y,X)),x.step=(Y,X)=>x.check(Q3(Y,X)),x.finite=()=>x;let W=x._zod.bag;x.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,x.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,x.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),x.isFinite=!0,x.format=W.format??null});function z0(x){return LW(Iv,x)}var DO=D("ZodNumberFormat",(x,Q)=>{PQ.init(x,Q),Iv.init(x,Q)});function jv(x){return MW(DO,x)}var jO=D("ZodBoolean",(x,Q)=>{iQ.init(x,Q),A0.init(x,Q)});function f0(x){return DW(jO,x)}var OO=D("ZodNull",(x,Q)=>{ZQ.init(x,Q),A0.init(x,Q)});function Sv(x){return jW(OO,x)}var AO=D("ZodUnknown",(x,Q)=>{CQ.init(x,Q),A0.init(x,Q)});function M0(){return OW(AO)}var IO=D("ZodNever",(x,Q)=>{TQ.init(x,Q),A0.init(x,Q)});function SO(x){return AW(IO,x)}var EO=D("ZodArray",(x,Q)=>{kQ.init(x,Q),A0.init(x,Q),x.element=Q.element,x.min=(W,Y)=>x.check(G8(W,Y)),x.nonempty=(W)=>x.check(G8(1,W)),x.max=(W,Y)=>x.check(W3(W,Y)),x.length=(W,Y)=>x.check(Y3(W,Y)),x.unwrap=()=>x.element});function W0(x,Q){return vv(EO,x,Q)}var Ev=D("ZodObject",(x,Q)=>{d9.init(x,Q),A0.init(x,Q),Q0.defineLazy(x,"shape",()=>Q.shape),x.keyof=()=>H1(Object.keys(x._zod.def.shape)),x.catchall=(W)=>x.clone({...x._zod.def,catchall:W}),x.passthrough=()=>x.clone({...x._zod.def,catchall:M0()}),x.loose=()=>x.clone({...x._zod.def,catchall:M0()}),x.strict=()=>x.clone({...x._zod.def,catchall:SO()}),x.strip=()=>x.clone({...x._zod.def,catchall:void 0}),x.extend=(W)=>{return Q0.extend(x,W)},x.merge=(W)=>Q0.merge(x,W),x.pick=(W)=>Q0.pick(x,W),x.omit=(W)=>Q0.omit(x,W),x.partial=(...W)=>Q0.partial(iv,x,W[0]),x.required=(...W)=>Q0.required(Zv,x,W[0])});function Z(x,Q){let W={type:"object",get shape(){return Q0.assignProp(this,"shape",{...x}),this.shape},...Q0.normalizeParams(Q)};return new Ev(W)}function J1(x,Q){return new Ev({type:"object",get shape(){return Q0.assignProp(this,"shape",{...x}),this.shape},catchall:M0(),...Q0.normalizeParams(Q)})}var Rv=D("ZodUnion",(x,Q)=>{r9.init(x,Q),A0.init(x,Q),x.options=Q.options});function U0(x,Q){return new Rv({type:"union",options:x,...Q0.normalizeParams(Q)})}var RO=D("ZodDiscriminatedUnion",(x,Q)=>{Rv.init(x,Q),_Q.init(x,Q)});function aW(x,Q,W){return new RO({type:"union",options:Q,discriminator:x,...Q0.normalizeParams(W)})}var PO=D("ZodIntersection",(x,Q)=>{uQ.init(x,Q),A0.init(x,Q)});function $3(x,Q){return new PO({type:"intersection",left:x,right:Q})}var iO=D("ZodRecord",(x,Q)=>{lQ.init(x,Q),A0.init(x,Q),x.keyType=Q.keyType,x.valueType=Q.valueType});function F0(x,Q,W){return new iO({type:"record",keyType:x,valueType:Q,...Q0.normalizeParams(W)})}var hW=D("ZodEnum",(x,Q)=>{pQ.init(x,Q),A0.init(x,Q),x.enum=Q.entries,x.options=Object.values(Q.entries);let W=new Set(Object.keys(Q.entries));x.extract=(Y,X)=>{let J={};for(let G of Y)if(W.has(G))J[G]=Q.entries[G];else throw Error(`Key ${G} not found in enum`);return new hW({...Q,checks:[],...Q0.normalizeParams(X),entries:J})},x.exclude=(Y,X)=>{let J={...Q.entries};for(let G of Y)if(W.has(G))delete J[G];else throw Error(`Key ${G} not found in enum`);return new hW({...Q,checks:[],...Q0.normalizeParams(X),entries:J})}});function H1(x,Q){let W=Array.isArray(x)?Object.fromEntries(x.map((Y)=>[Y,Y])):x;return new hW({type:"enum",entries:W,...Q0.normalizeParams(Q)})}var ZO=D("ZodLiteral",(x,Q)=>{nQ.init(x,Q),A0.init(x,Q),x.values=new Set(Q.values),Object.defineProperty(x,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});function _(x,Q){return new ZO({type:"literal",values:Array.isArray(x)?x:[x],...Q0.normalizeParams(Q)})}var CO=D("ZodTransform",(x,Q)=>{mQ.init(x,Q),A0.init(x,Q),x._zod.parse=(W,Y)=>{W.addIssue=(J)=>{if(typeof J==="string")W.issues.push(Q0.issue(J,W.value,Q));else{let G=J;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=W.value),G.inst??(G.inst=x),G.continue??(G.continue=!0),W.issues.push(Q0.issue(G))}};let X=Q.transform(W.value,W);if(X instanceof Promise)return X.then((J)=>{return W.value=J,W});return W.value=X,W}});function Pv(x){return new CO({type:"transform",transform:x})}var iv=D("ZodOptional",(x,Q)=>{fQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType});function D0(x){return new iv({type:"optional",innerType:x})}var TO=D("ZodNullable",(x,Q)=>{gQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType});function Ov(x){return new TO({type:"nullable",innerType:x})}var kO=D("ZodDefault",(x,Q)=>{yQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType,x.removeDefault=x.unwrap});function _O(x,Q){return new kO({type:"default",innerType:x,get defaultValue(){return typeof Q==="function"?Q():Q}})}var uO=D("ZodPrefault",(x,Q)=>{hQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType});function lO(x,Q){return new uO({type:"prefault",innerType:x,get defaultValue(){return typeof Q==="function"?Q():Q}})}var Zv=D("ZodNonOptional",(x,Q)=>{oQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType});function pO(x,Q){return new Zv({type:"nonoptional",innerType:x,...Q0.normalizeParams(Q)})}var nO=D("ZodCatch",(x,Q)=>{aQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType,x.removeCatch=x.unwrap});function mO(x,Q){return new nO({type:"catch",innerType:x,catchValue:typeof Q==="function"?Q:()=>Q})}var fO=D("ZodPipe",(x,Q)=>{dQ.init(x,Q),A0.init(x,Q),x.in=Q.in,x.out=Q.out});function oW(x,Q){return new fO({type:"pipe",in:x,out:Q})}var gO=D("ZodReadonly",(x,Q)=>{rQ.init(x,Q),A0.init(x,Q)});function yO(x){return new gO({type:"readonly",innerType:x})}var Cv=D("ZodCustom",(x,Q)=>{sQ.init(x,Q),A0.init(x,Q)});function hO(x){let Q=new a0({check:"custom"});return Q._zod.check=x,Q}function Tv(x,Q){return _W(Cv,x??(()=>!0),Q)}function oO(x,Q={}){return uW(Cv,x,Q)}function aO(x){let Q=hO((W)=>{return W.addIssue=(Y)=>{if(typeof Y==="string")W.issues.push(Q0.issue(Y,W.value,Q._zod.def));else{let X=Y;if(X.fatal)X.continue=!1;X.code??(X.code="custom"),X.input??(X.input=W.value),X.inst??(X.inst=Q),X.continue??(X.continue=!Q._zod.def.abort),W.issues.push(Q0.issue(X))}},x(W.value,W)});return Q}function dW(x,Q){return oW(Pv(x),Q)}D1(tQ());var rW="2025-11-25";var kv=[rW,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],T4="io.modelcontextprotocol/related-task",v3="2.0",_0=Tv((x)=>x!==null&&(typeof x==="object"||typeof x==="function")),_v=U0([L(),z0().int()]),uv=L(),Rm=J1({ttl:z0().optional(),pollInterval:z0().optional()}),dO=Z({ttl:z0().optional()}),rO=Z({taskId:L()}),sW=J1({progressToken:_v.optional(),[T4]:rO.optional()}),O1=Z({_meta:sW.optional()}),D6=O1.extend({task:dO.optional()}),lv=(x)=>D6.safeParse(x).success,d0=Z({method:L(),params:O1.loose().optional()}),i1=Z({_meta:sW.optional()}),Z1=Z({method:L(),params:i1.loose().optional()}),r0=J1({_meta:sW.optional()}),w3=U0([L(),z0().int()]),pv=Z({jsonrpc:_(v3),id:w3,...d0.shape}).strict(),tW=(x)=>pv.safeParse(x).success,nv=Z({jsonrpc:_(v3),...Z1.shape}).strict(),mv=(x)=>nv.safeParse(x).success,eW=Z({jsonrpc:_(v3),id:w3,result:r0}).strict(),j6=(x)=>eW.safeParse(x).success;var l;(function(x){x[x.ConnectionClosed=-32000]="ConnectionClosed",x[x.RequestTimeout=-32001]="RequestTimeout",x[x.ParseError=-32700]="ParseError",x[x.InvalidRequest=-32600]="InvalidRequest",x[x.MethodNotFound=-32601]="MethodNotFound",x[x.InvalidParams=-32602]="InvalidParams",x[x.InternalError=-32603]="InternalError",x[x.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(l||(l={}));var xY=Z({jsonrpc:_(v3),id:w3.optional(),error:Z({code:z0().int(),message:L(),data:M0().optional()})}).strict();var fv=(x)=>xY.safeParse(x).success;var gv=U0([pv,nv,eW,xY]),Pm=U0([eW,xY]),B3=r0.strict(),sO=i1.extend({requestId:w3.optional(),reason:L().optional()}),K3=Z1.extend({method:_("notifications/cancelled"),params:sO}),tO=Z({src:L(),mimeType:L().optional(),sizes:W0(L()).optional(),theme:H1(["light","dark"]).optional()}),O6=Z({icons:W0(tO).optional()}),$8=Z({name:L(),title:L().optional()}),yv=$8.extend({...$8.shape,...O6.shape,version:L(),websiteUrl:L().optional(),description:L().optional()}),eO=$3(Z({applyDefaults:f0().optional()}),F0(L(),M0())),xA=dW((x)=>{if(x&&typeof x==="object"&&!Array.isArray(x)){if(Object.keys(x).length===0)return{form:{}}}return x},$3(Z({form:eO.optional(),url:_0.optional()}),F0(L(),M0()).optional())),QA=J1({list:_0.optional(),cancel:_0.optional(),requests:J1({sampling:J1({createMessage:_0.optional()}).optional(),elicitation:J1({create:_0.optional()}).optional()}).optional()}),WA=J1({list:_0.optional(),cancel:_0.optional(),requests:J1({tools:J1({call:_0.optional()}).optional()}).optional()}),YA=Z({experimental:F0(L(),_0).optional(),sampling:Z({context:_0.optional(),tools:_0.optional()}).optional(),elicitation:xA.optional(),roots:Z({listChanged:f0().optional()}).optional(),tasks:QA.optional(),extensions:F0(L(),_0).optional()}),XA=O1.extend({protocolVersion:L(),capabilities:YA,clientInfo:yv}),QY=d0.extend({method:_("initialize"),params:XA});var JA=Z({experimental:F0(L(),_0).optional(),logging:_0.optional(),completions:_0.optional(),prompts:Z({listChanged:f0().optional()}).optional(),resources:Z({subscribe:f0().optional(),listChanged:f0().optional()}).optional(),tools:Z({listChanged:f0().optional()}).optional(),tasks:WA.optional(),extensions:F0(L(),_0).optional()}),GA=r0.extend({protocolVersion:L(),capabilities:JA,serverInfo:yv,instructions:L().optional()}),WY=Z1.extend({method:_("notifications/initialized"),params:i1.optional()});var H3=d0.extend({method:_("ping"),params:O1.optional()}),bA=Z({progress:z0(),total:D0(z0()),message:D0(L())}),$A=Z({...i1.shape,...bA.shape,progressToken:_v}),V3=Z1.extend({method:_("notifications/progress"),params:$A}),zA=O1.extend({cursor:uv.optional()}),A6=d0.extend({params:zA.optional()}),I6=r0.extend({nextCursor:uv.optional()}),vA=H1(["working","input_required","completed","failed","cancelled"]),S6=Z({taskId:L(),status:vA,ttl:U0([z0(),Sv()]),createdAt:L(),lastUpdatedAt:L(),pollInterval:D0(z0()),statusMessage:D0(L())}),z8=r0.extend({task:S6}),wA=i1.merge(S6),E6=Z1.extend({method:_("notifications/tasks/status"),params:wA}),q3=d0.extend({method:_("tasks/get"),params:O1.extend({taskId:L()})}),N3=r0.merge(S6),F3=d0.extend({method:_("tasks/result"),params:O1.extend({taskId:L()})}),im=r0.loose(),U3=A6.extend({method:_("tasks/list")}),c3=I6.extend({tasks:W0(S6)}),L3=d0.extend({method:_("tasks/cancel"),params:O1.extend({taskId:L()})}),hv=r0.merge(S6),ov=Z({uri:L(),mimeType:D0(L()),_meta:F0(L(),M0()).optional()}),av=ov.extend({text:L()}),YY=L().refine((x)=>{try{return atob(x),!0}catch{return!1}},{message:"Invalid Base64 string"}),dv=ov.extend({blob:YY}),R6=H1(["user","assistant"]),v8=Z({audience:W0(R6).optional(),priority:z0().min(0).max(1).optional(),lastModified:L6.datetime({offset:!0}).optional()}),rv=Z({...$8.shape,...O6.shape,uri:L(),description:D0(L()),mimeType:D0(L()),size:D0(z0()),annotations:v8.optional(),_meta:D0(J1({}))}),BA=Z({...$8.shape,...O6.shape,uriTemplate:L(),description:D0(L()),mimeType:D0(L()),annotations:v8.optional(),_meta:D0(J1({}))}),M3=A6.extend({method:_("resources/list")}),KA=I6.extend({resources:W0(rv)}),D3=A6.extend({method:_("resources/templates/list")}),HA=I6.extend({resourceTemplates:W0(BA)}),XY=O1.extend({uri:L()}),VA=XY,j3=d0.extend({method:_("resources/read"),params:VA}),qA=r0.extend({contents:W0(U0([av,dv]))}),NA=Z1.extend({method:_("notifications/resources/list_changed"),params:i1.optional()}),FA=XY,UA=d0.extend({method:_("resources/subscribe"),params:FA}),cA=XY,LA=d0.extend({method:_("resources/unsubscribe"),params:cA}),MA=i1.extend({uri:L()}),DA=Z1.extend({method:_("notifications/resources/updated"),params:MA}),jA=Z({name:L(),description:D0(L()),required:D0(f0())}),OA=Z({...$8.shape,...O6.shape,description:D0(L()),arguments:D0(W0(jA)),_meta:D0(J1({}))}),O3=A6.extend({method:_("prompts/list")}),AA=I6.extend({prompts:W0(OA)}),IA=O1.extend({name:L(),arguments:F0(L(),L()).optional()}),A3=d0.extend({method:_("prompts/get"),params:IA}),JY=Z({type:_("text"),text:L(),annotations:v8.optional(),_meta:F0(L(),M0()).optional()}),GY=Z({type:_("image"),data:YY,mimeType:L(),annotations:v8.optional(),_meta:F0(L(),M0()).optional()}),bY=Z({type:_("audio"),data:YY,mimeType:L(),annotations:v8.optional(),_meta:F0(L(),M0()).optional()}),SA=Z({type:_("tool_use"),name:L(),id:L(),input:F0(L(),M0()),_meta:F0(L(),M0()).optional()}),EA=Z({type:_("resource"),resource:U0([av,dv]),annotations:v8.optional(),_meta:F0(L(),M0()).optional()}),RA=rv.extend({type:_("resource_link")}),$Y=U0([JY,GY,bY,RA,EA]),PA=Z({role:R6,content:$Y}),iA=r0.extend({description:L().optional(),messages:W0(PA)}),ZA=Z1.extend({method:_("notifications/prompts/list_changed"),params:i1.optional()}),CA=Z({title:L().optional(),readOnlyHint:f0().optional(),destructiveHint:f0().optional(),idempotentHint:f0().optional(),openWorldHint:f0().optional()}),TA=Z({taskSupport:H1(["required","optional","forbidden"]).optional()}),sv=Z({...$8.shape,...O6.shape,description:L().optional(),inputSchema:Z({type:_("object"),properties:F0(L(),_0).optional(),required:W0(L()).optional()}).catchall(M0()),outputSchema:Z({type:_("object"),properties:F0(L(),_0).optional(),required:W0(L()).optional()}).catchall(M0()).optional(),annotations:CA.optional(),execution:TA.optional(),_meta:F0(L(),M0()).optional()}),I3=A6.extend({method:_("tools/list")}),kA=I6.extend({tools:W0(sv)}),S3=r0.extend({content:W0($Y).default([]),structuredContent:F0(L(),M0()).optional(),isError:f0().optional()}),Zm=S3.or(r0.extend({toolResult:M0()})),_A=D6.extend({name:L(),arguments:F0(L(),M0()).optional()}),w8=d0.extend({method:_("tools/call"),params:_A}),uA=Z1.extend({method:_("notifications/tools/list_changed"),params:i1.optional()}),Cm=Z({autoRefresh:f0().default(!0),debounceMs:z0().int().nonnegative().default(300)}),P6=H1(["debug","info","notice","warning","error","critical","alert","emergency"]),lA=O1.extend({level:P6}),zY=d0.extend({method:_("logging/setLevel"),params:lA}),pA=i1.extend({level:P6,logger:L().optional(),data:M0()}),nA=Z1.extend({method:_("notifications/message"),params:pA}),mA=Z({name:L().optional()}),fA=Z({hints:W0(mA).optional(),costPriority:z0().min(0).max(1).optional(),speedPriority:z0().min(0).max(1).optional(),intelligencePriority:z0().min(0).max(1).optional()}),gA=Z({mode:H1(["auto","required","none"]).optional()}),yA=Z({type:_("tool_result"),toolUseId:L().describe("The unique identifier for the corresponding tool call."),content:W0($Y).default([]),structuredContent:Z({}).loose().optional(),isError:f0().optional(),_meta:F0(L(),M0()).optional()}),hA=aW("type",[JY,GY,bY]),z3=aW("type",[JY,GY,bY,SA,yA]),oA=Z({role:R6,content:U0([z3,W0(z3)]),_meta:F0(L(),M0()).optional()}),aA=D6.extend({messages:W0(oA),modelPreferences:fA.optional(),systemPrompt:L().optional(),includeContext:H1(["none","thisServer","allServers"]).optional(),temperature:z0().optional(),maxTokens:z0().int(),stopSequences:W0(L()).optional(),metadata:_0.optional(),tools:W0(sv).optional(),toolChoice:gA.optional()}),dA=d0.extend({method:_("sampling/createMessage"),params:aA}),i6=r0.extend({model:L(),stopReason:D0(H1(["endTurn","stopSequence","maxTokens"]).or(L())),role:R6,content:hA}),vY=r0.extend({model:L(),stopReason:D0(H1(["endTurn","stopSequence","maxTokens","toolUse"]).or(L())),role:R6,content:U0([z3,W0(z3)])}),rA=Z({type:_("boolean"),title:L().optional(),description:L().optional(),default:f0().optional()}),sA=Z({type:_("string"),title:L().optional(),description:L().optional(),minLength:z0().optional(),maxLength:z0().optional(),format:H1(["email","uri","date","date-time"]).optional(),default:L().optional()}),tA=Z({type:H1(["number","integer"]),title:L().optional(),description:L().optional(),minimum:z0().optional(),maximum:z0().optional(),default:z0().optional()}),eA=Z({type:_("string"),title:L().optional(),description:L().optional(),enum:W0(L()),default:L().optional()}),x2=Z({type:_("string"),title:L().optional(),description:L().optional(),oneOf:W0(Z({const:L(),title:L()})),default:L().optional()}),Q2=Z({type:_("string"),title:L().optional(),description:L().optional(),enum:W0(L()),enumNames:W0(L()).optional(),default:L().optional()}),W2=U0([eA,x2]),Y2=Z({type:_("array"),title:L().optional(),description:L().optional(),minItems:z0().optional(),maxItems:z0().optional(),items:Z({type:_("string"),enum:W0(L())}),default:W0(L()).optional()}),X2=Z({type:_("array"),title:L().optional(),description:L().optional(),minItems:z0().optional(),maxItems:z0().optional(),items:Z({anyOf:W0(Z({const:L(),title:L()}))}),default:W0(L()).optional()}),J2=U0([Y2,X2]),G2=U0([Q2,W2,J2]),b2=U0([G2,rA,sA,tA]),$2=D6.extend({mode:_("form").optional(),message:L(),requestedSchema:Z({type:_("object"),properties:F0(L(),b2),required:W0(L()).optional()})}),z2=D6.extend({mode:_("url"),message:L(),elicitationId:L(),url:L().url()}),v2=U0([$2,z2]),w2=d0.extend({method:_("elicitation/create"),params:v2}),B2=i1.extend({elicitationId:L()}),K2=Z1.extend({method:_("notifications/elicitation/complete"),params:B2}),B8=r0.extend({action:H1(["accept","decline","cancel"]),content:dW((x)=>x===null?void 0:x,F0(L(),U0([L(),z0(),f0(),W0(L())])).optional())}),H2=Z({type:_("ref/resource"),uri:L()});var V2=Z({type:_("ref/prompt"),name:L()}),q2=O1.extend({ref:U0([V2,H2]),argument:Z({name:L(),value:L()}),context:Z({arguments:F0(L(),L()).optional()}).optional()}),E3=d0.extend({method:_("completion/complete"),params:q2});function tv(x){if(x.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${x.params.ref.type}`)}function ev(x){if(x.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${x.params.ref.type}`)}var N2=r0.extend({completion:J1({values:W0(L()).max(100),total:D0(z0().int()),hasMore:D0(f0())})}),F2=Z({uri:L().startsWith("file://"),name:L().optional(),_meta:F0(L(),M0()).optional()}),U2=d0.extend({method:_("roots/list"),params:O1.optional()}),wY=r0.extend({roots:W0(F2)}),c2=Z1.extend({method:_("notifications/roots/list_changed"),params:i1.optional()}),Tm=U0([H3,QY,E3,zY,A3,O3,M3,D3,j3,UA,LA,w8,I3,q3,F3,U3,L3]),km=U0([K3,V3,WY,c2,E6]),_m=U0([B3,i6,vY,B8,wY,N3,c3,z8]),um=U0([H3,dA,w2,U2,q3,F3,U3,L3]),lm=U0([K3,V3,nA,DA,NA,uA,ZA,E6,K2]),pm=U0([B3,GA,N2,iA,AA,KA,HA,qA,S3,kA,N3,c3,z8]);class k extends Error{constructor(x,Q,W){super(`MCP error ${x}: ${Q}`);this.code=x,this.data=W,this.name="McpError"}static fromError(x,Q,W){if(x===l.UrlElicitationRequired&&W){let Y=W;if(Y.elicitations)return new xw(Y.elicitations,Q)}return new k(x,Q,W)}}class xw extends k{constructor(x,Q=`URL elicitation${x.length>1?"s":""} required`){super(l.UrlElicitationRequired,Q,{elicitations:x})}get elicitations(){return this.data?.elicitations??[]}}function k4(x){return x==="completed"||x==="failed"||x==="cancelled"}var Ww=Symbol("Let zodToJsonSchema decide on which parser to use");var Qw={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",openAiAnyTypeName:"OpenAiAnyType"},Yw=(x)=>typeof x==="string"?{...Qw,name:x}:{...Qw,...x};var Xw=(x)=>{let Q=Yw(x),W=Q.name!==void 0?[...Q.basePath,Q.definitionPath,Q.name]:Q.basePath;return{...Q,flags:{hasReferencedOpenAiAnyType:!1},currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(Q.definitions).map(([Y,X])=>[X._def,{def:X._def,path:[...Q.basePath,Q.definitionPath,Y],jsonSchema:void 0}]))}};function BY(x,Q,W,Y){if(!Y?.errorMessages)return;if(W)x.errorMessage={...x.errorMessage,[Q]:W}}function Y0(x,Q,W,Y,X){x[Q]=W,BY(x,Q,Y,X)}var R3=(x,Q)=>{let W=0;for(;W<x.length&&W<Q.length;W++)if(x[W]!==Q[W])break;return[(x.length-W).toString(),...Q.slice(W)].join("/")};function j0(x){if(x.target!=="openAi")return{};let Q=[...x.basePath,x.definitionPath,x.openAiAnyTypeName];return x.flags.hasReferencedOpenAiAnyType=!0,{$ref:x.$refStrategy==="relative"?R3(Q,x.currentPath):Q.join("/")}}function Jw(x,Q){let W={type:"array"};if(x.type?._def&&x.type?._def?.typeName!==I.ZodAny)W.items=m(x.type._def,{...Q,currentPath:[...Q.currentPath,"items"]});if(x.minLength)Y0(W,"minItems",x.minLength.value,x.minLength.message,Q);if(x.maxLength)Y0(W,"maxItems",x.maxLength.value,x.maxLength.message,Q);if(x.exactLength)Y0(W,"minItems",x.exactLength.value,x.exactLength.message,Q),Y0(W,"maxItems",x.exactLength.value,x.exactLength.message,Q);return W}function Gw(x,Q){let W={type:"integer",format:"int64"};if(!x.checks)return W;for(let Y of x.checks)switch(Y.kind){case"min":if(Q.target==="jsonSchema7")if(Y.inclusive)Y0(W,"minimum",Y.value,Y.message,Q);else Y0(W,"exclusiveMinimum",Y.value,Y.message,Q);else{if(!Y.inclusive)W.exclusiveMinimum=!0;Y0(W,"minimum",Y.value,Y.message,Q)}break;case"max":if(Q.target==="jsonSchema7")if(Y.inclusive)Y0(W,"maximum",Y.value,Y.message,Q);else Y0(W,"exclusiveMaximum",Y.value,Y.message,Q);else{if(!Y.inclusive)W.exclusiveMaximum=!0;Y0(W,"maximum",Y.value,Y.message,Q)}break;case"multipleOf":Y0(W,"multipleOf",Y.value,Y.message,Q);break}return W}function bw(){return{type:"boolean"}}function P3(x,Q){return m(x.type._def,Q)}var $w=(x,Q)=>{return m(x.innerType._def,Q)};function KY(x,Q,W){let Y=W??Q.dateStrategy;if(Array.isArray(Y))return{anyOf:Y.map((X,J)=>KY(x,Q,X))};switch(Y){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return L2(x,Q)}}var L2=(x,Q)=>{let W={type:"integer",format:"unix-time"};if(Q.target==="openApi3")return W;for(let Y of x.checks)switch(Y.kind){case"min":Y0(W,"minimum",Y.value,Y.message,Q);break;case"max":Y0(W,"maximum",Y.value,Y.message,Q);break}return W};function zw(x,Q){return{...m(x.innerType._def,Q),default:x.defaultValue()}}function vw(x,Q){return Q.effectStrategy==="input"?m(x.schema._def,Q):j0(Q)}function ww(x){return{type:"string",enum:Array.from(x.values)}}var M2=(x)=>{if("type"in x&&x.type==="string")return!1;return"allOf"in x};function Bw(x,Q){let W=[m(x.left._def,{...Q,currentPath:[...Q.currentPath,"allOf","0"]}),m(x.right._def,{...Q,currentPath:[...Q.currentPath,"allOf","1"]})].filter((J)=>!!J),Y=Q.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,X=[];return W.forEach((J)=>{if(M2(J)){if(X.push(...J.allOf),J.unevaluatedProperties===void 0)Y=void 0}else{let G=J;if("additionalProperties"in J&&J.additionalProperties===!1){let{additionalProperties:b,...$}=J;G=$}else Y=void 0;X.push(G)}}),X.length?{allOf:X,...Y}:void 0}function Kw(x,Q){let W=typeof x.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray(x.value)?"array":"object"};if(Q.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[x.value]};return{type:W==="bigint"?"integer":W,const:x.value}}var HY=void 0,h1={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(HY===void 0)HY=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return HY},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 i3(x,Q){let W={type:"string"};if(x.checks)for(let Y of x.checks)switch(Y.kind){case"min":Y0(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Y.value):Y.value,Y.message,Q);break;case"max":Y0(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Y.value):Y.value,Y.message,Q);break;case"email":switch(Q.emailStrategy){case"format:email":o1(W,"email",Y.message,Q);break;case"format:idn-email":o1(W,"idn-email",Y.message,Q);break;case"pattern:zod":G1(W,h1.email,Y.message,Q);break}break;case"url":o1(W,"uri",Y.message,Q);break;case"uuid":o1(W,"uuid",Y.message,Q);break;case"regex":G1(W,Y.regex,Y.message,Q);break;case"cuid":G1(W,h1.cuid,Y.message,Q);break;case"cuid2":G1(W,h1.cuid2,Y.message,Q);break;case"startsWith":G1(W,RegExp(`^${VY(Y.value,Q)}`),Y.message,Q);break;case"endsWith":G1(W,RegExp(`${VY(Y.value,Q)}$`),Y.message,Q);break;case"datetime":o1(W,"date-time",Y.message,Q);break;case"date":o1(W,"date",Y.message,Q);break;case"time":o1(W,"time",Y.message,Q);break;case"duration":o1(W,"duration",Y.message,Q);break;case"length":Y0(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Y.value):Y.value,Y.message,Q),Y0(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Y.value):Y.value,Y.message,Q);break;case"includes":{G1(W,RegExp(VY(Y.value,Q)),Y.message,Q);break}case"ip":{if(Y.version!=="v6")o1(W,"ipv4",Y.message,Q);if(Y.version!=="v4")o1(W,"ipv6",Y.message,Q);break}case"base64url":G1(W,h1.base64url,Y.message,Q);break;case"jwt":G1(W,h1.jwt,Y.message,Q);break;case"cidr":{if(Y.version!=="v6")G1(W,h1.ipv4Cidr,Y.message,Q);if(Y.version!=="v4")G1(W,h1.ipv6Cidr,Y.message,Q);break}case"emoji":G1(W,h1.emoji(),Y.message,Q);break;case"ulid":{G1(W,h1.ulid,Y.message,Q);break}case"base64":{switch(Q.base64Strategy){case"format:binary":{o1(W,"binary",Y.message,Q);break}case"contentEncoding:base64":{Y0(W,"contentEncoding","base64",Y.message,Q);break}case"pattern:zod":{G1(W,h1.base64,Y.message,Q);break}}break}case"nanoid":G1(W,h1.nanoid,Y.message,Q);case"toLowerCase":case"toUpperCase":case"trim":break;default:((X)=>{})(Y)}return W}function VY(x,Q){return Q.patternStrategy==="escape"?j2(x):x}var D2=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function j2(x){let Q="";for(let W=0;W<x.length;W++){if(!D2.has(x[W]))Q+="\\";Q+=x[W]}return Q}function o1(x,Q,W,Y){if(x.format||x.anyOf?.some((X)=>X.format)){if(!x.anyOf)x.anyOf=[];if(x.format){if(x.anyOf.push({format:x.format,...x.errorMessage&&Y.errorMessages&&{errorMessage:{format:x.errorMessage.format}}}),delete x.format,x.errorMessage){if(delete x.errorMessage.format,Object.keys(x.errorMessage).length===0)delete x.errorMessage}}x.anyOf.push({format:Q,...W&&Y.errorMessages&&{errorMessage:{format:W}}})}else Y0(x,"format",Q,W,Y)}function G1(x,Q,W,Y){if(x.pattern||x.allOf?.some((X)=>X.pattern)){if(!x.allOf)x.allOf=[];if(x.pattern){if(x.allOf.push({pattern:x.pattern,...x.errorMessage&&Y.errorMessages&&{errorMessage:{pattern:x.errorMessage.pattern}}}),delete x.pattern,x.errorMessage){if(delete x.errorMessage.pattern,Object.keys(x.errorMessage).length===0)delete x.errorMessage}}x.allOf.push({pattern:Hw(Q,Y),...W&&Y.errorMessages&&{errorMessage:{pattern:W}}})}else Y0(x,"pattern",Hw(Q,Y),W,Y)}function Hw(x,Q){if(!Q.applyRegexFlags||!x.flags)return x.source;let W={i:x.flags.includes("i"),m:x.flags.includes("m"),s:x.flags.includes("s")},Y=W.i?x.source.toLowerCase():x.source,X="",J=!1,G=!1,b=!1;for(let $=0;$<Y.length;$++){if(J){X+=Y[$],J=!1;continue}if(W.i){if(G){if(Y[$].match(/[a-z]/)){if(b)X+=Y[$],X+=`${Y[$-2]}-${Y[$]}`.toUpperCase(),b=!1;else if(Y[$+1]==="-"&&Y[$+2]?.match(/[a-z]/))X+=Y[$],b=!0;else X+=`${Y[$]}${Y[$].toUpperCase()}`;continue}}else if(Y[$].match(/[a-z]/)){X+=`[${Y[$]}${Y[$].toUpperCase()}]`;continue}}if(W.m){if(Y[$]==="^"){X+=`(^|(?<=[\r
|
|
62
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let z of this.seen.entries()){let v=z[1];if(x===z[0]){J(z);continue}if(W.external){let K=W.external.registry.get(z[0])?.id;if(x!==z[0]&&K){J(z);continue}}if(this.metadataRegistry.get(z[0])?.id){J(z);continue}if(v.cycle){J(z);continue}if(v.count>1){if(W.reused==="ref"){J(z);continue}}}let G=(z,v)=>{let w=this.seen.get(z),K=w.def??w.schema,B={...K};if(w.ref===null)return;let V=w.ref;if(w.ref=null,V){G(V,v);let N=this.seen.get(V).schema;if(N.$ref&&v.target==="draft-7")K.allOf=K.allOf??[],K.allOf.push(N);else Object.assign(K,N),Object.assign(K,B)}if(!w.isParent)this.override({zodSchema:z,jsonSchema:K,path:w.path??[]})};for(let z of[...this.seen.entries()].reverse())G(z[0],{target:this.target});let b={};if(this.target==="draft-2020-12")b.$schema="https://json-schema.org/draft/2020-12/schema";else if(this.target==="draft-7")b.$schema="http://json-schema.org/draft-07/schema#";else console.warn(`Invalid target: ${this.target}`);if(W.external?.uri){let z=W.external.registry.get(x)?.id;if(!z)throw Error("Schema is missing an `id` property");b.$id=W.external.uri(z)}Object.assign(b,Y.def);let $=W.external?.defs??{};for(let z of this.seen.entries()){let v=z[1];if(v.def&&v.defId)$[v.defId]=v.def}if(W.external);else if(Object.keys($).length>0)if(this.target==="draft-2020-12")b.$defs=$;else b.definitions=$;try{return JSON.parse(JSON.stringify(b))}catch(z){throw Error("Error converting schema to JSON.")}}}function pW(x,Q){if(x instanceof s9){let Y=new lW(Q),X={};for(let b of x._idmap.entries()){let[$,z]=b;Y.process(z)}let J={},G={registry:x,uri:Q?.uri,defs:X};for(let b of x._idmap.entries()){let[$,z]=b;J[$]=Y.emit(z,{...Q,external:G})}if(Object.keys(X).length>0){let b=Y.target==="draft-2020-12"?"$defs":"definitions";J.__shared={[b]:X}}return{schemas:J}}let W=new lW(Q);return W.process(x),W.emit(x,Q)}function k0(x,Q){let W=Q??{seen:new Set};if(W.seen.has(x))return!1;W.seen.add(x);let X=x._zod.def;switch(X.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return k0(X.element,W);case"object":{for(let J in X.shape)if(k0(X.shape[J],W))return!0;return!1}case"union":{for(let J of X.options)if(k0(J,W))return!0;return!1}case"intersection":return k0(X.left,W)||k0(X.right,W);case"tuple":{for(let J of X.items)if(k0(J,W))return!0;if(X.rest&&k0(X.rest,W))return!0;return!1}case"record":return k0(X.keyType,W)||k0(X.valueType,W);case"map":return k0(X.keyType,W)||k0(X.valueType,W);case"set":return k0(X.valueType,W);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return k0(X.innerType,W);case"lazy":return k0(X.getter(),W);case"default":return k0(X.innerType,W);case"prefault":return k0(X.innerType,W);case"custom":return!1;case"transform":return!0;case"pipe":return k0(X.in,W)||k0(X.out,W);case"success":return!1;case"catch":return!1;default:}throw Error(`Unknown schema type: ${X.type}`)}var dj=D("ZodMiniType",(x,Q)=>{if(!x._zod)throw Error("Uninitialized schema in ZodMiniType.");B0.init(x,Q),x.def=Q,x.parse=(W,Y)=>QQ(x,W,Y,{callee:x.parse}),x.safeParse=(W,Y)=>Kx(x,W,Y),x.parseAsync=async(W,Y)=>YQ(x,W,Y,{callee:x.parseAsync}),x.safeParseAsync=async(W,Y)=>Hx(x,W,Y),x.check=(...W)=>{return x.clone({...Q,checks:[...Q.checks??[],...W.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]})},x.clone=(W,Y)=>j1(x,W,Y),x.brand=()=>x,x.register=(W,Y)=>{return W.add(x,Y),x}});var rj=D("ZodMiniObject",(x,Q)=>{d9.init(x,Q),dj.init(x,Q),Q0.defineLazy(x,"shape",()=>Q.shape)});function nW(x,Q){let W={type:"object",get shape(){return Q0.assignProp(this,"shape",{...x}),this.shape},...Q0.normalizeParams(Q)};return new rj(W)}function P1(x){return!!x._zod}function Nx(x){let Q=Object.values(x);if(Q.length===0)return nW({});let W=Q.every(P1),Y=Q.every((X)=>!P1(X));if(W)return nW(x);if(Y)return m5(x);throw Error("Mixed Zod versions detected in object shape.")}function Z4(x,Q){if(P1(x))return Kx(x,Q);return x.safeParse(Q)}async function X3(x,Q){if(P1(x))return await Hx(x,Q);return await x.safeParseAsync(Q)}function C4(x){if(!x)return;let Q;if(P1(x))Q=x._zod?.def?.shape;else Q=x.shape;if(!Q)return;if(typeof Q==="function")try{return Q()}catch{return}return Q}function b8(x){if(!x)return;if(typeof x==="object"){let Q=x,W=x;if(!Q._def&&!W._zod){let Y=Object.values(x);if(Y.length>0&&Y.every((X)=>typeof X==="object"&&X!==null&&(X._def!==void 0||X._zod!==void 0||typeof X.parse==="function")))return Nx(x)}}if(P1(x)){let W=x._zod?.def;if(W&&(W.type==="object"||W.shape!==void 0))return x}else if(x.shape!==void 0)return x;return}function J3(x){if(x&&typeof x==="object"){if("message"in x&&typeof x.message==="string")return x.message;if("issues"in x&&Array.isArray(x.issues)&&x.issues.length>0){let Q=x.issues[0];if(Q&&typeof Q==="object"&&"message"in Q)return String(Q.message)}try{return JSON.stringify(x)}catch{return String(x)}}return String(x)}function Bv(x){return x.description}function Kv(x){if(P1(x))return x._zod?.def?.type==="optional";let Q=x;if(typeof x.isOptional==="function")return x.isOptional();return Q._def?.typeName==="ZodOptional"}function G3(x){if(P1(x)){let J=x._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let W=x._def;if(W){if(W.value!==void 0)return W.value;if(Array.isArray(W.values)&&W.values.length>0)return W.values[0]}let Y=x.value;if(Y!==void 0)return Y;return}var L6={};G9(L6,{time:()=>gW,duration:()=>yW,datetime:()=>mW,date:()=>fW,ZodISOTime:()=>qv,ZodISODuration:()=>Nv,ZodISODateTime:()=>Hv,ZodISODate:()=>Vv});var Hv=D("ZodISODateTime",(x,Q)=>{xv.init(x,Q),L0.init(x,Q)});function mW(x){return Gv(Hv,x)}var Vv=D("ZodISODate",(x,Q)=>{Qv.init(x,Q),L0.init(x,Q)});function fW(x){return bv(Vv,x)}var qv=D("ZodISOTime",(x,Q)=>{Wv.init(x,Q),L0.init(x,Q)});function gW(x){return $v(qv,x)}var Nv=D("ZodISODuration",(x,Q)=>{Yv.init(x,Q),L0.init(x,Q)});function yW(x){return zv(Nv,x)}var Fv=(x,Q)=>{y9.init(x,Q),x.name="ZodError",Object.defineProperties(x,{format:{value:(W)=>e5(x,W)},flatten:{value:(W)=>t5(x,W)},addIssue:{value:(W)=>x.issues.push(W)},addIssues:{value:(W)=>x.issues.push(...W)},isEmpty:{get(){return x.issues.length===0}}})},qm=D("ZodError",Fv),M6=D("ZodError",Fv,{Parent:Error});var Uv=xQ(M6),cv=WQ(M6),Lv=XQ(M6),Mv=JQ(M6);var A0=D("ZodType",(x,Q)=>{return B0.init(x,Q),x.def=Q,Object.defineProperty(x,"_def",{value:Q}),x.check=(...W)=>{return x.clone({...Q,checks:[...Q.checks??[],...W.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]})},x.clone=(W,Y)=>j1(x,W,Y),x.brand=()=>x,x.register=(W,Y)=>{return W.add(x,Y),x},x.parse=(W,Y)=>Uv(x,W,Y,{callee:x.parse}),x.safeParse=(W,Y)=>Lv(x,W,Y),x.parseAsync=async(W,Y)=>cv(x,W,Y,{callee:x.parseAsync}),x.safeParseAsync=async(W,Y)=>Mv(x,W,Y),x.spa=x.safeParseAsync,x.refine=(W,Y)=>x.check(oO(W,Y)),x.superRefine=(W)=>x.check(aO(W)),x.overwrite=(W)=>x.check(Vx(W)),x.optional=()=>D0(x),x.nullable=()=>Ov(x),x.nullish=()=>D0(Ov(x)),x.nonoptional=(W)=>pO(x,W),x.array=()=>W0(x),x.or=(W)=>U0([x,W]),x.and=(W)=>$3(x,W),x.transform=(W)=>oW(x,Pv(W)),x.default=(W)=>_O(x,W),x.prefault=(W)=>lO(x,W),x.catch=(W)=>mO(x,W),x.pipe=(W)=>oW(x,W),x.readonly=()=>yO(x),x.describe=(W)=>{let Y=x.clone();return i4.add(Y,{description:W}),Y},Object.defineProperty(x,"description",{get(){return i4.get(x)?.description},configurable:!0}),x.meta=(...W)=>{if(W.length===0)return i4.get(x);let Y=x.clone();return i4.add(Y,W[0]),Y},x.isOptional=()=>x.safeParse(void 0).success,x.isNullable=()=>x.safeParse(null).success,x}),Av=D("_ZodString",(x,Q)=>{F6.init(x,Q),A0.init(x,Q);let W=x._zod.bag;x.format=W.format??null,x.minLength=W.minimum??null,x.maxLength=W.maximum??null,x.regex=(...Y)=>x.check(IW(...Y)),x.includes=(...Y)=>x.check(RW(...Y)),x.startsWith=(...Y)=>x.check(PW(...Y)),x.endsWith=(...Y)=>x.check(iW(...Y)),x.min=(...Y)=>x.check(G8(...Y)),x.max=(...Y)=>x.check(W3(...Y)),x.length=(...Y)=>x.check(Y3(...Y)),x.nonempty=(...Y)=>x.check(G8(1,...Y)),x.lowercase=(Y)=>x.check(SW(Y)),x.uppercase=(Y)=>x.check(EW(Y)),x.trim=()=>x.check(CW()),x.normalize=(...Y)=>x.check(ZW(...Y)),x.toLowerCase=()=>x.check(TW()),x.toUpperCase=()=>x.check(kW())}),JO=D("ZodString",(x,Q)=>{F6.init(x,Q),Av.init(x,Q),x.email=(W)=>x.check(xW(GO,W)),x.url=(W)=>x.check(JW(bO,W)),x.jwt=(W)=>x.check(cW(MO,W)),x.emoji=(W)=>x.check(GW($O,W)),x.guid=(W)=>x.check(t9(Dv,W)),x.uuid=(W)=>x.check(QW(b3,W)),x.uuidv4=(W)=>x.check(WW(b3,W)),x.uuidv6=(W)=>x.check(YW(b3,W)),x.uuidv7=(W)=>x.check(XW(b3,W)),x.nanoid=(W)=>x.check(bW(zO,W)),x.guid=(W)=>x.check(t9(Dv,W)),x.cuid=(W)=>x.check($W(vO,W)),x.cuid2=(W)=>x.check(zW(wO,W)),x.ulid=(W)=>x.check(vW(BO,W)),x.base64=(W)=>x.check(NW(UO,W)),x.base64url=(W)=>x.check(FW(cO,W)),x.xid=(W)=>x.check(wW(KO,W)),x.ksuid=(W)=>x.check(BW(HO,W)),x.ipv4=(W)=>x.check(KW(VO,W)),x.ipv6=(W)=>x.check(HW(qO,W)),x.cidrv4=(W)=>x.check(VW(NO,W)),x.cidrv6=(W)=>x.check(qW(FO,W)),x.e164=(W)=>x.check(UW(LO,W)),x.datetime=(W)=>x.check(mW(W)),x.date=(W)=>x.check(fW(W)),x.time=(W)=>x.check(gW(W)),x.duration=(W)=>x.check(yW(W))});function L(x){return eQ(JO,x)}var L0=D("ZodStringFormat",(x,Q)=>{N0.init(x,Q),Av.init(x,Q)}),GO=D("ZodEmail",(x,Q)=>{HQ.init(x,Q),L0.init(x,Q)});var Dv=D("ZodGUID",(x,Q)=>{BQ.init(x,Q),L0.init(x,Q)});var b3=D("ZodUUID",(x,Q)=>{KQ.init(x,Q),L0.init(x,Q)});var bO=D("ZodURL",(x,Q)=>{VQ.init(x,Q),L0.init(x,Q)});var $O=D("ZodEmoji",(x,Q)=>{qQ.init(x,Q),L0.init(x,Q)});var zO=D("ZodNanoID",(x,Q)=>{NQ.init(x,Q),L0.init(x,Q)});var vO=D("ZodCUID",(x,Q)=>{FQ.init(x,Q),L0.init(x,Q)});var wO=D("ZodCUID2",(x,Q)=>{UQ.init(x,Q),L0.init(x,Q)});var BO=D("ZodULID",(x,Q)=>{cQ.init(x,Q),L0.init(x,Q)});var KO=D("ZodXID",(x,Q)=>{LQ.init(x,Q),L0.init(x,Q)});var HO=D("ZodKSUID",(x,Q)=>{MQ.init(x,Q),L0.init(x,Q)});var VO=D("ZodIPv4",(x,Q)=>{DQ.init(x,Q),L0.init(x,Q)});var qO=D("ZodIPv6",(x,Q)=>{jQ.init(x,Q),L0.init(x,Q)});var NO=D("ZodCIDRv4",(x,Q)=>{OQ.init(x,Q),L0.init(x,Q)});var FO=D("ZodCIDRv6",(x,Q)=>{AQ.init(x,Q),L0.init(x,Q)});var UO=D("ZodBase64",(x,Q)=>{IQ.init(x,Q),L0.init(x,Q)});var cO=D("ZodBase64URL",(x,Q)=>{SQ.init(x,Q),L0.init(x,Q)});var LO=D("ZodE164",(x,Q)=>{EQ.init(x,Q),L0.init(x,Q)});var MO=D("ZodJWT",(x,Q)=>{RQ.init(x,Q),L0.init(x,Q)});var Iv=D("ZodNumber",(x,Q)=>{a9.init(x,Q),A0.init(x,Q),x.gt=(Y,X)=>x.check(x3(Y,X)),x.gte=(Y,X)=>x.check(c6(Y,X)),x.min=(Y,X)=>x.check(c6(Y,X)),x.lt=(Y,X)=>x.check(e9(Y,X)),x.lte=(Y,X)=>x.check(U6(Y,X)),x.max=(Y,X)=>x.check(U6(Y,X)),x.int=(Y)=>x.check(jv(Y)),x.safe=(Y)=>x.check(jv(Y)),x.positive=(Y)=>x.check(x3(0,Y)),x.nonnegative=(Y)=>x.check(c6(0,Y)),x.negative=(Y)=>x.check(e9(0,Y)),x.nonpositive=(Y)=>x.check(U6(0,Y)),x.multipleOf=(Y,X)=>x.check(Q3(Y,X)),x.step=(Y,X)=>x.check(Q3(Y,X)),x.finite=()=>x;let W=x._zod.bag;x.minValue=Math.max(W.minimum??Number.NEGATIVE_INFINITY,W.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,x.maxValue=Math.min(W.maximum??Number.POSITIVE_INFINITY,W.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,x.isInt=(W.format??"").includes("int")||Number.isSafeInteger(W.multipleOf??0.5),x.isFinite=!0,x.format=W.format??null});function z0(x){return LW(Iv,x)}var DO=D("ZodNumberFormat",(x,Q)=>{PQ.init(x,Q),Iv.init(x,Q)});function jv(x){return MW(DO,x)}var jO=D("ZodBoolean",(x,Q)=>{iQ.init(x,Q),A0.init(x,Q)});function f0(x){return DW(jO,x)}var OO=D("ZodNull",(x,Q)=>{ZQ.init(x,Q),A0.init(x,Q)});function Sv(x){return jW(OO,x)}var AO=D("ZodUnknown",(x,Q)=>{CQ.init(x,Q),A0.init(x,Q)});function M0(){return OW(AO)}var IO=D("ZodNever",(x,Q)=>{TQ.init(x,Q),A0.init(x,Q)});function SO(x){return AW(IO,x)}var EO=D("ZodArray",(x,Q)=>{kQ.init(x,Q),A0.init(x,Q),x.element=Q.element,x.min=(W,Y)=>x.check(G8(W,Y)),x.nonempty=(W)=>x.check(G8(1,W)),x.max=(W,Y)=>x.check(W3(W,Y)),x.length=(W,Y)=>x.check(Y3(W,Y)),x.unwrap=()=>x.element});function W0(x,Q){return vv(EO,x,Q)}var Ev=D("ZodObject",(x,Q)=>{d9.init(x,Q),A0.init(x,Q),Q0.defineLazy(x,"shape",()=>Q.shape),x.keyof=()=>H1(Object.keys(x._zod.def.shape)),x.catchall=(W)=>x.clone({...x._zod.def,catchall:W}),x.passthrough=()=>x.clone({...x._zod.def,catchall:M0()}),x.loose=()=>x.clone({...x._zod.def,catchall:M0()}),x.strict=()=>x.clone({...x._zod.def,catchall:SO()}),x.strip=()=>x.clone({...x._zod.def,catchall:void 0}),x.extend=(W)=>{return Q0.extend(x,W)},x.merge=(W)=>Q0.merge(x,W),x.pick=(W)=>Q0.pick(x,W),x.omit=(W)=>Q0.omit(x,W),x.partial=(...W)=>Q0.partial(iv,x,W[0]),x.required=(...W)=>Q0.required(Zv,x,W[0])});function C(x,Q){let W={type:"object",get shape(){return Q0.assignProp(this,"shape",{...x}),this.shape},...Q0.normalizeParams(Q)};return new Ev(W)}function J1(x,Q){return new Ev({type:"object",get shape(){return Q0.assignProp(this,"shape",{...x}),this.shape},catchall:M0(),...Q0.normalizeParams(Q)})}var Rv=D("ZodUnion",(x,Q)=>{r9.init(x,Q),A0.init(x,Q),x.options=Q.options});function U0(x,Q){return new Rv({type:"union",options:x,...Q0.normalizeParams(Q)})}var RO=D("ZodDiscriminatedUnion",(x,Q)=>{Rv.init(x,Q),_Q.init(x,Q)});function aW(x,Q,W){return new RO({type:"union",options:Q,discriminator:x,...Q0.normalizeParams(W)})}var PO=D("ZodIntersection",(x,Q)=>{uQ.init(x,Q),A0.init(x,Q)});function $3(x,Q){return new PO({type:"intersection",left:x,right:Q})}var iO=D("ZodRecord",(x,Q)=>{lQ.init(x,Q),A0.init(x,Q),x.keyType=Q.keyType,x.valueType=Q.valueType});function F0(x,Q,W){return new iO({type:"record",keyType:x,valueType:Q,...Q0.normalizeParams(W)})}var hW=D("ZodEnum",(x,Q)=>{pQ.init(x,Q),A0.init(x,Q),x.enum=Q.entries,x.options=Object.values(Q.entries);let W=new Set(Object.keys(Q.entries));x.extract=(Y,X)=>{let J={};for(let G of Y)if(W.has(G))J[G]=Q.entries[G];else throw Error(`Key ${G} not found in enum`);return new hW({...Q,checks:[],...Q0.normalizeParams(X),entries:J})},x.exclude=(Y,X)=>{let J={...Q.entries};for(let G of Y)if(W.has(G))delete J[G];else throw Error(`Key ${G} not found in enum`);return new hW({...Q,checks:[],...Q0.normalizeParams(X),entries:J})}});function H1(x,Q){let W=Array.isArray(x)?Object.fromEntries(x.map((Y)=>[Y,Y])):x;return new hW({type:"enum",entries:W,...Q0.normalizeParams(Q)})}var ZO=D("ZodLiteral",(x,Q)=>{nQ.init(x,Q),A0.init(x,Q),x.values=new Set(Q.values),Object.defineProperty(x,"value",{get(){if(Q.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return Q.values[0]}})});function _(x,Q){return new ZO({type:"literal",values:Array.isArray(x)?x:[x],...Q0.normalizeParams(Q)})}var CO=D("ZodTransform",(x,Q)=>{mQ.init(x,Q),A0.init(x,Q),x._zod.parse=(W,Y)=>{W.addIssue=(J)=>{if(typeof J==="string")W.issues.push(Q0.issue(J,W.value,Q));else{let G=J;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=W.value),G.inst??(G.inst=x),G.continue??(G.continue=!0),W.issues.push(Q0.issue(G))}};let X=Q.transform(W.value,W);if(X instanceof Promise)return X.then((J)=>{return W.value=J,W});return W.value=X,W}});function Pv(x){return new CO({type:"transform",transform:x})}var iv=D("ZodOptional",(x,Q)=>{fQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType});function D0(x){return new iv({type:"optional",innerType:x})}var TO=D("ZodNullable",(x,Q)=>{gQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType});function Ov(x){return new TO({type:"nullable",innerType:x})}var kO=D("ZodDefault",(x,Q)=>{yQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType,x.removeDefault=x.unwrap});function _O(x,Q){return new kO({type:"default",innerType:x,get defaultValue(){return typeof Q==="function"?Q():Q}})}var uO=D("ZodPrefault",(x,Q)=>{hQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType});function lO(x,Q){return new uO({type:"prefault",innerType:x,get defaultValue(){return typeof Q==="function"?Q():Q}})}var Zv=D("ZodNonOptional",(x,Q)=>{oQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType});function pO(x,Q){return new Zv({type:"nonoptional",innerType:x,...Q0.normalizeParams(Q)})}var nO=D("ZodCatch",(x,Q)=>{aQ.init(x,Q),A0.init(x,Q),x.unwrap=()=>x._zod.def.innerType,x.removeCatch=x.unwrap});function mO(x,Q){return new nO({type:"catch",innerType:x,catchValue:typeof Q==="function"?Q:()=>Q})}var fO=D("ZodPipe",(x,Q)=>{dQ.init(x,Q),A0.init(x,Q),x.in=Q.in,x.out=Q.out});function oW(x,Q){return new fO({type:"pipe",in:x,out:Q})}var gO=D("ZodReadonly",(x,Q)=>{rQ.init(x,Q),A0.init(x,Q)});function yO(x){return new gO({type:"readonly",innerType:x})}var Cv=D("ZodCustom",(x,Q)=>{sQ.init(x,Q),A0.init(x,Q)});function hO(x){let Q=new a0({check:"custom"});return Q._zod.check=x,Q}function Tv(x,Q){return _W(Cv,x??(()=>!0),Q)}function oO(x,Q={}){return uW(Cv,x,Q)}function aO(x){let Q=hO((W)=>{return W.addIssue=(Y)=>{if(typeof Y==="string")W.issues.push(Q0.issue(Y,W.value,Q._zod.def));else{let X=Y;if(X.fatal)X.continue=!1;X.code??(X.code="custom"),X.input??(X.input=W.value),X.inst??(X.inst=Q),X.continue??(X.continue=!Q._zod.def.abort),W.issues.push(Q0.issue(X))}},x(W.value,W)});return Q}function dW(x,Q){return oW(Pv(x),Q)}D1(tQ());var rW="2025-11-25";var kv=[rW,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],T4="io.modelcontextprotocol/related-task",v3="2.0",_0=Tv((x)=>x!==null&&(typeof x==="object"||typeof x==="function")),_v=U0([L(),z0().int()]),uv=L(),Rm=J1({ttl:z0().optional(),pollInterval:z0().optional()}),dO=C({ttl:z0().optional()}),rO=C({taskId:L()}),sW=J1({progressToken:_v.optional(),[T4]:rO.optional()}),O1=C({_meta:sW.optional()}),D6=O1.extend({task:dO.optional()}),lv=(x)=>D6.safeParse(x).success,d0=C({method:L(),params:O1.loose().optional()}),i1=C({_meta:sW.optional()}),Z1=C({method:L(),params:i1.loose().optional()}),r0=J1({_meta:sW.optional()}),w3=U0([L(),z0().int()]),pv=C({jsonrpc:_(v3),id:w3,...d0.shape}).strict(),tW=(x)=>pv.safeParse(x).success,nv=C({jsonrpc:_(v3),...Z1.shape}).strict(),mv=(x)=>nv.safeParse(x).success,eW=C({jsonrpc:_(v3),id:w3,result:r0}).strict(),j6=(x)=>eW.safeParse(x).success;var l;(function(x){x[x.ConnectionClosed=-32000]="ConnectionClosed",x[x.RequestTimeout=-32001]="RequestTimeout",x[x.ParseError=-32700]="ParseError",x[x.InvalidRequest=-32600]="InvalidRequest",x[x.MethodNotFound=-32601]="MethodNotFound",x[x.InvalidParams=-32602]="InvalidParams",x[x.InternalError=-32603]="InternalError",x[x.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(l||(l={}));var xY=C({jsonrpc:_(v3),id:w3.optional(),error:C({code:z0().int(),message:L(),data:M0().optional()})}).strict();var fv=(x)=>xY.safeParse(x).success;var gv=U0([pv,nv,eW,xY]),Pm=U0([eW,xY]),B3=r0.strict(),sO=i1.extend({requestId:w3.optional(),reason:L().optional()}),K3=Z1.extend({method:_("notifications/cancelled"),params:sO}),tO=C({src:L(),mimeType:L().optional(),sizes:W0(L()).optional(),theme:H1(["light","dark"]).optional()}),O6=C({icons:W0(tO).optional()}),$8=C({name:L(),title:L().optional()}),yv=$8.extend({...$8.shape,...O6.shape,version:L(),websiteUrl:L().optional(),description:L().optional()}),eO=$3(C({applyDefaults:f0().optional()}),F0(L(),M0())),xA=dW((x)=>{if(x&&typeof x==="object"&&!Array.isArray(x)){if(Object.keys(x).length===0)return{form:{}}}return x},$3(C({form:eO.optional(),url:_0.optional()}),F0(L(),M0()).optional())),QA=J1({list:_0.optional(),cancel:_0.optional(),requests:J1({sampling:J1({createMessage:_0.optional()}).optional(),elicitation:J1({create:_0.optional()}).optional()}).optional()}),WA=J1({list:_0.optional(),cancel:_0.optional(),requests:J1({tools:J1({call:_0.optional()}).optional()}).optional()}),YA=C({experimental:F0(L(),_0).optional(),sampling:C({context:_0.optional(),tools:_0.optional()}).optional(),elicitation:xA.optional(),roots:C({listChanged:f0().optional()}).optional(),tasks:QA.optional(),extensions:F0(L(),_0).optional()}),XA=O1.extend({protocolVersion:L(),capabilities:YA,clientInfo:yv}),QY=d0.extend({method:_("initialize"),params:XA});var JA=C({experimental:F0(L(),_0).optional(),logging:_0.optional(),completions:_0.optional(),prompts:C({listChanged:f0().optional()}).optional(),resources:C({subscribe:f0().optional(),listChanged:f0().optional()}).optional(),tools:C({listChanged:f0().optional()}).optional(),tasks:WA.optional(),extensions:F0(L(),_0).optional()}),GA=r0.extend({protocolVersion:L(),capabilities:JA,serverInfo:yv,instructions:L().optional()}),WY=Z1.extend({method:_("notifications/initialized"),params:i1.optional()});var H3=d0.extend({method:_("ping"),params:O1.optional()}),bA=C({progress:z0(),total:D0(z0()),message:D0(L())}),$A=C({...i1.shape,...bA.shape,progressToken:_v}),V3=Z1.extend({method:_("notifications/progress"),params:$A}),zA=O1.extend({cursor:uv.optional()}),A6=d0.extend({params:zA.optional()}),I6=r0.extend({nextCursor:uv.optional()}),vA=H1(["working","input_required","completed","failed","cancelled"]),S6=C({taskId:L(),status:vA,ttl:U0([z0(),Sv()]),createdAt:L(),lastUpdatedAt:L(),pollInterval:D0(z0()),statusMessage:D0(L())}),z8=r0.extend({task:S6}),wA=i1.merge(S6),E6=Z1.extend({method:_("notifications/tasks/status"),params:wA}),q3=d0.extend({method:_("tasks/get"),params:O1.extend({taskId:L()})}),N3=r0.merge(S6),F3=d0.extend({method:_("tasks/result"),params:O1.extend({taskId:L()})}),im=r0.loose(),U3=A6.extend({method:_("tasks/list")}),c3=I6.extend({tasks:W0(S6)}),L3=d0.extend({method:_("tasks/cancel"),params:O1.extend({taskId:L()})}),hv=r0.merge(S6),ov=C({uri:L(),mimeType:D0(L()),_meta:F0(L(),M0()).optional()}),av=ov.extend({text:L()}),YY=L().refine((x)=>{try{return atob(x),!0}catch{return!1}},{message:"Invalid Base64 string"}),dv=ov.extend({blob:YY}),R6=H1(["user","assistant"]),v8=C({audience:W0(R6).optional(),priority:z0().min(0).max(1).optional(),lastModified:L6.datetime({offset:!0}).optional()}),rv=C({...$8.shape,...O6.shape,uri:L(),description:D0(L()),mimeType:D0(L()),size:D0(z0()),annotations:v8.optional(),_meta:D0(J1({}))}),BA=C({...$8.shape,...O6.shape,uriTemplate:L(),description:D0(L()),mimeType:D0(L()),annotations:v8.optional(),_meta:D0(J1({}))}),M3=A6.extend({method:_("resources/list")}),KA=I6.extend({resources:W0(rv)}),D3=A6.extend({method:_("resources/templates/list")}),HA=I6.extend({resourceTemplates:W0(BA)}),XY=O1.extend({uri:L()}),VA=XY,j3=d0.extend({method:_("resources/read"),params:VA}),qA=r0.extend({contents:W0(U0([av,dv]))}),NA=Z1.extend({method:_("notifications/resources/list_changed"),params:i1.optional()}),FA=XY,UA=d0.extend({method:_("resources/subscribe"),params:FA}),cA=XY,LA=d0.extend({method:_("resources/unsubscribe"),params:cA}),MA=i1.extend({uri:L()}),DA=Z1.extend({method:_("notifications/resources/updated"),params:MA}),jA=C({name:L(),description:D0(L()),required:D0(f0())}),OA=C({...$8.shape,...O6.shape,description:D0(L()),arguments:D0(W0(jA)),_meta:D0(J1({}))}),O3=A6.extend({method:_("prompts/list")}),AA=I6.extend({prompts:W0(OA)}),IA=O1.extend({name:L(),arguments:F0(L(),L()).optional()}),A3=d0.extend({method:_("prompts/get"),params:IA}),JY=C({type:_("text"),text:L(),annotations:v8.optional(),_meta:F0(L(),M0()).optional()}),GY=C({type:_("image"),data:YY,mimeType:L(),annotations:v8.optional(),_meta:F0(L(),M0()).optional()}),bY=C({type:_("audio"),data:YY,mimeType:L(),annotations:v8.optional(),_meta:F0(L(),M0()).optional()}),SA=C({type:_("tool_use"),name:L(),id:L(),input:F0(L(),M0()),_meta:F0(L(),M0()).optional()}),EA=C({type:_("resource"),resource:U0([av,dv]),annotations:v8.optional(),_meta:F0(L(),M0()).optional()}),RA=rv.extend({type:_("resource_link")}),$Y=U0([JY,GY,bY,RA,EA]),PA=C({role:R6,content:$Y}),iA=r0.extend({description:L().optional(),messages:W0(PA)}),ZA=Z1.extend({method:_("notifications/prompts/list_changed"),params:i1.optional()}),CA=C({title:L().optional(),readOnlyHint:f0().optional(),destructiveHint:f0().optional(),idempotentHint:f0().optional(),openWorldHint:f0().optional()}),TA=C({taskSupport:H1(["required","optional","forbidden"]).optional()}),sv=C({...$8.shape,...O6.shape,description:L().optional(),inputSchema:C({type:_("object"),properties:F0(L(),_0).optional(),required:W0(L()).optional()}).catchall(M0()),outputSchema:C({type:_("object"),properties:F0(L(),_0).optional(),required:W0(L()).optional()}).catchall(M0()).optional(),annotations:CA.optional(),execution:TA.optional(),_meta:F0(L(),M0()).optional()}),I3=A6.extend({method:_("tools/list")}),kA=I6.extend({tools:W0(sv)}),S3=r0.extend({content:W0($Y).default([]),structuredContent:F0(L(),M0()).optional(),isError:f0().optional()}),Zm=S3.or(r0.extend({toolResult:M0()})),_A=D6.extend({name:L(),arguments:F0(L(),M0()).optional()}),w8=d0.extend({method:_("tools/call"),params:_A}),uA=Z1.extend({method:_("notifications/tools/list_changed"),params:i1.optional()}),Cm=C({autoRefresh:f0().default(!0),debounceMs:z0().int().nonnegative().default(300)}),P6=H1(["debug","info","notice","warning","error","critical","alert","emergency"]),lA=O1.extend({level:P6}),zY=d0.extend({method:_("logging/setLevel"),params:lA}),pA=i1.extend({level:P6,logger:L().optional(),data:M0()}),nA=Z1.extend({method:_("notifications/message"),params:pA}),mA=C({name:L().optional()}),fA=C({hints:W0(mA).optional(),costPriority:z0().min(0).max(1).optional(),speedPriority:z0().min(0).max(1).optional(),intelligencePriority:z0().min(0).max(1).optional()}),gA=C({mode:H1(["auto","required","none"]).optional()}),yA=C({type:_("tool_result"),toolUseId:L().describe("The unique identifier for the corresponding tool call."),content:W0($Y).default([]),structuredContent:C({}).loose().optional(),isError:f0().optional(),_meta:F0(L(),M0()).optional()}),hA=aW("type",[JY,GY,bY]),z3=aW("type",[JY,GY,bY,SA,yA]),oA=C({role:R6,content:U0([z3,W0(z3)]),_meta:F0(L(),M0()).optional()}),aA=D6.extend({messages:W0(oA),modelPreferences:fA.optional(),systemPrompt:L().optional(),includeContext:H1(["none","thisServer","allServers"]).optional(),temperature:z0().optional(),maxTokens:z0().int(),stopSequences:W0(L()).optional(),metadata:_0.optional(),tools:W0(sv).optional(),toolChoice:gA.optional()}),dA=d0.extend({method:_("sampling/createMessage"),params:aA}),i6=r0.extend({model:L(),stopReason:D0(H1(["endTurn","stopSequence","maxTokens"]).or(L())),role:R6,content:hA}),vY=r0.extend({model:L(),stopReason:D0(H1(["endTurn","stopSequence","maxTokens","toolUse"]).or(L())),role:R6,content:U0([z3,W0(z3)])}),rA=C({type:_("boolean"),title:L().optional(),description:L().optional(),default:f0().optional()}),sA=C({type:_("string"),title:L().optional(),description:L().optional(),minLength:z0().optional(),maxLength:z0().optional(),format:H1(["email","uri","date","date-time"]).optional(),default:L().optional()}),tA=C({type:H1(["number","integer"]),title:L().optional(),description:L().optional(),minimum:z0().optional(),maximum:z0().optional(),default:z0().optional()}),eA=C({type:_("string"),title:L().optional(),description:L().optional(),enum:W0(L()),default:L().optional()}),x2=C({type:_("string"),title:L().optional(),description:L().optional(),oneOf:W0(C({const:L(),title:L()})),default:L().optional()}),Q2=C({type:_("string"),title:L().optional(),description:L().optional(),enum:W0(L()),enumNames:W0(L()).optional(),default:L().optional()}),W2=U0([eA,x2]),Y2=C({type:_("array"),title:L().optional(),description:L().optional(),minItems:z0().optional(),maxItems:z0().optional(),items:C({type:_("string"),enum:W0(L())}),default:W0(L()).optional()}),X2=C({type:_("array"),title:L().optional(),description:L().optional(),minItems:z0().optional(),maxItems:z0().optional(),items:C({anyOf:W0(C({const:L(),title:L()}))}),default:W0(L()).optional()}),J2=U0([Y2,X2]),G2=U0([Q2,W2,J2]),b2=U0([G2,rA,sA,tA]),$2=D6.extend({mode:_("form").optional(),message:L(),requestedSchema:C({type:_("object"),properties:F0(L(),b2),required:W0(L()).optional()})}),z2=D6.extend({mode:_("url"),message:L(),elicitationId:L(),url:L().url()}),v2=U0([$2,z2]),w2=d0.extend({method:_("elicitation/create"),params:v2}),B2=i1.extend({elicitationId:L()}),K2=Z1.extend({method:_("notifications/elicitation/complete"),params:B2}),B8=r0.extend({action:H1(["accept","decline","cancel"]),content:dW((x)=>x===null?void 0:x,F0(L(),U0([L(),z0(),f0(),W0(L())])).optional())}),H2=C({type:_("ref/resource"),uri:L()});var V2=C({type:_("ref/prompt"),name:L()}),q2=O1.extend({ref:U0([V2,H2]),argument:C({name:L(),value:L()}),context:C({arguments:F0(L(),L()).optional()}).optional()}),E3=d0.extend({method:_("completion/complete"),params:q2});function tv(x){if(x.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${x.params.ref.type}`)}function ev(x){if(x.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${x.params.ref.type}`)}var N2=r0.extend({completion:J1({values:W0(L()).max(100),total:D0(z0().int()),hasMore:D0(f0())})}),F2=C({uri:L().startsWith("file://"),name:L().optional(),_meta:F0(L(),M0()).optional()}),U2=d0.extend({method:_("roots/list"),params:O1.optional()}),wY=r0.extend({roots:W0(F2)}),c2=Z1.extend({method:_("notifications/roots/list_changed"),params:i1.optional()}),Tm=U0([H3,QY,E3,zY,A3,O3,M3,D3,j3,UA,LA,w8,I3,q3,F3,U3,L3]),km=U0([K3,V3,WY,c2,E6]),_m=U0([B3,i6,vY,B8,wY,N3,c3,z8]),um=U0([H3,dA,w2,U2,q3,F3,U3,L3]),lm=U0([K3,V3,nA,DA,NA,uA,ZA,E6,K2]),pm=U0([B3,GA,N2,iA,AA,KA,HA,qA,S3,kA,N3,c3,z8]);class k extends Error{constructor(x,Q,W){super(`MCP error ${x}: ${Q}`);this.code=x,this.data=W,this.name="McpError"}static fromError(x,Q,W){if(x===l.UrlElicitationRequired&&W){let Y=W;if(Y.elicitations)return new xw(Y.elicitations,Q)}return new k(x,Q,W)}}class xw extends k{constructor(x,Q=`URL elicitation${x.length>1?"s":""} required`){super(l.UrlElicitationRequired,Q,{elicitations:x})}get elicitations(){return this.data?.elicitations??[]}}function k4(x){return x==="completed"||x==="failed"||x==="cancelled"}var Ww=Symbol("Let zodToJsonSchema decide on which parser to use");var Qw={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",openAiAnyTypeName:"OpenAiAnyType"},Yw=(x)=>typeof x==="string"?{...Qw,name:x}:{...Qw,...x};var Xw=(x)=>{let Q=Yw(x),W=Q.name!==void 0?[...Q.basePath,Q.definitionPath,Q.name]:Q.basePath;return{...Q,flags:{hasReferencedOpenAiAnyType:!1},currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(Q.definitions).map(([Y,X])=>[X._def,{def:X._def,path:[...Q.basePath,Q.definitionPath,Y],jsonSchema:void 0}]))}};function BY(x,Q,W,Y){if(!Y?.errorMessages)return;if(W)x.errorMessage={...x.errorMessage,[Q]:W}}function Y0(x,Q,W,Y,X){x[Q]=W,BY(x,Q,Y,X)}var R3=(x,Q)=>{let W=0;for(;W<x.length&&W<Q.length;W++)if(x[W]!==Q[W])break;return[(x.length-W).toString(),...Q.slice(W)].join("/")};function j0(x){if(x.target!=="openAi")return{};let Q=[...x.basePath,x.definitionPath,x.openAiAnyTypeName];return x.flags.hasReferencedOpenAiAnyType=!0,{$ref:x.$refStrategy==="relative"?R3(Q,x.currentPath):Q.join("/")}}function Jw(x,Q){let W={type:"array"};if(x.type?._def&&x.type?._def?.typeName!==I.ZodAny)W.items=m(x.type._def,{...Q,currentPath:[...Q.currentPath,"items"]});if(x.minLength)Y0(W,"minItems",x.minLength.value,x.minLength.message,Q);if(x.maxLength)Y0(W,"maxItems",x.maxLength.value,x.maxLength.message,Q);if(x.exactLength)Y0(W,"minItems",x.exactLength.value,x.exactLength.message,Q),Y0(W,"maxItems",x.exactLength.value,x.exactLength.message,Q);return W}function Gw(x,Q){let W={type:"integer",format:"int64"};if(!x.checks)return W;for(let Y of x.checks)switch(Y.kind){case"min":if(Q.target==="jsonSchema7")if(Y.inclusive)Y0(W,"minimum",Y.value,Y.message,Q);else Y0(W,"exclusiveMinimum",Y.value,Y.message,Q);else{if(!Y.inclusive)W.exclusiveMinimum=!0;Y0(W,"minimum",Y.value,Y.message,Q)}break;case"max":if(Q.target==="jsonSchema7")if(Y.inclusive)Y0(W,"maximum",Y.value,Y.message,Q);else Y0(W,"exclusiveMaximum",Y.value,Y.message,Q);else{if(!Y.inclusive)W.exclusiveMaximum=!0;Y0(W,"maximum",Y.value,Y.message,Q)}break;case"multipleOf":Y0(W,"multipleOf",Y.value,Y.message,Q);break}return W}function bw(){return{type:"boolean"}}function P3(x,Q){return m(x.type._def,Q)}var $w=(x,Q)=>{return m(x.innerType._def,Q)};function KY(x,Q,W){let Y=W??Q.dateStrategy;if(Array.isArray(Y))return{anyOf:Y.map((X,J)=>KY(x,Q,X))};switch(Y){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return L2(x,Q)}}var L2=(x,Q)=>{let W={type:"integer",format:"unix-time"};if(Q.target==="openApi3")return W;for(let Y of x.checks)switch(Y.kind){case"min":Y0(W,"minimum",Y.value,Y.message,Q);break;case"max":Y0(W,"maximum",Y.value,Y.message,Q);break}return W};function zw(x,Q){return{...m(x.innerType._def,Q),default:x.defaultValue()}}function vw(x,Q){return Q.effectStrategy==="input"?m(x.schema._def,Q):j0(Q)}function ww(x){return{type:"string",enum:Array.from(x.values)}}var M2=(x)=>{if("type"in x&&x.type==="string")return!1;return"allOf"in x};function Bw(x,Q){let W=[m(x.left._def,{...Q,currentPath:[...Q.currentPath,"allOf","0"]}),m(x.right._def,{...Q,currentPath:[...Q.currentPath,"allOf","1"]})].filter((J)=>!!J),Y=Q.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,X=[];return W.forEach((J)=>{if(M2(J)){if(X.push(...J.allOf),J.unevaluatedProperties===void 0)Y=void 0}else{let G=J;if("additionalProperties"in J&&J.additionalProperties===!1){let{additionalProperties:b,...$}=J;G=$}else Y=void 0;X.push(G)}}),X.length?{allOf:X,...Y}:void 0}function Kw(x,Q){let W=typeof x.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray(x.value)?"array":"object"};if(Q.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[x.value]};return{type:W==="bigint"?"integer":W,const:x.value}}var HY=void 0,h1={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(HY===void 0)HY=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return HY},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 i3(x,Q){let W={type:"string"};if(x.checks)for(let Y of x.checks)switch(Y.kind){case"min":Y0(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Y.value):Y.value,Y.message,Q);break;case"max":Y0(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Y.value):Y.value,Y.message,Q);break;case"email":switch(Q.emailStrategy){case"format:email":o1(W,"email",Y.message,Q);break;case"format:idn-email":o1(W,"idn-email",Y.message,Q);break;case"pattern:zod":G1(W,h1.email,Y.message,Q);break}break;case"url":o1(W,"uri",Y.message,Q);break;case"uuid":o1(W,"uuid",Y.message,Q);break;case"regex":G1(W,Y.regex,Y.message,Q);break;case"cuid":G1(W,h1.cuid,Y.message,Q);break;case"cuid2":G1(W,h1.cuid2,Y.message,Q);break;case"startsWith":G1(W,RegExp(`^${VY(Y.value,Q)}`),Y.message,Q);break;case"endsWith":G1(W,RegExp(`${VY(Y.value,Q)}$`),Y.message,Q);break;case"datetime":o1(W,"date-time",Y.message,Q);break;case"date":o1(W,"date",Y.message,Q);break;case"time":o1(W,"time",Y.message,Q);break;case"duration":o1(W,"duration",Y.message,Q);break;case"length":Y0(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,Y.value):Y.value,Y.message,Q),Y0(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,Y.value):Y.value,Y.message,Q);break;case"includes":{G1(W,RegExp(VY(Y.value,Q)),Y.message,Q);break}case"ip":{if(Y.version!=="v6")o1(W,"ipv4",Y.message,Q);if(Y.version!=="v4")o1(W,"ipv6",Y.message,Q);break}case"base64url":G1(W,h1.base64url,Y.message,Q);break;case"jwt":G1(W,h1.jwt,Y.message,Q);break;case"cidr":{if(Y.version!=="v6")G1(W,h1.ipv4Cidr,Y.message,Q);if(Y.version!=="v4")G1(W,h1.ipv6Cidr,Y.message,Q);break}case"emoji":G1(W,h1.emoji(),Y.message,Q);break;case"ulid":{G1(W,h1.ulid,Y.message,Q);break}case"base64":{switch(Q.base64Strategy){case"format:binary":{o1(W,"binary",Y.message,Q);break}case"contentEncoding:base64":{Y0(W,"contentEncoding","base64",Y.message,Q);break}case"pattern:zod":{G1(W,h1.base64,Y.message,Q);break}}break}case"nanoid":G1(W,h1.nanoid,Y.message,Q);case"toLowerCase":case"toUpperCase":case"trim":break;default:((X)=>{})(Y)}return W}function VY(x,Q){return Q.patternStrategy==="escape"?j2(x):x}var D2=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function j2(x){let Q="";for(let W=0;W<x.length;W++){if(!D2.has(x[W]))Q+="\\";Q+=x[W]}return Q}function o1(x,Q,W,Y){if(x.format||x.anyOf?.some((X)=>X.format)){if(!x.anyOf)x.anyOf=[];if(x.format){if(x.anyOf.push({format:x.format,...x.errorMessage&&Y.errorMessages&&{errorMessage:{format:x.errorMessage.format}}}),delete x.format,x.errorMessage){if(delete x.errorMessage.format,Object.keys(x.errorMessage).length===0)delete x.errorMessage}}x.anyOf.push({format:Q,...W&&Y.errorMessages&&{errorMessage:{format:W}}})}else Y0(x,"format",Q,W,Y)}function G1(x,Q,W,Y){if(x.pattern||x.allOf?.some((X)=>X.pattern)){if(!x.allOf)x.allOf=[];if(x.pattern){if(x.allOf.push({pattern:x.pattern,...x.errorMessage&&Y.errorMessages&&{errorMessage:{pattern:x.errorMessage.pattern}}}),delete x.pattern,x.errorMessage){if(delete x.errorMessage.pattern,Object.keys(x.errorMessage).length===0)delete x.errorMessage}}x.allOf.push({pattern:Hw(Q,Y),...W&&Y.errorMessages&&{errorMessage:{pattern:W}}})}else Y0(x,"pattern",Hw(Q,Y),W,Y)}function Hw(x,Q){if(!Q.applyRegexFlags||!x.flags)return x.source;let W={i:x.flags.includes("i"),m:x.flags.includes("m"),s:x.flags.includes("s")},Y=W.i?x.source.toLowerCase():x.source,X="",J=!1,G=!1,b=!1;for(let $=0;$<Y.length;$++){if(J){X+=Y[$],J=!1;continue}if(W.i){if(G){if(Y[$].match(/[a-z]/)){if(b)X+=Y[$],X+=`${Y[$-2]}-${Y[$]}`.toUpperCase(),b=!1;else if(Y[$+1]==="-"&&Y[$+2]?.match(/[a-z]/))X+=Y[$],b=!0;else X+=`${Y[$]}${Y[$].toUpperCase()}`;continue}}else if(Y[$].match(/[a-z]/)){X+=`[${Y[$]}${Y[$].toUpperCase()}]`;continue}}if(W.m){if(Y[$]==="^"){X+=`(^|(?<=[\r
|
|
63
63
|
]))`;continue}else if(Y[$]==="$"){X+=`($|(?=[\r
|
|
64
64
|
]))`;continue}}if(W.s&&Y[$]==="."){X+=G?`${Y[$]}\r
|
|
65
65
|
`:`[${Y[$]}\r
|
|
66
66
|
]`;continue}if(X+=Y[$],Y[$]==="\\")J=!0;else if(G&&Y[$]==="]")G=!1;else if(!G&&Y[$]==="[")G=!0}try{new RegExp(X)}catch{return console.warn(`Could not convert regex pattern at ${Q.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),x.source}return X}function Z3(x,Q){if(Q.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(Q.target==="openApi3"&&x.keyType?._def.typeName===I.ZodEnum)return{type:"object",required:x.keyType._def.values,properties:x.keyType._def.values.reduce((Y,X)=>({...Y,[X]:m(x.valueType._def,{...Q,currentPath:[...Q.currentPath,"properties",X]})??j0(Q)}),{}),additionalProperties:Q.rejectedAdditionalProperties};let W={type:"object",additionalProperties:m(x.valueType._def,{...Q,currentPath:[...Q.currentPath,"additionalProperties"]})??Q.allowedAdditionalProperties};if(Q.target==="openApi3")return W;if(x.keyType?._def.typeName===I.ZodString&&x.keyType._def.checks?.length){let{type:Y,...X}=i3(x.keyType._def,Q);return{...W,propertyNames:X}}else if(x.keyType?._def.typeName===I.ZodEnum)return{...W,propertyNames:{enum:x.keyType._def.values}};else if(x.keyType?._def.typeName===I.ZodBranded&&x.keyType._def.type._def.typeName===I.ZodString&&x.keyType._def.type._def.checks?.length){let{type:Y,...X}=P3(x.keyType._def,Q);return{...W,propertyNames:X}}return W}function Vw(x,Q){if(Q.mapStrategy==="record")return Z3(x,Q);let W=m(x.keyType._def,{...Q,currentPath:[...Q.currentPath,"items","items","0"]})||j0(Q),Y=m(x.valueType._def,{...Q,currentPath:[...Q.currentPath,"items","items","1"]})||j0(Q);return{type:"array",maxItems:125,items:{type:"array",items:[W,Y],minItems:2,maxItems:2}}}function qw(x){let Q=x.values,Y=Object.keys(x.values).filter((J)=>{return typeof Q[Q[J]]!=="number"}).map((J)=>Q[J]),X=Array.from(new Set(Y.map((J)=>typeof J)));return{type:X.length===1?X[0]==="string"?"string":"number":["string","number"],enum:Y}}function Nw(x){return x.target==="openAi"?void 0:{not:j0({...x,currentPath:[...x.currentPath,"not"]})}}function Fw(x){return x.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var Z6={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function cw(x,Q){if(Q.target==="openApi3")return Uw(x,Q);let W=x.options instanceof Map?Array.from(x.options.values()):x.options;if(W.every((Y)=>(Y._def.typeName in Z6)&&(!Y._def.checks||!Y._def.checks.length))){let Y=W.reduce((X,J)=>{let G=Z6[J._def.typeName];return G&&!X.includes(G)?[...X,G]:X},[]);return{type:Y.length>1?Y:Y[0]}}else if(W.every((Y)=>Y._def.typeName==="ZodLiteral"&&!Y.description)){let Y=W.reduce((X,J)=>{let G=typeof J._def.value;switch(G){case"string":case"number":case"boolean":return[...X,G];case"bigint":return[...X,"integer"];case"object":if(J._def.value===null)return[...X,"null"];case"symbol":case"undefined":case"function":default:return X}},[]);if(Y.length===W.length){let X=Y.filter((J,G,b)=>b.indexOf(J)===G);return{type:X.length>1?X:X[0],enum:W.reduce((J,G)=>{return J.includes(G._def.value)?J:[...J,G._def.value]},[])}}}else if(W.every((Y)=>Y._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((Y,X)=>[...Y,...X._def.values.filter((J)=>!Y.includes(J))],[])};return Uw(x,Q)}var Uw=(x,Q)=>{let W=(x.options instanceof Map?Array.from(x.options.values()):x.options).map((Y,X)=>m(Y._def,{...Q,currentPath:[...Q.currentPath,"anyOf",`${X}`]})).filter((Y)=>!!Y&&(!Q.strictUnions||typeof Y==="object"&&Object.keys(Y).length>0));return W.length?{anyOf:W}:void 0};function Lw(x,Q){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(x.innerType._def.typeName)&&(!x.innerType._def.checks||!x.innerType._def.checks.length)){if(Q.target==="openApi3")return{type:Z6[x.innerType._def.typeName],nullable:!0};return{type:[Z6[x.innerType._def.typeName],"null"]}}if(Q.target==="openApi3"){let Y=m(x.innerType._def,{...Q,currentPath:[...Q.currentPath]});if(Y&&"$ref"in Y)return{allOf:[Y],nullable:!0};return Y&&{...Y,nullable:!0}}let W=m(x.innerType._def,{...Q,currentPath:[...Q.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function Mw(x,Q){let W={type:"number"};if(!x.checks)return W;for(let Y of x.checks)switch(Y.kind){case"int":W.type="integer",BY(W,"type",Y.message,Q);break;case"min":if(Q.target==="jsonSchema7")if(Y.inclusive)Y0(W,"minimum",Y.value,Y.message,Q);else Y0(W,"exclusiveMinimum",Y.value,Y.message,Q);else{if(!Y.inclusive)W.exclusiveMinimum=!0;Y0(W,"minimum",Y.value,Y.message,Q)}break;case"max":if(Q.target==="jsonSchema7")if(Y.inclusive)Y0(W,"maximum",Y.value,Y.message,Q);else Y0(W,"exclusiveMaximum",Y.value,Y.message,Q);else{if(!Y.inclusive)W.exclusiveMaximum=!0;Y0(W,"maximum",Y.value,Y.message,Q)}break;case"multipleOf":Y0(W,"multipleOf",Y.value,Y.message,Q);break}return W}function Dw(x,Q){let W=Q.target==="openAi",Y={type:"object",properties:{}},X=[],J=x.shape();for(let b in J){let $=J[b];if($===void 0||$._def===void 0)continue;let z=A2($);if(z&&W){if($._def.typeName==="ZodOptional")$=$._def.innerType;if(!$.isNullable())$=$.nullable();z=!1}let v=m($._def,{...Q,currentPath:[...Q.currentPath,"properties",b],propertyPath:[...Q.currentPath,"properties",b]});if(v===void 0)continue;if(Y.properties[b]=v,!z)X.push(b)}if(X.length)Y.required=X;let G=O2(x,Q);if(G!==void 0)Y.additionalProperties=G;return Y}function O2(x,Q){if(x.catchall._def.typeName!=="ZodNever")return m(x.catchall._def,{...Q,currentPath:[...Q.currentPath,"additionalProperties"]});switch(x.unknownKeys){case"passthrough":return Q.allowedAdditionalProperties;case"strict":return Q.rejectedAdditionalProperties;case"strip":return Q.removeAdditionalStrategy==="strict"?Q.allowedAdditionalProperties:Q.rejectedAdditionalProperties}}function A2(x){try{return x.isOptional()}catch{return!0}}var jw=(x,Q)=>{if(Q.currentPath.toString()===Q.propertyPath?.toString())return m(x.innerType._def,Q);let W=m(x.innerType._def,{...Q,currentPath:[...Q.currentPath,"anyOf","1"]});return W?{anyOf:[{not:j0(Q)},W]}:j0(Q)};var Ow=(x,Q)=>{if(Q.pipeStrategy==="input")return m(x.in._def,Q);else if(Q.pipeStrategy==="output")return m(x.out._def,Q);let W=m(x.in._def,{...Q,currentPath:[...Q.currentPath,"allOf","0"]}),Y=m(x.out._def,{...Q,currentPath:[...Q.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,Y].filter((X)=>X!==void 0)}};function Aw(x,Q){return m(x.type._def,Q)}function Iw(x,Q){let Y={type:"array",uniqueItems:!0,items:m(x.valueType._def,{...Q,currentPath:[...Q.currentPath,"items"]})};if(x.minSize)Y0(Y,"minItems",x.minSize.value,x.minSize.message,Q);if(x.maxSize)Y0(Y,"maxItems",x.maxSize.value,x.maxSize.message,Q);return Y}function Sw(x,Q){if(x.rest)return{type:"array",minItems:x.items.length,items:x.items.map((W,Y)=>m(W._def,{...Q,currentPath:[...Q.currentPath,"items",`${Y}`]})).reduce((W,Y)=>Y===void 0?W:[...W,Y],[]),additionalItems:m(x.rest._def,{...Q,currentPath:[...Q.currentPath,"additionalItems"]})};else return{type:"array",minItems:x.items.length,maxItems:x.items.length,items:x.items.map((W,Y)=>m(W._def,{...Q,currentPath:[...Q.currentPath,"items",`${Y}`]})).reduce((W,Y)=>Y===void 0?W:[...W,Y],[])}}function Ew(x){return{not:j0(x)}}function Rw(x){return j0(x)}var Pw=(x,Q)=>{return m(x.innerType._def,Q)};var iw=(x,Q,W)=>{switch(Q){case I.ZodString:return i3(x,W);case I.ZodNumber:return Mw(x,W);case I.ZodObject:return Dw(x,W);case I.ZodBigInt:return Gw(x,W);case I.ZodBoolean:return bw();case I.ZodDate:return KY(x,W);case I.ZodUndefined:return Ew(W);case I.ZodNull:return Fw(W);case I.ZodArray:return Jw(x,W);case I.ZodUnion:case I.ZodDiscriminatedUnion:return cw(x,W);case I.ZodIntersection:return Bw(x,W);case I.ZodTuple:return Sw(x,W);case I.ZodRecord:return Z3(x,W);case I.ZodLiteral:return Kw(x,W);case I.ZodEnum:return ww(x);case I.ZodNativeEnum:return qw(x);case I.ZodNullable:return Lw(x,W);case I.ZodOptional:return jw(x,W);case I.ZodMap:return Vw(x,W);case I.ZodSet:return Iw(x,W);case I.ZodLazy:return()=>x.getter()._def;case I.ZodPromise:return Aw(x,W);case I.ZodNaN:case I.ZodNever:return Nw(W);case I.ZodEffects:return vw(x,W);case I.ZodAny:return j0(W);case I.ZodUnknown:return Rw(W);case I.ZodDefault:return zw(x,W);case I.ZodBranded:return P3(x,W);case I.ZodReadonly:return Pw(x,W);case I.ZodCatch:return $w(x,W);case I.ZodPipeline:return Ow(x,W);case I.ZodFunction:case I.ZodVoid:case I.ZodSymbol:return;default:return((Y)=>{return})(Q)}};function m(x,Q,W=!1){let Y=Q.seen.get(x);if(Q.override){let b=Q.override?.(x,Q,Y,W);if(b!==Ww)return b}if(Y&&!W){let b=I2(Y,Q);if(b!==void 0)return b}let X={def:x,path:Q.currentPath,jsonSchema:void 0};Q.seen.set(x,X);let J=iw(x,x.typeName,Q),G=typeof J==="function"?m(J(),Q):J;if(G)S2(x,Q,G);if(Q.postProcess){let b=Q.postProcess(G,x,Q);return X.jsonSchema=G,b}return X.jsonSchema=G,G}var I2=(x,Q)=>{switch(Q.$refStrategy){case"root":return{$ref:x.path.join("/")};case"relative":return{$ref:R3(Q.currentPath,x.path)};case"none":case"seen":{if(x.path.length<Q.currentPath.length&&x.path.every((W,Y)=>Q.currentPath[Y]===W))return console.warn(`Recursive reference detected at ${Q.currentPath.join("/")}! Defaulting to any`),j0(Q);return Q.$refStrategy==="seen"?j0(Q):void 0}}},S2=(x,Q,W)=>{if(x.description){if(W.description=x.description,Q.markdownDescription)W.markdownDescription=x.description}return W};var qY=(x,Q)=>{let W=Xw(Q),Y=typeof Q==="object"&&Q.definitions?Object.entries(Q.definitions).reduce(($,[z,v])=>({...$,[z]:m(v._def,{...W,currentPath:[...W.basePath,W.definitionPath,z]},!0)??j0(W)}),{}):void 0,X=typeof Q==="string"?Q:Q?.nameStrategy==="title"?void 0:Q?.name,J=m(x._def,X===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,X]},!1)??j0(W),G=typeof Q==="object"&&Q.name!==void 0&&Q.nameStrategy==="title"?Q.name:void 0;if(G!==void 0)J.title=G;if(W.flags.hasReferencedOpenAiAnyType){if(!Y)Y={};if(!Y[W.openAiAnyTypeName])Y[W.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:W.$refStrategy==="relative"?"1":[...W.basePath,W.definitionPath,W.openAiAnyTypeName].join("/")}}}let b=X===void 0?Y?{...J,[W.definitionPath]:Y}:J:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,X].join("/"),[W.definitionPath]:{...Y,[X]:J}};if(W.target==="jsonSchema7")b.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")b.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in b)||("oneOf"in b)||("allOf"in b)||("type"in b)&&Array.isArray(b.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return b};function E2(x){if(!x)return"draft-7";if(x==="jsonSchema7"||x==="draft-7")return"draft-7";if(x==="jsonSchema2019-09"||x==="draft-2020-12")return"draft-2020-12";return"draft-7"}function NY(x,Q){if(P1(x))return pW(x,{target:E2(Q?.target),io:Q?.pipeStrategy??"input"});return qY(x,{strictUnions:Q?.strictUnions??!0,pipeStrategy:Q?.pipeStrategy??"input"})}function FY(x){let W=C4(x)?.method;if(!W)throw Error("Schema is missing a method literal");let Y=G3(W);if(typeof Y!=="string")throw Error("Schema method literal must be a string");return Y}function UY(x,Q){let W=Z4(x,Q);if(!W.success)throw W.error;return W.data}var R2=60000;class cY{constructor(x){if(this._options=x,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._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(K3,(Q)=>{this._oncancel(Q)}),this.setNotificationHandler(V3,(Q)=>{this._onprogress(Q)}),this.setRequestHandler(H3,(Q)=>({})),this._taskStore=x?.taskStore,this._taskMessageQueue=x?.taskMessageQueue,this._taskStore)this.setRequestHandler(q3,async(Q,W)=>{let Y=await this._taskStore.getTask(Q.params.taskId,W.sessionId);if(!Y)throw new k(l.InvalidParams,"Failed to retrieve task: Task not found");return{...Y}}),this.setRequestHandler(F3,async(Q,W)=>{let Y=async()=>{let X=Q.params.taskId;if(this._taskMessageQueue){let G;while(G=await this._taskMessageQueue.dequeue(X,W.sessionId)){if(G.type==="response"||G.type==="error"){let b=G.message,$=b.id,z=this._requestResolvers.get($);if(z)if(this._requestResolvers.delete($),G.type==="response")z(b);else{let v=b,w=new k(v.error.code,v.error.message,v.error.data);z(w)}else{let v=G.type==="response"?"Response":"Error";this._onerror(Error(`${v} handler missing for request ${$}`))}continue}await this._transport?.send(G.message,{relatedRequestId:W.requestId})}}let J=await this._taskStore.getTask(X,W.sessionId);if(!J)throw new k(l.InvalidParams,`Task not found: ${X}`);if(!k4(J.status))return await this._waitForTaskUpdate(X,W.signal),await Y();if(k4(J.status)){let G=await this._taskStore.getTaskResult(X,W.sessionId);return this._clearTaskQueue(X),{...G,_meta:{...G._meta,[T4]:{taskId:X}}}}return await Y()};return await Y()}),this.setRequestHandler(U3,async(Q,W)=>{try{let{tasks:Y,nextCursor:X}=await this._taskStore.listTasks(Q.params?.cursor,W.sessionId);return{tasks:Y,nextCursor:X,_meta:{}}}catch(Y){throw new k(l.InvalidParams,`Failed to list tasks: ${Y instanceof Error?Y.message:String(Y)}`)}}),this.setRequestHandler(L3,async(Q,W)=>{try{let Y=await this._taskStore.getTask(Q.params.taskId,W.sessionId);if(!Y)throw new k(l.InvalidParams,`Task not found: ${Q.params.taskId}`);if(k4(Y.status))throw new k(l.InvalidParams,`Cannot cancel task in terminal status: ${Y.status}`);await this._taskStore.updateTaskStatus(Q.params.taskId,"cancelled","Client cancelled task execution.",W.sessionId),this._clearTaskQueue(Q.params.taskId);let X=await this._taskStore.getTask(Q.params.taskId,W.sessionId);if(!X)throw new k(l.InvalidParams,`Task not found after cancellation: ${Q.params.taskId}`);return{_meta:{},...X}}catch(Y){if(Y instanceof k)throw Y;throw new k(l.InvalidRequest,`Failed to cancel task: ${Y instanceof Error?Y.message:String(Y)}`)}})}async _oncancel(x){if(!x.params.requestId)return;this._requestHandlerAbortControllers.get(x.params.requestId)?.abort(x.params.reason)}_setupTimeout(x,Q,W,Y,X=!1){this._timeoutInfo.set(x,{timeoutId:setTimeout(Y,Q),startTime:Date.now(),timeout:Q,maxTotalTimeout:W,resetTimeoutOnProgress:X,onTimeout:Y})}_resetTimeout(x){let Q=this._timeoutInfo.get(x);if(!Q)return!1;let W=Date.now()-Q.startTime;if(Q.maxTotalTimeout&&W>=Q.maxTotalTimeout)throw this._timeoutInfo.delete(x),k.fromError(l.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:Q.maxTotalTimeout,totalElapsed:W});return clearTimeout(Q.timeoutId),Q.timeoutId=setTimeout(Q.onTimeout,Q.timeout),!0}_cleanupTimeout(x){let Q=this._timeoutInfo.get(x);if(Q)clearTimeout(Q.timeoutId),this._timeoutInfo.delete(x)}async connect(x){if(this._transport)throw Error("Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.");this._transport=x;let Q=this.transport?.onclose;this._transport.onclose=()=>{Q?.(),this._onclose()};let W=this.transport?.onerror;this._transport.onerror=(X)=>{W?.(X),this._onerror(X)};let Y=this._transport?.onmessage;this._transport.onmessage=(X,J)=>{if(Y?.(X,J),j6(X)||fv(X))this._onresponse(X);else if(tW(X))this._onrequest(X,J);else if(mv(X))this._onnotification(X);else this._onerror(Error(`Unknown message type: ${JSON.stringify(X)}`))},await this._transport.start()}_onclose(){let x=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let W of this._timeoutInfo.values())clearTimeout(W.timeoutId);this._timeoutInfo.clear();for(let W of this._requestHandlerAbortControllers.values())W.abort();this._requestHandlerAbortControllers.clear();let Q=k.fromError(l.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let W of x.values())W(Q)}_onerror(x){this.onerror?.(x)}_onnotification(x){let Q=this._notificationHandlers.get(x.method)??this.fallbackNotificationHandler;if(Q===void 0)return;Promise.resolve().then(()=>Q(x)).catch((W)=>this._onerror(Error(`Uncaught error in notification handler: ${W}`)))}_onrequest(x,Q){let W=this._requestHandlers.get(x.method)??this.fallbackRequestHandler,Y=this._transport,X=x.params?._meta?.[T4]?.taskId;if(W===void 0){let z={jsonrpc:"2.0",id:x.id,error:{code:l.MethodNotFound,message:"Method not found"}};if(X&&this._taskMessageQueue)this._enqueueTaskMessage(X,{type:"error",message:z,timestamp:Date.now()},Y?.sessionId).catch((v)=>this._onerror(Error(`Failed to enqueue error response: ${v}`)));else Y?.send(z).catch((v)=>this._onerror(Error(`Failed to send an error response: ${v}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(x.id,J);let G=lv(x.params)?x.params.task:void 0,b=this._taskStore?this.requestTaskStore(x,Y?.sessionId):void 0,$={signal:J.signal,sessionId:Y?.sessionId,_meta:x.params?._meta,sendNotification:async(z)=>{if(J.signal.aborted)return;let v={relatedRequestId:x.id};if(X)v.relatedTask={taskId:X};await this.notification(z,v)},sendRequest:async(z,v,w)=>{if(J.signal.aborted)throw new k(l.ConnectionClosed,"Request was cancelled");let K={...w,relatedRequestId:x.id};if(X&&!K.relatedTask)K.relatedTask={taskId:X};let B=K.relatedTask?.taskId??X;if(B&&b)await b.updateTaskStatus(B,"input_required");return await this.request(z,v,K)},authInfo:Q?.authInfo,requestId:x.id,requestInfo:Q?.requestInfo,taskId:X,taskStore:b,taskRequestedTtl:G?.ttl,closeSSEStream:Q?.closeSSEStream,closeStandaloneSSEStream:Q?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if(G)this.assertTaskHandlerCapability(x.method)}).then(()=>W(x,$)).then(async(z)=>{if(J.signal.aborted)return;let v={result:z,jsonrpc:"2.0",id:x.id};if(X&&this._taskMessageQueue)await this._enqueueTaskMessage(X,{type:"response",message:v,timestamp:Date.now()},Y?.sessionId);else await Y?.send(v)},async(z)=>{if(J.signal.aborted)return;let v={jsonrpc:"2.0",id:x.id,error:{code:Number.isSafeInteger(z.code)?z.code:l.InternalError,message:z.message??"Internal error",...z.data!==void 0&&{data:z.data}}};if(X&&this._taskMessageQueue)await this._enqueueTaskMessage(X,{type:"error",message:v,timestamp:Date.now()},Y?.sessionId);else await Y?.send(v)}).catch((z)=>this._onerror(Error(`Failed to send response: ${z}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(x.id)===J)this._requestHandlerAbortControllers.delete(x.id)})}_onprogress(x){let{progressToken:Q,...W}=x.params,Y=Number(Q),X=this._progressHandlers.get(Y);if(!X){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(x)}`));return}let J=this._responseHandlers.get(Y),G=this._timeoutInfo.get(Y);if(G&&J&&G.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(b){this._responseHandlers.delete(Y),this._progressHandlers.delete(Y),this._cleanupTimeout(Y),J(b);return}X(W)}_onresponse(x){let Q=Number(x.id),W=this._requestResolvers.get(Q);if(W){if(this._requestResolvers.delete(Q),j6(x))W(x);else{let J=new k(x.error.code,x.error.message,x.error.data);W(J)}return}let Y=this._responseHandlers.get(Q);if(Y===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(x)}`));return}this._responseHandlers.delete(Q),this._cleanupTimeout(Q);let X=!1;if(j6(x)&&x.result&&typeof x.result==="object"){let J=x.result;if(J.task&&typeof J.task==="object"){let G=J.task;if(typeof G.taskId==="string")X=!0,this._taskProgressTokens.set(G.taskId,Q)}}if(!X)this._progressHandlers.delete(Q);if(j6(x))Y(x);else{let J=k.fromError(x.error.code,x.error.message,x.error.data);Y(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(x,Q,W){let{task:Y}=W??{};if(!Y){try{yield{type:"result",result:await this.request(x,Q,W)}}catch(J){yield{type:"error",error:J instanceof k?J:new k(l.InternalError,String(J))}}return}let X;try{let J=await this.request(x,z8,W);if(J.task)X=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new k(l.InternalError,"Task creation did not return a task");while(!0){let G=await this.getTask({taskId:X},W);if(yield{type:"taskStatus",task:G},k4(G.status)){if(G.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:X},Q,W)};else if(G.status==="failed")yield{type:"error",error:new k(l.InternalError,`Task ${X} failed`)};else if(G.status==="cancelled")yield{type:"error",error:new k(l.InternalError,`Task ${X} was cancelled`)};return}if(G.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:X},Q,W)};return}let b=G.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise(($)=>setTimeout($,b)),W?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof k?J:new k(l.InternalError,String(J))}}}request(x,Q,W){let{relatedRequestId:Y,resumptionToken:X,onresumptiontoken:J,task:G,relatedTask:b}=W??{};return new Promise(($,z)=>{let v=(q)=>{z(q)};if(!this._transport){v(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(x.method),G)this.assertTaskCapability(x.method)}catch(q){v(q);return}W?.signal?.throwIfAborted();let w=this._requestMessageId++,K={...x,jsonrpc:"2.0",id:w};if(W?.onprogress)this._progressHandlers.set(w,W.onprogress),K.params={...x.params,_meta:{...x.params?._meta||{},progressToken:w}};if(G)K.params={...K.params,task:G};if(b)K.params={...K.params,_meta:{...K.params?._meta||{},[T4]:b}};let B=(q)=>{this._responseHandlers.delete(w),this._progressHandlers.delete(w),this._cleanupTimeout(w),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:w,reason:String(q)}},{relatedRequestId:Y,resumptionToken:X,onresumptiontoken:J}).catch((M)=>this._onerror(Error(`Failed to send cancellation: ${M}`)));let U=q instanceof k?q:new k(l.RequestTimeout,String(q));z(U)};this._responseHandlers.set(w,(q)=>{if(W?.signal?.aborted)return;if(q instanceof Error)return z(q);try{let U=Z4(Q,q.result);if(!U.success)z(U.error);else $(U.data)}catch(U){z(U)}}),W?.signal?.addEventListener("abort",()=>{B(W?.signal?.reason)});let V=W?.timeout??R2,N=()=>B(k.fromError(l.RequestTimeout,"Request timed out",{timeout:V}));this._setupTimeout(w,V,W?.maxTotalTimeout,N,W?.resetTimeoutOnProgress??!1);let F=b?.taskId;if(F){let q=(U)=>{let M=this._responseHandlers.get(w);if(M)M(U);else this._onerror(Error(`Response handler missing for side-channeled request ${w}`))};this._requestResolvers.set(w,q),this._enqueueTaskMessage(F,{type:"request",message:K,timestamp:Date.now()}).catch((U)=>{this._cleanupTimeout(w),z(U)})}else this._transport.send(K,{relatedRequestId:Y,resumptionToken:X,onresumptiontoken:J}).catch((q)=>{this._cleanupTimeout(w),z(q)})})}async getTask(x,Q){return this.request({method:"tasks/get",params:x},N3,Q)}async getTaskResult(x,Q,W){return this.request({method:"tasks/result",params:x},Q,W)}async listTasks(x,Q){return this.request({method:"tasks/list",params:x},c3,Q)}async cancelTask(x,Q){return this.request({method:"tasks/cancel",params:x},hv,Q)}async notification(x,Q){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(x.method);let W=Q?.relatedTask?.taskId;if(W){let G={...x,jsonrpc:"2.0",params:{...x.params,_meta:{...x.params?._meta||{},[T4]:Q.relatedTask}}};await this._enqueueTaskMessage(W,{type:"notification",message:G,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(x.method)&&!x.params&&!Q?.relatedRequestId&&!Q?.relatedTask){if(this._pendingDebouncedNotifications.has(x.method))return;this._pendingDebouncedNotifications.add(x.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(x.method),!this._transport)return;let G={...x,jsonrpc:"2.0"};if(Q?.relatedTask)G={...G,params:{...G.params,_meta:{...G.params?._meta||{},[T4]:Q.relatedTask}}};this._transport?.send(G,Q).catch((b)=>this._onerror(b))});return}let J={...x,jsonrpc:"2.0"};if(Q?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[T4]:Q.relatedTask}}};await this._transport.send(J,Q)}setRequestHandler(x,Q){let W=FY(x);this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(Y,X)=>{let J=UY(x,Y);return Promise.resolve(Q(J,X))})}removeRequestHandler(x){this._requestHandlers.delete(x)}assertCanSetRequestHandler(x){if(this._requestHandlers.has(x))throw Error(`A request handler for ${x} already exists, which would be overridden`)}setNotificationHandler(x,Q){let W=FY(x);this._notificationHandlers.set(W,(Y)=>{let X=UY(x,Y);return Promise.resolve(Q(X))})}removeNotificationHandler(x){this._notificationHandlers.delete(x)}_cleanupTaskProgressHandler(x){let Q=this._taskProgressTokens.get(x);if(Q!==void 0)this._progressHandlers.delete(Q),this._taskProgressTokens.delete(x)}async _enqueueTaskMessage(x,Q,W){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let Y=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(x,Q,W,Y)}async _clearTaskQueue(x,Q){if(this._taskMessageQueue){let W=await this._taskMessageQueue.dequeueAll(x,Q);for(let Y of W)if(Y.type==="request"&&tW(Y.message)){let X=Y.message.id,J=this._requestResolvers.get(X);if(J)J(new k(l.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(X);else this._onerror(Error(`Resolver missing for request ${X} during task ${x} cleanup`))}}}async _waitForTaskUpdate(x,Q){let W=this._options?.defaultTaskPollInterval??1000;try{let Y=await this._taskStore?.getTask(x);if(Y?.pollInterval)W=Y.pollInterval}catch{}return new Promise((Y,X)=>{if(Q.aborted){X(new k(l.InvalidRequest,"Request cancelled"));return}let J=setTimeout(Y,W);Q.addEventListener("abort",()=>{clearTimeout(J),X(new k(l.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(x,Q){let W=this._taskStore;if(!W)throw Error("No task store configured");return{createTask:async(Y)=>{if(!x)throw Error("No request provided");return await W.createTask(Y,x.id,{method:x.method,params:x.params},Q)},getTask:async(Y)=>{let X=await W.getTask(Y,Q);if(!X)throw new k(l.InvalidParams,"Failed to retrieve task: Task not found");return X},storeTaskResult:async(Y,X,J)=>{await W.storeTaskResult(Y,X,J,Q);let G=await W.getTask(Y,Q);if(G){let b=E6.parse({method:"notifications/tasks/status",params:G});if(await this.notification(b),k4(G.status))this._cleanupTaskProgressHandler(Y)}},getTaskResult:(Y)=>{return W.getTaskResult(Y,Q)},updateTaskStatus:async(Y,X,J)=>{let G=await W.getTask(Y,Q);if(!G)throw new k(l.InvalidParams,`Task "${Y}" not found - it may have been cleaned up`);if(k4(G.status))throw new k(l.InvalidParams,`Cannot update task "${Y}" from terminal status "${G.status}" to "${X}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await W.updateTaskStatus(Y,X,J,Q);let b=await W.getTask(Y,Q);if(b){let $=E6.parse({method:"notifications/tasks/status",params:b});if(await this.notification($),k4(b.status))this._cleanupTaskProgressHandler(Y)}},listTasks:(Y)=>{return W.listTasks(Y,Q)}}}}function Zw(x){return x!==null&&typeof x==="object"&&!Array.isArray(x)}function Cw(x,Q){let W={...x};for(let Y in Q){let X=Y,J=Q[X];if(J===void 0)continue;let G=W[X];if(Zw(G)&&Zw(J))W[X]={...G,...J};else W[X]=J}return W}var qq=S8(VX(),1),Nq=S8(Vq(),1);function tC(){let x=new qq.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Nq.default(x),x}class OX{constructor(x){this._ajv=x??tC()}getValidator(x){let Q="$id"in x&&typeof x.$id==="string"?this._ajv.getSchema(x.$id)??this._ajv.compile(x):this._ajv.compile(x);return(W)=>{if(Q(W))return{valid:!0,data:W,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(Q.errors)}}}}class AX{constructor(x){this._server=x}requestStream(x,Q,W){return this._server.requestStream(x,Q,W)}createMessageStream(x,Q){let W=this._server.getClientCapabilities();if((x.tools||x.toolChoice)&&!W?.sampling?.tools)throw Error("Client does not support sampling tools capability.");if(x.messages.length>0){let Y=x.messages[x.messages.length-1],X=Array.isArray(Y.content)?Y.content:[Y.content],J=X.some((z)=>z.type==="tool_result"),G=x.messages.length>1?x.messages[x.messages.length-2]:void 0,b=G?Array.isArray(G.content)?G.content:[G.content]:[],$=b.some((z)=>z.type==="tool_use");if(J){if(X.some((z)=>z.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!$)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if($){let z=new Set(b.filter((w)=>w.type==="tool_use").map((w)=>w.id)),v=new Set(X.filter((w)=>w.type==="tool_result").map((w)=>w.toolUseId));if(z.size!==v.size||![...z].every((w)=>v.has(w)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}return this.requestStream({method:"sampling/createMessage",params:x},i6,Q)}elicitInputStream(x,Q){let W=this._server.getClientCapabilities(),Y=x.mode??"form";switch(Y){case"url":{if(!W?.elicitation?.url)throw Error("Client does not support url elicitation.");break}case"form":{if(!W?.elicitation?.form)throw Error("Client does not support form elicitation.");break}}let X=Y==="form"&&x.mode===void 0?{...x,mode:"form"}:x;return this.requestStream({method:"elicitation/create",params:X},B8,Q)}async getTask(x,Q){return this._server.getTask({taskId:x},Q)}async getTaskResult(x,Q,W){return this._server.getTaskResult({taskId:x},Q,W)}async listTasks(x,Q){return this._server.listTasks(x?{cursor:x}:void 0,Q)}async cancelTask(x,Q){return this._server.cancelTask({taskId:x},Q)}}function Fq(x,Q,W){if(!x)throw Error(`${W} does not support task creation (required for ${Q})`);switch(Q){case"tools/call":if(!x.tools?.call)throw Error(`${W} does not support task creation for tools/call (required for ${Q})`);break;default:break}}function Uq(x,Q,W){if(!x)throw Error(`${W} does not support task creation (required for ${Q})`);switch(Q){case"sampling/createMessage":if(!x.sampling?.createMessage)throw Error(`${W} does not support task creation for sampling/createMessage (required for ${Q})`);break;case"elicitation/create":if(!x.elicitation?.create)throw Error(`${W} does not support task creation for elicitation/create (required for ${Q})`);break;default:break}}class IX extends cY{constructor(x,Q){super(Q);if(this._serverInfo=x,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(P6.options.map((W,Y)=>[W,Y])),this.isMessageIgnored=(W,Y)=>{let X=this._loggingLevels.get(Y);return X?this.LOG_LEVEL_SEVERITY.get(W)<this.LOG_LEVEL_SEVERITY.get(X):!1},this._capabilities=Q?.capabilities??{},this._instructions=Q?.instructions,this._jsonSchemaValidator=Q?.jsonSchemaValidator??new OX,this.setRequestHandler(QY,(W)=>this._oninitialize(W)),this.setNotificationHandler(WY,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(zY,async(W,Y)=>{let X=Y.sessionId||Y.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=W.params,G=P6.safeParse(J);if(G.success)this._loggingLevels.set(X,G.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new AX(this)};return this._experimental}registerCapabilities(x){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=Cw(this._capabilities,x)}setRequestHandler(x,Q){let Y=C4(x)?.method;if(!Y)throw Error("Schema is missing a method literal");let X;if(P1(Y)){let G=Y;X=G._zod?.def?.value??G.value}else{let G=Y;X=G._def?.value??G.value}if(typeof X!=="string")throw Error("Schema method literal must be a string");if(X==="tools/call"){let G=async(b,$)=>{let z=Z4(w8,b);if(!z.success){let B=z.error instanceof Error?z.error.message:String(z.error);throw new k(l.InvalidParams,`Invalid tools/call request: ${B}`)}let{params:v}=z.data,w=await Promise.resolve(Q(b,$));if(v.task){let B=Z4(z8,w);if(!B.success){let V=B.error instanceof Error?B.error.message:String(B.error);throw new k(l.InvalidParams,`Invalid task creation result: ${V}`)}return B.data}let K=Z4(S3,w);if(!K.success){let B=K.error instanceof Error?K.error.message:String(K.error);throw new k(l.InvalidParams,`Invalid tools/call result: ${B}`)}return K.data};return super.setRequestHandler(x,G)}return super.setRequestHandler(x,Q)}assertCapabilityForMethod(x){switch(x){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${x})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${x})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${x})`);break;case"ping":break}}assertNotificationCapability(x){switch(x){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${x})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${x})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${x})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${x})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${x})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(x){if(!this._capabilities)return;switch(x){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${x})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${x})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${x})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${x})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${x})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${x})`);break;case"ping":case"initialize":break}}assertTaskCapability(x){Uq(this._clientCapabilities?.tasks?.requests,x,"Client")}assertTaskHandlerCapability(x){if(!this._capabilities)return;Fq(this._capabilities.tasks?.requests,x,"Server")}async _oninitialize(x){let Q=x.params.protocolVersion;return this._clientCapabilities=x.params.capabilities,this._clientVersion=x.params.clientInfo,{protocolVersion:kv.includes(Q)?Q:rW,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"},B3)}async createMessage(x,Q){if(x.tools||x.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(x.messages.length>0){let W=x.messages[x.messages.length-1],Y=Array.isArray(W.content)?W.content:[W.content],X=Y.some(($)=>$.type==="tool_result"),J=x.messages.length>1?x.messages[x.messages.length-2]:void 0,G=J?Array.isArray(J.content)?J.content:[J.content]:[],b=G.some(($)=>$.type==="tool_use");if(X){if(Y.some(($)=>$.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!b)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(b){let $=new Set(G.filter((v)=>v.type==="tool_use").map((v)=>v.id)),z=new Set(Y.filter((v)=>v.type==="tool_result").map((v)=>v.toolUseId));if($.size!==z.size||![...$].every((v)=>z.has(v)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(x.tools)return this.request({method:"sampling/createMessage",params:x},vY,Q);return this.request({method:"sampling/createMessage",params:x},i6,Q)}async elicitInput(x,Q){switch(x.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let Y=x;return this.request({method:"elicitation/create",params:Y},B8,Q)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let Y=x.mode==="form"?x:{...x,mode:"form"},X=await this.request({method:"elicitation/create",params:Y},B8,Q);if(X.action==="accept"&&X.content&&Y.requestedSchema)try{let G=this._jsonSchemaValidator.getValidator(Y.requestedSchema)(X.content);if(!G.valid)throw new k(l.InvalidParams,`Elicitation response content does not match requested schema: ${G.errorMessage}`)}catch(J){if(J instanceof k)throw J;throw new k(l.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return X}}}createElicitationCompletionNotifier(x,Q){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:x}},Q)}async listRoots(x,Q){return this.request({method:"roots/list",params:x},wY,Q)}async sendLoggingMessage(x,Q){if(this._capabilities.logging){if(!this.isMessageIgnored(x.level,Q))return this.notification({method:"notifications/message",params:x})}}async sendResourceUpdated(x){return this.notification({method:"notifications/resources/updated",params:x})}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 Lq=Symbol.for("mcp.completable");function SX(x){return!!x&&typeof x==="object"&&Lq in x}function Mq(x){return x[Lq]?.complete}var cq;(function(x){x.Completable="McpCompletable"})(cq||(cq={}));var eC=/^[A-Za-z0-9._-]{1,128}$/;function xT(x){let Q=[];if(x.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(x.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${x.length})`]};if(x.includes(" "))Q.push("Tool name contains spaces, which may cause parsing issues");if(x.includes(","))Q.push("Tool name contains commas, which may cause parsing issues");if(x.startsWith("-")||x.endsWith("-"))Q.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if(x.startsWith(".")||x.endsWith("."))Q.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!eC.test(x)){let W=x.split("").filter((Y)=>!/[A-Za-z0-9._-]/.test(Y)).filter((Y,X,J)=>J.indexOf(Y)===X);return Q.push(`Tool name contains invalid characters: ${W.map((Y)=>`"${Y}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Q}}return{isValid:!0,warnings:Q}}function QT(x,Q){if(Q.length>0){console.warn(`Tool name validation warning for "${x}":`);for(let W of Q)console.warn(` - ${W}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function EX(x){let Q=xT(x);return QT(x,Q.warnings),Q.isValid}class RX{constructor(x){this._mcpServer=x}registerToolTask(x,Q,W){let Y={taskSupport:"required",...Q.execution};if(Y.taskSupport==="forbidden")throw Error(`Cannot register task-based tool '${x}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(x,Q.title,Q.description,Q.inputSchema,Q.outputSchema,Q.annotations,Y,Q._meta,W)}}class iX{constructor(x,Q){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new IX(x,Q)}get experimental(){if(!this._experimental)this._experimental={tasks:new RX(this)};return this._experimental}async connect(x){return await this.server.connect(x)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(g4(I3)),this.server.assertCanSetRequestHandler(g4(w8)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(I3,()=>({tools:Object.entries(this._registeredTools).filter(([,x])=>x.enabled).map(([x,Q])=>{let W={name:x,title:Q.title,description:Q.description,inputSchema:(()=>{let Y=b8(Q.inputSchema);return Y?NY(Y,{strictUnions:!0,pipeStrategy:"input"}):WT})(),annotations:Q.annotations,execution:Q.execution,_meta:Q._meta};if(Q.outputSchema){let Y=b8(Q.outputSchema);if(Y)W.outputSchema=NY(Y,{strictUnions:!0,pipeStrategy:"output"})}return W})})),this.server.setRequestHandler(w8,async(x,Q)=>{try{let W=this._registeredTools[x.params.name];if(!W)throw new k(l.InvalidParams,`Tool ${x.params.name} not found`);if(!W.enabled)throw new k(l.InvalidParams,`Tool ${x.params.name} disabled`);let Y=!!x.params.task,X=W.execution?.taskSupport,J="createTask"in W.handler;if((X==="required"||X==="optional")&&!J)throw new k(l.InternalError,`Tool ${x.params.name} has taskSupport '${X}' but was not registered with registerToolTask`);if(X==="required"&&!Y)throw new k(l.MethodNotFound,`Tool ${x.params.name} requires task augmentation (taskSupport: 'required')`);if(X==="optional"&&!Y&&J)return await this.handleAutomaticTaskPolling(W,x,Q);let G=await this.validateToolInput(W,x.params.arguments,x.params.name),b=await this.executeToolHandler(W,G,Q);if(Y)return b;return await this.validateToolOutput(W,b,x.params.name),b}catch(W){if(W instanceof k){if(W.code===l.UrlElicitationRequired)throw W}return this.createToolError(W instanceof Error?W.message:String(W))}}),this._toolHandlersInitialized=!0}createToolError(x){return{content:[{type:"text",text:x}],isError:!0}}async validateToolInput(x,Q,W){if(!x.inputSchema)return;let X=b8(x.inputSchema)??x.inputSchema,J=await X3(X,Q);if(!J.success){let G="error"in J?J.error:"Unknown error",b=J3(G);throw new k(l.InvalidParams,`Input validation error: Invalid arguments for tool ${W}: ${b}`)}return J.data}async validateToolOutput(x,Q,W){if(!x.outputSchema)return;if(!("content"in Q))return;if(Q.isError)return;if(!Q.structuredContent)throw new k(l.InvalidParams,`Output validation error: Tool ${W} has an output schema but no structured content was provided`);let Y=b8(x.outputSchema),X=await X3(Y,Q.structuredContent);if(!X.success){let J="error"in X?X.error:"Unknown error",G=J3(J);throw new k(l.InvalidParams,`Output validation error: Invalid structured content for tool ${W}: ${G}`)}}async executeToolHandler(x,Q,W){let Y=x.handler;if("createTask"in Y){if(!W.taskStore)throw Error("No task store provided.");let J={...W,taskStore:W.taskStore};if(x.inputSchema)return await Promise.resolve(Y.createTask(Q,J));else return await Promise.resolve(Y.createTask(J))}if(x.inputSchema)return await Promise.resolve(Y(Q,W));else return await Promise.resolve(Y(W))}async handleAutomaticTaskPolling(x,Q,W){if(!W.taskStore)throw Error("No task store provided for task-capable tool.");let Y=await this.validateToolInput(x,Q.params.arguments,Q.params.name),X=x.handler,J={...W,taskStore:W.taskStore},G=Y?await Promise.resolve(X.createTask(Y,J)):await Promise.resolve(X.createTask(J)),b=G.task.taskId,$=G.task,z=$.pollInterval??5000;while($.status!=="completed"&&$.status!=="failed"&&$.status!=="cancelled"){await new Promise((w)=>setTimeout(w,z));let v=await W.taskStore.getTask(b);if(!v)throw new k(l.InternalError,`Task ${b} not found during polling`);$=v}return await W.taskStore.getTaskResult(b)}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(g4(E3)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(E3,async(x)=>{switch(x.params.ref.type){case"ref/prompt":return tv(x),this.handlePromptCompletion(x,x.params.ref);case"ref/resource":return ev(x),this.handleResourceCompletion(x,x.params.ref);default:throw new k(l.InvalidParams,`Invalid completion reference: ${x.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(x,Q){let W=this._registeredPrompts[Q.name];if(!W)throw new k(l.InvalidParams,`Prompt ${Q.name} not found`);if(!W.enabled)throw new k(l.InvalidParams,`Prompt ${Q.name} disabled`);if(!W.argsSchema)return Y9;let X=C4(W.argsSchema)?.[x.params.argument.name];if(!SX(X))return Y9;let J=Mq(X);if(!J)return Y9;let G=await J(x.params.argument.value,x.params.context);return jq(G)}async handleResourceCompletion(x,Q){let W=Object.values(this._registeredResourceTemplates).find((J)=>J.resourceTemplate.uriTemplate.toString()===Q.uri);if(!W){if(this._registeredResources[Q.uri])return Y9;throw new k(l.InvalidParams,`Resource template ${x.params.ref.uri} not found`)}let Y=W.resourceTemplate.completeCallback(x.params.argument.name);if(!Y)return Y9;let X=await Y(x.params.argument.value,x.params.context);return jq(X)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(g4(M3)),this.server.assertCanSetRequestHandler(g4(D3)),this.server.assertCanSetRequestHandler(g4(j3)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(M3,async(x,Q)=>{let W=Object.entries(this._registeredResources).filter(([X,J])=>J.enabled).map(([X,J])=>({uri:X,name:J.name,...J.metadata})),Y=[];for(let X of Object.values(this._registeredResourceTemplates)){if(!X.resourceTemplate.listCallback)continue;let J=await X.resourceTemplate.listCallback(Q);for(let G of J.resources)Y.push({...X.metadata,...G})}return{resources:[...W,...Y]}}),this.server.setRequestHandler(D3,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([Q,W])=>({name:Q,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(j3,async(x,Q)=>{let W=new URL(x.params.uri),Y=this._registeredResources[W.toString()];if(Y){if(!Y.enabled)throw new k(l.InvalidParams,`Resource ${W} disabled`);return Y.readCallback(W,Q)}for(let X of Object.values(this._registeredResourceTemplates)){let J=X.resourceTemplate.uriTemplate.match(W.toString());if(J)return X.readCallback(W,J,Q)}throw new k(l.InvalidParams,`Resource ${W} not found`)}),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(g4(O3)),this.server.assertCanSetRequestHandler(g4(A3)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(O3,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,x])=>x.enabled).map(([x,Q])=>{return{name:x,title:Q.title,description:Q.description,arguments:Q.argsSchema?YT(Q.argsSchema):void 0}})})),this.server.setRequestHandler(A3,async(x,Q)=>{let W=this._registeredPrompts[x.params.name];if(!W)throw new k(l.InvalidParams,`Prompt ${x.params.name} not found`);if(!W.enabled)throw new k(l.InvalidParams,`Prompt ${x.params.name} disabled`);if(W.argsSchema){let Y=b8(W.argsSchema),X=await X3(Y,x.params.arguments);if(!X.success){let b="error"in X?X.error:"Unknown error",$=J3(b);throw new k(l.InvalidParams,`Invalid arguments for prompt ${x.params.name}: ${$}`)}let J=X.data,G=W.callback;return await Promise.resolve(G(J,Q))}else{let Y=W.callback;return await Promise.resolve(Y(Q))}}),this._promptHandlersInitialized=!0}resource(x,Q,...W){let Y;if(typeof W[0]==="object")Y=W.shift();let X=W[0];if(typeof Q==="string"){if(this._registeredResources[Q])throw Error(`Resource ${Q} is already registered`);let J=this._createRegisteredResource(x,void 0,Q,Y,X);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),J}else{if(this._registeredResourceTemplates[x])throw Error(`Resource template ${x} is already registered`);let J=this._createRegisteredResourceTemplate(x,void 0,Q,Y,X);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),J}}registerResource(x,Q,W,Y){if(typeof Q==="string"){if(this._registeredResources[Q])throw Error(`Resource ${Q} is already registered`);let X=this._createRegisteredResource(x,W.title,Q,W,Y);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}else{if(this._registeredResourceTemplates[x])throw Error(`Resource template ${x} is already registered`);let X=this._createRegisteredResourceTemplate(x,W.title,Q,W,Y);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),X}}_createRegisteredResource(x,Q,W,Y,X){let J={name:x,title:Q,metadata:Y,readCallback:X,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({uri:null}),update:(G)=>{if(typeof G.uri<"u"&&G.uri!==W){if(delete this._registeredResources[W],G.uri)this._registeredResources[G.uri]=J}if(typeof G.name<"u")J.name=G.name;if(typeof G.title<"u")J.title=G.title;if(typeof G.metadata<"u")J.metadata=G.metadata;if(typeof G.callback<"u")J.readCallback=G.callback;if(typeof G.enabled<"u")J.enabled=G.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=J,J}_createRegisteredResourceTemplate(x,Q,W,Y,X){let J={resourceTemplate:W,title:Q,metadata:Y,readCallback:X,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({name:null}),update:($)=>{if(typeof $.name<"u"&&$.name!==x){if(delete this._registeredResourceTemplates[x],$.name)this._registeredResourceTemplates[$.name]=J}if(typeof $.title<"u")J.title=$.title;if(typeof $.template<"u")J.resourceTemplate=$.template;if(typeof $.metadata<"u")J.metadata=$.metadata;if(typeof $.callback<"u")J.readCallback=$.callback;if(typeof $.enabled<"u")J.enabled=$.enabled;this.sendResourceListChanged()}};this._registeredResourceTemplates[x]=J;let G=W.uriTemplate.variableNames;if(Array.isArray(G)&&G.some(($)=>!!W.completeCallback($)))this.setCompletionRequestHandler();return J}_createRegisteredPrompt(x,Q,W,Y,X){let J={title:Q,description:W,argsSchema:Y===void 0?void 0:Nx(Y),callback:X,enabled:!0,disable:()=>J.update({enabled:!1}),enable:()=>J.update({enabled:!0}),remove:()=>J.update({name:null}),update:(G)=>{if(typeof G.name<"u"&&G.name!==x){if(delete this._registeredPrompts[x],G.name)this._registeredPrompts[G.name]=J}if(typeof G.title<"u")J.title=G.title;if(typeof G.description<"u")J.description=G.description;if(typeof G.argsSchema<"u")J.argsSchema=Nx(G.argsSchema);if(typeof G.callback<"u")J.callback=G.callback;if(typeof G.enabled<"u")J.enabled=G.enabled;this.sendPromptListChanged()}};if(this._registeredPrompts[x]=J,Y){if(Object.values(Y).some((b)=>{let $=b instanceof M1?b._def?.innerType:b;return SX($)}))this.setCompletionRequestHandler()}return J}_createRegisteredTool(x,Q,W,Y,X,J,G,b,$){EX(x);let z={title:Q,description:W,inputSchema:Dq(Y),outputSchema:Dq(X),annotations:J,execution:G,_meta:b,handler:$,enabled:!0,disable:()=>z.update({enabled:!1}),enable:()=>z.update({enabled:!0}),remove:()=>z.update({name:null}),update:(v)=>{if(typeof v.name<"u"&&v.name!==x){if(typeof v.name==="string")EX(v.name);if(delete this._registeredTools[x],v.name)this._registeredTools[v.name]=z}if(typeof v.title<"u")z.title=v.title;if(typeof v.description<"u")z.description=v.description;if(typeof v.paramsSchema<"u")z.inputSchema=Nx(v.paramsSchema);if(typeof v.outputSchema<"u")z.outputSchema=Nx(v.outputSchema);if(typeof v.callback<"u")z.handler=v.callback;if(typeof v.annotations<"u")z.annotations=v.annotations;if(typeof v._meta<"u")z._meta=v._meta;if(typeof v.enabled<"u")z.enabled=v.enabled;this.sendToolListChanged()}};return this._registeredTools[x]=z,this.setToolRequestHandlers(),this.sendToolListChanged(),z}tool(x,...Q){if(this._registeredTools[x])throw Error(`Tool ${x} is already registered`);let W,Y,X,J;if(typeof Q[0]==="string")W=Q.shift();if(Q.length>1){let b=Q[0];if(PX(b)){if(Y=Q.shift(),Q.length>1&&typeof Q[0]==="object"&&Q[0]!==null&&!PX(Q[0]))J=Q.shift()}else if(typeof b==="object"&&b!==null){if(Object.values(b).some(($)=>typeof $==="object"&&$!==null))throw Error(`Tool ${x} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);J=Q.shift()}}let G=Q[0];return this._createRegisteredTool(x,void 0,W,Y,X,J,{taskSupport:"forbidden"},void 0,G)}registerTool(x,Q,W){if(this._registeredTools[x])throw Error(`Tool ${x} is already registered`);let{title:Y,description:X,inputSchema:J,outputSchema:G,annotations:b,_meta:$}=Q;return this._createRegisteredTool(x,Y,X,J,G,b,{taskSupport:"forbidden"},$,W)}prompt(x,...Q){if(this._registeredPrompts[x])throw Error(`Prompt ${x} is already registered`);let W;if(typeof Q[0]==="string")W=Q.shift();let Y;if(Q.length>1)Y=Q.shift();let X=Q[0],J=this._createRegisteredPrompt(x,void 0,W,Y,X);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),J}registerPrompt(x,Q,W){if(this._registeredPrompts[x])throw Error(`Prompt ${x} is already registered`);let{title:Y,description:X,argsSchema:J}=Q,G=this._createRegisteredPrompt(x,Y,X,J,W);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),G}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(x,Q){return this.server.sendLoggingMessage(x,Q)}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var WT={type:"object",properties:{}};function Oq(x){return x!==null&&typeof x==="object"&&"parse"in x&&typeof x.parse==="function"&&"safeParse"in x&&typeof x.safeParse==="function"}function Aq(x){return"_def"in x||"_zod"in x||Oq(x)}function PX(x){if(typeof x!=="object"||x===null)return!1;if(Aq(x))return!1;if(Object.keys(x).length===0)return!0;return Object.values(x).some(Oq)}function Dq(x){if(!x)return;if(PX(x))return Nx(x);if(!Aq(x))throw Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return x}function YT(x){let Q=C4(x);if(!Q)return[];return Object.entries(Q).map(([W,Y])=>{let X=Bv(Y),J=Kv(Y);return{name:W,description:X,required:!J}})}function g4(x){let W=C4(x)?.method;if(!W)throw Error("Schema is missing a method literal");let Y=G3(W);if(typeof Y==="string")return Y;throw Error("Schema method literal must be a string")}function jq(x){return{completion:{values:x.slice(0,100),total:x.length,hasMore:x.length>100}}}var Y9={completion:{values:[],hasMore:!1}};import Sq from"node:process";class ZX{append(x){this._buffer=this._buffer?Buffer.concat([this._buffer,x]):x}readMessage(){if(!this._buffer)return null;let x=this._buffer.indexOf(`
|
|
67
67
|
`);if(x===-1)return null;let Q=this._buffer.toString("utf8",0,x).replace(/\r$/,"");return this._buffer=this._buffer.subarray(x+1),XT(Q)}clear(){this._buffer=void 0}}function XT(x){return gv.parse(JSON.parse(x))}function Iq(x){return JSON.stringify(x)+`
|
|
68
|
-
`}class CX{constructor(x=Sq.stdin,Q=Sq.stdout){this._stdin=x,this._stdout=Q,this._readBuffer=new ZX,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{this.onerror?.(W)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let x=this._readBuffer.readMessage();if(x===null)break;this.onmessage?.(x)}catch(x){this.onerror?.(x)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(x){return new Promise((Q)=>{let W=Iq(x);if(this._stdout.write(W))Q();else this._stdout.once("drain",Q)})}}var bT="https://api.figura.so",$T="mcp",Eq=q7(Cq(),".figura","config.json"),zT=q7(".figura","config.json");async function Rq(x){try{let Q=JSON.parse(await X9.readFile(x,"utf8"));if(Q&&typeof Q==="object")return Q}catch{}return{}}async function vT(x=process.cwd()){let Q=Cq(),W=x;for(;;){if(W!==Q){let X=q7(W,zT);try{return await X9.access(X),X}catch{}}let Y=Tq(W);if(Y===W)return null;W=Y}}function wT(x=process.cwd()){let Q=x;for(;;){if(JT(q7(Q,".git")))return!0;let W=Tq(Q);if(W===Q)return!1;Q=W}}async function kq(){let x=await vT(),Q=x?await Rq(x):{},W=await Rq(Eq),Y={...W,...Q},X=process.env.FIGURA_TOKEN||Y.token||void 0,J=process.env.FIGURA_TOKEN?"env":Q.token?"project":W.token?"global":"none",G=(process.env.FIGURA_API_URL||Y.apiUrl||bT).replace(/\/+$/,"");return{token:X,apiUrl:G,team:Y.team,source:J,configPath:J==="project"?x:J==="global"?Eq:null}}async function u0(x,Q={}){let W=await kq(),Y=W.token;if(!Y)throw Error("No Figura token. Run `figura link` in this repo (or `figura login`, or set FIGURA_TOKEN).");if((Q.method??"GET").toUpperCase()!=="GET"&&W.source==="global"&&wT()&&process.env.FIGURA_ALLOW_GLOBAL!=="1")throw Error(`this project isn't linked to a Figura team — the global credential${W.team?` (team '${W.team}')`:""} would receive this write. Ask the user to run \`figura link\` in this repo (or set FIGURA_ALLOW_GLOBAL=1 to use the global team deliberately).`);let J=`${W.apiUrl}${x.startsWith("/")?"":"/"}${x}`,G={Accept:"application/json",Authorization:`Bearer ${Y}`,"X-Figura-Source":$T},b;if(Q.body!==void 0)G["Content-Type"]="application/json",b=JSON.stringify(Q.body);let $=await k9.request({url:J,method:Q.method??"GET",headers:G,data:b,validateStatus:()=>!0,transformRequest:[(w)=>w],transformResponse:[(w)=>w]}),z=typeof $.data==="string"?$.data:"",v=void 0;if(z)try{v=JSON.parse(z)}catch{v=z}if($.status<200||$.status>=300){let w=v&&typeof v==="object"&&v!==null&&"error"in v?String(v.error):typeof v==="string"&&v?v:$.statusText||`HTTP ${$.status}`;throw Error(`${w} (HTTP ${$.status})`)}return v}var Pq=2500,BT=600000,KT=60000,iq=(x)=>new Promise((Q)=>setTimeout(Q,x));async function HT(x){let Q=Date.now(),W=null;for(;;){let Y;try{Y=await u0(`/v1/jobs/${encodeURIComponent(x)}`),W=null}catch(X){if(W??=Date.now(),Date.now()-W>=KT){let J=X instanceof Error?X.message:String(X);throw Error(`Lost contact with the Figura API while waiting for job ${x} (${J}). `+`The job may still complete — resume by checking GET /v1/jobs/${x} instead of regenerating.`)}await iq(Pq);continue}if(Y.status==="done")return Y;if(Y.status==="error")throw Error(Y.error||"The generation job failed. Please retry.");if(Date.now()-Q>BT)throw Error(`Timed out waiting for job ${x} — it may still complete; `+`check GET /v1/jobs/${x} instead of regenerating.`);await iq(Pq)}}function g0(x){return{content:[{type:"text",text:JSON.stringify(x,null,2)}]}}function X1(x){return{content:[{type:"text",text:x instanceof Error?x.message:String(x)}],isError:!0}}var N7=()=>C.string().optional().describe("Product area / surface the fig belongs to, e.g. 'dashboard', 'settings', 'onboarding'. Free text."),kX=["portrait","landscape","both"],_X=["single","compare","variations"],VT=(()=>{try{let x=JSON.parse(GT(new URL("../package.json",import.meta.url),"utf8"));return typeof x.version==="string"?x.version:"0.0.0"}catch{return"0.0.0"}})(),t0=new iX({name:"figura",version:VT});t0.registerTool("figura_whoami",{title:"Figura: whoami",description:"Return the identity (team, actor, scopes) for the configured Figura token, plus `binding` — which config tier supplied it (env | project | global). A `global` binding means this project is not linked to a team and writes will be refused; ask the user to run `figura link` in the repo.",inputSchema:{}},async()=>{try{let x=await u0("/v1/whoami"),{source:Q,configPath:W}=await kq();return g0({...x,binding:{source:Q,configPath:W}})}catch(x){return X1(x)}});t0.registerTool("figura_set_brand",{title:"Figura: set brand profile",description:'Set (upsert) the team brand profile that the fig generator renders against. Use this to "introduce a repo to Figura": scan the codebase for its design system, synthesize the brand, then push it here. `name` is required; `appDescription` is a one-clause product summary; `tokensBlock` is the freeform design-token reference (colors + hex + role, type scale + faces, spacing, the brand gradient, plus voice/conventions). This is a partial merge — fields you omit keep their saved value (pass an explicit empty string to clear one), so a name-only update will not wipe existing tokens. Editing the team brand — confirm with the user before calling.',inputSchema:{name:C.string().describe("Brand / app name (required)."),appDescription:C.string().optional().describe("One clause on what the product is + who it is for."),tokensBlock:C.string().optional().describe("Freeform plain-text design-token reference: colors (hex + role), type scale + faces, spacing, the brand gradient, and voice/conventions. Injected verbatim into the fig-generation prompt.")}},async(x)=>{try{let Q={name:x.name};if(x.appDescription!==void 0)Q.appDescription=x.appDescription;if(x.tokensBlock!==void 0)Q.tokensBlock=x.tokensBlock;return g0(await u0("/brand",{method:"PUT",body:Q}))}catch(Q){return X1(Q)}});var qT={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",svg:"image/svg+xml"},TX=5242880;function Zq(x){let Q=x.split(/[?#]/)[0].split(".").pop()?.toLowerCase()??"";return qT[Q]}async function _q(x,Q){let W,Y=Q;if(/^https?:\/\//i.test(x)){let X=await k9.get(x,{responseType:"arraybuffer",maxContentLength:TX,timeout:30000});if(W=Buffer.from(X.data).toString("base64"),!Y){let J=String(X.headers["content-type"]??"").split(";")[0].trim().toLowerCase();Y=J.startsWith("image/")?J:Zq(x)}}else{let{size:X}=await X9.stat(x);if(X>TX)throw Error(`'${x}' is ${(X/1048576).toFixed(1)}MB — over the ${TX/1048576}MB asset limit.`);if(W=(await X9.readFile(x)).toString("base64"),!Y)Y=Zq(x)}if(!Y)throw Error(`Could not determine an image content-type for '${x}' — pass contentType (e.g. image/png).`);return{data:W,contentType:Y}}async function NT(x,Q){let{data:W,contentType:Y}=await _q(x,Q),X=await u0("/v1/assets",{method:"POST",body:{data:W,contentType:Y}});if(!X||typeof X.url!=="string")throw Error("Asset upload did not return a URL.");return X.url}var uq=()=>C.array(C.object({source:C.string().describe("The image — a local file path or an http(s) URL (e.g. a screenshot)."),match:C.string().optional().describe('Exact string in the HTML to replace with the hosted URL (defaults to `source` — i.e. write <img src="<source>"> in the HTML).')})).optional().describe("Images to attach: each is uploaded to durable figura hosting (stable non-expiring URL, allowed by the fig CSP) and substituted into the HTML in place of `match`/`source`. Use for real screenshots/photos/logos instead of base64 data-URIs (HTML size cap) or external URLs (expire/CSP-blocked).");async function lq(x,Q){if(!Q?.length)return{html:x,uploaded:[]};let W=x,Y=[];for(let X of Q){let J=X.match??X.source;if(!W.includes(J))throw Error(`images: '${J}' does not occur in the html — reference it (e.g. <img src="${J}">) so it can be swapped for the hosted URL, or set 'match'.`);let G=await NT(X.source);W=W.split(J).join(G),Y.push({source:X.source,url:G})}return{html:W,uploaded:Y}}function pq(x,Q){if(!Q.length)return x;if(x&&typeof x==="object"&&!Array.isArray(x))return{...x,assets:Q};return{result:x,assets:Q}}t0.registerTool("figura_create_fig",{title:"Figura: create fig",description:'Create a new visualization from an HTML document. Returns the created fig (id, slug); with publish:true it is published and the result includes a shareable public url. To include REAL images (screenshots/photos/logos), pass them via `images` — they are uploaded to durable figura hosting and their stable URLs substituted into the HTML. TIP — injected components: if your HTML shows phone frames (a compare/multi-screen mock), wrap each state in <div class="fig-device portrait|landscape"><div class="fig-screen">…</div><div class="fig-di"></div><div class="fig-homebar"></div></div> and do NOT style those classes — Figura injects accurate iPhone frame CSS at save. Same for an iOS status bar (<div class="fig-statusbar" data-time="9:41"></div>), a compare control bar (.fig-controls/.fig-seg), and the .frame-web browser window.',inputSchema:{html:C.string().describe("The full HTML document for the visualization."),images:uq(),title:C.string().optional().describe("Title (otherwise derived from the HTML)."),description:C.string().optional(),area:N7(),tags:C.array(C.string()).optional(),orientation:C.enum(kX).optional(),mode:C.enum(_X).optional(),model:C.string().optional().describe("Model attribution."),device:C.string().optional().describe("Catalog iPhone id the fig targets (e.g. 'iphone-16', 'iphone-17-pro', 'iphone-se-3') — keys the injected frame/safe-area geometry."),issue:C.number().optional().describe("Linked issue number."),publish:C.boolean().optional().describe("Publish to a shareable public URL on create (requires a paid plan).")}},async(x)=>{try{let{html:Q,uploaded:W}=await lq(x.html,x.images),Y={html:Q};for(let X of["title","description","area","tags","orientation","mode","model","device","issue","publish"])if(x[X]!==void 0)Y[X]=x[X];return g0(pq(await u0("/v1/figs",{method:"POST",body:Y}),W))}catch(Q){return X1(Q)}});t0.registerTool("figura_upload_asset",{title:"Figura: upload asset",description:"Upload a durable image asset and get back a STABLE, figura-hosted URL that never expires — use it in a fig's <img src> instead of a base64 data-URI (bloats the HTML past the publish size) or an external URL that expires (Instagram/CDN signed links). The fig CSP allows figura-hosted images. Provide `path` (a local image file), `url` (an http(s) image to fetch and re-host), or `data` (base64 bytes) + `contentType`. Accepts png/jpeg/gif/webp/avif/svg, up to 5MB. Returns `{ url }`.",inputSchema:{path:C.string().optional().describe("Local path to an image file to upload (content-type inferred from the extension)."),url:C.string().optional().describe("http(s) URL of an image to fetch and re-host (alternative to `path`) — use for expiring/signed source URLs so the fig keeps rendering after they die."),data:C.string().optional().describe("Base64-encoded image bytes (alternative to `path`/`url`). Requires `contentType`."),contentType:C.string().optional().describe("MIME type, e.g. image/png. Required with `data`; inferred from the extension/response for `path`/`url`.")}},async(x)=>{try{let Q=x.path??x.url;if(Q){let{data:W,contentType:Y}=await _q(Q,x.contentType);return g0(await u0("/v1/assets",{method:"POST",body:{data:W,contentType:Y}}))}if(!x.data)throw Error("Provide `path` (a local image file), `url` (an http(s) image), or `data` (base64 bytes).");if(!x.contentType)throw Error("`contentType` is required with `data` — e.g. image/png.");return g0(await u0("/v1/assets",{method:"POST",body:{data:x.data,contentType:x.contentType}}))}catch(Q){return X1(Q)}});t0.registerTool("figura_generate_fig",{title:"Figura: generate fig",description:"Generate a new fig server-side from a natural-language brief, then persist it. The engine runs Figura's on-brand generation — you do NOT write the HTML; just describe the screen. SPENDS TEAM CREDITS: only use when the user explicitly opts for a server render; otherwise default to writing the HTML yourself and landing it with figura_create_fig (free, uses the calling model). Runs as an async server job; this call polls until the fig lands (typically 30–90s). Returns the created fig (id, slug); publish:true publishes it with a shareable url. Requires an active paid subscription.",inputSchema:{prompt:C.string().describe("A natural-language brief describing the screen/UI to generate."),area:N7(),orientation:C.enum(kX).optional(),mode:C.enum(_X).optional(),platform:C.enum(["mobile","web"]).optional().describe("Output platform: 'mobile' (iPhone, default) or 'web' (browser frame)."),device:C.string().optional().describe("Catalog iPhone id to target (e.g. 'iphone-16', 'iphone-17-pro', 'iphone-se-3'). Mobile only; default iphone-16."),title:C.string().optional().describe("Title (otherwise derived from the generated HTML)."),fidelity:C.enum(["fast","high"]).optional().describe("Generation fidelity (default fast)."),publish:C.boolean().optional().describe("Publish to a shareable public URL on create (requires a paid plan).")}},async(x)=>{try{let Q={prompt:x.prompt};for(let Y of["area","orientation","mode","platform","device","title","publish"])if(x[Y]!==void 0)Q[Y]=x[Y];if(x.fidelity!==void 0)Q.model=x.fidelity;Q.async=!0;let W=await u0("/v1/figs/generate",{method:"POST",body:Q});if(W&&typeof W==="object"&&typeof W.jobId==="string"){let Y=await HT(W.jobId),X=Y.result??{};return g0(X.fig??Y.result)}return g0(W)}catch(Q){return X1(Q)}});t0.registerTool("figura_revise_fig",{title:"Figura: revise fig",description:"Create a new revision (version) of an existing fig from updated HTML. Returns the new fig (id, slug, version); publish:true publishes it with a shareable url. The new version joins the original fig's chain — it does not replace it in place. Use list_revisions for the chain (rootFig + every version). To include REAL images (screenshots/photos/logos), pass them via `images` — uploaded to durable figura hosting, stable URLs substituted into the HTML.",inputSchema:{id:C.string().describe("The fig to revise — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),html:C.string().describe("The full updated HTML document."),images:uq(),title:C.string().optional().describe("Title (otherwise derived from the HTML)."),description:C.string().optional(),area:C.string().optional().describe("Product area / surface; free text. Inherited from the parent if omitted."),tags:C.array(C.string()).optional(),orientation:C.enum(kX).optional().describe("Inherited from the parent if omitted."),mode:C.enum(_X).optional(),model:C.string().optional().describe("Model attribution."),issue:C.number().optional().describe("Linked issue number."),publish:C.boolean().optional().describe("Publish the new revision to a shareable public URL (requires a paid plan).")}},async(x)=>{try{let{html:Q,uploaded:W}=await lq(x.html,x.images),Y={html:Q};for(let X of["title","description","area","tags","orientation","mode","model","issue","publish"])if(x[X]!==void 0)Y[X]=x[X];return g0(pq(await u0(`/v1/figs/${encodeURIComponent(x.id)}/revise`,{method:"POST",body:Y}),W))}catch(Q){return X1(Q)}});t0.registerTool("figura_list_revisions",{title:"Figura: list revisions",description:"List the full revision chain for a fig (all versions sharing a root), oldest to newest.",inputSchema:{id:C.string().describe("Any fig in the chain — its id (`fig_…`), a UUID, share link/URL, or publicId.")}},async(x)=>{try{return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}/revisions`))}catch(Q){return X1(Q)}});t0.registerTool("figura_publish_fig",{title:"Figura: publish fig",description:"Publish (or unpublish) an existing fig to its shareable public URL. Requires a paid plan. Returns { isPublic, url, publicId }.",inputSchema:{id:C.string().describe("The fig to publish — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),isPublic:C.boolean().optional().describe("Set false to unpublish (make private). Defaults to true (publish).")}},async(x)=>{try{let Q={};if(x.isPublic!==void 0)Q.isPublic=x.isPublic;return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}/publish`,{method:"POST",body:Q}))}catch(Q){return X1(Q)}});t0.registerTool("figura_list_figs",{title:"Figura: list figs",description:"List visualizations for the team, optionally filtered by area or tag.",inputSchema:{area:N7(),tag:C.string().optional(),limit:C.number().optional(),cursor:C.string().optional()}},async(x)=>{try{let Q=new URLSearchParams;if(x.area)Q.set("area",x.area);if(x.tag)Q.set("tag",x.tag);if(x.limit!==void 0)Q.set("limit",String(x.limit));if(x.cursor)Q.set("cursor",x.cursor);let W=Q.toString();return g0(await u0(`/v1/figs${W?`?${W}`:""}`))}catch(Q){return X1(Q)}});t0.registerTool("figura_get_fig",{title:"Figura: get fig",description:"Fetch a single visualization by id.",inputSchema:{id:C.string().describe("The fig — its id (`fig_…`), a UUID, a share link/URL, or its publicId.")}},async(x)=>{try{return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}`))}catch(Q){return X1(Q)}});t0.registerTool("figura_comment",{title:"Figura: comment",description:"Add a comment to a visualization.",inputSchema:{fig_id:C.string().describe("The fig to comment on — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),body:C.string().describe("Comment text.")}},async(x)=>{try{return g0(await u0(`/v1/figs/${encodeURIComponent(x.fig_id)}/comments`,{method:"POST",body:{body:x.body}}))}catch(Q){return X1(Q)}});t0.registerTool("figura_request_feedback",{title:"Figura: request feedback",description:"Ask a teammate to review a fig. Resolve `from` to a team member (by name or email); they get a notification (in-app, push, email) and the discussion happens in the fig's comment thread. Use this when the user says they want a specific person's feedback/eyes/review on a fig. Returns { ok, request: { to, status }, figUrl }.",inputSchema:{id:C.string().describe("The fig to request feedback on — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),from:C.string().describe("The teammate to ask, by name or email (resolved within the team)."),note:C.string().optional().describe("Optional message for them (e.g. what to look at).")}},async(x)=>{try{let Q={from:x.from};if(x.note!==void 0)Q.note=x.note;return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}/request-feedback`,{method:"POST",body:Q}))}catch(Q){return X1(Q)}});t0.registerTool("figura_list_sources",{title:"Figura: list sources",description:"List the company-brain source-spine connectors for the team, with event counts and last-synced times.",inputSchema:{}},async()=>{try{return g0(await u0("/v1/sources"))}catch(x){return X1(x)}});t0.registerTool("figura_sync_source",{title:"Figura: sync source",description:"Ingest new events from a connected source into the spine. Returns { ingested, fetched, nextCursor }.",inputSchema:{id:C.string().describe("The source id to sync (from figura_list_sources).")}},async(x)=>{try{return g0(await u0(`/v1/sources/${encodeURIComponent(x.id)}/sync`,{method:"POST"}))}catch(Q){return X1(Q)}});t0.registerTool("figura_update_fig",{title:"Figura: update fig",description:"Update a fig's METADATA only (title/description/area/tags/status). Set status='archived' to soft-delete. To change the fig's HTML, use figura_revise_fig — it saves a new version and never destroys the old one. update cannot touch the HTML.",inputSchema:{id:C.string().describe("The fig to update — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),title:C.string().optional(),description:C.string().optional(),area:N7(),tags:C.array(C.string()).optional().describe("Replaces the existing tags."),status:C.enum(["draft","published","archived"]).optional()}},async(x)=>{try{let Q={};if(x.title!==void 0)Q.title=x.title;if(x.description!==void 0)Q.description=x.description;if(x.area!==void 0)Q.area=x.area;if(x.tags!==void 0)Q.tags=x.tags;if(x.status!==void 0)Q.status=x.status;return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}`,{method:"PATCH",body:Q}))}catch(Q){return X1(Q)}});t0.registerTool("figura_delete_fig",{title:"Figura: delete fig",description:"Archive a fig (soft-delete; leaves the library, public link stops resolving) or permanently delete it with hard=true.",inputSchema:{id:C.string().describe("The fig to delete — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),hard:C.boolean().optional().describe("Permanently delete instead of archive.")}},async(x)=>{try{return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}${x.hard?"?hard=true":""}`,{method:"DELETE"}))}catch(Q){return X1(Q)}});await t0.connect(new CX);
|
|
68
|
+
`}class CX{constructor(x=Sq.stdin,Q=Sq.stdout){this._stdin=x,this._stdout=Q,this._readBuffer=new ZX,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{this.onerror?.(W)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let x=this._readBuffer.readMessage();if(x===null)break;this.onmessage?.(x)}catch(x){this.onerror?.(x)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(x){return new Promise((Q)=>{let W=Iq(x);if(this._stdout.write(W))Q();else this._stdout.once("drain",Q)})}}var bT="https://api.figura.so",$T="mcp",Eq=q7(Cq(),".figura","config.json"),zT=q7(".figura","config.json");async function Rq(x){try{let Q=JSON.parse(await X9.readFile(x,"utf8"));if(Q&&typeof Q==="object")return Q}catch{}return{}}async function vT(x=process.cwd()){let Q=Cq(),W=x;for(;;){if(W!==Q){let X=q7(W,zT);try{return await X9.access(X),X}catch{}}let Y=Tq(W);if(Y===W)return null;W=Y}}function wT(x=process.cwd()){let Q=x;for(;;){if(JT(q7(Q,".git")))return!0;let W=Tq(Q);if(W===Q)return!1;Q=W}}async function kq(){let x=await vT(),Q=x?await Rq(x):{},W=await Rq(Eq),Y={...W,...Q},X=process.env.FIGURA_TOKEN||Y.token||void 0,J=process.env.FIGURA_TOKEN?"env":Q.token?"project":W.token?"global":"none",G=(process.env.FIGURA_API_URL||Y.apiUrl||bT).replace(/\/+$/,"");return{token:X,apiUrl:G,team:Y.team,source:J,configPath:J==="project"?x:J==="global"?Eq:null}}async function u0(x,Q={}){let W=await kq(),Y=W.token;if(!Y)throw Error("No Figura token. Run `figura link` in this repo (or `figura login`, or set FIGURA_TOKEN).");if((Q.method??"GET").toUpperCase()!=="GET"&&W.source==="global"&&wT()&&process.env.FIGURA_ALLOW_GLOBAL!=="1")throw Error(`this project isn't linked to a Figura team — the global credential${W.team?` (team '${W.team}')`:""} would receive this write. Ask the user to run \`figura link\` in this repo (or set FIGURA_ALLOW_GLOBAL=1 to use the global team deliberately).`);let J=`${W.apiUrl}${x.startsWith("/")?"":"/"}${x}`,G={Accept:"application/json",Authorization:`Bearer ${Y}`,"X-Figura-Source":$T},b;if(Q.body!==void 0)G["Content-Type"]="application/json",b=JSON.stringify(Q.body);let $=await k9.request({url:J,method:Q.method??"GET",headers:G,data:b,validateStatus:()=>!0,transformRequest:[(w)=>w],transformResponse:[(w)=>w]}),z=typeof $.data==="string"?$.data:"",v=void 0;if(z)try{v=JSON.parse(z)}catch{v=z}if($.status<200||$.status>=300){let w=v&&typeof v==="object"&&v!==null&&"error"in v?String(v.error):typeof v==="string"&&v?v:$.statusText||`HTTP ${$.status}`;throw Error(`${w} (HTTP ${$.status})`)}return v}var Pq=2500,BT=600000,KT=60000,iq=(x)=>new Promise((Q)=>setTimeout(Q,x));async function HT(x){let Q=Date.now(),W=null;for(;;){let Y;try{Y=await u0(`/v1/jobs/${encodeURIComponent(x)}`),W=null}catch(X){if(W??=Date.now(),Date.now()-W>=KT){let J=X instanceof Error?X.message:String(X);throw Error(`Lost contact with the Figura API while waiting for job ${x} (${J}). `+`The job may still complete — resume by checking GET /v1/jobs/${x} instead of regenerating.`)}await iq(Pq);continue}if(Y.status==="done")return Y;if(Y.status==="error")throw Error(Y.error||"The generation job failed. Please retry.");if(Date.now()-Q>BT)throw Error(`Timed out waiting for job ${x} — it may still complete; `+`check GET /v1/jobs/${x} instead of regenerating.`);await iq(Pq)}}function g0(x){return{content:[{type:"text",text:JSON.stringify(x,null,2)}]}}function X1(x){return{content:[{type:"text",text:x instanceof Error?x.message:String(x)}],isError:!0}}var N7=()=>Z.string().optional().describe("Product area / surface the fig belongs to, e.g. 'dashboard', 'settings', 'onboarding'. Free text."),kX=["portrait","landscape","both"],_X=["single","compare","variations"],VT=(()=>{try{let x=JSON.parse(GT(new URL("../package.json",import.meta.url),"utf8"));return typeof x.version==="string"?x.version:"0.0.0"}catch{return"0.0.0"}})(),t0=new iX({name:"figura",version:VT});t0.registerTool("figura_whoami",{title:"Figura: whoami",description:"Return the identity (team, actor, scopes) for the configured Figura token, plus `binding` — which config tier supplied it (env | project | global). A `global` binding means this project is not linked to a team and writes will be refused; ask the user to run `figura link` in the repo.",inputSchema:{}},async()=>{try{let x=await u0("/v1/whoami"),{source:Q,configPath:W}=await kq();return g0({...x,binding:{source:Q,configPath:W}})}catch(x){return X1(x)}});t0.registerTool("figura_set_brand",{title:"Figura: set brand profile",description:'Set (upsert) the team brand profile that the fig generator renders against. Use this to "introduce a repo to Figura": scan the codebase for its design system, synthesize the brand, then push it here. `name` is required; `appDescription` is a one-clause product summary; `tokensBlock` is the freeform design-token reference (colors + hex + role, type scale + faces, spacing, the brand gradient, plus voice/conventions). This is a partial merge — fields you omit keep their saved value (pass an explicit empty string to clear one), so a name-only update will not wipe existing tokens. Editing the team brand — confirm with the user before calling.',inputSchema:{name:Z.string().describe("Brand / app name (required)."),appDescription:Z.string().optional().describe("One clause on what the product is + who it is for."),tokensBlock:Z.string().optional().describe("Freeform plain-text design-token reference: colors (hex + role), type scale + faces, spacing, the brand gradient, and voice/conventions. Injected verbatim into the fig-generation prompt.")}},async(x)=>{try{let Q={name:x.name};if(x.appDescription!==void 0)Q.appDescription=x.appDescription;if(x.tokensBlock!==void 0)Q.tokensBlock=x.tokensBlock;return g0(await u0("/brand",{method:"PUT",body:Q}))}catch(Q){return X1(Q)}});var qT={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",svg:"image/svg+xml"},TX=5242880;function Zq(x){let Q=x.split(/[?#]/)[0].split(".").pop()?.toLowerCase()??"";return qT[Q]}async function _q(x,Q){let W,Y=Q;if(/^https?:\/\//i.test(x)){let X=await k9.get(x,{responseType:"arraybuffer",maxContentLength:TX,timeout:30000});if(W=Buffer.from(X.data).toString("base64"),!Y){let J=String(X.headers["content-type"]??"").split(";")[0].trim().toLowerCase();Y=J.startsWith("image/")?J:Zq(x)}}else{let{size:X}=await X9.stat(x);if(X>TX)throw Error(`'${x}' is ${(X/1048576).toFixed(1)}MB — over the ${TX/1048576}MB asset limit.`);if(W=(await X9.readFile(x)).toString("base64"),!Y)Y=Zq(x)}if(!Y)throw Error(`Could not determine an image content-type for '${x}' — pass contentType (e.g. image/png).`);return{data:W,contentType:Y}}async function NT(x,Q){let{data:W,contentType:Y}=await _q(x,Q),X=await u0("/v1/assets",{method:"POST",body:{data:W,contentType:Y}});if(!X||typeof X.url!=="string")throw Error("Asset upload did not return a URL.");return X.url}var uq=()=>Z.array(Z.object({source:Z.string().describe("The image — a local file path or an http(s) URL (e.g. a screenshot)."),match:Z.string().optional().describe('Exact string in the HTML to replace with the hosted URL (defaults to `source` — i.e. write <img src="<source>"> in the HTML).')})).optional().describe("Images to attach: each is uploaded to durable figura hosting (stable non-expiring URL, allowed by the fig CSP) and substituted into the HTML in place of `match`/`source`. Use for real screenshots/photos/logos instead of base64 data-URIs (HTML size cap) or external URLs (expire/CSP-blocked).");async function lq(x,Q){if(!Q?.length)return{html:x,uploaded:[]};let W=x,Y=[];for(let X of Q){let J=X.match??X.source;if(!W.includes(J))throw Error(`images: '${J}' does not occur in the html — reference it (e.g. <img src="${J}">) so it can be swapped for the hosted URL, or set 'match'.`);let G=await NT(X.source);W=W.split(J).join(G),Y.push({source:X.source,url:G})}return{html:W,uploaded:Y}}function pq(x,Q){if(!Q.length)return x;if(x&&typeof x==="object"&&!Array.isArray(x))return{...x,assets:Q};return{result:x,assets:Q}}t0.registerTool("figura_create_fig",{title:"Figura: create fig",description:'Create a new visualization from an HTML document. Returns the created fig (id, slug); with publish:true it is published and the result includes a shareable public url. The response also carries `brandWarnings` — a deterministic (no-LLM) colors/fonts/radii/spacing diff against the team\'s brand tokens, WARN-only (never blocks the create). If it comes back non-empty, read it and consider a figura_revise_fig call that binds the missing tokens before telling the user you\'re done. To include REAL images (screenshots/photos/logos), pass them via `images` — they are uploaded to durable figura hosting and their stable URLs substituted into the HTML. TIP — injected components: if your HTML shows phone frames (a compare/multi-screen mock), wrap each state in <div class="fig-device portrait|landscape"><div class="fig-screen">…</div><div class="fig-di"></div><div class="fig-homebar"></div></div> and do NOT style those classes — Figura injects accurate iPhone frame CSS at save. Same for an iOS status bar (<div class="fig-statusbar" data-time="9:41"></div>), a compare control bar (.fig-controls/.fig-seg), and the .frame-web browser window.',inputSchema:{html:Z.string().describe("The full HTML document for the visualization."),images:uq(),title:Z.string().optional().describe("Title (otherwise derived from the HTML)."),description:Z.string().optional(),area:N7(),tags:Z.array(Z.string()).optional(),orientation:Z.enum(kX).optional(),mode:Z.enum(_X).optional(),model:Z.string().optional().describe("Model attribution."),device:Z.string().optional().describe("Catalog iPhone id the fig targets (e.g. 'iphone-16', 'iphone-17-pro', 'iphone-se-3') — keys the injected frame/safe-area geometry."),issue:Z.number().optional().describe("Linked issue number."),publish:Z.boolean().optional().describe("Publish to a shareable public URL on create (requires a paid plan)."),prompt:Z.string().optional().describe("OPTIONAL: the brief that produced this HTML, if there was one — you wrote the HTML yourself, so Figura never sees a prompt unless you pass it here. Stored on the fig (DB-only, never stamped into the HTML), and returned by figura_get_fig — lets teammates see 'why' this fig exists.")}},async(x)=>{try{let{html:Q,uploaded:W}=await lq(x.html,x.images),Y={html:Q};for(let X of["title","description","area","tags","orientation","mode","model","device","issue","publish","prompt"])if(x[X]!==void 0)Y[X]=x[X];return g0(pq(await u0("/v1/figs",{method:"POST",body:Y}),W))}catch(Q){return X1(Q)}});t0.registerTool("figura_upload_asset",{title:"Figura: upload asset",description:"Upload a durable image asset and get back a STABLE, figura-hosted URL that never expires — use it in a fig's <img src> instead of a base64 data-URI (bloats the HTML past the publish size) or an external URL that expires (Instagram/CDN signed links). The fig CSP allows figura-hosted images. Provide `path` (a local image file), `url` (an http(s) image to fetch and re-host), or `data` (base64 bytes) + `contentType`. Accepts png/jpeg/gif/webp/avif/svg, up to 5MB. Returns `{ url }`.",inputSchema:{path:Z.string().optional().describe("Local path to an image file to upload (content-type inferred from the extension)."),url:Z.string().optional().describe("http(s) URL of an image to fetch and re-host (alternative to `path`) — use for expiring/signed source URLs so the fig keeps rendering after they die."),data:Z.string().optional().describe("Base64-encoded image bytes (alternative to `path`/`url`). Requires `contentType`."),contentType:Z.string().optional().describe("MIME type, e.g. image/png. Required with `data`; inferred from the extension/response for `path`/`url`.")}},async(x)=>{try{let Q=x.path??x.url;if(Q){let{data:W,contentType:Y}=await _q(Q,x.contentType);return g0(await u0("/v1/assets",{method:"POST",body:{data:W,contentType:Y}}))}if(!x.data)throw Error("Provide `path` (a local image file), `url` (an http(s) image), or `data` (base64 bytes).");if(!x.contentType)throw Error("`contentType` is required with `data` — e.g. image/png.");return g0(await u0("/v1/assets",{method:"POST",body:{data:x.data,contentType:x.contentType}}))}catch(Q){return X1(Q)}});t0.registerTool("figura_generate_fig",{title:"Figura: generate fig",description:"Generate a new fig server-side from a natural-language brief, then persist it. The engine runs Figura's on-brand generation — you do NOT write the HTML; just describe the screen. SPENDS TEAM CREDITS: only use when the user explicitly opts for a server render; otherwise default to writing the HTML yourself and landing it with figura_create_fig (free, uses the calling model). Runs as an async server job; this call polls until the fig lands (typically 30–90s). Returns the created fig (id, slug); publish:true publishes it with a shareable url. Requires an active paid subscription.",inputSchema:{prompt:Z.string().describe("A natural-language brief describing the screen/UI to generate."),area:N7(),orientation:Z.enum(kX).optional(),mode:Z.enum(_X).optional(),platform:Z.enum(["mobile","web"]).optional().describe("Output platform: 'mobile' (iPhone, default) or 'web' (browser frame)."),device:Z.string().optional().describe("Catalog iPhone id to target (e.g. 'iphone-16', 'iphone-17-pro', 'iphone-se-3'). Mobile only; default iphone-16."),title:Z.string().optional().describe("Title (otherwise derived from the generated HTML)."),fidelity:Z.enum(["fast","high"]).optional().describe("Generation fidelity (default fast)."),publish:Z.boolean().optional().describe("Publish to a shareable public URL on create (requires a paid plan).")}},async(x)=>{try{let Q={prompt:x.prompt};for(let Y of["area","orientation","mode","platform","device","title","publish"])if(x[Y]!==void 0)Q[Y]=x[Y];if(x.fidelity!==void 0)Q.model=x.fidelity;Q.async=!0;let W=await u0("/v1/figs/generate",{method:"POST",body:Q});if(W&&typeof W==="object"&&typeof W.jobId==="string"){let Y=await HT(W.jobId),X=Y.result??{};return g0(X.fig??Y.result)}return g0(W)}catch(Q){return X1(Q)}});t0.registerTool("figura_revise_fig",{title:"Figura: revise fig",description:"Create a new revision (version) of an existing fig from updated HTML. Returns the new fig (id, slug, version); publish:true publishes it with a shareable url. The new version joins the original fig's chain — it does not replace it in place. Use list_revisions for the chain (rootFig + every version). The response also carries `brandWarnings` — a deterministic (no-LLM) colors/fonts/radii/spacing diff against the team's brand tokens, WARN-only. If it comes back non-empty, consider one more revision that binds the missing tokens. To include REAL images (screenshots/photos/logos), pass them via `images` — uploaded to durable figura hosting, stable URLs substituted into the HTML.",inputSchema:{id:Z.string().describe("The fig to revise — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),html:Z.string().describe("The full updated HTML document."),images:uq(),title:Z.string().optional().describe("Title (otherwise derived from the HTML)."),description:Z.string().optional(),area:Z.string().optional().describe("Product area / surface; free text. Inherited from the parent if omitted."),tags:Z.array(Z.string()).optional(),orientation:Z.enum(kX).optional().describe("Inherited from the parent if omitted."),mode:Z.enum(_X).optional(),model:Z.string().optional().describe("Model attribution."),issue:Z.number().optional().describe("Linked issue number."),publish:Z.boolean().optional().describe("Publish the new revision to a shareable public URL (requires a paid plan)."),prompt:Z.string().optional().describe("OPTIONAL: the brief/ask that produced this revision, if there was one. Stored on the fig (DB-only, never stamped into the HTML), and returned by figura_get_fig.")}},async(x)=>{try{let{html:Q,uploaded:W}=await lq(x.html,x.images),Y={html:Q};for(let X of["title","description","area","tags","orientation","mode","model","issue","publish","prompt"])if(x[X]!==void 0)Y[X]=x[X];return g0(pq(await u0(`/v1/figs/${encodeURIComponent(x.id)}/revise`,{method:"POST",body:Y}),W))}catch(Q){return X1(Q)}});t0.registerTool("figura_list_revisions",{title:"Figura: list revisions",description:"List the full revision chain for a fig (all versions sharing a root), oldest to newest.",inputSchema:{id:Z.string().describe("Any fig in the chain — its id (`fig_…`), a UUID, share link/URL, or publicId.")}},async(x)=>{try{return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}/revisions`))}catch(Q){return X1(Q)}});t0.registerTool("figura_publish_fig",{title:"Figura: publish fig",description:"Publish (or unpublish) an existing fig to its shareable public URL. Requires a paid plan. Returns { isPublic, url, publicId }.",inputSchema:{id:Z.string().describe("The fig to publish — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),isPublic:Z.boolean().optional().describe("Set false to unpublish (make private). Defaults to true (publish).")}},async(x)=>{try{let Q={};if(x.isPublic!==void 0)Q.isPublic=x.isPublic;return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}/publish`,{method:"POST",body:Q}))}catch(Q){return X1(Q)}});t0.registerTool("figura_list_figs",{title:"Figura: list figs",description:"List visualizations for the team, optionally filtered by area or tag.",inputSchema:{area:N7(),tag:Z.string().optional(),limit:Z.number().optional(),cursor:Z.string().optional()}},async(x)=>{try{let Q=new URLSearchParams;if(x.area)Q.set("area",x.area);if(x.tag)Q.set("tag",x.tag);if(x.limit!==void 0)Q.set("limit",String(x.limit));if(x.cursor)Q.set("cursor",x.cursor);let W=Q.toString();return g0(await u0(`/v1/figs${W?`?${W}`:""}`))}catch(Q){return X1(Q)}});t0.registerTool("figura_get_fig",{title:"Figura: get fig",description:"Fetch a single visualization by id.",inputSchema:{id:Z.string().describe("The fig — its id (`fig_…`), a UUID, a share link/URL, or its publicId.")}},async(x)=>{try{return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}`))}catch(Q){return X1(Q)}});t0.registerTool("figura_comment",{title:"Figura: comment",description:"Add a comment to a visualization.",inputSchema:{fig_id:Z.string().describe("The fig to comment on — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),body:Z.string().describe("Comment text.")}},async(x)=>{try{return g0(await u0(`/v1/figs/${encodeURIComponent(x.fig_id)}/comments`,{method:"POST",body:{body:x.body}}))}catch(Q){return X1(Q)}});t0.registerTool("figura_request_feedback",{title:"Figura: request feedback",description:"Ask a teammate to review a fig. Resolve `from` to a team member (by name or email); they get a notification (in-app, push, email) and the discussion happens in the fig's comment thread. Use this when the user says they want a specific person's feedback/eyes/review on a fig. Returns { ok, request: { to, status }, figUrl }.",inputSchema:{id:Z.string().describe("The fig to request feedback on — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),from:Z.string().describe("The teammate to ask, by name or email (resolved within the team)."),note:Z.string().optional().describe("Optional message for them (e.g. what to look at).")}},async(x)=>{try{let Q={from:x.from};if(x.note!==void 0)Q.note=x.note;return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}/request-feedback`,{method:"POST",body:Q}))}catch(Q){return X1(Q)}});t0.registerTool("figura_list_sources",{title:"Figura: list sources",description:"List the company-brain source-spine connectors for the team, with event counts and last-synced times.",inputSchema:{}},async()=>{try{return g0(await u0("/v1/sources"))}catch(x){return X1(x)}});t0.registerTool("figura_sync_source",{title:"Figura: sync source",description:"Ingest new events from a connected source into the spine. Returns { ingested, fetched, nextCursor }.",inputSchema:{id:Z.string().describe("The source id to sync (from figura_list_sources).")}},async(x)=>{try{return g0(await u0(`/v1/sources/${encodeURIComponent(x.id)}/sync`,{method:"POST"}))}catch(Q){return X1(Q)}});t0.registerTool("figura_update_fig",{title:"Figura: update fig",description:"Update a fig's METADATA only (title/description/area/tags/status). Set status='archived' to soft-delete. To change the fig's HTML, use figura_revise_fig — it saves a new version and never destroys the old one. update cannot touch the HTML.",inputSchema:{id:Z.string().describe("The fig to update — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),title:Z.string().optional(),description:Z.string().optional(),area:N7(),tags:Z.array(Z.string()).optional().describe("Replaces the existing tags."),status:Z.enum(["draft","published","archived"]).optional()}},async(x)=>{try{let Q={};if(x.title!==void 0)Q.title=x.title;if(x.description!==void 0)Q.description=x.description;if(x.area!==void 0)Q.area=x.area;if(x.tags!==void 0)Q.tags=x.tags;if(x.status!==void 0)Q.status=x.status;return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}`,{method:"PATCH",body:Q}))}catch(Q){return X1(Q)}});t0.registerTool("figura_delete_fig",{title:"Figura: delete fig",description:"Archive a fig (soft-delete; leaves the library, public link stops resolving) or permanently delete it with hard=true.",inputSchema:{id:Z.string().describe("The fig to delete — its id (`fig_…`), a UUID, a share link/URL, or its publicId."),hard:Z.boolean().optional().describe("Permanently delete instead of archive.")}},async(x)=>{try{return g0(await u0(`/v1/figs/${encodeURIComponent(x.id)}${x.hard?"?hard=true":""}`,{method:"DELETE"}))}catch(Q){return X1(Q)}});await t0.connect(new CX);
|
package/package.json
CHANGED
|
@@ -87,8 +87,14 @@ and confirm the target team (`figura whoami`). On approval:
|
|
|
87
87
|
### 4. Verify
|
|
88
88
|
|
|
89
89
|
`figura brand --json` (or the `figura_whoami` → `figura brand` read) → confirm
|
|
90
|
-
`isCustom: true` and that the saved tokens match.
|
|
91
|
-
|
|
90
|
+
`isCustom: true` and that the saved tokens match. The response also carries
|
|
91
|
+
`platformProfile` — the engine auto-detects mobile / web / both from the tokens
|
|
92
|
+
you just wrote (breakpoints, font stacks, safe-area/tab-bar tokens, hover
|
|
93
|
+
states — deterministic, no LLM) every time you save, so nothing extra to do
|
|
94
|
+
here. It only ever changes on its own until the team explicitly overrides it
|
|
95
|
+
on the brand page (Studio then defaults its device frame off that value —
|
|
96
|
+
iPhone for mobile, browser for web). Then tell the user the brand is set and
|
|
97
|
+
suggest trying `/fig <a screen>` to see it render on-brand.
|
|
92
98
|
|
|
93
99
|
## Output
|
|
94
100
|
|