@jsfsi-core/ts-crossplatform 1.0.15 → 1.0.16

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.
Files changed (3) hide show
  1. package/dist/index.cjs +13 -11
  2. package/dist/index.mjs +746 -668
  3. package/package.json +4 -4
package/dist/index.cjs CHANGED
@@ -1,18 +1,20 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ke=(e={})=>e,Ye=e=>[e,void 0],qe=e=>[void 0,e];class Je{name;constructor(){this.name=this.constructor.name}}const Be=e=>n=>!(n instanceof e),Xe=e=>n=>n instanceof e,Qe=(e,n=process.env)=>{const t=e.safeParse(n);if(!t.success)throw new Error(`Invalid environment variables: ${JSON.stringify(t.error.issues)}`);return t.data};function We(e){return new Promise(n=>setTimeout(n,e))}function we(e,n){return new Date(e).toLocaleDateString(n,{year:"numeric",month:"2-digit",day:"2-digit"})}function ke(e,n){return new Date(e).toLocaleTimeString(n,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function He(e,n){return`${we(e,n)} ${ke(e,n)}`}const en="00000000-0000-0000-0000-000000000000",nn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function $e(e){return typeof e=="string"&&nn.test(e)}function tn(e){if(!$e(e))throw TypeError("Invalid UUID");let n;return Uint8Array.of((n=parseInt(e.slice(0,8),16))>>>24,n>>>16&255,n>>>8&255,n&255,(n=parseInt(e.slice(9,13),16))>>>8,n&255,(n=parseInt(e.slice(14,18),16))>>>8,n&255,(n=parseInt(e.slice(19,23),16))>>>8,n&255,(n=parseInt(e.slice(24,36),16))/1099511627776&255,n/4294967296&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255)}const z=[];for(let e=0;e<256;++e)z.push((e+256).toString(16).slice(1));function rn(e,n=0){return(z[e[n+0]]+z[e[n+1]]+z[e[n+2]]+z[e[n+3]]+"-"+z[e[n+4]]+z[e[n+5]]+"-"+z[e[n+6]]+z[e[n+7]]+"-"+z[e[n+8]]+z[e[n+9]]+"-"+z[e[n+10]]+z[e[n+11]]+z[e[n+12]]+z[e[n+13]]+z[e[n+14]]+z[e[n+15]]).toLowerCase()}let G;const on=new Uint8Array(16);function un(){if(!G){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");G=crypto.getRandomValues.bind(crypto)}return G(on)}const sn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ne={randomUUID:sn};function cn(e,n,t){if(ne.randomUUID&&!e)return ne.randomUUID();e=e||{};const r=e.random??e.rng?.()??un();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,rn(r)}class I{uuid;constructor(n){tn(n),this.uuid=n}toString(){return this.uuid}equals(n){return this.uuid===n.toString()}static new(){return new I(cn())}static empty(){return new I(en)}static isValid(n){return!!(n&&$e(n))}static parse(n){return n&&I.isValid(n)?new I(n):void 0}}function c(e,n,t){function r(s,a){var l;Object.defineProperty(s,"_zod",{value:s._zod??{},enumerable:!1}),(l=s._zod).traits??(l.traits=new Set),s._zod.traits.add(e),n(s,a);for(const b in i.prototype)b in s||Object.defineProperty(s,b,{value:i.prototype[b].bind(s)});s._zod.constr=i,s._zod.def=a}const o=t?.Parent??Object;class u extends o{}Object.defineProperty(u,"name",{value:e});function i(s){var a;const l=t?.Parent?new u:this;r(l,s),(a=l._zod).deferred??(a.deferred=[]);for(const b of l._zod.deferred)b();return l}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:s=>t?.Parent&&s instanceof t.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class S extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Ze={};function E(e){return Ze}function an(e){const n=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>n.indexOf(+r)===-1).map(([r,o])=>o)}function q(e,n){return typeof n=="bigint"?n.toString():n}function Pe(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function Q(e){return e==null}function W(e){const n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}function ln(e,n){const t=(e.toString().split(".")[1]||"").length,r=n.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const a=r.match(/\d?e-(\d?)/);a?.[1]&&(o=Number.parseInt(a[1]))}const u=t>o?t:o,i=Number.parseInt(e.toFixed(u).replace(".","")),s=Number.parseInt(n.toFixed(u).replace(".",""));return i%s/10**u}const te=Symbol("evaluating");function p(e,n,t){let r;Object.defineProperty(e,n,{get(){if(r!==te)return r===void 0&&(r=te,r=t()),r},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function fn(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function O(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function x(...e){const n={};for(const t of e){const r=Object.getOwnPropertyDescriptors(t);Object.assign(n,r)}return Object.defineProperties({},n)}function re(e){return JSON.stringify(e)}const Ee="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const pn=Pe(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function U(e){if(J(e)===!1)return!1;const n=e.constructor;if(n===void 0)return!0;const t=n.prototype;return!(J(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Te(e){return U(e)?{...e}:e}const hn=new Set(["string","number","symbol"]);function dn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function N(e,n,t){const r=new e._zod.constr(n??e._zod.def);return(!n||t?.parent)&&(r._zod.parent=e),r}function m(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function mn(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}const _n={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function gn(e,n){const t=e._zod.def,r=x(e._zod.def,{get shape(){const o={};for(const u in n){if(!(u in t.shape))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(o[u]=t.shape[u])}return O(this,"shape",o),o},checks:[]});return N(e,r)}function vn(e,n){const t=e._zod.def,r=x(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const u in n){if(!(u in t.shape))throw new Error(`Unrecognized key: "${u}"`);n[u]&&delete o[u]}return O(this,"shape",o),o},checks:[]});return N(e,r)}function zn(e,n){if(!U(n))throw new Error("Invalid input to extend: expected a plain object");const t=x(e._zod.def,{get shape(){const r={...e._zod.def.shape,...n};return O(this,"shape",r),r},checks:[]});return N(e,t)}function bn(e,n){const t=x(e._zod.def,{get shape(){const r={...e._zod.def.shape,...n._zod.def.shape};return O(this,"shape",r),r},get catchall(){return n._zod.def.catchall},checks:[]});return N(e,t)}function yn(e,n,t){const r=x(n._zod.def,{get shape(){const o=n._zod.def.shape,u={...o};if(t)for(const i in t){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(u[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)u[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return O(this,"shape",u),u},checks:[]});return N(n,r)}function wn(e,n,t){const r=x(n._zod.def,{get shape(){const o=n._zod.def.shape,u={...o};if(t)for(const i in t){if(!(i in u))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(u[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(const i in o)u[i]=new e({type:"nonoptional",innerType:o[i]});return O(this,"shape",u),u},checks:[]});return N(n,r)}function j(e,n=0){for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue!==!0)return!0;return!1}function Oe(e,n){return n.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function C(e){return typeof e=="string"?e:e?.message}function T(e,n,t){const r={...e,path:e.path??[]};if(!e.message){const o=C(e.inst?._zod.def?.error?.(e))??C(n?.error?.(e))??C(t.customError?.(e))??C(t.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,n?.reportInput||delete r.input,r}function H(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function A(...e){const[n,t,r]=e;return typeof n=="string"?{message:n,code:"custom",input:t,inst:r}:{...n}}const Ne=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,q,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ie=c("$ZodError",Ne),xe=c("$ZodError",Ne,{Parent:Error});function kn(e,n=t=>t.message){const t={},r=[];for(const o of e.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(n(o))):r.push(n(o));return{formErrors:r,fieldErrors:t}}function $n(e,n){const t=n||function(u){return u.message},r={_errors:[]},o=u=>{for(const i of u.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>o({issues:s}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(t(i));else{let s=r,a=0;for(;a<i.path.length;){const l=i.path[a];a===i.path.length-1?(s[l]=s[l]||{_errors:[]},s[l]._errors.push(t(i))):s[l]=s[l]||{_errors:[]},s=s[l],a++}}};return o(e),r}const Zn=e=>(n,t,r,o)=>{const u=r?Object.assign(r,{async:!1}):{async:!1},i=n._zod.run({value:t,issues:[]},u);if(i instanceof Promise)throw new S;if(i.issues.length){const s=new(o?.Err??e)(i.issues.map(a=>T(a,u,E())));throw Ee(s,o?.callee),s}return i.value},Pn=e=>async(n,t,r,o)=>{const u=r?Object.assign(r,{async:!0}):{async:!0};let i=n._zod.run({value:t,issues:[]},u);if(i instanceof Promise&&(i=await i),i.issues.length){const s=new(o?.Err??e)(i.issues.map(a=>T(a,u,E())));throw Ee(s,o?.callee),s}return i.value},je=e=>(n,t,r)=>{const o=r?{...r,async:!1}:{async:!1},u=n._zod.run({value:t,issues:[]},o);if(u instanceof Promise)throw new S;return u.issues.length?{success:!1,error:new(e??Ie)(u.issues.map(i=>T(i,o,E())))}:{success:!0,data:u.value}},En=je(xe),Se=e=>async(n,t,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let u=n._zod.run({value:t,issues:[]},o);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(i=>T(i,o,E())))}:{success:!0,data:u.value}},Tn=Se(xe),On=/^\d+$/,Nn=/^-?\d+(?:\.\d+)?/i,$=c("$ZodCheck",(e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])}),Ae={number:"number",bigint:"bigint",object:"date"},Re=c("$ZodCheckLessThan",(e,n)=>{$.init(e,n);const t=Ae[typeof n.value];e._zod.onattach.push(r=>{const o=r._zod.bag,u=(n.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;n.value<u&&(n.inclusive?o.maximum=n.value:o.exclusiveMaximum=n.value)}),e._zod.check=r=>{(n.inclusive?r.value<=n.value:r.value<n.value)||r.issues.push({origin:t,code:"too_big",maximum:n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Ce=c("$ZodCheckGreaterThan",(e,n)=>{$.init(e,n);const t=Ae[typeof n.value];e._zod.onattach.push(r=>{const o=r._zod.bag,u=(n.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;n.value>u&&(n.inclusive?o.minimum=n.value:o.exclusiveMinimum=n.value)}),e._zod.check=r=>{(n.inclusive?r.value>=n.value:r.value>n.value)||r.issues.push({origin:t,code:"too_small",minimum:n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),In=c("$ZodCheckMultipleOf",(e,n)=>{$.init(e,n),e._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=n.value)}),e._zod.check=t=>{if(typeof t.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%n.value===BigInt(0):ln(t.value,n.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}}),xn=c("$ZodCheckNumberFormat",(e,n)=>{$.init(e,n),n.format=n.format||"float64";const t=n.format?.includes("int"),r=t?"int":"number",[o,u]=_n[n.format];e._zod.onattach.push(i=>{const s=i._zod.bag;s.format=n.format,s.minimum=o,s.maximum=u,t&&(s.pattern=On)}),e._zod.check=i=>{const s=i.value;if(t){if(!Number.isInteger(s)){i.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?i.issues.push({input:s,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!n.abort}):i.issues.push({input:s,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!n.abort});return}}s<o&&i.issues.push({origin:"number",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!n.abort}),s>u&&i.issues.push({origin:"number",input:s,code:"too_big",maximum:u,inst:e})}}),jn=c("$ZodCheckMaxLength",(e,n)=>{var t;$.init(e,n),(t=e._zod.def).when??(t.when=r=>{const o=r.value;return!Q(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<o&&(r._zod.bag.maximum=n.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=n.maximum)return;const i=H(o);r.issues.push({origin:i,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Sn=c("$ZodCheckMinLength",(e,n)=>{var t;$.init(e,n),(t=e._zod.def).when??(t.when=r=>{const o=r.value;return!Q(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>o&&(r._zod.bag.minimum=n.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=n.minimum)return;const i=H(o);r.issues.push({origin:i,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),An=c("$ZodCheckLengthEquals",(e,n)=>{var t;$.init(e,n),(t=e._zod.def).when??(t.when=r=>{const o=r.value;return!Q(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=n.length,o.maximum=n.length,o.length=n.length}),e._zod.check=r=>{const o=r.value,u=o.length;if(u===n.length)return;const i=H(o),s=u>n.length;r.issues.push({origin:i,...s?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),Rn=c("$ZodCheckOverwrite",(e,n)=>{$.init(e,n),e._zod.check=t=>{t.value=n.tx(t.value)}});class Cn{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const r=n.split(`
2
- `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),u=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of u)this.content.push(i)}compile(){const n=Function,t=this?.args,o=[...(this?.content??[""]).map(u=>` ${u}`)];return new n(...t,o.join(`
3
- `))}}const Fn={major:4,minor:0,patch:17},_=c("$ZodType",(e,n)=>{var t;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Fn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const u of o._zod.onattach)u(e);if(r.length===0)(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(u,i,s)=>{let a=j(u),l;for(const b of i){if(b._zod.def.when){if(!b._zod.def.when(u))continue}else if(a)continue;const f=u.issues.length,h=b._zod.check(u);if(h instanceof Promise&&s?.async===!1)throw new S;if(l||h instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await h,u.issues.length!==f&&(a||(a=j(u,f)))});else{if(u.issues.length===f)continue;a||(a=j(u,f))}}return l?l.then(()=>u):u};e._zod.run=(u,i)=>{const s=e._zod.parse(u,i);if(s instanceof Promise){if(i.async===!1)throw new S;return s.then(a=>o(a,r,i))}return o(s,r,i)}}e["~standard"]={validate:o=>{try{const u=En(e,o);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return Tn(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),Fe=c("$ZodNumber",(e,n)=>{_.init(e,n),e._zod.pattern=e._zod.bag.pattern??Nn,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Number(t.value)}catch{}const o=t.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return t;const u=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...u?{received:u}:{}}),t}}),Mn=c("$ZodNumber",(e,n)=>{xn.init(e,n),Fe.init(e,n)}),Un=c("$ZodUnknown",(e,n)=>{_.init(e,n),e._zod.parse=t=>t}),Dn=c("$ZodNever",(e,n)=>{_.init(e,n),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function oe(e,n,t){e.issues.length&&n.issues.push(...Oe(t,e.issues)),n.value[t]=e.value}const Vn=c("$ZodArray",(e,n)=>{_.init(e,n),e._zod.parse=(t,r)=>{const o=t.value;if(!Array.isArray(o))return t.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),t;t.value=Array(o.length);const u=[];for(let i=0;i<o.length;i++){const s=o[i],a=n.element._zod.run({value:s,issues:[]},r);a instanceof Promise?u.push(a.then(l=>oe(l,t,i))):oe(a,t,i)}return u.length?Promise.all(u).then(()=>t):t}});function F(e,n,t,r){e.issues.length&&n.issues.push(...Oe(t,e.issues)),e.value===void 0?t in r&&(n.value[t]=void 0):n.value[t]=e.value}const Ln=c("$ZodObject",(e,n)=>{_.init(e,n);const t=Pe(()=>{const f=Object.keys(n.shape);for(const d of f)if(!n.shape[d]._zod.traits.has("$ZodType"))throw new Error(`Invalid element at key "${d}": expected a Zod schema`);const h=mn(n.shape);return{shape:n.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(h)}});p(e._zod,"propValues",()=>{const f=n.shape,h={};for(const d in f){const w=f[d]._zod;if(w.values){h[d]??(h[d]=new Set);for(const Z of w.values)h[d].add(Z)}}return h});const r=f=>{const h=new Cn(["shape","payload","ctx"]),d=t.value,w=k=>{const g=re(k);return`shape[${g}]._zod.run({ value: input[${g}], issues: [] }, ctx)`};h.write("const input = payload.value;");const Z=Object.create(null);let V=0;for(const k of d.keys)Z[k]=`key_${V++}`;h.write("const newResult = {}");for(const k of d.keys){const g=Z[k],y=re(k);h.write(`const ${g} = ${w(k)};`),h.write(`
4
- if (${g}.issues.length) {
5
- payload.issues = payload.issues.concat(${g}.issues.map(iss => ({
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const qe=(e={})=>e,Be=e=>[e,void 0],Xe=e=>[void 0,e];class We{name;constructor(){this.name=this.constructor.name}}const Qe=(e=>n=>!(n instanceof e)),He=(e=>n=>n instanceof e),en=(e,n=process.env)=>{const t=e.safeParse(n);if(!t.success)throw new Error(`Invalid environment variables: ${JSON.stringify(t.error.issues)}`);return t.data};function nn(e){return new Promise(n=>setTimeout(n,e))}function Ee(e,n){return new Date(e).toLocaleDateString(n,{year:"numeric",month:"2-digit",day:"2-digit"})}function $e(e,n){return new Date(e).toLocaleTimeString(n,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function tn(e,n){return`${Ee(e,n)} ${$e(e,n)}`}const rn="00000000-0000-0000-0000-000000000000",on=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Ze(e){return typeof e=="string"&&on.test(e)}function un(e){if(!Ze(e))throw TypeError("Invalid UUID");let n;return Uint8Array.of((n=parseInt(e.slice(0,8),16))>>>24,n>>>16&255,n>>>8&255,n&255,(n=parseInt(e.slice(9,13),16))>>>8,n&255,(n=parseInt(e.slice(14,18),16))>>>8,n&255,(n=parseInt(e.slice(19,23),16))>>>8,n&255,(n=parseInt(e.slice(24,36),16))/1099511627776&255,n/4294967296&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255)}const v=[];for(let e=0;e<256;++e)v.push((e+256).toString(16).slice(1));function sn(e,n=0){return(v[e[n+0]]+v[e[n+1]]+v[e[n+2]]+v[e[n+3]]+"-"+v[e[n+4]]+v[e[n+5]]+"-"+v[e[n+6]]+v[e[n+7]]+"-"+v[e[n+8]]+v[e[n+9]]+"-"+v[e[n+10]]+v[e[n+11]]+v[e[n+12]]+v[e[n+13]]+v[e[n+14]]+v[e[n+15]]).toLowerCase()}let J;const cn=new Uint8Array(16);function an(){if(!J){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");J=crypto.getRandomValues.bind(crypto)}return J(cn)}const ln=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),oe={randomUUID:ln};function fn(e,n,t){e=e||{};const r=e.random??e.rng?.()??an();if(r.length<16)throw new Error("Random bytes length must be >= 16");return r[6]=r[6]&15|64,r[8]=r[8]&63|128,sn(r)}function dn(e,n,t){return oe.randomUUID&&!e?oe.randomUUID():fn(e)}class N{uuid;constructor(n){un(n),this.uuid=n}toString(){return this.uuid}equals(n){return this.uuid===n.toString()}static new(){return new N(dn())}static empty(){return new N(rn)}static isValid(n){return!!(n&&Ze(n))}static parse(n){return n&&N.isValid(n)?new N(n):void 0}}function a(e,n,t){function r(i,c){var l;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(l=i._zod).traits??(l.traits=new Set),i._zod.traits.add(e),n(i,c);for(const f in u.prototype)f in i||Object.defineProperty(i,f,{value:u.prototype[f].bind(i)});i._zod.constr=u,i._zod.def=c}const o=t?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function u(i){var c;const l=t?.Parent?new s:this;r(l,i),(c=l._zod).deferred??(c.deferred=[]);for(const f of l._zod.deferred)f();return l}return Object.defineProperty(u,"init",{value:r}),Object.defineProperty(u,Symbol.hasInstance,{value:i=>t?.Parent&&i instanceof t.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class A extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Pe extends Error{constructor(n){super(`Encountered unidirectional transform during encode: ${n}`),this.name="ZodEncodeError"}}const Oe={};function P(e){return Oe}function hn(e){const n=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>n.indexOf(+r)===-1).map(([r,o])=>o)}function q(e,n){return typeof n=="bigint"?n.toString():n}function W(e){return{get value(){{const n=e();return Object.defineProperty(this,"value",{value:n}),n}}}}function Q(e){return e==null}function H(e){const n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}function pn(e,n){const t=(e.toString().split(".")[1]||"").length,r=n.toString();let o=(r.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(r)){const c=r.match(/\d?e-(\d?)/);c?.[1]&&(o=Number.parseInt(c[1]))}const s=t>o?t:o,u=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(n.toFixed(s).replace(".",""));return u%i/10**s}const ue=Symbol("evaluating");function d(e,n,t){let r;Object.defineProperty(e,n,{get(){if(r!==ue)return r===void 0&&(r=ue,r=t()),r},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function T(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function I(...e){const n={};for(const t of e){const r=Object.getOwnPropertyDescriptors(t);Object.assign(n,r)}return Object.defineProperties({},n)}function se(e){return JSON.stringify(e)}const Te="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function U(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const mn=W(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function x(e){if(U(e)===!1)return!1;const n=e.constructor;if(n===void 0)return!0;const t=n.prototype;return!(U(t)===!1||Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)}function Ie(e){return x(e)?{...e}:Array.isArray(e)?[...e]:e}const _n=new Set(["string","number","symbol"]);function gn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function $(e,n,t){const r=new e._zod.constr(n??e._zod.def);return(!n||t?.parent)&&(r._zod.parent=e),r}function p(e){const n=e;if(!n)return{};if(typeof n=="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");n.error=n.message}return delete n.message,typeof n.error=="string"?{...n,error:()=>n.error}:n}function vn(e){return Object.keys(e).filter(n=>e[n]._zod.optin==="optional"&&e[n]._zod.optout==="optional")}const zn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function bn(e,n){const t=e._zod.def,r=I(e._zod.def,{get shape(){const o={};for(const s in n){if(!(s in t.shape))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=t.shape[s])}return T(this,"shape",o),o},checks:[]});return $(e,r)}function wn(e,n){const t=e._zod.def,r=I(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const s in n){if(!(s in t.shape))throw new Error(`Unrecognized key: "${s}"`);n[s]&&delete o[s]}return T(this,"shape",o),o},checks:[]});return $(e,r)}function yn(e,n){if(!x(n))throw new Error("Invalid input to extend: expected a plain object");const t=e._zod.def.checks;if(t&&t.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const o=I(e._zod.def,{get shape(){const s={...e._zod.def.shape,...n};return T(this,"shape",s),s},checks:[]});return $(e,o)}function kn(e,n){if(!x(n))throw new Error("Invalid input to safeExtend: expected a plain object");const t={...e._zod.def,get shape(){const r={...e._zod.def.shape,...n};return T(this,"shape",r),r},checks:e._zod.def.checks};return $(e,t)}function En(e,n){const t=I(e._zod.def,{get shape(){const r={...e._zod.def.shape,...n._zod.def.shape};return T(this,"shape",r),r},get catchall(){return n._zod.def.catchall},checks:[]});return $(e,t)}function $n(e,n,t){const r=I(n._zod.def,{get shape(){const o=n._zod.def.shape,s={...o};if(t)for(const u in t){if(!(u in o))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(s[u]=e?new e({type:"optional",innerType:o[u]}):o[u])}else for(const u in o)s[u]=e?new e({type:"optional",innerType:o[u]}):o[u];return T(this,"shape",s),s},checks:[]});return $(n,r)}function Zn(e,n,t){const r=I(n._zod.def,{get shape(){const o=n._zod.def.shape,s={...o};if(t)for(const u in t){if(!(u in s))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(s[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)s[u]=new e({type:"nonoptional",innerType:o[u]});return T(this,"shape",s),s},checks:[]});return $(n,r)}function j(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue!==!0)return!0;return!1}function Ne(e,n){return n.map(t=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function C(e){return typeof e=="string"?e:e?.message}function O(e,n,t){const r={...e,path:e.path??[]};if(!e.message){const o=C(e.inst?._zod.def?.error?.(e))??C(n?.error?.(e))??C(t.customError?.(e))??C(t.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,n?.reportInput||delete r.input,r}function ee(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function R(...e){const[n,t,r]=e;return typeof n=="string"?{message:n,code:"custom",input:t,inst:r}:{...n}}const je=(e,n)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:n,enumerable:!1}),e.message=JSON.stringify(n,q,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ae=a("$ZodError",je),Se=a("$ZodError",je,{Parent:Error});function Pn(e,n=t=>t.message){const t={},r=[];for(const o of e.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(n(o))):r.push(n(o));return{formErrors:r,fieldErrors:t}}function On(e,n=t=>t.message){const t={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(u=>r({issues:u}));else if(s.code==="invalid_key")r({issues:s.issues});else if(s.code==="invalid_element")r({issues:s.issues});else if(s.path.length===0)t._errors.push(n(s));else{let u=t,i=0;for(;i<s.path.length;){const c=s.path[i];i===s.path.length-1?(u[c]=u[c]||{_errors:[]},u[c]._errors.push(n(s))):u[c]=u[c]||{_errors:[]},u=u[c],i++}}};return r(e),t}const ne=e=>(n,t,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},u=n._zod.run({value:t,issues:[]},s);if(u instanceof Promise)throw new A;if(u.issues.length){const i=new(o?.Err??e)(u.issues.map(c=>O(c,s,P())));throw Te(i,o?.callee),i}return u.value},te=e=>async(n,t,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let u=n._zod.run({value:t,issues:[]},s);if(u instanceof Promise&&(u=await u),u.issues.length){const i=new(o?.Err??e)(u.issues.map(c=>O(c,s,P())));throw Te(i,o?.callee),i}return u.value},V=e=>(n,t,r)=>{const o=r?{...r,async:!1}:{async:!1},s=n._zod.run({value:t,issues:[]},o);if(s instanceof Promise)throw new A;return s.issues.length?{success:!1,error:new(e??Ae)(s.issues.map(u=>O(u,o,P())))}:{success:!0,data:s.value}},Tn=V(Se),L=e=>async(n,t,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=n._zod.run({value:t,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(u=>O(u,o,P())))}:{success:!0,data:s.value}},In=L(Se),Nn=e=>(n,t,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return ne(e)(n,t,o)},jn=e=>(n,t,r)=>ne(e)(n,t,r),An=e=>async(n,t,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return te(e)(n,t,o)},Sn=e=>async(n,t,r)=>te(e)(n,t,r),xn=e=>(n,t,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return V(e)(n,t,o)},Rn=e=>(n,t,r)=>V(e)(n,t,r),Cn=e=>async(n,t,r)=>{const o=r?Object.assign(r,{direction:"backward"}):{direction:"backward"};return L(e)(n,t,o)},Dn=e=>async(n,t,r)=>L(e)(n,t,r),Fn=/^-?\d+$/,Un=/^-?\d+(?:\.\d+)?/,k=a("$ZodCheck",(e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])}),xe={number:"number",bigint:"bigint",object:"date"},Re=a("$ZodCheckLessThan",(e,n)=>{k.init(e,n);const t=xe[typeof n.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(n.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;n.value<s&&(n.inclusive?o.maximum=n.value:o.exclusiveMaximum=n.value)}),e._zod.check=r=>{(n.inclusive?r.value<=n.value:r.value<n.value)||r.issues.push({origin:t,code:"too_big",maximum:n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Ce=a("$ZodCheckGreaterThan",(e,n)=>{k.init(e,n);const t=xe[typeof n.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(n.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;n.value>s&&(n.inclusive?o.minimum=n.value:o.exclusiveMinimum=n.value)}),e._zod.check=r=>{(n.inclusive?r.value>=n.value:r.value>n.value)||r.issues.push({origin:t,code:"too_small",minimum:n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Mn=a("$ZodCheckMultipleOf",(e,n)=>{k.init(e,n),e._zod.onattach.push(t=>{var r;(r=t._zod.bag).multipleOf??(r.multipleOf=n.value)}),e._zod.check=t=>{if(typeof t.value!=typeof n.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof t.value=="bigint"?t.value%n.value===BigInt(0):pn(t.value,n.value)===0)||t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}}),Vn=a("$ZodCheckNumberFormat",(e,n)=>{k.init(e,n),n.format=n.format||"float64";const t=n.format?.includes("int"),r=t?"int":"number",[o,s]=zn[n.format];e._zod.onattach.push(u=>{const i=u._zod.bag;i.format=n.format,i.minimum=o,i.maximum=s,t&&(i.pattern=Fn)}),e._zod.check=u=>{const i=u.value;if(t){if(!Number.isInteger(i)){u.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:i,inst:e});return}if(!Number.isSafeInteger(i)){i>0?u.issues.push({input:i,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!n.abort}):u.issues.push({input:i,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!n.abort});return}}i<o&&u.issues.push({origin:"number",input:i,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!n.abort}),i>s&&u.issues.push({origin:"number",input:i,code:"too_big",maximum:s,inst:e})}}),Ln=a("$ZodCheckMaxLength",(e,n)=>{var t;k.init(e,n),(t=e._zod.def).when??(t.when=r=>{const o=r.value;return!Q(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;n.maximum<o&&(r._zod.bag.maximum=n.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=n.maximum)return;const u=ee(o);r.issues.push({origin:u,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Gn=a("$ZodCheckMinLength",(e,n)=>{var t;k.init(e,n),(t=e._zod.def).when??(t.when=r=>{const o=r.value;return!Q(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;n.minimum>o&&(r._zod.bag.minimum=n.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=n.minimum)return;const u=ee(o);r.issues.push({origin:u,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Jn=a("$ZodCheckLengthEquals",(e,n)=>{var t;k.init(e,n),(t=e._zod.def).when??(t.when=r=>{const o=r.value;return!Q(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=n.length,o.maximum=n.length,o.length=n.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===n.length)return;const u=ee(o),i=s>n.length;r.issues.push({origin:u,...i?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),Kn=a("$ZodCheckOverwrite",(e,n)=>{k.init(e,n),e._zod.check=t=>{t.value=n.tx(t.value)}});class Yn{constructor(n=[]){this.content=[],this.indent=0,this&&(this.args=n)}indented(n){this.indent+=1,n(this),this.indent-=1}write(n){if(typeof n=="function"){n(this,{execution:"sync"}),n(this,{execution:"async"});return}const r=n.split(`
2
+ `).filter(u=>u),o=Math.min(...r.map(u=>u.length-u.trimStart().length)),s=r.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(const u of s)this.content.push(u)}compile(){const n=Function,t=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new n(...t,o.join(`
3
+ `))}}const qn={major:4,minor:1,patch:12},m=a("$ZodType",(e,n)=>{var t;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=qn;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(u,i,c)=>{let l=j(u),f;for(const z of i){if(z._zod.def.when){if(!z._zod.def.when(u))continue}else if(l)continue;const h=u.issues.length,_=z._zod.check(u);if(_ instanceof Promise&&c?.async===!1)throw new A;if(f||_ instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await _,u.issues.length!==h&&(l||(l=j(u,h)))});else{if(u.issues.length===h)continue;l||(l=j(u,h))}}return f?f.then(()=>u):u},s=(u,i,c)=>{if(j(u))return u.aborted=!0,u;const l=o(i,r,c);if(l instanceof Promise){if(c.async===!1)throw new A;return l.then(f=>e._zod.parse(f,c))}return e._zod.parse(l,c)};e._zod.run=(u,i)=>{if(i.skipChecks)return e._zod.parse(u,i);if(i.direction==="backward"){const l=e._zod.parse({value:u.value,issues:[]},{...i,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,u,i)):s(l,u,i)}const c=e._zod.parse(u,i);if(c instanceof Promise){if(i.async===!1)throw new A;return c.then(l=>o(l,r,i))}return o(c,r,i)}}e["~standard"]={validate:o=>{try{const s=Tn(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return In(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}}),De=a("$ZodNumber",(e,n)=>{m.init(e,n),e._zod.pattern=e._zod.bag.pattern??Un,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Number(t.value)}catch{}const o=t.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return t;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return t.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),t}}),Bn=a("$ZodNumber",(e,n)=>{Vn.init(e,n),De.init(e,n)}),Xn=a("$ZodUnknown",(e,n)=>{m.init(e,n),e._zod.parse=t=>t}),Wn=a("$ZodNever",(e,n)=>{m.init(e,n),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function ie(e,n,t){e.issues.length&&n.issues.push(...Ne(t,e.issues)),n.value[t]=e.value}const Qn=a("$ZodArray",(e,n)=>{m.init(e,n),e._zod.parse=(t,r)=>{const o=t.value;if(!Array.isArray(o))return t.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),t;t.value=Array(o.length);const s=[];for(let u=0;u<o.length;u++){const i=o[u],c=n.element._zod.run({value:i,issues:[]},r);c instanceof Promise?s.push(c.then(l=>ie(l,t,u))):ie(c,t,u)}return s.length?Promise.all(s).then(()=>t):t}});function M(e,n,t,r){e.issues.length&&n.issues.push(...Ne(t,e.issues)),e.value===void 0?t in r&&(n.value[t]=void 0):n.value[t]=e.value}function Fe(e){const n=Object.keys(e.shape);for(const r of n)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);const t=vn(e.shape);return{...e,keys:n,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(t)}}function Ue(e,n,t,r,o,s){const u=[],i=o.keySet,c=o.catchall._zod,l=c.def.type;for(const f of Object.keys(n)){if(i.has(f))continue;if(l==="never"){u.push(f);continue}const z=c.run({value:n[f],issues:[]},r);z instanceof Promise?e.push(z.then(h=>M(h,t,f,n))):M(z,t,f,n)}return u.length&&t.issues.push({code:"unrecognized_keys",keys:u,input:n,inst:s}),e.length?Promise.all(e).then(()=>t):t}const Hn=a("$ZodObject",(e,n)=>{if(m.init(e,n),!Object.getOwnPropertyDescriptor(n,"shape")?.get){const i=n.shape;Object.defineProperty(n,"shape",{get:()=>{const c={...i};return Object.defineProperty(n,"shape",{value:c}),c}})}const r=W(()=>Fe(n));d(e._zod,"propValues",()=>{const i=n.shape,c={};for(const l in i){const f=i[l]._zod;if(f.values){c[l]??(c[l]=new Set);for(const z of f.values)c[l].add(z)}}return c});const o=U,s=n.catchall;let u;e._zod.parse=(i,c)=>{u??(u=r.value);const l=i.value;if(!o(l))return i.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),i;i.value={};const f=[],z=u.shape;for(const h of u.keys){const b=z[h]._zod.run({value:l[h],issues:[]},c);b instanceof Promise?f.push(b.then(G=>M(G,i,h,l))):M(b,i,h,l)}return s?Ue(f,l,i,c,r.value,e):f.length?Promise.all(f).then(()=>i):i}}),et=a("$ZodObjectJIT",(e,n)=>{Hn.init(e,n);const t=e._zod.parse,r=W(()=>Fe(n)),o=h=>{const _=new Yn(["shape","payload","ctx"]),b=r.value,G=E=>{const y=se(E);return`shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`};_.write("const input = payload.value;");const re=Object.create(null);let Ke=0;for(const E of b.keys)re[E]=`key_${Ke++}`;_.write("const newResult = {};");for(const E of b.keys){const y=re[E],S=se(E);_.write(`const ${y} = ${G(E)};`),_.write(`
4
+ if (${y}.issues.length) {
5
+ payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
6
6
  ...iss,
7
- path: iss.path ? [${y}, ...iss.path] : [${y}]
7
+ path: iss.path ? [${S}, ...iss.path] : [${S}]
8
8
  })));
9
9
  }
10
10
 
11
- if (${g}.value === undefined) {
12
- if (${y} in input) {
13
- newResult[${y}] = undefined;
11
+
12
+ if (${y}.value === undefined) {
13
+ if (${S} in input) {
14
+ newResult[${S}] = undefined;
14
15
  }
15
16
  } else {
16
- newResult[${y}] = ${g}.value;
17
+ newResult[${S}] = ${y}.value;
17
18
  }
18
- `)}h.write("payload.value = newResult;"),h.write("return payload;");const R=h.compile();return(k,g)=>R(f,k,g)};let o;const u=J,i=!Ze.jitless,a=i&&pn.value,l=n.catchall;let b;e._zod.parse=(f,h)=>{b??(b=t.value);const d=f.value;if(!u(d))return f.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),f;const w=[];if(i&&a&&h?.async===!1&&h.jitless!==!0)o||(o=r(n.shape)),f=o(f,h);else{f.value={};const g=b.shape;for(const y of b.keys){const L=g[y]._zod.run({value:d[y],issues:[]},h);L instanceof Promise?w.push(L.then(Ge=>F(Ge,f,y,d))):F(L,f,y,d)}}if(!l)return w.length?Promise.all(w).then(()=>f):f;const Z=[],V=b.keySet,R=l._zod,k=R.def.type;for(const g of Object.keys(d)){if(V.has(g))continue;if(k==="never"){Z.push(g);continue}const y=R.run({value:d[g],issues:[]},h);y instanceof Promise?w.push(y.then(ee=>F(ee,f,g,d))):F(y,f,g,d)}return Z.length&&f.issues.push({code:"unrecognized_keys",keys:Z,input:d,inst:e}),w.length?Promise.all(w).then(()=>f):f}});function ue(e,n,t,r){for(const u of e)if(u.issues.length===0)return n.value=u.value,n;const o=e.filter(u=>!j(u));return o.length===1?(n.value=o[0].value,o[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map(u=>u.issues.map(i=>T(i,r,E())))}),n)}const Gn=c("$ZodUnion",(e,n)=>{_.init(e,n),p(e._zod,"optin",()=>n.options.some(o=>o._zod.optin==="optional")?"optional":void 0),p(e._zod,"optout",()=>n.options.some(o=>o._zod.optout==="optional")?"optional":void 0),p(e._zod,"values",()=>{if(n.options.every(o=>o._zod.values))return new Set(n.options.flatMap(o=>Array.from(o._zod.values)))}),p(e._zod,"pattern",()=>{if(n.options.every(o=>o._zod.pattern)){const o=n.options.map(u=>u._zod.pattern);return new RegExp(`^(${o.map(u=>W(u.source)).join("|")})$`)}});const t=n.options.length===1,r=n.options[0]._zod.run;e._zod.parse=(o,u)=>{if(t)return r(o,u);let i=!1;const s=[];for(const a of n.options){const l=a._zod.run({value:o.value,issues:[]},u);if(l instanceof Promise)s.push(l),i=!0;else{if(l.issues.length===0)return l;s.push(l)}}return i?Promise.all(s).then(a=>ue(a,o,e,u)):ue(s,o,e,u)}}),Kn=c("$ZodIntersection",(e,n)=>{_.init(e,n),e._zod.parse=(t,r)=>{const o=t.value,u=n.left._zod.run({value:o,issues:[]},r),i=n.right._zod.run({value:o,issues:[]},r);return u instanceof Promise||i instanceof Promise?Promise.all([u,i]).then(([a,l])=>ie(t,a,l)):ie(t,u,i)}});function B(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(U(e)&&U(n)){const t=Object.keys(n),r=Object.keys(e).filter(u=>t.indexOf(u)!==-1),o={...e,...n};for(const u of r){const i=B(e[u],n[u]);if(!i.valid)return{valid:!1,mergeErrorPath:[u,...i.mergeErrorPath]};o[u]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<e.length;r++){const o=e[r],u=n[r],i=B(o,u);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};t.push(i.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function ie(e,n,t){if(n.issues.length&&e.issues.push(...n.issues),t.issues.length&&e.issues.push(...t.issues),j(e))return e;const r=B(n.value,t.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const Yn=c("$ZodEnum",(e,n)=>{_.init(e,n);const t=an(n.entries),r=new Set(t);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.filter(o=>hn.has(typeof o)).map(o=>typeof o=="string"?dn(o):o.toString()).join("|")})$`),e._zod.parse=(o,u)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:t,input:i,inst:e}),o}}),qn=c("$ZodTransform",(e,n)=>{_.init(e,n),e._zod.parse=(t,r)=>{const o=n.transform(t.value,t);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(t.value=i,t));if(o instanceof Promise)throw new S;return t.value=o,t}});function se(e,n){return e.issues.length&&n===void 0?{issues:[],value:void 0}:e}const Jn=c("$ZodOptional",(e,n)=>{_.init(e,n),e._zod.optin="optional",e._zod.optout="optional",p(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),p(e._zod,"pattern",()=>{const t=n.innerType._zod.pattern;return t?new RegExp(`^(${W(t.source)})?$`):void 0}),e._zod.parse=(t,r)=>{if(n.innerType._zod.optin==="optional"){const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(u=>se(u,t.value)):se(o,t.value)}return t.value===void 0?t:n.innerType._zod.run(t,r)}}),Bn=c("$ZodNullable",(e,n)=>{_.init(e,n),p(e._zod,"optin",()=>n.innerType._zod.optin),p(e._zod,"optout",()=>n.innerType._zod.optout),p(e._zod,"pattern",()=>{const t=n.innerType._zod.pattern;return t?new RegExp(`^(${W(t.source)}|null)$`):void 0}),p(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(t,r)=>t.value===null?t:n.innerType._zod.run(t,r)}),Xn=c("$ZodDefault",(e,n)=>{_.init(e,n),e._zod.optin="optional",p(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(t,r)=>{if(t.value===void 0)return t.value=n.defaultValue,t;const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(u=>ce(u,n)):ce(o,n)}});function ce(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const Qn=c("$ZodPrefault",(e,n)=>{_.init(e,n),e._zod.optin="optional",p(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(t,r)=>(t.value===void 0&&(t.value=n.defaultValue),n.innerType._zod.run(t,r))}),Wn=c("$ZodNonOptional",(e,n)=>{_.init(e,n),p(e._zod,"values",()=>{const t=n.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),e._zod.parse=(t,r)=>{const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(u=>ae(u,e)):ae(o,e)}});function ae(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const Hn=c("$ZodCatch",(e,n)=>{_.init(e,n),p(e._zod,"optin",()=>n.innerType._zod.optin),p(e._zod,"optout",()=>n.innerType._zod.optout),p(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(t,r)=>{const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(u=>(t.value=u.value,u.issues.length&&(t.value=n.catchValue({...t,error:{issues:u.issues.map(i=>T(i,r,E()))},input:t.value}),t.issues=[]),t)):(t.value=o.value,o.issues.length&&(t.value=n.catchValue({...t,error:{issues:o.issues.map(u=>T(u,r,E()))},input:t.value}),t.issues=[]),t)}}),et=c("$ZodPipe",(e,n)=>{_.init(e,n),p(e._zod,"values",()=>n.in._zod.values),p(e._zod,"optin",()=>n.in._zod.optin),p(e._zod,"optout",()=>n.out._zod.optout),p(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(t,r)=>{const o=n.in._zod.run(t,r);return o instanceof Promise?o.then(u=>le(u,n,r)):le(o,n,r)}});function le(e,n,t){return e.issues.length?e:n.out._zod.run({value:e.value,issues:e.issues},t)}const nt=c("$ZodReadonly",(e,n)=>{_.init(e,n),p(e._zod,"propValues",()=>n.innerType._zod.propValues),p(e._zod,"values",()=>n.innerType._zod.values),p(e._zod,"optin",()=>n.innerType._zod.optin),p(e._zod,"optout",()=>n.innerType._zod.optout),e._zod.parse=(t,r)=>{const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(fe):fe(o)}});function fe(e){return e.value=Object.freeze(e.value),e}const tt=c("$ZodCustom",(e,n)=>{$.init(e,n),_.init(e,n),e._zod.parse=(t,r)=>t,e._zod.check=t=>{const r=t.value,o=n.fn(r);if(o instanceof Promise)return o.then(u=>pe(u,t,r,e));pe(o,t,r,e)}});function pe(e,n,t,r){if(!e){const o={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),n.issues.push(A(o))}}class rt{constructor(){this._map=new Map,this._idmap=new Map}add(n,...t){const r=t[0];if(this._map.set(n,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,n)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(n){const t=this._map.get(n);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(n),this}get(n){const t=n._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const o={...r,...this._map.get(n)};return Object.keys(o).length?o:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function ot(){return new rt}const M=ot();function ut(e,n){return new e({type:"number",checks:[],...m(n)})}function it(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...m(n)})}function st(e){return new e({type:"unknown"})}function ct(e,n){return new e({type:"never",...m(n)})}function he(e,n){return new Re({check:"less_than",...m(n),value:e,inclusive:!1})}function K(e,n){return new Re({check:"less_than",...m(n),value:e,inclusive:!0})}function de(e,n){return new Ce({check:"greater_than",...m(n),value:e,inclusive:!1})}function Y(e,n){return new Ce({check:"greater_than",...m(n),value:e,inclusive:!0})}function me(e,n){return new In({check:"multiple_of",...m(n),value:e})}function at(e,n){return new jn({check:"max_length",...m(n),maximum:e})}function _e(e,n){return new Sn({check:"min_length",...m(n),minimum:e})}function lt(e,n){return new An({check:"length_equals",...m(n),length:e})}function ft(e){return new Rn({check:"overwrite",tx:e})}function pt(e,n,t){return new e({type:"array",element:n,...m(t)})}function ht(e,n,t){return new e({type:"custom",check:"custom",fn:n,...m(t)})}function dt(e){const n=mt(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(A(r,t.value,n._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push(A(o))}},e(t.value,t)));return n}function mt(e,n){const t=new $({check:"custom",...m(n)});return t._zod.check=e,t}const _t=(e,n)=>{Ie.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>$n(e,t)},flatten:{value:t=>kn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,q,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,q,2)}},isEmpty:{get(){return e.issues.length===0}}})},D=c("ZodError",_t,{Parent:Error}),gt=Zn(D),vt=Pn(D),zt=je(D),bt=Se(D),v=c("ZodType",(e,n)=>(_.init(e,n),e.def=n,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone({...n,checks:[...n.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(t,r)=>N(e,t,r),e.brand=()=>e,e.register=(t,r)=>(t.add(e,r),e),e.parse=(t,r)=>gt(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>zt(e,t,r),e.parseAsync=async(t,r)=>vt(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>bt(e,t,r),e.spa=e.safeParseAsync,e.refine=(t,r)=>e.check(Yt(t,r)),e.superRefine=t=>e.check(qt(t)),e.overwrite=t=>e.check(ft(t)),e.optional=()=>ze(e),e.nullable=()=>be(e),e.nullish=()=>ze(be(e)),e.nonoptional=t=>Mt(e,t),e.array=()=>Ue(e),e.or=t=>Tt([e,t]),e.and=t=>Nt(e,t),e.transform=t=>ye(e,jt(t)),e.default=t=>Rt(e,t),e.prefault=t=>Ft(e,t),e.catch=t=>Dt(e,t),e.pipe=t=>ye(e,t),e.readonly=()=>Gt(e),e.describe=t=>{const r=e.clone();return M.add(r,{description:t}),r},Object.defineProperty(e,"description",{get(){return M.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return M.get(e);const r=e.clone();return M.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Me=c("ZodNumber",(e,n)=>{Fe.init(e,n),v.init(e,n),e.gt=(r,o)=>e.check(de(r,o)),e.gte=(r,o)=>e.check(Y(r,o)),e.min=(r,o)=>e.check(Y(r,o)),e.lt=(r,o)=>e.check(he(r,o)),e.lte=(r,o)=>e.check(K(r,o)),e.max=(r,o)=>e.check(K(r,o)),e.int=r=>e.check(ge(r)),e.safe=r=>e.check(ge(r)),e.positive=r=>e.check(de(0,r)),e.nonnegative=r=>e.check(Y(0,r)),e.negative=r=>e.check(he(0,r)),e.nonpositive=r=>e.check(K(0,r)),e.multipleOf=(r,o)=>e.check(me(r,o)),e.step=(r,o)=>e.check(me(r,o)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null});function P(e){return ut(Me,e)}const yt=c("ZodNumberFormat",(e,n)=>{Mn.init(e,n),Me.init(e,n)});function ge(e){return it(yt,e)}const wt=c("ZodUnknown",(e,n)=>{Un.init(e,n),v.init(e,n)});function ve(){return st(wt)}const kt=c("ZodNever",(e,n)=>{Dn.init(e,n),v.init(e,n)});function $t(e){return ct(kt,e)}const Zt=c("ZodArray",(e,n)=>{Vn.init(e,n),v.init(e,n),e.element=n.element,e.min=(t,r)=>e.check(_e(t,r)),e.nonempty=t=>e.check(_e(1,t)),e.max=(t,r)=>e.check(at(t,r)),e.length=(t,r)=>e.check(lt(t,r)),e.unwrap=()=>e.element});function Ue(e,n){return pt(Zt,e,n)}const Pt=c("ZodObject",(e,n)=>{Ln.init(e,n),v.init(e,n),p(e,"shape",()=>n.shape),e.keyof=()=>It(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ve()}),e.loose=()=>e.clone({...e._zod.def,catchall:ve()}),e.strict=()=>e.clone({...e._zod.def,catchall:$t()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>zn(e,t),e.merge=t=>bn(e,t),e.pick=t=>gn(e,t),e.omit=t=>vn(e,t),e.partial=(...t)=>yn(Ve,e,t[0]),e.required=(...t)=>wn(Le,e,t[0])});function De(e,n){const t={type:"object",get shape(){return O(this,"shape",e?fn(e):{}),this.shape},...m(n)};return new Pt(t)}const Et=c("ZodUnion",(e,n)=>{Gn.init(e,n),v.init(e,n),e.options=n.options});function Tt(e,n){return new Et({type:"union",options:e,...m(n)})}const Ot=c("ZodIntersection",(e,n)=>{Kn.init(e,n),v.init(e,n)});function Nt(e,n){return new Ot({type:"intersection",left:e,right:n})}const X=c("ZodEnum",(e,n)=>{Yn.init(e,n),v.init(e,n),e.enum=n.entries,e.options=Object.values(n.entries);const t=new Set(Object.keys(n.entries));e.extract=(r,o)=>{const u={};for(const i of r)if(t.has(i))u[i]=n.entries[i];else throw new Error(`Key ${i} not found in enum`);return new X({...n,checks:[],...m(o),entries:u})},e.exclude=(r,o)=>{const u={...n.entries};for(const i of r)if(t.has(i))delete u[i];else throw new Error(`Key ${i} not found in enum`);return new X({...n,checks:[],...m(o),entries:u})}});function It(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new X({type:"enum",entries:t,...m(n)})}const xt=c("ZodTransform",(e,n)=>{qn.init(e,n),v.init(e,n),e._zod.parse=(t,r)=>{t.addIssue=u=>{if(typeof u=="string")t.issues.push(A(u,t.value,n));else{const i=u;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=t.value),i.inst??(i.inst=e),t.issues.push(A(i))}};const o=n.transform(t.value,t);return o instanceof Promise?o.then(u=>(t.value=u,t)):(t.value=o,t)}});function jt(e){return new xt({type:"transform",transform:e})}const Ve=c("ZodOptional",(e,n)=>{Jn.init(e,n),v.init(e,n),e.unwrap=()=>e._zod.def.innerType});function ze(e){return new Ve({type:"optional",innerType:e})}const St=c("ZodNullable",(e,n)=>{Bn.init(e,n),v.init(e,n),e.unwrap=()=>e._zod.def.innerType});function be(e){return new St({type:"nullable",innerType:e})}const At=c("ZodDefault",(e,n)=>{Xn.init(e,n),v.init(e,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Rt(e,n){return new At({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():Te(n)}})}const Ct=c("ZodPrefault",(e,n)=>{Qn.init(e,n),v.init(e,n),e.unwrap=()=>e._zod.def.innerType});function Ft(e,n){return new Ct({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():Te(n)}})}const Le=c("ZodNonOptional",(e,n)=>{Wn.init(e,n),v.init(e,n),e.unwrap=()=>e._zod.def.innerType});function Mt(e,n){return new Le({type:"nonoptional",innerType:e,...m(n)})}const Ut=c("ZodCatch",(e,n)=>{Hn.init(e,n),v.init(e,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Dt(e,n){return new Ut({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const Vt=c("ZodPipe",(e,n)=>{et.init(e,n),v.init(e,n),e.in=n.in,e.out=n.out});function ye(e,n){return new Vt({type:"pipe",in:e,out:n})}const Lt=c("ZodReadonly",(e,n)=>{nt.init(e,n),v.init(e,n),e.unwrap=()=>e._zod.def.innerType});function Gt(e){return new Lt({type:"readonly",innerType:e})}const Kt=c("ZodCustom",(e,n)=>{tt.init(e,n),v.init(e,n)});function Yt(e,n={}){return ht(Kt,e,n)}function qt(e){return dt(e)}const Jt=e=>De({pages:P(),nextPage:P().optional(),totalElements:P(),currentPage:P(),pageSize:P(),elements:Ue(e)}),Bt=De({page:P(),pageSize:P()});exports.Fail=qe;exports.Failure=Je;exports.Guid=I;exports.Ok=Ye;exports.PageQuery=Bt;exports.createPageSchema=Jt;exports.formatDate=we;exports.formatDateTime=He;exports.formatTime=ke;exports.isFailure=Xe;exports.mock=Ke;exports.notFailure=Be;exports.parseConfig=Qe;exports.sleep=We;
19
+
20
+ `)}_.write("payload.value = newResult;"),_.write("return payload;");const Ye=_.compile();return(E,y)=>Ye(h,E,y)};let s;const u=U,i=!Oe.jitless,l=i&&mn.value,f=n.catchall;let z;e._zod.parse=(h,_)=>{z??(z=r.value);const b=h.value;return u(b)?i&&l&&_?.async===!1&&_.jitless!==!0?(s||(s=o(n.shape)),h=s(h,_),f?Ue([],b,h,_,z,e):h):t(h,_):(h.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),h)}});function ce(e,n,t,r){for(const s of e)if(s.issues.length===0)return n.value=s.value,n;const o=e.filter(s=>!j(s));return o.length===1?(n.value=o[0].value,o[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map(s=>s.issues.map(u=>O(u,r,P())))}),n)}const nt=a("$ZodUnion",(e,n)=>{m.init(e,n),d(e._zod,"optin",()=>n.options.some(o=>o._zod.optin==="optional")?"optional":void 0),d(e._zod,"optout",()=>n.options.some(o=>o._zod.optout==="optional")?"optional":void 0),d(e._zod,"values",()=>{if(n.options.every(o=>o._zod.values))return new Set(n.options.flatMap(o=>Array.from(o._zod.values)))}),d(e._zod,"pattern",()=>{if(n.options.every(o=>o._zod.pattern)){const o=n.options.map(s=>s._zod.pattern);return new RegExp(`^(${o.map(s=>H(s.source)).join("|")})$`)}});const t=n.options.length===1,r=n.options[0]._zod.run;e._zod.parse=(o,s)=>{if(t)return r(o,s);let u=!1;const i=[];for(const c of n.options){const l=c._zod.run({value:o.value,issues:[]},s);if(l instanceof Promise)i.push(l),u=!0;else{if(l.issues.length===0)return l;i.push(l)}}return u?Promise.all(i).then(c=>ce(c,o,e,s)):ce(i,o,e,s)}}),tt=a("$ZodIntersection",(e,n)=>{m.init(e,n),e._zod.parse=(t,r)=>{const o=t.value,s=n.left._zod.run({value:o,issues:[]},r),u=n.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||u instanceof Promise?Promise.all([s,u]).then(([c,l])=>ae(t,c,l)):ae(t,s,u)}});function B(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(x(e)&&x(n)){const t=Object.keys(n),r=Object.keys(e).filter(s=>t.indexOf(s)!==-1),o={...e,...n};for(const s of r){const u=B(e[s],n[s]);if(!u.valid)return{valid:!1,mergeErrorPath:[s,...u.mergeErrorPath]};o[s]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const t=[];for(let r=0;r<e.length;r++){const o=e[r],s=n[r],u=B(o,s);if(!u.valid)return{valid:!1,mergeErrorPath:[r,...u.mergeErrorPath]};t.push(u.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function ae(e,n,t){if(n.issues.length&&e.issues.push(...n.issues),t.issues.length&&e.issues.push(...t.issues),j(e))return e;const r=B(n.value,t.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const rt=a("$ZodEnum",(e,n)=>{m.init(e,n);const t=hn(n.entries),r=new Set(t);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.filter(o=>_n.has(typeof o)).map(o=>typeof o=="string"?gn(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const u=o.value;return r.has(u)||o.issues.push({code:"invalid_value",values:t,input:u,inst:e}),o}}),ot=a("$ZodTransform",(e,n)=>{m.init(e,n),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new Pe(e.constructor.name);const o=n.transform(t.value,t);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(t.value=u,t));if(o instanceof Promise)throw new A;return t.value=o,t}});function le(e,n){return e.issues.length&&n===void 0?{issues:[],value:void 0}:e}const ut=a("$ZodOptional",(e,n)=>{m.init(e,n),e._zod.optin="optional",e._zod.optout="optional",d(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),d(e._zod,"pattern",()=>{const t=n.innerType._zod.pattern;return t?new RegExp(`^(${H(t.source)})?$`):void 0}),e._zod.parse=(t,r)=>{if(n.innerType._zod.optin==="optional"){const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(s=>le(s,t.value)):le(o,t.value)}return t.value===void 0?t:n.innerType._zod.run(t,r)}}),st=a("$ZodNullable",(e,n)=>{m.init(e,n),d(e._zod,"optin",()=>n.innerType._zod.optin),d(e._zod,"optout",()=>n.innerType._zod.optout),d(e._zod,"pattern",()=>{const t=n.innerType._zod.pattern;return t?new RegExp(`^(${H(t.source)}|null)$`):void 0}),d(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(t,r)=>t.value===null?t:n.innerType._zod.run(t,r)}),it=a("$ZodDefault",(e,n)=>{m.init(e,n),e._zod.optin="optional",d(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)return t.value=n.defaultValue,t;const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(s=>fe(s,n)):fe(o,n)}});function fe(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const ct=a("$ZodPrefault",(e,n)=>{m.init(e,n),e._zod.optin="optional",d(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(t,r)=>(r.direction==="backward"||t.value===void 0&&(t.value=n.defaultValue),n.innerType._zod.run(t,r))}),at=a("$ZodNonOptional",(e,n)=>{m.init(e,n),d(e._zod,"values",()=>{const t=n.innerType._zod.values;return t?new Set([...t].filter(r=>r!==void 0)):void 0}),e._zod.parse=(t,r)=>{const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(s=>de(s,e)):de(o,e)}});function de(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const lt=a("$ZodCatch",(e,n)=>{m.init(e,n),d(e._zod,"optin",()=>n.innerType._zod.optin),d(e._zod,"optout",()=>n.innerType._zod.optout),d(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(s=>(t.value=s.value,s.issues.length&&(t.value=n.catchValue({...t,error:{issues:s.issues.map(u=>O(u,r,P()))},input:t.value}),t.issues=[]),t)):(t.value=o.value,o.issues.length&&(t.value=n.catchValue({...t,error:{issues:o.issues.map(s=>O(s,r,P()))},input:t.value}),t.issues=[]),t)}}),ft=a("$ZodPipe",(e,n)=>{m.init(e,n),d(e._zod,"values",()=>n.in._zod.values),d(e._zod,"optin",()=>n.in._zod.optin),d(e._zod,"optout",()=>n.out._zod.optout),d(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(t,r)=>{if(r.direction==="backward"){const s=n.out._zod.run(t,r);return s instanceof Promise?s.then(u=>D(u,n.in,r)):D(s,n.in,r)}const o=n.in._zod.run(t,r);return o instanceof Promise?o.then(s=>D(s,n.out,r)):D(o,n.out,r)}});function D(e,n,t){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues},t)}const dt=a("$ZodReadonly",(e,n)=>{m.init(e,n),d(e._zod,"propValues",()=>n.innerType._zod.propValues),d(e._zod,"values",()=>n.innerType._zod.values),d(e._zod,"optin",()=>n.innerType._zod.optin),d(e._zod,"optout",()=>n.innerType._zod.optout),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);const o=n.innerType._zod.run(t,r);return o instanceof Promise?o.then(he):he(o)}});function he(e){return e.value=Object.freeze(e.value),e}const ht=a("$ZodCustom",(e,n)=>{k.init(e,n),m.init(e,n),e._zod.parse=(t,r)=>t,e._zod.check=t=>{const r=t.value,o=n.fn(r);if(o instanceof Promise)return o.then(s=>pe(s,t,r,e));pe(o,t,r,e)}});function pe(e,n,t,r){if(!e){const o={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),n.issues.push(R(o))}}class pt{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...t){const r=t[0];if(this._map.set(n,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,n)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const t=this._map.get(n);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(n),this}get(n){const t=n._zod.parent;if(t){const r={...this.get(t)??{}};delete r.id;const o={...r,...this._map.get(n)};return Object.keys(o).length?o:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function mt(){return new pt}const F=mt();function _t(e,n){return new e({type:"number",checks:[],...p(n)})}function gt(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...p(n)})}function vt(e){return new e({type:"unknown"})}function zt(e,n){return new e({type:"never",...p(n)})}function me(e,n){return new Re({check:"less_than",...p(n),value:e,inclusive:!1})}function K(e,n){return new Re({check:"less_than",...p(n),value:e,inclusive:!0})}function _e(e,n){return new Ce({check:"greater_than",...p(n),value:e,inclusive:!1})}function Y(e,n){return new Ce({check:"greater_than",...p(n),value:e,inclusive:!0})}function ge(e,n){return new Mn({check:"multiple_of",...p(n),value:e})}function bt(e,n){return new Ln({check:"max_length",...p(n),maximum:e})}function ve(e,n){return new Gn({check:"min_length",...p(n),minimum:e})}function wt(e,n){return new Jn({check:"length_equals",...p(n),length:e})}function yt(e){return new Kn({check:"overwrite",tx:e})}function kt(e,n,t){return new e({type:"array",element:n,...p(t)})}function Et(e,n,t){return new e({type:"custom",check:"custom",fn:n,...p(t)})}function $t(e){const n=Zt(t=>(t.addIssue=r=>{if(typeof r=="string")t.issues.push(R(r,t.value,n._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=t.value),o.inst??(o.inst=n),o.continue??(o.continue=!n._zod.def.abort),t.issues.push(R(o))}},e(t.value,t)));return n}function Zt(e,n){const t=new k({check:"custom",...p(n)});return t._zod.check=e,t}const Pt=(e,n)=>{Ae.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>On(e,t)},flatten:{value:t=>Pn(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,q,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,q,2)}},isEmpty:{get(){return e.issues.length===0}}})},w=a("ZodError",Pt,{Parent:Error}),Ot=ne(w),Tt=te(w),It=V(w),Nt=L(w),jt=Nn(w),At=jn(w),St=An(w),xt=Sn(w),Rt=xn(w),Ct=Rn(w),Dt=Cn(w),Ft=Dn(w),g=a("ZodType",(e,n)=>(m.init(e,n),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.check=(...t)=>e.clone(I(n,{checks:[...n.checks??[],...t.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]})),e.clone=(t,r)=>$(e,t,r),e.brand=()=>e,e.register=((t,r)=>(t.add(e,r),e)),e.parse=(t,r)=>Ot(e,t,r,{callee:e.parse}),e.safeParse=(t,r)=>It(e,t,r),e.parseAsync=async(t,r)=>Tt(e,t,r,{callee:e.parseAsync}),e.safeParseAsync=async(t,r)=>Nt(e,t,r),e.spa=e.safeParseAsync,e.encode=(t,r)=>jt(e,t,r),e.decode=(t,r)=>At(e,t,r),e.encodeAsync=async(t,r)=>St(e,t,r),e.decodeAsync=async(t,r)=>xt(e,t,r),e.safeEncode=(t,r)=>Rt(e,t,r),e.safeDecode=(t,r)=>Ct(e,t,r),e.safeEncodeAsync=async(t,r)=>Dt(e,t,r),e.safeDecodeAsync=async(t,r)=>Ft(e,t,r),e.refine=(t,r)=>e.check(fr(t,r)),e.superRefine=t=>e.check(dr(t)),e.overwrite=t=>e.check(yt(t)),e.optional=()=>we(e),e.nullable=()=>ye(e),e.nullish=()=>we(ye(e)),e.nonoptional=t=>or(e,t),e.array=()=>Ve(e),e.or=t=>Yt([e,t]),e.and=t=>Bt(e,t),e.transform=t=>ke(e,Qt(t)),e.default=t=>nr(e,t),e.prefault=t=>rr(e,t),e.catch=t=>sr(e,t),e.pipe=t=>ke(e,t),e.readonly=()=>ar(e),e.describe=t=>{const r=e.clone();return F.add(r,{description:t}),r},Object.defineProperty(e,"description",{get(){return F.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return F.get(e);const r=e.clone();return F.add(r,t[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Me=a("ZodNumber",(e,n)=>{De.init(e,n),g.init(e,n),e.gt=(r,o)=>e.check(_e(r,o)),e.gte=(r,o)=>e.check(Y(r,o)),e.min=(r,o)=>e.check(Y(r,o)),e.lt=(r,o)=>e.check(me(r,o)),e.lte=(r,o)=>e.check(K(r,o)),e.max=(r,o)=>e.check(K(r,o)),e.int=r=>e.check(ze(r)),e.safe=r=>e.check(ze(r)),e.positive=r=>e.check(_e(0,r)),e.nonnegative=r=>e.check(Y(0,r)),e.negative=r=>e.check(me(0,r)),e.nonpositive=r=>e.check(K(0,r)),e.multipleOf=(r,o)=>e.check(ge(r,o)),e.step=(r,o)=>e.check(ge(r,o)),e.finite=()=>e;const t=e._zod.bag;e.minValue=Math.max(t.minimum??Number.NEGATIVE_INFINITY,t.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(t.maximum??Number.POSITIVE_INFINITY,t.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(t.format??"").includes("int")||Number.isSafeInteger(t.multipleOf??.5),e.isFinite=!0,e.format=t.format??null});function Z(e){return _t(Me,e)}const Ut=a("ZodNumberFormat",(e,n)=>{Bn.init(e,n),Me.init(e,n)});function ze(e){return gt(Ut,e)}const Mt=a("ZodUnknown",(e,n)=>{Xn.init(e,n),g.init(e,n)});function be(){return vt(Mt)}const Vt=a("ZodNever",(e,n)=>{Wn.init(e,n),g.init(e,n)});function Lt(e){return zt(Vt,e)}const Gt=a("ZodArray",(e,n)=>{Qn.init(e,n),g.init(e,n),e.element=n.element,e.min=(t,r)=>e.check(ve(t,r)),e.nonempty=t=>e.check(ve(1,t)),e.max=(t,r)=>e.check(bt(t,r)),e.length=(t,r)=>e.check(wt(t,r)),e.unwrap=()=>e.element});function Ve(e,n){return kt(Gt,e,n)}const Jt=a("ZodObject",(e,n)=>{et.init(e,n),g.init(e,n),d(e,"shape",()=>n.shape),e.keyof=()=>Xt(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:be()}),e.loose=()=>e.clone({...e._zod.def,catchall:be()}),e.strict=()=>e.clone({...e._zod.def,catchall:Lt()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>yn(e,t),e.safeExtend=t=>kn(e,t),e.merge=t=>En(e,t),e.pick=t=>bn(e,t),e.omit=t=>wn(e,t),e.partial=(...t)=>$n(Ge,e,t[0]),e.required=(...t)=>Zn(Je,e,t[0])});function Le(e,n){const t={type:"object",shape:e??{},...p(n)};return new Jt(t)}const Kt=a("ZodUnion",(e,n)=>{nt.init(e,n),g.init(e,n),e.options=n.options});function Yt(e,n){return new Kt({type:"union",options:e,...p(n)})}const qt=a("ZodIntersection",(e,n)=>{tt.init(e,n),g.init(e,n)});function Bt(e,n){return new qt({type:"intersection",left:e,right:n})}const X=a("ZodEnum",(e,n)=>{rt.init(e,n),g.init(e,n),e.enum=n.entries,e.options=Object.values(n.entries);const t=new Set(Object.keys(n.entries));e.extract=(r,o)=>{const s={};for(const u of r)if(t.has(u))s[u]=n.entries[u];else throw new Error(`Key ${u} not found in enum`);return new X({...n,checks:[],...p(o),entries:s})},e.exclude=(r,o)=>{const s={...n.entries};for(const u of r)if(t.has(u))delete s[u];else throw new Error(`Key ${u} not found in enum`);return new X({...n,checks:[],...p(o),entries:s})}});function Xt(e,n){const t=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new X({type:"enum",entries:t,...p(n)})}const Wt=a("ZodTransform",(e,n)=>{ot.init(e,n),g.init(e,n),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new Pe(e.constructor.name);t.addIssue=s=>{if(typeof s=="string")t.issues.push(R(s,t.value,n));else{const u=s;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=t.value),u.inst??(u.inst=e),t.issues.push(R(u))}};const o=n.transform(t.value,t);return o instanceof Promise?o.then(s=>(t.value=s,t)):(t.value=o,t)}});function Qt(e){return new Wt({type:"transform",transform:e})}const Ge=a("ZodOptional",(e,n)=>{ut.init(e,n),g.init(e,n),e.unwrap=()=>e._zod.def.innerType});function we(e){return new Ge({type:"optional",innerType:e})}const Ht=a("ZodNullable",(e,n)=>{st.init(e,n),g.init(e,n),e.unwrap=()=>e._zod.def.innerType});function ye(e){return new Ht({type:"nullable",innerType:e})}const er=a("ZodDefault",(e,n)=>{it.init(e,n),g.init(e,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nr(e,n){return new er({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():Ie(n)}})}const tr=a("ZodPrefault",(e,n)=>{ct.init(e,n),g.init(e,n),e.unwrap=()=>e._zod.def.innerType});function rr(e,n){return new tr({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():Ie(n)}})}const Je=a("ZodNonOptional",(e,n)=>{at.init(e,n),g.init(e,n),e.unwrap=()=>e._zod.def.innerType});function or(e,n){return new Je({type:"nonoptional",innerType:e,...p(n)})}const ur=a("ZodCatch",(e,n)=>{lt.init(e,n),g.init(e,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sr(e,n){return new ur({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const ir=a("ZodPipe",(e,n)=>{ft.init(e,n),g.init(e,n),e.in=n.in,e.out=n.out});function ke(e,n){return new ir({type:"pipe",in:e,out:n})}const cr=a("ZodReadonly",(e,n)=>{dt.init(e,n),g.init(e,n),e.unwrap=()=>e._zod.def.innerType});function ar(e){return new cr({type:"readonly",innerType:e})}const lr=a("ZodCustom",(e,n)=>{ht.init(e,n),g.init(e,n)});function fr(e,n={}){return Et(lr,e,n)}function dr(e){return $t(e)}const hr=e=>Le({pages:Z(),nextPage:Z().optional(),totalElements:Z(),currentPage:Z(),pageSize:Z(),elements:Ve(e)}),pr=Le({page:Z(),pageSize:Z()});exports.Fail=Xe;exports.Failure=We;exports.Guid=N;exports.Ok=Be;exports.PageQuery=pr;exports.createPageSchema=hr;exports.formatDate=Ee;exports.formatDateTime=tn;exports.formatTime=$e;exports.isFailure=He;exports.mock=qe;exports.notFailure=Qe;exports.parseConfig=en;exports.sleep=nn;