@walkeros/walker.js 0.2.0 → 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/walker.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{var e={Storage:{Local:"local",Session:"session",Cookie:"cookie"}},t={merge:!0,shallow:!0,extend:!0};function n(e,n={},o={}){o={...t,...o};const r=Object.entries(n).reduce((t,[n,r])=>{const i=e[n];return o.merge&&Array.isArray(i)&&Array.isArray(r)?t[n]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(o.extend||n in e)&&(t[n]=r),t},{});return o.shallow?{...e,...r}:(Object.assign(e,r),e)}function o(e){return Array.isArray(e)}function r(e){return void 0!==e}function i(e){return"object"==typeof e&&null!==e&&!o(e)&&"[object Object]"===Object.prototype.toString.call(e)}function s(e){return"string"==typeof e}function a(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 o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=a(e[o],t));return n}if("[object Array]"===n){const n=[];return t.set(e,n),e.forEach(e=>{n.push(a(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 c(e,t="",n){const i=t.split(".");let s=e;for(let e=0;e<i.length;e++){const t=i[e];if("*"===t&&o(s)){const t=i.slice(e+1).join("."),o=[];for(const e of s){const r=c(e,t,n);o.push(r)}return o}if(s=s instanceof Object?s[t]:void 0,!s)break}return r(s)?s:n}function u(e,t={},n={}){const o={...t,...n},r={};let i=void 0===e;return Object.keys(o).forEach(t=>{o[t]&&(r[t]=!0,e&&e[t]&&(i=!0))}),!!i&&r}function l(e=6){let t="";for(let n=36;t.length<e;)t+=(Math.random()*n|0).toString(n);return t}function f(e){return function(e){return"boolean"==typeof e}(e)||s(e)||function(e){return"number"==typeof e&&!Number.isNaN(e)}(e)||!r(e)||o(e)&&e.every(f)||i(e)&&Object.values(e).every(f)}function d(e){return f(e)?e:void 0}function g(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function m(e,t,n){return async function(...o){try{return await e(...o)}catch(e){if(!t)return;return await t(e)}finally{await(null==n?void 0:n())}}}async function p(e,t={},n={}){var s;if(!r(e))return;const a=i(e)&&e.consent||n.consent||(null==(s=n.collector)?void 0:s.consent),c=o(t)?t:[t];for(const t of c){const o=await m(y)(e,t,{...n,consent:a});if(r(o))return o}}async function y(e,t,n={}){const{collector:i,consent:a}=n;return(o(t)?t:[t]).reduce(async(t,l)=>{const f=await t;if(f)return f;const g=s(l)?{key:l}:l;if(!Object.keys(g).length)return;const{condition:h,consent:b,fn:w,key:v,loop:k,map:j,set:S,validate:E,value:_}=g;if(h&&!await m(h)(e,l,i))return;if(b&&!u(b,a))return _;let L=r(_)?_:e;if(w&&(L=await m(w)(e,l,n)),v&&(L=c(e,v,_)),k){const[t,i]=k,s="this"===t?[e]:await p(e,t,n);o(s)&&(L=(await Promise.all(s.map(e=>p(e,i,n)))).filter(r))}else j?L=await Object.entries(j).reduce(async(t,[o,i])=>{const s=await t,a=await p(e,i,n);return r(a)&&(s[o]=a),s},Promise.resolve({})):S&&(L=await Promise.all(S.map(t=>y(e,t,n))));E&&!await m(E)(L)&&(L=void 0);const O=d(L);return r(O)?O:d(_)},Promise.resolve(void 0))}function h(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function b(e,t,n){return function(...o){let r;const i="post"+t,s=n["pre"+t],a=n[i];return r=s?s({fn:e},...o):e(...o),a&&(r=a({fn:e,result:r},...o)),r}}function w(e,t){return(e.getAttribute(t)||"").trim()}function v(e){const t={};return function(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}(e).forEach(e=>{const[n,o]=function(e){const[t,n]=e.split(/:(.+)/,2);return[h(t||""),h(n||"")]}(e);n&&("true"===o?t[n]=!0:"false"===o?t[n]=!1:o&&/^\d+$/.test(o)?t[n]=parseInt(o,10):o&&/^\d+\.\d+$/.test(o)?t[n]=parseFloat(o):t[n]=o||!0)}),t}var k=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function j(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 o=window.innerHeight,r=e.getBoundingClientRect(),i=r.height,s=r.y,a=s+i,c={x:r.x+e.offsetWidth/2,y:r.y+e.offsetHeight/2};if(i<=o){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=o/2;if(s<0&&a<e)return!1;if(a>o&&s>e)return!1;n=document.elementFromPoint(c.x,o/2)}if(n)do{if(n===e)return!0}while(n=n.parentElement);return!1}function S(e,t,n){return!1===n?e:(n||(n=E),n(e,t,E))}var E=(e,t)=>{const n=(null==t?void 0:t.push)||k,o={};return e.id&&(o.session=e.id),e.storage&&e.device&&(o.device=e.device),n("walker user",o),e.isStart&&n({name:"session start",data:e}),e};function _(t,n=e.Storage.Session){var o;function r(e){try{return JSON.parse(e||"")}catch(t){let n=1,o="";return e&&(n=0,o=e),{e:n,v:o}}}let i,s;switch(n){case e.Storage.Cookie:i=decodeURIComponent((null==(o=document.cookie.split("; ").find(e=>e.startsWith(t+"=")))?void 0:o.split("=")[1])||"");break;case e.Storage.Local:s=r(window.localStorage.getItem(t));break;case e.Storage.Session:s=r(window.sessionStorage.getItem(t))}return s&&(i=s.v,0!=s.e&&s.e<Date.now()&&(function(t,n=e.Storage.Session){switch(n){case e.Storage.Cookie:L(t,"",0,n);break;case e.Storage.Local:window.localStorage.removeItem(t);break;case e.Storage.Session:window.sessionStorage.removeItem(t)}}(t,n),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 L(t,n,o=30,r=e.Storage.Session,i){const s={e:Date.now()+6e4*o,v:String(n)},a=JSON.stringify(s);switch(r){case e.Storage.Cookie:{n="object"==typeof n?JSON.stringify(n):n;let e=`${t}=${encodeURIComponent(n)}; max-age=${60*o}; path=/; SameSite=Lax; secure`;i&&(e+="; domain="+i),document.cookie=e;break}case e.Storage.Local:window.localStorage.setItem(t,a);break;case e.Storage.Session:window.sessionStorage.setItem(t,a)}return _(t,r)}function O(e={}){const t=Date.now(),{length:n=30,deviceKey:o="elbDeviceId",deviceStorage:r="local",deviceAge:i=30,sessionKey:s="elbSessionId",sessionStorage:a="local",pulse:c=!1}=e,u=x(e);let f=!1;const d=g((e,t,n)=>{let o=_(e,n);return o||(o=l(8),L(e,o,1440*t,n)),String(o)})(o,i,r),m=g((e,o)=>{const r=JSON.parse(String(_(e,o)));return c||(r.isNew=!1,u.marketing&&(Object.assign(r,u),f=!0),f||r.updated+6e4*n<t?(delete r.id,delete r.referrer,r.start=t,r.count++,r.runs=1,f=!0):r.runs++),r},()=>{f=!0})(s,a)||{},p={id:l(12),start:t,isNew:!0,count:1,runs:1},y=Object.assign(p,u,m,{device:d},{isStart:f,storage:!0,updated:t},e.data);return L(s,JSON.stringify(y),2*n,a),y}function x(e={}){let t=e.isStart||!1;const o={isStart:t,storage:!1};if(!1===e.isStart)return o;if(!t){const[e]=performance.getEntriesByType("navigation");if("navigate"!==e.type)return o}const r=new URL(e.url||window.location.href),i=e.referrer||document.referrer,s=i&&new URL(i).hostname,a=function(e,t={}){const o="clickId",r={},i={utm_campaign:"campaign",utm_content:"content",utm_medium:"medium",utm_source:"source",utm_term:"term",dclid:o,fbclid:o,gclid:o,msclkid:o,ttclid:o,twclid:o,igshid:o,sclid:o};return Object.entries(n(i,t)).forEach(([t,n])=>{const i=e.searchParams.get(t);i&&(n===o&&(n=t,r[o]=t),r[n]=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(s)}return t?Object.assign({isStart:t,storage:!1,start:Date.now(),id:l(12),referrer:s},a,e.data):o}var A={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"},$=A;function C(e,t,n,o){let r,i=n||[];switch(n||(i=e.on[t]||[]),t){case $.Consent:r=o||e.consent;break;case $.Session:r=e.session;break;case $.Ready:case $.Run:default:r=void 0}if(Object.values(e.sources).forEach(e=>{e.on&&g(e.on)(t,r)}),Object.values(e.destinations).forEach(e=>{if(e.on){g(e.on)(t,r)}}),i.length)switch(t){case $.Consent:!function(e,t,n){const o=n||e.consent;t.forEach(t=>{Object.keys(o).filter(e=>e in t).forEach(n=>{g(t[n])(e,o)})})}(e,i,o);break;case $.Ready:case $.Run:a=i,(s=e).allowed&&a.forEach(e=>{g(e)(s)});break;case $.Session:!function(e,t){e.session&&t.forEach(t=>{g(t)(e,e.session)})}(e,i)}var s,a}async function q(e,t,r,a){let c;switch(t){case $.Config:i(r)&&n(e.config,r,{shallow:!1});break;case $.Consent:i(r)&&(c=await async function(e,t){const{consent:o}=e;let r=!1;const i={};return Object.entries(t).forEach(([e,t])=>{const n=!!t;i[e]=n,r=r||n}),e.consent=n(o,i),C(e,"consent",void 0,i),r?R(e):X({ok:!0})}(e,r));break;case $.Custom:i(r)&&(e.custom=n(e.custom,r));break;case $.Destination:i(r)&&"function"==typeof r.push&&(c=await async function(e,t,n){const{code:o,config:r={},env:i={}}=t,s=n||r||{init:!1},a={...o,config:s,env:N(o.env,i)};let c=a.config.id;if(!c)do{c=l(4)}while(e.destinations[c]);return e.destinations[c]=a,!1!==a.config.queue&&(a.queue=[...e.queue]),R(e,void 0,{[c]:a})}(e,{code:r},a));break;case $.Globals:i(r)&&(e.globals=n(e.globals,r));break;case $.On:s(r)&&function(e,t,n){const r=e.on,i=r[t]||[],s=o(n)?n:[n];s.forEach(e=>{i.push(e)}),r[t]=i,C(e,t,s)}(e,r,a);break;case $.Ready:C(e,"ready");break;case $.Run:c=await async function(e,t){e.allowed=!0,e.count=0,e.group=l(),e.timing=Date.now(),t&&(t.consent&&(e.consent=n(e.consent,t.consent)),t.user&&(e.user=n(e.user,t.user)),t.globals&&(e.globals=n(e.config.globalsStatic||{},t.globals)),t.custom&&(e.custom=n(e.custom,t.custom))),Object.values(e.destinations).forEach(e=>{e.queue=[]}),e.queue=[],e.round++;const o=await R(e);return C(e,"run"),o}(e,r);break;case $.Session:C(e,"session");break;case $.User:i(r)&&n(e.user,r,{shallow:!1})}return c||{ok:!0,successful:[],queued:[],failed:[]}}function P(e,t,n){return b(async(o,r,i)=>await m(async()=>{if("string"==typeof o&&o.startsWith("walker ")){const n=o.replace("walker ","");return await t(e,n,r,i)}{const s=n("string"==typeof o?{name:o}:o),{event:a,command:c}=function(e,t,n={}){const o=function(e){return typeof e==typeof""}(t)?{name:t,...n}:{...n,...t||{}};if(!o.name)throw new Error("Event name is required");const[r,i]=o.name.split(" ");if(!r||!i)throw new Error("Event name is invalid");if(r===A.Walker)return{command:i};++e.count;const{timestamp:s=Date.now(),group:a=e.group,count:c=e.count}=o,{name:u=`${r} ${i}`,data:l={},context:f={},globals:d=e.globals,custom:g={},user:m=e.user,nested:p=[],consent:y=e.consent,id:h=`${s}-${a}-${c}`,trigger:b="",entity:w=r,action:v=i,timing:k=0,version:j={source:e.version,tagging:e.config.tagging||0},source:S={type:"collector",id:"",previous_id:""}}=o;return{event:{name:u,data:l,context:f,globals:d,custom:g,user:m,nested:p,consent:y,id:h,trigger:b,entity:w,action:v,timestamp:s,timing:k,group:a,count:c,version:j,source:S}}}(e,s.name,s);return c?await t(e,c,r,i):await R(e,a)}},()=>X({ok:!1}))(),"Push",e.hooks)}async function R(e,t,o){const{allowed:r,consent:i,globals:s,user:c}=e;if(!r)return X({ok:!1});t&&e.queue.push(t),o||(o=e.destinations);const l=await Promise.all(Object.entries(o||{}).map(async([o,r])=>{let l=(r.queue||[]).map(e=>({...e,consent:i}));if(r.queue=[],t){let n=a(t);await Promise.all(Object.entries(r.config.policy||[]).map(async([o,r])=>{const i=await p(t,r,{collector:e});n=function(e,t,n){const o=a(e),r=t.split(".");let i=o;for(let e=0;e<r.length;e++){const t=r[e];e===r.length-1?i[t]=n:(t in i&&"object"==typeof i[t]&&null!==i[t]||(i[t]={}),i=i[t])}return o}(n,o,i)})),l.push(n)}if(!l.length)return{id:o,destination:r,skipped:!0};const f=[],d=l.filter(e=>{const t=u(r.config.consent,i,e.consent);return!t||(e.consent=t,f.push(e),!1)});if(r.queue.concat(d),!f.length)return{id:o,destination:r,queue:l};if(!await m(D)(e,r))return{id:o,destination:r,queue:l};let g=!1;return r.dlq||(r.dlq=[]),await Promise.all(f.map(async t=>(t.globals=n(s,t.globals),t.user=n(c,t.user),await m(I,n=>(e.config.onError&&e.config.onError(n,e),g=!0,r.dlq.push([t,n]),!1))(e,r,t),t))),{id:o,destination:r,error:g}})),f=[],d=[],g=[];for(const e of l){if(e.skipped)continue;const t=e.destination,n={id:e.id,destination:t};e.error?g.push(n):e.queue&&e.queue.length?(t.queue=(t.queue||[]).concat(e.queue),d.push(n)):f.push(n)}return X({ok:!g.length,event:t,successful:f,queued:d,failed:g})}async function D(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:N(t.env,t.config.env)},o=await b(t.init,"DestinationInit",e.hooks)(n);if(!1===o)return o;t.config={...o||t.config,init:!0}}return!0}async function I(e,t,s){var a;const{config:c}=t,{eventMapping:u,mappingKey:l}=await async function(e,t){var n;const[r,i]=(e.name||"").split(" ");if(!t||!r||!i)return{};let s,a="",c=r,u=i;const l=t=>{if(t)return(t=o(t)?t:[t]).find(t=>!t.condition||t.condition(e))};t[c]||(c="*");const f=t[c];return f&&(f[u]||(u="*"),s=l(f[u])),s||(c="*",u="*",s=l(null==(n=t[c])?void 0:n[u])),s&&(a=`${c} ${u}`),{eventMapping:s,mappingKey:a}}(s,c.mapping);let f=c.data&&await p(s,c.data,{collector:e});if(u){if(u.ignore)return!1;if(u.name&&(s.name=u.name),u.data){const t=u.data&&await p(s,u.data,{collector:e});f=i(f)&&i(t)?n(f,t):t}}const d={collector:e,config:c,data:f,mapping:u,env:N(t.env,c.env)};if((null==u?void 0:u.batch)&&t.pushBatch){const n=u.batched||{key:l||"",events:[],data:[]};n.events.push(s),r(f)&&n.data.push(f),u.batchFn=u.batchFn||function(e,t=1e3,n=!1){let o,r=null,i=!1;return(...s)=>new Promise(a=>{const c=n&&!i;r&&clearTimeout(r),r=setTimeout(()=>{r=null,n&&!i||(o=e(...s),a(o))},t),c&&(i=!0,o=e(...s),a(o))})}((e,t)=>{const o={collector:t,config:c,data:f,mapping:u,env:N(e.env,c.env)};b(e.pushBatch,"DestinationPushBatch",t.hooks)(n,o),n.events=[],n.data=[]},u.batch),u.batched=n,null==(a=u.batchFn)||a.call(u,t,e)}else await b(t.push,"DestinationPush",e.hooks)(s,d);return!0}function X(e){var t;return n({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function N(e,t){return e||t?t?e&&i(e)&&i(t)?{...e,...t}:t:e:{}}async function W(e){e=e||{};const t=await async function(e){const t=n({globalsStatic:{},sessionStatic:{},tagging:0,verbose:!1,onLog:o,run:!0},e,{merge:!1,extend:!1});function o(e,n){!function(e,t=!1){t&&console.dir(e,{depth:4})}({message:e},n||t.verbose)}t.onLog=o;const r={...t.globalsStatic,...e.globals},i={allowed:!1,config:t,consent:e.consent||{},count:0,custom:e.custom||{},destinations:{},globals:r,group:"",hooks:{},on:{},queue:[],round:0,session:void 0,timing:Date.now(),user:e.user||{},version:"0.2.0",sources:{},push:void 0};return i.push=P(i,q,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[o,r]of Object.entries(t)){const{code:t,config:i={},env:s={},primary:a}=r,c={elb:(...t)=>e.push(...t),...s},u=await m(t)(i,c);u&&(a&&(u.config={...u.config,primary:a}),n[o]=u)}return n}(i,e.sources||{}),i.destinations=await async function(e,t={}){const n={};for(const[e,o]of Object.entries(t)){const{code:t,config:r={},env:i={}}=o,s={...t.config,...r},a=N(t.env,i);n[e]={...t,config:s,env:a}}return n}(0,e.destinations||{}),i}(e),{consent:o,user:r,globals:i,custom:s}=e;o&&await t.push("walker consent",o),r&&await t.push("walker user",r),i&&Object.assign(t.globals,i),s&&Object.assign(t.custom,s),t.config.run&&await t.push("walker run");let a=t.push;const c=Object.values(t.sources),u=c.find(e=>e.config.primary);return u?a=u.push:c.length>0&&(a=c[0].push),{collector:t,elb:a}}var T=Object.defineProperty,M=(e,t)=>{for(var n in t)T(e,n,{get:t[n],enumerable:!0})},U={merge:!0,shallow:!0,extend:!0};function H(e,t={},n={}){n={...U,...n};const o=Object.entries(t).reduce((t,[o,r])=>{const i=e[o];return n.merge&&Array.isArray(i)&&Array.isArray(r)?t[o]=r.reduce((e,t)=>e.includes(t)?e:[...e,t],[...i]):(n.extend||o in e)&&(t[o]=r),t},{});return n.shallow?{...e,...o}:(Object.assign(e,o),e)}function B(e){return Array.isArray(e)}function G(e){return e===document||e instanceof Element}function K(e){return"object"==typeof e&&null!==e&&!B(e)&&"[object Object]"===Object.prototype.toString.call(e)}function F(e){return"string"==typeof e}function J(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function z(e,t,n){return function(...o){try{return e(...o)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Y(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function V(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function Q(e,t,n,o=!0){return ae(w(t,V(e,n,o))||"").reduce((e,n)=>{let[o,r]=ce(n);if(!o)return e;if(r||(o.endsWith(":")&&(o=o.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 o.endsWith("[]")?(o=o.slice(0,-2),B(e[o])||(e[o]=[]),e[o].push(J(r))):e[o]=J(r),e},{})}function Z(e=$.Prefix,t=document){const n=V(e,$.Globals,!1);let o={};return se(t,`[${n}]`,t=>{o=H(o,Q(e,t,$.Globals,!1))}),o}function ee(e,t){const n=window.location,o="page",r=t===document?document.body:t,[i,s]=ie(r,`[${V(e,o)}]`,e,o);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 te(e){const t={};return ae(e).forEach(e=>{const[n,o]=ce(e),[r,i]=ue(n);if(!r)return;let[s,a]=ue(o||"");s=s||r,t[r]||(t[r]=[]),t[r].push({trigger:r,triggerParams:i,action:s,actionParams:a})}),t}function ne(e,t,n,o=!1){const r=[];let i=t;for(n=0!==Object.keys(n||{}).length?n:void 0;i;){const s=oe(e,i,t,n);if(s&&(r.push(s),o))break;i=re(e,i)}return r}function oe(e,t,n,o){const r=w(t,V(e));if(!r||o&&!o[r])return null;const i=[t],s=`[${V(e,r)}],[${V(e,"")}]`,a=V(e,$.Link,!1);let c={};const u=[],[l,f]=ie(n||t,s,e,r);se(t,`[${a}]`,t=>{const[n,o]=ce(w(t,a));"parent"===o&&se(document.body,`[${a}="${n}:child"]`,t=>{i.push(t);const n=oe(e,t);n&&u.push(n)})});const d=[];i.forEach(e=>{e.matches(s)&&d.push(e),se(e,s,e=>d.push(e))});let g={};return d.forEach(t=>{g=H(g,Q(e,t,"")),c=H(c,Q(e,t,r))}),c=H(H(g,c),l),i.forEach(t=>{se(t,`[${V(e)}]`,t=>{const n=oe(e,t);n&&u.push(n)})}),{entity:r,data:c,context:f,nested:u}}function re(e,t){const n=V(e,$.Link,!1);if(t.matches(`[${n}]`)){const[e,o]=ce(w(t,n));if("child"===o)return document.querySelector(`[${n}="${e}:parent"]`)}return!t.parentElement&&t.getRootNode&&t.getRootNode()instanceof ShadowRoot?t.getRootNode().host:t.parentElement}function ie(e,t,n,o){let r={};const i={};let s=e;const a=`[${V(n,$.Context,!1)}]`;let c=0;for(;s;)s.matches(t)&&(r=H(Q(n,s,""),r),r=H(Q(n,s,o),r)),s.matches(a)&&(Object.entries(Q(n,s,$.Context,!1)).forEach(([e,t])=>{t&&!i[e]&&(i[e]=[t,c])}),++c),s=re(n,s);return[r,i]}function se(e,t,n){e.querySelectorAll(t).forEach(n)}function ae(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}function ce(e){const[t,n]=e.split(/:(.+)/,2);return[Y(t),Y(n)]}function ue(e){const[t,n]=e.split("(",2);return[t,n?n.slice(0,-1):""]}var le,fe=new WeakMap,de=new WeakMap,ge=new WeakMap;function me(e){const t=Date.now();let n=de.get(e);return(!n||t-n.lastChecked>500)&&(n={isVisible:j(e),lastChecked:t},de.set(e,n)),n.isVisible}function pe(e){if(window.IntersectionObserver)return z(()=>new window.IntersectionObserver(t=>{t.forEach(t=>{!function(e,t){var n,o;const r=t.target,i=ge.get(e);if(!i)return;const s=i.timers.get(r);if(t.intersectionRatio>0){const o=Date.now();let a=fe.get(r);if((!a||o-a.lastChecked>1e3)&&(a={isLarge:r.offsetHeight>window.innerHeight,lastChecked:o},fe.set(r,a)),t.intersectionRatio>=.5||a.isLarge&&me(r)){const t=null==(n=i.elementConfigs)?void 0:n.get(r);if((null==t?void 0:t.multiple)&&t.blocked)return;if(!s){const t=window.setTimeout(async()=>{var t,n;if(me(r)){const o=null==(t=i.elementConfigs)?void 0:t.get(r);(null==o?void 0:o.context)&&await xe(o.context,r,o.trigger);const s=null==(n=i.elementConfigs)?void 0:n.get(r);(null==s?void 0:s.multiple)?s.blocked=!0:function(e,t){const n=ge.get(e);if(!n)return;n.observer&&n.observer.unobserve(t);const o=n.timers.get(t);o&&(clearTimeout(o),n.timers.delete(t)),fe.delete(t),de.delete(t)}(e,r)}},i.duration);i.timers.set(r,t)}return}}s&&(clearTimeout(s),i.timers.delete(r));const a=null==(o=i.elementConfigs)?void 0:o.get(r);(null==a?void 0:a.multiple)&&(a.blocked=!1)}(e,t)})},{rootMargin:"0px",threshold:[0,.5]}),()=>{})()}function ye(e,t,n={multiple:!1}){var o;const r=e.settings.scope||document,i=ge.get(r);(null==i?void 0:i.observer)&&t&&(i.elementConfigs||(i.elementConfigs=new WeakMap),i.elementConfigs.set(t,{multiple:null!=(o=n.multiple)&&o,blocked:!1,context:e,trigger:n.multiple?"visible":"impression"}),i.observer.observe(t))}function he(e){if(!e)return;const t=ge.get(e);t&&(t.observer&&t.observer.disconnect(),ge.delete(e))}function be(e,t,n,o,r,i,s){const{elb:a,settings:c}=e;if(F(t)&&t.startsWith("walker "))return a(t,n);if(K(t)){const e=t;return e.source||(e.source=we()),e.globals||(e.globals=Z(c.prefix,c.scope||document)),a(e)}const[u]=String(K(t)?t.name:t).split(" ");let l,f=K(n)?n:{},d={},g=!1;if(G(n)&&(l=n,g=!0),G(r)?l=r:K(r)&&Object.keys(r).length&&(d=r),l){const e=ne(c.prefix||"data-elb",l).find(e=>e.entity===u);e&&(g&&(f=e.data),d=e.context)}"page"===u&&(f.id=f.id||window.location.pathname);const m=Z(c.prefix,c.scope);return a({name:String(t||""),data:f,context:d,globals:m,nested:i,custom:s,trigger:F(o)?o:"",source:we()})}function we(){return{type:"browser",id:window.location.href,previous_id:document.referrer}}var ve=[],ke="hover",je="load",Se="pulse",Ee="scroll",_e="wait";function Le(e,t){t.scope&&function(e,t){const n=t.scope;n&&(n.addEventListener("click",z(function(t){$e.call(this,e,t)})),n.addEventListener("submit",z(function(t){Ce.call(this,e,t)})))}(e,t)}function Oe(e,t){t.scope&&function(e,t){const n=t.scope;ve=[];const o=n||document;he(o),function(e,t=1e3){ge.has(e)||ge.set(e,{observer:pe(e),timers:new WeakMap,duration:t})}(o,1e3);const r=V(t.prefix,$.Action,!1);o!==document&&Ae(e,o,r,t),o.querySelectorAll(`[${r}]`).forEach(n=>{Ae(e,n,r,t)}),ve.length&&function(e,t){const n=(e,t)=>e.filter(([e,n])=>{const o=window.scrollY+window.innerHeight,r=e.offsetTop;if(o<r)return!0;const i=e.clientHeight;return!(100*(1-(r+i-o)/(i||1))>=n&&(xe(t,e,Ee),1))});le||(le=function(e,t=1e3){let n=null;return function(...o){if(null===n)return n=setTimeout(()=>{n=null},t),e(...o)}}(function(){ve=n.call(t,ve,e)}),t.addEventListener("scroll",le))}(e,o)}(e,t)}async function xe(e,t,n){const o=function(e,t,n=$.Prefix){const o=[],{actions:r,nearestOnly:i}=function(e,t,n){let o=t;for(;o;){const t=w(o,V(e,$.Actions,!1));if(t){const e=te(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=w(o,V(e,$.Action,!1));if(r){const e=te(r);if(e[n]||"click"!==n)return{actions:e[n]||[],nearestOnly:!0}}o=re(e,o)}return{actions:[],nearestOnly:!1}}(n,e,t);return r.length?(r.forEach(r=>{const s=ae(r.actionParams||"",",").reduce((e,t)=>(e[Y(t)]=!0,e),{}),a=ne(n,e,s,i);if(!a.length){const t="page",o=`[${V(n,t)}]`,[r,i]=ie(e,o,n,t);a.push({entity:t,data:r,nested:[],context:i})}a.forEach(e=>{o.push({entity:e.entity,action:r.action,data:e.data,trigger:t,context:e.context,nested:e.nested})})}),o):o}(t,n,e.settings.prefix);return Promise.all(o.map(t=>be(e,{name:`${t.entity} ${t.action}`,...t,trigger:n})))}function Ae(e,t,n,o){const r=w(t,n);r&&Object.values(te(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case ke:o=e,t.addEventListener("mouseenter",z(function(e){e.target instanceof Element&&xe(o,e.target,ke)}));break;case je:!function(e,t){xe(e,t,je)}(e,t);break;case Se:!function(e,t,n=""){setInterval(()=>{document.hidden||xe(e,t,Se)},parseInt(n||"")||15e3)}(e,t,n.triggerParams);break;case Ee:!function(e,t=""){const n=parseInt(t||"")||50;n<0||n>100||ve.push([e,n])}(t,n.triggerParams);break;case"impression":ye(e,t);break;case"visible":ye(e,t,{multiple:!0});break;case _e:!function(e,t,n=""){setTimeout(()=>xe(e,t,_e),parseInt(n||"")||15e3)}(e,t,n.triggerParams)}var o}))}function $e(e,t){xe(e,t.target,"click")}function Ce(e,t){t.target&&xe(e,t.target,"submit")}function qe(e,t,n,o){const r=[];let i=!0;n.forEach(e=>{const t=Re(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=!K(s)&&F(s)&&s.startsWith("walker ");if(K(s)){if("object"==typeof s&&0===Object.keys(s).length)return}else{const e=Array.from(t);if(!F(e[0])||""===e[0].trim())return;const n="walker run";i&&e[0]===n&&(i=!1)}(o&&a||!o&&!a)&&r.push(t)}),r.forEach(n=>{Pe(e,t,n)})}function Pe(e,t="data-elb",n){z(()=>{if(Array.isArray(n)){const[o,...r]=n;if(!o||F(o)&&""===o.trim())return;if(F(o)&&o.startsWith("walker "))return void e(o,r[0]);be({elb:e,settings:{prefix:t,scope:document,pageview:!1,session:!1,elb:"",elbLayer:!1}},o,...r)}else if(n&&"object"==typeof n){if(0===Object.keys(n).length)return;e(n)}},()=>{})()}function Re(e){return null!=e&&"object"==typeof e&&"[object Arguments]"===Object.prototype.toString.call(e)}function De(e,t={}){return function(e={}){const{cb:t,consent:n,collector:i,storage:s}=e,a=(null==i?void 0:i.push)||k;if(!n)return S((s?O:x)(e),i,t);{const i=function(e,t){let n;return(i,s)=>{if(r(n)&&n===(null==i?void 0:i.group))return;n=null==i?void 0:i.group;let a=()=>x(e);return e.consent&&u((o(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),s)&&(a=()=>O(e)),S(a(),i,t)}}(e,t);a("walker on","consent",(o(n)?n:[n]).reduce((e,t)=>({...e,[t]:i}),{}))}}({...t,collector:{push:e,group:void 0}})}M({},{env:()=>Ie});var Ie={};M(Ie,{push:()=>We});var Xe={addEventListener:jest.fn(),removeEventListener:jest.fn(),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},Ne={addEventListener:jest.fn(),removeEventListener:jest.fn(),querySelector:jest.fn(),querySelectorAll:jest.fn(()=>[]),getElementById:jest.fn(),getElementsByClassName:jest.fn(()=>[]),getElementsByTagName:jest.fn(()=>[]),createElement:jest.fn(()=>({setAttribute:jest.fn(),getAttribute:jest.fn(),addEventListener:jest.fn(),removeEventListener:jest.fn()})),body:{appendChild:jest.fn(),removeChild:jest.fn()},documentElement:{scrollTop:0,scrollLeft:0},readyState:"complete",title:"Test Page",referrer:"",cookie:""},We={elb:jest.fn(),window:Xe,document:Ne},Te=async(e,t)=>{try{const{elb:n,window:o,document:r}=t,i=(null==e?void 0:e.settings)||{},s=o||(void 0!==globalThis.window?globalThis.window:void 0),a=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}}(i,a),u={settings:c},l={elb:n,settings:c};if(s&&a){if(!1!==c.elbLayer&&function(e,t={}){const n=t.name||"elbLayer",o=t.window||("undefined"!=typeof window?window:void 0);if(!o)return;const r=o;r[n]||(r[n]=[]);const i=r[n];i.push=function(...n){if(Re(n[0])){const o=[...Array.from(n[0])],r=Array.prototype.push.apply(this,[o]);return Pe(e,t.prefix,o),r}const o=Array.prototype.push.apply(this,n);return n.forEach(n=>{Pe(e,t.prefix,n)}),o},Array.isArray(i)&&i.length>0&&function(e,t="data-elb",n){qe(e,t,n,!0),qe(e,t,n,!1),n.length=0}(e,t.prefix,i)}(n,{name:F(c.elbLayer)?c.elbLayer:"elbLayer",prefix:c.prefix,window:s}),c.session){const e="boolean"==typeof c.session?{}:c.session;De(n,e)}await async function(e,t,n){const o=()=>{e(t,n)};"loading"!==document.readyState?o():document.addEventListener("DOMContentLoaded",o)}(Le,l,c),(()=>{if(Oe(l,c),c.pageview){const[e,t]=ee(c.prefix||"data-elb",c.scope);be(l,"page view",e,"load",t)}})(),F(c.elb)&&c.elb&&(s[c.elb]=(...e)=>{const[t,n,o,r,i,s]=e;return be(l,t,n,o,r,i,s)})}return{type:"browser",config:u,push:(...e)=>{const[t,n,o,r,i,s]=e;return be(l,t,n,o,r,i,s)},destroy:async()=>{a&&he(c.scope||a)},on:async(e,t)=>{switch(e){case"consent":if(c.session&&t){const e="boolean"==typeof c.session?{}:c.session;De(n,e)}break;case"session":case"ready":default:break;case"run":if(a&&s&&(Oe(l,c),c.pageview)){const[e,t]=ee(c.prefix||"data-elb",c.scope);be(l,"page view",e,"load",t)}}}}}catch(e){throw e}},Me=Object.defineProperty,Ue=(e,t)=>{for(var n in t)Me(e,n,{get:t[n],enumerable:!0})},He=!1;function Be(e,t={},n){if(t.filter&&!0===g(()=>t.filter(n),()=>!1)())return;const r=function(e){if(i(e)&&s(e.event)){const{event:t,...n}=e;return{name:t,...n}}return o(e)&&e.length>=2?Ge(e):null!=(t=e)&&"object"==typeof t&&"length"in t&&"number"==typeof t.length&&t.length>0?Ge(Array.from(e)):null;var t}(n);if(!r)return;const a={name:`${t.prefix||"dataLayer"} ${r.name}`,data:r,context:{},globals:{},custom:{},consent:{},nested:[],user:{},id:Math.random().toString(36).substring(2,15),trigger:"",entity:"",action:"",timestamp:Date.now(),timing:0,group:"",count:0,version:{source:"1.0.0",tagging:2},source:{type:"dataLayer",id:"",previous_id:""}};g(()=>e(a),()=>{})()}function Ge(e){const[t,n,o]=e;if(!s(t))return null;let r,a={};switch(t){case"consent":if(!s(n)||e.length<3)return null;if("default"!==n&&"update"!==n)return null;if(!i(o)||null===o)return null;r=`${t} ${n}`,a={...o};break;case"event":if(!s(n))return null;r=n,i(o)&&(a={...o});break;case"config":if(!s(n))return null;r=`${t} ${n}`,i(o)&&(a={...o});break;case"set":if(s(n))r=`${t} ${n}`,i(o)&&(a={...o});else{if(!i(n))return null;r=`${t} custom`,a={...n}}break;default:return null}return{name:r,...a}}Ue({},{push:()=>Fe});var Ke={dataLayer:[],addEventListener:jest.fn(),removeEventListener:jest.fn()},Fe={elb:jest.fn(),window:Ke};function Je(){return["consent","update",{ad_user_data:"granted",ad_personalization:"granted",ad_storage:"denied",analytics_storage:"granted"}]}function ze(){return["consent","default",{ad_storage:"denied",analytics_storage:"denied",ad_user_data:"denied",ad_personalization:"denied"}]}function Ye(){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 Ve(){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 Qe(){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 Ze(){return["config","G-XXXXXXXXXX",{page_title:"Custom Page Title",page_location:"https://example.com/page",send_page_view:!1}]}function et(){return["set",{currency:"EUR",country:"DE"}]}function tt(){return{event:"custom_event",custom_parameter:"custom_value",user_id:"user123"}}Ue({},{add_to_cart:()=>Ve,config:()=>Ze,consentDefault:()=>ze,consentUpdate:()=>Je,directDataLayerEvent:()=>tt,purchase:()=>Ye,setCustom:()=>et,view_item:()=>Qe});Ue({},{add_to_cart:()=>rt,config:()=>ct,configGA4:()=>st,consentOnlyMapping:()=>ut,consentUpdate:()=>nt,customEvent:()=>at,purchase:()=>ot,view_item:()=>it});var nt={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}}}}},ot={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"}}}}]}}}},rt={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"}}},it={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"}}},st={name:"page view",data:{map:{title:"page_title",url:"page_location"}}},at={data:{map:{user_id:"user_id",custom_parameter:"custom_parameter"}}},ct={consent:{update:nt},purchase:ot,add_to_cart:rt,view_item:it,"config G-XXXXXXXXXX":st,custom_event:at,"*":{data:{}}},ut={consent:{update:nt}},lt=async(e,t)=>{try{const{elb:n,window:o}=t,r={name:"dataLayer",prefix:"dataLayer",...null==e?void 0:e.settings},i={settings:r};return o&&(function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer",r=window[o];if(Array.isArray(r)&&!He){He=!0;try{for(const t of r)Be(e,n,t)}finally{He=!1}}}(n,i),function(e,t){const n=t.settings,o=(null==n?void 0:n.name)||"dataLayer";window[o]||(window[o]=[]);const r=window[o];if(!Array.isArray(r))return;const i=r.push.bind(r);r.push=function(...t){if(He)return i(...t);He=!0;try{for(const o of t)Be(e,n,o)}finally{He=!1}return i(...t)}}(n,i)),{type:"dataLayer",config:i,push:n,destroy:async()=>{const e=r.name||"dataLayer";o&&o[e]&&Array.isArray(o[e])}}}catch(e){throw e}};function ft(){window.dataLayer=window.dataLayer||[];const e=e=>{i(e)&&i(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})}}}if(window&&document){const e=async()=>{let e;const t=document.querySelector("script[data-elbconfig]");if(t){const n=t.getAttribute("data-elbconfig")||"";n.includes(":")?e=v(n):n&&(e=window[n])}e||(e=window.elbConfig),e&&await async function(e={}){const t=n({collector:{destinations:{dataLayer:{code:ft()}}},browser:{run:!0,session:!0},dataLayer:!1,elb:"elb"},e),o={...t.collector,sources:{browser:{code:Te,config:{settings:t.browser},env:{window:"undefined"!=typeof window?window:void 0,document:"undefined"!=typeof document?document:void 0}}}};if(t.dataLayer){const e=i(t.dataLayer)?t.dataLayer:{};o.sources&&(o.sources.dataLayer={code:lt,config:{settings:e}})}const r=await W(o);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=r.elb),t.name&&(window[t.name]=r.collector)),r}(e)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}})();
1
+ "use strict";(()=>{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:()=>Me,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:()=>Le,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,L=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,M=/^[-+]?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(!L.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?M.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 Le=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}}};Le.create=e=>new Le({typeName:qe.ZodNaN,...P(e)});var Me=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=Le.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 Lt(e,t,n,a,r){e[t]=n,Rt(e,t,a,r)}var Mt=(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?Mt(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":Lt(n,"minimum",a.value,a.message,t);break;case"max":Lt(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":Lt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Lt(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":Lt(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Lt(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":Lt(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}}})):Lt(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}}})):Lt(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?Lt(n,"minimum",a.value,a.message,t):Lt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Lt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Lt(n,"maximum",a.value,a.message,t):Lt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Lt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Lt(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?Lt(n,"minimum",a.value,a.message,t):Lt(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Lt(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Lt(n,"maximum",a.value,a.message,t):Lt(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Lt(n,"maximum",a.value,a.message,t));break;case"multipleOf":Lt(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&&Lt(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Lt(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Lt(s,"minItems",e.exactLength.value,e.exactLength.message,t),Lt(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&&Lt(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Lt(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:Mt(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 Ln(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 Mn(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&&!Ln(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){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Wn(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}}function Xn(e,t){return(e.getAttribute(t)||"").trim()}function Jn(e){const t={};return function(e,t=";"){if(!e)return[];const n=new RegExp(`(?:[^${t}']+|'[^']*')+`,"ig");return e.match(n)||[]}(e).forEach(e=>{const[n,a]=function(e){const[t,n]=e.split(/:(.+)/,2);return[Kn(t||""),Kn(n||"")]}(e);n&&("true"===a?t[n]=!0:"false"===a?t[n]=!1:a&&/^\d+$/.test(a)?t[n]=parseInt(a,10):a&&/^\d+\.\d+$/.test(a)?t[n]=parseFloat(a):t[n]=a||!0)}),t}var Hn=function(){const e=window;(e.elbLayer=e.elbLayer||[]).push(arguments)};function Yn(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 Gn(e,t,n){return!1===n?e:(n||(n=Qn),n(e,t,Qn))}var Qn=(e,t)=>{const n={};return e.id&&(n.session=e.id),e.storage&&e.device&&(n.device=e.device),t?t.command("user",n):Hn("walker user",n),e.isStart&&(t?t.push({name:"session start",data:e}):Hn({name:"session start",data:e})),e};function ea(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:ta(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 ta(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 ea(e,a)}function na(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=aa(e);let d=!1;const l=Dn((e,t,n)=>{let a=ea(e,n);return a||(a=Mn(8),ta(e,a,1440*t,n)),String(a)})(a,s,r),p=Dn((e,a)=>{const r=JSON.parse(String(ea(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:Mn(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 ta(i,JSON.stringify(f),2*n,o),f}function aa(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:Mn(12),referrer:s},i,e.data):n}var ra,sa,ia,oa={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 ca(e,t,n){const{allowed:a,consent:r,globals:s,user:i}=e;if(!a)return la({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=Ln(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(ua)(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(da,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 la({ok:!d.length,event:t,successful:c,queued:u,failed:d})}async function ua(e,t){if(t.init&&!t.config.init){const n={collector:e,config:t.config,env:pa(t.env,t.config.env)},a=await Wn(t.init,"DestinationInit",e.hooks)(n);if(!1===a)return a;t.config={...a||t.config,init:!0}}return!0}async function da(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:pa(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:pa(e.env,r.env)};Wn(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 Wn(t.push,"DestinationPush",e.hooks)(s.event,i);return!0}function la(e){var t;return Pn({ok:!(null==(t=null==e?void 0:e.failed)?void 0:t.length),successful:[],queued:[],failed:[]},e)}function pa(e,t){return e||t?t?e&&Cn(e)&&Cn(t)?{...e,...t}:t:e:{}}function ma(e,t,n,a){let r,s=n||[];switch(n||(s=e.on[t]||[]),t){case oa.Consent:r=a||e.consent;break;case oa.Session:r=e.session;break;case oa.Ready:case oa.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 oa.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 oa.Ready:case oa.Run:o=s,(i=e).allowed&&o.forEach(e=>{Dn(e)(i)});break;case oa.Session:!function(e,t){e.session&&t.forEach(t=>{Dn(t)(e,e.session)})}(e,s)}var i,o}async function fa(e,t,n,a){let r;switch(t){case oa.Config:Cn(n)&&Pn(e.config,n,{shallow:!1});break;case oa.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),ma(e,"consent",void 0,r),a?ca(e):la({ok:!0})}(e,n));break;case oa.Custom:Cn(n)&&(e.custom=Pn(e.custom,n));break;case oa.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:pa(a.env,s)};let c=o.config.id;if(!c)do{c=Mn(4)}while(e.destinations[c]);return e.destinations[c]=o,!1!==o.config.queue&&(o.queue=[...e.queue]),ca(e,void 0,{[c]:o})}(e,{code:n},a));break;case oa.Globals:Cn(n)&&(e.globals=Pn(e.globals,n));break;case oa.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,ma(e,t,s)}(e,n,a);break;case oa.Ready:ma(e,"ready");break;case oa.Run:r=await async function(e,t){e.allowed=!0,e.count=0,e.group=Mn(),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 ca(e);return ma(e,"run"),n}(e,n);break;case oa.Session:ma(e,"session");break;case oa.User:Cn(n)&&Pn(e.user,n,{shallow:!1})}return r||{ok:!0,successful:[],queued:[],failed:[]}}function ha(e,t){return Wn(async(n,a={})=>await Un(async()=>{let r=n;if(a.mapping){const t=await Bn(r,a.mapping,e);if(t.ignore)return la({ok:!0});if(a.mapping.consent&&!Ln(a.mapping.consent,e.consent,t.event.consent))return la({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 ca(e,i)},()=>la({ok:!1}))(),"Push",e.hooks)}async function ga(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=ha(r,e=>({timing:Math.round((Date.now()-r.timing)/10)/100,source:{type:"collector",id:"",previous_id:""},...e})),r.command=(i=fa,Wn(async(e,t,n)=>await Un(async()=>await i(s,e,t,n),()=>la({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=pa(t.env,s);n[e]={...t,config:i,env:o}}return n}(0,e.destinations||{}),r;var s,i}async function ya(e){e=e||{};const t=await ga(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}}var va=Object.defineProperty,_a=(e,t)=>{for(var n in t)va(e,n,{get:t[n],enumerable:!0})},ba={};_a(ba,{BRAND:()=>ns,DIRTY:()=>La,EMPTY_PATH:()=>Ea,INVALID:()=>Ra,NEVER:()=>Xs,OK:()=>Ma,ParseStatus:()=>Ia,Schema:()=>Wa,ZodAny:()=>Ar,ZodArray:()=>Pr,ZodBigInt:()=>_r,ZodBoolean:()=>br,ZodBranded:()=>as,ZodCatch:()=>Gr,ZodDate:()=>kr,ZodDefault:()=>Yr,ZodDiscriminatedUnion:()=>$r,ZodEffects:()=>Xr,ZodEnum:()=>Br,ZodError:()=>Aa,ZodFirstPartyTypeKind:()=>es,ZodFunction:()=>Dr,ZodIntersection:()=>Rr,ZodIssueCode:()=>wa,ZodLazy:()=>Ur,ZodLiteral:()=>Vr,ZodMap:()=>Fr,ZodNaN:()=>Qr,ZodNativeEnum:()=>Kr,ZodNever:()=>Or,ZodNull:()=>Zr,ZodNullable:()=>Hr,ZodNumber:()=>vr,ZodObject:()=>Nr,ZodOptional:()=>Jr,ZodParsedType:()=>ka,ZodPipeline:()=>rs,ZodPromise:()=>Wr,ZodReadonly:()=>ss,ZodRecord:()=>Mr,ZodSchema:()=>Wa,ZodSet:()=>zr,ZodString:()=>gr,ZodSymbol:()=>xr,ZodTransformer:()=>Xr,ZodTuple:()=>Lr,ZodType:()=>Wa,ZodUndefined:()=>wr,ZodUnion:()=>Cr,ZodUnknown:()=>Sr,ZodVoid:()=>Tr,addIssueToContext:()=>$a,any:()=>_s,array:()=>ws,bigint:()=>ms,boolean:()=>fs,coerce:()=>Ws,custom:()=>os,date:()=>hs,datetimeRegex:()=>pr,defaultErrorMap:()=>Sa,discriminatedUnion:()=>Os,effect:()=>Fs,enum:()=>Rs,function:()=>Es,getErrorMap:()=>Pa,getParsedType:()=>xa,instanceof:()=>us,intersection:()=>Ts,isAborted:()=>Fa,isAsync:()=>Ua,isDirty:()=>za,isValid:()=>Da,late:()=>cs,lazy:()=>$s,literal:()=>Is,makeIssue:()=>Ca,map:()=>Ns,nan:()=>ps,nativeEnum:()=>Ls,never:()=>ks,null:()=>vs,nullable:()=>Ds,number:()=>ls,object:()=>Zs,objectUtil:()=>ia,oboolean:()=>Ks,onumber:()=>Bs,optional:()=>zs,ostring:()=>qs,pipeline:()=>Vs,preprocess:()=>Us,promise:()=>Ms,quotelessJson:()=>Za,record:()=>js,set:()=>Cs,setErrorMap:()=>Ta,strictObject:()=>As,string:()=>ds,symbol:()=>gs,transformer:()=>Fs,tuple:()=>Ps,undefined:()=>ys,union:()=>Ss,unknown:()=>bs,util:()=>ra,void:()=>xs}),(sa=ra||(ra={})).assertEqual=e=>{},sa.assertIs=function(e){},sa.assertNever=function(e){throw new Error},sa.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},sa.getValidEnumValues=e=>{const t=sa.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const a of t)n[a]=e[a];return sa.objectValues(n)},sa.objectValues=e=>sa.objectKeys(e).map(function(t){return e[t]}),sa.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},sa.find=(e,t)=>{for(const n of e)if(t(n))return n},sa.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,sa.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},sa.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(ia||(ia={})).mergeShapes=(e,t)=>({...e,...t});var ka=ra.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),xa=e=>{switch(typeof e){case"undefined":return ka.undefined;case"string":return ka.string;case"number":return Number.isNaN(e)?ka.nan:ka.number;case"boolean":return ka.boolean;case"function":return ka.function;case"bigint":return ka.bigint;case"symbol":return ka.symbol;case"object":return Array.isArray(e)?ka.array:null===e?ka.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?ka.promise:"undefined"!=typeof Map&&e instanceof Map?ka.map:"undefined"!=typeof Set&&e instanceof Set?ka.set:"undefined"!=typeof Date&&e instanceof Date?ka.date:ka.object;default:return ka.unknown}},wa=ra.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"]),Za=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),Aa=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,ra.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()}};Aa.create=e=>new Aa(e);var Sa=(e,t)=>{let n;switch(e.code){case wa.invalid_type:n=e.received===ka.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case wa.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,ra.jsonStringifyReplacer)}`;break;case wa.unrecognized_keys:n=`Unrecognized key(s) in object: ${ra.joinValues(e.keys,", ")}`;break;case wa.invalid_union:n="Invalid input";break;case wa.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ra.joinValues(e.options)}`;break;case wa.invalid_enum_value:n=`Invalid enum value. Expected ${ra.joinValues(e.options)}, received '${e.received}'`;break;case wa.invalid_arguments:n="Invalid function arguments";break;case wa.invalid_return_type:n="Invalid function return type";break;case wa.invalid_date:n="Invalid date";break;case wa.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}"`:ra.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case wa.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 wa.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 wa.custom:n="Invalid input";break;case wa.invalid_intersection_types:n="Intersection results could not be merged";break;case wa.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case wa.not_finite:n="Number must be finite";break;default:n=t.defaultError,ra.assertNever(e)}return{message:n}},Oa=Sa;function Ta(e){Oa=e}function Pa(){return Oa}var ja,Na,Ca=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}},Ea=[];function $a(e,t){const n=Pa(),a=Ca({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Sa?void 0:Sa].filter(e=>!!e)});e.common.issues.push(a)}var Ia=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 Ra;"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 Ra;if("aborted"===r.status)return Ra;"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}}},Ra=Object.freeze({status:"aborted"}),La=e=>({status:"dirty",value:e}),Ma=e=>({status:"valid",value:e}),Fa=e=>"aborted"===e.status,za=e=>"dirty"===e.status,Da=e=>"valid"===e.status,Ua=e=>"undefined"!=typeof Promise&&e instanceof Promise;(Na=ja||(ja={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Na.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;var Va,qa=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}},Ba=(e,t)=>{if(Da(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 Aa(e.common.issues);return this._error=t,this._error}}};function Ka(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 Wa=class{get description(){return this._def.description}_getType(e){return xa(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:xa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ia,ctx:{common:e.parent.common,data:e.data,parsedType:xa(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ua(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:xa(e)},r=this._parseSync({data:e,path:a.path,parent:a});return Ba(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:xa(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:a});return Da(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=>Da(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:xa(e)},a=this._parse({data:e,path:n.path,parent:n}),r=await(Ua(a)?a:Promise.resolve(a));return Ba(n,r)}refine(e,t){return this._refinement((n,a)=>{const r=e(n),s=()=>{return a.addIssue({code:wa.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 Xr({schema:this,typeName:es.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 Jr.create(this,this._def)}nullable(){return Hr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pr.create(this)}promise(){return Wr.create(this,this._def)}or(e){return Cr.create([this,e],this._def)}and(e){return Rr.create(this,e,this._def)}transform(e){return new Xr({...Ka(this._def),schema:this,typeName:es.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Yr({...Ka(this._def),innerType:this,defaultValue:t,typeName:es.ZodDefault})}brand(){return new as({typeName:es.ZodBranded,type:this,...Ka(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Gr({...Ka(this._def),innerType:this,catchValue:t,typeName:es.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return rs.create(this,e)}readonly(){return ss.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Xa=/^c[^\s-]{8,}$/i,Ja=/^[0-9a-z]+$/,Ha=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ya=/^[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,Ga=/^[a-z0-9_-]{21}$/i,Qa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,er=/^[-+]?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)?)??$/,tr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nr=/^(?:(?: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])$/,ar=/^(?:(?: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])$/,rr=/^(([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]))$/,sr=/^(([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])$/,ir=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,or=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,cr="((\\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])))",ur=new RegExp(`^${cr}$`);function dr(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 lr(e){return new RegExp(`^${dr(e)}$`)}function pr(e){let t=`${cr}T${dr(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 mr(e,t){return!("v4"!==t&&t||!nr.test(e))||!("v6"!==t&&t||!rr.test(e))}function fr(e,t){if(!Qa.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 hr(e,t){return!("v4"!==t&&t||!ar.test(e))||!("v6"!==t&&t||!sr.test(e))}var gr=class e extends Wa{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==ka.string){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.string,received:t.parsedType}),Ra}const t=new Ia;let n;for(const a of this._def.checks)if("min"===a.kind)e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.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),$a(n,{code:wa.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?$a(n,{code:wa.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&$a(n,{code:wa.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),t.dirty())}else if("email"===a.kind)tr.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"email",code:wa.invalid_string,message:a.message}),t.dirty());else if("emoji"===a.kind)Va||(Va=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Va.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"emoji",code:wa.invalid_string,message:a.message}),t.dirty());else if("uuid"===a.kind)Ya.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"uuid",code:wa.invalid_string,message:a.message}),t.dirty());else if("nanoid"===a.kind)Ga.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"nanoid",code:wa.invalid_string,message:a.message}),t.dirty());else if("cuid"===a.kind)Xa.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cuid",code:wa.invalid_string,message:a.message}),t.dirty());else if("cuid2"===a.kind)Ja.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cuid2",code:wa.invalid_string,message:a.message}),t.dirty());else if("ulid"===a.kind)Ha.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"ulid",code:wa.invalid_string,message:a.message}),t.dirty());else if("url"===a.kind)try{new URL(e.data)}catch(r){n=this._getOrReturnCtx(e,n),$a(n,{validation:"url",code:wa.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),$a(n,{validation:"regex",code:wa.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),$a(n,{code:wa.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),$a(n,{code:wa.invalid_string,validation:{startsWith:a.value},message:a.message}),t.dirty()):"endsWith"===a.kind?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:{endsWith:a.value},message:a.message}),t.dirty()):"datetime"===a.kind?pr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"datetime",message:a.message}),t.dirty()):"date"===a.kind?ur.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"date",message:a.message}),t.dirty()):"time"===a.kind?lr(a).test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.invalid_string,validation:"time",message:a.message}),t.dirty()):"duration"===a.kind?er.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"duration",code:wa.invalid_string,message:a.message}),t.dirty()):"ip"===a.kind?mr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"ip",code:wa.invalid_string,message:a.message}),t.dirty()):"jwt"===a.kind?fr(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"jwt",code:wa.invalid_string,message:a.message}),t.dirty()):"cidr"===a.kind?hr(e.data,a.version)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"cidr",code:wa.invalid_string,message:a.message}),t.dirty()):"base64"===a.kind?ir.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"base64",code:wa.invalid_string,message:a.message}),t.dirty()):"base64url"===a.kind?or.test(e.data)||(n=this._getOrReturnCtx(e,n),$a(n,{validation:"base64url",code:wa.invalid_string,message:a.message}),t.dirty()):ra.assertNever(a);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:wa.invalid_string,...ja.errToObj(n)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(e){return this._addCheck({kind:"email",...ja.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ja.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ja.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ja.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ja.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ja.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ja.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ja.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ja.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...ja.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...ja.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ja.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...ja.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,...ja.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,...ja.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ja.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ja.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...ja.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ja.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ja.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ja.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ja.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ja.errToObj(t)})}nonempty(e){return this.min(1,ja.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 yr(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}gr.create=e=>{var t;return new gr({checks:[],typeName:es.ZodString,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...Ka(e)})};var vr=class e extends Wa{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)!==ka.number){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.number,received:t.parsedType}),Ra}let t;const n=new Ia;for(const a of this._def.checks)"int"===a.kind?ra.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.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),$a(t,{code:wa.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),$a(t,{code:wa.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):"multipleOf"===a.kind?0!==yr(e.data,a.value)&&(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):"finite"===a.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),$a(t,{code:wa.not_finite,message:a.message}),n.dirty()):ra.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ja.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ja.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ja.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ja.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:ja.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(e){return this._addCheck({kind:"int",message:ja.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ja.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ja.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ja.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ja.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ja.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ja.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ja.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ja.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&&ra.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)}};vr.create=e=>new vr({checks:[],typeName:es.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Ka(e)});var _r=class e extends Wa{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)!==ka.bigint)return this._getInvalidInput(e);let t;const n=new Ia;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),$a(t,{code:wa.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),$a(t,{code:wa.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),$a(t,{code:wa.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):ra.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.bigint,received:t.parsedType}),Ra}gte(e,t){return this.setLimit("min",e,!0,ja.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ja.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ja.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ja.toString(t))}setLimit(t,n,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:a,message:ja.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:ja.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ja.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ja.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ja.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ja.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}};_r.create=e=>{var t;return new _r({checks:[],typeName:es.ZodBigInt,coerce:null!=(t=null==e?void 0:e.coerce)&&t,...Ka(e)})};var br=class extends Wa{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==ka.boolean){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.boolean,received:t.parsedType}),Ra}return Ma(e.data)}};br.create=e=>new br({typeName:es.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Ka(e)});var kr=class e extends Wa{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==ka.date){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.date,received:t.parsedType}),Ra}if(Number.isNaN(e.data.getTime()))return $a(this._getOrReturnCtx(e),{code:wa.invalid_date}),Ra;const t=new Ia;let n;for(const a of this._def.checks)"min"===a.kind?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),$a(n,{code:wa.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),$a(n,{code:wa.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),t.dirty()):ra.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:ja.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ja.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}};kr.create=e=>new kr({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:es.ZodDate,...Ka(e)});var xr=class extends Wa{_parse(e){if(this._getType(e)!==ka.symbol){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.symbol,received:t.parsedType}),Ra}return Ma(e.data)}};xr.create=e=>new xr({typeName:es.ZodSymbol,...Ka(e)});var wr=class extends Wa{_parse(e){if(this._getType(e)!==ka.undefined){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.undefined,received:t.parsedType}),Ra}return Ma(e.data)}};wr.create=e=>new wr({typeName:es.ZodUndefined,...Ka(e)});var Zr=class extends Wa{_parse(e){if(this._getType(e)!==ka.null){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.null,received:t.parsedType}),Ra}return Ma(e.data)}};Zr.create=e=>new Zr({typeName:es.ZodNull,...Ka(e)});var Ar=class extends Wa{constructor(){super(...arguments),this._any=!0}_parse(e){return Ma(e.data)}};Ar.create=e=>new Ar({typeName:es.ZodAny,...Ka(e)});var Sr=class extends Wa{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ma(e.data)}};Sr.create=e=>new Sr({typeName:es.ZodUnknown,...Ka(e)});var Or=class extends Wa{_parse(e){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.never,received:t.parsedType}),Ra}};Or.create=e=>new Or({typeName:es.ZodNever,...Ka(e)});var Tr=class extends Wa{_parse(e){if(this._getType(e)!==ka.undefined){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.void,received:t.parsedType}),Ra}return Ma(e.data)}};Tr.create=e=>new Tr({typeName:es.ZodVoid,...Ka(e)});var Pr=class e extends Wa{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==ka.array)return $a(t,{code:wa.invalid_type,expected:ka.array,received:t.parsedType}),Ra;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,r=t.data.length<a.exactLength.value;(e||r)&&($a(t,{code:e?wa.too_big:wa.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&&($a(t,{code:wa.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&&($a(t,{code:wa.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 qa(t,e,t.path,n)))).then(e=>Ia.mergeArray(n,e));const r=[...t.data].map((e,n)=>a.type._parseSync(new qa(t,e,t.path,n)));return Ia.mergeArray(n,r)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:ja.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:ja.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:ja.toString(n)}})}nonempty(e){return this.min(1,e)}};function jr(e){if(e instanceof Nr){const t={};for(const n in e.shape){const a=e.shape[n];t[n]=Jr.create(jr(a))}return new Nr({...e._def,shape:()=>t})}return e instanceof Pr?new Pr({...e._def,type:jr(e.element)}):e instanceof Jr?Jr.create(jr(e.unwrap())):e instanceof Hr?Hr.create(jr(e.unwrap())):e instanceof Lr?Lr.create(e.items.map(e=>jr(e))):e}Pr.create=(e,t)=>new Pr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:es.ZodArray,...Ka(t)});var Nr=class e extends Wa{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=ra.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==ka.object){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.object,received:t.parsedType}),Ra}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof Or&&"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 qa(n,r,n.path,e)),alwaysSet:e in n.data})}if(this._def.catchall instanceof Or){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&&($a(n,{code:wa.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 qa(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=>Ia.mergeObjectSync(t,e)):Ia.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(t){return ja.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=ja.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:es.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 ra.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 ra.objectKeys(this.shape))t[e]||(n[e]=this.shape[e]);return new e({...this._def,shape:()=>n})}deepPartial(){return jr(this)}partial(t){const n={};for(const e of ra.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 ra.objectKeys(this.shape))if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof Jr;)t=t._def.innerType;n[e]=t}return new e({...this._def,shape:()=>n})}keyof(){return qr(ra.objectKeys(this.shape))}};Nr.create=(e,t)=>new Nr({shape:()=>e,unknownKeys:"strip",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)}),Nr.strictCreate=(e,t)=>new Nr({shape:()=>e,unknownKeys:"strict",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)}),Nr.lazycreate=(e,t)=>new Nr({shape:e,unknownKeys:"strip",catchall:Or.create(),typeName:es.ZodObject,...Ka(t)});var Cr=class extends Wa{_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 Aa(e.ctx.common.issues));return $a(t,{code:wa.invalid_union,unionErrors:n}),Ra});{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 Aa(e));return $a(t,{code:wa.invalid_union,unionErrors:r}),Ra}}get options(){return this._def.options}};Cr.create=(e,t)=>new Cr({options:e,typeName:es.ZodUnion,...Ka(t)});var Er=e=>e instanceof Ur?Er(e.schema):e instanceof Xr?Er(e.innerType()):e instanceof Vr?[e.value]:e instanceof Br?e.options:e instanceof Kr?ra.objectValues(e.enum):e instanceof Yr?Er(e._def.innerType):e instanceof wr?[void 0]:e instanceof Zr?[null]:e instanceof Jr?[void 0,...Er(e.unwrap())]:e instanceof Hr?[null,...Er(e.unwrap())]:e instanceof as||e instanceof ss?Er(e.unwrap()):e instanceof Gr?Er(e._def.innerType):[],$r=class e extends Wa{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.object)return $a(t,{code:wa.invalid_type,expected:ka.object,received:t.parsedType}),Ra;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}):($a(t,{code:wa.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Ra)}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=Er(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:es.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:r,...Ka(a)})}};function Ir(e,t){const n=xa(e),a=xa(t);if(e===t)return{valid:!0,data:e};if(n===ka.object&&a===ka.object){const n=ra.objectKeys(t),a=ra.objectKeys(e).filter(e=>-1!==n.indexOf(e)),r={...e,...t};for(const n of a){const a=Ir(e[n],t[n]);if(!a.valid)return{valid:!1};r[n]=a.data}return{valid:!0,data:r}}if(n===ka.array&&a===ka.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let a=0;a<e.length;a++){const r=Ir(e[a],t[a]);if(!r.valid)return{valid:!1};n.push(r.data)}return{valid:!0,data:n}}return n===ka.date&&a===ka.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}var Rr=class extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),a=(e,a)=>{if(Fa(e)||Fa(a))return Ra;const r=Ir(e.value,a.value);return r.valid?((za(e)||za(a))&&t.dirty(),{status:t.value,value:r.data}):($a(n,{code:wa.invalid_intersection_types}),Ra)};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}))}};Rr.create=(e,t,n)=>new Rr({left:e,right:t,typeName:es.ZodIntersection,...Ka(n)});var Lr=class e extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ka.array)return $a(n,{code:wa.invalid_type,expected:ka.array,received:n.parsedType}),Ra;if(n.data.length<this._def.items.length)return $a(n,{code:wa.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ra;!this._def.rest&&n.data.length>this._def.items.length&&($a(n,{code:wa.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 qa(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(a).then(e=>Ia.mergeArray(t,e)):Ia.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Lr.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Lr({items:e,typeName:es.ZodTuple,rest:null,...Ka(t)})};var Mr=class e extends Wa{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!==ka.object)return $a(n,{code:wa.invalid_type,expected:ka.object,received:n.parsedType}),Ra;const a=[],r=this._def.keyType,s=this._def.valueType;for(const e in n.data)a.push({key:r._parse(new qa(n,e,n.path,e)),value:s._parse(new qa(n,n.data[e],n.path,e)),alwaysSet:e in n.data});return n.common.async?Ia.mergeObjectAsync(t,a):Ia.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,a){return new e(n instanceof Wa?{keyType:t,valueType:n,typeName:es.ZodRecord,...Ka(a)}:{keyType:gr.create(),valueType:t,typeName:es.ZodRecord,...Ka(n)})}},Fr=class extends Wa{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!==ka.map)return $a(n,{code:wa.invalid_type,expected:ka.map,received:n.parsedType}),Ra;const a=this._def.keyType,r=this._def.valueType,s=[...n.data.entries()].map(([e,t],s)=>({key:a._parse(new qa(n,e,n.path,[s,"key"])),value:r._parse(new qa(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 Ra;"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 Ra;"dirty"!==a.status&&"dirty"!==r.status||t.dirty(),e.set(a.value,r.value)}return{status:t.value,value:e}}}};Fr.create=(e,t,n)=>new Fr({valueType:t,keyType:e,typeName:es.ZodMap,...Ka(n)});var zr=class e extends Wa{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==ka.set)return $a(n,{code:wa.invalid_type,expected:ka.set,received:n.parsedType}),Ra;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&($a(n,{code:wa.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&&($a(n,{code:wa.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 Ra;"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 qa(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:ja.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:ja.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};zr.create=(e,t)=>new zr({valueType:e,minSize:null,maxSize:null,typeName:es.ZodSet,...Ka(t)});var Dr=class e extends Wa{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.function)return $a(t,{code:wa.invalid_type,expected:ka.function,received:t.parsedType}),Ra;function n(e,n){return Ca({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pa(),Sa].filter(e=>!!e),issueData:{code:wa.invalid_arguments,argumentsError:n}})}function a(e,n){return Ca({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Pa(),Sa].filter(e=>!!e),issueData:{code:wa.invalid_return_type,returnTypeError:n}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Wr){const e=this;return Ma(async function(...t){const i=new Aa([]),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 Ma(function(...t){const i=e._def.args.safeParse(t,r);if(!i.success)throw new Aa([n(t,i.error)]);const o=Reflect.apply(s,this,i.data),c=e._def.returns.safeParse(o,r);if(!c.success)throw new Aa([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:Lr.create(t).rest(Sr.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||Lr.create([]).rest(Sr.create()),returns:n||Sr.create(),typeName:es.ZodFunction,...Ka(a)})}},Ur=class extends Wa{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})}};Ur.create=(e,t)=>new Ur({getter:e,typeName:es.ZodLazy,...Ka(t)});var Vr=class extends Wa{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return $a(t,{received:t.data,code:wa.invalid_literal,expected:this._def.value}),Ra}return{status:"valid",value:e.data}}get value(){return this._def.value}};function qr(e,t){return new Br({values:e,typeName:es.ZodEnum,...Ka(t)})}Vr.create=(e,t)=>new Vr({value:e,typeName:es.ZodLiteral,...Ka(t)});var Br=class e extends Wa{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return $a(t,{expected:ra.joinValues(n),received:t.parsedType,code:wa.invalid_type}),Ra}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 $a(t,{received:t.data,code:wa.invalid_enum_value,options:n}),Ra}return Ma(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})}};Br.create=qr;var Kr=class extends Wa{_parse(e){const t=ra.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==ka.string&&n.parsedType!==ka.number){const e=ra.objectValues(t);return $a(n,{expected:ra.joinValues(e),received:n.parsedType,code:wa.invalid_type}),Ra}if(this._cache||(this._cache=new Set(ra.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=ra.objectValues(t);return $a(n,{received:n.data,code:wa.invalid_enum_value,options:e}),Ra}return Ma(e.data)}get enum(){return this._def.values}};Kr.create=(e,t)=>new Kr({values:e,typeName:es.ZodNativeEnum,...Ka(t)});var Wr=class extends Wa{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==ka.promise&&!1===t.common.async)return $a(t,{code:wa.invalid_type,expected:ka.promise,received:t.parsedType}),Ra;const n=t.parsedType===ka.promise?t.data:Promise.resolve(t.data);return Ma(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Wr.create=(e,t)=>new Wr({type:e,typeName:es.ZodPromise,...Ka(t)});var Xr=class extends Wa{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===es.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=>{$a(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 Ra;const a=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ra:"dirty"===a.status||"dirty"===t.value?La(a.value):a});{if("aborted"===t.value)return Ra;const a=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===a.status?Ra:"dirty"===a.status||"dirty"===t.value?La(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?Ra:("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?Ra:("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(!Da(e))return Ra;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=>Da(e)?Promise.resolve(a.transform(e.value,r)).then(e=>({status:t.value,value:e})):Ra)}ra.assertNever(a)}};Xr.create=(e,t,n)=>new Xr({schema:e,typeName:es.ZodEffects,effect:t,...Ka(n)}),Xr.createWithPreprocess=(e,t,n)=>new Xr({schema:t,effect:{type:"preprocess",transform:e},typeName:es.ZodEffects,...Ka(n)});var Jr=class extends Wa{_parse(e){return this._getType(e)===ka.undefined?Ma(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Jr.create=(e,t)=>new Jr({innerType:e,typeName:es.ZodOptional,...Ka(t)});var Hr=class extends Wa{_parse(e){return this._getType(e)===ka.null?Ma(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Hr.create=(e,t)=>new Hr({innerType:e,typeName:es.ZodNullable,...Ka(t)});var Yr=class extends Wa{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===ka.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Yr.create=(e,t)=>new Yr({innerType:e,typeName:es.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Ka(t)});var Gr=class extends Wa{_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 Ua(a)?a.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Aa(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new Aa(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Gr.create=(e,t)=>new Gr({innerType:e,typeName:es.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Ka(t)});var Qr=class extends Wa{_parse(e){if(this._getType(e)!==ka.nan){const t=this._getOrReturnCtx(e);return $a(t,{code:wa.invalid_type,expected:ka.nan,received:t.parsedType}),Ra}return{status:"valid",value:e.data}}};Qr.create=e=>new Qr({typeName:es.ZodNaN,...Ka(e)});var es,ts,ns=Symbol("zod_brand"),as=class extends Wa{_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}},rs=class e extends Wa{_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?Ra:"dirty"===e.status?(t.dirty(),La(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?Ra:"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:es.ZodPipeline})}},ss=class extends Wa{_parse(e){const t=this._def.innerType._parse(e),n=e=>(Da(e)&&(e.value=Object.freeze(e.value)),e);return Ua(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};function is(e,t){const n="function"==typeof e?e(t):"string"==typeof e?{message:e}:e;return"string"==typeof n?{message:n}:n}function os(e,t={},n){return e?Ar.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=is(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}});if(!o){const e=is(t,a),o=null==(i=null!=(s=e.fatal)?s:n)||i;r.addIssue({code:"custom",...e,fatal:o})}}):Ar.create()}ss.create=(e,t)=>new ss({innerType:e,typeName:es.ZodReadonly,...Ka(t)});var cs={object:Nr.lazycreate};(ts=es||(es={})).ZodString="ZodString",ts.ZodNumber="ZodNumber",ts.ZodNaN="ZodNaN",ts.ZodBigInt="ZodBigInt",ts.ZodBoolean="ZodBoolean",ts.ZodDate="ZodDate",ts.ZodSymbol="ZodSymbol",ts.ZodUndefined="ZodUndefined",ts.ZodNull="ZodNull",ts.ZodAny="ZodAny",ts.ZodUnknown="ZodUnknown",ts.ZodNever="ZodNever",ts.ZodVoid="ZodVoid",ts.ZodArray="ZodArray",ts.ZodObject="ZodObject",ts.ZodUnion="ZodUnion",ts.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ts.ZodIntersection="ZodIntersection",ts.ZodTuple="ZodTuple",ts.ZodRecord="ZodRecord",ts.ZodMap="ZodMap",ts.ZodSet="ZodSet",ts.ZodFunction="ZodFunction",ts.ZodLazy="ZodLazy",ts.ZodLiteral="ZodLiteral",ts.ZodEnum="ZodEnum",ts.ZodEffects="ZodEffects",ts.ZodNativeEnum="ZodNativeEnum",ts.ZodOptional="ZodOptional",ts.ZodNullable="ZodNullable",ts.ZodDefault="ZodDefault",ts.ZodCatch="ZodCatch",ts.ZodPromise="ZodPromise",ts.ZodBranded="ZodBranded",ts.ZodPipeline="ZodPipeline",ts.ZodReadonly="ZodReadonly";var us=(e,t={message:`Input not instance of ${e.name}`})=>os(t=>t instanceof e,t),ds=gr.create,ls=vr.create,ps=Qr.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=Tr.create,ws=Pr.create,Zs=Nr.create,As=Nr.strictCreate,Ss=Cr.create,Os=$r.create,Ts=Rr.create,Ps=Lr.create,js=Mr.create,Ns=Fr.create,Cs=zr.create,Es=Dr.create,$s=Ur.create,Is=Vr.create,Rs=Br.create,Ls=Kr.create,Ms=Wr.create,Fs=Xr.create,zs=Jr.create,Ds=Hr.create,Us=Xr.createWithPreprocess,Vs=rs.create,qs=()=>ds().optional(),Bs=()=>ls().optional(),Ks=()=>fs().optional(),Ws={string:e=>gr.create({...e,coerce:!0}),number:e=>vr.create({...e,coerce:!0}),boolean:e=>br.create({...e,coerce:!0}),bigint:e=>_r.create({...e,coerce:!0}),date:e=>kr.create({...e,coerce:!0})},Xs=Ra,Js=Symbol("Let zodToJsonSchema decide on which parser to use"),Hs={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 Ys(e,t,n,a){(null==a?void 0:a.errorMessages)&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Gs(e,t,n,a,r){e[t]=n,Ys(e,t,a,r)}var Qs=(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 ei(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Qs(t,e.currentPath):t.join("/")}}function ti(e,t){return Oi(e.type._def,t)}function ni(e,t,n){const a=null!=n?n:t.dateStrategy;if(Array.isArray(a))return{anyOf:a.map((n,a)=>ni(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 ai(e,t)}}var ai=(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":Gs(n,"minimum",a.value,a.message,t);break;case"max":Gs(n,"maximum",a.value,a.message,t)}return n},ri=void 0,si=/^[cC][^\s-]{8,}$/,ii=/^[0-9a-z]+$/,oi=/^[0-9A-HJKMNP-TV-Z]{26}$/,ci=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,ui=()=>(void 0===ri&&(ri=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ri),di=/^(?:(?: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])$/,li=/^(([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])$/,pi=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,mi=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,fi=/^[a-zA-Z0-9_-]{21}$/,hi=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function gi(e,t){const n={type:"string"};if(e.checks)for(const a of e.checks)switch(a.kind){case"min":Gs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t);break;case"max":Gs(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":_i(n,"email",a.message,t);break;case"format:idn-email":_i(n,"idn-email",a.message,t);break;case"pattern:zod":bi(n,ci,a.message,t)}break;case"url":_i(n,"uri",a.message,t);break;case"uuid":_i(n,"uuid",a.message,t);break;case"regex":bi(n,a.regex,a.message,t);break;case"cuid":bi(n,si,a.message,t);break;case"cuid2":bi(n,ii,a.message,t);break;case"startsWith":bi(n,RegExp(`^${yi(a.value,t)}`),a.message,t);break;case"endsWith":bi(n,RegExp(`${yi(a.value,t)}$`),a.message,t);break;case"datetime":_i(n,"date-time",a.message,t);break;case"date":_i(n,"date",a.message,t);break;case"time":_i(n,"time",a.message,t);break;case"duration":_i(n,"duration",a.message,t);break;case"length":Gs(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,a.value):a.value,a.message,t),Gs(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,a.value):a.value,a.message,t);break;case"includes":bi(n,RegExp(yi(a.value,t)),a.message,t);break;case"ip":"v6"!==a.version&&_i(n,"ipv4",a.message,t),"v4"!==a.version&&_i(n,"ipv6",a.message,t);break;case"base64url":bi(n,mi,a.message,t);break;case"jwt":bi(n,hi,a.message,t);break;case"cidr":"v6"!==a.version&&bi(n,di,a.message,t),"v4"!==a.version&&bi(n,li,a.message,t);break;case"emoji":bi(n,ui(),a.message,t);break;case"ulid":bi(n,oi,a.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":_i(n,"binary",a.message,t);break;case"contentEncoding:base64":Gs(n,"contentEncoding","base64",a.message,t);break;case"pattern:zod":bi(n,pi,a.message,t)}break;case"nanoid":bi(n,fi,a.message,t)}return n}function yi(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)vi.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}var vi=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function _i(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}}})):Gs(e,"format",t,n,a)}function bi(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:ki(t,a),...n&&a.errorMessages&&{errorMessage:{pattern:n}}})):Gs(e,"pattern",ki(t,a),n,a)}function ki(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 xi(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)===es.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,a)=>{var r;return{...n,[a]:null!=(r=Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",a]}))?r:ei(t)}},{}),additionalProperties:t.rejectedAdditionalProperties};const u={type:"object",additionalProperties:null!=(a=Oi(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)===es.ZodString&&(null==(s=e.keyType._def.checks)?void 0:s.length)){const{type:n,...a}=gi(e.keyType._def,t);return{...u,propertyNames:a}}if((null==(i=e.keyType)?void 0:i._def.typeName)===es.ZodEnum)return{...u,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===es.ZodBranded&&e.keyType._def.type._def.typeName===es.ZodString&&(null==(c=e.keyType._def.type._def.checks)?void 0:c.length)){const{type:n,...a}=ti(e.keyType._def,t);return{...u,propertyNames:a}}return u}var wi={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"},Zi=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Oi(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 Ai(e){try{return e.isOptional()}catch(e){return!0}}var Si=(e,t,n)=>{switch(t){case es.ZodString:return gi(e,n);case es.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",Ys(n,"type",a.message,t);break;case"min":"jsonSchema7"===t.target?a.inclusive?Gs(n,"minimum",a.value,a.message,t):Gs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Gs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Gs(n,"maximum",a.value,a.message,t):Gs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Gs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Gs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case es.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=Ai(i);o&&n&&("ZodOptional"===i._def.typeName&&(i=i._def.innerType),i.isNullable()||(i=i.nullable()),o=!1);const c=Oi(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 Oi(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 es.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?Gs(n,"minimum",a.value,a.message,t):Gs(n,"exclusiveMinimum",a.value,a.message,t):(a.inclusive||(n.exclusiveMinimum=!0),Gs(n,"minimum",a.value,a.message,t));break;case"max":"jsonSchema7"===t.target?a.inclusive?Gs(n,"maximum",a.value,a.message,t):Gs(n,"exclusiveMaximum",a.value,a.message,t):(a.inclusive||(n.exclusiveMaximum=!0),Gs(n,"maximum",a.value,a.message,t));break;case"multipleOf":Gs(n,"multipleOf",a.value,a.message,t)}return n}(e,n);case es.ZodBoolean:return{type:"boolean"};case es.ZodDate:return ni(e,n);case es.ZodUndefined:return{not:ei(n)};case es.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case es.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)!==es.ZodAny&&(s.items=Oi(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Gs(s,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Gs(s,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Gs(s,"minItems",e.exactLength.value,e.exactLength.message,t),Gs(s,"maxItems",e.exactLength.value,e.exactLength.message,t)),s}(e,n);case es.ZodUnion:case es.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return Zi(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in wi&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=wi[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 Zi(e,t)}(e,n);case es.ZodIntersection:return function(e,t){const n=[Oi(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Oi(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 es.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>Oi(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Oi(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Oi(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case es.ZodRecord:return xi(e,n);case es.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 es.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case es.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 es.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:wi[e.innerType._def.typeName],nullable:!0}:{type:[wi[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case es.ZodOptional:return((e,t)=>{var n;if(t.currentPath.toString()===(null==(n=t.propertyPath)?void 0:n.toString()))return Oi(e.innerType._def,t);const a=Oi(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return a?{anyOf:[{not:ei(t)},a]}:ei(t)})(e,n);case es.ZodMap:return function(e,t){return"record"===t.mapStrategy?xi(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Oi(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||ei(t),Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||ei(t)],minItems:2,maxItems:2}}}(e,n);case es.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:Oi(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Gs(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Gs(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case es.ZodLazy:return()=>e.getter()._def;case es.ZodPromise:return function(e,t){return Oi(e.type._def,t)}(e,n);case es.ZodNaN:case es.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:ei({...e,currentPath:[...e.currentPath,"not"]})}}(n);case es.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Oi(e.schema._def,t):ei(t)}(e,n);case es.ZodAny:return ei(n);case es.ZodUnknown:return function(e){return ei(e)}(n);case es.ZodDefault:return function(e,t){return{...Oi(e.innerType._def,t),default:e.defaultValue()}}(e,n);case es.ZodBranded:return ti(e,n);case es.ZodReadonly:case es.ZodCatch:return((e,t)=>Oi(e.innerType._def,t))(e,n);case es.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Oi(e.in._def,t);if("output"===t.pipeStrategy)return Oi(e.out._def,t);const n=Oi(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,Oi(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case es.ZodFunction:case es.ZodVoid:case es.ZodSymbol:default:return}};function Oi(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!==Js)return s}if(r&&!n){const e=Ti(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=Si(e,e.typeName,t),o="function"==typeof i?Oi(i(),t):i;if(o&&Pi(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return s.jsonSchema=o,n}return s.jsonSchema=o,o}var Ti=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Qs(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`),ei(t)):"seen"===t.$refStrategy?ei(t):void 0}},Pi=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n),ji=(e,t)=>{var n;const a=(e=>{const t="string"==typeof(a=e)?{...Hs,name:a}:{...Hs,...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=Oi(n._def,{...a,currentPath:[...a.basePath,a.definitionPath,t]},!0))?r:ei(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=Oi(e._def,void 0===s?a:{...a,currentPath:[...a.basePath,a.definitionPath,s]},!1))?n:ei(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},Ni=ba.record(ba.string(),ba.boolean()).describe("Consent requirement mapping"),Ci=ba.lazy(()=>ba.union([ba.string(),ba.number(),ba.boolean(),Ri,ba.array(Ci)])),Ei=ba.tuple([Ci,Ci]).describe("Loop: [source, transform] tuple for array transformations"),$i=ba.array(Ci).describe("Set: Array of values"),Ii=ba.record(ba.string(),Ci).describe("Map: Object mapping keys to values"),Ri=ba.object({key:ba.string().optional().describe('Property path (e.g., "data.id")'),value:ba.union([ba.string(),ba.number(),ba.boolean()]).optional().describe("Static primitive value"),fn:ba.string().optional().describe("Function string for custom transformation"),map:Ii.optional().describe("Object with key-value mappings"),loop:Ei.optional().describe("Tuple [source, transform]"),set:$i.optional().describe("Array of values"),consent:Ni.optional().describe("Required consent states"),condition:ba.string().optional().describe("Condition function string"),validate:ba.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"),Li=Ei,Mi=$i,Fi=Ii,zi=(ji(Ri,{target:"jsonSchema7",$refStrategy:"relative",name:"ValueConfig"}),ji(Li,{target:"jsonSchema7",$refStrategy:"relative",name:"Loop"}),ji(Mi,{target:"jsonSchema7",$refStrategy:"relative",name:"Set"}),ji(Fi,{target:"jsonSchema7",$refStrategy:"relative",name:"Map"}),{merge:!0,shallow:!0,extend:!0});function Di(e,t={},n={}){n={...zi,...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 Ui(e){return Array.isArray(e)}function Vi(e){return e===document||e instanceof Element}function qi(e){return"object"==typeof e&&null!==e&&!Ui(e)&&"[object Object]"===Object.prototype.toString.call(e)}function Bi(e){return"string"==typeof e}function Ki(e){if("true"===e)return!0;if("false"===e)return!1;const t=Number(e);return e==t&&""!==e?t:String(e)}function Wi(e,t,n){return function(...a){try{return e(...a)}catch(e){if(!t)return;return t(e)}finally{null==n||n()}}}function Xi(e){return e?e.trim().replace(/^'|'$/g,"").trim():""}function Ji(e,t,n=!0){return e+(null!=t?(n?"-":"")+t:"")}function Hi(e,t,n,a=!0){return so(Xn(t,Ji(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),Ui(e[a])||(e[a]=[]),e[a].push(Ki(r))):e[a]=Ki(r),e},{})}function Yi(e=oa.Prefix,t=document){const n=Ji(e,oa.Globals,!1);let a={};return ro(t,`[${n}]`,t=>{a=Di(a,Hi(e,t,oa.Globals,!1))}),a}function Gi(e,t){const n=window.location,a="page",r=t===document?document.body:t,[s,i]=ao(r,`[${Ji(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=Xn(t,Ji(e));if(!r||a&&!a[r])return null;const s=[t],i=`[${Ji(e,r)}],[${Ji(e,"")}]`,o=Ji(e,oa.Link,!1);let c={};const u=[],[d,l]=ao(n||t,i,e,r);ro(t,`[${o}]`,t=>{const[n,a]=io(Xn(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=Di(m,Hi(e,t,"")),c=Di(c,Hi(e,t,r))}),c=Di(Di(m,c),d),s.forEach(t=>{ro(t,`[${Ji(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=Ji(e,oa.Link,!1);if(t.matches(`[${n}]`)){const[e,a]=io(Xn(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=`[${Ji(n,oa.Context,!1)}]`;let c=0;for(;i;)i.matches(t)&&(r=Di(Hi(n,i,""),r),r=Di(Hi(n,i,a),r)),i.matches(o)&&(Object.entries(Hi(n,i,oa.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[Xi(t),Xi(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:Yn(e),lastChecked:t},lo.set(e,n)),n.isVisible}function fo(e){if(window.IntersectionObserver)return Wi(()=>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(Bi(t)&&t.startsWith("walker "))return o(t,n);if(qi(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(qi(t)?t.name:t).split(" ");let d,l=qi(n)?n:{},p={},m=!1;if(Vi(n)&&(d=n,m=!0),Vi(r)?d=r:qi(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:Bi(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",Wi(function(t){Po.call(this,e,t)})),n.addEventListener("submit",Wi(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=Ji(t.prefix,oa.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=function(e,t,n=oa.Prefix){const a=[],{actions:r,nearestOnly:s}=function(e,t,n){let a=t;for(;a;){const t=Xn(a,Ji(e,oa.Actions,!1));if(t){const e=Qi(t);if(e[n])return{actions:e[n],nearestOnly:!1}}const r=Xn(a,Ji(e,oa.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[Xi(t)]=!0,e),{}),o=eo(n,e,i,s);if(!o.length){const t="page",a=`[${Ji(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}(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=Xn(t,n);r&&Object.values(Qi(r)).forEach(n=>n.forEach(n=>{switch(n.trigger){case bo:a=e,t.addEventListener("mouseenter",Wi(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=!qi(i)&&Bi(i)&&i.startsWith("walker ");if(qi(i)){if("object"==typeof i&&0===Object.keys(i).length)return}else{const e=Array.from(t);if(!Bi(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){Wi(()=>{if(Array.isArray(n)){const[a,...r]=n;if(!a||Bi(a)&&""===a.trim())return;if(Bi(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 Gn((r?na:aa)(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=()=>aa(e);return e.consent&&Ln((jn(e.consent)?e.consent:[e.consent]).reduce((e,t)=>({...e,[t]:!0}),{}),r)&&(s=()=>na(e)),Gn(s(),a,t)}}(e,t),s=(jn(n)?n:[n]).reduce((e,t)=>({...e,[t]:r}),{});a?a.command("on","consent",s):Hn("walker on","consent",s)}}({...t,collector:{push:e,group:void 0}})}_a({},{env:()=>Io});var Io={};_a(Io,{push:()=>Mo});var Ro=()=>{},Lo=()=>()=>Promise.resolve({ok:!0,successful:[],queued:[],failed:[]}),Mo={get push(){return Lo()},get command(){return Lo()},get elb(){return Lo()},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:Bi(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)}})(),Bi(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})}}}if(window&&document){const e=async()=>{let e;const t=document.querySelector("script[data-elbconfig]");if(t){const n=t.getAttribute("data-elbconfig")||"";n.includes(":")?e=Jn(n):n&&(e=window[n])}e||(e=window.elbConfig),e&&await async function(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 ya(n);return"undefined"!=typeof window&&(t.elb&&(window[t.elb]=a.elb),t.name&&(window[t.name]=a.collector)),a}(e)};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e()}})();