@walkeros/server-destination-aws 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.create;var e,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,n=(Object.getPrototypeOf,Object.prototype.hasOwnProperty),s=(e,a)=>{for(var r in a)t(e,r,{get:a[r],enumerable:!0})},i=(e,s,i,o)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let d of r(s))n.call(e,d)||d===i||t(e,d,{get:()=>s[d],enumerable:!(o=a(s,d))||o.enumerable});return e},o={};s(o,{DestinationFirehose:()=>Ra,destinationFirehose:()=>za,examples:()=>Da}),module.exports=(e=o,i(t({},"__esModule",{value:!0}),e));var d,c,u,l={};s(l,{BRAND:()=>Ke,DIRTY:()=>S,EMPTY_PATH:()=>x,INVALID:()=>O,NEVER:()=>Lt,OK:()=>P,ParseStatus:()=>T,Schema:()=>F,ZodAny:()=>ge,ZodArray:()=>be,ZodBigInt:()=>ue,ZodBoolean:()=>le,ZodBranded:()=>We,ZodCatch:()=>Ue,ZodDate:()=>pe,ZodDefault:()=>Ve,ZodDiscriminatedUnion:()=>Ae,ZodEffects:()=>Le,ZodEnum:()=>Re,ZodError:()=>g,ZodFirstPartyTypeKind:()=>Ge,ZodFunction:()=>Ce,ZodIntersection:()=>Oe,ZodIssueCode:()=>m,ZodLazy:()=>$e,ZodLiteral:()=>Ie,ZodMap:()=>Ne,ZodNaN:()=>Be,ZodNativeEnum:()=>Me,ZodNever:()=>ve,ZodNull:()=>fe,ZodNullable:()=>De,ZodNumber:()=>ce,ZodObject:()=>xe,ZodOptional:()=>ze,ZodParsedType:()=>p,ZodPipeline:()=>qe,ZodPromise:()=>Fe,ZodReadonly:()=>Je,ZodRecord:()=>Pe,ZodSchema:()=>F,ZodSet:()=>je,ZodString:()=>oe,ZodSymbol:()=>he,ZodTransformer:()=>Le,ZodTuple:()=>Se,ZodType:()=>F,ZodUndefined:()=>me,ZodUnion:()=>Ze,ZodUnknown:()=>ye,ZodVoid:()=>_e,addIssueToContext:()=>Z,any:()=>ut,array:()=>mt,bigint:()=>nt,boolean:()=>st,coerce:()=>Ft,custom:()=>Ye,date:()=>it,datetimeRegex:()=>re,defaultErrorMap:()=>y,discriminatedUnion:()=>vt,effect:()=>Nt,enum:()=>Ot,function:()=>wt,getErrorMap:()=>b,getParsedType:()=>h,instanceof:()=>et,intersection:()=>_t,isAborted:()=>N,isAsync:()=>$,isDirty:()=>j,isValid:()=>C,late:()=>Qe,lazy:()=>At,literal:()=>Tt,makeIssue:()=>k,map:()=>xt,nan:()=>rt,nativeEnum:()=>St,never:()=>pt,null:()=>ct,nullable:()=>Ct,number:()=>at,object:()=>ft,objectUtil:()=>u,oboolean:()=>Mt,onumber:()=>Rt,optional:()=>jt,ostring:()=>Et,pipeline:()=>It,preprocess:()=>$t,promise:()=>Pt,quotelessJson:()=>f,record:()=>kt,set:()=>Zt,setErrorMap:()=>_,strictObject:()=>gt,string:()=>tt,symbol:()=>ot,transformer:()=>Nt,tuple:()=>bt,undefined:()=>dt,union:()=>yt,unknown:()=>lt,util:()=>d,void:()=>ht}),(c=d||(d={})).assertEqual=e=>{},c.assertIs=function(e){},c.assertNever=function(e){throw new Error},c.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},c.getValidEnumValues=e=>{const t=c.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),a={};for(const r of t)a[r]=e[r];return c.objectValues(a)},c.objectValues=e=>c.objectKeys(e).map(function(t){return e[t]}),c.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},c.find=(e,t)=>{for(const a of e)if(t(a))return a},c.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,c.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},c.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(u||(u={})).mergeShapes=(e,t)=>({...e,...t});var p=d.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),h=e=>{switch(typeof e){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(e)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(e)?p.array:null===e?p.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?p.promise:"undefined"!=typeof Map&&e instanceof Map?p.map:"undefined"!=typeof Set&&e instanceof Set?p.set:"undefined"!=typeof Date&&e instanceof Date?p.date:p.object;default:return p.unknown}},m=d.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"]),f=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),g=class e 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:[]},r=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(r);else if("invalid_return_type"===n.code)r(n.returnTypeError);else if("invalid_arguments"===n.code)r(n.argumentsError);else if(0===n.path.length)a._errors.push(t(n));else{let e=a,r=0;for(;r<n.path.length;){const a=n.path[r];r===n.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(n))):e[a]=e[a]||{_errors:[]},e=e[a],r++}}};return r(this),a}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,d.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const r of this.issues)if(r.path.length>0){const a=r.path[0];t[a]=t[a]||[],t[a].push(e(r))}else a.push(e(r));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};g.create=e=>new g(e);var y=(e,t)=>{let a;switch(e.code){case m.invalid_type:a=e.received===p.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case m.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,d.jsonStringifyReplacer)}`;break;case m.unrecognized_keys:a=`Unrecognized key(s) in object: ${d.joinValues(e.keys,", ")}`;break;case m.invalid_union:a="Invalid input";break;case m.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${d.joinValues(e.options)}`;break;case m.invalid_enum_value:a=`Invalid enum value. Expected ${d.joinValues(e.options)}, received '${e.received}'`;break;case m.invalid_arguments:a="Invalid function arguments";break;case m.invalid_return_type:a="Invalid function return type";break;case m.invalid_date:a="Invalid date";break;case m.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}"`:d.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case m.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 m.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 m.custom:a="Invalid input";break;case m.invalid_intersection_types:a="Intersection results could not be merged";break;case m.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case m.not_finite:a="Number must be finite";break;default:a=t.defaultError,d.assertNever(e)}return{message:a}},v=y;function _(e){v=e}function b(){return v}var k=e=>{const{data:t,path:a,errorMaps:r,issueData:n}=e,s=[...a,...n.path||[]],i={...n,path:s};if(void 0!==n.message)return{...n,path:s,message:n.message};let o="";const d=r.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:s,message:o}},x=[];function Z(e,t){const a=b(),r=k({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===y?void 0:y].filter(e=>!!e)});e.common.issues.push(r)}var w,A,T=class e{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 r of t){if("aborted"===r.status)return O;"dirty"===r.status&&e.dirty(),a.push(r.value)}return{status:e.value,value:a}}static async mergeObjectAsync(t,a){const r=[];for(const e of a){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){const a={};for(const r of t){const{key:t,value:n}=r;if("aborted"===t.status)return O;if("aborted"===n.status)return O;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!r.alwaysSet||(a[t.value]=n.value)}return{status:e.value,value:a}}},O=Object.freeze({status:"aborted"}),S=e=>({status:"dirty",value:e}),P=e=>({status:"valid",value:e}),N=e=>"aborted"===e.status,j=e=>"dirty"===e.status,C=e=>"valid"===e.status,$=e=>"undefined"!=typeof Promise&&e instanceof Promise;(A=w||(w={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},A.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var I=class{constructor(e,t,a,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=r}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}},E=(e,t)=>{if(C(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 g(e.common.issues);return this._error=t,this._error}}};function R(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:r,description:n}=e;if(t&&(a||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:n.defaultError}:void 0===n.data?{message:null!=(s=null!=o?o:r)?s:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!=(i=null!=o?o:a)?i:n.defaultError}},description:n}}var M,F=class{get description(){return this._def.description}_getType(e){return h(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:h(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new T,ctx:{common:e.parent.common,data:e.data,parsedType:h(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if($(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){var a;const r={common:{issues:[],async:null!=(a=null==t?void 0:t.async)&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)},n=this._parseSync({data:e,path:r.path,parent:r});return E(r,n)}"~validate"(e){var t,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return C(t)?{value:t.value}:{issues:r.common.issues}}catch(e){(null==(a=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:a.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>C(e)?{value:e.value}:{issues:r.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:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:h(e)},r=this._parse({data:e,path:a.path,parent:a}),n=await($(r)?r:Promise.resolve(r));return E(a,n)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const n=e(t),s=()=>r.addIssue({code:m.custom,...a(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(s(),!1)):!!n||(s(),!1)})}refinement(e,t){return this._refinement((a,r)=>!!e(a)||(r.addIssue("function"==typeof t?t(a,r):t),!1))}_refinement(e){return new Le({schema:this,typeName:Ge.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 ze.create(this,this._def)}nullable(){return De.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return be.create(this)}promise(){return Fe.create(this,this._def)}or(e){return Ze.create([this,e],this._def)}and(e){return Oe.create(this,e,this._def)}transform(e){return new Le({...R(this._def),schema:this,typeName:Ge.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ve({...R(this._def),innerType:this,defaultValue:t,typeName:Ge.ZodDefault})}brand(){return new We({typeName:Ge.ZodBranded,type:this,...R(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ue({...R(this._def),innerType:this,catchValue:t,typeName:Ge.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return qe.create(this,e)}readonly(){return Je.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},L=/^c[^\s-]{8,}$/i,z=/^[0-9a-z]+$/,D=/^[0-9A-HJKMNP-TV-Z]{26}$/i,V=/^[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,U=/^[a-z0-9_-]{21}$/i,B=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,K=/^[-+]?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)?)??$/,W=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,q=/^(?:(?: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])$/,J=/^(?:(?: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])$/,H=/^(([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]))$/,Y=/^(([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])$/,G=/^([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}(=)?))?$/,Q="((\\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])))",ee=new RegExp(`^${Q}$`);function te(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function ae(e){return new RegExp(`^${te(e)}$`)}function re(e){let t=`${Q}T${te(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 ne(e,t){return!("v4"!==t&&t||!q.test(e))||!("v6"!==t&&t||!H.test(e))}function se(e,t){if(!B.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(r));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===(null==n?void 0:n.typ))&&(!!n.alg&&(!t||n.alg===t)))}catch(e){return!1}}function ie(e,t){return!("v4"!==t&&t||!J.test(e))||!("v6"!==t&&t||!Y.test(e))}var oe=class e extends F{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==p.string){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.string,received:t.parsedType}),O}const t=new T;let a;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(a=this._getOrReturnCtx(e,a),Z(a,{code:m.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(a=this._getOrReturnCtx(e,a),Z(a,{code:m.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const n=e.data.length>r.value,s=e.data.length<r.value;(n||s)&&(a=this._getOrReturnCtx(e,a),n?Z(a,{code:m.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&Z(a,{code:m.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)W.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"email",code:m.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)M||(M=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),M.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"emoji",code:m.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)V.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"uuid",code:m.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)U.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"nanoid",code:m.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)L.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"cuid",code:m.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)z.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"cuid2",code:m.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)D.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"ulid",code:m.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(n){a=this._getOrReturnCtx(e,a),Z(a,{validation:"url",code:m.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"regex",code:m.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(e,a),Z(a,{code:m.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(a=this._getOrReturnCtx(e,a),Z(a,{code:m.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(a=this._getOrReturnCtx(e,a),Z(a,{code:m.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){re(r).test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:m.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){ee.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:m.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){ae(r).test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{code:m.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?K.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"duration",code:m.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?ne(e.data,r.version)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"ip",code:m.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?se(e.data,r.alg)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"jwt",code:m.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?ie(e.data,r.version)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"cidr",code:m.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?G.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"base64",code:m.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?X.test(e.data)||(a=this._getOrReturnCtx(e,a),Z(a,{validation:"base64url",code:m.invalid_string,message:r.message}),t.dirty()):d.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:m.invalid_string,...w.errToObj(a)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...w.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...w.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...w.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...w.errToObj(e)})}datetime(e){var t,a;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(a=null==e?void 0:e.local)&&a,...w.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...w.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...w.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...w.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.errToObj(t)})}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...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 de(e,t){const a=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,n=a>r?a:r;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}oe.create=e=>{var t;return new oe({checks:[],typeName:Ge.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...R(e)})};var ce=class e extends F{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==p.number){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.number,received:t.parsedType}),O}let t;const a=new T;for(const r of this._def.checks)if("int"===r.kind)d.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:m.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:m.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:m.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else"multipleOf"===r.kind?0!==de(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:m.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Z(t,{code:m.not_finite,message:r.message}),a.dirty()):d.assertNever(r);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(t,a,r,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:w.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.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&&d.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)}};ce.create=e=>new ce({checks:[],typeName:Ge.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});var ue=class e extends F{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let t;const a=new T;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:m.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:m.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Z(t,{code:m.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):d.assertNever(r);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.bigint,received:t.parsedType}),O}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(t,a,r,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:w.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.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}};ue.create=e=>{var t;return new ue({checks:[],typeName:Ge.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...R(e)})};var le=class extends F{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==p.boolean){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.boolean,received:t.parsedType}),O}return P(e.data)}};le.create=e=>new le({typeName:Ge.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});var pe=class e extends F{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==p.date){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.date,received:t.parsedType}),O}if(Number.isNaN(e.data.getTime())){return Z(this._getOrReturnCtx(e),{code:m.invalid_date}),O}const t=new T;let a;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(a=this._getOrReturnCtx(e,a),Z(a,{code:m.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(a=this._getOrReturnCtx(e,a),Z(a,{code:m.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):d.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.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}};pe.create=e=>new pe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ge.ZodDate,...R(e)});var he=class extends F{_parse(e){if(this._getType(e)!==p.symbol){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.symbol,received:t.parsedType}),O}return P(e.data)}};he.create=e=>new he({typeName:Ge.ZodSymbol,...R(e)});var me=class extends F{_parse(e){if(this._getType(e)!==p.undefined){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.undefined,received:t.parsedType}),O}return P(e.data)}};me.create=e=>new me({typeName:Ge.ZodUndefined,...R(e)});var fe=class extends F{_parse(e){if(this._getType(e)!==p.null){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.null,received:t.parsedType}),O}return P(e.data)}};fe.create=e=>new fe({typeName:Ge.ZodNull,...R(e)});var ge=class extends F{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}};ge.create=e=>new ge({typeName:Ge.ZodAny,...R(e)});var ye=class extends F{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}};ye.create=e=>new ye({typeName:Ge.ZodUnknown,...R(e)});var ve=class extends F{_parse(e){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.never,received:t.parsedType}),O}};ve.create=e=>new ve({typeName:Ge.ZodNever,...R(e)});var _e=class extends F{_parse(e){if(this._getType(e)!==p.undefined){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.void,received:t.parsedType}),O}return P(e.data)}};_e.create=e=>new _e({typeName:Ge.ZodVoid,...R(e)});var be=class e extends F{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),r=this._def;if(t.parsedType!==p.array)return Z(t,{code:m.invalid_type,expected:p.array,received:t.parsedType}),O;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,n=t.data.length<r.exactLength.value;(e||n)&&(Z(t,{code:e?m.too_big:m.too_small,minimum:n?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Z(t,{code:m.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Z(t,{code:m.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>r.type._parseAsync(new I(t,e,t.path,a)))).then(e=>T.mergeArray(a,e));const n=[...t.data].map((e,a)=>r.type._parseSync(new I(t,e,t.path,a)));return T.mergeArray(a,n)}get element(){return this._def.type}min(t,a){return new e({...this._def,minLength:{value:t,message:w.toString(a)}})}max(t,a){return new e({...this._def,maxLength:{value:t,message:w.toString(a)}})}length(t,a){return new e({...this._def,exactLength:{value:t,message:w.toString(a)}})}nonempty(e){return this.min(1,e)}};function ke(e){if(e instanceof xe){const t={};for(const a in e.shape){const r=e.shape[a];t[a]=ze.create(ke(r))}return new xe({...e._def,shape:()=>t})}return e instanceof be?new be({...e._def,type:ke(e.element)}):e instanceof ze?ze.create(ke(e.unwrap())):e instanceof De?De.create(ke(e.unwrap())):e instanceof Se?Se.create(e.items.map(e=>ke(e))):e}be.create=(e,t)=>new be({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ge.ZodArray,...R(t)});var xe=class e extends F{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=d.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==p.object){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.object,received:t.parsedType}),O}const{status:t,ctx:a}=this._processInputParams(e),{shape:r,keys:n}=this._getCached(),s=[];if(!(this._def.catchall instanceof ve&&"strip"===this._def.unknownKeys))for(const e in a.data)n.includes(e)||s.push(e);const i=[];for(const e of n){const t=r[e],n=a.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new I(a,n,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof ve){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:a.data[e]}});else if("strict"===e)s.length>0&&(Z(a,{code:m.unrecognized_keys,keys:s}),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 s){const r=a.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new I(a,r,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const a=await t.key,r=await t.value;e.push({key:a,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>T.mergeObjectSync(t,e)):T.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return w.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,a)=>{var r,n,s,i;const o=null!=(s=null==(n=(r=this._def).errorMap)?void 0:n.call(r,e,a).message)?s:a.defaultError;return"unrecognized_keys"===e.code?{message:null!=(i=w.errToObj(t).message)?i:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ge.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const a={};for(const e of d.objectKeys(t))t[e]&&this.shape[e]&&(a[e]=this.shape[e]);return new e({...this._def,shape:()=>a})}omit(t){const a={};for(const e of d.objectKeys(this.shape))t[e]||(a[e]=this.shape[e]);return new e({...this._def,shape:()=>a})}deepPartial(){return ke(this)}partial(t){const a={};for(const e of d.objectKeys(this.shape)){const r=this.shape[e];t&&!t[e]?a[e]=r:a[e]=r.optional()}return new e({...this._def,shape:()=>a})}required(t){const a={};for(const e of d.objectKeys(this.shape))if(t&&!t[e])a[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ze;)t=t._def.innerType;a[e]=t}return new e({...this._def,shape:()=>a})}keyof(){return Ee(d.objectKeys(this.shape))}};xe.create=(e,t)=>new xe({shape:()=>e,unknownKeys:"strip",catchall:ve.create(),typeName:Ge.ZodObject,...R(t)}),xe.strictCreate=(e,t)=>new xe({shape:()=>e,unknownKeys:"strict",catchall:ve.create(),typeName:Ge.ZodObject,...R(t)}),xe.lazycreate=(e,t)=>new xe({shape:e,unknownKeys:"strip",catchall:ve.create(),typeName:Ge.ZodObject,...R(t)});var Ze=class extends F{_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 a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new g(e.ctx.common.issues));return Z(t,{code:m.invalid_union,unionErrors:a}),O});{let e;const r=[];for(const n of a){const a={...t,common:{...t.common,issues:[]},parent:null},s=n._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&&r.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=r.map(e=>new g(e));return Z(t,{code:m.invalid_union,unionErrors:n}),O}}get options(){return this._def.options}};Ze.create=(e,t)=>new Ze({options:e,typeName:Ge.ZodUnion,...R(t)});var we=e=>e instanceof $e?we(e.schema):e instanceof Le?we(e.innerType()):e instanceof Ie?[e.value]:e instanceof Re?e.options:e instanceof Me?d.objectValues(e.enum):e instanceof Ve?we(e._def.innerType):e instanceof me?[void 0]:e instanceof fe?[null]:e instanceof ze?[void 0,...we(e.unwrap())]:e instanceof De?[null,...we(e.unwrap())]:e instanceof We||e instanceof Je?we(e.unwrap()):e instanceof Ue?we(e._def.innerType):[],Ae=class e extends F{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return Z(t,{code:m.invalid_type,expected:p.object,received:t.parsedType}),O;const a=this.discriminator,r=t.data[a],n=this.optionsMap.get(r);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}):(Z(t,{code:m.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),O)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,a,r){const n=new Map;for(const e of a){const a=we(e.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const r of a){if(n.has(r))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);n.set(r,e)}}return new e({typeName:Ge.ZodDiscriminatedUnion,discriminator:t,options:a,optionsMap:n,...R(r)})}};function Te(e,t){const a=h(e),r=h(t);if(e===t)return{valid:!0,data:e};if(a===p.object&&r===p.object){const a=d.objectKeys(t),r=d.objectKeys(e).filter(e=>-1!==a.indexOf(e)),n={...e,...t};for(const a of r){const r=Te(e[a],t[a]);if(!r.valid)return{valid:!1};n[a]=r.data}return{valid:!0,data:n}}if(a===p.array&&r===p.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let r=0;r<e.length;r++){const n=Te(e[r],t[r]);if(!n.valid)return{valid:!1};a.push(n.data)}return{valid:!0,data:a}}return a===p.date&&r===p.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Oe=class extends F{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=(e,r)=>{if(N(e)||N(r))return O;const n=Te(e.value,r.value);return n.valid?((j(e)||j(r))&&t.dirty(),{status:t.value,value:n.data}):(Z(a,{code:m.invalid_intersection_types}),O)};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])=>r(e,t)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Oe.create=(e,t,a)=>new Oe({left:e,right:t,typeName:Ge.ZodIntersection,...R(a)});var Se=class e extends F{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==p.array)return Z(a,{code:m.invalid_type,expected:p.array,received:a.parsedType}),O;if(a.data.length<this._def.items.length)return Z(a,{code:m.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),O;!this._def.rest&&a.data.length>this._def.items.length&&(Z(a,{code:m.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...a.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new I(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(r).then(e=>T.mergeArray(t,e)):T.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Se.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se({items:e,typeName:Ge.ZodTuple,rest:null,...R(t)})};var Pe=class e extends F{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!==p.object)return Z(a,{code:m.invalid_type,expected:p.object,received:a.parsedType}),O;const r=[],n=this._def.keyType,s=this._def.valueType;for(const e in a.data)r.push({key:n._parse(new I(a,e,a.path,e)),value:s._parse(new I(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?T.mergeObjectAsync(t,r):T.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,a,r){return new e(a instanceof F?{keyType:t,valueType:a,typeName:Ge.ZodRecord,...R(r)}:{keyType:oe.create(),valueType:t,typeName:Ge.ZodRecord,...R(a)})}},Ne=class extends F{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!==p.map)return Z(a,{code:m.invalid_type,expected:p.map,received:a.parsedType}),O;const r=this._def.keyType,n=this._def.valueType,s=[...a.data.entries()].map(([e,t],s)=>({key:r._parse(new I(a,e,a.path,[s,"key"])),value:n._parse(new I(a,t,a.path,[s,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of s){const r=await a.key,n=await a.value;if("aborted"===r.status||"aborted"===n.status)return O;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of s){const r=a.key,n=a.value;if("aborted"===r.status||"aborted"===n.status)return O;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}}}};Ne.create=(e,t,a)=>new Ne({valueType:t,keyType:e,typeName:Ge.ZodMap,...R(a)});var je=class e extends F{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==p.set)return Z(a,{code:m.invalid_type,expected:p.set,received:a.parsedType}),O;const r=this._def;null!==r.minSize&&a.data.size<r.minSize.value&&(Z(a,{code:m.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&a.data.size>r.maxSize.value&&(Z(a,{code:m.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const n=this._def.valueType;function s(e){const a=new Set;for(const r of e){if("aborted"===r.status)return O;"dirty"===r.status&&t.dirty(),a.add(r.value)}return{status:t.value,value:a}}const i=[...a.data.values()].map((e,t)=>n._parse(new I(a,e,a.path,t)));return a.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(t,a){return new e({...this._def,minSize:{value:t,message:w.toString(a)}})}max(t,a){return new e({...this._def,maxSize:{value:t,message:w.toString(a)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};je.create=(e,t)=>new je({valueType:e,minSize:null,maxSize:null,typeName:Ge.ZodSet,...R(t)});var Ce=class e extends F{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return Z(t,{code:m.invalid_type,expected:p.function,received:t.parsedType}),O;function a(e,a){return k({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,b(),y].filter(e=>!!e),issueData:{code:m.invalid_arguments,argumentsError:a}})}function r(e,a){return k({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,b(),y].filter(e=>!!e),issueData:{code:m.invalid_return_type,returnTypeError:a}})}const n={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Fe){const e=this;return P(async function(...t){const i=new g([]),o=await e._def.args.parseAsync(t,n).catch(e=>{throw i.addIssue(a(t,e)),i}),d=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(d,n).catch(e=>{throw i.addIssue(r(d,e)),i})})}{const e=this;return P(function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new g([a(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,n);if(!d.success)throw new g([r(o,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Se.create(t).rest(ye.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,a,r){return new e({args:t||Se.create([]).rest(ye.create()),returns:a||ye.create(),typeName:Ge.ZodFunction,...R(r)})}},$e=class extends F{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})}};$e.create=(e,t)=>new $e({getter:e,typeName:Ge.ZodLazy,...R(t)});var Ie=class extends F{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Z(t,{received:t.data,code:m.invalid_literal,expected:this._def.value}),O}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Ee(e,t){return new Re({values:e,typeName:Ge.ZodEnum,...R(t)})}Ie.create=(e,t)=>new Ie({value:e,typeName:Ge.ZodLiteral,...R(t)});var Re=class e extends F{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return Z(t,{expected:d.joinValues(a),received:t.parsedType,code:m.invalid_type}),O}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return Z(t,{received:t.data,code:m.invalid_enum_value,options:a}),O}return P(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(t,a=this._def){return e.create(t,{...this._def,...a})}exclude(t,a=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...a})}};Re.create=Ee;var Me=class extends F{_parse(e){const t=d.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==p.string&&a.parsedType!==p.number){const e=d.objectValues(t);return Z(a,{expected:d.joinValues(e),received:a.parsedType,code:m.invalid_type}),O}if(this._cache||(this._cache=new Set(d.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=d.objectValues(t);return Z(a,{received:a.data,code:m.invalid_enum_value,options:e}),O}return P(e.data)}get enum(){return this._def.values}};Me.create=(e,t)=>new Me({values:e,typeName:Ge.ZodNativeEnum,...R(t)});var Fe=class extends F{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&!1===t.common.async)return Z(t,{code:m.invalid_type,expected:p.promise,received:t.parsedType}),O;const a=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return P(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Fe.create=(e,t)=>new Fe({type:e,typeName:Ge.ZodPromise,...R(t)});var Le=class extends F{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ge.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:e=>{Z(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===r.type){const e=r.transform(a.data,n);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return O;const r=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===r.status?O:"dirty"===r.status||"dirty"===t.value?S(r.value):r});{if("aborted"===t.value)return O;const r=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===r.status?O:"dirty"===r.status||"dirty"===t.value?S(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,n);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 r=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===r.status?O:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?O:("dirty"===a.status&&t.dirty(),e(a.value).then(()=>({status:t.value,value:a.value}))))}if("transform"===r.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!C(e))return O;const s=r.transform(e.value,n);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>C(e)?Promise.resolve(r.transform(e.value,n)).then(e=>({status:t.value,value:e})):O)}d.assertNever(r)}};Le.create=(e,t,a)=>new Le({schema:e,typeName:Ge.ZodEffects,effect:t,...R(a)}),Le.createWithPreprocess=(e,t,a)=>new Le({schema:t,effect:{type:"preprocess",transform:e},typeName:Ge.ZodEffects,...R(a)});var ze=class extends F{_parse(e){return this._getType(e)===p.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ze.create=(e,t)=>new ze({innerType:e,typeName:Ge.ZodOptional,...R(t)});var De=class extends F{_parse(e){return this._getType(e)===p.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};De.create=(e,t)=>new De({innerType:e,typeName:Ge.ZodNullable,...R(t)});var Ve=class extends F{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===p.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ve.create=(e,t)=>new Ve({innerType:e,typeName:Ge.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...R(t)});var Ue=class extends F{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return $(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new g(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new g(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Ue.create=(e,t)=>new Ue({innerType:e,typeName:Ge.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...R(t)});var Be=class extends F{_parse(e){if(this._getType(e)!==p.nan){const t=this._getOrReturnCtx(e);return Z(t,{code:m.invalid_type,expected:p.nan,received:t.parsedType}),O}return{status:"valid",value:e.data}}};Be.create=e=>new Be({typeName:Ge.ZodNaN,...R(e)});var Ke=Symbol("zod_brand"),We=class extends F{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},qe=class e extends F{_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?O:"dirty"===e.status?(t.dirty(),S(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?O:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(t,a){return new e({in:t,out:a,typeName:Ge.ZodPipeline})}},Je=class extends F{_parse(e){const t=this._def.innerType._parse(e),a=e=>(C(e)&&(e.value=Object.freeze(e.value)),e);return $(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}};function He(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function Ye(e,t={},a){return e?ge.create().superRefine((r,n)=>{var s,i;const o=e(r);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=He(t,r),o=null==(i=null!=(s=e.fatal)?s:a)||i;n.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=He(t,r),o=null==(i=null!=(s=e.fatal)?s:a)||i;n.addIssue({code:"custom",...e,fatal:o})}}):ge.create()}Je.create=(e,t)=>new Je({innerType:e,typeName:Ge.ZodReadonly,...R(t)});var Ge,Xe,Qe={object:xe.lazycreate};(Xe=Ge||(Ge={})).ZodString="ZodString",Xe.ZodNumber="ZodNumber",Xe.ZodNaN="ZodNaN",Xe.ZodBigInt="ZodBigInt",Xe.ZodBoolean="ZodBoolean",Xe.ZodDate="ZodDate",Xe.ZodSymbol="ZodSymbol",Xe.ZodUndefined="ZodUndefined",Xe.ZodNull="ZodNull",Xe.ZodAny="ZodAny",Xe.ZodUnknown="ZodUnknown",Xe.ZodNever="ZodNever",Xe.ZodVoid="ZodVoid",Xe.ZodArray="ZodArray",Xe.ZodObject="ZodObject",Xe.ZodUnion="ZodUnion",Xe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Xe.ZodIntersection="ZodIntersection",Xe.ZodTuple="ZodTuple",Xe.ZodRecord="ZodRecord",Xe.ZodMap="ZodMap",Xe.ZodSet="ZodSet",Xe.ZodFunction="ZodFunction",Xe.ZodLazy="ZodLazy",Xe.ZodLiteral="ZodLiteral",Xe.ZodEnum="ZodEnum",Xe.ZodEffects="ZodEffects",Xe.ZodNativeEnum="ZodNativeEnum",Xe.ZodOptional="ZodOptional",Xe.ZodNullable="ZodNullable",Xe.ZodDefault="ZodDefault",Xe.ZodCatch="ZodCatch",Xe.ZodPromise="ZodPromise",Xe.ZodBranded="ZodBranded",Xe.ZodPipeline="ZodPipeline",Xe.ZodReadonly="ZodReadonly";var et=(e,t={message:`Input not instance of ${e.name}`})=>Ye(t=>t instanceof e,t),tt=oe.create,at=ce.create,rt=Be.create,nt=ue.create,st=le.create,it=pe.create,ot=he.create,dt=me.create,ct=fe.create,ut=ge.create,lt=ye.create,pt=ve.create,ht=_e.create,mt=be.create,ft=xe.create,gt=xe.strictCreate,yt=Ze.create,vt=Ae.create,_t=Oe.create,bt=Se.create,kt=Pe.create,xt=Ne.create,Zt=je.create,wt=Ce.create,At=$e.create,Tt=Ie.create,Ot=Re.create,St=Me.create,Pt=Fe.create,Nt=Le.create,jt=ze.create,Ct=De.create,$t=Le.createWithPreprocess,It=qe.create,Et=()=>tt().optional(),Rt=()=>at().optional(),Mt=()=>st().optional(),Ft={string:e=>oe.create({...e,coerce:!0}),number:e=>ce.create({...e,coerce:!0}),boolean:e=>le.create({...e,coerce:!0}),bigint:e=>ue.create({...e,coerce:!0}),date:e=>pe.create({...e,coerce:!0})},Lt=O,zt=Symbol("Let zodToJsonSchema decide on which parser to use"),Dt={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"},Vt=e=>{const t=(e=>"string"==typeof e?{...Dt,name:e}:{...Dt,...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}]))}};function Ut(e,t,a,r){(null==r?void 0:r.errorMessages)&&a&&(e.errorMessage={...e.errorMessage,[t]:a})}function Bt(e,t,a,r,n){e[t]=a,Ut(e,t,r,n)}var Kt=(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 Wt(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Kt(t,e.currentPath):t.join("/")}}function qt(e,t){return ba(e.type._def,t)}function Jt(e,t,a){const r=null!=a?a:t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((a,r)=>Jt(e,t,a))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Ht(e,t)}}var Ht=(e,t)=>{const a={type:"integer",format:"unix-time"};if("openApi3"===t.target)return a;for(const r of e.checks)switch(r.kind){case"min":Bt(a,"minimum",r.value,r.message,t);break;case"max":Bt(a,"maximum",r.value,r.message,t)}return a};var Yt=void 0,Gt=/^[cC][^\s-]{8,}$/,Xt=/^[0-9a-z]+$/,Qt=/^[0-9A-HJKMNP-TV-Z]{26}$/,ea=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,ta=()=>(void 0===Yt&&(Yt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Yt),aa=/^(?:(?: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])$/,ra=/^(([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])$/,na=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ia=/^[a-zA-Z0-9_-]{21}$/,oa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function da(e,t){const a={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":Bt(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,r.value):r.value,r.message,t);break;case"max":Bt(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":la(a,"email",r.message,t);break;case"format:idn-email":la(a,"idn-email",r.message,t);break;case"pattern:zod":pa(a,ea,r.message,t)}break;case"url":la(a,"uri",r.message,t);break;case"uuid":la(a,"uuid",r.message,t);break;case"regex":pa(a,r.regex,r.message,t);break;case"cuid":pa(a,Gt,r.message,t);break;case"cuid2":pa(a,Xt,r.message,t);break;case"startsWith":pa(a,RegExp(`^${ca(r.value,t)}`),r.message,t);break;case"endsWith":pa(a,RegExp(`${ca(r.value,t)}$`),r.message,t);break;case"datetime":la(a,"date-time",r.message,t);break;case"date":la(a,"date",r.message,t);break;case"time":la(a,"time",r.message,t);break;case"duration":la(a,"duration",r.message,t);break;case"length":Bt(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,r.value):r.value,r.message,t),Bt(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,r.value):r.value,r.message,t);break;case"includes":pa(a,RegExp(ca(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&la(a,"ipv4",r.message,t),"v4"!==r.version&&la(a,"ipv6",r.message,t);break;case"base64url":pa(a,sa,r.message,t);break;case"jwt":pa(a,oa,r.message,t);break;case"cidr":"v6"!==r.version&&pa(a,aa,r.message,t),"v4"!==r.version&&pa(a,ra,r.message,t);break;case"emoji":pa(a,ta(),r.message,t);break;case"ulid":pa(a,Qt,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":la(a,"binary",r.message,t);break;case"contentEncoding:base64":Bt(a,"contentEncoding","base64",r.message,t);break;case"pattern:zod":pa(a,na,r.message,t)}break;case"nanoid":pa(a,ia,r.message,t)}return a}function ca(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let a=0;a<e.length;a++)ua.has(e[a])||(t+="\\"),t+=e[a];return t}(e):e}var ua=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function la(e,t,a,r){var n;e.format||(null==(n=e.anyOf)?void 0:n.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.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&&r.errorMessages&&{errorMessage:{format:a}}})):Bt(e,"format",t,a,r)}function pa(e,t,a,r){var n;e.pattern||(null==(n=e.allOf)?void 0:n.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.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:ha(t,r),...a&&r.errorMessages&&{errorMessage:{pattern:a}}})):Bt(e,"pattern",ha(t,r),a,r)}function ha(e,t){var a;if(!t.applyRegexFlags||!e.flags)return e.source;const r=e.flags.includes("i"),n=e.flags.includes("m"),s=e.flags.includes("s"),i=r?e.source.toLowerCase():e.source;let o="",d=!1,c=!1,u=!1;for(let e=0;e<i.length;e++)if(d)o+=i[e],d=!1;else{if(r)if(c){if(i[e].match(/[a-z]/)){u?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),u=!1):"-"===i[e+1]&&(null==(a=i[e+2])?void 0:a.match(/[a-z]/))?(o+=i[e],u=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(n){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=c?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?d=!0:c&&"]"===i[e]?c=!1:c||"["!==i[e]||(c=!0))}try{new RegExp(o)}catch(a){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function ma(e,t){var a,r,n,s,i,o,d;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(a=e.keyType)?void 0:a._def.typeName)===Ge.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((a,r)=>{var n;return{...a,[r]:null!=(n=ba(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]}))?n:Wt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const c={type:"object",additionalProperties:null!=(r=ba(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if("openApi3"===t.target)return c;if((null==(n=e.keyType)?void 0:n._def.typeName)===Ge.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:a,...r}=da(e.keyType._def,t);return{...c,propertyNames:r}}if((null==(i=e.keyType)?void 0:i._def.typeName)===Ge.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Ge.ZodBranded&&e.keyType._def.type._def.typeName===Ge.ZodString&&(null==(d=e.keyType._def.type._def.checks)?void 0:d.length)){const{type:a,...r}=qt(e.keyType._def,t);return{...c,propertyNames:r}}return c}var fa={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var ga=(e,t)=>{const a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,a)=>ba(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 ya(e,t){const a="openAi"===t.target,r={type:"object",properties:{}},n=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=va(i);o&&a&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const d=ba(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==d&&(r.properties[e]=d,o||n.push(e))}n.length&&(r.required=n);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return ba(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&&(r.additionalProperties=i),r}function va(e){try{return e.isOptional()}catch(e){return!0}}var _a=(e,t,a)=>{switch(t){case Ge.ZodString:return da(e,a);case Ge.ZodNumber:return function(e,t){const a={type:"number"};if(!e.checks)return a;for(const r of e.checks)switch(r.kind){case"int":a.type="integer",Ut(a,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?Bt(a,"minimum",r.value,r.message,t):Bt(a,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(a.exclusiveMinimum=!0),Bt(a,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Bt(a,"maximum",r.value,r.message,t):Bt(a,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(a.exclusiveMaximum=!0),Bt(a,"maximum",r.value,r.message,t));break;case"multipleOf":Bt(a,"multipleOf",r.value,r.message,t)}return a}(e,a);case Ge.ZodObject:return ya(e,a);case Ge.ZodBigInt:return function(e,t){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?Bt(a,"minimum",r.value,r.message,t):Bt(a,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(a.exclusiveMinimum=!0),Bt(a,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Bt(a,"maximum",r.value,r.message,t):Bt(a,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(a.exclusiveMaximum=!0),Bt(a,"maximum",r.value,r.message,t));break;case"multipleOf":Bt(a,"multipleOf",r.value,r.message,t)}return a}(e,a);case Ge.ZodBoolean:return{type:"boolean"};case Ge.ZodDate:return Jt(e,a);case Ge.ZodUndefined:return function(e){return{not:Wt(e)}}(a);case Ge.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(a);case Ge.ZodArray:return function(e,t){var a,r,n;const s={type:"array"};return(null==(a=e.type)?void 0:a._def)&&(null==(n=null==(r=e.type)?void 0:r._def)?void 0:n.typeName)!==Ge.ZodAny&&(s.items=ba(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Bt(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Bt(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Bt(s,"minItems",e.exactLength.value,e.exactLength.message,t),Bt(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,a);case Ge.ZodUnion:case Ge.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return ga(e,t);const a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(e=>e._def.typeName in fa&&(!e._def.checks||!e._def.checks.length))){const e=a.reduce((e,t)=>{const a=fa[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 ga(e,t)}(e,a);case Ge.ZodIntersection:return function(e,t){const a=[ba(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),ba(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const n=[];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,...r}=e;t=r}else r=void 0;n.push(t)}else n.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);var t}),n.length?{allOf:n,...r}:void 0}(e,a);case Ge.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,a)=>ba(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:ba(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,a)=>ba(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,a);case Ge.ZodRecord:return ma(e,a);case Ge.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 Ge.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Ge.ZodNativeEnum:return function(e){const t=e.values,a=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(a.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:a}}(e);case Ge.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:fa[e.innerType._def.typeName],nullable:!0}:{type:[fa[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const a=ba(e.innerType._def,{...t,currentPath:[...t.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}const a=ba(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}(e,a);case Ge.ZodOptional:return((e,t)=>{var a;if(t.currentPath.toString()===(null==(a=t.propertyPath)?void 0:a.toString()))return ba(e.innerType._def,t);const r=ba(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Wt(t)},r]}:Wt(t)})(e,a);case Ge.ZodMap:return function(e,t){return"record"===t.mapStrategy?ma(e,t):{type:"array",maxItems:125,items:{type:"array",items:[ba(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Wt(t),ba(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Wt(t)],minItems:2,maxItems:2}}}(e,a);case Ge.ZodSet:return function(e,t){const a={type:"array",uniqueItems:!0,items:ba(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Bt(a,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Bt(a,"maxItems",e.maxSize.value,e.maxSize.message,t),a}(e,a);case Ge.ZodLazy:return()=>e.getter()._def;case Ge.ZodPromise:return function(e,t){return ba(e.type._def,t)}(e,a);case Ge.ZodNaN:case Ge.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Wt({...e,currentPath:[...e.currentPath,"not"]})}}(a);case Ge.ZodEffects:return function(e,t){return"input"===t.effectStrategy?ba(e.schema._def,t):Wt(t)}(e,a);case Ge.ZodAny:return Wt(a);case Ge.ZodUnknown:return function(e){return Wt(e)}(a);case Ge.ZodDefault:return function(e,t){return{...ba(e.innerType._def,t),default:e.defaultValue()}}(e,a);case Ge.ZodBranded:return qt(e,a);case Ge.ZodReadonly:case Ge.ZodCatch:return((e,t)=>ba(e.innerType._def,t))(e,a);case Ge.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return ba(e.in._def,t);if("output"===t.pipeStrategy)return ba(e.out._def,t);const a=ba(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[a,ba(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]})].filter(e=>void 0!==e)}})(e,a);case Ge.ZodFunction:case Ge.ZodVoid:case Ge.ZodSymbol:default:return}};function ba(e,t,a=!1){var r;const n=t.seen.get(e);if(t.override){const s=null==(r=t.override)?void 0:r.call(t,e,t,n,a);if(s!==zt)return s}if(n&&!a){const e=ka(n,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=_a(e,e.typeName,t),o="function"==typeof i?ba(i(),t):i;if(o&&xa(e,t,o),t.postProcess){const a=t.postProcess(o,e,t);return s.jsonSchema=o,a}return s.jsonSchema=o,o}var ka=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Kt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,a)=>t.currentPath[a]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Wt(t)):"seen"===t.$refStrategy?Wt(t):void 0}},xa=(e,t,a)=>(e.description&&(a.description=e.description,t.markdownDescription&&(a.markdownDescription=e.description)),a),Za=(e,t)=>{var a;const r=Vt(t);let n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,a])=>{var n;return{...e,[t]:null!=(n=ba(a._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0))?n:Wt(r)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(a=ba(e._def,void 0===s?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))?a:Wt(r),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const d=void 0===s?n?{...i,[r.definitionPath]:n}:i:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:i}};return"jsonSchema7"===r.target?d.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(d.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.target&&("anyOf"in d||"oneOf"in d||"allOf"in d||"type"in d&&Array.isArray(d.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),d},wa=l.record(l.string(),l.boolean()).describe("Consent requirement mapping"),Aa=l.lazy(()=>l.union([l.string(),l.number(),l.boolean(),Pa,l.array(Aa)])),Ta=l.tuple([Aa,Aa]).describe("Loop: [source, transform] tuple for array transformations"),Oa=l.array(Aa).describe("Set: Array of values"),Sa=l.record(l.string(),Aa).describe("Map: Object mapping keys to values"),Pa=l.object({key:l.string().optional().describe('Property path (e.g., "data.id")'),value:l.union([l.string(),l.number(),l.boolean()]).optional().describe("Static primitive value"),fn:l.string().optional().describe("Function string for custom transformation"),map:Sa.optional().describe("Object with key-value mappings"),loop:Ta.optional().describe("Tuple [source, transform]"),set:Oa.optional().describe("Array of values"),consent:wa.optional().describe("Required consent states"),condition:l.string().optional().describe("Condition function string"),validate:l.string().optional().describe("Validation function string")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value configuration for transformations"),Na=Ta,ja=Oa,Ca=Sa;Za(Pa,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),Za(Na,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Za(ja,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),Za(Ca,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"});function $a(e){var t;return Boolean(e&&"object"==typeof e&&"AWS"in e&&(null==(t=e.AWS)?void 0:t.FirehoseClient))}function Ia(e,t){const{streamName:a,region:r="eu-central-1",config:n={}}=e;a||function(e){throw new Error(String(e))}("Firehose: Config custom streamName missing"),n.region||(n.region=r);let s=e.client;return!s&&$a(t)&&(s=new t.AWS.FirehoseClient(n)),{streamName:a,client:s,region:r}}var Ea=async function(e,{config:t,collector:a,env:r}){const{firehose:n}=t.settings||{};n&&async function(e,t,a){const{client:r,streamName:n}=t;if(!r)return{queue:e};const s=e.map(({event:e})=>({Data:Buffer.from(JSON.stringify(e))}));if($a(a))await r.send(new a.AWS.PutRecordBatchCommand({DeliveryStreamName:n,Records:s}));else{const{PutRecordBatchCommand:e}=await import("@aws-sdk/client-firehose");await r.send(new e({DeliveryStreamName:n,Records:s}))}}([{event:e}],n,r)},Ra={},Ma={};s(Ma,{env:()=>Fa});var Fa={};s(Fa,{push:()=>La});var La={AWS:{FirehoseClient:class{constructor(e){this.config=e}async send(e){return{RecordId:"mock-record-id",ResponseMetadata:{RequestId:"mock-request-id"}}}},PutRecordBatchCommand:class{constructor(e){this.input=e}}}},za={type:"aws-firehose",config:{},async init({config:e,env:t}){const a=function(e={},t){const a=e.settings||{};return a.firehose&&(a.firehose=Ia(a.firehose,t)),{settings:a}}(e,t);return typeof a.settings==typeof{}&&a},push:async(e,{config:t,collector:a,env:r})=>await Ea(e,{config:t,collector:a,env:r})},Da={};s(Da,{firehose:()=>Ma});//# sourceMappingURL=index.js.map
1
+ "use strict";Object.create;var e,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,r=(Object.getPrototypeOf,Object.prototype.hasOwnProperty),i=(e,n)=>{for(var a in n)t(e,a,{get:n[a],enumerable:!0})},s=(e,i,s,o)=>{if(i&&"object"==typeof i||"function"==typeof i)for(let c of a(i))r.call(e,c)||c===s||t(e,c,{get:()=>i[c],enumerable:!(o=n(i,c))||o.enumerable});return e},o={};i(o,{DestinationFirehose:()=>Er,destinationFirehose:()=>Vr,examples:()=>Jr,schemas:()=>Mr}),module.exports=(e=o,s(t({},"__esModule",{value:!0}),e));var c,d,u,l={};i(l,{BRAND:()=>Je,DIRTY:()=>A,EMPTY_PATH:()=>k,INVALID:()=>P,NEVER:()=>zt,OK:()=>T,ParseStatus:()=>j,Schema:()=>D,ZodAny:()=>ge,ZodArray:()=>_e,ZodBigInt:()=>ue,ZodBoolean:()=>le,ZodBranded:()=>We,ZodCatch:()=>Be,ZodDate:()=>pe,ZodDefault:()=>Ue,ZodDiscriminatedUnion:()=>Ze,ZodEffects:()=>ze,ZodEnum:()=>Re,ZodError:()=>g,ZodFirstPartyTypeKind:()=>Ye,ZodFunction:()=>Ne,ZodIntersection:()=>Pe,ZodIssueCode:()=>h,ZodLazy:()=>Ee,ZodLiteral:()=>$e,ZodMap:()=>Ce,ZodNaN:()=>Ve,ZodNativeEnum:()=>Me,ZodNever:()=>ve,ZodNull:()=>fe,ZodNullable:()=>Fe,ZodNumber:()=>de,ZodObject:()=>ke,ZodOptional:()=>Le,ZodParsedType:()=>p,ZodPipeline:()=>qe,ZodPromise:()=>De,ZodReadonly:()=>Ke,ZodRecord:()=>Te,ZodSchema:()=>D,ZodSet:()=>Oe,ZodString:()=>oe,ZodSymbol:()=>me,ZodTransformer:()=>ze,ZodTuple:()=>Ae,ZodType:()=>D,ZodUndefined:()=>he,ZodUnion:()=>xe,ZodUnknown:()=>ye,ZodVoid:()=>be,addIssueToContext:()=>x,any:()=>ut,array:()=>ht,bigint:()=>rt,boolean:()=>it,coerce:()=>Dt,custom:()=>Ge,date:()=>st,datetimeRegex:()=>ae,defaultErrorMap:()=>y,discriminatedUnion:()=>vt,effect:()=>Ct,enum:()=>Pt,function:()=>wt,getErrorMap:()=>_,getParsedType:()=>m,instanceof:()=>et,intersection:()=>bt,isAborted:()=>C,isAsync:()=>E,isDirty:()=>O,isValid:()=>N,late:()=>Xe,lazy:()=>Zt,literal:()=>jt,makeIssue:()=>S,map:()=>kt,nan:()=>at,nativeEnum:()=>At,never:()=>pt,null:()=>dt,nullable:()=>Nt,number:()=>nt,object:()=>ft,objectUtil:()=>u,oboolean:()=>Mt,onumber:()=>Rt,optional:()=>Ot,ostring:()=>It,pipeline:()=>$t,preprocess:()=>Et,promise:()=>Tt,quotelessJson:()=>f,record:()=>St,set:()=>xt,setErrorMap:()=>b,strictObject:()=>gt,string:()=>tt,symbol:()=>ot,transformer:()=>Ct,tuple:()=>_t,undefined:()=>ct,union:()=>yt,unknown:()=>lt,util:()=>c,void:()=>mt}),(d=c||(c={})).assertEqual=e=>{},d.assertIs=function(e){},d.assertNever=function(e){throw new Error},d.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},d.getValidEnumValues=e=>{const t=d.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return d.objectValues(n)},d.objectValues=e=>d.objectKeys(e).map(function(t){return e[t]}),d.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},d.find=(e,t)=>{for(const n of e)if(t(n))return n},d.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,d.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},d.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(u||(u={})).mergeShapes=(e,t)=>({...e,...t});var p=c.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),m=e=>{switch(typeof e){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(e)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(e)?p.array:null===e?p.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?p.promise:"undefined"!=typeof Map&&e instanceof Map?p.map:"undefined"!=typeof Set&&e instanceof Set?p.set:"undefined"!=typeof Date&&e instanceof Date?p.date:p.object;default:return p.unknown}},h=c.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"]),f=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),g=class e 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},n={_errors:[]},a=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(a);else if("invalid_return_type"===r.code)a(r.returnTypeError);else if("invalid_arguments"===r.code)a(r.argumentsError);else if(0===r.path.length)n._errors.push(t(r));else{let e=n,a=0;for(;a<r.path.length;){const n=r.path[a];a===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,c.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};g.create=e=>new g(e);var y=(e,t)=>{let n;switch(e.code){case h.invalid_type:n=e.received===p.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,c.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:n=`Unrecognized key(s) in object: ${c.joinValues(e.keys,", ")}`;break;case h.invalid_union:n="Invalid input";break;case h.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${c.joinValues(e.options)}`;break;case h.invalid_enum_value:n=`Invalid enum value. Expected ${c.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:n="Invalid function arguments";break;case h.invalid_return_type:n="Invalid function return type";break;case h.invalid_date:n="Invalid date";break;case h.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:c.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case h.too_small:n="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 h.too_big:n="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 h.custom:n="Invalid input";break;case h.invalid_intersection_types:n="Intersection results could not be merged";break;case h.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:n="Number must be finite";break;default:n=t.defaultError,c.assertNever(e)}return{message:n}},v=y;function b(e){v=e}function _(){return v}var S=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,i=[...n,...r.path||[]],s={...r,path:i};if(void 0!==r.message)return{...r,path:i,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(s,{data:t,defaultError:o}).message;return{...r,path:i,message:o}},k=[];function x(e,t){const n=_(),a=S({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===y?void 0:y].filter(e=>!!e)});e.common.issues.push(a)}var w,Z,j=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return P;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){const a=[];for(const e of n){const t=await e.key,n=await e.value;a.push({key:t,value:n})}return e.mergeObjectSync(t,a)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:r}=a;if("aborted"===t.status)return P;if("aborted"===r.status)return P;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!a.alwaysSet||(n[t.value]=r.value)}return{status:e.value,value:n}}},P=Object.freeze({status:"aborted"}),A=e=>({status:"dirty",value:e}),T=e=>({status:"valid",value:e}),C=e=>"aborted"===e.status,O=e=>"dirty"===e.status,N=e=>"valid"===e.status,E=e=>"undefined"!=typeof Promise&&e instanceof Promise;(Z=w||(w={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Z.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var $=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}},I=(e,t)=>{if(N(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 g(e.common.issues);return this._error=t,this._error}}};function R(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:r}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var i,s;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!=(i=null!=o?o:a)?i:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(s=null!=o?o:n)?s:r.defaultError}},description:r}}var M,D=class{get description(){return this._def.description}_getType(e){return m(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new j,ctx:{common:e.parent.common,data:e.data,parsedType:m(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(E(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 n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!=(n=null==t?void 0:t.async)&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},r=this._parseSync({data:e,path:a.path,parent:a});return I(a,r)}"~validate"(e){var t,n;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return N(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null==(n=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(e=>N(e)?{value:e.value}:{issues:a.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:m(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(E(a)?a:Promise.resolve(a));return I(n,r)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{const r=e(t),i=()=>a.addIssue({code:h.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(i(),!1)):!!r||(i(),!1)})}refinement(e,t){return this._refinement((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1))}_refinement(e){return new ze({schema:this,typeName:Ye.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 Le.create(this,this._def)}nullable(){return Fe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return _e.create(this)}promise(){return De.create(this,this._def)}or(e){return xe.create([this,e],this._def)}and(e){return Pe.create(this,e,this._def)}transform(e){return new ze({...R(this._def),schema:this,typeName:Ye.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ue({...R(this._def),innerType:this,defaultValue:t,typeName:Ye.ZodDefault})}brand(){return new We({typeName:Ye.ZodBranded,type:this,...R(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Be({...R(this._def),innerType:this,catchValue:t,typeName:Ye.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return qe.create(this,e)}readonly(){return Ke.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},z=/^c[^\s-]{8,}$/i,L=/^[0-9a-z]+$/,F=/^[0-9A-HJKMNP-TV-Z]{26}$/i,U=/^[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,B=/^[a-z0-9_-]{21}$/i,V=/^[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)?)??$/,W=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,q=/^(?:(?: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])$/,K=/^(?:(?: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])$/,H=/^(([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]))$/,G=/^(([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])$/,Y=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Q=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,X="((\\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])))",ee=new RegExp(`^${X}$`);function te(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function ne(e){return new RegExp(`^${te(e)}$`)}function ae(e){let t=`${X}T${te(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function re(e,t){return!("v4"!==t&&t||!q.test(e))||!("v6"!==t&&t||!H.test(e))}function ie(e,t){if(!V.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const a=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(a));return"object"==typeof r&&null!==r&&((!("typ"in r)||"JWT"===(null==r?void 0:r.typ))&&(!!r.alg&&(!t||r.alg===t)))}catch(e){return!1}}function se(e,t){return!("v4"!==t&&t||!K.test(e))||!("v6"!==t&&t||!G.test(e))}var oe=class e extends D{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==p.string){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.string,received:t.parsedType}),P}const t=new j;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:h.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:h.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const r=e.data.length>a.value,i=e.data.length<a.value;(r||i)&&(n=this._getOrReturnCtx(e,n),r?x(n,{code:h.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&x(n,{code:h.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)W.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"email",code:h.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)M||(M=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),M.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"emoji",code:h.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)U.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"uuid",code:h.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)B.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"nanoid",code:h.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)z.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"cuid",code:h.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)L.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"cuid2",code:h.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)F.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"ulid",code:h.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),x(n,{validation:"url",code:h.invalid_string,message:a.message}),t.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"regex",code:h.invalid_string,message:a.message}),t.dirty())}else if("trim"===a.kind)e.data=e.data.trim();else if("includes"===a.kind)e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty());else if("toLowerCase"===a.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===a.kind)e.data=e.data.toUpperCase();else if("startsWith"===a.kind)e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty());else if("endsWith"===a.kind)e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty());else if("datetime"===a.kind){ae(a).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:"datetime",message:a.message}),t.dirty())}else if("date"===a.kind){ee.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:"date",message:a.message}),t.dirty())}else if("time"===a.kind){ne(a).test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{code:h.invalid_string,validation:"time",message:a.message}),t.dirty())}else"duration"===a.kind?J.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"duration",code:h.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?re(e.data,a.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"ip",code:h.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?ie(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"jwt",code:h.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?se(e.data,a.version)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"cidr",code:h.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?Y.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"base64",code:h.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?Q.test(e.data)||(n=this._getOrReturnCtx(e,n),x(n,{validation:"base64url",code:h.invalid_string,message:a.message}),t.dirty()):c.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:h.invalid_string,...w.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...w.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...w.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...w.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...w.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(n=null==e?void 0:e.local)&&n,...w.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...w.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...w.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...w.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.errToObj(t)})}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...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 ce(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}oe.create=e=>{var t;return new oe({checks:[],typeName:Ye.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...R(e)})};var de=class e extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==p.number){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.number,received:t.parsedType}),P}let t;const n=new j;for(const a of this._def.checks)if("int"===a.kind)c.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:h.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty());else if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty())}else"multipleOf"===a.kind?0!==ce(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),x(t,{code:h.not_finite,message:a.message}),n.dirty()):c.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:w.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.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&&c.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};de.create=e=>new de({checks:[],typeName:Ye.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});var ue=class e extends D{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let t;const n=new j;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else if("max"===a.kind){(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty())}else"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),x(t,{code:h.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):c.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.bigint,received:t.parsedType}),P}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:w.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:w.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}};ue.create=e=>{var t;return new ue({checks:[],typeName:Ye.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...R(e)})};var le=class extends D{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==p.boolean){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.boolean,received:t.parsedType}),P}return T(e.data)}};le.create=e=>new le({typeName:Ye.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...R(e)});var pe=class e extends D{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==p.date){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.date,received:t.parsedType}),P}if(Number.isNaN(e.data.getTime())){return x(this._getOrReturnCtx(e),{code:h.invalid_date}),P}const t=new j;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:h.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),x(n,{code:h.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):c.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.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}};pe.create=e=>new pe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ye.ZodDate,...R(e)});var me=class extends D{_parse(e){if(this._getType(e)!==p.symbol){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.symbol,received:t.parsedType}),P}return T(e.data)}};me.create=e=>new me({typeName:Ye.ZodSymbol,...R(e)});var he=class extends D{_parse(e){if(this._getType(e)!==p.undefined){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.undefined,received:t.parsedType}),P}return T(e.data)}};he.create=e=>new he({typeName:Ye.ZodUndefined,...R(e)});var fe=class extends D{_parse(e){if(this._getType(e)!==p.null){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.null,received:t.parsedType}),P}return T(e.data)}};fe.create=e=>new fe({typeName:Ye.ZodNull,...R(e)});var ge=class extends D{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}};ge.create=e=>new ge({typeName:Ye.ZodAny,...R(e)});var ye=class extends D{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}};ye.create=e=>new ye({typeName:Ye.ZodUnknown,...R(e)});var ve=class extends D{_parse(e){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.never,received:t.parsedType}),P}};ve.create=e=>new ve({typeName:Ye.ZodNever,...R(e)});var be=class extends D{_parse(e){if(this._getType(e)!==p.undefined){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.void,received:t.parsedType}),P}return T(e.data)}};be.create=e=>new be({typeName:Ye.ZodVoid,...R(e)});var _e=class e extends D{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==p.array)return x(t,{code:h.invalid_type,expected:p.array,received:t.parsedType}),P;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(x(t,{code:e?h.too_big:h.too_small,minimum:r?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(x(t,{code:h.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(x(t,{code:h.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((e,n)=>a.type._parseAsync(new $(t,e,t.path,n)))).then(e=>j.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new $(t,e,t.path,n)));return j.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:w.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:w.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:w.toString(n)}})}nonempty(e){return this.min(1,e)}};function Se(e){if(e instanceof ke){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Le.create(Se(a))}return new ke({...e._def,shape:()=>t})}return e instanceof _e?new _e({...e._def,type:Se(e.element)}):e instanceof Le?Le.create(Se(e.unwrap())):e instanceof Fe?Fe.create(Se(e.unwrap())):e instanceof Ae?Ae.create(e.items.map(e=>Se(e))):e}_e.create=(e,t)=>new _e({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ye.ZodArray,...R(t)});var ke=class e extends D{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=c.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==p.object){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.object,received:t.parsedType}),P}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof ve&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||i.push(e);const s=[];for(const e of r){const t=a[e],r=n.data[e];s.push({key:{status:"valid",value:e},value:t._parse(new $(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof ve){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)s.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)i.length>0&&(x(n,{code:h.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){const a=n.data[t];s.push({key:{status:"valid",value:t},value:e._parse(new $(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of s){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>j.mergeObjectSync(t,e)):j.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(t){return w.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,n)=>{var a,r,i,s;const o=null!=(i=null==(r=(a=this._def).errorMap)?void 0:r.call(a,e,n).message)?i:n.defaultError;return"unrecognized_keys"===e.code?{message:null!=(s=w.errToObj(t).message)?s:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Ye.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const n={};for(const e of c.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){const n={};for(const e of c.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Se(this)}partial(t){const n={};for(const e of c.objectKeys(this.shape)){const a=this.shape[e];t&&!t[e]?n[e]=a:n[e]=a.optional()}return new e({...this._def,shape:()=>n})}required(t){const n={};for(const e of c.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Le;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Ie(c.objectKeys(this.shape))}};ke.create=(e,t)=>new ke({shape:()=>e,unknownKeys:"strip",catchall:ve.create(),typeName:Ye.ZodObject,...R(t)}),ke.strictCreate=(e,t)=>new ke({shape:()=>e,unknownKeys:"strict",catchall:ve.create(),typeName:Ye.ZodObject,...R(t)}),ke.lazycreate=(e,t)=>new ke({shape:e,unknownKeys:"strip",catchall:ve.create(),typeName:Ye.ZodObject,...R(t)});var xe=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).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 n=e.map(e=>new g(e.ctx.common.issues));return x(t,{code:h.invalid_union,unionErrors:n}),P});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},i=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map(e=>new g(e));return x(t,{code:h.invalid_union,unionErrors:r}),P}}get options(){return this._def.options}};xe.create=(e,t)=>new xe({options:e,typeName:Ye.ZodUnion,...R(t)});var we=e=>e instanceof Ee?we(e.schema):e instanceof ze?we(e.innerType()):e instanceof $e?[e.value]:e instanceof Re?e.options:e instanceof Me?c.objectValues(e.enum):e instanceof Ue?we(e._def.innerType):e instanceof he?[void 0]:e instanceof fe?[null]:e instanceof Le?[void 0,...we(e.unwrap())]:e instanceof Fe?[null,...we(e.unwrap())]:e instanceof We||e instanceof Ke?we(e.unwrap()):e instanceof Be?we(e._def.innerType):[],Ze=class e extends D{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return x(t,{code:h.invalid_type,expected:p.object,received:t.parsedType}),P;const n=this.discriminator,a=t.data[n],r=this.optionsMap.get(a);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(x(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),P)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,a){const r=new Map;for(const e of n){const n=we(e.shape[t]);if(!n.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of n){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,e)}}return new e({typeName:Ye.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...R(a)})}};function je(e,t){const n=m(e),a=m(t);if(e===t)return{valid:!0,data:e};if(n===p.object&&a===p.object){const n=c.objectKeys(t),a=c.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=je(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===p.array&&a===p.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=je(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===p.date&&a===p.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Pe=class extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(C(e)||C(a))return P;const r=je(e.value,a.value);return r.valid?((O(e)||O(a))&&t.dirty(),{status:t.value,value:r.data}):(x(n,{code:h.invalid_intersection_types}),P)};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(([e,t])=>a(e,t)):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}))}};Pe.create=(e,t,n)=>new Pe({left:e,right:t,typeName:Ye.ZodIntersection,...R(n)});var Ae=class e extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return x(n,{code:h.invalid_type,expected:p.array,received:n.parsedType}),P;if(n.data.length<this._def.items.length)return x(n,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),P;!this._def.rest&&n.data.length>this._def.items.length&&(x(n,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new $(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>j.mergeArray(t,e)):j.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ae.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ae({items:e,typeName:Ye.ZodTuple,rest:null,...R(t)})};var Te=class e extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return x(n,{code:h.invalid_type,expected:p.object,received:n.parsedType}),P;const a=[],r=this._def.keyType,i=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new $(n,e,n.path,e)),value:i._parse(new $(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?j.mergeObjectAsync(t,a):j.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof D?{keyType:t,valueType:n,typeName:Ye.ZodRecord,...R(a)}:{keyType:oe.create(),valueType:t,typeName:Ye.ZodRecord,...R(n)})}},Ce=class extends D{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return x(n,{code:h.invalid_type,expected:p.map,received:n.parsedType}),P;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([e,t],i)=>({key:a._parse(new $(n,e,n.path,[i,"key"])),value:r._parse(new $(n,t,n.path,[i,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of i){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return P;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of i){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return P;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Ce.create=(e,t,n)=>new Ce({valueType:t,keyType:e,typeName:Ye.ZodMap,...R(n)});var Oe=class e extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return x(n,{code:h.invalid_type,expected:p.set,received:n.parsedType}),P;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(x(n,{code:h.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(x(n,{code:h.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function i(e){const n=new Set;for(const a of e){if("aborted"===a.status)return P;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const s=[...n.data.values()].map((e,t)=>r._parse(new $(n,e,n.path,t)));return n.common.async?Promise.all(s).then(e=>i(e)):i(s)}min(t,n){return new e({...this._def,minSize:{value:t,message:w.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:w.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Oe.create=(e,t)=>new Oe({valueType:e,minSize:null,maxSize:null,typeName:Ye.ZodSet,...R(t)});var Ne=class e extends D{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return x(t,{code:h.invalid_type,expected:p.function,received:t.parsedType}),P;function n(e,n){return S({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_(),y].filter(e=>!!e),issueData:{code:h.invalid_arguments,argumentsError:n}})}function a(e,n){return S({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,_(),y].filter(e=>!!e),issueData:{code:h.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof De){const e=this;return T(async function(...t){const s=new g([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw s.addIssue(n(t,e)),s}),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,r).catch(e=>{throw s.addIssue(a(c,e)),s})})}{const e=this;return T(function(...t){const s=e._def.args.safeParse(t,r);if(!s.success)throw new g([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new g([a(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ae.create(t).rest(ye.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,a){return new e({args:t||Ae.create([]).rest(ye.create()),returns:n||ye.create(),typeName:Ye.ZodFunction,...R(a)})}},Ee=class extends D{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})}};Ee.create=(e,t)=>new Ee({getter:e,typeName:Ye.ZodLazy,...R(t)});var $e=class extends D{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return x(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),P}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Ie(e,t){return new Re({values:e,typeName:Ye.ZodEnum,...R(t)})}$e.create=(e,t)=>new $e({value:e,typeName:Ye.ZodLiteral,...R(t)});var Re=class e extends D{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{expected:c.joinValues(n),received:t.parsedType,code:h.invalid_type}),P}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return x(t,{received:t.data,code:h.invalid_enum_value,options:n}),P}return T(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(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Re.create=Ie;var Me=class extends D{_parse(e){const t=c.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){const e=c.objectValues(t);return x(n,{expected:c.joinValues(e),received:n.parsedType,code:h.invalid_type}),P}if(this._cache||(this._cache=new Set(c.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=c.objectValues(t);return x(n,{received:n.data,code:h.invalid_enum_value,options:e}),P}return T(e.data)}get enum(){return this._def.values}};Me.create=(e,t)=>new Me({values:e,typeName:Ye.ZodNativeEnum,...R(t)});var De=class extends D{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&!1===t.common.async)return x(t,{code:h.invalid_type,expected:p.promise,received:t.parsedType}),P;const n=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return T(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};De.create=(e,t)=>new De({type:e,typeName:Ye.ZodPromise,...R(t)});var ze=class extends D{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ye.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:e=>{x(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(n.data,r);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return P;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?P:"dirty"===a.status||"dirty"===t.value?A(a.value):a});{if("aborted"===t.value)return P;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?P:"dirty"===a.status||"dirty"===t.value?A(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);if(n.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===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?P:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?P:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!N(e))return P;const i=a.transform(e.value,r);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>N(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):P)}c.assertNever(a)}};ze.create=(e,t,n)=>new ze({schema:e,typeName:Ye.ZodEffects,effect:t,...R(n)}),ze.createWithPreprocess=(e,t,n)=>new ze({schema:t,effect:{type:"preprocess",transform:e},typeName:Ye.ZodEffects,...R(n)});var Le=class extends D{_parse(e){return this._getType(e)===p.undefined?T(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Le.create=(e,t)=>new Le({innerType:e,typeName:Ye.ZodOptional,...R(t)});var Fe=class extends D{_parse(e){return this._getType(e)===p.null?T(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Fe.create=(e,t)=>new Fe({innerType:e,typeName:Ye.ZodNullable,...R(t)});var Ue=class extends D{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ue.create=(e,t)=>new Ue({innerType:e,typeName:Ye.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...R(t)});var Be=class extends D{_parse(e){const{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 E(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new g(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new g(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Be.create=(e,t)=>new Be({innerType:e,typeName:Ye.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...R(t)});var Ve=class extends D{_parse(e){if(this._getType(e)!==p.nan){const t=this._getOrReturnCtx(e);return x(t,{code:h.invalid_type,expected:p.nan,received:t.parsedType}),P}return{status:"valid",value:e.data}}};Ve.create=e=>new Ve({typeName:Ye.ZodNaN,...R(e)});var Je=Symbol("zod_brand"),We=class extends D{_parse(e){const{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}},qe=class e extends D{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?P:"dirty"===e.status?(t.dirty(),A(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?P:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Ye.ZodPipeline})}},Ke=class extends D{_parse(e){const t=this._def.innerType._parse(e),n=e=>(N(e)&&(e.value=Object.freeze(e.value)),e);return E(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function He(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Ge(e,t={},n){return e?ge.create().superRefine((a,r)=>{var i,s;const o=e(a);if(o instanceof Promise)return o.then(e=>{var i,s;if(!e){const e=He(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=He(t,a),o=null==(s=null!=(i=e.fatal)?i:n)||s;r.addIssue({code:"custom",...e,fatal:o})}}):ge.create()}Ke.create=(e,t)=>new Ke({innerType:e,typeName:Ye.ZodReadonly,...R(t)});var Ye,Qe,Xe={object:ke.lazycreate};(Qe=Ye||(Ye={})).ZodString="ZodString",Qe.ZodNumber="ZodNumber",Qe.ZodNaN="ZodNaN",Qe.ZodBigInt="ZodBigInt",Qe.ZodBoolean="ZodBoolean",Qe.ZodDate="ZodDate",Qe.ZodSymbol="ZodSymbol",Qe.ZodUndefined="ZodUndefined",Qe.ZodNull="ZodNull",Qe.ZodAny="ZodAny",Qe.ZodUnknown="ZodUnknown",Qe.ZodNever="ZodNever",Qe.ZodVoid="ZodVoid",Qe.ZodArray="ZodArray",Qe.ZodObject="ZodObject",Qe.ZodUnion="ZodUnion",Qe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Qe.ZodIntersection="ZodIntersection",Qe.ZodTuple="ZodTuple",Qe.ZodRecord="ZodRecord",Qe.ZodMap="ZodMap",Qe.ZodSet="ZodSet",Qe.ZodFunction="ZodFunction",Qe.ZodLazy="ZodLazy",Qe.ZodLiteral="ZodLiteral",Qe.ZodEnum="ZodEnum",Qe.ZodEffects="ZodEffects",Qe.ZodNativeEnum="ZodNativeEnum",Qe.ZodOptional="ZodOptional",Qe.ZodNullable="ZodNullable",Qe.ZodDefault="ZodDefault",Qe.ZodCatch="ZodCatch",Qe.ZodPromise="ZodPromise",Qe.ZodBranded="ZodBranded",Qe.ZodPipeline="ZodPipeline",Qe.ZodReadonly="ZodReadonly";var et=(e,t={message:`Input not instance of ${e.name}`})=>Ge(t=>t instanceof e,t),tt=oe.create,nt=de.create,at=Ve.create,rt=ue.create,it=le.create,st=pe.create,ot=me.create,ct=he.create,dt=fe.create,ut=ge.create,lt=ye.create,pt=ve.create,mt=be.create,ht=_e.create,ft=ke.create,gt=ke.strictCreate,yt=xe.create,vt=Ze.create,bt=Pe.create,_t=Ae.create,St=Te.create,kt=Ce.create,xt=Oe.create,wt=Ne.create,Zt=Ee.create,jt=$e.create,Pt=Re.create,At=Me.create,Tt=De.create,Ct=ze.create,Ot=Le.create,Nt=Fe.create,Et=ze.createWithPreprocess,$t=qe.create,It=()=>tt().optional(),Rt=()=>nt().optional(),Mt=()=>it().optional(),Dt={string:e=>oe.create({...e,coerce:!0}),number:e=>de.create({...e,coerce:!0}),boolean:e=>le.create({...e,coerce:!0}),bigint:e=>ue.create({...e,coerce:!0}),date:e=>pe.create({...e,coerce:!0})},zt=P,Lt=Symbol("Let zodToJsonSchema decide on which parser to use"),Ft={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"},Ut=e=>{const t=(e=>"string"==typeof e?{...Ft,name:e}:{...Ft,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Bt(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Vt(e,t,n,a,r){e[t]=n,Bt(e,t,a,r)}var Jt=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Wt(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Jt(t,e.currentPath):t.join("/")}}function qt(e,t){return Sn(e.type._def,t)}function Kt(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>Kt(e,t,n))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Ht(e,t)}}var Ht=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const a of e.checks)switch(a.kind){case"min":Vt(n,"minimum",a.value,a.message,t);break;case"max":Vt(n,"maximum",a.value,a.message,t)}return n};var Gt=void 0,Yt=/^[cC][^\s-]{8,}$/,Qt=/^[0-9a-z]+$/,Xt=/^[0-9A-HJKMNP-TV-Z]{26}$/,en=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,tn=()=>(void 0===Gt&&(Gt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Gt),nn=/^(?:(?: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])$/,an=/^(([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])$/,rn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,on=/^[a-zA-Z0-9_-]{21}$/,cn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function dn(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Vt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Vt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":pn(n,"email",a.message,t);break;case"format:idn-email":pn(n,"idn-email",a.message,t);break;case"pattern:zod":mn(n,en,a.message,t)}break;case"url":pn(n,"uri",a.message,t);break;case"uuid":pn(n,"uuid",a.message,t);break;case"regex":mn(n,a.regex,a.message,t);break;case"cuid":mn(n,Yt,a.message,t);break;case"cuid2":mn(n,Qt,a.message,t);break;case"startsWith":mn(n,RegExp(`^${un(a.value,t)}`),a.message,t);break;case"endsWith":mn(n,RegExp(`${un(a.value,t)}$`),a.message,t);break;case"datetime":pn(n,"date-time",a.message,t);break;case"date":pn(n,"date",a.message,t);break;case"time":pn(n,"time",a.message,t);break;case"duration":pn(n,"duration",a.message,t);break;case"length":Vt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Vt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":mn(n,RegExp(un(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&pn(n,"ipv4",a.message,t),"v4"!==a.version&&pn(n,"ipv6",a.message,t);break;case"base64url":mn(n,sn,a.message,t);break;case"jwt":mn(n,cn,a.message,t);break;case"cidr":"v6"!==a.version&&mn(n,nn,a.message,t),"v4"!==a.version&&mn(n,an,a.message,t);break;case"emoji":mn(n,tn(),a.message,t);break;case"ulid":mn(n,Xt,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":pn(n,"binary",a.message,t);break;case"contentEncoding:base64":Vt(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":mn(n,rn,a.message,t)}break;case"nanoid":mn(n,on,a.message,t)}return n}function un(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)ln.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var ln=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function pn(e,t,n,a){var r;e.format||(null==(r=e.anyOf)?void 0:r.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.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,...n&&a.errorMessages&&{errorMessage:{format:n}}})):Vt(e,"format",t,n,a)}function mn(e,t,n,a){var r;e.pattern||(null==(r=e.allOf)?void 0:r.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.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:hn(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Vt(e,"pattern",hn(t,a),n,a)}function hn(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),i=e.flags.includes("s"),s=a?e.source.toLowerCase():e.source;let o="",c=!1,d=!1,u=!1;for(let e=0;e<s.length;e++)if(c)o+=s[e],c=!1;else{if(a)if(d){if(s[e].match(/[a-z]/)){u?(o+=s[e],o+=`${s[e-2]}-${s[e]}`.toUpperCase(),u=!1):"-"===s[e+1]&&(null==(n=s[e+2])?void 0:n.match(/[a-z]/))?(o+=s[e],u=!0):o+=`${s[e]}${s[e].toUpperCase()}`;continue}}else if(s[e].match(/[a-z]/)){o+=`[${s[e]}${s[e].toUpperCase()}]`;continue}if(r){if("^"===s[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===s[e]){o+="($|(?=[\r\n]))";continue}}i&&"."===s[e]?o+=d?`${s[e]}\r\n`:`[${s[e]}\r\n]`:(o+=s[e],"\\"===s[e]?c=!0:d&&"]"===s[e]?d=!1:d||"["!==s[e]||(d=!0))}try{new RegExp(o)}catch(n){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function fn(e,t){var n,a,r,i,s,o,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(n=e.keyType)?void 0:n._def.typeName)===Ye.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=Sn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:Wt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const d={type:"object",additionalProperties:null!=(a=Sn(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return d;if((null==(r=e.keyType)?void 0:r._def.typeName)===Ye.ZodString&&(null==(i=e.keyType._def.checks)?void 0:i.length)){const{type:n,...a}=dn(e.keyType._def,t);return{...d,propertyNames:a}}if((null==(s=e.keyType)?void 0:s._def.typeName)===Ye.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Ye.ZodBranded&&e.keyType._def.type._def.typeName===Ye.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=qt(e.keyType._def,t);return{...d,propertyNames:a}}return d}var gn={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var yn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Sn(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function vn(e,t){const n="openAi"===t.target,a={type:"object",properties:{}},r=[],i=e.shape();for(const e in i){let s=i[e];if(void 0===s||void 0===s._def)continue;let o=bn(s);o&&n&&("ZodOptional"===s._def.typeName&&(s=s._def.innerType),s.isNullable()||(s=s.nullable()),o=!1);const c=Sn(s._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==c&&(a.properties[e]=c,o||r.push(e))}r.length&&(a.required=r);const s=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Sn(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!==s&&(a.additionalProperties=s),a}function bn(e){try{return e.isOptional()}catch(e){return!0}}var _n=(e,t,n)=>{switch(t){case Ye.ZodString:return dn(e,n);case Ye.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"int":n.type="integer",Bt(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Vt(n,"minimum",a.value,a.message,t):Vt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Vt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Vt(n,"maximum",a.value,a.message,t):Vt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Vt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Vt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Ye.ZodObject:return vn(e,n);case Ye.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"min":"jsonSchema7"===t.target?a.inclusive?Vt(n,"minimum",a.value,a.message,t):Vt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Vt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Vt(n,"maximum",a.value,a.message,t):Vt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Vt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Vt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Ye.ZodBoolean:return{type:"boolean"};case Ye.ZodDate:return Kt(e,n);case Ye.ZodUndefined:return function(e){return{not:Wt(e)}}(n);case Ye.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Ye.ZodArray:return function(e,t){var n,a,r;const i={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(r=null==(a=e.type)?void 0:a._def)?void 0:r.typeName)!==Ye.ZodAny&&(i.items=Sn(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Vt(i,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Vt(i,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Vt(i,"minItems",e.exactLength.value,e.exactLength.message,t),Vt(i,"maxItems",e.exactLength.value,e.exactLength.message,t)),i}(e,n);case Ye.ZodUnion:case Ye.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return yn(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in gn&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=gn[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return yn(e,t)}(e,n);case Ye.ZodIntersection:return function(e,t){const n=[Sn(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Sn(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let a="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const r=[];return n.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:n,...a}=e;t=a}else a=void 0;r.push(t)}else r.push(...e.allOf),void 0===e.unevaluatedProperties&&(a=void 0);var t}),r.length?{allOf:r,...a}:void 0}(e,n);case Ye.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>Sn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Sn(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Sn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Ye.ZodRecord:return fn(e,n);case Ye.ZodLiteral:return function(e,t){const n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case Ye.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Ye.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),a=Array.from(new Set(n.map(e=>typeof e)));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:n}}(e);case Ye.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:gn[e.innerType._def.typeName],nullable:!0}:{type:[gn[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=Sn(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=Sn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Ye.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return Sn(e.innerType._def,t);const a=Sn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Wt(t)},a]}:Wt(t)})(e,n);case Ye.ZodMap:return function(e,t){return"record"===t.mapStrategy?fn(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Sn(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Wt(t),Sn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Wt(t)],minItems:2,maxItems:2}}}(e,n);case Ye.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:Sn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Vt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Vt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Ye.ZodLazy:return()=>e.getter()._def;case Ye.ZodPromise:return function(e,t){return Sn(e.type._def,t)}(e,n);case Ye.ZodNaN:case Ye.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Wt({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Ye.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Sn(e.schema._def,t):Wt(t)}(e,n);case Ye.ZodAny:return Wt(n);case Ye.ZodUnknown:return function(e){return Wt(e)}(n);case Ye.ZodDefault:return function(e,t){return{...Sn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Ye.ZodBranded:return qt(e,n);case Ye.ZodReadonly:case Ye.ZodCatch:return((e,t)=>Sn(e.innerType._def,t))(e,n);case Ye.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Sn(e.in._def,t);if("output"===t.pipeStrategy)return Sn(e.out._def,t);const n=Sn(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Sn(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Ye.ZodFunction:case Ye.ZodVoid:case Ye.ZodSymbol:default:return}};function Sn(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const i=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(i!==Lt)return i}if(r&&!n){const e=kn(r,t);if(void 0!==e)return e}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const s=_n(e,e.typeName,t),o="function"==typeof s?Sn(s(),t):s;if(o&&xn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var kn=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Jt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Wt(t)):"seen"===t.$refStrategy?Wt(t):void 0}},xn=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),wn=(e,t)=>{var n;const a=Ut(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=Sn(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:Wt(a)}},{}):void 0;const i="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,s=null!=(n=Sn(e._def,void 0===i?a:{...a,currentPath:[...a.basePath,a.definitionPath,i]},!1))?n:Wt(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(s.title=o),a.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[a.openAiAnyTypeName]||(r[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===a.$refStrategy?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const c=void 0===i?r?{...s,[a.definitionPath]:r}:s:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,i].join("/"),[a.definitionPath]:{...r,[i]:s}};return"jsonSchema7"===a.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==a.target&&"openAi"!==a.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===a.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c},Zn=Object.defineProperty,jn=(e,t)=>{for(var n in t)Zn(e,n,{get:t[n],enumerable:!0})},Pn=l.string(),An=l.number(),Tn=(l.boolean(),l.string().min(1)),Cn=l.number().int().positive(),On=l.number().int().nonnegative(),Nn=l.number().describe("Tagging version number");l.union([l.string(),l.number(),l.boolean()]).optional();jn({},{ErrorHandlerSchema:()=>In,HandlerSchema:()=>Mn,LogHandlerSchema:()=>Rn,StorageSchema:()=>$n,StorageTypeSchema:()=>En,errorHandlerJsonSchema:()=>Ln,handlerJsonSchema:()=>Un,logHandlerJsonSchema:()=>Fn,storageJsonSchema:()=>zn,storageTypeJsonSchema:()=>Dn});var En=l.enum(["local","session","cookie"]).describe("Storage mechanism: local, session, or cookie"),$n=l.object({Local:l.literal("local"),Session:l.literal("session"),Cookie:l.literal("cookie")}).describe("Storage type constants for type-safe references"),In=l.any().describe("Error handler function: (error, state?) => void"),Rn=l.any().describe("Log handler function: (message, verbose?) => void"),Mn=l.object({Error:In.describe("Error handler function"),Log:Rn.describe("Log handler function")}).describe("Handler interface with error and log functions"),Dn=wn(En,{target:"jsonSchema7",$refStrategy:"relative",name:"StorageType"}),zn=wn($n,{target:"jsonSchema7",$refStrategy:"relative",name:"Storage"}),Ln=wn(In,{target:"jsonSchema7",$refStrategy:"relative",name:"ErrorHandler"}),Fn=wn(Rn,{target:"jsonSchema7",$refStrategy:"relative",name:"LogHandler"}),Un=wn(Mn,{target:"jsonSchema7",$refStrategy:"relative",name:"Handler"});l.object({onError:In.optional().describe("Error handler function: (error, state?) => void"),onLog:Rn.optional().describe("Log handler function: (message, verbose?) => void")}).partial(),l.object({verbose:l.boolean().describe("Enable verbose logging for debugging").optional()}).partial(),l.object({queue:l.boolean().describe("Whether to queue events when consent is not granted").optional()}).partial(),l.object({}).partial(),l.object({init:l.boolean().describe("Whether to initialize immediately").optional(),loadScript:l.boolean().describe("Whether to load external script (for web destinations)").optional()}).partial(),l.object({disabled:l.boolean().describe("Set to true to disable").optional()}).partial(),l.object({primary:l.boolean().describe("Mark as primary (only one can be primary)").optional()}).partial(),l.object({settings:l.any().optional().describe("Implementation-specific configuration")}).partial(),l.object({env:l.any().optional().describe("Environment dependencies (platform-specific)")}).partial(),l.object({type:l.string().optional().describe("Instance type identifier"),config:l.any().describe("Instance configuration")}).partial(),l.object({collector:l.any().describe("Collector instance (runtime object)"),config:l.any().describe("Configuration"),env:l.any().describe("Environment dependencies")}).partial(),l.object({batch:l.number().optional().describe("Batch size: bundle N events for batch processing"),batched:l.any().optional().describe("Batch of events to be processed")}).partial(),l.object({ignore:l.boolean().describe("Set to true to skip processing").optional(),condition:l.string().optional().describe("Condition function: return true to process")}).partial(),l.object({sources:l.record(l.string(),l.any()).describe("Map of source instances")}).partial(),l.object({destinations:l.record(l.string(),l.any()).describe("Map of destination instances")}).partial();jn({},{ConsentSchema:()=>Kn,DeepPartialEventSchema:()=>na,EntitiesSchema:()=>Xn,EntitySchema:()=>Qn,EventSchema:()=>ea,OrderedPropertiesSchema:()=>Wn,PartialEventSchema:()=>ta,PropertiesSchema:()=>Jn,PropertySchema:()=>Vn,PropertyTypeSchema:()=>Bn,SourceSchema:()=>Yn,SourceTypeSchema:()=>qn,UserSchema:()=>Hn,VersionSchema:()=>Gn,consentJsonSchema:()=>ua,entityJsonSchema:()=>ca,eventJsonSchema:()=>aa,orderedPropertiesJsonSchema:()=>oa,partialEventJsonSchema:()=>ra,propertiesJsonSchema:()=>sa,sourceTypeJsonSchema:()=>da,userJsonSchema:()=>ia});var Bn=l.lazy(()=>l.union([l.boolean(),l.string(),l.number(),l.record(l.string(),Vn)])),Vn=l.lazy(()=>l.union([Bn,l.array(Bn)])),Jn=l.record(l.string(),Vn.optional()).describe("Flexible property collection with optional values"),Wn=l.record(l.string(),l.tuple([Vn,l.number()]).optional()).describe("Ordered properties with [value, order] tuples for priority control"),qn=l.union([l.enum(["web","server","app","other"]),l.string()]).describe("Source type: web, server, app, other, or custom"),Kn=l.record(l.string(),l.boolean()).describe("Consent requirement mapping (group name → state)"),Hn=Jn.and(l.object({id:l.string().optional().describe("User identifier"),device:l.string().optional().describe("Device identifier"),session:l.string().optional().describe("Session identifier"),hash:l.string().optional().describe("Hashed identifier"),address:l.string().optional().describe("User address"),email:l.string().email().optional().describe("User email address"),phone:l.string().optional().describe("User phone number"),userAgent:l.string().optional().describe("Browser user agent string"),browser:l.string().optional().describe("Browser name"),browserVersion:l.string().optional().describe("Browser version"),deviceType:l.string().optional().describe("Device type (mobile, desktop, tablet)"),os:l.string().optional().describe("Operating system"),osVersion:l.string().optional().describe("Operating system version"),screenSize:l.string().optional().describe("Screen dimensions"),language:l.string().optional().describe("User language"),country:l.string().optional().describe("User country"),region:l.string().optional().describe("User region/state"),city:l.string().optional().describe("User city"),zip:l.string().optional().describe("User postal code"),timezone:l.string().optional().describe("User timezone"),ip:l.string().optional().describe("User IP address"),internal:l.boolean().optional().describe("Internal user flag (employee, test user)")})).describe("User identification and properties"),Gn=Jn.and(l.object({source:Pn.describe('Walker implementation version (e.g., "2.0.0")'),tagging:Nn})).describe("Walker version information"),Yn=Jn.and(l.object({type:qn.describe("Source type identifier"),id:Pn.describe("Source identifier (typically URL on web)"),previous_id:Pn.describe("Previous source identifier (typically referrer on web)")})).describe("Event source information"),Qn=l.lazy(()=>l.object({entity:l.string().describe("Entity name"),data:Jn.describe("Entity-specific properties"),nested:l.array(Qn).describe("Nested child entities"),context:Wn.describe("Entity context data")})).describe("Nested entity structure with recursive nesting support"),Xn=l.array(Qn).describe("Array of nested entities"),ea=l.object({name:l.string().describe('Event name in "entity action" format (e.g., "page view", "product add")'),data:Jn.describe("Event-specific properties"),context:Wn.describe("Ordered context properties with priorities"),globals:Jn.describe("Global properties shared across events"),custom:Jn.describe("Custom implementation-specific properties"),user:Hn.describe("User identification and attributes"),nested:Xn.describe("Related nested entities"),consent:Kn.describe("Consent states at event time"),id:Tn.describe("Unique event identifier (timestamp-based)"),trigger:Pn.describe("Event trigger identifier"),entity:Pn.describe("Parsed entity from event name"),action:Pn.describe("Parsed action from event name"),timestamp:Cn.describe("Unix timestamp in milliseconds since epoch"),timing:An.describe("Event processing timing information"),group:Pn.describe("Event grouping identifier"),count:On.describe("Event count in session"),version:Gn.describe("Walker version information"),source:Yn.describe("Event source information")}).describe("Complete walkerOS event structure"),ta=ea.partial().describe("Partial event structure with all fields optional"),na=l.lazy(()=>ea.deepPartial()).describe("Deep partial event structure with all nested fields optional"),aa=wn(ea,{target:"jsonSchema7",$refStrategy:"relative",name:"Event"}),ra=wn(ta,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialEvent"}),ia=wn(Hn,{target:"jsonSchema7",$refStrategy:"relative",name:"User"}),sa=wn(Jn,{target:"jsonSchema7",$refStrategy:"relative",name:"Properties"}),oa=wn(Wn,{target:"jsonSchema7",$refStrategy:"relative",name:"OrderedProperties"}),ca=wn(Qn,{target:"jsonSchema7",$refStrategy:"relative",name:"Entity"}),da=wn(qn,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceType"}),ua=wn(Kn,{target:"jsonSchema7",$refStrategy:"relative",name:"Consent"});jn({},{ConfigSchema:()=>_a,LoopSchema:()=>ma,MapSchema:()=>fa,PolicySchema:()=>ya,ResultSchema:()=>Sa,RuleSchema:()=>va,RulesSchema:()=>ba,SetSchema:()=>ha,ValueConfigSchema:()=>ga,ValueSchema:()=>la,ValuesSchema:()=>pa,configJsonSchema:()=>Ca,loopJsonSchema:()=>wa,mapJsonSchema:()=>ja,policyJsonSchema:()=>Pa,ruleJsonSchema:()=>Aa,rulesJsonSchema:()=>Ta,setJsonSchema:()=>Za,valueConfigJsonSchema:()=>xa,valueJsonSchema:()=>ka});var la=l.lazy(()=>l.union([l.string().describe('String value or property path (e.g., "data.id")'),l.number().describe("Numeric value"),l.boolean().describe("Boolean value"),ga,l.array(la).describe("Array of values")])),pa=l.array(la).describe("Array of transformation values"),ma=l.tuple([la,la]).describe("Loop transformation: [source, transform] tuple for array processing"),ha=l.array(la).describe("Set: Array of values for selection or combination"),fa=l.record(l.string(),la).describe("Map: Object mapping keys to transformation values"),ga=l.object({key:l.string().optional().describe('Property path to extract from event (e.g., "data.id", "user.email")'),value:l.union([l.string(),l.number(),l.boolean()]).optional().describe("Static primitive value"),fn:l.string().optional().describe("Custom transformation function as string (serialized)"),map:fa.optional().describe("Object mapping: transform event data to structured output"),loop:ma.optional().describe("Loop transformation: [source, transform] for array processing"),set:ha.optional().describe("Set of values: combine or select from multiple values"),consent:Kn.optional().describe("Required consent states to include this value"),condition:l.string().optional().describe("Condition function as string: return true to include value"),validate:l.string().optional().describe("Validation function as string: return true if value is valid")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value transformation configuration with multiple strategies"),ya=l.record(l.string(),la).describe("Policy rules for event pre-processing (key → value mapping)"),va=l.object({batch:l.number().optional().describe("Batch size: bundle N events for batch processing"),condition:l.string().optional().describe("Condition function as string: return true to process event"),consent:Kn.optional().describe("Required consent states to process this event"),settings:l.any().optional().describe("Destination-specific settings for this event mapping"),data:l.union([la,pa]).optional().describe("Data transformation rules for event"),ignore:l.boolean().optional().describe("Set to true to skip processing this event"),name:l.string().optional().describe('Custom event name override (e.g., "view_item" for "product view")'),policy:ya.optional().describe("Event-level policy overrides (applied after config-level policy)")}).describe("Mapping rule for specific entity-action combination"),ba=l.record(l.string(),l.record(l.string(),l.union([va,l.array(va)])).optional()).describe("Nested mapping rules: { entity: { action: Rule | Rule[] } } with wildcard support"),_a=l.object({consent:Kn.optional().describe("Required consent states to process any events"),data:l.union([la,pa]).optional().describe("Global data transformation applied to all events"),mapping:ba.optional().describe("Entity-action specific mapping rules"),policy:ya.optional().describe("Pre-processing policy rules applied before mapping")}).describe("Shared mapping configuration for sources and destinations"),Sa=l.object({eventMapping:va.optional().describe("Resolved mapping rule for event"),mappingKey:l.string().optional().describe('Mapping key used (e.g., "product.view")')}).describe("Mapping resolution result"),ka=wn(la,{target:"jsonSchema7",$refStrategy:"relative",name:"Value"}),xa=wn(ga,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),wa=wn(ma,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Za=wn(ha,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),ja=wn(fa,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),Pa=wn(ya,{target:"jsonSchema7",$refStrategy:"relative",name:"Policy"}),Aa=wn(va,{target:"jsonSchema7",$refStrategy:"relative",name:"Rule"}),Ta=wn(ba,{target:"jsonSchema7",$refStrategy:"relative",name:"Rules"}),Ca=wn(_a,{target:"jsonSchema7",$refStrategy:"relative",name:"MappingConfig"});jn({},{BatchSchema:()=>za,ConfigSchema:()=>Oa,ContextSchema:()=>$a,DLQSchema:()=>Ka,DataSchema:()=>La,DestinationPolicySchema:()=>Ea,DestinationsSchema:()=>Va,InitDestinationsSchema:()=>Ba,InitSchema:()=>Ua,InstanceSchema:()=>Fa,PartialConfigSchema:()=>Na,PushBatchContextSchema:()=>Ra,PushContextSchema:()=>Ia,PushEventSchema:()=>Ma,PushEventsSchema:()=>Da,PushResultSchema:()=>Wa,RefSchema:()=>Ja,ResultSchema:()=>qa,batchJsonSchema:()=>Xa,configJsonSchema:()=>Ha,contextJsonSchema:()=>Ya,instanceJsonSchema:()=>er,partialConfigJsonSchema:()=>Ga,pushContextJsonSchema:()=>Qa,resultJsonSchema:()=>tr});var Oa=l.object({consent:Kn.optional().describe("Required consent states to send events to this destination"),settings:l.any().describe("Implementation-specific configuration").optional(),data:l.union([la,pa]).optional().describe("Global data transformation applied to all events for this destination"),env:l.any().describe("Environment dependencies (platform-specific)").optional(),id:Tn.describe("Destination instance identifier (defaults to destination key)").optional(),init:l.boolean().describe("Whether to initialize immediately").optional(),loadScript:l.boolean().describe("Whether to load external script (for web destinations)").optional(),mapping:ba.optional().describe("Entity-action specific mapping rules for this destination"),policy:ya.optional().describe("Pre-processing policy rules applied before event mapping"),queue:l.boolean().describe("Whether to queue events when consent is not granted").optional(),verbose:l.boolean().describe("Enable verbose logging for debugging").optional(),onError:In.optional(),onLog:Rn.optional()}).describe("Destination configuration"),Na=Oa.deepPartial().describe("Partial destination configuration with all fields deeply optional"),Ea=ya.describe("Destination policy rules for event pre-processing"),$a=l.object({collector:l.any().describe("Collector instance (runtime object)"),config:Oa.describe("Destination configuration"),data:l.union([l.any(),l.undefined(),l.array(l.union([l.any(),l.undefined()]))]).optional().describe("Transformed event data"),env:l.any().describe("Environment dependencies")}).describe("Destination context for init and push functions"),Ia=$a.extend({mapping:va.optional().describe("Resolved mapping rule for this specific event")}).describe("Push context with event-specific mapping"),Ra=Ia.describe("Batch push context with event-specific mapping"),Ma=l.object({event:ea.describe("The event to process"),mapping:va.optional().describe("Mapping rule for this event")}).describe("Event with optional mapping for batch processing"),Da=l.array(Ma).describe("Array of events with mappings"),za=l.object({key:l.string().describe('Batch key (usually mapping key like "product.view")'),events:l.array(ea).describe("Array of events in batch"),data:l.array(l.union([l.any(),l.undefined(),l.array(l.union([l.any(),l.undefined()]))])).describe("Transformed data for each event"),mapping:va.optional().describe("Shared mapping rule for batch")}).describe("Batch of events grouped by mapping key"),La=l.union([l.any(),l.undefined(),l.array(l.union([l.any(),l.undefined()]))]).describe("Transformed event data (Property, undefined, or array)"),Fa=l.object({config:Oa.describe("Destination configuration"),queue:l.array(ea).optional().describe("Queued events awaiting consent"),dlq:l.array(l.tuple([ea,l.any()])).optional().describe("Dead letter queue (failed events with errors)"),type:l.string().optional().describe("Destination type identifier"),env:l.any().optional().describe("Environment dependencies"),init:l.any().optional().describe("Initialization function"),push:l.any().describe("Push function for single events"),pushBatch:l.any().optional().describe("Batch push function"),on:l.any().optional().describe("Event lifecycle hook function")}).describe("Destination instance (runtime object with functions)"),Ua=l.object({code:Fa.describe("Destination instance with implementation"),config:Na.optional().describe("Partial configuration overrides"),env:l.any().optional().describe("Partial environment overrides")}).describe("Destination initialization configuration"),Ba=l.record(l.string(),Ua).describe("Map of destination IDs to initialization configurations"),Va=l.record(l.string(),Fa).describe("Map of destination IDs to runtime instances"),Ja=l.object({id:l.string().describe("Destination ID"),destination:Fa.describe("Destination instance")}).describe("Destination reference (ID + instance)"),Wa=l.object({queue:l.array(ea).optional().describe("Events queued (awaiting consent)"),error:l.any().optional().describe("Error if push failed")}).describe("Push operation result"),qa=l.object({successful:l.array(Ja).describe("Destinations that processed successfully"),queued:l.array(Ja).describe("Destinations that queued events"),failed:l.array(Ja).describe("Destinations that failed to process")}).describe("Overall destination processing result"),Ka=l.array(l.tuple([ea,l.any()])).describe("Dead letter queue: [(event, error), ...]"),Ha=wn(Oa,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationConfig"}),Ga=wn(Na,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialDestinationConfig"}),Ya=wn($a,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationContext"}),Qa=wn(Ia,{target:"jsonSchema7",$refStrategy:"relative",name:"PushContext"}),Xa=wn(za,{target:"jsonSchema7",$refStrategy:"relative",name:"Batch"}),er=wn(Fa,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationInstance"}),tr=wn(qa,{target:"jsonSchema7",$refStrategy:"relative",name:"DestinationResult"});jn({},{CommandTypeSchema:()=>nr,ConfigSchema:()=>ar,DestinationsSchema:()=>cr,InitConfigSchema:()=>ir,InstanceSchema:()=>dr,PushContextSchema:()=>sr,SessionDataSchema:()=>rr,SourcesSchema:()=>or,commandTypeJsonSchema:()=>ur,configJsonSchema:()=>lr,initConfigJsonSchema:()=>mr,instanceJsonSchema:()=>fr,pushContextJsonSchema:()=>hr,sessionDataJsonSchema:()=>pr});var nr=l.union([l.enum(["action","config","consent","context","destination","elb","globals","hook","init","link","run","user","walker"]),l.string()]).describe("Collector command type: standard commands or custom string for extensions"),ar=l.object({run:l.boolean().describe("Whether to run collector automatically on initialization").optional(),tagging:Nn,globalsStatic:Jn.describe("Static global properties that persist across collector runs"),sessionStatic:l.record(l.any()).describe("Static session data that persists across collector runs"),verbose:l.boolean().describe("Enable verbose logging for debugging"),onError:In.optional(),onLog:Rn.optional()}).describe("Core collector configuration"),rr=Jn.and(l.object({isStart:l.boolean().describe("Whether this is a new session start"),storage:l.boolean().describe("Whether storage is available"),id:Tn.describe("Session identifier").optional(),start:Cn.describe("Session start timestamp").optional(),marketing:l.literal(!0).optional().describe("Marketing attribution flag"),updated:Cn.describe("Last update timestamp").optional(),isNew:l.boolean().describe("Whether this is a new session").optional(),device:Tn.describe("Device identifier").optional(),count:On.describe("Event count in session").optional(),runs:On.describe("Number of runs").optional()})).describe("Session state and tracking data"),ir=ar.partial().extend({consent:Kn.optional().describe("Initial consent state"),user:Hn.optional().describe("Initial user data"),globals:Jn.optional().describe("Initial global properties"),sources:l.any().optional().describe("Source configurations"),destinations:l.any().optional().describe("Destination configurations"),custom:Jn.optional().describe("Initial custom implementation-specific properties")}).describe("Collector initialization configuration with initial state"),sr=l.object({mapping:_a.optional().describe("Source-level mapping configuration")}).describe("Push context with optional source mapping"),or=l.record(l.string(),l.any()).describe("Map of source IDs to source instances"),cr=l.record(l.string(),l.any()).describe("Map of destination IDs to destination instances"),dr=l.object({push:l.any().describe("Push function for processing events"),command:l.any().describe("Command function for walker commands"),allowed:l.boolean().describe("Whether event processing is allowed"),config:ar.describe("Current collector configuration"),consent:Kn.describe("Current consent state"),count:l.number().describe("Event count (increments with each event)"),custom:Jn.describe("Custom implementation-specific properties"),sources:or.describe("Registered source instances"),destinations:cr.describe("Registered destination instances"),globals:Jn.describe("Current global properties"),group:l.string().describe("Event grouping identifier"),hooks:l.any().describe("Lifecycle hook functions"),on:l.any().describe("Event lifecycle configuration"),queue:l.array(ea).describe("Queued events awaiting processing"),round:l.number().describe("Collector run count (increments with each run)"),session:l.union([l.undefined(),rr]).describe("Current session state"),timing:l.number().describe("Event processing timing information"),user:Hn.describe("Current user data"),version:l.string().describe("Walker implementation version")}).describe("Collector instance with state and methods"),ur=wn(nr,{target:"jsonSchema7",$refStrategy:"relative",name:"CommandType"}),lr=wn(ar,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorConfig"}),pr=wn(rr,{target:"jsonSchema7",$refStrategy:"relative",name:"SessionData"}),mr=wn(ir,{target:"jsonSchema7",$refStrategy:"relative",name:"InitConfig"}),hr=wn(sr,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorPushContext"}),fr=wn(dr,{target:"jsonSchema7",$refStrategy:"relative",name:"CollectorInstance"});jn({},{BaseEnvSchema:()=>gr,ConfigSchema:()=>yr,InitSchema:()=>_r,InitSourceSchema:()=>Sr,InitSourcesSchema:()=>kr,InstanceSchema:()=>br,PartialConfigSchema:()=>vr,baseEnvJsonSchema:()=>xr,configJsonSchema:()=>wr,initSourceJsonSchema:()=>Pr,initSourcesJsonSchema:()=>Ar,instanceJsonSchema:()=>jr,partialConfigJsonSchema:()=>Zr});var gr=l.object({push:l.any().describe("Collector push function"),command:l.any().describe("Collector command function"),sources:l.any().optional().describe("Map of registered source instances"),elb:l.any().describe("Public API function (alias for collector.push)")}).catchall(l.unknown()).describe("Base environment for dependency injection - platform-specific sources extend this"),yr=_a.extend({settings:l.any().describe("Implementation-specific configuration").optional(),env:gr.optional().describe("Environment dependencies (platform-specific)"),id:Tn.describe("Source identifier (defaults to source key)").optional(),onError:In.optional(),disabled:l.boolean().describe("Set to true to disable").optional(),primary:l.boolean().describe("Mark as primary (only one can be primary)").optional()}).describe("Source configuration with mapping and environment"),vr=yr.deepPartial().describe("Partial source configuration with all fields deeply optional"),br=l.object({type:l.string().describe('Source type identifier (e.g., "browser", "dataLayer")'),config:yr.describe("Current source configuration"),push:l.any().describe("Push function - THE HANDLER (flexible signature for platform compatibility)"),destroy:l.any().optional().describe("Cleanup function called when source is removed"),on:l.any().optional().describe("Lifecycle hook function for event types")}).describe("Source instance with push handler and lifecycle methods"),_r=l.any().describe("Source initialization function: (config, env) => Instance | Promise<Instance>"),Sr=l.object({code:_r.describe("Source initialization function"),config:vr.optional().describe("Partial configuration overrides"),env:gr.partial().optional().describe("Partial environment overrides"),primary:l.boolean().optional().describe("Mark as primary source (only one can be primary)")}).describe("Source initialization configuration"),kr=l.record(l.string(),Sr).describe("Map of source IDs to initialization configurations"),xr=wn(gr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceBaseEnv"}),wr=wn(yr,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceConfig"}),Zr=wn(vr,{target:"jsonSchema7",$refStrategy:"relative",name:"PartialSourceConfig"}),jr=wn(br,{target:"jsonSchema7",$refStrategy:"relative",name:"SourceInstance"}),Pr=wn(Sr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSource"}),Ar=wn(kr,{target:"jsonSchema7",$refStrategy:"relative",name:"InitSources"});function Tr(e){return wn(e,{target:"jsonSchema7",$refStrategy:"none"})}function Cr(e){var t;return Boolean(e&&"object"==typeof e&&"AWS"in e&&(null==(t=e.AWS)?void 0:t.FirehoseClient))}function Or(e,t){const{streamName:n,region:a="eu-central-1",config:r={}}=e;n||function(e){throw new Error(String(e))}("Firehose: Config custom streamName missing"),r.region||(r.region=a);let i=e.client;return!i&&Cr(t)&&(i=new t.AWS.FirehoseClient(r)),{streamName:n,client:i,region:a}}var Nr=async function(e,{config:t,collector:n,env:a}){const{firehose:r}=t.settings||{};r&&async function(e,t,n){const{client:a,streamName:r}=t;if(!a)return{queue:e};const i=e.map(({event:e})=>({Data:Buffer.from(JSON.stringify(e))}));if(Cr(n))await a.send(new n.AWS.PutRecordBatchCommand({DeliveryStreamName:r,Records:i}));else{const{PutRecordBatchCommand:e}=await import("@aws-sdk/client-firehose");await a.send(new e({DeliveryStreamName:r,Records:i}))}}([{event:e}],r,a)},Er={},$r={};i($r,{env:()=>Ir});var Ir={};i(Ir,{push:()=>Rr});var Rr={AWS:{FirehoseClient:class{constructor(e){this.config=e}async send(e){return{RecordId:"mock-record-id",ResponseMetadata:{RequestId:"mock-request-id"}}}},PutRecordBatchCommand:class{constructor(e){this.input=e}}}},Mr={};i(Mr,{FirehoseConfigSchema:()=>Dr,MappingSchema:()=>Lr,SettingsSchema:()=>zr,firehose:()=>Br,mapping:()=>Ur,settings:()=>Fr});var Dr=l.object({streamName:l.string().min(1).describe("Name of the Kinesis Data Firehose delivery stream (like walker-events)"),client:l.any().describe("Pre-configured AWS Firehose client instance (like new FirehoseClient(config))").optional(),region:l.string().describe("AWS region for the Firehose service (like us-east-1)").optional(),config:l.any().describe("AWS SDK client configuration options (like { credentials: awsCredentials })").optional()}),zr=l.object({firehose:Dr.describe("AWS Firehose configuration settings (like { streamName: 'walker-events', region: 'us-east-1' })").optional()}),Lr=l.object({}),Fr=Tr(zr),Ur=Tr(Lr),Br=Tr(Dr),Vr={type:"aws-firehose",config:{},async init({config:e,env:t}){const n=function(e={},t){const n=e.settings||{};return n.firehose&&(n.firehose=Or(n.firehose,t)),{settings:n}}(e,t);return typeof n.settings==typeof{}&&n},push:async(e,{config:t,collector:n,env:a})=>await Nr(e,{config:t,collector:n,env:a})},Jr={};i(Jr,{firehose:()=>$r});//# sourceMappingURL=index.js.map