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