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