@gperezmz/bb-plugin-thread-glance 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/app.css +1 -1
- package/dist/app.js +32 -32
- package/dist/app.meta.json +1 -1
- package/dist/server.js +8 -8
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/features/thread-list/components/FoldRows.tsx +14 -13
- package/features/thread-list/components/GroupSection.tsx +118 -69
- package/features/thread-list/components/Rails.tsx +2 -3
- package/features/thread-list/components/ThreadList.tsx +21 -16
- package/features/thread-list/components/ThreadRowView.tsx +12 -9
- package/features/thread-list/components/Toolbar.tsx +129 -187
- package/features/thread-list/components/controller.ts +1 -2
- package/features/thread-list/components/glyphs.tsx +1 -1
- package/features/thread-list/data/useClientPreferences.ts +1 -1
- package/features/thread-list/data/useNeedsYouHold.ts +19 -0
- package/features/thread-list/model/counters.ts +13 -19
- package/features/thread-list/model/details.ts +2 -2
- package/features/thread-list/model/expansion.ts +10 -10
- package/features/thread-list/model/families.ts +50 -48
- package/features/thread-list/model/labels.ts +2 -1
- package/features/thread-list/model/layout.ts +6 -11
- package/features/thread-list/model/needs-you.ts +133 -0
- package/features/thread-list/model/notes.ts +1 -1
- package/features/thread-list/model/settings.ts +54 -0
- package/features/thread-list/model/share.ts +7 -1
- package/features/thread-list/model/sort.ts +14 -6
- package/features/thread-list/model/state.ts +11 -11
- package/features/thread-list/model/time.ts +1 -1
- package/features/thread-list/model/toggles.ts +2 -7
- package/features/thread-list/model/view.ts +139 -143
- package/features/thread-list/testing/fixtures.ts +19 -10
- package/package.json +1 -1
- package/server/cli.ts +2 -2
- package/shared/preferences.ts +10 -23
- package/skills/thread-glance/SKILL.md +9 -10
- package/features/thread-list/model/attention.ts +0 -89
package/dist/server.js
CHANGED
|
@@ -4,12 +4,12 @@ import { fileURLToPath as __fileURLToPath } from "node:url";
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
var Jl=Object.defineProperty;var s=(e,t)=>Jl(e,"name",{value:t,configurable:!0});var $e=(e,t)=>{for(var r in t)Jl(e,r,{get:t[r],enumerable:!0})};import{defineRpcContract as Qy}from"@get-bb/plugin-sdk";var b={};$e(b,{$brand:()=>vi,$input:()=>Gu,$output:()=>Ju,INVALID:()=>Y,NEVER:()=>bi,TimePrecision:()=>oc,ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Bo,ZodBase64URL:()=>Jo,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Wo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Ko,ZodCIDRv6:()=>Uo,ZodCUID:()=>Do,ZodCUID2:()=>Ro,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCompileAsyncError:()=>pe,ZodCompileUnsupportedError:()=>Z,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>rt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>Go,ZodEmail:()=>No,ZodEmoji:()=>Co,ZodEnum:()=>Rt,ZodError:()=>$y,ZodExactOptional:()=>Qo,ZodFile:()=>sl,ZodFirstPartyTypeKind:()=>Ol,ZodFunction:()=>Sl,ZodGUID:()=>Eo,ZodIBAN:()=>La,ZodIPv4:()=>Mo,ZodIPv6:()=>Fo,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodIssueCode:()=>vy,ZodJWT:()=>qo,ZodKSUID:()=>Vo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>To,ZodNever:()=>Ga,ZodNonOptional:()=>ei,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>nt,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRealError:()=>ie,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>Lo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>jo,ZodXor:()=>Xa,_ZodString:()=>Zo,_default:()=>fl,_function:()=>yd,any:()=>qp,array:()=>Tr,base64:()=>Ip,base64url:()=>Ap,bigint:()=>Kp,boolean:()=>Va,catch:()=>yl,check:()=>_d,cidrv4:()=>Sp,cidrv6:()=>Pp,clone:()=>C,codec:()=>dd,coerce:()=>Nl,compile:()=>Hu,config:()=>F,core:()=>ke,creditCard:()=>Zp,cuid:()=>_p,cuid2:()=>$p,currencyCode:()=>Rp,custom:()=>$d,date:()=>Xp,decode:()=>Aa,decodeAsync:()=>Za,deepPartial:()=>Nd,describe:()=>wd,discriminatedUnion:()=>rd,e164:()=>Op,email:()=>cp,emoji:()=>gp,encode:()=>Ia,encodeAsync:()=>Oa,endsWith:()=>zt,enum:()=>Ho,exactOptional:()=>cl,file:()=>ad,flattenError:()=>rr,float32:()=>jp,float64:()=>Vp,formatError:()=>nr,fromJSONSchema:()=>Od,function:()=>yd,getDiscriminatedOption:()=>wu,getErrorMap:()=>ky,globalRegistry:()=>G,gt:()=>he,gte:()=>ue,guid:()=>ap,hash:()=>Lp,hex:()=>Dp,hostname:()=>Tp,httpUrl:()=>hp,iban:()=>Np,includes:()=>xt,input:()=>Cd,instanceof:()=>vd,int:()=>Ao,int32:()=>Mp,int64:()=>Up,intersection:()=>Qa,invertCodec:()=>md,ipv4:()=>xp,ipv6:()=>zp,iso:()=>Fr,json:()=>kd,jwt:()=>Ep,keyof:()=>Hp,ksuid:()=>vp,lazy:()=>kl,length:()=>He,literal:()=>cd,locales:()=>xr,looseObject:()=>ed,looseRecord:()=>od,lowercase:()=>bt,lt:()=>me,lte:()=>se,mac:()=>kp,map:()=>id,maxLength:()=>Xe,maxSize:()=>Oe,memoizer:()=>br,meta:()=>bd,mime:()=>Pt,minLength:()=>xe,minSize:()=>ge,multipleOf:()=>Ae,nan:()=>pd,nanoid:()=>yp,nativeEnum:()=>ud,negative:()=>_o,never:()=>Xo,nonnegative:()=>wo,nonoptional:()=>ml,nonpositive:()=>$o,normalize:()=>It,null:()=>Ua,nullable:()=>Nr,nullish:()=>ld,number:()=>ja,object:()=>Yp,optional:()=>et,output:()=>Td,overwrite:()=>de,parse:()=>ka,parseAsync:()=>za,partialRecord:()=>nd,pipe:()=>Oo,positive:()=>yo,prefault:()=>dl,preprocess:()=>zd,prettifyError:()=>Pi,promise:()=>gd,properties:()=>St,property:()=>bo,readonly:()=>bl,record:()=>rl,refine:()=>Pl,regex:()=>wt,regexes:()=>le,registry:()=>Bn,safeDecode:()=>Ea,safeDecodeAsync:()=>Ta,safeEncode:()=>Na,safeEncodeAsync:()=>Ca,safeParse:()=>Sa,safeParseAsync:()=>Pa,set:()=>sd,setErrorMap:()=>xy,size:()=>We,slugify:()=>Nt,startsWith:()=>kt,strictObject:()=>Qp,string:()=>Zr,stringFormat:()=>Cp,stringbool:()=>xd,success:()=>fd,superRefine:()=>Il,symbol:()=>Jp,templateLiteral:()=>hd,toJSONSchema:()=>zo,toLowerCase:()=>Ot,toUpperCase:()=>Zt,toZod:()=>Gt,transform:()=>Yo,treeifyError:()=>Si,trim:()=>At,tuple:()=>tl,uint32:()=>Fp,uint64:()=>Bp,ulid:()=>wp,undefined:()=>Gp,union:()=>Ft,unknown:()=>Qe,uppercase:()=>vt,url:()=>mp,util:()=>v,uuid:()=>lp,uuidv4:()=>fp,uuidv6:()=>pp,uuidv7:()=>dp,validate:()=>or,validateAsync:()=>ir,void:()=>Wp,withParser:()=>Jn,xid:()=>bp,xor:()=>td});var ke={};$e(ke,{$ZodAny:()=>pu,$ZodArray:()=>yu,$ZodAsyncError:()=>ne,$ZodBase64:()=>eu,$ZodBase64URL:()=>tu,$ZodBigInt:()=>Cn,$ZodBigIntFormat:()=>cu,$ZodBoolean:()=>hr,$ZodCIDRv4:()=>Ys,$ZodCIDRv6:()=>Qs,$ZodCUID:()=>Vs,$ZodCUID2:()=>Ms,$ZodCatch:()=>Du,$ZodCheck:()=>L,$ZodCheckBigIntFormat:()=>ds,$ZodCheckEndsWith:()=>zs,$ZodCheckGreaterThan:()=>_n,$ZodCheckIncludes:()=>xs,$ZodCheckLengthEquals:()=>$s,$ZodCheckLessThan:()=>yn,$ZodCheckLowerCase:()=>bs,$ZodCheckMaxLength:()=>ys,$ZodCheckMaxSize:()=>ms,$ZodCheckMimeType:()=>Is,$ZodCheckMinLength:()=>_s,$ZodCheckMinSize:()=>hs,$ZodCheckMultipleOf:()=>fs,$ZodCheckNumberFormat:()=>ps,$ZodCheckOverwrite:()=>As,$ZodCheckProperties:()=>Ps,$ZodCheckProperty:()=>Ss,$ZodCheckRegex:()=>ws,$ZodCheckSizeEquals:()=>gs,$ZodCheckStartsWith:()=>ks,$ZodCheckStringFormat:()=>gt,$ZodCheckUpperCase:()=>vs,$ZodCodec:()=>yr,$ZodCreditCard:()=>nu,$ZodCustom:()=>Ku,$ZodCustomStringFormat:()=>su,$ZodCyclicError:()=>Mn,$ZodDate:()=>gu,$ZodDefault:()=>Nu,$ZodDiscriminatedUnion:()=>bu,$ZodE164:()=>ru,$ZodEmail:()=>Cs,$ZodEmoji:()=>Ls,$ZodEncodeError:()=>Ie,$ZodEnum:()=>Su,$ZodError:()=>zi,$ZodExactOptional:()=>Ou,$ZodFile:()=>Iu,$ZodFunction:()=>Mu,$ZodGUID:()=>Ns,$ZodIBAN:()=>ou,$ZodIPv4:()=>Ws,$ZodIPv6:()=>Xs,$ZodISODate:()=>Js,$ZodISODateTime:()=>Bs,$ZodISODuration:()=>qs,$ZodISOTime:()=>Gs,$ZodIntersection:()=>vu,$ZodJWT:()=>iu,$ZodKSUID:()=>Us,$ZodLazy:()=>_r,$ZodLiteral:()=>Pu,$ZodMAC:()=>Hs,$ZodMap:()=>ku,$ZodNaN:()=>Ru,$ZodNanoID:()=>js,$ZodNever:()=>mu,$ZodNonOptional:()=>Cu,$ZodNull:()=>fu,$ZodNullable:()=>Zu,$ZodNumber:()=>En,$ZodNumberFormat:()=>uu,$ZodObject:()=>If,$ZodObjectJIT:()=>_u,$ZodOptional:()=>Dn,$ZodPipe:()=>Rn,$ZodPrefault:()=>Eu,$ZodPreprocess:()=>Lu,$ZodPromise:()=>Fu,$ZodReadonly:()=>ju,$ZodRealError:()=>oe,$ZodRecord:()=>xu,$ZodRegistry:()=>Un,$ZodSet:()=>zu,$ZodString:()=>Ue,$ZodStringFormat:()=>T,$ZodSuccess:()=>Tu,$ZodSymbol:()=>au,$ZodTemplateLiteral:()=>Vu,$ZodTransform:()=>Au,$ZodTuple:()=>Tn,$ZodType:()=>P,$ZodULID:()=>Fs,$ZodURL:()=>Rs,$ZodUUID:()=>Es,$ZodUndefined:()=>lu,$ZodUnion:()=>gr,$ZodUnknown:()=>du,$ZodVoid:()=>hu,$ZodXID:()=>Ks,$ZodXor:()=>$u,$brand:()=>vi,$constructor:()=>h,$input:()=>Gu,$output:()=>Ju,Doc:()=>Ke,INVALID:()=>Y,JSONSchema:()=>ip,JSONSchemaGenerator:()=>So,NEVER:()=>bi,TimePrecision:()=>oc,URL_BAD_FORMAT:()=>Ts,URL_UNPARSEABLE:()=>lr,ZodCompileAsyncError:()=>pe,ZodCompileUnsupportedError:()=>Z,_any:()=>bc,_array:()=>Ic,_base64:()=>po,_base64url:()=>mo,_bigint:()=>mc,_boolean:()=>pc,_catch:()=>uy,_check:()=>Kf,_cidrv4:()=>lo,_cidrv6:()=>fo,_coercedBigint:()=>hc,_coercedBoolean:()=>dc,_coercedDate:()=>Sc,_coercedNumber:()=>sc,_coercedString:()=>ec,_creditCard:()=>rc,_cuid:()=>no,_cuid2:()=>oo,_custom:()=>Oc,_date:()=>zc,_decode:()=>sn,_decodeAsync:()=>cn,_default:()=>oy,_discriminatedUnion:()=>Jg,_e164:()=>ho,_email:()=>Wn,_emoji:()=>to,_encode:()=>on,_encodeAsync:()=>un,_endsWith:()=>zt,_enum:()=>Yg,_file:()=>Ac,_float32:()=>cc,_float64:()=>ac,_gt:()=>he,_gte:()=>ue,_guid:()=>Xn,_iban:()=>nc,_includes:()=>xt,_int:()=>uc,_int32:()=>lc,_int64:()=>gc,_intersection:()=>Gg,_ipv4:()=>co,_ipv6:()=>ao,_isoDate:()=>Sr,_isoDateTime:()=>zr,_isoDuration:()=>Ir,_isoTime:()=>Pr,_jwt:()=>go,_ksuid:()=>uo,_lazy:()=>fy,_length:()=>He,_literal:()=>ey,_lowercase:()=>bt,_lt:()=>me,_lte:()=>se,_mac:()=>tc,_map:()=>Xg,_max:()=>se,_maxLength:()=>Xe,_maxSize:()=>Oe,_mime:()=>Pt,_min:()=>ue,_minLength:()=>xe,_minSize:()=>ge,_multipleOf:()=>Ae,_nan:()=>Pc,_nanoid:()=>ro,_nativeEnum:()=>Qg,_negative:()=>_o,_never:()=>xc,_nonnegative:()=>wo,_nonoptional:()=>iy,_nonpositive:()=>$o,_normalize:()=>It,_null:()=>wc,_nullable:()=>ny,_number:()=>ic,_optional:()=>ry,_overwrite:()=>de,_parse:()=>pt,_parseAsync:()=>dt,_pipe:()=>cy,_positive:()=>yo,_promise:()=>py,_properties:()=>St,_property:()=>bo,_readonly:()=>ay,_record:()=>Wg,_refine:()=>Zc,_regex:()=>wt,_safeDecode:()=>ln,_safeDecodeAsync:()=>pn,_safeEncode:()=>an,_safeEncodeAsync:()=>fn,_safeParse:()=>mt,_safeParseAsync:()=>ht,_set:()=>Hg,_size:()=>We,_slugify:()=>Nt,_startsWith:()=>kt,_string:()=>Qu,_stringFormat:()=>Ye,_stringbool:()=>Tc,_success:()=>sy,_superRefine:()=>Nc,_symbol:()=>_c,_templateLiteral:()=>ly,_toLowerCase:()=>Ot,_toUpperCase:()=>Zt,_transform:()=>ty,_trim:()=>At,_tuple:()=>qg,_uint32:()=>fc,_uint64:()=>yc,_ulid:()=>io,_undefined:()=>$c,_union:()=>Ug,_unknown:()=>vc,_uppercase:()=>vt,_url:()=>kr,_uuid:()=>Hn,_uuidv4:()=>Yn,_uuidv6:()=>Qn,_uuidv7:()=>eo,_void:()=>kc,_xid:()=>so,_xor:()=>Bg,base64Charset:()=>In,base64urlCharset:()=>mr,canParseURL:()=>Ds,clone:()=>C,compile:()=>Hu,compileFn:()=>Gn,config:()=>F,createStandardJSONSchemaMethod:()=>Et,createToJSONSchemaMethod:()=>Rc,decode:()=>eh,decodeAsync:()=>rh,describe:()=>Ec,encode:()=>Qm,encodeAsync:()=>th,extractDefs:()=>Ne,finalize:()=>Ee,flattenError:()=>rr,formatError:()=>nr,getDiscriminatedOption:()=>wu,globalConfig:()=>B,globalRegistry:()=>G,handleUnrepresentable:()=>K,initializeContext:()=>Ze,isBackEdge:()=>Kn,isRecursiveSchema:()=>Fn,isValidBase64:()=>dr,isValidBase64URL:()=>An,isValidCIDRv6:()=>Pn,isValidCreditCard:()=>On,isValidIBAN:()=>Zn,isValidIPv6:()=>pr,isValidJWT:()=>Nn,locales:()=>xr,memoizer:()=>br,mergeValues:()=>yt,meta:()=>Cc,parse:()=>rn,parseAsync:()=>nn,parseURLObject:()=>zf,prettifyError:()=>Pi,process:()=>D,processSchema:()=>D,regexes:()=>le,registry:()=>Bn,safeDecode:()=>oh,safeDecodeAsync:()=>sh,safeEncode:()=>nh,safeEncodeAsync:()=>ih,safeParse:()=>qm,safeParseAsync:()=>Wm,standardProps:()=>xn,stripTabAndNewline:()=>fr,toDotPath:()=>nf,toJSONSchema:()=>zo,toZod:()=>Gt,treeifyError:()=>Si,urlHostnameOk:()=>zn,urlProtocolOk:()=>Sn,util:()=>v,validate:()=>or,validateAsync:()=>ir,validateURL:()=>kn,version:()=>Os,withParser:()=>Jn});var v={};$e(v,{BIGINT_FORMAT_RANGES:()=>Yt,CONSTANT_CATCH:()=>en,Class:()=>li,NUMBER_FORMAT_RANGES:()=>Ht,aborted:()=>H,allowsEval:()=>di,assert:()=>mm,assertEqual:()=>lm,assertIs:()=>pm,assertNever:()=>dm,assertNotEqual:()=>fm,assignProp:()=>J,attachSchema:()=>Qr,base64ToUint8Array:()=>Hl,base64urlToUint8Array:()=>Em,cached:()=>at,captureStackTrace:()=>Xr,cleanEnum:()=>Nm,cleanRegex:()=>be,clone:()=>C,cloneDef:()=>ym,codePointLength:()=>Me,constantCatch:()=>$i,createTransparentProxy:()=>xm,defineLazy:()=>fi,defineLazyInternal:()=>O,derived:()=>Rm,esc:()=>X,escapeRegex:()=>ae,explicitlyAborted:()=>gi,extend:()=>Sm,finalizeIssue:()=>re,floatSafeRemainder:()=>qt,getElementAtPath:()=>_m,getEnumValues:()=>ut,getLengthableOrigin:()=>er,getParsedType:()=>vm,getSizableOrigin:()=>Qt,hexToUint8Array:()=>Tm,hide:()=>tr,installLazyProp:()=>Mm,isObject:()=>Ve,isPlainObject:()=>ce,issue:()=>ft,joinValues:()=>qr,jsonStringifyReplacer:()=>ct,members:()=>_i,merge:()=>Im,mergeDefs:()=>fe,normalizeParams:()=>_,nullish:()=>Wr,numKeys:()=>bm,objectClone:()=>hm,omit:()=>zm,optionalKeys:()=>hi,own:()=>Pe,parsedType:()=>yi,partial:()=>Am,pick:()=>km,prefixIssues:()=>te,primitiveTypes:()=>mi,promiseAllObject:()=>$m,propertyKeyTypes:()=>Xt,randomString:()=>wm,rawShape:()=>lt,required:()=>Om,safeExtend:()=>Pm,shallowClone:()=>Wt,slugify:()=>pi,stringifyPrimitive:()=>Hr,toZod:()=>Gt,uint8ArrayToBase64:()=>Yl,uint8ArrayToBase64url:()=>Cm,uint8ArrayToHex:()=>Dm,unwrapMessage:()=>st});function lm(e){return e}s(lm,"assertEqual");function fm(e){return e}s(fm,"assertNotEqual");function Gt(){return e=>e}s(Gt,"toZod");function pm(e){}s(pm,"assertIs");function dm(e){throw new Error("Unexpected value in exhaustive check")}s(dm,"assertNever");function mm(e){}s(mm,"assert");function ut(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(ut,"getEnumValues");function qr(e,t="|"){return e.map(r=>Hr(r)).join(t)}s(qr,"joinValues");function ct(e,t){return typeof t=="bigint"?t.toString():t}s(ct,"jsonStringifyReplacer");var ai=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 at(e){return new ai(e)}s(at,"cached");function Wr(e){return e==null}s(Wr,"nullish");function be(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}s(be,"cleanRegex");function qt(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(qt,"floatSafeRemainder");var Gl=Symbol("evaluating");function fi(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Gl)return n===void 0&&(n=Gl,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}s(fi,"defineLazy");function hm(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}s(hm,"objectClone");function J(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}s(J,"assignProp");function lt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}s(lt,"rawShape");function we(e){return lt(e._zod.def)??e._zod.def.shape}s(we,"sourceShape");function ql(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return J(this,t,n),n},enumerable:!0,configurable:!0})}s(ql,"deferProp");function Wl(e,t,r){t in e?J(e,t,r):e[t]=r}s(Wl,"putProp");function je(e,t,r,n){let o=we(t);for(let i of r){let u=Object.getOwnPropertyDescriptor(o,i);u.enumerable&&(u.get?ql(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Wl(e,i,n?n(u.value,i):u.value))}}s(je,"mirrorShape");function gm(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?ql(e,r,()=>t[r]):Wl(e,r,n.value))}}s(gm,"mirrorProps");function fe(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}s(fe,"mergeDefs");function ym(e){return fe(e._zod.def)}s(ym,"cloneDef");function _m(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}s(_m,"getElementAtPath");function $m(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($m,"promiseAllObject");function wm(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}s(wm,"randomString");function X(e){return JSON.stringify(e)}s(X,"esc");function pi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}s(pi,"slugify");var Xr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ve(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ve,"isObject");var di=at(()=>{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(Ve(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ve(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}s(ce,"isPlainObject");function Wt(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}s(Wt,"shallowClone");function bm(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}s(bm,"numKeys");var vm=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"),Xt=new Set(["string","number","symbol"]),mi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(ae,"escapeRegex");function C(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}s(C,"clone");function _(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(_,"normalizeParams");function xm(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(xm,"createTransparentProxy");function Hr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}s(Hr,"stringifyPrimitive");function hi(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}s(hi,"optionalKeys");var Ht={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]},Yt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function km(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 je(i,e,Yr(e,t)),C(e,fe(r,{shape:i,checks:[]}))}s(km,"pick");function Yr(e,t){let r=we(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(Yr,"maskedKeys");function zm(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(Yr(e,t)),u={};return je(u,e,Reflect.ownKeys(we(e)).filter(c=>!i.has(c))),C(e,fe(r,{shape:u,checks:[]}))}s(zm,"omit");function Sm(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=we(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 C(e,fe(e._zod.def,{shape:Xl(e,t)}))}s(Sm,"extend");function Xl(e,t){let r={};return je(r,e,Reflect.ownKeys(we(e))),gm(r,t),r}s(Xl,"extended");function Pm(e,t){if(!ce(t))throw new Error("Invalid input to safeExtend: expected a plain object");return C(e,fe(e._zod.def,{shape:Xl(e,t)}))}s(Pm,"safeExtend");function Im(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={};je(r,e,Reflect.ownKeys(we(e))),je(r,t,Reflect.ownKeys(we(t)));let n=fe(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return C(e,n)}s(Im,"merge");function Am(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 c=r?new Set(Yr(t,r)):void 0,a={};return je(a,t,Reflect.ownKeys(we(t)),e&&((l,f)=>c&&!c.has(f)?l:new e({type:"optional",innerType:l}))),C(t,fe(t._zod.def,{shape:a,checks:[]}))}s(Am,"partial");function Om(e,t,r){let n=r?new Set(Yr(t,r)):void 0,o={};return je(o,t,Reflect.ownKeys(we(t)),(i,u)=>n&&!n.has(u)?i:new e({type:"nonoptional",innerType:i})),C(t,fe(t._zod.def,{shape:o}))}s(Om,"required");function H(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(H,"aborted");function gi(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(gi,"explicitlyAborted");function te(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}s(te,"prefixIssues");function st(e){return typeof e=="string"?e:e?.message}s(st,"unwrapMessage");function Qr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}s(Qr,"attachSchema");function re(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,u=e.message?e.message:st(e.inst?._zod.def?.error?.(e))??st(i?.(e))??st(t?.error?.(e))??st(r.customError?.(e))??st(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=u,t?.reportInput&&(c.input=e.input),c}s(re,"finalizeIssue");function Qt(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}s(Qt,"getSizableOrigin");var Zm=/[\uD800-\uDBFF]/;function Me(e){let t=e.length;if(!Zm.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(Me,"codePointLength");function er(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}s(er,"getLengthableOrigin");function yi(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(yi,"parsedType");function ft(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}s(ft,"issue");function Nm(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}s(Nm,"cleanEnum");function Hl(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(Hl,"base64ToUint8Array");function Yl(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}s(Yl,"uint8ArrayToBase64");function Em(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Hl(t+r)}s(Em,"base64urlToUint8Array");function Cm(e){return Yl(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s(Cm,"uint8ArrayToBase64url");function Tm(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(Tm,"hexToUint8Array");function Dm(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}s(Dm,"uint8ArrayToHex");var li=class{static{s(this,"Class")}constructor(...t){}};function _i(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Lm(e,r,n.value)}}s(_i,"members");function Pe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}s(Pe,"own");function tr(e,t,r){return Pe(e,t,r,!1)}s(tr,"hide");function Rm(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Pe(this,r,n(this))},set(o){Pe(this,r,o)}})}return t}s(Rm,"derived");function Lm(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Pe(this,t,r.bind(this))},set(n){Pe(this,t,n)}})}s(Lm,"defineBound");function jm(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}s(jm,"claim");var ci,Se=!1,Vm={configurable:!0,get(){Se=!0}};function O(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ci!==e._zod){ci=void 0;return}ci=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Vm);let o=Se;Se=!1;try{let i=r(this);return Se?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Se=Se||o,i}catch(i){throw delete this[t],Se=Se||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}s(O,"defineLazyInternal");function Mm(e,t,r,n){let o=jm(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(Mm,"installLazyProp");var en="~constantCatch";function $i(e){let t=s(()=>e,"fn");return t[en]=!0,t}s($i,"constantCatch");var Ql,bi=Object.freeze({status:"aborted"}),wi={value:void 0,enumerable:!1},ef="captureStackTrace"in Error?Error:null;function Fm(e){let t=ef;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return ef=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}s(Fm,"newError");function h(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 u=r,c=u&&new WeakSet;function a(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{wi.value=new i(m);try{Object.defineProperty(d,"_zod",wi)}finally{wi.value=void 0}}if(d._zod.traits.add(e),t(d,m),c){let y=Object.getPrototypeOf(d),$=d._zod.constr.prototype,z=y;for(;z&&z!==$;)z=Object.getPrototypeOf(z);let x=z??y;c.has(x)||(c.add(x),_i(x,u))}let g=p.prototype;for(let y in g)Object.prototype.hasOwnProperty.call(g,y)&&(y in d||(d[y]=g[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 m=n?.Parent?Fm(f):this;a(m,d);let g=m._zod.deferred;if(g){for(let $ of g)$();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;return y&&y(m),m}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(h,"$constructor");var vi=Symbol("zod_brand"),ne=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ie=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Ql=globalThis).__zod_globalConfig??(Ql.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(B,e),B}s(F,"config");function Km(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ct,2)),e.message}s(Km,"_getMessage");function Um(e){this._zod.message=e}s(Um,"_setMessage");var Bm={get:Km,set:Um,enumerable:!0,configurable:!0},ki={value:void 0,enumerable:!1},tf=new WeakSet([Object.prototype,Error.prototype]),rf=s((e,t)=>{e.name="$ZodError",ki.value=t,Object.defineProperty(e,"issues",ki),ki.value=void 0,Object.defineProperty(e,"message",Bm);let r=Object.getPrototypeOf(e);tf.has(r)||(tf.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"),zi=h("$ZodError",rf),oe=h("$ZodError",rf,void 0,{Parent:Error});function Jm(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(Jm,"node");function rr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Jm(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}s(rr,"flattenError");function nr(e,t=r=>r.message){let r={_errors:[]},n=s((o,i=[])=>{for(let u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(c=>n({issues:c},[...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 c=[...i,...u.path];if(c.length===0)r._errors.push(t(u));else{let a=r,l=0;for(;l<c.length;){let f=c[l],p=l===c.length-1;if(f==="_errors"){p&&a._errors.push(t(u)),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(u)),a=d,l++}}}},"processError");return n(e),r}s(nr,"formatError");function Si(e,t=r=>r.message){let r={errors:[]},n=s((o,i=[])=>{var u;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(a=>n({issues:a},[...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 a=[...i,...c.path];if(a.length===0){r.errors.push(t(c));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=[]),(u=l.items)[p]??(u[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(c)),f++}}},"processError");return n(e),r}s(Si,"treeifyError");function nf(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(nf,"toDotPath");function Pi(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 ${nf(n.path)}`);return t.join(`
|
|
8
|
-
`)}s(Pi,"prettifyError");function tn(e,t){return{callee:t?.callee??e,Err:t?.Err}}s(tn,"finalizeParams");var pt=s(e=>{let t=s((r,n,o,i)=>{let u=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},u);if(c instanceof Promise)throw new ne;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>re(l,u,F())));throw Xr(a,i?.callee??t),a}return c.value},"fn");return t},"_parse"),rn=pt(oe),dt=s(e=>{let t=s(async(r,n,o,i)=>{let u=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>re(l,u,F())));throw Xr(a,i?.callee??t),a}return c.value},"fn");return t},"_parseAsync"),nn=dt(oe),mt=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 ne;return i.issues.length?of(e,i.issues,o):{success:!0,data:i.value}},"_safeParse"),qm=mt(oe);function of(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>re(o,r,F()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}s(of,"failure");var ht=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?of(e,i.issues,o):{success:!0,data:i.value}},"_safeParseAsync"),Wm=ht(oe),Xm=Symbol.for("zod.compile.invalid"),Hm=Symbol.for("zod.compile.fallback"),or=s(((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Xm)return!0;if(n.definite===!0&&r===void 0)return!1}return Ym(e,t,r)}),"validate");function Ym(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Hm]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new ne;return i.issues.length===0}s(Ym,"validateFallback");var ir=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"),on=s(e=>{let t=pt(e),r=s((n,o,i,u)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,tn(r,u))},"fn");return r},"_encode"),Qm=on(oe),sn=s(e=>{let t=pt(e),r=s((n,o,i,u)=>t(n,o,i,tn(r,u)),"fn");return r},"_decode"),eh=sn(oe),un=s(e=>{let t=dt(e),r=s(async(n,o,i,u)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,tn(r,u))},"fn");return r},"_encodeAsync"),th=un(oe),cn=s(e=>{let t=dt(e),r=s(async(n,o,i,u)=>await t(n,o,i,tn(r,u)),"fn");return r},"_decodeAsync"),rh=cn(oe),an=s(e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return mt(e)(t,r,o)},"_safeEncode"),nh=an(oe),ln=s(e=>(t,r,n)=>mt(e)(t,r,n),"_safeDecode"),oh=ln(oe),fn=s(e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ht(e)(t,r,o)},"_safeEncodeAsync"),ih=fn(oe),pn=s(e=>async(t,r,n)=>ht(e)(t,r,n),"_safeDecodeAsync"),sh=pn(oe);var le={};$e(le,{anyString:()=>es,base64:()=>Bi,base64url:()=>Ji,bigint:()=>rs,boolean:()=>ns,browserEmail:()=>mh,cidrv4:()=>Ki,cidrv6:()=>Ui,creditCard:()=>dn,cuid:()=>Ai,cuid2:()=>Oi,currencyCode:()=>Xi,date:()=>Hi,datetime:()=>Qi,domain:()=>qi,duration:()=>Di,e164:()=>Wi,email:()=>Li,emoji:()=>ji,extendedDuration:()=>uh,guid:()=>Ri,hex:()=>cs,hostname:()=>Gi,html5Email:()=>fh,httpProtocol:()=>sr,iban:()=>mn,idnEmail:()=>dh,integer:()=>ur,ipv4:()=>Vi,ipv6:()=>Mi,ksuid:()=>Ei,lowercase:()=>ss,mac:()=>Fi,md5_base64:()=>_h,md5_base64url:()=>$h,md5_hex:()=>yh,nanoid:()=>Ci,nanoidOfLength:()=>Ti,null:()=>os,number:()=>ve,rfc5322Email:()=>ph,sha1_base64:()=>bh,sha1_base64url:()=>vh,sha1_hex:()=>wh,sha256_base64:()=>kh,sha256_base64url:()=>zh,sha256_hex:()=>xh,sha384_base64:()=>Ph,sha384_base64url:()=>Ih,sha384_hex:()=>Sh,sha512_base64:()=>Oh,sha512_base64url:()=>Zh,sha512_hex:()=>Ah,string:()=>ts,time:()=>Yi,ulid:()=>Zi,undefined:()=>is,unicodeEmail:()=>sf,uppercase:()=>us,uuid:()=>Fe,uuid4:()=>ch,uuid6:()=>ah,uuid7:()=>lh,xid:()=>Ni});var Ai=/^[cC][0-9a-z]{6,}$/,Oi=/^[0-9a-z]+$/,Zi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ni=/^[0-9a-vA-V]{20}$/,Ei=/^[A-Za-z0-9]{27}$/,Ci=/^[a-zA-Z0-9_-]{21}$/;function Ti(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}s(Ti,"nanoidOfLength");var Di=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uh=/^[-+]?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)?)??$/,Ri=/^([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})$/,Fe=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"),ch=Fe(4),ah=Fe(6),lh=Fe(7),Li=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fh=/^[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])?)*$/,ph=/^(([^<>()\[\]\\.,;:\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,}))$/,sf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,dh=sf,mh=/^[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])?)*$/,hh="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function ji(){return new RegExp(hh,"u")}s(ji,"emoji");var Vi=/^(?:(?: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])$/,Mi=/^(([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}|:))$/,Fi=s(e=>{let t=ae(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"),Ki=/^((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])$/,Ui=/^(([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])$/,Bi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ji=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Gi=/^(?=.{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])?)*\.?$/,qi=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,sr=/^https?$/,Wi=/^\+[1-9]\d{6,14}$/,dn=/^\d(?:[ -]?\d){11,18}$/,Xi=/^(?: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)$/,mn=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,uf="(?:(?:\\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 gh(e){return new RegExp(`^${e}$`)}s(gh,"anchor");var Hi=gh(uf);function Ii(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(Ii,"timeSource");function Yi(e){return new RegExp(`^${Ii(e)}$`)}s(Yi,"time");function Qi(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ii({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ii({precision:e.precision})}`:r;return new RegExp(`^${uf}T(?:${n})$`)}s(Qi,"datetime");var es=/^[\s\S]{0,}$/,ts=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),rs=/^-?\d+n?$/,ur=/^-?\d+$/,ve=/^-?\d+(?:\.\d+)?$/,ns=/^(?:true|false)$/i,os=/^null$/i;var is=/^undefined$/i;var ss=/^[^A-Z]*$/,us=/^[^a-z]*$/,cs=/^[0-9a-fA-F]*$/;function cr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}s(cr,"fixedBase64");function ar(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}s(ar,"fixedBase64url");var yh=/^[0-9a-fA-F]{32}$/,_h=cr(22,"=="),$h=ar(22),wh=/^[0-9a-fA-F]{40}$/,bh=cr(27,"="),vh=ar(27),xh=/^[0-9a-fA-F]{64}$/,kh=cr(43,"="),zh=ar(43),Sh=/^[0-9a-fA-F]{96}$/,Ph=cr(64,""),Ih=ar(64),Ah=/^[0-9a-fA-F]{128}$/,Oh=cr(86,"=="),Zh=ar(86);var L=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),as=s(e=>{let t=e.value;return!Wr(t)&&t.size!==void 0},"_whenHasSize"),ls=s(e=>{let t=e.value;return!Wr(t)&&t.length!==void 0},"_whenHasLength"),hn={number:"number",bigint:"bigint",object:"date"},yn=h("$ZodCheckLessThan",(e,t)=>{L.init(e,t);let r=hn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:hn[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})}}),_n=h("$ZodCheckGreaterThan",(e,t)=>{L.init(e,t);let r=hn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:hn[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})}}),fs=h("$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):qt(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})}}),ps=h("$ZodCheckNumberFormat",(e,t)=>{L.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ht[t.format];e._zod.check=u=>{let c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):u.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ds=h("$ZodCheckBigIntFormat",(e,t)=>{L.init(e,t);let[r,n]=Yt[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})}}),ms=h("$ZodCheckMaxSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Qt(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hs=h("$ZodCheckMinSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Qt(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gs=h("$ZodCheckSizeEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let u=i>t.size;n.issues.push({origin:Qt(o),...u?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ys=h("$ZodCheckMaxLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Me(o):i)<=t.maximum)return;let c=er(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_s=h("$ZodCheckMinLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Me(o):i)>=t.minimum)return;let c=er(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$s=h("$ZodCheckLengthEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length,u=typeof o=="string"&&i>=t.length&&i<=t.length*2?Me(o):i;if(u===t.length)return;let c=er(o),a=u>t.length;n.issues.push({origin:c,...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})}}),gt=h("$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=()=>{})}),ws=h("$ZodCheckRegex",(e,t)=>{gt.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})}}),bs=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ss),gt.init(e,t)}),vs=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=us),gt.init(e,t)}),xs=h("$ZodCheckIncludes",(e,t)=>{L.init(e,t);let r=ae(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})}}),ks=h("$ZodCheckStartsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`^${ae(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})}}),zs=h("$ZodCheckEndsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`.*${ae(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 gn(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues))}s(gn,"handleCheckPropertyResult");var Ss=h("$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=>gn(o,r,t.property));gn(n,r,t.property)}}),Ps=h("$ZodCheckProperties",(e,t)=>{L.init(e,t),tr(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(u=>[u,t.shape[u]]));let o=n.value,i;for(let[u,c]of r){let a=c._zod.run({value:o[u],issues:[]},{});a instanceof Promise?(i??(i=[]),i.push(a.then(l=>gn(l,n,u)))):gn(a,n,u)}if(i)return Promise.all(i).then(()=>{})}}),Is=h("$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})}}),As=h("$ZodCheckOverwrite",(e,t)=>{L.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ke=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(`
|
|
7
|
+
var Jl=Object.defineProperty;var s=(e,t)=>Jl(e,"name",{value:t,configurable:!0});var _e=(e,t)=>{for(var r in t)Jl(e,r,{get:t[r],enumerable:!0})};import{defineRpcContract as Yy}from"@get-bb/plugin-sdk";var b={};_e(b,{$brand:()=>vi,$input:()=>Gu,$output:()=>Ju,INVALID:()=>Y,NEVER:()=>bi,TimePrecision:()=>oc,ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Bo,ZodBase64URL:()=>Jo,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Wo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Ko,ZodCIDRv6:()=>Uo,ZodCUID:()=>Do,ZodCUID2:()=>Ro,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCompileAsyncError:()=>pe,ZodCompileUnsupportedError:()=>Z,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>rt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>Go,ZodEmail:()=>No,ZodEmoji:()=>Co,ZodEnum:()=>Rt,ZodError:()=>$y,ZodExactOptional:()=>Qo,ZodFile:()=>sl,ZodFirstPartyTypeKind:()=>Ol,ZodFunction:()=>Sl,ZodGUID:()=>Eo,ZodIBAN:()=>La,ZodIPv4:()=>Mo,ZodIPv6:()=>Fo,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodIssueCode:()=>vy,ZodJWT:()=>qo,ZodKSUID:()=>Vo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>To,ZodNever:()=>Ga,ZodNonOptional:()=>ei,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>nt,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRealError:()=>ie,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>Lo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>jo,ZodXor:()=>Xa,_ZodString:()=>Zo,_default:()=>fl,_function:()=>yd,any:()=>qp,array:()=>Tr,base64:()=>Ip,base64url:()=>Ap,bigint:()=>Kp,boolean:()=>Va,catch:()=>yl,check:()=>_d,cidrv4:()=>Sp,cidrv6:()=>Pp,clone:()=>C,codec:()=>dd,coerce:()=>Nl,compile:()=>Hu,config:()=>M,core:()=>xe,creditCard:()=>Zp,cuid:()=>_p,cuid2:()=>$p,currencyCode:()=>Rp,custom:()=>$d,date:()=>Xp,decode:()=>Aa,decodeAsync:()=>Za,deepPartial:()=>Nd,describe:()=>wd,discriminatedUnion:()=>rd,e164:()=>Op,email:()=>cp,emoji:()=>gp,encode:()=>Ia,encodeAsync:()=>Oa,endsWith:()=>zt,enum:()=>Ho,exactOptional:()=>cl,file:()=>ad,flattenError:()=>rr,float32:()=>jp,float64:()=>Vp,formatError:()=>nr,fromJSONSchema:()=>Od,function:()=>yd,getDiscriminatedOption:()=>wu,getErrorMap:()=>ky,globalRegistry:()=>G,gt:()=>he,gte:()=>ue,guid:()=>ap,hash:()=>Lp,hex:()=>Dp,hostname:()=>Tp,httpUrl:()=>hp,iban:()=>Np,includes:()=>xt,input:()=>Cd,instanceof:()=>vd,int:()=>Ao,int32:()=>Mp,int64:()=>Up,intersection:()=>Qa,invertCodec:()=>md,ipv4:()=>xp,ipv6:()=>zp,iso:()=>Fr,json:()=>kd,jwt:()=>Ep,keyof:()=>Hp,ksuid:()=>vp,lazy:()=>kl,length:()=>He,literal:()=>cd,locales:()=>xr,looseObject:()=>ed,looseRecord:()=>od,lowercase:()=>bt,lt:()=>me,lte:()=>se,mac:()=>kp,map:()=>id,maxLength:()=>Xe,maxSize:()=>Oe,memoizer:()=>br,meta:()=>bd,mime:()=>Pt,minLength:()=>ve,minSize:()=>ge,multipleOf:()=>Ae,nan:()=>pd,nanoid:()=>yp,nativeEnum:()=>ud,negative:()=>_o,never:()=>Xo,nonnegative:()=>wo,nonoptional:()=>ml,nonpositive:()=>$o,normalize:()=>It,null:()=>Ua,nullable:()=>Nr,nullish:()=>ld,number:()=>ja,object:()=>Yp,optional:()=>et,output:()=>Td,overwrite:()=>de,parse:()=>ka,parseAsync:()=>za,partialRecord:()=>nd,pipe:()=>Oo,positive:()=>yo,prefault:()=>dl,preprocess:()=>zd,prettifyError:()=>Pi,promise:()=>gd,properties:()=>St,property:()=>bo,readonly:()=>bl,record:()=>rl,refine:()=>Pl,regex:()=>wt,regexes:()=>le,registry:()=>Bn,safeDecode:()=>Ea,safeDecodeAsync:()=>Ta,safeEncode:()=>Na,safeEncodeAsync:()=>Ca,safeParse:()=>Sa,safeParseAsync:()=>Pa,set:()=>sd,setErrorMap:()=>xy,size:()=>We,slugify:()=>Nt,startsWith:()=>kt,strictObject:()=>Qp,string:()=>Zr,stringFormat:()=>Cp,stringbool:()=>xd,success:()=>fd,superRefine:()=>Il,symbol:()=>Jp,templateLiteral:()=>hd,toJSONSchema:()=>zo,toLowerCase:()=>Ot,toUpperCase:()=>Zt,toZod:()=>Gt,transform:()=>Yo,treeifyError:()=>Si,trim:()=>At,tuple:()=>tl,uint32:()=>Fp,uint64:()=>Bp,ulid:()=>wp,undefined:()=>Gp,union:()=>Ft,unknown:()=>Qe,uppercase:()=>vt,url:()=>mp,util:()=>v,uuid:()=>lp,uuidv4:()=>fp,uuidv6:()=>pp,uuidv7:()=>dp,validate:()=>or,validateAsync:()=>ir,void:()=>Wp,withParser:()=>Jn,xid:()=>bp,xor:()=>td});var xe={};_e(xe,{$ZodAny:()=>pu,$ZodArray:()=>yu,$ZodAsyncError:()=>ne,$ZodBase64:()=>eu,$ZodBase64URL:()=>tu,$ZodBigInt:()=>Cn,$ZodBigIntFormat:()=>cu,$ZodBoolean:()=>hr,$ZodCIDRv4:()=>Ys,$ZodCIDRv6:()=>Qs,$ZodCUID:()=>Vs,$ZodCUID2:()=>Ms,$ZodCatch:()=>Du,$ZodCheck:()=>L,$ZodCheckBigIntFormat:()=>ds,$ZodCheckEndsWith:()=>zs,$ZodCheckGreaterThan:()=>_n,$ZodCheckIncludes:()=>xs,$ZodCheckLengthEquals:()=>$s,$ZodCheckLessThan:()=>yn,$ZodCheckLowerCase:()=>bs,$ZodCheckMaxLength:()=>ys,$ZodCheckMaxSize:()=>ms,$ZodCheckMimeType:()=>Is,$ZodCheckMinLength:()=>_s,$ZodCheckMinSize:()=>hs,$ZodCheckMultipleOf:()=>fs,$ZodCheckNumberFormat:()=>ps,$ZodCheckOverwrite:()=>As,$ZodCheckProperties:()=>Ps,$ZodCheckProperty:()=>Ss,$ZodCheckRegex:()=>ws,$ZodCheckSizeEquals:()=>gs,$ZodCheckStartsWith:()=>ks,$ZodCheckStringFormat:()=>gt,$ZodCheckUpperCase:()=>vs,$ZodCodec:()=>yr,$ZodCreditCard:()=>nu,$ZodCustom:()=>Ku,$ZodCustomStringFormat:()=>su,$ZodCyclicError:()=>Mn,$ZodDate:()=>gu,$ZodDefault:()=>Nu,$ZodDiscriminatedUnion:()=>bu,$ZodE164:()=>ru,$ZodEmail:()=>Cs,$ZodEmoji:()=>Ls,$ZodEncodeError:()=>Ie,$ZodEnum:()=>Su,$ZodError:()=>zi,$ZodExactOptional:()=>Ou,$ZodFile:()=>Iu,$ZodFunction:()=>Mu,$ZodGUID:()=>Ns,$ZodIBAN:()=>ou,$ZodIPv4:()=>Ws,$ZodIPv6:()=>Xs,$ZodISODate:()=>Js,$ZodISODateTime:()=>Bs,$ZodISODuration:()=>qs,$ZodISOTime:()=>Gs,$ZodIntersection:()=>vu,$ZodJWT:()=>iu,$ZodKSUID:()=>Us,$ZodLazy:()=>_r,$ZodLiteral:()=>Pu,$ZodMAC:()=>Hs,$ZodMap:()=>ku,$ZodNaN:()=>Ru,$ZodNanoID:()=>js,$ZodNever:()=>mu,$ZodNonOptional:()=>Cu,$ZodNull:()=>fu,$ZodNullable:()=>Zu,$ZodNumber:()=>En,$ZodNumberFormat:()=>uu,$ZodObject:()=>If,$ZodObjectJIT:()=>_u,$ZodOptional:()=>Dn,$ZodPipe:()=>Rn,$ZodPrefault:()=>Eu,$ZodPreprocess:()=>Lu,$ZodPromise:()=>Fu,$ZodReadonly:()=>ju,$ZodRealError:()=>oe,$ZodRecord:()=>xu,$ZodRegistry:()=>Un,$ZodSet:()=>zu,$ZodString:()=>Ue,$ZodStringFormat:()=>T,$ZodSuccess:()=>Tu,$ZodSymbol:()=>au,$ZodTemplateLiteral:()=>Vu,$ZodTransform:()=>Au,$ZodTuple:()=>Tn,$ZodType:()=>P,$ZodULID:()=>Fs,$ZodURL:()=>Rs,$ZodUUID:()=>Es,$ZodUndefined:()=>lu,$ZodUnion:()=>gr,$ZodUnknown:()=>du,$ZodVoid:()=>hu,$ZodXID:()=>Ks,$ZodXor:()=>$u,$brand:()=>vi,$constructor:()=>h,$input:()=>Gu,$output:()=>Ju,Doc:()=>Ke,INVALID:()=>Y,JSONSchema:()=>ip,JSONSchemaGenerator:()=>So,NEVER:()=>bi,TimePrecision:()=>oc,URL_BAD_FORMAT:()=>Ts,URL_UNPARSEABLE:()=>lr,ZodCompileAsyncError:()=>pe,ZodCompileUnsupportedError:()=>Z,_any:()=>bc,_array:()=>Ic,_base64:()=>po,_base64url:()=>mo,_bigint:()=>mc,_boolean:()=>pc,_catch:()=>uy,_check:()=>Kf,_cidrv4:()=>lo,_cidrv6:()=>fo,_coercedBigint:()=>hc,_coercedBoolean:()=>dc,_coercedDate:()=>Sc,_coercedNumber:()=>sc,_coercedString:()=>ec,_creditCard:()=>rc,_cuid:()=>no,_cuid2:()=>oo,_custom:()=>Oc,_date:()=>zc,_decode:()=>sn,_decodeAsync:()=>cn,_default:()=>oy,_discriminatedUnion:()=>Jg,_e164:()=>ho,_email:()=>Wn,_emoji:()=>to,_encode:()=>on,_encodeAsync:()=>un,_endsWith:()=>zt,_enum:()=>Yg,_file:()=>Ac,_float32:()=>cc,_float64:()=>ac,_gt:()=>he,_gte:()=>ue,_guid:()=>Xn,_iban:()=>nc,_includes:()=>xt,_int:()=>uc,_int32:()=>lc,_int64:()=>gc,_intersection:()=>Gg,_ipv4:()=>co,_ipv6:()=>ao,_isoDate:()=>Sr,_isoDateTime:()=>zr,_isoDuration:()=>Ir,_isoTime:()=>Pr,_jwt:()=>go,_ksuid:()=>uo,_lazy:()=>fy,_length:()=>He,_literal:()=>ey,_lowercase:()=>bt,_lt:()=>me,_lte:()=>se,_mac:()=>tc,_map:()=>Xg,_max:()=>se,_maxLength:()=>Xe,_maxSize:()=>Oe,_mime:()=>Pt,_min:()=>ue,_minLength:()=>ve,_minSize:()=>ge,_multipleOf:()=>Ae,_nan:()=>Pc,_nanoid:()=>ro,_nativeEnum:()=>Qg,_negative:()=>_o,_never:()=>xc,_nonnegative:()=>wo,_nonoptional:()=>iy,_nonpositive:()=>$o,_normalize:()=>It,_null:()=>wc,_nullable:()=>ny,_number:()=>ic,_optional:()=>ry,_overwrite:()=>de,_parse:()=>pt,_parseAsync:()=>dt,_pipe:()=>cy,_positive:()=>yo,_promise:()=>py,_properties:()=>St,_property:()=>bo,_readonly:()=>ay,_record:()=>Wg,_refine:()=>Zc,_regex:()=>wt,_safeDecode:()=>ln,_safeDecodeAsync:()=>pn,_safeEncode:()=>an,_safeEncodeAsync:()=>fn,_safeParse:()=>mt,_safeParseAsync:()=>ht,_set:()=>Hg,_size:()=>We,_slugify:()=>Nt,_startsWith:()=>kt,_string:()=>Qu,_stringFormat:()=>Ye,_stringbool:()=>Tc,_success:()=>sy,_superRefine:()=>Nc,_symbol:()=>_c,_templateLiteral:()=>ly,_toLowerCase:()=>Ot,_toUpperCase:()=>Zt,_transform:()=>ty,_trim:()=>At,_tuple:()=>qg,_uint32:()=>fc,_uint64:()=>yc,_ulid:()=>io,_undefined:()=>$c,_union:()=>Ug,_unknown:()=>vc,_uppercase:()=>vt,_url:()=>kr,_uuid:()=>Hn,_uuidv4:()=>Yn,_uuidv6:()=>Qn,_uuidv7:()=>eo,_void:()=>kc,_xid:()=>so,_xor:()=>Bg,base64Charset:()=>In,base64urlCharset:()=>mr,canParseURL:()=>Ds,clone:()=>C,compile:()=>Hu,compileFn:()=>Gn,config:()=>M,createStandardJSONSchemaMethod:()=>Et,createToJSONSchemaMethod:()=>Rc,decode:()=>eh,decodeAsync:()=>rh,describe:()=>Ec,encode:()=>Qm,encodeAsync:()=>th,extractDefs:()=>Ne,finalize:()=>Ee,flattenError:()=>rr,formatError:()=>nr,getDiscriminatedOption:()=>wu,globalConfig:()=>B,globalRegistry:()=>G,handleUnrepresentable:()=>K,initializeContext:()=>Ze,isBackEdge:()=>Kn,isRecursiveSchema:()=>Fn,isValidBase64:()=>dr,isValidBase64URL:()=>An,isValidCIDRv6:()=>Pn,isValidCreditCard:()=>On,isValidIBAN:()=>Zn,isValidIPv6:()=>pr,isValidJWT:()=>Nn,locales:()=>xr,memoizer:()=>br,mergeValues:()=>yt,meta:()=>Cc,parse:()=>rn,parseAsync:()=>nn,parseURLObject:()=>zf,prettifyError:()=>Pi,process:()=>D,processSchema:()=>D,regexes:()=>le,registry:()=>Bn,safeDecode:()=>oh,safeDecodeAsync:()=>sh,safeEncode:()=>nh,safeEncodeAsync:()=>ih,safeParse:()=>qm,safeParseAsync:()=>Wm,standardProps:()=>xn,stripTabAndNewline:()=>fr,toDotPath:()=>nf,toJSONSchema:()=>zo,toZod:()=>Gt,treeifyError:()=>Si,urlHostnameOk:()=>zn,urlProtocolOk:()=>Sn,util:()=>v,validate:()=>or,validateAsync:()=>ir,validateURL:()=>kn,version:()=>Os,withParser:()=>Jn});var v={};_e(v,{BIGINT_FORMAT_RANGES:()=>Yt,CONSTANT_CATCH:()=>en,Class:()=>li,NUMBER_FORMAT_RANGES:()=>Ht,aborted:()=>H,allowsEval:()=>di,assert:()=>mm,assertEqual:()=>lm,assertIs:()=>pm,assertNever:()=>dm,assertNotEqual:()=>fm,assignProp:()=>J,attachSchema:()=>Qr,base64ToUint8Array:()=>Hl,base64urlToUint8Array:()=>Em,cached:()=>at,captureStackTrace:()=>Xr,cleanEnum:()=>Nm,cleanRegex:()=>we,clone:()=>C,cloneDef:()=>ym,codePointLength:()=>Me,constantCatch:()=>$i,createTransparentProxy:()=>xm,defineLazy:()=>fi,defineLazyInternal:()=>O,derived:()=>Rm,esc:()=>X,escapeRegex:()=>ae,explicitlyAborted:()=>gi,extend:()=>Sm,finalizeIssue:()=>re,floatSafeRemainder:()=>qt,getElementAtPath:()=>_m,getEnumValues:()=>ut,getLengthableOrigin:()=>er,getParsedType:()=>vm,getSizableOrigin:()=>Qt,hexToUint8Array:()=>Tm,hide:()=>tr,installLazyProp:()=>Mm,isObject:()=>Ve,isPlainObject:()=>ce,issue:()=>ft,joinValues:()=>qr,jsonStringifyReplacer:()=>ct,members:()=>_i,merge:()=>Im,mergeDefs:()=>fe,normalizeParams:()=>_,nullish:()=>Wr,numKeys:()=>bm,objectClone:()=>hm,omit:()=>zm,optionalKeys:()=>hi,own:()=>Pe,parsedType:()=>yi,partial:()=>Am,pick:()=>km,prefixIssues:()=>te,primitiveTypes:()=>mi,promiseAllObject:()=>$m,propertyKeyTypes:()=>Xt,randomString:()=>wm,rawShape:()=>lt,required:()=>Om,safeExtend:()=>Pm,shallowClone:()=>Wt,slugify:()=>pi,stringifyPrimitive:()=>Hr,toZod:()=>Gt,uint8ArrayToBase64:()=>Yl,uint8ArrayToBase64url:()=>Cm,uint8ArrayToHex:()=>Dm,unwrapMessage:()=>st});function lm(e){return e}s(lm,"assertEqual");function fm(e){return e}s(fm,"assertNotEqual");function Gt(){return e=>e}s(Gt,"toZod");function pm(e){}s(pm,"assertIs");function dm(e){throw new Error("Unexpected value in exhaustive check")}s(dm,"assertNever");function mm(e){}s(mm,"assert");function ut(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(ut,"getEnumValues");function qr(e,t="|"){return e.map(r=>Hr(r)).join(t)}s(qr,"joinValues");function ct(e,t){return typeof t=="bigint"?t.toString():t}s(ct,"jsonStringifyReplacer");var ai=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 at(e){return new ai(e)}s(at,"cached");function Wr(e){return e==null}s(Wr,"nullish");function we(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}s(we,"cleanRegex");function qt(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(qt,"floatSafeRemainder");var Gl=Symbol("evaluating");function fi(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Gl)return n===void 0&&(n=Gl,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}s(fi,"defineLazy");function hm(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}s(hm,"objectClone");function J(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}s(J,"assignProp");function lt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}s(lt,"rawShape");function $e(e){return lt(e._zod.def)??e._zod.def.shape}s($e,"sourceShape");function ql(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return J(this,t,n),n},enumerable:!0,configurable:!0})}s(ql,"deferProp");function Wl(e,t,r){t in e?J(e,t,r):e[t]=r}s(Wl,"putProp");function je(e,t,r,n){let o=$e(t);for(let i of r){let u=Object.getOwnPropertyDescriptor(o,i);u.enumerable&&(u.get?ql(e,i,()=>{let c=t._zod.def.shape[i];return n?n(c,i):c}):Wl(e,i,n?n(u.value,i):u.value))}}s(je,"mirrorShape");function gm(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?ql(e,r,()=>t[r]):Wl(e,r,n.value))}}s(gm,"mirrorProps");function fe(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}s(fe,"mergeDefs");function ym(e){return fe(e._zod.def)}s(ym,"cloneDef");function _m(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}s(_m,"getElementAtPath");function $m(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($m,"promiseAllObject");function wm(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}s(wm,"randomString");function X(e){return JSON.stringify(e)}s(X,"esc");function pi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}s(pi,"slugify");var Xr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ve(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}s(Ve,"isObject");var di=at(()=>{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(Ve(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Ve(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}s(ce,"isPlainObject");function Wt(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}s(Wt,"shallowClone");function bm(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}s(bm,"numKeys");var vm=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"),Xt=new Set(["string","number","symbol"]),mi=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ae(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}s(ae,"escapeRegex");function C(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}s(C,"clone");function _(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(_,"normalizeParams");function xm(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(xm,"createTransparentProxy");function Hr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}s(Hr,"stringifyPrimitive");function hi(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}s(hi,"optionalKeys");var Ht={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]},Yt={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function km(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 je(i,e,Yr(e,t)),C(e,fe(r,{shape:i,checks:[]}))}s(km,"pick");function Yr(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(Yr,"maskedKeys");function zm(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(Yr(e,t)),u={};return je(u,e,Reflect.ownKeys($e(e)).filter(c=>!i.has(c))),C(e,fe(r,{shape:u,checks:[]}))}s(zm,"omit");function Sm(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 C(e,fe(e._zod.def,{shape:Xl(e,t)}))}s(Sm,"extend");function Xl(e,t){let r={};return je(r,e,Reflect.ownKeys($e(e))),gm(r,t),r}s(Xl,"extended");function Pm(e,t){if(!ce(t))throw new Error("Invalid input to safeExtend: expected a plain object");return C(e,fe(e._zod.def,{shape:Xl(e,t)}))}s(Pm,"safeExtend");function Im(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={};je(r,e,Reflect.ownKeys($e(e))),je(r,t,Reflect.ownKeys($e(t)));let n=fe(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return C(e,n)}s(Im,"merge");function Am(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 c=r?new Set(Yr(t,r)):void 0,a={};return je(a,t,Reflect.ownKeys($e(t)),e&&((l,f)=>c&&!c.has(f)?l:new e({type:"optional",innerType:l}))),C(t,fe(t._zod.def,{shape:a,checks:[]}))}s(Am,"partial");function Om(e,t,r){let n=r?new Set(Yr(t,r)):void 0,o={};return je(o,t,Reflect.ownKeys($e(t)),(i,u)=>n&&!n.has(u)?i:new e({type:"nonoptional",innerType:i})),C(t,fe(t._zod.def,{shape:o}))}s(Om,"required");function H(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(H,"aborted");function gi(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(gi,"explicitlyAborted");function te(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}s(te,"prefixIssues");function st(e){return typeof e=="string"?e:e?.message}s(st,"unwrapMessage");function Qr(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}s(Qr,"attachSchema");function re(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,u=e.message?e.message:st(e.inst?._zod.def?.error?.(e))??st(i?.(e))??st(t?.error?.(e))??st(r.customError?.(e))??st(r.localeError?.(e))??"Invalid input",c={};for(let a of Object.keys(e))a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__"||(c[a]=e[a]);return c.path??(c.path=[]),c.message=u,t?.reportInput&&(c.input=e.input),c}s(re,"finalizeIssue");function Qt(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}s(Qt,"getSizableOrigin");var Zm=/[\uD800-\uDBFF]/;function Me(e){let t=e.length;if(!Zm.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(Me,"codePointLength");function er(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}s(er,"getLengthableOrigin");function yi(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(yi,"parsedType");function ft(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}s(ft,"issue");function Nm(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}s(Nm,"cleanEnum");function Hl(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(Hl,"base64ToUint8Array");function Yl(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}s(Yl,"uint8ArrayToBase64");function Em(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Hl(t+r)}s(Em,"base64urlToUint8Array");function Cm(e){return Yl(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}s(Cm,"uint8ArrayToBase64url");function Tm(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(Tm,"hexToUint8Array");function Dm(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}s(Dm,"uint8ArrayToHex");var li=class{static{s(this,"Class")}constructor(...t){}};function _i(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Lm(e,r,n.value)}}s(_i,"members");function Pe(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}s(Pe,"own");function tr(e,t,r){return Pe(e,t,r,!1)}s(tr,"hide");function Rm(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return Pe(this,r,n(this))},set(o){Pe(this,r,o)}})}return t}s(Rm,"derived");function Lm(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:Pe(this,t,r.bind(this))},set(n){Pe(this,t,n)}})}s(Lm,"defineBound");function jm(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}s(jm,"claim");var ci,Se=!1,Vm={configurable:!0,get(){Se=!0}};function O(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&ci!==e._zod){ci=void 0;return}ci=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Vm);let o=Se;Se=!1;try{let i=r(this);return Se?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Se=Se||o,i}catch(i){throw delete this[t],Se=Se||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}s(O,"defineLazyInternal");function Mm(e,t,r,n){let o=jm(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(Mm,"installLazyProp");var en="~constantCatch";function $i(e){let t=s(()=>e,"fn");return t[en]=!0,t}s($i,"constantCatch");var Ql,bi=Object.freeze({status:"aborted"}),wi={value:void 0,enumerable:!1},ef="captureStackTrace"in Error?Error:null;function Fm(e){let t=ef;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return ef=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}s(Fm,"newError");function h(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 u=r,c=u&&new WeakSet;function a(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{wi.value=new i(m);try{Object.defineProperty(d,"_zod",wi)}finally{wi.value=void 0}}if(d._zod.traits.add(e),t(d,m),c){let y=Object.getPrototypeOf(d),$=d._zod.constr.prototype,z=y;for(;z&&z!==$;)z=Object.getPrototypeOf(z);let x=z??y;c.has(x)||(c.add(x),_i(x,u))}let g=p.prototype;for(let y in g)Object.prototype.hasOwnProperty.call(g,y)&&(y in d||(d[y]=g[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 m=n?.Parent?Fm(f):this;a(m,d);let g=m._zod.deferred;if(g){for(let $ of g)$();m._zod.deferred=void 0}let y=globalThis.__zod_globalConfig?.postProcessor;return y&&y(m),m}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(h,"$constructor");var vi=Symbol("zod_brand"),ne=class extends Error{static{s(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Ie=class extends Error{static{s(this,"$ZodEncodeError")}constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Ql=globalThis).__zod_globalConfig??(Ql.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function M(e){return e&&Object.assign(B,e),B}s(M,"config");function Km(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ct,2)),e.message}s(Km,"_getMessage");function Um(e){this._zod.message=e}s(Um,"_setMessage");var Bm={get:Km,set:Um,enumerable:!0,configurable:!0},ki={value:void 0,enumerable:!1},tf=new WeakSet([Object.prototype,Error.prototype]),rf=s((e,t)=>{e.name="$ZodError",ki.value=t,Object.defineProperty(e,"issues",ki),ki.value=void 0,Object.defineProperty(e,"message",Bm);let r=Object.getPrototypeOf(e);tf.has(r)||(tf.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"),zi=h("$ZodError",rf),oe=h("$ZodError",rf,void 0,{Parent:Error});function Jm(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(Jm,"node");function rr(e,t=r=>r.message){let r={},n=[];for(let o of e.issues)o.path.length>0?Jm(r,o.path[0],()=>[]).push(t(o)):n.push(t(o));return{formErrors:n,fieldErrors:r}}s(rr,"flattenError");function nr(e,t=r=>r.message){let r={_errors:[]},n=s((o,i=[])=>{for(let u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(c=>n({issues:c},[...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 c=[...i,...u.path];if(c.length===0)r._errors.push(t(u));else{let a=r,l=0;for(;l<c.length;){let f=c[l],p=l===c.length-1;if(f==="_errors"){p&&a._errors.push(t(u)),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(u)),a=d,l++}}}},"processError");return n(e),r}s(nr,"formatError");function Si(e,t=r=>r.message){let r={errors:[]},n=s((o,i=[])=>{var u;for(let c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(a=>n({issues:a},[...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 a=[...i,...c.path];if(a.length===0){r.errors.push(t(c));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=[]),(u=l.items)[p]??(u[p]={errors:[]}),l=l.items[p]),d&&l.errors.push(t(c)),f++}}},"processError");return n(e),r}s(Si,"treeifyError");function nf(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(nf,"toDotPath");function Pi(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 ${nf(n.path)}`);return t.join(`
|
|
8
|
+
`)}s(Pi,"prettifyError");function tn(e,t){return{callee:t?.callee??e,Err:t?.Err}}s(tn,"finalizeParams");var pt=s(e=>{let t=s((r,n,o,i)=>{let u=o?{...o,async:!1}:{async:!1},c=r._zod.run({value:n,issues:[]},u);if(c instanceof Promise)throw new ne;if(c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>re(l,u,M())));throw Xr(a,i?.callee??t),a}return c.value},"fn");return t},"_parse"),rn=pt(oe),dt=s(e=>{let t=s(async(r,n,o,i)=>{let u=o?{...o,async:!0}:{async:!0},c=r._zod.run({value:n,issues:[]},u);if(c instanceof Promise&&(c=await c),c.issues.length){let a=new(i?.Err??e)(c.issues.map(l=>re(l,u,M())));throw Xr(a,i?.callee??t),a}return c.value},"fn");return t},"_parseAsync"),nn=dt(oe),mt=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 ne;return i.issues.length?of(e,i.issues,o):{success:!0,data:i.value}},"_safeParse"),qm=mt(oe);function of(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>re(o,r,M()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}s(of,"failure");var ht=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?of(e,i.issues,o):{success:!0,data:i.value}},"_safeParseAsync"),Wm=ht(oe),Xm=Symbol.for("zod.compile.invalid"),Hm=Symbol.for("zod.compile.fallback"),or=s(((e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Xm)return!0;if(n.definite===!0&&r===void 0)return!1}return Ym(e,t,r)}),"validate");function Ym(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(n[Hm]=!0,i=o({value:t,issues:[]},n)):i=e._zod.run({value:t,issues:[]},n),i instanceof Promise)throw new ne;return i.issues.length===0}s(Ym,"validateFallback");var ir=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"),on=s(e=>{let t=pt(e),r=s((n,o,i,u)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,c,tn(r,u))},"fn");return r},"_encode"),Qm=on(oe),sn=s(e=>{let t=pt(e),r=s((n,o,i,u)=>t(n,o,i,tn(r,u)),"fn");return r},"_decode"),eh=sn(oe),un=s(e=>{let t=dt(e),r=s(async(n,o,i,u)=>{let c=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,c,tn(r,u))},"fn");return r},"_encodeAsync"),th=un(oe),cn=s(e=>{let t=dt(e),r=s(async(n,o,i,u)=>await t(n,o,i,tn(r,u)),"fn");return r},"_decodeAsync"),rh=cn(oe),an=s(e=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return mt(e)(t,r,o)},"_safeEncode"),nh=an(oe),ln=s(e=>(t,r,n)=>mt(e)(t,r,n),"_safeDecode"),oh=ln(oe),fn=s(e=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return ht(e)(t,r,o)},"_safeEncodeAsync"),ih=fn(oe),pn=s(e=>async(t,r,n)=>ht(e)(t,r,n),"_safeDecodeAsync"),sh=pn(oe);var le={};_e(le,{anyString:()=>es,base64:()=>Bi,base64url:()=>Ji,bigint:()=>rs,boolean:()=>ns,browserEmail:()=>mh,cidrv4:()=>Ki,cidrv6:()=>Ui,creditCard:()=>dn,cuid:()=>Ai,cuid2:()=>Oi,currencyCode:()=>Xi,date:()=>Hi,datetime:()=>Qi,domain:()=>qi,duration:()=>Di,e164:()=>Wi,email:()=>Li,emoji:()=>ji,extendedDuration:()=>uh,guid:()=>Ri,hex:()=>cs,hostname:()=>Gi,html5Email:()=>fh,httpProtocol:()=>sr,iban:()=>mn,idnEmail:()=>dh,integer:()=>ur,ipv4:()=>Vi,ipv6:()=>Mi,ksuid:()=>Ei,lowercase:()=>ss,mac:()=>Fi,md5_base64:()=>_h,md5_base64url:()=>$h,md5_hex:()=>yh,nanoid:()=>Ci,nanoidOfLength:()=>Ti,null:()=>os,number:()=>be,rfc5322Email:()=>ph,sha1_base64:()=>bh,sha1_base64url:()=>vh,sha1_hex:()=>wh,sha256_base64:()=>kh,sha256_base64url:()=>zh,sha256_hex:()=>xh,sha384_base64:()=>Ph,sha384_base64url:()=>Ih,sha384_hex:()=>Sh,sha512_base64:()=>Oh,sha512_base64url:()=>Zh,sha512_hex:()=>Ah,string:()=>ts,time:()=>Yi,ulid:()=>Zi,undefined:()=>is,unicodeEmail:()=>sf,uppercase:()=>us,uuid:()=>Fe,uuid4:()=>ch,uuid6:()=>ah,uuid7:()=>lh,xid:()=>Ni});var Ai=/^[cC][0-9a-z]{6,}$/,Oi=/^[0-9a-z]+$/,Zi=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ni=/^[0-9a-vA-V]{20}$/,Ei=/^[A-Za-z0-9]{27}$/,Ci=/^[a-zA-Z0-9_-]{21}$/;function Ti(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}s(Ti,"nanoidOfLength");var Di=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,uh=/^[-+]?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)?)??$/,Ri=/^([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})$/,Fe=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"),ch=Fe(4),ah=Fe(6),lh=Fe(7),Li=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,fh=/^[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])?)*$/,ph=/^(([^<>()\[\]\\.,;:\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,}))$/,sf=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,dh=sf,mh=/^[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])?)*$/,hh="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function ji(){return new RegExp(hh,"u")}s(ji,"emoji");var Vi=/^(?:(?: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])$/,Mi=/^(([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}|:))$/,Fi=s(e=>{let t=ae(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"),Ki=/^((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])$/,Ui=/^(([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])$/,Bi=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ji=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Gi=/^(?=.{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])?)*\.?$/,qi=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,sr=/^https?$/,Wi=/^\+[1-9]\d{6,14}$/,dn=/^\d(?:[ -]?\d){11,18}$/,Xi=/^(?: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)$/,mn=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,uf="(?:(?:\\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 gh(e){return new RegExp(`^${e}$`)}s(gh,"anchor");var Hi=gh(uf);function Ii(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(Ii,"timeSource");function Yi(e){return new RegExp(`^${Ii(e)}$`)}s(Yi,"time");function Qi(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Ii({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Ii({precision:e.precision})}`:r;return new RegExp(`^${uf}T(?:${n})$`)}s(Qi,"datetime");var es=/^[\s\S]{0,}$/,ts=s(e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string"),rs=/^-?\d+n?$/,ur=/^-?\d+$/,be=/^-?\d+(?:\.\d+)?$/,ns=/^(?:true|false)$/i,os=/^null$/i;var is=/^undefined$/i;var ss=/^[^A-Z]*$/,us=/^[^a-z]*$/,cs=/^[0-9a-fA-F]*$/;function cr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}s(cr,"fixedBase64");function ar(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}s(ar,"fixedBase64url");var yh=/^[0-9a-fA-F]{32}$/,_h=cr(22,"=="),$h=ar(22),wh=/^[0-9a-fA-F]{40}$/,bh=cr(27,"="),vh=ar(27),xh=/^[0-9a-fA-F]{64}$/,kh=cr(43,"="),zh=ar(43),Sh=/^[0-9a-fA-F]{96}$/,Ph=cr(64,""),Ih=ar(64),Ah=/^[0-9a-fA-F]{128}$/,Oh=cr(86,"=="),Zh=ar(86);var L=h("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),as=s(e=>{let t=e.value;return!Wr(t)&&t.size!==void 0},"_whenHasSize"),ls=s(e=>{let t=e.value;return!Wr(t)&&t.length!==void 0},"_whenHasLength"),hn={number:"number",bigint:"bigint",object:"date"},yn=h("$ZodCheckLessThan",(e,t)=>{L.init(e,t);let r=hn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:hn[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})}}),_n=h("$ZodCheckGreaterThan",(e,t)=>{L.init(e,t);let r=hn[typeof t.value];e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:hn[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})}}),fs=h("$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):qt(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})}}),ps=h("$ZodCheckNumberFormat",(e,t)=>{L.init(e,t),t.format=t.format||"float64";let r=t.format?.includes("int"),n=r?"int":"number",[o,i]=Ht[t.format];e._zod.check=u=>{let c=u.value;if(r){if(!Number.isInteger(c)){u.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?u.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):u.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}c<o&&u.issues.push({origin:"number",input:c,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),c>i&&u.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),ds=h("$ZodCheckBigIntFormat",(e,t)=>{L.init(e,t);let[r,n]=Yt[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})}}),ms=h("$ZodCheckMaxSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value;o.size<=t.maximum||n.issues.push({origin:Qt(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),hs=h("$ZodCheckMinSize",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value;o.size>=t.minimum||n.issues.push({origin:Qt(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),gs=h("$ZodCheckSizeEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=as),e._zod.check=n=>{let o=n.value,i=o.size;if(i===t.size)return;let u=i>t.size;n.issues.push({origin:Qt(o),...u?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ys=h("$ZodCheckMaxLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>t.maximum?Me(o):i)<=t.maximum)return;let c=er(o);n.issues.push({origin:c,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_s=h("$ZodCheckMinLength",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?Me(o):i)>=t.minimum)return;let c=er(o);n.issues.push({origin:c,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$s=h("$ZodCheckLengthEquals",(e,t)=>{var r;L.init(e,t),(r=e._zod.def).when??(r.when=ls),e._zod.check=n=>{let o=n.value,i=o.length,u=typeof o=="string"&&i>=t.length&&i<=t.length*2?Me(o):i;if(u===t.length)return;let c=er(o),a=u>t.length;n.issues.push({origin:c,...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})}}),gt=h("$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=()=>{})}),ws=h("$ZodCheckRegex",(e,t)=>{gt.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})}}),bs=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=ss),gt.init(e,t)}),vs=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=us),gt.init(e,t)}),xs=h("$ZodCheckIncludes",(e,t)=>{L.init(e,t);let r=ae(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})}}),ks=h("$ZodCheckStartsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`^${ae(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})}}),zs=h("$ZodCheckEndsWith",(e,t)=>{L.init(e,t);let r=new RegExp(`.*${ae(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 gn(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues))}s(gn,"handleCheckPropertyResult");var Ss=h("$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=>gn(o,r,t.property));gn(n,r,t.property)}}),Ps=h("$ZodCheckProperties",(e,t)=>{L.init(e,t),tr(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(u=>[u,t.shape[u]]));let o=n.value,i;for(let[u,c]of r){let a=c._zod.run({value:o[u],issues:[]},{});a instanceof Promise?(i??(i=[]),i.push(a.then(l=>gn(l,n,u)))):gn(a,n,u)}if(i)return Promise.all(i).then(()=>{})}}),Is=h("$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})}}),As=h("$ZodCheckOverwrite",(e,t)=>{L.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});var Ke=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
9
|
`).filter(u=>u),o=Math.min(...n.map(u=>u.length-u.trimStart().length)),i=n.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(let u of i)this.content.push(u)}compile(){let t=Function,r=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
10
10
|
${r.join(`
|
|
11
11
|
`)}
|
|
12
|
-
};`)(...Object.values(this.closed))}};var Os={major:4,minor:6,patch:5};var P=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Os;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let u of i._zod.onattach)u(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((c,a,l)=>{if(c.memo)return c;let f=H(c),p;for(let d of a){if(d._zod.def.when){if(gi(c)||!d._zod.def.when(c))continue}else if(f)continue;let m=c.issues.length,g=d._zod.check(c);if(g instanceof Promise&&l?.async===!1)throw new ne;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,c.issues.length!==m&&(Qr(c.issues,m,e),f||(f=H(c,m)))});else{if(c.issues.length===m)continue;Qr(c.issues,m,e),f||(f=H(c,m))}}return p?p.then(()=>c):c},"runChecks"),u=s((c,a,l)=>{if(H(c))return c.aborted=!0,c;let f=i(a,o,l);if(f instanceof Promise){if(l.async===!1)throw new ne;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let f=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return f instanceof Promise?f.then(p=>u(p,c,a)):u(f,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new ne;return l.then(f=>i(f,o,a))}return i(l,o,a)}}},{get"~standard"(){return tr(this,"~standard",xn(this))},set"~standard"(e){Pe(this,"~standard",e)}}),kf=s((e,t)=>e.issues.length?{issues:e.issues.map(r=>re(r,t,F()))}:{value:e.value},"toStandardResult");async function Nh(e,t){let r={async:!0};return kf(await e._zod.run({value:t,issues:[]},r),r)}s(Nh,"validateAsync");function xn(e){return{validate:s(t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return kf(n,r)}catch{}return Nh(e,t)},"validate"),vendor:"zod",version:1}}s(xn,"standardProps");var Ue=h("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=t.pattern??es,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=h("$ZodStringFormat",(e,t)=>{gt.init(e,t),Ue.init(e,t)}),Ns=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ri),T.init(e,t)}),Es=h("$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=Fe(n))}else t.pattern??(t.pattern=Fe());T.init(e,t)}),Cs=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Li),T.init(e,t)}),Ts=1,lr=2;function Ds(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}s(Ds,"canParseURL");function kn(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Ds(e)||lr:zf(e,t)}s(kn,"validateURL");function zf(e,t){if(!t.normalize&&t.protocol?.source===sr.source&&!/^https?:\/\//i.test(e))return Ts;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??lr}return new URL(e)}catch{return lr}}s(zf,"parseURLObject");var Eh=/[\t\n\r]/g;function fr(e){return e.replace(Eh,"")}s(fr,"stripTabAndNewline");function zn(e,t){return t.lastIndex=0,t.test(e.hostname)}s(zn,"urlHostnameOk");function Sn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}s(Sn,"urlProtocolOk");var Rs=h("$ZodURL",(e,t)=>{T.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=kn(n,t);if(o===Ts){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===lr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=fr(n);return}t.hostname&&!zn(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&&!Sn(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:fr(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ls=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ji()),T.init(e,t)}),js=h("$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?Ci:Ti(t.length)),T.init(e,t)}),Vs=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ai),T.init(e,t)}),Ms=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Oi),T.init(e,t)}),Fs=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Zi),T.init(e,t)}),Ks=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ni),T.init(e,t)}),Us=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ei),T.init(e,t)}),Bs=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Qi(t)),T.init(e,t)}),Js=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hi),T.init(e,t)}),Gs=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yi(t)),T.init(e,t)}),qs=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Di),T.init(e,t)}),Ws=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vi),T.init(e,t)}),Ch=/^[0-9a-fA-F:.]+$/;function pr(e){return Ch.test(e)?Ds(`http://[${e}]`):!1}s(pr,"isValidIPv6");var Xs=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Mi),T.init(e,t),e._zod.check=r=>{pr(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),Hs=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Fi(t.delimiter)),T.init(e,t)}),Ys=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ki),T.init(e,t)});function Pn(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:pr(r)}s(Pn,"isValidCIDRv6");var Qs=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ui),T.init(e,t),e._zod.check=r=>{Pn(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function dr(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}s(dr,"isValidBase64");var In=/^[0-9a-zA-Z+/]*={0,2}$/,eu=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=In),T.init(e,t),e._zod.check=r=>{dr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),mr=/^[A-Za-z0-9_-]*$/;function An(e){if(!mr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return dr(r)}s(An,"isValidBase64URL");var tu=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mr),T.init(e,t),e._zod.check=r=>{An(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ru=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wi),T.init(e,t)}),Th=/[- ]/g;function Dh(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(Dh,"isLuhnAlgo");function On(e){return dn.test(e)?Dh(e.replace(Th,"")):!1}s(On,"isValidCreditCard");var nu=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=dn),T.init(e,t),e._zod.check=r=>{On(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function Rh(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(Rh,"isIso7064Mod97");function Zn(e){return mn.test(e)?Rh(e):!1}s(Zn,"isValidIBAN");var ou=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=mn),T.init(e,t),e._zod.check=r=>{Zn(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function Nn(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(Nn,"isValidJWT");var iu=h("$ZodJWT",(e,t)=>{T.init(e,t),e._zod.check=r=>{Nn(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),su=h("$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})}}),En=h("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=ve,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}}),uu=h("$ZodNumberFormat",(e,t)=>{ps.init(e,t),En.init(e,t)}),hr=h("$ZodBoolean",(e,t)=>{P.init(e,t),e._zod.pattern=ns,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}}),Cn=h("$ZodBigInt",(e,t)=>{P.init(e,t),e._zod.pattern=rs,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}}),cu=h("$ZodBigIntFormat",(e,t)=>{ds.init(e,t),Cn.init(e,t)}),au=h("$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}}),lu=h("$ZodUndefined",(e,t)=>{P.init(e,t),e._zod.pattern=is,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}}),fu=h("$ZodNull",(e,t)=>{P.init(e,t),e._zod.pattern=os,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}}),pu=h("$ZodAny",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),du=h("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),mu=h("$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)}),hu=h("$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}}),gu=h("$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 af(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues)),t.value[r]=e.value}s(af,"handleArrayResult");var yu=h("$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 u=[],c=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)u.push(f.then(p=>af(p,n,a)));else if(af(f,n,a),c&&f.issues.length!==0&&H(f))break}return u.length?Promise.all(u).then(()=>n):n}});function vn(e,t,r,n,o,i){let u=r in n,c=i==="optional";if(!(!u&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!u)return;t.issues.push(...te(r,e.issues))}if(!u&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(u||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}s(vn,"handlePropertyResult");var Lh=[];function Sf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Lh,o=n.length?[...t,...n]:t;for(let u of o)if(!e.shape?.[u]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(u)}": expected a Zod schema`);let i=hi(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}s(Sf,"normalizeDef");function Pf(e,t,r,n,o,i,u){let c=[],a=o.keySet,l=o.catchall._zod,f=l.def.type,p=l.optin,d=l.optout,m=0;for(let g in t){if(u&&r.issues.length!==m){if(H(r,m))break;m=r.issues.length}if(a.has(g))continue;if(g==="__proto__"){f==="never"&&c.push(g);continue}if(f==="never"){c.push(g);continue}let y=l.run({value:t[g],issues:[]},n);y instanceof Promise?e.push(y.then($=>vn($,r,g,t,p,d))):vn(y,r,g,t,p,d)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}s(Pf,"handleCatchall");var If=h("$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=at(()=>Sf(t));O(e,"propValues",l=>{let f=l.def.shape,p={};for(let d in f){let m=f[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(p,d)||J(p,d,new Set);for(let g of m.values)p[d].add(g);m.optin!==void 0&&p[d].add(void 0)}}return p});let i=Ve,u=t.catchall,c,a=B.memoizer;a?.attach(e),e._zod.parse=(l,f)=>{c??(c=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=[],m=c.shape,g=f?.abortEarly,y=l.issues.length;for(let $ of c.allKeys){if(g&&l.issues.length!==y){if(H(l,y))break;y=l.issues.length}if($==="__proto__")continue;let z=m[$],x=z._zod.optin,I=z._zod.optout,E=z._zod.run({value:p[$],issues:[]},f);E instanceof Promise?d.push(E.then(j=>vn(j,l,$,p,x,I))):vn(E,l,$,p,x,I)}return u?Pf(d,p,l,f,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),_u=h("$ZodObjectJIT",(e,t)=>{If.init(e,t);let r=e._zod.parse,n=at(()=>Sf(t)),o=B.memoizer,i=s(m=>{let g=n.value,y=g.symbolKeys,$=new Ke(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),z=s(j=>`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`,"parseStr"),x=s((j,N)=>`
|
|
12
|
+
};`)(...Object.values(this.closed))}};var Os={major:4,minor:6,patch:5};var P=h("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Os;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let u of i._zod.onattach)u(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((c,a,l)=>{if(c.memo)return c;let f=H(c),p;for(let d of a){if(d._zod.def.when){if(gi(c)||!d._zod.def.when(c))continue}else if(f)continue;let m=c.issues.length,g=d._zod.check(c);if(g instanceof Promise&&l?.async===!1)throw new ne;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,c.issues.length!==m&&(Qr(c.issues,m,e),f||(f=H(c,m)))});else{if(c.issues.length===m)continue;Qr(c.issues,m,e),f||(f=H(c,m))}}return p?p.then(()=>c):c},"runChecks"),u=s((c,a,l)=>{if(H(c))return c.aborted=!0,c;let f=i(a,o,l);if(f instanceof Promise){if(l.async===!1)throw new ne;return f.then(p=>e._zod.parse(p,l))}return e._zod.parse(f,l)},"handleCanaryResult");e._zod.run=(c,a)=>{if(a.skipChecks)return e._zod.parse(c,a);if(a.direction==="backward"){let f=e._zod.parse({value:c.value,issues:[]},{...a,skipChecks:!0});return f instanceof Promise?f.then(p=>u(p,c,a)):u(f,c,a)}let l=e._zod.parse(c,a);if(l instanceof Promise){if(a.async===!1)throw new ne;return l.then(f=>i(f,o,a))}return i(l,o,a)}}},{get"~standard"(){return tr(this,"~standard",xn(this))},set"~standard"(e){Pe(this,"~standard",e)}}),kf=s((e,t)=>e.issues.length?{issues:e.issues.map(r=>re(r,t,M()))}:{value:e.value},"toStandardResult");async function Nh(e,t){let r={async:!0};return kf(await e._zod.run({value:t,issues:[]},r),r)}s(Nh,"validateAsync");function xn(e){return{validate:s(t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return kf(n,r)}catch{}return Nh(e,t)},"validate"),vendor:"zod",version:1}}s(xn,"standardProps");var Ue=h("$ZodString",(e,t)=>{P.init(e,t),e._zod.pattern=t.pattern??es,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=h("$ZodStringFormat",(e,t)=>{gt.init(e,t),Ue.init(e,t)}),Ns=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ri),T.init(e,t)}),Es=h("$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=Fe(n))}else t.pattern??(t.pattern=Fe());T.init(e,t)}),Cs=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Li),T.init(e,t)}),Ts=1,lr=2;function Ds(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}s(Ds,"canParseURL");function kn(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?Ds(e)||lr:zf(e,t)}s(kn,"validateURL");function zf(e,t){if(!t.normalize&&t.protocol?.source===sr.source&&!/^https?:\/\//i.test(e))return Ts;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse=="function")return r.parse(e)??lr}return new URL(e)}catch{return lr}}s(zf,"parseURLObject");var Eh=/[\t\n\r]/g;function fr(e){return e.replace(Eh,"")}s(fr,"stripTabAndNewline");function zn(e,t){return t.lastIndex=0,t.test(e.hostname)}s(zn,"urlHostnameOk");function Sn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}s(Sn,"urlProtocolOk");var Rs=h("$ZodURL",(e,t)=>{T.init(e,t),e._zod.check=r=>{try{let n=r.value.trim(),o=kn(n,t);if(o===Ts){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===lr){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=fr(n);return}t.hostname&&!zn(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&&!Sn(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:fr(n);return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),Ls=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=ji()),T.init(e,t)}),js=h("$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?Ci:Ti(t.length)),T.init(e,t)}),Vs=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ai),T.init(e,t)}),Ms=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Oi),T.init(e,t)}),Fs=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Zi),T.init(e,t)}),Ks=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ni),T.init(e,t)}),Us=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Ei),T.init(e,t)}),Bs=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Qi(t)),T.init(e,t)}),Js=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hi),T.init(e,t)}),Gs=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Yi(t)),T.init(e,t)}),qs=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Di),T.init(e,t)}),Ws=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Vi),T.init(e,t)}),Ch=/^[0-9a-fA-F:.]+$/;function pr(e){return Ch.test(e)?Ds(`http://[${e}]`):!1}s(pr,"isValidIPv6");var Xs=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Mi),T.init(e,t),e._zod.check=r=>{pr(r.value)||r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),Hs=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Fi(t.delimiter)),T.init(e,t)}),Ys=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ki),T.init(e,t)});function Pn(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:pr(r)}s(Pn,"isValidCIDRv6");var Qs=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ui),T.init(e,t),e._zod.check=r=>{Pn(r.value)||r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});function dr(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}s(dr,"isValidBase64");var In=/^[0-9a-zA-Z+/]*={0,2}$/,eu=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=In),T.init(e,t),e._zod.check=r=>{dr(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),mr=/^[A-Za-z0-9_-]*$/;function An(e){if(!mr.test(e))return!1;let t=e.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return dr(r)}s(An,"isValidBase64URL");var tu=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mr),T.init(e,t),e._zod.check=r=>{An(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),ru=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Wi),T.init(e,t)}),Th=/[- ]/g;function Dh(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(Dh,"isLuhnAlgo");function On(e){return dn.test(e)?Dh(e.replace(Th,"")):!1}s(On,"isValidCreditCard");var nu=h("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=dn),T.init(e,t),e._zod.check=r=>{On(r.value)||r.issues.push({code:"invalid_format",format:"credit_card",input:r.value,inst:e,continue:!t.abort})}});function Rh(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(Rh,"isIso7064Mod97");function Zn(e){return mn.test(e)?Rh(e):!1}s(Zn,"isValidIBAN");var ou=h("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=mn),T.init(e,t),e._zod.check=r=>{Zn(r.value)||r.issues.push({code:"invalid_format",format:"iban",input:r.value,inst:e,continue:!t.abort})}});function Nn(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(Nn,"isValidJWT");var iu=h("$ZodJWT",(e,t)=>{T.init(e,t),e._zod.check=r=>{Nn(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),su=h("$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})}}),En=h("$ZodNumber",(e,t)=>{P.init(e,t),e._zod.pattern=be,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}}),uu=h("$ZodNumberFormat",(e,t)=>{ps.init(e,t),En.init(e,t)}),hr=h("$ZodBoolean",(e,t)=>{P.init(e,t),e._zod.pattern=ns,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}}),Cn=h("$ZodBigInt",(e,t)=>{P.init(e,t),e._zod.pattern=rs,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}}),cu=h("$ZodBigIntFormat",(e,t)=>{ds.init(e,t),Cn.init(e,t)}),au=h("$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}}),lu=h("$ZodUndefined",(e,t)=>{P.init(e,t),e._zod.pattern=is,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}}),fu=h("$ZodNull",(e,t)=>{P.init(e,t),e._zod.pattern=os,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}}),pu=h("$ZodAny",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),du=h("$ZodUnknown",(e,t)=>{P.init(e,t),e._zod.parse=r=>r}),mu=h("$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)}),hu=h("$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}}),gu=h("$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 af(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues)),t.value[r]=e.value}s(af,"handleArrayResult");var yu=h("$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 u=[],c=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)u.push(f.then(p=>af(p,n,a)));else if(af(f,n,a),c&&f.issues.length!==0&&H(f))break}return u.length?Promise.all(u).then(()=>n):n}});function vn(e,t,r,n,o,i){let u=r in n,c=i==="optional";if(!(!u&&c&&o==="optional")){if(e.issues.length){if(o!==void 0&&c&&!u)return;t.issues.push(...te(r,e.issues))}if(!u&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(u||o==="defaulted"&&!c)&&(t.value[r]=void 0):t.value[r]=e.value}}s(vn,"handlePropertyResult");var Lh=[];function Sf(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Lh,o=n.length?[...t,...n]:t;for(let u of o)if(!e.shape?.[u]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(u)}": expected a Zod schema`);let i=hi(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}s(Sf,"normalizeDef");function Pf(e,t,r,n,o,i,u){let c=[],a=o.keySet,l=o.catchall._zod,f=l.def.type,p=l.optin,d=l.optout,m=0;for(let g in t){if(u&&r.issues.length!==m){if(H(r,m))break;m=r.issues.length}if(a.has(g))continue;if(g==="__proto__"){f==="never"&&c.push(g);continue}if(f==="never"){c.push(g);continue}let y=l.run({value:t[g],issues:[]},n);y instanceof Promise?e.push(y.then($=>vn($,r,g,t,p,d))):vn(y,r,g,t,p,d)}return c.length&&r.issues.push({code:"unrecognized_keys",keys:c,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}s(Pf,"handleCatchall");var If=h("$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=at(()=>Sf(t));O(e,"propValues",l=>{let f=l.def.shape,p={};for(let d in f){let m=f[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(p,d)||J(p,d,new Set);for(let g of m.values)p[d].add(g);m.optin!==void 0&&p[d].add(void 0)}}return p});let i=Ve,u=t.catchall,c,a=B.memoizer;a?.attach(e),e._zod.parse=(l,f)=>{c??(c=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=[],m=c.shape,g=f?.abortEarly,y=l.issues.length;for(let $ of c.allKeys){if(g&&l.issues.length!==y){if(H(l,y))break;y=l.issues.length}if($==="__proto__")continue;let z=m[$],x=z._zod.optin,I=z._zod.optout,E=z._zod.run({value:p[$],issues:[]},f);E instanceof Promise?d.push(E.then(j=>vn(j,l,$,p,x,I))):vn(E,l,$,p,x,I)}return u?Pf(d,p,l,f,o.value,e,g===!0):d.length?Promise.all(d).then(()=>l):l}}),_u=h("$ZodObjectJIT",(e,t)=>{If.init(e,t);let r=e._zod.parse,n=at(()=>Sf(t)),o=B.memoizer,i=s(m=>{let g=n.value,y=g.symbolKeys,$=new Ke(["payload","ctx"],{shape:m,inst:e,memo:o,syms:y}),z=s(j=>`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`,"parseStr"),x=s((j,N)=>`
|
|
13
13
|
let ${j}_ab = false;
|
|
14
14
|
for (let i = 0; i < ${j}.issues.length; i++) {
|
|
15
15
|
const iss = ${j}.issues[i];
|
|
@@ -59,13 +59,13 @@ ${r.join(`
|
|
|
59
59
|
newResult[${q}] = ${N}.value;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
`)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},"generateFastpass"),u,c=Ve,a=!B.jitless,f=a&&di.value,p=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let y=m.value;return c(y)?a&&f&&g?.async===!1&&g.jitless!==!0?(u||(u=i(t.shape)),m=u(m,g),p?Pf([],y,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function lf(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=>!H(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(u=>re(u,n,F())))}),t)}s(lf,"handleUnionResults");var gr=h("$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=>be(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,u=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)u.push(a),i=!0;else{if(a.issues.length===0)return a;u.push(a)}}return i?Promise.all(u).then(c=>lf(c,n,e,o)):lf(u,n,e,o)}});function ff(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(u=>re(u,n,F())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}s(ff,"handleExclusiveUnionResults");var $u=h("$ZodXor",(e,t)=>{gr.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,u=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);a instanceof Promise?(u.push(a),i=!0):u.push(a)}return i?Promise.all(u).then(c=>ff(c,n,e,o)):ff(u,n,e,o)}});function wu(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Af(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(wu,"getDiscriminatedOption");function Af(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(Af,"discriminatorMap");var bu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gr.init(e,t);let r=e._zod.parse;O(e,"propValues",o=>{let i={},u=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);a[o.def.discriminator]?.has(void 0)&&u++;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&&u>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let u=lt(o._zod.def);if(u&&!Object.prototype.hasOwnProperty.call(u,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=at(()=>Af(t));e._zod.parse=(o,i)=>{let u=o.value;if(!Ve(u))return o.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),o;let c=u?.[t.discriminator],a=n.value.get(c);return a&&(c!==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:u,path:[t.discriminator],inst:e}),o)}}),vu=h("$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),u=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||u instanceof Promise?Promise.all([i,u]).then(([a,l])=>pf(r,a,l)):pf(r,i,u)}});function yt(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 u=yt(e[i],t[i]);if(!u.valid)return{valid:!1,mergeErrorPath:[i,...u.mergeErrorPath]};o[i]=u.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],u=yt(o,i);if(!u.valid)return{valid:!1,mergeErrorPath:[n,...u.mergeErrorPath]};r.push(u.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}s(yt,"mergeValues");function pf(e,t,r){let n=new Map,o,i=new Map,u=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)u(l,"l")||e.issues.push(l);for(let l of r.issues)u(l,"r")||e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of c)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let a=yt(t.value,r.value);if(!a.valid){if(H(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}s(pf,"handleIntersectionResults");var Tn=h("$ZodTuple",(e,t)=>{P.init(e,t);let r=t.items,n=B.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let u=o.value;if(!Array.isArray(u))return o.issues.push({input:u,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],a=df(r,"optin"),l=df(r,"optout");if(!t.rest){if(u.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:u,inst:e,origin:"array"}),o;u.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:u,inst:e,origin:"array"})}let f=new Array(r.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:u[m],issues:[]},i);g instanceof Promise?c.push(g.then(y=>{f[m]=y})):(f[m]=g,p&&!d&&g.issues.length&&(d=H(g)))}if(t.rest&&!d){let m=r.length-1,g=u.slice(r.length),y=o.issues.length;for(let $ of g){if(p&&o.issues.length!==y){if(H(o,y))break;y=o.issues.length}m++;let z=t.rest._zod.run({value:$,issues:[]},i);z instanceof Promise?c.push(z.then(x=>mf(x,o,m))):mf(z,o,m)}}return c.length?Promise.all(c).then(()=>hf(f,o,r,u,l)):hf(f,o,r,u,l)}});function df(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(df,"getTupleOptStart");function mf(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues)),t.value[r]=e.value}s(mf,"handleTupleResult");function hf(e,t,r,n,o){for(let i=0;i<r.length;i++){let u=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(u.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...te(i,u.issues))}t.value[i]=u.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(hf,"handleTupleResults");var xu=h("$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 u=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let f of c)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(g=>re(g,o,F())),input:f,path:[f],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[f],issues:[]},o);m instanceof Promise?u.push(m.then(g=>{g.issues.length&&n.issues.push(...te(f,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...te(f,m.issues)),n.value[d]=m.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"&&ve.test(l)&&f.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(f=g)}if(f.issues.length){t.mode==="loose"?n.value[l]=i[l]:c?(a=a??[],a.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>re(g,o,F())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?u.push(m.then(g=>{g.issues.length&&n.issues.push(...te(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...te(l,m.issues)),n.value[d]=m.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return u.length?Promise.all(u).then(()=>n):n}}),ku=h("$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 u=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let c=o?.abortEarly,a=n.issues.length;for(let[l,f]of i){if(c&&n.issues.length!==a){if(H(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?u.push(Promise.all([p,d]).then(([m,g])=>{gf(m,g,n,l,i,e,o)})):gf(p,d,n,l,i,e,o)}return u.length?Promise.all(u).then(()=>n):n}});function gf(e,t,r,n,o,i,u){e.issues.length&&(Xt.has(typeof n)?r.issues.push(...te(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(c=>re(c,u,F()))})),t.issues.length&&(Xt.has(typeof n)?r.issues.push(...te(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(c=>re(c,u,F()))})),r.value.set(e.value,t.value)}s(gf,"handleMapResult");var zu=h("$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 u=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let c=o?.abortEarly,a=n.issues.length;for(let l of i){if(c&&n.issues.length!==a){if(H(n,a))break;a=n.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?u.push(f.then(p=>yf(p,n))):yf(f,n)}return u.length?Promise.all(u).then(()=>n):n}});function yf(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}s(yf,"handleSetResult");var Su=h("$ZodEnum",(e,t)=>{P.init(e,t);let r=ut(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=ut(o.def.entries).filter(u=>Xt.has(typeof u));return new RegExp(i.length?`^(${i.map(u=>ae(u.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let u=o.value;return n.has(u)||o.issues.push({code:"invalid_value",values:r,input:u,inst:e}),o}}),Pu=h("$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"?ae(i):i?ae(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}}),Iu=h("$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}}),Au=h("$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 Ie(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(r.value=u,r));if(o instanceof Promise)throw new ne;return r.value=o,r}});function _f(e,t){return e.value=t.issues.length?void 0:t.value,e}s(_f,"handleOptionalResult");var Dn=h("$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(`^(${be(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=>_f(r,i)):_f(r,o)}return t.innerType._zod.run(r,n)}}),Ou=h("$ZodExactOptional",(e,t)=>{Dn.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)}),Zu=h("$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(`^(${be(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)}),Nu=h("$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=>$f(i,t)):$f(o,t)}});function $f(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}s($f,"handleDefaultResult");var Eu=h("$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))}),Cu=h("$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=>wf(i,e)):wf(o,e)}});function wf(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(wf,"handleNonOptionalResult");var Tu=h("$ZodSuccess",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie("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 bf(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>re(o,n,F()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}s(bf,"handleCatchResult");var Du=h("$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=>bf(r,i,t,n)):bf(r,o,t,n)}}),Ru=h("$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)}),Rn=h("$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(u=>$n(u,t.in,n)):$n(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>$n(i,t.out,n)):$n(o,t.out,n)}});function $n(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($n,"handlePipeResult");var yr=h("$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(u=>wn(u,t,n)):wn(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(u=>wn(u,t,n)):wn(i,t,n)}}});function wn(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=>bn(e,i,t.out,r)):bn(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>bn(e,i,t.in,r)):bn(e,o,t.in,r)}}s(wn,"handleCodecAResult");function bn(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}s(bn,"handleCodecTxResult");var Lu=h("$ZodPreprocess",(e,t)=>{Rn.init(e,t)}),ju=h("$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(vf):vf(o)}});function vf(e){return e.memo||(e.value=Object.freeze(e.value)),e}s(vf,"handleReadonlyResult");function jh(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let c of t.checks??[]){let a=c._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 ts({minimum:o,maximum:i}).source;let u=e._zod.pattern;return(n&&u===ve?ur:u)?.source}s(jh,"leafPattern");function Zs(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=Zs(n);return r&&o&&i&&i!==o?r.replace(be(o),()=>be(i)):r}if(t.options){let o=t.options.map(Zs);if(o.every(Boolean))return`^(${o.map(i=>be(i)).join("|")})$`}return jh(e)}s(Zs,"partPattern");var Vu=h("$ZodTemplateLiteral",(e,t)=>{P.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=Zs(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(be(o))}else if(n===null||mi.has(typeof n))r.push(ae(`${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)}),Mu=h("$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?rn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?rn(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 nn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await nn(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 Tn({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)),Fu=h("$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))}),_r=h("$ZodLazy",(e,t)=>{P.init(e,t),fi(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)}),Ku=h("$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=>xf(i,r,n,e));xf(o,r,n,e)}});function xf(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(ft(o))}}s(xf,"handleRefineResult");var Mn=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Bu="~memo",Zf=[];function Nf(e){return e!==null&&typeof e=="object"}s(Nf,"isRef");function Uu(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}s(Uu,"cloneIssues");var Ef=new WeakMap,_t=0,Vn=1,$r=2;function wr(e,t,r){let n=Ef.get(e);if(n!==void 0)return n?$r:_t;if(t.has(e))return $r;t.add(e);let o=_t,i=s(f=>{if(o!==$r&&f?._zod){let p=wr(f,t,r);p>o&&(o=p)}},"check"),u=s((f,p)=>{let d=_t;for(let m of Reflect.ownKeys(f)){let g=Object.getOwnPropertyDescriptor(f,m);if(p&&!g.enumerable)continue;let y=g.get?Vn:g.value?._zod?wr(g.value,t,r):_t;y>d&&(d=y)}return d},"shape"),c=s(f=>{f>o&&(o=f)},"merge"),a=e._zod.def,l=a.type;switch(l){case"object":{let f=lt(a);c(f?u(f,!0):Vn),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);c(f?wr(f,t,!1):Vn);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 m of d)i(m)}}}return t.delete(e),Vh(e,o)}s(wr,"isRecursive");function Vh(e,t){return t!==Vn&&Ef.set(e,t===$r),t}s(Vh,"settle");function Fn(e){return wr(e,new Set,!0)!==_t}s(Fn,"isRecursiveSchema");function Mh(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}s(Mh,"bucketFor");var Ln,jn=[],Fh={alloc(e,t,r){let n=Ln;if(!n)return r;Ln=void 0;let o={value:r,issues:null};return n.set(t.value,o),jn.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"&&Kn(i,o.value))throw new Mn;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 u=e._zod.parse,c=s((a,l)=>{if(r===void 0){let z=wr(e,new Set,!1);if(z===_t)return e._zod.parse=u,e._zod.run===c&&(e._zod.run=u),u(a,l);z===$r||n?r=!0:n=!0}let f=a.value;if(!Nf(f))return u(a,l);let p=l[Bu];p||(p={buckets:new WeakMap,backEdges:void 0},l[Bu]=p);let d;o===l?d=i:(d=Mh(p,e),o=l,i=d);let m=d.get(f);if(m)return a.value=m.value,m.issues?m.issues.length&&a.issues.push(...Uu(m.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value)),a;Ln=d;let g=jn.length,y=u(a,l);Ln=void 0;let $=jn.length>g?jn.pop():void 0;return y instanceof Promise?y.then(z=>($&&($.issues=z.issues.length?Uu(z.issues):Zf),z)):($&&($.issues=y.issues.length?Uu(y.issues):Zf),y)},"wrapped");e._zod.parse=c,e._zod.run===u&&(e._zod.run=c)})}};function br(){return Fh}s(br,"memoizer");function Kn(e,t){let r=e[Bu]?.backEdges;return r!==void 0&&Nf(t)&&r.has(t)}s(Kn,"isBackEdge");var xr={};$e(xr,{en:()=>vr});var Kh=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,u){return i==="number"&&typeof u=="number"&&!Number.isFinite(u)?String(u):n[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let u=o(i.expected),c=yi(i.input),a=o(c,i.input);return`Invalid input: expected ${u}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Hr(i.values[0])}`:`Invalid option: expected one of ${qr(i.values,"|")}`;case"too_big":{let u=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${u}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${u}${i.maximum.toString()}`}case"too_small":{let u=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${u}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${u}${i.minimum.toString()}`}case"invalid_format":{let u=i;return u.format==="starts_with"?`Invalid string: must start with "${u.prefix}"`:u.format==="ends_with"?`Invalid string: must end with "${u.suffix}"`:u.format==="includes"?`Invalid string: must include "${u.includes}"`:u.format==="regex"?`Invalid string: must match pattern ${u.pattern}`:`Invalid ${r[u.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":""}: ${qr(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(c=>`'${c}'`).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 vr(){return{localeError:Kh()}}s(vr,"default");var Cf,Ju=Symbol("ZodOutput"),Gu=Symbol("ZodInput"),Un=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 Bn(){return new Un}s(Bn,"registry");(Cf=globalThis).__zod_globalRegistry??(Cf.__zod_globalRegistry=Bn());var G=globalThis.__zod_globalRegistry;var Y=Symbol.for("zod.compile.invalid"),Tf=Symbol.for("zod.compile.fallback"),pe=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Z=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 Bh(e,t){try{return Gn(e,{assertOnly:!0})}catch{return t}}s(Bh,"compileValidator");function Hu(e,t){try{let r=Gn(e),n=Jn(e,r);return n._zod.bag.validator=Bh(e,r),n}catch(r){if(t?.strict)throw r;return e}}s(Hu,"compile");function Jn(e,t){if(Fn(e))throw new Z("a schema whose subtree contains a reference cycle");let r=C(e),n=e._zod.run,o=n.__originalRun??n,i=s((u,c)=>{if(c?.async||c?.direction==="backward"||c?.skipChecks||c?.[Tf]||c&&Kn(c,u.value))return o(u,c);let a=t(u.value);return a!==Y?(u.value=a,u):(c&&(c[Tf]=!0),o(u,c))},"wrapped");return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||Jh(r,e,t),r}s(Jn,"withParser");function Jh(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(u,c)=>{let a=r(u);return a!==Y?{success:!0,data:a}:i(u,c)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(u,c)=>{let a=r(u);return a!==Y?a:i(u,c)}}}s(Jh,"installCompiledUserMethods");function Gn(e,t){let r=!0;try{r=Fn(e)}catch{}if(r)throw new Z("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Ke(["input"]),i=V(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let u=["INVALID",...n.constants.keys()],c=[Y,...n.constants.values()],a=o.content.join(`
|
|
62
|
+
`)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},"generateFastpass"),u,c=Ve,a=!B.jitless,f=a&&di.value,p=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=n.value);let y=m.value;return c(y)?a&&f&&g?.async===!1&&g.jitless!==!0?(u||(u=i(t.shape)),m=u(m,g),p?Pf([],y,m,g,d,e,g?.abortEarly===!0):m):r(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),m)}});function lf(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=>!H(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(u=>re(u,n,M())))}),t)}s(lf,"handleUnionResults");var gr=h("$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=>we(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,u=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);if(a instanceof Promise)u.push(a),i=!0;else{if(a.issues.length===0)return a;u.push(a)}}return i?Promise.all(u).then(c=>lf(c,n,e,o)):lf(u,n,e,o)}});function ff(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(u=>re(u,n,M())))}):t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:[],inclusive:!1,matches:o}),t)}s(ff,"handleExclusiveUnionResults");var $u=h("$ZodXor",(e,t)=>{gr.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,u=[];for(let c of t.options){let a=c._zod.run({value:n.value,issues:[]},o);a instanceof Promise?(u.push(a),i=!0):u.push(a)}return i?Promise.all(u).then(c=>ff(c,n,e,o)):ff(u,n,e,o)}});function wu(e,t){let r=e._zod,n=r.bag.optionsMap;n||(n=Af(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(wu,"getDiscriminatedOption");function Af(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(Af,"discriminatorMap");var bu=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,gr.init(e,t);let r=e._zod.parse;O(e,"propValues",o=>{let i={},u=0;for(let c of o.def.options){let a=c._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(c)}"`);a[o.def.discriminator]?.has(void 0)&&u++;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&&u>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let u=lt(o._zod.def);if(u&&!Object.prototype.hasOwnProperty.call(u,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let n=at(()=>Af(t));e._zod.parse=(o,i)=>{let u=o.value;if(!Ve(u))return o.issues.push({code:"invalid_type",expected:"object",input:u,inst:e}),o;let c=u?.[t.discriminator],a=n.value.get(c);return a&&(c!==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:u,path:[t.discriminator],inst:e}),o)}}),vu=h("$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),u=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||u instanceof Promise?Promise.all([i,u]).then(([a,l])=>pf(r,a,l)):pf(r,i,u)}});function yt(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 u=yt(e[i],t[i]);if(!u.valid)return{valid:!1,mergeErrorPath:[i,...u.mergeErrorPath]};o[i]=u.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],u=yt(o,i);if(!u.valid)return{valid:!1,mergeErrorPath:[n,...u.mergeErrorPath]};r.push(u.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}s(yt,"mergeValues");function pf(e,t,r){let n=new Map,o,i=new Map,u=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)u(l,"l")||e.issues.push(l);for(let l of r.issues)u(l,"r")||e.issues.push(l);let c=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(c.length){let l=o?c.filter(f=>o.keys.includes(f)):[];l.length&&e.issues.push({...o,keys:l});for(let f of c)!l.includes(f)&&i.has(f)&&e.issues.push(i.get(f))}let a=yt(t.value,r.value);if(!a.valid){if(H(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`)}return e.value=a.data,e}s(pf,"handleIntersectionResults");var Tn=h("$ZodTuple",(e,t)=>{P.init(e,t);let r=t.items,n=B.memoizer;n?.attach(e),e._zod.parse=(o,i)=>{let u=o.value;if(!Array.isArray(u))return o.issues.push({input:u,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=n?n.alloc(e,o,[],i):[];let c=[],a=df(r,"optin"),l=df(r,"optout");if(!t.rest){if(u.length<a)return o.issues.push({code:"too_small",minimum:a,inclusive:!0,input:u,inst:e,origin:"array"}),o;u.length>r.length&&o.issues.push({code:"too_big",maximum:r.length,inclusive:!0,input:u,inst:e,origin:"array"})}let f=new Array(r.length),p=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<r.length;m++){let g=r[m]._zod.run({value:u[m],issues:[]},i);g instanceof Promise?c.push(g.then(y=>{f[m]=y})):(f[m]=g,p&&!d&&g.issues.length&&(d=H(g)))}if(t.rest&&!d){let m=r.length-1,g=u.slice(r.length),y=o.issues.length;for(let $ of g){if(p&&o.issues.length!==y){if(H(o,y))break;y=o.issues.length}m++;let z=t.rest._zod.run({value:$,issues:[]},i);z instanceof Promise?c.push(z.then(x=>mf(x,o,m))):mf(z,o,m)}}return c.length?Promise.all(c).then(()=>hf(f,o,r,u,l)):hf(f,o,r,u,l)}});function df(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(df,"getTupleOptStart");function mf(e,t,r){e.issues.length&&t.issues.push(...te(r,e.issues)),t.value[r]=e.value}s(mf,"handleTupleResult");function hf(e,t,r,n,o){for(let i=0;i<r.length;i++){let u=e[i],c=i<n.length;if(!c&&i>=o&&r[i]._zod.optin==="optional"){t.value.length=i;break}if(u.issues.length){if(!c&&i>=o){t.value.length=i;break}t.issues.push(...te(i,u.issues))}t.value[i]=u.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(hf,"handleTupleResults");var xu=h("$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 u=[],c=t.keyType._zod.values;if(c&&!t.partial){n.value=r?r.alloc(e,n,{},o):{};let a=new Set;for(let f of c)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(g=>re(g,o,M())),input:f,path:[f],inst:e});continue}let d=p.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[f],issues:[]},o);m instanceof Promise?u.push(m.then(g=>{g.issues.length&&n.issues.push(...te(f,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...te(f,m.issues)),n.value[d]=m.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"&&be.test(l)&&f.issues.length){let g=t.keyType._zod.run({value:Number(l),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(f=g)}if(f.issues.length){t.mode==="loose"?n.value[l]=i[l]:c?(a=a??[],a.push(l)):n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>re(g,o,M())),input:l,path:[l],inst:e});continue}let d=f.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[l],issues:[]},o);m instanceof Promise?u.push(m.then(g=>{g.issues.length&&n.issues.push(...te(l,g.issues)),n.value[d]=g.value})):(m.issues.length&&n.issues.push(...te(l,m.issues)),n.value[d]=m.value)}a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:a,continue:!0})}return u.length?Promise.all(u).then(()=>n):n}}),ku=h("$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 u=[];n.value=r?r.alloc(e,n,new Map,o):new Map;let c=o?.abortEarly,a=n.issues.length;for(let[l,f]of i){if(c&&n.issues.length!==a){if(H(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?u.push(Promise.all([p,d]).then(([m,g])=>{gf(m,g,n,l,i,e,o)})):gf(p,d,n,l,i,e,o)}return u.length?Promise.all(u).then(()=>n):n}});function gf(e,t,r,n,o,i,u){e.issues.length&&(Xt.has(typeof n)?r.issues.push(...te(n,e.issues)):r.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(c=>re(c,u,M()))})),t.issues.length&&(Xt.has(typeof n)?r.issues.push(...te(n,t.issues)):r.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:n,issues:t.issues.map(c=>re(c,u,M()))})),r.value.set(e.value,t.value)}s(gf,"handleMapResult");var zu=h("$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 u=[];n.value=r?r.alloc(e,n,new Set,o):new Set;let c=o?.abortEarly,a=n.issues.length;for(let l of i){if(c&&n.issues.length!==a){if(H(n,a))break;a=n.issues.length}let f=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise?u.push(f.then(p=>yf(p,n))):yf(f,n)}return u.length?Promise.all(u).then(()=>n):n}});function yf(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}s(yf,"handleSetResult");var Su=h("$ZodEnum",(e,t)=>{P.init(e,t);let r=ut(t.entries),n=new Set(r);e._zod.values=n,O(e,"pattern",o=>{let i=ut(o.def.entries).filter(u=>Xt.has(typeof u));return new RegExp(i.length?`^(${i.map(u=>ae(u.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let u=o.value;return n.has(u)||o.issues.push({code:"invalid_value",values:r,input:u,inst:e}),o}}),Pu=h("$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"?ae(i):i?ae(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}}),Iu=h("$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}}),Au=h("$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 Ie(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(r.value=u,r));if(o instanceof Promise)throw new ne;return r.value=o,r}});function _f(e,t){return e.value=t.issues.length?void 0:t.value,e}s(_f,"handleOptionalResult");var Dn=h("$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(`^(${we(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=>_f(r,i)):_f(r,o)}return t.innerType._zod.run(r,n)}}),Ou=h("$ZodExactOptional",(e,t)=>{Dn.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)}),Zu=h("$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(`^(${we(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)}),Nu=h("$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=>$f(i,t)):$f(o,t)}});function $f(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}s($f,"handleDefaultResult");var Eu=h("$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))}),Cu=h("$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=>wf(i,e)):wf(o,e)}});function wf(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(wf,"handleNonOptionalResult");var Tu=h("$ZodSuccess",(e,t)=>{P.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie("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 bf(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>re(o,n,M()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}s(bf,"handleCatchResult");var Du=h("$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=>bf(r,i,t,n)):bf(r,o,t,n)}}),Ru=h("$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)}),Rn=h("$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(u=>$n(u,t.in,n)):$n(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>$n(i,t.out,n)):$n(o,t.out,n)}});function $n(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($n,"handlePipeResult");var yr=h("$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(u=>wn(u,t,n)):wn(i,t,n)}else{let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(u=>wn(u,t,n)):wn(i,t,n)}}});function wn(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=>bn(e,i,t.out,r)):bn(e,o,t.out,r)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>bn(e,i,t.in,r)):bn(e,o,t.in,r)}}s(wn,"handleCodecAResult");function bn(e,t,r,n){return e.issues.length?(e.aborted=!0,e):r._zod.run({value:t,issues:e.issues},n)}s(bn,"handleCodecTxResult");var Lu=h("$ZodPreprocess",(e,t)=>{Rn.init(e,t)}),ju=h("$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(vf):vf(o)}});function vf(e){return e.memo||(e.value=Object.freeze(e.value)),e}s(vf,"handleReadonlyResult");function jh(e){let t=e._zod.def,r=t.pattern,n=!!t.format?.includes("int"),o,i;for(let c of t.checks??[]){let a=c._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 ts({minimum:o,maximum:i}).source;let u=e._zod.pattern;return(n&&u===be?ur:u)?.source}s(jh,"leafPattern");function Zs(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=Zs(n);return r&&o&&i&&i!==o?r.replace(we(o),()=>we(i)):r}if(t.options){let o=t.options.map(Zs);if(o.every(Boolean))return`^(${o.map(i=>we(i)).join("|")})$`}return jh(e)}s(Zs,"partPattern");var Vu=h("$ZodTemplateLiteral",(e,t)=>{P.init(e,t);let r=[];for(let n of t.parts)if(typeof n=="object"&&n!==null){let o=Zs(n);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...n._zod.traits].shift()}`);r.push(we(o))}else if(n===null||mi.has(typeof n))r.push(ae(`${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)}),Mu=h("$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?rn(e._def.input,n):n,i=Reflect.apply(r,this,o);return e._def.output?rn(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 nn(e._def.input,n):n,i=await Reflect.apply(r,this,o);return e._def.output?await nn(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 Tn({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)),Fu=h("$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))}),_r=h("$ZodLazy",(e,t)=>{P.init(e,t),fi(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)}),Ku=h("$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=>xf(i,r,n,e));xf(o,r,n,e)}});function xf(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(ft(o))}}s(xf,"handleRefineResult");var Mn=class extends Error{static{s(this,"$ZodCyclicError")}constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Bu="~memo",Zf=[];function Nf(e){return e!==null&&typeof e=="object"}s(Nf,"isRef");function Uu(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}s(Uu,"cloneIssues");var Ef=new WeakMap,_t=0,Vn=1,$r=2;function wr(e,t,r){let n=Ef.get(e);if(n!==void 0)return n?$r:_t;if(t.has(e))return $r;t.add(e);let o=_t,i=s(f=>{if(o!==$r&&f?._zod){let p=wr(f,t,r);p>o&&(o=p)}},"check"),u=s((f,p)=>{let d=_t;for(let m of Reflect.ownKeys(f)){let g=Object.getOwnPropertyDescriptor(f,m);if(p&&!g.enumerable)continue;let y=g.get?Vn:g.value?._zod?wr(g.value,t,r):_t;y>d&&(d=y)}return d},"shape"),c=s(f=>{f>o&&(o=f)},"merge"),a=e._zod.def,l=a.type;switch(l){case"object":{let f=lt(a);c(f?u(f,!0):Vn),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);c(f?wr(f,t,!1):Vn);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 m of d)i(m)}}}return t.delete(e),Vh(e,o)}s(wr,"isRecursive");function Vh(e,t){return t!==Vn&&Ef.set(e,t===$r),t}s(Vh,"settle");function Fn(e){return wr(e,new Set,!0)!==_t}s(Fn,"isRecursiveSchema");function Mh(e,t){let r=e.buckets.get(t);return r||(r=new WeakMap,e.buckets.set(t,r)),r}s(Mh,"bucketFor");var Ln,jn=[],Fh={alloc(e,t,r){let n=Ln;if(!n)return r;Ln=void 0;let o={value:r,issues:null};return n.set(t.value,o),jn.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"&&Kn(i,o.value))throw new Mn;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 u=e._zod.parse,c=s((a,l)=>{if(r===void 0){let z=wr(e,new Set,!1);if(z===_t)return e._zod.parse=u,e._zod.run===c&&(e._zod.run=u),u(a,l);z===$r||n?r=!0:n=!0}let f=a.value;if(!Nf(f))return u(a,l);let p=l[Bu];p||(p={buckets:new WeakMap,backEdges:void 0},l[Bu]=p);let d;o===l?d=i:(d=Mh(p,e),o=l,i=d);let m=d.get(f);if(m)return a.value=m.value,m.issues?m.issues.length&&a.issues.push(...Uu(m.issues)):(a.memo=!0,p.backEdges??(p.backEdges=new WeakSet),p.backEdges.add(m.value)),a;Ln=d;let g=jn.length,y=u(a,l);Ln=void 0;let $=jn.length>g?jn.pop():void 0;return y instanceof Promise?y.then(z=>($&&($.issues=z.issues.length?Uu(z.issues):Zf),z)):($&&($.issues=y.issues.length?Uu(y.issues):Zf),y)},"wrapped");e._zod.parse=c,e._zod.run===u&&(e._zod.run=c)})}};function br(){return Fh}s(br,"memoizer");function Kn(e,t){let r=e[Bu]?.backEdges;return r!==void 0&&Nf(t)&&r.has(t)}s(Kn,"isBackEdge");var xr={};_e(xr,{en:()=>vr});var Kh=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,u){return i==="number"&&typeof u=="number"&&!Number.isFinite(u)?String(u):n[i]??i}return s(o,"getTypeName"),i=>{switch(i.code){case"invalid_type":{let u=o(i.expected),c=yi(i.input),a=o(c,i.input);return`Invalid input: expected ${u}, received ${a}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Hr(i.values[0])}`:`Invalid option: expected one of ${qr(i.values,"|")}`;case"too_big":{let u=i.exact?"exactly ":i.inclusive?"<=":"<",c=t(i.origin);return c?`Too big: expected ${i.origin??"value"} to have ${u}${i.maximum.toString()} ${c.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${u}${i.maximum.toString()}`}case"too_small":{let u=i.exact?"exactly ":i.inclusive?">=":">",c=t(i.origin);return c?`Too small: expected ${i.origin} to have ${u}${i.minimum.toString()} ${c.unit}`:`Too small: expected ${i.origin} to be ${u}${i.minimum.toString()}`}case"invalid_format":{let u=i;return u.format==="starts_with"?`Invalid string: must start with "${u.prefix}"`:u.format==="ends_with"?`Invalid string: must end with "${u.suffix}"`:u.format==="includes"?`Invalid string: must include "${u.includes}"`:u.format==="regex"?`Invalid string: must match pattern ${u.pattern}`:`Invalid ${r[u.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":""}: ${qr(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(c=>`'${c}'`).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 vr(){return{localeError:Kh()}}s(vr,"default");var Cf,Ju=Symbol("ZodOutput"),Gu=Symbol("ZodInput"),Un=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 Bn(){return new Un}s(Bn,"registry");(Cf=globalThis).__zod_globalRegistry??(Cf.__zod_globalRegistry=Bn());var G=globalThis.__zod_globalRegistry;var Y=Symbol.for("zod.compile.invalid"),Tf=Symbol.for("zod.compile.fallback"),pe=class extends Error{static{s(this,"ZodCompileAsyncError")}constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Z=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 Bh(e,t){try{return Gn(e,{assertOnly:!0})}catch{return t}}s(Bh,"compileValidator");function Hu(e,t){try{let r=Gn(e),n=Jn(e,r);return n._zod.bag.validator=Bh(e,r),n}catch(r){if(t?.strict)throw r;return e}}s(Hu,"compile");function Jn(e,t){if(Fn(e))throw new Z("a schema whose subtree contains a reference cycle");let r=C(e),n=e._zod.run,o=n.__originalRun??n,i=s((u,c)=>{if(c?.async||c?.direction==="backward"||c?.skipChecks||c?.[Tf]||c&&Kn(c,u.value))return o(u,c);let a=t(u.value);return a!==Y?(u.value=a,u):(c&&(c[Tf]=!0),o(u,c))},"wrapped");return i.__originalRun=o,r._zod.bag.fallbackRun=o,r._zod.bag.validator=t,r._zod.run=i,n.__originalRun||Jh(r,e,t),r}s(Jn,"withParser");function Jh(e,t,r){let n=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;n.safeParse=(u,c)=>{let a=r(u);return a!==Y?{success:!0,data:a}:i(u,c)}}if(typeof o.parse=="function"){let i=o.parse;n.parse=(u,c)=>{let a=r(u);return a!==Y?a:i(u,c)}}}s(Jh,"installCompiledUserMethods");function Gn(e,t){let r=!0;try{r=Fn(e)}catch{}if(r)throw new Z("a schema whose subtree contains a reference cycle");let n={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new Ke(["input"]),i=V(o,n,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let u=["INVALID",...n.constants.keys()],c=[Y,...n.constants.values()],a=o.content.join(`
|
|
63
63
|
`),l=t?.debug?u.length>0?`// Constants: ${u.join(", ")}
|
|
64
64
|
${a}`:a:"",f=Function,p=`return (input) => {
|
|
65
65
|
${a}
|
|
66
|
-
}`,d;try{d=new f(...u,p)(...c)}catch(m){throw new Z(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=n.definite,d}s(Gn,"compileFn");function S(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(S,"addConstant");function Ge(e,t){return e.definite=!1,S(e,t)}s(Ge,"addUserConstant");function k(e){return`v${e.varCounter++}`}s(k,"newVar");function Gh(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(Gh,"runtimeRun");function W(e,t,r,n,o=!0){let i=e.content.length,u=t.constants.size,c=t.constantCounter,a=t.varCounter;try{return V(e,t,r,n,o)}catch(l){if(!(l instanceof Z)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>u){let f=Array.from(t.constants.keys()).slice(u);for(let p of f)t.constants.delete(p)}return t.constantCounter=c,t.varCounter=a,qh(e,t,r,n)}}s(W,"compileChild");function qh(e,t,r,n){t.definite=!1;let o=S(t,r),i=S(t,Gh),u=k(t);return e.write(`const ${u} = ${i}(${o}, ${n});`),e.write(`if (${u} === INVALID) return INVALID;`),u}s(qh,"emitRuntimeIsland");var Wh=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Xh(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let u of o){let c=u._zod.def;if(c.when&&!Wh.has(c.check))throw new Z('check with a custom "when" condition');switch(c.check){case"greater_than":Hh(e,t,c,i);break;case"less_than":Yh(e,t,c,i);break;case"multiple_of":Qh(e,t,c,i);break;case"number_format":Mf(e,c,i);break;case"min_length":{let a=Be(c.minimum,"min_length"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length < ${c.minimum*2}`);e.write(`if (${l} < ${a}) return INVALID;`);break}case"max_length":{let a=Be(c.maximum,"max_length"),l=qu(e,t,i,`${i}.length > ${a}`);e.write(`if (${l} > ${a}) return INVALID;`);break}case"length_equals":{let a=Be(c.length,"length_equals"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length <= ${c.length*2}`);e.write(`if (${l} !== ${a}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Be(c.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Be(c.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Be(c.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Ff(e,t,c,i);break;case"custom":i=ig(e,t,u,i);break;case"bigint_format":eg(e,c,i);break;case"mime_type":tg(e,t,c,i);break;case"property":ng(e,t,c,i);break;case"properties":rg(e,t,c,i);break;case"overwrite":{let a=k(t);og(e,t,u,i,a),i=a;break}default:throw new Z(`check type ${c.check}`)}}return i}s(Xh,"generateChecks");function qu(e,t,r,n){let o=S(t,Me),i=k(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}s(qu,"codePointLengthVar");function Be(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Z(`${t} bound of type ${typeof e}`);return`${e}`}s(Be,"numericOperand");function Vf(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Z("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Z("comparison check with Invalid Date bound");return S(e,t)}throw new Z(`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 Yh(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${Vf(t,r.value)}) return INVALID;`)}s(Yh,"generateLessThanCheck");function Qh(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Z("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=S(t,qt);e.write(`if (${o}(${n}, ${Be(r.value,"multiple_of")}) !== 0) return INVALID;`)}}s(Qh,"generateMultipleOfCheck");function Mf(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 Z(`number format ${n}`)}}s(Mf,"generateNumberFormatCheck");function eg(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 Z(`bigint format ${n}`)}}s(eg,"generateBigIntFormatCheck");function tg(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=S(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}s(tg,"generateMimeTypeCheck");function rg(e,t,r,n){if(r.when)throw new Z('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 u=typeof i=="symbol"?S(t,i):X(i),c=k(t);e.write(`const ${c} = ${n}[${u}];`),W(e,t,o[i],c,!1)}}s(rg,"generatePropertiesChecks");function ng(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;V(e,t,r.schema,o)}s(ng,"generatePropertyCheck");function og(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new Z("overwrite check without a transform function");if(qe(i))throw new pe("z.compile: async overwrite transforms are not supported");let u=S(t,i);e.write(`const ${o} = ${u}(${n});`)}s(og,"generateOverwriteCheck");function Wu(){throw new ne}s(Wu,"throwAsync");function Yu(e){this.issues.push(e)}s(Yu,"pushIssue");function ig(e,t,r,n){let o=r._zod.def;if(o.fn){if(qe(o.fn))throw new pe("z.compile: async .refine() predicates are not supported");let i=Ge(t,o.fn),u=S(t,Wu),c=k(t);return e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`),n}if(r._zod.check){if(qe(r._zod.check))throw new pe("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,c=Ge(t,s(l=>{let f={value:l,issues:[],addIssue:Yu};return i(f)instanceof Promise&&Wu(),f.issues.length===0?f.value:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}throw new Z("custom check without a predicate or check function")}s(ig,"generateCustomRefineCheck");var sg=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 Ff(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=S(t,dr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=S(t,An);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=S(t,Nn),f=S(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=S(t,pr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=S(t,Pn);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=S(t,On);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=S(t,Zn);return e.write(`if (!${l}(${n})) return INVALID;`),n}let u=r;if(i==="url"||i==="httpurl"||u.normalize||u.hostname!==void 0||u.protocol!==void 0){let l=S(t,kn),f=S(t,r),p=k(t),d=k(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),u.hostname!==void 0){let y=S(t,zn);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(u.protocol!==void 0){let y=S(t,Sn);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=k(t),g=u.normalize?`${d}.href`:`${S(t,fr)}(${p})`;return e.write(`const ${m} = ${g};`),m}let c=r.fn;if(c){if(qe(c))throw new Z(`async string format ${i}`);let l=S(t,c);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(sg.has(i)&&r.pattern){let l=S(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 Z("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(${X(r.includes)})) return INVALID;`);break;case"starts_with":{let l=r.prefix;e.write(`if (${n}.slice(0, ${l.length}) !== ${X(l)}) return INVALID;`);break}case"ends_with":{let l=r.suffix;e.write(`if (${n}.slice(-${l.length}) !== ${X(l)}) return INVALID;`);break}default:throw new Z(`string format ${a}`)}return n}s(Ff,"generateStringFormatCheck");function V(e,t,r,n,o=!0){let i=r._zod.def,u=i.type;if(i.coerce)throw new Z(`coercion (z.coerce.${u}())`);let c=o||!!i.checks?.length,a;switch(u){case"string":a=ug(e,t,r,n,c);break;case"number":a=cg(e,r,n);break;case"boolean":a=ag(e,n);break;case"bigint":a=lg(e,r,n);break;case"symbol":a=fg(e,n);break;case"undefined":a=pg(e,n);break;case"null":a=dg(e,n);break;case"any":case"unknown":a=n;break;case"never":e.write("return INVALID;"),a=n;break;case"void":a=mg(e,n);break;case"nan":a=hg(e,n);break;case"date":a=gg(e,n);break;case"object":a=yg(e,t,r,n,c);break;case"optional":a=_g(e,t,r,n,c);break;case"nullable":a=bg(e,t,r,n,c);break;case"array":a=vg(e,t,r,n,c);break;case"literal":a=xg(e,t,r,n);break;case"enum":a=kg(e,t,r,n);break;case"readonly":{let l=Rf(e,t,r,n),f=k(t);e.write(`const ${f} = Object.freeze(${l});`),a=f;break}case"success":Rf(e,t,r,n),a="true";break;case"default":case"prefault":a=zg(e,t,r,n);break;case"nonoptional":a=Sg(e,t,r,n);break;case"tuple":a=Pg(e,t,r,n);break;case"union":a=Ig(e,t,r,n);break;case"intersection":a=Zg(e,t,r,n);break;case"record":a=Ng(e,t,r,n);break;case"map":a=Cg(e,t,r,n);break;case"set":a=Tg(e,t,r,n);break;case"file":a=Dg(e,n);break;case"template_literal":a=Rg(e,t,r,n);break;case"lazy":a=Lg(e,t,r,n);break;case"pipe":a=jg(e,t,r,n);break;case"custom":a=Vg(e,t,r,n);break;case"transform":a=Kg(e,t,r,n);break;case"catch":a=Fg(e,t,r,n);break;default:throw new Z(`schema type ${u}`)}return a===null?null:Xh(e,t,r,a)}s(V,"generateCheck");function ug(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:Ff(e,t,i,n,o)}s(ug,"generateStringCheck");function cg(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&&Mf(e,{format:n.format},r),r}s(cg,"generateNumberCheck");function ag(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}s(ag,"generateBooleanCheck");function lg(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(lg,"generateBigIntCheck");function fg(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}s(fg,"generateSymbolCheck");function pg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(pg,"generateUndefinedCheck");function dg(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}s(dg,"generateNullCheck");function mg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(mg,"generateVoidCheck");function hg(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}s(hg,"generateNaNCheck");function gg(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}s(gg,"generateDateCheck");function yg(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 u=i.shape,c=Object.keys(u),a=Object.getOwnPropertySymbols(u),l=a.length?[...c,...a]:c,f=s(x=>typeof x=="symbol"?S(t,x):X(x),"keyExpr"),p=s(x=>typeof x=="symbol"?`[${f(x)}]`:X(x),"propKey"),d=u;if(c.includes("__proto__"))throw new Z('object shape key "__proto__"');let m=new Map;for(let x of l){let I=d[x],E=f(x),j=k(t);if(e.write(`const ${j} = ${n}[${E}];`),I._zod.optin!==void 0){let N=k(t);e.write(`let ${N} = (() => {`),e.indented(q=>{let Jt=W(q,t,I,j);q.write(`return ${Jt};`)}),e.write("})();"),I._zod.optout==="optional"?(e.write(`if (${N} === INVALID) {`),e.indented(q=>{q.write(`if (${E} in ${n}) return INVALID;`),q.write(`${N} = undefined;`)}),e.write("}")):e.write(`if (${N} === INVALID) return INVALID;`),m.set(x,N)}else{wg(I)&&e.write(`if (!(${E} in ${n})) return INVALID;`);let N=W(e,t,I,j,o);N!==null&&m.set(x,N)}}let g=i.catchall,y="none";if(g){let x=g._zod.def.type;if(x==="never"){let I=c.map(E=>`k !== ${X(E)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(E=>{E.write(`if (${I}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let $=k(t),z=l.some(x=>Df(d[x])||Xu(d[x]));if(!o){if(y==="schema"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`);let E=k(t);I.write(`const ${E} = ${n}[k];`),W(I,t,g,E,!1)}),e.write("}")}return null}if(z){e.write(`const ${$} = {};`);for(let x of l){let I=f(x),E=m.get(x);Xu(d[x])?e.write(`if (${I} in ${n}) ${$}[${I}] = ${E};`):Df(d[x])?e.write(`if (${E} !== undefined || ${I} in ${n}) ${$}[${I}] = ${E};`):e.write(`${$}[${I}] = ${E};`)}}else{let x=l.map(I=>`${p(I)}: ${m.get(I)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(y!=="none"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{if(I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`),y==="passthrough")I.write(`${$}[k] = ${n}[k];`);else{let E=k(t);I.write(`const ${E} = ${n}[k];`);let j=W(I,t,g,E);I.write(`${$}[k] = ${j};`)}}),e.write("}")}return $}s(yg,"generateObjectCheck");function _g(e,t,r,n,o=!0){let i=r._zod.def;if($g(r))return V(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let c=k(t),a=k(t);return e.write(`let ${c};`),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) ${c} = ${a};`)}),e.write("} else {"),e.indented(l=>{let f=V(l,t,i.innerType,n);l.write(`${c} = ${f};`)}),e.write("}"),c}let u=o?k(t):null;return u&&e.write(`let ${u};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s(_g,"generateOptionalCheck");function $g(e){return e._zod.traits?.has("$ZodExactOptional")===!0}s($g,"isExactOptional");function wg(e){return e._zod.optin===void 0&&Je(e)}s(wg,"requiresPresenceCheck");function Je(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?Je(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?Je(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Je):!0;case"intersection":return!t.left||!t.right?!0:Je(t.left)&&Je(t.right);case"pipe":return t.in?Je(t.in):!0;default:return!0}}s(Je,"fastPathAcceptsAbsence");function Xu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}s(Xu,"dropsWhenAbsent");function Df(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&$t(e)}s(Df,"mayOmitUndefined");function $t(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?$t(t.innerType):!0;case"union":return t.options?t.options.some($t):!0;case"intersection":return!t.left||!t.right||$t(t.left)||$t(t.right);case"pipe":return t.out?$t(t.out):!0;default:return!0}}s($t,"mayOutputUndefined");function bg(e,t,r,n,o=!0){let i=r._zod.def,u=o?k(t):null;return u&&e.write(`let ${u} = null;`),e.write(`if (${n} !== null) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s(bg,"generateNullableCheck");function vg(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`);let u=o?k(t):null,c=k(t),a=k(t);return u&&e.write(`const ${u} = new Array(${n}.length);`),e.write(`for (let ${c} = 0; ${c} < ${n}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${a} = ${n}[${c}];`);let f=W(l,t,i.element,a,o);u&&f!==null&&l.write(`${u}[${c}] = ${f};`)}),e.write("}"),u}s(vg,"generateArrayCheck");function xg(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}let u=i[0];if(typeof u=="number"&&Number.isNaN(u)){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}if(typeof u=="string")e.write(`if (${n} !== ${X(u)}) return INVALID;`);else if(typeof u=="number"||typeof u=="boolean")e.write(`if (${n} !== ${u}) return INVALID;`);else if(u===null)e.write(`if (${n} !== null) return INVALID;`);else if(u===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof u=="bigint")e.write(`if (${n} !== ${u}n) return INVALID;`);else throw new Z(`literal type ${typeof u}`);return n}s(xg,"generateLiteralCheck");function kg(e,t,r,n){let o=r._zod.values;if(!o)throw new Z("enum schema without enumerated values");let i=S(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}s(kg,"generateEnumCheck");function Rf(e,t,r,n){let o=r._zod.def;return V(e,t,o.innerType,n)}s(Rf,"generateWrapperCheck");function zg(e,t,r,n){let o=r._zod.def,u=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!u)return V(e,t,o.innerType,n);let a=S(t,u),l=k(t);return e.write(`let ${l} = ${n};`),e.write(`if (${n} === undefined) ${l} = ${a}();`),V(e,t,o.innerType,l)}let c=k(t);if(u){let a=S(t,u),l=S(t,Wt);e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(f=>{f.write(`${c} = ${l}(${a}());`)}),e.write("} else {"),e.indented(f=>{let p=V(f,t,o.innerType,n);f.write(`${c} = ${p} === undefined ? ${l}(${a}()) : ${p};`)}),e.write("}")}else e.write(`let ${c};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let l=V(a,t,o.innerType,n);a.write(`${c} = ${l};`)}),e.write("}");return c}s(zg,"generateDefaultCheck");function Sg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.innerType,n),u=k(t);return e.write(`const ${u} = ${i};`),e.write(`if (${u} === undefined) return INVALID;`),u}s(Sg,"generateNonOptionalCheck");function Pg(e,t,r,n){let o=r._zod.def,i=o.items,u=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let c=Lf(i,"optin"),a=Lf(i,"optout");u?e.write(`if (${n}.length < ${c}) return INVALID;`):e.write(`if (${n}.length < ${c} || ${n}.length > ${i.length}) return INVALID;`);let l=k(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(m=>{let g=k(t);m.write(`const ${g} = ${n}[${f}];`);let y=W(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Xu(p)){m.write(`${l}.length = ${f};`);return}let g=k(t),y=k(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented($=>{let z=W($,t,p,g);$.write(`return ${z};`)}),m.write("})();"),m.write(`if (${y} === INVALID || ${y} === undefined) ${l}.length = ${f};`),m.write(`else ${l}[${f}] = ${y};`)}),d.write("}")}),e.write("}");else{let d=k(t);e.write(`const ${d} = ${n}[${f}];`);let m=W(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(u){let f=k(t),p=k(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${n}[${f}];`);let m=W(d,t,u,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}s(Pg,"generateTupleCheck");function Lf(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(Lf,"getTupleOptStart");function Ig(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Ag(e,t,o,n);if(o.inclusive===!1)throw new Z("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=S(t,a);return e.write(`if (!${l}.has(${n})) return INVALID;`),n}let c=k(t);e.write(`let ${c};`);for(let a=0;a<i.length;a++){let l=i[a];a===0?e.write(`${c} = (() => {`):e.write(`if (${c} === INVALID) ${c} = (() => {`),e.indented(f=>{let p=V(f,t,l,n);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${c} === INVALID) return INVALID;`),c}s(Ig,"generateUnionCheck");function Ag(e,t,r,n){if(r.unionFallback)throw new Z("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=k(t),i=k(t);e.write(`const ${o} = ${n}?.[${X(r.discriminator)}];`),e.write(`let ${i};`);let u=!0,c=new Set;for(let a of r.options){let l=a._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new Z("discriminated union option without static discriminator values");for(let d of l){if(c.has(d))throw new Z(`duplicate discriminator value ${String(d)}`);c.add(d)}let f=Array.from(l,d=>Og(t,o,d)),p=u?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=V(d,t,a,n);d.write(`${i} = ${m};`)}),e.write("}"),u=!1}return e.write("else { return INVALID; }"),i}s(Ag,"generateDiscriminatedUnionCheck");function Og(e,t,r){if(typeof r=="string")return`${t} === ${X(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=S(e,r);return`${t} === ${n}`}throw new Z(`literal discriminator value ${String(r)}`)}s(Og,"literalEquality");function Zg(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=W(e,t,o.left,n),u=W(e,t,o.right,n),c=S(t,yt),a=k(t);return e.write(`const ${a} = ${c}(${i}, ${u});`),e.write(`if (!${a}.valid) return INVALID;`),`${a}.data`}s(Zg,"generateIntersectionCheck");function Ng(e,t,r,n){let o=r._zod.def,i=S(t,ce);e.write(`if (!${i}(${n})) return INVALID;`);let u=k(t),c=k(t),a=k(t);e.write(`const ${u} = {};`);let l=o,f=l.partial?void 0:o.keyType._zod.values;if(f){let m=[];for(let y of f){if(!(typeof y=="string"||typeof y=="number"||typeof y=="symbol"))throw new Z(`record key value ${String(y)}`);let $=typeof y=="number"?y.toString():y;if($==="__proto__")throw new Z('record key "__proto__"');m.push($);let z=S(t,y),x=V(e,t,o.keyType,z),I=k(t);e.write(`const ${I} = ${n}[${Eg(t,$)}];`);let E=W(e,t,o.valueType,I);e.write(`${u}[${x}] = ${E};`)}let g=S(t,new Set(m));return e.write(`for (const ${c} in ${n}) {`),e.indented(y=>{y.write(`if (${g}.has(${c})) continue;`),l.mode==="loose"?y.write(`if (${c} !== "__proto__") ${u}[${c}] = ${n}[${c}];`):y.write("return INVALID;")}),e.write("}"),u}let p=o.keyType._zod.def;if(!(p.type==="string"&&p.format===void 0&&!p.coerce&&(p.checks?.length??0)===0)){let m=o.mode==="loose",g=Gn(o.keyType);g.definite===!1&&(t.definite=!1);let y=S(t,g),$=S(t,ve),z=k(t);return jf(e,t,n,c,x=>{x.write(`let ${z} = ${y}(${c});`),x.write(`if (${z} === INVALID && typeof ${c} === "string" && ${$}.test(${c})) ${z} = ${y}(Number(${c}));`),m?x.write(`if (${z} === INVALID) { ${u}[${c}] = ${n}[${c}]; continue; }`):x.write(`if (${z} === INVALID) return INVALID;`),x.write(`if (${z} === "__proto__") continue;`);let I=k(t);x.write(`const ${I} = ${n}[${c}];`);let E=W(x,t,o.valueType,I);x.write(`${u}[${z}] = ${E};`)}),u}return jf(e,t,n,c,m=>{m.write(`const ${a} = ${n}[${c}];`);let g=W(m,t,o.valueType,a);m.write(`${u}[${c}] = ${g};`)},"return INVALID;"),u}s(Ng,"generateRecordCheck");function jf(e,t,r,n,o,i){let u=S(t,Object.prototype.propertyIsEnumerable),c=k(t),a=k(t),l=k(t);e.write(`const ${c} = 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__" || !${u}.call(${r}, ${n})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${c}[${l}];`),f.write(`if (!${u}.call(${r}, ${n})) continue;`),i?f.write(i):o(f)}),e.write("}")}s(jf,"emitOwnKeys");function Eg(e,t){return typeof t=="string"?X(t):S(e,t)}s(Eg,"literalPropertyKey");function Cg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`);let i=k(t),u=k(t),c=k(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${u}, ${c}] of ${n}) {`),e.indented(a=>{let l=V(a,t,o.keyType,u),f=V(a,t,o.valueType,c);a.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}s(Cg,"generateMapCheck");function Tg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`);let i=k(t),u=k(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${u} of ${n}) {`),e.indented(c=>{let a=V(c,t,o.valueType,u);c.write(`${i}.add(${a});`)}),e.write("}"),i}s(Tg,"generateSetCheck");function Dg(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}s(Dg,"generateFileCheck");function Rg(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=S(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}s(Rg,"generateTemplateLiteralCheck");function Lg(e,t,r,n){let o=r._zod.def,i=Ge(t,o.getter),u=S(t,{parser:null});e.write(`if (!${u}.parser) {`),e.indented(a=>{a.write(`const inner = ${i}();`),a.write(`${u}.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 c=k(t);return e.write(`const ${c} = ${u}.parser(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}s(Lg,"generateLazyCheck");function jg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.in,n);if(o.transform){if(qe(o.transform))throw new pe("z.compile: async transforms in pipes are not supported");let u=o.transform,a=Ge(t,s(f=>{let p={value:f,issues:[],addIssue:Yu},d=u(f,p);return d instanceof Promise?Y:p.issues.length===0?d:Y},"helperFn")),l=k(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(jg,"generatePipeCheck");function qe(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}s(qe,"isAsyncFunction");function Vg(e,t,r,n){let o=r._zod.def;if(o.fn){if(qe(o.fn))throw new pe("z.compile: async custom predicates are not supported");let i=Ge(t,o.fn),u=S(t,Wu),c=k(t);e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`)}else throw new Z("custom schema without a predicate function");return n}s(Vg,"generateCustomCheck");function Mg(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(Mg,"runtimeCatch");function Fg(e,t,r,n){let o=r._zod.def;if(!o.catchValue[en])throw new Z("catch with a callback (only a constant catch value compiles)",!1);let i=k(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=W(l,t,o.innerType,n);l.write(`return ${f};`)}),e.write("})();");let u=S(t,o.innerType),c=Ge(t,o.catchValue),a=S(t,Mg);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${a}(${u}, ${c}, ${n});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}s(Fg,"generateCatchCheck");function Kg(e,t,r,n){let o=r._zod.def;if(o.transform){if(qe(o.transform))throw new pe("z.compile: async transforms are not supported");let i=o.transform,c=Ge(t,s(l=>{let f={value:l,issues:[],addIssue:Yu},p=i(l,f);return p instanceof Promise?Y:f.issues.length===0?p:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}return n}s(Kg,"generateTransformCheck");function qn(e){return e.checks&&(e.checks=[...e.checks]),e}s(qn,"snapshotChecks");function Qu(e,t){return new e(qn({type:"string",..._(t)}))}s(Qu,"_string");function ec(e,t){return new e(qn({type:"string",coerce:!0,..._(t)}))}s(ec,"_coercedString");function Wn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}s(Wn,"_email");function Xn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}s(Xn,"_guid");function Hn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}s(Hn,"_uuid");function Yn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}s(Yn,"_uuidv4");function Qn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}s(Qn,"_uuidv6");function eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}s(eo,"_uuidv7");function kr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}s(kr,"_url");function to(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}s(to,"_emoji");function ro(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}s(ro,"_nanoid");function no(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}s(no,"_cuid");function oo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}s(oo,"_cuid2");function io(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}s(io,"_ulid");function so(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}s(so,"_xid");function uo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}s(uo,"_ksuid");function co(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}s(co,"_ipv4");function ao(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}s(ao,"_ipv6");function tc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}s(tc,"_mac");function lo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}s(lo,"_cidrv4");function fo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}s(fo,"_cidrv6");function po(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}s(po,"_base64");function mo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}s(mo,"_base64url");function ho(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}s(ho,"_e164");function rc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}s(rc,"_creditCard");function nc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}s(nc,"_iban");function go(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}s(go,"_jwt");var oc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function zr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}s(zr,"_isoDateTime");function Sr(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}s(Sr,"_isoDate");function Pr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}s(Pr,"_isoTime");function Ir(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}s(Ir,"_isoDuration");function ic(e,t){return new e(qn({type:"number",checks:[],..._(t)}))}s(ic,"_number");function sc(e,t){return new e(qn({type:"number",coerce:!0,checks:[],..._(t)}))}s(sc,"_coercedNumber");function uc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}s(uc,"_int");function cc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}s(cc,"_float32");function ac(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}s(ac,"_float64");function lc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}s(lc,"_int32");function fc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}s(fc,"_uint32");function pc(e,t){return new e({type:"boolean",..._(t)})}s(pc,"_boolean");function dc(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}s(dc,"_coercedBoolean");function mc(e,t){return new e({type:"bigint",..._(t)})}s(mc,"_bigint");function hc(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}s(hc,"_coercedBigint");function gc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}s(gc,"_int64");function yc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}s(yc,"_uint64");function _c(e,t){return new e({type:"symbol",..._(t)})}s(_c,"_symbol");function $c(e,t){return new e({type:"undefined",..._(t)})}s($c,"_undefined");function wc(e,t){return new e({type:"null",..._(t)})}s(wc,"_null");function bc(e){return new e({type:"any"})}s(bc,"_any");function vc(e){return new e({type:"unknown"})}s(vc,"_unknown");function xc(e,t){return new e({type:"never",..._(t)})}s(xc,"_never");function kc(e,t){return new e({type:"void",..._(t)})}s(kc,"_void");function zc(e,t){return new e({type:"date",..._(t)})}s(zc,"_date");function Sc(e,t){return new e({type:"date",coerce:!0,..._(t)})}s(Sc,"_coercedDate");function Pc(e,t){return new e({type:"nan",..._(t)})}s(Pc,"_nan");function me(e,t){return new yn({check:"less_than",..._(t),value:e,inclusive:!1})}s(me,"_lt");function se(e,t){return new yn({check:"less_than",..._(t),value:e,inclusive:!0})}s(se,"_lte");function he(e,t){return new _n({check:"greater_than",..._(t),value:e,inclusive:!1})}s(he,"_gt");function ue(e,t){return new _n({check:"greater_than",..._(t),value:e,inclusive:!0})}s(ue,"_gte");function yo(e){return he(0,e)}s(yo,"_positive");function _o(e){return me(0,e)}s(_o,"_negative");function $o(e){return se(0,e)}s($o,"_nonpositive");function wo(e){return ue(0,e)}s(wo,"_nonnegative");function Ae(e,t){return new fs({check:"multiple_of",..._(t),value:e})}s(Ae,"_multipleOf");function Oe(e,t){return new ms({check:"max_size",..._(t),maximum:e})}s(Oe,"_maxSize");function ge(e,t){return new hs({check:"min_size",..._(t),minimum:e})}s(ge,"_minSize");function We(e,t){return new gs({check:"size_equals",..._(t),size:e})}s(We,"_size");function Xe(e,t){return new ys({check:"max_length",..._(t),maximum:e})}s(Xe,"_maxLength");function xe(e,t){return new _s({check:"min_length",..._(t),minimum:e})}s(xe,"_minLength");function He(e,t){return new $s({check:"length_equals",..._(t),length:e})}s(He,"_length");function wt(e,t){return new ws({check:"string_format",format:"regex",..._(t),pattern:e})}s(wt,"_regex");function bt(e){return new bs({check:"string_format",format:"lowercase",..._(e)})}s(bt,"_lowercase");function vt(e){return new vs({check:"string_format",format:"uppercase",..._(e)})}s(vt,"_uppercase");function xt(e,t){return new xs({check:"string_format",format:"includes",..._(t),includes:e})}s(xt,"_includes");function kt(e,t){return new ks({check:"string_format",format:"starts_with",..._(t),prefix:e})}s(kt,"_startsWith");function zt(e,t){return new zs({check:"string_format",format:"ends_with",..._(t),suffix:e})}s(zt,"_endsWith");function bo(e,t,r){return new Ss({check:"property",property:e,schema:t,..._(r)})}s(bo,"_property");function St(e,t){return new Ps({check:"properties",shape:e,..._(t)})}s(St,"_properties");function Pt(e,t){return new Is({check:"mime_type",mime:e,..._(t)})}s(Pt,"_mime");function de(e){return new As({check:"overwrite",tx:e})}s(de,"_overwrite");function It(e){return de(t=>t.normalize(e))}s(It,"_normalize");function At(){return de(e=>e.trim())}s(At,"_trim");function Ot(){return de(e=>e.toLowerCase())}s(Ot,"_toLowerCase");function Zt(){return de(e=>e.toUpperCase())}s(Zt,"_toUpperCase");function Nt(){return de(e=>pi(e))}s(Nt,"_slugify");function Ic(e,t,r){return new e({type:"array",element:t,..._(r)})}s(Ic,"_array");function Ug(e,t,r){return new e({type:"union",options:t,..._(r)})}s(Ug,"_union");function Bg(e,t,r){return new e({type:"union",options:t,inclusive:!1,..._(r)})}s(Bg,"_xor");function Jg(e,t,r,n){return new e({type:"union",options:r,discriminator:t,..._(n)})}s(Jg,"_discriminatedUnion");function Gg(e,t,r){return new e({type:"intersection",left:t,right:r})}s(Gg,"_intersection");function qg(e,t,r,n){let o=r instanceof P,i=o?n:r,u=o?r:null;return new e({type:"tuple",items:t,rest:u,..._(i)})}s(qg,"_tuple");function Wg(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,..._(n)})}s(Wg,"_record");function Xg(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,..._(n)})}s(Xg,"_map");function Hg(e,t,r){return new e({type:"set",valueType:t,..._(r)})}s(Hg,"_set");function Yg(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,..._(r)})}s(Yg,"_enum");function Qg(e,t,r){return new e({type:"enum",entries:t,..._(r)})}s(Qg,"_nativeEnum");function ey(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(r)})}s(ey,"_literal");function Ac(e,t){return new e({type:"file",..._(t)})}s(Ac,"_file");function ty(e,t){return new e({type:"transform",transform:t})}s(ty,"_transform");function ry(e,t){return new e({type:"optional",innerType:t})}s(ry,"_optional");function ny(e,t){return new e({type:"nullable",innerType:t})}s(ny,"_nullable");function oy(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Wt(r)}})}s(oy,"_default");function iy(e,t,r){return new e({type:"nonoptional",innerType:t,..._(r)})}s(iy,"_nonoptional");function sy(e,t){return new e({type:"success",innerType:t})}s(sy,"_success");function uy(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:$i(r)})}s(uy,"_catch");function cy(e,t,r){return new e({type:"pipe",in:t,out:r})}s(cy,"_pipe");function ay(e,t){return new e({type:"readonly",innerType:t})}s(ay,"_readonly");function ly(e,t,r){return new e({type:"template_literal",parts:t,..._(r)})}s(ly,"_templateLiteral");function fy(e,t){return new e({type:"lazy",getter:t})}s(fy,"_lazy");function py(e,t){return new e({type:"promise",innerType:t})}s(py,"_promise");function Oc(e,t,r){let n=_(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}s(Oc,"_custom");function Zc(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}s(Zc,"_refine");function Nc(e,t){let r=Kf(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ft(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(ft(i))}},e(n.value,n)),t);return r}s(Nc,"_superRefine");function Kf(e,t){let r=new L({check:"custom",..._(t)});return r._zod.check=e,r}s(Kf,"_check");function Ec(e){let t=new L({check:"describe"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,description:e})}],t._zod.check=()=>{},t}s(Ec,"describe");function Cc(e){let t=new L({check:"meta"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,...e})}],t._zod.check=()=>{},t}s(Cc,"meta");function Tc(e,t){let r=_(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(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),u=new Set(o),c=e.Codec??yr,a=e.Boolean??hr,l=e.String??Ue,f=new l({type:"string",error:r.error}),p=new a({type:"boolean",error:r.error}),d=new c({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:u.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...u],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!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(Tc,"_stringbool");function Ye(e,t,r,n={}){let o=_(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}s(Ye,"_stringFormat");function Ar(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(Ar,"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??G,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 K(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(K,"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 u={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,u),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)u.schema=c;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,f);else{let d=u.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,f)}let p=e._zod.parent;p&&(u.ref||(u.ref=p),D(p,t,f),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Ar(u.schema,a),t.io==="input"&&Q(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&"_prefault"in u.schema&&((n=u.schema).default??(n.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}s(D,"processSchema");function Uf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}s(Uf,"encodeJSONPointerSegment");function Ne(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 u of e.seen.entries()){let c=e.metadataRegistry.get(u[0])?.id;if(c){let a=n.get(c);if(a&&a!==u[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,u[0])}}let o=s(u=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(u[0])?.id,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Uf(m)}`}}let a="#",l=`${a}/${c}/`;if(u[1]===r&&!u[1].schema.id)return{ref:a};let f=u[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+Uf(f)}},"makeURI"),i=s(u=>{if(u[1].schema.$ref)return;let c=u[1],{ref:a,defId:l}=o(u);c.def={...c.schema},l&&(c.defId=l);let f=c.schema;for(let p in f)delete f[p];f.$ref=a},"extractToDef");if(e.cycles==="throw")for(let u of e.seen.entries()){let c=u[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
66
|
+
}`,d;try{d=new f(...u,p)(...c)}catch(m){throw new Z(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=l),d.definite=n.definite,d}s(Gn,"compileFn");function S(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(S,"addConstant");function Ge(e,t){return e.definite=!1,S(e,t)}s(Ge,"addUserConstant");function k(e){return`v${e.varCounter++}`}s(k,"newVar");function Gh(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(Gh,"runtimeRun");function W(e,t,r,n,o=!0){let i=e.content.length,u=t.constants.size,c=t.constantCounter,a=t.varCounter;try{return V(e,t,r,n,o)}catch(l){if(!(l instanceof Z)||!l.islandable)throw l;if(e.content.length=i,t.constants.size>u){let f=Array.from(t.constants.keys()).slice(u);for(let p of f)t.constants.delete(p)}return t.constantCounter=c,t.varCounter=a,qh(e,t,r,n)}}s(W,"compileChild");function qh(e,t,r,n){t.definite=!1;let o=S(t,r),i=S(t,Gh),u=k(t);return e.write(`const ${u} = ${i}(${o}, ${n});`),e.write(`if (${u} === INVALID) return INVALID;`),u}s(qh,"emitRuntimeIsland");var Wh=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function Xh(e,t,r,n){let o=r._zod.def.checks;if(!o||o.length===0)return n;let i=n;for(let u of o){let c=u._zod.def;if(c.when&&!Wh.has(c.check))throw new Z('check with a custom "when" condition');switch(c.check){case"greater_than":Hh(e,t,c,i);break;case"less_than":Yh(e,t,c,i);break;case"multiple_of":Qh(e,t,c,i);break;case"number_format":Mf(e,c,i);break;case"min_length":{let a=Be(c.minimum,"min_length"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length < ${c.minimum*2}`);e.write(`if (${l} < ${a}) return INVALID;`);break}case"max_length":{let a=Be(c.maximum,"max_length"),l=qu(e,t,i,`${i}.length > ${a}`);e.write(`if (${l} > ${a}) return INVALID;`);break}case"length_equals":{let a=Be(c.length,"length_equals"),l=qu(e,t,i,`${i}.length >= ${a} && ${i}.length <= ${c.length*2}`);e.write(`if (${l} !== ${a}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${Be(c.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${Be(c.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${Be(c.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Ff(e,t,c,i);break;case"custom":i=ig(e,t,u,i);break;case"bigint_format":eg(e,c,i);break;case"mime_type":tg(e,t,c,i);break;case"property":ng(e,t,c,i);break;case"properties":rg(e,t,c,i);break;case"overwrite":{let a=k(t);og(e,t,u,i,a),i=a;break}default:throw new Z(`check type ${c.check}`)}}return i}s(Xh,"generateChecks");function qu(e,t,r,n){let o=S(t,Me),i=k(t);return e.write(`const ${i} = typeof ${r} === "string" && ${n} ? ${o}(${r}) : ${r}.length;`),i}s(qu,"codePointLengthVar");function Be(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Z(`${t} bound of type ${typeof e}`);return`${e}`}s(Be,"numericOperand");function Vf(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new Z("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new Z("comparison check with Invalid Date bound");return S(e,t)}throw new Z(`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 Yh(e,t,r,n){let o=r.inclusive?">":">=";e.write(`if (${n} ${o} ${Vf(t,r.value)}) return INVALID;`)}s(Yh,"generateLessThanCheck");function Qh(e,t,r,n){if(typeof r.value=="bigint"){if(r.value===BigInt(0))throw new Z("multiple_of check with a zero divisor");e.write(`if (${n} % ${r.value}n !== 0n) return INVALID;`)}else{let o=S(t,qt);e.write(`if (${o}(${n}, ${Be(r.value,"multiple_of")}) !== 0) return INVALID;`)}}s(Qh,"generateMultipleOfCheck");function Mf(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 Z(`number format ${n}`)}}s(Mf,"generateNumberFormatCheck");function eg(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 Z(`bigint format ${n}`)}}s(eg,"generateBigIntFormatCheck");function tg(e,t,r,n){let o=r.mime;if(o&&o.length>0){let i=S(t,new Set(o));e.write(`if (!${i}.has(${n}.type)) return INVALID;`)}}s(tg,"generateMimeTypeCheck");function rg(e,t,r,n){if(r.when)throw new Z('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 u=typeof i=="symbol"?S(t,i):X(i),c=k(t);e.write(`const ${c} = ${n}[${u}];`),W(e,t,o[i],c,!1)}}s(rg,"generatePropertiesChecks");function ng(e,t,r,n){let o=`${n}[${JSON.stringify(r.property)}]`;V(e,t,r.schema,o)}s(ng,"generatePropertyCheck");function og(e,t,r,n,o){let i=r._zod.def.tx;if(!i)throw new Z("overwrite check without a transform function");if(qe(i))throw new pe("z.compile: async overwrite transforms are not supported");let u=S(t,i);e.write(`const ${o} = ${u}(${n});`)}s(og,"generateOverwriteCheck");function Wu(){throw new ne}s(Wu,"throwAsync");function Yu(e){this.issues.push(e)}s(Yu,"pushIssue");function ig(e,t,r,n){let o=r._zod.def;if(o.fn){if(qe(o.fn))throw new pe("z.compile: async .refine() predicates are not supported");let i=Ge(t,o.fn),u=S(t,Wu),c=k(t);return e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`),n}if(r._zod.check){if(qe(r._zod.check))throw new pe("z.compile: async .superRefine() / check functions are not supported");let i=r._zod.check,c=Ge(t,s(l=>{let f={value:l,issues:[],addIssue:Yu};return i(f)instanceof Promise&&Wu(),f.issues.length===0?f.value:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}throw new Z("custom check without a predicate or check function")}s(ig,"generateCustomRefineCheck");var sg=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 Ff(e,t,r,n,o=!0){let i=r.format;if(i==="base64"){let l=S(t,dr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="base64url"){let l=S(t,An);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="jwt"){let l=S(t,Nn),f=S(t,r.alg??null);return e.write(`if (!${l}(${n}, ${f})) return INVALID;`),n}if(i==="ipv6"){let l=S(t,pr);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="cidrv6"){let l=S(t,Pn);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="credit_card"){let l=S(t,On);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(i==="iban"){let l=S(t,Zn);return e.write(`if (!${l}(${n})) return INVALID;`),n}let u=r;if(i==="url"||i==="httpurl"||u.normalize||u.hostname!==void 0||u.protocol!==void 0){let l=S(t,kn),f=S(t,r),p=k(t),d=k(t);if(e.write(`const ${p} = ${n}.trim();`),e.write(`const ${d} = ${l}(${p}, ${f});`),e.write(`if (typeof ${d} === "number") return INVALID;`),u.hostname!==void 0){let y=S(t,zn);e.write(`if (!${y}(${d}, ${f}.hostname)) return INVALID;`)}if(u.protocol!==void 0){let y=S(t,Sn);e.write(`if (!${y}(${d}, ${f}.protocol)) return INVALID;`)}if(!o)return null;let m=k(t),g=u.normalize?`${d}.href`:`${S(t,fr)}(${p})`;return e.write(`const ${m} = ${g};`),m}let c=r.fn;if(c){if(qe(c))throw new Z(`async string format ${i}`);let l=S(t,c);return e.write(`if (!${l}(${n})) return INVALID;`),n}if(sg.has(i)&&r.pattern){let l=S(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 Z("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(${X(r.includes)})) return INVALID;`);break;case"starts_with":{let l=r.prefix;e.write(`if (${n}.slice(0, ${l.length}) !== ${X(l)}) return INVALID;`);break}case"ends_with":{let l=r.suffix;e.write(`if (${n}.slice(-${l.length}) !== ${X(l)}) return INVALID;`);break}default:throw new Z(`string format ${a}`)}return n}s(Ff,"generateStringFormatCheck");function V(e,t,r,n,o=!0){let i=r._zod.def,u=i.type;if(i.coerce)throw new Z(`coercion (z.coerce.${u}())`);let c=o||!!i.checks?.length,a;switch(u){case"string":a=ug(e,t,r,n,c);break;case"number":a=cg(e,r,n);break;case"boolean":a=ag(e,n);break;case"bigint":a=lg(e,r,n);break;case"symbol":a=fg(e,n);break;case"undefined":a=pg(e,n);break;case"null":a=dg(e,n);break;case"any":case"unknown":a=n;break;case"never":e.write("return INVALID;"),a=n;break;case"void":a=mg(e,n);break;case"nan":a=hg(e,n);break;case"date":a=gg(e,n);break;case"object":a=yg(e,t,r,n,c);break;case"optional":a=_g(e,t,r,n,c);break;case"nullable":a=bg(e,t,r,n,c);break;case"array":a=vg(e,t,r,n,c);break;case"literal":a=xg(e,t,r,n);break;case"enum":a=kg(e,t,r,n);break;case"readonly":{let l=Rf(e,t,r,n),f=k(t);e.write(`const ${f} = Object.freeze(${l});`),a=f;break}case"success":Rf(e,t,r,n),a="true";break;case"default":case"prefault":a=zg(e,t,r,n);break;case"nonoptional":a=Sg(e,t,r,n);break;case"tuple":a=Pg(e,t,r,n);break;case"union":a=Ig(e,t,r,n);break;case"intersection":a=Zg(e,t,r,n);break;case"record":a=Ng(e,t,r,n);break;case"map":a=Cg(e,t,r,n);break;case"set":a=Tg(e,t,r,n);break;case"file":a=Dg(e,n);break;case"template_literal":a=Rg(e,t,r,n);break;case"lazy":a=Lg(e,t,r,n);break;case"pipe":a=jg(e,t,r,n);break;case"custom":a=Vg(e,t,r,n);break;case"transform":a=Kg(e,t,r,n);break;case"catch":a=Fg(e,t,r,n);break;default:throw new Z(`schema type ${u}`)}return a===null?null:Xh(e,t,r,a)}s(V,"generateCheck");function ug(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:Ff(e,t,i,n,o)}s(ug,"generateStringCheck");function cg(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&&Mf(e,{format:n.format},r),r}s(cg,"generateNumberCheck");function ag(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}s(ag,"generateBooleanCheck");function lg(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(lg,"generateBigIntCheck");function fg(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}s(fg,"generateSymbolCheck");function pg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(pg,"generateUndefinedCheck");function dg(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}s(dg,"generateNullCheck");function mg(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}s(mg,"generateVoidCheck");function hg(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}s(hg,"generateNaNCheck");function gg(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}s(gg,"generateDateCheck");function yg(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 u=i.shape,c=Object.keys(u),a=Object.getOwnPropertySymbols(u),l=a.length?[...c,...a]:c,f=s(x=>typeof x=="symbol"?S(t,x):X(x),"keyExpr"),p=s(x=>typeof x=="symbol"?`[${f(x)}]`:X(x),"propKey"),d=u;if(c.includes("__proto__"))throw new Z('object shape key "__proto__"');let m=new Map;for(let x of l){let I=d[x],E=f(x),j=k(t);if(e.write(`const ${j} = ${n}[${E}];`),I._zod.optin!==void 0){let N=k(t);e.write(`let ${N} = (() => {`),e.indented(q=>{let Jt=W(q,t,I,j);q.write(`return ${Jt};`)}),e.write("})();"),I._zod.optout==="optional"?(e.write(`if (${N} === INVALID) {`),e.indented(q=>{q.write(`if (${E} in ${n}) return INVALID;`),q.write(`${N} = undefined;`)}),e.write("}")):e.write(`if (${N} === INVALID) return INVALID;`),m.set(x,N)}else{wg(I)&&e.write(`if (!(${E} in ${n})) return INVALID;`);let N=W(e,t,I,j,o);N!==null&&m.set(x,N)}}let g=i.catchall,y="none";if(g){let x=g._zod.def.type;if(x==="never"){let I=c.map(E=>`k !== ${X(E)}`).join(" && ")||"true";e.write(`for (const k in ${n}) {`),e.indented(E=>{E.write(`if (${I}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?y="passthrough":y="schema"}let $=k(t),z=l.some(x=>Df(d[x])||Xu(d[x]));if(!o){if(y==="schema"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`);let E=k(t);I.write(`const ${E} = ${n}[k];`),W(I,t,g,E,!1)}),e.write("}")}return null}if(z){e.write(`const ${$} = {};`);for(let x of l){let I=f(x),E=m.get(x);Xu(d[x])?e.write(`if (${I} in ${n}) ${$}[${I}] = ${E};`):Df(d[x])?e.write(`if (${E} !== undefined || ${I} in ${n}) ${$}[${I}] = ${E};`):e.write(`${$}[${I}] = ${E};`)}}else{let x=l.map(I=>`${p(I)}: ${m.get(I)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(y!=="none"){let x=c.length>0?S(t,new Set(c)):null;e.write(`for (const k in ${n}) {`),e.indented(I=>{if(I.write('if (k === "__proto__") continue;'),x&&I.write(`if (${x}.has(k)) continue;`),y==="passthrough")I.write(`${$}[k] = ${n}[k];`);else{let E=k(t);I.write(`const ${E} = ${n}[k];`);let j=W(I,t,g,E);I.write(`${$}[k] = ${j};`)}}),e.write("}")}return $}s(yg,"generateObjectCheck");function _g(e,t,r,n,o=!0){let i=r._zod.def;if($g(r))return V(e,t,i.innerType,n,o);if(i.innerType._zod.optin==="defaulted"){let c=k(t),a=k(t);return e.write(`let ${c};`),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) ${c} = ${a};`)}),e.write("} else {"),e.indented(l=>{let f=V(l,t,i.innerType,n);l.write(`${c} = ${f};`)}),e.write("}"),c}let u=o?k(t):null;return u&&e.write(`let ${u};`),e.write(`if (${n} !== undefined) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s(_g,"generateOptionalCheck");function $g(e){return e._zod.traits?.has("$ZodExactOptional")===!0}s($g,"isExactOptional");function wg(e){return e._zod.optin===void 0&&Je(e)}s(wg,"requiresPresenceCheck");function Je(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?Je(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?Je(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(Je):!0;case"intersection":return!t.left||!t.right?!0:Je(t.left)&&Je(t.right);case"pipe":return t.in?Je(t.in):!0;default:return!0}}s(Je,"fastPathAcceptsAbsence");function Xu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}s(Xu,"dropsWhenAbsent");function Df(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&$t(e)}s(Df,"mayOmitUndefined");function $t(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?$t(t.innerType):!0;case"union":return t.options?t.options.some($t):!0;case"intersection":return!t.left||!t.right||$t(t.left)||$t(t.right);case"pipe":return t.out?$t(t.out):!0;default:return!0}}s($t,"mayOutputUndefined");function bg(e,t,r,n,o=!0){let i=r._zod.def,u=o?k(t):null;return u&&e.write(`let ${u} = null;`),e.write(`if (${n} !== null) {`),e.indented(c=>{let a=V(c,t,i.innerType,n,o);u&&a!==null&&c.write(`${u} = ${a};`)}),e.write("}"),u}s(bg,"generateNullableCheck");function vg(e,t,r,n,o=!0){let i=r._zod.def;e.write(`if (!Array.isArray(${n})) return INVALID;`);let u=o?k(t):null,c=k(t),a=k(t);return u&&e.write(`const ${u} = new Array(${n}.length);`),e.write(`for (let ${c} = 0; ${c} < ${n}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${a} = ${n}[${c}];`);let f=W(l,t,i.element,a,o);u&&f!==null&&l.write(`${u}[${c}] = ${f};`)}),e.write("}"),u}s(vg,"generateArrayCheck");function xg(e,t,r,n){let i=r._zod.def.values;if(i.length!==1){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}let u=i[0];if(typeof u=="number"&&Number.isNaN(u)){let c=S(t,new Set(i));return e.write(`if (!${c}.has(${n})) return INVALID;`),n}if(typeof u=="string")e.write(`if (${n} !== ${X(u)}) return INVALID;`);else if(typeof u=="number"||typeof u=="boolean")e.write(`if (${n} !== ${u}) return INVALID;`);else if(u===null)e.write(`if (${n} !== null) return INVALID;`);else if(u===void 0)e.write(`if (${n} !== undefined) return INVALID;`);else if(typeof u=="bigint")e.write(`if (${n} !== ${u}n) return INVALID;`);else throw new Z(`literal type ${typeof u}`);return n}s(xg,"generateLiteralCheck");function kg(e,t,r,n){let o=r._zod.values;if(!o)throw new Z("enum schema without enumerated values");let i=S(t,o);return e.write(`if (!${i}.has(${n})) return INVALID;`),n}s(kg,"generateEnumCheck");function Rf(e,t,r,n){let o=r._zod.def;return V(e,t,o.innerType,n)}s(Rf,"generateWrapperCheck");function zg(e,t,r,n){let o=r._zod.def,u=Object.getOwnPropertyDescriptor(r._zod.def,"defaultValue")?()=>r._zod.def.defaultValue:void 0;if(r._zod.def.type==="prefault"){if(!u)return V(e,t,o.innerType,n);let a=S(t,u),l=k(t);return e.write(`let ${l} = ${n};`),e.write(`if (${n} === undefined) ${l} = ${a}();`),V(e,t,o.innerType,l)}let c=k(t);if(u){let a=S(t,u),l=S(t,Wt);e.write(`let ${c};`),e.write(`if (${n} === undefined) {`),e.indented(f=>{f.write(`${c} = ${l}(${a}());`)}),e.write("} else {"),e.indented(f=>{let p=V(f,t,o.innerType,n);f.write(`${c} = ${p} === undefined ? ${l}(${a}()) : ${p};`)}),e.write("}")}else e.write(`let ${c};`),e.write(`if (${n} !== undefined) {`),e.indented(a=>{let l=V(a,t,o.innerType,n);a.write(`${c} = ${l};`)}),e.write("}");return c}s(zg,"generateDefaultCheck");function Sg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.innerType,n),u=k(t);return e.write(`const ${u} = ${i};`),e.write(`if (${u} === undefined) return INVALID;`),u}s(Sg,"generateNonOptionalCheck");function Pg(e,t,r,n){let o=r._zod.def,i=o.items,u=o.rest;e.write(`if (!Array.isArray(${n})) return INVALID;`);let c=Lf(i,"optin"),a=Lf(i,"optout");u?e.write(`if (${n}.length < ${c}) return INVALID;`):e.write(`if (${n}.length < ${c} || ${n}.length > ${i.length}) return INVALID;`);let l=k(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(m=>{let g=k(t);m.write(`const ${g} = ${n}[${f}];`);let y=W(m,t,p,g);m.write(`${l}[${f}] = ${y};`)}),d.write("} else {"),d.indented(m=>{if(Xu(p)){m.write(`${l}.length = ${f};`);return}let g=k(t),y=k(t);m.write(`const ${g} = undefined;`),m.write(`const ${y} = (() => {`),m.indented($=>{let z=W($,t,p,g);$.write(`return ${z};`)}),m.write("})();"),m.write(`if (${y} === INVALID || ${y} === undefined) ${l}.length = ${f};`),m.write(`else ${l}[${f}] = ${y};`)}),d.write("}")}),e.write("}");else{let d=k(t);e.write(`const ${d} = ${n}[${f}];`);let m=W(e,t,p,d);e.write(`${l}[${f}] = ${m};`)}}if(u){let f=k(t),p=k(t);e.write(`for (let ${f} = ${i.length}; ${f} < ${n}.length; ${f}++) {`),e.indented(d=>{d.write(`const ${p} = ${n}[${f}];`);let m=W(d,t,u,p);d.write(`${l}[${f}] = ${m};`)}),e.write("}")}return l}s(Pg,"generateTupleCheck");function Lf(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(Lf,"getTupleOptStart");function Ig(e,t,r,n){let o=r._zod.def,i=o.options;if(o.discriminator)return Ag(e,t,o,n);if(o.inclusive===!1)throw new Z("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=S(t,a);return e.write(`if (!${l}.has(${n})) return INVALID;`),n}let c=k(t);e.write(`let ${c};`);for(let a=0;a<i.length;a++){let l=i[a];a===0?e.write(`${c} = (() => {`):e.write(`if (${c} === INVALID) ${c} = (() => {`),e.indented(f=>{let p=V(f,t,l,n);f.write(`return ${p};`)}),e.write("})();")}return e.write(`if (${c} === INVALID) return INVALID;`),c}s(Ig,"generateUnionCheck");function Ag(e,t,r,n){if(r.unionFallback)throw new Z("discriminated union with unionFallback");if(r.options.length===0)return e.write("return INVALID;"),n;let o=k(t),i=k(t);e.write(`const ${o} = ${n}?.[${X(r.discriminator)}];`),e.write(`let ${i};`);let u=!0,c=new Set;for(let a of r.options){let l=a._zod.propValues?.[r.discriminator];if(!l||l.size===0)throw new Z("discriminated union option without static discriminator values");for(let d of l){if(c.has(d))throw new Z(`duplicate discriminator value ${String(d)}`);c.add(d)}let f=Array.from(l,d=>Og(t,o,d)),p=u?"if":"else if";e.write(`${p} (${f.join(" || ")}) {`),e.indented(d=>{let m=V(d,t,a,n);d.write(`${i} = ${m};`)}),e.write("}"),u=!1}return e.write("else { return INVALID; }"),i}s(Ag,"generateDiscriminatedUnionCheck");function Og(e,t,r){if(typeof r=="string")return`${t} === ${X(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=S(e,r);return`${t} === ${n}`}throw new Z(`literal discriminator value ${String(r)}`)}s(Og,"literalEquality");function Zg(e,t,r,n){let o=r._zod.def;t.definite=!1;let i=W(e,t,o.left,n),u=W(e,t,o.right,n),c=S(t,yt),a=k(t);return e.write(`const ${a} = ${c}(${i}, ${u});`),e.write(`if (!${a}.valid) return INVALID;`),`${a}.data`}s(Zg,"generateIntersectionCheck");function Ng(e,t,r,n){let o=r._zod.def,i=S(t,ce);e.write(`if (!${i}(${n})) return INVALID;`);let u=k(t),c=k(t),a=k(t);e.write(`const ${u} = {};`);let l=o,f=l.partial?void 0:o.keyType._zod.values;if(f){let m=[];for(let y of f){if(!(typeof y=="string"||typeof y=="number"||typeof y=="symbol"))throw new Z(`record key value ${String(y)}`);let $=typeof y=="number"?y.toString():y;if($==="__proto__")throw new Z('record key "__proto__"');m.push($);let z=S(t,y),x=V(e,t,o.keyType,z),I=k(t);e.write(`const ${I} = ${n}[${Eg(t,$)}];`);let E=W(e,t,o.valueType,I);e.write(`${u}[${x}] = ${E};`)}let g=S(t,new Set(m));return e.write(`for (const ${c} in ${n}) {`),e.indented(y=>{y.write(`if (${g}.has(${c})) continue;`),l.mode==="loose"?y.write(`if (${c} !== "__proto__") ${u}[${c}] = ${n}[${c}];`):y.write("return INVALID;")}),e.write("}"),u}let p=o.keyType._zod.def;if(!(p.type==="string"&&p.format===void 0&&!p.coerce&&(p.checks?.length??0)===0)){let m=o.mode==="loose",g=Gn(o.keyType);g.definite===!1&&(t.definite=!1);let y=S(t,g),$=S(t,be),z=k(t);return jf(e,t,n,c,x=>{x.write(`let ${z} = ${y}(${c});`),x.write(`if (${z} === INVALID && typeof ${c} === "string" && ${$}.test(${c})) ${z} = ${y}(Number(${c}));`),m?x.write(`if (${z} === INVALID) { ${u}[${c}] = ${n}[${c}]; continue; }`):x.write(`if (${z} === INVALID) return INVALID;`),x.write(`if (${z} === "__proto__") continue;`);let I=k(t);x.write(`const ${I} = ${n}[${c}];`);let E=W(x,t,o.valueType,I);x.write(`${u}[${z}] = ${E};`)}),u}return jf(e,t,n,c,m=>{m.write(`const ${a} = ${n}[${c}];`);let g=W(m,t,o.valueType,a);m.write(`${u}[${c}] = ${g};`)},"return INVALID;"),u}s(Ng,"generateRecordCheck");function jf(e,t,r,n,o,i){let u=S(t,Object.prototype.propertyIsEnumerable),c=k(t),a=k(t),l=k(t);e.write(`const ${c} = 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__" || !${u}.call(${r}, ${n})) continue;`),o(f)}),e.write("}"),e.write(`for (let ${l} = 0; ${l} < ${c}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${n} = ${c}[${l}];`),f.write(`if (!${u}.call(${r}, ${n})) continue;`),i?f.write(i):o(f)}),e.write("}")}s(jf,"emitOwnKeys");function Eg(e,t){return typeof t=="string"?X(t):S(e,t)}s(Eg,"literalPropertyKey");function Cg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Map)) return INVALID;`);let i=k(t),u=k(t),c=k(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${u}, ${c}] of ${n}) {`),e.indented(a=>{let l=V(a,t,o.keyType,u),f=V(a,t,o.valueType,c);a.write(`${i}.set(${l}, ${f});`)}),e.write("}"),i}s(Cg,"generateMapCheck");function Tg(e,t,r,n){let o=r._zod.def;e.write(`if (!(${n} instanceof Set)) return INVALID;`);let i=k(t),u=k(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${u} of ${n}) {`),e.indented(c=>{let a=V(c,t,o.valueType,u);c.write(`${i}.add(${a});`)}),e.write("}"),i}s(Tg,"generateSetCheck");function Dg(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}s(Dg,"generateFileCheck");function Rg(e,t,r,n){e.write(`if (typeof ${n} !== "string") return INVALID;`);let o=r._zod.pattern;if(o){let i=S(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${n})) return INVALID;`)}return n}s(Rg,"generateTemplateLiteralCheck");function Lg(e,t,r,n){let o=r._zod.def,i=Ge(t,o.getter),u=S(t,{parser:null});e.write(`if (!${u}.parser) {`),e.indented(a=>{a.write(`const inner = ${i}();`),a.write(`${u}.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 c=k(t);return e.write(`const ${c} = ${u}.parser(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),c}s(Lg,"generateLazyCheck");function jg(e,t,r,n){let o=r._zod.def,i=V(e,t,o.in,n);if(o.transform){if(qe(o.transform))throw new pe("z.compile: async transforms in pipes are not supported");let u=o.transform,a=Ge(t,s(f=>{let p={value:f,issues:[],addIssue:Yu},d=u(f,p);return d instanceof Promise?Y:p.issues.length===0?d:Y},"helperFn")),l=k(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(jg,"generatePipeCheck");function qe(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}s(qe,"isAsyncFunction");function Vg(e,t,r,n){let o=r._zod.def;if(o.fn){if(qe(o.fn))throw new pe("z.compile: async custom predicates are not supported");let i=Ge(t,o.fn),u=S(t,Wu),c=k(t);e.write(`const ${c} = ${i}(${n});`),e.write(`if (${c} instanceof Promise) ${u}();`),e.write(`if (!${c}) return INVALID;`)}else throw new Z("custom schema without a predicate function");return n}s(Vg,"generateCustomCheck");function Mg(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(Mg,"runtimeCatch");function Fg(e,t,r,n){let o=r._zod.def;if(!o.catchValue[en])throw new Z("catch with a callback (only a constant catch value compiles)",!1);let i=k(t);e.write(`let ${i} = (() => {`),e.indented(l=>{let f=W(l,t,o.innerType,n);l.write(`return ${f};`)}),e.write("})();");let u=S(t,o.innerType),c=Ge(t,o.catchValue),a=S(t,Mg);return e.write(`if (${i} === INVALID) {`),e.indented(l=>{l.write(`${i} = ${a}(${u}, ${c}, ${n});`),l.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}s(Fg,"generateCatchCheck");function Kg(e,t,r,n){let o=r._zod.def;if(o.transform){if(qe(o.transform))throw new pe("z.compile: async transforms are not supported");let i=o.transform,c=Ge(t,s(l=>{let f={value:l,issues:[],addIssue:Yu},p=i(l,f);return p instanceof Promise?Y:f.issues.length===0?p:Y},"helperFn")),a=k(t);return e.write(`const ${a} = ${c}(${n});`),e.write(`if (${a} === INVALID) return INVALID;`),a}return n}s(Kg,"generateTransformCheck");function qn(e){return e.checks&&(e.checks=[...e.checks]),e}s(qn,"snapshotChecks");function Qu(e,t){return new e(qn({type:"string",..._(t)}))}s(Qu,"_string");function ec(e,t){return new e(qn({type:"string",coerce:!0,..._(t)}))}s(ec,"_coercedString");function Wn(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}s(Wn,"_email");function Xn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}s(Xn,"_guid");function Hn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}s(Hn,"_uuid");function Yn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}s(Yn,"_uuidv4");function Qn(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}s(Qn,"_uuidv6");function eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}s(eo,"_uuidv7");function kr(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}s(kr,"_url");function to(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}s(to,"_emoji");function ro(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}s(ro,"_nanoid");function no(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}s(no,"_cuid");function oo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}s(oo,"_cuid2");function io(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}s(io,"_ulid");function so(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}s(so,"_xid");function uo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}s(uo,"_ksuid");function co(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}s(co,"_ipv4");function ao(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}s(ao,"_ipv6");function tc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}s(tc,"_mac");function lo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}s(lo,"_cidrv4");function fo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}s(fo,"_cidrv6");function po(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}s(po,"_base64");function mo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}s(mo,"_base64url");function ho(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}s(ho,"_e164");function rc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}s(rc,"_creditCard");function nc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}s(nc,"_iban");function go(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}s(go,"_jwt");var oc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function zr(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}s(zr,"_isoDateTime");function Sr(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}s(Sr,"_isoDate");function Pr(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}s(Pr,"_isoTime");function Ir(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}s(Ir,"_isoDuration");function ic(e,t){return new e(qn({type:"number",checks:[],..._(t)}))}s(ic,"_number");function sc(e,t){return new e(qn({type:"number",coerce:!0,checks:[],..._(t)}))}s(sc,"_coercedNumber");function uc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}s(uc,"_int");function cc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}s(cc,"_float32");function ac(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}s(ac,"_float64");function lc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}s(lc,"_int32");function fc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}s(fc,"_uint32");function pc(e,t){return new e({type:"boolean",..._(t)})}s(pc,"_boolean");function dc(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}s(dc,"_coercedBoolean");function mc(e,t){return new e({type:"bigint",..._(t)})}s(mc,"_bigint");function hc(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}s(hc,"_coercedBigint");function gc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}s(gc,"_int64");function yc(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}s(yc,"_uint64");function _c(e,t){return new e({type:"symbol",..._(t)})}s(_c,"_symbol");function $c(e,t){return new e({type:"undefined",..._(t)})}s($c,"_undefined");function wc(e,t){return new e({type:"null",..._(t)})}s(wc,"_null");function bc(e){return new e({type:"any"})}s(bc,"_any");function vc(e){return new e({type:"unknown"})}s(vc,"_unknown");function xc(e,t){return new e({type:"never",..._(t)})}s(xc,"_never");function kc(e,t){return new e({type:"void",..._(t)})}s(kc,"_void");function zc(e,t){return new e({type:"date",..._(t)})}s(zc,"_date");function Sc(e,t){return new e({type:"date",coerce:!0,..._(t)})}s(Sc,"_coercedDate");function Pc(e,t){return new e({type:"nan",..._(t)})}s(Pc,"_nan");function me(e,t){return new yn({check:"less_than",..._(t),value:e,inclusive:!1})}s(me,"_lt");function se(e,t){return new yn({check:"less_than",..._(t),value:e,inclusive:!0})}s(se,"_lte");function he(e,t){return new _n({check:"greater_than",..._(t),value:e,inclusive:!1})}s(he,"_gt");function ue(e,t){return new _n({check:"greater_than",..._(t),value:e,inclusive:!0})}s(ue,"_gte");function yo(e){return he(0,e)}s(yo,"_positive");function _o(e){return me(0,e)}s(_o,"_negative");function $o(e){return se(0,e)}s($o,"_nonpositive");function wo(e){return ue(0,e)}s(wo,"_nonnegative");function Ae(e,t){return new fs({check:"multiple_of",..._(t),value:e})}s(Ae,"_multipleOf");function Oe(e,t){return new ms({check:"max_size",..._(t),maximum:e})}s(Oe,"_maxSize");function ge(e,t){return new hs({check:"min_size",..._(t),minimum:e})}s(ge,"_minSize");function We(e,t){return new gs({check:"size_equals",..._(t),size:e})}s(We,"_size");function Xe(e,t){return new ys({check:"max_length",..._(t),maximum:e})}s(Xe,"_maxLength");function ve(e,t){return new _s({check:"min_length",..._(t),minimum:e})}s(ve,"_minLength");function He(e,t){return new $s({check:"length_equals",..._(t),length:e})}s(He,"_length");function wt(e,t){return new ws({check:"string_format",format:"regex",..._(t),pattern:e})}s(wt,"_regex");function bt(e){return new bs({check:"string_format",format:"lowercase",..._(e)})}s(bt,"_lowercase");function vt(e){return new vs({check:"string_format",format:"uppercase",..._(e)})}s(vt,"_uppercase");function xt(e,t){return new xs({check:"string_format",format:"includes",..._(t),includes:e})}s(xt,"_includes");function kt(e,t){return new ks({check:"string_format",format:"starts_with",..._(t),prefix:e})}s(kt,"_startsWith");function zt(e,t){return new zs({check:"string_format",format:"ends_with",..._(t),suffix:e})}s(zt,"_endsWith");function bo(e,t,r){return new Ss({check:"property",property:e,schema:t,..._(r)})}s(bo,"_property");function St(e,t){return new Ps({check:"properties",shape:e,..._(t)})}s(St,"_properties");function Pt(e,t){return new Is({check:"mime_type",mime:e,..._(t)})}s(Pt,"_mime");function de(e){return new As({check:"overwrite",tx:e})}s(de,"_overwrite");function It(e){return de(t=>t.normalize(e))}s(It,"_normalize");function At(){return de(e=>e.trim())}s(At,"_trim");function Ot(){return de(e=>e.toLowerCase())}s(Ot,"_toLowerCase");function Zt(){return de(e=>e.toUpperCase())}s(Zt,"_toUpperCase");function Nt(){return de(e=>pi(e))}s(Nt,"_slugify");function Ic(e,t,r){return new e({type:"array",element:t,..._(r)})}s(Ic,"_array");function Ug(e,t,r){return new e({type:"union",options:t,..._(r)})}s(Ug,"_union");function Bg(e,t,r){return new e({type:"union",options:t,inclusive:!1,..._(r)})}s(Bg,"_xor");function Jg(e,t,r,n){return new e({type:"union",options:r,discriminator:t,..._(n)})}s(Jg,"_discriminatedUnion");function Gg(e,t,r){return new e({type:"intersection",left:t,right:r})}s(Gg,"_intersection");function qg(e,t,r,n){let o=r instanceof P,i=o?n:r,u=o?r:null;return new e({type:"tuple",items:t,rest:u,..._(i)})}s(qg,"_tuple");function Wg(e,t,r,n){return new e({type:"record",keyType:t,valueType:r,..._(n)})}s(Wg,"_record");function Xg(e,t,r,n){return new e({type:"map",keyType:t,valueType:r,..._(n)})}s(Xg,"_map");function Hg(e,t,r){return new e({type:"set",valueType:t,..._(r)})}s(Hg,"_set");function Yg(e,t,r){let n=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:n,..._(r)})}s(Yg,"_enum");function Qg(e,t,r){return new e({type:"enum",entries:t,..._(r)})}s(Qg,"_nativeEnum");function ey(e,t,r){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(r)})}s(ey,"_literal");function Ac(e,t){return new e({type:"file",..._(t)})}s(Ac,"_file");function ty(e,t){return new e({type:"transform",transform:t})}s(ty,"_transform");function ry(e,t){return new e({type:"optional",innerType:t})}s(ry,"_optional");function ny(e,t){return new e({type:"nullable",innerType:t})}s(ny,"_nullable");function oy(e,t,r){return new e({type:"default",innerType:t,get defaultValue(){return typeof r=="function"?r():Wt(r)}})}s(oy,"_default");function iy(e,t,r){return new e({type:"nonoptional",innerType:t,..._(r)})}s(iy,"_nonoptional");function sy(e,t){return new e({type:"success",innerType:t})}s(sy,"_success");function uy(e,t,r){return new e({type:"catch",innerType:t,catchValue:typeof r=="function"?r:$i(r)})}s(uy,"_catch");function cy(e,t,r){return new e({type:"pipe",in:t,out:r})}s(cy,"_pipe");function ay(e,t){return new e({type:"readonly",innerType:t})}s(ay,"_readonly");function ly(e,t,r){return new e({type:"template_literal",parts:t,..._(r)})}s(ly,"_templateLiteral");function fy(e,t){return new e({type:"lazy",getter:t})}s(fy,"_lazy");function py(e,t){return new e({type:"promise",innerType:t})}s(py,"_promise");function Oc(e,t,r){let n=_(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}s(Oc,"_custom");function Zc(e,t,r){return new e({type:"custom",check:"custom",fn:t,..._(r)})}s(Zc,"_refine");function Nc(e,t){let r=Kf(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(ft(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(ft(i))}},e(n.value,n)),t);return r}s(Nc,"_superRefine");function Kf(e,t){let r=new L({check:"custom",..._(t)});return r._zod.check=e,r}s(Kf,"_check");function Ec(e){let t=new L({check:"describe"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,description:e})}],t._zod.check=()=>{},t}s(Ec,"describe");function Cc(e){let t=new L({check:"meta"});return t._zod.onattach=[r=>{let n=G.get(r)??{};G.add(r,{...n,...e})}],t._zod.check=()=>{},t}s(Cc,"meta");function Tc(e,t){let r=_(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(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(n),u=new Set(o),c=e.Codec??yr,a=e.Boolean??hr,l=e.String??Ue,f=new l({type:"string",error:r.error}),p=new a({type:"boolean",error:r.error}),d=new c({type:"pipe",in:f,out:p,transform:s(((m,g)=>{let y=m;return r.case!=="sensitive"&&(y=y.toLowerCase()),i.has(y)?!0:u.has(y)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...u],input:g.value,inst:d,continue:!1}),{})}),"transform"),reverseTransform:s(((m,g)=>m===!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(Tc,"_stringbool");function Ye(e,t,r,n={}){let o=_(n),i={check:"string_format",type:"string",format:t,fn:typeof r=="function"?r:c=>r.test(c),...o};return r instanceof RegExp&&(i.pattern=r),new e(i)}s(Ye,"_stringFormat");function Ar(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(Ar,"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??G,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 K(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(K,"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 u={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,u),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let c=e._zod.toJSONSchema?.();if(c)u.schema=c;else{let f={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,f);else{let d=u.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,f)}let p=e._zod.parent;p&&(u.ref||(u.ref=p),D(p,t,f),t.seen.get(p).isParent=!0)}let a=t.metadataRegistry.get(e);return a&&Ar(u.schema,a),t.io==="input"&&Q(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&"_prefault"in u.schema&&((n=u.schema).default??(n.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}s(D,"processSchema");function Uf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}s(Uf,"encodeJSONPointerSegment");function Ne(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 u of e.seen.entries()){let c=e.metadataRegistry.get(u[0])?.id;if(c){let a=n.get(c);if(a&&a!==u[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(c,u[0])}}let o=s(u=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let p=e.external.registry.get(u[0])?.id,d=e.external.uri??(g=>g);if(p)return{ref:d(p)};let m=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=m,{defId:m,ref:`${d("__shared")}#/${c}/${Uf(m)}`}}let a="#",l=`${a}/${c}/`;if(u[1]===r&&!u[1].schema.id)return{ref:a};let f=u[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:l+Uf(f)}},"makeURI"),i=s(u=>{if(u[1].schema.$ref)return;let c=u[1],{ref:a,defId:l}=o(u);c.def={...c.schema},l&&(c.defId=l);let f=c.schema;for(let p in f)delete f[p];f.$ref=a},"extractToDef");if(e.cycles==="throw")for(let u of e.seen.entries()){let c=u[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
67
67
|
|
|
68
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of e.seen.entries()){let c=u[1];if(t===u[0]){i(u);continue}if(e.external){let l=e.external.registry.get(u[0])?.id;if(t!==u[0]&&l){i(u);continue}}if(e.metadataRegistry.get(u[0])?.id){i(u);continue}if(c.cycle){i(u);continue}c.count>1&&e.reused==="ref"&&i(u)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Ne,"extractDefs");function Gf(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;Gf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let u of Array.isArray(i)?i:[i]){if(typeof u!="string")return;r.includes(u)||r.push(u)}}delete e.anyOf,e.type=r.length===1?r[0]:r}s(Gf,"compactTypeUnion");var qf=new Set(["type","properties","required","additionalProperties"]),Bf=["oneOf","anyOf"];function Jf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Jf,"undeclaredConstraint");function Dc(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let u in i)if(!qf.has(u))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let u in i.properties){if(Object.prototype.hasOwnProperty.call(r,u))continue;let c=[];for(let l of t){let f=l.properties?.[u]??Jf(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let a=c.length===1?c[0]:Dc(c)??{allOf:c};J(r,u,a)}for(let u of i.required??[])n.add(u)}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 u of t){let c=Jf(u);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(Dc,"foldObjects");function dy(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of qf)if(o in e)return;let r=t.filter(o=>Bf.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Dc(t);else{let o=r[0],i=Bf.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let u=t.filter(a=>a!==o),c=o[i].map(a=>Dc([...u,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Ar(e,n))}s(dy,"foldIntersection");function Ee(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s(c=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,f={...l},p=a.ref;if(a.ref=null,p){n(p);let m=e.seen.get(p),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):Ar(l,g),Ar(l,f),c._zod.parent===p)for(let $ in l)$==="$ref"||$==="allOf"||$ in f||delete l[$];if(g.$ref&&m.def)for(let $ in l)$==="$ref"||$==="allOf"||$ in m.def&&JSON.stringify(l[$])===JSON.stringify(m.def[$])&&delete l[$]}let d=c._zod.parent;if(d&&d!==p){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let g in l)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g])&&delete l[g]}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Gf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=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=c.get(f);p?p.push(l):c.set(f,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])dy(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 c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Ar(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 u=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,J(u,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?o.$defs=u:o.definitions=u);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Et(t,"input",e.processors),output:Et(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}s(Ee,"finalize");function Q(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 Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(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 Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(n.in,r)||Q(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;return!!(n.rest&&Q(n.rest,r))}return!1}s(Q,"isTransforming");var Rc=s((e,t={})=>r=>{let n=Ze({...r,processors:t});return D(e,n),Ne(n,e),Ee(n,e)},"createToJSONSchemaMethod"),Et=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},u=Ze({...o??{},target:i,io:t,processors:r});return D(e,u),Ne(u,e),Ee(u,e)},"createStandardJSONSchemaMethod");var Ct=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),Tt=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),Wf=s((e,t)=>{Ct(e,"minimum",t),Tt(e,"maximum",t)},"narrowBoth"),Qf=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),ep=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),tp=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),rp=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),Xf=s((e,t)=>Ct(e,"minimum",t.minimum),"minContributor"),Hf=s((e,t)=>Tt(e,"maximum",t.maximum),"maxContributor"),Yf=s(e=>(t,r)=>{rp(t,r.format);let[n,o]=e[r.format];Ct(t,"minimum",n),Tt(t,"maximum",o)},"formatContributor"),my={greater_than:s((e,t)=>Ct(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Tt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>Qf(e,t.value),"multiple_of"),number_format:Yf(Ht),bigint_format:Yf(Yt),min_length:Xf,max_length:Hf,length_equals:s((e,t)=>Wf(e,t.length),"length_equals"),min_size:Xf,max_size:Hf,size_equals:s((e,t)=>Wf(e,t.size),"size_equals"),string_format:s((e,t)=>{rp(e,t.format),t.pattern&&ep(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)=>tp(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)my[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Ct(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Ct(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Tt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Tt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Qf(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&tp(t,o.mime);for(let i of o.patterns??[])ep(t,i);return t}s(U,"aggregateChecks");var hy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gy=new Map([[In,Bi],[mr,Ji]]),np=s(e=>gy.get(e)??e,"exactPattern"),Vc=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:u,format:c,patterns:a,contentEncoding:l,laxFormat:f}=U(e);if(typeof i=="number"&&(o.minLength=i),typeof u=="number"&&(o.maxLength=u),c&&(o.format=hy[c]??c,o.format===""&&delete o.format,(c==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),a&&a.size>0){let p=[...a].map(np);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"),Mc=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:u,multipleOf:c,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<=(u??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p?m?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof u=="number"&&(o.maximum=u),c){let g=new Set;for(let z of c)Number.isFinite(z)&&z!==0?g.add(Math.abs(z)):K(e,t,o,n,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[y,...$]=g;y!==void 0&&(o.multipleOf=y),$.length&&(o.allOf=[...o.allOf??[],...$.map(z=>({multipleOf:z}))])}},"numberProcessor"),Fc=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),Kc=s((e,t,r,n)=>{K(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Uc=s((e,t,r,n)=>{K(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Bc=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Jc=s((e,t,r,n)=>{K(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Gc=s((e,t,r,n)=>{K(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),qc=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Wc=s((e,t,r,n)=>{},"anyProcessor"),Xc=s((e,t,r,n)=>{},"unknownProcessor"),Hc=s((e,t,r,n)=>{K(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Yc=s((e,t,r,n)=>{let o=e._zod.def,i=ut(o.entries);if(i.length===0){r.not={};return}i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Qc=s((e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let u of o.values)if(u===void 0){if(K(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof u=="bigint"){if(K(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(u))}else i.push(u);if(i.length!==0)if(i.length===1){let u=i[0];r.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[u]:r.const=u}else i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),i.every(u=>typeof u=="boolean")&&(r.type="boolean"),i.every(u=>u===null)&&(r.type="null"),r.enum=i},"literalProcessor"),ea=s((e,t,r,n)=>{K(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),ta=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"),ra=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:u,mime:c}=U(e);i!==void 0&&(o.minLength=i),u!==void 0&&(o.maxLength=u),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},"fileProcessor"),na=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),oa=s((e,t,r,n)=>{K(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),ia=s((e,t,r,n)=>{K(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),sa=s((e,t,r,n)=>{K(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),ua=s((e,t,r,n)=>{K(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),ca=s((e,t,r,n)=>{K(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),aa=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:u,maximum:c}=U(e);typeof u=="number"&&(o.minItems=u),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=D(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");function Or(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Or(t.out):t.type==="catch"?Or(t.innerType):e._zod.optin}s(Or,"inputOptin");var la=s((e,t,r,n)=>{let o=r,i=e._zod.def,u=i.shape;if(Object.getOwnPropertySymbols(u).length&&K(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in u)J(o.properties,l,D(u[l],t,{...n,path:[...n.path,"properties",l]}));let a=[];for(let l of Object.keys(u)){let f=i.shape[l];(t.io==="input"?Or(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"),xo=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,u=o.options.map((c,a)=>D(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=u:r.anyOf=u},"unionProcessor"),fa=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,"allOf",0]}),u=D(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),a=[...c(i)?i.allOf:[i],...c(u)?u.allOf:[u]];r.allOf=a,t.intersections.push(a)},"intersectionProcessor"),pa=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let u=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((y,$)=>D(y,t,{...n,path:[...n.path,u,$]})),l=i.rest?D(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,f=i.items.length;for(;f>0;){let y=i.items[f-1];if(!(t.io==="input"?Or(y)!==void 0:y._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:m,maximum:g}=U(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");function Lc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let y=Lc(e,g,r);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let $=y.map(z=>Lc(e,z,r));$.some((z,x)=>z!==y[x])&&(t={...t,[g]:$})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:u,maximum:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:f,format:p,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?ve:ur).source)),m}s(Lc,"stringifyKeyNames");var jc=new WeakMap;function yy(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 jc.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let u=Lc(t,i,new Set);u!==i&&r.set(i,u)}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(yy,"rewriteKeyNames");var da=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let u=i.keyType,c=U(u).patterns;if(i.mode==="loose"&&c&&c.size>0){let f=D(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)J(o.patternProperties,np(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=jc.get(t);f||(f=[],jc.set(t,f),t.deferred.push(()=>yy(t))),f.push(e)}o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=u._zod.values,l=t.io==="input"&&Or(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"),ma=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),ha=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"),ga=Symbol();function op(e,t,r,n,o){let i=!1,u=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(K(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ga):JSON.parse(u)}s(op,"serializeDefaultValue");var ya=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 u=op(o.defaultValue,e,t,r,n);u!==ga&&(r.default=u)},"defaultProcessor"),_a=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 u=op(o.defaultValue,e,t,r,n);u!==ga&&(r._prefault=u)},"prefaultProcessor"),$a=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 u;try{u=o.catchValue(void 0)}catch{K(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=u},"catchProcessor"),wa=s((e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),u=t.io==="input"?i?o.out:o.in:o.out;D(u,t,n);let c=t.seen.get(e);c.ref=u},"pipeProcessor"),ba=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"),va=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"),ko=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"),xa=s((e,t,r,n)=>{let o=e._zod.innerType;D(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),vo={string:Vc,number:Mc,boolean:Fc,bigint:Kc,symbol:Uc,null:Bc,undefined:Jc,void:Gc,never:qc,any:Wc,unknown:Xc,date:Hc,enum:Yc,literal:Qc,nan:ea,template_literal:ta,file:ra,success:na,custom:oa,function:ia,transform:sa,map:ua,set:ca,array:aa,object:la,union:xo,intersection:fa,tuple:pa,record:da,nullable:ma,nonoptional:ha,default:ya,prefault:_a,catch:$a,pipe:wa,readonly:ba,promise:va,optional:ko,lazy:xa};function zo(e,t){if("_idmap"in e){let n=e,o=Ze({...t,processors:vo}),i={};for(let a of n._idmap.entries()){let[l,f]=a;D(f,o)}let u={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[l,f]=a;Ne(o,f),J(u,l,Ee(o,f))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[a]:i}}return{schemas:u}}let r=Ze({...t,processors:vo});return D(e,r),Ne(r,e),Ee(r,e)}s(zo,"toJSONSchema");var So=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:vo,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,Ne(this.ctx,t);let n=Ee(this.ctx,t),{"~standard":o,...i}=n;return i}};var ip={};var Kt={};$e(Kt,{ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Bo,ZodBase64URL:()=>Jo,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Wo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Ko,ZodCIDRv6:()=>Uo,ZodCUID:()=>Do,ZodCUID2:()=>Ro,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>rt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>Go,ZodEmail:()=>No,ZodEmoji:()=>Co,ZodEnum:()=>Rt,ZodExactOptional:()=>Qo,ZodFile:()=>sl,ZodFunction:()=>Sl,ZodGUID:()=>Eo,ZodIBAN:()=>La,ZodIPv4:()=>Mo,ZodIPv6:()=>Fo,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodJWT:()=>qo,ZodKSUID:()=>Vo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>To,ZodNever:()=>Ga,ZodNonOptional:()=>ei,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>nt,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>Lo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>jo,ZodXor:()=>Xa,_ZodString:()=>Zo,_default:()=>fl,_function:()=>yd,any:()=>qp,array:()=>Tr,base64:()=>Ip,base64url:()=>Ap,bigint:()=>Kp,boolean:()=>Va,catch:()=>yl,check:()=>_d,cidrv4:()=>Sp,cidrv6:()=>Pp,codec:()=>dd,creditCard:()=>Zp,cuid:()=>_p,cuid2:()=>$p,currencyCode:()=>Rp,custom:()=>$d,date:()=>Xp,describe:()=>wd,discriminatedUnion:()=>rd,e164:()=>Op,email:()=>cp,emoji:()=>gp,enum:()=>Ho,exactOptional:()=>cl,file:()=>ad,float32:()=>jp,float64:()=>Vp,function:()=>yd,guid:()=>ap,hash:()=>Lp,hex:()=>Dp,hostname:()=>Tp,httpUrl:()=>hp,iban:()=>Np,instanceof:()=>vd,int:()=>Ao,int32:()=>Mp,int64:()=>Up,intersection:()=>Qa,invertCodec:()=>md,ipv4:()=>xp,ipv6:()=>zp,json:()=>kd,jwt:()=>Ep,keyof:()=>Hp,ksuid:()=>vp,lazy:()=>kl,literal:()=>cd,looseObject:()=>ed,looseRecord:()=>od,mac:()=>kp,map:()=>id,meta:()=>bd,nan:()=>pd,nanoid:()=>yp,nativeEnum:()=>ud,never:()=>Xo,nonoptional:()=>ml,null:()=>Ua,nullable:()=>Nr,nullish:()=>ld,number:()=>ja,object:()=>Yp,optional:()=>et,partialRecord:()=>nd,pipe:()=>Oo,prefault:()=>dl,preprocess:()=>zd,promise:()=>gd,readonly:()=>bl,record:()=>rl,refine:()=>Pl,set:()=>sd,strictObject:()=>Qp,string:()=>Zr,stringFormat:()=>Cp,stringbool:()=>xd,success:()=>fd,superRefine:()=>Il,symbol:()=>Jp,templateLiteral:()=>hd,transform:()=>Yo,tuple:()=>tl,uint32:()=>Fp,uint64:()=>Bp,ulid:()=>wp,undefined:()=>Gp,union:()=>Ft,unknown:()=>Qe,url:()=>mp,uuid:()=>lp,uuidv4:()=>fp,uuidv6:()=>pp,uuidv7:()=>dp,void:()=>Wp,xid:()=>bp,xor:()=>td});var Po={};$e(Po,{endsWith:()=>zt,gt:()=>he,gte:()=>ue,includes:()=>xt,length:()=>He,lowercase:()=>bt,lt:()=>me,lte:()=>se,maxLength:()=>Xe,maxSize:()=>Oe,mime:()=>Pt,minLength:()=>xe,minSize:()=>ge,multipleOf:()=>Ae,negative:()=>_o,nonnegative:()=>wo,nonpositive:()=>$o,normalize:()=>It,overwrite:()=>de,positive:()=>yo,properties:()=>St,property:()=>bo,regex:()=>wt,size:()=>We,slugify:()=>Nt,startsWith:()=>kt,toLowerCase:()=>Ot,toUpperCase:()=>Zt,trim:()=>At,uppercase:()=>vt});var sp=new WeakSet([Object.prototype,Error.prototype]);function Io(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(Io,"_lazyMethod");var up=s((e,t)=>{zi.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);sp.has(r)||(sp.add(r),Io(r,"format",n=>o=>nr(n,o)),Io(r,"flatten",n=>o=>rr(n,o)),Io(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ct,2)}),Io(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ct,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),$y=h("ZodError",up),ie=h("ZodError",up,void 0,{Parent:Error});var ka=pt(ie),za=dt(ie),Sa=mt(ie),Pa=ht(ie),Ia=on(ie),Aa=sn(ie),Oa=un(ie),Za=cn(ie),Na=an(ie),Ea=ln(ie),Ca=fn(ie),Ta=pn(ie);function by(){B.localeError||F(vr())}s(by,"_ensureDefaultLocale");function tt(){B.memoizer||F({memoizer:br()})}s(tt,"_ensureDefaultMemoizer");var A=h("ZodType",(e,t)=>(by(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.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 C(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pl(e,t))},superRefine(e,t){return this.check(Il(e,t))},overwrite(e){return this.check(de(e))},optional(){return et(this)},exactOptional(){return cl(this)},nullable(){return Nr(this)},nullish(){return et(Nr(this))},nonoptional(e){return ml(this,e)},array(){return Tr(this)},or(e){return Ft([this,e])},and(e){return Qa(this,e)},transform(e){return Oo(this,Yo(e))},default(e){return fl(this,e)},prefault(e){return dl(this,e)},catch(e){return yl(this,e)},pipe(e){return Oo(this,e)},readonly(){return bl(this)},describe(e){let t=this.clone();return G.add(t,{description:e}),t},meta(...e){if(e.length===0)return G.get(this);let t=this.clone();return G.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 v.hide(this,"~standard",{...xn(this),jsonSchema:{input:Et(this,"input"),output:Et(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:s(function e(t,r){return ka(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await za(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return Sa(this,e,t)},async safeParseAsync(e,t){return Pa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return or(this,e,t)},validateAsync(e,t){return ir(this,e,t)},encode:s(function e(t,r){return Ia(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return Aa(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await Oa(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await Za(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return Na(this,e,t)},safeDecode(e,t){return Ea(this,e,t)},async safeEncodeAsync(e,t){return Ca(this,e,t)},async safeDecodeAsync(e,t){return Ta(this,e,t)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),Zo=h("_ZodString",(e,t)=>{Ue.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vc(e,r,n,o)},v.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(wt(...e))},includes(...e){return this.check(xt(...e))},startsWith(...e){return this.check(kt(...e))},endsWith(...e){return this.check(zt(...e))},min(...e){return this.check(xe(...e))},max(...e){return this.check(Xe(...e))},length(...e){return this.check(He(...e))},nonempty(...e){return this.check(xe(1,...e))},lowercase(e){return this.check(bt(e))},uppercase(e){return this.check(vt(e))},trim(){return this.check(At())},normalize(...e){return this.check(It(...e))},toLowerCase(){return this.check(Ot())},toUpperCase(){return this.check(Zt())},slugify(){return this.check(Nt())}})),Lt=h("ZodString",(e,t)=>{Ue.init(e,t),Zo.init(e,t)},{email(e){return this.check(Wn(No,e))},url(e){return this.check(kr(Er,e))},jwt(e){return this.check(go(qo,e))},emoji(e){return this.check(to(Co,e))},guid(e){return this.check(Xn(Eo,e))},uuid(e){return this.check(Hn(ye,e))},uuidv4(e){return this.check(Yn(ye,e))},uuidv6(e){return this.check(Qn(ye,e))},uuidv7(e){return this.check(eo(ye,e))},nanoid(e){return this.check(ro(To,e))},cuid(e){return this.check(no(Do,e))},cuid2(e){return this.check(oo(Ro,e))},ulid(e){return this.check(io(Lo,e))},base64(e){return this.check(po(Bo,e))},base64url(e){return this.check(mo(Jo,e))},xid(e){return this.check(so(jo,e))},ksuid(e){return this.check(uo(Vo,e))},ipv4(e){return this.check(co(Mo,e))},ipv6(e){return this.check(ao(Fo,e))},cidrv4(e){return this.check(lo(Ko,e))},cidrv6(e){return this.check(fo(Uo,e))},e164(e){return this.check(ho(Go,e))},datetime(e){return this.check(zr(Ce,e))},date(e){return this.check(Sr(Te,e))},time(e){return this.check(Pr(De,e))},duration(e){return this.check(Ir(Re,e))}});function Zr(e){return Qu(Lt,e)}s(Zr,"string");var R=h("ZodStringFormat",(e,t)=>{T.init(e,t),Zo.init(e,t)}),Ce=h("ZodISODateTime",(e,t)=>{Bs.init(e,t),R.init(e,t)}),Te=h("ZodISODate",(e,t)=>{Js.init(e,t),R.init(e,t)}),De=h("ZodISOTime",(e,t)=>{Gs.init(e,t),R.init(e,t)}),Re=h("ZodISODuration",(e,t)=>{qs.init(e,t),R.init(e,t)}),No=h("ZodEmail",(e,t)=>{Cs.init(e,t),R.init(e,t)});function cp(e){return Wn(No,e)}s(cp,"email");var Eo=h("ZodGUID",(e,t)=>{Ns.init(e,t),R.init(e,t)});function ap(e){return Xn(Eo,e)}s(ap,"guid");var ye=h("ZodUUID",(e,t)=>{Es.init(e,t),R.init(e,t)});function lp(e){return Hn(ye,e)}s(lp,"uuid");function fp(e){return Yn(ye,e)}s(fp,"uuidv4");function pp(e){return Qn(ye,e)}s(pp,"uuidv6");function dp(e){return eo(ye,e)}s(dp,"uuidv7");var Er=h("ZodURL",(e,t)=>{Rs.init(e,t),R.init(e,t)});function mp(e){return kr(Er,e)}s(mp,"url");function hp(e){return kr(Er,{protocol:sr,hostname:qi,...v.normalizeParams(e)})}s(hp,"httpUrl");var Co=h("ZodEmoji",(e,t)=>{Ls.init(e,t),R.init(e,t)});function gp(e){return to(Co,e)}s(gp,"emoji");var To=h("ZodNanoID",(e,t)=>{js.init(e,t),R.init(e,t)});function yp(e){return ro(To,e)}s(yp,"nanoid");var Do=h("ZodCUID",(e,t)=>{Vs.init(e,t),R.init(e,t)});function _p(e){return no(Do,e)}s(_p,"cuid");var Ro=h("ZodCUID2",(e,t)=>{Ms.init(e,t),R.init(e,t)});function $p(e){return oo(Ro,e)}s($p,"cuid2");var Lo=h("ZodULID",(e,t)=>{Fs.init(e,t),R.init(e,t)});function wp(e){return io(Lo,e)}s(wp,"ulid");var jo=h("ZodXID",(e,t)=>{Ks.init(e,t),R.init(e,t)});function bp(e){return so(jo,e)}s(bp,"xid");var Vo=h("ZodKSUID",(e,t)=>{Us.init(e,t),R.init(e,t)});function vp(e){return uo(Vo,e)}s(vp,"ksuid");var Mo=h("ZodIPv4",(e,t)=>{Ws.init(e,t),R.init(e,t)});function xp(e){return co(Mo,e)}s(xp,"ipv4");var Da=h("ZodMAC",(e,t)=>{Hs.init(e,t),R.init(e,t)});function kp(e){return tc(Da,e)}s(kp,"mac");var Fo=h("ZodIPv6",(e,t)=>{Xs.init(e,t),R.init(e,t)});function zp(e){return ao(Fo,e)}s(zp,"ipv6");var Ko=h("ZodCIDRv4",(e,t)=>{Ys.init(e,t),R.init(e,t)});function Sp(e){return lo(Ko,e)}s(Sp,"cidrv4");var Uo=h("ZodCIDRv6",(e,t)=>{Qs.init(e,t),R.init(e,t)});function Pp(e){return fo(Uo,e)}s(Pp,"cidrv6");var Bo=h("ZodBase64",(e,t)=>{eu.init(e,t),R.init(e,t)});function Ip(e){return po(Bo,e)}s(Ip,"base64");var Jo=h("ZodBase64URL",(e,t)=>{tu.init(e,t),R.init(e,t)});function Ap(e){return mo(Jo,e)}s(Ap,"base64url");var Go=h("ZodE164",(e,t)=>{ru.init(e,t),R.init(e,t)});function Op(e){return ho(Go,e)}s(Op,"e164");var Ra=h("ZodCreditCard",(e,t)=>{nu.init(e,t),R.init(e,t)});function Zp(e){return rc(Ra,e)}s(Zp,"creditCard");var La=h("ZodIBAN",(e,t)=>{ou.init(e,t),R.init(e,t)});function Np(e){return nc(La,e)}s(Np,"iban");var qo=h("ZodJWT",(e,t)=>{iu.init(e,t),R.init(e,t)});function Ep(e){return go(qo,e)}s(Ep,"jwt");var rt=h("ZodCustomStringFormat",(e,t)=>{su.init(e,t),R.init(e,t)});function Cp(e,t,r={}){return Ye(rt,e,t,r)}s(Cp,"stringFormat");function Tp(e){return Ye(rt,"hostname",Gi,e)}s(Tp,"hostname");function Dp(e){return Ye(rt,"hex",cs,e)}s(Dp,"hex");function Rp(e){return Ye(rt,"currency_code",Xi,e)}s(Rp,"currencyCode");function Lp(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=le[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Ye(rt,n,o,t)}s(Lp,"hash");var jt=h("ZodNumber",(e,t)=>{En.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mc(e,r,n,o),e.isFinite=!0},v.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(he(e,t))},gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},int(e){return this.check(Ao(e))},safe(e){return this.check(Ao(e))},positive(e){return this.check(he(0,e))},nonnegative(e){return this.check(ue(0,e))},negative(e){return this.check(me(0,e))},nonpositive(e){return this.check(se(0,e))},multipleOf(e,t){return this.check(Ae(e,t))},step(e,t){return this.check(Ae(e,t))},finite(){return this}}));function ja(e){return ic(jt,e)}s(ja,"number");var nt=h("ZodNumberFormat",(e,t)=>{uu.init(e,t),jt.init(e,t)});function Ao(e){return uc(nt,e)}s(Ao,"int");function jp(e){return cc(nt,e)}s(jp,"float32");function Vp(e){return ac(nt,e)}s(Vp,"float64");function Mp(e){return lc(nt,e)}s(Mp,"int32");function Fp(e){return fc(nt,e)}s(Fp,"uint32");var Vt=h("ZodBoolean",(e,t)=>{hr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fc(e,r,n,o)});function Va(e){return pc(Vt,e)}s(Va,"boolean");var Mt=h("ZodBigInt",(e,t)=>{Cn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kc(e,r,n,o)},v.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(ue(e,t))},min(e,t){return this.check(ue(e,t))},gt(e,t){return this.check(he(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},positive(e){return this.check(he(BigInt(0),e))},negative(e){return this.check(me(BigInt(0),e))},nonpositive(e){return this.check(se(BigInt(0),e))},nonnegative(e){return this.check(ue(BigInt(0),e))},multipleOf(e,t){return this.check(Ae(e,t))}}));function Kp(e){return mc(Mt,e)}s(Kp,"bigint");var Wo=h("ZodBigIntFormat",(e,t)=>{cu.init(e,t),Mt.init(e,t)});function Up(e){return gc(Wo,e)}s(Up,"int64");function Bp(e){return yc(Wo,e)}s(Bp,"uint64");var Ma=h("ZodSymbol",(e,t)=>{au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uc(e,r,n,o)});function Jp(e){return _c(Ma,e)}s(Jp,"symbol");var Fa=h("ZodUndefined",(e,t)=>{lu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jc(e,r,n,o)});function Gp(e){return $c(Fa,e)}s(Gp,"_undefined");var Ka=h("ZodNull",(e,t)=>{fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bc(e,r,n,o)});function Ua(e){return wc(Ka,e)}s(Ua,"_null");var Ba=h("ZodAny",(e,t)=>{pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wc(e,r,n,o)});function qp(){return bc(Ba)}s(qp,"any");var Ja=h("ZodUnknown",(e,t)=>{du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xc(e,r,n,o)});function Qe(){return vc(Ja)}s(Qe,"unknown");var Ga=h("ZodNever",(e,t)=>{mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qc(e,r,n,o)});function Xo(e){return xc(Ga,e)}s(Xo,"never");var qa=h("ZodVoid",(e,t)=>{hu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gc(e,r,n,o)});function Wp(e){return kc(qa,e)}s(Wp,"_void");var Cr=h("ZodDate",(e,t)=>{gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o),e.min=(r,n)=>e.check(ue(r,n)),e.max=(r,n)=>e.check(se(r,n))},v.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 Xp(e){return zc(Cr,e)}s(Xp,"date");var Wa=h("ZodArray",(e,t)=>{tt(),yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>aa(e,r,n,o),e.element=t.element},{min(e,t){return this.check(xe(e,t))},nonempty(e){return this.check(xe(1,e))},max(e,t){return this.check(Xe(e,t))},length(e,t){return this.check(He(e,t))},unwrap(){return this.element}});function Tr(e,t){return Ic(Wa,e,t)}s(Tr,"array");function Hp(e){let t=e._zod.def.shape;return Ho(Object.keys(t))}s(Hp,"keyof");var Dr=h("ZodObject",(e,t)=>{tt(),_u.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>la(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ho(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Qe()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Qe()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Xo()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Lr,this,e[0])},exactPartial(...e){return v.partial(Qo,this,e[0],"exactPartial")},required(...e){return v.required(ei,this,e[0])}});function Yp(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Dr(r)}s(Yp,"object");function Qp(e,t){return new Dr({type:"object",shape:e,catchall:Xo(),...v.normalizeParams(t)})}s(Qp,"strictObject");function ed(e,t){return new Dr({type:"object",shape:e,catchall:Qe(),...v.normalizeParams(t)})}s(ed,"looseObject");var Rr=h("ZodUnion",(e,t)=>{gr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function Ft(e,t){return new Rr({type:"union",options:e,...v.normalizeParams(t)})}s(Ft,"union");var Xa=h("ZodXor",(e,t)=>{Rr.init(e,t),$u.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function td(e,t){return new Xa({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}s(td,"xor");var Ha=h("ZodDiscriminatedUnion",(e,t)=>{Rr.init(e,t),bu.init(e,t)});function rd(e,t,r){return new Ha({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}s(rd,"discriminatedUnion");var Ya=h("ZodIntersection",(e,t)=>{vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fa(e,r,n,o)});function Qa(e,t){return new Ya({type:"intersection",left:e,right:t})}s(Qa,"intersection");var el=h("ZodTuple",(e,t)=>{tt(),Tn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pa(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 Lr({type:"optional",innerType:t}))})}});function tl(e,t,r){let n=t instanceof P,o=n?r:t,i=n?t:null;return new el({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}s(tl,"tuple");var Dt=h("ZodRecord",(e,t)=>{tt(),xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>da(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function rl(e,t,r){return!t||!t._zod?new Dt({type:"record",keyType:Zr(),valueType:e,...v.normalizeParams(t)}):new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}s(rl,"record");function nd(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}s(nd,"partialRecord");function od(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}s(od,"looseRecord");var nl=h("ZodMap",(e,t)=>{tt(),ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ua(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(We(...r))});function id(e,t,r){return new nl({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}s(id,"map");var ol=h("ZodSet",(e,t)=>{tt(),zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ca(e,r,n,o),e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(We(...r))});function sd(e,t){return new ol({type:"set",valueType:e,...v.normalizeParams(t)})}s(sd,"set");var Rt=h("ZodEnum",(e,t)=>{Su.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Yc(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 u of n)if(r.has(u))i[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let u of n)if(r.has(u))delete i[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})}});function Ho(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Rt({type:"enum",entries:r,...v.normalizeParams(t)})}s(Ho,"_enum");function ud(e,t){return new Rt({type:"enum",entries:e,...v.normalizeParams(t)})}s(ud,"nativeEnum");var il=h("ZodLiteral",(e,t)=>{Pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(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 cd(e,t){return new il({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}s(cd,"literal");var sl=h("ZodFile",(e,t)=>{Iu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ra(e,r,n,o),e.min=(r,n)=>e.check(ge(r,n)),e.max=(r,n)=>e.check(Oe(r,n)),e.mime=(r,n)=>e.check(Pt(Array.isArray(r)?r:[r],n))});function ad(e){return Ac(sl,e)}s(ad,"file");var ul=h("ZodTransform",(e,t)=>{tt(),Au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sa(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let u=i;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),"input"in u||(u.input=r.value),u.inst??(u.inst=e),r.issues.push(v.issue(u))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Yo(e){return new ul({type:"transform",transform:e})}s(Yo,"transform");var Lr=h("ZodOptional",(e,t)=>{Dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function et(e){return new Lr({type:"optional",innerType:e})}s(et,"optional");var Qo=h("ZodExactOptional",(e,t)=>{Ou.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new Qo({type:"optional",innerType:e})}s(cl,"exactOptional");var al=h("ZodNullable",(e,t)=>{Zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ma(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nr(e){return new al({type:"nullable",innerType:e})}s(Nr,"nullable");function ld(e){return et(Nr(e))}s(ld,"nullish");var ll=h("ZodDefault",(e,t)=>{Nu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ya(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fl(e,t){return new ll({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(fl,"_default");var pl=h("ZodPrefault",(e,t)=>{Eu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dl(e,t){return new pl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(dl,"prefault");var ei=h("ZodNonOptional",(e,t)=>{Cu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ha(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ml(e,t){return new ei({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}s(ml,"nonoptional");var hl=h("ZodSuccess",(e,t)=>{Tu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>na(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fd(e){return new hl({type:"success",innerType:e})}s(fd,"success");var gl=h("ZodCatch",(e,t)=>{Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yl(e,t){return new gl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}s(yl,"_catch");var _l=h("ZodNaN",(e,t)=>{Ru.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ea(e,r,n,o)});function pd(e){return Pc(_l,e)}s(pd,"nan");var jr=h("ZodPipe",(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wa(e,r,n,o),e.in=t.in,e.out=t.out});function Oo(e,t){return new jr({type:"pipe",in:e,out:t})}s(Oo,"pipe");var Vr=h("ZodCodec",(e,t)=>{jr.init(e,t),yr.init(e,t)});function dd(e,t,r){return new Vr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}s(dd,"codec");function md(e){let t=e._zod.def;return new Vr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(md,"invertCodec");var $l=h("ZodPreprocess",(e,t)=>{jr.init(e,t),Lu.init(e,t)}),wl=h("ZodReadonly",(e,t)=>{ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ba(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bl(e){return new wl({type:"readonly",innerType:e})}s(bl,"readonly");var vl=h("ZodTemplateLiteral",(e,t)=>{Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ta(e,r,n,o)});function hd(e,t){return new vl({type:"template_literal",parts:e,...v.normalizeParams(t)})}s(hd,"templateLiteral");var xl=h("ZodLazy",(e,t)=>{_r.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xa(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function kl(e){return new xl({type:"lazy",getter:e})}s(kl,"lazy");var zl=h("ZodPromise",(e,t)=>{Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gd(e){return new zl({type:"promise",innerType:e})}s(gd,"promise");var Sl=h("ZodFunction",(e,t)=>{Mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ia(e,r,n,o)});function yd(e){return new Sl({type:"function",input:Array.isArray(e?.input)?tl(e?.input):e?.input??Tr(Qe()),output:e?.output??Qe()})}s(yd,"_function");var Mr=h("ZodCustom",(e,t)=>{Ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oa(e,r,n,o)});function _d(e){let t=new L({check:"custom"});return t._zod.check=e,t}s(_d,"check");function $d(e,t){return Oc(Mr,e??(()=>!0),t)}s($d,"custom");function Pl(e,t={}){return Zc(Mr,e,t)}s(Pl,"refine");function Il(e,t){return Nc(e,t)}s(Il,"superRefine");var wd=Ec,bd=Cc,Al=h("ZodInstanceOf",(e,t)=>{Mr.init(e,t)},{properties(e,t){return this.check(St(e,t))}});function vd(e,t={}){let r=new Al({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...v.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(vd,"_instanceof");var xd=s((...e)=>Tc({Codec:Vr,Boolean:Vt,String:Lt},...e),"stringbool");function kd(e){let t=kl(()=>Ft([Zr(e),ja(),Va(),Ua(),Tr(t),rl(Zr(),t)]));return t}s(kd,"json");function zd(e,t){return new $l({type:"pipe",in:Yo(e),out:t})}s(zd,"preprocess");var vy={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 xy(e){F({customError:e})}s(xy,"setErrorMap");function ky(){return F().customError}s(ky,"getErrorMap");var Ol;Ol||(Ol={});var Fr={};$e(Fr,{ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,date:()=>Sy,datetime:()=>zy,duration:()=>Iy,time:()=>Py});function zy(e){return zr(Ce,e)}s(zy,"datetime");function Sy(e){return Sr(Te,e)}s(Sy,"date");function Py(e){return Pr(De,e)}s(Py,"time");function Iy(e){return Ir(Re,e)}s(Iy,"duration");var w={...Kt,...Po,iso:Fr},Ay=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 Oy(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(Oy,"detectVersion");function Sd(e,t){return e.map((r,n)=>n<t?r:r.optional())}s(Sd,"applyMinItems");function Zy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s(Zy,"decodeJSONPointerSegment");function Ny(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:Zy(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(Ny,"resolveRef");function Ey(e,t){return w.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 u of i){let c=t.keySchema.safeParse(u);c.success||n.issues.push({code:"invalid_key",origin:"record",issues:c.error.issues,input:u,path:[u],continue:!0})}}).pipe(e)}s(Ey,"checkObjectGuards");function Zl(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 u of e){let c=Zl(u,t);if(c===null)return null;i.push(c)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let u=Zl(e[i],t);if(u===null)return null;o.push(`${i.length}:${i}=${u}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(Zl,"canonicalKey");var Cy=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Ty=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Kr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Kr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>Cy.has(t)?Kr(r):!Ty.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Kr))}s(Kr,"containsRef");function Pd(e){return e===1?"element":"elements"}s(Pd,"plural");function Dy(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let u=0;u<o.length;u++){let c=Zl(o[u],new Set);if(c===null)continue;let a=i.get(c);if(a===void 0){i.set(c,u);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${u} duplicates the one at index ${a}`,input:o,path:[u],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,u=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,c=0;for(let a of o)if(t.containsSchema.safeParse(a).success&&++c>=u)break;c<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Pd(i)}; found ${c}`,input:o,continue:!0}),t.maxContains!==void 0&&c>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Pd(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(Dy,"checkArrayGuards");function Id(e,t){if(e!==!1)return e===void 0||e===!0?w.any():ee(e,t)}s(Id,"getTupleRest");var Ry=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ad(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return w.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 w.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=Ny(o,t),u=ee(i,t);return t.refs.set(o,u),t.processing.delete(o),u}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 w.null();if(o.length===0)return w.never();if(o.length===1)return w.literal(o[0]);if(o.every(u=>typeof u=="string"))return w.enum(o);let i=o.map(u=>w.literal(u));return i.length<2?i[0]:w.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let u={...e,type:i};return Ad(u,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!r)return w.any();let n;switch(r){case"string":{let o=w.string();if(e.format){let i=e.format;i==="email"?o=o.check(w.email()):i==="uri"||i==="uri-reference"?o=o.check(w.url()):i==="uuid"||i==="guid"?o=o.check(w.uuid()):i==="date-time"?o=o.check(w.iso.datetime({offset:!0})):i==="date"?o=o.check(w.iso.date()):i==="time"?o=o.check(w.regex(Ry)):i==="duration"?o=o.check(w.iso.duration()):i==="hostname"?o=o.check(w.hostname()):i==="ipv4"?o=o.check(w.ipv4()):i==="ipv6"?o=o.check(w.ipv6()):i==="mac"?o=o.check(w.mac()):i==="cidr"?o=o.check(w.cidrv4()):i==="cidr-v6"?o=o.check(w.cidrv6()):i==="base64"?o=o.check(w.base64()):i==="base64url"?o=o.check(w.base64url()):i==="e164"?o=o.check(w.e164()):i==="credit_card"?o=o.check(w.creditCard()):i==="iban"?o=o.check(w.iban()):i==="jwt"?o=o.check(w.jwt()):i==="emoji"?o=o.check(w.emoji()):i==="nanoid"?o=o.check(w.nanoid()):i==="cuid"?o=o.check(w.cuid()):i==="cuid2"?o=o.check(w.cuid2()):i==="ulid"?o=o.check(w.ulid()):i==="xid"?o=o.check(w.xid()):i==="ksuid"&&(o=o.check(w.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"?w.number().int():w.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=w.boolean();break}case"null":{n=w.null();break}case"object":{let o={},i=e.properties||{},u=new Set(e.required||[]),c=typeof e.additionalProperties=="object"?ee(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let m=ee(d,t);J(o,p,u.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let $=ee(p[y],t),z=w.string().regex(new RegExp(y));m.push(w.looseRecord(z,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)n=w.object({}).passthrough();else if(g.length===1)n=g[0];else{let y=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)y=w.intersection(y,g[$]);n=y}if(e.additionalProperties===!1){let y=Object.keys(o),$=d.map(x=>new RegExp(x)),z=n;n=n.check(x=>{if(!ce(x.value))return;let I=[];for(let E of Object.keys(x.value))y.includes(E)||$.some(j=>j.test(E))||I.push(E);I.length&&x.issues.push({code:"unrecognized_keys",keys:I,input:x.value,inst:z})})}}else{let p=w.object(o);e.additionalProperties===!1?n=p.strict():c?n=p.catchall(c):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=ee(d,t)}n=Ey(n,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let u=typeof e.minItems=="number"?e.minItems:0,c=o.map(p=>ee(p,t)),a=Sd(c,u),l=Array.isArray(i)?void 0:Id(i,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let u=typeof e.minItems=="number"?e.minItems:0,c=i.map(p=>ee(p,t)),a=Sd(c,u),l=Id(e.additionalItems,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let u=ee(i,t),c=w.array(u);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),n=c}else n=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=Dy(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ee(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(Ad,"convertBaseSchema");function ee(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r=Ad(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>ee(l,t)),a=w.union(c);r=n?w.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>ee(l,t)),a=w.xor(c);r=n?w.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:w.any();else{let c=n?r:ee(e.allOf[0],t),a=n?0:1;for(let l=a;l<e.allOf.length;l++)c=w.intersection(c,ee(e.allOf[l],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=w.nullable(r)),e.readOnly===!0&&(r=w.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(o[c]=e[c]);let u=["contentEncoding","contentMediaType","contentSchema"];for(let c of u)c in e&&(o[c]=e[c]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Kr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let c of["minProperties","maxProperties"])e[c]!==void 0&&(o[c]=e[c])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Kr(e.contains)&&(o.contains=e.contains);for(let c of["uniqueItems","minContains","maxContains"])e[c]!==void 0&&(o[c]=e[c])}for(let c of Object.keys(e))Ay.has(c)||J(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}s(ee,"convertSchema");function Od(e,t){if(typeof e=="boolean")return e?w.any():w.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=Oy(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??G};return ee(r,i)}s(Od,"fromJSONSchema");var Zd=Symbol("z.visit/resolving");function Ur(e,t){let r=typeof t=="function"?t:(u,c)=>{let a=t[u._zod.def.type];return a?a(u,c):u},n=new Map;function o(u){let c=n.get(u);if(c===Zd)return new _r({type:"lazy",getter:s(()=>n.get(u),"getter")});if(c!==void 0)return c;n.set(u,Zd);let a=i(u),l=r(a,a!==u);return n.set(u,l),l}s(o,"run");function i(u){let c=u._zod.def,a=c.type;switch(a){case"object":{let l=c.shape,f=Object.keys(l),p=!1,d={};for(let g of f){let y=o(l[g]);y!==l[g]&&(p=!0),d[g]=y}let m=c.catchall;return c.catchall&&(m=o(c.catchall),m!==c.catchall&&(p=!0)),p?C(u,{...c,shape:d,catchall:m}):u}case"array":{let l=o(c.element);return l===c.element?u:C(u,{...c,element:l})}case"tuple":{let l=c.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=c.rest;return c.rest&&(d=o(c.rest),d!==c.rest&&(f=!0)),f?C(u,{...c,items:p,rest:d}):u}case"record":case"map":{let l=o(c.keyType),f=o(c.valueType);return l===c.keyType&&f===c.valueType?u:C(u,{...c,keyType:l,valueType:f})}case"set":{let l=o(c.valueType);return l===c.valueType?u:C(u,{...c,valueType:l})}case"union":{let l=c.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?C(u,{...c,options:p}):u}case"intersection":{let l=o(c.left),f=o(c.right);return l===c.left&&f===c.right?u:C(u,{...c,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(c.innerType);return l===c.innerType?u:C(u,{...c,innerType:l})}case"pipe":{let l=o(c.in),f=o(c.out);return l===c.in&&f===c.out?u:C(u,{...c,in:l,out:f})}case"function":{let l=o(c.input),f=o(c.output);return l===c.input&&f===c.output?u:C(u,{...c,input:l,output:f})}case"lazy":{let l=c.getter,{_cachedInner:f,...p}=c;return C(u,{...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 u;default:return u}}return s(i,"mapInner"),o(e)}s(Ur,"visit");function Nd(e){return Ur(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:Ft(r.options)},"union")})}s(Nd,"deepPartial");function Ly(e,t){if(!t?.length)return e;let r=e._zod.def;return C(e,fe(r,{checks:[...r.checks??[],...t]}),{parent:!0})}s(Ly,"withChecks");function Ed(e){return Ly(e.out,e.checks)}s(Ed,"outSide");function jy(e){return e.in._zod.traits.has("$ZodTransform")?Ed(e):e.in}s(jy,"inSide");function Cd(e){return Ur(e,{pipe:s(t=>jy(t._zod.def),"pipe"),default:s((t,r)=>r?et(t._zod.def.innerType):t,"default"),catch:s((t,r)=>r?t._zod.def.innerType:t,"catch")})}s(Cd,"input");function Td(e){return Ur(e,{pipe:s(t=>Ed(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}s(Td,"output");var Nl={};$e(Nl,{bigint:()=>Ky,boolean:()=>Fy,date:()=>Uy,number:()=>My,string:()=>Vy});function Vy(e){return ec(Lt,e)}s(Vy,"string");function My(e){return sc(jt,e)}s(My,"number");function Fy(e){return dc(Vt,e)}s(Fy,"boolean");function Ky(e){return hc(Mt,e)}s(Ky,"bigint");function Uy(e){return Sc(Cr,e)}s(Uy,"date");var El=1e4,Dd=b.string().min(1).max(1024),_e=b.array(Dd).max(El),By=b.enum(["project","chronological","machine"]),Jy=b.enum(["updated","created","alpha","none"]),Gy=b.enum(["default","ascending","descending"]),qy=b.enum(["folded","tree"]),Wy=b.enum(["active","archived"]),Xy=b.enum(["muted","colour","hidden"]),Hy=b.enum(["blocked","everything"]),Yy=b.array(b.union([b.literal("threads"),Dd.regex(/^(project|section|machine):\S+$/)])).max(El).transform(e=>[...new Set(e)]);function M(e,t,r){return{schema:e,defaultValue:t,description:r}}s(M,"define");var ot={threadLifecycles:M(b.array(Wy).min(1).max(2).refine(e=>new Set(e).size===e.length,"Lifecycles must be unique"),["active"],"Thread lifecycles shown: active, archived, or both. At least one is required."),organizationMode:M(By,"project","How top-level groups are formed: project, chronological (custom sections) or machine."),environmentGrouping:M(b.boolean(),!1,"Whether sibling threads sharing a worktree environment fold into a folder row."),chronologicalSort:M(Jy,"updated","Sort field inside a group: updated, created or alpha. none is read as updated."),sortDirection:M(Gy,"default","Sort direction; default keeps the field's natural direction."),sectionOrder:M(_e,["pinned","projects","threads"],"Top-level group order when organized by project."),manualSectionOrder:M(_e,["pinned","sections","threads"],"Top-level group order when organized chronologically."),machineSectionOrder:M(_e,["pinned","machines","threads"],"Top-level group order when organized by machine."),hiddenGroups:M(Yy,[],"Groups moved into More: threads, project:<id>, section:<id> or machine:<id>."),collapsedSections:M(b.array(b.enum(["pinned","threads"])).max(El),[],"Built-in groups (pinned, threads) that are collapsed."),collapsedProjects:M(_e,[],"Project ids whose group is collapsed."),collapsedThreadSections:M(_e,[],"Custom section keys (section:<id>) whose group is collapsed."),collapsedMachines:M(_e,[],"Machine ids whose group is collapsed."),collapsedEnvironments:M(_e,[],"Environment ids whose folder row is collapsed."),nesting:M(qy,"folded","Child thread nesting: folded (one flat level behind a chip) or tree (bb's tree)."),foldOlder:M(b.boolean(),!0,"Whether quiet roots past the 5 most recent fold behind an N older row."),workingFirst:M(b.boolean(),!1,"Whether working threads sort first under Updated, as bb's list does."),expandedOlder:M(_e,[],"Group ids and parent thread ids whose N older fold the user opened."),expandedChildren:M(_e,[],"Parent thread ids the user expanded (folded nesting)."),collapsedChildren:M(_e,[],"Parent thread ids the user collapsed (tree nesting)."),showPullRequests:M(b.boolean(),!0,"Whether rows show a pull request badge."),childAttention:M(Hy,"blocked","Which child threads count under Needs attention, in badges and counters, and stay out of a family's fold along with running children: blocked (waiting on you, offline, or an orphaned failure) or everything (also every failed and unread child)."),harnessIcon:M(Xy,"muted","How rows draw the harness logo: muted (monochrome), colour (the provider's tint) or hidden.")},ze=Object.keys(ot);function Cl(e){return Object.hasOwn(ot,e)}s(Cl,"isPreferenceKey");function it(e){return structuredClone(ot[e].defaultValue)}s(it,"preferenceDefault");function Rd(){return Object.fromEntries(ze.map(e=>[e,it(e)]))}s(Rd,"defaultPreferences");function Tl(e){return ot[e].description}s(Tl,"describePreference");function ti(e,t){let r=ot[e].schema.safeParse(t);return r.success?{success:!0,value:r.data}:{success:!1,message:r.error.issues.map(n=>n.message).join("; ")}}s(ti,"parsePreference");function Dl(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};let t=e,r={};for(let[n,o]of Object.entries(t)){if(n==="collapsedThreads"||!Cl(n))continue;let u=ti(n,n==="environmentGrouping"&&o==="auto"?!1:o);u.success&&(r[n]=u.value)}return r}s(Dl,"mapBbPreferences");var bw=b.object({filter:b.enum(["all","attention"]).catch("all"),density:b.enum(["compact","comfortable"]).catch("compact")});var ri=b.record(b.string(),b.number()),Ld=b.object({startedAt:ri,finishedAt:ri,pendingAt:ri,seenAt:ri}),Br=140,Rl=b.object({kind:b.enum(["question","approval","plan","input","failed","done"]),text:b.string().max(Br),at:b.number()}),ni=b.object({pending:Rl.optional(),failed:Rl.optional(),done:Rl.optional()}),Le={preferences:"preferences",stamps:"stamps",scheduled:"scheduled",notes:"notes"};var Jr=b.enum(ze),e_=b.object(Object.fromEntries(ze.map(e=>[e,ot[e].schema]))),t_=b.record(b.string(),b.number()),jd=b.array(b.string().min(1).max(1024)).max(1e4),Vd=Qy({listPreferences:{input:b.null(),output:b.object({preferences:e_}).strict()},setPreference:{input:b.object({key:Jr,value:b.unknown()}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},resetPreference:{input:b.object({key:Jr}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},importPreferences:{input:b.object({bbMirror:b.unknown().nullable()}).strict(),output:b.object({status:b.enum(["already-imported","imported","defaults"]),source:b.enum(["local-storage","cli","none"]).nullable(),keys:b.array(Jr)}).strict()},listStamps:{input:b.null(),output:b.object({stamps:Ld}).strict()},markSeen:{input:b.object({threadIds:jd}).strict(),output:b.object({at:b.number()}).strict()},clearSeen:{input:b.object({threadIds:jd}).strict(),output:b.object({ok:b.literal(!0)}).strict()},listNotes:{input:b.null(),output:b.object({notes:b.record(b.string(),ni)}).strict()},listScheduled:{input:b.null(),output:b.object({status:b.enum(["ready","error"]),scheduled:t_}).strict()}});import{PluginCliError as Fd,cliCommand as ii,defineCli as n_}from"@get-bb/plugin-sdk";var r_="preference:";function oi(e){return`${r_}${e}`}s(oi,"preferenceKvKey");var Gr=class extends Error{static{s(this,"PreferenceValidationError")}key;detail;constructor(t,r){super(`Invalid value for ${t}: ${r}`),this.name="PreferenceValidationError",this.key=t,this.detail=r}};function Md(e){let{kv:t}=e.storage;function r(o,i){let u={key:o,value:i};e.realtime.publish(Le.preferences,u)}s(r,"publish");async function n(o){let i=await t.get(oi(o));if(i===void 0)return it(o);let u=ti(o,i);return u.success?u.value:(e.log.warn(`stored preference ${o} is invalid (${u.message}); using the default`),it(o))}return s(n,"read"),{read:n,async readAll(){let o=Rd();return await Promise.all(ze.map(async i=>{o[i]=await n(i)})),o},async isStored(o){return await t.get(oi(o))!==void 0},async write(o,i){let u=ti(o,i);if(!u.success)throw new Gr(o,u.message);return await t.set(oi(o),u.value),r(o,u.value),u.value},async reset(o){await t.delete(oi(o));let i=it(o);return r(o,i),i}}}s(Md,"createPreferenceStore");function o_(e){try{return JSON.parse(e)}catch{return e}}s(o_,"parseCliValue");function Ll(e){if(Cl(e))return e;throw new Fd(`Unknown preference: ${e}`,{code:"unknown_preference",hint:`Known preferences: ${ze.join(", ")}.`})}s(Ll,"requirePreferenceKey");var si={type:"boolean",description:"Emit machine-readable JSON"},jl={name:"key",description:"Preference name",required:!0};function Kd(e){function t(r,n,o){return o?JSON.stringify({key:r,value:n}):`${r} = ${JSON.stringify(n)}`}return s(t,"keyValueOutput"),n_({name:"thread-glance",summary:"Inspect and change the Thread Glance sidebar's layout preferences",description:"Organization, sort, group order, hidden and collapsed groups, child nesting and folding for the Thread Glance sidebar. Values are JSON; a bare word is read as a string.",commands:{"prefs list":ii({summary:"List every preference and its current value",options:{json:si},async run(r){let n=await e.readAll();return r.options.json?{exitCode:0,stdout:JSON.stringify(n)}:{exitCode:0,stdout:ze.map(i=>`${i} ${JSON.stringify(n[i])} ${Tl(i)}`).join(`
|
|
69
|
-
`)}}}),"prefs get":ii({summary:"Print one preference",positionals:[jl],options:{json:si},async run(r){let n=Ll(r.positionals.key),o=await e.read(n);return{exitCode:0,stdout:r.options.json?JSON.stringify({key:n,value:o}):JSON.stringify(o)}}}),"prefs set":ii({summary:"Set one preference",positionals:[jl,{name:"value",description:`JSON value, e.g. '"machine"' or '["pinned","threads"]'`,required:!0}],options:{json:si},async run(r){let n=Ll(r.positionals.key);try{let o=await e.write(n,
|
|
70
|
-
`)){let r=t.replace(/^\s*#+/,"").trim();if(r!=="")return r}return""}s(s_,"firstNonEmptyLine");function Jd(e,t){return t>1?`${e} (+${t-1} more)`:e}s(Jd,"withMore");function u_(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e.questions;if(!Array.isArray(t)||t.length===0)return null;let r=t[0]?.prompt;return typeof r=="string"&&r.trim()!==""?Jd(r,t.length):null}s(u_,"questionsText");function c_(e,t){return e.trim()===""&&t?t:e}s(c_,"approvalText");function a_(e){let t=e.payload;switch(e.payload.kind){case"user_question":{let{questions:r}=e.payload,n=r[0]?.prompt??"";return{kind:"question",text:Jd(n,r.length)}}case"approval":{let{subject:r,reason:n}=e.payload;switch(r.kind){case"command":return{kind:"approval",text:c_(r.command,n)};case"file_change":return{kind:"approval",text:`File changes${r.writeScope?` in ${r.writeScope}`:""}`};case"permission_grant":return{kind:"approval",text:`Permissions${r.toolName?` for ${r.toolName}`:""}`};case"tool_use":return{kind:"approval",text:r.presentation.title??r.tool};case"plan":return{kind:"plan",text:s_(r.plan)};default:return{kind:"approval",text:n??""}}}case"plugin":{if(e.origin?.kind!=="plugin")break;let{title:r,presentation:n,data:o}=e.payload;if(e.origin.pluginId===i_)return{kind:"question",text:u_(o)??r};let i=n?.detail?Bt(n.detail):"",u=`${r}: ${i}`;return{kind:"input",text:i!==""&&u.length<=Br?u:r}}}return"title"in t&&typeof t.title=="string"?{kind:"input",text:t.title}:{kind:"input",text:Bd}}s(a_,"describeRaw");function Gd(e){let t=a_(e),r=Bt(t.text);return{kind:t.kind,text:r===""?Bd:r}}s(Gd,"describeInteraction");function Ml(e){let t=e===null?"":Bt(e);return{kind:"failed",text:t===""?"Failed":t}}s(Ml,"describeFailure");function qd(e){let t=e===null?"":Bt(e);return t===""?null:{kind:"done",text:t}}s(qd,"describeDone");function Wd(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let u=new Map;for(let c of await t.list(Vl)){let a=c.slice(Vl.length),l=ni.safeParse(await t.get(c));if(!l.success||Object.keys(l.data).length===0){e.log.warn(`stored notes for ${a} are invalid; dropping them`),await t.delete(c);continue}u.set(a,l.data)}return n=u,u}s(o,"load");async function i(u,c,a){let l=Object.keys(a).length===0;l?(u.delete(c),await t.delete(Ud(c))):(u.set(c,a),await t.set(Ud(c),a));let f={threadId:c,notes:l?null:a};e.realtime.publish(Le.notes,f)}return s(i,"save"),{list:s(()=>r(async()=>Object.fromEntries(await o())),"list"),get:s(u=>r(async()=>(await o()).get(u)),"get"),update:s((u,c)=>r(async()=>{let a=await o(),l=a.get(u)??{},f={...l};for(let[p,d]of Object.entries(c))d===null?delete f[p]:f[p]=d;JSON.stringify(f)!==JSON.stringify(l)&&await i(a,u,f)}),"update"),forget:s(u=>r(async()=>{let c=await o();for(let a of u)c.has(a)&&await i(c,a,{})}),"forget"),prune:s((u,c)=>r(async()=>{let a=await o(),l=[];for(let[f,p]of[...a])u.has(f)||Math.max(...Object.values(p).map(m=>m.at))>=c||(await i(a,f,{}),l.push(f));return l}),"prune")}}s(Wd,"createNoteStore");var l_=20,f_=new Set(["error","failed","provider error","turn failed","unknown error"]);function Xd(e){if(e==null)return!0;let t=e.trim().toLowerCase().replace(/[.!]+$/,"");return t===""||f_.has(t)||/^command [\w./:-]+ failed$/.test(t)}s(Xd,"isGenericError");function p_(e){if(!e)return null;let t=e.httpStatusCode===null?"":` (${e.httpStatusCode})`;switch(e.category){case"rate-limit":return`Rate limited${t}`;case"unauthorized":return"Not signed in";case"billing":case"budget-exceeded":return"Out of credits";case"context-window-exceeded":return"Context window full";case"unknown":return t===""?null:`Error${t}`;default:{let r=e.category.replace(/-/g," ");return`${r.charAt(0).toUpperCase()}${r.slice(1)}${t}`}}}s(p_,"errorInfoLabel");function d_(e,t){for(let r of e){if(r.type==="turn/started"&&t===null)return null;if(!(r.type!=="provider/error"&&r.type!=="system/error")&&!(t!==null&&r.scope?.turnId!==void 0&&r.scope.turnId!==t))return r.data??{}}return null}s(d_,"latestProviderError");function m_(e){let t=[e.error,e.providerError?.detail,e.providerError?.message,p_(e.errorInfo??e.providerError?.errorInfo)];for(let r of t)if(!Xd(r)){let n=Bt(r);if(n!=="")return n}return null}s(m_,"failureText");async function Fl(e,t){let r=null;if(Xd(t.error))try{let n=await e.sdk.threads.events.list({threadId:t.threadId,types:["provider/error","system/error","turn/started"],order:"desc",limit:String(l_)});r=d_(n,t.turnId)}catch(n){e.log.warn(`could not read events of ${t.threadId} for its failure: ${n instanceof Error?n.message:String(n)}`)}return m_({error:t.error,providerError:r,errorInfo:t.errorInfo})}s(Fl,"resolveFailureText");import{execFile as h_}from"node:child_process";var Hd="migration:import:v1",g_=5e3,y_=4*1024*1024;function Yd(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return null}if(t===null||typeof t!="object"||Array.isArray(t))return null;let r=t,n=r.preferences;return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:r}s(Yd,"unwrapBbPreferences");function __(e=process.env){let t=e.BB_CLI?.trim();return t||"bb"}s(__,"bbCliPath");function Qd(e,t=process.env){return()=>new Promise(r=>{let n=__(t);h_(n,["thread-list","prefs","list","--json"],{timeout:g_,maxBuffer:y_,encoding:"utf8"},(o,i)=>{if(o){e.warn(`could not run ${n} thread-list prefs list: ${o.message}`),r(null);return}try{r(JSON.parse(i))}catch{e.warn(`${n} thread-list prefs list printed output that is not JSON`),r(null)}})})}s(Qd,"createBbCliReader");async function em(e,t){if(await e.kv.get(Hd)!==void 0)return{status:"already-imported",source:null,keys:[]};let r="none",n={},o=t===null?null:Yd(t),i=o===null?{}:Dl(o);if(Object.keys(i).length>0)r="local-storage",n=i;else{let c=Yd(await e.readBbCli()),a=c===null?{}:Dl(c);Object.keys(a).length>0&&(r="cli",n=a)}let u=[];for(let[c,a]of Object.entries(n))await e.store.isStored(c)||JSON.stringify(a)!==JSON.stringify(it(c))&&(await e.store.write(c,a),u.push(c));return await e.kv.set(Hd,{source:r,keys:u,at:Date.now()}),e.log.info(r==="none"?"no bb thread-list preferences found; using the defaults":`imported bb thread-list preferences from ${r}: ${u.join(", ")||"none differ from the defaults"}`),{status:r==="none"?"defaults":"imported",source:r,keys:u}}s(em,"importPreferences");function tm(e){let t=e.now??Date.now,r=new Map,n="error",o=null,i=null,u=JSON.stringify({status:n,scheduled:{}});function c(d){switch(d.type){case"upsert":{let{id:m,threadId:g,sendAt:y}=d.row;y!==null&&y>t()?r.set(m,{threadId:g,sendAt:y}):r.delete(m);break}case"remove":r.delete(d.rowId);break;case"remove-thread":for(let[m,g]of r)g.threadId===d.threadId&&r.delete(m);break}}s(c,"apply");function a(){let d=t(),m={};for(let[g,y]of r){if(y.sendAt<=d){r.delete(g);continue}let $=m[y.threadId];($===void 0||y.sendAt<$)&&(m[y.threadId]=y.sendAt)}return{status:n,scheduled:m}}s(a,"current");function l(){let d=a(),m=JSON.stringify(d);m!==u&&(u=m,e.publish(d))}s(l,"publishIfChanged");function f(d){o?.push(d),c(d),l()}s(f,"change");async function p(d){o=[];try{let m=await d(),g=o;r=new Map;for(let y of m)c({type:"upsert",row:y});for(let y of g)c(y);return n="ready",!0}catch{return n="error",!1}finally{o=null,l()}}return s(p,"runSeed"),{queued:s(d=>f({type:"upsert",row:d}),"queued"),removed:s(d=>f({type:"remove",rowId:d}),"removed"),threadGone:s(d=>f({type:"remove-thread",threadId:d}),"threadGone"),seed(d){let m=p(d).finally(()=>{i===m&&(i=null)});return i=m,m},async snapshot(){return i!==null&&await i,a()}}}s(tm,"createScheduledTracker");var Kl="stamp:",nm=["startedAt","finishedAt","pendingAt","seenAt"];function rm(e){return`${Kl}${e}`}s(rm,"stampKvKey");function $_(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let n of nm){let o=t[n];typeof o=="number"&&Number.isFinite(o)&&(r[n]=o)}return Object.keys(r).length>0?r:null}s($_,"parseThreadStamps");function om(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let c=new Map;for(let a of await t.list(Kl)){let l=a.slice(Kl.length),f=$_(await t.get(a));if(f===null){e.log.warn(`stored stamps for ${l} are invalid; dropping them`),await t.delete(a);continue}c.set(l,f)}return n=c,c}s(o,"load");async function i(c,a,l){if(Object.keys(l).length===0){c.delete(a),await t.delete(rm(a));return}c.set(a,l),await t.set(rm(a),l)}s(i,"save");function u(c){e.realtime.publish(Le.stamps,c)}return s(u,"publish"),{list:s(()=>r(async()=>{let c={startedAt:{},finishedAt:{},pendingAt:{},seenAt:{}};for(let[a,l]of await o())for(let f of nm){let p=l[f];p!==void 0&&(c[f][a]=p)}return c}),"list"),stamp:s((c,a,l)=>r(async()=>{if(a.length===0)return;let f=await o();for(let p of new Set(a))await i(f,p,{...f.get(p),[c]:l});u({kind:c,threadIds:[...a],value:l})}),"stamp"),clear:s((c,a)=>r(async()=>{if(a.length===0)return;let l=await o();for(let f of new Set(a)){let p=l.get(f);if(p?.[c]===void 0)continue;let{[c]:d,...m}=p;await i(l,f,m)}u({kind:c,threadIds:[...a],value:null})}),"clear"),forget:s(c=>r(async()=>{let a=await o();for(let l of c)a.has(l)&&await i(a,l,{})}),"forget"),prune:s((c,a)=>r(async()=>{let l=await o(),f=[];for(let[p,d]of[...l])c.has(p)||Math.max(...Object.values(d))>=a||(await i(l,p,{}),f.push(p));return f}),"prune")}}s(om,"createStampStore");function sm(e){return e instanceof Error?e.message:String(e)}s(sm,"errorMessage");async function w_(e,t){let r=new Set;for(let n of[!1,!0])for(let o=0;;o+=500){let i=await e.threads.list({archived:n,includeHidden:!0,limit:500,offset:o,signal:t});for(let u of i)r.add(u.id);if(i.length<500)break}return r}s(w_,"listAllThreadIds");async function b_(e,t,r){let n=Date.now(),o;try{o=await w_(e.sdk,r)}catch(i){e.log.warn(`could not list threads to prune deleted ones: ${sm(i)}`);return}for(let i of t){let u=await i.prune(o,n);u.length>0&&e.log.info(`pruned ${i.name} of ${u.length} deleted threads`)}}s(b_,"pruneDeletedThreads");function im(e,t,r){return t.seed(async()=>{try{return await e.sdk.threads.queue.list({signal:r})}catch(n){throw e.log.warn(`could not list queued messages: ${sm(n)}`),n}})}s(im,"seedScheduled");function v_(e,t){return new Promise(r=>{let n=setTimeout(o,e);function o(){clearTimeout(n),t.removeEventListener("abort",o),r()}s(o,"done"),t.addEventListener("abort",o,{once:!0})})}s(v_,"sleep");function x_(e){return e.aborted?Promise.resolve():new Promise(t=>e.addEventListener("abort",()=>t(),{once:!0}))}s(x_,"waitForAbort");async function um(e,t,r,n,o=6e4){let i=im(e,r,n);await b_(e,t,n);let u=await i;for(;!u&&!n.aborted&&(await v_(o,n),!n.aborted);)u=await im(e,r,n);await x_(n)}s(um,"runStartup");function k_(e){let t=Md(e),r=om(e),n=Wd(e),o=tm({publish:s(a=>e.realtime.publish(Le.scheduled,a),"publish")}),i=Qd(e.log),u=Ut();e.rpc.register(Vd,{async listPreferences(){return{preferences:await t.readAll()}},async setPreference({key:a,value:l}){return{key:a,value:await t.write(a,l)}},async resetPreference({key:a}){return{key:a,value:await t.reset(a)}},importPreferences({bbMirror:a}){return u(()=>em({kv:e.storage.kv,log:e.log,store:t,readBbCli:i},a))},async listStamps(){return{stamps:await r.list()}},async markSeen({threadIds:a}){let l=Date.now();return await r.stamp("seenAt",a,l),{at:l}},async clearSeen({threadIds:a}){return await r.clear("seenAt",a),{ok:!0}},async listNotes(){return{notes:await n.list()}},listScheduled(){return o.snapshot()}}),e.cli.register(Kd(t));let c=s((a,l=Date.now())=>({...a,at:l}),"note");e.events.on("thread.active",async({thread:a})=>{await r.stamp("startedAt",[a.id],Date.now()),await n.update(a.id,{pending:null,failed:null})}),e.events.on("thread.idle",async({thread:a,lastAssistantText:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=qd(l);await n.update(a.id,{pending:null,...f?{done:c(f)}:{}})}),e.events.on("thread.failed",async({thread:a,error:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=await Fl(e,{threadId:a.id,error:l,errorInfo:null,turnId:null});f===null&&(await n.get(a.id))?.failed||await n.update(a.id,{failed:c(Ml(f))})}),e.events.on("turn.failed",async({threadId:a,errorInfo:l,turnId:f})=>{let p=await Fl(e,{threadId:a,error:null,errorInfo:l,turnId:f});p!==null&&await n.update(a,{failed:c(Ml(p))})}),e.events.on("interaction.pending",async({thread:a,interaction:l})=>{await r.stamp("pendingAt",[a.id],Date.now()),await n.update(a.id,{pending:c(Gd(l),l.createdAt)})}),e.events.on("thread.deleted",async({thread:a})=>{o.threadGone(a.id),await r.forget([a.id]),await n.forget([a.id])}),e.events.on("thread.archived",({thread:a})=>o.threadGone(a.id)),e.events.on("message.queued",({entry:a})=>o.queued(a)),e.events.on("message.dispatched",({entry:a})=>o.removed(a.id)),e.events.on("message.cancelled",({entry:a})=>o.removed(a.id)),e.background.service("startup",{start:s(a=>um(e,[{name:"stamps",prune:r.prune},{name:"notes",prune:n.prune}],o,a),"start")})}s(k_,"threadGlance");export{k_ as default};
|
|
68
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let u of e.seen.entries()){let c=u[1];if(t===u[0]){i(u);continue}if(e.external){let l=e.external.registry.get(u[0])?.id;if(t!==u[0]&&l){i(u);continue}}if(e.metadataRegistry.get(u[0])?.id){i(u);continue}if(c.cycle){i(u);continue}c.count>1&&e.reused==="ref"&&i(u)}e.external&&(e.sharedDefsExtractedFor=e.external)}s(Ne,"extractDefs");function Gf(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;Gf(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let u of Array.isArray(i)?i:[i]){if(typeof u!="string")return;r.includes(u)||r.push(u)}}delete e.anyOf,e.type=r.length===1?r[0]:r}s(Gf,"compactTypeUnion");var qf=new Set(["type","properties","required","additionalProperties"]),Bf=["oneOf","anyOf"];function Jf(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}s(Jf,"undeclaredConstraint");function Dc(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let u in i)if(!qf.has(u))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let u in i.properties){if(Object.prototype.hasOwnProperty.call(r,u))continue;let c=[];for(let l of t){let f=l.properties?.[u]??Jf(l);f!=null&&(c.some(p=>JSON.stringify(p)===JSON.stringify(f))||c.push(f))}let a=c.length===1?c[0]:Dc(c)??{allOf:c};J(r,u,a)}for(let u of i.required??[])n.add(u)}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 u of t){let c=Jf(u);c&&!i.some(a=>JSON.stringify(a)===JSON.stringify(c))&&i.push(c)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}s(Dc,"foldObjects");function dy(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of qf)if(o in e)return;let r=t.filter(o=>Bf.some(i=>Array.isArray(o[i]))),n=null;if(!r.length)n=Dc(t);else{let o=r[0],i=Bf.find(a=>Array.isArray(o[a]));if(Object.keys(o).length!==1)return;let u=t.filter(a=>a!==o),c=o[i].map(a=>Dc([...u,a]));if(c.some(a=>!a))return;n={[i]:c}}n&&(delete e.allOf,Ar(e,n))}s(dy,"foldIntersection");function Ee(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s(c=>{let a=e.seen.get(c);if(a.ref===null)return;let l=a.def??a.schema,f={...l},p=a.ref;if(a.ref=null,p){n(p);let m=e.seen.get(p),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(g)):Ar(l,g),Ar(l,f),c._zod.parent===p)for(let $ in l)$==="$ref"||$==="allOf"||$ in f||delete l[$];if(g.$ref&&m.def)for(let $ in l)$==="$ref"||$==="allOf"||$ in m.def&&JSON.stringify(l[$])===JSON.stringify(m.def[$])&&delete l[$]}let d=c._zod.parent;if(d&&d!==p){n(d);let m=e.seen.get(d);if(m?.schema.$ref&&(l.$ref=m.schema.$ref,m.def))for(let g in l)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(l[g])===JSON.stringify(m.def[g])&&delete l[g]}e.override({zodSchema:c,jsonSchema:l,path:a.path??[]})},"flattenRef");if(!e.external||e.sharedEmitDoneFor!==e.external){for(let c of[...e.seen.entries()].reverse())n(c[0]);if(e.target!=="openapi-3.0")for(let c of e.seen.entries())Gf(c[1].def??c[1].schema);for(let c of e.deferred)c();if(e.intersections.length){let c=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=c.get(f);p?p.push(l):c.set(f,[l])}for(let a of e.intersections)for(let l of c.get(a)??[])dy(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 c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(c)}Ar(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 u=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let c of e.seen.entries()){let a=c[1];a.def&&a.defId&&(a.def.id===a.defId&&delete a.def.id,J(u,a.defId,a.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?o.$defs=u:o.definitions=u);try{let c=JSON.parse(JSON.stringify(o));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Et(t,"input",e.processors),output:Et(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}s(Ee,"finalize");function Q(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 Q(n.element,r);if(n.type==="set")return Q(n.valueType,r);if(n.type==="lazy")return Q(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 Q(n.innerType,r);if(n.type==="intersection")return Q(n.left,r)||Q(n.right,r);if(n.type==="record"||n.type==="map")return Q(n.keyType,r)||Q(n.valueType,r);if(n.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Q(n.in,r)||Q(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Q(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Q(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Q(o,r))return!0;return!!(n.rest&&Q(n.rest,r))}return!1}s(Q,"isTransforming");var Rc=s((e,t={})=>r=>{let n=Ze({...r,processors:t});return D(e,n),Ne(n,e),Ee(n,e)},"createToJSONSchemaMethod"),Et=s((e,t,r={})=>n=>{let{libraryOptions:o,target:i}=n??{},u=Ze({...o??{},target:i,io:t,processors:r});return D(e,u),Ne(u,e),Ee(u,e)},"createStandardJSONSchemaMethod");var Ct=s((e,t,r)=>{(e[t]===void 0||r>e[t])&&(e[t]=r)},"narrowMin"),Tt=s((e,t,r)=>{(e[t]===void 0||r<e[t])&&(e[t]=r)},"narrowMax"),Wf=s((e,t)=>{Ct(e,"minimum",t),Tt(e,"maximum",t)},"narrowBoth"),Qf=s((e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},"addDivisor"),ep=s((e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},"addPattern"),tp=s((e,t)=>{e.mime=e.mime?e.mime.filter(r=>t.includes(r)):[...t]},"intersectMime"),rp=s((e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},"setFormat"),Xf=s((e,t)=>Ct(e,"minimum",t.minimum),"minContributor"),Hf=s((e,t)=>Tt(e,"maximum",t.maximum),"maxContributor"),Yf=s(e=>(t,r)=>{rp(t,r.format);let[n,o]=e[r.format];Ct(t,"minimum",n),Tt(t,"maximum",o)},"formatContributor"),my={greater_than:s((e,t)=>Ct(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),"greater_than"),less_than:s((e,t)=>Tt(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),"less_than"),multiple_of:s((e,t)=>Qf(e,t.value),"multiple_of"),number_format:Yf(Ht),bigint_format:Yf(Yt),min_length:Xf,max_length:Hf,length_equals:s((e,t)=>Wf(e,t.length),"length_equals"),min_size:Xf,max_size:Hf,size_equals:s((e,t)=>Wf(e,t.size),"size_equals"),string_format:s((e,t)=>{rp(e,t.format),t.pattern&&ep(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)=>tp(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)my[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&Ct(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&Ct(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&Tt(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&Tt(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Qf(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&tp(t,o.mime);for(let i of o.patterns??[])ep(t,i);return t}s(U,"aggregateChecks");var hy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gy=new Map([[In,Bi],[mr,Ji]]),np=s(e=>gy.get(e)??e,"exactPattern"),Vc=s((e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:u,format:c,patterns:a,contentEncoding:l,laxFormat:f}=U(e);if(typeof i=="number"&&(o.minLength=i),typeof u=="number"&&(o.maxLength=u),c&&(o.format=hy[c]??c,o.format===""&&delete o.format,(c==="time"||f)&&delete o.format),l&&(o.contentEncoding=l),a&&a.size>0){let p=[...a].map(np);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"),Mc=s((e,t,r,n)=>{let o=r,{minimum:i,maximum:u,multipleOf:c,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<=(u??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(p?m?(o.minimum=l,o.exclusiveMinimum=!0):o.exclusiveMinimum=l:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=a,o.exclusiveMaximum=!0):o.exclusiveMaximum=a:typeof u=="number"&&(o.maximum=u),c){let g=new Set;for(let z of c)Number.isFinite(z)&&z!==0?g.add(Math.abs(z)):K(e,t,o,n,`A multipleOf divisor of ${z} cannot be represented in JSON Schema`);let[y,...$]=g;y!==void 0&&(o.multipleOf=y),$.length&&(o.allOf=[...o.allOf??[],...$.map(z=>({multipleOf:z}))])}},"numberProcessor"),Fc=s((e,t,r,n)=>{r.type="boolean"},"booleanProcessor"),Kc=s((e,t,r,n)=>{K(e,t,r,n,"BigInt cannot be represented in JSON Schema")},"bigintProcessor"),Uc=s((e,t,r,n)=>{K(e,t,r,n,"Symbols cannot be represented in JSON Schema")},"symbolProcessor"),Bc=s((e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},"nullProcessor"),Jc=s((e,t,r,n)=>{K(e,t,r,n,"Undefined cannot be represented in JSON Schema")},"undefinedProcessor"),Gc=s((e,t,r,n)=>{K(e,t,r,n,"Void cannot be represented in JSON Schema")},"voidProcessor"),qc=s((e,t,r,n)=>{r.not={}},"neverProcessor"),Wc=s((e,t,r,n)=>{},"anyProcessor"),Xc=s((e,t,r,n)=>{},"unknownProcessor"),Hc=s((e,t,r,n)=>{K(e,t,r,n,"Date cannot be represented in JSON Schema")},"dateProcessor"),Yc=s((e,t,r,n)=>{let o=e._zod.def,i=ut(o.entries);if(i.length===0){r.not={};return}i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),r.enum=i},"enumProcessor"),Qc=s((e,t,r,n)=>{let o=e._zod.def;if(o.values.length===0){r.not={};return}let i=[];for(let u of o.values)if(u===void 0){if(K(e,t,r,n,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof u=="bigint"){if(K(e,t,r,n,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(u))}else i.push(u);if(i.length!==0)if(i.length===1){let u=i[0];r.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[u]:r.const=u}else i.every(u=>typeof u=="number")&&(r.type="number"),i.every(u=>typeof u=="string")&&(r.type="string"),i.every(u=>typeof u=="boolean")&&(r.type="boolean"),i.every(u=>u===null)&&(r.type="null"),r.enum=i},"literalProcessor"),ea=s((e,t,r,n)=>{K(e,t,r,n,"NaN cannot be represented in JSON Schema")},"nanProcessor"),ta=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"),ra=s((e,t,r,n)=>{let o=r;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:u,mime:c}=U(e);i!==void 0&&(o.minLength=i),u!==void 0&&(o.maxLength=u),c&&(c.length===0?o.not={}:c.length===1?o.contentMediaType=c[0]:o.anyOf=c.map(a=>({contentMediaType:a})))},"fileProcessor"),na=s((e,t,r,n)=>{r.type="boolean"},"successProcessor"),oa=s((e,t,r,n)=>{K(e,t,r,n,"Custom types cannot be represented in JSON Schema")},"customProcessor"),ia=s((e,t,r,n)=>{K(e,t,r,n,"Function types cannot be represented in JSON Schema")},"functionProcessor"),sa=s((e,t,r,n)=>{K(e,t,r,n,"Transforms cannot be represented in JSON Schema")},"transformProcessor"),ua=s((e,t,r,n)=>{K(e,t,r,n,"Map cannot be represented in JSON Schema")},"mapProcessor"),ca=s((e,t,r,n)=>{K(e,t,r,n,"Set cannot be represented in JSON Schema")},"setProcessor"),aa=s((e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:u,maximum:c}=U(e);typeof u=="number"&&(o.minItems=u),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=D(i.element,t,{...n,path:[...n.path,"items"]})},"arrayProcessor");function Or(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Or(t.out):t.type==="catch"?Or(t.innerType):e._zod.optin}s(Or,"inputOptin");var la=s((e,t,r,n)=>{let o=r,i=e._zod.def,u=i.shape;if(Object.getOwnPropertySymbols(u).length&&K(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in u)J(o.properties,l,D(u[l],t,{...n,path:[...n.path,"properties",l]}));let a=[];for(let l of Object.keys(u)){let f=i.shape[l];(t.io==="input"?Or(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"),xo=s((e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,u=o.options.map((c,a)=>D(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",a]}));i?r.oneOf=u:r.anyOf=u},"unionProcessor"),fa=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.left,t,{...n,path:[...n.path,"allOf",0]}),u=D(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=s(l=>"allOf"in l&&Object.keys(l).length===1,"isSimpleIntersection"),a=[...c(i)?i.allOf:[i],...c(u)?u.allOf:[u]];r.allOf=a,t.intersections.push(a)},"intersectionProcessor"),pa=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let u=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",a=i.items.map((y,$)=>D(y,t,{...n,path:[...n.path,u,$]})),l=i.rest?D(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,f=i.items.length;for(;f>0;){let y=i.items[f-1];if(!(t.io==="input"?Or(y)!==void 0:y._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:m,maximum:g}=U(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)},"tupleProcessor");function Lc(e,t,r){if(t.$ref){if(r.has(t))return t;r.add(t);let g=e.get(t)?.def;if(!g)return t;let y=Lc(e,g,r);return y===g?t:y}for(let g of["anyOf","oneOf"]){let y=t[g];if(!Array.isArray(y))continue;let $=y.map(z=>Lc(e,z,r));$.some((z,x)=>z!==y[x])&&(t={...t,[g]:$})}let n=Array.isArray(t.type)?t.type:[t.type],o=!n.includes("string")&&n.some(g=>g==="number"||g==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some(g=>typeof g=="number"))return t;let{minimum:u,maximum:c,exclusiveMinimum:a,exclusiveMaximum:l,multipleOf:f,format:p,id:d,...m}=t;return m.enum?m.enum=m.enum.map(g=>typeof g=="number"?String(g):g):typeof m.const=="number"&&(m.const=String(m.const)),o&&(m.type="string",i||(m.pattern=(n.includes("number")?be:ur).source)),m}s(Lc,"stringifyKeyNames");var jc=new WeakMap;function yy(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 jc.get(e)??[]){let o=e.seen.get(n),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||r.has(i))continue;let u=Lc(t,i,new Set);u!==i&&r.set(i,u)}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(yy,"rewriteKeyNames");var da=s((e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object";let u=i.keyType,c=U(u).patterns;if(i.mode==="loose"&&c&&c.size>0){let f=D(i.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});o.patternProperties={};for(let p of c)J(o.patternProperties,np(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=jc.get(t);f||(f=[],jc.set(t,f),t.deferred.push(()=>yy(t))),f.push(e)}o.additionalProperties=D(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})}let a=u._zod.values,l=t.io==="input"&&Or(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"),ma=s((e,t,r,n)=>{let o=e._zod.def,i=D(o.innerType,t,n),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},"nullableProcessor"),ha=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"),ga=Symbol();function op(e,t,r,n,o){let i=!1,u=JSON.stringify(e,(c,a)=>typeof a!="bigint"?a:(i=!0,null));return i?(K(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),ga):JSON.parse(u)}s(op,"serializeDefaultValue");var ya=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 u=op(o.defaultValue,e,t,r,n);u!==ga&&(r.default=u)},"defaultProcessor"),_a=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 u=op(o.defaultValue,e,t,r,n);u!==ga&&(r._prefault=u)},"prefaultProcessor"),$a=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 u;try{u=o.catchValue(void 0)}catch{K(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=u},"catchProcessor"),wa=s((e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),u=t.io==="input"?i?o.out:o.in:o.out;D(u,t,n);let c=t.seen.get(e);c.ref=u},"pipeProcessor"),ba=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"),va=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"),ko=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"),xa=s((e,t,r,n)=>{let o=e._zod.innerType;D(o,t,n);let i=t.seen.get(e);i.ref=o},"lazyProcessor"),vo={string:Vc,number:Mc,boolean:Fc,bigint:Kc,symbol:Uc,null:Bc,undefined:Jc,void:Gc,never:qc,any:Wc,unknown:Xc,date:Hc,enum:Yc,literal:Qc,nan:ea,template_literal:ta,file:ra,success:na,custom:oa,function:ia,transform:sa,map:ua,set:ca,array:aa,object:la,union:xo,intersection:fa,tuple:pa,record:da,nullable:ma,nonoptional:ha,default:ya,prefault:_a,catch:$a,pipe:wa,readonly:ba,promise:va,optional:ko,lazy:xa};function zo(e,t){if("_idmap"in e){let n=e,o=Ze({...t,processors:vo}),i={};for(let a of n._idmap.entries()){let[l,f]=a;D(f,o)}let u={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let a of n._idmap.entries()){let[l,f]=a;Ne(o,f),J(u,l,Ee(o,f))}if(Object.keys(i).length>0){let a=o.target==="draft-2020-12"?"$defs":"definitions";u.__shared={[a]:i}}return{schemas:u}}let r=Ze({...t,processors:vo});return D(e,r),Ne(r,e),Ee(r,e)}s(zo,"toJSONSchema");var So=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:vo,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,Ne(this.ctx,t);let n=Ee(this.ctx,t),{"~standard":o,...i}=n;return i}};var ip={};var Kt={};_e(Kt,{ZodAny:()=>Ba,ZodArray:()=>Wa,ZodBase64:()=>Bo,ZodBase64URL:()=>Jo,ZodBigInt:()=>Mt,ZodBigIntFormat:()=>Wo,ZodBoolean:()=>Vt,ZodCIDRv4:()=>Ko,ZodCIDRv6:()=>Uo,ZodCUID:()=>Do,ZodCUID2:()=>Ro,ZodCatch:()=>gl,ZodCodec:()=>Vr,ZodCreditCard:()=>Ra,ZodCustom:()=>Mr,ZodCustomStringFormat:()=>rt,ZodDate:()=>Cr,ZodDefault:()=>ll,ZodDiscriminatedUnion:()=>Ha,ZodE164:()=>Go,ZodEmail:()=>No,ZodEmoji:()=>Co,ZodEnum:()=>Rt,ZodExactOptional:()=>Qo,ZodFile:()=>sl,ZodFunction:()=>Sl,ZodGUID:()=>Eo,ZodIBAN:()=>La,ZodIPv4:()=>Mo,ZodIPv6:()=>Fo,ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,ZodInstanceOf:()=>Al,ZodIntersection:()=>Ya,ZodJWT:()=>qo,ZodKSUID:()=>Vo,ZodLazy:()=>xl,ZodLiteral:()=>il,ZodMAC:()=>Da,ZodMap:()=>nl,ZodNaN:()=>_l,ZodNanoID:()=>To,ZodNever:()=>Ga,ZodNonOptional:()=>ei,ZodNull:()=>Ka,ZodNullable:()=>al,ZodNumber:()=>jt,ZodNumberFormat:()=>nt,ZodObject:()=>Dr,ZodOptional:()=>Lr,ZodPipe:()=>jr,ZodPrefault:()=>pl,ZodPreprocess:()=>$l,ZodPromise:()=>zl,ZodReadonly:()=>wl,ZodRecord:()=>Dt,ZodSet:()=>ol,ZodString:()=>Lt,ZodStringFormat:()=>R,ZodSuccess:()=>hl,ZodSymbol:()=>Ma,ZodTemplateLiteral:()=>vl,ZodTransform:()=>ul,ZodTuple:()=>el,ZodType:()=>A,ZodULID:()=>Lo,ZodURL:()=>Er,ZodUUID:()=>ye,ZodUndefined:()=>Fa,ZodUnion:()=>Rr,ZodUnknown:()=>Ja,ZodVoid:()=>qa,ZodXID:()=>jo,ZodXor:()=>Xa,_ZodString:()=>Zo,_default:()=>fl,_function:()=>yd,any:()=>qp,array:()=>Tr,base64:()=>Ip,base64url:()=>Ap,bigint:()=>Kp,boolean:()=>Va,catch:()=>yl,check:()=>_d,cidrv4:()=>Sp,cidrv6:()=>Pp,codec:()=>dd,creditCard:()=>Zp,cuid:()=>_p,cuid2:()=>$p,currencyCode:()=>Rp,custom:()=>$d,date:()=>Xp,describe:()=>wd,discriminatedUnion:()=>rd,e164:()=>Op,email:()=>cp,emoji:()=>gp,enum:()=>Ho,exactOptional:()=>cl,file:()=>ad,float32:()=>jp,float64:()=>Vp,function:()=>yd,guid:()=>ap,hash:()=>Lp,hex:()=>Dp,hostname:()=>Tp,httpUrl:()=>hp,iban:()=>Np,instanceof:()=>vd,int:()=>Ao,int32:()=>Mp,int64:()=>Up,intersection:()=>Qa,invertCodec:()=>md,ipv4:()=>xp,ipv6:()=>zp,json:()=>kd,jwt:()=>Ep,keyof:()=>Hp,ksuid:()=>vp,lazy:()=>kl,literal:()=>cd,looseObject:()=>ed,looseRecord:()=>od,mac:()=>kp,map:()=>id,meta:()=>bd,nan:()=>pd,nanoid:()=>yp,nativeEnum:()=>ud,never:()=>Xo,nonoptional:()=>ml,null:()=>Ua,nullable:()=>Nr,nullish:()=>ld,number:()=>ja,object:()=>Yp,optional:()=>et,partialRecord:()=>nd,pipe:()=>Oo,prefault:()=>dl,preprocess:()=>zd,promise:()=>gd,readonly:()=>bl,record:()=>rl,refine:()=>Pl,set:()=>sd,strictObject:()=>Qp,string:()=>Zr,stringFormat:()=>Cp,stringbool:()=>xd,success:()=>fd,superRefine:()=>Il,symbol:()=>Jp,templateLiteral:()=>hd,transform:()=>Yo,tuple:()=>tl,uint32:()=>Fp,uint64:()=>Bp,ulid:()=>wp,undefined:()=>Gp,union:()=>Ft,unknown:()=>Qe,url:()=>mp,uuid:()=>lp,uuidv4:()=>fp,uuidv6:()=>pp,uuidv7:()=>dp,void:()=>Wp,xid:()=>bp,xor:()=>td});var Po={};_e(Po,{endsWith:()=>zt,gt:()=>he,gte:()=>ue,includes:()=>xt,length:()=>He,lowercase:()=>bt,lt:()=>me,lte:()=>se,maxLength:()=>Xe,maxSize:()=>Oe,mime:()=>Pt,minLength:()=>ve,minSize:()=>ge,multipleOf:()=>Ae,negative:()=>_o,nonnegative:()=>wo,nonpositive:()=>$o,normalize:()=>It,overwrite:()=>de,positive:()=>yo,properties:()=>St,property:()=>bo,regex:()=>wt,size:()=>We,slugify:()=>Nt,startsWith:()=>kt,toLowerCase:()=>Ot,toUpperCase:()=>Zt,trim:()=>At,uppercase:()=>vt});var sp=new WeakSet([Object.prototype,Error.prototype]);function Io(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(Io,"_lazyMethod");var up=s((e,t)=>{zi.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);sp.has(r)||(sp.add(r),Io(r,"format",n=>o=>nr(n,o)),Io(r,"flatten",n=>o=>rr(n,o)),Io(r,"addIssue",n=>o=>{n.issues.push(o),n.message=JSON.stringify(n.issues,ct,2)}),Io(r,"addIssues",n=>o=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,ct,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},"initializer"),$y=h("ZodError",up),ie=h("ZodError",up,void 0,{Parent:Error});var ka=pt(ie),za=dt(ie),Sa=mt(ie),Pa=ht(ie),Ia=on(ie),Aa=sn(ie),Oa=un(ie),Za=cn(ie),Na=an(ie),Ea=ln(ie),Ca=fn(ie),Ta=pn(ie);function by(){B.localeError||M(vr())}s(by,"_ensureDefaultLocale");function tt(){B.memoizer||M({memoizer:br()})}s(tt,"_ensureDefaultMemoizer");var A=h("ZodType",(e,t)=>(by(),P.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(v.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 C(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Pl(e,t))},superRefine(e,t){return this.check(Il(e,t))},overwrite(e){return this.check(de(e))},optional(){return et(this)},exactOptional(){return cl(this)},nullable(){return Nr(this)},nullish(){return et(Nr(this))},nonoptional(e){return ml(this,e)},array(){return Tr(this)},or(e){return Ft([this,e])},and(e){return Qa(this,e)},transform(e){return Oo(this,Yo(e))},default(e){return fl(this,e)},prefault(e){return dl(this,e)},catch(e){return yl(this,e)},pipe(e){return Oo(this,e)},readonly(){return bl(this)},describe(e){let t=this.clone();return G.add(t,{description:e}),t},meta(...e){if(e.length===0)return G.get(this);let t=this.clone();return G.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 v.hide(this,"~standard",{...xn(this),jsonSchema:{input:Et(this,"input"),output:Et(this,"output")}})},set"~standard"(e){v.own(this,"~standard",e)},parse:s(function e(t,r){return ka(this,t,r,{callee:e})},"_parse"),parseAsync:s(async function e(t,r){return await za(this,t,r,{callee:e})},"_parseAsync"),safeParse(e,t){return Sa(this,e,t)},async safeParseAsync(e,t){return Pa(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){v.own(this,"spa",e)},validate(e,t){return or(this,e,t)},validateAsync(e,t){return ir(this,e,t)},encode:s(function e(t,r){return Ia(this,t,r,{callee:e})},"_encode"),decode:s(function e(t,r){return Aa(this,t,r,{callee:e})},"_decode"),encodeAsync:s(async function e(t,r){return await Oa(this,t,r,{callee:e})},"_encodeAsync"),decodeAsync:s(async function e(t,r){return await Za(this,t,r,{callee:e})},"_decodeAsync"),safeEncode(e,t){return Na(this,e,t)},safeDecode(e,t){return Ea(this,e,t)},async safeEncodeAsync(e,t){return Ca(this,e,t)},async safeDecodeAsync(e,t){return Ta(this,e,t)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),Zo=h("_ZodString",(e,t)=>{Ue.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Vc(e,r,n,o)},v.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(wt(...e))},includes(...e){return this.check(xt(...e))},startsWith(...e){return this.check(kt(...e))},endsWith(...e){return this.check(zt(...e))},min(...e){return this.check(ve(...e))},max(...e){return this.check(Xe(...e))},length(...e){return this.check(He(...e))},nonempty(...e){return this.check(ve(1,...e))},lowercase(e){return this.check(bt(e))},uppercase(e){return this.check(vt(e))},trim(){return this.check(At())},normalize(...e){return this.check(It(...e))},toLowerCase(){return this.check(Ot())},toUpperCase(){return this.check(Zt())},slugify(){return this.check(Nt())}})),Lt=h("ZodString",(e,t)=>{Ue.init(e,t),Zo.init(e,t)},{email(e){return this.check(Wn(No,e))},url(e){return this.check(kr(Er,e))},jwt(e){return this.check(go(qo,e))},emoji(e){return this.check(to(Co,e))},guid(e){return this.check(Xn(Eo,e))},uuid(e){return this.check(Hn(ye,e))},uuidv4(e){return this.check(Yn(ye,e))},uuidv6(e){return this.check(Qn(ye,e))},uuidv7(e){return this.check(eo(ye,e))},nanoid(e){return this.check(ro(To,e))},cuid(e){return this.check(no(Do,e))},cuid2(e){return this.check(oo(Ro,e))},ulid(e){return this.check(io(Lo,e))},base64(e){return this.check(po(Bo,e))},base64url(e){return this.check(mo(Jo,e))},xid(e){return this.check(so(jo,e))},ksuid(e){return this.check(uo(Vo,e))},ipv4(e){return this.check(co(Mo,e))},ipv6(e){return this.check(ao(Fo,e))},cidrv4(e){return this.check(lo(Ko,e))},cidrv6(e){return this.check(fo(Uo,e))},e164(e){return this.check(ho(Go,e))},datetime(e){return this.check(zr(Ce,e))},date(e){return this.check(Sr(Te,e))},time(e){return this.check(Pr(De,e))},duration(e){return this.check(Ir(Re,e))}});function Zr(e){return Qu(Lt,e)}s(Zr,"string");var R=h("ZodStringFormat",(e,t)=>{T.init(e,t),Zo.init(e,t)}),Ce=h("ZodISODateTime",(e,t)=>{Bs.init(e,t),R.init(e,t)}),Te=h("ZodISODate",(e,t)=>{Js.init(e,t),R.init(e,t)}),De=h("ZodISOTime",(e,t)=>{Gs.init(e,t),R.init(e,t)}),Re=h("ZodISODuration",(e,t)=>{qs.init(e,t),R.init(e,t)}),No=h("ZodEmail",(e,t)=>{Cs.init(e,t),R.init(e,t)});function cp(e){return Wn(No,e)}s(cp,"email");var Eo=h("ZodGUID",(e,t)=>{Ns.init(e,t),R.init(e,t)});function ap(e){return Xn(Eo,e)}s(ap,"guid");var ye=h("ZodUUID",(e,t)=>{Es.init(e,t),R.init(e,t)});function lp(e){return Hn(ye,e)}s(lp,"uuid");function fp(e){return Yn(ye,e)}s(fp,"uuidv4");function pp(e){return Qn(ye,e)}s(pp,"uuidv6");function dp(e){return eo(ye,e)}s(dp,"uuidv7");var Er=h("ZodURL",(e,t)=>{Rs.init(e,t),R.init(e,t)});function mp(e){return kr(Er,e)}s(mp,"url");function hp(e){return kr(Er,{protocol:sr,hostname:qi,...v.normalizeParams(e)})}s(hp,"httpUrl");var Co=h("ZodEmoji",(e,t)=>{Ls.init(e,t),R.init(e,t)});function gp(e){return to(Co,e)}s(gp,"emoji");var To=h("ZodNanoID",(e,t)=>{js.init(e,t),R.init(e,t)});function yp(e){return ro(To,e)}s(yp,"nanoid");var Do=h("ZodCUID",(e,t)=>{Vs.init(e,t),R.init(e,t)});function _p(e){return no(Do,e)}s(_p,"cuid");var Ro=h("ZodCUID2",(e,t)=>{Ms.init(e,t),R.init(e,t)});function $p(e){return oo(Ro,e)}s($p,"cuid2");var Lo=h("ZodULID",(e,t)=>{Fs.init(e,t),R.init(e,t)});function wp(e){return io(Lo,e)}s(wp,"ulid");var jo=h("ZodXID",(e,t)=>{Ks.init(e,t),R.init(e,t)});function bp(e){return so(jo,e)}s(bp,"xid");var Vo=h("ZodKSUID",(e,t)=>{Us.init(e,t),R.init(e,t)});function vp(e){return uo(Vo,e)}s(vp,"ksuid");var Mo=h("ZodIPv4",(e,t)=>{Ws.init(e,t),R.init(e,t)});function xp(e){return co(Mo,e)}s(xp,"ipv4");var Da=h("ZodMAC",(e,t)=>{Hs.init(e,t),R.init(e,t)});function kp(e){return tc(Da,e)}s(kp,"mac");var Fo=h("ZodIPv6",(e,t)=>{Xs.init(e,t),R.init(e,t)});function zp(e){return ao(Fo,e)}s(zp,"ipv6");var Ko=h("ZodCIDRv4",(e,t)=>{Ys.init(e,t),R.init(e,t)});function Sp(e){return lo(Ko,e)}s(Sp,"cidrv4");var Uo=h("ZodCIDRv6",(e,t)=>{Qs.init(e,t),R.init(e,t)});function Pp(e){return fo(Uo,e)}s(Pp,"cidrv6");var Bo=h("ZodBase64",(e,t)=>{eu.init(e,t),R.init(e,t)});function Ip(e){return po(Bo,e)}s(Ip,"base64");var Jo=h("ZodBase64URL",(e,t)=>{tu.init(e,t),R.init(e,t)});function Ap(e){return mo(Jo,e)}s(Ap,"base64url");var Go=h("ZodE164",(e,t)=>{ru.init(e,t),R.init(e,t)});function Op(e){return ho(Go,e)}s(Op,"e164");var Ra=h("ZodCreditCard",(e,t)=>{nu.init(e,t),R.init(e,t)});function Zp(e){return rc(Ra,e)}s(Zp,"creditCard");var La=h("ZodIBAN",(e,t)=>{ou.init(e,t),R.init(e,t)});function Np(e){return nc(La,e)}s(Np,"iban");var qo=h("ZodJWT",(e,t)=>{iu.init(e,t),R.init(e,t)});function Ep(e){return go(qo,e)}s(Ep,"jwt");var rt=h("ZodCustomStringFormat",(e,t)=>{su.init(e,t),R.init(e,t)});function Cp(e,t,r={}){return Ye(rt,e,t,r)}s(Cp,"stringFormat");function Tp(e){return Ye(rt,"hostname",Gi,e)}s(Tp,"hostname");function Dp(e){return Ye(rt,"hex",cs,e)}s(Dp,"hex");function Rp(e){return Ye(rt,"currency_code",Xi,e)}s(Rp,"currencyCode");function Lp(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,o=le[n];if(!o)throw new Error(`Unrecognized hash format: ${n}`);return Ye(rt,n,o,t)}s(Lp,"hash");var jt=h("ZodNumber",(e,t)=>{En.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Mc(e,r,n,o),e.isFinite=!0},v.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(he(e,t))},gte(e,t){return this.check(ue(e,t))},min(e,t){return this.check(ue(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},int(e){return this.check(Ao(e))},safe(e){return this.check(Ao(e))},positive(e){return this.check(he(0,e))},nonnegative(e){return this.check(ue(0,e))},negative(e){return this.check(me(0,e))},nonpositive(e){return this.check(se(0,e))},multipleOf(e,t){return this.check(Ae(e,t))},step(e,t){return this.check(Ae(e,t))},finite(){return this}}));function ja(e){return ic(jt,e)}s(ja,"number");var nt=h("ZodNumberFormat",(e,t)=>{uu.init(e,t),jt.init(e,t)});function Ao(e){return uc(nt,e)}s(Ao,"int");function jp(e){return cc(nt,e)}s(jp,"float32");function Vp(e){return ac(nt,e)}s(Vp,"float64");function Mp(e){return lc(nt,e)}s(Mp,"int32");function Fp(e){return fc(nt,e)}s(Fp,"uint32");var Vt=h("ZodBoolean",(e,t)=>{hr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Fc(e,r,n,o)});function Va(e){return pc(Vt,e)}s(Va,"boolean");var Mt=h("ZodBigInt",(e,t)=>{Cn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Kc(e,r,n,o)},v.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(ue(e,t))},min(e,t){return this.check(ue(e,t))},gt(e,t){return this.check(he(e,t))},lt(e,t){return this.check(me(e,t))},lte(e,t){return this.check(se(e,t))},max(e,t){return this.check(se(e,t))},positive(e){return this.check(he(BigInt(0),e))},negative(e){return this.check(me(BigInt(0),e))},nonpositive(e){return this.check(se(BigInt(0),e))},nonnegative(e){return this.check(ue(BigInt(0),e))},multipleOf(e,t){return this.check(Ae(e,t))}}));function Kp(e){return mc(Mt,e)}s(Kp,"bigint");var Wo=h("ZodBigIntFormat",(e,t)=>{cu.init(e,t),Mt.init(e,t)});function Up(e){return gc(Wo,e)}s(Up,"int64");function Bp(e){return yc(Wo,e)}s(Bp,"uint64");var Ma=h("ZodSymbol",(e,t)=>{au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Uc(e,r,n,o)});function Jp(e){return _c(Ma,e)}s(Jp,"symbol");var Fa=h("ZodUndefined",(e,t)=>{lu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Jc(e,r,n,o)});function Gp(e){return $c(Fa,e)}s(Gp,"_undefined");var Ka=h("ZodNull",(e,t)=>{fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Bc(e,r,n,o)});function Ua(e){return wc(Ka,e)}s(Ua,"_null");var Ba=h("ZodAny",(e,t)=>{pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Wc(e,r,n,o)});function qp(){return bc(Ba)}s(qp,"any");var Ja=h("ZodUnknown",(e,t)=>{du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Xc(e,r,n,o)});function Qe(){return vc(Ja)}s(Qe,"unknown");var Ga=h("ZodNever",(e,t)=>{mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>qc(e,r,n,o)});function Xo(e){return xc(Ga,e)}s(Xo,"never");var qa=h("ZodVoid",(e,t)=>{hu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Gc(e,r,n,o)});function Wp(e){return kc(qa,e)}s(Wp,"_void");var Cr=h("ZodDate",(e,t)=>{gu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Hc(e,r,n,o),e.min=(r,n)=>e.check(ue(r,n)),e.max=(r,n)=>e.check(se(r,n))},v.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 Xp(e){return zc(Cr,e)}s(Xp,"date");var Wa=h("ZodArray",(e,t)=>{tt(),yu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>aa(e,r,n,o),e.element=t.element},{min(e,t){return this.check(ve(e,t))},nonempty(e){return this.check(ve(1,e))},max(e,t){return this.check(Xe(e,t))},length(e,t){return this.check(He(e,t))},unwrap(){return this.element}});function Tr(e,t){return Ic(Wa,e,t)}s(Tr,"array");function Hp(e){let t=e._zod.def.shape;return Ho(Object.keys(t))}s(Hp,"keyof");var Dr=h("ZodObject",(e,t)=>{tt(),_u.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>la(e,r,n,o),v.installLazyProp(e,"shape",r=>r._zod.def.shape,!1)},{keyof(){return Ho(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(v.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Qe()}))},loose(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Qe()}))},strict(){return this.clone(v.mergeDefs(this._zod.def,{catchall:Xo()}))},strip(){return this.clone(v.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return v.extend(this,e)},safeExtend(e){return v.safeExtend(this,e)},merge(e){return v.merge(this,e)},pick(e){return v.pick(this,e)},omit(e){return v.omit(this,e)},partial(...e){return v.partial(Lr,this,e[0])},exactPartial(...e){return v.partial(Qo,this,e[0],"exactPartial")},required(...e){return v.required(ei,this,e[0])}});function Yp(e,t){let r={type:"object",shape:e??{},...v.normalizeParams(t)};return new Dr(r)}s(Yp,"object");function Qp(e,t){return new Dr({type:"object",shape:e,catchall:Xo(),...v.normalizeParams(t)})}s(Qp,"strictObject");function ed(e,t){return new Dr({type:"object",shape:e,catchall:Qe(),...v.normalizeParams(t)})}s(ed,"looseObject");var Rr=h("ZodUnion",(e,t)=>{gr.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function Ft(e,t){return new Rr({type:"union",options:e,...v.normalizeParams(t)})}s(Ft,"union");var Xa=h("ZodXor",(e,t)=>{Rr.init(e,t),$u.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xo(e,r,n,o),e.options=t.options});function td(e,t){return new Xa({type:"union",options:e,inclusive:!1,...v.normalizeParams(t)})}s(td,"xor");var Ha=h("ZodDiscriminatedUnion",(e,t)=>{Rr.init(e,t),bu.init(e,t)});function rd(e,t,r){return new Ha({type:"union",options:t,discriminator:e,...v.normalizeParams(r)})}s(rd,"discriminatedUnion");var Ya=h("ZodIntersection",(e,t)=>{vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>fa(e,r,n,o)});function Qa(e,t){return new Ya({type:"intersection",left:e,right:t})}s(Qa,"intersection");var el=h("ZodTuple",(e,t)=>{tt(),Tn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pa(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 Lr({type:"optional",innerType:t}))})}});function tl(e,t,r){let n=t instanceof P,o=n?r:t,i=n?t:null;return new el({type:"tuple",items:e,rest:i,...v.normalizeParams(o)})}s(tl,"tuple");var Dt=h("ZodRecord",(e,t)=>{tt(),xu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>da(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function rl(e,t,r){return!t||!t._zod?new Dt({type:"record",keyType:Zr(),valueType:e,...v.normalizeParams(t)}):new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r)})}s(rl,"record");function nd(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,...v.normalizeParams(r),partial:!0})}s(nd,"partialRecord");function od(e,t,r){return new Dt({type:"record",keyType:e,valueType:t,mode:"loose",...v.normalizeParams(r)})}s(od,"looseRecord");var nl=h("ZodMap",(e,t)=>{tt(),ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ua(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(We(...r))});function id(e,t,r){return new nl({type:"map",keyType:e,valueType:t,...v.normalizeParams(r)})}s(id,"map");var ol=h("ZodSet",(e,t)=>{tt(),zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ca(e,r,n,o),e.min=(...r)=>e.check(ge(...r)),e.nonempty=r=>e.check(ge(1,r)),e.max=(...r)=>e.check(Oe(...r)),e.size=(...r)=>e.check(We(...r))});function sd(e,t){return new ol({type:"set",valueType:e,...v.normalizeParams(t)})}s(sd,"set");var Rt=h("ZodEnum",(e,t)=>{Su.init(e,t),A.init(e,t),e._zod.processJSONSchema=(n,o,i)=>Yc(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 u of n)if(r.has(u))i[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let u of n)if(r.has(u))delete i[u];else throw new Error(`Key ${u} not found in enum`);return new Rt({...t,checks:[],...v.normalizeParams(o),entries:i})}});function Ho(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Rt({type:"enum",entries:r,...v.normalizeParams(t)})}s(Ho,"_enum");function ud(e,t){return new Rt({type:"enum",entries:e,...v.normalizeParams(t)})}s(ud,"nativeEnum");var il=h("ZodLiteral",(e,t)=>{Pu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Qc(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 cd(e,t){return new il({type:"literal",values:Array.isArray(e)?e:[e],...v.normalizeParams(t)})}s(cd,"literal");var sl=h("ZodFile",(e,t)=>{Iu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ra(e,r,n,o),e.min=(r,n)=>e.check(ge(r,n)),e.max=(r,n)=>e.check(Oe(r,n)),e.mime=(r,n)=>e.check(Pt(Array.isArray(r)?r:[r],n))});function ad(e){return Ac(sl,e)}s(ad,"file");var ul=h("ZodTransform",(e,t)=>{tt(),Au.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>sa(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Ie(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(v.issue(i,r.value,t));else{let u=i;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),"input"in u||(u.input=r.value),u.inst??(u.inst=e),r.issues.push(v.issue(u))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function Yo(e){return new ul({type:"transform",transform:e})}s(Yo,"transform");var Lr=h("ZodOptional",(e,t)=>{Dn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function et(e){return new Lr({type:"optional",innerType:e})}s(et,"optional");var Qo=h("ZodExactOptional",(e,t)=>{Ou.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ko(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function cl(e){return new Qo({type:"optional",innerType:e})}s(cl,"exactOptional");var al=h("ZodNullable",(e,t)=>{Zu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ma(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Nr(e){return new al({type:"nullable",innerType:e})}s(Nr,"nullable");function ld(e){return et(Nr(e))}s(ld,"nullish");var ll=h("ZodDefault",(e,t)=>{Nu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ya(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fl(e,t){return new ll({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(fl,"_default");var pl=h("ZodPrefault",(e,t)=>{Eu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function dl(e,t){return new pl({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():v.shallowClone(t)}})}s(dl,"prefault");var ei=h("ZodNonOptional",(e,t)=>{Cu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ha(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function ml(e,t){return new ei({type:"nonoptional",innerType:e,...v.normalizeParams(t)})}s(ml,"nonoptional");var hl=h("ZodSuccess",(e,t)=>{Tu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>na(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function fd(e){return new hl({type:"success",innerType:e})}s(fd,"success");var gl=h("ZodCatch",(e,t)=>{Du.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$a(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yl(e,t){return new gl({type:"catch",innerType:e,catchValue:typeof t=="function"?t:v.constantCatch(t)})}s(yl,"_catch");var _l=h("ZodNaN",(e,t)=>{Ru.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ea(e,r,n,o)});function pd(e){return Pc(_l,e)}s(pd,"nan");var jr=h("ZodPipe",(e,t)=>{Rn.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wa(e,r,n,o),e.in=t.in,e.out=t.out});function Oo(e,t){return new jr({type:"pipe",in:e,out:t})}s(Oo,"pipe");var Vr=h("ZodCodec",(e,t)=>{jr.init(e,t),yr.init(e,t)});function dd(e,t,r){return new Vr({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}s(dd,"codec");function md(e){let t=e._zod.def;return new Vr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}s(md,"invertCodec");var $l=h("ZodPreprocess",(e,t)=>{jr.init(e,t),Lu.init(e,t)}),wl=h("ZodReadonly",(e,t)=>{ju.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ba(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function bl(e){return new wl({type:"readonly",innerType:e})}s(bl,"readonly");var vl=h("ZodTemplateLiteral",(e,t)=>{Vu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ta(e,r,n,o)});function hd(e,t){return new vl({type:"template_literal",parts:e,...v.normalizeParams(t)})}s(hd,"templateLiteral");var xl=h("ZodLazy",(e,t)=>{_r.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>xa(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function kl(e){return new xl({type:"lazy",getter:e})}s(kl,"lazy");var zl=h("ZodPromise",(e,t)=>{Fu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function gd(e){return new zl({type:"promise",innerType:e})}s(gd,"promise");var Sl=h("ZodFunction",(e,t)=>{Mu.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>ia(e,r,n,o)});function yd(e){return new Sl({type:"function",input:Array.isArray(e?.input)?tl(e?.input):e?.input??Tr(Qe()),output:e?.output??Qe()})}s(yd,"_function");var Mr=h("ZodCustom",(e,t)=>{Ku.init(e,t),A.init(e,t),e._zod.processJSONSchema=(r,n,o)=>oa(e,r,n,o)});function _d(e){let t=new L({check:"custom"});return t._zod.check=e,t}s(_d,"check");function $d(e,t){return Oc(Mr,e??(()=>!0),t)}s($d,"custom");function Pl(e,t={}){return Zc(Mr,e,t)}s(Pl,"refine");function Il(e,t){return Nc(e,t)}s(Il,"superRefine");var wd=Ec,bd=Cc,Al=h("ZodInstanceOf",(e,t)=>{Mr.init(e,t)},{properties(e,t){return this.check(St(e,t))}});function vd(e,t={}){let r=new Al({type:"custom",check:"custom",fn:s(n=>n instanceof e,"fn"),abort:!0,...v.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(vd,"_instanceof");var xd=s((...e)=>Tc({Codec:Vr,Boolean:Vt,String:Lt},...e),"stringbool");function kd(e){let t=kl(()=>Ft([Zr(e),ja(),Va(),Ua(),Tr(t),rl(Zr(),t)]));return t}s(kd,"json");function zd(e,t){return new $l({type:"pipe",in:Yo(e),out:t})}s(zd,"preprocess");var vy={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 xy(e){M({customError:e})}s(xy,"setErrorMap");function ky(){return M().customError}s(ky,"getErrorMap");var Ol;Ol||(Ol={});var Fr={};_e(Fr,{ZodISODate:()=>Te,ZodISODateTime:()=>Ce,ZodISODuration:()=>Re,ZodISOTime:()=>De,date:()=>Sy,datetime:()=>zy,duration:()=>Iy,time:()=>Py});function zy(e){return zr(Ce,e)}s(zy,"datetime");function Sy(e){return Sr(Te,e)}s(Sy,"date");function Py(e){return Pr(De,e)}s(Py,"time");function Iy(e){return Ir(Re,e)}s(Iy,"duration");var w={...Kt,...Po,iso:Fr},Ay=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 Oy(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(Oy,"detectVersion");function Sd(e,t){return e.map((r,n)=>n<t?r:r.optional())}s(Sd,"applyMinItems");function Zy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}s(Zy,"decodeJSONPointerSegment");function Ny(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:Zy(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(Ny,"resolveRef");function Ey(e,t){return w.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 u of i){let c=t.keySchema.safeParse(u);c.success||n.issues.push({code:"invalid_key",origin:"record",issues:c.error.issues,input:u,path:[u],continue:!0})}}).pipe(e)}s(Ey,"checkObjectGuards");function Zl(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 u of e){let c=Zl(u,t);if(c===null)return null;i.push(c)}return`a${i.length}:[${i.join(",")}]`}let n=Object.keys(e).sort(),o=[];for(let i of n){let u=Zl(e[i],t);if(u===null)return null;o.push(`${i.length}:${i}=${u}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}s(Zl,"canonicalKey");var Cy=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Ty=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Kr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(Kr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,r])=>Cy.has(t)?Kr(r):!Ty.has(t)||typeof r!="object"||r===null?!1:Object.values(r).some(Kr))}s(Kr,"containsRef");function Pd(e){return e===1?"element":"elements"}s(Pd,"plural");function Dy(e,t){return w.transform(n=>n).check(n=>{let o=n.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let u=0;u<o.length;u++){let c=Zl(o[u],new Set);if(c===null)continue;let a=i.get(c);if(a===void 0){i.set(c,u);continue}n.issues.push({code:"custom",message:`Array items must be unique: element at index ${u} duplicates the one at index ${a}`,input:o,path:[u],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,u=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,c=0;for(let a of o)if(t.containsSchema.safeParse(a).success&&++c>=u)break;c<i&&n.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Pd(i)}; found ${c}`,input:o,continue:!0}),t.maxContains!==void 0&&c>t.maxContains&&n.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Pd(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}s(Dy,"checkArrayGuards");function Id(e,t){if(e!==!1)return e===void 0||e===!0?w.any():ee(e,t)}s(Id,"getTupleRest");var Ry=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Ad(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return w.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 w.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=Ny(o,t),u=ee(i,t);return t.refs.set(o,u),t.processing.delete(o),u}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 w.null();if(o.length===0)return w.never();if(o.length===1)return w.literal(o[0]);if(o.every(u=>typeof u=="string"))return w.enum(o);let i=o.map(u=>w.literal(u));return i.length<2?i[0]:w.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let r=e.type;if(Array.isArray(r)){let o=r.map(i=>{let u={...e,type:i};return Ad(u,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!r)return w.any();let n;switch(r){case"string":{let o=w.string();if(e.format){let i=e.format;i==="email"?o=o.check(w.email()):i==="uri"||i==="uri-reference"?o=o.check(w.url()):i==="uuid"||i==="guid"?o=o.check(w.uuid()):i==="date-time"?o=o.check(w.iso.datetime({offset:!0})):i==="date"?o=o.check(w.iso.date()):i==="time"?o=o.check(w.regex(Ry)):i==="duration"?o=o.check(w.iso.duration()):i==="hostname"?o=o.check(w.hostname()):i==="ipv4"?o=o.check(w.ipv4()):i==="ipv6"?o=o.check(w.ipv6()):i==="mac"?o=o.check(w.mac()):i==="cidr"?o=o.check(w.cidrv4()):i==="cidr-v6"?o=o.check(w.cidrv6()):i==="base64"?o=o.check(w.base64()):i==="base64url"?o=o.check(w.base64url()):i==="e164"?o=o.check(w.e164()):i==="credit_card"?o=o.check(w.creditCard()):i==="iban"?o=o.check(w.iban()):i==="jwt"?o=o.check(w.jwt()):i==="emoji"?o=o.check(w.emoji()):i==="nanoid"?o=o.check(w.nanoid()):i==="cuid"?o=o.check(w.cuid()):i==="cuid2"?o=o.check(w.cuid2()):i==="ulid"?o=o.check(w.ulid()):i==="xid"?o=o.check(w.xid()):i==="ksuid"&&(o=o.check(w.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"?w.number().int():w.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=w.boolean();break}case"null":{n=w.null();break}case"object":{let o={},i=e.properties||{},u=new Set(e.required||[]),c=typeof e.additionalProperties=="object"?ee(e.additionalProperties,t):void 0;for(let[p,d]of Object.entries(i)){let m=ee(d,t);J(o,p,u.has(p)?m:m.optional())}if(e.patternProperties){let p=e.patternProperties,d=Object.keys(p),m=[];for(let y of d){let $=ee(p[y],t),z=w.string().regex(new RegExp(y));m.push(w.looseRecord(z,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)n=w.object({}).passthrough();else if(g.length===1)n=g[0];else{let y=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)y=w.intersection(y,g[$]);n=y}if(e.additionalProperties===!1){let y=Object.keys(o),$=d.map(x=>new RegExp(x)),z=n;n=n.check(x=>{if(!ce(x.value))return;let I=[];for(let E of Object.keys(x.value))y.includes(E)||$.some(j=>j.test(E))||I.push(E);I.length&&x.issues.push({code:"unrecognized_keys",keys:I,input:x.value,inst:z})})}}else{let p=w.object(o);e.additionalProperties===!1?n=p.strict():c?n=p.catchall(c):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=ee(d,t)}n=Ey(n,{keySchema:p,minProperties:l,maxProperties:f})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let u=typeof e.minItems=="number"?e.minItems:0,c=o.map(p=>ee(p,t)),a=Sd(c,u),l=Array.isArray(i)?void 0:Id(i,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let u=typeof e.minItems=="number"?e.minItems:0,c=i.map(p=>ee(p,t)),a=Sd(c,u),l=Id(e.additionalItems,t),f=w.tuple(a);n=l?f.rest(l):f,typeof e.minItems=="number"&&(n=n.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let u=ee(i,t),c=w.array(u);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),n=c}else n=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(n=Dy(n,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ee(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(Ad,"convertBaseSchema");function ee(e,t){if(typeof e=="boolean")return e?w.any():w.never();let r=Ad(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(l=>ee(l,t)),a=w.union(c);r=n?w.intersection(r,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(l=>ee(l,t)),a=w.xor(c);r=n?w.intersection(r,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:w.any();else{let c=n?r:ee(e.allOf[0],t),a=n?0:1;for(let l=a;l<e.allOf.length;l++)c=w.intersection(c,ee(e.allOf[l],t));r=c}e.nullable===!0&&t.version==="openapi-3.0"&&(r=w.nullable(r)),e.readOnly===!0&&(r=w.readonly(r)),e.default!==void 0&&(r=r.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of i)c in e&&(o[c]=e[c]);let u=["contentEncoding","contentMediaType","contentSchema"];for(let c of u)c in e&&(o[c]=e[c]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Kr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let c of["minProperties","maxProperties"])e[c]!==void 0&&(o[c]=e[c])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Kr(e.contains)&&(o.contains=e.contains);for(let c of["uniqueItems","minContains","maxContains"])e[c]!==void 0&&(o[c]=e[c])}for(let c of Object.keys(e))Ay.has(c)||J(o,c,e[c]);return Object.keys(o).length>0&&t.registry.add(r,o),e.description&&(r=r.describe(e.description)),r}s(ee,"convertSchema");function Od(e,t){if(typeof e=="boolean")return e?w.any():w.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=Oy(r,t?.defaultTarget),o=r.$defs||r.definitions||{},i={version:n,defs:o,refs:new Map,processing:new Set,rootSchema:r,registry:t?.registry??G};return ee(r,i)}s(Od,"fromJSONSchema");var Zd=Symbol("z.visit/resolving");function Ur(e,t){let r=typeof t=="function"?t:(u,c)=>{let a=t[u._zod.def.type];return a?a(u,c):u},n=new Map;function o(u){let c=n.get(u);if(c===Zd)return new _r({type:"lazy",getter:s(()=>n.get(u),"getter")});if(c!==void 0)return c;n.set(u,Zd);let a=i(u),l=r(a,a!==u);return n.set(u,l),l}s(o,"run");function i(u){let c=u._zod.def,a=c.type;switch(a){case"object":{let l=c.shape,f=Object.keys(l),p=!1,d={};for(let g of f){let y=o(l[g]);y!==l[g]&&(p=!0),d[g]=y}let m=c.catchall;return c.catchall&&(m=o(c.catchall),m!==c.catchall&&(p=!0)),p?C(u,{...c,shape:d,catchall:m}):u}case"array":{let l=o(c.element);return l===c.element?u:C(u,{...c,element:l})}case"tuple":{let l=c.items,f=!1,p=[];for(let m of l){let g=o(m);g!==m&&(f=!0),p.push(g)}let d=c.rest;return c.rest&&(d=o(c.rest),d!==c.rest&&(f=!0)),f?C(u,{...c,items:p,rest:d}):u}case"record":case"map":{let l=o(c.keyType),f=o(c.valueType);return l===c.keyType&&f===c.valueType?u:C(u,{...c,keyType:l,valueType:f})}case"set":{let l=o(c.valueType);return l===c.valueType?u:C(u,{...c,valueType:l})}case"union":{let l=c.options,f=!1,p=[];for(let d of l){let m=o(d);m!==d&&(f=!0),p.push(m)}return f?C(u,{...c,options:p}):u}case"intersection":{let l=o(c.left),f=o(c.right);return l===c.left&&f===c.right?u:C(u,{...c,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(c.innerType);return l===c.innerType?u:C(u,{...c,innerType:l})}case"pipe":{let l=o(c.in),f=o(c.out);return l===c.in&&f===c.out?u:C(u,{...c,in:l,out:f})}case"function":{let l=o(c.input),f=o(c.output);return l===c.input&&f===c.output?u:C(u,{...c,input:l,output:f})}case"lazy":{let l=c.getter,{_cachedInner:f,...p}=c;return C(u,{...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 u;default:return u}}return s(i,"mapInner"),o(e)}s(Ur,"visit");function Nd(e){return Ur(e,{object:s(t=>t.partial(),"object"),union:s(t=>{let r=t._zod.def;return r.discriminator===void 0?t:Ft(r.options)},"union")})}s(Nd,"deepPartial");function Ly(e,t){if(!t?.length)return e;let r=e._zod.def;return C(e,fe(r,{checks:[...r.checks??[],...t]}),{parent:!0})}s(Ly,"withChecks");function Ed(e){return Ly(e.out,e.checks)}s(Ed,"outSide");function jy(e){return e.in._zod.traits.has("$ZodTransform")?Ed(e):e.in}s(jy,"inSide");function Cd(e){return Ur(e,{pipe:s(t=>jy(t._zod.def),"pipe"),default:s((t,r)=>r?et(t._zod.def.innerType):t,"default"),catch:s((t,r)=>r?t._zod.def.innerType:t,"catch")})}s(Cd,"input");function Td(e){return Ur(e,{pipe:s(t=>Ed(t._zod.def),"pipe"),prefault:s((t,r)=>r?t._zod.def.innerType:t,"prefault")})}s(Td,"output");var Nl={};_e(Nl,{bigint:()=>Ky,boolean:()=>Fy,date:()=>Uy,number:()=>My,string:()=>Vy});function Vy(e){return ec(Lt,e)}s(Vy,"string");function My(e){return sc(jt,e)}s(My,"number");function Fy(e){return dc(Vt,e)}s(Fy,"boolean");function Ky(e){return hc(Mt,e)}s(Ky,"bigint");function Uy(e){return Sc(Cr,e)}s(Uy,"date");var El=1e4,Dd=b.string().min(1).max(1024),ke=b.array(Dd).max(El),By=b.enum(["project","chronological","machine"]),Jy=b.enum(["updated","created","alpha","none"]),Gy=b.enum(["default","ascending","descending"]),qy=b.enum(["active","archived"]),Wy=b.enum(["muted","colour","hidden"]),Xy=b.enum(["blocked","everything"]),Hy=b.array(b.union([b.literal("threads"),Dd.regex(/^(project|section|machine):\S+$/)])).max(El).transform(e=>[...new Set(e)]);function F(e,t,r){return{schema:e,defaultValue:t,description:r}}s(F,"define");var ot={threadLifecycles:F(b.array(qy).min(1).max(2).refine(e=>new Set(e).size===e.length,"Lifecycles must be unique"),["active"],'Threads shown: ["active"], ["archived"] or both. At least one is required.'),organizationMode:F(By,"project","How top-level groups are formed: project, chronological (custom sections) or machine."),environmentGrouping:F(b.boolean(),!1,"Worktrees as folders: whether sibling threads sharing a worktree environment fold into a folder row."),chronologicalSort:F(Jy,"updated","Sort field inside a group: updated, created or alpha. none is read as updated."),sortDirection:F(Gy,"default","Sort direction: ascending or descending. A saved default reads as the field's own direction (descending for dates, ascending for alpha)."),sectionOrder:F(ke,["pinned","projects","threads"],"Top-level group order when organized by project."),manualSectionOrder:F(ke,["pinned","sections","threads"],"Top-level group order when organized chronologically."),machineSectionOrder:F(ke,["pinned","machines","threads"],"Top-level group order when organized by machine."),hiddenGroups:F(Hy,[],"Groups moved into More: threads, project:<id>, section:<id> or machine:<id>."),collapsedSections:F(b.array(b.enum(["pinned","threads"])).max(El),[],"Built-in groups (pinned, threads) that are collapsed."),collapsedProjects:F(ke,[],"Project ids whose group is collapsed."),collapsedThreadSections:F(ke,[],"Custom section keys (section:<id>) whose group is collapsed."),collapsedMachines:F(ke,[],"Machine ids whose group is collapsed."),collapsedEnvironments:F(ke,[],"Environment ids whose folder row is collapsed."),foldOlder:F(b.boolean(),!0,"Collapse older threads: whether each group's quiet roots past its 5 newest fold behind an N older row."),workingFirst:F(b.boolean(),!1,"Working threads first: whether working threads sort first under Updated, as bb's list does."),expandedOlder:F(ke,[],"Group ids and parent thread ids whose N older fold the user opened."),expandedChildren:F(ke,[],"Parent thread ids whose chip the user opened."),showPullRequests:F(b.boolean(),!0,"Whether rows show a pull request badge."),childAttention:F(Xy,"blocked","Needs you counts every child: blocked counts a child thread that waits on you, is offline or has an orphaned failure; everything also counts every failed or finished-unread child. The same children stay out of a family's older fold, as running ones do."),harnessIcon:F(Wy,"muted","How rows draw the harness logo: muted (monochrome), colour (the provider's tint) or hidden.")},ze=Object.keys(ot);function Cl(e){return Object.hasOwn(ot,e)}s(Cl,"isPreferenceKey");function it(e){return structuredClone(ot[e].defaultValue)}s(it,"preferenceDefault");function Rd(){return Object.fromEntries(ze.map(e=>[e,it(e)]))}s(Rd,"defaultPreferences");function Tl(e){return ot[e].description}s(Tl,"describePreference");function ti(e,t){let r=ot[e].schema.safeParse(t);return r.success?{success:!0,value:r.data}:{success:!1,message:r.error.issues.map(n=>n.message).join("; ")}}s(ti,"parsePreference");function Dl(e){if(e===null||typeof e!="object"||Array.isArray(e))return{};let t=e,r={};for(let[n,o]of Object.entries(t)){if(n==="collapsedThreads"||!Cl(n))continue;let u=ti(n,n==="environmentGrouping"&&o==="auto"?!1:o);u.success&&(r[n]=u.value)}return r}s(Dl,"mapBbPreferences");var ww=b.object({density:b.enum(["compact","comfortable"]).catch("compact")});var ri=b.record(b.string(),b.number()),Ld=b.object({startedAt:ri,finishedAt:ri,pendingAt:ri,seenAt:ri}),Br=140,Rl=b.object({kind:b.enum(["question","approval","plan","input","failed","done"]),text:b.string().max(Br),at:b.number()}),ni=b.object({pending:Rl.optional(),failed:Rl.optional(),done:Rl.optional()}),Le={preferences:"preferences",stamps:"stamps",scheduled:"scheduled",notes:"notes"};var Jr=b.enum(ze),Qy=b.object(Object.fromEntries(ze.map(e=>[e,ot[e].schema]))),e_=b.record(b.string(),b.number()),jd=b.array(b.string().min(1).max(1024)).max(1e4),Vd=Yy({listPreferences:{input:b.null(),output:b.object({preferences:Qy}).strict()},setPreference:{input:b.object({key:Jr,value:b.unknown()}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},resetPreference:{input:b.object({key:Jr}).strict(),output:b.object({key:Jr,value:b.unknown()}).strict()},importPreferences:{input:b.object({bbMirror:b.unknown().nullable()}).strict(),output:b.object({status:b.enum(["already-imported","imported","defaults"]),source:b.enum(["local-storage","cli","none"]).nullable(),keys:b.array(Jr)}).strict()},listStamps:{input:b.null(),output:b.object({stamps:Ld}).strict()},markSeen:{input:b.object({threadIds:jd}).strict(),output:b.object({at:b.number()}).strict()},clearSeen:{input:b.object({threadIds:jd}).strict(),output:b.object({ok:b.literal(!0)}).strict()},listNotes:{input:b.null(),output:b.object({notes:b.record(b.string(),ni)}).strict()},listScheduled:{input:b.null(),output:b.object({status:b.enum(["ready","error"]),scheduled:e_}).strict()}});import{PluginCliError as Fd,cliCommand as ii,defineCli as r_}from"@get-bb/plugin-sdk";var t_="preference:";function oi(e){return`${t_}${e}`}s(oi,"preferenceKvKey");var Gr=class extends Error{static{s(this,"PreferenceValidationError")}key;detail;constructor(t,r){super(`Invalid value for ${t}: ${r}`),this.name="PreferenceValidationError",this.key=t,this.detail=r}};function Md(e){let{kv:t}=e.storage;function r(o,i){let u={key:o,value:i};e.realtime.publish(Le.preferences,u)}s(r,"publish");async function n(o){let i=await t.get(oi(o));if(i===void 0)return it(o);let u=ti(o,i);return u.success?u.value:(e.log.warn(`stored preference ${o} is invalid (${u.message}); using the default`),it(o))}return s(n,"read"),{read:n,async readAll(){let o=Rd();return await Promise.all(ze.map(async i=>{o[i]=await n(i)})),o},async isStored(o){return await t.get(oi(o))!==void 0},async write(o,i){let u=ti(o,i);if(!u.success)throw new Gr(o,u.message);return await t.set(oi(o),u.value),r(o,u.value),u.value},async reset(o){await t.delete(oi(o));let i=it(o);return r(o,i),i}}}s(Md,"createPreferenceStore");function n_(e){try{return JSON.parse(e)}catch{return e}}s(n_,"parseCliValue");function Ll(e){if(Cl(e))return e;throw new Fd(`Unknown preference: ${e}`,{code:"unknown_preference",hint:`Known preferences: ${ze.join(", ")}.`})}s(Ll,"requirePreferenceKey");var si={type:"boolean",description:"Emit machine-readable JSON"},jl={name:"key",description:"Preference name",required:!0};function Kd(e){function t(r,n,o){return o?JSON.stringify({key:r,value:n}):`${r} = ${JSON.stringify(n)}`}return s(t,"keyValueOutput"),r_({name:"thread-glance",summary:"Inspect and change the Thread Glance sidebar's layout preferences",description:"Organization, sort, group order, hidden and collapsed groups, child-thread folding and which child threads Needs you counts, for the Thread Glance sidebar. Values are JSON; a bare word is read as a string.",commands:{"prefs list":ii({summary:"List every preference and its current value",options:{json:si},async run(r){let n=await e.readAll();return r.options.json?{exitCode:0,stdout:JSON.stringify(n)}:{exitCode:0,stdout:ze.map(i=>`${i} ${JSON.stringify(n[i])} ${Tl(i)}`).join(`
|
|
69
|
+
`)}}}),"prefs get":ii({summary:"Print one preference",positionals:[jl],options:{json:si},async run(r){let n=Ll(r.positionals.key),o=await e.read(n);return{exitCode:0,stdout:r.options.json?JSON.stringify({key:n,value:o}):JSON.stringify(o)}}}),"prefs set":ii({summary:"Set one preference",positionals:[jl,{name:"value",description:`JSON value, e.g. '"machine"' or '["pinned","threads"]'`,required:!0}],options:{json:si},async run(r){let n=Ll(r.positionals.key);try{let o=await e.write(n,n_(r.positionals.value));return{exitCode:0,stdout:t(n,o,r.options.json===!0)}}catch(o){throw o instanceof Gr?new Fd(o.message,{code:"invalid_preference_value",hint:Tl(n)}):o}}}),"prefs reset":ii({summary:"Restore one preference to its default",positionals:[jl],options:{json:si},async run(r){let n=Ll(r.positionals.key),o=await e.reset(n);return{exitCode:0,stdout:t(n,o,r.options.json===!0)}}})}})}s(Kd,"createCli");function Ut(){let e=Promise.resolve();return t=>{let r=e.then(t,t);return e=r.catch(()=>{}),r}}s(Ut,"createSerialQueue");var Vl="note:",o_="ask-user-question",Bd="Needs your input";function Ud(e){return`${Vl}${e}`}s(Ud,"noteKvKey");function Bt(e){let t=e.replace(/\s+/g," ").trim();for(;;){let r=t.replace(/^(?:#{1,6}|[-*+>]|\d+[.)])\s+/,"");if(r===t)break;t=r}return t.length<=Br?t:`${t.slice(0,Br-1).trimEnd()}\u2026`}s(Bt,"noteText");function i_(e){for(let t of e.split(`
|
|
70
|
+
`)){let r=t.replace(/^\s*#+/,"").trim();if(r!=="")return r}return""}s(i_,"firstNonEmptyLine");function Jd(e,t){return t>1?`${e} (+${t-1} more)`:e}s(Jd,"withMore");function s_(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e.questions;if(!Array.isArray(t)||t.length===0)return null;let r=t[0]?.prompt;return typeof r=="string"&&r.trim()!==""?Jd(r,t.length):null}s(s_,"questionsText");function u_(e,t){return e.trim()===""&&t?t:e}s(u_,"approvalText");function c_(e){let t=e.payload;switch(e.payload.kind){case"user_question":{let{questions:r}=e.payload,n=r[0]?.prompt??"";return{kind:"question",text:Jd(n,r.length)}}case"approval":{let{subject:r,reason:n}=e.payload;switch(r.kind){case"command":return{kind:"approval",text:u_(r.command,n)};case"file_change":return{kind:"approval",text:`File changes${r.writeScope?` in ${r.writeScope}`:""}`};case"permission_grant":return{kind:"approval",text:`Permissions${r.toolName?` for ${r.toolName}`:""}`};case"tool_use":return{kind:"approval",text:r.presentation.title??r.tool};case"plan":return{kind:"plan",text:i_(r.plan)};default:return{kind:"approval",text:n??""}}}case"plugin":{if(e.origin?.kind!=="plugin")break;let{title:r,presentation:n,data:o}=e.payload;if(e.origin.pluginId===o_)return{kind:"question",text:s_(o)??r};let i=n?.detail?Bt(n.detail):"",u=`${r}: ${i}`;return{kind:"input",text:i!==""&&u.length<=Br?u:r}}}return"title"in t&&typeof t.title=="string"?{kind:"input",text:t.title}:{kind:"input",text:Bd}}s(c_,"describeRaw");function Gd(e){let t=c_(e),r=Bt(t.text);return{kind:t.kind,text:r===""?Bd:r}}s(Gd,"describeInteraction");function Ml(e){let t=e===null?"":Bt(e);return{kind:"failed",text:t===""?"Failed":t}}s(Ml,"describeFailure");function qd(e){let t=e===null?"":Bt(e);return t===""?null:{kind:"done",text:t}}s(qd,"describeDone");function Wd(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let u=new Map;for(let c of await t.list(Vl)){let a=c.slice(Vl.length),l=ni.safeParse(await t.get(c));if(!l.success||Object.keys(l.data).length===0){e.log.warn(`stored notes for ${a} are invalid; dropping them`),await t.delete(c);continue}u.set(a,l.data)}return n=u,u}s(o,"load");async function i(u,c,a){let l=Object.keys(a).length===0;l?(u.delete(c),await t.delete(Ud(c))):(u.set(c,a),await t.set(Ud(c),a));let f={threadId:c,notes:l?null:a};e.realtime.publish(Le.notes,f)}return s(i,"save"),{list:s(()=>r(async()=>Object.fromEntries(await o())),"list"),get:s(u=>r(async()=>(await o()).get(u)),"get"),update:s((u,c)=>r(async()=>{let a=await o(),l=a.get(u)??{},f={...l};for(let[p,d]of Object.entries(c))d===null?delete f[p]:f[p]=d;JSON.stringify(f)!==JSON.stringify(l)&&await i(a,u,f)}),"update"),forget:s(u=>r(async()=>{let c=await o();for(let a of u)c.has(a)&&await i(c,a,{})}),"forget"),prune:s((u,c)=>r(async()=>{let a=await o(),l=[];for(let[f,p]of[...a])u.has(f)||Math.max(...Object.values(p).map(m=>m.at))>=c||(await i(a,f,{}),l.push(f));return l}),"prune")}}s(Wd,"createNoteStore");var a_=20,l_=new Set(["error","failed","provider error","turn failed","unknown error"]);function Xd(e){if(e==null)return!0;let t=e.trim().toLowerCase().replace(/[.!]+$/,"");return t===""||l_.has(t)||/^command [\w./:-]+ failed$/.test(t)}s(Xd,"isGenericError");function f_(e){if(!e)return null;let t=e.httpStatusCode===null?"":` (${e.httpStatusCode})`;switch(e.category){case"rate-limit":return`Rate limited${t}`;case"unauthorized":return"Not signed in";case"billing":case"budget-exceeded":return"Out of credits";case"context-window-exceeded":return"Context window full";case"unknown":return t===""?null:`Error${t}`;default:{let r=e.category.replace(/-/g," ");return`${r.charAt(0).toUpperCase()}${r.slice(1)}${t}`}}}s(f_,"errorInfoLabel");function p_(e,t){for(let r of e){if(r.type==="turn/started"&&t===null)return null;if(!(r.type!=="provider/error"&&r.type!=="system/error")&&!(t!==null&&r.scope?.turnId!==void 0&&r.scope.turnId!==t))return r.data??{}}return null}s(p_,"latestProviderError");function d_(e){let t=[e.error,e.providerError?.detail,e.providerError?.message,f_(e.errorInfo??e.providerError?.errorInfo)];for(let r of t)if(!Xd(r)){let n=Bt(r);if(n!=="")return n}return null}s(d_,"failureText");async function Fl(e,t){let r=null;if(Xd(t.error))try{let n=await e.sdk.threads.events.list({threadId:t.threadId,types:["provider/error","system/error","turn/started"],order:"desc",limit:String(a_)});r=p_(n,t.turnId)}catch(n){e.log.warn(`could not read events of ${t.threadId} for its failure: ${n instanceof Error?n.message:String(n)}`)}return d_({error:t.error,providerError:r,errorInfo:t.errorInfo})}s(Fl,"resolveFailureText");import{execFile as m_}from"node:child_process";var Hd="migration:import:v1",h_=5e3,g_=4*1024*1024;function Yd(e){let t=e;if(typeof t=="string")try{t=JSON.parse(t)}catch{return null}if(t===null||typeof t!="object"||Array.isArray(t))return null;let r=t,n=r.preferences;return n!==null&&typeof n=="object"&&!Array.isArray(n)?n:r}s(Yd,"unwrapBbPreferences");function y_(e=process.env){let t=e.BB_CLI?.trim();return t||"bb"}s(y_,"bbCliPath");function Qd(e,t=process.env){return()=>new Promise(r=>{let n=y_(t);m_(n,["thread-list","prefs","list","--json"],{timeout:h_,maxBuffer:g_,encoding:"utf8"},(o,i)=>{if(o){e.warn(`could not run ${n} thread-list prefs list: ${o.message}`),r(null);return}try{r(JSON.parse(i))}catch{e.warn(`${n} thread-list prefs list printed output that is not JSON`),r(null)}})})}s(Qd,"createBbCliReader");async function em(e,t){if(await e.kv.get(Hd)!==void 0)return{status:"already-imported",source:null,keys:[]};let r="none",n={},o=t===null?null:Yd(t),i=o===null?{}:Dl(o);if(Object.keys(i).length>0)r="local-storage",n=i;else{let c=Yd(await e.readBbCli()),a=c===null?{}:Dl(c);Object.keys(a).length>0&&(r="cli",n=a)}let u=[];for(let[c,a]of Object.entries(n))await e.store.isStored(c)||JSON.stringify(a)!==JSON.stringify(it(c))&&(await e.store.write(c,a),u.push(c));return await e.kv.set(Hd,{source:r,keys:u,at:Date.now()}),e.log.info(r==="none"?"no bb thread-list preferences found; using the defaults":`imported bb thread-list preferences from ${r}: ${u.join(", ")||"none differ from the defaults"}`),{status:r==="none"?"defaults":"imported",source:r,keys:u}}s(em,"importPreferences");function tm(e){let t=e.now??Date.now,r=new Map,n="error",o=null,i=null,u=JSON.stringify({status:n,scheduled:{}});function c(d){switch(d.type){case"upsert":{let{id:m,threadId:g,sendAt:y}=d.row;y!==null&&y>t()?r.set(m,{threadId:g,sendAt:y}):r.delete(m);break}case"remove":r.delete(d.rowId);break;case"remove-thread":for(let[m,g]of r)g.threadId===d.threadId&&r.delete(m);break}}s(c,"apply");function a(){let d=t(),m={};for(let[g,y]of r){if(y.sendAt<=d){r.delete(g);continue}let $=m[y.threadId];($===void 0||y.sendAt<$)&&(m[y.threadId]=y.sendAt)}return{status:n,scheduled:m}}s(a,"current");function l(){let d=a(),m=JSON.stringify(d);m!==u&&(u=m,e.publish(d))}s(l,"publishIfChanged");function f(d){o?.push(d),c(d),l()}s(f,"change");async function p(d){o=[];try{let m=await d(),g=o;r=new Map;for(let y of m)c({type:"upsert",row:y});for(let y of g)c(y);return n="ready",!0}catch{return n="error",!1}finally{o=null,l()}}return s(p,"runSeed"),{queued:s(d=>f({type:"upsert",row:d}),"queued"),removed:s(d=>f({type:"remove",rowId:d}),"removed"),threadGone:s(d=>f({type:"remove-thread",threadId:d}),"threadGone"),seed(d){let m=p(d).finally(()=>{i===m&&(i=null)});return i=m,m},async snapshot(){return i!==null&&await i,a()}}}s(tm,"createScheduledTracker");var Kl="stamp:",nm=["startedAt","finishedAt","pendingAt","seenAt"];function rm(e){return`${Kl}${e}`}s(rm,"stampKvKey");function __(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e,r={};for(let n of nm){let o=t[n];typeof o=="number"&&Number.isFinite(o)&&(r[n]=o)}return Object.keys(r).length>0?r:null}s(__,"parseThreadStamps");function om(e){let{kv:t}=e.storage,r=Ut(),n=null;async function o(){if(n!==null)return n;let c=new Map;for(let a of await t.list(Kl)){let l=a.slice(Kl.length),f=__(await t.get(a));if(f===null){e.log.warn(`stored stamps for ${l} are invalid; dropping them`),await t.delete(a);continue}c.set(l,f)}return n=c,c}s(o,"load");async function i(c,a,l){if(Object.keys(l).length===0){c.delete(a),await t.delete(rm(a));return}c.set(a,l),await t.set(rm(a),l)}s(i,"save");function u(c){e.realtime.publish(Le.stamps,c)}return s(u,"publish"),{list:s(()=>r(async()=>{let c={startedAt:{},finishedAt:{},pendingAt:{},seenAt:{}};for(let[a,l]of await o())for(let f of nm){let p=l[f];p!==void 0&&(c[f][a]=p)}return c}),"list"),stamp:s((c,a,l)=>r(async()=>{if(a.length===0)return;let f=await o();for(let p of new Set(a))await i(f,p,{...f.get(p),[c]:l});u({kind:c,threadIds:[...a],value:l})}),"stamp"),clear:s((c,a)=>r(async()=>{if(a.length===0)return;let l=await o();for(let f of new Set(a)){let p=l.get(f);if(p?.[c]===void 0)continue;let{[c]:d,...m}=p;await i(l,f,m)}u({kind:c,threadIds:[...a],value:null})}),"clear"),forget:s(c=>r(async()=>{let a=await o();for(let l of c)a.has(l)&&await i(a,l,{})}),"forget"),prune:s((c,a)=>r(async()=>{let l=await o(),f=[];for(let[p,d]of[...l])c.has(p)||Math.max(...Object.values(d))>=a||(await i(l,p,{}),f.push(p));return f}),"prune")}}s(om,"createStampStore");function sm(e){return e instanceof Error?e.message:String(e)}s(sm,"errorMessage");async function $_(e,t){let r=new Set;for(let n of[!1,!0])for(let o=0;;o+=500){let i=await e.threads.list({archived:n,includeHidden:!0,limit:500,offset:o,signal:t});for(let u of i)r.add(u.id);if(i.length<500)break}return r}s($_,"listAllThreadIds");async function w_(e,t,r){let n=Date.now(),o;try{o=await $_(e.sdk,r)}catch(i){e.log.warn(`could not list threads to prune deleted ones: ${sm(i)}`);return}for(let i of t){let u=await i.prune(o,n);u.length>0&&e.log.info(`pruned ${i.name} of ${u.length} deleted threads`)}}s(w_,"pruneDeletedThreads");function im(e,t,r){return t.seed(async()=>{try{return await e.sdk.threads.queue.list({signal:r})}catch(n){throw e.log.warn(`could not list queued messages: ${sm(n)}`),n}})}s(im,"seedScheduled");function b_(e,t){return new Promise(r=>{let n=setTimeout(o,e);function o(){clearTimeout(n),t.removeEventListener("abort",o),r()}s(o,"done"),t.addEventListener("abort",o,{once:!0})})}s(b_,"sleep");function v_(e){return e.aborted?Promise.resolve():new Promise(t=>e.addEventListener("abort",()=>t(),{once:!0}))}s(v_,"waitForAbort");async function um(e,t,r,n,o=6e4){let i=im(e,r,n);await w_(e,t,n);let u=await i;for(;!u&&!n.aborted&&(await b_(o,n),!n.aborted);)u=await im(e,r,n);await v_(n)}s(um,"runStartup");function x_(e){let t=Md(e),r=om(e),n=Wd(e),o=tm({publish:s(a=>e.realtime.publish(Le.scheduled,a),"publish")}),i=Qd(e.log),u=Ut();e.rpc.register(Vd,{async listPreferences(){return{preferences:await t.readAll()}},async setPreference({key:a,value:l}){return{key:a,value:await t.write(a,l)}},async resetPreference({key:a}){return{key:a,value:await t.reset(a)}},importPreferences({bbMirror:a}){return u(()=>em({kv:e.storage.kv,log:e.log,store:t,readBbCli:i},a))},async listStamps(){return{stamps:await r.list()}},async markSeen({threadIds:a}){let l=Date.now();return await r.stamp("seenAt",a,l),{at:l}},async clearSeen({threadIds:a}){return await r.clear("seenAt",a),{ok:!0}},async listNotes(){return{notes:await n.list()}},listScheduled(){return o.snapshot()}}),e.cli.register(Kd(t));let c=s((a,l=Date.now())=>({...a,at:l}),"note");e.events.on("thread.active",async({thread:a})=>{await r.stamp("startedAt",[a.id],Date.now()),await n.update(a.id,{pending:null,failed:null})}),e.events.on("thread.idle",async({thread:a,lastAssistantText:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=qd(l);await n.update(a.id,{pending:null,...f?{done:c(f)}:{}})}),e.events.on("thread.failed",async({thread:a,error:l})=>{await r.stamp("finishedAt",[a.id],Date.now());let f=await Fl(e,{threadId:a.id,error:l,errorInfo:null,turnId:null});f===null&&(await n.get(a.id))?.failed||await n.update(a.id,{failed:c(Ml(f))})}),e.events.on("turn.failed",async({threadId:a,errorInfo:l,turnId:f})=>{let p=await Fl(e,{threadId:a,error:null,errorInfo:l,turnId:f});p!==null&&await n.update(a,{failed:c(Ml(p))})}),e.events.on("interaction.pending",async({thread:a,interaction:l})=>{await r.stamp("pendingAt",[a.id],Date.now()),await n.update(a.id,{pending:c(Gd(l),l.createdAt)})}),e.events.on("thread.deleted",async({thread:a})=>{o.threadGone(a.id),await r.forget([a.id]),await n.forget([a.id])}),e.events.on("thread.archived",({thread:a})=>o.threadGone(a.id)),e.events.on("message.queued",({entry:a})=>o.queued(a)),e.events.on("message.dispatched",({entry:a})=>o.removed(a.id)),e.events.on("message.cancelled",({entry:a})=>o.removed(a.id)),e.background.service("startup",{start:s(a=>um(e,[{name:"stamps",prune:r.prune},{name:"notes",prune:n.prune}],o,a),"start")})}s(x_,"threadGlance");export{x_ as default};
|
|
71
71
|
//# sourceMappingURL=server.js.map
|