@zibby/core 0.1.37 → 0.1.38

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.
Files changed (36) hide show
  1. package/dist/agents/base.js +85 -230
  2. package/dist/framework/agents/assistant-strategy.js +9 -67
  3. package/dist/framework/agents/claude-strategy.js +16 -105
  4. package/dist/framework/agents/codex-strategy.js +12 -18
  5. package/dist/framework/agents/cursor-strategy.js +39 -81
  6. package/dist/framework/agents/gemini-strategy.js +11 -15
  7. package/dist/framework/agents/index.js +65 -210
  8. package/dist/framework/agents/utils/cursor-output-formatter.js +4 -8
  9. package/dist/framework/agents/utils/openai-proxy-formatter.js +5 -43
  10. package/dist/framework/agents/utils/structured-output-formatter.js +4 -8
  11. package/dist/framework/code-generator.js +78 -223
  12. package/dist/framework/function-bridge.js +1 -60
  13. package/dist/framework/graph-compiler.js +77 -222
  14. package/dist/framework/graph.js +73 -218
  15. package/dist/framework/index.js +89 -242
  16. package/dist/framework/mcp-client.js +2 -56
  17. package/dist/framework/node-registry.js +68 -213
  18. package/dist/framework/node.js +70 -215
  19. package/dist/framework/state-utils.js +1 -5
  20. package/dist/index.js +187 -332
  21. package/dist/package.json +35 -36
  22. package/dist/utils/ast-utils.js +1 -9
  23. package/dist/utils/node-schema-parser.js +1 -9
  24. package/package.json +5 -6
  25. package/templates/browser-test-automation/run-index.mjs +4 -4
  26. package/templates/code-analysis/nodes/analyze-ticket-node.js +3 -3
  27. package/templates/code-analysis/nodes/create-pr-node.js +1 -1
  28. package/templates/code-analysis/nodes/generate-code-node.js +1 -1
  29. package/templates/code-analysis/nodes/generate-test-cases-node.js +1 -1
  30. package/templates/code-analysis/nodes/services/prMetaService.js +1 -1
  31. package/templates/register-nodes.js +1 -1
  32. package/scripts/export-default-workflows.js +0 -51
  33. package/scripts/patch-cursor-mcp.js +0 -174
  34. package/scripts/setup-ci.sh +0 -115
  35. package/scripts/setup-official-playwright-mcp.sh +0 -173
  36. package/scripts/test-with-video.sh +0 -49
