@cline/shared 0.0.92 → 0.0.93
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/agent.d.ts +4 -0
- package/dist/automation/index.js +12 -12
- package/dist/db/index.js +5 -5
- package/dist/extensions/contribution-registry.d.ts +18 -0
- package/dist/hub.d.ts +81 -3
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.js +19 -19
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -42
- package/dist/llms/tokens.d.ts +23 -0
- package/dist/providers/defaults.d.ts +6 -2
- package/dist/remote-config/index.js +26 -26
- package/dist/rpc/runtime.d.ts +5 -1
- package/dist/storage/index.js +1 -1
- package/package.json +1 -1
package/dist/agent.d.ts
CHANGED
|
@@ -142,6 +142,10 @@ export interface AgentToolContext {
|
|
|
142
142
|
metadata?: Record<string, unknown>;
|
|
143
143
|
snapshot?: AgentRuntimeStateSnapshot;
|
|
144
144
|
emitUpdate?: (update: unknown) => void;
|
|
145
|
+
/** Session working directory. Set by the host for plugin tools. */
|
|
146
|
+
cwd?: string;
|
|
147
|
+
/** Sends a plugin event to the calling session. Set by the host for plugin tools. */
|
|
148
|
+
emitEvent?: (name: string, payload?: unknown) => void;
|
|
145
149
|
}
|
|
146
150
|
export interface AgentTool<TInput = unknown, TOutput = unknown> extends AgentToolDefinition {
|
|
147
151
|
/** Override the runtime execution mode. Adjacent parallel calls may overlap; sequential calls form ordering boundaries. */
|
package/dist/automation/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function de(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function at(e,t="|"){return e.map((r)=>ft(r)).join(t)}function me(e,t){if(typeof t==="bigint")return t.toString();return t}class Dr{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function he(e){return new Dr(e)}function jr(e){return e===null||e===void 0}function Ee(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Lr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function C(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ge(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function W(e){return ge(e._zod.def)??e._zod.def.shape}function Fr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return C(this,t,n),n},enumerable:!0,configurable:!0})}function Mr(e,t,r){if(t in e)C(e,t,r);else e[t]=r}function q(e,t,r,n){let o=W(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Fr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else Mr(e,i,n?n(s.value,i):s.value)}}function hc(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Fr(e,r,()=>t[r]);else Mr(e,r,n.value)}}function R(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Ur(e){return JSON.stringify(e)}function Br(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var lt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function re(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Jr=he(()=>{if(E.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Q(e){if(re(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(re(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function pt(e){if(Q(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Kr=new Set(["string","number","symbol"]);function Y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function ft(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Vr(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Te=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),dt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function gc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return q(i,e,Ne(e,t)),B(e,R(r,{shape:i,checks:[]}))}function Ne(e,t){let r=W(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function _c(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Ne(e,t)),s={};return q(s,e,Reflect.ownKeys(W(e)).filter((c)=>!i.has(c))),B(e,R(r,{shape:s,checks:[]}))}function xc(e,t){if(!Q(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=W(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return B(e,R(e._zod.def,{shape:Wr(e,t)}))}function Wr(e,t){let r={};return q(r,e,Reflect.ownKeys(W(e))),hc(r,t),r}function yc(e,t){if(!Q(t))throw Error("Invalid input to safeExtend: expected a plain object");return B(e,R(e._zod.def,{shape:Wr(e,t)}))}function vc(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};q(r,e,Reflect.ownKeys(W(e))),q(r,t,Reflect.ownKeys(W(t)));let n=R(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return B(e,n)}function Gr(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Ne(t,r)):void 0,u={};return q(u,t,Reflect.ownKeys(W(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),B(t,R(t._zod.def,{shape:u,checks:[]}))}function bc(e,t,r){let n=r?new Set(Ne(t,r)):void 0,o={};return q(o,t,Reflect.ownKeys(W(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),B(t,R(t._zod.def,{shape:o}))}function F(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Xr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function J(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function fe(e){return typeof e==="string"?e:e?.message}function mt(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function K(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:fe(e.inst?._zod.def?.error?.(e))??fe(i?.(e))??fe(t?.error?.(e))??fe(r.customError?.(e))??fe(r.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;c[u]=e[u]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var zc=/[\uD800-\uDBFF]/;function Ce(e){let t=e.length;if(!zc.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function Re(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Yr(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ee(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Hr(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else $c(e,r,n.value)}}function G(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function De(e,t,r){return G(e,t,r,!1)}function ht(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return G(this,r,n(this))},set(o){G(this,r,o)}})}return t}function $c(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:G(this,t,r.bind(this))},set(n){G(this,t,n)}})}function wc(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var ut,X=!1,kc={configurable:!0,get(){X=!0;return}};function v(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ut!==e._zod){ut=void 0;return}ut=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,kc);let o=X;X=!1;try{let i=r(this);if(X)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return X=X||o,i}catch(i){throw delete this[t],X=X||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Zc(e,t,r,n){let o=wc(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Sc="~constantCatch";function qr(e){let t=()=>e;return t[Sc]=!0,t}var Qr;var gt={value:void 0,enumerable:!1},en="captureStackTrace"in Error?Error:null;function Pc(e){let t=en;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return en=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(h){this.def=h,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(h,d){if(!h._zod){gt.value=new i(d);try{Object.defineProperty(h,"_zod",gt)}finally{gt.value=void 0}}else if(h._zod.traits.has(e))return;if(h._zod.traits.add(e),t(h,d),c){let _=Object.getPrototypeOf(h),x=h._zod.constr.prototype,y=_;while(y&&y!==x)y=Object.getPrototypeOf(y);let N=y??_;if(!c.has(N))c.add(N),Hr(N,s)}let m=f.prototype;for(let _ in m){if(!Object.prototype.hasOwnProperty.call(m,_))continue;if(!(_ in h))h[_]=m[_].bind(h)}}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(h){let d=n?.Parent?Pc(l):this;u(d,h);let m=d._zod.deferred;if(m){for(let x of m)x();d._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(d);return d}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:(h)=>{if(n?.Parent&&h instanceof n.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class V extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _e extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(Qr=globalThis).__zod_globalConfig??(Qr.__zod_globalConfig={});var E=globalThis.__zod_globalConfig;function D(e){if(e)Object.assign(E,e);return E}function Oc(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,me,2)),e.message}function Ic(e){this._zod.message=e}var Ac={get:Oc,set:Ic,enumerable:!0,configurable:!0},xt={value:void 0,enumerable:!1},tn=new WeakSet([Object.prototype,Error.prototype]),rn=(e,t)=>{e.name="$ZodError",xt.value=t,Object.defineProperty(e,"issues",xt),xt.value=void 0,Object.defineProperty(e,"message",Ac);let r=Object.getPrototypeOf(e);if(!tn.has(r))tn.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},nn=p("$ZodError",rn),yt=p("$ZodError",rn,void 0,{Parent:Error});function Ec(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function on(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Ec(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function sn(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;while(a<c.length){let l=c[a],f=a===c.length-1;if(l==="_errors"){if(f)u._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(u,l))Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=u[l];if(f)h._errors.push(t(s));u=h,a++}}}};return n(e),r}function Tc(e){let t=[],r=e.map((n)=>typeof n==="object"?n.key:n);for(let n of r)if(typeof n==="number")t.push(`[${n}]`);else if(typeof n==="symbol")t.push(`[${JSON.stringify(String(n))}]`);else if(/[^\w$]/.test(n))t.push(`[${JSON.stringify(n)}]`);else{if(t.length)t.push(".");t.push(n)}return t.join("")}function Da(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)if(t.push(`✖ ${n.message}`),n.path?.length)t.push(` → at ${Tc(n.path)}`);return t.join(`
|
|
2
|
-
`)}function je(e,t){return{callee:t?.callee??e,Err:t?.Err}}var xe=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new V;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>K(a,s,D())));throw lt(u,i?.callee??t),u}return c.value};return t},vt=xe(yt),ye=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>K(a,s,D())));throw lt(u,i?.callee??t),u}return c.value};return t},bt=ye(yt),Le=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new V;return i.issues.length?cn(e,i.issues,o):{success:!0,data:i.value}};function cn(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>K(o,r,D()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Fe=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?cn(e,i.issues,o):{success:!0,data:i.value}};var Cc=Symbol.for("zod.compile.invalid"),Rc=Symbol.for("zod.compile.fallback"),zt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Cc)return!0;if(n.definite===!0&&r===void 0)return!1}return Dc(e,t,r)};function Dc(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[Rc]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new V;return i.issues.length===0}var $t=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},un=(e)=>{let t=xe(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,je(r,s))};return r};var an=(e)=>{let t=xe(e),r=(n,o,i,s)=>t(n,o,i,je(r,s));return r};var ln=(e)=>{let t=ye(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,je(r,s))};return r};var pn=(e)=>{let t=ye(e),r=async(n,o,i,s)=>await t(n,o,i,je(r,s));return r};var fn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Le(e)(t,r,o)};var dn=(e)=>(t,r,n)=>Le(e)(t,r,n);var mn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Fe(e)(t,r,o)};var hn=(e)=>async(t,r,n)=>Fe(e)(t,r,n);var gn=/^[cC][0-9a-z]{6,}$/,_n=/^[0-9a-z]+$/,xn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,yn=/^[0-9a-vA-V]{20}$/,vn=/^[A-Za-z0-9]{27}$/,bn=/^[a-zA-Z0-9_-]{21}$/;function zn(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var $n=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var wn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,kt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var kn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var jc="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Zn(){return new RegExp(jc,"u")}var Sn=/^(?:(?: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])$/,Pn=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var On=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,In=/^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,An=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,En=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Tn=/^https?$/,Nn=/^\+[1-9]\d{6,14}$/;var Cn="(?:(?:\\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])))";function Lc(e){return new RegExp(`^${e}$`)}var Rn=Lc(Cn);function wt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Dn(e){return new RegExp(`^${wt(e)}$`)}function jn(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${wt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${wt({precision:e.precision})}`:r;return new RegExp(`^${Cn}T(?:${n})$`)}var Ln=/^[\s\S]{0,}$/;var Zt=/^-?\d+$/,ve=/^-?\d+(?:\.\d+)?$/,Fn=/^(?:true|false)$/i;var Mn=/^[^A-Z]*$/,Un=/^[^a-z]*$/;var I=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var St=(e)=>{let t=e.value;return!jr(t)&&t.length!==void 0},Me={number:"number",bigint:"bigint",object:"date"},Pt=p("$ZodCheckLessThan",(e,t)=>{I.init(e,t);let r=Me[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Me[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ot=p("$ZodCheckGreaterThan",(e,t)=>{I.init(e,t);let r=Me[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Me[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Bn=p("$ZodCheckMultipleOf",(e,t)=>{I.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Lr(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Jn=p("$ZodCheckNumberFormat",(e,t)=>{I.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Te[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Kn=p("$ZodCheckMaxLength",(e,t)=>{var r;I.init(e,t),(r=e._zod.def).when??(r.when=St),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Ce(o):i)<=t.maximum)return;let c=Re(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vn=p("$ZodCheckMinLength",(e,t)=>{var r;I.init(e,t),(r=e._zod.def).when??(r.when=St),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Ce(o):i)>=t.minimum)return;let c=Re(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wn=p("$ZodCheckLengthEquals",(e,t)=>{var r;I.init(e,t),(r=e._zod.def).when??(r.when=St),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Ce(o):i;if(s===t.length)return;let c=Re(o),u=s>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ze=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(I.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Gn=p("$ZodCheckRegex",(e,t)=>{ze.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xn=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Mn),ze.init(e,t)}),Yn=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Un),ze.init(e,t)}),Hn=p("$ZodCheckIncludes",(e,t)=>{I.init(e,t);let r=Y(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),qn=p("$ZodCheckStartsWith",(e,t)=>{I.init(e,t);let r=new RegExp(`^${Y(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Qn=p("$ZodCheckEndsWith",(e,t)=>{I.init(e,t);let r=new RegExp(`.*${Y(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var eo=p("$ZodCheckOverwrite",(e,t)=>{I.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class It{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
1
|
+
function de(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function lt(e,t="|"){return e.map((r)=>dt(r)).join(t)}function me(e,t){if(typeof t==="bigint")return t.toString();return t}class jr{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function he(e){return new jr(e)}function Lr(e){return e===null||e===void 0}function Ee(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Fr(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);if(Math.abs(r-n)<o)return 0;return r-n}function C(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function ge(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function W(e){return ge(e._zod.def)??e._zod.def.shape}function Mr(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return C(this,t,n),n},enumerable:!0,configurable:!0})}function Ur(e,t,r){if(t in e)C(e,t,r);else e[t]=r}function q(e,t,r,n){let o=W(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Mr(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else Ur(e,i,n?n(s.value,i):s.value)}}function gc(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Mr(e,r,()=>t[r]);else Ur(e,r,n.value)}}function R(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Br(e){return JSON.stringify(e)}function Jr(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var pt="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function re(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var Kr=he(()=>{if(E.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Q(e){if(re(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(re(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function ft(e){if(Q(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Vr=new Set(["string","number","symbol"]);function Y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function B(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function g(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function dt(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Wr(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Te=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),mt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function _c(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return q(i,e,Ne(e,t)),B(e,R(r,{shape:i,checks:[]}))}function Ne(e,t){let r=W(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function xc(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Ne(e,t)),s={};return q(s,e,Reflect.ownKeys(W(e)).filter((c)=>!i.has(c))),B(e,R(r,{shape:s,checks:[]}))}function yc(e,t){if(!Q(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=W(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return B(e,R(e._zod.def,{shape:Gr(e,t)}))}function Gr(e,t){let r={};return q(r,e,Reflect.ownKeys(W(e))),gc(r,t),r}function vc(e,t){if(!Q(t))throw Error("Invalid input to safeExtend: expected a plain object");return B(e,R(e._zod.def,{shape:Gr(e,t)}))}function bc(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};q(r,e,Reflect.ownKeys(W(e))),q(r,t,Reflect.ownKeys(W(t)));let n=R(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return B(e,n)}function Xr(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let c=r?new Set(Ne(t,r)):void 0,u={};return q(u,t,Reflect.ownKeys(W(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),B(t,R(t._zod.def,{shape:u,checks:[]}))}function zc(e,t,r){let n=r?new Set(Ne(t,r)):void 0,o={};return q(o,t,Reflect.ownKeys(W(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),B(t,R(t._zod.def,{shape:o}))}function F(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Yr(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function J(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function fe(e){return typeof e==="string"?e:e?.message}function ht(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function Ce(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function K(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:fe(e.inst?._zod.def?.error?.(e))??fe(i?.(e))??fe(t?.error?.(e))??fe(r.customError?.(e))??fe(r.localeError?.(e))??"Invalid input",c={};for(let u of Object.keys(e)){if(u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__")continue;c[u]=e[u]}if(c.path??(c.path=[]),c.message=s,t?.reportInput)c.input=e.input;return c}var $c=/[\uD800-\uDBFF]/;function Re(e){let t=e.length;if(!$c.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function De(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Hr(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function ee(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function qr(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else wc(e,r,n.value)}}function G(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function je(e,t,r){return G(e,t,r,!1)}function gt(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return G(this,r,n(this))},set(o){G(this,r,o)}})}return t}function wc(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:G(this,t,r.bind(this))},set(n){G(this,t,n)}})}function kc(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var at,X=!1,Zc={configurable:!0,get(){X=!0;return}};function v(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&at!==e._zod){at=void 0;return}at=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Zc);let o=X;X=!1;try{let i=r(this);if(X)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return X=X||o,i}catch(i){throw delete this[t],X=X||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Sc(e,t,r,n){let o=kc(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Pc="~constantCatch";function Qr(e){let t=()=>e;return t[Pc]=!0,t}var en;var _t={value:void 0,enumerable:!1},tn="captureStackTrace"in Error?Error:null;function Oc(e){let t=tn;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return tn=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(h){this.def=h,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(h,d){if(!h._zod){_t.value=new i(d);try{Object.defineProperty(h,"_zod",_t)}finally{_t.value=void 0}}else if(h._zod.traits.has(e))return;if(h._zod.traits.add(e),t(h,d),c){let _=Object.getPrototypeOf(h),x=h._zod.constr.prototype,y=_;while(y&&y!==x)y=Object.getPrototypeOf(y);let N=y??_;if(!c.has(N))c.add(N),qr(N,s)}let m=f.prototype;for(let _ in m){if(!Object.prototype.hasOwnProperty.call(m,_))continue;if(!(_ in h))h[_]=m[_].bind(h)}}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(h){let d=n?.Parent?Oc(l):this;u(d,h);let m=d._zod.deferred;if(m){for(let x of m)x();d._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(d);return d}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:(h)=>{if(n?.Parent&&h instanceof n.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class V extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class _e extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(en=globalThis).__zod_globalConfig??(en.__zod_globalConfig={});var E=globalThis.__zod_globalConfig;function D(e){if(e)Object.assign(E,e);return E}function Ic(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,me,2)),e.message}function Ac(e){this._zod.message=e}var Ec={get:Ic,set:Ac,enumerable:!0,configurable:!0},yt={value:void 0,enumerable:!1},rn=new WeakSet([Object.prototype,Error.prototype]),nn=(e,t)=>{e.name="$ZodError",yt.value=t,Object.defineProperty(e,"issues",yt),yt.value=void 0,Object.defineProperty(e,"message",Ec);let r=Object.getPrototypeOf(e);if(!rn.has(r))rn.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},on=p("$ZodError",nn),vt=p("$ZodError",nn,void 0,{Parent:Error});function Tc(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function sn(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)Tc(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function cn(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((c)=>n({issues:c},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let c=[...i,...s.path];if(c.length===0)r._errors.push(t(s));else{let u=r,a=0;while(a<c.length){let l=c[a],f=a===c.length-1;if(l==="_errors"){if(f)u._errors.push(t(s));a++;continue}if(!Object.prototype.hasOwnProperty.call(u,l))Object.defineProperty(u,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=u[l];if(f)h._errors.push(t(s));u=h,a++}}}};return n(e),r}function Nc(e){let t=[],r=e.map((n)=>typeof n==="object"?n.key:n);for(let n of r)if(typeof n==="number")t.push(`[${n}]`);else if(typeof n==="symbol")t.push(`[${JSON.stringify(String(n))}]`);else if(/[^\w$]/.test(n))t.push(`[${JSON.stringify(n)}]`);else{if(t.length)t.push(".");t.push(n)}return t.join("")}function Fa(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)if(t.push(`✖ ${n.message}`),n.path?.length)t.push(` → at ${Nc(n.path)}`);return t.join(`
|
|
2
|
+
`)}function Le(e,t){return{callee:t?.callee??e,Err:t?.Err}}var xe=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new V;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>K(a,s,D())));throw pt(u,i?.callee??t),u}return c.value};return t},bt=xe(vt),ye=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>K(a,s,D())));throw pt(u,i?.callee??t),u}return c.value};return t},zt=ye(vt),Fe=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new V;return i.issues.length?un(e,i.issues,o):{success:!0,data:i.value}};function un(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>K(o,r,D()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Me=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?un(e,i.issues,o):{success:!0,data:i.value}};var Rc=Symbol.for("zod.compile.invalid"),Dc=Symbol.for("zod.compile.fallback"),$t=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Rc)return!0;if(n.definite===!0&&r===void 0)return!1}return jc(e,t,r)};function jc(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[Dc]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new V;return i.issues.length===0}var wt=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},an=(e)=>{let t=xe(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,Le(r,s))};return r};var ln=(e)=>{let t=xe(e),r=(n,o,i,s)=>t(n,o,i,Le(r,s));return r};var pn=(e)=>{let t=ye(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,Le(r,s))};return r};var fn=(e)=>{let t=ye(e),r=async(n,o,i,s)=>await t(n,o,i,Le(r,s));return r};var dn=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Fe(e)(t,r,o)};var mn=(e)=>(t,r,n)=>Fe(e)(t,r,n);var hn=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Me(e)(t,r,o)};var gn=(e)=>async(t,r,n)=>Me(e)(t,r,n);var _n=/^[cC][0-9a-z]{6,}$/,xn=/^[0-9a-z]+$/,yn=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,vn=/^[0-9a-vA-V]{20}$/,bn=/^[A-Za-z0-9]{27}$/,zn=/^[a-zA-Z0-9_-]{21}$/;function $n(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var wn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var kn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Zn=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Lc="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Sn(){return new RegExp(Lc,"u")}var Pn=/^(?:(?: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])$/,On=/^(([0-9a-fA-F]{1,4}:){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}|:))$/;var In=/^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/,An=/^(([0-9a-fA-F]{1,4}:){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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,En=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Nn=/^https?$/,Cn=/^\+[1-9]\d{6,14}$/;var Rn="(?:(?:\\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])))";function Fc(e){return new RegExp(`^${e}$`)}var Dn=Fc(Rn);function kt(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function jn(e){return new RegExp(`^${kt(e)}$`)}function Ln(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${kt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${kt({precision:e.precision})}`:r;return new RegExp(`^${Rn}T(?:${n})$`)}var Fn=/^[\s\S]{0,}$/;var St=/^-?\d+$/,ve=/^-?\d+(?:\.\d+)?$/,Mn=/^(?:true|false)$/i;var Un=/^[^A-Z]*$/,Bn=/^[^a-z]*$/;var I=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Pt=(e)=>{let t=e.value;return!Lr(t)&&t.length!==void 0},Ue={number:"number",bigint:"bigint",object:"date"},Ot=p("$ZodCheckLessThan",(e,t)=>{I.init(e,t);let r=Ue[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value<=t.value:n.value<t.value)return;n.issues.push({origin:Ue[typeof n.value]??r,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),It=p("$ZodCheckGreaterThan",(e,t)=>{I.init(e,t);let r=Ue[typeof t.value];e._zod.check=(n)=>{if(t.inclusive?n.value>=t.value:n.value>t.value)return;n.issues.push({origin:Ue[typeof n.value]??r,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jn=p("$ZodCheckMultipleOf",(e,t)=>{I.init(e,t),e._zod.check=(r)=>{if(typeof r.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof r.value==="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Fr(r.value,t.value)===0)return;r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Kn=p("$ZodCheckNumberFormat",(e,t)=>{I.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Te[t.format];e._zod.check=(s)=>{let c=s.value;if(r){if(!Number.isInteger(c)){s.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)s.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});else s.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}if(c<o)s.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(c>i)s.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var Vn=p("$ZodCheckMaxLength",(e,t)=>{var r;I.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?Re(o):i)<=t.maximum)return;let c=De(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wn=p("$ZodCheckMinLength",(e,t)=>{var r;I.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?Re(o):i)>=t.minimum)return;let c=De(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gn=p("$ZodCheckLengthEquals",(e,t)=>{var r;I.init(e,t),(r=e._zod.def).when??(r.when=Pt),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?Re(o):i;if(s===t.length)return;let c=De(o),u=s>t.length;n.issues.push({origin:c,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ze=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(I.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Xn=p("$ZodCheckRegex",(e,t)=>{ze.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Yn=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Un),ze.init(e,t)}),Hn=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bn),ze.init(e,t)}),qn=p("$ZodCheckIncludes",(e,t)=>{I.init(e,t);let r=Y(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Qn=p("$ZodCheckStartsWith",(e,t)=>{I.init(e,t);let r=new RegExp(`^${Y(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),eo=p("$ZodCheckEndsWith",(e,t)=>{I.init(e,t);let r=new RegExp(`.*${Y(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});var to=p("$ZodCheckOverwrite",(e,t)=>{I.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class At{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
3
3
|
`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
4
|
${t.join(`
|
|
5
5
|
`)}
|
|
6
|
-
};`)(...Object.values(this.closed))}}var ro={major:4,minor:6,patch:5};var b=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ro;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let l=F(c),f;for(let h of u){if(h._zod.def.when){if(Xr(c))continue;if(!h._zod.def.when(c))continue}else if(l)continue;let d=c.issues.length,m=h._zod.check(c);if(m instanceof Promise&&a?.async===!1)throw new V;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await m,c.issues.length===d)return;if(mt(c.issues,d,e),!l)l=F(c,d)});else{if(c.issues.length===d)continue;if(mt(c.issues,d,e),!l)l=F(c,d)}}if(f)return f.then(()=>c);return c},s=(c,u,a)=>{if(F(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new V;return l.then((f)=>e._zod.parse(f,a))}return e._zod.parse(l,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,u));return s(l,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new V;return a.then((l)=>i(l,o,u))}return i(a,o,u)}}},{get "~standard"(){return De(this,"~standard",Et(this))},set "~standard"(e){G(this,"~standard",e)}}),_o=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>K(r,t,D()))}:{value:e.value};async function Fc(e,t){let r={async:!0};return _o(await e._zod.run({value:t,issues:[]},r),r)}function Et(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return _o(n,r)}catch(n){}return Fc(e,t)},vendor:"zod",version:1}}var Ke=p("$ZodString",(e,t)=>{b.init(e,t),e._zod.pattern=t.pattern??Ln,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Z=p("$ZodStringFormat",(e,t)=>{ze.init(e,t),Ke.init(e,t)}),xo=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=wn),Z.init(e,t)}),yo=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=kt(n))}else t.pattern??(t.pattern=kt());Z.init(e,t)}),vo=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=kn),Z.init(e,t)}),bo=1,Be=2;function zo(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Mc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return zo(e)||Be;return Uc(e,t)}function Uc(e,t){if(!t.normalize&&t.protocol?.source===Tn.source&&!/^https?:\/\//i.test(e))return bo;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Be}return new URL(e)}catch{return Be}}var Bc=/[\t\n\r]/g;function no(e){return e.replace(Bc,"")}function Jc(e,t){return t.lastIndex=0,t.test(e.hostname)}function Kc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var $o=p("$ZodURL",(e,t)=>{Z.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Mc(n,t);if(o===bo){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Be){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=no(n);return}if(t.hostname&&!Jc(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Kc(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:no(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),wo=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Zn()),Z.init(e,t)}),ko=p("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?bn:zn(t.length)),Z.init(e,t)}),Zo=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gn),Z.init(e,t)}),So=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_n),Z.init(e,t)}),Po=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=xn),Z.init(e,t)}),Oo=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=yn),Z.init(e,t)}),Io=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=vn),Z.init(e,t)}),Ao=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jn(t)),Z.init(e,t)}),Eo=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rn),Z.init(e,t)}),To=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Dn(t)),Z.init(e,t)}),No=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=$n),Z.init(e,t)}),Co=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Sn),Z.init(e,t)}),Vc=/^[0-9a-fA-F:.]+$/;function Ro(e){if(!Vc.test(e))return!1;return zo(`http://[${e}]`)}var Do=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Pn),Z.init(e,t),e._zod.check=(r)=>{if(!Ro(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var jo=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=On),Z.init(e,t)});function Wc(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Ro(r)}var Lo=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=In),Z.init(e,t),e._zod.check=(r)=>{if(!Wc(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Fo(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Tt=/^[0-9a-zA-Z+/]*={0,2}$/,Mo=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Tt),Z.init(e,t),e._zod.check=(r)=>{if(Fo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ve=/^[A-Za-z0-9_-]*$/;function Gc(e){if(!Ve.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fo(r)}var Uo=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ve),Z.init(e,t),e._zod.check=(r)=>{if(Gc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Bo=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Nn),Z.init(e,t)});function Xc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Jo=p("$ZodJWT",(e,t)=>{Z.init(e,t),e._zod.check=(r)=>{if(Xc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Nt=p("$ZodNumber",(e,t)=>{b.init(e,t),e._zod.pattern=ve,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Ko=p("$ZodNumberFormat",(e,t)=>{Jn.init(e,t),Nt.init(e,t)}),Vo=p("$ZodBoolean",(e,t)=>{b.init(e,t),e._zod.pattern=Fn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Wo=p("$ZodUnknown",(e,t)=>{b.init(e,t),e._zod.parse=(r)=>r}),Go=p("$ZodNever",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Xo=p("$ZodVoid",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(typeof o>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Yo=p("$ZodDate",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(c){}let o=r.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function oo(e,t,r){if(e.issues.length)t.issues.push(...J(r,e.issues));t.value[r]=e.value}var Ho=p("$ZodArray",(e,t)=>{b.init(e,t);let r=E.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then((f)=>oo(f,n,u)));else if(oo(l,n,u),c&&l.issues.length!==0&&F(l))break}if(s.length)return Promise.all(s).then(()=>n);return n}});function Je(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...J(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var Yc=[];function qo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Yc,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Vr(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Qo(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,{optin:f,optout:h}=a,d=0;for(let m in t){if(s&&r.issues.length!==d){if(F(r,d))break;d=r.issues.length}if(u.has(m))continue;if(m==="__proto__"){if(l==="never")c.push(m);continue}if(l==="never"){c.push(m);continue}let _=a.run({value:t[m],issues:[]},n);if(_ instanceof Promise)e.push(_.then((x)=>Je(x,r,m,t,f,h)));else Je(_,r,m,t,f,h)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var Hc=p("$ZodObject",(e,t)=>{b.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=he(()=>qo(t));v(e,"propValues",(a)=>{let l=a.def.shape,f={};for(let h in l){let d=l[h]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,h))C(f,h,new Set);for(let m of d.values)f[h].add(m);if(d.optin!==void 0)f[h].add(void 0)}}return f});let i=re,s=t.catchall,c,u=E.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{c??(c=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let h=[],d=c.shape,m=l?.abortEarly,_=a.issues.length;for(let x of c.allKeys){if(m&&a.issues.length!==_){if(F(a,_))break;_=a.issues.length}if(x==="__proto__")continue;let y=d[x],N=y._zod.optin,le=y._zod.optout,pe=y._zod.run({value:f[x],issues:[]},l);if(pe instanceof Promise)h.push(pe.then((P)=>Je(P,a,x,f,N,le)));else Je(pe,a,x,f,N,le)}if(!s)return h.length?Promise.all(h).then(()=>a):a;return Qo(h,f,a,l,o.value,e,m===!0)}}),ei=p("$ZodObjectJIT",(e,t)=>{Hc.init(e,t);let r=e._zod.parse,n=he(()=>qo(t)),o=E.memoizer,i=(d)=>{let m=n.value,_=m.symbolKeys,x=new It(["payload","ctx"],{shape:d,inst:e,memo:o,syms:_}),y=(P)=>`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`,N=(P,k)=>`
|
|
6
|
+
};`)(...Object.values(this.closed))}}var no={major:4,minor:6,patch:7};var b=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=no;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(c,u,a)=>{if(c.memo)return c;let l=F(c),f;for(let h of u){if(h._zod.def.when){if(Yr(c))continue;if(!h._zod.def.when(c))continue}else if(l)continue;let d=c.issues.length,m=h._zod.check(c);if(m instanceof Promise&&a?.async===!1)throw new V;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await m,c.issues.length===d)return;if(Ce(c.issues,d,e),!l)l=F(c,d)});else{if(c.issues.length===d)continue;if(Ce(c.issues,d,e),!l)l=F(c,d)}}if(f)return f.then(()=>c);return c},s=(c,u,a)=>{if(F(c))return c.aborted=!0,c;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new V;return l.then((f)=>e._zod.parse(f,a))}return e._zod.parse(l,a)};e._zod.run=(c,u)=>{if(u.skipChecks)return e._zod.parse(c,u);if(u.direction==="backward"){let l=e._zod.parse({value:c.value,issues:[]},{...u,skipChecks:!0});if(l instanceof Promise)return l.then((f)=>s(f,c,u));return s(l,c,u)}let a=e._zod.parse(c,u);if(a instanceof Promise){if(u.async===!1)throw new V;return a.then((l)=>i(l,o,u))}return i(a,o,u)}}},{get "~standard"(){return je(this,"~standard",Tt(this))},set "~standard"(e){G(this,"~standard",e)}}),xo=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>K(r,t,D()))}:{value:e.value};async function Mc(e,t){let r={async:!0};return xo(await e._zod.run({value:t,issues:[]},r),r)}function Tt(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return xo(n,r)}catch(n){}return Mc(e,t)},vendor:"zod",version:1}}var Ve=p("$ZodString",(e,t)=>{b.init(e,t),e._zod.pattern=t.pattern??Fn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Z=p("$ZodStringFormat",(e,t)=>{ze.init(e,t),Ve.init(e,t)}),yo=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=kn),Z.init(e,t)}),vo=p("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Zt(n))}else t.pattern??(t.pattern=Zt());Z.init(e,t)}),bo=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Zn),Z.init(e,t)}),zo=1,Je=2;function $o(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Uc(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return $o(e)||Je;return Bc(e,t)}function Bc(e,t){if(!t.normalize&&t.protocol?.source===Nn.source&&!/^https?:\/\//i.test(e))return zo;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??Je}return new URL(e)}catch{return Je}}var Jc=/[\t\n\r]/g;function oo(e){return e.replace(Jc,"")}function Kc(e,t){return t.lastIndex=0,t.test(e.hostname)}function Vc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var wo=p("$ZodURL",(e,t)=>{Z.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Uc(n,t);if(o===zo){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===Je){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=oo(n);return}if(t.hostname&&!Kc(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Vc(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:oo(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ko=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Sn()),Z.init(e,t)}),Zo=p("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?zn:$n(t.length)),Z.init(e,t)}),So=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_n),Z.init(e,t)}),Po=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=xn),Z.init(e,t)}),Oo=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=yn),Z.init(e,t)}),Io=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=vn),Z.init(e,t)}),Ao=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=bn),Z.init(e,t)}),Eo=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ln(t)),Z.init(e,t)}),To=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Dn),Z.init(e,t)}),No=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=jn(t)),Z.init(e,t)}),Co=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=wn),Z.init(e,t)}),Ro=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Pn),Z.init(e,t)}),Wc=/^[0-9a-fA-F:.]+$/;function Do(e){if(!Wc.test(e))return!1;return $o(`http://[${e}]`)}var jo=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=On),Z.init(e,t),e._zod.check=(r)=>{if(!Do(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var Lo=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=In),Z.init(e,t)});function Gc(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Do(r)}var Fo=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=An),Z.init(e,t),e._zod.check=(r)=>{if(!Gc(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Mo(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Nt=/^[0-9a-zA-Z+/]*={0,2}$/,Uo=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Nt),Z.init(e,t),e._zod.check=(r)=>{if(Mo(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),We=/^[A-Za-z0-9_-]*$/;function Xc(e){if(!We.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Mo(r)}var Bo=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=We),Z.init(e,t),e._zod.check=(r)=>{if(Xc(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Jo=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cn),Z.init(e,t)});function Yc(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Ko=p("$ZodJWT",(e,t)=>{Z.init(e,t),e._zod.check=(r)=>{if(Yc(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Ct=p("$ZodNumber",(e,t)=>{b.init(e,t),e._zod.pattern=ve,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch(s){}let o=r.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),Vo=p("$ZodNumberFormat",(e,t)=>{Kn.init(e,t),Ct.init(e,t)}),Wo=p("$ZodBoolean",(e,t)=>{b.init(e,t),e._zod.pattern=Mn,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Boolean(r.value)}catch(i){}let o=r.value;if(typeof o==="boolean")return r;return r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});var Go=p("$ZodUnknown",(e,t)=>{b.init(e,t),e._zod.parse=(r)=>r}),Xo=p("$ZodNever",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),Yo=p("$ZodVoid",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(typeof o>"u")return r;return r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),Ho=p("$ZodDate",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch(c){}let o=r.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return r;return r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function Hc(e,t){let r=ht(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let c=t(i.value);if(c>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[u,a]of ht(e._zod.def.checks))if(c>u&&a._zod.def.when(i)){let l=i.issues.length;return a._zod.check(i),i.issues[l].continue=!1,Ce(i.issues,l,e),i}}return o(i,s)}}var qc=(e)=>Array.isArray(e)?e.length:-1;function io(e,t,r){if(e.issues.length)t.issues.push(...J(r,e.issues));t.value[r]=e.value}var qo=p("$ZodArray",(e,t)=>{b.init(e,t);let r=E.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],c=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)s.push(l.then((f)=>io(f,n,u)));else if(io(l,n,u),c&&l.issues.length!==0&&F(l))break}if(s.length)return Promise.all(s).then(()=>n);return n},Hc(e,qc)});function Ke(e,t,r,n,o,i){let s=r in n,c=i==="optional";if(!s&&c&&o==="optional")return;if(e.issues.length){if(o!==void 0&&c&&!s)return;t.issues.push(...J(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!c)t.value[r]=void 0}else t.value[r]=e.value}var Qc=[];function Qo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Qc,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Wr(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function ei(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,{optin:f,optout:h}=a,d=0;for(let m in t){if(s&&r.issues.length!==d){if(F(r,d))break;d=r.issues.length}if(u.has(m))continue;if(m==="__proto__"){if(l==="never")c.push(m);continue}if(l==="never"){c.push(m);continue}let _=a.run({value:t[m],issues:[]},n);if(_ instanceof Promise)e.push(_.then((x)=>Ke(x,r,m,t,f,h)));else Ke(_,r,m,t,f,h)}if(c.length)r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}var eu=p("$ZodObject",(e,t)=>{b.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=he(()=>Qo(t));v(e,"propValues",(a)=>{let l=a.def.shape,f={};for(let h in l){let d=l[h]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,h))C(f,h,new Set);for(let m of d.values)f[h].add(m);if(d.optin!==void 0)f[h].add(void 0)}}return f});let i=re,s=t.catchall,c,u=E.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{c??(c=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let h=[],d=c.shape,m=l?.abortEarly,_=a.issues.length;for(let x of c.allKeys){if(m&&a.issues.length!==_){if(F(a,_))break;_=a.issues.length}if(x==="__proto__")continue;let y=d[x],N=y._zod.optin,le=y._zod.optout,pe=y._zod.run({value:f[x],issues:[]},l);if(pe instanceof Promise)h.push(pe.then((P)=>Ke(P,a,x,f,N,le)));else Ke(pe,a,x,f,N,le)}if(!s)return h.length?Promise.all(h).then(()=>a):a;return ei(h,f,a,l,o.value,e,m===!0)}}),ti=p("$ZodObjectJIT",(e,t)=>{eu.init(e,t);let r=e._zod.parse,n=he(()=>Qo(t)),o=E.memoizer,i=(d)=>{let m=n.value,_=m.symbolKeys,x=new At(["payload","ctx"],{shape:d,inst:e,memo:o,syms:_}),y=(P)=>`shape[${P}]._zod.run({ value: input[${P}], issues: [] }, ctx)`,N=(P,k)=>`
|
|
7
7
|
let ${P}_ab = false;
|
|
8
8
|
for (let i = 0; i < ${P}.issues.length; i++) {
|
|
9
9
|
const iss = ${P}.issues[i];
|
|
@@ -14,19 +14,19 @@ ${t.join(`
|
|
|
14
14
|
if (${P}_ab && ctx && ctx.abortEarly) {
|
|
15
15
|
payload.value = newResult;
|
|
16
16
|
return payload;
|
|
17
|
-
}`;x.write("const input = payload.value;");let le=Object.create(null),pe=0;for(let P of m.allKeys)le[P]=`key_${pe++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let P of m.allKeys){if(P==="__proto__")continue;let k=le[P],U=typeof P==="symbol"?`syms[${_.indexOf(P)}]`:
|
|
18
|
-
const ${k}_present = ${
|
|
17
|
+
}`;x.write("const input = payload.value;");let le=Object.create(null),pe=0;for(let P of m.allKeys)le[P]=`key_${pe++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let P of m.allKeys){if(P==="__proto__")continue;let k=le[P],U=typeof P==="symbol"?`syms[${_.indexOf(P)}]`:Br(P),ct=`${U} in input`,Rr=d[P],ut=Rr?._zod?.optin,Dr=ut!==void 0,mc=Rr?._zod?.optout==="optional";if(x.write(`const ${k} = ${y(U)};`),Dr&&mc){let hc=ut==="optional"?`${k}_present`:`${k}.value !== undefined || ${k}_present`;x.write(`
|
|
18
|
+
const ${k}_present = ${ct};
|
|
19
19
|
if (!${k}.issues.length || ${k}_present) {
|
|
20
20
|
if (${k}.issues.length) {${N(k,U)}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
if (${
|
|
23
|
+
if (${hc}) {
|
|
24
24
|
newResult[${U}] = ${k}.value;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
`)}else if(!
|
|
29
|
-
const ${k}_present = ${
|
|
28
|
+
`)}else if(!Dr)x.write(`
|
|
29
|
+
const ${k}_present = ${ct};
|
|
30
30
|
if (${k}.issues.length) {${N(k,U)}
|
|
31
31
|
}
|
|
32
32
|
if (!${k}_present && !${k}.issues.length) {
|
|
@@ -49,10 +49,10 @@ ${t.join(`
|
|
|
49
49
|
`);else if(x.write(`
|
|
50
50
|
if (${k}.issues.length) {${N(k,U)}
|
|
51
51
|
}
|
|
52
|
-
`),
|
|
53
|
-
if (${k}.value !== undefined || ${
|
|
52
|
+
`),ut==="defaulted")x.write(`newResult[${U}] = ${k}.value;`);else x.write(`
|
|
53
|
+
if (${k}.value !== undefined || ${ct}) {
|
|
54
54
|
newResult[${U}] = ${k}.value;
|
|
55
55
|
}
|
|
56
|
-
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,c=re,u=!E.jitless,l=u&&Jr.value,f=t.catchall,h;e._zod.parse=(d,m)=>{h??(h=n.value);let _=d.value;if(!c(_))return d.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),d;if(u&&l&&m?.async===!1&&m.jitless!==!0){if(!s)s=i(t.shape);if(d=s(d,m),!f)return d;return Qo([],_,d,m,h,e,m?.abortEarly===!0)}return r(d,m)}});function io(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!F(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>K(s,n,D())))}),t}var Ct=p("$ZodUnion",(e,t)=>{b.init(e,t),v(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),v(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),v(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),v(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Ee(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}if(!i)return io(s,n,e,o);return Promise.all(s).then((c)=>io(c,n,e,o))}});function qc(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var ti=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ct.init(e,t);let r=e._zod.parse;v(e,"propValues",(o)=>{let i={},s=0;for(let c of o.def.options){let u=c._zod.propValues;if(!u||Object.keys(u).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);if(u[o.def.discriminator]?.has(void 0))s++;for(let[a,l]of Object.entries(u)){if(!Object.prototype.hasOwnProperty.call(i,a))C(i,a,new Set);for(let f of l)i[a].add(f)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=ge(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=he(()=>qc(t));e._zod.parse=(o,i)=>{let s=o.value;if(!re(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let c=s?.[t.discriminator],u=n.value.get(c);if(u&&(c!==void 0||i.direction!=="backward"))return u._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return r(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((a)=>n.value.get(a)!==null),input:s,path:[t.discriminator],inst:e}),o}}),ri=p("$ZodIntersection",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([u,a])=>so(r,u,a));return so(r,i,s)}});function At(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Q(e)&&Q(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=At(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=At(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function so(e,t,r){let n=new Map,o,i=new Map,s=(a,l)=>{let f;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),f=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let h=String(a.path[0]);if(!i.has(h))i.set(h,a);f=[h]}else return!1;for(let h of f){if(!n.has(h))n.set(h,{});n.get(h)[l]=!0}return!0};for(let a of t.issues)if(!s(a,"l"))e.issues.push(a);for(let a of r.issues)if(!s(a,"r"))e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter((l)=>o.keys.includes(l)):[];if(a.length)e.issues.push({...o,keys:a});for(let l of c)if(!a.includes(l)&&i.has(l))e.issues.push(i.get(l))}let u=At(t.value,r.value);if(!u.valid){if(F(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var Rt=p("$ZodTuple",(e,t)=>{b.init(e,t);let r=t.items,n=E.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],u=co(r,"optin"),a=co(r,"optout");if(!t.rest){if(s.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=Array(r.length),f=t.rest?i?.abortEarly:void 0,h=!1;for(let d=0;d<r.length;d++){let m=r[d]._zod.run({value:s[d],issues:[]},i);if(m instanceof Promise)c.push(m.then((_)=>{l[d]=_}));else if(l[d]=m,f&&!h&&m.issues.length)h=F(m)}if(t.rest&&!h){let d=r.length-1,m=s.slice(r.length),_=o.issues.length;for(let x of m){if(f&&o.issues.length!==_){if(F(o,_))break;_=o.issues.length}d++;let y=t.rest._zod.run({value:x,issues:[]},i);if(y instanceof Promise)c.push(y.then((N)=>uo(N,o,d)));else uo(y,o,d)}}if(c.length)return Promise.all(c).then(()=>ao(l,o,r,s,a));return ao(l,o,r,s,a)}});function co(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function uo(e,t,r){if(e.issues.length)t.issues.push(...J(r,e.issues));t.value[r]=e.value}function ao(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...J(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var ni=p("$ZodRecord",(e,t)=>{b.init(e,t);let r=E.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Q(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let u=new Set;for(let l of c)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(u.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((m)=>K(m,o,D())),input:l,path:[l],inst:e});continue}let h=f.value;if(h==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);if(d instanceof Promise)s.push(d.then((m)=>{if(m.issues.length)n.issues.push(...J(l,m.issues));n.value[h]=m.value}));else{if(d.issues.length)n.issues.push(...J(l,d.issues));n.value[h]=d.value}}let a;for(let l in i)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else a=a??[],a.push(l);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let a of Reflect.ownKeys(i)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&ve.test(a)&&l.issues.length){let m=t.keyType._zod.run({value:Number(a),issues:[]},o);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length===0)l=m}if(l.issues.length){if(t.mode==="loose")n.value[a]=i[a];else if(c)u=u??[],u.push(a);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((m)=>K(m,o,D())),input:a,path:[a],inst:e});continue}let h=l.value;if(h==="__proto__")continue;let d=t.valueType._zod.run({value:i[a],issues:[]},o);if(d instanceof Promise)s.push(d.then((m)=>{if(m.issues.length)n.issues.push(...J(a,m.issues));n.value[h]=m.value}));else{if(d.issues.length)n.issues.push(...J(a,d.issues));n.value[h]=d.value}}if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}if(s.length)return Promise.all(s).then(()=>n);return n}});var oi=p("$ZodEnum",(e,t)=>{b.init(e,t);let r=de(t.entries),n=new Set(r);e._zod.values=n,v(e,"pattern",(o)=>{let i=de(o.def.entries).filter((s)=>Kr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>Y(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),ii=p("$ZodLiteral",(e,t)=>{b.init(e,t);let r=new Set(t.values);e._zod.values=r,v(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?Y(i):i?Y(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var si=p("$ZodTransform",(e,t)=>{b.init(e,t),e._zod.optin="optional",E.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _e(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new V;return r.value=o,r}});function lo(e,t){return e.value=t.issues.length?void 0:t.value,e}var Dt=p("$ZodOptional",(e,t)=>{b.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ee(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>lo(r,i));return lo(r,o)}return t.innerType._zod.run(r,n)}}),ci=p("$ZodExactOptional",(e,t)=>{Dt.init(e,t),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ui=p("$ZodNullable",(e,t)=>{b.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ee(n.source)}|null)$`):void 0}),v(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),ai=p("$ZodDefault",(e,t)=>{b.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>po(i,t));return po(o,t)}});function po(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var li=p("$ZodPrefault",(e,t)=>{b.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),pi=p("$ZodNonOptional",(e,t)=>{b.init(e,t),v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>fo(i,e));return fo(o,e)}});function fo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function mo(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>K(o,n,D()))},input:e.value}),e}var fi=p("$ZodCatch",(e,t)=>{b.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>mo(r,i,t,n));return mo(r,o,t,n)}});var jt=p("$ZodPipe",(e,t)=>{b.init(e,t),v(e,"values",(r)=>r.def.in._zod.values),v(e,"optin",(r)=>r.def.in._zod.optin),v(e,"optout",(r)=>r.def.out._zod.optout),v(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Ue(s,t.in,n));return Ue(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Ue(i,t.out,n));return Ue(o,t.out,n)}});function Ue(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var di=p("$ZodPreprocess",(e,t)=>{jt.init(e,t)}),mi=p("$ZodReadonly",(e,t)=>{b.init(e,t),v(e,"propValues",(r)=>r.def.innerType._zod.propValues),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"optin",(r)=>r.def.innerType?._zod?.optin),v(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(ho);return ho(o)}});function ho(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var hi=p("$ZodFunction",(e,t)=>(b.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?vt(e._def.input,n):n,i=Reflect.apply(r,this,o);if(e._def.output)return vt(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await bt(e._def.input,n):n,i=await Reflect.apply(r,this,o);if(e._def.output)return await bt(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let n=e.constructor;if(Array.isArray(r[0]))return new n({type:"function",input:new Rt({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new n({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),gi=p("$ZodPromise",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},n))});var _i=p("$ZodCustom",(e,t)=>{I.init(e,t),b.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>go(i,r,n,e));go(o,r,n,e);return}});function go(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(ee(o))}}class yi extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Ft="~memo",xi=[];function vi(e){return e!==null&&typeof e==="object"}function Lt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var bi=new WeakMap,$e=0,Xe=1,we=2;function Ye(e,t,r){let n=bi.get(e);if(n!==void 0)return n?we:$e;if(t.has(e))return we;t.add(e);let o=$e,i=(l)=>{if(o!==we&&l?._zod){let f=Ye(l,t,r);if(f>o)o=f}},s=(l,f)=>{let h=$e;for(let d of Reflect.ownKeys(l)){let m=Object.getOwnPropertyDescriptor(l,d);if(f&&!m.enumerable)continue;let _=m.get?Xe:m.value?._zod?Ye(m.value,t,r):$e;if(_>h)h=_}return h},c=(l)=>{if(l>o)o=l},u=e._zod.def,a=u.type;switch(a){case"object":{let l=ge(u);c(l?s(l,!0):Xe),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let l of u.items)i(l);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let l of u.options)i(l);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);c(l?Ye(l,t,!1):Xe);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in u){let f=Object.getOwnPropertyDescriptor(u,l);if(!f||f.get)continue;let h=f.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let d of h)i(d)}}return t.delete(e),Qc(e,o)}function Qc(e,t){if(t!==Xe)bi.set(e,t===we);return t}function eu(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var We,Ge=[],tu={alloc(e,t,r){let n=We;if(!n)return r;We=void 0;let o={value:r,issues:null};return n.set(t.value,o),Ge.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&ru(i,o.value))throw new yi;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let y=Ye(e,new Set,!1);if(y===$e){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(y===we||n)r=!0;else n=!0}let l=u.value;if(!vi(l))return s(u,a);let f=a[Ft];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[Ft]=f;let h;if(o===a)h=i;else h=eu(f,e),o=a,i=h;let d=h.get(l);if(d){if(u.value=d.value,d.issues){if(d.issues.length)u.issues.push(...Lt(d.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return u}We=h;let m=Ge.length,_=s(u,a);We=void 0;let x=Ge.length>m?Ge.pop():void 0;if(_ instanceof Promise)return _.then((y)=>{if(x)x.issues=y.issues.length?Lt(y.issues):xi;return y});if(x)x.issues=_.issues.length?Lt(_.issues):xi;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function zi(){return tu}function ru(e,t){let r=e[Ft]?.backEdges;return r!==void 0&&vi(t)&&r.has(t)}var nu=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=Yr(i.input),u=o(c,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ft(i.values[0])}`;return`Invalid option: expected one of ${at(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${at(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Mt(){return{localeError:nu()}}var $i;class wi{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function ou(){return new wi}($i=globalThis).__zod_globalRegistry??($i.__zod_globalRegistry=ou());var te=globalThis.__zod_globalRegistry;function ki(e){if(e.checks)e.checks=[...e.checks];return e}function Zi(e,t){return new e(ki({type:"string",...g(t)}))}function Si(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Pi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Oi(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Ii(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function Ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Ti(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Ni(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Ci(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Ri(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Di(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function ji(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Li(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Fi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Mi(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Ui(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function Bi(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Ji(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function Ki(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function Vi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Wi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function Gi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Xi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Yi(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Hi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function qi(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function Qi(e,t){return new e(ki({type:"number",checks:[],...g(t)}))}function es(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function ts(e,t){return new e({type:"boolean",...g(t)})}function rs(e){return new e({type:"unknown"})}function ns(e,t){return new e({type:"never",...g(t)})}function os(e,t){return new e({type:"void",...g(t)})}function is(e,t){return new e({type:"date",...g(t)})}function He(e,t){return new Pt({check:"less_than",...g(t),value:e,inclusive:!1})}function ne(e,t){return new Pt({check:"less_than",...g(t),value:e,inclusive:!0})}function qe(e,t){return new Ot({check:"greater_than",...g(t),value:e,inclusive:!1})}function oe(e,t){return new Ot({check:"greater_than",...g(t),value:e,inclusive:!0})}function Qe(e,t){return new Bn({check:"multiple_of",...g(t),value:e})}function et(e,t){return new Kn({check:"max_length",...g(t),maximum:e})}function ie(e,t){return new Vn({check:"min_length",...g(t),minimum:e})}function tt(e,t){return new Wn({check:"length_equals",...g(t),length:e})}function Ut(e,t){return new Gn({check:"string_format",format:"regex",...g(t),pattern:e})}function Bt(e){return new Xn({check:"string_format",format:"lowercase",...g(e)})}function Jt(e){return new Yn({check:"string_format",format:"uppercase",...g(e)})}function Kt(e,t){return new Hn({check:"string_format",format:"includes",...g(t),includes:e})}function Vt(e,t){return new qn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Wt(e,t){return new Qn({check:"string_format",format:"ends_with",...g(t),suffix:e})}function H(e){return new eo({check:"overwrite",tx:e})}function Gt(e){return H((t)=>t.normalize(e))}function Xt(){return H((e)=>e.trim())}function Yt(){return H((e)=>e.toLowerCase())}function Ht(){return H((e)=>e.toUpperCase())}function qt(){return H((e)=>Br(e))}function ss(e,t,r){return new e({type:"array",element:t,...g(r)})}function cs(e,t,r){let n=g(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function us(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function as(e,t){let r=iu((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ee(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ee(i))}},e(n.value,n)),t);return r}function iu(e,t){let r=new I({check:"custom",...g(t)});return r._zod.check=e,r}function ke(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))C(e,n,r[n]);return e}function Se(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??te,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function O(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function w(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let h=s.schema,d=t.processors[o.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,h,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;w(f,t,l),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)ke(s.schema,u);if(t.io==="input"&&T(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function ls(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Pe(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=n.get(c);if(u&&u!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,h=e.external.uri??((m)=>m);if(f)return{ref:h(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${h("__shared")}#/${c}/${ls(d)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:a+ls(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);if(c.def={...c.schema},a)c.defId=a;let l=c.schema;for(let f in l)delete l[f];l.$ref=u};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
56
|
+
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,c=re,u=!E.jitless,l=u&&Kr.value,f=t.catchall,h;e._zod.parse=(d,m)=>{h??(h=n.value);let _=d.value;if(!c(_))return d.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),d;if(u&&l&&m?.async===!1&&m.jitless!==!0){if(!s)s=i(t.shape);if(d=s(d,m),!f)return d;return ei([],_,d,m,h,e,m?.abortEarly===!0)}return r(d,m)}});function so(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!F(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>K(s,n,D())))}),t}var Rt=p("$ZodUnion",(e,t)=>{b.init(e,t),v(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),v(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),v(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),v(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Ee(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let c of t.options){let u=c._zod.run({value:n.value,issues:[]},o);if(u instanceof Promise)s.push(u),i=!0;else{if(u.issues.length===0)return u;s.push(u)}}if(!i)return so(s,n,e,o);return Promise.all(s).then((c)=>so(c,n,e,o))}});function tu(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(r)}"`);for(let o of n)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}var ri=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Rt.init(e,t);let r=e._zod.parse;v(e,"propValues",(o)=>{let i={},s=0;for(let c of o.def.options){let u=c._zod.propValues;if(!u||Object.keys(u).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);if(u[o.def.discriminator]?.has(void 0))s++;for(let[a,l]of Object.entries(u)){if(!Object.prototype.hasOwnProperty.call(i,a))C(i,a,new Set);for(let f of l)i[a].add(f)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=ge(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let n=he(()=>tu(t));e._zod.parse=(o,i)=>{let s=o.value;if(!re(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let c=s?.[t.discriminator],u=n.value.get(c);if(u&&(c!==void 0||i.direction!=="backward"))return u._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return r(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter((a)=>n.value.get(a)!==null),input:s,path:[t.discriminator],inst:e}),o}}),ni=p("$ZodIntersection",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([u,a])=>co(r,u,a));return co(r,i,s)}});function Et(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Q(e)&&Q(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=Et(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=Et(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function co(e,t,r){let n=new Map,o,i=new Map,s=(a,l)=>{let f;if(a.code==="unrecognized_keys"&&!a.path?.length)o??(o=a),f=a.keys;else if(a.code==="invalid_key"&&a.origin==="record"&&a.path?.length===1){let h=String(a.path[0]);if(!i.has(h))i.set(h,a);f=[h]}else return!1;for(let h of f){if(!n.has(h))n.set(h,{});n.get(h)[l]=!0}return!0};for(let a of t.issues)if(!s(a,"l"))e.issues.push(a);for(let a of r.issues)if(!s(a,"r"))e.issues.push(a);let c=[...n].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(c.length){let a=o?c.filter((l)=>o.keys.includes(l)):[];if(a.length)e.issues.push({...o,keys:a});for(let l of c)if(!a.includes(l)&&i.has(l))e.issues.push(i.get(l))}let u=Et(t.value,r.value);if(!u.valid){if(F(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`)}return e.value=u.data,e}var Dt=p("$ZodTuple",(e,t)=>{b.init(e,t);let r=t.items,n=E.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],u=uo(r,"optin"),a=uo(r,"optout");if(!t.rest){if(s.length<u)return o.issues.push({code:"too_small",minimum:u,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>r.length)o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=Array(r.length),f=t.rest?i?.abortEarly:void 0,h=!1;for(let d=0;d<r.length;d++){let m=r[d]._zod.run({value:s[d],issues:[]},i);if(m instanceof Promise)c.push(m.then((_)=>{l[d]=_}));else if(l[d]=m,f&&!h&&m.issues.length)h=F(m)}if(t.rest&&!h){let d=r.length-1,m=s.slice(r.length),_=o.issues.length;for(let x of m){if(f&&o.issues.length!==_){if(F(o,_))break;_=o.issues.length}d++;let y=t.rest._zod.run({value:x,issues:[]},i);if(y instanceof Promise)c.push(y.then((N)=>ao(N,o,d)));else ao(y,o,d)}}if(c.length)return Promise.all(c).then(()=>lo(l,o,r,s,a));return lo(l,o,r,s,a)}});function uo(e,t){for(let r=e.length-1;r>=0;r--)if(!(t==="optin"?e[r]._zod.optin!==void 0:e[r]._zod.optout==="optional"))return r+1;return 0}function ao(e,t,r){if(e.issues.length)t.issues.push(...J(r,e.issues));t.value[r]=e.value}function lo(e,t,r,n,o){for(let i=0;i<r.length;i++){let s=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...J(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=n.length;i--)if(r[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var oi=p("$ZodRecord",(e,t)=>{b.init(e,t);let r=E.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Q(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let s=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let u=new Set;for(let l of c)if(typeof l==="string"||typeof l==="number"||typeof l==="symbol"){if(u.add(typeof l==="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map((m)=>K(m,o,D())),input:l,path:[l],inst:e});continue}let h=f.value;if(h==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);if(d instanceof Promise)s.push(d.then((m)=>{if(m.issues.length)n.issues.push(...J(l,m.issues));n.value[h]=m.value}));else{if(d.issues.length)n.issues.push(...J(l,d.issues));n.value[h]=d.value}}let a;for(let l in i)if(!u.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;n.value[l]=i[l]}else a=a??[],a.push(l);if(a&&a.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let u;for(let a of Reflect.ownKeys(i)){if(a==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,a))continue;let l=t.keyType._zod.run({value:a,issues:[]},o);if(l instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof a==="string"&&ve.test(a)&&l.issues.length){let m=t.keyType._zod.run({value:Number(a),issues:[]},o);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length===0)l=m}if(l.issues.length){if(t.mode==="loose")n.value[a]=i[a];else if(c)u=u??[],u.push(a);else n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map((m)=>K(m,o,D())),input:a,path:[a],inst:e});continue}let h=l.value;if(h==="__proto__")continue;let d=t.valueType._zod.run({value:i[a],issues:[]},o);if(d instanceof Promise)s.push(d.then((m)=>{if(m.issues.length)n.issues.push(...J(a,m.issues));n.value[h]=m.value}));else{if(d.issues.length)n.issues.push(...J(a,d.issues));n.value[h]=d.value}}if(u&&u.length>0)n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}if(s.length)return Promise.all(s).then(()=>n);return n}});var ii=p("$ZodEnum",(e,t)=>{b.init(e,t);let r=de(t.entries),n=new Set(r);e._zod.values=n,v(e,"pattern",(o)=>{let i=de(o.def.entries).filter((s)=>Vr.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>Y(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),si=p("$ZodLiteral",(e,t)=>{b.init(e,t);let r=new Set(t.values);e._zod.values=r,v(e,"pattern",(n)=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?Y(i):i?Y(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;if(r.has(i))return n;return n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var ci=p("$ZodTransform",(e,t)=>{b.init(e,t),e._zod.optin="optional",E.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _e(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new V;return r.value=o,r}});function po(e,t){return e.value=t.issues.length?void 0:t.value,e}var jt=p("$ZodOptional",(e,t)=>{b.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ee(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>po(r,i));return po(r,o)}return t.innerType._zod.run(r,n)}}),ui=p("$ZodExactOptional",(e,t)=>{jt.init(e,t),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),ai=p("$ZodNullable",(e,t)=>{b.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Ee(n.source)}|null)$`):void 0}),v(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),li=p("$ZodDefault",(e,t)=>{b.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>fo(i,t));return fo(o,t)}});function fo(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var pi=p("$ZodPrefault",(e,t)=>{b.init(e,t),e._zod.optin="defaulted",v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),fi=p("$ZodNonOptional",(e,t)=>{b.init(e,t),v(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>mo(i,e));return mo(o,e)}});function mo(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function ho(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>K(o,n,D()))},input:e.value}),e}var di=p("$ZodCatch",(e,t)=>{b.init(e,t),v(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),v(e,"optout",(r)=>r.def.innerType._zod.optout),v(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>ho(r,i,t,n));return ho(r,o,t,n)}});var Lt=p("$ZodPipe",(e,t)=>{b.init(e,t),v(e,"values",(r)=>r.def.in._zod.values),v(e,"optin",(r)=>r.def.in._zod.optin),v(e,"optout",(r)=>r.def.out._zod.optout),v(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Be(s,t.in,n));return Be(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Be(i,t.out,n));return Be(o,t.out,n)}});function Be(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}var mi=p("$ZodPreprocess",(e,t)=>{Lt.init(e,t)}),hi=p("$ZodReadonly",(e,t)=>{b.init(e,t),v(e,"propValues",(r)=>r.def.innerType._zod.propValues),v(e,"values",(r)=>r.def.innerType._zod.values),v(e,"optin",(r)=>r.def.innerType?._zod?.optin),v(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(go);return go(o)}});function go(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var gi=p("$ZodFunction",(e,t)=>(b.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(r)=>{if(typeof r!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?bt(e._def.input,n):n,i=Reflect.apply(r,this,o);if(e._def.output)return bt(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(r)=>{if(typeof r!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await zt(e._def.input,n):n,i=await Reflect.apply(r,this,o);if(e._def.output)return await zt(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>{if(typeof r.value!=="function")return r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r;if(e._def.output&&e._def.output._zod.def.type==="promise")r.value=e.implementAsync(r.value);else r.value=e.implement(r.value);return r},e.input=(...r)=>{let n=e.constructor;if(Array.isArray(r[0]))return new n({type:"function",input:new Dt({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output});return new n({type:"function",input:r[0],output:e._def.output})},e.output=(r)=>new e.constructor({type:"function",input:e._def.input,output:r}),e)),_i=p("$ZodPromise",(e,t)=>{b.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},n))});var xi=p("$ZodCustom",(e,t)=>{I.init(e,t),b.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>_o(i,r,n,e));_o(o,r,n,e);return}});function _o(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(ee(o))}}class vi extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Mt="~memo",yi=[];function bi(e){return e!==null&&typeof e==="object"}function Ft(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var zi=new WeakMap,$e=0,Ye=1,we=2;function He(e,t,r){let n=zi.get(e);if(n!==void 0)return n?we:$e;if(t.has(e))return we;t.add(e);let o=$e,i=(l)=>{if(o!==we&&l?._zod){let f=He(l,t,r);if(f>o)o=f}},s=(l,f)=>{let h=$e;for(let d of Reflect.ownKeys(l)){let m=Object.getOwnPropertyDescriptor(l,d);if(f&&!m.enumerable)continue;let _=m.get?Ye:m.value?._zod?He(m.value,t,r):$e;if(_>h)h=_}return h},c=(l)=>{if(l>o)o=l},u=e._zod.def,a=u.type;switch(a){case"object":{let l=ge(u);c(l?s(l,!0):Ye),i(u.catchall);break}case"array":i(u.element);break;case"tuple":for(let l of u.items)i(l);i(u.rest);break;case"record":case"map":i(u.keyType),i(u.valueType);break;case"set":i(u.valueType);break;case"union":for(let l of u.options)i(l);break;case"intersection":i(u.left),i(u.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(u.innerType);break;case"pipe":i(u.in),i(u.out);break;case"function":i(u.input),i(u.output);break;case"lazy":{let l=u._cachedInner??(r?e._zod.innerType:void 0);c(l?He(l,t,!1):Ye);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in u){let f=Object.getOwnPropertyDescriptor(u,l);if(!f||f.get)continue;let h=f.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let d of h)i(d)}}return t.delete(e),ru(e,o)}function ru(e,t){if(t!==Ye)zi.set(e,t===we);return t}function nu(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Ge,Xe=[],ou={alloc(e,t,r){let n=Ge;if(!n)return r;Ge=void 0;let o={value:r,issues:null};return n.set(t.value,o),Xe.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&iu(i,o.value))throw new vi;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,c=(u,a)=>{if(r===void 0){let y=He(e,new Set,!1);if(y===$e){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(y===we||n)r=!0;else n=!0}let l=u.value;if(!bi(l))return s(u,a);let f=a[Mt];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[Mt]=f;let h;if(o===a)h=i;else h=nu(f,e),o=a,i=h;let d=h.get(l);if(d){if(u.value=d.value,d.issues){if(d.issues.length)u.issues.push(...Ft(d.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return u}Ge=h;let m=Xe.length,_=s(u,a);Ge=void 0;let x=Xe.length>m?Xe.pop():void 0;if(_ instanceof Promise)return _.then((y)=>{if(x)x.issues=y.issues.length?Ft(y.issues):yi;return y});if(x)x.issues=_.issues.length?Ft(_.issues):yi;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function $i(){return ou}function iu(e,t){let r=e[Mt]?.backEdges;return r!==void 0&&bi(t)&&r.has(t)}var su=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),c=Hr(i.input),u=o(c,i.input);return`Invalid input: expected ${s}, received ${u}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${dt(i.values[0])}`;return`Invalid option: expected one of ${lt(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);if(c)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${c.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);if(c)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${c.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${lt(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((c)=>`'${c}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function Ut(){return{localeError:su()}}var wi;class ki{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function cu(){return new ki}(wi=globalThis).__zod_globalRegistry??(wi.__zod_globalRegistry=cu());var te=globalThis.__zod_globalRegistry;function Zi(e){if(e.checks)e.checks=[...e.checks];return e}function Si(e,t){return new e(Zi({type:"string",...g(t)}))}function Pi(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function Oi(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function Ii(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function Ai(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function Ei(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function Ti(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function Ni(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function Ci(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function Ri(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Di(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function ji(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function Li(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Fi(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Mi(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Ui(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Bi(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function Ji(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function Ki(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function Vi(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function Wi(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Gi(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function Xi(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Yi(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Hi(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function qi(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function Qi(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function es(e,t){return new e(Zi({type:"number",checks:[],...g(t)}))}function ts(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...g(t)})}function rs(e,t){return new e({type:"boolean",...g(t)})}function ns(e){return new e({type:"unknown"})}function os(e,t){return new e({type:"never",...g(t)})}function is(e,t){return new e({type:"void",...g(t)})}function ss(e,t){return new e({type:"date",...g(t)})}function qe(e,t){return new Ot({check:"less_than",...g(t),value:e,inclusive:!1})}function ne(e,t){return new Ot({check:"less_than",...g(t),value:e,inclusive:!0})}function Qe(e,t){return new It({check:"greater_than",...g(t),value:e,inclusive:!1})}function oe(e,t){return new It({check:"greater_than",...g(t),value:e,inclusive:!0})}function et(e,t){return new Jn({check:"multiple_of",...g(t),value:e})}function tt(e,t){return new Vn({check:"max_length",...g(t),maximum:e})}function ie(e,t){return new Wn({check:"min_length",...g(t),minimum:e})}function rt(e,t){return new Gn({check:"length_equals",...g(t),length:e})}function Bt(e,t){return new Xn({check:"string_format",format:"regex",...g(t),pattern:e})}function Jt(e){return new Yn({check:"string_format",format:"lowercase",...g(e)})}function Kt(e){return new Hn({check:"string_format",format:"uppercase",...g(e)})}function Vt(e,t){return new qn({check:"string_format",format:"includes",...g(t),includes:e})}function Wt(e,t){return new Qn({check:"string_format",format:"starts_with",...g(t),prefix:e})}function Gt(e,t){return new eo({check:"string_format",format:"ends_with",...g(t),suffix:e})}function H(e){return new to({check:"overwrite",tx:e})}function Xt(e){return H((t)=>t.normalize(e))}function Yt(){return H((e)=>e.trim())}function Ht(){return H((e)=>e.toLowerCase())}function qt(){return H((e)=>e.toUpperCase())}function Qt(){return H((e)=>Jr(e))}function cs(e,t,r){return new e({type:"array",element:t,...g(r)})}function us(e,t,r){let n=g(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}function as(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function ls(e,t){let r=uu((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(ee(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(ee(i))}},e(n.value,n)),t);return r}function uu(e,t){let r=new I({check:"custom",...g(t)});return r._zod.check=e,r}function ke(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))C(e,n,r[n]);return e}function Se(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??te,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function O(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function w(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)s.schema=c;else{let l={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let h=s.schema,d=t.processors[o.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,h,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;w(f,t,l),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)ke(s.schema,u);if(t.io==="input"&&T(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function ps(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Pe(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let c=e.metadataRegistry.get(s[0])?.id;if(c){let u=n.get(c);if(u&&u!==s[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,s[0])}}let o=(s)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,h=e.external.uri??((m)=>m);if(f)return{ref:h(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${h("__shared")}#/${c}/${ps(d)}`}}let u="#",a=`${u}/${c}/`;if(s[1]===r&&!s[1].schema.id)return{ref:u};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:a+ps(l)}},i=(s)=>{if(s[1].schema.$ref)return;let c=s[1],{ref:u,defId:a}=o(s);if(c.def={...c.schema},a)c.defId=a;let l=c.schema;for(let f in l)delete l[f];l.$ref=u};if(e.cycles==="throw")for(let s of e.seen.entries()){let c=s[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
57
57
|
|
|
58
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function ds(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;ds(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var ms=new Set(["type","properties","required","additionalProperties"]),ps=["oneOf","anyOf"];function fs(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Qt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!ms.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let a of t){let l=a.properties?.[s]??fs(a);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let u=c.length===1?c[0]:Qt(c)??{allOf:c};C(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=fs(s);if(c&&!i.some((u)=>JSON.stringify(u)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function su(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of ms)if(o in e)return;let r=t.filter((o)=>ps.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=Qt(t);else{let o=r[0],i=ps.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter((u)=>u!==o),c=o[i].map((u)=>Qt([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,ke(e,n)}function Oe(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,l={...a},f=u.ref;if(u.ref=null,f){n(f);let d=e.seen.get(f),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))a.allOf=a.allOf??[],a.allOf.push(m);else ke(a,m);if(ke(a,l),c._zod.parent===f)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(!(x in l))delete a[x]}if(m.$ref&&d.def)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(x in d.def&&JSON.stringify(a[x])===JSON.stringify(d.def[x]))delete a[x]}}let h=c._zod.parent;if(h&&h!==f){n(h);let d=e.seen.get(h);if(d?.schema.$ref){if(a.$ref=d.schema.$ref,d.def)for(let m in a){if(m==="$ref"||m==="allOf")continue;if(m in d.def&&JSON.stringify(a[m])===JSON.stringify(d.def[m]))delete a[m]}}}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())ds(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let l=a?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(a);else c.set(l,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])su(a)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}ke(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;C(s,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ze(t,"input",e.processors),output:Ze(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function T(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return T(n.element,r);if(n.type==="set")return T(n.valueType,r);if(n.type==="lazy")return T(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return T(n.innerType,r);if(n.type==="intersection")return T(n.left,r)||T(n.right,r);if(n.type==="record"||n.type==="map")return T(n.keyType,r)||T(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return T(n.in,r)||T(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(T(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(T(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(T(o,r))return!0;if(n.rest&&T(n.rest,r))return!0;return!1}return!1}var hs=(e,t={})=>(r)=>{let n=Se({...r,processors:t});return w(e,n),Pe(n,e),Oe(n,e)},Ze=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Se({...o??{},target:i,io:t,processors:r});return w(e,s),Pe(s,e),Oe(s,e)};var se=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ce=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},gs=(e,t)=>{se(e,"minimum",t),ce(e,"maximum",t)},bs=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},zs=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},$s=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},ws=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},_s=(e,t)=>se(e,"minimum",t.minimum),xs=(e,t)=>ce(e,"maximum",t.maximum),ys=(e)=>(t,r)=>{ws(t,r.format);let[n,o]=e[r.format];se(t,"minimum",n),ce(t,"maximum",o)},cu={greater_than:(e,t)=>se(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ce(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>bs(e,t.value),number_format:ys(Te),bigint_format:ys(dt),min_length:_s,max_length:xs,length_equals:(e,t)=>gs(e,t.length),min_size:_s,max_size:xs,size_equals:(e,t)=>gs(e,t.size),string_format:(e,t)=>{if(ws(e,t.format),t.pattern)zs(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>$s(e,t.mime)};function A(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)cu[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)se(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)se(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ce(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ce(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)bs(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)$s(t,o.mime);for(let i of o.patterns??[])zs(t,i);return t}var uu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},au=new Map([[Tt,An],[Ve,En]]),ks=(e)=>au.get(e)??e,rr=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=A(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=uu[c]??c,o.format==="")delete o.format;if(c==="time"||l)delete o.format}if(a)o.contentEncoding=a;if(u&&u.size>0){let f=[...u].map(ks);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},nr=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:l}=A(e);o.type=l?"integer":"number";let f=typeof a==="number"&&a>=(i??Number.NEGATIVE_INFINITY),h=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)o.minimum=a,o.exclusiveMinimum=!0;else o.exclusiveMinimum=a;else if(typeof i==="number")o.minimum=i;if(h)if(d)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof s==="number")o.maximum=s;if(c){let m=new Set;for(let y of c)if(Number.isFinite(y)&&y!==0)m.add(Math.abs(y));else O(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[_,...x]=m;if(_!==void 0)o.multipleOf=_;if(x.length)o.allOf=[...o.allOf??[],...x.map((y)=>({multipleOf:y}))]}},or=(e,t,r,n)=>{r.type="boolean"},Zs=(e,t,r,n)=>{O(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Ss=(e,t,r,n)=>{O(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Ps=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Os=(e,t,r,n)=>{O(e,t,r,n,"Undefined cannot be represented in JSON Schema")},ir=(e,t,r,n)=>{O(e,t,r,n,"Void cannot be represented in JSON Schema")},sr=(e,t,r,n)=>{r.not={}},Is=(e,t,r,n)=>{},cr=(e,t,r,n)=>{},ur=(e,t,r,n)=>{O(e,t,r,n,"Date cannot be represented in JSON Schema")},ar=(e,t,r,n)=>{let o=e._zod.def,i=de(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},lr=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(O(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(O(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},As=(e,t,r,n)=>{O(e,t,r,n,"NaN cannot be represented in JSON Schema")},Es=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Ts=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:c}=A(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!c)return;if(c.length===0)o.not={};else if(c.length===1)o.contentMediaType=c[0];else o.anyOf=c.map((u)=>({contentMediaType:u}))},Ns=(e,t,r,n)=>{r.type="boolean"},pr=(e,t,r,n)=>{O(e,t,r,n,"Custom types cannot be represented in JSON Schema")},fr=(e,t,r,n)=>{O(e,t,r,n,"Function types cannot be represented in JSON Schema")},dr=(e,t,r,n)=>{O(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Cs=(e,t,r,n)=>{O(e,t,r,n,"Map cannot be represented in JSON Schema")},Rs=(e,t,r,n)=>{O(e,t,r,n,"Set cannot be represented in JSON Schema")},mr=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=A(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=w(i.element,t,{...n,path:[...n.path,"items"]})};function Ie(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Ie(t.out);if(t.type==="catch")return Ie(t.innerType);return e._zod.optin}var hr=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&O(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)C(o.properties,a,w(s[a],t,{...n,path:[...n.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let l=i.shape[a];if(t.io==="input"?Ie(l)===void 0:l._zod.optout===void 0)u.push(a)}if(u.length>0)o.required=u;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=w(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},gr=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>w(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},_r=(e,t,r,n)=>{let o=e._zod.def,i=w(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=w(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(a)=>("allOf"in a)&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)},xr=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((_,x)=>w(_,t,{...n,path:[...n.path,s,x]})),a=i.rest?w(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;while(l>0){let _=i.items[l-1];if(!(t.io==="input"?Ie(_)!==void 0:_._zod.optout==="optional"))break;l--}let f=i.items.length,h=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=u,h)o.items=!1;else if(a)o.items=a;if(l>0)o.minItems=l;if(h)o.maxItems=f}else if(t.target==="openapi-3.0"){if(o.items={anyOf:u},a)o.items.anyOf.push(a);if(l>0)o.minItems=l;if(h)o.maxItems=f}else{if(o.items=u,h)o.additionalItems=!1;else if(a)o.additionalItems=a;if(l>0)o.minItems=l;if(h)o.maxItems=f}let{minimum:d,maximum:m}=A(e);if(typeof d==="number")o.minItems=d;if(typeof m==="number")o.maxItems=m};function er(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let _=er(e,m,r);return _===m?t:_}for(let m of["anyOf","oneOf"]){let _=t[m];if(!Array.isArray(_))continue;let x=_.map((y)=>er(e,y,r));if(x.some((y,N)=>y!==_[N]))t={...t,[m]:x}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((m)=>m==="number"||m==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((m)=>typeof m==="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:u,exclusiveMaximum:a,multipleOf:l,format:f,id:h,...d}=t;if(d.enum)d.enum=d.enum.map((m)=>typeof m==="number"?String(m):m);else if(typeof d.const==="number")d.const=String(d.const);if(!o)return d;if(d.type="string",!i)d.pattern=(n.includes("number")?ve:Zt).source;return d}var tr=new WeakMap;function lu(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of tr.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=er(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}var yr=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=A(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=w(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)C(o.patternProperties,ks(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=w(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=tr.get(t);if(!l)l=[],tr.set(t,l),t.deferred.push(()=>lu(t));l.push(e)}o.additionalProperties=w(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=s._zod.values,a=t.io==="input"&&Ie(i.valueType)!==void 0;if(u&&!i.partial&&!a){let l=[...u].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)o.required=l.map(String)}},vr=(e,t,r,n)=>{let o=e._zod.def,i=w(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},br=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},zr=Symbol();function Ds(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,u)=>{if(typeof u!=="bigint")return u;return i=!0,null});if(!i)return JSON.parse(s);return O(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),zr}var $r=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=Ds(o.defaultValue,e,t,r,n);if(s!==zr)r.default=s},wr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Ds(o.defaultValue,e,t,r,n);if(s!==zr)r._prefault=s},kr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{O(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Zr=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;w(s,t,n);let c=t.seen.get(e);c.ref=s},Sr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Pr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},rt=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},js=(e,t,r,n)=>{let o=e._zod.innerType;w(o,t,n);let i=t.seen.get(e);i.ref=o},vs={string:rr,number:nr,boolean:or,bigint:Zs,symbol:Ss,null:Ps,undefined:Os,void:ir,never:sr,any:Is,unknown:cr,date:ur,enum:ar,literal:lr,nan:As,template_literal:Es,file:Ts,success:Ns,custom:pr,function:fr,transform:dr,map:Cs,set:Rs,array:mr,object:hr,union:gr,intersection:_r,tuple:xr,record:yr,nullable:vr,nonoptional:br,default:$r,prefault:wr,catch:kr,pipe:Zr,readonly:Sr,promise:Pr,optional:rt,lazy:js};function yl(e,t){if("_idmap"in e){let n=e,o=Se({...t,processors:vs}),i={};for(let u of n._idmap.entries()){let[a,l]=u;w(l,o)}let s={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let u of n._idmap.entries()){let[a,l]=u;Pe(o,l),C(s,a,Oe(o,l))}if(Object.keys(i).length>0){let u=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:i}}return{schemas:s}}let r=Se({...t,processors:vs});return w(e,r),Pe(r,e),Oe(r,e)}var Ls=new WeakSet([Object.prototype,Error.prototype]);function nt(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var xu=(e,t)=>{nn.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Ls.has(r))return;Ls.add(r),nt(r,"format",(n)=>(o)=>sn(n,o)),nt(r,"flatten",(n)=>(o)=>on(n,o)),nt(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,me,2)}),nt(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,me,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var j=p("ZodError",xu,void 0,{Parent:Error});var Fs=xe(j),Ms=ye(j),Us=Le(j),Bs=Fe(j),Js=un(j),Ks=an(j),Vs=ln(j),Ws=pn(j),Gs=fn(j),Xs=dn(j),Ys=mn(j),Hs=hn(j);function vu(){if(!E.localeError)D(Mt())}function Ae(){if(!E.memoizer)D({memoizer:zi()})}var z=p("ZodType",(e,t)=>(vu(),b.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(R(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return B(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(za(e,t))},superRefine(e,t){return this.check($a(e,t))},overwrite(e){return this.check(H(e))},optional(){return ec(this)},exactOptional(){return ua(this)},nullable(){return tc(this)},nullish(){return ec(tc(this))},nonoptional(e){return ma(this,e)},array(){return Ar(this)},or(e){return ea([this,e])},and(e){return na(this,e)},transform(e){return rc(this,uc(e))},default(e){return pa(this,e)},prefault(e){return da(this,e)},catch(e){return ga(this,e)},pipe(e){return rc(this,e)},readonly(){return ya(this)},describe(e){let t=this.clone();return te.add(t,{description:e}),t},meta(...e){if(e.length===0)return te.get(this);let t=this.clone();return te.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return De(this,"~standard",{...Et(this),jsonSchema:{input:Ze(this,"input"),output:Ze(this,"output")}})},set "~standard"(e){G(this,"~standard",e)},parse:function e(t,r){return Fs(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Ms(this,t,r,{callee:e})},safeParse(e,t){return Us(this,e,t)},async safeParseAsync(e,t){return Bs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){G(this,"spa",e)},validate(e,t){return zt(this,e,t)},validateAsync(e,t){return $t(this,e,t)},encode:function e(t,r){return Js(this,t,r,{callee:e})},decode:function e(t,r){return Ks(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Vs(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Ws(this,t,r,{callee:e})},safeEncode(e,t){return Gs(this,e,t)},safeDecode(e,t){return Xs(this,e,t)},async safeEncodeAsync(e,t){return Ys(this,e,t)},async safeDecodeAsync(e,t){return Hs(this,e,t)},toJSONSchema(e){return hs(this,{})(e)},get description(){return te.get(this)?.description},get _def(){return this._zod.def}}),nc=p("_ZodString",(e,t)=>{Ke.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rr(e,r,n,o)},ht({format:(e)=>A(e).format??null,minLength:(e)=>A(e).minimum??null,maxLength:(e)=>A(e).maximum??null},{regex(...e){return this.check(Ut(...e))},includes(...e){return this.check(Kt(...e))},startsWith(...e){return this.check(Vt(...e))},endsWith(...e){return this.check(Wt(...e))},min(...e){return this.check(ie(...e))},max(...e){return this.check(et(...e))},length(...e){return this.check(tt(...e))},nonempty(...e){return this.check(ie(1,...e))},lowercase(e){return this.check(Bt(e))},uppercase(e){return this.check(Jt(e))},trim(){return this.check(Xt())},normalize(...e){return this.check(Gt(...e))},toLowerCase(){return this.check(Yt())},toUpperCase(){return this.check(Ht())},slugify(){return this.check(qt())}})),bu=p("ZodString",(e,t)=>{Ke.init(e,t),nc.init(e,t)},{email(e){return this.check(Si(Zu,e))},url(e){return this.check(Ti(Pu,e))},jwt(e){return this.check(Gi(Bu,e))},emoji(e){return this.check(Ni(Ou,e))},guid(e){return this.check(Pi(Su,e))},uuid(e){return this.check(Oi(ot,e))},uuidv4(e){return this.check(Ii(ot,e))},uuidv6(e){return this.check(Ai(ot,e))},uuidv7(e){return this.check(Ei(ot,e))},nanoid(e){return this.check(Ci(Iu,e))},cuid(e){return this.check(Ri(Au,e))},cuid2(e){return this.check(Di(Eu,e))},ulid(e){return this.check(ji(Tu,e))},base64(e){return this.check(Ki(Fu,e))},base64url(e){return this.check(Vi(Mu,e))},xid(e){return this.check(Li(Nu,e))},ksuid(e){return this.check(Fi(Cu,e))},ipv4(e){return this.check(Mi(Ru,e))},ipv6(e){return this.check(Ui(Du,e))},cidrv4(e){return this.check(Bi(ju,e))},cidrv6(e){return this.check(Ji(Lu,e))},e164(e){return this.check(Wi(Uu,e))},datetime(e){return this.check(Xi(zu,e))},date(e){return this.check(Yi($u,e))},time(e){return this.check(Hi(wu,e))},duration(e){return this.check(qi(ku,e))}});function L(e){return Zi(bu,e)}var S=p("ZodStringFormat",(e,t)=>{Z.init(e,t),nc.init(e,t)}),zu=p("ZodISODateTime",(e,t)=>{Ao.init(e,t),S.init(e,t)}),$u=p("ZodISODate",(e,t)=>{Eo.init(e,t),S.init(e,t)}),wu=p("ZodISOTime",(e,t)=>{To.init(e,t),S.init(e,t)}),ku=p("ZodISODuration",(e,t)=>{No.init(e,t),S.init(e,t)}),Zu=p("ZodEmail",(e,t)=>{vo.init(e,t),S.init(e,t)});var Su=p("ZodGUID",(e,t)=>{xo.init(e,t),S.init(e,t)});var ot=p("ZodUUID",(e,t)=>{yo.init(e,t),S.init(e,t)});var Pu=p("ZodURL",(e,t)=>{$o.init(e,t),S.init(e,t)});var Ou=p("ZodEmoji",(e,t)=>{wo.init(e,t),S.init(e,t)});var Iu=p("ZodNanoID",(e,t)=>{ko.init(e,t),S.init(e,t)});var Au=p("ZodCUID",(e,t)=>{Zo.init(e,t),S.init(e,t)});var Eu=p("ZodCUID2",(e,t)=>{So.init(e,t),S.init(e,t)});var Tu=p("ZodULID",(e,t)=>{Po.init(e,t),S.init(e,t)});var Nu=p("ZodXID",(e,t)=>{Oo.init(e,t),S.init(e,t)});var Cu=p("ZodKSUID",(e,t)=>{Io.init(e,t),S.init(e,t)});var Ru=p("ZodIPv4",(e,t)=>{Co.init(e,t),S.init(e,t)});var Du=p("ZodIPv6",(e,t)=>{Do.init(e,t),S.init(e,t)});var ju=p("ZodCIDRv4",(e,t)=>{jo.init(e,t),S.init(e,t)});var Lu=p("ZodCIDRv6",(e,t)=>{Lo.init(e,t),S.init(e,t)});var Fu=p("ZodBase64",(e,t)=>{Mo.init(e,t),S.init(e,t)});var Mu=p("ZodBase64URL",(e,t)=>{Uo.init(e,t),S.init(e,t)});var Uu=p("ZodE164",(e,t)=>{Bo.init(e,t),S.init(e,t)});var Bu=p("ZodJWT",(e,t)=>{Jo.init(e,t),S.init(e,t)});var oc=p("ZodNumber",(e,t)=>{Nt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nr(e,r,n,o),e.isFinite=!0},ht({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=A(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=A(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=A(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>A(e).format??null},{gt(e,t){return this.check(qe(e,t))},gte(e,t){return this.check(oe(e,t))},min(e,t){return this.check(oe(e,t))},lt(e,t){return this.check(He(e,t))},lte(e,t){return this.check(ne(e,t))},max(e,t){return this.check(ne(e,t))},int(e){return this.check(qs(e))},safe(e){return this.check(qs(e))},positive(e){return this.check(qe(0,e))},nonnegative(e){return this.check(oe(0,e))},negative(e){return this.check(He(0,e))},nonpositive(e){return this.check(ne(0,e))},multipleOf(e,t){return this.check(Qe(e,t))},step(e,t){return this.check(Qe(e,t))},finite(){return this}}));function ae(e){return Qi(oc,e)}var Ju=p("ZodNumberFormat",(e,t)=>{Ko.init(e,t),oc.init(e,t)});function qs(e){return es(Ju,e)}var Ku=p("ZodBoolean",(e,t)=>{Vo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>or(e,r,n,o)});function Vu(e){return ts(Ku,e)}var Wu=p("ZodUnknown",(e,t)=>{Wo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cr(e,r,n,o)});function ue(){return rs(Wu)}var Gu=p("ZodNever",(e,t)=>{Go.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sr(e,r,n,o)});function Xu(e){return ns(Gu,e)}var Yu=p("ZodVoid",(e,t)=>{Xo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ir(e,r,n,o)});function Ep(e){return os(Yu,e)}var Hu=p("ZodDate",(e,t)=>{Yo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ur(e,r,n,o),e.min=(r,n)=>e.check(oe(r,n)),e.max=(r,n)=>e.check(ne(r,n))},ht({minDate:(e)=>{let{minimum:t}=A(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=A(e);return t?new Date(t):null}},{}));function Tp(e){return is(Hu,e)}var qu=p("ZodArray",(e,t)=>{Ae(),Ho.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mr(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ie(e,t))},nonempty(e){return this.check(ie(1,e))},max(e,t){return this.check(et(e,t))},length(e,t){return this.check(tt(e,t))},unwrap(){return this.element}});function Ar(e,t){return ss(qu,e,t)}var Qu=p("ZodObject",(e,t)=>{Ae(),ei.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hr(e,r,n,o),Zc(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return cc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(R(this._zod.def,{catchall:e}))},passthrough(){return this.clone(R(this._zod.def,{catchall:ue()}))},loose(){return this.clone(R(this._zod.def,{catchall:ue()}))},strict(){return this.clone(R(this._zod.def,{catchall:Xu()}))},strip(){return this.clone(R(this._zod.def,{catchall:void 0}))},extend(e){return xc(this,e)},safeExtend(e){return yc(this,e)},merge(e){return vc(this,e)},pick(e){return gc(this,e)},omit(e){return _c(this,e)},partial(...e){return Gr(Er,this,e[0])},exactPartial(...e){return Gr(ac,this,e[0],"exactPartial")},required(...e){return bc(lc,this,e[0])}});function it(e,t){let r={type:"object",shape:e??{},...g(t)};return new Qu(r)}var ic=p("ZodUnion",(e,t)=>{Ct.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gr(e,r,n,o),e.options=t.options});function ea(e,t){return new ic({type:"union",options:e,...g(t)})}var ta=p("ZodDiscriminatedUnion",(e,t)=>{ic.init(e,t),ti.init(e,t)});function Np(e,t,r){return new ta({type:"union",options:t,discriminator:e,...g(r)})}var ra=p("ZodIntersection",(e,t)=>{ri.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_r(e,r,n,o)});function na(e,t){return new ra({type:"intersection",left:e,right:t})}var oa=p("ZodTuple",(e,t)=>{Ae(),Rt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xr(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new Er({type:"optional",innerType:t}))})}});function ia(e,t,r){let n=t instanceof b,o=n?r:t;return new oa({type:"tuple",items:e,rest:n?t:null,...g(o)})}var Qs=p("ZodRecord",(e,t)=>{Ae(),ni.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yr(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function sc(e,t,r){if(!t||!t._zod)return new Qs({type:"record",keyType:L(),valueType:e,...g(t)});return new Qs({type:"record",keyType:e,valueType:t,...g(r)})}var Ir=p("ZodEnum",(e,t)=>{oi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ar(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Ir({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Ir({...t,checks:[],...g(o),entries:i})}});function cc(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Ir({type:"enum",entries:r,...g(t)})}var sa=p("ZodLiteral",(e,t)=>{ii.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lr(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Cp(e,t){return new sa({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}var ca=p("ZodTransform",(e,t)=>{Ae(),si.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _e(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ee(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(ee(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function uc(e){return new ca({type:"transform",transform:e})}var Er=p("ZodOptional",(e,t)=>{Dt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ec(e){return new Er({type:"optional",innerType:e})}var ac=p("ZodExactOptional",(e,t)=>{ci.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>rt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ua(e){return new ac({type:"optional",innerType:e})}var aa=p("ZodNullable",(e,t)=>{ui.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function tc(e){return new aa({type:"nullable",innerType:e})}var la=p("ZodDefault",(e,t)=>{ai.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$r(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pa(e,t){return new la({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():pt(t)}})}var fa=p("ZodPrefault",(e,t)=>{li.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function da(e,t){return new fa({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():pt(t)}})}var lc=p("ZodNonOptional",(e,t)=>{pi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>br(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ma(e,t){return new lc({type:"nonoptional",innerType:e,...g(t)})}var ha=p("ZodCatch",(e,t)=>{fi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ga(e,t){return new ha({type:"catch",innerType:e,catchValue:typeof t==="function"?t:qr(t)})}var pc=p("ZodPipe",(e,t)=>{jt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.in=t.in,e.out=t.out});function rc(e,t){return new pc({type:"pipe",in:e,out:t})}var _a=p("ZodPreprocess",(e,t)=>{pc.init(e,t),di.init(e,t)}),xa=p("ZodReadonly",(e,t)=>{mi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ya(e){return new xa({type:"readonly",innerType:e})}var va=p("ZodPromise",(e,t)=>{gi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Rp(e){return new va({type:"promise",innerType:e})}var ba=p("ZodFunction",(e,t)=>{hi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fr(e,r,n,o)});function Dp(e){return new ba({type:"function",input:Array.isArray(e?.input)?ia(e?.input):e?.input??Ar(ue()),output:e?.output??ue()})}var fc=p("ZodCustom",(e,t)=>{_i.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pr(e,r,n,o)});function jp(e,t){return cs(fc,e??(()=>!0),t)}function za(e,t={}){return us(fc,e,t)}function $a(e,t){return as(e,t)}function Lp(e,t){return new _a({type:"pipe",in:uc(e),out:t})}var Tr=L().min(1),ka=Ar(L()).optional(),Za=sc(L(),ue()).optional(),Sa=cc(["act","plan","yolo","zen"]).optional(),Pa=it({providerId:Tr,modelId:L().optional()}).optional(),Nr={id:L().optional(),title:L().optional(),prompt:L().optional(),workspaceRoot:L().optional(),cwd:L().optional(),modelSelection:Pa,systemPrompt:L().optional(),mode:Sa,timeoutSeconds:ae().int().positive().optional(),maxIterations:ae().int().positive().optional(),tags:ka,enabled:Vu().optional(),metadata:Za},Oa=it({...Nr}).strict(),Ia=it({...Nr,schedule:Tr,timezone:L().optional()}).strict(),Aa=it({...Nr,event:Tr,filters:sc(L(),ue()).optional(),debounceSeconds:ae().int().nonnegative().optional(),dedupeWindowSeconds:ae().int().nonnegative().optional(),cooldownSeconds:ae().int().nonnegative().optional(),maxParallel:ae().int().positive().optional()}).strict(),Ea=["schedule","timezone"],Ta=["event","filters","debounceSeconds","dedupeWindowSeconds","cooldownSeconds","maxParallel"];export{Aa as AutomationEventFrontmatterSchema,Oa as AutomationOneOffFrontmatterSchema,Ia as AutomationScheduleFrontmatterSchema,Ta as EVENT_ONLY_FIELDS,Ea as SCHEDULE_ONLY_FIELDS};
|
|
58
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let c=s[1];if(t===s[0]){i(s);continue}if(e.external){let a=e.external.registry.get(s[0])?.id;if(t!==s[0]&&a){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(c.cycle){i(s);continue}if(c.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function ms(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;ms(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}var hs=new Set(["type","properties","required","additionalProperties"]),fs=["oneOf","anyOf"];function ds(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function er(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!hs.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let c=[];for(let a of t){let l=a.properties?.[s]??ds(a);if(l===null||l===void 0)continue;if(!c.some((f)=>JSON.stringify(f)===JSON.stringify(l)))c.push(l)}let u=c.length===1?c[0]:er(c)??{allOf:c};C(r,s,u)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let c=ds(s);if(c&&!i.some((u)=>JSON.stringify(u)===JSON.stringify(c)))i.push(c)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function au(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of hs)if(o in e)return;let r=t.filter((o)=>fs.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=er(t);else{let o=r[0],i=fs.find((u)=>Array.isArray(o[u]));if(Object.keys(o).length!==1)return;let s=t.filter((u)=>u!==o),c=o[i].map((u)=>er([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,ke(e,n)}function Oe(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(c)=>{let u=e.seen.get(c);if(u.ref===null)return;let a=u.def??u.schema,l={...a},f=u.ref;if(u.ref=null,f){n(f);let d=e.seen.get(f),m=d.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))a.allOf=a.allOf??[],a.allOf.push(m);else ke(a,m);if(ke(a,l),c._zod.parent===f)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(!(x in l))delete a[x]}if(m.$ref&&d.def)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(x in d.def&&JSON.stringify(a[x])===JSON.stringify(d.def[x]))delete a[x]}}let h=c._zod.parent;if(h&&h!==f){n(h);let d=e.seen.get(h);if(d?.schema.$ref){if(a.$ref=d.schema.$ref,d.def)for(let m in a){if(m==="$ref"||m==="allOf")continue;if(m in d.def&&JSON.stringify(a[m])===JSON.stringify(d.def[m]))delete a[m]}}}e.override({zodSchema:c,jsonSchema:a,path:u.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())ms(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=new Map;for(let u of e.seen.values())for(let a of[u.schema,u.def]){let l=a?.allOf;if(!Array.isArray(l))continue;let f=c.get(l);if(f)f.push(a);else c.set(l,[a])}for(let u of e.intersections)for(let a of c.get(u)??[])au(a)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}ke(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let u=c[1];if(u.def&&u.defId){if(u.def.id===u.defId)delete u.def.id;C(s,u.defId,u.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ze(t,"input",e.processors),output:Ze(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function T(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return T(n.element,r);if(n.type==="set")return T(n.valueType,r);if(n.type==="lazy")return T(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return T(n.innerType,r);if(n.type==="intersection")return T(n.left,r)||T(n.right,r);if(n.type==="record"||n.type==="map")return T(n.keyType,r)||T(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return T(n.in,r)||T(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(T(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(T(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(T(o,r))return!0;if(n.rest&&T(n.rest,r))return!0;return!1}return!1}var gs=(e,t={})=>(r)=>{let n=Se({...r,processors:t});return w(e,n),Pe(n,e),Oe(n,e)},Ze=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Se({...o??{},target:i,io:t,processors:r});return w(e,s),Pe(s,e),Oe(s,e)};var se=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},ce=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},_s=(e,t)=>{se(e,"minimum",t),ce(e,"maximum",t)},zs=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},$s=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ws=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},ks=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},xs=(e,t)=>se(e,"minimum",t.minimum),ys=(e,t)=>ce(e,"maximum",t.maximum),vs=(e)=>(t,r)=>{ks(t,r.format);let[n,o]=e[r.format];se(t,"minimum",n),ce(t,"maximum",o)},lu={greater_than:(e,t)=>se(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>ce(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>zs(e,t.value),number_format:vs(Te),bigint_format:vs(mt),min_length:xs,max_length:ys,length_equals:(e,t)=>_s(e,t.length),min_size:xs,max_size:ys,size_equals:(e,t)=>_s(e,t.size),string_format:(e,t)=>{if(ks(e,t.format),t.pattern)$s(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>ws(e,t.mime)};function A(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)lu[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)se(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)se(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)ce(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)ce(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)zs(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)ws(t,o.mime);for(let i of o.patterns??[])$s(t,i);return t}var pu={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},fu=new Map([[Nt,En],[We,Tn]]),Zs=(e)=>fu.get(e)??e,nr=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=A(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=pu[c]??c,o.format==="")delete o.format;if(c==="time"||l)delete o.format}if(a)o.contentEncoding=a;if(u&&u.size>0){let f=[...u].map(Zs);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},or=(e,t,r,n)=>{let o=r,{minimum:i,maximum:s,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:a,isInt:l}=A(e);o.type=l?"integer":"number";let f=typeof a==="number"&&a>=(i??Number.NEGATIVE_INFINITY),h=typeof u==="number"&&u<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(d)o.minimum=a,o.exclusiveMinimum=!0;else o.exclusiveMinimum=a;else if(typeof i==="number")o.minimum=i;if(h)if(d)o.maximum=u,o.exclusiveMaximum=!0;else o.exclusiveMaximum=u;else if(typeof s==="number")o.maximum=s;if(c){let m=new Set;for(let y of c)if(Number.isFinite(y)&&y!==0)m.add(Math.abs(y));else O(e,t,o,n,`A multipleOf divisor of ${y} cannot be represented in JSON Schema`);let[_,...x]=m;if(_!==void 0)o.multipleOf=_;if(x.length)o.allOf=[...o.allOf??[],...x.map((y)=>({multipleOf:y}))]}},ir=(e,t,r,n)=>{r.type="boolean"},Ss=(e,t,r,n)=>{O(e,t,r,n,"BigInt cannot be represented in JSON Schema")},Ps=(e,t,r,n)=>{O(e,t,r,n,"Symbols cannot be represented in JSON Schema")},Os=(e,t,r,n)=>{if(t.target==="openapi-3.0")r.type="string",r.nullable=!0,r.enum=[null];else r.type="null"},Is=(e,t,r,n)=>{O(e,t,r,n,"Undefined cannot be represented in JSON Schema")},sr=(e,t,r,n)=>{O(e,t,r,n,"Void cannot be represented in JSON Schema")},cr=(e,t,r,n)=>{r.not={}},As=(e,t,r,n)=>{},ur=(e,t,r,n)=>{},ar=(e,t,r,n)=>{O(e,t,r,n,"Date cannot be represented in JSON Schema")},lr=(e,t,r,n)=>{let o=e._zod.def,i=de(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},pr=(e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(O(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(O(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")r.enum=[s];else r.const=s}else{if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";if(i.every((s)=>typeof s==="boolean"))r.type="boolean";if(i.every((s)=>s===null))r.type="null";r.enum=i}},Es=(e,t,r,n)=>{O(e,t,r,n,"NaN cannot be represented in JSON Schema")},Ts=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Ns=(e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:c}=A(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!c)return;if(c.length===0)o.not={};else if(c.length===1)o.contentMediaType=c[0];else o.anyOf=c.map((u)=>({contentMediaType:u}))},Cs=(e,t,r,n)=>{r.type="boolean"},fr=(e,t,r,n)=>{O(e,t,r,n,"Custom types cannot be represented in JSON Schema")},dr=(e,t,r,n)=>{O(e,t,r,n,"Function types cannot be represented in JSON Schema")},mr=(e,t,r,n)=>{O(e,t,r,n,"Transforms cannot be represented in JSON Schema")},Rs=(e,t,r,n)=>{O(e,t,r,n,"Map cannot be represented in JSON Schema")},Ds=(e,t,r,n)=>{O(e,t,r,n,"Set cannot be represented in JSON Schema")},hr=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=A(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=w(i.element,t,{...n,path:[...n.path,"items"]})};function Ie(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Ie(t.out);if(t.type==="catch")return Ie(t.innerType);return e._zod.optin}var gr=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&O(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let a in s)C(o.properties,a,w(s[a],t,{...n,path:[...n.path,"properties",a]}));let u=[];for(let a of Object.keys(s)){let l=i.shape[a];if(t.io==="input"?Ie(l)===void 0:l._zod.optout===void 0)u.push(a)}if(u.length>0)o.required=u;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=w(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},_r=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>w(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},xr=(e,t,r,n)=>{let o=e._zod.def,i=w(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=w(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=(a)=>("allOf"in a)&&Object.keys(a).length===1,u=[...c(i)?i.allOf:[i],...c(s)?s.allOf:[s]];r.allOf=u,t.intersections.push(u)},yr=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",u=i.items.map((_,x)=>w(_,t,{...n,path:[...n.path,s,x]})),a=i.rest?w(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;while(l>0){let _=i.items[l-1];if(!(t.io==="input"?Ie(_)!==void 0:_._zod.optout==="optional"))break;l--}let f=i.items.length,h=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=u,h)o.items=!1;else if(a)o.items=a;if(l>0)o.minItems=l;if(h)o.maxItems=f}else if(t.target==="openapi-3.0"){if(o.items={anyOf:u},a)o.items.anyOf.push(a);if(l>0)o.minItems=l;if(h)o.maxItems=f}else{if(o.items=u,h)o.additionalItems=!1;else if(a)o.additionalItems=a;if(l>0)o.minItems=l;if(h)o.maxItems=f}let{minimum:d,maximum:m}=A(e);if(typeof d==="number")o.minItems=d;if(typeof m==="number")o.maxItems=m};function tr(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let m=e.get(t)?.def;if(!m)return t;let _=tr(e,m,r);return _===m?t:_}for(let m of["anyOf","oneOf"]){let _=t[m];if(!Array.isArray(_))continue;let x=_.map((y)=>tr(e,y,r));if(x.some((y,N)=>y!==_[N]))t={...t,[m]:x}}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some((m)=>m==="number"||m==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((m)=>typeof m==="number"))return t;let{minimum:s,maximum:c,exclusiveMinimum:u,exclusiveMaximum:a,multipleOf:l,format:f,id:h,...d}=t;if(d.enum)d.enum=d.enum.map((m)=>typeof m==="number"?String(m):m);else if(typeof d.const==="number")d.const=String(d.const);if(!o)return d;if(d.type="string",!i)d.pattern=(n.includes("number")?ve:St).source;return d}var rr=new WeakMap;function du(e){let t=new Map;for(let n of e.seen.values())if(n.def&&!t.has(n.schema))t.set(n.schema,n);let r=new Map;for(let n of rr.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let s=tr(t,i,new Set);if(s!==i)r.set(i,s)}if(!r.size)return;for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);if(i)o.propertyNames=i}}var vr=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let s=i.keyType,c=A(s).patterns;if(i.mode==="loose"&&c&&c.size>0){let l=w(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let f of c)C(o.patternProperties,Zs(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=w(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let l=rr.get(t);if(!l)l=[],rr.set(t,l),t.deferred.push(()=>du(t));l.push(e)}o.additionalProperties=w(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let u=s._zod.values,a=t.io==="input"&&Ie(i.valueType)!==void 0;if(u&&!i.partial&&!a){let l=[...u].filter((f)=>typeof f==="string"||typeof f==="number");if(l.length>0)o.required=l.map(String)}},br=(e,t,r,n)=>{let o=e._zod.def,i=w(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},zr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},$r=Symbol();function js(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(c,u)=>{if(typeof u!=="bigint")return u;return i=!0,null});if(!i)return JSON.parse(s);return O(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),$r}var wr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=js(o.defaultValue,e,t,r,n);if(s!==$r)r.default=s},kr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=js(o.defaultValue,e,t,r,n);if(s!==$r)r._prefault=s},Zr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{O(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},Sr=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;w(s,t,n);let c=t.seen.get(e);c.ref=s},Pr=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Or=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},nt=(e,t,r,n)=>{let o=e._zod.def;w(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Ls=(e,t,r,n)=>{let o=e._zod.innerType;w(o,t,n);let i=t.seen.get(e);i.ref=o},bs={string:nr,number:or,boolean:ir,bigint:Ss,symbol:Ps,null:Os,undefined:Is,void:sr,never:cr,any:As,unknown:ur,date:ar,enum:lr,literal:pr,nan:Es,template_literal:Ts,file:Ns,success:Cs,custom:fr,function:dr,transform:mr,map:Rs,set:Ds,array:hr,object:gr,union:_r,intersection:xr,tuple:yr,record:vr,nullable:br,nonoptional:zr,default:wr,prefault:kr,catch:Zr,pipe:Sr,readonly:Pr,promise:Or,optional:nt,lazy:Ls};function zl(e,t){if("_idmap"in e){let n=e,o=Se({...t,processors:bs}),i={};for(let u of n._idmap.entries()){let[a,l]=u;w(l,o)}let s={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let u of n._idmap.entries()){let[a,l]=u;Pe(o,l),C(s,a,Oe(o,l))}if(Object.keys(i).length>0){let u=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:i}}return{schemas:s}}let r=Se({...t,processors:bs});return w(e,r),Pe(r,e),Oe(r,e)}var Fs=new WeakSet([Object.prototype,Error.prototype]);function ot(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var bu=(e,t)=>{on.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Fs.has(r))return;Fs.add(r),ot(r,"format",(n)=>(o)=>cn(n,o)),ot(r,"flatten",(n)=>(o)=>sn(n,o)),ot(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,me,2)}),ot(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,me,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var j=p("ZodError",bu,void 0,{Parent:Error});var Ms=xe(j),Us=ye(j),Bs=Fe(j),Js=Me(j),Ks=an(j),Vs=ln(j),Ws=pn(j),Gs=fn(j),Xs=dn(j),Ys=mn(j),Hs=hn(j),qs=gn(j);function $u(){if(!E.localeError)D(Ut())}function Ae(){if(!E.memoizer)D({memoizer:$i()})}var z=p("ZodType",(e,t)=>($u(),b.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(R(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return B(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(ka(e,t))},superRefine(e,t){return this.check(Za(e,t))},overwrite(e){return this.check(H(e))},optional(){return tc(this)},exactOptional(){return pa(this)},nullable(){return rc(this)},nullish(){return tc(rc(this))},nonoptional(e){return _a(this,e)},array(){return Er(this)},or(e){return na([this,e])},and(e){return sa(this,e)},transform(e){return nc(this,ac(e))},default(e){return ma(this,e)},prefault(e){return ga(this,e)},catch(e){return ya(this,e)},pipe(e){return nc(this,e)},readonly(){return za(this)},describe(e){let t=this.clone();return te.add(t,{description:e}),t},meta(...e){if(e.length===0)return te.get(this);let t=this.clone();return te.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return je(this,"~standard",{...Tt(this),jsonSchema:{input:Ze(this,"input"),output:Ze(this,"output")}})},set "~standard"(e){G(this,"~standard",e)},parse:function e(t,r){return Ms(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Us(this,t,r,{callee:e})},safeParse(e,t){return Bs(this,e,t)},async safeParseAsync(e,t){return Js(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){G(this,"spa",e)},validate(e,t){return $t(this,e,t)},validateAsync(e,t){return wt(this,e,t)},encode:function e(t,r){return Ks(this,t,r,{callee:e})},decode:function e(t,r){return Vs(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Ws(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Gs(this,t,r,{callee:e})},safeEncode(e,t){return Xs(this,e,t)},safeDecode(e,t){return Ys(this,e,t)},async safeEncodeAsync(e,t){return Hs(this,e,t)},async safeDecodeAsync(e,t){return qs(this,e,t)},toJSONSchema(e){return gs(this,{})(e)},get description(){return te.get(this)?.description},get _def(){return this._zod.def}}),oc=p("_ZodString",(e,t)=>{Ve.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nr(e,r,n,o)},gt({format:(e)=>A(e).format??null,minLength:(e)=>A(e).minimum??null,maxLength:(e)=>A(e).maximum??null},{regex(...e){return this.check(Bt(...e))},includes(...e){return this.check(Vt(...e))},startsWith(...e){return this.check(Wt(...e))},endsWith(...e){return this.check(Gt(...e))},min(...e){return this.check(ie(...e))},max(...e){return this.check(tt(...e))},length(...e){return this.check(rt(...e))},nonempty(...e){return this.check(ie(1,...e))},lowercase(e){return this.check(Jt(e))},uppercase(e){return this.check(Kt(e))},trim(){return this.check(Yt())},normalize(...e){return this.check(Xt(...e))},toLowerCase(){return this.check(Ht())},toUpperCase(){return this.check(qt())},slugify(){return this.check(Qt())}})),wu=p("ZodString",(e,t)=>{Ve.init(e,t),oc.init(e,t)},{email(e){return this.check(Pi(Ou,e))},url(e){return this.check(Ni(Au,e))},jwt(e){return this.check(Xi(Vu,e))},emoji(e){return this.check(Ci(Eu,e))},guid(e){return this.check(Oi(Iu,e))},uuid(e){return this.check(Ii(it,e))},uuidv4(e){return this.check(Ai(it,e))},uuidv6(e){return this.check(Ei(it,e))},uuidv7(e){return this.check(Ti(it,e))},nanoid(e){return this.check(Ri(Tu,e))},cuid(e){return this.check(Di(Nu,e))},cuid2(e){return this.check(ji(Cu,e))},ulid(e){return this.check(Li(Ru,e))},base64(e){return this.check(Vi(Bu,e))},base64url(e){return this.check(Wi(Ju,e))},xid(e){return this.check(Fi(Du,e))},ksuid(e){return this.check(Mi(ju,e))},ipv4(e){return this.check(Ui(Lu,e))},ipv6(e){return this.check(Bi(Fu,e))},cidrv4(e){return this.check(Ji(Mu,e))},cidrv6(e){return this.check(Ki(Uu,e))},e164(e){return this.check(Gi(Ku,e))},datetime(e){return this.check(Yi(ku,e))},date(e){return this.check(Hi(Zu,e))},time(e){return this.check(qi(Su,e))},duration(e){return this.check(Qi(Pu,e))}});function L(e){return Si(wu,e)}var S=p("ZodStringFormat",(e,t)=>{Z.init(e,t),oc.init(e,t)}),ku=p("ZodISODateTime",(e,t)=>{Eo.init(e,t),S.init(e,t)}),Zu=p("ZodISODate",(e,t)=>{To.init(e,t),S.init(e,t)}),Su=p("ZodISOTime",(e,t)=>{No.init(e,t),S.init(e,t)}),Pu=p("ZodISODuration",(e,t)=>{Co.init(e,t),S.init(e,t)}),Ou=p("ZodEmail",(e,t)=>{bo.init(e,t),S.init(e,t)});var Iu=p("ZodGUID",(e,t)=>{yo.init(e,t),S.init(e,t)});var it=p("ZodUUID",(e,t)=>{vo.init(e,t),S.init(e,t)});var Au=p("ZodURL",(e,t)=>{wo.init(e,t),S.init(e,t)});var Eu=p("ZodEmoji",(e,t)=>{ko.init(e,t),S.init(e,t)});var Tu=p("ZodNanoID",(e,t)=>{Zo.init(e,t),S.init(e,t)});var Nu=p("ZodCUID",(e,t)=>{So.init(e,t),S.init(e,t)});var Cu=p("ZodCUID2",(e,t)=>{Po.init(e,t),S.init(e,t)});var Ru=p("ZodULID",(e,t)=>{Oo.init(e,t),S.init(e,t)});var Du=p("ZodXID",(e,t)=>{Io.init(e,t),S.init(e,t)});var ju=p("ZodKSUID",(e,t)=>{Ao.init(e,t),S.init(e,t)});var Lu=p("ZodIPv4",(e,t)=>{Ro.init(e,t),S.init(e,t)});var Fu=p("ZodIPv6",(e,t)=>{jo.init(e,t),S.init(e,t)});var Mu=p("ZodCIDRv4",(e,t)=>{Lo.init(e,t),S.init(e,t)});var Uu=p("ZodCIDRv6",(e,t)=>{Fo.init(e,t),S.init(e,t)});var Bu=p("ZodBase64",(e,t)=>{Uo.init(e,t),S.init(e,t)});var Ju=p("ZodBase64URL",(e,t)=>{Bo.init(e,t),S.init(e,t)});var Ku=p("ZodE164",(e,t)=>{Jo.init(e,t),S.init(e,t)});var Vu=p("ZodJWT",(e,t)=>{Ko.init(e,t),S.init(e,t)});var ic=p("ZodNumber",(e,t)=>{Ct.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>or(e,r,n,o),e.isFinite=!0},gt({minValue:(e)=>{let{minimum:t,exclusiveMinimum:r}=A(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:r}=A(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:r}=A(e);return!!t||!!r?.some(Number.isSafeInteger)},format:(e)=>A(e).format??null},{gt(e,t){return this.check(Qe(e,t))},gte(e,t){return this.check(oe(e,t))},min(e,t){return this.check(oe(e,t))},lt(e,t){return this.check(qe(e,t))},lte(e,t){return this.check(ne(e,t))},max(e,t){return this.check(ne(e,t))},int(e){return this.check(Qs(e))},safe(e){return this.check(Qs(e))},positive(e){return this.check(Qe(0,e))},nonnegative(e){return this.check(oe(0,e))},negative(e){return this.check(qe(0,e))},nonpositive(e){return this.check(ne(0,e))},multipleOf(e,t){return this.check(et(e,t))},step(e,t){return this.check(et(e,t))},finite(){return this}}));function ae(e){return es(ic,e)}var Wu=p("ZodNumberFormat",(e,t)=>{Vo.init(e,t),ic.init(e,t)});function Qs(e){return ts(Wu,e)}var Gu=p("ZodBoolean",(e,t)=>{Wo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ir(e,r,n,o)});function Xu(e){return rs(Gu,e)}var Yu=p("ZodUnknown",(e,t)=>{Go.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ur(e,r,n,o)});function ue(){return ns(Yu)}var Hu=p("ZodNever",(e,t)=>{Xo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cr(e,r,n,o)});function qu(e){return os(Hu,e)}var Qu=p("ZodVoid",(e,t)=>{Yo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sr(e,r,n,o)});function Cp(e){return is(Qu,e)}var ea=p("ZodDate",(e,t)=>{Ho.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ar(e,r,n,o),e.min=(r,n)=>e.check(oe(r,n)),e.max=(r,n)=>e.check(ne(r,n))},gt({minDate:(e)=>{let{minimum:t}=A(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=A(e);return t?new Date(t):null}},{}));function Rp(e){return ss(ea,e)}var ta=p("ZodArray",(e,t)=>{Ae(),qo.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hr(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ie(e,t))},nonempty(e){return this.check(ie(1,e))},max(e,t){return this.check(tt(e,t))},length(e,t){return this.check(rt(e,t))},unwrap(){return this.element}});function Er(e,t){return cs(ta,e,t)}var ra=p("ZodObject",(e,t)=>{Ae(),ti.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gr(e,r,n,o),Sc(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return uc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(R(this._zod.def,{catchall:e}))},passthrough(){return this.clone(R(this._zod.def,{catchall:ue()}))},loose(){return this.clone(R(this._zod.def,{catchall:ue()}))},strict(){return this.clone(R(this._zod.def,{catchall:qu()}))},strip(){return this.clone(R(this._zod.def,{catchall:void 0}))},extend(e){return yc(this,e)},safeExtend(e){return vc(this,e)},merge(e){return bc(this,e)},pick(e){return _c(this,e)},omit(e){return xc(this,e)},partial(...e){return Xr(Tr,this,e[0])},exactPartial(...e){return Xr(lc,this,e[0],"exactPartial")},required(...e){return zc(pc,this,e[0])}});function st(e,t){let r={type:"object",shape:e??{},...g(t)};return new ra(r)}var sc=p("ZodUnion",(e,t)=>{Rt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_r(e,r,n,o),e.options=t.options});function na(e,t){return new sc({type:"union",options:e,...g(t)})}var oa=p("ZodDiscriminatedUnion",(e,t)=>{sc.init(e,t),ri.init(e,t)});function Dp(e,t,r){return new oa({type:"union",options:t,discriminator:e,...g(r)})}var ia=p("ZodIntersection",(e,t)=>{ni.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xr(e,r,n,o)});function sa(e,t){return new ia({type:"intersection",left:e,right:t})}var ca=p("ZodTuple",(e,t)=>{Ae(),Dt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yr(e,r,n,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new Tr({type:"optional",innerType:t}))})}});function ua(e,t,r){let n=t instanceof b,o=n?r:t;return new ca({type:"tuple",items:e,rest:n?t:null,...g(o)})}var ec=p("ZodRecord",(e,t)=>{Ae(),oi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vr(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function cc(e,t,r){if(!t||!t._zod)return new ec({type:"record",keyType:L(),valueType:e,...g(t)});return new ec({type:"record",keyType:e,valueType:t,...g(r)})}var Ar=p("ZodEnum",(e,t)=>{ii.init(e,t),z.init(e,t),e._zod.processJSONSchema=(n,o,i)=>lr(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Ar({...t,checks:[],...g(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Ar({...t,checks:[],...g(o),entries:i})}});function uc(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Ar({type:"enum",entries:r,...g(t)})}var aa=p("ZodLiteral",(e,t)=>{si.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pr(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function jp(e,t){return new aa({type:"literal",values:Array.isArray(e)?e:[e],...g(t)})}var la=p("ZodTransform",(e,t)=>{Ae(),ci.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mr(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new _e(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(ee(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(ee(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});function ac(e){return new la({type:"transform",transform:e})}var Tr=p("ZodOptional",(e,t)=>{jt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function tc(e){return new Tr({type:"optional",innerType:e})}var lc=p("ZodExactOptional",(e,t)=>{ui.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>nt(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function pa(e){return new lc({type:"optional",innerType:e})}var fa=p("ZodNullable",(e,t)=>{ai.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>br(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function rc(e){return new fa({type:"nullable",innerType:e})}var da=p("ZodDefault",(e,t)=>{li.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function ma(e,t){return new da({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():ft(t)}})}var ha=p("ZodPrefault",(e,t)=>{pi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ga(e,t){return new ha({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():ft(t)}})}var pc=p("ZodNonOptional",(e,t)=>{fi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function _a(e,t){return new pc({type:"nonoptional",innerType:e,...g(t)})}var xa=p("ZodCatch",(e,t)=>{di.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ya(e,t){return new xa({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Qr(t)})}var fc=p("ZodPipe",(e,t)=>{Lt.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sr(e,r,n,o),e.in=t.in,e.out=t.out});function nc(e,t){return new fc({type:"pipe",in:e,out:t})}var va=p("ZodPreprocess",(e,t)=>{fc.init(e,t),mi.init(e,t)}),ba=p("ZodReadonly",(e,t)=>{hi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pr(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function za(e){return new ba({type:"readonly",innerType:e})}var $a=p("ZodPromise",(e,t)=>{_i.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Or(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Lp(e){return new $a({type:"promise",innerType:e})}var wa=p("ZodFunction",(e,t)=>{gi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dr(e,r,n,o)});function Fp(e){return new wa({type:"function",input:Array.isArray(e?.input)?ua(e?.input):e?.input??Er(ue()),output:e?.output??ue()})}var dc=p("ZodCustom",(e,t)=>{xi.init(e,t),z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fr(e,r,n,o)});function Mp(e,t){return us(dc,e??(()=>!0),t)}function ka(e,t={}){return as(dc,e,t)}function Za(e,t){return ls(e,t)}function Up(e,t){return new va({type:"pipe",in:ac(e),out:t})}var Nr=L().min(1),Pa=Er(L()).optional(),Oa=cc(L(),ue()).optional(),Ia=uc(["act","plan","yolo","zen"]).optional(),Aa=st({providerId:Nr,modelId:L().optional()}).optional(),Cr={id:L().optional(),title:L().optional(),prompt:L().optional(),workspaceRoot:L().optional(),cwd:L().optional(),modelSelection:Aa,systemPrompt:L().optional(),mode:Ia,timeoutSeconds:ae().int().positive().optional(),maxIterations:ae().int().positive().optional(),tags:Pa,enabled:Xu().optional(),metadata:Oa},Ea=st({...Cr}).strict(),Ta=st({...Cr,schedule:Nr,timezone:L().optional()}).strict(),Na=st({...Cr,event:Nr,filters:cc(L(),ue()).optional(),debounceSeconds:ae().int().nonnegative().optional(),dedupeWindowSeconds:ae().int().nonnegative().optional(),cooldownSeconds:ae().int().nonnegative().optional(),maxParallel:ae().int().positive().optional()}).strict(),Ca=["schedule","timezone"],Ra=["event","filters","debounceSeconds","dedupeWindowSeconds","cooldownSeconds","maxParallel"];export{Na as AutomationEventFrontmatterSchema,Ea as AutomationOneOffFrontmatterSchema,Ta as AutomationScheduleFrontmatterSchema,Ra as EVENT_ONLY_FIELDS,Ca as SCHEDULE_ONLY_FIELDS};
|