File: /home/deshuvsd/www/wp-content/plugins/surerank/build/vendor-f3718ba5/index.js
"use strict";(globalThis.webpackChunksurerank=globalThis.webpackChunksurerank||[]).push([[8871],{5281:(e,t,a)=>{var n,s;a.d(t,{kY:()=>Ie,aR:()=>Z,YO:()=>ze,zM:()=>Re,gM:()=>De,k5:()=>Be,eu:()=>Ve,ai:()=>Me,Ik:()=>Fe,lq:()=>Ke,g1:()=>Ue,Yj:()=>Ee,KC:()=>Ye,L5:()=>Le}),function(e){e.assertEqual=e=>{},e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},e.getValidEnumValues=t=>{const a=e.objectKeys(t).filter(e=>"number"!==typeof t[t[e]]),n={};for(const e of a)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys="function"===typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},e.find=(e,t)=>{for(const a of e)if(t(a))return a},e.isInteger="function"===typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"===typeof e&&Number.isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map(e=>"string"===typeof e?`'${e}'`:e).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"===typeof t?t.toString():t}(n||(n={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(s||(s={}));const r=n.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),i=e=>{switch(typeof e){case"undefined":return r.undefined;case"string":return r.string;case"number":return Number.isNaN(e)?r.nan:r.number;case"boolean":return r.boolean;case"function":return r.function;case"bigint":return r.bigint;case"symbol":return r.symbol;case"object":return Array.isArray(e)?r.array:null===e?r.null:e.then&&"function"===typeof e.then&&e.catch&&"function"===typeof e.catch?r.promise:"undefined"!==typeof Map&&e instanceof Map?r.map:"undefined"!==typeof Set&&e instanceof Set?r.set:"undefined"!==typeof Date&&e instanceof Date?r.date:r.object;default:return r.unknown}},o=n.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"]);class d extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},n=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(n);else if("invalid_return_type"===s.code)n(s.returnTypeError);else if("invalid_arguments"===s.code)n(s.argumentsError);else if(0===s.path.length)a._errors.push(t(s));else{let e=a,n=0;for(;n<s.path.length;){const a=s.path[n];n===s.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(s))):e[a]=e[a]||{_errors:[]},e=e[a],n++}}};return n(this),a}static assert(e){if(!(e instanceof d))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const n of this.issues)if(n.path.length>0){const a=n.path[0];t[a]=t[a]||[],t[a].push(e(n))}else a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}d.create=e=>new d(e);const u=(e,t)=>{let a;switch(e.code){case o.invalid_type:a=e.received===r.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case o.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,n.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:a=`Unrecognized key(s) in object: ${n.joinValues(e.keys,", ")}`;break;case o.invalid_union:a="Invalid input";break;case o.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${n.joinValues(e.options)}`;break;case o.invalid_enum_value:a=`Invalid enum value. Expected ${n.joinValues(e.options)}, received '${e.received}'`;break;case o.invalid_arguments:a="Invalid function arguments";break;case o.invalid_return_type:a="Invalid function return type";break;case o.invalid_date:a="Invalid date";break;case o.invalid_string:"object"===typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"===typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:n.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case o.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case o.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case o.custom:a="Invalid input";break;case o.invalid_intersection_types:a="Intersection results could not be merged";break;case o.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case o.not_finite:a="Number must be finite";break;default:a=t.defaultError,n.assertNever(e)}return{message:a}};let c=u;var l;function h(e,t){const a=(e=>{const{data:t,path:a,errorMaps:n,issueData:s}=e,r=[...a,...s.path||[]],i={...s,path:r};if(void 0!==s.message)return{...s,path:r,message:s.message};let o="";const d=n.filter(e=>!!e).slice().reverse();for(const u of d)o=u(i,{data:t,defaultError:o}).message;return{...s,path:r,message:o}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,c,c===u?void 0:u].filter(e=>!!e)});e.common.issues.push(a)}!function(e){e.errToObj=e=>"string"===typeof e?{message:e}:e||{},e.toString=e=>"string"===typeof e?e:e?.message}(l||(l={}));class p{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const n of t){if("aborted"===n.status)return m;"dirty"===n.status&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const n of t){const e=await n.key,t=await n.value;a.push({key:e,value:t})}return p.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const n of t){const{key:t,value:s}=n;if("aborted"===t.status)return m;if("aborted"===s.status)return m;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||"undefined"===typeof s.value&&!n.alwaysSet||(a[t.value]=s.value)}return{status:e.value,value:a}}}const m=Object.freeze({status:"aborted"}),f=e=>({status:"dirty",value:e}),y=e=>({status:"valid",value:e}),g=e=>"aborted"===e.status,_=e=>"dirty"===e.status,v=e=>"valid"===e.status,k=e=>"undefined"!==typeof Promise&&e instanceof Promise;class b{constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}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}}const x=(e,t)=>{if(v(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new d(e.common.issues);return this._error=t,this._error}}};function w(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:n,description:s}=e;if(t&&(a||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:s}:{errorMap:(t,s)=>{const{message:r}=e;return"invalid_enum_value"===t.code?{message:r??s.defaultError}:"undefined"===typeof s.data?{message:r??n??s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:r??a??s.defaultError}},description:s}}class Z{get description(){return this._def.description}_getType(e){return i(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new p,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(k(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){const a={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)},n=this._parseSync({data:e,path:a.path,parent:a});return x(a,n)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:t});return v(a)?{value:a.value}:{issues:t.common.issues}}catch(a){a?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>v(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)},n=this._parse({data:e,path:a.path,parent:a}),s=await(k(n)?n:Promise.resolve(n));return x(a,s)}refine(e,t){const a=e=>"string"===typeof t||"undefined"===typeof t?{message:t}:"function"===typeof t?t(e):t;return this._refinement((t,n)=>{const s=e(t),r=()=>n.addIssue({code:o.custom,...a(t)});return"undefined"!==typeof Promise&&s instanceof Promise?s.then(e=>!!e||(r(),!1)):!!s||(r(),!1)})}refinement(e,t){return this._refinement((a,n)=>!!e(a)||(n.addIssue("function"===typeof t?t(a,n):t),!1))}_refinement(e){return new Ae({schema:this,typeName:Ie.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:e=>this["~validate"](e)}}optional(){return Te.create(this,this._def)}nullable(){return Oe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return oe.create(this)}promise(){return Ze.create(this,this._def)}or(e){return ce.create([this,e],this._def)}and(e){return me.create(this,e,this._def)}transform(e){return new Ae({...w(this._def),schema:this,typeName:Ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"===typeof e?e:()=>e;return new Se({...w(this._def),innerType:this,defaultValue:t,typeName:Ie.ZodDefault})}brand(){return new je({typeName:Ie.ZodBranded,type:this,...w(this._def)})}catch(e){const t="function"===typeof e?e:()=>e;return new Pe({...w(this._def),innerType:this,catchValue:t,typeName:Ie.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ce.create(this,e)}readonly(){return $e.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const A=/^c[^\s-]{8,}$/i,T=/^[0-9a-z]+$/,O=/^[0-9A-HJKMNP-TV-Z]{26}$/i,S=/^[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,P=/^[a-z0-9_-]{21}$/i,N=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,j=/^[-+]?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)?)??$/,C=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let $;const I=/^(?:(?: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])$/,E=/^(?:(?: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])$/,M=/^(([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]))$/,R=/^(([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])$/,L=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,z=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,F="((\\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])))",Y=new RegExp(`^${F}$`);function D(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function U(e){return new RegExp(`^${D(e)}$`)}function V(e){let t=`${F}T${D(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function B(e,t){return!("v4"!==t&&t||!I.test(e))||!("v6"!==t&&t||!M.test(e))}function K(e,t){if(!N.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const n=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),s=JSON.parse(atob(n));return"object"===typeof s&&null!==s&&(!("typ"in s)||"JWT"===s?.typ)&&!!s.alg&&(!t||s.alg===t)}catch{return!1}}function W(e,t){return!("v4"!==t&&t||!E.test(e))||!("v6"!==t&&t||!R.test(e))}class q extends Z{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==r.string){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.string,received:t.parsedType}),m}const t=new p;let a;for(const s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:o.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("max"===s.kind)e.data.length>s.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:o.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("length"===s.kind){const n=e.data.length>s.value,r=e.data.length<s.value;(n||r)&&(a=this._getOrReturnCtx(e,a),n?h(a,{code:o.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):r&&h(a,{code:o.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if("email"===s.kind)C.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"email",code:o.invalid_string,message:s.message}),t.dirty());else if("emoji"===s.kind)$||($=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),$.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"emoji",code:o.invalid_string,message:s.message}),t.dirty());else if("uuid"===s.kind)S.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"uuid",code:o.invalid_string,message:s.message}),t.dirty());else if("nanoid"===s.kind)P.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"nanoid",code:o.invalid_string,message:s.message}),t.dirty());else if("cuid"===s.kind)A.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cuid",code:o.invalid_string,message:s.message}),t.dirty());else if("cuid2"===s.kind)T.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cuid2",code:o.invalid_string,message:s.message}),t.dirty());else if("ulid"===s.kind)O.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"ulid",code:o.invalid_string,message:s.message}),t.dirty());else if("url"===s.kind)try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),h(a,{validation:"url",code:o.invalid_string,message:s.message}),t.dirty()}else"regex"===s.kind?(s.regex.lastIndex=0,s.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"regex",code:o.invalid_string,message:s.message}),t.dirty())):"trim"===s.kind?e.data=e.data.trim():"includes"===s.kind?e.data.includes(s.value,s.position)||(a=this._getOrReturnCtx(e,a),h(a,{code:o.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty()):"toLowerCase"===s.kind?e.data=e.data.toLowerCase():"toUpperCase"===s.kind?e.data=e.data.toUpperCase():"startsWith"===s.kind?e.data.startsWith(s.value)||(a=this._getOrReturnCtx(e,a),h(a,{code:o.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty()):"endsWith"===s.kind?e.data.endsWith(s.value)||(a=this._getOrReturnCtx(e,a),h(a,{code:o.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty()):"datetime"===s.kind?V(s).test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:o.invalid_string,validation:"datetime",message:s.message}),t.dirty()):"date"===s.kind?Y.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:o.invalid_string,validation:"date",message:s.message}),t.dirty()):"time"===s.kind?U(s).test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{code:o.invalid_string,validation:"time",message:s.message}),t.dirty()):"duration"===s.kind?j.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"duration",code:o.invalid_string,message:s.message}),t.dirty()):"ip"===s.kind?B(e.data,s.version)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"ip",code:o.invalid_string,message:s.message}),t.dirty()):"jwt"===s.kind?K(e.data,s.alg)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"jwt",code:o.invalid_string,message:s.message}),t.dirty()):"cidr"===s.kind?W(e.data,s.version)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"cidr",code:o.invalid_string,message:s.message}),t.dirty()):"base64"===s.kind?L.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"base64",code:o.invalid_string,message:s.message}),t.dirty()):"base64url"===s.kind?z.test(e.data)||(a=this._getOrReturnCtx(e,a),h(a,{validation:"base64url",code:o.invalid_string,message:s.message}),t.dirty()):n.assertNever(s);return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:o.invalid_string,...l.errToObj(a)})}_addCheck(e){return new q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...l.errToObj(e)})}url(e){return this._addCheck({kind:"url",...l.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...l.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...l.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...l.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...l.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...l.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...l.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...l.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...l.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...l.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...l.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...l.errToObj(e)})}datetime(e){return this._addCheck("string"===typeof e?{kind:"datetime",precision:null,offset:!1,local:!1,message:e}:{kind:"datetime",precision:"undefined"===typeof e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...l.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return this._addCheck("string"===typeof e?{kind:"time",precision:null,message:e}:{kind:"time",precision:"undefined"===typeof e?.precision?null:e?.precision,...l.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...l.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...l.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...l.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...l.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...l.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...l.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...l.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...l.errToObj(t)})}nonempty(e){return this.min(1,l.errToObj(e))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function J(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=a>n?a:n;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}q.create=e=>new q({checks:[],typeName:Ie.ZodString,coerce:e?.coerce??!1,...w(e)});class H extends Z{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)!==r.number){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.number,received:t.parsedType}),m}let t;const a=new p;for(const s of this._def.checks)"int"===s.kind?n.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),h(t,{code:o.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):"multipleOf"===s.kind?0!==J(e.data,s.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):"finite"===s.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),h(t,{code:o.not_finite,message:s.message}),a.dirty()):n.assertNever(s);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,a,n){return new H({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:l.toString(n)}]})}_addCheck(e){return new H({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:l.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:l.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:l.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:l.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&n.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}H.create=e=>new H({checks:[],typeName:Ie.ZodNumber,coerce:e?.coerce||!1,...w(e)});class G extends Z{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)!==r.bigint)return this._getInvalidInput(e);let t;const a=new p;for(const s of this._def.checks)"min"===s.kind?(s.inclusive?e.data<s.value:e.data<=s.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):"max"===s.kind?(s.inclusive?e.data>s.value:e.data>=s.value)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),a.dirty()):"multipleOf"===s.kind?e.data%s.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),h(t,{code:o.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):n.assertNever(s);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,l.toString(t))}gt(e,t){return this.setLimit("min",e,!1,l.toString(t))}lte(e,t){return this.setLimit("max",e,!0,l.toString(t))}lt(e,t){return this.setLimit("max",e,!1,l.toString(t))}setLimit(e,t,a,n){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:l.toString(n)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:l.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:l.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:l.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:l.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:l.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}G.create=e=>new G({checks:[],typeName:Ie.ZodBigInt,coerce:e?.coerce??!1,...w(e)});class X extends Z{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==r.boolean){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.boolean,received:t.parsedType}),m}return y(e.data)}}X.create=e=>new X({typeName:Ie.ZodBoolean,coerce:e?.coerce||!1,...w(e)});class Q extends Z{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==r.date){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.date,received:t.parsedType}),m}if(Number.isNaN(e.data.getTime()))return h(this._getOrReturnCtx(e),{code:o.invalid_date}),m;const t=new p;let a;for(const s of this._def.checks)"min"===s.kind?e.data.getTime()<s.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:o.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),t.dirty()):"max"===s.kind?e.data.getTime()>s.value&&(a=this._getOrReturnCtx(e,a),h(a,{code:o.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),t.dirty()):n.assertNever(s);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:l.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:l.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}Q.create=e=>new Q({checks:[],coerce:e?.coerce||!1,typeName:Ie.ZodDate,...w(e)});class ee extends Z{_parse(e){if(this._getType(e)!==r.symbol){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.symbol,received:t.parsedType}),m}return y(e.data)}}ee.create=e=>new ee({typeName:Ie.ZodSymbol,...w(e)});class te extends Z{_parse(e){if(this._getType(e)!==r.undefined){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.undefined,received:t.parsedType}),m}return y(e.data)}}te.create=e=>new te({typeName:Ie.ZodUndefined,...w(e)});class ae extends Z{_parse(e){if(this._getType(e)!==r.null){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.null,received:t.parsedType}),m}return y(e.data)}}ae.create=e=>new ae({typeName:Ie.ZodNull,...w(e)});class ne extends Z{constructor(){super(...arguments),this._any=!0}_parse(e){return y(e.data)}}ne.create=e=>new ne({typeName:Ie.ZodAny,...w(e)});class se extends Z{constructor(){super(...arguments),this._unknown=!0}_parse(e){return y(e.data)}}se.create=e=>new se({typeName:Ie.ZodUnknown,...w(e)});class re extends Z{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.never,received:t.parsedType}),m}}re.create=e=>new re({typeName:Ie.ZodNever,...w(e)});class ie extends Z{_parse(e){if(this._getType(e)!==r.undefined){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.void,received:t.parsedType}),m}return y(e.data)}}ie.create=e=>new ie({typeName:Ie.ZodVoid,...w(e)});class oe extends Z{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==r.array)return h(t,{code:o.invalid_type,expected:r.array,received:t.parsedType}),m;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,s=t.data.length<n.exactLength.value;(e||s)&&(h(t,{code:e?o.too_big:o.too_small,minimum:s?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(h(t,{code:o.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(h(t,{code:o.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>n.type._parseAsync(new b(t,e,t.path,a)))).then(e=>p.mergeArray(a,e));const s=[...t.data].map((e,a)=>n.type._parseSync(new b(t,e,t.path,a)));return p.mergeArray(a,s)}get element(){return this._def.type}min(e,t){return new oe({...this._def,minLength:{value:e,message:l.toString(t)}})}max(e,t){return new oe({...this._def,maxLength:{value:e,message:l.toString(t)}})}length(e,t){return new oe({...this._def,exactLength:{value:e,message:l.toString(t)}})}nonempty(e){return this.min(1,e)}}function de(e){if(e instanceof ue){const t={};for(const a in e.shape)t[a]=Te.create(de(e.shape[a]));return new ue({...e._def,shape:()=>t})}return e instanceof oe?new oe({...e._def,type:de(e.element)}):e instanceof Te?Te.create(de(e.unwrap())):e instanceof Oe?Oe.create(de(e.unwrap())):e instanceof fe?fe.create(e.items.map(e=>de(e))):e}oe.create=(e,t)=>new oe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ie.ZodArray,...w(t)});class ue extends Z{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=n.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==r.object){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.object,received:t.parsedType}),m}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:s}=this._getCached(),i=[];if(!(this._def.catchall instanceof re&&"strip"===this._def.unknownKeys))for(const r in a.data)s.includes(r)||i.push(r);const d=[];for(const r of s)d.push({key:{status:"valid",value:r},value:n[r]._parse(new b(a,a.data[r],a.path,r)),alwaysSet:r in a.data});if(this._def.catchall instanceof re){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of i)d.push({key:{status:"valid",value:t},value:{status:"valid",value:a.data[t]}});else if("strict"===e)i.length>0&&(h(a,{code:o.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i)d.push({key:{status:"valid",value:t},value:e._parse(new b(a,a.data[t],a.path,t)),alwaysSet:t in a.data})}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of d){const a=await t.key,n=await t.value;e.push({key:a,value:n,alwaysSet:t.alwaysSet})}return e}).then(e=>p.mergeObjectSync(t,e)):p.mergeObjectSync(t,d)}get shape(){return this._def.shape()}strict(e){return new ue({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{const n=this._def.errorMap?.(t,a).message??a.defaultError;return"unrecognized_keys"===t.code?{message:l.errToObj(e).message??n}:{message:n}}}:{}})}strip(){return new ue({...this._def,unknownKeys:"strip"})}passthrough(){return new ue({...this._def,unknownKeys:"passthrough"})}extend(e){return new ue({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ue({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ie.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ue({...this._def,catchall:e})}pick(e){const t={};for(const a of n.objectKeys(e))e[a]&&this.shape[a]&&(t[a]=this.shape[a]);return new ue({...this._def,shape:()=>t})}omit(e){const t={};for(const a of n.objectKeys(this.shape))e[a]||(t[a]=this.shape[a]);return new ue({...this._def,shape:()=>t})}deepPartial(){return de(this)}partial(e){const t={};for(const a of n.objectKeys(this.shape)){const n=this.shape[a];t[a]=e&&!e[a]?n:n.optional()}return new ue({...this._def,shape:()=>t})}required(e){const t={};for(const a of n.objectKeys(this.shape))if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof Te;)e=e._def.innerType;t[a]=e}return new ue({...this._def,shape:()=>t})}keyof(){return be(n.objectKeys(this.shape))}}ue.create=(e,t)=>new ue({shape:()=>e,unknownKeys:"strip",catchall:re.create(),typeName:Ie.ZodObject,...w(t)}),ue.strictCreate=(e,t)=>new ue({shape:()=>e,unknownKeys:"strict",catchall:re.create(),typeName:Ie.ZodObject,...w(t)}),ue.lazycreate=(e,t)=>new ue({shape:e,unknownKeys:"strip",catchall:re.create(),typeName:Ie.ZodObject,...w(t)});class ce extends Z{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const a=e.map(e=>new d(e.ctx.common.issues));return h(t,{code:o.invalid_union,unionErrors:a}),m});{let e;const n=[];for(const r of a){const a={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:a});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const s=n.map(e=>new d(e));return h(t,{code:o.invalid_union,unionErrors:s}),m}}get options(){return this._def.options}}ce.create=(e,t)=>new ce({options:e,typeName:Ie.ZodUnion,...w(t)});const le=e=>e instanceof ve?le(e.schema):e instanceof Ae?le(e.innerType()):e instanceof ke?[e.value]:e instanceof xe?e.options:e instanceof we?n.objectValues(e.enum):e instanceof Se?le(e._def.innerType):e instanceof te?[void 0]:e instanceof ae?[null]:e instanceof Te?[void 0,...le(e.unwrap())]:e instanceof Oe?[null,...le(e.unwrap())]:e instanceof je||e instanceof $e?le(e.unwrap()):e instanceof Pe?le(e._def.innerType):[];class he extends Z{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.object)return h(t,{code:o.invalid_type,expected:r.object,received:t.parsedType}),m;const a=this.discriminator,n=this.optionsMap.get(t.data[a]);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const n=new Map;for(const s of t){const t=le(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of t){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,s)}}return new he({typeName:Ie.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...w(a)})}}function pe(e,t){const a=i(e),s=i(t);if(e===t)return{valid:!0,data:e};if(a===r.object&&s===r.object){const a=n.objectKeys(t),s=n.objectKeys(e).filter(e=>-1!==a.indexOf(e)),r={...e,...t};for(const n of s){const a=pe(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(a===r.array&&s===r.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const s=pe(e[n],t[n]);if(!s.valid)return{valid:!1};a.push(s.data)}return{valid:!0,data:a}}return a===r.date&&s===r.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}class me extends Z{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(g(e)||g(n))return m;const s=pe(e.value,n.value);return s.valid?((_(e)||_(n))&&t.dirty(),{status:t.value,value:s.data}):(h(a,{code:o.invalid_intersection_types}),m)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>n(e,t)):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}me.create=(e,t,a)=>new me({left:e,right:t,typeName:Ie.ZodIntersection,...w(a)});class fe extends Z{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.array)return h(a,{code:o.invalid_type,expected:r.array,received:a.parsedType}),m;if(a.data.length<this._def.items.length)return h(a,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&a.data.length>this._def.items.length&&(h(a,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new b(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(n).then(e=>p.mergeArray(t,e)):p.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new fe({...this._def,rest:e})}}fe.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fe({items:e,typeName:Ie.ZodTuple,rest:null,...w(t)})};class ye extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.object)return h(a,{code:o.invalid_type,expected:r.object,received:a.parsedType}),m;const n=[],s=this._def.keyType,i=this._def.valueType;for(const r in a.data)n.push({key:s._parse(new b(a,r,a.path,r)),value:i._parse(new b(a,a.data[r],a.path,r)),alwaysSet:r in a.data});return a.common.async?p.mergeObjectAsync(t,n):p.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return new ye(t instanceof Z?{keyType:e,valueType:t,typeName:Ie.ZodRecord,...w(a)}:{keyType:q.create(),valueType:e,typeName:Ie.ZodRecord,...w(t)})}}class ge extends Z{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.map)return h(a,{code:o.invalid_type,expected:r.map,received:a.parsedType}),m;const n=this._def.keyType,s=this._def.valueType,i=[...a.data.entries()].map(([e,t],r)=>({key:n._parse(new b(a,e,a.path,[r,"key"])),value:s._parse(new b(a,t,a.path,[r,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of i){const n=await a.key,s=await a.value;if("aborted"===n.status||"aborted"===s.status)return m;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of i){const n=a.key,s=a.value;if("aborted"===n.status||"aborted"===s.status)return m;"dirty"!==n.status&&"dirty"!==s.status||t.dirty(),e.set(n.value,s.value)}return{status:t.value,value:e}}}}ge.create=(e,t,a)=>new ge({valueType:t,keyType:e,typeName:Ie.ZodMap,...w(a)});class _e extends Z{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==r.set)return h(a,{code:o.invalid_type,expected:r.set,received:a.parsedType}),m;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(h(a,{code:o.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(h(a,{code:o.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const s=this._def.valueType;function i(e){const a=new Set;for(const n of e){if("aborted"===n.status)return m;"dirty"===n.status&&t.dirty(),a.add(n.value)}return{status:t.value,value:a}}const d=[...a.data.values()].map((e,t)=>s._parse(new b(a,e,a.path,t)));return a.common.async?Promise.all(d).then(e=>i(e)):i(d)}min(e,t){return new _e({...this._def,minSize:{value:e,message:l.toString(t)}})}max(e,t){return new _e({...this._def,maxSize:{value:e,message:l.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_e.create=(e,t)=>new _e({valueType:e,minSize:null,maxSize:null,typeName:Ie.ZodSet,...w(t)});class ve extends Z{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ve.create=(e,t)=>new ve({getter:e,typeName:Ie.ZodLazy,...w(t)});class ke extends Z{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}}function be(e,t){return new xe({values:e,typeName:Ie.ZodEnum,...w(t)})}ke.create=(e,t)=>new ke({value:e,typeName:Ie.ZodLiteral,...w(t)});class xe extends Z{_parse(e){if("string"!==typeof e.data){const t=this._getOrReturnCtx(e);return h(t,{expected:n.joinValues(this._def.values),received:t.parsedType,code:o.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:o.invalid_enum_value,options:this._def.values}),m}return y(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return xe.create(e,{...this._def,...t})}exclude(e,t=this._def){return xe.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}xe.create=be;class we extends Z{_parse(e){const t=n.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==r.string&&a.parsedType!==r.number){const e=n.objectValues(t);return h(a,{expected:n.joinValues(e),received:a.parsedType,code:o.invalid_type}),m}if(this._cache||(this._cache=new Set(n.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=n.objectValues(t);return h(a,{received:a.data,code:o.invalid_enum_value,options:e}),m}return y(e.data)}get enum(){return this._def.values}}we.create=(e,t)=>new we({values:e,typeName:Ie.ZodNativeEnum,...w(t)});class Ze extends Z{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==r.promise&&!1===t.common.async)return h(t,{code:o.invalid_type,expected:r.promise,received:t.parsedType}),m;const a=t.parsedType===r.promise?t.data:Promise.resolve(t.data);return y(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ze.create=(e,t)=>new Ze({type:e,typeName:Ie.ZodPromise,...w(t)});class Ae extends Z{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),s=this._def.effect||null,r={addIssue:e=>{h(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===s.type){const e=s.transform(a.data,r);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return m;const n=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===n.status?m:"dirty"===n.status||"dirty"===t.value?f(n.value):n});{if("aborted"===t.value)return m;const n=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===n.status?m:"dirty"===n.status||"dirty"===t.value?f(n.value):n}}if("refinement"===s.type){const e=e=>{const t=s.refinement(e,r);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?m:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?m:("dirty"===a.status&&t.dirty(),e(a.value).then(()=>({status:t.value,value:a.value}))))}if("transform"===s.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!v(e))return m;const n=s.transform(e.value,r);if(n instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:n}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>v(e)?Promise.resolve(s.transform(e.value,r)).then(e=>({status:t.value,value:e})):m)}n.assertNever(s)}}Ae.create=(e,t,a)=>new Ae({schema:e,typeName:Ie.ZodEffects,effect:t,...w(a)}),Ae.createWithPreprocess=(e,t,a)=>new Ae({schema:t,effect:{type:"preprocess",transform:e},typeName:Ie.ZodEffects,...w(a)});class Te extends Z{_parse(e){return this._getType(e)===r.undefined?y(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Te.create=(e,t)=>new Te({innerType:e,typeName:Ie.ZodOptional,...w(t)});class Oe extends Z{_parse(e){return this._getType(e)===r.null?y(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Oe.create=(e,t)=>new Oe({innerType:e,typeName:Ie.ZodNullable,...w(t)});class Se extends Z{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===r.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Se.create=(e,t)=>new Se({innerType:e,typeName:Ie.ZodDefault,defaultValue:"function"===typeof t.default?t.default:()=>t.default,...w(t)});class Pe extends Z{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return k(n)?n.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new d(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new d(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}Pe.create=(e,t)=>new Pe({innerType:e,typeName:Ie.ZodCatch,catchValue:"function"===typeof t.catch?t.catch:()=>t.catch,...w(t)});class Ne extends Z{_parse(e){if(this._getType(e)!==r.nan){const t=this._getOrReturnCtx(e);return h(t,{code:o.invalid_type,expected:r.nan,received:t.parsedType}),m}return{status:"valid",value:e.data}}}Ne.create=e=>new Ne({typeName:Ie.ZodNaN,...w(e)}),Symbol("zod_brand");class je extends Z{_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.type._parse({data:t.data,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ce extends Z{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?m:"dirty"===e.status?(t.dirty(),f(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})();{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?m:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new Ce({in:e,out:t,typeName:Ie.ZodPipeline})}}class $e extends Z{_parse(e){const t=this._def.innerType._parse(e),a=e=>(v(e)&&(e.value=Object.freeze(e.value)),e);return k(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}}var Ie;$e.create=(e,t)=>new $e({innerType:e,typeName:Ie.ZodReadonly,...w(t)}),function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"}(Ie||(Ie={}));const Ee=q.create,Me=H.create,Re=X.create,Le=se.create,ze=oe.create,Fe=ue.create,Ye=ce.create,De=he.create,Ue=ye.create,Ve=ke.create,Be=xe.create,Ke=Te.create},64146:(e,t,a)=>{a.d(t,{Ik:()=>z});const n=Symbol("Let zodToJsonSchema decide on which parser to use"),s={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"};var r=a(5281);const i=(e,t)=>{let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];a++);return[(e.length-a).toString(),...t.slice(a)].join("/")};function o(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?i(t,e.currentPath):t.join("/")}}function d(e,t,a,n){n?.errorMessages&&a&&(e.errorMessage={...e.errorMessage,[t]:a})}function u(e,t,a,n,s){e[t]=a,d(e,t,n,s)}function c(e,t){return M(e.type._def,t)}function l(e,t,a){const n=a??t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((a,n)=>l(e,t,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 h(e,t)}}const h=(e,t)=>{const a={type:"integer",format:"unix-time"};if("openApi3"===t.target)return a;for(const n of e.checks)switch(n.kind){case"min":u(a,"minimum",n.value,n.message,t);break;case"max":u(a,"maximum",n.value,n.message,t)}return a};let p;const m=/^[cC][^\s-]{8,}$/,f=/^[0-9a-z]+$/,y=/^[0-9A-HJKMNP-TV-Z]{26}$/,g=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,_=()=>(void 0===p&&(p=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),p),v=/^(?:(?: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])$/,k=/^(([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])$/,b=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,w=/^[a-zA-Z0-9_-]{21}$/,Z=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function A(e,t){const a={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":u(a,"minLength","number"===typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,t);break;case"max":u(a,"maxLength","number"===typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,t);break;case"email":switch(t.emailStrategy){case"format:email":S(a,"email",n.message,t);break;case"format:idn-email":S(a,"idn-email",n.message,t);break;case"pattern:zod":P(a,g,n.message,t)}break;case"url":S(a,"uri",n.message,t);break;case"uuid":S(a,"uuid",n.message,t);break;case"regex":P(a,n.regex,n.message,t);break;case"cuid":P(a,m,n.message,t);break;case"cuid2":P(a,f,n.message,t);break;case"startsWith":P(a,RegExp(`^${T(n.value,t)}`),n.message,t);break;case"endsWith":P(a,RegExp(`${T(n.value,t)}$`),n.message,t);break;case"datetime":S(a,"date-time",n.message,t);break;case"date":S(a,"date",n.message,t);break;case"time":S(a,"time",n.message,t);break;case"duration":S(a,"duration",n.message,t);break;case"length":u(a,"minLength","number"===typeof a.minLength?Math.max(a.minLength,n.value):n.value,n.message,t),u(a,"maxLength","number"===typeof a.maxLength?Math.min(a.maxLength,n.value):n.value,n.message,t);break;case"includes":P(a,RegExp(T(n.value,t)),n.message,t);break;case"ip":"v6"!==n.version&&S(a,"ipv4",n.message,t),"v4"!==n.version&&S(a,"ipv6",n.message,t);break;case"base64url":P(a,x,n.message,t);break;case"jwt":P(a,Z,n.message,t);break;case"cidr":"v6"!==n.version&&P(a,v,n.message,t),"v4"!==n.version&&P(a,k,n.message,t);break;case"emoji":P(a,_(),n.message,t);break;case"ulid":P(a,y,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":S(a,"binary",n.message,t);break;case"contentEncoding:base64":u(a,"contentEncoding","base64",n.message,t);break;case"pattern:zod":P(a,b,n.message,t)}break;case"nanoid":P(a,w,n.message,t);case"toLowerCase":case"toUpperCase":case"trim":break;default:(()=>{})()}return a}function T(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let a=0;a<e.length;a++)O.has(e[a])||(t+="\\"),t+=e[a];return t}(e):e}const O=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function S(e,t,a,n){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&n.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...a&&n.errorMessages&&{errorMessage:{format:a}}})):u(e,"format",t,a,n)}function P(e,t,a,n){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&n.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:N(t,n),...a&&n.errorMessages&&{errorMessage:{pattern:a}}})):u(e,"pattern",N(t,n),a,n)}function N(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),n=e.flags.includes("m"),s=e.flags.includes("s"),r=a?e.source.toLowerCase():e.source;let i="",o=!1,d=!1,u=!1;for(let c=0;c<r.length;c++)if(o)i+=r[c],o=!1;else{if(a)if(d){if(r[c].match(/[a-z]/)){u?(i+=r[c],i+=`${r[c-2]}-${r[c]}`.toUpperCase(),u=!1):"-"===r[c+1]&&r[c+2]?.match(/[a-z]/)?(i+=r[c],u=!0):i+=`${r[c]}${r[c].toUpperCase()}`;continue}}else if(r[c].match(/[a-z]/)){i+=`[${r[c]}${r[c].toUpperCase()}]`;continue}if(n){if("^"===r[c]){i+="(^|(?<=[\r\n]))";continue}if("$"===r[c]){i+="($|(?=[\r\n]))";continue}}s&&"."===r[c]?i+=d?`${r[c]}\r\n`:`[${r[c]}\r\n]`:(i+=r[c],"\\"===r[c]?o=!0:d&&"]"===r[c]?d=!1:d||"["!==r[c]||(d=!0))}try{new RegExp(i)}catch{return e.source}return i}function j(e,t){if("openApi3"===t.target&&e.keyType?._def.typeName===r.kY.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((a,n)=>({...a,[n]:M(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",n]})??o(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const a={type:"object",additionalProperties:M(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return a;if(e.keyType?._def.typeName===r.kY.ZodString&&e.keyType._def.checks?.length){const{type:n,...s}=A(e.keyType._def,t);return{...a,propertyNames:s}}if(e.keyType?._def.typeName===r.kY.ZodEnum)return{...a,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===r.kY.ZodBranded&&e.keyType._def.type._def.typeName===r.kY.ZodString&&e.keyType._def.type._def.checks?.length){const{type:n,...s}=c(e.keyType._def,t);return{...a,propertyNames:s}}return a}const C={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},$=(e,t)=>{const a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,a)=>M(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(e=>!!e&&(!t.strictUnions||"object"===typeof e&&Object.keys(e).length>0));return a.length?{anyOf:a}:void 0};function I(e){try{return e.isOptional()}catch{return!0}}const E=(e,t,a)=>{switch(t){case r.kY.ZodString:return A(e,a);case r.kY.ZodNumber:return function(e,t){const a={type:"number"};if(!e.checks)return a;for(const n of e.checks)switch(n.kind){case"int":a.type="integer",d(a,"type",n.message,t);break;case"min":"jsonSchema7"===t.target?u(a,n.inclusive?"minimum":"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(a.exclusiveMinimum=!0),u(a,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?u(a,n.inclusive?"maximum":"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(a.exclusiveMaximum=!0),u(a,"maximum",n.value,n.message,t));break;case"multipleOf":u(a,"multipleOf",n.value,n.message,t)}return a}(e,a);case r.kY.ZodObject:return function(e,t){const a="openAi"===t.target,n={type:"object",properties:{}},s=[],r=e.shape();for(const o in r){let e=r[o];if(void 0===e||void 0===e._def)continue;let i=I(e);i&&a&&("ZodOptional"===e._def.typeName&&(e=e._def.innerType),e.isNullable()||(e=e.nullable()),i=!1);const d=M(e._def,{...t,currentPath:[...t.currentPath,"properties",o],propertyPath:[...t.currentPath,"properties",o]});void 0!==d&&(n.properties[o]=d,i||s.push(o))}s.length&&(n.required=s);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return M(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==i&&(n.additionalProperties=i),n}(e,a);case r.kY.ZodBigInt:return function(e,t){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const n of e.checks)switch(n.kind){case"min":"jsonSchema7"===t.target?u(a,n.inclusive?"minimum":"exclusiveMinimum",n.value,n.message,t):(n.inclusive||(a.exclusiveMinimum=!0),u(a,"minimum",n.value,n.message,t));break;case"max":"jsonSchema7"===t.target?u(a,n.inclusive?"maximum":"exclusiveMaximum",n.value,n.message,t):(n.inclusive||(a.exclusiveMaximum=!0),u(a,"maximum",n.value,n.message,t));break;case"multipleOf":u(a,"multipleOf",n.value,n.message,t)}return a}(e,a);case r.kY.ZodBoolean:return{type:"boolean"};case r.kY.ZodDate:return l(e,a);case r.kY.ZodUndefined:return function(e){return{not:o(e)}}(a);case r.kY.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(a);case r.kY.ZodArray:return function(e,t){const a={type:"array"};return e.type?._def&&e.type?._def?.typeName!==r.kY.ZodAny&&(a.items=M(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&u(a,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&u(a,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(u(a,"minItems",e.exactLength.value,e.exactLength.message,t),u(a,"maxItems",e.exactLength.value,e.exactLength.message,t)),a}(e,a);case r.kY.ZodUnion:case r.kY.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return $(e,t);const a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(e=>e._def.typeName in C&&(!e._def.checks||!e._def.checks.length))){const e=a.reduce((e,t)=>{const a=C[t._def.typeName];return a&&!e.includes(a)?[...e,a]:e},[]);return{type:e.length>1?e:e[0]}}if(a.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=a.reduce((e,t)=>{const a=typeof t._def.value;switch(a){case"string":case"number":case"boolean":return[...e,a];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===a.length){const t=e.filter((e,t,a)=>a.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:a.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(a.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:a.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return $(e,t)}(e,a);case r.kY.ZodIntersection:return function(e,t){const a=[M(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),M(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let n="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const s=[];return a.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:a,...n}=e;t=n}else n=void 0;s.push(t)}else s.push(...e.allOf),void 0===e.unevaluatedProperties&&(n=void 0);var t}),s.length?{allOf:s,...n}:void 0}(e,a);case r.kY.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,a)=>M(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:M(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,a)=>M(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,a);case r.kY.ZodRecord:return j(e,a);case r.kY.ZodLiteral:return function(e,t){const a=typeof e.value;return"bigint"!==a&&"number"!==a&&"boolean"!==a&&"string"!==a?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===a?"integer":a,enum:[e.value]}:{type:"bigint"===a?"integer":a,const:e.value}}(e,a);case r.kY.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case r.kY.ZodNativeEnum:return function(e){const t=e.values,a=Object.keys(e.values).filter(e=>"number"!==typeof t[t[e]]).map(e=>t[e]),n=Array.from(new Set(a.map(e=>typeof e)));return{type:1===n.length?"string"===n[0]?"string":"number":["string","number"],enum:a}}(e);case r.kY.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:C[e.innerType._def.typeName],nullable:!0}:{type:[C[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const a=M(e.innerType._def,{...t,currentPath:[...t.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}const a=M(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}(e,a);case r.kY.ZodOptional:return((e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return M(e.innerType._def,t);const a=M(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:o(t)},a]}:o(t)})(e,a);case r.kY.ZodMap:return function(e,t){return"record"===t.mapStrategy?j(e,t):{type:"array",maxItems:125,items:{type:"array",items:[M(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||o(t),M(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||o(t)],minItems:2,maxItems:2}}}(e,a);case r.kY.ZodSet:return function(e,t){const a={type:"array",uniqueItems:!0,items:M(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&u(a,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&u(a,"maxItems",e.maxSize.value,e.maxSize.message,t),a}(e,a);case r.kY.ZodLazy:return()=>e.getter()._def;case r.kY.ZodPromise:return function(e,t){return M(e.type._def,t)}(e,a);case r.kY.ZodNaN:case r.kY.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:o({...e,currentPath:[...e.currentPath,"not"]})}}(a);case r.kY.ZodEffects:return function(e,t){return"input"===t.effectStrategy?M(e.schema._def,t):o(t)}(e,a);case r.kY.ZodAny:return o(a);case r.kY.ZodUnknown:return function(e){return o(e)}(a);case r.kY.ZodDefault:return function(e,t){return{...M(e.innerType._def,t),default:e.defaultValue()}}(e,a);case r.kY.ZodBranded:return c(e,a);case r.kY.ZodReadonly:case r.kY.ZodCatch:return((e,t)=>M(e.innerType._def,t))(e,a);case r.kY.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return M(e.in._def,t);if("output"===t.pipeStrategy)return M(e.out._def,t);const a=M(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[a,M(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]})].filter(e=>void 0!==e)}})(e,a);default:return}};function M(e,t,a=!1){const s=t.seen.get(e);if(t.override){const r=t.override?.(e,t,s,a);if(r!==n)return r}if(s&&!a){const e=R(s,t);if(void 0!==e)return e}const r={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,r);const i=E(e,e.typeName,t),o="function"===typeof i?M(i(),t):i;if(o&&L(e,t,o),t.postProcess){const a=t.postProcess(o,e,t);return r.jsonSchema=o,a}return r.jsonSchema=o,o}const R=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:i(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,a)=>t.currentPath[a]===e)||"seen"===t.$refStrategy?o(t):void 0}},L=(e,t,a)=>(e.description&&(a.description=e.description,t.markdownDescription&&(a.markdownDescription=e.description)),a),z=(e,t)=>{const a=(e=>{const t=(e=>"string"===typeof e?{...s,name:e}:{...s,...e})(e),a=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}})(t);let n="object"===typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>({...e,[t]:M(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0)??o(a)}),{}):void 0;const r="string"===typeof t?t:"title"===t?.nameStrategy?void 0:t?.name,i=M(e._def,void 0===r?a:{...a,currentPath:[...a.basePath,a.definitionPath,r]},!1)??o(a),d="object"===typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==d&&(i.title=d),a.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[a.openAiAnyTypeName]||(n[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===a.$refStrategy?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const u=void 0===r?n?{...i,[a.definitionPath]:n}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,r].join("/"),[a.definitionPath]:{...n,[r]:i}};return"jsonSchema7"===a.target?u.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==a.target&&"openAi"!==a.target||(u.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===a.target&&("anyOf"in u||"oneOf"in u||"allOf"in u||"type"in u&&Array.isArray(u.type)),u}}}]);