austere-axi 0.10.2 → 0.10.3

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.
@@ -1,9 +1,9 @@
1
- (()=>{var Jf=Object.defineProperty;var dh=(e,t,n)=>t in e?Jf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ne=(e,t)=>{for(var n in t)Jf(e,n,{get:t[n],enumerable:!0})};var Je=(e,t,n)=>dh(e,typeof t!="symbol"?t+"":t,n);var y={};Ne(y,{$brand:()=>cs,$input:()=>Tc,$output:()=>Nc,INVALID:()=>ne,NEVER:()=>as,TimePrecision:()=>Kc,ZodAny:()=>Nl,ZodArray:()=>Rl,ZodBase64:()=>wi,ZodBase64URL:()=>vi,ZodBigInt:()=>dn,ZodBigIntFormat:()=>zi,ZodBoolean:()=>pn,ZodCIDRv4:()=>_i,ZodCIDRv6:()=>$i,ZodCUID:()=>pi,ZodCUID2:()=>di,ZodCatch:()=>of,ZodCodec:()=>dr,ZodCompileAsyncError:()=>ve,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>zl,ZodCustom:()=>mr,ZodCustomStringFormat:()=>St,ZodDate:()=>ar,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>jl,ZodE164:()=>ki,ZodEmail:()=>ci,ZodEmoji:()=>li,ZodEnum:()=>un,ZodError:()=>Sb,ZodExactOptional:()=>Oi,ZodFile:()=>Wl,ZodFirstPartyTypeKind:()=>_f,ZodFunction:()=>hf,ZodGUID:()=>ui,ZodIBAN:()=>Sl,ZodIPv4:()=>yi,ZodIPv6:()=>bi,ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,ZodInstanceOf:()=>bf,ZodIntersection:()=>Ml,ZodIssueCode:()=>Ob,ZodJWT:()=>xi,ZodKSUID:()=>gi,ZodLazy:()=>pf,ZodLiteral:()=>ql,ZodMAC:()=>xl,ZodMap:()=>Jl,ZodNaN:()=>af,ZodNanoID:()=>fi,ZodNever:()=>Cl,ZodNonOptional:()=>Ai,ZodNull:()=>El,ZodNullable:()=>Yl,ZodNumber:()=>fn,ZodNumberFormat:()=>It,ZodObject:()=>ur,ZodOptional:()=>fr,ZodPipe:()=>pr,ZodPrefault:()=>ef,ZodPreprocess:()=>cf,ZodPromise:()=>mf,ZodReadonly:()=>uf,ZodRealError:()=>le,ZodRecord:()=>cn,ZodSet:()=>Kl,ZodString:()=>ln,ZodStringFormat:()=>j,ZodSuccess:()=>rf,ZodSymbol:()=>Ol,ZodTemplateLiteral:()=>ff,ZodTransform:()=>Hl,ZodTuple:()=>Fl,ZodType:()=>E,ZodULID:()=>mi,ZodURL:()=>sr,ZodUUID:()=>Ae,ZodUndefined:()=>Al,ZodUnion:()=>lr,ZodUnknown:()=>Tl,ZodVoid:()=>Ll,ZodXID:()=>hi,ZodXor:()=>Dl,_ZodString:()=>ai,_default:()=>Ql,_function:()=>hm,any:()=>Kd,array:()=>cr,base64:()=>Sd,base64url:()=>Id,bigint:()=>Vd,boolean:()=>Pl,catch:()=>sf,check:()=>gm,cidrv4:()=>xd,cidrv6:()=>zd,clone:()=>L,codec:()=>fm,coerce:()=>wf,compile:()=>Dc,config:()=>F,core:()=>De,creditCard:()=>Od,cuid:()=>gd,cuid2:()=>yd,currencyCode:()=>Cd,custom:()=>ym,date:()=>Wd,decode:()=>yl,decodeAsync:()=>_l,deepPartial:()=>Am,describe:()=>bm,discriminatedUnion:()=>em,e164:()=>Pd,email:()=>sd,emoji:()=>md,encode:()=>gl,encodeAsync:()=>bl,endsWith:()=>Gt,enum:()=>Ii,exactOptional:()=>Gl,file:()=>am,flattenError:()=>An,float32:()=>Rd,float64:()=>Dd,formatError:()=>En,fromJSONSchema:()=>Pm,function:()=>hm,getDiscriminatedOption:()=>ac,getErrorMap:()=>Eb,globalRegistry:()=>Y,gt:()=>Pe,gte:()=>me,guid:()=>ad,hash:()=>Ld,hex:()=>Td,hostname:()=>Nd,httpUrl:()=>dd,iban:()=>Ad,includes:()=>Wt,input:()=>Zm,instanceof:()=>$m,int:()=>ii,int32:()=>jd,int64:()=>Fd,intersection:()=>Vl,invertCodec:()=>pm,ipv4:()=>wd,ipv6:()=>kd,iso:()=>hr,json:()=>vm,jwt:()=>Ed,keyof:()=>Hd,ksuid:()=>$d,lazy:()=>df,length:()=>wt,literal:()=>sm,locales:()=>Gn,looseObject:()=>Xd,looseRecord:()=>nm,lowercase:()=>Kt,lt:()=>Ie,lte:()=>de,mac:()=>vd,map:()=>rm,maxLength:()=>$t,maxSize:()=>Ye,memoizer:()=>Hn,meta:()=>_m,mime:()=>Xt,minLength:()=>Re,minSize:()=>Oe,multipleOf:()=>Ge,nan:()=>lm,nanoid:()=>hd,nativeEnum:()=>im,negative:()=>Wo,never:()=>Si,nonnegative:()=>Go,nonoptional:()=>nf,nonpositive:()=>Ho,normalize:()=>Qt,null:()=>Zl,nullable:()=>ir,nullish:()=>cm,number:()=>Il,object:()=>Gd,optional:()=>xt,output:()=>Nm,overwrite:()=>ke,parse:()=>pl,parseAsync:()=>dl,partialRecord:()=>tm,pipe:()=>si,positive:()=>qo,prefault:()=>tf,preprocess:()=>km,prettifyError:()=>ds,promise:()=>mm,properties:()=>Yt,property:()=>Yo,readonly:()=>lf,record:()=>Bl,refine:()=>gf,regex:()=>Jt,regexes:()=>_e,registry:()=>vo,safeDecode:()=>wl,safeDecodeAsync:()=>kl,safeEncode:()=>$l,safeEncodeAsync:()=>vl,safeParse:()=>ml,safeParseAsync:()=>hl,set:()=>om,setErrorMap:()=>Ab,size:()=>_t,slugify:()=>rn,startsWith:()=>Ht,strictObject:()=>Yd,string:()=>or,stringFormat:()=>Zd,stringbool:()=>wm,success:()=>um,superRefine:()=>yf,symbol:()=>Bd,templateLiteral:()=>dm,toJSONSchema:()=>ti,toLowerCase:()=>tn,toUpperCase:()=>nn,toZod:()=>$n,transform:()=>Pi,treeifyError:()=>ps,trim:()=>en,tuple:()=>Ul,uint32:()=>Md,uint64:()=>Ud,ulid:()=>bd,undefined:()=>Jd,union:()=>mn,unknown:()=>kt,uppercase:()=>qt,url:()=>pd,util:()=>k,uuid:()=>cd,uuidv4:()=>ud,uuidv6:()=>ld,uuidv7:()=>fd,validate:()=>Zn,validateAsync:()=>Nn,void:()=>qd,withParser:()=>ko,xid:()=>_d,xor:()=>Qd});var De={};Ne(De,{$ZodAny:()=>Xa,$ZodArray:()=>oc,$ZodAsyncError:()=>ce,$ZodBase64:()=>Ma,$ZodBase64URL:()=>Va,$ZodBigInt:()=>uo,$ZodBigIntFormat:()=>Wa,$ZodBoolean:()=>Un,$ZodCIDRv4:()=>Da,$ZodCIDRv6:()=>ja,$ZodCUID:()=>Sa,$ZodCUID2:()=>Ia,$ZodCatch:()=>kc,$ZodCheck:()=>M,$ZodCheckBigIntFormat:()=>Qs,$ZodCheckEndsWith:()=>fa,$ZodCheckGreaterThan:()=>qr,$ZodCheckIncludes:()=>ua,$ZodCheckLengthEquals:()=>ia,$ZodCheckLessThan:()=>Kr,$ZodCheckLowerCase:()=>aa,$ZodCheckMaxLength:()=>ra,$ZodCheckMaxSize:()=>ea,$ZodCheckMimeType:()=>ma,$ZodCheckMinLength:()=>oa,$ZodCheckMinSize:()=>ta,$ZodCheckMultipleOf:()=>Ys,$ZodCheckNumberFormat:()=>Xs,$ZodCheckOverwrite:()=>ha,$ZodCheckProperties:()=>da,$ZodCheckProperty:()=>pa,$ZodCheckRegex:()=>sa,$ZodCheckSizeEquals:()=>na,$ZodCheckStartsWith:()=>la,$ZodCheckStringFormat:()=>Vt,$ZodCheckUpperCase:()=>ca,$ZodCodec:()=>Jn,$ZodCreditCard:()=>Ua,$ZodCustom:()=>Ac,$ZodCustomStringFormat:()=>Ka,$ZodCyclicError:()=>yo,$ZodDate:()=>nc,$ZodDefault:()=>_c,$ZodDiscriminatedUnion:()=>cc,$ZodE164:()=>Fa,$ZodEmail:()=>$a,$ZodEmoji:()=>xa,$ZodEncodeError:()=>We,$ZodEnum:()=>dc,$ZodError:()=>fs,$ZodExactOptional:()=>yc,$ZodFile:()=>hc,$ZodFunction:()=>Pc,$ZodGUID:()=>ba,$ZodIBAN:()=>Ba,$ZodIPv4:()=>Ca,$ZodIPv6:()=>La,$ZodISODate:()=>Za,$ZodISODateTime:()=>Ea,$ZodISODuration:()=>Ta,$ZodISOTime:()=>Na,$ZodIntersection:()=>uc,$ZodJWT:()=>Ja,$ZodKSUID:()=>Aa,$ZodLazy:()=>Kn,$ZodLiteral:()=>mc,$ZodMAC:()=>Ra,$ZodMap:()=>fc,$ZodNaN:()=>xc,$ZodNanoID:()=>za,$ZodNever:()=>ec,$ZodNonOptional:()=>wc,$ZodNull:()=>Ya,$ZodNullable:()=>bc,$ZodNumber:()=>co,$ZodNumberFormat:()=>qa,$ZodObject:()=>Sp,$ZodObjectJIT:()=>ic,$ZodOptional:()=>fo,$ZodPipe:()=>po,$ZodPrefault:()=>$c,$ZodPreprocess:()=>zc,$ZodPromise:()=>Oc,$ZodReadonly:()=>Sc,$ZodRealError:()=>ue,$ZodRecord:()=>lc,$ZodRegistry:()=>wo,$ZodSet:()=>pc,$ZodString:()=>ht,$ZodStringFormat:()=>R,$ZodSuccess:()=>vc,$ZodSymbol:()=>Ha,$ZodTemplateLiteral:()=>Ic,$ZodTransform:()=>gc,$ZodTuple:()=>lo,$ZodType:()=>O,$ZodULID:()=>Pa,$ZodURL:()=>ka,$ZodUUID:()=>_a,$ZodUndefined:()=>Ga,$ZodUnion:()=>Bn,$ZodUnknown:()=>Qa,$ZodVoid:()=>tc,$ZodXID:()=>Oa,$ZodXor:()=>sc,$brand:()=>cs,$constructor:()=>p,$input:()=>Tc,$output:()=>Nc,Doc:()=>mt,INVALID:()=>ne,JSONSchema:()=>rd,JSONSchemaGenerator:()=>ni,NEVER:()=>as,TimePrecision:()=>Kc,URL_BAD_FORMAT:()=>wa,URL_UNPARSEABLE:()=>Dn,ZodCompileAsyncError:()=>ve,ZodCompileUnsupportedError:()=>N,_any:()=>uu,_array:()=>gu,_base64:()=>Uo,_base64url:()=>Bo,_bigint:()=>nu,_boolean:()=>eu,_catch:()=>mb,_check:()=>Vp,_cidrv4:()=>Vo,_cidrv6:()=>Fo,_coercedBigint:()=>ru,_coercedBoolean:()=>tu,_coercedDate:()=>mu,_coercedNumber:()=>Wc,_coercedString:()=>Fc,_creditCard:()=>Bc,_cuid:()=>To,_cuid2:()=>Co,_custom:()=>bu,_date:()=>du,_decode:()=>Cr,_decodeAsync:()=>Rr,_default:()=>fb,_discriminatedUnion:()=>Qy,_e164:()=>Jo,_email:()=>So,_emoji:()=>Zo,_encode:()=>Tr,_encodeAsync:()=>Lr,_endsWith:()=>Gt,_enum:()=>ib,_file:()=>yu,_float32:()=>Gc,_float64:()=>Yc,_gt:()=>Pe,_gte:()=>me,_guid:()=>Io,_iban:()=>Jc,_includes:()=>Wt,_int:()=>Hc,_int32:()=>Xc,_int64:()=>ou,_intersection:()=>eb,_ipv4:()=>jo,_ipv6:()=>Mo,_isoDate:()=>Qn,_isoDateTime:()=>Xn,_isoDuration:()=>tr,_isoTime:()=>er,_jwt:()=>Ko,_ksuid:()=>Do,_lazy:()=>bb,_length:()=>wt,_literal:()=>ab,_lowercase:()=>Kt,_lt:()=>Ie,_lte:()=>de,_mac:()=>Uc,_map:()=>rb,_max:()=>de,_maxLength:()=>$t,_maxSize:()=>Ye,_mime:()=>Xt,_min:()=>me,_minLength:()=>Re,_minSize:()=>Oe,_multipleOf:()=>Ge,_nan:()=>hu,_nanoid:()=>No,_nativeEnum:()=>sb,_negative:()=>Wo,_never:()=>fu,_nonnegative:()=>Go,_nonoptional:()=>pb,_nonpositive:()=>Ho,_normalize:()=>Qt,_null:()=>cu,_nullable:()=>lb,_number:()=>qc,_optional:()=>ub,_overwrite:()=>ke,_parse:()=>Rt,_parseAsync:()=>Dt,_pipe:()=>hb,_positive:()=>qo,_promise:()=>_b,_properties:()=>Yt,_property:()=>Yo,_readonly:()=>gb,_record:()=>nb,_refine:()=>_u,_regex:()=>Jt,_safeDecode:()=>jr,_safeDecodeAsync:()=>Vr,_safeEncode:()=>Dr,_safeEncodeAsync:()=>Mr,_safeParse:()=>jt,_safeParseAsync:()=>Mt,_set:()=>ob,_size:()=>_t,_slugify:()=>rn,_startsWith:()=>Ht,_string:()=>Vc,_stringFormat:()=>vt,_stringbool:()=>ku,_success:()=>db,_superRefine:()=>$u,_symbol:()=>su,_templateLiteral:()=>yb,_toLowerCase:()=>tn,_toUpperCase:()=>nn,_transform:()=>cb,_trim:()=>en,_tuple:()=>tb,_uint32:()=>Qc,_uint64:()=>iu,_ulid:()=>Lo,_undefined:()=>au,_union:()=>Yy,_unknown:()=>lu,_uppercase:()=>qt,_url:()=>Yn,_uuid:()=>Po,_uuidv4:()=>Oo,_uuidv6:()=>Ao,_uuidv7:()=>Eo,_void:()=>pu,_xid:()=>Ro,_xor:()=>Xy,base64Charset:()=>ro,base64urlCharset:()=>Fn,canParseURL:()=>va,clone:()=>L,compile:()=>Dc,compileFn:()=>xo,config:()=>F,createStandardJSONSchemaMethod:()=>on,createToJSONSchemaMethod:()=>zu,decode:()=>og,decodeAsync:()=>sg,describe:()=>wu,encode:()=>rg,encodeAsync:()=>ig,extractDefs:()=>Qe,finalize:()=>et,flattenError:()=>An,formatError:()=>En,getDiscriminatedOption:()=>ac,globalConfig:()=>W,globalRegistry:()=>Y,handleUnrepresentable:()=>J,initializeContext:()=>Xe,isBackEdge:()=>_o,isRecursiveSchema:()=>bo,isValidBase64:()=>Vn,isValidBase64URL:()=>oo,isValidCIDRv6:()=>no,isValidCreditCard:()=>io,isValidIBAN:()=>so,isValidIPv6:()=>Mn,isValidJWT:()=>ao,locales:()=>Gn,memoizer:()=>Hn,mergeValues:()=>Ft,meta:()=>vu,parse:()=>Zr,parseAsync:()=>Nr,parseURLObject:()=>kp,prettifyError:()=>ds,process:()=>D,processSchema:()=>D,regexes:()=>_e,registry:()=>vo,safeDecode:()=>cg,safeDecodeAsync:()=>lg,safeEncode:()=>ag,safeEncodeAsync:()=>ug,safeParse:()=>Xh,safeParseAsync:()=>Qh,standardProps:()=>Xr,stripTabAndNewline:()=>jn,toDotPath:()=>np,toJSONSchema:()=>ti,toZod:()=>$n,treeifyError:()=>ps,urlHostnameOk:()=>eo,urlProtocolOk:()=>to,util:()=>k,validate:()=>Zn,validateAsync:()=>Nn,validateURL:()=>Qr,version:()=>ga,withParser:()=>ko});var k={};Ne(k,{BIGINT_FORMAT_RANGES:()=>zn,CONSTANT_CATCH:()=>Ar,Class:()=>Gi,NUMBER_FORMAT_RANGES:()=>xn,aborted:()=>te,allowsEval:()=>Qi,assert:()=>bh,assertEqual:()=>mh,assertIs:()=>gh,assertNever:()=>yh,assertNotEqual:()=>hh,assignProp:()=>G,attachSchema:()=>Sn,base64ToUint8Array:()=>Gf,base64urlToUint8Array:()=>Rh,cached:()=>Nt,captureStackTrace:()=>Ir,cleanEnum:()=>Lh,cleanRegex:()=>Ce,clone:()=>L,cloneDef:()=>wh,codePointLength:()=>pt,constantCatch:()=>is,createTransparentProxy:()=>Ih,defineLazy:()=>Yi,defineLazyInternal:()=>Z,derived:()=>Vh,esc:()=>ee,escapeRegex:()=>be,explicitlyAborted:()=>ns,extend:()=>Ah,finalizeIssue:()=>ae,floatSafeRemainder:()=>wn,getElementAtPath:()=>vh,getEnumValues:()=>Et,getLengthableOrigin:()=>Pn,getParsedType:()=>Sh,getSizableOrigin:()=>In,hexToUint8Array:()=>jh,hide:()=>On,installLazyProp:()=>Jh,isObject:()=>ft,isPlainObject:()=>ye,issue:()=>Lt,joinValues:()=>zr,jsonStringifyReplacer:()=>Zt,members:()=>os,merge:()=>Zh,mergeDefs:()=>we,normalizeParams:()=>_,nullish:()=>Sr,numKeys:()=>zh,objectClone:()=>_h,omit:()=>Oh,optionalKeys:()=>ts,own:()=>qe,parsedType:()=>rs,partial:()=>Nh,pick:()=>Ph,prefixIssues:()=>se,primitiveTypes:()=>es,promiseAllObject:()=>kh,propertyKeyTypes:()=>kn,randomString:()=>xh,rawShape:()=>Tt,required:()=>Th,safeExtend:()=>Eh,shallowClone:()=>vn,sizeCaps:()=>Ct,slugify:()=>Xi,stringifyPrimitive:()=>Pr,toZod:()=>$n,uint8ArrayToBase64:()=>Yf,uint8ArrayToBase64url:()=>Dh,uint8ArrayToHex:()=>Mh,unwrapMessage:()=>At});function mh(e){return e}function hh(e){return e}function $n(){return e=>e}function gh(e){}function yh(e){throw new Error("Unexpected value in exhaustive check")}function bh(e){}function Et(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function zr(e,t="|"){return e.map(n=>Pr(n)).join(t)}function Zt(e,t){return typeof t=="bigint"?t.toString():t}var Hi=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function Nt(e){return new Hi(e)}function Sr(e){return e==null}function Ce(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function wn(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}var Kf=Symbol("evaluating");function Yi(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Kf)return r===void 0&&(r=Kf,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function _h(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function G(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Tt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Te(e){return Tt(e._zod.def)??e._zod.def.shape}function qf(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return G(this,t,r),r},enumerable:!0,configurable:!0})}function Wf(e,t,n){t in e?G(e,t,n):e[t]=n}function lt(e,t,n,r){let o=Te(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?qf(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a}):Wf(e,i,r?r(s.value,i):s.value))}}function $h(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?qf(e,n,()=>t[n]):Wf(e,n,r.value))}}function we(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function wh(e){return we(e._zod.def)}function vh(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function kh(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function xh(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function ee(e){return JSON.stringify(e)}function Xi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ir="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ft(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qi=Nt(()=>{if(W.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function ye(e){if(ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(ft(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function vn(e){return ye(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function zh(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Sh=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}`)}},kn=new Set(["string","number","symbol"]),es=new Set(["string","number","bigint","boolean","symbol","undefined"]);function be(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Ih(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Pr(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ts(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var xn={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]},zn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ph(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return lt(i,e,Or(e,t)),L(e,we(n,{shape:i,checks:[]}))}function Or(e,t){let n=Te(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function Oh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Or(e,t)),s={};return lt(s,e,Reflect.ownKeys(Te(e)).filter(a=>!i.has(a))),L(e,we(n,{shape:s,checks:[]}))}function Ah(e,t){if(!ye(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=Te(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 L(e,we(e._zod.def,{shape:Hf(e,t)}))}function Hf(e,t){let n={};return lt(n,e,Reflect.ownKeys(Te(e))),$h(n,t),n}function Eh(e,t){if(!ye(t))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,we(e._zod.def,{shape:Hf(e,t)}))}function Zh(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 n={};lt(n,e,Reflect.ownKeys(Te(e))),lt(n,t,Reflect.ownKeys(Te(t)));let r=we(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,r)}function Nh(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Or(t,n)):void 0,c={};return lt(c,t,Reflect.ownKeys(Te(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),L(t,we(t._zod.def,{shape:c,checks:[]}))}function Th(e,t,n){let r=n?new Set(Or(t,n)):void 0,o={};return lt(o,t,Reflect.ownKeys(Te(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,we(t._zod.def,{shape:o}))}function te(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ns(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function se(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function At(e){return typeof e=="string"?e:e?.message}function Ct(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}function Sn(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function ae(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:At(e.inst?._zod.def?.error?.(e))??At(i?.(e))??At(t?.error?.(e))??At(n.customError?.(e))??At(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function In(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Ch=/[\uD800-\uDBFF]/;function pt(e){let t=e.length;if(!Ch.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function Pn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function rs(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Lt(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Lh(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Gf(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Yf(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Rh(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Gf(t+n)}function Dh(e){return Yf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function jh(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function Mh(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Gi=class{constructor(...t){}};function os(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Fh(e,n,r.value)}}function qe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function On(e,t,n){return qe(e,t,n,!1)}function Vh(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return qe(this,n,r(this))},set(o){qe(this,n,o)}})}return t}function Fh(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:qe(this,t,n.bind(this))},set(r){qe(this,t,r)}})}function Uh(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Wi,Ke=!1,Bh={configurable:!0,get(){Ke=!0}};function Z(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Wi!==e._zod){Wi=void 0;return}Wi=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Bh);let o=Ke;Ke=!1;try{let i=n(this);return Ke?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Ke=Ke||o,i}catch(i){throw delete this[t],Ke=Ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Jh(e,t,n,r){let o=Uh(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Ar="~constantCatch";function is(e){let t=()=>e;return t[Ar]=!0,t}var Xf,as=Object.freeze({status:"aborted"}),ss={value:void 0,enumerable:!1},Qf="captureStackTrace"in Error?Error:null;function Kh(e){let t=Qf;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return Qf=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function p(e,t,n,r){let o={};function i(m){this.def=m,this.constr=f,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(m,d){if(m._zod){if(m._zod.traits.has(e))return}else{ss.value=new i(d);try{Object.defineProperty(m,"_zod",ss)}finally{ss.value=void 0}}if(m._zod.traits.add(e),t(m,d),a){let b=Object.getPrototypeOf(m),$=m._zod.constr.prototype,S=b;for(;S&&S!==$;)S=Object.getPrototypeOf(S);let x=S??b;a.has(x)||(a.add(x),os(x,s))}let g=f.prototype;for(let b in g)Object.prototype.hasOwnProperty.call(g,b)&&(b in m||(m[b]=g[b].bind(m)))}let u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(m){let d=r?.Parent?Kh(l):this;c(d,m);let g=d._zod.deferred;if(g){for(let $ of g)$();d._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(d),d}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:m=>r?.Parent&&m instanceof r.Parent?!0:m?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var cs=Symbol("zod_brand"),ce=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},We=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Xf=globalThis).__zod_globalConfig??(Xf.__zod_globalConfig={});var W=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(W,e),W}function qh(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Zt,2)),e.message}function Wh(e){this._zod.message=e}var Hh={get:qh,set:Wh,enumerable:!0,configurable:!0},ls={value:void 0,enumerable:!1},ep=new WeakSet([Object.prototype,Error.prototype]),tp=(e,t)=>{e.name="$ZodError",ls.value=t,Object.defineProperty(e,"issues",ls),ls.value=void 0,Object.defineProperty(e,"message",Hh);let n=Object.getPrototypeOf(e);ep.has(n)||(ep.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},fs=p("$ZodError",tp),ue=p("$ZodError",tp,void 0,{Parent:Error});function Gh(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function An(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?Gh(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function En(e,t=n=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,u=0;for(;u<a.length;){let l=a[u],f=u===a.length-1;if(l==="_errors"){f&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let m=c[l];f&&m._errors.push(t(s)),c=m,u++}}}};return r(e),n}function ps(e,t=n=>n.message){let n={errors:[]},r=(o,i=[])=>{var s;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){n.errors.push(t(a));continue}let u=n,l=0;for(;l<c.length;){let f=c[l],m=l===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),m&&u.errors.push(t(a)),l++}}};return r(e),n}function np(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function ds(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${np(r.path)}`);return t.join(`
2
- `)}function Er(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Rt=e=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ce;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>ae(u,s,F())));throw Ir(c,i?.callee??t),c}return a.value};return t},Zr=Rt(ue),Dt=e=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>ae(u,s,F())));throw Ir(c,i?.callee??t),c}return a.value};return t},Nr=Dt(ue),jt=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new ce;return i.issues.length?rp(e,i.issues,o):{success:!0,data:i.value}},Xh=jt(ue);function rp(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>ae(o,n,F()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}var Mt=e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?rp(e,i.issues,o):{success:!0,data:i.value}},Qh=Mt(ue),eg=Symbol.for("zod.compile.invalid"),tg=Symbol.for("zod.compile.fallback"),Zn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==eg)return!0;if(r.definite===!0&&n===void 0)return!1}return ng(e,t,n)});function ng(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[tg]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new ce;return i.issues.length===0}var Nn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},Tr=e=>{let t=Rt(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,Er(n,s))};return n},rg=Tr(ue),Cr=e=>{let t=Rt(e),n=(r,o,i,s)=>t(r,o,i,Er(n,s));return n},og=Cr(ue),Lr=e=>{let t=Dt(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Er(n,s))};return n},ig=Lr(ue),Rr=e=>{let t=Dt(e),n=async(r,o,i,s)=>await t(r,o,i,Er(n,s));return n},sg=Rr(ue),Dr=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return jt(e)(t,n,o)},ag=Dr(ue),jr=e=>(t,n,r)=>jt(e)(t,n,r),cg=jr(ue),Mr=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Mt(e)(t,n,o)},ug=Mr(ue),Vr=e=>async(t,n,r)=>Mt(e)(t,n,r),lg=Vr(ue);var _e={};Ne(_e,{anyString:()=>Ms,base64:()=>Es,base64url:()=>Zs,bigint:()=>Fs,boolean:()=>Us,browserEmail:()=>bg,cidrv4:()=>Os,cidrv6:()=>As,creditCard:()=>Fr,cuid:()=>hs,cuid2:()=>gs,currencyCode:()=>Ls,date:()=>Rs,datetime:()=>js,domain:()=>Ts,duration:()=>vs,e164:()=>Cs,email:()=>xs,emoji:()=>zs,extendedDuration:()=>fg,guid:()=>ks,hex:()=>Ws,hostname:()=>Ns,html5Email:()=>hg,httpProtocol:()=>Tn,iban:()=>Ur,idnEmail:()=>yg,integer:()=>Cn,ipv4:()=>Ss,ipv6:()=>Is,ksuid:()=>_s,lowercase:()=>Ks,mac:()=>Ps,md5_base64:()=>vg,md5_base64url:()=>kg,md5_hex:()=>wg,nanoid:()=>$s,nanoidOfLength:()=>ws,null:()=>Bs,number:()=>Le,rfc5322Email:()=>gg,sha1_base64:()=>zg,sha1_base64url:()=>Sg,sha1_hex:()=>xg,sha256_base64:()=>Pg,sha256_base64url:()=>Og,sha256_hex:()=>Ig,sha384_base64:()=>Eg,sha384_base64url:()=>Zg,sha384_hex:()=>Ag,sha512_base64:()=>Tg,sha512_base64url:()=>Cg,sha512_hex:()=>Ng,string:()=>Vs,time:()=>Ds,ulid:()=>ys,undefined:()=>Js,unicodeEmail:()=>op,uppercase:()=>qs,uuid:()=>dt,uuid4:()=>pg,uuid6:()=>dg,uuid7:()=>mg,xid:()=>bs});var hs=/^[cC][0-9a-z]{6,}$/,gs=/^[0-9a-z]+$/,ys=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,bs=/^[0-9a-vA-V]{20}$/,_s=/^[A-Za-z0-9]{27}$/,$s=/^[a-zA-Z0-9_-]{21}$/;function ws(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var vs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,fg=/^[-+]?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)?)??$/,ks=/^([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})$/,dt=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)$/,pg=dt(4),dg=dt(6),mg=dt(7),xs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,hg=/^[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])?)*$/,gg=/^(([^<>()\[\]\\.,;:\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,}))$/,op=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,yg=op,bg=/^[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])?)*$/,_g="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zs(){return new RegExp(_g,"u")}var Ss=/^(?:(?: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])$/,Is=/^(([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}|:))$/,Ps=e=>{let t=be(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Os=/^((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])$/,As=/^(([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])$/,Es=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Zs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ns=/^(?=.{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])?)*\.?$/,Ts=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Tn=/^https?$/,Cs=/^\+[1-9]\d{6,14}$/,Fr=/^\d(?:[ -]?\d){11,18}$/,Ls=/^(?: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)$/,Ur=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,ip="(?:(?:\\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 $g(e){return new RegExp(`^${e}$`)}var Rs=$g(ip);function ms(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+)?)?`}function Ds(e){return new RegExp(`^${ms(e)}$`)}function js(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${ms({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${ms({precision:e.precision})}`:n;return new RegExp(`^${ip}T(?:${r})$`)}var Ms=/^[\s\S]{0,}$/,Vs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Fs=/^-?\d+n?$/,Cn=/^-?\d+$/,Le=/^-?\d+(?:\.\d+)?$/,Us=/^(?:true|false)$/i,Bs=/^null$/i;var Js=/^undefined$/i;var Ks=/^[^A-Z]*$/,qs=/^[^a-z]*$/,Ws=/^[0-9a-fA-F]*$/;function Ln(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Rn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var wg=/^[0-9a-fA-F]{32}$/,vg=Ln(22,"=="),kg=Rn(22),xg=/^[0-9a-fA-F]{40}$/,zg=Ln(27,"="),Sg=Rn(27),Ig=/^[0-9a-fA-F]{64}$/,Pg=Ln(43,"="),Og=Rn(43),Ag=/^[0-9a-fA-F]{96}$/,Eg=Ln(64,""),Zg=Rn(64),Ng=/^[0-9a-fA-F]{128}$/,Tg=Ln(86,"=="),Cg=Rn(86);var M=p("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Hs=e=>{let t=e.value;return!Sr(t)&&t.size!==void 0},Gs=e=>{let t=e.value;return!Sr(t)&&t.length!==void 0},Br={number:"number",bigint:"bigint",object:"date"},Kr=p("$ZodCheckLessThan",(e,t)=>{M.init(e,t);let n=Br[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Br[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qr=p("$ZodCheckGreaterThan",(e,t)=>{M.init(e,t);let n=Br[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Br[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ys=p("$ZodCheckMultipleOf",(e,t)=>{M.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):wn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Xs=p("$ZodCheckNumberFormat",(e,t)=>{M.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=xn[t.format];e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Qs=p("$ZodCheckBigIntFormat",(e,t)=>{M.init(e,t);let[n,r]=zn[t.format];e._zod.check=o=>{let i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),ea=p("$ZodCheckMaxSize",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:In(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ta=p("$ZodCheckMinSize",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:In(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),na=p("$ZodCheckSizeEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Hs),e._zod.check=r=>{let o=r.value,i=o.size;if(i===t.size)return;let s=i>t.size;r.issues.push({origin:In(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ra=p("$ZodCheckMaxLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?pt(o):i)<=t.maximum)return;let a=Pn(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),oa=p("$ZodCheckMinLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?pt(o):i)>=t.minimum)return;let a=Pn(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ia=p("$ZodCheckLengthEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?pt(o):i;if(s===t.length)return;let a=Pn(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Vt=p("$ZodCheckStringFormat",(e,t)=>{var n,r;M.init(e,t),t.pattern?(n=e._zod).check??(n.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})}):(r=e._zod).check??(r.check=()=>{})}),sa=p("$ZodCheckRegex",(e,t)=>{Vt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),aa=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ks),Vt.init(e,t)}),ca=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=qs),Vt.init(e,t)}),ua=p("$ZodCheckIncludes",(e,t)=>{M.init(e,t);let n=be(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,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})}}),la=p("$ZodCheckStartsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`^${be(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),fa=p("$ZodCheckEndsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`.*${be(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Jr(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues))}var pa=p("$ZodCheckProperty",(e,t)=>{M.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>Jr(o,n,t.property));Jr(r,n,t.property)}}),da=p("$ZodCheckProperties",(e,t)=>{M.init(e,t),On(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let o=r.value,i;for(let[s,a]of n){let c=a._zod.run({value:o[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>Jr(u,r,s)))):Jr(c,r,s)}if(i)return Promise.all(i).then(()=>{})}}),ma=p("$ZodCheckMimeType",(e,t)=>{M.init(e,t);let n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),ha=p("$ZodCheckOverwrite",(e,t)=>{M.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var mt=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}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 r=t.split(`
1
+ (()=>{var Kf=Object.defineProperty;var bh=(e,t,n)=>t in e?Kf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Te=(e,t)=>{for(var n in t)Kf(e,n,{get:t[n],enumerable:!0})};var Je=(e,t,n)=>bh(e,typeof t!="symbol"?t+"":t,n);var y={};Te(y,{$brand:()=>cs,$input:()=>Tc,$output:()=>Zc,INVALID:()=>re,NEVER:()=>as,TimePrecision:()=>Kc,ZodAny:()=>Zl,ZodArray:()=>Rl,ZodBase64:()=>vi,ZodBase64URL:()=>ki,ZodBigInt:()=>dn,ZodBigIntFormat:()=>Si,ZodBoolean:()=>pn,ZodCIDRv4:()=>$i,ZodCIDRv6:()=>wi,ZodCUID:()=>di,ZodCUID2:()=>mi,ZodCatch:()=>of,ZodCodec:()=>dr,ZodCompileAsyncError:()=>ve,ZodCompileUnsupportedError:()=>Z,ZodCreditCard:()=>zl,ZodCustom:()=>mr,ZodCustomStringFormat:()=>St,ZodDate:()=>ar,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>jl,ZodE164:()=>xi,ZodEmail:()=>ui,ZodEmoji:()=>fi,ZodEnum:()=>un,ZodError:()=>Eb,ZodExactOptional:()=>Ai,ZodFile:()=>Hl,ZodFirstPartyTypeKind:()=>_f,ZodFunction:()=>hf,ZodGUID:()=>li,ZodIBAN:()=>Sl,ZodIPv4:()=>bi,ZodIPv6:()=>_i,ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,ZodInstanceOf:()=>bf,ZodIntersection:()=>Ml,ZodIssueCode:()=>Tb,ZodJWT:()=>zi,ZodKSUID:()=>yi,ZodLazy:()=>pf,ZodLiteral:()=>ql,ZodMAC:()=>xl,ZodMap:()=>Jl,ZodNaN:()=>af,ZodNanoID:()=>pi,ZodNever:()=>Cl,ZodNonOptional:()=>Ei,ZodNull:()=>El,ZodNullable:()=>Yl,ZodNumber:()=>fn,ZodNumberFormat:()=>It,ZodObject:()=>ur,ZodOptional:()=>fr,ZodPipe:()=>pr,ZodPrefault:()=>ef,ZodPreprocess:()=>cf,ZodPromise:()=>mf,ZodReadonly:()=>uf,ZodRealError:()=>le,ZodRecord:()=>cn,ZodSet:()=>Kl,ZodString:()=>ln,ZodStringFormat:()=>j,ZodSuccess:()=>rf,ZodSymbol:()=>Ol,ZodTemplateLiteral:()=>ff,ZodTransform:()=>Wl,ZodTuple:()=>Fl,ZodType:()=>E,ZodULID:()=>hi,ZodURL:()=>sr,ZodUUID:()=>Ae,ZodUndefined:()=>Al,ZodUnion:()=>lr,ZodUnknown:()=>Tl,ZodVoid:()=>Ll,ZodXID:()=>gi,ZodXor:()=>Dl,_ZodString:()=>ci,_default:()=>Ql,_function:()=>gm,any:()=>qd,array:()=>cr,base64:()=>Id,base64url:()=>Pd,bigint:()=>Fd,boolean:()=>Pl,catch:()=>sf,check:()=>ym,cidrv4:()=>zd,cidrv6:()=>Sd,clone:()=>L,codec:()=>pm,coerce:()=>wf,compile:()=>Dc,config:()=>U,core:()=>je,creditCard:()=>Ad,cuid:()=>yd,cuid2:()=>bd,currencyCode:()=>Ld,custom:()=>bm,date:()=>Wd,decode:()=>yl,decodeAsync:()=>_l,deepPartial:()=>Em,describe:()=>_m,discriminatedUnion:()=>tm,e164:()=>Od,email:()=>ad,emoji:()=>hd,encode:()=>gl,encodeAsync:()=>bl,endsWith:()=>Gt,enum:()=>Pi,exactOptional:()=>Gl,file:()=>cm,flattenError:()=>An,float32:()=>Dd,float64:()=>jd,formatError:()=>En,fromJSONSchema:()=>Om,function:()=>gm,getDiscriminatedOption:()=>ac,getErrorMap:()=>Lb,globalRegistry:()=>Y,gt:()=>Pe,gte:()=>he,guid:()=>cd,hash:()=>Rd,hex:()=>Cd,hostname:()=>Td,httpUrl:()=>md,iban:()=>Ed,includes:()=>Ht,input:()=>Zm,instanceof:()=>wm,int:()=>si,int32:()=>Md,int64:()=>Ud,intersection:()=>Vl,invertCodec:()=>dm,ipv4:()=>vd,ipv6:()=>xd,iso:()=>hr,json:()=>km,jwt:()=>Nd,keyof:()=>Gd,ksuid:()=>wd,lazy:()=>df,length:()=>wt,literal:()=>am,locales:()=>Gn,looseObject:()=>Qd,looseRecord:()=>rm,lowercase:()=>Kt,lt:()=>Ie,lte:()=>me,mac:()=>kd,map:()=>om,maxLength:()=>$t,maxSize:()=>Ye,memoizer:()=>Wn,meta:()=>$m,mime:()=>Xt,minLength:()=>De,minSize:()=>Oe,multipleOf:()=>Ge,nan:()=>fm,nanoid:()=>gd,nativeEnum:()=>sm,negative:()=>Wo,never:()=>Ii,nonnegative:()=>Yo,nonoptional:()=>nf,nonpositive:()=>Go,normalize:()=>Qt,null:()=>Nl,nullable:()=>ir,nullish:()=>um,number:()=>Il,object:()=>Yd,optional:()=>xt,output:()=>Tm,overwrite:()=>ke,parse:()=>pl,parseAsync:()=>dl,partialRecord:()=>nm,pipe:()=>ai,positive:()=>Ho,prefault:()=>tf,preprocess:()=>xm,prettifyError:()=>ds,promise:()=>hm,properties:()=>Yt,property:()=>Xo,readonly:()=>lf,record:()=>Bl,refine:()=>gf,regex:()=>Jt,regexes:()=>$e,registry:()=>ko,safeDecode:()=>wl,safeDecodeAsync:()=>kl,safeEncode:()=>$l,safeEncodeAsync:()=>vl,safeParse:()=>ml,safeParseAsync:()=>hl,set:()=>im,setErrorMap:()=>Cb,size:()=>_t,slugify:()=>rn,startsWith:()=>Wt,strictObject:()=>Xd,string:()=>or,stringFormat:()=>Zd,stringbool:()=>vm,success:()=>lm,superRefine:()=>yf,symbol:()=>Jd,templateLiteral:()=>mm,toJSONSchema:()=>ni,toLowerCase:()=>tn,toUpperCase:()=>nn,toZod:()=>$n,transform:()=>Oi,treeifyError:()=>ps,trim:()=>en,tuple:()=>Ul,uint32:()=>Vd,uint64:()=>Bd,ulid:()=>_d,undefined:()=>Kd,union:()=>mn,unknown:()=>kt,uppercase:()=>qt,url:()=>dd,util:()=>k,uuid:()=>ud,uuidv4:()=>ld,uuidv6:()=>fd,uuidv7:()=>pd,validate:()=>Nn,validateAsync:()=>Zn,void:()=>Hd,withParser:()=>xo,xid:()=>$d,xor:()=>em});var je={};Te(je,{$ZodAny:()=>Xa,$ZodArray:()=>oc,$ZodAsyncError:()=>ce,$ZodBase64:()=>Ma,$ZodBase64URL:()=>Va,$ZodBigInt:()=>lo,$ZodBigIntFormat:()=>Ha,$ZodBoolean:()=>Un,$ZodCIDRv4:()=>Da,$ZodCIDRv6:()=>ja,$ZodCUID:()=>Sa,$ZodCUID2:()=>Ia,$ZodCatch:()=>kc,$ZodCheck:()=>M,$ZodCheckBigIntFormat:()=>Qs,$ZodCheckEndsWith:()=>fa,$ZodCheckGreaterThan:()=>Hr,$ZodCheckIncludes:()=>ua,$ZodCheckLengthEquals:()=>ia,$ZodCheckLessThan:()=>qr,$ZodCheckLowerCase:()=>aa,$ZodCheckMaxLength:()=>ra,$ZodCheckMaxSize:()=>ea,$ZodCheckMimeType:()=>ma,$ZodCheckMinLength:()=>oa,$ZodCheckMinSize:()=>ta,$ZodCheckMultipleOf:()=>Ys,$ZodCheckNumberFormat:()=>Xs,$ZodCheckOverwrite:()=>ha,$ZodCheckProperties:()=>da,$ZodCheckProperty:()=>pa,$ZodCheckRegex:()=>sa,$ZodCheckSizeEquals:()=>na,$ZodCheckStartsWith:()=>la,$ZodCheckStringFormat:()=>Vt,$ZodCheckUpperCase:()=>ca,$ZodCodec:()=>Jn,$ZodCreditCard:()=>Ua,$ZodCustom:()=>Ac,$ZodCustomStringFormat:()=>Ka,$ZodCyclicError:()=>bo,$ZodDate:()=>nc,$ZodDefault:()=>_c,$ZodDiscriminatedUnion:()=>cc,$ZodE164:()=>Fa,$ZodEmail:()=>$a,$ZodEmoji:()=>xa,$ZodEncodeError:()=>He,$ZodEnum:()=>dc,$ZodError:()=>fs,$ZodExactOptional:()=>yc,$ZodFile:()=>hc,$ZodFunction:()=>Pc,$ZodGUID:()=>ba,$ZodIBAN:()=>Ba,$ZodIPv4:()=>Ca,$ZodIPv6:()=>La,$ZodISODate:()=>Na,$ZodISODateTime:()=>Ea,$ZodISODuration:()=>Ta,$ZodISOTime:()=>Za,$ZodIntersection:()=>uc,$ZodJWT:()=>Ja,$ZodKSUID:()=>Aa,$ZodLazy:()=>Kn,$ZodLiteral:()=>mc,$ZodMAC:()=>Ra,$ZodMap:()=>fc,$ZodNaN:()=>xc,$ZodNanoID:()=>za,$ZodNever:()=>ec,$ZodNonOptional:()=>wc,$ZodNull:()=>Ya,$ZodNullable:()=>bc,$ZodNumber:()=>uo,$ZodNumberFormat:()=>qa,$ZodObject:()=>Ip,$ZodObjectJIT:()=>ic,$ZodOptional:()=>po,$ZodPipe:()=>mo,$ZodPrefault:()=>$c,$ZodPreprocess:()=>zc,$ZodPromise:()=>Oc,$ZodReadonly:()=>Sc,$ZodRealError:()=>ue,$ZodRecord:()=>lc,$ZodRegistry:()=>vo,$ZodSet:()=>pc,$ZodString:()=>ht,$ZodStringFormat:()=>R,$ZodSuccess:()=>vc,$ZodSymbol:()=>Wa,$ZodTemplateLiteral:()=>Ic,$ZodTransform:()=>gc,$ZodTuple:()=>fo,$ZodType:()=>O,$ZodULID:()=>Pa,$ZodURL:()=>ka,$ZodUUID:()=>_a,$ZodUndefined:()=>Ga,$ZodUnion:()=>Bn,$ZodUnknown:()=>Qa,$ZodVoid:()=>tc,$ZodXID:()=>Oa,$ZodXor:()=>sc,$brand:()=>cs,$constructor:()=>p,$input:()=>Tc,$output:()=>Zc,Doc:()=>mt,INVALID:()=>re,JSONSchema:()=>od,JSONSchemaGenerator:()=>ri,NEVER:()=>as,TimePrecision:()=>Kc,URL_BAD_FORMAT:()=>wa,URL_UNPARSEABLE:()=>Dn,ZodCompileAsyncError:()=>ve,ZodCompileUnsupportedError:()=>Z,_any:()=>uu,_array:()=>gu,_base64:()=>Bo,_base64url:()=>Jo,_bigint:()=>nu,_boolean:()=>eu,_catch:()=>_b,_check:()=>Fp,_cidrv4:()=>Fo,_cidrv6:()=>Uo,_coercedBigint:()=>ru,_coercedBoolean:()=>tu,_coercedDate:()=>mu,_coercedNumber:()=>Hc,_coercedString:()=>Fc,_creditCard:()=>Bc,_cuid:()=>Co,_cuid2:()=>Lo,_custom:()=>bu,_date:()=>du,_decode:()=>Lr,_decodeAsync:()=>Dr,_default:()=>gb,_discriminatedUnion:()=>ob,_e164:()=>Ko,_email:()=>Io,_emoji:()=>Zo,_encode:()=>Cr,_encodeAsync:()=>Rr,_endsWith:()=>Gt,_enum:()=>lb,_file:()=>yu,_float32:()=>Gc,_float64:()=>Yc,_gt:()=>Pe,_gte:()=>he,_guid:()=>Po,_iban:()=>Jc,_includes:()=>Ht,_int:()=>Wc,_int32:()=>Xc,_int64:()=>ou,_intersection:()=>ib,_ipv4:()=>Mo,_ipv6:()=>Vo,_isoDate:()=>Qn,_isoDateTime:()=>Xn,_isoDuration:()=>tr,_isoTime:()=>er,_jwt:()=>qo,_ksuid:()=>jo,_lazy:()=>kb,_length:()=>wt,_literal:()=>pb,_lowercase:()=>Kt,_lt:()=>Ie,_lte:()=>me,_mac:()=>Uc,_map:()=>cb,_max:()=>me,_maxLength:()=>$t,_maxSize:()=>Ye,_mime:()=>Xt,_min:()=>he,_minLength:()=>De,_minSize:()=>Oe,_multipleOf:()=>Ge,_nan:()=>hu,_nanoid:()=>To,_nativeEnum:()=>fb,_negative:()=>Wo,_never:()=>fu,_nonnegative:()=>Yo,_nonoptional:()=>yb,_nonpositive:()=>Go,_normalize:()=>Qt,_null:()=>cu,_nullable:()=>hb,_number:()=>qc,_optional:()=>mb,_overwrite:()=>ke,_parse:()=>Rt,_parseAsync:()=>Dt,_pipe:()=>$b,_positive:()=>Ho,_promise:()=>xb,_properties:()=>Yt,_property:()=>Xo,_readonly:()=>wb,_record:()=>ab,_refine:()=>_u,_regex:()=>Jt,_safeDecode:()=>Mr,_safeDecodeAsync:()=>Fr,_safeEncode:()=>jr,_safeEncodeAsync:()=>Vr,_safeParse:()=>jt,_safeParseAsync:()=>Mt,_set:()=>ub,_size:()=>_t,_slugify:()=>rn,_startsWith:()=>Wt,_string:()=>Vc,_stringFormat:()=>vt,_stringbool:()=>ku,_success:()=>bb,_superRefine:()=>$u,_symbol:()=>su,_templateLiteral:()=>vb,_toLowerCase:()=>tn,_toUpperCase:()=>nn,_transform:()=>db,_trim:()=>en,_tuple:()=>sb,_uint32:()=>Qc,_uint64:()=>iu,_ulid:()=>Ro,_undefined:()=>au,_union:()=>nb,_unknown:()=>lu,_uppercase:()=>qt,_url:()=>Yn,_uuid:()=>Oo,_uuidv4:()=>Ao,_uuidv6:()=>Eo,_uuidv7:()=>No,_void:()=>pu,_xid:()=>Do,_xor:()=>rb,base64Charset:()=>oo,base64urlCharset:()=>Fn,canParseURL:()=>va,clone:()=>L,compile:()=>Dc,compileFn:()=>zo,config:()=>U,createStandardJSONSchemaMethod:()=>on,createToJSONSchemaMethod:()=>zu,decode:()=>ug,decodeAsync:()=>fg,describe:()=>wu,encode:()=>cg,encodeAsync:()=>lg,extractDefs:()=>Qe,finalize:()=>et,flattenError:()=>An,formatError:()=>En,getDiscriminatedOption:()=>ac,globalConfig:()=>W,globalRegistry:()=>Y,handleUnrepresentable:()=>K,initializeContext:()=>Xe,isBackEdge:()=>$o,isRecursiveSchema:()=>_o,isValidBase64:()=>Vn,isValidBase64URL:()=>io,isValidCIDRv6:()=>ro,isValidCreditCard:()=>so,isValidIBAN:()=>ao,isValidIPv6:()=>Mn,isValidJWT:()=>co,locales:()=>Gn,memoizer:()=>Wn,mergeValues:()=>Ft,meta:()=>vu,parse:()=>Zr,parseAsync:()=>Tr,parseURLObject:()=>xp,prettifyError:()=>ds,process:()=>D,processSchema:()=>D,regexes:()=>$e,registry:()=>ko,safeDecode:()=>dg,safeDecodeAsync:()=>hg,safeEncode:()=>pg,safeEncodeAsync:()=>mg,safeParse:()=>rg,safeParseAsync:()=>og,standardProps:()=>Qr,stripTabAndNewline:()=>jn,toDotPath:()=>rp,toJSONSchema:()=>ni,toZod:()=>$n,treeifyError:()=>ps,urlHostnameOk:()=>to,urlProtocolOk:()=>no,util:()=>k,validate:()=>Nn,validateAsync:()=>Zn,validateURL:()=>eo,version:()=>ga,withParser:()=>xo});var k={};Te(k,{BIGINT_FORMAT_RANGES:()=>zn,CONSTANT_CATCH:()=>Er,Class:()=>Gi,NUMBER_FORMAT_RANGES:()=>xn,aborted:()=>ne,allowsEval:()=>Qi,assert:()=>kh,assertEqual:()=>_h,assertIs:()=>wh,assertNever:()=>vh,assertNotEqual:()=>$h,assignProp:()=>G,attachSchema:()=>Sn,base64ToUint8Array:()=>Yf,base64urlToUint8Array:()=>Fh,cached:()=>Zt,captureStackTrace:()=>Pr,cleanEnum:()=>Vh,cleanRegex:()=>Le,clone:()=>L,cloneDef:()=>Sh,codePointLength:()=>pt,constantCatch:()=>is,createTransparentProxy:()=>Nh,defineLazy:()=>Yi,defineLazyInternal:()=>N,derived:()=>Kh,esc:()=>te,escapeRegex:()=>_e,explicitlyAborted:()=>ns,extend:()=>Ch,finalizeIssue:()=>ae,floatSafeRemainder:()=>wn,getElementAtPath:()=>Ih,getEnumValues:()=>Et,getLengthableOrigin:()=>Pn,getParsedType:()=>Eh,getSizableOrigin:()=>In,hexToUint8Array:()=>Bh,hide:()=>On,installLazyProp:()=>Gh,isObject:()=>ft,isPlainObject:()=>be,issue:()=>Lt,joinValues:()=>Sr,jsonStringifyReplacer:()=>Nt,members:()=>os,merge:()=>Rh,mergeDefs:()=>we,normalizeParams:()=>_,nullish:()=>Ir,numKeys:()=>Ah,objectClone:()=>xh,omit:()=>Th,optionalKeys:()=>ts,own:()=>qe,parsedType:()=>rs,partial:()=>Dh,pick:()=>Zh,prefixIssues:()=>se,primitiveTypes:()=>es,promiseAllObject:()=>Ph,propertyKeyTypes:()=>kn,randomString:()=>Oh,rawShape:()=>Tt,required:()=>jh,safeExtend:()=>Lh,shallowClone:()=>vn,sizeCaps:()=>Ct,slugify:()=>Xi,stringifyPrimitive:()=>Or,toZod:()=>$n,uint8ArrayToBase64:()=>Xf,uint8ArrayToBase64url:()=>Uh,uint8ArrayToHex:()=>Jh,unwrapMessage:()=>At});function _h(e){return e}function $h(e){return e}function $n(){return e=>e}function wh(e){}function vh(e){throw new Error("Unexpected value in exhaustive check")}function kh(e){}function Et(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Sr(e,t="|"){return e.map(n=>Or(n)).join(t)}function Nt(e,t){return typeof t=="bigint"?t.toString():t}var Wi=class{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 Zt(e){return new Wi(e)}function Ir(e){return e==null}function Le(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function wn(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}var qf=Symbol("evaluating");function Yi(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==qf)return r===void 0&&(r=qf,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function xh(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function G(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Tt(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Ce(e){return Tt(e._zod.def)??e._zod.def.shape}function Hf(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return G(this,t,r),r},enumerable:!0,configurable:!0})}function Wf(e,t,n){t in e?G(e,t,n):e[t]=n}function lt(e,t,n,r){let o=Ce(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);s.enumerable&&(s.get?Hf(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a}):Wf(e,i,r?r(s.value,i):s.value))}}function zh(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Hf(e,n,()=>t[n]):Wf(e,n,r.value))}}function we(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Sh(e){return we(e._zod.def)}function Ih(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function Ph(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=r[i];return o})}function Oh(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function te(e){return JSON.stringify(e)}function Xi(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Pr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ft(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Qi=Zt(()=>{if(W.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function be(e){if(ft(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(ft(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function vn(e){return be(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function Ah(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Eh=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}`)}},kn=new Set(["string","number","symbol"]),es=new Set(["string","number","bigint","boolean","symbol","undefined"]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function L(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function _(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Nh(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,i){return t??(t=e()),Reflect.set(t,r,o,i)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Or(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function ts(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var xn={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]},zn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Zh(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return lt(i,e,Ar(e,t)),L(e,we(n,{shape:i,checks:[]}))}function Ar(e,t){let n=Ce(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&r.push(o)}return r}function Th(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Ar(e,t)),s={};return lt(s,e,Reflect.ownKeys(Ce(e)).filter(a=>!i.has(a))),L(e,we(n,{shape:s,checks:[]}))}function Ch(e,t){if(!be(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=Ce(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 L(e,we(e._zod.def,{shape:Gf(e,t)}))}function Gf(e,t){let n={};return lt(n,e,Reflect.ownKeys(Ce(e))),zh(n,t),n}function Lh(e,t){if(!be(t))throw new Error("Invalid input to safeExtend: expected a plain object");return L(e,we(e._zod.def,{shape:Gf(e,t)}))}function Rh(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 n={};lt(n,e,Reflect.ownKeys(Ce(e))),lt(n,t,Reflect.ownKeys(Ce(t)));let r=we(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return L(e,r)}function Dh(e,t,n,r="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ar(t,n)):void 0,c={};return lt(c,t,Reflect.ownKeys(Ce(t)),e&&((u,l)=>a&&!a.has(l)?u:new e({type:"optional",innerType:u}))),L(t,we(t._zod.def,{shape:c,checks:[]}))}function jh(e,t,n){let r=n?new Set(Ar(t,n)):void 0,o={};return lt(o,t,Reflect.ownKeys(Ce(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),L(t,we(t._zod.def,{shape:o}))}function ne(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ns(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function se(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function At(e){return typeof e=="string"?e:e?.message}function Ct(e){let t=[];for(let n of e??[]){let r=n._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;o>=0&&t.push([o,n])}return t}function Sn(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function ae(e,t,n){var r;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:At(e.inst?._zod.def?.error?.(e))??At(i?.(e))??At(t?.error?.(e))??At(n.customError?.(e))??At(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e))c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__"||(a[c]=e[c]);return a.path??(a.path=[]),a.message=s,t?.reportInput&&(a.input=e.input),a}function In(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Mh=/[\uD800-\uDBFF]/;function pt(e){let t=e.length;if(!Mh.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320&&(n--,r++);return n}function Pn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function rs(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Lt(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Vh(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Yf(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Xf(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Fh(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Yf(t+n)}function Uh(e){return Xf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Bh(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function Jh(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var Gi=class{constructor(...t){}};function os(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):qh(e,n,r.value)}}function qe(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function On(e,t,n){return qe(e,t,n,!1)}function Kh(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return qe(this,n,r(this))},set(o){qe(this,n,o)}})}return t}function qh(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:qe(this,t,n.bind(this))},set(r){qe(this,t,r)}})}function Hh(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Hi,Ke=!1,Wh={configurable:!0,get(){Ke=!0}};function N(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Hi!==e._zod){Hi=void 0;return}Hi=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Wh);let o=Ke;Ke=!1;try{let i=n(this);return Ke?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),Ke=Ke||o,i}catch(i){throw delete this[t],Ke=Ke||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Gh(e,t,n,r){let o=Hh(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Er="~constantCatch";function is(e){let t=()=>e;return t[Er]=!0,t}var Qf,as=Object.freeze({status:"aborted"}),ss={value:void 0,enumerable:!1},ep="captureStackTrace"in Error?Error:null;function Yh(e){let t=ep;if(t){let n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return ep=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function p(e,t,n,r){let o={};function i(d){this.def=d,this.constr=f,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(d,m){if(d._zod){if(d._zod.traits.has(e))return}else{ss.value=new i(m);try{Object.defineProperty(d,"_zod",ss)}finally{ss.value=void 0}}if(d._zod.traits.add(e),t(d,m),a){let b=Object.getPrototypeOf(d),$=d._zod.constr.prototype,I=b;for(;I&&I!==$;)I=Object.getPrototypeOf(I);let x=I??b;a.has(x)||(a.add(x),os(x,s))}let g=f.prototype;for(let b in g)Object.prototype.hasOwnProperty.call(g,b)&&(b in d||(d[b]=g[b].bind(d)))}let u=r?.Parent??Object;class l extends u{}Object.defineProperty(l,"name",{value:e});function f(d){let m=r?.Parent?Yh(l):this;c(m,d);let g=m._zod.deferred;if(g){for(let $ of g)$();m._zod.deferred=void 0}let b=globalThis.__zod_globalConfig?.postProcessor;return b&&b(m),m}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:d=>r?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var cs=Symbol("zod_brand"),ce=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},He=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Qf=globalThis).__zod_globalConfig??(Qf.__zod_globalConfig={});var W=globalThis.__zod_globalConfig;function U(e){return e&&Object.assign(W,e),W}function Xh(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Nt,2)),e.message}function Qh(e){this._zod.message=e}var eg={get:Xh,set:Qh,enumerable:!0,configurable:!0},ls={value:void 0,enumerable:!1},tp=new WeakSet([Object.prototype,Error.prototype]),np=(e,t)=>{e.name="$ZodError",ls.value=t,Object.defineProperty(e,"issues",ls),ls.value=void 0,Object.defineProperty(e,"message",eg);let n=Object.getPrototypeOf(e);tp.has(n)||(tp.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}}))},fs=p("$ZodError",np),ue=p("$ZodError",np,void 0,{Parent:Error});function tg(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function An(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?tg(n,o.path[0],()=>[]).push(t(o)):r.push(t(o));return{formErrors:r,fieldErrors:n}}function En(e,t=n=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,u=0;for(;u<a.length;){let l=a[u],f=u===a.length-1;if(l==="_errors"){f&&c._errors.push(t(s)),u++;continue}Object.prototype.hasOwnProperty.call(c,l)||Object.defineProperty(c,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let d=c[l];f&&d._errors.push(t(s)),c=d,u++}}}};return r(e),n}function ps(e,t=n=>n.message){let n={errors:[]},r=(o,i=[])=>{var s;for(let a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0){n.errors.push(t(a));continue}let u=n,l=0;for(;l<c.length;){let f=c[l],d=l===c.length-1;typeof f=="string"?(u.properties??(u.properties={}),Object.prototype.hasOwnProperty.call(u.properties,f)||Object.defineProperty(u.properties,f,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),u=u.properties[f]):(u.items??(u.items=[]),(s=u.items)[f]??(s[f]={errors:[]}),u=u.items[f]),d&&u.errors.push(t(a)),l++}}};return r(e),n}function rp(e){let t=[],n=e.map(r=>typeof r=="object"?r.key:r);for(let r of n)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function ds(e){let t=[],n=[...e.issues].sort((r,o)=>(r.path??[]).length-(o.path??[]).length);for(let r of n)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${rp(r.path)}`);return t.join(`
2
+ `)}function Nr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Rt=e=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ce;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>ae(u,s,U())));throw Pr(c,i?.callee??t),c}return a.value};return t},Zr=Rt(ue),Dt=e=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let c=new(i?.Err??e)(a.issues.map(u=>ae(u,s,U())));throw Pr(c,i?.callee??t),c}return a.value};return t},Tr=Dt(ue),jt=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new ce;return i.issues.length?op(e,i.issues,o):{success:!0,data:i.value}},rg=jt(ue);function op(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(o=>ae(o,n,U()))),t=void 0,n=void 0),r},set error(o){r=o,t=void 0,n=void 0}}}var Mt=e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?op(e,i.issues,o):{success:!0,data:i.value}},og=Mt(ue),ig=Symbol.for("zod.compile.invalid"),sg=Symbol.for("zod.compile.fallback"),Nn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==ig)return!0;if(r.definite===!0&&n===void 0)return!1}return ag(e,t,n)});function ag(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o?(r[sg]=!0,i=o({value:t,issues:[]},r)):i=e._zod.run({value:t,issues:[]},r),i instanceof Promise)throw new ce;return i.issues.length===0}var Zn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);return o instanceof Promise&&(o=await o),o.issues.length===0},Cr=e=>{let t=Rt(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,Nr(n,s))};return n},cg=Cr(ue),Lr=e=>{let t=Rt(e),n=(r,o,i,s)=>t(r,o,i,Nr(n,s));return n},ug=Lr(ue),Rr=e=>{let t=Dt(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,Nr(n,s))};return n},lg=Rr(ue),Dr=e=>{let t=Dt(e),n=async(r,o,i,s)=>await t(r,o,i,Nr(n,s));return n},fg=Dr(ue),jr=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return jt(e)(t,n,o)},pg=jr(ue),Mr=e=>(t,n,r)=>jt(e)(t,n,r),dg=Mr(ue),Vr=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Mt(e)(t,n,o)},mg=Vr(ue),Fr=e=>async(t,n,r)=>Mt(e)(t,n,r),hg=Fr(ue);var $e={};Te($e,{anyString:()=>Ms,base64:()=>Es,base64url:()=>Ns,bigint:()=>Fs,boolean:()=>Us,browserEmail:()=>kg,cidrv4:()=>Os,cidrv6:()=>As,creditCard:()=>Ur,cuid:()=>hs,cuid2:()=>gs,currencyCode:()=>Ls,date:()=>Rs,datetime:()=>js,domain:()=>Ts,duration:()=>vs,e164:()=>Cs,email:()=>xs,emoji:()=>zs,extendedDuration:()=>gg,guid:()=>ks,hex:()=>Hs,hostname:()=>Zs,html5Email:()=>$g,httpProtocol:()=>Tn,iban:()=>Br,idnEmail:()=>vg,integer:()=>Cn,ipv4:()=>Ss,ipv6:()=>Is,ksuid:()=>_s,lowercase:()=>Ks,mac:()=>Ps,md5_base64:()=>Ig,md5_base64url:()=>Pg,md5_hex:()=>Sg,nanoid:()=>$s,nanoidOfLength:()=>ws,null:()=>Bs,number:()=>Re,rfc5322Email:()=>wg,sha1_base64:()=>Ag,sha1_base64url:()=>Eg,sha1_hex:()=>Og,sha256_base64:()=>Zg,sha256_base64url:()=>Tg,sha256_hex:()=>Ng,sha384_base64:()=>Lg,sha384_base64url:()=>Rg,sha384_hex:()=>Cg,sha512_base64:()=>jg,sha512_base64url:()=>Mg,sha512_hex:()=>Dg,string:()=>Vs,time:()=>Ds,ulid:()=>ys,undefined:()=>Js,unicodeEmail:()=>ip,uppercase:()=>qs,uuid:()=>dt,uuid4:()=>yg,uuid6:()=>bg,uuid7:()=>_g,xid:()=>bs});var hs=/^[cC][0-9a-z]{6,}$/,gs=/^[0-9a-z]+$/,ys=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,bs=/^[0-9a-vA-V]{20}$/,_s=/^[A-Za-z0-9]{27}$/,$s=/^[a-zA-Z0-9_-]{21}$/;function ws(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var vs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gg=/^[-+]?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)?)??$/,ks=/^([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})$/,dt=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)$/,yg=dt(4),bg=dt(6),_g=dt(7),xs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,$g=/^[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])?)*$/,wg=/^(([^<>()\[\]\\.,;:\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,}))$/,ip=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,vg=ip,kg=/^[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])?)*$/,xg="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function zs(){return new RegExp(xg,"u")}var Ss=/^(?:(?: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])$/,Is=/^(([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}|:))$/,Ps=e=>{let t=_e(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Os=/^((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])$/,As=/^(([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])$/,Es=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ns=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Zs=/^(?=.{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])?)*\.?$/,Ts=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Tn=/^https?$/,Cs=/^\+[1-9]\d{6,14}$/,Ur=/^\d(?:[ -]?\d){11,18}$/,Ls=/^(?: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)$/,Br=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,sp="(?:(?:\\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 zg(e){return new RegExp(`^${e}$`)}var Rs=zg(sp);function ms(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+)?)?`}function Ds(e){return new RegExp(`^${ms(e)}$`)}function js(e){let t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${ms({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${ms({precision:e.precision})}`:n;return new RegExp(`^${sp}T(?:${r})$`)}var Ms=/^[\s\S]{0,}$/,Vs=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Fs=/^-?\d+n?$/,Cn=/^-?\d+$/,Re=/^-?\d+(?:\.\d+)?$/,Us=/^(?:true|false)$/i,Bs=/^null$/i;var Js=/^undefined$/i;var Ks=/^[^A-Z]*$/,qs=/^[^a-z]*$/,Hs=/^[0-9a-fA-F]*$/;function Ln(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Rn(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Sg=/^[0-9a-fA-F]{32}$/,Ig=Ln(22,"=="),Pg=Rn(22),Og=/^[0-9a-fA-F]{40}$/,Ag=Ln(27,"="),Eg=Rn(27),Ng=/^[0-9a-fA-F]{64}$/,Zg=Ln(43,"="),Tg=Rn(43),Cg=/^[0-9a-fA-F]{96}$/,Lg=Ln(64,""),Rg=Rn(64),Dg=/^[0-9a-fA-F]{128}$/,jg=Ln(86,"=="),Mg=Rn(86);var M=p("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ws=e=>{let t=e.value;return!Ir(t)&&t.size!==void 0},Gs=e=>{let t=e.value;return!Ir(t)&&t.length!==void 0},Jr={number:"number",bigint:"bigint",object:"date"},qr=p("$ZodCheckLessThan",(e,t)=>{M.init(e,t);let n=Jr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Jr[typeof r.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hr=p("$ZodCheckGreaterThan",(e,t)=>{M.init(e,t);let n=Jr[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Jr[typeof r.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ys=p("$ZodCheckMultipleOf",(e,t)=>{M.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):wn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Xs=p("$ZodCheckNumberFormat",(e,t)=>{M.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=xn[t.format];e._zod.check=s=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>i&&s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),Qs=p("$ZodCheckBigIntFormat",(e,t)=>{M.init(e,t);let[n,r]=zn[t.format];e._zod.check=o=>{let i=o.value;i<n&&o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),i>r&&o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),ea=p("$ZodCheckMaxSize",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Ws),e._zod.check=r=>{let o=r.value;o.size<=t.maximum||r.issues.push({origin:In(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ta=p("$ZodCheckMinSize",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Ws),e._zod.check=r=>{let o=r.value;o.size>=t.minimum||r.issues.push({origin:In(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),na=p("$ZodCheckSizeEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Ws),e._zod.check=r=>{let o=r.value,i=o.size;if(i===t.size)return;let s=i>t.size;r.issues.push({origin:In(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),ra=p("$ZodCheckMaxLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>t.maximum?pt(o):i)<=t.maximum)return;let a=Pn(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),oa=p("$ZodCheckMinLength",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length;if((typeof o=="string"&&i>=t.minimum&&i<t.minimum*2?pt(o):i)>=t.minimum)return;let a=Pn(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ia=p("$ZodCheckLengthEquals",(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=Gs),e._zod.check=r=>{let o=r.value,i=o.length,s=typeof o=="string"&&i>=t.length&&i<=t.length*2?pt(o):i;if(s===t.length)return;let a=Pn(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Vt=p("$ZodCheckStringFormat",(e,t)=>{var n,r;M.init(e,t),t.pattern?(n=e._zod).check??(n.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})}):(r=e._zod).check??(r.check=()=>{})}),sa=p("$ZodCheckRegex",(e,t)=>{Vt.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),aa=p("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ks),Vt.init(e,t)}),ca=p("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=qs),Vt.init(e,t)}),ua=p("$ZodCheckIncludes",(e,t)=>{M.init(e,t);let n=_e(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=r,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})}}),la=p("$ZodCheckStartsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`^${_e(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),fa=p("$ZodCheckEndsWith",(e,t)=>{M.init(e,t);let n=new RegExp(`.*${_e(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Kr(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues))}var pa=p("$ZodCheckProperty",(e,t)=>{M.init(e,t),e._zod.check=n=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(o=>Kr(o,n,t.property));Kr(r,n,t.property)}}),da=p("$ZodCheckProperties",(e,t)=>{M.init(e,t),On(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=r=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map(s=>[s,t.shape[s]]));let o=r.value,i;for(let[s,a]of n){let c=a._zod.run({value:o[s],issues:[]},{});c instanceof Promise?(i??(i=[]),i.push(c.then(u=>Kr(u,r,s)))):Kr(c,r,s)}if(i)return Promise.all(i).then(()=>{})}}),ma=p("$ZodCheckMimeType",(e,t)=>{M.init(e,t);let n=new Set(t.mime);e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),ha=p("$ZodCheckOverwrite",(e,t)=>{M.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var mt=class{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}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 r=t.split(`
3
3
  `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(let s of i)this.content.push(s)}compile(){let t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
4
4
  ${n.join(`
5
5
  `)}
6
- };`)(...Object.values(this.closed))}};var ga={major:4,minor:6,patch:7};var O=p("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ga;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=te(a),f;for(let m of c){if(m._zod.def.when){if(ns(a)||!m._zod.def.when(a))continue}else if(l)continue;let d=a.issues.length,g=m._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new ce;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==d&&(Sn(a.issues,d,e),l||(l=te(a,d)))});else{if(a.issues.length===d)continue;Sn(a.issues,d,e),l||(l=te(a,d))}}return f?f.then(()=>a):a},s=(a,c,u)=>{if(te(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new ce;return l.then(f=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new ce;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return On(this,"~standard",Xr(this))},set"~standard"(e){qe(this,"~standard",e)}}),vp=(e,t)=>e.issues.length?{issues:e.issues.map(n=>ae(n,t,F()))}:{value:e.value};async function Lg(e,t){let n={async:!0};return vp(await e._zod.run({value:t,issues:[]},n),n)}function Xr(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return vp(r,n)}catch{}return Lg(e,t)},vendor:"zod",version:1}}var ht=p("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??Ms,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),R=p("$ZodStringFormat",(e,t)=>{Vt.init(e,t),ht.init(e,t)}),ba=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ks),R.init(e,t)}),_a=p("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=dt(r))}else t.pattern??(t.pattern=dt());R.init(e,t)}),$a=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xs),R.init(e,t)}),wa=1,Dn=2;function va(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Qr(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?va(e)||Dn:kp(e,t)}function kp(e,t){if(!t.normalize&&t.protocol?.source===Tn.source&&!/^https?:\/\//i.test(e))return wa;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??Dn}return new URL(e)}catch{return Dn}}var Rg=/[\t\n\r]/g;function jn(e){return e.replace(Rg,"")}function eo(e,t){return t.lastIndex=0,t.test(e.hostname)}function to(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ka=p("$ZodURL",(e,t)=>{R.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=Qr(r,t);if(o===wa){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Dn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=jn(r);return}t.hostname&&!eo(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!to(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:jn(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),xa=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zs()),R.init(e,t)}),za=p("$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?$s:ws(t.length)),R.init(e,t)}),Sa=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hs),R.init(e,t)}),Ia=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gs),R.init(e,t)}),Pa=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ys),R.init(e,t)}),Oa=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bs),R.init(e,t)}),Aa=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=_s),R.init(e,t)}),Ea=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=js(t)),R.init(e,t)}),Za=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rs),R.init(e,t)}),Na=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ds(t)),R.init(e,t)}),Ta=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vs),R.init(e,t)}),Ca=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ss),R.init(e,t)}),Dg=/^[0-9a-fA-F:.]+$/;function Mn(e){return Dg.test(e)?va(`http://[${e}]`):!1}var La=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Is),R.init(e,t),e._zod.check=n=>{Mn(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Ra=p("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Ps(t.delimiter)),R.init(e,t)}),Da=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Os),R.init(e,t)});function no(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:Mn(n)}var ja=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=As),R.init(e,t),e._zod.check=n=>{no(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Vn(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var ro=/^[0-9a-zA-Z+/]*={0,2}$/,Ma=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=ro),R.init(e,t),e._zod.check=n=>{Vn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Fn=/^[A-Za-z0-9_-]*$/;function oo(e){if(!Fn.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Vn(n)}var Va=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fn),R.init(e,t),e._zod.check=n=>{oo(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Fa=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cs),R.init(e,t)}),jg=/[- ]/g;function Mg(e){let t=e.length,n=1,r=0;for(;t;){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function io(e){return Fr.test(e)?Mg(e.replace(jg,"")):!1}var Ua=p("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Fr),R.init(e,t),e._zod.check=n=>{io(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function Vg(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function so(e){return Ur.test(e)?Vg(e):!1}var Ba=p("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Ur),R.init(e,t),e._zod.check=n=>{so(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function ao(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Ja=p("$ZodJWT",(e,t)=>{R.init(e,t),e._zod.check=n=>{ao(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ka=p("$ZodCustomStringFormat",(e,t)=>{R.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),co=p("$ZodNumber",(e,t)=>{O.init(e,t),e._zod.pattern=Le,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),qa=p("$ZodNumberFormat",(e,t)=>{Xs.init(e,t),co.init(e,t)}),Un=p("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=Us,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),uo=p("$ZodBigInt",(e,t)=>{O.init(e,t),e._zod.pattern=Fs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Wa=p("$ZodBigIntFormat",(e,t)=>{Qs.init(e,t),uo.init(e,t)}),Ha=p("$ZodSymbol",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Ga=p("$ZodUndefined",(e,t)=>{O.init(e,t),e._zod.pattern=Js,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Ya=p("$ZodNull",(e,t)=>{O.init(e,t),e._zod.pattern=Bs,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Xa=p("$ZodAny",(e,t)=>{O.init(e,t),e._zod.parse=n=>n}),Qa=p("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=n=>n}),ec=p("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),tc=p("$ZodVoid",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),nc=p("$ZodDate",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function rc(e,t){let n=Ct(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of Ct(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Sn(i.issues,l,e),i}}return o(i,s)}}var Fg=e=>Array.isArray(e)?e.length:-1,Ug=e=>e instanceof Map?e.size:-1,Bg=e=>e instanceof Set?e.size:-1;function ap(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues)),t.value[n]=e.value}var oc=p("$ZodArray",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>ap(f,r,c)));else if(ap(l,r,c),a&&l.issues.length!==0&&te(l))break}return s.length?Promise.all(s).then(()=>r):r},rc(e,Fg)});function Yr(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...se(n,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}var Jg=[];function xp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Jg,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=ts(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function zp(e,t,n,r,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,m=u.optout,d=0;for(let g in t){if(s&&n.issues.length!==d){if(te(n,d))break;d=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){l==="never"&&a.push(g);continue}if(l==="never"){a.push(g);continue}let b=u.run({value:t[g],issues:[]},r);b instanceof Promise?e.push(b.then($=>Yr($,n,g,t,f,m))):Yr(b,n,g,t,f,m)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Sp=p("$ZodObject",(e,t)=>{O.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let u=()=>{let l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}let o=Nt(()=>xp(t));Z(e,"propValues",u=>{let l=u.def.shape,f={};for(let m in l){let d=l[m]._zod;if(d.values){Object.prototype.hasOwnProperty.call(f,m)||G(f,m,new Set);for(let g of d.values)f[m].add(g);d.optin!==void 0&&f[m].add(void 0)}}return f});let i=ft,s=t.catchall,a,c=W.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let m=[],d=a.shape,g=l?.abortEarly,b=u.issues.length;for(let $ of a.allKeys){if(g&&u.issues.length!==b){if(te(u,b))break;b=u.issues.length}if($==="__proto__")continue;let S=d[$],x=S._zod.optin,A=S._zod.optout,C=S._zod.run({value:f[$],issues:[]},l);C instanceof Promise?m.push(C.then(V=>Yr(V,u,$,f,x,A))):Yr(C,u,$,f,x,A)}return s?zp(m,f,u,l,o.value,e,g===!0):m.length?Promise.all(m).then(()=>u):u}}),ic=p("$ZodObjectJIT",(e,t)=>{Sp.init(e,t);let n=e._zod.parse,r=Nt(()=>xp(t)),o=W.memoizer,i=d=>{let g=r.value,b=g.symbolKeys,$=new mt(["payload","ctx"],{shape:d,inst:e,memo:o,syms:b}),S=V=>`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`,x=(V,T)=>`
6
+ };`)(...Object.values(this.closed))}};var ga={major:4,minor:6,patch:7};var O=p("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ga;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,u)=>{if(a.memo)return a;let l=ne(a),f;for(let d of c){if(d._zod.def.when){if(ns(a)||!d._zod.def.when(a))continue}else if(l)continue;let m=a.issues.length,g=d._zod.check(a);if(g instanceof Promise&&u?.async===!1)throw new ce;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,a.issues.length!==m&&(Sn(a.issues,m,e),l||(l=ne(a,m)))});else{if(a.issues.length===m)continue;Sn(a.issues,m,e),l||(l=ne(a,m))}}return f?f.then(()=>a):a},s=(a,c,u)=>{if(ne(a))return a.aborted=!0,a;let l=i(c,o,u);if(l instanceof Promise){if(u.async===!1)throw new ce;return l.then(f=>e._zod.parse(f,u))}return e._zod.parse(l,u)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let l=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});return l instanceof Promise?l.then(f=>s(f,a,c)):s(l,a,c)}let u=e._zod.parse(a,c);if(u instanceof Promise){if(c.async===!1)throw new ce;return u.then(l=>i(l,o,c))}return i(u,o,c)}}},{get"~standard"(){return On(this,"~standard",Qr(this))},set"~standard"(e){qe(this,"~standard",e)}}),kp=(e,t)=>e.issues.length?{issues:e.issues.map(n=>ae(n,t,U()))}:{value:e.value};async function Vg(e,t){let n={async:!0};return kp(await e._zod.run({value:t,issues:[]},n),n)}function Qr(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return kp(r,n)}catch{}return Vg(e,t)},vendor:"zod",version:1}}var ht=p("$ZodString",(e,t)=>{O.init(e,t),e._zod.pattern=t.pattern??Ms,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),R=p("$ZodStringFormat",(e,t)=>{Vt.init(e,t),ht.init(e,t)}),ba=p("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ks),R.init(e,t)}),_a=p("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=dt(r))}else t.pattern??(t.pattern=dt());R.init(e,t)}),$a=p("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xs),R.init(e,t)}),wa=1,Dn=2;function va(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function eo(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?va(e)||Dn:xp(e,t)}function xp(e,t){if(!t.normalize&&t.protocol?.source===Tn.source&&!/^https?:\/\//i.test(e))return wa;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse=="function")return n.parse(e)??Dn}return new URL(e)}catch{return Dn}}var Fg=/[\t\n\r]/g;function jn(e){return e.replace(Fg,"")}function to(e,t){return t.lastIndex=0,t.test(e.hostname)}function no(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var ka=p("$ZodURL",(e,t)=>{R.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),o=eo(r,t);if(o===wa){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Dn){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=jn(r);return}t.hostname&&!to(o,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!no(o,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?o.href:jn(r);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),xa=p("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=zs()),R.init(e,t)}),za=p("$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?$s:ws(t.length)),R.init(e,t)}),Sa=p("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=hs),R.init(e,t)}),Ia=p("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=gs),R.init(e,t)}),Pa=p("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ys),R.init(e,t)}),Oa=p("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bs),R.init(e,t)}),Aa=p("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=_s),R.init(e,t)}),Ea=p("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=js(t)),R.init(e,t)}),Na=p("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Rs),R.init(e,t)}),Za=p("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Ds(t)),R.init(e,t)}),Ta=p("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=vs),R.init(e,t)}),Ca=p("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ss),R.init(e,t)}),Ug=/^[0-9a-fA-F:.]+$/;function Mn(e){return Ug.test(e)?va(`http://[${e}]`):!1}var La=p("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Is),R.init(e,t),e._zod.check=n=>{Mn(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),Ra=p("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Ps(t.delimiter)),R.init(e,t)}),Da=p("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Os),R.init(e,t)});function ro(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);return`${o}`!==r||o<0||o>128?!1:Mn(n)}var ja=p("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=As),R.init(e,t),e._zod.check=n=>{ro(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Vn(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var oo=/^[0-9a-zA-Z+/]*={0,2}$/,Ma=p("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=oo),R.init(e,t),e._zod.check=n=>{Vn(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),Fn=/^[A-Za-z0-9_-]*$/;function io(e){if(!Fn.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Vn(n)}var Va=p("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Fn),R.init(e,t),e._zod.check=n=>{io(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Fa=p("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Cs),R.init(e,t)}),Bg=/[- ]/g;function Jg(e){let t=e.length,n=1,r=0;for(;t;){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function so(e){return Ur.test(e)?Jg(e.replace(Bg,"")):!1}var Ua=p("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Ur),R.init(e,t),e._zod.check=n=>{so(n.value)||n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function Kg(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function ao(e){return Br.test(e)?Kg(e):!1}var Ba=p("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Br),R.init(e,t),e._zod.check=n=>{ao(n.value)||n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function co(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var Ja=p("$ZodJWT",(e,t)=>{R.init(e,t),e._zod.check=n=>{co(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Ka=p("$ZodCustomStringFormat",(e,t)=>{R.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),uo=p("$ZodNumber",(e,t)=>{O.init(e,t),e._zod.pattern=Re,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),qa=p("$ZodNumberFormat",(e,t)=>{Xs.init(e,t),uo.init(e,t)}),Un=p("$ZodBoolean",(e,t)=>{O.init(e,t),e._zod.pattern=Us,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),lo=p("$ZodBigInt",(e,t)=>{O.init(e,t),e._zod.pattern=Fs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Ha=p("$ZodBigIntFormat",(e,t)=>{Qs.init(e,t),lo.init(e,t)}),Wa=p("$ZodSymbol",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o=="symbol"||n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Ga=p("$ZodUndefined",(e,t)=>{O.init(e,t),e._zod.pattern=Js,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Ya=p("$ZodNull",(e,t)=>{O.init(e,t),e._zod.pattern=Bs,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),Xa=p("$ZodAny",(e,t)=>{O.init(e,t),e._zod.parse=n=>n}),Qa=p("$ZodUnknown",(e,t)=>{O.init(e,t),e._zod.parse=n=>n}),ec=p("$ZodNever",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),tc=p("$ZodVoid",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return typeof o>"u"||n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),nc=p("$ZodDate",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let o=n.value,i=o instanceof Date;return i&&!Number.isNaN(o.getTime())||n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function rc(e,t){let n=Ct(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,u]of Ct(e._zod.def.checks))if(a>c&&u._zod.def.when(i)){let l=i.issues.length;return u._zod.check(i),i.issues[l].continue=!1,Sn(i.issues,l,e),i}}return o(i,s)}}var qg=e=>Array.isArray(e)?e.length:-1,Hg=e=>e instanceof Map?e.size:-1,Wg=e=>e instanceof Set?e.size:-1;function cp(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues)),t.value[n]=e.value}var oc=p("$ZodArray",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let u=i[c],l=t.element._zod.run({value:u,issues:[]},o);if(l instanceof Promise)s.push(l.then(f=>cp(f,r,c)));else if(cp(l,r,c),a&&l.issues.length!==0&&ne(l))break}return s.length?Promise.all(s).then(()=>r):r},rc(e,qg)});function Xr(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!(!s&&a&&o==="optional")){if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...se(n,e.issues))}if(!s&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(s||o==="defaulted"&&!a)&&(t.value[n]=void 0):t.value[n]=e.value}}var Gg=[];function zp(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Gg,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=ts(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Sp(e,t,n,r,o,i,s){let a=[],c=o.keySet,u=o.catchall._zod,l=u.def.type,f=u.optin,d=u.optout,m=0;for(let g in t){if(s&&n.issues.length!==m){if(ne(n,m))break;m=n.issues.length}if(c.has(g))continue;if(g==="__proto__"){l==="never"&&a.push(g);continue}if(l==="never"){a.push(g);continue}let b=u.run({value:t[g],issues:[]},r);b instanceof Promise?e.push(b.then($=>Xr($,n,g,t,f,d))):Xr(b,n,g,t,f,d)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Ip=p("$ZodObject",(e,t)=>{O.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let u=()=>{let l={...r};return Object.defineProperty(t,"shape",{value:l}),u.raw=l,l};u.raw=r,Object.defineProperty(t,"shape",{get:u})}let o=Zt(()=>zp(t));N(e,"propValues",u=>{let l=u.def.shape,f={};for(let d in l){let m=l[d]._zod;if(m.values){Object.prototype.hasOwnProperty.call(f,d)||G(f,d,new Set);for(let g of m.values)f[d].add(g);m.optin!==void 0&&f[d].add(void 0)}}return f});let i=ft,s=t.catchall,a,c=W.memoizer;c?.attach(e),e._zod.parse=(u,l)=>{a??(a=o.value);let f=u.value;if(!i(f))return u.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),u;u.value=c?c.alloc(e,u,{},l):{};let d=[],m=a.shape,g=l?.abortEarly,b=u.issues.length;for(let $ of a.allKeys){if(g&&u.issues.length!==b){if(ne(u,b))break;b=u.issues.length}if($==="__proto__")continue;let I=m[$],x=I._zod.optin,A=I._zod.optout,C=I._zod.run({value:f[$],issues:[]},l);C instanceof Promise?d.push(C.then(V=>Xr(V,u,$,f,x,A))):Xr(C,u,$,f,x,A)}return s?Sp(d,f,u,l,o.value,e,g===!0):d.length?Promise.all(d).then(()=>u):u}}),ic=p("$ZodObjectJIT",(e,t)=>{Ip.init(e,t);let n=e._zod.parse,r=Zt(()=>zp(t)),o=W.memoizer,i=m=>{let g=r.value,b=g.symbolKeys,$=new mt(["payload","ctx"],{shape:m,inst:e,memo:o,syms:b}),I=V=>`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`,x=(V,T)=>`
7
7
  let ${V}_ab = false;
8
8
  for (let i = 0; i < ${V}.issues.length; i++) {
9
9
  const iss = ${V}.issues[i];
@@ -14,18 +14,18 @@ ${n.join(`
14
14
  if (${V}_ab && ctx && ctx.abortEarly) {
15
15
  payload.value = newResult;
16
16
  return payload;
17
- }`;$.write("const input = payload.value;");let A=Object.create(null),C=0;for(let V of g.allKeys)A[V]=`key_${C++}`;$.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let V of g.allKeys){if(V==="__proto__")continue;let T=A[V],X=typeof V=="symbol"?`syms[${b.indexOf(V)}]`:ee(V),_n=`${X} in input`,Uf=d[V],qi=Uf?._zod?.optin,Bf=qi!==void 0,fh=Uf?._zod?.optout==="optional";if($.write(`const ${T} = ${S(X)};`),Bf&&fh){let ph=qi==="optional"?`${T}_present`:`${T}.value !== undefined || ${T}_present`;$.write(`
17
+ }`;$.write("const input = payload.value;");let A=Object.create(null),C=0;for(let V of g.allKeys)A[V]=`key_${C++}`;$.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let V of g.allKeys){if(V==="__proto__")continue;let T=A[V],X=typeof V=="symbol"?`syms[${b.indexOf(V)}]`:te(V),_n=`${X} in input`,Bf=m[V],qi=Bf?._zod?.optin,Jf=qi!==void 0,gh=Bf?._zod?.optout==="optional";if($.write(`const ${T} = ${I(X)};`),Jf&&gh){let yh=qi==="optional"?`${T}_present`:`${T}.value !== undefined || ${T}_present`;$.write(`
18
18
  const ${T}_present = ${_n};
19
19
  if (!${T}.issues.length || ${T}_present) {
20
20
  if (${T}.issues.length) {${x(T,X)}
21
21
  }
22
22
 
23
- if (${ph}) {
23
+ if (${yh}) {
24
24
  newResult[${X}] = ${T}.value;
25
25
  }
26
26
  }
27
27
 
28
- `)}else Bf?($.write(`
28
+ `)}else Jf?($.write(`
29
29
  if (${T}.issues.length) {${x(T,X)}
30
30
  }
31
31
  `),qi==="defaulted"?$.write(`newResult[${X}] = ${T}.value;`):$.write(`
@@ -53,13 +53,13 @@ ${n.join(`
53
53
  newResult[${X}] = ${T}.value;
54
54
  }
55
55
 
56
- `)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},s,a=ft,c=!W.jitless,l=c&&Qi.value,f=t.catchall,m;e._zod.parse=(d,g)=>{m??(m=r.value);let b=d.value;return a(b)?c&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),d=s(d,g),f?zp([],b,d,g,m,e,g?.abortEarly===!0):d):n(d,g):(d.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),d)}});function cp(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!te(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ae(s,r,F())))}),t)}var Bn=p("$ZodUnion",(e,t)=>{O.init(e,t),Z(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),Z(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Z(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),Z(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Ce(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>cp(a,r,e,o)):cp(s,r,e,o)}});function up(e,t,n,r){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:n,errors:e.map(i=>i.issues.map(s=>ae(s,r,F())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}var sc=p("$ZodXor",(e,t)=>{Bn.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>up(a,r,e,o)):up(s,r,e,o)}});function ac(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=Ip(n.def),n.bag.optionsMap=r);let o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Ip(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var cc=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Bn.init(e,t);let n=e._zod.parse;Z(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||G(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=Tt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let r=Nt(()=>Ip(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ft(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=r.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(u=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),uc=p("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>lp(n,c,u)):lp(n,i,s)}});function Ft(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(ye(e)&&ye(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=Ft(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=Ft(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function lp(e,t,n){let r=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let m=String(u.path[0]);i.has(m)||i.set(m,u),f=[m]}else return!1;for(let m of f)r.has(m)||r.set(m,{}),r.get(m)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of n.issues)s(u,"r")||e.issues.push(u);let a=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=Ft(t.value,n.value);if(!c.valid){if(te(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var lo=p("$ZodTuple",(e,t)=>{O.init(e,t);let n=t.items,r=W.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=fp(n,"optin"),u=fp(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(n.length),f=t.rest?i?.abortEarly:void 0,m=!1;for(let d=0;d<n.length;d++){let g=n[d]._zod.run({value:s[d],issues:[]},i);g instanceof Promise?a.push(g.then(b=>{l[d]=b})):(l[d]=g,f&&!m&&g.issues.length&&(m=te(g)))}if(t.rest&&!m){let d=n.length-1,g=s.slice(n.length),b=o.issues.length;for(let $ of g){if(f&&o.issues.length!==b){if(te(o,b))break;b=o.issues.length}d++;let S=t.rest._zod.run({value:$,issues:[]},i);S instanceof Promise?a.push(S.then(x=>pp(x,o,d))):pp(S,o,d)}}return a.length?Promise.all(a).then(()=>dp(l,o,n,s,u)):dp(l,o,n,s,u)}});function fp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function pp(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues)),t.value[n]=e.value}function dp(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...se(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var lc=p("$ZodRecord",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!ye(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>ae(g,o,F())),input:l,path:[l],inst:e});continue}let m=f.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[l],issues:[]},o);d instanceof Promise?s.push(d.then(g=>{g.issues.length&&r.issues.push(...se(l,g.issues)),r.value[m]=g.value})):(d.issues.length&&r.issues.push(...se(l,d.issues)),r.value[m]=d.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Le.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?r.value[u]=i[u]:a?(c=c??[],c.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>ae(g,o,F())),input:u,path:[u],inst:e});continue}let m=l.value;if(m==="__proto__")continue;let d=t.valueType._zod.run({value:i[u],issues:[]},o);d instanceof Promise?s.push(d.then(g=>{g.issues.length&&r.issues.push(...se(u,g.issues)),r.value[m]=g.value})):(d.issues.length&&r.issues.push(...se(u,d.issues)),r.value[m]=d.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}}),fc=p("$ZodMap",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[u,l]of i){if(a&&r.issues.length!==c){if(te(r,c))break;c=r.issues.length}let f=t.keyType._zod.run({value:u,issues:[]},o),m=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise||m instanceof Promise?s.push(Promise.all([f,m]).then(([d,g])=>{mp(d,g,r,u,i,e,o)})):mp(f,m,r,u,i,e,o)}return s.length?Promise.all(s).then(()=>r):r},rc(e,Ug)});function mp(e,t,n,r,o,i,s){e.issues.length&&(kn.has(typeof r)?n.issues.push(...se(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>ae(a,s,F()))})),t.issues.length&&(kn.has(typeof r)?n.issues.push(...se(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>ae(a,s,F()))})),n.value.set(e.value,t.value)}var pc=p("$ZodSet",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let u of i){if(a&&r.issues.length!==c){if(te(r,c))break;c=r.issues.length}let l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?s.push(l.then(f=>hp(f,r))):hp(l,r)}return s.length?Promise.all(s).then(()=>r):r},rc(e,Bg)});function hp(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var dc=p("$ZodEnum",(e,t)=>{O.init(e,t);let n=Et(t.entries),r=new Set(n);e._zod.values=r,Z(e,"pattern",o=>{let i=Et(o.def.entries).filter(s=>kn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>be(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),mc=p("$ZodLiteral",(e,t)=>{O.init(e,t);let n=new Set(t.values);e._zod.values=n,Z(e,"pattern",r=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?be(i):i?be(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),hc=p("$ZodFile",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),gc=p("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.optin="optional",W.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new We(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new ce;return n.value=o,n}});function gp(e,t){return e.value=t.issues.length?void 0:t.value,e}var fo=p("$ZodOptional",(e,t)=>{O.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Z(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),Z(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ce(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>gp(n,i)):gp(n,o)}return t.innerType._zod.run(n,r)}}),yc=p("$ZodExactOptional",(e,t)=>{fo.init(e,t),Z(e,"values",n=>n.def.innerType._zod.values),Z(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),bc=p("$ZodNullable",(e,t)=>{O.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin),Z(e,"optout",n=>n.def.innerType._zod.optout),Z(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Ce(r.source)}|null)$`):void 0}),Z(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),_c=p("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>yp(i,t)):yp(o,t)}});function yp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var $c=p("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),wc=p("$ZodNonOptional",(e,t)=>{O.init(e,t),Z(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>bp(i,e)):bp(o,e)}});function bp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var vc=p("$ZodSuccess",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new We("ZodSuccess");let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}});function _p(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>ae(o,r,F()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var kc=p("$ZodCatch",(e,t)=>{O.init(e,t),Z(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Z(e,"optout",n=>n.def.innerType._zod.optout),Z(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>_p(n,i,t,r)):_p(n,o,t,r)}}),xc=p("$ZodNaN",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),po=p("$ZodPipe",(e,t)=>{O.init(e,t),Z(e,"values",n=>n.def.in._zod.values),Z(e,"optin",n=>n.def.in._zod.optin),Z(e,"optout",n=>n.def.out._zod.optout),Z(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Wr(s,t.in,r)):Wr(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Wr(i,t.out,r)):Wr(o,t.out,r)}});function Wr(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Jn=p("$ZodCodec",(e,t)=>{O.init(e,t),Z(e,"values",n=>n.def.in._zod.values),Z(e,"optin",n=>n.def.in._zod.optin),Z(e,"optout",n=>n.def.out._zod.optout),Z(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Hr(s,t,r)):Hr(i,t,r)}else{let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Hr(s,t,r)):Hr(i,t,r)}}});function Hr(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Gr(e,i,t.out,n)):Gr(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Gr(e,i,t.in,n)):Gr(e,o,t.in,n)}}function Gr(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var zc=p("$ZodPreprocess",(e,t)=>{po.init(e,t)}),Sc=p("$ZodReadonly",(e,t)=>{O.init(e,t),Z(e,"propValues",n=>n.def.innerType._zod.propValues),Z(e,"values",n=>n.def.innerType._zod.values),Z(e,"optin",n=>n.def.innerType?._zod?.optin),Z(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then($p):$p(o)}});function $p(e){return e.memo||(e.value=Object.freeze(e.value)),e}function Kg(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(n=c.pattern),r||(r=!!c.format?.includes("int"));let u=c.minimum??c.length,l=c.maximum??c.length;u!==void 0&&(o===void 0||u>o)&&(o=u),l!==void 0&&(i===void 0||l<i)&&(i=l)}if(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Vs({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Le?Cn:s)?.source}function ya(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ya(r);return n&&o&&i&&i!==o?n.replace(Ce(o),()=>Ce(i)):n}if(t.options){let o=t.options.map(ya);if(o.every(Boolean))return`^(${o.map(i=>Ce(i)).join("|")})$`}return Kg(e)}var Ic=p("$ZodTemplateLiteral",(e,t)=>{O.init(e,t);let n=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){let o=ya(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Ce(o))}else if(r===null||es.has(typeof r))n.push(be(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Pc=p("$ZodFunction",(e,t)=>(O.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Zr(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Zr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Nr(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await Nr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new lo({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),Oc=p("$ZodPromise",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),Kn=p("$ZodLazy",(e,t)=>{O.init(e,t),Yi(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),Z(e,"pattern",n=>n.innerType?._zod?.pattern),Z(e,"propValues",n=>n.innerType?._zod?.propValues),Z(e,"optin",n=>n.innerType?._zod?.optin??void 0),Z(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Ac=p("$ZodCustom",(e,t)=>{M.init(e,t),O.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>wp(i,n,r,e));wp(o,n,r,e)}});function wp(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Lt(o))}}var yo=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Zc="~memo",Op=[];function Ap(e){return e!==null&&typeof e=="object"}function Ec(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Ep=new WeakMap,Ut=0,go=1,qn=2;function Wn(e,t,n){let r=Ep.get(e);if(r!==void 0)return r?qn:Ut;if(t.has(e))return qn;t.add(e);let o=Ut,i=l=>{if(o!==qn&&l?._zod){let f=Wn(l,t,n);f>o&&(o=f)}},s=(l,f)=>{let m=Ut;for(let d of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,d);if(f&&!g.enumerable)continue;let b=g.get?go:g.value?._zod?Wn(g.value,t,n):Ut;b>m&&(m=b)}return m},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Tt(c);a(l?s(l,!0):go),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?Wn(l,t,!1):go);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let m=f.value;if(!(!m||typeof m!="object")){if(m._zod)i(m);else if(Array.isArray(m))for(let d of m)i(d)}}}return t.delete(e),qg(e,o)}function qg(e,t){return t!==go&&Ep.set(e,t===qn),t}function bo(e){return Wn(e,new Set,!0)!==Ut}function Wg(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var mo,ho=[],Hg={alloc(e,t,n){let r=mo;if(!r)return n;mo=void 0;let o={value:n,issues:null};return r.set(t.value,o),ho.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&_o(i,o.value))throw new yo;return n(o,i)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(n===void 0){let S=Wn(e,new Set,!1);if(S===Ut)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);S===qn||r?n=!0:r=!0}let l=c.value;if(!Ap(l))return s(c,u);let f=u[Zc];f||(f={buckets:new WeakMap,backEdges:void 0},u[Zc]=f);let m;o===u?m=i:(m=Wg(f,e),o=u,i=m);let d=m.get(l);if(d)return c.value=d.value,d.issues?d.issues.length&&c.issues.push(...Ec(d.issues)):(c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value)),c;mo=m;let g=ho.length,b=s(c,u);mo=void 0;let $=ho.length>g?ho.pop():void 0;return b instanceof Promise?b.then(S=>($&&($.issues=S.issues.length?Ec(S.issues):Op),S)):($&&($.issues=b.issues.length?Ec(b.issues):Op),b)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function Hn(){return Hg}function _o(e,t){let n=e[Zc]?.backEdges;return n!==void 0&&Ap(t)&&n.has(t)}var Gn={};Ne(Gn,{en:()=>$o});var Gg=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let n={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"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=rs(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Pr(i.values[0])}`:`Invalid option: expected one of ${zr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${zr(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(a=>`'${a}'`).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"}}};function $o(){return{localeError:Gg()}}var Zp,Nc=Symbol("ZodOutput"),Tc=Symbol("ZodInput"),wo=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...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 vo(){return new wo}(Zp=globalThis).__zod_globalRegistry??(Zp.__zod_globalRegistry=vo());var Y=globalThis.__zod_globalRegistry;var ne=Symbol.for("zod.compile.invalid"),Np=Symbol.for("zod.compile.fallback"),ve=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},N=class extends Error{constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}};function Xg(e,t){try{return xo(e,{assertOnly:!0})}catch{return t}}function Dc(e,t){try{let n=xo(e),r=ko(e,n);return r._zod.bag.validator=Xg(e,n),r}catch(n){if(t?.strict)throw n;return e}}function ko(e,t){if(bo(e))throw new N("a schema whose subtree contains a reference cycle");let n=L(e),r=e._zod.run,o=r.__originalRun??r,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Np]||a&&_o(a,s.value))return o(s,a);let c=t(s.value);return c!==ne?(s.value=c,s):(a&&(a[Np]=!0),o(s,a))};return i.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=i,r.__originalRun||Qg(n,e,t),n}function Qg(e,t,n){let r=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;r.safeParse=(s,a)=>{let c=n(s);return c!==ne?{success:!0,data:c}:i(s,a)}}if(typeof o.parse=="function"){let i=o.parse;r.parse=(s,a)=>{let c=n(s);return c!==ne?c:i(s,a)}}}function xo(e,t){let n=!0;try{n=bo(e)}catch{}if(n)throw new N("a schema whose subtree contains a reference cycle");let r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new mt(["input"]),i=U(o,r,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let s=["INVALID",...r.constants.keys()],a=[ne,...r.constants.values()],c=o.content.join(`
56
+ `)}return $.write("payload.value = newResult;"),$.write("return payload;"),$.compile()},s,a=ft,c=!W.jitless,l=c&&Qi.value,f=t.catchall,d;e._zod.parse=(m,g)=>{d??(d=r.value);let b=m.value;return a(b)?c&&l&&g?.async===!1&&g.jitless!==!0?(s||(s=i(t.shape)),m=s(m,g),f?Sp([],b,m,g,d,e,g?.abortEarly===!0):m):n(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:b,inst:e}),m)}});function up(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!ne(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(s=>ae(s,r,U())))}),t)}var Bn=p("$ZodUnion",(e,t)=>{O.init(e,t),N(e,"optin",r=>r.def.options.some(o=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some(o=>o._zod.optin!==void 0)?"optional":void 0),N(e,"optout",r=>r.def.options.some(o=>o._zod.optout==="optional")?"optional":void 0),N(e,"values",r=>{if(r.def.options.every(o=>o._zod.values))return new Set(r.def.options.flatMap(o=>Array.from(o._zod.values)))}),N(e,"pattern",r=>{if(r.def.options.every(o=>o._zod.pattern)){let o=r.def.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>Le(i.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}return i?Promise.all(s).then(a=>up(a,r,e,o)):up(s,r,e,o)}});function lp(e,t,n,r){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:n,errors:e.map(i=>i.issues.map(s=>ae(s,r,U())))}):t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o}),t)}var sc=p("$ZodXor",(e,t)=>{Bn.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);c instanceof Promise?(s.push(c),i=!0):s.push(c)}return i?Promise.all(s).then(a=>lp(a,r,e,o)):lp(s,r,e,o)}});function ac(e,t){let n=e._zod,r=n.bag.optionsMap;r||(r=Pp(n.def),n.bag.optionsMap=r);let o=r.get(t);if(o===null)throw new Error(`Ambiguous discriminator value "${String(t)}"`);return o}function Pp(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw new Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var cc=p("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Bn.init(e,t);let n=e._zod.parse;N(e,"propValues",o=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw new Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);c[o.def.discriminator]?.has(void 0)&&s++;for(let[u,l]of Object.entries(c)){Object.prototype.hasOwnProperty.call(i,u)||G(i,u,new Set);for(let f of l)i[u].add(f)}}return!o.def.unionFallback&&s>1&&i[o.def.discriminator]?.delete(void 0),i}),t.options.forEach((o,i)=>{let s=Tt(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw new Error(`Invalid discriminated union option at index "${i}"`)});let r=Zt(()=>Pp(t));e._zod.parse=(o,i)=>{let s=o.value;if(!ft(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=r.value.get(a);return c&&(a!==void 0||i.direction!=="backward")?c._zod.run(o,i):t.unionFallback||i.direction==="backward"?n(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(u=>r.value.get(u)!==null),input:s,path:[t.discriminator],inst:e}),o)}}),uc=p("$ZodIntersection",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([c,u])=>fp(n,c,u)):fp(n,i,s)}});function Ft(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(be(e)&&be(t)){let n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};Object.prototype.hasOwnProperty.call(o,"__proto__")&&delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=Ft(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t[r],s=Ft(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function fp(e,t,n){let r=new Map,o,i=new Map,s=(u,l)=>{let f;if(u.code==="unrecognized_keys"&&!u.path?.length)o??(o=u),f=u.keys;else if(u.code==="invalid_key"&&u.origin==="record"&&u.path?.length===1){let d=String(u.path[0]);i.has(d)||i.set(d,u),f=[d]}else return!1;for(let d of f)r.has(d)||r.set(d,{}),r.get(d)[l]=!0;return!0};for(let u of t.issues)s(u,"l")||e.issues.push(u);for(let u of n.issues)s(u,"r")||e.issues.push(u);let a=[...r].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length){let u=o?a.filter(l=>o.keys.includes(l)):[];u.length&&e.issues.push({...o,keys:u});for(let l of a)!u.includes(l)&&i.has(l)&&e.issues.push(i.get(l))}let c=Ft(t.value,n.value);if(!c.valid){if(ne(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var fo=p("$ZodTuple",(e,t)=>{O.init(e,t);let n=t.items,r=W.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=pp(n,"optin"),u=pp(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;s.length>n.length&&o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let l=new Array(n.length),f=t.rest?i?.abortEarly:void 0,d=!1;for(let m=0;m<n.length;m++){let g=n[m]._zod.run({value:s[m],issues:[]},i);g instanceof Promise?a.push(g.then(b=>{l[m]=b})):(l[m]=g,f&&!d&&g.issues.length&&(d=ne(g)))}if(t.rest&&!d){let m=n.length-1,g=s.slice(n.length),b=o.issues.length;for(let $ of g){if(f&&o.issues.length!==b){if(ne(o,b))break;b=o.issues.length}m++;let I=t.rest._zod.run({value:$,issues:[]},i);I instanceof Promise?a.push(I.then(x=>dp(x,o,m))):dp(I,o,m)}}return a.length?Promise.all(a).then(()=>mp(l,o,n,s,u)):mp(l,o,n,s,u)}});function pp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function dp(e,t,n){e.issues.length&&t.issues.push(...se(n,e.issues)),t.value[n]=e.value}function mp(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...se(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length&&(n[i]._zod.optout==="optional"&&t.value[i]===void 0);i--)t.value.length=i;return t}var lc=p("$ZodRecord",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!be(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){if(c.add(typeof l=="number"?l.toString():l),l==="__proto__")continue;let f=t.keyType._zod.run({value:l,issues:[]},o);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>ae(g,o,U())),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?s.push(m.then(g=>{g.issues.length&&r.issues.push(...se(l,g.issues)),r.value[d]=g.value})):(m.issues.length&&r.issues.push(...se(l,m.issues)),r.value[d]=m.value)}let u;for(let l in i)if(!c.has(l))if(t.mode==="loose"){if(l==="__proto__")continue;r.value[l]=i[l]}else u=u??[],u.push(l);u&&u.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:u,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let u of Reflect.ownKeys(i)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(i,u))continue;let l=t.keyType._zod.run({value:u,issues:[]},o);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&Re.test(u)&&l.issues.length){let g=t.keyType._zod.run({value:Number(u),issues:[]},o);if(g instanceof Promise)throw new Error("Async schemas not supported in object keys currently");g.issues.length===0&&(l=g)}if(l.issues.length){t.mode==="loose"?r.value[u]=i[u]:a?(c=c??[],c.push(u)):r.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(g=>ae(g,o,U())),input:u,path:[u],inst:e});continue}let d=l.value;if(d==="__proto__")continue;let m=t.valueType._zod.run({value:i[u],issues:[]},o);m instanceof Promise?s.push(m.then(g=>{g.issues.length&&r.issues.push(...se(u,g.issues)),r.value[d]=g.value})):(m.issues.length&&r.issues.push(...se(u,m.issues)),r.value[d]=m.value)}c&&c.length>0&&r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}return s.length?Promise.all(s).then(()=>r):r}}),fc=p("$ZodMap",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[u,l]of i){if(a&&r.issues.length!==c){if(ne(r,c))break;c=r.issues.length}let f=t.keyType._zod.run({value:u,issues:[]},o),d=t.valueType._zod.run({value:l,issues:[]},o);f instanceof Promise||d instanceof Promise?s.push(Promise.all([f,d]).then(([m,g])=>{hp(m,g,r,u,i,e,o)})):hp(f,d,r,u,i,e,o)}return s.length?Promise.all(s).then(()=>r):r},rc(e,Hg)});function hp(e,t,n,r,o,i,s){e.issues.length&&(kn.has(typeof r)?n.issues.push(...se(r,e.issues)):n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map(a=>ae(a,s,U()))})),t.issues.length&&(kn.has(typeof r)?n.issues.push(...se(r,t.issues)):n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map(a=>ae(a,s,U()))})),n.value.set(e.value,t.value)}var pc=p("$ZodSet",(e,t)=>{O.init(e,t);let n=W.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let u of i){if(a&&r.issues.length!==c){if(ne(r,c))break;c=r.issues.length}let l=t.valueType._zod.run({value:u,issues:[]},o);l instanceof Promise?s.push(l.then(f=>gp(f,r))):gp(l,r)}return s.length?Promise.all(s).then(()=>r):r},rc(e,Wg)});function gp(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var dc=p("$ZodEnum",(e,t)=>{O.init(e,t);let n=Et(t.entries),r=new Set(n);e._zod.values=r,N(e,"pattern",o=>{let i=Et(o.def.entries).filter(s=>kn.has(typeof s));return new RegExp(i.length?`^(${i.map(s=>_e(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;return r.has(s)||o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),mc=p("$ZodLiteral",(e,t)=>{O.init(e,t);let n=new Set(t.values);e._zod.values=n,N(e,"pattern",r=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?_e(i):i?_e(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;return n.has(i)||r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),hc=p("$ZodFile",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;return o instanceof File||n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),gc=p("$ZodTransform",(e,t)=>{O.init(e,t),e._zod.optin="optional",W.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new He(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new ce;return n.value=o,n}});function yp(e,t){return e.value=t.issues.length?void 0:t.value,e}var po=p("$ZodOptional",(e,t)=>{O.init(e,t),N(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",N(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),N(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Le(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>yp(n,i)):yp(n,o)}return t.innerType._zod.run(n,r)}}),yc=p("$ZodExactOptional",(e,t)=>{po.init(e,t),N(e,"values",n=>n.def.innerType._zod.values),N(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),bc=p("$ZodNullable",(e,t)=>{O.init(e,t),N(e,"optin",n=>n.def.innerType._zod.optin),N(e,"optout",n=>n.def.innerType._zod.optout),N(e,"pattern",n=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Le(r.source)}|null)$`):void 0}),N(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),_c=p("$ZodDefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",N(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>bp(i,t)):bp(o,t)}});function bp(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var $c=p("$ZodPrefault",(e,t)=>{O.init(e,t),e._zod.optin="defaulted",N(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),wc=p("$ZodNonOptional",(e,t)=>{O.init(e,t),N(e,"values",n=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>_p(i,e)):_p(o,e)}});function _p(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var vc=p("$ZodSuccess",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new He("ZodSuccess");let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.issues.length===0,n)):(n.value=o.issues.length===0,n)}});function $p(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>ae(o,r,U()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var kc=p("$ZodCatch",(e,t)=>{O.init(e,t),N(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),N(e,"optout",n=>n.def.innerType._zod.optout),N(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);return o instanceof Promise?o.then(i=>$p(n,i,t,r)):$p(n,o,t,r)}}),xc=p("$ZodNaN",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>((typeof n.value!="number"||!Number.isNaN(n.value))&&n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n)}),mo=p("$ZodPipe",(e,t)=>{O.init(e,t),N(e,"values",n=>n.def.in._zod.values),N(e,"optin",n=>n.def.in._zod.optin),N(e,"optout",n=>n.def.out._zod.optout),N(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Wr(s,t.in,r)):Wr(i,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Wr(i,t.out,r)):Wr(o,t.out,r)}});function Wr(e,t,n){return e.issues.some(r=>r.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Jn=p("$ZodCodec",(e,t)=>{O.init(e,t),N(e,"values",n=>n.def.in._zod.values),N(e,"optin",n=>n.def.in._zod.optin),N(e,"optout",n=>n.def.out._zod.optout),N(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);return i instanceof Promise?i.then(s=>Gr(s,t,r)):Gr(i,t,r)}else{let i=t.out._zod.run(n,r);return i instanceof Promise?i.then(s=>Gr(s,t,r)):Gr(i,t,r)}}});function Gr(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);return o instanceof Promise?o.then(i=>Yr(e,i,t.out,n)):Yr(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);return o instanceof Promise?o.then(i=>Yr(e,i,t.in,n)):Yr(e,o,t.in,n)}}function Yr(e,t,n,r){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:t,issues:e.issues},r)}var zc=p("$ZodPreprocess",(e,t)=>{mo.init(e,t)}),Sc=p("$ZodReadonly",(e,t)=>{O.init(e,t),N(e,"propValues",n=>n.def.innerType._zod.propValues),N(e,"values",n=>n.def.innerType._zod.values),N(e,"optin",n=>n.def.innerType?._zod?.optin),N(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(wp):wp(o)}});function wp(e){return e.memo||(e.value=Object.freeze(e.value)),e}function Yg(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;c.pattern&&(n=c.pattern),r||(r=!!c.format?.includes("int"));let u=c.minimum??c.length,l=c.maximum??c.length;u!==void 0&&(o===void 0||u>o)&&(o=u),l!==void 0&&(i===void 0||l<i)&&(i=l)}if(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Vs({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Re?Cn:s)?.source}function ya(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ya(r);return n&&o&&i&&i!==o?n.replace(Le(o),()=>Le(i)):n}if(t.options){let o=t.options.map(ya);if(o.every(Boolean))return`^(${o.map(i=>Le(i)).join("|")})$`}return Yg(e)}var Ic=p("$ZodTemplateLiteral",(e,t)=>{O.init(e,t);let n=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){let o=ya(r);if(!o)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Le(o))}else if(r===null||es.has(typeof r))n.push(_e(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Pc=p("$ZodFunction",(e,t)=>(O.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=n=>{if(typeof n!="function")throw new Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Zr(e._def.input,r):r,i=Reflect.apply(n,this,o);return e._def.output?Zr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=n=>{if(typeof n!="function")throw new Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await Tr(e._def.input,r):r,i=await Reflect.apply(n,this,o);return e._def.output?await Tr(e._def.output,i):i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>typeof n.value!="function"?(n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n):(e._def.output&&e._def.output._zod.def.type==="promise"?n.value=e.implementAsync(n.value):n.value=e.implement(n.value),n),e.input=(...n)=>{let r=e.constructor;return Array.isArray(n[0])?new r({type:"function",input:new fo({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output}):new r({type:"function",input:n[0],output:e._def.output})},e.output=n=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:n})},e)),Oc=p("$ZodPromise",(e,t)=>{O.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then(o=>t.innerType._zod.run({value:o,issues:[]},r))}),Kn=p("$ZodLazy",(e,t)=>{O.init(e,t),Yi(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),N(e,"pattern",n=>n.innerType?._zod?.pattern),N(e,"propValues",n=>n.innerType?._zod?.propValues),N(e,"optin",n=>n.innerType?._zod?.optin??void 0),N(e,"optout",n=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Ac=p("$ZodCustom",(e,t)=>{M.init(e,t),O.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>vp(i,n,r,e));vp(o,n,r,e)}});function vp(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Lt(o))}}var bo=class extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}},Nc="~memo",Ap=[];function Ep(e){return e!==null&&typeof e=="object"}function Ec(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}var Np=new WeakMap,Ut=0,yo=1,qn=2;function Hn(e,t,n){let r=Np.get(e);if(r!==void 0)return r?qn:Ut;if(t.has(e))return qn;t.add(e);let o=Ut,i=l=>{if(o!==qn&&l?._zod){let f=Hn(l,t,n);f>o&&(o=f)}},s=(l,f)=>{let d=Ut;for(let m of Reflect.ownKeys(l)){let g=Object.getOwnPropertyDescriptor(l,m);if(f&&!g.enumerable)continue;let b=g.get?yo:g.value?._zod?Hn(g.value,t,n):Ut;b>d&&(d=b)}return d},a=l=>{l>o&&(o=l)},c=e._zod.def,u=c.type;switch(u){case"object":{let l=Tt(c);a(l?s(l,!0):yo),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let l of c.items)i(l);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let l of c.options)i(l);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let l=c._cachedInner??(n?e._zod.innerType:void 0);a(l?Hn(l,t,!1):yo);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let l in c){let f=Object.getOwnPropertyDescriptor(c,l);if(!f||f.get)continue;let d=f.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),Xg(e,o)}function Xg(e,t){return t!==yo&&Np.set(e,t===qn),t}function _o(e){return Hn(e,new Set,!0)!==Ut}function Qg(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var ho,go=[],ey={alloc(e,t,n){let r=ho;if(!r)return n;ho=void 0;let o={value:n,issues:null};return r.set(t.value,o),go.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&$o(i,o.value))throw new bo;return n(o,i)};e._zod.parse=r,e._zod.run===n&&(e._zod.run=r)})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,u)=>{if(n===void 0){let I=Hn(e,new Set,!1);if(I===Ut)return e._zod.parse=s,e._zod.run===a&&(e._zod.run=s),s(c,u);I===qn||r?n=!0:r=!0}let l=c.value;if(!Ep(l))return s(c,u);let f=u[Nc];f||(f={buckets:new WeakMap,backEdges:void 0},u[Nc]=f);let d;o===u?d=i:(d=Qg(f,e),o=u,i=d);let m=d.get(l);if(m)return c.value=m.value,m.issues?m.issues.length&&c.issues.push(...Ec(m.issues)):(c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(m.value)),c;ho=d;let g=go.length,b=s(c,u);ho=void 0;let $=go.length>g?go.pop():void 0;return b instanceof Promise?b.then(I=>($&&($.issues=I.issues.length?Ec(I.issues):Ap),I)):($&&($.issues=b.issues.length?Ec(b.issues):Ap),b)};e._zod.parse=a,e._zod.run===s&&(e._zod.run=a)})}};function Wn(){return ey}function $o(e,t){let n=e[Nc]?.backEdges;return n!==void 0&&Ep(t)&&n.has(t)}var Gn={};Te(Gn,{en:()=>wo});var ty=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let n={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"},r={nan:"NaN"};function o(i,s){return i==="number"&&typeof s=="number"&&!Number.isFinite(s)?String(s):r[i]??i}return i=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=rs(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return i.values.length===1?`Invalid input: expected ${Or(i.values[0])}`:`Invalid option: expected one of ${Sr(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);return a?`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);return a?`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`:`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Sr(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(a=>`'${a}'`).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"}}};function wo(){return{localeError:ty()}}var Zp,Zc=Symbol("ZodOutput"),Tc=Symbol("ZodInput"),vo=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...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 ko(){return new vo}(Zp=globalThis).__zod_globalRegistry??(Zp.__zod_globalRegistry=ko());var Y=globalThis.__zod_globalRegistry;var re=Symbol.for("zod.compile.invalid"),Tp=Symbol.for("zod.compile.fallback"),ve=class extends Error{constructor(t="z.compile does not support async refinements, transforms, or checks"){super(t),this.name="ZodCompileAsyncError"}},Z=class extends Error{constructor(t,n=!0){super(`z.compile does not support ${t}; this schema must use the runtime parser`),this.name="ZodCompileUnsupportedError",this.islandable=n}};function ry(e,t){try{return zo(e,{assertOnly:!0})}catch{return t}}function Dc(e,t){try{let n=zo(e),r=xo(e,n);return r._zod.bag.validator=ry(e,n),r}catch(n){if(t?.strict)throw n;return e}}function xo(e,t){if(_o(e))throw new Z("a schema whose subtree contains a reference cycle");let n=L(e),r=e._zod.run,o=r.__originalRun??r,i=(s,a)=>{if(a?.async||a?.direction==="backward"||a?.skipChecks||a?.[Tp]||a&&$o(a,s.value))return o(s,a);let c=t(s.value);return c!==re?(s.value=c,s):(a&&(a[Tp]=!0),o(s,a))};return i.__originalRun=o,n._zod.bag.fallbackRun=o,n._zod.bag.validator=t,n._zod.run=i,r.__originalRun||oy(n,e,t),n}function oy(e,t,n){let r=e,o=t;if(typeof o.safeParse=="function"){let i=o.safeParse;r.safeParse=(s,a)=>{let c=n(s);return c!==re?{success:!0,data:c}:i(s,a)}}if(typeof o.parse=="function"){let i=o.parse;r.parse=(s,a)=>{let c=n(s);return c!==re?c:i(s,a)}}}function zo(e,t){let n=!0;try{n=_o(e)}catch{}if(n)throw new Z("a schema whose subtree contains a reference cycle");let r={constants:new Map,constantCounter:0,varCounter:0,definite:!0},o=new mt(["input"]),i=B(o,r,e,"input",!t?.assertOnly);o.write(i===null?"return true;":`return ${i};`);let s=["INVALID",...r.constants.keys()],a=[re,...r.constants.values()],c=o.content.join(`
57
57
  `),u=t?.debug?s.length>0?`// Constants: ${s.join(", ")}
58
58
  ${c}`:c:"",l=Function,f=`return (input) => {
59
59
  ${c}
60
- }`,m;try{m=new l(...s,f)(...a)}catch(d){throw new N(`this schema (generated code failed to evaluate: ${d.message})`)}return t?.debug&&(m.code=u),m.definite=r.definite,m}function P(e,t){for(let[r,o]of e.constants)if(o===t)return r;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function yt(e,t){return e.definite=!1,P(e,t)}function z(e){return`v${e.varCounter++}`}function ey(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return ne;let r=n;return r.issues.length===0?r.value:ne}function Q(e,t,n,r,o=!0){let i=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return U(e,t,n,r,o)}catch(u){if(!(u instanceof N)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let f of l)t.constants.delete(f)}return t.constantCounter=a,t.varCounter=c,ty(e,t,n,r)}}function ty(e,t,n,r){t.definite=!1;let o=P(t,n),i=P(t,ey),s=z(t);return e.write(`const ${s} = ${i}(${o}, ${r});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var ny=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function ry(e,t,n,r){let o=n._zod.def.checks;if(!o||o.length===0)return r;let i=r;for(let s of o){let a=s._zod.def;if(a.when&&!ny.has(a.check))throw new N('check with a custom "when" condition');switch(a.check){case"greater_than":oy(e,t,a,i);break;case"less_than":iy(e,t,a,i);break;case"multiple_of":sy(e,t,a,i);break;case"number_format":jp(e,a,i);break;case"min_length":{let c=He(a.minimum,"min_length"),u=Cc(e,t,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=He(a.maximum,"max_length"),u=Cc(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=He(a.length,"length_equals"),u=Cc(e,t,i,`${i}.length >= ${c} && ${i}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${He(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${He(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${He(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Mp(e,t,a,i);break;case"custom":i=py(e,t,s,i);break;case"bigint_format":ay(e,a,i);break;case"mime_type":cy(e,t,a,i);break;case"property":ly(e,t,a,i);break;case"properties":uy(e,t,a,i);break;case"overwrite":{let c=z(t);fy(e,t,s,i,c),i=c;break}default:throw new N(`check type ${a.check}`)}}return i}function Cc(e,t,n,r){let o=P(t,pt),i=z(t);return e.write(`const ${i} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),i}function He(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new N(`${t} bound of type ${typeof e}`);return`${e}`}function Dp(e,t){if(typeof t=="bigint")return`${t}n`;if(typeof t=="number"){if(Number.isNaN(t))throw new N("comparison check with NaN bound");return`${t}`}if(t instanceof Date){if(Number.isNaN(t.getTime()))throw new N("comparison check with Invalid Date bound");return P(e,t)}throw new N(`comparison check bound of type ${typeof t}`)}function oy(e,t,n,r){let o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${Dp(t,n.value)}) return INVALID;`)}function iy(e,t,n,r){let o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${Dp(t,n.value)}) return INVALID;`)}function sy(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new N("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{let o=P(t,wn);e.write(`if (${o}(${r}, ${He(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function jp(e,t,n){let r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new N(`number format ${r}`)}}function ay(e,t,n){let r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new N(`bigint format ${r}`)}}function cy(e,t,n,r){let o=n.mime;if(o&&o.length>0){let i=P(t,new Set(o));e.write(`if (!${i}.has(${r}.type)) return INVALID;`)}}function uy(e,t,n,r){if(n.when)throw new N('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);let o=n.shape;for(let i of Reflect.ownKeys(o)){let s=typeof i=="symbol"?P(t,i):ee(i),a=z(t);e.write(`const ${a} = ${r}[${s}];`),Q(e,t,o[i],a,!1)}}function ly(e,t,n,r){let o=`${r}[${JSON.stringify(n.property)}]`;U(e,t,n.schema,o)}function fy(e,t,n,r,o){let i=n._zod.def.tx;if(!i)throw new N("overwrite check without a transform function");if(bt(i))throw new ve("z.compile: async overwrite transforms are not supported");let s=P(t,i);e.write(`const ${o} = ${s}(${r});`)}function Lc(){throw new ce}function jc(e){this.issues.push(e)}function py(e,t,n,r){let o=n._zod.def;if(o.fn){if(bt(o.fn))throw new ve("z.compile: async .refine() predicates are not supported");let i=yt(t,o.fn),s=P(t,Lc),a=z(t);return e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(bt(n._zod.check))throw new ve("z.compile: async .superRefine() / check functions are not supported");let i=n._zod.check,a=yt(t,u=>{let l={value:u,issues:[],addIssue:jc};return i(l)instanceof Promise&&Lc(),l.issues.length===0?l.value:ne}),c=z(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new N("custom check without a predicate or check function")}var dy=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 Mp(e,t,n,r,o=!0){let i=n.format;if(i==="base64"){let u=P(t,Vn);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="base64url"){let u=P(t,oo);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="jwt"){let u=P(t,ao),l=P(t,n.alg??null);return e.write(`if (!${u}(${r}, ${l})) return INVALID;`),r}if(i==="ipv6"){let u=P(t,Mn);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="cidrv6"){let u=P(t,no);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="credit_card"){let u=P(t,io);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="iban"){let u=P(t,so);return e.write(`if (!${u}(${r})) return INVALID;`),r}let s=n;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=P(t,Qr),l=P(t,n),f=z(t),m=z(t);if(e.write(`const ${f} = ${r}.trim();`),e.write(`const ${m} = ${u}(${f}, ${l});`),e.write(`if (typeof ${m} === "number") return INVALID;`),s.hostname!==void 0){let b=P(t,eo);e.write(`if (!${b}(${m}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let b=P(t,to);e.write(`if (!${b}(${m}, ${l}.protocol)) return INVALID;`)}if(!o)return null;let d=z(t),g=s.normalize?`${m}.href`:`${P(t,jn)}(${f})`;return e.write(`const ${d} = ${g};`),d}let a=n.fn;if(a){if(bt(a))throw new N(`async string format ${i}`);let u=P(t,a);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(dy.has(i)&&n.pattern){let u=P(t,n.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${r})) return INVALID;`),r}let c=n.format;switch(c){case"regex":throw new N("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${ee(n.includes)})) return INVALID;`);break;case"starts_with":{let u=n.prefix;e.write(`if (${r}.slice(0, ${u.length}) !== ${ee(u)}) return INVALID;`);break}case"ends_with":{let u=n.suffix;e.write(`if (${r}.slice(-${u.length}) !== ${ee(u)}) return INVALID;`);break}default:throw new N(`string format ${c}`)}return r}function U(e,t,n,r,o=!0){let i=n._zod.def,s=i.type;if(i.coerce)throw new N(`coercion (z.coerce.${s}())`);let a=o||!!i.checks?.length,c;switch(s){case"string":c=my(e,t,n,r,a);break;case"number":c=hy(e,n,r);break;case"boolean":c=gy(e,r);break;case"bigint":c=yy(e,n,r);break;case"symbol":c=by(e,r);break;case"undefined":c=_y(e,r);break;case"null":c=$y(e,r);break;case"any":case"unknown":c=r;break;case"never":e.write("return INVALID;"),c=r;break;case"void":c=wy(e,r);break;case"nan":c=vy(e,r);break;case"date":c=ky(e,r);break;case"object":c=xy(e,t,n,r,a);break;case"optional":c=zy(e,t,n,r,a);break;case"nullable":c=Py(e,t,n,r,a);break;case"array":c=Oy(e,t,n,r,a);break;case"literal":c=Ay(e,t,n,r);break;case"enum":c=Ey(e,t,n,r);break;case"readonly":{let u=Cp(e,t,n,r),l=z(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":Cp(e,t,n,r),c="true";break;case"default":case"prefault":c=Zy(e,t,n,r);break;case"nonoptional":c=Ny(e,t,n,r);break;case"tuple":c=Ty(e,t,n,r);break;case"union":c=Cy(e,t,n,r);break;case"intersection":c=Dy(e,t,n,r);break;case"record":c=jy(e,t,n,r);break;case"map":c=Vy(e,t,n,r);break;case"set":c=Fy(e,t,n,r);break;case"file":c=Uy(e,r);break;case"template_literal":c=By(e,t,n,r);break;case"lazy":c=Jy(e,t,n,r);break;case"pipe":c=Ky(e,t,n,r);break;case"custom":c=qy(e,t,n,r);break;case"transform":c=Gy(e,t,n,r);break;case"catch":c=Hy(e,t,n,r);break;default:throw new N(`schema type ${s}`)}return c===null?null:ry(e,t,n,c)}function my(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);let i=n._zod.def;return i.format===void 0?r:Mp(e,t,i,r,o)}function hy(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let r=t._zod.def;return r.check==="number_format"&&r.format&&jp(e,{format:r.format},n),n}function gy(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function yy(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function by(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function _y(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function $y(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function wy(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function vy(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function ky(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function xy(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);let s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=x=>typeof x=="symbol"?P(t,x):ee(x),f=x=>typeof x=="symbol"?`[${l(x)}]`:ee(x),m=s;if(a.includes("__proto__"))throw new N('object shape key "__proto__"');let d=new Map;for(let x of u){let A=m[x],C=l(x),V=z(t);if(e.write(`const ${V} = ${r}[${C}];`),A._zod.optin!==void 0){let T=z(t);e.write(`let ${T} = (() => {`),e.indented(X=>{let _n=Q(X,t,A,V);X.write(`return ${_n};`)}),e.write("})();"),A._zod.optout==="optional"?(e.write(`if (${T} === INVALID) {`),e.indented(X=>{X.write(`if (${C} in ${r}) return INVALID;`),X.write(`${T} = undefined;`)}),e.write("}")):e.write(`if (${T} === INVALID) return INVALID;`),d.set(x,T)}else{Iy(A)&&e.write(`if (!(${C} in ${r})) return INVALID;`);let T=Q(e,t,A,V,o);T!==null&&d.set(x,T)}}let g=i.catchall,b="none";if(g){let x=g._zod.def.type;if(x==="never"){let A=a.map(C=>`k !== ${ee(C)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(C=>{C.write(`if (${A}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?b="passthrough":b="schema"}let $=z(t),S=u.some(x=>Tp(m[x])||Rc(m[x]));if(!o){if(b==="schema"){let x=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(A=>{A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`);let C=z(t);A.write(`const ${C} = ${r}[k];`),Q(A,t,g,C,!1)}),e.write("}")}return null}if(S){e.write(`const ${$} = {};`);for(let x of u){let A=l(x),C=d.get(x);Rc(m[x])?e.write(`if (${A} in ${r}) ${$}[${A}] = ${C};`):Tp(m[x])?e.write(`if (${C} !== undefined || ${A} in ${r}) ${$}[${A}] = ${C};`):e.write(`${$}[${A}] = ${C};`)}}else{let x=u.map(A=>`${f(A)}: ${d.get(A)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(b!=="none"){let x=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(A=>{if(A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`),b==="passthrough")A.write(`${$}[k] = ${r}[k];`);else{let C=z(t);A.write(`const ${C} = ${r}[k];`);let V=Q(A,t,g,C);A.write(`${$}[k] = ${V};`)}}),e.write("}")}return $}function zy(e,t,n,r,o=!0){let i=n._zod.def;if(Sy(n))return U(e,t,i.innerType,r,o);if(i.innerType._zod.optin==="defaulted"){let a=z(t),c=z(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let f=U(l,t,i.innerType,r);l.write(`return ${f};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=U(u,t,i.innerType,r);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=o?z(t):null;return s&&e.write(`let ${s};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{let c=U(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Sy(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Iy(e){return e._zod.optin===void 0&&gt(e)}function gt(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?gt(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?gt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(gt):!0;case"intersection":return!t.left||!t.right?!0:gt(t.left)&&gt(t.right);case"pipe":return t.in?gt(t.in):!0;default:return!0}}function Rc(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function Tp(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Bt(e)}function Bt(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?Bt(t.innerType):!0;case"union":return t.options?t.options.some(Bt):!0;case"intersection":return!t.left||!t.right||Bt(t.left)||Bt(t.right);case"pipe":return t.out?Bt(t.out):!0;default:return!0}}function Py(e,t,n,r,o=!0){let i=n._zod.def,s=o?z(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{let c=U(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Mc(e,t,n){for(let[r,o]of Ct(t._zod.def.checks))e.write(`if (${n} > ${He(r,o._zod.def.check)}) return INVALID;`)}function Oy(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`),Mc(e,n,`${r}.length`);let s=o?z(t):null,a=z(t),c=z(t);return s&&e.write(`const ${s} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${r}[${a}];`);let l=Q(u,t,i.element,c,o);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function Ay(e,t,n,r){let i=n._zod.def.values;if(i.length!==1){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof s=="string")e.write(`if (${r} !== ${ee(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${r} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${r} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${r} !== ${s}n) return INVALID;`);else throw new N(`literal type ${typeof s}`);return r}function Ey(e,t,n,r){let o=n._zod.values;if(!o)throw new N("enum schema without enumerated values");let i=P(t,o);return e.write(`if (!${i}.has(${r})) return INVALID;`),r}function Cp(e,t,n,r){let o=n._zod.def;return U(e,t,o.innerType,r)}function Zy(e,t,n,r){let o=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return U(e,t,o.innerType,r);let c=P(t,s),u=z(t);return e.write(`let ${u} = ${r};`),e.write(`if (${r} === undefined) ${u} = ${c}();`),U(e,t,o.innerType,u)}let a=z(t);if(s){let c=P(t,s),u=P(t,vn);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let f=U(l,t,o.innerType,r);l.write(`${a} = ${f} === undefined ? ${u}(${c}()) : ${f};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(c=>{let u=U(c,t,o.innerType,r);c.write(`${a} = ${u};`)}),e.write("}");return a}function Ny(e,t,n,r){let o=n._zod.def,i=U(e,t,o.innerType,r),s=z(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function Ty(e,t,n,r){let o=n._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);let a=Lp(i,"optin"),c=Lp(i,"optout");s?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${i.length}) return INVALID;`);let u=z(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let f=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(m=>{m.write(`if (${l} < ${r}.length) {`),m.indented(d=>{let g=z(t);d.write(`const ${g} = ${r}[${l}];`);let b=Q(d,t,f,g);d.write(`${u}[${l}] = ${b};`)}),m.write("} else {"),m.indented(d=>{if(Rc(f)){d.write(`${u}.length = ${l};`);return}let g=z(t),b=z(t);d.write(`const ${g} = undefined;`),d.write(`const ${b} = (() => {`),d.indented($=>{let S=Q($,t,f,g);$.write(`return ${S};`)}),d.write("})();"),d.write(`if (${b} === INVALID || ${b} === undefined) ${u}.length = ${l};`),d.write(`else ${u}[${l}] = ${b};`)}),m.write("}")}),e.write("}");else{let m=z(t);e.write(`const ${m} = ${r}[${l}];`);let d=Q(e,t,f,m);e.write(`${u}[${l}] = ${d};`)}}if(s){let l=z(t),f=z(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${r}.length; ${l}++) {`),e.indented(m=>{m.write(`const ${f} = ${r}[${l}];`);let d=Q(m,t,s,f);m.write(`${u}[${l}] = ${d};`)}),e.write("}")}return u}function Lp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function Cy(e,t,n,r){let o=n._zod.def,i=o.options;if(o.discriminator)return Ly(e,t,o,r);if(o.inclusive===!1)throw new N("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),r;if(i.length===1)return U(e,t,i[0],r);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=P(t,c);return e.write(`if (!${u}.has(${r})) return INVALID;`),r}let a=z(t);e.write(`let ${a};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let f=U(l,t,u,r);l.write(`return ${f};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Ly(e,t,n,r){if(n.unionFallback)throw new N("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;let o=z(t),i=z(t);e.write(`const ${o} = ${r}?.[${ee(n.discriminator)}];`),e.write(`let ${i};`);let s=!0,a=new Set;for(let c of n.options){let u=c._zod.propValues?.[n.discriminator];if(!u||u.size===0)throw new N("discriminated union option without static discriminator values");for(let m of u){if(a.has(m))throw new N(`duplicate discriminator value ${String(m)}`);a.add(m)}let l=Array.from(u,m=>Ry(t,o,m)),f=s?"if":"else if";e.write(`${f} (${l.join(" || ")}) {`),e.indented(m=>{let d=U(m,t,c,r);m.write(`${i} = ${d};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function Ry(e,t,n){if(typeof n=="string")return`${t} === ${ee(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let r=P(e,n);return`${t} === ${r}`}throw new N(`literal discriminator value ${String(n)}`)}function Dy(e,t,n,r){let o=n._zod.def;t.definite=!1;let i=Q(e,t,o.left,r),s=Q(e,t,o.right,r),a=P(t,Ft),c=z(t);return e.write(`const ${c} = ${a}(${i}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function jy(e,t,n,r){let o=n._zod.def,i=P(t,ye);e.write(`if (!${i}(${r})) return INVALID;`);let s=z(t),a=z(t),c=z(t);e.write(`const ${s} = {};`);let u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){let d=[];for(let b of l){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new N(`record key value ${String(b)}`);let $=typeof b=="number"?b.toString():b;if($==="__proto__")throw new N('record key "__proto__"');d.push($);let S=P(t,b),x=U(e,t,o.keyType,S),A=z(t);e.write(`const ${A} = ${r}[${My(t,$)}];`);let C=Q(e,t,o.valueType,A);e.write(`${s}[${x}] = ${C};`)}let g=P(t,new Set(d));return e.write(`for (const ${a} in ${r}) {`),e.indented(b=>{b.write(`if (${g}.has(${a})) continue;`),u.mode==="loose"?b.write(`if (${a} !== "__proto__") ${s}[${a}] = ${r}[${a}];`):b.write("return INVALID;")}),e.write("}"),s}let f=o.keyType._zod.def;if(!(f.type==="string"&&f.format===void 0&&!f.coerce&&(f.checks?.length??0)===0)){let d=o.mode==="loose",g=xo(o.keyType);g.definite===!1&&(t.definite=!1);let b=P(t,g),$=P(t,Le),S=z(t);return Rp(e,t,r,a,x=>{x.write(`let ${S} = ${b}(${a});`),x.write(`if (${S} === INVALID && typeof ${a} === "string" && ${$}.test(${a})) ${S} = ${b}(Number(${a}));`),d?x.write(`if (${S} === INVALID) { ${s}[${a}] = ${r}[${a}]; continue; }`):x.write(`if (${S} === INVALID) return INVALID;`),x.write(`if (${S} === "__proto__") continue;`);let A=z(t);x.write(`const ${A} = ${r}[${a}];`);let C=Q(x,t,o.valueType,A);x.write(`${s}[${S}] = ${C};`)}),s}return Rp(e,t,r,a,d=>{d.write(`const ${c} = ${r}[${a}];`);let g=Q(d,t,o.valueType,c);d.write(`${s}[${a}] = ${g};`)},"return INVALID;"),s}function Rp(e,t,n,r,o,i){let s=P(t,Object.prototype.propertyIsEnumerable),a=z(t),c=z(t),u=z(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${c} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${c}[${u}];`),l.write(`if (${r} === "__proto__" || !${s}.call(${n}, ${r})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${a}[${u}];`),l.write(`if (!${s}.call(${n}, ${r})) continue;`),i?l.write(i):o(l)}),e.write("}")}function My(e,t){return typeof t=="string"?ee(t):P(e,t)}function Vy(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`),Mc(e,n,`${r}.size`);let i=z(t),s=z(t),a=z(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${r}) {`),e.indented(c=>{let u=U(c,t,o.keyType,s),l=U(c,t,o.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function Fy(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`),Mc(e,n,`${r}.size`);let i=z(t),s=z(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${r}) {`),e.indented(a=>{let c=U(a,t,o.valueType,s);a.write(`${i}.add(${c});`)}),e.write("}"),i}function Uy(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function By(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);let o=n._zod.pattern;if(o){let i=P(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${r})) return INVALID;`)}return r}function Jy(e,t,n,r){let o=n._zod.def,i=yt(t,o.getter),s=P(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${i}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=z(t);return e.write(`const ${a} = ${s}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Ky(e,t,n,r){let o=n._zod.def,i=U(e,t,o.in,r);if(o.transform){if(bt(o.transform))throw new ve("z.compile: async transforms in pipes are not supported");let s=o.transform,c=yt(t,l=>{let f={value:l,issues:[],addIssue:jc},m=s(l,f);return m instanceof Promise?ne:f.issues.length===0?m:ne}),u=z(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),U(e,t,o.out,u)}else return U(e,t,o.out,i)}function bt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function qy(e,t,n,r){let o=n._zod.def;if(o.fn){if(bt(o.fn))throw new ve("z.compile: async custom predicates are not supported");let i=yt(t,o.fn),s=P(t,Lc),a=z(t);e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new N("custom schema without a predicate function");return r}function Wy(e,t,n){let r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return ne;let o=r;return o.issues.length===0?o.value:t()}function Hy(e,t,n,r){let o=n._zod.def;if(!o.catchValue[Ar])throw new N("catch with a callback (only a constant catch value compiles)",!1);let i=z(t);e.write(`let ${i} = (() => {`),e.indented(u=>{let l=Q(u,t,o.innerType,r);u.write(`return ${l};`)}),e.write("})();");let s=P(t,o.innerType),a=yt(t,o.catchValue),c=P(t,Wy);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${r});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function Gy(e,t,n,r){let o=n._zod.def;if(o.transform){if(bt(o.transform))throw new ve("z.compile: async transforms are not supported");let i=o.transform,a=yt(t,u=>{let l={value:u,issues:[],addIssue:jc},f=i(u,l);return f instanceof Promise?ne:l.issues.length===0?f:ne}),c=z(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return r}function zo(e){return e.checks&&(e.checks=[...e.checks]),e}function Vc(e,t){return new e(zo({type:"string",..._(t)}))}function Fc(e,t){return new e(zo({type:"string",coerce:!0,..._(t)}))}function So(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function Io(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function Po(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function Oo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function Ao(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function Eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function Yn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function Zo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function No(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function To(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Co(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Lo(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Ro(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function Do(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function jo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Mo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Uc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}function Vo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Fo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Uo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Bo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Jo(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Bc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}function Jc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}function Ko(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}var Kc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Xn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Qn(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function er(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function tr(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function qc(e,t){return new e(zo({type:"number",checks:[],..._(t)}))}function Wc(e,t){return new e(zo({type:"number",coerce:!0,checks:[],..._(t)}))}function Hc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Gc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}function Yc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}function Xc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}function Qc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}function eu(e,t){return new e({type:"boolean",..._(t)})}function tu(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}function nu(e,t){return new e({type:"bigint",..._(t)})}function ru(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}function ou(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}function iu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}function su(e,t){return new e({type:"symbol",..._(t)})}function au(e,t){return new e({type:"undefined",..._(t)})}function cu(e,t){return new e({type:"null",..._(t)})}function uu(e){return new e({type:"any"})}function lu(e){return new e({type:"unknown"})}function fu(e,t){return new e({type:"never",..._(t)})}function pu(e,t){return new e({type:"void",..._(t)})}function du(e,t){return new e({type:"date",..._(t)})}function mu(e,t){return new e({type:"date",coerce:!0,..._(t)})}function hu(e,t){return new e({type:"nan",..._(t)})}function Ie(e,t){return new Kr({check:"less_than",..._(t),value:e,inclusive:!1})}function de(e,t){return new Kr({check:"less_than",..._(t),value:e,inclusive:!0})}function Pe(e,t){return new qr({check:"greater_than",..._(t),value:e,inclusive:!1})}function me(e,t){return new qr({check:"greater_than",..._(t),value:e,inclusive:!0})}function qo(e){return Pe(0,e)}function Wo(e){return Ie(0,e)}function Ho(e){return de(0,e)}function Go(e){return me(0,e)}function Ge(e,t){return new Ys({check:"multiple_of",..._(t),value:e})}function Ye(e,t){return new ea({check:"max_size",..._(t),maximum:e})}function Oe(e,t){return new ta({check:"min_size",..._(t),minimum:e})}function _t(e,t){return new na({check:"size_equals",..._(t),size:e})}function $t(e,t){return new ra({check:"max_length",..._(t),maximum:e})}function Re(e,t){return new oa({check:"min_length",..._(t),minimum:e})}function wt(e,t){return new ia({check:"length_equals",..._(t),length:e})}function Jt(e,t){return new sa({check:"string_format",format:"regex",..._(t),pattern:e})}function Kt(e){return new aa({check:"string_format",format:"lowercase",..._(e)})}function qt(e){return new ca({check:"string_format",format:"uppercase",..._(e)})}function Wt(e,t){return new ua({check:"string_format",format:"includes",..._(t),includes:e})}function Ht(e,t){return new la({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Gt(e,t){return new fa({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Yo(e,t,n){return new pa({check:"property",property:e,schema:t,..._(n)})}function Yt(e,t){return new da({check:"properties",shape:e,..._(t)})}function Xt(e,t){return new ma({check:"mime_type",mime:e,..._(t)})}function ke(e){return new ha({check:"overwrite",tx:e})}function Qt(e){return ke(t=>t.normalize(e))}function en(){return ke(e=>e.trim())}function tn(){return ke(e=>e.toLowerCase())}function nn(){return ke(e=>e.toUpperCase())}function rn(){return ke(e=>Xi(e))}function gu(e,t,n){return new e({type:"array",element:t,..._(n)})}function Yy(e,t,n){return new e({type:"union",options:t,..._(n)})}function Xy(e,t,n){return new e({type:"union",options:t,inclusive:!1,..._(n)})}function Qy(e,t,n,r){return new e({type:"union",options:n,discriminator:t,..._(r)})}function eb(e,t,n){return new e({type:"intersection",left:t,right:n})}function tb(e,t,n,r){let o=n instanceof O,i=o?r:n,s=o?n:null;return new e({type:"tuple",items:t,rest:s,..._(i)})}function nb(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,..._(r)})}function rb(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,..._(r)})}function ob(e,t,n){return new e({type:"set",valueType:t,..._(n)})}function ib(e,t,n){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,..._(n)})}function sb(e,t,n){return new e({type:"enum",entries:t,..._(n)})}function ab(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(n)})}function yu(e,t){return new e({type:"file",..._(t)})}function cb(e,t){return new e({type:"transform",transform:t})}function ub(e,t){return new e({type:"optional",innerType:t})}function lb(e,t){return new e({type:"nullable",innerType:t})}function fb(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():vn(n)}})}function pb(e,t,n){return new e({type:"nonoptional",innerType:t,..._(n)})}function db(e,t){return new e({type:"success",innerType:t})}function mb(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:is(n)})}function hb(e,t,n){return new e({type:"pipe",in:t,out:n})}function gb(e,t){return new e({type:"readonly",innerType:t})}function yb(e,t,n){return new e({type:"template_literal",parts:t,..._(n)})}function bb(e,t){return new e({type:"lazy",getter:t})}function _b(e,t){return new e({type:"promise",innerType:t})}function bu(e,t,n){let r=_(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function _u(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function $u(e,t){let n=Vp(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Lt(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Lt(i))}},e(r.value,r)),t);return n}function Vp(e,t){let n=new M({check:"custom",..._(t)});return n._zod.check=e,n}function wu(e){let t=new M({check:"describe"});return t._zod.onattach=[n=>{let r=Y.get(n)??{};Y.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function vu(e){let t=new M({check:"meta"});return t._zod.onattach=[n=>{let r=Y.get(n)??{};Y.add(n,{...r,...e})}],t._zod.check=()=>{},t}function ku(e,t){let n=_(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(d=>typeof d=="string"?d.toLowerCase():d),o=o.map(d=>typeof d=="string"?d.toLowerCase():d));let i=new Set(r),s=new Set(o),a=e.Codec??Jn,c=e.Boolean??Un,u=e.String??ht,l=new u({type:"string",error:n.error}),f=new c({type:"boolean",error:n.error}),m=new a({type:"pipe",in:l,out:f,transform:((d,g)=>{let b=d;return n.case!=="sensitive"&&(b=b.toLowerCase()),i.has(b)?!0:s.has(b)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:m,continue:!1}),{})}),reverseTransform:((d,g)=>d===!0?r[0]||"true":o[0]||"false"),error:n.error});return m._zod.bag.truthy=r,m._zod.bag.falsy=o,m._zod.bag.case=n.case??"insensitive",m}function vt(e,t,n,r={}){let o=_(r),i={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new e(i)}function nr(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&G(e,r,n[r]);return e}function Xe(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??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function J(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}function D(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let m=s.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,m,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),D(f,t,l),t.seen.get(f).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&nr(s.schema,c),t.io==="input"&&re(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Fp(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Qe(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,m=e.external.uri??(g=>g);if(f)return{ref:m(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${m("__shared")}#/${a}/${Fp(d)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Fp(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
60
+ }`,d;try{d=new l(...s,f)(...a)}catch(m){throw new Z(`this schema (generated code failed to evaluate: ${m.message})`)}return t?.debug&&(d.code=u),d.definite=r.definite,d}function P(e,t){for(let[r,o]of e.constants)if(o===t)return r;let n=`c${e.constantCounter++}`;return e.constants.set(n,t),n}function yt(e,t){return e.definite=!1,P(e,t)}function z(e){return`v${e.varCounter++}`}function iy(e,t){let n=e._zod.run({value:t,issues:[]},{});if(n&&typeof n.then=="function")return re;let r=n;return r.issues.length===0?r.value:re}function Q(e,t,n,r,o=!0){let i=e.content.length,s=t.constants.size,a=t.constantCounter,c=t.varCounter;try{return B(e,t,n,r,o)}catch(u){if(!(u instanceof Z)||!u.islandable)throw u;if(e.content.length=i,t.constants.size>s){let l=Array.from(t.constants.keys()).slice(s);for(let f of l)t.constants.delete(f)}return t.constantCounter=a,t.varCounter=c,sy(e,t,n,r)}}function sy(e,t,n,r){t.definite=!1;let o=P(t,n),i=P(t,iy),s=z(t);return e.write(`const ${s} = ${i}(${o}, ${r});`),e.write(`if (${s} === INVALID) return INVALID;`),s}var ay=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function cy(e,t,n,r){let o=n._zod.def.checks;if(!o||o.length===0)return r;let i=r;for(let s of o){let a=s._zod.def;if(a.when&&!ay.has(a.check))throw new Z('check with a custom "when" condition');switch(a.check){case"greater_than":uy(e,t,a,i);break;case"less_than":ly(e,t,a,i);break;case"multiple_of":fy(e,t,a,i);break;case"number_format":Mp(e,a,i);break;case"min_length":{let c=We(a.minimum,"min_length"),u=Cc(e,t,i,`${i}.length >= ${c} && ${i}.length < ${a.minimum*2}`);e.write(`if (${u} < ${c}) return INVALID;`);break}case"max_length":{let c=We(a.maximum,"max_length"),u=Cc(e,t,i,`${i}.length > ${c}`);e.write(`if (${u} > ${c}) return INVALID;`);break}case"length_equals":{let c=We(a.length,"length_equals"),u=Cc(e,t,i,`${i}.length >= ${c} && ${i}.length <= ${a.length*2}`);e.write(`if (${u} !== ${c}) return INVALID;`);break}case"min_size":e.write(`if (${i}.size < ${We(a.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${i}.size > ${We(a.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${i}.size !== ${We(a.size,"size_equals")}) return INVALID;`);break;case"string_format":i=Vp(e,t,a,i);break;case"custom":i=yy(e,t,s,i);break;case"bigint_format":py(e,a,i);break;case"mime_type":dy(e,t,a,i);break;case"property":hy(e,t,a,i);break;case"properties":my(e,t,a,i);break;case"overwrite":{let c=z(t);gy(e,t,s,i,c),i=c;break}default:throw new Z(`check type ${a.check}`)}}return i}function Cc(e,t,n,r){let o=P(t,pt),i=z(t);return e.write(`const ${i} = typeof ${n} === "string" && ${r} ? ${o}(${n}) : ${n}.length;`),i}function We(e,t){if(typeof e!="number"||!Number.isFinite(e))throw new Z(`${t} bound of type ${typeof e}`);return`${e}`}function jp(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 P(e,t)}throw new Z(`comparison check bound of type ${typeof t}`)}function uy(e,t,n,r){let o=n.inclusive?"<":"<=";e.write(`if (${r} ${o} ${jp(t,n.value)}) return INVALID;`)}function ly(e,t,n,r){let o=n.inclusive?">":">=";e.write(`if (${r} ${o} ${jp(t,n.value)}) return INVALID;`)}function fy(e,t,n,r){if(typeof n.value=="bigint"){if(n.value===BigInt(0))throw new Z("multiple_of check with a zero divisor");e.write(`if (${r} % ${n.value}n !== 0n) return INVALID;`)}else{let o=P(t,wn);e.write(`if (${o}(${r}, ${We(n.value,"multiple_of")}) !== 0) return INVALID;`)}}function Mp(e,t,n){let r=t.format;switch(r){case"safeint":e.write(`if (!Number.isSafeInteger(${n})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${n}) || ${n} < -2147483648 || ${n} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${n}) || ${n} < 0 || ${n} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${n}) || ${n} < -3.4028234663852886e38 || ${n} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${n})) return INVALID;`);break;default:throw new Z(`number format ${r}`)}}function py(e,t,n){let r=t.format;if(r)switch(r){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break;default:throw new Z(`bigint format ${r}`)}}function dy(e,t,n,r){let o=n.mime;if(o&&o.length>0){let i=P(t,new Set(o));e.write(`if (!${i}.has(${r}.type)) return INVALID;`)}}function my(e,t,n,r){if(n.when)throw new Z('check with a custom "when" condition');e.write(`if (${r} == null) return INVALID;`);let o=n.shape;for(let i of Reflect.ownKeys(o)){let s=typeof i=="symbol"?P(t,i):te(i),a=z(t);e.write(`const ${a} = ${r}[${s}];`),Q(e,t,o[i],a,!1)}}function hy(e,t,n,r){let o=`${r}[${JSON.stringify(n.property)}]`;B(e,t,n.schema,o)}function gy(e,t,n,r,o){let i=n._zod.def.tx;if(!i)throw new Z("overwrite check without a transform function");if(bt(i))throw new ve("z.compile: async overwrite transforms are not supported");let s=P(t,i);e.write(`const ${o} = ${s}(${r});`)}function Lc(){throw new ce}function jc(e){this.issues.push(e)}function yy(e,t,n,r){let o=n._zod.def;if(o.fn){if(bt(o.fn))throw new ve("z.compile: async .refine() predicates are not supported");let i=yt(t,o.fn),s=P(t,Lc),a=z(t);return e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`),r}if(n._zod.check){if(bt(n._zod.check))throw new ve("z.compile: async .superRefine() / check functions are not supported");let i=n._zod.check,a=yt(t,u=>{let l={value:u,issues:[],addIssue:jc};return i(l)instanceof Promise&&Lc(),l.issues.length===0?l.value:re}),c=z(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}throw new Z("custom check without a predicate or check function")}var by=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 Vp(e,t,n,r,o=!0){let i=n.format;if(i==="base64"){let u=P(t,Vn);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="base64url"){let u=P(t,io);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="jwt"){let u=P(t,co),l=P(t,n.alg??null);return e.write(`if (!${u}(${r}, ${l})) return INVALID;`),r}if(i==="ipv6"){let u=P(t,Mn);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="cidrv6"){let u=P(t,ro);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="credit_card"){let u=P(t,so);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(i==="iban"){let u=P(t,ao);return e.write(`if (!${u}(${r})) return INVALID;`),r}let s=n;if(i==="url"||i==="httpurl"||s.normalize||s.hostname!==void 0||s.protocol!==void 0){let u=P(t,eo),l=P(t,n),f=z(t),d=z(t);if(e.write(`const ${f} = ${r}.trim();`),e.write(`const ${d} = ${u}(${f}, ${l});`),e.write(`if (typeof ${d} === "number") return INVALID;`),s.hostname!==void 0){let b=P(t,to);e.write(`if (!${b}(${d}, ${l}.hostname)) return INVALID;`)}if(s.protocol!==void 0){let b=P(t,no);e.write(`if (!${b}(${d}, ${l}.protocol)) return INVALID;`)}if(!o)return null;let m=z(t),g=s.normalize?`${d}.href`:`${P(t,jn)}(${f})`;return e.write(`const ${m} = ${g};`),m}let a=n.fn;if(a){if(bt(a))throw new Z(`async string format ${i}`);let u=P(t,a);return e.write(`if (!${u}(${r})) return INVALID;`),r}if(by.has(i)&&n.pattern){let u=P(t,n.pattern);return e.write(`${u}.lastIndex = 0;`),e.write(`if (!${u}.test(${r})) return INVALID;`),r}let c=n.format;switch(c){case"regex":throw new Z("regex format without a pattern");case"lowercase":e.write(`if (${r} !== ${r}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${r} !== ${r}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${r}.includes(${te(n.includes)})) return INVALID;`);break;case"starts_with":{let u=n.prefix;e.write(`if (${r}.slice(0, ${u.length}) !== ${te(u)}) return INVALID;`);break}case"ends_with":{let u=n.suffix;e.write(`if (${r}.slice(-${u.length}) !== ${te(u)}) return INVALID;`);break}default:throw new Z(`string format ${c}`)}return r}function B(e,t,n,r,o=!0){let i=n._zod.def,s=i.type;if(i.coerce)throw new Z(`coercion (z.coerce.${s}())`);let a=o||!!i.checks?.length,c;switch(s){case"string":c=_y(e,t,n,r,a);break;case"number":c=$y(e,n,r);break;case"boolean":c=wy(e,r);break;case"bigint":c=vy(e,n,r);break;case"symbol":c=ky(e,r);break;case"undefined":c=xy(e,r);break;case"null":c=zy(e,r);break;case"any":case"unknown":c=r;break;case"never":e.write("return INVALID;"),c=r;break;case"void":c=Sy(e,r);break;case"nan":c=Iy(e,r);break;case"date":c=Py(e,r);break;case"object":c=Oy(e,t,n,r,a);break;case"optional":c=Ay(e,t,n,r,a);break;case"nullable":c=Zy(e,t,n,r,a);break;case"array":c=Ty(e,t,n,r,a);break;case"literal":c=Cy(e,t,n,r);break;case"enum":c=Ly(e,t,n,r);break;case"readonly":{let u=Lp(e,t,n,r),l=z(t);e.write(`const ${l} = Object.freeze(${u});`),c=l;break}case"success":Lp(e,t,n,r),c="true";break;case"default":case"prefault":c=Ry(e,t,n,r);break;case"nonoptional":c=Dy(e,t,n,r);break;case"tuple":c=jy(e,t,n,r);break;case"union":c=My(e,t,n,r);break;case"intersection":c=Uy(e,t,n,r);break;case"record":c=By(e,t,n,r);break;case"map":c=Ky(e,t,n,r);break;case"set":c=qy(e,t,n,r);break;case"file":c=Hy(e,r);break;case"template_literal":c=Wy(e,t,n,r);break;case"lazy":c=Gy(e,t,n,r);break;case"pipe":c=Yy(e,t,n,r);break;case"custom":c=Xy(e,t,n,r);break;case"transform":c=tb(e,t,n,r);break;case"catch":c=eb(e,t,n,r);break;default:throw new Z(`schema type ${s}`)}return c===null?null:cy(e,t,n,c)}function _y(e,t,n,r,o=!0){e.write(`if (typeof ${r} !== "string") return INVALID;`);let i=n._zod.def;return i.format===void 0?r:Vp(e,t,i,r,o)}function $y(e,t,n){e.write(`if (typeof ${n} !== "number" || !Number.isFinite(${n})) return INVALID;`);let r=t._zod.def;return r.check==="number_format"&&r.format&&Mp(e,{format:r.format},n),n}function wy(e,t){return e.write(`if (typeof ${t} !== "boolean") return INVALID;`),t}function vy(e,t,n){e.write(`if (typeof ${n} !== "bigint") return INVALID;`);let r=t._zod.def;if(r.format)switch(r.format){case"int64":e.write(`if (${n} < -9223372036854775808n || ${n} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${n} < 0n || ${n} > 18446744073709551615n) return INVALID;`);break}return n}function ky(e,t){return e.write(`if (typeof ${t} !== "symbol") return INVALID;`),t}function xy(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function zy(e,t){return e.write(`if (${t} !== null) return INVALID;`),t}function Sy(e,t){return e.write(`if (${t} !== undefined) return INVALID;`),t}function Iy(e,t){return e.write(`if (typeof ${t} !== "number" || !Number.isNaN(${t})) return INVALID;`),t}function Py(e,t){return e.write(`if (!(${t} instanceof Date) || Number.isNaN(${t}.getTime())) return INVALID;`),t}function Oy(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) return INVALID;`);let s=i.shape,a=Object.keys(s),c=Object.getOwnPropertySymbols(s),u=c.length?[...a,...c]:a,l=x=>typeof x=="symbol"?P(t,x):te(x),f=x=>typeof x=="symbol"?`[${l(x)}]`:te(x),d=s;if(a.includes("__proto__"))throw new Z('object shape key "__proto__"');let m=new Map;for(let x of u){let A=d[x],C=l(x),V=z(t);if(e.write(`const ${V} = ${r}[${C}];`),A._zod.optin!==void 0){let T=z(t);e.write(`let ${T} = (() => {`),e.indented(X=>{let _n=Q(X,t,A,V);X.write(`return ${_n};`)}),e.write("})();"),A._zod.optout==="optional"?(e.write(`if (${T} === INVALID) {`),e.indented(X=>{X.write(`if (${C} in ${r}) return INVALID;`),X.write(`${T} = undefined;`)}),e.write("}")):e.write(`if (${T} === INVALID) return INVALID;`),m.set(x,T)}else{Ny(A)&&e.write(`if (!(${C} in ${r})) return INVALID;`);let T=Q(e,t,A,V,o);T!==null&&m.set(x,T)}}let g=i.catchall,b="none";if(g){let x=g._zod.def.type;if(x==="never"){let A=a.map(C=>`k !== ${te(C)}`).join(" && ")||"true";e.write(`for (const k in ${r}) {`),e.indented(C=>{C.write(`if (${A}) return INVALID;`)}),e.write("}")}else(x==="unknown"||x==="any")&&!g._zod.def.checks?.length?b="passthrough":b="schema"}let $=z(t),I=u.some(x=>Cp(d[x])||Rc(d[x]));if(!o){if(b==="schema"){let x=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(A=>{A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`);let C=z(t);A.write(`const ${C} = ${r}[k];`),Q(A,t,g,C,!1)}),e.write("}")}return null}if(I){e.write(`const ${$} = {};`);for(let x of u){let A=l(x),C=m.get(x);Rc(d[x])?e.write(`if (${A} in ${r}) ${$}[${A}] = ${C};`):Cp(d[x])?e.write(`if (${C} !== undefined || ${A} in ${r}) ${$}[${A}] = ${C};`):e.write(`${$}[${A}] = ${C};`)}}else{let x=u.map(A=>`${f(A)}: ${m.get(A)}`).join(", ");e.write(`const ${$} = { ${x} };`)}if(b!=="none"){let x=a.length>0?P(t,new Set(a)):null;e.write(`for (const k in ${r}) {`),e.indented(A=>{if(A.write('if (k === "__proto__") continue;'),x&&A.write(`if (${x}.has(k)) continue;`),b==="passthrough")A.write(`${$}[k] = ${r}[k];`);else{let C=z(t);A.write(`const ${C} = ${r}[k];`);let V=Q(A,t,g,C);A.write(`${$}[k] = ${V};`)}}),e.write("}")}return $}function Ay(e,t,n,r,o=!0){let i=n._zod.def;if(Ey(n))return B(e,t,i.innerType,r,o);if(i.innerType._zod.optin==="defaulted"){let a=z(t),c=z(t);return e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(u=>{u.write(`const ${c} = (() => {`),u.indented(l=>{let f=B(l,t,i.innerType,r);l.write(`return ${f};`)}),u.write("})();"),u.write(`if (${c} !== INVALID) ${a} = ${c};`)}),e.write("} else {"),e.indented(u=>{let l=B(u,t,i.innerType,r);u.write(`${a} = ${l};`)}),e.write("}"),a}let s=o?z(t):null;return s&&e.write(`let ${s};`),e.write(`if (${r} !== undefined) {`),e.indented(a=>{let c=B(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Ey(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function Ny(e){return e._zod.optin===void 0&&gt(e)}function gt(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?gt(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?gt(t.innerType):!0;case"catch":return!0;case"union":return t.options?t.options.some(gt):!0;case"intersection":return!t.left||!t.right?!0:gt(t.left)&&gt(t.right);case"pipe":return t.in?gt(t.in):!0;default:return!0}}function Rc(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function Cp(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&Bt(e)}function Bt(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?Bt(t.innerType):!0;case"union":return t.options?t.options.some(Bt):!0;case"intersection":return!t.left||!t.right||Bt(t.left)||Bt(t.right);case"pipe":return t.out?Bt(t.out):!0;default:return!0}}function Zy(e,t,n,r,o=!0){let i=n._zod.def,s=o?z(t):null;return s&&e.write(`let ${s} = null;`),e.write(`if (${r} !== null) {`),e.indented(a=>{let c=B(a,t,i.innerType,r,o);s&&c!==null&&a.write(`${s} = ${c};`)}),e.write("}"),s}function Mc(e,t,n){for(let[r,o]of Ct(t._zod.def.checks))e.write(`if (${n} > ${We(r,o._zod.def.check)}) return INVALID;`)}function Ty(e,t,n,r,o=!0){let i=n._zod.def;e.write(`if (!Array.isArray(${r})) return INVALID;`),Mc(e,n,`${r}.length`);let s=o?z(t):null,a=z(t),c=z(t);return s&&e.write(`const ${s} = new Array(${r}.length);`),e.write(`for (let ${a} = 0; ${a} < ${r}.length; ${a}++) {`),e.indented(u=>{u.write(`const ${c} = ${r}[${a}];`);let l=Q(u,t,i.element,c,o);s&&l!==null&&u.write(`${s}[${a}] = ${l};`)}),e.write("}"),s}function Cy(e,t,n,r){let i=n._zod.def.values;if(i.length!==1){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}let s=i[0];if(typeof s=="number"&&Number.isNaN(s)){let a=P(t,new Set(i));return e.write(`if (!${a}.has(${r})) return INVALID;`),r}if(typeof s=="string")e.write(`if (${r} !== ${te(s)}) return INVALID;`);else if(typeof s=="number"||typeof s=="boolean")e.write(`if (${r} !== ${s}) return INVALID;`);else if(s===null)e.write(`if (${r} !== null) return INVALID;`);else if(s===void 0)e.write(`if (${r} !== undefined) return INVALID;`);else if(typeof s=="bigint")e.write(`if (${r} !== ${s}n) return INVALID;`);else throw new Z(`literal type ${typeof s}`);return r}function Ly(e,t,n,r){let o=n._zod.values;if(!o)throw new Z("enum schema without enumerated values");let i=P(t,o);return e.write(`if (!${i}.has(${r})) return INVALID;`),r}function Lp(e,t,n,r){let o=n._zod.def;return B(e,t,o.innerType,r)}function Ry(e,t,n,r){let o=n._zod.def,s=Object.getOwnPropertyDescriptor(n._zod.def,"defaultValue")?()=>n._zod.def.defaultValue:void 0;if(n._zod.def.type==="prefault"){if(!s)return B(e,t,o.innerType,r);let c=P(t,s),u=z(t);return e.write(`let ${u} = ${r};`),e.write(`if (${r} === undefined) ${u} = ${c}();`),B(e,t,o.innerType,u)}let a=z(t);if(s){let c=P(t,s),u=P(t,vn);e.write(`let ${a};`),e.write(`if (${r} === undefined) {`),e.indented(l=>{l.write(`${a} = ${u}(${c}());`)}),e.write("} else {"),e.indented(l=>{let f=B(l,t,o.innerType,r);l.write(`${a} = ${f} === undefined ? ${u}(${c}()) : ${f};`)}),e.write("}")}else e.write(`let ${a};`),e.write(`if (${r} !== undefined) {`),e.indented(c=>{let u=B(c,t,o.innerType,r);c.write(`${a} = ${u};`)}),e.write("}");return a}function Dy(e,t,n,r){let o=n._zod.def,i=B(e,t,o.innerType,r),s=z(t);return e.write(`const ${s} = ${i};`),e.write(`if (${s} === undefined) return INVALID;`),s}function jy(e,t,n,r){let o=n._zod.def,i=o.items,s=o.rest;e.write(`if (!Array.isArray(${r})) return INVALID;`);let a=Rp(i,"optin"),c=Rp(i,"optout");s?e.write(`if (${r}.length < ${a}) return INVALID;`):e.write(`if (${r}.length < ${a} || ${r}.length > ${i.length}) return INVALID;`);let u=z(t);e.write(`const ${u} = [];`);for(let l=0;l<i.length;l++){let f=i[l];if(l>=c)e.write(`if (${u}.length === ${l}) {`),e.indented(d=>{d.write(`if (${l} < ${r}.length) {`),d.indented(m=>{let g=z(t);m.write(`const ${g} = ${r}[${l}];`);let b=Q(m,t,f,g);m.write(`${u}[${l}] = ${b};`)}),d.write("} else {"),d.indented(m=>{if(Rc(f)){m.write(`${u}.length = ${l};`);return}let g=z(t),b=z(t);m.write(`const ${g} = undefined;`),m.write(`const ${b} = (() => {`),m.indented($=>{let I=Q($,t,f,g);$.write(`return ${I};`)}),m.write("})();"),m.write(`if (${b} === INVALID || ${b} === undefined) ${u}.length = ${l};`),m.write(`else ${u}[${l}] = ${b};`)}),d.write("}")}),e.write("}");else{let d=z(t);e.write(`const ${d} = ${r}[${l}];`);let m=Q(e,t,f,d);e.write(`${u}[${l}] = ${m};`)}}if(s){let l=z(t),f=z(t);e.write(`for (let ${l} = ${i.length}; ${l} < ${r}.length; ${l}++) {`),e.indented(d=>{d.write(`const ${f} = ${r}[${l}];`);let m=Q(d,t,s,f);d.write(`${u}[${l}] = ${m};`)}),e.write("}")}return u}function Rp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function My(e,t,n,r){let o=n._zod.def,i=o.options;if(o.discriminator)return Vy(e,t,o,r);if(o.inclusive===!1)throw new Z("exclusive unions (z.xor)");if(i.length===0)return e.write("return INVALID;"),r;if(i.length===1)return B(e,t,i[0],r);if(i.every(c=>c._zod.def.type==="literal"&&!c._zod.def.checks?.length)){let c=new Set(i.flatMap(l=>l._zod.def.values)),u=P(t,c);return e.write(`if (!${u}.has(${r})) return INVALID;`),r}let a=z(t);e.write(`let ${a};`);for(let c=0;c<i.length;c++){let u=i[c];c===0?e.write(`${a} = (() => {`):e.write(`if (${a} === INVALID) ${a} = (() => {`),e.indented(l=>{let f=B(l,t,u,r);l.write(`return ${f};`)}),e.write("})();")}return e.write(`if (${a} === INVALID) return INVALID;`),a}function Vy(e,t,n,r){if(n.unionFallback)throw new Z("discriminated union with unionFallback");if(n.options.length===0)return e.write("return INVALID;"),r;let o=z(t),i=z(t);e.write(`const ${o} = ${r}?.[${te(n.discriminator)}];`),e.write(`let ${i};`);let s=!0,a=new Set;for(let c of n.options){let u=c._zod.propValues?.[n.discriminator];if(!u||u.size===0)throw new Z("discriminated union option without static discriminator values");for(let d of u){if(a.has(d))throw new Z(`duplicate discriminator value ${String(d)}`);a.add(d)}let l=Array.from(u,d=>Fy(t,o,d)),f=s?"if":"else if";e.write(`${f} (${l.join(" || ")}) {`),e.indented(d=>{let m=B(d,t,c,r);d.write(`${i} = ${m};`)}),e.write("}"),s=!1}return e.write("else { return INVALID; }"),i}function Fy(e,t,n){if(typeof n=="string")return`${t} === ${te(n)}`;if(typeof n=="number")return Number.isNaN(n)?`Number.isNaN(${t})`:`${t} === ${n}`;if(typeof n=="boolean")return`${t} === ${n}`;if(n===null)return`${t} === null`;if(n===void 0)return`${t} === undefined`;if(typeof n=="bigint")return`${t} === ${n}n`;if(typeof n=="symbol"){let r=P(e,n);return`${t} === ${r}`}throw new Z(`literal discriminator value ${String(n)}`)}function Uy(e,t,n,r){let o=n._zod.def;t.definite=!1;let i=Q(e,t,o.left,r),s=Q(e,t,o.right,r),a=P(t,Ft),c=z(t);return e.write(`const ${c} = ${a}(${i}, ${s});`),e.write(`if (!${c}.valid) return INVALID;`),`${c}.data`}function By(e,t,n,r){let o=n._zod.def,i=P(t,be);e.write(`if (!${i}(${r})) return INVALID;`);let s=z(t),a=z(t),c=z(t);e.write(`const ${s} = {};`);let u=o,l=u.partial?void 0:o.keyType._zod.values;if(l){let m=[];for(let b of l){if(!(typeof b=="string"||typeof b=="number"||typeof b=="symbol"))throw new Z(`record key value ${String(b)}`);let $=typeof b=="number"?b.toString():b;if($==="__proto__")throw new Z('record key "__proto__"');m.push($);let I=P(t,b),x=B(e,t,o.keyType,I),A=z(t);e.write(`const ${A} = ${r}[${Jy(t,$)}];`);let C=Q(e,t,o.valueType,A);e.write(`${s}[${x}] = ${C};`)}let g=P(t,new Set(m));return e.write(`for (const ${a} in ${r}) {`),e.indented(b=>{b.write(`if (${g}.has(${a})) continue;`),u.mode==="loose"?b.write(`if (${a} !== "__proto__") ${s}[${a}] = ${r}[${a}];`):b.write("return INVALID;")}),e.write("}"),s}let f=o.keyType._zod.def;if(!(f.type==="string"&&f.format===void 0&&!f.coerce&&(f.checks?.length??0)===0)){let m=o.mode==="loose",g=zo(o.keyType);g.definite===!1&&(t.definite=!1);let b=P(t,g),$=P(t,Re),I=z(t);return Dp(e,t,r,a,x=>{x.write(`let ${I} = ${b}(${a});`),x.write(`if (${I} === INVALID && typeof ${a} === "string" && ${$}.test(${a})) ${I} = ${b}(Number(${a}));`),m?x.write(`if (${I} === INVALID) { ${s}[${a}] = ${r}[${a}]; continue; }`):x.write(`if (${I} === INVALID) return INVALID;`),x.write(`if (${I} === "__proto__") continue;`);let A=z(t);x.write(`const ${A} = ${r}[${a}];`);let C=Q(x,t,o.valueType,A);x.write(`${s}[${I}] = ${C};`)}),s}return Dp(e,t,r,a,m=>{m.write(`const ${c} = ${r}[${a}];`);let g=Q(m,t,o.valueType,c);m.write(`${s}[${a}] = ${g};`)},"return INVALID;"),s}function Dp(e,t,n,r,o,i){let s=P(t,Object.prototype.propertyIsEnumerable),a=z(t),c=z(t),u=z(t);e.write(`const ${a} = Object.getOwnPropertySymbols(${n});`),e.write(`const ${c} = Object.getOwnPropertyNames(${n});`),e.write(`for (let ${u} = 0; ${u} < ${c}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${c}[${u}];`),l.write(`if (${r} === "__proto__" || !${s}.call(${n}, ${r})) continue;`),o(l)}),e.write("}"),e.write(`for (let ${u} = 0; ${u} < ${a}.length; ${u}++) {`),e.indented(l=>{l.write(`const ${r} = ${a}[${u}];`),l.write(`if (!${s}.call(${n}, ${r})) continue;`),i?l.write(i):o(l)}),e.write("}")}function Jy(e,t){return typeof t=="string"?te(t):P(e,t)}function Ky(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Map)) return INVALID;`),Mc(e,n,`${r}.size`);let i=z(t),s=z(t),a=z(t);return e.write(`const ${i} = new Map();`),e.write(`for (const [${s}, ${a}] of ${r}) {`),e.indented(c=>{let u=B(c,t,o.keyType,s),l=B(c,t,o.valueType,a);c.write(`${i}.set(${u}, ${l});`)}),e.write("}"),i}function qy(e,t,n,r){let o=n._zod.def;e.write(`if (!(${r} instanceof Set)) return INVALID;`),Mc(e,n,`${r}.size`);let i=z(t),s=z(t);return e.write(`const ${i} = new Set();`),e.write(`for (const ${s} of ${r}) {`),e.indented(a=>{let c=B(a,t,o.valueType,s);a.write(`${i}.add(${c});`)}),e.write("}"),i}function Hy(e,t){return e.write(`if (!(${t} instanceof File)) return INVALID;`),t}function Wy(e,t,n,r){e.write(`if (typeof ${r} !== "string") return INVALID;`);let o=n._zod.pattern;if(o){let i=P(t,o);e.write(`${i}.lastIndex = 0;`),e.write(`if (!${i}.test(${r})) return INVALID;`)}return r}function Gy(e,t,n,r){let o=n._zod.def,i=yt(t,o.getter),s=P(t,{parser:null});e.write(`if (!${s}.parser) {`),e.indented(c=>{c.write(`const inner = ${i}();`),c.write(`${s}.parser = function(input) {`),c.indented(u=>{u.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),u.write("return result.issues.length === 0 ? result.value : INVALID;")}),c.write("};")}),e.write("}");let a=z(t);return e.write(`const ${a} = ${s}.parser(${r});`),e.write(`if (${a} === INVALID) return INVALID;`),a}function Yy(e,t,n,r){let o=n._zod.def,i=B(e,t,o.in,r);if(o.transform){if(bt(o.transform))throw new ve("z.compile: async transforms in pipes are not supported");let s=o.transform,c=yt(t,l=>{let f={value:l,issues:[],addIssue:jc},d=s(l,f);return d instanceof Promise?re:f.issues.length===0?d:re}),u=z(t);return e.write(`const ${u} = ${c}(${i});`),e.write(`if (${u} === INVALID) return INVALID;`),B(e,t,o.out,u)}else return B(e,t,o.out,i)}function bt(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function Xy(e,t,n,r){let o=n._zod.def;if(o.fn){if(bt(o.fn))throw new ve("z.compile: async custom predicates are not supported");let i=yt(t,o.fn),s=P(t,Lc),a=z(t);e.write(`const ${a} = ${i}(${r});`),e.write(`if (${a} instanceof Promise) ${s}();`),e.write(`if (!${a}) return INVALID;`)}else throw new Z("custom schema without a predicate function");return r}function Qy(e,t,n){let r=e._zod.run({value:n,issues:[]},{});if(r&&typeof r.then=="function")return re;let o=r;return o.issues.length===0?o.value:t()}function eb(e,t,n,r){let o=n._zod.def;if(!o.catchValue[Er])throw new Z("catch with a callback (only a constant catch value compiles)",!1);let i=z(t);e.write(`let ${i} = (() => {`),e.indented(u=>{let l=Q(u,t,o.innerType,r);u.write(`return ${l};`)}),e.write("})();");let s=P(t,o.innerType),a=yt(t,o.catchValue),c=P(t,Qy);return e.write(`if (${i} === INVALID) {`),e.indented(u=>{u.write(`${i} = ${c}(${s}, ${a}, ${r});`),u.write(`if (${i} === INVALID) return INVALID;`)}),e.write("}"),i}function tb(e,t,n,r){let o=n._zod.def;if(o.transform){if(bt(o.transform))throw new ve("z.compile: async transforms are not supported");let i=o.transform,a=yt(t,u=>{let l={value:u,issues:[],addIssue:jc},f=i(u,l);return f instanceof Promise?re:l.issues.length===0?f:re}),c=z(t);return e.write(`const ${c} = ${a}(${r});`),e.write(`if (${c} === INVALID) return INVALID;`),c}return r}function So(e){return e.checks&&(e.checks=[...e.checks]),e}function Vc(e,t){return new e(So({type:"string",..._(t)}))}function Fc(e,t){return new e(So({type:"string",coerce:!0,..._(t)}))}function Io(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._(t)})}function Po(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._(t)})}function Oo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._(t)})}function Ao(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._(t)})}function Eo(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._(t)})}function No(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._(t)})}function Yn(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._(t)})}function Zo(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._(t)})}function To(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._(t)})}function Co(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._(t)})}function Lo(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._(t)})}function Ro(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._(t)})}function Do(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._(t)})}function jo(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._(t)})}function Mo(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._(t)})}function Vo(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._(t)})}function Uc(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,..._(t)})}function Fo(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._(t)})}function Uo(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._(t)})}function Bo(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._(t)})}function Jo(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._(t)})}function Ko(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._(t)})}function Bc(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,..._(t)})}function Jc(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,..._(t)})}function qo(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._(t)})}var Kc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Xn(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._(t)})}function Qn(e,t){return new e({type:"string",format:"date",check:"string_format",..._(t)})}function er(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._(t)})}function tr(e,t){return new e({type:"string",format:"duration",check:"string_format",..._(t)})}function qc(e,t){return new e(So({type:"number",checks:[],..._(t)}))}function Hc(e,t){return new e(So({type:"number",coerce:!0,checks:[],..._(t)}))}function Wc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",..._(t)})}function Gc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",..._(t)})}function Yc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",..._(t)})}function Xc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",..._(t)})}function Qc(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",..._(t)})}function eu(e,t){return new e({type:"boolean",..._(t)})}function tu(e,t){return new e({type:"boolean",coerce:!0,..._(t)})}function nu(e,t){return new e({type:"bigint",..._(t)})}function ru(e,t){return new e({type:"bigint",coerce:!0,..._(t)})}function ou(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",..._(t)})}function iu(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",..._(t)})}function su(e,t){return new e({type:"symbol",..._(t)})}function au(e,t){return new e({type:"undefined",..._(t)})}function cu(e,t){return new e({type:"null",..._(t)})}function uu(e){return new e({type:"any"})}function lu(e){return new e({type:"unknown"})}function fu(e,t){return new e({type:"never",..._(t)})}function pu(e,t){return new e({type:"void",..._(t)})}function du(e,t){return new e({type:"date",..._(t)})}function mu(e,t){return new e({type:"date",coerce:!0,..._(t)})}function hu(e,t){return new e({type:"nan",..._(t)})}function Ie(e,t){return new qr({check:"less_than",..._(t),value:e,inclusive:!1})}function me(e,t){return new qr({check:"less_than",..._(t),value:e,inclusive:!0})}function Pe(e,t){return new Hr({check:"greater_than",..._(t),value:e,inclusive:!1})}function he(e,t){return new Hr({check:"greater_than",..._(t),value:e,inclusive:!0})}function Ho(e){return Pe(0,e)}function Wo(e){return Ie(0,e)}function Go(e){return me(0,e)}function Yo(e){return he(0,e)}function Ge(e,t){return new Ys({check:"multiple_of",..._(t),value:e})}function Ye(e,t){return new ea({check:"max_size",..._(t),maximum:e})}function Oe(e,t){return new ta({check:"min_size",..._(t),minimum:e})}function _t(e,t){return new na({check:"size_equals",..._(t),size:e})}function $t(e,t){return new ra({check:"max_length",..._(t),maximum:e})}function De(e,t){return new oa({check:"min_length",..._(t),minimum:e})}function wt(e,t){return new ia({check:"length_equals",..._(t),length:e})}function Jt(e,t){return new sa({check:"string_format",format:"regex",..._(t),pattern:e})}function Kt(e){return new aa({check:"string_format",format:"lowercase",..._(e)})}function qt(e){return new ca({check:"string_format",format:"uppercase",..._(e)})}function Ht(e,t){return new ua({check:"string_format",format:"includes",..._(t),includes:e})}function Wt(e,t){return new la({check:"string_format",format:"starts_with",..._(t),prefix:e})}function Gt(e,t){return new fa({check:"string_format",format:"ends_with",..._(t),suffix:e})}function Xo(e,t,n){return new pa({check:"property",property:e,schema:t,..._(n)})}function Yt(e,t){return new da({check:"properties",shape:e,..._(t)})}function Xt(e,t){return new ma({check:"mime_type",mime:e,..._(t)})}function ke(e){return new ha({check:"overwrite",tx:e})}function Qt(e){return ke(t=>t.normalize(e))}function en(){return ke(e=>e.trim())}function tn(){return ke(e=>e.toLowerCase())}function nn(){return ke(e=>e.toUpperCase())}function rn(){return ke(e=>Xi(e))}function gu(e,t,n){return new e({type:"array",element:t,..._(n)})}function nb(e,t,n){return new e({type:"union",options:t,..._(n)})}function rb(e,t,n){return new e({type:"union",options:t,inclusive:!1,..._(n)})}function ob(e,t,n,r){return new e({type:"union",options:n,discriminator:t,..._(r)})}function ib(e,t,n){return new e({type:"intersection",left:t,right:n})}function sb(e,t,n,r){let o=n instanceof O,i=o?r:n,s=o?n:null;return new e({type:"tuple",items:t,rest:s,..._(i)})}function ab(e,t,n,r){return new e({type:"record",keyType:t,valueType:n,..._(r)})}function cb(e,t,n,r){return new e({type:"map",keyType:t,valueType:n,..._(r)})}function ub(e,t,n){return new e({type:"set",valueType:t,..._(n)})}function lb(e,t,n){let r=Array.isArray(t)?Object.fromEntries(t.map(o=>[o,o])):t;return new e({type:"enum",entries:r,..._(n)})}function fb(e,t,n){return new e({type:"enum",entries:t,..._(n)})}function pb(e,t,n){return new e({type:"literal",values:Array.isArray(t)?t:[t],..._(n)})}function yu(e,t){return new e({type:"file",..._(t)})}function db(e,t){return new e({type:"transform",transform:t})}function mb(e,t){return new e({type:"optional",innerType:t})}function hb(e,t){return new e({type:"nullable",innerType:t})}function gb(e,t,n){return new e({type:"default",innerType:t,get defaultValue(){return typeof n=="function"?n():vn(n)}})}function yb(e,t,n){return new e({type:"nonoptional",innerType:t,..._(n)})}function bb(e,t){return new e({type:"success",innerType:t})}function _b(e,t,n){return new e({type:"catch",innerType:t,catchValue:typeof n=="function"?n:is(n)})}function $b(e,t,n){return new e({type:"pipe",in:t,out:n})}function wb(e,t){return new e({type:"readonly",innerType:t})}function vb(e,t,n){return new e({type:"template_literal",parts:t,..._(n)})}function kb(e,t){return new e({type:"lazy",getter:t})}function xb(e,t){return new e({type:"promise",innerType:t})}function bu(e,t,n){let r=_(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function _u(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._(n)})}function $u(e,t){let n=Fp(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Lt(o,r.value,n._zod.def));else{let i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),"input"in i||(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Lt(i))}},e(r.value,r)),t);return n}function Fp(e,t){let n=new M({check:"custom",..._(t)});return n._zod.check=e,n}function wu(e){let t=new M({check:"describe"});return t._zod.onattach=[n=>{let r=Y.get(n)??{};Y.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function vu(e){let t=new M({check:"meta"});return t._zod.onattach=[n=>{let r=Y.get(n)??{};Y.add(n,{...r,...e})}],t._zod.check=()=>{},t}function ku(e,t){let n=_(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];n.case!=="sensitive"&&(r=r.map(m=>typeof m=="string"?m.toLowerCase():m),o=o.map(m=>typeof m=="string"?m.toLowerCase():m));let i=new Set(r),s=new Set(o),a=e.Codec??Jn,c=e.Boolean??Un,u=e.String??ht,l=new u({type:"string",error:n.error}),f=new c({type:"boolean",error:n.error}),d=new a({type:"pipe",in:l,out:f,transform:((m,g)=>{let b=m;return n.case!=="sensitive"&&(b=b.toLowerCase()),i.has(b)?!0:s.has(b)?!1:(g.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:g.value,inst:d,continue:!1}),{})}),reverseTransform:((m,g)=>m===!0?r[0]||"true":o[0]||"false"),error:n.error});return d._zod.bag.truthy=r,d._zod.bag.falsy=o,d._zod.bag.case=n.case??"insensitive",d}function vt(e,t,n,r={}){let o=_(r),i={check:"string_format",type:"string",format:t,fn:typeof n=="function"?n:a=>n.test(a),...o};return n instanceof RegExp&&(i.pattern=n),new e(i)}function nr(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,r)&&G(e,r,n[r]);return e}function Xe(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??Y,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function K(e,t,n,r,o){let i=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw new Error(o);return Object.assign(n,i),!0}function D(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let l={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,l);else{let d=s.schema,m=t.processors[o.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,t,d,l)}let f=e._zod.parent;f&&(s.ref||(s.ref=f),D(f,t,l),t.seen.get(f).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&nr(s.schema,c),t.io==="input"&&oe(e)&&(delete s.schema.examples,delete s.schema.default),t.io==="input"&&"_prefault"in s.schema&&((r=s.schema).default??(r.default=s.schema._prefault)),delete s.schema._prefault,t.seen.get(e).schema}function Up(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Qe(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=s=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,d=e.external.uri??(g=>g);if(f)return{ref:d(f)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${d("__shared")}#/${a}/${Up(m)}`}}let c="#",u=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let l=s[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:u+Up(l)}},i=s=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:u}=o(s);a.def={...a.schema},u&&(a.defId=u);let l=a.schema;for(let f in l)delete l[f];l.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
61
61
 
62
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Jp(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;Jp(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Kp=new Set(["type","properties","required","additionalProperties"]),Up=["oneOf","anyOf"];function Bp(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function xu(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!Kp.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Bp(u);l!=null&&(a.some(f=>JSON.stringify(f)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:xu(a)??{allOf:a};G(n,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Bp(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function $b(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Kp)if(o in e)return;let n=t.filter(o=>Up.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=xu(t);else{let o=n[0],i=Up.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>xu([...s,c]));if(a.some(c=>!c))return;r={[i]:a}}r&&(delete e.allOf,nr(e,r))}function et(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){r(f);let d=e.seen.get(f),g=d.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):nr(u,g),nr(u,l),a._zod.parent===f)for(let $ in u)$==="$ref"||$==="allOf"||$ in l||delete u[$];if(g.$ref&&d.def)for(let $ in u)$==="$ref"||$==="allOf"||$ in d.def&&JSON.stringify(u[$])===JSON.stringify(d.def[$])&&delete u[$]}let m=a._zod.parent;if(m&&m!==f){r(m);let d=e.seen.get(m);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let g in u)g==="$ref"||g==="allOf"||g in d.def&&JSON.stringify(u[g])===JSON.stringify(d.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Jp(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=a.get(l);f?f.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])$b(u)}}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 a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}nr(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,G(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:on(t,"input",e.processors),output:on(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function re(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return re(r.element,n);if(r.type==="set")return re(r.valueType,n);if(r.type==="lazy")return re(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return re(r.innerType,n);if(r.type==="intersection")return re(r.left,n)||re(r.right,n);if(r.type==="record"||r.type==="map")return re(r.keyType,n)||re(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:re(r.in,n)||re(r.out,n);if(r.type==="object"){for(let o in r.shape)if(re(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(re(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(re(o,n))return!0;return!!(r.rest&&re(r.rest,n))}return!1}var zu=(e,t={})=>n=>{let r=Xe({...n,processors:t});return D(e,r),Qe(r,e),et(r,e)},on=(e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},s=Xe({...o??{},target:i,io:t,processors:n});return D(e,s),Qe(s,e),et(s,e)};var sn=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},an=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},qp=(e,t)=>{sn(e,"minimum",t),an(e,"maximum",t)},Yp=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Xp=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},Qp=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},ed=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Wp=(e,t)=>sn(e,"minimum",t.minimum),Hp=(e,t)=>an(e,"maximum",t.maximum),Gp=e=>(t,n)=>{ed(t,n.format);let[r,o]=e[n.format];sn(t,"minimum",r),an(t,"maximum",o)},wb={greater_than:(e,t)=>sn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>an(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Yp(e,t.value),number_format:Gp(xn),bigint_format:Gp(zn),min_length:Wp,max_length:Hp,length_equals:(e,t)=>qp(e,t.length),min_size:Wp,max_size:Hp,size_equals:(e,t)=>qp(e,t.size),string_format:(e,t)=>{ed(e,t.format),t.pattern&&Xp(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Qp(e,t.mime)};function K(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)wb[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&sn(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&sn(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&an(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&an(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Yp(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&Qp(t,o.mime);for(let i of o.patterns??[])Xp(t,i);return t}var vb={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},kb=new Map([[ro,Es],[Fn,Zs]]),td=e=>kb.get(e)??e,Pu=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=K(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=vb[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let f=[...c].map(td);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(m=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:m.source}))])}},Ou=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=K(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";if(f?d?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),m?d?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let g=new Set;for(let S of a)Number.isFinite(S)&&S!==0?g.add(Math.abs(S)):J(e,t,o,r,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[b,...$]=g;b!==void 0&&(o.multipleOf=b),$.length&&(o.allOf=[...o.allOf??[],...$.map(S=>({multipleOf:S}))])}},Au=(e,t,n,r)=>{n.type="boolean"},Eu=(e,t,n,r)=>{J(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Zu=(e,t,n,r)=>{J(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Nu=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Tu=(e,t,n,r)=>{J(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Cu=(e,t,n,r)=>{J(e,t,n,r,"Void cannot be represented in JSON Schema")},Lu=(e,t,n,r)=>{n.not={}},Ru=(e,t,n,r)=>{},Du=(e,t,n,r)=>{},ju=(e,t,n,r)=>{J(e,t,n,r,"Date cannot be represented in JSON Schema")},Mu=(e,t,n,r)=>{let o=e._zod.def,i=Et(o.entries);if(i.length===0){n.not={};return}i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},Vu=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(J(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(J(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},Fu=(e,t,n,r)=>{J(e,t,n,r,"NaN cannot be represented in JSON Schema")},Uu=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Bu=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=K(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},Ju=(e,t,n,r)=>{n.type="boolean"},Ku=(e,t,n,r)=>{J(e,t,n,r,"Custom types cannot be represented in JSON Schema")},qu=(e,t,n,r)=>{J(e,t,n,r,"Function types cannot be represented in JSON Schema")},Wu=(e,t,n,r)=>{J(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Hu=(e,t,n,r)=>{J(e,t,n,r,"Map cannot be represented in JSON Schema")},Gu=(e,t,n,r)=>{J(e,t,n,r,"Set cannot be represented in JSON Schema")},Yu=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=K(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=D(i.element,t,{...r,path:[...r.path,"items"]})};function rr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?rr(t.out):t.type==="catch"?rr(t.innerType):e._zod.optin}var Xu=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&J(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)G(o.properties,u,D(s[u],t,{...r,path:[...r.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?rr(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Qo=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>D(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=s:n.anyOf=s},Qu=(e,t,n,r)=>{let o=e._zod.def,i=D(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=D(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},el=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((b,$)=>D(b,t,{...r,path:[...r.path,s,$]})),u=i.rest?D(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let b=i.items[l-1];if(!(t.io==="input"?rr(b)!==void 0:b._zod.optout==="optional"))break;l--}let f=i.items.length,m=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,m?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),m&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),m&&(o.maxItems=f)):(o.items=c,m?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),m&&(o.maxItems=f));let{minimum:d,maximum:g}=K(e);typeof d=="number"&&(o.minItems=d),typeof g=="number"&&(o.maxItems=g)};function Su(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let b=Su(e,g,n);return b===g?t:b}for(let g of["anyOf","oneOf"]){let b=t[g];if(!Array.isArray(b))continue;let $=b.map(S=>Su(e,S,n));$.some((S,x)=>S!==b[x])&&(t={...t,[g]:$})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.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:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,id:m,...d}=t;return d.enum?d.enum=d.enum.map(g=>typeof g=="number"?String(g):g):typeof d.const=="number"&&(d.const=String(d.const)),o&&(d.type="string",i||(d.pattern=(r.includes("number")?Le:Cn).source)),d}var Iu=new WeakMap;function xb(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of Iu.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Su(t,i,new Set);s!==i&&n.set(i,s)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}var tl=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=K(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=D(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let f of a)G(o.patternProperties,td(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Iu.get(t);l||(l=[],Iu.set(t,l),t.deferred.push(()=>xb(t))),l.push(e)}o.additionalProperties=D(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&rr(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},nl=(e,t,n,r)=>{let o=e._zod.def,i=D(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},rl=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ol=Symbol();function nd(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(J(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),ol):JSON.parse(s)}var il=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=nd(o.defaultValue,e,t,n,r);s!==ol&&(n.default=s)},sl=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=nd(o.defaultValue,e,t,n,r);s!==ol&&(n._prefault=s)},al=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{J(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},cl=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;D(s,t,r);let a=t.seen.get(e);a.ref=s},ul=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ll=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ei=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},fl=(e,t,n,r)=>{let o=e._zod.innerType;D(o,t,r);let i=t.seen.get(e);i.ref=o},Xo={string:Pu,number:Ou,boolean:Au,bigint:Eu,symbol:Zu,null:Nu,undefined:Tu,void:Cu,never:Lu,any:Ru,unknown:Du,date:ju,enum:Mu,literal:Vu,nan:Fu,template_literal:Uu,file:Bu,success:Ju,custom:Ku,function:qu,transform:Wu,map:Hu,set:Gu,array:Yu,object:Xu,union:Qo,intersection:Qu,tuple:el,record:tl,nullable:nl,nonoptional:rl,default:il,prefault:sl,catch:al,pipe:cl,readonly:ul,promise:ll,optional:ei,lazy:fl};function ti(e,t){if("_idmap"in e){let r=e,o=Xe({...t,processors:Xo}),i={};for(let c of r._idmap.entries()){let[u,l]=c;D(l,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[u,l]=c;Qe(o,l),G(s,u,et(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=Xe({...t,processors:Xo});return D(e,n),Qe(n,e),et(n,e)}var ni=class{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 n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Xe({processors:Xo,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return D(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Qe(this.ctx,t);let r=et(this.ctx,t),{"~standard":o,...i}=r;return i}};var rd={};var hn={};Ne(hn,{ZodAny:()=>Nl,ZodArray:()=>Rl,ZodBase64:()=>wi,ZodBase64URL:()=>vi,ZodBigInt:()=>dn,ZodBigIntFormat:()=>zi,ZodBoolean:()=>pn,ZodCIDRv4:()=>_i,ZodCIDRv6:()=>$i,ZodCUID:()=>pi,ZodCUID2:()=>di,ZodCatch:()=>of,ZodCodec:()=>dr,ZodCreditCard:()=>zl,ZodCustom:()=>mr,ZodCustomStringFormat:()=>St,ZodDate:()=>ar,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>jl,ZodE164:()=>ki,ZodEmail:()=>ci,ZodEmoji:()=>li,ZodEnum:()=>un,ZodExactOptional:()=>Oi,ZodFile:()=>Wl,ZodFunction:()=>hf,ZodGUID:()=>ui,ZodIBAN:()=>Sl,ZodIPv4:()=>yi,ZodIPv6:()=>bi,ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,ZodInstanceOf:()=>bf,ZodIntersection:()=>Ml,ZodJWT:()=>xi,ZodKSUID:()=>gi,ZodLazy:()=>pf,ZodLiteral:()=>ql,ZodMAC:()=>xl,ZodMap:()=>Jl,ZodNaN:()=>af,ZodNanoID:()=>fi,ZodNever:()=>Cl,ZodNonOptional:()=>Ai,ZodNull:()=>El,ZodNullable:()=>Yl,ZodNumber:()=>fn,ZodNumberFormat:()=>It,ZodObject:()=>ur,ZodOptional:()=>fr,ZodPipe:()=>pr,ZodPrefault:()=>ef,ZodPreprocess:()=>cf,ZodPromise:()=>mf,ZodReadonly:()=>uf,ZodRecord:()=>cn,ZodSet:()=>Kl,ZodString:()=>ln,ZodStringFormat:()=>j,ZodSuccess:()=>rf,ZodSymbol:()=>Ol,ZodTemplateLiteral:()=>ff,ZodTransform:()=>Hl,ZodTuple:()=>Fl,ZodType:()=>E,ZodULID:()=>mi,ZodURL:()=>sr,ZodUUID:()=>Ae,ZodUndefined:()=>Al,ZodUnion:()=>lr,ZodUnknown:()=>Tl,ZodVoid:()=>Ll,ZodXID:()=>hi,ZodXor:()=>Dl,_ZodString:()=>ai,_default:()=>Ql,_function:()=>hm,any:()=>Kd,array:()=>cr,base64:()=>Sd,base64url:()=>Id,bigint:()=>Vd,boolean:()=>Pl,catch:()=>sf,check:()=>gm,cidrv4:()=>xd,cidrv6:()=>zd,codec:()=>fm,creditCard:()=>Od,cuid:()=>gd,cuid2:()=>yd,currencyCode:()=>Cd,custom:()=>ym,date:()=>Wd,describe:()=>bm,discriminatedUnion:()=>em,e164:()=>Pd,email:()=>sd,emoji:()=>md,enum:()=>Ii,exactOptional:()=>Gl,file:()=>am,float32:()=>Rd,float64:()=>Dd,function:()=>hm,guid:()=>ad,hash:()=>Ld,hex:()=>Td,hostname:()=>Nd,httpUrl:()=>dd,iban:()=>Ad,instanceof:()=>$m,int:()=>ii,int32:()=>jd,int64:()=>Fd,intersection:()=>Vl,invertCodec:()=>pm,ipv4:()=>wd,ipv6:()=>kd,json:()=>vm,jwt:()=>Ed,keyof:()=>Hd,ksuid:()=>$d,lazy:()=>df,literal:()=>sm,looseObject:()=>Xd,looseRecord:()=>nm,mac:()=>vd,map:()=>rm,meta:()=>_m,nan:()=>lm,nanoid:()=>hd,nativeEnum:()=>im,never:()=>Si,nonoptional:()=>nf,null:()=>Zl,nullable:()=>ir,nullish:()=>cm,number:()=>Il,object:()=>Gd,optional:()=>xt,partialRecord:()=>tm,pipe:()=>si,prefault:()=>tf,preprocess:()=>km,promise:()=>mm,readonly:()=>lf,record:()=>Bl,refine:()=>gf,set:()=>om,strictObject:()=>Yd,string:()=>or,stringFormat:()=>Zd,stringbool:()=>wm,success:()=>um,superRefine:()=>yf,symbol:()=>Bd,templateLiteral:()=>dm,transform:()=>Pi,tuple:()=>Ul,uint32:()=>Md,uint64:()=>Ud,ulid:()=>bd,undefined:()=>Jd,union:()=>mn,unknown:()=>kt,url:()=>pd,uuid:()=>cd,uuidv4:()=>ud,uuidv6:()=>ld,uuidv7:()=>fd,void:()=>qd,xid:()=>_d,xor:()=>Qd});var ri={};Ne(ri,{endsWith:()=>Gt,gt:()=>Pe,gte:()=>me,includes:()=>Wt,length:()=>wt,lowercase:()=>Kt,lt:()=>Ie,lte:()=>de,maxLength:()=>$t,maxSize:()=>Ye,mime:()=>Xt,minLength:()=>Re,minSize:()=>Oe,multipleOf:()=>Ge,negative:()=>Wo,nonnegative:()=>Go,nonpositive:()=>Ho,normalize:()=>Qt,overwrite:()=>ke,positive:()=>qo,properties:()=>Yt,property:()=>Yo,regex:()=>Jt,size:()=>_t,slugify:()=>rn,startsWith:()=>Ht,toLowerCase:()=>tn,toUpperCase:()=>nn,trim:()=>en,uppercase:()=>qt});var od=new WeakSet([Object.prototype,Error.prototype]);function oi(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var id=(e,t)=>{fs.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);od.has(n)||(od.add(n),oi(n,"format",r=>o=>En(r,o)),oi(n,"flatten",r=>o=>An(r,o)),oi(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Zt,2)}),oi(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Zt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Sb=p("ZodError",id),le=p("ZodError",id,void 0,{Parent:Error});var pl=Rt(le),dl=Dt(le),ml=jt(le),hl=Mt(le),gl=Tr(le),yl=Cr(le),bl=Lr(le),_l=Rr(le),$l=Dr(le),wl=jr(le),vl=Mr(le),kl=Vr(le);function Pb(){W.localeError||F($o())}function zt(){W.memoizer||F({memoizer:Hn()})}var E=p("ZodType",(e,t)=>(Pb(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(k.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(gf(e,t))},superRefine(e,t){return this.check(yf(e,t))},overwrite(e){return this.check(ke(e))},optional(){return xt(this)},exactOptional(){return Gl(this)},nullable(){return ir(this)},nullish(){return xt(ir(this))},nonoptional(e){return nf(this,e)},array(){return cr(this)},or(e){return mn([this,e])},and(e){return Vl(this,e)},transform(e){return si(this,Pi(e))},default(e){return Ql(this,e)},prefault(e){return tf(this,e)},catch(e){return sf(this,e)},pipe(e){return si(this,e)},readonly(){return lf(this)},describe(e){let t=this.clone();return Y.add(t,{description:e}),t},meta(...e){if(e.length===0)return Y.get(this);let t=this.clone();return Y.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 k.hide(this,"~standard",{...Xr(this),jsonSchema:{input:on(this,"input"),output:on(this,"output")}})},set"~standard"(e){k.own(this,"~standard",e)},parse:function e(t,n){return pl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await dl(this,t,n,{callee:e})},safeParse(e,t){return ml(this,e,t)},async safeParseAsync(e,t){return hl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){k.own(this,"spa",e)},validate(e,t){return Zn(this,e,t)},validateAsync(e,t){return Nn(this,e,t)},encode:function e(t,n){return gl(this,t,n,{callee:e})},decode:function e(t,n){return yl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await bl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await _l(this,t,n,{callee:e})},safeEncode(e,t){return $l(this,e,t)},safeDecode(e,t){return wl(this,e,t)},async safeEncodeAsync(e,t){return vl(this,e,t)},async safeDecodeAsync(e,t){return kl(this,e,t)},toJSONSchema(e){return zu(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),ai=p("_ZodString",(e,t)=>{ht.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pu(e,n,r,o)},k.derived({format:e=>K(e).format??null,minLength:e=>K(e).minimum??null,maxLength:e=>K(e).maximum??null},{regex(...e){return this.check(Jt(...e))},includes(...e){return this.check(Wt(...e))},startsWith(...e){return this.check(Ht(...e))},endsWith(...e){return this.check(Gt(...e))},min(...e){return this.check(Re(...e))},max(...e){return this.check($t(...e))},length(...e){return this.check(wt(...e))},nonempty(...e){return this.check(Re(1,...e))},lowercase(e){return this.check(Kt(e))},uppercase(e){return this.check(qt(e))},trim(){return this.check(en())},normalize(...e){return this.check(Qt(...e))},toLowerCase(){return this.check(tn())},toUpperCase(){return this.check(nn())},slugify(){return this.check(rn())}})),ln=p("ZodString",(e,t)=>{ht.init(e,t),ai.init(e,t)},{email(e){return this.check(So(ci,e))},url(e){return this.check(Yn(sr,e))},jwt(e){return this.check(Ko(xi,e))},emoji(e){return this.check(Zo(li,e))},guid(e){return this.check(Io(ui,e))},uuid(e){return this.check(Po(Ae,e))},uuidv4(e){return this.check(Oo(Ae,e))},uuidv6(e){return this.check(Ao(Ae,e))},uuidv7(e){return this.check(Eo(Ae,e))},nanoid(e){return this.check(No(fi,e))},cuid(e){return this.check(To(pi,e))},cuid2(e){return this.check(Co(di,e))},ulid(e){return this.check(Lo(mi,e))},base64(e){return this.check(Uo(wi,e))},base64url(e){return this.check(Bo(vi,e))},xid(e){return this.check(Ro(hi,e))},ksuid(e){return this.check(Do(gi,e))},ipv4(e){return this.check(jo(yi,e))},ipv6(e){return this.check(Mo(bi,e))},cidrv4(e){return this.check(Vo(_i,e))},cidrv6(e){return this.check(Fo($i,e))},e164(e){return this.check(Jo(ki,e))},datetime(e){return this.check(Xn(tt,e))},date(e){return this.check(Qn(nt,e))},time(e){return this.check(er(rt,e))},duration(e){return this.check(tr(ot,e))}});function or(e){return Vc(ln,e)}var j=p("ZodStringFormat",(e,t)=>{R.init(e,t),ai.init(e,t)}),tt=p("ZodISODateTime",(e,t)=>{Ea.init(e,t),j.init(e,t)}),nt=p("ZodISODate",(e,t)=>{Za.init(e,t),j.init(e,t)}),rt=p("ZodISOTime",(e,t)=>{Na.init(e,t),j.init(e,t)}),ot=p("ZodISODuration",(e,t)=>{Ta.init(e,t),j.init(e,t)}),ci=p("ZodEmail",(e,t)=>{$a.init(e,t),j.init(e,t)});function sd(e){return So(ci,e)}var ui=p("ZodGUID",(e,t)=>{ba.init(e,t),j.init(e,t)});function ad(e){return Io(ui,e)}var Ae=p("ZodUUID",(e,t)=>{_a.init(e,t),j.init(e,t)});function cd(e){return Po(Ae,e)}function ud(e){return Oo(Ae,e)}function ld(e){return Ao(Ae,e)}function fd(e){return Eo(Ae,e)}var sr=p("ZodURL",(e,t)=>{ka.init(e,t),j.init(e,t)});function pd(e){return Yn(sr,e)}function dd(e){return Yn(sr,{protocol:Tn,hostname:Ts,...k.normalizeParams(e)})}var li=p("ZodEmoji",(e,t)=>{xa.init(e,t),j.init(e,t)});function md(e){return Zo(li,e)}var fi=p("ZodNanoID",(e,t)=>{za.init(e,t),j.init(e,t)});function hd(e){return No(fi,e)}var pi=p("ZodCUID",(e,t)=>{Sa.init(e,t),j.init(e,t)});function gd(e){return To(pi,e)}var di=p("ZodCUID2",(e,t)=>{Ia.init(e,t),j.init(e,t)});function yd(e){return Co(di,e)}var mi=p("ZodULID",(e,t)=>{Pa.init(e,t),j.init(e,t)});function bd(e){return Lo(mi,e)}var hi=p("ZodXID",(e,t)=>{Oa.init(e,t),j.init(e,t)});function _d(e){return Ro(hi,e)}var gi=p("ZodKSUID",(e,t)=>{Aa.init(e,t),j.init(e,t)});function $d(e){return Do(gi,e)}var yi=p("ZodIPv4",(e,t)=>{Ca.init(e,t),j.init(e,t)});function wd(e){return jo(yi,e)}var xl=p("ZodMAC",(e,t)=>{Ra.init(e,t),j.init(e,t)});function vd(e){return Uc(xl,e)}var bi=p("ZodIPv6",(e,t)=>{La.init(e,t),j.init(e,t)});function kd(e){return Mo(bi,e)}var _i=p("ZodCIDRv4",(e,t)=>{Da.init(e,t),j.init(e,t)});function xd(e){return Vo(_i,e)}var $i=p("ZodCIDRv6",(e,t)=>{ja.init(e,t),j.init(e,t)});function zd(e){return Fo($i,e)}var wi=p("ZodBase64",(e,t)=>{Ma.init(e,t),j.init(e,t)});function Sd(e){return Uo(wi,e)}var vi=p("ZodBase64URL",(e,t)=>{Va.init(e,t),j.init(e,t)});function Id(e){return Bo(vi,e)}var ki=p("ZodE164",(e,t)=>{Fa.init(e,t),j.init(e,t)});function Pd(e){return Jo(ki,e)}var zl=p("ZodCreditCard",(e,t)=>{Ua.init(e,t),j.init(e,t)});function Od(e){return Bc(zl,e)}var Sl=p("ZodIBAN",(e,t)=>{Ba.init(e,t),j.init(e,t)});function Ad(e){return Jc(Sl,e)}var xi=p("ZodJWT",(e,t)=>{Ja.init(e,t),j.init(e,t)});function Ed(e){return Ko(xi,e)}var St=p("ZodCustomStringFormat",(e,t)=>{Ka.init(e,t),j.init(e,t)});function Zd(e,t,n={}){return vt(St,e,t,n)}function Nd(e){return vt(St,"hostname",Ns,e)}function Td(e){return vt(St,"hex",Ws,e)}function Cd(e){return vt(St,"currency_code",Ls,e)}function Ld(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=_e[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return vt(St,r,o,t)}var fn=p("ZodNumber",(e,t)=>{co.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ou(e,n,r,o),e.isFinite=!0},k.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=K(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=K(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=K(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>K(e).format??null},{gt(e,t){return this.check(Pe(e,t))},gte(e,t){return this.check(me(e,t))},min(e,t){return this.check(me(e,t))},lt(e,t){return this.check(Ie(e,t))},lte(e,t){return this.check(de(e,t))},max(e,t){return this.check(de(e,t))},int(e){return this.check(ii(e))},safe(e){return this.check(ii(e))},positive(e){return this.check(Pe(0,e))},nonnegative(e){return this.check(me(0,e))},negative(e){return this.check(Ie(0,e))},nonpositive(e){return this.check(de(0,e))},multipleOf(e,t){return this.check(Ge(e,t))},step(e,t){return this.check(Ge(e,t))},finite(){return this}}));function Il(e){return qc(fn,e)}var It=p("ZodNumberFormat",(e,t)=>{qa.init(e,t),fn.init(e,t)});function ii(e){return Hc(It,e)}function Rd(e){return Gc(It,e)}function Dd(e){return Yc(It,e)}function jd(e){return Xc(It,e)}function Md(e){return Qc(It,e)}var pn=p("ZodBoolean",(e,t)=>{Un.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Au(e,n,r,o)});function Pl(e){return eu(pn,e)}var dn=p("ZodBigInt",(e,t)=>{uo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eu(e,n,r,o)},k.derived({minValue:e=>K(e).minimum??null,maxValue:e=>K(e).maximum??null,format:e=>K(e).format??null},{gte(e,t){return this.check(me(e,t))},min(e,t){return this.check(me(e,t))},gt(e,t){return this.check(Pe(e,t))},lt(e,t){return this.check(Ie(e,t))},lte(e,t){return this.check(de(e,t))},max(e,t){return this.check(de(e,t))},positive(e){return this.check(Pe(BigInt(0),e))},negative(e){return this.check(Ie(BigInt(0),e))},nonpositive(e){return this.check(de(BigInt(0),e))},nonnegative(e){return this.check(me(BigInt(0),e))},multipleOf(e,t){return this.check(Ge(e,t))}}));function Vd(e){return nu(dn,e)}var zi=p("ZodBigIntFormat",(e,t)=>{Wa.init(e,t),dn.init(e,t)});function Fd(e){return ou(zi,e)}function Ud(e){return iu(zi,e)}var Ol=p("ZodSymbol",(e,t)=>{Ha.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zu(e,n,r,o)});function Bd(e){return su(Ol,e)}var Al=p("ZodUndefined",(e,t)=>{Ga.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tu(e,n,r,o)});function Jd(e){return au(Al,e)}var El=p("ZodNull",(e,t)=>{Ya.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nu(e,n,r,o)});function Zl(e){return cu(El,e)}var Nl=p("ZodAny",(e,t)=>{Xa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ru(e,n,r,o)});function Kd(){return uu(Nl)}var Tl=p("ZodUnknown",(e,t)=>{Qa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Du(e,n,r,o)});function kt(){return lu(Tl)}var Cl=p("ZodNever",(e,t)=>{ec.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r,o)});function Si(e){return fu(Cl,e)}var Ll=p("ZodVoid",(e,t)=>{tc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cu(e,n,r,o)});function qd(e){return pu(Ll,e)}var ar=p("ZodDate",(e,t)=>{nc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ju(e,n,r,o),e.min=(n,r)=>e.check(me(n,r)),e.max=(n,r)=>e.check(de(n,r))},k.derived({minDate:e=>{let{minimum:t}=K(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=K(e);return t?new Date(t):null}},{}));function Wd(e){return du(ar,e)}var Rl=p("ZodArray",(e,t)=>{zt(),oc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yu(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Re(e,t))},nonempty(e){return this.check(Re(1,e))},max(e,t){return this.check($t(e,t))},length(e,t){return this.check(wt(e,t))},unwrap(){return this.element}});function cr(e,t){return gu(Rl,e,t)}function Hd(e){let t=e._zod.def.shape;return Ii(Object.keys(t))}var ur=p("ZodObject",(e,t)=>{zt(),ic.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xu(e,n,r,o),k.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ii(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(k.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(k.mergeDefs(this._zod.def,{catchall:kt()}))},loose(){return this.clone(k.mergeDefs(this._zod.def,{catchall:kt()}))},strict(){return this.clone(k.mergeDefs(this._zod.def,{catchall:Si()}))},strip(){return this.clone(k.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return k.extend(this,e)},safeExtend(e){return k.safeExtend(this,e)},merge(e){return k.merge(this,e)},pick(e){return k.pick(this,e)},omit(e){return k.omit(this,e)},partial(...e){return k.partial(fr,this,e[0])},exactPartial(...e){return k.partial(Oi,this,e[0],"exactPartial")},required(...e){return k.required(Ai,this,e[0])}});function Gd(e,t){let n={type:"object",shape:e??{},...k.normalizeParams(t)};return new ur(n)}function Yd(e,t){return new ur({type:"object",shape:e,catchall:Si(),...k.normalizeParams(t)})}function Xd(e,t){return new ur({type:"object",shape:e,catchall:kt(),...k.normalizeParams(t)})}var lr=p("ZodUnion",(e,t)=>{Bn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qo(e,n,r,o),e.options=t.options});function mn(e,t){return new lr({type:"union",options:e,...k.normalizeParams(t)})}var Dl=p("ZodXor",(e,t)=>{lr.init(e,t),sc.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qo(e,n,r,o),e.options=t.options});function Qd(e,t){return new Dl({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}var jl=p("ZodDiscriminatedUnion",(e,t)=>{lr.init(e,t),cc.init(e,t)});function em(e,t,n){return new jl({type:"union",options:t,discriminator:e,...k.normalizeParams(n)})}var Ml=p("ZodIntersection",(e,t)=>{uc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qu(e,n,r,o)});function Vl(e,t){return new Ml({type:"intersection",left:e,right:t})}var Fl=p("ZodTuple",(e,t)=>{zt(),lo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>el(e,n,r,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 fr({type:"optional",innerType:t}))})}});function Ul(e,t,n){let r=t instanceof O,o=r?n:t,i=r?t:null;return new Fl({type:"tuple",items:e,rest:i,...k.normalizeParams(o)})}var cn=p("ZodRecord",(e,t)=>{zt(),lc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tl(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Bl(e,t,n){return!t||!t._zod?new cn({type:"record",keyType:or(),valueType:e,...k.normalizeParams(t)}):new cn({type:"record",keyType:e,valueType:t,...k.normalizeParams(n)})}function tm(e,t,n){return new cn({type:"record",keyType:e,valueType:t,...k.normalizeParams(n),partial:!0})}function nm(e,t,n){return new cn({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(n)})}var Jl=p("ZodMap",(e,t)=>{zt(),fc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hu(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Oe(...n)),e.nonempty=n=>e.check(Oe(1,n)),e.max=(...n)=>e.check(Ye(...n)),e.size=(...n)=>e.check(_t(...n))});function rm(e,t,n){return new Jl({type:"map",keyType:e,valueType:t,...k.normalizeParams(n)})}var Kl=p("ZodSet",(e,t)=>{zt(),pc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gu(e,n,r,o),e.min=(...n)=>e.check(Oe(...n)),e.nonempty=n=>e.check(Oe(1,n)),e.max=(...n)=>e.check(Ye(...n)),e.size=(...n)=>e.check(_t(...n))});function om(e,t){return new Kl({type:"set",valueType:e,...k.normalizeParams(t)})}var un=p("ZodEnum",(e,t)=>{dc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Mu(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new un({...t,checks:[],...k.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new un({...t,checks:[],...k.normalizeParams(o),entries:i})}});function Ii(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new un({type:"enum",entries:n,...k.normalizeParams(t)})}function im(e,t){return new un({type:"enum",entries:e,...k.normalizeParams(t)})}var ql=p("ZodLiteral",(e,t)=>{mc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vu(e,n,r,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 sm(e,t){return new ql({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}var Wl=p("ZodFile",(e,t)=>{hc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bu(e,n,r,o),e.min=(n,r)=>e.check(Oe(n,r)),e.max=(n,r)=>e.check(Ye(n,r)),e.mime=(n,r)=>e.check(Xt(Array.isArray(n)?n:[n],r))});function am(e){return yu(Wl,e)}var Hl=p("ZodTransform",(e,t)=>{zt(),gc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wu(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new We(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(k.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(k.issue(s))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Pi(e){return new Hl({type:"transform",transform:e})}var fr=p("ZodOptional",(e,t)=>{fo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ei(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function xt(e){return new fr({type:"optional",innerType:e})}var Oi=p("ZodExactOptional",(e,t)=>{yc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ei(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gl(e){return new Oi({type:"optional",innerType:e})}var Yl=p("ZodNullable",(e,t)=>{bc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ir(e){return new Yl({type:"nullable",innerType:e})}function cm(e){return xt(ir(e))}var Xl=p("ZodDefault",(e,t)=>{_c.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>il(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ql(e,t){return new Xl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var ef=p("ZodPrefault",(e,t)=>{$c.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tf(e,t){return new ef({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var Ai=p("ZodNonOptional",(e,t)=>{wc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function nf(e,t){return new Ai({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}var rf=p("ZodSuccess",(e,t)=>{vc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ju(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function um(e){return new rf({type:"success",innerType:e})}var of=p("ZodCatch",(e,t)=>{kc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>al(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sf(e,t){return new of({type:"catch",innerType:e,catchValue:typeof t=="function"?t:k.constantCatch(t)})}var af=p("ZodNaN",(e,t)=>{xc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r,o)});function lm(e){return hu(af,e)}var pr=p("ZodPipe",(e,t)=>{po.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cl(e,n,r,o),e.in=t.in,e.out=t.out});function si(e,t){return new pr({type:"pipe",in:e,out:t})}var dr=p("ZodCodec",(e,t)=>{pr.init(e,t),Jn.init(e,t)});function fm(e,t,n){return new dr({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function pm(e){let t=e._zod.def;return new dr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var cf=p("ZodPreprocess",(e,t)=>{pr.init(e,t),zc.init(e,t)}),uf=p("ZodReadonly",(e,t)=>{Sc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ul(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lf(e){return new uf({type:"readonly",innerType:e})}var ff=p("ZodTemplateLiteral",(e,t)=>{Ic.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uu(e,n,r,o)});function dm(e,t){return new ff({type:"template_literal",parts:e,...k.normalizeParams(t)})}var pf=p("ZodLazy",(e,t)=>{Kn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fl(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function df(e){return new pf({type:"lazy",getter:e})}var mf=p("ZodPromise",(e,t)=>{Oc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ll(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function mm(e){return new mf({type:"promise",innerType:e})}var hf=p("ZodFunction",(e,t)=>{Pc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qu(e,n,r,o)});function hm(e){return new hf({type:"function",input:Array.isArray(e?.input)?Ul(e?.input):e?.input??cr(kt()),output:e?.output??kt()})}var mr=p("ZodCustom",(e,t)=>{Ac.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ku(e,n,r,o)});function gm(e){let t=new M({check:"custom"});return t._zod.check=e,t}function ym(e,t){return bu(mr,e??(()=>!0),t)}function gf(e,t={}){return _u(mr,e,t)}function yf(e,t){return $u(e,t)}var bm=wu,_m=vu,bf=p("ZodInstanceOf",(e,t)=>{mr.init(e,t)},{properties(e,t){return this.check(Yt(e,t))}});function $m(e,t={}){let n=new bf({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...k.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var wm=(...e)=>ku({Codec:dr,Boolean:pn,String:ln},...e);function vm(e){let t=df(()=>mn([or(e),Il(),Pl(),Zl(),cr(t),Bl(or(),t)]));return t}function km(e,t){return new cf({type:"pipe",in:Pi(e),out:t})}var Ob={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 Ab(e){F({customError:e})}function Eb(){return F().customError}var _f;_f||(_f={});var hr={};Ne(hr,{ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,date:()=>Nb,datetime:()=>Zb,duration:()=>Cb,time:()=>Tb});function Zb(e){return Xn(tt,e)}function Nb(e){return Qn(nt,e)}function Tb(e){return er(rt,e)}function Cb(e){return tr(ot,e)}var w={...hn,...ri,iso:hr},Lb=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 Rb(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function xm(e,t){return e.map((n,r)=>r<t?n:n.optional())}function Db(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function jb(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:Db(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function Mb(e,t){return w.transform(r=>r).check(r=>{let o=r.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&&r.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&&r.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 s of i){let a=t.keySchema.safeParse(s);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function $f(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=$f(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=$f(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}var Vb=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Fb=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function gr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(gr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Vb.has(t)?gr(n):!Fb.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(gr))}function zm(e){return e===1?"element":"elements"}function Ub(e,t){return w.transform(r=>r).check(r=>{let o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=$f(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${zm(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${zm(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Sm(e,t){if(e!==!1)return e===void 0||e===!0?w.any():oe(e,t)}var Bb=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Im(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=jb(o,t),s=oe(i,t);return t.refs.set(o,s),t.processing.delete(o),s}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(s=>typeof s=="string"))return w.enum(o);let i=o.map(s=>w.literal(s));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 n=e.type;if(Array.isArray(n)){let o=n.map(i=>{let s={...e,type:i};return Im(s,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!n)return w.any();let r;switch(n){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(Bb)):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))),r=o;break}case"number":case"integer":{let o=n==="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)),r=o;break}case"boolean":{r=w.boolean();break}case"null":{r=w.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?oe(e.additionalProperties,t):void 0;for(let[f,m]of Object.entries(i)){let d=oe(m,t);G(o,f,s.has(f)?d:d.optional())}if(e.patternProperties){let f=e.patternProperties,m=Object.keys(f),d=[];for(let b of m){let $=oe(f[b],t),S=w.string().regex(new RegExp(b));d.push(w.looseRecord(S,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...d),g.length===0)r=w.object({}).passthrough();else if(g.length===1)r=g[0];else{let b=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)b=w.intersection(b,g[$]);r=b}if(e.additionalProperties===!1){let b=Object.keys(o),$=m.map(x=>new RegExp(x)),S=r;r=r.check(x=>{if(!ye(x.value))return;let A=[];for(let C of Object.keys(x.value))b.includes(C)||$.some(V=>V.test(C))||A.push(C);A.length&&x.issues.push({code:"unrecognized_keys",keys:A,input:x.value,inst:S})})}}else{let f=w.object(o);e.additionalProperties===!1?r=f.strict():a?r=f.catchall(a):r=f.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let f;if(c){let m=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=oe(m,t)}r=Mb(r,{keySchema:f,minProperties:u,maxProperties:l})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(f=>oe(f,t)),c=xm(a,s),u=Array.isArray(i)?void 0:Sm(i,t),l=w.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=typeof e.minItems=="number"?e.minItems:0,a=i.map(f=>oe(f,t)),c=xm(a,s),u=Sm(e.additionalItems,t),l=w.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let s=oe(i,t),a=w.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=Ub(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?oe(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: ${n}`)}return r}function oe(e,t){if(typeof e=="boolean")return e?w.any():w.never();let n=Im(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>oe(u,t)),c=w.union(a);n=r?w.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>oe(u,t)),c=w.xor(a);n=r?w.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:w.any();else{let a=r?n:oe(e.allOf[0],t),c=r?0:1;for(let u=c;u<e.allOf.length;u++)a=w.intersection(a,oe(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=w.nullable(n)),e.readOnly===!0&&(n=w.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!gr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!gr(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))Lb.has(a)||G(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}function Pm(e,t){if(typeof e=="boolean")return e?w.any():w.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Rb(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Y};return oe(n,i)}var Om=Symbol("z.visit/resolving");function yr(e,t){let n=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},r=new Map;function o(s){let a=r.get(s);if(a===Om)return new Kn({type:"lazy",getter:()=>r.get(s)});if(a!==void 0)return a;r.set(s,Om);let c=i(s),u=n(c,c!==s);return r.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),f=!1,m={};for(let g of l){let b=o(u[g]);b!==u[g]&&(f=!0),m[g]=b}let d=a.catchall;return a.catchall&&(d=o(a.catchall),d!==a.catchall&&(f=!0)),f?L(s,{...a,shape:m,catchall:d}):s}case"array":{let u=o(a.element);return u===a.element?s:L(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,f=[];for(let d of u){let g=o(d);g!==d&&(l=!0),f.push(g)}let m=a.rest;return a.rest&&(m=o(a.rest),m!==a.rest&&(l=!0)),l?L(s,{...a,items:f,rest:m}):s}case"record":case"map":{let u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?s:L(s,{...a,keyType:u,valueType:l})}case"set":{let u=o(a.valueType);return u===a.valueType?s:L(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,f=[];for(let m of u){let d=o(m);d!==m&&(l=!0),f.push(d)}return l?L(s,{...a,options:f}):s}case"intersection":{let u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?s:L(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=o(a.innerType);return u===a.innerType?s:L(s,{...a,innerType:u})}case"pipe":{let u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?s:L(s,{...a,in:u,out:l})}case"function":{let u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?s:L(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...f}=a;return L(s,{...f,getter:()=>o(u())})}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 s;default:return s}}return o(e)}function Am(e){return yr(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:mn(n.options)}})}function Jb(e,t){if(!t?.length)return e;let n=e._zod.def;return L(e,we(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function Em(e){return Jb(e.out,e.checks)}function Kb(e){return e.in._zod.traits.has("$ZodTransform")?Em(e):e.in}function Zm(e){return yr(e,{pipe:t=>Kb(t._zod.def),default:(t,n)=>n?xt(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Nm(e){return yr(e,{pipe:t=>Em(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var wf={};Ne(wf,{bigint:()=>Gb,boolean:()=>Hb,date:()=>Yb,number:()=>Wb,string:()=>qb});function qb(e){return Fc(ln,e)}function Wb(e){return Wc(fn,e)}function Hb(e){return tu(pn,e)}function Gb(e){return ru(dn,e)}function Yb(e){return mu(ar,e)}F({jitless:!0});var kf=1,Tm=1,Xb="austere-sync.1",Ot={frameBytes:65536,noteItemsBytes:4096,nameChars:40},Qb=["upgrade_required","forbidden","rate_limited","too_large","invalid"];var e_=["publish","addNote","releaseNote","discardNote","addReply","grant","revoke","delete"];var t_=/^[A-Za-z_$][\w$]{0,99}$/,n_=/^[0-9a-f]{64}$/,r_=/^[A-Za-z0-9_-]{43}$/,o_=/^[A-Za-z0-9_-]{8,64}$/,i_=/^[A-Za-z0-9_-]{16,256}$/,Mm=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,s_=/^#[0-9a-f]{6}$/,a_=/^[A-Za-z0-9_-]{16}$/,xf=y.int().positive(),Vm=y.int().nonnegative(),Pt=y.int().nonnegative(),Cm=y.string().min(1).max(Ot.nameChars),Fm=y.string().regex(n_),vf=y.string().regex(t_).nullable(),Ti=y.enum(["viewing","away","writing"]),c_=y.enum(["owner","reviewer"]),Lm={code:y.enum(Qb),message:y.string(),retryAfter:y.int().nonnegative().optional()},Um=y.discriminatedUnion("kind",[y.looseObject({kind:y.literal("message"),text:y.string()}),y.looseObject({kind:y.literal("annotation"),target:y.string().optional(),component:y.string().optional(),path:y.array(y.string()).optional(),selection:y.string().optional(),excerpt:y.string().optional(),note:y.string().optional(),detail:y.looseObject({part:y.string().optional(),row:y.string().optional(),column:y.string().optional(),rowIndex:y.int().optional()}).optional()})]),Bm=y.looseObject({sha256:Fm,name:y.string().min(1),version:y.string().min(1)}),lw={publish:y.looseObject({title:y.string(),cliVersion:y.string().regex(Mm),html:Fm,packs:y.array(Bm),auto:y.boolean(),unlisted:y.boolean(),presence:y.boolean()}),addNote:y.looseObject({items:y.array(Um).min(1),name:y.string().optional()}),releaseNote:y.looseObject({note:y.string().min(1)}),discardNote:y.looseObject({note:y.string().min(1)}),addReply:y.looseObject({text:y.string().min(1)}),grant:y.looseObject({name:Cm,tokenHash:y.string().regex(r_),expiresAt:Pt.nullable()}),revoke:y.looseObject({name:Cm}),delete:y.looseObject({})},u_=y.looseObject({clientId:y.string().regex(o_),n:xf}),fw=u_.extend({v:y.int(),t:y.literal("mutation"),name:y.enum(e_),args:y.unknown()}),br={v:y.int(),id:y.string().min(1),seq:xf},l_=y.looseObject({...br,type:y.string()}),Rm={page:y.looseObject({...br,type:y.literal("page"),title:y.string(),cliVersion:y.string().regex(Mm),html:y.string(),packs:y.array(Bm),auto:y.boolean(),unlisted:y.boolean(),presence:y.boolean(),publishedAt:Pt,expiresAt:Pt,deleted:y.boolean()}),note:y.looseObject({...br,type:y.literal("note"),author:y.string(),items:y.array(Um),at:Pt,state:y.enum(["held","released","discarded"])}),reply:y.looseObject({...br,type:y.literal("reply"),text:y.string(),at:Pt}),acl:y.looseObject({...br,type:y.literal("acl"),name:y.string(),grantedAt:Pt,expiresAt:Pt.nullable(),revoked:y.boolean(),grant:y.string().regex(a_).optional()})},pw={pull:y.looseObject({v:y.int(),t:y.literal("pull"),after:Vm}),hello:y.looseObject({v:y.int(),t:y.literal("hello"),status:Ti,name:y.string().optional()}),status:y.looseObject({v:y.int(),t:y.literal("status"),status:Ti}),focus:y.looseObject({v:y.int(),t:y.literal("focus"),statement:vf}),bye:y.looseObject({v:y.int(),t:y.literal("bye")})},f_=y.looseObject({v:y.int(),t:y.literal("changes"),rows:y.array(y.unknown()),cursor:Vm,more:y.boolean().optional(),reset:y.boolean().optional()}),Ei=y.string().min(1),Dm={ack:y.looseObject({v:y.int(),t:y.literal("ack"),clientId:y.string(),n:xf,error:y.looseObject(Lm).optional()}),error:y.looseObject({v:y.int(),t:y.literal("error"),...Lm}),hello:y.looseObject({v:y.int(),t:y.literal("hello"),viewer:y.looseObject({id:Ei,name:y.string(),colour:y.string().regex(s_),role:c_}),status:Ti,focus:vf,self:y.boolean()}),status:y.looseObject({v:y.int(),t:y.literal("status"),viewer:Ei,status:Ti}),focus:y.looseObject({v:y.int(),t:y.literal("focus"),viewer:Ei,statement:vf}),bye:y.looseObject({v:y.int(),t:y.literal("bye"),viewer:Ei})},Ni=e=>({ok:!0,value:e}),_r=(e,t)=>({ok:!1,error:{code:e,message:t}}),jm=(e,t)=>typeof t=="string"&&Object.hasOwn(e,t);function p_(e){return new TextEncoder().encode(e).length}function Zi(e,t){let n=t.issues[0],r=n&&n.path.length?`${e}.${n.path.join(".")}`:e;return _r("invalid",`${r}: ${n?n.message:"invalid"}`)}function Jm(e,t){if(e.length*3<=t)return;let n=p_(e);return n>t?n:void 0}function d_(e,t){let n;try{n=typeof e=="string"?e:JSON.stringify(e)}catch{}if(n===void 0)return _r("invalid","frame is not JSON");let r=t===null?void 0:Jm(n,t);if(r!==void 0)return _r("too_large",`frame is ${r} bytes; the limit is ${t}`);let o;try{o=JSON.parse(n)}catch{return _r("invalid","frame is not JSON")}if(!o||typeof o!="object"||Array.isArray(o))return _r("invalid","frame is not a JSON object");let i=o,s=Km(i.v,"frame");return s?{ok:!1,error:s}:Ni(i)}function Km(e,t){if(typeof e!="number"||!Number.isInteger(e))return{code:"invalid",message:`${t}.v: expected an integer protocol version`};if(e<Tm)return{code:"upgrade_required",message:`${t} speaks sync v${e}; v${Tm} or later is required`}}function Ci(e){let t=d_(e,null);if(!t.ok)return t;let n=t.value;if(n.t==="changes"){let o=f_.safeParse(n);if(!o.success)return Zi("changes",o.error);let i=[],s=[];for(let[a,c]of o.data.rows.entries()){let u=l_.safeParse(c);if(!u.success)return Zi(`changes.rows.${a}`,u.error);let l=Km(u.data.v,`changes.rows.${a}`);if(l)return{ok:!1,error:l};if(!jm(Rm,u.data.type)){s.push(u.data);continue}let f=Rm[u.data.type].safeParse(c);if(!f.success)return Zi(`changes.rows.${a}`,f.error);i.push(f.data)}return Ni({...o.data,rows:i,skipped:s})}if(!jm(Dm,n.t))return Ni(null);let r=Dm[n.t].safeParse(n);return r.success?Ni(r.data):Zi(n.t,r.error)}function qm(e,t,n){let r={v:kf,t:"mutation",clientId:n.clientId,n:n.n,name:e,args:t},o=Jm(JSON.stringify(r),Ot.frameBytes);if(o!==void 0)throw new RangeError(`${e} is ${o} bytes; a frame may be at most ${Ot.frameBytes}`);return r}var m_="austere-owner.",h_="austere-invite.";function Wm(e){let t=[Xb];for(let[n,r]of[[m_,e.owner],[h_,e.invite]])if(r!==void 0){if(!i_.test(r))throw new Error("sync token must be 16-256 base64url characters");t.push(n+r)}return t}var g_={viewing:"viewing",away:"away",writing:"writing a note"},Li=class{constructor(t){Je(this,"roster",new Map);Je(this,"self",null);Je(this,"send",null);Je(this,"heartbeat");Je(this,"writing",new Set);Je(this,"focus",null);Je(this,"host");this.host=t,document.addEventListener("visibilitychange",()=>this.sendStatus())}status(){return document.visibilityState==="hidden"?"away":this.writing.size?"writing":"viewing"}connect(t){this.send=t,this.hello(),this.focus&&t({v:1,t:"focus",statement:this.focus}),window.clearInterval(this.heartbeat),this.heartbeat=window.setInterval(()=>this.send?.({v:1,t:"status",status:this.status()}),25e3)}disconnect(){this.send=null,window.clearInterval(this.heartbeat),this.self=null,this.roster.clear(),this.render()}rename(){this.send&&this.hello()}leave(){this.send?.({v:1,t:"bye"})}hello(){let t=this.host.name();this.send?.(t?{v:1,t:"hello",status:this.status(),name:t}:{v:1,t:"hello",status:this.status()})}handle(t){if(t.t==="hello")this.roster.set(t.viewer.id,{viewer:t.viewer,status:t.status,focus:t.focus}),t.self&&(this.self=t.viewer.id);else if(t.t==="bye")this.roster.delete(t.viewer),t.viewer===this.self&&(this.self=null);else{let n=this.roster.get(t.viewer);if(!n)return;t.t==="status"?n.status=t.status:n.focus=t.statement}this.render()}setFocus(t){t!==this.focus&&(this.focus=t,this.send?.({v:1,t:"focus",statement:t}))}setWriting(t,n){let r=this.status();n?this.writing.add(t):this.writing.delete(t),this.status()!==r&&this.sendStatus()}redraw(){this.host.showFocus(this.marks())}sendStatus(){this.send?.({v:1,t:"status",status:this.status()})}others(){return[...this.roster.values()].filter(t=>t.viewer.id!==this.self)}marks(){return this.others().flatMap(t=>t.focus?[{statement:t.focus,name:t.viewer.name,colour:t.viewer.colour}]:[])}selfChip(t){let n=document.createElement("span");n.dataset.viewer=t.viewer.id,n.className="viewer self",n.style.setProperty("--viewer",t.viewer.colour),n.textContent=[...t.viewer.name][0]?.toUpperCase()??"?";let r=`You \xB7 ${t.viewer.name}`;return n.title=r,n.setAttribute("role","img"),n.setAttribute("aria-label",r),n}render(){let t=document.activeElement,n=t instanceof HTMLElement&&this.host.chips.contains(t)?t.dataset.viewer:void 0,r=this.others().map(i=>{let s=document.createElement("button");s.dataset.viewer=i.viewer.id,s.type="button",s.className=`viewer ${i.status}`,s.style.setProperty("--viewer",i.viewer.colour),s.textContent=[...i.viewer.name][0]?.toUpperCase()??"?";let a=`${i.viewer.name} \xB7 ${g_[i.status]}${i.focus?" \xB7 click to see where":""}`;return s.title=a,s.setAttribute("aria-label",a),s.disabled=!i.focus,s.addEventListener("click",()=>i.focus&&this.host.reveal(i.focus)),s}),o=this.self?this.roster.get(this.self):void 0;this.host.chips.replaceChildren(...o?[this.selfChip(o)]:[],...r),r.find(i=>i.dataset.viewer===n)?.focus(),this.host.chips.hidden=!o&&!r.length,this.redraw()}};var Hm=1e3,y_=3e4;function Gm(e){let t=[],n=[],r=[],o=null,i=!1,s=Hm,a;function c(){if(a=void 0,i)return;let u=!1,l=null,f=new WebSocket(e.url,e.protocols());o=f,f.addEventListener("open",()=>{u=!0;for(let m of t)m()}),f.addEventListener("message",m=>{let d=Ci(m.data);if(!d.ok){console.warn(`austere: skipped a sync frame: ${d.error.message}`);return}if(d.value){s=Hm,d.value.t==="error"&&(l=d.value);for(let g of n)g(d.value)}}),f.addEventListener("close",async m=>{o===f&&(o=null);let d={code:m.code,opened:u,error:l},g=m.code===1e3||m.code===1008||l?.code==="forbidden"||l?.code==="upgrade_required",b=!i&&!g;b&&e.mayRetry&&(b=await e.mayRetry(d)&&!i),b&&(a=setTimeout(c,s),s=Math.min(s*2,y_));for(let $ of r)$(d,b)})}return c(),{get connected(){return o?.readyState===WebSocket.OPEN},send(u){return o?.readyState!==WebSocket.OPEN?!1:(o.send(JSON.stringify(u)),!0)},onOpen:u=>{t.push(u)},onFrame:u=>{n.push(u)},onClose:u=>{r.push(u)},stop(){i=!0,clearTimeout(a),o?.close(1e3),o=null}}}var $e=window.__AUSTERE__??JSON.parse(document.getElementById("austere-boot")?.textContent||"{}"),ze=$e.id,H=$e.hosted||null,ie=$e.hosted?.base??`/s/${ze}`,Cf=$e.viewer||{role:"owner",name:""},fe=!H&&Cf.role==="owner",vr=Ot.nameChars,Be={get(e,t){try{let n=localStorage.getItem(e);return n==null?t:JSON.parse(n)}catch{return t}},set(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}},Ee={get(e){try{return JSON.parse(sessionStorage.getItem(e)||"null")}catch{return null}},set(e,t){try{return sessionStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}}},Pf=`austere:invite:${ze}`,Ym=/^[A-Za-z0-9_-]{16,256}$/,Se=null;if(H){let e=new URLSearchParams(location.hash.slice(1)).get("i");if(e!==null&&history.replaceState(null,"",location.pathname+location.search),e!==null&&Ym.test(e))Se=e,Be.set(Pf,e);else{let t=Be.get(Pf,null);Se=typeof t=="string"&&Ym.test(t)?t:null}window.addEventListener("hashchange",()=>{new URLSearchParams(location.hash.slice(1)).has("i")&&location.reload()})}var Ve,ge=H?"":Cf.name,rh="";if(H){let e=crypto.getRandomValues(new Uint8Array(16));rh=btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var ji=`austere:outbox:${ze}`,Xm=Ee.get(ji),xe=Array.isArray(Xm)?Xm.filter(e=>e?.m?.name==="addNote"&&typeof e.as=="string"&&typeof e.m.clientId=="string"&&/^[A-Za-z0-9_-]{8,64}$/.test(e.m.clientId)&&Number.isInteger(e.m.n)&&e.m.n>0&&(e.retryAt===void 0||typeof e.retryAt=="number")):[];function Lf(){return Ve?`invite:${Ve}`:"open"}function oh(){let e=Lf();return xe.filter(t=>t.as===e)}var b_=0,$r=!1,Of=null,zf=new Map,wr=null,at=null,h={mode:Be.get("austere:mode","annotate"),queue:Be.get(`austere:queue:${ze}`,[]),transcript:[],presence:"idle",status:"open",endedBy:null,closed:!1,unread:0,more:!1,program:null,revision:0,errorsRevision:0,renderReport:null,thirdParty:!1,frameReady:!1,scrollY:0,parserErrors:[],runtimeErrors:[],changes:[],highlight:!1,sheetOpen:Ee.get(`austere:sheet:${ze}`)===!0,sending:!1,connected:!1,editing:null,links:null},I=(e,t=document)=>t.querySelector(e);function v(e,t={},...n){let r=document.createElement(e);for(let[o,i]of Object.entries(t))i==null||i===!1||(o==="class"?r.className=String(i):o.startsWith("on")?typeof i=="function"&&r.addEventListener(o.slice(2),i):o==="text"?r.textContent=String(i):o==="html"?r.innerHTML=String(i):r.setAttribute(o,i===!0?"":String(i)));for(let o of n.flat())o!=null&&o!==!1&&r.append(o instanceof Node?o:document.createTextNode(String(o)));return r}document.body.innerHTML=`
62
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let u=e.external.registry.get(s[0])?.id;if(t!==s[0]&&u){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}a.count>1&&e.reused==="ref"&&i(s)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Kp(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!="object")return;Kp(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!="string")return;n.includes(s)||n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var qp=new Set(["type","properties","required","additionalProperties"]),Bp=["oneOf","anyOf"];function Jp(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function xu(e){let t=[];for(let i of e){if(typeof i!="object"||i.type!=="object")return null;for(let s in i)if(!qp.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let u of t){let l=u.properties?.[s]??Jp(u);l!=null&&(a.some(f=>JSON.stringify(f)===JSON.stringify(l))||a.push(l))}let c=a.length===1?a[0]:xu(a)??{allOf:a};G(n,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size&&(o.required=[...r]),t.every(i=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Jp(s);a&&!i.some(c=>JSON.stringify(c)===JSON.stringify(a))&&i.push(a)}i.length===1?o.additionalProperties=i[0]:i.length>1&&(o.additionalProperties={allOf:i})}return o}function zb(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of qp)if(o in e)return;let n=t.filter(o=>Bp.some(i=>Array.isArray(o[i]))),r=null;if(!n.length)r=xu(t);else{let o=n[0],i=Bp.find(c=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter(c=>c!==o),a=o[i].map(c=>xu([...s,c]));if(a.some(c=>!c))return;r={[i]:a}}r&&(delete e.allOf,nr(e,r))}function et(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,l={...u},f=c.ref;if(c.ref=null,f){r(f);let m=e.seen.get(f),g=m.schema;if(g.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(g)):nr(u,g),nr(u,l),a._zod.parent===f)for(let $ in u)$==="$ref"||$==="allOf"||$ in l||delete u[$];if(g.$ref&&m.def)for(let $ in u)$==="$ref"||$==="allOf"||$ in m.def&&JSON.stringify(u[$])===JSON.stringify(m.def[$])&&delete u[$]}let d=a._zod.parent;if(d&&d!==f){r(d);let m=e.seen.get(d);if(m?.schema.$ref&&(u.$ref=m.schema.$ref,m.def))for(let g in u)g==="$ref"||g==="allOf"||g in m.def&&JSON.stringify(u[g])===JSON.stringify(m.def[g])&&delete u[g]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Kp(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let u of[c.schema,c.def]){let l=u?.allOf;if(!Array.isArray(l))continue;let f=a.get(l);f?f.push(u):a.set(l,[u])}for(let c of e.intersections)for(let u of a.get(c)??[])zb(u)}}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 a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}nr(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;i!==void 0&&o.id===i&&delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,G(s,c.defId,c.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(s).length>0&&(e.target==="draft-2020-12"?o.$defs=s:o.definitions=s);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:on(t,"input",e.processors),output:on(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function oe(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return oe(r.element,n);if(r.type==="set")return oe(r.valueType,n);if(r.type==="lazy")return oe(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault"||r.type==="catch")return oe(r.innerType,n);if(r.type==="intersection")return oe(r.left,n)||oe(r.right,n);if(r.type==="record"||r.type==="map")return oe(r.keyType,n)||oe(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:oe(r.in,n)||oe(r.out,n);if(r.type==="object"){for(let o in r.shape)if(oe(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(oe(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(oe(o,n))return!0;return!!(r.rest&&oe(r.rest,n))}return!1}var zu=(e,t={})=>n=>{let r=Xe({...n,processors:t});return D(e,r),Qe(r,e),et(r,e)},on=(e,t,n={})=>r=>{let{libraryOptions:o,target:i}=r??{},s=Xe({...o??{},target:i,io:t,processors:n});return D(e,s),Qe(s,e),et(s,e)};var sn=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},an=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Hp=(e,t)=>{sn(e,"minimum",t),an(e,"maximum",t)},Xp=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},Qp=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},ed=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},td=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},Wp=(e,t)=>sn(e,"minimum",t.minimum),Gp=(e,t)=>an(e,"maximum",t.maximum),Yp=e=>(t,n)=>{td(t,n.format);let[r,o]=e[n.format];sn(t,"minimum",r),an(t,"maximum",o)},Sb={greater_than:(e,t)=>sn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>an(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>Xp(e,t.value),number_format:Yp(xn),bigint_format:Yp(zn),min_length:Wp,max_length:Gp,length_equals:(e,t)=>Hp(e,t.length),min_size:Wp,max_size:Gp,size_equals:(e,t)=>Hp(e,t.size),string_format:(e,t)=>{td(e,t.format),t.pattern&&Qp(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>ed(e,t.mime)};function q(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)Sb[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;o.minimum!==void 0&&sn(t,"minimum",o.minimum),o.exclusiveMinimum!==void 0&&sn(t,"exclusiveMinimum",o.exclusiveMinimum),o.maximum!==void 0&&an(t,"maximum",o.maximum),o.exclusiveMaximum!==void 0&&an(t,"exclusiveMaximum",o.exclusiveMaximum),o.multipleOf!==void 0&&Xp(t,o.multipleOf),o.format!==void 0&&(t.format??(t.format=o.format),o.format.includes("int")&&(t.isInt=!0)),o.mime&&ed(t,o.mime);for(let i of o.patterns??[])Qp(t,i);return t}var Ib={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Pb=new Map([[oo,Es],[Fn,Ns]]),nd=e=>Pb.get(e)??e,Pu=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:u,laxFormat:l}=q(e);if(typeof i=="number"&&(o.minLength=i),typeof s=="number"&&(o.maxLength=s),a&&(o.format=Ib[a]??a,o.format===""&&delete o.format,(a==="time"||l)&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let f=[...c].map(nd);f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},Ou=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:u,isInt:l}=q(e);o.type=l?"integer":"number";let f=typeof u=="number"&&u>=(i??Number.NEGATIVE_INFINITY),d=typeof c=="number"&&c<=(s??Number.POSITIVE_INFINITY),m=t.target==="draft-04"||t.target==="openapi-3.0";if(f?m?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof i=="number"&&(o.minimum=i),d?m?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof s=="number"&&(o.maximum=s),a){let g=new Set;for(let I of a)Number.isFinite(I)&&I!==0?g.add(Math.abs(I)):K(e,t,o,r,`A multipleOf divisor of ${I} cannot be represented in JSON Schema`);let[b,...$]=g;b!==void 0&&(o.multipleOf=b),$.length&&(o.allOf=[...o.allOf??[],...$.map(I=>({multipleOf:I}))])}},Au=(e,t,n,r)=>{n.type="boolean"},Eu=(e,t,n,r)=>{K(e,t,n,r,"BigInt cannot be represented in JSON Schema")},Nu=(e,t,n,r)=>{K(e,t,n,r,"Symbols cannot be represented in JSON Schema")},Zu=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"},Tu=(e,t,n,r)=>{K(e,t,n,r,"Undefined cannot be represented in JSON Schema")},Cu=(e,t,n,r)=>{K(e,t,n,r,"Void cannot be represented in JSON Schema")},Lu=(e,t,n,r)=>{n.not={}},Ru=(e,t,n,r)=>{},Du=(e,t,n,r)=>{},ju=(e,t,n,r)=>{K(e,t,n,r,"Date cannot be represented in JSON Schema")},Mu=(e,t,n,r)=>{let o=e._zod.def,i=Et(o.entries);if(i.length===0){n.not={};return}i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),n.enum=i},Vu=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(K(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s=="bigint"){if(K(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length!==0)if(i.length===1){let s=i[0];n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[s]:n.const=s}else i.every(s=>typeof s=="number")&&(n.type="number"),i.every(s=>typeof s=="string")&&(n.type="string"),i.every(s=>typeof s=="boolean")&&(n.type="boolean"),i.every(s=>s===null)&&(n.type="null"),n.enum=i},Fu=(e,t,n,r)=>{K(e,t,n,r,"NaN cannot be represented in JSON Schema")},Uu=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Bu=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=q(e);i!==void 0&&(o.minLength=i),s!==void 0&&(o.maxLength=s),a&&(a.length===0?o.not={}:a.length===1?o.contentMediaType=a[0]:o.anyOf=a.map(c=>({contentMediaType:c})))},Ju=(e,t,n,r)=>{n.type="boolean"},Ku=(e,t,n,r)=>{K(e,t,n,r,"Custom types cannot be represented in JSON Schema")},qu=(e,t,n,r)=>{K(e,t,n,r,"Function types cannot be represented in JSON Schema")},Hu=(e,t,n,r)=>{K(e,t,n,r,"Transforms cannot be represented in JSON Schema")},Wu=(e,t,n,r)=>{K(e,t,n,r,"Map cannot be represented in JSON Schema")},Gu=(e,t,n,r)=>{K(e,t,n,r,"Set cannot be represented in JSON Schema")},Yu=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=q(e);typeof s=="number"&&(o.minItems=s),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=D(i.element,t,{...r,path:[...r.path,"items"]})};function rr(e){let t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?rr(t.out):t.type==="catch"?rr(t.innerType):e._zod.optin}var Xu=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&K(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let u in s)G(o.properties,u,D(s[u],t,{...r,path:[...r.path,"properties",u]}));let c=[];for(let u of Object.keys(s)){let l=i.shape[u];(t.io==="input"?rr(l)===void 0:l._zod.optout===void 0)&&c.push(u)}c.length>0&&(o.required=c),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=D(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},ei=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>D(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));i?n.oneOf=s:n.anyOf=s},Qu=(e,t,n,r)=>{let o=e._zod.def,i=D(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=D(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},el=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((b,$)=>D(b,t,{...r,path:[...r.path,s,$]})),u=i.rest?D(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,l=i.items.length;for(;l>0;){let b=i.items[l-1];if(!(t.io==="input"?rr(b)!==void 0:b._zod.optout==="optional"))break;l--}let f=i.items.length,d=!i.rest;t.target==="draft-2020-12"?(o.prefixItems=c,d?o.items=!1:u&&(o.items=u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):t.target==="openapi-3.0"?(o.items={anyOf:c},u&&o.items.anyOf.push(u),l>0&&(o.minItems=l),d&&(o.maxItems=f)):(o.items=c,d?o.additionalItems=!1:u&&(o.additionalItems=u),l>0&&(o.minItems=l),d&&(o.maxItems=f));let{minimum:m,maximum:g}=q(e);typeof m=="number"&&(o.minItems=m),typeof g=="number"&&(o.maxItems=g)};function Su(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let g=e.get(t)?.def;if(!g)return t;let b=Su(e,g,n);return b===g?t:b}for(let g of["anyOf","oneOf"]){let b=t[g];if(!Array.isArray(b))continue;let $=b.map(I=>Su(e,I,n));$.some((I,x)=>I!==b[x])&&(t={...t,[g]:$})}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.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:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:u,multipleOf:l,format:f,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=(r.includes("number")?Re:Cn).source)),m}var Iu=new WeakMap;function Ob(e){let t=new Map;for(let r of e.seen.values())r.def&&!t.has(r.schema)&&t.set(r.schema,r);let n=new Map;for(let r of Iu.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Su(t,i,new Set);s!==i&&n.set(i,s)}if(n.size)for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);i&&(o.propertyNames=i)}}var tl=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=q(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let l=D(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let f of a)G(o.patternProperties,nd(f).source,l)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=D(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let l=Iu.get(t);l||(l=[],Iu.set(t,l),t.deferred.push(()=>Ob(t))),l.push(e)}o.additionalProperties=D(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,u=t.io==="input"&&rr(i.valueType)!==void 0;if(c&&!i.partial&&!u){let l=[...c].filter(f=>typeof f=="string"||typeof f=="number");l.length>0&&(o.required=l.map(String))}},nl=(e,t,n,r)=>{let o=e._zod.def,i=D(o.innerType,t,r),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},rl=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ol=Symbol();function rd(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>typeof c!="bigint"?c:(i=!0,null));return i?(K(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),ol):JSON.parse(s)}var il=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=rd(o.defaultValue,e,t,n,r);s!==ol&&(n.default=s)},sl=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=rd(o.defaultValue,e,t,n,r);s!==ol&&(n._prefault=s)},al=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{K(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},cl=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;D(s,t,r);let a=t.seen.get(e);a.ref=s},ul=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},ll=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},ti=(e,t,n,r)=>{let o=e._zod.def;D(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},fl=(e,t,n,r)=>{let o=e._zod.innerType;D(o,t,r);let i=t.seen.get(e);i.ref=o},Qo={string:Pu,number:Ou,boolean:Au,bigint:Eu,symbol:Nu,null:Zu,undefined:Tu,void:Cu,never:Lu,any:Ru,unknown:Du,date:ju,enum:Mu,literal:Vu,nan:Fu,template_literal:Uu,file:Bu,success:Ju,custom:Ku,function:qu,transform:Hu,map:Wu,set:Gu,array:Yu,object:Xu,union:ei,intersection:Qu,tuple:el,record:tl,nullable:nl,nonoptional:rl,default:il,prefault:sl,catch:al,pipe:cl,readonly:ul,promise:ll,optional:ti,lazy:fl};function ni(e,t){if("_idmap"in e){let r=e,o=Xe({...t,processors:Qo}),i={};for(let c of r._idmap.entries()){let[u,l]=c;D(l,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[u,l]=c;Qe(o,l),G(s,u,et(o,l))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=Xe({...t,processors:Qo});return D(e,n),Qe(n,e),et(n,e)}var ri=class{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 n=t?.target??"draft-2020-12";n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),this.ctx=Xe({processors:Qo,target:n,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,n={path:[],schemaPath:[]}){return D(t,this.ctx,n)}emit(t,n){n&&(n.cycles&&(this.ctx.cycles=n.cycles),n.reused&&(this.ctx.reused=n.reused),n.external&&(this.ctx.external=n.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Qe(this.ctx,t);let r=et(this.ctx,t),{"~standard":o,...i}=r;return i}};var od={};var hn={};Te(hn,{ZodAny:()=>Zl,ZodArray:()=>Rl,ZodBase64:()=>vi,ZodBase64URL:()=>ki,ZodBigInt:()=>dn,ZodBigIntFormat:()=>Si,ZodBoolean:()=>pn,ZodCIDRv4:()=>$i,ZodCIDRv6:()=>wi,ZodCUID:()=>di,ZodCUID2:()=>mi,ZodCatch:()=>of,ZodCodec:()=>dr,ZodCreditCard:()=>zl,ZodCustom:()=>mr,ZodCustomStringFormat:()=>St,ZodDate:()=>ar,ZodDefault:()=>Xl,ZodDiscriminatedUnion:()=>jl,ZodE164:()=>xi,ZodEmail:()=>ui,ZodEmoji:()=>fi,ZodEnum:()=>un,ZodExactOptional:()=>Ai,ZodFile:()=>Hl,ZodFunction:()=>hf,ZodGUID:()=>li,ZodIBAN:()=>Sl,ZodIPv4:()=>bi,ZodIPv6:()=>_i,ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,ZodInstanceOf:()=>bf,ZodIntersection:()=>Ml,ZodJWT:()=>zi,ZodKSUID:()=>yi,ZodLazy:()=>pf,ZodLiteral:()=>ql,ZodMAC:()=>xl,ZodMap:()=>Jl,ZodNaN:()=>af,ZodNanoID:()=>pi,ZodNever:()=>Cl,ZodNonOptional:()=>Ei,ZodNull:()=>El,ZodNullable:()=>Yl,ZodNumber:()=>fn,ZodNumberFormat:()=>It,ZodObject:()=>ur,ZodOptional:()=>fr,ZodPipe:()=>pr,ZodPrefault:()=>ef,ZodPreprocess:()=>cf,ZodPromise:()=>mf,ZodReadonly:()=>uf,ZodRecord:()=>cn,ZodSet:()=>Kl,ZodString:()=>ln,ZodStringFormat:()=>j,ZodSuccess:()=>rf,ZodSymbol:()=>Ol,ZodTemplateLiteral:()=>ff,ZodTransform:()=>Wl,ZodTuple:()=>Fl,ZodType:()=>E,ZodULID:()=>hi,ZodURL:()=>sr,ZodUUID:()=>Ae,ZodUndefined:()=>Al,ZodUnion:()=>lr,ZodUnknown:()=>Tl,ZodVoid:()=>Ll,ZodXID:()=>gi,ZodXor:()=>Dl,_ZodString:()=>ci,_default:()=>Ql,_function:()=>gm,any:()=>qd,array:()=>cr,base64:()=>Id,base64url:()=>Pd,bigint:()=>Fd,boolean:()=>Pl,catch:()=>sf,check:()=>ym,cidrv4:()=>zd,cidrv6:()=>Sd,codec:()=>pm,creditCard:()=>Ad,cuid:()=>yd,cuid2:()=>bd,currencyCode:()=>Ld,custom:()=>bm,date:()=>Wd,describe:()=>_m,discriminatedUnion:()=>tm,e164:()=>Od,email:()=>ad,emoji:()=>hd,enum:()=>Pi,exactOptional:()=>Gl,file:()=>cm,float32:()=>Dd,float64:()=>jd,function:()=>gm,guid:()=>cd,hash:()=>Rd,hex:()=>Cd,hostname:()=>Td,httpUrl:()=>md,iban:()=>Ed,instanceof:()=>wm,int:()=>si,int32:()=>Md,int64:()=>Ud,intersection:()=>Vl,invertCodec:()=>dm,ipv4:()=>vd,ipv6:()=>xd,json:()=>km,jwt:()=>Nd,keyof:()=>Gd,ksuid:()=>wd,lazy:()=>df,literal:()=>am,looseObject:()=>Qd,looseRecord:()=>rm,mac:()=>kd,map:()=>om,meta:()=>$m,nan:()=>fm,nanoid:()=>gd,nativeEnum:()=>sm,never:()=>Ii,nonoptional:()=>nf,null:()=>Nl,nullable:()=>ir,nullish:()=>um,number:()=>Il,object:()=>Yd,optional:()=>xt,partialRecord:()=>nm,pipe:()=>ai,prefault:()=>tf,preprocess:()=>xm,promise:()=>hm,readonly:()=>lf,record:()=>Bl,refine:()=>gf,set:()=>im,strictObject:()=>Xd,string:()=>or,stringFormat:()=>Zd,stringbool:()=>vm,success:()=>lm,superRefine:()=>yf,symbol:()=>Jd,templateLiteral:()=>mm,transform:()=>Oi,tuple:()=>Ul,uint32:()=>Vd,uint64:()=>Bd,ulid:()=>_d,undefined:()=>Kd,union:()=>mn,unknown:()=>kt,url:()=>dd,uuid:()=>ud,uuidv4:()=>ld,uuidv6:()=>fd,uuidv7:()=>pd,void:()=>Hd,xid:()=>$d,xor:()=>em});var oi={};Te(oi,{endsWith:()=>Gt,gt:()=>Pe,gte:()=>he,includes:()=>Ht,length:()=>wt,lowercase:()=>Kt,lt:()=>Ie,lte:()=>me,maxLength:()=>$t,maxSize:()=>Ye,mime:()=>Xt,minLength:()=>De,minSize:()=>Oe,multipleOf:()=>Ge,negative:()=>Wo,nonnegative:()=>Yo,nonpositive:()=>Go,normalize:()=>Qt,overwrite:()=>ke,positive:()=>Ho,properties:()=>Yt,property:()=>Xo,regex:()=>Jt,size:()=>_t,slugify:()=>rn,startsWith:()=>Wt,toLowerCase:()=>tn,toUpperCase:()=>nn,trim:()=>en,uppercase:()=>qt});var id=new WeakSet([Object.prototype,Error.prototype]);function ii(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var sd=(e,t)=>{fs.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);id.has(n)||(id.add(n),ii(n,"format",r=>o=>En(r,o)),ii(n,"flatten",r=>o=>An(r,o)),ii(n,"addIssue",r=>o=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Nt,2)}),ii(n,"addIssues",r=>o=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Nt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Eb=p("ZodError",sd),le=p("ZodError",sd,void 0,{Parent:Error});var pl=Rt(le),dl=Dt(le),ml=jt(le),hl=Mt(le),gl=Cr(le),yl=Lr(le),bl=Rr(le),_l=Dr(le),$l=jr(le),wl=Mr(le),vl=Vr(le),kl=Fr(le);function Zb(){W.localeError||U(wo())}function zt(){W.memoizer||U({memoizer:Wn()})}var E=p("ZodType",(e,t)=>(Zb(),O.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(k.mergeDefs(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(gf(e,t))},superRefine(e,t){return this.check(yf(e,t))},overwrite(e){return this.check(ke(e))},optional(){return xt(this)},exactOptional(){return Gl(this)},nullable(){return ir(this)},nullish(){return xt(ir(this))},nonoptional(e){return nf(this,e)},array(){return cr(this)},or(e){return mn([this,e])},and(e){return Vl(this,e)},transform(e){return ai(this,Oi(e))},default(e){return Ql(this,e)},prefault(e){return tf(this,e)},catch(e){return sf(this,e)},pipe(e){return ai(this,e)},readonly(){return lf(this)},describe(e){let t=this.clone();return Y.add(t,{description:e}),t},meta(...e){if(e.length===0)return Y.get(this);let t=this.clone();return Y.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 k.hide(this,"~standard",{...Qr(this),jsonSchema:{input:on(this,"input"),output:on(this,"output")}})},set"~standard"(e){k.own(this,"~standard",e)},parse:function e(t,n){return pl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await dl(this,t,n,{callee:e})},safeParse(e,t){return ml(this,e,t)},async safeParseAsync(e,t){return hl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){k.own(this,"spa",e)},validate(e,t){return Nn(this,e,t)},validateAsync(e,t){return Zn(this,e,t)},encode:function e(t,n){return gl(this,t,n,{callee:e})},decode:function e(t,n){return yl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await bl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await _l(this,t,n,{callee:e})},safeEncode(e,t){return $l(this,e,t)},safeDecode(e,t){return wl(this,e,t)},async safeEncodeAsync(e,t){return vl(this,e,t)},async safeDecodeAsync(e,t){return kl(this,e,t)},toJSONSchema(e){return zu(this,{})(e)},get description(){return Y.get(this)?.description},get _def(){return this._zod.def}}),ci=p("_ZodString",(e,t)=>{ht.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pu(e,n,r,o)},k.derived({format:e=>q(e).format??null,minLength:e=>q(e).minimum??null,maxLength:e=>q(e).maximum??null},{regex(...e){return this.check(Jt(...e))},includes(...e){return this.check(Ht(...e))},startsWith(...e){return this.check(Wt(...e))},endsWith(...e){return this.check(Gt(...e))},min(...e){return this.check(De(...e))},max(...e){return this.check($t(...e))},length(...e){return this.check(wt(...e))},nonempty(...e){return this.check(De(1,...e))},lowercase(e){return this.check(Kt(e))},uppercase(e){return this.check(qt(e))},trim(){return this.check(en())},normalize(...e){return this.check(Qt(...e))},toLowerCase(){return this.check(tn())},toUpperCase(){return this.check(nn())},slugify(){return this.check(rn())}})),ln=p("ZodString",(e,t)=>{ht.init(e,t),ci.init(e,t)},{email(e){return this.check(Io(ui,e))},url(e){return this.check(Yn(sr,e))},jwt(e){return this.check(qo(zi,e))},emoji(e){return this.check(Zo(fi,e))},guid(e){return this.check(Po(li,e))},uuid(e){return this.check(Oo(Ae,e))},uuidv4(e){return this.check(Ao(Ae,e))},uuidv6(e){return this.check(Eo(Ae,e))},uuidv7(e){return this.check(No(Ae,e))},nanoid(e){return this.check(To(pi,e))},cuid(e){return this.check(Co(di,e))},cuid2(e){return this.check(Lo(mi,e))},ulid(e){return this.check(Ro(hi,e))},base64(e){return this.check(Bo(vi,e))},base64url(e){return this.check(Jo(ki,e))},xid(e){return this.check(Do(gi,e))},ksuid(e){return this.check(jo(yi,e))},ipv4(e){return this.check(Mo(bi,e))},ipv6(e){return this.check(Vo(_i,e))},cidrv4(e){return this.check(Fo($i,e))},cidrv6(e){return this.check(Uo(wi,e))},e164(e){return this.check(Ko(xi,e))},datetime(e){return this.check(Xn(tt,e))},date(e){return this.check(Qn(nt,e))},time(e){return this.check(er(rt,e))},duration(e){return this.check(tr(ot,e))}});function or(e){return Vc(ln,e)}var j=p("ZodStringFormat",(e,t)=>{R.init(e,t),ci.init(e,t)}),tt=p("ZodISODateTime",(e,t)=>{Ea.init(e,t),j.init(e,t)}),nt=p("ZodISODate",(e,t)=>{Na.init(e,t),j.init(e,t)}),rt=p("ZodISOTime",(e,t)=>{Za.init(e,t),j.init(e,t)}),ot=p("ZodISODuration",(e,t)=>{Ta.init(e,t),j.init(e,t)}),ui=p("ZodEmail",(e,t)=>{$a.init(e,t),j.init(e,t)});function ad(e){return Io(ui,e)}var li=p("ZodGUID",(e,t)=>{ba.init(e,t),j.init(e,t)});function cd(e){return Po(li,e)}var Ae=p("ZodUUID",(e,t)=>{_a.init(e,t),j.init(e,t)});function ud(e){return Oo(Ae,e)}function ld(e){return Ao(Ae,e)}function fd(e){return Eo(Ae,e)}function pd(e){return No(Ae,e)}var sr=p("ZodURL",(e,t)=>{ka.init(e,t),j.init(e,t)});function dd(e){return Yn(sr,e)}function md(e){return Yn(sr,{protocol:Tn,hostname:Ts,...k.normalizeParams(e)})}var fi=p("ZodEmoji",(e,t)=>{xa.init(e,t),j.init(e,t)});function hd(e){return Zo(fi,e)}var pi=p("ZodNanoID",(e,t)=>{za.init(e,t),j.init(e,t)});function gd(e){return To(pi,e)}var di=p("ZodCUID",(e,t)=>{Sa.init(e,t),j.init(e,t)});function yd(e){return Co(di,e)}var mi=p("ZodCUID2",(e,t)=>{Ia.init(e,t),j.init(e,t)});function bd(e){return Lo(mi,e)}var hi=p("ZodULID",(e,t)=>{Pa.init(e,t),j.init(e,t)});function _d(e){return Ro(hi,e)}var gi=p("ZodXID",(e,t)=>{Oa.init(e,t),j.init(e,t)});function $d(e){return Do(gi,e)}var yi=p("ZodKSUID",(e,t)=>{Aa.init(e,t),j.init(e,t)});function wd(e){return jo(yi,e)}var bi=p("ZodIPv4",(e,t)=>{Ca.init(e,t),j.init(e,t)});function vd(e){return Mo(bi,e)}var xl=p("ZodMAC",(e,t)=>{Ra.init(e,t),j.init(e,t)});function kd(e){return Uc(xl,e)}var _i=p("ZodIPv6",(e,t)=>{La.init(e,t),j.init(e,t)});function xd(e){return Vo(_i,e)}var $i=p("ZodCIDRv4",(e,t)=>{Da.init(e,t),j.init(e,t)});function zd(e){return Fo($i,e)}var wi=p("ZodCIDRv6",(e,t)=>{ja.init(e,t),j.init(e,t)});function Sd(e){return Uo(wi,e)}var vi=p("ZodBase64",(e,t)=>{Ma.init(e,t),j.init(e,t)});function Id(e){return Bo(vi,e)}var ki=p("ZodBase64URL",(e,t)=>{Va.init(e,t),j.init(e,t)});function Pd(e){return Jo(ki,e)}var xi=p("ZodE164",(e,t)=>{Fa.init(e,t),j.init(e,t)});function Od(e){return Ko(xi,e)}var zl=p("ZodCreditCard",(e,t)=>{Ua.init(e,t),j.init(e,t)});function Ad(e){return Bc(zl,e)}var Sl=p("ZodIBAN",(e,t)=>{Ba.init(e,t),j.init(e,t)});function Ed(e){return Jc(Sl,e)}var zi=p("ZodJWT",(e,t)=>{Ja.init(e,t),j.init(e,t)});function Nd(e){return qo(zi,e)}var St=p("ZodCustomStringFormat",(e,t)=>{Ka.init(e,t),j.init(e,t)});function Zd(e,t,n={}){return vt(St,e,t,n)}function Td(e){return vt(St,"hostname",Zs,e)}function Cd(e){return vt(St,"hex",Hs,e)}function Ld(e){return vt(St,"currency_code",Ls,e)}function Rd(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=$e[r];if(!o)throw new Error(`Unrecognized hash format: ${r}`);return vt(St,r,o,t)}var fn=p("ZodNumber",(e,t)=>{uo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ou(e,n,r,o),e.isFinite=!0},k.derived({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=q(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=q(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:t,multipleOf:n}=q(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>q(e).format??null},{gt(e,t){return this.check(Pe(e,t))},gte(e,t){return this.check(he(e,t))},min(e,t){return this.check(he(e,t))},lt(e,t){return this.check(Ie(e,t))},lte(e,t){return this.check(me(e,t))},max(e,t){return this.check(me(e,t))},int(e){return this.check(si(e))},safe(e){return this.check(si(e))},positive(e){return this.check(Pe(0,e))},nonnegative(e){return this.check(he(0,e))},negative(e){return this.check(Ie(0,e))},nonpositive(e){return this.check(me(0,e))},multipleOf(e,t){return this.check(Ge(e,t))},step(e,t){return this.check(Ge(e,t))},finite(){return this}}));function Il(e){return qc(fn,e)}var It=p("ZodNumberFormat",(e,t)=>{qa.init(e,t),fn.init(e,t)});function si(e){return Wc(It,e)}function Dd(e){return Gc(It,e)}function jd(e){return Yc(It,e)}function Md(e){return Xc(It,e)}function Vd(e){return Qc(It,e)}var pn=p("ZodBoolean",(e,t)=>{Un.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Au(e,n,r,o)});function Pl(e){return eu(pn,e)}var dn=p("ZodBigInt",(e,t)=>{lo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Eu(e,n,r,o)},k.derived({minValue:e=>q(e).minimum??null,maxValue:e=>q(e).maximum??null,format:e=>q(e).format??null},{gte(e,t){return this.check(he(e,t))},min(e,t){return this.check(he(e,t))},gt(e,t){return this.check(Pe(e,t))},lt(e,t){return this.check(Ie(e,t))},lte(e,t){return this.check(me(e,t))},max(e,t){return this.check(me(e,t))},positive(e){return this.check(Pe(BigInt(0),e))},negative(e){return this.check(Ie(BigInt(0),e))},nonpositive(e){return this.check(me(BigInt(0),e))},nonnegative(e){return this.check(he(BigInt(0),e))},multipleOf(e,t){return this.check(Ge(e,t))}}));function Fd(e){return nu(dn,e)}var Si=p("ZodBigIntFormat",(e,t)=>{Ha.init(e,t),dn.init(e,t)});function Ud(e){return ou(Si,e)}function Bd(e){return iu(Si,e)}var Ol=p("ZodSymbol",(e,t)=>{Wa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nu(e,n,r,o)});function Jd(e){return su(Ol,e)}var Al=p("ZodUndefined",(e,t)=>{Ga.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tu(e,n,r,o)});function Kd(e){return au(Al,e)}var El=p("ZodNull",(e,t)=>{Ya.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zu(e,n,r,o)});function Nl(e){return cu(El,e)}var Zl=p("ZodAny",(e,t)=>{Xa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ru(e,n,r,o)});function qd(){return uu(Zl)}var Tl=p("ZodUnknown",(e,t)=>{Qa.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Du(e,n,r,o)});function kt(){return lu(Tl)}var Cl=p("ZodNever",(e,t)=>{ec.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lu(e,n,r,o)});function Ii(e){return fu(Cl,e)}var Ll=p("ZodVoid",(e,t)=>{tc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cu(e,n,r,o)});function Hd(e){return pu(Ll,e)}var ar=p("ZodDate",(e,t)=>{nc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ju(e,n,r,o),e.min=(n,r)=>e.check(he(n,r)),e.max=(n,r)=>e.check(me(n,r))},k.derived({minDate:e=>{let{minimum:t}=q(e);return t?new Date(t):null},maxDate:e=>{let{maximum:t}=q(e);return t?new Date(t):null}},{}));function Wd(e){return du(ar,e)}var Rl=p("ZodArray",(e,t)=>{zt(),oc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yu(e,n,r,o),e.element=t.element},{min(e,t){return this.check(De(e,t))},nonempty(e){return this.check(De(1,e))},max(e,t){return this.check($t(e,t))},length(e,t){return this.check(wt(e,t))},unwrap(){return this.element}});function cr(e,t){return gu(Rl,e,t)}function Gd(e){let t=e._zod.def.shape;return Pi(Object.keys(t))}var ur=p("ZodObject",(e,t)=>{zt(),ic.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xu(e,n,r,o),k.installLazyProp(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Pi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(k.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone(k.mergeDefs(this._zod.def,{catchall:kt()}))},loose(){return this.clone(k.mergeDefs(this._zod.def,{catchall:kt()}))},strict(){return this.clone(k.mergeDefs(this._zod.def,{catchall:Ii()}))},strip(){return this.clone(k.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return k.extend(this,e)},safeExtend(e){return k.safeExtend(this,e)},merge(e){return k.merge(this,e)},pick(e){return k.pick(this,e)},omit(e){return k.omit(this,e)},partial(...e){return k.partial(fr,this,e[0])},exactPartial(...e){return k.partial(Ai,this,e[0],"exactPartial")},required(...e){return k.required(Ei,this,e[0])}});function Yd(e,t){let n={type:"object",shape:e??{},...k.normalizeParams(t)};return new ur(n)}function Xd(e,t){return new ur({type:"object",shape:e,catchall:Ii(),...k.normalizeParams(t)})}function Qd(e,t){return new ur({type:"object",shape:e,catchall:kt(),...k.normalizeParams(t)})}var lr=p("ZodUnion",(e,t)=>{Bn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ei(e,n,r,o),e.options=t.options});function mn(e,t){return new lr({type:"union",options:e,...k.normalizeParams(t)})}var Dl=p("ZodXor",(e,t)=>{lr.init(e,t),sc.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ei(e,n,r,o),e.options=t.options});function em(e,t){return new Dl({type:"union",options:e,inclusive:!1,...k.normalizeParams(t)})}var jl=p("ZodDiscriminatedUnion",(e,t)=>{lr.init(e,t),cc.init(e,t)});function tm(e,t,n){return new jl({type:"union",options:t,discriminator:e,...k.normalizeParams(n)})}var Ml=p("ZodIntersection",(e,t)=>{uc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qu(e,n,r,o)});function Vl(e,t){return new Ml({type:"intersection",left:e,right:t})}var Fl=p("ZodTuple",(e,t)=>{zt(),fo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>el(e,n,r,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 fr({type:"optional",innerType:t}))})}});function Ul(e,t,n){let r=t instanceof O,o=r?n:t,i=r?t:null;return new Fl({type:"tuple",items:e,rest:i,...k.normalizeParams(o)})}var cn=p("ZodRecord",(e,t)=>{zt(),lc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tl(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Bl(e,t,n){return!t||!t._zod?new cn({type:"record",keyType:or(),valueType:e,...k.normalizeParams(t)}):new cn({type:"record",keyType:e,valueType:t,...k.normalizeParams(n)})}function nm(e,t,n){return new cn({type:"record",keyType:e,valueType:t,...k.normalizeParams(n),partial:!0})}function rm(e,t,n){return new cn({type:"record",keyType:e,valueType:t,mode:"loose",...k.normalizeParams(n)})}var Jl=p("ZodMap",(e,t)=>{zt(),fc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wu(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Oe(...n)),e.nonempty=n=>e.check(Oe(1,n)),e.max=(...n)=>e.check(Ye(...n)),e.size=(...n)=>e.check(_t(...n))});function om(e,t,n){return new Jl({type:"map",keyType:e,valueType:t,...k.normalizeParams(n)})}var Kl=p("ZodSet",(e,t)=>{zt(),pc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gu(e,n,r,o),e.min=(...n)=>e.check(Oe(...n)),e.nonempty=n=>e.check(Oe(1,n)),e.max=(...n)=>e.check(Ye(...n)),e.size=(...n)=>e.check(_t(...n))});function im(e,t){return new Kl({type:"set",valueType:e,...k.normalizeParams(t)})}var un=p("ZodEnum",(e,t)=>{dc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Mu(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new un({...t,checks:[],...k.normalizeParams(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new un({...t,checks:[],...k.normalizeParams(o),entries:i})}});function Pi(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new un({type:"enum",entries:n,...k.normalizeParams(t)})}function sm(e,t){return new un({type:"enum",entries:e,...k.normalizeParams(t)})}var ql=p("ZodLiteral",(e,t)=>{mc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vu(e,n,r,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 am(e,t){return new ql({type:"literal",values:Array.isArray(e)?e:[e],...k.normalizeParams(t)})}var Hl=p("ZodFile",(e,t)=>{hc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bu(e,n,r,o),e.min=(n,r)=>e.check(Oe(n,r)),e.max=(n,r)=>e.check(Ye(n,r)),e.mime=(n,r)=>e.check(Xt(Array.isArray(n)?n:[n],r))});function cm(e){return yu(Hl,e)}var Wl=p("ZodTransform",(e,t)=>{zt(),gc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hu(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new He(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(k.issue(i,n.value,t));else{let s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),"input"in s||(s.input=n.value),s.inst??(s.inst=e),n.issues.push(k.issue(s))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function Oi(e){return new Wl({type:"transform",transform:e})}var fr=p("ZodOptional",(e,t)=>{po.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ti(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function xt(e){return new fr({type:"optional",innerType:e})}var Ai=p("ZodExactOptional",(e,t)=>{yc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ti(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gl(e){return new Ai({type:"optional",innerType:e})}var Yl=p("ZodNullable",(e,t)=>{bc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ir(e){return new Yl({type:"nullable",innerType:e})}function um(e){return xt(ir(e))}var Xl=p("ZodDefault",(e,t)=>{_c.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>il(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ql(e,t){return new Xl({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var ef=p("ZodPrefault",(e,t)=>{$c.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function tf(e,t){return new ef({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():k.shallowClone(t)}})}var Ei=p("ZodNonOptional",(e,t)=>{wc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function nf(e,t){return new Ei({type:"nonoptional",innerType:e,...k.normalizeParams(t)})}var rf=p("ZodSuccess",(e,t)=>{vc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ju(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lm(e){return new rf({type:"success",innerType:e})}var of=p("ZodCatch",(e,t)=>{kc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>al(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function sf(e,t){return new of({type:"catch",innerType:e,catchValue:typeof t=="function"?t:k.constantCatch(t)})}var af=p("ZodNaN",(e,t)=>{xc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fu(e,n,r,o)});function fm(e){return hu(af,e)}var pr=p("ZodPipe",(e,t)=>{mo.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cl(e,n,r,o),e.in=t.in,e.out=t.out});function ai(e,t){return new pr({type:"pipe",in:e,out:t})}var dr=p("ZodCodec",(e,t)=>{pr.init(e,t),Jn.init(e,t)});function pm(e,t,n){return new dr({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function dm(e){let t=e._zod.def;return new dr({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var cf=p("ZodPreprocess",(e,t)=>{pr.init(e,t),zc.init(e,t)}),uf=p("ZodReadonly",(e,t)=>{Sc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ul(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lf(e){return new uf({type:"readonly",innerType:e})}var ff=p("ZodTemplateLiteral",(e,t)=>{Ic.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uu(e,n,r,o)});function mm(e,t){return new ff({type:"template_literal",parts:e,...k.normalizeParams(t)})}var pf=p("ZodLazy",(e,t)=>{Kn.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fl(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function df(e){return new pf({type:"lazy",getter:e})}var mf=p("ZodPromise",(e,t)=>{Oc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ll(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function hm(e){return new mf({type:"promise",innerType:e})}var hf=p("ZodFunction",(e,t)=>{Pc.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qu(e,n,r,o)});function gm(e){return new hf({type:"function",input:Array.isArray(e?.input)?Ul(e?.input):e?.input??cr(kt()),output:e?.output??kt()})}var mr=p("ZodCustom",(e,t)=>{Ac.init(e,t),E.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ku(e,n,r,o)});function ym(e){let t=new M({check:"custom"});return t._zod.check=e,t}function bm(e,t){return bu(mr,e??(()=>!0),t)}function gf(e,t={}){return _u(mr,e,t)}function yf(e,t){return $u(e,t)}var _m=wu,$m=vu,bf=p("ZodInstanceOf",(e,t)=>{mr.init(e,t)},{properties(e,t){return this.check(Yt(e,t))}});function wm(e,t={}){let n=new bf({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...k.normalizeParams(t)});return n._zod.bag.Class=e,n._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var vm=(...e)=>ku({Codec:dr,Boolean:pn,String:ln},...e);function km(e){let t=df(()=>mn([or(e),Il(),Pl(),Nl(),cr(t),Bl(or(),t)]));return t}function xm(e,t){return new cf({type:"pipe",in:Oi(e),out:t})}var Tb={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 Cb(e){U({customError:e})}function Lb(){return U().customError}var _f;_f||(_f={});var hr={};Te(hr,{ZodISODate:()=>nt,ZodISODateTime:()=>tt,ZodISODuration:()=>ot,ZodISOTime:()=>rt,date:()=>Db,datetime:()=>Rb,duration:()=>Mb,time:()=>jb});function Rb(e){return Xn(tt,e)}function Db(e){return Qn(nt,e)}function jb(e){return er(rt,e)}function Mb(e){return tr(ot,e)}var w={...hn,...oi,iso:hr},Vb=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 Fb(e,t){let n=e.$schema;return n==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":n==="http://json-schema.org/draft-07/schema#"?"draft-7":n==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function zm(e,t){return e.map((n,r)=>r<t?n:n.optional())}function Ub(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Bb(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:Ub(n[1]);if(!o||!t.defs[o])throw new Error(`Reference not found: ${e}`);return t.defs[o]}throw new Error(`Reference not found: ${e}`)}function Jb(e,t){return w.transform(r=>r).check(r=>{let o=r.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&&r.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&&r.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 s of i){let a=t.keySchema.safeParse(s);a.success||r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function $f(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=$f(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=$f(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}var Kb=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),qb=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function gr(e){return typeof e!="object"||e===null?!1:Array.isArray(e)?e.some(gr):typeof e.$ref=="string"?!0:Object.entries(e).some(([t,n])=>Kb.has(t)?gr(n):!qb.has(t)||typeof n!="object"||n===null?!1:Object.values(n).some(gr))}function Sm(e){return e===1?"element":"elements"}function Hb(e,t){return w.transform(r=>r).check(r=>{let o=r.value;if(Array.isArray(o)){if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=$f(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;a<i&&r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Sm(i)}; found ${a}`,input:o,continue:!0}),t.maxContains!==void 0&&a>t.maxContains&&r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Sm(t.maxContains)}`,input:o,continue:!0})}}}).pipe(e)}function Im(e,t){if(e!==!1)return e===void 0||e===!0?w.any():ie(e,t)}var Wb=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Pm(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=Bb(o,t),s=ie(i,t);return t.refs.set(o,s),t.processing.delete(o),s}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(s=>typeof s=="string"))return w.enum(o);let i=o.map(s=>w.literal(s));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 n=e.type;if(Array.isArray(n)){let o=n.map(i=>{let s={...e,type:i};return Pm(s,t)});return o.length===0?w.never():o.length===1?o[0]:w.union(o)}if(!n)return w.any();let r;switch(n){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(Wb)):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))),r=o;break}case"number":case"integer":{let o=n==="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)),r=o;break}case"boolean":{r=w.boolean();break}case"null":{r=w.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties=="object"?ie(e.additionalProperties,t):void 0;for(let[f,d]of Object.entries(i)){let m=ie(d,t);G(o,f,s.has(f)?m:m.optional())}if(e.patternProperties){let f=e.patternProperties,d=Object.keys(f),m=[];for(let b of d){let $=ie(f[b],t),I=w.string().regex(new RegExp(b));m.push(w.looseRecord(I,$))}let g=[];if(Object.keys(o).length>0&&g.push(w.object(o).passthrough()),g.push(...m),g.length===0)r=w.object({}).passthrough();else if(g.length===1)r=g[0];else{let b=w.intersection(g[0],g[1]);for(let $=2;$<g.length;$++)b=w.intersection(b,g[$]);r=b}if(e.additionalProperties===!1){let b=Object.keys(o),$=d.map(x=>new RegExp(x)),I=r;r=r.check(x=>{if(!be(x.value))return;let A=[];for(let C of Object.keys(x.value))b.includes(C)||$.some(V=>V.test(C))||A.push(C);A.length&&x.issues.push({code:"unrecognized_keys",keys:A,input:x.value,inst:I})})}}else{let f=w.object(o);e.additionalProperties===!1?r=f.strict():a?r=f.catchall(a):r=f.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,u=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(c||u!==void 0||l!==void 0){let f;if(c){let d=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;f=ie(d,t)}r=Jb(r,{keySchema:f,minProperties:u,maxProperties:l})}break}case"array":{let o=e.prefixItems,i=e.items;if(o&&Array.isArray(o)){let s=typeof e.minItems=="number"?e.minItems:0,a=o.map(f=>ie(f,t)),c=zm(a,s),u=Array.isArray(i)?void 0:Im(i,t),l=w.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let s=typeof e.minItems=="number"?e.minItems:0,a=i.map(f=>ie(f,t)),c=zm(a,s),u=Im(e.additionalItems,t),l=w.tuple(c);r=u?l.rest(u):l,typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let s=ie(i,t),a=w.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),r=a}else r=w.array(w.any());(e.uniqueItems===!0||e.contains!==void 0)&&(r=Hb(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?ie(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: ${n}`)}return r}function ie(e,t){if(typeof e=="boolean")return e?w.any():w.never();let n=Pm(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(u=>ie(u,t)),c=w.union(a);n=r?w.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(u=>ie(u,t)),c=w.xor(a);n=r?w.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:w.any();else{let a=r?n:ie(e.allOf[0],t),c=r?0:1;for(let u=c;u<e.allOf.length;u++)a=w.intersection(a,ie(e.allOf[u],t));n=a}e.nullable===!0&&t.version==="openapi-3.0"&&(n=w.nullable(n)),e.readOnly===!0&&(n=w.readonly(n)),e.default!==void 0&&(n=n.default(e.default));let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)a in e&&(o[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(o[a]=e[a]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!gr(e.propertyNames)&&(o.propertyNames=e.propertyNames);for(let a of["minProperties","maxProperties"])e[a]!==void 0&&(o[a]=e[a])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!gr(e.contains)&&(o.contains=e.contains);for(let a of["uniqueItems","minContains","maxContains"])e[a]!==void 0&&(o[a]=e[a])}for(let a of Object.keys(e))Vb.has(a)||G(o,a,e[a]);return Object.keys(o).length>0&&t.registry.add(n,o),e.description&&(n=n.describe(e.description)),n}function Om(e,t){if(typeof e=="boolean")return e?w.any():w.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Fb(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Y};return ie(n,i)}var Am=Symbol("z.visit/resolving");function yr(e,t){let n=typeof t=="function"?t:(s,a)=>{let c=t[s._zod.def.type];return c?c(s,a):s},r=new Map;function o(s){let a=r.get(s);if(a===Am)return new Kn({type:"lazy",getter:()=>r.get(s)});if(a!==void 0)return a;r.set(s,Am);let c=i(s),u=n(c,c!==s);return r.set(s,u),u}function i(s){let a=s._zod.def,c=a.type;switch(c){case"object":{let u=a.shape,l=Object.keys(u),f=!1,d={};for(let g of l){let b=o(u[g]);b!==u[g]&&(f=!0),d[g]=b}let m=a.catchall;return a.catchall&&(m=o(a.catchall),m!==a.catchall&&(f=!0)),f?L(s,{...a,shape:d,catchall:m}):s}case"array":{let u=o(a.element);return u===a.element?s:L(s,{...a,element:u})}case"tuple":{let u=a.items,l=!1,f=[];for(let m of u){let g=o(m);g!==m&&(l=!0),f.push(g)}let d=a.rest;return a.rest&&(d=o(a.rest),d!==a.rest&&(l=!0)),l?L(s,{...a,items:f,rest:d}):s}case"record":case"map":{let u=o(a.keyType),l=o(a.valueType);return u===a.keyType&&l===a.valueType?s:L(s,{...a,keyType:u,valueType:l})}case"set":{let u=o(a.valueType);return u===a.valueType?s:L(s,{...a,valueType:u})}case"union":{let u=a.options,l=!1,f=[];for(let d of u){let m=o(d);m!==d&&(l=!0),f.push(m)}return l?L(s,{...a,options:f}):s}case"intersection":{let u=o(a.left),l=o(a.right);return u===a.left&&l===a.right?s:L(s,{...a,left:u,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let u=o(a.innerType);return u===a.innerType?s:L(s,{...a,innerType:u})}case"pipe":{let u=o(a.in),l=o(a.out);return u===a.in&&l===a.out?s:L(s,{...a,in:u,out:l})}case"function":{let u=o(a.input),l=o(a.output);return u===a.input&&l===a.output?s:L(s,{...a,input:u,output:l})}case"lazy":{let u=a.getter,{_cachedInner:l,...f}=a;return L(s,{...f,getter:()=>o(u())})}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 s;default:return s}}return o(e)}function Em(e){return yr(e,{object:t=>t.partial(),union:t=>{let n=t._zod.def;return n.discriminator===void 0?t:mn(n.options)}})}function Gb(e,t){if(!t?.length)return e;let n=e._zod.def;return L(e,we(n,{checks:[...n.checks??[],...t]}),{parent:!0})}function Nm(e){return Gb(e.out,e.checks)}function Yb(e){return e.in._zod.traits.has("$ZodTransform")?Nm(e):e.in}function Zm(e){return yr(e,{pipe:t=>Yb(t._zod.def),default:(t,n)=>n?xt(t._zod.def.innerType):t,catch:(t,n)=>n?t._zod.def.innerType:t})}function Tm(e){return yr(e,{pipe:t=>Nm(t._zod.def),prefault:(t,n)=>n?t._zod.def.innerType:t})}var wf={};Te(wf,{bigint:()=>t_,boolean:()=>e_,date:()=>n_,number:()=>Qb,string:()=>Xb});function Xb(e){return Fc(ln,e)}function Qb(e){return Hc(fn,e)}function e_(e){return tu(pn,e)}function t_(e){return ru(dn,e)}function n_(e){return mu(ar,e)}U({jitless:!0});var kf=1,Cm=1,r_="austere-sync.1",Ot={frameBytes:65536,noteItemsBytes:4096,nameChars:40},o_=["upgrade_required","forbidden","rate_limited","too_large","invalid"];var i_=["publish","addNote","releaseNote","discardNote","addReply","grant","revoke","delete"];var s_=/^[A-Za-z_$][\w$]{0,99}$/,a_=/^[0-9a-f]{64}$/,c_=/^[A-Za-z0-9_-]{43}$/,u_=/^[A-Za-z0-9_-]{8,64}$/,l_=/^[A-Za-z0-9_-]{16,256}$/,Vm=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,f_=/^#[0-9a-f]{6}$/,p_=/^[A-Za-z0-9_-]{16}$/,xf=y.int().positive(),Fm=y.int().nonnegative(),Pt=y.int().nonnegative(),Lm=y.string().min(1).max(Ot.nameChars),Um=y.string().regex(a_),vf=y.string().regex(s_).nullable(),Ci=y.enum(["viewing","away","writing"]),d_=y.enum(["owner","reviewer"]),Rm={code:y.enum(o_),message:y.string(),retryAfter:y.int().nonnegative().optional()},Bm=y.discriminatedUnion("kind",[y.looseObject({kind:y.literal("message"),text:y.string()}),y.looseObject({kind:y.literal("annotation"),target:y.string().optional(),component:y.string().optional(),path:y.array(y.string()).optional(),selection:y.string().optional(),excerpt:y.string().optional(),note:y.string().optional(),detail:y.looseObject({part:y.string().optional(),row:y.string().optional(),column:y.string().optional(),rowIndex:y.int().optional()}).optional()})]),Jm=y.looseObject({sha256:Um,name:y.string().min(1),version:y.string().min(1)}),$w={publish:y.looseObject({title:y.string(),cliVersion:y.string().regex(Vm),html:Um,packs:y.array(Jm),auto:y.boolean(),unlisted:y.boolean(),presence:y.boolean()}),addNote:y.looseObject({items:y.array(Bm).min(1),name:y.string().optional()}),releaseNote:y.looseObject({note:y.string().min(1)}),discardNote:y.looseObject({note:y.string().min(1)}),addReply:y.looseObject({text:y.string().min(1)}),grant:y.looseObject({name:Lm,tokenHash:y.string().regex(c_),expiresAt:Pt.nullable()}),revoke:y.looseObject({name:Lm}),delete:y.looseObject({})},m_=y.looseObject({clientId:y.string().regex(u_),n:xf}),ww=m_.extend({v:y.int(),t:y.literal("mutation"),name:y.enum(i_),args:y.unknown()}),br={v:y.int(),id:y.string().min(1),seq:xf},h_=y.looseObject({...br,type:y.string()}),Dm={page:y.looseObject({...br,type:y.literal("page"),title:y.string(),cliVersion:y.string().regex(Vm),html:y.string(),packs:y.array(Jm),auto:y.boolean(),unlisted:y.boolean(),presence:y.boolean(),publishedAt:Pt,expiresAt:Pt,deleted:y.boolean()}),note:y.looseObject({...br,type:y.literal("note"),author:y.string(),items:y.array(Bm),at:Pt,state:y.enum(["held","released","discarded"])}),reply:y.looseObject({...br,type:y.literal("reply"),text:y.string(),at:Pt}),acl:y.looseObject({...br,type:y.literal("acl"),name:y.string(),grantedAt:Pt,expiresAt:Pt.nullable(),revoked:y.boolean(),grant:y.string().regex(p_).optional()})},vw={pull:y.looseObject({v:y.int(),t:y.literal("pull"),after:Fm}),hello:y.looseObject({v:y.int(),t:y.literal("hello"),status:Ci,name:y.string().optional()}),status:y.looseObject({v:y.int(),t:y.literal("status"),status:Ci}),focus:y.looseObject({v:y.int(),t:y.literal("focus"),statement:vf}),bye:y.looseObject({v:y.int(),t:y.literal("bye")})},g_=y.looseObject({v:y.int(),t:y.literal("changes"),rows:y.array(y.unknown()),cursor:Fm,more:y.boolean().optional(),reset:y.boolean().optional()}),Ni=y.string().min(1),jm={ack:y.looseObject({v:y.int(),t:y.literal("ack"),clientId:y.string(),n:xf,error:y.looseObject(Rm).optional()}),error:y.looseObject({v:y.int(),t:y.literal("error"),...Rm}),hello:y.looseObject({v:y.int(),t:y.literal("hello"),viewer:y.looseObject({id:Ni,name:y.string(),colour:y.string().regex(f_),role:d_}),status:Ci,focus:vf,self:y.boolean()}),status:y.looseObject({v:y.int(),t:y.literal("status"),viewer:Ni,status:Ci}),focus:y.looseObject({v:y.int(),t:y.literal("focus"),viewer:Ni,statement:vf}),bye:y.looseObject({v:y.int(),t:y.literal("bye"),viewer:Ni})},Ti=e=>({ok:!0,value:e}),_r=(e,t)=>({ok:!1,error:{code:e,message:t}}),Mm=(e,t)=>typeof t=="string"&&Object.hasOwn(e,t);function y_(e){return new TextEncoder().encode(e).length}function Zi(e,t){let n=t.issues[0],r=n&&n.path.length?`${e}.${n.path.join(".")}`:e;return _r("invalid",`${r}: ${n?n.message:"invalid"}`)}function Km(e,t){if(e.length*3<=t)return;let n=y_(e);return n>t?n:void 0}function b_(e,t){let n;try{n=typeof e=="string"?e:JSON.stringify(e)}catch{}if(n===void 0)return _r("invalid","frame is not JSON");let r=t===null?void 0:Km(n,t);if(r!==void 0)return _r("too_large",`frame is ${r} bytes; the limit is ${t}`);let o;try{o=JSON.parse(n)}catch{return _r("invalid","frame is not JSON")}if(!o||typeof o!="object"||Array.isArray(o))return _r("invalid","frame is not a JSON object");let i=o,s=qm(i.v,"frame");return s?{ok:!1,error:s}:Ti(i)}function qm(e,t){if(typeof e!="number"||!Number.isInteger(e))return{code:"invalid",message:`${t}.v: expected an integer protocol version`};if(e<Cm)return{code:"upgrade_required",message:`${t} speaks sync v${e}; v${Cm} or later is required`}}function Li(e){let t=b_(e,null);if(!t.ok)return t;let n=t.value;if(n.t==="changes"){let o=g_.safeParse(n);if(!o.success)return Zi("changes",o.error);let i=[],s=[];for(let[a,c]of o.data.rows.entries()){let u=h_.safeParse(c);if(!u.success)return Zi(`changes.rows.${a}`,u.error);let l=qm(u.data.v,`changes.rows.${a}`);if(l)return{ok:!1,error:l};if(!Mm(Dm,u.data.type)){s.push(u.data);continue}let f=Dm[u.data.type].safeParse(c);if(!f.success)return Zi(`changes.rows.${a}`,f.error);i.push(f.data)}return Ti({...o.data,rows:i,skipped:s})}if(!Mm(jm,n.t))return Ti(null);let r=jm[n.t].safeParse(n);return r.success?Ti(r.data):Zi(n.t,r.error)}function Hm(e,t,n){let r={v:kf,t:"mutation",clientId:n.clientId,n:n.n,name:e,args:t},o=Km(JSON.stringify(r),Ot.frameBytes);if(o!==void 0)throw new RangeError(`${e} is ${o} bytes; a frame may be at most ${Ot.frameBytes}`);return r}var __="austere-owner.",$_="austere-invite.";function Wm(e){let t=[r_];for(let[n,r]of[[__,e.owner],[$_,e.invite]])if(r!==void 0){if(!l_.test(r))throw new Error("sync token must be 16-256 base64url characters");t.push(n+r)}return t}var w_={viewing:"viewing",away:"away",writing:"writing a note"},Ri=class{constructor(t){Je(this,"roster",new Map);Je(this,"self",null);Je(this,"send",null);Je(this,"heartbeat");Je(this,"writing",new Set);Je(this,"focus",null);Je(this,"host");this.host=t,document.addEventListener("visibilitychange",()=>this.sendStatus())}status(){return document.visibilityState==="hidden"?"away":this.writing.size?"writing":"viewing"}connect(t){this.send=t,this.hello(),this.focus&&t({v:1,t:"focus",statement:this.focus}),window.clearInterval(this.heartbeat),this.heartbeat=window.setInterval(()=>this.send?.({v:1,t:"status",status:this.status()}),25e3)}disconnect(){this.send=null,window.clearInterval(this.heartbeat),this.self=null,this.roster.clear(),this.render()}rename(){this.send&&this.hello()}leave(){this.send?.({v:1,t:"bye"})}hello(){let t=this.host.name();this.send?.(t?{v:1,t:"hello",status:this.status(),name:t}:{v:1,t:"hello",status:this.status()})}handle(t){if(t.t==="hello")this.roster.set(t.viewer.id,{viewer:t.viewer,status:t.status,focus:t.focus}),t.self&&(this.self=t.viewer.id);else if(t.t==="bye")this.roster.delete(t.viewer),t.viewer===this.self&&(this.self=null);else{let n=this.roster.get(t.viewer);if(!n)return;t.t==="status"?n.status=t.status:n.focus=t.statement}this.render()}setFocus(t){t!==this.focus&&(this.focus=t,this.send?.({v:1,t:"focus",statement:t}))}setWriting(t,n){let r=this.status();n?this.writing.add(t):this.writing.delete(t),this.status()!==r&&this.sendStatus()}redraw(){this.host.showFocus(this.marks())}sendStatus(){this.send?.({v:1,t:"status",status:this.status()})}others(){return[...this.roster.values()].filter(t=>t.viewer.id!==this.self)}marks(){return this.others().flatMap(t=>t.focus?[{statement:t.focus,name:t.viewer.name,colour:t.viewer.colour}]:[])}selfChip(t){let n=document.createElement("span");n.dataset.viewer=t.viewer.id,n.className="viewer self",n.style.setProperty("--viewer",t.viewer.colour),n.textContent=[...t.viewer.name][0]?.toUpperCase()??"?";let r=`You \xB7 ${t.viewer.name}`;return n.title=r,n.setAttribute("role","img"),n.setAttribute("aria-label",r),n}render(){let t=document.activeElement,n=t instanceof HTMLElement&&this.host.chips.contains(t)?t.dataset.viewer:void 0,r=this.others().map(i=>{let s=document.createElement("button");s.dataset.viewer=i.viewer.id,s.type="button",s.className=`viewer ${i.status}`,s.style.setProperty("--viewer",i.viewer.colour),s.textContent=[...i.viewer.name][0]?.toUpperCase()??"?";let a=`${i.viewer.name} \xB7 ${w_[i.status]}${i.focus?" \xB7 click to see where":""}`;return s.title=a,s.setAttribute("aria-label",a),s.disabled=!i.focus,s.addEventListener("click",()=>i.focus&&this.host.reveal(i.focus)),s}),o=this.self?this.roster.get(this.self):void 0;this.host.chips.replaceChildren(...o?[this.selfChip(o)]:[],...r),r.find(i=>i.dataset.viewer===n)?.focus(),this.host.chips.hidden=!o&&!r.length,this.redraw()}};var Gm=1e3,v_=3e4;function Ym(e){let t=[],n=[],r=[],o=null,i=!1,s=Gm,a;function c(){if(a=void 0,i)return;let u=!1,l=null,f=new WebSocket(e.url,e.protocols());o=f,f.addEventListener("open",()=>{u=!0;for(let d of t)d()}),f.addEventListener("message",d=>{let m=Li(d.data);if(!m.ok){console.warn(`austere: skipped a sync frame: ${m.error.message}`);return}if(m.value){s=Gm,m.value.t==="error"&&(l=m.value);for(let g of n)g(m.value)}}),f.addEventListener("close",async d=>{o===f&&(o=null);let m={code:d.code,opened:u,error:l},g=d.code===1e3||d.code===1008||l?.code==="forbidden"||l?.code==="upgrade_required",b=!i&&!g;b&&e.mayRetry&&(b=await e.mayRetry(m)&&!i),b&&(a=setTimeout(c,s),s=Math.min(s*2,v_));for(let $ of r)$(m,b)})}return c(),{get connected(){return o?.readyState===WebSocket.OPEN},send(u){return o?.readyState!==WebSocket.OPEN?!1:(o.send(JSON.stringify(u)),!0)},onOpen:u=>{t.push(u)},onFrame:u=>{n.push(u)},onClose:u=>{r.push(u)},stop(){i=!0,clearTimeout(a),o?.close(1e3),o=null}}}var Xm="data-austere-inline",Qm="application/x-austere-gzip";async function k_(e){try{if(typeof DecompressionStream!="function")throw new Error("this browser cannot unpack the page (no DecompressionStream)");let t=Array.from(document.querySelectorAll(`script[type="${e}"]`)),n=await Promise.all(t.map(r=>{let o=atob((r.textContent??"").trim()),i=Uint8Array.from(o,s=>s.charCodeAt(0));return new Response(new Blob([i]).stream().pipeThrough(new DecompressionStream("gzip"))).text()}));for(let r of n){let o=document.createElement("script");o.textContent=r,document.head.appendChild(o)}}catch(t){document.documentElement.textContent=`This page could not start: ${t instanceof Error?t.message:String(t)}`}}var eh=`<script ${Xm}="loader">(${k_})(${JSON.stringify(Qm)})<\/script>`;function th(e,t){return`<script type="${Qm}" ${Xm}="${e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;")}">${t}<\/script>`}var de=window.__AUSTERE__??JSON.parse(document.getElementById("austere-boot")?.textContent||"{}"),ze=de.id,F=de.hosted||null,ee=de.hosted?.base??`/s/${ze}`,Cf=de.viewer||{role:"owner",name:""},fe=!F&&Cf.role==="owner",kr=Ot.nameChars,Be={get(e,t){try{let n=localStorage.getItem(e);return n==null?t:JSON.parse(n)}catch{return t}},set(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}},remove(e){try{localStorage.removeItem(e)}catch{}}},Ne={get(e){try{return JSON.parse(sessionStorage.getItem(e)||"null")}catch{return null}},set(e,t){try{return sessionStorage.setItem(e,JSON.stringify(t)),!0}catch{return!1}}},Pf=`austere:invite:${ze}`,nh=/^[A-Za-z0-9_-]{16,256}$/,Se=null;if(F){let e=new URLSearchParams(location.hash.slice(1)).get("i");if(e!==null&&history.replaceState(null,"",location.pathname+location.search),e!==null&&nh.test(e))Se=e,Be.set(Pf,e);else{let t=Be.get(Pf,null);Se=typeof t=="string"&&nh.test(t)?t:null}window.addEventListener("hashchange",()=>{new URLSearchParams(location.hash.slice(1)).has("i")&&location.reload()})}var Ve,ye=F?"":Cf.name,uh="";if(F){let e=crypto.getRandomValues(new Uint8Array(16));uh=btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var Mi=`austere:outbox:${ze}`,rh=Ne.get(Mi),xe=Array.isArray(rh)?rh.filter(e=>e?.m?.name==="addNote"&&typeof e.as=="string"&&typeof e.m.clientId=="string"&&/^[A-Za-z0-9_-]{8,64}$/.test(e.m.clientId)&&Number.isInteger(e.m.n)&&e.m.n>0&&(e.retryAt===void 0||typeof e.retryAt=="number")):[];function Lf(){return Ve?`invite:${Ve}`:"open"}function lh(){let e=Lf();return xe.filter(t=>t.as===e)}var x_=0,$r=!1,Of=null,zf=new Map,wr=null,at=null,h={mode:Be.get("austere:mode","annotate"),queue:Be.get(`austere:queue:${ze}`,[]),transcript:[],presence:"idle",status:"open",endedBy:null,closed:!1,unread:0,more:!1,program:null,revision:0,errorsRevision:0,renderReport:null,thirdParty:!1,frameReady:!1,scrollY:0,parserErrors:[],runtimeErrors:[],changes:[],highlight:!1,sheetOpen:Ne.get(`austere:sheet:${ze}`)===!0,sending:!1,connected:!1,editing:null,links:null},S=(e,t=document)=>t.querySelector(e);function v(e,t={},...n){let r=document.createElement(e);for(let[o,i]of Object.entries(t))i==null||i===!1||(o==="class"?r.className=String(i):o.startsWith("on")?typeof i=="function"&&r.addEventListener(o.slice(2),i):o==="text"?r.textContent=String(i):o==="html"?r.innerHTML=String(i):r.setAttribute(o,i===!0?"":String(i)));for(let o of n.flat())o!=null&&o!==!1&&r.append(o instanceof Node?o:document.createTextNode(String(o)));return r}document.body.innerHTML=`
63
63
  <div class="app">
64
64
  <header class="bar">
65
65
  <div class="bar-title"><span class="title"></span><span class="file"></span></div>
@@ -77,9 +77,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
77
77
  <button type="button" class="icon-btn menu-btn" aria-label="More">\u22EF</button>
78
78
  <div class="menu-pop" hidden>
79
79
  <button type="button" data-cmd="copy-path">Copy file path</button>
80
- <button type="button" data-cmd="copy-link">Copy review link</button>
80
+ <button type="button" data-cmd="copy-link"${F?" hidden":""}>${F?"Copy page link":"Copy review link"}</button>
81
+ ${F?'<div class="menu-note" data-share-note hidden>Only the owner can share this page. To invite someone, they run<code>austere-axi publish &lt;file&gt; --invite "Name"</code>which prints a link for that person.</div>':""}
81
82
  <button type="button" data-cmd="reload">Reload artifact</button>
82
- <a data-cmd="export" href="${ie}/export">Download standalone HTML</a>
83
+ ${F?'<button type="button" data-cmd="export">Download standalone HTML</button>':`<a data-cmd="export" href="${ee}/export">Download standalone HTML</a>`}
83
84
  <button type="button" data-cmd="end" class="danger">End review</button>
84
85
  <button type="button" data-cmd="close" class="danger">Close review</button>
85
86
  <button type="button" data-cmd="reopen">Reopen review</button>
@@ -114,7 +115,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
114
115
  </aside>
115
116
  </div>
116
117
  <button type="button" class="dock"></button>
117
- </div>`;if(!fe)for(let e of['[data-cmd="copy-path"]','[data-cmd="copy-link"]','[data-cmd="export"]','[data-cmd="end"]','[data-cmd="close"]','[data-cmd="reopen"]',".send-end"])I(e)?.remove();function Rf(){if(fe)return;I(".file").textContent=ge?`reviewing as ${ge}`:"";let e=H||Cf.auto?"Enter sends":"the owner sends your notes on \xB7 Enter sends";I(".composer-hint").textContent=ge?`Posting as ${ge} \xB7 ${e}`:e}var it=H?v("form",{class:"name-ask",hidden:!0},v("label",{for:"austere-name",text:"Your name, shown with your notes"}),v("div",{class:"name-row"},v("input",{id:"austere-name",maxlength:String(vr),autocomplete:"name",placeholder:"Name"}),v("button",{type:"submit",class:"btn primary",text:"Continue"}))):null;it&&(I(".composer").before(it),it.addEventListener("submit",e=>{e.preventDefault();let t=I("input",it),n=t.value.trim().slice(0,vr);if(!n)return t.focus();ge=n,Be.set("austere:name",n),it.hidden=!0,Rf(),pe.rename(),xr(!1)}));var he=H?.report?v("form",{class:"report-box",hidden:!0},v("label",{for:"austere-report",text:"What is wrong with this page?"}),v("textarea",{id:"austere-report",rows:"3",maxlength:"1000"}),v("div",{class:"report-row"},v("span",{class:"report-status"}),v("button",{type:"button",class:"btn tiny ghost",text:"Cancel",onclick:()=>{he&&(he.hidden=!0)}}),v("button",{type:"submit",class:"btn tiny primary",text:"Send report"}))):null;if(H){let e=v("footer",{class:"hosted-foot"},v("a",{href:"https://github.com/MandalorianBatman/austere-axi",target:"_blank",rel:"noopener noreferrer",text:"Made with austere-axi"}));he&&(e.append(v("span",{"aria-hidden":"true",text:"\xB7"}),v("button",{type:"button",class:"link-btn report-open",text:"Report",onclick:()=>{he.hidden=!1,I(".report-status",he).textContent="",I("textarea",he).focus()}})),I(".panel").append(he),he.addEventListener("submit",async t=>{t.preventDefault();let n=I("textarea",he).value.trim(),r=I(".report-status",he);if(!n)return I("textarea",he).focus();r.textContent="Sending\u2026";try{let o={"content-type":"application/json",...Se?{"X-Austere-Invite":Se}:{}},i=await fetch(H.report,{method:"POST",headers:o,body:JSON.stringify({reason:n})});if(!i.ok)throw new Error(`HTTP ${i.status}`);I("textarea",he).value="",he.hidden=!0,I(".report-open",e).replaceWith(v("span",{class:"report-done",text:"Reported. Thank you."}))}catch(o){r.textContent=`Not sent: ${o.message}`}})),I(".panel").append(e)}var Bi=I(".frame"),B=I(".log"),Fe=I(".composer textarea"),Ri=I(".banner");I(".title").textContent=$e.title;fe&&(I(".file").textContent=$e.name);Rf();var pe=new Li({chips:I(".viewers"),showFocus:e=>Ue({type:"presence",marks:e}),reveal:e=>Ue({type:"reveal",id:e}),name:()=>ge||void 0});Fe.addEventListener("focus",()=>pe.setWriting("composer",!0));Fe.addEventListener("blur",()=>pe.setWriting("composer",!1));window.addEventListener("pagehide",()=>pe.leave());I(".file").title=$e.file||"";document.title=`${$e.title} \xB7 austere`;function Mi(e){return String(e).replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function Sf(e){return Mi(e).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,'<a href="$2" target="_blank" rel="noopener">$1</a>')}function __(e){let t=String(e).replace(/\r\n/g,`
118
+ </div>`;if(!fe){let e=['[data-cmd="copy-path"]','[data-cmd="end"]','[data-cmd="close"]','[data-cmd="reopen"]',".send-end"];F||e.push('[data-cmd="copy-link"]','[data-cmd="export"]');for(let t of e)S(t)?.remove()}function Rf(){if(fe)return;S(".file").textContent=ye?`reviewing as ${ye}`:"";let e=F||Cf.auto?"Enter sends":"the owner sends your notes on \xB7 Enter sends";S(".composer-hint").textContent=ye?`Posting as ${ye} \xB7 ${e}`:e}var it=F?v("form",{class:"name-ask",hidden:!0},v("label",{for:"austere-name",text:"Your name, shown with your notes"}),v("div",{class:"name-row"},v("input",{id:"austere-name",maxlength:String(kr),autocomplete:"name",placeholder:"Name"}),v("button",{type:"submit",class:"btn primary",text:"Continue"}))):null;it&&(S(".composer").before(it),it.addEventListener("submit",e=>{e.preventDefault();let t=S("input",it),n=t.value.trim().slice(0,kr);if(!n)return t.focus();ye=n,Be.set("austere:name",n),it.hidden=!0,Rf(),pe.rename(),zr(!1)}));var ge=F?.report?v("form",{class:"report-box",hidden:!0},v("label",{for:"austere-report",text:"What is wrong with this page?"}),v("textarea",{id:"austere-report",rows:"3",maxlength:"1000"}),v("div",{class:"report-row"},v("span",{class:"report-status"}),v("button",{type:"button",class:"btn tiny ghost",text:"Cancel",onclick:()=>{ge&&(ge.hidden=!0)}}),v("button",{type:"submit",class:"btn tiny primary",text:"Send report"}))):null;if(F){let e=v("footer",{class:"hosted-foot"},v("a",{href:"https://github.com/MandalorianBatman/austere-axi",target:"_blank",rel:"noopener noreferrer",text:"Made with austere-axi"}));ge&&(e.append(v("span",{"aria-hidden":"true",text:"\xB7"}),v("button",{type:"button",class:"link-btn report-open",text:"Report",onclick:()=>{ge.hidden=!1,S(".report-status",ge).textContent="",S("textarea",ge).focus()}})),S(".panel").append(ge),ge.addEventListener("submit",async t=>{t.preventDefault();let n=S("textarea",ge).value.trim(),r=S(".report-status",ge);if(!n)return S("textarea",ge).focus();r.textContent="Sending\u2026";try{let o={"content-type":"application/json",...Se?{"X-Austere-Invite":Se}:{}},i=await fetch(F.report,{method:"POST",headers:o,body:JSON.stringify({reason:n})});if(!i.ok)throw new Error(`HTTP ${i.status}`);S("textarea",ge).value="",ge.hidden=!0,S(".report-open",e).replaceWith(v("span",{class:"report-done",text:"Reported. Thank you."}))}catch(o){r.textContent=`Not sent: ${o.message}`}})),S(".panel").append(e)}var Bi=S(".frame"),J=S(".log"),Fe=S(".composer textarea"),Di=S(".banner");S(".title").textContent=de.title;fe&&(S(".file").textContent=de.name);Rf();var pe=new Ri({chips:S(".viewers"),showFocus:e=>Ue({type:"presence",marks:e}),reveal:e=>Ue({type:"reveal",id:e}),name:()=>ye||void 0});Fe.addEventListener("focus",()=>pe.setWriting("composer",!0));Fe.addEventListener("blur",()=>pe.setWriting("composer",!1));window.addEventListener("pagehide",()=>pe.leave());S(".file").title=de.file||"";document.title=`${de.title} \xB7 austere`;function Vi(e){return String(e).replace(/[&<>"']/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[t])}function Sf(e){return Vi(e).replace(/`([^`]+)`/g,"<code>$1</code>").replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>").replace(/(^|[^*])\*([^*\n]+)\*/g,"$1<em>$2</em>").replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,'<a href="$2" target="_blank" rel="noopener">$1</a>')}function z_(e){let t=String(e).replace(/\r\n/g,`
118
119
  `).split(`
119
- `),n=[],r=0;for(;r<t.length;){let o=t[r];if(/^```/.test(o)){let s=[];for(r++;r<t.length&&!/^```/.test(t[r]);)s.push(t[r++]);r++,n.push(`<pre><code>${Mi(s.join(`
120
- `))}</code></pre>`);continue}if(/^\s*([-*]|\d+\.)\s+/.test(o)){let s=/^\s*\d+\./.test(o),a=[];for(;r<t.length&&/^\s*([-*]|\d+\.)\s+/.test(t[r]);)a.push(t[r++].replace(/^\s*([-*]|\d+\.)\s+/,""));n.push(`<${s?"ol":"ul"}>${a.map(c=>`<li>${Sf(c)}</li>`).join("")}</${s?"ol":"ul"}>`);continue}if(/^#{1,6}\s+/.test(o)){n.push(`<p><strong>${Sf(o.replace(/^#+\s+/,""))}</strong></p>`),r++;continue}if(!o.trim()){r++;continue}let i=[];for(;r<t.length&&t[r].trim()&&!/^```|^\s*([-*]|\d+\.)\s+|^#{1,6}\s/.test(t[r]);)i.push(t[r++]);n.push(`<p>${i.map(Sf).join("<br>")}</p>`)}return n.join("")}function Ue(e){Bi.contentWindow?.postMessage({austere:1,...e},"*")}function Df(){h.frameReady=!1,H?uh():Bi.src=`${$e.artifactUrl??`${ie}/a/`}?r=${Date.now()}`}window.addEventListener("message",e=>{if(e.source!==Bi.contentWindow)return;let t=e.data;if(!(!t||t.austere!==1))switch(t.type){case"hello":Ue({type:"init",mode:h.closed?"explore":h.mode,state:Ee.get(`austere:form:${ze}`),scrollY:h.scrollY});break;case"ready":h.frameReady=!0,t.title&&(I(".title").textContent=t.title,document.title=`${t.title} \xB7 austere`),h.highlight&&Nf(!1),pe.redraw(),pe.setWriting("note",!1);break;case"annotate":Vi(t.item);break;case"focus":typeof t.id=="string"&&pe.setFocus(t.id);break;case"writing":pe.setWriting("note",t.on===!0);break;case"action":Vi(t.item),O_();break;case"errors":h.parserErrors=(t.errors||[]).filter(r=>r.severity!=="warning"),h.errorsRevision=h.revision,q(),Af();break;case"runtime-error":let n=t.error;n&&!h.runtimeErrors.some(r=>r.statementId===n.statementId&&r.message===n.message)&&(h.runtimeErrors.push(n),h.errorsRevision=h.revision,q(),Af());break;case"state":Ee.set(`austere:form:${ze}`,t.state);break;case"scroll":h.scrollY=t.y||0;break;case"changes":h.changes=Array.isArray(t.ids)?t.ids.filter(r=>typeof r=="string").slice(0,50):[],Mf(),h.highlight&&Nf(!1);break;case"toggle-mode":bn(h.mode==="annotate"?"explore":"annotate");break;case"open-url":$_(t.url);break}});function $_(e){let t;try{t=new URL(String(e))}catch{return}!/^(https?|mailto):$/.test(t.protocol)||t.origin===location.origin||window.open(t.href,"_blank","noopener")}function kr(){Be.set(`austere:queue:${ze}`,h.queue)}function Vi(e){if(h.closed||!e||typeof e!="object"||typeof e.kind!="string")return;let t=e;for(let r of["target","component","note","text","selection","excerpt","message","statement"])r in t&&(t[r]=yn(t[r]));let n=e;n.qid=`q${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,h.queue.push(n),kr(),q(!0),Ze()}var Qm;function Af(){!fe||h.closed||h.thirdParty||(clearTimeout(Qm),Qm=setTimeout(async()=>{let e=[...h.parserErrors,...h.runtimeErrors].map(n=>({statement:yn(n.statementId),message:yn(n.message)}));if(!e.length)return;let t=await fetch(`${ie}/render-errors`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({revision:h.errorsRevision,errors:e})}).then(async n=>n.ok?await n.json():null,()=>null);h.renderReport=t&&!t.stale?"sent":t?null:"failed",q()},500))}function ih(e){h.queue=h.queue.filter(t=>t.qid!==e),kr(),q(),Ze()}function w_(e){return e.kind==="annotation"?{icon:"\u270E",text:e.target,sub:e.component}:e.kind==="action"?{icon:"\u2197",text:e.message,sub:"button"}:e.kind==="render-error"?{icon:"!",text:e.statement||"page",sub:"render issue"}:{icon:"",text:"",sub:""}}function Ji(e,t=""){let n=[];for(let[r,o]of Object.entries(e||{}))o&&typeof o=="object"&&!Array.isArray(o)?n.push(...Ji(o,"")):n.push(`${t}${r}: ${Array.isArray(o)?o.join(", "):o}`);return n}var yn=e=>typeof e=="string"?e:e==null?"":String(e);function v_(e){if(e.selection)return e.selection;if(e.detail?.part)return e.excerpt?`${e.detail.part} ${e.excerpt}`:e.detail.part;if(e.detail?.column){let t=[e.detail.row&&`row ${e.detail.row}`,`column ${e.detail.column}`].filter(Boolean).join(", ");return e.excerpt?`${e.excerpt} (${t})`:t}return e.kind==="action"&&e.form?Ji(e.form).join(" \xB7 "):e.kind==="render-error"?e.message:e.excerpt||""}function eh(e,t={}){try{return k_(e,t)}catch{return v("div",{class:"item"},v("div",{class:"note",text:"This note could not be displayed."}))}}function k_(e,{queued:t,held:n}={}){let r=w_(e),o=v("div",{class:`item kind-${e.kind}`});if(r.text){let a=v("button",{type:"button",class:"anchor",title:e.kind==="annotation"?"Show in the page":"",onclick:()=>{(e.kind==="annotation"||e.kind==="render-error")&&(Ue({type:"reveal",id:e.target||e.statement}),Vf()&&ut(!1))}},v("span",{class:"anchor-icon",text:r.icon}),v("span",{class:"anchor-text",text:r.text}),r.sub?v("span",{class:"anchor-sub",text:r.sub}):null);o.append(a)}if(n&&e.kind==="annotation"){let a=(Array.isArray(e.path)?e.path:[]).slice(0,-1).filter(c=>typeof c=="string"&&c!=="root");a.length&&o.append(v("div",{class:"anchor-sub",text:`within ${a.join(" > ")}`})),e.detail&&typeof e.detail=="object"&&o.append(v("div",{class:"anchor-sub",text:Ji(e.detail).join(" \xB7 ")}))}let i=yn(v_(e));i&&o.append(v("blockquote",{text:n||i.length<=260?i:i.slice(0,259)+"\u2026"}));let s=e.kind==="message"?e.text:e.note;if(t&&h.editing===e.qid){let a=v("textarea",{class:"edit",rows:"2"});a.value=s||"";let c=()=>{let u=a.value.trim();if(e.kind==="message"){if(!u)return ih(e.qid);e.text=u}else e.note=u;h.editing=null,kr(),q()};a.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey?(u.preventDefault(),c()):u.key==="Escape"&&(h.editing=null,q())}),a.addEventListener("blur",c),o.append(a),setTimeout(()=>a.focus(),0)}else s&&o.append(v("div",{class:"note",text:s}));return o}function Ef(e){return e?new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):""}function x_(e){return fe?e.author||"You":e.author===ge?"You":e.author||"Owner"}async function Fi(e,t){try{await fetch(`${ie}/${e}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{ids:t}:{all:!0})})}catch{ct("Could not reach the server. Try again.")}}function z_(e){if(H)return e.pending?v("div",{class:"receipt"},v("em",{text:"Sending\u2026"})):e.author===ge?v("div",{class:"receipt"},v("em",{text:"Sent to the page owner"})):null;if(e.held){let r=v("div",{class:"receipt held"},v("span",{class:"held-label",text:fe?"Held \xB7 not sent to the agent":"Waiting for the owner to send it on"}));return fe&&r.append(v("button",{type:"button",class:"btn tiny primary",text:"Send",onclick:()=>Fi("release",[e.id])}),v("button",{type:"button",class:"btn tiny ghost",text:"Discard",onclick:()=>Fi("discard",[e.id])})),r}let t=[["Seen",e.seenAt],["Working",e.workAt],["Done",e.doneAt]],n=v("div",{class:"receipt"});for(let[r,o]of t)n.append(v("span",{class:o?"on":"",title:o?`${r} ${Ef(o)}`:`Not ${r.toLowerCase()} yet`,text:r}));return e.seenAt||n.append(v("em",{text:h.presence==="listening"?"":h.unread?`waiting for the agent (${h.unread} unread)`:"waiting for the agent"})),n}var th=0;function q(e=!1){let t=B.scrollHeight-B.scrollTop-B.clientHeight<40;B.textContent="";let n=[...h.parserErrors,...h.runtimeErrors];if(n.length){let a=fe&&h.renderReport==="sent",c=`Render issues (${n.length})${a?" \xB7 sent to the agent":""}`,u=v("div",{class:"issues"},v("div",{class:"issues-head",text:c}));for(let l of n.slice(0,8))u.append(v("div",{class:"issue"},v("div",{class:"issue-text"},l.statementId?v("code",{text:l.statementId}):null," ",l.message),h.closed||a?null:v("button",{type:"button",class:"btn tiny",text:"Queue fix",onclick:()=>Vi({kind:"render-error",statement:l.statementId,target:l.statementId,message:l.message,note:"Fix this render error."})})));B.append(u)}h.more&&B.append(v("button",{type:"button",class:"btn tiny ghost load-earlier",text:"Load earlier messages",onclick:A_}));let r=oh().map(a=>({id:`out:${a.m.clientId}:${a.m.n}`,role:"user",author:ge,items:a.m.args.items,at:a.at,pending:!0})),o=r.length?[...h.transcript,...r]:h.transcript;!o.length&&!h.queue.length&&B.append(v("div",{class:"empty"},v("p",{html:"<strong>Point at anything to comment on it.</strong>"}),v("p",{text:`In Annotate mode, click a section, table cell, diagram node or diff line, or select text. Notes queue here; Send delivers them to the ${H?"page owner":"agent"}.`})));for(let a of o)if(a.role==="agent")B.append(v("div",{class:"msg agent"},v("div",{class:"who",text:`Agent \xB7 ${Ef(a.at)}`}),v("div",{class:"md",html:__(a.text)})));else{let c=v("div",{class:`msg user${a.held?" held":""}`},v("div",{class:"who",text:`${x_(a)} \xB7 ${Ef(a.at)}${a.end?" \xB7 ended review":""}`}));for(let l of a.items||[])c.append(eh(l,{held:!!a.held}));let u=z_(a);u&&c.append(u),B.append(c)}let i=fe?h.transcript.filter(a=>a.held).length:0;if(i&&B.append(v("div",{class:"held-bar"},v("span",{text:`${i} held from teammates`}),v("button",{type:"button",class:"btn tiny primary",text:"Send all",onclick:()=>Fi("release",h.transcript.filter(a=>a.held).map(a=>a.id))}),v("button",{type:"button",class:"btn tiny ghost",text:"Discard all",onclick:()=>Fi("discard")}))),h.queue.length){let a=v("div",{class:"queued"},v("div",{class:"queued-head",text:`Queued \xB7 ${h.queue.length}`}));for(let c of h.queue){let u=eh(c,{queued:!0});u.classList.add("q"),u.append(v("div",{class:"q-actions"},v("button",{type:"button",class:"btn tiny ghost",text:"Edit",onclick:()=>{h.editing=c.qid,q()}}),v("button",{type:"button",class:"btn tiny ghost",text:"Remove",onclick:()=>ih(c.qid)}))),a.append(u)}B.append(a)}if(h.closed)B.append(v("div",{class:"ended-note",text:fe?"You closed this review.":"The owner closed this review."}));else if(h.status==="ended"){let a=h.endedBy==="agent"?"The agent ended this review.":fe?"You ended this review.":"The owner ended this review.";B.append(v("div",{class:"ended-note",text:`${a} Notes you send now reach the agent the next time it polls.`}))}let s=o.length+h.queue.length;(e||t||s!==th)&&(B.scrollTop=B.scrollHeight),th=s,Ki()}function Ki(){let e=h.closed,t=h.queue.length;Fe.disabled=e||!!at||h.sending,I(".send").disabled=e||!!at||h.sending||!!H&&Ve===void 0,I(".send-end")&&(I(".send-end").disabled=e||h.sending),I(".send").textContent=h.sending?"Sending\u2026":t?`Send ${t}`:"Send",Fe.placeholder=e?"Review closed":t?"Add a message (optional)\u2026":"Message the agent\u2026"}function ct(e){let t=I(".composer-error");t.textContent=e||"",t.hidden=!e}async function xr(e=!1){if(h.sending||h.closed)return;let t=Fe.value.trim(),n=h.queue.map(({qid:r,...o})=>o);if(t&&n.push({kind:"message",text:t}),!n.length&&!e){Fe.focus();return}if(!(e&&!fe)&&!(e&&!n.length&&!confirm("End this review? The agent will stop listening; notes you send later still reach it."))){if(H)return P_(n);h.sending=!0,ct(""),Ki();try{let r=await fetch(`${ie}/send`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({items:n,end:e})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o.error||`HTTP ${r.status}`);h.queue=[],kr(),Fe.value="";let i=o.entry;i&&!h.transcript.some(s=>s.id===i.id)&&h.transcript.push(i)}catch(r){ct(`Not sent: ${r.message}. Your notes are still queued.`)}finally{h.sending=!1,q(!0),Ze()}}}function S_(e){if(e.kind==="message")return{kind:"message",text:yn(e.text)};if(e.kind==="action")return{kind:"message",text:[yn(e.message),e.form?Ji(e.form).join(" \xB7 "):""].filter(Boolean).join(" \xB7 ")};let t={kind:"annotation"},n=e.kind==="render-error"?e.statement:e.target;typeof n=="string"&&n&&(t.target=n);for(let o of["component","selection","excerpt","note"]){let i=e[o];typeof i=="string"&&i&&(t[o]=i)}e.kind==="render-error"&&typeof e.message=="string"&&(t.excerpt=e.message),Array.isArray(e.path)&&(t.path=e.path.filter(o=>typeof o=="string"));let r=e.detail;if(r&&typeof r=="object"){let o={};for(let i of["part","row","column"])typeof r[i]=="string"&&(o[i]=r[i]);Number.isInteger(r.rowIndex)&&(o.rowIndex=r.rowIndex),Object.keys(o).length&&(t.detail=o)}return t}var I_="This browser could not keep a copy of your note: keep this tab open until it shows \u201CSent to the page owner\u201D.";function Zf(){ct([Of,$r?I_:""].filter(Boolean).join(" "))}function jf(e){let t=(e.retryAt??0)-Date.now();if(t<=0){delete e.retryAt,wr?.send(e.m);return}zf.has(e)||zf.set(e,window.setTimeout(()=>{zf.delete(e),xe.includes(e)&&e.as===Lf()&&jf(e)},t))}function P_(e){if(at||Ve===void 0)return;if(Ve===null&&!ge&&it){it.hidden=!1,I("input",it).focus();return}let t=e.map(S_),n=new TextEncoder().encode(JSON.stringify(t)).length;if(n>Ot.noteItemsBytes){ct(`Too long to send: ${n} bytes, the limit is ${Ot.noteItemsBytes}. Shorten or remove a note.`);return}let o=qm("addNote",Ve===null?{items:t,name:ge}:{items:t},{clientId:rh,n:++b_});xe.push({m:o,at:Date.now(),as:Lf()}),$r=!Ee.set(ji,xe),wr?.send(o),h.queue=[],kr(),Fe.value="",Zf(),q(!0),Ze()}I(".composer").addEventListener("submit",e=>{e.preventDefault(),xr(!1)});I(".send-end")?.addEventListener("click",()=>xr(!0));Fe.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),xr(!1))});function bn(e){h.mode=e==="explore"?"explore":"annotate",Be.set("austere:mode",h.mode);let t=document.documentElement,n=t.classList.contains("exploring");t.classList.toggle("exploring",h.mode==="explore"),n&&h.mode==="annotate"&&(B.scrollTop=B.scrollHeight);for(let r of document.querySelectorAll(".seg button"))r.classList.toggle("on",r.dataset.mode===h.mode);Ue({type:"mode",mode:h.closed?"explore":h.mode})}for(let e of document.querySelectorAll(".seg button"))e.addEventListener("click",()=>bn(e.dataset.mode));document.addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&(e.key==="i"||e.key==="I")&&(e.preventDefault(),bn(h.mode==="annotate"?"explore":"annotate"))});function je(){let e=I(".presence"),t,n;h.closed?[t,n]=["Review closed","ended"]:at?[t,n]=[at,"ended"]:h.connected?H?[t,n]=["Shared page","hosted"]:h.presence==="listening"?[t,n]=["Agent listening","listening"]:h.presence==="working"?[t,n]=["Agent working","working"]:h.status==="ended"?[t,n]=["Agent stopped","idle"]:[t,n]=["Agent not listening","idle"]:[t,n]=["Reconnecting\u2026","off"],n==="idle"&&h.unread&&(t+=` \xB7 ${h.unread} waiting`),e.className=`presence ${n}`,e.textContent=t,e.title=n==="idle"?"Your notes are kept and reach the agent the next time it polls.":n==="working"?"The agent has your last batch.":n==="hosted"?"Notes go to the page owner. Replies show up here as they are posted.":"",document.documentElement.classList.toggle("is-ended",h.closed),fe&&(I('[data-cmd="end"]').hidden=h.status==="ended",I('[data-cmd="close"]').hidden=h.closed,I('[data-cmd="reopen"]').hidden=!h.closed&&h.status!=="ended"),Ze()}function Mf(){let e=I(".changes");if(e.setAttribute("aria-pressed",String(h.highlight)),!h.changes.length&&!h.highlight){e.hidden=!0;return}e.hidden=!1,e.textContent=`${h.changes.length} changed`,e.title=h.changes.length?`${h.highlight?"Hide":"Highlight"} what the last turn changed: ${h.changes.join(", ")}`:"The last turn changed nothing on the page. Click to stop highlighting."}function Nf(e){Ue({type:"highlight",ids:h.highlight?h.changes:[],scroll:e})}I(".changes").addEventListener("click",()=>{h.highlight=!h.highlight,Mf(),Nf(h.highlight)});var Ui=I(".menu-pop");I(".menu-btn").addEventListener("click",e=>{e.stopPropagation(),Ui.hidden=!Ui.hidden});document.addEventListener("click",()=>Ui.hidden=!0);Ui.addEventListener("click",async e=>{let t=e.target instanceof Element?e.target.closest("[data-cmd]")?.dataset.cmd:void 0;if(t){if(t==="copy-path"&&navigator.clipboard?.writeText($e.file),t==="copy-link"&&navigator.clipboard?.writeText(h.links?.remote||location.href),t==="reload"&&Df(),t==="end"){if(h.queue.length)return xr(!0);if(!confirm("End this review? The agent will stop listening."))return;await fetch(`${ie}/end`,{method:"POST"}).catch(()=>{})}if(t==="close"){if(!confirm("Close this review? No one can add notes until you reopen it."))return;await fetch(`${ie}/close`,{method:"POST"}).catch(()=>{})}t==="reopen"&&await fetch(`${ie}/reopen`,{method:"POST"}).catch(()=>{})}});var Vf=()=>window.matchMedia("(max-width: 860px)").matches;function ut(e){h.sheetOpen=e,Ee.set(`austere:sheet:${ze}`,e),document.documentElement.classList.toggle("sheet-open",e),e&&setTimeout(()=>B.scrollTop=B.scrollHeight,50)}function Ze(){let e=I(".dock"),t=h.queue.length,n=["Conversation"];t&&n.push(`${t} queued`);let r=h.transcript[h.transcript.length-1];r?.role==="agent"&&r.at>(Ee.get(`austere:seen:${ze}`)||0)&&n.push("new reply"),e.innerHTML=`<span class="dock-grip"></span><span>${Mi(n.join(" \xB7 "))}</span><span class="dock-presence ${Mi(I(".presence").className.replace("presence","").trim())}"></span>`}function O_(){let e=I(".dock");e.classList.remove("pulse"),e.offsetWidth,e.classList.add("pulse")}I(".dock").addEventListener("click",()=>{Ee.set(`austere:seen:${ze}`,Date.now()),ut(!0),Ze()});I(".sheet-close").addEventListener("click",()=>ut(!1));I(".scrim").addEventListener("click",()=>ut(!1));document.addEventListener("keydown",e=>{e.key==="Escape"&&h.sheetOpen&&Vf()&&ut(!1)});var st=null;I(".panel-head").addEventListener("touchstart",e=>st=e.touches[0].clientY,{passive:!0});I(".panel-head").addEventListener("touchend",e=>{st!=null&&e.changedTouches[0].clientY-st>60&&ut(!1),st=null},{passive:!0});I(".dock").addEventListener("touchstart",e=>st=e.touches[0].clientY,{passive:!0});I(".dock").addEventListener("touchend",e=>{st!=null&&st-e.changedTouches[0].clientY>40&&ut(!0),st=null},{passive:!0});function Tf(e){let t=I(".notice");if(!e||!e.length){t.hidden=!0;return}t.textContent=`Third-party pack code runs in this page: check queued items before you send (${e.join(", ")}).`,t.title=t.textContent,t.hidden=!1}function Me(e,t=[]){if(Ri.textContent="",!e){Ri.hidden=!0;return}Ri.append(v("span",{text:e}),...t),Ri.hidden=!1}function sh(e){for(let t of e){let n=h.transcript.findIndex(r=>r.id===t.id);t.discarded?n>=0&&h.transcript.splice(n,1):n>=0?h.transcript[n]=t:h.transcript.push(t)}h.transcript.sort((t,n)=>t.at-n.at)}async function A_(){let e=h.transcript[0];if(e)try{let t=await fetch(`${ie}/transcript?before=${encodeURIComponent(e.id)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=await t.json(),r=new Set(h.transcript.map(i=>i.id));h.transcript=[...(n.entries||[]).filter(i=>!i.discarded&&!r.has(i.id)),...h.transcript],h.more=!!n.more;let o=B.scrollHeight-B.scrollTop;q(),B.scrollTop=B.scrollHeight-o}catch(t){ct(`Could not load earlier messages: ${t.message}`)}}var nh=null,Di=0;function E_(){nh=new EventSource(`${ie}/events`);let e=nh;if(e.addEventListener("open",()=>{h.connected=!0,Di=0,Me(""),je()}),e.addEventListener("error",()=>{h.connected=!1,Di||(Di=Date.now()),je(),setTimeout(()=>{!h.connected&&Date.now()-Di>3500&&Me("Lost the austere-axi server. Run any austere-axi command to restart it; this page reconnects on its own.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})])},4e3)}),fe){let t=n=>{fetch(`${ie}/presence`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).catch(()=>{})};e.addEventListener("open",()=>pe.connect(t)),e.addEventListener("error",()=>pe.disconnect()),e.addEventListener("viewer",n=>{let r=Ci(n.data),o=r.ok?r.value:null;o&&(o.t==="hello"||o.t==="status"||o.t==="focus"||o.t==="bye")&&pe.handle(o)})}e.addEventListener("snapshot",t=>{let n=JSON.parse(t.data);h.transcript=(n.transcript||[]).filter(r=>!r.discarded),h.presence=n.presence,h.status=n.session.status,h.endedBy=n.session.endedBy,h.closed=!!n.session.closed,h.unread=n.session.unread||0,h.more=!!n.more,h.links=n.links,n.version&&n.version!==$e.version&&Me("austere-axi was updated. This page is running the previous version.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Tf(n.thirdPartyPacks),h.thirdParty=!!n.thirdPartyPacks?.length,h.program===null||n.revision===h.revision||n.program===h.program?(n.revision!==h.revision&&(h.errorsRevision=n.revision),h.revision=n.revision,Af()):(h.revision=n.revision,h.parserErrors=[],h.runtimeErrors=[],h.renderReport=null),h.program===null?h.program=n.program:n.program!==h.program&&(h.program=n.program,h.frameReady&&Ue({type:"source",program:n.program})),je(),q(),bn(h.mode)}),e.addEventListener("transcript",t=>{sh(JSON.parse(t.data).entries||[]),q(),Ze()}),e.addEventListener("presence",t=>{let n=JSON.parse(t.data);h.presence=n.presence,h.status=n.status,h.endedBy=n.endedBy,h.closed=!!n.closed,h.unread=n.unread||0,bn(h.mode),je(),q()}),e.addEventListener("changed",t=>{let n=JSON.parse(t.data);h.revision=n.revision,h.renderReport=null,h.parserErrors=[],h.runtimeErrors=[],Tf(n.thirdPartyPacks),h.thirdParty=!!n.thirdPartyPacks?.length,n.shellChanged||!h.frameReady?(h.program=n.program,h.changes=[],Mf(),Df()):(h.program=n.program,Ue({type:"source",program:n.program})),q()}),e.addEventListener("ended",t=>{let n=JSON.parse(t.data);h.status="ended",h.endedBy=n.by,n.closed&&(h.closed=!0,Ue({type:"mode",mode:"explore"})),je(),q()}),e.addEventListener("server",t=>{let n=JSON.parse(t.data);if(n.state==="revoked"){e.close(),h.connected=!1,Me("Your invite was revoked. Ask the owner for a new link.");return}n.state==="stopped"&&Me("The austere-axi server stopped. Run any austere-axi command to start it again; this page reconnects on its own.")})}var If=H?.publishedAt,ah=0;function gn(e,t,n=[]){at=e,h.connected=!1,wr?.stop(),Me(t,n),je(),Ki()}function Ff(e){if(e===403)Se?gn("Invite no longer valid","This invite is no longer valid. Ask the page owner for a new link."):gn("Invite required","This page is invite-only. Open it from the link the page owner sent you.");else if(e===404||e===410)gn("Page removed","This page is no longer available.");else return!1;return!0}async function ch(e){let t=await fetch(`${ie}/asset-token`,{method:"POST",headers:Se?{"X-Austere-Invite":Se}:{},signal:e});if(!t.ok)return{status:t.status};let n=await t.json().catch(()=>null),r=typeof n?.token=="string"&&/^[A-Za-z0-9_-]+$/.test(n.token)?n.token:void 0;return{status:t.status,token:r,name:typeof n?.name=="string"&&n.name?n.name.slice(0,vr):null}}async function uh(){let e=await ch().catch(()=>null);return e&&Ff(e.status)?!1:e?.token?(Ve=e.name??null,Ve?ge=Ve:(Se&&(Se=null,Be.remove(Pf)),ge=String(Be.get("austere:name","")||"").slice(0,vr)),Rf(),Ki(),Bi.src=`${$e.artifactUrl??`${ie}/a/`}${e.token}/`,!0):(Me(`Could not load this page${e?` (HTTP ${e.status})`:""}.`,[v("button",{type:"button",class:"btn tiny",text:"Retry",onclick:()=>lh()})]),!1)}function Z_(e){e.reset&&(h.transcript=[]);let t=[];for(let n of e.rows)n.type==="page"?N_(n):n.type==="note"?t.push({id:`note:${n.id}`,role:"user",author:n.author.slice(0,vr),items:n.items,at:n.at,discarded:n.state==="discarded"}):n.type==="reply"&&t.push({id:`reply:${n.id}`,role:"agent",text:n.text,at:n.at});sh(t),ah=e.cursor,q(),Ze()}function N_(e){if(e.deleted)return gn("Page removed","The owner removed this page.");If??(If=e.publishedAt),e.publishedAt!==If&&Me("New version, reload",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Tf(e.packs.map(t=>t.name))}function T_(e){let t=xe.findIndex(o=>o.m.clientId===e.clientId&&o.m.n===e.n);if(t<0)return;if(e.error?.code==="rate_limited"){let o=xe[t],i=Math.max(1,e.error.retryAfter??5);o.retryAt=Date.now()+i*1e3,$r=!Ee.set(ji,xe),Of=`Too many notes for now: sending again in ${i} s.`,Zf(),jf(o);return}let[n]=xe.splice(t,1),r=Ee.set(ji,xe);if($r&&(r||!xe.length)&&($r=!1),xe.some(o=>o.retryAt)||(Of=null),Zf(),e.error){for(let o of n.m.args.items)Vi({...o});ct(`Not sent: ${e.error.message}. Your notes are back in the queue.`)}q(),Ze()}function C_(e){e.t==="changes"?Z_(e):e.t==="ack"?T_(e):e.t==="error"&&e.code!=="forbidden"&&e.code!=="upgrade_required"&&ct(e.message)}function L_(e,t){h.connected=!1,!t&&!at&&(e.error?.code==="upgrade_required"?gn("Update needed","This page needs a newer review page. Reload to get it.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]):e.code===1e3&&!e.error?gn("Page removed","This page is no longer available."):Ff(403)),je()}var R_=5e3;async function lh(){if(Me(""),!await uh()||wr)return;let e=Gm({url:`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${ie}/sync`,protocols:()=>Wm(Se?{invite:Se}:{}),mayRetry:async t=>{if(at)return!1;if(t.opened)return!0;let n=await ch(AbortSignal.timeout(R_)).catch(()=>null);return!(n&&Ff(n.status))}});wr=e,e.onOpen(()=>{h.connected=!0,e.send({v:kf,t:"pull",after:ah});for(let t of oh())jf(t);je()}),e.onFrame(C_),e.onClose(L_),e.onOpen(()=>pe.connect(t=>{e.send(t)})),e.onFrame(t=>{(t.t==="hello"||t.t==="status"||t.t==="focus"||t.t==="bye")&&pe.handle(t)}),e.onClose(()=>pe.disconnect())}H||window.addEventListener("pagehide",e=>{e.persisted||navigator.sendBeacon?.(`${ie}/bye`)});bn(h.mode);Vf()&&h.sheetOpen&&ut(!0);je();q();Ze();H?lh():(Df(),E_());})();
120
+ `),n=[],r=0;for(;r<t.length;){let o=t[r];if(/^```/.test(o)){let s=[];for(r++;r<t.length&&!/^```/.test(t[r]);)s.push(t[r++]);r++,n.push(`<pre><code>${Vi(s.join(`
121
+ `))}</code></pre>`);continue}if(/^\s*([-*]|\d+\.)\s+/.test(o)){let s=/^\s*\d+\./.test(o),a=[];for(;r<t.length&&/^\s*([-*]|\d+\.)\s+/.test(t[r]);)a.push(t[r++].replace(/^\s*([-*]|\d+\.)\s+/,""));n.push(`<${s?"ol":"ul"}>${a.map(c=>`<li>${Sf(c)}</li>`).join("")}</${s?"ol":"ul"}>`);continue}if(/^#{1,6}\s+/.test(o)){n.push(`<p><strong>${Sf(o.replace(/^#+\s+/,""))}</strong></p>`),r++;continue}if(!o.trim()){r++;continue}let i=[];for(;r<t.length&&t[r].trim()&&!/^```|^\s*([-*]|\d+\.)\s+|^#{1,6}\s/.test(t[r]);)i.push(t[r++]);n.push(`<p>${i.map(Sf).join("<br>")}</p>`)}return n.join("")}function Ue(e){Bi.contentWindow?.postMessage({austere:1,...e},"*")}function Df(){h.frameReady=!1,F?mh():Bi.src=`${de.artifactUrl??`${ee}/a/`}?r=${Date.now()}`}window.addEventListener("message",e=>{if(e.source!==Bi.contentWindow)return;let t=e.data;if(!(!t||t.austere!==1))switch(t.type){case"hello":Ue({type:"init",mode:h.closed?"explore":h.mode,state:Ne.get(`austere:form:${ze}`),scrollY:h.scrollY});break;case"ready":h.frameReady=!0,t.title&&(S(".title").textContent=t.title,document.title=`${t.title} \xB7 austere`),h.highlight&&Zf(!1),pe.redraw(),pe.setWriting("note",!1);break;case"annotate":Fi(t.item);break;case"focus":typeof t.id=="string"&&pe.setFocus(t.id);break;case"writing":pe.setWriting("note",t.on===!0);break;case"action":Fi(t.item),C_();break;case"errors":h.parserErrors=(t.errors||[]).filter(r=>r.severity!=="warning"),h.errorsRevision=h.revision,H(),Af();break;case"runtime-error":let n=t.error;n&&!h.runtimeErrors.some(r=>r.statementId===n.statementId&&r.message===n.message)&&(h.runtimeErrors.push(n),h.errorsRevision=h.revision,H(),Af());break;case"state":Ne.set(`austere:form:${ze}`,t.state);break;case"scroll":h.scrollY=t.y||0;break;case"changes":h.changes=Array.isArray(t.ids)?t.ids.filter(r=>typeof r=="string").slice(0,50):[],Mf(),h.highlight&&Zf(!1);break;case"toggle-mode":bn(h.mode==="annotate"?"explore":"annotate");break;case"open-url":S_(t.url);break}});function S_(e){let t;try{t=new URL(String(e))}catch{return}!/^(https?|mailto):$/.test(t.protocol)||t.origin===location.origin||window.open(t.href,"_blank","noopener")}function xr(){Be.set(`austere:queue:${ze}`,h.queue)}function Fi(e){if(h.closed||!e||typeof e!="object"||typeof e.kind!="string")return;let t=e;for(let r of["target","component","note","text","selection","excerpt","message","statement"])r in t&&(t[r]=yn(t[r]));let n=e;n.qid=`q${Date.now().toString(36)}${Math.random().toString(36).slice(2,6)}`,h.queue.push(n),xr(),H(!0),Ze()}var oh;function Af(){!fe||h.closed||h.thirdParty||(clearTimeout(oh),oh=setTimeout(async()=>{let e=[...h.parserErrors,...h.runtimeErrors].map(n=>({statement:yn(n.statementId),message:yn(n.message)}));if(!e.length)return;let t=await fetch(`${ee}/render-errors`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({revision:h.errorsRevision,errors:e})}).then(async n=>n.ok?await n.json():null,()=>null);h.renderReport=t&&!t.stale?"sent":t?null:"failed",H()},500))}function fh(e){h.queue=h.queue.filter(t=>t.qid!==e),xr(),H(),Ze()}function I_(e){return e.kind==="annotation"?{icon:"\u270E",text:e.target,sub:e.component}:e.kind==="action"?{icon:"\u2197",text:e.message,sub:"button"}:e.kind==="render-error"?{icon:"!",text:e.statement||"page",sub:"render issue"}:{icon:"",text:"",sub:""}}function Ji(e,t=""){let n=[];for(let[r,o]of Object.entries(e||{}))o&&typeof o=="object"&&!Array.isArray(o)?n.push(...Ji(o,"")):n.push(`${t}${r}: ${Array.isArray(o)?o.join(", "):o}`);return n}var yn=e=>typeof e=="string"?e:e==null?"":String(e);function P_(e){if(e.selection)return e.selection;if(e.detail?.part)return e.excerpt?`${e.detail.part} ${e.excerpt}`:e.detail.part;if(e.detail?.column){let t=[e.detail.row&&`row ${e.detail.row}`,`column ${e.detail.column}`].filter(Boolean).join(", ");return e.excerpt?`${e.excerpt} (${t})`:t}return e.kind==="action"&&e.form?Ji(e.form).join(" \xB7 "):e.kind==="render-error"?e.message:e.excerpt||""}function ih(e,t={}){try{return O_(e,t)}catch{return v("div",{class:"item"},v("div",{class:"note",text:"This note could not be displayed."}))}}function O_(e,{queued:t,held:n}={}){let r=I_(e),o=v("div",{class:`item kind-${e.kind}`});if(r.text){let a=v("button",{type:"button",class:"anchor",title:e.kind==="annotation"?"Show in the page":"",onclick:()=>{(e.kind==="annotation"||e.kind==="render-error")&&(Ue({type:"reveal",id:e.target||e.statement}),Vf()&&ut(!1))}},v("span",{class:"anchor-icon",text:r.icon}),v("span",{class:"anchor-text",text:r.text}),r.sub?v("span",{class:"anchor-sub",text:r.sub}):null);o.append(a)}if(n&&e.kind==="annotation"){let a=(Array.isArray(e.path)?e.path:[]).slice(0,-1).filter(c=>typeof c=="string"&&c!=="root");a.length&&o.append(v("div",{class:"anchor-sub",text:`within ${a.join(" > ")}`})),e.detail&&typeof e.detail=="object"&&o.append(v("div",{class:"anchor-sub",text:Ji(e.detail).join(" \xB7 ")}))}let i=yn(P_(e));i&&o.append(v("blockquote",{text:n||i.length<=260?i:i.slice(0,259)+"\u2026"}));let s=e.kind==="message"?e.text:e.note;if(t&&h.editing===e.qid){let a=v("textarea",{class:"edit",rows:"2"});a.value=s||"";let c=()=>{let u=a.value.trim();if(e.kind==="message"){if(!u)return fh(e.qid);e.text=u}else e.note=u;h.editing=null,xr(),H()};a.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey?(u.preventDefault(),c()):u.key==="Escape"&&(h.editing=null,H())}),a.addEventListener("blur",c),o.append(a),setTimeout(()=>a.focus(),0)}else s&&o.append(v("div",{class:"note",text:s}));return o}function Ef(e){return e?new Date(e).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"}):""}function A_(e){return fe?e.author||"You":e.author===ye?"You":e.author||"Owner"}async function Ui(e,t){try{await fetch(`${ee}/${e}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t?{ids:t}:{all:!0})})}catch{ct("Could not reach the server. Try again.")}}function E_(e){if(F)return e.pending?v("div",{class:"receipt"},v("em",{text:"Sending\u2026"})):e.author===ye?v("div",{class:"receipt"},v("em",{text:"Sent to the page owner"})):null;if(e.held){let r=v("div",{class:"receipt held"},v("span",{class:"held-label",text:fe?"Held \xB7 not sent to the agent":"Waiting for the owner to send it on"}));return fe&&r.append(v("button",{type:"button",class:"btn tiny primary",text:"Send",onclick:()=>Ui("release",[e.id])}),v("button",{type:"button",class:"btn tiny ghost",text:"Discard",onclick:()=>Ui("discard",[e.id])})),r}let t=[["Seen",e.seenAt],["Working",e.workAt],["Done",e.doneAt]],n=v("div",{class:"receipt"});for(let[r,o]of t)n.append(v("span",{class:o?"on":"",title:o?`${r} ${Ef(o)}`:`Not ${r.toLowerCase()} yet`,text:r}));return e.seenAt||n.append(v("em",{text:h.presence==="listening"?"":h.unread?`waiting for the agent (${h.unread} unread)`:"waiting for the agent"})),n}var sh=0;function H(e=!1){let t=J.scrollHeight-J.scrollTop-J.clientHeight<40;J.textContent="";let n=[...h.parserErrors,...h.runtimeErrors];if(n.length){let a=fe&&h.renderReport==="sent",c=`Render issues (${n.length})${a?" \xB7 sent to the agent":""}`,u=v("div",{class:"issues"},v("div",{class:"issues-head",text:c}));for(let l of n.slice(0,8))u.append(v("div",{class:"issue"},v("div",{class:"issue-text"},l.statementId?v("code",{text:l.statementId}):null," ",l.message),h.closed||a?null:v("button",{type:"button",class:"btn tiny",text:"Queue fix",onclick:()=>Fi({kind:"render-error",statement:l.statementId,target:l.statementId,message:l.message,note:"Fix this render error."})})));J.append(u)}h.more&&J.append(v("button",{type:"button",class:"btn tiny ghost load-earlier",text:"Load earlier messages",onclick:L_}));let r=lh().map(a=>({id:`out:${a.m.clientId}:${a.m.n}`,role:"user",author:ye,items:a.m.args.items,at:a.at,pending:!0})),o=r.length?[...h.transcript,...r]:h.transcript;!o.length&&!h.queue.length&&J.append(v("div",{class:"empty"},v("p",{html:"<strong>Point at anything to comment on it.</strong>"}),v("p",{text:`In Annotate mode, click a section, table cell, diagram node or diff line, or select text. Notes queue here; Send delivers them to the ${F?"page owner":"agent"}.`})));for(let a of o)if(a.role==="agent")J.append(v("div",{class:"msg agent"},v("div",{class:"who",text:`Agent \xB7 ${Ef(a.at)}`}),v("div",{class:"md",html:z_(a.text)})));else{let c=v("div",{class:`msg user${a.held?" held":""}`},v("div",{class:"who",text:`${A_(a)} \xB7 ${Ef(a.at)}${a.end?" \xB7 ended review":""}`}));for(let l of a.items||[])c.append(ih(l,{held:!!a.held}));let u=E_(a);u&&c.append(u),J.append(c)}let i=fe?h.transcript.filter(a=>a.held).length:0;if(i&&J.append(v("div",{class:"held-bar"},v("span",{text:`${i} held from teammates`}),v("button",{type:"button",class:"btn tiny primary",text:"Send all",onclick:()=>Ui("release",h.transcript.filter(a=>a.held).map(a=>a.id))}),v("button",{type:"button",class:"btn tiny ghost",text:"Discard all",onclick:()=>Ui("discard")}))),h.queue.length){let a=v("div",{class:"queued"},v("div",{class:"queued-head",text:`Queued \xB7 ${h.queue.length}`}));for(let c of h.queue){let u=ih(c,{queued:!0});u.classList.add("q"),u.append(v("div",{class:"q-actions"},v("button",{type:"button",class:"btn tiny ghost",text:"Edit",onclick:()=>{h.editing=c.qid,H()}}),v("button",{type:"button",class:"btn tiny ghost",text:"Remove",onclick:()=>fh(c.qid)}))),a.append(u)}J.append(a)}if(h.closed)J.append(v("div",{class:"ended-note",text:fe?"You closed this review.":"The owner closed this review."}));else if(h.status==="ended"){let a=h.endedBy==="agent"?"The agent ended this review.":fe?"You ended this review.":"The owner ended this review.";J.append(v("div",{class:"ended-note",text:`${a} Notes you send now reach the agent the next time it polls.`}))}let s=o.length+h.queue.length;(e||t||s!==sh)&&(J.scrollTop=J.scrollHeight),sh=s,Ki()}function Ki(){let e=h.closed,t=h.queue.length;Fe.disabled=e||!!at||h.sending,S(".send").disabled=e||!!at||h.sending||!!F&&Ve===void 0,S(".send-end")&&(S(".send-end").disabled=e||h.sending),S(".send").textContent=h.sending?"Sending\u2026":t?`Send ${t}`:"Send",Fe.placeholder=e?"Review closed":t?"Add a message (optional)\u2026":"Message the agent\u2026"}function ct(e){let t=S(".composer-error");t.textContent=e||"",t.hidden=!e}async function zr(e=!1){if(h.sending||h.closed)return;let t=Fe.value.trim(),n=h.queue.map(({qid:r,...o})=>o);if(t&&n.push({kind:"message",text:t}),!n.length&&!e){Fe.focus();return}if(!(e&&!fe)&&!(e&&!n.length&&!confirm("End this review? The agent will stop listening; notes you send later still reach it."))){if(F)return T_(n);h.sending=!0,ct(""),Ki();try{let r=await fetch(`${ee}/send`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({items:n,end:e})}),o=await r.json().catch(()=>({}));if(!r.ok)throw new Error(o.error||`HTTP ${r.status}`);h.queue=[],xr(),Fe.value="";let i=o.entry;i&&!h.transcript.some(s=>s.id===i.id)&&h.transcript.push(i)}catch(r){ct(`Not sent: ${r.message}. Your notes are still queued.`)}finally{h.sending=!1,H(!0),Ze()}}}function N_(e){if(e.kind==="message")return{kind:"message",text:yn(e.text)};if(e.kind==="action")return{kind:"message",text:[yn(e.message),e.form?Ji(e.form).join(" \xB7 "):""].filter(Boolean).join(" \xB7 ")};let t={kind:"annotation"},n=e.kind==="render-error"?e.statement:e.target;typeof n=="string"&&n&&(t.target=n);for(let o of["component","selection","excerpt","note"]){let i=e[o];typeof i=="string"&&i&&(t[o]=i)}e.kind==="render-error"&&typeof e.message=="string"&&(t.excerpt=e.message),Array.isArray(e.path)&&(t.path=e.path.filter(o=>typeof o=="string"));let r=e.detail;if(r&&typeof r=="object"){let o={};for(let i of["part","row","column"])typeof r[i]=="string"&&(o[i]=r[i]);Number.isInteger(r.rowIndex)&&(o.rowIndex=r.rowIndex),Object.keys(o).length&&(t.detail=o)}return t}var Z_="This browser could not keep a copy of your note: keep this tab open until it shows \u201CSent to the page owner\u201D.";function Nf(){ct([Of,$r?Z_:""].filter(Boolean).join(" "))}function jf(e){let t=(e.retryAt??0)-Date.now();if(t<=0){delete e.retryAt,wr?.send(e.m);return}zf.has(e)||zf.set(e,window.setTimeout(()=>{zf.delete(e),xe.includes(e)&&e.as===Lf()&&jf(e)},t))}function T_(e){if(at||Ve===void 0)return;if(Ve===null&&!ye&&it){it.hidden=!1,S("input",it).focus();return}let t=e.map(N_),n=new TextEncoder().encode(JSON.stringify(t)).length;if(n>Ot.noteItemsBytes){ct(`Too long to send: ${n} bytes, the limit is ${Ot.noteItemsBytes}. Shorten or remove a note.`);return}let o=Hm("addNote",Ve===null?{items:t,name:ye}:{items:t},{clientId:uh,n:++x_});xe.push({m:o,at:Date.now(),as:Lf()}),$r=!Ne.set(Mi,xe),wr?.send(o),h.queue=[],xr(),Fe.value="",Nf(),H(!0),Ze()}S(".composer").addEventListener("submit",e=>{e.preventDefault(),zr(!1)});S(".send-end")?.addEventListener("click",()=>zr(!0));Fe.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),zr(!1))});function bn(e){h.mode=e==="explore"?"explore":"annotate",Be.set("austere:mode",h.mode);let t=document.documentElement,n=t.classList.contains("exploring");t.classList.toggle("exploring",h.mode==="explore"),n&&h.mode==="annotate"&&(J.scrollTop=J.scrollHeight);for(let r of document.querySelectorAll(".seg button"))r.classList.toggle("on",r.dataset.mode===h.mode);Ue({type:"mode",mode:h.closed?"explore":h.mode})}for(let e of document.querySelectorAll(".seg button"))e.addEventListener("click",()=>bn(e.dataset.mode));document.addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&(e.key==="i"||e.key==="I")&&(e.preventDefault(),bn(h.mode==="annotate"?"explore":"annotate"))});function Me(){let e=S(".presence"),t,n;h.closed?[t,n]=["Review closed","ended"]:at?[t,n]=[at,"ended"]:h.connected?F?[t,n]=["Shared page","hosted"]:h.presence==="listening"?[t,n]=["Agent listening","listening"]:h.presence==="working"?[t,n]=["Agent working","working"]:h.status==="ended"?[t,n]=["Agent stopped","idle"]:[t,n]=["Agent not listening","idle"]:[t,n]=["Reconnecting\u2026","off"],n==="idle"&&h.unread&&(t+=` \xB7 ${h.unread} waiting`),e.className=`presence ${n}`,e.textContent=t,e.title=n==="idle"?"Your notes are kept and reach the agent the next time it polls.":n==="working"?"The agent has your last batch.":n==="hosted"?"Notes go to the page owner. Replies show up here as they are posted.":"",document.documentElement.classList.toggle("is-ended",h.closed),fe&&(S('[data-cmd="end"]').hidden=h.status==="ended",S('[data-cmd="close"]').hidden=h.closed,S('[data-cmd="reopen"]').hidden=!h.closed&&h.status!=="ended"),Ze()}function Mf(){let e=S(".changes");if(e.setAttribute("aria-pressed",String(h.highlight)),!h.changes.length&&!h.highlight){e.hidden=!0;return}e.hidden=!1,e.textContent=`${h.changes.length} changed`,e.title=h.changes.length?`${h.highlight?"Hide":"Highlight"} what the last turn changed: ${h.changes.join(", ")}`:"The last turn changed nothing on the page. Click to stop highlighting."}function Zf(e){Ue({type:"highlight",ids:h.highlight?h.changes:[],scroll:e})}S(".changes").addEventListener("click",()=>{h.highlight=!h.highlight,Mf(),Zf(h.highlight)});var vr=S(".menu-pop");S(".menu-btn").addEventListener("click",e=>{e.stopPropagation(),vr.hidden=!vr.hidden});document.addEventListener("click",()=>vr.hidden=!0);vr.addEventListener("click",async e=>{let t=e.target instanceof Element?e.target.closest("[data-cmd]")?.dataset.cmd:void 0;if(!t)return e.stopPropagation();if(t==="copy-path"&&navigator.clipboard?.writeText(de.file),t==="copy-link"&&navigator.clipboard?.writeText(F?location.origin+location.pathname:h.links?.remote||location.href),t==="reload"&&Df(),t==="export"&&F&&(e.stopPropagation(),await M_(),vr.hidden=!0),t==="end"){if(h.queue.length)return zr(!0);if(!confirm("End this review? The agent will stop listening."))return;await fetch(`${ee}/end`,{method:"POST"}).catch(()=>{})}if(t==="close"){if(!confirm("Close this review? No one can add notes until you reopen it."))return;await fetch(`${ee}/close`,{method:"POST"}).catch(()=>{})}t==="reopen"&&await fetch(`${ee}/reopen`,{method:"POST"}).catch(()=>{})});var Vf=()=>window.matchMedia("(max-width: 860px)").matches;function ut(e){h.sheetOpen=e,Ne.set(`austere:sheet:${ze}`,e),document.documentElement.classList.toggle("sheet-open",e),e&&setTimeout(()=>J.scrollTop=J.scrollHeight,50)}function Ze(){let e=S(".dock"),t=h.queue.length,n=["Conversation"];t&&n.push(`${t} queued`);let r=h.transcript[h.transcript.length-1];r?.role==="agent"&&r.at>(Ne.get(`austere:seen:${ze}`)||0)&&n.push("new reply"),e.innerHTML=`<span class="dock-grip"></span><span>${Vi(n.join(" \xB7 "))}</span><span class="dock-presence ${Vi(S(".presence").className.replace("presence","").trim())}"></span>`}function C_(){let e=S(".dock");e.classList.remove("pulse"),e.offsetWidth,e.classList.add("pulse")}S(".dock").addEventListener("click",()=>{Ne.set(`austere:seen:${ze}`,Date.now()),ut(!0),Ze()});S(".sheet-close").addEventListener("click",()=>ut(!1));S(".scrim").addEventListener("click",()=>ut(!1));document.addEventListener("keydown",e=>{e.key==="Escape"&&h.sheetOpen&&Vf()&&ut(!1)});var st=null;S(".panel-head").addEventListener("touchstart",e=>st=e.touches[0].clientY,{passive:!0});S(".panel-head").addEventListener("touchend",e=>{st!=null&&e.changedTouches[0].clientY-st>60&&ut(!1),st=null},{passive:!0});S(".dock").addEventListener("touchstart",e=>st=e.touches[0].clientY,{passive:!0});S(".dock").addEventListener("touchend",e=>{st!=null&&st-e.changedTouches[0].clientY>40&&ut(!0),st=null},{passive:!0});function Tf(e){let t=S(".notice");if(!e||!e.length){t.hidden=!0;return}t.textContent=`Third-party pack code runs in this page: check queued items before you send (${e.join(", ")}).`,t.title=t.textContent,t.hidden=!1}function Ee(e,t=[]){if(Di.textContent="",!e){Di.hidden=!0;return}Di.append(v("span",{text:e}),...t),Di.hidden=!1}function ph(e){for(let t of e){let n=h.transcript.findIndex(r=>r.id===t.id);t.discarded?n>=0&&h.transcript.splice(n,1):n>=0?h.transcript[n]=t:h.transcript.push(t)}h.transcript.sort((t,n)=>t.at-n.at)}async function L_(){let e=h.transcript[0];if(e)try{let t=await fetch(`${ee}/transcript?before=${encodeURIComponent(e.id)}`);if(!t.ok)throw new Error(`HTTP ${t.status}`);let n=await t.json(),r=new Set(h.transcript.map(i=>i.id));h.transcript=[...(n.entries||[]).filter(i=>!i.discarded&&!r.has(i.id)),...h.transcript],h.more=!!n.more;let o=J.scrollHeight-J.scrollTop;H(),J.scrollTop=J.scrollHeight-o}catch(t){ct(`Could not load earlier messages: ${t.message}`)}}var ah=null,ji=0;function R_(){ah=new EventSource(`${ee}/events`);let e=ah;if(e.addEventListener("open",()=>{h.connected=!0,ji=0,Ee(""),Me()}),e.addEventListener("error",()=>{h.connected=!1,ji||(ji=Date.now()),Me(),setTimeout(()=>{!h.connected&&Date.now()-ji>3500&&Ee("Lost the austere-axi server. Run any austere-axi command to restart it; this page reconnects on its own.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})])},4e3)}),fe){let t=n=>{fetch(`${ee}/presence`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(n)}).catch(()=>{})};e.addEventListener("open",()=>pe.connect(t)),e.addEventListener("error",()=>pe.disconnect()),e.addEventListener("viewer",n=>{let r=Li(n.data),o=r.ok?r.value:null;o&&(o.t==="hello"||o.t==="status"||o.t==="focus"||o.t==="bye")&&pe.handle(o)})}e.addEventListener("snapshot",t=>{let n=JSON.parse(t.data);h.transcript=(n.transcript||[]).filter(r=>!r.discarded),h.presence=n.presence,h.status=n.session.status,h.endedBy=n.session.endedBy,h.closed=!!n.session.closed,h.unread=n.session.unread||0,h.more=!!n.more,h.links=n.links,n.version&&n.version!==de.version&&Ee("austere-axi was updated. This page is running the previous version.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Tf(n.thirdPartyPacks),h.thirdParty=!!n.thirdPartyPacks?.length,h.program===null||n.revision===h.revision||n.program===h.program?(n.revision!==h.revision&&(h.errorsRevision=n.revision),h.revision=n.revision,Af()):(h.revision=n.revision,h.parserErrors=[],h.runtimeErrors=[],h.renderReport=null),h.program===null?h.program=n.program:n.program!==h.program&&(h.program=n.program,h.frameReady&&Ue({type:"source",program:n.program})),Me(),H(),bn(h.mode)}),e.addEventListener("transcript",t=>{ph(JSON.parse(t.data).entries||[]),H(),Ze()}),e.addEventListener("presence",t=>{let n=JSON.parse(t.data);h.presence=n.presence,h.status=n.status,h.endedBy=n.endedBy,h.closed=!!n.closed,h.unread=n.unread||0,bn(h.mode),Me(),H()}),e.addEventListener("changed",t=>{let n=JSON.parse(t.data);h.revision=n.revision,h.renderReport=null,h.parserErrors=[],h.runtimeErrors=[],Tf(n.thirdPartyPacks),h.thirdParty=!!n.thirdPartyPacks?.length,n.shellChanged||!h.frameReady?(h.program=n.program,h.changes=[],Mf(),Df()):(h.program=n.program,Ue({type:"source",program:n.program})),H()}),e.addEventListener("ended",t=>{let n=JSON.parse(t.data);h.status="ended",h.endedBy=n.by,n.closed&&(h.closed=!0,Ue({type:"mode",mode:"explore"})),Me(),H()}),e.addEventListener("server",t=>{let n=JSON.parse(t.data);if(n.state==="revoked"){e.close(),h.connected=!1,Ee("Your invite was revoked. Ask the owner for a new link.");return}n.state==="stopped"&&Ee("The austere-axi server stopped. Run any austere-axi command to start it again; this page reconnects on its own.")})}var If=F?.publishedAt,dh=0;function gn(e,t,n=[]){at=e,h.connected=!1,wr?.stop(),Ee(t,n),Me(),Ki()}function Ff(e){if(e===403)Se?gn("Invite no longer valid","This invite is no longer valid. Ask the page owner for a new link."):gn("Invite required","This page is invite-only. Open it from the link the page owner sent you.");else if(e===404||e===410)gn("Page removed","This page is no longer available.");else return!1;return!0}async function Uf(e){let t=await fetch(`${ee}/asset-token`,{method:"POST",headers:Se?{"X-Austere-Invite":Se}:{},signal:e});if(!t.ok)return{status:t.status};let n=await t.json().catch(()=>null),r=typeof n?.token=="string"&&/^[A-Za-z0-9_-]+$/.test(n.token)?n.token:void 0;return{status:t.status,token:r,name:typeof n?.name=="string"&&n.name?n.name.slice(0,kr):null}}async function mh(){let e=await Uf().catch(()=>null);return e&&Ff(e.status)?!1:e?.token?(Ve=e.name??null,Ve?ye=Ve:(Se&&(Se=null,Be.remove(Pf)),ye=String(Be.get("austere:name","")||"").slice(0,kr)),Rf(),Ki(),Bi.src=`${de.artifactUrl??`${ee}/a/`}${e.token}/`,!0):(Ee(`Could not load this page${e?` (HTTP ${e.status})`:""}.`,[v("button",{type:"button",class:"btn tiny",text:"Retry",onclick:()=>hh()})]),!1)}function D_(e){let t="";for(let n=0;n<e.length;n+=32768)t+=String.fromCharCode(...e.subarray(n,n+32768));return btoa(t)}async function j_(e){let t=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));return D_(new Uint8Array(await new Response(t).arrayBuffer()))}var ch=/<script\b[^>]*\bsrc\s*=\s*["'](\/(?:rt|pk)\/[^"']+)["'][^>]*>\s*<\/script\s*>/gi;async function M_(){let e=S('[data-cmd="export"]');if(e.disabled)return;e.disabled=!0,e.textContent="Preparing download\u2026";let t;try{let n=await Uf();if(!n.token)throw new Error(`HTTP ${n.status}`);let r=await fetch(`${de.artifactUrl??`${ee}/a/`}${n.token}/`);if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=await r.text(),i=[...o.matchAll(ch)];if(!i.length)throw new Error("the page has no runtime script");let s=await Promise.all(i.map(async f=>{let d=await fetch(f[1]);if(!d.ok)throw new Error(`${f[1]}: HTTP ${d.status}`);return th(f[1].replace(/^\/rt\/[^/]+\//,""),await j_(await d.text()))})),a=0,c=o.replace(ch,()=>a++?"":[...s,eh].join(`
122
+ `));t=URL.createObjectURL(new Blob([c],{type:"text/html"}));let u=de.title.replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,"").slice(0,80)||"page",l=v("a",{href:t,download:`${u}.html`,hidden:!0});document.body.append(l),l.click(),l.remove()}catch(n){Ee(`Could not build the download: ${n instanceof Error?n.message:String(n)}`)}finally{t&&setTimeout(URL.revokeObjectURL,6e4,t),e.disabled=!1,e.textContent="Download standalone HTML"}}function V_(e){e.reset&&(h.transcript=[]);let t=[];for(let n of e.rows)n.type==="page"?F_(n):n.type==="note"?t.push({id:`note:${n.id}`,role:"user",author:n.author.slice(0,kr),items:n.items,at:n.at,discarded:n.state==="discarded"}):n.type==="reply"&&t.push({id:`reply:${n.id}`,role:"agent",text:n.text,at:n.at});ph(t),dh=e.cursor,H(),Ze()}function F_(e){if(e.deleted)return gn("Page removed","The owner removed this page.");If??(If=e.publishedAt),e.publishedAt!==If&&Ee("New version, reload",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]),Tf(e.packs.map(t=>t.name)),U_(e.unlisted)}function U_(e){S('[data-cmd="copy-link"]').hidden=!e,S("[data-share-note]").hidden=e}function B_(e){let t=xe.findIndex(o=>o.m.clientId===e.clientId&&o.m.n===e.n);if(t<0)return;if(e.error?.code==="rate_limited"){let o=xe[t],i=Math.max(1,e.error.retryAfter??5);o.retryAt=Date.now()+i*1e3,$r=!Ne.set(Mi,xe),Of=`Too many notes for now: sending again in ${i} s.`,Nf(),jf(o);return}let[n]=xe.splice(t,1),r=Ne.set(Mi,xe);if($r&&(r||!xe.length)&&($r=!1),xe.some(o=>o.retryAt)||(Of=null),Nf(),e.error){for(let o of n.m.args.items)Fi({...o});ct(`Not sent: ${e.error.message}. Your notes are back in the queue.`)}H(),Ze()}function J_(e){e.t==="changes"?V_(e):e.t==="ack"?B_(e):e.t==="error"&&e.code!=="forbidden"&&e.code!=="upgrade_required"&&ct(e.message)}function K_(e,t){h.connected=!1,!t&&!at&&(e.error?.code==="upgrade_required"?gn("Update needed","This page needs a newer review page. Reload to get it.",[v("button",{type:"button",class:"btn tiny",text:"Reload",onclick:()=>location.reload()})]):e.code===1e3&&!e.error?gn("Page removed","This page is no longer available."):Ff(403)),Me()}var q_=5e3;async function hh(){if(Ee(""),!await mh()||wr)return;let e=Ym({url:`${location.protocol==="https:"?"wss:":"ws:"}//${location.host}${ee}/sync`,protocols:()=>Wm(Se?{invite:Se}:{}),mayRetry:async t=>{if(at)return!1;if(t.opened)return!0;let n=await Uf(AbortSignal.timeout(q_)).catch(()=>null);return!(n&&Ff(n.status))}});wr=e,e.onOpen(()=>{h.connected=!0,e.send({v:kf,t:"pull",after:dh});for(let t of lh())jf(t);Me()}),e.onFrame(J_),e.onClose(K_),e.onOpen(()=>pe.connect(t=>{e.send(t)})),e.onFrame(t=>{(t.t==="hello"||t.t==="status"||t.t==="focus"||t.t==="bye")&&pe.handle(t)}),e.onClose(()=>pe.disconnect())}F||window.addEventListener("pagehide",e=>{e.persisted||navigator.sendBeacon?.(`${ee}/bye`)});bn(h.mode);Vf()&&h.sheetOpen&&ut(!0);Me();H();Ze();F?hh():(Df(),R_());})();