@walkeros/web-source-datalayer 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,23 @@
1
- import { Mapping } from '@walkeros/core';
1
+ import { Source, Mapping } from '@walkeros/core';
2
+
3
+ /**
4
+ * Environment interface for dataLayer source
5
+ */
6
+ interface DataLayerEnv extends Source.BaseEnv {
7
+ window?: typeof window;
8
+ }
9
+ /**
10
+ * Standard mock environment for testing dataLayer source
11
+ *
12
+ * Use this for testing dataLayer.push interception and event transformation
13
+ * without requiring a real browser environment.
14
+ */
15
+ declare const push: DataLayerEnv;
16
+
17
+ declare const env_push: typeof push;
18
+ declare namespace env {
19
+ export { env_push as push };
20
+ }
2
21
 
3
22
  /**
4
23
  * Sample gtag events that would be pushed to dataLayer
@@ -79,4 +98,4 @@ declare namespace mapping {
79
98
  export { mapping_add_to_cart as add_to_cart, mapping_config as config, mapping_configGA4 as configGA4, mapping_consentOnlyMapping as consentOnlyMapping, mapping_consentUpdate as consentUpdate, mapping_customEvent as customEvent, mapping_purchase as purchase, mapping_view_item as view_item };
80
99
  }
81
100
 
82
- export { events as Events, mapping as Mapping, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples };
101
+ export { events as Events, mapping as Mapping, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples, env };
@@ -1,4 +1,23 @@
1
- import { Mapping } from '@walkeros/core';
1
+ import { Source, Mapping } from '@walkeros/core';
2
+
3
+ /**
4
+ * Environment interface for dataLayer source
5
+ */
6
+ interface DataLayerEnv extends Source.BaseEnv {
7
+ window?: typeof window;
8
+ }
9
+ /**
10
+ * Standard mock environment for testing dataLayer source
11
+ *
12
+ * Use this for testing dataLayer.push interception and event transformation
13
+ * without requiring a real browser environment.
14
+ */
15
+ declare const push: DataLayerEnv;
16
+
17
+ declare const env_push: typeof push;
18
+ declare namespace env {
19
+ export { env_push as push };
20
+ }
2
21
 
