@regojs/erp-sdk 1.0.3 → 1.0.4
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/browser/index.d.ts +1 -1
- package/dist/browser/index.js +65 -0
- package/dist/browser/index.js.map +30 -0
- package/dist/browser/vanilla/constants/enums.d.ts +5 -0
- package/dist/browser/vanilla/constants/index.d.ts +1 -0
- package/dist/browser/vanilla/index.d.ts +4 -0
- package/dist/browser/vanilla/providers/index.d.ts +1 -0
- package/dist/browser/vanilla/providers/regoProvider.d.ts +6 -0
- package/dist/browser/vanilla/types/index.d.ts +1 -0
- package/dist/browser/vanilla/types/regoProvider.d.ts +4 -0
- package/dist/browser/vanilla/validators/index.d.ts +2 -0
- package/dist/browser/vanilla/validators/routes.d.ts +6 -0
- package/package.json +15 -8
- package/src/browser/index.ts +1 -0
- package/src/browser/vanilla/constants/enums.ts +5 -0
- package/src/browser/vanilla/constants/index.ts +1 -0
- package/src/browser/vanilla/index.ts +4 -0
- package/src/browser/vanilla/providers/index.ts +1 -0
- package/src/browser/vanilla/providers/regoProvider.ts +37 -0
- package/src/browser/vanilla/types/index.ts +1 -0
- package/src/browser/vanilla/types/regoProvider.ts +5 -0
- package/src/browser/vanilla/validators/index.ts +3 -0
- package/src/browser/vanilla/validators/routes.ts +10 -0
package/dist/browser/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * as Vanilla from "./vanilla";
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var Yi=Object.defineProperty;var Hi=(e)=>e;function Qi(e,t){this[e]=Hi.bind(null,t)}var Mt=(e,t)=>{for(var r in t)Yi(e,r,{get:t[r],enumerable:!0,configurable:!0,set:Qi.bind(t,r)})};var Gi={};Mt(Gi,{Enums:()=>_e,RegoProvider:()=>Rt,routeSchema:()=>jt});var _e={};Mt(_e,{EScriptIds:()=>Ue});var Ue;((n)=>{n.routesId="rego-routes";n.dataId="rego-data";n.metadataId="rego-metadata"})(Ue||={});function ce(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 Be(e,t="|"){return e.map((r)=>We(r)).join(t)}function ue(e,t){if(typeof t==="bigint")return t.toString();return t}class Jt{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 xe(e){return new Jt(e)}function Bt(e){return e===null||e===void 0}function ye(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function D(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function be(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function U(e){return be(e._zod.def)??e._zod.def.shape}function Vt(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return D(this,t,n),n},enumerable:!0,configurable:!0})}function Kt(e,t,r){if(t in e)D(e,t,r);else e[t]=r}function W(e,t,r,n){let o=U(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Vt(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c});else Kt(e,i,n?n(s.value,i):s.value)}}function es(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Vt(e,r,()=>t[r]);else Kt(e,r,n.value)}}function A(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function Wt(e){return JSON.stringify(e)}function Gt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ve="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function se(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var qt=xe(()=>{if(I.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function X(e){if(se(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(se(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Ke(e){if(X(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 Xt=new Set(["string","number","symbol"]);function Y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(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 We(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Yt(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var Ge=(()=>({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]}))(),qe={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function ts(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 W(i,e,ve(e,t)),L(e,A(r,{shape:i,checks:[]}))}function ve(e,t){let r=U(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 rs(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(ve(e,t)),s={};return W(s,e,Reflect.ownKeys(U(e)).filter((c)=>!i.has(c))),L(e,A(r,{shape:s,checks:[]}))}function ns(e,t){if(!X(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=U(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 L(e,A(e._zod.def,{shape:Ht(e,t)}))}function Ht(e,t){let r={};return W(r,e,Reflect.ownKeys(U(e))),es(r,t),r}function os(e,t){if(!X(t))throw Error("Invalid input to safeExtend: expected a plain object");return L(e,A(e._zod.def,{shape:Ht(e,t)}))}function is(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={};W(r,e,Reflect.ownKeys(U(e))),W(r,t,Reflect.ownKeys(U(t)));let n=A(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,n)}function Qt(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(ve(t,r)):void 0,u={};return W(u,t,Reflect.ownKeys(U(t)),e&&((a,l)=>c&&!c.has(l)?a:new e({type:"optional",innerType:a}))),L(t,A(t._zod.def,{shape:u,checks:[]}))}function ss(e,t,r){let n=r?new Set(ve(t,r)):void 0,o={};return W(o,t,Reflect.ownKeys(U(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,A(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 er(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 ae(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function ie(e){return typeof e==="string"?e:e?.message}function Xe(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function V(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:ie(e.inst?._zod.def?.error?.(e))??ie(i?.(e))??ie(t?.error?.(e))??ie(r.customError?.(e))??ie(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 cs=/[\uD800-\uDBFF]/;function ze(e){let t=e.length;if(!cs.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 $e(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function tr(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 G(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function rr(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else Ut(e,r,n.value)}for(let r of Object.getOwnPropertySymbols(t))Ut(e,r,t[r])}function J(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Ye(e,t,r){return J(e,t,r,!1)}function us(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return J(this,r,n(this))},set(o){J(this,r,o)}})}return t}function Ut(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:J(this,t,r.bind(this))},set(n){J(this,t,n)}})}function as(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var Je,B=!1,ls={configurable:!0,get(){B=!0;return}};function y(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Je!==e._zod){Je=void 0;return}Je=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,ls);let o=B;B=!1;try{let i=r(this);if(B)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return B=B||o,i}catch(i){throw delete this[t],B=B||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function ps(e,t,r,n){let o=as(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 fs="~constantCatch";function nr(e){let t=()=>e;return t[fs]=!0,t}var or;var He={value:void 0,enumerable:!1},ir="captureStackTrace"in Error?Error:null;function ds(e){let t=ir;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return ir=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function p(e,t,r,n){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,c=s&&new WeakSet;function u(d,m){if(!d._zod){He.value=new i(m);try{Object.defineProperty(d,"_zod",He)}finally{He.value=void 0}}if(d._zod.traits.has(e))return;if(d._zod.traits.add(e),t(d,m),c){let _=Object.getPrototypeOf(d),x=d._zod.constr.prototype,P=_;while(P&&P!==x)P=Object.getPrototypeOf(P);let j=P??_;if(!c.has(j))c.add(j),rr(j,s)}let h=f.prototype;for(let _ in h){if(!Object.prototype.hasOwnProperty.call(h,_))continue;if(!(_ in d))d[_]=h[_].bind(d)}}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(d){let m=n?.Parent?ds(l):this;u(m,d);let h=m._zod.deferred;if(h){for(let x of h)x();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;if(_)_(m);return m}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:(d)=>{if(n?.Parent&&d instanceof n.Parent)return!0;return d?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}class M extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class le extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(or=globalThis).__zod_globalConfig??(or.__zod_globalConfig={});var I=globalThis.__zod_globalConfig;function C(e){if(e)Object.assign(I,e);return I}function ms(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ue,2)),e.message}function hs(e){this._zod.message=e}var gs={get:ms,set:hs,enumerable:!0,configurable:!0},et={value:void 0,enumerable:!1},sr=new WeakSet([Object.prototype,Error.prototype]),cr=(e,t)=>{e.name="$ZodError",et.value=t,Object.defineProperty(e,"issues",et),et.value=void 0,Object.defineProperty(e,"message",gs);let r=Object.getPrototypeOf(e);if(!sr.has(r))sr.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})}})},ur=p("$ZodError",cr),fu=p("$ZodError",cr,void 0,{Parent:Error});function _s(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 ar(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)_s(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function lr(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 d=u[l];if(f)d._errors.push(t(s));u=d,a++}}}};return n(e),r}function we(e,t){return{callee:t?.callee??e,Err:t?.Err}}var ke=(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 M;if(c.issues.length){let u=new(i?.Err??e)(c.issues.map((a)=>V(a,s,C())));throw Ve(u,i?.callee??t),u}return c.value};return t};var Ze=(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)=>V(a,s,C())));throw Ve(u,i?.callee??t),u}return c.value};return t};var Pe=(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 M;return i.issues.length?pr(e,i.issues,o):{success:!0,data:i.value}};function pr(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>V(o,r,C()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}var Se=(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?pr(e,i.issues,o):{success:!0,data:i.value}};var xs=Symbol.for("zod.compile.invalid"),ys=Symbol.for("zod.compile.fallback"),tt=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==xs)return!0;if(n.definite===!0&&r===void 0)return!1}return bs(e,t,r)};function bs(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[ys]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new M;return i.issues.length===0}var rt=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},fr=(e)=>{let t=ke(e),r=(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,we(r,s))};return r};var dr=(e)=>{let t=ke(e),r=(n,o,i,s)=>t(n,o,i,we(r,s));return r};var mr=(e)=>{let t=Ze(e),r=async(n,o,i,s)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,we(r,s))};return r};var hr=(e)=>{let t=Ze(e),r=async(n,o,i,s)=>await t(n,o,i,we(r,s));return r};var gr=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Pe(e)(t,r,o)};var _r=(e)=>(t,r,n)=>Pe(e)(t,r,n);var xr=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Se(e)(t,r,o)};var yr=(e)=>async(t,r,n)=>Se(e)(t,r,n);var br=/^[cC][0-9a-z]{6,}$/,vr=/^[0-9a-z]+$/,zr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,$r=/^[0-9a-vA-V]{20}$/,wr=/^[A-Za-z0-9]{27}$/,kr=/^[a-zA-Z0-9_-]{21}$/;function Zr(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Pr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Sr=/^([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})$/,ot=(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 Or=/^(?:[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 vs="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ir(){return new RegExp(vs,"u")}var Er=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ar=/^(([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 Tr=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Nr=/^(([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])$/,Cr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,jr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;var Rr=/^https?$/,Dr=/^\+[1-9]\d{6,14}$/;var Lr="(?:(?:\\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 zs(e){return new RegExp(`^${e}$`)}var Fr=zs(Lr);function nt(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 Mr(e){return new RegExp(`^${nt(e)}$`)}function Ur(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${nt({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${nt({precision:e.precision})}`:r;return new RegExp(`^${Lr}T(?:${n})$`)}var Jr=/^[\s\S]{0,}$/;var Br=/^[^A-Z]*$/,Vr=/^[^a-z]*$/;var E=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var it=(e)=>{let t=e.value;return!Bt(t)&&t.length!==void 0};var Kr=p("$ZodCheckMaxLength",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=it),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?ze(o):i)<=t.maximum)return;let c=$e(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Wr=p("$ZodCheckMinLength",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=it),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?ze(o):i)>=t.minimum)return;let c=$e(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gr=p("$ZodCheckLengthEquals",(e,t)=>{var r;E.init(e,t),(r=e._zod.def).when??(r.when=it),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?ze(o):i;if(s===t.length)return;let c=$e(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})}}),fe=p("$ZodCheckStringFormat",(e,t)=>{var r,n;if(E.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=()=>{})}),qr=p("$ZodCheckRegex",(e,t)=>{fe.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})}}),Xr=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Br),fe.init(e,t)}),Yr=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Vr),fe.init(e,t)}),Hr=p("$ZodCheckIncludes",(e,t)=>{E.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})}}),Qr=p("$ZodCheckStartsWith",(e,t)=>{E.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})}}),en=p("$ZodCheckEndsWith",(e,t)=>{E.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 tn=p("$ZodCheckOverwrite",(e,t)=>{E.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}});class st{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
|
+
`).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
|
+
${t.join(`
|
|
5
|
+
`)}
|
|
6
|
+
};`)(...Object.values(this.closed))}}var nn={major:4,minor:6,patch:1};var w=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=nn;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 d of u){if(d._zod.def.when){if(er(c))continue;if(!d._zod.def.when(c))continue}else if(l)continue;let m=c.issues.length,h=d._zod.check(c);if(h instanceof Promise&&a?.async===!1)throw new M;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await h,c.issues.length===m)return;if(Xe(c.issues,m,e),!l)l=F(c,m)});else{if(c.issues.length===m)continue;if(Xe(c.issues,m,e),!l)l=F(c,m)}}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 M;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 M;return a.then((l)=>i(l,o,u))}return i(a,o,u)}}},{get "~standard"(){return Ye(this,"~standard",ut(this))},set "~standard"(e){J(this,"~standard",e)}}),hn=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>V(r,t,C()))}:{value:e.value};async function ks(e,t){let r={async:!0};return hn(await e._zod.run({value:t,issues:[]},r),r)}function ut(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return hn(n,r)}catch(n){}return ks(e,t)},vendor:"zod",version:1}}var Ee=p("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??Jr,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}}),b=p("$ZodStringFormat",(e,t)=>{fe.init(e,t),Ee.init(e,t)}),gn=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Sr),b.init(e,t)}),_n=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=ot(n))}else t.pattern??(t.pattern=ot());b.init(e,t)}),xn=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Or),b.init(e,t)}),yn=1,bn=2;function Zs(e,t){if(!t.normalize&&t.protocol?.source===Rr.source&&!/^https?:\/\//i.test(e))return yn;try{return new URL(e)}catch{return bn}}var Ps=/[\t\n\r]/g;function Ss(e){return e.replace(Ps,"")}function Os(e,t){return t.lastIndex=0,t.test(e.hostname)}function Is(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var vn=p("$ZodURL",(e,t)=>{b.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Zs(n,t);if(o===yn){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===bn){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(t.hostname&&!Os(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&&!Is(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:Ss(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),zn=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ir()),b.init(e,t)}),$n=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?kr:Zr(t.length)),b.init(e,t)}),wn=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=br),b.init(e,t)}),kn=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=vr),b.init(e,t)}),Zn=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=zr),b.init(e,t)}),Pn=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$r),b.init(e,t)}),Sn=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=wr),b.init(e,t)}),On=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ur(t)),b.init(e,t)}),In=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Fr),b.init(e,t)}),En=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Mr(t)),b.init(e,t)}),An=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Pr),b.init(e,t)}),Tn=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Er),b.init(e,t)}),Es=/^[0-9a-fA-F:.]+$/;function Nn(e){if(!Es.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}var Cn=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Ar),b.init(e,t),e._zod.check=(r)=>{if(!Nn(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}});var jn=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Tr),b.init(e,t)});function As(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 Nn(r)}var Rn=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Nr),b.init(e,t),e._zod.check=(r)=>{if(!As(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function Dn(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 at=/^[0-9a-zA-Z+/]*={0,2}$/,Ln=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=at),b.init(e,t),e._zod.check=(r)=>{if(Dn(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Ae=/^[A-Za-z0-9_-]*$/;function Ts(e){if(!Ae.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Dn(r)}var Fn=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ae),b.init(e,t),e._zod.check=(r)=>{if(Ts(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Mn=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Dr),b.init(e,t)});function Ns(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 Un=p("$ZodJWT",(e,t)=>{b.init(e,t),e._zod.check=(r)=>{if(Ns(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}});var Jn=p("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(r)=>r}),Bn=p("$ZodNever",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function on(e,t,r){if(e.issues.length)t.issues.push(...ae(r,e.issues));t.value[r]=e.value}var Vn=p("$ZodArray",(e,t)=>{w.init(e,t);let r=I.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)=>on(f,n,u)));else if(on(l,n,u),c&&l.issues.length!==0&&F(l))break}if(s.length)return Promise.all(s).then(()=>n);return n}});function Ie(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(...ae(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)t.value[r]=void 0}else t.value[r]=e.value}var Cs=[];function Kn(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Cs,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=Yt(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Wn(e,t,r,n,o,i,s){let c=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,{optin:f,optout:d}=a,m=0;for(let h in t){if(s&&r.issues.length!==m){if(F(r,m))break;m=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){if(l==="never")c.push(h);continue}if(l==="never"){c.push(h);continue}let _=a.run({value:t[h],issues:[]},n);if(_ instanceof Promise)e.push(_.then((x)=>Ie(x,r,h,t,f,d)));else Ie(_,r,h,t,f,d)}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 js=p("$ZodObject",(e,t)=>{w.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=xe(()=>Kn(t));y(e,"propValues",(a)=>{let l=a.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(f,d))D(f,d,new Set);for(let h of m.values)f[d].add(h);if(m.optin!==void 0)f[d].add(void 0)}}return f});let i=se,s=t.catchall,c,u=I.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 d=[],m=c.shape,h=l?.abortEarly,_=a.issues.length;for(let x of c.allKeys){if(h&&a.issues.length!==_){if(F(a,_))break;_=a.issues.length}if(x==="__proto__")continue;let P=m[x],j=P._zod.optin,ne=P._zod.optout,oe=P._zod.run({value:f[x],issues:[]},l);if(oe instanceof Promise)d.push(oe.then((k)=>Ie(k,a,x,f,j,ne)));else Ie(oe,a,x,f,j,ne)}if(!s)return d.length?Promise.all(d).then(()=>a):a;return Wn(d,f,a,l,o.value,e,h===!0)}}),Gn=p("$ZodObjectJIT",(e,t)=>{js.init(e,t);let r=e._zod.parse,n=xe(()=>Kn(t)),o=I.memoizer,i=(m)=>{let h=n.value,_=h.symbolKeys,x=new st(["payload","ctx"],{shape:m,inst:e,memo:o,syms:_}),P=(k)=>`shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`,j=(k,v)=>`
|
|
7
|
+
let ${k}_ab = false;
|
|
8
|
+
for (let i = 0; i < ${k}.issues.length; i++) {
|
|
9
|
+
const iss = ${k}.issues[i];
|
|
10
|
+
iss.path = iss.path ? [${v}, ...iss.path] : [${v}];
|
|
11
|
+
payload.issues.push(iss);
|
|
12
|
+
if (iss.continue !== true) ${k}_ab = true;
|
|
13
|
+
}
|
|
14
|
+
if (${k}_ab && ctx && ctx.abortEarly) {
|
|
15
|
+
payload.value = newResult;
|
|
16
|
+
return payload;
|
|
17
|
+
}`;x.write("const input = payload.value;");let ne=Object.create(null),oe=0;for(let k of h.allKeys)ne[k]=`key_${oe++}`;x.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let k of h.allKeys){if(k==="__proto__")continue;let v=ne[k],R=typeof k==="symbol"?`syms[${_.indexOf(k)}]`:Wt(k),Me=`${R} in input`,Dt=m[k],Lt=Dt?._zod?.optin,Ft=Lt!==void 0,qi=Dt?._zod?.optout==="optional";if(x.write(`const ${v} = ${P(R)};`),Ft&&qi){let Xi=Lt==="optional"?`${v}_present`:`${v}.value !== undefined || ${v}_present`;x.write(`
|
|
18
|
+
const ${v}_present = ${Me};
|
|
19
|
+
if (!${v}.issues.length || ${v}_present) {
|
|
20
|
+
if (${v}.issues.length) {${j(v,R)}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (${Xi}) {
|
|
24
|
+
newResult[${R}] = ${v}.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
`)}else if(!Ft)x.write(`
|
|
29
|
+
const ${v}_present = ${Me};
|
|
30
|
+
if (${v}.issues.length) {${j(v,R)}
|
|
31
|
+
}
|
|
32
|
+
if (!${v}_present && !${v}.issues.length) {
|
|
33
|
+
payload.issues.push({
|
|
34
|
+
code: "invalid_type",
|
|
35
|
+
expected: "nonoptional",
|
|
36
|
+
input: undefined,
|
|
37
|
+
path: [${R}]
|
|
38
|
+
});
|
|
39
|
+
if (ctx && ctx.abortEarly) {
|
|
40
|
+
payload.value = newResult;
|
|
41
|
+
return payload;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (${v}_present) {
|
|
46
|
+
newResult[${R}] = ${v}.value;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
`);else x.write(`
|
|
50
|
+
if (${v}.issues.length) {${j(v,R)}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (${v}.value === undefined) {
|
|
54
|
+
if (${Me}) {
|
|
55
|
+
newResult[${R}] = undefined;
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
newResult[${R}] = ${v}.value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
`)}return x.write("payload.value = newResult;"),x.write("return payload;"),x.compile()},s,c=se,u=!I.jitless,l=u&&qt.value,f=t.catchall,d;e._zod.parse=(m,h)=>{d??(d=n.value);let _=m.value;if(!c(_))return m.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),m;if(u&&l&&h?.async===!1&&h.jitless!==!0){if(!s)s=i(t.shape);if(m=s(m,h),!f)return m;return Wn([],_,m,h,d,e,h?.abortEarly===!0)}return r(m,h)}});function sn(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)=>V(s,n,C())))}),t}var qn=p("$ZodUnion",(e,t)=>{w.init(e,t),y(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),y(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),y(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}),y(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)=>ye(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 sn(s,n,e,o);return Promise.all(s).then((c)=>sn(c,n,e,o))}});var Xn=p("$ZodIntersection",(e,t)=>{w.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])=>cn(r,u,a));return cn(r,i,s)}});function ct(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(X(e)&&X(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=ct(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=ct(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 cn(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 d=String(a.path[0]);if(!i.has(d))i.set(d,a);f=[d]}else return!1;for(let d of f){if(!n.has(d))n.set(d,{});n.get(d)[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=ct(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 Yn=p("$ZodEnum",(e,t)=>{w.init(e,t);let r=ce(t.entries),n=new Set(r);e._zod.values=n,y(e,"pattern",(o)=>{let i=ce(o.def.entries).filter((s)=>Xt.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}});var Hn=p("$ZodTransform",(e,t)=>{w.init(e,t),e._zod.optin="optional",I.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new le(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 M;return r.value=o,r}});function un(e,t){return e.value=t.issues.length?void 0:t.value,e}var lt=p("$ZodOptional",(e,t)=>{w.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",y(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),y(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${ye(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)=>un(r,i));return un(r,o)}return t.innerType._zod.run(r,n)}}),Qn=p("$ZodExactOptional",(e,t)=>{lt.init(e,t),y(e,"values",(r)=>r.def.innerType._zod.values),y(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),eo=p("$ZodNullable",(e,t)=>{w.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin),y(e,"optout",(r)=>r.def.innerType._zod.optout),y(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${ye(n.source)}|null)$`):void 0}),y(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)}}),to=p("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",y(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)=>an(i,t));return an(o,t)}});function an(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var ro=p("$ZodPrefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",y(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)}}),no=p("$ZodNonOptional",(e,t)=>{w.init(e,t),y(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)=>ln(i,e));return ln(o,e)}});function ln(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 pn(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)=>V(o,n,C()))},input:e.value}),e}var oo=p("$ZodCatch",(e,t)=>{w.init(e,t),y(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),y(e,"optout",(r)=>r.def.innerType._zod.optout),y(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)=>pn(r,i,t,n));return pn(r,o,t,n)}});var io=p("$ZodPipe",(e,t)=>{w.init(e,t),y(e,"values",(r)=>r.def.in._zod.values),y(e,"optin",(r)=>r.def.in._zod.optin),y(e,"optout",(r)=>r.def.out._zod.optout),y(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)=>Oe(s,t.in,n));return Oe(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Oe(i,t.out,n));return Oe(o,t.out,n)}});function Oe(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 so=p("$ZodReadonly",(e,t)=>{w.init(e,t),y(e,"propValues",(r)=>r.def.innerType._zod.propValues),y(e,"values",(r)=>r.def.innerType._zod.values),y(e,"optin",(r)=>r.def.innerType?._zod?.optin),y(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(fn);return fn(o)}});function fn(e){if(!e.memo)e.value=Object.freeze(e.value);return e}var co=p("$ZodCustom",(e,t)=>{E.init(e,t),w.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)=>dn(i,r,n,e));dn(o,r,n,e);return}});function dn(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(G(o))}}function mn(e,t,r){if(e.issues.length)t.issues.push(...ae(r,e.issues))}var Rs=p("$ZodProperties",(e,t)=>{w.init(e,t),E.init(e,t);let r=I.memoizer;r?.attach(e);let n,o=(i,s)=>{n??(n=Reflect.ownKeys(t.shape).map((a)=>[a,t.shape[a]]));let c=i.value,u;for(let[a,l]of n){let f=l._zod.run({value:c[a],issues:[]},s);if(f instanceof Promise)u??(u=[]),u.push(f.then((d)=>mn(d,i,a)));else mn(f,i,a)}if(u)return Promise.all(u).then(()=>{return});return};e._zod.parse=(i,s)=>{let c=i.value;if(c===null||typeof c!=="object"&&typeof c!=="function")return i.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),i;if(s.direction==="backward")s={...s,direction:"forward"};if(r)r.alloc(e,i,c,s);let u=o(i,s);return u instanceof Promise?u.then(()=>i):i},e._zod.check=(i)=>{if(i.value==null){i.issues.push({expected:"object",code:"invalid_type",input:i.value,inst:e});return}return o(i,{})}},{*[Symbol.iterator](){yield this}});class ao extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var ft="~memo",uo=[];function lo(e){return e!==null&&(typeof e==="object"||typeof e==="function")}function pt(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var po=new WeakMap,de=0,Ce=1,me=2;function je(e,t,r){let n=po.get(e);if(n!==void 0)return n?me:de;if(t.has(e))return me;t.add(e);let o=de,i=(l)=>{if(o!==me&&l?._zod){let f=je(l,t,r);if(f>o)o=f}},s=(l,f)=>{let d=de;for(let m of Reflect.ownKeys(l)){let h=Object.getOwnPropertyDescriptor(l,m);if(f&&!h.enumerable)continue;let _=h.get?Ce:h.value?._zod?je(h.value,t,r):de;if(_>d)d=_}return d},c=(l)=>{if(l>o)o=l},u=e._zod.def,a=u.type;switch(a){case"object":{let l=be(u);c(l?s(l,!0):Ce),i(u.catchall);break}case"properties":c(s(u.shape,!1));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?je(l,t,!1):Ce);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 d=f.value;if(!d||typeof d!=="object")continue;if(d._zod)i(d);else if(Array.isArray(d))for(let m of d)i(m)}}return t.delete(e),Ds(e,o)}function Ds(e,t){if(t!==Ce)po.set(e,t===me);return t}function Ls(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}var Te,Ne=[],Fs={alloc(e,t,r){let n=Te;if(!n)return r;Te=void 0;let o={value:r,issues:null};return n.set(t.value,o),Ne.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"&&Ms(i,o.value))throw new ao;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 P=je(e,new Set,!1);if(P===de){if(e._zod.parse=s,e._zod.run===c)e._zod.run=s;return s(u,a)}if(P===me||n)r=!0;else n=!0}let l=u.value;if(!lo(l))return s(u,a);let f=a[ft];if(!f)f={buckets:new WeakMap,backEdges:void 0},a[ft]=f;let d;if(o===a)d=i;else d=Ls(f,e),o=a,i=d;let m=d.get(l);if(m){if(u.value=m.value,m.issues){if(m.issues.length)u.issues.push(...pt(m.issues))}else u.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value);return u}Te=d;let h=Ne.length,_=s(u,a);Te=void 0;let x=Ne.length>h?Ne.pop():void 0;if(_ instanceof Promise)return _.then((P)=>{if(x)x.issues=P.issues.length?pt(P.issues):uo;return P});if(x)x.issues=_.issues.length?pt(_.issues):uo;return _};if(e._zod.parse=c,e._zod.run===s)e._zod.run=c})}};function fo(){return Fs}function Ms(e,t){let r=e[ft]?.backEdges;return r!==void 0&&lo(t)&&r.has(t)}var Us=()=>{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",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=tr(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 ${We(i.values[0])}`;return`Invalid option: expected one of ${Be(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":""}: ${Be(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 dt(){return{localeError:Us()}}var mo;class ho{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 Js(){return new ho}(mo=globalThis).__zod_globalRegistry??(mo.__zod_globalRegistry=Js());var q=globalThis.__zod_globalRegistry;function go(e,t){return new e({type:"string",...g(t)})}function _o(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...g(t)})}function xo(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...g(t)})}function yo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...g(t)})}function bo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...g(t)})}function vo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...g(t)})}function zo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...g(t)})}function $o(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...g(t)})}function wo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...g(t)})}function ko(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...g(t)})}function Zo(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...g(t)})}function Po(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...g(t)})}function So(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...g(t)})}function Oo(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...g(t)})}function Io(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...g(t)})}function Eo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...g(t)})}function Ao(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...g(t)})}function To(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...g(t)})}function No(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...g(t)})}function Co(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...g(t)})}function jo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...g(t)})}function Ro(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...g(t)})}function Do(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...g(t)})}function Lo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...g(t)})}function Fo(e,t){return new e({type:"string",format:"date",check:"string_format",...g(t)})}function Mo(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...g(t)})}function Uo(e,t){return new e({type:"string",format:"duration",check:"string_format",...g(t)})}function Jo(e){return new e({type:"unknown"})}function Bo(e,t){return new e({type:"never",...g(t)})}function Re(e,t){return new Kr({check:"max_length",...g(t),maximum:e})}function H(e,t){return new Wr({check:"min_length",...g(t),minimum:e})}function De(e,t){return new Gr({check:"length_equals",...g(t),length:e})}function mt(e,t){return new qr({check:"string_format",format:"regex",...g(t),pattern:e})}function ht(e){return new Xr({check:"string_format",format:"lowercase",...g(e)})}function gt(e){return new Yr({check:"string_format",format:"uppercase",...g(e)})}function _t(e,t){return new Hr({check:"string_format",format:"includes",...g(t),includes:e})}function xt(e,t){return new Qr({check:"string_format",format:"starts_with",...g(t),prefix:e})}function yt(e,t){return new en({check:"string_format",format:"ends_with",...g(t),suffix:e})}function K(e){return new tn({check:"overwrite",tx:e})}function bt(e){return K((t)=>t.normalize(e))}function vt(){return K((e)=>e.trim())}function zt(){return K((e)=>e.toLowerCase())}function $t(){return K((e)=>e.toUpperCase())}function wt(){return K((e)=>Gt(e))}function Vo(e,t,r){return new e({type:"array",element:t,...g(r)})}function Ko(e,t,r){return new e({type:"custom",check:"custom",fn:t,...g(r)})}function Wo(e,t){let r=Bs((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(G(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(G(i))}},e(n.value,n)),t);return r}function Bs(e,t){let r=new E({check:"custom",...g(t)});return r._zod.check=e,r}function he(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))D(e,n,r[n]);return e}function Zt(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??q,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 Q(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 S(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 d=s.schema,m=t.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;S(f,t,l),t.seen.get(f).isParent=!0}}let u=t.metadataRegistry.get(e);if(u)he(s.schema,u);if(t.io==="input"&&O(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 Go(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Pt(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,d=e.external.uri??((h)=>h);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Go(m)}`}}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+Go(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>
|
|
62
|
+
|
|
63
|
+
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 Yo(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;Yo(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 Ho=new Set(["type","properties","required","additionalProperties"]),qo=["oneOf","anyOf"];function Xo(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 kt(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Ho.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]??Xo(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]:kt(c)??{allOf:c};D(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=Xo(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 Vs(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Ho)if(o in e)return;let r=t.filter((o)=>qo.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=kt(t);else{let o=r[0],i=qo.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)=>kt([...s,u]));if(c.some((u)=>!u))return;n={[i]:c}}if(!n)return;delete e.allOf,he(e,n)}function St(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 m=e.seen.get(f),h=m.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))a.allOf=a.allOf??[],a.allOf.push(h);else he(a,h);if(he(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(h.$ref&&m.def)for(let x in a){if(x==="$ref"||x==="allOf")continue;if(x in m.def&&JSON.stringify(a[x])===JSON.stringify(m.def[x]))delete a[x]}}let d=c._zod.parent;if(d&&d!==f){n(d);let m=e.seen.get(d);if(m?.schema.$ref){if(a.$ref=m.schema.$ref,m.def)for(let h in a){if(h==="$ref"||h==="allOf")continue;if(h in m.def&&JSON.stringify(a[h])===JSON.stringify(m.def[h]))delete a[h]}}}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())Yo(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)??[])Vs(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)}he(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;D(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:ge(t,"input",e.processors),output:ge(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function O(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 O(n.element,r);if(n.type==="set")return O(n.valueType,r);if(n.type==="lazy")return O(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 O(n.innerType,r);if(n.type==="intersection")return O(n.left,r)||O(n.right,r);if(n.type==="record"||n.type==="map")return O(n.keyType,r)||O(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return O(n.in,r)||O(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(O(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(O(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(O(o,r))return!0;if(n.rest&&O(n.rest,r))return!0;return!1}return!1}var Qo=(e,t={})=>(r)=>{let n=Zt({...r,processors:t});return S(e,n),Pt(n,e),St(n,e)},ge=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=Zt({...o??{},target:i,io:t,processors:r});return S(e,s),Pt(s,e),St(s,e)};var ee=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},te=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},ei=(e,t)=>{ee(e,"minimum",t),te(e,"maximum",t)},oi=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},ii=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},si=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},ci=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},ti=(e,t)=>ee(e,"minimum",t.minimum),ri=(e,t)=>te(e,"maximum",t.maximum),ni=(e)=>(t,r)=>{ci(t,r.format);let[n,o]=e[r.format];ee(t,"minimum",n),te(t,"maximum",o)},Ks={greater_than:(e,t)=>ee(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>te(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>oi(e,t.value),number_format:ni(Ge),bigint_format:ni(qe),min_length:ti,max_length:ri,length_equals:(e,t)=>ei(e,t.length),min_size:ti,max_size:ri,size_equals:(e,t)=>ei(e,t.size),string_format:(e,t)=>{if(ci(e,t.format),t.pattern)ii(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)=>si(e,t.mime)};function re(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)Ks[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)ee(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)ee(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)te(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)te(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)oi(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)si(t,o.mime);for(let i of o.patterns??[])ii(t,i);return t}var Ws={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Gs=new Map([[at,Cr],[Ae,jr]]),qs=(e)=>Gs.get(e)??e,ui=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:c,patterns:u,contentEncoding:a,laxFormat:l}=re(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(c){if(o.format=Ws[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(qs);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((d)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))]}};var ai=(e,t,r,n)=>{r.not={}};var li=(e,t,r,n)=>{};var pi=(e,t,r,n)=>{let o=e._zod.def,i=ce(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};var fi=(e,t,r,n)=>{Q(e,t,r,n,"Custom types cannot be represented in JSON Schema")};var di=(e,t,r,n)=>{Q(e,t,r,n,"Transforms cannot be represented in JSON Schema")};var mi=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:c}=re(e);if(typeof s==="number")o.minItems=s;if(typeof c==="number")o.maxItems=c;o.type="array",o.items=S(i.element,t,{...n,path:[...n.path,"items"]})};function Ot(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return Ot(t.out);if(t.type==="catch")return Ot(t.innerType);return e._zod.optin}var hi=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Q(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)D(o.properties,l,S(s[l],t,{...n,path:[...n.path,"properties",l]}));let u=new Set(Object.keys(s)),a=new Set([...u].filter((l)=>{let f=i.shape[l];if(t.io==="input")return Ot(f)===void 0;else return f._zod.optout===void 0}));if(a.size>0)o.required=Array.from(a);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=S(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})};var gi=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((c,u)=>S(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",u]}));if(i)r.oneOf=s;else r.anyOf=s},_i=(e,t,r,n)=>{let o=e._zod.def,i=S(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=S(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)};var xi=(e,t,r,n)=>{let o=e._zod.def,i=S(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"}]},yi=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},It=Symbol();function bi(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 Q(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),It}var vi=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=bi(o.defaultValue,e,t,r,n);if(s!==It)r.default=s},zi=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=bi(o.defaultValue,e,t,r,n);if(s!==It)r._prefault=s},$i=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Q(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},wi=(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;S(s,t,n);let c=t.seen.get(e);c.ref=s},ki=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0};var Et=(e,t,r,n)=>{let o=e._zod.def;S(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var Zi=new WeakSet([Object.prototype,Error.prototype]);function Le(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 cc=(e,t)=>{ur.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Zi.has(r))return;Zi.add(r),Le(r,"format",(n)=>(o)=>lr(n,o)),Le(r,"flatten",(n)=>(o)=>ar(n,o)),Le(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ue,2)}),Le(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ue,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})};var T=p("ZodError",cc,void 0,{Parent:Error});var Pi=ke(T),Si=Ze(T),Oi=Pe(T),Ii=Se(T),Ei=fr(T),Ai=dr(T),Ti=mr(T),Ni=hr(T),Ci=gr(T),ji=_r(T),Ri=xr(T),Di=yr(T);function ac(){if(!I.localeError)C(dt())}function Nt(){if(!I.memoizer)C({memoizer:fo()})}var Z=p("ZodType",(e,t)=>(ac(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(A(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 L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(iu(e,t))},superRefine(e,t){return this.check(su(e,t))},overwrite(e){return this.check(K(e))},optional(){return Fi(this)},exactOptional(){return Kc(this)},nullable(){return Mi(this)},nullish(){return Fi(Mi(this))},nonoptional(e){return Hc(this,e)},array(){return Rc(this)},or(e){return Fc([this,e])},and(e){return Uc(this,e)},transform(e){return Ui(this,Vc(e))},default(e){return qc(this,e)},prefault(e){return Yc(this,e)},catch(e){return eu(this,e)},pipe(e){return Ui(this,e)},readonly(){return nu(this)},describe(e){let t=this.clone();return q.add(t,{description:e}),t},meta(...e){if(e.length===0)return q.get(this);let t=this.clone();return q.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 Ye(this,"~standard",{...ut(this),jsonSchema:{input:ge(this,"input"),output:ge(this,"output")}})},set "~standard"(e){J(this,"~standard",e)},parse:function e(t,r){return Pi(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Si(this,t,r,{callee:e})},safeParse(e,t){return Oi(this,e,t)},async safeParseAsync(e,t){return Ii(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){J(this,"spa",e)},validate(e,t){return tt(this,e,t)},validateAsync(e,t){return rt(this,e,t)},encode:function e(t,r){return Ei(this,t,r,{callee:e})},decode:function e(t,r){return Ai(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Ti(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Ni(this,t,r,{callee:e})},safeEncode(e,t){return Ci(this,e,t)},safeDecode(e,t){return ji(this,e,t)},async safeEncodeAsync(e,t){return Ri(this,e,t)},async safeDecodeAsync(e,t){return Di(this,e,t)},toJSONSchema(e){return Qo(this,{})(e)},get description(){return q.get(this)?.description},get _def(){return this._zod.def}}),Ji=p("_ZodString",(e,t)=>{Ee.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ui(e,r,n,o)},us({format:(e)=>re(e).format??null,minLength:(e)=>re(e).minimum??null,maxLength:(e)=>re(e).maximum??null},{regex(...e){return this.check(mt(...e))},includes(...e){return this.check(_t(...e))},startsWith(...e){return this.check(xt(...e))},endsWith(...e){return this.check(yt(...e))},min(...e){return this.check(H(...e))},max(...e){return this.check(Re(...e))},length(...e){return this.check(De(...e))},nonempty(...e){return this.check(H(1,...e))},lowercase(e){return this.check(ht(e))},uppercase(e){return this.check(gt(e))},trim(){return this.check(vt())},normalize(...e){return this.check(bt(...e))},toLowerCase(){return this.check(zt())},toUpperCase(){return this.check($t())},slugify(){return this.check(wt())}})),lc=p("ZodString",(e,t)=>{Ee.init(e,t),Ji.init(e,t)},{email(e){return this.check(_o(hc,e))},url(e){return this.check($o(_c,e))},jwt(e){return this.check(Do(Ac,e))},emoji(e){return this.check(wo(xc,e))},guid(e){return this.check(xo(gc,e))},uuid(e){return this.check(yo(Fe,e))},uuidv4(e){return this.check(bo(Fe,e))},uuidv6(e){return this.check(vo(Fe,e))},uuidv7(e){return this.check(zo(Fe,e))},nanoid(e){return this.check(ko(yc,e))},cuid(e){return this.check(Zo(bc,e))},cuid2(e){return this.check(Po(vc,e))},ulid(e){return this.check(So(zc,e))},base64(e){return this.check(Co(Oc,e))},base64url(e){return this.check(jo(Ic,e))},xid(e){return this.check(Oo($c,e))},ksuid(e){return this.check(Io(wc,e))},ipv4(e){return this.check(Eo(kc,e))},ipv6(e){return this.check(Ao(Zc,e))},cidrv4(e){return this.check(To(Pc,e))},cidrv6(e){return this.check(No(Sc,e))},e164(e){return this.check(Ro(Ec,e))},datetime(e){return this.check(Lo(pc,e))},date(e){return this.check(Fo(fc,e))},time(e){return this.check(Mo(dc,e))},duration(e){return this.check(Uo(mc,e))}});function Ct(e){return go(lc,e)}var z=p("ZodStringFormat",(e,t)=>{b.init(e,t),Ji.init(e,t)}),pc=p("ZodISODateTime",(e,t)=>{On.init(e,t),z.init(e,t)}),fc=p("ZodISODate",(e,t)=>{In.init(e,t),z.init(e,t)}),dc=p("ZodISOTime",(e,t)=>{En.init(e,t),z.init(e,t)}),mc=p("ZodISODuration",(e,t)=>{An.init(e,t),z.init(e,t)}),hc=p("ZodEmail",(e,t)=>{xn.init(e,t),z.init(e,t)});var gc=p("ZodGUID",(e,t)=>{gn.init(e,t),z.init(e,t)});var Fe=p("ZodUUID",(e,t)=>{_n.init(e,t),z.init(e,t)});var _c=p("ZodURL",(e,t)=>{vn.init(e,t),z.init(e,t)});var xc=p("ZodEmoji",(e,t)=>{zn.init(e,t),z.init(e,t)});var yc=p("ZodNanoID",(e,t)=>{$n.init(e,t),z.init(e,t)});var bc=p("ZodCUID",(e,t)=>{wn.init(e,t),z.init(e,t)});var vc=p("ZodCUID2",(e,t)=>{kn.init(e,t),z.init(e,t)});var zc=p("ZodULID",(e,t)=>{Zn.init(e,t),z.init(e,t)});var $c=p("ZodXID",(e,t)=>{Pn.init(e,t),z.init(e,t)});var wc=p("ZodKSUID",(e,t)=>{Sn.init(e,t),z.init(e,t)});var kc=p("ZodIPv4",(e,t)=>{Tn.init(e,t),z.init(e,t)});var Zc=p("ZodIPv6",(e,t)=>{Cn.init(e,t),z.init(e,t)});var Pc=p("ZodCIDRv4",(e,t)=>{jn.init(e,t),z.init(e,t)});var Sc=p("ZodCIDRv6",(e,t)=>{Rn.init(e,t),z.init(e,t)});var Oc=p("ZodBase64",(e,t)=>{Ln.init(e,t),z.init(e,t)});var Ic=p("ZodBase64URL",(e,t)=>{Fn.init(e,t),z.init(e,t)});var Ec=p("ZodE164",(e,t)=>{Mn.init(e,t),z.init(e,t)});var Ac=p("ZodJWT",(e,t)=>{Un.init(e,t),z.init(e,t)});var Tc=p("ZodUnknown",(e,t)=>{Jn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>li(e,r,n,o)});function Li(){return Jo(Tc)}var Nc=p("ZodNever",(e,t)=>{Bn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ai(e,r,n,o)});function Cc(e){return Bo(Nc,e)}var jc=p("ZodArray",(e,t)=>{Nt(),Vn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mi(e,r,n,o),e.element=t.element},{min(e,t){return this.check(H(e,t))},nonempty(e){return this.check(H(1,e))},max(e,t){return this.check(Re(e,t))},length(e,t){return this.check(De(e,t))},unwrap(){return this.element}});function Rc(e,t){return Vo(jc,e,t)}var Dc=p("ZodObject",(e,t)=>{Nt(),Gn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hi(e,r,n,o),ps(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Jc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(A(this._zod.def,{catchall:e}))},passthrough(){return this.clone(A(this._zod.def,{catchall:Li()}))},loose(){return this.clone(A(this._zod.def,{catchall:Li()}))},strict(){return this.clone(A(this._zod.def,{catchall:Cc()}))},strip(){return this.clone(A(this._zod.def,{catchall:void 0}))},extend(e){return ns(this,e)},safeExtend(e){return os(this,e)},merge(e){return is(this,e)},pick(e){return ts(this,e)},omit(e){return rs(this,e)},partial(...e){return Qt(Vi,this,e[0])},exactPartial(...e){return Qt(Ki,this,e[0],"exactPartial")},required(...e){return ss(Wi,this,e[0])}});function Bi(e,t){let r={type:"object",shape:e??{},...g(t)};return new Dc(r)}var Lc=p("ZodUnion",(e,t)=>{qn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gi(e,r,n,o),e.options=t.options});function Fc(e,t){return new Lc({type:"union",options:e,...g(t)})}var Mc=p("ZodIntersection",(e,t)=>{Xn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_i(e,r,n,o)});function Uc(e,t){return new Mc({type:"intersection",left:e,right:t})}var Tt=p("ZodEnum",(e,t)=>{Yn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,i)=>pi(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 Tt({...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 Tt({...t,checks:[],...g(o),entries:i})}});function Jc(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Tt({type:"enum",entries:r,...g(t)})}var Bc=p("ZodTransform",(e,t)=>{Nt(),Hn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>di(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new le(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(G(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(G(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 Vc(e){return new Bc({type:"transform",transform:e})}var Vi=p("ZodOptional",(e,t)=>{lt.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Et(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Fi(e){return new Vi({type:"optional",innerType:e})}var Ki=p("ZodExactOptional",(e,t)=>{Qn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Et(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Kc(e){return new Ki({type:"optional",innerType:e})}var Wc=p("ZodNullable",(e,t)=>{eo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Mi(e){return new Wc({type:"nullable",innerType:e})}var Gc=p("ZodDefault",(e,t)=>{to.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function qc(e,t){return new Gc({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ke(t)}})}var Xc=p("ZodPrefault",(e,t)=>{ro.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Yc(e,t){return new Xc({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ke(t)}})}var Wi=p("ZodNonOptional",(e,t)=>{no.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yi(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Hc(e,t){return new Wi({type:"nonoptional",innerType:e,...g(t)})}var Qc=p("ZodCatch",(e,t)=>{oo.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$i(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function eu(e,t){return new Qc({type:"catch",innerType:e,catchValue:typeof t==="function"?t:nr(t)})}var tu=p("ZodPipe",(e,t)=>{io.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wi(e,r,n,o),e.in=t.in,e.out=t.out});function Ui(e,t){return new tu({type:"pipe",in:e,out:t})}var ru=p("ZodReadonly",(e,t)=>{so.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ki(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function nu(e){return new ru({type:"readonly",innerType:e})}var ou=p("ZodCustom",(e,t)=>{co.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fi(e,r,n,o)});function iu(e,t={}){return Ko(ou,e,t)}function su(e,t){return Wo(e,t)}var jt=Bi({path:Ct().trim().nonempty(),component:Ct().trim().nonempty()});class Rt{document;constructor(e){this.document=e}getRoutes(){let e=this.document.querySelector(`script#${Ue.routesId}[type="application/json"]`);if(!e)return;try{let t=e.textContent.trim(),r=JSON.parse(t);if(!Array.isArray(r))return;return r.map((n)=>{let o=jt.safeParse(n);return!o.success?null:o.data}).filter((n)=>!!n)}catch(t){console.error("Error on parse JSON:",t);return}}}export{Gi as Vanilla};
|
|
64
|
+
|
|
65
|
+
//# debugId=4DF7E2545CE2355B64756E2164756E21
|