@f2c/mcp 0.4.8 → 0.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,457 +1,48 @@
1
1
  #!/usr/bin/env node
2
- var C1=Object.create;var{getPrototypeOf:I1,defineProperty:C3,getOwnPropertyNames:T1}=Object;var x1=Object.prototype.hasOwnProperty;var y1=($,X,Q)=>{Q=$!=null?C1(I1($)):{};let Y=X||!$||!$.__esModule?C3(Q,"default",{value:$,enumerable:!0}):Q;for(let G of T1($))if(!x1.call(Y,G))C3(Y,G,{get:()=>$[G],enumerable:!0});return Y};var t6=($,X)=>()=>(X||$((X={exports:{}}).exports,X),X.exports);var h1=($,X)=>{for(var Q in X)C3($,Q,{get:X[Q],enumerable:!0,configurable:!0,set:(Y)=>X[Q]=()=>Y})};var g=($,X)=>()=>($&&(X=$($=0)),X);var L,I3,M,t=($)=>{switch(typeof $){case"undefined":return M.undefined;case"string":return M.string;case"number":return Number.isNaN($)?M.nan:M.number;case"boolean":return M.boolean;case"function":return M.function;case"bigint":return M.bigint;case"symbol":return M.symbol;case"object":if(Array.isArray($))return M.array;if($===null)return M.null;if($.then&&typeof $.then==="function"&&$.catch&&typeof $.catch==="function")return M.promise;if(typeof Map!=="undefined"&&$ instanceof Map)return M.map;if(typeof Set!=="undefined"&&$ instanceof Set)return M.set;if(typeof Date!=="undefined"&&$ instanceof Date)return M.date;return M.object;default:return M.unknown}};var I$=g(()=>{(function($){$.assertEqual=(G)=>{};function X(G){}$.assertIs=X;function Q(G){throw new Error}$.assertNever=Q,$.arrayToEnum=(G)=>{let W={};for(let H of G)W[H]=H;return W},$.getValidEnumValues=(G)=>{let W=$.objectKeys(G).filter((B)=>typeof G[G[B]]!=="number"),H={};for(let B of W)H[B]=G[B];return $.objectValues(H)},$.objectValues=(G)=>{return $.objectKeys(G).map(function(W){return G[W]})},$.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let W=[];for(let H in G)if(Object.prototype.hasOwnProperty.call(G,H))W.push(H);return W},$.find=(G,W)=>{for(let H of G)if(W(H))return H;return},$.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function Y(G,W=" | "){return G.map((H)=>typeof H==="string"?`'${H}'`:H).join(W)}$.joinValues=Y,$.jsonStringifyReplacer=(G,W)=>{if(typeof W==="bigint")return W.toString();return W}})(L||(L={}));(function($){$.mergeShapes=(X,Q)=>{return{...X,...Q}}})(I3||(I3={}));M=L.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var w,Z1=($)=>{return JSON.stringify($,null,2).replace(/"([^"]+)":/g,"$1:")},h;var r$=g(()=>{I$();w=L.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"]);h=class h extends Error{get errors(){return this.issues}constructor($){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let X=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,X);else this.__proto__=X;this.name="ZodError",this.issues=$}format($){let X=$||function(G){return G.message},Q={_errors:[]},Y=(G)=>{for(let W of G.issues)if(W.code==="invalid_union")W.unionErrors.map(Y);else if(W.code==="invalid_return_type")Y(W.returnTypeError);else if(W.code==="invalid_arguments")Y(W.argumentsError);else if(W.path.length===0)Q._errors.push(X(W));else{let H=Q,B=0;while(B<W.path.length){let D=W.path[B];if(B!==W.path.length-1)H[D]=H[D]||{_errors:[]};else H[D]=H[D]||{_errors:[]},H[D]._errors.push(X(W));H=H[D],B++}}};return Y(this),Q}static assert($){if(!($ instanceof h))throw new Error(`Not a ZodError: ${$}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,L.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten($=(X)=>X.message){let X={},Q=[];for(let Y of this.issues)if(Y.path.length>0){let G=Y.path[0];X[G]=X[G]||[],X[G].push($(Y))}else Q.push($(Y));return{formErrors:Q,fieldErrors:X}}get formErrors(){return this.flatten()}};h.create=($)=>{return new h($)}});var g1=($,X)=>{let Q;switch($.code){case w.invalid_type:if($.received===M.undefined)Q="Required";else Q=`Expected ${$.expected}, received ${$.received}`;break;case w.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify($.expected,L.jsonStringifyReplacer)}`;break;case w.unrecognized_keys:Q=`Unrecognized key(s) in object: ${L.joinValues($.keys,", ")}`;break;case w.invalid_union:Q="Invalid input";break;case w.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${L.joinValues($.options)}`;break;case w.invalid_enum_value:Q=`Invalid enum value. Expected ${L.joinValues($.options)}, received '${$.received}'`;break;case w.invalid_arguments:Q="Invalid function arguments";break;case w.invalid_return_type:Q="Invalid function return type";break;case w.invalid_date:Q="Invalid date";break;case w.invalid_string:if(typeof $.validation==="object")if("includes"in $.validation){if(Q=`Invalid input: must include "${$.validation.includes}"`,typeof $.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${$.validation.position}`}else if("startsWith"in $.validation)Q=`Invalid input: must start with "${$.validation.startsWith}"`;else if("endsWith"in $.validation)Q=`Invalid input: must end with "${$.validation.endsWith}"`;else L.assertNever($.validation);else if($.validation!=="regex")Q=`Invalid ${$.validation}`;else Q="Invalid";break;case w.too_small:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at least":"more than"} ${$.minimum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at least":"over"} ${$.minimum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="bigint")Q=`Number must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${$.minimum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly equal to ":$.inclusive?"greater than or equal to ":"greater than "}${new Date(Number($.minimum))}`;else Q="Invalid input";break;case w.too_big:if($.type==="array")Q=`Array must contain ${$.exact?"exactly":$.inclusive?"at most":"less than"} ${$.maximum} element(s)`;else if($.type==="string")Q=`String must contain ${$.exact?"exactly":$.inclusive?"at most":"under"} ${$.maximum} character(s)`;else if($.type==="number")Q=`Number must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="bigint")Q=`BigInt must be ${$.exact?"exactly":$.inclusive?"less than or equal to":"less than"} ${$.maximum}`;else if($.type==="date")Q=`Date must be ${$.exact?"exactly":$.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number($.maximum))}`;else Q="Invalid input";break;case w.custom:Q="Invalid input";break;case w.invalid_intersection_types:Q="Intersection results could not be merged";break;case w.not_multiple_of:Q=`Number must be a multiple of ${$.multipleOf}`;break;case w.not_finite:Q="Number must be finite";break;default:Q=X.defaultError,L.assertNever($)}return{message:Q}},Q$;var T3=g(()=>{r$();I$();Q$=g1});function l1($){J0=$}function b$(){return J0}var J0;var t$=g(()=>{T3();J0=Q$});function N($,X){let Q=b$(),Y=T$({issueData:X,data:$.data,path:$.path,errorMaps:[$.common.contextualErrorMap,$.schemaErrorMap,Q,Q===Q$?void 0:Q$].filter((G)=>!!G)});$.common.issues.push(Y)}class f{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray($,X){let Q=[];for(let Y of X){if(Y.status==="aborted")return A;if(Y.status==="dirty")$.dirty();Q.push(Y.value)}return{status:$.value,value:Q}}static async mergeObjectAsync($,X){let Q=[];for(let Y of X){let G=await Y.key,W=await Y.value;Q.push({key:G,value:W})}return f.mergeObjectSync($,Q)}static mergeObjectSync($,X){let Q={};for(let Y of X){let{key:G,value:W}=Y;if(G.status==="aborted")return A;if(W.status==="aborted")return A;if(G.status==="dirty")$.dirty();if(W.status==="dirty")$.dirty();if(G.value!=="__proto__"&&(typeof W.value!=="undefined"||Y.alwaysSet))Q[G.value]=W.value}return{status:$.value,value:Q}}}var T$=($)=>{let{data:X,path:Q,errorMaps:Y,issueData:G}=$,W=[...Q,...G.path||[]],H={...G,path:W};if(G.message!==void 0)return{...G,path:W,message:G.message};let B="",D=Y.filter((V)=>!!V).slice().reverse();for(let V of D)B=V(H,{data:X,defaultError:B}).message;return{...G,path:W,message:B}},m1,A,V$=($)=>({status:"dirty",value:$}),C=($)=>({status:"valid",value:$}),s$=($)=>$.status==="aborted",e$=($)=>$.status==="dirty",W$=($)=>$.status==="valid",U$=($)=>typeof Promise!=="undefined"&&$ instanceof Promise;var x3=g(()=>{t$();T3();m1=[];A=Object.freeze({status:"aborted"})});var W0=()=>{};var O;var H0=g(()=>{(function($){$.errToObj=(X)=>typeof X==="string"?{message:X}:X||{},$.toString=(X)=>typeof X==="string"?X:X?.message})(O||(O={}))});class n{constructor($,X,Q,Y){this._cachedPath=[],this.parent=$,this.data=X,this._path=Q,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}}function U($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:Y,description:G}=$;if(X&&(Q||Y))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:G};return{errorMap:(H,B)=>{let{message:D}=$;if(H.code==="invalid_enum_value")return{message:D??B.defaultError};if(typeof B.data==="undefined")return{message:D??Y??B.defaultError};if(H.code!=="invalid_type")return{message:B.defaultError};return{message:D??Q??B.defaultError}},description:G}}class q{get description(){return this._def.description}_getType($){return t($.data)}_getOrReturnCtx($,X){return X||{common:$.parent.common,data:$.data,parsedType:t($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}_processInputParams($){return{status:new f,ctx:{common:$.parent.common,data:$.data,parsedType:t($.data),schemaErrorMap:this._def.errorMap,path:$.path,parent:$.parent}}}_parseSync($){let X=this._parse($);if(U$(X))throw new Error("Synchronous parse encountered promise.");return X}_parseAsync($){let X=this._parse($);return Promise.resolve(X)}parse($,X){let Q=this.safeParse($,X);if(Q.success)return Q.data;throw Q.error}safeParse($,X){let Q={common:{issues:[],async:X?.async??!1,contextualErrorMap:X?.errorMap},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)},Y=this._parseSync({data:$,path:Q.path,parent:Q});return B0(Q,Y)}"~validate"($){let X={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)};if(!this["~standard"].async)try{let Q=this._parseSync({data:$,path:[],parent:X});return W$(Q)?{value:Q.value}:{issues:X.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;X.common={issues:[],async:!0}}return this._parseAsync({data:$,path:[],parent:X}).then((Q)=>W$(Q)?{value:Q.value}:{issues:X.common.issues})}async parseAsync($,X){let Q=await this.safeParseAsync($,X);if(Q.success)return Q.data;throw Q.error}async safeParseAsync($,X){let Q={common:{issues:[],contextualErrorMap:X?.errorMap,async:!0},path:X?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:$,parsedType:t($)},Y=this._parse({data:$,path:Q.path,parent:Q}),G=await(U$(Y)?Y:Promise.resolve(Y));return B0(Q,G)}refine($,X){let Q=(Y)=>{if(typeof X==="string"||typeof X==="undefined")return{message:X};else if(typeof X==="function")return X(Y);else return X};return this._refinement((Y,G)=>{let W=$(Y),H=()=>G.addIssue({code:w.custom,...Q(Y)});if(typeof Promise!=="undefined"&&W instanceof Promise)return W.then((B)=>{if(!B)return H(),!1;else return!0});if(!W)return H(),!1;else return!0})}refinement($,X){return this._refinement((Q,Y)=>{if(!$(Q))return Y.addIssue(typeof X==="function"?X(Q,Y):X),!1;else return!0})}_refinement($){return new p({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:$}})}superRefine($){return this._refinement($)}constructor($){this.spa=this.safeParseAsync,this._def=$,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(X)=>this["~validate"](X)}}optional(){return c.create(this,this._def)}nullable(){return G$.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return u.create(this)}promise(){return A$.create(this,this._def)}or($){return F$.create([this,$],this._def)}and($){return z$.create(this,$,this._def)}transform($){return new p({...U(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:$}})}default($){let X=typeof $==="function"?$:()=>$;return new f$({...U(this._def),innerType:this,defaultValue:X,typeName:_.ZodDefault})}brand(){return new X3({typeName:_.ZodBranded,type:this,...U(this._def)})}catch($){let X=typeof $==="function"?$:()=>$;return new P$({...U(this._def),innerType:this,catchValue:X,typeName:_.ZodCatch})}describe($){return new this.constructor({...this._def,description:$})}pipe($){return l$.create(this,$)}readonly(){return C$.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function _0($){let X="[0-5]\\d";if($.precision)X=`${X}\\.\\d{${$.precision}}`;else if($.precision==null)X=`${X}(\\.\\d+)?`;let Q=$.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${X})${Q}`}function G2($){return new RegExp(`^${_0($)}$`)}function M0($){let X=`${w0}T${_0($)}`,Q=[];if(Q.push($.local?"Z?":"Z"),$.offset)Q.push("([+-]\\d{2}:?\\d{2})");return X=`${X}(${Q.join("|")})`,new RegExp(`^${X}$`)}function J2($,X){if((X==="v4"||!X)&&t1.test($))return!0;if((X==="v6"||!X)&&e1.test($))return!0;return!1}function W2($,X){if(!d1.test($))return!1;try{let[Q]=$.split(".");if(!Q)return!1;let Y=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),G=JSON.parse(atob(Y));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(X&&G.alg!==X)return!1;return!0}catch{return!1}}function H2($,X){if((X==="v4"||!X)&&s1.test($))return!0;if((X==="v6"||!X)&&$2.test($))return!0;return!1}function B2($,X){let Q=($.toString().split(".")[1]||"").length,Y=(X.toString().split(".")[1]||"").length,G=Q>Y?Q:Y,W=Number.parseInt($.toFixed(G).replace(".","")),H=Number.parseInt(X.toFixed(G).replace(".",""));return W%H/10**G}function q$($){if($ instanceof F){let X={};for(let Q in $.shape){let Y=$.shape[Q];X[Q]=c.create(q$(Y))}return new F({...$._def,shape:()=>X})}else if($ instanceof u)return new u({...$._def,type:q$($.element)});else if($ instanceof c)return c.create(q$($.unwrap()));else if($ instanceof G$)return G$.create(q$($.unwrap()));else if($ instanceof e)return e.create($.items.map((X)=>q$(X)));else return $}function h3($,X){let Q=t($),Y=t(X);if($===X)return{valid:!0,data:$};else if(Q===M.object&&Y===M.object){let G=L.objectKeys(X),W=L.objectKeys($).filter((B)=>G.indexOf(B)!==-1),H={...$,...X};for(let B of W){let D=h3($[B],X[B]);if(!D.valid)return{valid:!1};H[B]=D.data}return{valid:!0,data:H}}else if(Q===M.array&&Y===M.array){if($.length!==X.length)return{valid:!1};let G=[];for(let W=0;W<$.length;W++){let H=$[W],B=X[W],D=h3(H,B);if(!D.valid)return{valid:!1};G.push(D.data)}return{valid:!0,data:G}}else if(Q===M.date&&Y===M.date&&+$===+X)return{valid:!0,data:$};else return{valid:!1}}function V0($,X){return new w$({values:$,typeName:_.ZodEnum,...U(X)})}function D0($,X){let Q=typeof $==="function"?$(X):typeof $==="string"?{message:$}:$;return typeof Q==="string"?{message:Q}:Q}function N0($,X={},Q){if($)return O$.create().superRefine((Y,G)=>{let W=$(Y);if(W instanceof Promise)return W.then((H)=>{if(!H){let B=D0(X,Y),D=B.fatal??Q??!0;G.addIssue({code:"custom",...B,fatal:D})}});if(!W){let H=D0(X,Y),B=H.fatal??Q??!0;G.addIssue({code:"custom",...H,fatal:B})}return});return O$.create()}var B0=($,X)=>{if(W$(X))return{success:!0,data:X.value};else{if(!$.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new h($.common.issues);return this._error=Q,this._error}}}},u1,c1,n1,p1,i1,d1,o1,a1,r1="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",y3,t1,s1,e1,$2,X2,Q2,w0="((\\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])))",Y2,m,B$,D$,L$,N$,x$,E$,S$,O$,H$,s,y$,u,F,F$,Y$=($)=>{if($ instanceof R$)return Y$($.schema);else if($ instanceof p)return Y$($.innerType());else if($ instanceof v$)return[$.value];else if($ instanceof w$)return $.options;else if($ instanceof k$)return L.objectValues($.enum);else if($ instanceof f$)return Y$($._def.innerType);else if($ instanceof E$)return[void 0];else if($ instanceof S$)return[null];else if($ instanceof c)return[void 0,...Y$($.unwrap())];else if($ instanceof G$)return[null,...Y$($.unwrap())];else if($ instanceof X3)return Y$($.unwrap());else if($ instanceof C$)return Y$($.unwrap());else if($ instanceof P$)return Y$($._def.innerType);else return[]},$3,z$,e,h$,Z$,j$,K$,R$,v$,w$,k$,A$,p,c,G$,f$,P$,g$,D2,X3,l$,C$,w2,_,_2=($,X={message:`Input not instance of ${$.name}`})=>N0((Q)=>Q instanceof $,X),O0,j0,M2,V2,A0,N2,O2,j2,A2,b2,U2,q2,K2,L2,E2,S2,F2,z2,R2,v2,k2,f2,P2,C2,I2,T2,x2,y2,h2,Z2,g2,l2,m2,u2,c2=()=>O0().optional(),n2=()=>j0().optional(),p2=()=>A0().optional(),i2,d2;var b0=g(()=>{r$();t$();H0();x3();I$();u1=/^c[^\s-]{8,}$/i,c1=/^[0-9a-z]+$/,n1=/^[0-9A-HJKMNP-TV-Z]{26}$/i,p1=/^[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,i1=/^[a-z0-9_-]{21}$/i,d1=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,o1=/^[-+]?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)?)??$/,a1=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,t1=/^(?:(?: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])$/,s1=/^(?:(?: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])$/,e1=/^(([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]))$/,$2=/^(([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])$/,X2=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Q2=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Y2=new RegExp(`^${w0}$`);m=class m extends q{_parse($){if(this._def.coerce)$.data=String($.data);if(this._getType($)!==M.string){let G=this._getOrReturnCtx($);return N(G,{code:w.invalid_type,expected:M.string,received:G.parsedType}),A}let Q=new f,Y=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.length<G.value)Y=this._getOrReturnCtx($,Y),N(Y,{code:w.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="max"){if($.data.length>G.value)Y=this._getOrReturnCtx($,Y),N(Y,{code:w.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="length"){let W=$.data.length>G.value,H=$.data.length<G.value;if(W||H){if(Y=this._getOrReturnCtx($,Y),W)N(Y,{code:w.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(H)N(Y,{code:w.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Q.dirty()}}else if(G.kind==="email"){if(!a1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"email",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="emoji"){if(!y3)y3=new RegExp(r1,"u");if(!y3.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"emoji",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="uuid"){if(!p1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"uuid",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="nanoid"){if(!i1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"nanoid",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid"){if(!u1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"cuid",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid2"){if(!c1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"cuid2",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ulid"){if(!n1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"ulid",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="url")try{new URL($.data)}catch{Y=this._getOrReturnCtx($,Y),N(Y,{validation:"url",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"regex",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="trim")$.data=$.data.trim();else if(G.kind==="includes"){if(!$.data.includes(G.value,G.position))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),Q.dirty()}else if(G.kind==="toLowerCase")$.data=$.data.toLowerCase();else if(G.kind==="toUpperCase")$.data=$.data.toUpperCase();else if(G.kind==="startsWith"){if(!$.data.startsWith(G.value))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:{startsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="endsWith"){if(!$.data.endsWith(G.value))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:{endsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="datetime"){if(!M0(G).test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:"datetime",message:G.message}),Q.dirty()}else if(G.kind==="date"){if(!Y2.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:"date",message:G.message}),Q.dirty()}else if(G.kind==="time"){if(!G2(G).test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{code:w.invalid_string,validation:"time",message:G.message}),Q.dirty()}else if(G.kind==="duration"){if(!o1.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"duration",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ip"){if(!J2($.data,G.version))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"ip",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="jwt"){if(!W2($.data,G.alg))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"jwt",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cidr"){if(!H2($.data,G.version))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"cidr",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64"){if(!X2.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"base64",code:w.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64url"){if(!Q2.test($.data))Y=this._getOrReturnCtx($,Y),N(Y,{validation:"base64url",code:w.invalid_string,message:G.message}),Q.dirty()}else L.assertNever(G);return{status:Q.value,value:$.data}}_regex($,X,Q){return this.refinement((Y)=>$.test(Y),{validation:X,code:w.invalid_string,...O.errToObj(Q)})}_addCheck($){return new m({...this._def,checks:[...this._def.checks,$]})}email($){return this._addCheck({kind:"email",...O.errToObj($)})}url($){return this._addCheck({kind:"url",...O.errToObj($)})}emoji($){return this._addCheck({kind:"emoji",...O.errToObj($)})}uuid($){return this._addCheck({kind:"uuid",...O.errToObj($)})}nanoid($){return this._addCheck({kind:"nanoid",...O.errToObj($)})}cuid($){return this._addCheck({kind:"cuid",...O.errToObj($)})}cuid2($){return this._addCheck({kind:"cuid2",...O.errToObj($)})}ulid($){return this._addCheck({kind:"ulid",...O.errToObj($)})}base64($){return this._addCheck({kind:"base64",...O.errToObj($)})}base64url($){return this._addCheck({kind:"base64url",...O.errToObj($)})}jwt($){return this._addCheck({kind:"jwt",...O.errToObj($)})}ip($){return this._addCheck({kind:"ip",...O.errToObj($)})}cidr($){return this._addCheck({kind:"cidr",...O.errToObj($)})}datetime($){if(typeof $==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:$});return this._addCheck({kind:"datetime",precision:typeof $?.precision==="undefined"?null:$?.precision,offset:$?.offset??!1,local:$?.local??!1,...O.errToObj($?.message)})}date($){return this._addCheck({kind:"date",message:$})}time($){if(typeof $==="string")return this._addCheck({kind:"time",precision:null,message:$});return this._addCheck({kind:"time",precision:typeof $?.precision==="undefined"?null:$?.precision,...O.errToObj($?.message)})}duration($){return this._addCheck({kind:"duration",...O.errToObj($)})}regex($,X){return this._addCheck({kind:"regex",regex:$,...O.errToObj(X)})}includes($,X){return this._addCheck({kind:"includes",value:$,position:X?.position,...O.errToObj(X?.message)})}startsWith($,X){return this._addCheck({kind:"startsWith",value:$,...O.errToObj(X)})}endsWith($,X){return this._addCheck({kind:"endsWith",value:$,...O.errToObj(X)})}min($,X){return this._addCheck({kind:"min",value:$,...O.errToObj(X)})}max($,X){return this._addCheck({kind:"max",value:$,...O.errToObj(X)})}length($,X){return this._addCheck({kind:"length",value:$,...O.errToObj(X)})}nonempty($){return this.min(1,O.errToObj($))}trim(){return new m({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new m({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new m({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(($)=>$.kind==="datetime")}get isDate(){return!!this._def.checks.find(($)=>$.kind==="date")}get isTime(){return!!this._def.checks.find(($)=>$.kind==="time")}get isDuration(){return!!this._def.checks.find(($)=>$.kind==="duration")}get isEmail(){return!!this._def.checks.find(($)=>$.kind==="email")}get isURL(){return!!this._def.checks.find(($)=>$.kind==="url")}get isEmoji(){return!!this._def.checks.find(($)=>$.kind==="emoji")}get isUUID(){return!!this._def.checks.find(($)=>$.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(($)=>$.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(($)=>$.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(($)=>$.kind==="cuid2")}get isULID(){return!!this._def.checks.find(($)=>$.kind==="ulid")}get isIP(){return!!this._def.checks.find(($)=>$.kind==="ip")}get isCIDR(){return!!this._def.checks.find(($)=>$.kind==="cidr")}get isBase64(){return!!this._def.checks.find(($)=>$.kind==="base64")}get isBase64url(){return!!this._def.checks.find(($)=>$.kind==="base64url")}get minLength(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxLength(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}};m.create=($)=>{return new m({checks:[],typeName:_.ZodString,coerce:$?.coerce??!1,...U($)})};B$=class B$ extends q{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse($){if(this._def.coerce)$.data=Number($.data);if(this._getType($)!==M.number){let G=this._getOrReturnCtx($);return N(G,{code:w.invalid_type,expected:M.number,received:G.parsedType}),A}let Q=void 0,Y=new f;for(let G of this._def.checks)if(G.kind==="int"){if(!L.isInteger($.data))Q=this._getOrReturnCtx($,Q),N(Q,{code:w.invalid_type,expected:"integer",received:"float",message:G.message}),Y.dirty()}else if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),Y.dirty()}else if(G.kind==="multipleOf"){if(B2($.data,G.value)!==0)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.not_multiple_of,multipleOf:G.value,message:G.message}),Y.dirty()}else if(G.kind==="finite"){if(!Number.isFinite($.data))Q=this._getOrReturnCtx($,Q),N(Q,{code:w.not_finite,message:G.message}),Y.dirty()}else L.assertNever(G);return{status:Y.value,value:$.data}}gte($,X){return this.setLimit("min",$,!0,O.toString(X))}gt($,X){return this.setLimit("min",$,!1,O.toString(X))}lte($,X){return this.setLimit("max",$,!0,O.toString(X))}lt($,X){return this.setLimit("max",$,!1,O.toString(X))}setLimit($,X,Q,Y){return new B$({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:O.toString(Y)}]})}_addCheck($){return new B$({...this._def,checks:[...this._def.checks,$]})}int($){return this._addCheck({kind:"int",message:O.toString($)})}positive($){return this._addCheck({kind:"min",value:0,inclusive:!1,message:O.toString($)})}negative($){return this._addCheck({kind:"max",value:0,inclusive:!1,message:O.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:0,inclusive:!0,message:O.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:0,inclusive:!0,message:O.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:O.toString(X)})}finite($){return this._addCheck({kind:"finite",message:O.toString($)})}safe($){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:O.toString($)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:O.toString($)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}get isInt(){return!!this._def.checks.find(($)=>$.kind==="int"||$.kind==="multipleOf"&&L.isInteger($.value))}get isFinite(){let $=null,X=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(X===null||Q.value>X)X=Q.value}else if(Q.kind==="max"){if($===null||Q.value<$)$=Q.value}return Number.isFinite(X)&&Number.isFinite($)}};B$.create=($)=>{return new B$({checks:[],typeName:_.ZodNumber,coerce:$?.coerce||!1,...U($)})};D$=class D$ extends q{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse($){if(this._def.coerce)try{$.data=BigInt($.data)}catch{return this._getInvalidInput($)}if(this._getType($)!==M.bigint)return this._getInvalidInput($);let Q=void 0,Y=new f;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?$.data<G.value:$.data<=G.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),Y.dirty()}else if(G.kind==="max"){if(G.inclusive?$.data>G.value:$.data>=G.value)Q=this._getOrReturnCtx($,Q),N(Q,{code:w.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),Y.dirty()}else if(G.kind==="multipleOf"){if($.data%G.value!==BigInt(0))Q=this._getOrReturnCtx($,Q),N(Q,{code:w.not_multiple_of,multipleOf:G.value,message:G.message}),Y.dirty()}else L.assertNever(G);return{status:Y.value,value:$.data}}_getInvalidInput($){let X=this._getOrReturnCtx($);return N(X,{code:w.invalid_type,expected:M.bigint,received:X.parsedType}),A}gte($,X){return this.setLimit("min",$,!0,O.toString(X))}gt($,X){return this.setLimit("min",$,!1,O.toString(X))}lte($,X){return this.setLimit("max",$,!0,O.toString(X))}lt($,X){return this.setLimit("max",$,!1,O.toString(X))}setLimit($,X,Q,Y){return new D$({...this._def,checks:[...this._def.checks,{kind:$,value:X,inclusive:Q,message:O.toString(Y)}]})}_addCheck($){return new D$({...this._def,checks:[...this._def.checks,$]})}positive($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:O.toString($)})}negative($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:O.toString($)})}nonpositive($){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:O.toString($)})}nonnegative($){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:O.toString($)})}multipleOf($,X){return this._addCheck({kind:"multipleOf",value:$,message:O.toString(X)})}get minValue(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $}get maxValue(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $}};D$.create=($)=>{return new D$({checks:[],typeName:_.ZodBigInt,coerce:$?.coerce??!1,...U($)})};L$=class L$ extends q{_parse($){if(this._def.coerce)$.data=Boolean($.data);if(this._getType($)!==M.boolean){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.boolean,received:Q.parsedType}),A}return C($.data)}};L$.create=($)=>{return new L$({typeName:_.ZodBoolean,coerce:$?.coerce||!1,...U($)})};N$=class N$ extends q{_parse($){if(this._def.coerce)$.data=new Date($.data);if(this._getType($)!==M.date){let G=this._getOrReturnCtx($);return N(G,{code:w.invalid_type,expected:M.date,received:G.parsedType}),A}if(Number.isNaN($.data.getTime())){let G=this._getOrReturnCtx($);return N(G,{code:w.invalid_date}),A}let Q=new f,Y=void 0;for(let G of this._def.checks)if(G.kind==="min"){if($.data.getTime()<G.value)Y=this._getOrReturnCtx($,Y),N(Y,{code:w.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),Q.dirty()}else if(G.kind==="max"){if($.data.getTime()>G.value)Y=this._getOrReturnCtx($,Y),N(Y,{code:w.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Q.dirty()}else L.assertNever(G);return{status:Q.value,value:new Date($.data.getTime())}}_addCheck($){return new N$({...this._def,checks:[...this._def.checks,$]})}min($,X){return this._addCheck({kind:"min",value:$.getTime(),message:O.toString(X)})}max($,X){return this._addCheck({kind:"max",value:$.getTime(),message:O.toString(X)})}get minDate(){let $=null;for(let X of this._def.checks)if(X.kind==="min"){if($===null||X.value>$)$=X.value}return $!=null?new Date($):null}get maxDate(){let $=null;for(let X of this._def.checks)if(X.kind==="max"){if($===null||X.value<$)$=X.value}return $!=null?new Date($):null}};N$.create=($)=>{return new N$({checks:[],coerce:$?.coerce||!1,typeName:_.ZodDate,...U($)})};x$=class x$ extends q{_parse($){if(this._getType($)!==M.symbol){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.symbol,received:Q.parsedType}),A}return C($.data)}};x$.create=($)=>{return new x$({typeName:_.ZodSymbol,...U($)})};E$=class E$ extends q{_parse($){if(this._getType($)!==M.undefined){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.undefined,received:Q.parsedType}),A}return C($.data)}};E$.create=($)=>{return new E$({typeName:_.ZodUndefined,...U($)})};S$=class S$ extends q{_parse($){if(this._getType($)!==M.null){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.null,received:Q.parsedType}),A}return C($.data)}};S$.create=($)=>{return new S$({typeName:_.ZodNull,...U($)})};O$=class O$ extends q{constructor(){super(...arguments);this._any=!0}_parse($){return C($.data)}};O$.create=($)=>{return new O$({typeName:_.ZodAny,...U($)})};H$=class H$ extends q{constructor(){super(...arguments);this._unknown=!0}_parse($){return C($.data)}};H$.create=($)=>{return new H$({typeName:_.ZodUnknown,...U($)})};s=class s extends q{_parse($){let X=this._getOrReturnCtx($);return N(X,{code:w.invalid_type,expected:M.never,received:X.parsedType}),A}};s.create=($)=>{return new s({typeName:_.ZodNever,...U($)})};y$=class y$ extends q{_parse($){if(this._getType($)!==M.undefined){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.void,received:Q.parsedType}),A}return C($.data)}};y$.create=($)=>{return new y$({typeName:_.ZodVoid,...U($)})};u=class u extends q{_parse($){let{ctx:X,status:Q}=this._processInputParams($),Y=this._def;if(X.parsedType!==M.array)return N(X,{code:w.invalid_type,expected:M.array,received:X.parsedType}),A;if(Y.exactLength!==null){let W=X.data.length>Y.exactLength.value,H=X.data.length<Y.exactLength.value;if(W||H)N(X,{code:W?w.too_big:w.too_small,minimum:H?Y.exactLength.value:void 0,maximum:W?Y.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:Y.exactLength.message}),Q.dirty()}if(Y.minLength!==null){if(X.data.length<Y.minLength.value)N(X,{code:w.too_small,minimum:Y.minLength.value,type:"array",inclusive:!0,exact:!1,message:Y.minLength.message}),Q.dirty()}if(Y.maxLength!==null){if(X.data.length>Y.maxLength.value)N(X,{code:w.too_big,maximum:Y.maxLength.value,type:"array",inclusive:!0,exact:!1,message:Y.maxLength.message}),Q.dirty()}if(X.common.async)return Promise.all([...X.data].map((W,H)=>{return Y.type._parseAsync(new n(X,W,X.path,H))})).then((W)=>{return f.mergeArray(Q,W)});let G=[...X.data].map((W,H)=>{return Y.type._parseSync(new n(X,W,X.path,H))});return f.mergeArray(Q,G)}get element(){return this._def.type}min($,X){return new u({...this._def,minLength:{value:$,message:O.toString(X)}})}max($,X){return new u({...this._def,maxLength:{value:$,message:O.toString(X)}})}length($,X){return new u({...this._def,exactLength:{value:$,message:O.toString(X)}})}nonempty($){return this.min(1,$)}};u.create=($,X)=>{return new u({type:$,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...U(X)})};F=class F extends q{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let $=this._def.shape(),X=L.objectKeys($);return this._cached={shape:$,keys:X},this._cached}_parse($){if(this._getType($)!==M.object){let D=this._getOrReturnCtx($);return N(D,{code:w.invalid_type,expected:M.object,received:D.parsedType}),A}let{status:Q,ctx:Y}=this._processInputParams($),{shape:G,keys:W}=this._getCached(),H=[];if(!(this._def.catchall instanceof s&&this._def.unknownKeys==="strip")){for(let D in Y.data)if(!W.includes(D))H.push(D)}let B=[];for(let D of W){let V=G[D],j=Y.data[D];B.push({key:{status:"valid",value:D},value:V._parse(new n(Y,j,Y.path,D)),alwaysSet:D in Y.data})}if(this._def.catchall instanceof s){let D=this._def.unknownKeys;if(D==="passthrough")for(let V of H)B.push({key:{status:"valid",value:V},value:{status:"valid",value:Y.data[V]}});else if(D==="strict"){if(H.length>0)N(Y,{code:w.unrecognized_keys,keys:H}),Q.dirty()}else if(D==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let D=this._def.catchall;for(let V of H){let j=Y.data[V];B.push({key:{status:"valid",value:V},value:D._parse(new n(Y,j,Y.path,V)),alwaysSet:V in Y.data})}}if(Y.common.async)return Promise.resolve().then(async()=>{let D=[];for(let V of B){let j=await V.key,P=await V.value;D.push({key:j,value:P,alwaysSet:V.alwaysSet})}return D}).then((D)=>{return f.mergeObjectSync(Q,D)});else return f.mergeObjectSync(Q,B)}get shape(){return this._def.shape()}strict($){return O.errToObj,new F({...this._def,unknownKeys:"strict",...$!==void 0?{errorMap:(X,Q)=>{let Y=this._def.errorMap?.(X,Q).message??Q.defaultError;if(X.code==="unrecognized_keys")return{message:O.errToObj($).message??Y};return{message:Y}}}:{}})}strip(){return new F({...this._def,unknownKeys:"strip"})}passthrough(){return new F({...this._def,unknownKeys:"passthrough"})}extend($){return new F({...this._def,shape:()=>({...this._def.shape(),...$})})}merge($){return new F({unknownKeys:$._def.unknownKeys,catchall:$._def.catchall,shape:()=>({...this._def.shape(),...$._def.shape()}),typeName:_.ZodObject})}setKey($,X){return this.augment({[$]:X})}catchall($){return new F({...this._def,catchall:$})}pick($){let X={};for(let Q of L.objectKeys($))if($[Q]&&this.shape[Q])X[Q]=this.shape[Q];return new F({...this._def,shape:()=>X})}omit($){let X={};for(let Q of L.objectKeys(this.shape))if(!$[Q])X[Q]=this.shape[Q];return new F({...this._def,shape:()=>X})}deepPartial(){return q$(this)}partial($){let X={};for(let Q of L.objectKeys(this.shape)){let Y=this.shape[Q];if($&&!$[Q])X[Q]=Y;else X[Q]=Y.optional()}return new F({...this._def,shape:()=>X})}required($){let X={};for(let Q of L.objectKeys(this.shape))if($&&!$[Q])X[Q]=this.shape[Q];else{let G=this.shape[Q];while(G instanceof c)G=G._def.innerType;X[Q]=G}return new F({...this._def,shape:()=>X})}keyof(){return V0(L.objectKeys(this.shape))}};F.create=($,X)=>{return new F({shape:()=>$,unknownKeys:"strip",catchall:s.create(),typeName:_.ZodObject,...U(X)})};F.strictCreate=($,X)=>{return new F({shape:()=>$,unknownKeys:"strict",catchall:s.create(),typeName:_.ZodObject,...U(X)})};F.lazycreate=($,X)=>{return new F({shape:$,unknownKeys:"strip",catchall:s.create(),typeName:_.ZodObject,...U(X)})};F$=class F$ extends q{_parse($){let{ctx:X}=this._processInputParams($),Q=this._def.options;function Y(G){for(let H of G)if(H.result.status==="valid")return H.result;for(let H of G)if(H.result.status==="dirty")return X.common.issues.push(...H.ctx.common.issues),H.result;let W=G.map((H)=>new h(H.ctx.common.issues));return N(X,{code:w.invalid_union,unionErrors:W}),A}if(X.common.async)return Promise.all(Q.map(async(G)=>{let W={...X,common:{...X.common,issues:[]},parent:null};return{result:await G._parseAsync({data:X.data,path:X.path,parent:W}),ctx:W}})).then(Y);else{let G=void 0,W=[];for(let B of Q){let D={...X,common:{...X.common,issues:[]},parent:null},V=B._parseSync({data:X.data,path:X.path,parent:D});if(V.status==="valid")return V;else if(V.status==="dirty"&&!G)G={result:V,ctx:D};if(D.common.issues.length)W.push(D.common.issues)}if(G)return X.common.issues.push(...G.ctx.common.issues),G.result;let H=W.map((B)=>new h(B));return N(X,{code:w.invalid_union,unionErrors:H}),A}}get options(){return this._def.options}};F$.create=($,X)=>{return new F$({options:$,typeName:_.ZodUnion,...U(X)})};$3=class $3 extends q{_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==M.object)return N(X,{code:w.invalid_type,expected:M.object,received:X.parsedType}),A;let Q=this.discriminator,Y=X.data[Q],G=this.optionsMap.get(Y);if(!G)return N(X,{code:w.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),A;if(X.common.async)return G._parseAsync({data:X.data,path:X.path,parent:X});else return G._parseSync({data:X.data,path:X.path,parent:X})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create($,X,Q){let Y=new Map;for(let G of X){let W=Y$(G.shape[$]);if(!W.length)throw new Error(`A discriminator value for key \`${$}\` could not be extracted from all schema options`);for(let H of W){if(Y.has(H))throw new Error(`Discriminator property ${String($)} has duplicate value ${String(H)}`);Y.set(H,G)}}return new $3({typeName:_.ZodDiscriminatedUnion,discriminator:$,options:X,optionsMap:Y,...U(Q)})}};z$=class z$ extends q{_parse($){let{status:X,ctx:Q}=this._processInputParams($),Y=(G,W)=>{if(s$(G)||s$(W))return A;let H=h3(G.value,W.value);if(!H.valid)return N(Q,{code:w.invalid_intersection_types}),A;if(e$(G)||e$(W))X.dirty();return{status:X.value,value:H.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([G,W])=>Y(G,W));else return Y(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}};z$.create=($,X,Q)=>{return new z$({left:$,right:X,typeName:_.ZodIntersection,...U(Q)})};e=class e extends q{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.array)return N(Q,{code:w.invalid_type,expected:M.array,received:Q.parsedType}),A;if(Q.data.length<this._def.items.length)return N(Q,{code:w.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),A;if(!this._def.rest&&Q.data.length>this._def.items.length)N(Q,{code:w.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X.dirty();let G=[...Q.data].map((W,H)=>{let B=this._def.items[H]||this._def.rest;if(!B)return null;return B._parse(new n(Q,W,Q.path,H))}).filter((W)=>!!W);if(Q.common.async)return Promise.all(G).then((W)=>{return f.mergeArray(X,W)});else return f.mergeArray(X,G)}get items(){return this._def.items}rest($){return new e({...this._def,rest:$})}};e.create=($,X)=>{if(!Array.isArray($))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new e({items:$,typeName:_.ZodTuple,rest:null,...U(X)})};h$=class h$ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.object)return N(Q,{code:w.invalid_type,expected:M.object,received:Q.parsedType}),A;let Y=[],G=this._def.keyType,W=this._def.valueType;for(let H in Q.data)Y.push({key:G._parse(new n(Q,H,Q.path,H)),value:W._parse(new n(Q,Q.data[H],Q.path,H)),alwaysSet:H in Q.data});if(Q.common.async)return f.mergeObjectAsync(X,Y);else return f.mergeObjectSync(X,Y)}get element(){return this._def.valueType}static create($,X,Q){if(X instanceof q)return new h$({keyType:$,valueType:X,typeName:_.ZodRecord,...U(Q)});return new h$({keyType:m.create(),valueType:$,typeName:_.ZodRecord,...U(X)})}};Z$=class Z$ extends q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.map)return N(Q,{code:w.invalid_type,expected:M.map,received:Q.parsedType}),A;let Y=this._def.keyType,G=this._def.valueType,W=[...Q.data.entries()].map(([H,B],D)=>{return{key:Y._parse(new n(Q,H,Q.path,[D,"key"])),value:G._parse(new n(Q,B,Q.path,[D,"value"]))}});if(Q.common.async){let H=new Map;return Promise.resolve().then(async()=>{for(let B of W){let D=await B.key,V=await B.value;if(D.status==="aborted"||V.status==="aborted")return A;if(D.status==="dirty"||V.status==="dirty")X.dirty();H.set(D.value,V.value)}return{status:X.value,value:H}})}else{let H=new Map;for(let B of W){let{key:D,value:V}=B;if(D.status==="aborted"||V.status==="aborted")return A;if(D.status==="dirty"||V.status==="dirty")X.dirty();H.set(D.value,V.value)}return{status:X.value,value:H}}}};Z$.create=($,X,Q)=>{return new Z$({valueType:X,keyType:$,typeName:_.ZodMap,...U(Q)})};j$=class j$ extends q{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.parsedType!==M.set)return N(Q,{code:w.invalid_type,expected:M.set,received:Q.parsedType}),A;let Y=this._def;if(Y.minSize!==null){if(Q.data.size<Y.minSize.value)N(Q,{code:w.too_small,minimum:Y.minSize.value,type:"set",inclusive:!0,exact:!1,message:Y.minSize.message}),X.dirty()}if(Y.maxSize!==null){if(Q.data.size>Y.maxSize.value)N(Q,{code:w.too_big,maximum:Y.maxSize.value,type:"set",inclusive:!0,exact:!1,message:Y.maxSize.message}),X.dirty()}let G=this._def.valueType;function W(B){let D=new Set;for(let V of B){if(V.status==="aborted")return A;if(V.status==="dirty")X.dirty();D.add(V.value)}return{status:X.value,value:D}}let H=[...Q.data.values()].map((B,D)=>G._parse(new n(Q,B,Q.path,D)));if(Q.common.async)return Promise.all(H).then((B)=>W(B));else return W(H)}min($,X){return new j$({...this._def,minSize:{value:$,message:O.toString(X)}})}max($,X){return new j$({...this._def,maxSize:{value:$,message:O.toString(X)}})}size($,X){return this.min($,X).max($,X)}nonempty($){return this.min(1,$)}};j$.create=($,X)=>{return new j$({valueType:$,minSize:null,maxSize:null,typeName:_.ZodSet,...U(X)})};K$=class K$ extends q{constructor(){super(...arguments);this.validate=this.implement}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==M.function)return N(X,{code:w.invalid_type,expected:M.function,received:X.parsedType}),A;function Q(H,B){return T$({data:H,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,b$(),Q$].filter((D)=>!!D),issueData:{code:w.invalid_arguments,argumentsError:B}})}function Y(H,B){return T$({data:H,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,b$(),Q$].filter((D)=>!!D),issueData:{code:w.invalid_return_type,returnTypeError:B}})}let G={errorMap:X.common.contextualErrorMap},W=X.data;if(this._def.returns instanceof A$){let H=this;return C(async function(...B){let D=new h([]),V=await H._def.args.parseAsync(B,G).catch((I)=>{throw D.addIssue(Q(B,I)),D}),j=await Reflect.apply(W,this,V);return await H._def.returns._def.type.parseAsync(j,G).catch((I)=>{throw D.addIssue(Y(j,I)),D})})}else{let H=this;return C(function(...B){let D=H._def.args.safeParse(B,G);if(!D.success)throw new h([Q(B,D.error)]);let V=Reflect.apply(W,this,D.data),j=H._def.returns.safeParse(V,G);if(!j.success)throw new h([Y(V,j.error)]);return j.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...$){return new K$({...this._def,args:e.create($).rest(H$.create())})}returns($){return new K$({...this._def,returns:$})}implement($){return this.parse($)}strictImplement($){return this.parse($)}static create($,X,Q){return new K$({args:$?$:e.create([]).rest(H$.create()),returns:X||H$.create(),typeName:_.ZodFunction,...U(Q)})}};R$=class R$ extends q{get schema(){return this._def.getter()}_parse($){let{ctx:X}=this._processInputParams($);return this._def.getter()._parse({data:X.data,path:X.path,parent:X})}};R$.create=($,X)=>{return new R$({getter:$,typeName:_.ZodLazy,...U(X)})};v$=class v$ extends q{_parse($){if($.data!==this._def.value){let X=this._getOrReturnCtx($);return N(X,{received:X.data,code:w.invalid_literal,expected:this._def.value}),A}return{status:"valid",value:$.data}}get value(){return this._def.value}};v$.create=($,X)=>{return new v$({value:$,typeName:_.ZodLiteral,...U(X)})};w$=class w$ extends q{_parse($){if(typeof $.data!=="string"){let X=this._getOrReturnCtx($),Q=this._def.values;return N(X,{expected:L.joinValues(Q),received:X.parsedType,code:w.invalid_type}),A}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has($.data)){let X=this._getOrReturnCtx($),Q=this._def.values;return N(X,{received:X.data,code:w.invalid_enum_value,options:Q}),A}return C($.data)}get options(){return this._def.values}get enum(){let $={};for(let X of this._def.values)$[X]=X;return $}get Values(){let $={};for(let X of this._def.values)$[X]=X;return $}get Enum(){let $={};for(let X of this._def.values)$[X]=X;return $}extract($,X=this._def){return w$.create($,{...this._def,...X})}exclude($,X=this._def){return w$.create(this.options.filter((Q)=>!$.includes(Q)),{...this._def,...X})}};w$.create=V0;k$=class k$ extends q{_parse($){let X=L.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx($);if(Q.parsedType!==M.string&&Q.parsedType!==M.number){let Y=L.objectValues(X);return N(Q,{expected:L.joinValues(Y),received:Q.parsedType,code:w.invalid_type}),A}if(!this._cache)this._cache=new Set(L.getValidEnumValues(this._def.values));if(!this._cache.has($.data)){let Y=L.objectValues(X);return N(Q,{received:Q.data,code:w.invalid_enum_value,options:Y}),A}return C($.data)}get enum(){return this._def.values}};k$.create=($,X)=>{return new k$({values:$,typeName:_.ZodNativeEnum,...U(X)})};A$=class A$ extends q{unwrap(){return this._def.type}_parse($){let{ctx:X}=this._processInputParams($);if(X.parsedType!==M.promise&&X.common.async===!1)return N(X,{code:w.invalid_type,expected:M.promise,received:X.parsedType}),A;let Q=X.parsedType===M.promise?X.data:Promise.resolve(X.data);return C(Q.then((Y)=>{return this._def.type.parseAsync(Y,{path:X.path,errorMap:X.common.contextualErrorMap})}))}};A$.create=($,X)=>{return new A$({type:$,typeName:_.ZodPromise,...U(X)})};p=class p extends q{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse($){let{status:X,ctx:Q}=this._processInputParams($),Y=this._def.effect||null,G={addIssue:(W)=>{if(N(Q,W),W.fatal)X.abort();else X.dirty()},get path(){return Q.path}};if(G.addIssue=G.addIssue.bind(G),Y.type==="preprocess"){let W=Y.transform(Q.data,G);if(Q.common.async)return Promise.resolve(W).then(async(H)=>{if(X.value==="aborted")return A;let B=await this._def.schema._parseAsync({data:H,path:Q.path,parent:Q});if(B.status==="aborted")return A;if(B.status==="dirty")return V$(B.value);if(X.value==="dirty")return V$(B.value);return B});else{if(X.value==="aborted")return A;let H=this._def.schema._parseSync({data:W,path:Q.path,parent:Q});if(H.status==="aborted")return A;if(H.status==="dirty")return V$(H.value);if(X.value==="dirty")return V$(H.value);return H}}if(Y.type==="refinement"){let W=(H)=>{let B=Y.refinement(H,G);if(Q.common.async)return Promise.resolve(B);if(B instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return H};if(Q.common.async===!1){let H=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(H.status==="aborted")return A;if(H.status==="dirty")X.dirty();return W(H.value),{status:X.value,value:H.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((H)=>{if(H.status==="aborted")return A;if(H.status==="dirty")X.dirty();return W(H.value).then(()=>{return{status:X.value,value:H.value}})})}if(Y.type==="transform")if(Q.common.async===!1){let W=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!W$(W))return A;let H=Y.transform(W.value,G);if(H instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:X.value,value:H}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((W)=>{if(!W$(W))return A;return Promise.resolve(Y.transform(W.value,G)).then((H)=>({status:X.value,value:H}))});L.assertNever(Y)}};p.create=($,X,Q)=>{return new p({schema:$,typeName:_.ZodEffects,effect:X,...U(Q)})};p.createWithPreprocess=($,X,Q)=>{return new p({schema:X,effect:{type:"preprocess",transform:$},typeName:_.ZodEffects,...U(Q)})};c=class c extends q{_parse($){if(this._getType($)===M.undefined)return C(void 0);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};c.create=($,X)=>{return new c({innerType:$,typeName:_.ZodOptional,...U(X)})};G$=class G$ extends q{_parse($){if(this._getType($)===M.null)return C(null);return this._def.innerType._parse($)}unwrap(){return this._def.innerType}};G$.create=($,X)=>{return new G$({innerType:$,typeName:_.ZodNullable,...U(X)})};f$=class f$ extends q{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;if(X.parsedType===M.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:X.path,parent:X})}removeDefault(){return this._def.innerType}};f$.create=($,X)=>{return new f$({innerType:$,typeName:_.ZodDefault,defaultValue:typeof X.default==="function"?X.default:()=>X.default,...U(X)})};P$=class P$ extends q{_parse($){let{ctx:X}=this._processInputParams($),Q={...X,common:{...X.common,issues:[]}},Y=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(U$(Y))return Y.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new h(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:Y.status==="valid"?Y.value:this._def.catchValue({get error(){return new h(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}};P$.create=($,X)=>{return new P$({innerType:$,typeName:_.ZodCatch,catchValue:typeof X.catch==="function"?X.catch:()=>X.catch,...U(X)})};g$=class g$ extends q{_parse($){if(this._getType($)!==M.nan){let Q=this._getOrReturnCtx($);return N(Q,{code:w.invalid_type,expected:M.nan,received:Q.parsedType}),A}return{status:"valid",value:$.data}}};g$.create=($)=>{return new g$({typeName:_.ZodNaN,...U($)})};D2=Symbol("zod_brand");X3=class X3 extends q{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;return this._def.type._parse({data:Q,path:X.path,parent:X})}unwrap(){return this._def.type}};l$=class l$ extends q{_parse($){let{status:X,ctx:Q}=this._processInputParams($);if(Q.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(G.status==="aborted")return A;if(G.status==="dirty")return X.dirty(),V$(G.value);else return this._def.out._parseAsync({data:G.value,path:Q.path,parent:Q})})();else{let Y=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(Y.status==="aborted")return A;if(Y.status==="dirty")return X.dirty(),{status:"dirty",value:Y.value};else return this._def.out._parseSync({data:Y.value,path:Q.path,parent:Q})}}static create($,X){return new l$({in:$,out:X,typeName:_.ZodPipeline})}};C$=class C$ extends q{_parse($){let X=this._def.innerType._parse($),Q=(Y)=>{if(W$(Y))Y.value=Object.freeze(Y.value);return Y};return U$(X)?X.then((Y)=>Q(Y)):Q(X)}unwrap(){return this._def.innerType}};C$.create=($,X)=>{return new C$({innerType:$,typeName:_.ZodReadonly,...U(X)})};w2={object:F.lazycreate};(function($){$.ZodString="ZodString",$.ZodNumber="ZodNumber",$.ZodNaN="ZodNaN",$.ZodBigInt="ZodBigInt",$.ZodBoolean="ZodBoolean",$.ZodDate="ZodDate",$.ZodSymbol="ZodSymbol",$.ZodUndefined="ZodUndefined",$.ZodNull="ZodNull",$.ZodAny="ZodAny",$.ZodUnknown="ZodUnknown",$.ZodNever="ZodNever",$.ZodVoid="ZodVoid",$.ZodArray="ZodArray",$.ZodObject="ZodObject",$.ZodUnion="ZodUnion",$.ZodDiscriminatedUnion="ZodDiscriminatedUnion",$.ZodIntersection="ZodIntersection",$.ZodTuple="ZodTuple",$.ZodRecord="ZodRecord",$.ZodMap="ZodMap",$.ZodSet="ZodSet",$.ZodFunction="ZodFunction",$.ZodLazy="ZodLazy",$.ZodLiteral="ZodLiteral",$.ZodEnum="ZodEnum",$.ZodEffects="ZodEffects",$.ZodNativeEnum="ZodNativeEnum",$.ZodOptional="ZodOptional",$.ZodNullable="ZodNullable",$.ZodDefault="ZodDefault",$.ZodCatch="ZodCatch",$.ZodPromise="ZodPromise",$.ZodBranded="ZodBranded",$.ZodPipeline="ZodPipeline",$.ZodReadonly="ZodReadonly"})(_||(_={}));O0=m.create,j0=B$.create,M2=g$.create,V2=D$.create,A0=L$.create,N2=N$.create,O2=x$.create,j2=E$.create,A2=S$.create,b2=O$.create,U2=H$.create,q2=s.create,K2=y$.create,L2=u.create,E2=F.create,S2=F.strictCreate,F2=F$.create,z2=$3.create,R2=z$.create,v2=e.create,k2=h$.create,f2=Z$.create,P2=j$.create,C2=K$.create,I2=R$.create,T2=v$.create,x2=w$.create,y2=k$.create,h2=A$.create,Z2=p.create,g2=c.create,l2=G$.create,m2=p.createWithPreprocess,u2=l$.create,i2={string:($)=>m.create({...$,coerce:!0}),number:($)=>B$.create({...$,coerce:!0}),boolean:($)=>L$.create({...$,coerce:!0}),bigint:($)=>D$.create({...$,coerce:!0}),date:($)=>N$.create({...$,coerce:!0})},d2=A});var J={};h1(J,{void:()=>K2,util:()=>L,unknown:()=>U2,union:()=>F2,undefined:()=>j2,tuple:()=>v2,transformer:()=>Z2,symbol:()=>O2,string:()=>O0,strictObject:()=>S2,setErrorMap:()=>l1,set:()=>P2,record:()=>k2,quotelessJson:()=>Z1,promise:()=>h2,preprocess:()=>m2,pipeline:()=>u2,ostring:()=>c2,optional:()=>g2,onumber:()=>n2,oboolean:()=>p2,objectUtil:()=>I3,object:()=>E2,number:()=>j0,nullable:()=>l2,null:()=>A2,never:()=>q2,nativeEnum:()=>y2,nan:()=>M2,map:()=>f2,makeIssue:()=>T$,literal:()=>T2,lazy:()=>I2,late:()=>w2,isValid:()=>W$,isDirty:()=>e$,isAsync:()=>U$,isAborted:()=>s$,intersection:()=>R2,instanceof:()=>_2,getParsedType:()=>t,getErrorMap:()=>b$,function:()=>C2,enum:()=>x2,effect:()=>Z2,discriminatedUnion:()=>z2,defaultErrorMap:()=>Q$,datetimeRegex:()=>M0,date:()=>N2,custom:()=>N0,coerce:()=>i2,boolean:()=>A0,bigint:()=>V2,array:()=>L2,any:()=>b2,addIssueToContext:()=>N,ZodVoid:()=>y$,ZodUnknown:()=>H$,ZodUnion:()=>F$,ZodUndefined:()=>E$,ZodType:()=>q,ZodTuple:()=>e,ZodTransformer:()=>p,ZodSymbol:()=>x$,ZodString:()=>m,ZodSet:()=>j$,ZodSchema:()=>q,ZodRecord:()=>h$,ZodReadonly:()=>C$,ZodPromise:()=>A$,ZodPipeline:()=>l$,ZodParsedType:()=>M,ZodOptional:()=>c,ZodObject:()=>F,ZodNumber:()=>B$,ZodNullable:()=>G$,ZodNull:()=>S$,ZodNever:()=>s,ZodNativeEnum:()=>k$,ZodNaN:()=>g$,ZodMap:()=>Z$,ZodLiteral:()=>v$,ZodLazy:()=>R$,ZodIssueCode:()=>w,ZodIntersection:()=>z$,ZodFunction:()=>K$,ZodFirstPartyTypeKind:()=>_,ZodError:()=>h,ZodEnum:()=>w$,ZodEffects:()=>p,ZodDiscriminatedUnion:()=>$3,ZodDefault:()=>f$,ZodDate:()=>N$,ZodCatch:()=>P$,ZodBranded:()=>X3,ZodBoolean:()=>L$,ZodBigInt:()=>D$,ZodArray:()=>u,ZodAny:()=>O$,Schema:()=>q,ParseStatus:()=>f,OK:()=>C,NEVER:()=>d2,INVALID:()=>A,EMPTY_PATH:()=>m1,DIRTY:()=>V$,BRAND:()=>D2});var Z3=g(()=>{t$();x3();W0();I$();b0();r$()});var _$=g(()=>{Z3();Z3()});var g3="2025-03-26",U0,Q3="2.0",q0,K0,o2,i,Z,m$,$$,d,Y3,L0,E0=($)=>L0.safeParse($).success,S0,F0=($)=>S0.safeParse($).success,z0,l3=($)=>z0.safeParse($).success,z,R0,v0=($)=>R0.safeParse($).success,k0,G3,J3,f0,a2,W3,zX=($)=>W3.safeParse($).success,r2,t2,m3,H3,s2,B3,D3,w3,P0,C0,I0,e2,$6,_3,X6,M3,Q6,V3,Y6,G6,J6,W6,H6,B6,D6,N3,w6,O3,j3,A3,b3,T0,_6,M6,V6,N6,O6,U3,j6,x0,RX,q3,A6,y0,b6,U6,q6,K6,L6,E6,u3,S6,F6,K3,z6,R6,v6,c3,k6,vX,kX,fX,PX,CX,IX,v;var u$=g(()=>{_$();U0=[g3,"2024-11-05","2024-10-07"],q0=J.union([J.string(),J.number().int()]),K0=J.string(),o2=J.object({progressToken:J.optional(q0)}).passthrough(),i=J.object({_meta:J.optional(o2)}).passthrough(),Z=J.object({method:J.string(),params:J.optional(i)}),m$=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),$$=J.object({method:J.string(),params:J.optional(m$)}),d=J.object({_meta:J.optional(J.object({}).passthrough())}).passthrough(),Y3=J.union([J.string(),J.number().int()]),L0=J.object({jsonrpc:J.literal(Q3),id:Y3}).merge(Z).strict(),S0=J.object({jsonrpc:J.literal(Q3)}).merge($$).strict(),z0=J.object({jsonrpc:J.literal(Q3),id:Y3,result:d}).strict();(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError"})(z||(z={}));R0=J.object({jsonrpc:J.literal(Q3),id:Y3,error:J.object({code:J.number().int(),message:J.string(),data:J.optional(J.unknown())})}).strict(),k0=J.union([L0,S0,z0,R0]),G3=d.strict(),J3=$$.extend({method:J.literal("notifications/cancelled"),params:m$.extend({requestId:Y3,reason:J.string().optional()})}),f0=J.object({name:J.string(),version:J.string()}).passthrough(),a2=J.object({experimental:J.optional(J.object({}).passthrough()),sampling:J.optional(J.object({}).passthrough()),roots:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),W3=Z.extend({method:J.literal("initialize"),params:i.extend({protocolVersion:J.string(),capabilities:a2,clientInfo:f0})}),r2=J.object({experimental:J.optional(J.object({}).passthrough()),logging:J.optional(J.object({}).passthrough()),completions:J.optional(J.object({}).passthrough()),prompts:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough()),resources:J.optional(J.object({subscribe:J.optional(J.boolean()),listChanged:J.optional(J.boolean())}).passthrough()),tools:J.optional(J.object({listChanged:J.optional(J.boolean())}).passthrough())}).passthrough(),t2=d.extend({protocolVersion:J.string(),capabilities:r2,serverInfo:f0,instructions:J.optional(J.string())}),m3=$$.extend({method:J.literal("notifications/initialized")}),H3=Z.extend({method:J.literal("ping")}),s2=J.object({progress:J.number(),total:J.optional(J.number()),message:J.optional(J.string())}).passthrough(),B3=$$.extend({method:J.literal("notifications/progress"),params:m$.merge(s2).extend({progressToken:q0})}),D3=Z.extend({params:i.extend({cursor:J.optional(K0)}).optional()}),w3=d.extend({nextCursor:J.optional(K0)}),P0=J.object({uri:J.string(),mimeType:J.optional(J.string())}).passthrough(),C0=P0.extend({text:J.string()}),I0=P0.extend({blob:J.string().base64()}),e2=J.object({uri:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),$6=J.object({uriTemplate:J.string(),name:J.string(),description:J.optional(J.string()),mimeType:J.optional(J.string())}).passthrough(),_3=D3.extend({method:J.literal("resources/list")}),X6=w3.extend({resources:J.array(e2)}),M3=D3.extend({method:J.literal("resources/templates/list")}),Q6=w3.extend({resourceTemplates:J.array($6)}),V3=Z.extend({method:J.literal("resources/read"),params:i.extend({uri:J.string()})}),Y6=d.extend({contents:J.array(J.union([C0,I0]))}),G6=$$.extend({method:J.literal("notifications/resources/list_changed")}),J6=Z.extend({method:J.literal("resources/subscribe"),params:i.extend({uri:J.string()})}),W6=Z.extend({method:J.literal("resources/unsubscribe"),params:i.extend({uri:J.string()})}),H6=$$.extend({method:J.literal("notifications/resources/updated"),params:m$.extend({uri:J.string()})}),B6=J.object({name:J.string(),description:J.optional(J.string()),required:J.optional(J.boolean())}).passthrough(),D6=J.object({name:J.string(),description:J.optional(J.string()),arguments:J.optional(J.array(B6))}).passthrough(),N3=D3.extend({method:J.literal("prompts/list")}),w6=w3.extend({prompts:J.array(D6)}),O3=Z.extend({method:J.literal("prompts/get"),params:i.extend({name:J.string(),arguments:J.optional(J.record(J.string()))})}),j3=J.object({type:J.literal("text"),text:J.string()}).passthrough(),A3=J.object({type:J.literal("image"),data:J.string().base64(),mimeType:J.string()}).passthrough(),b3=J.object({type:J.literal("audio"),data:J.string().base64(),mimeType:J.string()}).passthrough(),T0=J.object({type:J.literal("resource"),resource:J.union([C0,I0])}).passthrough(),_6=J.object({role:J.enum(["user","assistant"]),content:J.union([j3,A3,b3,T0])}).passthrough(),M6=d.extend({description:J.optional(J.string()),messages:J.array(_6)}),V6=$$.extend({method:J.literal("notifications/prompts/list_changed")}),N6=J.object({title:J.optional(J.string()),readOnlyHint:J.optional(J.boolean()),destructiveHint:J.optional(J.boolean()),idempotentHint:J.optional(J.boolean()),openWorldHint:J.optional(J.boolean())}).passthrough(),O6=J.object({name:J.string(),description:J.optional(J.string()),inputSchema:J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough(),outputSchema:J.optional(J.object({type:J.literal("object"),properties:J.optional(J.object({}).passthrough()),required:J.optional(J.array(J.string()))}).passthrough()),annotations:J.optional(N6)}).passthrough(),U3=D3.extend({method:J.literal("tools/list")}),j6=w3.extend({tools:J.array(O6)}),x0=d.extend({content:J.array(J.union([j3,A3,b3,T0])).default([]),structuredContent:J.object({}).passthrough().optional(),isError:J.optional(J.boolean())}),RX=x0.or(d.extend({toolResult:J.unknown()})),q3=Z.extend({method:J.literal("tools/call"),params:i.extend({name:J.string(),arguments:J.optional(J.record(J.unknown()))})}),A6=$$.extend({method:J.literal("notifications/tools/list_changed")}),y0=J.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),b6=Z.extend({method:J.literal("logging/setLevel"),params:i.extend({level:y0})}),U6=$$.extend({method:J.literal("notifications/message"),params:m$.extend({level:y0,logger:J.optional(J.string()),data:J.unknown()})}),q6=J.object({name:J.string().optional()}).passthrough(),K6=J.object({hints:J.optional(J.array(q6)),costPriority:J.optional(J.number().min(0).max(1)),speedPriority:J.optional(J.number().min(0).max(1)),intelligencePriority:J.optional(J.number().min(0).max(1))}).passthrough(),L6=J.object({role:J.enum(["user","assistant"]),content:J.union([j3,A3,b3])}).passthrough(),E6=Z.extend({method:J.literal("sampling/createMessage"),params:i.extend({messages:J.array(L6),systemPrompt:J.optional(J.string()),includeContext:J.optional(J.enum(["none","thisServer","allServers"])),temperature:J.optional(J.number()),maxTokens:J.number().int(),stopSequences:J.optional(J.array(J.string())),metadata:J.optional(J.object({}).passthrough()),modelPreferences:J.optional(K6)})}),u3=d.extend({model:J.string(),stopReason:J.optional(J.enum(["endTurn","stopSequence","maxTokens"]).or(J.string())),role:J.enum(["user","assistant"]),content:J.discriminatedUnion("type",[j3,A3,b3])}),S6=J.object({type:J.literal("ref/resource"),uri:J.string()}).passthrough(),F6=J.object({type:J.literal("ref/prompt"),name:J.string()}).passthrough(),K3=Z.extend({method:J.literal("completion/complete"),params:i.extend({ref:J.union([F6,S6]),argument:J.object({name:J.string(),value:J.string()}).passthrough()})}),z6=d.extend({completion:J.object({values:J.array(J.string()).max(100),total:J.optional(J.number().int()),hasMore:J.optional(J.boolean())}).passthrough()}),R6=J.object({uri:J.string().startsWith("file://"),name:J.optional(J.string())}).passthrough(),v6=Z.extend({method:J.literal("roots/list")}),c3=d.extend({roots:J.array(R6)}),k6=$$.extend({method:J.literal("notifications/roots/list_changed")}),vX=J.union([H3,W3,K3,b6,O3,N3,_3,M3,V3,J6,W6,q3,U3]),kX=J.union([J3,B3,m3,k6]),fX=J.union([G3,u3,c3]),PX=J.union([H3,E6,v6]),CX=J.union([J3,B3,U6,H6,G6,A6,V6]),IX=J.union([G3,t2,z6,M6,w6,X6,Q6,Y6,x0,j6]);v=class v extends Error{constructor($,X,Q){super(`MCP error ${$}: ${X}`);this.code=$,this.data=Q,this.name="McpError"}}});function c6(){let $=process.argv.join(" ");return $.includes("streamable-http.js")||$.includes("streamable-http.ts")}class q1{context;level;constructor($,X=1){this.context=$,this.level=X}setLevel($){this.level=$}log(...$){if(U1)console.log(...$);else console.error(...$)}logWarn(...$){if(U1)console.warn(...$);else console.error(...$)}debug(...$){if(this.level<=0)this.log(`[DEBUG] [${this.context}]`,...$)}info(...$){if(this.level<=1)this.log(`[INFO] [${this.context}]`,...$)}warn(...$){if(this.level<=2)this.logWarn(`[WARN] [${this.context}]`,...$)}error(...$){if(this.level<=3)console.error(`[ERROR] [${this.context}]`,...$)}}var U1,M$=($,X=1)=>new q1($,X);var p$=g(()=>{U1=c6()});u$();var f6=60000;class n3{constructor($){this._options=$,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this.setNotificationHandler(J3,(X)=>{let Q=this._requestHandlerAbortControllers.get(X.params.requestId);Q===null||Q===void 0||Q.abort(X.params.reason)}),this.setNotificationHandler(B3,(X)=>{this._onprogress(X)}),this.setRequestHandler(H3,(X)=>({}))}_setupTimeout($,X,Q,Y,G=!1){this._timeoutInfo.set($,{timeoutId:setTimeout(Y,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Q,resetTimeoutOnProgress:G,onTimeout:Y})}_resetTimeout($){let X=this._timeoutInfo.get($);if(!X)return!1;let Q=Date.now()-X.startTime;if(X.maxTotalTimeout&&Q>=X.maxTotalTimeout)throw this._timeoutInfo.delete($),new v(z.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Q});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout($){let X=this._timeoutInfo.get($);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete($)}async connect($){this._transport=$,this._transport.onclose=()=>{this._onclose()},this._transport.onerror=(X)=>{this._onerror(X)},this._transport.onmessage=(X,Q)=>{if(l3(X)||v0(X))this._onresponse(X);else if(E0(X))this._onrequest(X,Q);else if(F0(X))this._onnotification(X);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(X)}`))},await this._transport.start()}_onclose(){var $;let X=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._transport=void 0,($=this.onclose)===null||$===void 0||$.call(this);let Q=new v(z.ConnectionClosed,"Connection closed");for(let Y of X.values())Y(Q)}_onerror($){var X;(X=this.onerror)===null||X===void 0||X.call(this,$)}_onnotification($){var X;let Q=(X=this._notificationHandlers.get($.method))!==null&&X!==void 0?X:this.fallbackNotificationHandler;if(Q===void 0)return;Promise.resolve().then(()=>Q($)).catch((Y)=>this._onerror(new Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest($,X){var Q,Y,G,W;let H=(Q=this._requestHandlers.get($.method))!==null&&Q!==void 0?Q:this.fallbackRequestHandler;if(H===void 0){(Y=this._transport)===null||Y===void 0||Y.send({jsonrpc:"2.0",id:$.id,error:{code:z.MethodNotFound,message:"Method not found"}}).catch((V)=>this._onerror(new Error(`Failed to send an error response: ${V}`)));return}let B=new AbortController;this._requestHandlerAbortControllers.set($.id,B);let D={signal:B.signal,sessionId:(G=this._transport)===null||G===void 0?void 0:G.sessionId,_meta:(W=$.params)===null||W===void 0?void 0:W._meta,sendNotification:(V)=>this.notification(V,{relatedRequestId:$.id}),sendRequest:(V,j,P)=>this.request(V,j,{...P,relatedRequestId:$.id}),authInfo:X===null||X===void 0?void 0:X.authInfo,requestId:$.id};Promise.resolve().then(()=>H($,D)).then((V)=>{var j;if(B.signal.aborted)return;return(j=this._transport)===null||j===void 0?void 0:j.send({result:V,jsonrpc:"2.0",id:$.id})},(V)=>{var j,P;if(B.signal.aborted)return;return(j=this._transport)===null||j===void 0?void 0:j.send({jsonrpc:"2.0",id:$.id,error:{code:Number.isSafeInteger(V.code)?V.code:z.InternalError,message:(P=V.message)!==null&&P!==void 0?P:"Internal error"}})}).catch((V)=>this._onerror(new Error(`Failed to send response: ${V}`))).finally(()=>{this._requestHandlerAbortControllers.delete($.id)})}_onprogress($){let{progressToken:X,...Q}=$.params,Y=Number(X),G=this._progressHandlers.get(Y);if(!G){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify($)}`));return}let W=this._responseHandlers.get(Y),H=this._timeoutInfo.get(Y);if(H&&W&&H.resetTimeoutOnProgress)try{this._resetTimeout(Y)}catch(B){W(B);return}G(Q)}_onresponse($){let X=Number($.id),Q=this._responseHandlers.get(X);if(Q===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify($)}`));return}if(this._responseHandlers.delete(X),this._progressHandlers.delete(X),this._cleanupTimeout(X),l3($))Q($);else{let Y=new v($.error.code,$.error.message,$.error.data);Q(Y)}}get transport(){return this._transport}async close(){var $;await(($=this._transport)===null||$===void 0?void 0:$.close())}request($,X,Q){let{relatedRequestId:Y,resumptionToken:G,onresumptiontoken:W}=Q!==null&&Q!==void 0?Q:{};return new Promise((H,B)=>{var D,V,j,P,I,l;if(!this._transport){B(new Error("Not connected"));return}if(((D=this._options)===null||D===void 0?void 0:D.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod($.method);(V=Q===null||Q===void 0?void 0:Q.signal)===null||V===void 0||V.throwIfAborted();let R=this._requestMessageId++,d$={...$,jsonrpc:"2.0",id:R};if(Q===null||Q===void 0?void 0:Q.onprogress)this._progressHandlers.set(R,Q.onprogress),d$.params={...$.params,_meta:{...((j=$.params)===null||j===void 0?void 0:j._meta)||{},progressToken:R}};let o$=(y)=>{var X$;this._responseHandlers.delete(R),this._progressHandlers.delete(R),this._cleanupTimeout(R),(X$=this._transport)===null||X$===void 0||X$.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:R,reason:String(y)}},{relatedRequestId:Y,resumptionToken:G,onresumptiontoken:W}).catch((r)=>this._onerror(new Error(`Failed to send cancellation: ${r}`))),B(y)};this._responseHandlers.set(R,(y)=>{var X$;if((X$=Q===null||Q===void 0?void 0:Q.signal)===null||X$===void 0?void 0:X$.aborted)return;if(y instanceof Error)return B(y);try{let r=X.parse(y.result);H(r)}catch(r){B(r)}}),(P=Q===null||Q===void 0?void 0:Q.signal)===null||P===void 0||P.addEventListener("abort",()=>{var y;o$((y=Q===null||Q===void 0?void 0:Q.signal)===null||y===void 0?void 0:y.reason)});let a$=(I=Q===null||Q===void 0?void 0:Q.timeout)!==null&&I!==void 0?I:f6,P3=()=>o$(new v(z.RequestTimeout,"Request timed out",{timeout:a$}));this._setupTimeout(R,a$,Q===null||Q===void 0?void 0:Q.maxTotalTimeout,P3,(l=Q===null||Q===void 0?void 0:Q.resetTimeoutOnProgress)!==null&&l!==void 0?l:!1),this._transport.send(d$,{relatedRequestId:Y,resumptionToken:G,onresumptiontoken:W}).catch((y)=>{this._cleanupTimeout(R),B(y)})})}async notification($,X){if(!this._transport)throw new Error("Not connected");this.assertNotificationCapability($.method);let Q={...$,jsonrpc:"2.0"};await this._transport.send(Q,X)}setRequestHandler($,X){let Q=$.shape.method.value;this.assertRequestHandlerCapability(Q),this._requestHandlers.set(Q,(Y,G)=>{return Promise.resolve(X($.parse(Y),G))})}removeRequestHandler($){this._requestHandlers.delete($)}assertCanSetRequestHandler($){if(this._requestHandlers.has($))throw new Error(`A request handler for ${$} already exists, which would be overridden`)}setNotificationHandler($,X){this._notificationHandlers.set($.shape.method.value,(Q)=>Promise.resolve(X($.parse(Q))))}removeNotificationHandler($){this._notificationHandlers.delete($)}}function h0($,X){return Object.entries(X).reduce((Q,[Y,G])=>{if(G&&typeof G==="object")Q[Y]=Q[Y]?{...Q[Y],...G}:G;else Q[Y]=G;return Q},{...$})}u$();class p3 extends n3{constructor($,X){var Q;super(X);this._serverInfo=$,this._capabilities=(Q=X===null||X===void 0?void 0:X.capabilities)!==null&&Q!==void 0?Q:{},this._instructions=X===null||X===void 0?void 0:X.instructions,this.setRequestHandler(W3,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(m3,()=>{var Y;return(Y=this.oninitialized)===null||Y===void 0?void 0:Y.call(this)})}registerCapabilities($){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=h0(this._capabilities,$)}assertCapabilityForMethod($){var X,Q;switch($){case"sampling/createMessage":if(!((X=this._clientCapabilities)===null||X===void 0?void 0:X.sampling))throw new Error(`Client does not support sampling (required for ${$})`);break;case"roots/list":if(!((Q=this._clientCapabilities)===null||Q===void 0?void 0:Q.roots))throw new Error(`Client does not support listing roots (required for ${$})`);break;case"ping":break}}assertNotificationCapability($){switch($){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${$})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${$})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${$})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability($){switch($){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${$})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${$})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${$})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${$})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${$})`);break;case"ping":case"initialize":break}}async _oninitialize($){let X=$.params.protocolVersion;return this._clientCapabilities=$.params.capabilities,this._clientVersion=$.params.clientInfo,{protocolVersion:U0.includes(X)?X:g3,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"},G3)}async createMessage($,X){return this.request({method:"sampling/createMessage",params:$},u3,X)}async listRoots($,X){return this.request({method:"roots/list",params:$},c3,X)}async sendLoggingMessage($){return this.notification({method:"notifications/message",params:$})}async sendResourceUpdated($){return this.notification({method:"notifications/resources/updated",params:$})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}var g0=Symbol("Let zodToJsonSchema decide on which parser to use");var Z0={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"},l0=($)=>typeof $==="string"?{...Z0,name:$}:{...Z0,...$};var m0=($)=>{let X=l0($),Q=X.name!==void 0?[...X.basePath,X.definitionPath,X.name]:X.basePath;return{...X,flags:{hasReferencedOpenAiAnyType:!1},currentPath:Q,propertyPath:void 0,seen:new Map(Object.entries(X.definitions).map(([Y,G])=>[G._def,{def:G._def,path:[...X.basePath,X.definitionPath,Y],jsonSchema:void 0}]))}};function i3($,X,Q,Y){if(!Y?.errorMessages)return;if(Q)$.errorMessage={...$.errorMessage,[X]:Q}}function E($,X,Q,Y,G){$[X]=Q,i3($,X,Y,G)}var L3=($,X)=>{let Q=0;for(;Q<$.length&&Q<X.length;Q++)if($[Q]!==X[Q])break;return[($.length-Q).toString(),...X.slice(Q)].join("/")};_$();function S($){if($.target!=="openAi")return{};let X=[...$.basePath,$.definitionPath,$.openAiAnyTypeName];return $.flags.hasReferencedOpenAiAnyType=!0,{$ref:$.$refStrategy==="relative"?L3(X,$.currentPath):X.join("/")}}_$();function u0($,X){let Q={type:"array"};if($.type?._def&&$.type?._def?.typeName!==_.ZodAny)Q.items=b($.type._def,{...X,currentPath:[...X.currentPath,"items"]});if($.minLength)E(Q,"minItems",$.minLength.value,$.minLength.message,X);if($.maxLength)E(Q,"maxItems",$.maxLength.value,$.maxLength.message,X);if($.exactLength)E(Q,"minItems",$.exactLength.value,$.exactLength.message,X),E(Q,"maxItems",$.exactLength.value,$.exactLength.message,X);return Q}function c0($,X){let Q={type:"integer",format:"int64"};if(!$.checks)return Q;for(let Y of $.checks)switch(Y.kind){case"min":if(X.target==="jsonSchema7")if(Y.inclusive)E(Q,"minimum",Y.value,Y.message,X);else E(Q,"exclusiveMinimum",Y.value,Y.message,X);else{if(!Y.inclusive)Q.exclusiveMinimum=!0;E(Q,"minimum",Y.value,Y.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Y.inclusive)E(Q,"maximum",Y.value,Y.message,X);else E(Q,"exclusiveMaximum",Y.value,Y.message,X);else{if(!Y.inclusive)Q.exclusiveMaximum=!0;E(Q,"maximum",Y.value,Y.message,X)}break;case"multipleOf":E(Q,"multipleOf",Y.value,Y.message,X);break}return Q}function n0(){return{type:"boolean"}}function E3($,X){return b($.type._def,X)}var p0=($,X)=>{return b($.innerType._def,X)};function d3($,X,Q){let Y=Q??X.dateStrategy;if(Array.isArray(Y))return{anyOf:Y.map((G,W)=>d3($,X,G))};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 P6($,X)}}var P6=($,X)=>{let Q={type:"integer",format:"unix-time"};if(X.target==="openApi3")return Q;for(let Y of $.checks)switch(Y.kind){case"min":E(Q,"minimum",Y.value,Y.message,X);break;case"max":E(Q,"maximum",Y.value,Y.message,X);break}return Q};function i0($,X){return{...b($.innerType._def,X),default:$.defaultValue()}}function d0($,X){return X.effectStrategy==="input"?b($.schema._def,X):S(X)}function o0($){return{type:"string",enum:Array.from($.values)}}var C6=($)=>{if("type"in $&&$.type==="string")return!1;return"allOf"in $};function a0($,X){let Q=[b($.left._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),b($.right._def,{...X,currentPath:[...X.currentPath,"allOf","1"]})].filter((W)=>!!W),Y=X.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,G=[];return Q.forEach((W)=>{if(C6(W)){if(G.push(...W.allOf),W.unevaluatedProperties===void 0)Y=void 0}else{let H=W;if("additionalProperties"in W&&W.additionalProperties===!1){let{additionalProperties:B,...D}=W;H=D}else Y=void 0;G.push(H)}}),G.length?{allOf:G,...Y}:void 0}function r0($,X){let Q=typeof $.value;if(Q!=="bigint"&&Q!=="number"&&Q!=="boolean"&&Q!=="string")return{type:Array.isArray($.value)?"array":"object"};if(X.target==="openApi3")return{type:Q==="bigint"?"integer":Q,enum:[$.value]};return{type:Q==="bigint"?"integer":Q,const:$.value}}_$();var o3=void 0,o={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(o3===void 0)o3=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return o3},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 S3($,X){let Q={type:"string"};if($.checks)for(let Y of $.checks)switch(Y.kind){case"min":E(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,Y.value):Y.value,Y.message,X);break;case"max":E(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,Y.value):Y.value,Y.message,X);break;case"email":switch(X.emailStrategy){case"format:email":a(Q,"email",Y.message,X);break;case"format:idn-email":a(Q,"idn-email",Y.message,X);break;case"pattern:zod":T(Q,o.email,Y.message,X);break}break;case"url":a(Q,"uri",Y.message,X);break;case"uuid":a(Q,"uuid",Y.message,X);break;case"regex":T(Q,Y.regex,Y.message,X);break;case"cuid":T(Q,o.cuid,Y.message,X);break;case"cuid2":T(Q,o.cuid2,Y.message,X);break;case"startsWith":T(Q,RegExp(`^${a3(Y.value,X)}`),Y.message,X);break;case"endsWith":T(Q,RegExp(`${a3(Y.value,X)}$`),Y.message,X);break;case"datetime":a(Q,"date-time",Y.message,X);break;case"date":a(Q,"date",Y.message,X);break;case"time":a(Q,"time",Y.message,X);break;case"duration":a(Q,"duration",Y.message,X);break;case"length":E(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,Y.value):Y.value,Y.message,X),E(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,Y.value):Y.value,Y.message,X);break;case"includes":{T(Q,RegExp(a3(Y.value,X)),Y.message,X);break}case"ip":{if(Y.version!=="v6")a(Q,"ipv4",Y.message,X);if(Y.version!=="v4")a(Q,"ipv6",Y.message,X);break}case"base64url":T(Q,o.base64url,Y.message,X);break;case"jwt":T(Q,o.jwt,Y.message,X);break;case"cidr":{if(Y.version!=="v6")T(Q,o.ipv4Cidr,Y.message,X);if(Y.version!=="v4")T(Q,o.ipv6Cidr,Y.message,X);break}case"emoji":T(Q,o.emoji(),Y.message,X);break;case"ulid":{T(Q,o.ulid,Y.message,X);break}case"base64":{switch(X.base64Strategy){case"format:binary":{a(Q,"binary",Y.message,X);break}case"contentEncoding:base64":{E(Q,"contentEncoding","base64",Y.message,X);break}case"pattern:zod":{T(Q,o.base64,Y.message,X);break}}break}case"nanoid":T(Q,o.nanoid,Y.message,X);case"toLowerCase":case"toUpperCase":case"trim":break;default:((G)=>{})(Y)}return Q}function a3($,X){return X.patternStrategy==="escape"?T6($):$}var I6=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function T6($){let X="";for(let Q=0;Q<$.length;Q++){if(!I6.has($[Q]))X+="\\";X+=$[Q]}return X}function a($,X,Q,Y){if($.format||$.anyOf?.some((G)=>G.format)){if(!$.anyOf)$.anyOf=[];if($.format){if($.anyOf.push({format:$.format,...$.errorMessage&&Y.errorMessages&&{errorMessage:{format:$.errorMessage.format}}}),delete $.format,$.errorMessage){if(delete $.errorMessage.format,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.anyOf.push({format:X,...Q&&Y.errorMessages&&{errorMessage:{format:Q}}})}else E($,"format",X,Q,Y)}function T($,X,Q,Y){if($.pattern||$.allOf?.some((G)=>G.pattern)){if(!$.allOf)$.allOf=[];if($.pattern){if($.allOf.push({pattern:$.pattern,...$.errorMessage&&Y.errorMessages&&{errorMessage:{pattern:$.errorMessage.pattern}}}),delete $.pattern,$.errorMessage){if(delete $.errorMessage.pattern,Object.keys($.errorMessage).length===0)delete $.errorMessage}}$.allOf.push({pattern:t0(X,Y),...Q&&Y.errorMessages&&{errorMessage:{pattern:Q}}})}else E($,"pattern",t0(X,Y),Q,Y)}function t0($,X){if(!X.applyRegexFlags||!$.flags)return $.source;let Q={i:$.flags.includes("i"),m:$.flags.includes("m"),s:$.flags.includes("s")},Y=Q.i?$.source.toLowerCase():$.source,G="",W=!1,H=!1,B=!1;for(let D=0;D<Y.length;D++){if(W){G+=Y[D],W=!1;continue}if(Q.i){if(H){if(Y[D].match(/[a-z]/)){if(B)G+=Y[D],G+=`${Y[D-2]}-${Y[D]}`.toUpperCase(),B=!1;else if(Y[D+1]==="-"&&Y[D+2]?.match(/[a-z]/))G+=Y[D],B=!0;else G+=`${Y[D]}${Y[D].toUpperCase()}`;continue}}else if(Y[D].match(/[a-z]/)){G+=`[${Y[D]}${Y[D].toUpperCase()}]`;continue}}if(Q.m){if(Y[D]==="^"){G+=`(^|(?<=[\r
3
- ]))`;continue}else if(Y[D]==="$"){G+=`($|(?=[\r
4
- ]))`;continue}}if(Q.s&&Y[D]==="."){G+=H?`${Y[D]}\r
5
- `:`[${Y[D]}\r
6
- ]`;continue}if(G+=Y[D],Y[D]==="\\")W=!0;else if(H&&Y[D]==="]")H=!1;else if(!H&&Y[D]==="[")H=!0}try{new RegExp(G)}catch{return console.warn(`Could not convert regex pattern at ${X.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),$.source}return G}function F3($,X){if(X.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(X.target==="openApi3"&&$.keyType?._def.typeName===_.ZodEnum)return{type:"object",required:$.keyType._def.values,properties:$.keyType._def.values.reduce((Y,G)=>({...Y,[G]:b($.valueType._def,{...X,currentPath:[...X.currentPath,"properties",G]})??S(X)}),{}),additionalProperties:X.rejectedAdditionalProperties};let Q={type:"object",additionalProperties:b($.valueType._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]})??X.allowedAdditionalProperties};if(X.target==="openApi3")return Q;if($.keyType?._def.typeName===_.ZodString&&$.keyType._def.checks?.length){let{type:Y,...G}=S3($.keyType._def,X);return{...Q,propertyNames:G}}else if($.keyType?._def.typeName===_.ZodEnum)return{...Q,propertyNames:{enum:$.keyType._def.values}};else if($.keyType?._def.typeName===_.ZodBranded&&$.keyType._def.type._def.typeName===_.ZodString&&$.keyType._def.type._def.checks?.length){let{type:Y,...G}=E3($.keyType._def,X);return{...Q,propertyNames:G}}return Q}function s0($,X){if(X.mapStrategy==="record")return F3($,X);let Q=b($.keyType._def,{...X,currentPath:[...X.currentPath,"items","items","0"]})||S(X),Y=b($.valueType._def,{...X,currentPath:[...X.currentPath,"items","items","1"]})||S(X);return{type:"array",maxItems:125,items:{type:"array",items:[Q,Y],minItems:2,maxItems:2}}}function e0($){let X=$.values,Y=Object.keys($.values).filter((W)=>{return typeof X[X[W]]!=="number"}).map((W)=>X[W]),G=Array.from(new Set(Y.map((W)=>typeof W)));return{type:G.length===1?G[0]==="string"?"string":"number":["string","number"],enum:Y}}function $1($){return $.target==="openAi"?void 0:{not:S({...$,currentPath:[...$.currentPath,"not"]})}}function X1($){return $.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var c$={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Y1($,X){if(X.target==="openApi3")return Q1($,X);let Q=$.options instanceof Map?Array.from($.options.values()):$.options;if(Q.every((Y)=>(Y._def.typeName in c$)&&(!Y._def.checks||!Y._def.checks.length))){let Y=Q.reduce((G,W)=>{let H=c$[W._def.typeName];return H&&!G.includes(H)?[...G,H]:G},[]);return{type:Y.length>1?Y:Y[0]}}else if(Q.every((Y)=>Y._def.typeName==="ZodLiteral"&&!Y.description)){let Y=Q.reduce((G,W)=>{let H=typeof W._def.value;switch(H){case"string":case"number":case"boolean":return[...G,H];case"bigint":return[...G,"integer"];case"object":if(W._def.value===null)return[...G,"null"];case"symbol":case"undefined":case"function":default:return G}},[]);if(Y.length===Q.length){let G=Y.filter((W,H,B)=>B.indexOf(W)===H);return{type:G.length>1?G:G[0],enum:Q.reduce((W,H)=>{return W.includes(H._def.value)?W:[...W,H._def.value]},[])}}}else if(Q.every((Y)=>Y._def.typeName==="ZodEnum"))return{type:"string",enum:Q.reduce((Y,G)=>[...Y,...G._def.values.filter((W)=>!Y.includes(W))],[])};return Q1($,X)}var Q1=($,X)=>{let Q=($.options instanceof Map?Array.from($.options.values()):$.options).map((Y,G)=>b(Y._def,{...X,currentPath:[...X.currentPath,"anyOf",`${G}`]})).filter((Y)=>!!Y&&(!X.strictUnions||typeof Y==="object"&&Object.keys(Y).length>0));return Q.length?{anyOf:Q}:void 0};function G1($,X){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes($.innerType._def.typeName)&&(!$.innerType._def.checks||!$.innerType._def.checks.length)){if(X.target==="openApi3")return{type:c$[$.innerType._def.typeName],nullable:!0};return{type:[c$[$.innerType._def.typeName],"null"]}}if(X.target==="openApi3"){let Y=b($.innerType._def,{...X,currentPath:[...X.currentPath]});if(Y&&"$ref"in Y)return{allOf:[Y],nullable:!0};return Y&&{...Y,nullable:!0}}let Q=b($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","0"]});return Q&&{anyOf:[Q,{type:"null"}]}}function J1($,X){let Q={type:"number"};if(!$.checks)return Q;for(let Y of $.checks)switch(Y.kind){case"int":Q.type="integer",i3(Q,"type",Y.message,X);break;case"min":if(X.target==="jsonSchema7")if(Y.inclusive)E(Q,"minimum",Y.value,Y.message,X);else E(Q,"exclusiveMinimum",Y.value,Y.message,X);else{if(!Y.inclusive)Q.exclusiveMinimum=!0;E(Q,"minimum",Y.value,Y.message,X)}break;case"max":if(X.target==="jsonSchema7")if(Y.inclusive)E(Q,"maximum",Y.value,Y.message,X);else E(Q,"exclusiveMaximum",Y.value,Y.message,X);else{if(!Y.inclusive)Q.exclusiveMaximum=!0;E(Q,"maximum",Y.value,Y.message,X)}break;case"multipleOf":E(Q,"multipleOf",Y.value,Y.message,X);break}return Q}function W1($,X){let Q=X.target==="openAi",Y={type:"object",properties:{}},G=[],W=$.shape();for(let B in W){let D=W[B];if(D===void 0||D._def===void 0)continue;let V=y6(D);if(V&&Q){if(D._def.typeName==="ZodOptional")D=D._def.innerType;if(!D.isNullable())D=D.nullable();V=!1}let j=b(D._def,{...X,currentPath:[...X.currentPath,"properties",B],propertyPath:[...X.currentPath,"properties",B]});if(j===void 0)continue;if(Y.properties[B]=j,!V)G.push(B)}if(G.length)Y.required=G;let H=x6($,X);if(H!==void 0)Y.additionalProperties=H;return Y}function x6($,X){if($.catchall._def.typeName!=="ZodNever")return b($.catchall._def,{...X,currentPath:[...X.currentPath,"additionalProperties"]});switch($.unknownKeys){case"passthrough":return X.allowedAdditionalProperties;case"strict":return X.rejectedAdditionalProperties;case"strip":return X.removeAdditionalStrategy==="strict"?X.allowedAdditionalProperties:X.rejectedAdditionalProperties}}function y6($){try{return $.isOptional()}catch{return!0}}var H1=($,X)=>{if(X.currentPath.toString()===X.propertyPath?.toString())return b($.innerType._def,X);let Q=b($.innerType._def,{...X,currentPath:[...X.currentPath,"anyOf","1"]});return Q?{anyOf:[{not:S(X)},Q]}:S(X)};var B1=($,X)=>{if(X.pipeStrategy==="input")return b($.in._def,X);else if(X.pipeStrategy==="output")return b($.out._def,X);let Q=b($.in._def,{...X,currentPath:[...X.currentPath,"allOf","0"]}),Y=b($.out._def,{...X,currentPath:[...X.currentPath,"allOf",Q?"1":"0"]});return{allOf:[Q,Y].filter((G)=>G!==void 0)}};function D1($,X){return b($.type._def,X)}function w1($,X){let Y={type:"array",uniqueItems:!0,items:b($.valueType._def,{...X,currentPath:[...X.currentPath,"items"]})};if($.minSize)E(Y,"minItems",$.minSize.value,$.minSize.message,X);if($.maxSize)E(Y,"maxItems",$.maxSize.value,$.maxSize.message,X);return Y}function _1($,X){if($.rest)return{type:"array",minItems:$.items.length,items:$.items.map((Q,Y)=>b(Q._def,{...X,currentPath:[...X.currentPath,"items",`${Y}`]})).reduce((Q,Y)=>Y===void 0?Q:[...Q,Y],[]),additionalItems:b($.rest._def,{...X,currentPath:[...X.currentPath,"additionalItems"]})};else return{type:"array",minItems:$.items.length,maxItems:$.items.length,items:$.items.map((Q,Y)=>b(Q._def,{...X,currentPath:[...X.currentPath,"items",`${Y}`]})).reduce((Q,Y)=>Y===void 0?Q:[...Q,Y],[])}}function M1($){return{not:S($)}}function V1($){return S($)}var N1=($,X)=>{return b($.innerType._def,X)};var O1=($,X,Q)=>{switch(X){case _.ZodString:return S3($,Q);case _.ZodNumber:return J1($,Q);case _.ZodObject:return W1($,Q);case _.ZodBigInt:return c0($,Q);case _.ZodBoolean:return n0();case _.ZodDate:return d3($,Q);case _.ZodUndefined:return M1(Q);case _.ZodNull:return X1(Q);case _.ZodArray:return u0($,Q);case _.ZodUnion:case _.ZodDiscriminatedUnion:return Y1($,Q);case _.ZodIntersection:return a0($,Q);case _.ZodTuple:return _1($,Q);case _.ZodRecord:return F3($,Q);case _.ZodLiteral:return r0($,Q);case _.ZodEnum:return o0($);case _.ZodNativeEnum:return e0($);case _.ZodNullable:return G1($,Q);case _.ZodOptional:return H1($,Q);case _.ZodMap:return s0($,Q);case _.ZodSet:return w1($,Q);case _.ZodLazy:return()=>$.getter()._def;case _.ZodPromise:return D1($,Q);case _.ZodNaN:case _.ZodNever:return $1(Q);case _.ZodEffects:return d0($,Q);case _.ZodAny:return S(Q);case _.ZodUnknown:return V1(Q);case _.ZodDefault:return i0($,Q);case _.ZodBranded:return E3($,Q);case _.ZodReadonly:return N1($,Q);case _.ZodCatch:return p0($,Q);case _.ZodPipeline:return B1($,Q);case _.ZodFunction:case _.ZodVoid:case _.ZodSymbol:return;default:return((Y)=>{return})(X)}};function b($,X,Q=!1){let Y=X.seen.get($);if(X.override){let B=X.override?.($,X,Y,Q);if(B!==g0)return B}if(Y&&!Q){let B=h6(Y,X);if(B!==void 0)return B}let G={def:$,path:X.currentPath,jsonSchema:void 0};X.seen.set($,G);let W=O1($,$.typeName,X),H=typeof W==="function"?b(W(),X):W;if(H)Z6($,X,H);if(X.postProcess){let B=X.postProcess(H,$,X);return G.jsonSchema=H,B}return G.jsonSchema=H,H}var h6=($,X)=>{switch(X.$refStrategy){case"root":return{$ref:$.path.join("/")};case"relative":return{$ref:L3(X.currentPath,$.path)};case"none":case"seen":{if($.path.length<X.currentPath.length&&$.path.every((Q,Y)=>X.currentPath[Y]===Q))return console.warn(`Recursive reference detected at ${X.currentPath.join("/")}! Defaulting to any`),S(X);return X.$refStrategy==="seen"?S(X):void 0}}},Z6=($,X,Q)=>{if($.description){if(Q.description=$.description,X.markdownDescription)Q.markdownDescription=$.description}return Q};var z3=($,X)=>{let Q=m0(X),Y=typeof X==="object"&&X.definitions?Object.entries(X.definitions).reduce((D,[V,j])=>({...D,[V]:b(j._def,{...Q,currentPath:[...Q.basePath,Q.definitionPath,V]},!0)??S(Q)}),{}):void 0,G=typeof X==="string"?X:X?.nameStrategy==="title"?void 0:X?.name,W=b($._def,G===void 0?Q:{...Q,currentPath:[...Q.basePath,Q.definitionPath,G]},!1)??S(Q),H=typeof X==="object"&&X.name!==void 0&&X.nameStrategy==="title"?X.name:void 0;if(H!==void 0)W.title=H;if(Q.flags.hasReferencedOpenAiAnyType){if(!Y)Y={};if(!Y[Q.openAiAnyTypeName])Y[Q.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:Q.$refStrategy==="relative"?"1":[...Q.basePath,Q.definitionPath,Q.openAiAnyTypeName].join("/")}}}let B=G===void 0?Y?{...W,[Q.definitionPath]:Y}:W:{$ref:[...Q.$refStrategy==="relative"?[]:Q.basePath,Q.definitionPath,G].join("/"),[Q.definitionPath]:{...Y,[G]:W}};if(Q.target==="jsonSchema7")B.$schema="http://json-schema.org/draft-07/schema#";else if(Q.target==="jsonSchema2019-09"||Q.target==="openAi")B.$schema="https://json-schema.org/draft/2019-09/schema#";if(Q.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};_$();u$();_$();var r3;(function($){$.Completable="McpCompletable"})(r3||(r3={}));class n$ extends q{_parse($){let{ctx:X}=this._processInputParams($),Q=X.data;return this._def.type._parse({data:Q,path:X.path,parent:X})}unwrap(){return this._def.type}}n$.create=($,X)=>{return new n$({type:$,typeName:r3.Completable,complete:X.complete,...g6(X)})};function g6($){if(!$)return{};let{errorMap:X,invalid_type_error:Q,required_error:Y,description:G}=$;if(X&&(Q||Y))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(X)return{errorMap:X,description:G};return{errorMap:(H,B)=>{var D,V;let{message:j}=$;if(H.code==="invalid_enum_value")return{message:j!==null&&j!==void 0?j:B.defaultError};if(typeof B.data==="undefined")return{message:(D=j!==null&&j!==void 0?j:Y)!==null&&D!==void 0?D:B.defaultError};if(H.code!=="invalid_type")return{message:B.defaultError};return{message:(V=j!==null&&j!==void 0?j:Q)!==null&&V!==void 0?V:B.defaultError}},description:G}}class t3{constructor($,X){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new p3($,X)}async connect($){return await this.server.connect($)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(U3.shape.method.value),this.server.assertCanSetRequestHandler(q3.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(U3,()=>({tools:Object.entries(this._registeredTools).filter(([,$])=>$.enabled).map(([$,X])=>{let Q={name:$,description:X.description,inputSchema:X.inputSchema?z3(X.inputSchema,{strictUnions:!0}):l6,annotations:X.annotations};if(X.outputSchema)Q.outputSchema=z3(X.outputSchema,{strictUnions:!0});return Q})})),this.server.setRequestHandler(q3,async($,X)=>{let Q=this._registeredTools[$.params.name];if(!Q)throw new v(z.InvalidParams,`Tool ${$.params.name} not found`);if(!Q.enabled)throw new v(z.InvalidParams,`Tool ${$.params.name} disabled`);let Y;if(Q.inputSchema){let G=await Q.inputSchema.safeParseAsync($.params.arguments);if(!G.success)throw new v(z.InvalidParams,`Invalid arguments for tool ${$.params.name}: ${G.error.message}`);let W=G.data,H=Q.callback;try{Y=await Promise.resolve(H(W,X))}catch(B){Y={content:[{type:"text",text:B instanceof Error?B.message:String(B)}],isError:!0}}}else{let G=Q.callback;try{Y=await Promise.resolve(G(X))}catch(W){Y={content:[{type:"text",text:W instanceof Error?W.message:String(W)}],isError:!0}}}if(Q.outputSchema){if(!Y.structuredContent)throw new v(z.InvalidParams,`Tool ${$.params.name} has an output schema but no structured content was provided`);let G=await Q.outputSchema.safeParseAsync(Y.structuredContent);if(!G.success)throw new v(z.InvalidParams,`Invalid structured content for tool ${$.params.name}: ${G.error.message}`)}return Y}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(K3.shape.method.value),this.server.setRequestHandler(K3,async($)=>{switch($.params.ref.type){case"ref/prompt":return this.handlePromptCompletion($,$.params.ref);case"ref/resource":return this.handleResourceCompletion($,$.params.ref);default:throw new v(z.InvalidParams,`Invalid completion reference: ${$.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion($,X){let Q=this._registeredPrompts[X.name];if(!Q)throw new v(z.InvalidParams,`Prompt ${X.name} not found`);if(!Q.enabled)throw new v(z.InvalidParams,`Prompt ${X.name} disabled`);if(!Q.argsSchema)return R3;let Y=Q.argsSchema.shape[$.params.argument.name];if(!(Y instanceof n$))return R3;let W=await Y._def.complete($.params.argument.value);return A1(W)}async handleResourceCompletion($,X){let Q=Object.values(this._registeredResourceTemplates).find((W)=>W.resourceTemplate.uriTemplate.toString()===X.uri);if(!Q){if(this._registeredResources[X.uri])return R3;throw new v(z.InvalidParams,`Resource template ${$.params.ref.uri} not found`)}let Y=Q.resourceTemplate.completeCallback($.params.argument.name);if(!Y)return R3;let G=await Y($.params.argument.value);return A1(G)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(_3.shape.method.value),this.server.assertCanSetRequestHandler(M3.shape.method.value),this.server.assertCanSetRequestHandler(V3.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(_3,async($,X)=>{let Q=Object.entries(this._registeredResources).filter(([G,W])=>W.enabled).map(([G,W])=>({uri:G,name:W.name,...W.metadata})),Y=[];for(let G of Object.values(this._registeredResourceTemplates)){if(!G.resourceTemplate.listCallback)continue;let W=await G.resourceTemplate.listCallback(X);for(let H of W.resources)Y.push({...H,...G.metadata})}return{resources:[...Q,...Y]}}),this.server.setRequestHandler(M3,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([X,Q])=>({name:X,uriTemplate:Q.resourceTemplate.uriTemplate.toString(),...Q.metadata}))}}),this.server.setRequestHandler(V3,async($,X)=>{let Q=new URL($.params.uri),Y=this._registeredResources[Q.toString()];if(Y){if(!Y.enabled)throw new v(z.InvalidParams,`Resource ${Q} disabled`);return Y.readCallback(Q,X)}for(let G of Object.values(this._registeredResourceTemplates)){let W=G.resourceTemplate.uriTemplate.match(Q.toString());if(W)return G.readCallback(Q,W,X)}throw new v(z.InvalidParams,`Resource ${Q} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(N3.shape.method.value),this.server.assertCanSetRequestHandler(O3.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(N3,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,$])=>$.enabled).map(([$,X])=>{return{name:$,description:X.description,arguments:X.argsSchema?u6(X.argsSchema):void 0}})})),this.server.setRequestHandler(O3,async($,X)=>{let Q=this._registeredPrompts[$.params.name];if(!Q)throw new v(z.InvalidParams,`Prompt ${$.params.name} not found`);if(!Q.enabled)throw new v(z.InvalidParams,`Prompt ${$.params.name} disabled`);if(Q.argsSchema){let Y=await Q.argsSchema.safeParseAsync($.params.arguments);if(!Y.success)throw new v(z.InvalidParams,`Invalid arguments for prompt ${$.params.name}: ${Y.error.message}`);let G=Y.data,W=Q.callback;return await Promise.resolve(W(G,X))}else{let Y=Q.callback;return await Promise.resolve(Y(X))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource($,X,...Q){let Y;if(typeof Q[0]==="object")Y=Q.shift();let G=Q[0];if(typeof X==="string"){if(this._registeredResources[X])throw new Error(`Resource ${X} is already registered`);let W={name:$,metadata:Y,readCallback:G,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({uri:null}),update:(H)=>{if(typeof H.uri!=="undefined"&&H.uri!==X){if(delete this._registeredResources[X],H.uri)this._registeredResources[H.uri]=W}if(typeof H.name!=="undefined")W.name=H.name;if(typeof H.metadata!=="undefined")W.metadata=H.metadata;if(typeof H.callback!=="undefined")W.readCallback=H.callback;if(typeof H.enabled!=="undefined")W.enabled=H.enabled;this.sendResourceListChanged()}};return this._registeredResources[X]=W,this.setResourceRequestHandlers(),this.sendResourceListChanged(),W}else{if(this._registeredResourceTemplates[$])throw new Error(`Resource template ${$} is already registered`);let W={resourceTemplate:X,metadata:Y,readCallback:G,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({name:null}),update:(H)=>{if(typeof H.name!=="undefined"&&H.name!==$){if(delete this._registeredResourceTemplates[$],H.name)this._registeredResourceTemplates[H.name]=W}if(typeof H.template!=="undefined")W.resourceTemplate=H.template;if(typeof H.metadata!=="undefined")W.metadata=H.metadata;if(typeof H.callback!=="undefined")W.readCallback=H.callback;if(typeof H.enabled!=="undefined")W.enabled=H.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[$]=W,this.setResourceRequestHandlers(),this.sendResourceListChanged(),W}}_createRegisteredTool($,X,Q,Y,G,W){let H={description:X,inputSchema:Q===void 0?void 0:J.object(Q),outputSchema:Y===void 0?void 0:J.object(Y),annotations:G,callback:W,enabled:!0,disable:()=>H.update({enabled:!1}),enable:()=>H.update({enabled:!0}),remove:()=>H.update({name:null}),update:(B)=>{if(typeof B.name!=="undefined"&&B.name!==$){if(delete this._registeredTools[$],B.name)this._registeredTools[B.name]=H}if(typeof B.description!=="undefined")H.description=B.description;if(typeof B.paramsSchema!=="undefined")H.inputSchema=J.object(B.paramsSchema);if(typeof B.callback!=="undefined")H.callback=B.callback;if(typeof B.annotations!=="undefined")H.annotations=B.annotations;if(typeof B.enabled!=="undefined")H.enabled=B.enabled;this.sendToolListChanged()}};return this._registeredTools[$]=H,this.setToolRequestHandlers(),this.sendToolListChanged(),H}tool($,...X){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let Q,Y,G,W;if(typeof X[0]==="string")Q=X.shift();if(X.length>1){let B=X[0];if(j1(B)){if(Y=X.shift(),X.length>1&&typeof X[0]==="object"&&X[0]!==null&&!j1(X[0]))W=X.shift()}else if(typeof B==="object"&&B!==null)W=X.shift()}let H=X[0];return this._createRegisteredTool($,Q,Y,G,W,H)}registerTool($,X,Q){if(this._registeredTools[$])throw new Error(`Tool ${$} is already registered`);let{description:Y,inputSchema:G,outputSchema:W,annotations:H}=X;return this._createRegisteredTool($,Y,G,W,H,Q)}prompt($,...X){if(this._registeredPrompts[$])throw new Error(`Prompt ${$} is already registered`);let Q;if(typeof X[0]==="string")Q=X.shift();let Y;if(X.length>1)Y=X.shift();let G=X[0],W={description:Q,argsSchema:Y===void 0?void 0:J.object(Y),callback:G,enabled:!0,disable:()=>W.update({enabled:!1}),enable:()=>W.update({enabled:!0}),remove:()=>W.update({name:null}),update:(H)=>{if(typeof H.name!=="undefined"&&H.name!==$){if(delete this._registeredPrompts[$],H.name)this._registeredPrompts[H.name]=W}if(typeof H.description!=="undefined")W.description=H.description;if(typeof H.argsSchema!=="undefined")W.argsSchema=J.object(H.argsSchema);if(typeof H.callback!=="undefined")W.callback=H.callback;if(typeof H.enabled!=="undefined")W.enabled=H.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[$]=W,this.setPromptRequestHandlers(),this.sendPromptListChanged(),W}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var l6={type:"object"};function j1($){if(typeof $!=="object"||$===null)return!1;return Object.keys($).length===0||Object.values($).some(m6)}function m6($){return $!==null&&typeof $==="object"&&"parse"in $&&typeof $.parse==="function"&&"safeParse"in $&&typeof $.safeParse==="function"}function u6($){return Object.entries($.shape).map(([X,Q])=>({name:X,description:Q.description,required:!Q.isOptional()}))}function A1($){return{completion:{values:$.slice(0,100),total:$.length,hasMore:$.length>100}}}var R3={completion:{values:[],hasMore:!1}};function b1($,X){let Q=process.argv,Y=`--${$}=`;for(let G of Q)if(G.startsWith(Y))return G.substring(Y.length);return X}p$();var n6=M$("FigmaConfig",1),p6=b1("figma-api-key")||process.env.FIGMA_API_KEY||"",K1="F2C MCP",L1=process.env.FIGMA_VERSION||"0.0.1";n6.debug("DEFAULT_PERSONAL_TOKEN",p6);_$();p$();var z1=require("node:crypto");p$();var k=M$("ptdTool"),x=null,i$=0,E1=10,i6=1000,k3=null,d6=process.argv.slice(2),S1=d6.find(($)=>$.startsWith("--server=")),v3=S1?S1.split("=")[1]:"localhost",F1=v3==="localhost"?`ws://${v3}`:`wss://${v3}`,J$=new Map;function s3($=3055){if(x&&x.readyState===WebSocket.OPEN){k.info("Already connected to Figma");return}let X=v3==="localhost"?`${F1}:${$}`:F1;k.info(`Connecting to Figma socket server at ${X}...`),x=new WebSocket(X),k.info("Connecting",x.readyState,WebSocket.OPEN),x.onopen=()=>{k.info("Successfully connected to Figma socket server"),k3=null,i$=0},x.onmessage=(Q)=>{try{let Y=JSON.parse(Q.data);if(k.log("onmessage"+JSON.stringify(Y)),Y.type==="ping"){x?.send(JSON.stringify({type:"pong"}));return}let G=Y.message;if(G.id&&J$.has(G.id)&&G.result){let W=J$.get(G.id);if(clearTimeout(W.timeout),G.error)k.error(`Error from Figma: ${G.error}`),W.reject(new Error(G.error));else if(G.result)W.resolve(G.result);J$.delete(G.id)}else k.info(`Received broadcast message: ${JSON.stringify(G)}`)}catch(Y){k.error(`Error parsing message: ${Y instanceof Error?Y.message:String(Y)}`)}},x.onerror=(Q)=>{k.error(`Socket error: ${Q instanceof Error?Q.message:String(Q)}`,Q)},x.onclose=(Q)=>{k.info(`Disconnected from Figma socket server, Code: ${Q.code}, Reason: ${Q.reason}`),x=null;for(let[Y,G]of J$.entries())clearTimeout(G.timeout),G.reject(new Error("Connection closed")),J$.delete(Y);if(i$<E1){let Y=i6*Math.pow(2,i$);k.info(`Attempting to reconnect in ${Y/1000} seconds... (Attempt ${i$+1}/${E1})`),setTimeout(()=>s3($),Y),i$++}else k.error("Max reconnection attempts reached. Will not try again.")}}async function R1(){try{console.log("FigmaMCP server starting...");let $=process.env.PORT?parseInt(process.env.PORT,10):3055;s3($)}catch($){k.warn(`Could not connect to Figma initially: ${$ instanceof Error?$.message:String($)}`),k.warn("Will try to connect when the first command is sent")}k.info("FigmaMCP server running on stdio")}async function v1($){if(!x||x.readyState!==WebSocket.OPEN)throw new Error("Not connected to Figma");try{await K("join",{channel:$}),k3=$,k.info(`Joined channel: ${$}`)}catch(X){throw k.error(`Failed to join channel: ${X instanceof Error?X.message:String(X)}`),X}}function K($,X={},Q=30000){return new Promise((Y,G)=>{if(!x||x.readyState!==WebSocket.OPEN){s3(),G(new Error("Not connected to Figma. Attempting to connect..."));return}if($!=="join"&&!k3){G(new Error("Must join a channel before sending commands"));return}let H=z1.randomUUID(),B={id:H,type:$==="join"?"join":"message",...$==="join"?{channel:X.channel}:{channel:k3},message:{id:H,command:$,params:{...X,commandId:H}}};k.info(`Sending command to Figma: ${JSON.stringify(B)}`);let D=setTimeout(()=>{if(J$.has(H)){let{reject:V,...j}=J$.get(H);k.error(`Request to Figma timed out after ${Q/1000} seconds. Request details: ${JSON.stringify(j)}`),J$.delete(H),G(new Error("Request to Figma timed out"))}},Q);J$.set(H,{resolve:Y,reject:G,timeout:D,lastActivity:Date.now()}),k.info(`Sending command to Figma: ${$}`),k.debug(`Request details: ${JSON.stringify(B)}`),x.send(JSON.stringify(B))})}function e3($){if($.startsWith("#"))return $;let X=Math.round($.r*255),Q=Math.round($.g*255),Y=Math.round($.b*255),G=Math.round($.a*255);return`#${X.toString(16).padStart(2,"0")}${Q.toString(16).padStart(2,"0")}${Y.toString(16).padStart(2,"0")}${G===255?"":G.toString(16).padStart(2,"0")}`}function f3($){if($.type==="VECTOR")return null;let X={id:$.id,name:$.name,type:$.type};if($.fills&&$.fills.length>0)X.fills=$.fills.map((Q)=>{let Y={...Q};if(delete Y.boundVariables,delete Y.imageRef,Y.gradientStops)Y.gradientStops=Y.gradientStops.map((G)=>{let W={...G};if(W.color)W.color=e3(W.color);return delete W.boundVariables,W});if(Y.color)Y.color=e3(Y.color);return Y});if($.strokes&&$.strokes.length>0)X.strokes=$.strokes.map((Q)=>{let Y={...Q};if(delete Y.boundVariables,Y.color)Y.color=e3(Y.color);return Y});if($.cornerRadius!==void 0)X.cornerRadius=$.cornerRadius;if($.absoluteBoundingBox)X.absoluteBoundingBox=$.absoluteBoundingBox;if($.characters)X.characters=$.characters;if($.style)X.style={fontFamily:$.style.fontFamily,fontStyle:$.style.fontStyle,fontWeight:$.style.fontWeight,fontSize:$.style.fontSize,textAlignHorizontal:$.style.textAlignHorizontal,letterSpacing:$.style.letterSpacing,lineHeightPx:$.style.lineHeightPx};if($.children)X.children=$.children.map((Q)=>f3(Q)).filter((Q)=>Q!==null);return X}var o6=M$("ptdTool");function k1($){$.tool("get_document_info","Get detailed information about the current Figma document",{},async()=>{try{let X=await K("get_document_info");return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting document info: ${X instanceof Error?X.message:String(X)}`}]}}}),$.tool("get_selection","Get information about the current selection in Figma",{},async()=>{try{let X=await K("get_selection");return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting selection: ${X instanceof Error?X.message:String(X)}`}]}}}),$.tool("get_node_info","Get detailed information about a specific node in Figma",{nodeId:J.string().describe("The ID of the node to get information about")},async({nodeId:X})=>{try{let Q=await K("get_node_info",{nodeId:X});return{content:[{type:"text",text:JSON.stringify(f3(Q))}]}}catch(Q){return{content:[{type:"text",text:`Error getting node info: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("get_nodes_info","Get detailed information about multiple nodes in Figma",{nodeIds:J.array(J.string()).describe("Array of node IDs to get information about")},async({nodeIds:X})=>{try{let Q=await Promise.all(X.map(async(Y)=>{let G=await K("get_node_info",{nodeId:Y});return{nodeId:Y,info:G}}));return{content:[{type:"text",text:JSON.stringify(Q.map((Y)=>f3(Y.info)))}]}}catch(Q){return{content:[{type:"text",text:`Error getting nodes info: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("create_rectangle","Create a new rectangle in Figma",{x:J.number().describe("X position"),y:J.number().describe("Y position"),width:J.number().describe("Width of the rectangle"),height:J.number().describe("Height of the rectangle"),name:J.string().optional().describe("Optional name for the rectangle"),parentId:J.string().optional().describe("Optional parent node ID to append the rectangle to")},async({x:X,y:Q,width:Y,height:G,name:W,parentId:H})=>{try{let B=await K("create_rectangle",{x:X,y:Q,width:Y,height:G,name:W||"Rectangle",parentId:H});return{content:[{type:"text",text:`Created rectangle "${JSON.stringify(B)}"`}]}}catch(B){return{content:[{type:"text",text:`Error creating rectangle: ${B instanceof Error?B.message:String(B)}`}]}}}),$.tool("create_frame","Create a new frame in Figma",{x:J.number().describe("X position"),y:J.number().describe("Y position"),width:J.number().describe("Width of the frame"),height:J.number().describe("Height of the frame"),name:J.string().optional().describe("Optional name for the frame"),parentId:J.string().optional().describe("Optional parent node ID to append the frame to"),fillColor:J.object({r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Fill color in RGBA format"),strokeColor:J.object({r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Stroke color in RGBA format"),strokeWeight:J.number().positive().optional().describe("Stroke weight"),layoutMode:J.enum(["NONE","HORIZONTAL","VERTICAL"]).optional().describe("Auto-layout mode for the frame"),layoutWrap:J.enum(["NO_WRAP","WRAP"]).optional().describe("Whether the auto-layout frame wraps its children"),paddingTop:J.number().optional().describe("Top padding for auto-layout frame"),paddingRight:J.number().optional().describe("Right padding for auto-layout frame"),paddingBottom:J.number().optional().describe("Bottom padding for auto-layout frame"),paddingLeft:J.number().optional().describe("Left padding for auto-layout frame"),primaryAxisAlignItems:J.enum(["MIN","MAX","CENTER","SPACE_BETWEEN"]).optional().describe("Primary axis alignment for auto-layout frame. Note: When set to SPACE_BETWEEN, itemSpacing will be ignored as children will be evenly spaced."),counterAxisAlignItems:J.enum(["MIN","MAX","CENTER","BASELINE"]).optional().describe("Counter axis alignment for auto-layout frame"),layoutSizingHorizontal:J.enum(["FIXED","HUG","FILL"]).optional().describe("Horizontal sizing mode for auto-layout frame"),layoutSizingVertical:J.enum(["FIXED","HUG","FILL"]).optional().describe("Vertical sizing mode for auto-layout frame"),itemSpacing:J.number().optional().describe("Distance between children in auto-layout frame. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN.")},async({x:X,y:Q,width:Y,height:G,name:W,parentId:H,fillColor:B,strokeColor:D,strokeWeight:V,layoutMode:j,layoutWrap:P,paddingTop:I,paddingRight:l,paddingBottom:R,paddingLeft:d$,primaryAxisAlignItems:o$,counterAxisAlignItems:a$,layoutSizingHorizontal:P3,layoutSizingVertical:y,itemSpacing:X$})=>{try{let G0=await K("create_frame",{x:X,y:Q,width:Y,height:G,name:W||"Frame",parentId:H,fillColor:B||{r:1,g:1,b:1,a:1},strokeColor:D,strokeWeight:V,layoutMode:j,layoutWrap:P,paddingTop:I,paddingRight:l,paddingBottom:R,paddingLeft:d$,primaryAxisAlignItems:o$,counterAxisAlignItems:a$,layoutSizingHorizontal:P3,layoutSizingVertical:y,itemSpacing:X$});return{content:[{type:"text",text:`Created frame "${G0.name}" with ID: ${G0.id}. Use the ID as the parentId to appendChild inside this frame.`}]}}catch(r){return{content:[{type:"text",text:`Error creating frame: ${r instanceof Error?r.message:String(r)}`}]}}}),$.tool("create_text","Create a new text element in Figma",{x:J.number().describe("X position"),y:J.number().describe("Y position"),text:J.string().describe("Text content"),fontSize:J.number().optional().describe("Font size (default: 14)"),fontWeight:J.number().optional().describe("Font weight (e.g., 400 for Regular, 700 for Bold)"),fontColor:J.object({r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)")}).optional().describe("Font color in RGBA format"),name:J.string().optional().describe("Semantic layer name for the text node"),parentId:J.string().optional().describe("Optional parent node ID to append the text to")},async({x:X,y:Q,text:Y,fontSize:G,fontWeight:W,fontColor:H,name:B,parentId:D})=>{try{let j=await K("create_text",{x:X,y:Q,text:Y,fontSize:G||14,fontWeight:W||400,fontColor:H||{r:0,g:0,b:0,a:1},name:B||"Text",parentId:D});return{content:[{type:"text",text:`Created text "${j.name}" with ID: ${j.id}`}]}}catch(V){return{content:[{type:"text",text:`Error creating text: ${V instanceof Error?V.message:String(V)}`}]}}}),$.tool("set_fill_color","Set the fill color of a node in Figma can be TextNode or FrameNode",{nodeId:J.string().describe("The ID of the node to modify"),r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)")},async({nodeId:X,r:Q,g:Y,b:G,a:W})=>{try{return{content:[{type:"text",text:`Set fill color of node "${(await K("set_fill_color",{nodeId:X,color:{r:Q,g:Y,b:G,a:W||1}})).name}" to RGBA(${Q}, ${Y}, ${G}, ${W||1})`}]}}catch(H){return{content:[{type:"text",text:`Error setting fill color: ${H instanceof Error?H.message:String(H)}`}]}}}),$.tool("set_stroke_color","Set the stroke color of a node in Figma",{nodeId:J.string().describe("The ID of the node to modify"),r:J.number().min(0).max(1).describe("Red component (0-1)"),g:J.number().min(0).max(1).describe("Green component (0-1)"),b:J.number().min(0).max(1).describe("Blue component (0-1)"),a:J.number().min(0).max(1).optional().describe("Alpha component (0-1)"),weight:J.number().positive().optional().describe("Stroke weight")},async({nodeId:X,r:Q,g:Y,b:G,a:W,weight:H})=>{try{return{content:[{type:"text",text:`Set stroke color of node "${(await K("set_stroke_color",{nodeId:X,color:{r:Q,g:Y,b:G,a:W||1},weight:H||1})).name}" to RGBA(${Q}, ${Y}, ${G}, ${W||1}) with weight ${H||1}`}]}}catch(B){return{content:[{type:"text",text:`Error setting stroke color: ${B instanceof Error?B.message:String(B)}`}]}}}),$.tool("move_node","Move a node to a new position in Figma",{nodeId:J.string().describe("The ID of the node to move"),x:J.number().describe("New X position"),y:J.number().describe("New Y position")},async({nodeId:X,x:Q,y:Y})=>{try{return{content:[{type:"text",text:`Moved node "${(await K("move_node",{nodeId:X,x:Q,y:Y})).name}" to position (${Q}, ${Y})`}]}}catch(G){return{content:[{type:"text",text:`Error moving node: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("clone_node","Clone an existing node in Figma",{nodeId:J.string().describe("The ID of the node to clone"),x:J.number().optional().describe("New X position for the clone"),y:J.number().optional().describe("New Y position for the clone")},async({nodeId:X,x:Q,y:Y})=>{try{let W=await K("clone_node",{nodeId:X,x:Q,y:Y});return{content:[{type:"text",text:`Cloned node "${W.name}" with new ID: ${W.id}${Q!==void 0&&Y!==void 0?` at position (${Q}, ${Y})`:""}`}]}}catch(G){return{content:[{type:"text",text:`Error cloning node: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("resize_node","Resize a node in Figma",{nodeId:J.string().describe("The ID of the node to resize"),width:J.number().positive().describe("New width"),height:J.number().positive().describe("New height")},async({nodeId:X,width:Q,height:Y})=>{try{return{content:[{type:"text",text:`Resized node "${(await K("resize_node",{nodeId:X,width:Q,height:Y})).name}" to width ${Q} and height ${Y}`}]}}catch(G){return{content:[{type:"text",text:`Error resizing node: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("delete_multiple_nodes","Delete multiple nodes from Figma at once",{nodeIds:J.array(J.string()).describe("Array of node IDs to delete")},async({nodeIds:X})=>{try{let Q=await K("delete_multiple_nodes",{nodeIds:X});return{content:[{type:"text",text:JSON.stringify(Q)}]}}catch(Q){return{content:[{type:"text",text:`Error deleting multiple nodes: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("export_node_as_image","Export a node as an image from Figma",{nodeId:J.string().describe("The ID of the node to export"),format:J.enum(["PNG","JPG","SVG","PDF"]).optional().describe("Export format"),scale:J.number().positive().optional().describe("Export scale")},async({nodeId:X,format:Q,scale:Y})=>{try{let W=await K("export_node_as_image",{nodeId:X,format:Q||"PNG",scale:Y||1});return{content:[{type:"image",data:W.imageData,mimeType:W.mimeType||"image/png"}]}}catch(G){return{content:[{type:"text",text:`Error exporting node as image: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("set_text_content","Set the text content of an existing text node in Figma",{nodeId:J.string().describe("The ID of the text node to modify"),text:J.string().describe("New text content")},async({nodeId:X,text:Q})=>{try{return{content:[{type:"text",text:`Updated text content of node "${(await K("set_text_content",{nodeId:X,text:Q})).name}" to "${Q}"`}]}}catch(Y){return{content:[{type:"text",text:`Error setting text content: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.tool("get_styles","Get all styles from the current Figma document",{},async()=>{try{let X=await K("get_styles");return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting styles: ${X instanceof Error?X.message:String(X)}`}]}}}),$.tool("get_local_components","Get all local components from the Figma document",{},async()=>{try{let X=await K("get_local_components");return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting local components: ${X instanceof Error?X.message:String(X)}`}]}}}),$.tool("get_annotations","Get all annotations in the current document or specific node",{nodeId:J.string().optional().describe("Optional node ID to get annotations for specific node"),includeCategories:J.boolean().optional().default(!0).describe("Whether to include category information")},async({nodeId:X,includeCategories:Q})=>{try{let Y=await K("get_annotations",{nodeId:X,includeCategories:Q});return{content:[{type:"text",text:JSON.stringify(Y)}]}}catch(Y){return{content:[{type:"text",text:`Error getting annotations: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.tool("set_multiple_annotations","Set multiple annotations parallelly in a node",{nodeId:J.string().describe("The ID of the node containing the elements to annotate"),annotations:J.array(J.object({nodeId:J.string().describe("The ID of the node to annotate"),labelMarkdown:J.string().describe("The annotation text in markdown format"),categoryId:J.string().optional().describe("The ID of the annotation category"),annotationId:J.string().optional().describe("The ID of the annotation to update (if updating existing annotation)"),properties:J.array(J.object({type:J.string()})).optional().describe("Additional properties for the annotation")})).describe("Array of annotations to apply")},async({nodeId:X,annotations:Q},Y)=>{try{if(!Q||Q.length===0)return{content:[{type:"text",text:"No annotations provided"}]};let G={type:"text",text:`Starting annotation process for ${Q.length} nodes. This will be processed in batches of 5...`},W=0,H=Q.length,D=await K("set_multiple_annotations",{nodeId:X,annotations:Q}),V=D.annotationsApplied&&D.annotationsApplied>0,j=`
7
- Annotation process completed:
8
- - ${D.annotationsApplied||0} of ${H} successfully applied
9
- - ${D.annotationsFailed||0} failed
10
- - Processed in ${D.completedInChunks||1} batches
11
- `,I=(D.results||[]).filter((R)=>!R.success),l="";if(I.length>0)l=`
12
-
13
- Nodes that failed:
14
- ${I.map((R)=>`- ${R.nodeId}: ${R.error||"Unknown error"}`).join(`
15
- `)}`;return{content:[G,{type:"text",text:j+l}]}}catch(G){return{content:[{type:"text",text:`Error setting multiple annotations: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("create_component_instance","Create an instance of a component in Figma",{componentKey:J.string().describe("Key of the component to instantiate"),x:J.number().describe("X position"),y:J.number().describe("Y position")},async({componentKey:X,x:Q,y:Y})=>{try{let W=await K("create_component_instance",{componentKey:X,x:Q,y:Y});return{content:[{type:"text",text:JSON.stringify(W)}]}}catch(G){return{content:[{type:"text",text:`Error creating component instance: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("get_instance_overrides","Get all override properties from a selected component instance. These overrides can be applied to other instances, which will swap them to match the source component.",{nodeId:J.string().optional().describe("Optional ID of the component instance to get overrides from. If not provided, currently selected instance will be used.")},async({nodeId:X})=>{try{let Y=await K("get_instance_overrides",{instanceNodeId:X||null});return{content:[{type:"text",text:Y.success?`Successfully got instance overrides: ${Y.message}`:`Failed to get instance overrides: ${Y.message}`}]}}catch(Q){return{content:[{type:"text",text:`Error copying instance overrides: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("set_instance_overrides","Apply previously copied overrides to selected component instances. Target instances will be swapped to the source component and all copied override properties will be applied.",{sourceInstanceId:J.string().describe("ID of the source component instance"),targetNodeIds:J.array(J.string()).describe("Array of target instance IDs. Currently selected instances will be used.")},async({sourceInstanceId:X,targetNodeIds:Q})=>{try{let G=await K("set_instance_overrides",{sourceInstanceId:X,targetNodeIds:Q||[]});if(G.success){let W=G.results?.filter((H)=>H.success).length||0;return{content:[{type:"text",text:`Successfully applied ${G.totalCount||0} overrides to ${W} instances.`}]}}else return{content:[{type:"text",text:`Failed to set instance overrides: ${G.message}`}]}}catch(Y){return{content:[{type:"text",text:`Error setting instance overrides: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.tool("set_corner_radius","Set the corner radius of a node in Figma",{nodeId:J.string().describe("The ID of the node to modify"),radius:J.number().min(0).describe("Corner radius value"),corners:J.array(J.boolean()).length(4).optional().describe("Optional array of 4 booleans to specify which corners to round [topLeft, topRight, bottomRight, bottomLeft]")},async({nodeId:X,radius:Q,corners:Y})=>{try{return{content:[{type:"text",text:`Set corner radius of node "${(await K("set_corner_radius",{nodeId:X,radius:Q,corners:Y||[!0,!0,!0,!0]})).name}" to ${Q}px`}]}}catch(G){return{content:[{type:"text",text:`Error setting corner radius: ${G instanceof Error?G.message:String(G)}`}]}}}),$.prompt("design_strategy","Best practices for working with Figma designs",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`When working with Figma designs, follow these best practices:
16
-
17
- 1. Start with Document Structure:
18
- - First use get_document_info() to understand the current document
19
- - Plan your layout hierarchy before creating elements
20
- - Create a main container frame for each screen/section
21
- - If a component library has already been provided, please prioritize creating elements using component instances
22
- 2. Naming Conventions:
23
- - Use descriptive, semantic names for all elements
24
- - Follow a consistent naming pattern (e.g., "Login Screen", "Logo Container", "Email Input")
25
- - Group related elements with meaningful names
26
-
27
- 3. Layout Hierarchy:
28
- - Create parent frames first, then add child elements
29
- - For forms/login screens:
30
- * Start with the main screen container frame
31
- * Create a logo container at the top
32
- * Group input fields in their own containers
33
- * Place action buttons (login, submit) after inputs
34
- * Add secondary elements (forgot password, signup links) last
35
-
36
- 4. Input Fields Structure:
37
- - Create a container frame for each input field
38
- - Include a label text above or inside the input
39
- - Group related inputs (e.g., username/password) together
40
-
41
- 5. Element Creation:
42
- - Use create_frame() for containers and input fields
43
- - Use create_text() for labels, buttons text, and links
44
- - Set appropriate colors and styles:
45
- * Use fillColor for backgrounds
46
- * Use strokeColor for borders
47
- * Set proper fontWeight for different text elements
48
-
49
- 6. Mofifying existing elements:
50
- - use set_text_content() to modify text content.
51
-
52
- 7. Visual Hierarchy:
53
- - Position elements in logical reading order (top to bottom)
54
- - Maintain consistent spacing between elements
55
- - Use appropriate font sizes for different text types:
56
- * Larger for headings/welcome text
57
- * Medium for input labels
58
- * Standard for button text
59
- * Smaller for helper text/links
60
-
61
- 8. Best Practices:
62
- - Verify each creation with get_node_info()
63
- - Use parentId to maintain proper hierarchy
64
- - Group related elements together in frames
65
- - Keep consistent spacing and alignment
66
-
67
- Example Login Screen Structure:
68
- - Login Screen (main frame)
69
- - Logo Container (frame)
70
- - Logo (image/text)
71
- - Welcome Text (text)
72
- - Input Container (frame)
73
- - Email Input (frame)
74
- - Email Label (text)
75
- - Email Field (frame)
76
- - Password Input (frame)
77
- - Password Label (text)
78
- - Password Field (frame)
79
- - Login Button (frame)
80
- - Button Text (text)
81
- - Helper Links (frame)
82
- - Forgot Password (text)
83
- - Don't have account (text)`}}],description:"Best practices for working with Figma designs"}}),$.prompt("read_design_strategy","Best practices for reading Figma designs",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`When reading Figma designs, follow these best practices:
84
-
85
- 1. Start with selection:
86
- - First use read_my_design() to understand the current selection
87
- - If no selection ask user to select single or multiple nodes
88
- `}}],description:"Best practices for reading Figma designs"}}),$.tool("scan_text_nodes","Scan all text nodes in the selected Figma node",{nodeId:J.string().describe("ID of the node to scan")},async({nodeId:X})=>{try{let Q={type:"text",text:"Starting text node scanning. This may take a moment for large designs..."},Y=await K("scan_text_nodes",{nodeId:X,useChunking:!0,chunkSize:10});if(Y&&typeof Y==="object"&&"chunks"in Y){let G=Y,W=`
89
- Scan completed:
90
- - Found ${G.totalNodes} text nodes
91
- - Processed in ${G.chunks} chunks
92
- `;return{content:[Q,{type:"text",text:W},{type:"text",text:JSON.stringify(G.textNodes,null,2)}]}}return{content:[Q,{type:"text",text:JSON.stringify(Y,null,2)}]}}catch(Q){return{content:[{type:"text",text:`Error scanning text nodes: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("scan_nodes_by_types","Scan for child nodes with specific types in the selected Figma node",{nodeId:J.string().describe("ID of the node to scan"),types:J.array(J.string()).describe("Array of node types to find in the child nodes (e.g. ['COMPONENT', 'FRAME'])")},async({nodeId:X,types:Q})=>{try{let Y={type:"text",text:`Starting node type scanning for types: ${Q.join(", ")}...`},G=await K("scan_nodes_by_types",{nodeId:X,types:Q});if(G&&typeof G==="object"&&"matchingNodes"in G){let W=G,H=`Scan completed: Found ${W.count} nodes matching types: ${W.searchedTypes.join(", ")}`;return{content:[Y,{type:"text",text:H},{type:"text",text:JSON.stringify(W.matchingNodes,null,2)}]}}return{content:[Y,{type:"text",text:JSON.stringify(G,null,2)}]}}catch(Y){return{content:[{type:"text",text:`Error scanning nodes by types: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.prompt("text_replacement_strategy","Systematic approach for replacing text in Figma designs",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`# Intelligent Text Replacement Strategy
93
-
94
- ## 1. Analyze Design & Identify Structure
95
- - Scan text nodes to understand the overall structure of the design
96
- - Use AI pattern recognition to identify logical groupings:
97
- * Tables (rows, columns, headers, cells)
98
- * Lists (items, headers, nested lists)
99
- * Card groups (similar cards with recurring text fields)
100
- * Forms (labels, input fields, validation text)
101
- * Navigation (menu items, breadcrumbs)
102
- \`\`\`
103
- scan_text_nodes(nodeId: "node-id")
104
- get_node_info(nodeId: "node-id") // optional
105
- \`\`\`
106
-
107
- ## 2. Strategic Chunking for Complex Designs
108
- - Divide replacement tasks into logical content chunks based on design structure
109
- - Use one of these chunking strategies that best fits the design:
110
- * **Structural Chunking**: Table rows/columns, list sections, card groups
111
- * **Spatial Chunking**: Top-to-bottom, left-to-right in screen areas
112
- * **Semantic Chunking**: Content related to the same topic or functionality
113
- * **Component-Based Chunking**: Process similar component instances together
114
-
115
- ## 3. Progressive Replacement with Verification
116
- - Create a safe copy of the node for text replacement
117
- - Replace text chunk by chunk with continuous progress updates
118
- - After each chunk is processed:
119
- * Export that section as a small, manageable image
120
- * Verify text fits properly and maintain design integrity
121
- * Fix issues before proceeding to the next chunk
122
-
123
- \`\`\`
124
- // Clone the node to create a safe copy
125
- clone_node(nodeId: "selected-node-id", x: [new-x], y: [new-y])
126
-
127
- // Replace text chunk by chunk
128
- set_multiple_text_contents(
129
- nodeId: "parent-node-id",
130
- text: [
131
- { nodeId: "node-id-1", text: "New text 1" },
132
- // More nodes in this chunk...
133
- ]
134
- )
135
-
136
- // Verify chunk with small, targeted image exports
137
- export_node_as_image(nodeId: "chunk-node-id", format: "PNG", scale: 0.5)
138
- \`\`\`
139
-
140
- ## 4. Intelligent Handling for Table Data
141
- - For tabular content:
142
- * Process one row or column at a time
143
- * Maintain alignment and spacing between cells
144
- * Consider conditional formatting based on cell content
145
- * Preserve header/data relationships
146
-
147
- ## 5. Smart Text Adaptation
148
- - Adaptively handle text based on container constraints:
149
- * Auto-detect space constraints and adjust text length
150
- * Apply line breaks at appropriate linguistic points
151
- * Maintain text hierarchy and emphasis
152
- * Consider font scaling for critical content that must fit
153
-
154
- ## 6. Progressive Feedback Loop
155
- - Establish a continuous feedback loop during replacement:
156
- * Real-time progress updates (0-100%)
157
- * Small image exports after each chunk for verification
158
- * Issues identified early and resolved incrementally
159
- * Quick adjustments applied to subsequent chunks
160
-
161
- ## 7. Final Verification & Context-Aware QA
162
- - After all chunks are processed:
163
- * Export the entire design at reduced scale for final verification
164
- * Check for cross-chunk consistency issues
165
- * Verify proper text flow between different sections
166
- * Ensure design harmony across the full composition
167
-
168
- ## 8. Chunk-Specific Export Scale Guidelines
169
- - Scale exports appropriately based on chunk size:
170
- * Small chunks (1-5 elements): scale 1.0
171
- * Medium chunks (6-20 elements): scale 0.7
172
- * Large chunks (21-50 elements): scale 0.5
173
- * Very large chunks (50+ elements): scale 0.3
174
- * Full design verification: scale 0.2
175
-
176
- ## Sample Chunking Strategy for Common Design Types
177
-
178
- ### Tables
179
- - Process by logical rows (5-10 rows per chunk)
180
- - Alternative: Process by column for columnar analysis
181
- - Tip: Always include header row in first chunk for reference
182
-
183
- ### Card Lists
184
- - Group 3-5 similar cards per chunk
185
- - Process entire cards to maintain internal consistency
186
- - Verify text-to-image ratio within cards after each chunk
187
-
188
- ### Forms
189
- - Group related fields (e.g., "Personal Information", "Payment Details")
190
- - Process labels and input fields together
191
- - Ensure validation messages and hints are updated with their fields
192
-
193
- ### Navigation & Menus
194
- - Process hierarchical levels together (main menu, submenu)
195
- - Respect information architecture relationships
196
- - Verify menu fit and alignment after replacement
197
-
198
- ## Best Practices
199
- - **Preserve Design Intent**: Always prioritize design integrity
200
- - **Structural Consistency**: Maintain alignment, spacing, and hierarchy
201
- - **Visual Feedback**: Verify each chunk visually before proceeding
202
- - **Incremental Improvement**: Learn from each chunk to improve subsequent ones
203
- - **Balance Automation & Control**: Let AI handle repetitive replacements but maintain oversight
204
- - **Respect Content Relationships**: Keep related content consistent across chunks
205
-
206
- Remember that text is never just text—it's a core design element that must work harmoniously with the overall composition. This chunk-based strategy allows you to methodically transform text while maintaining design integrity.`}}],description:"Systematic approach for replacing text in Figma designs"}}),$.tool("set_multiple_text_contents","Set multiple text contents parallelly in a node",{nodeId:J.string().describe("The ID of the node containing the text nodes to replace"),text:J.array(J.object({nodeId:J.string().describe("The ID of the text node"),text:J.string().describe("The replacement text")})).describe("Array of text node IDs and their replacement texts")},async({nodeId:X,text:Q},Y)=>{try{if(!Q||Q.length===0)return{content:[{type:"text",text:"No text provided"}]};let G={type:"text",text:`Starting text replacement for ${Q.length} nodes. This will be processed in batches of 5...`},W=0,H=Q.length,D=await K("set_multiple_text_contents",{nodeId:X,text:Q}),V=D.replacementsApplied&&D.replacementsApplied>0,j=`
207
- Text replacement completed:
208
- - ${D.replacementsApplied||0} of ${H} successfully updated
209
- - ${D.replacementsFailed||0} failed
210
- - Processed in ${D.completedInChunks||1} batches
211
- `,I=(D.results||[]).filter((R)=>!R.success),l="";if(I.length>0)l=`
212
-
213
- Nodes that failed:
214
- ${I.map((R)=>`- ${R.nodeId}: ${R.error||"Unknown error"}`).join(`
215
- `)}`;return{content:[G,{type:"text",text:j+l}]}}catch(G){return{content:[{type:"text",text:`Error setting multiple text contents: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("read_my_design","Get detailed information about the current selection in Figma, including all node details",{},async()=>{try{let X=await K("read_my_design",{});return{content:[{type:"text",text:JSON.stringify(X)}]}}catch(X){return{content:[{type:"text",text:`Error getting node info: ${X instanceof Error?X.message:String(X)}`}]}}}),$.prompt("annotation_conversion_strategy","Strategy for converting manual annotations to Figma's native annotations",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`# Automatic Annotation Conversion
216
-
217
- ## Process Overview
218
-
219
- The process of converting manual annotations (numbered/alphabetical indicators with connected descriptions) to Figma's native annotations:
220
-
221
- 1. Get selected frame/component information
222
- 2. Scan and collect all annotation text nodes
223
- 3. Scan target UI elements (components, instances, frames)
224
- 4. Match annotations to appropriate UI elements
225
- 5. Apply native Figma annotations
226
-
227
- ## Step 1: Get Selection and Initial Setup
228
-
229
- First, get the selected frame or component that contains annotations:
230
-
231
- \`\`\`typescript
232
- // Get the selected frame/component
233
- const selection = await get_selection();
234
- const selectedNodeId = selection[0].id
235
-
236
- // Get available annotation categories for later use
237
- const annotationData = await get_annotations({
238
- nodeId: selectedNodeId,
239
- includeCategories: true
240
- });
241
- const categories = annotationData.categories;
242
- \`\`\`
243
-
244
- ## Step 2: Scan Annotation Text Nodes
245
-
246
- Scan all text nodes to identify annotations and their descriptions:
247
-
248
- \`\`\`typescript
249
- // Get all text nodes in the selection
250
- const textNodes = await scan_text_nodes({
251
- nodeId: selectedNodeId
252
- });
253
-
254
- // Filter and group annotation markers and descriptions
255
-
256
- // Markers typically have these characteristics:
257
- // - Short text content (usually single digit/letter)
258
- // - Specific font styles (often bold)
259
- // - Located in a container with "Marker" or "Dot" in the name
260
- // - Have a clear naming pattern (e.g., "1", "2", "3" or "A", "B", "C")
261
-
262
-
263
- // Identify description nodes
264
- // Usually longer text nodes near markers or with matching numbers in path
265
-
266
- \`\`\`
267
-
268
- ## Step 3: Scan Target UI Elements
269
-
270
- Get all potential target elements that annotations might refer to:
271
-
272
- \`\`\`typescript
273
- // Scan for all UI elements that could be annotation targets
274
- const targetNodes = await scan_nodes_by_types({
275
- nodeId: selectedNodeId,
276
- types: [
277
- "COMPONENT",
278
- "INSTANCE",
279
- "FRAME"
280
- ]
281
- });
282
- \`\`\`
283
-
284
- ## Step 4: Match Annotations to Targets
285
-
286
- Match each annotation to its target UI element using these strategies in order of priority:
287
-
288
- 1. **Path-Based Matching**:
289
- - Look at the marker's parent container name in the Figma layer hierarchy
290
- - Remove any "Marker:" or "Annotation:" prefixes from the parent name
291
- - Find UI elements that share the same parent name or have it in their path
292
- - This works well when markers are grouped with their target elements
293
-
294
- 2. **Name-Based Matching**:
295
- - Extract key terms from the annotation description
296
- - Look for UI elements whose names contain these key terms
297
- - Consider both exact matches and semantic similarities
298
- - Particularly effective for form fields, buttons, and labeled components
299
-
300
- 3. **Proximity-Based Matching** (fallback):
301
- - Calculate the center point of the marker
302
- - Find the closest UI element by measuring distances to element centers
303
- - Consider the marker's position relative to nearby elements
304
- - Use this method when other matching strategies fail
305
-
306
- Additional Matching Considerations:
307
- - Give higher priority to matches found through path-based matching
308
- - Consider the type of UI element when evaluating matches
309
- - Take into account the annotation's context and content
310
- - Use a combination of strategies for more accurate matching
311
-
312
- ## Step 5: Apply Native Annotations
313
-
314
- Convert matched annotations to Figma's native annotations using batch processing:
315
-
316
- \`\`\`typescript
317
- // Prepare annotations array for batch processing
318
- const annotationsToApply = Object.values(annotations).map(({ marker, description }) => {
319
- // Find target using multiple strategies
320
- const target =
321
- findTargetByPath(marker, targetNodes) ||
322
- findTargetByName(description, targetNodes) ||
323
- findTargetByProximity(marker, targetNodes);
324
-
325
- if (target) {
326
- // Determine appropriate category based on content
327
- const category = determineCategory(description.characters, categories);
328
-
329
- // Determine appropriate additional annotationProperty based on content
330
- const annotationProperty = determineProperties(description.characters, target.type);
331
-
332
- return {
333
- nodeId: target.id,
334
- labelMarkdown: description.characters,
335
- categoryId: category.id,
336
- properties: annotationProperty
337
- };
338
- }
339
- return null;
340
- }).filter(Boolean); // Remove null entries
341
-
342
- // Apply annotations in batches using set_multiple_annotations
343
- if (annotationsToApply.length > 0) {
344
- await set_multiple_annotations({
345
- nodeId: selectedNodeId,
346
- annotations: annotationsToApply
347
- });
348
- }
349
- \`\`\`
350
-
351
-
352
- This strategy focuses on practical implementation based on real-world usage patterns, emphasizing the importance of handling various UI elements as annotation targets, not just text nodes.`}}],description:"Strategy for converting manual annotations to Figma's native annotations"}}),$.prompt("swap_overrides_instances","Guide to swap instance overrides between instances",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`# Swap Component Instance and Override Strategy
353
-
354
- ## Overview
355
- This strategy enables transferring content and property overrides from a source instance to one or more target instances in Figma, maintaining design consistency while reducing manual work.
356
-
357
- ## Step-by-Step Process
358
-
359
- ### 1. Selection Analysis
360
- - Use \`get_selection()\` to identify the parent component or selected instances
361
- - For parent components, scan for instances with \`scan_nodes_by_types({ nodeId: "parent-id", types: ["INSTANCE"] })\`
362
- - Identify custom slots by name patterns (e.g. "Custom Slot*" or "Instance Slot") or by examining text content
363
- - Determine which is the source instance (with content to copy) and which are targets (where to apply content)
364
-
365
- ### 2. Extract Source Overrides
366
- - Use \`get_instance_overrides()\` to extract customizations from the source instance
367
- - This captures text content, property values, and style overrides
368
- - Command syntax: \`get_instance_overrides({ nodeId: "source-instance-id" })\`
369
- - Look for successful response like "Got component information from [instance name]"
370
-
371
- ### 3. Apply Overrides to Targets
372
- - Apply captured overrides using \`set_instance_overrides()\`
373
- - Command syntax:
374
- \`\`\`
375
- set_instance_overrides({
376
- sourceInstanceId: "source-instance-id",
377
- targetNodeIds: ["target-id-1", "target-id-2", ...]
378
- })
379
- \`\`\`
380
-
381
- ### 4. Verification
382
- - Verify results with \`get_node_info()\` or \`read_my_design()\`
383
- - Confirm text content and style overrides have transferred successfully
384
-
385
- ## Key Tips
386
- - Always join the appropriate channel first with \`join_channel()\`
387
- - When working with multiple targets, check the full selection with \`get_selection()\`
388
- - Preserve component relationships by using instance overrides rather than direct text manipulation`}}],description:"Strategy for transferring overrides between component instances in Figma"}}),$.tool("set_layout_mode","Set the layout mode and wrap behavior of a frame in Figma",{nodeId:J.string().describe("The ID of the frame to modify"),layoutMode:J.enum(["NONE","HORIZONTAL","VERTICAL"]).describe("Layout mode for the frame"),layoutWrap:J.enum(["NO_WRAP","WRAP"]).optional().describe("Whether the auto-layout frame wraps its children")},async({nodeId:X,layoutMode:Q,layoutWrap:Y})=>{try{return{content:[{type:"text",text:`Set layout mode of frame "${(await K("set_layout_mode",{nodeId:X,layoutMode:Q,layoutWrap:Y||"NO_WRAP"})).name}" to ${Q}${Y?` with ${Y}`:""}`}]}}catch(G){return{content:[{type:"text",text:`Error setting layout mode: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("set_annotation","Create or update an annotation",{nodeId:J.string().describe("The ID of the node to annotate"),annotationId:J.string().optional().describe("The ID of the annotation to update (if updating existing annotation)"),labelMarkdown:J.string().describe("The annotation text in markdown format"),categoryId:J.string().optional().describe("The ID of the annotation category"),properties:J.array(J.object({type:J.string()})).optional().describe("Additional properties for the annotation")},async({nodeId:X,annotationId:Q,labelMarkdown:Y,categoryId:G,properties:W})=>{try{let H=await K("set_annotation",{nodeId:X,annotationId:Q,labelMarkdown:Y,categoryId:G,properties:W});return{content:[{type:"text",text:JSON.stringify(H)}]}}catch(H){return{content:[{type:"text",text:`Error setting annotation: ${H instanceof Error?H.message:String(H)}`}]}}}),$.tool("set_padding","Set padding values for an auto-layout frame in Figma",{nodeId:J.string().describe("The ID of the frame to modify"),paddingTop:J.number().optional().describe("Top padding value"),paddingRight:J.number().optional().describe("Right padding value"),paddingBottom:J.number().optional().describe("Bottom padding value"),paddingLeft:J.number().optional().describe("Left padding value")},async({nodeId:X,paddingTop:Q,paddingRight:Y,paddingBottom:G,paddingLeft:W})=>{try{let B=await K("set_padding",{nodeId:X,paddingTop:Q,paddingRight:Y,paddingBottom:G,paddingLeft:W}),D=[];if(Q!==void 0)D.push(`top: ${Q}`);if(Y!==void 0)D.push(`right: ${Y}`);if(G!==void 0)D.push(`bottom: ${G}`);if(W!==void 0)D.push(`left: ${W}`);return{content:[{type:"text",text:`Set ${D.length>0?`padding (${D.join(", ")})`:"padding"} for frame "${B.name}"`}]}}catch(H){return{content:[{type:"text",text:`Error setting padding: ${H instanceof Error?H.message:String(H)}`}]}}}),$.tool("set_axis_align","Set primary and counter axis alignment for an auto-layout frame in Figma",{nodeId:J.string().describe("The ID of the frame to modify"),primaryAxisAlignItems:J.enum(["MIN","MAX","CENTER","SPACE_BETWEEN"]).optional().describe("Primary axis alignment (MIN/MAX = left/right in horizontal, top/bottom in vertical). Note: When set to SPACE_BETWEEN, itemSpacing will be ignored as children will be evenly spaced."),counterAxisAlignItems:J.enum(["MIN","MAX","CENTER","BASELINE"]).optional().describe("Counter axis alignment (MIN/MAX = top/bottom in horizontal, left/right in vertical)")},async({nodeId:X,primaryAxisAlignItems:Q,counterAxisAlignItems:Y})=>{try{let W=await K("set_axis_align",{nodeId:X,primaryAxisAlignItems:Q,counterAxisAlignItems:Y}),H=[];if(Q!==void 0)H.push(`primary: ${Q}`);if(Y!==void 0)H.push(`counter: ${Y}`);return{content:[{type:"text",text:`Set ${H.length>0?`axis alignment (${H.join(", ")})`:"axis alignment"} for frame "${W.name}"`}]}}catch(G){return{content:[{type:"text",text:`Error setting axis alignment: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("set_layout_sizing","Set horizontal and vertical sizing modes for an auto-layout frame in Figma",{nodeId:J.string().describe("The ID of the frame to modify"),layoutSizingHorizontal:J.enum(["FIXED","HUG","FILL"]).optional().describe("Horizontal sizing mode (HUG for frames/text only, FILL for auto-layout children only)"),layoutSizingVertical:J.enum(["FIXED","HUG","FILL"]).optional().describe("Vertical sizing mode (HUG for frames/text only, FILL for auto-layout children only)")},async({nodeId:X,layoutSizingHorizontal:Q,layoutSizingVertical:Y})=>{try{let W=await K("set_layout_sizing",{nodeId:X,layoutSizingHorizontal:Q,layoutSizingVertical:Y}),H=[];if(Q!==void 0)H.push(`horizontal: ${Q}`);if(Y!==void 0)H.push(`vertical: ${Y}`);return{content:[{type:"text",text:`Set ${H.length>0?`layout sizing (${H.join(", ")})`:"layout sizing"} for frame "${W.name}"`}]}}catch(G){return{content:[{type:"text",text:`Error setting layout sizing: ${G instanceof Error?G.message:String(G)}`}]}}}),$.tool("set_item_spacing","Set distance between children in an auto-layout frame",{nodeId:J.string().describe("The ID of the frame to modify"),itemSpacing:J.number().describe("Distance between children. Note: This value will be ignored if primaryAxisAlignItems is set to SPACE_BETWEEN.")},async({nodeId:X,itemSpacing:Q})=>{try{let G=await K("set_item_spacing",{nodeId:X,itemSpacing:Q});return{content:[{type:"text",text:`Set item spacing to ${Q} for frame "${G.name}"`}]}}catch(Y){return{content:[{type:"text",text:`Error setting item spacing: ${Y instanceof Error?Y.message:String(Y)}`}]}}}),$.tool("get_reactions","Get Figma Prototyping Reactions from multiple nodes. CRITICAL: The output MUST be processed using the 'reaction_to_connector_strategy' prompt IMMEDIATELY to generate parameters for connector lines via the 'create_connections' tool.",{nodeIds:J.array(J.string()).describe("Array of node IDs to get reactions from")},async({nodeIds:X})=>{try{let Q=await K("get_reactions",{nodeIds:X});return{content:[{type:"text",text:JSON.stringify(Q)},{type:"text",text:"IMPORTANT: You MUST now use the reaction data above and follow the `reaction_to_connector_strategy` prompt to prepare the parameters for the `create_connections` tool call. This is a required next step."}],followUp:{type:"prompt",prompt:"reaction_to_connector_strategy"}}}catch(Q){return{content:[{type:"text",text:`Error getting reactions: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("set_default_connector","Set a copied connector node as the default connector",{connectorId:J.string().optional().describe("The ID of the connector node to set as default")},async({connectorId:X})=>{try{let Q=await K("set_default_connector",{connectorId:X});return{content:[{type:"text",text:`Default connector set: ${JSON.stringify(Q)}`}]}}catch(Q){return{content:[{type:"text",text:`Error setting default connector: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("delete_node","Delete a node from Figma",{nodeId:J.string().describe("The ID of the node to delete")},async({nodeId:X})=>{try{return await K("delete_node",{nodeId:X}),{content:[{type:"text",text:`Deleted node with ID: ${X}`}]}}catch(Q){return{content:[{type:"text",text:`Error deleting node: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("create_connections","Create connections between nodes using the default connector style",{connections:J.array(J.object({startNodeId:J.string().describe("ID of the starting node"),endNodeId:J.string().describe("ID of the ending node"),text:J.string().optional().describe("Optional text to display on the connector")})).describe("Array of node connections to create")},async({connections:X})=>{try{if(!X||X.length===0)return{content:[{type:"text",text:"No connections provided"}]};let Q=await K("create_connections",{connections:X});return{content:[{type:"text",text:`Created ${X.length} connections: ${JSON.stringify(Q)}`}]}}catch(Q){return{content:[{type:"text",text:`Error creating connections: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.prompt("reaction_to_connector_strategy","Strategy for converting Figma prototype reactions to connector lines using the output of 'get_reactions'",(X)=>{return{messages:[{role:"assistant",content:{type:"text",text:`# Strategy: Convert Figma Prototype Reactions to Connector Lines
389
-
390
- ## Goal
391
- Process the JSON output from the \`get_reactions\` tool to generate an array of connection objects suitable for the \`create_connections\` tool. This visually represents prototype flows as connector lines on the Figma canvas.
392
-
393
- ## Input Data
394
- You will receive JSON data from the \`get_reactions\` tool. This data contains an array of nodes, each with potential reactions. A typical reaction object looks like this:
395
- \`\`\`json
396
- {
397
- "trigger": { "type": "ON_CLICK" },
398
- "action": {
399
- "type": "NAVIGATE",
400
- "destinationId": "destination-node-id",
401
- "navigationTransition": { ... },
402
- "preserveScrollPosition": false
403
- }
404
- }
405
- \`\`\`
406
-
407
- ## Step-by-Step Process
408
-
409
- ### 1. Preparation & Context Gathering
410
- - **Action:** Call \`read_my_design\` on the relevant node(s) to get context about the nodes involved (names, types, etc.). This helps in generating meaningful connector labels later.
411
- - **Action:** Call \`set_default_connector\` **without** the \`connectorId\` parameter.
412
- - **Check Result:** Analyze the response from \`set_default_connector\`.
413
- - If it confirms a default connector is already set (e.g., "Default connector is already set"), proceed to Step 2.
414
- - If it indicates no default connector is set (e.g., "No default connector set..."), you **cannot** proceed with \`create_connections\` yet. Inform the user they need to manually copy a connector from FigJam, paste it onto the current page, select it, and then you can run \`set_default_connector({ connectorId: "SELECTED_NODE_ID" })\` before attempting \`create_connections\`. **Do not proceed to Step 2 until a default connector is confirmed.**
415
-
416
- ### 2. Filter and Transform Reactions from \`get_reactions\` Output
417
- - **Iterate:** Go through the JSON array provided by \`get_reactions\`. For each node in the array:
418
- - Iterate through its \`reactions\` array.
419
- - **Filter:** Keep only reactions where the \`action\` meets these criteria:
420
- - Has a \`type\` that implies a connection (e.g., \`NAVIGATE\`, \`OPEN_OVERLAY\`, \`SWAP_OVERLAY\`). **Ignore** types like \`CHANGE_TO\`, \`CLOSE_OVERLAY\`, etc.
421
- - Has a valid \`destinationId\` property.
422
- - **Extract:** For each valid reaction, extract the following information:
423
- - \`sourceNodeId\`: The ID of the node the reaction belongs to (from the outer loop).
424
- - \`destinationNodeId\`: The value of \`action.destinationId\`.
425
- - \`actionType\`: The value of \`action.type\`.
426
- - \`triggerType\`: The value of \`trigger.type\`.
427
-
428
- ### 3. Generate Connector Text Labels
429
- - **For each extracted connection:** Create a concise, descriptive text label string.
430
- - **Combine Information:** Use the \`actionType\`, \`triggerType\`, and potentially the names of the source/destination nodes (obtained from Step 1's \`read_my_design\` or by calling \`get_node_info\` if necessary) to generate the label.
431
- - **Example Labels:**
432
- - If \`triggerType\` is "ON_CLICK" and \`actionType\` is "NAVIGATE": "On click, navigate to [Destination Node Name]"
433
- - If \`triggerType\` is "ON_DRAG" and \`actionType\` is "OPEN_OVERLAY": "On drag, open [Destination Node Name] overlay"
434
- - **Keep it brief and informative.** Let this generated string be \`generatedText\`.
435
-
436
- ### 4. Prepare the \`connections\` Array for \`create_connections\`
437
- - **Structure:** Create a JSON array where each element is an object representing a connection.
438
- - **Format:** Each object in the array must have the following structure:
439
- \`\`\`json
440
- {
441
- "startNodeId": "sourceNodeId_from_step_2",
442
- "endNodeId": "destinationNodeId_from_step_2",
443
- "text": "generatedText_from_step_3"
444
- }
445
- \`\`\`
446
- - **Result:** This final array is the value you will pass to the \`connections\` parameter when calling the \`create_connections\` tool.
447
-
448
- ### 5. Execute Connection Creation
449
- - **Action:** Call the \`create_connections\` tool, passing the array generated in Step 4 as the \`connections\` argument.
450
- - **Verify:** Check the response from \`create_connections\` to confirm success or failure.
451
-
452
- This detailed process ensures you correctly interpret the reaction data, prepare the necessary information, and use the appropriate tools to create the connector lines.`}}],description:"Strategy for converting Figma prototype reactions to connector lines using the output of 'get_reactions'"}}),$.tool("join_channel","Join a specific channel to communicate with Figma",{channel:J.string().describe("The name of the channel to join").default("")},async({channel:X})=>{try{if(!X)return{content:[{type:"text",text:"Please provide a channel name to join:"}],followUp:{tool:"join_channel",description:"Join the specified channel"}};return await v1(X),{content:[{type:"text",text:`Successfully joined channel: ${X}`}]}}catch(Q){return{content:[{type:"text",text:`Error joining channel: ${Q instanceof Error?Q.message:String(Q)}`}]}}}),$.tool("get_file_components","Get all components from a specific Figma file",{fileKey:J.string().describe("The Figma file identifier found in the file URL"),personalToken:J.string().optional().describe("Optional personal token, will use environment token if not provided")},async({fileKey:X,personalToken:Q})=>{try{let Y=Q;if(!Y){if(Y=process.env.personalToken,!Y)return{content:[{type:"text",text:JSON.stringify({success:!1,error:"Personal token not found. Please provide personalToken parameter or set FIGMA_API_KEY environment variable."})}]}}let G=await fetch(`https://api.figma.com/v1/files/${X}/components`,{headers:{Authorization:`Bearer ${Y}`,"X-Figma-Token":Y}});if(!G.ok){let H=await G.text();return{content:[{type:"text",text:JSON.stringify({success:!1,error:`API request failed: ${G.status} ${G.statusText}`,details:H})}]}}let W=await G.json();return{content:[{type:"text",text:JSON.stringify({success:!0,fileKey:X,components:W})}]}}catch(Y){return{content:[{type:"text",text:JSON.stringify({success:!1,error:`Error getting file components: ${Y instanceof Error?Y.message:String(Y)}`})}]}}}),$.tool("get_component","Get detailed information about a specific component by its key",{componentKey:J.string().describe("The unique key identifier of the component"),personalToken:J.string().optional().describe("Optional personal token, will use environment token if not provided")},async({componentKey:X,personalToken:Q})=>{try{let Y=Q;if(!Y){if(Y=process.env.personalToken,!Y)return{content:[{type:"text",text:JSON.stringify({success:!1,error:"Personal token not found. Please provide personalToken parameter or set FIGMA_API_KEY environment variable."})}]}}let G=await fetch(`https://api.figma.com/v1/components/${X}`,{headers:{Authorization:`Bearer ${Y}`,"X-Figma-Token":Y}});if(!G.ok){let H=await G.text();return{content:[{type:"text",text:JSON.stringify({success:!1,error:`API request failed: ${G.status} ${G.statusText}`,details:H})}]}}let W=await G.json();return{content:[{type:"text",text:JSON.stringify({success:!0,componentKey:X,component:W})}]}}catch(Y){return{content:[{type:"text",text:JSON.stringify({success:!1,error:`Error getting component: ${Y instanceof Error?Y.message:String(Y)}`})}]}}})}R1().catch(($)=>{o6.error(`Error starting FigmaMCP server: ${$ instanceof Error?$.message:String($)}`),process.exit(1)});var $0=new t3({name:K1,version:L1},{capabilities:{logging:{}}});k1($0);var Q0=y1(require("node:process"));u$();class X0{append($){this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){if(!this._buffer)return null;let $=this._buffer.indexOf(`
453
- `);if($===-1)return null;let X=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),a6(X)}clear(){this._buffer=void 0}}function a6($){return k0.parse(JSON.parse($))}function f1($){return JSON.stringify($)+`
454
- `}class Y0{constructor($=Q0.default.stdin,X=Q0.default.stdout){this._stdin=$,this._stdout=X,this._readBuffer=new X0,this._started=!1,this._ondata=(Q)=>{this._readBuffer.append(Q),this.processReadBuffer()},this._onerror=(Q)=>{var Y;(Y=this.onerror)===null||Y===void 0||Y.call(this,Q)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var $,X;while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;($=this.onmessage)===null||$===void 0||$.call(this,Q)}catch(Q){(X=this.onerror)===null||X===void 0||X.call(this,Q)}}async close(){var $;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),($=this.onclose)===null||$===void 0||$.call(this)}send($){return new Promise((X)=>{let Q=f1($);if(this._stdout.write(Q))X();else this._stdout.once("drain",X)})}}p$();var r6=M$("StdioTransport");async function P1($){try{let X=new Y0;await $.connect(X)}catch(X){r6.info(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${X.message}`}})),process.exit(1)}}P1($0);
455
-
456
- //# debugId=3EA45C7EDFB5A7C564756E2164756E21
2
+ var y5=Object.create;var{getPrototypeOf:T5,defineProperty:EQ,getOwnPropertyNames:e9,getOwnPropertyDescriptor:x5}=Object,v6=Object.prototype.hasOwnProperty;var Hf=(f,v,W)=>{W=f!=null?y5(T5(f)):{};let X=v||!f||!f.__esModule?EQ(W,"default",{value:f,enumerable:!0}):W;for(let Q of e9(f))if(!v6.call(X,Q))EQ(X,Q,{get:()=>f[Q],enumerable:!0});return X},t9=new WeakMap,l5=(f)=>{var v=t9.get(f),W;if(v)return v;if(v=EQ({},"__esModule",{value:!0}),f&&typeof f==="object"||typeof f==="function")e9(f).map((X)=>!v6.call(v,X)&&EQ(v,X,{get:()=>f[X],enumerable:!(W=x5(f,X))||W.enumerable}));return t9.set(f,v),v},Qv=(f,v)=>()=>(v||f((v={exports:{}}).exports,v),v.exports);var pW=(f,v)=>{for(var W in v)EQ(f,W,{get:v[W],enumerable:!0,configurable:!0,set:(X)=>v[W]=()=>X})};var jv=(f,v)=>()=>(f&&(v=f(f=0)),v);var Ov,iW,r,B1=(f)=>{switch(typeof f){case"undefined":return r.undefined;case"string":return r.string;case"number":return Number.isNaN(f)?r.nan:r.number;case"boolean":return r.boolean;case"function":return r.function;case"bigint":return r.bigint;case"symbol":return r.symbol;case"object":if(Array.isArray(f))return r.array;if(f===null)return r.null;if(f.then&&typeof f.then==="function"&&f.catch&&typeof f.catch==="function")return r.promise;if(typeof Map!=="undefined"&&f instanceof Map)return r.map;if(typeof Set!=="undefined"&&f instanceof Set)return r.set;if(typeof Date!=="undefined"&&f instanceof Date)return r.date;return r.object;default:return r.unknown}};var AQ=jv(()=>{(function(f){f.assertEqual=(Q)=>{};function v(Q){}f.assertIs=v;function W(Q){throw new Error}f.assertNever=W,f.arrayToEnum=(Q)=>{let P={};for(let w of Q)P[w]=w;return P},f.getValidEnumValues=(Q)=>{let P=f.objectKeys(Q).filter((G)=>typeof Q[Q[G]]!=="number"),w={};for(let G of P)w[G]=Q[G];return f.objectValues(w)},f.objectValues=(Q)=>{return f.objectKeys(Q).map(function(P){return Q[P]})},f.objectKeys=typeof Object.keys==="function"?(Q)=>Object.keys(Q):(Q)=>{let P=[];for(let w in Q)if(Object.prototype.hasOwnProperty.call(Q,w))P.push(w);return P},f.find=(Q,P)=>{for(let w of Q)if(P(w))return w;return},f.isInteger=typeof Number.isInteger==="function"?(Q)=>Number.isInteger(Q):(Q)=>typeof Q==="number"&&Number.isFinite(Q)&&Math.floor(Q)===Q;function X(Q,P=" | "){return Q.map((w)=>typeof w==="string"?`'${w}'`:w).join(P)}f.joinValues=X,f.jsonStringifyReplacer=(Q,P)=>{if(typeof P==="bigint")return P.toString();return P}})(Ov||(Ov={}));(function(f){f.mergeShapes=(v,W)=>{return{...v,...W}}})(iW||(iW={}));r=Ov.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var l,b5=(f)=>{return JSON.stringify(f,null,2).replace(/"([^"]+)":/g,"$1:")},Vf;var V8=jv(()=>{AQ();l=Ov.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"]);Vf=class Vf extends Error{get errors(){return this.issues}constructor(f){super();this.issues=[],this.addIssue=(W)=>{this.issues=[...this.issues,W]},this.addIssues=(W=[])=>{this.issues=[...this.issues,...W]};let v=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,v);else this.__proto__=v;this.name="ZodError",this.issues=f}format(f){let v=f||function(Q){return Q.message},W={_errors:[]},X=(Q)=>{for(let P of Q.issues)if(P.code==="invalid_union")P.unionErrors.map(X);else if(P.code==="invalid_return_type")X(P.returnTypeError);else if(P.code==="invalid_arguments")X(P.argumentsError);else if(P.path.length===0)W._errors.push(v(P));else{let w=W,G=0;while(G<P.path.length){let B=P.path[G];if(G!==P.path.length-1)w[B]=w[B]||{_errors:[]};else w[B]=w[B]||{_errors:[]},w[B]._errors.push(v(P));w=w[B],G++}}};return X(this),W}static assert(f){if(!(f instanceof Vf))throw new Error(`Not a ZodError: ${f}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ov.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(f=(v)=>v.message){let v={},W=[];for(let X of this.issues)if(X.path.length>0){let Q=X.path[0];v[Q]=v[Q]||[],v[Q].push(f(X))}else W.push(f(X));return{formErrors:W,fieldErrors:v}}get formErrors(){return this.flatten()}};Vf.create=(f)=>{return new Vf(f)}});var u5=(f,v)=>{let W;switch(f.code){case l.invalid_type:if(f.received===r.undefined)W="Required";else W=`Expected ${f.expected}, received ${f.received}`;break;case l.invalid_literal:W=`Invalid literal value, expected ${JSON.stringify(f.expected,Ov.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:W=`Unrecognized key(s) in object: ${Ov.joinValues(f.keys,", ")}`;break;case l.invalid_union:W="Invalid input";break;case l.invalid_union_discriminator:W=`Invalid discriminator value. Expected ${Ov.joinValues(f.options)}`;break;case l.invalid_enum_value:W=`Invalid enum value. Expected ${Ov.joinValues(f.options)}, received '${f.received}'`;break;case l.invalid_arguments:W="Invalid function arguments";break;case l.invalid_return_type:W="Invalid function return type";break;case l.invalid_date:W="Invalid date";break;case l.invalid_string:if(typeof f.validation==="object")if("includes"in f.validation){if(W=`Invalid input: must include "${f.validation.includes}"`,typeof f.validation.position==="number")W=`${W} at one or more positions greater than or equal to ${f.validation.position}`}else if("startsWith"in f.validation)W=`Invalid input: must start with "${f.validation.startsWith}"`;else if("endsWith"in f.validation)W=`Invalid input: must end with "${f.validation.endsWith}"`;else Ov.assertNever(f.validation);else if(f.validation!=="regex")W=`Invalid ${f.validation}`;else W="Invalid";break;case l.too_small:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at least":"more than"} ${f.minimum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at least":"over"} ${f.minimum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="bigint")W=`Number must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${f.minimum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly equal to ":f.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(f.minimum))}`;else W="Invalid input";break;case l.too_big:if(f.type==="array")W=`Array must contain ${f.exact?"exactly":f.inclusive?"at most":"less than"} ${f.maximum} element(s)`;else if(f.type==="string")W=`String must contain ${f.exact?"exactly":f.inclusive?"at most":"under"} ${f.maximum} character(s)`;else if(f.type==="number")W=`Number must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="bigint")W=`BigInt must be ${f.exact?"exactly":f.inclusive?"less than or equal to":"less than"} ${f.maximum}`;else if(f.type==="date")W=`Date must be ${f.exact?"exactly":f.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(f.maximum))}`;else W="Invalid input";break;case l.custom:W="Invalid input";break;case l.invalid_intersection_types:W="Intersection results could not be merged";break;case l.not_multiple_of:W=`Number must be a multiple of ${f.multipleOf}`;break;case l.not_finite:W="Number must be finite";break;default:W=v.defaultError,Ov.assertNever(f)}return{message:W}},F1;var dW=jv(()=>{V8();AQ();F1=u5});function m5(f){f6=f}function u0(){return f6}var f6;var q8=jv(()=>{dW();f6=F1});function n(f,v){let W=u0(),X=UQ({issueData:v,data:f.data,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,W,W===F1?void 0:F1].filter((Q)=>!!Q)});f.common.issues.push(X)}class Wf{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(f,v){let W=[];for(let X of v){if(X.status==="aborted")return fv;if(X.status==="dirty")f.dirty();W.push(X.value)}return{status:f.value,value:W}}static async mergeObjectAsync(f,v){let W=[];for(let X of v){let Q=await X.key,P=await X.value;W.push({key:Q,value:P})}return Wf.mergeObjectSync(f,W)}static mergeObjectSync(f,v){let W={};for(let X of v){let{key:Q,value:P}=X;if(Q.status==="aborted")return fv;if(P.status==="aborted")return fv;if(Q.status==="dirty")f.dirty();if(P.status==="dirty")f.dirty();if(Q.value!=="__proto__"&&(typeof P.value!=="undefined"||X.alwaysSet))W[Q.value]=P.value}return{status:f.value,value:W}}}var UQ=(f)=>{let{data:v,path:W,errorMaps:X,issueData:Q}=f,P=[...W,...Q.path||[]],w={...Q,path:P};if(Q.message!==void 0)return{...Q,path:P,message:Q.message};let G="",B=X.filter((D)=>!!D).slice().reverse();for(let D of B)G=D(w,{data:v,defaultError:G}).message;return{...Q,path:P,message:G}},r5,fv,K0=(f)=>({status:"dirty",value:f}),Gf=(f)=>({status:"valid",value:f}),N8=(f)=>f.status==="aborted",E8=(f)=>f.status==="dirty",u1=(f)=>f.status==="valid",m0=(f)=>typeof Promise!=="undefined"&&f instanceof Promise;var sW=jv(()=>{q8();dW();r5=[];fv=Object.freeze({status:"aborted"})});var Q6=()=>{};var o;var W6=jv(()=>{(function(f){f.errToObj=(v)=>typeof v==="string"?{message:v}:v||{},f.toString=(v)=>typeof v==="string"?v:v?.message})(o||(o={}))});class df{constructor(f,v,W,X){this._cachedPath=[],this.parent=f,this.data=v,this._path=W,this._key=X}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}}function wv(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:X,description:Q}=f;if(v&&(W||X))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(w,G)=>{let{message:B}=f;if(w.code==="invalid_enum_value")return{message:B??G.defaultError};if(typeof G.data==="undefined")return{message:B??X??G.defaultError};if(w.code!=="invalid_type")return{message:G.defaultError};return{message:B??W??G.defaultError}},description:Q}}class zv{get description(){return this._def.description}_getType(f){return B1(f.data)}_getOrReturnCtx(f,v){return v||{common:f.parent.common,data:f.data,parsedType:B1(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}_processInputParams(f){return{status:new Wf,ctx:{common:f.parent.common,data:f.data,parsedType:B1(f.data),schemaErrorMap:this._def.errorMap,path:f.path,parent:f.parent}}}_parseSync(f){let v=this._parse(f);if(m0(v))throw new Error("Synchronous parse encountered promise.");return v}_parseAsync(f){let v=this._parse(f);return Promise.resolve(v)}parse(f,v){let W=this.safeParse(f,v);if(W.success)return W.data;throw W.error}safeParse(f,v){let W={common:{issues:[],async:v?.async??!1,contextualErrorMap:v?.errorMap},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:B1(f)},X=this._parseSync({data:f,path:W.path,parent:W});return J6(W,X)}"~validate"(f){let v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:B1(f)};if(!this["~standard"].async)try{let W=this._parseSync({data:f,path:[],parent:v});return u1(W)?{value:W.value}:{issues:v.common.issues}}catch(W){if(W?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;v.common={issues:[],async:!0}}return this._parseAsync({data:f,path:[],parent:v}).then((W)=>u1(W)?{value:W.value}:{issues:v.common.issues})}async parseAsync(f,v){let W=await this.safeParseAsync(f,v);if(W.success)return W.data;throw W.error}async safeParseAsync(f,v){let W={common:{issues:[],contextualErrorMap:v?.errorMap,async:!0},path:v?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:f,parsedType:B1(f)},X=this._parse({data:f,path:W.path,parent:W}),Q=await(m0(X)?X:Promise.resolve(X));return J6(W,Q)}refine(f,v){let W=(X)=>{if(typeof v==="string"||typeof v==="undefined")return{message:v};else if(typeof v==="function")return v(X);else return v};return this._refinement((X,Q)=>{let P=f(X),w=()=>Q.addIssue({code:l.custom,...W(X)});if(typeof Promise!=="undefined"&&P instanceof Promise)return P.then((G)=>{if(!G)return w(),!1;else return!0});if(!P)return w(),!1;else return!0})}refinement(f,v){return this._refinement((W,X)=>{if(!f(W))return X.addIssue(typeof v==="function"?v(W,X):v),!1;else return!0})}_refinement(f){return new sf({schema:this,typeName:u.ZodEffects,effect:{type:"refinement",refinement:f}})}superRefine(f){return this._refinement(f)}constructor(f){this.spa=this.safeParseAsync,this._def=f,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:(v)=>this["~validate"](v)}}optional(){return pf.create(this,this._def)}nullable(){return S1.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return nf.create(this)}promise(){return M0.create(this,this._def)}or(f){return i0.create([this,f],this._def)}and(f){return d0.create(this,f,this._def)}transform(f){return new sf({...wv(this._def),schema:this,typeName:u.ZodEffects,effect:{type:"transform",transform:f}})}default(f){let v=typeof f==="function"?f:()=>f;return new e0({...wv(this._def),innerType:this,defaultValue:v,typeName:u.ZodDefault})}brand(){return new U8({typeName:u.ZodBranded,type:this,...wv(this._def)})}catch(f){let v=typeof f==="function"?f:()=>f;return new vQ({...wv(this._def),innerType:this,catchValue:v,typeName:u.ZodCatch})}describe(f){return new this.constructor({...this._def,description:f})}pipe(f){return RQ.create(this,f)}readonly(){return fQ.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Y6(f){let v="[0-5]\\d";if(f.precision)v=`${v}\\.\\d{${f.precision}}`;else if(f.precision==null)v=`${v}(\\.\\d+)?`;let W=f.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${v})${W}`}function P7(f){return new RegExp(`^${Y6(f)}$`)}function w6(f){let v=`${P6}T${Y6(f)}`,W=[];if(W.push(f.local?"Z?":"Z"),f.offset)W.push("([+-]\\d{2}:?\\d{2})");return v=`${v}(${W.join("|")})`,new RegExp(`^${v}$`)}function Y7(f,v){if((v==="v4"||!v)&&e5.test(f))return!0;if((v==="v6"||!v)&&f7.test(f))return!0;return!1}function w7(f,v){if(!d5.test(f))return!1;try{let[W]=f.split(".");if(!W)return!1;let X=W.replace(/-/g,"+").replace(/_/g,"/").padEnd(W.length+(4-W.length%4)%4,"="),Q=JSON.parse(atob(X));if(typeof Q!=="object"||Q===null)return!1;if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(v&&Q.alg!==v)return!1;return!0}catch{return!1}}function G7(f,v){if((v==="v4"||!v)&&v7.test(f))return!0;if((v==="v6"||!v)&&Q7.test(f))return!0;return!1}function z7(f,v){let W=(f.toString().split(".")[1]||"").length,X=(v.toString().split(".")[1]||"").length,Q=W>X?W:X,P=Number.parseInt(f.toFixed(Q).replace(".","")),w=Number.parseInt(v.toFixed(Q).replace(".",""));return P%w/10**Q}function r0(f){if(f instanceof mv){let v={};for(let W in f.shape){let X=f.shape[W];v[W]=pf.create(r0(X))}return new mv({...f._def,shape:()=>v})}else if(f instanceof nf)return new nf({...f._def,type:r0(f.element)});else if(f instanceof pf)return pf.create(r0(f.unwrap()));else if(f instanceof S1)return S1.create(r0(f.unwrap()));else if(f instanceof h1)return h1.create(f.items.map((v)=>r0(v)));else return f}function tW(f,v){let W=B1(f),X=B1(v);if(f===v)return{valid:!0,data:f};else if(W===r.object&&X===r.object){let Q=Ov.objectKeys(v),P=Ov.objectKeys(f).filter((G)=>Q.indexOf(G)!==-1),w={...f,...v};for(let G of P){let B=tW(f[G],v[G]);if(!B.valid)return{valid:!1};w[G]=B.data}return{valid:!0,data:w}}else if(W===r.array&&X===r.array){if(f.length!==v.length)return{valid:!1};let Q=[];for(let P=0;P<f.length;P++){let w=f[P],G=v[P],B=tW(w,G);if(!B.valid)return{valid:!1};Q.push(B.data)}return{valid:!0,data:Q}}else if(W===r.date&&X===r.date&&+f===+v)return{valid:!0,data:f};else return{valid:!1}}function G6(f,v){return new c1({values:f,typeName:u.ZodEnum,...wv(v)})}function X6(f,v){let W=typeof f==="function"?f(v):typeof f==="string"?{message:f}:f;return typeof W==="string"?{message:W}:W}function z6(f,v={},W){if(f)return $0.create().superRefine((X,Q)=>{let P=f(X);if(P instanceof Promise)return P.then((w)=>{if(!w){let G=X6(v,X),B=G.fatal??W??!0;Q.addIssue({code:"custom",...G,fatal:B})}});if(!P){let w=X6(v,X),G=w.fatal??W??!0;Q.addIssue({code:"custom",...w,fatal:G})}return});return $0.create()}var J6=(f,v)=>{if(u1(v))return{success:!0,data:v.value};else{if(!f.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let W=new Vf(f.common.issues);return this._error=W,this._error}}}},a5,c5,n5,p5,i5,d5,s5,o5,t5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",oW,e5,v7,f7,Q7,W7,J7,P6="((\\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])))",X7,cf,r1,a1,c0,h0,jQ,n0,p0,$0,m1,K1,FQ,nf,mv,i0,L1=(f)=>{if(f instanceof s0)return L1(f.schema);else if(f instanceof sf)return L1(f.innerType());else if(f instanceof o0)return[f.value];else if(f instanceof c1)return f.options;else if(f instanceof t0)return Ov.objectValues(f.enum);else if(f instanceof e0)return L1(f._def.innerType);else if(f instanceof n0)return[void 0];else if(f instanceof p0)return[null];else if(f instanceof pf)return[void 0,...L1(f.unwrap())];else if(f instanceof S1)return[null,...L1(f.unwrap())];else if(f instanceof U8)return L1(f.unwrap());else if(f instanceof fQ)return L1(f.unwrap());else if(f instanceof vQ)return L1(f._def.innerType);else return[]},A8,d0,h1,LQ,SQ,D0,a0,s0,o0,c1,t0,M0,sf,pf,S1,e0,vQ,gQ,B7,U8,RQ,fQ,K7,u,h7=(f,v={message:`Input not instance of ${f.name}`})=>z6((W)=>W instanceof f,v),B6,K6,$7,D7,h6,M7,O7,H7,V7,q7,N7,E7,A7,U7,j7,F7,L7,S7,g7,R7,_7,k7,I7,Z7,C7,y7,T7,x7,l7,b7,u7,m7,r7,a7,c7=()=>B6().optional(),n7=()=>K6().optional(),p7=()=>h6().optional(),i7,d7;var $6=jv(()=>{V8();q8();W6();sW();AQ();a5=/^c[^\s-]{8,}$/i,c5=/^[0-9a-z]+$/,n5=/^[0-9A-HJKMNP-TV-Z]{26}$/i,p5=/^[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,i5=/^[a-z0-9_-]{21}$/i,d5=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,s5=/^[-+]?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)?)??$/,o5=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,e5=/^(?:(?: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])$/,v7=/^(?:(?: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])$/,f7=/^(([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]))$/,Q7=/^(([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])$/,W7=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,J7=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,X7=new RegExp(`^${P6}$`);cf=class cf extends zv{_parse(f){if(this._def.coerce)f.data=String(f.data);if(this._getType(f)!==r.string){let Q=this._getOrReturnCtx(f);return n(Q,{code:l.invalid_type,expected:r.string,received:Q.parsedType}),fv}let W=new Wf,X=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.length<Q.value)X=this._getOrReturnCtx(f,X),n(X,{code:l.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="max"){if(f.data.length>Q.value)X=this._getOrReturnCtx(f,X),n(X,{code:l.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!1,message:Q.message}),W.dirty()}else if(Q.kind==="length"){let P=f.data.length>Q.value,w=f.data.length<Q.value;if(P||w){if(X=this._getOrReturnCtx(f,X),P)n(X,{code:l.too_big,maximum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});else if(w)n(X,{code:l.too_small,minimum:Q.value,type:"string",inclusive:!0,exact:!0,message:Q.message});W.dirty()}}else if(Q.kind==="email"){if(!o5.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"email",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="emoji"){if(!oW)oW=new RegExp(t5,"u");if(!oW.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"emoji",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="uuid"){if(!p5.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"uuid",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="nanoid"){if(!i5.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"nanoid",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid"){if(!a5.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"cuid",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cuid2"){if(!c5.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"cuid2",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ulid"){if(!n5.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"ulid",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="url")try{new URL(f.data)}catch{X=this._getOrReturnCtx(f,X),n(X,{validation:"url",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="regex"){if(Q.regex.lastIndex=0,!Q.regex.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"regex",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="trim")f.data=f.data.trim();else if(Q.kind==="includes"){if(!f.data.includes(Q.value,Q.position))X=this._getOrReturnCtx(f,X),n(X,{code:l.invalid_string,validation:{includes:Q.value,position:Q.position},message:Q.message}),W.dirty()}else if(Q.kind==="toLowerCase")f.data=f.data.toLowerCase();else if(Q.kind==="toUpperCase")f.data=f.data.toUpperCase();else if(Q.kind==="startsWith"){if(!f.data.startsWith(Q.value))X=this._getOrReturnCtx(f,X),n(X,{code:l.invalid_string,validation:{startsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="endsWith"){if(!f.data.endsWith(Q.value))X=this._getOrReturnCtx(f,X),n(X,{code:l.invalid_string,validation:{endsWith:Q.value},message:Q.message}),W.dirty()}else if(Q.kind==="datetime"){if(!w6(Q).test(f.data))X=this._getOrReturnCtx(f,X),n(X,{code:l.invalid_string,validation:"datetime",message:Q.message}),W.dirty()}else if(Q.kind==="date"){if(!X7.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{code:l.invalid_string,validation:"date",message:Q.message}),W.dirty()}else if(Q.kind==="time"){if(!P7(Q).test(f.data))X=this._getOrReturnCtx(f,X),n(X,{code:l.invalid_string,validation:"time",message:Q.message}),W.dirty()}else if(Q.kind==="duration"){if(!s5.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"duration",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="ip"){if(!Y7(f.data,Q.version))X=this._getOrReturnCtx(f,X),n(X,{validation:"ip",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="jwt"){if(!w7(f.data,Q.alg))X=this._getOrReturnCtx(f,X),n(X,{validation:"jwt",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="cidr"){if(!G7(f.data,Q.version))X=this._getOrReturnCtx(f,X),n(X,{validation:"cidr",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64"){if(!W7.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"base64",code:l.invalid_string,message:Q.message}),W.dirty()}else if(Q.kind==="base64url"){if(!J7.test(f.data))X=this._getOrReturnCtx(f,X),n(X,{validation:"base64url",code:l.invalid_string,message:Q.message}),W.dirty()}else Ov.assertNever(Q);return{status:W.value,value:f.data}}_regex(f,v,W){return this.refinement((X)=>f.test(X),{validation:v,code:l.invalid_string,...o.errToObj(W)})}_addCheck(f){return new cf({...this._def,checks:[...this._def.checks,f]})}email(f){return this._addCheck({kind:"email",...o.errToObj(f)})}url(f){return this._addCheck({kind:"url",...o.errToObj(f)})}emoji(f){return this._addCheck({kind:"emoji",...o.errToObj(f)})}uuid(f){return this._addCheck({kind:"uuid",...o.errToObj(f)})}nanoid(f){return this._addCheck({kind:"nanoid",...o.errToObj(f)})}cuid(f){return this._addCheck({kind:"cuid",...o.errToObj(f)})}cuid2(f){return this._addCheck({kind:"cuid2",...o.errToObj(f)})}ulid(f){return this._addCheck({kind:"ulid",...o.errToObj(f)})}base64(f){return this._addCheck({kind:"base64",...o.errToObj(f)})}base64url(f){return this._addCheck({kind:"base64url",...o.errToObj(f)})}jwt(f){return this._addCheck({kind:"jwt",...o.errToObj(f)})}ip(f){return this._addCheck({kind:"ip",...o.errToObj(f)})}cidr(f){return this._addCheck({kind:"cidr",...o.errToObj(f)})}datetime(f){if(typeof f==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:f});return this._addCheck({kind:"datetime",precision:typeof f?.precision==="undefined"?null:f?.precision,offset:f?.offset??!1,local:f?.local??!1,...o.errToObj(f?.message)})}date(f){return this._addCheck({kind:"date",message:f})}time(f){if(typeof f==="string")return this._addCheck({kind:"time",precision:null,message:f});return this._addCheck({kind:"time",precision:typeof f?.precision==="undefined"?null:f?.precision,...o.errToObj(f?.message)})}duration(f){return this._addCheck({kind:"duration",...o.errToObj(f)})}regex(f,v){return this._addCheck({kind:"regex",regex:f,...o.errToObj(v)})}includes(f,v){return this._addCheck({kind:"includes",value:f,position:v?.position,...o.errToObj(v?.message)})}startsWith(f,v){return this._addCheck({kind:"startsWith",value:f,...o.errToObj(v)})}endsWith(f,v){return this._addCheck({kind:"endsWith",value:f,...o.errToObj(v)})}min(f,v){return this._addCheck({kind:"min",value:f,...o.errToObj(v)})}max(f,v){return this._addCheck({kind:"max",value:f,...o.errToObj(v)})}length(f,v){return this._addCheck({kind:"length",value:f,...o.errToObj(v)})}nonempty(f){return this.min(1,o.errToObj(f))}trim(){return new cf({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new cf({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new cf({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((f)=>f.kind==="datetime")}get isDate(){return!!this._def.checks.find((f)=>f.kind==="date")}get isTime(){return!!this._def.checks.find((f)=>f.kind==="time")}get isDuration(){return!!this._def.checks.find((f)=>f.kind==="duration")}get isEmail(){return!!this._def.checks.find((f)=>f.kind==="email")}get isURL(){return!!this._def.checks.find((f)=>f.kind==="url")}get isEmoji(){return!!this._def.checks.find((f)=>f.kind==="emoji")}get isUUID(){return!!this._def.checks.find((f)=>f.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((f)=>f.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((f)=>f.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((f)=>f.kind==="cuid2")}get isULID(){return!!this._def.checks.find((f)=>f.kind==="ulid")}get isIP(){return!!this._def.checks.find((f)=>f.kind==="ip")}get isCIDR(){return!!this._def.checks.find((f)=>f.kind==="cidr")}get isBase64(){return!!this._def.checks.find((f)=>f.kind==="base64")}get isBase64url(){return!!this._def.checks.find((f)=>f.kind==="base64url")}get minLength(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxLength(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}};cf.create=(f)=>{return new cf({checks:[],typeName:u.ZodString,coerce:f?.coerce??!1,...wv(f)})};r1=class r1 extends zv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(f){if(this._def.coerce)f.data=Number(f.data);if(this._getType(f)!==r.number){let Q=this._getOrReturnCtx(f);return n(Q,{code:l.invalid_type,expected:r.number,received:Q.parsedType}),fv}let W=void 0,X=new Wf;for(let Q of this._def.checks)if(Q.kind==="int"){if(!Ov.isInteger(f.data))W=this._getOrReturnCtx(f,W),n(W,{code:l.invalid_type,expected:"integer",received:"float",message:Q.message}),X.dirty()}else if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),n(W,{code:l.too_small,minimum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),X.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),n(W,{code:l.too_big,maximum:Q.value,type:"number",inclusive:Q.inclusive,exact:!1,message:Q.message}),X.dirty()}else if(Q.kind==="multipleOf"){if(z7(f.data,Q.value)!==0)W=this._getOrReturnCtx(f,W),n(W,{code:l.not_multiple_of,multipleOf:Q.value,message:Q.message}),X.dirty()}else if(Q.kind==="finite"){if(!Number.isFinite(f.data))W=this._getOrReturnCtx(f,W),n(W,{code:l.not_finite,message:Q.message}),X.dirty()}else Ov.assertNever(Q);return{status:X.value,value:f.data}}gte(f,v){return this.setLimit("min",f,!0,o.toString(v))}gt(f,v){return this.setLimit("min",f,!1,o.toString(v))}lte(f,v){return this.setLimit("max",f,!0,o.toString(v))}lt(f,v){return this.setLimit("max",f,!1,o.toString(v))}setLimit(f,v,W,X){return new r1({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:o.toString(X)}]})}_addCheck(f){return new r1({...this._def,checks:[...this._def.checks,f]})}int(f){return this._addCheck({kind:"int",message:o.toString(f)})}positive(f){return this._addCheck({kind:"min",value:0,inclusive:!1,message:o.toString(f)})}negative(f){return this._addCheck({kind:"max",value:0,inclusive:!1,message:o.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:0,inclusive:!0,message:o.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:0,inclusive:!0,message:o.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:o.toString(v)})}finite(f){return this._addCheck({kind:"finite",message:o.toString(f)})}safe(f){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:o.toString(f)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:o.toString(f)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}get isInt(){return!!this._def.checks.find((f)=>f.kind==="int"||f.kind==="multipleOf"&&Ov.isInteger(f.value))}get isFinite(){let f=null,v=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(v===null||W.value>v)v=W.value}else if(W.kind==="max"){if(f===null||W.value<f)f=W.value}return Number.isFinite(v)&&Number.isFinite(f)}};r1.create=(f)=>{return new r1({checks:[],typeName:u.ZodNumber,coerce:f?.coerce||!1,...wv(f)})};a1=class a1 extends zv{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(f){if(this._def.coerce)try{f.data=BigInt(f.data)}catch{return this._getInvalidInput(f)}if(this._getType(f)!==r.bigint)return this._getInvalidInput(f);let W=void 0,X=new Wf;for(let Q of this._def.checks)if(Q.kind==="min"){if(Q.inclusive?f.data<Q.value:f.data<=Q.value)W=this._getOrReturnCtx(f,W),n(W,{code:l.too_small,type:"bigint",minimum:Q.value,inclusive:Q.inclusive,message:Q.message}),X.dirty()}else if(Q.kind==="max"){if(Q.inclusive?f.data>Q.value:f.data>=Q.value)W=this._getOrReturnCtx(f,W),n(W,{code:l.too_big,type:"bigint",maximum:Q.value,inclusive:Q.inclusive,message:Q.message}),X.dirty()}else if(Q.kind==="multipleOf"){if(f.data%Q.value!==BigInt(0))W=this._getOrReturnCtx(f,W),n(W,{code:l.not_multiple_of,multipleOf:Q.value,message:Q.message}),X.dirty()}else Ov.assertNever(Q);return{status:X.value,value:f.data}}_getInvalidInput(f){let v=this._getOrReturnCtx(f);return n(v,{code:l.invalid_type,expected:r.bigint,received:v.parsedType}),fv}gte(f,v){return this.setLimit("min",f,!0,o.toString(v))}gt(f,v){return this.setLimit("min",f,!1,o.toString(v))}lte(f,v){return this.setLimit("max",f,!0,o.toString(v))}lt(f,v){return this.setLimit("max",f,!1,o.toString(v))}setLimit(f,v,W,X){return new a1({...this._def,checks:[...this._def.checks,{kind:f,value:v,inclusive:W,message:o.toString(X)}]})}_addCheck(f){return new a1({...this._def,checks:[...this._def.checks,f]})}positive(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:o.toString(f)})}negative(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:o.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:o.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:o.toString(f)})}multipleOf(f,v){return this._addCheck({kind:"multipleOf",value:f,message:o.toString(v)})}get minValue(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f}get maxValue(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f}};a1.create=(f)=>{return new a1({checks:[],typeName:u.ZodBigInt,coerce:f?.coerce??!1,...wv(f)})};c0=class c0 extends zv{_parse(f){if(this._def.coerce)f.data=Boolean(f.data);if(this._getType(f)!==r.boolean){let W=this._getOrReturnCtx(f);return n(W,{code:l.invalid_type,expected:r.boolean,received:W.parsedType}),fv}return Gf(f.data)}};c0.create=(f)=>{return new c0({typeName:u.ZodBoolean,coerce:f?.coerce||!1,...wv(f)})};h0=class h0 extends zv{_parse(f){if(this._def.coerce)f.data=new Date(f.data);if(this._getType(f)!==r.date){let Q=this._getOrReturnCtx(f);return n(Q,{code:l.invalid_type,expected:r.date,received:Q.parsedType}),fv}if(Number.isNaN(f.data.getTime())){let Q=this._getOrReturnCtx(f);return n(Q,{code:l.invalid_date}),fv}let W=new Wf,X=void 0;for(let Q of this._def.checks)if(Q.kind==="min"){if(f.data.getTime()<Q.value)X=this._getOrReturnCtx(f,X),n(X,{code:l.too_small,message:Q.message,inclusive:!0,exact:!1,minimum:Q.value,type:"date"}),W.dirty()}else if(Q.kind==="max"){if(f.data.getTime()>Q.value)X=this._getOrReturnCtx(f,X),n(X,{code:l.too_big,message:Q.message,inclusive:!0,exact:!1,maximum:Q.value,type:"date"}),W.dirty()}else Ov.assertNever(Q);return{status:W.value,value:new Date(f.data.getTime())}}_addCheck(f){return new h0({...this._def,checks:[...this._def.checks,f]})}min(f,v){return this._addCheck({kind:"min",value:f.getTime(),message:o.toString(v)})}max(f,v){return this._addCheck({kind:"max",value:f.getTime(),message:o.toString(v)})}get minDate(){let f=null;for(let v of this._def.checks)if(v.kind==="min"){if(f===null||v.value>f)f=v.value}return f!=null?new Date(f):null}get maxDate(){let f=null;for(let v of this._def.checks)if(v.kind==="max"){if(f===null||v.value<f)f=v.value}return f!=null?new Date(f):null}};h0.create=(f)=>{return new h0({checks:[],coerce:f?.coerce||!1,typeName:u.ZodDate,...wv(f)})};jQ=class jQ extends zv{_parse(f){if(this._getType(f)!==r.symbol){let W=this._getOrReturnCtx(f);return n(W,{code:l.invalid_type,expected:r.symbol,received:W.parsedType}),fv}return Gf(f.data)}};jQ.create=(f)=>{return new jQ({typeName:u.ZodSymbol,...wv(f)})};n0=class n0 extends zv{_parse(f){if(this._getType(f)!==r.undefined){let W=this._getOrReturnCtx(f);return n(W,{code:l.invalid_type,expected:r.undefined,received:W.parsedType}),fv}return Gf(f.data)}};n0.create=(f)=>{return new n0({typeName:u.ZodUndefined,...wv(f)})};p0=class p0 extends zv{_parse(f){if(this._getType(f)!==r.null){let W=this._getOrReturnCtx(f);return n(W,{code:l.invalid_type,expected:r.null,received:W.parsedType}),fv}return Gf(f.data)}};p0.create=(f)=>{return new p0({typeName:u.ZodNull,...wv(f)})};$0=class $0 extends zv{constructor(){super(...arguments);this._any=!0}_parse(f){return Gf(f.data)}};$0.create=(f)=>{return new $0({typeName:u.ZodAny,...wv(f)})};m1=class m1 extends zv{constructor(){super(...arguments);this._unknown=!0}_parse(f){return Gf(f.data)}};m1.create=(f)=>{return new m1({typeName:u.ZodUnknown,...wv(f)})};K1=class K1 extends zv{_parse(f){let v=this._getOrReturnCtx(f);return n(v,{code:l.invalid_type,expected:r.never,received:v.parsedType}),fv}};K1.create=(f)=>{return new K1({typeName:u.ZodNever,...wv(f)})};FQ=class FQ extends zv{_parse(f){if(this._getType(f)!==r.undefined){let W=this._getOrReturnCtx(f);return n(W,{code:l.invalid_type,expected:r.void,received:W.parsedType}),fv}return Gf(f.data)}};FQ.create=(f)=>{return new FQ({typeName:u.ZodVoid,...wv(f)})};nf=class nf extends zv{_parse(f){let{ctx:v,status:W}=this._processInputParams(f),X=this._def;if(v.parsedType!==r.array)return n(v,{code:l.invalid_type,expected:r.array,received:v.parsedType}),fv;if(X.exactLength!==null){let P=v.data.length>X.exactLength.value,w=v.data.length<X.exactLength.value;if(P||w)n(v,{code:P?l.too_big:l.too_small,minimum:w?X.exactLength.value:void 0,maximum:P?X.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:X.exactLength.message}),W.dirty()}if(X.minLength!==null){if(v.data.length<X.minLength.value)n(v,{code:l.too_small,minimum:X.minLength.value,type:"array",inclusive:!0,exact:!1,message:X.minLength.message}),W.dirty()}if(X.maxLength!==null){if(v.data.length>X.maxLength.value)n(v,{code:l.too_big,maximum:X.maxLength.value,type:"array",inclusive:!0,exact:!1,message:X.maxLength.message}),W.dirty()}if(v.common.async)return Promise.all([...v.data].map((P,w)=>{return X.type._parseAsync(new df(v,P,v.path,w))})).then((P)=>{return Wf.mergeArray(W,P)});let Q=[...v.data].map((P,w)=>{return X.type._parseSync(new df(v,P,v.path,w))});return Wf.mergeArray(W,Q)}get element(){return this._def.type}min(f,v){return new nf({...this._def,minLength:{value:f,message:o.toString(v)}})}max(f,v){return new nf({...this._def,maxLength:{value:f,message:o.toString(v)}})}length(f,v){return new nf({...this._def,exactLength:{value:f,message:o.toString(v)}})}nonempty(f){return this.min(1,f)}};nf.create=(f,v)=>{return new nf({type:f,minLength:null,maxLength:null,exactLength:null,typeName:u.ZodArray,...wv(v)})};mv=class mv extends zv{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let f=this._def.shape(),v=Ov.objectKeys(f);return this._cached={shape:f,keys:v},this._cached}_parse(f){if(this._getType(f)!==r.object){let B=this._getOrReturnCtx(f);return n(B,{code:l.invalid_type,expected:r.object,received:B.parsedType}),fv}let{status:W,ctx:X}=this._processInputParams(f),{shape:Q,keys:P}=this._getCached(),w=[];if(!(this._def.catchall instanceof K1&&this._def.unknownKeys==="strip")){for(let B in X.data)if(!P.includes(B))w.push(B)}let G=[];for(let B of P){let D=Q[B],M=X.data[B];G.push({key:{status:"valid",value:B},value:D._parse(new df(X,M,X.path,B)),alwaysSet:B in X.data})}if(this._def.catchall instanceof K1){let B=this._def.unknownKeys;if(B==="passthrough")for(let D of w)G.push({key:{status:"valid",value:D},value:{status:"valid",value:X.data[D]}});else if(B==="strict"){if(w.length>0)n(X,{code:l.unrecognized_keys,keys:w}),W.dirty()}else if(B==="strip");else throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let B=this._def.catchall;for(let D of w){let M=X.data[D];G.push({key:{status:"valid",value:D},value:B._parse(new df(X,M,X.path,D)),alwaysSet:D in X.data})}}if(X.common.async)return Promise.resolve().then(async()=>{let B=[];for(let D of G){let M=await D.key,A=await D.value;B.push({key:M,value:A,alwaysSet:D.alwaysSet})}return B}).then((B)=>{return Wf.mergeObjectSync(W,B)});else return Wf.mergeObjectSync(W,G)}get shape(){return this._def.shape()}strict(f){return o.errToObj,new mv({...this._def,unknownKeys:"strict",...f!==void 0?{errorMap:(v,W)=>{let X=this._def.errorMap?.(v,W).message??W.defaultError;if(v.code==="unrecognized_keys")return{message:o.errToObj(f).message??X};return{message:X}}}:{}})}strip(){return new mv({...this._def,unknownKeys:"strip"})}passthrough(){return new mv({...this._def,unknownKeys:"passthrough"})}extend(f){return new mv({...this._def,shape:()=>({...this._def.shape(),...f})})}merge(f){return new mv({unknownKeys:f._def.unknownKeys,catchall:f._def.catchall,shape:()=>({...this._def.shape(),...f._def.shape()}),typeName:u.ZodObject})}setKey(f,v){return this.augment({[f]:v})}catchall(f){return new mv({...this._def,catchall:f})}pick(f){let v={};for(let W of Ov.objectKeys(f))if(f[W]&&this.shape[W])v[W]=this.shape[W];return new mv({...this._def,shape:()=>v})}omit(f){let v={};for(let W of Ov.objectKeys(this.shape))if(!f[W])v[W]=this.shape[W];return new mv({...this._def,shape:()=>v})}deepPartial(){return r0(this)}partial(f){let v={};for(let W of Ov.objectKeys(this.shape)){let X=this.shape[W];if(f&&!f[W])v[W]=X;else v[W]=X.optional()}return new mv({...this._def,shape:()=>v})}required(f){let v={};for(let W of Ov.objectKeys(this.shape))if(f&&!f[W])v[W]=this.shape[W];else{let Q=this.shape[W];while(Q instanceof pf)Q=Q._def.innerType;v[W]=Q}return new mv({...this._def,shape:()=>v})}keyof(){return G6(Ov.objectKeys(this.shape))}};mv.create=(f,v)=>{return new mv({shape:()=>f,unknownKeys:"strip",catchall:K1.create(),typeName:u.ZodObject,...wv(v)})};mv.strictCreate=(f,v)=>{return new mv({shape:()=>f,unknownKeys:"strict",catchall:K1.create(),typeName:u.ZodObject,...wv(v)})};mv.lazycreate=(f,v)=>{return new mv({shape:f,unknownKeys:"strip",catchall:K1.create(),typeName:u.ZodObject,...wv(v)})};i0=class i0 extends zv{_parse(f){let{ctx:v}=this._processInputParams(f),W=this._def.options;function X(Q){for(let w of Q)if(w.result.status==="valid")return w.result;for(let w of Q)if(w.result.status==="dirty")return v.common.issues.push(...w.ctx.common.issues),w.result;let P=Q.map((w)=>new Vf(w.ctx.common.issues));return n(v,{code:l.invalid_union,unionErrors:P}),fv}if(v.common.async)return Promise.all(W.map(async(Q)=>{let P={...v,common:{...v.common,issues:[]},parent:null};return{result:await Q._parseAsync({data:v.data,path:v.path,parent:P}),ctx:P}})).then(X);else{let Q=void 0,P=[];for(let G of W){let B={...v,common:{...v.common,issues:[]},parent:null},D=G._parseSync({data:v.data,path:v.path,parent:B});if(D.status==="valid")return D;else if(D.status==="dirty"&&!Q)Q={result:D,ctx:B};if(B.common.issues.length)P.push(B.common.issues)}if(Q)return v.common.issues.push(...Q.ctx.common.issues),Q.result;let w=P.map((G)=>new Vf(G));return n(v,{code:l.invalid_union,unionErrors:w}),fv}}get options(){return this._def.options}};i0.create=(f,v)=>{return new i0({options:f,typeName:u.ZodUnion,...wv(v)})};A8=class A8 extends zv{_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==r.object)return n(v,{code:l.invalid_type,expected:r.object,received:v.parsedType}),fv;let W=this.discriminator,X=v.data[W],Q=this.optionsMap.get(X);if(!Q)return n(v,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[W]}),fv;if(v.common.async)return Q._parseAsync({data:v.data,path:v.path,parent:v});else return Q._parseSync({data:v.data,path:v.path,parent:v})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(f,v,W){let X=new Map;for(let Q of v){let P=L1(Q.shape[f]);if(!P.length)throw new Error(`A discriminator value for key \`${f}\` could not be extracted from all schema options`);for(let w of P){if(X.has(w))throw new Error(`Discriminator property ${String(f)} has duplicate value ${String(w)}`);X.set(w,Q)}}return new A8({typeName:u.ZodDiscriminatedUnion,discriminator:f,options:v,optionsMap:X,...wv(W)})}};d0=class d0 extends zv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f),X=(Q,P)=>{if(N8(Q)||N8(P))return fv;let w=tW(Q.value,P.value);if(!w.valid)return n(W,{code:l.invalid_intersection_types}),fv;if(E8(Q)||E8(P))v.dirty();return{status:v.value,value:w.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(([Q,P])=>X(Q,P));else return X(this._def.left._parseSync({data:W.data,path:W.path,parent:W}),this._def.right._parseSync({data:W.data,path:W.path,parent:W}))}};d0.create=(f,v,W)=>{return new d0({left:f,right:v,typeName:u.ZodIntersection,...wv(W)})};h1=class h1 extends zv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==r.array)return n(W,{code:l.invalid_type,expected:r.array,received:W.parsedType}),fv;if(W.data.length<this._def.items.length)return n(W,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),fv;if(!this._def.rest&&W.data.length>this._def.items.length)n(W,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v.dirty();let Q=[...W.data].map((P,w)=>{let G=this._def.items[w]||this._def.rest;if(!G)return null;return G._parse(new df(W,P,W.path,w))}).filter((P)=>!!P);if(W.common.async)return Promise.all(Q).then((P)=>{return Wf.mergeArray(v,P)});else return Wf.mergeArray(v,Q)}get items(){return this._def.items}rest(f){return new h1({...this._def,rest:f})}};h1.create=(f,v)=>{if(!Array.isArray(f))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new h1({items:f,typeName:u.ZodTuple,rest:null,...wv(v)})};LQ=class LQ extends zv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==r.object)return n(W,{code:l.invalid_type,expected:r.object,received:W.parsedType}),fv;let X=[],Q=this._def.keyType,P=this._def.valueType;for(let w in W.data)X.push({key:Q._parse(new df(W,w,W.path,w)),value:P._parse(new df(W,W.data[w],W.path,w)),alwaysSet:w in W.data});if(W.common.async)return Wf.mergeObjectAsync(v,X);else return Wf.mergeObjectSync(v,X)}get element(){return this._def.valueType}static create(f,v,W){if(v instanceof zv)return new LQ({keyType:f,valueType:v,typeName:u.ZodRecord,...wv(W)});return new LQ({keyType:cf.create(),valueType:f,typeName:u.ZodRecord,...wv(v)})}};SQ=class SQ extends zv{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==r.map)return n(W,{code:l.invalid_type,expected:r.map,received:W.parsedType}),fv;let X=this._def.keyType,Q=this._def.valueType,P=[...W.data.entries()].map(([w,G],B)=>{return{key:X._parse(new df(W,w,W.path,[B,"key"])),value:Q._parse(new df(W,G,W.path,[B,"value"]))}});if(W.common.async){let w=new Map;return Promise.resolve().then(async()=>{for(let G of P){let B=await G.key,D=await G.value;if(B.status==="aborted"||D.status==="aborted")return fv;if(B.status==="dirty"||D.status==="dirty")v.dirty();w.set(B.value,D.value)}return{status:v.value,value:w}})}else{let w=new Map;for(let G of P){let{key:B,value:D}=G;if(B.status==="aborted"||D.status==="aborted")return fv;if(B.status==="dirty"||D.status==="dirty")v.dirty();w.set(B.value,D.value)}return{status:v.value,value:w}}}};SQ.create=(f,v,W)=>{return new SQ({valueType:v,keyType:f,typeName:u.ZodMap,...wv(W)})};D0=class D0 extends zv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.parsedType!==r.set)return n(W,{code:l.invalid_type,expected:r.set,received:W.parsedType}),fv;let X=this._def;if(X.minSize!==null){if(W.data.size<X.minSize.value)n(W,{code:l.too_small,minimum:X.minSize.value,type:"set",inclusive:!0,exact:!1,message:X.minSize.message}),v.dirty()}if(X.maxSize!==null){if(W.data.size>X.maxSize.value)n(W,{code:l.too_big,maximum:X.maxSize.value,type:"set",inclusive:!0,exact:!1,message:X.maxSize.message}),v.dirty()}let Q=this._def.valueType;function P(G){let B=new Set;for(let D of G){if(D.status==="aborted")return fv;if(D.status==="dirty")v.dirty();B.add(D.value)}return{status:v.value,value:B}}let w=[...W.data.values()].map((G,B)=>Q._parse(new df(W,G,W.path,B)));if(W.common.async)return Promise.all(w).then((G)=>P(G));else return P(w)}min(f,v){return new D0({...this._def,minSize:{value:f,message:o.toString(v)}})}max(f,v){return new D0({...this._def,maxSize:{value:f,message:o.toString(v)}})}size(f,v){return this.min(f,v).max(f,v)}nonempty(f){return this.min(1,f)}};D0.create=(f,v)=>{return new D0({valueType:f,minSize:null,maxSize:null,typeName:u.ZodSet,...wv(v)})};a0=class a0 extends zv{constructor(){super(...arguments);this.validate=this.implement}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==r.function)return n(v,{code:l.invalid_type,expected:r.function,received:v.parsedType}),fv;function W(w,G){return UQ({data:w,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,u0(),F1].filter((B)=>!!B),issueData:{code:l.invalid_arguments,argumentsError:G}})}function X(w,G){return UQ({data:w,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,u0(),F1].filter((B)=>!!B),issueData:{code:l.invalid_return_type,returnTypeError:G}})}let Q={errorMap:v.common.contextualErrorMap},P=v.data;if(this._def.returns instanceof M0){let w=this;return Gf(async function(...G){let B=new Vf([]),D=await w._def.args.parseAsync(G,Q).catch((N)=>{throw B.addIssue(W(G,N)),B}),M=await Reflect.apply(P,this,D);return await w._def.returns._def.type.parseAsync(M,Q).catch((N)=>{throw B.addIssue(X(M,N)),B})})}else{let w=this;return Gf(function(...G){let B=w._def.args.safeParse(G,Q);if(!B.success)throw new Vf([W(G,B.error)]);let D=Reflect.apply(P,this,B.data),M=w._def.returns.safeParse(D,Q);if(!M.success)throw new Vf([X(D,M.error)]);return M.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...f){return new a0({...this._def,args:h1.create(f).rest(m1.create())})}returns(f){return new a0({...this._def,returns:f})}implement(f){return this.parse(f)}strictImplement(f){return this.parse(f)}static create(f,v,W){return new a0({args:f?f:h1.create([]).rest(m1.create()),returns:v||m1.create(),typeName:u.ZodFunction,...wv(W)})}};s0=class s0 extends zv{get schema(){return this._def.getter()}_parse(f){let{ctx:v}=this._processInputParams(f);return this._def.getter()._parse({data:v.data,path:v.path,parent:v})}};s0.create=(f,v)=>{return new s0({getter:f,typeName:u.ZodLazy,...wv(v)})};o0=class o0 extends zv{_parse(f){if(f.data!==this._def.value){let v=this._getOrReturnCtx(f);return n(v,{received:v.data,code:l.invalid_literal,expected:this._def.value}),fv}return{status:"valid",value:f.data}}get value(){return this._def.value}};o0.create=(f,v)=>{return new o0({value:f,typeName:u.ZodLiteral,...wv(v)})};c1=class c1 extends zv{_parse(f){if(typeof f.data!=="string"){let v=this._getOrReturnCtx(f),W=this._def.values;return n(v,{expected:Ov.joinValues(W),received:v.parsedType,code:l.invalid_type}),fv}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(f.data)){let v=this._getOrReturnCtx(f),W=this._def.values;return n(v,{received:v.data,code:l.invalid_enum_value,options:W}),fv}return Gf(f.data)}get options(){return this._def.values}get enum(){let f={};for(let v of this._def.values)f[v]=v;return f}get Values(){let f={};for(let v of this._def.values)f[v]=v;return f}get Enum(){let f={};for(let v of this._def.values)f[v]=v;return f}extract(f,v=this._def){return c1.create(f,{...this._def,...v})}exclude(f,v=this._def){return c1.create(this.options.filter((W)=>!f.includes(W)),{...this._def,...v})}};c1.create=G6;t0=class t0 extends zv{_parse(f){let v=Ov.getValidEnumValues(this._def.values),W=this._getOrReturnCtx(f);if(W.parsedType!==r.string&&W.parsedType!==r.number){let X=Ov.objectValues(v);return n(W,{expected:Ov.joinValues(X),received:W.parsedType,code:l.invalid_type}),fv}if(!this._cache)this._cache=new Set(Ov.getValidEnumValues(this._def.values));if(!this._cache.has(f.data)){let X=Ov.objectValues(v);return n(W,{received:W.data,code:l.invalid_enum_value,options:X}),fv}return Gf(f.data)}get enum(){return this._def.values}};t0.create=(f,v)=>{return new t0({values:f,typeName:u.ZodNativeEnum,...wv(v)})};M0=class M0 extends zv{unwrap(){return this._def.type}_parse(f){let{ctx:v}=this._processInputParams(f);if(v.parsedType!==r.promise&&v.common.async===!1)return n(v,{code:l.invalid_type,expected:r.promise,received:v.parsedType}),fv;let W=v.parsedType===r.promise?v.data:Promise.resolve(v.data);return Gf(W.then((X)=>{return this._def.type.parseAsync(X,{path:v.path,errorMap:v.common.contextualErrorMap})}))}};M0.create=(f,v)=>{return new M0({type:f,typeName:u.ZodPromise,...wv(v)})};sf=class sf extends zv{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===u.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(f){let{status:v,ctx:W}=this._processInputParams(f),X=this._def.effect||null,Q={addIssue:(P)=>{if(n(W,P),P.fatal)v.abort();else v.dirty()},get path(){return W.path}};if(Q.addIssue=Q.addIssue.bind(Q),X.type==="preprocess"){let P=X.transform(W.data,Q);if(W.common.async)return Promise.resolve(P).then(async(w)=>{if(v.value==="aborted")return fv;let G=await this._def.schema._parseAsync({data:w,path:W.path,parent:W});if(G.status==="aborted")return fv;if(G.status==="dirty")return K0(G.value);if(v.value==="dirty")return K0(G.value);return G});else{if(v.value==="aborted")return fv;let w=this._def.schema._parseSync({data:P,path:W.path,parent:W});if(w.status==="aborted")return fv;if(w.status==="dirty")return K0(w.value);if(v.value==="dirty")return K0(w.value);return w}}if(X.type==="refinement"){let P=(w)=>{let G=X.refinement(w,Q);if(W.common.async)return Promise.resolve(G);if(G instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return w};if(W.common.async===!1){let w=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(w.status==="aborted")return fv;if(w.status==="dirty")v.dirty();return P(w.value),{status:v.value,value:w.value}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((w)=>{if(w.status==="aborted")return fv;if(w.status==="dirty")v.dirty();return P(w.value).then(()=>{return{status:v.value,value:w.value}})})}if(X.type==="transform")if(W.common.async===!1){let P=this._def.schema._parseSync({data:W.data,path:W.path,parent:W});if(!u1(P))return fv;let w=X.transform(P.value,Q);if(w instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:v.value,value:w}}else return this._def.schema._parseAsync({data:W.data,path:W.path,parent:W}).then((P)=>{if(!u1(P))return fv;return Promise.resolve(X.transform(P.value,Q)).then((w)=>({status:v.value,value:w}))});Ov.assertNever(X)}};sf.create=(f,v,W)=>{return new sf({schema:f,typeName:u.ZodEffects,effect:v,...wv(W)})};sf.createWithPreprocess=(f,v,W)=>{return new sf({schema:v,effect:{type:"preprocess",transform:f},typeName:u.ZodEffects,...wv(W)})};pf=class pf extends zv{_parse(f){if(this._getType(f)===r.undefined)return Gf(void 0);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}};pf.create=(f,v)=>{return new pf({innerType:f,typeName:u.ZodOptional,...wv(v)})};S1=class S1 extends zv{_parse(f){if(this._getType(f)===r.null)return Gf(null);return this._def.innerType._parse(f)}unwrap(){return this._def.innerType}};S1.create=(f,v)=>{return new S1({innerType:f,typeName:u.ZodNullable,...wv(v)})};e0=class e0 extends zv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;if(v.parsedType===r.undefined)W=this._def.defaultValue();return this._def.innerType._parse({data:W,path:v.path,parent:v})}removeDefault(){return this._def.innerType}};e0.create=(f,v)=>{return new e0({innerType:f,typeName:u.ZodDefault,defaultValue:typeof v.default==="function"?v.default:()=>v.default,...wv(v)})};vQ=class vQ extends zv{_parse(f){let{ctx:v}=this._processInputParams(f),W={...v,common:{...v.common,issues:[]}},X=this._def.innerType._parse({data:W.data,path:W.path,parent:{...W}});if(m0(X))return X.then((Q)=>{return{status:"valid",value:Q.status==="valid"?Q.value:this._def.catchValue({get error(){return new Vf(W.common.issues)},input:W.data})}});else return{status:"valid",value:X.status==="valid"?X.value:this._def.catchValue({get error(){return new Vf(W.common.issues)},input:W.data})}}removeCatch(){return this._def.innerType}};vQ.create=(f,v)=>{return new vQ({innerType:f,typeName:u.ZodCatch,catchValue:typeof v.catch==="function"?v.catch:()=>v.catch,...wv(v)})};gQ=class gQ extends zv{_parse(f){if(this._getType(f)!==r.nan){let W=this._getOrReturnCtx(f);return n(W,{code:l.invalid_type,expected:r.nan,received:W.parsedType}),fv}return{status:"valid",value:f.data}}};gQ.create=(f)=>{return new gQ({typeName:u.ZodNaN,...wv(f)})};B7=Symbol("zod_brand");U8=class U8 extends zv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}};RQ=class RQ extends zv{_parse(f){let{status:v,ctx:W}=this._processInputParams(f);if(W.common.async)return(async()=>{let Q=await this._def.in._parseAsync({data:W.data,path:W.path,parent:W});if(Q.status==="aborted")return fv;if(Q.status==="dirty")return v.dirty(),K0(Q.value);else return this._def.out._parseAsync({data:Q.value,path:W.path,parent:W})})();else{let X=this._def.in._parseSync({data:W.data,path:W.path,parent:W});if(X.status==="aborted")return fv;if(X.status==="dirty")return v.dirty(),{status:"dirty",value:X.value};else return this._def.out._parseSync({data:X.value,path:W.path,parent:W})}}static create(f,v){return new RQ({in:f,out:v,typeName:u.ZodPipeline})}};fQ=class fQ extends zv{_parse(f){let v=this._def.innerType._parse(f),W=(X)=>{if(u1(X))X.value=Object.freeze(X.value);return X};return m0(v)?v.then((X)=>W(X)):W(v)}unwrap(){return this._def.innerType}};fQ.create=(f,v)=>{return new fQ({innerType:f,typeName:u.ZodReadonly,...wv(v)})};K7={object:mv.lazycreate};(function(f){f.ZodString="ZodString",f.ZodNumber="ZodNumber",f.ZodNaN="ZodNaN",f.ZodBigInt="ZodBigInt",f.ZodBoolean="ZodBoolean",f.ZodDate="ZodDate",f.ZodSymbol="ZodSymbol",f.ZodUndefined="ZodUndefined",f.ZodNull="ZodNull",f.ZodAny="ZodAny",f.ZodUnknown="ZodUnknown",f.ZodNever="ZodNever",f.ZodVoid="ZodVoid",f.ZodArray="ZodArray",f.ZodObject="ZodObject",f.ZodUnion="ZodUnion",f.ZodDiscriminatedUnion="ZodDiscriminatedUnion",f.ZodIntersection="ZodIntersection",f.ZodTuple="ZodTuple",f.ZodRecord="ZodRecord",f.ZodMap="ZodMap",f.ZodSet="ZodSet",f.ZodFunction="ZodFunction",f.ZodLazy="ZodLazy",f.ZodLiteral="ZodLiteral",f.ZodEnum="ZodEnum",f.ZodEffects="ZodEffects",f.ZodNativeEnum="ZodNativeEnum",f.ZodOptional="ZodOptional",f.ZodNullable="ZodNullable",f.ZodDefault="ZodDefault",f.ZodCatch="ZodCatch",f.ZodPromise="ZodPromise",f.ZodBranded="ZodBranded",f.ZodPipeline="ZodPipeline",f.ZodReadonly="ZodReadonly"})(u||(u={}));B6=cf.create,K6=r1.create,$7=gQ.create,D7=a1.create,h6=c0.create,M7=h0.create,O7=jQ.create,H7=n0.create,V7=p0.create,q7=$0.create,N7=m1.create,E7=K1.create,A7=FQ.create,U7=nf.create,j7=mv.create,F7=mv.strictCreate,L7=i0.create,S7=A8.create,g7=d0.create,R7=h1.create,_7=LQ.create,k7=SQ.create,I7=D0.create,Z7=a0.create,C7=s0.create,y7=o0.create,T7=c1.create,x7=t0.create,l7=M0.create,b7=sf.create,u7=pf.create,m7=S1.create,r7=sf.createWithPreprocess,a7=RQ.create,i7={string:(f)=>cf.create({...f,coerce:!0}),number:(f)=>r1.create({...f,coerce:!0}),boolean:(f)=>c0.create({...f,coerce:!0}),bigint:(f)=>a1.create({...f,coerce:!0}),date:(f)=>h0.create({...f,coerce:!0})},d7=fv});var K={};pW(K,{void:()=>A7,util:()=>Ov,unknown:()=>N7,union:()=>L7,undefined:()=>H7,tuple:()=>R7,transformer:()=>b7,symbol:()=>O7,string:()=>B6,strictObject:()=>F7,setErrorMap:()=>m5,set:()=>I7,record:()=>_7,quotelessJson:()=>b5,promise:()=>l7,preprocess:()=>r7,pipeline:()=>a7,ostring:()=>c7,optional:()=>u7,onumber:()=>n7,oboolean:()=>p7,objectUtil:()=>iW,object:()=>j7,number:()=>K6,nullable:()=>m7,null:()=>V7,never:()=>E7,nativeEnum:()=>x7,nan:()=>$7,map:()=>k7,makeIssue:()=>UQ,literal:()=>y7,lazy:()=>C7,late:()=>K7,isValid:()=>u1,isDirty:()=>E8,isAsync:()=>m0,isAborted:()=>N8,intersection:()=>g7,instanceof:()=>h7,getParsedType:()=>B1,getErrorMap:()=>u0,function:()=>Z7,enum:()=>T7,effect:()=>b7,discriminatedUnion:()=>S7,defaultErrorMap:()=>F1,datetimeRegex:()=>w6,date:()=>M7,custom:()=>z6,coerce:()=>i7,boolean:()=>h6,bigint:()=>D7,array:()=>U7,any:()=>q7,addIssueToContext:()=>n,ZodVoid:()=>FQ,ZodUnknown:()=>m1,ZodUnion:()=>i0,ZodUndefined:()=>n0,ZodType:()=>zv,ZodTuple:()=>h1,ZodTransformer:()=>sf,ZodSymbol:()=>jQ,ZodString:()=>cf,ZodSet:()=>D0,ZodSchema:()=>zv,ZodRecord:()=>LQ,ZodReadonly:()=>fQ,ZodPromise:()=>M0,ZodPipeline:()=>RQ,ZodParsedType:()=>r,ZodOptional:()=>pf,ZodObject:()=>mv,ZodNumber:()=>r1,ZodNullable:()=>S1,ZodNull:()=>p0,ZodNever:()=>K1,ZodNativeEnum:()=>t0,ZodNaN:()=>gQ,ZodMap:()=>SQ,ZodLiteral:()=>o0,ZodLazy:()=>s0,ZodIssueCode:()=>l,ZodIntersection:()=>d0,ZodFunction:()=>a0,ZodFirstPartyTypeKind:()=>u,ZodError:()=>Vf,ZodEnum:()=>c1,ZodEffects:()=>sf,ZodDiscriminatedUnion:()=>A8,ZodDefault:()=>e0,ZodDate:()=>h0,ZodCatch:()=>vQ,ZodBranded:()=>U8,ZodBoolean:()=>c0,ZodBigInt:()=>a1,ZodArray:()=>nf,ZodAny:()=>$0,Schema:()=>zv,ParseStatus:()=>Wf,OK:()=>Gf,NEVER:()=>d7,INVALID:()=>fv,EMPTY_PATH:()=>r5,DIRTY:()=>K0,BRAND:()=>B7});var eW=jv(()=>{q8();sW();Q6();AQ();$6();V8()});var n1=jv(()=>{eW();eW()});var vJ="2025-06-18",Z3="2025-03-26",D6,j8="2.0",M6,O6,s7,yf,qf,_Q,$1,Tf,F8,H6,V6=(f)=>H6.safeParse(f).success,q6,N6=(f)=>q6.safeParse(f).success,E6,fJ=(f)=>E6.safeParse(f).success,kv,A6,U6=(f)=>A6.safeParse(f).success,j6,L8,S8,kQ,F6,o7,g8,C3=(f)=>g8.safeParse(f).success,t7,e7,QJ,R8,v2,_8,k8,I8,L6,S6,WJ,g6,R6,f2,Z8,Q2,C8,W2,y8,J2,X2,P2,Y2,w2,G2,z2,T8,B2,x8,JJ,XJ,PJ,K2,h2,_6,$2,D2,M2,O2,H2,l8,V2,k6,y3,b8,q2,I6,N2,E2,A2,U2,j2,F2,YJ,L2,S2,g2,R2,_2,k2,wJ,I2,Z2,u8,C2,y2,T2,GJ,x2,T3,x3,l3,b3,u3,m3,Tv;var IQ=jv(()=>{n1();D6=[vJ,"2025-03-26","2024-11-05","2024-10-07"],M6=K.union([K.string(),K.number().int()]),O6=K.string(),s7=K.object({progressToken:K.optional(M6)}).passthrough(),yf=K.object({_meta:K.optional(s7)}).passthrough(),qf=K.object({method:K.string(),params:K.optional(yf)}),_Q=K.object({_meta:K.optional(K.object({}).passthrough())}).passthrough(),$1=K.object({method:K.string(),params:K.optional(_Q)}),Tf=K.object({_meta:K.optional(K.object({}).passthrough())}).passthrough(),F8=K.union([K.string(),K.number().int()]),H6=K.object({jsonrpc:K.literal(j8),id:F8}).merge(qf).strict(),q6=K.object({jsonrpc:K.literal(j8)}).merge($1).strict(),E6=K.object({jsonrpc:K.literal(j8),id:F8,result:Tf}).strict();(function(f){f[f.ConnectionClosed=-32000]="ConnectionClosed",f[f.RequestTimeout=-32001]="RequestTimeout",f[f.ParseError=-32700]="ParseError",f[f.InvalidRequest=-32600]="InvalidRequest",f[f.MethodNotFound=-32601]="MethodNotFound",f[f.InvalidParams=-32602]="InvalidParams",f[f.InternalError=-32603]="InternalError"})(kv||(kv={}));A6=K.object({jsonrpc:K.literal(j8),id:F8,error:K.object({code:K.number().int(),message:K.string(),data:K.optional(K.unknown())})}).strict(),j6=K.union([H6,q6,E6,A6]),L8=Tf.strict(),S8=$1.extend({method:K.literal("notifications/cancelled"),params:_Q.extend({requestId:F8,reason:K.string().optional()})}),kQ=K.object({name:K.string(),title:K.optional(K.string())}).passthrough(),F6=kQ.extend({version:K.string()}),o7=K.object({experimental:K.optional(K.object({}).passthrough()),sampling:K.optional(K.object({}).passthrough()),elicitation:K.optional(K.object({}).passthrough()),roots:K.optional(K.object({listChanged:K.optional(K.boolean())}).passthrough())}).passthrough(),g8=qf.extend({method:K.literal("initialize"),params:yf.extend({protocolVersion:K.string(),capabilities:o7,clientInfo:F6})}),t7=K.object({experimental:K.optional(K.object({}).passthrough()),logging:K.optional(K.object({}).passthrough()),completions:K.optional(K.object({}).passthrough()),prompts:K.optional(K.object({listChanged:K.optional(K.boolean())}).passthrough()),resources:K.optional(K.object({subscribe:K.optional(K.boolean()),listChanged:K.optional(K.boolean())}).passthrough()),tools:K.optional(K.object({listChanged:K.optional(K.boolean())}).passthrough())}).passthrough(),e7=Tf.extend({protocolVersion:K.string(),capabilities:t7,serverInfo:F6,instructions:K.optional(K.string())}),QJ=$1.extend({method:K.literal("notifications/initialized")}),R8=qf.extend({method:K.literal("ping")}),v2=K.object({progress:K.number(),total:K.optional(K.number()),message:K.optional(K.string())}).passthrough(),_8=$1.extend({method:K.literal("notifications/progress"),params:_Q.merge(v2).extend({progressToken:M6})}),k8=qf.extend({params:yf.extend({cursor:K.optional(O6)}).optional()}),I8=Tf.extend({nextCursor:K.optional(O6)}),L6=K.object({uri:K.string(),mimeType:K.optional(K.string()),_meta:K.optional(K.object({}).passthrough())}).passthrough(),S6=L6.extend({text:K.string()}),WJ=K.string().refine((f)=>{try{return atob(f),!0}catch(v){return!1}},{message:"Invalid Base64 string"}),g6=L6.extend({blob:WJ}),R6=kQ.extend({uri:K.string(),description:K.optional(K.string()),mimeType:K.optional(K.string()),_meta:K.optional(K.object({}).passthrough())}),f2=kQ.extend({uriTemplate:K.string(),description:K.optional(K.string()),mimeType:K.optional(K.string()),_meta:K.optional(K.object({}).passthrough())}),Z8=k8.extend({method:K.literal("resources/list")}),Q2=I8.extend({resources:K.array(R6)}),C8=k8.extend({method:K.literal("resources/templates/list")}),W2=I8.extend({resourceTemplates:K.array(f2)}),y8=qf.extend({method:K.literal("resources/read"),params:yf.extend({uri:K.string()})}),J2=Tf.extend({contents:K.array(K.union([S6,g6]))}),X2=$1.extend({method:K.literal("notifications/resources/list_changed")}),P2=qf.extend({method:K.literal("resources/subscribe"),params:yf.extend({uri:K.string()})}),Y2=qf.extend({method:K.literal("resources/unsubscribe"),params:yf.extend({uri:K.string()})}),w2=$1.extend({method:K.literal("notifications/resources/updated"),params:_Q.extend({uri:K.string()})}),G2=K.object({name:K.string(),description:K.optional(K.string()),required:K.optional(K.boolean())}).passthrough(),z2=kQ.extend({description:K.optional(K.string()),arguments:K.optional(K.array(G2)),_meta:K.optional(K.object({}).passthrough())}),T8=k8.extend({method:K.literal("prompts/list")}),B2=I8.extend({prompts:K.array(z2)}),x8=qf.extend({method:K.literal("prompts/get"),params:yf.extend({name:K.string(),arguments:K.optional(K.record(K.string()))})}),JJ=K.object({type:K.literal("text"),text:K.string(),_meta:K.optional(K.object({}).passthrough())}).passthrough(),XJ=K.object({type:K.literal("image"),data:WJ,mimeType:K.string(),_meta:K.optional(K.object({}).passthrough())}).passthrough(),PJ=K.object({type:K.literal("audio"),data:WJ,mimeType:K.string(),_meta:K.optional(K.object({}).passthrough())}).passthrough(),K2=K.object({type:K.literal("resource"),resource:K.union([S6,g6]),_meta:K.optional(K.object({}).passthrough())}).passthrough(),h2=R6.extend({type:K.literal("resource_link")}),_6=K.union([JJ,XJ,PJ,h2,K2]),$2=K.object({role:K.enum(["user","assistant"]),content:_6}).passthrough(),D2=Tf.extend({description:K.optional(K.string()),messages:K.array($2)}),M2=$1.extend({method:K.literal("notifications/prompts/list_changed")}),O2=K.object({title:K.optional(K.string()),readOnlyHint:K.optional(K.boolean()),destructiveHint:K.optional(K.boolean()),idempotentHint:K.optional(K.boolean()),openWorldHint:K.optional(K.boolean())}).passthrough(),H2=kQ.extend({description:K.optional(K.string()),inputSchema:K.object({type:K.literal("object"),properties:K.optional(K.object({}).passthrough()),required:K.optional(K.array(K.string()))}).passthrough(),outputSchema:K.optional(K.object({type:K.literal("object"),properties:K.optional(K.object({}).passthrough()),required:K.optional(K.array(K.string()))}).passthrough()),annotations:K.optional(O2),_meta:K.optional(K.object({}).passthrough())}),l8=k8.extend({method:K.literal("tools/list")}),V2=I8.extend({tools:K.array(H2)}),k6=Tf.extend({content:K.array(_6).default([]),structuredContent:K.object({}).passthrough().optional(),isError:K.optional(K.boolean())}),y3=k6.or(Tf.extend({toolResult:K.unknown()})),b8=qf.extend({method:K.literal("tools/call"),params:yf.extend({name:K.string(),arguments:K.optional(K.record(K.unknown()))})}),q2=$1.extend({method:K.literal("notifications/tools/list_changed")}),I6=K.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),N2=qf.extend({method:K.literal("logging/setLevel"),params:yf.extend({level:I6})}),E2=$1.extend({method:K.literal("notifications/message"),params:_Q.extend({level:I6,logger:K.optional(K.string()),data:K.unknown()})}),A2=K.object({name:K.string().optional()}).passthrough(),U2=K.object({hints:K.optional(K.array(A2)),costPriority:K.optional(K.number().min(0).max(1)),speedPriority:K.optional(K.number().min(0).max(1)),intelligencePriority:K.optional(K.number().min(0).max(1))}).passthrough(),j2=K.object({role:K.enum(["user","assistant"]),content:K.union([JJ,XJ,PJ])}).passthrough(),F2=qf.extend({method:K.literal("sampling/createMessage"),params:yf.extend({messages:K.array(j2),systemPrompt:K.optional(K.string()),includeContext:K.optional(K.enum(["none","thisServer","allServers"])),temperature:K.optional(K.number()),maxTokens:K.number().int(),stopSequences:K.optional(K.array(K.string())),metadata:K.optional(K.object({}).passthrough()),modelPreferences:K.optional(U2)})}),YJ=Tf.extend({model:K.string(),stopReason:K.optional(K.enum(["endTurn","stopSequence","maxTokens"]).or(K.string())),role:K.enum(["user","assistant"]),content:K.discriminatedUnion("type",[JJ,XJ,PJ])}),L2=K.object({type:K.literal("boolean"),title:K.optional(K.string()),description:K.optional(K.string()),default:K.optional(K.boolean())}).passthrough(),S2=K.object({type:K.literal("string"),title:K.optional(K.string()),description:K.optional(K.string()),minLength:K.optional(K.number()),maxLength:K.optional(K.number()),format:K.optional(K.enum(["email","uri","date","date-time"]))}).passthrough(),g2=K.object({type:K.enum(["number","integer"]),title:K.optional(K.string()),description:K.optional(K.string()),minimum:K.optional(K.number()),maximum:K.optional(K.number())}).passthrough(),R2=K.object({type:K.literal("string"),title:K.optional(K.string()),description:K.optional(K.string()),enum:K.array(K.string()),enumNames:K.optional(K.array(K.string()))}).passthrough(),_2=K.union([L2,S2,g2,R2]),k2=qf.extend({method:K.literal("elicitation/create"),params:yf.extend({message:K.string(),requestedSchema:K.object({type:K.literal("object"),properties:K.record(K.string(),_2),required:K.optional(K.array(K.string()))}).passthrough()})}),wJ=Tf.extend({action:K.enum(["accept","decline","cancel"]),content:K.optional(K.record(K.string(),K.unknown()))}),I2=K.object({type:K.literal("ref/resource"),uri:K.string()}).passthrough(),Z2=K.object({type:K.literal("ref/prompt"),name:K.string()}).passthrough(),u8=qf.extend({method:K.literal("completion/complete"),params:yf.extend({ref:K.union([Z2,I2]),argument:K.object({name:K.string(),value:K.string()}).passthrough(),context:K.optional(K.object({arguments:K.optional(K.record(K.string(),K.string()))}))})}),C2=Tf.extend({completion:K.object({values:K.array(K.string()).max(100),total:K.optional(K.number().int()),hasMore:K.optional(K.boolean())}).passthrough()}),y2=K.object({uri:K.string().startsWith("file://"),name:K.optional(K.string()),_meta:K.optional(K.object({}).passthrough())}).passthrough(),T2=qf.extend({method:K.literal("roots/list")}),GJ=Tf.extend({roots:K.array(y2)}),x2=$1.extend({method:K.literal("notifications/roots/list_changed")}),T3=K.union([R8,g8,u8,N2,x8,T8,Z8,C8,y8,P2,Y2,b8,l8]),x3=K.union([S8,_8,QJ,x2]),l3=K.union([L8,YJ,wJ,GJ]),b3=K.union([R8,F2,k2,T2]),u3=K.union([S8,_8,E2,w2,X2,q2,M2]),m3=K.union([L8,e7,C2,D2,B2,Q2,W2,J2,k6,V2]);Tv=class Tv extends Error{constructor(f,v,W){super(`MCP error ${f}: ${v}`);this.code=f,this.data=W,this.name="McpError"}}});var y6=Qv((m8,C6)=>{(function(f,v){typeof m8==="object"&&typeof C6!=="undefined"?v(m8):typeof define==="function"&&define.amd?define(["exports"],v):v(f.URI=f.URI||{})})(m8,function(f){function v(){for(var j=arguments.length,V=Array(j),S=0;S<j;S++)V[S]=arguments[S];if(V.length>1){V[0]=V[0].slice(0,-1);var I=V.length-1;for(var _=1;_<I;++_)V[_]=V[_].slice(1,-1);return V[I]=V[I].slice(1),V.join("")}else return V[0]}function W(j){return"(?:"+j+")"}function X(j){return j===void 0?"undefined":j===null?"null":Object.prototype.toString.call(j).split(" ").pop().split("]").shift().toLowerCase()}function Q(j){return j.toUpperCase()}function P(j){return j!==void 0&&j!==null?j instanceof Array?j:typeof j.length!=="number"||j.split||j.setInterval||j.call?[j]:Array.prototype.slice.call(j):[]}function w(j,V){var S=j;if(V)for(var I in V)S[I]=V[I];return S}function G(j){var V="[A-Za-z]",S="[\\x0D]",I="[0-9]",_="[\\x22]",c=v(I,"[A-Fa-f]"),Wv="[\\x0A]",Dv="[\\x20]",hv=W(W("%[EFef]"+c+"%"+c+c+"%"+c+c)+"|"+W("%[89A-Fa-f]"+c+"%"+c+c)+"|"+W("%"+c+c)),uv="[\\:\\/\\?\\#\\[\\]\\@]",$v="[\\!\\$\\&\\'\\(\\)\\*\\+\\,\\;\\=]",gv=v(uv,$v),yv=j?"[\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]":"[]",Lv=j?"[\\uE000-\\uF8FF]":"[]",qv=v(V,I,"[\\-\\.\\_\\~]",yv),Rv=W(V+v(V,I,"[\\+\\-\\.]")+"*"),Uv=W(W(hv+"|"+v(qv,$v,"[\\:]"))+"*"),J1=W(W("25[0-5]")+"|"+W("2[0-4]"+I)+"|"+W("1"+I+I)+"|"+W("[1-9]"+I)+"|"+I),ff=W(W("25[0-5]")+"|"+W("2[0-4]"+I)+"|"+W("1"+I+I)+"|"+W("0?[1-9]"+I)+"|0?0?"+I),Pf=W(ff+"\\."+ff+"\\."+ff+"\\."+ff),Fv=W(c+"{1,4}"),hf=W(W(Fv+"\\:"+Fv)+"|"+Pf),Mf=W(W(Fv+"\\:")+"{6}"+hf),_f=W("\\:\\:"+W(Fv+"\\:")+"{5}"+hf),X1=W(W(Fv)+"?\\:\\:"+W(Fv+"\\:")+"{4}"+hf),Yf=W(W(W(Fv+"\\:")+"{0,1}"+Fv)+"?\\:\\:"+W(Fv+"\\:")+"{3}"+hf),Q0=W(W(W(Fv+"\\:")+"{0,2}"+Fv)+"?\\:\\:"+W(Fv+"\\:")+"{2}"+hf),H1=W(W(W(Fv+"\\:")+"{0,3}"+Fv)+"?\\:\\:"+Fv+"\\:"+hf),P1=W(W(W(Fv+"\\:")+"{0,4}"+Fv)+"?\\:\\:"+hf),mf=W(W(W(Fv+"\\:")+"{0,5}"+Fv)+"?\\:\\:"+Fv),dv=W(W(W(Fv+"\\:")+"{0,6}"+Fv)+"?\\:\\:"),kf=W([Mf,_f,X1,Yf,Q0,H1,P1,mf,dv].join("|")),Y1=W(W(qv+"|"+hv)+"+"),L0=W(kf+"\\%25"+Y1),If=W(kf+W("\\%25|\\%(?!"+c+"{2})")+Y1),S0=W("[vV]"+c+"+\\."+v(qv,$v,"[\\:]")+"+"),v8=W("\\["+W(If+"|"+kf+"|"+S0)+"\\]"),f8=W(W(hv+"|"+v(qv,$v))+"*"),W0=W(v8+"|"+Pf+"(?!"+f8+")|"+f8),V1=W(I+"*"),Z1=W(W(Uv+"@")+"?"+W0+W("\\:"+V1)+"?"),J0=W(hv+"|"+v(qv,$v,"[\\:\\@]")),gW=W(J0+"*"),Q8=W(J0+"+"),W8=W(W(hv+"|"+v(qv,$v,"[\\@]"))+"+"),Zf=W(W("\\/"+gW)+"*"),C1=W("\\/"+W(Q8+Zf)+"?"),g0=W(W8+Zf),y1=W(Q8+Zf),wf="(?!"+J0+")",T1=W(Zf+"|"+C1+"|"+g0+"|"+y1+"|"+wf),q1=W(W(J0+"|"+v("[\\/\\?]",Lv))+"*"),X0=W(W(J0+"|[\\/\\?]")+"*"),KQ=W(W("\\/\\/"+Z1+Zf)+"|"+C1+"|"+y1+"|"+wf),R0=W(Rv+"\\:"+KQ+W("\\?"+q1)+"?"+W("\\#"+X0)+"?"),P0=W(W("\\/\\/"+Z1+Zf)+"|"+C1+"|"+g0+"|"+wf),_0=W(P0+W("\\?"+q1)+"?"+W("\\#"+X0)+"?"),hQ=W(R0+"|"+_0),B9=W(Rv+"\\:"+KQ+W("\\?"+q1)+"?"),K9="^("+Rv+")\\:"+W(W("\\/\\/("+W("("+Uv+")@")+"?("+W0+")"+W("\\:("+V1+")")+"?)")+"?("+Zf+"|"+C1+"|"+y1+"|"+wf+")")+W("\\?("+q1+")")+"?"+W("\\#("+X0+")")+"?$",h9="^(){0}"+W(W("\\/\\/("+W("("+Uv+")@")+"?("+W0+")"+W("\\:("+V1+")")+"?)")+"?("+Zf+"|"+C1+"|"+g0+"|"+wf+")")+W("\\?("+q1+")")+"?"+W("\\#("+X0+")")+"?$",$9="^("+Rv+")\\:"+W(W("\\/\\/("+W("("+Uv+")@")+"?("+W0+")"+W("\\:("+V1+")")+"?)")+"?("+Zf+"|"+C1+"|"+y1+"|"+wf+")")+W("\\?("+q1+")")+"?$",D9="^"+W("\\#("+X0+")")+"?$",M9="^"+W("("+Uv+")@")+"?("+W0+")"+W("\\:("+V1+")")+"?$";return{NOT_SCHEME:new RegExp(v("[^]",V,I,"[\\+\\-\\.]"),"g"),NOT_USERINFO:new RegExp(v("[^\\%\\:]",qv,$v),"g"),NOT_HOST:new RegExp(v("[^\\%\\[\\]\\:]",qv,$v),"g"),NOT_PATH:new RegExp(v("[^\\%\\/\\:\\@]",qv,$v),"g"),NOT_PATH_NOSCHEME:new RegExp(v("[^\\%\\/\\@]",qv,$v),"g"),NOT_QUERY:new RegExp(v("[^\\%]",qv,$v,"[\\:\\@\\/\\?]",Lv),"g"),NOT_FRAGMENT:new RegExp(v("[^\\%]",qv,$v,"[\\:\\@\\/\\?]"),"g"),ESCAPE:new RegExp(v("[^]",qv,$v),"g"),UNRESERVED:new RegExp(qv,"g"),OTHER_CHARS:new RegExp(v("[^\\%]",qv,gv),"g"),PCT_ENCODED:new RegExp(hv,"g"),IPV4ADDRESS:new RegExp("^("+Pf+")$"),IPV6ADDRESS:new RegExp("^\\[?("+kf+")"+W(W("\\%25|\\%(?!"+c+"{2})")+"("+Y1+")")+"?\\]?$")}}var B=G(!1),D=G(!0),M=function(){function j(V,S){var I=[],_=!0,c=!1,Wv=void 0;try{for(var Dv=V[Symbol.iterator](),hv;!(_=(hv=Dv.next()).done);_=!0)if(I.push(hv.value),S&&I.length===S)break}catch(uv){c=!0,Wv=uv}finally{try{if(!_&&Dv.return)Dv.return()}finally{if(c)throw Wv}}return I}return function(V,S){if(Array.isArray(V))return V;else if(Symbol.iterator in Object(V))return j(V,S);else throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),A=function(j){if(Array.isArray(j)){for(var V=0,S=Array(j.length);V<j.length;V++)S[V]=j[V];return S}else return Array.from(j)},N=2147483647,h=36,$=1,U=26,O=38,H=700,F=72,E=128,L="-",R=/^xn--/,Z=/[^\0-\x7E]/,m=/[\x2E\u3002\uFF0E\uFF61]/g,x={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y=h-$,a=Math.floor,p=String.fromCharCode;function i(j){throw new RangeError(x[j])}function T(j,V){var S=[],I=j.length;while(I--)S[I]=V(j[I]);return S}function b(j,V){var S=j.split("@"),I="";if(S.length>1)I=S[0]+"@",j=S[1];j=j.replace(m,".");var _=j.split("."),c=T(_,V).join(".");return I+c}function d(j){var V=[],S=0,I=j.length;while(S<I){var _=j.charCodeAt(S++);if(_>=55296&&_<=56319&&S<I){var c=j.charCodeAt(S++);if((c&64512)==56320)V.push(((_&1023)<<10)+(c&1023)+65536);else V.push(_),S--}else V.push(_)}return V}var Av=function j(V){return String.fromCodePoint.apply(String,A(V))},Bv=function j(V){if(V-48<10)return V-22;if(V-65<26)return V-65;if(V-97<26)return V-97;return h},Kv=function j(V,S){return V+22+75*(V<26)-((S!=0)<<5)},Gv=function j(V,S,I){var _=0;V=I?a(V/H):V>>1,V+=a(V/S);for(;V>y*U>>1;_+=h)V=a(V/y);return a(_+(y+1)*V/(V+O))},e=function j(V){var S=[],I=V.length,_=0,c=E,Wv=F,Dv=V.lastIndexOf(L);if(Dv<0)Dv=0;for(var hv=0;hv<Dv;++hv){if(V.charCodeAt(hv)>=128)i("not-basic");S.push(V.charCodeAt(hv))}for(var uv=Dv>0?Dv+1:0;uv<I;){var $v=_;for(var gv=1,yv=h;;yv+=h){if(uv>=I)i("invalid-input");var Lv=Bv(V.charCodeAt(uv++));if(Lv>=h||Lv>a((N-_)/gv))i("overflow");_+=Lv*gv;var qv=yv<=Wv?$:yv>=Wv+U?U:yv-Wv;if(Lv<qv)break;var Rv=h-qv;if(gv>a(N/Rv))i("overflow");gv*=Rv}var Uv=S.length+1;if(Wv=Gv(_-$v,Uv,$v==0),a(_/Uv)>N-c)i("overflow");c+=a(_/Uv),_%=Uv,S.splice(_++,0,c)}return String.fromCodePoint.apply(String,S)},Zv=function j(V){var S=[];V=d(V);var I=V.length,_=E,c=0,Wv=F,Dv=!0,hv=!1,uv=void 0;try{for(var $v=V[Symbol.iterator](),gv;!(Dv=(gv=$v.next()).done);Dv=!0){var yv=gv.value;if(yv<128)S.push(p(yv))}}catch(If){hv=!0,uv=If}finally{try{if(!Dv&&$v.return)$v.return()}finally{if(hv)throw uv}}var Lv=S.length,qv=Lv;if(Lv)S.push(L);while(qv<I){var Rv=N,Uv=!0,J1=!1,ff=void 0;try{for(var Pf=V[Symbol.iterator](),Fv;!(Uv=(Fv=Pf.next()).done);Uv=!0){var hf=Fv.value;if(hf>=_&&hf<Rv)Rv=hf}}catch(If){J1=!0,ff=If}finally{try{if(!Uv&&Pf.return)Pf.return()}finally{if(J1)throw ff}}var Mf=qv+1;if(Rv-_>a((N-c)/Mf))i("overflow");c+=(Rv-_)*Mf,_=Rv;var _f=!0,X1=!1,Yf=void 0;try{for(var Q0=V[Symbol.iterator](),H1;!(_f=(H1=Q0.next()).done);_f=!0){var P1=H1.value;if(P1<_&&++c>N)i("overflow");if(P1==_){var mf=c;for(var dv=h;;dv+=h){var kf=dv<=Wv?$:dv>=Wv+U?U:dv-Wv;if(mf<kf)break;var Y1=mf-kf,L0=h-kf;S.push(p(Kv(kf+Y1%L0,0))),mf=a(Y1/L0)}S.push(p(Kv(mf,0))),Wv=Gv(c,Mf,qv==Lv),c=0,++qv}}}catch(If){X1=!0,Yf=If}finally{try{if(!_f&&Q0.return)Q0.return()}finally{if(X1)throw Yf}}++c,++_}return S.join("")},sv=function j(V){return b(V,function(S){return R.test(S)?e(S.slice(4).toLowerCase()):S})},vf=function j(V){return b(V,function(S){return Z.test(S)?"xn--"+Zv(S):S})},Pv={version:"2.1.0",ucs2:{decode:d,encode:Av},decode:e,encode:Zv,toASCII:vf,toUnicode:sv},Ev={};function nv(j){var V=j.charCodeAt(0),S=void 0;if(V<16)S="%0"+V.toString(16).toUpperCase();else if(V<128)S="%"+V.toString(16).toUpperCase();else if(V<2048)S="%"+(V>>6|192).toString(16).toUpperCase()+"%"+(V&63|128).toString(16).toUpperCase();else S="%"+(V>>12|224).toString(16).toUpperCase()+"%"+(V>>6&63|128).toString(16).toUpperCase()+"%"+(V&63|128).toString(16).toUpperCase();return S}function ov(j){var V="",S=0,I=j.length;while(S<I){var _=parseInt(j.substr(S+1,2),16);if(_<128)V+=String.fromCharCode(_),S+=3;else if(_>=194&&_<224){if(I-S>=6){var c=parseInt(j.substr(S+4,2),16);V+=String.fromCharCode((_&31)<<6|c&63)}else V+=j.substr(S,6);S+=6}else if(_>=224){if(I-S>=9){var Wv=parseInt(j.substr(S+4,2),16),Dv=parseInt(j.substr(S+7,2),16);V+=String.fromCharCode((_&15)<<12|(Wv&63)<<6|Dv&63)}else V+=j.substr(S,9);S+=9}else V+=j.substr(S,3),S+=3}return V}function tv(j,V){function S(I){var _=ov(I);return!_.match(V.UNRESERVED)?I:_}if(j.scheme)j.scheme=String(j.scheme).replace(V.PCT_ENCODED,S).toLowerCase().replace(V.NOT_SCHEME,"");if(j.userinfo!==void 0)j.userinfo=String(j.userinfo).replace(V.PCT_ENCODED,S).replace(V.NOT_USERINFO,nv).replace(V.PCT_ENCODED,Q);if(j.host!==void 0)j.host=String(j.host).replace(V.PCT_ENCODED,S).toLowerCase().replace(V.NOT_HOST,nv).replace(V.PCT_ENCODED,Q);if(j.path!==void 0)j.path=String(j.path).replace(V.PCT_ENCODED,S).replace(j.scheme?V.NOT_PATH:V.NOT_PATH_NOSCHEME,nv).replace(V.PCT_ENCODED,Q);if(j.query!==void 0)j.query=String(j.query).replace(V.PCT_ENCODED,S).replace(V.NOT_QUERY,nv).replace(V.PCT_ENCODED,Q);if(j.fragment!==void 0)j.fragment=String(j.fragment).replace(V.PCT_ENCODED,S).replace(V.NOT_FRAGMENT,nv).replace(V.PCT_ENCODED,Q);return j}function Uf(j){return j.replace(/^0*(.*)/,"$1")||"0"}function xv(j,V){var S=j.match(V.IPV4ADDRESS)||[],I=M(S,2),_=I[1];if(_)return _.split(".").map(Uf).join(".");else return j}function Cv(j,V){var S=j.match(V.IPV6ADDRESS)||[],I=M(S,3),_=I[1],c=I[2];if(_){var Wv=_.toLowerCase().split("::").reverse(),Dv=M(Wv,2),hv=Dv[0],uv=Dv[1],$v=uv?uv.split(":").map(Uf):[],gv=hv.split(":").map(Uf),yv=V.IPV4ADDRESS.test(gv[gv.length-1]),Lv=yv?7:8,qv=gv.length-Lv,Rv=Array(Lv);for(var Uv=0;Uv<Lv;++Uv)Rv[Uv]=$v[Uv]||gv[qv+Uv]||"";if(yv)Rv[Lv-1]=xv(Rv[Lv-1],V);var J1=Rv.reduce(function(Mf,_f,X1){if(!_f||_f==="0"){var Yf=Mf[Mf.length-1];if(Yf&&Yf.index+Yf.length===X1)Yf.length++;else Mf.push({index:X1,length:1})}return Mf},[]),ff=J1.sort(function(Mf,_f){return _f.length-Mf.length})[0],Pf=void 0;if(ff&&ff.length>1){var Fv=Rv.slice(0,ff.index),hf=Rv.slice(ff.index+ff.length);Pf=Fv.join(":")+"::"+hf.join(":")}else Pf=Rv.join(":");if(c)Pf+="%"+c;return Pf}else return j}var M1=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,pv="".match(/(){0}/)[1]===void 0;function Vv(j){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S={},I=V.iri!==!1?D:B;if(V.reference==="suffix")j=(V.scheme?V.scheme+":":"")+"//"+j;var _=j.match(M1);if(_){if(pv){if(S.scheme=_[1],S.userinfo=_[3],S.host=_[4],S.port=parseInt(_[5],10),S.path=_[6]||"",S.query=_[7],S.fragment=_[8],isNaN(S.port))S.port=_[5]}else if(S.scheme=_[1]||void 0,S.userinfo=j.indexOf("@")!==-1?_[3]:void 0,S.host=j.indexOf("//")!==-1?_[4]:void 0,S.port=parseInt(_[5],10),S.path=_[6]||"",S.query=j.indexOf("?")!==-1?_[7]:void 0,S.fragment=j.indexOf("#")!==-1?_[8]:void 0,isNaN(S.port))S.port=j.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?_[4]:void 0;if(S.host)S.host=Cv(xv(S.host,I),I);if(S.scheme===void 0&&S.userinfo===void 0&&S.host===void 0&&S.port===void 0&&!S.path&&S.query===void 0)S.reference="same-document";else if(S.scheme===void 0)S.reference="relative";else if(S.fragment===void 0)S.reference="absolute";else S.reference="uri";if(V.reference&&V.reference!=="suffix"&&V.reference!==S.reference)S.error=S.error||"URI is not a "+V.reference+" reference.";var c=Ev[(V.scheme||S.scheme||"").toLowerCase()];if(!V.unicodeSupport&&(!c||!c.unicodeSupport)){if(S.host&&(V.domainHost||c&&c.domainHost))try{S.host=Pv.toASCII(S.host.replace(I.PCT_ENCODED,ov).toLowerCase())}catch(Wv){S.error=S.error||"Host's domain name can not be converted to ASCII via punycode: "+Wv}tv(S,B)}else tv(S,I);if(c&&c.parse)c.parse(S,V)}else S.error=S.error||"URI can not be parsed.";return S}function Bf(j,V){var S=V.iri!==!1?D:B,I=[];if(j.userinfo!==void 0)I.push(j.userinfo),I.push("@");if(j.host!==void 0)I.push(Cv(xv(String(j.host),S),S).replace(S.IPV6ADDRESS,function(_,c,Wv){return"["+c+(Wv?"%25"+Wv:"")+"]"}));if(typeof j.port==="number"||typeof j.port==="string")I.push(":"),I.push(String(j.port));return I.length?I.join(""):void 0}var Sf=/^\.\.?\//,bf=/^\/\.(\/|$)/,gf=/^\/\.\.(\/|$)/,iv=/^\/?(?:.|\n)*?(?=\/|$)/;function rv(j){var V=[];while(j.length)if(j.match(Sf))j=j.replace(Sf,"");else if(j.match(bf))j=j.replace(bf,"/");else if(j.match(gf))j=j.replace(gf,"/"),V.pop();else if(j==="."||j==="..")j="";else{var S=j.match(iv);if(S){var I=S[0];j=j.slice(I.length),V.push(I)}else throw new Error("Unexpected dot segment condition")}return V.join("")}function bv(j){var V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},S=V.iri?D:B,I=[],_=Ev[(V.scheme||j.scheme||"").toLowerCase()];if(_&&_.serialize)_.serialize(j,V);if(j.host){if(S.IPV6ADDRESS.test(j.host));else if(V.domainHost||_&&_.domainHost)try{j.host=!V.iri?Pv.toASCII(j.host.replace(S.PCT_ENCODED,ov).toLowerCase()):Pv.toUnicode(j.host)}catch(Dv){j.error=j.error||"Host's domain name can not be converted to "+(!V.iri?"ASCII":"Unicode")+" via punycode: "+Dv}}if(tv(j,S),V.reference!=="suffix"&&j.scheme)I.push(j.scheme),I.push(":");var c=Bf(j,V);if(c!==void 0){if(V.reference!=="suffix")I.push("//");if(I.push(c),j.path&&j.path.charAt(0)!=="/")I.push("/")}if(j.path!==void 0){var Wv=j.path;if(!V.absolutePath&&(!_||!_.absolutePath))Wv=rv(Wv);if(c===void 0)Wv=Wv.replace(/^\/\//,"/%2F");I.push(Wv)}if(j.query!==void 0)I.push("?"),I.push(j.query);if(j.fragment!==void 0)I.push("#"),I.push(j.fragment);return I.join("")}function cv(j,V){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},I=arguments[3],_={};if(!I)j=Vv(bv(j,S),S),V=Vv(bv(V,S),S);if(S=S||{},!S.tolerant&&V.scheme)_.scheme=V.scheme,_.userinfo=V.userinfo,_.host=V.host,_.port=V.port,_.path=rv(V.path||""),_.query=V.query;else{if(V.userinfo!==void 0||V.host!==void 0||V.port!==void 0)_.userinfo=V.userinfo,_.host=V.host,_.port=V.port,_.path=rv(V.path||""),_.query=V.query;else{if(!V.path)if(_.path=j.path,V.query!==void 0)_.query=V.query;else _.query=j.query;else{if(V.path.charAt(0)==="/")_.path=rv(V.path);else{if((j.userinfo!==void 0||j.host!==void 0||j.port!==void 0)&&!j.path)_.path="/"+V.path;else if(!j.path)_.path=V.path;else _.path=j.path.slice(0,j.path.lastIndexOf("/")+1)+V.path;_.path=rv(_.path)}_.query=V.query}_.userinfo=j.userinfo,_.host=j.host,_.port=j.port}_.scheme=j.scheme}return _.fragment=V.fragment,_}function Rf(j,V,S){var I=w({scheme:"null"},S);return bv(cv(Vv(j,I),Vv(V,I),I,!0),I)}function Jf(j,V){if(typeof j==="string")j=bv(Vv(j,V),V);else if(X(j)==="object")j=Vv(bv(j,V),V);return j}function O1(j,V,S){if(typeof j==="string")j=bv(Vv(j,S),S);else if(X(j)==="object")j=bv(j,S);if(typeof V==="string")V=bv(Vv(V,S),S);else if(X(V)==="object")V=bv(V,S);return j===V}function XQ(j,V){return j&&j.toString().replace(!V||!V.iri?B.ESCAPE:D.ESCAPE,nv)}function Kf(j,V){return j&&j.toString().replace(!V||!V.iri?B.PCT_ENCODED:D.PCT_ENCODED,ov)}var k1={scheme:"http",domainHost:!0,parse:function j(V,S){if(!V.host)V.error=V.error||"HTTP URIs must have a host.";return V},serialize:function j(V,S){var I=String(V.scheme).toLowerCase()==="https";if(V.port===(I?443:80)||V.port==="")V.port=void 0;if(!V.path)V.path="/";return V}},nQ={scheme:"https",domainHost:k1.domainHost,parse:k1.parse,serialize:k1.serialize};function PQ(j){return typeof j.secure==="boolean"?j.secure:String(j.scheme).toLowerCase()==="wss"}var I1={scheme:"ws",domainHost:!0,parse:function j(V,S){var I=V;return I.secure=PQ(I),I.resourceName=(I.path||"/")+(I.query?"?"+I.query:""),I.path=void 0,I.query=void 0,I},serialize:function j(V,S){if(V.port===(PQ(V)?443:80)||V.port==="")V.port=void 0;if(typeof V.secure==="boolean")V.scheme=V.secure?"wss":"ws",V.secure=void 0;if(V.resourceName){var I=V.resourceName.split("?"),_=M(I,2),c=_[0],Wv=_[1];V.path=c&&c!=="/"?c:void 0,V.query=Wv,V.resourceName=void 0}return V.fragment=void 0,V}},YQ={scheme:"wss",domainHost:I1.domainHost,parse:I1.parse,serialize:I1.serialize},wQ={},GQ=!0,U0="[A-Za-z0-9\\-\\.\\_\\~"+(GQ?"\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF":"")+"]",Xf="[0-9A-Fa-f]",pQ=W(W("%[EFef]"+Xf+"%"+Xf+Xf+"%"+Xf+Xf)+"|"+W("%[89A-Fa-f]"+Xf+"%"+Xf+Xf)+"|"+W("%"+Xf+Xf)),uf="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",Q1="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",iQ=v(Q1,"[\\\"\\\\]"),j0="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",LW=new RegExp(U0,"g"),W1=new RegExp(pQ,"g"),dQ=new RegExp(v("[^]",uf,"[\\.]","[\\\"]",iQ),"g"),sQ=new RegExp(v("[^]",U0,j0),"g"),SW=sQ;function zQ(j){var V=ov(j);return!V.match(LW)?j:V}var oQ={scheme:"mailto",parse:function j(V,S){var I=V,_=I.to=I.path?I.path.split(","):[];if(I.path=void 0,I.query){var c=!1,Wv={},Dv=I.query.split("&");for(var hv=0,uv=Dv.length;hv<uv;++hv){var $v=Dv[hv].split("=");switch($v[0]){case"to":var gv=$v[1].split(",");for(var yv=0,Lv=gv.length;yv<Lv;++yv)_.push(gv[yv]);break;case"subject":I.subject=Kf($v[1],S);break;case"body":I.body=Kf($v[1],S);break;default:c=!0,Wv[Kf($v[0],S)]=Kf($v[1],S);break}}if(c)I.headers=Wv}I.query=void 0;for(var qv=0,Rv=_.length;qv<Rv;++qv){var Uv=_[qv].split("@");if(Uv[0]=Kf(Uv[0]),!S.unicodeSupport)try{Uv[1]=Pv.toASCII(Kf(Uv[1],S).toLowerCase())}catch(J1){I.error=I.error||"Email address's domain name can not be converted to ASCII via punycode: "+J1}else Uv[1]=Kf(Uv[1],S).toLowerCase();_[qv]=Uv.join("@")}return I},serialize:function j(V,S){var I=V,_=P(V.to);if(_){for(var c=0,Wv=_.length;c<Wv;++c){var Dv=String(_[c]),hv=Dv.lastIndexOf("@"),uv=Dv.slice(0,hv).replace(W1,zQ).replace(W1,Q).replace(dQ,nv),$v=Dv.slice(hv+1);try{$v=!S.iri?Pv.toASCII(Kf($v,S).toLowerCase()):Pv.toUnicode($v)}catch(qv){I.error=I.error||"Email address's domain name can not be converted to "+(!S.iri?"ASCII":"Unicode")+" via punycode: "+qv}_[c]=uv+"@"+$v}I.path=_.join(",")}var gv=V.headers=V.headers||{};if(V.subject)gv.subject=V.subject;if(V.body)gv.body=V.body;var yv=[];for(var Lv in gv)if(gv[Lv]!==wQ[Lv])yv.push(Lv.replace(W1,zQ).replace(W1,Q).replace(sQ,nv)+"="+gv[Lv].replace(W1,zQ).replace(W1,Q).replace(SW,nv));if(yv.length)I.query=yv.join("&");return I}},tQ=/^([^\:]+)\:(.*)/,F0={scheme:"urn",parse:function j(V,S){var I=V.path&&V.path.match(tQ),_=V;if(I){var c=S.scheme||_.scheme||"urn",Wv=I[1].toLowerCase(),Dv=I[2],hv=c+":"+(S.nid||Wv),uv=Ev[hv];if(_.nid=Wv,_.nss=Dv,_.path=void 0,uv)_=uv.parse(_,S)}else _.error=_.error||"URN can not be parsed.";return _},serialize:function j(V,S){var I=S.scheme||V.scheme||"urn",_=V.nid,c=I+":"+(S.nid||_),Wv=Ev[c];if(Wv)V=Wv.serialize(V,S);var Dv=V,hv=V.nss;return Dv.path=(_||S.nid)+":"+hv,Dv}},BQ=/^[0-9A-Fa-f]{8}(?:\-[0-9A-Fa-f]{4}){3}\-[0-9A-Fa-f]{12}$/,eQ={scheme:"urn:uuid",parse:function j(V,S){var I=V;if(I.uuid=I.nss,I.nss=void 0,!S.tolerant&&(!I.uuid||!I.uuid.match(BQ)))I.error=I.error||"UUID is not valid.";return I},serialize:function j(V,S){var I=V;return I.nss=(V.uuid||"").toLowerCase(),I}};Ev[k1.scheme]=k1,Ev[nQ.scheme]=nQ,Ev[I1.scheme]=I1,Ev[YQ.scheme]=YQ,Ev[oQ.scheme]=oQ,Ev[F0.scheme]=F0,Ev[eQ.scheme]=eQ,f.SCHEMES=Ev,f.pctEncChar=nv,f.pctDecChars=ov,f.parse=Vv,f.removeDotSegments=rv,f.serialize=bv,f.resolveComponents=cv,f.resolve=Rf,f.normalize=Jf,f.equal=O1,f.escapeComponent=XQ,f.unescapeComponent=Kf,Object.defineProperty(f,"__esModule",{value:!0})})});var r8=Qv((n3,T6)=>{T6.exports=function f(v,W){if(v===W)return!0;if(v&&W&&typeof v=="object"&&typeof W=="object"){if(v.constructor!==W.constructor)return!1;var X,Q,P;if(Array.isArray(v)){if(X=v.length,X!=W.length)return!1;for(Q=X;Q--!==0;)if(!f(v[Q],W[Q]))return!1;return!0}if(v.constructor===RegExp)return v.source===W.source&&v.flags===W.flags;if(v.valueOf!==Object.prototype.valueOf)return v.valueOf()===W.valueOf();if(v.toString!==Object.prototype.toString)return v.toString()===W.toString();if(P=Object.keys(v),X=P.length,X!==Object.keys(W).length)return!1;for(Q=X;Q--!==0;)if(!Object.prototype.hasOwnProperty.call(W,P[Q]))return!1;for(Q=X;Q--!==0;){var w=P[Q];if(!f(v[w],W[w]))return!1}return!0}return v!==v&&W!==W}});var l6=Qv((p3,x6)=>{x6.exports=function f(v){var W=0,X=v.length,Q=0,P;while(Q<X)if(W++,P=v.charCodeAt(Q++),P>=55296&&P<=56319&&Q<X){if(P=v.charCodeAt(Q),(P&64512)==56320)Q++}return W}});var O0=Qv((i3,m6)=>{m6.exports={copy:b2,checkDataType:BJ,checkDataTypes:u2,coerceToTypes:m2,toHash:hJ,getProperty:$J,escapeQuotes:DJ,equal:r8(),ucs2length:l6(),varOccurences:c2,varReplace:n2,schemaHasRules:p2,schemaHasRulesExcept:i2,schemaUnknownRules:d2,toQuotedString:KJ,getPathExpr:s2,getPath:o2,getData:vw,unescapeFragment:fw,unescapeJsonPointer:OJ,escapeFragment:Qw,escapeJsonPointer:MJ};function b2(f,v){v=v||{};for(var W in f)v[W]=f[W];return v}function BJ(f,v,W,X){var Q=X?" !== ":" === ",P=X?" || ":" && ",w=X?"!":"",G=X?"":"!";switch(f){case"null":return v+Q+"null";case"array":return w+"Array.isArray("+v+")";case"object":return"("+w+v+P+"typeof "+v+Q+'"object"'+P+G+"Array.isArray("+v+"))";case"integer":return"(typeof "+v+Q+'"number"'+P+G+"("+v+" % 1)"+P+v+Q+v+(W?P+w+"isFinite("+v+")":"")+")";case"number":return"(typeof "+v+Q+'"'+f+'"'+(W?P+w+"isFinite("+v+")":"")+")";default:return"typeof "+v+Q+'"'+f+'"'}}function u2(f,v,W){switch(f.length){case 1:return BJ(f[0],v,W,!0);default:var X="",Q=hJ(f);if(Q.array&&Q.object)X=Q.null?"(":"(!"+v+" || ",X+="typeof "+v+' !== "object")',delete Q.null,delete Q.array,delete Q.object;if(Q.number)delete Q.integer;for(var P in Q)X+=(X?" && ":"")+BJ(P,v,W,!0);return X}}var b6=hJ(["string","number","integer","boolean","null"]);function m2(f,v){if(Array.isArray(v)){var W=[];for(var X=0;X<v.length;X++){var Q=v[X];if(b6[Q])W[W.length]=Q;else if(f==="array"&&Q==="array")W[W.length]=Q}if(W.length)return W}else if(b6[v])return[v];else if(f==="array"&&v==="array")return["array"]}function hJ(f){var v={};for(var W=0;W<f.length;W++)v[f[W]]=!0;return v}var r2=/^[a-z$_][a-z$_0-9]*$/i,a2=/'|\\/g;function $J(f){return typeof f=="number"?"["+f+"]":r2.test(f)?"."+f:"['"+DJ(f)+"']"}function DJ(f){return f.replace(a2,"\\$&").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\f/g,"\\f").replace(/\t/g,"\\t")}function c2(f,v){v+="[^0-9]";var W=f.match(new RegExp(v,"g"));return W?W.length:0}function n2(f,v,W){return v+="([^0-9])",W=W.replace(/\$/g,"$$$$"),f.replace(new RegExp(v,"g"),W+"$1")}function p2(f,v){if(typeof f=="boolean")return!f;for(var W in f)if(v[W])return!0}function i2(f,v,W){if(typeof f=="boolean")return!f&&W!="not";for(var X in f)if(X!=W&&v[X])return!0}function d2(f,v){if(typeof f=="boolean")return;for(var W in f)if(!v[W])return W}function KJ(f){return"'"+DJ(f)+"'"}function s2(f,v,W,X){var Q=W?"'/' + "+v+(X?"":".replace(/~/g, '~0').replace(/\\//g, '~1')"):X?"'[' + "+v+" + ']'":"'[\\'' + "+v+" + '\\']'";return u6(f,Q)}function o2(f,v,W){var X=W?KJ("/"+MJ(v)):KJ($J(v));return u6(f,X)}var t2=/^\/(?:[^~]|~0|~1)*$/,e2=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function vw(f,v,W){var X,Q,P,w;if(f==="")return"rootData";if(f[0]=="/"){if(!t2.test(f))throw new Error("Invalid JSON-pointer: "+f);Q=f,P="rootData"}else{if(w=f.match(e2),!w)throw new Error("Invalid JSON-pointer: "+f);if(X=+w[1],Q=w[2],Q=="#"){if(X>=v)throw new Error("Cannot access property/index "+X+" levels up, current level is "+v);return W[v-X]}if(X>v)throw new Error("Cannot access data "+X+" levels up, current level is "+v);if(P="data"+(v-X||""),!Q)return P}var G=P,B=Q.split("/");for(var D=0;D<B.length;D++){var M=B[D];if(M)P+=$J(OJ(M)),G+=" && "+P}return G}function u6(f,v){if(f=='""')return v;return(f+" + "+v).replace(/([^\\])' \+ '/g,"$1")}function fw(f){return OJ(decodeURIComponent(f))}function Qw(f){return encodeURIComponent(MJ(f))}function MJ(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}function OJ(f){return f.replace(/~1/g,"/").replace(/~0/g,"~")}});var HJ=Qv((d3,r6)=>{var Ww=O0();r6.exports=Jw;function Jw(f){Ww.copy(f,this)}});var c6=Qv((s3,a6)=>{var p1=a6.exports=function(f,v,W){if(typeof v=="function")W=v,v={};W=v.cb||W;var X=typeof W=="function"?W:W.pre||function(){},Q=W.post||function(){};a8(v,X,Q,f,"",f)};p1.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0};p1.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};p1.propsKeywords={definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};p1.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function a8(f,v,W,X,Q,P,w,G,B,D){if(X&&typeof X=="object"&&!Array.isArray(X)){v(X,Q,P,w,G,B,D);for(var M in X){var A=X[M];if(Array.isArray(A)){if(M in p1.arrayKeywords)for(var N=0;N<A.length;N++)a8(f,v,W,A[N],Q+"/"+M+"/"+N,P,Q,M,X,N)}else if(M in p1.propsKeywords){if(A&&typeof A=="object")for(var h in A)a8(f,v,W,A[h],Q+"/"+M+"/"+Xw(h),P,Q,M,X,h)}else if(M in p1.keywords||f.allKeys&&!(M in p1.skipKeywords))a8(f,v,W,A,Q+"/"+M,P,Q,M,X)}W(X,Q,P,w,G,B,D)}}function Xw(f){return f.replace(/~/g,"~0").replace(/\//g,"~1")}});var s8=Qv((o3,d6)=>{var ZQ=y6(),n6=r8(),i8=O0(),c8=HJ(),Pw=c6();d6.exports=d1;d1.normalizeId=i1;d1.fullPath=n8;d1.url=p8;d1.ids=Bw;d1.inlineRef=VJ;d1.schema=d8;function d1(f,v,W){var X=this._refs[W];if(typeof X=="string")if(this._refs[X])X=this._refs[X];else return d1.call(this,f,v,X);if(X=X||this._schemas[W],X instanceof c8)return VJ(X.schema,this._opts.inlineRefs)?X.schema:X.validate||this._compile(X);var Q=d8.call(this,v,W),P,w,G;if(Q)P=Q.schema,v=Q.root,G=Q.baseId;if(P instanceof c8)w=P.validate||f.call(this,P.schema,v,void 0,G);else if(P!==void 0)w=VJ(P,this._opts.inlineRefs)?P:f.call(this,P,v,void 0,G);return w}function d8(f,v){var W=ZQ.parse(v),X=i6(W),Q=n8(this._getId(f.schema));if(Object.keys(f.schema).length===0||X!==Q){var P=i1(X),w=this._refs[P];if(typeof w=="string")return Yw.call(this,f,w,W);else if(w instanceof c8){if(!w.validate)this._compile(w);f=w}else if(w=this._schemas[P],w instanceof c8){if(!w.validate)this._compile(w);if(P==i1(v))return{schema:w,root:f,baseId:Q};f=w}else return;if(!f.schema)return;Q=n8(this._getId(f.schema))}return p6.call(this,W,Q,f.schema,f)}function Yw(f,v,W){var X=d8.call(this,f,v);if(X){var{schema:Q,baseId:P}=X;f=X.root;var w=this._getId(Q);if(w)P=p8(P,w);return p6.call(this,W,P,Q,f)}}var ww=i8.toHash(["properties","patternProperties","enum","dependencies","definitions"]);function p6(f,v,W,X){if(f.fragment=f.fragment||"",f.fragment.slice(0,1)!="/")return;var Q=f.fragment.split("/");for(var P=1;P<Q.length;P++){var w=Q[P];if(w){if(w=i8.unescapeFragment(w),W=W[w],W===void 0)break;var G;if(!ww[w]){if(G=this._getId(W),G)v=p8(v,G);if(W.$ref){var B=p8(v,W.$ref),D=d8.call(this,X,B);if(D)W=D.schema,X=D.root,v=D.baseId}}}}if(W!==void 0&&W!==X.schema)return{schema:W,root:X,baseId:v}}var Gw=i8.toHash(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum"]);function VJ(f,v){if(v===!1)return!1;if(v===void 0||v===!0)return qJ(f);else if(v)return NJ(f)<=v}function qJ(f){var v;if(Array.isArray(f)){for(var W=0;W<f.length;W++)if(v=f[W],typeof v=="object"&&!qJ(v))return!1}else for(var X in f){if(X=="$ref")return!1;if(v=f[X],typeof v=="object"&&!qJ(v))return!1}return!0}function NJ(f){var v=0,W;if(Array.isArray(f))for(var X=0;X<f.length;X++){if(W=f[X],typeof W=="object")v+=NJ(W);if(v==1/0)return 1/0}else for(var Q in f){if(Q=="$ref")return 1/0;if(Gw[Q])v++;else{if(W=f[Q],typeof W=="object")v+=NJ(W)+1;if(v==1/0)return 1/0}}return v}function n8(f,v){if(v!==!1)f=i1(f);var W=ZQ.parse(f);return i6(W)}function i6(f){return ZQ.serialize(f).split("#")[0]+"#"}var zw=/#\/?$/;function i1(f){return f?f.replace(zw,""):""}function p8(f,v){return v=i1(v),ZQ.resolve(f,v)}function Bw(f){var v=i1(this._getId(f)),W={"":v},X={"":n8(v,!1)},Q={},P=this;return Pw(f,{allKeys:!0},function(w,G,B,D,M,A,N){if(G==="")return;var h=P._getId(w),$=W[D],U=X[D]+"/"+M;if(N!==void 0)U+="/"+(typeof N=="number"?N:i8.escapeFragment(N));if(typeof h=="string"){h=$=i1($?ZQ.resolve($,h):h);var O=P._refs[h];if(typeof O=="string")O=P._refs[O];if(O&&O.schema){if(!n6(w,O.schema))throw new Error('id "'+h+'" resolves to more than one schema')}else if(h!=i1(U))if(h[0]=="#"){if(Q[h]&&!n6(w,Q[h]))throw new Error('id "'+h+'" resolves to more than one schema');Q[h]=w}else P._refs[h]=U}W[G]=$,X[G]=U}),Q}});var o8=Qv((t3,o6)=>{var EJ=s8();o6.exports={Validation:s6(Kw),MissingRef:s6(AJ)};function Kw(f){this.message="validation failed",this.errors=f,this.ajv=this.validation=!0}AJ.message=function(f,v){return"can't resolve reference "+v+" from id "+f};function AJ(f,v,W){this.message=W||AJ.message(f,v),this.missingRef=EJ.url(f,v),this.missingSchema=EJ.normalizeId(EJ.fullPath(this.missingRef))}function s6(f){return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f}});var UJ=Qv((e3,t6)=>{t6.exports=function(f,v){if(!v)v={};if(typeof v==="function")v={cmp:v};var W=typeof v.cycles==="boolean"?v.cycles:!1,X=v.cmp&&function(P){return function(w){return function(G,B){var D={key:G,value:w[G]},M={key:B,value:w[B]};return P(D,M)}}}(v.cmp),Q=[];return function P(w){if(w&&w.toJSON&&typeof w.toJSON==="function")w=w.toJSON();if(w===void 0)return;if(typeof w=="number")return isFinite(w)?""+w:"null";if(typeof w!=="object")return JSON.stringify(w);var G,B;if(Array.isArray(w)){B="[";for(G=0;G<w.length;G++){if(G)B+=",";B+=P(w[G])||"null"}return B+"]"}if(w===null)return"null";if(Q.indexOf(w)!==-1){if(W)return JSON.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}var D=Q.push(w)-1,M=Object.keys(w).sort(X&&X(w));B="";for(G=0;G<M.length;G++){var A=M[G],N=P(w[A]);if(!N)continue;if(B)B+=",";B+=JSON.stringify(A)+":"+N}return Q.splice(D,1),"{"+B+"}"}(f)}});var jJ=Qv((vz,e6)=>{e6.exports=function f(v,W,X){var Q="",P=v.schema.$async===!0,w=v.util.schemaHasRulesExcept(v.schema,v.RULES.all,"$ref"),G=v.self._getId(v.schema);if(v.opts.strictKeywords){var B=v.util.schemaUnknownRules(v.schema,v.RULES.keywords);if(B){var D="unknown keyword: "+B;if(v.opts.strictKeywords==="log")v.logger.warn(D);else throw new Error(D)}}if(v.isTop){if(Q+=" var validate = ",P)v.async=!0,Q+="async ";if(Q+="function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict'; ",G&&(v.opts.sourceCode||v.opts.processCode))Q+=" "+("/*# sourceURL="+G+" */")+" "}if(typeof v.schema=="boolean"||!(w||v.schema.$ref)){var W="false schema",M=v.level,A=v.dataLevel,N=v.schema[W],h=v.schemaPath+v.util.getProperty(W),$=v.errSchemaPath+"/"+W,R=!v.opts.allErrors,x,U="data"+(A||""),L="valid"+M;if(v.schema===!1){if(v.isTop)R=!0;else Q+=" var "+L+" = false; ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(x||"false schema")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString($)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'boolean schema is false' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+U+" ";Q+=" } "}else Q+=" {} ";var H=Q;if(Q=O.pop(),!v.compositeRule&&R)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else if(v.isTop)if(P)Q+=" return data; ";else Q+=" validate.errors = null; return true; ";else Q+=" var "+L+" = true; ";if(v.isTop)Q+=" }; return validate; ";return Q}if(v.isTop){var F=v.isTop,M=v.level=0,A=v.dataLevel=0,U="data";if(v.rootId=v.resolve.fullPath(v.self._getId(v.root.schema)),v.baseId=v.baseId||v.rootId,delete v.isTop,v.dataPathArr=[""],v.schema.default!==void 0&&v.opts.useDefaults&&v.opts.strictDefaults){var E="default is ignored in the schema root";if(v.opts.strictDefaults==="log")v.logger.warn(E);else throw new Error(E)}Q+=" var vErrors = null; ",Q+=" var errors = 0; ",Q+=" if (rootData === undefined) rootData = data; "}else{var{level:M,dataLevel:A}=v,U="data"+(A||"");if(G)v.baseId=v.resolve.url(v.baseId,G);if(P&&!v.async)throw new Error("async schema in sync schema");Q+=" var errs_"+M+" = errors;"}var L="valid"+M,R=!v.opts.allErrors,Z="",m="",x,y=v.schema.type,a=Array.isArray(y);if(y&&v.opts.nullable&&v.schema.nullable===!0){if(a){if(y.indexOf("null")==-1)y=y.concat("null")}else if(y!="null")y=[y,"null"],a=!0}if(a&&y.length==1)y=y[0],a=!1;if(v.schema.$ref&&w){if(v.opts.extendRefs=="fail")throw new Error('$ref: validation keywords used in schema at path "'+v.errSchemaPath+'" (see option extendRefs)');else if(v.opts.extendRefs!==!0)w=!1,v.logger.warn('$ref: keywords ignored in schema at path "'+v.errSchemaPath+'"')}if(v.schema.$comment&&v.opts.$comment)Q+=" "+v.RULES.all.$comment.code(v,"$comment");if(y){if(v.opts.coerceTypes)var p=v.util.coerceToTypes(v.opts.coerceTypes,y);var i=v.RULES.types[y];if(p||a||i===!0||i&&!iv(i)){var h=v.schemaPath+".type",$=v.errSchemaPath+"/type",h=v.schemaPath+".type",$=v.errSchemaPath+"/type",T=a?"checkDataTypes":"checkDataType";if(Q+=" if ("+v.util[T](y,U,v.opts.strictNumbers,!0)+") { ",p){var b="dataType"+M,d="coerced"+M;if(Q+=" var "+b+" = typeof "+U+"; var "+d+" = undefined; ",v.opts.coerceTypes=="array")Q+=" if ("+b+" == 'object' && Array.isArray("+U+") && "+U+".length == 1) { "+U+" = "+U+"[0]; "+b+" = typeof "+U+"; if ("+v.util.checkDataType(v.schema.type,U,v.opts.strictNumbers)+") "+d+" = "+U+"; } ";Q+=" if ("+d+" !== undefined) ; ";var Av=p;if(Av){var Bv,Kv=-1,Gv=Av.length-1;while(Kv<Gv)if(Bv=Av[Kv+=1],Bv=="string")Q+=" else if ("+b+" == 'number' || "+b+" == 'boolean') "+d+" = '' + "+U+"; else if ("+U+" === null) "+d+" = ''; ";else if(Bv=="number"||Bv=="integer"){if(Q+=" else if ("+b+" == 'boolean' || "+U+" === null || ("+b+" == 'string' && "+U+" && "+U+" == +"+U+" ",Bv=="integer")Q+=" && !("+U+" % 1)";Q+=")) "+d+" = +"+U+"; "}else if(Bv=="boolean")Q+=" else if ("+U+" === 'false' || "+U+" === 0 || "+U+" === null) "+d+" = false; else if ("+U+" === 'true' || "+U+" === 1) "+d+" = true; ";else if(Bv=="null")Q+=" else if ("+U+" === '' || "+U+" === 0 || "+U+" === false) "+d+" = null; ";else if(v.opts.coerceTypes=="array"&&Bv=="array")Q+=" else if ("+b+" == 'string' || "+b+" == 'number' || "+b+" == 'boolean' || "+U+" == null) "+d+" = ["+U+"]; "}Q+=" else { ";var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(x||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString($)+" , params: { type: '",a)Q+=""+y.join(",");else Q+=""+y;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",a)Q+=""+y.join(",");else Q+=""+y;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+U+" ";Q+=" } "}else Q+=" {} ";var H=Q;if(Q=O.pop(),!v.compositeRule&&R)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } if ("+d+" !== undefined) { ";var e=A?"data"+(A-1||""):"parentData",Zv=A?v.dataPathArr[A]:"parentDataProperty";if(Q+=" "+U+" = "+d+"; ",!A)Q+="if ("+e+" !== undefined)";Q+=" "+e+"["+Zv+"] = "+d+"; } "}else{var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(x||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString($)+" , params: { type: '",a)Q+=""+y.join(",");else Q+=""+y;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",a)Q+=""+y.join(",");else Q+=""+y;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+U+" ";Q+=" } "}else Q+=" {} ";var H=Q;if(Q=O.pop(),!v.compositeRule&&R)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}Q+=" } "}}if(v.schema.$ref&&!w){if(Q+=" "+v.RULES.all.$ref.code(v,"$ref")+" ",R){if(Q+=" } if (errors === ",F)Q+="0";else Q+="errs_"+M;Q+=") { ",m+="}"}}else{var sv=v.RULES;if(sv){var i,vf=-1,Pv=sv.length-1;while(vf<Pv)if(i=sv[vf+=1],iv(i)){if(i.type)Q+=" if ("+v.util.checkDataType(i.type,U,v.opts.strictNumbers)+") { ";if(v.opts.useDefaults){if(i.type=="object"&&v.schema.properties){var N=v.schema.properties,Ev=Object.keys(N),nv=Ev;if(nv){var ov,tv=-1,Uf=nv.length-1;while(tv<Uf){ov=nv[tv+=1];var xv=N[ov];if(xv.default!==void 0){var Cv=U+v.util.getProperty(ov);if(v.compositeRule){if(v.opts.strictDefaults){var E="default is ignored for: "+Cv;if(v.opts.strictDefaults==="log")v.logger.warn(E);else throw new Error(E)}}else{if(Q+=" if ("+Cv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+Cv+" === null || "+Cv+" === '' ";if(Q+=" ) "+Cv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(xv.default)+" ";else Q+=" "+JSON.stringify(xv.default)+" ";Q+="; "}}}}}else if(i.type=="array"&&Array.isArray(v.schema.items)){var M1=v.schema.items;if(M1){var xv,Kv=-1,pv=M1.length-1;while(Kv<pv)if(xv=M1[Kv+=1],xv.default!==void 0){var Cv=U+"["+Kv+"]";if(v.compositeRule){if(v.opts.strictDefaults){var E="default is ignored for: "+Cv;if(v.opts.strictDefaults==="log")v.logger.warn(E);else throw new Error(E)}}else{if(Q+=" if ("+Cv+" === undefined ",v.opts.useDefaults=="empty")Q+=" || "+Cv+" === null || "+Cv+" === '' ";if(Q+=" ) "+Cv+" = ",v.opts.useDefaults=="shared")Q+=" "+v.useDefault(xv.default)+" ";else Q+=" "+JSON.stringify(xv.default)+" ";Q+="; "}}}}}var Vv=i.rules;if(Vv){var Bf,Sf=-1,bf=Vv.length-1;while(Sf<bf)if(Bf=Vv[Sf+=1],rv(Bf)){var gf=Bf.code(v,Bf.keyword,i.type);if(gf){if(Q+=" "+gf+" ",R)Z+="}"}}}if(R)Q+=" "+Z+" ",Z="";if(i.type){if(Q+=" } ",y&&y===i.type&&!p){Q+=" else { ";var h=v.schemaPath+".type",$=v.errSchemaPath+"/type",O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(x||"type")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString($)+" , params: { type: '",a)Q+=""+y.join(",");else Q+=""+y;if(Q+="' } ",v.opts.messages!==!1){if(Q+=" , message: 'should be ",a)Q+=""+y.join(",");else Q+=""+y;Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+h+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+U+" ";Q+=" } "}else Q+=" {} ";var H=Q;if(Q=O.pop(),!v.compositeRule&&R)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } "}}if(R){if(Q+=" if (errors === ",F)Q+="0";else Q+="errs_"+M;Q+=") { ",m+="}"}}}}if(R)Q+=" "+m+" ";if(F){if(P)Q+=" if (errors === 0) return data; ",Q+=" else throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; ",Q+=" return errors === 0; ";Q+=" }; return validate;"}else Q+=" var "+L+" = errors === errs_"+M+";";function iv(cv){var Rf=cv.rules;for(var Jf=0;Jf<Rf.length;Jf++)if(rv(Rf[Jf]))return!0}function rv(cv){return v.schema[cv.keyword]!==void 0||cv.implements&&bv(cv)}function bv(cv){var Rf=cv.implements;for(var Jf=0;Jf<Rf.length;Jf++)if(v.schema[Rf[Jf]]!==void 0)return!0}return Q}});var JX=Qv((fz,WX)=>{var t8=s8(),vW=O0(),fX=o8(),hw=UJ(),vX=jJ(),$w=vW.ucs2length,Dw=r8(),Mw=fX.Validation;WX.exports=FJ;function FJ(f,v,W,X){var Q=this,P=this._opts,w=[void 0],G={},B=[],D={},M=[],A={},N=[];v=v||{schema:f,refVal:w,refs:G};var h=Ow.call(this,f,v,X),$=this._compilations[h.index];if(h.compiling)return $.callValidate=E;var U=this._formats,O=this.RULES;try{var H=L(f,v,W,X);$.validate=H;var F=$.callValidate;if(F){if(F.schema=H.schema,F.errors=null,F.refs=H.refs,F.refVal=H.refVal,F.root=H.root,F.$async=H.$async,P.sourceCode)F.source=H.source}return H}finally{Hw.call(this,f,v,X)}function E(){var T=$.validate,b=T.apply(this,arguments);return E.errors=T.errors,b}function L(T,b,d,Av){var Bv=!b||b&&b.schema==T;if(b.schema!=v.schema)return FJ.call(Q,T,b,d,Av);var Kv=T.$async===!0,Gv=vX({isTop:!0,schema:T,isRoot:Bv,baseId:Av,root:b,schemaPath:"",errSchemaPath:"#",errorPath:'""',MissingRefError:fX.MissingRef,RULES:O,validate:vX,util:vW,resolve:t8,resolveRef:R,usePattern:a,useDefault:p,useCustomRule:i,opts:P,formats:U,logger:Q.logger,self:Q});if(Gv=e8(w,Nw)+e8(B,Vw)+e8(M,qw)+e8(N,Ew)+Gv,P.processCode)Gv=P.processCode(Gv,T);var e;try{var Zv=new Function("self","RULES","formats","root","refVal","defaults","customRules","equal","ucs2length","ValidationError",Gv);e=Zv(Q,O,U,v,w,M,N,Dw,$w,Mw),w[0]=e}catch(sv){throw Q.logger.error("Error compiling schema, function code:",Gv),sv}if(e.schema=T,e.errors=null,e.refs=G,e.refVal=w,e.root=Bv?e:b,Kv)e.$async=!0;if(P.sourceCode===!0)e.source={code:Gv,patterns:B,defaults:M};return e}function R(T,b,d){b=t8.url(T,b);var Av=G[b],Bv,Kv;if(Av!==void 0)return Bv=w[Av],Kv="refVal["+Av+"]",y(Bv,Kv);if(!d&&v.refs){var Gv=v.refs[b];if(Gv!==void 0)return Bv=v.refVal[Gv],Kv=Z(b,Bv),y(Bv,Kv)}Kv=Z(b);var e=t8.call(Q,L,v,b);if(e===void 0){var Zv=W&&W[b];if(Zv)e=t8.inlineRef(Zv,P.inlineRefs)?Zv:FJ.call(Q,Zv,v,W,T)}if(e===void 0)m(b);else return x(b,e),y(e,Kv)}function Z(T,b){var d=w.length;return w[d]=b,G[T]=d,"refVal"+d}function m(T){delete G[T]}function x(T,b){var d=G[T];w[d]=b}function y(T,b){return typeof T=="object"||typeof T=="boolean"?{code:b,schema:T,inline:!0}:{code:b,$async:T&&!!T.$async}}function a(T){var b=D[T];if(b===void 0)b=D[T]=B.length,B[b]=T;return"pattern"+b}function p(T){switch(typeof T){case"boolean":case"number":return""+T;case"string":return vW.toQuotedString(T);case"object":if(T===null)return"null";var b=hw(T),d=A[b];if(d===void 0)d=A[b]=M.length,M[d]=T;return"default"+d}}function i(T,b,d,Av){if(Q._opts.validateSchema!==!1){var Bv=T.definition.dependencies;if(Bv&&!Bv.every(function(nv){return Object.prototype.hasOwnProperty.call(d,nv)}))throw new Error("parent schema must have all required keywords: "+Bv.join(","));var Kv=T.definition.validateSchema;if(Kv){var Gv=Kv(b);if(!Gv){var e="keyword schema is invalid: "+Q.errorsText(Kv.errors);if(Q._opts.validateSchema=="log")Q.logger.error(e);else throw new Error(e)}}}var Zv=T.definition.compile,sv=T.definition.inline,vf=T.definition.macro,Pv;if(Zv)Pv=Zv.call(Q,b,d,Av);else if(vf){if(Pv=vf.call(Q,b,d,Av),P.validateSchema!==!1)Q.validateSchema(Pv,!0)}else if(sv)Pv=sv.call(Q,Av,T.keyword,b,d);else if(Pv=T.definition.validate,!Pv)return;if(Pv===void 0)throw new Error('custom keyword "'+T.keyword+'"failed to compile');var Ev=N.length;return N[Ev]=Pv,{code:"customRule"+Ev,validate:Pv}}}function Ow(f,v,W){var X=QX.call(this,f,v,W);if(X>=0)return{index:X,compiling:!0};return X=this._compilations.length,this._compilations[X]={schema:f,root:v,baseId:W},{index:X,compiling:!1}}function Hw(f,v,W){var X=QX.call(this,f,v,W);if(X>=0)this._compilations.splice(X,1)}function QX(f,v,W){for(var X=0;X<this._compilations.length;X++){var Q=this._compilations[X];if(Q.schema==f&&Q.root==v&&Q.baseId==W)return X}return-1}function Vw(f,v){return"var pattern"+f+" = new RegExp("+vW.toQuotedString(v[f])+");"}function qw(f){return"var default"+f+" = defaults["+f+"];"}function Nw(f,v){return v[f]===void 0?"":"var refVal"+f+" = refVal["+f+"];"}function Ew(f){return"var customRule"+f+" = customRules["+f+"];"}function e8(f,v){if(!f.length)return"";var W="";for(var X=0;X<f.length;X++)W+=v(X,f);return W}});var PX=Qv((Qz,XX)=>{var fW=XX.exports=function f(){this._cache={}};fW.prototype.put=function f(v,W){this._cache[v]=W};fW.prototype.get=function f(v){return this._cache[v]};fW.prototype.del=function f(v){delete this._cache[v]};fW.prototype.clear=function f(){this._cache={}}});var HX=Qv((Wz,OX)=>{var Aw=O0(),Uw=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,jw=[0,31,28,31,30,31,30,31,31,30,31,30,31],Fw=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,YX=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,Lw=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Sw=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,wX=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,GX=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-)*(?:[0-9a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[a-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i,zX=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,BX=/^(?:\/(?:[^~/]|~0|~1)*)*$/,KX=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,hX=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;OX.exports=QW;function QW(f){return f=f=="full"?"full":"fast",Aw.copy(QW[f])}QW.fast={date:/^\d\d\d\d-[0-1]\d-[0-3]\d$/,time:/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,"date-time":/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,"uri-template":wX,url:GX,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,hostname:YX,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:MX,uuid:zX,"json-pointer":BX,"json-pointer-uri-fragment":KX,"relative-json-pointer":hX};QW.full={date:$X,time:DX,"date-time":_w,uri:Iw,"uri-reference":Sw,"uri-template":wX,url:GX,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:YX,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ipv6:/^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,regex:MX,uuid:zX,"json-pointer":BX,"json-pointer-uri-fragment":KX,"relative-json-pointer":hX};function gw(f){return f%4===0&&(f%100!==0||f%400===0)}function $X(f){var v=f.match(Uw);if(!v)return!1;var W=+v[1],X=+v[2],Q=+v[3];return X>=1&&X<=12&&Q>=1&&Q<=(X==2&&gw(W)?29:jw[X])}function DX(f,v){var W=f.match(Fw);if(!W)return!1;var X=W[1],Q=W[2],P=W[3],w=W[5];return(X<=23&&Q<=59&&P<=59||X==23&&Q==59&&P==60)&&(!v||w)}var Rw=/t|\s/i;function _w(f){var v=f.split(Rw);return v.length==2&&$X(v[0])&&DX(v[1],!0)}var kw=/\/|:/;function Iw(f){return kw.test(f)&&Lw.test(f)}var Zw=/[^\\]\\Z/;function MX(f){if(Zw.test(f))return!1;try{return new RegExp(f),!0}catch(v){return!1}}});var qX=Qv((Jz,VX)=>{VX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.errSchemaPath+"/"+W,D=!v.opts.allErrors,M="data"+(w||""),A="valid"+P,N,h;if(G=="#"||G=="#/")if(v.isRoot)N=v.async,h="validate";else N=v.root.schema.$async===!0,h="root.refVal[0]";else{var $=v.resolveRef(v.baseId,G,v.isRoot);if($===void 0){var U=v.MissingRefError.message(v.baseId,G);if(v.opts.missingRefs=="fail"){v.logger.error(U);var O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '$ref' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(B)+" , params: { ref: '"+v.util.escapeQuotes(G)+"' } ",v.opts.messages!==!1)Q+=" , message: 'can\\'t resolve reference "+v.util.escapeQuotes(G)+"' ";if(v.opts.verbose)Q+=" , schema: "+v.util.toQuotedString(G)+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+M+" ";Q+=" } "}else Q+=" {} ";var H=Q;if(Q=O.pop(),!v.compositeRule&&D)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(D)Q+=" if (false) { "}else if(v.opts.missingRefs=="ignore"){if(v.logger.warn(U),D)Q+=" if (true) { "}else throw new v.MissingRefError(v.baseId,G,U)}else if($.inline){var F=v.util.copy(v);F.level++;var E="valid"+F.level;F.schema=$.schema,F.schemaPath="",F.errSchemaPath=G;var L=v.validate(F).replace(/validate\.schema/g,$.code);if(Q+=" "+L+" ",D)Q+=" if ("+E+") { "}else N=$.$async===!0||v.async&&$.$async!==!1,h=$.code}if(h){var O=O||[];if(O.push(Q),Q="",v.opts.passContext)Q+=" "+h+".call(this, ";else Q+=" "+h+"( ";if(Q+=" "+M+", (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var R=w?"data"+(w-1||""):"parentData",Z=w?v.dataPathArr[w]:"parentDataProperty";Q+=" , "+R+" , "+Z+", rootData) ";var m=Q;if(Q=O.pop(),N){if(!v.async)throw new Error("async schema referenced by sync schema");if(D)Q+=" var "+A+"; ";if(Q+=" try { await "+m+"; ",D)Q+=" "+A+" = true; ";if(Q+=" } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; ",D)Q+=" "+A+" = false; ";if(Q+=" } ",D)Q+=" if ("+A+") { "}else if(Q+=" if (!"+m+") { if (vErrors === null) vErrors = "+h+".errors; else vErrors = vErrors.concat("+h+".errors); errors = vErrors.length; } ",D)Q+=" else { "}return Q}});var EX=Qv((Xz,NX)=>{NX.exports=function f(v,W,X){var Q=" ",P=v.schema[W],w=v.schemaPath+v.util.getProperty(W),G=v.errSchemaPath+"/"+W,B=!v.opts.allErrors,D=v.util.copy(v),M="";D.level++;var A="valid"+D.level,N=D.baseId,h=!0,$=P;if($){var U,O=-1,H=$.length-1;while(O<H)if(U=$[O+=1],v.opts.strictKeywords?typeof U=="object"&&Object.keys(U).length>0||U===!1:v.util.schemaHasRules(U,v.RULES.all)){if(h=!1,D.schema=U,D.schemaPath=w+"["+O+"]",D.errSchemaPath=G+"/"+O,Q+=" "+v.validate(D)+" ",D.baseId=N,B)Q+=" if ("+A+") { ",M+="}"}}if(B)if(h)Q+=" if (true) { ";else Q+=" "+M.slice(0,-1)+" ";return Q}});var UX=Qv((Pz,AX)=>{AX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h="errs__"+P,$=v.util.copy(v),U="";$.level++;var O="valid"+$.level,H=G.every(function(x){return v.opts.strictKeywords?typeof x=="object"&&Object.keys(x).length>0||x===!1:v.util.schemaHasRules(x,v.RULES.all)});if(H){var F=$.baseId;Q+=" var "+h+" = errors; var "+N+" = false; ";var E=v.compositeRule;v.compositeRule=$.compositeRule=!0;var L=G;if(L){var R,Z=-1,m=L.length-1;while(Z<m)R=L[Z+=1],$.schema=R,$.schemaPath=B+"["+Z+"]",$.errSchemaPath=D+"/"+Z,Q+=" "+v.validate($)+" ",$.baseId=F,Q+=" "+N+" = "+N+" || "+O+"; if (!"+N+") { ",U+="}"}if(v.compositeRule=$.compositeRule=E,Q+=" "+U+" if (!"+N+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'anyOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should match some schema in anyOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else if(M)Q+=" if (true) { ";return Q}});var FX=Qv((Yz,jX)=>{jX.exports=function f(v,W,X){var Q=" ",P=v.schema[W],w=v.errSchemaPath+"/"+W,G=!v.opts.allErrors,B=v.util.toQuotedString(P);if(v.opts.$comment===!0)Q+=" console.log("+B+");";else if(typeof v.opts.$comment=="function")Q+=" self._opts.$comment("+B+", "+v.util.toQuotedString(w)+", validate.root.schema);";return Q}});var SX=Qv((wz,LX)=>{LX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h=v.opts.$data&&G&&G.$data,$;if(h)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",$="schema"+P;else $=G;if(!h)Q+=" var schema"+P+" = validate.schema"+B+";";Q+="var "+N+" = equal("+A+", schema"+P+"); if (!"+N+") { ";var U=U||[];if(U.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'const' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { allowedValue: schema"+P+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to constant' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var O=Q;if(Q=U.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",M)Q+=" else { ";return Q}});var RX=Qv((Gz,gX)=>{gX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h="errs__"+P,$=v.util.copy(v),U="";$.level++;var O="valid"+$.level,H="i"+P,F=$.dataLevel=v.dataLevel+1,E="data"+F,L=v.baseId,R=v.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:v.util.schemaHasRules(G,v.RULES.all);if(Q+="var "+h+" = errors;var "+N+";",R){var Z=v.compositeRule;v.compositeRule=$.compositeRule=!0,$.schema=G,$.schemaPath=B,$.errSchemaPath=D,Q+=" var "+O+" = false; for (var "+H+" = 0; "+H+" < "+A+".length; "+H+"++) { ",$.errorPath=v.util.getPathExpr(v.errorPath,H,v.opts.jsonPointers,!0);var m=A+"["+H+"]";$.dataPathArr[F]=H;var x=v.validate($);if($.baseId=L,v.util.varOccurences(x,E)<2)Q+=" "+v.util.varReplace(x,E,m)+" ";else Q+=" var "+E+" = "+m+"; "+x+" ";Q+=" if ("+O+") break; } ",v.compositeRule=$.compositeRule=Z,Q+=" "+U+" if (!"+O+") {"}else Q+=" if ("+A+".length == 0) {";var y=y||[];if(y.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'contains' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should contain a valid item' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var a=Q;if(Q=y.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+a+"]); ";else Q+=" validate.errors = ["+a+"]; return false; ";else Q+=" var err = "+a+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { ",R)Q+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ";if(v.opts.allErrors)Q+=" } ";return Q}});var kX=Qv((zz,_X)=>{_X.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="errs__"+P,h=v.util.copy(v),$="";h.level++;var U="valid"+h.level,O={},H={},F=v.opts.ownProperties;for(Z in G){if(Z=="__proto__")continue;var E=G[Z],L=Array.isArray(E)?H:O;L[Z]=E}Q+="var "+N+" = errors;";var R=v.errorPath;Q+="var missing"+P+";";for(var Z in H)if(L=H[Z],L.length){if(Q+=" if ( "+A+v.util.getProperty(Z)+" !== undefined ",F)Q+=" && Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(Z)+"') ";if(M){Q+=" && ( ";var m=L;if(m){var x,y=-1,a=m.length-1;while(y<a){if(x=m[y+=1],y)Q+=" || ";var p=v.util.getProperty(x),i=A+p;if(Q+=" ( ( "+i+" === undefined ",F)Q+=" || ! Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(x)+"') ";Q+=") && (missing"+P+" = "+v.util.toQuotedString(v.opts.jsonPointers?x:p)+") ) "}}Q+=")) { ";var T="missing"+P,b="' + "+T+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(R,T,!0):R+" + "+T;var d=d||[];if(d.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { property: '"+v.util.escapeQuotes(Z)+"', missingProperty: '"+b+"', depsCount: "+L.length+", deps: '"+v.util.escapeQuotes(L.length==1?L[0]:L.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",L.length==1)Q+="property "+v.util.escapeQuotes(L[0]);else Q+="properties "+v.util.escapeQuotes(L.join(", "));Q+=" when property "+v.util.escapeQuotes(Z)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var Av=Q;if(Q=d.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+Av+"]); ";else Q+=" validate.errors = ["+Av+"]; return false; ";else Q+=" var err = "+Av+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; "}else{Q+=" ) { ";var Bv=L;if(Bv){var x,Kv=-1,Gv=Bv.length-1;while(Kv<Gv){x=Bv[Kv+=1];var p=v.util.getProperty(x),b=v.util.escapeQuotes(x),i=A+p;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(R,x,v.opts.jsonPointers);if(Q+=" if ( "+i+" === undefined ",F)Q+=" || ! Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(x)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'dependencies' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { property: '"+v.util.escapeQuotes(Z)+"', missingProperty: '"+b+"', depsCount: "+L.length+", deps: '"+v.util.escapeQuotes(L.length==1?L[0]:L.join(", "))+"' } ",v.opts.messages!==!1){if(Q+=" , message: 'should have ",L.length==1)Q+="property "+v.util.escapeQuotes(L[0]);else Q+="properties "+v.util.escapeQuotes(L.join(", "));Q+=" when property "+v.util.escapeQuotes(Z)+" is present' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}if(Q+=" } ",M)$+="}",Q+=" else { "}v.errorPath=R;var e=h.baseId;for(var Z in O){var E=O[Z];if(v.opts.strictKeywords?typeof E=="object"&&Object.keys(E).length>0||E===!1:v.util.schemaHasRules(E,v.RULES.all)){if(Q+=" "+U+" = true; if ( "+A+v.util.getProperty(Z)+" !== undefined ",F)Q+=" && Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(Z)+"') ";if(Q+=") { ",h.schema=E,h.schemaPath=B+v.util.getProperty(Z),h.errSchemaPath=D+"/"+v.util.escapeFragment(Z),Q+=" "+v.validate(h)+" ",h.baseId=e,Q+=" } ",M)Q+=" if ("+U+") { ",$+="}"}}if(M)Q+=" "+$+" if ("+N+" == errors) {";return Q}});var ZX=Qv((Bz,IX)=>{IX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h=v.opts.$data&&G&&G.$data,$;if(h)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",$="schema"+P;else $=G;var U="i"+P,O="schema"+P;if(!h)Q+=" var "+O+" = validate.schema"+B+";";if(Q+="var "+N+";",h)Q+=" if (schema"+P+" === undefined) "+N+" = true; else if (!Array.isArray(schema"+P+")) "+N+" = false; else {";if(Q+=""+N+" = false;for (var "+U+"=0; "+U+"<"+O+".length; "+U+"++) if (equal("+A+", "+O+"["+U+"])) { "+N+" = true; break; }",h)Q+=" } ";Q+=" if (!"+N+") { ";var H=H||[];if(H.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'enum' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { allowedValues: schema"+P+" } ",v.opts.messages!==!1)Q+=" , message: 'should be equal to one of the allowed values' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var F=Q;if(Q=H.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" }",M)Q+=" else { ";return Q}});var yX=Qv((Kz,CX)=>{CX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||"");if(v.opts.format===!1){if(M)Q+=" if (true) { ";return Q}var N=v.opts.$data&&G&&G.$data,h;if(N)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",h="schema"+P;else h=G;var $=v.opts.unknownFormats,U=Array.isArray($);if(N){var O="format"+P,H="isObject"+P,F="formatType"+P;if(Q+=" var "+O+" = formats["+h+"]; var "+H+" = typeof "+O+" == 'object' && !("+O+" instanceof RegExp) && "+O+".validate; var "+F+" = "+H+" && "+O+".type || 'string'; if ("+H+") { ",v.async)Q+=" var async"+P+" = "+O+".async; ";if(Q+=" "+O+" = "+O+".validate; } if ( ",N)Q+=" ("+h+" !== undefined && typeof "+h+" != 'string') || ";if(Q+=" (",$!="ignore"){if(Q+=" ("+h+" && !"+O+" ",U)Q+=" && self._opts.unknownFormats.indexOf("+h+") == -1 ";Q+=") || "}if(Q+=" ("+O+" && "+F+" == '"+X+"' && !(typeof "+O+" == 'function' ? ",v.async)Q+=" (async"+P+" ? await "+O+"("+A+") : "+O+"("+A+")) ";else Q+=" "+O+"("+A+") ";Q+=" : "+O+".test("+A+"))))) {"}else{var O=v.formats[G];if(!O)if($=="ignore"){if(v.logger.warn('unknown format "'+G+'" ignored in schema at path "'+v.errSchemaPath+'"'),M)Q+=" if (true) { ";return Q}else if(U&&$.indexOf(G)>=0){if(M)Q+=" if (true) { ";return Q}else throw new Error('unknown format "'+G+'" is used in schema at path "'+v.errSchemaPath+'"');var H=typeof O=="object"&&!(O instanceof RegExp)&&O.validate,F=H&&O.type||"string";if(H){var E=O.async===!0;O=O.validate}if(F!=X){if(M)Q+=" if (true) { ";return Q}if(E){if(!v.async)throw new Error("async format in sync schema");var L="formats"+v.util.getProperty(G)+".validate";Q+=" if (!(await "+L+"("+A+"))) { "}else{Q+=" if (! ";var L="formats"+v.util.getProperty(G);if(H)L+=".validate";if(typeof O=="function")Q+=" "+L+"("+A+") ";else Q+=" "+L+".test("+A+") ";Q+=") { "}}var R=R||[];if(R.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'format' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { format: ",N)Q+=""+h;else Q+=""+v.util.toQuotedString(G);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match format "`,N)Q+="' + "+h+" + '";else Q+=""+v.util.escapeQuotes(G);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",N)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(G);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" "}Q+=" } "}else Q+=" {} ";var Z=Q;if(Q=R.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+Z+"]); ";else Q+=" validate.errors = ["+Z+"]; return false; ";else Q+=" var err = "+Z+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",M)Q+=" else { ";return Q}});var xX=Qv((hz,TX)=>{TX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h="errs__"+P,$=v.util.copy(v);$.level++;var U="valid"+$.level,O=v.schema.then,H=v.schema.else,F=O!==void 0&&(v.opts.strictKeywords?typeof O=="object"&&Object.keys(O).length>0||O===!1:v.util.schemaHasRules(O,v.RULES.all)),E=H!==void 0&&(v.opts.strictKeywords?typeof H=="object"&&Object.keys(H).length>0||H===!1:v.util.schemaHasRules(H,v.RULES.all)),L=$.baseId;if(F||E){var R;$.createErrors=!1,$.schema=G,$.schemaPath=B,$.errSchemaPath=D,Q+=" var "+h+" = errors; var "+N+" = true; ";var Z=v.compositeRule;if(v.compositeRule=$.compositeRule=!0,Q+=" "+v.validate($)+" ",$.baseId=L,$.createErrors=!0,Q+=" errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; } ",v.compositeRule=$.compositeRule=Z,F){if(Q+=" if ("+U+") { ",$.schema=v.schema.then,$.schemaPath=v.schemaPath+".then",$.errSchemaPath=v.errSchemaPath+"/then",Q+=" "+v.validate($)+" ",$.baseId=L,Q+=" "+N+" = "+U+"; ",F&&E)R="ifClause"+P,Q+=" var "+R+" = 'then'; ";else R="'then'";if(Q+=" } ",E)Q+=" else { "}else Q+=" if (!"+U+") { ";if(E){if($.schema=v.schema.else,$.schemaPath=v.schemaPath+".else",$.errSchemaPath=v.errSchemaPath+"/else",Q+=" "+v.validate($)+" ",$.baseId=L,Q+=" "+N+" = "+U+"; ",F&&E)R="ifClause"+P,Q+=" var "+R+" = 'else'; ";else R="'else'";Q+=" } "}if(Q+=" if (!"+N+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'if' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { failingKeyword: "+R+" } ",v.opts.messages!==!1)Q+=` , message: 'should match "' + `+R+` + '" schema' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+=" } ",M)Q+=" else { "}else if(M)Q+=" if (true) { ";return Q}});var bX=Qv(($z,lX)=>{lX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h="errs__"+P,$=v.util.copy(v),U="";$.level++;var O="valid"+$.level,H="i"+P,F=$.dataLevel=v.dataLevel+1,E="data"+F,L=v.baseId;if(Q+="var "+h+" = errors;var "+N+";",Array.isArray(G)){var R=v.schema.additionalItems;if(R===!1){Q+=" "+N+" = "+A+".length <= "+G.length+"; ";var Z=D;D=v.errSchemaPath+"/additionalItems",Q+=" if (!"+N+") { ";var m=m||[];if(m.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { limit: "+G.length+" } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have more than "+G.length+" items' ";if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var x=Q;if(Q=m.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+x+"]); ";else Q+=" validate.errors = ["+x+"]; return false; ";else Q+=" var err = "+x+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",D=Z,M)U+="}",Q+=" else { "}var y=G;if(y){var a,p=-1,i=y.length-1;while(p<i)if(a=y[p+=1],v.opts.strictKeywords?typeof a=="object"&&Object.keys(a).length>0||a===!1:v.util.schemaHasRules(a,v.RULES.all)){Q+=" "+O+" = true; if ("+A+".length > "+p+") { ";var T=A+"["+p+"]";$.schema=a,$.schemaPath=B+"["+p+"]",$.errSchemaPath=D+"/"+p,$.errorPath=v.util.getPathExpr(v.errorPath,p,v.opts.jsonPointers,!0),$.dataPathArr[F]=p;var b=v.validate($);if($.baseId=L,v.util.varOccurences(b,E)<2)Q+=" "+v.util.varReplace(b,E,T)+" ";else Q+=" var "+E+" = "+T+"; "+b+" ";if(Q+=" } ",M)Q+=" if ("+O+") { ",U+="}"}}if(typeof R=="object"&&(v.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:v.util.schemaHasRules(R,v.RULES.all))){$.schema=R,$.schemaPath=v.schemaPath+".additionalItems",$.errSchemaPath=v.errSchemaPath+"/additionalItems",Q+=" "+O+" = true; if ("+A+".length > "+G.length+") { for (var "+H+" = "+G.length+"; "+H+" < "+A+".length; "+H+"++) { ",$.errorPath=v.util.getPathExpr(v.errorPath,H,v.opts.jsonPointers,!0);var T=A+"["+H+"]";$.dataPathArr[F]=H;var b=v.validate($);if($.baseId=L,v.util.varOccurences(b,E)<2)Q+=" "+v.util.varReplace(b,E,T)+" ";else Q+=" var "+E+" = "+T+"; "+b+" ";if(M)Q+=" if (!"+O+") break; ";if(Q+=" } } ",M)Q+=" if ("+O+") { ",U+="}"}}else if(v.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:v.util.schemaHasRules(G,v.RULES.all)){$.schema=G,$.schemaPath=B,$.errSchemaPath=D,Q+=" for (var "+H+" = 0; "+H+" < "+A+".length; "+H+"++) { ",$.errorPath=v.util.getPathExpr(v.errorPath,H,v.opts.jsonPointers,!0);var T=A+"["+H+"]";$.dataPathArr[F]=H;var b=v.validate($);if($.baseId=L,v.util.varOccurences(b,E)<2)Q+=" "+v.util.varReplace(b,E,T)+" ";else Q+=" var "+E+" = "+T+"; "+b+" ";if(M)Q+=" if (!"+O+") break; ";Q+=" }"}if(M)Q+=" "+U+" if ("+h+" == errors) {";return Q}});var LJ=Qv((Dz,uX)=>{uX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,L,A="data"+(w||""),N=v.opts.$data&&G&&G.$data,h;if(N)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",h="schema"+P;else h=G;var $=W=="maximum",U=$?"exclusiveMaximum":"exclusiveMinimum",O=v.schema[U],H=v.opts.$data&&O&&O.$data,F=$?"<":">",E=$?">":"<",L=void 0;if(!(N||typeof G=="number"||G===void 0))throw new Error(W+" must be number");if(!(H||O===void 0||typeof O=="number"||typeof O=="boolean"))throw new Error(U+" must be number or boolean");if(H){var R=v.util.getData(O.$data,w,v.dataPathArr),Z="exclusive"+P,m="exclType"+P,x="exclIsNumber"+P,y="op"+P,a="' + "+y+" + '";Q+=" var schemaExcl"+P+" = "+R+"; ",R="schemaExcl"+P,Q+=" var "+Z+"; var "+m+" = typeof "+R+"; if ("+m+" != 'boolean' && "+m+" != 'undefined' && "+m+" != 'number') { ";var L=U,p=p||[];if(p.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(L||"_exclusiveLimit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: '"+U+" should be boolean' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var i=Q;if(Q=p.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+i+"]); ";else Q+=" validate.errors = ["+i+"]; return false; ";else Q+=" var err = "+i+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else if ( ",N)Q+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ";if(Q+=" "+m+" == 'number' ? ( ("+Z+" = "+h+" === undefined || "+R+" "+F+"= "+h+") ? "+A+" "+E+"= "+R+" : "+A+" "+E+" "+h+" ) : ( ("+Z+" = "+R+" === true) ? "+A+" "+E+"= "+h+" : "+A+" "+E+" "+h+" ) || "+A+" !== "+A+") { var op"+P+" = "+Z+" ? '"+F+"' : '"+F+"='; ",G===void 0)L=U,D=v.errSchemaPath+"/"+U,h=R,N=H}else{var x=typeof O=="number",a=F;if(x&&N){var y="'"+a+"'";if(Q+=" if ( ",N)Q+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ";Q+=" ( "+h+" === undefined || "+O+" "+F+"= "+h+" ? "+A+" "+E+"= "+O+" : "+A+" "+E+" "+h+" ) || "+A+" !== "+A+") { "}else{if(x&&G===void 0)Z=!0,L=U,D=v.errSchemaPath+"/"+U,h=O,E+="=";else{if(x)h=Math[$?"min":"max"](O,G);if(O===(x?h:!0))Z=!0,L=U,D=v.errSchemaPath+"/"+U,E+="=";else Z=!1,a+="="}var y="'"+a+"'";if(Q+=" if ( ",N)Q+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ";Q+=" "+A+" "+E+" "+h+" || "+A+" !== "+A+") { "}}L=L||W;var p=p||[];if(p.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(L||"_limit")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { comparison: "+y+", limit: "+h+", exclusive: "+Z+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be "+a+" ",N)Q+="' + "+h;else Q+=""+h+"'";if(v.opts.verbose){if(Q+=" , schema: ",N)Q+="validate.schema"+B;else Q+=""+G;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" "}Q+=" } "}else Q+=" {} ";var i=Q;if(Q=p.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+i+"]); ";else Q+=" validate.errors = ["+i+"]; return false; ";else Q+=" var err = "+i+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",M)Q+=" else { ";return Q}});var SJ=Qv((Mz,mX)=>{mX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,U,A="data"+(w||""),N=v.opts.$data&&G&&G.$data,h;if(N)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",h="schema"+P;else h=G;if(!(N||typeof G=="number"))throw new Error(W+" must be number");var $=W=="maxItems"?">":"<";if(Q+="if ( ",N)Q+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ";Q+=" "+A+".length "+$+" "+h+") { ";var U=W,O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(U||"_limitItems")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { limit: "+h+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxItems")Q+="more";else Q+="fewer";if(Q+=" than ",N)Q+="' + "+h+" + '";else Q+=""+G;Q+=" items' "}if(v.opts.verbose){if(Q+=" , schema: ",N)Q+="validate.schema"+B;else Q+=""+G;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" "}Q+=" } "}else Q+=" {} ";var H=Q;if(Q=O.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",M)Q+=" else { ";return Q}});var gJ=Qv((Oz,rX)=>{rX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,U,A="data"+(w||""),N=v.opts.$data&&G&&G.$data,h;if(N)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",h="schema"+P;else h=G;if(!(N||typeof G=="number"))throw new Error(W+" must be number");var $=W=="maxLength"?">":"<";if(Q+="if ( ",N)Q+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ";if(v.opts.unicode===!1)Q+=" "+A+".length ";else Q+=" ucs2length("+A+") ";Q+=" "+$+" "+h+") { ";var U=W,O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(U||"_limitLength")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { limit: "+h+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT be ",W=="maxLength")Q+="longer";else Q+="shorter";if(Q+=" than ",N)Q+="' + "+h+" + '";else Q+=""+G;Q+=" characters' "}if(v.opts.verbose){if(Q+=" , schema: ",N)Q+="validate.schema"+B;else Q+=""+G;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" "}Q+=" } "}else Q+=" {} ";var H=Q;if(Q=O.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",M)Q+=" else { ";return Q}});var RJ=Qv((Hz,aX)=>{aX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,U,A="data"+(w||""),N=v.opts.$data&&G&&G.$data,h;if(N)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",h="schema"+P;else h=G;if(!(N||typeof G=="number"))throw new Error(W+" must be number");var $=W=="maxProperties"?">":"<";if(Q+="if ( ",N)Q+=" ("+h+" !== undefined && typeof "+h+" != 'number') || ";Q+=" Object.keys("+A+").length "+$+" "+h+") { ";var U=W,O=O||[];if(O.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(U||"_limitProperties")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { limit: "+h+" } ",v.opts.messages!==!1){if(Q+=" , message: 'should NOT have ",W=="maxProperties")Q+="more";else Q+="fewer";if(Q+=" than ",N)Q+="' + "+h+" + '";else Q+=""+G;Q+=" properties' "}if(v.opts.verbose){if(Q+=" , schema: ",N)Q+="validate.schema"+B;else Q+=""+G;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" "}Q+=" } "}else Q+=" {} ";var H=Q;if(Q=O.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+H+"]); ";else Q+=" validate.errors = ["+H+"]; return false; ";else Q+=" var err = "+H+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",M)Q+=" else { ";return Q}});var nX=Qv((Vz,cX)=>{cX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N=v.opts.$data&&G&&G.$data,h;if(N)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",h="schema"+P;else h=G;if(!(N||typeof G=="number"))throw new Error(W+" must be number");if(Q+="var division"+P+";if (",N)Q+=" "+h+" !== undefined && ( typeof "+h+" != 'number' || ";if(Q+=" (division"+P+" = "+A+" / "+h+", ",v.opts.multipleOfPrecision)Q+=" Math.abs(Math.round(division"+P+") - division"+P+") > 1e-"+v.opts.multipleOfPrecision+" ";else Q+=" division"+P+" !== parseInt(division"+P+") ";if(Q+=" ) ",N)Q+=" ) ";Q+=" ) { ";var $=$||[];if($.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'multipleOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { multipleOf: "+h+" } ",v.opts.messages!==!1)if(Q+=" , message: 'should be multiple of ",N)Q+="' + "+h;else Q+=""+h+"'";if(v.opts.verbose){if(Q+=" , schema: ",N)Q+="validate.schema"+B;else Q+=""+G;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" "}Q+=" } "}else Q+=" {} ";var U=Q;if(Q=$.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+U+"]); ";else Q+=" validate.errors = ["+U+"]; return false; ";else Q+=" var err = "+U+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",M)Q+=" else { ";return Q}});var iX=Qv((qz,pX)=>{pX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="errs__"+P,h=v.util.copy(v);h.level++;var $="valid"+h.level;if(v.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:v.util.schemaHasRules(G,v.RULES.all)){h.schema=G,h.schemaPath=B,h.errSchemaPath=D,Q+=" var "+N+" = errors; ";var U=v.compositeRule;v.compositeRule=h.compositeRule=!0,h.createErrors=!1;var O;if(h.opts.allErrors)O=h.opts.allErrors,h.opts.allErrors=!1;if(Q+=" "+v.validate(h)+" ",h.createErrors=!0,O)h.opts.allErrors=O;v.compositeRule=h.compositeRule=U,Q+=" if ("+$+") { ";var H=H||[];if(H.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var F=Q;if(Q=H.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+F+"]); ";else Q+=" validate.errors = ["+F+"]; return false; ";else Q+=" var err = "+F+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } else { errors = "+N+"; if (vErrors !== null) { if ("+N+") vErrors.length = "+N+"; else vErrors = null; } ",v.opts.allErrors)Q+=" } "}else{if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'not' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: {} ",v.opts.messages!==!1)Q+=" , message: 'should NOT be valid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",M)Q+=" if (false) { "}return Q}});var sX=Qv((Nz,dX)=>{dX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h="errs__"+P,$=v.util.copy(v),U="";$.level++;var O="valid"+$.level,H=$.baseId,F="prevValid"+P,E="passingSchemas"+P;Q+="var "+h+" = errors , "+F+" = false , "+N+" = false , "+E+" = null; ";var L=v.compositeRule;v.compositeRule=$.compositeRule=!0;var R=G;if(R){var Z,m=-1,x=R.length-1;while(m<x){if(Z=R[m+=1],v.opts.strictKeywords?typeof Z=="object"&&Object.keys(Z).length>0||Z===!1:v.util.schemaHasRules(Z,v.RULES.all))$.schema=Z,$.schemaPath=B+"["+m+"]",$.errSchemaPath=D+"/"+m,Q+=" "+v.validate($)+" ",$.baseId=H;else Q+=" var "+O+" = true; ";if(m)Q+=" if ("+O+" && "+F+") { "+N+" = false; "+E+" = ["+E+", "+m+"]; } else { ",U+="}";Q+=" if ("+O+") { "+N+" = "+F+" = true; "+E+" = "+m+"; }"}}if(v.compositeRule=$.compositeRule=L,Q+=""+U+"if (!"+N+") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'oneOf' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { passingSchemas: "+E+" } ",v.opts.messages!==!1)Q+=" , message: 'should match exactly one schema in oneOf' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(Q+="} else { errors = "+h+"; if (vErrors !== null) { if ("+h+") vErrors.length = "+h+"; else vErrors = null; }",v.opts.allErrors)Q+=" } ";return Q}});var tX=Qv((Ez,oX)=>{oX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N=v.opts.$data&&G&&G.$data,h;if(N)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",h="schema"+P;else h=G;var $=N?"(new RegExp("+h+"))":v.usePattern(G);if(Q+="if ( ",N)Q+=" ("+h+" !== undefined && typeof "+h+" != 'string') || ";Q+=" !"+$+".test("+A+") ) { ";var U=U||[];if(U.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'pattern' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { pattern: ",N)Q+=""+h;else Q+=""+v.util.toQuotedString(G);if(Q+=" } ",v.opts.messages!==!1){if(Q+=` , message: 'should match pattern "`,N)Q+="' + "+h+" + '";else Q+=""+v.util.escapeQuotes(G);Q+=`"' `}if(v.opts.verbose){if(Q+=" , schema: ",N)Q+="validate.schema"+B;else Q+=""+v.util.toQuotedString(G);Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" "}Q+=" } "}else Q+=" {} ";var O=Q;if(Q=U.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+O+"]); ";else Q+=" validate.errors = ["+O+"]; return false; ";else Q+=" var err = "+O+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+="} ",M)Q+=" else { ";return Q}});var vP=Qv((Az,eX)=>{eX.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="errs__"+P,h=v.util.copy(v),$="";h.level++;var U="valid"+h.level,O="key"+P,H="idx"+P,F=h.dataLevel=v.dataLevel+1,E="data"+F,L="dataProperties"+P,R=Object.keys(G||{}).filter(Kv),Z=v.schema.patternProperties||{},m=Object.keys(Z).filter(Kv),x=v.schema.additionalProperties,y=R.length||m.length,a=x===!1,p=typeof x=="object"&&Object.keys(x).length,i=v.opts.removeAdditional,T=a||p||i,b=v.opts.ownProperties,d=v.baseId,Av=v.schema.required;if(Av&&!(v.opts.$data&&Av.$data)&&Av.length<v.opts.loopRequired)var Bv=v.util.toHash(Av);function Kv(Kf){return Kf!=="__proto__"}if(Q+="var "+N+" = errors;var "+U+" = true;",b)Q+=" var "+L+" = undefined;";if(T){if(b)Q+=" "+L+" = "+L+" || Object.keys("+A+"); for (var "+H+"=0; "+H+"<"+L+".length; "+H+"++) { var "+O+" = "+L+"["+H+"]; ";else Q+=" for (var "+O+" in "+A+") { ";if(y){if(Q+=" var isAdditional"+P+" = !(false ",R.length)if(R.length>8)Q+=" || validate.schema"+B+".hasOwnProperty("+O+") ";else{var Gv=R;if(Gv){var e,Zv=-1,sv=Gv.length-1;while(Zv<sv)e=Gv[Zv+=1],Q+=" || "+O+" == "+v.util.toQuotedString(e)+" "}}if(m.length){var vf=m;if(vf){var Pv,Ev=-1,nv=vf.length-1;while(Ev<nv)Pv=vf[Ev+=1],Q+=" || "+v.usePattern(Pv)+".test("+O+") "}}Q+=" ); if (isAdditional"+P+") { "}if(i=="all")Q+=" delete "+A+"["+O+"]; ";else{var ov=v.errorPath,tv="' + "+O+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers);if(a)if(i)Q+=" delete "+A+"["+O+"]; ";else{Q+=" "+U+" = false; ";var Uf=D;D=v.errSchemaPath+"/additionalProperties";var xv=xv||[];if(xv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'additionalProperties' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { additionalProperty: '"+tv+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is an invalid additional property";else Q+="should NOT have additional properties";Q+="' "}if(v.opts.verbose)Q+=" , schema: false , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var Cv=Q;if(Q=xv.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+Cv+"]); ";else Q+=" validate.errors = ["+Cv+"]; return false; ";else Q+=" var err = "+Cv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(D=Uf,M)Q+=" break; "}else if(p)if(i=="failing"){Q+=" var "+N+" = errors; ";var M1=v.compositeRule;v.compositeRule=h.compositeRule=!0,h.schema=x,h.schemaPath=v.schemaPath+".additionalProperties",h.errSchemaPath=v.errSchemaPath+"/additionalProperties",h.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers);var pv=A+"["+O+"]";h.dataPathArr[F]=O;var Vv=v.validate(h);if(h.baseId=d,v.util.varOccurences(Vv,E)<2)Q+=" "+v.util.varReplace(Vv,E,pv)+" ";else Q+=" var "+E+" = "+pv+"; "+Vv+" ";Q+=" if (!"+U+") { errors = "+N+"; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete "+A+"["+O+"]; } ",v.compositeRule=h.compositeRule=M1}else{h.schema=x,h.schemaPath=v.schemaPath+".additionalProperties",h.errSchemaPath=v.errSchemaPath+"/additionalProperties",h.errorPath=v.opts._errorDataPathProperty?v.errorPath:v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers);var pv=A+"["+O+"]";h.dataPathArr[F]=O;var Vv=v.validate(h);if(h.baseId=d,v.util.varOccurences(Vv,E)<2)Q+=" "+v.util.varReplace(Vv,E,pv)+" ";else Q+=" var "+E+" = "+pv+"; "+Vv+" ";if(M)Q+=" if (!"+U+") break; "}v.errorPath=ov}if(y)Q+=" } ";if(Q+=" } ",M)Q+=" if ("+U+") { ",$+="}"}var Bf=v.opts.useDefaults&&!v.compositeRule;if(R.length){var Sf=R;if(Sf){var e,bf=-1,gf=Sf.length-1;while(bf<gf){e=Sf[bf+=1];var iv=G[e];if(v.opts.strictKeywords?typeof iv=="object"&&Object.keys(iv).length>0||iv===!1:v.util.schemaHasRules(iv,v.RULES.all)){var rv=v.util.getProperty(e),pv=A+rv,bv=Bf&&iv.default!==void 0;h.schema=iv,h.schemaPath=B+rv,h.errSchemaPath=D+"/"+v.util.escapeFragment(e),h.errorPath=v.util.getPath(v.errorPath,e,v.opts.jsonPointers),h.dataPathArr[F]=v.util.toQuotedString(e);var Vv=v.validate(h);if(h.baseId=d,v.util.varOccurences(Vv,E)<2){Vv=v.util.varReplace(Vv,E,pv);var cv=pv}else{var cv=E;Q+=" var "+E+" = "+pv+"; "}if(bv)Q+=" "+Vv+" ";else{if(Bv&&Bv[e]){if(Q+=" if ( "+cv+" === undefined ",b)Q+=" || ! Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(e)+"') ";Q+=") { "+U+" = false; ";var ov=v.errorPath,Uf=D,Rf=v.util.escapeQuotes(e);if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(ov,e,v.opts.jsonPointers);D=v.errSchemaPath+"/required";var xv=xv||[];if(xv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { missingProperty: '"+Rf+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+Rf+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var Cv=Q;if(Q=xv.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+Cv+"]); ";else Q+=" validate.errors = ["+Cv+"]; return false; ";else Q+=" var err = "+Cv+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";D=Uf,v.errorPath=ov,Q+=" } else { "}else if(M){if(Q+=" if ( "+cv+" === undefined ",b)Q+=" || ! Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(e)+"') ";Q+=") { "+U+" = true; } else { "}else{if(Q+=" if ("+cv+" !== undefined ",b)Q+=" && Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(e)+"') ";Q+=" ) { "}Q+=" "+Vv+" } "}}if(M)Q+=" if ("+U+") { ",$+="}"}}}if(m.length){var Jf=m;if(Jf){var Pv,O1=-1,XQ=Jf.length-1;while(O1<XQ){Pv=Jf[O1+=1];var iv=Z[Pv];if(v.opts.strictKeywords?typeof iv=="object"&&Object.keys(iv).length>0||iv===!1:v.util.schemaHasRules(iv,v.RULES.all)){if(h.schema=iv,h.schemaPath=v.schemaPath+".patternProperties"+v.util.getProperty(Pv),h.errSchemaPath=v.errSchemaPath+"/patternProperties/"+v.util.escapeFragment(Pv),b)Q+=" "+L+" = "+L+" || Object.keys("+A+"); for (var "+H+"=0; "+H+"<"+L+".length; "+H+"++) { var "+O+" = "+L+"["+H+"]; ";else Q+=" for (var "+O+" in "+A+") { ";Q+=" if ("+v.usePattern(Pv)+".test("+O+")) { ",h.errorPath=v.util.getPathExpr(v.errorPath,O,v.opts.jsonPointers);var pv=A+"["+O+"]";h.dataPathArr[F]=O;var Vv=v.validate(h);if(h.baseId=d,v.util.varOccurences(Vv,E)<2)Q+=" "+v.util.varReplace(Vv,E,pv)+" ";else Q+=" var "+E+" = "+pv+"; "+Vv+" ";if(M)Q+=" if (!"+U+") break; ";if(Q+=" } ",M)Q+=" else "+U+" = true; ";if(Q+=" } ",M)Q+=" if ("+U+") { ",$+="}"}}}}if(M)Q+=" "+$+" if ("+N+" == errors) {";return Q}});var QP=Qv((Uz,fP)=>{fP.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="errs__"+P,h=v.util.copy(v),$="";h.level++;var U="valid"+h.level;if(Q+="var "+N+" = errors;",v.opts.strictKeywords?typeof G=="object"&&Object.keys(G).length>0||G===!1:v.util.schemaHasRules(G,v.RULES.all)){h.schema=G,h.schemaPath=B,h.errSchemaPath=D;var O="key"+P,H="idx"+P,F="i"+P,E="' + "+O+" + '",L=h.dataLevel=v.dataLevel+1,R="data"+L,Z="dataProperties"+P,m=v.opts.ownProperties,x=v.baseId;if(m)Q+=" var "+Z+" = undefined; ";if(m)Q+=" "+Z+" = "+Z+" || Object.keys("+A+"); for (var "+H+"=0; "+H+"<"+Z+".length; "+H+"++) { var "+O+" = "+Z+"["+H+"]; ";else Q+=" for (var "+O+" in "+A+") { ";Q+=" var startErrs"+P+" = errors; ";var y=O,a=v.compositeRule;v.compositeRule=h.compositeRule=!0;var p=v.validate(h);if(h.baseId=x,v.util.varOccurences(p,R)<2)Q+=" "+v.util.varReplace(p,R,y)+" ";else Q+=" var "+R+" = "+y+"; "+p+" ";if(v.compositeRule=h.compositeRule=a,Q+=" if (!"+U+") { for (var "+F+"=startErrs"+P+"; "+F+"<errors; "+F+"++) { vErrors["+F+"].propertyName = "+O+"; } var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'propertyNames' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { propertyName: '"+E+"' } ",v.opts.messages!==!1)Q+=" , message: 'property name \\'"+E+"\\' is invalid' ";if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; ";if(M)Q+=" break; ";Q+=" } }"}if(M)Q+=" "+$+" if ("+N+" == errors) {";return Q}});var JP=Qv((jz,WP)=>{WP.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h=v.opts.$data&&G&&G.$data,$;if(h)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",$="schema"+P;else $=G;var U="schema"+P;if(!h)if(G.length<v.opts.loopRequired&&v.schema.properties&&Object.keys(v.schema.properties).length){var O=[],H=G;if(H){var F,E=-1,L=H.length-1;while(E<L){F=H[E+=1];var R=v.schema.properties[F];if(!(R&&(v.opts.strictKeywords?typeof R=="object"&&Object.keys(R).length>0||R===!1:v.util.schemaHasRules(R,v.RULES.all))))O[O.length]=F}}}else var O=G;if(h||O.length){var Z=v.errorPath,m=h||O.length>=v.opts.loopRequired,x=v.opts.ownProperties;if(M)if(Q+=" var missing"+P+"; ",m){if(!h)Q+=" var "+U+" = validate.schema"+B+"; ";var y="i"+P,a="schema"+P+"["+y+"]",p="' + "+a+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(Z,a,v.opts.jsonPointers);if(Q+=" var "+N+" = true; ",h)Q+=" if (schema"+P+" === undefined) "+N+" = true; else if (!Array.isArray(schema"+P+")) "+N+" = false; else {";if(Q+=" for (var "+y+" = 0; "+y+" < "+U+".length; "+y+"++) { "+N+" = "+A+"["+U+"["+y+"]] !== undefined ",x)Q+=" && Object.prototype.hasOwnProperty.call("+A+", "+U+"["+y+"]) ";if(Q+="; if (!"+N+") break; } ",h)Q+=" } ";Q+=" if (!"+N+") { ";var i=i||[];if(i.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { missingProperty: '"+p+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+p+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var T=Q;if(Q=i.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+T+"]); ";else Q+=" validate.errors = ["+T+"]; return false; ";else Q+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else{Q+=" if ( ";var b=O;if(b){var d,y=-1,Av=b.length-1;while(y<Av){if(d=b[y+=1],y)Q+=" || ";var Bv=v.util.getProperty(d),Kv=A+Bv;if(Q+=" ( ( "+Kv+" === undefined ",x)Q+=" || ! Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(d)+"') ";Q+=") && (missing"+P+" = "+v.util.toQuotedString(v.opts.jsonPointers?d:Bv)+") ) "}}Q+=") { ";var a="missing"+P,p="' + "+a+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.opts.jsonPointers?v.util.getPathExpr(Z,a,!0):Z+" + "+a;var i=i||[];if(i.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { missingProperty: '"+p+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+p+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";var T=Q;if(Q=i.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+T+"]); ";else Q+=" validate.errors = ["+T+"]; return false; ";else Q+=" var err = "+T+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";Q+=" } else { "}else if(m){if(!h)Q+=" var "+U+" = validate.schema"+B+"; ";var y="i"+P,a="schema"+P+"["+y+"]",p="' + "+a+" + '";if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPathExpr(Z,a,v.opts.jsonPointers);if(h){if(Q+=" if ("+U+" && !Array.isArray("+U+")) { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { missingProperty: '"+p+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+p+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if ("+U+" !== undefined) { "}if(Q+=" for (var "+y+" = 0; "+y+" < "+U+".length; "+y+"++) { if ("+A+"["+U+"["+y+"]] === undefined ",x)Q+=" || ! Object.prototype.hasOwnProperty.call("+A+", "+U+"["+y+"]) ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { missingProperty: '"+p+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+p+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } ",h)Q+=" } "}else{var Gv=O;if(Gv){var d,e=-1,Zv=Gv.length-1;while(e<Zv){d=Gv[e+=1];var Bv=v.util.getProperty(d),p=v.util.escapeQuotes(d),Kv=A+Bv;if(v.opts._errorDataPathProperty)v.errorPath=v.util.getPath(Z,d,v.opts.jsonPointers);if(Q+=" if ( "+Kv+" === undefined ",x)Q+=" || ! Object.prototype.hasOwnProperty.call("+A+", '"+v.util.escapeQuotes(d)+"') ";if(Q+=") { var err = ",v.createErrors!==!1){if(Q+=" { keyword: 'required' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { missingProperty: '"+p+"' } ",v.opts.messages!==!1){if(Q+=" , message: '",v.opts._errorDataPathProperty)Q+="is a required property";else Q+="should have required property \\'"+p+"\\'";Q+="' "}if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" ";Q+=" } "}else Q+=" {} ";Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } "}}}v.errorPath=Z}else if(M)Q+=" if (true) {";return Q}});var PP=Qv((Fz,XP)=>{XP.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A="data"+(w||""),N="valid"+P,h=v.opts.$data&&G&&G.$data,$;if(h)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",$="schema"+P;else $=G;if((G||h)&&v.opts.uniqueItems!==!1){if(h)Q+=" var "+N+"; if ("+$+" === false || "+$+" === undefined) "+N+" = true; else if (typeof "+$+" != 'boolean') "+N+" = false; else { ";Q+=" var i = "+A+".length , "+N+" = true , j; if (i > 1) { ";var U=v.schema.items&&v.schema.items.type,O=Array.isArray(U);if(!U||U=="object"||U=="array"||O&&(U.indexOf("object")>=0||U.indexOf("array")>=0))Q+=" outer: for (;i--;) { for (j = i; j--;) { if (equal("+A+"[i], "+A+"[j])) { "+N+" = false; break outer; } } } ";else{Q+=" var itemIndices = {}, item; for (;i--;) { var item = "+A+"[i]; ";var H="checkDataType"+(O?"s":"");if(Q+=" if ("+v.util[H](U,"item",v.opts.strictNumbers,!0)+") continue; ",O)Q+=` if (typeof item == 'string') item = '"' + item; `;Q+=" if (typeof itemIndices[item] == 'number') { "+N+" = false; j = itemIndices[item]; break; } itemIndices[item] = i; } "}if(Q+=" } ",h)Q+=" } ";Q+=" if (!"+N+") { ";var F=F||[];if(F.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: 'uniqueItems' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { i: i, j: j } ",v.opts.messages!==!1)Q+=" , message: 'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)' ";if(v.opts.verbose){if(Q+=" , schema: ",h)Q+="validate.schema"+B;else Q+=""+G;Q+=" , parentSchema: validate.schema"+v.schemaPath+" , data: "+A+" "}Q+=" } "}else Q+=" {} ";var E=Q;if(Q=F.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+E+"]); ";else Q+=" validate.errors = ["+E+"]; return false; ";else Q+=" var err = "+E+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";if(Q+=" } ",M)Q+=" else { "}else if(M)Q+=" if (true) { ";return Q}});var wP=Qv((Lz,YP)=>{YP.exports={$ref:qX(),allOf:EX(),anyOf:UX(),$comment:FX(),const:SX(),contains:RX(),dependencies:kX(),enum:ZX(),format:yX(),if:xX(),items:bX(),maximum:LJ(),minimum:LJ(),maxItems:SJ(),minItems:SJ(),maxLength:gJ(),minLength:gJ(),maxProperties:RJ(),minProperties:RJ(),multipleOf:nX(),not:iX(),oneOf:sX(),pattern:tX(),properties:vP(),propertyNames:QP(),required:JP(),uniqueItems:PP(),validate:jJ()}});var BP=Qv((Sz,zP)=>{var GP=wP(),_J=O0().toHash;zP.exports=function f(){var v=[{type:"number",rules:[{maximum:["exclusiveMaximum"]},{minimum:["exclusiveMinimum"]},"multipleOf","format"]},{type:"string",rules:["maxLength","minLength","pattern","format"]},{type:"array",rules:["maxItems","minItems","items","contains","uniqueItems"]},{type:"object",rules:["maxProperties","minProperties","required","dependencies","propertyNames",{properties:["additionalProperties","patternProperties"]}]},{rules:["$ref","const","enum","not","anyOf","oneOf","allOf","if"]}],W=["type","$comment"],X=["$schema","$id","id","$data","$async","title","description","default","definitions","examples","readOnly","writeOnly","contentMediaType","contentEncoding","additionalItems","then","else"],Q=["number","integer","string","array","object","boolean","null"];return v.all=_J(W),v.types=_J(Q),v.forEach(function(P){if(P.rules=P.rules.map(function(w){var G;if(typeof w=="object"){var B=Object.keys(w)[0];G=w[B],w=B,G.forEach(function(M){W.push(M),v.all[M]=!0})}W.push(w);var D=v.all[w]={keyword:w,code:GP[w],implements:G};return D}),v.all.$comment={keyword:"$comment",code:GP.$comment},P.type)v.types[P.type]=P}),v.keywords=_J(W.concat(X)),v.custom={},v}});var $P=Qv((gz,hP)=>{var KP=["multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","enum","format","const"];hP.exports=function(f,v){for(var W=0;W<v.length;W++){f=JSON.parse(JSON.stringify(f));var X=v[W].split("/"),Q=f,P;for(P=1;P<X.length;P++)Q=Q[X[P]];for(P=0;P<KP.length;P++){var w=KP[P],G=Q[w];if(G)Q[w]={anyOf:[G,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]}}}return f}});var OP=Qv((Rz,MP)=>{var Cw=o8().MissingRef;MP.exports=DP;function DP(f,v,W){var X=this;if(typeof this._opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");if(typeof v=="function")W=v,v=void 0;var Q=P(f).then(function(){var G=X._addSchema(f,void 0,v);return G.validate||w(G)});if(W)Q.then(function(G){W(null,G)},W);return Q;function P(G){var B=G.$schema;return B&&!X.getSchema(B)?DP.call(X,{$ref:B},!0):Promise.resolve()}function w(G){try{return X._compile(G)}catch(D){if(D instanceof Cw)return B(D);throw D}function B(D){var M=D.missingSchema;if(h(M))throw new Error("Schema "+M+" is loaded but "+D.missingRef+" cannot be resolved");var A=X._loadingSchemas[M];if(!A)A=X._loadingSchemas[M]=X._opts.loadSchema(M),A.then(N,N);return A.then(function($){if(!h(M))return P($).then(function(){if(!h(M))X.addSchema($,M,void 0,v)})}).then(function(){return w(G)});function N(){delete X._loadingSchemas[M]}function h($){return X._refs[$]||X._schemas[$]}}}}});var VP=Qv((_z,HP)=>{HP.exports=function f(v,W,X){var Q=" ",P=v.level,w=v.dataLevel,G=v.schema[W],B=v.schemaPath+v.util.getProperty(W),D=v.errSchemaPath+"/"+W,M=!v.opts.allErrors,A,N="data"+(w||""),h="valid"+P,$="errs__"+P,U=v.opts.$data&&G&&G.$data,O;if(U)Q+=" var schema"+P+" = "+v.util.getData(G.$data,w,v.dataPathArr)+"; ",O="schema"+P;else O=G;var H=this,F="definition"+P,E=H.definition,L="",R,Z,m,x,y;if(U&&E.$data){y="keywordValidate"+P;var a=E.validateSchema;Q+=" var "+F+" = RULES.custom['"+W+"'].definition; var "+y+" = "+F+".validate;"}else{if(x=v.useCustomRule(H,G,v.schema,v),!x)return;O="validate.schema"+B,y=x.code,R=E.compile,Z=E.inline,m=E.macro}var p=y+".errors",i="i"+P,T="ruleErr"+P,b=E.async;if(b&&!v.async)throw new Error("async keyword in sync schema");if(!(Z||m))Q+=""+p+" = null;";if(Q+="var "+$+" = errors;var "+h+";",U&&E.$data){if(L+="}",Q+=" if ("+O+" === undefined) { "+h+" = true; } else { ",a)L+="}",Q+=" "+h+" = "+F+".validateSchema("+O+"); if ("+h+") { "}if(Z)if(E.statements)Q+=" "+x.validate+" ";else Q+=" "+h+" = "+x.validate+"; ";else if(m){var d=v.util.copy(v),L="";d.level++;var Av="valid"+d.level;d.schema=x.validate,d.schemaPath="";var Bv=v.compositeRule;v.compositeRule=d.compositeRule=!0;var Kv=v.validate(d).replace(/validate\.schema/g,y);v.compositeRule=d.compositeRule=Bv,Q+=" "+Kv}else{var Gv=Gv||[];if(Gv.push(Q),Q="",Q+=" "+y+".call( ",v.opts.passContext)Q+="this";else Q+="self";if(R||E.schema===!1)Q+=" , "+N+" ";else Q+=" , "+O+" , "+N+" , validate.schema"+v.schemaPath+" ";if(Q+=" , (dataPath || '')",v.errorPath!='""')Q+=" + "+v.errorPath;var e=w?"data"+(w-1||""):"parentData",Zv=w?v.dataPathArr[w]:"parentDataProperty";Q+=" , "+e+" , "+Zv+" , rootData ) ";var sv=Q;if(Q=Gv.pop(),E.errors===!1){if(Q+=" "+h+" = ",b)Q+="await ";Q+=""+sv+"; "}else if(b)p="customErrors"+P,Q+=" var "+p+" = null; try { "+h+" = await "+sv+"; } catch (e) { "+h+" = false; if (e instanceof ValidationError) "+p+" = e.errors; else throw e; } ";else Q+=" "+p+" = null; "+h+" = "+sv+"; "}if(E.modifying)Q+=" if ("+e+") "+N+" = "+e+"["+Zv+"];";if(Q+=""+L,E.valid){if(M)Q+=" if (true) { "}else{if(Q+=" if ( ",E.valid===void 0)if(Q+=" !",m)Q+=""+Av;else Q+=""+h;else Q+=" "+!E.valid+" ";Q+=") { ",A=H.keyword;var Gv=Gv||[];Gv.push(Q),Q="";var Gv=Gv||[];if(Gv.push(Q),Q="",v.createErrors!==!1){if(Q+=" { keyword: '"+(A||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { keyword: '"+H.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+H.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";var vf=Q;if(Q=Gv.pop(),!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(["+vf+"]); ";else Q+=" validate.errors = ["+vf+"]; return false; ";else Q+=" var err = "+vf+"; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ";var Pv=Q;if(Q=Gv.pop(),Z)if(E.errors){if(E.errors!="full"){if(Q+=" for (var "+i+"="+$+"; "+i+"<errors; "+i+"++) { var "+T+" = vErrors["+i+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+T+".schemaPath === undefined) { "+T+'.schemaPath = "'+D+'"; } ',v.opts.verbose)Q+=" "+T+".schema = "+O+"; "+T+".data = "+N+"; ";Q+=" } "}}else if(E.errors===!1)Q+=" "+Pv+" ";else{if(Q+=" if ("+$+" == errors) { "+Pv+" } else { for (var "+i+"="+$+"; "+i+"<errors; "+i+"++) { var "+T+" = vErrors["+i+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+v.errorPath+"; if ("+T+".schemaPath === undefined) { "+T+'.schemaPath = "'+D+'"; } ',v.opts.verbose)Q+=" "+T+".schema = "+O+"; "+T+".data = "+N+"; ";Q+=" } } "}else if(m){if(Q+=" var err = ",v.createErrors!==!1){if(Q+=" { keyword: '"+(A||"custom")+"' , dataPath: (dataPath || '') + "+v.errorPath+" , schemaPath: "+v.util.toQuotedString(D)+" , params: { keyword: '"+H.keyword+"' } ",v.opts.messages!==!1)Q+=` , message: 'should pass "`+H.keyword+`" keyword validation' `;if(v.opts.verbose)Q+=" , schema: validate.schema"+B+" , parentSchema: validate.schema"+v.schemaPath+" , data: "+N+" ";Q+=" } "}else Q+=" {} ";if(Q+="; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ",!v.compositeRule&&M)if(v.async)Q+=" throw new ValidationError(vErrors); ";else Q+=" validate.errors = vErrors; return false; "}else if(E.errors===!1)Q+=" "+Pv+" ";else{if(Q+=" if (Array.isArray("+p+")) { if (vErrors === null) vErrors = "+p+"; else vErrors = vErrors.concat("+p+"); errors = vErrors.length; for (var "+i+"="+$+"; "+i+"<errors; "+i+"++) { var "+T+" = vErrors["+i+"]; if ("+T+".dataPath === undefined) "+T+".dataPath = (dataPath || '') + "+v.errorPath+"; "+T+'.schemaPath = "'+D+'"; ',v.opts.verbose)Q+=" "+T+".schema = "+O+"; "+T+".data = "+N+"; ";Q+=" } } else { "+Pv+" } "}if(Q+=" } ",M)Q+=" else { "}return Q}});var kJ=Qv((kz,yw)=>{yw.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var EP=Qv((Iz,NP)=>{var qP=kJ();NP.exports={$id:"https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js",definitions:{simpleTypes:qP.definitions.simpleTypes},type:"object",dependencies:{schema:["validate"],$data:["validate"],statements:["inline"],valid:{not:{required:["macro"]}}},properties:{type:qP.properties.type,schema:{type:"boolean"},statements:{type:"boolean"},dependencies:{type:"array",items:{type:"string"}},metaSchema:{type:"object"},modifying:{type:"boolean"},valid:{type:"boolean"},$data:{type:"boolean"},async:{type:"boolean"},errors:{anyOf:[{type:"boolean"},{const:"full"}]}}}});var UP=Qv((Zz,AP)=>{var Tw=/^[a-z_$][a-z0-9_$-]*$/i,xw=VP(),lw=EP();AP.exports={add:bw,get:uw,remove:mw,validate:IJ};function bw(f,v){var W=this.RULES;if(W.keywords[f])throw new Error("Keyword "+f+" is already defined");if(!Tw.test(f))throw new Error("Keyword "+f+" is not a valid identifier");if(v){this.validateKeyword(v,!0);var X=v.type;if(Array.isArray(X))for(var Q=0;Q<X.length;Q++)w(f,X[Q],v);else w(f,X,v);var P=v.metaSchema;if(P){if(v.$data&&this._opts.$data)P={anyOf:[P,{$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"}]};v.validateSchema=this.compile(P,!0)}}W.keywords[f]=W.all[f]=!0;function w(G,B,D){var M;for(var A=0;A<W.length;A++){var N=W[A];if(N.type==B){M=N;break}}if(!M)M={type:B,rules:[]},W.push(M);var h={keyword:G,definition:D,custom:!0,code:xw,implements:D.implements};M.rules.push(h),W.custom[G]=h}return this}function uw(f){var v=this.RULES.custom[f];return v?v.definition:this.RULES.keywords[f]||!1}function mw(f){var v=this.RULES;delete v.keywords[f],delete v.all[f],delete v.custom[f];for(var W=0;W<v.length;W++){var X=v[W].rules;for(var Q=0;Q<X.length;Q++)if(X[Q].keyword==f){X.splice(Q,1);break}}return this}function IJ(f,v){IJ.errors=null;var W=this._validateKeyword=this._validateKeyword||this.compile(lw,!0);if(W(f))return!0;if(IJ.errors=W.errors,v)throw new Error("custom keyword definition is invalid: "+this.errorsText(W.errors));else return!1}});var jP=Qv((Cz,rw)=>{rw.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON Schema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var CP=Qv((yz,ZP)=>{var LP=JX(),H0=s8(),aw=PX(),SP=HJ(),cw=UJ(),nw=HX(),pw=BP(),gP=$P(),RP=O0();ZP.exports=av;av.prototype.validate=dw;av.prototype.compile=sw;av.prototype.addSchema=ow;av.prototype.addMetaSchema=tw;av.prototype.validateSchema=ew;av.prototype.getSchema=fG;av.prototype.removeSchema=WG;av.prototype.addFormat=BG;av.prototype.errorsText=zG;av.prototype._addSchema=JG;av.prototype._compile=XG;av.prototype.compileAsync=OP();var XW=UP();av.prototype.addKeyword=XW.add;av.prototype.getKeyword=XW.get;av.prototype.removeKeyword=XW.remove;av.prototype.validateKeyword=XW.validate;var _P=o8();av.ValidationError=_P.Validation;av.MissingRefError=_P.MissingRef;av.$dataMetaSchema=gP;var JW="http://json-schema.org/draft-07/schema",FP=["removeAdditional","useDefaults","coerceTypes","strictDefaults"],iw=["/properties"];function av(f){if(!(this instanceof av))return new av(f);if(f=this._opts=RP.copy(f)||{},OG(this),this._schemas={},this._refs={},this._fragments={},this._formats=nw(f.format),this._cache=f.cache||new aw,this._loadingSchemas={},this._compilations=[],this.RULES=pw(),this._getId=PG(f),f.loopRequired=f.loopRequired||1/0,f.errorDataPath=="property")f._errorDataPathProperty=!0;if(f.serialize===void 0)f.serialize=cw;if(this._metaOpts=MG(this),f.formats)$G(this);if(f.keywords)DG(this);if(KG(this),typeof f.meta=="object")this.addMetaSchema(f.meta);if(f.nullable)this.addKeyword("nullable",{metaSchema:{type:"boolean"}});hG(this)}function dw(f,v){var W;if(typeof f=="string"){if(W=this.getSchema(f),!W)throw new Error('no schema with key or ref "'+f+'"')}else{var X=this._addSchema(f);W=X.validate||this._compile(X)}var Q=W(v);if(W.$async!==!0)this.errors=W.errors;return Q}function sw(f,v){var W=this._addSchema(f,void 0,v);return W.validate||this._compile(W)}function ow(f,v,W,X){if(Array.isArray(f)){for(var Q=0;Q<f.length;Q++)this.addSchema(f[Q],void 0,W,X);return this}var P=this._getId(f);if(P!==void 0&&typeof P!="string")throw new Error("schema id must be string");return v=H0.normalizeId(v||P),IP(this,v),this._schemas[v]=this._addSchema(f,W,X,!0),this}function tw(f,v,W){return this.addSchema(f,v,W,!0),this}function ew(f,v){var W=f.$schema;if(W!==void 0&&typeof W!="string")throw new Error("$schema must be a string");if(W=W||this._opts.defaultMeta||vG(this),!W)return this.logger.warn("meta-schema not available"),this.errors=null,!0;var X=this.validate(W,f);if(!X&&v){var Q="schema is invalid: "+this.errorsText();if(this._opts.validateSchema=="log")this.logger.error(Q);else throw new Error(Q)}return X}function vG(f){var v=f._opts.meta;return f._opts.defaultMeta=typeof v=="object"?f._getId(v)||v:f.getSchema(JW)?JW:void 0,f._opts.defaultMeta}function fG(f){var v=kP(this,f);switch(typeof v){case"object":return v.validate||this._compile(v);case"string":return this.getSchema(v);case"undefined":return QG(this,f)}}function QG(f,v){var W=H0.schema.call(f,{schema:{}},v);if(W){var{schema:X,root:Q,baseId:P}=W,w=LP.call(f,X,Q,void 0,P);return f._fragments[v]=new SP({ref:v,fragment:!0,schema:X,root:Q,baseId:P,validate:w}),w}}function kP(f,v){return v=H0.normalizeId(v),f._schemas[v]||f._refs[v]||f._fragments[v]}function WG(f){if(f instanceof RegExp)return WW(this,this._schemas,f),WW(this,this._refs,f),this;switch(typeof f){case"undefined":return WW(this,this._schemas),WW(this,this._refs),this._cache.clear(),this;case"string":var v=kP(this,f);if(v)this._cache.del(v.cacheKey);return delete this._schemas[f],delete this._refs[f],this;case"object":var W=this._opts.serialize,X=W?W(f):f;this._cache.del(X);var Q=this._getId(f);if(Q)Q=H0.normalizeId(Q),delete this._schemas[Q],delete this._refs[Q]}return this}function WW(f,v,W){for(var X in v){var Q=v[X];if(!Q.meta&&(!W||W.test(X)))f._cache.del(Q.cacheKey),delete v[X]}}function JG(f,v,W,X){if(typeof f!="object"&&typeof f!="boolean")throw new Error("schema should be object or boolean");var Q=this._opts.serialize,P=Q?Q(f):f,w=this._cache.get(P);if(w)return w;X=X||this._opts.addUsedSchema!==!1;var G=H0.normalizeId(this._getId(f));if(G&&X)IP(this,G);var B=this._opts.validateSchema!==!1&&!v,D;if(B&&!(D=G&&G==H0.normalizeId(f.$schema)))this.validateSchema(f,!0);var M=H0.ids.call(this,f),A=new SP({id:G,schema:f,localRefs:M,cacheKey:P,meta:W});if(G[0]!="#"&&X)this._refs[G]=A;if(this._cache.put(P,A),B&&D)this.validateSchema(f,!0);return A}function XG(f,v){if(f.compiling){if(f.validate=Q,Q.schema=f.schema,Q.errors=null,Q.root=v?v:Q,f.schema.$async===!0)Q.$async=!0;return Q}f.compiling=!0;var W;if(f.meta)W=this._opts,this._opts=this._metaOpts;var X;try{X=LP.call(this,f.schema,v,f.localRefs)}catch(P){throw delete f.validate,P}finally{if(f.compiling=!1,f.meta)this._opts=W}return f.validate=X,f.refs=X.refs,f.refVal=X.refVal,f.root=X.root,X;function Q(){var P=f.validate,w=P.apply(this,arguments);return Q.errors=P.errors,w}}function PG(f){switch(f.schemaId){case"auto":return GG;case"id":return YG;default:return wG}}function YG(f){if(f.$id)this.logger.warn("schema $id ignored",f.$id);return f.id}function wG(f){if(f.id)this.logger.warn("schema id ignored",f.id);return f.$id}function GG(f){if(f.$id&&f.id&&f.$id!=f.id)throw new Error("schema $id is different from id");return f.$id||f.id}function zG(f,v){if(f=f||this.errors,!f)return"No errors";v=v||{};var W=v.separator===void 0?", ":v.separator,X=v.dataVar===void 0?"data":v.dataVar,Q="";for(var P=0;P<f.length;P++){var w=f[P];if(w)Q+=X+w.dataPath+" "+w.message+W}return Q.slice(0,-W.length)}function BG(f,v){if(typeof v=="string")v=new RegExp(v);return this._formats[f]=v,this}function KG(f){var v;if(f._opts.$data)v=jP(),f.addMetaSchema(v,v.$id,!0);if(f._opts.meta===!1)return;var W=kJ();if(f._opts.$data)W=gP(W,iw);f.addMetaSchema(W,JW,!0),f._refs["http://json-schema.org/schema"]=JW}function hG(f){var v=f._opts.schemas;if(!v)return;if(Array.isArray(v))f.addSchema(v);else for(var W in v)f.addSchema(v[W],W)}function $G(f){for(var v in f._opts.formats){var W=f._opts.formats[v];f.addFormat(v,W)}}function DG(f){for(var v in f._opts.keywords){var W=f._opts.keywords[v];f.addKeyword(v,W)}}function IP(f,v){if(f._schemas[v]||f._refs[v])throw new Error('schema with key or id "'+v+'" already exists')}function MG(f){var v=RP.copy(f._opts);for(var W=0;W<FP.length;W++)delete v[FP[W]];return v}function OG(f){var v=f._opts.logger;if(v===!1)f.logger={log:ZJ,warn:ZJ,error:ZJ};else{if(v===void 0)v=console;if(!(typeof v=="object"&&v.log&&v.warn&&v.error))throw new Error("logger must implement log, warn and error methods");f.logger=v}}function ZJ(){}});function OY(f,v){let W=process.argv,X=`--${f}=`;for(let Q of W)if(Q.startsWith(X))return Q.substring(X.length);return v}function RG(){let f=process.argv.join(" ");return f.includes("streamable-http.js")||f.includes("streamable-http.ts")}class VY{context;level;constructor(f,v=1){this.context=f,this.level=v}setLevel(f){this.level=f}log(...f){if(HY)console.log(...f);else console.error(...f)}logWarn(...f){if(HY)console.warn(...f);else console.error(...f)}debug(...f){if(this.level<=0)this.log(`[DEBUG] [${this.context}]`,...f)}info(...f){if(this.level<=1)this.log(`[INFO] [${this.context}]`,...f)}warn(...f){if(this.level<=2)this.logWarn(`[WARN] [${this.context}]`,...f)}error(...f){if(this.level<=3)console.error(`[ERROR] [${this.context}]`,...f)}}var HY,xf=(f,v=1)=>new VY(f,v);var V0=jv(()=>{HY=RG()});class qY{serverName="F2C MCP";serverVersion=process.env.FIGMA_VERSION||"0.0.1";_personalToken=OY("figma-api-key")||process.env.FIGMA_API_KEY||process.env.personalToken||"";get personalToken(){return this._personalToken}set personalToken(f){this._personalToken=f,kG.debug("personalToken",f)}}var kG,g1;var KW=jv(()=>{V0();kG=xf("FigmaConfig",1);g1=new qY});function IG(f){if(!/^data:/i.test(f))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');f=f.replace(/\r?\n/g,"");let v=f.indexOf(",");if(v===-1||v<=4)throw new TypeError("malformed data: URI");let W=f.substring(5,v).split(";"),X="",Q=!1,P=W[0]||"text/plain",w=P;for(let M=1;M<W.length;M++)if(W[M]==="base64")Q=!0;else if(W[M]){if(w+=`;${W[M]}`,W[M].indexOf("charset=")===0)X=W[M].substring(8)}if(!W[0]&&!X.length)w+=";charset=US-ASCII",X="US-ASCII";let G=Q?"base64":"ascii",B=unescape(f.substring(v+1)),D=Buffer.from(B,G);return D.type=P,D.typeFull=w,D.charset=X,D}var AY;var UY=jv(()=>{AY=IG});var FY=Qv((hW,jY)=>{(function(f,v){typeof hW==="object"&&typeof jY!=="undefined"?v(hW):typeof define==="function"&&define.amd?define(["exports"],v):(f=typeof globalThis!=="undefined"?globalThis:f||self,v(f.WebStreamsPolyfill={}))})(hW,function(f){function v(){return}function W(J){return typeof J==="object"&&J!==null||typeof J==="function"}let X=v;function Q(J,Y){try{Object.defineProperty(J,"name",{value:Y,configurable:!0})}catch(z){}}let P=Promise,w=Promise.prototype.then,G=Promise.reject.bind(P);function B(J){return new P(J)}function D(J){return B((Y)=>Y(J))}function M(J){return G(J)}function A(J,Y,z){return w.call(J,Y,z)}function N(J,Y,z){A(A(J,Y,z),void 0,X)}function h(J,Y){N(J,Y)}function $(J,Y){N(J,void 0,Y)}function U(J,Y,z){return A(J,Y,z)}function O(J){A(J,void 0,X)}let H=(J)=>{if(typeof queueMicrotask==="function")H=queueMicrotask;else{let Y=D(void 0);H=(z)=>A(Y,z)}return H(J)};function F(J,Y,z){if(typeof J!=="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(J,Y,z)}function E(J,Y,z){try{return D(F(J,Y,z))}catch(q){return M(q)}}let L=16384;class R{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(J){let Y=this._back,z=Y;if(Y._elements.length===L-1)z={_elements:[],_next:void 0};if(Y._elements.push(J),z!==Y)this._back=z,Y._next=z;++this._size}shift(){let J=this._front,Y=J,z=this._cursor,q=z+1,g=J._elements,k=g[z];if(q===L)Y=J._next,q=0;if(--this._size,this._cursor=q,J!==Y)this._front=Y;return g[z]=void 0,k}forEach(J){let Y=this._cursor,z=this._front,q=z._elements;while(Y!==q.length||z._next!==void 0){if(Y===q.length){if(z=z._next,q=z._elements,Y=0,q.length===0)break}J(q[Y]),++Y}}peek(){let J=this._front,Y=this._cursor;return J._elements[Y]}}let Z=Symbol("[[AbortSteps]]"),m=Symbol("[[ErrorSteps]]"),x=Symbol("[[CancelSteps]]"),y=Symbol("[[PullSteps]]"),a=Symbol("[[ReleaseSteps]]");function p(J,Y){if(J._ownerReadableStream=Y,Y._reader=J,Y._state==="readable")d(J);else if(Y._state==="closed")Bv(J);else Av(J,Y._storedError)}function i(J,Y){let z=J._ownerReadableStream;return af(z,Y)}function T(J){let Y=J._ownerReadableStream;if(Y._state==="readable")Kv(J,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));else Gv(J,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness"));Y._readableStreamController[a](),Y._reader=void 0,J._ownerReadableStream=void 0}function b(J){return new TypeError("Cannot "+J+" a stream using a released reader")}function d(J){J._closedPromise=B((Y,z)=>{J._closedPromise_resolve=Y,J._closedPromise_reject=z})}function Av(J,Y){d(J),Kv(J,Y)}function Bv(J){d(J),e(J)}function Kv(J,Y){if(J._closedPromise_reject===void 0)return;O(J._closedPromise),J._closedPromise_reject(Y),J._closedPromise_resolve=void 0,J._closedPromise_reject=void 0}function Gv(J,Y){Av(J,Y)}function e(J){if(J._closedPromise_resolve===void 0)return;J._closedPromise_resolve(void 0),J._closedPromise_resolve=void 0,J._closedPromise_reject=void 0}let Zv=Number.isFinite||function(J){return typeof J==="number"&&isFinite(J)},sv=Math.trunc||function(J){return J<0?Math.ceil(J):Math.floor(J)};function vf(J){return typeof J==="object"||typeof J==="function"}function Pv(J,Y){if(J!==void 0&&!vf(J))throw new TypeError(`${Y} is not an object.`)}function Ev(J,Y){if(typeof J!=="function")throw new TypeError(`${Y} is not a function.`)}function nv(J){return typeof J==="object"&&J!==null||typeof J==="function"}function ov(J,Y){if(!nv(J))throw new TypeError(`${Y} is not an object.`)}function tv(J,Y,z){if(J===void 0)throw new TypeError(`Parameter ${Y} is required in '${z}'.`)}function Uf(J,Y,z){if(J===void 0)throw new TypeError(`${Y} is required in '${z}'.`)}function xv(J){return Number(J)}function Cv(J){return J===0?0:J}function M1(J){return Cv(sv(J))}function pv(J,Y){let q=Number.MAX_SAFE_INTEGER,g=Number(J);if(g=Cv(g),!Zv(g))throw new TypeError(`${Y} is not a finite number`);if(g=M1(g),g<0||g>q)throw new TypeError(`${Y} is outside the accepted range of 0 to ${q}, inclusive`);if(!Zv(g)||g===0)return 0;return g}function Vv(J,Y){if(!x1(J))throw new TypeError(`${Y} is not a ReadableStream.`)}function Bf(J){return new rv(J)}function Sf(J,Y){J._reader._readRequests.push(Y)}function bf(J,Y,z){let g=J._reader._readRequests.shift();if(z)g._closeSteps();else g._chunkSteps(Y)}function gf(J){return J._reader._readRequests.length}function iv(J){let Y=J._reader;if(Y===void 0)return!1;if(!bv(Y))return!1;return!0}class rv{constructor(J){if(tv(J,1,"ReadableStreamDefaultReader"),Vv(J,"First parameter"),l1(J))throw new TypeError("This stream has already been locked for exclusive reading by another reader");p(this,J),this._readRequests=new R}get closed(){if(!bv(this))return M(O1("closed"));return this._closedPromise}cancel(J=void 0){if(!bv(this))return M(O1("cancel"));if(this._ownerReadableStream===void 0)return M(b("cancel"));return i(this,J)}read(){if(!bv(this))return M(O1("read"));if(this._ownerReadableStream===void 0)return M(b("read from"));let J,Y,z=B((g,k)=>{J=g,Y=k});return cv(this,{_chunkSteps:(g)=>J({value:g,done:!1}),_closeSteps:()=>J({value:void 0,done:!0}),_errorSteps:(g)=>Y(g)}),z}releaseLock(){if(!bv(this))throw O1("releaseLock");if(this._ownerReadableStream===void 0)return;Rf(this)}}if(Object.defineProperties(rv.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),Q(rv.prototype.cancel,"cancel"),Q(rv.prototype.read,"read"),Q(rv.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(rv.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function bv(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_readRequests"))return!1;return J instanceof rv}function cv(J,Y){let z=J._ownerReadableStream;if(z._disturbed=!0,z._state==="closed")Y._closeSteps();else if(z._state==="errored")Y._errorSteps(z._storedError);else z._readableStreamController[y](Y)}function Rf(J){T(J);let Y=new TypeError("Reader was released");Jf(J,Y)}function Jf(J,Y){let z=J._readRequests;J._readRequests=new R,z.forEach((q)=>{q._errorSteps(Y)})}function O1(J){return new TypeError(`ReadableStreamDefaultReader.prototype.${J} can only be used on a ReadableStreamDefaultReader`)}let XQ=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class Kf{constructor(J,Y){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=J,this._preventCancel=Y}next(){let J=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?U(this._ongoingPromise,J,J):J(),this._ongoingPromise}return(J){let Y=()=>this._returnSteps(J);return this._ongoingPromise?U(this._ongoingPromise,Y,Y):Y()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});let J=this._reader,Y,z,q=B((k,C)=>{Y=k,z=C});return cv(J,{_chunkSteps:(k)=>{this._ongoingPromise=void 0,H(()=>Y({value:k,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,T(J),Y({value:void 0,done:!0})},_errorSteps:(k)=>{this._ongoingPromise=void 0,this._isFinished=!0,T(J),z(k)}}),q}_returnSteps(J){if(this._isFinished)return Promise.resolve({value:J,done:!0});this._isFinished=!0;let Y=this._reader;if(!this._preventCancel){let z=i(Y,J);return T(Y),U(z,()=>({value:J,done:!0}))}return T(Y),D({value:J,done:!0})}}let k1={next(){if(!PQ(this))return M(I1("next"));return this._asyncIteratorImpl.next()},return(J){if(!PQ(this))return M(I1("return"));return this._asyncIteratorImpl.return(J)}};Object.setPrototypeOf(k1,XQ);function nQ(J,Y){let z=Bf(J),q=new Kf(z,Y),g=Object.create(k1);return g._asyncIteratorImpl=q,g}function PQ(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_asyncIteratorImpl"))return!1;try{return J._asyncIteratorImpl instanceof Kf}catch(Y){return!1}}function I1(J){return new TypeError(`ReadableStreamAsyncIterator.${J} can only be used on a ReadableSteamAsyncIterator`)}let YQ=Number.isNaN||function(J){return J!==J};var wQ,GQ,U0;function Xf(J){return J.slice()}function pQ(J,Y,z,q,g){new Uint8Array(J).set(new Uint8Array(z,q,g),Y)}let uf=(J)=>{if(typeof J.transfer==="function")uf=(Y)=>Y.transfer();else if(typeof structuredClone==="function")uf=(Y)=>structuredClone(Y,{transfer:[Y]});else uf=(Y)=>Y;return uf(J)},Q1=(J)=>{if(typeof J.detached==="boolean")Q1=(Y)=>Y.detached;else Q1=(Y)=>Y.byteLength===0;return Q1(J)};function iQ(J,Y,z){if(J.slice)return J.slice(Y,z);let q=z-Y,g=new ArrayBuffer(q);return pQ(g,0,J,Y,q),g}function j0(J,Y){let z=J[Y];if(z===void 0||z===null)return;if(typeof z!=="function")throw new TypeError(`${String(Y)} is not a function`);return z}function LW(J){let Y={[Symbol.iterator]:()=>J.iterator},z=async function*(){return yield*Y}(),q=z.next;return{iterator:z,nextMethod:q,done:!1}}let W1=(U0=(wQ=Symbol.asyncIterator)!==null&&wQ!==void 0?wQ:(GQ=Symbol.for)===null||GQ===void 0?void 0:GQ.call(Symbol,"Symbol.asyncIterator"))!==null&&U0!==void 0?U0:"@@asyncIterator";function dQ(J,Y="sync",z){if(z===void 0)if(Y==="async"){if(z=j0(J,W1),z===void 0){let k=j0(J,Symbol.iterator),C=dQ(J,"sync",k);return LW(C)}}else z=j0(J,Symbol.iterator);if(z===void 0)throw new TypeError("The object is not iterable");let q=F(z,J,[]);if(!W(q))throw new TypeError("The iterator method must return an object");let g=q.next;return{iterator:q,nextMethod:g,done:!1}}function sQ(J){let Y=F(J.nextMethod,J.iterator,[]);if(!W(Y))throw new TypeError("The iterator.next() method must return an object");return Y}function SW(J){return Boolean(J.done)}function zQ(J){return J.value}function oQ(J){if(typeof J!=="number")return!1;if(YQ(J))return!1;if(J<0)return!1;return!0}function tQ(J){let Y=iQ(J.buffer,J.byteOffset,J.byteOffset+J.byteLength);return new Uint8Array(Y)}function F0(J){let Y=J._queue.shift();if(J._queueTotalSize-=Y.size,J._queueTotalSize<0)J._queueTotalSize=0;return Y.value}function BQ(J,Y,z){if(!oQ(z)||z===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");J._queue.push({value:Y,size:z}),J._queueTotalSize+=z}function eQ(J){return J._queue.peek().value}function j(J){J._queue=new R,J._queueTotalSize=0}function V(J){return J===DataView}function S(J){return V(J.constructor)}function I(J){if(V(J))return 1;return J.BYTES_PER_ELEMENT}class _{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!Dv(this))throw V1("view");return this._view}respond(J){if(!Dv(this))throw V1("respond");if(tv(J,1,"respond"),J=pv(J,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(Q1(this._view.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be used as a response");If(this._associatedReadableByteStreamController,J)}respondWithNewView(J){if(!Dv(this))throw V1("respondWithNewView");if(tv(J,1,"respondWithNewView"),!ArrayBuffer.isView(J))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");if(Q1(J.buffer))throw new TypeError("The given view's buffer has been detached and so cannot be used as a response");S0(this._associatedReadableByteStreamController,J)}}if(Object.defineProperties(_.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),Q(_.prototype.respond,"respond"),Q(_.prototype.respondWithNewView,"respondWithNewView"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(_.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class c{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Wv(this))throw Z1("byobRequest");return Y1(this)}get desiredSize(){if(!Wv(this))throw Z1("desiredSize");return L0(this)}close(){if(!Wv(this))throw Z1("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");let J=this._controlledReadableByteStream._state;if(J!=="readable")throw new TypeError(`The stream (in ${J} state) is not in the readable state and cannot be closed`);P1(this)}enqueue(J){if(!Wv(this))throw Z1("enqueue");if(tv(J,1,"enqueue"),!ArrayBuffer.isView(J))throw new TypeError("chunk must be an array buffer view");if(J.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(J.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");let Y=this._controlledReadableByteStream._state;if(Y!=="readable")throw new TypeError(`The stream (in ${Y} state) is not in the readable state and cannot be enqueued to`);mf(this,J)}error(J=void 0){if(!Wv(this))throw Z1("error");dv(this,J)}[x](J){uv(this),j(this);let Y=this._cancelAlgorithm(J);return H1(this),Y}[y](J){let Y=this._controlledReadableByteStream;if(this._queueTotalSize>0){kf(this,J);return}let z=this._autoAllocateChunkSize;if(z!==void 0){let q;try{q=new ArrayBuffer(z)}catch(k){J._errorSteps(k);return}let g={buffer:q,bufferByteLength:z,byteOffset:0,byteLength:z,bytesFilled:0,minimumFill:1,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(g)}Sf(Y,J),hv(this)}[a](){if(this._pendingPullIntos.length>0){let J=this._pendingPullIntos.peek();J.readerType="none",this._pendingPullIntos=new R,this._pendingPullIntos.push(J)}}}if(Object.defineProperties(c.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),Q(c.prototype.close,"close"),Q(c.prototype.enqueue,"enqueue"),Q(c.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(c.prototype,Symbol.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Wv(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_controlledReadableByteStream"))return!1;return J instanceof c}function Dv(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_associatedReadableByteStreamController"))return!1;return J instanceof _}function hv(J){if(!Q0(J))return;if(J._pulling){J._pullAgain=!0;return}J._pulling=!0;let z=J._pullAlgorithm();N(z,()=>{if(J._pulling=!1,J._pullAgain)J._pullAgain=!1,hv(J);return null},(q)=>{return dv(J,q),null})}function uv(J){ff(J),J._pendingPullIntos=new R}function $v(J,Y){let z=!1;if(J._state==="closed")z=!0;let q=gv(Y);if(Y.readerType==="default")bf(J,q,z);else C1(J,q,z)}function gv(J){let{bytesFilled:Y,elementSize:z}=J;return new J.viewConstructor(J.buffer,J.byteOffset,Y/z)}function yv(J,Y,z,q){J._queue.push({buffer:Y,byteOffset:z,byteLength:q}),J._queueTotalSize+=q}function Lv(J,Y,z,q){let g;try{g=iQ(Y,z,z+q)}catch(k){throw dv(J,k),k}yv(J,g,0,q)}function qv(J,Y){if(Y.bytesFilled>0)Lv(J,Y.buffer,Y.byteOffset,Y.bytesFilled);Yf(J)}function Rv(J,Y){let z=Math.min(J._queueTotalSize,Y.byteLength-Y.bytesFilled),q=Y.bytesFilled+z,g=z,k=!1,C=q%Y.elementSize,s=q-C;if(s>=Y.minimumFill)g=s-Y.bytesFilled,k=!0;let t=J._queue;while(g>0){let Xv=t.peek(),Yv=Math.min(g,Xv.byteLength),Mv=Y.byteOffset+Y.bytesFilled;if(pQ(Y.buffer,Mv,Xv.buffer,Xv.byteOffset,Yv),Xv.byteLength===Yv)t.shift();else Xv.byteOffset+=Yv,Xv.byteLength-=Yv;J._queueTotalSize-=Yv,Uv(J,Yv,Y),g-=Yv}return k}function Uv(J,Y,z){z.bytesFilled+=Y}function J1(J){if(J._queueTotalSize===0&&J._closeRequested)H1(J),HQ(J._controlledReadableByteStream);else hv(J)}function ff(J){if(J._byobRequest===null)return;J._byobRequest._associatedReadableByteStreamController=void 0,J._byobRequest._view=null,J._byobRequest=null}function Pf(J){while(J._pendingPullIntos.length>0){if(J._queueTotalSize===0)return;let Y=J._pendingPullIntos.peek();if(Rv(J,Y))Yf(J),$v(J._controlledReadableByteStream,Y)}}function Fv(J){let Y=J._controlledReadableByteStream._reader;while(Y._readRequests.length>0){if(J._queueTotalSize===0)return;let z=Y._readRequests.shift();kf(J,z)}}function hf(J,Y,z,q){let g=J._controlledReadableByteStream,k=Y.constructor,C=I(k),{byteOffset:s,byteLength:t}=Y,Xv=z*C,Yv;try{Yv=uf(Y.buffer)}catch(Sv){q._errorSteps(Sv);return}let Mv={buffer:Yv,bufferByteLength:Yv.byteLength,byteOffset:s,byteLength:t,bytesFilled:0,minimumFill:Xv,elementSize:C,viewConstructor:k,readerType:"byob"};if(J._pendingPullIntos.length>0){J._pendingPullIntos.push(Mv),Zf(g,q);return}if(g._state==="closed"){let Sv=new k(Mv.buffer,Mv.byteOffset,0);q._closeSteps(Sv);return}if(J._queueTotalSize>0){if(Rv(J,Mv)){let Sv=gv(Mv);J1(J),q._chunkSteps(Sv);return}if(J._closeRequested){let Sv=new TypeError("Insufficient bytes to fill elements in the given buffer");dv(J,Sv),q._errorSteps(Sv);return}}J._pendingPullIntos.push(Mv),Zf(g,q),hv(J)}function Mf(J,Y){if(Y.readerType==="none")Yf(J);let z=J._controlledReadableByteStream;if(y1(z))while(g0(z)>0){let q=Yf(J);$v(z,q)}}function _f(J,Y,z){if(Uv(J,Y,z),z.readerType==="none"){qv(J,z),Pf(J);return}if(z.bytesFilled<z.minimumFill)return;Yf(J);let q=z.bytesFilled%z.elementSize;if(q>0){let g=z.byteOffset+z.bytesFilled;Lv(J,z.buffer,g-q,q)}z.bytesFilled-=q,$v(J._controlledReadableByteStream,z),Pf(J)}function X1(J,Y){let z=J._pendingPullIntos.peek();if(ff(J),J._controlledReadableByteStream._state==="closed")Mf(J,z);else _f(J,Y,z);hv(J)}function Yf(J){return J._pendingPullIntos.shift()}function Q0(J){let Y=J._controlledReadableByteStream;if(Y._state!=="readable")return!1;if(J._closeRequested)return!1;if(!J._started)return!1;if(iv(Y)&&gf(Y)>0)return!0;if(y1(Y)&&g0(Y)>0)return!0;if(L0(J)>0)return!0;return!1}function H1(J){J._pullAlgorithm=void 0,J._cancelAlgorithm=void 0}function P1(J){let Y=J._controlledReadableByteStream;if(J._closeRequested||Y._state!=="readable")return;if(J._queueTotalSize>0){J._closeRequested=!0;return}if(J._pendingPullIntos.length>0){let z=J._pendingPullIntos.peek();if(z.bytesFilled%z.elementSize!==0){let q=new TypeError("Insufficient bytes to fill elements in the given buffer");throw dv(J,q),q}}H1(J),HQ(Y)}function mf(J,Y){let z=J._controlledReadableByteStream;if(J._closeRequested||z._state!=="readable")return;let{buffer:q,byteOffset:g,byteLength:k}=Y;if(Q1(q))throw new TypeError("chunk's buffer is detached and so cannot be enqueued");let C=uf(q);if(J._pendingPullIntos.length>0){let s=J._pendingPullIntos.peek();if(Q1(s.buffer))throw new TypeError("The BYOB request's buffer has been detached and so cannot be filled with an enqueued chunk");if(ff(J),s.buffer=uf(s.buffer),s.readerType==="none")qv(J,s)}if(iv(z))if(Fv(J),gf(z)===0)yv(J,C,g,k);else{if(J._pendingPullIntos.length>0)Yf(J);let s=new Uint8Array(C,g,k);bf(z,s,!1)}else if(y1(z))yv(J,C,g,k),Pf(J);else yv(J,C,g,k);hv(J)}function dv(J,Y){let z=J._controlledReadableByteStream;if(z._state!=="readable")return;uv(J),j(J),H1(J),x9(z,Y)}function kf(J,Y){let z=J._queue.shift();J._queueTotalSize-=z.byteLength,J1(J);let q=new Uint8Array(z.buffer,z.byteOffset,z.byteLength);Y._chunkSteps(q)}function Y1(J){if(J._byobRequest===null&&J._pendingPullIntos.length>0){let Y=J._pendingPullIntos.peek(),z=new Uint8Array(Y.buffer,Y.byteOffset+Y.bytesFilled,Y.byteLength-Y.bytesFilled),q=Object.create(_.prototype);W0(q,J,z),J._byobRequest=q}return J._byobRequest}function L0(J){let Y=J._controlledReadableByteStream._state;if(Y==="errored")return null;if(Y==="closed")return 0;return J._strategyHWM-J._queueTotalSize}function If(J,Y){let z=J._pendingPullIntos.peek();if(J._controlledReadableByteStream._state==="closed"){if(Y!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(Y===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(z.bytesFilled+Y>z.byteLength)throw new RangeError("bytesWritten out of range")}z.buffer=uf(z.buffer),X1(J,Y)}function S0(J,Y){let z=J._pendingPullIntos.peek();if(J._controlledReadableByteStream._state==="closed"){if(Y.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(Y.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(z.byteOffset+z.bytesFilled!==Y.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(z.bufferByteLength!==Y.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(z.bytesFilled+Y.byteLength>z.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");let g=Y.byteLength;z.buffer=uf(Y.buffer),X1(J,g)}function v8(J,Y,z,q,g,k,C){Y._controlledReadableByteStream=J,Y._pullAgain=!1,Y._pulling=!1,Y._byobRequest=null,Y._queue=Y._queueTotalSize=void 0,j(Y),Y._closeRequested=!1,Y._started=!1,Y._strategyHWM=k,Y._pullAlgorithm=q,Y._cancelAlgorithm=g,Y._autoAllocateChunkSize=C,Y._pendingPullIntos=new R,J._readableStreamController=Y;let s=z();N(D(s),()=>{return Y._started=!0,hv(Y),null},(t)=>{return dv(Y,t),null})}function f8(J,Y,z){let q=Object.create(c.prototype),g,k,C;if(Y.start!==void 0)g=()=>Y.start(q);else g=()=>{return};if(Y.pull!==void 0)k=()=>Y.pull(q);else k=()=>D(void 0);if(Y.cancel!==void 0)C=(t)=>Y.cancel(t);else C=()=>D(void 0);let s=Y.autoAllocateChunkSize;if(s===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");v8(J,q,g,k,C,z,s)}function W0(J,Y,z){J._associatedReadableByteStreamController=Y,J._view=z}function V1(J){return new TypeError(`ReadableStreamBYOBRequest.prototype.${J} can only be used on a ReadableStreamBYOBRequest`)}function Z1(J){return new TypeError(`ReadableByteStreamController.prototype.${J} can only be used on a ReadableByteStreamController`)}function J0(J,Y){Pv(J,Y);let z=J===null||J===void 0?void 0:J.mode;return{mode:z===void 0?void 0:gW(z,`${Y} has member 'mode' that`)}}function gW(J,Y){if(J=`${J}`,J!=="byob")throw new TypeError(`${Y} '${J}' is not a valid enumeration value for ReadableStreamReaderMode`);return J}function Q8(J,Y){var z;Pv(J,Y);let q=(z=J===null||J===void 0?void 0:J.min)!==null&&z!==void 0?z:1;return{min:pv(q,`${Y} has member 'min' that`)}}function W8(J){return new wf(J)}function Zf(J,Y){J._reader._readIntoRequests.push(Y)}function C1(J,Y,z){let g=J._reader._readIntoRequests.shift();if(z)g._closeSteps(Y);else g._chunkSteps(Y)}function g0(J){return J._reader._readIntoRequests.length}function y1(J){let Y=J._reader;if(Y===void 0)return!1;if(!T1(Y))return!1;return!0}class wf{constructor(J){if(tv(J,1,"ReadableStreamBYOBReader"),Vv(J,"First parameter"),l1(J))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Wv(J._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");p(this,J),this._readIntoRequests=new R}get closed(){if(!T1(this))return M(R0("closed"));return this._closedPromise}cancel(J=void 0){if(!T1(this))return M(R0("cancel"));if(this._ownerReadableStream===void 0)return M(b("cancel"));return i(this,J)}read(J,Y={}){if(!T1(this))return M(R0("read"));if(!ArrayBuffer.isView(J))return M(new TypeError("view must be an array buffer view"));if(J.byteLength===0)return M(new TypeError("view must have non-zero byteLength"));if(J.buffer.byteLength===0)return M(new TypeError("view's buffer must have non-zero byteLength"));if(Q1(J.buffer))return M(new TypeError("view's buffer has been detached"));let z;try{z=Q8(Y,"options")}catch(t){return M(t)}let q=z.min;if(q===0)return M(new TypeError("options.min must be greater than 0"));if(!S(J)){if(q>J.length)return M(new RangeError("options.min must be less than or equal to view's length"))}else if(q>J.byteLength)return M(new RangeError("options.min must be less than or equal to view's byteLength"));if(this._ownerReadableStream===void 0)return M(b("read from"));let g,k,C=B((t,Xv)=>{g=t,k=Xv});return q1(this,J,q,{_chunkSteps:(t)=>g({value:t,done:!1}),_closeSteps:(t)=>g({value:t,done:!0}),_errorSteps:(t)=>k(t)}),C}releaseLock(){if(!T1(this))throw R0("releaseLock");if(this._ownerReadableStream===void 0)return;X0(this)}}if(Object.defineProperties(wf.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),Q(wf.prototype.cancel,"cancel"),Q(wf.prototype.read,"read"),Q(wf.prototype.releaseLock,"releaseLock"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(wf.prototype,Symbol.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function T1(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_readIntoRequests"))return!1;return J instanceof wf}function q1(J,Y,z,q){let g=J._ownerReadableStream;if(g._disturbed=!0,g._state==="errored")q._errorSteps(g._storedError);else hf(g._readableStreamController,Y,z,q)}function X0(J){T(J);let Y=new TypeError("Reader was released");KQ(J,Y)}function KQ(J,Y){let z=J._readIntoRequests;J._readIntoRequests=new R,z.forEach((q)=>{q._errorSteps(Y)})}function R0(J){return new TypeError(`ReadableStreamBYOBReader.prototype.${J} can only be used on a ReadableStreamBYOBReader`)}function P0(J,Y){let{highWaterMark:z}=J;if(z===void 0)return Y;if(YQ(z)||z<0)throw new RangeError("Invalid highWaterMark");return z}function _0(J){let{size:Y}=J;if(!Y)return()=>1;return Y}function hQ(J,Y){Pv(J,Y);let z=J===null||J===void 0?void 0:J.highWaterMark,q=J===null||J===void 0?void 0:J.size;return{highWaterMark:z===void 0?void 0:xv(z),size:q===void 0?void 0:B9(q,`${Y} has member 'size' that`)}}function B9(J,Y){return Ev(J,Y),(z)=>xv(J(z))}function K9(J,Y){Pv(J,Y);let z=J===null||J===void 0?void 0:J.abort,q=J===null||J===void 0?void 0:J.close,g=J===null||J===void 0?void 0:J.start,k=J===null||J===void 0?void 0:J.type,C=J===null||J===void 0?void 0:J.write;return{abort:z===void 0?void 0:h9(z,J,`${Y} has member 'abort' that`),close:q===void 0?void 0:$9(q,J,`${Y} has member 'close' that`),start:g===void 0?void 0:D9(g,J,`${Y} has member 'start' that`),write:C===void 0?void 0:M9(C,J,`${Y} has member 'write' that`),type:k}}function h9(J,Y,z){return Ev(J,z),(q)=>E(J,Y,[q])}function $9(J,Y,z){return Ev(J,z),()=>E(J,Y,[])}function D9(J,Y,z){return Ev(J,z),(q)=>F(J,Y,[q])}function M9(J,Y,z){return Ev(J,z),(q,g)=>E(J,Y,[q,g])}function O9(J,Y){if(!k0(J))throw new TypeError(`${Y} is not a WritableStream.`)}function L4(J){if(typeof J!=="object"||J===null)return!1;try{return typeof J.aborted==="boolean"}catch(Y){return!1}}let S4=typeof AbortController==="function";function g4(){if(S4)return new AbortController;return}class N1{constructor(J={},Y={}){if(J===void 0)J=null;else ov(J,"First parameter");let z=hQ(Y,"Second parameter"),q=K9(J,"First parameter");if(V9(this),q.type!==void 0)throw new RangeError("Invalid type is specified");let k=_0(z),C=P0(z,1);r4(this,q,C,k)}get locked(){if(!k0(this))throw w8("locked");return I0(this)}abort(J=void 0){if(!k0(this))return M(w8("abort"));if(I0(this))return M(new TypeError("Cannot abort a stream that already has a writer"));return J8(this,J)}close(){if(!k0(this))return M(w8("close"));if(I0(this))return M(new TypeError("Cannot close a stream that already has a writer"));if(w1(this))return M(new TypeError("Cannot close an already-closing stream"));return q9(this)}getWriter(){if(!k0(this))throw w8("getWriter");return H9(this)}}if(Object.defineProperties(N1.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),Q(N1.prototype.abort,"abort"),Q(N1.prototype.close,"close"),Q(N1.prototype.getWriter,"getWriter"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(N1.prototype,Symbol.toStringTag,{value:"WritableStream",configurable:!0});function H9(J){return new G1(J)}function R4(J,Y,z,q,g=1,k=()=>1){let C=Object.create(N1.prototype);V9(C);let s=Object.create(w0.prototype);return F9(C,s,J,Y,z,q,g,k),C}function V9(J){J._state="writable",J._storedError=void 0,J._writer=void 0,J._writableStreamController=void 0,J._writeRequests=new R,J._inFlightWriteRequest=void 0,J._closeRequest=void 0,J._inFlightCloseRequest=void 0,J._pendingAbortRequest=void 0,J._backpressure=!1}function k0(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_writableStreamController"))return!1;return J instanceof N1}function I0(J){if(J._writer===void 0)return!1;return!0}function J8(J,Y){var z;if(J._state==="closed"||J._state==="errored")return D(void 0);J._writableStreamController._abortReason=Y,(z=J._writableStreamController._abortController)===null||z===void 0||z.abort(Y);let q=J._state;if(q==="closed"||q==="errored")return D(void 0);if(J._pendingAbortRequest!==void 0)return J._pendingAbortRequest._promise;let g=!1;if(q==="erroring")g=!0,Y=void 0;let k=B((C,s)=>{J._pendingAbortRequest={_promise:void 0,_resolve:C,_reject:s,_reason:Y,_wasAlreadyErroring:g}});if(J._pendingAbortRequest._promise=k,!g)_W(J,Y);return k}function q9(J){let Y=J._state;if(Y==="closed"||Y==="errored")return M(new TypeError(`The stream (in ${Y} state) is not in the writable state and cannot be closed`));let z=B((g,k)=>{let C={_resolve:g,_reject:k};J._closeRequest=C}),q=J._writer;if(q!==void 0&&J._backpressure&&Y==="writable")lW(q);return a4(J._writableStreamController),z}function _4(J){return B((z,q)=>{let g={_resolve:z,_reject:q};J._writeRequests.push(g)})}function RW(J,Y){if(J._state==="writable"){_W(J,Y);return}kW(J)}function _W(J,Y){let z=J._writableStreamController;J._state="erroring",J._storedError=Y;let q=J._writer;if(q!==void 0)E9(q,Y);if(!y4(J)&&z._started)kW(J)}function kW(J){J._state="errored",J._writableStreamController[m]();let Y=J._storedError;if(J._writeRequests.forEach((g)=>{g._reject(Y)}),J._writeRequests=new R,J._pendingAbortRequest===void 0){X8(J);return}let z=J._pendingAbortRequest;if(J._pendingAbortRequest=void 0,z._wasAlreadyErroring){z._reject(Y),X8(J);return}let q=J._writableStreamController[Z](z._reason);N(q,()=>{return z._resolve(),X8(J),null},(g)=>{return z._reject(g),X8(J),null})}function k4(J){J._inFlightWriteRequest._resolve(void 0),J._inFlightWriteRequest=void 0}function I4(J,Y){J._inFlightWriteRequest._reject(Y),J._inFlightWriteRequest=void 0,RW(J,Y)}function Z4(J){if(J._inFlightCloseRequest._resolve(void 0),J._inFlightCloseRequest=void 0,J._state==="erroring"){if(J._storedError=void 0,J._pendingAbortRequest!==void 0)J._pendingAbortRequest._resolve(),J._pendingAbortRequest=void 0}J._state="closed";let z=J._writer;if(z!==void 0)R9(z)}function C4(J,Y){if(J._inFlightCloseRequest._reject(Y),J._inFlightCloseRequest=void 0,J._pendingAbortRequest!==void 0)J._pendingAbortRequest._reject(Y),J._pendingAbortRequest=void 0;RW(J,Y)}function w1(J){if(J._closeRequest===void 0&&J._inFlightCloseRequest===void 0)return!1;return!0}function y4(J){if(J._inFlightWriteRequest===void 0&&J._inFlightCloseRequest===void 0)return!1;return!0}function T4(J){J._inFlightCloseRequest=J._closeRequest,J._closeRequest=void 0}function x4(J){J._inFlightWriteRequest=J._writeRequests.shift()}function X8(J){if(J._closeRequest!==void 0)J._closeRequest._reject(J._storedError),J._closeRequest=void 0;let Y=J._writer;if(Y!==void 0)TW(Y,J._storedError)}function IW(J,Y){let z=J._writer;if(z!==void 0&&Y!==J._backpressure)if(Y)o4(z);else lW(z);J._backpressure=Y}class G1{constructor(J){if(tv(J,1,"WritableStreamDefaultWriter"),O9(J,"First parameter"),I0(J))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=J,J._writer=this;let Y=J._state;if(Y==="writable"){if(!w1(J)&&J._backpressure)z8(this);else _9(this);G8(this)}else if(Y==="erroring")xW(this,J._storedError),G8(this);else if(Y==="closed")_9(this),d4(this);else{let z=J._storedError;xW(this,z),g9(this,z)}}get closed(){if(!Y0(this))return M(G0("closed"));return this._closedPromise}get desiredSize(){if(!Y0(this))throw G0("desiredSize");if(this._ownerWritableStream===void 0)throw DQ("desiredSize");return m4(this)}get ready(){if(!Y0(this))return M(G0("ready"));return this._readyPromise}abort(J=void 0){if(!Y0(this))return M(G0("abort"));if(this._ownerWritableStream===void 0)return M(DQ("abort"));return l4(this,J)}close(){if(!Y0(this))return M(G0("close"));let J=this._ownerWritableStream;if(J===void 0)return M(DQ("close"));if(w1(J))return M(new TypeError("Cannot close an already-closing stream"));return N9(this)}releaseLock(){if(!Y0(this))throw G0("releaseLock");if(this._ownerWritableStream===void 0)return;A9(this)}write(J=void 0){if(!Y0(this))return M(G0("write"));if(this._ownerWritableStream===void 0)return M(DQ("write to"));return U9(this,J)}}if(Object.defineProperties(G1.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),Q(G1.prototype.abort,"abort"),Q(G1.prototype.close,"close"),Q(G1.prototype.releaseLock,"releaseLock"),Q(G1.prototype.write,"write"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(G1.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function Y0(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_ownerWritableStream"))return!1;return J instanceof G1}function l4(J,Y){let z=J._ownerWritableStream;return J8(z,Y)}function N9(J){let Y=J._ownerWritableStream;return q9(Y)}function b4(J){let Y=J._ownerWritableStream,z=Y._state;if(w1(Y)||z==="closed")return D(void 0);if(z==="errored")return M(Y._storedError);return N9(J)}function u4(J,Y){if(J._closedPromiseState==="pending")TW(J,Y);else s4(J,Y)}function E9(J,Y){if(J._readyPromiseState==="pending")k9(J,Y);else t4(J,Y)}function m4(J){let Y=J._ownerWritableStream,z=Y._state;if(z==="errored"||z==="erroring")return null;if(z==="closed")return 0;return L9(Y._writableStreamController)}function A9(J){let Y=J._ownerWritableStream,z=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");E9(J,z),u4(J,z),Y._writer=void 0,J._ownerWritableStream=void 0}function U9(J,Y){let z=J._ownerWritableStream,q=z._writableStreamController,g=c4(q,Y);if(z!==J._ownerWritableStream)return M(DQ("write to"));let k=z._state;if(k==="errored")return M(z._storedError);if(w1(z)||k==="closed")return M(new TypeError("The stream is closing or closed and cannot be written to"));if(k==="erroring")return M(z._storedError);let C=_4(z);return n4(q,Y,g),C}let j9={};class w0{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!ZW(this))throw yW("abortReason");return this._abortReason}get signal(){if(!ZW(this))throw yW("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(J=void 0){if(!ZW(this))throw yW("error");if(this._controlledWritableStream._state!=="writable")return;S9(this,J)}[Z](J){let Y=this._abortAlgorithm(J);return P8(this),Y}[m](){j(this)}}if(Object.defineProperties(w0.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(w0.prototype,Symbol.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function ZW(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_controlledWritableStream"))return!1;return J instanceof w0}function F9(J,Y,z,q,g,k,C,s){Y._controlledWritableStream=J,J._writableStreamController=Y,Y._queue=void 0,Y._queueTotalSize=void 0,j(Y),Y._abortReason=void 0,Y._abortController=g4(),Y._started=!1,Y._strategySizeAlgorithm=s,Y._strategyHWM=C,Y._writeAlgorithm=q,Y._closeAlgorithm=g,Y._abortAlgorithm=k;let t=CW(Y);IW(J,t);let Xv=z(),Yv=D(Xv);N(Yv,()=>{return Y._started=!0,Y8(Y),null},(Mv)=>{return Y._started=!0,RW(J,Mv),null})}function r4(J,Y,z,q){let g=Object.create(w0.prototype),k,C,s,t;if(Y.start!==void 0)k=()=>Y.start(g);else k=()=>{return};if(Y.write!==void 0)C=(Xv)=>Y.write(Xv,g);else C=()=>D(void 0);if(Y.close!==void 0)s=()=>Y.close();else s=()=>D(void 0);if(Y.abort!==void 0)t=(Xv)=>Y.abort(Xv);else t=()=>D(void 0);F9(J,g,k,C,s,t,z,q)}function P8(J){J._writeAlgorithm=void 0,J._closeAlgorithm=void 0,J._abortAlgorithm=void 0,J._strategySizeAlgorithm=void 0}function a4(J){BQ(J,j9,0),Y8(J)}function c4(J,Y){try{return J._strategySizeAlgorithm(Y)}catch(z){return $Q(J,z),1}}function L9(J){return J._strategyHWM-J._queueTotalSize}function n4(J,Y,z){try{BQ(J,Y,z)}catch(g){$Q(J,g);return}let q=J._controlledWritableStream;if(!w1(q)&&q._state==="writable"){let g=CW(J);IW(q,g)}Y8(J)}function Y8(J){let Y=J._controlledWritableStream;if(!J._started)return;if(Y._inFlightWriteRequest!==void 0)return;if(Y._state==="erroring"){kW(Y);return}if(J._queue.length===0)return;let q=eQ(J);if(q===j9)p4(J);else i4(J,q)}function $Q(J,Y){if(J._controlledWritableStream._state==="writable")S9(J,Y)}function p4(J){let Y=J._controlledWritableStream;T4(Y),F0(J);let z=J._closeAlgorithm();P8(J),N(z,()=>{return Z4(Y),null},(q)=>{return C4(Y,q),null})}function i4(J,Y){let z=J._controlledWritableStream;x4(z);let q=J._writeAlgorithm(Y);N(q,()=>{k4(z);let g=z._state;if(F0(J),!w1(z)&&g==="writable"){let k=CW(J);IW(z,k)}return Y8(J),null},(g)=>{if(z._state==="writable")P8(J);return I4(z,g),null})}function CW(J){return L9(J)<=0}function S9(J,Y){let z=J._controlledWritableStream;P8(J),_W(z,Y)}function w8(J){return new TypeError(`WritableStream.prototype.${J} can only be used on a WritableStream`)}function yW(J){return new TypeError(`WritableStreamDefaultController.prototype.${J} can only be used on a WritableStreamDefaultController`)}function G0(J){return new TypeError(`WritableStreamDefaultWriter.prototype.${J} can only be used on a WritableStreamDefaultWriter`)}function DQ(J){return new TypeError("Cannot "+J+" a stream using a released writer")}function G8(J){J._closedPromise=B((Y,z)=>{J._closedPromise_resolve=Y,J._closedPromise_reject=z,J._closedPromiseState="pending"})}function g9(J,Y){G8(J),TW(J,Y)}function d4(J){G8(J),R9(J)}function TW(J,Y){if(J._closedPromise_reject===void 0)return;O(J._closedPromise),J._closedPromise_reject(Y),J._closedPromise_resolve=void 0,J._closedPromise_reject=void 0,J._closedPromiseState="rejected"}function s4(J,Y){g9(J,Y)}function R9(J){if(J._closedPromise_resolve===void 0)return;J._closedPromise_resolve(void 0),J._closedPromise_resolve=void 0,J._closedPromise_reject=void 0,J._closedPromiseState="resolved"}function z8(J){J._readyPromise=B((Y,z)=>{J._readyPromise_resolve=Y,J._readyPromise_reject=z}),J._readyPromiseState="pending"}function xW(J,Y){z8(J),k9(J,Y)}function _9(J){z8(J),lW(J)}function k9(J,Y){if(J._readyPromise_reject===void 0)return;O(J._readyPromise),J._readyPromise_reject(Y),J._readyPromise_resolve=void 0,J._readyPromise_reject=void 0,J._readyPromiseState="rejected"}function o4(J){z8(J)}function t4(J,Y){xW(J,Y)}function lW(J){if(J._readyPromise_resolve===void 0)return;J._readyPromise_resolve(void 0),J._readyPromise_resolve=void 0,J._readyPromise_reject=void 0,J._readyPromiseState="fulfilled"}function e4(){if(typeof globalThis!=="undefined")return globalThis;else if(typeof self!=="undefined")return self;else if(typeof global!=="undefined")return global;return}let bW=e4();function v5(J){if(!(typeof J==="function"||typeof J==="object"))return!1;if(J.name!=="DOMException")return!1;try{return new J,!0}catch(Y){return!1}}function f5(){let J=bW===null||bW===void 0?void 0:bW.DOMException;return v5(J)?J:void 0}function Q5(){let J=function Y(z,q){if(this.message=z||"",this.name=q||"Error",Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)};return Q(J,"DOMException"),J.prototype=Object.create(Error.prototype),Object.defineProperty(J.prototype,"constructor",{value:J,writable:!0,configurable:!0}),J}let W5=f5()||Q5();function I9(J,Y,z,q,g,k){let C=Bf(J),s=H9(Y);J._disturbed=!0;let t=!1,Xv=D(void 0);return B((Yv,Mv)=>{let Sv;if(k!==void 0){if(Sv=()=>{let vv=k.reason!==void 0?k.reason:new W5("Aborted","AbortError"),Hv=[];if(!q)Hv.push(()=>{if(Y._state==="writable")return J8(Y,vv);return D(void 0)});if(!g)Hv.push(()=>{if(J._state==="readable")return af(J,vv);return D(void 0)});Of(()=>Promise.all(Hv.map((_v)=>_v())),!0,vv)},k.aborted){Sv();return}k.addEventListener("abort",Sv)}function A1(){return B((vv,Hv)=>{function _v(jf){if(jf)vv();else A(T0(),_v,Hv)}_v(!1)})}function T0(){if(t)return D(!0);return A(s._readyPromise,()=>{return B((vv,Hv)=>{cv(C,{_chunkSteps:(_v)=>{Xv=A(U9(s,_v),void 0,v),vv(!1)},_closeSteps:()=>vv(!0),_errorSteps:Hv})})})}if(U1(J,C._closedPromise,(vv)=>{if(!q)Of(()=>J8(Y,vv),!0,vv);else Cf(!0,vv);return null}),U1(Y,s._closedPromise,(vv)=>{if(!g)Of(()=>af(J,vv),!0,vv);else Cf(!0,vv);return null}),$f(J,C._closedPromise,()=>{if(!z)Of(()=>b4(s));else Cf();return null}),w1(Y)||Y._state==="closed"){let vv=new TypeError("the destination writable stream closed before all data could be piped to it");if(!g)Of(()=>af(J,vv),!0,vv);else Cf(!0,vv)}O(A1());function b1(){let vv=Xv;return A(Xv,()=>vv!==Xv?b1():void 0)}function U1(vv,Hv,_v){if(vv._state==="errored")_v(vv._storedError);else $(Hv,_v)}function $f(vv,Hv,_v){if(vv._state==="closed")_v();else h(Hv,_v)}function Of(vv,Hv,_v){if(t)return;if(t=!0,Y._state==="writable"&&!w1(Y))h(b1(),jf);else jf();function jf(){return N(vv(),()=>j1(Hv,_v),(x0)=>j1(!0,x0)),null}}function Cf(vv,Hv){if(t)return;if(t=!0,Y._state==="writable"&&!w1(Y))h(b1(),()=>j1(vv,Hv));else j1(vv,Hv)}function j1(vv,Hv){if(A9(s),T(C),k!==void 0)k.removeEventListener("abort",Sv);if(vv)Mv(Hv);else Yv(void 0);return null}})}class z1{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!B8(this))throw h8("desiredSize");return uW(this)}close(){if(!B8(this))throw h8("close");if(!C0(this))throw new TypeError("The stream is not in a state that permits close");z0(this)}enqueue(J=void 0){if(!B8(this))throw h8("enqueue");if(!C0(this))throw new TypeError("The stream is not in a state that permits enqueue");return Z0(this,J)}error(J=void 0){if(!B8(this))throw h8("error");rf(this,J)}[x](J){j(this);let Y=this._cancelAlgorithm(J);return K8(this),Y}[y](J){let Y=this._controlledReadableStream;if(this._queue.length>0){let z=F0(this);if(this._closeRequested&&this._queue.length===0)K8(this),HQ(Y);else MQ(this);J._chunkSteps(z)}else Sf(Y,J),MQ(this)}[a](){}}if(Object.defineProperties(z1.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),Q(z1.prototype.close,"close"),Q(z1.prototype.enqueue,"enqueue"),Q(z1.prototype.error,"error"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(z1.prototype,Symbol.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function B8(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_controlledReadableStream"))return!1;return J instanceof z1}function MQ(J){if(!Z9(J))return;if(J._pulling){J._pullAgain=!0;return}J._pulling=!0;let z=J._pullAlgorithm();N(z,()=>{if(J._pulling=!1,J._pullAgain)J._pullAgain=!1,MQ(J);return null},(q)=>{return rf(J,q),null})}function Z9(J){let Y=J._controlledReadableStream;if(!C0(J))return!1;if(!J._started)return!1;if(l1(Y)&&gf(Y)>0)return!0;if(uW(J)>0)return!0;return!1}function K8(J){J._pullAlgorithm=void 0,J._cancelAlgorithm=void 0,J._strategySizeAlgorithm=void 0}function z0(J){if(!C0(J))return;let Y=J._controlledReadableStream;if(J._closeRequested=!0,J._queue.length===0)K8(J),HQ(Y)}function Z0(J,Y){if(!C0(J))return;let z=J._controlledReadableStream;if(l1(z)&&gf(z)>0)bf(z,Y,!1);else{let q;try{q=J._strategySizeAlgorithm(Y)}catch(g){throw rf(J,g),g}try{BQ(J,Y,q)}catch(g){throw rf(J,g),g}}MQ(J)}function rf(J,Y){let z=J._controlledReadableStream;if(z._state!=="readable")return;j(J),K8(J),x9(z,Y)}function uW(J){let Y=J._controlledReadableStream._state;if(Y==="errored")return null;if(Y==="closed")return 0;return J._strategyHWM-J._queueTotalSize}function J5(J){if(Z9(J))return!1;return!0}function C0(J){let Y=J._controlledReadableStream._state;if(!J._closeRequested&&Y==="readable")return!0;return!1}function C9(J,Y,z,q,g,k,C){Y._controlledReadableStream=J,Y._queue=void 0,Y._queueTotalSize=void 0,j(Y),Y._started=!1,Y._closeRequested=!1,Y._pullAgain=!1,Y._pulling=!1,Y._strategySizeAlgorithm=C,Y._strategyHWM=k,Y._pullAlgorithm=q,Y._cancelAlgorithm=g,J._readableStreamController=Y;let s=z();N(D(s),()=>{return Y._started=!0,MQ(Y),null},(t)=>{return rf(Y,t),null})}function X5(J,Y,z,q){let g=Object.create(z1.prototype),k,C,s;if(Y.start!==void 0)k=()=>Y.start(g);else k=()=>{return};if(Y.pull!==void 0)C=()=>Y.pull(g);else C=()=>D(void 0);if(Y.cancel!==void 0)s=(t)=>Y.cancel(t);else s=()=>D(void 0);C9(J,g,k,C,s,z,q)}function h8(J){return new TypeError(`ReadableStreamDefaultController.prototype.${J} can only be used on a ReadableStreamDefaultController`)}function P5(J,Y){if(Wv(J._readableStreamController))return w5(J);return Y5(J)}function Y5(J,Y){let z=Bf(J),q=!1,g=!1,k=!1,C=!1,s,t,Xv,Yv,Mv,Sv=B(($f)=>{Mv=$f});function A1(){if(q)return g=!0,D(void 0);return q=!0,cv(z,{_chunkSteps:(Of)=>{H(()=>{g=!1;let Cf=Of,j1=Of;if(!k)Z0(Xv._readableStreamController,Cf);if(!C)Z0(Yv._readableStreamController,j1);if(q=!1,g)A1()})},_closeSteps:()=>{if(q=!1,!k)z0(Xv._readableStreamController);if(!C)z0(Yv._readableStreamController);if(!k||!C)Mv(void 0)},_errorSteps:()=>{q=!1}}),D(void 0)}function T0($f){if(k=!0,s=$f,C){let Of=Xf([s,t]),Cf=af(J,Of);Mv(Cf)}return Sv}function b1($f){if(C=!0,t=$f,k){let Of=Xf([s,t]),Cf=af(J,Of);Mv(Cf)}return Sv}function U1(){}return Xv=OQ(U1,A1,T0),Yv=OQ(U1,A1,b1),$(z._closedPromise,($f)=>{if(rf(Xv._readableStreamController,$f),rf(Yv._readableStreamController,$f),!k||!C)Mv(void 0);return null}),[Xv,Yv]}function w5(J){let Y=Bf(J),z=!1,q=!1,g=!1,k=!1,C=!1,s,t,Xv,Yv,Mv,Sv=B((vv)=>{Mv=vv});function A1(vv){$(vv._closedPromise,(Hv)=>{if(vv!==Y)return null;if(dv(Xv._readableStreamController,Hv),dv(Yv._readableStreamController,Hv),!k||!C)Mv(void 0);return null})}function T0(){if(T1(Y))T(Y),Y=Bf(J),A1(Y);cv(Y,{_chunkSteps:(Hv)=>{H(()=>{q=!1,g=!1;let _v=Hv,jf=Hv;if(!k&&!C)try{jf=tQ(Hv)}catch(x0){dv(Xv._readableStreamController,x0),dv(Yv._readableStreamController,x0),Mv(af(J,x0));return}if(!k)mf(Xv._readableStreamController,_v);if(!C)mf(Yv._readableStreamController,jf);if(z=!1,q)U1();else if(g)$f()})},_closeSteps:()=>{if(z=!1,!k)P1(Xv._readableStreamController);if(!C)P1(Yv._readableStreamController);if(Xv._readableStreamController._pendingPullIntos.length>0)If(Xv._readableStreamController,0);if(Yv._readableStreamController._pendingPullIntos.length>0)If(Yv._readableStreamController,0);if(!k||!C)Mv(void 0)},_errorSteps:()=>{z=!1}})}function b1(vv,Hv){if(bv(Y))T(Y),Y=W8(J),A1(Y);let _v=Hv?Yv:Xv,jf=Hv?Xv:Yv;q1(Y,vv,1,{_chunkSteps:(l0)=>{H(()=>{q=!1,g=!1;let b0=Hv?C:k;if(!(Hv?k:C)){let o9;try{o9=tQ(l0)}catch(nW){dv(_v._readableStreamController,nW),dv(jf._readableStreamController,nW),Mv(af(J,nW));return}if(!b0)S0(_v._readableStreamController,l0);mf(jf._readableStreamController,o9)}else if(!b0)S0(_v._readableStreamController,l0);if(z=!1,q)U1();else if(g)$f()})},_closeSteps:(l0)=>{z=!1;let b0=Hv?C:k,H8=Hv?k:C;if(!b0)P1(_v._readableStreamController);if(!H8)P1(jf._readableStreamController);if(l0!==void 0){if(!b0)S0(_v._readableStreamController,l0);if(!H8&&jf._readableStreamController._pendingPullIntos.length>0)If(jf._readableStreamController,0)}if(!b0||!H8)Mv(void 0)},_errorSteps:()=>{z=!1}})}function U1(){if(z)return q=!0,D(void 0);z=!0;let vv=Y1(Xv._readableStreamController);if(vv===null)T0();else b1(vv._view,!1);return D(void 0)}function $f(){if(z)return g=!0,D(void 0);z=!0;let vv=Y1(Yv._readableStreamController);if(vv===null)T0();else b1(vv._view,!0);return D(void 0)}function Of(vv){if(k=!0,s=vv,C){let Hv=Xf([s,t]),_v=af(J,Hv);Mv(_v)}return Sv}function Cf(vv){if(C=!0,t=vv,k){let Hv=Xf([s,t]),_v=af(J,Hv);Mv(_v)}return Sv}function j1(){return}return Xv=T9(j1,U1,Of),Yv=T9(j1,$f,Cf),A1(Y),[Xv,Yv]}function G5(J){return W(J)&&typeof J.getReader!=="undefined"}function z5(J){if(G5(J))return K5(J.getReader());return B5(J)}function B5(J){let Y,z=dQ(J,"async"),q=v;function g(){let C;try{C=sQ(z)}catch(t){return M(t)}let s=D(C);return U(s,(t)=>{if(!W(t))throw new TypeError("The promise returned by the iterator.next() method must fulfill with an object");if(SW(t))z0(Y._readableStreamController);else{let Yv=zQ(t);Z0(Y._readableStreamController,Yv)}})}function k(C){let s=z.iterator,t;try{t=j0(s,"return")}catch(Mv){return M(Mv)}if(t===void 0)return D(void 0);let Xv;try{Xv=F(t,s,[C])}catch(Mv){return M(Mv)}let Yv=D(Xv);return U(Yv,(Mv)=>{if(!W(Mv))throw new TypeError("The promise returned by the iterator.return() method must fulfill with an object");return})}return Y=OQ(q,g,k,0),Y}function K5(J){let Y,z=v;function q(){let k;try{k=J.read()}catch(C){return M(C)}return U(k,(C)=>{if(!W(C))throw new TypeError("The promise returned by the reader.read() method must fulfill with an object");if(C.done)z0(Y._readableStreamController);else{let s=C.value;Z0(Y._readableStreamController,s)}})}function g(k){try{return D(J.cancel(k))}catch(C){return M(C)}}return Y=OQ(z,q,g,0),Y}function h5(J,Y){Pv(J,Y);let z=J,q=z===null||z===void 0?void 0:z.autoAllocateChunkSize,g=z===null||z===void 0?void 0:z.cancel,k=z===null||z===void 0?void 0:z.pull,C=z===null||z===void 0?void 0:z.start,s=z===null||z===void 0?void 0:z.type;return{autoAllocateChunkSize:q===void 0?void 0:pv(q,`${Y} has member 'autoAllocateChunkSize' that`),cancel:g===void 0?void 0:$5(g,z,`${Y} has member 'cancel' that`),pull:k===void 0?void 0:D5(k,z,`${Y} has member 'pull' that`),start:C===void 0?void 0:M5(C,z,`${Y} has member 'start' that`),type:s===void 0?void 0:O5(s,`${Y} has member 'type' that`)}}function $5(J,Y,z){return Ev(J,z),(q)=>E(J,Y,[q])}function D5(J,Y,z){return Ev(J,z),(q)=>E(J,Y,[q])}function M5(J,Y,z){return Ev(J,z),(q)=>F(J,Y,[q])}function O5(J,Y){if(J=`${J}`,J!=="bytes")throw new TypeError(`${Y} '${J}' is not a valid enumeration value for ReadableStreamType`);return J}function H5(J,Y){Pv(J,Y);let z=J===null||J===void 0?void 0:J.preventCancel;return{preventCancel:Boolean(z)}}function y9(J,Y){Pv(J,Y);let z=J===null||J===void 0?void 0:J.preventAbort,q=J===null||J===void 0?void 0:J.preventCancel,g=J===null||J===void 0?void 0:J.preventClose,k=J===null||J===void 0?void 0:J.signal;if(k!==void 0)V5(k,`${Y} has member 'signal' that`);return{preventAbort:Boolean(z),preventCancel:Boolean(q),preventClose:Boolean(g),signal:k}}function V5(J,Y){if(!L4(J))throw new TypeError(`${Y} is not an AbortSignal.`)}function q5(J,Y){Pv(J,Y);let z=J===null||J===void 0?void 0:J.readable;Uf(z,"readable","ReadableWritablePair"),Vv(z,`${Y} has member 'readable' that`);let q=J===null||J===void 0?void 0:J.writable;return Uf(q,"writable","ReadableWritablePair"),O9(q,`${Y} has member 'writable' that`),{readable:z,writable:q}}class Qf{constructor(J={},Y={}){if(J===void 0)J=null;else ov(J,"First parameter");let z=hQ(Y,"Second parameter"),q=h5(J,"First parameter");if(mW(this),q.type==="bytes"){if(z.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");let g=P0(z,0);f8(this,q,g)}else{let g=_0(z),k=P0(z,1);X5(this,q,k,g)}}get locked(){if(!x1(this))throw B0("locked");return l1(this)}cancel(J=void 0){if(!x1(this))return M(B0("cancel"));if(l1(this))return M(new TypeError("Cannot cancel a stream that already has a reader"));return af(this,J)}getReader(J=void 0){if(!x1(this))throw B0("getReader");if(J0(J,"First parameter").mode===void 0)return Bf(this);return W8(this)}pipeThrough(J,Y={}){if(!x1(this))throw B0("pipeThrough");tv(J,1,"pipeThrough");let z=q5(J,"First parameter"),q=y9(Y,"Second parameter");if(l1(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(I0(z.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");let g=I9(this,z.writable,q.preventClose,q.preventAbort,q.preventCancel,q.signal);return O(g),z.readable}pipeTo(J,Y={}){if(!x1(this))return M(B0("pipeTo"));if(J===void 0)return M("Parameter 1 is required in 'pipeTo'.");if(!k0(J))return M(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let z;try{z=y9(Y,"Second parameter")}catch(q){return M(q)}if(l1(this))return M(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream"));if(I0(J))return M(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream"));return I9(this,J,z.preventClose,z.preventAbort,z.preventCancel,z.signal)}tee(){if(!x1(this))throw B0("tee");let J=P5(this);return Xf(J)}values(J=void 0){if(!x1(this))throw B0("values");let Y=H5(J,"First parameter");return nQ(this,Y.preventCancel)}[W1](J){return this.values(J)}static from(J){return z5(J)}}if(Object.defineProperties(Qf,{from:{enumerable:!0}}),Object.defineProperties(Qf.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),Q(Qf.from,"from"),Q(Qf.prototype.cancel,"cancel"),Q(Qf.prototype.getReader,"getReader"),Q(Qf.prototype.pipeThrough,"pipeThrough"),Q(Qf.prototype.pipeTo,"pipeTo"),Q(Qf.prototype.tee,"tee"),Q(Qf.prototype.values,"values"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(Qf.prototype,Symbol.toStringTag,{value:"ReadableStream",configurable:!0});Object.defineProperty(Qf.prototype,W1,{value:Qf.prototype.values,writable:!0,configurable:!0});function OQ(J,Y,z,q=1,g=()=>1){let k=Object.create(Qf.prototype);mW(k);let C=Object.create(z1.prototype);return C9(k,C,J,Y,z,q,g),k}function T9(J,Y,z){let q=Object.create(Qf.prototype);mW(q);let g=Object.create(c.prototype);return v8(q,g,J,Y,z,0,void 0),q}function mW(J){J._state="readable",J._reader=void 0,J._storedError=void 0,J._disturbed=!1}function x1(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_readableStreamController"))return!1;return J instanceof Qf}function l1(J){if(J._reader===void 0)return!1;return!0}function af(J,Y){if(J._disturbed=!0,J._state==="closed")return D(void 0);if(J._state==="errored")return M(J._storedError);HQ(J);let z=J._reader;if(z!==void 0&&T1(z)){let g=z._readIntoRequests;z._readIntoRequests=new R,g.forEach((k)=>{k._closeSteps(void 0)})}let q=J._readableStreamController[x](Y);return U(q,v)}function HQ(J){J._state="closed";let Y=J._reader;if(Y===void 0)return;if(e(Y),bv(Y)){let z=Y._readRequests;Y._readRequests=new R,z.forEach((q)=>{q._closeSteps()})}}function x9(J,Y){J._state="errored",J._storedError=Y;let z=J._reader;if(z===void 0)return;if(Kv(z,Y),bv(z))Jf(z,Y);else KQ(z,Y)}function B0(J){return new TypeError(`ReadableStream.prototype.${J} can only be used on a ReadableStream`)}function l9(J,Y){Pv(J,Y);let z=J===null||J===void 0?void 0:J.highWaterMark;return Uf(z,"highWaterMark","QueuingStrategyInit"),{highWaterMark:xv(z)}}let b9=(J)=>{return J.byteLength};Q(b9,"size");class VQ{constructor(J){tv(J,1,"ByteLengthQueuingStrategy"),J=l9(J,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=J.highWaterMark}get highWaterMark(){if(!m9(this))throw u9("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!m9(this))throw u9("size");return b9}}if(Object.defineProperties(VQ.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(VQ.prototype,Symbol.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function u9(J){return new TypeError(`ByteLengthQueuingStrategy.prototype.${J} can only be used on a ByteLengthQueuingStrategy`)}function m9(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_byteLengthQueuingStrategyHighWaterMark"))return!1;return J instanceof VQ}let r9=()=>{return 1};Q(r9,"size");class qQ{constructor(J){tv(J,1,"CountQueuingStrategy"),J=l9(J,"First parameter"),this._countQueuingStrategyHighWaterMark=J.highWaterMark}get highWaterMark(){if(!c9(this))throw a9("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!c9(this))throw a9("size");return r9}}if(Object.defineProperties(qQ.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(qQ.prototype,Symbol.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function a9(J){return new TypeError(`CountQueuingStrategy.prototype.${J} can only be used on a CountQueuingStrategy`)}function c9(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_countQueuingStrategyHighWaterMark"))return!1;return J instanceof qQ}function N5(J,Y){Pv(J,Y);let z=J===null||J===void 0?void 0:J.cancel,q=J===null||J===void 0?void 0:J.flush,g=J===null||J===void 0?void 0:J.readableType,k=J===null||J===void 0?void 0:J.start,C=J===null||J===void 0?void 0:J.transform,s=J===null||J===void 0?void 0:J.writableType;return{cancel:z===void 0?void 0:j5(z,J,`${Y} has member 'cancel' that`),flush:q===void 0?void 0:E5(q,J,`${Y} has member 'flush' that`),readableType:g,start:k===void 0?void 0:A5(k,J,`${Y} has member 'start' that`),transform:C===void 0?void 0:U5(C,J,`${Y} has member 'transform' that`),writableType:s}}function E5(J,Y,z){return Ev(J,z),(q)=>E(J,Y,[q])}function A5(J,Y,z){return Ev(J,z),(q)=>F(J,Y,[q])}function U5(J,Y,z){return Ev(J,z),(q,g)=>E(J,Y,[q,g])}function j5(J,Y,z){return Ev(J,z),(q)=>E(J,Y,[q])}class NQ{constructor(J={},Y={},z={}){if(J===void 0)J=null;let q=hQ(Y,"Second parameter"),g=hQ(z,"Third parameter"),k=N5(J,"First parameter");if(k.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(k.writableType!==void 0)throw new RangeError("Invalid writableType specified");let C=P0(g,0),s=_0(g),t=P0(q,1),Xv=_0(q),Yv,Mv=B((Sv)=>{Yv=Sv});if(F5(this,Mv,t,Xv,C,s),S5(this,k),k.start!==void 0)Yv(k.start(this._transformStreamController));else Yv(void 0)}get readable(){if(!n9(this))throw s9("readable");return this._readable}get writable(){if(!n9(this))throw s9("writable");return this._writable}}if(Object.defineProperties(NQ.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof Symbol.toStringTag==="symbol")Object.defineProperty(NQ.prototype,Symbol.toStringTag,{value:"TransformStream",configurable:!0});function F5(J,Y,z,q,g,k){function C(){return Y}function s(Sv){return _5(J,Sv)}function t(Sv){return k5(J,Sv)}function Xv(){return I5(J)}J._writable=R4(C,s,Xv,t,z,q);function Yv(){return Z5(J)}function Mv(Sv){return C5(J,Sv)}J._readable=OQ(C,Yv,Mv,g,k),J._backpressure=void 0,J._backpressureChangePromise=void 0,J._backpressureChangePromise_resolve=void 0,$8(J,!0),J._transformStreamController=void 0}function n9(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_transformStreamController"))return!1;return J instanceof NQ}function p9(J,Y){rf(J._readable._readableStreamController,Y),rW(J,Y)}function rW(J,Y){M8(J._transformStreamController),$Q(J._writable._writableStreamController,Y),aW(J)}function aW(J){if(J._backpressure)$8(J,!1)}function $8(J,Y){if(J._backpressureChangePromise!==void 0)J._backpressureChangePromise_resolve();J._backpressureChangePromise=B((z)=>{J._backpressureChangePromise_resolve=z}),J._backpressure=Y}class E1{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!D8(this))throw O8("desiredSize");let J=this._controlledTransformStream._readable._readableStreamController;return uW(J)}enqueue(J=void 0){if(!D8(this))throw O8("enqueue");i9(this,J)}error(J=void 0){if(!D8(this))throw O8("error");g5(this,J)}terminate(){if(!D8(this))throw O8("terminate");R5(this)}}if(Object.defineProperties(E1.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),Q(E1.prototype.enqueue,"enqueue"),Q(E1.prototype.error,"error"),Q(E1.prototype.terminate,"terminate"),typeof Symbol.toStringTag==="symbol")Object.defineProperty(E1.prototype,Symbol.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function D8(J){if(!W(J))return!1;if(!Object.prototype.hasOwnProperty.call(J,"_controlledTransformStream"))return!1;return J instanceof E1}function L5(J,Y,z,q,g){Y._controlledTransformStream=J,J._transformStreamController=Y,Y._transformAlgorithm=z,Y._flushAlgorithm=q,Y._cancelAlgorithm=g,Y._finishPromise=void 0,Y._finishPromise_resolve=void 0,Y._finishPromise_reject=void 0}function S5(J,Y){let z=Object.create(E1.prototype),q,g,k;if(Y.transform!==void 0)q=(C)=>Y.transform(C,z);else q=(C)=>{try{return i9(z,C),D(void 0)}catch(s){return M(s)}};if(Y.flush!==void 0)g=()=>Y.flush(z);else g=()=>D(void 0);if(Y.cancel!==void 0)k=(C)=>Y.cancel(C);else k=()=>D(void 0);L5(J,z,q,g,k)}function M8(J){J._transformAlgorithm=void 0,J._flushAlgorithm=void 0,J._cancelAlgorithm=void 0}function i9(J,Y){let z=J._controlledTransformStream,q=z._readable._readableStreamController;if(!C0(q))throw new TypeError("Readable side is not in a state that permits enqueue");try{Z0(q,Y)}catch(k){throw rW(z,k),z._readable._storedError}if(J5(q)!==z._backpressure)$8(z,!0)}function g5(J,Y){p9(J._controlledTransformStream,Y)}function d9(J,Y){let z=J._transformAlgorithm(Y);return U(z,void 0,(q)=>{throw p9(J._controlledTransformStream,q),q})}function R5(J){let Y=J._controlledTransformStream,z=Y._readable._readableStreamController;z0(z);let q=new TypeError("TransformStream terminated");rW(Y,q)}function _5(J,Y){let z=J._transformStreamController;if(J._backpressure){let q=J._backpressureChangePromise;return U(q,()=>{let g=J._writable;if(g._state==="erroring")throw g._storedError;return d9(z,Y)})}return d9(z,Y)}function k5(J,Y){let z=J._transformStreamController;if(z._finishPromise!==void 0)return z._finishPromise;let q=J._readable;z._finishPromise=B((k,C)=>{z._finishPromise_resolve=k,z._finishPromise_reject=C});let g=z._cancelAlgorithm(Y);return M8(z),N(g,()=>{if(q._state==="errored")y0(z,q._storedError);else rf(q._readableStreamController,Y),cW(z);return null},(k)=>{return rf(q._readableStreamController,k),y0(z,k),null}),z._finishPromise}function I5(J){let Y=J._transformStreamController;if(Y._finishPromise!==void 0)return Y._finishPromise;let z=J._readable;Y._finishPromise=B((g,k)=>{Y._finishPromise_resolve=g,Y._finishPromise_reject=k});let q=Y._flushAlgorithm();return M8(Y),N(q,()=>{if(z._state==="errored")y0(Y,z._storedError);else z0(z._readableStreamController),cW(Y);return null},(g)=>{return rf(z._readableStreamController,g),y0(Y,g),null}),Y._finishPromise}function Z5(J){return $8(J,!1),J._backpressureChangePromise}function C5(J,Y){let z=J._transformStreamController;if(z._finishPromise!==void 0)return z._finishPromise;let q=J._writable;z._finishPromise=B((k,C)=>{z._finishPromise_resolve=k,z._finishPromise_reject=C});let g=z._cancelAlgorithm(Y);return M8(z),N(g,()=>{if(q._state==="errored")y0(z,q._storedError);else $Q(q._writableStreamController,Y),aW(J),cW(z);return null},(k)=>{return $Q(q._writableStreamController,k),aW(J),y0(z,k),null}),z._finishPromise}function O8(J){return new TypeError(`TransformStreamDefaultController.prototype.${J} can only be used on a TransformStreamDefaultController`)}function cW(J){if(J._finishPromise_resolve===void 0)return;J._finishPromise_resolve(),J._finishPromise_resolve=void 0,J._finishPromise_reject=void 0}function y0(J,Y){if(J._finishPromise_reject===void 0)return;O(J._finishPromise),J._finishPromise_reject(Y),J._finishPromise_resolve=void 0,J._finishPromise_reject=void 0}function s9(J){return new TypeError(`TransformStream.prototype.${J} can only be used on a TransformStream`)}f.ByteLengthQueuingStrategy=VQ,f.CountQueuingStrategy=qQ,f.ReadableByteStreamController=c,f.ReadableStream=Qf,f.ReadableStreamBYOBReader=wf,f.ReadableStreamBYOBRequest=_,f.ReadableStreamDefaultController=z1,f.ReadableStreamDefaultReader=rv,f.TransformStream=NQ,f.TransformStreamDefaultController=E1,f.WritableStream=N1,f.WritableStreamDefaultController=w0,f.WritableStreamDefaultWriter=G1})});var LY=Qv(()=>{if(!globalThis.ReadableStream)try{let f=require("node:process"),{emitWarning:v}=f;try{f.emitWarning=()=>{},Object.assign(globalThis,require("node:stream/web")),f.emitWarning=v}catch(W){throw f.emitWarning=v,W}}catch(f){Object.assign(globalThis,FY())}try{let{Blob:f}=require("buffer");if(f&&!f.prototype.stream)f.prototype.stream=function v(W){let X=0,Q=this;return new ReadableStream({type:"bytes",async pull(P){let G=await Q.slice(X,Math.min(Q.size,X+65536)).arrayBuffer();if(X+=G.byteLength,P.enqueue(new Uint8Array(G)),X===Q.size)P.close()}})}}catch(f){}});async function*rJ(f,v=!0){for(let W of f)if("stream"in W)yield*W.stream();else if(ArrayBuffer.isView(W))if(v){let X=W.byteOffset,Q=W.byteOffset+W.byteLength;while(X!==Q){let P=Math.min(Q-X,SY),w=W.buffer.slice(X,X+P);X+=w.byteLength,yield new Uint8Array(w)}}else yield W;else{let X=0,Q=W;while(X!==Q.size){let w=await Q.slice(X,Math.min(Q.size,X+SY)).arrayBuffer();X+=w.byteLength,yield new Uint8Array(w)}}}var eh,SY=65536,gY,ZG,ef;var TQ=jv(()=>{eh=Hf(LY());/*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */gY=class f{#v=[];#f="";#Q=0;#W="transparent";constructor(v=[],W={}){if(typeof v!=="object"||v===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof v[Symbol.iterator]!=="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof W!=="object"&&typeof W!=="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");if(W===null)W={};let X=new TextEncoder;for(let P of v){let w;if(ArrayBuffer.isView(P))w=new Uint8Array(P.buffer.slice(P.byteOffset,P.byteOffset+P.byteLength));else if(P instanceof ArrayBuffer)w=new Uint8Array(P.slice(0));else if(P instanceof f)w=P;else w=X.encode(`${P}`);this.#Q+=ArrayBuffer.isView(w)?w.byteLength:w.size,this.#v.push(w)}this.#W=`${W.endings===void 0?"transparent":W.endings}`;let Q=W.type===void 0?"":String(W.type);this.#f=/^[\x20-\x7E]*$/.test(Q)?Q:""}get size(){return this.#Q}get type(){return this.#f}async text(){let v=new TextDecoder,W="";for await(let X of rJ(this.#v,!1))W+=v.decode(X,{stream:!0});return W+=v.decode(),W}async arrayBuffer(){let v=new Uint8Array(this.size),W=0;for await(let X of rJ(this.#v,!1))v.set(X,W),W+=X.length;return v.buffer}stream(){let v=rJ(this.#v,!0);return new globalThis.ReadableStream({type:"bytes",async pull(W){let X=await v.next();X.done?W.close():W.enqueue(X.value)},async cancel(){await v.return()}})}slice(v=0,W=this.size,X=""){let{size:Q}=this,P=v<0?Math.max(Q+v,0):Math.min(v,Q),w=W<0?Math.max(Q+W,0):Math.min(W,Q),G=Math.max(w-P,0),B=this.#v,D=[],M=0;for(let N of B){if(M>=G)break;let h=ArrayBuffer.isView(N)?N.byteLength:N.size;if(P&&h<=P)P-=h,w-=h;else{let $;if(ArrayBuffer.isView(N))$=N.subarray(P,Math.min(h,w)),M+=$.byteLength;else $=N.slice(P,Math.min(h,w)),M+=$.size;w-=h,D.push($),P=0}}let A=new f([],{type:String(X).toLowerCase()});return A.#Q=G,A.#v=D,A}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](v){return v&&typeof v==="object"&&typeof v.constructor==="function"&&(typeof v.stream==="function"||typeof v.arrayBuffer==="function")&&/^(Blob|File)$/.test(v[Symbol.toStringTag])}};Object.defineProperties(gY.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});ZG=gY,ef=ZG});var CG,yG,s1;var aJ=jv(()=>{TQ();CG=class f extends ef{#v=0;#f="";constructor(v,W,X={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(v,X);if(X===null)X={};let Q=X.lastModified===void 0?Date.now():Number(X.lastModified);if(!Number.isNaN(Q))this.#v=Q;this.#f=String(W)}get name(){return this.#f}get lastModified(){return this.#v}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](v){return!!v&&v instanceof ef&&/^(File)$/.test(v[Symbol.toStringTag])}},yG=CG,s1=yG});function kY(f,v=ef){var W=`${RY()}${RY()}`.replace(/\./g,"").slice(-28).padStart(32,"-"),X=[],Q=`--${W}\r
3
+ Content-Disposition: form-data; name="`;return f.forEach((P,w)=>typeof P=="string"?X.push(Q+cJ(w)+`"\r
4
+ \r
5
+ ${P.replace(/\r(?!\n)|(?<!\r)\n/g,`\r
6
+ `)}\r
7
+ `):X.push(Q+cJ(w)+`"; filename="${cJ(P.name,1)}"\r
8
+ Content-Type: ${P.type||"application/octet-stream"}\r
9
+ \r
10
+ `,P,`\r
11
+ `)),X.push(`--${W}--`),new v(X,{type:"multipart/form-data; boundary="+W})}var xQ,TG,xG,RY,lG,_Y=(f,v,W)=>(f+="",/^(Blob|File)$/.test(v&&v[xQ])?[(W=W!==void 0?W+"":v[xQ]=="File"?v.name:"blob",f),v.name!==W||v[xQ]=="blob"?new s1([v],W,v):v]:[f,v+""]),cJ=(f,v)=>(v?f:f.replace(/\r?\n|\r/g,`\r
12
+ `)).replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22"),q0=(f,v,W)=>{if(v.length<W)throw new TypeError(`Failed to execute '${f}' on 'FormData': ${W} arguments required, but only ${v.length} present.`)},o1;var $W=jv(()=>{TQ();aJ();/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */({toStringTag:xQ,iterator:TG,hasInstance:xG}=Symbol),RY=Math.random,lG="append,set,get,getAll,delete,keys,values,entries,forEach,constructor".split(","),o1=class f{#v=[];constructor(...v){if(v.length)throw new TypeError("Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.")}get[xQ](){return"FormData"}[TG](){return this.entries()}static[xG](v){return v&&typeof v==="object"&&v[xQ]==="FormData"&&!lG.some((W)=>typeof v[W]!="function")}append(...v){q0("append",arguments,2),this.#v.push(_Y(...v))}delete(v){q0("delete",arguments,1),v+="",this.#v=this.#v.filter(([W])=>W!==v)}get(v){q0("get",arguments,1),v+="";for(var W=this.#v,X=W.length,Q=0;Q<X;Q++)if(W[Q][0]===v)return W[Q][1];return null}getAll(v,W){return q0("getAll",arguments,1),W=[],v+="",this.#v.forEach((X)=>X[0]===v&&W.push(X[1])),W}has(v){return q0("has",arguments,1),v+="",this.#v.some((W)=>W[0]===v)}forEach(v,W){q0("forEach",arguments,1);for(var[X,Q]of this)v.call(W,Q,X,this)}set(...v){q0("set",arguments,2);var W=[],X=!0;v=_Y(...v),this.#v.forEach((Q)=>{Q[0]===v[0]?X&&(X=!W.push(v)):W.push(Q)}),X&&W.push(v),this.#v=W}*entries(){yield*this.#v}*keys(){for(var[v]of this)yield v}*values(){for(var[,v]of this)yield v}}});var t1;var DW=jv(()=>{t1=class t1 extends Error{constructor(f,v){super(f);Error.captureStackTrace(this,this.constructor),this.type=v}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}});var Nf;var nJ=jv(()=>{DW();Nf=class Nf extends t1{constructor(f,v,W){super(f,v);if(W)this.code=this.errno=W.code,this.erroredSysCall=W.syscall}}});var MW,pJ=(f)=>{return typeof f==="object"&&typeof f.append==="function"&&typeof f.delete==="function"&&typeof f.get==="function"&&typeof f.getAll==="function"&&typeof f.has==="function"&&typeof f.set==="function"&&typeof f.sort==="function"&&f[MW]==="URLSearchParams"},lQ=(f)=>{return f&&typeof f==="object"&&typeof f.arrayBuffer==="function"&&typeof f.type==="string"&&typeof f.stream==="function"&&typeof f.constructor==="function"&&/^(Blob|File)$/.test(f[MW])},IY=(f)=>{return typeof f==="object"&&(f[MW]==="AbortSignal"||f[MW]==="EventTarget")},ZY=(f,v)=>{let W=new URL(v).hostname,X=new URL(f).hostname;return W===X||W.endsWith(`.${X}`)},CY=(f,v)=>{let W=new URL(v).protocol,X=new URL(f).protocol;return W===X};var OW=jv(()=>{MW=Symbol.toStringTag});var TY=Qv((z$,yY)=>{/*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */if(!globalThis.DOMException)try{let{MessageChannel:f}=require("worker_threads"),v=new f().port1,W=new ArrayBuffer;v.postMessage(W,[W,W])}catch(f){f.constructor.name==="DOMException"&&(globalThis.DOMException=f.constructor)}yY.exports=globalThis.DOMException});var N0,xY,lY,iJ,bY=(f,v)=>aY(N0.statSync(f),f,v),uY=(f,v)=>iJ(f).then((W)=>aY(W,f,v)),mY=(f,v)=>iJ(f).then((W)=>cY(W,f,v)),rY=(f,v)=>cY(N0.statSync(f),f,v),aY=(f,v,W="")=>new ef([new HW({path:v,size:f.size,lastModified:f.mtimeMs,start:0})],{type:W}),cY=(f,v,W="")=>new s1([new HW({path:v,size:f.size,lastModified:f.mtimeMs,start:0})],xY.basename(v),{type:W,lastModified:f.mtimeMs}),HW;var dJ=jv(()=>{N0=require("node:fs"),xY=require("node:path"),lY=Hf(TY());aJ();TQ();({stat:iJ}=N0.promises);HW=class HW{#v;#f;constructor(f){this.#v=f.path,this.#f=f.start,this.size=f.size,this.lastModified=f.lastModified}slice(f,v){return new HW({path:this.#v,lastModified:this.lastModified,size:v-f,start:this.#f+f})}async*stream(){let{mtimeMs:f}=await iJ(this.#v);if(f>this.lastModified)throw new lY.default("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*N0.createReadStream(this.#v,{start:this.#f,end:this.#f+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}});var iY={};pW(iY,{toFormData:()=>nG});class pY{constructor(f){this.index=0,this.flags=0,this.onHeaderEnd=E0,this.onHeaderField=E0,this.onHeadersEnd=E0,this.onHeaderValue=E0,this.onPartBegin=E0,this.onPartData=E0,this.onPartEnd=E0,this.boundaryChars={},f=`\r
13
+ --`+f;let v=new Uint8Array(f.length);for(let W=0;W<f.length;W++)v[W]=f.charCodeAt(W),this.boundaryChars[v[W]]=!0;this.boundary=v,this.lookbehind=new Uint8Array(this.boundary.length+8),this.state=Iv.START_BOUNDARY}write(f){let v=0,W=f.length,X=this.index,{lookbehind:Q,boundary:P,boundaryChars:w,index:G,state:B,flags:D}=this,M=this.boundary.length,A=M-1,N=f.length,h,$,U=(E)=>{this[E+"Mark"]=v},O=(E)=>{delete this[E+"Mark"]},H=(E,L,R,Z)=>{if(L===void 0||L!==R)this[E](Z&&Z.subarray(L,R))},F=(E,L)=>{let R=E+"Mark";if(!(R in this))return;if(L)H(E,this[R],v,f),delete this[R];else H(E,this[R],f.length,f),this[R]=0};for(v=0;v<W;v++)switch(h=f[v],B){case Iv.START_BOUNDARY:if(G===P.length-2){if(h===bQ)D|=e1.LAST_BOUNDARY;else if(h!==qW)return;G++;break}else if(G-1===P.length-2){if(D&e1.LAST_BOUNDARY&&h===bQ)B=Iv.END,D=0;else if(!(D&e1.LAST_BOUNDARY)&&h===VW)G=0,H("onPartBegin"),B=Iv.HEADER_FIELD_START;else return;break}if(h!==P[G+2])G=-2;if(h===P[G+2])G++;break;case Iv.HEADER_FIELD_START:B=Iv.HEADER_FIELD,U("onHeaderField"),G=0;case Iv.HEADER_FIELD:if(h===qW){O("onHeaderField"),B=Iv.HEADERS_ALMOST_DONE;break}if(G++,h===bQ)break;if(h===uG){if(G===1)return;F("onHeaderField",!0),B=Iv.HEADER_VALUE_START;break}if($=aG(h),$<mG||$>rG)return;break;case Iv.HEADER_VALUE_START:if(h===bG)break;U("onHeaderValue"),B=Iv.HEADER_VALUE;case Iv.HEADER_VALUE:if(h===qW)F("onHeaderValue",!0),H("onHeaderEnd"),B=Iv.HEADER_VALUE_ALMOST_DONE;break;case Iv.HEADER_VALUE_ALMOST_DONE:if(h!==VW)return;B=Iv.HEADER_FIELD_START;break;case Iv.HEADERS_ALMOST_DONE:if(h!==VW)return;H("onHeadersEnd"),B=Iv.PART_DATA_START;break;case Iv.PART_DATA_START:B=Iv.PART_DATA,U("onPartData");case Iv.PART_DATA:if(X=G,G===0){v+=A;while(v<N&&!(f[v]in w))v+=M;v-=A,h=f[v]}if(G<P.length)if(P[G]===h){if(G===0)F("onPartData",!0);G++}else G=0;else if(G===P.length)if(G++,h===qW)D|=e1.PART_BOUNDARY;else if(h===bQ)D|=e1.LAST_BOUNDARY;else G=0;else if(G-1===P.length)if(D&e1.PART_BOUNDARY){if(G=0,h===VW){D&=~e1.PART_BOUNDARY,H("onPartEnd"),H("onPartBegin"),B=Iv.HEADER_FIELD_START;break}}else if(D&e1.LAST_BOUNDARY)if(h===bQ)H("onPartEnd"),B=Iv.END,D=0;else G=0;else G=0;if(G>0)Q[G-1]=h;else if(X>0){let E=new Uint8Array(Q.buffer,Q.byteOffset,Q.byteLength);H("onPartData",0,X,E),X=0,U("onPartData"),v--}break;case Iv.END:break;default:throw new Error(`Unexpected state entered: ${B}`)}F("onHeaderField"),F("onHeaderValue"),F("onPartData"),this.index=G,this.state=B,this.flags=D}end(){if(this.state===Iv.HEADER_FIELD_START&&this.index===0||this.state===Iv.PART_DATA&&this.index===this.boundary.length)this.onPartEnd();else if(this.state!==Iv.END)throw new Error("MultipartParser.end(): stream ended unexpectedly")}}function cG(f){let v=f.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);if(!v)return;let W=v[2]||v[3]||"",X=W.slice(W.lastIndexOf("\\")+1);return X=X.replace(/%22/g,'"'),X=X.replace(/&#(\d{4});/g,(Q,P)=>{return String.fromCharCode(P)}),X}async function nG(f,v){if(!/multipart/i.test(v))throw new TypeError("Failed to fetch");let W=v.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!W)throw new TypeError("no or bad content-type header, no multipart boundary");let X=new pY(W[1]||W[2]),Q,P,w,G,B,D,M=[],A=new o1,N=(H)=>{w+=O.decode(H,{stream:!0})},h=(H)=>{M.push(H)},$=()=>{let H=new s1(M,D,{type:B});A.append(G,H)},U=()=>{A.append(G,w)},O=new TextDecoder("utf-8");O.decode(),X.onPartBegin=function(){X.onPartData=N,X.onPartEnd=U,Q="",P="",w="",G="",B="",D=null,M.length=0},X.onHeaderField=function(H){Q+=O.decode(H,{stream:!0})},X.onHeaderValue=function(H){P+=O.decode(H,{stream:!0})},X.onHeaderEnd=function(){if(P+=O.decode(),Q=Q.toLowerCase(),Q==="content-disposition"){let H=P.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);if(H)G=H[2]||H[3]||"";if(D=cG(P),D)X.onPartData=h,X.onPartEnd=$}else if(Q==="content-type")B=P;P="",Q=""};for await(let H of f)X.write(H);return X.end(),A}var D1=0,Iv,nY=1,e1,VW=10,qW=13,bG=32,bQ=45,uG=58,mG=97,rG=122,aG=(f)=>f|32,E0=()=>{};var dY=jv(()=>{dJ();$W();Iv={START_BOUNDARY:D1++,HEADER_FIELD_START:D1++,HEADER_FIELD:D1++,HEADER_VALUE_START:D1++,HEADER_VALUE:D1++,HEADER_VALUE_ALMOST_DONE:D1++,HEADERS_ALMOST_DONE:D1++,PART_DATA_START:D1++,PART_DATA:D1++,END:D1++},e1={PART_BOUNDARY:nY,LAST_BOUNDARY:nY*=2}});class R1{constructor(f,{size:v=0}={}){let W=null;if(f===null)f=null;else if(pJ(f))f=Ff.Buffer.from(f.toString());else if(lQ(f));else if(Ff.Buffer.isBuffer(f));else if(_1.types.isAnyArrayBuffer(f))f=Ff.Buffer.from(f);else if(ArrayBuffer.isView(f))f=Ff.Buffer.from(f.buffer,f.byteOffset,f.byteLength);else if(f instanceof lf.default);else if(f instanceof o1)f=kY(f),W=f.type.split("=")[1];else f=Ff.Buffer.from(String(f));let X=f;if(Ff.Buffer.isBuffer(f))X=lf.default.Readable.from(f);else if(lQ(f))X=lf.default.Readable.from(f.stream());if(this[Ef]={body:f,stream:X,boundary:W,disturbed:!1,error:null},this.size=v,f instanceof lf.default)f.on("error",(Q)=>{let P=Q instanceof t1?Q:new Nf(`Invalid response body while trying to fetch ${this.url}: ${Q.message}`,"system",Q);this[Ef].error=P})}get body(){return this[Ef].stream}get bodyUsed(){return this[Ef].disturbed}async arrayBuffer(){let{buffer:f,byteOffset:v,byteLength:W}=await sJ(this);return f.slice(v,v+W)}async formData(){let f=this.headers.get("content-type");if(f.startsWith("application/x-www-form-urlencoded")){let W=new o1,X=new URLSearchParams(await this.text());for(let[Q,P]of X)W.append(Q,P);return W}let{toFormData:v}=await Promise.resolve().then(() => (dY(),iY));return v(this.body,f)}async blob(){let f=this.headers&&this.headers.get("content-type")||this[Ef].body&&this[Ef].body.type||"",v=await this.arrayBuffer();return new ef([v],{type:f})}async json(){let f=await this.text();return JSON.parse(f)}async text(){let f=await sJ(this);return new TextDecoder().decode(f)}buffer(){return sJ(this)}}async function sJ(f){if(f[Ef].disturbed)throw new TypeError(`body used already for: ${f.url}`);if(f[Ef].disturbed=!0,f[Ef].error)throw f[Ef].error;let{body:v}=f;if(v===null)return Ff.Buffer.alloc(0);if(!(v instanceof lf.default))return Ff.Buffer.alloc(0);let W=[],X=0;try{for await(let Q of v){if(f.size>0&&X+Q.length>f.size){let P=new Nf(`content size at ${f.url} over limit: ${f.size}`,"max-size");throw v.destroy(P),P}X+=Q.length,W.push(Q)}}catch(Q){throw Q instanceof t1?Q:new Nf(`Invalid response body while trying to fetch ${f.url}: ${Q.message}`,"system",Q)}if(v.readableEnded===!0||v._readableState.ended===!0)try{if(W.every((Q)=>typeof Q==="string"))return Ff.Buffer.from(W.join(""));return Ff.Buffer.concat(W,X)}catch(Q){throw new Nf(`Could not create Buffer from response body for ${f.url}: ${Q.message}`,"system",Q)}else throw new Nf(`Premature close of server response while trying to fetch ${f.url}`)}var lf,_1,Ff,pG,Ef,QQ=(f,v)=>{let W,X,{body:Q}=f[Ef];if(f.bodyUsed)throw new Error("cannot clone body after it is used");if(Q instanceof lf.default&&typeof Q.getBoundary!=="function")W=new lf.PassThrough({highWaterMark:v}),X=new lf.PassThrough({highWaterMark:v}),Q.pipe(W),Q.pipe(X),f[Ef].stream=W,Q=X;return Q},iG,NW=(f,v)=>{if(f===null)return null;if(typeof f==="string")return"text/plain;charset=UTF-8";if(pJ(f))return"application/x-www-form-urlencoded;charset=UTF-8";if(lQ(f))return f.type||null;if(Ff.Buffer.isBuffer(f)||_1.types.isAnyArrayBuffer(f)||ArrayBuffer.isView(f))return null;if(f instanceof o1)return`multipart/form-data; boundary=${v[Ef].boundary}`;if(f&&typeof f.getBoundary==="function")return`multipart/form-data;boundary=${iG(f)}`;if(f instanceof lf.default)return null;return"text/plain;charset=UTF-8"},sY=(f)=>{let{body:v}=f[Ef];if(v===null)return 0;if(lQ(v))return v.size;if(Ff.Buffer.isBuffer(v))return v.length;if(v&&typeof v.getLengthSync==="function")return v.hasKnownLength&&v.hasKnownLength()?v.getLengthSync():null;return null},oY=async(f,{body:v})=>{if(v===null)f.end();else await pG(v,f)};var EW=jv(()=>{lf=Hf(require("node:stream")),_1=require("node:util"),Ff=require("node:buffer");TQ();$W();nJ();DW();OW();pG=_1.promisify(lf.default.pipeline),Ef=Symbol("Body internals");R1.prototype.buffer=_1.deprecate(R1.prototype.buffer,"Please use 'response.arrayBuffer()' instead of 'response.buffer()'","node-fetch#buffer");Object.defineProperties(R1.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:_1.deprecate(()=>{},"data doesn't exist, use json(), text(), arrayBuffer(), or body instead","https://github.com/node-fetch/node-fetch/issues/1000 (response)")}});iG=_1.deprecate((f)=>f.getBoundary(),"form-data doesn't follow the spec and requires special treatment. Use alternative package","https://github.com/node-fetch/node-fetch/issues/1167")});function tY(f=[]){return new Af(f.reduce((v,W,X,Q)=>{if(X%2===0)v.push(Q.slice(X,X+2));return v},[]).filter(([v,W])=>{try{return AW(v),tJ(v,String(W)),!0}catch{return!1}}))}var oJ,uQ,AW,tJ,Af;var UW=jv(()=>{oJ=require("node:util"),uQ=Hf(require("node:http")),AW=typeof uQ.default.validateHeaderName==="function"?uQ.default.validateHeaderName:(f)=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(f)){let v=new TypeError(`Header name must be a valid HTTP token [${f}]`);throw Object.defineProperty(v,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),v}},tJ=typeof uQ.default.validateHeaderValue==="function"?uQ.default.validateHeaderValue:(f,v)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(v)){let W=new TypeError(`Invalid character in header content ["${f}"]`);throw Object.defineProperty(W,"code",{value:"ERR_INVALID_CHAR"}),W}};Af=class Af extends URLSearchParams{constructor(f){let v=[];if(f instanceof Af){let W=f.raw();for(let[X,Q]of Object.entries(W))v.push(...Q.map((P)=>[X,P]))}else if(f==null);else if(typeof f==="object"&&!oJ.types.isBoxedPrimitive(f)){let W=f[Symbol.iterator];if(W==null)v.push(...Object.entries(f));else{if(typeof W!=="function")throw new TypeError("Header pairs must be iterable");v=[...f].map((X)=>{if(typeof X!=="object"||oJ.types.isBoxedPrimitive(X))throw new TypeError("Each header pair must be an iterable object");return[...X]}).map((X)=>{if(X.length!==2)throw new TypeError("Each header pair must be a name/value tuple");return[...X]})}}else throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");v=v.length>0?v.map(([W,X])=>{return AW(W),tJ(W,String(X)),[String(W).toLowerCase(),String(X)]}):void 0;super(v);return new Proxy(this,{get(W,X,Q){switch(X){case"append":case"set":return(P,w)=>{return AW(P),tJ(P,String(w)),URLSearchParams.prototype[X].call(W,String(P).toLowerCase(),String(w))};case"delete":case"has":case"getAll":return(P)=>{return AW(P),URLSearchParams.prototype[X].call(W,String(P).toLowerCase())};case"keys":return()=>{return W.sort(),new Set(URLSearchParams.prototype.keys.call(W)).keys()};default:return Reflect.get(W,X,Q)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(f){let v=this.getAll(f);if(v.length===0)return null;let W=v.join(", ");if(/^content-encoding$/i.test(f))W=W.toLowerCase();return W}forEach(f,v=void 0){for(let W of this.keys())Reflect.apply(f,v,[this.get(W),W,this])}*values(){for(let f of this.keys())yield this.get(f)}*entries(){for(let f of this.keys())yield[f,this.get(f)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce((f,v)=>{return f[v]=this.getAll(v),f},{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce((f,v)=>{let W=this.getAll(v);if(v==="host")f[v]=W[0];else f[v]=W.length>1?W:W[0];return f},{})}};Object.defineProperties(Af.prototype,["get","entries","forEach","values"].reduce((f,v)=>{return f[v]={enumerable:!0},f},{}))});var dG,mQ=(f)=>{return dG.has(f)};var eJ=jv(()=>{dG=new Set([301,302,303,307,308])});var v1,zf;var eY=jv(()=>{UW();EW();eJ();v1=Symbol("Response internals");zf=class zf extends R1{constructor(f=null,v={}){super(f,v);let W=v.status!=null?v.status:200,X=new Af(v.headers);if(f!==null&&!X.has("Content-Type")){let Q=NW(f,this);if(Q)X.append("Content-Type",Q)}this[v1]={type:"default",url:v.url,status:W,statusText:v.statusText||"",headers:X,counter:v.counter,highWaterMark:v.highWaterMark}}get type(){return this[v1].type}get url(){return this[v1].url||""}get status(){return this[v1].status}get ok(){return this[v1].status>=200&&this[v1].status<300}get redirected(){return this[v1].counter>0}get statusText(){return this[v1].statusText}get headers(){return this[v1].headers}get highWaterMark(){return this[v1].highWaterMark}clone(){return new zf(QQ(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(f,v=302){if(!mQ(v))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new zf(null,{headers:{location:new URL(f).toString()},status:v})}static error(){let f=new zf(null,{status:0,statusText:""});return f[v1].type="error",f}static json(f=void 0,v={}){let W=JSON.stringify(f);if(W===void 0)throw new TypeError("data is not JSON serializable");let X=new Af(v&&v.headers);if(!X.has("content-type"))X.set("content-type","application/json");return new zf(W,{...v,headers:X})}get[Symbol.toStringTag](){return"Response"}};Object.defineProperties(zf.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}})});var v4=(f)=>{if(f.search)return f.search;let v=f.href.length-1,W=f.hash||(f.href[v]==="#"?"#":"");return f.href[v-W.length]==="?"?"?":""};function f4(f,v=!1){if(f==null)return"no-referrer";if(f=new URL(f),/^(about|blob|data):$/.test(f.protocol))return"no-referrer";if(f.username="",f.password="",f.hash="",v)f.pathname="",f.search="";return f}function X4(f){if(!W4.has(f))throw new TypeError(`Invalid referrerPolicy: ${f}`);return f}function sG(f){if(/^(http|ws)s:$/.test(f.protocol))return!0;let v=f.host.replace(/(^\[)|(]$)/g,""),W=Q4.isIP(v);if(W===4&&/^127\./.test(v))return!0;if(W===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(v))return!0;if(f.host==="localhost"||f.host.endsWith(".localhost"))return!1;if(f.protocol==="file:")return!0;return!1}function WQ(f){if(/^about:(blank|srcdoc)$/.test(f))return!0;if(f.protocol==="data:")return!0;if(/^(blob|filesystem):$/.test(f.protocol))return!0;return sG(f)}function P4(f,{referrerURLCallback:v,referrerOriginCallback:W}={}){if(f.referrer==="no-referrer"||f.referrerPolicy==="")return null;let X=f.referrerPolicy;if(f.referrer==="about:client")return"no-referrer";let Q=f.referrer,P=f4(Q),w=f4(Q,!0);if(P.toString().length>4096)P=w;if(v)P=v(P);if(W)w=W(w);let G=new URL(f.url);switch(X){case"no-referrer":return"no-referrer";case"origin":return w;case"unsafe-url":return P;case"strict-origin":if(WQ(P)&&!WQ(G))return"no-referrer";return w.toString();case"strict-origin-when-cross-origin":if(P.origin===G.origin)return P;if(WQ(P)&&!WQ(G))return"no-referrer";return w;case"same-origin":if(P.origin===G.origin)return P;return"no-referrer";case"origin-when-cross-origin":if(P.origin===G.origin)return P;return w;case"no-referrer-when-downgrade":if(WQ(P)&&!WQ(G))return"no-referrer";return P;default:throw new TypeError(`Invalid referrerPolicy: ${X}`)}}function Y4(f){let v=(f.get("referrer-policy")||"").split(/[,\s]+/),W="";for(let X of v)if(X&&W4.has(X))W=X;return W}var Q4,W4,J4="strict-origin-when-cross-origin";var v9=jv(()=>{Q4=require("node:net");W4=new Set(["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"])});var w4,G4,ev,rQ=(f)=>{return typeof f==="object"&&typeof f[ev]==="object"},oG,v0,z4=(f)=>{let{parsedURL:v}=f[ev],W=new Af(f[ev].headers);if(!W.has("Accept"))W.set("Accept","*/*");let X=null;if(f.body===null&&/^(post|put)$/i.test(f.method))X="0";if(f.body!==null){let G=sY(f);if(typeof G==="number"&&!Number.isNaN(G))X=String(G)}if(X)W.set("Content-Length",X);if(f.referrerPolicy==="")f.referrerPolicy=J4;if(f.referrer&&f.referrer!=="no-referrer")f[ev].referrer=P4(f);else f[ev].referrer="no-referrer";if(f[ev].referrer instanceof URL)W.set("Referer",f.referrer);if(!W.has("User-Agent"))W.set("User-Agent","node-fetch");if(f.compress&&!W.has("Accept-Encoding"))W.set("Accept-Encoding","gzip, deflate, br");let{agent:Q}=f;if(typeof Q==="function")Q=Q(v);let P=v4(v),w={path:v.pathname+P,method:f.method,headers:W[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:f.insecureHTTPParser,agent:Q};return{parsedURL:v,options:w}};var B4=jv(()=>{w4=require("node:url"),G4=require("node:util");UW();EW();OW();v9();ev=Symbol("Request internals"),oG=G4.deprecate(()=>{},".data is not a valid RequestInit property, use .body instead","https://github.com/node-fetch/node-fetch/issues/1000 (request)");v0=class v0 extends R1{constructor(f,v={}){let W;if(rQ(f))W=new URL(f.url);else W=new URL(f),f={};if(W.username!==""||W.password!=="")throw new TypeError(`${W} is an url with embedded credentials.`);let X=v.method||f.method||"GET";if(/^(delete|get|head|options|post|put)$/i.test(X))X=X.toUpperCase();if(!rQ(v)&&"data"in v)oG();if((v.body!=null||rQ(f)&&f.body!==null)&&(X==="GET"||X==="HEAD"))throw new TypeError("Request with GET/HEAD method cannot have body");let Q=v.body?v.body:rQ(f)&&f.body!==null?QQ(f):null;super(Q,{size:v.size||f.size||0});let P=new Af(v.headers||f.headers||{});if(Q!==null&&!P.has("Content-Type")){let B=NW(Q,this);if(B)P.set("Content-Type",B)}let w=rQ(f)?f.signal:null;if("signal"in v)w=v.signal;if(w!=null&&!IY(w))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");let G=v.referrer==null?f.referrer:v.referrer;if(G==="")G="no-referrer";else if(G){let B=new URL(G);G=/^about:(\/\/)?client$/.test(B)?"client":B}else G=void 0;this[ev]={method:X,redirect:v.redirect||f.redirect||"follow",headers:P,parsedURL:W,signal:w,referrer:G},this.follow=v.follow===void 0?f.follow===void 0?20:f.follow:v.follow,this.compress=v.compress===void 0?f.compress===void 0?!0:f.compress:v.compress,this.counter=v.counter||f.counter||0,this.agent=v.agent||f.agent,this.highWaterMark=v.highWaterMark||f.highWaterMark||16384,this.insecureHTTPParser=v.insecureHTTPParser||f.insecureHTTPParser||!1,this.referrerPolicy=v.referrerPolicy||f.referrerPolicy||""}get method(){return this[ev].method}get url(){return w4.format(this[ev].parsedURL)}get headers(){return this[ev].headers}get redirect(){return this[ev].redirect}get signal(){return this[ev].signal}get referrer(){if(this[ev].referrer==="no-referrer")return"";if(this[ev].referrer==="client")return"about:client";if(this[ev].referrer)return this[ev].referrer.toString();return}get referrerPolicy(){return this[ev].referrerPolicy}set referrerPolicy(f){this[ev].referrerPolicy=X4(f)}clone(){return new v0(this)}get[Symbol.toStringTag](){return"Request"}};Object.defineProperties(v0.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}})});var jW;var K4=jv(()=>{DW();jW=class jW extends t1{constructor(f,v="aborted"){super(f,v)}}});var Q9={};pW(Q9,{isRedirect:()=>mQ,fileFromSync:()=>rY,fileFrom:()=>mY,default:()=>f9,blobFromSync:()=>bY,blobFrom:()=>uY,Response:()=>zf,Request:()=>v0,Headers:()=>Af,FormData:()=>o1,File:()=>s1,FetchError:()=>Nf,Blob:()=>ef,AbortError:()=>jW});async function f9(f,v){return new Promise((W,X)=>{let Q=new v0(f,v),{parsedURL:P,options:w}=z4(Q);if(!tG.has(P.protocol))throw new TypeError(`node-fetch cannot load ${f}. URL scheme "${P.protocol.replace(/:$/,"")}" is not supported.`);if(P.protocol==="data:"){let $=AY(Q.url),U=new zf($,{headers:{"Content-Type":$.typeFull}});W(U);return}let G=(P.protocol==="https:"?$4.default:h4.default).request,{signal:B}=Q,D=null,M=()=>{let $=new jW("The operation was aborted.");if(X($),Q.body&&Q.body instanceof Lf.default.Readable)Q.body.destroy($);if(!D||!D.body)return;D.body.emit("error",$)};if(B&&B.aborted){M();return}let A=()=>{M(),h()},N=G(P.toString(),w);if(B)B.addEventListener("abort",A);let h=()=>{if(N.abort(),B)B.removeEventListener("abort",A)};if(N.on("error",($)=>{X(new Nf(`request to ${Q.url} failed, reason: ${$.message}`,"system",$)),h()}),eG(N,($)=>{if(D&&D.body)D.body.destroy($)}),process.version<"v14")N.on("socket",($)=>{let U;$.prependListener("end",()=>{U=$._eventsCount}),$.prependListener("close",(O)=>{if(D&&U<$._eventsCount&&!O){let H=new Error("Premature close");H.code="ERR_STREAM_PREMATURE_CLOSE",D.body.emit("error",H)}})});N.on("response",($)=>{N.setTimeout(0);let U=tY($.rawHeaders);if(mQ($.statusCode)){let L=U.get("Location"),R=null;try{R=L===null?null:new URL(L,Q.url)}catch{if(Q.redirect!=="manual"){X(new Nf(`uri requested responds with an invalid redirect URL: ${L}`,"invalid-redirect")),h();return}}switch(Q.redirect){case"error":X(new Nf(`uri requested responds with a redirect, redirect mode is set to error: ${Q.url}`,"no-redirect")),h();return;case"manual":break;case"follow":{if(R===null)break;if(Q.counter>=Q.follow){X(new Nf(`maximum redirect reached at: ${Q.url}`,"max-redirect")),h();return}let Z={headers:new Af(Q.headers),follow:Q.follow,counter:Q.counter+1,agent:Q.agent,compress:Q.compress,method:Q.method,body:QQ(Q),signal:Q.signal,size:Q.size,referrer:Q.referrer,referrerPolicy:Q.referrerPolicy};if(!ZY(Q.url,R)||!CY(Q.url,R))for(let x of["authorization","www-authenticate","cookie","cookie2"])Z.headers.delete(x);if($.statusCode!==303&&Q.body&&v.body instanceof Lf.default.Readable){X(new Nf("Cannot follow redirect with body being a readable stream","unsupported-redirect")),h();return}if($.statusCode===303||($.statusCode===301||$.statusCode===302)&&Q.method==="POST")Z.method="GET",Z.body=void 0,Z.headers.delete("content-length");let m=Y4(U);if(m)Z.referrerPolicy=m;W(f9(new v0(R,Z))),h();return}default:return X(new TypeError(`Redirect option '${Q.redirect}' is not a valid value of RequestRedirect`))}}if(B)$.once("end",()=>{B.removeEventListener("abort",A)});let O=Lf.pipeline($,new Lf.PassThrough,(L)=>{if(L)X(L)});if(process.version<"v12.10")$.on("aborted",A);let H={url:Q.url,status:$.statusCode,statusText:$.statusMessage,headers:U,size:Q.size,counter:Q.counter,highWaterMark:Q.highWaterMark},F=U.get("Content-Encoding");if(!Q.compress||Q.method==="HEAD"||F===null||$.statusCode===204||$.statusCode===304){D=new zf(O,H),W(D);return}let E={flush:A0.default.Z_SYNC_FLUSH,finishFlush:A0.default.Z_SYNC_FLUSH};if(F==="gzip"||F==="x-gzip"){O=Lf.pipeline(O,A0.default.createGunzip(E),(L)=>{if(L)X(L)}),D=new zf(O,H),W(D);return}if(F==="deflate"||F==="x-deflate"){let L=Lf.pipeline($,new Lf.PassThrough,(R)=>{if(R)X(R)});L.once("data",(R)=>{if((R[0]&15)===8)O=Lf.pipeline(O,A0.default.createInflate(),(Z)=>{if(Z)X(Z)});else O=Lf.pipeline(O,A0.default.createInflateRaw(),(Z)=>{if(Z)X(Z)});D=new zf(O,H),W(D)}),L.once("end",()=>{if(!D)D=new zf(O,H),W(D)});return}if(F==="br"){O=Lf.pipeline(O,A0.default.createBrotliDecompress(),(L)=>{if(L)X(L)}),D=new zf(O,H),W(D);return}D=new zf(O,H),W(D)}),oY(N,Q).catch(X)})}function eG(f,v){let W=aQ.Buffer.from(`0\r
14
+ \r
15
+ `),X=!1,Q=!1,P;f.on("response",(w)=>{let{headers:G}=w;X=G["transfer-encoding"]==="chunked"&&!G["content-length"]}),f.on("socket",(w)=>{let G=()=>{if(X&&!Q){let D=new Error("Premature close");D.code="ERR_STREAM_PREMATURE_CLOSE",v(D)}},B=(D)=>{if(Q=aQ.Buffer.compare(D.slice(-5),W)===0,!Q&&P)Q=aQ.Buffer.compare(P.slice(-3),W.slice(0,3))===0&&aQ.Buffer.compare(D.slice(-2),W.slice(3))===0;P=D};w.prependListener("close",G),w.on("data",B),f.on("close",()=>{w.removeListener("close",G),w.removeListener("data",B)})})}var h4,$4,A0,Lf,aQ,tG;var W9=jv(()=>{h4=Hf(require("node:http")),$4=Hf(require("node:https")),A0=Hf(require("node:zlib")),Lf=Hf(require("node:stream")),aQ=require("node:buffer");UY();EW();eY();UW();B4();nJ();K4();eJ();$W();OW();v9();dJ();tG=new Set(["data:","http:","https:"])});var q4=Qv((XD,V4)=>{(()=>{var f={52:(Q,P)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.ReportType=P.ReportUrl=void 0,P.ReportUrl="https://statistcs-hdpt.yy.com/reportGeneralStatistics";var w;(function(G){G.pluginOpenCount="f2c_plugin_open_count"})(w||(P.ReportType=w={}))},248:(Q)=>{Q.exports=(W9(),l5(Q9))},428:(Q,P,w)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.getGitUserInfo=B,P.getIsGitRepository=D,P.getUserInfoWithFallback=M;let G=w(646);function B(){let h={};try{let $=G.execSync("git config user.name",{encoding:"utf8"}).trim();if($)h.name=$;let U=G.execSync("git config user.email",{encoding:"utf8"}).trim();if(U)h.email=U}catch($){return h}return h}function D(){try{return G.execSync("git rev-parse --git-dir",{encoding:"utf8",stdio:"ignore"}),!0}catch(h){return!1}}function M(){if(D())try{let U=B(),O=U.email||U.name;if(O)return O}catch(U){}let h=A();if(h)return h;let $=N();if($)return $;return"f2c_匿名"}function A(){let h=["GIT_AUTHOR_EMAIL","GIT_COMMITTER_EMAIL","EMAIL","GIT_AUTHOR_NAME","GIT_COMMITTER_NAME","USER","USERNAME","LOGNAME"];for(let $ of h){let U=process.env[$];if(U&&U.trim())return U.trim()}return""}function N(){try{let h=G.execSync("whoami",{encoding:"utf8",timeout:5000}).trim();if(process.platform==="win32"&&h.includes("\\"))return h.split("\\").pop()||"";return h}catch(h){return""}}},445:(Q)=>{/*!
16
+ * Determine if an object is a Buffer
17
+ *
18
+ * @author Feross Aboukhadijeh <https://feross.org>
19
+ * @license MIT
20
+ */Q.exports=function(G){return G!=null&&(P(G)||w(G)||!!G._isBuffer)};function P(G){return!!G.constructor&&typeof G.constructor.isBuffer==="function"&&G.constructor.isBuffer(G)}function w(G){return typeof G.readFloatLE==="function"&&typeof G.slice==="function"&&P(G.slice(0,0))}},539:(Q)=>{var P={utf8:{stringToBytes:function(w){return P.bin.stringToBytes(unescape(encodeURIComponent(w)))},bytesToString:function(w){return decodeURIComponent(escape(P.bin.bytesToString(w)))}},bin:{stringToBytes:function(w){for(var G=[],B=0;B<w.length;B++)G.push(w.charCodeAt(B)&255);return G},bytesToString:function(w){for(var G=[],B=0;B<w.length;B++)G.push(String.fromCharCode(w[B]));return G.join("")}}};Q.exports=P},635:(Q)=>{(function(){var P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",w={rotl:function(G,B){return G<<B|G>>>32-B},rotr:function(G,B){return G<<32-B|G>>>B},endian:function(G){if(G.constructor==Number)return w.rotl(G,8)&16711935|w.rotl(G,24)&4278255360;for(var B=0;B<G.length;B++)G[B]=w.endian(G[B]);return G},randomBytes:function(G){for(var B=[];G>0;G--)B.push(Math.floor(Math.random()*256));return B},bytesToWords:function(G){for(var B=[],D=0,M=0;D<G.length;D++,M+=8)B[M>>>5]|=G[D]<<24-M%32;return B},wordsToBytes:function(G){for(var B=[],D=0;D<G.length*32;D+=8)B.push(G[D>>>5]>>>24-D%32&255);return B},bytesToHex:function(G){for(var B=[],D=0;D<G.length;D++)B.push((G[D]>>>4).toString(16)),B.push((G[D]&15).toString(16));return B.join("")},hexToBytes:function(G){for(var B=[],D=0;D<G.length;D+=2)B.push(parseInt(G.substr(D,2),16));return B},bytesToBase64:function(G){for(var B=[],D=0;D<G.length;D+=3){var M=G[D]<<16|G[D+1]<<8|G[D+2];for(var A=0;A<4;A++)if(D*8+A*6<=G.length*8)B.push(P.charAt(M>>>6*(3-A)&63));else B.push("=")}return B.join("")},base64ToBytes:function(G){G=G.replace(/[^A-Z0-9+\/]/ig,"");for(var B=[],D=0,M=0;D<G.length;M=++D%4){if(M==0)continue;B.push((P.indexOf(G.charAt(D-1))&Math.pow(2,-2*M+8)-1)<<M*2|P.indexOf(G.charAt(D))>>>6-M*2)}return B}};Q.exports=w})()},646:(Q)=>{Q.exports=require("child_process")},680:function(Q,P,w){var G=this&&this.__createBinding||(Object.create?function(h,$,U,O){if(O===void 0)O=U;var H=Object.getOwnPropertyDescriptor($,U);if(!H||("get"in H?!$.__esModule:H.writable||H.configurable))H={enumerable:!0,get:function(){return $[U]}};Object.defineProperty(h,O,H)}:function(h,$,U,O){if(O===void 0)O=U;h[O]=$[U]}),B=this&&this.__setModuleDefault||(Object.create?function(h,$){Object.defineProperty(h,"default",{enumerable:!0,value:$})}:function(h,$){h.default=$}),D=this&&this.__importStar||function(){var h=function($){return h=Object.getOwnPropertyNames||function(U){var O=[];for(var H in U)if(Object.prototype.hasOwnProperty.call(U,H))O[O.length]=H;return O},h($)};return function($){if($&&$.__esModule)return $;var U={};if($!=null){for(var O=h($),H=0;H<O.length;H++)if(O[H]!=="default")G(U,$,O[H])}return B(U,$),U}}();Object.defineProperty(P,"__esModule",{value:!0}),P.compatFetch=N;let M=null;async function A(){if(typeof global!=="undefined"&&global.fetch)return global.fetch;if(typeof globalThis.fetch!=="undefined")return globalThis.fetch;if(!M)try{M=await Promise.resolve().then(()=>D(w(248)))}catch(h){throw new Error("Neither native fetch nor node-fetch is available. Please install node-fetch or upgrade to Node.js 18+")}return M.default}async function N(h,$){return(await A())(h,$)}P.default=N},782:(Q,P)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.createLogger=P.Logger=P.isHttp=P.LogLevel=void 0;var w;(function(M){M[M.DEBUG=0]="DEBUG",M[M.INFO=1]="INFO",M[M.WARN=2]="WARN",M[M.ERROR=3]="ERROR"})(w||(P.LogLevel=w={}));function G(){let M=process.argv.join(" ");return M.includes("streamable-http.js")||M.includes("streamable-http.ts")}P.isHttp=G();class B{constructor(M,A=w.INFO){this.context=M,this.level=A}setLevel(M){this.level=M}log(...M){if(P.isHttp)console.log(...M);else console.error(...M)}logWarn(...M){if(P.isHttp)console.warn(...M);else console.error(...M)}debug(...M){if(this.level<=w.DEBUG)this.log(`[DEBUG] [${this.context}]`,...M)}info(...M){if(this.level<=w.INFO)this.log(`[INFO] [${this.context}]`,...M)}warn(...M){if(this.level<=w.WARN)this.logWarn(`[WARN] [${this.context}]`,...M)}error(...M){if(this.level<=w.ERROR)console.error(`[ERROR] [${this.context}]`,...M)}}P.Logger=B;let D=(M,A=w.INFO)=>new B(M,A);P.createLogger=D},799:(Q,P)=>{Object.defineProperty(P,"__esModule",{value:!0}),P.detectIDE=w;function w(){try{let G=process.env,B=()=>{try{if(typeof globalThis!=="undefined"){if(globalThis.vscode||globalThis.__vscode_extension_context||globalThis.acquireVsCodeApi)return!0}}catch{}try{if(process&&process.env){if(process.env.VSCODE_EXTENSION_ID||process.env.VSCODE_EXTENSION_VERSION||process.env.npm_config_user_agent&&process.env.npm_config_user_agent.includes("vscode"))return!0}}catch{}try{if(process&&process.argv){let N=process.argv.join(" ");if(N.includes("extensionHost")||N.includes("vscode")||N.includes("code.exe"))return!0}if(process.title&&(process.title.includes("Code")||process.title.includes("vscode")||process.title.includes("extensionHost")))return!0}catch{}return!1},D=process.cwd().toLowerCase(),M="other";if([D.includes("codebuddy"),G.CODEBUDDY_VERSION!==void 0,G.CODEBUDDY_MODE!==void 0,process.title?.toLowerCase().includes("codebuddy"),typeof globalThis!=="undefined"&&globalThis.CODEBUDDY_CONTEXT!==void 0].some((N)=>N))M="codeBuddy";else if(G?.VSCODE_CWD?.toLowerCase().includes("trae")||D.includes("trae"))M="trae";else if(G?.IDE?.toLowerCase().includes("comate")||G?.VSCODE_CWD?.toLowerCase().includes("comate")||D.includes("comate"))M="comate";else if(G?.CURSOR_USER_DATA_DIR!==void 0||G?.VSCODE_CWD?.toLowerCase().includes("cursor")||D.includes("cursor"))M="cursor";else if(G?.VSCODE_CWD!==void 0||G?.VSCODE_PID!==void 0||G?.VSCODE_IPC_HOOK!==void 0||G?.VSCODE_IPC_HOOK_EXTHOST!==void 0||B())M="vscode";else if(G?.PATH?.includes("Microsoft VS Code")&&!D.includes("cursor")&&!D.includes("comate")&&!D.includes("codebuddy")&&!D.includes("trae"))M="vscode";return M}catch(G){return"other"}}},867:function(Q,P,w){var G=this&&this.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(P,"__esModule",{value:!0}),P.f2cDataReport=O,P.addParamsToUrl=H,P.reportMcpLoader=E,P.reportPTDMcpLoader=L;let B=w(680),D=w(428),M=w(782),A=w(52),N=w(799),h=G(w(892)),$=M.createLogger("F2c-Report");function U(R){return(Z,m)=>{let x=new AbortController;m=m||{},m.signal=x.signal;let y=setTimeout(()=>{clearTimeout(y),x.abort()},R);return B.compatFetch(A.ReportUrl,m)}}async function O(R,Z,m,x){let y="",a=D.getGitUserInfo();y=a.name?a.name+"-"+a.email:a.email?a.email:"f2c_匿名";let p={...x,account:y,appid:1,dataType:R,data_type:R,dim1:y,dim3:Z,value1:m};F("webhdf2cgeneralstatistics",p,!1)}function H(R,Z){try{let m=new URL(R);return Object.keys(Z).forEach((x)=>{let y=Z[x];if(y!==null&&y!==void 0)m.searchParams.append(x,String(y))}),m.toString()}catch(m){let x=Object.keys(Z).filter((a)=>Z[a]!==null&&Z[a]!==void 0).map((a)=>`${encodeURIComponent(a)}=${encodeURIComponent(String(Z[a]))}`).join("&"),y=R.includes("?")?"&":"?";return x?`${R}${y}${x}`:R}}function F(R,Z,m){try{let x=Math.floor(new Date().getTime()/1000),y=R+x+"HiidoYYSystem",a=h.default(y),p=Object.assign({time:x},Z),i="mlog.bigda.com",T=H("https://mlog.bigda.com/c.gif?act="+R+"&key="+a,p);B.compatFetch(T,{method:"GET"}).then(async(b)=>{if(b&&b.status!=200)$.log("上报失败",b.status);else $.log("上报成功")})}catch(x){}}async function E(){try{let R=N.detectIDE();return $.log("当前运行环境",R),O(A.ReportType.pluginOpenCount,"",1,{dim5:"f2c-mcp-"+R}),R}catch(R){}}async function L(){try{let R=N.detectIDE();return $.log("当前运行环境",R),O(A.ReportType.pluginOpenCount,"",1,{dim5:"f2c-ptd-mcp-"+R}),R}catch(R){}}},892:(Q,P,w)=>{(function(){var G=w(635),B=w(539).utf8,D=w(445),M=w(539).bin,A=function(N,h){if(N.constructor==String)if(h&&h.encoding==="binary")N=M.stringToBytes(N);else N=B.stringToBytes(N);else if(D(N))N=Array.prototype.slice.call(N,0);else if(!Array.isArray(N)&&N.constructor!==Uint8Array)N=N.toString();var $=G.bytesToWords(N),U=N.length*8,O=1732584193,H=-271733879,F=-1732584194,E=271733878;for(var L=0;L<$.length;L++)$[L]=($[L]<<8|$[L]>>>24)&16711935|($[L]<<24|$[L]>>>8)&4278255360;$[U>>>5]|=128<<U%32,$[(U+64>>>9<<4)+14]=U;var{_ff:R,_gg:Z,_hh:m,_ii:x}=A;for(var L=0;L<$.length;L+=16){var y=O,a=H,p=F,i=E;O=R(O,H,F,E,$[L+0],7,-680876936),E=R(E,O,H,F,$[L+1],12,-389564586),F=R(F,E,O,H,$[L+2],17,606105819),H=R(H,F,E,O,$[L+3],22,-1044525330),O=R(O,H,F,E,$[L+4],7,-176418897),E=R(E,O,H,F,$[L+5],12,1200080426),F=R(F,E,O,H,$[L+6],17,-1473231341),H=R(H,F,E,O,$[L+7],22,-45705983),O=R(O,H,F,E,$[L+8],7,1770035416),E=R(E,O,H,F,$[L+9],12,-1958414417),F=R(F,E,O,H,$[L+10],17,-42063),H=R(H,F,E,O,$[L+11],22,-1990404162),O=R(O,H,F,E,$[L+12],7,1804603682),E=R(E,O,H,F,$[L+13],12,-40341101),F=R(F,E,O,H,$[L+14],17,-1502002290),H=R(H,F,E,O,$[L+15],22,1236535329),O=Z(O,H,F,E,$[L+1],5,-165796510),E=Z(E,O,H,F,$[L+6],9,-1069501632),F=Z(F,E,O,H,$[L+11],14,643717713),H=Z(H,F,E,O,$[L+0],20,-373897302),O=Z(O,H,F,E,$[L+5],5,-701558691),E=Z(E,O,H,F,$[L+10],9,38016083),F=Z(F,E,O,H,$[L+15],14,-660478335),H=Z(H,F,E,O,$[L+4],20,-405537848),O=Z(O,H,F,E,$[L+9],5,568446438),E=Z(E,O,H,F,$[L+14],9,-1019803690),F=Z(F,E,O,H,$[L+3],14,-187363961),H=Z(H,F,E,O,$[L+8],20,1163531501),O=Z(O,H,F,E,$[L+13],5,-1444681467),E=Z(E,O,H,F,$[L+2],9,-51403784),F=Z(F,E,O,H,$[L+7],14,1735328473),H=Z(H,F,E,O,$[L+12],20,-1926607734),O=m(O,H,F,E,$[L+5],4,-378558),E=m(E,O,H,F,$[L+8],11,-2022574463),F=m(F,E,O,H,$[L+11],16,1839030562),H=m(H,F,E,O,$[L+14],23,-35309556),O=m(O,H,F,E,$[L+1],4,-1530992060),E=m(E,O,H,F,$[L+4],11,1272893353),F=m(F,E,O,H,$[L+7],16,-155497632),H=m(H,F,E,O,$[L+10],23,-1094730640),O=m(O,H,F,E,$[L+13],4,681279174),E=m(E,O,H,F,$[L+0],11,-358537222),F=m(F,E,O,H,$[L+3],16,-722521979),H=m(H,F,E,O,$[L+6],23,76029189),O=m(O,H,F,E,$[L+9],4,-640364487),E=m(E,O,H,F,$[L+12],11,-421815835),F=m(F,E,O,H,$[L+15],16,530742520),H=m(H,F,E,O,$[L+2],23,-995338651),O=x(O,H,F,E,$[L+0],6,-198630844),E=x(E,O,H,F,$[L+7],10,1126891415),F=x(F,E,O,H,$[L+14],15,-1416354905),H=x(H,F,E,O,$[L+5],21,-57434055),O=x(O,H,F,E,$[L+12],6,1700485571),E=x(E,O,H,F,$[L+3],10,-1894986606),F=x(F,E,O,H,$[L+10],15,-1051523),H=x(H,F,E,O,$[L+1],21,-2054922799),O=x(O,H,F,E,$[L+8],6,1873313359),E=x(E,O,H,F,$[L+15],10,-30611744),F=x(F,E,O,H,$[L+6],15,-1560198380),H=x(H,F,E,O,$[L+13],21,1309151649),O=x(O,H,F,E,$[L+4],6,-145523070),E=x(E,O,H,F,$[L+11],10,-1120210379),F=x(F,E,O,H,$[L+2],15,718787259),H=x(H,F,E,O,$[L+9],21,-343485551),O=O+y>>>0,H=H+a>>>0,F=F+p>>>0,E=E+i>>>0}return G.endian([O,H,F,E])};A._ff=function(N,h,$,U,O,H,F){var E=N+(h&$|~h&U)+(O>>>0)+F;return(E<<H|E>>>32-H)+h},A._gg=function(N,h,$,U,O,H,F){var E=N+(h&U|$&~U)+(O>>>0)+F;return(E<<H|E>>>32-H)+h},A._hh=function(N,h,$,U,O,H,F){var E=N+(h^$^U)+(O>>>0)+F;return(E<<H|E>>>32-H)+h},A._ii=function(N,h,$,U,O,H,F){var E=N+($^(h|~U))+(O>>>0)+F;return(E<<H|E>>>32-H)+h},A._blocksize=16,A._digestsize=16,Q.exports=function(N,h){if(N===void 0||N===null)throw new Error("Illegal argument "+N);var $=G.wordsToBytes(A(N,h));return h&&h.asBytes?$:h&&h.asString?M.bytesToString($):G.bytesToHex($)}})()}},v={};function W(Q){var P=v[Q];if(P!==void 0)return P.exports;var w=v[Q]={exports:{}};return f[Q].call(w.exports,w,w.exports,W),w.exports}var X={};(()=>{var Q=X;Object.defineProperty(Q,"__esModule",{value:!0}),Q.ReportType=Q.addParamsToUrl=Q.reportPTDMcpLoader=Q.reportMcpLoader=Q.f2cDataReport=void 0;var P=W(867);Object.defineProperty(Q,"f2cDataReport",{enumerable:!0,get:function(){return P.f2cDataReport}}),Object.defineProperty(Q,"reportMcpLoader",{enumerable:!0,get:function(){return P.reportMcpLoader}}),Object.defineProperty(Q,"reportPTDMcpLoader",{enumerable:!0,get:function(){return P.reportPTDMcpLoader}}),Object.defineProperty(Q,"addParamsToUrl",{enumerable:!0,get:function(){return P.addParamsToUrl}});var w=W(52);Object.defineProperty(Q,"ReportType",{enumerable:!0,get:function(){return w.ReportType}})})(),V4.exports=X})()});IQ();var l2=60000;class zJ{constructor(f){this._options=f,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.setNotificationHandler(S8,(v)=>{let W=this._requestHandlerAbortControllers.get(v.params.requestId);W===null||W===void 0||W.abort(v.params.reason)}),this.setNotificationHandler(_8,(v)=>{this._onprogress(v)}),this.setRequestHandler(R8,(v)=>({}))}_setupTimeout(f,v,W,X,Q=!1){this._timeoutInfo.set(f,{timeoutId:setTimeout(X,v),startTime:Date.now(),timeout:v,maxTotalTimeout:W,resetTimeoutOnProgress:Q,onTimeout:X})}_resetTimeout(f){let v=this._timeoutInfo.get(f);if(!v)return!1;let W=Date.now()-v.startTime;if(v.maxTotalTimeout&&W>=v.maxTotalTimeout)throw this._timeoutInfo.delete(f),new Tv(kv.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:v.maxTotalTimeout,totalElapsed:W});return clearTimeout(v.timeoutId),v.timeoutId=setTimeout(v.onTimeout,v.timeout),!0}_cleanupTimeout(f){let v=this._timeoutInfo.get(f);if(v)clearTimeout(v.timeoutId),this._timeoutInfo.delete(f)}async connect(f){var v,W,X;this._transport=f;let Q=(v=this.transport)===null||v===void 0?void 0:v.onclose;this._transport.onclose=()=>{Q===null||Q===void 0||Q(),this._onclose()};let P=(W=this.transport)===null||W===void 0?void 0:W.onerror;this._transport.onerror=(G)=>{P===null||P===void 0||P(G),this._onerror(G)};let w=(X=this._transport)===null||X===void 0?void 0:X.onmessage;this._transport.onmessage=(G,B)=>{if(w===null||w===void 0||w(G,B),fJ(G)||U6(G))this._onresponse(G);else if(V6(G))this._onrequest(G,B);else if(N6(G))this._onnotification(G);else this._onerror(new Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){var f;let v=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear(),this._transport=void 0,(f=this.onclose)===null||f===void 0||f.call(this);let W=new Tv(kv.ConnectionClosed,"Connection closed");for(let X of v.values())X(W)}_onerror(f){var v;(v=this.onerror)===null||v===void 0||v.call(this,f)}_onnotification(f){var v;let W=(v=this._notificationHandlers.get(f.method))!==null&&v!==void 0?v:this.fallbackNotificationHandler;if(W===void 0)return;Promise.resolve().then(()=>W(f)).catch((X)=>this._onerror(new Error(`Uncaught error in notification handler: ${X}`)))}_onrequest(f,v){var W,X;let Q=(W=this._requestHandlers.get(f.method))!==null&&W!==void 0?W:this.fallbackRequestHandler,P=this._transport;if(Q===void 0){P===null||P===void 0||P.send({jsonrpc:"2.0",id:f.id,error:{code:kv.MethodNotFound,message:"Method not found"}}).catch((B)=>this._onerror(new Error(`Failed to send an error response: ${B}`)));return}let w=new AbortController;this._requestHandlerAbortControllers.set(f.id,w);let G={signal:w.signal,sessionId:P===null||P===void 0?void 0:P.sessionId,_meta:(X=f.params)===null||X===void 0?void 0:X._meta,sendNotification:(B)=>this.notification(B,{relatedRequestId:f.id}),sendRequest:(B,D,M)=>this.request(B,D,{...M,relatedRequestId:f.id}),authInfo:v===null||v===void 0?void 0:v.authInfo,requestId:f.id,requestInfo:v===null||v===void 0?void 0:v.requestInfo};Promise.resolve().then(()=>Q(f,G)).then((B)=>{if(w.signal.aborted)return;return P===null||P===void 0?void 0:P.send({result:B,jsonrpc:"2.0",id:f.id})},(B)=>{var D;if(w.signal.aborted)return;return P===null||P===void 0?void 0:P.send({jsonrpc:"2.0",id:f.id,error:{code:Number.isSafeInteger(B.code)?B.code:kv.InternalError,message:(D=B.message)!==null&&D!==void 0?D:"Internal error"}})}).catch((B)=>this._onerror(new Error(`Failed to send response: ${B}`))).finally(()=>{this._requestHandlerAbortControllers.delete(f.id)})}_onprogress(f){let{progressToken:v,...W}=f.params,X=Number(v),Q=this._progressHandlers.get(X);if(!Q){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(f)}`));return}let P=this._responseHandlers.get(X),w=this._timeoutInfo.get(X);if(w&&P&&w.resetTimeoutOnProgress)try{this._resetTimeout(X)}catch(G){P(G);return}Q(W)}_onresponse(f){let v=Number(f.id),W=this._responseHandlers.get(v);if(W===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(f)}`));return}if(this._responseHandlers.delete(v),this._progressHandlers.delete(v),this._cleanupTimeout(v),fJ(f))W(f);else{let X=new Tv(f.error.code,f.error.message,f.error.data);W(X)}}get transport(){return this._transport}async close(){var f;await((f=this._transport)===null||f===void 0?void 0:f.close())}request(f,v,W){let{relatedRequestId:X,resumptionToken:Q,onresumptiontoken:P}=W!==null&&W!==void 0?W:{};return new Promise((w,G)=>{var B,D,M,A,N,h;if(!this._transport){G(new Error("Not connected"));return}if(((B=this._options)===null||B===void 0?void 0:B.enforceStrictCapabilities)===!0)this.assertCapabilityForMethod(f.method);(D=W===null||W===void 0?void 0:W.signal)===null||D===void 0||D.throwIfAborted();let $=this._requestMessageId++,U={...f,jsonrpc:"2.0",id:$};if(W===null||W===void 0?void 0:W.onprogress)this._progressHandlers.set($,W.onprogress),U.params={...f.params,_meta:{...((M=f.params)===null||M===void 0?void 0:M._meta)||{},progressToken:$}};let O=(E)=>{var L;this._responseHandlers.delete($),this._progressHandlers.delete($),this._cleanupTimeout($),(L=this._transport)===null||L===void 0||L.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:$,reason:String(E)}},{relatedRequestId:X,resumptionToken:Q,onresumptiontoken:P}).catch((R)=>this._onerror(new Error(`Failed to send cancellation: ${R}`))),G(E)};this._responseHandlers.set($,(E)=>{var L;if((L=W===null||W===void 0?void 0:W.signal)===null||L===void 0?void 0:L.aborted)return;if(E instanceof Error)return G(E);try{let R=v.parse(E.result);w(R)}catch(R){G(R)}}),(A=W===null||W===void 0?void 0:W.signal)===null||A===void 0||A.addEventListener("abort",()=>{var E;O((E=W===null||W===void 0?void 0:W.signal)===null||E===void 0?void 0:E.reason)});let H=(N=W===null||W===void 0?void 0:W.timeout)!==null&&N!==void 0?N:l2,F=()=>O(new Tv(kv.RequestTimeout,"Request timed out",{timeout:H}));this._setupTimeout($,H,W===null||W===void 0?void 0:W.maxTotalTimeout,F,(h=W===null||W===void 0?void 0:W.resetTimeoutOnProgress)!==null&&h!==void 0?h:!1),this._transport.send(U,{relatedRequestId:X,resumptionToken:Q,onresumptiontoken:P}).catch((E)=>{this._cleanupTimeout($),G(E)})})}async notification(f,v){var W,X;if(!this._transport)throw new Error("Not connected");if(this.assertNotificationCapability(f.method),((X=(W=this._options)===null||W===void 0?void 0:W.debouncedNotificationMethods)!==null&&X!==void 0?X:[]).includes(f.method)&&!f.params&&!(v===null||v===void 0?void 0:v.relatedRequestId)){if(this._pendingDebouncedNotifications.has(f.method))return;this._pendingDebouncedNotifications.add(f.method),Promise.resolve().then(()=>{var G;if(this._pendingDebouncedNotifications.delete(f.method),!this._transport)return;let B={...f,jsonrpc:"2.0"};(G=this._transport)===null||G===void 0||G.send(B,v).catch((D)=>this._onerror(D))});return}let w={...f,jsonrpc:"2.0"};await this._transport.send(w,v)}setRequestHandler(f,v){let W=f.shape.method.value;this.assertRequestHandlerCapability(W),this._requestHandlers.set(W,(X,Q)=>{return Promise.resolve(v(f.parse(X),Q))})}removeRequestHandler(f){this._requestHandlers.delete(f)}assertCanSetRequestHandler(f){if(this._requestHandlers.has(f))throw new Error(`A request handler for ${f} already exists, which would be overridden`)}setNotificationHandler(f,v){this._notificationHandlers.set(f.shape.method.value,(W)=>Promise.resolve(v(f.parse(W))))}removeNotificationHandler(f){this._notificationHandlers.delete(f)}}function Z6(f,v){return Object.entries(v).reduce((W,[X,Q])=>{if(Q&&typeof Q==="object")W[X]=W[X]?{...W[X],...Q}:Q;else W[X]=Q;return W},{...f})}IQ();var yP=Hf(CP());class CJ extends zJ{constructor(f,v){var W;super(v);this._serverInfo=f,this._capabilities=(W=v===null||v===void 0?void 0:v.capabilities)!==null&&W!==void 0?W:{},this._instructions=v===null||v===void 0?void 0:v.instructions,this.setRequestHandler(g8,(X)=>this._oninitialize(X)),this.setNotificationHandler(QJ,()=>{var X;return(X=this.oninitialized)===null||X===void 0?void 0:X.call(this)})}registerCapabilities(f){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=Z6(this._capabilities,f)}assertCapabilityForMethod(f){var v,W,X;switch(f){case"sampling/createMessage":if(!((v=this._clientCapabilities)===null||v===void 0?void 0:v.sampling))throw new Error(`Client does not support sampling (required for ${f})`);break;case"elicitation/create":if(!((W=this._clientCapabilities)===null||W===void 0?void 0:W.elicitation))throw new Error(`Client does not support elicitation (required for ${f})`);break;case"roots/list":if(!((X=this._clientCapabilities)===null||X===void 0?void 0:X.roots))throw new Error(`Client does not support listing roots (required for ${f})`);break;case"ping":break}}assertNotificationCapability(f){switch(f){case"notifications/message":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new Error(`Server does not support notifying about resources (required for ${f})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new Error(`Server does not support notifying of tool list changes (required for ${f})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new Error(`Server does not support notifying of prompt list changes (required for ${f})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(f){switch(f){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Server does not support sampling (required for ${f})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new Error(`Server does not support logging (required for ${f})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new Error(`Server does not support prompts (required for ${f})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new Error(`Server does not support resources (required for ${f})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new Error(`Server does not support tools (required for ${f})`);break;case"ping":case"initialize":break}}async _oninitialize(f){let v=f.params.protocolVersion;return this._clientCapabilities=f.params.capabilities,this._clientVersion=f.params.clientInfo,{protocolVersion:D6.includes(v)?v:vJ,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"},L8)}async createMessage(f,v){return this.request({method:"sampling/createMessage",params:f},YJ,v)}async elicitInput(f,v){let W=await this.request({method:"elicitation/create",params:f},wJ,v);if(W.action==="accept"&&W.content)try{let X=new yP.default,Q=X.compile(f.requestedSchema);if(!Q(W.content))throw new Tv(kv.InvalidParams,`Elicitation response content does not match requested schema: ${X.errorsText(Q.errors)}`)}catch(X){if(X instanceof Tv)throw X;throw new Tv(kv.InternalError,`Error validating elicitation response: ${X}`)}return W}async listRoots(f,v){return this.request({method:"roots/list",params:f},GJ,v)}async sendLoggingMessage(f){return this.notification({method:"notifications/message",params:f})}async sendResourceUpdated(f){return this.notification({method:"notifications/resources/updated",params:f})}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 xP=Symbol("Let zodToJsonSchema decide on which parser to use");var TP={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"},lP=(f)=>typeof f==="string"?{...TP,name:f}:{...TP,...f};var bP=(f)=>{let v=lP(f),W=v.name!==void 0?[...v.basePath,v.definitionPath,v.name]:v.basePath;return{...v,flags:{hasReferencedOpenAiAnyType:!1},currentPath:W,propertyPath:void 0,seen:new Map(Object.entries(v.definitions).map(([X,Q])=>[Q._def,{def:Q._def,path:[...v.basePath,v.definitionPath,X],jsonSchema:void 0}]))}};function yJ(f,v,W,X){if(!X?.errorMessages)return;if(W)f.errorMessage={...f.errorMessage,[v]:W}}function Nv(f,v,W,X,Q){f[v]=W,yJ(f,v,X,Q)}var PW=(f,v)=>{let W=0;for(;W<f.length&&W<v.length;W++)if(f[W]!==v[W])break;return[(f.length-W).toString(),...v.slice(W)].join("/")};n1();function lv(f){if(f.target!=="openAi")return{};let v=[...f.basePath,f.definitionPath,f.openAiAnyTypeName];return f.flags.hasReferencedOpenAiAnyType=!0,{$ref:f.$refStrategy==="relative"?PW(v,f.currentPath):v.join("/")}}n1();function uP(f,v){let W={type:"array"};if(f.type?._def&&f.type?._def?.typeName!==u.ZodAny)W.items=Jv(f.type._def,{...v,currentPath:[...v.currentPath,"items"]});if(f.minLength)Nv(W,"minItems",f.minLength.value,f.minLength.message,v);if(f.maxLength)Nv(W,"maxItems",f.maxLength.value,f.maxLength.message,v);if(f.exactLength)Nv(W,"minItems",f.exactLength.value,f.exactLength.message,v),Nv(W,"maxItems",f.exactLength.value,f.exactLength.message,v);return W}function mP(f,v){let W={type:"integer",format:"int64"};if(!f.checks)return W;for(let X of f.checks)switch(X.kind){case"min":if(v.target==="jsonSchema7")if(X.inclusive)Nv(W,"minimum",X.value,X.message,v);else Nv(W,"exclusiveMinimum",X.value,X.message,v);else{if(!X.inclusive)W.exclusiveMinimum=!0;Nv(W,"minimum",X.value,X.message,v)}break;case"max":if(v.target==="jsonSchema7")if(X.inclusive)Nv(W,"maximum",X.value,X.message,v);else Nv(W,"exclusiveMaximum",X.value,X.message,v);else{if(!X.inclusive)W.exclusiveMaximum=!0;Nv(W,"maximum",X.value,X.message,v)}break;case"multipleOf":Nv(W,"multipleOf",X.value,X.message,v);break}return W}function rP(){return{type:"boolean"}}function YW(f,v){return Jv(f.type._def,v)}var aP=(f,v)=>{return Jv(f.innerType._def,v)};function TJ(f,v,W){let X=W??v.dateStrategy;if(Array.isArray(X))return{anyOf:X.map((Q,P)=>TJ(f,v,Q))};switch(X){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return HG(f,v)}}var HG=(f,v)=>{let W={type:"integer",format:"unix-time"};if(v.target==="openApi3")return W;for(let X of f.checks)switch(X.kind){case"min":Nv(W,"minimum",X.value,X.message,v);break;case"max":Nv(W,"maximum",X.value,X.message,v);break}return W};function cP(f,v){return{...Jv(f.innerType._def,v),default:f.defaultValue()}}function nP(f,v){return v.effectStrategy==="input"?Jv(f.schema._def,v):lv(v)}function pP(f){return{type:"string",enum:Array.from(f.values)}}var VG=(f)=>{if("type"in f&&f.type==="string")return!1;return"allOf"in f};function iP(f,v){let W=[Jv(f.left._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),Jv(f.right._def,{...v,currentPath:[...v.currentPath,"allOf","1"]})].filter((P)=>!!P),X=v.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,Q=[];return W.forEach((P)=>{if(VG(P)){if(Q.push(...P.allOf),P.unevaluatedProperties===void 0)X=void 0}else{let w=P;if("additionalProperties"in P&&P.additionalProperties===!1){let{additionalProperties:G,...B}=P;w=B}else X=void 0;Q.push(w)}}),Q.length?{allOf:Q,...X}:void 0}function dP(f,v){let W=typeof f.value;if(W!=="bigint"&&W!=="number"&&W!=="boolean"&&W!=="string")return{type:Array.isArray(f.value)?"array":"object"};if(v.target==="openApi3")return{type:W==="bigint"?"integer":W,enum:[f.value]};return{type:W==="bigint"?"integer":W,const:f.value}}n1();var xJ=void 0,of={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(xJ===void 0)xJ=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u");return xJ},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 wW(f,v){let W={type:"string"};if(f.checks)for(let X of f.checks)switch(X.kind){case"min":Nv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,X.value):X.value,X.message,v);break;case"max":Nv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,X.value):X.value,X.message,v);break;case"email":switch(v.emailStrategy){case"format:email":tf(W,"email",X.message,v);break;case"format:idn-email":tf(W,"idn-email",X.message,v);break;case"pattern:zod":Df(W,of.email,X.message,v);break}break;case"url":tf(W,"uri",X.message,v);break;case"uuid":tf(W,"uuid",X.message,v);break;case"regex":Df(W,X.regex,X.message,v);break;case"cuid":Df(W,of.cuid,X.message,v);break;case"cuid2":Df(W,of.cuid2,X.message,v);break;case"startsWith":Df(W,RegExp(`^${lJ(X.value,v)}`),X.message,v);break;case"endsWith":Df(W,RegExp(`${lJ(X.value,v)}$`),X.message,v);break;case"datetime":tf(W,"date-time",X.message,v);break;case"date":tf(W,"date",X.message,v);break;case"time":tf(W,"time",X.message,v);break;case"duration":tf(W,"duration",X.message,v);break;case"length":Nv(W,"minLength",typeof W.minLength==="number"?Math.max(W.minLength,X.value):X.value,X.message,v),Nv(W,"maxLength",typeof W.maxLength==="number"?Math.min(W.maxLength,X.value):X.value,X.message,v);break;case"includes":{Df(W,RegExp(lJ(X.value,v)),X.message,v);break}case"ip":{if(X.version!=="v6")tf(W,"ipv4",X.message,v);if(X.version!=="v4")tf(W,"ipv6",X.message,v);break}case"base64url":Df(W,of.base64url,X.message,v);break;case"jwt":Df(W,of.jwt,X.message,v);break;case"cidr":{if(X.version!=="v6")Df(W,of.ipv4Cidr,X.message,v);if(X.version!=="v4")Df(W,of.ipv6Cidr,X.message,v);break}case"emoji":Df(W,of.emoji(),X.message,v);break;case"ulid":{Df(W,of.ulid,X.message,v);break}case"base64":{switch(v.base64Strategy){case"format:binary":{tf(W,"binary",X.message,v);break}case"contentEncoding:base64":{Nv(W,"contentEncoding","base64",X.message,v);break}case"pattern:zod":{Df(W,of.base64,X.message,v);break}}break}case"nanoid":Df(W,of.nanoid,X.message,v);case"toLowerCase":case"toUpperCase":case"trim":break;default:((Q)=>{})(X)}return W}function lJ(f,v){return v.patternStrategy==="escape"?NG(f):f}var qG=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function NG(f){let v="";for(let W=0;W<f.length;W++){if(!qG.has(f[W]))v+="\\";v+=f[W]}return v}function tf(f,v,W,X){if(f.format||f.anyOf?.some((Q)=>Q.format)){if(!f.anyOf)f.anyOf=[];if(f.format){if(f.anyOf.push({format:f.format,...f.errorMessage&&X.errorMessages&&{errorMessage:{format:f.errorMessage.format}}}),delete f.format,f.errorMessage){if(delete f.errorMessage.format,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.anyOf.push({format:v,...W&&X.errorMessages&&{errorMessage:{format:W}}})}else Nv(f,"format",v,W,X)}function Df(f,v,W,X){if(f.pattern||f.allOf?.some((Q)=>Q.pattern)){if(!f.allOf)f.allOf=[];if(f.pattern){if(f.allOf.push({pattern:f.pattern,...f.errorMessage&&X.errorMessages&&{errorMessage:{pattern:f.errorMessage.pattern}}}),delete f.pattern,f.errorMessage){if(delete f.errorMessage.pattern,Object.keys(f.errorMessage).length===0)delete f.errorMessage}}f.allOf.push({pattern:sP(v,X),...W&&X.errorMessages&&{errorMessage:{pattern:W}}})}else Nv(f,"pattern",sP(v,X),W,X)}function sP(f,v){if(!v.applyRegexFlags||!f.flags)return f.source;let W={i:f.flags.includes("i"),m:f.flags.includes("m"),s:f.flags.includes("s")},X=W.i?f.source.toLowerCase():f.source,Q="",P=!1,w=!1,G=!1;for(let B=0;B<X.length;B++){if(P){Q+=X[B],P=!1;continue}if(W.i){if(w){if(X[B].match(/[a-z]/)){if(G)Q+=X[B],Q+=`${X[B-2]}-${X[B]}`.toUpperCase(),G=!1;else if(X[B+1]==="-"&&X[B+2]?.match(/[a-z]/))Q+=X[B],G=!0;else Q+=`${X[B]}${X[B].toUpperCase()}`;continue}}else if(X[B].match(/[a-z]/)){Q+=`[${X[B]}${X[B].toUpperCase()}]`;continue}}if(W.m){if(X[B]==="^"){Q+=`(^|(?<=[\r
21
+ ]))`;continue}else if(X[B]==="$"){Q+=`($|(?=[\r
22
+ ]))`;continue}}if(W.s&&X[B]==="."){Q+=w?`${X[B]}\r
23
+ `:`[${X[B]}\r
24
+ ]`;continue}if(Q+=X[B],X[B]==="\\")P=!0;else if(w&&X[B]==="]")w=!1;else if(!w&&X[B]==="[")w=!0}try{new RegExp(Q)}catch{return console.warn(`Could not convert regex pattern at ${v.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),f.source}return Q}function GW(f,v){if(v.target==="openAi")console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");if(v.target==="openApi3"&&f.keyType?._def.typeName===u.ZodEnum)return{type:"object",required:f.keyType._def.values,properties:f.keyType._def.values.reduce((X,Q)=>({...X,[Q]:Jv(f.valueType._def,{...v,currentPath:[...v.currentPath,"properties",Q]})??lv(v)}),{}),additionalProperties:v.rejectedAdditionalProperties};let W={type:"object",additionalProperties:Jv(f.valueType._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]})??v.allowedAdditionalProperties};if(v.target==="openApi3")return W;if(f.keyType?._def.typeName===u.ZodString&&f.keyType._def.checks?.length){let{type:X,...Q}=wW(f.keyType._def,v);return{...W,propertyNames:Q}}else if(f.keyType?._def.typeName===u.ZodEnum)return{...W,propertyNames:{enum:f.keyType._def.values}};else if(f.keyType?._def.typeName===u.ZodBranded&&f.keyType._def.type._def.typeName===u.ZodString&&f.keyType._def.type._def.checks?.length){let{type:X,...Q}=YW(f.keyType._def,v);return{...W,propertyNames:Q}}return W}function oP(f,v){if(v.mapStrategy==="record")return GW(f,v);let W=Jv(f.keyType._def,{...v,currentPath:[...v.currentPath,"items","items","0"]})||lv(v),X=Jv(f.valueType._def,{...v,currentPath:[...v.currentPath,"items","items","1"]})||lv(v);return{type:"array",maxItems:125,items:{type:"array",items:[W,X],minItems:2,maxItems:2}}}function tP(f){let v=f.values,X=Object.keys(f.values).filter((P)=>{return typeof v[v[P]]!=="number"}).map((P)=>v[P]),Q=Array.from(new Set(X.map((P)=>typeof P)));return{type:Q.length===1?Q[0]==="string"?"string":"number":["string","number"],enum:X}}function eP(f){return f.target==="openAi"?void 0:{not:lv({...f,currentPath:[...f.currentPath,"not"]})}}function vY(f){return f.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var CQ={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function QY(f,v){if(v.target==="openApi3")return fY(f,v);let W=f.options instanceof Map?Array.from(f.options.values()):f.options;if(W.every((X)=>(X._def.typeName in CQ)&&(!X._def.checks||!X._def.checks.length))){let X=W.reduce((Q,P)=>{let w=CQ[P._def.typeName];return w&&!Q.includes(w)?[...Q,w]:Q},[]);return{type:X.length>1?X:X[0]}}else if(W.every((X)=>X._def.typeName==="ZodLiteral"&&!X.description)){let X=W.reduce((Q,P)=>{let w=typeof P._def.value;switch(w){case"string":case"number":case"boolean":return[...Q,w];case"bigint":return[...Q,"integer"];case"object":if(P._def.value===null)return[...Q,"null"];case"symbol":case"undefined":case"function":default:return Q}},[]);if(X.length===W.length){let Q=X.filter((P,w,G)=>G.indexOf(P)===w);return{type:Q.length>1?Q:Q[0],enum:W.reduce((P,w)=>{return P.includes(w._def.value)?P:[...P,w._def.value]},[])}}}else if(W.every((X)=>X._def.typeName==="ZodEnum"))return{type:"string",enum:W.reduce((X,Q)=>[...X,...Q._def.values.filter((P)=>!X.includes(P))],[])};return fY(f,v)}var fY=(f,v)=>{let W=(f.options instanceof Map?Array.from(f.options.values()):f.options).map((X,Q)=>Jv(X._def,{...v,currentPath:[...v.currentPath,"anyOf",`${Q}`]})).filter((X)=>!!X&&(!v.strictUnions||typeof X==="object"&&Object.keys(X).length>0));return W.length?{anyOf:W}:void 0};function WY(f,v){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(f.innerType._def.typeName)&&(!f.innerType._def.checks||!f.innerType._def.checks.length)){if(v.target==="openApi3")return{type:CQ[f.innerType._def.typeName],nullable:!0};return{type:[CQ[f.innerType._def.typeName],"null"]}}if(v.target==="openApi3"){let X=Jv(f.innerType._def,{...v,currentPath:[...v.currentPath]});if(X&&"$ref"in X)return{allOf:[X],nullable:!0};return X&&{...X,nullable:!0}}let W=Jv(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","0"]});return W&&{anyOf:[W,{type:"null"}]}}function JY(f,v){let W={type:"number"};if(!f.checks)return W;for(let X of f.checks)switch(X.kind){case"int":W.type="integer",yJ(W,"type",X.message,v);break;case"min":if(v.target==="jsonSchema7")if(X.inclusive)Nv(W,"minimum",X.value,X.message,v);else Nv(W,"exclusiveMinimum",X.value,X.message,v);else{if(!X.inclusive)W.exclusiveMinimum=!0;Nv(W,"minimum",X.value,X.message,v)}break;case"max":if(v.target==="jsonSchema7")if(X.inclusive)Nv(W,"maximum",X.value,X.message,v);else Nv(W,"exclusiveMaximum",X.value,X.message,v);else{if(!X.inclusive)W.exclusiveMaximum=!0;Nv(W,"maximum",X.value,X.message,v)}break;case"multipleOf":Nv(W,"multipleOf",X.value,X.message,v);break}return W}function XY(f,v){let W=v.target==="openAi",X={type:"object",properties:{}},Q=[],P=f.shape();for(let G in P){let B=P[G];if(B===void 0||B._def===void 0)continue;let D=AG(B);if(D&&W){if(B._def.typeName==="ZodOptional")B=B._def.innerType;if(!B.isNullable())B=B.nullable();D=!1}let M=Jv(B._def,{...v,currentPath:[...v.currentPath,"properties",G],propertyPath:[...v.currentPath,"properties",G]});if(M===void 0)continue;if(X.properties[G]=M,!D)Q.push(G)}if(Q.length)X.required=Q;let w=EG(f,v);if(w!==void 0)X.additionalProperties=w;return X}function EG(f,v){if(f.catchall._def.typeName!=="ZodNever")return Jv(f.catchall._def,{...v,currentPath:[...v.currentPath,"additionalProperties"]});switch(f.unknownKeys){case"passthrough":return v.allowedAdditionalProperties;case"strict":return v.rejectedAdditionalProperties;case"strip":return v.removeAdditionalStrategy==="strict"?v.allowedAdditionalProperties:v.rejectedAdditionalProperties}}function AG(f){try{return f.isOptional()}catch{return!0}}var PY=(f,v)=>{if(v.currentPath.toString()===v.propertyPath?.toString())return Jv(f.innerType._def,v);let W=Jv(f.innerType._def,{...v,currentPath:[...v.currentPath,"anyOf","1"]});return W?{anyOf:[{not:lv(v)},W]}:lv(v)};var YY=(f,v)=>{if(v.pipeStrategy==="input")return Jv(f.in._def,v);else if(v.pipeStrategy==="output")return Jv(f.out._def,v);let W=Jv(f.in._def,{...v,currentPath:[...v.currentPath,"allOf","0"]}),X=Jv(f.out._def,{...v,currentPath:[...v.currentPath,"allOf",W?"1":"0"]});return{allOf:[W,X].filter((Q)=>Q!==void 0)}};function wY(f,v){return Jv(f.type._def,v)}function GY(f,v){let X={type:"array",uniqueItems:!0,items:Jv(f.valueType._def,{...v,currentPath:[...v.currentPath,"items"]})};if(f.minSize)Nv(X,"minItems",f.minSize.value,f.minSize.message,v);if(f.maxSize)Nv(X,"maxItems",f.maxSize.value,f.maxSize.message,v);return X}function zY(f,v){if(f.rest)return{type:"array",minItems:f.items.length,items:f.items.map((W,X)=>Jv(W._def,{...v,currentPath:[...v.currentPath,"items",`${X}`]})).reduce((W,X)=>X===void 0?W:[...W,X],[]),additionalItems:Jv(f.rest._def,{...v,currentPath:[...v.currentPath,"additionalItems"]})};else return{type:"array",minItems:f.items.length,maxItems:f.items.length,items:f.items.map((W,X)=>Jv(W._def,{...v,currentPath:[...v.currentPath,"items",`${X}`]})).reduce((W,X)=>X===void 0?W:[...W,X],[])}}function BY(f){return{not:lv(f)}}function KY(f){return lv(f)}var hY=(f,v)=>{return Jv(f.innerType._def,v)};var $Y=(f,v,W)=>{switch(v){case u.ZodString:return wW(f,W);case u.ZodNumber:return JY(f,W);case u.ZodObject:return XY(f,W);case u.ZodBigInt:return mP(f,W);case u.ZodBoolean:return rP();case u.ZodDate:return TJ(f,W);case u.ZodUndefined:return BY(W);case u.ZodNull:return vY(W);case u.ZodArray:return uP(f,W);case u.ZodUnion:case u.ZodDiscriminatedUnion:return QY(f,W);case u.ZodIntersection:return iP(f,W);case u.ZodTuple:return zY(f,W);case u.ZodRecord:return GW(f,W);case u.ZodLiteral:return dP(f,W);case u.ZodEnum:return pP(f);case u.ZodNativeEnum:return tP(f);case u.ZodNullable:return WY(f,W);case u.ZodOptional:return PY(f,W);case u.ZodMap:return oP(f,W);case u.ZodSet:return GY(f,W);case u.ZodLazy:return()=>f.getter()._def;case u.ZodPromise:return wY(f,W);case u.ZodNaN:case u.ZodNever:return eP(W);case u.ZodEffects:return nP(f,W);case u.ZodAny:return lv(W);case u.ZodUnknown:return KY(W);case u.ZodDefault:return cP(f,W);case u.ZodBranded:return YW(f,W);case u.ZodReadonly:return hY(f,W);case u.ZodCatch:return aP(f,W);case u.ZodPipeline:return YY(f,W);case u.ZodFunction:case u.ZodVoid:case u.ZodSymbol:return;default:return((X)=>{return})(v)}};function Jv(f,v,W=!1){let X=v.seen.get(f);if(v.override){let G=v.override?.(f,v,X,W);if(G!==xP)return G}if(X&&!W){let G=UG(X,v);if(G!==void 0)return G}let Q={def:f,path:v.currentPath,jsonSchema:void 0};v.seen.set(f,Q);let P=$Y(f,f.typeName,v),w=typeof P==="function"?Jv(P(),v):P;if(w)jG(f,v,w);if(v.postProcess){let G=v.postProcess(w,f,v);return Q.jsonSchema=w,G}return Q.jsonSchema=w,w}var UG=(f,v)=>{switch(v.$refStrategy){case"root":return{$ref:f.path.join("/")};case"relative":return{$ref:PW(v.currentPath,f.path)};case"none":case"seen":{if(f.path.length<v.currentPath.length&&f.path.every((W,X)=>v.currentPath[X]===W))return console.warn(`Recursive reference detected at ${v.currentPath.join("/")}! Defaulting to any`),lv(v);return v.$refStrategy==="seen"?lv(v):void 0}}},jG=(f,v,W)=>{if(f.description){if(W.description=f.description,v.markdownDescription)W.markdownDescription=f.description}return W};var zW=(f,v)=>{let W=bP(v),X=typeof v==="object"&&v.definitions?Object.entries(v.definitions).reduce((B,[D,M])=>({...B,[D]:Jv(M._def,{...W,currentPath:[...W.basePath,W.definitionPath,D]},!0)??lv(W)}),{}):void 0,Q=typeof v==="string"?v:v?.nameStrategy==="title"?void 0:v?.name,P=Jv(f._def,Q===void 0?W:{...W,currentPath:[...W.basePath,W.definitionPath,Q]},!1)??lv(W),w=typeof v==="object"&&v.name!==void 0&&v.nameStrategy==="title"?v.name:void 0;if(w!==void 0)P.title=w;if(W.flags.hasReferencedOpenAiAnyType){if(!X)X={};if(!X[W.openAiAnyTypeName])X[W.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:W.$refStrategy==="relative"?"1":[...W.basePath,W.definitionPath,W.openAiAnyTypeName].join("/")}}}let G=Q===void 0?X?{...P,[W.definitionPath]:X}:P:{$ref:[...W.$refStrategy==="relative"?[]:W.basePath,W.definitionPath,Q].join("/"),[W.definitionPath]:{...X,[Q]:P}};if(W.target==="jsonSchema7")G.$schema="http://json-schema.org/draft-07/schema#";else if(W.target==="jsonSchema2019-09"||W.target==="openAi")G.$schema="https://json-schema.org/draft/2019-09/schema#";if(W.target==="openAi"&&(("anyOf"in G)||("oneOf"in G)||("allOf"in G)||("type"in G)&&Array.isArray(G.type)))console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");return G};n1();IQ();n1();var bJ;(function(f){f.Completable="McpCompletable"})(bJ||(bJ={}));class yQ extends zv{_parse(f){let{ctx:v}=this._processInputParams(f),W=v.data;return this._def.type._parse({data:W,path:v.path,parent:v})}unwrap(){return this._def.type}}yQ.create=(f,v)=>{return new yQ({type:f,typeName:bJ.Completable,complete:v.complete,...FG(v)})};function FG(f){if(!f)return{};let{errorMap:v,invalid_type_error:W,required_error:X,description:Q}=f;if(v&&(W||X))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(v)return{errorMap:v,description:Q};return{errorMap:(w,G)=>{var B,D;let{message:M}=f;if(w.code==="invalid_enum_value")return{message:M!==null&&M!==void 0?M:G.defaultError};if(typeof G.data==="undefined")return{message:(B=M!==null&&M!==void 0?M:X)!==null&&B!==void 0?B:G.defaultError};if(w.code!=="invalid_type")return{message:G.defaultError};return{message:(D=M!==null&&M!==void 0?M:W)!==null&&D!==void 0?D:G.defaultError}},description:Q}}class uJ{constructor(f,v){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new CJ(f,v)}async connect(f){return await this.server.connect(f)}async close(){await this.server.close()}setToolRequestHandlers(){if(this._toolHandlersInitialized)return;this.server.assertCanSetRequestHandler(l8.shape.method.value),this.server.assertCanSetRequestHandler(b8.shape.method.value),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(l8,()=>({tools:Object.entries(this._registeredTools).filter(([,f])=>f.enabled).map(([f,v])=>{let W={name:f,title:v.title,description:v.description,inputSchema:v.inputSchema?zW(v.inputSchema,{strictUnions:!0}):LG,annotations:v.annotations};if(v.outputSchema)W.outputSchema=zW(v.outputSchema,{strictUnions:!0});return W})})),this.server.setRequestHandler(b8,async(f,v)=>{let W=this._registeredTools[f.params.name];if(!W)throw new Tv(kv.InvalidParams,`Tool ${f.params.name} not found`);if(!W.enabled)throw new Tv(kv.InvalidParams,`Tool ${f.params.name} disabled`);let X;if(W.inputSchema){let Q=await W.inputSchema.safeParseAsync(f.params.arguments);if(!Q.success)throw new Tv(kv.InvalidParams,`Invalid arguments for tool ${f.params.name}: ${Q.error.message}`);let P=Q.data,w=W.callback;try{X=await Promise.resolve(w(P,v))}catch(G){X={content:[{type:"text",text:G instanceof Error?G.message:String(G)}],isError:!0}}}else{let Q=W.callback;try{X=await Promise.resolve(Q(v))}catch(P){X={content:[{type:"text",text:P instanceof Error?P.message:String(P)}],isError:!0}}}if(W.outputSchema&&!X.isError){if(!X.structuredContent)throw new Tv(kv.InvalidParams,`Tool ${f.params.name} has an output schema but no structured content was provided`);let Q=await W.outputSchema.safeParseAsync(X.structuredContent);if(!Q.success)throw new Tv(kv.InvalidParams,`Invalid structured content for tool ${f.params.name}: ${Q.error.message}`)}return X}),this._toolHandlersInitialized=!0}setCompletionRequestHandler(){if(this._completionHandlerInitialized)return;this.server.assertCanSetRequestHandler(u8.shape.method.value),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler(u8,async(f)=>{switch(f.params.ref.type){case"ref/prompt":return this.handlePromptCompletion(f,f.params.ref);case"ref/resource":return this.handleResourceCompletion(f,f.params.ref);default:throw new Tv(kv.InvalidParams,`Invalid completion reference: ${f.params.ref}`)}}),this._completionHandlerInitialized=!0}async handlePromptCompletion(f,v){let W=this._registeredPrompts[v.name];if(!W)throw new Tv(kv.InvalidParams,`Prompt ${v.name} not found`);if(!W.enabled)throw new Tv(kv.InvalidParams,`Prompt ${v.name} disabled`);if(!W.argsSchema)return BW;let X=W.argsSchema.shape[f.params.argument.name];if(!(X instanceof yQ))return BW;let P=await X._def.complete(f.params.argument.value,f.params.context);return MY(P)}async handleResourceCompletion(f,v){let W=Object.values(this._registeredResourceTemplates).find((P)=>P.resourceTemplate.uriTemplate.toString()===v.uri);if(!W){if(this._registeredResources[v.uri])return BW;throw new Tv(kv.InvalidParams,`Resource template ${f.params.ref.uri} not found`)}let X=W.resourceTemplate.completeCallback(f.params.argument.name);if(!X)return BW;let Q=await X(f.params.argument.value,f.params.context);return MY(Q)}setResourceRequestHandlers(){if(this._resourceHandlersInitialized)return;this.server.assertCanSetRequestHandler(Z8.shape.method.value),this.server.assertCanSetRequestHandler(C8.shape.method.value),this.server.assertCanSetRequestHandler(y8.shape.method.value),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(Z8,async(f,v)=>{let W=Object.entries(this._registeredResources).filter(([Q,P])=>P.enabled).map(([Q,P])=>({uri:Q,name:P.name,...P.metadata})),X=[];for(let Q of Object.values(this._registeredResourceTemplates)){if(!Q.resourceTemplate.listCallback)continue;let P=await Q.resourceTemplate.listCallback(v);for(let w of P.resources)X.push({...Q.metadata,...w})}return{resources:[...W,...X]}}),this.server.setRequestHandler(C8,async()=>{return{resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([v,W])=>({name:v,uriTemplate:W.resourceTemplate.uriTemplate.toString(),...W.metadata}))}}),this.server.setRequestHandler(y8,async(f,v)=>{let W=new URL(f.params.uri),X=this._registeredResources[W.toString()];if(X){if(!X.enabled)throw new Tv(kv.InvalidParams,`Resource ${W} disabled`);return X.readCallback(W,v)}for(let Q of Object.values(this._registeredResourceTemplates)){let P=Q.resourceTemplate.uriTemplate.match(W.toString());if(P)return Q.readCallback(W,P,v)}throw new Tv(kv.InvalidParams,`Resource ${W} not found`)}),this.setCompletionRequestHandler(),this._resourceHandlersInitialized=!0}setPromptRequestHandlers(){if(this._promptHandlersInitialized)return;this.server.assertCanSetRequestHandler(T8.shape.method.value),this.server.assertCanSetRequestHandler(x8.shape.method.value),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(T8,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,f])=>f.enabled).map(([f,v])=>{return{name:f,title:v.title,description:v.description,arguments:v.argsSchema?gG(v.argsSchema):void 0}})})),this.server.setRequestHandler(x8,async(f,v)=>{let W=this._registeredPrompts[f.params.name];if(!W)throw new Tv(kv.InvalidParams,`Prompt ${f.params.name} not found`);if(!W.enabled)throw new Tv(kv.InvalidParams,`Prompt ${f.params.name} disabled`);if(W.argsSchema){let X=await W.argsSchema.safeParseAsync(f.params.arguments);if(!X.success)throw new Tv(kv.InvalidParams,`Invalid arguments for prompt ${f.params.name}: ${X.error.message}`);let Q=X.data,P=W.callback;return await Promise.resolve(P(Q,v))}else{let X=W.callback;return await Promise.resolve(X(v))}}),this.setCompletionRequestHandler(),this._promptHandlersInitialized=!0}resource(f,v,...W){let X;if(typeof W[0]==="object")X=W.shift();let Q=W[0];if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let P=this._createRegisteredResource(f,void 0,v,X,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),P}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let P=this._createRegisteredResourceTemplate(f,void 0,v,X,Q);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),P}}registerResource(f,v,W,X){if(typeof v==="string"){if(this._registeredResources[v])throw new Error(`Resource ${v} is already registered`);let Q=this._createRegisteredResource(f,W.title,v,W,X);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}else{if(this._registeredResourceTemplates[f])throw new Error(`Resource template ${f} is already registered`);let Q=this._createRegisteredResourceTemplate(f,W.title,v,W,X);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),Q}}_createRegisteredResource(f,v,W,X,Q){let P={name:f,title:v,metadata:X,readCallback:Q,enabled:!0,disable:()=>P.update({enabled:!1}),enable:()=>P.update({enabled:!0}),remove:()=>P.update({uri:null}),update:(w)=>{if(typeof w.uri!=="undefined"&&w.uri!==W){if(delete this._registeredResources[W],w.uri)this._registeredResources[w.uri]=P}if(typeof w.name!=="undefined")P.name=w.name;if(typeof w.title!=="undefined")P.title=w.title;if(typeof w.metadata!=="undefined")P.metadata=w.metadata;if(typeof w.callback!=="undefined")P.readCallback=w.callback;if(typeof w.enabled!=="undefined")P.enabled=w.enabled;this.sendResourceListChanged()}};return this._registeredResources[W]=P,P}_createRegisteredResourceTemplate(f,v,W,X,Q){let P={resourceTemplate:W,title:v,metadata:X,readCallback:Q,enabled:!0,disable:()=>P.update({enabled:!1}),enable:()=>P.update({enabled:!0}),remove:()=>P.update({name:null}),update:(w)=>{if(typeof w.name!=="undefined"&&w.name!==f){if(delete this._registeredResourceTemplates[f],w.name)this._registeredResourceTemplates[w.name]=P}if(typeof w.title!=="undefined")P.title=w.title;if(typeof w.template!=="undefined")P.resourceTemplate=w.template;if(typeof w.metadata!=="undefined")P.metadata=w.metadata;if(typeof w.callback!=="undefined")P.readCallback=w.callback;if(typeof w.enabled!=="undefined")P.enabled=w.enabled;this.sendResourceListChanged()}};return this._registeredResourceTemplates[f]=P,P}_createRegisteredPrompt(f,v,W,X,Q){let P={title:v,description:W,argsSchema:X===void 0?void 0:K.object(X),callback:Q,enabled:!0,disable:()=>P.update({enabled:!1}),enable:()=>P.update({enabled:!0}),remove:()=>P.update({name:null}),update:(w)=>{if(typeof w.name!=="undefined"&&w.name!==f){if(delete this._registeredPrompts[f],w.name)this._registeredPrompts[w.name]=P}if(typeof w.title!=="undefined")P.title=w.title;if(typeof w.description!=="undefined")P.description=w.description;if(typeof w.argsSchema!=="undefined")P.argsSchema=K.object(w.argsSchema);if(typeof w.callback!=="undefined")P.callback=w.callback;if(typeof w.enabled!=="undefined")P.enabled=w.enabled;this.sendPromptListChanged()}};return this._registeredPrompts[f]=P,P}_createRegisteredTool(f,v,W,X,Q,P,w){let G={title:v,description:W,inputSchema:X===void 0?void 0:K.object(X),outputSchema:Q===void 0?void 0:K.object(Q),annotations:P,callback:w,enabled:!0,disable:()=>G.update({enabled:!1}),enable:()=>G.update({enabled:!0}),remove:()=>G.update({name:null}),update:(B)=>{if(typeof B.name!=="undefined"&&B.name!==f){if(delete this._registeredTools[f],B.name)this._registeredTools[B.name]=G}if(typeof B.title!=="undefined")G.title=B.title;if(typeof B.description!=="undefined")G.description=B.description;if(typeof B.paramsSchema!=="undefined")G.inputSchema=K.object(B.paramsSchema);if(typeof B.callback!=="undefined")G.callback=B.callback;if(typeof B.annotations!=="undefined")G.annotations=B.annotations;if(typeof B.enabled!=="undefined")G.enabled=B.enabled;this.sendToolListChanged()}};return this._registeredTools[f]=G,this.setToolRequestHandlers(),this.sendToolListChanged(),G}tool(f,...v){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let W,X,Q,P;if(typeof v[0]==="string")W=v.shift();if(v.length>1){let G=v[0];if(DY(G)){if(X=v.shift(),v.length>1&&typeof v[0]==="object"&&v[0]!==null&&!DY(v[0]))P=v.shift()}else if(typeof G==="object"&&G!==null)P=v.shift()}let w=v[0];return this._createRegisteredTool(f,void 0,W,X,Q,P,w)}registerTool(f,v,W){if(this._registeredTools[f])throw new Error(`Tool ${f} is already registered`);let{title:X,description:Q,inputSchema:P,outputSchema:w,annotations:G}=v;return this._createRegisteredTool(f,X,Q,P,w,G,W)}prompt(f,...v){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let W;if(typeof v[0]==="string")W=v.shift();let X;if(v.length>1)X=v.shift();let Q=v[0],P=this._createRegisteredPrompt(f,void 0,W,X,Q);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),P}registerPrompt(f,v,W){if(this._registeredPrompts[f])throw new Error(`Prompt ${f} is already registered`);let{title:X,description:Q,argsSchema:P}=v,w=this._createRegisteredPrompt(f,X,Q,P,W);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),w}isConnected(){return this.server.transport!==void 0}sendResourceListChanged(){if(this.isConnected())this.server.sendResourceListChanged()}sendToolListChanged(){if(this.isConnected())this.server.sendToolListChanged()}sendPromptListChanged(){if(this.isConnected())this.server.sendPromptListChanged()}}var LG={type:"object",properties:{}};function DY(f){if(typeof f!=="object"||f===null)return!1;return Object.keys(f).length===0||Object.values(f).some(SG)}function SG(f){return f!==null&&typeof f==="object"&&"parse"in f&&typeof f.parse==="function"&&"safeParse"in f&&typeof f.safeParse==="function"}function gG(f){return Object.entries(f.shape).map(([v,W])=>({name:v,description:W.description,required:!W.isOptional()}))}function MY(f){return{completion:{values:f.slice(0,100),total:f.length,hasMore:f.length>100}}}var BW={completion:{values:[],hasMore:!1}};KW();var NY=(f)=>{};var EY=(f)=>{NY(f)};KW();var J9=null;async function v3(){if(typeof global!=="undefined"&&global.fetch)return global.fetch;if(typeof globalThis.fetch!=="undefined")return globalThis.fetch;if(!J9)try{J9=await Promise.resolve().then(() => (W9(),Q9))}catch(f){throw new Error("Neither native fetch nor node-fetch is available. Please install node-fetch or upgrade to Node.js 18+")}return J9.default}async function f3(f,v){return(await v3())(f,v)}var JQ=f3;V0();var X9=xf("F2cApi",1);class D4{f2cHost="https://f2c-figma-api.yy.com/api";async nodeToCode(f){let v={fileKey:f.fileKey,nodeIds:f.ids,personal_token:f.personalToken||g1.personalToken,option:{cssFramework:"inlinecss",imgFormat:f.imgFormat||"png",scaleSize:f.scaleSize||2},format:"files"};if(f.format==="react-cssmodules")v.option.cssFramework="cssmodules";else if(f.format==="react-tailwind")v.option.cssFramework="tailwindcss";let W=this.opToUrl(`${this.f2cHost}/nodes`,v);return this.fetch(W,"json",f.ideInfo||"other")}async fetch(f,v="json",W){X9.debug("fetch",f,g1.personalToken);try{let X={method:"GET",headers:{"F2c-Api-Platform":`mcp-${W}`}};X9.debug("fetch",f);let Q=await JQ(f,X);if(!Q.ok)throw new Error(`HTTP error! status: ${Q.status}`);return v==="text"?await Q.text():await Q.json()}catch(X){throw X9.error("HTTP error",X),X}}opToUrl(f,v={}){if(Object.keys(v).length===0)return f;let W=new URL(f);for(let[X,Q]of Object.entries(v))if(typeof Q==="object"&&Q!==null)for(let[P,w]of Object.entries(Q))W.searchParams.append(`${X}[${P}]`,w);else W.searchParams.append(X,Q);return W.toString()}}var M4=new D4;KW();V0();var Q3=xf("FigmaRestApi");class O4{figmaHost="https://api.figma.com/v1";async files(f){let v;if(f.ids)v=this.opToUrl(`${this.figmaHost}/files/${f.fileKey}/nodes`,f);else v=this.opToUrl(`${this.figmaHost}/files/${f.fileKey}`,f);return this.fetch(v)}async images(f){let v=this.opToUrl(`${this.figmaHost}/images/${f.fileKey}`,f);return this.fetch(v)}async imageFills(f){let v=this.opToUrl(`${this.figmaHost}/files/${f.fileKey}/images`,f);return this.fetch(v)}async meta(f){let v=this.opToUrl(`${this.figmaHost}/files/${f.fileKey}/meta`,f);return this.fetch(v)}async fetch(f,v="json"){try{let W={method:"GET",headers:{"X-FIGMA-TOKEN":g1.personalToken}},X=await JQ(f,W);if(!X.ok)throw new Error(`HTTP error! status: ${X.status}`);return v==="text"?await X.text():await X.json()}catch(W){throw Q3.error("HTTP error",W),W}}opToUrl(f,v={},W=["fileKey","personalToken"]){if(Object.keys(v).length===0)return f;if(v.personalToken)g1.personalToken=v.personalToken;let X=new URL(f);for(let[Q,P]of Object.entries(v))if(!W.includes(Q))X.searchParams.append(Q,P);return X.toString()}}var H4=new O4;V0();var A4=Hf(q4());n1();var cQ=Hf(require("fs")),f0=Hf(require("path")),P9=Hf(require("fs/promises"));V0();var f1=xf("Downloader");class N4{op;assetsPath="";savePath="";setup(f){if(this.op=f,this.op.localPath)this.assetsPath=f0.default.join(this.op.localPath,"assets"),this.savePath=this.op.localPath}async downloadImage(f,v){let{imgFormat:W}=this.op,X=this.assetsPath;try{if(!cQ.default.existsSync(X))cQ.default.mkdirSync(X,{recursive:!0});let Q=`${v}.${W}`,P=f0.default.join(X,Q),w=await JQ(f);if(!w.ok)throw new Error(`下载失败: ${w.status} ${w.statusText}`);let G=await w.arrayBuffer();return cQ.default.writeFileSync(P,new Uint8Array(G)),f0.default.join(f0.default.basename(X),Q).replace(/\\/g,"/")}catch(Q){throw f1.error("图片下载错误:",Q),Q}}async downLoadImageAndReplaceContent(f){try{let v=/https:\/\/figma-alpha-api\.s3\.us-west-2\.amazonaws\.com\/images\/[a-f0-9-]+/g,W=f.match(v);if(!W)return f;let X=[...new Set(W)],Q=new Map;await Promise.all(X.map(async(w)=>{let G=f0.default.basename(w),B=await this.downloadImage(w,G);Q.set(w,B)}));let P=f;for(let[w,G]of Q.entries()){let B=new RegExp(w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g");P=P.replace(B,G)}return P}catch(v){throw f1.error("内容处理错误:",v),v}}async checkLocalAndDownload(f){if(!this.op.localPath)return;await Promise.all(f.map(async(v)=>{v.content=await this.downLoadImageAndReplaceContent(v.content)}));for(let v of f)try{let W=await this.saveContentToFile(v.content,v.path);f1.debug(`Successfully saved: ${W}`)}catch(W){f1.error(`Failed to save file ${v.path}:`,W)}}async ensureDirectoryExists(f){if(!cQ.default.existsSync(f))f1.debug(`Creating directory: ${f}`),await P9.default.mkdir(f,{recursive:!0})}async saveContentToFile(f,v){try{let W=f0.default.join(this.savePath,v),X=f0.default.dirname(W);if(f1.debug(`Full path: ${W}, directory: ${X}`),await this.ensureDirectoryExists(X),v.endsWith(".html"))f1.debug("Wrapping content with HTML template"),f=this.wrapHtmlContent(f);return f1.debug(`Writing ${f.length} bytes to file`),await P9.default.writeFile(W,f),f1.info(`File saved: ${W}`),W}catch(W){throw f1.error("File save error:",v,W),W}}wrapHtmlContent(f){return f1.debug("Wrapping content with HTML template"),`<!DOCTYPE html>
25
+ <html>
26
+ <head>
27
+ <meta charset="UTF-8">
28
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
29
+ <title>F2C Generated</title>
30
+ </head>
31
+ <body>
32
+ ${f}
33
+ </body>
34
+ </html>`}}var Y9=new N4;var W3=xf("V3Tool"),E4="",U4=(f)=>{A4.reportMcpLoader().then((v)=>{E4=v||"other"}),f.tool("get_code","Generate UI code for a given node or the currently selected node in the Figma desktop app. Use the nodeId parameter to specify a node id. If no node id is provided, the currently selected node will be used. If a URL is provided, extract the node id from the URL, for example, if given the URL https://figma.com/design/:fileKey/:fileName?node-id=1-2, the extracted nodeId would be 1:2.",{fileKey:K.string().describe("The Figma file identifier found in the file URL (e.g., https://www.figma.com/file/XXXXXXXXXXXX/). Extract the XXXXXXXXXXXX portion as the fileKey."),ids:K.string().describe('Comma-separated list of Figma node IDs for conversion. To obtain node IDs, select elements in Figma, right-click and select "Copy/Paste as" → "Copy ID".'),personalToken:K.string().optional().describe("Figma personal access token for API authentication.The parameters are not required when the tool is called."),localPath:K.string().optional().describe("Absolute path for asset(e.g., images) and code storage. Directory will be created if non-existent. Path must follow OS-specific format without special character escaping. When this path is set, all code-related static resources are stored in this directory, while other assets (e.g., images) will be saved into the subdirectory named assets under this path."),imgFormat:K.enum(["png","jpg","svg"]).default("png").describe('Export format for image assets: "png" for lossless quality, "jpg" for compressed files, or "svg" for vector graphics.'),scaleSize:K.number().min(1).max(4).default(1).describe("Image export scale factor (1-4). Higher values yield better quality at the cost of larger file sizes.")},async(v)=>{Y9.setup(v);try{let W=await M4.nodeToCode({...v,format:"react-tailwind",ideInfo:E4})||[];if(await Y9.checkLocalAndDownload(W),!W)return{content:[{type:"text",text:"Failed to generate any code. Please check if the provided Figma node IDs are correct or if the nodes can be converted to code."}]};let X=Array.isArray(W)?W:[W];if(X.length===0)return{content:[{type:"text",text:"Conversion succeeded but no files were generated. Please check if the selected Figma nodes contain convertible content."}]};let Q=X.filter((w)=>!w.path.endsWith("/index.scss")).map((w,G)=>`${G+1}. ${w.path}`).join(`
35
+ `);if(v.localPath)return{content:[{type:"text",text:`# Files Saved Locally
36
+
37
+ ## Save Location
38
+ ${v.localPath}
39
+
40
+ ## Generated Files
41
+ ${Q}. Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]};return{content:[{type:"text",text:`${X.filter((w)=>w.path.endsWith(".tsx")).map((w)=>w.content).join(`
42
+
43
+ `)} Convert the Tailwind to vanilla CSS if not already used in the codebase. Do not install any dependencies.`}]}}catch(W){return W3.error("Tool execution error:",W),{content:[{type:"text",text:`Error: ${W.message}`}]}}}),f.tool("get_image","Generate an image for a given node or the currently selected node in the Figma desktop app. Use the nodeId parameter to specify a node id. If no node id is provided, the currently selected node will be used. If a URL is provided, extract the node id from the URL, for example, if given the URL https://figma.com/design/:fileKey/:fileName?node-id=1-2, the extracted nodeId would be 1:2. Also export Figma design images for visual verification and design fidelity validation. Essential for comparing generated code output against original designs, ensuring pixel-perfect implementation and catching visual discrepancies during the design-to-code process.",{fileKey:K.string().describe("Figma file identifier from the URL for accessing the design source"),ids:K.string().describe('Comma-separated node IDs to export. Use "Copy ID" from Figma context menu to get precise element references for comparison'),format:K.enum(["jpg","png","svg","pdf"]).optional().describe('Export format for verification: "png" for pixel-perfect comparison with transparency, "jpg" for quick previews, "svg" for scalable reference, "pdf" for print validation'),scale:K.number().optional().describe("Scale factor (1-4x) for high-resolution comparison. Use 2x+ for detailed fidelity checks on retina displays"),svg_include_id:K.boolean().optional().describe("Include element IDs in SVG for precise element mapping during code validation"),svg_simplify_stroke:K.boolean().optional().describe("Simplify stroke paths for cleaner reference images during visual comparison"),use_absolute_bounds:K.boolean().optional().describe("Use absolute positioning for accurate layout verification against implemented code"),version:K.string().optional().describe("Specific design version for consistent comparison baseline"),personalToken:K.string().optional().describe("Figma personal access token for authenticated access to design files")},async(v)=>{try{let W=await H4.images(v);return{content:[{type:"text",text:JSON.stringify(W)}]}}catch(W){return{content:[{type:"text",text:`Error: ${W.message}`}]}}})};var FW=new uJ({name:g1.serverName,version:g1.serverVersion},{capabilities:{logging:{}}});EY(FW);U4(FW);var G9=Hf(require("node:process"));IQ();class w9{append(f){this._buffer=this._buffer?Buffer.concat([this._buffer,f]):f}readMessage(){if(!this._buffer)return null;let f=this._buffer.indexOf(`
44
+ `);if(f===-1)return null;let v=this._buffer.toString("utf8",0,f).replace(/\r$/,"");return this._buffer=this._buffer.subarray(f+1),J3(v)}clear(){this._buffer=void 0}}function J3(f){return j6.parse(JSON.parse(f))}function j4(f){return JSON.stringify(f)+`
45
+ `}class z9{constructor(f=G9.default.stdin,v=G9.default.stdout){this._stdin=f,this._stdout=v,this._readBuffer=new w9,this._started=!1,this._ondata=(W)=>{this._readBuffer.append(W),this.processReadBuffer()},this._onerror=(W)=>{var X;(X=this.onerror)===null||X===void 0||X.call(this,W)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){var f,v;while(!0)try{let W=this._readBuffer.readMessage();if(W===null)break;(f=this.onmessage)===null||f===void 0||f.call(this,W)}catch(W){(v=this.onerror)===null||v===void 0||v.call(this,W)}}async close(){var f;if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),(f=this.onclose)===null||f===void 0||f.call(this)}send(f){return new Promise((v)=>{let W=j4(f);if(this._stdout.write(W))v();else this._stdout.once("drain",v)})}}V0();var X3=xf("StdioTransport");async function F4(f){try{let v=new z9;await f.connect(v)}catch(v){X3.info(JSON.stringify({jsonrpc:"2.0",id:null,error:{code:-32000,message:`Server startup failed: ${v.message}`}})),process.exit(1)}}F4(FW);
46
+
47
+ //# debugId=597DD9CE2279A33E64756E2164756E21
457
48
  //# sourceMappingURL=cli.js.map