@walkeros/walker.js 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.
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var e,t,n=Object.getOwnPropertyNames,r=(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[n(e)[0]])((t={exports:{}}).exports,t),t.exports}),o={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},i={merge:!0,shallow:!0,extend:!0};function s(e,t={},n={}){n={...i,...n};const r=Object.entries(t).reduce((t,[r,o])=>{const i=e[r];return n.merge&&Array.isArray(i)&&Array.isArray(o)?t[r]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||r in e)&&(t[r]=o),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function a(e){return Array.isArray(e)}function c(e){return void 0!==e}function u(e){return"object"==typeof e&&null!==e&&!a(e)&&"[object Object]"===Object.prototype.toString.call(e)}function l(e){return"string"==typeof e}function d(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=d(e[r],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(d(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function f(e,t="",n){const r=t.split(".");let o=e;for(let e=0;e<r.length;e++){const t=r[e];if("*"===t&&a(o)){const t=r.slice(e+1).join("."),i=[];for(const e of o){const r=f(e,t,n);i.push(r)}return i}if(o=o instanceof Object?o[t]:void 0,!o)break}return c(o)?o:n}function p(e,t={},n={}){const r={...t,...n},o={};let i=void 0===e;return Object.keys(r).forEach(t=>{r[t]&&(o[t]=!0,e&&e[t]&&(i=!0))}),!!i&&o}var g,m,{version:y}=r();function h(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function w(e){return function(e){return"boolean"==typeof e}(e)||l(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!c(e)||a(e)&&e.every(w)||u(e)&&Object.values(e).every(w)}function b(e){return w(e)?e:void 0}function v(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function k(e,t,n){return async function(...r){try{return await e(...r)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function S(e,t={},n={}){var r;if(!c(e))return;const o=u(e)&&e.consent||n.consent||(null==(r=n.collector)?void 0:r.consent),i=a(t)?t:[t];for(const t of i){const r=await k(x)(e,t,{...n,consent:o});if(c(r))return r}}async function x(e,t,n={}){const{collector:r,consent:o}=n;return(a(t)?t:[t]).reduce(async(t,i)=>{const s=await t;if(s)return s;const u=l(i)?{key:i}:i;if(!Object.keys(u).length)return;const{condition:d,consent:g,fn:m,key:y,loop:h,map:w,set:v,validate:j,value:O}=u;if(d&&!await k(d)(e,i,r))return;if(g&&!p(g,o))return O;let _=c(O)?O:e;if(m&&(_=await k(m)(e,i,n)),y&&(_=f(e,y,O)),h){const[t,r]=h,o="this"===t?[e]:await S(e,t,n);a(o)&&(_=(await Promise.all(o.map(e=>S(e,r,n)))).filter(c))}else w?_=await Object.entries(w).reduce(async(t,[r,o])=>{const i=await t,s=await S(e,o,n);return c(s)&&(i[r]=s),i},Promise.resolve({})):v&&(_=await Promise.all(v.map(t=>x(e,t,n))));j&&!await k(j)(_)&&(_=void 0);const E=b(_);return c(E)?E:b(O)},Promise.resolve(void 0))}function j(e,t,n){return function(...r){let o;const i="post"+t,s=n["pre"+t],a=n[i];return o=s?s({fn:e},...r):e(...r),a&&(o=a({fn:e,result:o},...r)),o}}var O=Object.getOwnPropertyNames,_=(g={"package.json"(e,t){t.exports={name:"@walkeros/collector",description:"Unified platform-agnostic collector 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:{"@walkeros/core":"0.1.2"},devDependencies:{},repository:{url:"git+https://github.com/elbwalker/walkerOS.git",directory:"packages/collector"},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","collector","event processing"],funding:[{type:"GitHub Sponsors",url:"https://github.com/sponsors/elbwalker"}]}}},function(){return m||(0,g[O(g)[0]])((m={exports:{}}).exports,m),m.exports}),E={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"},L=E;function A(e,t,n,r){let o,i=n||[];switch(n||(i=e.on[t]||[]),t){case L.Consent:o=r||e.consent;break;case L.Session:o=e.session;break;case L.Ready:case L.Run:default:o=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&v(e.on)(t,o)}),Object.values(e.destinations).forEach(e=>{e.on&&v(e.on)(t,o)}),i.length)switch(t){case L.Consent:!function(e,t,n){const r=n||e.consent;t.forEach(t=>{Object.keys(r).filter(e=>e in t).forEach(n=>{v(t[n])(e,r)})})}(e,i,r);break;case L.Ready:case L.Run:a=i,(s=e).allowed&&a.forEach(e=>{v(e)(s)});break;case L.Session:!function(e,t){e.session&&t.forEach(t=>{v(t)(e,e.session)})}(e,i)}var s,a}async function $(e,t,n,r){let o;switch(t){case L.Config:u(n)&&s(e.config,n,{shallow:!1});break;case L.Consent:u(n)&&(o=await async function(e,t){const{consent:n}=e;let r=!1;const o={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;o[e]=n,r=r||n}),e.consent=s(n,o),A(e,"consent",void 0,o),r?q(e):R({ok:!0})}(e,n));break;case L.Custom:u(n)&&(e.custom=s(e.custom,n));break;case L.Destination:u(n)&&function(e){return"function"==typeof e}(n.push)&&(o=await async function(e,t,n){const{code:r,config:o={},env:i={}}=t,s=n||o||{init:!1},a={...r,config:s,env:I(r.env,i)};let c=a.config.id;if(!c)do{c=h(4)}while(e.destinations[c]);return e.destinations[c]=a,!1!==a.config.queue&&(a.queue=[...e.queue]),q(e,void 0,{[c]:a})}(e,{code:n},r));break;case L.Globals:u(n)&&(e.globals=s(e.globals,n));break;case L.On:l(n)&&function(e,t,n){const r=e.on,o=r[t]||[],i=a(n)?n:[n];i.forEach(e=>{o.push(e)}),r[t]=o,A(e,t,i)}(e,n,r);break;case L.Ready:A(e,"ready");break;case L.Run:o=await async function(e,t){e.allowed=!0,e.count=0,e.group=h(),e.timing=Date.now(),t&&(t.consent&&(e.consent=s(e.consent,t.consent)),t.user&&(e.user=s(e.user,t.user)),t.globals&&(e.globals=s(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=s(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await q(e);return A(e,"run"),n}(e,n);break;case L.Session:A(e,"session");break;case L.User:u(n)&&s(e.user,n,{shallow:!1})}return o||{ok:!0,successful:[],queued:[],failed:[]}}function C(e,t,n){return j(async(r,o,i)=>await k(async()=>{if("string"==typeof r&&r.startsWith("walker ")){const n=r.replace("walker ","");return await t(e,n,o,i)}{const s=n("string"==typeof r?{name:r}:r),{event:a,command:c}=function(e,t,n={}){const r=function(e){return typeof e==typeof""}(t)?{name:t,...n}:{...n,...t||{}};if(!r.name)throw new Error("Event name is required");const[o,i]=r.name.split(" ");if(!o||!i)throw new Error("Event name is invalid");if(o===E.Walker)return{command:i};++e.count;const{timestamp:s=Date.now(),group:a=e.group,count:c=e.count}=r,{name:u=`${o} ${i}`,data:l={},context:d={},globals:f=e.globals,custom:p={},user:g=e.user,nested:m=[],consent:y=e.consent,id:h=`${s}-${a}-${c}`,trigger:w="",entity:b=o,action:v=i,timing:k=0,version:S={source:e.version,tagging:e.config.tagging||0},source:x={type:"collector",id:"",previous_id:""}}=r;return{event:{name:u,data:l,context:d,globals:f,custom:p,user:g,nested:m,consent:y,id:h,trigger:w,entity:b,action:v,timestamp:s,timing:k,group:a,count:c,version:S,source:x}}}(e,s.name,s);return c?await t(e,c,o,i):await q(e,a)}},()=>R({ok:!1}))(),"Push",e.hooks)}async function q(e,t,n){const{allowed:r,consent:o,globals:i,user:a}=e;if(!r)return R({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const c=await Promise.all(Object.entries(n||{}).map(async([n,r])=>{let c=(r.queue||[]).map(e=>({...e,consent:o}));if(r.queue=[],t){let n=d(t);await Promise.all(Object.entries(r.config.policy||[]).map(async([r,o])=>{const i=await S(t,o,{collector:e});n=function(e,t,n){const r=d(e),o=t.split(".");let i=r;for(let e=0;e<o.length;e++){const t=o[e];e===o.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return r}(n,r,i)})),c.push(n)}if(!c.length)return{id:n,destination:r,skipped:!0};const u=[],l=c.filter(e=>{const t=p(r.config.consent,o,e.consent);return!t||(e.consent=t,u.push(e),!1)});if(r.queue.concat(l),!u.length)return{id:n,destination:r,queue:c};if(!await k(P)(e,r))return{id:n,destination:r,queue:c};let f=!1;return r.dlq||(r.dlq=[]),await Promise.all(u.map(async t=>(t.globals=s(i,t.globals),t.user=s(a,t.user),await k(D,n=>(e.config.onError&&e.config.onError(n,e),f=!0,r.dlq.push([t,n]),!1))(e,r,t),t))),{id:n,destination:r,error:f}})),u=[],l=[],f=[];for(const e of c){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?f.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),l.push(n)):u.push(n)}return R({ok:!f.length,event:t,successful:u,queued:l,failed:f})}async function P(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:I(t.env,t.config.env)},r=await j(t.init,"DestinationInit",e.hooks)(n);if(!1===r)return r;t.config={...r||t.config,init:!0}}return!0}async function D(e,t,n){var r;const{config:o}=t,{eventMapping:i,mappingKey:l}=await async function(e,t){var n;const[r,o]=(e.name||"").split(" ");if(!t||!r||!o)return{};let i,s="",c=r,u=o;const l=t=>{if(t)return(t=a(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[c]||(c="*");const d=t[c];return d&&(d[u]||(u="*"),i=l(d[u])),i||(c="*",u="*",i=l(null==(n=t[c])?void 0:n[u])),i&&(s=`${c} ${u}`),{eventMapping:i,mappingKey:s}}(n,o.mapping);let d=o.data&&await S(n,o.data,{collector:e});if(i){if(i.ignore)return!1;if(i.name&&(n.name=i.name),i.data){const t=i.data&&await S(n,i.data,{collector:e});d=u(d)&&u(t)?s(d,t):t}}const f={collector:e,config:o,data:d,mapping:i,env:I(t.env,o.env)};if((null==i?void 0:i.batch)&&t.pushBatch){const s=i.batched||{key:l||"",events:[],data:[]};s.events.push(n),c(d)&&s.data.push(d),i.batchFn=i.batchFn||function(e,t=1e3,n=!1){let r,o=null,i=!1;return(...s)=>new Promise(a=>{const c=n&&!i;o&&clearTimeout(o),o=setTimeout(()=>{o=null,n&&!i||(r=e(...s),a(r))},t),c&&(i=!0,r=e(...s),a(r))})}((e,t)=>{const n={collector:t,config:o,data:d,mapping:i,env:I(e.env,o.env)};j(e.pushBatch,"DestinationPushBatch",t.hooks)(s,n),s.events=[],s.data=[]},i.batch),i.batched=s,null==(r=i.batchFn)||r.call(i,t,e)}else await j(t.push,"DestinationPush",e.hooks)(n,f);return!0}function R(e){var t;return s({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function I(e,t){return e||t?t?e&&u(e)&&u(t)?{...e,...t}:t:e:{}}async function N(e={}){const t=await async function(e){const{version:t}=_(),n=s({globalsStatic:{},sessionStatic:{},tagging:0,verbose:!1,onLog:r,run:!0,sources:{},destinations:{},consent:{},user:{},globals:{},custom:{}},e,{merge:!1,extend:!1});function r(e,t){!function(e,t=!1){t&&console.dir(e,{depth:4})}({message:e},t||n.verbose)}n.onLog=r;const o={...n.globalsStatic,...n.globals},i={allowed:!1,config:n,consent:n.consent||{},count:0,custom:n.custom||{},destinations:{},globals:o,group:"",hooks:{},on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:n.user||{},version:t,sources:{},push:void 0};return i.push=C(i,$,e=>({timing:Math.round((Date.now()-i.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),i.sources=await async function(e,t={}){const n={};for(const[r,o]of Object.entries(t)){const{code:t,config:i={},env:s={}}=o,a={elb:(...t)=>e.push(...t),...s},c=await k(t)(i,a);c&&(n[r]=c)}return n}(i,n.sources),i.destinations=await async function(e,t={}){const n={};for(const[e,r]of Object.entries(t)){const{code:t,config:o={},env:i={}}=r,s={...t.config,...o},a=I(t.env,i);n[e]={...t,config:s,env:a}}return n}(0,n.destinations),i}(e),{consent:n,user:r,globals:o,custom:i}=e;return n&&await t.push("walker consent",n),r&&await t.push("walker user",r),o&&Object.assign(t.globals,o),i&&Object.assign(t.custom,i),t.config.run&&await t.push("walker run"),{collector:t,elb:t.push}}function W(e,t){return(e.getAttribute(t)||"").trim()}var X=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function M(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const r=window.innerHeight,o=e.getBoundingClientRect(),i=o.height,s=o.y,a=s+i,c={x:o.x+e.offsetWidth/2,y:o.y+e.offsetHeight/2};if(i<=r){if(e.offsetWidth+o.width===0||e.offsetHeight+o.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=r/2;if(s<0&&a<e)return!1;if(a>r&&s>e)return!1;n=document.elementFromPoint(c.x,r/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function U(e,t,n){return!1===n?e:(n||(n=G),n(e,t,G))}var T,H,G=(e,t)=>{const n=(null==t?void 0:t.push)||X,r={};return e.id&&(r.session=e.id),e.storage&&e.device&&(r.device=e.device),n("walker user",r),e.isStart&&n({name:"session start",data:e}),e};function B(e,t=o.Storage.Session){var n;function r(e){try{return JSON.parse(e||"")}catch(t){let n=1,r="";return e&&(n=0,r=e),{e:n,v:r}}}let i,s;switch(t){case o.Storage.Cookie:i=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case o.Storage.Local:s=r(window.localStorage.getItem(e));break;case o.Storage.Session:s=r(window.sessionStorage.getItem(e))}return s&&(i=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=o.Storage.Session){switch(t){case o.Storage.Cookie:K(e,"",0,t);break;case o.Storage.Local:window.localStorage.removeItem(e);break;case o.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),i="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(i||"")}function K(e,t,n=30,r=o.Storage.Session,i){const s={e:Date.now()+6e4*n,v:String(t)},a=JSON.stringify(s);switch(r){case o.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let r=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;i&&(r+="; domain="+i),document.cookie=r;break}case o.Storage.Local:window.localStorage.setItem(e,a);break;case o.Storage.Session:window.sessionStorage.setItem(e,a)}return B(e,r)}function F(e={}){const t=Date.now(),{length:n=30,deviceKey:r="elbDeviceId",deviceStorage:o="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:a="local",pulse:c=!1}=e,u=J(e);let l=!1;const d=v((e,t,n)=>{let r=B(e,n);return r||(r=h(8),K(e,r,1440*t,n)),String(r)})(r,i,o),f=v((e,r)=>{const o=JSON.parse(String(B(e,r)));return c||(o.isNew=!1,u.marketing&&(Object.assign(o,u),l=!0),l||o.updated+6e4*n<t?(delete o.id,delete o.referrer,o.start=t,o.count++,o.runs=1,l=!0):o.runs++),o},()=>{l=!0})(s,a)||{},p={id:h(12),start:t,isNew:!0,count:1,runs:1},g=Object.assign(p,u,f,{device:d},{isStart:l,storage:!0,updated:t},e.data);return K(s,JSON.stringify(g),2*n,a),g}function J(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const r=new URL(e.url||window.location.href),o=e.referrer||document.referrer,i=o&&new URL(o).hostname,a=function(e,t={}){const n="clickId",r={},o={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(s(o,t)).forEach(([t,o])=>{const i=e.searchParams.get(t);i&&(o===n&&(o=t,r[n]=t),r[o]=i)}),r}(r,e.parameters);if(Object.keys(a).length&&(a.marketing||(a.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(r.hostname),t=!n.includes(i)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:h(12),referrer:i},a,e.data):n}var z=Object.getOwnPropertyNames,V=(T={"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 H||(0,T[z(T)[0]])((H={exports:{}}).exports,H),H.exports}),Y={merge:!0,shallow:!0,extend:!0};function Q(e,t={},n={}){n={...Y,...n};const r=Object.entries(t).reduce((t,[r,o])=>{const i=e[r];return n.merge&&Array.isArray(i)&&Array.isArray(o)?t[r]=o.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||r in e)&&(t[r]=o),t},{});return n.shallow?{...e,...r}:(Object.assign(e,r),e)}function Z(e){return Array.isArray(e)}function ee(e){return e===document||e instanceof Element}function te(e){return"object"==typeof e&&null!==e&&!Z(e)&&"[object Object]"===Object.prototype.toString.call(e)}function ne(e){return"string"==typeof e}function re(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}var{version:oe}=V();function ie(e,t,n){return function(...r){try{return e(...r)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function se(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function ae(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function ce(e,t,n,r=!0){return be(W(t,ae(e,n,r))||"").reduce((e,n)=>{let[r,o]=ve(n);if(!r)return e;if(o||(r.endsWith(":")&&(r=r.slice(0,-1)),o=""),o.startsWith("#")){o=o.slice(1);try{let e=t[o];e||"selected"!==o||(e=t.options[t.selectedIndex].text),o=String(e)}catch(e){o=""}}return r.endsWith("[]")?(r=r.slice(0,-2),Z(e[r])||(e[r]=[]),e[r].push(re(o))):e[r]=re(o),e},{})}function ue(e,t=L.Prefix){var n;const r=e||("undefined"!=typeof document?document.body:void 0);if(!r)return[];let o=[];const i=L.Action,s=`[${ae(t,i,!1)}]`,a=e=>{Object.keys(ce(t,e,i,!1)).forEach(n=>{o=o.concat(le(e,n,t))})};return r!==("undefined"!=typeof document?document:null)&&(null==(n=r.matches)?void 0:n.call(r,s))&&a(r),we(r,s,a),o}function le(e,t,n=L.Prefix){const r=[],{actions:o,nearestOnly:i}=function(e,t,n){let r=t;for(;r;){const t=W(r,ae(e,L.Actions,!1));if(t){const e=pe(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const o=W(r,ae(e,L.Action,!1));if(o){const e=pe(o);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}r=ye(e,r)}return{actions:[],nearestOnly:!1}}(n,e,t);return o.length?(o.forEach(o=>{const s=be(o.actionParams||"",",").reduce((e,t)=>(e[se(t)]=!0,e),{}),a=ge(n,e,s,i);if(!a.length){const t="page",r=`[${ae(n,t)}]`,[o,i]=he(e,r,n,t);a.push({entity:t,data:o,nested:[],context:i})}a.forEach(e=>{r.push({entity:e.entity,action:o.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),r):r}function de(e=L.Prefix,t=document){const n=ae(e,L.Globals,!1);let r={};return we(t,`[${n}]`,t=>{r=Q(r,ce(e,t,L.Globals,!1))}),r}function fe(e,t){const n=window.location,r="page",o=t===document?document.body:t,[i,s]=he(o,`[${ae(e,r)}]`,e,r);return i.domain=n.hostname,i.title=document.title,i.referrer=document.referrer,n.search&&(i.search=n.search),n.hash&&(i.hash=n.hash),[i,s]}function pe(e){const t={};return be(e).forEach(e=>{const[n,r]=ve(e),[o,i]=ke(n);if(!o)return;let[s,a]=ke(r||"");s=s||o,t[o]||(t[o]=[]),t[o].push({trigger:o,triggerParams:i,action:s,actionParams:a})}),t}function ge(e,t,n,r=!1){const o=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=me(e,i,t,n);if(s&&(o.push(s),r))break;i=ye(e,i)}return o}function me(e,t,n,r){const o=W(t,ae(e));if(!o||r&&!r[o])return null;const i=[t],s=`[${ae(e,o)}],[${ae(e,"")}]`,a=ae(e,L.Link,!1);let c={};const u=[],[l,d]=he(n||t,s,e,o);we(t,`[${a}]`,t=>{const[n,r]=ve(W(t,a));"parent"===r&&we(document.body,`[${a}="${n}:child"]`,t=>{i.push(t);const n=me(e,t);n&&u.push(n)})});const f=[];i.forEach(e=>{e.matches(s)&&f.push(e),we(e,s,e=>f.push(e))});let p={};return f.forEach(t=>{p=Q(p,ce(e,t,"")),c=Q(c,ce(e,t,o))}),c=Q(Q(p,c),l),i.forEach(t=>{we(t,`[${ae(e)}]`,t=>{const n=me(e,t);n&&u.push(n)})}),{entity:o,data:c,context:d,nested:u}}function ye(e,t){const n=ae(e,L.Link,!1);if(t.matches(`[${n}]`)){const[e,r]=ve(W(t,n));if("child"===r)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function he(e,t,n,r){let o={};const i={};let s=e;const a=`[${ae(n,L.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(o=Q(ce(n,s,""),o),o=Q(ce(n,s,r),o)),s.matches(a)&&(Object.entries(ce(n,s,L.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=ye(n,s);return[o,i]}function we(e,t,n){e.querySelectorAll(t).forEach(n)}function be(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function ve(e){const[t,n]=e.split(/:(.+)/,2);return[se(t),se(n)]}function ke(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var Se=new WeakMap,xe=new WeakMap,je=new WeakMap;function Oe(e){const t=Date.now();let n=xe.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:M(e),lastChecked:t},xe.set(e,n)),n.isVisible}function _e(e){if(window.IntersectionObserver)return ie(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,r;const o=t.target,i=je.get(e);if(!i)return;const s=i.timers.get(o);if(t.intersectionRatio>0){const r=Date.now();let a=Se.get(o);if((!a||r-a.lastChecked>1e3)&&(a={isLarge:o.offsetHeight>window.innerHeight,lastChecked:r},Se.set(o,a)),t.intersectionRatio>=.5||a.isLarge&&Oe(o)){const t=null==(n=i.elementConfigs)?void 0:n.get(o);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(Oe(o)){const r=null==(t=i.elementConfigs)?void 0:t.get(o);(null==r?void 0:r.context)&&await Ue(r.context,o,r.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(o);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=je.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const r=n.timers.get(t);r&&(clearTimeout(r),n.timers.delete(t)),Se.delete(t),xe.delete(t)}(e,o)}},i.duration);i.timers.set(o,t)}return}}s&&(clearTimeout(s),i.timers.delete(o));const a=null==(r=i.elementConfigs)?void 0:r.get(o);(null==a?void 0:a.multiple)&&(a.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function Ee(e,t,n={multiple:!1}){var r;const o=e.settings.scope||document,i=je.get(o);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(r=n.multiple)&&r,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function Le(e){if(!e)return;const t=je.get(e);t&&(t.observer&&t.observer.disconnect(),je.delete(e))}var Ae,$e=performance.now();function Ce(e,t,n,r,o,i,s){const{elb:a,settings:c}=e;if(ne(t)&&t.startsWith("walker "))return a(t,n);if(te(t)){const e=t;return e.source||(e.source=qe()),e.globals||(e.globals=de(c.prefix,c.scope||document)),a(e)}const[u]=String(te(t)?t.name:t).split(" ");let l,d=te(n)?n:{},f={},p=!1;if(ee(n)&&(l=n,p=!0),ee(o)?l=o:te(o)&&Object.keys(o).length&&(f=o),l){const e=ge(c.prefix||"data-elb",l).find(e=>e.entity===u);e&&(p&&(d=e.data),f=e.context)}"page"===u&&(d.id=d.id||window.location.pathname);const g=de(c.prefix,c.scope);return a({name:String(t||""),data:d,context:f,globals:g,nested:i,custom:s,trigger:ne(r)?r:"",timing:Math.round((performance.now()-$e)/10)/100,source:qe()})}function qe(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var Pe=[],De="hover",Re="load",Ie="pulse",Ne="scroll",We="wait";function Xe(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",ie(function(t){He.call(this,e,t)})),n.addEventListener("submit",ie(function(t){Ge.call(this,e,t)})))}(e,t)}function Me(e,t){t.scope&&function(e,t){const n=t.scope;Pe=[];const r=n||document;Le(r),function(e,t=1e3){je.has(e)||je.set(e,{observer:_e(e),timers:new WeakMap,duration:t})}(r,1e3);const o=ae(t.prefix,L.Action,!1);r!==document&&Te(e,r,o,t),r.querySelectorAll(`[${o}]`).forEach(n=>{Te(e,n,o,t)}),Pe.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const r=window.scrollY+window.innerHeight,o=e.offsetTop;if(r<o)return!0;const i=e.clientHeight;return!(100*(1-(o+i-r)/(i||1))>=n&&(Ue(t,e,Ne),1))});Ae||(Ae=function(e,t=1e3){let n=null;return function(...r){if(null===n)return n=setTimeout(()=>{n=null},t),e(...r)}}(function(){Pe=n.call(t,Pe,e)}),t.addEventListener("scroll",Ae))}(e,r)}(e,t)}async function Ue(e,t,n){const r=le(t,n,e.settings.prefix);return Promise.all(r.map(t=>Ce(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Te(e,t,n,r){const o=W(t,n);o&&Object.values(pe(o)).forEach(n=>n.forEach(n=>{switch(n.trigger){case De:r=e,t.addEventListener("mouseenter",ie(function(e){e.target instanceof Element&&Ue(r,e.target,De)}));break;case Re:!function(e,t){Ue(e,t,Re)}(e,t);break;case Ie:!function(e,t,n=""){setInterval(()=>{document.hidden||Ue(e,t,Ie)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case Ne:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||Pe.push([e,n])}(t,n.triggerParams);break;case"impression":Ee(e,t);break;case"visible":Ee(e,t,{multiple:!0});break;case We:!function(e,t,n=""){setTimeout(()=>Ue(e,t,We),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var r}))}function He(e,t){Ue(e,t.target,"click")}function Ge(e,t){t.target&&Ue(e,t.target,"submit")}function Be(e,t,n,r){const o=[];let i=!0;n.forEach(e=>{const t=Fe(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const s=t[0],a=!te(s)&&ne(s)&&s.startsWith("walker ");if(te(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!ne(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(r&&a||!r&&!a)&&o.push(t)}),o.forEach(n=>{Ke(e,t,n)})}function Ke(e,t="data-elb",n){ie(()=>{if(Array.isArray(n)){const[r,...o]=n;if(!r||ne(r)&&""===r.trim())return;if(ne(r)&&r.startsWith("walker "))return void e(r,o[0]);Ce({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},r,...o)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Fe(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function Je(e,t={}){return function(e={}){const{cb:t,consent:n,collector:r,storage:o}=e,i=(null==r?void 0:r.push)||X;if(!n)return U((o?F:J)(e),r,t);{const r=function(e,t){let n;return(r,o)=>{if(c(n)&&n===(null==r?void 0:r.group))return;n=null==r?void 0:r.group;let i=()=>J(e);return e.consent&&p((a(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),o)&&(i=()=>F(e)),U(i(),r,t)}}(e,t);i("walker on","consent",(a(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{}))}}({...t,collector:{push:e,group:void 0}})}var ze=async(e,t)=>{try{const n=t||{},{elb:r,window:o,document:i}=n;if(!r)throw new Error("Browser source requires elb function in environment");const s=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}((null==e?void 0:e.settings)||{},i),a={settings:s},c={elb:r,settings:s};if(i&&o){if(!1!==s.elbLayer&&function(e,t={}){const n=t.name||"elbLayer",r=t.window||("undefined"!=typeof window?window:void 0);if(!r)return;const o=r;o[n]||(o[n]=[]);const i=o[n];i.push=function(...n){if(Fe(n[0])){const r=[...Array.from(n[0])],o=Array.prototype.push.apply(this,[r]);return Ke(e,t.prefix,r),o}const r=Array.prototype.push.apply(this,n);return n.forEach(n=>{Ke(e,t.prefix,n)}),r},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){Be(e,t,n,!0),Be(e,t,n,!1),n.length=0}(e,t.prefix,i)}(r,{name:ne(s.elbLayer)?s.elbLayer:"elbLayer",prefix:s.prefix,window:o}),s.session){const e="boolean"==typeof s.session?{}:s.session;Je(r,e)}await async function(e,t,n){const r=()=>{e(t,n)};"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r)}(Xe,c,s),(()=>{if(Me(c,s),s.pageview){const[e,t]=fe(s.prefix||"data-elb",s.scope);Ce(c,"page view",e,"load",t)}})(),ne(s.elb)&&s.elb&&(o[s.elb]=(...e)=>{const[t,n,r,o,i,s]=e;return Ce(c,t,n,r,o,i,s)})}return{type:"browser",config:a,push:(...e)=>{const[t,n,r,o,i,s]=e;return Ce(c,t,n,r,o,i,s)},destroy:async()=>{i&&Le(s.scope||i)},on:async(e,t)=>{switch(e){case"consent":if(s.session&&t){const e="boolean"==typeof s.session?{}:s.session;Je(r,e)}break;case"session":case"ready":default:break;case"run":if(i&&o&&(Me(c,s),s.pageview)){const[e,t]=fe(s.prefix||"data-elb",s.scope);Ce(c,"page view",e,"load",t)}}}}}catch(e){throw e}},Ve=Object.defineProperty,Ye=(e,t)=>{for(var n in t)Ve(e,n,{get:t[n],enumerable:!0})},Qe=!1;function Ze(e,t={},n){if(t.filter&&!0===v(()=>t.filter(n),()=>!1)())return;const r=function(e){if(u(e)&&l(e.event)){const{event:t,...n}=e;return{name:t,...n}}return a(e)&&e.length>=2?et(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?et(Array.from(e)):null;var t}(n);if(!r)return;const o={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:""}};v(()=>e(o),()=>{})()}function et(e){const[t,n,r]=e;if(!l(t))return null;let o,i={};switch(t){case"consent":if(!l(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!u(r)||null===r)return null;o=`${t} ${n}`,i={...r};break;case"event":if(!l(n))return null;o=n,u(r)&&(i={...r});break;case"config":if(!l(n))return null;o=`${t} ${n}`,u(r)&&(i={...r});break;case"set":if(l(n))o=`${t} ${n}`,u(r)&&(i={...r});else{if(!u(n))return null;o=`${t} custom`,i={...n}}break;default:return null}return{name:o,...i}}function tt(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function nt(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function rt(){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 ot(){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 it(){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 st(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function at(){return["set",{currency:"EUR",country:"DE"}]}function ct(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}Ye({},{add_to_cart:()=>ot,config:()=>st,consentDefault:()=>nt,consentUpdate:()=>tt,directDataLayerEvent:()=>ct,purchase:()=>rt,setCustom:()=>at,view_item:()=>it});Ye({},{add_to_cart:()=>dt,config:()=>mt,configGA4:()=>pt,consentOnlyMapping:()=>yt,consentUpdate:()=>ut,customEvent:()=>gt,purchase:()=>lt,view_item:()=>ft});var ut={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}}}}},lt={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"}}}}]}}}},dt={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"}}},ft={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"}}},pt={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},gt={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},mt={consent:{update:ut},purchase:lt,add_to_cart:dt,view_item:ft,"config G-XXXXXXXXXX":pt,custom_event:gt,"*":{data:{}}},yt={consent:{update:ut}},ht=async(e,t)=>{try{const n=t||{},{elb:r,window:o}=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},s={settings:i};return o&&(function(e,t){const n=t.settings,r=(null==n?void 0:n.name)||"dataLayer",o=window[r];if(Array.isArray(o)&&!Qe){Qe=!0;try{for(const t of o)Ze(e,n,t)}finally{Qe=!1}}}(r,s),function(e,t){const n=t.settings,r=(null==n?void 0:n.name)||"dataLayer";window[r]||(window[r]=[]);const o=window[r];if(!Array.isArray(o))return;const i=o.push.bind(o);o.push=function(...t){if(Qe)return i(...t);Qe=!0;try{for(const r of t)Ze(e,n,r)}finally{Qe=!1}return i(...t)}}(r,s)),{type:"dataLayer",config:s,push:r,destroy:async()=>{const e=i.name||"dataLayer";o&&o[e]&&Array.isArray(o[e])}}}catch(e){throw e}};function wt(){window.dataLayer=window.dataLayer||[];const e=e=>{u(e)&&u(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}var bt={};async function vt(e={}){const t=s({collector:{destinations:{dataLayer:{code:wt()}}},browser:{run:!0,session:!0},dataLayer:!1,elb:"elb"},e),n={...t.collector,sources:{browser:{code:ze,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=u(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:ht,config:{settings:e}})}const{collector:r}=await N(n);if(!r.sources.browser)throw new Error("Browser source not initialized in walker.js");const o=r.sources.browser.push,i={collector:r,elb:o};return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=o),t.name&&(window[t.name]=r)),i}var kt=vt;export{bt as Walkerjs,vt as createWalkerjs,kt as default,ue as getAllEvents,le as getEvents,de as getGlobals};//# sourceMappingURL=index.mjs.map
1
+ var e,t,n,a=Object.defineProperty,r={};((e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})})(r,{BRAND:()=>Le,DIRTY:()=>k,EMPTY_PATH:()=>h,INVALID:()=>b,NEVER:()=>Ct,OK:()=>x,ParseStatus:()=>_,Schema:()=>N,ZodAny:()=>ue,ZodArray:()=>me,ZodBigInt:()=>ae,ZodBoolean:()=>re,ZodBranded:()=>Fe,ZodCatch:()=>Re,ZodDate:()=>se,ZodDefault:()=>Ie,ZodDiscriminatedUnion:()=>ve,ZodEffects:()=>Ce,ZodEnum:()=>Pe,ZodError:()=>u,ZodFirstPartyTypeKind:()=>qe,ZodFunction:()=>Ae,ZodIntersection:()=>be,ZodIssueCode:()=>o,ZodLazy:()=>Se,ZodLiteral:()=>Oe,ZodMap:()=>we,ZodNaN:()=>Me,ZodNativeEnum:()=>je,ZodNever:()=>le,ZodNull:()=>ce,ZodNullable:()=>$e,ZodNumber:()=>ne,ZodObject:()=>he,ZodOptional:()=>Ee,ZodParsedType:()=>s,ZodPipeline:()=>ze,ZodPromise:()=>Ne,ZodReadonly:()=>De,ZodRecord:()=>xe,ZodSchema:()=>N,ZodSet:()=>Ze,ZodString:()=>ee,ZodSymbol:()=>ie,ZodTransformer:()=>Ce,ZodTuple:()=>ke,ZodType:()=>N,ZodUndefined:()=>oe,ZodUnion:()=>ge,ZodUnknown:()=>de,ZodVoid:()=>pe,addIssueToContext:()=>g,any:()=>at,array:()=>ot,bigint:()=>Ye,boolean:()=>Ge,coerce:()=>Nt,custom:()=>Ve,date:()=>Qe,datetimeRegex:()=>H,defaultErrorMap:()=>d,discriminatedUnion:()=>lt,effect:()=>wt,enum:()=>bt,function:()=>yt,getErrorMap:()=>m,getParsedType:()=>i,instanceof:()=>We,intersection:()=>pt,isAborted:()=>w,isAsync:()=>S,isDirty:()=>Z,isValid:()=>A,late:()=>Ke,lazy:()=>vt,literal:()=>_t,makeIssue:()=>f,map:()=>ht,nan:()=>He,nativeEnum:()=>kt,never:()=>st,null:()=>nt,nullable:()=>At,number:()=>Je,object:()=>ct,objectUtil:()=>n,oboolean:()=>jt,onumber:()=>Pt,optional:()=>Zt,ostring:()=>Tt,pipeline:()=>Ot,preprocess:()=>St,promise:()=>xt,quotelessJson:()=>c,record:()=>ft,set:()=>gt,setErrorMap:()=>p,strictObject:()=>ut,string:()=>Xe,symbol:()=>et,transformer:()=>wt,tuple:()=>mt,undefined:()=>tt,union:()=>dt,unknown:()=>rt,util:()=>e,void:()=>it}),(t=e||(e={})).assertEqual=e=>{},t.assertIs=function(e){},t.assertNever=function(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),a={};for(const t of n)a[t]=e[t];return t.objectValues(a)},t.objectValues=e=>t.objectKeys(e).map(function(t){return e[t]}),t.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,t.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});var s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),i=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return Number.isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},o=e.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"]),c=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),u=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(a);else if("invalid_return_type"===r.code)a(r.returnTypeError);else if("invalid_arguments"===r.code)a(r.argumentsError);else if(0===r.path.length)n._errors.push(t(r));else{let e=n,a=0;for(;a<r.path.length;){const n=r.path[a];a===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};u.create=e=>new u(e);var d=(t,n)=>{let a;switch(t.code){case o.invalid_type:a=t.received===s.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case o.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case o.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case o.invalid_union:a="Invalid input";break;case o.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case o.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case o.invalid_arguments:a="Invalid function arguments";break;case o.invalid_return_type:a="Invalid function return type";break;case o.invalid_date:a="Invalid date";break;case o.invalid_string:"object"==typeof t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case o.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type||"bigint"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case o.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:"Invalid input";break;case o.custom:a="Invalid input";break;case o.invalid_intersection_types:a="Intersection results could not be merged";break;case o.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case o.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}},l=d;function p(e){l=e}function m(){return l}var f=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,s=[...n,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}},h=[];function g(e,t){const n=m(),a=f({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===d?void 0:d].filter(e=>!!e)});e.common.issues.push(a)}var y,v,_=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return b;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){const a=[];for(const e of n){const t=await e.key,n=await e.value;a.push({key:t,value:n})}return e.mergeObjectSync(t,a)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:r}=a;if("aborted"===t.status)return b;if("aborted"===r.status)return b;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!a.alwaysSet||(n[t.value]=r.value)}return{status:e.value,value:n}}},b=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),x=e=>({status:"valid",value:e}),w=e=>"aborted"===e.status,Z=e=>"dirty"===e.status,A=e=>"valid"===e.status,S=e=>"undefined"!=typeof Promise&&e instanceof Promise;(v=y||(y={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},v.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var O=class{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},T=(e,t)=>{if(A(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 u(e.common.issues);return this._error=t,this._error}}};function P(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:r}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!=(s=null!=o?o:a)?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(i=null!=o?o:n)?i:r.defaultError}},description:r}}var j,N=class{get description(){return this._def.description}_getType(e){return i(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _,ctx:{common:e.parent.common,data:e.data,parsedType:i(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(S(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!=(n=null==t?void 0:t.async)&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)},r=this._parseSync({data:e,path:a.path,parent:a});return T(a,r)}"~validate"(e){var t,n;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return A(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null==(n=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(e=>A(e)?{value:e.value}:{issues:a.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:i(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(S(a)?a:Promise.resolve(a));return T(n,r)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,a)=>{const r=e(t),s=()=>a.addIssue({code:o.custom,...n(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(s(),!1)):!!r||(s(),!1)})}refinement(e,t){return this._refinement((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1))}_refinement(e){return new Ce({schema:this,typeName:qe.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 Ee.create(this,this._def)}nullable(){return $e.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return Ne.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return be.create(this,e,this._def)}transform(e){return new Ce({...P(this._def),schema:this,typeName:qe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Ie({...P(this._def),innerType:this,defaultValue:t,typeName:qe.ZodDefault})}brand(){return new Fe({typeName:qe.ZodBranded,type:this,...P(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Re({...P(this._def),innerType:this,catchValue:t,typeName:qe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ze.create(this,e)}readonly(){return De.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},C=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,$=/^[0-9A-HJKMNP-TV-Z]{26}$/i,I=/^[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,R=/^[a-z0-9_-]{21}$/i,M=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,L=/^[-+]?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)?)??$/,F=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,z=/^(?:(?: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])$/,D=/^(?:(?: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])$/,U=/^(([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]))$/,V=/^(([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])$/,q=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,K="((\\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])))",W=new RegExp(`^${K}$`);function X(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 J(e){return new RegExp(`^${X(e)}$`)}function H(e){let t=`${K}T${X(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Y(e,t){return!("v4"!==t&&t||!z.test(e))||!("v6"!==t&&t||!U.test(e))}function G(e,t){if(!M.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const a=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(a));return"object"==typeof r&&null!==r&&((!("typ"in r)||"JWT"===(null==r?void 0:r.typ))&&(!!r.alg&&(!t||r.alg===t)))}catch(e){return!1}}function Q(e,t){return!("v4"!==t&&t||!D.test(e))||!("v6"!==t&&t||!V.test(e))}var ee=class t extends N{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==s.string){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.string,received:e.parsedType}),b}const n=new _;let a;for(const r of this._def.checks)if("min"===r.kind)t.data.length<r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if("max"===r.kind)t.data.length>r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if("length"===r.kind){const e=t.data.length>r.value,s=t.data.length<r.value;(e||s)&&(a=this._getOrReturnCtx(t,a),e?g(a,{code:o.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):s&&g(a,{code:o.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if("email"===r.kind)F.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"email",code:o.invalid_string,message:r.message}),n.dirty());else if("emoji"===r.kind)j||(j=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),j.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"emoji",code:o.invalid_string,message:r.message}),n.dirty());else if("uuid"===r.kind)I.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"uuid",code:o.invalid_string,message:r.message}),n.dirty());else if("nanoid"===r.kind)R.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"nanoid",code:o.invalid_string,message:r.message}),n.dirty());else if("cuid"===r.kind)C.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cuid",code:o.invalid_string,message:r.message}),n.dirty());else if("cuid2"===r.kind)E.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cuid2",code:o.invalid_string,message:r.message}),n.dirty());else if("ulid"===r.kind)$.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"ulid",code:o.invalid_string,message:r.message}),n.dirty());else if("url"===r.kind)try{new URL(t.data)}catch(e){a=this._getOrReturnCtx(t,a),g(a,{validation:"url",code:o.invalid_string,message:r.message}),n.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"regex",code:o.invalid_string,message:r.message}),n.dirty())}else if("trim"===r.kind)t.data=t.data.trim();else if("includes"===r.kind)t.data.includes(r.value,r.position)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty());else if("toLowerCase"===r.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===r.kind)t.data=t.data.toUpperCase();else if("startsWith"===r.kind)t.data.startsWith(r.value)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty());else if("endsWith"===r.kind)t.data.endsWith(r.value)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty());else if("datetime"===r.kind){H(r).test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"datetime",message:r.message}),n.dirty())}else if("date"===r.kind){W.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"date",message:r.message}),n.dirty())}else if("time"===r.kind){J(r).test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{code:o.invalid_string,validation:"time",message:r.message}),n.dirty())}else"duration"===r.kind?L.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"duration",code:o.invalid_string,message:r.message}),n.dirty()):"ip"===r.kind?Y(t.data,r.version)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"ip",code:o.invalid_string,message:r.message}),n.dirty()):"jwt"===r.kind?G(t.data,r.alg)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"jwt",code:o.invalid_string,message:r.message}),n.dirty()):"cidr"===r.kind?Q(t.data,r.version)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"cidr",code:o.invalid_string,message:r.message}),n.dirty()):"base64"===r.kind?q.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"base64",code:o.invalid_string,message:r.message}),n.dirty()):"base64url"===r.kind?B.test(t.data)||(a=this._getOrReturnCtx(t,a),g(a,{validation:"base64url",code:o.invalid_string,message:r.message}),n.dirty()):e.assertNever(r);return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:o.invalid_string,...y.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(n=null==e?void 0:e.local)&&n,...y.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,...y.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...y.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...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 te(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}ee.create=e=>{var t;return new ee({checks:[],typeName:qe.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...P(e)})};var ne=class t extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==s.number){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.number,received:e.parsedType}),b}let n;const a=new _;for(const r of this._def.checks)if("int"===r.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:o.invalid_type,expected:"integer",received:"float",message:r.message}),a.dirty());else if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),a.dirty())}else"multipleOf"===r.kind?0!==te(t.data,r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):"finite"===r.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_finite,message:r.message}),a.dirty()):e.assertNever(r);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,n,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:a,message:y.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.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(t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ne.create=e=>new ne({checks:[],typeName:qe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...P(e)});var ae=class t extends N{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch(e){return this._getInvalidInput(t)}if(this._getType(t)!==s.bigint)return this._getInvalidInput(t);let n;const a=new _;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?t.data<r.value:t.data<=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else if("max"===r.kind){(r.inclusive?t.data>r.value:t.data>=r.value)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),a.dirty())}else"multipleOf"===r.kind?t.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),g(n,{code:o.not_multiple_of,multipleOf:r.value,message:r.message}),a.dirty()):e.assertNever(r);return{status:a.value,value:t.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.bigint,received:t.parsedType}),b}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,n,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:a,message:y.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.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}};ae.create=e=>{var t;return new ae({checks:[],typeName:qe.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...P(e)})};var re=class extends N{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.boolean,received:t.parsedType}),b}return x(e.data)}};re.create=e=>new re({typeName:qe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...P(e)});var se=class t extends N{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==s.date){const e=this._getOrReturnCtx(t);return g(e,{code:o.invalid_type,expected:s.date,received:e.parsedType}),b}if(Number.isNaN(t.data.getTime())){return g(this._getOrReturnCtx(t),{code:o.invalid_date}),b}const n=new _;let a;for(const r of this._def.checks)"min"===r.kind?t.data.getTime()<r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):"max"===r.kind?t.data.getTime()>r.value&&(a=this._getOrReturnCtx(t,a),g(a,{code:o.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):e.assertNever(r);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.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}};se.create=e=>new se({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:qe.ZodDate,...P(e)});var ie=class extends N{_parse(e){if(this._getType(e)!==s.symbol){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.symbol,received:t.parsedType}),b}return x(e.data)}};ie.create=e=>new ie({typeName:qe.ZodSymbol,...P(e)});var oe=class extends N{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.undefined,received:t.parsedType}),b}return x(e.data)}};oe.create=e=>new oe({typeName:qe.ZodUndefined,...P(e)});var ce=class extends N{_parse(e){if(this._getType(e)!==s.null){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.null,received:t.parsedType}),b}return x(e.data)}};ce.create=e=>new ce({typeName:qe.ZodNull,...P(e)});var ue=class extends N{constructor(){super(...arguments),this._any=!0}_parse(e){return x(e.data)}};ue.create=e=>new ue({typeName:qe.ZodAny,...P(e)});var de=class extends N{constructor(){super(...arguments),this._unknown=!0}_parse(e){return x(e.data)}};de.create=e=>new de({typeName:qe.ZodUnknown,...P(e)});var le=class extends N{_parse(e){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.never,received:t.parsedType}),b}};le.create=e=>new le({typeName:qe.ZodNever,...P(e)});var pe=class extends N{_parse(e){if(this._getType(e)!==s.undefined){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.void,received:t.parsedType}),b}return x(e.data)}};pe.create=e=>new pe({typeName:qe.ZodVoid,...P(e)});var me=class e extends N{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==s.array)return g(t,{code:o.invalid_type,expected:s.array,received:t.parsedType}),b;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(g(t,{code:e?o.too_big:o.too_small,minimum:r?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(g(t,{code:o.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(g(t,{code:o.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>a.type._parseAsync(new O(t,e,t.path,n)))).then(e=>_.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new O(t,e,t.path,n)));return _.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:y.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:y.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:y.toString(n)}})}nonempty(e){return this.min(1,e)}};function fe(e){if(e instanceof he){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Ee.create(fe(a))}return new he({...e._def,shape:()=>t})}return e instanceof me?new me({...e._def,type:fe(e.element)}):e instanceof Ee?Ee.create(fe(e.unwrap())):e instanceof $e?$e.create(fe(e.unwrap())):e instanceof ke?ke.create(e.items.map(e=>fe(e))):e}me.create=(e,t)=>new me({type:e,minLength:null,maxLength:null,exactLength:null,typeName:qe.ZodArray,...P(t)});var he=class t extends N{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(e){if(this._getType(e)!==s.object){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.object,received:t.parsedType}),b}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),i=[];if(!(this._def.catchall instanceof le&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||i.push(e);const c=[];for(const e of r){const t=a[e],r=n.data[e];c.push({key:{status:"valid",value:e},value:t._parse(new O(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof le){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of i)c.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)i.length>0&&(g(n,{code:o.unrecognized_keys,keys:i}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of i){const a=n.data[t];c.push({key:{status:"valid",value:t},value:e._parse(new O(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of c){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>_.mergeObjectSync(t,e)):_.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new t({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var a,r,s,i;const o=null!=(s=null==(r=(a=this._def).errorMap)?void 0:r.call(a,t,n).message)?s:n.defaultError;return"unrecognized_keys"===t.code?{message:null!=(i=y.errToObj(e).message)?i:o}:{message:o}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:qe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){const a={};for(const t of e.objectKeys(n))n[t]&&this.shape[t]&&(a[t]=this.shape[t]);return new t({...this._def,shape:()=>a})}omit(n){const a={};for(const t of e.objectKeys(this.shape))n[t]||(a[t]=this.shape[t]);return new t({...this._def,shape:()=>a})}deepPartial(){return fe(this)}partial(n){const a={};for(const t of e.objectKeys(this.shape)){const e=this.shape[t];n&&!n[t]?a[t]=e:a[t]=e.optional()}return new t({...this._def,shape:()=>a})}required(n){const a={};for(const t of e.objectKeys(this.shape))if(n&&!n[t])a[t]=this.shape[t];else{let e=this.shape[t];for(;e instanceof Ee;)e=e._def.innerType;a[t]=e}return new t({...this._def,shape:()=>a})}keyof(){return Te(e.objectKeys(this.shape))}};he.create=(e,t)=>new he({shape:()=>e,unknownKeys:"strip",catchall:le.create(),typeName:qe.ZodObject,...P(t)}),he.strictCreate=(e,t)=>new he({shape:()=>e,unknownKeys:"strict",catchall:le.create(),typeName:qe.ZodObject,...P(t)}),he.lazycreate=(e,t)=>new he({shape:e,unknownKeys:"strip",catchall:le.create(),typeName:qe.ZodObject,...P(t)});var ge=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map(e=>new u(e.ctx.common.issues));return g(t,{code:o.invalid_union,unionErrors:n}),b});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map(e=>new u(e));return g(t,{code:o.invalid_union,unionErrors:r}),b}}get options(){return this._def.options}};ge.create=(e,t)=>new ge({options:e,typeName:qe.ZodUnion,...P(t)});var ye=t=>t instanceof Se?ye(t.schema):t instanceof Ce?ye(t.innerType()):t instanceof Oe?[t.value]:t instanceof Pe?t.options:t instanceof je?e.objectValues(t.enum):t instanceof Ie?ye(t._def.innerType):t instanceof oe?[void 0]:t instanceof ce?[null]:t instanceof Ee?[void 0,...ye(t.unwrap())]:t instanceof $e?[null,...ye(t.unwrap())]:t instanceof Fe||t instanceof De?ye(t.unwrap()):t instanceof Re?ye(t._def.innerType):[],ve=class e extends N{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.object)return g(t,{code:o.invalid_type,expected:s.object,received:t.parsedType}),b;const n=this.discriminator,a=t.data[n],r=this.optionsMap.get(a);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(g(t,{code:o.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),b)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,a){const r=new Map;for(const e of n){const n=ye(e.shape[t]);if(!n.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of n){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,e)}}return new e({typeName:qe.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...P(a)})}};function _e(t,n){const a=i(t),r=i(n);if(t===n)return{valid:!0,data:t};if(a===s.object&&r===s.object){const a=e.objectKeys(n),r=e.objectKeys(t).filter(e=>-1!==a.indexOf(e)),s={...t,...n};for(const e of r){const a=_e(t[e],n[e]);if(!a.valid)return{valid:!1};s[e]=a.data}return{valid:!0,data:s}}if(a===s.array&&r===s.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let a=0;a<t.length;a++){const r=_e(t[a],n[a]);if(!r.valid)return{valid:!1};e.push(r.data)}return{valid:!0,data:e}}return a===s.date&&r===s.date&&+t===+n?{valid:!0,data:t}:{valid:!1}}var be=class extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(w(e)||w(a))return b;const r=_e(e.value,a.value);return r.valid?((Z(e)||Z(a))&&t.dirty(),{status:t.value,value:r.data}):(g(n,{code:o.invalid_intersection_types}),b)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};be.create=(e,t,n)=>new be({left:e,right:t,typeName:qe.ZodIntersection,...P(n)});var ke=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.array)return g(n,{code:o.invalid_type,expected:s.array,received:n.parsedType}),b;if(n.data.length<this._def.items.length)return g(n,{code:o.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b;!this._def.rest&&n.data.length>this._def.items.length&&(g(n,{code:o.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new O(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>_.mergeArray(t,e)):_.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};ke.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ke({items:e,typeName:qe.ZodTuple,rest:null,...P(t)})};var xe=class e extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.object)return g(n,{code:o.invalid_type,expected:s.object,received:n.parsedType}),b;const a=[],r=this._def.keyType,i=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new O(n,e,n.path,e)),value:i._parse(new O(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?_.mergeObjectAsync(t,a):_.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof N?{keyType:t,valueType:n,typeName:qe.ZodRecord,...P(a)}:{keyType:ee.create(),valueType:t,typeName:qe.ZodRecord,...P(n)})}},we=class extends N{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.map)return g(n,{code:o.invalid_type,expected:s.map,received:n.parsedType}),b;const a=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([e,t],s)=>({key:a._parse(new O(n,e,n.path,[s,"key"])),value:r._parse(new O(n,t,n.path,[s,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of i){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return b;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of i){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return b;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};we.create=(e,t,n)=>new we({valueType:t,keyType:e,typeName:qe.ZodMap,...P(n)});var Ze=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==s.set)return g(n,{code:o.invalid_type,expected:s.set,received:n.parsedType}),b;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(g(n,{code:o.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(g(n,{code:o.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function i(e){const n=new Set;for(const a of e){if("aborted"===a.status)return b;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const c=[...n.data.values()].map((e,t)=>r._parse(new O(n,e,n.path,t)));return n.common.async?Promise.all(c).then(e=>i(e)):i(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:y.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:y.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ze.create=(e,t)=>new Ze({valueType:e,minSize:null,maxSize:null,typeName:qe.ZodSet,...P(t)});var Ae=class e extends N{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.function)return g(t,{code:o.invalid_type,expected:s.function,received:t.parsedType}),b;function n(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),d].filter(e=>!!e),issueData:{code:o.invalid_arguments,argumentsError:n}})}function a(e,n){return f({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,m(),d].filter(e=>!!e),issueData:{code:o.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ne){const e=this;return x(async function(...t){const s=new u([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw s.addIssue(n(t,e)),s}),c=await Reflect.apply(i,this,o);return await e._def.returns._def.type.parseAsync(c,r).catch(e=>{throw s.addIssue(a(c,e)),s})})}{const e=this;return x(function(...t){const s=e._def.args.safeParse(t,r);if(!s.success)throw new u([n(t,s.error)]);const o=Reflect.apply(i,this,s.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new u([a(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:ke.create(t).rest(de.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,a){return new e({args:t||ke.create([]).rest(de.create()),returns:n||de.create(),typeName:qe.ZodFunction,...P(a)})}},Se=class extends N{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})}};Se.create=(e,t)=>new Se({getter:e,typeName:qe.ZodLazy,...P(t)});var Oe=class extends N{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return g(t,{received:t.data,code:o.invalid_literal,expected:this._def.value}),b}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Te(e,t){return new Pe({values:e,typeName:qe.ZodEnum,...P(t)})}Oe.create=(e,t)=>new Oe({value:e,typeName:qe.ZodLiteral,...P(t)});var Pe=class t extends N{_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),a=this._def.values;return g(n,{expected:e.joinValues(a),received:n.parsedType,code:o.invalid_type}),b}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return g(e,{received:e.data,code:o.invalid_enum_value,options:n}),b}return x(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...n})}};Pe.create=Te;var je=class extends N{_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==s.string&&a.parsedType!==s.number){const t=e.objectValues(n);return g(a,{expected:e.joinValues(t),received:a.parsedType,code:o.invalid_type}),b}if(this._cache||(this._cache=new Set(e.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const t=e.objectValues(n);return g(a,{received:a.data,code:o.invalid_enum_value,options:t}),b}return x(t.data)}get enum(){return this._def.values}};je.create=(e,t)=>new je({values:e,typeName:qe.ZodNativeEnum,...P(t)});var Ne=class extends N{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==s.promise&&!1===t.common.async)return g(t,{code:o.invalid_type,expected:s.promise,received:t.parsedType}),b;const n=t.parsedType===s.promise?t.data:Promise.resolve(t.data);return x(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Ne.create=(e,t)=>new Ne({type:e,typeName:qe.ZodPromise,...P(t)});var Ce=class extends N{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===qe.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:a}=this._processInputParams(t),r=this._def.effect||null,s={addIssue:e=>{g(a,e),e.fatal?n.abort():n.dirty()},get path(){return a.path}};if(s.addIssue=s.addIssue.bind(s),"preprocess"===r.type){const e=r.transform(a.data,s);if(a.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===n.value)return b;const t=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===t.status?b:"dirty"===t.status||"dirty"===n.value?k(t.value):t});{if("aborted"===n.value)return b;const t=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===t.status?b:"dirty"===t.status||"dirty"===n.value?k(t.value):t}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,s);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 t=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===t.status?b:("dirty"===t.status&&n.dirty(),e(t.value),{status:n.value,value:t.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(t=>"aborted"===t.status?b:("dirty"===t.status&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.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(!A(e))return b;const t=r.transform(e.value,s);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(e=>A(e)?Promise.resolve(r.transform(e.value,s)).then(e=>({status:n.value,value:e})):b)}e.assertNever(r)}};Ce.create=(e,t,n)=>new Ce({schema:e,typeName:qe.ZodEffects,effect:t,...P(n)}),Ce.createWithPreprocess=(e,t,n)=>new Ce({schema:t,effect:{type:"preprocess",transform:e},typeName:qe.ZodEffects,...P(n)});var Ee=class extends N{_parse(e){return this._getType(e)===s.undefined?x(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Ee.create=(e,t)=>new Ee({innerType:e,typeName:qe.ZodOptional,...P(t)});var $e=class extends N{_parse(e){return this._getType(e)===s.null?x(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$e.create=(e,t)=>new $e({innerType:e,typeName:qe.ZodNullable,...P(t)});var Ie=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===s.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Ie.create=(e,t)=>new Ie({innerType:e,typeName:qe.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...P(t)});var Re=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return S(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new u(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Re.create=(e,t)=>new Re({innerType:e,typeName:qe.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...P(t)});var Me=class extends N{_parse(e){if(this._getType(e)!==s.nan){const t=this._getOrReturnCtx(e);return g(t,{code:o.invalid_type,expected:s.nan,received:t.parsedType}),b}return{status:"valid",value:e.data}}};Me.create=e=>new Me({typeName:qe.ZodNaN,...P(e)});var Le=Symbol("zod_brand"),Fe=class extends N{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ze=class e extends N{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?b:"dirty"===e.status?(t.dirty(),k(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?b:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:qe.ZodPipeline})}},De=class extends N{_parse(e){const t=this._def.innerType._parse(e),n=e=>(A(e)&&(e.value=Object.freeze(e.value)),e);return S(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function Ue(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function Ve(e,t={},n){return e?ue.create().superRefine((a,r)=>{var s,i;const o=e(a);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=Ue(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=Ue(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}}):ue.create()}De.create=(e,t)=>new De({innerType:e,typeName:qe.ZodReadonly,...P(t)});var qe,Be,Ke={object:he.lazycreate};(Be=qe||(qe={})).ZodString="ZodString",Be.ZodNumber="ZodNumber",Be.ZodNaN="ZodNaN",Be.ZodBigInt="ZodBigInt",Be.ZodBoolean="ZodBoolean",Be.ZodDate="ZodDate",Be.ZodSymbol="ZodSymbol",Be.ZodUndefined="ZodUndefined",Be.ZodNull="ZodNull",Be.ZodAny="ZodAny",Be.ZodUnknown="ZodUnknown",Be.ZodNever="ZodNever",Be.ZodVoid="ZodVoid",Be.ZodArray="ZodArray",Be.ZodObject="ZodObject",Be.ZodUnion="ZodUnion",Be.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Be.ZodIntersection="ZodIntersection",Be.ZodTuple="ZodTuple",Be.ZodRecord="ZodRecord",Be.ZodMap="ZodMap",Be.ZodSet="ZodSet",Be.ZodFunction="ZodFunction",Be.ZodLazy="ZodLazy",Be.ZodLiteral="ZodLiteral",Be.ZodEnum="ZodEnum",Be.ZodEffects="ZodEffects",Be.ZodNativeEnum="ZodNativeEnum",Be.ZodOptional="ZodOptional",Be.ZodNullable="ZodNullable",Be.ZodDefault="ZodDefault",Be.ZodCatch="ZodCatch",Be.ZodPromise="ZodPromise",Be.ZodBranded="ZodBranded",Be.ZodPipeline="ZodPipeline",Be.ZodReadonly="ZodReadonly";var We=(e,t={message:`Input not instance of ${e.name}`})=>Ve(t=>t instanceof e,t),Xe=ee.create,Je=ne.create,He=Me.create,Ye=ae.create,Ge=re.create,Qe=se.create,et=ie.create,tt=oe.create,nt=ce.create,at=ue.create,rt=de.create,st=le.create,it=pe.create,ot=me.create,ct=he.create,ut=he.strictCreate,dt=ge.create,lt=ve.create,pt=be.create,mt=ke.create,ft=xe.create,ht=we.create,gt=Ze.create,yt=Ae.create,vt=Se.create,_t=Oe.create,bt=Pe.create,kt=je.create,xt=Ne.create,wt=Ce.create,Zt=Ee.create,At=$e.create,St=Ce.createWithPreprocess,Ot=ze.create,Tt=()=>Xe().optional(),Pt=()=>Je().optional(),jt=()=>Ge().optional(),Nt={string:e=>ee.create({...e,coerce:!0}),number:e=>ne.create({...e,coerce:!0}),boolean:e=>re.create({...e,coerce:!0}),bigint:e=>ae.create({...e,coerce:!0}),date:e=>se.create({...e,coerce:!0})},Ct=b,Et=Symbol("Let zodToJsonSchema decide on which parser to use"),$t={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"},It=e=>{const t=(e=>"string"==typeof e?{...$t,name:e}:{...$t,...e})(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}};function Rt(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Mt(e,t,n,a,r){e[t]=n,Rt(e,t,a,r)}var Lt=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Ft(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Lt(t,e.currentPath):t.join("/")}}function zt(e,t){return fn(e.type._def,t)}function Dt(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>Dt(e,t,n))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Ut(e,t)}}var Ut=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const a of e.checks)switch(a.kind){case"min":Mt(n,"minimum",a.value,a.message,t);break;case"max":Mt(n,"maximum",a.value,a.message,t)}return n};var Vt=void 0,qt=/^[cC][^\s-]{8,}$/,Bt=/^[0-9a-z]+$/,Kt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Wt=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,Xt=()=>(void 0===Vt&&(Vt=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Vt),Jt=/^(?:(?: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])$/,Ht=/^(([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])$/,Yt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Gt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Qt=/^[a-zA-Z0-9_-]{21}$/,en=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function tn(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Mt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Mt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":rn(n,"email",a.message,t);break;case"format:idn-email":rn(n,"idn-email",a.message,t);break;case"pattern:zod":sn(n,Wt,a.message,t)}break;case"url":rn(n,"uri",a.message,t);break;case"uuid":rn(n,"uuid",a.message,t);break;case"regex":sn(n,a.regex,a.message,t);break;case"cuid":sn(n,qt,a.message,t);break;case"cuid2":sn(n,Bt,a.message,t);break;case"startsWith":sn(n,RegExp(`^${nn(a.value,t)}`),a.message,t);break;case"endsWith":sn(n,RegExp(`${nn(a.value,t)}$`),a.message,t);break;case"datetime":rn(n,"date-time",a.message,t);break;case"date":rn(n,"date",a.message,t);break;case"time":rn(n,"time",a.message,t);break;case"duration":rn(n,"duration",a.message,t);break;case"length":Mt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Mt(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":sn(n,RegExp(nn(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&rn(n,"ipv4",a.message,t),"v4"!==a.version&&rn(n,"ipv6",a.message,t);break;case"base64url":sn(n,Gt,a.message,t);break;case"jwt":sn(n,en,a.message,t);break;case"cidr":"v6"!==a.version&&sn(n,Jt,a.message,t),"v4"!==a.version&&sn(n,Ht,a.message,t);break;case"emoji":sn(n,Xt(),a.message,t);break;case"ulid":sn(n,Kt,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":rn(n,"binary",a.message,t);break;case"contentEncoding:base64":Mt(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":sn(n,Yt,a.message,t)}break;case"nanoid":sn(n,Qt,a.message,t)}return n}function nn(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)an.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var an=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function rn(e,t,n,a){var r;e.format||(null==(r=e.anyOf)?void 0:r.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&a.errorMessages&&{errorMessage:{format:n}}})):Mt(e,"format",t,n,a)}function sn(e,t,n,a){var r;e.pattern||(null==(r=e.allOf)?void 0:r.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:on(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Mt(e,"pattern",on(t,a),n,a)}function on(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),s=e.flags.includes("s"),i=a?e.source.toLowerCase():e.source;let o="",c=!1,u=!1,d=!1;for(let e=0;e<i.length;e++)if(c)o+=i[e],c=!1;else{if(a)if(u){if(i[e].match(/[a-z]/)){d?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),d=!1):"-"===i[e+1]&&(null==(n=i[e+2])?void 0:n.match(/[a-z]/))?(o+=i[e],d=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(r){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=u?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?c=!0:u&&"]"===i[e]?u=!1:u||"["!==i[e]||(u=!0))}try{new RegExp(o)}catch(n){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function cn(e,t){var n,a,r,s,i,o,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(n=e.keyType)?void 0:n._def.typeName)===qe.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:Ft(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(a=fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(r=e.keyType)?void 0:r._def.typeName)===qe.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...a}=tn(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===qe.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===qe.ZodBranded&&e.keyType._def.type._def.typeName===qe.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=zt(e.keyType._def,t);return{...u,propertyNames:a}}return u}var un={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};var dn=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>fn(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function ln(e,t){const n="openAi"===t.target,a={type:"object",properties:{}},r=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=pn(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=fn(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==c&&(a.properties[e]=c,o||r.push(e))}r.length&&(a.required=r);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return fn(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&&(a.additionalProperties=i),a}function pn(e){try{return e.isOptional()}catch(e){return!0}}var mn=(e,t,n)=>{switch(t){case qe.ZodString:return tn(e,n);case qe.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"int":n.type="integer",Rt(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Mt(n,"minimum",a.value,a.message,t):Mt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Mt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Mt(n,"maximum",a.value,a.message,t):Mt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Mt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Mt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case qe.ZodObject:return ln(e,n);case qe.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"min":"jsonSchema7"===t.target?a.inclusive?Mt(n,"minimum",a.value,a.message,t):Mt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Mt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Mt(n,"maximum",a.value,a.message,t):Mt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Mt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Mt(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case qe.ZodBoolean:return{type:"boolean"};case qe.ZodDate:return Dt(e,n);case qe.ZodUndefined:return function(e){return{not:Ft(e)}}(n);case qe.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case qe.ZodArray:return function(e,t){var n,a,r;const s={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(r=null==(a=e.type)?void 0:a._def)?void 0:r.typeName)!==qe.ZodAny&&(s.items=fn(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Mt(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Mt(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Mt(s,"minItems",e.exactLength.value,e.exactLength.message,t),Mt(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case qe.ZodUnion:case qe.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return dn(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in un&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=un[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return dn(e,t)}(e,n);case qe.ZodIntersection:return function(e,t){const n=[fn(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),fn(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let a="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const r=[];return n.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...a}=e;t=a}else a=void 0;r.push(t)}else r.push(...e.allOf),void 0===e.unevaluatedProperties&&(a=void 0);var t}),r.length?{allOf:r,...a}:void 0}(e,n);case qe.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>fn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:fn(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>fn(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case qe.ZodRecord:return cn(e,n);case qe.ZodLiteral:return function(e,t){const n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case qe.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case qe.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),a=Array.from(new Set(n.map(e=>typeof e)));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:n}}(e);case qe.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:un[e.innerType._def.typeName],nullable:!0}:{type:[un[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=fn(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=fn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case qe.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return fn(e.innerType._def,t);const a=fn(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Ft(t)},a]}:Ft(t)})(e,n);case qe.ZodMap:return function(e,t){return"record"===t.mapStrategy?cn(e,t):{type:"array",maxItems:125,items:{type:"array",items:[fn(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ft(t),fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ft(t)],minItems:2,maxItems:2}}}(e,n);case qe.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:fn(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Mt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Mt(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case qe.ZodLazy:return()=>e.getter()._def;case qe.ZodPromise:return function(e,t){return fn(e.type._def,t)}(e,n);case qe.ZodNaN:case qe.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Ft({...e,currentPath:[...e.currentPath,"not"]})}}(n);case qe.ZodEffects:return function(e,t){return"input"===t.effectStrategy?fn(e.schema._def,t):Ft(t)}(e,n);case qe.ZodAny:return Ft(n);case qe.ZodUnknown:return function(e){return Ft(e)}(n);case qe.ZodDefault:return function(e,t){return{...fn(e.innerType._def,t),default:e.defaultValue()}}(e,n);case qe.ZodBranded:return zt(e,n);case qe.ZodReadonly:case qe.ZodCatch:return((e,t)=>fn(e.innerType._def,t))(e,n);case qe.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return fn(e.in._def,t);if("output"===t.pipeStrategy)return fn(e.out._def,t);const n=fn(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,fn(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case qe.ZodFunction:case qe.ZodVoid:case qe.ZodSymbol:default:return}};function fn(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const s=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(s!==Et)return s}if(r&&!n){const e=hn(r,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=mn(e,e.typeName,t),o="function"==typeof i?fn(i(),t):i;if(o&&gn(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var hn=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Lt(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ft(t)):"seen"===t.$refStrategy?Ft(t):void 0}},gn=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),yn=(e,t)=>{var n;const a=It(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=fn(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:Ft(a)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(n=fn(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?n:Ft(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),a.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[a.openAiAnyTypeName]||(r[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===a.$refStrategy?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const c=void 0===s?r?{...i,[a.definitionPath]:r}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...r,[s]:i}};return"jsonSchema7"===a.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==a.target&&"openAi"!==a.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===a.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c},vn={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},_n=r.record(r.string(),r.boolean()).describe("Consent requirement mapping"),bn=r.lazy(()=>r.union([r.string(),r.number(),r.boolean(),Zn,r.array(bn)])),kn=r.tuple([bn,bn]).describe("Loop: [source, transform] tuple for array transformations"),xn=r.array(bn).describe("Set: Array of values"),wn=r.record(r.string(),bn).describe("Map: Object mapping keys to values"),Zn=r.object({key:r.string().optional().describe('Property path (e.g., "data.id")'),value:r.union([r.string(),r.number(),r.boolean()]).optional().describe("Static primitive value"),fn:r.string().optional().describe("Function string for custom transformation"),map:wn.optional().describe("Object with key-value mappings"),loop:kn.optional().describe("Tuple [source, transform]"),set:xn.optional().describe("Array of values"),consent:_n.optional().describe("Required consent states"),condition:r.string().optional().describe("Condition function string"),validate:r.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"),An=kn,Sn=xn,On=wn,Tn=(yn(Zn,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),yn(An,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),yn(Sn,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),yn(On,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function Pn(e,t={},n={}){n={...Tn,...n};const a=Object.entries(t).reduce((t,[a,r])=>{const s=e[a];return n.merge&&Array.isArray(s)&&Array.isArray(r)?t[a]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(n.extend||a in e)&&(t[a]=r),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}function jn(e){return Array.isArray(e)}function Nn(e){return void 0!==e}function Cn(e){return"object"==typeof e&&null!==e&&!jn(e)&&"[object Object]"===Object.prototype.toString.call(e)}function En(e){return"string"==typeof e}function $n(e,t=new WeakMap){if("object"!=typeof e||null===e)return e;if(t.has(e))return t.get(e);const n=Object.prototype.toString.call(e);if("[object Object]"===n){const n={};t.set(e,n);for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(n[a]=$n(e[a],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push($n(e,t))}),n}if("[object Date]"===n)return new Date(e.getTime());if("[object RegExp]"===n){const t=e;return new RegExp(t.source,t.flags)}return e}function In(e,t="",n){const a=t.split(".");let r=e;for(let e=0;e<a.length;e++){const t=a[e];if("*"===t&&jn(r)){const t=a.slice(e+1).join("."),s=[];for(const e of r){const a=In(e,t,n);s.push(a)}return s}if(r=r instanceof Object?r[t]:void 0,!r)break}return Nn(r)?r:n}function Rn(e,t,n){if(!Cn(e))return e;const a=$n(e),r=t.split(".");let s=a;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?s[t]=n:(t in s&&"object"==typeof s[t]&&null!==s[t]||(s[t]={}),s=s[t])}return a}function Mn(e,t={},n={}){const a={...t,...n},r={};let s=void 0===e;return Object.keys(a).forEach(t=>{a[t]&&(r[t]=!0,e&&e[t]&&(s=!0))}),!!s&&r}function Ln(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function Fn(e){return function(e){return"boolean"==typeof e}(e)||En(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!Nn(e)||jn(e)&&e.every(Fn)||Cn(e)&&Object.values(e).every(Fn)}function zn(e){return Fn(e)?e:void 0}function Dn(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Un(e,t,n){return async function(...a){try{return await e(...a)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function Vn(e,t={},n={}){var a;if(!Nn(e))return;const r=Cn(e)&&e.consent||n.consent||(null==(a=n.collector)?void 0:a.consent),s=jn(t)?t:[t];for(const t of s){const a=await Un(qn)(e,t,{...n,consent:r});if(Nn(a))return a}}async function qn(e,t,n={}){const{collector:a,consent:r}=n;return(jn(t)?t:[t]).reduce(async(t,s)=>{const i=await t;if(i)return i;const o=En(s)?{key:s}:s;if(!Object.keys(o).length)return;const{condition:c,consent:u,fn:d,key:l,loop:p,map:m,set:f,validate:h,value:g}=o;if(c&&!await Un(c)(e,s,a))return;if(u&&!Mn(u,r))return g;let y=Nn(g)?g:e;if(d&&(y=await Un(d)(e,s,n)),l&&(y=In(e,l,g)),p){const[t,a]=p,r="this"===t?[e]:await Vn(e,t,n);jn(r)&&(y=(await Promise.all(r.map(e=>Vn(e,a,n)))).filter(Nn))}else m?y=await Object.entries(m).reduce(async(t,[a,r])=>{const s=await t,i=await Vn(e,r,n);return Nn(i)&&(s[a]=i),s},Promise.resolve({})):f&&(y=await Promise.all(f.map(t=>qn(e,t,n))));h&&!await Un(h)(y)&&(y=void 0);const v=zn(y);return Nn(v)?v:zn(g)},Promise.resolve(void 0))}async function Bn(e,t,n){t.policy&&await Promise.all(Object.entries(t.policy).map(async([t,a])=>{const r=await Vn(e,a,{collector:n});e=Rn(e,t,r)}));const{eventMapping:a,mappingKey:r}=await async function(e,t){var n;const[a,r]=(e.name||"").split(" ");if(!t||!a||!r)return{};let s,i="",o=a,c=r;const u=t=>{if(t)return(t=jn(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[o]||(o="*");const d=t[o];return d&&(d[c]||(c="*"),s=u(d[c])),s||(o="*",c="*",s=u(null==(n=t[o])?void 0:n[c])),s&&(i=`${o} ${c}`),{eventMapping:s,mappingKey:i}}(e,t.mapping);(null==a?void 0:a.policy)&&await Promise.all(Object.entries(a.policy).map(async([t,a])=>{const r=await Vn(e,a,{collector:n});e=Rn(e,t,r)}));let s=t.data&&await Vn(e,t.data,{collector:n});if(a){if(a.ignore)return{event:e,data:s,mapping:a,mappingKey:r,ignore:!0};if(a.name&&(e.name=a.name),a.data){const t=a.data&&await Vn(e,a.data,{collector:n});s=Cn(s)&&Cn(t)?Pn(s,t):t}}return{event:e,data:s,mapping:a,mappingKey:r,ignore:!1}}function Kn(e,t,n){return function(...a){let r;const s="post"+t,i=n["pre"+t],o=n[s];return r=i?i({fn:e},...a):e(...a),o&&(r=o({fn:e,result:r},...a)),r}}var Wn={Action:"action",Actions:"actions",Config:"config",Consent:"consent",Context:"context",Custom:"custom",Destination:"destination",Elb:"elb",Globals:"globals",Hook:"hook",Init:"init",Link:"link",On:"on",Prefix:"data-elb",Ready:"ready",Run:"run",Session:"session",User:"user",Walker:"walker"};async function Xn(e,t,n){const{allowed:a,consent:r,globals:s,user:i}=e;if(!a)return Yn({ok:!1});t&&e.queue.push(t),n||(n=e.destinations);const o=await Promise.all(Object.entries(n||{}).map(async([n,a])=>{let o=(a.queue||[]).map(e=>({...e,consent:r}));if(a.queue=[],t){const e=$n(t);o.push(e)}if(!o.length)return{id:n,destination:a,skipped:!0};const c=[],u=o.filter(e=>{const t=Mn(a.config.consent,r,e.consent);return!t||(e.consent=t,c.push(e),!1)});if(a.queue.concat(u),!c.length)return{id:n,destination:a,queue:o};if(!await Un(Jn)(e,a))return{id:n,destination:a,queue:o};let d=!1;return a.dlq||(a.dlq=[]),await Promise.all(c.map(async t=>(t.globals=Pn(s,t.globals),t.user=Pn(i,t.user),await Un(Hn,n=>(e.config.onError&&e.config.onError(n,e),d=!0,a.dlq.push([t,n]),!1))(e,a,t),t))),{id:n,destination:a,error:d}})),c=[],u=[],d=[];for(const e of o){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?d.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),u.push(n)):c.push(n)}return Yn({ok:!d.length,event:t,successful:c,queued:u,failed:d})}async function Jn(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:Gn(t.env,t.config.env)},a=await Kn(t.init,"DestinationInit",e.hooks)(n);if(!1===a)return a;t.config={...a||t.config,init:!0}}return!0}async function Hn(e,t,n){var a;const{config:r}=t,s=await Bn(n,r,e);if(s.ignore)return!1;const i={collector:e,config:r,data:s.data,mapping:s.mapping,env:Gn(t.env,r.env)},o=s.mapping;if((null==o?void 0:o.batch)&&t.pushBatch){const n=o.batched||{key:s.mappingKey||"",events:[],data:[]};n.events.push(s.event),Nn(s.data)&&n.data.push(s.data),o.batchFn=o.batchFn||function(e,t=1e3,n=!1){let a,r=null,s=!1;return(...i)=>new Promise(o=>{const c=n&&!s;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!s||(a=e(...i),o(a))},t),c&&(s=!0,a=e(...i),o(a))})}((e,t)=>{const a={collector:t,config:r,data:s.data,mapping:o,env:Gn(e.env,r.env)};Kn(e.pushBatch,"DestinationPushBatch",t.hooks)(n,a),n.events=[],n.data=[]},o.batch),o.batched=n,null==(a=o.batchFn)||a.call(o,t,e)}else await Kn(t.push,"DestinationPush",e.hooks)(s.event,i);return!0}function Yn(e){var t;return Pn({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function Gn(e,t){return e||t?t?e&&Cn(e)&&Cn(t)?{...e,...t}:t:e:{}}function Qn(e,t,n,a){let r,s=n||[];switch(n||(s=e.on[t]||[]),t){case Wn.Consent:r=a||e.consent;break;case Wn.Session:r=e.session;break;case Wn.Ready:case Wn.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&Dn(e.on)(t,r)}),Object.values(e.destinations).forEach(e=>{if(e.on){Dn(e.on)(t,r)}}),s.length)switch(t){case Wn.Consent:!function(e,t,n){const a=n||e.consent;t.forEach(t=>{Object.keys(a).filter(e=>e in t).forEach(n=>{Dn(t[n])(e,a)})})}(e,s,a);break;case Wn.Ready:case Wn.Run:o=s,(i=e).allowed&&o.forEach(e=>{Dn(e)(i)});break;case Wn.Session:!function(e,t){e.session&&t.forEach(t=>{Dn(t)(e,e.session)})}(e,s)}var i,o}async function ea(e,t,n,a){let r;switch(t){case Wn.Config:Cn(n)&&Pn(e.config,n,{shallow:!1});break;case Wn.Consent:Cn(n)&&(r=await async function(e,t){const{consent:n}=e;let a=!1;const r={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;r[e]=n,a=a||n}),e.consent=Pn(n,r),Qn(e,"consent",void 0,r),a?Xn(e):Yn({ok:!0})}(e,n));break;case Wn.Custom:Cn(n)&&(e.custom=Pn(e.custom,n));break;case Wn.Destination:Cn(n)&&"function"==typeof n.push&&(r=await async function(e,t,n){const{code:a,config:r={},env:s={}}=t,i=n||r||{init:!1},o={...a,config:i,env:Gn(a.env,s)};let c=o.config.id;if(!c)do{c=Ln(4)}while(e.destinations[c]);return e.destinations[c]=o,!1!==o.config.queue&&(o.queue=[...e.queue]),Xn(e,void 0,{[c]:o})}(e,{code:n},a));break;case Wn.Globals:Cn(n)&&(e.globals=Pn(e.globals,n));break;case Wn.On:En(n)&&function(e,t,n){const a=e.on,r=a[t]||[],s=jn(n)?n:[n];s.forEach(e=>{r.push(e)}),a[t]=r,Qn(e,t,s)}(e,n,a);break;case Wn.Ready:Qn(e,"ready");break;case Wn.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=Ln(),e.timing=Date.now(),t&&(t.consent&&(e.consent=Pn(e.consent,t.consent)),t.user&&(e.user=Pn(e.user,t.user)),t.globals&&(e.globals=Pn(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=Pn(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const n=await Xn(e);return Qn(e,"run"),n}(e,n);break;case Wn.Session:Qn(e,"session");break;case Wn.User:Cn(n)&&Pn(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function ta(e,t){return Kn(async(n,a={})=>await Un(async()=>{let r=n;if(a.mapping){const t=await Bn(r,a.mapping,e);if(t.ignore)return Yn({ok:!0});if(a.mapping.consent&&!Mn(a.mapping.consent,e.consent,t.event.consent))return Yn({ok:!0});r=t.event}const s=t(r),i=function(e,t){if(!t.name)throw new Error("Event name is required");const[n,a]=t.name.split(" ");if(!n||!a)throw new Error("Event name is invalid");++e.count;const{timestamp:r=Date.now(),group:s=e.group,count:i=e.count}=t,{name:o=`${n} ${a}`,data:c={},context:u={},globals:d=e.globals,custom:l={},user:p=e.user,nested:m=[],consent:f=e.consent,id:h=`${r}-${s}-${i}`,trigger:g="",entity:y=n,action:v=a,timing:_=0,version:b={source:e.version,tagging:e.config.tagging||0},source:k={type:"collector",id:"",previous_id:""}}=t;return{name:o,data:c,context:u,globals:d,custom:l,user:p,nested:m,consent:f,id:h,trigger:g,entity:y,action:v,timestamp:r,timing:_,group:s,count:i,version:b,source:k}}(e,s);return await Xn(e,i)},()=>Yn({ok:!1}))(),"Push",e.hooks)}async function na(e){const t=Pn({globalsStatic:{},sessionStatic:{},tagging:0,verbose:!1,onLog:n,run:!0},e,{merge:!1,extend:!1});function n(e,n){!function(e,t=!1){t&&console.dir(e,{depth:4})}({message:e},n||t.verbose)}t.onLog=n;const a={...t.globalsStatic,...e.globals},r={allowed:!1,config:t,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:a,group:"",hooks:{},on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.2.1",sources:{},push:void 0,command:void 0};return r.push=ta(r,e=>({timing:Math.round((Date.now()-r.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),r.command=(i=ea,Kn(async(e,t,n)=>await Un(async()=>await i(s,e,t,n),()=>Yn({ok:!1}))(),"Command",(s=r).hooks)),r.destinations=await async function(e,t={}){const n={};for(const[e,a]of Object.entries(t)){const{code:t,config:r={},env:s={}}=a,i={...t.config,...r},o=Gn(t.env,s);n[e]={...t,config:i,env:o}}return n}(0,e.destinations||{}),r;var s,i}async function aa(e){e=e||{};const t=await na(e),n=(a=t,{type:"elb",config:{},push:async(e,t,n,r,s,i)=>{if("string"==typeof e&&e.startsWith("walker ")){const r=e.replace("walker ","");return a.command(r,t,n)}let o;if("string"==typeof e)o={name:e},t&&"object"==typeof t&&!Array.isArray(t)&&(o.data=t);else{if(!e||"object"!=typeof e)return{ok:!1,successful:[],queued:[],failed:[]};o=e,t&&"object"==typeof t&&!Array.isArray(t)&&(o.data={...o.data||{},...t})}return r&&"object"==typeof r&&(o.context=r),s&&Array.isArray(s)&&(o.nested=s),i&&"object"==typeof i&&(o.custom=i),a.push(o)}});var a;t.sources.elb=n;const r=await async function(e,t={}){const n={};for(const[a,r]of Object.entries(t)){const{code:t,config:s={},env:i={},primary:o}=r,c={push:(t,n={})=>e.push(t,{...n,mapping:s}),command:e.command,sources:e.sources,elb:e.sources.elb.push,...i},u=await Un(t)(s,c);u&&(o&&(u.config={...u.config,primary:o}),n[a]=u)}return n}(t,e.sources||{});Object.assign(t.sources,r);const{consent:s,user:i,globals:o,custom:c}=e;s&&await t.command("consent",s),i&&await t.command("user",i),o&&Object.assign(t.globals,o),c&&Object.assign(t.custom,c),t.config.run&&await t.command("run");let u=n.push;const d=Object.values(t.sources).filter(e=>"elb"!==e.type),l=d.find(e=>e.config.primary);return l?u=l.push:d.length>0&&(u=d[0].push),{collector:t,elb:u}}function ra(e,t){return(e.getAttribute(t)||"").trim()}var sa=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function ia(e){const t=getComputedStyle(e);if("none"===t.display)return!1;if("visible"!==t.visibility)return!1;if(t.opacity&&Number(t.opacity)<.1)return!1;let n;const a=window.innerHeight,r=e.getBoundingClientRect(),s=r.height,i=r.y,o=i+s,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(s<=a){if(e.offsetWidth+r.width===0||e.offsetHeight+r.height===0)return!1;if(c.x<0)return!1;if(c.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(c.y<0)return!1;if(c.y>(document.documentElement.clientHeight||window.innerHeight))return!1;n=document.elementFromPoint(c.x,c.y)}else{const e=a/2;if(i<0&&o<e)return!1;if(o>a&&i>e)return!1;n=document.elementFromPoint(c.x,a/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function oa(e,t,n){return!1===n?e:(n||(n=la),n(e,t,la))}var ca,ua,da,la=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):sa("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):sa({name:"session start",data:e})),e};function pa(e,t=vn.Storage.Session){var n;function a(e){try{return JSON.parse(e||"")}catch(t){let n=1,a="";return e&&(n=0,a=e),{e:n,v:a}}}let r,s;switch(t){case vn.Storage.Cookie:r=decodeURIComponent((null==(n=document.cookie.split("; ").find(t=>t.startsWith(e+"=")))?void 0:n.split("=")[1])||"");break;case vn.Storage.Local:s=a(window.localStorage.getItem(e));break;case vn.Storage.Session:s=a(window.sessionStorage.getItem(e))}return s&&(r=s.v,0!=s.e&&s.e<Date.now()&&(function(e,t=vn.Storage.Session){switch(t){case vn.Storage.Cookie:ma(e,"",0,t);break;case vn.Storage.Local:window.localStorage.removeItem(e);break;case vn.Storage.Session:window.sessionStorage.removeItem(e)}}(e,t),r="")),function(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}(r||"")}function ma(e,t,n=30,a=vn.Storage.Session,r){const s={e:Date.now()+6e4*n,v:String(t)},i=JSON.stringify(s);switch(a){case vn.Storage.Cookie:{t="object"==typeof t?JSON.stringify(t):t;let a=`${e}=${encodeURIComponent(t)}; max-age=${60*n}; path=/; SameSite=Lax; secure`;r&&(a+="; domain="+r),document.cookie=a;break}case vn.Storage.Local:window.localStorage.setItem(e,i);break;case vn.Storage.Session:window.sessionStorage.setItem(e,i)}return pa(e,a)}function fa(e={}){const t=Date.now(),{length:n=30,deviceKey:a="elbDeviceId",deviceStorage:r="local",deviceAge:s=30,sessionKey:i="elbSessionId",sessionStorage:o="local",pulse:c=!1}=e,u=ha(e);let d=!1;const l=Dn((e,t,n)=>{let a=pa(e,n);return a||(a=Ln(8),ma(e,a,1440*t,n)),String(a)})(a,s,r),p=Dn((e,a)=>{const r=JSON.parse(String(pa(e,a)));return c||(r.isNew=!1,u.marketing&&(Object.assign(r,u),d=!0),d||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,d=!0):r.runs++),r},()=>{d=!0})(i,o)||{},m={id:Ln(12),start:t,isNew:!0,count:1,runs:1},f=Object.assign(m,u,p,{device:l},{isStart:d,storage:!0,updated:t},e.data);return ma(i,JSON.stringify(f),2*n,o),f}function ha(e={}){let t=e.isStart||!1;const n={isStart:t,storage:!1};if(!1===e.isStart)return n;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return n}const a=new URL(e.url||window.location.href),r=e.referrer||document.referrer,s=r&&new URL(r).hostname,i=function(e,t={}){const n="clickId",a={},r={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:n,fbclid:n,gclid:n,msclkid:n,ttclid:n,twclid:n,igshid:n,sclid:n};return Object.entries(Pn(r,t)).forEach(([t,r])=>{const s=e.searchParams.get(t);s&&(r===n&&(r=t,a[n]=t),a[r]=s)}),a}(a,e.parameters);if(Object.keys(i).length&&(i.marketing||(i.marketing=!0),t=!0),!t){const n=e.domains||[];n.push(a.hostname),t=!n.includes(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:Ln(12),referrer:s},i,e.data):n}var ga=Object.defineProperty,ya=(e,t)=>{for(var n in t)ga(e,n,{get:t[n],enumerable:!0})},va={};ya(va,{BRAND:()=>es,DIRTY:()=>Ia,EMPTY_PATH:()=>Na,INVALID:()=>$a,NEVER:()=>Ks,OK:()=>Ra,ParseStatus:()=>Ea,Schema:()=>Ba,ZodAny:()=>wr,ZodArray:()=>Or,ZodBigInt:()=>yr,ZodBoolean:()=>vr,ZodBranded:()=>ts,ZodCatch:()=>Hr,ZodDate:()=>_r,ZodDefault:()=>Jr,ZodDiscriminatedUnion:()=>Cr,ZodEffects:()=>Kr,ZodEnum:()=>Vr,ZodError:()=>wa,ZodFirstPartyTypeKind:()=>Gr,ZodFunction:()=>Fr,ZodIntersection:()=>$r,ZodIssueCode:()=>ka,ZodLazy:()=>zr,ZodLiteral:()=>Dr,ZodMap:()=>Mr,ZodNaN:()=>Yr,ZodNativeEnum:()=>qr,ZodNever:()=>Ar,ZodNull:()=>xr,ZodNullable:()=>Xr,ZodNumber:()=>gr,ZodObject:()=>Pr,ZodOptional:()=>Wr,ZodParsedType:()=>_a,ZodPipeline:()=>ns,ZodPromise:()=>Br,ZodReadonly:()=>as,ZodRecord:()=>Rr,ZodSchema:()=>Ba,ZodSet:()=>Lr,ZodString:()=>fr,ZodSymbol:()=>br,ZodTransformer:()=>Kr,ZodTuple:()=>Ir,ZodType:()=>Ba,ZodUndefined:()=>kr,ZodUnion:()=>jr,ZodUnknown:()=>Zr,ZodVoid:()=>Sr,addIssueToContext:()=>Ca,any:()=>ys,array:()=>ks,bigint:()=>ls,boolean:()=>ps,coerce:()=>Bs,custom:()=>ss,date:()=>ms,datetimeRegex:()=>dr,defaultErrorMap:()=>Za,discriminatedUnion:()=>As,effect:()=>Ms,enum:()=>$s,function:()=>Ns,getErrorMap:()=>Oa,getParsedType:()=>ba,instanceof:()=>os,intersection:()=>Ss,isAborted:()=>Ma,isAsync:()=>za,isDirty:()=>La,isValid:()=>Fa,late:()=>is,lazy:()=>Cs,literal:()=>Es,makeIssue:()=>ja,map:()=>Ps,nan:()=>ds,nativeEnum:()=>Is,never:()=>_s,null:()=>gs,nullable:()=>Fs,number:()=>us,object:()=>xs,objectUtil:()=>da,oboolean:()=>qs,onumber:()=>Vs,optional:()=>Ls,ostring:()=>Us,pipeline:()=>Ds,preprocess:()=>zs,promise:()=>Rs,quotelessJson:()=>xa,record:()=>Ts,set:()=>js,setErrorMap:()=>Sa,strictObject:()=>ws,string:()=>cs,symbol:()=>fs,transformer:()=>Ms,tuple:()=>Os,undefined:()=>hs,union:()=>Zs,unknown:()=>vs,util:()=>ca,void:()=>bs}),(ua=ca||(ca={})).assertEqual=e=>{},ua.assertIs=function(e){},ua.assertNever=function(e){throw new Error},ua.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},ua.getValidEnumValues=e=>{const t=ua.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return ua.objectValues(n)},ua.objectValues=e=>ua.objectKeys(e).map(function(t){return e[t]}),ua.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},ua.find=(e,t)=>{for(const n of e)if(t(n))return n},ua.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,ua.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},ua.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(da||(da={})).mergeShapes=(e,t)=>({...e,...t});var _a=ca.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ba=e=>{switch(typeof e){case"undefined":return _a.undefined;case"string":return _a.string;case"number":return Number.isNaN(e)?_a.nan:_a.number;case"boolean":return _a.boolean;case"function":return _a.function;case"bigint":return _a.bigint;case"symbol":return _a.symbol;case"object":return Array.isArray(e)?_a.array:null===e?_a.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?_a.promise:"undefined"!=typeof Map&&e instanceof Map?_a.map:"undefined"!=typeof Set&&e instanceof Set?_a.set:"undefined"!=typeof Date&&e instanceof Date?_a.date:_a.object;default:return _a.unknown}},ka=ca.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"]),xa=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),wa=class e extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},a=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(a);else if("invalid_return_type"===r.code)a(r.returnTypeError);else if("invalid_arguments"===r.code)a(r.argumentsError);else if(0===r.path.length)n._errors.push(t(r));else{let e=n,a=0;for(;a<r.path.length;){const n=r.path[a];a===r.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(r))):e[n]=e[n]||{_errors:[]},e=e[n],a++}}};return a(this),n}static assert(t){if(!(t instanceof e))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ca.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const a of this.issues)if(a.path.length>0){const n=a.path[0];t[n]=t[n]||[],t[n].push(e(a))}else n.push(e(a));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};wa.create=e=>new wa(e);var Za=(e,t)=>{let n;switch(e.code){case ka.invalid_type:n=e.received===_a.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case ka.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ca.jsonStringifyReplacer)}`;break;case ka.unrecognized_keys:n=`Unrecognized key(s) in object: ${ca.joinValues(e.keys,", ")}`;break;case ka.invalid_union:n="Invalid input";break;case ka.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ca.joinValues(e.options)}`;break;case ka.invalid_enum_value:n=`Invalid enum value. Expected ${ca.joinValues(e.options)}, received '${e.received}'`;break;case ka.invalid_arguments:n="Invalid function arguments";break;case ka.invalid_return_type:n="Invalid function return type";break;case ka.invalid_date:n="Invalid date";break;case ka.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:ca.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case ka.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case ka.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case ka.custom:n="Invalid input";break;case ka.invalid_intersection_types:n="Intersection results could not be merged";break;case ka.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ka.not_finite:n="Number must be finite";break;default:n=t.defaultError,ca.assertNever(e)}return{message:n}},Aa=Za;function Sa(e){Aa=e}function Oa(){return Aa}var Ta,Pa,ja=e=>{const{data:t,path:n,errorMaps:a,issueData:r}=e,s=[...n,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const c=a.filter(e=>!!e).slice().reverse();for(const e of c)o=e(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}},Na=[];function Ca(e,t){const n=Oa(),a=ja({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Za?void 0:Za].filter(e=>!!e)});e.common.issues.push(a)}var Ea=class e{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const a of t){if("aborted"===a.status)return $a;"dirty"===a.status&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){const a=[];for(const e of n){const t=await e.key,n=await e.value;a.push({key:t,value:n})}return e.mergeObjectSync(t,a)}static mergeObjectSync(e,t){const n={};for(const a of t){const{key:t,value:r}=a;if("aborted"===t.status)return $a;if("aborted"===r.status)return $a;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!a.alwaysSet||(n[t.value]=r.value)}return{status:e.value,value:n}}},$a=Object.freeze({status:"aborted"}),Ia=e=>({status:"dirty",value:e}),Ra=e=>({status:"valid",value:e}),Ma=e=>"aborted"===e.status,La=e=>"dirty"===e.status,Fa=e=>"valid"===e.status,za=e=>"undefined"!=typeof Promise&&e instanceof Promise;(Pa=Ta||(Ta={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Pa.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var Da,Ua=class{constructor(e,t,n,a){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Va=(e,t)=>{if(Fa(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 wa(e.common.issues);return this._error=t,this._error}}};function qa(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:a,description:r}=e;if(t&&(n||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:r}:{errorMap:(t,r)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!=(s=null!=o?o:a)?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!=(i=null!=o?o:n)?i:r.defaultError}},description:r}}var Ba=class{get description(){return this._def.description}_getType(e){return ba(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ba(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ea,ctx:{common:e.parent.common,data:e.data,parsedType:ba(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(za(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const a={common:{issues:[],async:null!=(n=null==t?void 0:t.async)&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ba(e)},r=this._parseSync({data:e,path:a.path,parent:a});return Va(a,r)}"~validate"(e){var t,n;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ba(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Fa(t)?{value:t.value}:{issues:a.common.issues}}catch(e){(null==(n=null==(t=null==e?void 0:e.message)?void 0:t.toLowerCase())?void 0:n.includes("encountered"))&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:a}).then(e=>Fa(e)?{value:e.value}:{issues:a.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ba(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(za(a)?a:Promise.resolve(a));return Va(n,r)}refine(e,t){return this._refinement((n,a)=>{const r=e(n),s=()=>{return a.addIssue({code:ka.custom,...(e=n,"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t)});var e};return"undefined"!=typeof Promise&&r instanceof Promise?r.then(e=>!!e||(s(),!1)):!!r||(s(),!1)})}refinement(e,t){return this._refinement((n,a)=>!!e(n)||(a.addIssue("function"==typeof t?t(n,a):t),!1))}_refinement(e){return new Kr({schema:this,typeName:Gr.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 Wr.create(this,this._def)}nullable(){return Xr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Or.create(this)}promise(){return Br.create(this,this._def)}or(e){return jr.create([this,e],this._def)}and(e){return $r.create(this,e,this._def)}transform(e){return new Kr({...qa(this._def),schema:this,typeName:Gr.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Jr({...qa(this._def),innerType:this,defaultValue:t,typeName:Gr.ZodDefault})}brand(){return new ts({typeName:Gr.ZodBranded,type:this,...qa(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Hr({...qa(this._def),innerType:this,catchValue:t,typeName:Gr.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ns.create(this,e)}readonly(){return as.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Ka=/^c[^\s-]{8,}$/i,Wa=/^[0-9a-z]+$/,Xa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ja=/^[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,Ha=/^[a-z0-9_-]{21}$/i,Ya=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ga=/^[-+]?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)?)??$/,Qa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,er=/^(?:(?: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])$/,tr=/^(?:(?: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])$/,nr=/^(([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]))$/,ar=/^(([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])$/,rr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ir="((\\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])))",or=new RegExp(`^${ir}$`);function cr(e){let t="[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function ur(e){return new RegExp(`^${cr(e)}$`)}function dr(e){let t=`${ir}T${cr(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function lr(e,t){return!("v4"!==t&&t||!er.test(e))||!("v6"!==t&&t||!nr.test(e))}function pr(e,t){if(!Ya.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const a=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),r=JSON.parse(atob(a));return!("object"!=typeof r||null===r||"typ"in r&&"JWT"!==(null==r?void 0:r.typ)||!r.alg||t&&r.alg!==t)}catch(e){return!1}}function mr(e,t){return!("v4"!==t&&t||!tr.test(e))||!("v6"!==t&&t||!ar.test(e))}var fr=class e extends Ba{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_a.string){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.string,received:t.parsedType}),$a}const t=new Ea;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("max"===a.kind)e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),t.dirty());else if("length"===a.kind){const r=e.data.length>a.value,s=e.data.length<a.value;(r||s)&&(n=this._getOrReturnCtx(e,n),r?Ca(n,{code:ka.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&Ca(n,{code:ka.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)Qa.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"email",code:ka.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Da||(Da=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Da.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"emoji",code:ka.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Ja.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"uuid",code:ka.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Ha.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"nanoid",code:ka.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Ka.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"cuid",code:ka.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Wa.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"cuid2",code:ka.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Xa.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"ulid",code:ka.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),Ca(n,{validation:"url",code:ka.invalid_string,message:a.message}),t.dirty()}else"regex"===a.kind?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"regex",code:ka.invalid_string,message:a.message}),t.dirty())):"trim"===a.kind?e.data=e.data.trim():"includes"===a.kind?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),t.dirty()):"toLowerCase"===a.kind?e.data=e.data.toLowerCase():"toUpperCase"===a.kind?e.data=e.data.toUpperCase():"startsWith"===a.kind?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?dr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?or.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?ur(a).test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?Ga.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"duration",code:ka.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?lr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"ip",code:ka.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?pr(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"jwt",code:ka.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?mr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"cidr",code:ka.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?rr.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"base64",code:ka.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?sr.test(e.data)||(n=this._getOrReturnCtx(e,n),Ca(n,{validation:"base64url",code:ka.invalid_string,message:a.message}),t.dirty()):ca.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:ka.invalid_string,...Ta.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...Ta.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Ta.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Ta.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Ta.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Ta.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Ta.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Ta.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Ta.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Ta.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Ta.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Ta.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Ta.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Ta.errToObj(e)})}datetime(e){var t,n;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!=(t=null==e?void 0:e.offset)&&t,local:null!=(n=null==e?void 0:e.local)&&n,...Ta.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,...Ta.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Ta.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Ta.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Ta.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Ta.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Ta.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Ta.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Ta.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Ta.errToObj(t)})}nonempty(e){return this.min(1,Ta.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 hr(e,t){const n=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=n>a?n:a;return Number.parseInt(e.toFixed(r).replace(".",""))%Number.parseInt(t.toFixed(r).replace(".",""))/10**r}fr.create=e=>{var t;return new fr({checks:[],typeName:Gr.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...qa(e)})};var gr=class e extends Ba{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==_a.number){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.number,received:t.parsedType}),$a}let t;const n=new Ea;for(const a of this._def.checks)"int"===a.kind?ca.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==hr(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.not_finite,message:a.message}),n.dirty()):ca.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Ta.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ta.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ta.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ta.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:Ta.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:Ta.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ta.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ta.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ta.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ta.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ta.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Ta.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ta.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ta.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&&ca.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};gr.create=e=>new gr({checks:[],typeName:Gr.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...qa(e)});var yr=class e extends Ba{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)!==_a.bigint)return this._getInvalidInput(e);let t;const n=new Ea;for(const a of this._def.checks)"min"===a.kind?(a.inclusive?e.data<a.value:e.data<=a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"max"===a.kind?(a.inclusive?e.data>a.value:e.data>=a.value)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):"multipleOf"===a.kind?e.data%a.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ca(t,{code:ka.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):ca.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.bigint,received:t.parsedType}),$a}gte(e,t){return this.setLimit("min",e,!0,Ta.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Ta.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Ta.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Ta.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:Ta.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ta.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ta.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ta.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ta.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Ta.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}};yr.create=e=>{var t;return new yr({checks:[],typeName:Gr.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...qa(e)})};var vr=class extends Ba{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==_a.boolean){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.boolean,received:t.parsedType}),$a}return Ra(e.data)}};vr.create=e=>new vr({typeName:Gr.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...qa(e)});var _r=class e extends Ba{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_a.date){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.date,received:t.parsedType}),$a}if(Number.isNaN(e.data.getTime()))return Ca(this._getOrReturnCtx(e),{code:ka.invalid_date}),$a;const t=new Ea;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),t.dirty()):"max"===a.kind?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),Ca(n,{code:ka.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):ca.assertNever(a);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Ta.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Ta.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}};_r.create=e=>new _r({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Gr.ZodDate,...qa(e)});var br=class extends Ba{_parse(e){if(this._getType(e)!==_a.symbol){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.symbol,received:t.parsedType}),$a}return Ra(e.data)}};br.create=e=>new br({typeName:Gr.ZodSymbol,...qa(e)});var kr=class extends Ba{_parse(e){if(this._getType(e)!==_a.undefined){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.undefined,received:t.parsedType}),$a}return Ra(e.data)}};kr.create=e=>new kr({typeName:Gr.ZodUndefined,...qa(e)});var xr=class extends Ba{_parse(e){if(this._getType(e)!==_a.null){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.null,received:t.parsedType}),$a}return Ra(e.data)}};xr.create=e=>new xr({typeName:Gr.ZodNull,...qa(e)});var wr=class extends Ba{constructor(){super(...arguments),this._any=!0}_parse(e){return Ra(e.data)}};wr.create=e=>new wr({typeName:Gr.ZodAny,...qa(e)});var Zr=class extends Ba{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ra(e.data)}};Zr.create=e=>new Zr({typeName:Gr.ZodUnknown,...qa(e)});var Ar=class extends Ba{_parse(e){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.never,received:t.parsedType}),$a}};Ar.create=e=>new Ar({typeName:Gr.ZodNever,...qa(e)});var Sr=class extends Ba{_parse(e){if(this._getType(e)!==_a.undefined){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.void,received:t.parsedType}),$a}return Ra(e.data)}};Sr.create=e=>new Sr({typeName:Gr.ZodVoid,...qa(e)});var Or=class e extends Ba{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==_a.array)return Ca(t,{code:ka.invalid_type,expected:_a.array,received:t.parsedType}),$a;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&(Ca(t,{code:e?ka.too_big:ka.too_small,minimum:r?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(Ca(t,{code:ka.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(Ca(t,{code:ka.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>a.type._parseAsync(new Ua(t,e,t.path,n)))).then(e=>Ea.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new Ua(t,e,t.path,n)));return Ea.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:Ta.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:Ta.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:Ta.toString(n)}})}nonempty(e){return this.min(1,e)}};function Tr(e){if(e instanceof Pr){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Wr.create(Tr(a))}return new Pr({...e._def,shape:()=>t})}return e instanceof Or?new Or({...e._def,type:Tr(e.element)}):e instanceof Wr?Wr.create(Tr(e.unwrap())):e instanceof Xr?Xr.create(Tr(e.unwrap())):e instanceof Ir?Ir.create(e.items.map(e=>Tr(e))):e}Or.create=(e,t)=>new Or({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Gr.ZodArray,...qa(t)});var Pr=class e extends Ba{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=ca.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==_a.object){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.object,received:t.parsedType}),$a}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ar&&"strip"===this._def.unknownKeys))for(const e in n.data)r.includes(e)||s.push(e);const i=[];for(const e of r){const t=a[e],r=n.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new Ua(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Ar){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:n.data[e]}});else if("strict"===e)s.length>0&&(Ca(n,{code:ka.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 a=n.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new Ua(n,a,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of i){const n=await t.key,a=await t.value;e.push({key:n,value:a,alwaysSet:t.alwaysSet})}return e}).then(e=>Ea.mergeObjectSync(t,e)):Ea.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return Ta.errToObj,new e({...this._def,unknownKeys:"strict",...void 0!==t?{errorMap:(e,n)=>{var a,r,s,i;const o=null!=(s=null==(r=(a=this._def).errorMap)?void 0:r.call(a,e,n).message)?s:n.defaultError;return"unrecognized_keys"===e.code?{message:null!=(i=Ta.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:Gr.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(t){return new e({...this._def,catchall:t})}pick(t){const n={};for(const e of ca.objectKeys(t))t[e]&&this.shape[e]&&(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}omit(t){const n={};for(const e of ca.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return Tr(this)}partial(t){const n={};for(const e of ca.objectKeys(this.shape)){const a=this.shape[e];t&&!t[e]?n[e]=a:n[e]=a.optional()}return new e({...this._def,shape:()=>n})}required(t){const n={};for(const e of ca.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Wr;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return Ur(ca.objectKeys(this.shape))}};Pr.create=(e,t)=>new Pr({shape:()=>e,unknownKeys:"strip",catchall:Ar.create(),typeName:Gr.ZodObject,...qa(t)}),Pr.strictCreate=(e,t)=>new Pr({shape:()=>e,unknownKeys:"strict",catchall:Ar.create(),typeName:Gr.ZodObject,...qa(t)}),Pr.lazycreate=(e,t)=>new Pr({shape:e,unknownKeys:"strip",catchall:Ar.create(),typeName:Gr.ZodObject,...qa(t)});var jr=class extends Ba{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const n=e.map(e=>new wa(e.ctx.common.issues));return Ca(t,{code:ka.invalid_union,unionErrors:n}),$a});{let e;const a=[];for(const r of n){const n={...t,common:{...t.common,issues:[]},parent:null},s=r._parseSync({data:t.data,path:t.path,parent:n});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:n}),n.common.issues.length&&a.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=a.map(e=>new wa(e));return Ca(t,{code:ka.invalid_union,unionErrors:r}),$a}}get options(){return this._def.options}};jr.create=(e,t)=>new jr({options:e,typeName:Gr.ZodUnion,...qa(t)});var Nr=e=>e instanceof zr?Nr(e.schema):e instanceof Kr?Nr(e.innerType()):e instanceof Dr?[e.value]:e instanceof Vr?e.options:e instanceof qr?ca.objectValues(e.enum):e instanceof Jr?Nr(e._def.innerType):e instanceof kr?[void 0]:e instanceof xr?[null]:e instanceof Wr?[void 0,...Nr(e.unwrap())]:e instanceof Xr?[null,...Nr(e.unwrap())]:e instanceof ts||e instanceof as?Nr(e.unwrap()):e instanceof Hr?Nr(e._def.innerType):[],Cr=class e extends Ba{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_a.object)return Ca(t,{code:ka.invalid_type,expected:_a.object,received:t.parsedType}),$a;const n=this.discriminator,a=t.data[n],r=this.optionsMap.get(a);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(Ca(t,{code:ka.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),$a)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,a){const r=new Map;for(const e of n){const n=Nr(e.shape[t]);if(!n.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of n){if(r.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);r.set(a,e)}}return new e({typeName:Gr.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...qa(a)})}};function Er(e,t){const n=ba(e),a=ba(t);if(e===t)return{valid:!0,data:e};if(n===_a.object&&a===_a.object){const n=ca.objectKeys(t),a=ca.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=Er(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===_a.array&&a===_a.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=Er(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===_a.date&&a===_a.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var $r=class extends Ba{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(Ma(e)||Ma(a))return $a;const r=Er(e.value,a.value);return r.valid?((La(e)||La(a))&&t.dirty(),{status:t.value,value:r.data}):(Ca(n,{code:ka.invalid_intersection_types}),$a)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>a(e,t)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};$r.create=(e,t,n)=>new $r({left:e,right:t,typeName:Gr.ZodIntersection,...qa(n)});var Ir=class e extends Ba{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_a.array)return Ca(n,{code:ka.invalid_type,expected:_a.array,received:n.parsedType}),$a;if(n.data.length<this._def.items.length)return Ca(n,{code:ka.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),$a;!this._def.rest&&n.data.length>this._def.items.length&&(Ca(n,{code:ka.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map((e,t)=>{const a=this._def.items[t]||this._def.rest;return a?a._parse(new Ua(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>Ea.mergeArray(t,e)):Ea.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Ir.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ir({items:e,typeName:Gr.ZodTuple,rest:null,...qa(t)})};var Rr=class e extends Ba{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_a.object)return Ca(n,{code:ka.invalid_type,expected:_a.object,received:n.parsedType}),$a;const a=[],r=this._def.keyType,s=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new Ua(n,e,n.path,e)),value:s._parse(new Ua(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ea.mergeObjectAsync(t,a):Ea.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof Ba?{keyType:t,valueType:n,typeName:Gr.ZodRecord,...qa(a)}:{keyType:fr.create(),valueType:t,typeName:Gr.ZodRecord,...qa(n)})}},Mr=class extends Ba{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_a.map)return Ca(n,{code:ka.invalid_type,expected:_a.map,received:n.parsedType}),$a;const a=this._def.keyType,r=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:a._parse(new Ua(n,e,n.path,[s,"key"])),value:r._parse(new Ua(n,t,n.path,[s,"value"]))}));if(n.common.async){const e=new Map;return Promise.resolve().then(async()=>{for(const n of s){const a=await n.key,r=await n.value;if("aborted"===a.status||"aborted"===r.status)return $a;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}})}{const e=new Map;for(const n of s){const a=n.key,r=n.value;if("aborted"===a.status||"aborted"===r.status)return $a;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Mr.create=(e,t,n)=>new Mr({valueType:t,keyType:e,typeName:Gr.ZodMap,...qa(n)});var Lr=class e extends Ba{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_a.set)return Ca(n,{code:ka.invalid_type,expected:_a.set,received:n.parsedType}),$a;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(Ca(n,{code:ka.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(Ca(n,{code:ka.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const r=this._def.valueType;function s(e){const n=new Set;for(const a of e){if("aborted"===a.status)return $a;"dirty"===a.status&&t.dirty(),n.add(a.value)}return{status:t.value,value:n}}const i=[...n.data.values()].map((e,t)=>r._parse(new Ua(n,e,n.path,t)));return n.common.async?Promise.all(i).then(e=>s(e)):s(i)}min(t,n){return new e({...this._def,minSize:{value:t,message:Ta.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:Ta.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Lr.create=(e,t)=>new Lr({valueType:e,minSize:null,maxSize:null,typeName:Gr.ZodSet,...qa(t)});var Fr=class e extends Ba{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_a.function)return Ca(t,{code:ka.invalid_type,expected:_a.function,received:t.parsedType}),$a;function n(e,n){return ja({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oa(),Za].filter(e=>!!e),issueData:{code:ka.invalid_arguments,argumentsError:n}})}function a(e,n){return ja({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Oa(),Za].filter(e=>!!e),issueData:{code:ka.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Br){const e=this;return Ra(async function(...t){const i=new wa([]),o=await e._def.args.parseAsync(t,r).catch(e=>{throw i.addIssue(n(t,e)),i}),c=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(c,r).catch(e=>{throw i.addIssue(a(c,e)),i})})}{const e=this;return Ra(function(...t){const i=e._def.args.safeParse(t,r);if(!i.success)throw new wa([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new wa([a(o,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Ir.create(t).rest(Zr.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,a){return new e({args:t||Ir.create([]).rest(Zr.create()),returns:n||Zr.create(),typeName:Gr.ZodFunction,...qa(a)})}},zr=class extends Ba{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})}};zr.create=(e,t)=>new zr({getter:e,typeName:Gr.ZodLazy,...qa(t)});var Dr=class extends Ba{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ca(t,{received:t.data,code:ka.invalid_literal,expected:this._def.value}),$a}return{status:"valid",value:e.data}}get value(){return this._def.value}};function Ur(e,t){return new Vr({values:e,typeName:Gr.ZodEnum,...qa(t)})}Dr.create=(e,t)=>new Dr({value:e,typeName:Gr.ZodLiteral,...qa(t)});var Vr=class e extends Ba{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Ca(t,{expected:ca.joinValues(n),received:t.parsedType,code:ka.invalid_type}),$a}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Ca(t,{received:t.data,code:ka.invalid_enum_value,options:n}),$a}return Ra(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(t,n=this._def){return e.create(t,{...this._def,...n})}exclude(t,n=this._def){return e.create(this.options.filter(e=>!t.includes(e)),{...this._def,...n})}};Vr.create=Ur;var qr=class extends Ba{_parse(e){const t=ca.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_a.string&&n.parsedType!==_a.number){const e=ca.objectValues(t);return Ca(n,{expected:ca.joinValues(e),received:n.parsedType,code:ka.invalid_type}),$a}if(this._cache||(this._cache=new Set(ca.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=ca.objectValues(t);return Ca(n,{received:n.data,code:ka.invalid_enum_value,options:e}),$a}return Ra(e.data)}get enum(){return this._def.values}};qr.create=(e,t)=>new qr({values:e,typeName:Gr.ZodNativeEnum,...qa(t)});var Br=class extends Ba{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==_a.promise&&!1===t.common.async)return Ca(t,{code:ka.invalid_type,expected:_a.promise,received:t.parsedType}),$a;const n=t.parsedType===_a.promise?t.data:Promise.resolve(t.data);return Ra(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Br.create=(e,t)=>new Br({type:e,typeName:Gr.ZodPromise,...qa(t)});var Kr=class extends Ba{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Gr.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=this._def.effect||null,r={addIssue:e=>{Ca(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===a.type){const e=a.transform(n.data,r);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return $a;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?$a:"dirty"===a.status||"dirty"===t.value?Ia(a.value):a});{if("aborted"===t.value)return $a;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?$a:"dirty"===a.status||"dirty"===t.value?Ia(a.value):a}}if("refinement"===a.type){const e=e=>{const t=a.refinement(e,r);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===a.status?$a:("dirty"===a.status&&t.dirty(),e(a.value),{status:t.value,value:a.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?$a:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===a.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Fa(e))return $a;const s=a.transform(e.value,r);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>Fa(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):$a)}ca.assertNever(a)}};Kr.create=(e,t,n)=>new Kr({schema:e,typeName:Gr.ZodEffects,effect:t,...qa(n)}),Kr.createWithPreprocess=(e,t,n)=>new Kr({schema:t,effect:{type:"preprocess",transform:e},typeName:Gr.ZodEffects,...qa(n)});var Wr=class extends Ba{_parse(e){return this._getType(e)===_a.undefined?Ra(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Wr.create=(e,t)=>new Wr({innerType:e,typeName:Gr.ZodOptional,...qa(t)});var Xr=class extends Ba{_parse(e){return this._getType(e)===_a.null?Ra(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Xr.create=(e,t)=>new Xr({innerType:e,typeName:Gr.ZodNullable,...qa(t)});var Jr=class extends Ba{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===_a.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:Gr.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...qa(t)});var Hr=class extends Ba{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return za(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new wa(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new wa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Hr.create=(e,t)=>new Hr({innerType:e,typeName:Gr.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...qa(t)});var Yr=class extends Ba{_parse(e){if(this._getType(e)!==_a.nan){const t=this._getOrReturnCtx(e);return Ca(t,{code:ka.invalid_type,expected:_a.nan,received:t.parsedType}),$a}return{status:"valid",value:e.data}}};Yr.create=e=>new Yr({typeName:Gr.ZodNaN,...qa(e)});var Gr,Qr,es=Symbol("zod_brand"),ts=class extends Ba{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ns=class e extends Ba{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?$a:"dirty"===e.status?(t.dirty(),Ia(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?$a:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:Gr.ZodPipeline})}},as=class extends Ba{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Fa(e)&&(e.value=Object.freeze(e.value)),e);return za(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function rs(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function ss(e,t={},n){return e?wr.create().superRefine((a,r)=>{var s,i;const o=e(a);if(o instanceof Promise)return o.then(e=>{var s,i;if(!e){const e=rs(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=rs(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}}):wr.create()}as.create=(e,t)=>new as({innerType:e,typeName:Gr.ZodReadonly,...qa(t)});var is={object:Pr.lazycreate};(Qr=Gr||(Gr={})).ZodString="ZodString",Qr.ZodNumber="ZodNumber",Qr.ZodNaN="ZodNaN",Qr.ZodBigInt="ZodBigInt",Qr.ZodBoolean="ZodBoolean",Qr.ZodDate="ZodDate",Qr.ZodSymbol="ZodSymbol",Qr.ZodUndefined="ZodUndefined",Qr.ZodNull="ZodNull",Qr.ZodAny="ZodAny",Qr.ZodUnknown="ZodUnknown",Qr.ZodNever="ZodNever",Qr.ZodVoid="ZodVoid",Qr.ZodArray="ZodArray",Qr.ZodObject="ZodObject",Qr.ZodUnion="ZodUnion",Qr.ZodDiscriminatedUnion="ZodDiscriminatedUnion",Qr.ZodIntersection="ZodIntersection",Qr.ZodTuple="ZodTuple",Qr.ZodRecord="ZodRecord",Qr.ZodMap="ZodMap",Qr.ZodSet="ZodSet",Qr.ZodFunction="ZodFunction",Qr.ZodLazy="ZodLazy",Qr.ZodLiteral="ZodLiteral",Qr.ZodEnum="ZodEnum",Qr.ZodEffects="ZodEffects",Qr.ZodNativeEnum="ZodNativeEnum",Qr.ZodOptional="ZodOptional",Qr.ZodNullable="ZodNullable",Qr.ZodDefault="ZodDefault",Qr.ZodCatch="ZodCatch",Qr.ZodPromise="ZodPromise",Qr.ZodBranded="ZodBranded",Qr.ZodPipeline="ZodPipeline",Qr.ZodReadonly="ZodReadonly";var os=(e,t={message:`Input not instance of ${e.name}`})=>ss(t=>t instanceof e,t),cs=fr.create,us=gr.create,ds=Yr.create,ls=yr.create,ps=vr.create,ms=_r.create,fs=br.create,hs=kr.create,gs=xr.create,ys=wr.create,vs=Zr.create,_s=Ar.create,bs=Sr.create,ks=Or.create,xs=Pr.create,ws=Pr.strictCreate,Zs=jr.create,As=Cr.create,Ss=$r.create,Os=Ir.create,Ts=Rr.create,Ps=Mr.create,js=Lr.create,Ns=Fr.create,Cs=zr.create,Es=Dr.create,$s=Vr.create,Is=qr.create,Rs=Br.create,Ms=Kr.create,Ls=Wr.create,Fs=Xr.create,zs=Kr.createWithPreprocess,Ds=ns.create,Us=()=>cs().optional(),Vs=()=>us().optional(),qs=()=>ps().optional(),Bs={string:e=>fr.create({...e,coerce:!0}),number:e=>gr.create({...e,coerce:!0}),boolean:e=>vr.create({...e,coerce:!0}),bigint:e=>yr.create({...e,coerce:!0}),date:e=>_r.create({...e,coerce:!0})},Ks=$a,Ws=Symbol("Let zodToJsonSchema decide on which parser to use"),Xs={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"};function Js(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Hs(e,t,n,a,r){e[t]=n,Js(e,t,a,r)}var Ys=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Gs(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Ys(t,e.currentPath):t.join("/")}}function Qs(e,t){return Ai(e.type._def,t)}function ei(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>ei(e,t,n))};switch(a){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return ti(e,t)}}var ti=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const a of e.checks)switch(a.kind){case"min":Hs(n,"minimum",a.value,a.message,t);break;case"max":Hs(n,"maximum",a.value,a.message,t)}return n},ni=void 0,ai=/^[cC][^\s-]{8,}$/,ri=/^[0-9a-z]+$/,si=/^[0-9A-HJKMNP-TV-Z]{26}$/,ii=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,oi=()=>(void 0===ni&&(ni=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ni),ci=/^(?:(?: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])$/,ui=/^(([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])$/,di=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,li=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,pi=/^[a-zA-Z0-9_-]{21}$/,mi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function fi(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Hs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Hs(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"email":switch(t.emailStrategy){case"format:email":yi(n,"email",a.message,t);break;case"format:idn-email":yi(n,"idn-email",a.message,t);break;case"pattern:zod":vi(n,ii,a.message,t)}break;case"url":yi(n,"uri",a.message,t);break;case"uuid":yi(n,"uuid",a.message,t);break;case"regex":vi(n,a.regex,a.message,t);break;case"cuid":vi(n,ai,a.message,t);break;case"cuid2":vi(n,ri,a.message,t);break;case"startsWith":vi(n,RegExp(`^${hi(a.value,t)}`),a.message,t);break;case"endsWith":vi(n,RegExp(`${hi(a.value,t)}$`),a.message,t);break;case"datetime":yi(n,"date-time",a.message,t);break;case"date":yi(n,"date",a.message,t);break;case"time":yi(n,"time",a.message,t);break;case"duration":yi(n,"duration",a.message,t);break;case"length":Hs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Hs(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":vi(n,RegExp(hi(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&yi(n,"ipv4",a.message,t),"v4"!==a.version&&yi(n,"ipv6",a.message,t);break;case"base64url":vi(n,li,a.message,t);break;case"jwt":vi(n,mi,a.message,t);break;case"cidr":"v6"!==a.version&&vi(n,ci,a.message,t),"v4"!==a.version&&vi(n,ui,a.message,t);break;case"emoji":vi(n,oi(),a.message,t);break;case"ulid":vi(n,si,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":yi(n,"binary",a.message,t);break;case"contentEncoding:base64":Hs(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":vi(n,di,a.message,t)}break;case"nanoid":vi(n,pi,a.message,t)}return n}function hi(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)gi.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var gi=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function yi(e,t,n,a){var r;e.format||(null==(r=e.anyOf)?void 0:r.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&a.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&a.errorMessages&&{errorMessage:{format:n}}})):Hs(e,"format",t,n,a)}function vi(e,t,n,a){var r;e.pattern||(null==(r=e.allOf)?void 0:r.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&a.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:_i(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Hs(e,"pattern",_i(t,a),n,a)}function _i(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const a=e.flags.includes("i"),r=e.flags.includes("m"),s=e.flags.includes("s"),i=a?e.source.toLowerCase():e.source;let o="",c=!1,u=!1,d=!1;for(let e=0;e<i.length;e++)if(c)o+=i[e],c=!1;else{if(a)if(u){if(i[e].match(/[a-z]/)){d?(o+=i[e],o+=`${i[e-2]}-${i[e]}`.toUpperCase(),d=!1):"-"===i[e+1]&&(null==(n=i[e+2])?void 0:n.match(/[a-z]/))?(o+=i[e],d=!0):o+=`${i[e]}${i[e].toUpperCase()}`;continue}}else if(i[e].match(/[a-z]/)){o+=`[${i[e]}${i[e].toUpperCase()}]`;continue}if(r){if("^"===i[e]){o+="(^|(?<=[\r\n]))";continue}if("$"===i[e]){o+="($|(?=[\r\n]))";continue}}s&&"."===i[e]?o+=u?`${i[e]}\r\n`:`[${i[e]}\r\n]`:(o+=i[e],"\\"===i[e]?c=!0:u&&"]"===i[e]?u=!1:u||"["!==i[e]||(u=!0))}try{new RegExp(o)}catch(n){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function bi(e,t){var n,a,r,s,i,o,c;if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&(null==(n=e.keyType)?void 0:n._def.typeName)===Gr.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=Ai(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:Gs(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(a=Ai(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?a:t.allowedAdditionalProperties};if("openApi3"===t.target)return u;if((null==(r=e.keyType)?void 0:r._def.typeName)===Gr.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...a}=fi(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===Gr.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===Gr.ZodBranded&&e.keyType._def.type._def.typeName===Gr.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=Qs(e.keyType._def,t);return{...u,propertyNames:a}}return u}var ki={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},xi=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Ai(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function wi(e){try{return e.isOptional()}catch(e){return!0}}var Zi=(e,t,n)=>{switch(t){case Gr.ZodString:return fi(e,n);case Gr.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"int":n.type="integer",Js(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Hs(n,"minimum",a.value,a.message,t):Hs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Hs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Hs(n,"maximum",a.value,a.message,t):Hs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Hs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Hs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Gr.ZodObject:return function(e,t){const n="openAi"===t.target,a={type:"object",properties:{}},r=[],s=e.shape();for(const e in s){let i=s[e];if(void 0===i||void 0===i._def)continue;let o=wi(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=Ai(i._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==c&&(a.properties[e]=c,o||r.push(e))}r.length&&(a.required=r);const i=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Ai(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&&(a.additionalProperties=i),a}(e,n);case Gr.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const a of e.checks)switch(a.kind){case"min":"jsonSchema7"===t.target?a.inclusive?Hs(n,"minimum",a.value,a.message,t):Hs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Hs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Hs(n,"maximum",a.value,a.message,t):Hs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Hs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Hs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case Gr.ZodBoolean:return{type:"boolean"};case Gr.ZodDate:return ei(e,n);case Gr.ZodUndefined:return{not:Gs(n)};case Gr.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case Gr.ZodArray:return function(e,t){var n,a,r;const s={type:"array"};return(null==(n=e.type)?void 0:n._def)&&(null==(r=null==(a=e.type)?void 0:a._def)?void 0:r.typeName)!==Gr.ZodAny&&(s.items=Ai(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Hs(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Hs(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Hs(s,"minItems",e.exactLength.value,e.exactLength.message,t),Hs(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case Gr.ZodUnion:case Gr.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return xi(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in ki&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=ki[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return xi(e,t)}(e,n);case Gr.ZodIntersection:return function(e,t){const n=[Ai(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Ai(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let a="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const r=[];return n.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...a}=e;t=a}else a=void 0;r.push(t)}else r.push(...e.allOf),void 0===e.unevaluatedProperties&&(a=void 0);var t}),r.length?{allOf:r,...a}:void 0}(e,n);case Gr.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>Ai(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Ai(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Ai(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case Gr.ZodRecord:return bi(e,n);case Gr.ZodLiteral:return function(e,t){const n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case Gr.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case Gr.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),a=Array.from(new Set(n.map(e=>typeof e)));return{type:1===a.length?"string"===a[0]?"string":"number":["string","number"],enum:n}}(e);case Gr.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:ki[e.innerType._def.typeName],nullable:!0}:{type:[ki[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=Ai(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=Ai(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case Gr.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return Ai(e.innerType._def,t);const a=Ai(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:Gs(t)},a]}:Gs(t)})(e,n);case Gr.ZodMap:return function(e,t){return"record"===t.mapStrategy?bi(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Ai(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Gs(t),Ai(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Gs(t)],minItems:2,maxItems:2}}}(e,n);case Gr.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:Ai(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Hs(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Hs(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case Gr.ZodLazy:return()=>e.getter()._def;case Gr.ZodPromise:return function(e,t){return Ai(e.type._def,t)}(e,n);case Gr.ZodNaN:case Gr.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Gs({...e,currentPath:[...e.currentPath,"not"]})}}(n);case Gr.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Ai(e.schema._def,t):Gs(t)}(e,n);case Gr.ZodAny:return Gs(n);case Gr.ZodUnknown:return function(e){return Gs(e)}(n);case Gr.ZodDefault:return function(e,t){return{...Ai(e.innerType._def,t),default:e.defaultValue()}}(e,n);case Gr.ZodBranded:return Qs(e,n);case Gr.ZodReadonly:case Gr.ZodCatch:return((e,t)=>Ai(e.innerType._def,t))(e,n);case Gr.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Ai(e.in._def,t);if("output"===t.pipeStrategy)return Ai(e.out._def,t);const n=Ai(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Ai(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case Gr.ZodFunction:case Gr.ZodVoid:case Gr.ZodSymbol:default:return}};function Ai(e,t,n=!1){var a;const r=t.seen.get(e);if(t.override){const s=null==(a=t.override)?void 0:a.call(t,e,t,r,n);if(s!==Ws)return s}if(r&&!n){const e=Si(r,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=Zi(e,e.typeName,t),o="function"==typeof i?Ai(i(),t):i;if(o&&Oi(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var Si=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Ys(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Gs(t)):"seen"===t.$refStrategy?Gs(t):void 0}},Oi=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),Ti=(e,t)=>{var n;const a=(e=>{const t="string"==typeof(a=e)?{...Xs,name:a}:{...Xs,...a},n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;var a;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}})(t);let r="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,n])=>{var r;return{...e,[t]:null!=(r=Ai(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:Gs(a)}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,i=null!=(n=Ai(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?n:Gs(a),o="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==o&&(i.title=o),a.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[a.openAiAnyTypeName]||(r[a.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===a.$refStrategy?"1":[...a.basePath,a.definitionPath,a.openAiAnyTypeName].join("/")}}));const c=void 0===s?r?{...i,[a.definitionPath]:r}:i:{$ref:[..."relative"===a.$refStrategy?[]:a.basePath,a.definitionPath,s].join("/"),[a.definitionPath]:{...r,[s]:i}};return"jsonSchema7"===a.target?c.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==a.target&&"openAi"!==a.target||(c.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===a.target&&("anyOf"in c||"oneOf"in c||"allOf"in c||"type"in c&&Array.isArray(c.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),c},Pi=va.record(va.string(),va.boolean()).describe("Consent requirement mapping"),ji=va.lazy(()=>va.union([va.string(),va.number(),va.boolean(),$i,va.array(ji)])),Ni=va.tuple([ji,ji]).describe("Loop: [source, transform] tuple for array transformations"),Ci=va.array(ji).describe("Set: Array of values"),Ei=va.record(va.string(),ji).describe("Map: Object mapping keys to values"),$i=va.object({key:va.string().optional().describe('Property path (e.g., "data.id")'),value:va.union([va.string(),va.number(),va.boolean()]).optional().describe("Static primitive value"),fn:va.string().optional().describe("Function string for custom transformation"),map:Ei.optional().describe("Object with key-value mappings"),loop:Ni.optional().describe("Tuple [source, transform]"),set:Ci.optional().describe("Array of values"),consent:Pi.optional().describe("Required consent states"),condition:va.string().optional().describe("Condition function string"),validate:va.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"),Ii=Ni,Ri=Ci,Mi=Ei,Li=(Ti($i,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),Ti(Ii,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),Ti(Ri,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),Ti(Mi,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function Fi(e,t={},n={}){n={...Li,...n};const a=Object.entries(t).reduce((t,[a,r])=>{const s=e[a];return n.merge&&Array.isArray(s)&&Array.isArray(r)?t[a]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...s]):(n.extend||a in e)&&(t[a]=r),t},{});return n.shallow?{...e,...a}:(Object.assign(e,a),e)}function zi(e){return Array.isArray(e)}function Di(e){return e===document||e instanceof Element}function Ui(e){return"object"==typeof e&&null!==e&&!zi(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Vi(e){return"string"==typeof e}function qi(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Bi(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Ki(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Wi(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function Xi(e,t,n,a=!0){return so(ra(t,Wi(e,n,a))||"").reduce((e,n)=>{let[a,r]=io(n);if(!a)return e;if(r||(a.endsWith(":")&&(a=a.slice(0,-1)),r=""),r.startsWith("#")){r=r.slice(1);try{let e=t[r];e||"selected"!==r||(e=t.options[t.selectedIndex].text),r=String(e)}catch(e){r=""}}return a.endsWith("[]")?(a=a.slice(0,-2),zi(e[a])||(e[a]=[]),e[a].push(qi(r))):e[a]=qi(r),e},{})}function Ji(e,t=Wn.Prefix){var n;const a=e||document.body;if(!a)return[];let r=[];const s=Wn.Action,i=`[${Wi(t,s,!1)}]`,o=e=>{Object.keys(Xi(t,e,s,!1)).forEach(n=>{r=r.concat(Hi(e,n,t))})};return a!==document&&(null==(n=a.matches)?void 0:n.call(a,i))&&o(a),ro(a,i,o),r}function Hi(e,t,n=Wn.Prefix){const a=[],{actions:r,nearestOnly:s}=function(e,t,n){let a=t;for(;a;){const t=ra(a,Wi(e,Wn.Actions,!1));if(t){const e=Qi(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=ra(a,Wi(e,Wn.Action,!1));if(r){const e=Qi(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}a=no(e,a)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const i=so(r.actionParams||"",",").reduce((e,t)=>(e[Ki(t)]=!0,e),{}),o=eo(n,e,i,s);if(!o.length){const t="page",a=`[${Wi(n,t)}]`,[r,s]=ao(e,a,n,t);o.push({entity:t,data:r,nested:[],context:s})}o.forEach(e=>{a.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),a):a}function Yi(e=Wn.Prefix,t=document){const n=Wi(e,Wn.Globals,!1);let a={};return ro(t,`[${n}]`,t=>{a=Fi(a,Xi(e,t,Wn.Globals,!1))}),a}function Gi(e,t){const n=window.location,a="page",r=t===document?document.body:t,[s,i]=ao(r,`[${Wi(e,a)}]`,e,a);return s.domain=n.hostname,s.title=document.title,s.referrer=document.referrer,n.search&&(s.search=n.search),n.hash&&(s.hash=n.hash),[s,i]}function Qi(e){const t={};return so(e).forEach(e=>{const[n,a]=io(e),[r,s]=oo(n);if(!r)return;let[i,o]=oo(a||"");i=i||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:s,action:i,actionParams:o})}),t}function eo(e,t,n,a=!1){const r=[];let s=t;for(n=0!==Object.keys(n||{}).length?n:void 0;s;){const i=to(e,s,t,n);if(i&&(r.push(i),a))break;s=no(e,s)}return r}function to(e,t,n,a){const r=ra(t,Wi(e));if(!r||a&&!a[r])return null;const s=[t],i=`[${Wi(e,r)}],[${Wi(e,"")}]`,o=Wi(e,Wn.Link,!1);let c={};const u=[],[d,l]=ao(n||t,i,e,r);ro(t,`[${o}]`,t=>{const[n,a]=io(ra(t,o));"parent"===a&&ro(document.body,`[${o}="${n}:child"]`,t=>{s.push(t);const n=to(e,t);n&&u.push(n)})});const p=[];s.forEach(e=>{e.matches(i)&&p.push(e),ro(e,i,e=>p.push(e))});let m={};return p.forEach(t=>{m=Fi(m,Xi(e,t,"")),c=Fi(c,Xi(e,t,r))}),c=Fi(Fi(m,c),d),s.forEach(t=>{ro(t,`[${Wi(e)}]`,t=>{const n=to(e,t);n&&u.push(n)})}),{entity:r,data:c,context:l,nested:u}}function no(e,t){const n=Wi(e,Wn.Link,!1);if(t.matches(`[${n}]`)){const[e,a]=io(ra(t,n));if("child"===a)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function ao(e,t,n,a){let r={};const s={};let i=e;const o=`[${Wi(n,Wn.Context,!1)}]`;let c=0;for(;i;)i.matches(t)&&(r=Fi(Xi(n,i,""),r),r=Fi(Xi(n,i,a),r)),i.matches(o)&&(Object.entries(Xi(n,i,Wn.Context,!1)).forEach(([e,t])=>{t&&!s[e]&&(s[e]=[t,c])}),++c),i=no(n,i);return[r,s]}function ro(e,t,n){e.querySelectorAll(t).forEach(n)}function so(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function io(e){const[t,n]=e.split(/:(.+)/,2);return[Ki(t),Ki(n)]}function oo(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var co,uo=new WeakMap,lo=new WeakMap,po=new WeakMap;function mo(e){const t=Date.now();let n=lo.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:ia(e),lastChecked:t},lo.set(e,n)),n.isVisible}function fo(e){if(window.IntersectionObserver)return Bi(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,a;const r=t.target,s=po.get(e);if(!s)return;const i=s.timers.get(r);if(t.intersectionRatio>0){const a=Date.now();let o=uo.get(r);if((!o||a-o.lastChecked>1e3)&&(o={isLarge:r.offsetHeight>window.innerHeight,lastChecked:a},uo.set(r,o)),t.intersectionRatio>=.5||o.isLarge&&mo(r)){const t=null==(n=s.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!i){const t=window.setTimeout(async()=>{var t,n;if(mo(r)){const a=null==(t=s.elementConfigs)?void 0:t.get(r);(null==a?void 0:a.context)&&await Oo(a.context,r,a.trigger);const i=null==(n=s.elementConfigs)?void 0:n.get(r);(null==i?void 0:i.multiple)?i.blocked=!0:function(e,t){const n=po.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const a=n.timers.get(t);a&&(clearTimeout(a),n.timers.delete(t)),uo.delete(t),lo.delete(t)}(e,r)}},s.duration);s.timers.set(r,t)}return}}i&&(clearTimeout(i),s.timers.delete(r));const o=null==(a=s.elementConfigs)?void 0:a.get(r);(null==o?void 0:o.multiple)&&(o.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function ho(e,t,n={multiple:!1}){var a;const r=e.settings.scope||document,s=po.get(r);(null==s?void 0:s.observer)&&t&&(s.elementConfigs||(s.elementConfigs=new WeakMap),s.elementConfigs.set(t,{multiple:null!=(a=n.multiple)&&a,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),s.observer.observe(t))}function go(e){if(!e)return;const t=po.get(e);t&&(t.observer&&t.observer.disconnect(),po.delete(e))}function yo(e,t,n,a,r,s,i){const{elb:o,settings:c}=e;if(Vi(t)&&t.startsWith("walker "))return o(t,n);if(Ui(t)){const e=t;return e.source||(e.source=vo()),e.globals||(e.globals=Yi(c.prefix,c.scope||document)),o(e)}const[u]=String(Ui(t)?t.name:t).split(" ");let d,l=Ui(n)?n:{},p={},m=!1;if(Di(n)&&(d=n,m=!0),Di(r)?d=r:Ui(r)&&Object.keys(r).length&&(p=r),d){const e=eo(c.prefix||"data-elb",d).find(e=>e.entity===u);e&&(m&&(l=e.data),p=e.context)}"page"===u&&(l.id=l.id||window.location.pathname);const f=Yi(c.prefix,c.scope);return o({name:String(t||""),data:l,context:p,globals:f,nested:s,custom:i,trigger:Vi(a)?a:"",source:vo()})}function vo(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var _o=[],bo="hover",ko="load",xo="pulse",wo="scroll",Zo="wait";function Ao(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",Bi(function(t){Po.call(this,e,t)})),n.addEventListener("submit",Bi(function(t){jo.call(this,e,t)})))}(e,t)}function So(e,t){t.scope&&function(e,t){const n=t.scope;_o=[];const a=n||document;go(a),function(e,t=1e3){po.has(e)||po.set(e,{observer:fo(e),timers:new WeakMap,duration:t})}(a,1e3);const r=Wi(t.prefix,Wn.Action,!1);a!==document&&To(e,a,r,t),a.querySelectorAll(`[${r}]`).forEach(n=>{To(e,n,r,t)}),_o.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const a=window.scrollY+window.innerHeight,r=e.offsetTop;if(a<r)return!0;const s=e.clientHeight;return!(100*(1-(r+s-a)/(s||1))>=n&&(Oo(t,e,wo),1))});co||(co=function(e,t=1e3){let n=null;return function(...a){if(null===n)return n=setTimeout(()=>{n=null},t),e(...a)}}(function(){_o=n.call(t,_o,e)}),t.addEventListener("scroll",co))}(e,a)}(e,t)}async function Oo(e,t,n){const a=Hi(t,n,e.settings.prefix);return Promise.all(a.map(t=>yo(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function To(e,t,n,a){const r=ra(t,n);r&&Object.values(Qi(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case bo:a=e,t.addEventListener("mouseenter",Bi(function(e){e.target instanceof Element&&Oo(a,e.target,bo)}));break;case ko:!function(e,t){Oo(e,t,ko)}(e,t);break;case xo:!function(e,t,n=""){setInterval(()=>{document.hidden||Oo(e,t,xo)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case wo:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||_o.push([e,n])}(t,n.triggerParams);break;case"impression":ho(e,t);break;case"visible":ho(e,t,{multiple:!0});break;case Zo:!function(e,t,n=""){setTimeout(()=>Oo(e,t,Zo),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var a}))}function Po(e,t){Oo(e,t.target,"click")}function jo(e,t){t.target&&Oo(e,t.target,"submit")}function No(e,t,n,a){const r=[];let s=!0;n.forEach(e=>{const t=Eo(e)?[...Array.from(e)]:null!=(n=e)&&"object"==typeof n&&"length"in n&&"number"==typeof n.length?Array.from(e):[e];var n;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&1===t.length&&!t[0])return;const i=t[0],o=!Ui(i)&&Vi(i)&&i.startsWith("walker ");if(Ui(i)){if("object"==typeof i&&0===Object.keys(i).length)return}else{const e=Array.from(t);if(!Vi(e[0])||""===e[0].trim())return;const n="walker run";s&&e[0]===n&&(s=!1)}(a&&o||!a&&!o)&&r.push(t)}),r.forEach(n=>{Co(e,t,n)})}function Co(e,t="data-elb",n){Bi(()=>{if(Array.isArray(n)){const[a,...r]=n;if(!a||Vi(a)&&""===a.trim())return;if(Vi(a)&&a.startsWith("walker "))return void e(a,r[0]);yo({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},a,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Eo(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function $o(e,t={}){return function(e={}){const{cb:t,consent:n,collector:a,storage:r}=e;if(!n)return oa((r?fa:ha)(e),a,t);{const r=function(e,t){let n;return(a,r)=>{if(Nn(n)&&n===(null==a?void 0:a.group))return;n=null==a?void 0:a.group;let s=()=>ha(e);return e.consent&&Mn((jn(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(s=()=>fa(e)),oa(s(),a,t)}}(e,t),s=(jn(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});a?a.command("on","consent",s):sa("walker on","consent",s)}}({...t,collector:{push:e,group:void 0}})}ya({},{env:()=>Io});var Io={};ya(Io,{push:()=>Lo});var Ro=()=>{},Mo=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Lo={get push(){return Mo()},get command(){return Mo()},get elb(){return Mo()},get window(){return{addEventListener:Ro,removeEventListener:Ro,location:{href:"https://example.com/page",pathname:"/page",search:"?query=test",hash:"#section",host:"example.com",hostname:"example.com",origin:"https://example.com",protocol:"https:"},document:{},navigator:{language:"en-US",userAgent:"Mozilla/5.0 (Test)"},screen:{width:1920,height:1080},innerWidth:1920,innerHeight:1080,pageXOffset:0,pageYOffset:0,scrollX:0,scrollY:0}},get document(){return{addEventListener:Ro,removeEventListener:Ro,querySelector:Ro,querySelectorAll:()=>[],getElementById:Ro,getElementsByClassName:()=>[],getElementsByTagName:()=>[],createElement:()=>({setAttribute:Ro,getAttribute:Ro,addEventListener:Ro,removeEventListener:Ro}),body:{appendChild:Ro,removeChild:Ro},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""}}},Fo=async(e,t)=>{const{elb:n,window:a,document:r}=t,s=(null==e?void 0:e.settings)||{},i=a||(void 0!==globalThis.window?globalThis.window:void 0),o=r||(void 0!==globalThis.document?globalThis.document:void 0),c=function(e={},t){return{prefix:"data-elb",pageview:!0,session:!0,elb:"elb",elbLayer:"elbLayer",scope:t||void 0,...e}}(s,o),u={settings:c},d={elb:n,settings:c};if(i&&o){if(!1!==c.elbLayer&&n&&function(e,t={}){const n=t.name||"elbLayer",a=t.window||window;if(!a)return;const r=a;r[n]||(r[n]=[]);const s=r[n];s.push=function(...n){if(Eo(n[0])){const a=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[a]);return Co(e,t.prefix,a),r}const a=Array.prototype.push.apply(this,n);return n.forEach(n=>{Co(e,t.prefix,n)}),a},Array.isArray(s)&&s.length>0&&function(e,t="data-elb",n){No(e,t,n,!0),No(e,t,n,!1),n.length=0}(e,t.prefix,s)}(n,{name:Vi(c.elbLayer)?c.elbLayer:"elbLayer",prefix:c.prefix,window:i}),c.session&&n){const e="boolean"==typeof c.session?{}:c.session;$o(n,e)}await async function(e,t,n){const a=()=>{e(t,n)};"loading"!==document.readyState?a():document.addEventListener("DOMContentLoaded",a)}(Ao,d,c),(()=>{if(So(d,c),c.pageview){const[e,t]=Gi(c.prefix||"data-elb",c.scope);yo(d,"page view",e,"load",t)}})(),Vi(c.elb)&&c.elb&&(i[c.elb]=(...e)=>{const[t,n,a,r,s,i]=e;return yo(d,t,n,a,r,s,i)})}return{type:"browser",config:u,push:(...e)=>{const[t,n,a,r,s,i]=e;return yo(d,t,n,a,r,s,i)},destroy:async()=>{o&&go(c.scope||o)},on:async(e,t)=>{switch(e){case"consent":if(c.session&&t&&n){const e="boolean"==typeof c.session?{}:c.session;$o(n,e)}break;case"session":case"ready":default:break;case"run":if(o&&i&&(So(d,c),c.pageview)){const[e,t]=Gi(c.prefix||"data-elb",c.scope);yo(d,"page view",e,"load",t)}}}}},zo=Object.defineProperty,Do=(e,t)=>{for(var n in t)zo(e,n,{get:t[n],enumerable:!0})},Uo=!1;function Vo(e,t={},n){if(t.filter&&!0===Dn(()=>t.filter(n),()=>!1)())return;const a=function(e){if(Cn(e)&&En(e.event)){const{event:t,...n}=e;return{name:t,...n}}return jn(e)&&e.length>=2?qo(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?qo(Array.from(e)):null;var t}(n);if(!a)return;const r=`${t.prefix||"dataLayer"} ${a.name}`,{name:s,...i}=a,o={name:r,data:i};Dn(()=>e(o),()=>{})()}function qo(e){const[t,n,a]=e;if(!En(t))return null;let r,s={};switch(t){case"consent":if(!En(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!Cn(a)||null===a)return null;r=`${t} ${n}`,s={...a};break;case"event":if(!En(n))return null;r=n,Cn(a)&&(s={...a});break;case"config":if(!En(n))return null;r=`${t} ${n}`,Cn(a)&&(s={...a});break;case"set":if(En(n))r=`${t} ${n}`,Cn(a)&&(s={...a});else{if(!Cn(n))return null;r=`${t} custom`,s={...n}}break;default:return null}return{name:r,...s}}Do({},{push:()=>Wo});var Bo=()=>{},Ko=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Wo={get push(){return Ko()},get command(){return Ko()},get elb(){return Ko()},get window(){return{dataLayer:[],addEventListener:Bo,removeEventListener:Bo}}};function Xo(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function Jo(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function Ho(){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 Yo(){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 Go(){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 Qo(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function ec(){return["set",{currency:"EUR",country:"DE"}]}function tc(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}Do({},{add_to_cart:()=>Yo,config:()=>Qo,consentDefault:()=>Jo,consentUpdate:()=>Xo,directDataLayerEvent:()=>tc,purchase:()=>Ho,setCustom:()=>ec,view_item:()=>Go});Do({},{add_to_cart:()=>rc,config:()=>cc,configGA4:()=>ic,consentOnlyMapping:()=>uc,consentUpdate:()=>nc,customEvent:()=>oc,purchase:()=>ac,view_item:()=>sc});var nc={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}}}}},ac={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"}}}}]}}}},rc={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"}}},sc={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"}}},ic={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},oc={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},cc={consent:{update:nc},purchase:ac,add_to_cart:rc,view_item:sc,"config G-XXXXXXXXXX":ic,custom_event:oc,"*":{data:{}}},uc={consent:{update:nc}},dc=async(e,t)=>{const{elb:n,window:a}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},s={settings:r};return a&&(function(e,t){const n=t.settings,a=(null==n?void 0:n.name)||"dataLayer",r=window[a];if(Array.isArray(r)&&!Uo){Uo=!0;try{for(const t of r)Vo(e,n,t)}finally{Uo=!1}}}(n,s),function(e,t){const n=t.settings,a=(null==n?void 0:n.name)||"dataLayer";window[a]||(window[a]=[]);const r=window[a];if(!Array.isArray(r))return;const s=r.push.bind(r);r.push=function(...t){if(Uo)return s(...t);Uo=!0;try{for(const a of t)Vo(e,n,a)}finally{Uo=!1}return s(...t)}}(n,s)),{type:"dataLayer",config:s,push:n,destroy:async()=>{const e=r.name||"dataLayer";a&&a[e]&&Array.isArray(a[e])}}};function lc(){window.dataLayer=window.dataLayer||[];const e=e=>{Cn(e)&&Cn(e.source)&&String(e.source.type).includes("dataLayer")||window.dataLayer.push(e)};return{type:"dataLayer",config:{},push:(t,n)=>{e(n.data||t)},pushBatch:t=>{e({name:"batch",batched_event:t.key,events:t.data.length?t.data:t.events})}}}var pc={};async function mc(e={}){const t=Pn({collector:{destinations:{dataLayer:{code:lc()}}},browser:{run:!0,session:!0},dataLayer:!1,elb:"elb"},e),n={...t.collector,sources:{browser:{code:Fo,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=Cn(t.dataLayer)?t.dataLayer:{};n.sources&&(n.sources.dataLayer={code:dc,config:{settings:e}})}const a=await aa(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=a.elb),t.name&&(window[t.name]=a.collector)),a}var fc=mc;export{pc as Walkerjs,mc as createWalkerjs,fc as default,Ji as getAllEvents,Hi as getEvents,Yi as getGlobals};//# sourceMappingURL=index.mjs.map