3
22
  /**
4
23
  * Sample gtag events that would be pushed to dataLayer
@@ -79,4 +98,4 @@ declare namespace mapping {
79
98
  export { mapping_add_to_cart as add_to_cart, mapping_config as config, mapping_configGA4 as configGA4, mapping_consentOnlyMapping as consentOnlyMapping, mapping_consentUpdate as consentUpdate, mapping_customEvent as customEvent, mapping_purchase as purchase, mapping_view_item as view_item };
80
99
  }
81
100
 
82
- export { events as Events, mapping as Mapping, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples };
101
+ export { events as Events, mapping as Mapping, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples, env };
@@ -24,10 +24,47 @@ __export(examples_exports, {
24
24
  Mapping: () => mapping_exports,
25
25
  consentOnlyMapping: () => consentOnlyMapping,
26
26
  consentUpdateEvent: () => consentUpdate,
27
- dataLayerExamples: () => config2
27
+ dataLayerExamples: () => config2,
28
+ env: () => env_exports
28
29
  });
29
30
  module.exports = __toCommonJS(examples_exports);
30
31
 
32
+ // src/examples/env.ts
33
+ var env_exports = {};
34
+ __export(env_exports, {
35
+ push: () => push
36
+ });
37
+ var noop = () => {
38
+ };
39
+ var createMockElbFn = () => {
40
+ const fn = (() => Promise.resolve({
41
+ ok: true,
42
+ successful: [],
43
+ queued: [],
44
+ failed: []
45
+ }));
46
+ return fn;
47
+ };
48
+ var createMockWindow = () => ({
49
+ dataLayer: [],
50
+ addEventListener: noop,
51
+ removeEventListener: noop
52
+ });
53
+ var push = {
54
+ get push() {
55
+ return createMockElbFn();
56
+ },
57
+ get command() {
58
+ return createMockElbFn();
59
+ },
60
+ get elb() {
61
+ return createMockElbFn();
62
+ },
63
+ get window() {
64
+ return createMockWindow();
65
+ }
66
+ };
67
+
31
68
  // src/examples/events.ts
32
69
  var events_exports = {};
33
70
  __export(events_exports, {
@@ -285,5 +322,6 @@ var consentOnlyMapping = {
285
322
  Mapping,
286
323
  consentOnlyMapping,
287
324
  consentUpdateEvent,
288
- dataLayerExamples
325
+ dataLayerExamples,
326
+ env
289
327
  });
@@ -4,6 +4,42 @@ var __export = (target, all) => {
4
4
  __defProp(target, name, { get: all[name], enumerable: true });
5
5
  };
6
6
 
7
+ // src/examples/env.ts
8
+ var env_exports = {};
9
+ __export(env_exports, {
10
+ push: () => push
11
+ });
12
+ var noop = () => {
13
+ };
14
+ var createMockElbFn = () => {
15
+ const fn = (() => Promise.resolve({
16
+ ok: true,
17
+ successful: [],
18
+ queued: [],
19
+ failed: []
20
+ }));
21
+ return fn;
22
+ };
23
+ var createMockWindow = () => ({
24
+ dataLayer: [],
25
+ addEventListener: noop,
26
+ removeEventListener: noop
27
+ });
28
+ var push = {
29
+ get push() {
30
+ return createMockElbFn();
31
+ },
32
+ get command() {
33
+ return createMockElbFn();
34
+ },
35
+ get elb() {
36
+ return createMockElbFn();
37
+ },
38
+ get window() {
39
+ return createMockWindow();
40
+ }
41
+ };
42
+
7
43
  // src/examples/events.ts
8
44
  var events_exports = {};
9
45
  __export(events_exports, {
@@ -260,5 +296,6 @@ export {
260
296
  mapping_exports as Mapping,
261
297
  consentOnlyMapping,
262
298
  consentUpdate as consentUpdateEvent,
263
- config2 as dataLayerExamples
299
+ config2 as dataLayerExamples,
300
+ env_exports as env
264
301
  };
@@ -1 +1 @@
1
- "use strict";var Destination=(()=>{var e,t,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},c={};o(c,{Events:()=>w,Mapping:()=>S,SourceDataLayer:()=>v,consentOnlyMapping:()=>C,consentUpdateEvent:()=>b,dataLayerExamples:()=>M,default:()=>G,sourceDataLayer:()=>N});var s=Object.getOwnPropertyNames,u=(e={"package.json"(e,t){t.exports={name:"@walkeros/core",description:"Core types and platform-agnostic utilities for walkerOS",version:"0.1.2",main:"./dist/index.js",module:"./dist/index.mjs",types:"./dist/index.d.ts",license:"MIT",files:["dist/**"],scripts:{build:"tsup --silent",clean:"rm -rf .turbo && rm -rf node_modules && rm -rf dist",dev:"jest --watchAll --colors",lint:'tsc && eslint "**/*.ts*"',test:"jest",update:"npx npm-check-updates -u && npm update"},dependencies:{},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/core"},author:"elbwalker <hello@elbwalker.com>",homepage:"https://github.com/elbwalker/walkerOS#readme",bugs:{url:"https://github.com/elbwalker/walkerOS/issues"},keywords:["walker","walkerOS","analytics","tracking","data collection","measurement","data privacy","privacy friendly","web analytics","product analytics","core","types","utils"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return t||(0,e[s(e)[0]])((t={exports:{}}).exports,t),t.exports});function l(e){return Array.isArray(e)}function d(e){return"object"==typeof e&&null!==e&&!l(e)&&"[object Object]"===Object.prototype.toString.call(e)}function m(e){return"string"==typeof e}var{version:p}=u();function y(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}var f=!1;function g(e,t={},n){if(t.filter){if(!0===y(()=>t.filter(n),()=>!1)())return}const r=function(e){if(d(e)&&m(e.event)){const{event:t,...n}=e;return{name:t,...n}}if(l(e)&&e.length>=2)return _(e);if(t=e,null!=t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0){return _(Array.from(e))}var t;return null}(n);if(!r)return;const a={name:`${t.prefix||"dataLayer"} ${r.name}`,data:r,context:{},globals:{},custom:{},consent:{},nested:[],user:{},id:Math.random().toString(36).substring(2,15),trigger:"",entity:"",action:"",timestamp:Date.now(),timing:0,group:"",count:0,version:{source:"1.0.0",tagging:2},source:{type:"dataLayer",id:"",previous_id:""}};y(()=>e(a),()=>{})()}function _(e){const[t,n,r]=e;if(!m(t))return null;let a,i={};switch(t){case"consent":if(!m(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!d(r)||null===r)return null;a=`${t} ${n}`,i={...r};break;case"event":if(!m(n))return null;a=n,d(r)&&(i={...r});break;case"config":if(!m(n))return null;a=`${t} ${n}`,d(r)&&(i={...r});break;case"set":if(m(n))a=`${t} ${n}`,d(r)&&(i={...r});else{if(!d(n))return null;a=`${t} custom`,i={...n}}break;default:return null}return{name:a,...i}}var v={},w={};function b(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function h(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function k(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function X(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function O(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function j(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function x(){return["set",{currency:"EUR",country:"DE"}]}function L(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}o(w,{add_to_cart:()=>X,config:()=>j,consentDefault:()=>h,consentUpdate:()=>b,directDataLayerEvent:()=>L,purchase:()=>k,setCustom:()=>x,view_item:()=>O});var S={};o(S,{add_to_cart:()=>U,config:()=>M,configGA4:()=>$,consentOnlyMapping:()=>C,consentUpdate:()=>E,customEvent:()=>q,purchase:()=>D,view_item:()=>P});var A,E={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},D={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},U={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},P={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},$={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},q={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},M={consent:{update:E},purchase:D,add_to_cart:U,view_item:P,"config G-XXXXXXXXXX":$,custom_event:q,"*":{data:{}}},C={consent:{update:E}},N=async(e,t)=>{try{const n=t||{},{elb:r,window:a}=n;if(!r)throw new Error("DataLayer source requires elb function in environment");const i={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},o={settings:i};a&&(function(e,t){const n=t.settings,r=(null==n?void 0:n.name)||"dataLayer",a=window[r];if(Array.isArray(a)&&!f){f=!0;try{for(const t of a)g(e,n,t)}finally{f=!1}}}(r,o),function(e,t){const n=t.settings,r=(null==n?void 0:n.name)||"dataLayer";window[r]||(window[r]=[]);const a=window[r];if(!Array.isArray(a))return;const i=a.push.bind(a);a.push=function(...t){if(f)return i(...t);f=!0;try{for(const r of t)g(e,n,r)}finally{f=!1}return i(...t)}}(r,o));return{type:"dataLayer",config:o,push:r,destroy:async()=>{const e=i.name||"dataLayer";a&&a[e]&&Array.isArray(a[e])}}}catch(e){throw e}},G=N;return A=c,((e,t,o,c)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let s of a(t))i.call(e,s)||s===o||n(e,s,{get:()=>t[s],enumerable:!(c=r(t,s))||c.enumerable});return e})(n({},"__esModule",{value:!0}),A)})();
1
+ "use strict";var Destination=(()=>{var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,n=(t,a)=>{for(var r in a)e(t,r,{get:a[r],enumerable:!0})},s={};n(s,{Events:()=>Va,Mapping:()=>Ya,SourceDataLayer:()=>La,consentOnlyMapping:()=>or,consentUpdateEvent:()=>Ba,dataLayerExamples:()=>ir,default:()=>ur,env:()=>za,sourceDataLayer:()=>dr});var i,o,d,u={};n(u,{BRAND:()=>Ve,DIRTY:()=>T,EMPTY_PATH:()=>b,INVALID:()=>A,NEVER:()=>Rt,OK:()=>O,ParseStatus:()=>Z,Schema:()=>M,ZodAny:()=>he,ZodArray:()=>ve,ZodBigInt:()=>de,ZodBoolean:()=>ue,ZodBranded:()=>Be,ZodCatch:()=>De,ZodDate:()=>ce,ZodDefault:()=>Fe,ZodDiscriminatedUnion:()=>we,ZodEffects:()=>Re,ZodEnum:()=>Ee,ZodError:()=>h,ZodFirstPartyTypeKind:()=>Je,ZodFunction:()=>je,ZodIntersection:()=>Ae,ZodIssueCode:()=>p,ZodLazy:()=>Ne,ZodLiteral:()=>Ce,ZodMap:()=>Pe,ZodNaN:()=>Ue,ZodNativeEnum:()=>Ie,ZodNever:()=>ye,ZodNull:()=>me,ZodNullable:()=>ze,ZodNumber:()=>oe,ZodObject:()=>be,ZodOptional:()=>Le,ZodParsedType:()=>c,ZodPipeline:()=>Ke,ZodPromise:()=>Me,ZodReadonly:()=>qe,ZodRecord:()=>Oe,ZodSchema:()=>M,ZodSet:()=>Se,ZodString:()=>se,ZodSymbol:()=>le,ZodTransformer:()=>Re,ZodTuple:()=>Te,ZodType:()=>M,ZodUndefined:()=>pe,ZodUnion:()=>ke,ZodUnknown:()=>fe,ZodVoid:()=>ge,addIssueToContext:()=>k,any:()=>dt,array:()=>pt,bigint:()=>at,boolean:()=>rt,coerce:()=>Mt,custom:()=>Xe,date:()=>nt,datetimeRegex:()=>te,defaultErrorMap:()=>f,discriminatedUnion:()=>yt,effect:()=>Pt,enum:()=>At,function:()=>xt,getErrorMap:()=>v,getParsedType:()=>l,instanceof:()=>Ye,intersection:()=>gt,isAborted:()=>P,isAsync:()=>N,isDirty:()=>S,isValid:()=>j,late:()=>He,lazy:()=>wt,literal:()=>Zt,makeIssue:()=>_,map:()=>bt,nan:()=>tt,nativeEnum:()=>Tt,never:()=>ct,null:()=>ot,nullable:()=>jt,number:()=>et,object:()=>mt,objectUtil:()=>d,oboolean:()=>It,onumber:()=>Et,optional:()=>St,ostring:()=>$t,pipeline:()=>Ct,preprocess:()=>Nt,promise:()=>Ot,quotelessJson:()=>m,record:()=>_t,set:()=>kt,setErrorMap:()=>g,strictObject:()=>ht,string:()=>Qe,symbol:()=>st,transformer:()=>Pt,tuple:()=>vt,undefined:()=>it,union:()=>ft,unknown:()=>ut,util:()=>i,void:()=>lt}),(o=i||(i={})).assertEqual=e=>{},o.assertIs=function(e){},o.assertNever=function(e){throw new Error},o.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},o.getValidEnumValues=e=>{const t=o.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),a={};for(const r of t)a[r]=e[r];return o.objectValues(a)},o.objectValues=e=>o.objectKeys(e).map(function(t){return e[t]}),o.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},o.find=(e,t)=>{for(const a of e)if(t(a))return a},o.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,o.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},o.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(d||(d={})).mergeShapes=(e,t)=>({...e,...t});var c=i.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),l=e=>{switch(typeof e){case"undefined":return c.undefined;case"string":return c.string;case"number":return Number.isNaN(e)?c.nan:c.number;case"boolean":return c.boolean;case"function":return c.function;case"bigint":return c.bigint;case"symbol":return c.symbol;case"object":return Array.isArray(e)?c.array:null===e?c.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?c.promise:"undefined"!=typeof Map&&e instanceof Map?c.map:"undefined"!=typeof Set&&e instanceof Set?c.set:"undefined"!=typeof Date&&e instanceof Date?c.date:c.object;default:return c.unknown}},p=i.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),m=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),h=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},a={_errors:[]},r=e=>{for(const n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(r);else if("invalid_return_type"===n.code)r(n.returnTypeError);else if("invalid_arguments"===n.code)r(n.argumentsError);else if(0===n.path.length)a._errors.push(t(n));else{let e=a,r=0;for(;r<n.path.length;){const a=n.path[r];r===n.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(n))):e[a]=e[a]||{_errors:[]},e=e[a],r++}}};return r(this),a}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,i.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const r of this.issues)if(r.path.length>0){const a=r.path[0];t[a]=t[a]||[],t[a].push(e(r))}else a.push(e(r));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}};h.create=e=>new h(e);var f=(e,t)=>{let a;switch(e.code){case p.invalid_type:a=e.received===c.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case p.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,i.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:a=`Unrecognized key(s) in object: ${i.joinValues(e.keys,", ")}`;break;case p.invalid_union:a="Invalid input";break;case p.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${i.joinValues(e.options)}`;break;case p.invalid_enum_value:a=`Invalid enum value. Expected ${i.joinValues(e.options)}, received '${e.received}'`;break;case p.invalid_arguments:a="Invalid function arguments";break;case p.invalid_return_type:a="Invalid function return type";break;case p.invalid_date:a="Invalid date";break;case p.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:i.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case p.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case p.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case p.custom:a="Invalid input";break;case p.invalid_intersection_types:a="Intersection results could not be merged";break;case p.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case p.not_finite:a="Number must be finite";break;default:a=t.defaultError,i.assertNever(e)}return{message:a}},y=f;function g(e){y=e}function v(){return y}var _=e=>{const{data:t,path:a,errorMaps:r,issueData:n}=e,s=[...a,...n.path||[]],i={...n,path:s};if(void 0!==n.message)return{...n,path:s,message:n.message};let o="";const d=r.filter(e=>!!e).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...n,path:s,message:o}},b=[];function k(e,t){const a=v(),r=_({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===f?void 0:f].filter(e=>!!e)});e.common.issues.push(r)}var x,w,Z=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const r of t){if("aborted"===r.status)return A;"dirty"===r.status&&e.dirty(),a.push(r.value)}return{status:e.value,value:a}}static async mergeObjectAsync(t,a){const r=[];for(const e of a){const t=await e.key,a=await e.value;r.push({key:t,value:a})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){const a={};for(const r of t){const{key:t,value:n}=r;if("aborted"===t.status)return A;if("aborted"===n.status)return A;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"===t.value||void 0===n.value&&!r.alwaysSet||(a[t.value]=n.value)}return{status:e.value,value:a}}},A=Object.freeze({status:"aborted"}),T=e=>({status:"dirty",value:e}),O=e=>({status:"valid",value:e}),P=e=>"aborted"===e.status,S=e=>"dirty"===e.status,j=e=>"valid"===e.status,N=e=>"undefined"!=typeof Promise&&e instanceof Promise;(w=x||(x={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},w.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var C=class{constructor(e,t,a,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},$=(e,t)=>{if(j(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new h(e.common.issues);return this._error=t,this._error}}};function E(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:r,description:n}=e;if(t&&(a||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:n};return{errorMap:(t,n)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:n.defaultError}:void 0===n.data?{message:null!=(s=null!=o?o:r)?s:n.defaultError}:"invalid_type"!==t.code?{message:n.defaultError}:{message:null!=(i=null!=o?o:a)?i:n.defaultError}},description:n}}var I,M=class{get description(){return this._def.description}_getType(e){return l(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:l(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Z,ctx:{common:e.parent.common,data:e.data,parsedType:l(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(N(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const r={common:{issues:[],async:null!=(a=null==t?void 0:t.async)&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:l(e)},n=this._parseSync({data:e,path:r.path,parent:r});return $(r,n)}"~validate"(e){var t,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:l(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:r});return j(t)?{value:t.value}:{issues:r.common.issues}}catch(e){(null==(a=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:a.includes("encountered"))&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(e=>j(e)?{value:e.value}:{issues:r.common.issues})}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:l(e)},r=this._parse({data:e,path:a.path,parent:a}),n=await(N(r)?r:Promise.resolve(r));return $(a,n)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const n=e(t),s=()=>r.addIssue({code:p.custom,...a(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(s(),!1)):!!n||(s(),!1)})}refinement(e,t){return this._refinement((a,r)=>!!e(a)||(r.addIssue("function"==typeof t?t(a,r):t),!1))}_refinement(e){return new Re({schema:this,typeName:Je.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return Le.create(this,this._def)}nullable(){return ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ve.create(this)}promise(){return Me.create(this,this._def)}or(e){return ke.create([this,e],this._def)}and(e){return Ae.create(this,e,this._def)}transform(e){return new Re({...E(this._def),schema:this,typeName:Je.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Fe({...E(this._def),innerType:this,defaultValue:t,typeName:Je.ZodDefault})}brand(){return new Be({typeName:Je.ZodBranded,type:this,...E(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new De({...E(this._def),innerType:this,catchValue:t,typeName:Je.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Ke.create(this,e)}readonly(){return qe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},R=/^c[^\s-]{8,}$/i,L=/^[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,D=/^[a-z0-9_-]{21}$/i,U=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,V=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,B=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,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])$/,q=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,W=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,X=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,J=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,G=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,H="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Y=new RegExp(`^${H}$`);function Q(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function ee(e){return new RegExp(`^${Q(e)}$`)}function te(e){let t=`${H}T${Q(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}function ae(e,t){return!("v4"!==t&&t||!K.test(e))||!("v6"!==t&&t||!W.test(e))}function re(e,t){if(!U.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const r=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(r));return"object"==typeof n&&null!==n&&((!("typ"in n)||"JWT"===(null==n?void 0:n.typ))&&(!!n.alg&&(!t||n.alg===t)))}catch(e){return!1}}function ne(e,t){return!("v4"!==t&&t||!q.test(e))||!("v6"!==t&&t||!X.test(e))}var se=class e extends M{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==c.string){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.string,received:t.parsedType}),A}const t=new Z;let a;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:p.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:p.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const n=e.data.length>r.value,s=e.data.length<r.value;(n||s)&&(a=this._getOrReturnCtx(e,a),n?k(a,{code:p.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&k(a,{code:p.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)B.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"email",code:p.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)I||(I=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),I.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"emoji",code:p.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)F.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"uuid",code:p.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)D.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"nanoid",code:p.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)R.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid",code:p.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)L.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cuid2",code:p.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)z.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ulid",code:p.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch(n){a=this._getOrReturnCtx(e,a),k(a,{validation:"url",code:p.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"regex",code:p.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(e,a),k(a,{code:p.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:p.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(a=this._getOrReturnCtx(e,a),k(a,{code:p.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){te(r).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:p.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){Y.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:p.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){ee(r).test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{code:p.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?V.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"duration",code:p.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?ae(e.data,r.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"ip",code:p.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?re(e.data,r.alg)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"jwt",code:p.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?ne(e.data,r.version)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"cidr",code:p.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?J.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64",code:p.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?G.test(e.data)||(a=this._getOrReturnCtx(e,a),k(a,{validation:"base64url",code:p.invalid_string,message:r.message}),t.dirty()):i.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement(t=>e.test(t),{validation:t,code:p.invalid_string,...x.errToObj(a)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...x.errToObj(e)})}url(e){return this._addCheck({kind:"url",...x.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...x.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...x.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...x.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...x.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...x.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...x.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...x.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...x.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...x.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...x.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...x.errToObj(e)})}datetime(e){var t,a;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(a=null==e?void 0:e.local)&&a,...x.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...x.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...x.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...x.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...x.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...x.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...x.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...x.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...x.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...x.errToObj(t)})}nonempty(e){return this.min(1,x.errToObj(e))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};function ie(e,t){const a=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,n=a>r?a:r;return Number.parseInt(e.toFixed(n).replace(".",""))%Number.parseInt(t.toFixed(n).replace(".",""))/10**n}se.create=e=>{var t;return new se({checks:[],typeName:Je.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...E(e)})};var oe=class e extends M{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)!==c.number){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.number,received:t.parsedType}),A}let t;const a=new Z;for(const r of this._def.checks)if("int"===r.kind)i.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),k(t,{code:p.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else"multipleOf"===r.kind?0!==ie(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),k(t,{code:p.not_finite,message:r.message}),a.dirty()):i.assertNever(r);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(t,a,r,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:x.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:x.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:x.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:x.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:x.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&i.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}};oe.create=e=>new oe({checks:[],typeName:Je.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...E(e)});var de=class e extends M{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)!==c.bigint)return this._getInvalidInput(e);let t;const a=new Z;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),k(t,{code:p.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):i.assertNever(r);return{status:a.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.bigint,received:t.parsedType}),A}gte(e,t){return this.setLimit("min",e,!0,x.toString(t))}gt(e,t){return this.setLimit("min",e,!1,x.toString(t))}lte(e,t){return this.setLimit("max",e,!0,x.toString(t))}lt(e,t){return this.setLimit("max",e,!1,x.toString(t))}setLimit(t,a,r,n){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:a,inclusive:r,message:x.toString(n)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:x.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:x.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:x.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:x.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:x.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}};de.create=e=>{var t;return new de({checks:[],typeName:Je.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...E(e)})};var ue=class extends M{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==c.boolean){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.boolean,received:t.parsedType}),A}return O(e.data)}};ue.create=e=>new ue({typeName:Je.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...E(e)});var ce=class e extends M{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==c.date){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.date,received:t.parsedType}),A}if(Number.isNaN(e.data.getTime())){return k(this._getOrReturnCtx(e),{code:p.invalid_date}),A}const t=new Z;let a;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:p.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(a=this._getOrReturnCtx(e,a),k(a,{code:p.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):i.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:x.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:x.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}};ce.create=e=>new ce({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Je.ZodDate,...E(e)});var le=class extends M{_parse(e){if(this._getType(e)!==c.symbol){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.symbol,received:t.parsedType}),A}return O(e.data)}};le.create=e=>new le({typeName:Je.ZodSymbol,...E(e)});var pe=class extends M{_parse(e){if(this._getType(e)!==c.undefined){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.undefined,received:t.parsedType}),A}return O(e.data)}};pe.create=e=>new pe({typeName:Je.ZodUndefined,...E(e)});var me=class extends M{_parse(e){if(this._getType(e)!==c.null){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.null,received:t.parsedType}),A}return O(e.data)}};me.create=e=>new me({typeName:Je.ZodNull,...E(e)});var he=class extends M{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}};he.create=e=>new he({typeName:Je.ZodAny,...E(e)});var fe=class extends M{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}};fe.create=e=>new fe({typeName:Je.ZodUnknown,...E(e)});var ye=class extends M{_parse(e){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.never,received:t.parsedType}),A}};ye.create=e=>new ye({typeName:Je.ZodNever,...E(e)});var ge=class extends M{_parse(e){if(this._getType(e)!==c.undefined){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.void,received:t.parsedType}),A}return O(e.data)}};ge.create=e=>new ge({typeName:Je.ZodVoid,...E(e)});var ve=class e extends M{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),r=this._def;if(t.parsedType!==c.array)return k(t,{code:p.invalid_type,expected:c.array,received:t.parsedType}),A;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,n=t.data.length<r.exactLength.value;(e||n)&&(k(t,{code:e?p.too_big:p.too_small,minimum:n?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(k(t,{code:p.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(k(t,{code:p.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map((e,a)=>r.type._parseAsync(new C(t,e,t.path,a)))).then(e=>Z.mergeArray(a,e));const n=[...t.data].map((e,a)=>r.type._parseSync(new C(t,e,t.path,a)));return Z.mergeArray(a,n)}get element(){return this._def.type}min(t,a){return new e({...this._def,minLength:{value:t,message:x.toString(a)}})}max(t,a){return new e({...this._def,maxLength:{value:t,message:x.toString(a)}})}length(t,a){return new e({...this._def,exactLength:{value:t,message:x.toString(a)}})}nonempty(e){return this.min(1,e)}};function _e(e){if(e instanceof be){const t={};for(const a in e.shape){const r=e.shape[a];t[a]=Le.create(_e(r))}return new be({...e._def,shape:()=>t})}return e instanceof ve?new ve({...e._def,type:_e(e.element)}):e instanceof Le?Le.create(_e(e.unwrap())):e instanceof ze?ze.create(_e(e.unwrap())):e instanceof Te?Te.create(e.items.map(e=>_e(e))):e}ve.create=(e,t)=>new ve({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Je.ZodArray,...E(t)});var be=class e extends M{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=i.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==c.object){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.object,received:t.parsedType}),A}const{status:t,ctx:a}=this._processInputParams(e),{shape:r,keys:n}=this._getCached(),s=[];if(!(this._def.catchall instanceof ye&&"strip"===this._def.unknownKeys))for(const e in a.data)n.includes(e)||s.push(e);const i=[];for(const e of n){const t=r[e],n=a.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new C(a,n,a.path,e)),alwaysSet:e in a.data})}if(this._def.catchall instanceof 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:a.data[e]}});else if("strict"===e)s.length>0&&(k(a,{code:p.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const r=a.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new C(a,r,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const a=await t.key,r=await t.value;e.push({key:a,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>Z.mergeObjectSync(t,e)):Z.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return x.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,a)=>{var r,n,s,i;const o=null!=(s=null==(n=(r=this._def).errorMap)?void 0:n.call(r,e,a).message)?s:a.defaultError;return"unrecognized_keys"===e.code?{message:null!=(i=x.errToObj(t).message)?i:o}:{message:o}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Je.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const a={};for(const e of i.objectKeys(t))t[e]&&this.shape[e]&&(a[e]=this.shape[e]);return new e({...this._def,shape:()=>a})}omit(t){const a={};for(const e of i.objectKeys(this.shape))t[e]||(a[e]=this.shape[e]);return new e({...this._def,shape:()=>a})}deepPartial(){return _e(this)}partial(t){const a={};for(const e of i.objectKeys(this.shape)){const r=this.shape[e];t&&!t[e]?a[e]=r:a[e]=r.optional()}return new e({...this._def,shape:()=>a})}required(t){const a={};for(const e of i.objectKeys(this.shape))if(t&&!t[e])a[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Le;)t=t._def.innerType;a[e]=t}return new e({...this._def,shape:()=>a})}keyof(){return $e(i.objectKeys(this.shape))}};be.create=(e,t)=>new be({shape:()=>e,unknownKeys:"strip",catchall:ye.create(),typeName:Je.ZodObject,...E(t)}),be.strictCreate=(e,t)=>new be({shape:()=>e,unknownKeys:"strict",catchall:ye.create(),typeName:Je.ZodObject,...E(t)}),be.lazycreate=(e,t)=>new be({shape:e,unknownKeys:"strip",catchall:ye.create(),typeName:Je.ZodObject,...E(t)});var ke=class extends M{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map(async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const a of e)if("dirty"===a.result.status)return t.common.issues.push(...a.ctx.common.issues),a.result;const a=e.map(e=>new h(e.ctx.common.issues));return k(t,{code:p.invalid_union,unionErrors:a}),A});{let e;const r=[];for(const n of a){const a={...t,common:{...t.common,issues:[]},parent:null},s=n._parseSync({data:t.data,path:t.path,parent:a});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:a}),a.common.issues.length&&r.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const n=r.map(e=>new h(e));return k(t,{code:p.invalid_union,unionErrors:n}),A}}get options(){return this._def.options}};ke.create=(e,t)=>new ke({options:e,typeName:Je.ZodUnion,...E(t)});var xe=e=>e instanceof Ne?xe(e.schema):e instanceof Re?xe(e.innerType()):e instanceof Ce?[e.value]:e instanceof Ee?e.options:e instanceof Ie?i.objectValues(e.enum):e instanceof Fe?xe(e._def.innerType):e instanceof pe?[void 0]:e instanceof me?[null]:e instanceof Le?[void 0,...xe(e.unwrap())]:e instanceof ze?[null,...xe(e.unwrap())]:e instanceof Be||e instanceof qe?xe(e.unwrap()):e instanceof De?xe(e._def.innerType):[],we=class e extends M{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.object)return k(t,{code:p.invalid_type,expected:c.object,received:t.parsedType}),A;const a=this.discriminator,r=t.data[a],n=this.optionsMap.get(r);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(k(t,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),A)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,a,r){const n=new Map;for(const e of a){const a=xe(e.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const r of a){if(n.has(r))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);n.set(r,e)}}return new e({typeName:Je.ZodDiscriminatedUnion,discriminator:t,options:a,optionsMap:n,...E(r)})}};function Ze(e,t){const a=l(e),r=l(t);if(e===t)return{valid:!0,data:e};if(a===c.object&&r===c.object){const a=i.objectKeys(t),r=i.objectKeys(e).filter(e=>-1!==a.indexOf(e)),n={...e,...t};for(const a of r){const r=Ze(e[a],t[a]);if(!r.valid)return{valid:!1};n[a]=r.data}return{valid:!0,data:n}}if(a===c.array&&r===c.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let r=0;r<e.length;r++){const n=Ze(e[r],t[r]);if(!n.valid)return{valid:!1};a.push(n.data)}return{valid:!0,data:a}}return a===c.date&&r===c.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Ae=class extends M{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=(e,r)=>{if(P(e)||P(r))return A;const n=Ze(e.value,r.value);return n.valid?((S(e)||S(r))&&t.dirty(),{status:t.value,value:n.data}):(k(a,{code:p.invalid_intersection_types}),A)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};Ae.create=(e,t,a)=>new Ae({left:e,right:t,typeName:Je.ZodIntersection,...E(a)});var Te=class e extends M{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==c.array)return k(a,{code:p.invalid_type,expected:c.array,received:a.parsedType}),A;if(a.data.length<this._def.items.length)return k(a,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),A;!this._def.rest&&a.data.length>this._def.items.length&&(k(a,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...a.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new C(a,e,a.path,t)):null}).filter(e=>!!e);return a.common.async?Promise.all(r).then(e=>Z.mergeArray(t,e)):Z.mergeArray(t,r)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Te.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Te({items:e,typeName:Je.ZodTuple,rest:null,...E(t)})};var Oe=class e extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==c.object)return k(a,{code:p.invalid_type,expected:c.object,received:a.parsedType}),A;const r=[],n=this._def.keyType,s=this._def.valueType;for(const e in a.data)r.push({key:n._parse(new C(a,e,a.path,e)),value:s._parse(new C(a,a.data[e],a.path,e)),alwaysSet:e in a.data});return a.common.async?Z.mergeObjectAsync(t,r):Z.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(t,a,r){return new e(a instanceof M?{keyType:t,valueType:a,typeName:Je.ZodRecord,...E(r)}:{keyType:se.create(),valueType:t,typeName:Je.ZodRecord,...E(a)})}},Pe=class extends M{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==c.map)return k(a,{code:p.invalid_type,expected:c.map,received:a.parsedType}),A;const r=this._def.keyType,n=this._def.valueType,s=[...a.data.entries()].map(([e,t],s)=>({key:r._parse(new C(a,e,a.path,[s,"key"])),value:n._parse(new C(a,t,a.path,[s,"value"]))}));if(a.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const a of s){const r=await a.key,n=await a.value;if("aborted"===r.status||"aborted"===n.status)return A;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}})}{const e=new Map;for(const a of s){const r=a.key,n=a.value;if("aborted"===r.status||"aborted"===n.status)return A;"dirty"!==r.status&&"dirty"!==n.status||t.dirty(),e.set(r.value,n.value)}return{status:t.value,value:e}}}};Pe.create=(e,t,a)=>new Pe({valueType:t,keyType:e,typeName:Je.ZodMap,...E(a)});var Se=class e extends M{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==c.set)return k(a,{code:p.invalid_type,expected:c.set,received:a.parsedType}),A;const r=this._def;null!==r.minSize&&a.data.size<r.minSize.value&&(k(a,{code:p.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&a.data.size>r.maxSize.value&&(k(a,{code:p.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const n=this._def.valueType;function s(e){const a=new Set;for(const r of e){if("aborted"===r.status)return A;"dirty"===r.status&&t.dirty(),a.add(r.value)}return{status:t.value,value:a}}const i=[...a.data.values()].map((e,t)=>n._parse(new C(a,e,a.path,t)));return a.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(t,a){return new e({...this._def,minSize:{value:t,message:x.toString(a)}})}max(t,a){return new e({...this._def,maxSize:{value:t,message:x.toString(a)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Se.create=(e,t)=>new Se({valueType:e,minSize:null,maxSize:null,typeName:Je.ZodSet,...E(t)});var je=class e extends M{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.function)return k(t,{code:p.invalid_type,expected:c.function,received:t.parsedType}),A;function a(e,a){return _({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,v(),f].filter(e=>!!e),issueData:{code:p.invalid_arguments,argumentsError:a}})}function r(e,a){return _({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,v(),f].filter(e=>!!e),issueData:{code:p.invalid_return_type,returnTypeError:a}})}const n={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Me){const e=this;return O(async function(...t){const i=new h([]),o=await e._def.args.parseAsync(t,n).catch(e=>{throw i.addIssue(a(t,e)),i}),d=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(d,n).catch(e=>{throw i.addIssue(r(d,e)),i})})}{const e=this;return O(function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new h([a(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,n);if(!d.success)throw new h([r(o,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Te.create(t).rest(fe.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,a,r){return new e({args:t||Te.create([]).rest(fe.create()),returns:a||fe.create(),typeName:Je.ZodFunction,...E(r)})}},Ne=class extends M{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Ne.create=(e,t)=>new Ne({getter:e,typeName:Je.ZodLazy,...E(t)});var Ce=class extends M{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return k(t,{received:t.data,code:p.invalid_literal,expected:this._def.value}),A}return{status:"valid",value:e.data}}get value(){return this._def.value}};function $e(e,t){return new Ee({values:e,typeName:Je.ZodEnum,...E(t)})}Ce.create=(e,t)=>new Ce({value:e,typeName:Je.ZodLiteral,...E(t)});var Ee=class e extends M{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return k(t,{expected:i.joinValues(a),received:t.parsedType,code:p.invalid_type}),A}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return k(t,{received:t.data,code:p.invalid_enum_value,options:a}),A}return O(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,a=this._def){return e.create(t,{...this._def,...a})}exclude(t,a=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...a})}};Ee.create=$e;var Ie=class extends M{_parse(e){const t=i.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==c.string&&a.parsedType!==c.number){const e=i.objectValues(t);return k(a,{expected:i.joinValues(e),received:a.parsedType,code:p.invalid_type}),A}if(this._cache||(this._cache=new Set(i.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=i.objectValues(t);return k(a,{received:a.data,code:p.invalid_enum_value,options:e}),A}return O(e.data)}get enum(){return this._def.values}};Ie.create=(e,t)=>new Ie({values:e,typeName:Je.ZodNativeEnum,...E(t)});var Me=class extends M{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==c.promise&&!1===t.common.async)return k(t,{code:p.invalid_type,expected:c.promise,received:t.parsedType}),A;const a=t.parsedType===c.promise?t.data:Promise.resolve(t.data);return O(a.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Me.create=(e,t)=>new Me({type:e,typeName:Je.ZodPromise,...E(t)});var Re=class extends M{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Je.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:e=>{k(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===r.type){const e=r.transform(a.data,n);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return A;const r=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===r.status?A:"dirty"===r.status||"dirty"===t.value?T(r.value):r});{if("aborted"===t.value)return A;const r=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===r.status?A:"dirty"===r.status||"dirty"===t.value?T(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,n);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const r=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===r.status?A:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(a=>"aborted"===a.status?A:("dirty"===a.status&&t.dirty(),e(a.value).then(()=>({status:t.value,value:a.value}))))}if("transform"===r.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!j(e))return A;const s=r.transform(e.value,n);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>j(e)?Promise.resolve(r.transform(e.value,n)).then(e=>({status:t.value,value:e})):A)}i.assertNever(r)}};Re.create=(e,t,a)=>new Re({schema:e,typeName:Je.ZodEffects,effect:t,...E(a)}),Re.createWithPreprocess=(e,t,a)=>new Re({schema:t,effect:{type:"preprocess",transform:e},typeName:Je.ZodEffects,...E(a)});var Le=class extends M{_parse(e){return this._getType(e)===c.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Le.create=(e,t)=>new Le({innerType:e,typeName:Je.ZodOptional,...E(t)});var ze=class extends M{_parse(e){return this._getType(e)===c.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ze.create=(e,t)=>new ze({innerType:e,typeName:Je.ZodNullable,...E(t)});var Fe=class extends M{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===c.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Fe.create=(e,t)=>new Fe({innerType:e,typeName:Je.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...E(t)});var De=class extends M{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return N(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new h(a.common.issues)},input:a.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new h(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};De.create=(e,t)=>new De({innerType:e,typeName:Je.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...E(t)});var Ue=class extends M{_parse(e){if(this._getType(e)!==c.nan){const t=this._getOrReturnCtx(e);return k(t,{code:p.invalid_type,expected:c.nan,received:t.parsedType}),A}return{status:"valid",value:e.data}}};Ue.create=e=>new Ue({typeName:Je.ZodNaN,...E(e)});var Ve=Symbol("zod_brand"),Be=class extends M{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}},Ke=class e extends M{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?A:"dirty"===e.status?(t.dirty(),T(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?A:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(t,a){return new e({in:t,out:a,typeName:Je.ZodPipeline})}},qe=class extends M{_parse(e){const t=this._def.innerType._parse(e),a=e=>(j(e)&&(e.value=Object.freeze(e.value)),e);return N(t)?t.then(e=>a(e)):a(t)}unwrap(){return this._def.innerType}};function We(e,t){const a="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof a?{message:a}:a}function Xe(e,t={},a){return e?he.create().superRefine((r,n)=>{var s,i;const o=e(r);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=We(t,r),o=null==(i=null!=(s=e.fatal)?s:a)||i;n.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=We(t,r),o=null==(i=null!=(s=e.fatal)?s:a)||i;n.addIssue({code:"custom",...e,fatal:o})}}):he.create()}qe.create=(e,t)=>new qe({innerType:e,typeName:Je.ZodReadonly,...E(t)});var Je,Ge,He={object:be.lazycreate};(Ge=Je||(Je={})).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 Ye=(e,t={message:`Input not instance of ${e.name}`})=>Xe(t=>t instanceof e,t),Qe=se.create,et=oe.create,tt=Ue.create,at=de.create,rt=ue.create,nt=ce.create,st=le.create,it=pe.create,ot=me.create,dt=he.create,ut=fe.create,ct=ye.create,lt=ge.create,pt=ve.create,mt=be.create,ht=be.strictCreate,ft=ke.create,yt=we.create,gt=Ae.create,vt=Te.create,_t=Oe.create,bt=Pe.create,kt=Se.create,xt=je.create,wt=Ne.create,Zt=Ce.create,At=Ee.create,Tt=Ie.create,Ot=Me.create,Pt=Re.create,St=Le.create,jt=ze.create,Nt=Re.createWithPreprocess,Ct=Ke.create,$t=()=>Qe().optional(),Et=()=>et().optional(),It=()=>rt().optional(),Mt={string:e=>se.create({...e,coerce:!0}),number:e=>oe.create({...e,coerce:!0}),boolean:e=>ue.create({...e,coerce:!0}),bigint:e=>de.create({...e,coerce:!0}),date:e=>ce.create({...e,coerce:!0})},Rt=A,Lt=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),a=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,a])=>[a._def,{def:a._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Dt(e,t,a,r){(null==r?void 0:r.errorMessages)&&a&&(e.errorMessage={...e.errorMessage,[t]:a})}function Ut(e,t,a,r,n){e[t]=a,Dt(e,t,r,n)}var Vt=(e,t)=>{let a=0;for(;a<e.length&&a<t.length&&e[a]===t[a];a++);return[(e.length-a).toString(),...t.slice(a)].join("/")};function Bt(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Vt(t,e.currentPath):t.join("/")}}function Kt(e,t){return va(e.type._def,t)}function qt(e,t,a){const r=null!=a?a:t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map((a,r)=>qt(e,t,a))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Wt(e,t)}}var Wt=(e,t)=>{const a={type:"integer",format:"unix-time"};if("openApi3"===t.target)return a;for(const r of e.checks)switch(r.kind){case"min":Ut(a,"minimum",r.value,r.message,t);break;case"max":Ut(a,"maximum",r.value,r.message,t)}return a};var Xt=void 0,Jt=/^[cC][^\s-]{8,}$/,Gt=/^[0-9a-z]+$/,Ht=/^[0-9A-HJKMNP-TV-Z]{26}$/,Yt=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Qt=()=>(void 0===Xt&&(Xt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Xt),ea=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ta=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,aa=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ra=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,na=/^[a-zA-Z0-9_-]{21}$/,sa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function ia(e,t){const a={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":Ut(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,r.value):r.value,r.message,t);break;case"max":Ut(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":ua(a,"email",r.message,t);break;case"format:idn-email":ua(a,"idn-email",r.message,t);break;case"pattern:zod":ca(a,Yt,r.message,t)}break;case"url":ua(a,"uri",r.message,t);break;case"uuid":ua(a,"uuid",r.message,t);break;case"regex":ca(a,r.regex,r.message,t);break;case"cuid":ca(a,Jt,r.message,t);break;case"cuid2":ca(a,Gt,r.message,t);break;case"startsWith":ca(a,RegExp(`^${oa(r.value,t)}`),r.message,t);break;case"endsWith":ca(a,RegExp(`${oa(r.value,t)}$`),r.message,t);break;case"datetime":ua(a,"date-time",r.message,t);break;case"date":ua(a,"date",r.message,t);break;case"time":ua(a,"time",r.message,t);break;case"duration":ua(a,"duration",r.message,t);break;case"length":Ut(a,"minLength","number"==typeof a.minLength?Math.max(a.minLength,r.value):r.value,r.message,t),Ut(a,"maxLength","number"==typeof a.maxLength?Math.min(a.maxLength,r.value):r.value,r.message,t);break;case"includes":ca(a,RegExp(oa(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&ua(a,"ipv4",r.message,t),"v4"!==r.version&&ua(a,"ipv6",r.message,t);break;case"base64url":ca(a,ra,r.message,t);break;case"jwt":ca(a,sa,r.message,t);break;case"cidr":"v6"!==r.version&&ca(a,ea,r.message,t),"v4"!==r.version&&ca(a,ta,r.message,t);break;case"emoji":ca(a,Qt(),r.message,t);break;case"ulid":ca(a,Ht,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":ua(a,"binary",r.message,t);break;case"contentEncoding:base64":Ut(a,"contentEncoding","base64",r.message,t);break;case"pattern:zod":ca(a,aa,r.message,t)}break;case"nanoid":ca(a,na,r.message,t)}return a}function oa(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let a=0;a<e.length;a++)da.has(e[a])||(t+="\\"),t+=e[a];return t}(e):e}var da=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ua(e,t,a,r){var n;e.format||(null==(n=e.anyOf)?void 0:n.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...a&&r.errorMessages&&{errorMessage:{format:a}}})):Ut(e,"format",t,a,r)}function ca(e,t,a,r){var n;e.pattern||(null==(n=e.allOf)?void 0:n.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:la(t,r),...a&&r.errorMessages&&{errorMessage:{pattern:a}}})):Ut(e,"pattern",la(t,r),a,r)}function la(e,t){var a;if(!t.applyRegexFlags||!e.flags)return e.source;const r=e.flags.includes("i"),n=e.flags.includes("m"),s=e.flags.includes("s"),i=r?e.source.toLowerCase():e.source;let o="",d=!1,u=!1,c=!1;for(let e=0;e<i.length;e++)if(d)o+=i[e],d=!1;else{if(r)if(u){if(i[e].match(/[a-z]/)){c?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),c=!1):"-"===i[e+1]&&(null==(a=i[e+2])?void 0:a.match(/[a-z]/))?(o+=i[e],c=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(n){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=u?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?d=!0:u&&"]"===i[e]?u=!1:u||"["!==i[e]||(u=!0))}try{new RegExp(o)}catch(a){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function pa(e,t){var a,r,n,s,i,o,d;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(a=e.keyType)?void 0:a._def.typeName)===Je.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((a,r)=>{var n;return{...a,[r]:null!=(n=va(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]}))?n:Bt(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(r=va(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(n=e.keyType)?void 0:n._def.typeName)===Je.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:a,...r}=ia(e.keyType._def,t);return{...u,propertyNames:r}}if((null==(i=e.keyType)?void 0:i._def.typeName)===Je.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Je.ZodBranded&&e.keyType._def.type._def.typeName===Je.ZodString&&(null==(d=e.keyType._def.type._def.checks)?void 0:d.length)){const{type:a,...r}=Kt(e.keyType._def,t);return{...u,propertyNames:r}}return u}var ma={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var ha=(e,t)=>{const a=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,a)=>va(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${a}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return a.length?{anyOf:a}:void 0};function fa(e,t){const a="openAi"===t.target,r={type:"object",properties:{}},n=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=ya(i);o&&a&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const d=va(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==d&&(r.properties[e]=d,o||n.push(e))}n.length&&(r.required=n);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return va(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==i&&(r.additionalProperties=i),r}function ya(e){try{return e.isOptional()}catch(e){return!0}}var ga=(e,t,a)=>{switch(t){case Je.ZodString:return ia(e,a);case Je.ZodNumber:return function(e,t){const a={type:"number"};if(!e.checks)return a;for(const r of e.checks)switch(r.kind){case"int":a.type="integer",Dt(a,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?Ut(a,"minimum",r.value,r.message,t):Ut(a,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(a.exclusiveMinimum=!0),Ut(a,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Ut(a,"maximum",r.value,r.message,t):Ut(a,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(a.exclusiveMaximum=!0),Ut(a,"maximum",r.value,r.message,t));break;case"multipleOf":Ut(a,"multipleOf",r.value,r.message,t)}return a}(e,a);case Je.ZodObject:return fa(e,a);case Je.ZodBigInt:return function(e,t){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?Ut(a,"minimum",r.value,r.message,t):Ut(a,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(a.exclusiveMinimum=!0),Ut(a,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Ut(a,"maximum",r.value,r.message,t):Ut(a,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(a.exclusiveMaximum=!0),Ut(a,"maximum",r.value,r.message,t));break;case"multipleOf":Ut(a,"multipleOf",r.value,r.message,t)}return a}(e,a);case Je.ZodBoolean:return{type:"boolean"};case Je.ZodDate:return qt(e,a);case Je.ZodUndefined:return function(e){return{not:Bt(e)}}(a);case Je.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(a);case Je.ZodArray:return function(e,t){var a,r,n;const s={type:"array"};return(null==(a=e.type)?void 0:a._def)&&(null==(n=null==(r=e.type)?void 0:r._def)?void 0:n.typeName)!==Je.ZodAny&&(s.items=va(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Ut(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Ut(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Ut(s,"minItems",e.exactLength.value,e.exactLength.message,t),Ut(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,a);case Je.ZodUnion:case Je.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return ha(e,t);const a=e.options instanceof Map?Array.from(e.options.values()):e.options;if(a.every(e=>e._def.typeName in ma&&(!e._def.checks||!e._def.checks.length))){const e=a.reduce((e,t)=>{const a=ma[t._def.typeName];return a&&!e.includes(a)?[...e,a]:e},[]);return{type:e.length>1?e:e[0]}}if(a.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=a.reduce((e,t)=>{const a=typeof t._def.value;switch(a){case"string":case"number":case"boolean":return[...e,a];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===a.length){const t=e.filter((e,t,a)=>a.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:a.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(a.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:a.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return ha(e,t)}(e,a);case Je.ZodIntersection:return function(e,t){const a=[va(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),va(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const n=[];return a.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:a,...r}=e;t=r}else r=void 0;n.push(t)}else n.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);var t}),n.length?{allOf:n,...r}:void 0}(e,a);case Je.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,a)=>va(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:va(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,a)=>va(e._def,{...t,currentPath:[...t.currentPath,"items",`${a}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,a);case Je.ZodRecord:return pa(e,a);case Je.ZodLiteral:return function(e,t){const a=typeof e.value;return"bigint"!==a&&"number"!==a&&"boolean"!==a&&"string"!==a?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===a?"integer":a,enum:[e.value]}:{type:"bigint"===a?"integer":a,const:e.value}}(e,a);case Je.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Je.ZodNativeEnum:return function(e){const t=e.values,a=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(a.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:a}}(e);case Je.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:ma[e.innerType._def.typeName],nullable:!0}:{type:[ma[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const a=va(e.innerType._def,{...t,currentPath:[...t.currentPath]});return a&&"$ref"in a?{allOf:[a],nullable:!0}:a&&{...a,nullable:!0}}const a=va(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return a&&{anyOf:[a,{type:"null"}]}}(e,a);case Je.ZodOptional:return((e,t)=>{var a;if(t.currentPath.toString()===(null==(a=t.propertyPath)?void 0:a.toString()))return va(e.innerType._def,t);const r=va(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Bt(t)},r]}:Bt(t)})(e,a);case Je.ZodMap:return function(e,t){return"record"===t.mapStrategy?pa(e,t):{type:"array",maxItems:125,items:{type:"array",items:[va(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Bt(t),va(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Bt(t)],minItems:2,maxItems:2}}}(e,a);case Je.ZodSet:return function(e,t){const a={type:"array",uniqueItems:!0,items:va(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Ut(a,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Ut(a,"maxItems",e.maxSize.value,e.maxSize.message,t),a}(e,a);case Je.ZodLazy:return()=>e.getter()._def;case Je.ZodPromise:return function(e,t){return va(e.type._def,t)}(e,a);case Je.ZodNaN:case Je.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Bt({...e,currentPath:[...e.currentPath,"not"]})}}(a);case Je.ZodEffects:return function(e,t){return"input"===t.effectStrategy?va(e.schema._def,t):Bt(t)}(e,a);case Je.ZodAny:return Bt(a);case Je.ZodUnknown:return function(e){return Bt(e)}(a);case Je.ZodDefault:return function(e,t){return{...va(e.innerType._def,t),default:e.defaultValue()}}(e,a);case Je.ZodBranded:return Kt(e,a);case Je.ZodReadonly:case Je.ZodCatch:return((e,t)=>va(e.innerType._def,t))(e,a);case Je.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return va(e.in._def,t);if("output"===t.pipeStrategy)return va(e.out._def,t);const a=va(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[a,va(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",a?"1":"0"]})].filter(e=>void 0!==e)}})(e,a);case Je.ZodFunction:case Je.ZodVoid:case Je.ZodSymbol:default:return}};function va(e,t,a=!1){var r;const n=t.seen.get(e);if(t.override){const s=null==(r=t.override)?void 0:r.call(t,e,t,n,a);if(s!==Lt)return s}if(n&&!a){const e=_a(n,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=ga(e,e.typeName,t),o="function"==typeof i?va(i(),t):i;if(o&&ba(e,t,o),t.postProcess){const a=t.postProcess(o,e,t);return s.jsonSchema=o,a}return s.jsonSchema=o,o}var _a=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Vt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,a)=>t.currentPath[a]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Bt(t)):"seen"===t.$refStrategy?Bt(t):void 0}},ba=(e,t,a)=>(e.description&&(a.description=e.description,t.markdownDescription&&(a.markdownDescription=e.description)),a),ka=(e,t)=>{var a;const r=Ft(t);let n="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,a])=>{var n;return{...e,[t]:null!=(n=va(a._def,{...r,currentPath:[...r.basePath,r.definitionPath,t]},!0))?n:Bt(r)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(a=va(e._def,void 0===s?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))?a:Bt(r),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),r.flags.hasReferencedOpenAiAnyType&&(n||(n={}),n[r.openAiAnyTypeName]||(n[r.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===r.$refStrategy?"1":[...r.basePath,r.definitionPath,r.openAiAnyTypeName].join("/")}}));const d=void 0===s?n?{...i,[r.definitionPath]:n}:i:{$ref:[..."relative"===r.$refStrategy?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...n,[s]:i}};return"jsonSchema7"===r.target?d.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==r.target&&"openAi"!==r.target||(d.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===r.target&&("anyOf"in d||"oneOf"in d||"allOf"in d||"type"in d&&Array.isArray(d.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),d},xa=u.record(u.string(),u.boolean()).describe("Consent requirement mapping"),wa=u.lazy(()=>u.union([u.string(),u.number(),u.boolean(),Oa,u.array(wa)])),Za=u.tuple([wa,wa]).describe("Loop: [source, transform] tuple for array transformations"),Aa=u.array(wa).describe("Set: Array of values"),Ta=u.record(u.string(),wa).describe("Map: Object mapping keys to values"),Oa=u.object({key:u.string().optional().describe('Property path (e.g., "data.id")'),value:u.union([u.string(),u.number(),u.boolean()]).optional().describe("Static primitive value"),fn:u.string().optional().describe("Function string for custom transformation"),map:Ta.optional().describe("Object with key-value mappings"),loop:Za.optional().describe("Tuple [source, transform]"),set:Aa.optional().describe("Array of values"),consent:xa.optional().describe("Required consent states"),condition:u.string().optional().describe("Condition function string"),validate:u.string().optional().describe("Validation function string")}).refine(e=>Object.keys(e).length>0,{message:"ValueConfig must have at least one property"}).describe("Value configuration for transformations"),Pa=Za,Sa=Aa,ja=Ta;ka(Oa,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),ka(Pa,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),ka(Sa,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),ka(ja,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"});function Na(e){return Array.isArray(e)}function Ca(e){return"object"==typeof e&&null!==e&&!Na(e)&&"[object Object]"===Object.prototype.toString.call(e)}function $a(e){return"string"==typeof e}function Ea(e,t,a){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==a||a()}}}var Ia=!1;function Ma(e,t={},a){if(t.filter){if(!0===Ea(()=>t.filter(a),()=>!1)())return}const r=function(e){if(Ca(e)&&$a(e.event)){const{event:t,...a}=e;return{name:t,...a}}if(Na(e)&&e.length>=2)return Ra(e);if(t=e,null!=t&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0){return Ra(Array.from(e))}var t;return null}(a);if(!r)return;const n=`${t.prefix||"dataLayer"} ${r.name}`,{name:s,...i}=r,o={name:n,data:i};Ea(()=>e(o),()=>{})()}function Ra(e){const[t,a,r]=e;if(!$a(t))return null;let n,s={};switch(t){case"consent":if(!$a(a)||e.length<3)return null;if("default"!==a&&"update"!==a)return null;if(!Ca(r)||null===r)return null;n=`${t} ${a}`,s={...r};break;case"event":if(!$a(a))return null;n=a,Ca(r)&&(s={...r});break;case"config":if(!$a(a))return null;n=`${t} ${a}`,Ca(r)&&(s={...r});break;case"set":if($a(a))n=`${t} ${a}`,Ca(r)&&(s={...r});else{if(!Ca(a))return null;n=`${t} custom`,s={...a}}break;default:return null}return{name:n,...s}}var La={},za={};n(za,{push:()=>Ua});var Fa=()=>{},Da=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Ua={get push(){return Da()},get command(){return Da()},get elb(){return Da()},get window(){return{dataLayer:[],addEventListener:Fa,removeEventListener:Fa}}},Va={};function Ba(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function Ka(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function qa(){return["event","purchase",{transaction_id:"T_12345",value:25.42,currency:"EUR",items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",quantity:1,price:25.42}]}]}function Wa(){return["event","add_to_cart",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_variant:"red",quantity:1,price:15.25}]}]}function Xa(){return["event","view_item",{currency:"EUR",value:15.25,items:[{item_id:"SKU_12345",item_name:"Product Name",item_category:"Category",price:15.25}]}]}function Ja(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function Ga(){return["set",{currency:"EUR",country:"DE"}]}function Ha(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}n(Va,{add_to_cart:()=>Wa,config:()=>Ja,consentDefault:()=>Ka,consentUpdate:()=>Ba,directDataLayerEvent:()=>Ha,purchase:()=>qa,setCustom:()=>Ga,view_item:()=>Xa});var Ya={};n(Ya,{add_to_cart:()=>ar,config:()=>ir,configGA4:()=>nr,consentOnlyMapping:()=>or,consentUpdate:()=>er,customEvent:()=>sr,purchase:()=>tr,view_item:()=>rr});var Qa,er={name:"walker consent",settings:{command:{map:{functional:{value:!0},analytics:{key:"analytics_storage",fn:e=>"granted"===e},marketing:{key:"ad_storage",fn:e=>"granted"===e}}}}},tr={name:"order complete",data:{map:{id:"transaction_id",total:"value",currency:"currency",nested:{loop:["items",{map:{type:{value:"product"},data:{map:{id:"item_id",name:"item_name",category:"item_category",quantity:"quantity",price:"price"}}}}]}}}},ar={name:"product add",data:{map:{id:"items.0.item_id",name:"items.0.item_name",price:"value",currency:"currency",color:"items.0.item_variant",quantity:"items.0.quantity"}}},rr={name:"product view",data:{map:{id:"items.0.item_id",name:"items.0.item_name",category:"items.0.item_category",price:"items.0.price",currency:"currency"}}},nr={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},sr={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},ir={consent:{update:er},purchase:tr,add_to_cart:ar,view_item:rr,"config G-XXXXXXXXXX":nr,custom_event:sr,"*":{data:{}}},or={consent:{update:er}},dr=async(e,t)=>{const{elb:a,window:r}=t,n={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},s={settings:n};return r&&(function(e,t){const a=t.settings,r=(null==a?void 0:a.name)||"dataLayer",n=window[r];if(Array.isArray(n)&&!Ia){Ia=!0;try{for(const t of n)Ma(e,a,t)}finally{Ia=!1}}}(a,s),function(e,t){const a=t.settings,r=(null==a?void 0:a.name)||"dataLayer";window[r]||(window[r]=[]);const n=window[r];if(!Array.isArray(n))return;const s=n.push.bind(n);n.push=function(...t){if(Ia)return s(...t);Ia=!0;try{for(const r of t)Ma(e,a,r)}finally{Ia=!1}return s(...t)}}(a,s)),{type:"dataLayer",config:s,push:a,destroy:async()=>{const e=n.name||"dataLayer";r&&r[e]&&Array.isArray(r[e])}}},ur=dr;return Qa=s,((n,s,i,o)=>{if(s&&"object"==typeof s||"function"==typeof s)for(let d of a(s))r.call(n,d)||d===i||e(n,d,{get:()=>s[d],enumerable:!(o=t(s,d))||o.enumerable});return n})(e({},"__esModule",{value:!0}),Qa)})();
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Source, WalkerOS, Mapping } from '@walkeros/core';
1
+ import { Source, WalkerOS, Elb, Mapping as Mapping$1 } from '@walkeros/core';
2
2
 
3
3
  declare global {
4
4
  interface Window {
@@ -6,15 +6,19 @@ declare global {
6
6
  [key: string]: DataLayer | unknown;
7
7
  }
8
8
  }
9
- interface DataLayerSourceConfig extends Source.Config {
10
- settings: Settings;
11
- }
12
9
  type DataLayer = Array<unknown>;
13
10
  interface Settings extends Record<string, unknown> {
14
11
  name?: string;
15
12
  prefix?: string;
16
13
  filter?: (event: unknown) => WalkerOS.PromiseOrValue<boolean>;
17
14
  }
15
+ interface Mapping {
16
+ }
17
+ type Push = Elb.Fn;
18
+ interface Env extends Source.BaseEnv {
19
+ window?: Window & typeof globalThis;
20
+ }
21
+ type Types = Source.Types<Settings, Mapping, Push, Env>;
18
22
  type DataLayerEvent = {
19
23
  event: string;
20
24
  [key: string]: unknown;
@@ -31,11 +35,33 @@ type MappedEvent = {
31
35
 
32
36
  type index_DataLayer = DataLayer;
33
37
  type index_DataLayerEvent = DataLayerEvent;
34
- type index_DataLayerSourceConfig = DataLayerSourceConfig;
38
+ type index_Env = Env;
35
39
  type index_MappedEvent = MappedEvent;
40
+ type index_Mapping = Mapping;
41
+ type index_Push = Push;
36
42
  type index_Settings = Settings;
43
+ type index_Types = Types;
37
44
  declare namespace index {
38
- export type { index_DataLayer as DataLayer, index_DataLayerEvent as DataLayerEvent, index_DataLayerSourceConfig as DataLayerSourceConfig, index_MappedEvent as MappedEvent, index_Settings as Settings };
45
+ export type { index_DataLayer as DataLayer, index_DataLayerEvent as DataLayerEvent, index_Env as Env, index_MappedEvent as MappedEvent, index_Mapping as Mapping, index_Push as Push, index_Settings as Settings, index_Types as Types };
46
+ }
47
+
48
+ /**
49
+ * Environment interface for dataLayer source
50
+ */
51
+ interface DataLayerEnv extends Source.BaseEnv {
52
+ window?: typeof window;
53
+ }
54
+ /**
55
+ * Standard mock environment for testing dataLayer source
56
+ *
57
+ * Use this for testing dataLayer.push interception and event transformation
58
+ * without requiring a real browser environment.
59
+ */
60
+ declare const push: DataLayerEnv;
61
+
62
+ declare const env_push: typeof push;
63
+ declare namespace env {
64
+ export { env_push as push };
39
65
  }
40
66
 
41
67
  /**
@@ -77,33 +103,33 @@ declare namespace events {
77
103
  * Consent Mode Mapping - Primary use case
78
104
  * Maps gtag consent events to walker consent commands
79
105
  */
80
- declare const consentUpdate: Mapping.Rule;
106
+ declare const consentUpdate: Mapping$1.Rule;
81
107
  /**
82
108
  * E-commerce Event Mappings
83
109
  * Transform GA4 ecommerce events to WalkerOS events
84
110
  */
85
- declare const purchase: Mapping.Rule;
86
- declare const add_to_cart: Mapping.Rule;
87
- declare const view_item: Mapping.Rule;
111
+ declare const purchase: Mapping$1.Rule;
112
+ declare const add_to_cart: Mapping$1.Rule;
113
+ declare const view_item: Mapping$1.Rule;
88
114
  /**
89
115
  * Config Event Mapping
90
116
  * Transform GA4 config events to WalkerOS page events
91
117
  */
92
- declare const configGA4: Mapping.Rule;
118
+ declare const configGA4: Mapping$1.Rule;
93
119
  /**
94
120
  * Custom Event Mapping
95
121
  * Handle direct dataLayer pushes
96
122
  */
97
- declare const customEvent: Mapping.Rule;
123
+ declare const customEvent: Mapping$1.Rule;
98
124
  /**
99
125
  * Complete mapping configuration
100
126
  * Following the same pattern as destination mappings
101
127
  */
102
- declare const config: Mapping.Rules;
128
+ declare const config: Mapping$1.Rules;
103
129
  /**
104
130
  * Minimal consent-only mapping for focused use cases
105
131
  */
106
- declare const consentOnlyMapping: Mapping.Rules;
132
+ declare const consentOnlyMapping: Mapping$1.Rules;
107
133
 
108
134
  declare const mapping_add_to_cart: typeof add_to_cart;
109
135
  declare const mapping_config: typeof config;
@@ -123,6 +149,6 @@ declare namespace mapping {
123
149
  * This source intercepts dataLayer.push calls and transforms them to WalkerOS events.
124
150
  * It works by replacing the dataLayer.push method with a custom handler.
125
151
  */
126
- declare const sourceDataLayer: Source.Init<DataLayerSourceConfig>;
152
+ declare const sourceDataLayer: Source.Init<Types>;
127
153
 
128
- export { events as Events, mapping as Mapping, index as SourceDataLayer, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples, sourceDataLayer as default, sourceDataLayer };
154
+ export { events as Events, mapping as Mapping, index as SourceDataLayer, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples, sourceDataLayer as default, env, sourceDataLayer };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Source, WalkerOS, Mapping } from '@walkeros/core';
1
+ import { Source, WalkerOS, Elb, Mapping as Mapping$1 } from '@walkeros/core';
2
2
 
3
3
  declare global {
4
4
  interface Window {
@@ -6,15 +6,19 @@ declare global {
6
6
  [key: string]: DataLayer | unknown;
7
7
  }
8
8
  }
9
- interface DataLayerSourceConfig extends Source.Config {
10
- settings: Settings;
11
- }
12
9
  type DataLayer = Array<unknown>;
13
10
  interface Settings extends Record<string, unknown> {
14
11
  name?: string;
15
12
  prefix?: string;
16
13
  filter?: (event: unknown) => WalkerOS.PromiseOrValue<boolean>;
17
14
  }
15
+ interface Mapping {
16
+ }
17
+ type Push = Elb.Fn;
18
+ interface Env extends Source.BaseEnv {
19
+ window?: Window & typeof globalThis;
20
+ }
21
+ type Types = Source.Types<Settings, Mapping, Push, Env>;
18
22
  type DataLayerEvent = {
19
23
  event: string;
20
24
  [key: string]: unknown;
@@ -31,11 +35,33 @@ type MappedEvent = {
31
35
 
32
36
  type index_DataLayer = DataLayer;
33
37
  type index_DataLayerEvent = DataLayerEvent;
34
- type index_DataLayerSourceConfig = DataLayerSourceConfig;
38
+ type index_Env = Env;
35
39
  type index_MappedEvent = MappedEvent;
40
+ type index_Mapping = Mapping;
41
+ type index_Push = Push;
36
42
  type index_Settings = Settings;
43
+ type index_Types = Types;
37
44
  declare namespace index {
38
- export type { index_DataLayer as DataLayer, index_DataLayerEvent as DataLayerEvent, index_DataLayerSourceConfig as DataLayerSourceConfig, index_MappedEvent as MappedEvent, index_Settings as Settings };
45
+ export type { index_DataLayer as DataLayer, index_DataLayerEvent as DataLayerEvent, index_Env as Env, index_MappedEvent as MappedEvent, index_Mapping as Mapping, index_Push as Push, index_Settings as Settings, index_Types as Types };
46
+ }
47
+
48
+ /**
49
+ * Environment interface for dataLayer source
50
+ */
51
+ interface DataLayerEnv extends Source.BaseEnv {
52
+ window?: typeof window;
53
+ }
54
+ /**
55
+ * Standard mock environment for testing dataLayer source
56
+ *
57
+ * Use this for testing dataLayer.push interception and event transformation
58
+ * without requiring a real browser environment.
59
+ */
60
+ declare const push: DataLayerEnv;
61
+
62
+ declare const env_push: typeof push;
63
+ declare namespace env {
64
+ export { env_push as push };
39
65
  }
40
66
 
41
67
  /**
@@ -77,33 +103,33 @@ declare namespace events {
77
103
  * Consent Mode Mapping - Primary use case
78
104
  * Maps gtag consent events to walker consent commands
79
105
  */
80
- declare const consentUpdate: Mapping.Rule;
106
+ declare const consentUpdate: Mapping$1.Rule;
81
107
  /**
82
108
  * E-commerce Event Mappings
83
109
  * Transform GA4 ecommerce events to WalkerOS events
84
110
  */
85
- declare const purchase: Mapping.Rule;
86
- declare const add_to_cart: Mapping.Rule;
87
- declare const view_item: Mapping.Rule;
111
+ declare const purchase: Mapping$1.Rule;
112
+ declare const add_to_cart: Mapping$1.Rule;
113
+ declare const view_item: Mapping$1.Rule;
88
114
  /**
89
115
  * Config Event Mapping
90
116
  * Transform GA4 config events to WalkerOS page events
91
117
  */
92
- declare const configGA4: Mapping.Rule;
118
+ declare const configGA4: Mapping$1.Rule;
93
119
  /**
94
120
  * Custom Event Mapping
95
121
  * Handle direct dataLayer pushes
96
122
  */
97
- declare const customEvent: Mapping.Rule;
123
+ declare const customEvent: Mapping$1.Rule;
98
124
  /**
99
125
  * Complete mapping configuration
100
126
  * Following the same pattern as destination mappings
101
127
  */
102
- declare const config: Mapping.Rules;
128
+ declare const config: Mapping$1.Rules;
103
129
  /**
104
130
  * Minimal consent-only mapping for focused use cases
105
131
  */
106
- declare const consentOnlyMapping: Mapping.Rules;
132
+ declare const consentOnlyMapping: Mapping$1.Rules;
107
133
 
108
134
  declare const mapping_add_to_cart: typeof add_to_cart;
109
135
  declare const mapping_config: typeof config;
@@ -123,6 +149,6 @@ declare namespace mapping {
123
149
  * This source intercepts dataLayer.push calls and transforms them to WalkerOS events.
124
150
  * It works by replacing the dataLayer.push method with a custom handler.
125
151
  */
126
- declare const sourceDataLayer: Source.Init<DataLayerSourceConfig>;
152
+ declare const sourceDataLayer: Source.Init<Types>;
127
153
 
128
- export { events as Events, mapping as Mapping, index as SourceDataLayer, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples, sourceDataLayer as default, sourceDataLayer };
154
+ export { events as Events, mapping as Mapping, index as SourceDataLayer, consentOnlyMapping, consentUpdate$1 as consentUpdateEvent, config as dataLayerExamples, sourceDataLayer as default, env, sourceDataLayer };