@transai/connector-runner-control-office 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var Gp=Object.create;var Xr=Object.defineProperty;var Wp=Object.getOwnPropertyDescriptor;var Xp=Object.getOwnPropertyNames;var qp=Object.getPrototypeOf,Hp=Object.prototype.hasOwnProperty;var ge=(e,r)=>{for(var i in r)Xr(e,i,{get:r[i],enumerable:!0})},Rl=(e,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of Xp(r))!Hp.call(e,t)&&t!==i&&Xr(e,t,{get:()=>r[t],enumerable:!(o=Wp(r,t))||o.enumerable});return e};var Yp=(e,r,i)=>(i=e!=null?Gp(qp(e)):{},Rl(r||!e||!e.__esModule?Xr(i,"default",{value:e,enumerable:!0}):i,e)),Qp=e=>Rl(Xr({},"__esModule",{value:!0}),e);var Xy={};ge(Xy,{ConnectorRunnerControlOffice:()=>Cl});module.exports=Qp(Xy);var Xt=Yp(require("node:process")),qr=class{#e="connector-runtime";#t;constructor(r,i){this.#t=i,Xt.default.on?Xt.default.on("message",o=>{o.cmd===this.#e&&i.logger.verbose(`${Xt.default.pid} Received message from parent process:`,o)}):i.logger.warn("IPC channel is not available. process.on is undefined."),Xt.default.send||i.logger.warn("IPC channel is not available. process.send is undefined."),r.actions?.forEach(o=>{if(o.config.templates===void 0)return;let t={};Object.entries(o.config.templates).forEach(([n,a])=>{try{t[n]=i.templating.compile(a)}catch(u){i.logger.error(`Error compiling template ${n} for action ${o.identifier}`,u)}}),o.config.parsedTemplates=t})}init=()=>Promise.resolve();start=()=>Promise.resolve();stop=()=>Promise.resolve();set callbackFunction(r){this.connectorSDK.receiver.registerCallback(this.#r(r))}get connectorSDK(){return this.#t}#r(r){return async i=>{let o=await this.#t.receiver.getActionConfig(i);return o?r(i,o):this.#t.receiver.responses.badRequest("Action not found")(i)}}};var ot=class extends Error{};var at=class extends Error{};var W={};ge(W,{$brand:()=>xo,$input:()=>Xu,$output:()=>Wu,INVALID:()=>Q,NEVER:()=>ko,TimePrecision:()=>uc,ZodAny:()=>Ws,ZodArray:()=>Ys,ZodBase64:()=>Gi,ZodBase64URL:()=>Wi,ZodBigInt:()=>Jt,ZodBigIntFormat:()=>Hi,ZodBoolean:()=>Mt,ZodCIDRv4:()=>Bi,ZodCIDRv6:()=>Ki,ZodCUID:()=>Ei,ZodCUID2:()=>Li,ZodCatch:()=>yl,ZodCodec:()=>Jr,ZodCompileAsyncError:()=>me,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>Rs,ZodCustom:()=>Br,ZodCustomStringFormat:()=>tt,ZodDate:()=>Er,ZodDefault:()=>ml,ZodDiscriminatedUnion:()=>el,ZodE164:()=>Xi,ZodEmail:()=>Ai,ZodEmoji:()=>Zi,ZodEnum:()=>Rt,ZodError:()=>hy,ZodExactOptional:()=>to,ZodFile:()=>sl,ZodFirstPartyTypeKind:()=>Ul,ZodFunction:()=>Dl,ZodGUID:()=>Ti,ZodIBAN:()=>Vs,ZodIPv4:()=>Mi,ZodIPv6:()=>Ji,ZodISODate:()=>Te,ZodISODateTime:()=>Ae,ZodISODuration:()=>Ce,ZodISOTime:()=>Ze,ZodInstanceOf:()=>Nl,ZodIntersection:()=>tl,ZodIssueCode:()=>by,ZodJWT:()=>qi,ZodKSUID:()=>Fi,ZodLazy:()=>Sl,ZodLiteral:()=>cl,ZodMAC:()=>Ls,ZodMap:()=>al,ZodNaN:()=>bl,ZodNanoID:()=>Ci,ZodNever:()=>qs,ZodNonOptional:()=>ro,ZodNull:()=>Ks,ZodNullable:()=>fl,ZodNumber:()=>Ft,ZodNumberFormat:()=>rt,ZodObject:()=>Rr,ZodOptional:()=>Fr,ZodPipe:()=>Mr,ZodPrefault:()=>gl,ZodPreprocess:()=>kl,ZodPromise:()=>Pl,ZodReadonly:()=>xl,ZodRealError:()=>ae,ZodRecord:()=>Lt,ZodSet:()=>ul,ZodString:()=>Vt,ZodStringFormat:()=>E,ZodSuccess:()=>hl,ZodSymbol:()=>Js,ZodTemplateLiteral:()=>wl,ZodTransform:()=>ll,ZodTuple:()=>nl,ZodType:()=>O,ZodULID:()=>Ri,ZodURL:()=>Cr,ZodUUID:()=>ye,ZodUndefined:()=>Bs,ZodUnion:()=>Vr,ZodUnknown:()=>Xs,ZodVoid:()=>Hs,ZodXID:()=>Vi,ZodXor:()=>Qs,_ZodString:()=>Ui,_default:()=>pl,_function:()=>bp,any:()=>Ym,array:()=>Lr,base64:()=>Nm,base64url:()=>Um,bigint:()=>Gm,boolean:()=>Ms,catch:()=>_l,check:()=>kp,cidrv4:()=>Om,cidrv6:()=>jm,clone:()=>T,codec:()=>$p,coerce:()=>Tl,compile:()=>Qu,config:()=>F,core:()=>Ie,creditCard:()=>Tm,cuid:()=>km,cuid2:()=>xm,currencyCode:()=>Vm,custom:()=>xp,date:()=>ep,decode:()=>Ns,decodeAsync:()=>As,deepPartial:()=>Zp,describe:()=>Ip,discriminatedUnion:()=>ap,e164:()=>Am,email:()=>fm,emoji:()=>_m,encode:()=>js,encodeAsync:()=>Us,endsWith:()=>Pt,enum:()=>Qi,exactOptional:()=>dl,file:()=>mp,flattenError:()=>ar,float32:()=>Mm,float64:()=>Jm,formatError:()=>ur,fromJSONSchema:()=>Ap,function:()=>bp,getDiscriminatedOption:()=>ku,getErrorMap:()=>xy,globalRegistry:()=>G,gt:()=>$e,gte:()=>ce,guid:()=>mm,hash:()=>Fm,hex:()=>Rm,hostname:()=>Lm,httpUrl:()=>ym,iban:()=>Zm,includes:()=>St,input:()=>Ep,instanceof:()=>Sp,int:()=>ji,int32:()=>Bm,int64:()=>Wm,intersection:()=>rl,invertCodec:()=>hp,ipv4:()=>zm,ipv6:()=>Dm,iso:()=>Kr,json:()=>Pp,jwt:()=>Cm,keyof:()=>tp,ksuid:()=>Sm,lazy:()=>zl,length:()=>qe,literal:()=>fp,locales:()=>zr,looseObject:()=>ip,looseRecord:()=>cp,lowercase:()=>It,lt:()=>ve,lte:()=>ue,mac:()=>Pm,map:()=>sp,maxLength:()=>Xe,maxSize:()=>Oe,memoizer:()=>wr,meta:()=>wp,mime:()=>Ot,minLength:()=>xe,minSize:()=>he,multipleOf:()=>De,nan:()=>vp,nanoid:()=>bm,nativeEnum:()=>dp,negative:()=>_i,never:()=>Yi,nonnegative:()=>ki,nonoptional:()=>$l,nonpositive:()=>bi,normalize:()=>jt,null:()=>Gs,nullable:()=>Zr,nullish:()=>pp,number:()=>Fs,object:()=>rp,optional:()=>Qe,output:()=>Lp,overwrite:()=>pe,parse:()=>zs,parseAsync:()=>Ps,partialRecord:()=>up,pipe:()=>Ni,positive:()=>yi,prefault:()=>vl,preprocess:()=>Dp,prettifyError:()=>Po,promise:()=>_p,properties:()=>Dt,property:()=>xi,readonly:()=>Il,record:()=>ol,refine:()=>Ol,regex:()=>xt,regexes:()=>de,registry:()=>Wn,safeDecode:()=>Zs,safeDecodeAsync:()=>Es,safeEncode:()=>Ts,safeEncodeAsync:()=>Cs,safeParse:()=>Ds,safeParseAsync:()=>Os,set:()=>lp,setErrorMap:()=>ky,size:()=>We,slugify:()=>Tt,startsWith:()=>zt,strictObject:()=>np,string:()=>Tr,stringFormat:()=>Em,stringbool:()=>zp,success:()=>gp,superRefine:()=>jl,symbol:()=>qm,templateLiteral:()=>yp,toJSONSchema:()=>zi,toLowerCase:()=>Ut,toUpperCase:()=>At,toZod:()=>qt,transform:()=>eo,treeifyError:()=>zo,trim:()=>Nt,tuple:()=>il,uint32:()=>Km,uint64:()=>Xm,ulid:()=>Im,undefined:()=>Hm,union:()=>Bt,unknown:()=>Ye,uppercase:()=>wt,url:()=>hm,util:()=>$,uuid:()=>pm,uuidv4:()=>gm,uuidv6:()=>vm,uuidv7:()=>$m,validate:()=>cr,validateAsync:()=>sr,void:()=>Qm,withParser:()=>Xn,xid:()=>wm,xor:()=>op});var Ie={};ge(Ie,{$ZodAny:()=>mu,$ZodArray:()=>yu,$ZodAsyncError:()=>ie,$ZodBase64:()=>tu,$ZodBase64URL:()=>ru,$ZodBigInt:()=>An,$ZodBigIntFormat:()=>su,$ZodBoolean:()=>yr,$ZodCIDRv4:()=>Qa,$ZodCIDRv6:()=>eu,$ZodCUID:()=>Va,$ZodCUID2:()=>Fa,$ZodCatch:()=>Eu,$ZodCheck:()=>L,$ZodCheckBigIntFormat:()=>pa,$ZodCheckEndsWith:()=>Sa,$ZodCheckGreaterThan:()=>hn,$ZodCheckIncludes:()=>Ia,$ZodCheckLengthEquals:()=>_a,$ZodCheckLessThan:()=>$n,$ZodCheckLowerCase:()=>ka,$ZodCheckMaxLength:()=>ha,$ZodCheckMaxSize:()=>ga,$ZodCheckMimeType:()=>Da,$ZodCheckMinLength:()=>ya,$ZodCheckMinSize:()=>va,$ZodCheckMultipleOf:()=>fa,$ZodCheckNumberFormat:()=>ma,$ZodCheckOverwrite:()=>Oa,$ZodCheckProperties:()=>Pa,$ZodCheckProperty:()=>za,$ZodCheckRegex:()=>ba,$ZodCheckSizeEquals:()=>$a,$ZodCheckStartsWith:()=>wa,$ZodCheckStringFormat:()=>ht,$ZodCheckUpperCase:()=>xa,$ZodCodec:()=>br,$ZodCreditCard:()=>iu,$ZodCustom:()=>Bu,$ZodCustomStringFormat:()=>uu,$ZodCyclicError:()=>Vn,$ZodDate:()=>$u,$ZodDefault:()=>Au,$ZodDiscriminatedUnion:()=>xu,$ZodE164:()=>nu,$ZodEmail:()=>Ta,$ZodEmoji:()=>La,$ZodEncodeError:()=>ze,$ZodEnum:()=>Pu,$ZodError:()=>So,$ZodExactOptional:()=>Nu,$ZodFile:()=>Ou,$ZodFunction:()=>Mu,$ZodGUID:()=>Ua,$ZodIBAN:()=>ou,$ZodIPv4:()=>qa,$ZodIPv6:()=>Ha,$ZodISODate:()=>Ga,$ZodISODateTime:()=>Ka,$ZodISODuration:()=>Xa,$ZodISOTime:()=>Wa,$ZodIntersection:()=>Iu,$ZodJWT:()=>au,$ZodKSUID:()=>Ba,$ZodLazy:()=>kr,$ZodLiteral:()=>Du,$ZodMAC:()=>Ya,$ZodMap:()=>Su,$ZodNaN:()=>Lu,$ZodNanoID:()=>Ra,$ZodNever:()=>gu,$ZodNonOptional:()=>Zu,$ZodNull:()=>fu,$ZodNullable:()=>Uu,$ZodNumber:()=>Un,$ZodNumberFormat:()=>cu,$ZodObject:()=>bd,$ZodObjectJIT:()=>_u,$ZodOptional:()=>Zn,$ZodPipe:()=>Cn,$ZodPrefault:()=>Tu,$ZodPreprocess:()=>Ru,$ZodPromise:()=>Ju,$ZodReadonly:()=>Vu,$ZodRealError:()=>oe,$ZodRecord:()=>wu,$ZodRegistry:()=>Gn,$ZodSet:()=>zu,$ZodString:()=>Je,$ZodStringFormat:()=>Z,$ZodSuccess:()=>Cu,$ZodSymbol:()=>lu,$ZodTemplateLiteral:()=>Fu,$ZodTransform:()=>ju,$ZodTuple:()=>Tn,$ZodType:()=>P,$ZodULID:()=>Ma,$ZodURL:()=>Ea,$ZodUUID:()=>Aa,$ZodUndefined:()=>du,$ZodUnion:()=>_r,$ZodUnknown:()=>pu,$ZodVoid:()=>vu,$ZodXID:()=>Ja,$ZodXor:()=>bu,$brand:()=>xo,$constructor:()=>p,$input:()=>Xu,$output:()=>Wu,Doc:()=>Me,INVALID:()=>Q,JSONSchema:()=>sm,JSONSchemaGenerator:()=>Pi,NEVER:()=>ko,TimePrecision:()=>uc,URL_BAD_FORMAT:()=>Za,URL_UNPARSEABLE:()=>pr,ZodCompileAsyncError:()=>me,ZodCompileUnsupportedError:()=>N,_any:()=>Ic,_array:()=>jc,_base64:()=>gi,_base64url:()=>vi,_bigint:()=>$c,_boolean:()=>gc,_catch:()=>ay,_check:()=>Gf,_cidrv4:()=>mi,_cidrv6:()=>pi,_coercedBigint:()=>hc,_coercedBoolean:()=>vc,_coercedDate:()=>Dc,_coercedNumber:()=>sc,_coercedString:()=>nc,_creditCard:()=>oc,_cuid:()=>ai,_cuid2:()=>ui,_custom:()=>Uc,_date:()=>Pc,_decode:()=>an,_decodeAsync:()=>cn,_default:()=>ny,_discriminatedUnion:()=>Bh,_e164:()=>$i,_email:()=>Yn,_emoji:()=>ii,_encode:()=>on,_encodeAsync:()=>un,_endsWith:()=>Pt,_enum:()=>Hh,_file:()=>Nc,_float32:()=>dc,_float64:()=>fc,_gt:()=>$e,_gte:()=>ce,_guid:()=>Qn,_iban:()=>ac,_includes:()=>St,_int:()=>lc,_int32:()=>mc,_int64:()=>yc,_intersection:()=>Kh,_ipv4:()=>di,_ipv6:()=>fi,_isoDate:()=>Or,_isoDateTime:()=>Dr,_isoDuration:()=>Nr,_isoTime:()=>jr,_jwt:()=>hi,_ksuid:()=>li,_lazy:()=>ly,_length:()=>qe,_literal:()=>Qh,_lowercase:()=>It,_lt:()=>ve,_lte:()=>ue,_mac:()=>ic,_map:()=>Xh,_max:()=>ue,_maxLength:()=>Xe,_maxSize:()=>Oe,_mime:()=>Ot,_min:()=>ce,_minLength:()=>xe,_minSize:()=>he,_multipleOf:()=>De,_nan:()=>Oc,_nanoid:()=>oi,_nativeEnum:()=>Yh,_negative:()=>_i,_never:()=>Sc,_nonnegative:()=>ki,_nonoptional:()=>iy,_nonpositive:()=>bi,_normalize:()=>jt,_null:()=>xc,_nullable:()=>ry,_number:()=>cc,_optional:()=>ty,_overwrite:()=>pe,_parse:()=>pt,_parseAsync:()=>gt,_pipe:()=>uy,_positive:()=>yi,_promise:()=>dy,_properties:()=>Dt,_property:()=>xi,_readonly:()=>cy,_record:()=>Wh,_refine:()=>Ac,_regex:()=>xt,_safeDecode:()=>ln,_safeDecodeAsync:()=>fn,_safeEncode:()=>sn,_safeEncodeAsync:()=>dn,_safeParse:()=>vt,_safeParseAsync:()=>$t,_set:()=>qh,_size:()=>We,_slugify:()=>Tt,_startsWith:()=>zt,_string:()=>rc,_stringFormat:()=>He,_stringbool:()=>Ec,_success:()=>oy,_superRefine:()=>Tc,_symbol:()=>bc,_templateLiteral:()=>sy,_toLowerCase:()=>Ut,_toUpperCase:()=>At,_transform:()=>ey,_trim:()=>Nt,_tuple:()=>Gh,_uint32:()=>pc,_uint64:()=>_c,_ulid:()=>ci,_undefined:()=>kc,_union:()=>Mh,_unknown:()=>wc,_uppercase:()=>wt,_url:()=>Pr,_uuid:()=>ei,_uuidv4:()=>ti,_uuidv6:()=>ri,_uuidv7:()=>ni,_void:()=>zc,_xid:()=>si,_xor:()=>Jh,base64Charset:()=>Pn,base64urlCharset:()=>hr,canParseURL:()=>Ca,clone:()=>T,compile:()=>Qu,compileFn:()=>qn,config:()=>F,createStandardJSONSchemaMethod:()=>Zt,createToJSONSchemaMethod:()=>Rc,decode:()=>Jg,decodeAsync:()=>Kg,describe:()=>Zc,encode:()=>Mg,encodeAsync:()=>Bg,extractDefs:()=>Ne,finalize:()=>Ue,flattenError:()=>ar,formatError:()=>ur,getDiscriminatedOption:()=>ku,globalConfig:()=>B,globalRegistry:()=>G,handleUnrepresentable:()=>M,initializeContext:()=>je,isBackEdge:()=>Mn,isRecursiveSchema:()=>Fn,isValidBase64:()=>$r,isValidBase64URL:()=>Dn,isValidCIDRv6:()=>zn,isValidCreditCard:()=>On,isValidIBAN:()=>jn,isValidIPv6:()=>vr,isValidJWT:()=>Nn,locales:()=>zr,memoizer:()=>wr,mergeValues:()=>yt,meta:()=>Cc,parse:()=>rn,parseAsync:()=>nn,parseURLObject:()=>hd,prettifyError:()=>Po,process:()=>C,processSchema:()=>C,regexes:()=>de,registry:()=>Wn,safeDecode:()=>Wg,safeDecodeAsync:()=>qg,safeEncode:()=>Gg,safeEncodeAsync:()=>Xg,safeParse:()=>Eg,safeParseAsync:()=>Lg,standardProps:()=>xn,stripTabAndNewline:()=>gr,toDotPath:()=>Hl,toJSONSchema:()=>zi,toZod:()=>qt,treeifyError:()=>zo,urlHostnameOk:()=>wn,urlProtocolOk:()=>Sn,util:()=>$,validate:()=>cr,validateAsync:()=>sr,validateURL:()=>In,version:()=>ja,withParser:()=>Xn});var $={};ge($,{BIGINT_FORMAT_RANGES:()=>tr,CONSTANT_CATCH:()=>en,Class:()=>fo,NUMBER_FORMAT_RANGES:()=>er,aborted:()=>Y,allowsEval:()=>go,assert:()=>ig,assertEqual:()=>eg,assertIs:()=>rg,assertNever:()=>ng,assertNotEqual:()=>tg,assignProp:()=>K,attachSchema:()=>rr,base64ToUint8Array:()=>Bl,base64urlToUint8Array:()=>xg,cached:()=>lt,captureStackTrace:()=>Yr,cleanEnum:()=>kg,cleanRegex:()=>be,clone:()=>T,cloneDef:()=>ug,codePointLength:()=>Ve,constantCatch:()=>_o,createTransparentProxy:()=>mg,defineLazy:()=>mo,defineLazyInternal:()=>j,derived:()=>zg,esc:()=>H,escapeRegex:()=>le,explicitlyAborted:()=>ho,extend:()=>vg,finalizeIssue:()=>ne,floatSafeRemainder:()=>Ht,getElementAtPath:()=>cg,getEnumValues:()=>ct,getLengthableOrigin:()=>ir,getParsedType:()=>fg,getSizableOrigin:()=>nr,hexToUint8Array:()=>wg,hide:()=>or,installLazyProp:()=>jg,isObject:()=>Re,isPlainObject:()=>se,issue:()=>mt,joinValues:()=>g,jsonStringifyReplacer:()=>st,members:()=>yo,merge:()=>hg,mergeDefs:()=>fe,normalizeParams:()=>b,nullish:()=>Hr,numKeys:()=>dg,objectClone:()=>og,omit:()=>gg,optionalKeys:()=>$o,own:()=>Se,parsedType:()=>y,partial:()=>yg,pick:()=>pg,prefixIssues:()=>re,primitiveTypes:()=>vo,promiseAllObject:()=>sg,propertyKeyTypes:()=>Qt,randomString:()=>lg,rawShape:()=>dt,required:()=>_g,safeExtend:()=>$g,shallowClone:()=>Yt,sizeCaps:()=>ft,slugify:()=>po,stringifyPrimitive:()=>h,toZod:()=>qt,uint8ArrayToBase64:()=>Kl,uint8ArrayToBase64url:()=>Ig,uint8ArrayToHex:()=>Sg,unwrapMessage:()=>ut});function eg(e){return e}function tg(e){return e}function qt(){return e=>e}function rg(e){}function ng(e){throw new Error("Unexpected value in exhaustive check")}function ig(e){}function ct(e){let r=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,t])=>r.indexOf(+o)===-1).map(([o,t])=>t)}function g(e,r="|"){return e.map(i=>h(i)).join(r)}function st(e,r){return typeof r=="bigint"?r.toString():r}var lo=class{constructor(r){this._getter=r,this._value=void 0}get value(){let r=this._getter;return r!==void 0&&(this._value=r(),this._getter=void 0),this._value}};function lt(e){return new lo(e)}function Hr(e){return e==null}function be(e){let r=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(r,i)}function Ht(e,r){let i=e/r,o=Math.round(i),t=4*Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-o)<t?0:i-o}var Vl=Symbol("evaluating");function mo(e,r,i){let o;Object.defineProperty(e,r,{get(){if(o!==Vl)return o===void 0&&(o=Vl,o=i()),o},set(t){Object.defineProperty(e,r,{value:t})},configurable:!0})}function og(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function K(e,r,i){Object.defineProperty(e,r,{value:i,writable:!0,enumerable:!0,configurable:!0})}function dt(e){let r=Object.getOwnPropertyDescriptor(e,"shape");return r?.get?r.get.raw:r?.value}function _e(e){return dt(e._zod.def)??e._zod.def.shape}function Fl(e,r,i){Object.defineProperty(e,r,{get(){let o=i();return K(this,r,o),o},enumerable:!0,configurable:!0})}function Ml(e,r,i){r in e?K(e,r,i):e[r]=i}function Le(e,r,i,o){let t=_e(r);for(let n of i){let a=Object.getOwnPropertyDescriptor(t,n);a.enumerable&&(a.get?Fl(e,n,()=>{let u=r._zod.def.shape[n];return o?o(u,n):u}):Ml(e,n,o?o(a.value,n):a.value))}}function ag(e,r){for(let i of Reflect.ownKeys(r)){let o=Object.getOwnPropertyDescriptor(r,i);o.enumerable&&(o.get?Fl(e,i,()=>r[i]):Ml(e,i,o.value))}}function fe(...e){let r={};for(let i of e){let o=Object.getOwnPropertyDescriptors(i);Object.assign(r,o)}return Object.defineProperties({},r)}function ug(e){return fe(e._zod.def)}function cg(e,r){return r?r.reduce((i,o)=>i?.[o],e):e}function sg(e){let r=Object.keys(e),i=r.map(o=>e[o]);return Promise.all(i).then(o=>{let t={};for(let n=0;n<r.length;n++)t[r[n]]=o[n];return t})}function lg(e=10){let r="abcdefghijklmnopqrstuvwxyz",i="";for(let o=0;o<e;o++)i+=r[Math.floor(Math.random()*r.length)];return i}function H(e){return JSON.stringify(e)}function po(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Yr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var go=lt(()=>{if(B.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function se(e){if(Re(e)===!1)return!1;let r=e.constructor;if(r===void 0||typeof r!="function")return!0;let i=r.prototype;return!(Re(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function Yt(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function dg(e){let r=0;for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&r++;return r}var fg=e=>{let r=typeof e;switch(r){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: ${r}`)}},Qt=new Set(["string","number","symbol"]),vo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function le(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T(e,r,i){let o=new e._zod.constr(r??e._zod.def);return(!r||i?.parent)&&(o._zod.parent=e),o}function b(e){let r=e;if(!r)return{};if(typeof r=="string")return{error:()=>r};if(r?.message!==void 0){if(r?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");r.error=r.message}return delete r.message,typeof r.error=="string"?{...r,error:()=>r.error}:r}function mg(e){let r;return new Proxy({},{get(i,o,t){return r??(r=e()),Reflect.get(r,o,t)},set(i,o,t,n){return r??(r=e()),Reflect.set(r,o,t,n)},has(i,o){return r??(r=e()),Reflect.has(r,o)},deleteProperty(i,o){return r??(r=e()),Reflect.deleteProperty(r,o)},ownKeys(i){return r??(r=e()),Reflect.ownKeys(r)},getOwnPropertyDescriptor(i,o){return r??(r=e()),Reflect.getOwnPropertyDescriptor(r,o)},defineProperty(i,o,t){return r??(r=e()),Reflect.defineProperty(r,o,t)}})}function h(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function $o(e){return Object.keys(e).filter(r=>e[r]._zod.optin!==void 0&&e[r]._zod.optout==="optional")}var er={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]},tr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pg(e,r){let i=e._zod.def,o=i.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let n={};return Le(n,e,Qr(e,r)),T(e,fe(i,{shape:n,checks:[]}))}function Qr(e,r){let i=_e(e),o=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(i,t)?.enumerable)throw new Error(`Unrecognized key: "${String(t)}"`);r[t]&&o.push(t)}return o}function gg(e,r){let i=e._zod.def,o=i.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let n=new Set(Qr(e,r)),a={};return Le(a,e,Reflect.ownKeys(_e(e)).filter(u=>!n.has(u))),T(e,fe(i,{shape:a,checks:[]}))}function vg(e,r){if(!se(r))throw new Error("Invalid input to extend: expected a plain object");let i=e._zod.def.checks;if(i&&i.length>0){let t=_e(e);for(let n of Reflect.ownKeys(r))if(Object.getOwnPropertyDescriptor(t,n)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return T(e,fe(e._zod.def,{shape:Jl(e,r)}))}function Jl(e,r){let i={};return Le(i,e,Reflect.ownKeys(_e(e))),ag(i,r),i}function $g(e,r){if(!se(r))throw new Error("Invalid input to safeExtend: expected a plain object");return T(e,fe(e._zod.def,{shape:Jl(e,r)}))}function hg(e,r){if(!r?._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 i={};Le(i,e,Reflect.ownKeys(_e(e))),Le(i,r,Reflect.ownKeys(_e(r)));let o=fe(e._zod.def,{shape:i,get catchall(){return r._zod.def.catchall},checks:r._zod.def.checks??[]});return T(e,o)}function yg(e,r,i,o="partial"){let n=r._zod.def.checks;if(n&&n.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let u=i?new Set(Qr(r,i)):void 0,s={};return Le(s,r,Reflect.ownKeys(_e(r)),e&&((c,l)=>u&&!u.has(l)?c:new e({type:"optional",innerType:c}))),T(r,fe(r._zod.def,{shape:s,checks:[]}))}function _g(e,r,i){let o=i?new Set(Qr(r,i)):void 0,t={};return Le(t,r,Reflect.ownKeys(_e(r)),(n,a)=>o&&!o.has(a)?n:new e({type:"nonoptional",innerType:n})),T(r,fe(r._zod.def,{shape:t}))}function Y(e,r=0){if(e.aborted===!0)return!0;for(let i=r;i<e.issues.length;i++)if(e.issues[i]?.continue!==!0)return!0;return!1}function ho(e,r=0){if(e.aborted===!0)return!0;for(let i=r;i<e.issues.length;i++)if(e.issues[i]?.continue===!1)return!0;return!1}function re(e,r){return r.map(i=>{var o;return(o=i).path??(o.path=[]),i.path.unshift(e),i})}function ut(e){return typeof e=="string"?e:e?.message}function ft(e){let r=[];for(let i of e??[]){let o=i._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let t=o.maximum??o.length??o.size;t>=0&&r.push([t,i])}return r}function rr(e,r,i){var o;for(let t=r;t<e.length;t++)(o=e[t]).schema??(o.schema=i)}function ne(e,r,i){var o;let t=e.inst?._zod?.traits;t?.has("$ZodType")&&(t.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let n=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:ut(e.inst?._zod.def?.error?.(e))??ut(n?.(e))??ut(r?.error?.(e))??ut(i.customError?.(e))??ut(i.localeError?.(e))??"Invalid input",u={};for(let s of Object.keys(e))s==="inst"||s==="schema"||s==="continue"||s==="input"||s==="__proto__"||(u[s]=e[s]);return u.path??(u.path=[]),u.message=a,r?.reportInput&&(u.input=e.input),u}function nr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var bg=/[\uD800-\uDBFF]/;function Ve(e){let r=e.length;if(!bg.test(e))return r;let i=r;for(let o=0;o<r-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(i--,o++);return i}function ir(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function y(e){let r=typeof e;switch(r){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let i=e;if(i&&Object.getPrototypeOf(i)!==Object.prototype&&"constructor"in i&&i.constructor)return i.constructor.name}}return r}function mt(...e){let[r,i,o]=e;return typeof r=="string"?{message:r,code:"custom",input:i,inst:o}:{...r}}function kg(e){return Object.entries(e).filter(([r,i])=>Number.isNaN(Number.parseInt(r,10))).map(r=>r[1])}function Bl(e){let r=atob(e),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}function Kl(e){let r="";for(let i=0;i<e.length;i++)r+=String.fromCharCode(e[i]);return btoa(r)}function xg(e){let r=e.replace(/-/g,"+").replace(/_/g,"/"),i="=".repeat((4-r.length%4)%4);return Bl(r+i)}function Ig(e){return Kl(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wg(e){let r=e.replace(/^0x/,"");if(r.length%2!==0)throw new Error("Invalid hex string length");let i=new Uint8Array(r.length/2);for(let o=0;o<r.length;o+=2)i[o/2]=Number.parseInt(r.slice(o,o+2),16);return i}function Sg(e){return Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}var fo=class{constructor(...r){}};function yo(e,r){for(let i in r){let o=Object.getOwnPropertyDescriptor(r,i);o.get?Object.defineProperty(e,i,{...o,enumerable:!1}):Pg(e,i,o.value)}}function Se(e,r,i,o=!0){return Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:o,value:i}),i}function or(e,r,i){return Se(e,r,i,!1)}function zg(e,r){for(let i in e){let o=e[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!0,get(){return Se(this,i,o(this))},set(t){Se(this,i,t)}})}return r}function Pg(e,r,i){Object.defineProperty(e,r,{configurable:!0,get(){return this==null?i:Se(this,r,i.bind(this))},set(o){Se(this,r,o)}})}function Dg(e,r){let i=Object.getPrototypeOf(e);return r in i?void 0:i}var so,we=!1,Og={configurable:!0,get(){we=!0}};function j(e,r,i){let o=Object.getPrototypeOf(e._zod);if(r in o&&so!==e._zod){so=void 0;return}so=e._zod,Object.defineProperty(o,r,{configurable:!0,get(){Object.defineProperty(this,r,Og);let t=we;we=!1;try{let n=i(this);return we?delete this[r]:Object.defineProperty(this,r,{configurable:!0,writable:!0,value:n}),we=we||t,n}catch(n){throw delete this[r],we=we||t,n}},set(t){Object.defineProperty(this,r,{configurable:!0,writable:!0,value:t})}})}function jg(e,r,i,o){let t=Dg(e,r);t&&Object.defineProperty(t,r,{configurable:!0,get(){let n={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,r,n),n.value=i(this),Object.defineProperty(this,r,n),n.value},set(n){Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:o,value:n})}})}var en="~constantCatch";function _o(e){let r=()=>e;return r[en]=!0,r}var Gl,ko=Object.freeze({status:"aborted"}),bo={value:void 0,enumerable:!1},Wl="captureStackTrace"in Error?Error:null;function Ng(e){let r=Wl;if(r){let i=r.stackTraceLimit;if(typeof i=="number"){try{r.stackTraceLimit=0}catch{return Wl=null,new e}try{return new e}finally{r.stackTraceLimit=i}}}return new e}function p(e,r,i,o){let t={};function n(f){this.def=f,this.constr=d,this.traits=new Set}n.prototype=t;let a=i,u=a&&new WeakSet;function s(f,m){if(f._zod){if(f._zod.traits.has(e))return}else{bo.value=new n(m);try{Object.defineProperty(f,"_zod",bo)}finally{bo.value=void 0}}if(f._zod.traits.add(e),r(f,m),u){let _=Object.getPrototypeOf(f),k=f._zod.constr.prototype,S=_;for(;S&&S!==k;)S=Object.getPrototypeOf(S);let I=S??_;u.has(I)||(u.add(I),yo(I,a))}let v=d.prototype;for(let _ in v)Object.prototype.hasOwnProperty.call(v,_)&&(_ in f||(f[_]=v[_].bind(f)))}let c=o?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(f){let m=o?.Parent?Ng(l):this;s(m,f);let v=m._zod.deferred;if(v){for(let k of v)k();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(m),m}return Object.defineProperty(d,"init",{value:s}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>o?.Parent&&f instanceof o.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var xo=Symbol("zod_brand"),ie=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ze=class extends Error{constructor(r){super(`Encountered unidirectional transform during encode: ${r}`),this.name="ZodEncodeError"}};(Gl=globalThis).__zod_globalConfig??(Gl.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(B,e),B}function Ug(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,st,2)),e.message}function Ag(e){this._zod.message=e}var Tg={get:Ug,set:Ag,enumerable:!0,configurable:!0},wo={value:void 0,enumerable:!1},Xl=new WeakSet([Object.prototype,Error.prototype]),ql=(e,r)=>{e.name="$ZodError",wo.value=r,Object.defineProperty(e,"issues",wo),wo.value=void 0,Object.defineProperty(e,"message",Tg);let i=Object.getPrototypeOf(e);Xl.has(i)||(Xl.add(i),Object.defineProperty(i,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},So=p("$ZodError",ql),oe=p("$ZodError",ql,void 0,{Parent:Error});function Zg(e,r,i){return Object.prototype.hasOwnProperty.call(e,r)||(r==="__proto__"?Object.defineProperty(e,r,{value:i(),writable:!0,enumerable:!0,configurable:!0}):e[r]=i()),e[r]}function ar(e,r=i=>i.message){let i={},o=[];for(let t of e.issues)t.path.length>0?Zg(i,t.path[0],()=>[]).push(r(t)):o.push(r(t));return{formErrors:o,fieldErrors:i}}function ur(e,r=i=>i.message){let i={_errors:[]},o=(t,n=[])=>{for(let a of t.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(u=>o({issues:u},[...n,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...n,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...n,...a.path]);else{let u=[...n,...a.path];if(u.length===0)i._errors.push(r(a));else{let s=i,c=0;for(;c<u.length;){let l=u[c],d=c===u.length-1;if(l==="_errors"){d&&s._errors.push(r(a)),c++;continue}Object.prototype.hasOwnProperty.call(s,l)||Object.defineProperty(s,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=s[l];d&&f._errors.push(r(a)),s=f,c++}}}};return o(e),i}function zo(e,r=i=>i.message){let i={errors:[]},o=(t,n=[])=>{var a;for(let u of t.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(s=>o({issues:s},[...n,...u.path]));else if(u.code==="invalid_key")o({issues:u.issues},[...n,...u.path]);else if(u.code==="invalid_element")o({issues:u.issues},[...n,...u.path]);else{let s=[...n,...u.path];if(s.length===0){i.errors.push(r(u));continue}let c=i,l=0;for(;l<s.length;){let d=s[l],f=l===s.length-1;typeof d=="string"?(c.properties??(c.properties={}),Object.prototype.hasOwnProperty.call(c.properties,d)||Object.defineProperty(c.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),c=c.properties[d]):(c.items??(c.items=[]),(a=c.items)[d]??(a[d]={errors:[]}),c=c.items[d]),f&&c.errors.push(r(u)),l++}}};return o(e),i}function Hl(e){let r=[],i=e.map(o=>typeof o=="object"?o.key:o);for(let o of i)typeof o=="number"?r.push(`[${o}]`):typeof o=="symbol"?r.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?r.push(`[${JSON.stringify(o)}]`):(r.length&&r.push("."),r.push(o));return r.join("")}function Po(e){let r=[],i=[...e.issues].sort((o,t)=>(o.path??[]).length-(t.path??[]).length);for(let o of i)r.push(`\u2716 ${o.message}`),o.path?.length&&r.push(` \u2192 at ${Hl(o.path)}`);return r.join(`
|
|
1
|
+
"use strict";var Gp=Object.create;var Xr=Object.defineProperty;var Wp=Object.getOwnPropertyDescriptor;var Xp=Object.getOwnPropertyNames;var qp=Object.getPrototypeOf,Hp=Object.prototype.hasOwnProperty;var ge=(e,r)=>{for(var i in r)Xr(e,i,{get:r[i],enumerable:!0})},Rl=(e,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of Xp(r))!Hp.call(e,t)&&t!==i&&Xr(e,t,{get:()=>r[t],enumerable:!(o=Wp(r,t))||o.enumerable});return e};var Yp=(e,r,i)=>(i=e!=null?Gp(qp(e)):{},Rl(r||!e||!e.__esModule?Xr(i,"default",{value:e,enumerable:!0}):i,e)),Qp=e=>Rl(Xr({},"__esModule",{value:!0}),e);var qy={};ge(qy,{ConnectorRunnerControlOffice:()=>Cl});module.exports=Qp(qy);var Xt=Yp(require("node:process")),qr=class{#e="connector-runtime";#t;constructor(r,i){this.#t=i,Xt.default.on?Xt.default.on("message",o=>{o.cmd===this.#e&&i.logger.verbose(`${Xt.default.pid} Received message from parent process:`,o)}):i.logger.warn("IPC channel is not available. process.on is undefined."),Xt.default.send||i.logger.warn("IPC channel is not available. process.send is undefined."),r.actions?.forEach(o=>{if(o.config.templates===void 0)return;let t={};Object.entries(o.config.templates).forEach(([n,a])=>{try{t[n]=i.templating.compile(a)}catch(u){i.logger.error(`Error compiling template ${n} for action ${o.identifier}`,u)}}),o.config.parsedTemplates=t})}init=()=>Promise.resolve();start=()=>Promise.resolve();stop=()=>Promise.resolve();set callbackFunction(r){this.connectorSDK.receiver.registerCallback(this.#r(r))}get connectorSDK(){return this.#t}#r(r){return async i=>{let o=await this.#t.receiver.getActionConfig(i);return o?r(i,o):this.#t.receiver.responses.badRequest("Action not found")(i)}}};var ot=class extends Error{};var at=class extends Error{};var W={};ge(W,{$brand:()=>xo,$input:()=>Xu,$output:()=>Wu,INVALID:()=>Q,NEVER:()=>ko,TimePrecision:()=>uc,ZodAny:()=>Ws,ZodArray:()=>Ys,ZodBase64:()=>Gi,ZodBase64URL:()=>Wi,ZodBigInt:()=>Jt,ZodBigIntFormat:()=>Hi,ZodBoolean:()=>Mt,ZodCIDRv4:()=>Bi,ZodCIDRv6:()=>Ki,ZodCUID:()=>Ei,ZodCUID2:()=>Li,ZodCatch:()=>yl,ZodCodec:()=>Jr,ZodCompileAsyncError:()=>me,ZodCompileUnsupportedError:()=>N,ZodCreditCard:()=>Rs,ZodCustom:()=>Br,ZodCustomStringFormat:()=>tt,ZodDate:()=>Er,ZodDefault:()=>ml,ZodDiscriminatedUnion:()=>el,ZodE164:()=>Xi,ZodEmail:()=>Ai,ZodEmoji:()=>Zi,ZodEnum:()=>Rt,ZodError:()=>hy,ZodExactOptional:()=>to,ZodFile:()=>sl,ZodFirstPartyTypeKind:()=>Ul,ZodFunction:()=>Dl,ZodGUID:()=>Ti,ZodIBAN:()=>Vs,ZodIPv4:()=>Mi,ZodIPv6:()=>Ji,ZodISODate:()=>Te,ZodISODateTime:()=>Ae,ZodISODuration:()=>Ce,ZodISOTime:()=>Ze,ZodInstanceOf:()=>Nl,ZodIntersection:()=>tl,ZodIssueCode:()=>by,ZodJWT:()=>qi,ZodKSUID:()=>Fi,ZodLazy:()=>Sl,ZodLiteral:()=>cl,ZodMAC:()=>Ls,ZodMap:()=>al,ZodNaN:()=>bl,ZodNanoID:()=>Ci,ZodNever:()=>qs,ZodNonOptional:()=>ro,ZodNull:()=>Ks,ZodNullable:()=>fl,ZodNumber:()=>Ft,ZodNumberFormat:()=>rt,ZodObject:()=>Rr,ZodOptional:()=>Fr,ZodPipe:()=>Mr,ZodPrefault:()=>gl,ZodPreprocess:()=>kl,ZodPromise:()=>Pl,ZodReadonly:()=>xl,ZodRealError:()=>ae,ZodRecord:()=>Lt,ZodSet:()=>ul,ZodString:()=>Vt,ZodStringFormat:()=>E,ZodSuccess:()=>hl,ZodSymbol:()=>Js,ZodTemplateLiteral:()=>wl,ZodTransform:()=>ll,ZodTuple:()=>nl,ZodType:()=>O,ZodULID:()=>Ri,ZodURL:()=>Cr,ZodUUID:()=>ye,ZodUndefined:()=>Bs,ZodUnion:()=>Vr,ZodUnknown:()=>Xs,ZodVoid:()=>Hs,ZodXID:()=>Vi,ZodXor:()=>Qs,_ZodString:()=>Ui,_default:()=>pl,_function:()=>bp,any:()=>Ym,array:()=>Lr,base64:()=>Nm,base64url:()=>Um,bigint:()=>Gm,boolean:()=>Ms,catch:()=>_l,check:()=>kp,cidrv4:()=>Om,cidrv6:()=>jm,clone:()=>T,codec:()=>$p,coerce:()=>Tl,compile:()=>Qu,config:()=>F,core:()=>Ie,creditCard:()=>Tm,cuid:()=>km,cuid2:()=>xm,currencyCode:()=>Vm,custom:()=>xp,date:()=>ep,decode:()=>Ns,decodeAsync:()=>As,deepPartial:()=>Zp,describe:()=>Ip,discriminatedUnion:()=>ap,e164:()=>Am,email:()=>fm,emoji:()=>_m,encode:()=>js,encodeAsync:()=>Us,endsWith:()=>Pt,enum:()=>Qi,exactOptional:()=>dl,file:()=>mp,flattenError:()=>ar,float32:()=>Mm,float64:()=>Jm,formatError:()=>ur,fromJSONSchema:()=>Ap,function:()=>bp,getDiscriminatedOption:()=>ku,getErrorMap:()=>xy,globalRegistry:()=>G,gt:()=>$e,gte:()=>ce,guid:()=>mm,hash:()=>Fm,hex:()=>Rm,hostname:()=>Lm,httpUrl:()=>ym,iban:()=>Zm,includes:()=>St,input:()=>Ep,instanceof:()=>Sp,int:()=>ji,int32:()=>Bm,int64:()=>Wm,intersection:()=>rl,invertCodec:()=>hp,ipv4:()=>zm,ipv6:()=>Dm,iso:()=>Kr,json:()=>Pp,jwt:()=>Cm,keyof:()=>tp,ksuid:()=>Sm,lazy:()=>zl,length:()=>qe,literal:()=>fp,locales:()=>zr,looseObject:()=>ip,looseRecord:()=>cp,lowercase:()=>It,lt:()=>ve,lte:()=>ue,mac:()=>Pm,map:()=>sp,maxLength:()=>Xe,maxSize:()=>Oe,memoizer:()=>wr,meta:()=>wp,mime:()=>Ot,minLength:()=>xe,minSize:()=>he,multipleOf:()=>De,nan:()=>vp,nanoid:()=>bm,nativeEnum:()=>dp,negative:()=>_i,never:()=>Yi,nonnegative:()=>ki,nonoptional:()=>$l,nonpositive:()=>bi,normalize:()=>jt,null:()=>Gs,nullable:()=>Zr,nullish:()=>pp,number:()=>Fs,object:()=>rp,optional:()=>Qe,output:()=>Lp,overwrite:()=>pe,parse:()=>zs,parseAsync:()=>Ps,partialRecord:()=>up,pipe:()=>Ni,positive:()=>yi,prefault:()=>vl,preprocess:()=>Dp,prettifyError:()=>Po,promise:()=>_p,properties:()=>Dt,property:()=>xi,readonly:()=>Il,record:()=>ol,refine:()=>Ol,regex:()=>xt,regexes:()=>de,registry:()=>Wn,safeDecode:()=>Zs,safeDecodeAsync:()=>Es,safeEncode:()=>Ts,safeEncodeAsync:()=>Cs,safeParse:()=>Ds,safeParseAsync:()=>Os,set:()=>lp,setErrorMap:()=>ky,size:()=>We,slugify:()=>Tt,startsWith:()=>zt,strictObject:()=>np,string:()=>Tr,stringFormat:()=>Em,stringbool:()=>zp,success:()=>gp,superRefine:()=>jl,symbol:()=>qm,templateLiteral:()=>yp,toJSONSchema:()=>zi,toLowerCase:()=>Ut,toUpperCase:()=>At,toZod:()=>qt,transform:()=>eo,treeifyError:()=>zo,trim:()=>Nt,tuple:()=>il,uint32:()=>Km,uint64:()=>Xm,ulid:()=>Im,undefined:()=>Hm,union:()=>Bt,unknown:()=>Ye,uppercase:()=>wt,url:()=>hm,util:()=>$,uuid:()=>pm,uuidv4:()=>gm,uuidv6:()=>vm,uuidv7:()=>$m,validate:()=>cr,validateAsync:()=>sr,void:()=>Qm,withParser:()=>Xn,xid:()=>wm,xor:()=>op});var Ie={};ge(Ie,{$ZodAny:()=>mu,$ZodArray:()=>yu,$ZodAsyncError:()=>ie,$ZodBase64:()=>tu,$ZodBase64URL:()=>ru,$ZodBigInt:()=>An,$ZodBigIntFormat:()=>su,$ZodBoolean:()=>yr,$ZodCIDRv4:()=>Qa,$ZodCIDRv6:()=>eu,$ZodCUID:()=>Va,$ZodCUID2:()=>Fa,$ZodCatch:()=>Eu,$ZodCheck:()=>L,$ZodCheckBigIntFormat:()=>pa,$ZodCheckEndsWith:()=>Sa,$ZodCheckGreaterThan:()=>hn,$ZodCheckIncludes:()=>Ia,$ZodCheckLengthEquals:()=>_a,$ZodCheckLessThan:()=>$n,$ZodCheckLowerCase:()=>ka,$ZodCheckMaxLength:()=>ha,$ZodCheckMaxSize:()=>ga,$ZodCheckMimeType:()=>Da,$ZodCheckMinLength:()=>ya,$ZodCheckMinSize:()=>va,$ZodCheckMultipleOf:()=>fa,$ZodCheckNumberFormat:()=>ma,$ZodCheckOverwrite:()=>Oa,$ZodCheckProperties:()=>Pa,$ZodCheckProperty:()=>za,$ZodCheckRegex:()=>ba,$ZodCheckSizeEquals:()=>$a,$ZodCheckStartsWith:()=>wa,$ZodCheckStringFormat:()=>ht,$ZodCheckUpperCase:()=>xa,$ZodCodec:()=>br,$ZodCreditCard:()=>iu,$ZodCustom:()=>Bu,$ZodCustomStringFormat:()=>uu,$ZodCyclicError:()=>Vn,$ZodDate:()=>$u,$ZodDefault:()=>Au,$ZodDiscriminatedUnion:()=>xu,$ZodE164:()=>nu,$ZodEmail:()=>Ta,$ZodEmoji:()=>La,$ZodEncodeError:()=>ze,$ZodEnum:()=>Pu,$ZodError:()=>So,$ZodExactOptional:()=>Nu,$ZodFile:()=>Ou,$ZodFunction:()=>Mu,$ZodGUID:()=>Ua,$ZodIBAN:()=>ou,$ZodIPv4:()=>qa,$ZodIPv6:()=>Ha,$ZodISODate:()=>Ga,$ZodISODateTime:()=>Ka,$ZodISODuration:()=>Xa,$ZodISOTime:()=>Wa,$ZodIntersection:()=>Iu,$ZodJWT:()=>au,$ZodKSUID:()=>Ba,$ZodLazy:()=>kr,$ZodLiteral:()=>Du,$ZodMAC:()=>Ya,$ZodMap:()=>Su,$ZodNaN:()=>Lu,$ZodNanoID:()=>Ra,$ZodNever:()=>gu,$ZodNonOptional:()=>Zu,$ZodNull:()=>fu,$ZodNullable:()=>Uu,$ZodNumber:()=>Un,$ZodNumberFormat:()=>cu,$ZodObject:()=>bd,$ZodObjectJIT:()=>_u,$ZodOptional:()=>Zn,$ZodPipe:()=>Cn,$ZodPrefault:()=>Tu,$ZodPreprocess:()=>Ru,$ZodPromise:()=>Ju,$ZodReadonly:()=>Vu,$ZodRealError:()=>oe,$ZodRecord:()=>wu,$ZodRegistry:()=>Gn,$ZodSet:()=>zu,$ZodString:()=>Je,$ZodStringFormat:()=>Z,$ZodSuccess:()=>Cu,$ZodSymbol:()=>lu,$ZodTemplateLiteral:()=>Fu,$ZodTransform:()=>ju,$ZodTuple:()=>Tn,$ZodType:()=>P,$ZodULID:()=>Ma,$ZodURL:()=>Ea,$ZodUUID:()=>Aa,$ZodUndefined:()=>du,$ZodUnion:()=>_r,$ZodUnknown:()=>pu,$ZodVoid:()=>vu,$ZodXID:()=>Ja,$ZodXor:()=>bu,$brand:()=>xo,$constructor:()=>p,$input:()=>Xu,$output:()=>Wu,Doc:()=>Me,INVALID:()=>Q,JSONSchema:()=>sm,JSONSchemaGenerator:()=>Pi,NEVER:()=>ko,TimePrecision:()=>uc,URL_BAD_FORMAT:()=>Za,URL_UNPARSEABLE:()=>pr,ZodCompileAsyncError:()=>me,ZodCompileUnsupportedError:()=>N,_any:()=>Ic,_array:()=>jc,_base64:()=>gi,_base64url:()=>vi,_bigint:()=>$c,_boolean:()=>gc,_catch:()=>ay,_check:()=>Gf,_cidrv4:()=>mi,_cidrv6:()=>pi,_coercedBigint:()=>hc,_coercedBoolean:()=>vc,_coercedDate:()=>Dc,_coercedNumber:()=>sc,_coercedString:()=>nc,_creditCard:()=>oc,_cuid:()=>ai,_cuid2:()=>ui,_custom:()=>Uc,_date:()=>Pc,_decode:()=>an,_decodeAsync:()=>cn,_default:()=>ny,_discriminatedUnion:()=>Bh,_e164:()=>$i,_email:()=>Yn,_emoji:()=>ii,_encode:()=>on,_encodeAsync:()=>un,_endsWith:()=>Pt,_enum:()=>Hh,_file:()=>Nc,_float32:()=>dc,_float64:()=>fc,_gt:()=>$e,_gte:()=>ce,_guid:()=>Qn,_iban:()=>ac,_includes:()=>St,_int:()=>lc,_int32:()=>mc,_int64:()=>yc,_intersection:()=>Kh,_ipv4:()=>di,_ipv6:()=>fi,_isoDate:()=>Or,_isoDateTime:()=>Dr,_isoDuration:()=>Nr,_isoTime:()=>jr,_jwt:()=>hi,_ksuid:()=>li,_lazy:()=>ly,_length:()=>qe,_literal:()=>Qh,_lowercase:()=>It,_lt:()=>ve,_lte:()=>ue,_mac:()=>ic,_map:()=>Xh,_max:()=>ue,_maxLength:()=>Xe,_maxSize:()=>Oe,_mime:()=>Ot,_min:()=>ce,_minLength:()=>xe,_minSize:()=>he,_multipleOf:()=>De,_nan:()=>Oc,_nanoid:()=>oi,_nativeEnum:()=>Yh,_negative:()=>_i,_never:()=>Sc,_nonnegative:()=>ki,_nonoptional:()=>iy,_nonpositive:()=>bi,_normalize:()=>jt,_null:()=>xc,_nullable:()=>ry,_number:()=>cc,_optional:()=>ty,_overwrite:()=>pe,_parse:()=>pt,_parseAsync:()=>gt,_pipe:()=>uy,_positive:()=>yi,_promise:()=>dy,_properties:()=>Dt,_property:()=>xi,_readonly:()=>cy,_record:()=>Wh,_refine:()=>Ac,_regex:()=>xt,_safeDecode:()=>ln,_safeDecodeAsync:()=>fn,_safeEncode:()=>sn,_safeEncodeAsync:()=>dn,_safeParse:()=>vt,_safeParseAsync:()=>$t,_set:()=>qh,_size:()=>We,_slugify:()=>Tt,_startsWith:()=>zt,_string:()=>rc,_stringFormat:()=>He,_stringbool:()=>Ec,_success:()=>oy,_superRefine:()=>Tc,_symbol:()=>bc,_templateLiteral:()=>sy,_toLowerCase:()=>Ut,_toUpperCase:()=>At,_transform:()=>ey,_trim:()=>Nt,_tuple:()=>Gh,_uint32:()=>pc,_uint64:()=>_c,_ulid:()=>ci,_undefined:()=>kc,_union:()=>Mh,_unknown:()=>wc,_uppercase:()=>wt,_url:()=>Pr,_uuid:()=>ei,_uuidv4:()=>ti,_uuidv6:()=>ri,_uuidv7:()=>ni,_void:()=>zc,_xid:()=>si,_xor:()=>Jh,base64Charset:()=>Pn,base64urlCharset:()=>hr,canParseURL:()=>Ca,clone:()=>T,compile:()=>Qu,compileFn:()=>qn,config:()=>F,createStandardJSONSchemaMethod:()=>Zt,createToJSONSchemaMethod:()=>Rc,decode:()=>Jg,decodeAsync:()=>Kg,describe:()=>Zc,encode:()=>Mg,encodeAsync:()=>Bg,extractDefs:()=>Ne,finalize:()=>Ue,flattenError:()=>ar,formatError:()=>ur,getDiscriminatedOption:()=>ku,globalConfig:()=>B,globalRegistry:()=>G,handleUnrepresentable:()=>M,initializeContext:()=>je,isBackEdge:()=>Mn,isRecursiveSchema:()=>Fn,isValidBase64:()=>$r,isValidBase64URL:()=>Dn,isValidCIDRv6:()=>zn,isValidCreditCard:()=>On,isValidIBAN:()=>jn,isValidIPv6:()=>vr,isValidJWT:()=>Nn,locales:()=>zr,memoizer:()=>wr,mergeValues:()=>yt,meta:()=>Cc,parse:()=>rn,parseAsync:()=>nn,parseURLObject:()=>hd,prettifyError:()=>Po,process:()=>C,processSchema:()=>C,regexes:()=>de,registry:()=>Wn,safeDecode:()=>Wg,safeDecodeAsync:()=>qg,safeEncode:()=>Gg,safeEncodeAsync:()=>Xg,safeParse:()=>Eg,safeParseAsync:()=>Lg,standardProps:()=>xn,stripTabAndNewline:()=>gr,toDotPath:()=>Hl,toJSONSchema:()=>zi,toZod:()=>qt,treeifyError:()=>zo,urlHostnameOk:()=>wn,urlProtocolOk:()=>Sn,util:()=>$,validate:()=>cr,validateAsync:()=>sr,validateURL:()=>In,version:()=>ja,withParser:()=>Xn});var $={};ge($,{BIGINT_FORMAT_RANGES:()=>tr,CONSTANT_CATCH:()=>en,Class:()=>fo,NUMBER_FORMAT_RANGES:()=>er,aborted:()=>Y,allowsEval:()=>go,assert:()=>ig,assertEqual:()=>eg,assertIs:()=>rg,assertNever:()=>ng,assertNotEqual:()=>tg,assignProp:()=>K,attachSchema:()=>rr,base64ToUint8Array:()=>Bl,base64urlToUint8Array:()=>xg,cached:()=>lt,captureStackTrace:()=>Yr,cleanEnum:()=>kg,cleanRegex:()=>be,clone:()=>T,cloneDef:()=>ug,codePointLength:()=>Ve,constantCatch:()=>_o,createTransparentProxy:()=>mg,defineLazy:()=>mo,defineLazyInternal:()=>j,derived:()=>zg,esc:()=>H,escapeRegex:()=>le,explicitlyAborted:()=>ho,extend:()=>vg,finalizeIssue:()=>ne,floatSafeRemainder:()=>Ht,getElementAtPath:()=>cg,getEnumValues:()=>ct,getLengthableOrigin:()=>ir,getParsedType:()=>fg,getSizableOrigin:()=>nr,hexToUint8Array:()=>wg,hide:()=>or,installLazyProp:()=>jg,isObject:()=>Re,isPlainObject:()=>se,issue:()=>mt,joinValues:()=>g,jsonStringifyReplacer:()=>st,members:()=>yo,merge:()=>hg,mergeDefs:()=>fe,normalizeParams:()=>b,nullish:()=>Hr,numKeys:()=>dg,objectClone:()=>og,omit:()=>gg,optionalKeys:()=>$o,own:()=>Se,parsedType:()=>y,partial:()=>yg,pick:()=>pg,prefixIssues:()=>re,primitiveTypes:()=>vo,promiseAllObject:()=>sg,propertyKeyTypes:()=>Qt,randomString:()=>lg,rawShape:()=>dt,required:()=>_g,safeExtend:()=>$g,shallowClone:()=>Yt,sizeCaps:()=>ft,slugify:()=>po,stringifyPrimitive:()=>h,toZod:()=>qt,uint8ArrayToBase64:()=>Kl,uint8ArrayToBase64url:()=>Ig,uint8ArrayToHex:()=>Sg,unwrapMessage:()=>ut});function eg(e){return e}function tg(e){return e}function qt(){return e=>e}function rg(e){}function ng(e){throw new Error("Unexpected value in exhaustive check")}function ig(e){}function ct(e){let r=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,t])=>r.indexOf(+o)===-1).map(([o,t])=>t)}function g(e,r="|"){return e.map(i=>h(i)).join(r)}function st(e,r){return typeof r=="bigint"?r.toString():r}var lo=class{constructor(r){this._getter=r,this._value=void 0}get value(){let r=this._getter;return r!==void 0&&(this._value=r(),this._getter=void 0),this._value}};function lt(e){return new lo(e)}function Hr(e){return e==null}function be(e){let r=e.startsWith("^")?1:0,i=e.endsWith("$")?e.length-1:e.length;return e.slice(r,i)}function Ht(e,r){let i=e/r,o=Math.round(i),t=4*Number.EPSILON*Math.max(Math.abs(i),1);return Math.abs(i-o)<t?0:i-o}var Vl=Symbol("evaluating");function mo(e,r,i){let o;Object.defineProperty(e,r,{get(){if(o!==Vl)return o===void 0&&(o=Vl,o=i()),o},set(t){Object.defineProperty(e,r,{value:t})},configurable:!0})}function og(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function K(e,r,i){Object.defineProperty(e,r,{value:i,writable:!0,enumerable:!0,configurable:!0})}function dt(e){let r=Object.getOwnPropertyDescriptor(e,"shape");return r?.get?r.get.raw:r?.value}function _e(e){return dt(e._zod.def)??e._zod.def.shape}function Fl(e,r,i){Object.defineProperty(e,r,{get(){let o=i();return K(this,r,o),o},enumerable:!0,configurable:!0})}function Ml(e,r,i){r in e?K(e,r,i):e[r]=i}function Le(e,r,i,o){let t=_e(r);for(let n of i){let a=Object.getOwnPropertyDescriptor(t,n);a.enumerable&&(a.get?Fl(e,n,()=>{let u=r._zod.def.shape[n];return o?o(u,n):u}):Ml(e,n,o?o(a.value,n):a.value))}}function ag(e,r){for(let i of Reflect.ownKeys(r)){let o=Object.getOwnPropertyDescriptor(r,i);o.enumerable&&(o.get?Fl(e,i,()=>r[i]):Ml(e,i,o.value))}}function fe(...e){let r={};for(let i of e){let o=Object.getOwnPropertyDescriptors(i);Object.assign(r,o)}return Object.defineProperties({},r)}function ug(e){return fe(e._zod.def)}function cg(e,r){return r?r.reduce((i,o)=>i?.[o],e):e}function sg(e){let r=Object.keys(e),i=r.map(o=>e[o]);return Promise.all(i).then(o=>{let t={};for(let n=0;n<r.length;n++)t[r[n]]=o[n];return t})}function lg(e=10){let r="abcdefghijklmnopqrstuvwxyz",i="";for(let o=0;o<e;o++)i+=r[Math.floor(Math.random()*r.length)];return i}function H(e){return JSON.stringify(e)}function po(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Yr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Re(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var go=lt(()=>{if(B.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function se(e){if(Re(e)===!1)return!1;let r=e.constructor;if(r===void 0||typeof r!="function")return!0;let i=r.prototype;return!(Re(i)===!1||Object.prototype.hasOwnProperty.call(i,"isPrototypeOf")===!1)}function Yt(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function dg(e){let r=0;for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&r++;return r}var fg=e=>{let r=typeof e;switch(r){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: ${r}`)}},Qt=new Set(["string","number","symbol"]),vo=new Set(["string","number","bigint","boolean","symbol","undefined"]);function le(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function T(e,r,i){let o=new e._zod.constr(r??e._zod.def);return(!r||i?.parent)&&(o._zod.parent=e),o}function b(e){let r=e;if(!r)return{};if(typeof r=="string")return{error:()=>r};if(r?.message!==void 0){if(r?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");r.error=r.message}return delete r.message,typeof r.error=="string"?{...r,error:()=>r.error}:r}function mg(e){let r;return new Proxy({},{get(i,o,t){return r??(r=e()),Reflect.get(r,o,t)},set(i,o,t,n){return r??(r=e()),Reflect.set(r,o,t,n)},has(i,o){return r??(r=e()),Reflect.has(r,o)},deleteProperty(i,o){return r??(r=e()),Reflect.deleteProperty(r,o)},ownKeys(i){return r??(r=e()),Reflect.ownKeys(r)},getOwnPropertyDescriptor(i,o){return r??(r=e()),Reflect.getOwnPropertyDescriptor(r,o)},defineProperty(i,o,t){return r??(r=e()),Reflect.defineProperty(r,o,t)}})}function h(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function $o(e){return Object.keys(e).filter(r=>e[r]._zod.optin!==void 0&&e[r]._zod.optout==="optional")}var er={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]},tr={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pg(e,r){let i=e._zod.def,o=i.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let n={};return Le(n,e,Qr(e,r)),T(e,fe(i,{shape:n,checks:[]}))}function Qr(e,r){let i=_e(e),o=[];for(let t of Reflect.ownKeys(r)){if(!Object.getOwnPropertyDescriptor(i,t)?.enumerable)throw new Error(`Unrecognized key: "${String(t)}"`);r[t]&&o.push(t)}return o}function gg(e,r){let i=e._zod.def,o=i.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let n=new Set(Qr(e,r)),a={};return Le(a,e,Reflect.ownKeys(_e(e)).filter(u=>!n.has(u))),T(e,fe(i,{shape:a,checks:[]}))}function vg(e,r){if(!se(r))throw new Error("Invalid input to extend: expected a plain object");let i=e._zod.def.checks;if(i&&i.length>0){let t=_e(e);for(let n of Reflect.ownKeys(r))if(Object.getOwnPropertyDescriptor(t,n)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return T(e,fe(e._zod.def,{shape:Jl(e,r)}))}function Jl(e,r){let i={};return Le(i,e,Reflect.ownKeys(_e(e))),ag(i,r),i}function $g(e,r){if(!se(r))throw new Error("Invalid input to safeExtend: expected a plain object");return T(e,fe(e._zod.def,{shape:Jl(e,r)}))}function hg(e,r){if(!r?._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 i={};Le(i,e,Reflect.ownKeys(_e(e))),Le(i,r,Reflect.ownKeys(_e(r)));let o=fe(e._zod.def,{shape:i,get catchall(){return r._zod.def.catchall},checks:r._zod.def.checks??[]});return T(e,o)}function yg(e,r,i,o="partial"){let n=r._zod.def.checks;if(n&&n.length>0)throw new Error(`.${o}() cannot be used on object schemas containing refinements`);let u=i?new Set(Qr(r,i)):void 0,s={};return Le(s,r,Reflect.ownKeys(_e(r)),e&&((c,l)=>u&&!u.has(l)?c:new e({type:"optional",innerType:c}))),T(r,fe(r._zod.def,{shape:s,checks:[]}))}function _g(e,r,i){let o=i?new Set(Qr(r,i)):void 0,t={};return Le(t,r,Reflect.ownKeys(_e(r)),(n,a)=>o&&!o.has(a)?n:new e({type:"nonoptional",innerType:n})),T(r,fe(r._zod.def,{shape:t}))}function Y(e,r=0){if(e.aborted===!0)return!0;for(let i=r;i<e.issues.length;i++)if(e.issues[i]?.continue!==!0)return!0;return!1}function ho(e,r=0){if(e.aborted===!0)return!0;for(let i=r;i<e.issues.length;i++)if(e.issues[i]?.continue===!1)return!0;return!1}function re(e,r){return r.map(i=>{var o;return(o=i).path??(o.path=[]),i.path.unshift(e),i})}function ut(e){return typeof e=="string"?e:e?.message}function ft(e){let r=[];for(let i of e??[]){let o=i._zod.def;if(!/_(length|size)$|_equals$/.test(o.check))break;let t=o.maximum??o.length??o.size;t>=0&&r.push([t,i])}return r}function rr(e,r,i){var o;for(let t=r;t<e.length;t++)(o=e[t]).schema??(o.schema=i)}function ne(e,r,i){var o;let t=e.inst?._zod?.traits;t?.has("$ZodType")&&(t.has("$ZodCheck")?(o=e).schema??(o.schema=e.inst):e.schema=e.inst);let n=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,a=e.message?e.message:ut(e.inst?._zod.def?.error?.(e))??ut(n?.(e))??ut(r?.error?.(e))??ut(i.customError?.(e))??ut(i.localeError?.(e))??"Invalid input",u={};for(let s of Object.keys(e))s==="inst"||s==="schema"||s==="continue"||s==="input"||s==="__proto__"||(u[s]=e[s]);return u.path??(u.path=[]),u.message=a,r?.reportInput&&(u.input=e.input),u}function nr(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var bg=/[\uD800-\uDBFF]/;function Ve(e){let r=e.length;if(!bg.test(e))return r;let i=r;for(let o=0;o<r-1;o++)(e.charCodeAt(o)&64512)===55296&&(e.charCodeAt(o+1)&64512)===56320&&(i--,o++);return i}function ir(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function y(e){let r=typeof e;switch(r){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let i=e;if(i&&Object.getPrototypeOf(i)!==Object.prototype&&"constructor"in i&&i.constructor)return i.constructor.name}}return r}function mt(...e){let[r,i,o]=e;return typeof r=="string"?{message:r,code:"custom",input:i,inst:o}:{...r}}function kg(e){return Object.entries(e).filter(([r,i])=>Number.isNaN(Number.parseInt(r,10))).map(r=>r[1])}function Bl(e){let r=atob(e),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i}function Kl(e){let r="";for(let i=0;i<e.length;i++)r+=String.fromCharCode(e[i]);return btoa(r)}function xg(e){let r=e.replace(/-/g,"+").replace(/_/g,"/"),i="=".repeat((4-r.length%4)%4);return Bl(r+i)}function Ig(e){return Kl(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function wg(e){let r=e.replace(/^0x/,"");if(r.length%2!==0)throw new Error("Invalid hex string length");let i=new Uint8Array(r.length/2);for(let o=0;o<r.length;o+=2)i[o/2]=Number.parseInt(r.slice(o,o+2),16);return i}function Sg(e){return Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}var fo=class{constructor(...r){}};function yo(e,r){for(let i in r){let o=Object.getOwnPropertyDescriptor(r,i);o.get?Object.defineProperty(e,i,{...o,enumerable:!1}):Pg(e,i,o.value)}}function Se(e,r,i,o=!0){return Object.defineProperty(e,r,{configurable:!0,writable:!0,enumerable:o,value:i}),i}function or(e,r,i){return Se(e,r,i,!1)}function zg(e,r){for(let i in e){let o=e[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!0,get(){return Se(this,i,o(this))},set(t){Se(this,i,t)}})}return r}function Pg(e,r,i){Object.defineProperty(e,r,{configurable:!0,get(){return this==null?i:Se(this,r,i.bind(this))},set(o){Se(this,r,o)}})}function Dg(e,r){let i=Object.getPrototypeOf(e);return r in i?void 0:i}var so,we=!1,Og={configurable:!0,get(){we=!0}};function j(e,r,i){let o=Object.getPrototypeOf(e._zod);if(r in o&&so!==e._zod){so=void 0;return}so=e._zod,Object.defineProperty(o,r,{configurable:!0,get(){Object.defineProperty(this,r,Og);let t=we;we=!1;try{let n=i(this);return we?delete this[r]:Object.defineProperty(this,r,{configurable:!0,writable:!0,value:n}),we=we||t,n}catch(n){throw delete this[r],we=we||t,n}},set(t){Object.defineProperty(this,r,{configurable:!0,writable:!0,value:t})}})}function jg(e,r,i,o){let t=Dg(e,r);t&&Object.defineProperty(t,r,{configurable:!0,get(){let n={configurable:!0,writable:!0,enumerable:o,value:void 0};return Object.defineProperty(this,r,n),n.value=i(this),Object.defineProperty(this,r,n),n.value},set(n){Object.defineProperty(this,r,{configurable:!0,writable:!0,enumerable:o,value:n})}})}var en="~constantCatch";function _o(e){let r=()=>e;return r[en]=!0,r}var Gl,ko=Object.freeze({status:"aborted"}),bo={value:void 0,enumerable:!1},Wl="captureStackTrace"in Error?Error:null;function Ng(e){let r=Wl;if(r){let i=r.stackTraceLimit;if(typeof i=="number"){try{r.stackTraceLimit=0}catch{return Wl=null,new e}try{return new e}finally{r.stackTraceLimit=i}}}return new e}function p(e,r,i,o){let t={};function n(f){this.def=f,this.constr=d,this.traits=new Set}n.prototype=t;let a=i,u=a&&new WeakSet;function s(f,m){if(f._zod){if(f._zod.traits.has(e))return}else{bo.value=new n(m);try{Object.defineProperty(f,"_zod",bo)}finally{bo.value=void 0}}if(f._zod.traits.add(e),r(f,m),u){let _=Object.getPrototypeOf(f),k=f._zod.constr.prototype,S=_;for(;S&&S!==k;)S=Object.getPrototypeOf(S);let I=S??_;u.has(I)||(u.add(I),yo(I,a))}let v=d.prototype;for(let _ in v)Object.prototype.hasOwnProperty.call(v,_)&&(_ in f||(f[_]=v[_].bind(f)))}let c=o?.Parent??Object;class l extends c{}Object.defineProperty(l,"name",{value:e});function d(f){let m=o?.Parent?Ng(l):this;s(m,f);let v=m._zod.deferred;if(v){for(let k of v)k();m._zod.deferred=void 0}let _=globalThis.__zod_globalConfig?.postProcessor;return _&&_(m),m}return Object.defineProperty(d,"init",{value:s}),Object.defineProperty(d,Symbol.hasInstance,{value:f=>o?.Parent&&f instanceof o.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var xo=Symbol("zod_brand"),ie=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ze=class extends Error{constructor(r){super(`Encountered unidirectional transform during encode: ${r}`),this.name="ZodEncodeError"}};(Gl=globalThis).__zod_globalConfig??(Gl.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function F(e){return e&&Object.assign(B,e),B}function Ug(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,st,2)),e.message}function Ag(e){this._zod.message=e}var Tg={get:Ug,set:Ag,enumerable:!0,configurable:!0},wo={value:void 0,enumerable:!1},Xl=new WeakSet([Object.prototype,Error.prototype]),ql=(e,r)=>{e.name="$ZodError",wo.value=r,Object.defineProperty(e,"issues",wo),wo.value=void 0,Object.defineProperty(e,"message",Tg);let i=Object.getPrototypeOf(e);Xl.has(i)||(Xl.add(i),Object.defineProperty(i,"toString",{configurable:!0,enumerable:!1,get(){let o=()=>this.message;return Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,"toString",{value:o,configurable:!0,writable:!0})}}))},So=p("$ZodError",ql),oe=p("$ZodError",ql,void 0,{Parent:Error});function Zg(e,r,i){return Object.prototype.hasOwnProperty.call(e,r)||(r==="__proto__"?Object.defineProperty(e,r,{value:i(),writable:!0,enumerable:!0,configurable:!0}):e[r]=i()),e[r]}function ar(e,r=i=>i.message){let i={},o=[];for(let t of e.issues)t.path.length>0?Zg(i,t.path[0],()=>[]).push(r(t)):o.push(r(t));return{formErrors:o,fieldErrors:i}}function ur(e,r=i=>i.message){let i={_errors:[]},o=(t,n=[])=>{for(let a of t.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(u=>o({issues:u},[...n,...a.path]));else if(a.code==="invalid_key")o({issues:a.issues},[...n,...a.path]);else if(a.code==="invalid_element")o({issues:a.issues},[...n,...a.path]);else{let u=[...n,...a.path];if(u.length===0)i._errors.push(r(a));else{let s=i,c=0;for(;c<u.length;){let l=u[c],d=c===u.length-1;if(l==="_errors"){d&&s._errors.push(r(a)),c++;continue}Object.prototype.hasOwnProperty.call(s,l)||Object.defineProperty(s,l,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let f=s[l];d&&f._errors.push(r(a)),s=f,c++}}}};return o(e),i}function zo(e,r=i=>i.message){let i={errors:[]},o=(t,n=[])=>{var a;for(let u of t.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(s=>o({issues:s},[...n,...u.path]));else if(u.code==="invalid_key")o({issues:u.issues},[...n,...u.path]);else if(u.code==="invalid_element")o({issues:u.issues},[...n,...u.path]);else{let s=[...n,...u.path];if(s.length===0){i.errors.push(r(u));continue}let c=i,l=0;for(;l<s.length;){let d=s[l],f=l===s.length-1;typeof d=="string"?(c.properties??(c.properties={}),Object.prototype.hasOwnProperty.call(c.properties,d)||Object.defineProperty(c.properties,d,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),c=c.properties[d]):(c.items??(c.items=[]),(a=c.items)[d]??(a[d]={errors:[]}),c=c.items[d]),f&&c.errors.push(r(u)),l++}}};return o(e),i}function Hl(e){let r=[],i=e.map(o=>typeof o=="object"?o.key:o);for(let o of i)typeof o=="number"?r.push(`[${o}]`):typeof o=="symbol"?r.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?r.push(`[${JSON.stringify(o)}]`):(r.length&&r.push("."),r.push(o));return r.join("")}function Po(e){let r=[],i=[...e.issues].sort((o,t)=>(o.path??[]).length-(t.path??[]).length);for(let o of i)r.push(`\u2716 ${o.message}`),o.path?.length&&r.push(` \u2192 at ${Hl(o.path)}`);return r.join(`
|
|
2
2
|
`)}function tn(e,r){return{callee:r?.callee??e,Err:r?.Err}}var pt=e=>{let r=(i,o,t,n)=>{let a=t?{...t,async:!1}:{async:!1},u=i._zod.run({value:o,issues:[]},a);if(u instanceof Promise)throw new ie;if(u.issues.length){let s=new(n?.Err??e)(u.issues.map(c=>ne(c,a,F())));throw Yr(s,n?.callee??r),s}return u.value};return r},rn=pt(oe),gt=e=>{let r=async(i,o,t,n)=>{let a=t?{...t,async:!0}:{async:!0},u=i._zod.run({value:o,issues:[]},a);if(u instanceof Promise&&(u=await u),u.issues.length){let s=new(n?.Err??e)(u.issues.map(c=>ne(c,a,F())));throw Yr(s,n?.callee??r),s}return u.value};return r},nn=gt(oe),vt=e=>(r,i,o)=>{let t=o?{...o,async:!1}:{async:!1},n=r._zod.run({value:i,issues:[]},t);if(n instanceof Promise)throw new ie;return n.issues.length?Yl(e,n.issues,t):{success:!0,data:n.value}},Eg=vt(oe);function Yl(e,r,i){let o;return{success:!1,get error(){return o||(o=new e(r.map(t=>ne(t,i,F()))),r=void 0,i=void 0),o},set error(t){o=t,r=void 0,i=void 0}}}var $t=e=>async(r,i,o)=>{let t=o?{...o,async:!0}:{async:!0},n=r._zod.run({value:i,issues:[]},t);return n instanceof Promise&&(n=await n),n.issues.length?Yl(e,n.issues,t):{success:!0,data:n.value}},Lg=$t(oe),Rg=Symbol.for("zod.compile.invalid"),Vg=Symbol.for("zod.compile.fallback"),cr=((e,r,i)=>{let o=e._zod.bag.validator;if(o!==void 0){if(o(r)!==Rg)return!0;if(o.definite===!0&&i===void 0)return!1}return Fg(e,r,i)});function Fg(e,r,i){let o=i?{...i,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},t=e._zod.bag.fallbackRun,n;if(t?(o[Vg]=!0,n=t({value:r,issues:[]},o)):n=e._zod.run({value:r,issues:[]},o),n instanceof Promise)throw new ie;return n.issues.length===0}var sr=async(e,r,i)=>{let o=i?{...i,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},t=e._zod.run({value:r,issues:[]},o);return t instanceof Promise&&(t=await t),t.issues.length===0},on=e=>{let r=pt(e),i=(o,t,n,a)=>{let u=n?{...n,direction:"backward"}:{direction:"backward"};return r(o,t,u,tn(i,a))};return i},Mg=on(oe),an=e=>{let r=pt(e),i=(o,t,n,a)=>r(o,t,n,tn(i,a));return i},Jg=an(oe),un=e=>{let r=gt(e),i=async(o,t,n,a)=>{let u=n?{...n,direction:"backward"}:{direction:"backward"};return await r(o,t,u,tn(i,a))};return i},Bg=un(oe),cn=e=>{let r=gt(e),i=async(o,t,n,a)=>await r(o,t,n,tn(i,a));return i},Kg=cn(oe),sn=e=>(r,i,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return vt(e)(r,i,t)},Gg=sn(oe),ln=e=>(r,i,o)=>vt(e)(r,i,o),Wg=ln(oe),dn=e=>async(r,i,o)=>{let t=o?{...o,direction:"backward"}:{direction:"backward"};return $t(e)(r,i,t)},Xg=dn(oe),fn=e=>async(r,i,o)=>$t(e)(r,i,o),qg=fn(oe);var de={};ge(de,{anyString:()=>ta,base64:()=>Ko,base64url:()=>Go,bigint:()=>na,boolean:()=>ia,browserEmail:()=>iv,cidrv4:()=>Jo,cidrv6:()=>Bo,creditCard:()=>mn,cuid:()=>Oo,cuid2:()=>jo,currencyCode:()=>Ho,date:()=>Yo,datetime:()=>ea,domain:()=>Xo,duration:()=>Co,e164:()=>qo,email:()=>Lo,emoji:()=>Ro,extendedDuration:()=>Hg,guid:()=>Eo,hex:()=>sa,hostname:()=>Wo,html5Email:()=>tv,httpProtocol:()=>lr,iban:()=>pn,idnEmail:()=>nv,integer:()=>dr,ipv4:()=>Vo,ipv6:()=>Fo,ksuid:()=>Ao,lowercase:()=>ua,mac:()=>Mo,md5_base64:()=>cv,md5_base64url:()=>sv,md5_hex:()=>uv,nanoid:()=>To,nanoidOfLength:()=>Zo,null:()=>oa,number:()=>ke,rfc5322Email:()=>rv,sha1_base64:()=>dv,sha1_base64url:()=>fv,sha1_hex:()=>lv,sha256_base64:()=>pv,sha256_base64url:()=>gv,sha256_hex:()=>mv,sha384_base64:()=>$v,sha384_base64url:()=>hv,sha384_hex:()=>vv,sha512_base64:()=>_v,sha512_base64url:()=>bv,sha512_hex:()=>yv,string:()=>ra,time:()=>Qo,ulid:()=>No,undefined:()=>aa,unicodeEmail:()=>Ql,uppercase:()=>ca,uuid:()=>Fe,uuid4:()=>Yg,uuid6:()=>Qg,uuid7:()=>ev,xid:()=>Uo});var Oo=/^[cC][0-9a-z]{6,}$/,jo=/^[0-9a-z]+$/,No=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Uo=/^[0-9a-vA-V]{20}$/,Ao=/^[A-Za-z0-9]{27}$/,To=/^[a-zA-Z0-9_-]{21}$/;function Zo(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Co=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Hg=/^[-+]?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)?)??$/,Eo=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Fe=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=Fe(4),Qg=Fe(6),ev=Fe(7),Lo=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,tv=/^[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])?)*$/,rv=/^(([^<>()\[\]\\.,;:\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,}))$/,Ql=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,nv=Ql,iv=/^[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])?)*$/,ov="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ro(){return new RegExp(ov,"u")}var Vo=/^(?:(?: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])$/,Fo=/^(([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}|:))$/,Mo=e=>{let r=le(e??":");return new RegExp(`^(?:[0-9A-F]{2}${r}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${r}){5}[0-9a-f]{2}$`)},Jo=/^((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])$/,Bo=/^(([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])$/,Ko=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Go=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Wo=/^(?=.{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])?)*\.?$/,Xo=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,lr=/^https?$/,qo=/^\+[1-9]\d{6,14}$/,mn=/^\d(?:[ -]?\d){11,18}$/,Ho=/^(?: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)$/,pn=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,ed="(?:(?:\\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 av(e){return new RegExp(`^${e}$`)}var Yo=av(ed);function Do(e){let r="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${r}`:e.precision===0?`${r}:[0-5]\\d`:`${r}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${r}:[0-5]\\d(?:\\.\\d+)?`:`${r}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Qo(e){return new RegExp(`^${Do(e)}$`)}function ea(e){let r=["Z"];e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let i=`${Do({precision:e.precision,seconds:!0})}(?:${r.join("|")})`,o=e.local?`${i}|${Do({precision:e.precision})}`:i;return new RegExp(`^${ed}T(?:${o})$`)}var ta=/^[\s\S]{0,}$/,ra=e=>{let r=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${r}$`)},na=/^-?\d+n?$/,dr=/^-?\d+$/,ke=/^-?\d+(?:\.\d+)?$/,ia=/^(?:true|false)$/i,oa=/^null$/i;var aa=/^undefined$/i;var ua=/^[^A-Z]*$/,ca=/^[^a-z]*$/,sa=/^[0-9a-fA-F]*$/;function fr(e,r){return new RegExp(`^[A-Za-z0-9+/]{${e}}${r}$`)}function mr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var uv=/^[0-9a-fA-F]{32}$/,cv=fr(22,"=="),sv=mr(22),lv=/^[0-9a-fA-F]{40}$/,dv=fr(27,"="),fv=mr(27),mv=/^[0-9a-fA-F]{64}$/,pv=fr(43,"="),gv=mr(43),vv=/^[0-9a-fA-F]{96}$/,$v=fr(64,""),hv=mr(64),yv=/^[0-9a-fA-F]{128}$/,_v=fr(86,"=="),bv=mr(86);var L=p("$ZodCheck",(e,r)=>{var i;e._zod??(e._zod={}),e._zod.def=r,(i=e._zod).onattach??(i.onattach=[])}),la=e=>{let r=e.value;return!Hr(r)&&r.size!==void 0},da=e=>{let r=e.value;return!Hr(r)&&r.length!==void 0},gn={number:"number",bigint:"bigint",object:"date"},$n=p("$ZodCheckLessThan",(e,r)=>{L.init(e,r);let i=gn[typeof r.value];e._zod.check=o=>{(r.inclusive?o.value<=r.value:o.value<r.value)||o.issues.push({origin:gn[typeof o.value]??i,code:"too_big",maximum:typeof r.value=="object"?r.value.getTime():r.value,input:o.value,inclusive:r.inclusive,inst:e,continue:!r.abort})}}),hn=p("$ZodCheckGreaterThan",(e,r)=>{L.init(e,r);let i=gn[typeof r.value];e._zod.check=o=>{(r.inclusive?o.value>=r.value:o.value>r.value)||o.issues.push({origin:gn[typeof o.value]??i,code:"too_small",minimum:typeof r.value=="object"?r.value.getTime():r.value,input:o.value,inclusive:r.inclusive,inst:e,continue:!r.abort})}}),fa=p("$ZodCheckMultipleOf",(e,r)=>{L.init(e,r),e._zod.check=i=>{if(typeof i.value!=typeof r.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof i.value=="bigint"?r.value!==BigInt(0)&&i.value%r.value===BigInt(0):Ht(i.value,r.value)===0)||i.issues.push({origin:typeof i.value,code:"not_multiple_of",divisor:r.value,input:i.value,inst:e,continue:!r.abort})}}),ma=p("$ZodCheckNumberFormat",(e,r)=>{L.init(e,r),r.format=r.format||"float64";let i=r.format?.includes("int"),o=i?"int":"number",[t,n]=er[r.format];e._zod.check=a=>{let u=a.value;if(i){if(!Number.isInteger(u)){a.issues.push({expected:o,format:r.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?a.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!r.abort}):a.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!r.abort});return}}u<t&&a.issues.push({origin:"number",input:u,code:"too_small",minimum:t,inclusive:!0,inst:e,continue:!r.abort}),u>n&&a.issues.push({origin:"number",input:u,code:"too_big",maximum:n,inclusive:!0,inst:e,continue:!r.abort})}}),pa=p("$ZodCheckBigIntFormat",(e,r)=>{L.init(e,r);let[i,o]=tr[r.format];e._zod.check=t=>{let n=t.value;n<i&&t.issues.push({origin:"bigint",input:n,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!r.abort}),n>o&&t.issues.push({origin:"bigint",input:n,code:"too_big",maximum:o,inclusive:!0,inst:e,continue:!r.abort})}}),ga=p("$ZodCheckMaxSize",(e,r)=>{var i;L.init(e,r),(i=e._zod.def).when??(i.when=la),e._zod.check=o=>{let t=o.value;t.size<=r.maximum||o.issues.push({origin:nr(t),code:"too_big",maximum:r.maximum,inclusive:!0,input:t,inst:e,continue:!r.abort})}}),va=p("$ZodCheckMinSize",(e,r)=>{var i;L.init(e,r),(i=e._zod.def).when??(i.when=la),e._zod.check=o=>{let t=o.value;t.size>=r.minimum||o.issues.push({origin:nr(t),code:"too_small",minimum:r.minimum,inclusive:!0,input:t,inst:e,continue:!r.abort})}}),$a=p("$ZodCheckSizeEquals",(e,r)=>{var i;L.init(e,r),(i=e._zod.def).when??(i.when=la),e._zod.check=o=>{let t=o.value,n=t.size;if(n===r.size)return;let a=n>r.size;o.issues.push({origin:nr(t),...a?{code:"too_big",maximum:r.size}:{code:"too_small",minimum:r.size},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!r.abort})}}),ha=p("$ZodCheckMaxLength",(e,r)=>{var i;L.init(e,r),(i=e._zod.def).when??(i.when=da),e._zod.check=o=>{let t=o.value,n=t.length;if((typeof t=="string"&&n>r.maximum?Ve(t):n)<=r.maximum)return;let u=ir(t);o.issues.push({origin:u,code:"too_big",maximum:r.maximum,inclusive:!0,input:t,inst:e,continue:!r.abort})}}),ya=p("$ZodCheckMinLength",(e,r)=>{var i;L.init(e,r),(i=e._zod.def).when??(i.when=da),e._zod.check=o=>{let t=o.value,n=t.length;if((typeof t=="string"&&n>=r.minimum&&n<r.minimum*2?Ve(t):n)>=r.minimum)return;let u=ir(t);o.issues.push({origin:u,code:"too_small",minimum:r.minimum,inclusive:!0,input:t,inst:e,continue:!r.abort})}}),_a=p("$ZodCheckLengthEquals",(e,r)=>{var i;L.init(e,r),(i=e._zod.def).when??(i.when=da),e._zod.check=o=>{let t=o.value,n=t.length,a=typeof t=="string"&&n>=r.length&&n<=r.length*2?Ve(t):n;if(a===r.length)return;let u=ir(t),s=a>r.length;o.issues.push({origin:u,...s?{code:"too_big",maximum:r.length}:{code:"too_small",minimum:r.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!r.abort})}}),ht=p("$ZodCheckStringFormat",(e,r)=>{var i,o;L.init(e,r),r.pattern?(i=e._zod).check??(i.check=t=>{r.pattern.lastIndex=0,!r.pattern.test(t.value)&&t.issues.push({origin:"string",code:"invalid_format",format:r.format,input:t.value,...r.pattern?{pattern:r.pattern.toString()}:{},inst:e,continue:!r.abort})}):(o=e._zod).check??(o.check=()=>{})}),ba=p("$ZodCheckRegex",(e,r)=>{ht.init(e,r),e._zod.check=i=>{r.pattern.lastIndex=0,!r.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:"regex",input:i.value,pattern:r.pattern.toString(),inst:e,continue:!r.abort})}}),ka=p("$ZodCheckLowerCase",(e,r)=>{r.pattern??(r.pattern=ua),ht.init(e,r)}),xa=p("$ZodCheckUpperCase",(e,r)=>{r.pattern??(r.pattern=ca),ht.init(e,r)}),Ia=p("$ZodCheckIncludes",(e,r)=>{L.init(e,r);let i=le(r.includes),o=new RegExp(typeof r.position=="number"?`^.{${r.position},}${i}`:i);r.pattern=o,e._zod.check=t=>{t.value.includes(r.includes,r.position)||t.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:r.includes,input:t.value,inst:e,continue:!r.abort})}}),wa=p("$ZodCheckStartsWith",(e,r)=>{L.init(e,r);let i=new RegExp(`^${le(r.prefix)}.*`);r.pattern??(r.pattern=i),e._zod.check=o=>{o.value.startsWith(r.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:r.prefix,input:o.value,inst:e,continue:!r.abort})}}),Sa=p("$ZodCheckEndsWith",(e,r)=>{L.init(e,r);let i=new RegExp(`.*${le(r.suffix)}$`);r.pattern??(r.pattern=i),e._zod.check=o=>{o.value.endsWith(r.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:r.suffix,input:o.value,inst:e,continue:!r.abort})}});function vn(e,r,i){e.issues.length&&r.issues.push(...re(i,e.issues))}var za=p("$ZodCheckProperty",(e,r)=>{L.init(e,r),e._zod.check=i=>{let o=r.schema._zod.run({value:i.value[r.property],issues:[]},{});if(o instanceof Promise)return o.then(t=>vn(t,i,r.property));vn(o,i,r.property)}}),Pa=p("$ZodCheckProperties",(e,r)=>{L.init(e,r),or(e,Symbol.iterator,function*(){yield e});let i;e._zod.check=o=>{if(o.value==null){o.issues.push({expected:"object",code:"invalid_type",input:o.value,inst:e});return}i??(i=Reflect.ownKeys(r.shape).map(a=>[a,r.shape[a]]));let t=o.value,n;for(let[a,u]of i){let s=u._zod.run({value:t[a],issues:[]},{});s instanceof Promise?(n??(n=[]),n.push(s.then(c=>vn(c,o,a)))):vn(s,o,a)}if(n)return Promise.all(n).then(()=>{})}}),Da=p("$ZodCheckMimeType",(e,r)=>{L.init(e,r);let i=new Set(r.mime);e._zod.check=o=>{i.has(o.value.type)||o.issues.push({code:"invalid_value",values:r.mime,input:o.value.type,inst:e,continue:!r.abort})}}),Oa=p("$ZodCheckOverwrite",(e,r)=>{L.init(e,r),e._zod.check=i=>{i.value=r.tx(i.value)}});var Me=class{constructor(r=[],i={}){this.content=[],this.indent=0,this.args=r,this.closed=i}indented(r){this.indent+=1;try{r(this)}finally{this.indent-=1}}write(r){if(typeof r=="function"){r(this,{execution:"sync"}),r(this,{execution:"async"});return}let o=r.split(`
|
|
3
3
|
`).filter(a=>a),t=Math.min(...o.map(a=>a.length-a.trimStart().length)),n=o.map(a=>a.slice(t)).map(a=>" ".repeat(this.indent*2)+a);for(let a of n)this.content.push(a)}compile(){let r=Function,i=this?.content??[""];return new r(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
4
4
|
${i.join(`
|
|
@@ -59,5 +59,5 @@ ${s}`:s:"",l=Function,d=`return (input) => {
|
|
|
59
59
|
${s}
|
|
60
60
|
}`,f;try{f=new l(...a,d)(...u)}catch(m){throw new N(`this schema (generated code failed to evaluate: ${m.message})`)}return r?.debug&&(f.code=c),f.definite=o.definite,f}function z(e,r){for(let[o,t]of e.constants)if(t===r)return o;let i=`c${e.constantCounter++}`;return e.constants.set(i,r),i}function Ke(e,r){return e.definite=!1,z(e,r)}function w(e){return`v${e.varCounter++}`}function K$(e,r){let i=e._zod.run({value:r,issues:[]},{});if(i&&typeof i.then=="function")return Q;let o=i;return o.issues.length===0?o.value:Q}function q(e,r,i,o,t=!0){let n=e.content.length,a=r.constants.size,u=r.constantCounter,s=r.varCounter;try{return V(e,r,i,o,t)}catch(c){if(!(c instanceof N)||!c.islandable)throw c;if(e.content.length=n,r.constants.size>a){let l=Array.from(r.constants.keys()).slice(a);for(let d of l)r.constants.delete(d)}return r.constantCounter=u,r.varCounter=s,G$(e,r,i,o)}}function G$(e,r,i,o){r.definite=!1;let t=z(r,i),n=z(r,K$),a=w(r);return e.write(`const ${a} = ${n}(${t}, ${o});`),e.write(`if (${a} === INVALID) return INVALID;`),a}var W$=new Set(["max_size","min_size","size_equals","max_length","min_length","length_equals"]);function X$(e,r,i,o){let t=i._zod.def.checks;if(!t||t.length===0)return o;let n=o;for(let a of t){let u=a._zod.def;if(u.when&&!W$.has(u.check))throw new N('check with a custom "when" condition');switch(u.check){case"greater_than":q$(e,r,u,n);break;case"less_than":H$(e,r,u,n);break;case"multiple_of":Y$(e,r,u,n);break;case"number_format":Bf(e,u,n);break;case"min_length":{let s=Pe(u.minimum,"min_length"),c=qu(e,r,n,`${n}.length >= ${s} && ${n}.length < ${u.minimum*2}`);e.write(`if (${c} < ${s}) return INVALID;`);break}case"max_length":{let s=Pe(u.maximum,"max_length"),c=qu(e,r,n,`${n}.length > ${s}`);e.write(`if (${c} > ${s}) return INVALID;`);break}case"length_equals":{let s=Pe(u.length,"length_equals"),c=qu(e,r,n,`${n}.length >= ${s} && ${n}.length <= ${u.length*2}`);e.write(`if (${c} !== ${s}) return INVALID;`);break}case"min_size":e.write(`if (${n}.size < ${Pe(u.minimum,"min_size")}) return INVALID;`);break;case"max_size":e.write(`if (${n}.size > ${Pe(u.maximum,"max_size")}) return INVALID;`);break;case"size_equals":e.write(`if (${n}.size !== ${Pe(u.size,"size_equals")}) return INVALID;`);break;case"string_format":n=Kf(e,r,u,n);break;case"custom":n=ih(e,r,a,n);break;case"bigint_format":Q$(e,u,n);break;case"mime_type":eh(e,r,u,n);break;case"property":rh(e,r,u,n);break;case"properties":th(e,r,u,n);break;case"overwrite":{let s=w(r);nh(e,r,a,n,s),n=s;break}default:throw new N(`check type ${u.check}`)}}return n}function qu(e,r,i,o){let t=z(r,Ve),n=w(r);return e.write(`const ${n} = typeof ${i} === "string" && ${o} ? ${t}(${i}) : ${i}.length;`),n}function Pe(e,r){if(typeof e!="number"||!Number.isFinite(e))throw new N(`${r} bound of type ${typeof e}`);return`${e}`}function Jf(e,r){if(typeof r=="bigint")return`${r}n`;if(typeof r=="number"){if(Number.isNaN(r))throw new N("comparison check with NaN bound");return`${r}`}if(r instanceof Date){if(Number.isNaN(r.getTime()))throw new N("comparison check with Invalid Date bound");return z(e,r)}throw new N(`comparison check bound of type ${typeof r}`)}function q$(e,r,i,o){let t=i.inclusive?"<":"<=";e.write(`if (${o} ${t} ${Jf(r,i.value)}) return INVALID;`)}function H$(e,r,i,o){let t=i.inclusive?">":">=";e.write(`if (${o} ${t} ${Jf(r,i.value)}) return INVALID;`)}function Y$(e,r,i,o){if(typeof i.value=="bigint"){if(i.value===BigInt(0))throw new N("multiple_of check with a zero divisor");e.write(`if (${o} % ${i.value}n !== 0n) return INVALID;`)}else{let t=z(r,Ht);e.write(`if (${t}(${o}, ${Pe(i.value,"multiple_of")}) !== 0) return INVALID;`)}}function Bf(e,r,i){let o=r.format;switch(o){case"safeint":e.write(`if (!Number.isSafeInteger(${i})) return INVALID;`);break;case"int32":e.write(`if (!Number.isInteger(${i}) || ${i} < -2147483648 || ${i} > 2147483647) return INVALID;`);break;case"uint32":e.write(`if (!Number.isInteger(${i}) || ${i} < 0 || ${i} > 4294967295) return INVALID;`);break;case"float32":e.write(`if (!Number.isFinite(${i}) || ${i} < -3.4028234663852886e38 || ${i} > 3.4028234663852886e38) return INVALID;`);break;case"float64":e.write(`if (!Number.isFinite(${i})) return INVALID;`);break;default:throw new N(`number format ${o}`)}}function Q$(e,r,i){let o=r.format;if(o)switch(o){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break;default:throw new N(`bigint format ${o}`)}}function eh(e,r,i,o){let t=i.mime;if(t&&t.length>0){let n=z(r,new Set(t));e.write(`if (!${n}.has(${o}.type)) return INVALID;`)}}function th(e,r,i,o){if(i.when)throw new N('check with a custom "when" condition');e.write(`if (${o} == null) return INVALID;`);let t=i.shape;for(let n of Reflect.ownKeys(t)){let a=typeof n=="symbol"?z(r,n):H(n),u=w(r);e.write(`const ${u} = ${o}[${a}];`),q(e,r,t[n],u,!1)}}function rh(e,r,i,o){let t=`${o}[${JSON.stringify(i.property)}]`;V(e,r,i.schema,t)}function nh(e,r,i,o,t){let n=i._zod.def.tx;if(!n)throw new N("overwrite check without a transform function");if(Ge(n))throw new me("z.compile: async overwrite transforms are not supported");let a=z(r,n);e.write(`const ${t} = ${a}(${o});`)}function Hu(){throw new ie}function ec(e){this.issues.push(e)}function ih(e,r,i,o){let t=i._zod.def;if(t.fn){if(Ge(t.fn))throw new me("z.compile: async .refine() predicates are not supported");let n=Ke(r,t.fn),a=z(r,Hu),u=w(r);return e.write(`const ${u} = ${n}(${o});`),e.write(`if (${u} instanceof Promise) ${a}();`),e.write(`if (!${u}) return INVALID;`),o}if(i._zod.check){if(Ge(i._zod.check))throw new me("z.compile: async .superRefine() / check functions are not supported");let n=i._zod.check,u=Ke(r,c=>{let l={value:c,issues:[],addIssue:ec};return n(l)instanceof Promise&&Hu(),l.issues.length===0?l.value:Q}),s=w(r);return e.write(`const ${s} = ${u}(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}throw new N("custom check without a predicate or check function")}var oh=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 Kf(e,r,i,o,t=!0){let n=i.format;if(n==="base64"){let c=z(r,$r);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="base64url"){let c=z(r,Dn);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="jwt"){let c=z(r,Nn),l=z(r,i.alg??null);return e.write(`if (!${c}(${o}, ${l})) return INVALID;`),o}if(n==="ipv6"){let c=z(r,vr);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="cidrv6"){let c=z(r,zn);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="credit_card"){let c=z(r,On);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(n==="iban"){let c=z(r,jn);return e.write(`if (!${c}(${o})) return INVALID;`),o}let a=i;if(n==="url"||n==="httpurl"||a.normalize||a.hostname!==void 0||a.protocol!==void 0){let c=z(r,In),l=z(r,i),d=w(r),f=w(r);if(e.write(`const ${d} = ${o}.trim();`),e.write(`const ${f} = ${c}(${d}, ${l});`),e.write(`if (typeof ${f} === "number") return INVALID;`),a.hostname!==void 0){let _=z(r,wn);e.write(`if (!${_}(${f}, ${l}.hostname)) return INVALID;`)}if(a.protocol!==void 0){let _=z(r,Sn);e.write(`if (!${_}(${f}, ${l}.protocol)) return INVALID;`)}if(!t)return null;let m=w(r),v=a.normalize?`${f}.href`:`${z(r,gr)}(${d})`;return e.write(`const ${m} = ${v};`),m}let u=i.fn;if(u){if(Ge(u))throw new N(`async string format ${n}`);let c=z(r,u);return e.write(`if (!${c}(${o})) return INVALID;`),o}if(oh.has(n)&&i.pattern){let c=z(r,i.pattern);return e.write(`${c}.lastIndex = 0;`),e.write(`if (!${c}.test(${o})) return INVALID;`),o}let s=i.format;switch(s){case"regex":throw new N("regex format without a pattern");case"lowercase":e.write(`if (${o} !== ${o}.toLowerCase()) return INVALID;`);break;case"uppercase":e.write(`if (${o} !== ${o}.toUpperCase()) return INVALID;`);break;case"includes":e.write(`if (!${o}.includes(${H(i.includes)})) return INVALID;`);break;case"starts_with":{let c=i.prefix;e.write(`if (${o}.slice(0, ${c.length}) !== ${H(c)}) return INVALID;`);break}case"ends_with":{let c=i.suffix;e.write(`if (${o}.slice(-${c.length}) !== ${H(c)}) return INVALID;`);break}default:throw new N(`string format ${s}`)}return o}function V(e,r,i,o,t=!0){let n=i._zod.def,a=n.type;if(n.coerce)throw new N(`coercion (z.coerce.${a}())`);let u=t||!!n.checks?.length,s;switch(a){case"string":s=ah(e,r,i,o,u);break;case"number":s=uh(e,i,o);break;case"boolean":s=ch(e,o);break;case"bigint":s=sh(e,i,o);break;case"symbol":s=lh(e,o);break;case"undefined":s=dh(e,o);break;case"null":s=fh(e,o);break;case"any":case"unknown":s=o;break;case"never":e.write("return INVALID;"),s=o;break;case"void":s=mh(e,o);break;case"nan":s=ph(e,o);break;case"date":s=gh(e,o);break;case"object":s=vh(e,r,i,o,u);break;case"optional":s=$h(e,r,i,o,u);break;case"nullable":s=_h(e,r,i,o,u);break;case"array":s=bh(e,r,i,o,u);break;case"literal":s=kh(e,r,i,o);break;case"enum":s=xh(e,r,i,o);break;case"readonly":{let c=Vf(e,r,i,o),l=w(r);e.write(`const ${l} = Object.freeze(${c});`),s=l;break}case"success":Vf(e,r,i,o),s="true";break;case"default":case"prefault":s=Ih(e,r,i,o);break;case"nonoptional":s=wh(e,r,i,o);break;case"tuple":s=Sh(e,r,i,o);break;case"union":s=zh(e,r,i,o);break;case"intersection":s=Oh(e,r,i,o);break;case"record":s=jh(e,r,i,o);break;case"map":s=Uh(e,r,i,o);break;case"set":s=Ah(e,r,i,o);break;case"file":s=Th(e,o);break;case"template_literal":s=Zh(e,r,i,o);break;case"lazy":s=Ch(e,r,i,o);break;case"pipe":s=Eh(e,r,i,o);break;case"custom":s=Lh(e,r,i,o);break;case"transform":s=Fh(e,r,i,o);break;case"catch":s=Vh(e,r,i,o);break;default:throw new N(`schema type ${a}`)}return s===null?null:X$(e,r,i,s)}function ah(e,r,i,o,t=!0){e.write(`if (typeof ${o} !== "string") return INVALID;`);let n=i._zod.def;return n.format===void 0?o:Kf(e,r,n,o,t)}function uh(e,r,i){e.write(`if (typeof ${i} !== "number" || !Number.isFinite(${i})) return INVALID;`);let o=r._zod.def;return o.check==="number_format"&&o.format&&Bf(e,{format:o.format},i),i}function ch(e,r){return e.write(`if (typeof ${r} !== "boolean") return INVALID;`),r}function sh(e,r,i){e.write(`if (typeof ${i} !== "bigint") return INVALID;`);let o=r._zod.def;if(o.format)switch(o.format){case"int64":e.write(`if (${i} < -9223372036854775808n || ${i} > 9223372036854775807n) return INVALID;`);break;case"uint64":e.write(`if (${i} < 0n || ${i} > 18446744073709551615n) return INVALID;`);break}return i}function lh(e,r){return e.write(`if (typeof ${r} !== "symbol") return INVALID;`),r}function dh(e,r){return e.write(`if (${r} !== undefined) return INVALID;`),r}function fh(e,r){return e.write(`if (${r} !== null) return INVALID;`),r}function mh(e,r){return e.write(`if (${r} !== undefined) return INVALID;`),r}function ph(e,r){return e.write(`if (typeof ${r} !== "number" || !Number.isNaN(${r})) return INVALID;`),r}function gh(e,r){return e.write(`if (!(${r} instanceof Date) || Number.isNaN(${r}.getTime())) return INVALID;`),r}function vh(e,r,i,o,t=!0){let n=i._zod.def;e.write(`if (typeof ${o} !== "object" || ${o} === null || Array.isArray(${o})) return INVALID;`);let a=n.shape,u=Object.keys(a),s=Object.getOwnPropertySymbols(a),c=s.length?[...u,...s]:u,l=I=>typeof I=="symbol"?z(r,I):H(I),d=I=>typeof I=="symbol"?`[${l(I)}]`:H(I),f=a;if(u.includes("__proto__"))throw new N('object shape key "__proto__"');let m=new Map;for(let I of c){let D=f[I],A=l(I),R=w(r);if(e.write(`const ${R} = ${o}[${A}];`),D._zod.optin!==void 0){let U=w(r);e.write(`let ${U} = (() => {`),e.indented(X=>{let Wt=q(X,r,D,R);X.write(`return ${Wt};`)}),e.write("})();"),D._zod.optout==="optional"?(e.write(`if (${U} === INVALID) {`),e.indented(X=>{X.write(`if (${A} in ${o}) return INVALID;`),X.write(`${U} = undefined;`)}),e.write("}")):e.write(`if (${U} === INVALID) return INVALID;`),m.set(I,U)}else{yh(D)&&e.write(`if (!(${A} in ${o})) return INVALID;`);let U=q(e,r,D,R,t);U!==null&&m.set(I,U)}}let v=n.catchall,_="none";if(v){let I=v._zod.def.type;if(I==="never"){let D=u.map(A=>`k !== ${H(A)}`).join(" && ")||"true";e.write(`for (const k in ${o}) {`),e.indented(A=>{A.write(`if (${D}) return INVALID;`)}),e.write("}")}else(I==="unknown"||I==="any")&&!v._zod.def.checks?.length?_="passthrough":_="schema"}let k=w(r),S=c.some(I=>Rf(f[I])||Yu(f[I]));if(!t){if(_==="schema"){let I=u.length>0?z(r,new Set(u)):null;e.write(`for (const k in ${o}) {`),e.indented(D=>{D.write('if (k === "__proto__") continue;'),I&&D.write(`if (${I}.has(k)) continue;`);let A=w(r);D.write(`const ${A} = ${o}[k];`),q(D,r,v,A,!1)}),e.write("}")}return null}if(S){e.write(`const ${k} = {};`);for(let I of c){let D=l(I),A=m.get(I);Yu(f[I])?e.write(`if (${D} in ${o}) ${k}[${D}] = ${A};`):Rf(f[I])?e.write(`if (${A} !== undefined || ${D} in ${o}) ${k}[${D}] = ${A};`):e.write(`${k}[${D}] = ${A};`)}}else{let I=c.map(D=>`${d(D)}: ${m.get(D)}`).join(", ");e.write(`const ${k} = { ${I} };`)}if(_!=="none"){let I=u.length>0?z(r,new Set(u)):null;e.write(`for (const k in ${o}) {`),e.indented(D=>{if(D.write('if (k === "__proto__") continue;'),I&&D.write(`if (${I}.has(k)) continue;`),_==="passthrough")D.write(`${k}[k] = ${o}[k];`);else{let A=w(r);D.write(`const ${A} = ${o}[k];`);let R=q(D,r,v,A);D.write(`${k}[k] = ${R};`)}}),e.write("}")}return k}function $h(e,r,i,o,t=!0){let n=i._zod.def;if(hh(i))return V(e,r,n.innerType,o,t);if(n.innerType._zod.optin==="defaulted"){let u=w(r),s=w(r);return e.write(`let ${u};`),e.write(`if (${o} === undefined) {`),e.indented(c=>{c.write(`const ${s} = (() => {`),c.indented(l=>{let d=V(l,r,n.innerType,o);l.write(`return ${d};`)}),c.write("})();"),c.write(`if (${s} !== INVALID) ${u} = ${s};`)}),e.write("} else {"),e.indented(c=>{let l=V(c,r,n.innerType,o);c.write(`${u} = ${l};`)}),e.write("}"),u}let a=t?w(r):null;return a&&e.write(`let ${a};`),e.write(`if (${o} !== undefined) {`),e.indented(u=>{let s=V(u,r,n.innerType,o,t);a&&s!==null&&u.write(`${a} = ${s};`)}),e.write("}"),a}function hh(e){return e._zod.traits?.has("$ZodExactOptional")===!0}function yh(e){return e._zod.optin===void 0&&Be(e)}function Be(e){if(e._zod.def.coerce)return!0;let r=e._zod.def;switch(r.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 r.innerType?Be(r.innerType):!1;case"literal":return!!r.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":case"nullable":case"readonly":case"success":return r.innerType?Be(r.innerType):!0;case"catch":return!0;case"union":return r.options?r.options.some(Be):!0;case"intersection":return!r.left||!r.right?!0:Be(r.left)&&Be(r.right);case"pipe":return r.in?Be(r.in):!0;default:return!0}}function Yu(e){return e._zod.optin==="optional"&&e._zod.optout==="optional"}function Rf(e){return(e._zod.optin!=="defaulted"||e._zod.optout==="optional")&&kt(e)}function kt(e){let r=e._zod.def;switch(r.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!!r.values?.includes(void 0);case"enum":return!!e._zod.values?.has(void 0);case"optional":return!0;case"nullable":case"readonly":case"nonoptional":return r.innerType?kt(r.innerType):!0;case"union":return r.options?r.options.some(kt):!0;case"intersection":return!r.left||!r.right||kt(r.left)||kt(r.right);case"pipe":return r.out?kt(r.out):!0;default:return!0}}function _h(e,r,i,o,t=!0){let n=i._zod.def,a=t?w(r):null;return a&&e.write(`let ${a} = null;`),e.write(`if (${o} !== null) {`),e.indented(u=>{let s=V(u,r,n.innerType,o,t);a&&s!==null&&u.write(`${a} = ${s};`)}),e.write("}"),a}function tc(e,r,i){for(let[o,t]of ft(r._zod.def.checks))e.write(`if (${i} > ${Pe(o,t._zod.def.check)}) return INVALID;`)}function bh(e,r,i,o,t=!0){let n=i._zod.def;e.write(`if (!Array.isArray(${o})) return INVALID;`),tc(e,i,`${o}.length`);let a=t?w(r):null,u=w(r),s=w(r);return a&&e.write(`const ${a} = new Array(${o}.length);`),e.write(`for (let ${u} = 0; ${u} < ${o}.length; ${u}++) {`),e.indented(c=>{c.write(`const ${s} = ${o}[${u}];`);let l=q(c,r,n.element,s,t);a&&l!==null&&c.write(`${a}[${u}] = ${l};`)}),e.write("}"),a}function kh(e,r,i,o){let n=i._zod.def.values;if(n.length!==1){let u=z(r,new Set(n));return e.write(`if (!${u}.has(${o})) return INVALID;`),o}let a=n[0];if(typeof a=="number"&&Number.isNaN(a)){let u=z(r,new Set(n));return e.write(`if (!${u}.has(${o})) return INVALID;`),o}if(typeof a=="string")e.write(`if (${o} !== ${H(a)}) return INVALID;`);else if(typeof a=="number"||typeof a=="boolean")e.write(`if (${o} !== ${a}) return INVALID;`);else if(a===null)e.write(`if (${o} !== null) return INVALID;`);else if(a===void 0)e.write(`if (${o} !== undefined) return INVALID;`);else if(typeof a=="bigint")e.write(`if (${o} !== ${a}n) return INVALID;`);else throw new N(`literal type ${typeof a}`);return o}function xh(e,r,i,o){let t=i._zod.values;if(!t)throw new N("enum schema without enumerated values");let n=z(r,t);return e.write(`if (!${n}.has(${o})) return INVALID;`),o}function Vf(e,r,i,o){let t=i._zod.def;return V(e,r,t.innerType,o)}function Ih(e,r,i,o){let t=i._zod.def,a=Object.getOwnPropertyDescriptor(i._zod.def,"defaultValue")?()=>i._zod.def.defaultValue:void 0;if(i._zod.def.type==="prefault"){if(!a)return V(e,r,t.innerType,o);let s=z(r,a),c=w(r);return e.write(`let ${c} = ${o};`),e.write(`if (${o} === undefined) ${c} = ${s}();`),V(e,r,t.innerType,c)}let u=w(r);if(a){let s=z(r,a),c=z(r,Yt);e.write(`let ${u};`),e.write(`if (${o} === undefined) {`),e.indented(l=>{l.write(`${u} = ${c}(${s}());`)}),e.write("} else {"),e.indented(l=>{let d=V(l,r,t.innerType,o);l.write(`${u} = ${d} === undefined ? ${c}(${s}()) : ${d};`)}),e.write("}")}else e.write(`let ${u};`),e.write(`if (${o} !== undefined) {`),e.indented(s=>{let c=V(s,r,t.innerType,o);s.write(`${u} = ${c};`)}),e.write("}");return u}function wh(e,r,i,o){let t=i._zod.def,n=V(e,r,t.innerType,o),a=w(r);return e.write(`const ${a} = ${n};`),e.write(`if (${a} === undefined) return INVALID;`),a}function Sh(e,r,i,o){let t=i._zod.def,n=t.items,a=t.rest;e.write(`if (!Array.isArray(${o})) return INVALID;`);let u=Ff(n,"optin"),s=Ff(n,"optout");a?e.write(`if (${o}.length < ${u}) return INVALID;`):e.write(`if (${o}.length < ${u} || ${o}.length > ${n.length}) return INVALID;`);let c=w(r);e.write(`const ${c} = [];`);for(let l=0;l<n.length;l++){let d=n[l];if(l>=s)e.write(`if (${c}.length === ${l}) {`),e.indented(f=>{f.write(`if (${l} < ${o}.length) {`),f.indented(m=>{let v=w(r);m.write(`const ${v} = ${o}[${l}];`);let _=q(m,r,d,v);m.write(`${c}[${l}] = ${_};`)}),f.write("} else {"),f.indented(m=>{if(Yu(d)){m.write(`${c}.length = ${l};`);return}let v=w(r),_=w(r);m.write(`const ${v} = undefined;`),m.write(`const ${_} = (() => {`),m.indented(k=>{let S=q(k,r,d,v);k.write(`return ${S};`)}),m.write("})();"),m.write(`if (${_} === INVALID || ${_} === undefined) ${c}.length = ${l};`),m.write(`else ${c}[${l}] = ${_};`)}),f.write("}")}),e.write("}");else{let f=w(r);e.write(`const ${f} = ${o}[${l}];`);let m=q(e,r,d,f);e.write(`${c}[${l}] = ${m};`)}}if(a){let l=w(r),d=w(r);e.write(`for (let ${l} = ${n.length}; ${l} < ${o}.length; ${l}++) {`),e.indented(f=>{f.write(`const ${d} = ${o}[${l}];`);let m=q(f,r,a,d);f.write(`${c}[${l}] = ${m};`)}),e.write("}")}return c}function Ff(e,r){for(let i=e.length-1;i>=0;i--)if(!(r==="optin"?e[i]._zod.optin!==void 0:e[i]._zod.optout==="optional"))return i+1;return 0}function zh(e,r,i,o){let t=i._zod.def,n=t.options;if(t.discriminator)return Ph(e,r,t,o);if(t.inclusive===!1)throw new N("exclusive unions (z.xor)");if(n.length===0)return e.write("return INVALID;"),o;if(n.length===1)return V(e,r,n[0],o);if(n.every(s=>s._zod.def.type==="literal"&&!s._zod.def.checks?.length)){let s=new Set(n.flatMap(l=>l._zod.def.values)),c=z(r,s);return e.write(`if (!${c}.has(${o})) return INVALID;`),o}let u=w(r);e.write(`let ${u};`);for(let s=0;s<n.length;s++){let c=n[s];s===0?e.write(`${u} = (() => {`):e.write(`if (${u} === INVALID) ${u} = (() => {`),e.indented(l=>{let d=V(l,r,c,o);l.write(`return ${d};`)}),e.write("})();")}return e.write(`if (${u} === INVALID) return INVALID;`),u}function Ph(e,r,i,o){if(i.unionFallback)throw new N("discriminated union with unionFallback");if(i.options.length===0)return e.write("return INVALID;"),o;let t=w(r),n=w(r);e.write(`const ${t} = ${o}?.[${H(i.discriminator)}];`),e.write(`let ${n};`);let a=!0,u=new Set;for(let s of i.options){let c=s._zod.propValues?.[i.discriminator];if(!c||c.size===0)throw new N("discriminated union option without static discriminator values");for(let f of c){if(u.has(f))throw new N(`duplicate discriminator value ${String(f)}`);u.add(f)}let l=Array.from(c,f=>Dh(r,t,f)),d=a?"if":"else if";e.write(`${d} (${l.join(" || ")}) {`),e.indented(f=>{let m=V(f,r,s,o);f.write(`${n} = ${m};`)}),e.write("}"),a=!1}return e.write("else { return INVALID; }"),n}function Dh(e,r,i){if(typeof i=="string")return`${r} === ${H(i)}`;if(typeof i=="number")return Number.isNaN(i)?`Number.isNaN(${r})`:`${r} === ${i}`;if(typeof i=="boolean")return`${r} === ${i}`;if(i===null)return`${r} === null`;if(i===void 0)return`${r} === undefined`;if(typeof i=="bigint")return`${r} === ${i}n`;if(typeof i=="symbol"){let o=z(e,i);return`${r} === ${o}`}throw new N(`literal discriminator value ${String(i)}`)}function Oh(e,r,i,o){let t=i._zod.def;r.definite=!1;let n=q(e,r,t.left,o),a=q(e,r,t.right,o),u=z(r,yt),s=w(r);return e.write(`const ${s} = ${u}(${n}, ${a});`),e.write(`if (!${s}.valid) return INVALID;`),`${s}.data`}function jh(e,r,i,o){let t=i._zod.def,n=z(r,se);e.write(`if (!${n}(${o})) return INVALID;`);let a=w(r),u=w(r),s=w(r);e.write(`const ${a} = {};`);let c=t,l=c.partial?void 0:t.keyType._zod.values;if(l){let m=[];for(let _ of l){if(!(typeof _=="string"||typeof _=="number"||typeof _=="symbol"))throw new N(`record key value ${String(_)}`);let k=typeof _=="number"?_.toString():_;if(k==="__proto__")throw new N('record key "__proto__"');m.push(k);let S=z(r,_),I=V(e,r,t.keyType,S),D=w(r);e.write(`const ${D} = ${o}[${Nh(r,k)}];`);let A=q(e,r,t.valueType,D);e.write(`${a}[${I}] = ${A};`)}let v=z(r,new Set(m));return e.write(`for (const ${u} in ${o}) {`),e.indented(_=>{_.write(`if (${v}.has(${u})) continue;`),c.mode==="loose"?_.write(`if (${u} !== "__proto__") ${a}[${u}] = ${o}[${u}];`):_.write("return INVALID;")}),e.write("}"),a}let d=t.keyType._zod.def;if(!(d.type==="string"&&d.format===void 0&&!d.coerce&&(d.checks?.length??0)===0)){let m=t.mode==="loose",v=qn(t.keyType);v.definite===!1&&(r.definite=!1);let _=z(r,v),k=z(r,ke),S=w(r);return Mf(e,r,o,u,I=>{I.write(`let ${S} = ${_}(${u});`),I.write(`if (${S} === INVALID && typeof ${u} === "string" && ${k}.test(${u})) ${S} = ${_}(Number(${u}));`),m?I.write(`if (${S} === INVALID) { ${a}[${u}] = ${o}[${u}]; continue; }`):I.write(`if (${S} === INVALID) return INVALID;`),I.write(`if (${S} === "__proto__") continue;`);let D=w(r);I.write(`const ${D} = ${o}[${u}];`);let A=q(I,r,t.valueType,D);I.write(`${a}[${S}] = ${A};`)}),a}return Mf(e,r,o,u,m=>{m.write(`const ${s} = ${o}[${u}];`);let v=q(m,r,t.valueType,s);m.write(`${a}[${u}] = ${v};`)},"return INVALID;"),a}function Mf(e,r,i,o,t,n){let a=z(r,Object.prototype.propertyIsEnumerable),u=w(r),s=w(r),c=w(r);e.write(`const ${u} = Object.getOwnPropertySymbols(${i});`),e.write(`const ${s} = Object.getOwnPropertyNames(${i});`),e.write(`for (let ${c} = 0; ${c} < ${s}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${o} = ${s}[${c}];`),l.write(`if (${o} === "__proto__" || !${a}.call(${i}, ${o})) continue;`),t(l)}),e.write("}"),e.write(`for (let ${c} = 0; ${c} < ${u}.length; ${c}++) {`),e.indented(l=>{l.write(`const ${o} = ${u}[${c}];`),l.write(`if (!${a}.call(${i}, ${o})) continue;`),n?l.write(n):t(l)}),e.write("}")}function Nh(e,r){return typeof r=="string"?H(r):z(e,r)}function Uh(e,r,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Map)) return INVALID;`),tc(e,i,`${o}.size`);let n=w(r),a=w(r),u=w(r);return e.write(`const ${n} = new Map();`),e.write(`for (const [${a}, ${u}] of ${o}) {`),e.indented(s=>{let c=V(s,r,t.keyType,a),l=V(s,r,t.valueType,u);s.write(`${n}.set(${c}, ${l});`)}),e.write("}"),n}function Ah(e,r,i,o){let t=i._zod.def;e.write(`if (!(${o} instanceof Set)) return INVALID;`),tc(e,i,`${o}.size`);let n=w(r),a=w(r);return e.write(`const ${n} = new Set();`),e.write(`for (const ${a} of ${o}) {`),e.indented(u=>{let s=V(u,r,t.valueType,a);u.write(`${n}.add(${s});`)}),e.write("}"),n}function Th(e,r){return e.write(`if (!(${r} instanceof File)) return INVALID;`),r}function Zh(e,r,i,o){e.write(`if (typeof ${o} !== "string") return INVALID;`);let t=i._zod.pattern;if(t){let n=z(r,t);e.write(`${n}.lastIndex = 0;`),e.write(`if (!${n}.test(${o})) return INVALID;`)}return o}function Ch(e,r,i,o){let t=i._zod.def,n=Ke(r,t.getter),a=z(r,{parser:null});e.write(`if (!${a}.parser) {`),e.indented(s=>{s.write(`const inner = ${n}();`),s.write(`${a}.parser = function(input) {`),s.indented(c=>{c.write("const result = inner._zod.run({ value: input, issues: [] }, {});"),c.write("return result.issues.length === 0 ? result.value : INVALID;")}),s.write("};")}),e.write("}");let u=w(r);return e.write(`const ${u} = ${a}.parser(${o});`),e.write(`if (${u} === INVALID) return INVALID;`),u}function Eh(e,r,i,o){let t=i._zod.def,n=V(e,r,t.in,o);if(t.transform){if(Ge(t.transform))throw new me("z.compile: async transforms in pipes are not supported");let a=t.transform,s=Ke(r,l=>{let d={value:l,issues:[],addIssue:ec},f=a(l,d);return f instanceof Promise?Q:d.issues.length===0?f:Q}),c=w(r);return e.write(`const ${c} = ${s}(${n});`),e.write(`if (${c} === INVALID) return INVALID;`),V(e,r,t.out,c)}else return V(e,r,t.out,n)}function Ge(e){return typeof e=="function"&&(e.constructor.name==="AsyncFunction"||e[Symbol.toStringTag]==="AsyncFunction")}function Lh(e,r,i,o){let t=i._zod.def;if(t.fn){if(Ge(t.fn))throw new me("z.compile: async custom predicates are not supported");let n=Ke(r,t.fn),a=z(r,Hu),u=w(r);e.write(`const ${u} = ${n}(${o});`),e.write(`if (${u} instanceof Promise) ${a}();`),e.write(`if (!${u}) return INVALID;`)}else throw new N("custom schema without a predicate function");return o}function Rh(e,r,i){let o=e._zod.run({value:i,issues:[]},{});if(o&&typeof o.then=="function")return Q;let t=o;return t.issues.length===0?t.value:r()}function Vh(e,r,i,o){let t=i._zod.def;if(!t.catchValue[en])throw new N("catch with a callback (only a constant catch value compiles)",!1);let n=w(r);e.write(`let ${n} = (() => {`),e.indented(c=>{let l=q(c,r,t.innerType,o);c.write(`return ${l};`)}),e.write("})();");let a=z(r,t.innerType),u=Ke(r,t.catchValue),s=z(r,Rh);return e.write(`if (${n} === INVALID) {`),e.indented(c=>{c.write(`${n} = ${s}(${a}, ${u}, ${o});`),c.write(`if (${n} === INVALID) return INVALID;`)}),e.write("}"),n}function Fh(e,r,i,o){let t=i._zod.def;if(t.transform){if(Ge(t.transform))throw new me("z.compile: async transforms are not supported");let n=t.transform,u=Ke(r,c=>{let l={value:c,issues:[],addIssue:ec},d=n(c,l);return d instanceof Promise?Q:l.issues.length===0?d:Q}),s=w(r);return e.write(`const ${s} = ${u}(${o});`),e.write(`if (${s} === INVALID) return INVALID;`),s}return o}function Hn(e){return e.checks&&(e.checks=[...e.checks]),e}function rc(e,r){return new e(Hn({type:"string",...b(r)}))}function nc(e,r){return new e(Hn({type:"string",coerce:!0,...b(r)}))}function Yn(e,r){return new e({type:"string",format:"email",check:"string_format",abort:!1,...b(r)})}function Qn(e,r){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...b(r)})}function ei(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...b(r)})}function ti(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(r)})}function ri(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(r)})}function ni(e,r){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(r)})}function Pr(e,r){return new e({type:"string",format:"url",check:"string_format",abort:!1,...b(r)})}function ii(e,r){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...b(r)})}function oi(e,r){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(r)})}function ai(e,r){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...b(r)})}function ui(e,r){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(r)})}function ci(e,r){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...b(r)})}function si(e,r){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...b(r)})}function li(e,r){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(r)})}function di(e,r){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(r)})}function fi(e,r){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(r)})}function ic(e,r){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...b(r)})}function mi(e,r){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(r)})}function pi(e,r){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(r)})}function gi(e,r){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...b(r)})}function vi(e,r){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...b(r)})}function $i(e,r){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...b(r)})}function oc(e,r){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...b(r)})}function ac(e,r){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...b(r)})}function hi(e,r){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...b(r)})}var uc={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Dr(e,r){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(r)})}function Or(e,r){return new e({type:"string",format:"date",check:"string_format",...b(r)})}function jr(e,r){return new e({type:"string",format:"time",check:"string_format",precision:null,...b(r)})}function Nr(e,r){return new e({type:"string",format:"duration",check:"string_format",...b(r)})}function cc(e,r){return new e(Hn({type:"number",checks:[],...b(r)}))}function sc(e,r){return new e(Hn({type:"number",coerce:!0,checks:[],...b(r)}))}function lc(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...b(r)})}function dc(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...b(r)})}function fc(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...b(r)})}function mc(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...b(r)})}function pc(e,r){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...b(r)})}function gc(e,r){return new e({type:"boolean",...b(r)})}function vc(e,r){return new e({type:"boolean",coerce:!0,...b(r)})}function $c(e,r){return new e({type:"bigint",...b(r)})}function hc(e,r){return new e({type:"bigint",coerce:!0,...b(r)})}function yc(e,r){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...b(r)})}function _c(e,r){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...b(r)})}function bc(e,r){return new e({type:"symbol",...b(r)})}function kc(e,r){return new e({type:"undefined",...b(r)})}function xc(e,r){return new e({type:"null",...b(r)})}function Ic(e){return new e({type:"any"})}function wc(e){return new e({type:"unknown"})}function Sc(e,r){return new e({type:"never",...b(r)})}function zc(e,r){return new e({type:"void",...b(r)})}function Pc(e,r){return new e({type:"date",...b(r)})}function Dc(e,r){return new e({type:"date",coerce:!0,...b(r)})}function Oc(e,r){return new e({type:"nan",...b(r)})}function ve(e,r){return new $n({check:"less_than",...b(r),value:e,inclusive:!1})}function ue(e,r){return new $n({check:"less_than",...b(r),value:e,inclusive:!0})}function $e(e,r){return new hn({check:"greater_than",...b(r),value:e,inclusive:!1})}function ce(e,r){return new hn({check:"greater_than",...b(r),value:e,inclusive:!0})}function yi(e){return $e(0,e)}function _i(e){return ve(0,e)}function bi(e){return ue(0,e)}function ki(e){return ce(0,e)}function De(e,r){return new fa({check:"multiple_of",...b(r),value:e})}function Oe(e,r){return new ga({check:"max_size",...b(r),maximum:e})}function he(e,r){return new va({check:"min_size",...b(r),minimum:e})}function We(e,r){return new $a({check:"size_equals",...b(r),size:e})}function Xe(e,r){return new ha({check:"max_length",...b(r),maximum:e})}function xe(e,r){return new ya({check:"min_length",...b(r),minimum:e})}function qe(e,r){return new _a({check:"length_equals",...b(r),length:e})}function xt(e,r){return new ba({check:"string_format",format:"regex",...b(r),pattern:e})}function It(e){return new ka({check:"string_format",format:"lowercase",...b(e)})}function wt(e){return new xa({check:"string_format",format:"uppercase",...b(e)})}function St(e,r){return new Ia({check:"string_format",format:"includes",...b(r),includes:e})}function zt(e,r){return new wa({check:"string_format",format:"starts_with",...b(r),prefix:e})}function Pt(e,r){return new Sa({check:"string_format",format:"ends_with",...b(r),suffix:e})}function xi(e,r,i){return new za({check:"property",property:e,schema:r,...b(i)})}function Dt(e,r){return new Pa({check:"properties",shape:e,...b(r)})}function Ot(e,r){return new Da({check:"mime_type",mime:e,...b(r)})}function pe(e){return new Oa({check:"overwrite",tx:e})}function jt(e){return pe(r=>r.normalize(e))}function Nt(){return pe(e=>e.trim())}function Ut(){return pe(e=>e.toLowerCase())}function At(){return pe(e=>e.toUpperCase())}function Tt(){return pe(e=>po(e))}function jc(e,r,i){return new e({type:"array",element:r,...b(i)})}function Mh(e,r,i){return new e({type:"union",options:r,...b(i)})}function Jh(e,r,i){return new e({type:"union",options:r,inclusive:!1,...b(i)})}function Bh(e,r,i,o){return new e({type:"union",options:i,discriminator:r,...b(o)})}function Kh(e,r,i){return new e({type:"intersection",left:r,right:i})}function Gh(e,r,i,o){let t=i instanceof P,n=t?o:i,a=t?i:null;return new e({type:"tuple",items:r,rest:a,...b(n)})}function Wh(e,r,i,o){return new e({type:"record",keyType:r,valueType:i,...b(o)})}function Xh(e,r,i,o){return new e({type:"map",keyType:r,valueType:i,...b(o)})}function qh(e,r,i){return new e({type:"set",valueType:r,...b(i)})}function Hh(e,r,i){let o=Array.isArray(r)?Object.fromEntries(r.map(t=>[t,t])):r;return new e({type:"enum",entries:o,...b(i)})}function Yh(e,r,i){return new e({type:"enum",entries:r,...b(i)})}function Qh(e,r,i){return new e({type:"literal",values:Array.isArray(r)?r:[r],...b(i)})}function Nc(e,r){return new e({type:"file",...b(r)})}function ey(e,r){return new e({type:"transform",transform:r})}function ty(e,r){return new e({type:"optional",innerType:r})}function ry(e,r){return new e({type:"nullable",innerType:r})}function ny(e,r,i){return new e({type:"default",innerType:r,get defaultValue(){return typeof i=="function"?i():Yt(i)}})}function iy(e,r,i){return new e({type:"nonoptional",innerType:r,...b(i)})}function oy(e,r){return new e({type:"success",innerType:r})}function ay(e,r,i){return new e({type:"catch",innerType:r,catchValue:typeof i=="function"?i:_o(i)})}function uy(e,r,i){return new e({type:"pipe",in:r,out:i})}function cy(e,r){return new e({type:"readonly",innerType:r})}function sy(e,r,i){return new e({type:"template_literal",parts:r,...b(i)})}function ly(e,r){return new e({type:"lazy",getter:r})}function dy(e,r){return new e({type:"promise",innerType:r})}function Uc(e,r,i){let o=b(i);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:r,...o})}function Ac(e,r,i){return new e({type:"custom",check:"custom",fn:r,...b(i)})}function Tc(e,r){let i=Gf(o=>(o.addIssue=t=>{if(typeof t=="string")o.issues.push(mt(t,o.value,i._zod.def));else{let n=t;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),"input"in n||(n.input=o.value),n.inst??(n.inst=i),n.continue??(n.continue=!i._zod.def.abort),o.issues.push(mt(n))}},e(o.value,o)),r);return i}function Gf(e,r){let i=new L({check:"custom",...b(r)});return i._zod.check=e,i}function Zc(e){let r=new L({check:"describe"});return r._zod.onattach=[i=>{let o=G.get(i)??{};G.add(i,{...o,description:e})}],r._zod.check=()=>{},r}function Cc(e){let r=new L({check:"meta"});return r._zod.onattach=[i=>{let o=G.get(i)??{};G.add(i,{...o,...e})}],r._zod.check=()=>{},r}function Ec(e,r){let i=b(r),o=i.truthy??["true","1","yes","on","y","enabled"],t=i.falsy??["false","0","no","off","n","disabled"];i.case!=="sensitive"&&(o=o.map(m=>typeof m=="string"?m.toLowerCase():m),t=t.map(m=>typeof m=="string"?m.toLowerCase():m));let n=new Set(o),a=new Set(t),u=e.Codec??br,s=e.Boolean??yr,c=e.String??Je,l=new c({type:"string",error:i.error}),d=new s({type:"boolean",error:i.error}),f=new u({type:"pipe",in:l,out:d,transform:((m,v)=>{let _=m;return i.case!=="sensitive"&&(_=_.toLowerCase()),n.has(_)?!0:a.has(_)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...n,...a],input:v.value,inst:f,continue:!1}),{})}),reverseTransform:((m,v)=>m===!0?o[0]||"true":t[0]||"false"),error:i.error});return f._zod.bag.truthy=o,f._zod.bag.falsy=t,f._zod.bag.case=i.case??"insensitive",f}function He(e,r,i,o={}){let t=b(o),n={check:"string_format",type:"string",format:r,fn:typeof i=="function"?i:u=>i.test(u),...t};return i instanceof RegExp&&(n.pattern=i),new e(n)}function Ur(e,...r){for(let i of r)for(let o of Reflect.ownKeys(i))Object.prototype.propertyIsEnumerable.call(i,o)&&K(e,o,i[o]);return e}function je(e){let r=e?.target??"draft-2020-12";return r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??G,target:r,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 M(e,r,i,o,t){let n=typeof r.unrepresentable=="function"?r.unrepresentable({zodSchema:e,path:o.path,message:t}):r.unrepresentable;if(n==="any")return!1;if(n===void 0||n==="throw")throw new Error(t);return Object.assign(i,n),!0}function C(e,r,i={path:[],schemaPath:[]}){var o;let t=e._zod.def,n=r.seen.get(e);if(n)return n.count++,i.schemaPath.includes(e)&&(n.cycle=i.path),n.schema;let a={schema:{},count:1,cycle:void 0,path:i.path};r.seen.set(e,a),r.sharedDefsExtractedFor=void 0,r.sharedEmitDoneFor=void 0;let u=e._zod.toJSONSchema?.();if(u)a.schema=u;else{let l={...i,schemaPath:[...i.schemaPath,e],path:i.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(r,a.schema,l);else{let f=a.schema,m=r.processors[t.type];if(!m)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${t.type}`);m(e,r,f,l)}let d=e._zod.parent;d&&(a.ref||(a.ref=d),C(d,r,l),r.seen.get(d).isParent=!0)}let s=r.metadataRegistry.get(e);return s&&Ur(a.schema,s),r.io==="input"&&ee(e)&&(delete a.schema.examples,delete a.schema.default),r.io==="input"&&"_prefault"in a.schema&&((o=a.schema).default??(o.default=a.schema._prefault)),delete a.schema._prefault,r.seen.get(e).schema}function Wf(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Ne(e,r){let i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let o=new Map;for(let a of e.seen.entries()){let u=e.metadataRegistry.get(a[0])?.id;if(u){let s=o.get(u);if(s&&s!==a[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(u,a[0])}}let t=a=>{let u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(a[0])?.id,f=e.external.uri??(v=>v);if(d)return{ref:f(d)};let m=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=m,{defId:m,ref:`${f("__shared")}#/${u}/${Wf(m)}`}}let s="#",c=`${s}/${u}/`;if(a[1]===i&&!a[1].schema.id)return{ref:s};let l=a[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:c+Wf(l)}},n=a=>{if(a[1].schema.$ref)return;let u=a[1],{ref:s,defId:c}=t(a);u.def={...u.schema},c&&(u.defId=c);let l=u.schema;for(let d in l)delete l[d];l.$ref=s};if(e.cycles==="throw")for(let a of e.seen.entries()){let u=a[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
|
|
61
61
|
|
|
62
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let u=a[1];if(r===a[0]){n(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(r!==a[0]&&c){n(a);continue}}if(e.metadataRegistry.get(a[0])?.id){n(a);continue}if(u.cycle){n(a);continue}u.count>1&&e.reused==="ref"&&n(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Hf(e){let r=e.anyOf;if(!Array.isArray(r)||r.length===0||e.type!==void 0)return;let i=[];for(let o of r){if(!o||typeof o!="object")return;Hf(o);let t=Object.keys(o);if(t.length!==1||t[0]!=="type")return;let n=o.type;for(let a of Array.isArray(n)?n:[n]){if(typeof a!="string")return;i.includes(a)||i.push(a)}}delete e.anyOf,e.type=i.length===1?i[0]:i}var Yf=new Set(["type","properties","required","additionalProperties"]),Xf=["oneOf","anyOf"];function qf(e){let r=e.additionalProperties;return r===void 0||r===!1||typeof r!="object"||r===null?null:Object.keys(r).length?r:null}function Lc(e){let r=[];for(let n of e){if(typeof n!="object"||n.type!=="object")return null;for(let a in n)if(!Yf.has(a))return null;r.push(n)}let i={},o=new Set;for(let n of r){for(let a in n.properties){if(Object.prototype.hasOwnProperty.call(i,a))continue;let u=[];for(let c of r){let l=c.properties?.[a]??qf(c);l!=null&&(u.some(d=>JSON.stringify(d)===JSON.stringify(l))||u.push(l))}let s=u.length===1?u[0]:Lc(u)??{allOf:u};K(i,a,s)}for(let a of n.required??[])o.add(a)}let t={type:"object",properties:i};if(o.size&&(t.required=[...o]),r.every(n=>n.additionalProperties===!1))t.additionalProperties=!1;else{let n=[];for(let a of r){let u=qf(a);u&&!n.some(s=>JSON.stringify(s)===JSON.stringify(u))&&n.push(u)}n.length===1?t.additionalProperties=n[0]:n.length>1&&(t.additionalProperties={allOf:n})}return t}function fy(e){let r=e.allOf;if(!Array.isArray(r)||r.length<2)return;for(let t of Yf)if(t in e)return;let i=r.filter(t=>Xf.some(n=>Array.isArray(t[n]))),o=null;if(!i.length)o=Lc(r);else{let t=i[0],n=Xf.find(s=>Array.isArray(t[s]));if(Object.keys(t).length!==1)return;let a=r.filter(s=>s!==t),u=t[n].map(s=>Lc([...a,s]));if(u.some(s=>!s))return;o={[n]:u}}o&&(delete e.allOf,Ur(e,o))}function Ue(e,r){let i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=u=>{let s=e.seen.get(u);if(s.ref===null)return;let c=s.def??s.schema,l={...c},d=s.ref;if(s.ref=null,d){o(d);let m=e.seen.get(d),v=m.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(v)):Ur(c,v),Ur(c,l),u._zod.parent===d)for(let k in c)k==="$ref"||k==="allOf"||k in l||delete c[k];if(v.$ref&&m.def)for(let k in c)k==="$ref"||k==="allOf"||k in m.def&&JSON.stringify(c[k])===JSON.stringify(m.def[k])&&delete c[k]}let f=u._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let v in c)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(c[v])===JSON.stringify(m.def[v])&&delete c[v]}e.override({zodSchema:u,jsonSchema:c,path:s.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let u of[...e.seen.entries()].reverse())o(u[0]);if(e.target!=="openapi-3.0")for(let u of e.seen.entries())Hf(u[1].def??u[1].schema);for(let u of e.deferred)u();if(e.intersections.length){let u=new Map;for(let s of e.seen.values())for(let c of[s.schema,s.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=u.get(l);d?d.push(c):u.set(l,[c])}for(let s of e.intersections)for(let c of u.get(s)??[])fy(c)}}let t={};if(e.target==="draft-2020-12"?t.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?t.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?t.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let u=e.external.registry.get(r)?.id;if(!u)throw new Error("Schema is missing an `id` property");t.$id=e.external.uri(u)}Ur(t,i.defId?i.schema:i.def??i.schema);let n=e.metadataRegistry.get(r)?.id;n!==void 0&&t.id===n&&delete t.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let u of e.seen.entries()){let s=u[1];s.def&&s.defId&&(s.def.id===s.defId&&delete s.def.id,K(a,s.defId,s.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?t.$defs=a:t.definitions=a);try{let u=JSON.parse(JSON.stringify(t));return Object.defineProperty(u,"~standard",{value:{...r["~standard"],jsonSchema:{input:Zt(r,"input",e.processors),output:Zt(r,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function ee(e,r){let i=r??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ee(o.element,i);if(o.type==="set")return ee(o.valueType,i);if(o.type==="lazy")return ee(o.getter(),i);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ee(o.innerType,i);if(o.type==="intersection")return ee(o.left,i)||ee(o.right,i);if(o.type==="record"||o.type==="map")return ee(o.keyType,i)||ee(o.valueType,i);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ee(o.in,i)||ee(o.out,i);if(o.type==="object"){for(let t in o.shape)if(ee(o.shape[t],i))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(ee(t,i))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(ee(t,i))return!0;return!!(o.rest&&ee(o.rest,i))}return!1}var Rc=(e,r={})=>i=>{let o=je({...i,processors:r});return C(e,o),Ne(o,e),Ue(o,e)},Zt=(e,r,i={})=>o=>{let{libraryOptions:t,target:n}=o??{},a=je({...t??{},target:n,io:r,processors:i});return C(e,a),Ne(a,e),Ue(a,e)};var Ct=(e,r,i)=>{(e[r]===void 0||i>e[r])&&(e[r]=i)},Et=(e,r,i)=>{(e[r]===void 0||i<e[r])&&(e[r]=i)},Qf=(e,r)=>{Ct(e,"minimum",r),Et(e,"maximum",r)},nm=(e,r)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(r)||e.multipleOf.push(r)},im=(e,r)=>{e.patterns??(e.patterns=new Set),e.patterns.add(r)},om=(e,r)=>{e.mime=e.mime?e.mime.filter(i=>r.includes(i)):[...r]},am=(e,r)=>{e.format=r,r.includes("int")&&(e.isInt=!0)},em=(e,r)=>Ct(e,"minimum",r.minimum),tm=(e,r)=>Et(e,"maximum",r.maximum),rm=e=>(r,i)=>{am(r,i.format);let[o,t]=e[i.format];Ct(r,"minimum",o),Et(r,"maximum",t)},my={greater_than:(e,r)=>Ct(e,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(e,r)=>Et(e,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(e,r)=>nm(e,r.value),number_format:rm(er),bigint_format:rm(tr),min_length:em,max_length:tm,length_equals:(e,r)=>Qf(e,r.length),min_size:em,max_size:tm,size_equals:(e,r)=>Qf(e,r.size),string_format:(e,r)=>{am(e,r.format),r.pattern&&im(e,r.pattern),(r.format==="base64"||r.format==="base64url")&&(e.contentEncoding=r.format),(r.local||r.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,r)=>om(e,r.mime)};function J(e){let r={},i=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(let n of o)my[n._zod.def.check]?.(r,n._zod.def);let t=e._zod.bag;t.minimum!==void 0&&Ct(r,"minimum",t.minimum),t.exclusiveMinimum!==void 0&&Ct(r,"exclusiveMinimum",t.exclusiveMinimum),t.maximum!==void 0&&Et(r,"maximum",t.maximum),t.exclusiveMaximum!==void 0&&Et(r,"exclusiveMaximum",t.exclusiveMaximum),t.multipleOf!==void 0&&nm(r,t.multipleOf),t.format!==void 0&&(r.format??(r.format=t.format),t.format.includes("int")&&(r.isInt=!0)),t.mime&&om(r,t.mime);for(let n of t.patterns??[])im(r,n);return r}var py={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gy=new Map([[Pn,Ko],[hr,Go]]),um=e=>gy.get(e)??e,Mc=(e,r,i,o)=>{let t=i;t.type="string";let{minimum:n,maximum:a,format:u,patterns:s,contentEncoding:c,laxFormat:l}=J(e);if(typeof n=="number"&&(t.minLength=n),typeof a=="number"&&(t.maxLength=a),u&&(t.format=py[u]??u,t.format===""&&delete t.format,(u==="time"||l)&&delete t.format),c&&(t.contentEncoding=c),s&&s.size>0){let d=[...s].map(um);d.length===1?t.pattern=d[0].source:d.length>1&&(t.allOf=[...d.map(f=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Jc=(e,r,i,o)=>{let t=i,{minimum:n,maximum:a,multipleOf:u,exclusiveMaximum:s,exclusiveMinimum:c,isInt:l}=J(e);t.type=l?"integer":"number";let d=typeof c=="number"&&c>=(n??Number.NEGATIVE_INFINITY),f=typeof s=="number"&&s<=(a??Number.POSITIVE_INFINITY),m=r.target==="draft-04"||r.target==="openapi-3.0";if(d?m?(t.minimum=c,t.exclusiveMinimum=!0):t.exclusiveMinimum=c:typeof n=="number"&&(t.minimum=n),f?m?(t.maximum=s,t.exclusiveMaximum=!0):t.exclusiveMaximum=s:typeof a=="number"&&(t.maximum=a),u){let v=new Set;for(let S of u)Number.isFinite(S)&&S!==0?v.add(Math.abs(S)):M(e,r,t,o,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[_,...k]=v;_!==void 0&&(t.multipleOf=_),k.length&&(t.allOf=[...t.allOf??[],...k.map(S=>({multipleOf:S}))])}},Bc=(e,r,i,o)=>{i.type="boolean"},Kc=(e,r,i,o)=>{M(e,r,i,o,"BigInt cannot be represented in JSON Schema")},Gc=(e,r,i,o)=>{M(e,r,i,o,"Symbols cannot be represented in JSON Schema")},Wc=(e,r,i,o)=>{r.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Xc=(e,r,i,o)=>{M(e,r,i,o,"Undefined cannot be represented in JSON Schema")},qc=(e,r,i,o)=>{M(e,r,i,o,"Void cannot be represented in JSON Schema")},Hc=(e,r,i,o)=>{i.not={}},Yc=(e,r,i,o)=>{},Qc=(e,r,i,o)=>{},es=(e,r,i,o)=>{M(e,r,i,o,"Date cannot be represented in JSON Schema")},ts=(e,r,i,o)=>{let t=e._zod.def,n=ct(t.entries);if(n.length===0){i.not={};return}n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),i.enum=n},rs=(e,r,i,o)=>{let t=e._zod.def;if(t.values.length===0){i.not={};return}let n=[];for(let a of t.values)if(a===void 0){if(M(e,r,i,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(M(e,r,i,o,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(a))}else n.push(a);if(n.length!==0)if(n.length===1){let a=n[0];i.type=a===null?"null":typeof a,r.target==="draft-04"||r.target==="openapi-3.0"?i.enum=[a]:i.const=a}else n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),n.every(a=>typeof a=="boolean")&&(i.type="boolean"),n.every(a=>a===null)&&(i.type="null"),i.enum=n},ns=(e,r,i,o)=>{M(e,r,i,o,"NaN cannot be represented in JSON Schema")},is=(e,r,i,o)=>{let t=i,n=e._zod.pattern;if(!n)throw new Error("Pattern not found in template literal");t.type="string",t.pattern=n.source},os=(e,r,i,o)=>{let t=i;t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:n,maximum:a,mime:u}=J(e);n!==void 0&&(t.minLength=n),a!==void 0&&(t.maxLength=a),u&&(u.length===0?t.not={}:u.length===1?t.contentMediaType=u[0]:t.anyOf=u.map(s=>({contentMediaType:s})))},as=(e,r,i,o)=>{i.type="boolean"},us=(e,r,i,o)=>{M(e,r,i,o,"Custom types cannot be represented in JSON Schema")},cs=(e,r,i,o)=>{M(e,r,i,o,"Function types cannot be represented in JSON Schema")},ss=(e,r,i,o)=>{M(e,r,i,o,"Transforms cannot be represented in JSON Schema")},ls=(e,r,i,o)=>{M(e,r,i,o,"Map cannot be represented in JSON Schema")},ds=(e,r,i,o)=>{M(e,r,i,o,"Set cannot be represented in JSON Schema")},fs=(e,r,i,o)=>{let t=i,n=e._zod.def,{minimum:a,maximum:u}=J(e);typeof a=="number"&&(t.minItems=a),typeof u=="number"&&(t.maxItems=u),t.type="array",t.items=C(n.element,r,{...o,path:[...o.path,"items"]})};function Ar(e){let r=e._zod.def;return r.type==="pipe"&&r.in._zod.traits.has("$ZodTransform")?Ar(r.out):r.type==="catch"?Ar(r.innerType):e._zod.optin}var ms=(e,r,i,o)=>{let t=i,n=e._zod.def,a=n.shape;if(Object.getOwnPropertySymbols(a).length&&M(e,r,t,o,"Symbol keys cannot be represented in JSON Schema"))return;t.type="object",t.properties={};for(let c in a)K(t.properties,c,C(a[c],r,{...o,path:[...o.path,"properties",c]}));let s=[];for(let c of Object.keys(a)){let l=n.shape[c];(r.io==="input"?Ar(l)===void 0:l._zod.optout===void 0)&&s.push(c)}s.length>0&&(t.required=s),n.catchall?._zod.def.type==="never"?t.additionalProperties=!1:n.catchall?n.catchall&&(t.additionalProperties=C(n.catchall,r,{...o,path:[...o.path,"additionalProperties"]})):r.io==="output"&&(t.additionalProperties=!1)},wi=(e,r,i,o)=>{let t=e._zod.def,n=t.inclusive===!1,a=t.options.map((u,s)=>C(u,r,{...o,path:[...o.path,n?"oneOf":"anyOf",s]}));n?i.oneOf=a:i.anyOf=a},ps=(e,r,i,o)=>{let t=e._zod.def,n=C(t.left,r,{...o,path:[...o.path,"allOf",0]}),a=C(t.right,r,{...o,path:[...o.path,"allOf",1]}),u=c=>"allOf"in c&&Object.keys(c).length===1,s=[...u(n)?n.allOf:[n],...u(a)?a.allOf:[a]];i.allOf=s,r.intersections.push(s)},gs=(e,r,i,o)=>{let t=i,n=e._zod.def;t.type="array";let a=r.target==="draft-2020-12"?"prefixItems":"items",u=r.target==="draft-2020-12"||r.target==="openapi-3.0"?"items":"additionalItems",s=n.items.map((_,k)=>C(_,r,{...o,path:[...o.path,a,k]})),c=n.rest?C(n.rest,r,{...o,path:[...o.path,u,...r.target==="openapi-3.0"?[n.items.length]:[]]}):null,l=n.items.length;for(;l>0;){let _=n.items[l-1];if(!(r.io==="input"?Ar(_)!==void 0:_._zod.optout==="optional"))break;l--}let d=n.items.length,f=!n.rest;r.target==="draft-2020-12"?(t.prefixItems=s,f?t.items=!1:c&&(t.items=c),l>0&&(t.minItems=l),f&&(t.maxItems=d)):r.target==="openapi-3.0"?(t.items={anyOf:s},c&&t.items.anyOf.push(c),l>0&&(t.minItems=l),f&&(t.maxItems=d)):(t.items=s,f?t.additionalItems=!1:c&&(t.additionalItems=c),l>0&&(t.minItems=l),f&&(t.maxItems=d));let{minimum:m,maximum:v}=J(e);typeof m=="number"&&(t.minItems=m),typeof v=="number"&&(t.maxItems=v)};function Vc(e,r,i){if(r.$ref){if(i.has(r))return r;i.add(r);let v=e.get(r)?.def;if(!v)return r;let _=Vc(e,v,i);return _===v?r:_}for(let v of["anyOf","oneOf"]){let _=r[v];if(!Array.isArray(_))continue;let k=_.map(S=>Vc(e,S,i));k.some((S,I)=>S!==_[I])&&(r={...r,[v]:k})}let o=Array.isArray(r.type)?r.type:[r.type],t=!o.includes("string")&&o.some(v=>v==="number"||v==="integer"),n=r.enum??(r.const!==void 0?[r.const]:void 0);if(!t&&!n?.some(v=>typeof v=="number"))return r;let{minimum:a,maximum:u,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,format:d,id:f,...m}=r;return m.enum?m.enum=m.enum.map(v=>typeof v=="number"?String(v):v):typeof m.const=="number"&&(m.const=String(m.const)),t&&(m.type="string",n||(m.pattern=(o.includes("number")?ke:dr).source)),m}var Fc=new WeakMap;function vy(e){let r=new Map;for(let o of e.seen.values())o.def&&!r.has(o.schema)&&r.set(o.schema,o);let i=new Map;for(let o of Fc.get(e)??[]){let t=e.seen.get(o),n=(t?.def??t?.schema)?.propertyNames;if(!n||n===!0||i.has(n))continue;let a=Vc(r,n,new Set);a!==n&&i.set(n,a)}if(i.size)for(let o of e.seen.values())for(let t of[o.schema,o.def]){let n=t&&i.get(t.propertyNames);n&&(t.propertyNames=n)}}var vs=(e,r,i,o)=>{let t=i,n=e._zod.def;t.type="object";let a=n.keyType,u=J(a).patterns;if(n.mode==="loose"&&u&&u.size>0){let l=C(n.valueType,r,{...o,path:[...o.path,"patternProperties","*"]});t.patternProperties={};for(let d of u)K(t.patternProperties,um(d).source,l)}else{if(r.target==="draft-07"||r.target==="draft-2020-12"){t.propertyNames=C(n.keyType,r,{...o,path:[...o.path,"propertyNames"]});let l=Fc.get(r);l||(l=[],Fc.set(r,l),r.deferred.push(()=>vy(r))),l.push(e)}t.additionalProperties=C(n.valueType,r,{...o,path:[...o.path,"additionalProperties"]})}let s=a._zod.values,c=r.io==="input"&&Ar(n.valueType)!==void 0;if(s&&!n.partial&&!c){let l=[...s].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(t.required=l.map(String))}},$s=(e,r,i,o)=>{let t=e._zod.def,n=C(t.innerType,r,o),a=r.seen.get(e);r.target==="openapi-3.0"?(a.ref=t.innerType,i.nullable=!0):i.anyOf=[n,{type:"null"}]},hs=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},ys=Symbol();function cm(e,r,i,o,t){let n=!1,a=JSON.stringify(e,(u,s)=>typeof s!="bigint"?s:(n=!0,null));return n?(M(r,i,o,t,"BigInt defaults cannot be represented in JSON Schema"),ys):JSON.parse(a)}var _s=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a=cm(t.defaultValue,e,r,i,o);a!==ys&&(i.default=a)},bs=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);if(n.ref=t.innerType,r.io!=="input")return;let a=cm(t.defaultValue,e,r,i,o);a!==ys&&(i._prefault=a)},ks=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a;try{a=t.catchValue(void 0)}catch{M(e,r,i,o,"Dynamic catch values are not supported in JSON Schema");return}i.default=a},xs=(e,r,i,o)=>{let t=e._zod.def,n=t.in._zod.traits.has("$ZodTransform"),a=r.io==="input"?n?t.out:t.in:t.out;C(a,r,o);let u=r.seen.get(e);u.ref=a},Is=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType,i.readOnly=!0},ws=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},Si=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},Ss=(e,r,i,o)=>{let t=e._zod.innerType;C(t,r,o);let n=r.seen.get(e);n.ref=t},Ii={string:Mc,number:Jc,boolean:Bc,bigint:Kc,symbol:Gc,null:Wc,undefined:Xc,void:qc,never:Hc,any:Yc,unknown:Qc,date:es,enum:ts,literal:rs,nan:ns,template_literal:is,file:os,success:as,custom:us,function:cs,transform:ss,map:ls,set:ds,array:fs,object:ms,union:wi,intersection:ps,tuple:gs,record:vs,nullable:$s,nonoptional:hs,default:_s,prefault:bs,catch:ks,pipe:xs,readonly:Is,promise:ws,optional:Si,lazy:Ss};function zi(e,r){if("_idmap"in e){let o=e,t=je({...r,processors:Ii}),n={};for(let s of o._idmap.entries()){let[c,l]=s;C(l,t)}let a={},u={registry:o,uri:r?.uri,defs:n};t.external=u;for(let s of o._idmap.entries()){let[c,l]=s;Ne(t,l),K(a,c,Ue(t,l))}if(Object.keys(n).length>0){let s=t.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:n}}return{schemas:a}}let i=je({...r,processors:Ii});return C(e,i),Ne(i,e),Ue(i,e)}var Pi=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(r){this.ctx.counter=r}get seen(){return this.ctx.seen}constructor(r){let i=r?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=je({processors:Ii,target:i,...r?.metadata&&{metadata:r.metadata},...r?.unrepresentable&&{unrepresentable:r.unrepresentable},...r?.override&&{override:r.override},...r?.io&&{io:r.io}})}process(r,i={path:[],schemaPath:[]}){return C(r,this.ctx,i)}emit(r,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ne(this.ctx,r);let o=Ue(this.ctx,r),{"~standard":t,...n}=o;return n}};var sm={};var Kt={};ge(Kt,{ZodAny:()=>Ws,ZodArray:()=>Ys,ZodBase64:()=>Gi,ZodBase64URL:()=>Wi,ZodBigInt:()=>Jt,ZodBigIntFormat:()=>Hi,ZodBoolean:()=>Mt,ZodCIDRv4:()=>Bi,ZodCIDRv6:()=>Ki,ZodCUID:()=>Ei,ZodCUID2:()=>Li,ZodCatch:()=>yl,ZodCodec:()=>Jr,ZodCreditCard:()=>Rs,ZodCustom:()=>Br,ZodCustomStringFormat:()=>tt,ZodDate:()=>Er,ZodDefault:()=>ml,ZodDiscriminatedUnion:()=>el,ZodE164:()=>Xi,ZodEmail:()=>Ai,ZodEmoji:()=>Zi,ZodEnum:()=>Rt,ZodExactOptional:()=>to,ZodFile:()=>sl,ZodFunction:()=>Dl,ZodGUID:()=>Ti,ZodIBAN:()=>Vs,ZodIPv4:()=>Mi,ZodIPv6:()=>Ji,ZodISODate:()=>Te,ZodISODateTime:()=>Ae,ZodISODuration:()=>Ce,ZodISOTime:()=>Ze,ZodInstanceOf:()=>Nl,ZodIntersection:()=>tl,ZodJWT:()=>qi,ZodKSUID:()=>Fi,ZodLazy:()=>Sl,ZodLiteral:()=>cl,ZodMAC:()=>Ls,ZodMap:()=>al,ZodNaN:()=>bl,ZodNanoID:()=>Ci,ZodNever:()=>qs,ZodNonOptional:()=>ro,ZodNull:()=>Ks,ZodNullable:()=>fl,ZodNumber:()=>Ft,ZodNumberFormat:()=>rt,ZodObject:()=>Rr,ZodOptional:()=>Fr,ZodPipe:()=>Mr,ZodPrefault:()=>gl,ZodPreprocess:()=>kl,ZodPromise:()=>Pl,ZodReadonly:()=>xl,ZodRecord:()=>Lt,ZodSet:()=>ul,ZodString:()=>Vt,ZodStringFormat:()=>E,ZodSuccess:()=>hl,ZodSymbol:()=>Js,ZodTemplateLiteral:()=>wl,ZodTransform:()=>ll,ZodTuple:()=>nl,ZodType:()=>O,ZodULID:()=>Ri,ZodURL:()=>Cr,ZodUUID:()=>ye,ZodUndefined:()=>Bs,ZodUnion:()=>Vr,ZodUnknown:()=>Xs,ZodVoid:()=>Hs,ZodXID:()=>Vi,ZodXor:()=>Qs,_ZodString:()=>Ui,_default:()=>pl,_function:()=>bp,any:()=>Ym,array:()=>Lr,base64:()=>Nm,base64url:()=>Um,bigint:()=>Gm,boolean:()=>Ms,catch:()=>_l,check:()=>kp,cidrv4:()=>Om,cidrv6:()=>jm,codec:()=>$p,creditCard:()=>Tm,cuid:()=>km,cuid2:()=>xm,currencyCode:()=>Vm,custom:()=>xp,date:()=>ep,describe:()=>Ip,discriminatedUnion:()=>ap,e164:()=>Am,email:()=>fm,emoji:()=>_m,enum:()=>Qi,exactOptional:()=>dl,file:()=>mp,float32:()=>Mm,float64:()=>Jm,function:()=>bp,guid:()=>mm,hash:()=>Fm,hex:()=>Rm,hostname:()=>Lm,httpUrl:()=>ym,iban:()=>Zm,instanceof:()=>Sp,int:()=>ji,int32:()=>Bm,int64:()=>Wm,intersection:()=>rl,invertCodec:()=>hp,ipv4:()=>zm,ipv6:()=>Dm,json:()=>Pp,jwt:()=>Cm,keyof:()=>tp,ksuid:()=>Sm,lazy:()=>zl,literal:()=>fp,looseObject:()=>ip,looseRecord:()=>cp,mac:()=>Pm,map:()=>sp,meta:()=>wp,nan:()=>vp,nanoid:()=>bm,nativeEnum:()=>dp,never:()=>Yi,nonoptional:()=>$l,null:()=>Gs,nullable:()=>Zr,nullish:()=>pp,number:()=>Fs,object:()=>rp,optional:()=>Qe,partialRecord:()=>up,pipe:()=>Ni,prefault:()=>vl,preprocess:()=>Dp,promise:()=>_p,readonly:()=>Il,record:()=>ol,refine:()=>Ol,set:()=>lp,strictObject:()=>np,string:()=>Tr,stringFormat:()=>Em,stringbool:()=>zp,success:()=>gp,superRefine:()=>jl,symbol:()=>qm,templateLiteral:()=>yp,transform:()=>eo,tuple:()=>il,uint32:()=>Km,uint64:()=>Xm,ulid:()=>Im,undefined:()=>Hm,union:()=>Bt,unknown:()=>Ye,url:()=>hm,uuid:()=>pm,uuidv4:()=>gm,uuidv6:()=>vm,uuidv7:()=>$m,void:()=>Qm,xid:()=>wm,xor:()=>op});var Di={};ge(Di,{endsWith:()=>Pt,gt:()=>$e,gte:()=>ce,includes:()=>St,length:()=>qe,lowercase:()=>It,lt:()=>ve,lte:()=>ue,maxLength:()=>Xe,maxSize:()=>Oe,mime:()=>Ot,minLength:()=>xe,minSize:()=>he,multipleOf:()=>De,negative:()=>_i,nonnegative:()=>ki,nonpositive:()=>bi,normalize:()=>jt,overwrite:()=>pe,positive:()=>yi,properties:()=>Dt,property:()=>xi,regex:()=>xt,size:()=>We,slugify:()=>Tt,startsWith:()=>zt,toLowerCase:()=>Ut,toUpperCase:()=>At,trim:()=>Nt,uppercase:()=>wt});var lm=new WeakSet([Object.prototype,Error.prototype]);function Oi(e,r,i){Object.defineProperty(e,r,{configurable:!0,enumerable:!1,get(){let o=i(this);return Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0})}})}var dm=(e,r)=>{So.init(e,r),e.name="ZodError";let i=Object.getPrototypeOf(e);lm.has(i)||(lm.add(i),Oi(i,"format",o=>t=>ur(o,t)),Oi(i,"flatten",o=>t=>ar(o,t)),Oi(i,"addIssue",o=>t=>{o.issues.push(t),o.message=JSON.stringify(o.issues,st,2)}),Oi(i,"addIssues",o=>t=>{o.issues.push(...t),o.message=JSON.stringify(o.issues,st,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},hy=p("ZodError",dm),ae=p("ZodError",dm,void 0,{Parent:Error});var zs=pt(ae),Ps=gt(ae),Ds=vt(ae),Os=$t(ae),js=on(ae),Ns=an(ae),Us=un(ae),As=cn(ae),Ts=sn(ae),Zs=ln(ae),Cs=dn(ae),Es=fn(ae);function _y(){B.localeError||F(Jn())}function et(){B.memoizer||F({memoizer:wr()})}var O=p("ZodType",(e,r)=>(_y(),P.init(e,r),e.def=r,e.type=r.type,e),{check(...e){let r=this.def;return this.clone($.mergeDefs(r,{checks:[...r.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,r){return T(this,e,r)},brand(){return this},register(e,r){return e.add(this,r),this},refine(e,r){return this.check(Ol(e,r))},superRefine(e,r){return this.check(jl(e,r))},overwrite(e){return this.check(pe(e))},optional(){return Qe(this)},exactOptional(){return dl(this)},nullable(){return Zr(this)},nullish(){return Qe(Zr(this))},nonoptional(e){return $l(this,e)},array(){return Lr(this)},or(e){return Bt([this,e])},and(e){return rl(this,e)},transform(e){return Ni(this,eo(e))},default(e){return pl(this,e)},prefault(e){return vl(this,e)},catch(e){return _l(this,e)},pipe(e){return Ni(this,e)},readonly(){return Il(this)},describe(e){let r=this.clone();return G.add(r,{description:e}),r},meta(...e){if(e.length===0)return G.get(this);let r=this.clone();return G.add(r,e[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...r){return r.length===0?e(this):e(this,...r)},get"~standard"(){return $.hide(this,"~standard",{...xn(this),jsonSchema:{input:Zt(this,"input"),output:Zt(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(r,i){return zs(this,r,i,{callee:e})},parseAsync:async function e(r,i){return await Ps(this,r,i,{callee:e})},safeParse(e,r){return Ds(this,e,r)},async safeParseAsync(e,r){return Os(this,e,r)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,r){return cr(this,e,r)},validateAsync(e,r){return sr(this,e,r)},encode:function e(r,i){return js(this,r,i,{callee:e})},decode:function e(r,i){return Ns(this,r,i,{callee:e})},encodeAsync:async function e(r,i){return await Us(this,r,i,{callee:e})},decodeAsync:async function e(r,i){return await As(this,r,i,{callee:e})},safeEncode(e,r){return Ts(this,e,r)},safeDecode(e,r){return Zs(this,e,r)},async safeEncodeAsync(e,r){return Cs(this,e,r)},async safeDecodeAsync(e,r){return Es(this,e,r)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),Ui=p("_ZodString",(e,r)=>{Je.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Mc(e,i,o,t)},$.derived({format:e=>J(e).format??null,minLength:e=>J(e).minimum??null,maxLength:e=>J(e).maximum??null},{regex(...e){return this.check(xt(...e))},includes(...e){return this.check(St(...e))},startsWith(...e){return this.check(zt(...e))},endsWith(...e){return this.check(Pt(...e))},min(...e){return this.check(xe(...e))},max(...e){return this.check(Xe(...e))},length(...e){return this.check(qe(...e))},nonempty(...e){return this.check(xe(1,...e))},lowercase(e){return this.check(It(e))},uppercase(e){return this.check(wt(e))},trim(){return this.check(Nt())},normalize(...e){return this.check(jt(...e))},toLowerCase(){return this.check(Ut())},toUpperCase(){return this.check(At())},slugify(){return this.check(Tt())}})),Vt=p("ZodString",(e,r)=>{Je.init(e,r),Ui.init(e,r)},{email(e){return this.check(Yn(Ai,e))},url(e){return this.check(Pr(Cr,e))},jwt(e){return this.check(hi(qi,e))},emoji(e){return this.check(ii(Zi,e))},guid(e){return this.check(Qn(Ti,e))},uuid(e){return this.check(ei(ye,e))},uuidv4(e){return this.check(ti(ye,e))},uuidv6(e){return this.check(ri(ye,e))},uuidv7(e){return this.check(ni(ye,e))},nanoid(e){return this.check(oi(Ci,e))},cuid(e){return this.check(ai(Ei,e))},cuid2(e){return this.check(ui(Li,e))},ulid(e){return this.check(ci(Ri,e))},base64(e){return this.check(gi(Gi,e))},base64url(e){return this.check(vi(Wi,e))},xid(e){return this.check(si(Vi,e))},ksuid(e){return this.check(li(Fi,e))},ipv4(e){return this.check(di(Mi,e))},ipv6(e){return this.check(fi(Ji,e))},cidrv4(e){return this.check(mi(Bi,e))},cidrv6(e){return this.check(pi(Ki,e))},e164(e){return this.check($i(Xi,e))},datetime(e){return this.check(Dr(Ae,e))},date(e){return this.check(Or(Te,e))},time(e){return this.check(jr(Ze,e))},duration(e){return this.check(Nr(Ce,e))}});function Tr(e){return rc(Vt,e)}var E=p("ZodStringFormat",(e,r)=>{Z.init(e,r),Ui.init(e,r)}),Ae=p("ZodISODateTime",(e,r)=>{Ka.init(e,r),E.init(e,r)}),Te=p("ZodISODate",(e,r)=>{Ga.init(e,r),E.init(e,r)}),Ze=p("ZodISOTime",(e,r)=>{Wa.init(e,r),E.init(e,r)}),Ce=p("ZodISODuration",(e,r)=>{Xa.init(e,r),E.init(e,r)}),Ai=p("ZodEmail",(e,r)=>{Ta.init(e,r),E.init(e,r)});function fm(e){return Yn(Ai,e)}var Ti=p("ZodGUID",(e,r)=>{Ua.init(e,r),E.init(e,r)});function mm(e){return Qn(Ti,e)}var ye=p("ZodUUID",(e,r)=>{Aa.init(e,r),E.init(e,r)});function pm(e){return ei(ye,e)}function gm(e){return ti(ye,e)}function vm(e){return ri(ye,e)}function $m(e){return ni(ye,e)}var Cr=p("ZodURL",(e,r)=>{Ea.init(e,r),E.init(e,r)});function hm(e){return Pr(Cr,e)}function ym(e){return Pr(Cr,{protocol:lr,hostname:Xo,...$.normalizeParams(e)})}var Zi=p("ZodEmoji",(e,r)=>{La.init(e,r),E.init(e,r)});function _m(e){return ii(Zi,e)}var Ci=p("ZodNanoID",(e,r)=>{Ra.init(e,r),E.init(e,r)});function bm(e){return oi(Ci,e)}var Ei=p("ZodCUID",(e,r)=>{Va.init(e,r),E.init(e,r)});function km(e){return ai(Ei,e)}var Li=p("ZodCUID2",(e,r)=>{Fa.init(e,r),E.init(e,r)});function xm(e){return ui(Li,e)}var Ri=p("ZodULID",(e,r)=>{Ma.init(e,r),E.init(e,r)});function Im(e){return ci(Ri,e)}var Vi=p("ZodXID",(e,r)=>{Ja.init(e,r),E.init(e,r)});function wm(e){return si(Vi,e)}var Fi=p("ZodKSUID",(e,r)=>{Ba.init(e,r),E.init(e,r)});function Sm(e){return li(Fi,e)}var Mi=p("ZodIPv4",(e,r)=>{qa.init(e,r),E.init(e,r)});function zm(e){return di(Mi,e)}var Ls=p("ZodMAC",(e,r)=>{Ya.init(e,r),E.init(e,r)});function Pm(e){return ic(Ls,e)}var Ji=p("ZodIPv6",(e,r)=>{Ha.init(e,r),E.init(e,r)});function Dm(e){return fi(Ji,e)}var Bi=p("ZodCIDRv4",(e,r)=>{Qa.init(e,r),E.init(e,r)});function Om(e){return mi(Bi,e)}var Ki=p("ZodCIDRv6",(e,r)=>{eu.init(e,r),E.init(e,r)});function jm(e){return pi(Ki,e)}var Gi=p("ZodBase64",(e,r)=>{tu.init(e,r),E.init(e,r)});function Nm(e){return gi(Gi,e)}var Wi=p("ZodBase64URL",(e,r)=>{ru.init(e,r),E.init(e,r)});function Um(e){return vi(Wi,e)}var Xi=p("ZodE164",(e,r)=>{nu.init(e,r),E.init(e,r)});function Am(e){return $i(Xi,e)}var Rs=p("ZodCreditCard",(e,r)=>{iu.init(e,r),E.init(e,r)});function Tm(e){return oc(Rs,e)}var Vs=p("ZodIBAN",(e,r)=>{ou.init(e,r),E.init(e,r)});function Zm(e){return ac(Vs,e)}var qi=p("ZodJWT",(e,r)=>{au.init(e,r),E.init(e,r)});function Cm(e){return hi(qi,e)}var tt=p("ZodCustomStringFormat",(e,r)=>{uu.init(e,r),E.init(e,r)});function Em(e,r,i={}){return He(tt,e,r,i)}function Lm(e){return He(tt,"hostname",Wo,e)}function Rm(e){return He(tt,"hex",sa,e)}function Vm(e){return He(tt,"currency_code",Ho,e)}function Fm(e,r){let i=r?.enc??"hex",o=`${e}_${i}`,t=de[o];if(!t)throw new Error(`Unrecognized hash format: ${o}`);return He(tt,o,t,r)}var Ft=p("ZodNumber",(e,r)=>{Un.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Jc(e,i,o,t),e.isFinite=!0},$.derived({minValue:e=>{let{minimum:r,exclusiveMinimum:i}=J(e);return Math.max(r??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:r,exclusiveMaximum:i}=J(e);return Math.min(r??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:r,multipleOf:i}=J(e);return!!r||!!i?.some(Number.isSafeInteger)},format:e=>J(e).format??null},{gt(e,r){return this.check($e(e,r))},gte(e,r){return this.check(ce(e,r))},min(e,r){return this.check(ce(e,r))},lt(e,r){return this.check(ve(e,r))},lte(e,r){return this.check(ue(e,r))},max(e,r){return this.check(ue(e,r))},int(e){return this.check(ji(e))},safe(e){return this.check(ji(e))},positive(e){return this.check($e(0,e))},nonnegative(e){return this.check(ce(0,e))},negative(e){return this.check(ve(0,e))},nonpositive(e){return this.check(ue(0,e))},multipleOf(e,r){return this.check(De(e,r))},step(e,r){return this.check(De(e,r))},finite(){return this}}));function Fs(e){return cc(Ft,e)}var rt=p("ZodNumberFormat",(e,r)=>{cu.init(e,r),Ft.init(e,r)});function ji(e){return lc(rt,e)}function Mm(e){return dc(rt,e)}function Jm(e){return fc(rt,e)}function Bm(e){return mc(rt,e)}function Km(e){return pc(rt,e)}var Mt=p("ZodBoolean",(e,r)=>{yr.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Bc(e,i,o,t)});function Ms(e){return gc(Mt,e)}var Jt=p("ZodBigInt",(e,r)=>{An.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Kc(e,i,o,t)},$.derived({minValue:e=>J(e).minimum??null,maxValue:e=>J(e).maximum??null,format:e=>J(e).format??null},{gte(e,r){return this.check(ce(e,r))},min(e,r){return this.check(ce(e,r))},gt(e,r){return this.check($e(e,r))},lt(e,r){return this.check(ve(e,r))},lte(e,r){return this.check(ue(e,r))},max(e,r){return this.check(ue(e,r))},positive(e){return this.check($e(BigInt(0),e))},negative(e){return this.check(ve(BigInt(0),e))},nonpositive(e){return this.check(ue(BigInt(0),e))},nonnegative(e){return this.check(ce(BigInt(0),e))},multipleOf(e,r){return this.check(De(e,r))}}));function Gm(e){return $c(Jt,e)}var Hi=p("ZodBigIntFormat",(e,r)=>{su.init(e,r),Jt.init(e,r)});function Wm(e){return yc(Hi,e)}function Xm(e){return _c(Hi,e)}var Js=p("ZodSymbol",(e,r)=>{lu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Gc(e,i,o,t)});function qm(e){return bc(Js,e)}var Bs=p("ZodUndefined",(e,r)=>{du.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Xc(e,i,o,t)});function Hm(e){return kc(Bs,e)}var Ks=p("ZodNull",(e,r)=>{fu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Wc(e,i,o,t)});function Gs(e){return xc(Ks,e)}var Ws=p("ZodAny",(e,r)=>{mu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Yc(e,i,o,t)});function Ym(){return Ic(Ws)}var Xs=p("ZodUnknown",(e,r)=>{pu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Qc(e,i,o,t)});function Ye(){return wc(Xs)}var qs=p("ZodNever",(e,r)=>{gu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Hc(e,i,o,t)});function Yi(e){return Sc(qs,e)}var Hs=p("ZodVoid",(e,r)=>{vu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>qc(e,i,o,t)});function Qm(e){return zc(Hs,e)}var Er=p("ZodDate",(e,r)=>{$u.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>es(e,i,o,t),e.min=(i,o)=>e.check(ce(i,o)),e.max=(i,o)=>e.check(ue(i,o))},$.derived({minDate:e=>{let{minimum:r}=J(e);return r?new Date(r):null},maxDate:e=>{let{maximum:r}=J(e);return r?new Date(r):null}},{}));function ep(e){return Pc(Er,e)}var Ys=p("ZodArray",(e,r)=>{et(),yu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>fs(e,i,o,t),e.element=r.element},{min(e,r){return this.check(xe(e,r))},nonempty(e){return this.check(xe(1,e))},max(e,r){return this.check(Xe(e,r))},length(e,r){return this.check(qe(e,r))},unwrap(){return this.element}});function Lr(e,r){return jc(Ys,e,r)}function tp(e){let r=e._zod.def.shape;return Qi(Object.keys(r))}var Rr=p("ZodObject",(e,r)=>{et(),_u.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ms(e,i,o,t),$.installLazyProp(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return Qi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:Ye()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:Ye()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:Yi()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(Fr,this,e[0])},exactPartial(...e){return $.partial(to,this,e[0],"exactPartial")},required(...e){return $.required(ro,this,e[0])}});function rp(e,r){let i={type:"object",shape:e??{},...$.normalizeParams(r)};return new Rr(i)}function np(e,r){return new Rr({type:"object",shape:e,catchall:Yi(),...$.normalizeParams(r)})}function ip(e,r){return new Rr({type:"object",shape:e,catchall:Ye(),...$.normalizeParams(r)})}var Vr=p("ZodUnion",(e,r)=>{_r.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>wi(e,i,o,t),e.options=r.options});function Bt(e,r){return new Vr({type:"union",options:e,...$.normalizeParams(r)})}var Qs=p("ZodXor",(e,r)=>{Vr.init(e,r),bu.init(e,r),e._zod.processJSONSchema=(i,o,t)=>wi(e,i,o,t),e.options=r.options});function op(e,r){return new Qs({type:"union",options:e,inclusive:!1,...$.normalizeParams(r)})}var el=p("ZodDiscriminatedUnion",(e,r)=>{Vr.init(e,r),xu.init(e,r)});function ap(e,r,i){return new el({type:"union",options:r,discriminator:e,...$.normalizeParams(i)})}var tl=p("ZodIntersection",(e,r)=>{Iu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ps(e,i,o,t)});function rl(e,r){return new tl({type:"intersection",left:e,right:r})}var nl=p("ZodTuple",(e,r)=>{et(),Tn.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>gs(e,i,o,t)},{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(r=>new Fr({type:"optional",innerType:r}))})}});function il(e,r,i){let o=r instanceof P,t=o?i:r,n=o?r:null;return new nl({type:"tuple",items:e,rest:n,...$.normalizeParams(t)})}var Lt=p("ZodRecord",(e,r)=>{et(),wu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>vs(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType});function ol(e,r,i){return!r||!r._zod?new Lt({type:"record",keyType:Tr(),valueType:e,...$.normalizeParams(r)}):new Lt({type:"record",keyType:e,valueType:r,...$.normalizeParams(i)})}function up(e,r,i){return new Lt({type:"record",keyType:e,valueType:r,...$.normalizeParams(i),partial:!0})}function cp(e,r,i){return new Lt({type:"record",keyType:e,valueType:r,mode:"loose",...$.normalizeParams(i)})}var al=p("ZodMap",(e,r)=>{et(),Su.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ls(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType,e.min=(...i)=>e.check(he(...i)),e.nonempty=i=>e.check(he(1,i)),e.max=(...i)=>e.check(Oe(...i)),e.size=(...i)=>e.check(We(...i))});function sp(e,r,i){return new al({type:"map",keyType:e,valueType:r,...$.normalizeParams(i)})}var ul=p("ZodSet",(e,r)=>{et(),zu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ds(e,i,o,t),e.min=(...i)=>e.check(he(...i)),e.nonempty=i=>e.check(he(1,i)),e.max=(...i)=>e.check(Oe(...i)),e.size=(...i)=>e.check(We(...i))});function lp(e,r){return new ul({type:"set",valueType:e,...$.normalizeParams(r)})}var Rt=p("ZodEnum",(e,r)=>{Pu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(o,t,n)=>ts(e,o,t,n),e.enum=r.entries,e.options=[...e._zod.values];let i=new Set(Object.keys(r.entries));e.extract=(o,t)=>{let n={};for(let a of o)if(i.has(a))n[a]=r.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Rt({...r,checks:[],...$.normalizeParams(t),entries:n})},e.exclude=(o,t)=>{let n={...r.entries};for(let a of o)if(i.has(a))delete n[a];else throw new Error(`Key ${a} not found in enum`);return new Rt({...r,checks:[],...$.normalizeParams(t),entries:n})}});function Qi(e,r){let i=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Rt({type:"enum",entries:i,...$.normalizeParams(r)})}function dp(e,r){return new Rt({type:"enum",entries:e,...$.normalizeParams(r)})}var cl=p("ZodLiteral",(e,r)=>{Du.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>rs(e,i,o,t),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function fp(e,r){return new cl({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(r)})}var sl=p("ZodFile",(e,r)=>{Ou.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>os(e,i,o,t),e.min=(i,o)=>e.check(he(i,o)),e.max=(i,o)=>e.check(Oe(i,o)),e.mime=(i,o)=>e.check(Ot(Array.isArray(i)?i:[i],o))});function mp(e){return Nc(sl,e)}var ll=p("ZodTransform",(e,r)=>{et(),ju.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ss(e,i,o,t),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new ze(e.constructor.name);i.addIssue=n=>{if(typeof n=="string")i.issues.push($.issue(n,i.value,r));else{let a=n;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=e),i.issues.push($.issue(a))}};let t=r.transform(i.value,i);return t instanceof Promise?t.then(n=>(i.value=n,i)):(i.value=t,i)}});function eo(e){return new ll({type:"transform",transform:e})}var Fr=p("ZodOptional",(e,r)=>{Zn.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Si(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Qe(e){return new Fr({type:"optional",innerType:e})}var to=p("ZodExactOptional",(e,r)=>{Nu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Si(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function dl(e){return new to({type:"optional",innerType:e})}var fl=p("ZodNullable",(e,r)=>{Uu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>$s(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Zr(e){return new fl({type:"nullable",innerType:e})}function pp(e){return Qe(Zr(e))}var ml=p("ZodDefault",(e,r)=>{Au.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>_s(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pl(e,r){return new ml({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}var gl=p("ZodPrefault",(e,r)=>{Tu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>bs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function vl(e,r){return new gl({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}var ro=p("ZodNonOptional",(e,r)=>{Zu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>hs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function $l(e,r){return new ro({type:"nonoptional",innerType:e,...$.normalizeParams(r)})}var hl=p("ZodSuccess",(e,r)=>{Cu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>as(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function gp(e){return new hl({type:"success",innerType:e})}var yl=p("ZodCatch",(e,r)=>{Eu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ks(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _l(e,r){return new yl({type:"catch",innerType:e,catchValue:typeof r=="function"?r:$.constantCatch(r)})}var bl=p("ZodNaN",(e,r)=>{Lu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ns(e,i,o,t)});function vp(e){return Oc(bl,e)}var Mr=p("ZodPipe",(e,r)=>{Cn.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>xs(e,i,o,t),e.in=r.in,e.out=r.out});function Ni(e,r){return new Mr({type:"pipe",in:e,out:r})}var Jr=p("ZodCodec",(e,r)=>{Mr.init(e,r),br.init(e,r)});function $p(e,r,i){return new Jr({type:"pipe",in:e,out:r,transform:i.decode,reverseTransform:i.encode})}function hp(e){let r=e._zod.def;return new Jr({type:"pipe",in:r.out,out:r.in,transform:r.reverseTransform,reverseTransform:r.transform})}var kl=p("ZodPreprocess",(e,r)=>{Mr.init(e,r),Ru.init(e,r)}),xl=p("ZodReadonly",(e,r)=>{Vu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Is(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Il(e){return new xl({type:"readonly",innerType:e})}var wl=p("ZodTemplateLiteral",(e,r)=>{Fu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>is(e,i,o,t)});function yp(e,r){return new wl({type:"template_literal",parts:e,...$.normalizeParams(r)})}var Sl=p("ZodLazy",(e,r)=>{kr.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Ss(e,i,o,t),e.unwrap=()=>e._zod.def.getter()});function zl(e){return new Sl({type:"lazy",getter:e})}var Pl=p("ZodPromise",(e,r)=>{Ju.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ws(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function _p(e){return new Pl({type:"promise",innerType:e})}var Dl=p("ZodFunction",(e,r)=>{Mu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>cs(e,i,o,t)});function bp(e){return new Dl({type:"function",input:Array.isArray(e?.input)?il(e?.input):e?.input??Lr(Ye()),output:e?.output??Ye()})}var Br=p("ZodCustom",(e,r)=>{Bu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>us(e,i,o,t)});function kp(e){let r=new L({check:"custom"});return r._zod.check=e,r}function xp(e,r){return Uc(Br,e??(()=>!0),r)}function Ol(e,r={}){return Ac(Br,e,r)}function jl(e,r){return Tc(e,r)}var Ip=Zc,wp=Cc,Nl=p("ZodInstanceOf",(e,r)=>{Br.init(e,r)},{properties(e,r){return this.check(Dt(e,r))}});function Sp(e,r={}){let i=new Nl({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...$.normalizeParams(r)});return i._zod.bag.Class=e,i._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:i,path:[...i._zod.def.path??[]]})},i}var zp=(...e)=>Ec({Codec:Jr,Boolean:Mt,String:Vt},...e);function Pp(e){let r=zl(()=>Bt([Tr(e),Fs(),Ms(),Gs(),Lr(r),ol(Tr(),r)]));return r}function Dp(e,r){return new kl({type:"pipe",in:eo(e),out:r})}var by={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 ky(e){F({customError:e})}function xy(){return F().customError}var Ul;Ul||(Ul={});var Kr={};ge(Kr,{ZodISODate:()=>Te,ZodISODateTime:()=>Ae,ZodISODuration:()=>Ce,ZodISOTime:()=>Ze,date:()=>wy,datetime:()=>Iy,duration:()=>zy,time:()=>Sy});function Iy(e){return Dr(Ae,e)}function wy(e){return Or(Te,e)}function Sy(e){return jr(Ze,e)}function zy(e){return Nr(Ce,e)}var x={...Kt,...Di,iso:Kr},Py=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 Dy(e,r){let i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":r??"draft-2020-12"}function Op(e,r){return e.map((i,o)=>o<r?i:i.optional())}function Oy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function jy(e,r){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let i=e.slice(1).split("/").filter(Boolean);if(i.length===0)return r.rootSchema;let o=r.version==="draft-2020-12"?"$defs":"definitions";if(i[0]===o){let t=i[1]===void 0?void 0:Oy(i[1]);if(!t||!r.defs[t])throw new Error(`Reference not found: ${e}`);return r.defs[t]}throw new Error(`Reference not found: ${e}`)}function Ny(e,r){return x.transform(o=>o).check(o=>{let t=o.value;if(typeof t!="object"||t===null||Array.isArray(t))return;let n=Object.getOwnPropertyNames(t);if(r.minProperties!==void 0&&n.length<r.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:r.minProperties,inclusive:!0,message:`Too small: expected object to have >=${r.minProperties} properties`,input:t,inst:e,continue:!0}),r.maxProperties!==void 0&&n.length>r.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:r.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${r.maxProperties} properties`,input:t,inst:e,continue:!0}),r.keySchema)for(let a of n){let u=r.keySchema.safeParse(a);u.success||o.issues.push({code:"invalid_key",origin:"record",issues:u.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function Al(e,r){if(e===null)return"z";let i=typeof e;if(i!=="object"){if(i==="number"&&Number.isNaN(e))return null;let o=String(e);return`${i[0]}${o.length}:${o}`}if(r.has(e))return null;r.add(e);try{if(Array.isArray(e)){let n=[];for(let a of e){let u=Al(a,r);if(u===null)return null;n.push(u)}return`a${n.length}:[${n.join(",")}]`}let o=Object.keys(e).sort(),t=[];for(let n of o){let a=Al(e[n],r);if(a===null)return null;t.push(`${n.length}:${n}=${a}`)}return`o${t.length}:{${t.join(",")}}`}finally{r.delete(e)}}var Uy=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Ay=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(([r,i])=>Uy.has(r)?Gr(i):!Ay.has(r)||typeof i!="object"||i===null?!1:Object.values(i).some(Gr))}function jp(e){return e===1?"element":"elements"}function Ty(e,r){return x.transform(o=>o).check(o=>{let t=o.value;if(Array.isArray(t)){if(r.uniqueItems===!0){let n=new Map;for(let a=0;a<t.length;a++){let u=Al(t[a],new Set);if(u===null)continue;let s=n.get(u);if(s===void 0){n.set(u,a);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${s}`,input:t,path:[a],continue:!0})}}if(r.containsSchema){let n=r.minContains??1,a=r.maxContains!==void 0?r.maxContains+1:Number.POSITIVE_INFINITY,u=0;for(let s of t)if(r.containsSchema.safeParse(s).success&&++u>=a)break;u<n&&o.issues.push({code:"custom",message:`Array must contain at least ${n} matching ${jp(n)}; found ${u}`,input:t,continue:!0}),r.maxContains!==void 0&&u>r.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${r.maxContains} matching ${jp(r.maxContains)}`,input:t,continue:!0})}}}).pipe(e)}function Np(e,r){if(e!==!1)return e===void 0||e===!0?x.any():te(e,r)}var Zy=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Up(e,r){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return x.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 t=e.$ref;if(r.refs.has(t))return r.refs.get(t);if(r.processing.has(t))return x.lazy(()=>{if(!r.refs.has(t))throw new Error(`Circular reference not resolved: ${t}`);return r.refs.get(t)});r.processing.add(t);let n=jy(t,r),a=te(n,r);return r.refs.set(t,a),r.processing.delete(t),a}if(e.enum!==void 0){let t=e.enum;if(r.version==="openapi-3.0"&&e.nullable===!0&&t.length===1&&t[0]===null)return x.null();if(t.length===0)return x.never();if(t.length===1)return x.literal(t[0]);if(t.every(a=>typeof a=="string"))return x.enum(t);let n=t.map(a=>x.literal(a));return n.length<2?n[0]:x.union([n[0],n[1],...n.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let i=e.type;if(Array.isArray(i)){let t=i.map(n=>{let a={...e,type:n};return Up(a,r)});return t.length===0?x.never():t.length===1?t[0]:x.union(t)}if(!i)return x.any();let o;switch(i){case"string":{let t=x.string();if(e.format){let n=e.format;n==="email"?t=t.check(x.email()):n==="uri"||n==="uri-reference"?t=t.check(x.url()):n==="uuid"||n==="guid"?t=t.check(x.uuid()):n==="date-time"?t=t.check(x.iso.datetime({offset:!0})):n==="date"?t=t.check(x.iso.date()):n==="time"?t=t.check(x.regex(Zy)):n==="duration"?t=t.check(x.iso.duration()):n==="hostname"?t=t.check(x.hostname()):n==="ipv4"?t=t.check(x.ipv4()):n==="ipv6"?t=t.check(x.ipv6()):n==="mac"?t=t.check(x.mac()):n==="cidr"?t=t.check(x.cidrv4()):n==="cidr-v6"?t=t.check(x.cidrv6()):n==="base64"?t=t.check(x.base64()):n==="base64url"?t=t.check(x.base64url()):n==="e164"?t=t.check(x.e164()):n==="credit_card"?t=t.check(x.creditCard()):n==="iban"?t=t.check(x.iban()):n==="jwt"?t=t.check(x.jwt()):n==="emoji"?t=t.check(x.emoji()):n==="nanoid"?t=t.check(x.nanoid()):n==="cuid"?t=t.check(x.cuid()):n==="cuid2"?t=t.check(x.cuid2()):n==="ulid"?t=t.check(x.ulid()):n==="xid"?t=t.check(x.xid()):n==="ksuid"&&(t=t.check(x.ksuid()))}typeof e.minLength=="number"&&(t=t.min(e.minLength)),typeof e.maxLength=="number"&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),o=t;break}case"number":case"integer":{let t=i==="integer"?x.number().int():x.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(t=t.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum=="number"?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(t=t.lt(e.maximum)),typeof e.multipleOf=="number"&&(t=t.multipleOf(e.multipleOf)),o=t;break}case"boolean":{o=x.boolean();break}case"null":{o=x.null();break}case"object":{let t={},n=e.properties||{},a=new Set(e.required||[]),u=typeof e.additionalProperties=="object"?te(e.additionalProperties,r):void 0;for(let[d,f]of Object.entries(n)){let m=te(f,r);K(t,d,a.has(d)?m:m.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),m=[];for(let _ of f){let k=te(d[_],r),S=x.string().regex(new RegExp(_));m.push(x.looseRecord(S,k))}let v=[];if(Object.keys(t).length>0&&v.push(x.object(t).passthrough()),v.push(...m),v.length===0)o=x.object({}).passthrough();else if(v.length===1)o=v[0];else{let _=x.intersection(v[0],v[1]);for(let k=2;k<v.length;k++)_=x.intersection(_,v[k]);o=_}if(e.additionalProperties===!1){let _=Object.keys(t),k=f.map(I=>new RegExp(I)),S=o;o=o.check(I=>{if(!se(I.value))return;let D=[];for(let A of Object.keys(I.value))_.includes(A)||k.some(R=>R.test(A))||D.push(A);D.length&&I.issues.push({code:"unrecognized_keys",keys:D,input:I.value,inst:S})})}}else{let d=x.object(t);e.additionalProperties===!1?o=d.strict():u?o=d.catchall(u):o=d.passthrough()}let s=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(s||c!==void 0||l!==void 0){let d;if(s){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=te(f,r)}o=Ny(o,{keySchema:d,minProperties:c,maxProperties:l})}break}case"array":{let t=e.prefixItems,n=e.items;if(t&&Array.isArray(t)){let a=typeof e.minItems=="number"?e.minItems:0,u=t.map(d=>te(d,r)),s=Op(u,a),c=Array.isArray(n)?void 0:Np(n,r),l=x.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(x.maxLength(e.maxItems)))}else if(Array.isArray(n)){let a=typeof e.minItems=="number"?e.minItems:0,u=n.map(d=>te(d,r)),s=Op(u,a),c=Np(e.additionalItems,r),l=x.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(x.maxLength(e.maxItems)))}else if(n!==void 0){let a=te(n,r),u=x.array(a);typeof e.minItems=="number"&&(u=u.min(e.minItems)),typeof e.maxItems=="number"&&(u=u.max(e.maxItems)),o=u}else o=x.array(x.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=Ty(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?te(e.contains,r):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: ${i}`)}return o}function te(e,r){if(typeof e=="boolean")return e?x.any():x.never();let i=Up(e,r),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let u=e.anyOf.map(c=>te(c,r)),s=x.union(u);i=o?x.intersection(i,s):s}if(e.oneOf&&Array.isArray(e.oneOf)){let u=e.oneOf.map(c=>te(c,r)),s=x.xor(u);i=o?x.intersection(i,s):s}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=o?i:x.any();else{let u=o?i:te(e.allOf[0],r),s=o?0:1;for(let c=s;c<e.allOf.length;c++)u=x.intersection(u,te(e.allOf[c],r));i=u}e.nullable===!0&&r.version==="openapi-3.0"&&(i=x.nullable(i)),e.readOnly===!0&&(i=x.readonly(i)),e.default!==void 0&&(i=i.default(e.default));let t={},n=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of n)u in e&&(t[u]=e[u]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let u of a)u in e&&(t[u]=e[u]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Gr(e.propertyNames)&&(t.propertyNames=e.propertyNames);for(let u of["minProperties","maxProperties"])e[u]!==void 0&&(t[u]=e[u])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Gr(e.contains)&&(t.contains=e.contains);for(let u of["uniqueItems","minContains","maxContains"])e[u]!==void 0&&(t[u]=e[u])}for(let u of Object.keys(e))Py.has(u)||K(t,u,e[u]);return Object.keys(t).length>0&&r.registry.add(i,t),e.description&&(i=i.describe(e.description)),i}function Ap(e,r){if(typeof e=="boolean")return e?x.any():x.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=Dy(i,r?.defaultTarget),t=i.$defs||i.definitions||{},n={version:o,defs:t,refs:new Map,processing:new Set,rootSchema:i,registry:r?.registry??G};return te(i,n)}var Tp=Symbol("z.visit/resolving");function Wr(e,r){let i=typeof r=="function"?r:(a,u)=>{let s=r[a._zod.def.type];return s?s(a,u):a},o=new Map;function t(a){let u=o.get(a);if(u===Tp)return new kr({type:"lazy",getter:()=>o.get(a)});if(u!==void 0)return u;o.set(a,Tp);let s=n(a),c=i(s,s!==a);return o.set(a,c),c}function n(a){let u=a._zod.def,s=u.type;switch(s){case"object":{let c=u.shape,l=Object.keys(c),d=!1,f={};for(let v of l){let _=t(c[v]);_!==c[v]&&(d=!0),f[v]=_}let m=u.catchall;return u.catchall&&(m=t(u.catchall),m!==u.catchall&&(d=!0)),d?T(a,{...u,shape:f,catchall:m}):a}case"array":{let c=t(u.element);return c===u.element?a:T(a,{...u,element:c})}case"tuple":{let c=u.items,l=!1,d=[];for(let m of c){let v=t(m);v!==m&&(l=!0),d.push(v)}let f=u.rest;return u.rest&&(f=t(u.rest),f!==u.rest&&(l=!0)),l?T(a,{...u,items:d,rest:f}):a}case"record":case"map":{let c=t(u.keyType),l=t(u.valueType);return c===u.keyType&&l===u.valueType?a:T(a,{...u,keyType:c,valueType:l})}case"set":{let c=t(u.valueType);return c===u.valueType?a:T(a,{...u,valueType:c})}case"union":{let c=u.options,l=!1,d=[];for(let f of c){let m=t(f);m!==f&&(l=!0),d.push(m)}return l?T(a,{...u,options:d}):a}case"intersection":{let c=t(u.left),l=t(u.right);return c===u.left&&l===u.right?a:T(a,{...u,left:c,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=t(u.innerType);return c===u.innerType?a:T(a,{...u,innerType:c})}case"pipe":{let c=t(u.in),l=t(u.out);return c===u.in&&l===u.out?a:T(a,{...u,in:c,out:l})}case"function":{let c=t(u.input),l=t(u.output);return c===u.input&&l===u.output?a:T(a,{...u,input:c,output:l})}case"lazy":{let c=u.getter,{_cachedInner:l,...d}=u;return T(a,{...d,getter:()=>t(c())})}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 a;default:return a}}return t(e)}function Zp(e){return Wr(e,{object:r=>r.partial(),union:r=>{let i=r._zod.def;return i.discriminator===void 0?r:Bt(i.options)}})}function Cy(e,r){if(!r?.length)return e;let i=e._zod.def;return T(e,fe(i,{checks:[...i.checks??[],...r]}),{parent:!0})}function Cp(e){return Cy(e.out,e.checks)}function Ey(e){return e.in._zod.traits.has("$ZodTransform")?Cp(e):e.in}function Ep(e){return Wr(e,{pipe:r=>Ey(r._zod.def),default:(r,i)=>i?Qe(r._zod.def.innerType):r,catch:(r,i)=>i?r._zod.def.innerType:r})}function Lp(e){return Wr(e,{pipe:r=>Cp(r._zod.def),prefault:(r,i)=>i?r._zod.def.innerType:r})}var Tl={};ge(Tl,{bigint:()=>Fy,boolean:()=>Vy,date:()=>My,number:()=>Ry,string:()=>Ly});function Ly(e){return nc(Vt,e)}function Ry(e){return sc(Ft,e)}function Vy(e){return vc(Mt,e)}function Fy(e){return hc(Jt,e)}function My(e){return Dc(Er,e)}var Rp="control-office",nt={interval:300,pageSize:100,actionRecordLimit:1e3,syncTimeoutSeconds:3600},it=W.string().regex(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i),Ee=W.iso.datetime({offset:!0}),Vp=W.object({url:W.url().refine(e=>{let r=new URL(e);return r.protocol==="https:"&&!r.username&&!r.password&&!r.search&&!r.hash&&(r.pathname==="/"||r.pathname==="")},"url must be an HTTPS tenant origin without credentials, query or path"),apiKey:W.string().trim().min(1).refine(e=>!/[\r\n]/.test(e)),retrievers:W.array(W.string()).optional(),interval:W.number().int().min(1).default(nt.interval),pageSize:W.number().int().min(1).max(1e3).default(nt.pageSize)}),Fp=W.object({id:it.optional(),modifiedFrom:Ee.optional()}).strict().refine(e=>!e.id||!e.modifiedFrom,"Use id or modifiedFrom, not both");var no=class{identifier;identifierField="Id";#e;#t;constructor(r,i){this.#e=r,this.#t=i,this.identifier=i.identifier}async run(r,i){let o=Fp.safeParse(r??{});if(!o.success)throw new ot("Invalid ControlOffice read inputs");let{id:t,modifiedFrom:n}=o.data;return i?{data:[],single:!1}:t?{data:[await this.#e.get(this.#t,t)],single:!0}:{data:await this.#r(n),single:!1}}pages(r){return this.#e.pages(this.#t,r)}async#r(r){let i=[];for await(let o of this.pages({from:r,until:new Date().toISOString()}))if(i.push(...o),i.length>nt.actionRecordLimit)throw new at(`ControlOffice read returns more than ${nt.actionRecordLimit} records; use a later modifiedFrom`);return i}};var Gt=class extends Error{};async function io(e,r,i){if(i.length===0)return;let o=await e.sender.documents(i,{collection:`${e.config.datasourceIdentifier??Rp}_${r.identifier}`,keyField:r.identifierField}),t=typeof o=="boolean"?[o]:Object.values(o);if(t.length===0||!t.every(n=>n===!0))throw new Error("ControlOffice document ingestion failed")}var oo=class{#e;#t;constructor(r,i){this.#e=r,this.#t=new Map(i.map(o=>[o.identifier,o]))}get callbackFunctionChain(){return async(r,i)=>{let o=i.config?.action,t=typeof o=="string"?this.#t.get(o):void 0;if(!t)return this.#e.receiver.responses.badRequest("Unknown ControlOffice read action")(r);try{return await this.#r(t,r)}catch(n){return this.#n(t,r,n)}}}async#r(r,i){let o=i.testRun===!0,t=await r.run(i.payload,o);return o?this.#e.receiver.responses.ok()(i):(await io(this.#e,r,t.data),this.#e.receiver.emitEventType(this.#e.receiver.responses.ok())({...i,payload:t.single?t.data[0]:t.data}))}#n(r,i,o){let{responses:t}=this.#e.receiver;return o instanceof ot||o instanceof at?t.badRequest(o.message)(i):o instanceof Gt?t.notFound("ControlOffice record was not found")(i):(this.#e.logger.error(`[ControlOffice] ${r.identifier} read failed: ${o instanceof Error?o.message:"unknown error"}`),t.internalServerError("ControlOffice read failed; check connector logs")(i))}};var ao=class{#e;#t;#r=!1;constructor(r,i){this.#e=r,this.#t=i}get name(){return`control-office-extractor-${this.#t.identifier}`}get#n(){return`offset_${this.#t.identifier}`}async onRun(){if(this.#r){this.#e.logger.warn(`[ControlOffice] previous ${this.#t.identifier} sync still running; skipping this run`);return}this.#r=!0;try{await this.#i()}catch(r){throw this.#e.logger.error(`[ControlOffice] ${this.#t.identifier} sync failed: ${r instanceof Error?r.message:"unknown error"}`),r}finally{this.#r=!1}}async#i(){let r=new Date().toISOString(),i=await this.#o(r);for await(let o of this.#t.pages(i)){await io(this.#e,this.#t,o);let t=o[o.length-1];t&&(this.#e.offsetStore.setOffset({timestamp:Date.parse(t.Modified),rawTimestamp:t.Modified,id:t.Id,cursorVersion:1},this.#n),await this.#e.offsetStore.flush())}}async#o(r){let i=await this.#e.offsetStore.getOffset(this.#n);if(i===void 0||i.id===0)return{until:r};let{timestamp:o}=i;if(typeof o!="number"||!Number.isFinite(o)||o<0)throw new Error("ControlOffice stored offset is invalid");if(i.cursorVersion===void 0)return{from:new Date(o).toISOString(),until:r};let t=Ee.safeParse(i.rawTimestamp),n=it.safeParse(i.id);if(i.cursorVersion!==1||!t.success||!n.success||Date.parse(t.data)!==o)throw new Error("ControlOffice stored cursor is invalid");return{after:{modified:t.data,id:n.data},until:r}}};var Mp=1e4,Jy=300,By=W.object({Id:it,Modified:Ee}).passthrough(),Jp=W.object({value:W.array(By)});function Ky(e){return typeof e=="object"&&e!==null&&"status"in e&&typeof e.status=="number"?e.status:"unknown"}function Gy(e){return e instanceof Error?e.message:typeof e=="object"&&e!==null&&"error"in e&&typeof e.error=="string"?e.error:""}var uo=class{#e;#t;constructor(r,i){this.#e=r,this.#t=i}async*pages(r,i){Ee.parse(i.until),i.from&&Ee.parse(i.from),i.after&&(Ee.parse(i.after.modified),it.parse(i.after.id));let o=i.after,t;for(let n=0;n<Mp;n+=1){let a=Jp.parse(await this.#i(this.#r(r,i,o))),[u]=a.value;if(!u)return;let s=`${u.Modified}|${u.Id}`;if(s===t)throw new Error("ControlOffice ignored the cursor and repeated a page");t=s,yield a.value;let c=a.value[a.value.length-1];o={modified:c.Modified,id:c.Id}}throw new Error(`ControlOffice pagination exceeded ${Mp} pages`)}async get(r,i){it.parse(i);let o=new URL(`/api/v1/${r.entity}`,this.#t.url);o.searchParams.set("$filter",`Id eq ${i}`),o.searchParams.set("$top","1");let[t]=Jp.parse(await this.#i(o)).value;if(!t)throw new Gt("ControlOffice record was not found");if(t.Id.toLowerCase()!==i.toLowerCase())throw new Error("ControlOffice lookup returned an unexpected record");return t}#r(r,i,o){let t=new URL(`/api/v1/${r.entity}`,this.#t.url),n=o?`(Modified gt ${o.modified} or (Modified eq ${o.modified} and Id gt ${o.id}))`:i.from&&`Modified ge ${i.from}`,a=[...n?[n]:[],`Modified le ${i.until}`];return t.searchParams.set("$top",String(this.#t.pageSize)),t.searchParams.set("$orderby","Modified asc,Id asc"),t.searchParams.set("$filter",a.join(" and ")),t}#n(r){let i=Gy(r).split(this.#t.apiKey).join("[redacted]").slice(0,Jy);return i?`: ${i}`:""}async#i(r){let i={headers:{"X-CO-ODATAAPIKEY":this.#t.apiKey,Accept:"application/json"},maxRedirects:0},o;try{o=await this.#e.get(`${r.pathname}${r.search}`,i)}catch(t){throw new Error(`ControlOffice GET failed (HTTP ${Ky(t)})${this.#n(t)}`)}if(o.status<200||o.status>=300)throw new Error(`ControlOffice GET failed (HTTP ${o.status})`);return o.data}};var Zl=[{entity:"Workorder",identifier:"get-workorders"},{entity:"Request",identifier:"get-requests"},{entity:"Object",identifier:"get-objects"},{entity:"Meter",identifier:"get-meters"},{entity:"MeterReading",identifier:"get-meter-readings"},{entity:"HourBooking",identifier:"get-hour-bookings"},{entity:"WorkorderActivity",identifier:"get-workorder-activities"},{entity:"WorkorderEmployee",identifier:"get-workorder-employees"},{entity:"WorkorderObject",identifier:"get-workorder-objects"},{entity:"RequestObject",identifier:"get-request-objects"},{entity:"ObjectMeter",identifier:"get-object-meters"},{entity:"Employee",identifier:"get-employees"},{entity:"Status",identifier:"get-statuses"},{entity:"Priority",identifier:"get-priorities"},{entity:"ObjectType",identifier:"get-object-types"},{entity:"Unit",identifier:"get-units"},{entity:"RequestOrWorkorderType",identifier:"get-request-or-workorder-types"}];function Wy(e){return e.issues.map(r=>`${r.path.join(".")||"config"}: ${r.message}`).join("; ")}var Cl=class extends qr{init=async()=>{let r=this.#e(),i=new uo(this.connectorSDK.httpClient({baseUrl:r.url}),r),o=Zl.map(n=>new no(i,n)),t=r.retrievers??o.map(n=>n.identifier);this.callbackFunction=new oo(this.connectorSDK,o).callbackFunctionChain,await Promise.all(o.filter(n=>t.includes(n.identifier)).map(n=>this.connectorSDK.processing.registerInterval(r.interval,new ao(this.connectorSDK,n),{immediate:!0,timeout:nt.syncTimeoutSeconds})))};#e(){let r=Vp.safeParse(this.connectorSDK.config);if(!r.success)throw new Error(`Invalid ControlOffice configuration: ${Wy(r.error)}`);let i=new Set(Zl.map(t=>t.identifier)),o=(r.data.retrievers??[]).filter(t=>!i.has(t));if(o.length>0)throw new Error(`Unknown ControlOffice retrievers in configuration: ${o.join(", ")}`);return r.data}};0&&(module.exports={ConnectorRunnerControlOffice});
|
|
62
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let u=a[1];if(r===a[0]){n(a);continue}if(e.external){let c=e.external.registry.get(a[0])?.id;if(r!==a[0]&&c){n(a);continue}}if(e.metadataRegistry.get(a[0])?.id){n(a);continue}if(u.cycle){n(a);continue}u.count>1&&e.reused==="ref"&&n(a)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Hf(e){let r=e.anyOf;if(!Array.isArray(r)||r.length===0||e.type!==void 0)return;let i=[];for(let o of r){if(!o||typeof o!="object")return;Hf(o);let t=Object.keys(o);if(t.length!==1||t[0]!=="type")return;let n=o.type;for(let a of Array.isArray(n)?n:[n]){if(typeof a!="string")return;i.includes(a)||i.push(a)}}delete e.anyOf,e.type=i.length===1?i[0]:i}var Yf=new Set(["type","properties","required","additionalProperties"]),Xf=["oneOf","anyOf"];function qf(e){let r=e.additionalProperties;return r===void 0||r===!1||typeof r!="object"||r===null?null:Object.keys(r).length?r:null}function Lc(e){let r=[];for(let n of e){if(typeof n!="object"||n.type!=="object")return null;for(let a in n)if(!Yf.has(a))return null;r.push(n)}let i={},o=new Set;for(let n of r){for(let a in n.properties){if(Object.prototype.hasOwnProperty.call(i,a))continue;let u=[];for(let c of r){let l=c.properties?.[a]??qf(c);l!=null&&(u.some(d=>JSON.stringify(d)===JSON.stringify(l))||u.push(l))}let s=u.length===1?u[0]:Lc(u)??{allOf:u};K(i,a,s)}for(let a of n.required??[])o.add(a)}let t={type:"object",properties:i};if(o.size&&(t.required=[...o]),r.every(n=>n.additionalProperties===!1))t.additionalProperties=!1;else{let n=[];for(let a of r){let u=qf(a);u&&!n.some(s=>JSON.stringify(s)===JSON.stringify(u))&&n.push(u)}n.length===1?t.additionalProperties=n[0]:n.length>1&&(t.additionalProperties={allOf:n})}return t}function fy(e){let r=e.allOf;if(!Array.isArray(r)||r.length<2)return;for(let t of Yf)if(t in e)return;let i=r.filter(t=>Xf.some(n=>Array.isArray(t[n]))),o=null;if(!i.length)o=Lc(r);else{let t=i[0],n=Xf.find(s=>Array.isArray(t[s]));if(Object.keys(t).length!==1)return;let a=r.filter(s=>s!==t),u=t[n].map(s=>Lc([...a,s]));if(u.some(s=>!s))return;o={[n]:u}}o&&(delete e.allOf,Ur(e,o))}function Ue(e,r){let i=e.seen.get(r);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");let o=u=>{let s=e.seen.get(u);if(s.ref===null)return;let c=s.def??s.schema,l={...c},d=s.ref;if(s.ref=null,d){o(d);let m=e.seen.get(d),v=m.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(v)):Ur(c,v),Ur(c,l),u._zod.parent===d)for(let k in c)k==="$ref"||k==="allOf"||k in l||delete c[k];if(v.$ref&&m.def)for(let k in c)k==="$ref"||k==="allOf"||k in m.def&&JSON.stringify(c[k])===JSON.stringify(m.def[k])&&delete c[k]}let f=u._zod.parent;if(f&&f!==d){o(f);let m=e.seen.get(f);if(m?.schema.$ref&&(c.$ref=m.schema.$ref,m.def))for(let v in c)v==="$ref"||v==="allOf"||v in m.def&&JSON.stringify(c[v])===JSON.stringify(m.def[v])&&delete c[v]}e.override({zodSchema:u,jsonSchema:c,path:s.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let u of[...e.seen.entries()].reverse())o(u[0]);if(e.target!=="openapi-3.0")for(let u of e.seen.entries())Hf(u[1].def??u[1].schema);for(let u of e.deferred)u();if(e.intersections.length){let u=new Map;for(let s of e.seen.values())for(let c of[s.schema,s.def]){let l=c?.allOf;if(!Array.isArray(l))continue;let d=u.get(l);d?d.push(c):u.set(l,[c])}for(let s of e.intersections)for(let c of u.get(s)??[])fy(c)}}let t={};if(e.target==="draft-2020-12"?t.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?t.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?t.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let u=e.external.registry.get(r)?.id;if(!u)throw new Error("Schema is missing an `id` property");t.$id=e.external.uri(u)}Ur(t,i.defId?i.schema:i.def??i.schema);let n=e.metadataRegistry.get(r)?.id;n!==void 0&&t.id===n&&delete t.id;let a=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let u of e.seen.entries()){let s=u[1];s.def&&s.defId&&(s.def.id===s.defId&&delete s.def.id,K(a,s.defId,s.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?t.$defs=a:t.definitions=a);try{let u=JSON.parse(JSON.stringify(t));return Object.defineProperty(u,"~standard",{value:{...r["~standard"],jsonSchema:{input:Zt(r,"input",e.processors),output:Zt(r,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function ee(e,r){let i=r??{seen:new Set};if(i.seen.has(e))return!1;i.seen.add(e);let o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return ee(o.element,i);if(o.type==="set")return ee(o.valueType,i);if(o.type==="lazy")return ee(o.getter(),i);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault"||o.type==="catch")return ee(o.innerType,i);if(o.type==="intersection")return ee(o.left,i)||ee(o.right,i);if(o.type==="record"||o.type==="map")return ee(o.keyType,i)||ee(o.valueType,i);if(o.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ee(o.in,i)||ee(o.out,i);if(o.type==="object"){for(let t in o.shape)if(ee(o.shape[t],i))return!0;return!1}if(o.type==="union"){for(let t of o.options)if(ee(t,i))return!0;return!1}if(o.type==="tuple"){for(let t of o.items)if(ee(t,i))return!0;return!!(o.rest&&ee(o.rest,i))}return!1}var Rc=(e,r={})=>i=>{let o=je({...i,processors:r});return C(e,o),Ne(o,e),Ue(o,e)},Zt=(e,r,i={})=>o=>{let{libraryOptions:t,target:n}=o??{},a=je({...t??{},target:n,io:r,processors:i});return C(e,a),Ne(a,e),Ue(a,e)};var Ct=(e,r,i)=>{(e[r]===void 0||i>e[r])&&(e[r]=i)},Et=(e,r,i)=>{(e[r]===void 0||i<e[r])&&(e[r]=i)},Qf=(e,r)=>{Ct(e,"minimum",r),Et(e,"maximum",r)},nm=(e,r)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(r)||e.multipleOf.push(r)},im=(e,r)=>{e.patterns??(e.patterns=new Set),e.patterns.add(r)},om=(e,r)=>{e.mime=e.mime?e.mime.filter(i=>r.includes(i)):[...r]},am=(e,r)=>{e.format=r,r.includes("int")&&(e.isInt=!0)},em=(e,r)=>Ct(e,"minimum",r.minimum),tm=(e,r)=>Et(e,"maximum",r.maximum),rm=e=>(r,i)=>{am(r,i.format);let[o,t]=e[i.format];Ct(r,"minimum",o),Et(r,"maximum",t)},my={greater_than:(e,r)=>Ct(e,r.inclusive?"minimum":"exclusiveMinimum",r.value),less_than:(e,r)=>Et(e,r.inclusive?"maximum":"exclusiveMaximum",r.value),multiple_of:(e,r)=>nm(e,r.value),number_format:rm(er),bigint_format:rm(tr),min_length:em,max_length:tm,length_equals:(e,r)=>Qf(e,r.length),min_size:em,max_size:tm,size_equals:(e,r)=>Qf(e,r.size),string_format:(e,r)=>{am(e,r.format),r.pattern&&im(e,r.pattern),(r.format==="base64"||r.format==="base64url")&&(e.contentEncoding=r.format),(r.local||r.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,r)=>om(e,r.mime)};function J(e){let r={},i=e._zod.def,o=e._zod.traits.has("$ZodCheck")?[e,...i.checks??[]]:i.checks??[];for(let n of o)my[n._zod.def.check]?.(r,n._zod.def);let t=e._zod.bag;t.minimum!==void 0&&Ct(r,"minimum",t.minimum),t.exclusiveMinimum!==void 0&&Ct(r,"exclusiveMinimum",t.exclusiveMinimum),t.maximum!==void 0&&Et(r,"maximum",t.maximum),t.exclusiveMaximum!==void 0&&Et(r,"exclusiveMaximum",t.exclusiveMaximum),t.multipleOf!==void 0&&nm(r,t.multipleOf),t.format!==void 0&&(r.format??(r.format=t.format),t.format.includes("int")&&(r.isInt=!0)),t.mime&&om(r,t.mime);for(let n of t.patterns??[])im(r,n);return r}var py={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},gy=new Map([[Pn,Ko],[hr,Go]]),um=e=>gy.get(e)??e,Mc=(e,r,i,o)=>{let t=i;t.type="string";let{minimum:n,maximum:a,format:u,patterns:s,contentEncoding:c,laxFormat:l}=J(e);if(typeof n=="number"&&(t.minLength=n),typeof a=="number"&&(t.maxLength=a),u&&(t.format=py[u]??u,t.format===""&&delete t.format,(u==="time"||l)&&delete t.format),c&&(t.contentEncoding=c),s&&s.size>0){let d=[...s].map(um);d.length===1?t.pattern=d[0].source:d.length>1&&(t.allOf=[...d.map(f=>({...r.target==="draft-07"||r.target==="draft-04"||r.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},Jc=(e,r,i,o)=>{let t=i,{minimum:n,maximum:a,multipleOf:u,exclusiveMaximum:s,exclusiveMinimum:c,isInt:l}=J(e);t.type=l?"integer":"number";let d=typeof c=="number"&&c>=(n??Number.NEGATIVE_INFINITY),f=typeof s=="number"&&s<=(a??Number.POSITIVE_INFINITY),m=r.target==="draft-04"||r.target==="openapi-3.0";if(d?m?(t.minimum=c,t.exclusiveMinimum=!0):t.exclusiveMinimum=c:typeof n=="number"&&(t.minimum=n),f?m?(t.maximum=s,t.exclusiveMaximum=!0):t.exclusiveMaximum=s:typeof a=="number"&&(t.maximum=a),u){let v=new Set;for(let S of u)Number.isFinite(S)&&S!==0?v.add(Math.abs(S)):M(e,r,t,o,`A multipleOf divisor of ${S} cannot be represented in JSON Schema`);let[_,...k]=v;_!==void 0&&(t.multipleOf=_),k.length&&(t.allOf=[...t.allOf??[],...k.map(S=>({multipleOf:S}))])}},Bc=(e,r,i,o)=>{i.type="boolean"},Kc=(e,r,i,o)=>{M(e,r,i,o,"BigInt cannot be represented in JSON Schema")},Gc=(e,r,i,o)=>{M(e,r,i,o,"Symbols cannot be represented in JSON Schema")},Wc=(e,r,i,o)=>{r.target==="openapi-3.0"?(i.type="string",i.nullable=!0,i.enum=[null]):i.type="null"},Xc=(e,r,i,o)=>{M(e,r,i,o,"Undefined cannot be represented in JSON Schema")},qc=(e,r,i,o)=>{M(e,r,i,o,"Void cannot be represented in JSON Schema")},Hc=(e,r,i,o)=>{i.not={}},Yc=(e,r,i,o)=>{},Qc=(e,r,i,o)=>{},es=(e,r,i,o)=>{M(e,r,i,o,"Date cannot be represented in JSON Schema")},ts=(e,r,i,o)=>{let t=e._zod.def,n=ct(t.entries);if(n.length===0){i.not={};return}n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),i.enum=n},rs=(e,r,i,o)=>{let t=e._zod.def;if(t.values.length===0){i.not={};return}let n=[];for(let a of t.values)if(a===void 0){if(M(e,r,i,o,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof a=="bigint"){if(M(e,r,i,o,"BigInt literals cannot be represented in JSON Schema"))return;n.push(Number(a))}else n.push(a);if(n.length!==0)if(n.length===1){let a=n[0];i.type=a===null?"null":typeof a,r.target==="draft-04"||r.target==="openapi-3.0"?i.enum=[a]:i.const=a}else n.every(a=>typeof a=="number")&&(i.type="number"),n.every(a=>typeof a=="string")&&(i.type="string"),n.every(a=>typeof a=="boolean")&&(i.type="boolean"),n.every(a=>a===null)&&(i.type="null"),i.enum=n},ns=(e,r,i,o)=>{M(e,r,i,o,"NaN cannot be represented in JSON Schema")},is=(e,r,i,o)=>{let t=i,n=e._zod.pattern;if(!n)throw new Error("Pattern not found in template literal");t.type="string",t.pattern=n.source},os=(e,r,i,o)=>{let t=i;t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:n,maximum:a,mime:u}=J(e);n!==void 0&&(t.minLength=n),a!==void 0&&(t.maxLength=a),u&&(u.length===0?t.not={}:u.length===1?t.contentMediaType=u[0]:t.anyOf=u.map(s=>({contentMediaType:s})))},as=(e,r,i,o)=>{i.type="boolean"},us=(e,r,i,o)=>{M(e,r,i,o,"Custom types cannot be represented in JSON Schema")},cs=(e,r,i,o)=>{M(e,r,i,o,"Function types cannot be represented in JSON Schema")},ss=(e,r,i,o)=>{M(e,r,i,o,"Transforms cannot be represented in JSON Schema")},ls=(e,r,i,o)=>{M(e,r,i,o,"Map cannot be represented in JSON Schema")},ds=(e,r,i,o)=>{M(e,r,i,o,"Set cannot be represented in JSON Schema")},fs=(e,r,i,o)=>{let t=i,n=e._zod.def,{minimum:a,maximum:u}=J(e);typeof a=="number"&&(t.minItems=a),typeof u=="number"&&(t.maxItems=u),t.type="array",t.items=C(n.element,r,{...o,path:[...o.path,"items"]})};function Ar(e){let r=e._zod.def;return r.type==="pipe"&&r.in._zod.traits.has("$ZodTransform")?Ar(r.out):r.type==="catch"?Ar(r.innerType):e._zod.optin}var ms=(e,r,i,o)=>{let t=i,n=e._zod.def,a=n.shape;if(Object.getOwnPropertySymbols(a).length&&M(e,r,t,o,"Symbol keys cannot be represented in JSON Schema"))return;t.type="object",t.properties={};for(let c in a)K(t.properties,c,C(a[c],r,{...o,path:[...o.path,"properties",c]}));let s=[];for(let c of Object.keys(a)){let l=n.shape[c];(r.io==="input"?Ar(l)===void 0:l._zod.optout===void 0)&&s.push(c)}s.length>0&&(t.required=s),n.catchall?._zod.def.type==="never"?t.additionalProperties=!1:n.catchall?n.catchall&&(t.additionalProperties=C(n.catchall,r,{...o,path:[...o.path,"additionalProperties"]})):r.io==="output"&&(t.additionalProperties=!1)},wi=(e,r,i,o)=>{let t=e._zod.def,n=t.inclusive===!1,a=t.options.map((u,s)=>C(u,r,{...o,path:[...o.path,n?"oneOf":"anyOf",s]}));n?i.oneOf=a:i.anyOf=a},ps=(e,r,i,o)=>{let t=e._zod.def,n=C(t.left,r,{...o,path:[...o.path,"allOf",0]}),a=C(t.right,r,{...o,path:[...o.path,"allOf",1]}),u=c=>"allOf"in c&&Object.keys(c).length===1,s=[...u(n)?n.allOf:[n],...u(a)?a.allOf:[a]];i.allOf=s,r.intersections.push(s)},gs=(e,r,i,o)=>{let t=i,n=e._zod.def;t.type="array";let a=r.target==="draft-2020-12"?"prefixItems":"items",u=r.target==="draft-2020-12"||r.target==="openapi-3.0"?"items":"additionalItems",s=n.items.map((_,k)=>C(_,r,{...o,path:[...o.path,a,k]})),c=n.rest?C(n.rest,r,{...o,path:[...o.path,u,...r.target==="openapi-3.0"?[n.items.length]:[]]}):null,l=n.items.length;for(;l>0;){let _=n.items[l-1];if(!(r.io==="input"?Ar(_)!==void 0:_._zod.optout==="optional"))break;l--}let d=n.items.length,f=!n.rest;r.target==="draft-2020-12"?(t.prefixItems=s,f?t.items=!1:c&&(t.items=c),l>0&&(t.minItems=l),f&&(t.maxItems=d)):r.target==="openapi-3.0"?(t.items={anyOf:s},c&&t.items.anyOf.push(c),l>0&&(t.minItems=l),f&&(t.maxItems=d)):(t.items=s,f?t.additionalItems=!1:c&&(t.additionalItems=c),l>0&&(t.minItems=l),f&&(t.maxItems=d));let{minimum:m,maximum:v}=J(e);typeof m=="number"&&(t.minItems=m),typeof v=="number"&&(t.maxItems=v)};function Vc(e,r,i){if(r.$ref){if(i.has(r))return r;i.add(r);let v=e.get(r)?.def;if(!v)return r;let _=Vc(e,v,i);return _===v?r:_}for(let v of["anyOf","oneOf"]){let _=r[v];if(!Array.isArray(_))continue;let k=_.map(S=>Vc(e,S,i));k.some((S,I)=>S!==_[I])&&(r={...r,[v]:k})}let o=Array.isArray(r.type)?r.type:[r.type],t=!o.includes("string")&&o.some(v=>v==="number"||v==="integer"),n=r.enum??(r.const!==void 0?[r.const]:void 0);if(!t&&!n?.some(v=>typeof v=="number"))return r;let{minimum:a,maximum:u,exclusiveMinimum:s,exclusiveMaximum:c,multipleOf:l,format:d,id:f,...m}=r;return m.enum?m.enum=m.enum.map(v=>typeof v=="number"?String(v):v):typeof m.const=="number"&&(m.const=String(m.const)),t&&(m.type="string",n||(m.pattern=(o.includes("number")?ke:dr).source)),m}var Fc=new WeakMap;function vy(e){let r=new Map;for(let o of e.seen.values())o.def&&!r.has(o.schema)&&r.set(o.schema,o);let i=new Map;for(let o of Fc.get(e)??[]){let t=e.seen.get(o),n=(t?.def??t?.schema)?.propertyNames;if(!n||n===!0||i.has(n))continue;let a=Vc(r,n,new Set);a!==n&&i.set(n,a)}if(i.size)for(let o of e.seen.values())for(let t of[o.schema,o.def]){let n=t&&i.get(t.propertyNames);n&&(t.propertyNames=n)}}var vs=(e,r,i,o)=>{let t=i,n=e._zod.def;t.type="object";let a=n.keyType,u=J(a).patterns;if(n.mode==="loose"&&u&&u.size>0){let l=C(n.valueType,r,{...o,path:[...o.path,"patternProperties","*"]});t.patternProperties={};for(let d of u)K(t.patternProperties,um(d).source,l)}else{if(r.target==="draft-07"||r.target==="draft-2020-12"){t.propertyNames=C(n.keyType,r,{...o,path:[...o.path,"propertyNames"]});let l=Fc.get(r);l||(l=[],Fc.set(r,l),r.deferred.push(()=>vy(r))),l.push(e)}t.additionalProperties=C(n.valueType,r,{...o,path:[...o.path,"additionalProperties"]})}let s=a._zod.values,c=r.io==="input"&&Ar(n.valueType)!==void 0;if(s&&!n.partial&&!c){let l=[...s].filter(d=>typeof d=="string"||typeof d=="number");l.length>0&&(t.required=l.map(String))}},$s=(e,r,i,o)=>{let t=e._zod.def,n=C(t.innerType,r,o),a=r.seen.get(e);r.target==="openapi-3.0"?(a.ref=t.innerType,i.nullable=!0):i.anyOf=[n,{type:"null"}]},hs=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},ys=Symbol();function cm(e,r,i,o,t){let n=!1,a=JSON.stringify(e,(u,s)=>typeof s!="bigint"?s:(n=!0,null));return n?(M(r,i,o,t,"BigInt defaults cannot be represented in JSON Schema"),ys):JSON.parse(a)}var _s=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a=cm(t.defaultValue,e,r,i,o);a!==ys&&(i.default=a)},bs=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);if(n.ref=t.innerType,r.io!=="input")return;let a=cm(t.defaultValue,e,r,i,o);a!==ys&&(i._prefault=a)},ks=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType;let a;try{a=t.catchValue(void 0)}catch{M(e,r,i,o,"Dynamic catch values are not supported in JSON Schema");return}i.default=a},xs=(e,r,i,o)=>{let t=e._zod.def,n=t.in._zod.traits.has("$ZodTransform"),a=r.io==="input"?n?t.out:t.in:t.out;C(a,r,o);let u=r.seen.get(e);u.ref=a},Is=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType,i.readOnly=!0},ws=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},Si=(e,r,i,o)=>{let t=e._zod.def;C(t.innerType,r,o);let n=r.seen.get(e);n.ref=t.innerType},Ss=(e,r,i,o)=>{let t=e._zod.innerType;C(t,r,o);let n=r.seen.get(e);n.ref=t},Ii={string:Mc,number:Jc,boolean:Bc,bigint:Kc,symbol:Gc,null:Wc,undefined:Xc,void:qc,never:Hc,any:Yc,unknown:Qc,date:es,enum:ts,literal:rs,nan:ns,template_literal:is,file:os,success:as,custom:us,function:cs,transform:ss,map:ls,set:ds,array:fs,object:ms,union:wi,intersection:ps,tuple:gs,record:vs,nullable:$s,nonoptional:hs,default:_s,prefault:bs,catch:ks,pipe:xs,readonly:Is,promise:ws,optional:Si,lazy:Ss};function zi(e,r){if("_idmap"in e){let o=e,t=je({...r,processors:Ii}),n={};for(let s of o._idmap.entries()){let[c,l]=s;C(l,t)}let a={},u={registry:o,uri:r?.uri,defs:n};t.external=u;for(let s of o._idmap.entries()){let[c,l]=s;Ne(t,l),K(a,c,Ue(t,l))}if(Object.keys(n).length>0){let s=t.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:n}}return{schemas:a}}let i=je({...r,processors:Ii});return C(e,i),Ne(i,e),Ue(i,e)}var Pi=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(r){this.ctx.counter=r}get seen(){return this.ctx.seen}constructor(r){let i=r?.target??"draft-2020-12";i==="draft-4"&&(i="draft-04"),i==="draft-7"&&(i="draft-07"),this.ctx=je({processors:Ii,target:i,...r?.metadata&&{metadata:r.metadata},...r?.unrepresentable&&{unrepresentable:r.unrepresentable},...r?.override&&{override:r.override},...r?.io&&{io:r.io}})}process(r,i={path:[],schemaPath:[]}){return C(r,this.ctx,i)}emit(r,i){i&&(i.cycles&&(this.ctx.cycles=i.cycles),i.reused&&(this.ctx.reused=i.reused),i.external&&(this.ctx.external=i.external)),this.ctx.sharedDefsExtractedFor=void 0,this.ctx.sharedEmitDoneFor=void 0,Ne(this.ctx,r);let o=Ue(this.ctx,r),{"~standard":t,...n}=o;return n}};var sm={};var Kt={};ge(Kt,{ZodAny:()=>Ws,ZodArray:()=>Ys,ZodBase64:()=>Gi,ZodBase64URL:()=>Wi,ZodBigInt:()=>Jt,ZodBigIntFormat:()=>Hi,ZodBoolean:()=>Mt,ZodCIDRv4:()=>Bi,ZodCIDRv6:()=>Ki,ZodCUID:()=>Ei,ZodCUID2:()=>Li,ZodCatch:()=>yl,ZodCodec:()=>Jr,ZodCreditCard:()=>Rs,ZodCustom:()=>Br,ZodCustomStringFormat:()=>tt,ZodDate:()=>Er,ZodDefault:()=>ml,ZodDiscriminatedUnion:()=>el,ZodE164:()=>Xi,ZodEmail:()=>Ai,ZodEmoji:()=>Zi,ZodEnum:()=>Rt,ZodExactOptional:()=>to,ZodFile:()=>sl,ZodFunction:()=>Dl,ZodGUID:()=>Ti,ZodIBAN:()=>Vs,ZodIPv4:()=>Mi,ZodIPv6:()=>Ji,ZodISODate:()=>Te,ZodISODateTime:()=>Ae,ZodISODuration:()=>Ce,ZodISOTime:()=>Ze,ZodInstanceOf:()=>Nl,ZodIntersection:()=>tl,ZodJWT:()=>qi,ZodKSUID:()=>Fi,ZodLazy:()=>Sl,ZodLiteral:()=>cl,ZodMAC:()=>Ls,ZodMap:()=>al,ZodNaN:()=>bl,ZodNanoID:()=>Ci,ZodNever:()=>qs,ZodNonOptional:()=>ro,ZodNull:()=>Ks,ZodNullable:()=>fl,ZodNumber:()=>Ft,ZodNumberFormat:()=>rt,ZodObject:()=>Rr,ZodOptional:()=>Fr,ZodPipe:()=>Mr,ZodPrefault:()=>gl,ZodPreprocess:()=>kl,ZodPromise:()=>Pl,ZodReadonly:()=>xl,ZodRecord:()=>Lt,ZodSet:()=>ul,ZodString:()=>Vt,ZodStringFormat:()=>E,ZodSuccess:()=>hl,ZodSymbol:()=>Js,ZodTemplateLiteral:()=>wl,ZodTransform:()=>ll,ZodTuple:()=>nl,ZodType:()=>O,ZodULID:()=>Ri,ZodURL:()=>Cr,ZodUUID:()=>ye,ZodUndefined:()=>Bs,ZodUnion:()=>Vr,ZodUnknown:()=>Xs,ZodVoid:()=>Hs,ZodXID:()=>Vi,ZodXor:()=>Qs,_ZodString:()=>Ui,_default:()=>pl,_function:()=>bp,any:()=>Ym,array:()=>Lr,base64:()=>Nm,base64url:()=>Um,bigint:()=>Gm,boolean:()=>Ms,catch:()=>_l,check:()=>kp,cidrv4:()=>Om,cidrv6:()=>jm,codec:()=>$p,creditCard:()=>Tm,cuid:()=>km,cuid2:()=>xm,currencyCode:()=>Vm,custom:()=>xp,date:()=>ep,describe:()=>Ip,discriminatedUnion:()=>ap,e164:()=>Am,email:()=>fm,emoji:()=>_m,enum:()=>Qi,exactOptional:()=>dl,file:()=>mp,float32:()=>Mm,float64:()=>Jm,function:()=>bp,guid:()=>mm,hash:()=>Fm,hex:()=>Rm,hostname:()=>Lm,httpUrl:()=>ym,iban:()=>Zm,instanceof:()=>Sp,int:()=>ji,int32:()=>Bm,int64:()=>Wm,intersection:()=>rl,invertCodec:()=>hp,ipv4:()=>zm,ipv6:()=>Dm,json:()=>Pp,jwt:()=>Cm,keyof:()=>tp,ksuid:()=>Sm,lazy:()=>zl,literal:()=>fp,looseObject:()=>ip,looseRecord:()=>cp,mac:()=>Pm,map:()=>sp,meta:()=>wp,nan:()=>vp,nanoid:()=>bm,nativeEnum:()=>dp,never:()=>Yi,nonoptional:()=>$l,null:()=>Gs,nullable:()=>Zr,nullish:()=>pp,number:()=>Fs,object:()=>rp,optional:()=>Qe,partialRecord:()=>up,pipe:()=>Ni,prefault:()=>vl,preprocess:()=>Dp,promise:()=>_p,readonly:()=>Il,record:()=>ol,refine:()=>Ol,set:()=>lp,strictObject:()=>np,string:()=>Tr,stringFormat:()=>Em,stringbool:()=>zp,success:()=>gp,superRefine:()=>jl,symbol:()=>qm,templateLiteral:()=>yp,transform:()=>eo,tuple:()=>il,uint32:()=>Km,uint64:()=>Xm,ulid:()=>Im,undefined:()=>Hm,union:()=>Bt,unknown:()=>Ye,url:()=>hm,uuid:()=>pm,uuidv4:()=>gm,uuidv6:()=>vm,uuidv7:()=>$m,void:()=>Qm,xid:()=>wm,xor:()=>op});var Di={};ge(Di,{endsWith:()=>Pt,gt:()=>$e,gte:()=>ce,includes:()=>St,length:()=>qe,lowercase:()=>It,lt:()=>ve,lte:()=>ue,maxLength:()=>Xe,maxSize:()=>Oe,mime:()=>Ot,minLength:()=>xe,minSize:()=>he,multipleOf:()=>De,negative:()=>_i,nonnegative:()=>ki,nonpositive:()=>bi,normalize:()=>jt,overwrite:()=>pe,positive:()=>yi,properties:()=>Dt,property:()=>xi,regex:()=>xt,size:()=>We,slugify:()=>Tt,startsWith:()=>zt,toLowerCase:()=>Ut,toUpperCase:()=>At,trim:()=>Nt,uppercase:()=>wt});var lm=new WeakSet([Object.prototype,Error.prototype]);function Oi(e,r,i){Object.defineProperty(e,r,{configurable:!0,enumerable:!1,get(){let o=i(this);return Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0}),o},set(o){Object.defineProperty(this,r,{value:o,configurable:!0,writable:!0})}})}var dm=(e,r)=>{So.init(e,r),e.name="ZodError";let i=Object.getPrototypeOf(e);lm.has(i)||(lm.add(i),Oi(i,"format",o=>t=>ur(o,t)),Oi(i,"flatten",o=>t=>ar(o,t)),Oi(i,"addIssue",o=>t=>{o.issues.push(t),o.message=JSON.stringify(o.issues,st,2)}),Oi(i,"addIssues",o=>t=>{o.issues.push(...t),o.message=JSON.stringify(o.issues,st,2)}),Object.defineProperty(i,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},hy=p("ZodError",dm),ae=p("ZodError",dm,void 0,{Parent:Error});var zs=pt(ae),Ps=gt(ae),Ds=vt(ae),Os=$t(ae),js=on(ae),Ns=an(ae),Us=un(ae),As=cn(ae),Ts=sn(ae),Zs=ln(ae),Cs=dn(ae),Es=fn(ae);function _y(){B.localeError||F(Jn())}function et(){B.memoizer||F({memoizer:wr()})}var O=p("ZodType",(e,r)=>(_y(),P.init(e,r),e.def=r,e.type=r.type,e),{check(...e){let r=this.def;return this.clone($.mergeDefs(r,{checks:[...r.checks??[],...e.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,r){return T(this,e,r)},brand(){return this},register(e,r){return e.add(this,r),this},refine(e,r){return this.check(Ol(e,r))},superRefine(e,r){return this.check(jl(e,r))},overwrite(e){return this.check(pe(e))},optional(){return Qe(this)},exactOptional(){return dl(this)},nullable(){return Zr(this)},nullish(){return Qe(Zr(this))},nonoptional(e){return $l(this,e)},array(){return Lr(this)},or(e){return Bt([this,e])},and(e){return rl(this,e)},transform(e){return Ni(this,eo(e))},default(e){return pl(this,e)},prefault(e){return vl(this,e)},catch(e){return _l(this,e)},pipe(e){return Ni(this,e)},readonly(){return Il(this)},describe(e){let r=this.clone();return G.add(r,{description:e}),r},meta(...e){if(e.length===0)return G.get(this);let r=this.clone();return G.add(r,e[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...r){return r.length===0?e(this):e(this,...r)},get"~standard"(){return $.hide(this,"~standard",{...xn(this),jsonSchema:{input:Zt(this,"input"),output:Zt(this,"output")}})},set"~standard"(e){$.own(this,"~standard",e)},parse:function e(r,i){return zs(this,r,i,{callee:e})},parseAsync:async function e(r,i){return await Ps(this,r,i,{callee:e})},safeParse(e,r){return Ds(this,e,r)},async safeParseAsync(e,r){return Os(this,e,r)},get spa(){return this?.safeParseAsync},set spa(e){$.own(this,"spa",e)},validate(e,r){return cr(this,e,r)},validateAsync(e,r){return sr(this,e,r)},encode:function e(r,i){return js(this,r,i,{callee:e})},decode:function e(r,i){return Ns(this,r,i,{callee:e})},encodeAsync:async function e(r,i){return await Us(this,r,i,{callee:e})},decodeAsync:async function e(r,i){return await As(this,r,i,{callee:e})},safeEncode(e,r){return Ts(this,e,r)},safeDecode(e,r){return Zs(this,e,r)},async safeEncodeAsync(e,r){return Cs(this,e,r)},async safeDecodeAsync(e,r){return Es(this,e,r)},toJSONSchema(e){return Rc(this,{})(e)},get description(){return G.get(this)?.description},get _def(){return this._zod.def}}),Ui=p("_ZodString",(e,r)=>{Je.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Mc(e,i,o,t)},$.derived({format:e=>J(e).format??null,minLength:e=>J(e).minimum??null,maxLength:e=>J(e).maximum??null},{regex(...e){return this.check(xt(...e))},includes(...e){return this.check(St(...e))},startsWith(...e){return this.check(zt(...e))},endsWith(...e){return this.check(Pt(...e))},min(...e){return this.check(xe(...e))},max(...e){return this.check(Xe(...e))},length(...e){return this.check(qe(...e))},nonempty(...e){return this.check(xe(1,...e))},lowercase(e){return this.check(It(e))},uppercase(e){return this.check(wt(e))},trim(){return this.check(Nt())},normalize(...e){return this.check(jt(...e))},toLowerCase(){return this.check(Ut())},toUpperCase(){return this.check(At())},slugify(){return this.check(Tt())}})),Vt=p("ZodString",(e,r)=>{Je.init(e,r),Ui.init(e,r)},{email(e){return this.check(Yn(Ai,e))},url(e){return this.check(Pr(Cr,e))},jwt(e){return this.check(hi(qi,e))},emoji(e){return this.check(ii(Zi,e))},guid(e){return this.check(Qn(Ti,e))},uuid(e){return this.check(ei(ye,e))},uuidv4(e){return this.check(ti(ye,e))},uuidv6(e){return this.check(ri(ye,e))},uuidv7(e){return this.check(ni(ye,e))},nanoid(e){return this.check(oi(Ci,e))},cuid(e){return this.check(ai(Ei,e))},cuid2(e){return this.check(ui(Li,e))},ulid(e){return this.check(ci(Ri,e))},base64(e){return this.check(gi(Gi,e))},base64url(e){return this.check(vi(Wi,e))},xid(e){return this.check(si(Vi,e))},ksuid(e){return this.check(li(Fi,e))},ipv4(e){return this.check(di(Mi,e))},ipv6(e){return this.check(fi(Ji,e))},cidrv4(e){return this.check(mi(Bi,e))},cidrv6(e){return this.check(pi(Ki,e))},e164(e){return this.check($i(Xi,e))},datetime(e){return this.check(Dr(Ae,e))},date(e){return this.check(Or(Te,e))},time(e){return this.check(jr(Ze,e))},duration(e){return this.check(Nr(Ce,e))}});function Tr(e){return rc(Vt,e)}var E=p("ZodStringFormat",(e,r)=>{Z.init(e,r),Ui.init(e,r)}),Ae=p("ZodISODateTime",(e,r)=>{Ka.init(e,r),E.init(e,r)}),Te=p("ZodISODate",(e,r)=>{Ga.init(e,r),E.init(e,r)}),Ze=p("ZodISOTime",(e,r)=>{Wa.init(e,r),E.init(e,r)}),Ce=p("ZodISODuration",(e,r)=>{Xa.init(e,r),E.init(e,r)}),Ai=p("ZodEmail",(e,r)=>{Ta.init(e,r),E.init(e,r)});function fm(e){return Yn(Ai,e)}var Ti=p("ZodGUID",(e,r)=>{Ua.init(e,r),E.init(e,r)});function mm(e){return Qn(Ti,e)}var ye=p("ZodUUID",(e,r)=>{Aa.init(e,r),E.init(e,r)});function pm(e){return ei(ye,e)}function gm(e){return ti(ye,e)}function vm(e){return ri(ye,e)}function $m(e){return ni(ye,e)}var Cr=p("ZodURL",(e,r)=>{Ea.init(e,r),E.init(e,r)});function hm(e){return Pr(Cr,e)}function ym(e){return Pr(Cr,{protocol:lr,hostname:Xo,...$.normalizeParams(e)})}var Zi=p("ZodEmoji",(e,r)=>{La.init(e,r),E.init(e,r)});function _m(e){return ii(Zi,e)}var Ci=p("ZodNanoID",(e,r)=>{Ra.init(e,r),E.init(e,r)});function bm(e){return oi(Ci,e)}var Ei=p("ZodCUID",(e,r)=>{Va.init(e,r),E.init(e,r)});function km(e){return ai(Ei,e)}var Li=p("ZodCUID2",(e,r)=>{Fa.init(e,r),E.init(e,r)});function xm(e){return ui(Li,e)}var Ri=p("ZodULID",(e,r)=>{Ma.init(e,r),E.init(e,r)});function Im(e){return ci(Ri,e)}var Vi=p("ZodXID",(e,r)=>{Ja.init(e,r),E.init(e,r)});function wm(e){return si(Vi,e)}var Fi=p("ZodKSUID",(e,r)=>{Ba.init(e,r),E.init(e,r)});function Sm(e){return li(Fi,e)}var Mi=p("ZodIPv4",(e,r)=>{qa.init(e,r),E.init(e,r)});function zm(e){return di(Mi,e)}var Ls=p("ZodMAC",(e,r)=>{Ya.init(e,r),E.init(e,r)});function Pm(e){return ic(Ls,e)}var Ji=p("ZodIPv6",(e,r)=>{Ha.init(e,r),E.init(e,r)});function Dm(e){return fi(Ji,e)}var Bi=p("ZodCIDRv4",(e,r)=>{Qa.init(e,r),E.init(e,r)});function Om(e){return mi(Bi,e)}var Ki=p("ZodCIDRv6",(e,r)=>{eu.init(e,r),E.init(e,r)});function jm(e){return pi(Ki,e)}var Gi=p("ZodBase64",(e,r)=>{tu.init(e,r),E.init(e,r)});function Nm(e){return gi(Gi,e)}var Wi=p("ZodBase64URL",(e,r)=>{ru.init(e,r),E.init(e,r)});function Um(e){return vi(Wi,e)}var Xi=p("ZodE164",(e,r)=>{nu.init(e,r),E.init(e,r)});function Am(e){return $i(Xi,e)}var Rs=p("ZodCreditCard",(e,r)=>{iu.init(e,r),E.init(e,r)});function Tm(e){return oc(Rs,e)}var Vs=p("ZodIBAN",(e,r)=>{ou.init(e,r),E.init(e,r)});function Zm(e){return ac(Vs,e)}var qi=p("ZodJWT",(e,r)=>{au.init(e,r),E.init(e,r)});function Cm(e){return hi(qi,e)}var tt=p("ZodCustomStringFormat",(e,r)=>{uu.init(e,r),E.init(e,r)});function Em(e,r,i={}){return He(tt,e,r,i)}function Lm(e){return He(tt,"hostname",Wo,e)}function Rm(e){return He(tt,"hex",sa,e)}function Vm(e){return He(tt,"currency_code",Ho,e)}function Fm(e,r){let i=r?.enc??"hex",o=`${e}_${i}`,t=de[o];if(!t)throw new Error(`Unrecognized hash format: ${o}`);return He(tt,o,t,r)}var Ft=p("ZodNumber",(e,r)=>{Un.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Jc(e,i,o,t),e.isFinite=!0},$.derived({minValue:e=>{let{minimum:r,exclusiveMinimum:i}=J(e);return Math.max(r??Number.NEGATIVE_INFINITY,i??Number.NEGATIVE_INFINITY)},maxValue:e=>{let{maximum:r,exclusiveMaximum:i}=J(e);return Math.min(r??Number.POSITIVE_INFINITY,i??Number.POSITIVE_INFINITY)},isInt:e=>{let{isInt:r,multipleOf:i}=J(e);return!!r||!!i?.some(Number.isSafeInteger)},format:e=>J(e).format??null},{gt(e,r){return this.check($e(e,r))},gte(e,r){return this.check(ce(e,r))},min(e,r){return this.check(ce(e,r))},lt(e,r){return this.check(ve(e,r))},lte(e,r){return this.check(ue(e,r))},max(e,r){return this.check(ue(e,r))},int(e){return this.check(ji(e))},safe(e){return this.check(ji(e))},positive(e){return this.check($e(0,e))},nonnegative(e){return this.check(ce(0,e))},negative(e){return this.check(ve(0,e))},nonpositive(e){return this.check(ue(0,e))},multipleOf(e,r){return this.check(De(e,r))},step(e,r){return this.check(De(e,r))},finite(){return this}}));function Fs(e){return cc(Ft,e)}var rt=p("ZodNumberFormat",(e,r)=>{cu.init(e,r),Ft.init(e,r)});function ji(e){return lc(rt,e)}function Mm(e){return dc(rt,e)}function Jm(e){return fc(rt,e)}function Bm(e){return mc(rt,e)}function Km(e){return pc(rt,e)}var Mt=p("ZodBoolean",(e,r)=>{yr.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Bc(e,i,o,t)});function Ms(e){return gc(Mt,e)}var Jt=p("ZodBigInt",(e,r)=>{An.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Kc(e,i,o,t)},$.derived({minValue:e=>J(e).minimum??null,maxValue:e=>J(e).maximum??null,format:e=>J(e).format??null},{gte(e,r){return this.check(ce(e,r))},min(e,r){return this.check(ce(e,r))},gt(e,r){return this.check($e(e,r))},lt(e,r){return this.check(ve(e,r))},lte(e,r){return this.check(ue(e,r))},max(e,r){return this.check(ue(e,r))},positive(e){return this.check($e(BigInt(0),e))},negative(e){return this.check(ve(BigInt(0),e))},nonpositive(e){return this.check(ue(BigInt(0),e))},nonnegative(e){return this.check(ce(BigInt(0),e))},multipleOf(e,r){return this.check(De(e,r))}}));function Gm(e){return $c(Jt,e)}var Hi=p("ZodBigIntFormat",(e,r)=>{su.init(e,r),Jt.init(e,r)});function Wm(e){return yc(Hi,e)}function Xm(e){return _c(Hi,e)}var Js=p("ZodSymbol",(e,r)=>{lu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Gc(e,i,o,t)});function qm(e){return bc(Js,e)}var Bs=p("ZodUndefined",(e,r)=>{du.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Xc(e,i,o,t)});function Hm(e){return kc(Bs,e)}var Ks=p("ZodNull",(e,r)=>{fu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Wc(e,i,o,t)});function Gs(e){return xc(Ks,e)}var Ws=p("ZodAny",(e,r)=>{mu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Yc(e,i,o,t)});function Ym(){return Ic(Ws)}var Xs=p("ZodUnknown",(e,r)=>{pu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Qc(e,i,o,t)});function Ye(){return wc(Xs)}var qs=p("ZodNever",(e,r)=>{gu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Hc(e,i,o,t)});function Yi(e){return Sc(qs,e)}var Hs=p("ZodVoid",(e,r)=>{vu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>qc(e,i,o,t)});function Qm(e){return zc(Hs,e)}var Er=p("ZodDate",(e,r)=>{$u.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>es(e,i,o,t),e.min=(i,o)=>e.check(ce(i,o)),e.max=(i,o)=>e.check(ue(i,o))},$.derived({minDate:e=>{let{minimum:r}=J(e);return r?new Date(r):null},maxDate:e=>{let{maximum:r}=J(e);return r?new Date(r):null}},{}));function ep(e){return Pc(Er,e)}var Ys=p("ZodArray",(e,r)=>{et(),yu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>fs(e,i,o,t),e.element=r.element},{min(e,r){return this.check(xe(e,r))},nonempty(e){return this.check(xe(1,e))},max(e,r){return this.check(Xe(e,r))},length(e,r){return this.check(qe(e,r))},unwrap(){return this.element}});function Lr(e,r){return jc(Ys,e,r)}function tp(e){let r=e._zod.def.shape;return Qi(Object.keys(r))}var Rr=p("ZodObject",(e,r)=>{et(),_u.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ms(e,i,o,t),$.installLazyProp(e,"shape",i=>i._zod.def.shape,!1)},{keyof(){return Qi(Object.keys(this._zod.def.shape))},catchall(e){return this.clone($.mergeDefs(this._zod.def,{catchall:e}))},passthrough(){return this.clone($.mergeDefs(this._zod.def,{catchall:Ye()}))},loose(){return this.clone($.mergeDefs(this._zod.def,{catchall:Ye()}))},strict(){return this.clone($.mergeDefs(this._zod.def,{catchall:Yi()}))},strip(){return this.clone($.mergeDefs(this._zod.def,{catchall:void 0}))},extend(e){return $.extend(this,e)},safeExtend(e){return $.safeExtend(this,e)},merge(e){return $.merge(this,e)},pick(e){return $.pick(this,e)},omit(e){return $.omit(this,e)},partial(...e){return $.partial(Fr,this,e[0])},exactPartial(...e){return $.partial(to,this,e[0],"exactPartial")},required(...e){return $.required(ro,this,e[0])}});function rp(e,r){let i={type:"object",shape:e??{},...$.normalizeParams(r)};return new Rr(i)}function np(e,r){return new Rr({type:"object",shape:e,catchall:Yi(),...$.normalizeParams(r)})}function ip(e,r){return new Rr({type:"object",shape:e,catchall:Ye(),...$.normalizeParams(r)})}var Vr=p("ZodUnion",(e,r)=>{_r.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>wi(e,i,o,t),e.options=r.options});function Bt(e,r){return new Vr({type:"union",options:e,...$.normalizeParams(r)})}var Qs=p("ZodXor",(e,r)=>{Vr.init(e,r),bu.init(e,r),e._zod.processJSONSchema=(i,o,t)=>wi(e,i,o,t),e.options=r.options});function op(e,r){return new Qs({type:"union",options:e,inclusive:!1,...$.normalizeParams(r)})}var el=p("ZodDiscriminatedUnion",(e,r)=>{Vr.init(e,r),xu.init(e,r)});function ap(e,r,i){return new el({type:"union",options:r,discriminator:e,...$.normalizeParams(i)})}var tl=p("ZodIntersection",(e,r)=>{Iu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ps(e,i,o,t)});function rl(e,r){return new tl({type:"intersection",left:e,right:r})}var nl=p("ZodTuple",(e,r)=>{et(),Tn.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>gs(e,i,o,t)},{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(r=>new Fr({type:"optional",innerType:r}))})}});function il(e,r,i){let o=r instanceof P,t=o?i:r,n=o?r:null;return new nl({type:"tuple",items:e,rest:n,...$.normalizeParams(t)})}var Lt=p("ZodRecord",(e,r)=>{et(),wu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>vs(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType});function ol(e,r,i){return!r||!r._zod?new Lt({type:"record",keyType:Tr(),valueType:e,...$.normalizeParams(r)}):new Lt({type:"record",keyType:e,valueType:r,...$.normalizeParams(i)})}function up(e,r,i){return new Lt({type:"record",keyType:e,valueType:r,...$.normalizeParams(i),partial:!0})}function cp(e,r,i){return new Lt({type:"record",keyType:e,valueType:r,mode:"loose",...$.normalizeParams(i)})}var al=p("ZodMap",(e,r)=>{et(),Su.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ls(e,i,o,t),e.keyType=r.keyType,e.valueType=r.valueType,e.min=(...i)=>e.check(he(...i)),e.nonempty=i=>e.check(he(1,i)),e.max=(...i)=>e.check(Oe(...i)),e.size=(...i)=>e.check(We(...i))});function sp(e,r,i){return new al({type:"map",keyType:e,valueType:r,...$.normalizeParams(i)})}var ul=p("ZodSet",(e,r)=>{et(),zu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ds(e,i,o,t),e.min=(...i)=>e.check(he(...i)),e.nonempty=i=>e.check(he(1,i)),e.max=(...i)=>e.check(Oe(...i)),e.size=(...i)=>e.check(We(...i))});function lp(e,r){return new ul({type:"set",valueType:e,...$.normalizeParams(r)})}var Rt=p("ZodEnum",(e,r)=>{Pu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(o,t,n)=>ts(e,o,t,n),e.enum=r.entries,e.options=[...e._zod.values];let i=new Set(Object.keys(r.entries));e.extract=(o,t)=>{let n={};for(let a of o)if(i.has(a))n[a]=r.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Rt({...r,checks:[],...$.normalizeParams(t),entries:n})},e.exclude=(o,t)=>{let n={...r.entries};for(let a of o)if(i.has(a))delete n[a];else throw new Error(`Key ${a} not found in enum`);return new Rt({...r,checks:[],...$.normalizeParams(t),entries:n})}});function Qi(e,r){let i=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Rt({type:"enum",entries:i,...$.normalizeParams(r)})}function dp(e,r){return new Rt({type:"enum",entries:e,...$.normalizeParams(r)})}var cl=p("ZodLiteral",(e,r)=>{Du.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>rs(e,i,o,t),e.values=new Set(r.values),Object.defineProperty(e,"value",{get(){if(r.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return r.values[0]}})});function fp(e,r){return new cl({type:"literal",values:Array.isArray(e)?e:[e],...$.normalizeParams(r)})}var sl=p("ZodFile",(e,r)=>{Ou.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>os(e,i,o,t),e.min=(i,o)=>e.check(he(i,o)),e.max=(i,o)=>e.check(Oe(i,o)),e.mime=(i,o)=>e.check(Ot(Array.isArray(i)?i:[i],o))});function mp(e){return Nc(sl,e)}var ll=p("ZodTransform",(e,r)=>{et(),ju.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ss(e,i,o,t),e._zod.parse=(i,o)=>{if(o.direction==="backward")throw new ze(e.constructor.name);i.addIssue=n=>{if(typeof n=="string")i.issues.push($.issue(n,i.value,r));else{let a=n;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=e),i.issues.push($.issue(a))}};let t=r.transform(i.value,i);return t instanceof Promise?t.then(n=>(i.value=n,i)):(i.value=t,i)}});function eo(e){return new ll({type:"transform",transform:e})}var Fr=p("ZodOptional",(e,r)=>{Zn.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Si(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Qe(e){return new Fr({type:"optional",innerType:e})}var to=p("ZodExactOptional",(e,r)=>{Nu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Si(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function dl(e){return new to({type:"optional",innerType:e})}var fl=p("ZodNullable",(e,r)=>{Uu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>$s(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Zr(e){return new fl({type:"nullable",innerType:e})}function pp(e){return Qe(Zr(e))}var ml=p("ZodDefault",(e,r)=>{Au.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>_s(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function pl(e,r){return new ml({type:"default",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}var gl=p("ZodPrefault",(e,r)=>{Tu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>bs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function vl(e,r){return new gl({type:"prefault",innerType:e,get defaultValue(){return typeof r=="function"?r():$.shallowClone(r)}})}var ro=p("ZodNonOptional",(e,r)=>{Zu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>hs(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function $l(e,r){return new ro({type:"nonoptional",innerType:e,...$.normalizeParams(r)})}var hl=p("ZodSuccess",(e,r)=>{Cu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>as(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function gp(e){return new hl({type:"success",innerType:e})}var yl=p("ZodCatch",(e,r)=>{Eu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ks(e,i,o,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _l(e,r){return new yl({type:"catch",innerType:e,catchValue:typeof r=="function"?r:$.constantCatch(r)})}var bl=p("ZodNaN",(e,r)=>{Lu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ns(e,i,o,t)});function vp(e){return Oc(bl,e)}var Mr=p("ZodPipe",(e,r)=>{Cn.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>xs(e,i,o,t),e.in=r.in,e.out=r.out});function Ni(e,r){return new Mr({type:"pipe",in:e,out:r})}var Jr=p("ZodCodec",(e,r)=>{Mr.init(e,r),br.init(e,r)});function $p(e,r,i){return new Jr({type:"pipe",in:e,out:r,transform:i.decode,reverseTransform:i.encode})}function hp(e){let r=e._zod.def;return new Jr({type:"pipe",in:r.out,out:r.in,transform:r.reverseTransform,reverseTransform:r.transform})}var kl=p("ZodPreprocess",(e,r)=>{Mr.init(e,r),Ru.init(e,r)}),xl=p("ZodReadonly",(e,r)=>{Vu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Is(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function Il(e){return new xl({type:"readonly",innerType:e})}var wl=p("ZodTemplateLiteral",(e,r)=>{Fu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>is(e,i,o,t)});function yp(e,r){return new wl({type:"template_literal",parts:e,...$.normalizeParams(r)})}var Sl=p("ZodLazy",(e,r)=>{kr.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>Ss(e,i,o,t),e.unwrap=()=>e._zod.def.getter()});function zl(e){return new Sl({type:"lazy",getter:e})}var Pl=p("ZodPromise",(e,r)=>{Ju.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>ws(e,i,o,t),e.unwrap=()=>e._zod.def.innerType});function _p(e){return new Pl({type:"promise",innerType:e})}var Dl=p("ZodFunction",(e,r)=>{Mu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>cs(e,i,o,t)});function bp(e){return new Dl({type:"function",input:Array.isArray(e?.input)?il(e?.input):e?.input??Lr(Ye()),output:e?.output??Ye()})}var Br=p("ZodCustom",(e,r)=>{Bu.init(e,r),O.init(e,r),e._zod.processJSONSchema=(i,o,t)=>us(e,i,o,t)});function kp(e){let r=new L({check:"custom"});return r._zod.check=e,r}function xp(e,r){return Uc(Br,e??(()=>!0),r)}function Ol(e,r={}){return Ac(Br,e,r)}function jl(e,r){return Tc(e,r)}var Ip=Zc,wp=Cc,Nl=p("ZodInstanceOf",(e,r)=>{Br.init(e,r)},{properties(e,r){return this.check(Dt(e,r))}});function Sp(e,r={}){let i=new Nl({type:"custom",check:"custom",fn:o=>o instanceof e,abort:!0,...$.normalizeParams(r)});return i._zod.bag.Class=e,i._zod.check=o=>{o.value instanceof e||o.issues.push({code:"invalid_type",expected:e.name,input:o.value,inst:i,path:[...i._zod.def.path??[]]})},i}var zp=(...e)=>Ec({Codec:Jr,Boolean:Mt,String:Vt},...e);function Pp(e){let r=zl(()=>Bt([Tr(e),Fs(),Ms(),Gs(),Lr(r),ol(Tr(),r)]));return r}function Dp(e,r){return new kl({type:"pipe",in:eo(e),out:r})}var by={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 ky(e){F({customError:e})}function xy(){return F().customError}var Ul;Ul||(Ul={});var Kr={};ge(Kr,{ZodISODate:()=>Te,ZodISODateTime:()=>Ae,ZodISODuration:()=>Ce,ZodISOTime:()=>Ze,date:()=>wy,datetime:()=>Iy,duration:()=>zy,time:()=>Sy});function Iy(e){return Dr(Ae,e)}function wy(e){return Or(Te,e)}function Sy(e){return jr(Ze,e)}function zy(e){return Nr(Ce,e)}var x={...Kt,...Di,iso:Kr},Py=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 Dy(e,r){let i=e.$schema;return i==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":i==="http://json-schema.org/draft-07/schema#"?"draft-7":i==="http://json-schema.org/draft-04/schema#"?"draft-4":r??"draft-2020-12"}function Op(e,r){return e.map((i,o)=>o<r?i:i.optional())}function Oy(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function jy(e,r){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let i=e.slice(1).split("/").filter(Boolean);if(i.length===0)return r.rootSchema;let o=r.version==="draft-2020-12"?"$defs":"definitions";if(i[0]===o){let t=i[1]===void 0?void 0:Oy(i[1]);if(!t||!r.defs[t])throw new Error(`Reference not found: ${e}`);return r.defs[t]}throw new Error(`Reference not found: ${e}`)}function Ny(e,r){return x.transform(o=>o).check(o=>{let t=o.value;if(typeof t!="object"||t===null||Array.isArray(t))return;let n=Object.getOwnPropertyNames(t);if(r.minProperties!==void 0&&n.length<r.minProperties&&o.issues.push({origin:"object",code:"too_small",minimum:r.minProperties,inclusive:!0,message:`Too small: expected object to have >=${r.minProperties} properties`,input:t,inst:e,continue:!0}),r.maxProperties!==void 0&&n.length>r.maxProperties&&o.issues.push({origin:"object",code:"too_big",maximum:r.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${r.maxProperties} properties`,input:t,inst:e,continue:!0}),r.keySchema)for(let a of n){let u=r.keySchema.safeParse(a);u.success||o.issues.push({code:"invalid_key",origin:"record",issues:u.error.issues,input:a,path:[a],continue:!0})}}).pipe(e)}function Al(e,r){if(e===null)return"z";let i=typeof e;if(i!=="object"){if(i==="number"&&Number.isNaN(e))return null;let o=String(e);return`${i[0]}${o.length}:${o}`}if(r.has(e))return null;r.add(e);try{if(Array.isArray(e)){let n=[];for(let a of e){let u=Al(a,r);if(u===null)return null;n.push(u)}return`a${n.length}:[${n.join(",")}]`}let o=Object.keys(e).sort(),t=[];for(let n of o){let a=Al(e[n],r);if(a===null)return null;t.push(`${n.length}:${n}=${a}`)}return`o${t.length}:{${t.join(",")}}`}finally{r.delete(e)}}var Uy=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Ay=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(([r,i])=>Uy.has(r)?Gr(i):!Ay.has(r)||typeof i!="object"||i===null?!1:Object.values(i).some(Gr))}function jp(e){return e===1?"element":"elements"}function Ty(e,r){return x.transform(o=>o).check(o=>{let t=o.value;if(Array.isArray(t)){if(r.uniqueItems===!0){let n=new Map;for(let a=0;a<t.length;a++){let u=Al(t[a],new Set);if(u===null)continue;let s=n.get(u);if(s===void 0){n.set(u,a);continue}o.issues.push({code:"custom",message:`Array items must be unique: element at index ${a} duplicates the one at index ${s}`,input:t,path:[a],continue:!0})}}if(r.containsSchema){let n=r.minContains??1,a=r.maxContains!==void 0?r.maxContains+1:Number.POSITIVE_INFINITY,u=0;for(let s of t)if(r.containsSchema.safeParse(s).success&&++u>=a)break;u<n&&o.issues.push({code:"custom",message:`Array must contain at least ${n} matching ${jp(n)}; found ${u}`,input:t,continue:!0}),r.maxContains!==void 0&&u>r.maxContains&&o.issues.push({code:"custom",message:`Array must contain at most ${r.maxContains} matching ${jp(r.maxContains)}`,input:t,continue:!0})}}}).pipe(e)}function Np(e,r){if(e!==!1)return e===void 0||e===!0?x.any():te(e,r)}var Zy=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Up(e,r){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return x.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 t=e.$ref;if(r.refs.has(t))return r.refs.get(t);if(r.processing.has(t))return x.lazy(()=>{if(!r.refs.has(t))throw new Error(`Circular reference not resolved: ${t}`);return r.refs.get(t)});r.processing.add(t);let n=jy(t,r),a=te(n,r);return r.refs.set(t,a),r.processing.delete(t),a}if(e.enum!==void 0){let t=e.enum;if(r.version==="openapi-3.0"&&e.nullable===!0&&t.length===1&&t[0]===null)return x.null();if(t.length===0)return x.never();if(t.length===1)return x.literal(t[0]);if(t.every(a=>typeof a=="string"))return x.enum(t);let n=t.map(a=>x.literal(a));return n.length<2?n[0]:x.union([n[0],n[1],...n.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let i=e.type;if(Array.isArray(i)){let t=i.map(n=>{let a={...e,type:n};return Up(a,r)});return t.length===0?x.never():t.length===1?t[0]:x.union(t)}if(!i)return x.any();let o;switch(i){case"string":{let t=x.string();if(e.format){let n=e.format;n==="email"?t=t.check(x.email()):n==="uri"||n==="uri-reference"?t=t.check(x.url()):n==="uuid"||n==="guid"?t=t.check(x.uuid()):n==="date-time"?t=t.check(x.iso.datetime({offset:!0})):n==="date"?t=t.check(x.iso.date()):n==="time"?t=t.check(x.regex(Zy)):n==="duration"?t=t.check(x.iso.duration()):n==="hostname"?t=t.check(x.hostname()):n==="ipv4"?t=t.check(x.ipv4()):n==="ipv6"?t=t.check(x.ipv6()):n==="mac"?t=t.check(x.mac()):n==="cidr"?t=t.check(x.cidrv4()):n==="cidr-v6"?t=t.check(x.cidrv6()):n==="base64"?t=t.check(x.base64()):n==="base64url"?t=t.check(x.base64url()):n==="e164"?t=t.check(x.e164()):n==="credit_card"?t=t.check(x.creditCard()):n==="iban"?t=t.check(x.iban()):n==="jwt"?t=t.check(x.jwt()):n==="emoji"?t=t.check(x.emoji()):n==="nanoid"?t=t.check(x.nanoid()):n==="cuid"?t=t.check(x.cuid()):n==="cuid2"?t=t.check(x.cuid2()):n==="ulid"?t=t.check(x.ulid()):n==="xid"?t=t.check(x.xid()):n==="ksuid"&&(t=t.check(x.ksuid()))}typeof e.minLength=="number"&&(t=t.min(e.minLength)),typeof e.maxLength=="number"&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),o=t;break}case"number":case"integer":{let t=i==="integer"?x.number().int():x.number();typeof e.minimum=="number"&&e.exclusiveMinimum!==!0&&(t=t.min(e.minimum)),typeof e.maximum=="number"&&e.exclusiveMaximum!==!0&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum=="number"?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(t=t.lt(e.maximum)),typeof e.multipleOf=="number"&&(t=t.multipleOf(e.multipleOf)),o=t;break}case"boolean":{o=x.boolean();break}case"null":{o=x.null();break}case"object":{let t={},n=e.properties||{},a=new Set(e.required||[]),u=typeof e.additionalProperties=="object"?te(e.additionalProperties,r):void 0;for(let[d,f]of Object.entries(n)){let m=te(f,r);K(t,d,a.has(d)?m:m.optional())}if(e.patternProperties){let d=e.patternProperties,f=Object.keys(d),m=[];for(let _ of f){let k=te(d[_],r),S=x.string().regex(new RegExp(_));m.push(x.looseRecord(S,k))}let v=[];if(Object.keys(t).length>0&&v.push(x.object(t).passthrough()),v.push(...m),v.length===0)o=x.object({}).passthrough();else if(v.length===1)o=v[0];else{let _=x.intersection(v[0],v[1]);for(let k=2;k<v.length;k++)_=x.intersection(_,v[k]);o=_}if(e.additionalProperties===!1){let _=Object.keys(t),k=f.map(I=>new RegExp(I)),S=o;o=o.check(I=>{if(!se(I.value))return;let D=[];for(let A of Object.keys(I.value))_.includes(A)||k.some(R=>R.test(A))||D.push(A);D.length&&I.issues.push({code:"unrecognized_keys",keys:D,input:I.value,inst:S})})}}else{let d=x.object(t);e.additionalProperties===!1?o=d.strict():u?o=d.catchall(u):o=d.passthrough()}let s=e.propertyNames!==void 0&&e.propertyNames!==!0,c=typeof e.minProperties=="number"?e.minProperties:void 0,l=typeof e.maxProperties=="number"?e.maxProperties:void 0;if(s||c!==void 0||l!==void 0){let d;if(s){let f=typeof e.propertyNames=="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=te(f,r)}o=Ny(o,{keySchema:d,minProperties:c,maxProperties:l})}break}case"array":{let t=e.prefixItems,n=e.items;if(t&&Array.isArray(t)){let a=typeof e.minItems=="number"?e.minItems:0,u=t.map(d=>te(d,r)),s=Op(u,a),c=Array.isArray(n)?void 0:Np(n,r),l=x.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(x.maxLength(e.maxItems)))}else if(Array.isArray(n)){let a=typeof e.minItems=="number"?e.minItems:0,u=n.map(d=>te(d,r)),s=Op(u,a),c=Np(e.additionalItems,r),l=x.tuple(s);o=c?l.rest(c):l,typeof e.minItems=="number"&&(o=o.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(o=o.check(x.maxLength(e.maxItems)))}else if(n!==void 0){let a=te(n,r),u=x.array(a);typeof e.minItems=="number"&&(u=u.min(e.minItems)),typeof e.maxItems=="number"&&(u=u.max(e.maxItems)),o=u}else o=x.array(x.any());(e.uniqueItems===!0||e.contains!==void 0)&&(o=Ty(o,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?te(e.contains,r):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: ${i}`)}return o}function te(e,r){if(typeof e=="boolean")return e?x.any():x.never();let i=Up(e,r),o=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let u=e.anyOf.map(c=>te(c,r)),s=x.union(u);i=o?x.intersection(i,s):s}if(e.oneOf&&Array.isArray(e.oneOf)){let u=e.oneOf.map(c=>te(c,r)),s=x.xor(u);i=o?x.intersection(i,s):s}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)i=o?i:x.any();else{let u=o?i:te(e.allOf[0],r),s=o?0:1;for(let c=s;c<e.allOf.length;c++)u=x.intersection(u,te(e.allOf[c],r));i=u}e.nullable===!0&&r.version==="openapi-3.0"&&(i=x.nullable(i)),e.readOnly===!0&&(i=x.readonly(i)),e.default!==void 0&&(i=i.default(e.default));let t={},n=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let u of n)u in e&&(t[u]=e[u]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let u of a)u in e&&(t[u]=e[u]);if(e.type==="object"&&e.$ref===void 0){e.propertyNames!==void 0&&!Gr(e.propertyNames)&&(t.propertyNames=e.propertyNames);for(let u of["minProperties","maxProperties"])e[u]!==void 0&&(t[u]=e[u])}if(e.type==="array"&&e.$ref===void 0){e.contains!==void 0&&!Gr(e.contains)&&(t.contains=e.contains);for(let u of["uniqueItems","minContains","maxContains"])e[u]!==void 0&&(t[u]=e[u])}for(let u of Object.keys(e))Py.has(u)||K(t,u,e[u]);return Object.keys(t).length>0&&r.registry.add(i,t),e.description&&(i=i.describe(e.description)),i}function Ap(e,r){if(typeof e=="boolean")return e?x.any():x.never();let i;try{i=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let o=Dy(i,r?.defaultTarget),t=i.$defs||i.definitions||{},n={version:o,defs:t,refs:new Map,processing:new Set,rootSchema:i,registry:r?.registry??G};return te(i,n)}var Tp=Symbol("z.visit/resolving");function Wr(e,r){let i=typeof r=="function"?r:(a,u)=>{let s=r[a._zod.def.type];return s?s(a,u):a},o=new Map;function t(a){let u=o.get(a);if(u===Tp)return new kr({type:"lazy",getter:()=>o.get(a)});if(u!==void 0)return u;o.set(a,Tp);let s=n(a),c=i(s,s!==a);return o.set(a,c),c}function n(a){let u=a._zod.def,s=u.type;switch(s){case"object":{let c=u.shape,l=Object.keys(c),d=!1,f={};for(let v of l){let _=t(c[v]);_!==c[v]&&(d=!0),f[v]=_}let m=u.catchall;return u.catchall&&(m=t(u.catchall),m!==u.catchall&&(d=!0)),d?T(a,{...u,shape:f,catchall:m}):a}case"array":{let c=t(u.element);return c===u.element?a:T(a,{...u,element:c})}case"tuple":{let c=u.items,l=!1,d=[];for(let m of c){let v=t(m);v!==m&&(l=!0),d.push(v)}let f=u.rest;return u.rest&&(f=t(u.rest),f!==u.rest&&(l=!0)),l?T(a,{...u,items:d,rest:f}):a}case"record":case"map":{let c=t(u.keyType),l=t(u.valueType);return c===u.keyType&&l===u.valueType?a:T(a,{...u,keyType:c,valueType:l})}case"set":{let c=t(u.valueType);return c===u.valueType?a:T(a,{...u,valueType:c})}case"union":{let c=u.options,l=!1,d=[];for(let f of c){let m=t(f);m!==f&&(l=!0),d.push(m)}return l?T(a,{...u,options:d}):a}case"intersection":{let c=t(u.left),l=t(u.right);return c===u.left&&l===u.right?a:T(a,{...u,left:c,right:l})}case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":{let c=t(u.innerType);return c===u.innerType?a:T(a,{...u,innerType:c})}case"pipe":{let c=t(u.in),l=t(u.out);return c===u.in&&l===u.out?a:T(a,{...u,in:c,out:l})}case"function":{let c=t(u.input),l=t(u.output);return c===u.input&&l===u.output?a:T(a,{...u,input:c,output:l})}case"lazy":{let c=u.getter,{_cachedInner:l,...d}=u;return T(a,{...d,getter:()=>t(c())})}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 a;default:return a}}return t(e)}function Zp(e){return Wr(e,{object:r=>r.partial(),union:r=>{let i=r._zod.def;return i.discriminator===void 0?r:Bt(i.options)}})}function Cy(e,r){if(!r?.length)return e;let i=e._zod.def;return T(e,fe(i,{checks:[...i.checks??[],...r]}),{parent:!0})}function Cp(e){return Cy(e.out,e.checks)}function Ey(e){return e.in._zod.traits.has("$ZodTransform")?Cp(e):e.in}function Ep(e){return Wr(e,{pipe:r=>Ey(r._zod.def),default:(r,i)=>i?Qe(r._zod.def.innerType):r,catch:(r,i)=>i?r._zod.def.innerType:r})}function Lp(e){return Wr(e,{pipe:r=>Cp(r._zod.def),prefault:(r,i)=>i?r._zod.def.innerType:r})}var Tl={};ge(Tl,{bigint:()=>Fy,boolean:()=>Vy,date:()=>My,number:()=>Ry,string:()=>Ly});function Ly(e){return nc(Vt,e)}function Ry(e){return sc(Ft,e)}function Vy(e){return vc(Mt,e)}function Fy(e){return hc(Jt,e)}function My(e){return Dc(Er,e)}var Rp="control-office",nt={interval:300,pageSize:100,actionRecordLimit:1e3,syncTimeoutSeconds:3600},it=W.string().regex(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/i),Ee=W.iso.datetime({offset:!0}),Vp=W.object({url:W.url().refine(e=>{let r=new URL(e);return r.protocol==="https:"&&!r.username&&!r.password&&!r.search&&!r.hash&&(r.pathname==="/"||r.pathname==="")},"url must be an HTTPS tenant origin without credentials, query or path"),apiKey:W.string().trim().min(1).refine(e=>!/[\r\n]/.test(e)),retrievers:W.array(W.string()).optional(),interval:W.number().int().min(1).default(nt.interval),pageSize:W.number().int().min(1).max(1e3).default(nt.pageSize)}),Fp=W.object({id:it.optional(),modifiedFrom:Ee.optional()}).strict().refine(e=>!e.id||!e.modifiedFrom,"Use id or modifiedFrom, not both");var no=class{identifier;identifierField="Id";#e;#t;constructor(r,i){this.#e=r,this.#t=i,this.identifier=i.identifier}async run(r,i){let o=Fp.safeParse(r??{});if(!o.success)throw new ot("Invalid ControlOffice read inputs");let{id:t,modifiedFrom:n}=o.data;return i?{data:[],single:!1}:t?{data:[await this.#e.get(this.#t,t)],single:!0}:{data:await this.#r(n),single:!1}}pages(r){return this.#e.pages(this.#t,r)}async#r(r){let i=[];for await(let o of this.pages({from:r,until:new Date().toISOString()}))if(i.push(...o),i.length>nt.actionRecordLimit)throw new at(`ControlOffice read returns more than ${nt.actionRecordLimit} records; use a later modifiedFrom`);return i}};var Gt=class extends Error{};async function io(e,r,i,o){if(i.length===0)return;let t=await e.sender.documents(i,{collection:`${e.config.datasourceIdentifier??Rp}_${r.identifier}`,keyField:r.identifierField},o),n=typeof t=="boolean"?[t]:Object.values(t);if(n.length===0||!n.every(a=>a===!0))throw new Error("ControlOffice document ingestion failed")}var Jy={level:"priority"},oo=class{#e;#t;constructor(r,i){this.#e=r,this.#t=new Map(i.map(o=>[o.identifier,o]))}get callbackFunctionChain(){return async(r,i)=>{let o=i.config?.action,t=typeof o=="string"?this.#t.get(o):void 0;if(!t)return this.#e.receiver.responses.badRequest("Unknown ControlOffice read action")(r);try{return await this.#r(t,r)}catch(n){return this.#n(t,r,n)}}}async#r(r,i){let o=i.testRun===!0,t=await r.run(i.payload,o);return o?this.#e.receiver.responses.ok()(i):(await io(this.#e,r,t.data,Jy),this.#e.receiver.emitEventType(this.#e.receiver.responses.ok())({...i,payload:t.single?t.data[0]:t.data}))}#n(r,i,o){let{responses:t}=this.#e.receiver;return o instanceof ot||o instanceof at?t.badRequest(o.message)(i):o instanceof Gt?t.notFound("ControlOffice record was not found")(i):(this.#e.logger.error(`[ControlOffice] ${r.identifier} read failed: ${o instanceof Error?o.message:"unknown error"}`),t.internalServerError("ControlOffice read failed; check connector logs")(i))}};var ao=class{#e;#t;#r=!1;constructor(r,i){this.#e=r,this.#t=i}get name(){return`control-office-extractor-${this.#t.identifier}`}get#n(){return`offset_${this.#t.identifier}`}async onRun(){if(this.#r){this.#e.logger.warn(`[ControlOffice] previous ${this.#t.identifier} sync still running; skipping this run`);return}this.#r=!0;try{await this.#i()}catch(r){throw this.#e.logger.error(`[ControlOffice] ${this.#t.identifier} sync failed: ${r instanceof Error?r.message:"unknown error"}`),r}finally{this.#r=!1}}async#i(){let r=new Date().toISOString(),i=await this.#o(r);for await(let o of this.#t.pages(i)){await io(this.#e,this.#t,o);let t=o[o.length-1];t&&(this.#e.offsetStore.setOffset({timestamp:Date.parse(t.Modified),rawTimestamp:t.Modified,id:t.Id,cursorVersion:1},this.#n),await this.#e.offsetStore.flush())}}async#o(r){let i=await this.#e.offsetStore.getOffset(this.#n);if(i===void 0||i.id===0)return{until:r};let{timestamp:o}=i;if(typeof o!="number"||!Number.isFinite(o)||o<0)throw new Error("ControlOffice stored offset is invalid");if(i.cursorVersion===void 0)return{from:new Date(o).toISOString(),until:r};let t=Ee.safeParse(i.rawTimestamp),n=it.safeParse(i.id);if(i.cursorVersion!==1||!t.success||!n.success||Date.parse(t.data)!==o)throw new Error("ControlOffice stored cursor is invalid");return{after:{modified:t.data,id:n.data},until:r}}};var Mp=1e4,By=300,Ky=W.object({Id:it,Modified:Ee}).passthrough(),Jp=W.object({value:W.array(Ky)});function Gy(e){return typeof e=="object"&&e!==null&&"status"in e&&typeof e.status=="number"?e.status:"unknown"}function Wy(e){return e instanceof Error?e.message:typeof e=="object"&&e!==null&&"error"in e&&typeof e.error=="string"?e.error:""}var uo=class{#e;#t;constructor(r,i){this.#e=r,this.#t=i}async*pages(r,i){Ee.parse(i.until),i.from&&Ee.parse(i.from),i.after&&(Ee.parse(i.after.modified),it.parse(i.after.id));let o=i.after,t;for(let n=0;n<Mp;n+=1){let a=Jp.parse(await this.#i(this.#r(r,i,o))),[u]=a.value;if(!u)return;let s=`${u.Modified}|${u.Id}`;if(s===t)throw new Error("ControlOffice ignored the cursor and repeated a page");t=s,yield a.value;let c=a.value[a.value.length-1];o={modified:c.Modified,id:c.Id}}throw new Error(`ControlOffice pagination exceeded ${Mp} pages`)}async get(r,i){it.parse(i);let o=new URL(`/api/v1/${r.entity}`,this.#t.url);o.searchParams.set("$filter",`Id eq ${i}`),o.searchParams.set("$top","1");let[t]=Jp.parse(await this.#i(o)).value;if(!t)throw new Gt("ControlOffice record was not found");if(t.Id.toLowerCase()!==i.toLowerCase())throw new Error("ControlOffice lookup returned an unexpected record");return t}#r(r,i,o){let t=new URL(`/api/v1/${r.entity}`,this.#t.url),n=o?`(Modified gt ${o.modified} or (Modified eq ${o.modified} and Id gt ${o.id}))`:i.from&&`Modified ge ${i.from}`,a=[...n?[n]:[],`Modified le ${i.until}`];return t.searchParams.set("$top",String(this.#t.pageSize)),t.searchParams.set("$orderby","Modified asc,Id asc"),t.searchParams.set("$filter",a.join(" and ")),t}#n(r){let i=Wy(r).split(this.#t.apiKey).join("[redacted]").slice(0,By);return i?`: ${i}`:""}async#i(r){let i={headers:{"X-CO-ODATAAPIKEY":this.#t.apiKey,Accept:"application/json"},maxRedirects:0},o;try{o=await this.#e.get(`${r.pathname}${r.search}`,i)}catch(t){throw new Error(`ControlOffice GET failed (HTTP ${Gy(t)})${this.#n(t)}`)}if(o.status<200||o.status>=300)throw new Error(`ControlOffice GET failed (HTTP ${o.status})`);return o.data}};var Zl=[{entity:"Workorder",identifier:"get-workorders"},{entity:"Request",identifier:"get-requests"},{entity:"Object",identifier:"get-objects"},{entity:"Meter",identifier:"get-meters"},{entity:"MeterReading",identifier:"get-meter-readings"},{entity:"HourBooking",identifier:"get-hour-bookings"},{entity:"WorkorderActivity",identifier:"get-workorder-activities"},{entity:"WorkorderEmployee",identifier:"get-workorder-employees"},{entity:"WorkorderObject",identifier:"get-workorder-objects"},{entity:"RequestObject",identifier:"get-request-objects"},{entity:"ObjectMeter",identifier:"get-object-meters"},{entity:"Employee",identifier:"get-employees"},{entity:"Status",identifier:"get-statuses"},{entity:"Priority",identifier:"get-priorities"},{entity:"ObjectType",identifier:"get-object-types"},{entity:"Unit",identifier:"get-units"},{entity:"RequestOrWorkorderType",identifier:"get-request-or-workorder-types"}];function Xy(e){return e.issues.map(r=>`${r.path.join(".")||"config"}: ${r.message}`).join("; ")}var Cl=class extends qr{init=async()=>{let r=this.#e(),i=new uo(this.connectorSDK.httpClient({baseUrl:r.url}),r),o=Zl.map(n=>new no(i,n)),t=r.retrievers??o.map(n=>n.identifier);this.callbackFunction=new oo(this.connectorSDK,o).callbackFunctionChain,await Promise.all(o.filter(n=>t.includes(n.identifier)).map(n=>this.connectorSDK.processing.registerInterval(r.interval,new ao(this.connectorSDK,n),{immediate:!0,timeout:nt.syncTimeoutSeconds})))};#e(){let r=Vp.safeParse(this.connectorSDK.config);if(!r.success)throw new Error(`Invalid ControlOffice configuration: ${Xy(r.error)}`);let i=new Set(Zl.map(t=>t.identifier)),o=(r.data.retrievers??[]).filter(t=>!i.has(t));if(o.length>0)throw new Error(`Unknown ControlOffice retrievers in configuration: ${o.join(", ")}`);return r.data}};0&&(module.exports={ConnectorRunnerControlOffice});
|
|
63
63
|
//# sourceMappingURL=index.cjs.map
|