@@ -1,25 +1,21 @@
1
- var Le=Symbol("Let zodToJsonSchema decide on which parser to use");var ze={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"},Ve=r=>typeof r=="string"?{...ze,name:r}:{...ze,...r};var Fe=r=>{let e=Ve(r),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return{...e,flags:{hasReferencedOpenAiAnyType:!1},currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,a])=>[a._def,{def:a._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};function Oe(r,e,t,n){n?.errorMessages&&t&&(r.errorMessage={...r.errorMessage,[e]:t})}function b(r,e,t,n,a){r[e]=t,Oe(r,e,n,a)}var ge=(r,e)=>{let t=0;for(;t<r.length&&t<e.length&&r[t]===e[t];t++);return[(r.length-t).toString(),...e.slice(t)].join("/")};var x;(function(r){r.assertEqual=a=>{};function e(a){}r.assertIs=e;function t(a){throw new Error}r.assertNever=t,r.arrayToEnum=a=>{let s={};for(let i of a)s[i]=i;return s},r.getValidEnumValues=a=>{let s=r.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),i={};for(let o of s)i[o]=a[o];return r.objectValues(i)},r.objectValues=a=>r.objectKeys(a).map(function(s){return a[s]}),r.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&s.push(i);return s},r.find=(a,s)=>{for(let i of a)if(s(i))return i},r.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(s)}r.joinValues=n,r.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(x||(x={}));var Ue;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ue||(Ue={}));var f=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),E=r=>{switch(typeof r){case"undefined":return f.undefined;case"string":return f.string;case"number":return Number.isNaN(r)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(r)?f.array:r===null?f.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?f.promise:typeof Map<"u"&&r instanceof Map?f.map:typeof Set<"u"&&r instanceof Set?f.set:typeof Date<"u"&&r instanceof Date?f.date:f.object;default:return f.unknown}};var u=x.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"]);var O=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},n={_errors:[]},a=s=>{for(let i of s.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,c=0;for(;c<i.path.length;){let p=i.path[c];c===i.path.length-1?(o[p]=o[p]||{_errors:[]},o[p]._errors.push(t(i))):o[p]=o[p]||{_errors:[]},o=o[p],c++}}};return a(this),n}static assert(e){if(!(e instanceof r))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t=Object.create(null),n=[];for(let a of this.issues)if(a.path.length>0){let s=a.path[0];t[s]=t[s]||[],t[s].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};O.create=r=>new O(r);var wt=(r,e)=>{let t;switch(r.code){case u.invalid_type:r.received===f.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,x.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(r.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(r.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:x.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case u.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="bigint"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case u.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(r)}return{message:t}},z=wt;var Tt=z;function ae(){return Tt}var _e=r=>{let{data:e,path:t,errorMaps:n,issueData:a}=r,s=[...t,...a.path||[]],i={...a,path:s};if(a.message!==void 0)return{...a,path:s,message:a.message};let o="",c=n.filter(p=>!!p).slice().reverse();for(let p of c)o=p(i,{data:e,defaultError:o}).message;return{...a,path:s,message:o}};function l(r,e){let t=ae(),n=_e({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===z?void 0:z].filter(a=>!!a)});r.common.issues.push(n)}var w=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let a of t){if(a.status==="aborted")return h;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let a of t){let s=await a.key,i=await a.value;n.push({key:s,value:i})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let a of t){let{key:s,value:i}=a;if(s.status==="aborted"||i.status==="aborted")return h;s.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(n[s.value]=i.value)}return{status:e.value,value:n}}},h=Object.freeze({status:"aborted"}),B=r=>({status:"dirty",value:r}),T=r=>({status:"valid",value:r}),Se=r=>r.status==="aborted",Ne=r=>r.status==="dirty",F=r=>r.status==="valid",se=r=>typeof Promise<"u"&&r instanceof Promise;var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));var P=class{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Be=(r,e)=>{if(F(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new O(r.common.issues);return this._error=t,this._error}}};function g(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:a}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(i,o)=>{let{message:c}=r;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??t??o.defaultError}},description:a}}var v=class{get description(){return this._def.description}_getType(e){return E(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:E(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:E(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(se(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Be(n,a)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:t});return F(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>F(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:E(e)},a=this._parse({data:e,path:n.path,parent:n}),s=await(se(a)?a:Promise.resolve(a));return Be(n,s)}refine(e,t){let n=a=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(a):t;return this._refinement((a,s)=>{let i=e(a),o=()=>s.addIssue({code:u.custom,...n(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof t=="function"?t(n,a):t),!1))}_refinement(e){return new D({schema:this,typeName:d.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,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:t=>this["~validate"](t)}}optional(){return j.create(this,this._def)}nullable(){return M.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return V.create(this)}promise(){return U.create(this,this._def)}or(e){return H.create([this,e],this._def)}and(e){return K.create(this,e,this._def)}transform(e){return new D({...g(this._def),schema:this,typeName:d.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new te({...g(this._def),innerType:this,defaultValue:t,typeName:d.ZodDefault})}brand(){return new ve({typeName:d.ZodBranded,type:this,...g(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new re({...g(this._def),innerType:this,catchValue:t,typeName:d.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return xe.create(this,e)}readonly(){return ne.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},At=/^c[^\s-]{8,}$/i,Ot=/^[0-9a-z]+$/,St=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Nt=/^[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,Pt=/^[a-z0-9_-]{21}$/i,jt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Dt=/^[-+]?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)?)??$/,Ct=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pe,Rt=/^(?:(?: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])$/,Et=/^(?:(?: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])$/,It=/^(([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]))$/,$t=/^(([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])$/,Mt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,zt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,We="((\\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])))",Lt=new RegExp(`^${We}$`);function qe(r){let e="[0-5]\\d";r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`);let t=r.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Vt(r){return new RegExp(`^${qe(r)}$`)}function Ft(r){let e=`${We}T${qe(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Ut(r,e){return!!((e==="v4"||!e)&&Rt.test(r)||(e==="v6"||!e)&&It.test(r))}function Bt(r,e){if(!jt.test(r))return!1;try{let[t]=r.split(".");if(!t)return!1;let n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&a?.typ!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function Wt(r,e){return!!((e==="v4"||!e)&&Et.test(r)||(e==="v6"||!e)&&$t.test(r))}var q=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.string,received:s.parsedType}),h}let n=new w,a;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let i=e.data.length>s.value,o=e.data.length<s.value;(i||o)&&(a=this._getOrReturnCtx(e,a),i?l(a,{code:u.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):o&&l(a,{code:u.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Ct.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"email",code:u.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Pe||(Pe=new RegExp(Zt,"u")),Pe.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"emoji",code:u.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Nt.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"uuid",code:u.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")Pt.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"nanoid",code:u.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")At.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"cuid",code:u.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Ot.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"cuid2",code:u.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")St.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"ulid",code:u.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),l(a,{validation:"url",code:u.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"regex",code:u.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),l(a,{code:u.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),l(a,{code:u.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),l(a,{code:u.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Ft(s).test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:u.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Lt.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:u.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Vt(s).test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{code:u.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Dt.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"duration",code:u.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Ut(e.data,s.version)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"ip",code:u.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Bt(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"jwt",code:u.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Wt(e.data,s.version)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"cidr",code:u.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Mt.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"base64",code:u.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?zt.test(e.data)||(a=this._getOrReturnCtx(e,a),l(a,{validation:"base64url",code:u.invalid_string,message:s.message}),n.dirty()):x.assertNever(s);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(a=>e.test(a),{validation:t,code:u.invalid_string,...m.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};q.create=r=>new q({checks:[],typeName:d.ZodString,coerce:r?.coerce??!1,...g(r)});function qt(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=t>n?t:n,s=Number.parseInt(r.toFixed(a).replace(".","")),i=Number.parseInt(e.toFixed(a).replace(".",""));return s%i/10**a}var ie=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==f.number){let s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.number,received:s.parsedType}),h}let n,a=new w;for(let s of this._def.checks)s.kind==="int"?x.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?qt(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:u.not_finite,message:s.message}),a.dirty()):x.assertNever(s);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,a){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(a)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ie.create=r=>new ie({checks:[],typeName:d.ZodNumber,coerce:r?.coerce||!1,...g(r)});var oe=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==f.bigint)return this._getInvalidInput(e);let n,a=new w;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:u.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):x.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:u.invalid_type,expected:f.bigint,received:t.parsedType}),h}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,a){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(a)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};oe.create=r=>new oe({checks:[],typeName:d.ZodBigInt,coerce:r?.coerce??!1,...g(r)});var ce=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let n=this._getOrReturnCtx(e);return l(n,{code:u.invalid_type,expected:f.boolean,received:n.parsedType}),h}return T(e.data)}};ce.create=r=>new ce({typeName:d.ZodBoolean,coerce:r?.coerce||!1,...g(r)});var ue=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_type,expected:f.date,received:s.parsedType}),h}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return l(s,{code:u.invalid_date}),h}let n=new w,a;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),l(a,{code:u.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):x.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};ue.create=r=>new ue({checks:[],coerce:r?.coerce||!1,typeName:d.ZodDate,...g(r)});var de=class extends v{_parse(e){if(this._getType(e)!==f.symbol){let n=this._getOrReturnCtx(e);return l(n,{code:u.invalid_type,expected:f.symbol,received:n.parsedType}),h}return T(e.data)}};de.create=r=>new de({typeName:d.ZodSymbol,...g(r)});var J=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return l(n,{code:u.invalid_type,expected:f.undefined,received:n.parsedType}),h}return T(e.data)}};J.create=r=>new J({typeName:d.ZodUndefined,...g(r)});var Y=class extends v{_parse(e){if(this._getType(e)!==f.null){let n=this._getOrReturnCtx(e);return l(n,{code:u.invalid_type,expected:f.null,received:n.parsedType}),h}return T(e.data)}};Y.create=r=>new Y({typeName:d.ZodNull,...g(r)});var le=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}};le.create=r=>new le({typeName:d.ZodAny,...g(r)});var L=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}};L.create=r=>new L({typeName:d.ZodUnknown,...g(r)});var R=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:u.invalid_type,expected:f.never,received:t.parsedType}),h}};R.create=r=>new R({typeName:d.ZodNever,...g(r)});var pe=class extends v{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return l(n,{code:u.invalid_type,expected:f.void,received:n.parsedType}),h}return T(e.data)}};pe.create=r=>new pe({typeName:d.ZodVoid,...g(r)});var V=class r extends v{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==f.array)return l(t,{code:u.invalid_type,expected:f.array,received:t.parsedType}),h;if(a.exactLength!==null){let i=t.data.length>a.exactLength.value,o=t.data.length<a.exactLength.value;(i||o)&&(l(t,{code:i?u.too_big:u.too_small,minimum:o?a.exactLength.value:void 0,maximum:i?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(l(t,{code:u.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(l(t,{code:u.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>a.type._parseAsync(new P(t,i,t.path,o)))).then(i=>w.mergeArray(n,i));let s=[...t.data].map((i,o)=>a.type._parseSync(new P(t,i,t.path,o)));return w.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}};V.create=(r,e)=>new V({type:r,minLength:null,maxLength:null,exactLength:null,typeName:d.ZodArray,...g(e)});function W(r){if(r instanceof S){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=j.create(W(n))}return new S({...r._def,shape:()=>e})}else return r instanceof V?new V({...r._def,type:W(r.element)}):r instanceof j?j.create(W(r.unwrap())):r instanceof M?M.create(W(r.unwrap())):r instanceof $?$.create(r.items.map(e=>W(e))):r}var S=class r extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==f.object){let p=this._getOrReturnCtx(e);return l(p,{code:u.invalid_type,expected:f.object,received:p.parsedType}),h}let{status:n,ctx:a}=this._processInputParams(e),{shape:s,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof R&&this._def.unknownKeys==="strip"))for(let p in a.data)i.includes(p)||o.push(p);let c=[];for(let p of i){let _=s[p],N=a.data[p];c.push({key:{status:"valid",value:p},value:_._parse(new P(a,N,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof R){let p=this._def.unknownKeys;if(p==="passthrough")for(let _ of o)c.push({key:{status:"valid",value:_},value:{status:"valid",value:a.data[_]}});else if(p==="strict")o.length>0&&(l(a,{code:u.unrecognized_keys,keys:o}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let _ of o){let N=a.data[_];c.push({key:{status:"valid",value:_},value:p._parse(new P(a,N,a.path,_)),alwaysSet:_ in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let _ of c){let N=await _.key,Me=await _.value;p.push({key:N,value:Me,alwaysSet:_.alwaysSet})}return p}).then(p=>w.mergeObjectSync(n,p)):w.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{let a=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:m.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:d.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};for(let n of x.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}omit(e){let t={};for(let n of x.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new r({...this._def,shape:()=>t})}deepPartial(){return W(this)}partial(e){let t={};for(let n of x.objectKeys(this.shape)){let a=this.shape[n];e&&!e[n]?t[n]=a:t[n]=a.optional()}return new r({...this._def,shape:()=>t})}required(e){let t={};for(let n of x.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof j;)s=s._def.innerType;t[n]=s}return new r({...this._def,shape:()=>t})}keyof(){return Je(x.objectKeys(this.shape))}};S.create=(r,e)=>new S({shape:()=>r,unknownKeys:"strip",catchall:R.create(),typeName:d.ZodObject,...g(e)});S.strictCreate=(r,e)=>new S({shape:()=>r,unknownKeys:"strict",catchall:R.create(),typeName:d.ZodObject,...g(e)});S.lazycreate=(r,e)=>new S({shape:r,unknownKeys:"strip",catchall:R.create(),typeName:d.ZodObject,...g(e)});var H=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function a(s){for(let o of s)if(o.result.status==="valid")return o.result;for(let o of s)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=s.map(o=>new O(o.ctx.common.issues));return l(t,{code:u.invalid_union,unionErrors:i}),h}if(t.common.async)return Promise.all(n.map(async s=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(a);{let s,i=[];for(let c of n){let p={...t,common:{...t.common,issues:[]},parent:null},_=c._parseSync({data:t.data,path:t.path,parent:p});if(_.status==="valid")return _;_.status==="dirty"&&!s&&(s={result:_,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let o=i.map(c=>new O(c));return l(t,{code:u.invalid_union,unionErrors:o}),h}}get options(){return this._def.options}};H.create=(r,e)=>new H({options:r,typeName:d.ZodUnion,...g(e)});var I=r=>r instanceof G?I(r.schema):r instanceof D?I(r.innerType()):r instanceof X?[r.value]:r instanceof Q?r.options:r instanceof ee?x.objectValues(r.enum):r instanceof te?I(r._def.innerType):r instanceof J?[void 0]:r instanceof Y?[null]:r instanceof j?[void 0,...I(r.unwrap())]:r instanceof M?[null,...I(r.unwrap())]:r instanceof ve||r instanceof ne?I(r.unwrap()):r instanceof re?I(r._def.innerType):[],je=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.object)return l(t,{code:u.invalid_type,expected:f.object,received:t.parsedType}),h;let n=this.discriminator,a=t.data[n],s=this.optionsMap.get(a);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:u.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let a=new Map;for(let s of t){let i=I(s.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,s)}}return new r({typeName:d.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:a,...g(n)})}};function De(r,e){let t=E(r),n=E(e);if(r===e)return{valid:!0,data:r};if(t===f.object&&n===f.object){let a=x.objectKeys(e),s=x.objectKeys(r).filter(o=>a.indexOf(o)!==-1),i={...r,...e};for(let o of s){let c=De(r[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===f.array&&n===f.array){if(r.length!==e.length)return{valid:!1};let a=[];for(let s=0;s<r.length;s++){let i=r[s],o=e[s],c=De(i,o);if(!c.valid)return{valid:!1};a.push(c.data)}return{valid:!0,data:a}}else return t===f.date&&n===f.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var K=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),a=(s,i)=>{if(Se(s)||Se(i))return h;let o=De(s.value,i.value);return o.valid?((Ne(s)||Ne(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:u.invalid_intersection_types}),h)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,i])=>a(s,i)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};K.create=(r,e,t)=>new K({left:r,right:e,typeName:d.ZodIntersection,...g(t)});var $=class r extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.array)return l(n,{code:u.invalid_type,expected:f.array,received:n.parsedType}),h;if(n.data.length<this._def.items.length)return l(n,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((i,o)=>{let c=this._def.items[o]||this._def.rest;return c?c._parse(new P(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(s).then(i=>w.mergeArray(t,i)):w.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};$.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $({items:r,typeName:d.ZodTuple,rest:null,...g(e)})};var Ce=class r extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.object)return l(n,{code:u.invalid_type,expected:f.object,received:n.parsedType}),h;let a=[],s=this._def.keyType,i=this._def.valueType;for(let o in n.data)a.push({key:s._parse(new P(n,o,n.path,o)),value:i._parse(new P(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?w.mergeObjectAsync(t,a):w.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof v?new r({keyType:e,valueType:t,typeName:d.ZodRecord,...g(n)}):new r({keyType:q.create(),valueType:e,typeName:d.ZodRecord,...g(t)})}},fe=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.map)return l(n,{code:u.invalid_type,expected:f.map,received:n.parsedType}),h;let a=this._def.keyType,s=this._def.valueType,i=[...n.data.entries()].map(([o,c],p)=>({key:a._parse(new P(n,o,n.path,[p,"key"])),value:s._parse(new P(n,c,n.path,[p,"value"]))}));if(n.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let c of i){let p=await c.key,_=await c.value;if(p.status==="aborted"||_.status==="aborted")return h;(p.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(p.value,_.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let c of i){let p=c.key,_=c.value;if(p.status==="aborted"||_.status==="aborted")return h;(p.status==="dirty"||_.status==="dirty")&&t.dirty(),o.set(p.value,_.value)}return{status:t.value,value:o}}}};fe.create=(r,e,t)=>new fe({valueType:e,keyType:r,typeName:d.ZodMap,...g(t)});var me=class r extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return l(n,{code:u.invalid_type,expected:f.set,received:n.parsedType}),h;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(l(n,{code:u.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(l(n,{code:u.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let s=this._def.valueType;function i(c){let p=new Set;for(let _ of c){if(_.status==="aborted")return h;_.status==="dirty"&&t.dirty(),p.add(_.value)}return{status:t.value,value:p}}let o=[...n.data.values()].map((c,p)=>s._parse(new P(n,c,n.path,p)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};me.create=(r,e)=>new me({valueType:r,minSize:null,maxSize:null,typeName:d.ZodSet,...g(e)});var Ze=class r extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.function)return l(t,{code:u.invalid_type,expected:f.function,received:t.parsedType}),h;function n(o,c){return _e({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ae(),z].filter(p=>!!p),issueData:{code:u.invalid_arguments,argumentsError:c}})}function a(o,c){return _e({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ae(),z].filter(p=>!!p),issueData:{code:u.invalid_return_type,returnTypeError:c}})}let s={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof U){let o=this;return T(async function(...c){let p=new O([]),_=await o._def.args.parseAsync(c,s).catch(Ae=>{throw p.addIssue(n(c,Ae)),p}),N=await Reflect.apply(i,this,_);return await o._def.returns._def.type.parseAsync(N,s).catch(Ae=>{throw p.addIssue(a(N,Ae)),p})})}else{let o=this;return T(function(...c){let p=o._def.args.safeParse(c,s);if(!p.success)throw new O([n(c,p.error)]);let _=Reflect.apply(i,this,p.data),N=o._def.returns.safeParse(_,s);if(!N.success)throw new O([a(_,N.error)]);return N.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:$.create(e).rest(L.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||$.create([]).rest(L.create()),returns:t||L.create(),typeName:d.ZodFunction,...g(n)})}},G=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};G.create=(r,e)=>new G({getter:r,typeName:d.ZodLazy,...g(e)});var X=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}};X.create=(r,e)=>new X({value:r,typeName:d.ZodLiteral,...g(e)});function Je(r,e){return new Q({values:r,typeName:d.ZodEnum,...g(e)})}var Q=class r extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:x.joinValues(n),received:t.parsedType,code:u.invalid_type}),h}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:u.invalid_enum_value,options:n}),h}return T(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};Q.create=Je;var ee=class extends v{_parse(e){let t=x.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.number){let a=x.objectValues(t);return l(n,{expected:x.joinValues(a),received:n.parsedType,code:u.invalid_type}),h}if(this._cache||(this._cache=new Set(x.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let a=x.objectValues(t);return l(n,{received:n.data,code:u.invalid_enum_value,options:a}),h}return T(e.data)}get enum(){return this._def.values}};ee.create=(r,e)=>new ee({values:r,typeName:d.ZodNativeEnum,...g(e)});var U=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==f.promise&&t.common.async===!1)return l(t,{code:u.invalid_type,expected:f.promise,received:t.parsedType}),h;let n=t.parsedType===f.promise?t.data:Promise.resolve(t.data);return T(n.then(a=>this._def.type.parseAsync(a,{path:t.path,errorMap:t.common.contextualErrorMap})))}};U.create=(r,e)=>new U({type:r,typeName:d.ZodPromise,...g(e)});var D=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===d.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,s={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="preprocess"){let i=a.transform(n.data,s);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return h;let c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?h:c.status==="dirty"?B(c.value):t.value==="dirty"?B(c.value):c});{if(t.value==="aborted")return h;let o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?h:o.status==="dirty"?B(o.value):t.value==="dirty"?B(o.value):o}}if(a.type==="refinement"){let i=o=>{let c=a.refinement(o,s);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?h:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?h:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!F(i))return h;let o=a.transform(i.value,s);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>F(i)?Promise.resolve(a.transform(i.value,s)).then(o=>({status:t.value,value:o})):h);x.assertNever(a)}};D.create=(r,e,t)=>new D({schema:r,typeName:d.ZodEffects,effect:e,...g(t)});D.createWithPreprocess=(r,e,t)=>new D({schema:e,effect:{type:"preprocess",transform:r},typeName:d.ZodEffects,...g(t)});var j=class extends v{_parse(e){return this._getType(e)===f.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};j.create=(r,e)=>new j({innerType:r,typeName:d.ZodOptional,...g(e)});var M=class extends v{_parse(e){return this._getType(e)===f.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};M.create=(r,e)=>new M({innerType:r,typeName:d.ZodNullable,...g(e)});var te=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:d.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...g(e)});var re=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return se(a)?a.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new O(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new O(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};re.create=(r,e)=>new re({innerType:r,typeName:d.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...g(e)});var he=class extends v{_parse(e){if(this._getType(e)!==f.nan){let n=this._getOrReturnCtx(e);return l(n,{code:u.invalid_type,expected:f.nan,received:n.parsedType}),h}return{status:"valid",value:e.data}}};he.create=r=>new he({typeName:d.ZodNaN,...g(r)});var ve=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},xe=class r extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?h:s.status==="dirty"?(t.dirty(),B(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?h:a.status==="dirty"?(t.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:d.ZodPipeline})}},ne=class extends v{_parse(e){let t=this._def.innerType._parse(e),n=a=>(F(a)&&(a.value=Object.freeze(a.value)),a);return se(t)?t.then(a=>n(a)):n(t)}unwrap(){return this._def.innerType}};ne.create=(r,e)=>new ne({innerType:r,typeName:d.ZodReadonly,...g(e)});var Tr={object:S.lazycreate},d;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(d||(d={}));var Ar=q.create,Or=ie.create,Sr=he.create,Nr=oe.create,Pr=ce.create,jr=ue.create,Dr=de.create,Cr=J.create,Zr=Y.create,Rr=le.create,Er=L.create,Ir=R.create,$r=pe.create,Mr=V.create,zr=S.create,Lr=S.strictCreate,Vr=H.create,Fr=je.create,Ur=K.create,Br=$.create,Wr=Ce.create,qr=fe.create,Jr=me.create,Yr=Ze.create,Hr=G.create,Kr=X.create,Gr=Q.create,Xr=ee.create,Qr=U.create,en=D.create,tn=j.create,rn=M.create,nn=D.createWithPreprocess,an=xe.create;function k(r){if(r.target!=="openAi")return{};let e=[...r.basePath,r.definitionPath,r.openAiAnyTypeName];return r.flags.hasReferencedOpenAiAnyType=!0,{$ref:r.$refStrategy==="relative"?ge(e,r.currentPath):e.join("/")}}function Ye(r,e){let t={type:"array"};return r.type?._def&&r.type?._def?.typeName!==d.ZodAny&&(t.items=y(r.type._def,{...e,currentPath:[...e.currentPath,"items"]})),r.minLength&&b(t,"minItems",r.minLength.value,r.minLength.message,e),r.maxLength&&b(t,"maxItems",r.maxLength.value,r.maxLength.message,e),r.exactLength&&(b(t,"minItems",r.exactLength.value,r.exactLength.message,e),b(t,"maxItems",r.exactLength.value,r.exactLength.message,e)),t}function He(r,e){let t={type:"integer",format:"int64"};if(!r.checks)return t;for(let n of r.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?b(t,"minimum",n.value,n.message,e):b(t,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),b(t,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?b(t,"maximum",n.value,n.message,e):b(t,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),b(t,"maximum",n.value,n.message,e));break;case"multipleOf":b(t,"multipleOf",n.value,n.message,e);break}return t}function Ke(){return{type:"boolean"}}function be(r,e){return y(r.type._def,e)}var Ge=(r,e)=>y(r.innerType._def,e);function Re(r,e,t){let n=t??e.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a,s)=>Re(r,e,a))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Yt(r,e)}}var Yt=(r,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let n of r.checks)switch(n.kind){case"min":b(t,"minimum",n.value,n.message,e);break;case"max":b(t,"maximum",n.value,n.message,e);break}return t};function Xe(r,e){return{...y(r.innerType._def,e),default:r.defaultValue()}}function Qe(r,e){return e.effectStrategy==="input"?y(r.schema._def,e):k(e)}function et(r){return{type:"string",enum:Array.from(r.values)}}var Ht=r=>"type"in r&&r.type==="string"?!1:"allOf"in r;function tt(r,e){let t=[y(r.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),y(r.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,a=[];return t.forEach(s=>{if(Ht(s))a.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else{let i=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:o,...c}=s;i=c}else n=void 0;a.push(i)}}),a.length?{allOf:a,...n}:void 0}function rt(r,e){let t=typeof r.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(r.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[r.value]}:{type:t==="bigint"?"integer":t,const:r.value}}var Ee,C={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:()=>(Ee===void 0&&(Ee=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ee),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 ke(r,e){let t={type:"string"};if(r.checks)for(let n of r.checks)switch(n.kind){case"min":b(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e);break;case"max":b(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case"email":switch(e.emailStrategy){case"format:email":Z(t,"email",n.message,e);break;case"format:idn-email":Z(t,"idn-email",n.message,e);break;case"pattern:zod":A(t,C.email,n.message,e);break}break;case"url":Z(t,"uri",n.message,e);break;case"uuid":Z(t,"uuid",n.message,e);break;case"regex":A(t,n.regex,n.message,e);break;case"cuid":A(t,C.cuid,n.message,e);break;case"cuid2":A(t,C.cuid2,n.message,e);break;case"startsWith":A(t,RegExp(`^${Ie(n.value,e)}`),n.message,e);break;case"endsWith":A(t,RegExp(`${Ie(n.value,e)}$`),n.message,e);break;case"datetime":Z(t,"date-time",n.message,e);break;case"date":Z(t,"date",n.message,e);break;case"time":Z(t,"time",n.message,e);break;case"duration":Z(t,"duration",n.message,e);break;case"length":b(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,n.value):n.value,n.message,e),b(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,n.value):n.value,n.message,e);break;case"includes":{A(t,RegExp(Ie(n.value,e)),n.message,e);break}case"ip":{n.version!=="v6"&&Z(t,"ipv4",n.message,e),n.version!=="v4"&&Z(t,"ipv6",n.message,e);break}case"base64url":A(t,C.base64url,n.message,e);break;case"jwt":A(t,C.jwt,n.message,e);break;case"cidr":{n.version!=="v6"&&A(t,C.ipv4Cidr,n.message,e),n.version!=="v4"&&A(t,C.ipv6Cidr,n.message,e);break}case"emoji":A(t,C.emoji(),n.message,e);break;case"ulid":{A(t,C.ulid,n.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{Z(t,"binary",n.message,e);break}case"contentEncoding:base64":{b(t,"contentEncoding","base64",n.message,e);break}case"pattern:zod":{A(t,C.base64,n.message,e);break}}break}case"nanoid":A(t,C.nanoid,n.message,e);case"toLowerCase":case"toUpperCase":case"trim":break;default:}return t}function Ie(r,e){return e.patternStrategy==="escape"?Gt(r):r}var Kt=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Gt(r){let e="";for(let t=0;t<r.length;t++)Kt.has(r[t])||(e+="\\"),e+=r[t];return e}function Z(r,e,t,n){r.format||r.anyOf?.some(a=>a.format)?(r.anyOf||(r.anyOf=[]),r.format&&(r.anyOf.push({format:r.format,...r.errorMessage&&n.errorMessages&&{errorMessage:{format:r.errorMessage.format}}}),delete r.format,r.errorMessage&&(delete r.errorMessage.format,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.anyOf.push({format:e,...t&&n.errorMessages&&{errorMessage:{format:t}}})):b(r,"format",e,t,n)}function A(r,e,t,n){r.pattern||r.allOf?.some(a=>a.pattern)?(r.allOf||(r.allOf=[]),r.pattern&&(r.allOf.push({pattern:r.pattern,...r.errorMessage&&n.errorMessages&&{errorMessage:{pattern:r.errorMessage.pattern}}}),delete r.pattern,r.errorMessage&&(delete r.errorMessage.pattern,Object.keys(r.errorMessage).length===0&&delete r.errorMessage)),r.allOf.push({pattern:nt(e,n),...t&&n.errorMessages&&{errorMessage:{pattern:t}}})):b(r,"pattern",nt(e,n),t,n)}function nt(r,e){if(!e.applyRegexFlags||!r.flags)return r.source;let t={i:r.flags.includes("i"),m:r.flags.includes("m"),s:r.flags.includes("s")},n=t.i?r.source.toLowerCase():r.source,a="",s=!1,i=!1,o=!1;for(let c=0;c<n.length;c++){if(s){a+=n[c],s=!1;continue}if(t.i){if(i){if(n[c].match(/[a-z]/)){o?(a+=n[c],a+=`${n[c-2]}-${n[c]}`.toUpperCase(),o=!1):n[c+1]==="-"&&n[c+2]?.match(/[a-z]/)?(a+=n[c],o=!0):a+=`${n[c]}${n[c].toUpperCase()}`;continue}}else if(n[c].match(/[a-z]/)){a+=`[${n[c]}${n[c].toUpperCase()}]`;continue}}if(t.m){if(n[c]==="^"){a+=`(^|(?<=[\r
2
- ]))`;continue}else if(n[c]==="$"){a+=`($|(?=[\r
3
- ]))`;continue}}if(t.s&&n[c]==="."){a+=i?`${n[c]}\r
4
- `:`[${n[c]}\r
5
- ]`;continue}a+=n[c],n[c]==="\\"?s=!0:i&&n[c]==="]"?i=!1:!i&&n[c]==="["&&(i=!0)}try{new RegExp(a)}catch{return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),r.source}return a}function we(r,e){if(e.target==="openAi"&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),e.target==="openApi3"&&r.keyType?._def.typeName===d.ZodEnum)return{type:"object",required:r.keyType._def.values,properties:r.keyType._def.values.reduce((n,a)=>({...n,[a]:y(r.valueType._def,{...e,currentPath:[...e.currentPath,"properties",a]})??k(e)}),{}),additionalProperties:e.rejectedAdditionalProperties};let t={type:"object",additionalProperties:y(r.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??e.allowedAdditionalProperties};if(e.target==="openApi3")return t;if(r.keyType?._def.typeName===d.ZodString&&r.keyType._def.checks?.length){let{type:n,...a}=ke(r.keyType._def,e);return{...t,propertyNames:a}}else{if(r.keyType?._def.typeName===d.ZodEnum)return{...t,propertyNames:{enum:r.keyType._def.values}};if(r.keyType?._def.typeName===d.ZodBranded&&r.keyType._def.type._def.typeName===d.ZodString&&r.keyType._def.type._def.checks?.length){let{type:n,...a}=be(r.keyType._def,e);return{...t,propertyNames:a}}}return t}function at(r,e){if(e.mapStrategy==="record")return we(r,e);let t=y(r.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||k(e),n=y(r.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||k(e);return{type:"array",maxItems:125,items:{type:"array",items:[t,n],minItems:2,maxItems:2}}}function st(r){let e=r.values,n=Object.keys(r.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),a=Array.from(new Set(n.map(s=>typeof s)));return{type:a.length===1?a[0]==="string"?"string":"number":["string","number"],enum:n}}function it(r){return r.target==="openAi"?void 0:{not:k({...r,currentPath:[...r.currentPath,"not"]})}}function ot(r){return r.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}var ye={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function ut(r,e){if(e.target==="openApi3")return ct(r,e);let t=r.options instanceof Map?Array.from(r.options.values()):r.options;if(t.every(n=>n._def.typeName in ye&&(!n._def.checks||!n._def.checks.length))){let n=t.reduce((a,s)=>{let i=ye[s._def.typeName];return i&&!a.includes(i)?[...a,i]:a},[]);return{type:n.length>1?n:n[0]}}else if(t.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=t.reduce((a,s)=>{let i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...a,i];case"bigint":return[...a,"integer"];case"object":if(s._def.value===null)return[...a,"null"];default:return a}},[]);if(n.length===t.length){let a=n.filter((s,i,o)=>o.indexOf(s)===i);return{type:a.length>1?a:a[0],enum:t.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(t.every(n=>n._def.typeName==="ZodEnum"))return{type:"string",enum:t.reduce((n,a)=>[...n,...a._def.values.filter(s=>!n.includes(s))],[])};return ct(r,e)}var ct=(r,e)=>{let t=(r.options instanceof Map?Array.from(r.options.values()):r.options).map((n,a)=>y(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${a}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return t.length?{anyOf:t}:void 0};function dt(r,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return e.target==="openApi3"?{type:ye[r.innerType._def.typeName],nullable:!0}:{type:[ye[r.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=y(r.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let t=y(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}function lt(r,e){let t={type:"number"};if(!r.checks)return t;for(let n of r.checks)switch(n.kind){case"int":t.type="integer",Oe(t,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?b(t,"minimum",n.value,n.message,e):b(t,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),b(t,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?b(t,"maximum",n.value,n.message,e):b(t,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),b(t,"maximum",n.value,n.message,e));break;case"multipleOf":b(t,"multipleOf",n.value,n.message,e);break}return t}function pt(r,e){let t=e.target==="openAi",n={type:"object",properties:{}},a=[],s=r.shape();for(let o in s){let c=s[o];if(c===void 0||c._def===void 0)continue;let p=Qt(c);p&&t&&(c._def.typeName==="ZodOptional"&&(c=c._def.innerType),c.isNullable()||(c=c.nullable()),p=!1);let _=y(c._def,{...e,currentPath:[...e.currentPath,"properties",o],propertyPath:[...e.currentPath,"properties",o]});_!==void 0&&(n.properties[o]=_,p||a.push(o))}a.length&&(n.required=a);let i=Xt(r,e);return i!==void 0&&(n.additionalProperties=i),n}function Xt(r,e){if(r.catchall._def.typeName!=="ZodNever")return y(r.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]});switch(r.unknownKeys){case"passthrough":return e.allowedAdditionalProperties;case"strict":return e.rejectedAdditionalProperties;case"strip":return e.removeAdditionalStrategy==="strict"?e.allowedAdditionalProperties:e.rejectedAdditionalProperties}}function Qt(r){try{return r.isOptional()}catch{return!0}}var ft=(r,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return y(r.innerType._def,e);let t=y(r.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:k(e)},t]}:k(e)};var mt=(r,e)=>{if(e.pipeStrategy==="input")return y(r.in._def,e);if(e.pipeStrategy==="output")return y(r.out._def,e);let t=y(r.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=y(r.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return{allOf:[t,n].filter(a=>a!==void 0)}};function ht(r,e){return y(r.type._def,e)}function yt(r,e){let n={type:"array",uniqueItems:!0,items:y(r.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return r.minSize&&b(n,"minItems",r.minSize.value,r.minSize.message,e),r.maxSize&&b(n,"maxItems",r.maxSize.value,r.maxSize.message,e),n}function gt(r,e){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map((t,n)=>y(t._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[]),additionalItems:y(r.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map((t,n)=>y(t._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[])}}function _t(r){return{not:k(r)}}function vt(r){return k(r)}var xt=(r,e)=>y(r.innerType._def,e);var bt=(r,e,t)=>{switch(e){case d.ZodString:return ke(r,t);case d.ZodNumber:return lt(r,t);case d.ZodObject:return pt(r,t);case d.ZodBigInt:return He(r,t);case d.ZodBoolean:return Ke();case d.ZodDate:return Re(r,t);case d.ZodUndefined:return _t(t);case d.ZodNull:return ot(t);case d.ZodArray:return Ye(r,t);case d.ZodUnion:case d.ZodDiscriminatedUnion:return ut(r,t);case d.ZodIntersection:return tt(r,t);case d.ZodTuple:return gt(r,t);case d.ZodRecord:return we(r,t);case d.ZodLiteral:return rt(r,t);case d.ZodEnum:return et(r);case d.ZodNativeEnum:return st(r);case d.ZodNullable:return dt(r,t);case d.ZodOptional:return ft(r,t);case d.ZodMap:return at(r,t);case d.ZodSet:return yt(r,t);case d.ZodLazy:return()=>r.getter()._def;case d.ZodPromise:return ht(r,t);case d.ZodNaN:case d.ZodNever:return it(t);case d.ZodEffects:return Qe(r,t);case d.ZodAny:return k(t);case d.ZodUnknown:return vt(t);case d.ZodDefault:return Xe(r,t);case d.ZodBranded:return be(r,t);case d.ZodReadonly:return xt(r,t);case d.ZodCatch:return Ge(r,t);case d.ZodPipeline:return mt(r,t);case d.ZodFunction:case d.ZodVoid:case d.ZodSymbol:return;default:return(n=>{})(e)}};function y(r,e,t=!1){let n=e.seen.get(r);if(e.override){let o=e.override?.(r,e,n,t);if(o!==Le)return o}if(n&&!t){let o=er(n,e);if(o!==void 0)return o}let a={def:r,path:e.currentPath,jsonSchema:void 0};e.seen.set(r,a);let s=bt(r,r.typeName,e),i=typeof s=="function"?y(s(),e):s;if(i&&tr(r,e,i),e.postProcess){let o=e.postProcess(i,r,e);return a.jsonSchema=i,o}return a.jsonSchema=i,i}var er=(r,e)=>{switch(e.$refStrategy){case"root":return{$ref:r.path.join("/")};case"relative":return{$ref:ge(e.currentPath,r.path)};case"none":case"seen":return r.path.length<e.currentPath.length&&r.path.every((t,n)=>e.currentPath[n]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),k(e)):e.$refStrategy==="seen"?k(e):void 0}},tr=(r,e,t)=>(r.description&&(t.description=r.description,e.markdownDescription&&(t.markdownDescription=r.description)),t);var $e=(r,e)=>{let t=Fe(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[p,_])=>({...c,[p]:y(_._def,{...t,currentPath:[...t.basePath,t.definitionPath,p]},!0)??k(t)}),{}):void 0,a=typeof e=="string"?e:e?.nameStrategy==="title"?void 0:e?.name,s=y(r._def,a===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,a]},!1)??k(t),i=typeof e=="object"&&e.name!==void 0&&e.nameStrategy==="title"?e.name:void 0;i!==void 0&&(s.title=i),t.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[t.openAiAnyTypeName]||(n[t.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:t.$refStrategy==="relative"?"1":[...t.basePath,t.definitionPath,t.openAiAnyTypeName].join("/")}}));let o=a===void 0?n?{...s,[t.definitionPath]:n}:s:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,a].join("/"),[t.definitionPath]:{...n,[a]:s}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":(t.target==="jsonSchema2019-09"||t.target==="openAi")&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),t.target==="openAi"&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o};var Te=class{static generateFileOutputInstructions(e,t){let n;typeof e?.parse=="function"?n=$e(e,{target:"openApi3"}):n=e;let a=this._buildExample(n);return`
1
+ import{zodToJsonSchema as u}from"zod-to-json-schema";var n=class{static generateFileOutputInstructions(e,i){let t;typeof e?.parse=="function"?t=u(e,{target:"openApi3"}):t=e;let r=this._buildExample(t);return`
6
2
  \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
7
3
  \u{1F6A8} MANDATORY: WRITE RESULT TO FILE \u{1F6A8}
8
4
  \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
9
5
  You MUST write your final result as pure JSON to this EXACT file path:
10
6
 
11
- ${t}
7
+ ${i}
12
8
 
13
9
  Use your file writing tool (WriteFile or ApplyPatch) to create this file.
14
10
  DO NOT just output JSON to stdout. The file MUST exist when you finish.
15
11
  DO NOT skip this step. The workflow WILL FAIL if the file is missing.
16
12
 
17
13
  Required JSON structure:
18
- ${JSON.stringify(a,null,2)}
14
+ ${JSON.stringify(r,null,2)}
19
15
 
20
16
  JSON types (strict \u2014 validators reject wrong types):
21
17
  - Use bare JSON numbers for numeric fields (e.g. 3000). Do NOT quote them as strings (wrong: "3000").
22
18
  - Use true/false without quotes for booleans.
23
19
  - Use unquoted null where a field may be null.
24
20
 
25
- Rules: valid JSON only, no markdown wrapping, no extra text in the file.`}static _buildExample(e){if(!e)return{};let t=e.type;if(t==="object"&&e.properties){let n={};for(let[a,s]of Object.entries(e.properties))n[a]=this._buildExample(s);return n}if(t==="array"&&e.items)return[this._buildExample(e.items)];if(t==="string")return"<string>";if(t==="number"||t==="integer")return 0;if(t==="boolean")return!1;if(e.description)return`<${e.description}>`;if(e.nullable||e.oneOf||e.anyOf){let n=e.oneOf?.find(a=>a.type!=="null")||e.anyOf?.find(a=>a.type!=="null");return n?this._buildExample(n):null}return"<value>"}};var kt=class extends Te{};export{kt as CursorOutputFormatter};
21
+ Rules: valid JSON only, no markdown wrapping, no extra text in the file.`}static _buildExample(e){if(!e)return{};let i=e.type;if(i==="object"&&e.properties){let t={};for(let[r,s]of Object.entries(e.properties))t[r]=this._buildExample(s);return t}if(i==="array"&&e.items)return[this._buildExample(e.items)];if(i==="string")return"<string>";if(i==="number"||i==="integer")return 0;if(i==="boolean")return!1;if(e.description)return`<${e.description}>`;if(e.nullable||e.oneOf||e.anyOf){let t=e.oneOf?.find(r=>r.type!=="null")||e.anyOf?.find(r=>r.type!=="null");return t?this._buildExample(t):null}return"<value>"}};var o=class extends n{};export{o as CursorOutputFormatter};
@@ -1,47 +1,9 @@
1
- var Ou=Object.defineProperty;var _e=(e,t)=>{for(var r in t)Ou(e,r,{get:t[r],enumerable:!0})};import od from"axios";import{homedir as ad}from"node:os";import{join as cd}from"node:path";import{existsSync as ud,readFileSync as ld}from"node:fs";var Uu=Object.freeze({status:"aborted"});function u(e,t,r){function n(c,l){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,l);let s=a.prototype,d=Object.keys(s);for(let p=0;p<d.length;p++){let g=d[p];g in c||(c[g]=s[g].bind(c))}}let i=r?.Parent??Object;class o extends i{}Object.defineProperty(o,"name",{value:e});function a(c){var l;let s=r?.Parent?new o:this;n(s,c),(l=s._zod).deferred??(l.deferred=[]);for(let d of s._zod.deferred)d();return s}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var V=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},re=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}},Ke={};function P(e){return e&&Object.assign(Ke,e),Ke}var m={};_e(m,{BIGINT_FORMAT_RANGES:()=>Bt,Class:()=>Rt,NUMBER_FORMAT_RANGES:()=>Kt,aborted:()=>H,allowsEval:()=>Jt,assert:()=>Eu,assertEqual:()=>Zu,assertIs:()=>Tu,assertNever:()=>Nu,assertNotEqual:()=>Du,assignProp:()=>q,base64ToUint8Array:()=>Si,base64urlToUint8Array:()=>Qu,cached:()=>ue,captureStackTrace:()=>Ge,cleanEnum:()=>Hu,cleanRegex:()=>be,clone:()=>N,cloneDef:()=>Lu,createTransparentProxy:()=>Mu,defineLazy:()=>b,esc:()=>Be,escapeRegex:()=>R,extend:()=>Gu,finalizeIssue:()=>D,floatSafeRemainder:()=>Ct,getElementAtPath:()=>Ru,getEnumValues:()=>xe,getLengthableOrigin:()=>Ie,getParsedType:()=>Vu,getSizableOrigin:()=>ze,hexToUint8Array:()=>tl,isObject:()=>ne,isPlainObject:()=>Y,issue:()=>le,joinValues:()=>$,jsonStringifyReplacer:()=>ce,merge:()=>Xu,mergeDefs:()=>B,normalizeParams:()=>f,nullish:()=>X,numKeys:()=>Ju,objectClone:()=>Au,omit:()=>Bu,optionalKeys:()=>Mt,parsedType:()=>_,partial:()=>qu,pick:()=>Ku,prefixIssues:()=>E,primitiveTypes:()=>Vt,promiseAllObject:()=>Cu,propertyKeyTypes:()=>ke,randomString:()=>Fu,required:()=>Yu,safeExtend:()=>Wu,shallowClone:()=>Ii,slugify:()=>Ft,stringifyPrimitive:()=>h,uint8ArrayToBase64:()=>wi,uint8ArrayToBase64url:()=>el,uint8ArrayToHex:()=>rl,unwrapMessage:()=>ye});function Zu(e){return e}function Du(e){return e}function Tu(e){}function Nu(e){throw new Error("Unexpected value in exhaustive check")}function Eu(e){}function xe(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,i])=>t.indexOf(+n)===-1).map(([n,i])=>i)}function $(e,t="|"){return e.map(r=>h(r)).join(t)}function ce(e,t){return typeof t=="bigint"?t.toString():t}function ue(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function X(e){return e==null}function be(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Ct(e,t){let r=(e.toString().split(".")[1]||"").length,n=t.toString(),i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){let l=n.match(/\d?e-(\d?)/);l?.[1]&&(i=Number.parseInt(l[1]))}let o=r>i?r:i,a=Number.parseInt(e.toFixed(o).replace(".","")),c=Number.parseInt(t.toFixed(o).replace(".",""));return a%c/10**o}var zi=Symbol("evaluating");function b(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==zi)return n===void 0&&(n=zi,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function Au(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function q(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function B(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Lu(e){return B(e._zod.def)}function Ru(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function Cu(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let i={};for(let o=0;o<t.length;o++)i[t[o]]=n[o];return i})}function Fu(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function Be(e){return JSON.stringify(e)}function Ft(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ge="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ne(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Jt=ue(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Y(e){if(ne(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(ne(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ii(e){return Y(e)?{...e}:Array.isArray(e)?[...e]:e}function Ju(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var Vu=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},ke=new Set(["string","number","symbol"]),Vt=new Set(["string","number","bigint","boolean","symbol","undefined"]);function R(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function N(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function f(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Mu(e){let t;return new Proxy({},{get(r,n,i){return t??(t=e()),Reflect.get(t,n,i)},set(r,n,i,o){return t??(t=e()),Reflect.set(t,n,i,o)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,i){return t??(t=e()),Reflect.defineProperty(t,n,i)}})}function h(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Mt(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Kt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Bt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ku(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let o=B(e._zod.def,{get shape(){let a={};for(let c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=r.shape[c])}return q(this,"shape",a),a},checks:[]});return N(e,o)}function Bu(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let o=B(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let c in t){if(!(c in r.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return q(this,"shape",a),a},checks:[]});return N(e,o)}function Gu(e,t){if(!Y(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(o,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let i=B(e._zod.def,{get shape(){let o={...e._zod.def.shape,...t};return q(this,"shape",o),o}});return N(e,i)}function Wu(e,t){if(!Y(t))throw new Error("Invalid input to safeExtend: expected a plain object");let r=B(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return q(this,"shape",n),n}});return N(e,r)}function Xu(e,t){let r=B(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return q(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return N(e,r)}function qu(e,t,r){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let a=B(t._zod.def,{get shape(){let c=t._zod.def.shape,l={...c};if(r)for(let s in r){if(!(s in c))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(l[s]=e?new e({type:"optional",innerType:c[s]}):c[s])}else for(let s in c)l[s]=e?new e({type:"optional",innerType:c[s]}):c[s];return q(this,"shape",l),l},checks:[]});return N(t,a)}function Yu(e,t,r){let n=B(t._zod.def,{get shape(){let i=t._zod.def.shape,o={...i};if(r)for(let a in r){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);r[a]&&(o[a]=new e({type:"nonoptional",innerType:i[a]}))}else for(let a in i)o[a]=new e({type:"nonoptional",innerType:i[a]});return q(this,"shape",o),o}});return N(t,n)}function H(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function E(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ye(e){return typeof e=="string"?e:e?.message}function D(e,t,r){let n={...e,path:e.path??[]};if(!e.message){let i=ye(e.inst?._zod.def?.error?.(e))??ye(t?.error?.(e))??ye(r.customError?.(e))??ye(r.localeError?.(e))??"Invalid input";n.message=i}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function ze(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Ie(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function _(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function le(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function Hu(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Si(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function wi(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Qu(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Si(t+r)}function el(e){return wi(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function tl(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function rl(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Rt=class{constructor(...t){}};var ji=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ce,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},We=u("$ZodError",ji),Se=u("$ZodError",ji,{Parent:Error});function Gt(e,t=r=>r.message){let r={},n=[];for(let i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function Wt(e,t=r=>r.message){let r={_errors:[]},n=i=>{for(let o of i.issues)if(o.code==="invalid_union"&&o.errors.length)o.errors.map(a=>n({issues:a}));else if(o.code==="invalid_key")n({issues:o.issues});else if(o.code==="invalid_element")n({issues:o.issues});else if(o.path.length===0)r._errors.push(t(o));else{let a=r,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return n(e),r}var we=e=>(t,r,n,i)=>{let o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new V;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(l=>D(l,o,P())));throw Ge(c,i?.callee),c}return a.value},Xt=we(Se),je=e=>async(t,r,n,i)=>{let o=n?Object.assign(n,{async:!0}):{async:!0},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(l=>D(l,o,P())));throw Ge(c,i?.callee),c}return a.value},qt=je(Se),Pe=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new V;return o.issues.length?{success:!1,error:new(e??We)(o.issues.map(a=>D(a,i,P())))}:{success:!0,data:o.value}},Pi=Pe(Se),Oe=e=>async(t,r,n)=>{let i=n?Object.assign(n,{async:!0}):{async:!0},o=t._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new e(o.issues.map(a=>D(a,i,P())))}:{success:!0,data:o.value}},Oi=Oe(Se),Ui=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return we(e)(t,r,i)};var Zi=e=>(t,r,n)=>we(e)(t,r,n);var Di=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return je(e)(t,r,i)};var Ti=e=>async(t,r,n)=>je(e)(t,r,n);var Ni=e=>(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Pe(e)(t,r,i)};var Ei=e=>(t,r,n)=>Pe(e)(t,r,n);var Ai=e=>async(t,r,n)=>{let i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Oe(e)(t,r,i)};var Li=e=>async(t,r,n)=>Oe(e)(t,r,n);var M={};_e(M,{base64:()=>mr,base64url:()=>Xe,bigint:()=>hr,boolean:()=>yr,browserEmail:()=>dl,cidrv4:()=>sr,cidrv6:()=>dr,cuid:()=>Yt,cuid2:()=>Ht,date:()=>fr,datetime:()=>vr,domain:()=>fl,duration:()=>nr,e164:()=>pr,email:()=>or,emoji:()=>ar,extendedDuration:()=>il,guid:()=>ir,hex:()=>gl,hostname:()=>pl,html5Email:()=>ul,idnEmail:()=>sl,integer:()=>_r,ipv4:()=>cr,ipv6:()=>ur,ksuid:()=>tr,lowercase:()=>kr,mac:()=>lr,md5_base64:()=>$l,md5_base64url:()=>hl,md5_hex:()=>vl,nanoid:()=>rr,null:()=>xr,number:()=>qe,rfc5322Email:()=>ll,sha1_base64:()=>yl,sha1_base64url:()=>xl,sha1_hex:()=>_l,sha256_base64:()=>kl,sha256_base64url:()=>zl,sha256_hex:()=>bl,sha384_base64:()=>Sl,sha384_base64url:()=>wl,sha384_hex:()=>Il,sha512_base64:()=>Pl,sha512_base64url:()=>Ol,sha512_hex:()=>jl,string:()=>$r,time:()=>gr,ulid:()=>Qt,undefined:()=>br,unicodeEmail:()=>Ri,uppercase:()=>zr,uuid:()=>ie,uuid4:()=>ol,uuid6:()=>al,uuid7:()=>cl,xid:()=>er});var Yt=/^[cC][^\s-]{8,}$/,Ht=/^[0-9a-z]+$/,Qt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,er=/^[0-9a-vA-V]{20}$/,tr=/^[A-Za-z0-9]{27}$/,rr=/^[a-zA-Z0-9_-]{21}$/,nr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,il=/^[-+]?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)?)??$/,ir=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,ie=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ol=ie(4),al=ie(6),cl=ie(7),or=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ul=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ll=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Ri=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,sl=Ri,dl=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,ml="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ar(){return new RegExp(ml,"u")}var cr=/^(?:(?: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])$/,ur=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,lr=e=>{let t=R(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},sr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Xe=/^[A-Za-z0-9_-]*$/,pl=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,fl=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,pr=/^\+[1-9]\d{6,14}$/,Ci="(?:(?:\\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])))",fr=new RegExp(`^${Ci}$`);function Fi(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function gr(e){return new RegExp(`^${Fi(e)}$`)}function vr(e){let t=Fi({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${t}(?:${r.join("|")})`;return new RegExp(`^${Ci}T(?:${n})$`)}var $r=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},hr=/^-?\d+n?$/,_r=/^-?\d+$/,qe=/^-?\d+(?:\.\d+)?$/,yr=/^(?:true|false)$/i,xr=/^null$/i;var br=/^undefined$/i;var kr=/^[^A-Z]*$/,zr=/^[^a-z]*$/,gl=/^[0-9a-fA-F]*$/;function Ue(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Ze(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var vl=/^[0-9a-fA-F]{32}$/,$l=Ue(22,"=="),hl=Ze(22),_l=/^[0-9a-fA-F]{40}$/,yl=Ue(27,"="),xl=Ze(27),bl=/^[0-9a-fA-F]{64}$/,kl=Ue(43,"="),zl=Ze(43),Il=/^[0-9a-fA-F]{96}$/,Sl=Ue(64,""),wl=Ze(64),jl=/^[0-9a-fA-F]{128}$/,Pl=Ue(86,"=="),Ol=Ze(86);var S=u("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Vi={number:"number",bigint:"bigint",object:"date"},Ir=u("$ZodCheckLessThan",(e,t)=>{S.init(e,t);let r=Vi[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<o&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Sr=u("$ZodCheckGreaterThan",(e,t)=>{S.init(e,t);let r=Vi[typeof t.value];e._zod.onattach.push(n=>{let i=n._zod.bag,o=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>o&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Mi=u("$ZodCheckMultipleOf",(e,t)=>{S.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):Ct(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Ki=u("$ZodCheckNumberFormat",(e,t)=>{S.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[i,o]=Kt[t.format];e._zod.onattach.push(a=>{let c=a._zod.bag;c.format=t.format,c.minimum=i,c.maximum=o,r&&(c.pattern=_r)}),e._zod.check=a=>{let c=a.value;if(r){if(!Number.isInteger(c)){a.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<i&&a.issues.push({origin:"number",input:c,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),c>o&&a.issues.push({origin:"number",input:c,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!t.abort})}}),Bi=u("$ZodCheckBigIntFormat",(e,t)=>{S.init(e,t);let[r,n]=Bt[t.format];e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,o.minimum=r,o.maximum=n}),e._zod.check=i=>{let o=i.value;o<r&&i.issues.push({origin:"bigint",input:o,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),o>n&&i.issues.push({origin:"bigint",input:o,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),Gi=u("$ZodCheckMaxSize",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;i.size<=t.maximum||n.issues.push({origin:ze(i),code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Wi=u("$ZodCheckMinSize",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;i.size>=t.minimum||n.issues.push({origin:ze(i),code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Xi=u("$ZodCheckSizeEquals",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.size!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.size,i.maximum=t.size,i.size=t.size}),e._zod.check=n=>{let i=n.value,o=i.size;if(o===t.size)return;let a=o>t.size;n.issues.push({origin:ze(i),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),qi=u("$ZodCheckMaxLength",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let i=n.value;if(i.length<=t.maximum)return;let a=Ie(i);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Yi=u("$ZodCheckMinLength",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let i=n.value;if(i.length>=t.minimum)return;let a=Ie(i);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),Hi=u("$ZodCheckLengthEquals",(e,t)=>{var r;S.init(e,t),(r=e._zod.def).when??(r.when=n=>{let i=n.value;return!X(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{let i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{let i=n.value,o=i.length;if(o===t.length)return;let a=Ie(i),c=o>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),De=u("$ZodCheckStringFormat",(e,t)=>{var r,n;S.init(e,t),e._zod.onattach.push(i=>{let o=i._zod.bag;o.format=t.format,t.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Qi=u("$ZodCheckRegex",(e,t)=>{De.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),eo=u("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=kr),De.init(e,t)}),to=u("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=zr),De.init(e,t)}),ro=u("$ZodCheckIncludes",(e,t)=>{S.init(e,t);let r=R(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{let o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),no=u("$ZodCheckStartsWith",(e,t)=>{S.init(e,t);let r=new RegExp(`^${R(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),io=u("$ZodCheckEndsWith",(e,t)=>{S.init(e,t);let r=new RegExp(`.*${R(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function Ji(e,t,r){e.issues.length&&t.issues.push(...E(r,e.issues))}var oo=u("$ZodCheckProperty",(e,t)=>{S.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(i=>Ji(i,r,t.property));Ji(n,r,t.property)}}),ao=u("$ZodCheckMimeType",(e,t)=>{S.init(e,t);let r=new Set(t.mime);e._zod.onattach.push(n=>{n._zod.bag.mime=t.mime}),e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),co=u("$ZodCheckOverwrite",(e,t)=>{S.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ye=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
2
- `).filter(a=>a),i=Math.min(...n.map(a=>a.length-a.trimStart().length)),o=n.map(a=>a.slice(i)).map(a=>" ".repeat(this.indent*2)+a);for(let a of o)this.content.push(a)}compile(){let t=Function,r=this?.args,i=[...(this?.content??[""]).map(o=>` ${o}`)];return new t(...r,i.join(`
3
- `))}};var lo={major:4,minor:3,patch:6};var y=u("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=lo;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let o of i._zod.onattach)o(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{let s=H(a),d;for(let p of c){if(p._zod.def.when){if(!p._zod.def.when(a))continue}else if(s)continue;let g=a.issues.length,v=p._zod.check(a);if(v instanceof Promise&&l?.async===!1)throw new V;if(d||v instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await v,a.issues.length!==g&&(s||(s=H(a,g)))});else{if(a.issues.length===g)continue;s||(s=H(a,g))}}return d?d.then(()=>a):a},o=(a,c,l)=>{if(H(a))return a.aborted=!0,a;let s=i(c,n,l);if(s instanceof Promise){if(l.async===!1)throw new V;return s.then(d=>e._zod.parse(d,l))}return e._zod.parse(s,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let s=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return s instanceof Promise?s.then(d=>o(d,a,c)):o(s,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new V;return l.then(s=>i(s,n,c))}return i(l,n,c)}}b(e,"~standard",()=>({validate:i=>{try{let o=Pi(e,i);return o.success?{value:o.data}:{issues:o.error?.issues}}catch{return Oi(e,i).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),se=u("$ZodString",(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$r(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),z=u("$ZodStringFormat",(e,t)=>{De.init(e,t),se.init(e,t)}),bo=u("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ir),z.init(e,t)}),ko=u("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=ie(n))}else t.pattern??(t.pattern=ie());z.init(e,t)}),zo=u("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=or),z.init(e,t)}),Io=u("$ZodURL",(e,t)=>{z.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),So=u("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ar()),z.init(e,t)}),wo=u("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=rr),z.init(e,t)}),jo=u("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Yt),z.init(e,t)}),Po=u("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ht),z.init(e,t)}),Oo=u("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Qt),z.init(e,t)}),Uo=u("$ZodXID",(e,t)=>{t.pattern??(t.pattern=er),z.init(e,t)}),Zo=u("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=tr),z.init(e,t)}),Do=u("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=vr(t)),z.init(e,t)}),To=u("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=fr),z.init(e,t)}),No=u("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=gr(t)),z.init(e,t)}),Eo=u("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=nr),z.init(e,t)}),Ao=u("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=cr),z.init(e,t),e._zod.bag.format="ipv4"}),Lo=u("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ur),z.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),Ro=u("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=lr(t.delimiter)),z.init(e,t),e._zod.bag.format="mac"}),Co=u("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=sr),z.init(e,t)}),Fo=u("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=dr),z.init(e,t),e._zod.check=r=>{let n=r.value.split("/");try{if(n.length!==2)throw new Error;let[i,o]=n;if(!o)throw new Error;let a=Number(o);if(`${a}`!==o)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function Jo(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Vo=u("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mr),z.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{Jo(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Ul(e){if(!Xe.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Jo(r)}var Mo=u("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Xe),z.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{Ul(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Ko=u("$ZodE164",(e,t)=>{t.pattern??(t.pattern=pr),z.init(e,t)});function Zl(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var Bo=u("$ZodJWT",(e,t)=>{z.init(e,t),e._zod.check=r=>{Zl(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Go=u("$ZodCustomStringFormat",(e,t)=>{z.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),jr=u("$ZodNumber",(e,t)=>{y.init(e,t),e._zod.pattern=e._zod.bag.pattern??qe,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;let o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...o?{received:o}:{}}),r}}),Wo=u("$ZodNumberFormat",(e,t)=>{Ki.init(e,t),jr.init(e,t)}),nt=u("$ZodBoolean",(e,t)=>{y.init(e,t),e._zod.pattern=yr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Pr=u("$ZodBigInt",(e,t)=>{y.init(e,t),e._zod.pattern=hr,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Xo=u("$ZodBigIntFormat",(e,t)=>{Bi.init(e,t),Pr.init(e,t)}),qo=u("$ZodSymbol",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:i,inst:e}),r}}),Yo=u("$ZodUndefined",(e,t)=>{y.init(e,t),e._zod.pattern=br,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),Ho=u("$ZodNull",(e,t)=>{y.init(e,t),e._zod.pattern=xr,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),Qo=u("$ZodAny",(e,t)=>{y.init(e,t),e._zod.parse=r=>r}),ea=u("$ZodUnknown",(e,t)=>{y.init(e,t),e._zod.parse=r=>r}),ta=u("$ZodNever",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),ra=u("$ZodVoid",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return typeof i>"u"||r.issues.push({expected:"void",code:"invalid_type",input:i,inst:e}),r}}),na=u("$ZodDate",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let i=r.value,o=i instanceof Date;return o&&!Number.isNaN(i.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:i,...o?{received:"Invalid Date"}:{},inst:e}),r}});function so(e,t,r){e.issues.length&&t.issues.push(...E(r,e.issues)),t.value[r]=e.value}var ia=u("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let o=[];for(let a=0;a<i.length;a++){let c=i[a],l=t.element._zod.run({value:c,issues:[]},n);l instanceof Promise?o.push(l.then(s=>so(s,r,a))):so(l,r,a)}return o.length?Promise.all(o).then(()=>r):r}});function rt(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...E(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function oa(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=Mt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function aa(e,t,r,n,i,o){let a=[],c=i.keySet,l=i.catchall._zod,s=l.def.type,d=l.optout==="optional";for(let p in t){if(c.has(p))continue;if(s==="never"){a.push(p);continue}let g=l.run({value:t[p],issues:[]},n);g instanceof Promise?e.push(g.then(v=>rt(v,r,p,t,d))):rt(g,r,p,t,d)}return a.length&&r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:o}),e.length?Promise.all(e).then(()=>r):r}var Dl=u("$ZodObject",(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...c};return Object.defineProperty(t,"shape",{value:l}),l}})}let n=ue(()=>oa(t));b(e._zod,"propValues",()=>{let c=t.shape,l={};for(let s in c){let d=c[s]._zod;if(d.values){l[s]??(l[s]=new Set);for(let p of d.values)l[s].add(p)}}return l});let i=ne,o=t.catchall,a;e._zod.parse=(c,l)=>{a??(a=n.value);let s=c.value;if(!i(s))return c.issues.push({expected:"object",code:"invalid_type",input:s,inst:e}),c;c.value={};let d=[],p=a.shape;for(let g of a.keys){let v=p[g],j=v._zod.optout==="optional",w=v._zod.run({value:s[g],issues:[]},l);w instanceof Promise?d.push(w.then(Me=>rt(Me,c,g,s,j))):rt(w,c,g,s,j)}return o?aa(d,s,c,l,n.value,e):d.length?Promise.all(d).then(()=>c):c}}),ca=u("$ZodObjectJIT",(e,t)=>{Dl.init(e,t);let r=e._zod.parse,n=ue(()=>oa(t)),i=g=>{let v=new Ye(["shape","payload","ctx"]),j=n.value,w=J=>{let Z=Be(J);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};v.write("const input = payload.value;");let Me=Object.create(null),wu=0;for(let J of j.keys)Me[J]=`key_${wu++}`;v.write("const newResult = {};");for(let J of j.keys){let Z=Me[J],C=Be(J),Pu=g[J]?._zod?.optout==="optional";v.write(`const ${Z} = ${w(J)};`),Pu?v.write(`
4
- if (${Z}.issues.length) {
5
- if (${C} in input) {
6
- payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
7
- ...iss,
8
- path: iss.path ? [${C}, ...iss.path] : [${C}]
9
- })));
10
- }
11
- }
12
-
13
- if (${Z}.value === undefined) {
14
- if (${C} in input) {
15
- newResult[${C}] = undefined;
16
- }
17
- } else {
18
- newResult[${C}] = ${Z}.value;
19
- }
20
-
21
- `):v.write(`
22
- if (${Z}.issues.length) {
23
- payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
24
- ...iss,
25
- path: iss.path ? [${C}, ...iss.path] : [${C}]
26
- })));
27
- }
28
-
29
- if (${Z}.value === undefined) {
30
- if (${C} in input) {
31
- newResult[${C}] = undefined;
32
- }
33
- } else {
34
- newResult[${C}] = ${Z}.value;
35
- }
36
-
37
- `)}v.write("payload.value = newResult;"),v.write("return payload;");let ju=v.compile();return(J,Z)=>ju(g,J,Z)},o,a=ne,c=!Ke.jitless,s=c&&Jt.value,d=t.catchall,p;e._zod.parse=(g,v)=>{p??(p=n.value);let j=g.value;return a(j)?c&&s&&v?.async===!1&&v.jitless!==!0?(o||(o=i(t.shape)),g=o(g,v),d?aa([],j,g,v,p,e):g):r(g,v):(g.issues.push({expected:"object",code:"invalid_type",input:j,inst:e}),g)}});function mo(e,t,r,n){for(let o of e)if(o.issues.length===0)return t.value=o.value,t;let i=e.filter(o=>!H(o));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>D(a,n,P())))}),t)}var it=u("$ZodUnion",(e,t)=>{y.init(e,t),b(e._zod,"optin",()=>t.options.some(i=>i._zod.optin==="optional")?"optional":void 0),b(e._zod,"optout",()=>t.options.some(i=>i._zod.optout==="optional")?"optional":void 0),b(e._zod,"values",()=>{if(t.options.every(i=>i._zod.values))return new Set(t.options.flatMap(i=>Array.from(i._zod.values)))}),b(e._zod,"pattern",()=>{if(t.options.every(i=>i._zod.pattern)){let i=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>be(o.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,c=[];for(let l of t.options){let s=l._zod.run({value:i.value,issues:[]},o);if(s instanceof Promise)c.push(s),a=!0;else{if(s.issues.length===0)return s;c.push(s)}}return a?Promise.all(c).then(l=>mo(l,i,e,o)):mo(c,i,e,o)}});function po(e,t,r,n){let i=e.filter(o=>o.issues.length===0);return i.length===1?(t.value=i[0].value,t):(i.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(o=>o.issues.map(a=>D(a,n,P())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1}),t)}var ua=u("$ZodXor",(e,t)=>{it.init(e,t),t.inclusive=!1;let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(i,o)=>{if(r)return n(i,o);let a=!1,c=[];for(let l of t.options){let s=l._zod.run({value:i.value,issues:[]},o);s instanceof Promise?(c.push(s),a=!0):c.push(s)}return a?Promise.all(c).then(l=>po(l,i,e,o)):po(c,i,e,o)}}),la=u("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,it.init(e,t);let r=e._zod.parse;b(e._zod,"propValues",()=>{let i={};for(let o of t.options){let a=o._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(o)}"`);for(let[c,l]of Object.entries(a)){i[c]||(i[c]=new Set);for(let s of l)i[c].add(s)}}return i});let n=ue(()=>{let i=t.options,o=new Map;for(let a of i){let c=a._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let l of c){if(o.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);o.set(l,a)}}return o});e._zod.parse=(i,o)=>{let a=i.value;if(!ne(a))return i.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),i;let c=n.value.get(a?.[t.discriminator]);return c?c._zod.run(i,o):t.unionFallback?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),i)}}),sa=u("$ZodIntersection",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value,o=t.left._zod.run({value:i,issues:[]},n),a=t.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||a instanceof Promise?Promise.all([o,a]).then(([l,s])=>fo(r,l,s)):fo(r,o,a)}});function wr(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Y(e)&&Y(t)){let r=Object.keys(t),n=Object.keys(e).filter(o=>r.indexOf(o)!==-1),i={...e,...t};for(let o of n){let a=wr(e[o],t[o]);if(!a.valid)return{valid:!1,mergeErrorPath:[o,...a.mergeErrorPath]};i[o]=a.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=t[n],a=wr(i,o);if(!a.valid)return{valid:!1,mergeErrorPath:[n,...a.mergeErrorPath]};r.push(a.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function fo(e,t,r){let n=new Map,i;for(let c of t.issues)if(c.code==="unrecognized_keys"){i??(i=c);for(let l of c.keys)n.has(l)||n.set(l,{}),n.get(l).l=!0}else e.issues.push(c);for(let c of r.issues)if(c.code==="unrecognized_keys")for(let l of c.keys)n.has(l)||n.set(l,{}),n.get(l).r=!0;else e.issues.push(c);let o=[...n].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(o.length&&i&&e.issues.push({...i,keys:o}),H(e))return e;let a=wr(t.value,r.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var Or=u("$ZodTuple",(e,t)=>{y.init(e,t);let r=t.items;e._zod.parse=(n,i)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({input:o,inst:e,expected:"tuple",code:"invalid_type"}),n;n.value=[];let a=[],c=[...r].reverse().findIndex(d=>d._zod.optin!=="optional"),l=c===-1?0:r.length-c;if(!t.rest){let d=o.length>r.length,p=o.length<l-1;if(d||p)return n.issues.push({...d?{code:"too_big",maximum:r.length,inclusive:!0}:{code:"too_small",minimum:r.length},input:o,inst:e,origin:"array"}),n}let s=-1;for(let d of r){if(s++,s>=o.length&&s>=l)continue;let p=d._zod.run({value:o[s],issues:[]},i);p instanceof Promise?a.push(p.then(g=>He(g,n,s))):He(p,n,s)}if(t.rest){let d=o.slice(r.length);for(let p of d){s++;let g=t.rest._zod.run({value:p,issues:[]},i);g instanceof Promise?a.push(g.then(v=>He(v,n,s))):He(g,n,s)}}return a.length?Promise.all(a).then(()=>n):n}});function He(e,t,r){e.issues.length&&t.issues.push(...E(r,e.issues)),t.value[r]=e.value}var da=u("$ZodRecord",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Y(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let o=[],a=t.keyType._zod.values;if(a){r.value={};let c=new Set;for(let s of a)if(typeof s=="string"||typeof s=="number"||typeof s=="symbol"){c.add(typeof s=="number"?s.toString():s);let d=t.valueType._zod.run({value:i[s],issues:[]},n);d instanceof Promise?o.push(d.then(p=>{p.issues.length&&r.issues.push(...E(s,p.issues)),r.value[s]=p.value})):(d.issues.length&&r.issues.push(...E(s,d.issues)),r.value[s]=d.value)}let l;for(let s in i)c.has(s)||(l=l??[],l.push(s));l&&l.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l})}else{r.value={};for(let c of Reflect.ownKeys(i)){if(c==="__proto__")continue;let l=t.keyType._zod.run({value:c,issues:[]},n);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&qe.test(c)&&l.issues.length){let p=t.keyType._zod.run({value:Number(c),issues:[]},n);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");p.issues.length===0&&(l=p)}if(l.issues.length){t.mode==="loose"?r.value[c]=i[c]:r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(p=>D(p,n,P())),input:c,path:[c],inst:e});continue}let d=t.valueType._zod.run({value:i[c],issues:[]},n);d instanceof Promise?o.push(d.then(p=>{p.issues.length&&r.issues.push(...E(c,p.issues)),r.value[l.value]=p.value})):(d.issues.length&&r.issues.push(...E(c,d.issues)),r.value[l.value]=d.value)}}return o.length?Promise.all(o).then(()=>r):r}}),ma=u("$ZodMap",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let o=[];r.value=new Map;for(let[a,c]of i){let l=t.keyType._zod.run({value:a,issues:[]},n),s=t.valueType._zod.run({value:c,issues:[]},n);l instanceof Promise||s instanceof Promise?o.push(Promise.all([l,s]).then(([d,p])=>{go(d,p,r,a,i,e,n)})):go(l,s,r,a,i,e,n)}return o.length?Promise.all(o).then(()=>r):r}});function go(e,t,r,n,i,o,a){e.issues.length&&(ke.has(typeof n)?r.issues.push(...E(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:i,inst:o,issues:e.issues.map(c=>D(c,a,P()))})),t.issues.length&&(ke.has(typeof n)?r.issues.push(...E(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:i,inst:o,key:n,issues:t.issues.map(c=>D(c,a,P()))})),r.value.set(e.value,t.value)}var pa=u("$ZodSet",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let o=[];r.value=new Set;for(let a of i){let c=t.valueType._zod.run({value:a,issues:[]},n);c instanceof Promise?o.push(c.then(l=>vo(l,r))):vo(c,r)}return o.length?Promise.all(o).then(()=>r):r}});function vo(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var fa=u("$ZodEnum",(e,t)=>{y.init(e,t);let r=xe(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(i=>ke.has(typeof i)).map(i=>typeof i=="string"?R(i):i.toString()).join("|")})$`),e._zod.parse=(i,o)=>{let a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:r,input:a,inst:e}),i}}),ga=u("$ZodLiteral",(e,t)=>{if(y.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?R(n):n?R(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,i)=>{let o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),va=u("$ZodFile",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;return i instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:i,inst:e}),r}}),$a=u("$ZodTransform",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new re(e.constructor.name);let i=t.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(a=>(r.value=a,r));if(i instanceof Promise)throw new V;return r.value=i,r}});function $o(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Ur=u("$ZodOptional",(e,t)=>{y.init(e,t),e._zod.optin="optional",e._zod.optout="optional",b(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),b(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${be(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>$o(o,r.value)):$o(i,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),ha=u("$ZodExactOptional",(e,t)=>{Ur.init(e,t),b(e._zod,"values",()=>t.innerType._zod.values),b(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),_a=u("$ZodNullable",(e,t)=>{y.init(e,t),b(e._zod,"optin",()=>t.innerType._zod.optin),b(e._zod,"optout",()=>t.innerType._zod.optout),b(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${be(r.source)}|null)$`):void 0}),b(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),ya=u("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>ho(o,t)):ho(i,t)}});function ho(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var xa=u("$ZodPrefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),ba=u("$ZodNonOptional",(e,t)=>{y.init(e,t),b(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>_o(o,e)):_o(i,e)}});function _o(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var ka=u("$ZodSuccess",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new re("ZodSuccess");let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.issues.length===0,r)):(r.value=i.issues.length===0,r)}}),za=u("$ZodCatch",(e,t)=>{y.init(e,t),b(e._zod,"optin",()=>t.innerType._zod.optin),b(e._zod,"optout",()=>t.innerType._zod.optout),b(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(a=>D(a,n,P()))},input:r.value}),r.issues=[]),r)):(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(o=>D(o,n,P()))},input:r.value}),r.issues=[]),r)}}),Ia=u("$ZodNaN",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Sa=u("$ZodPipe",(e,t)=>{y.init(e,t),b(e._zod,"values",()=>t.in._zod.values),b(e._zod,"optin",()=>t.in._zod.optin),b(e._zod,"optout",()=>t.out._zod.optout),b(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>Qe(a,t.in,n)):Qe(o,t.in,n)}let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(o=>Qe(o,t.out,n)):Qe(i,t.out,n)}});function Qe(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var ot=u("$ZodCodec",(e,t)=>{y.init(e,t),b(e._zod,"values",()=>t.in._zod.values),b(e._zod,"optin",()=>t.in._zod.optin),b(e._zod,"optout",()=>t.out._zod.optout),b(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(a=>et(a,t,n)):et(o,t,n)}else{let o=t.out._zod.run(r,n);return o instanceof Promise?o.then(a=>et(a,t,n)):et(o,t,n)}}});function et(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let i=t.transform(e.value,e);return i instanceof Promise?i.then(o=>tt(e,o,t.out,r)):tt(e,i,t.out,r)}else{let i=t.reverseTransform(e.value,e);return i instanceof Promise?i.then(o=>tt(e,o,t.in,r)):tt(e,i,t.in,r)}}function tt(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}var wa=u("$ZodReadonly",(e,t)=>{y.init(e,t),b(e._zod,"propValues",()=>t.innerType._zod.propValues),b(e._zod,"values",()=>t.innerType._zod.values),b(e._zod,"optin",()=>t.innerType?._zod?.optin),b(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(yo):yo(i)}});function yo(e){return e.value=Object.freeze(e.value),e}var ja=u("$ZodTemplateLiteral",(e,t)=>{y.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){if(!n._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);let i=n._zod.pattern instanceof RegExp?n._zod.pattern.source:n._zod.pattern;if(!i)throw new Error(`Invalid template literal part: ${n._zod.traits}`);let o=i.startsWith("^")?1:0,a=i.endsWith("$")?i.length-1:i.length;r.push(i.slice(o,a))}else if(n===null||Vt.has(typeof n))r.push(R(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,i)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Pa=u("$ZodFunction",(e,t)=>(y.init(e,t),e._def=t,e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return function(...n){let i=e._def.input?Xt(e._def.input,n):n,o=Reflect.apply(r,this,i);return e._def.output?Xt(e._def.output,o):o}},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return async function(...n){let i=e._def.input?await qt(e._def.input,n):n,o=await Reflect.apply(r,this,i);return e._def.output?await qt(e._def.output,o):o}},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new Or({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Oa=u("$ZodPromise",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(i=>t.innerType._zod.run({value:i,issues:[]},n))}),Ua=u("$ZodLazy",(e,t)=>{y.init(e,t),b(e._zod,"innerType",()=>t.getter()),b(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),b(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),b(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),b(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Za=u("$ZodCustom",(e,t)=>{S.init(e,t),y.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,i=t.fn(n);if(i instanceof Promise)return i.then(o=>xo(o,r,n,e));xo(i,r,n,e)}});function xo(e,t,r,n){if(!e){let i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),t.issues.push(le(i))}}var Nl=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};return i=>{switch(i.code){case"invalid_type":{let o=n[i.expected]??i.expected,a=_(i.input),c=n[a]??a;return`Invalid input: expected ${o}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${h(i.values[0])}`:`Invalid option: expected one of ${$(i.values,"|")}`;case"too_big":{let o=i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${o}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${o}${i.maximum.toString()}`}case"too_small":{let o=i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${o}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${o}${i.minimum.toString()}`}case"invalid_format":{let o=i;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${$(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Zr(){return{localeError:Nl()}}var Ta;var Dr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let i={...n,...this._map.get(t)};return Object.keys(i).length?i:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Na(){return new Dr}(Ta=globalThis).__zod_globalRegistry??(Ta.__zod_globalRegistry=Na());var T=globalThis.__zod_globalRegistry;function Ea(e,t){return new e({type:"string",...f(t)})}function Tr(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...f(t)})}function at(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...f(t)})}function Nr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...f(t)})}function Er(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...f(t)})}function Ar(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...f(t)})}function Lr(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...f(t)})}function ct(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...f(t)})}function Rr(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...f(t)})}function Cr(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...f(t)})}function Fr(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...f(t)})}function Jr(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...f(t)})}function Vr(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...f(t)})}function Mr(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...f(t)})}function Kr(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...f(t)})}function Br(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...f(t)})}function Gr(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...f(t)})}function Aa(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...f(t)})}function Wr(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...f(t)})}function Xr(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...f(t)})}function qr(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...f(t)})}function Yr(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...f(t)})}function Hr(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...f(t)})}function Qr(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...f(t)})}function La(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...f(t)})}function Ra(e,t){return new e({type:"string",format:"date",check:"string_format",...f(t)})}function Ca(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...f(t)})}function Fa(e,t){return new e({type:"string",format:"duration",check:"string_format",...f(t)})}function Ja(e,t){return new e({type:"number",checks:[],...f(t)})}function Va(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...f(t)})}function Ma(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...f(t)})}function Ka(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...f(t)})}function Ba(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...f(t)})}function Ga(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...f(t)})}function Wa(e,t){return new e({type:"boolean",...f(t)})}function Xa(e,t){return new e({type:"bigint",...f(t)})}function qa(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...f(t)})}function Ya(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...f(t)})}function Ha(e,t){return new e({type:"symbol",...f(t)})}function Qa(e,t){return new e({type:"undefined",...f(t)})}function ec(e,t){return new e({type:"null",...f(t)})}function tc(e){return new e({type:"any"})}function rc(e){return new e({type:"unknown"})}function nc(e,t){return new e({type:"never",...f(t)})}function ic(e,t){return new e({type:"void",...f(t)})}function oc(e,t){return new e({type:"date",...f(t)})}function ac(e,t){return new e({type:"nan",...f(t)})}function Q(e,t){return new Ir({check:"less_than",...f(t),value:e,inclusive:!1})}function F(e,t){return new Ir({check:"less_than",...f(t),value:e,inclusive:!0})}function ee(e,t){return new Sr({check:"greater_than",...f(t),value:e,inclusive:!1})}function A(e,t){return new Sr({check:"greater_than",...f(t),value:e,inclusive:!0})}function cc(e){return ee(0,e)}function uc(e){return Q(0,e)}function lc(e){return F(0,e)}function sc(e){return A(0,e)}function de(e,t){return new Mi({check:"multiple_of",...f(t),value:e})}function me(e,t){return new Gi({check:"max_size",...f(t),maximum:e})}function te(e,t){return new Wi({check:"min_size",...f(t),minimum:e})}function Te(e,t){return new Xi({check:"size_equals",...f(t),size:e})}function Ne(e,t){return new qi({check:"max_length",...f(t),maximum:e})}function oe(e,t){return new Yi({check:"min_length",...f(t),minimum:e})}function Ee(e,t){return new Hi({check:"length_equals",...f(t),length:e})}function ut(e,t){return new Qi({check:"string_format",format:"regex",...f(t),pattern:e})}function lt(e){return new eo({check:"string_format",format:"lowercase",...f(e)})}function st(e){return new to({check:"string_format",format:"uppercase",...f(e)})}function dt(e,t){return new ro({check:"string_format",format:"includes",...f(t),includes:e})}function mt(e,t){return new no({check:"string_format",format:"starts_with",...f(t),prefix:e})}function pt(e,t){return new io({check:"string_format",format:"ends_with",...f(t),suffix:e})}function dc(e,t,r){return new oo({check:"property",property:e,schema:t,...f(r)})}function ft(e,t){return new ao({check:"mime_type",mime:e,...f(t)})}function G(e){return new co({check:"overwrite",tx:e})}function gt(e){return G(t=>t.normalize(e))}function vt(){return G(e=>e.trim())}function $t(){return G(e=>e.toLowerCase())}function ht(){return G(e=>e.toUpperCase())}function _t(){return G(e=>Ft(e))}function mc(e,t,r){return new e({type:"array",element:t,...f(r)})}function pc(e,t){return new e({type:"file",...f(t)})}function fc(e,t,r){let n=f(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function gc(e,t,r){return new e({type:"custom",check:"custom",fn:t,...f(r)})}function vc(e){let t=Rl(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(le(n,r.value,t._zod.def));else{let i=n;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(le(i))}},e(r.value,r)));return t}function Rl(e,t){let r=new S({check:"custom",...f(t)});return r._zod.check=e,r}function $c(e){let t=new S({check:"describe"});return t._zod.onattach=[r=>{let n=T.get(r)??{};T.add(r,{...n,description:e})}],t._zod.check=()=>{},t}function hc(e){let t=new S({check:"meta"});return t._zod.onattach=[r=>{let n=T.get(r)??{};T.add(r,{...n,...e})}],t._zod.check=()=>{},t}function _c(e,t){let r=f(t),n=r.truthy??["true","1","yes","on","y","enabled"],i=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(v=>typeof v=="string"?v.toLowerCase():v),i=i.map(v=>typeof v=="string"?v.toLowerCase():v));let o=new Set(n),a=new Set(i),c=e.Codec??ot,l=e.Boolean??nt,s=e.String??se,d=new s({type:"string",error:r.error}),p=new l({type:"boolean",error:r.error}),g=new c({type:"pipe",in:d,out:p,transform:((v,j)=>{let w=v;return r.case!=="sensitive"&&(w=w.toLowerCase()),o.has(w)?!0:a.has(w)?!1:(j.issues.push({code:"invalid_value",expected:"stringbool",values:[...o,...a],input:j.value,inst:g,continue:!1}),{})}),reverseTransform:((v,j)=>v===!0?n[0]||"true":i[0]||"false"),error:r.error});return g}function Ae(e,t,r,n={}){let i=f(n),o={...f(n),check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...i};return r instanceof RegExp&&(o.pattern=r),new e(o)}function pe(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??T,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function k(e,t,r={path:[],schemaPath:[]}){var n;let i=e._zod.def,o=t.seen.get(e);if(o)return o.count++,r.schemaPath.includes(e)&&(o.cycle=r.path),o.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let d={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,d);else{let g=a.schema,v=t.processors[i.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);v(e,t,g,d)}let p=e._zod.parent;p&&(a.ref||(a.ref=p),k(p,t,d),t.seen.get(p).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&U(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function fe(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=new Map;for(let a of e.seen.entries()){let c=e.metadataRegistry.get(a[0])?.id;if(c){let l=n.get(c);if(l&&l!==a[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,a[0])}}let i=a=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(a[0])?.id,g=e.external.uri??(j=>j);if(p)return{ref:g(p)};let v=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=v,{defId:v,ref:`${g("__shared")}#/${c}/${v}`}}if(a[1]===r)return{ref:"#"};let s=`#/${c}/`,d=a[1].schema.id??`__schema${e.counter++}`;return{defId:d,ref:s+d}},o=a=>{if(a[1].schema.$ref)return;let c=a[1],{ref:l,defId:s}=i(a);c.def={...c.schema},s&&(c.defId=s);let d=c.schema;for(let p in d)delete d[p];d.$ref=l};if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
38
-
39
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){o(a);continue}if(e.external){let s=e.external.registry.get(a[0])?.id;if(t!==a[0]&&s){o(a);continue}}if(e.metadataRegistry.get(a[0])?.id){o(a);continue}if(c.cycle){o(a);continue}if(c.count>1&&e.reused==="ref"){o(a);continue}}}function ge(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,s={...l},d=c.ref;if(c.ref=null,d){n(d);let g=e.seen.get(d),v=g.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(v)):Object.assign(l,v),Object.assign(l,s),a._zod.parent===d)for(let w in l)w==="$ref"||w==="allOf"||w in s||delete l[w];if(v.$ref&&g.def)for(let w in l)w==="$ref"||w==="allOf"||w in g.def&&JSON.stringify(l[w])===JSON.stringify(g.def[w])&&delete l[w]}let p=a._zod.parent;if(p&&p!==d){n(p);let g=e.seen.get(p);if(g?.schema.$ref&&(l.$ref=g.schema.$ref,g.def))for(let v in l)v==="$ref"||v==="allOf"||v in g.def&&JSON.stringify(l[v])===JSON.stringify(g.def[v])&&delete l[v]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(a)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(o[c.defId]=c.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let a=JSON.parse(JSON.stringify(i));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Le(t,"input",e.processors),output:Le(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function U(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return U(n.element,r);if(n.type==="set")return U(n.valueType,r);if(n.type==="lazy")return U(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return U(n.innerType,r);if(n.type==="intersection")return U(n.left,r)||U(n.right,r);if(n.type==="record"||n.type==="map")return U(n.keyType,r)||U(n.valueType,r);if(n.type==="pipe")return U(n.in,r)||U(n.out,r);if(n.type==="object"){for(let i in n.shape)if(U(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(U(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(U(i,r))return!0;return!!(n.rest&&U(n.rest,r))}return!1}var yc=(e,t={})=>r=>{let n=pe({...r,processors:t});return k(e,n),fe(n,e),ge(n,e)},Le=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},a=pe({...i??{},target:o,io:t,processors:r});return k(e,a),fe(a,e),ge(a,e)};var Cl={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tn=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:a,format:c,patterns:l,contentEncoding:s}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof a=="number"&&(i.maxLength=a),c&&(i.format=Cl[c]??c,i.format===""&&delete i.format,c==="time"&&delete i.format),s&&(i.contentEncoding=s),l&&l.size>0){let d=[...l];d.length===1?i.pattern=d[0].source:d.length>1&&(i.allOf=[...d.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},rn=(e,t,r,n)=>{let i=r,{minimum:o,maximum:a,format:c,multipleOf:l,exclusiveMaximum:s,exclusiveMinimum:d}=e._zod.bag;typeof c=="string"&&c.includes("int")?i.type="integer":i.type="number",typeof d=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=d,i.exclusiveMinimum=!0):i.exclusiveMinimum=d),typeof o=="number"&&(i.minimum=o,typeof d=="number"&&t.target!=="draft-04"&&(d>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof s=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=s,i.exclusiveMaximum=!0):i.exclusiveMaximum=s),typeof a=="number"&&(i.maximum=a,typeof s=="number"&&t.target!=="draft-04"&&(s<=a?delete i.maximum:delete i.exclusiveMaximum)),typeof l=="number"&&(i.multipleOf=l)},nn=(e,t,r,n)=>{r.type="boolean"},on=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},an=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},cn=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},un=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},ln=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},sn=(e,t,r,n)=>{r.not={}},dn=(e,t,r,n)=>{},mn=(e,t,r,n)=>{},pn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},fn=(e,t,r,n)=>{let i=e._zod.def,o=xe(i.entries);o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),r.enum=o},gn=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let a of i.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(a))}else o.push(a);if(o.length!==0)if(o.length===1){let a=o[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else o.every(a=>typeof a=="number")&&(r.type="number"),o.every(a=>typeof a=="string")&&(r.type="string"),o.every(a=>typeof a=="boolean")&&(r.type="boolean"),o.every(a=>a===null)&&(r.type="null"),r.enum=o},vn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},$n=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},hn=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:l}=e._zod.bag;a!==void 0&&(o.minLength=a),c!==void 0&&(o.maxLength=c),l?l.length===1?(o.contentMediaType=l[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=l.map(s=>({contentMediaType:s}))):Object.assign(i,o)},_n=(e,t,r,n)=>{r.type="boolean"},yn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},xn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},bn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},kn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},zn=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},In=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(i.minItems=a),typeof c=="number"&&(i.maxItems=c),i.type="array",i.items=k(o.element,t,{...n,path:[...n.path,"items"]})},Sn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let a=o.shape;for(let s in a)i.properties[s]=k(a[s],t,{...n,path:[...n.path,"properties",s]});let c=new Set(Object.keys(a)),l=new Set([...c].filter(s=>{let d=o.shape[s]._zod;return t.io==="input"?d.optin===void 0:d.optout===void 0}));l.size>0&&(i.required=Array.from(l)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=k(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},yt=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,a=i.options.map((c,l)=>k(c,t,{...n,path:[...n.path,o?"oneOf":"anyOf",l]}));o?r.oneOf=a:r.anyOf=a},wn=(e,t,r,n)=>{let i=e._zod.def,o=k(i.left,t,{...n,path:[...n.path,"allOf",0]}),a=k(i.right,t,{...n,path:[...n.path,"allOf",1]}),c=s=>"allOf"in s&&Object.keys(s).length===1,l=[...c(o)?o.allOf:[o],...c(a)?a.allOf:[a]];r.allOf=l},jn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=o.items.map((g,v)=>k(g,t,{...n,path:[...n.path,a,v]})),s=o.rest?k(o.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=l,s&&(i.items=s)):t.target==="openapi-3.0"?(i.items={anyOf:l},s&&i.items.anyOf.push(s),i.minItems=l.length,s||(i.maxItems=l.length)):(i.items=l,s&&(i.additionalItems=s));let{minimum:d,maximum:p}=e._zod.bag;typeof d=="number"&&(i.minItems=d),typeof p=="number"&&(i.maxItems=p)},Pn=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let a=o.keyType,l=a._zod.bag?.patterns;if(o.mode==="loose"&&l&&l.size>0){let d=k(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let p of l)i.patternProperties[p.source]=d}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=k(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=k(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let s=a._zod.values;if(s){let d=[...s].filter(p=>typeof p=="string"||typeof p=="number");d.length>0&&(i.required=d)}},On=(e,t,r,n)=>{let i=e._zod.def,o=k(i.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},Un=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Zn=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},Dn=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Tn=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let a;try{a=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Nn=(e,t,r,n)=>{let i=e._zod.def,o=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;k(o,t,n);let a=t.seen.get(e);a.ref=o},En=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},An=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},xt=(e,t,r,n)=>{let i=e._zod.def;k(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},Ln=(e,t,r,n)=>{let i=e._zod.innerType;k(i,t,n);let o=t.seen.get(e);o.ref=i},en={string:tn,number:rn,boolean:nn,bigint:on,symbol:an,null:cn,undefined:un,void:ln,never:sn,any:dn,unknown:mn,date:pn,enum:fn,literal:gn,nan:vn,template_literal:$n,file:hn,success:_n,custom:yn,function:xn,transform:bn,map:kn,set:zn,array:In,object:Sn,union:yt,intersection:wn,tuple:jn,record:Pn,nullable:On,nonoptional:Un,default:Zn,prefault:Dn,catch:Tn,pipe:Nn,readonly:En,promise:An,optional:xt,lazy:Ln};function bt(e,t){if("_idmap"in e){let n=e,i=pe({...t,processors:en}),o={};for(let l of n._idmap.entries()){let[s,d]=l;k(d,i)}let a={},c={registry:n,uri:t?.uri,defs:o};i.external=c;for(let l of n._idmap.entries()){let[s,d]=l;fe(i,d),a[s]=ge(i,d)}if(Object.keys(o).length>0){let l=i.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[l]:o}}return{schemas:a}}let r=pe({...t,processors:en});return k(e,r),fe(r,e),ge(r,e)}var Ce={};_e(Ce,{ZodAny:()=>Fc,ZodArray:()=>Kc,ZodBase64:()=>ui,ZodBase64URL:()=>li,ZodBigInt:()=>Zt,ZodBigIntFormat:()=>mi,ZodBoolean:()=>Ut,ZodCIDRv4:()=>ai,ZodCIDRv6:()=>ci,ZodCUID:()=>Qn,ZodCUID2:()=>ei,ZodCatch:()=>pu,ZodCodec:()=>xi,ZodCustom:()=>At,ZodCustomStringFormat:()=>Je,ZodDate:()=>fi,ZodDefault:()=>cu,ZodDiscriminatedUnion:()=>Gc,ZodE164:()=>si,ZodEmail:()=>qn,ZodEmoji:()=>Yn,ZodEnum:()=>Fe,ZodExactOptional:()=>iu,ZodFile:()=>ru,ZodFunction:()=>bu,ZodGUID:()=>zt,ZodIPv4:()=>ii,ZodIPv6:()=>oi,ZodIntersection:()=>Wc,ZodJWT:()=>di,ZodKSUID:()=>ni,ZodLazy:()=>_u,ZodLiteral:()=>tu,ZodMAC:()=>Tc,ZodMap:()=>Qc,ZodNaN:()=>gu,ZodNanoID:()=>Hn,ZodNever:()=>Vc,ZodNonOptional:()=>_i,ZodNull:()=>Rc,ZodNullable:()=>au,ZodNumber:()=>Ot,ZodNumberFormat:()=>$e,ZodObject:()=>Tt,ZodOptional:()=>hi,ZodPipe:()=>yi,ZodPrefault:()=>lu,ZodPromise:()=>xu,ZodReadonly:()=>vu,ZodRecord:()=>Et,ZodSet:()=>eu,ZodString:()=>jt,ZodStringFormat:()=>I,ZodSuccess:()=>mu,ZodSymbol:()=>Ac,ZodTemplateLiteral:()=>hu,ZodTransform:()=>nu,ZodTuple:()=>qc,ZodType:()=>x,ZodULID:()=>ti,ZodURL:()=>Pt,ZodUUID:()=>W,ZodUndefined:()=>Lc,ZodUnion:()=>Nt,ZodUnknown:()=>Jc,ZodVoid:()=>Mc,ZodXID:()=>ri,ZodXor:()=>Bc,_ZodString:()=>Xn,_default:()=>uu,_function:()=>Ws,any:()=>Ss,array:()=>Dt,base64:()=>ls,base64url:()=>ss,bigint:()=>xs,boolean:()=>Ec,catch:()=>fu,check:()=>Xs,cidrv4:()=>cs,cidrv6:()=>us,codec:()=>Ks,cuid:()=>Ql,cuid2:()=>es,custom:()=>qs,date:()=>js,describe:()=>Ys,discriminatedUnion:()=>Ts,e164:()=>ds,email:()=>Vl,emoji:()=>Yl,enum:()=>vi,exactOptional:()=>ou,file:()=>Fs,float32:()=>$s,float64:()=>hs,function:()=>Ws,guid:()=>Ml,hash:()=>vs,hex:()=>gs,hostname:()=>fs,httpUrl:()=>ql,instanceof:()=>Qs,int:()=>Wn,int32:()=>_s,int64:()=>bs,intersection:()=>Xc,ipv4:()=>is,ipv6:()=>as,json:()=>td,jwt:()=>ms,keyof:()=>Ps,ksuid:()=>ns,lazy:()=>yu,literal:()=>Cs,looseObject:()=>Zs,looseRecord:()=>Es,mac:()=>os,map:()=>As,meta:()=>Hs,nan:()=>Ms,nanoid:()=>Hl,nativeEnum:()=>Rs,never:()=>pi,nonoptional:()=>du,null:()=>Cc,nullable:()=>St,nullish:()=>Js,number:()=>Nc,object:()=>Os,optional:()=>It,partialRecord:()=>Ns,pipe:()=>wt,prefault:()=>su,preprocess:()=>rd,promise:()=>Gs,readonly:()=>$u,record:()=>Hc,refine:()=>ku,set:()=>Ls,strictObject:()=>Us,string:()=>Gn,stringFormat:()=>ps,stringbool:()=>ed,success:()=>Vs,superRefine:()=>zu,symbol:()=>zs,templateLiteral:()=>Bs,transform:()=>$i,tuple:()=>Yc,uint32:()=>ys,uint64:()=>ks,ulid:()=>ts,undefined:()=>Is,union:()=>gi,unknown:()=>ve,url:()=>Xl,uuid:()=>Kl,uuidv4:()=>Bl,uuidv6:()=>Gl,uuidv7:()=>Wl,void:()=>ws,xid:()=>rs,xor:()=>Ds});var kt={};_e(kt,{endsWith:()=>pt,gt:()=>ee,gte:()=>A,includes:()=>dt,length:()=>Ee,lowercase:()=>lt,lt:()=>Q,lte:()=>F,maxLength:()=>Ne,maxSize:()=>me,mime:()=>ft,minLength:()=>oe,minSize:()=>te,multipleOf:()=>de,negative:()=>uc,nonnegative:()=>sc,nonpositive:()=>lc,normalize:()=>gt,overwrite:()=>G,positive:()=>cc,property:()=>dc,regex:()=>ut,size:()=>Te,slugify:()=>_t,startsWith:()=>mt,toLowerCase:()=>$t,toUpperCase:()=>ht,trim:()=>vt,uppercase:()=>st});var Re={};_e(Re,{ZodISODate:()=>Fn,ZodISODateTime:()=>Rn,ZodISODuration:()=>Kn,ZodISOTime:()=>Vn,date:()=>Jn,datetime:()=>Cn,duration:()=>Bn,time:()=>Mn});var Rn=u("ZodISODateTime",(e,t)=>{Do.init(e,t),I.init(e,t)});function Cn(e){return La(Rn,e)}var Fn=u("ZodISODate",(e,t)=>{To.init(e,t),I.init(e,t)});function Jn(e){return Ra(Fn,e)}var Vn=u("ZodISOTime",(e,t)=>{No.init(e,t),I.init(e,t)});function Mn(e){return Ca(Vn,e)}var Kn=u("ZodISODuration",(e,t)=>{Eo.init(e,t),I.init(e,t)});function Bn(e){return Fa(Kn,e)}var xc=(e,t)=>{We.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Wt(e,r)},flatten:{value:r=>Gt(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,ce,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,ce,2)}},isEmpty:{get(){return e.issues.length===0}}})},Uf=u("ZodError",xc),L=u("ZodError",xc,{Parent:Error});var bc=we(L),kc=je(L),zc=Pe(L),Ic=Oe(L),Sc=Ui(L),wc=Zi(L),jc=Di(L),Pc=Ti(L),Oc=Ni(L),Uc=Ei(L),Zc=Ai(L),Dc=Li(L);var x=u("ZodType",(e,t)=>(y.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Le(e,"input"),output:Le(e,"output")}}),e.toJSONSchema=yc(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(m.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>N(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>bc(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>zc(e,r,n),e.parseAsync=async(r,n)=>kc(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Ic(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Sc(e,r,n),e.decode=(r,n)=>wc(e,r,n),e.encodeAsync=async(r,n)=>jc(e,r,n),e.decodeAsync=async(r,n)=>Pc(e,r,n),e.safeEncode=(r,n)=>Oc(e,r,n),e.safeDecode=(r,n)=>Uc(e,r,n),e.safeEncodeAsync=async(r,n)=>Zc(e,r,n),e.safeDecodeAsync=async(r,n)=>Dc(e,r,n),e.refine=(r,n)=>e.check(ku(r,n)),e.superRefine=r=>e.check(zu(r)),e.overwrite=r=>e.check(G(r)),e.optional=()=>It(e),e.exactOptional=()=>ou(e),e.nullable=()=>St(e),e.nullish=()=>It(St(e)),e.nonoptional=r=>du(e,r),e.array=()=>Dt(e),e.or=r=>gi([e,r]),e.and=r=>Xc(e,r),e.transform=r=>wt(e,$i(r)),e.default=r=>uu(e,r),e.prefault=r=>su(e,r),e.catch=r=>fu(e,r),e.pipe=r=>wt(e,r),e.readonly=()=>$u(e),e.describe=r=>{let n=e.clone();return T.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return T.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return T.get(e);let n=e.clone();return T.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Xn=u("_ZodString",(e,t)=>{se.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>tn(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(ut(...n)),e.includes=(...n)=>e.check(dt(...n)),e.startsWith=(...n)=>e.check(mt(...n)),e.endsWith=(...n)=>e.check(pt(...n)),e.min=(...n)=>e.check(oe(...n)),e.max=(...n)=>e.check(Ne(...n)),e.length=(...n)=>e.check(Ee(...n)),e.nonempty=(...n)=>e.check(oe(1,...n)),e.lowercase=n=>e.check(lt(n)),e.uppercase=n=>e.check(st(n)),e.trim=()=>e.check(vt()),e.normalize=(...n)=>e.check(gt(...n)),e.toLowerCase=()=>e.check($t()),e.toUpperCase=()=>e.check(ht()),e.slugify=()=>e.check(_t())}),jt=u("ZodString",(e,t)=>{se.init(e,t),Xn.init(e,t),e.email=r=>e.check(Tr(qn,r)),e.url=r=>e.check(ct(Pt,r)),e.jwt=r=>e.check(Qr(di,r)),e.emoji=r=>e.check(Rr(Yn,r)),e.guid=r=>e.check(at(zt,r)),e.uuid=r=>e.check(Nr(W,r)),e.uuidv4=r=>e.check(Er(W,r)),e.uuidv6=r=>e.check(Ar(W,r)),e.uuidv7=r=>e.check(Lr(W,r)),e.nanoid=r=>e.check(Cr(Hn,r)),e.guid=r=>e.check(at(zt,r)),e.cuid=r=>e.check(Fr(Qn,r)),e.cuid2=r=>e.check(Jr(ei,r)),e.ulid=r=>e.check(Vr(ti,r)),e.base64=r=>e.check(qr(ui,r)),e.base64url=r=>e.check(Yr(li,r)),e.xid=r=>e.check(Mr(ri,r)),e.ksuid=r=>e.check(Kr(ni,r)),e.ipv4=r=>e.check(Br(ii,r)),e.ipv6=r=>e.check(Gr(oi,r)),e.cidrv4=r=>e.check(Wr(ai,r)),e.cidrv6=r=>e.check(Xr(ci,r)),e.e164=r=>e.check(Hr(si,r)),e.datetime=r=>e.check(Cn(r)),e.date=r=>e.check(Jn(r)),e.time=r=>e.check(Mn(r)),e.duration=r=>e.check(Bn(r))});function Gn(e){return Ea(jt,e)}var I=u("ZodStringFormat",(e,t)=>{z.init(e,t),Xn.init(e,t)}),qn=u("ZodEmail",(e,t)=>{zo.init(e,t),I.init(e,t)});function Vl(e){return Tr(qn,e)}var zt=u("ZodGUID",(e,t)=>{bo.init(e,t),I.init(e,t)});function Ml(e){return at(zt,e)}var W=u("ZodUUID",(e,t)=>{ko.init(e,t),I.init(e,t)});function Kl(e){return Nr(W,e)}function Bl(e){return Er(W,e)}function Gl(e){return Ar(W,e)}function Wl(e){return Lr(W,e)}var Pt=u("ZodURL",(e,t)=>{Io.init(e,t),I.init(e,t)});function Xl(e){return ct(Pt,e)}function ql(e){return ct(Pt,{protocol:/^https?$/,hostname:M.domain,...m.normalizeParams(e)})}var Yn=u("ZodEmoji",(e,t)=>{So.init(e,t),I.init(e,t)});function Yl(e){return Rr(Yn,e)}var Hn=u("ZodNanoID",(e,t)=>{wo.init(e,t),I.init(e,t)});function Hl(e){return Cr(Hn,e)}var Qn=u("ZodCUID",(e,t)=>{jo.init(e,t),I.init(e,t)});function Ql(e){return Fr(Qn,e)}var ei=u("ZodCUID2",(e,t)=>{Po.init(e,t),I.init(e,t)});function es(e){return Jr(ei,e)}var ti=u("ZodULID",(e,t)=>{Oo.init(e,t),I.init(e,t)});function ts(e){return Vr(ti,e)}var ri=u("ZodXID",(e,t)=>{Uo.init(e,t),I.init(e,t)});function rs(e){return Mr(ri,e)}var ni=u("ZodKSUID",(e,t)=>{Zo.init(e,t),I.init(e,t)});function ns(e){return Kr(ni,e)}var ii=u("ZodIPv4",(e,t)=>{Ao.init(e,t),I.init(e,t)});function is(e){return Br(ii,e)}var Tc=u("ZodMAC",(e,t)=>{Ro.init(e,t),I.init(e,t)});function os(e){return Aa(Tc,e)}var oi=u("ZodIPv6",(e,t)=>{Lo.init(e,t),I.init(e,t)});function as(e){return Gr(oi,e)}var ai=u("ZodCIDRv4",(e,t)=>{Co.init(e,t),I.init(e,t)});function cs(e){return Wr(ai,e)}var ci=u("ZodCIDRv6",(e,t)=>{Fo.init(e,t),I.init(e,t)});function us(e){return Xr(ci,e)}var ui=u("ZodBase64",(e,t)=>{Vo.init(e,t),I.init(e,t)});function ls(e){return qr(ui,e)}var li=u("ZodBase64URL",(e,t)=>{Mo.init(e,t),I.init(e,t)});function ss(e){return Yr(li,e)}var si=u("ZodE164",(e,t)=>{Ko.init(e,t),I.init(e,t)});function ds(e){return Hr(si,e)}var di=u("ZodJWT",(e,t)=>{Bo.init(e,t),I.init(e,t)});function ms(e){return Qr(di,e)}var Je=u("ZodCustomStringFormat",(e,t)=>{Go.init(e,t),I.init(e,t)});function ps(e,t,r={}){return Ae(Je,e,t,r)}function fs(e){return Ae(Je,"hostname",M.hostname,e)}function gs(e){return Ae(Je,"hex",M.hex,e)}function vs(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=M[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return Ae(Je,n,i,t)}var Ot=u("ZodNumber",(e,t)=>{jr.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>rn(e,n,i,o),e.gt=(n,i)=>e.check(ee(n,i)),e.gte=(n,i)=>e.check(A(n,i)),e.min=(n,i)=>e.check(A(n,i)),e.lt=(n,i)=>e.check(Q(n,i)),e.lte=(n,i)=>e.check(F(n,i)),e.max=(n,i)=>e.check(F(n,i)),e.int=n=>e.check(Wn(n)),e.safe=n=>e.check(Wn(n)),e.positive=n=>e.check(ee(0,n)),e.nonnegative=n=>e.check(A(0,n)),e.negative=n=>e.check(Q(0,n)),e.nonpositive=n=>e.check(F(0,n)),e.multipleOf=(n,i)=>e.check(de(n,i)),e.step=(n,i)=>e.check(de(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Nc(e){return Ja(Ot,e)}var $e=u("ZodNumberFormat",(e,t)=>{Wo.init(e,t),Ot.init(e,t)});function Wn(e){return Va($e,e)}function $s(e){return Ma($e,e)}function hs(e){return Ka($e,e)}function _s(e){return Ba($e,e)}function ys(e){return Ga($e,e)}var Ut=u("ZodBoolean",(e,t)=>{nt.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>nn(e,r,n,i)});function Ec(e){return Wa(Ut,e)}var Zt=u("ZodBigInt",(e,t)=>{Pr.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>on(e,n,i,o),e.gte=(n,i)=>e.check(A(n,i)),e.min=(n,i)=>e.check(A(n,i)),e.gt=(n,i)=>e.check(ee(n,i)),e.gte=(n,i)=>e.check(A(n,i)),e.min=(n,i)=>e.check(A(n,i)),e.lt=(n,i)=>e.check(Q(n,i)),e.lte=(n,i)=>e.check(F(n,i)),e.max=(n,i)=>e.check(F(n,i)),e.positive=n=>e.check(ee(BigInt(0),n)),e.negative=n=>e.check(Q(BigInt(0),n)),e.nonpositive=n=>e.check(F(BigInt(0),n)),e.nonnegative=n=>e.check(A(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(de(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function xs(e){return Xa(Zt,e)}var mi=u("ZodBigIntFormat",(e,t)=>{Xo.init(e,t),Zt.init(e,t)});function bs(e){return qa(mi,e)}function ks(e){return Ya(mi,e)}var Ac=u("ZodSymbol",(e,t)=>{qo.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>an(e,r,n,i)});function zs(e){return Ha(Ac,e)}var Lc=u("ZodUndefined",(e,t)=>{Yo.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>un(e,r,n,i)});function Is(e){return Qa(Lc,e)}var Rc=u("ZodNull",(e,t)=>{Ho.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>cn(e,r,n,i)});function Cc(e){return ec(Rc,e)}var Fc=u("ZodAny",(e,t)=>{Qo.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>dn(e,r,n,i)});function Ss(){return tc(Fc)}var Jc=u("ZodUnknown",(e,t)=>{ea.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>mn(e,r,n,i)});function ve(){return rc(Jc)}var Vc=u("ZodNever",(e,t)=>{ta.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sn(e,r,n,i)});function pi(e){return nc(Vc,e)}var Mc=u("ZodVoid",(e,t)=>{ra.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ln(e,r,n,i)});function ws(e){return ic(Mc,e)}var fi=u("ZodDate",(e,t)=>{na.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>pn(e,n,i,o),e.min=(n,i)=>e.check(A(n,i)),e.max=(n,i)=>e.check(F(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function js(e){return oc(fi,e)}var Kc=u("ZodArray",(e,t)=>{ia.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>In(e,r,n,i),e.element=t.element,e.min=(r,n)=>e.check(oe(r,n)),e.nonempty=r=>e.check(oe(1,r)),e.max=(r,n)=>e.check(Ne(r,n)),e.length=(r,n)=>e.check(Ee(r,n)),e.unwrap=()=>e.element});function Dt(e,t){return mc(Kc,e,t)}function Ps(e){let t=e._zod.def.shape;return vi(Object.keys(t))}var Tt=u("ZodObject",(e,t)=>{ca.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Sn(e,r,n,i),m.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>vi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ve()}),e.loose=()=>e.clone({...e._zod.def,catchall:ve()}),e.strict=()=>e.clone({...e._zod.def,catchall:pi()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>m.extend(e,r),e.safeExtend=r=>m.safeExtend(e,r),e.merge=r=>m.merge(e,r),e.pick=r=>m.pick(e,r),e.omit=r=>m.omit(e,r),e.partial=(...r)=>m.partial(hi,e,r[0]),e.required=(...r)=>m.required(_i,e,r[0])});function Os(e,t){let r={type:"object",shape:e??{},...m.normalizeParams(t)};return new Tt(r)}function Us(e,t){return new Tt({type:"object",shape:e,catchall:pi(),...m.normalizeParams(t)})}function Zs(e,t){return new Tt({type:"object",shape:e,catchall:ve(),...m.normalizeParams(t)})}var Nt=u("ZodUnion",(e,t)=>{it.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yt(e,r,n,i),e.options=t.options});function gi(e,t){return new Nt({type:"union",options:e,...m.normalizeParams(t)})}var Bc=u("ZodXor",(e,t)=>{Nt.init(e,t),ua.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yt(e,r,n,i),e.options=t.options});function Ds(e,t){return new Bc({type:"union",options:e,inclusive:!1,...m.normalizeParams(t)})}var Gc=u("ZodDiscriminatedUnion",(e,t)=>{Nt.init(e,t),la.init(e,t)});function Ts(e,t,r){return new Gc({type:"union",options:t,discriminator:e,...m.normalizeParams(r)})}var Wc=u("ZodIntersection",(e,t)=>{sa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>wn(e,r,n,i)});function Xc(e,t){return new Wc({type:"intersection",left:e,right:t})}var qc=u("ZodTuple",(e,t)=>{Or.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>jn(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function Yc(e,t,r){let n=t instanceof y,i=n?r:t,o=n?t:null;return new qc({type:"tuple",items:e,rest:o,...m.normalizeParams(i)})}var Et=u("ZodRecord",(e,t)=>{da.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Pn(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function Hc(e,t,r){return new Et({type:"record",keyType:e,valueType:t,...m.normalizeParams(r)})}function Ns(e,t,r){let n=N(e);return n._zod.values=void 0,new Et({type:"record",keyType:n,valueType:t,...m.normalizeParams(r)})}function Es(e,t,r){return new Et({type:"record",keyType:e,valueType:t,mode:"loose",...m.normalizeParams(r)})}var Qc=u("ZodMap",(e,t)=>{ma.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>kn(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(te(...r)),e.nonempty=r=>e.check(te(1,r)),e.max=(...r)=>e.check(me(...r)),e.size=(...r)=>e.check(Te(...r))});function As(e,t,r){return new Qc({type:"map",keyType:e,valueType:t,...m.normalizeParams(r)})}var eu=u("ZodSet",(e,t)=>{pa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>zn(e,r,n,i),e.min=(...r)=>e.check(te(...r)),e.nonempty=r=>e.check(te(1,r)),e.max=(...r)=>e.check(me(...r)),e.size=(...r)=>e.check(Te(...r))});function Ls(e,t){return new eu({type:"set",valueType:e,...m.normalizeParams(t)})}var Fe=u("ZodEnum",(e,t)=>{fa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(n,i,o)=>fn(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let a of n)if(r.has(a))o[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Fe({...t,checks:[],...m.normalizeParams(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let a of n)if(r.has(a))delete o[a];else throw new Error(`Key ${a} not found in enum`);return new Fe({...t,checks:[],...m.normalizeParams(i),entries:o})}});function vi(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Fe({type:"enum",entries:r,...m.normalizeParams(t)})}function Rs(e,t){return new Fe({type:"enum",entries:e,...m.normalizeParams(t)})}var tu=u("ZodLiteral",(e,t)=>{ga.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>gn(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Cs(e,t){return new tu({type:"literal",values:Array.isArray(e)?e:[e],...m.normalizeParams(t)})}var ru=u("ZodFile",(e,t)=>{va.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>hn(e,r,n,i),e.min=(r,n)=>e.check(te(r,n)),e.max=(r,n)=>e.check(me(r,n)),e.mime=(r,n)=>e.check(ft(Array.isArray(r)?r:[r],n))});function Fs(e){return pc(ru,e)}var nu=u("ZodTransform",(e,t)=>{$a.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>bn(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new re(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(m.issue(o,r.value,t));else{let a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(m.issue(a))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function $i(e){return new nu({type:"transform",transform:e})}var hi=u("ZodOptional",(e,t)=>{Ur.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xt(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function It(e){return new hi({type:"optional",innerType:e})}var iu=u("ZodExactOptional",(e,t)=>{ha.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xt(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function ou(e){return new iu({type:"optional",innerType:e})}var au=u("ZodNullable",(e,t)=>{_a.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>On(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function St(e){return new au({type:"nullable",innerType:e})}function Js(e){return It(St(e))}var cu=u("ZodDefault",(e,t)=>{ya.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Zn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function uu(e,t){return new cu({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():m.shallowClone(t)}})}var lu=u("ZodPrefault",(e,t)=>{xa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Dn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function su(e,t){return new lu({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():m.shallowClone(t)}})}var _i=u("ZodNonOptional",(e,t)=>{ba.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Un(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function du(e,t){return new _i({type:"nonoptional",innerType:e,...m.normalizeParams(t)})}var mu=u("ZodSuccess",(e,t)=>{ka.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>_n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Vs(e){return new mu({type:"success",innerType:e})}var pu=u("ZodCatch",(e,t)=>{za.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Tn(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function fu(e,t){return new pu({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var gu=u("ZodNaN",(e,t)=>{Ia.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>vn(e,r,n,i)});function Ms(e){return ac(gu,e)}var yi=u("ZodPipe",(e,t)=>{Sa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Nn(e,r,n,i),e.in=t.in,e.out=t.out});function wt(e,t){return new yi({type:"pipe",in:e,out:t})}var xi=u("ZodCodec",(e,t)=>{yi.init(e,t),ot.init(e,t)});function Ks(e,t,r){return new xi({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var vu=u("ZodReadonly",(e,t)=>{wa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>En(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function $u(e){return new vu({type:"readonly",innerType:e})}var hu=u("ZodTemplateLiteral",(e,t)=>{ja.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>$n(e,r,n,i)});function Bs(e,t){return new hu({type:"template_literal",parts:e,...m.normalizeParams(t)})}var _u=u("ZodLazy",(e,t)=>{Ua.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Ln(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function yu(e){return new _u({type:"lazy",getter:e})}var xu=u("ZodPromise",(e,t)=>{Oa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>An(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Gs(e){return new xu({type:"promise",innerType:e})}var bu=u("ZodFunction",(e,t)=>{Pa.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>xn(e,r,n,i)});function Ws(e){return new bu({type:"function",input:Array.isArray(e?.input)?Yc(e?.input):e?.input??Dt(ve()),output:e?.output??ve()})}var At=u("ZodCustom",(e,t)=>{Za.init(e,t),x.init(e,t),e._zod.processJSONSchema=(r,n,i)=>yn(e,r,n,i)});function Xs(e){let t=new S({check:"custom"});return t._zod.check=e,t}function qs(e,t){return fc(At,e??(()=>!0),t)}function ku(e,t={}){return gc(At,e,t)}function zu(e){return vc(e)}var Ys=$c,Hs=hc;function Qs(e,t={}){let r=new At({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...m.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var ed=(...e)=>_c({Codec:xi,Boolean:Ut,String:jt},...e);function td(e){let t=yu(()=>gi([Gn(e),Nc(),Ec(),Cc(),Dt(t),Hc(Gn(),t)]));return t}function rd(e,t){return wt($i(e),t)}var Iu;Iu||(Iu={});var Rf={...Ce,...kt,iso:Re};P(Zr());import Ve from"chalk";var K={debug:0,info:1,warn:2,error:3,silent:4},bi=class{constructor(){this._level=this._getLogLevel()}_getLogLevel(){if(process.env.ZIBBY_DEBUG==="true")return K.debug;if(process.env.ZIBBY_VERBOSE==="true")return K.info;let t=process.env.LOG_LEVEL?.toLowerCase();return t&&t in K?K[t]:K.info}_shouldLog(t){return K[t]>=this._level}_formatMessage(t,r,n={}){let i=new Date().toISOString(),a=`${this._getPrefix(t)} ${r}`;return Object.keys(n).length>0&&(a+=Ve.dim(` ${JSON.stringify(n)}`)),a}_getPrefix(t){return{debug:Ve.gray("[DEBUG]"),info:Ve.cyan("[INFO]"),warn:Ve.yellow("[WARN]"),error:Ve.red("\u274C [ERROR]")}[t]||""}debug(t,r){this._shouldLog("debug")&&console.log(this._formatMessage("debug",t,r))}info(t,r){this._shouldLog("info")&&console.log(this._formatMessage("info",t,r))}warn(t,r){this._shouldLog("warn")&&console.warn(this._formatMessage("warn",t,r))}error(t,r){this._shouldLog("error")&&console.error(this._formatMessage("error",t,r))}setLevel(t){t in K&&(this._level=K[t])}getLevel(){return Object.keys(K).find(t=>K[t]===this._level)}},O=new bi;var ki={ASSISTANT:"gpt-5.4-nano-2026-03-17",CLAUDE:"claude-sonnet-4-6",CURSOR:"auto",CODEX:"o4-mini",GEMINI:"gemini-2.5-pro",OPENAI_POSTPROCESSING:"gpt-4o-mini"};var Su={CURSOR_AGENT_DEFAULT:1200*1e3,OPENAI_REQUEST:18e4};function sd(){if(process.env.OPENAI_PROXY_TOKEN)return O.debug("[Auth] Using OPENAI_PROXY_TOKEN (ECS execution)"),process.env.OPENAI_PROXY_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return O.debug("[Auth] Using ZIBBY_USER_TOKEN (CI/CD PAT)"),process.env.ZIBBY_USER_TOKEN;try{let e=cd(ad(),".zibby","config.json");if(ud(e)){let t=JSON.parse(ld(e,"utf-8"));if(t.sessionToken)return O.debug("[Auth] Using session token from zibby login"),t.sessionToken}}catch(e){O.debug(`[Auth] Could not read zibby login session: ${e.message}`)}return null}function dd(){return process.env.OPENAI_PROXY_URL?process.env.OPENAI_PROXY_URL.replace(/\/v1\/?$/,""):"https://api-prod.zibby.app/openai-proxy"}function he(e){if(!(typeof e!="object"||e===null)){if(Object.keys(e).length===0){e.type="object",e.additionalProperties=!0;return}if(e.type||(e.properties?e.type="object":e.items&&(e.type="array")),e.type==="object")if(e.properties){for(let[t,r]of Object.entries(e.properties))r.type==="object"&&r.additionalProperties&&r.additionalProperties!==!1&&(!r.properties||Object.keys(r.properties).length===0)&&(e.properties[t]={type:["object","null"]});e.additionalProperties=!1,e.required=Object.keys(e.properties),Object.values(e.properties).forEach(he)}else"additionalProperties"in e||(e.additionalProperties=!0);e.type==="array"&&e.items&&he(e.items),e.anyOf&&e.anyOf.forEach(he),e.oneOf&&e.oneOf.forEach(he),e.allOf&&e.allOf.forEach(he)}}async function yg(e,t){O.info("\u{1F527} [OpenAI Proxy] Formatting structured output...");let r=sd();if(!r)throw new Error("Authentication required for structured output processing.\n Local development: Run `zibby login`\n CI/CD: Set ZIBBY_USER_TOKEN environment variable (Personal Access Token from UI settings)");let n=dd();O.info(`\u{1F517} Using OpenAI proxy: ${n}`);let i=bt(t),o=i;if(i.$ref&&i.definitions){let d=i.$ref.split("/").pop();o=i.definitions[d]||i,O.debug(`Extracted schema from $ref: ${d}`)}delete o.$schema,he(o);let a=4e5,c=e;e.length>a&&(O.warn(`\u26A0\uFE0F [OpenAI Proxy] Raw text (${e.length} chars) exceeds limit, keeping last ${a} chars`),c=`... [truncated early content] ...
40
- ${e.slice(-a)}`);let l=`Extract and format the following information into structured JSON matching the schema.
1
+ import I from"axios";import{homedir as A}from"node:os";import{join as h}from"node:path";import{existsSync as x,readFileSync as N}from"node:fs";import{toJSONSchema as P}from"zod";import d from"chalk";var i={debug:0,info:1,warn:2,error:3,silent:4},g=class{constructor(){this._level=this._getLogLevel()}_getLogLevel(){if(process.env.ZIBBY_DEBUG==="true")return i.debug;if(process.env.ZIBBY_VERBOSE==="true")return i.info;let o=process.env.LOG_LEVEL?.toLowerCase();return o&&o in i?i[o]:i.info}_shouldLog(o){return i[o]>=this._level}_formatMessage(o,t,f={}){let s=new Date().toISOString(),a=`${this._getPrefix(o)} ${t}`;return Object.keys(f).length>0&&(a+=d.dim(` ${JSON.stringify(f)}`)),a}_getPrefix(o){return{debug:d.gray("[DEBUG]"),info:d.cyan("[INFO]"),warn:d.yellow("[WARN]"),error:d.red("\u274C [ERROR]")}[o]||""}debug(o,t){this._shouldLog("debug")&&console.log(this._formatMessage("debug",o,t))}info(o,t){this._shouldLog("info")&&console.log(this._formatMessage("info",o,t))}warn(o,t){this._shouldLog("warn")&&console.warn(this._formatMessage("warn",o,t))}error(o,t){this._shouldLog("error")&&console.error(this._formatMessage("error",o,t))}setLevel(o){o in i&&(this._level=i[o])}getLevel(){return Object.keys(i).find(o=>i[o]===this._level)}},n=new g;var O={ASSISTANT:"gpt-5.4-nano-2026-03-17",CLAUDE:"claude-sonnet-4-6",CURSOR:"auto",CODEX:"o4-mini",GEMINI:"gemini-2.5-pro",OPENAI_POSTPROCESSING:"gpt-4o-mini"};var m={CURSOR_AGENT_DEFAULT:1200*1e3,OPENAI_REQUEST:18e4};function b(){if(process.env.OPENAI_PROXY_TOKEN)return n.debug("[Auth] Using OPENAI_PROXY_TOKEN (ECS execution)"),process.env.OPENAI_PROXY_TOKEN;if(process.env.ZIBBY_USER_TOKEN)return n.debug("[Auth] Using ZIBBY_USER_TOKEN (CI/CD PAT)"),process.env.ZIBBY_USER_TOKEN;try{let e=h(A(),".zibby","config.json");if(x(e)){let o=JSON.parse(N(e,"utf-8"));if(o.sessionToken)return n.debug("[Auth] Using session token from zibby login"),o.sessionToken}}catch(e){n.debug(`[Auth] Could not read zibby login session: ${e.message}`)}return null}function R(){return process.env.OPENAI_PROXY_URL?process.env.OPENAI_PROXY_URL.replace(/\/v1\/?$/,""):"https://api-prod.zibby.app/openai-proxy"}function c(e){if(!(typeof e!="object"||e===null)){if(Object.keys(e).length===0){e.type="object",e.additionalProperties=!0;return}if(e.type||(e.properties?e.type="object":e.items&&(e.type="array")),e.type==="object")if(e.properties){for(let[o,t]of Object.entries(e.properties))t.type==="object"&&t.additionalProperties&&t.additionalProperties!==!1&&(!t.properties||Object.keys(t.properties).length===0)&&(e.properties[o]={type:["object","null"]});e.additionalProperties=!1,e.required=Object.keys(e.properties),Object.values(e.properties).forEach(c)}else"additionalProperties"in e||(e.additionalProperties=!0);e.type==="array"&&e.items&&c(e.items),e.anyOf&&e.anyOf.forEach(c),e.oneOf&&e.oneOf.forEach(c),e.allOf&&e.allOf.forEach(c)}}async function k(e,o){n.info("\u{1F527} [OpenAI Proxy] Formatting structured output...");let t=b();if(!t)throw new Error("Authentication required for structured output processing.\n Local development: Run `zibby login`\n CI/CD: Set ZIBBY_USER_TOKEN environment variable (Personal Access Token from UI settings)");let f=R();n.info(`\u{1F517} Using OpenAI proxy: ${f}`);let s=P(o),p=s;if(s.$ref&&s.definitions){let r=s.$ref.split("/").pop();p=s.definitions[r]||s,n.debug(`Extracted schema from $ref: ${r}`)}delete p.$schema,c(p);let a=4e5,E=e;e.length>a&&(n.warn(`\u26A0\uFE0F [OpenAI Proxy] Raw text (${e.length} chars) exceeds limit, keeping last ${a} chars`),E=`... [truncated early content] ...
2
+ ${e.slice(-a)}`);let _=`Extract and format the following information into structured JSON matching the schema.
41
3
 
42
4
  RAW CONTENT:
43
- ${c}
5
+ ${E}
44
6
 
45
- Extract all relevant information and format it according to the schema. If any required fields are missing, do your best to infer them from the content.`,s={model:ki.OPENAI_POSTPROCESSING,messages:[{role:"user",content:l}],response_format:{type:"json_schema",json_schema:{name:"extract",schema:o,strict:!0}}};O.info(`\u{1F4E4} Sending to OpenAI proxy: model=${ki.OPENAI_POSTPROCESSING}, schema keys=${Object.keys(o.properties||{}).join(", ")}`),O.debug(` Schema size: ${JSON.stringify(o).length} chars`),O.debug(` Prompt size: ${l.length} chars`);try{let d={"Content-Type":"application/json"};process.env.OPENAI_PROXY_TOKEN?(d["x-proxy-token"]=r,d["x-execution-id"]=process.env.EXECUTION_ID||""):(d.Authorization=`Bearer ${r}`,d["x-api-key"]=process.env.ZIBBY_API_KEY||"",d["x-execution-id"]=process.env.EXECUTION_ID||"");let g=(await od.post(n,s,{headers:d,timeout:Su.OPENAI_REQUEST})).data?.choices?.[0]?.message?.content;if(!g)throw new Error("OpenAI proxy returned empty response");let v=JSON.parse(g);return O.info("\u2705 Successfully formatted with OpenAI proxy"),{structured:v,raw:e}}catch(d){if(d.response){let p=d.response.status,g=d.response.data;throw O.error(`\u274C OpenAI proxy request failed: ${p}`),O.error(` Status: ${p}`),O.error(` Response: ${JSON.stringify(g,null,2)}`),p===401||p===403?new Error(`Authentication failed for OpenAI proxy.
7
+ Extract all relevant information and format it according to the schema. If any required fields are missing, do your best to infer them from the content.`,y={model:O.OPENAI_POSTPROCESSING,messages:[{role:"user",content:_}],response_format:{type:"json_schema",json_schema:{name:"extract",schema:p,strict:!0}}};n.info(`\u{1F4E4} Sending to OpenAI proxy: model=${O.OPENAI_POSTPROCESSING}, schema keys=${Object.keys(p.properties||{}).join(", ")}`),n.debug(` Schema size: ${JSON.stringify(p).length} chars`),n.debug(` Prompt size: ${_.length} chars`);try{let r={"Content-Type":"application/json"};process.env.OPENAI_PROXY_TOKEN?(r["x-proxy-token"]=t,r["x-execution-id"]=process.env.EXECUTION_ID||""):(r.Authorization=`Bearer ${t}`,r["x-api-key"]=process.env.ZIBBY_API_KEY||"",r["x-execution-id"]=process.env.EXECUTION_ID||"");let u=(await I.post(f,y,{headers:r,timeout:m.OPENAI_REQUEST})).data?.choices?.[0]?.message?.content;if(!u)throw new Error("OpenAI proxy returned empty response");let S=JSON.parse(u);return n.info("\u2705 Successfully formatted with OpenAI proxy"),{structured:S,raw:e}}catch(r){if(r.response){let l=r.response.status,u=r.response.data;throw n.error(`\u274C OpenAI proxy request failed: ${l}`),n.error(` Status: ${l}`),n.error(` Response: ${JSON.stringify(u,null,2)}`),l===401||l===403?new Error(`Authentication failed for OpenAI proxy.
46
8
  Run \`zibby login\` or set ZIBBY_USER_TOKEN environment variable.
47
- Response: ${JSON.stringify(g)}`,{cause:d}):new Error(`Failed to format Cursor output: ${g?.error?.message||"Unknown error"}`,{cause:d})}throw O.error(`\u274C OpenAI proxy request failed: ${d.message}`),new Error(`Failed to format output: ${d.message}`,{cause:d})}}export{yg as formatWithOpenAIProxy};
9
+ Response: ${JSON.stringify(u)}`,{cause:r}):new Error(`Failed to format Cursor output: ${u?.error?.message||"Unknown error"}`,{cause:r})}throw n.error(`\u274C OpenAI proxy request failed: ${r.message}`),new Error(`Failed to format output: ${r.message}`,{cause:r})}}export{k as formatWithOpenAIProxy};