@mmon-co/ncept-bb 0.0.0-stage → 0.2.0

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/server.js ADDED
@@ -0,0 +1,69 @@
1
+ import { createRequire as __createRequire } from "node:module";
2
+ import { dirname as __pathDirname } from "node:path";
3
+ import { fileURLToPath as __fileURLToPath } from "node:url";
4
+ const require = __createRequire(import.meta.url);
5
+ var __filename = __fileURLToPath(import.meta.url);
6
+ var __dirname = __pathDirname(__filename);
7
+ var Pl=Object.defineProperty;var s=(e,t)=>Pl(e,"name",{value:t,configurable:!0});var ye=(e,t)=>{for(var r in t)Pl(e,r,{get:t[r],enumerable:!0})};import{basename as py}from"node:path";import{cliCommand as Wo,defineCli as dy}from"@get-bb/plugin-sdk";import{defineRpcContract as $d}from"@get-bb/plugin-sdk";var m={};ye(m,{$brand:()=>ai,$input:()=>Tc,$output:()=>Ec,INVALID:()=>Y,NEVER:()=>ui,TimePrecision:()=>Wc,ZodAny:()=>Ea,ZodArray:()=>La,ZodBase64:()=>Do,ZodBase64URL:()=>jo,ZodBigInt:()=>Dt,ZodBigIntFormat:()=>Vo,ZodBoolean:()=>Tt,ZodCIDRv4:()=>Eo,ZodCIDRv6:()=>To,ZodCUID:()=>So,ZodCUID2:()=>Po,ZodCatch:()=>il,ZodCodec:()=>Er,ZodCompileAsyncError:()=>fe,ZodCompileUnsupportedError:()=>A,ZodCreditCard:()=>Ia,ZodCustom:()=>Tr,ZodCustomStringFormat:()=>He,ZodDate:()=>Pr,ZodDefault:()=>Qa,ZodDiscriminatedUnion:()=>Va,ZodE164:()=>Lo,ZodEmail:()=>ko,ZodEmoji:()=>zo,ZodEnum:()=>Nt,ZodError:()=>jg,ZodExactOptional:()=>Bo,ZodFile:()=>Ga,ZodFirstPartyTypeKind:()=>$l,ZodFunction:()=>hl,ZodGUID:()=>xo,ZodIBAN:()=>Sa,ZodIPv4:()=>No,ZodIPv6:()=>Co,ZodISODate:()=>Ce,ZodISODateTime:()=>Ne,ZodISODuration:()=>Te,ZodISOTime:()=>Ee,ZodInstanceOf:()=>_l,ZodIntersection:()=>Ma,ZodIssueCode:()=>Vg,ZodJWT:()=>Ro,ZodKSUID:()=>Ao,ZodLazy:()=>pl,ZodLiteral:()=>qa,ZodMAC:()=>za,ZodMap:()=>Ka,ZodNaN:()=>cl,ZodNanoID:()=>Io,ZodNever:()=>Da,ZodNonOptional:()=>Jo,ZodNull:()=>Na,ZodNullable:()=>Ha,ZodNumber:()=>Et,ZodNumberFormat:()=>Qe,ZodObject:()=>Or,ZodOptional:()=>Nr,ZodPipe:()=>Cr,ZodPrefault:()=>tl,ZodPreprocess:()=>ul,ZodPromise:()=>ml,ZodReadonly:()=>al,ZodRealError:()=>oe,ZodRecord:()=>At,ZodSet:()=>Wa,ZodString:()=>Ct,ZodStringFormat:()=>j,ZodSuccess:()=>ol,ZodSymbol:()=>Oa,ZodTemplateLiteral:()=>fl,ZodTransform:()=>Xa,ZodTuple:()=>Ua,ZodType:()=>Z,ZodULID:()=>Zo,ZodURL:()=>Sr,ZodUUID:()=>ge,ZodUndefined:()=>Aa,ZodUnion:()=>Ar,ZodUnknown:()=>Ta,ZodVoid:()=>ja,ZodXID:()=>Oo,ZodXor:()=>Ra,_ZodString:()=>vo,_default:()=>el,_function:()=>Qp,any:()=>Op,array:()=>Zr,base64:()=>lp,base64url:()=>fp,bigint:()=>zp,boolean:()=>Za,catch:()=>sl,check:()=>ed,cidrv4:()=>up,cidrv6:()=>ap,clone:()=>E,codec:()=>Gp,coerce:()=>bl,compile:()=>Rc,config:()=>M,core:()=>ve,creditCard:()=>dp,cuid:()=>ep,cuid2:()=>tp,currencyCode:()=>$p,custom:()=>td,date:()=>Np,decode:()=>_a,decodeAsync:()=>wa,deepPartial:()=>md,describe:()=>rd,discriminatedUnion:()=>Lp,e164:()=>pp,email:()=>Bf,emoji:()=>Hf,encode:()=>ya,encodeAsync:()=>$a,endsWith:()=>wt,enum:()=>Fo,exactOptional:()=>Ya,file:()=>Jp,flattenError:()=>Xt,float32:()=>bp,float64:()=>vp,formatError:()=>Yt,fromJSONSchema:()=>pd,function:()=>Qp,getDiscriminatedOption:()=>uc,getErrorMap:()=>Fg,globalRegistry:()=>K,gt:()=>me,gte:()=>se,guid:()=>Jf,hash:()=>wp,hex:()=>_p,hostname:()=>yp,httpUrl:()=>Yf,iban:()=>mp,includes:()=>_t,input:()=>gd,instanceof:()=>od,int:()=>wo,int32:()=>kp,int64:()=>Ip,intersection:()=>Fa,invertCodec:()=>Xp,ipv4:()=>ip,ipv6:()=>cp,iso:()=>Dr,json:()=>sd,jwt:()=>hp,keyof:()=>Cp,ksuid:()=>op,lazy:()=>dl,length:()=>We,literal:()=>Bp,locales:()=>yr,looseObject:()=>Dp,looseRecord:()=>Vp,lowercase:()=>gt,lt:()=>de,lte:()=>ie,mac:()=>sp,map:()=>Mp,maxLength:()=>Ke,maxSize:()=>Pe,memoizer:()=>hr,meta:()=>nd,mime:()=>vt,minLength:()=>be,minSize:()=>he,multipleOf:()=>Se,nan:()=>qp,nanoid:()=>Qf,nativeEnum:()=>Up,negative:()=>uo,never:()=>Mo,nonnegative:()=>lo,nonoptional:()=>nl,nonpositive:()=>ao,normalize:()=>kt,null:()=>Ca,nullable:()=>Ir,nullish:()=>Kp,number:()=>Pa,object:()=>Ep,optional:()=>Xe,output:()=>yd,overwrite:()=>pe,parse:()=>da,parseAsync:()=>ma,partialRecord:()=>Rp,pipe:()=>bo,positive:()=>co,prefault:()=>rl,preprocess:()=>cd,prettifyError:()=>mi,promise:()=>Hp,properties:()=>bt,property:()=>fo,readonly:()=>ll,record:()=>Ja,refine:()=>gl,regex:()=>ht,regexes:()=>ae,registry:()=>Dn,safeDecode:()=>va,safeDecodeAsync:()=>xa,safeEncode:()=>ba,safeEncodeAsync:()=>ka,safeParse:()=>ha,safeParseAsync:()=>ga,set:()=>Fp,setErrorMap:()=>Mg,size:()=>Je,slugify:()=>St,startsWith:()=>$t,strictObject:()=>Tp,string:()=>zr,stringFormat:()=>gp,stringbool:()=>id,success:()=>Wp,superRefine:()=>yl,symbol:()=>Pp,templateLiteral:()=>Yp,toJSONSchema:()=>go,toLowerCase:()=>zt,toUpperCase:()=>It,toZod:()=>Vt,transform:()=>Uo,treeifyError:()=>di,trim:()=>xt,tuple:()=>Ba,uint32:()=>xp,uint64:()=>Sp,ulid:()=>rp,undefined:()=>Zp,union:()=>jt,unknown:()=>Ge,uppercase:()=>yt,url:()=>Xf,util:()=>x,uuid:()=>Kf,uuidv4:()=>Wf,uuidv6:()=>qf,uuidv7:()=>Gf,validate:()=>Ht,validateAsync:()=>Qt,void:()=>Ap,withParser:()=>jn,xid:()=>np,xor:()=>jp});var ve={};ye(ve,{$ZodAny:()=>Qs,$ZodArray:()=>ic,$ZodAsyncError:()=>re,$ZodBase64:()=>Ms,$ZodBase64URL:()=>Fs,$ZodBigInt:()=>zn,$ZodBigIntFormat:()=>Gs,$ZodBoolean:()=>ar,$ZodCIDRv4:()=>Rs,$ZodCIDRv6:()=>Vs,$ZodCUID:()=>Ss,$ZodCUID2:()=>Ps,$ZodCatch:()=>xc,$ZodCheck:()=>L,$ZodCheckBigIntFormat:()=>es,$ZodCheckEndsWith:()=>ps,$ZodCheckGreaterThan:()=>an,$ZodCheckIncludes:()=>ls,$ZodCheckLengthEquals:()=>ss,$ZodCheckLessThan:()=>un,$ZodCheckLowerCase:()=>us,$ZodCheckMaxLength:()=>os,$ZodCheckMaxSize:()=>ts,$ZodCheckMimeType:()=>hs,$ZodCheckMinLength:()=>is,$ZodCheckMinSize:()=>rs,$ZodCheckMultipleOf:()=>Hi,$ZodCheckNumberFormat:()=>Qi,$ZodCheckOverwrite:()=>gs,$ZodCheckProperties:()=>ms,$ZodCheckProperty:()=>ds,$ZodCheckRegex:()=>cs,$ZodCheckSizeEquals:()=>ns,$ZodCheckStartsWith:()=>fs,$ZodCheckStringFormat:()=>ft,$ZodCheckUpperCase:()=>as,$ZodCodec:()=>fr,$ZodCreditCard:()=>Bs,$ZodCustom:()=>Ac,$ZodCustomStringFormat:()=>Ws,$ZodCyclicError:()=>Nn,$ZodDate:()=>nc,$ZodDefault:()=>wc,$ZodDiscriminatedUnion:()=>ac,$ZodE164:()=>Us,$ZodEmail:()=>bs,$ZodEmoji:()=>zs,$ZodEncodeError:()=>ze,$ZodEnum:()=>mc,$ZodError:()=>pi,$ZodExactOptional:()=>_c,$ZodFile:()=>gc,$ZodFunction:()=>Zc,$ZodGUID:()=>$s,$ZodIBAN:()=>Js,$ZodIPv4:()=>Ds,$ZodIPv6:()=>js,$ZodISODate:()=>Cs,$ZodISODateTime:()=>Ns,$ZodISODuration:()=>Ts,$ZodISOTime:()=>Es,$ZodIntersection:()=>lc,$ZodJWT:()=>Ks,$ZodKSUID:()=>As,$ZodLazy:()=>pr,$ZodLiteral:()=>hc,$ZodMAC:()=>Ls,$ZodMap:()=>pc,$ZodNaN:()=>zc,$ZodNanoID:()=>Is,$ZodNever:()=>tc,$ZodNonOptional:()=>vc,$ZodNull:()=>Hs,$ZodNullable:()=>$c,$ZodNumber:()=>xn,$ZodNumberFormat:()=>qs,$ZodObject:()=>lf,$ZodObjectJIT:()=>sc,$ZodOptional:()=>Sn,$ZodPipe:()=>Pn,$ZodPrefault:()=>bc,$ZodPreprocess:()=>Ic,$ZodPromise:()=>Oc,$ZodReadonly:()=>Sc,$ZodRealError:()=>ne,$ZodRecord:()=>fc,$ZodRegistry:()=>Tn,$ZodSet:()=>dc,$ZodString:()=>Me,$ZodStringFormat:()=>T,$ZodSuccess:()=>kc,$ZodSymbol:()=>Xs,$ZodTemplateLiteral:()=>Pc,$ZodTransform:()=>yc,$ZodTuple:()=>In,$ZodType:()=>P,$ZodULID:()=>Zs,$ZodURL:()=>xs,$ZodUUID:()=>ws,$ZodUndefined:()=>Ys,$ZodUnion:()=>lr,$ZodUnknown:()=>ec,$ZodVoid:()=>rc,$ZodXID:()=>Os,$ZodXor:()=>cc,$brand:()=>ai,$constructor:()=>g,$input:()=>Tc,$output:()=>Ec,Doc:()=>Ve,INVALID:()=>Y,JSONSchema:()=>Mf,JSONSchemaGenerator:()=>yo,NEVER:()=>ui,TimePrecision:()=>Wc,URL_BAD_FORMAT:()=>vs,URL_UNPARSEABLE:()=>or,ZodCompileAsyncError:()=>fe,ZodCompileUnsupportedError:()=>A,_any:()=>lu,_array:()=>yu,_base64:()=>no,_base64url:()=>oo,_bigint:()=>nu,_boolean:()=>tu,_catch:()=>zg,_check:()=>zf,_cidrv4:()=>to,_cidrv6:()=>ro,_coercedBigint:()=>ou,_coercedBoolean:()=>ru,_coercedDate:()=>hu,_coercedNumber:()=>Gc,_coercedString:()=>Uc,_creditCard:()=>Jc,_cuid:()=>qn,_cuid2:()=>Gn,_custom:()=>$u,_date:()=>mu,_decode:()=>Xr,_decodeAsync:()=>Hr,_default:()=>vg,_discriminatedUnion:()=>lg,_e164:()=>io,_email:()=>Vn,_emoji:()=>Kn,_encode:()=>Gr,_encodeAsync:()=>Yr,_endsWith:()=>wt,_enum:()=>gg,_file:()=>_u,_float32:()=>Yc,_float64:()=>Hc,_gt:()=>me,_gte:()=>se,_guid:()=>Mn,_iban:()=>Kc,_includes:()=>_t,_int:()=>Xc,_int32:()=>Qc,_int64:()=>iu,_intersection:()=>fg,_ipv4:()=>Qn,_ipv6:()=>eo,_isoDate:()=>wr,_isoDateTime:()=>$r,_isoDuration:()=>vr,_isoTime:()=>br,_jwt:()=>so,_ksuid:()=>Hn,_lazy:()=>Zg,_length:()=>We,_literal:()=>_g,_lowercase:()=>gt,_lt:()=>de,_lte:()=>ie,_mac:()=>Bc,_map:()=>mg,_max:()=>ie,_maxLength:()=>Ke,_maxSize:()=>Pe,_mime:()=>vt,_min:()=>se,_minLength:()=>be,_minSize:()=>he,_multipleOf:()=>Se,_nan:()=>gu,_nanoid:()=>Wn,_nativeEnum:()=>yg,_negative:()=>uo,_never:()=>pu,_nonnegative:()=>lo,_nonoptional:()=>kg,_nonpositive:()=>ao,_normalize:()=>kt,_null:()=>au,_nullable:()=>bg,_number:()=>qc,_optional:()=>wg,_overwrite:()=>pe,_parse:()=>ct,_parseAsync:()=>ut,_pipe:()=>Ig,_positive:()=>co,_promise:()=>Og,_properties:()=>bt,_property:()=>fo,_readonly:()=>Sg,_record:()=>dg,_refine:()=>wu,_regex:()=>ht,_safeDecode:()=>en,_safeDecodeAsync:()=>rn,_safeEncode:()=>Qr,_safeEncodeAsync:()=>tn,_safeParse:()=>at,_safeParseAsync:()=>lt,_set:()=>hg,_size:()=>Je,_slugify:()=>St,_startsWith:()=>$t,_string:()=>Fc,_stringFormat:()=>qe,_stringbool:()=>xu,_success:()=>xg,_superRefine:()=>bu,_symbol:()=>cu,_templateLiteral:()=>Pg,_toLowerCase:()=>zt,_toUpperCase:()=>It,_transform:()=>$g,_trim:()=>xt,_tuple:()=>pg,_uint32:()=>eu,_uint64:()=>su,_ulid:()=>Xn,_undefined:()=>uu,_union:()=>ug,_unknown:()=>fu,_uppercase:()=>yt,_url:()=>_r,_uuid:()=>Fn,_uuidv4:()=>Un,_uuidv6:()=>Bn,_uuidv7:()=>Jn,_void:()=>du,_xid:()=>Yn,_xor:()=>ag,base64Charset:()=>$n,base64urlCharset:()=>ur,canParseURL:()=>ks,clone:()=>E,compile:()=>Rc,compileFn:()=>Ln,config:()=>M,createStandardJSONSchemaMethod:()=>Pt,createToJSONSchemaMethod:()=>Iu,decode:()=>hm,decodeAsync:()=>ym,describe:()=>vu,encode:()=>mm,encodeAsync:()=>gm,extractDefs:()=>Oe,finalize:()=>Ae,flattenError:()=>Xt,formatError:()=>Yt,getDiscriminatedOption:()=>uc,globalConfig:()=>B,globalRegistry:()=>K,handleUnrepresentable:()=>F,initializeContext:()=>Ze,isBackEdge:()=>En,isRecursiveSchema:()=>Cn,isValidBase64:()=>cr,isValidBase64URL:()=>wn,isValidCIDRv6:()=>_n,isValidCreditCard:()=>bn,isValidIBAN:()=>vn,isValidIPv6:()=>sr,isValidJWT:()=>kn,locales:()=>yr,memoizer:()=>hr,mergeValues:()=>pt,meta:()=>ku,parse:()=>Wr,parseAsync:()=>qr,parseURLObject:()=>cf,prettifyError:()=>mi,process:()=>D,processSchema:()=>D,regexes:()=>ae,registry:()=>Dn,safeDecode:()=>$m,safeDecodeAsync:()=>bm,safeEncode:()=>_m,safeEncodeAsync:()=>wm,safeParse:()=>am,safeParseAsync:()=>lm,standardProps:()=>mn,stripTabAndNewline:()=>ir,toDotPath:()=>Rl,toJSONSchema:()=>go,toZod:()=>Vt,treeifyError:()=>di,urlHostnameOk:()=>gn,urlProtocolOk:()=>yn,util:()=>x,validate:()=>Ht,validateAsync:()=>Qt,validateURL:()=>hn,version:()=>ys,withParser:()=>jn});var x={};ye(x,{BIGINT_FORMAT_RANGES:()=>Jt,CONSTANT_CATCH:()=>Jr,Class:()=>Yo,NUMBER_FORMAT_RANGES:()=>Bt,aborted:()=>X,allowsEval:()=>ei,assert:()=>Zd,assertEqual:()=>zd,assertIs:()=>Sd,assertNever:()=>Pd,assertNotEqual:()=>Id,assignProp:()=>J,attachSchema:()=>Kt,base64ToUint8Array:()=>Cl,base64urlToUint8Array:()=>qd,cached:()=>nt,captureStackTrace:()=>Fr,cleanEnum:()=>Wd,cleanRegex:()=>$e,clone:()=>E,cloneDef:()=>Nd,codePointLength:()=>Le,constantCatch:()=>si,createTransparentProxy:()=>Ld,defineLazy:()=>Ho,defineLazyInternal:()=>O,derived:()=>Hd,esc:()=>G,escapeRegex:()=>ue,explicitlyAborted:()=>ni,extend:()=>Md,finalizeIssue:()=>te,floatSafeRemainder:()=>Mt,getElementAtPath:()=>Cd,getEnumValues:()=>tt,getLengthableOrigin:()=>qt,getParsedType:()=>jd,getSizableOrigin:()=>Wt,hexToUint8Array:()=>Xd,hide:()=>Gt,installLazyProp:()=>rm,isObject:()=>je,isPlainObject:()=>ce,issue:()=>st,joinValues:()=>Vr,jsonStringifyReplacer:()=>rt,members:()=>ii,merge:()=>Ud,mergeDefs:()=>le,normalizeParams:()=>w,nullish:()=>Mr,numKeys:()=>Dd,objectClone:()=>Od,omit:()=>Vd,optionalKeys:()=>ri,own:()=>xe,parsedType:()=>oi,partial:()=>Bd,pick:()=>Rd,prefixIssues:()=>ee,primitiveTypes:()=>ti,promiseAllObject:()=>Ed,propertyKeyTypes:()=>Ut,randomString:()=>Td,rawShape:()=>ot,required:()=>Jd,safeExtend:()=>Fd,shallowClone:()=>Ft,sizeCaps:()=>it,slugify:()=>Qo,stringifyPrimitive:()=>Ur,toZod:()=>Vt,uint8ArrayToBase64:()=>El,uint8ArrayToBase64url:()=>Gd,uint8ArrayToHex:()=>Yd,unwrapMessage:()=>et});function zd(e){return e}s(zd,"assertEqual");function Id(e){return e}s(Id,"assertNotEqual");function Vt(){return e=>e}s(Vt,"toZod");function Sd(e){}s(Sd,"assertIs");function Pd(e){throw new Error("Unexpected value in exhaustive check")}s(Pd,"assertNever");function Zd(e){}s(Zd,"assert");function tt(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)}s(tt,"getEnumValues");function Vr(e,t="|"){return e.map(r=>Ur(r)).join(t)}s(Vr,"joinValues");function rt(e,t){return typeof t=="bigint"?t.toString():t}s(rt,"jsonStringifyReplacer");var Xo=class{static{s(this,"Cached")}constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function nt(e){return new Xo(e)}s(nt,"cached");function Mr(e){return e==null}s(Mr,"nullish");function $e(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}s($e,"cleanRegex");function Mt(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}s(Mt,"floatSafeRemainder");var Zl=Symbol("evaluating");function Ho(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Zl)return n===void 0&&(n=Zl,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}s(Ho,"defineLazy");function Od(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}s(Od,"objectClone");function J(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}s(J,"assignProp");function ot(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}s(ot,"rawShape");function _e(e){return ot(e._zod.def)??e._zod.def.shape}s(_e,"sourceShape");function Ol(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return J(this,t,n),n},enumerable:!0,configurable:!0})}s(Ol,"deferProp");function Al(e,t,r){t in e?J(e,t,r):e[t]=r}s(Al,"putProp");function De(e,t,r,n){let o=_e(t);for(let i of r){let c=Object.getOwnPropertyDescriptor(o,i);c.enumerable&&(c.get?Ol(e,i,()=>{let u=t._zod.def.shape[i];return n?n(u,i):u}):Al(e,i,n?n(c.value,i):c.value))}}s(De,"mirrorShape");function Ad(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?Ol(e,r,()=>t[r]):Al(e,r,n.value))}}s(Ad,"mirrorProps");function le(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}s(le,"mergeDefs");function Nd(e){return le(e._zod.def)}s(Nd,"cloneDef");function Cd(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}s(Cd,"getElementAtPath");function Ed(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}s(Ed,"promiseAllObject");function Td(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}s(Td,"randomString");function G(e){return JSON.stringify(e)}s(G,"esc");function Qo(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}s(Qo,"slugify");var Fr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function je(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(je,"isObject");var ei=nt(()=>{if(B.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ce(e){if(je(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(je(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}s(ce,"isPlainObject");function Ft(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}s(Ft,"shallowClone");function Dd(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}s(Dd,"numKeys");var jd=s(e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},"getParsedType"),Ut=new Set(["string","number","symbol"]),ti=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ue(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(ue,"escapeRegex");function E(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}s(E,"clone");function w(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:s(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:s(()=>t.error,"error")}:t}s(w,"normalizeParams");function Ld(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}s(Ld,"createTransparentProxy");function Ur(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}s(Ur,"stringifyPrimitive");function ri(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}s(ri,"optionalKeys");var Bt={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Jt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Rd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return De(i,e,Br(e,t)),E(e,le(r,{shape:i,checks:[]}))}s(Rd,"pick");function Br(e,t){let r=_e(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}s(Br,"maskedKeys");function Vd(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Br(e,t)),c={};return De(c,e,Reflect.ownKeys(_e(e)).filter(u=>!i.has(u))),E(e,le(r,{shape:c,checks:[]}))}s(Vd,"omit");function Md(e,t){if(!ce(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=_e(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return E(e,le(e._zod.def,{shape:Nl(e,t)}))}s(Md,"extend");function Nl(e,t){let r={};return De(r,e,Reflect.ownKeys(_e(e))),Ad(r,t),r}s(Nl,"extended");function Fd(e,t){if(!ce(t))throw new Error("Invalid input to safeExtend: expected a plain object");return E(e,le(e._zod.def,{shape:Nl(e,t)}))}s(Fd,"safeExtend");function Ud(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};De(r,e,Reflect.ownKeys(_e(e))),De(r,t,Reflect.ownKeys(_e(t)));let n=le(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return E(e,n)}s(Ud,"merge");function Bd(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let u=r?new Set(Br(t,r)):void 0,a={};return De(a,t,Reflect.ownKeys(_e(t)),e&&((l,f)=>u&&!u.has(f)?l:new e({type:"optional",innerType:l}))),E(t,le(t._zod.def,{shape:a,checks:[]}))}s(Bd,"partial");function Jd(e,t,r){let n=r?new Set(Br(t,r)):void 0,o={};return De(o,t,Reflect.ownKeys(_e(t)),(i,c)=>n&&!n.has(c)?i:new e({type:"nonoptional",innerType:i})),E(t,le(t._zod.def,{shape:o}))}s(Jd,"required");function X(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}s(X,"aborted");function ni(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}s(ni,"explicitlyAborted");function ee(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}s(ee,"prefixIssues");function et(e){return typeof e=="string"?e:e?.message}s(et,"unwrapMessage");function it(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;o>=0&&t.push([o,r])}return t}s(it,"sizeCaps");function Kt(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}s(Kt,"attachSchema");function te(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,c=e.message?e.message:et(e.inst?._zod.def?.error?.(e))??et(i?.(e))??et(t?.error?.(e))??et(r.customError?.(e))??et(r.localeError?.(e))??"Invalid input",u={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(u[a]=e[a]);return u.path??(u.path=[]),u.message=c,t?.reportInput&&(u.input=e.input),u}s(te,"finalizeIssue");function Wt(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}s(Wt,"getSizableOrigin");var Kd=/[\uD800-\uDBFF]/;function Le(e){let t=e.length;if(!Kd.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}s(Le,"codePointLength");function qt(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}s(qt,"getLengthableOrigin");function oi(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}s(oi,"parsedType");function st(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}s(st,"issue");function Wd(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}s(Wd,"cleanEnum");function Cl(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}s(Cl,"base64ToUint8Array");function El(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}s(El,"uint8ArrayToBase64");function qd(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Cl(t+r)}s(qd,"base64urlToUint8Array");function Gd(e){return El(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s(Gd,"uint8ArrayToBase64url");function Xd(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}s(Xd,"hexToUint8Array");function Yd(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}s(Yd,"uint8ArrayToHex");var Yo=class{static{s(this,"Class")}constructor(...t){}};function ii(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Qd(e,r,n.value)}}s(ii,"members");function xe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}s(xe,"own");function Gt(e,t,r){return xe(e,t,r,!1)}s(Gt,"hide");function Hd(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return xe(this,r,n(this))},set(o){xe(this,r,o)}})}return t}s(Hd,"derived");function Qd(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:xe(this,t,r.bind(this))},set(n){xe(this,t,n)}})}s(Qd,"defineBound");function em(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}s(em,"claim");var Go,ke=!1,tm={configurable:!0,get(){ke=!0}};function O(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&Go!==e._zod){Go=void 0;return}Go=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,tm);let o=ke;ke=!1;try{let i=r(this);return ke?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),ke=ke||o,i}catch(i){throw delete this[t],ke=ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}s(O,"defineLazyInternal");function rm(e,t,r,n){let o=em(e,t);o&&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})}})}s(rm,"installLazyProp");var Jr="~constantCatch";function si(e){let t=s(()=>e,"fn");return t[Jr]=!0,t}s(si,"constantCatch");var Tl,ui=Object.freeze({status:"aborted"}),ci={value:void 0,enumerable:!1},Dl="captureStackTrace"in Error?Error:null;function nm(e){let t=Dl;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return Dl=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}s(nm,"newError");function g(e,t,r,n){let o={};function i(d){this.def=d,this.constr=p,this.traits=new Set}s(i,"Internals"),i.prototype=o;let c=r,u=c&&new WeakSet;function a(d,h){if(d._zod){if(d._zod.traits.has(e))return}else{ci.value=new i(h);try{Object.defineProperty(d,"_zod",ci)}finally{ci.value=void 0}}if(d._zod.traits.add(e),t(d,h),u){let _=Object.getPrototypeOf(d),$=d._zod.constr.prototype,b=_;for(;b&&b!==$;)b=Object.getPrototypeOf(b);let k=b??_;u.has(k)||(u.add(k),ii(k,c))}let y=p.prototype;for(let _ in y)Object.prototype.hasOwnProperty.call(y,_)&&(_ in d||(d[_]=y[_].bind(d)))}s(a,"init");let l=n?.Parent??Object;class f extends l{static{s(this,"Definition")}}Object.defineProperty(f,"name",{value:e});function p(d){let h=n?.Parent?nm(f):this;a(h,d);let y=h._zod.deferred;if(y){for(let $ of y)$();h._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(h),h}return s(p,"_"),Object.defineProperty(p,"init",{value:a}),Object.defineProperty(p,Symbol.hasInstance,{value:s(d=>n?.Parent&&d instanceof n.Parent?!0:d?._zod?.traits?.has(e),"value")}),Object.defineProperty(p,"name",{value:e}),p}s(g,"$constructor");var ai=Symbol("zod_brand"),re=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ze=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Tl=globalThis).__zod_globalConfig??(Tl.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function M(e){return e&&Object.assign(B,e),B}s(M,"config");function om(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,rt,2)),e.message}s(om,"_getMessage");function im(e){this._zod.message=e}s(im,"_setMessage");var sm={get:om,set:im,enumerable:!0,configurable:!0},fi={value:void 0,enumerable:!1},jl=new WeakSet([Object.prototype,Error.prototype]),Ll=s((e,t)=>{e.name="$ZodError",fi.value=t,Object.defineProperty(e,"issues",fi),fi.value=void 0,Object.defineProperty(e,"message",sm);let r=Object.getPrototypeOf(e);jl.has(r)||(jl.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=s(()=>this.message,"value");return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},"initializer"),pi=g("$ZodError",Ll),ne=g("$ZodError",Ll,void 0,{Parent:Error});function cm(e,t,r){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0}):e[t]=r()),e[t]}s(cm,"node");function Xt(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?cm(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}s(Xt,"flattenError");function Yt(e,t=r=>r.message){let r={_errors:[]},n=s((o,i=[])=>{for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>n({issues:u},[...i,...c.path]));else if(c.code==="invalid_key")n({issues:c.issues},[...i,...c.path]);else if(c.code==="invalid_element")n({issues:c.issues},[...i,...c.path]);else{let u=[...i,...c.path];if(u.length===0)r._errors.push(t(c));else{let a=r,l=0;for(;l<u.length;){let f=u[l],p=l===u.length-1;if(f==="_errors"){p&&a._errors.push(t(c)),l++;continue}Object.prototype.hasOwnProperty.call(a,f)||Object.defineProperty(a,f,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=a[f];p&&d._errors.push(t(c)),a=d,l++}}}},"processError");return n(e),r}s(Yt,"formatError");function di(e,t=r=>r.message){let r={errors:[]},n=s((o,i=[])=>{var c;for(let u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(a=>n({issues:a},[...i,...u.path]));else if(u.code==="invalid_key")n({issues:u.issues},[...i,...u.path]);else if(u.code==="invalid_element")n({issues:u.issues},[...i,...u.path]);else{let a=[...i,...u.path];if(a.length===0){r.errors.push(t(u));continue}let l=r,f=0;for(;f<a.length;){let p=a[f],d=f===a.length-1;typeof p=="string"?(l.properties??(l.properties={}),Object.prototype.hasOwnProperty.call(l.properties,p)||Object.defineProperty(l.properties,p,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),l=l.properties[p]):(l.items??(l.items=[]),(c=l.items)[p]??(c[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(u)),f++}}},"processError");return n(e),r}s(di,"treeifyError");function Rl(e){let t=[],r=e.map(n=>typeof n=="object"?n.key:n);for(let n of r)typeof n=="number"?t.push(`[${n}]`):typeof n=="symbol"?t.push(`[${JSON.stringify(String(n))}]`):/[^\w$]/.test(n)?t.push(`[${JSON.stringify(n)}]`):(t.length&&t.push("."),t.push(n));return t.join("")}s(Rl,"toDotPath");function mi(e){let t=[],r=[...e.issues].sort((n,o)=>(n.path??[]).length-(o.path??[]).length);for(let n of r)t.push(`\u2716 ${n.message}`),n.path?.length&&t.push(` \u2192 at ${Rl(n.path)}`);return t.join(`
8
+ `)}s(mi,"prettifyError");function Kr(e,t){return{callee:t?.callee??e,Err:t?.Err}}s(Kr,"finalizeParams");var ct=s(e=>{let t=s((r,n,o,i)=>{let c=o?{...o,async:!1}:{async:!1},u=r._zod.run({value:n,issues:[]},c);if(u instanceof Promise)throw new re;if(u.issues.length){let a=new(i?.Err??e)(u.issues.map(l=>te(l,c,M())));throw Fr(a,i?.callee??t),a}return u.value},"fn");return t},"_parse"),Wr=ct(ne),ut=s(e=>{let t=s(async(r,n,o,i)=>{let c=o?{...o,async:!0}:{async:!0},u=r._zod.run({value:n,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){let a=new(i?.Err??e)(u.issues.map(l=>te(l,c,M())));throw Fr(a,i?.callee??t),a}return u.value},"fn");return t},"_parseAsync"),qr=ut(ne),at=s(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 re;return i.issues.length?Vl(e,i.issues,o):{success:!0,data:i.value}},"_safeParse"),am=at(ne);function Vl(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>te(o,r,M()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}s(Vl,"failure");var lt=s(e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?Vl(e,i.issues,o):{success:!0,data:i.value}},"_safeParseAsync"),lm=lt(ne),fm=Symbol.for("zod.compile.invalid"),pm=Symbol.for("zod.compile.fallback"),Ht=s(((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==fm)return!0;if(n.definite===!0&&r===void 0)return!1}return dm(e,t,r)}),"validate");function dm(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[pm]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new re;return i.issues.length===0}s(dm,"validateFallback");var Qt=s(async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);return o instanceof Promise&&(o=await o),o.issues.length===0},"validateAsync"),Gr=s(e=>{let t=ct(e),r=s((n,o,i,c)=>{let u=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,u,Kr(r,c))},"fn");return r},"_encode"),mm=Gr(ne),Xr=s(e=>{let t=ct(e),r=s((n,o,i,c)=>t(n,o,i,Kr(r,c)),"fn");return r},"_decode"),hm=Xr(ne),Yr=s(e=>{let t=ut(e),r=s(async(n,o,i,c)=>{let u=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,u,Kr(r,c))},"fn");return r},"_encodeAsync"),gm=Yr(ne),Hr=s(e=>{let t=ut(e),r=s(async(n,o,i,c)=>await t(n,o,i,Kr(r,c)),"fn");return r},"_decodeAsync"),ym=Hr(ne),Qr=s(e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return at(e)(t,r,o)},"_safeEncode"),_m=Qr(ne),en=s(e=>(t,r,n)=>at(e)(t,r,n),"_safeDecode"),$m=en(ne),tn=s(e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return lt(e)(t,r,o)},"_safeEncodeAsync"),wm=tn(ne),rn=s(e=>async(t,r,n)=>lt(e)(t,r,n),"_safeDecodeAsync"),bm=rn(ne);var ae={};ye(ae,{anyString:()=>Mi,base64:()=>Ni,base64url:()=>Ci,bigint:()=>Ui,boolean:()=>Bi,browserEmail:()=>Zm,cidrv4:()=>Oi,cidrv6:()=>Ai,creditCard:()=>nn,cuid:()=>gi,cuid2:()=>yi,currencyCode:()=>ji,date:()=>Li,datetime:()=>Vi,domain:()=>Ti,duration:()=>ki,e164:()=>Di,email:()=>zi,emoji:()=>Ii,extendedDuration:()=>vm,guid:()=>xi,hex:()=>Gi,hostname:()=>Ei,html5Email:()=>Im,httpProtocol:()=>er,iban:()=>on,idnEmail:()=>Pm,integer:()=>tr,ipv4:()=>Si,ipv6:()=>Pi,ksuid:()=>wi,lowercase:()=>Wi,mac:()=>Zi,md5_base64:()=>Cm,md5_base64url:()=>Em,md5_hex:()=>Nm,nanoid:()=>bi,nanoidOfLength:()=>vi,null:()=>Ji,number:()=>we,rfc5322Email:()=>Sm,sha1_base64:()=>Dm,sha1_base64url:()=>jm,sha1_hex:()=>Tm,sha256_base64:()=>Rm,sha256_base64url:()=>Vm,sha256_hex:()=>Lm,sha384_base64:()=>Fm,sha384_base64url:()=>Um,sha384_hex:()=>Mm,sha512_base64:()=>Jm,sha512_base64url:()=>Km,sha512_hex:()=>Bm,string:()=>Fi,time:()=>Ri,ulid:()=>_i,undefined:()=>Ki,unicodeEmail:()=>Ml,uppercase:()=>qi,uuid:()=>Re,uuid4:()=>km,uuid6:()=>xm,uuid7:()=>zm,xid:()=>$i});var gi=/^[cC][0-9a-z]{6,}$/,yi=/^[0-9a-z]+$/,_i=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,$i=/^[0-9a-vA-V]{20}$/,wi=/^[A-Za-z0-9]{27}$/,bi=/^[a-zA-Z0-9_-]{21}$/;function vi(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}s(vi,"nanoidOfLength");var ki=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,vm=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,xi=/^([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})$/,Re=s(e=>e?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})$`):/^([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)$/,"uuid"),km=Re(4),xm=Re(6),zm=Re(7),zi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Im=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Sm=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Ml=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Pm=Ml,Zm=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Om="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ii(){return new RegExp(Om,"u")}s(Ii,"emoji");var Si=/^(?:(?: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])$/,Pi=/^(([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}|:))$/,Zi=s(e=>{let t=ue(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},"mac"),Oi=/^((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])$/,Ai=/^(([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])$/,Ni=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ci=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ei=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Ti=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,er=/^https?$/,Di=/^\+[1-9]\d{6,14}$/,nn=/^\d(?:[ -]?\d){11,18}$/,ji=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,on=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Fl="(?:(?:\\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 Am(e){return new RegExp(`^${e}$`)}s(Am,"anchor");var Li=Am(Fl);function hi(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}s(hi,"timeSource");function Ri(e){return new RegExp(`^${hi(e)}$`)}s(Ri,"time");function Vi(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${hi({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${hi({precision:e.precision})}`:r;return new RegExp(`^${Fl}T(?:${n})$`)}s(Vi,"datetime");var Mi=/^[\s\S]{0,}$/,Fi=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),Ui=/^-?\d+n?$/,tr=/^-?\d+$/,we=/^-?\d+(?:\.\d+)?$/,Bi=/^(?:true|false)$/i,Ji=/^null$/i;var Ki=/^undefined$/i;var Wi=/^[^A-Z]*$/,qi=/^[^a-z]*$/,Gi=/^[0-9a-fA-F]*$/;function rr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}s(rr,"fixedBase64");function nr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}s(nr,"fixedBase64url");var Nm=/^[0-9a-fA-F]{32}$/,Cm=rr(22,"=="),Em=nr(22),Tm=/^[0-9a-fA-F]{40}$/,Dm=rr(27,"="),jm=nr(27),Lm=/^[0-9a-fA-F]{64}$/,Rm=rr(43,"="),Vm=nr(43),Mm=/^[0-9a-fA-F]{96}$/,Fm=rr(64,""),Um=nr(64),Bm=/^[0-9a-fA-F]{128}$/,Jm=rr(86,"=="),Km=nr(86);var L=g("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Xi=s(e=>{let t=e.value;return!Mr(t)&&t.size!==void 0},"_whenHasSize"),Yi=s(e=>{let t=e.value;return!Mr(t)&&t.length!==void 0},"_whenHasLength"),sn={number:"number",bigint:"bigint",object:"date"},un=g("$ZodCheckLessThan",(e,t)=>{L.init(e,t);let r=sn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:sn[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})}}),an=g("$ZodCheckGreaterThan",(e,t)=>{L.init(e,t);let r=sn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:sn[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})}}),Hi=g("$ZodCheckMultipleOf",(e,t)=>{L.init(e,t),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?t.value!==BigInt(0)&&r.value%t.value===BigInt(0):Mt(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),Qi=g("$ZodCheckNumberFormat",(e,t)=>{L.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Bt[t.format];e._zod.check=c=>{let u=c.value;if(r){if(!Number.isInteger(u)){c.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?c.issues.push({input:u,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}):c.issues.push({input:u,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}}u<o&&c.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>i&&c.issues.push({origin:"number",input:u,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),es=g("$ZodCheckBigIntFormat",(e,t)=>{L.init(e,t);let[r,n]=Jt[t.format];e._zod.check=o=>{let i=o.value;i<r&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:r,inclusive:!0,inst:e,continue:!t.abort}),i>n&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!t.abort})}}),ts=g("$ZodCheckMaxSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Xi),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Wt(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rs=g("$ZodCheckMinSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Xi),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Wt(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ns=g("$ZodCheckSizeEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Xi),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let c=i>t.size;n.issues.push({origin:Wt(o),...c?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),os=g("$ZodCheckMaxLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Yi),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Le(o):i)<=t.maximum)return;let u=qt(o);n.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),is=g("$ZodCheckMinLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Yi),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Le(o):i)>=t.minimum)return;let u=qt(o);n.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ss=g("$ZodCheckLengthEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=Yi),e._zod.check=n=>{let o=n.value,i=o.length,c=typeof o=="string"&&i>=t.length&&i<=t.length*2?Le(o):i;if(c===t.length)return;let u=qt(o),a=c>t.length;n.issues.push({origin:u,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ft=g("$ZodCheckStringFormat",(e,t)=>{var r,n;L.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&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})}):(n=e._zod).check??(n.check=()=>{})}),cs=g("$ZodCheckRegex",(e,t)=>{ft.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),us=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Wi),ft.init(e,t)}),as=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=qi),ft.init(e,t)}),ls=g("$ZodCheckIncludes",(e,t)=>{L.init(e,t);let r=ue(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),fs=g("$ZodCheckStartsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`^${ue(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ps=g("$ZodCheckEndsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`.*${ue(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function cn(e,t,r){e.issues.length&&t.issues.push(...ee(r,e.issues))}s(cn,"handleCheckPropertyResult");var ds=g("$ZodCheckProperty",(e,t)=>{L.init(e,t),e._zod.check=r=>{let n=t.schema._zod.run({value:r.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(o=>cn(o,r,t.property));cn(n,r,t.property)}}),ms=g("$ZodCheckProperties",(e,t)=>{L.init(e,t),Gt(e,Symbol.iterator,function*(){yield e});let r;e._zod.check=n=>{if(n.value==null){n.issues.push({expected:"object",code:"invalid_type",input:n.value,inst:e});return}r??(r=Reflect.ownKeys(t.shape).map(c=>[c,t.shape[c]]));let o=n.value,i;for(let[c,u]of r){let a=u._zod.run({value:o[c],issues:[]},{});a instanceof Promise?(i??(i=[]),i.push(a.then(l=>cn(l,n,c)))):cn(a,n,c)}if(i)return Promise.all(i).then(()=>{})}}),hs=g("$ZodCheckMimeType",(e,t)=>{L.init(e,t);let r=new Set(t.mime);e._zod.check=n=>{r.has(n.value.type)||n.issues.push({code:"invalid_value",values:t.mime,input:n.value.type,inst:e,continue:!t.abort})}}),gs=g("$ZodCheckOverwrite",(e,t)=>{L.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ve=class{static{s(this,"Doc")}constructor(t=[],r={}){this.content=[],this.indent=0,this.args=t,this.closed=r}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let n=t.split(`
9
+ `).filter(c=>c),o=Math.min(...n.map(c=>c.length-c.trimStart().length)),i=n.map(c=>c.slice(o)).map(c=>" ".repeat(this.indent*2)+c);for(let c of i)this.content.push(c)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
10
+ ${r.join(`
11
+ `)}
12
+ };`)(...Object.values(this.closed))}};var ys={major:4,minor:6,patch:7};var P=g("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ys;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let c of i._zod.onattach)c(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=s((u,a,l)=>{if(u.memo)return u;let f=X(u),p;for(let d of a){if(d._zod.def.when){if(ni(u)||!d._zod.def.when(u))continue}else if(f)continue;let h=u.issues.length,y=d._zod.check(u);if(y instanceof Promise&&l?.async===!1)throw new re;if(p||y instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await y,u.issues.length!==h&&(Kt(u.issues,h,e),f||(f=X(u,h)))});else{if(u.issues.length===h)continue;Kt(u.issues,h,e),f||(f=X(u,h))}}return p?p.then(()=>u):u},"runChecks"),c=s((u,a,l)=>{if(X(u))return u.aborted=!0,u;let f=i(a,o,l);if(f instanceof Promise){if(l.async===!1)throw new re;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(u,a)=>{if(a.skipChecks)return e._zod.parse(u,a);if(a.direction==="backward"){let f=e._zod.parse({value:u.value,issues:[]},{...a,skipChecks:!0});return f instanceof Promise?f.then(p=>c(p,u,a)):c(f,u,a)}let l=e._zod.parse(u,a);if(l instanceof Promise){if(a.async===!1)throw new re;return l.then(f=>i(f,o,a))}return i(l,o,a)}}},{get"~standard"(){return Gt(this,"~standard",mn(this))},set"~standard"(e){xe(this,"~standard",e)}}),sf=s((e,t)=>e.issues.length?{issues:e.issues.map(r=>te(r,t,M()))}:{value:e.value},"toStandardResult");async function Wm(e,t){let r={async:!0};return sf(await e._zod.run({value:t,issues:[]},r),r)}s(Wm,"validateAsync");function mn(e){return{validate:s(t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return sf(n,r)}catch{}return Wm(e,t)},"validate"),vendor:"zod",version:1}}s(mn,"standardProps");var Me=g("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=t.pattern??Mi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),T=g("$ZodStringFormat",(e,t)=>{ft.init(e,t),Me.init(e,t)}),$s=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=xi),T.init(e,t)}),ws=g("$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 new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Re(n))}else t.pattern??(t.pattern=Re());T.init(e,t)}),bs=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=zi),T.init(e,t)}),vs=1,or=2;function ks(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}s(ks,"canParseURL");function hn(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?ks(e)||or:cf(e,t)}s(hn,"validateURL");function cf(e,t){if(!t.normalize&&t.protocol?.source===er.source&&!/^https?:\/\//i.test(e))return vs;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??or}return new URL(e)}catch{return or}}s(cf,"parseURLObject");var qm=/[\t\n\r]/g;function ir(e){return e.replace(qm,"")}s(ir,"stripTabAndNewline");function gn(e,t){return t.lastIndex=0,t.test(e.hostname)}s(gn,"urlHostnameOk");function yn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}s(yn,"urlProtocolOk");var xs=g("$ZodURL",(e,t)=>{T.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=hn(n,t);if(o===vs){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===or){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=ir(n);return}t.hostname&&!gn(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}),t.protocol&&!yn(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:ir(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),zs=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ii()),T.init(e,t)}),Is=g("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?bi:vi(t.length)),T.init(e,t)}),Ss=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=gi),T.init(e,t)}),Ps=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=yi),T.init(e,t)}),Zs=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=_i),T.init(e,t)}),Os=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=$i),T.init(e,t)}),As=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=wi),T.init(e,t)}),Ns=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Vi(t)),T.init(e,t)}),Cs=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Li),T.init(e,t)}),Es=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ri(t)),T.init(e,t)}),Ts=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=ki),T.init(e,t)}),Ds=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Si),T.init(e,t)}),Gm=/^[0-9a-fA-F:.]+$/;function sr(e){return Gm.test(e)?ks(`http://[${e}]`):!1}s(sr,"isValidIPv6");var js=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Pi),T.init(e,t),e._zod.check=r=>{sr(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),Ls=g("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Zi(t.delimiter)),T.init(e,t)}),Rs=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Oi),T.init(e,t)});function _n(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);return`${o}`!==n||o<0||o>128?!1:sr(r)}s(_n,"isValidCIDRv6");var Vs=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ai),T.init(e,t),e._zod.check=r=>{_n(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function cr(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}s(cr,"isValidBase64");var $n=/^[0-9a-zA-Z+/]*={0,2}$/,Ms=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=$n),T.init(e,t),e._zod.check=r=>{cr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),ur=/^[A-Za-z0-9_-]*$/;function wn(e){if(!ur.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return cr(r)}s(wn,"isValidBase64URL");var Fs=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ur),T.init(e,t),e._zod.check=r=>{wn(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Us=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Di),T.init(e,t)}),Xm=/[- ]/g;function Ym(e){let t=e.length,r=1,n=0;for(;t;){let o=e.charCodeAt(--t)-48;r^=1,n+=r?[0,2,4,6,8,1,3,5,7,9][o]:o}return n%10===0}s(Ym,"isLuhnAlgo");function bn(e){return nn.test(e)?Ym(e.replace(Xm,"")):!1}s(bn,"isValidCreditCard");var Bs=g("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=nn),T.init(e,t),e._zod.check=r=>{bn(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function Hm(e){let t=0,r=e.length;for(let n=4;n<r;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let n=0;n<4;n++){let o=e.charCodeAt(n);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}s(Hm,"isIso7064Mod97");function vn(e){return on.test(e)?Hm(e):!1}s(vn,"isValidIBAN");var Js=g("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=on),T.init(e,t),e._zod.check=r=>{vn(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function kn(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));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}s(kn,"isValidJWT");var Ks=g("$ZodJWT",(e,t)=>{T.init(e,t),e._zod.check=r=>{kn(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Ws=g("$ZodCustomStringFormat",(e,t)=>{T.init(e,t),e._zod.check=r=>{t.fn(r.value)||r.issues.push({code:"invalid_format",format:t.format,input:r.value,inst:e,continue:!t.abort})}}),xn=g("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=we,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}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)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}}),qs=g("$ZodNumberFormat",(e,t)=>{Qi.init(e,t),xn.init(e,t)}),ar=g("$ZodBoolean",(e,t)=>{P.init(e,t),e._zod.pattern=Bi,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),zn=g("$ZodBigInt",(e,t)=>{P.init(e,t),e._zod.pattern=Ui,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=BigInt(r.value)}catch{}return typeof r.value=="bigint"||r.issues.push({expected:"bigint",code:"invalid_type",input:r.value,inst:e}),r}}),Gs=g("$ZodBigIntFormat",(e,t)=>{es.init(e,t),zn.init(e,t)}),Xs=g("$ZodSymbol",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o=="symbol"||r.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),r}}),Ys=g("$ZodUndefined",(e,t)=>{P.init(e,t),e._zod.pattern=Ki,e._zod.values=new Set([void 0]),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),r}}),Hs=g("$ZodNull",(e,t)=>{P.init(e,t),e._zod.pattern=Ji,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{let o=r.value;return o===null||r.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),r}}),Qs=g("$ZodAny",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),ec=g("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),tc=g("$ZodNever",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)}),rc=g("$ZodVoid",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return typeof o>"u"||r.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),r}}),nc=g("$ZodDate",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=new Date(r.value)}catch{}let o=r.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||r.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),r}});function oc(e,t){let r=it(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,c)=>{let u=t(i.value);if(u>n&&!c?.skipChecks&&c?.direction!=="backward"){for(let[a,l]of it(e._zod.def.checks))if(u>a&&l._zod.def.when(i)){let f=i.issues.length;return l._zod.check(i),i.issues[f].continue=!1,Kt(i.issues,f,e),i}}return o(i,c)}}s(oc,"capSize");var Qm=s(e=>Array.isArray(e)?e.length:-1,"arraySize"),eh=s(e=>e instanceof Map?e.size:-1,"mapSize"),th=s(e=>e instanceof Set?e.size:-1,"setSize");function Bl(e,t,r){e.issues.length&&t.issues.push(...ee(r,e.issues)),t.value[r]=e.value}s(Bl,"handleArrayResult");var ic=g("$ZodArray",(e,t)=>{P.init(e,t);let r=B.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 c=[],u=o?.abortEarly;for(let a=0;a<i.length;a++){let l=i[a],f=t.element._zod.run({value:l,issues:[]},o);if(f instanceof Promise)c.push(f.then(p=>Bl(p,n,a)));else if(Bl(f,n,a),u&&f.issues.length!==0&&X(f))break}return c.length?Promise.all(c).then(()=>n):n},oc(e,Qm)});function dn(e,t,r,n,o,i){let c=r in n,u=i==="optional";if(!(!c&&u&&o==="optional")){if(e.issues.length){if(o!==void 0&&u&&!c)return;t.issues.push(...ee(r,e.issues))}if(!c&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(c||o==="defaulted"&&!u)&&(t.value[r]=void 0):t.value[r]=e.value}}s(dn,"handlePropertyResult");var rh=[];function uf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:rh,o=n.length?[...t,...n]:t;for(let c of o)if(!e.shape?.[c]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(c)}": expected a Zod schema`);let i=ri(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}s(uf,"normalizeDef");function af(e,t,r,n,o,i,c){let u=[],a=o.keySet,l=o.catchall._zod,f=l.def.type,p=l.optin,d=l.optout,h=0;for(let y in t){if(c&&r.issues.length!==h){if(X(r,h))break;h=r.issues.length}if(a.has(y))continue;if(y==="__proto__"){f==="never"&&u.push(y);continue}if(f==="never"){u.push(y);continue}let _=l.run({value:t[y],issues:[]},n);_ instanceof Promise?e.push(_.then($=>dn($,r,y,t,p,d))):dn(_,r,y,t,p,d)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}s(af,"handleCatchall");var lf=g("$ZodObject",(e,t)=>{P.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=s(()=>{let f={...n};return Object.defineProperty(t,"shape",{value:f}),l.raw=f,f},"get");l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=nt(()=>uf(t));O(e,"propValues",l=>{let f=l.def.shape,p={};for(let d in f){let h=f[d]._zod;if(h.values){Object.prototype.hasOwnProperty.call(p,d)||J(p,d,new Set);for(let y of h.values)p[d].add(y);h.optin!==void 0&&p[d].add(void 0)}}return p});let i=je,c=t.catchall,u,a=B.memoizer;a?.attach(e),e._zod.parse=(l,f)=>{u??(u=o.value);let p=l.value;if(!i(p))return l.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),l;l.value=a?a.alloc(e,l,{},f):{};let d=[],h=u.shape,y=f?.abortEarly,_=l.issues.length;for(let $ of u.allKeys){if(y&&l.issues.length!==_){if(X(l,_))break;_=l.issues.length}if($==="__proto__")continue;let b=h[$],k=b._zod.optin,S=b._zod.optout,C=b._zod.run({value:p[$],issues:[]},f);C instanceof Promise?d.push(C.then(R=>dn(R,l,$,p,k,S))):dn(C,l,$,p,k,S)}return c?af(d,p,l,f,o.value,e,y===!0):d.length?Promise.all(d).then(()=>l):l}}),sc=g("$ZodObjectJIT",(e,t)=>{lf.init(e,t);let r=e._zod.parse,n=nt(()=>uf(t)),o=B.memoizer,i=s(h=>{let y=n.value,_=y.symbolKeys,$=new Ve(["payload","ctx"],{shape:h,inst:e,memo:o,syms:_}),b=s(R=>`shape[${R}]._zod.run({ value: input[${R}], issues: [] }, ctx)`,"parseStr"),k=s((R,N)=>`
13
+ let ${R}_ab = false;
14
+ for (let i = 0; i < ${R}.issues.length; i++) {
15
+ const iss = ${R}.issues[i];
16
+ iss.path = iss.path ? [${N}, ...iss.path] : [${N}];
17
+ payload.issues.push(iss);
18
+ if (iss.continue !== true) ${R}_ab = true;
19
+ }
20
+ if (${R}_ab && ctx && ctx.abortEarly) {
21
+ payload.value = newResult;
22
+ return payload;
23
+ }`,"prefixStr");$.write("const input = payload.value;");let S=Object.create(null),C=0;for(let R of y.allKeys)S[R]=`key_${C++}`;$.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let R of y.allKeys){if(R==="__proto__")continue;let N=S[R],W=typeof R=="symbol"?`syms[${_.indexOf(R)}]`:G(R),Rt=`${W} in input`,Il=h[R],qo=Il?._zod?.optin,Sl=qo!==void 0,kd=Il?._zod?.optout==="optional";if($.write(`const ${N} = ${b(W)};`),Sl&&kd){let xd=qo==="optional"?`${N}_present`:`${N}.value !== undefined || ${N}_present`;$.write(`
24
+ const ${N}_present = ${Rt};
25
+ if (!${N}.issues.length || ${N}_present) {
26
+ if (${N}.issues.length) {${k(N,W)}
27
+ }
28
+
29
+ if (${xd}) {
30
+ newResult[${W}] = ${N}.value;
31
+ }
32
+ }
33
+
34
+ `)}else Sl?($.write(`
35
+ if (${N}.issues.length) {${k(N,W)}
36
+ }
37
+ `),qo==="defaulted"?$.write(`newResult[${W}] = ${N}.value;`):$.write(`
38
+ if (${N}.value !== undefined || ${Rt}) {
39
+ newResult[${W}] = ${N}.value;
40
+ }
41
+ `)):$.write(`
42
+ const ${N}_present = ${Rt};
43
+ if (${N}.issues.length) {${k(N,W)}
44
+ }
45
+ if (!${N}_present && !${N}.issues.length) {
46
+ payload.issues.push({
47
+ code: "invalid_type",
48
+ expected: "nonoptional",
49
+ input: undefined,
50
+ path: [${W}]
51
+ });
52
+ if (ctx && ctx.abortEarly) {
53
+ payload.value = newResult;
54
+ return payload;
55
+ }
56
+ }
57
+
58
+ if (${N}_present) {
59
+ newResult[${W}] = ${N}.value;
60
+ }
61
+
62
+ `)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},"generateFastpass"),c,u=je,a=!B.jitless,f=a&&ei.value,p=t.catchall,d;e._zod.parse=(h,y)=>{d??(d=n.value);let _=h.value;return u(_)?a&&f&&y?.async===!1&&y.jitless!==!0?(c||(c=i(t.shape)),h=c(h,y),p?af([],_,h,y,d,e,y?.abortEarly===!0):h):r(h,y):(h.issues.push({expected:"object",code:"invalid_type",input:_,inst:e}),h)}});function Jl(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=>!X(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(c=>te(c,n,M())))}),t)}s(Jl,"handleUnionResults");var lr=g("$ZodUnion",(e,t)=>{P.init(e,t),O(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),O(e,"optout",n=>n.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),O(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)))}),O(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=>$e(i.source)).join("|")})$`)}});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,c=[];for(let u of t.options){let a=u._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)c.push(a),i=!0;else{if(a.issues.length===0)return a;c.push(a)}}return i?Promise.all(c).then(u=>Jl(u,n,e,o)):Jl(c,n,e,o)}});function Kl(e,t,r,n){let o=[];for(let i=0;i<e.length;i++)e[i].issues.length===0&&o.push(i);return o.length===1?(t.value=e[o[0]].value,t):(o.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(c=>te(c,n,M())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}s(Kl,"handleExclusiveUnionResults");var cc=g("$ZodXor",(e,t)=>{lr.init(e,t),t.inclusive=!1;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,c=[];for(let u of t.options){let a=u._zod.run({value:n.value,issues:[]},o);a instanceof Promise?(c.push(a),i=!0):c.push(a)}return i?Promise.all(c).then(u=>Kl(u,n,e,o)):Kl(c,n,e,o)}});function uc(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=ff(r.def),r.bag.optionsMap=n);let o=n.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}s(uc,"getDiscriminatedOption");function ff(e){let t=new Map;for(let r of e.options){let n=r._zod.propValues?.[e.discriminator];if(!n||n.size===0)throw new 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 new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,r)}return t}s(ff,"discriminatorMap");var ac=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,lr.init(e,t);let r=e._zod.parse;O(e,"propValues",o=>{let i={},c=0;for(let u of o.def.options){let a=u._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(u)}"`);a[o.def.discriminator]?.has(void 0)&&c++;for(let[l,f]of Object.entries(a)){Object.prototype.hasOwnProperty.call(i,l)||J(i,l,new Set);for(let p of f)i[l].add(p)}}return!o.def.unionFallback&&c>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let c=ot(o._zod.def);if(c&&!Object.prototype.hasOwnProperty.call(c,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=nt(()=>ff(t));e._zod.parse=(o,i)=>{let c=o.value;if(!je(c))return o.issues.push({code:"invalid_type",expected:"object",input:c,inst:e}),o;let u=c?.[t.discriminator],a=n.value.get(u);return a&&(u!==void 0||i.direction!=="backward")?a._zod.run(o,i):t.unionFallback||i.direction==="backward"?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(n.value.keys()).filter(l=>n.value.get(l)!==null),input:c,path:[t.discriminator],inst:e}),o)}}),lc=g("$ZodIntersection",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),c=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||c instanceof Promise?Promise.all([i,c]).then(([a,l])=>Wl(r,a,l)):Wl(r,i,c)}});function pt(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(ce(e)&&ce(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let c=pt(e[i],t[i]);if(!c.valid)return{valid:!1,mergeErrorPath:[i,...c.mergeErrorPath]};o[i]=c.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],c=pt(o,i);if(!c.valid)return{valid:!1,mergeErrorPath:[n,...c.mergeErrorPath]};r.push(c.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}s(pt,"mergeValues");function Wl(e,t,r){let n=new Map,o,i=new Map,c=s((l,f)=>{let p;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),p=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let d=String(l.path[0]);i.has(d)||i.set(d,l),p=[d]}else return!1;for(let d of p)n.has(d)||n.set(d,{}),n.get(d)[f]=!0;return!0},"collect");for(let l of t.issues)c(l,"l")||e.issues.push(l);for(let l of r.issues)c(l,"r")||e.issues.push(l);let u=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(u.length){let l=o?u.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of u)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let a=pt(t.value,r.value);if(!a.valid){if(X(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}s(Wl,"handleIntersectionResults");var In=g("$ZodTuple",(e,t)=>{P.init(e,t);let r=t.items,n=B.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let c=o.value;if(!Array.isArray(c))return o.issues.push({input:c,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let u=[],a=ql(r,"optin"),l=ql(r,"optout");if(!t.rest){if(c.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:c,inst:e,origin:"array"}),o;c.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:c,inst:e,origin:"array"})}let f=new Array(r.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let h=0;h<r.length;h++){let y=r[h]._zod.run({value:c[h],issues:[]},i);y instanceof Promise?u.push(y.then(_=>{f[h]=_})):(f[h]=y,p&&!d&&y.issues.length&&(d=X(y)))}if(t.rest&&!d){let h=r.length-1,y=c.slice(r.length),_=o.issues.length;for(let $ of y){if(p&&o.issues.length!==_){if(X(o,_))break;_=o.issues.length}h++;let b=t.rest._zod.run({value:$,issues:[]},i);b instanceof Promise?u.push(b.then(k=>Gl(k,o,h))):Gl(b,o,h)}}return u.length?Promise.all(u).then(()=>Xl(f,o,r,c,l)):Xl(f,o,r,c,l)}});function ql(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}s(ql,"getTupleOptStart");function Gl(e,t,r){e.issues.length&&t.issues.push(...ee(r,e.issues)),t.value[r]=e.value}s(Gl,"handleTupleResult");function Xl(e,t,r,n,o){for(let i=0;i<r.length;i++){let c=e[i],u=i<n.length;if(!u&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(c.issues.length){if(!u&&i>=o){t.value.length=i;break}t.issues.push(...ee(i,c.issues))}t.value[i]=c.value}for(let i=t.value.length-1;i>=n.length&&(r[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}s(Xl,"handleTupleResults");var fc=g("$ZodRecord",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!ce(i))return n.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),n;let c=[],u=t.keyType._zod.values;if(u&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let f of u)if(typeof f=="string"||typeof f=="number"||typeof f=="symbol"){if(a.add(typeof f=="number"?f.toString():f),f==="__proto__")continue;let p=t.keyType._zod.run({value:f,issues:[]},o);if(p instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(p.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:p.issues.map(y=>te(y,o,M())),input:f,path:[f],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let h=t.valueType._zod.run({value:i[f],issues:[]},o);h instanceof Promise?c.push(h.then(y=>{y.issues.length&&n.issues.push(...ee(f,y.issues)),n.value[d]=y.value})):(h.issues.length&&n.issues.push(...ee(f,h.issues)),n.value[d]=h.value)}let l;for(let f in i)if(!a.has(f))if(t.mode==="loose"){if(f==="__proto__")continue;n.value[f]=i[f]}else l=l??[],l.push(f);l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{n.value=r?r.alloc(e,n,{},o):{};let a;for(let l of Reflect.ownKeys(i)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,l))continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&we.test(l)&&f.issues.length){let y=t.keyType._zod.run({value:Number(l),issues:[]},o);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");y.issues.length===0&&(f=y)}if(f.issues.length){t.mode==="loose"?n.value[l]=i[l]:u?(a=a??[],a.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(y=>te(y,o,M())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let h=t.valueType._zod.run({value:i[l],issues:[]},o);h instanceof Promise?c.push(h.then(y=>{y.issues.length&&n.issues.push(...ee(l,y.issues)),n.value[d]=y.value})):(h.issues.length&&n.issues.push(...ee(l,h.issues)),n.value[d]=h.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return c.length?Promise.all(c).then(()=>n):n}}),pc=g("$ZodMap",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Map))return n.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),n;let c=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let u=o?.abortEarly,a=n.issues.length;for(let[l,f]of i){if(u&&n.issues.length!==a){if(X(n,a))break;a=n.issues.length}let p=t.keyType._zod.run({value:l,issues:[]},o),d=t.valueType._zod.run({value:f,issues:[]},o);p instanceof Promise||d instanceof Promise?c.push(Promise.all([p,d]).then(([h,y])=>{Yl(h,y,n,l,i,e,o)})):Yl(p,d,n,l,i,e,o)}return c.length?Promise.all(c).then(()=>n):n},oc(e,eh)});function Yl(e,t,r,n,o,i,c){e.issues.length&&(Ut.has(typeof n)?r.issues.push(...ee(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(u=>te(u,c,M()))})),t.issues.length&&(Ut.has(typeof n)?r.issues.push(...ee(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(u=>te(u,c,M()))})),r.value.set(e.value,t.value)}s(Yl,"handleMapResult");var dc=g("$ZodSet",(e,t)=>{P.init(e,t);let r=B.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!(i instanceof Set))return n.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),n;let c=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let u=o?.abortEarly,a=n.issues.length;for(let l of i){if(u&&n.issues.length!==a){if(X(n,a))break;a=n.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?c.push(f.then(p=>Hl(p,n))):Hl(f,n)}return c.length?Promise.all(c).then(()=>n):n},oc(e,th)});function Hl(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}s(Hl,"handleSetResult");var mc=g("$ZodEnum",(e,t)=>{P.init(e,t);let r=tt(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=tt(o.def.entries).filter(c=>Ut.has(typeof c));return new RegExp(i.length?`^(${i.map(c=>ue(c.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let c=o.value;return n.has(c)||o.issues.push({code:"invalid_value",values:r,input:c,inst:e}),o}}),hc=g("$ZodLiteral",(e,t)=>{P.init(e,t);let r=new Set(t.values);e._zod.values=r,O(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?ue(i):i?ue(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}}),gc=g("$ZodFile",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;return o instanceof File||r.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),r}}),yc=g("$ZodTransform",(e,t)=>{P.init(e,t),e._zod.optin="optional",B.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ze(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(c=>(r.value=c,r));if(o instanceof Promise)throw new re;return r.value=o,r}});function Ql(e,t){return e.value=t.issues.length?void 0:t.value,e}s(Ql,"handleOptionalResult");var Sn=g("$ZodOptional",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",O(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${$e(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);return o instanceof Promise?o.then(i=>Ql(r,i)):Ql(r,o)}return t.innerType._zod.run(r,n)}}),_c=g("$ZodExactOptional",(e,t)=>{Sn.init(e,t),O(e,"values",r=>r.def.innerType._zod.values),O(e,"pattern",r=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),$c=g("$ZodNullable",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin),O(e,"optout",r=>r.def.innerType._zod.optout),O(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${$e(n.source)}|null)$`):void 0}),O(e,"values",r=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),wc=g("$ZodDefault",(e,t)=>{P.init(e,t),e._zod.optin="defaulted",O(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);return o instanceof Promise?o.then(i=>ef(i,t)):ef(o,t)}});function ef(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}s(ef,"handleDefaultResult");var bc=g("$ZodPrefault",(e,t)=>{P.init(e,t),e._zod.optin="defaulted",O(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),vc=g("$ZodNonOptional",(e,t)=>{P.init(e,t),O(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);return o instanceof Promise?o.then(i=>tf(i,e)):tf(o,e)}});function tf(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}s(tf,"handleNonOptionalResult");var kc=g("$ZodSuccess",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ze("ZodSuccess");let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.issues.length===0,r)):(r.value=o.issues.length===0,r)}});function rf(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>te(o,n,M()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}s(rf,"handleCatchResult");var xc=g("$ZodCatch",(e,t)=>{P.init(e,t),O(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),O(e,"optout",r=>r.def.innerType._zod.optout),O(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);return o instanceof Promise?o.then(i=>rf(r,i,t,n)):rf(r,o,t,n)}}),zc=g("$ZodNaN",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>((typeof r.value!="number"||!Number.isNaN(r.value))&&r.issues.push({input:r.value,inst:e,expected:"nan",code:"invalid_type"}),r)}),Pn=g("$ZodPipe",(e,t)=>{P.init(e,t),O(e,"values",r=>r.def.in._zod.values),O(e,"optin",r=>r.def.in._zod.optin),O(e,"optout",r=>r.def.out._zod.optout),O(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);return i instanceof Promise?i.then(c=>ln(c,t.in,n)):ln(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>ln(i,t.out,n)):ln(o,t.out,n)}});function ln(e,t,r){return e.issues.some(n=>n.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}s(ln,"handlePipeResult");var fr=g("$ZodCodec",(e,t)=>{P.init(e,t),O(e,"values",r=>r.def.in._zod.values),O(e,"optin",r=>r.def.in._zod.optin),O(e,"optout",r=>r.def.out._zod.optout),O(e,"propValues",r=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if((n.direction||"forward")==="forward"){let i=t.in._zod.run(r,n);return i instanceof Promise?i.then(c=>fn(c,t,n)):fn(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(c=>fn(c,t,n)):fn(i,t,n)}}});function fn(e,t,r){if(e.issues.length)return e.aborted=!0,e;if((r.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>pn(e,i,t.out,r)):pn(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>pn(e,i,t.in,r)):pn(e,o,t.in,r)}}s(fn,"handleCodecAResult");function pn(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}s(pn,"handleCodecTxResult");var Ic=g("$ZodPreprocess",(e,t)=>{Pn.init(e,t)}),Sc=g("$ZodReadonly",(e,t)=>{P.init(e,t),O(e,"propValues",r=>r.def.innerType._zod.propValues),O(e,"values",r=>r.def.innerType._zod.values),O(e,"optin",r=>r.def.innerType?._zod?.optin),O(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);return o instanceof Promise?o.then(nf):nf(o)}});function nf(e){return e.memo||(e.value=Object.freeze(e.value)),e}s(nf,"handleReadonlyResult");function nh(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let u of t.checks??[]){let a=u._zod.def;a.pattern&&(r=a.pattern),n||(n=!!a.format?.includes("int"));let l=a.minimum??a.length,f=a.maximum??a.length;l!==void 0&&(o===void 0||l>o)&&(o=l),f!==void 0&&(i===void 0||f<i)&&(i=f)}if(r)return r.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Fi({minimum:o,maximum:i}).source;let c=e._zod.pattern;return(n&&c===we?tr:c)?.source}s(nh,"leafPattern");function _s(e){let t=e._zod.def,r=e._zod.pattern?.source,n=t.innerType??e._zod.innerType;if(n){let o=n._zod.pattern?.source,i=_s(n);return r&&o&&i&&i!==o?r.replace($e(o),()=>$e(i)):r}if(t.options){let o=t.options.map(_s);if(o.every(Boolean))return`^(${o.map(i=>$e(i)).join("|")})$`}return nh(e)}s(_s,"partPattern");var Pc=g("$ZodTemplateLiteral",(e,t)=>{P.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=_s(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push($e(o))}else if(n===null||ti.has(typeof n))r.push(ue(`${n}`));else throw new Error(`Invalid template literal part: ${n}`);e._zod.pattern=new RegExp(`^${r.join("")}$`),e._zod.parse=(n,o)=>typeof n.value!="string"?(n.issues.push({input:n.value,inst:e,expected:"string",code:"invalid_type"}),n):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(n.value)||n.issues.push({input:n.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),n)}),Zc=g("$ZodFunction",(e,t)=>(P.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=r=>{if(typeof r!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...n){let o=e._def.input?Wr(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?Wr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=r=>{if(typeof r!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...n){let o=e._def.input?await qr(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await qr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(r,n)=>typeof r.value!="function"?(r.issues.push({code:"invalid_type",expected:"function",input:r.value,inst:e}),r):(e._def.output&&e._def.output._zod.def.type==="promise"?r.value=e.implementAsync(r.value):r.value=e.implement(r.value),r),e.input=(...r)=>{let n=e.constructor;return Array.isArray(r[0])?new n({type:"function",input:new In({type:"tuple",items:r[0],rest:r[1]}),output:e._def.output}):new n({type:"function",input:r[0],output:e._def.output})},e.output=r=>{let n=e.constructor;return new n({type:"function",input:e._def.input,output:r})},e)),Oc=g("$ZodPromise",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>Promise.resolve(r.value).then(o=>t.innerType._zod.run({value:o,issues:[]},n))}),pr=g("$ZodLazy",(e,t)=>{P.init(e,t),Ho(e._zod,"innerType",()=>{let r=t;return r._cachedInner||(r._cachedInner=t.getter()),r._cachedInner}),O(e,"pattern",r=>r.innerType?._zod?.pattern),O(e,"propValues",r=>r.innerType?._zod?.propValues),O(e,"optin",r=>r.innerType?._zod?.optin??void 0),O(e,"optout",r=>r.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Ac=g("$ZodCustom",(e,t)=>{L.init(e,t),P.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=>of(i,r,n,e));of(o,r,n,e)}});function of(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(st(o))}}s(of,"handleRefineResult");var Nn=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Cc="~memo",df=[];function mf(e){return e!==null&&typeof e=="object"}s(mf,"isRef");function Nc(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}s(Nc,"cloneIssues");var hf=new WeakMap,dt=0,An=1,dr=2;function mr(e,t,r){let n=hf.get(e);if(n!==void 0)return n?dr:dt;if(t.has(e))return dr;t.add(e);let o=dt,i=s(f=>{if(o!==dr&&f?._zod){let p=mr(f,t,r);p>o&&(o=p)}},"check"),c=s((f,p)=>{let d=dt;for(let h of Reflect.ownKeys(f)){let y=Object.getOwnPropertyDescriptor(f,h);if(p&&!y.enumerable)continue;let _=y.get?An:y.value?._zod?mr(y.value,t,r):dt;_>d&&(d=_)}return d},"shape"),u=s(f=>{f>o&&(o=f)},"merge"),a=e._zod.def,l=a.type;switch(l){case"object":{let f=ot(a);u(f?c(f,!0):An),i(a.catchall);break}case"array":i(a.element);break;case"tuple":for(let f of a.items)i(f);i(a.rest);break;case"record":case"map":i(a.keyType),i(a.valueType);break;case"set":i(a.valueType);break;case"union":for(let f of a.options)i(f);break;case"intersection":i(a.left),i(a.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(a.innerType);break;case"pipe":i(a.in),i(a.out);break;case"function":i(a.input),i(a.output);break;case"lazy":{let f=a._cachedInner??(r?e._zod.innerType:void 0);u(f?mr(f,t,!1):An);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 f in a){let p=Object.getOwnPropertyDescriptor(a,f);if(!p||p.get)continue;let d=p.value;if(!(!d||typeof d!="object")){if(d._zod)i(d);else if(Array.isArray(d))for(let h of d)i(h)}}}return t.delete(e),oh(e,o)}s(mr,"isRecursive");function oh(e,t){return t!==An&&hf.set(e,t===dr),t}s(oh,"settle");function Cn(e){return mr(e,new Set,!0)!==dt}s(Cn,"isRecursiveSchema");function ih(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}s(ih,"bucketFor");var Zn,On=[],sh={alloc(e,t,r){let n=Zn;if(!n)return r;Zn=void 0;let o={value:r,issues:null};return n.set(t.value,o),On.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=s((o,i)=>{if(i.direction!=="backward"&&En(i,o.value))throw new Nn;return r(o,i)},"wrapped");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 c=e._zod.parse,u=s((a,l)=>{if(r===void 0){let b=mr(e,new Set,!1);if(b===dt)return e._zod.parse=c,e._zod.run===u&&(e._zod.run=c),c(a,l);b===dr||n?r=!0:n=!0}let f=a.value;if(!mf(f))return c(a,l);let p=l[Cc];p||(p={buckets:new WeakMap,backEdges:void 0},l[Cc]=p);let d;o===l?d=i:(d=ih(p,e),o=l,i=d);let h=d.get(f);if(h)return a.value=h.value,h.issues?h.issues.length&&a.issues.push(...Nc(h.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(h.value)),a;Zn=d;let y=On.length,_=c(a,l);Zn=void 0;let $=On.length>y?On.pop():void 0;return _ instanceof Promise?_.then(b=>($&&($.issues=b.issues.length?Nc(b.issues):df),b)):($&&($.issues=_.issues.length?Nc(_.issues):df),_)},"wrapped");e._zod.parse=u,e._zod.run===c&&(e._zod.run=u)})}};function hr(){return sh}s(hr,"memoizer");function En(e,t){let r=e[Cc]?.backEdges;return r!==void 0&&mf(t)&&r.has(t)}s(En,"isBackEdge");var yr={};ye(yr,{en:()=>gr});var ch=s(()=>{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}s(t,"getSizing");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,c){return i==="number"&&typeof c=="number"&&!Number.isFinite(c)?String(c):n[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let c=o(i.expected),u=oi(i.input),a=o(u,i.input);return`Invalid input: expected ${c}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Ur(i.values[0])}`:`Invalid option: expected one of ${Vr(i.values,"|")}`;case"too_big":{let c=i.exact?"exactly ":i.inclusive?"<=":"<",u=t(i.origin);return u?`Too big: expected ${i.origin??"value"} to have ${c}${i.maximum.toString()} ${u.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${c}${i.maximum.toString()}`}case"too_small":{let c=i.exact?"exactly ":i.inclusive?">=":">",u=t(i.origin);return u?`Too small: expected ${i.origin} to have ${c}${i.minimum.toString()} ${u.unit}`:`Too small: expected ${i.origin} to be ${c}${i.minimum.toString()}`}case"invalid_format":{let c=i;return c.format==="starts_with"?`Invalid string: must start with "${c.prefix}"`:c.format==="ends_with"?`Invalid string: must end with "${c.suffix}"`:c.format==="includes"?`Invalid string: must include "${c.includes}"`:c.format==="regex"?`Invalid string: must match pattern ${c.pattern}`:`Invalid ${r[c.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":""}: ${Vr(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":return i.options&&Array.isArray(i.options)&&i.options.length>0?`Invalid discriminator value. Expected ${i.options.map(u=>`'${u}'`).join(" | ")}`:i.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}},"error");function gr(){return{localeError:ch()}}s(gr,"default");var gf,Ec=Symbol("ZodOutput"),Tc=Symbol("ZodInput"),Tn=class{static{s(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];return this._map.set(t,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Dn(){return new Tn}s(Dn,"registry");(gf=globalThis).__zod_globalRegistry??(gf.__zod_globalRegistry=Dn());var K=globalThis.__zod_globalRegistry;var Y=Symbol.for("zod.compile.invalid"),yf=Symbol.for("zod.compile.fallback"),fe=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},A=class extends Error{static{s(this,"ZodCompileUnsupportedError")}constructor(t,r=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=r}};function ah(e,t){try{return Ln(e,{assertOnly:!0})}catch{return t}}s(ah,"compileValidator");function Rc(e,t){try{let r=Ln(e),n=jn(e,r);return n._zod.bag.validator=ah(e,r),n}catch(r){if(t?.strict)throw r;return e}}s(Rc,"compile");function jn(e,t){if(Cn(e))throw new A("a schema whose subtree contains a reference cycle");let r=E(e),n=e._zod.run,o=n.__originalRun??n,i=s((c,u)=>{if(u?.async||u?.direction==="backward"||u?.skipChecks||u?.[yf]||u&&En(u,c.value))return o(c,u);let a=t(c.value);return a!==Y?(c.value=a,c):(u&&(u[yf]=!0),o(c,u))},"wrapped");return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||lh(r,e,t),r}s(jn,"withParser");function lh(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(c,u)=>{let a=r(c);return a!==Y?{success:!0,data:a}:i(c,u)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(c,u)=>{let a=r(c);return a!==Y?a:i(c,u)}}}s(lh,"installCompiledUserMethods");function Ln(e,t){let r=!0;try{r=Cn(e)}catch{}if(r)throw new A("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Ve(["input"]),i=V(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let c=["INVALID",...n.constants.keys()],u=[Y,...n.constants.values()],a=o.content.join(`
63
+ `),l=t?.debug?c.length>0?`// Constants: ${c.join(", ")}
64
+ ${a}`:a:"",f=Function,p=`return (input) => {
65
+ ${a}
66
+ }`,d;try{d=new f(...c,p)(...u)}catch(h){throw new A(`this schema (generated code failed to evaluate: ${h.message})`)}return t?.debug&&(d.code=l),d.definite=n.definite,d}s(Ln,"compileFn");function I(e,t){for(let[n,o]of e.constants)if(o===t)return n;let r=`c${e.constantCounter++}`;return e.constants.set(r,t),r}s(I,"addConstant");function Ue(e,t){return e.definite=!1,I(e,t)}s(Ue,"addUserConstant");function z(e){return`v${e.varCounter++}`}s(z,"newVar");function fh(e,t){let r=e._zod.run({value:t,issues:[]},{});if(r&&typeof r.then=="function")return Y;let n=r;return n.issues.length===0?n.value:Y}s(fh,"runtimeRun");function q(e,t,r,n,o=!0){let i=e.content.length,c=t.constants.size,u=t.constantCounter,a=t.varCounter;try{return V(e,t,r,n,o)}catch(l){if(!(l instanceof A)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>c){let f=Array.from(t.constants.keys()).slice(c);for(let p of f)t.constants.delete(p)}return t.constantCounter=u,t.varCounter=a,ph(e,t,r,n)}}s(q,"compileChild");function ph(e,t,r,n){t.definite=!1;let o=I(t,r),i=I(t,fh),c=z(t);return e.write(`const ${c} = ${i}(${o}, ${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}s(ph,"emitRuntimeIsland");var dh=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function mh(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let c of o){let u=c._zod.def;if(u.when&&!dh.has(u.check))throw new A('check with a custom "when" condition');switch(u.check){case"greater_than":hh(e,t,u,i);break;case"less_than":gh(e,t,u,i);break;case"multiple_of":yh(e,t,u,i);break;case"number_format":kf(e,u,i);break;case"min_length":{let a=Ie(u.minimum,"min_length"),l=Dc(e,t,i,`${i}.length >= ${a} && ${i}.length < ${u.minimum*2}`);e.write(`if (${l} < ${a}) return INVALID;`);break}case"max_length":{let a=Ie(u.maximum,"max_length"),l=Dc(e,t,i,`${i}.length > ${a}`);e.write(`if (${l} > ${a}) return INVALID;`);break}case"length_equals":{let a=Ie(u.length,"length_equals"),l=Dc(e,t,i,`${i}.length >= ${a} && ${i}.length <= ${u.length*2}`);e.write(`if (${l} !== ${a}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Ie(u.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Ie(u.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Ie(u.size,"size_equals")}) return INVALID;`);break;case"string_format":i=xf(e,t,u,i);break;case"custom":i=kh(e,t,c,i);break;case"bigint_format":_h(e,u,i);break;case"mime_type":$h(e,t,u,i);break;case"property":bh(e,t,u,i);break;case"properties":wh(e,t,u,i);break;case"overwrite":{let a=z(t);vh(e,t,c,i,a),i=a;break}default:throw new A(`check type ${u.check}`)}}return i}s(mh,"generateChecks");function Dc(e,t,r,n){let o=I(t,Le),i=z(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}s(Dc,"codePointLengthVar");function Ie(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new A(`${t} bound of type ${typeof e}`);return`${e}`}s(Ie,"numericOperand");function vf(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new A("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new A("comparison check with Invalid Date bound");return I(e,t)}throw new A(`comparison check bound of type ${typeof t}`)}s(vf,"comparisonOperand");function hh(e,t,r,n){let o=r.inclusive?"<":"<=";e.write(`if (${n} ${o} ${vf(t,r.value)}) return INVALID;`)}s(hh,"generateGreaterThanCheck");function gh(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${vf(t,r.value)}) return INVALID;`)}s(gh,"generateLessThanCheck");function yh(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new A("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=I(t,Mt);e.write(`if (${o}(${n}, ${Ie(r.value,"multiple_of")}) !== 0) return INVALID;`)}}s(yh,"generateMultipleOfCheck");function kf(e,t,r){let n=t.format;switch(n){case"safeint":e.write(`if (!Number.isSafeInteger(${r})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${r}) || ${r} < -2147483648 || ${r} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${r}) || ${r} < 0 || ${r} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${r}) || ${r} < -3.4028234663852886e38 || ${r} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${r})) return INVALID;`);break;default:throw new A(`number format ${n}`)}}s(kf,"generateNumberFormatCheck");function _h(e,t,r){let n=t.format;if(n)switch(n){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break;default:throw new A(`bigint format ${n}`)}}s(_h,"generateBigIntFormatCheck");function $h(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=I(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}s($h,"generateMimeTypeCheck");function wh(e,t,r,n){if(r.when)throw new A('check with a custom "when" condition');e.write(`if (${n} == null) return INVALID;`);let o=r.shape;for(let i of Reflect.ownKeys(o)){let c=typeof i=="symbol"?I(t,i):G(i),u=z(t);e.write(`const ${u} = ${n}[${c}];`),q(e,t,o[i],u,!1)}}s(wh,"generatePropertiesChecks");function bh(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;V(e,t,r.schema,o)}s(bh,"generatePropertyCheck");function vh(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new A("overwrite check without a transform function");if(Be(i))throw new fe("z.compile: async overwrite transforms are not supported");let c=I(t,i);e.write(`const ${o} = ${c}(${n});`)}s(vh,"generateOverwriteCheck");function jc(){throw new re}s(jc,"throwAsync");function Vc(e){this.issues.push(e)}s(Vc,"pushIssue");function kh(e,t,r,n){let o=r._zod.def;if(o.fn){if(Be(o.fn))throw new fe("z.compile: async .refine() predicates are not supported");let i=Ue(t,o.fn),c=I(t,jc),u=z(t);return e.write(`const ${u} = ${i}(${n});`),e.write(`if (${u} instanceof Promise) ${c}();`),e.write(`if (!${u}) return INVALID;`),n}if(r._zod.check){if(Be(r._zod.check))throw new fe("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,u=Ue(t,s(l=>{let f={value:l,issues:[],addIssue:Vc};return i(f)instanceof Promise&&jc(),f.issues.length===0?f.value:Y},"helperFn")),a=z(t);return e.write(`const ${a} = ${u}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}throw new A("custom check without a predicate or check function")}s(kh,"generateCustomRefineCheck");var xh=new Set(["cidrv4","cuid","cuid2","date","datetime","duration","e164","email","emoji","ends_with","guid","includes","ipv4","ksuid","lowercase","mac","nanoid","regex","starts_with","time","ulid","uppercase","uuid","xid"]);function xf(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=I(t,cr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=I(t,wn);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=I(t,kn),f=I(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=I(t,sr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=I(t,_n);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=I(t,bn);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=I(t,vn);return e.write(`if (!${l}(${n})) return INVALID;`),n}let c=r;if(i==="url"||i==="httpurl"||c.normalize||c.hostname!==void 0||c.protocol!==void 0){let l=I(t,hn),f=I(t,r),p=z(t),d=z(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),c.hostname!==void 0){let _=I(t,gn);e.write(`if (!${_}(${d}, ${f}.hostname)) return INVALID;`)}if(c.protocol!==void 0){let _=I(t,yn);e.write(`if (!${_}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let h=z(t),y=c.normalize?`${d}.href`:`${I(t,ir)}(${p})`;return e.write(`const ${h} = ${y};`),h}let u=r.fn;if(u){if(Be(u))throw new A(`async string format ${i}`);let l=I(t,u);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(xh.has(i)&&r.pattern){let l=I(t,r.pattern);return e.write(`${l}.lastIndex = 0;`),e.write(`if (!${l}.test(${n})) return INVALID;`),n}let a=r.format;switch(a){case"regex":throw new A("regex format without a pattern");case"lowercase":e.write(`if (${n} !== ${n}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${n} !== ${n}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${n}.includes(${G(r.includes)})) return INVALID;`);break;case"starts_with":{let l=r.prefix;e.write(`if (${n}.slice(0, ${l.length}) !== ${G(l)}) return INVALID;`);break}case"ends_with":{let l=r.suffix;e.write(`if (${n}.slice(-${l.length}) !== ${G(l)}) return INVALID;`);break}default:throw new A(`string format ${a}`)}return n}s(xf,"generateStringFormatCheck");function V(e,t,r,n,o=!0){let i=r._zod.def,c=i.type;if(i.coerce)throw new A(`coercion (z.coerce.${c}())`);let u=o||!!i.checks?.length,a;switch(c){case"string":a=zh(e,t,r,n,u);break;case"number":a=Ih(e,r,n);break;case"boolean":a=Sh(e,n);break;case"bigint":a=Ph(e,r,n);break;case"symbol":a=Zh(e,n);break;case"undefined":a=Oh(e,n);break;case"null":a=Ah(e,n);break;case"any":case"unknown":a=n;break;case"never":e.write("return INVALID;"),a=n;break;case"void":a=Nh(e,n);break;case"nan":a=Ch(e,n);break;case"date":a=Eh(e,n);break;case"object":a=Th(e,t,r,n,u);break;case"optional":a=Dh(e,t,r,n,u);break;case"nullable":a=Rh(e,t,r,n,u);break;case"array":a=Vh(e,t,r,n,u);break;case"literal":a=Mh(e,t,r,n);break;case"enum":a=Fh(e,t,r,n);break;case"readonly":{let l=$f(e,t,r,n),f=z(t);e.write(`const ${f} = Object.freeze(${l});`),a=f;break}case"success":$f(e,t,r,n),a="true";break;case"default":case"prefault":a=Uh(e,t,r,n);break;case"nonoptional":a=Bh(e,t,r,n);break;case"tuple":a=Jh(e,t,r,n);break;case"union":a=Kh(e,t,r,n);break;case"intersection":a=Gh(e,t,r,n);break;case"record":a=Xh(e,t,r,n);break;case"map":a=Hh(e,t,r,n);break;case"set":a=Qh(e,t,r,n);break;case"file":a=eg(e,n);break;case"template_literal":a=tg(e,t,r,n);break;case"lazy":a=rg(e,t,r,n);break;case"pipe":a=ng(e,t,r,n);break;case"custom":a=og(e,t,r,n);break;case"transform":a=cg(e,t,r,n);break;case"catch":a=sg(e,t,r,n);break;default:throw new A(`schema type ${c}`)}return a===null?null:mh(e,t,r,a)}s(V,"generateCheck");function zh(e,t,r,n,o=!0){e.write(`if (typeof ${n} !== "string") return INVALID;`);let i=r._zod.def;return i.format===void 0?n:xf(e,t,i,n,o)}s(zh,"generateStringCheck");function Ih(e,t,r){e.write(`if (typeof ${r} !== "number" || !Number.isFinite(${r})) return INVALID;`);let n=t._zod.def;return n.check==="number_format"&&n.format&&kf(e,{format:n.format},r),r}s(Ih,"generateNumberCheck");function Sh(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}s(Sh,"generateBooleanCheck");function Ph(e,t,r){e.write(`if (typeof ${r} !== "bigint") return INVALID;`);let n=t._zod.def;if(n.format)switch(n.format){case"int64":e.write(`if (${r} < -9223372036854775808n || ${r} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${r} < 0n || ${r} > 18446744073709551615n) return INVALID;`);break}return r}s(Ph,"generateBigIntCheck");function Zh(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}s(Zh,"generateSymbolCheck");function Oh(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(Oh,"generateUndefinedCheck");function Ah(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}s(Ah,"generateNullCheck");function Nh(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(Nh,"generateVoidCheck");function Ch(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}s(Ch,"generateNaNCheck");function Eh(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}s(Eh,"generateDateCheck");function Th(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (typeof ${n} !== "object" || ${n} === null || Array.isArray(${n})) return INVALID;`);let c=i.shape,u=Object.keys(c),a=Object.getOwnPropertySymbols(c),l=a.length?[...u,...a]:u,f=s(k=>typeof k=="symbol"?I(t,k):G(k),"keyExpr"),p=s(k=>typeof k=="symbol"?`[${f(k)}]`:G(k),"propKey"),d=c;if(u.includes("__proto__"))throw new A('object shape key "__proto__"');let h=new Map;for(let k of l){let S=d[k],C=f(k),R=z(t);if(e.write(`const ${R} = ${n}[${C}];`),S._zod.optin!==void 0){let N=z(t);e.write(`let ${N} = (() => {`),e.indented(W=>{let Rt=q(W,t,S,R);W.write(`return ${Rt};`)}),e.write("})();"),S._zod.optout==="optional"?(e.write(`if (${N} === INVALID) {`),e.indented(W=>{W.write(`if (${C} in ${n}) return INVALID;`),W.write(`${N} = undefined;`)}),e.write("}")):e.write(`if (${N} === INVALID) return INVALID;`),h.set(k,N)}else{Lh(S)&&e.write(`if (!(${C} in ${n})) return INVALID;`);let N=q(e,t,S,R,o);N!==null&&h.set(k,N)}}let y=i.catchall,_="none";if(y){let k=y._zod.def.type;if(k==="never"){let S=u.map(C=>`k !== ${G(C)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(C=>{C.write(`if (${S}) return INVALID;`)}),e.write("}")}else(k==="unknown"||k==="any")&&!y._zod.def.checks?.length?_="passthrough":_="schema"}let $=z(t),b=l.some(k=>_f(d[k])||Lc(d[k]));if(!o){if(_==="schema"){let k=u.length>0?I(t,new Set(u)):null;e.write(`for (const k in ${n}) {`),e.indented(S=>{S.write('if (k === "__proto__") continue;'),k&&S.write(`if (${k}.has(k)) continue;`);let C=z(t);S.write(`const ${C} = ${n}[k];`),q(S,t,y,C,!1)}),e.write("}")}return null}if(b){e.write(`const ${$} = {};`);for(let k of l){let S=f(k),C=h.get(k);Lc(d[k])?e.write(`if (${S} in ${n}) ${$}[${S}] = ${C};`):_f(d[k])?e.write(`if (${C} !== undefined || ${S} in ${n}) ${$}[${S}] = ${C};`):e.write(`${$}[${S}] = ${C};`)}}else{let k=l.map(S=>`${p(S)}: ${h.get(S)}`).join(", ");e.write(`const ${$} = { ${k} };`)}if(_!=="none"){let k=u.length>0?I(t,new Set(u)):null;e.write(`for (const k in ${n}) {`),e.indented(S=>{if(S.write('if (k === "__proto__") continue;'),k&&S.write(`if (${k}.has(k)) continue;`),_==="passthrough")S.write(`${$}[k] = ${n}[k];`);else{let C=z(t);S.write(`const ${C} = ${n}[k];`);let R=q(S,t,y,C);S.write(`${$}[k] = ${R};`)}}),e.write("}")}return $}s(Th,"generateObjectCheck");function Dh(e,t,r,n,o=!0){let i=r._zod.def;if(jh(r))return V(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let u=z(t),a=z(t);return e.write(`let ${u};`),e.write(`if (${n} === undefined) {`),e.indented(l=>{l.write(`const ${a} = (() => {`),l.indented(f=>{let p=V(f,t,i.innerType,n);f.write(`return ${p};`)}),l.write("})();"),l.write(`if (${a} !== INVALID) ${u} = ${a};`)}),e.write("} else {"),e.indented(l=>{let f=V(l,t,i.innerType,n);l.write(`${u} = ${f};`)}),e.write("}"),u}let c=o?z(t):null;return c&&e.write(`let ${c};`),e.write(`if (${n} !== undefined) {`),e.indented(u=>{let a=V(u,t,i.innerType,n,o);c&&a!==null&&u.write(`${c} = ${a};`)}),e.write("}"),c}s(Dh,"generateOptionalCheck");function jh(e){return e._zod.traits?.has("$ZodExactOptional")===!0}s(jh,"isExactOptional");function Lh(e){return e._zod.optin===void 0&&Fe(e)}s(Lh,"requiresPresenceCheck");function Fe(e){if(e._zod.def.coerce)return!0;let t=e._zod.def;switch(t.type){case"any":case"unknown":case"undefined":case"void":case"default":case"prefault":case"transform":case"custom":case"lazy":return!0;case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"never":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":return!1;case"nonoptional":return t.innerType?Fe(t.innerType):!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return t.innerType?Fe(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Fe):!0;case"intersection":return!t.left||!t.right?!0:Fe(t.left)&&Fe(t.right);case"pipe":return t.in?Fe(t.in):!0;default:return!0}}s(Fe,"fastPathAcceptsAbsence");function Lc(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}s(Lc,"dropsWhenAbsent");function _f(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&mt(e)}s(_f,"mayOmitUndefined");function mt(e){let t=e._zod.def;switch(t.type){case"string":case"number":case"boolean":case"bigint":case"symbol":case"null":case"nan":case"date":case"object":case"array":case"tuple":case"record":case"map":case"set":case"file":case"template_literal":case"never":case"success":return!1;case"literal":return!!t.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return t.innerType?mt(t.innerType):!0;case"union":return t.options?t.options.some(mt):!0;case"intersection":return!t.left||!t.right||mt(t.left)||mt(t.right);case"pipe":return t.out?mt(t.out):!0;default:return!0}}s(mt,"mayOutputUndefined");function Rh(e,t,r,n,o=!0){let i=r._zod.def,c=o?z(t):null;return c&&e.write(`let ${c} = null;`),e.write(`if (${n} !== null) {`),e.indented(u=>{let a=V(u,t,i.innerType,n,o);c&&a!==null&&u.write(`${c} = ${a};`)}),e.write("}"),c}s(Rh,"generateNullableCheck");function Mc(e,t,r){for(let[n,o]of it(t._zod.def.checks))e.write(`if (${r} > ${Ie(n,o._zod.def.check)}) return INVALID;`)}s(Mc,"generateSizeGate");function Vh(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`),Mc(e,r,`${n}.length`);let c=o?z(t):null,u=z(t),a=z(t);return c&&e.write(`const ${c} = new Array(${n}.length);`),e.write(`for (let ${u} = 0; ${u} < ${n}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${a} = ${n}[${u}];`);let f=q(l,t,i.element,a,o);c&&f!==null&&l.write(`${c}[${u}] = ${f};`)}),e.write("}"),c}s(Vh,"generateArrayCheck");function Mh(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let u=I(t,new Set(i));return e.write(`if (!${u}.has(${n})) return INVALID;`),n}let c=i[0];if(typeof c=="number"&&Number.isNaN(c)){let u=I(t,new Set(i));return e.write(`if (!${u}.has(${n})) return INVALID;`),n}if(typeof c=="string")e.write(`if (${n} !== ${G(c)}) return INVALID;`);else if(typeof c=="number"||typeof c=="boolean")e.write(`if (${n} !== ${c}) return INVALID;`);else if(c===null)e.write(`if (${n} !== null) return INVALID;`);else if(c===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof c=="bigint")e.write(`if (${n} !== ${c}n) return INVALID;`);else throw new A(`literal type ${typeof c}`);return n}s(Mh,"generateLiteralCheck");function Fh(e,t,r,n){let o=r._zod.values;if(!o)throw new A("enum schema without enumerated values");let i=I(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}s(Fh,"generateEnumCheck");function $f(e,t,r,n){let o=r._zod.def;return V(e,t,o.innerType,n)}s($f,"generateWrapperCheck");function Uh(e,t,r,n){let o=r._zod.def,c=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!c)return V(e,t,o.innerType,n);let a=I(t,c),l=z(t);return e.write(`let ${l} = ${n};`),e.write(`if (${n} === undefined) ${l} = ${a}();`),V(e,t,o.innerType,l)}let u=z(t);if(c){let a=I(t,c),l=I(t,Ft);e.write(`let ${u};`),e.write(`if (${n} === undefined) {`),e.indented(f=>{f.write(`${u} = ${l}(${a}());`)}),e.write("} else {"),e.indented(f=>{let p=V(f,t,o.innerType,n);f.write(`${u} = ${p} === undefined ? ${l}(${a}()) : ${p};`)}),e.write("}")}else e.write(`let ${u};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let l=V(a,t,o.innerType,n);a.write(`${u} = ${l};`)}),e.write("}");return u}s(Uh,"generateDefaultCheck");function Bh(e,t,r,n){let o=r._zod.def,i=V(e,t,o.innerType,n),c=z(t);return e.write(`const ${c} = ${i};`),e.write(`if (${c} === undefined) return INVALID;`),c}s(Bh,"generateNonOptionalCheck");function Jh(e,t,r,n){let o=r._zod.def,i=o.items,c=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let u=wf(i,"optin"),a=wf(i,"optout");c?e.write(`if (${n}.length < ${u}) return INVALID;`):e.write(`if (${n}.length < ${u} || ${n}.length > ${i.length}) return INVALID;`);let l=z(t);e.write(`const ${l} = [];`);for(let f=0;f<i.length;f++){let p=i[f];if(f>=a)e.write(`if (${l}.length === ${f}) {`),e.indented(d=>{d.write(`if (${f} < ${n}.length) {`),d.indented(h=>{let y=z(t);h.write(`const ${y} = ${n}[${f}];`);let _=q(h,t,p,y);h.write(`${l}[${f}] = ${_};`)}),d.write("} else {"),d.indented(h=>{if(Lc(p)){h.write(`${l}.length = ${f};`);return}let y=z(t),_=z(t);h.write(`const ${y} = undefined;`),h.write(`const ${_} = (() => {`),h.indented($=>{let b=q($,t,p,y);$.write(`return ${b};`)}),h.write("})();"),h.write(`if (${_} === INVALID || ${_} === undefined) ${l}.length = ${f};`),h.write(`else ${l}[${f}] = ${_};`)}),d.write("}")}),e.write("}");else{let d=z(t);e.write(`const ${d} = ${n}[${f}];`);let h=q(e,t,p,d);e.write(`${l}[${f}] = ${h};`)}}if(c){let f=z(t),p=z(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${n}[${f}];`);let h=q(d,t,c,p);d.write(`${l}[${f}] = ${h};`)}),e.write("}")}return l}s(Jh,"generateTupleCheck");function wf(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}s(wf,"getTupleOptStart");function Kh(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Wh(e,t,o,n);if(o.inclusive===!1)throw new A("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),n;if(i.length===1)return V(e,t,i[0],n);if(i.every(a=>a._zod.def.type==="literal"&&!a._zod.def.checks?.length)){let a=new Set(i.flatMap(f=>f._zod.def.values)),l=I(t,a);return e.write(`if (!${l}.has(${n})) return INVALID;`),n}let u=z(t);e.write(`let ${u};`);for(let a=0;a<i.length;a++){let l=i[a];a===0?e.write(`${u} = (() => {`):e.write(`if (${u} === INVALID) ${u} = (() => {`),e.indented(f=>{let p=V(f,t,l,n);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${u} === INVALID) return INVALID;`),u}s(Kh,"generateUnionCheck");function Wh(e,t,r,n){if(r.unionFallback)throw new A("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=z(t),i=z(t);e.write(`const ${o} = ${n}?.[${G(r.discriminator)}];`),e.write(`let ${i};`);let c=!0,u=new Set;for(let a of r.options){let l=a._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new A("discriminated union option without static discriminator values");for(let d of l){if(u.has(d))throw new A(`duplicate discriminator value ${String(d)}`);u.add(d)}let f=Array.from(l,d=>qh(t,o,d)),p=c?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let h=V(d,t,a,n);d.write(`${i} = ${h};`)}),e.write("}"),c=!1}return e.write("else { return INVALID; }"),i}s(Wh,"generateDiscriminatedUnionCheck");function qh(e,t,r){if(typeof r=="string")return`${t} === ${G(r)}`;if(typeof r=="number")return Number.isNaN(r)?`Number.isNaN(${t})`:`${t} === ${r}`;if(typeof r=="boolean")return`${t} === ${r}`;if(r===null)return`${t} === null`;if(r===void 0)return`${t} === undefined`;if(typeof r=="bigint")return`${t} === ${r}n`;if(typeof r=="symbol"){let n=I(e,r);return`${t} === ${n}`}throw new A(`literal discriminator value ${String(r)}`)}s(qh,"literalEquality");function Gh(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=q(e,t,o.left,n),c=q(e,t,o.right,n),u=I(t,pt),a=z(t);return e.write(`const ${a} = ${u}(${i}, ${c});`),e.write(`if (!${a}.valid) return INVALID;`),`${a}.data`}s(Gh,"generateIntersectionCheck");function Xh(e,t,r,n){let o=r._zod.def,i=I(t,ce);e.write(`if (!${i}(${n})) return INVALID;`);let c=z(t),u=z(t),a=z(t);e.write(`const ${c} = {};`);let l=o,f=l.partial?void 0:o.keyType._zod.values;if(f){let h=[];for(let _ of f){if(!(typeof _=="string"||typeof _=="number"||typeof _=="symbol"))throw new A(`record key value ${String(_)}`);let $=typeof _=="number"?_.toString():_;if($==="__proto__")throw new A('record key "__proto__"');h.push($);let b=I(t,_),k=V(e,t,o.keyType,b),S=z(t);e.write(`const ${S} = ${n}[${Yh(t,$)}];`);let C=q(e,t,o.valueType,S);e.write(`${c}[${k}] = ${C};`)}let y=I(t,new Set(h));return e.write(`for (const ${u} in ${n}) {`),e.indented(_=>{_.write(`if (${y}.has(${u})) continue;`),l.mode==="loose"?_.write(`if (${u} !== "__proto__") ${c}[${u}] = ${n}[${u}];`):_.write("return INVALID;")}),e.write("}"),c}let p=o.keyType._zod.def;if(!(p.type==="string"&&p.format===void 0&&!p.coerce&&(p.checks?.length??0)===0)){let h=o.mode==="loose",y=Ln(o.keyType);y.definite===!1&&(t.definite=!1);let _=I(t,y),$=I(t,we),b=z(t);return bf(e,t,n,u,k=>{k.write(`let ${b} = ${_}(${u});`),k.write(`if (${b} === INVALID && typeof ${u} === "string" && ${$}.test(${u})) ${b} = ${_}(Number(${u}));`),h?k.write(`if (${b} === INVALID) { ${c}[${u}] = ${n}[${u}]; continue; }`):k.write(`if (${b} === INVALID) return INVALID;`),k.write(`if (${b} === "__proto__") continue;`);let S=z(t);k.write(`const ${S} = ${n}[${u}];`);let C=q(k,t,o.valueType,S);k.write(`${c}[${b}] = ${C};`)}),c}return bf(e,t,n,u,h=>{h.write(`const ${a} = ${n}[${u}];`);let y=q(h,t,o.valueType,a);h.write(`${c}[${u}] = ${y};`)},"return INVALID;"),c}s(Xh,"generateRecordCheck");function bf(e,t,r,n,o,i){let c=I(t,Object.prototype.propertyIsEnumerable),u=z(t),a=z(t),l=z(t);e.write(`const ${u} = Object.getOwnPropertySymbols(${r});`),e.write(`const ${a} = Object.getOwnPropertyNames(${r});`),e.write(`for (let ${l} = 0; ${l} < ${a}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${a}[${l}];`),f.write(`if (${n} === "__proto__" || !${c}.call(${r}, ${n})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${u}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${u}[${l}];`),f.write(`if (!${c}.call(${r}, ${n})) continue;`),i?f.write(i):o(f)}),e.write("}")}s(bf,"emitOwnKeys");function Yh(e,t){return typeof t=="string"?G(t):I(e,t)}s(Yh,"literalPropertyKey");function Hh(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`),Mc(e,r,`${n}.size`);let i=z(t),c=z(t),u=z(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${c}, ${u}] of ${n}) {`),e.indented(a=>{let l=V(a,t,o.keyType,c),f=V(a,t,o.valueType,u);a.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}s(Hh,"generateMapCheck");function Qh(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`),Mc(e,r,`${n}.size`);let i=z(t),c=z(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${c} of ${n}) {`),e.indented(u=>{let a=V(u,t,o.valueType,c);u.write(`${i}.add(${a});`)}),e.write("}"),i}s(Qh,"generateSetCheck");function eg(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}s(eg,"generateFileCheck");function tg(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=I(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}s(tg,"generateTemplateLiteralCheck");function rg(e,t,r,n){let o=r._zod.def,i=Ue(t,o.getter),c=I(t,{parser:null});e.write(`if (!${c}.parser) {`),e.indented(a=>{a.write(`const inner = ${i}();`),a.write(`${c}.parser = function(input) {`),a.indented(l=>{l.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),l.write("return result.issues.length === 0 ? result.value : INVALID;")}),a.write("};")}),e.write("}");let u=z(t);return e.write(`const ${u} = ${c}.parser(${n});`),e.write(`if (${u} === INVALID) return INVALID;`),u}s(rg,"generateLazyCheck");function ng(e,t,r,n){let o=r._zod.def,i=V(e,t,o.in,n);if(o.transform){if(Be(o.transform))throw new fe("z.compile: async transforms in pipes are not supported");let c=o.transform,a=Ue(t,s(f=>{let p={value:f,issues:[],addIssue:Vc},d=c(f,p);return d instanceof Promise?Y:p.issues.length===0?d:Y},"helperFn")),l=z(t);return e.write(`const ${l} = ${a}(${i});`),e.write(`if (${l} === INVALID) return INVALID;`),V(e,t,o.out,l)}else return V(e,t,o.out,i)}s(ng,"generatePipeCheck");function Be(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}s(Be,"isAsyncFunction");function og(e,t,r,n){let o=r._zod.def;if(o.fn){if(Be(o.fn))throw new fe("z.compile: async custom predicates are not supported");let i=Ue(t,o.fn),c=I(t,jc),u=z(t);e.write(`const ${u} = ${i}(${n});`),e.write(`if (${u} instanceof Promise) ${c}();`),e.write(`if (!${u}) return INVALID;`)}else throw new A("custom schema without a predicate function");return n}s(og,"generateCustomCheck");function ig(e,t,r){let n=e._zod.run({value:r,issues:[]},{});if(n&&typeof n.then=="function")return Y;let o=n;return o.issues.length===0?o.value:t()}s(ig,"runtimeCatch");function sg(e,t,r,n){let o=r._zod.def;if(!o.catchValue[Jr])throw new A("catch with a callback (only a constant catch value compiles)",!1);let i=z(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=q(l,t,o.innerType,n);l.write(`return ${f};`)}),e.write("})();");let c=I(t,o.innerType),u=Ue(t,o.catchValue),a=I(t,ig);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${a}(${c}, ${u}, ${n});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}s(sg,"generateCatchCheck");function cg(e,t,r,n){let o=r._zod.def;if(o.transform){if(Be(o.transform))throw new fe("z.compile: async transforms are not supported");let i=o.transform,u=Ue(t,s(l=>{let f={value:l,issues:[],addIssue:Vc},p=i(l,f);return p instanceof Promise?Y:f.issues.length===0?p:Y},"helperFn")),a=z(t);return e.write(`const ${a} = ${u}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}return n}s(cg,"generateTransformCheck");function Rn(e){return e.checks&&(e.checks=[...e.checks]),e}s(Rn,"snapshotChecks");function Fc(e,t){return new e(Rn({type:"string",...w(t)}))}s(Fc,"_string");function Uc(e,t){return new e(Rn({type:"string",coerce:!0,...w(t)}))}s(Uc,"_coercedString");function Vn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...w(t)})}s(Vn,"_email");function Mn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...w(t)})}s(Mn,"_guid");function Fn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...w(t)})}s(Fn,"_uuid");function Un(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...w(t)})}s(Un,"_uuidv4");function Bn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...w(t)})}s(Bn,"_uuidv6");function Jn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...w(t)})}s(Jn,"_uuidv7");function _r(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...w(t)})}s(_r,"_url");function Kn(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...w(t)})}s(Kn,"_emoji");function Wn(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...w(t)})}s(Wn,"_nanoid");function qn(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...w(t)})}s(qn,"_cuid");function Gn(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...w(t)})}s(Gn,"_cuid2");function Xn(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...w(t)})}s(Xn,"_ulid");function Yn(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...w(t)})}s(Yn,"_xid");function Hn(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...w(t)})}s(Hn,"_ksuid");function Qn(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...w(t)})}s(Qn,"_ipv4");function eo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...w(t)})}s(eo,"_ipv6");function Bc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...w(t)})}s(Bc,"_mac");function to(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...w(t)})}s(to,"_cidrv4");function ro(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...w(t)})}s(ro,"_cidrv6");function no(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...w(t)})}s(no,"_base64");function oo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...w(t)})}s(oo,"_base64url");function io(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...w(t)})}s(io,"_e164");function Jc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...w(t)})}s(Jc,"_creditCard");function Kc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...w(t)})}s(Kc,"_iban");function so(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...w(t)})}s(so,"_jwt");var Wc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function $r(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...w(t)})}s($r,"_isoDateTime");function wr(e,t){return new e({type:"string",format:"date",check:"string_format",...w(t)})}s(wr,"_isoDate");function br(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...w(t)})}s(br,"_isoTime");function vr(e,t){return new e({type:"string",format:"duration",check:"string_format",...w(t)})}s(vr,"_isoDuration");function qc(e,t){return new e(Rn({type:"number",checks:[],...w(t)}))}s(qc,"_number");function Gc(e,t){return new e(Rn({type:"number",coerce:!0,checks:[],...w(t)}))}s(Gc,"_coercedNumber");function Xc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...w(t)})}s(Xc,"_int");function Yc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...w(t)})}s(Yc,"_float32");function Hc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...w(t)})}s(Hc,"_float64");function Qc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...w(t)})}s(Qc,"_int32");function eu(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...w(t)})}s(eu,"_uint32");function tu(e,t){return new e({type:"boolean",...w(t)})}s(tu,"_boolean");function ru(e,t){return new e({type:"boolean",coerce:!0,...w(t)})}s(ru,"_coercedBoolean");function nu(e,t){return new e({type:"bigint",...w(t)})}s(nu,"_bigint");function ou(e,t){return new e({type:"bigint",coerce:!0,...w(t)})}s(ou,"_coercedBigint");function iu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...w(t)})}s(iu,"_int64");function su(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...w(t)})}s(su,"_uint64");function cu(e,t){return new e({type:"symbol",...w(t)})}s(cu,"_symbol");function uu(e,t){return new e({type:"undefined",...w(t)})}s(uu,"_undefined");function au(e,t){return new e({type:"null",...w(t)})}s(au,"_null");function lu(e){return new e({type:"any"})}s(lu,"_any");function fu(e){return new e({type:"unknown"})}s(fu,"_unknown");function pu(e,t){return new e({type:"never",...w(t)})}s(pu,"_never");function du(e,t){return new e({type:"void",...w(t)})}s(du,"_void");function mu(e,t){return new e({type:"date",...w(t)})}s(mu,"_date");function hu(e,t){return new e({type:"date",coerce:!0,...w(t)})}s(hu,"_coercedDate");function gu(e,t){return new e({type:"nan",...w(t)})}s(gu,"_nan");function de(e,t){return new un({check:"less_than",...w(t),value:e,inclusive:!1})}s(de,"_lt");function ie(e,t){return new un({check:"less_than",...w(t),value:e,inclusive:!0})}s(ie,"_lte");function me(e,t){return new an({check:"greater_than",...w(t),value:e,inclusive:!1})}s(me,"_gt");function se(e,t){return new an({check:"greater_than",...w(t),value:e,inclusive:!0})}s(se,"_gte");function co(e){return me(0,e)}s(co,"_positive");function uo(e){return de(0,e)}s(uo,"_negative");function ao(e){return ie(0,e)}s(ao,"_nonpositive");function lo(e){return se(0,e)}s(lo,"_nonnegative");function Se(e,t){return new Hi({check:"multiple_of",...w(t),value:e})}s(Se,"_multipleOf");function Pe(e,t){return new ts({check:"max_size",...w(t),maximum:e})}s(Pe,"_maxSize");function he(e,t){return new rs({check:"min_size",...w(t),minimum:e})}s(he,"_minSize");function Je(e,t){return new ns({check:"size_equals",...w(t),size:e})}s(Je,"_size");function Ke(e,t){return new os({check:"max_length",...w(t),maximum:e})}s(Ke,"_maxLength");function be(e,t){return new is({check:"min_length",...w(t),minimum:e})}s(be,"_minLength");function We(e,t){return new ss({check:"length_equals",...w(t),length:e})}s(We,"_length");function ht(e,t){return new cs({check:"string_format",format:"regex",...w(t),pattern:e})}s(ht,"_regex");function gt(e){return new us({check:"string_format",format:"lowercase",...w(e)})}s(gt,"_lowercase");function yt(e){return new as({check:"string_format",format:"uppercase",...w(e)})}s(yt,"_uppercase");function _t(e,t){return new ls({check:"string_format",format:"includes",...w(t),includes:e})}s(_t,"_includes");function $t(e,t){return new fs({check:"string_format",format:"starts_with",...w(t),prefix:e})}s($t,"_startsWith");function wt(e,t){return new ps({check:"string_format",format:"ends_with",...w(t),suffix:e})}s(wt,"_endsWith");function fo(e,t,r){return new ds({check:"property",property:e,schema:t,...w(r)})}s(fo,"_property");function bt(e,t){return new ms({check:"properties",shape:e,...w(t)})}s(bt,"_properties");function vt(e,t){return new hs({check:"mime_type",mime:e,...w(t)})}s(vt,"_mime");function pe(e){return new gs({check:"overwrite",tx:e})}s(pe,"_overwrite");function kt(e){return pe(t=>t.normalize(e))}s(kt,"_normalize");function xt(){return pe(e=>e.trim())}s(xt,"_trim");function zt(){return pe(e=>e.toLowerCase())}s(zt,"_toLowerCase");function It(){return pe(e=>e.toUpperCase())}s(It,"_toUpperCase");function St(){return pe(e=>Qo(e))}s(St,"_slugify");function yu(e,t,r){return new e({type:"array",element:t,...w(r)})}s(yu,"_array");function ug(e,t,r){return new e({type:"union",options:t,...w(r)})}s(ug,"_union");function ag(e,t,r){return new e({type:"union",options:t,inclusive:!1,...w(r)})}s(ag,"_xor");function lg(e,t,r,n){return new e({type:"union",options:r,discriminator:t,...w(n)})}s(lg,"_discriminatedUnion");function fg(e,t,r){return new e({type:"intersection",left:t,right:r})}s(fg,"_intersection");function pg(e,t,r,n){let o=r instanceof P,i=o?n:r,c=o?r:null;return new e({type:"tuple",items:t,rest:c,...w(i)})}s(pg,"_tuple");function dg(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,...w(n)})}s(dg,"_record");function mg(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,...w(n)})}s(mg,"_map");function hg(e,t,r){return new e({type:"set",valueType:t,...w(r)})}s(hg,"_set");function gg(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,...w(r)})}s(gg,"_enum");function yg(e,t,r){return new e({type:"enum",entries:t,...w(r)})}s(yg,"_nativeEnum");function _g(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],...w(r)})}s(_g,"_literal");function _u(e,t){return new e({type:"file",...w(t)})}s(_u,"_file");function $g(e,t){return new e({type:"transform",transform:t})}s($g,"_transform");function wg(e,t){return new e({type:"optional",innerType:t})}s(wg,"_optional");function bg(e,t){return new e({type:"nullable",innerType:t})}s(bg,"_nullable");function vg(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Ft(r)}})}s(vg,"_default");function kg(e,t,r){return new e({type:"nonoptional",innerType:t,...w(r)})}s(kg,"_nonoptional");function xg(e,t){return new e({type:"success",innerType:t})}s(xg,"_success");function zg(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:si(r)})}s(zg,"_catch");function Ig(e,t,r){return new e({type:"pipe",in:t,out:r})}s(Ig,"_pipe");function Sg(e,t){return new e({type:"readonly",innerType:t})}s(Sg,"_readonly");function Pg(e,t,r){return new e({type:"template_literal",parts:t,...w(r)})}s(Pg,"_templateLiteral");function Zg(e,t){return new e({type:"lazy",getter:t})}s(Zg,"_lazy");function Og(e,t){return new e({type:"promise",innerType:t})}s(Og,"_promise");function $u(e,t,r){let n=w(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}s($u,"_custom");function wu(e,t,r){return new e({type:"custom",check:"custom",fn:t,...w(r)})}s(wu,"_refine");function bu(e,t){let r=zf(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(st(o,n.value,r._zod.def));else{let i=o;i.fatal&&(i.continue=!1),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(st(i))}},e(n.value,n)),t);return r}s(bu,"_superRefine");function zf(e,t){let r=new L({check:"custom",...w(t)});return r._zod.check=e,r}s(zf,"_check");function vu(e){let t=new L({check:"describe"});return t._zod.onattach=[r=>{let n=K.get(r)??{};K.add(r,{...n,description:e})}],t._zod.check=()=>{},t}s(vu,"describe");function ku(e){let t=new L({check:"meta"});return t._zod.onattach=[r=>{let n=K.get(r)??{};K.add(r,{...n,...e})}],t._zod.check=()=>{},t}s(ku,"meta");function xu(e,t){let r=w(t),n=r.truthy??["true","1","yes","on","y","enabled"],o=r.falsy??["false","0","no","off","n","disabled"];r.case!=="sensitive"&&(n=n.map(h=>typeof h=="string"?h.toLowerCase():h),o=o.map(h=>typeof h=="string"?h.toLowerCase():h));let i=new Set(n),c=new Set(o),u=e.Codec??fr,a=e.Boolean??ar,l=e.String??Me,f=new l({type:"string",error:r.error}),p=new a({type:"boolean",error:r.error}),d=new u({type:"pipe",in:f,out:p,transform:s(((h,y)=>{let _=h;return r.case!=="sensitive"&&(_=_.toLowerCase()),i.has(_)?!0:c.has(_)?!1:(y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...c],input:y.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((h,y)=>h===!0?n[0]||"true":o[0]||"false"),"reverseTransform"),error:r.error});return d._zod.bag.truthy=n,d._zod.bag.falsy=o,d._zod.bag.case=r.case??"insensitive",d}s(xu,"_stringbool");function qe(e,t,r,n={}){let o=w(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:u=>r.test(u),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}s(qe,"_stringFormat");function kr(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))Object.prototype.propertyIsEnumerable.call(r,n)&&J(e,n,r[n]);return e}s(kr,"assignProps");function Ze(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??K,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}}s(Ze,"initializeContext");function F(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 new Error(o);return Object.assign(r,i),!0}s(F,"handleUnrepresentable");function D(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let c={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,c),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let u=e._zod.toJSONSchema?.();if(u)c.schema=u;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,f);else{let d=c.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,d,f)}let p=e._zod.parent;p&&(c.ref||(c.ref=p),D(p,t,f),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&kr(c.schema,a),t.io==="input"&&H(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&"_prefault"in c.schema&&((n=c.schema).default??(n.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}s(D,"processSchema");function If(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}s(If,"encodeJSONPointerSegment");function Oe(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let c of e.seen.entries()){let u=e.metadataRegistry.get(c[0])?.id;if(u){let a=n.get(u);if(a&&a!==c[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(u,c[0])}}let o=s(c=>{let u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(c[0])?.id,d=e.external.uri??(y=>y);if(p)return{ref:d(p)};let h=c[1].defId??c[1].schema.id??`schema${e.counter++}`;return c[1].defId=h,{defId:h,ref:`${d("__shared")}#/${u}/${If(h)}`}}let a="#",l=`${a}/${u}/`;if(c[1]===r&&!c[1].schema.id)return{ref:a};let f=c[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+If(f)}},"makeURI"),i=s(c=>{if(c[1].schema.$ref)return;let u=c[1],{ref:a,defId:l}=o(c);u.def={...u.schema},l&&(u.defId=l);let f=u.schema;for(let p in f)delete f[p];f.$ref=a},"extractToDef");if(e.cycles==="throw")for(let c of e.seen.entries()){let u=c[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
67
+
68
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let c of e.seen.entries()){let u=c[1];if(t===c[0]){i(c);continue}if(e.external){let l=e.external.registry.get(c[0])?.id;if(t!==c[0]&&l){i(c);continue}}if(e.metadataRegistry.get(c[0])?.id){i(c);continue}if(u.cycle){i(c);continue}u.count>1&&e.reused==="ref"&&i(c)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Oe,"extractDefs");function Zf(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;Zf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let c of Array.isArray(i)?i:[i]){if(typeof c!="string")return;r.includes(c)||r.push(c)}}delete e.anyOf,e.type=r.length===1?r[0]:r}s(Zf,"compactTypeUnion");var Of=new Set(["type","properties","required","additionalProperties"]),Sf=["oneOf","anyOf"];function Pf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Pf,"undeclaredConstraint");function zu(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let c in i)if(!Of.has(c))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let c in i.properties){if(Object.prototype.hasOwnProperty.call(r,c))continue;let u=[];for(let l of t){let f=l.properties?.[c]??Pf(l);f!=null&&(u.some(p=>JSON.stringify(p)===JSON.stringify(f))||u.push(f))}let a=u.length===1?u[0]:zu(u)??{allOf:u};J(r,c,a)}for(let c of i.required??[])n.add(c)}let o={type:"object",properties:r};if(n.size&&(o.required=[...n]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let c of t){let u=Pf(c);u&&!i.some(a=>JSON.stringify(a)===JSON.stringify(u))&&i.push(u)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(zu,"foldObjects");function Ag(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Of)if(o in e)return;let r=t.filter(o=>Sf.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=zu(t);else{let o=r[0],i=Sf.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let c=t.filter(a=>a!==o),u=o[i].map(a=>zu([...c,a]));if(u.some(a=>!a))return;n={[i]:u}}n&&(delete e.allOf,kr(e,n))}s(Ag,"foldIntersection");function Ae(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s(u=>{let a=e.seen.get(u);if(a.ref===null)return;let l=a.def??a.schema,f={...l},p=a.ref;if(a.ref=null,p){n(p);let h=e.seen.get(p),y=h.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(y)):kr(l,y),kr(l,f),u._zod.parent===p)for(let $ in l)$==="$ref"||$==="allOf"||$ in f||delete l[$];if(y.$ref&&h.def)for(let $ in l)$==="$ref"||$==="allOf"||$ in h.def&&JSON.stringify(l[$])===JSON.stringify(h.def[$])&&delete l[$]}let d=u._zod.parent;if(d&&d!==p){n(d);let h=e.seen.get(d);if(h?.schema.$ref&&(l.$ref=h.schema.$ref,h.def))for(let y in l)y==="$ref"||y==="allOf"||y in h.def&&JSON.stringify(l[y])===JSON.stringify(h.def[y])&&delete l[y]}e.override({zodSchema:u,jsonSchema:l,path:a.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let u of[...e.seen.entries()].reverse())n(u[0]);if(e.target!=="openapi-3.0")for(let u of e.seen.entries())Zf(u[1].def??u[1].schema);for(let u of e.deferred)u();if(e.intersections.length){let u=new Map;for(let a of e.seen.values())for(let l of[a.schema,a.def]){let f=l?.allOf;if(!Array.isArray(f))continue;let p=u.get(f);p?p.push(l):u.set(f,[l])}for(let a of e.intersections)for(let l of u.get(a)??[])Ag(l)}}let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}kr(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let c=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let u of e.seen.entries()){let a=u[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,J(c,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?o.$defs=c:o.definitions=c);try{let u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Pt(t,"input",e.processors),output:Pt(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}s(Ae,"finalize");function H(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 H(n.element,r);if(n.type==="set")return H(n.valueType,r);if(n.type==="lazy")return H(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 H(n.innerType,r);if(n.type==="intersection")return H(n.left,r)||H(n.right,r);if(n.type==="record"||n.type==="map")return H(n.keyType,r)||H(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:H(n.in,r)||H(n.out,r);if(n.type==="object"){for(let o in n.shape)if(H(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(H(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(H(o,r))return!0;return!!(n.rest&&H(n.rest,r))}return!1}s(H,"isTransforming");var Iu=s((e,t={})=>r=>{let n=Ze({...r,processors:t});return D(e,n),Oe(n,e),Ae(n,e)},"createToJSONSchemaMethod"),Pt=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},c=Ze({...o??{},target:i,io:t,processors:r});return D(e,c),Oe(c,e),Ae(c,e)},"createStandardJSONSchemaMethod");var Zt=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),Ot=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),Af=s((e,t)=>{Zt(e,"minimum",t),Ot(e,"maximum",t)},"narrowBoth"),Tf=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),Df=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),jf=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),Lf=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),Nf=s((e,t)=>Zt(e,"minimum",t.minimum),"minContributor"),Cf=s((e,t)=>Ot(e,"maximum",t.maximum),"maxContributor"),Ef=s(e=>(t,r)=>{Lf(t,r.format);let[n,o]=e[r.format];Zt(t,"minimum",n),Ot(t,"maximum",o)},"formatContributor"),Ng={greater_than:s((e,t)=>Zt(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Ot(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>Tf(e,t.value),"multiple_of"),number_format:Ef(Bt),bigint_format:Ef(Jt),min_length:Nf,max_length:Cf,length_equals:s((e,t)=>Af(e,t.length),"length_equals"),min_size:Nf,max_size:Cf,size_equals:s((e,t)=>Af(e,t.size),"size_equals"),string_format:s((e,t)=>{Lf(e,t.format),t.pattern&&Df(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},"string_format"),mime_type:s((e,t)=>jf(e,t.mime),"mime_type")};function U(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)Ng[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Zt(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Zt(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Ot(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Ot(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Tf(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&jf(t,o.mime);for(let i of o.patterns??[])Df(t,i);return t}s(U,"aggregateChecks");var Cg={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Eg=new Map([[$n,Ni],[ur,Ci]]),Rf=s(e=>Eg.get(e)??e,"exactPattern"),Zu=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:c,format:u,patterns:a,contentEncoding:l,laxFormat:f}=U(e);if(typeof i=="number"&&(o.minLength=i),typeof c=="number"&&(o.maxLength=c),u&&(o.format=Cg[u]??u,o.format===""&&delete o.format,(u==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),a&&a.size>0){let p=[...a].map(Rf);p.length===1?o.pattern=p[0].source:p.length>1&&(o.allOf=[...p.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},"stringProcessor"),Ou=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:c,multipleOf:u,exclusiveMaximum:a,exclusiveMinimum:l,isInt:f}=U(e);o.type=f?"integer":"number";let p=typeof l=="number"&&l>=(i??Number.NEGATIVE_INFINITY),d=typeof a=="number"&&a<=(c??Number.POSITIVE_INFINITY),h=t.target==="draft-04"||t.target==="openapi-3.0";if(p?h?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),d?h?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof c=="number"&&(o.maximum=c),u){let y=new Set;for(let b of u)Number.isFinite(b)&&b!==0?y.add(Math.abs(b)):F(e,t,o,n,`A multipleOf divisor of ${b} cannot be represented in JSON Schema`);let[_,...$]=y;_!==void 0&&(o.multipleOf=_),$.length&&(o.allOf=[...o.allOf??[],...$.map(b=>({multipleOf:b}))])}},"numberProcessor"),Au=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),Nu=s((e,t,r,n)=>{F(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Cu=s((e,t,r,n)=>{F(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Eu=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Tu=s((e,t,r,n)=>{F(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Du=s((e,t,r,n)=>{F(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),ju=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Lu=s((e,t,r,n)=>{},"anyProcessor"),Ru=s((e,t,r,n)=>{},"unknownProcessor"),Vu=s((e,t,r,n)=>{F(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Mu=s((e,t,r,n)=>{let o=e._zod.def,i=tt(o.entries);if(i.length===0){r.not={};return}i.every(c=>typeof c=="number")&&(r.type="number"),i.every(c=>typeof c=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Fu=s((e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let c of o.values)if(c===void 0){if(F(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof c=="bigint"){if(F(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(c))}else i.push(c);if(i.length!==0)if(i.length===1){let c=i[0];r.type=c===null?"null":typeof c,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[c]:r.const=c}else i.every(c=>typeof c=="number")&&(r.type="number"),i.every(c=>typeof c=="string")&&(r.type="string"),i.every(c=>typeof c=="boolean")&&(r.type="boolean"),i.every(c=>c===null)&&(r.type="null"),r.enum=i},"literalProcessor"),Uu=s((e,t,r,n)=>{F(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),Bu=s((e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},"templateLiteralProcessor"),Ju=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:c,mime:u}=U(e);i!==void 0&&(o.minLength=i),c!==void 0&&(o.maxLength=c),u&&(u.length===0?o.not={}:u.length===1?o.contentMediaType=u[0]:o.anyOf=u.map(a=>({contentMediaType:a})))},"fileProcessor"),Ku=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),Wu=s((e,t,r,n)=>{F(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),qu=s((e,t,r,n)=>{F(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),Gu=s((e,t,r,n)=>{F(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),Xu=s((e,t,r,n)=>{F(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),Yu=s((e,t,r,n)=>{F(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),Hu=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:c,maximum:u}=U(e);typeof c=="number"&&(o.minItems=c),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=D(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");function xr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?xr(t.out):t.type==="catch"?xr(t.innerType):e._zod.optin}s(xr,"inputOptin");var Qu=s((e,t,r,n)=>{let o=r,i=e._zod.def,c=i.shape;if(Object.getOwnPropertySymbols(c).length&&F(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in c)J(o.properties,l,D(c[l],t,{...n,path:[...n.path,"properties",l]}));let a=[];for(let l of Object.keys(c)){let f=i.shape[l];(t.io==="input"?xr(f)===void 0:f._zod.optout===void 0)&&a.push(l)}a.length>0&&(o.required=a),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),mo=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,c=o.options.map((u,a)=>D(u,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=c:r.anyOf=c},"unionProcessor"),ea=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,"allOf",0]}),c=D(o.right,t,{...n,path:[...n.path,"allOf",1]}),u=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),a=[...u(i)?i.allOf:[i],...u(c)?c.allOf:[c]];r.allOf=a,t.intersections.push(a)},"intersectionProcessor"),ta=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let c=t.target==="draft-2020-12"?"prefixItems":"items",u=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((_,$)=>D(_,t,{...n,path:[...n.path,c,$]})),l=i.rest?D(i.rest,t,{...n,path:[...n.path,u,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,f=i.items.length;for(;f>0;){let _=i.items[f-1];if(!(t.io==="input"?xr(_)!==void 0:_._zod.optout==="optional"))break;f--}let p=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=a,d?o.items=!1:l&&(o.items=l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):t.target==="openapi-3.0"?(o.items={anyOf:a},l&&o.items.anyOf.push(l),f>0&&(o.minItems=f),d&&(o.maxItems=p)):(o.items=a,d?o.additionalItems=!1:l&&(o.additionalItems=l),f>0&&(o.minItems=f),d&&(o.maxItems=p));let{minimum:h,maximum:y}=U(e);typeof h=="number"&&(o.minItems=h),typeof y=="number"&&(o.maxItems=y)},"tupleProcessor");function Su(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let y=e.get(t)?.def;if(!y)return t;let _=Su(e,y,r);return _===y?t:_}for(let y of["anyOf","oneOf"]){let _=t[y];if(!Array.isArray(_))continue;let $=_.map(b=>Su(e,b,r));$.some((b,k)=>b!==_[k])&&(t={...t,[y]:$})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(y=>y==="number"||y==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(y=>typeof y=="number"))return t;let{minimum:c,maximum:u,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:f,format:p,id:d,...h}=t;return h.enum?h.enum=h.enum.map(y=>typeof y=="number"?String(y):y):typeof h.const=="number"&&(h.const=String(h.const)),o&&(h.type="string",i||(h.pattern=(n.includes("number")?we:tr).source)),h}s(Su,"stringifyKeyNames");var Pu=new WeakMap;function Tg(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let r=new Map;for(let n of Pu.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let c=Su(t,i,new Set);c!==i&&r.set(i,c)}if(r.size)for(let n of e.seen.values())for(let o of[n.schema,n.def]){let i=o&&r.get(o.propertyNames);i&&(o.propertyNames=i)}}s(Tg,"rewriteKeyNames");var ra=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let c=i.keyType,u=U(c).patterns;if(i.mode==="loose"&&u&&u.size>0){let f=D(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of u)J(o.patternProperties,Rf(p).source,f)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...n,path:[...n.path,"propertyNames"]});let f=Pu.get(t);f||(f=[],Pu.set(t,f),t.deferred.push(()=>Tg(t))),f.push(e)}o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=c._zod.values,l=t.io==="input"&&xr(i.valueType)!==void 0;if(a&&!i.partial&&!l){let f=[...a].filter(p=>typeof p=="string"||typeof p=="number");f.length>0&&(o.required=f.map(String))}},"recordProcessor"),na=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),c=t.seen.get(e);t.target==="openapi-3.0"?(c.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),oa=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"nonoptionalProcessor"),ia=Symbol();function Vf(e,t,r,n,o){let i=!1,c=JSON.stringify(e,(u,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(F(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ia):JSON.parse(c)}s(Vf,"serializeDefaultValue");var sa=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let c=Vf(o.defaultValue,e,t,r,n);c!==ia&&(r.default=c)},"defaultProcessor"),ca=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let c=Vf(o.defaultValue,e,t,r,n);c!==ia&&(r._prefault=c)},"prefaultProcessor"),ua=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let c;try{c=o.catchValue(void 0)}catch{F(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=c},"catchProcessor"),aa=s((e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),c=t.io==="input"?i?o.out:o.in:o.out;D(c,t,n);let u=t.seen.get(e);u.ref=c},"pipeProcessor"),la=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},"readonlyProcessor"),fa=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"promiseProcessor"),ho=s((e,t,r,n)=>{let o=e._zod.def;D(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},"optionalProcessor"),pa=s((e,t,r,n)=>{let o=e._zod.innerType;D(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),po={string:Zu,number:Ou,boolean:Au,bigint:Nu,symbol:Cu,null:Eu,undefined:Tu,void:Du,never:ju,any:Lu,unknown:Ru,date:Vu,enum:Mu,literal:Fu,nan:Uu,template_literal:Bu,file:Ju,success:Ku,custom:Wu,function:qu,transform:Gu,map:Xu,set:Yu,array:Hu,object:Qu,union:mo,intersection:ea,tuple:ta,record:ra,nullable:na,nonoptional:oa,default:sa,prefault:ca,catch:ua,pipe:aa,readonly:la,promise:fa,optional:ho,lazy:pa};function go(e,t){if("_idmap"in e){let n=e,o=Ze({...t,processors:po}),i={};for(let a of n._idmap.entries()){let[l,f]=a;D(f,o)}let c={},u={registry:n,uri:t?.uri,defs:i};o.external=u;for(let a of n._idmap.entries()){let[l,f]=a;Oe(o,f),J(c,l,Ae(o,f))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";c.__shared={[a]:i}}return{schemas:c}}let r=Ze({...t,processors:po});return D(e,r),Oe(r,e),Ae(r,e)}s(go,"toJSONSchema");var yo=class{static{s(this,"JSONSchemaGenerator")}get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Ze({processors:po,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return D(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Oe(this.ctx,t);let n=Ae(this.ctx,t),{"~standard":o,...i}=n;return i}};var Mf={};var Lt={};ye(Lt,{ZodAny:()=>Ea,ZodArray:()=>La,ZodBase64:()=>Do,ZodBase64URL:()=>jo,ZodBigInt:()=>Dt,ZodBigIntFormat:()=>Vo,ZodBoolean:()=>Tt,ZodCIDRv4:()=>Eo,ZodCIDRv6:()=>To,ZodCUID:()=>So,ZodCUID2:()=>Po,ZodCatch:()=>il,ZodCodec:()=>Er,ZodCreditCard:()=>Ia,ZodCustom:()=>Tr,ZodCustomStringFormat:()=>He,ZodDate:()=>Pr,ZodDefault:()=>Qa,ZodDiscriminatedUnion:()=>Va,ZodE164:()=>Lo,ZodEmail:()=>ko,ZodEmoji:()=>zo,ZodEnum:()=>Nt,ZodExactOptional:()=>Bo,ZodFile:()=>Ga,ZodFunction:()=>hl,ZodGUID:()=>xo,ZodIBAN:()=>Sa,ZodIPv4:()=>No,ZodIPv6:()=>Co,ZodISODate:()=>Ce,ZodISODateTime:()=>Ne,ZodISODuration:()=>Te,ZodISOTime:()=>Ee,ZodInstanceOf:()=>_l,ZodIntersection:()=>Ma,ZodJWT:()=>Ro,ZodKSUID:()=>Ao,ZodLazy:()=>pl,ZodLiteral:()=>qa,ZodMAC:()=>za,ZodMap:()=>Ka,ZodNaN:()=>cl,ZodNanoID:()=>Io,ZodNever:()=>Da,ZodNonOptional:()=>Jo,ZodNull:()=>Na,ZodNullable:()=>Ha,ZodNumber:()=>Et,ZodNumberFormat:()=>Qe,ZodObject:()=>Or,ZodOptional:()=>Nr,ZodPipe:()=>Cr,ZodPrefault:()=>tl,ZodPreprocess:()=>ul,ZodPromise:()=>ml,ZodReadonly:()=>al,ZodRecord:()=>At,ZodSet:()=>Wa,ZodString:()=>Ct,ZodStringFormat:()=>j,ZodSuccess:()=>ol,ZodSymbol:()=>Oa,ZodTemplateLiteral:()=>fl,ZodTransform:()=>Xa,ZodTuple:()=>Ua,ZodType:()=>Z,ZodULID:()=>Zo,ZodURL:()=>Sr,ZodUUID:()=>ge,ZodUndefined:()=>Aa,ZodUnion:()=>Ar,ZodUnknown:()=>Ta,ZodVoid:()=>ja,ZodXID:()=>Oo,ZodXor:()=>Ra,_ZodString:()=>vo,_default:()=>el,_function:()=>Qp,any:()=>Op,array:()=>Zr,base64:()=>lp,base64url:()=>fp,bigint:()=>zp,boolean:()=>Za,catch:()=>sl,check:()=>ed,cidrv4:()=>up,cidrv6:()=>ap,codec:()=>Gp,creditCard:()=>dp,cuid:()=>ep,cuid2:()=>tp,currencyCode:()=>$p,custom:()=>td,date:()=>Np,describe:()=>rd,discriminatedUnion:()=>Lp,e164:()=>pp,email:()=>Bf,emoji:()=>Hf,enum:()=>Fo,exactOptional:()=>Ya,file:()=>Jp,float32:()=>bp,float64:()=>vp,function:()=>Qp,guid:()=>Jf,hash:()=>wp,hex:()=>_p,hostname:()=>yp,httpUrl:()=>Yf,iban:()=>mp,instanceof:()=>od,int:()=>wo,int32:()=>kp,int64:()=>Ip,intersection:()=>Fa,invertCodec:()=>Xp,ipv4:()=>ip,ipv6:()=>cp,json:()=>sd,jwt:()=>hp,keyof:()=>Cp,ksuid:()=>op,lazy:()=>dl,literal:()=>Bp,looseObject:()=>Dp,looseRecord:()=>Vp,mac:()=>sp,map:()=>Mp,meta:()=>nd,nan:()=>qp,nanoid:()=>Qf,nativeEnum:()=>Up,never:()=>Mo,nonoptional:()=>nl,null:()=>Ca,nullable:()=>Ir,nullish:()=>Kp,number:()=>Pa,object:()=>Ep,optional:()=>Xe,partialRecord:()=>Rp,pipe:()=>bo,prefault:()=>rl,preprocess:()=>cd,promise:()=>Hp,readonly:()=>ll,record:()=>Ja,refine:()=>gl,set:()=>Fp,strictObject:()=>Tp,string:()=>zr,stringFormat:()=>gp,stringbool:()=>id,success:()=>Wp,superRefine:()=>yl,symbol:()=>Pp,templateLiteral:()=>Yp,transform:()=>Uo,tuple:()=>Ba,uint32:()=>xp,uint64:()=>Sp,ulid:()=>rp,undefined:()=>Zp,union:()=>jt,unknown:()=>Ge,url:()=>Xf,uuid:()=>Kf,uuidv4:()=>Wf,uuidv6:()=>qf,uuidv7:()=>Gf,void:()=>Ap,xid:()=>np,xor:()=>jp});var _o={};ye(_o,{endsWith:()=>wt,gt:()=>me,gte:()=>se,includes:()=>_t,length:()=>We,lowercase:()=>gt,lt:()=>de,lte:()=>ie,maxLength:()=>Ke,maxSize:()=>Pe,mime:()=>vt,minLength:()=>be,minSize:()=>he,multipleOf:()=>Se,negative:()=>uo,nonnegative:()=>lo,nonpositive:()=>ao,normalize:()=>kt,overwrite:()=>pe,positive:()=>co,properties:()=>bt,property:()=>fo,regex:()=>ht,size:()=>Je,slugify:()=>St,startsWith:()=>$t,toLowerCase:()=>zt,toUpperCase:()=>It,trim:()=>xt,uppercase:()=>yt});var Ff=new WeakSet([Object.prototype,Error.prototype]);function $o(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})}})}s($o,"_lazyMethod");var Uf=s((e,t)=>{pi.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);Ff.has(r)||(Ff.add(r),$o(r,"format",n=>o=>Yt(n,o)),$o(r,"flatten",n=>o=>Xt(n,o)),$o(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,rt,2)}),$o(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,rt,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),jg=g("ZodError",Uf),oe=g("ZodError",Uf,void 0,{Parent:Error});var da=ct(oe),ma=ut(oe),ha=at(oe),ga=lt(oe),ya=Gr(oe),_a=Xr(oe),$a=Yr(oe),wa=Hr(oe),ba=Qr(oe),va=en(oe),ka=tn(oe),xa=rn(oe);function Rg(){B.localeError||M(gr())}s(Rg,"_ensureDefaultLocale");function Ye(){B.memoizer||M({memoizer:hr()})}s(Ye,"_ensureDefaultMemoizer");var Z=g("ZodType",(e,t)=>(Rg(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(x.mergeDefs(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 E(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(gl(e,t))},superRefine(e,t){return this.check(yl(e,t))},overwrite(e){return this.check(pe(e))},optional(){return Xe(this)},exactOptional(){return Ya(this)},nullable(){return Ir(this)},nullish(){return Xe(Ir(this))},nonoptional(e){return nl(this,e)},array(){return Zr(this)},or(e){return jt([this,e])},and(e){return Fa(this,e)},transform(e){return bo(this,Uo(e))},default(e){return el(this,e)},prefault(e){return rl(this,e)},catch(e){return sl(this,e)},pipe(e){return bo(this,e)},readonly(){return ll(this)},describe(e){let t=this.clone();return K.add(t,{description:e}),t},meta(...e){if(e.length===0)return K.get(this);let t=this.clone();return K.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 x.hide(this,"~standard",{...mn(this),jsonSchema:{input:Pt(this,"input"),output:Pt(this,"output")}})},set"~standard"(e){x.own(this,"~standard",e)},parse:s(function e(t,r){return da(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await ma(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return ha(this,e,t)},async safeParseAsync(e,t){return ga(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){x.own(this,"spa",e)},validate(e,t){return Ht(this,e,t)},validateAsync(e,t){return Qt(this,e,t)},encode:s(function e(t,r){return ya(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return _a(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await $a(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await wa(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return ba(this,e,t)},safeDecode(e,t){return va(this,e,t)},async safeEncodeAsync(e,t){return ka(this,e,t)},async safeDecodeAsync(e,t){return xa(this,e,t)},toJSONSchema(e){return Iu(this,{})(e)},get description(){return K.get(this)?.description},get _def(){return this._zod.def}}),vo=g("_ZodString",(e,t)=>{Me.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Zu(e,r,n,o)},x.derived({format:s(e=>U(e).format??null,"format"),minLength:s(e=>U(e).minimum??null,"minLength"),maxLength:s(e=>U(e).maximum??null,"maxLength")},{regex(...e){return this.check(ht(...e))},includes(...e){return this.check(_t(...e))},startsWith(...e){return this.check($t(...e))},endsWith(...e){return this.check(wt(...e))},min(...e){return this.check(be(...e))},max(...e){return this.check(Ke(...e))},length(...e){return this.check(We(...e))},nonempty(...e){return this.check(be(1,...e))},lowercase(e){return this.check(gt(e))},uppercase(e){return this.check(yt(e))},trim(){return this.check(xt())},normalize(...e){return this.check(kt(...e))},toLowerCase(){return this.check(zt())},toUpperCase(){return this.check(It())},slugify(){return this.check(St())}})),Ct=g("ZodString",(e,t)=>{Me.init(e,t),vo.init(e,t)},{email(e){return this.check(Vn(ko,e))},url(e){return this.check(_r(Sr,e))},jwt(e){return this.check(so(Ro,e))},emoji(e){return this.check(Kn(zo,e))},guid(e){return this.check(Mn(xo,e))},uuid(e){return this.check(Fn(ge,e))},uuidv4(e){return this.check(Un(ge,e))},uuidv6(e){return this.check(Bn(ge,e))},uuidv7(e){return this.check(Jn(ge,e))},nanoid(e){return this.check(Wn(Io,e))},cuid(e){return this.check(qn(So,e))},cuid2(e){return this.check(Gn(Po,e))},ulid(e){return this.check(Xn(Zo,e))},base64(e){return this.check(no(Do,e))},base64url(e){return this.check(oo(jo,e))},xid(e){return this.check(Yn(Oo,e))},ksuid(e){return this.check(Hn(Ao,e))},ipv4(e){return this.check(Qn(No,e))},ipv6(e){return this.check(eo(Co,e))},cidrv4(e){return this.check(to(Eo,e))},cidrv6(e){return this.check(ro(To,e))},e164(e){return this.check(io(Lo,e))},datetime(e){return this.check($r(Ne,e))},date(e){return this.check(wr(Ce,e))},time(e){return this.check(br(Ee,e))},duration(e){return this.check(vr(Te,e))}});function zr(e){return Fc(Ct,e)}s(zr,"string");var j=g("ZodStringFormat",(e,t)=>{T.init(e,t),vo.init(e,t)}),Ne=g("ZodISODateTime",(e,t)=>{Ns.init(e,t),j.init(e,t)}),Ce=g("ZodISODate",(e,t)=>{Cs.init(e,t),j.init(e,t)}),Ee=g("ZodISOTime",(e,t)=>{Es.init(e,t),j.init(e,t)}),Te=g("ZodISODuration",(e,t)=>{Ts.init(e,t),j.init(e,t)}),ko=g("ZodEmail",(e,t)=>{bs.init(e,t),j.init(e,t)});function Bf(e){return Vn(ko,e)}s(Bf,"email");var xo=g("ZodGUID",(e,t)=>{$s.init(e,t),j.init(e,t)});function Jf(e){return Mn(xo,e)}s(Jf,"guid");var ge=g("ZodUUID",(e,t)=>{ws.init(e,t),j.init(e,t)});function Kf(e){return Fn(ge,e)}s(Kf,"uuid");function Wf(e){return Un(ge,e)}s(Wf,"uuidv4");function qf(e){return Bn(ge,e)}s(qf,"uuidv6");function Gf(e){return Jn(ge,e)}s(Gf,"uuidv7");var Sr=g("ZodURL",(e,t)=>{xs.init(e,t),j.init(e,t)});function Xf(e){return _r(Sr,e)}s(Xf,"url");function Yf(e){return _r(Sr,{protocol:er,hostname:Ti,...x.normalizeParams(e)})}s(Yf,"httpUrl");var zo=g("ZodEmoji",(e,t)=>{zs.init(e,t),j.init(e,t)});function Hf(e){return Kn(zo,e)}s(Hf,"emoji");var Io=g("ZodNanoID",(e,t)=>{Is.init(e,t),j.init(e,t)});function Qf(e){return Wn(Io,e)}s(Qf,"nanoid");var So=g("ZodCUID",(e,t)=>{Ss.init(e,t),j.init(e,t)});function ep(e){return qn(So,e)}s(ep,"cuid");var Po=g("ZodCUID2",(e,t)=>{Ps.init(e,t),j.init(e,t)});function tp(e){return Gn(Po,e)}s(tp,"cuid2");var Zo=g("ZodULID",(e,t)=>{Zs.init(e,t),j.init(e,t)});function rp(e){return Xn(Zo,e)}s(rp,"ulid");var Oo=g("ZodXID",(e,t)=>{Os.init(e,t),j.init(e,t)});function np(e){return Yn(Oo,e)}s(np,"xid");var Ao=g("ZodKSUID",(e,t)=>{As.init(e,t),j.init(e,t)});function op(e){return Hn(Ao,e)}s(op,"ksuid");var No=g("ZodIPv4",(e,t)=>{Ds.init(e,t),j.init(e,t)});function ip(e){return Qn(No,e)}s(ip,"ipv4");var za=g("ZodMAC",(e,t)=>{Ls.init(e,t),j.init(e,t)});function sp(e){return Bc(za,e)}s(sp,"mac");var Co=g("ZodIPv6",(e,t)=>{js.init(e,t),j.init(e,t)});function cp(e){return eo(Co,e)}s(cp,"ipv6");var Eo=g("ZodCIDRv4",(e,t)=>{Rs.init(e,t),j.init(e,t)});function up(e){return to(Eo,e)}s(up,"cidrv4");var To=g("ZodCIDRv6",(e,t)=>{Vs.init(e,t),j.init(e,t)});function ap(e){return ro(To,e)}s(ap,"cidrv6");var Do=g("ZodBase64",(e,t)=>{Ms.init(e,t),j.init(e,t)});function lp(e){return no(Do,e)}s(lp,"base64");var jo=g("ZodBase64URL",(e,t)=>{Fs.init(e,t),j.init(e,t)});function fp(e){return oo(jo,e)}s(fp,"base64url");var Lo=g("ZodE164",(e,t)=>{Us.init(e,t),j.init(e,t)});function pp(e){return io(Lo,e)}s(pp,"e164");var Ia=g("ZodCreditCard",(e,t)=>{Bs.init(e,t),j.init(e,t)});function dp(e){return Jc(Ia,e)}s(dp,"creditCard");var Sa=g("ZodIBAN",(e,t)=>{Js.init(e,t),j.init(e,t)});function mp(e){return Kc(Sa,e)}s(mp,"iban");var Ro=g("ZodJWT",(e,t)=>{Ks.init(e,t),j.init(e,t)});function hp(e){return so(Ro,e)}s(hp,"jwt");var He=g("ZodCustomStringFormat",(e,t)=>{Ws.init(e,t),j.init(e,t)});function gp(e,t,r={}){return qe(He,e,t,r)}s(gp,"stringFormat");function yp(e){return qe(He,"hostname",Ei,e)}s(yp,"hostname");function _p(e){return qe(He,"hex",Gi,e)}s(_p,"hex");function $p(e){return qe(He,"currency_code",ji,e)}s($p,"currencyCode");function wp(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=ae[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return qe(He,n,o,t)}s(wp,"hash");var Et=g("ZodNumber",(e,t)=>{xn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ou(e,r,n,o),e.isFinite=!0},x.derived({minValue:s(e=>{let{minimum:t,exclusiveMinimum:r}=U(e);return Math.max(t??Number.NEGATIVE_INFINITY,r??Number.NEGATIVE_INFINITY)},"minValue"),maxValue:s(e=>{let{maximum:t,exclusiveMaximum:r}=U(e);return Math.min(t??Number.POSITIVE_INFINITY,r??Number.POSITIVE_INFINITY)},"maxValue"),isInt:s(e=>{let{isInt:t,multipleOf:r}=U(e);return!!t||!!r?.some(Number.isSafeInteger)},"isInt"),format:s(e=>U(e).format??null,"format")},{gt(e,t){return this.check(me(e,t))},gte(e,t){return this.check(se(e,t))},min(e,t){return this.check(se(e,t))},lt(e,t){return this.check(de(e,t))},lte(e,t){return this.check(ie(e,t))},max(e,t){return this.check(ie(e,t))},int(e){return this.check(wo(e))},safe(e){return this.check(wo(e))},positive(e){return this.check(me(0,e))},nonnegative(e){return this.check(se(0,e))},negative(e){return this.check(de(0,e))},nonpositive(e){return this.check(ie(0,e))},multipleOf(e,t){return this.check(Se(e,t))},step(e,t){return this.check(Se(e,t))},finite(){return this}}));function Pa(e){return qc(Et,e)}s(Pa,"number");var Qe=g("ZodNumberFormat",(e,t)=>{qs.init(e,t),Et.init(e,t)});function wo(e){return Xc(Qe,e)}s(wo,"int");function bp(e){return Yc(Qe,e)}s(bp,"float32");function vp(e){return Hc(Qe,e)}s(vp,"float64");function kp(e){return Qc(Qe,e)}s(kp,"int32");function xp(e){return eu(Qe,e)}s(xp,"uint32");var Tt=g("ZodBoolean",(e,t)=>{ar.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Au(e,r,n,o)});function Za(e){return tu(Tt,e)}s(Za,"boolean");var Dt=g("ZodBigInt",(e,t)=>{zn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Nu(e,r,n,o)},x.derived({minValue:s(e=>U(e).minimum??null,"minValue"),maxValue:s(e=>U(e).maximum??null,"maxValue"),format:s(e=>U(e).format??null,"format")},{gte(e,t){return this.check(se(e,t))},min(e,t){return this.check(se(e,t))},gt(e,t){return this.check(me(e,t))},lt(e,t){return this.check(de(e,t))},lte(e,t){return this.check(ie(e,t))},max(e,t){return this.check(ie(e,t))},positive(e){return this.check(me(BigInt(0),e))},negative(e){return this.check(de(BigInt(0),e))},nonpositive(e){return this.check(ie(BigInt(0),e))},nonnegative(e){return this.check(se(BigInt(0),e))},multipleOf(e,t){return this.check(Se(e,t))}}));function zp(e){return nu(Dt,e)}s(zp,"bigint");var Vo=g("ZodBigIntFormat",(e,t)=>{Gs.init(e,t),Dt.init(e,t)});function Ip(e){return iu(Vo,e)}s(Ip,"int64");function Sp(e){return su(Vo,e)}s(Sp,"uint64");var Oa=g("ZodSymbol",(e,t)=>{Xs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Cu(e,r,n,o)});function Pp(e){return cu(Oa,e)}s(Pp,"symbol");var Aa=g("ZodUndefined",(e,t)=>{Ys.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tu(e,r,n,o)});function Zp(e){return uu(Aa,e)}s(Zp,"_undefined");var Na=g("ZodNull",(e,t)=>{Hs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Eu(e,r,n,o)});function Ca(e){return au(Na,e)}s(Ca,"_null");var Ea=g("ZodAny",(e,t)=>{Qs.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Lu(e,r,n,o)});function Op(){return lu(Ea)}s(Op,"any");var Ta=g("ZodUnknown",(e,t)=>{ec.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ru(e,r,n,o)});function Ge(){return fu(Ta)}s(Ge,"unknown");var Da=g("ZodNever",(e,t)=>{tc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ju(e,r,n,o)});function Mo(e){return pu(Da,e)}s(Mo,"never");var ja=g("ZodVoid",(e,t)=>{rc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Du(e,r,n,o)});function Ap(e){return du(ja,e)}s(Ap,"_void");var Pr=g("ZodDate",(e,t)=>{nc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vu(e,r,n,o),e.min=(r,n)=>e.check(se(r,n)),e.max=(r,n)=>e.check(ie(r,n))},x.derived({minDate:s(e=>{let{minimum:t}=U(e);return t?new Date(t):null},"minDate"),maxDate:s(e=>{let{maximum:t}=U(e);return t?new Date(t):null},"maxDate")},{}));function Np(e){return mu(Pr,e)}s(Np,"date");var La=g("ZodArray",(e,t)=>{Ye(),ic.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hu(e,r,n,o),e.element=t.element},{min(e,t){return this.check(be(e,t))},nonempty(e){return this.check(be(1,e))},max(e,t){return this.check(Ke(e,t))},length(e,t){return this.check(We(e,t))},unwrap(){return this.element}});function Zr(e,t){return yu(La,e,t)}s(Zr,"array");function Cp(e){let t=e._zod.def.shape;return Fo(Object.keys(t))}s(Cp,"keyof");var Or=g("ZodObject",(e,t)=>{Ye(),sc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qu(e,r,n,o),x.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Fo(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(x.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(x.mergeDefs(this._zod.def,{catchall:Ge()}))},loose(){return this.clone(x.mergeDefs(this._zod.def,{catchall:Ge()}))},strict(){return this.clone(x.mergeDefs(this._zod.def,{catchall:Mo()}))},strip(){return this.clone(x.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return x.extend(this,e)},safeExtend(e){return x.safeExtend(this,e)},merge(e){return x.merge(this,e)},pick(e){return x.pick(this,e)},omit(e){return x.omit(this,e)},partial(...e){return x.partial(Nr,this,e[0])},exactPartial(...e){return x.partial(Bo,this,e[0],"exactPartial")},required(...e){return x.required(Jo,this,e[0])}});function Ep(e,t){let r={type:"object",shape:e??{},...x.normalizeParams(t)};return new Or(r)}s(Ep,"object");function Tp(e,t){return new Or({type:"object",shape:e,catchall:Mo(),...x.normalizeParams(t)})}s(Tp,"strictObject");function Dp(e,t){return new Or({type:"object",shape:e,catchall:Ge(),...x.normalizeParams(t)})}s(Dp,"looseObject");var Ar=g("ZodUnion",(e,t)=>{lr.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.options=t.options});function jt(e,t){return new Ar({type:"union",options:e,...x.normalizeParams(t)})}s(jt,"union");var Ra=g("ZodXor",(e,t)=>{Ar.init(e,t),cc.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mo(e,r,n,o),e.options=t.options});function jp(e,t){return new Ra({type:"union",options:e,inclusive:!1,...x.normalizeParams(t)})}s(jp,"xor");var Va=g("ZodDiscriminatedUnion",(e,t)=>{Ar.init(e,t),ac.init(e,t)});function Lp(e,t,r){return new Va({type:"union",options:t,discriminator:e,...x.normalizeParams(r)})}s(Lp,"discriminatedUnion");var Ma=g("ZodIntersection",(e,t)=>{lc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ea(e,r,n,o)});function Fa(e,t){return new Ma({type:"intersection",left:e,right:t})}s(Fa,"intersection");var Ua=g("ZodTuple",(e,t)=>{Ye(),In.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ta(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 new Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map(t=>new Nr({type:"optional",innerType:t}))})}});function Ba(e,t,r){let n=t instanceof P,o=n?r:t,i=n?t:null;return new Ua({type:"tuple",items:e,rest:i,...x.normalizeParams(o)})}s(Ba,"tuple");var At=g("ZodRecord",(e,t)=>{Ye(),fc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ra(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ja(e,t,r){return!t||!t._zod?new At({type:"record",keyType:zr(),valueType:e,...x.normalizeParams(t)}):new At({type:"record",keyType:e,valueType:t,...x.normalizeParams(r)})}s(Ja,"record");function Rp(e,t,r){return new At({type:"record",keyType:e,valueType:t,...x.normalizeParams(r),partial:!0})}s(Rp,"partialRecord");function Vp(e,t,r){return new At({type:"record",keyType:e,valueType:t,mode:"loose",...x.normalizeParams(r)})}s(Vp,"looseRecord");var Ka=g("ZodMap",(e,t)=>{Ye(),pc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xu(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(he(...r)),e.nonempty=r=>e.check(he(1,r)),e.max=(...r)=>e.check(Pe(...r)),e.size=(...r)=>e.check(Je(...r))});function Mp(e,t,r){return new Ka({type:"map",keyType:e,valueType:t,...x.normalizeParams(r)})}s(Mp,"map");var Wa=g("ZodSet",(e,t)=>{Ye(),dc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Yu(e,r,n,o),e.min=(...r)=>e.check(he(...r)),e.nonempty=r=>e.check(he(1,r)),e.max=(...r)=>e.check(Pe(...r)),e.size=(...r)=>e.check(Je(...r))});function Fp(e,t){return new Wa({type:"set",valueType:e,...x.normalizeParams(t)})}s(Fp,"set");var Nt=g("ZodEnum",(e,t)=>{mc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Mu(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 c of n)if(r.has(c))i[c]=t.entries[c];else throw new Error(`Key ${c} not found in enum`);return new Nt({...t,checks:[],...x.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let c of n)if(r.has(c))delete i[c];else throw new Error(`Key ${c} not found in enum`);return new Nt({...t,checks:[],...x.normalizeParams(o),entries:i})}});function Fo(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Nt({type:"enum",entries:r,...x.normalizeParams(t)})}s(Fo,"_enum");function Up(e,t){return new Nt({type:"enum",entries:e,...x.normalizeParams(t)})}s(Up,"nativeEnum");var qa=g("ZodLiteral",(e,t)=>{hc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fu(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Bp(e,t){return new qa({type:"literal",values:Array.isArray(e)?e:[e],...x.normalizeParams(t)})}s(Bp,"literal");var Ga=g("ZodFile",(e,t)=>{gc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ju(e,r,n,o),e.min=(r,n)=>e.check(he(r,n)),e.max=(r,n)=>e.check(Pe(r,n)),e.mime=(r,n)=>e.check(vt(Array.isArray(r)?r:[r],n))});function Jp(e){return _u(Ga,e)}s(Jp,"file");var Xa=g("ZodTransform",(e,t)=>{Ye(),yc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gu(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new ze(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(x.issue(i,r.value,t));else{let c=i;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),"input"in c||(c.input=r.value),c.inst??(c.inst=e),r.issues.push(x.issue(c))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Uo(e){return new Xa({type:"transform",transform:e})}s(Uo,"transform");var Nr=g("ZodOptional",(e,t)=>{Sn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Xe(e){return new Nr({type:"optional",innerType:e})}s(Xe,"optional");var Bo=g("ZodExactOptional",(e,t)=>{_c.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ho(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ya(e){return new Bo({type:"optional",innerType:e})}s(Ya,"exactOptional");var Ha=g("ZodNullable",(e,t)=>{$c.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>na(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Ir(e){return new Ha({type:"nullable",innerType:e})}s(Ir,"nullable");function Kp(e){return Xe(Ir(e))}s(Kp,"nullish");var Qa=g("ZodDefault",(e,t)=>{wc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sa(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function el(e,t){return new Qa({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():x.shallowClone(t)}})}s(el,"_default");var tl=g("ZodPrefault",(e,t)=>{bc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ca(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function rl(e,t){return new tl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():x.shallowClone(t)}})}s(rl,"prefault");var Jo=g("ZodNonOptional",(e,t)=>{vc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oa(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function nl(e,t){return new Jo({type:"nonoptional",innerType:e,...x.normalizeParams(t)})}s(nl,"nonoptional");var ol=g("ZodSuccess",(e,t)=>{kc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ku(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Wp(e){return new ol({type:"success",innerType:e})}s(Wp,"success");var il=g("ZodCatch",(e,t)=>{xc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ua(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sl(e,t){return new il({type:"catch",innerType:e,catchValue:typeof t=="function"?t:x.constantCatch(t)})}s(sl,"_catch");var cl=g("ZodNaN",(e,t)=>{zc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uu(e,r,n,o)});function qp(e){return gu(cl,e)}s(qp,"nan");var Cr=g("ZodPipe",(e,t)=>{Pn.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>aa(e,r,n,o),e.in=t.in,e.out=t.out});function bo(e,t){return new Cr({type:"pipe",in:e,out:t})}s(bo,"pipe");var Er=g("ZodCodec",(e,t)=>{Cr.init(e,t),fr.init(e,t)});function Gp(e,t,r){return new Er({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}s(Gp,"codec");function Xp(e){let t=e._zod.def;return new Er({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(Xp,"invertCodec");var ul=g("ZodPreprocess",(e,t)=>{Cr.init(e,t),Ic.init(e,t)}),al=g("ZodReadonly",(e,t)=>{Sc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>la(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ll(e){return new al({type:"readonly",innerType:e})}s(ll,"readonly");var fl=g("ZodTemplateLiteral",(e,t)=>{Pc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bu(e,r,n,o)});function Yp(e,t){return new fl({type:"template_literal",parts:e,...x.normalizeParams(t)})}s(Yp,"templateLiteral");var pl=g("ZodLazy",(e,t)=>{pr.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pa(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function dl(e){return new pl({type:"lazy",getter:e})}s(dl,"lazy");var ml=g("ZodPromise",(e,t)=>{Oc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fa(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Hp(e){return new ml({type:"promise",innerType:e})}s(Hp,"promise");var hl=g("ZodFunction",(e,t)=>{Zc.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qu(e,r,n,o)});function Qp(e){return new hl({type:"function",input:Array.isArray(e?.input)?Ba(e?.input):e?.input??Zr(Ge()),output:e?.output??Ge()})}s(Qp,"_function");var Tr=g("ZodCustom",(e,t)=>{Ac.init(e,t),Z.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wu(e,r,n,o)});function ed(e){let t=new L({check:"custom"});return t._zod.check=e,t}s(ed,"check");function td(e,t){return $u(Tr,e??(()=>!0),t)}s(td,"custom");function gl(e,t={}){return wu(Tr,e,t)}s(gl,"refine");function yl(e,t){return bu(e,t)}s(yl,"superRefine");var rd=vu,nd=ku,_l=g("ZodInstanceOf",(e,t)=>{Tr.init(e,t)},{properties(e,t){return this.check(bt(e,t))}});function od(e,t={}){let r=new _l({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...x.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}s(od,"_instanceof");var id=s((...e)=>xu({Codec:Er,Boolean:Tt,String:Ct},...e),"stringbool");function sd(e){let t=dl(()=>jt([zr(e),Pa(),Za(),Ca(),Zr(t),Ja(zr(),t)]));return t}s(sd,"json");function cd(e,t){return new ul({type:"pipe",in:Uo(e),out:t})}s(cd,"preprocess");var Vg={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function Mg(e){M({customError:e})}s(Mg,"setErrorMap");function Fg(){return M().customError}s(Fg,"getErrorMap");var $l;$l||($l={});var Dr={};ye(Dr,{ZodISODate:()=>Ce,ZodISODateTime:()=>Ne,ZodISODuration:()=>Te,ZodISOTime:()=>Ee,date:()=>Bg,datetime:()=>Ug,duration:()=>Kg,time:()=>Jg});function Ug(e){return $r(Ne,e)}s(Ug,"datetime");function Bg(e){return wr(Ce,e)}s(Bg,"date");function Jg(e){return br(Ee,e)}s(Jg,"time");function Kg(e){return vr(Te,e)}s(Kg,"duration");var v={...Lt,..._o,iso:Dr},Wg=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function qg(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}s(qg,"detectVersion");function ud(e,t){return e.map((r,n)=>n<t?r:r.optional())}s(ud,"applyMinItems");function Gg(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s(Gg,"decodeJSONPointerSegment");function Xg(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let o=r[1]===void 0?void 0:Gg(r[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}s(Xg,"resolveRef");function Yg(e,t){return v.transform(n=>n).check(n=>{let o=n.value;if(typeof o!="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties&&n.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0}),t.maxProperties!==void 0&&i.length>t.maxProperties&&n.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0}),t.keySchema)for(let c of i){let u=t.keySchema.safeParse(c);u.success||n.issues.push({code:"invalid_key",origin:"record",issues:u.error.issues,input:c,path:[c],continue:!0})}}).pipe(e)}s(Yg,"checkObjectGuards");function wl(e,t){if(e===null)return"z";let r=typeof e;if(r!=="object"){if(r==="number"&&Number.isNaN(e))return null;let n=String(e);return`${r[0]}${n.length}:${n}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let c of e){let u=wl(c,t);if(u===null)return null;i.push(u)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let c=wl(e[i],t);if(c===null)return null;o.push(`${i.length}:${i}=${c}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(wl,"canonicalKey");var Hg=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Qg=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function jr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(jr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>Hg.has(t)?jr(r):!Qg.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(jr))}s(jr,"containsRef");function ad(e){return e===1?"element":"elements"}s(ad,"plural");function ey(e,t){return v.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let c=0;c<o.length;c++){let u=wl(o[c],new Set);if(u===null)continue;let a=i.get(u);if(a===void 0){i.set(u,c);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${c} duplicates the one at index ${a}`,input:o,path:[c],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,c=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,u=0;for(let a of o)if(t.containsSchema.safeParse(a).success&&++u>=c)break;u<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${ad(i)}; found ${u}`,input:o,continue:!0}),t.maxContains!==void 0&&u>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${ad(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(ey,"checkArrayGuards");function ld(e,t){if(e!==!1)return e===void 0||e===!0?v.any():Q(e,t)}s(ld,"getTupleRest");var ty=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function fd(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return v.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return v.lazy(()=>{if(!t.refs.has(o))throw new Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=Xg(o,t),c=Q(i,t);return t.refs.set(o,c),t.processing.delete(o),c}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return v.null();if(o.length===0)return v.never();if(o.length===1)return v.literal(o[0]);if(o.every(c=>typeof c=="string"))return v.enum(o);let i=o.map(c=>v.literal(c));return i.length<2?i[0]:v.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return v.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let c={...e,type:i};return fd(c,t)});return o.length===0?v.never():o.length===1?o[0]:v.union(o)}if(!r)return v.any();let n;switch(r){case"string":{let o=v.string();if(e.format){let i=e.format;i==="email"?o=o.check(v.email()):i==="uri"||i==="uri-reference"?o=o.check(v.url()):i==="uuid"||i==="guid"?o=o.check(v.uuid()):i==="date-time"?o=o.check(v.iso.datetime({offset:!0})):i==="date"?o=o.check(v.iso.date()):i==="time"?o=o.check(v.regex(ty)):i==="duration"?o=o.check(v.iso.duration()):i==="hostname"?o=o.check(v.hostname()):i==="ipv4"?o=o.check(v.ipv4()):i==="ipv6"?o=o.check(v.ipv6()):i==="mac"?o=o.check(v.mac()):i==="cidr"?o=o.check(v.cidrv4()):i==="cidr-v6"?o=o.check(v.cidrv6()):i==="base64"?o=o.check(v.base64()):i==="base64url"?o=o.check(v.base64url()):i==="e164"?o=o.check(v.e164()):i==="credit_card"?o=o.check(v.creditCard()):i==="iban"?o=o.check(v.iban()):i==="jwt"?o=o.check(v.jwt()):i==="emoji"?o=o.check(v.emoji()):i==="nanoid"?o=o.check(v.nanoid()):i==="cuid"?o=o.check(v.cuid()):i==="cuid2"?o=o.check(v.cuid2()):i==="ulid"?o=o.check(v.ulid()):i==="xid"?o=o.check(v.xid()):i==="ksuid"&&(o=o.check(v.ksuid()))}typeof e.minLength=="number"&&(o=o.min(e.minLength)),typeof e.maxLength=="number"&&(o=o.max(e.maxLength)),e.pattern&&(o=o.regex(new RegExp(e.pattern))),n=o;break}case"number":case"integer":{let o=r==="integer"?v.number().int():v.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(o=o.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(o=o.max(e.maximum)),typeof e.exclusiveMinimum=="number"?o=o.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(o=o.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?o=o.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(o=o.lt(e.maximum)),typeof e.multipleOf=="number"&&(o=o.multipleOf(e.multipleOf)),n=o;break}case"boolean":{n=v.boolean();break}case"null":{n=v.null();break}case"object":{let o={},i=e.properties||{},c=new Set(e.required||[]),u=typeof e.additionalProperties=="object"?Q(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let h=Q(d,t);J(o,p,c.has(p)?h:h.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),h=[];for(let _ of d){let $=Q(p[_],t),b=v.string().regex(new RegExp(_));h.push(v.looseRecord(b,$))}let y=[];if(Object.keys(o).length>0&&y.push(v.object(o).passthrough()),y.push(...h),y.length===0)n=v.object({}).passthrough();else if(y.length===1)n=y[0];else{let _=v.intersection(y[0],y[1]);for(let $=2;$<y.length;$++)_=v.intersection(_,y[$]);n=_}if(e.additionalProperties===!1){let _=Object.keys(o),$=d.map(k=>new RegExp(k)),b=n;n=n.check(k=>{if(!ce(k.value))return;let S=[];for(let C of Object.keys(k.value))_.includes(C)||$.some(R=>R.test(C))||S.push(C);S.length&&k.issues.push({code:"unrecognized_keys",keys:S,input:k.value,inst:b})})}}else{let p=v.object(o);e.additionalProperties===!1?n=p.strict():u?n=p.catchall(u):n=p.passthrough()}let a=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties=="number"?e.minProperties:void 0,f=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(a||l!==void 0||f!==void 0){let p;if(a){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;p=Q(d,t)}n=Yg(n,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let c=typeof e.minItems=="number"?e.minItems:0,u=o.map(p=>Q(p,t)),a=ud(u,c),l=Array.isArray(i)?void 0:ld(i,t),f=v.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(v.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(v.maxLength(e.maxItems)))}else if(Array.isArray(i)){let c=typeof e.minItems=="number"?e.minItems:0,u=i.map(p=>Q(p,t)),a=ud(u,c),l=ld(e.additionalItems,t),f=v.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(v.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(v.maxLength(e.maxItems)))}else if(i!==void 0){let c=Q(i,t),u=v.array(c);typeof e.minItems=="number"&&(u=u.min(e.minItems)),typeof e.maxItems=="number"&&(u=u.max(e.maxItems)),n=u}else n=v.array(v.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=ey(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Q(e.contains,t):void 0,minContains:typeof e.minContains=="number"?e.minContains:void 0,maxContains:typeof e.maxContains=="number"?e.maxContains:void 0}));break}default:throw new Error(`Unsupported type: ${r}`)}return n}s(fd,"convertBaseSchema");function Q(e,t){if(typeof e=="boolean")return e?v.any():v.never();let r=fd(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let u=e.anyOf.map(l=>Q(l,t)),a=v.union(u);r=n?v.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let u=e.oneOf.map(l=>Q(l,t)),a=v.xor(u);r=n?v.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:v.any();else{let u=n?r:Q(e.allOf[0],t),a=n?0:1;for(let l=a;l<e.allOf.length;l++)u=v.intersection(u,Q(e.allOf[l],t));r=u}e.nullable===!0&&t.version==="openapi-3.0"&&(r=v.nullable(r)),e.readOnly===!0&&(r=v.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of i)u in e&&(o[u]=e[u]);let c=["contentEncoding","contentMediaType","contentSchema"];for(let u of c)u in e&&(o[u]=e[u]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!jr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let u of["minProperties","maxProperties"])e[u]!==void 0&&(o[u]=e[u])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!jr(e.contains)&&(o.contains=e.contains);for(let u of["uniqueItems","minContains","maxContains"])e[u]!==void 0&&(o[u]=e[u])}for(let u of Object.keys(e))Wg.has(u)||J(o,u,e[u]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}s(Q,"convertSchema");function pd(e,t){if(typeof e=="boolean")return e?v.any():v.never();let r;try{r=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let n=qg(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??K};return Q(r,i)}s(pd,"fromJSONSchema");var dd=Symbol("z.visit/resolving");function Lr(e,t){let r=typeof t=="function"?t:(c,u)=>{let a=t[c._zod.def.type];return a?a(c,u):c},n=new Map;function o(c){let u=n.get(c);if(u===dd)return new pr({type:"lazy",getter:s(()=>n.get(c),"getter")});if(u!==void 0)return u;n.set(c,dd);let a=i(c),l=r(a,a!==c);return n.set(c,l),l}s(o,"run");function i(c){let u=c._zod.def,a=u.type;switch(a){case"object":{let l=u.shape,f=Object.keys(l),p=!1,d={};for(let y of f){let _=o(l[y]);_!==l[y]&&(p=!0),d[y]=_}let h=u.catchall;return u.catchall&&(h=o(u.catchall),h!==u.catchall&&(p=!0)),p?E(c,{...u,shape:d,catchall:h}):c}case"array":{let l=o(u.element);return l===u.element?c:E(c,{...u,element:l})}case"tuple":{let l=u.items,f=!1,p=[];for(let h of l){let y=o(h);y!==h&&(f=!0),p.push(y)}let d=u.rest;return u.rest&&(d=o(u.rest),d!==u.rest&&(f=!0)),f?E(c,{...u,items:p,rest:d}):c}case"record":case"map":{let l=o(u.keyType),f=o(u.valueType);return l===u.keyType&&f===u.valueType?c:E(c,{...u,keyType:l,valueType:f})}case"set":{let l=o(u.valueType);return l===u.valueType?c:E(c,{...u,valueType:l})}case"union":{let l=u.options,f=!1,p=[];for(let d of l){let h=o(d);h!==d&&(f=!0),p.push(h)}return f?E(c,{...u,options:p}):c}case"intersection":{let l=o(u.left),f=o(u.right);return l===u.left&&f===u.right?c:E(c,{...u,left:l,right:f})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let l=o(u.innerType);return l===u.innerType?c:E(c,{...u,innerType:l})}case"pipe":{let l=o(u.in),f=o(u.out);return l===u.in&&f===u.out?c:E(c,{...u,in:l,out:f})}case"function":{let l=o(u.input),f=o(u.output);return l===u.input&&f===u.output?c:E(c,{...u,input:l,output:f})}case"lazy":{let l=u.getter,{_cachedInner:f,...p}=u;return E(c,{...p,getter:s(()=>o(l()),"getter")})}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":return c;default:return c}}return s(i,"mapInner"),o(e)}s(Lr,"visit");function md(e){return Lr(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:jt(r.options)},"union")})}s(md,"deepPartial");function ry(e,t){if(!t?.length)return e;let r=e._zod.def;return E(e,le(r,{checks:[...r.checks??[],...t]}),{parent:!0})}s(ry,"withChecks");function hd(e){return ry(e.out,e.checks)}s(hd,"outSide");function ny(e){return e.in._zod.traits.has("$ZodTransform")?hd(e):e.in}s(ny,"inSide");function gd(e){return Lr(e,{pipe:s(t=>ny(t._zod.def),"pipe"),default:s((t,r)=>r?Xe(t._zod.def.innerType):t,"default"),catch:s((t,r)=>r?t._zod.def.innerType:t,"catch")})}s(gd,"input");function yd(e){return Lr(e,{pipe:s(t=>hd(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}s(yd,"output");var bl={};ye(bl,{bigint:()=>cy,boolean:()=>sy,date:()=>uy,number:()=>iy,string:()=>oy});function oy(e){return Uc(Ct,e)}s(oy,"string");function iy(e){return Gc(Et,e)}s(iy,"number");function sy(e){return ru(Tt,e)}s(sy,"boolean");function cy(e){return ou(Dt,e)}s(cy,"bigint");function uy(e){return hu(Pr,e)}s(uy,"date");var vl=m.object({kind:m.string(),number:m.number(),checkpoint:m.object({milestone:m.custom(e=>typeof e=="string"&&e.startsWith("node-")).optional(),required:m.boolean(),final:m.literal(!0).optional()}).optional()}),Rr=m.discriminatedUnion("kind",[m.object({kind:m.literal("skip-lesson"),missionId:m.string().min(1)}).strict(),m.object({kind:m.literal("skip-to"),missionId:m.string().min(1),stop:vl}).strict(),m.object({kind:m.literal("continue"),missionId:m.string().min(1)}).strict(),m.object({kind:m.literal("new-mission")}).strict(),m.object({kind:m.literal("review")}).strict(),m.object({kind:m.literal("tell-tutor"),missionId:m.string().min(1),request:m.string().refine(e=>e.trim().length>0,"Tell the tutor what you want to change")}).strict(),m.object({kind:m.literal("revise-lesson"),missionId:m.string().min(1)}).strict(),m.object({kind:m.literal("revise-route"),missionId:m.string().min(1)}).strict()]);var Ko=m.object({missions:m.array(m.object({id:m.string(),statement:m.string(),active:m.boolean(),retired:m.boolean(),nodes:m.number(),next:m.string().nullable()})),dueReview:m.array(m.object({id:m.string(),label:m.string()})),sessions:m.array(m.object({id:m.string(),mode:m.string(),closed:m.boolean(),title:m.string(),mission:m.string().optional(),missionLabel:m.string().optional(),parent:m.string().optional(),nodes:m.array(m.object({id:m.string(),label:m.string()})),threadId:m.string().nullable().optional()}))}),kl=m.object({nodes:m.array(m.object({id:m.string(),label:m.string(),status:m.string(),frontier:m.boolean(),x:m.number(),y:m.number()})),edges:m.array(m.object({from:m.string(),to:m.string()})),missions:m.array(m.object({id:m.string(),statement:m.string(),cone:m.array(m.string())}))});function xl(e){return e.status==="done"?"demonstrated":e.frontier?"frontier":e.status==="tentative"?"tentative":"unknown"}s(xl,"stateName");var _d=m.object({projectId:m.string(),name:m.string(),directory:m.string(),hostId:m.string()});var ay=m.object({kind:m.string(),name:m.string(),nodes:m.array(m.string()),number:m.number(),numbered:m.boolean(),cleared:m.boolean(),probablyKnown:m.boolean(),active:m.boolean(),minutes:m.number().optional(),checkpoint:m.boolean(),skip:vl}),zl=m.object({id:m.string(),statement:m.string(),active:m.string().nullable(),retired:m.boolean(),canReviseLesson:m.boolean(),next:m.string().nullable(),asides:m.array(m.string()),sections:m.array(m.object({number:m.number(),label:m.string(),minutesLeft:m.number(),lessons:m.array(ay)})),history:m.array(m.object({kind:m.string(),at:m.string(),session:m.string().optional(),parent:m.string().optional(),label:m.string()}))});var ly=m.object({session:m.string().min(1),mode:m.string().min(1),kickoff:m.string().optional(),learnerKickoff:m.boolean().optional(),carry:m.string().max(4*1024*1024).optional(),aside:m.boolean()}),wd=m.object({missionId:m.string(),outcome:m.enum(["achieved","abandoned"])}),fy=m.object({session:m.string(),mode:m.string(),title:m.string()}),bd=$d({retire:{input:wd.extend({projectId:m.string()}),output:m.object({}),tags:s(()=>["learning"],"tags")},share:{input:m.object({projectId:m.string(),missionId:m.string(),title:m.string().min(1)}),output:m.object({url:m.string()})},profiles:{input:m.object({}),output:m.array(_d)},mission:{input:m.object({projectId:m.string(),missionId:m.string()}),output:zl,tags:s(()=>["learning"],"tags")},reading:{input:m.object({projectId:m.string()}),output:Ko,tags:s(()=>["learning"],"tags")},map:{input:m.object({projectId:m.string(),missionId:m.string().optional()}),output:kl,tags:s(()=>["learning"],"tags")},context:{input:m.object({threadId:m.string()}),output:Ko.shape.sessions.element.nullable(),tags:s(()=>["learning"],"tags")},threadProject:{input:m.object({threadId:m.string()}),output:m.string().nullable()},open:{input:m.object({projectId:m.string(),intent:Rr}).strict(),output:m.object({threadId:m.string(),title:m.string()})},thread:{input:m.object({projectId:m.string(),session:m.string()}).strict(),output:m.object({threadId:m.string().nullable()})}}),vd=$d({retire:{input:wd.extend({directory:m.string()}),output:m.object({})},share:{input:m.object({directory:m.string(),missionId:m.string(),title:m.string().min(1)}),output:m.object({url:m.string()})},recognize:{input:m.object({directory:m.string()}),output:m.boolean()},mission:{input:m.object({directory:m.string(),missionId:m.string()}),output:zl},reading:{input:m.object({directory:m.string()}),output:Ko},map:{input:m.object({directory:m.string(),missionId:m.string().optional()}),output:kl},entry:{input:m.object({directory:m.string(),intent:Rr}),output:m.object({title:m.string(),resume:m.string().optional()})},session:{input:m.object({directory:m.string(),session:m.string()}),output:fy},init:{input:m.object({directory:m.string(),source:m.string().optional()}),output:m.object({directory:m.string()})},handoff:{input:m.object({directory:m.string(),requestFile:m.string()}),output:ly.extend({title:m.string()})}});function my(e){let t=e.hosts.experimental_client({contract:vd});e.events.on("thread.idle",()=>e.rpc.experimental_invalidate(["learning"]));async function r(u){let a=await e.sdk.threads.getPluginMetadata({threadId:u});return typeof a.carry=="string"?a.carry:typeof a.carryRef=="string"?await e.storage.kv.get(a.carryRef)??"":""}s(r,"carried");async function n(u){let a=await e.sdk.projects.get({projectId:u}),l=a.sources.find(f=>f.isDefault)??a.sources[0];if(!l)throw new Error("The learn project has no Profile source");return{directory:l.path,hostId:l.hostId}}s(n,"profile");async function o(u,a){let l=await n(u),f="session:"+JSON.stringify([l.hostId,l.directory,a]),p=await e.storage.kv.get(f);if(p&&await e.sdk.threads.get({threadId:p}).then(()=>!0,()=>!1))return p;for(let d of[!1,!0])for(let h=0;;h+=200){let y=await e.sdk.threads.list({projectId:u,archived:d,includeHidden:!0,limit:200,offset:h});if(!y.length)break;let _=await e.sdk.threads.experimental_listPluginMetadata({threadIds:y.map($=>$.id)});for(let $ of _.threads){if($.metadata.session!==a)continue;let b=y.find(S=>S.id===$.threadId);if(!b?.environmentId)continue;let k=await e.sdk.environments.get({environmentId:b.environmentId});if(!(k.hostId!==l.hostId||k.path!==l.directory))return await e.storage.kv.set(f,b.id),b.id}if(y.length<200)break}return null}s(o,"association");async function i(u,a,l){let f=await n(u);await e.storage.kv.set("session:"+JSON.stringify([f.hostId,f.directory,a]),l)}s(i,"remember");async function c(u){let a=await n(u);return await t.call("recognize",{directory:a.directory},{hostId:a.hostId})?t.call("map",{directory:a.directory},{hostId:a.hostId}):null}s(c,"learnMap"),e.ui.registerMentionProvider({id:"map",label:"Map",async search({query:u,projectId:a}){let l=a?await c(a).catch(()=>null):null;if(!l)return[];let f=s(p=>p.toLowerCase().includes(u.toLowerCase()),"matches");return[...l.nodes.filter(p=>f(p.label)).map(p=>({id:[a,"node",p.id].join("~"),title:p.label,subtitle:"Node \xB7 "+xl(p)})),...l.missions.filter(p=>f(p.statement)).map(p=>({id:[a,"mission",p.id].join("~"),title:p.statement,subtitle:"Mission"}))].slice(0,20)},async resolve(u){let[a="",l,f="",p=""]=u.split("~"),d=await c(a);if(!d)throw new Error("That Profile is no longer a learn project");let h=s(b=>d.nodes.find(k=>k.id===b),"node"),y=s(b=>JSON.stringify(h(b)?.label??b)+" ("+b+")","name"),_=s(b=>b.map(y).join(", ")||"nothing","list");if(l==="mission"){let b=d.missions.find(k=>k.id===f);if(!b)throw new Error("That Mission is no longer in the Profile");return{context:"Mission "+JSON.stringify(b.statement)+" (id "+b.id+"). Its Nodes: "+_(b.cone)+"."}}if(l==="edge"){if(!d.edges.some(b=>b.from===f&&b.to===p))throw new Error("That Edge is no longer in the graph");return{context:"Edge: "+y(f)+" is needed for "+y(p)+"."}}let $=h(f);if(!$)throw new Error("That Node is no longer in the graph");return{context:"Node "+JSON.stringify($.label)+" (id "+$.id+", "+xl($)+"). Needs: "+_(d.edges.filter(b=>b.to===f).map(b=>b.from))+". Unlocks: "+_(d.edges.filter(b=>b.from===f).map(b=>b.to))+"."}}}),e.rpc.register(bd,{profiles:s(async()=>{let u=new Map;return(await Promise.all((await e.sdk.projects.list()).map(async l=>{let f=l.sources.find(d=>d.isDefault)??l.sources[0];if(!f)return[];let p=u.get(f.hostId);return p||(p=e.sdk.hosts.get({hostId:f.hostId}).then(d=>d.status==="connected"),u.set(f.hostId,p)),await p?await t.call("recognize",{directory:f.path},{hostId:f.hostId})?[{projectId:l.id,name:l.name,directory:f.path,hostId:f.hostId}]:[]:[]}))).flat()},"profiles"),reading:s(async({projectId:u})=>{let a=await n(u),l=await t.call("reading",{directory:a.directory},{hostId:a.hostId});return{...l,sessions:await Promise.all(l.sessions.map(async f=>({...f,threadId:await o(u,f.id)})))}},"reading"),threadProject:s(async({threadId:u})=>{let a=await e.sdk.threads.get({threadId:u}),l=await n(a.projectId).catch(()=>null);return l&&await t.call("recognize",{directory:l.directory},{hostId:l.hostId})?a.projectId:null},"threadProject"),map:s(async({projectId:u,missionId:a})=>{let l=await n(u);return t.call("map",{directory:l.directory,missionId:a},{hostId:l.hostId})},"map"),retire:s(async({projectId:u,missionId:a,outcome:l})=>{let f=await n(u);return t.call("retire",{directory:f.directory,missionId:a,outcome:l},{hostId:f.hostId})},"retire"),share:s(async({projectId:u,missionId:a,title:l})=>{let f=await n(u);return t.call("share",{directory:f.directory,missionId:a,title:l},{hostId:f.hostId})},"share"),mission:s(async({projectId:u,missionId:a})=>{let l=await n(u);return t.call("mission",{directory:l.directory,missionId:a},{hostId:l.hostId})},"mission"),context:s(async({threadId:u})=>{let a=await e.sdk.threads.get({threadId:u}),l=await e.sdk.threads.getPluginMetadata({threadId:u});if(typeof l.session!="string"||!a.projectId)return null;let f=await n(a.projectId);return(await t.call("reading",{directory:f.directory},{hostId:f.hostId})).sessions.find(d=>d.id===l.session)??null},"context"),thread:s(async({projectId:u,session:a})=>({threadId:await o(u,a)}),"thread"),open:s(async({projectId:u,intent:a})=>{let l=await n(u),f=await t.call("entry",{directory:l.directory,intent:a},{hostId:l.hostId});if(f.resume){let $=await o(u,f.resume);if($)return{threadId:$,title:(await e.sdk.threads.get({threadId:$})).title??f.title}}let d=(await e.sdk.environments.list({projectId:u,hostId:l.hostId,path:l.directory})).find($=>$.path===l.directory),h=await e.sdk.projects.defaultExecutionOptions({projectId:u}),y=a.kind==="tell-tutor"?a.request:a.kind==="new-mission"?"/ncept-kickoff Chart a new Mission.":a.kind==="review"?"/ncept-kickoff Begin the Review.":a.kind==="revise-lesson"?"/ncept-kickoff Rework this Lesson; the learner requested a different approach.":a.kind==="revise-route"?"/ncept-kickoff Revise the route for this Mission.":a.kind==="skip-lesson"||a.kind==="skip-to"?"/ncept-kickoff Continue from the stop the learner skipped to.":"/ncept-kickoff Continue this Mission.",_=await e.sdk.threads.spawn({projectId:u,environment:d?{type:"reuse",environmentId:d.id}:{type:"host",hostId:l.hostId,workspace:{type:"unmanaged",path:l.directory}},providerId:"pi",...h?.providerId==="pi"?{model:h.model,reasoningLevel:h.reasoningLevel,serviceTier:h.serviceTier,permissionMode:h.permissionMode}:{},input:[{type:"text",mentions:[],text:y,...a.kind==="tell-tutor"?{}:{visibility:"agent-only"}}],title:f.title.slice(0,200),pluginMetadata:f.resume?{session:f.resume}:{intent:a}});return f.resume&&await i(u,f.resume,_.id),{threadId:_.id,title:f.title.slice(0,200)}},"open")}),e.providers.experimental_contributeEnv("pi",async({threadId:u})=>{if(!u)return[];let a=await e.sdk.threads.getPluginMetadata({threadId:u});if(a.localSession===!0)return[];if(a.intent){let f=Rr.safeParse(a.intent);return f.success?[{name:"NCEPT_BB_ENTRY",value:JSON.stringify(f.data),reason:"Open the requested tutoring Session entry"}]:[]}if(typeof a.session!="string")return[];let l=[{name:"NCEPT_BB_SESSION",value:a.session,reason:"Adopt this thread's tutoring Session"}];return typeof a.carryRef=="string"?l.push({name:"NCEPT_BB_CARRY_REF",value:u,reason:"Fetch the full Session carry through bb concept carry"}):typeof a.carry=="string"&&l.push({name:"NCEPT_BB_CARRY",value:a.carry,reason:"Carry context to the next tutor"}),l}),e.cli.register(dy({name:"concept",summary:"Learn in bb from a local Common Concept Profile",commands:{init:Wo({summary:"Create a Profile, trust its pi extensions, and create its bb project",positionals:[{name:"dir",description:"Profile directory on the selected machine (default ~/learn)"}],options:{machine:{type:"string",description:"Machine ID or name; defaults to this thread's machine, otherwise the server"},source:{type:"string",description:"Unpublished packages/bb directory on that machine (uses sibling packages/pi too)"},name:{type:"string",description:"bb project name (default: directory name)"}},async run(u,a){let l;if(u.options.machine){let h=(await e.sdk.hosts.list()).filter(_=>_.id===u.options.machine||_.name===u.options.machine),y=h[0];if(!y||h.length!==1)throw new Error("Choose an unambiguous connected machine ID or name.");l=y.id}else if(a.threadId){let d=await e.sdk.threads.get({threadId:a.threadId});d.environmentId&&(l=(await e.sdk.environments.get({environmentId:d.environmentId})).hostId)}else l=(await e.sdk.system.config()).primaryHostId;if(!l)throw new Error("No machine selected. Add --machine <id>.");let{directory:f}=await t.call("init",{directory:u.positionals.dir??"~/learn",...u.options.source?{source:u.options.source}:{}},{hostId:l,signal:a.signal}),p=await e.sdk.projects.create({name:u.options.name??py(f),source:{type:"local_path",hostId:l,path:f}});return{exitCode:0,stdout:JSON.stringify({projectId:p.id,hostId:l,directory:f})}}}),spawn:Wo({summary:"Open an already-created tutoring Session in this thread's project and environment",options:{"request-file":{type:"string",required:!0,description:"Absolute host-local JSON handoff file (carry limited to 4 MiB)"}},async run(u,a){if(!a.threadId)throw new Error("Run from a bb thread (BB_THREAD_ID is required).");let l=await e.sdk.threads.get({threadId:a.threadId});if(!l.environmentId)throw new Error("The tutoring thread has no environment.");let f=await e.sdk.environments.get({environmentId:l.environmentId});if(!f.path)throw new Error("The tutoring environment has no Profile path.");let p=await t.call("handoff",{directory:f.path,requestFile:u.options["request-file"]},{hostId:f.hostId,signal:a.signal}),d=p.carry&&Buffer.byteLength(p.carry,"utf8")>24*1024?"carry:"+p.session:void 0;d&&await e.storage.kv.set(d,p.carry);let h=await e.sdk.threads.defaultExecutionOptions({threadId:l.id}),y=await e.sdk.threads.spawn({projectId:l.projectId,environment:{type:"reuse",environmentId:l.environmentId},providerId:"pi",...h?{model:h.model,reasoningLevel:h.reasoningLevel,serviceTier:h.serviceTier,permissionMode:h.permissionMode}:{},input:[{type:"text",mentions:[],text:p.learnerKickoff?p.kickoff??"":"/ncept-kickoff "+(p.kickoff||"Continue."),...p.learnerKickoff?{}:{visibility:"agent-only"}}],title:p.title,...p.aside?{parentThreadId:l.id,parentNotifications:"off"}:{},pluginMetadata:{session:p.session,...d?{carryRef:d}:p.carry?{carry:p.carry}:{}}});return await i(l.projectId,p.session,y.id),{exitCode:0,stdout:JSON.stringify({threadId:y.id,title:p.title})}}}),associate:Wo({summary:"Associate this tutoring thread with its pi-owned Session",options:{session:{type:"string",required:!0,description:"The Session recorded by ncept-pi"}},async run(u,a){if(!a.threadId)throw new Error("Run from a bb thread");let l=await e.sdk.threads.get({threadId:a.threadId});if(!l.environmentId)throw new Error("The thread has no Profile environment");let f=await e.sdk.environments.get({environmentId:l.environmentId}),p=await n(l.projectId);if(f.hostId!==p.hostId||f.path!==p.directory)throw new Error("The thread is not in its learn project's Profile environment");let d=await t.call("session",{directory:p.directory,session:u.options.session},{hostId:p.hostId,signal:a.signal}),h=await e.sdk.threads.getPluginMetadata({threadId:l.id});return await e.sdk.threads.updatePluginMetadata({threadId:l.id,set:{...d,...!h.intent&&!h.session?{localSession:!0}:{}}}),h.intent&&await e.sdk.threads.update({threadId:l.id,title:d.title}),await i(l.projectId,d.session,l.id),{exitCode:0,stdout:JSON.stringify(d)}}}),carry:Wo({summary:"Read a thread's hidden tutoring carry (for the pi extension)",options:{thread:{type:"string",required:!0,description:"Thread ID supplied by NCEPT_BB_CARRY_REF"}},async run(u){return{exitCode:0,stdout:JSON.stringify({carry:await r(u.options.thread)})}}})}}))}s(my,"ncept");export{my as default};
69
+ //# sourceMappingURL=server.js.map