@reqvire-org/ads 0.3.36 → 0.3.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -8
- package/dist/bootstrap-ds/README.md +8 -9
- package/dist/bootstrap-ds/ds.config.json +1 -8
- package/dist/bootstrap-ds/package.json +4 -3
- package/dist/bootstrap-ds/scripts/build-mcp-previews.mjs +2 -32
- package/dist/bun-compiler.mjs +13 -0
- package/dist/bun-worker.mjs +9 -0
- package/dist/check.mjs +7 -4
- package/dist/cli.mjs +20 -8
- package/dist/config.mjs +24 -4
- package/dist/development-runtime.mjs +3 -1
- package/dist/init.mjs +16 -18
- package/dist/mcp/build-status.mjs +6 -4
- package/dist/mcp/context.mjs +9 -4
- package/dist/mcp/drafts.mjs +4 -2
- package/dist/mcp/mutations.mjs +4 -14
- package/dist/mcp/preview-owner-guard.mjs +7 -4
- package/dist/mcp/preview-watch.mjs +21 -9
- package/dist/mcp/preview-widget.bundle.js +57 -63
- package/dist/mcp/preview-work.mjs +1 -15
- package/dist/mcp/project-widget.bundle.js +55 -61
- package/dist/mcp/prompts.mjs +2 -2
- package/dist/mcp/resource-loader.js +32 -10
- package/dist/mcp/server.mjs +94 -34
- package/dist/mcp/widget.bundle.js +58 -64
- package/dist/preview-builder.mjs +17 -5
- package/dist/preview-bun.mjs +269 -0
- package/dist/preview-imports.mjs +73 -0
- package/dist/preview-resources.mjs +26 -14
- package/dist/resource-limits.mjs +146 -0
- package/dist/runtime-requirements.mjs +21 -0
- package/dist/scenario-inspector.mjs +11 -4
- package/dist/scenarios-compiler.mjs +51 -9
- package/dist/showcase/client.bundle.js +66 -71
- package/dist/showcase/index.html +2 -2
- package/dist/showcase/sandbox.bundle.js +1 -1
- package/dist/showcase/style.css +4 -0
- package/dist/skills/ads-break-ui/SKILL.md +42 -42
- package/dist/skills/ads-break-ui/references/drafts.md +6 -3
- package/dist/skills/ads-break-ui/references/guarded-editing.md +4 -3
- package/dist/skills/ads-break-ui/references/runtimes.md +175 -140
- package/dist/skills/ads-break-ui/references/validation.md +13 -3
- package/dist/skills/ads-break-ui/references/workflows.md +82 -0
- package/dist/skills/ads-designer/SKILL.md +41 -41
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +8 -9
- package/dist/skills/ads-designer/assets/bootstrap-ds/ds.config.json +1 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +4 -3
- package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +2 -32
- package/dist/skills/ads-designer/references/cli.md +25 -21
- package/dist/skills/ads-designer/references/drafts.md +6 -3
- package/dist/skills/ads-designer/references/guarded-editing.md +4 -3
- package/dist/skills/ads-designer/references/runtimes.md +175 -140
- package/dist/skills/ads-designer/references/validation.md +13 -3
- package/dist/skills/ads-designer/references/workflows.md +82 -0
- package/dist/skills/ads-import/SKILL.md +43 -44
- package/dist/skills/ads-import/references/cli.md +25 -21
- package/dist/skills/ads-import/references/drafts.md +6 -3
- package/dist/skills/ads-import/references/guarded-editing.md +4 -3
- package/dist/skills/ads-import/references/runtimes.md +175 -140
- package/dist/skills/ads-import/references/validation.md +13 -3
- package/dist/skills/ads-import/references/workflows.md +82 -0
- package/dist/skills/ads-motion/SKILL.md +40 -40
- package/dist/skills/ads-motion/references/drafts.md +6 -3
- package/dist/skills/ads-motion/references/guarded-editing.md +4 -3
- package/dist/skills/ads-motion/references/runtimes.md +175 -140
- package/dist/skills/ads-motion/references/validation.md +13 -3
- package/dist/skills/ads-motion/references/workflows.md +82 -0
- package/dist/skills/ads-port/SKILL.md +40 -40
- package/dist/skills/ads-port/references/cli.md +25 -21
- package/dist/skills/ads-port/references/drafts.md +6 -3
- package/dist/skills/ads-port/references/guarded-editing.md +4 -3
- package/dist/skills/ads-port/references/runtimes.md +175 -140
- package/dist/skills/ads-port/references/validation.md +13 -3
- package/dist/skills/ads-port/references/workflows.md +82 -0
- package/dist/usage.mjs +84 -0
- package/dist/validation.mjs +0 -12
- package/dist/verification/browser.mjs +77 -48
- package/docs/ADS.md +17 -11
- package/docs/ARCHITECTURE.md +43 -29
- package/docs/BEHAVIORS.md +3 -3
- package/docs/CHANGELOG.md +81 -13
- package/docs/GUIDE.md +96 -53
- package/docs/MCP.md +117 -123
- package/docs/benchmarks/bun-previews.md +91 -0
- package/docs/benchmarks/gidi-preview-memory.md +4 -0
- package/package.json +16 -14
|
@@ -1,74 +1,77 @@
|
|
|
1
|
-
var V_=Object.defineProperty;var et=(e,t)=>{for(var o in t)V_(e,o,{get:t[o],enumerable:!0})};var H_=Object.create,Aa=Object.defineProperty,F_=Object.getOwnPropertyDescriptor,J_=Object.getOwnPropertyNames,B_=Object.getPrototypeOf,G_=Object.prototype.hasOwnProperty,If=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Of=(e,t)=>{let o={};for(var r in e)Aa(o,r,{get:e[r],enumerable:!0});return t&&Aa(o,Symbol.toStringTag,{value:"Module"}),o},W_=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=J_(t),s=0,i=n.length,c;s<i;s++)c=n[s],!G_.call(e,c)&&c!==o&&Aa(e,c,{get:(l=>t[l]).bind(null,c),enumerable:!(r=F_(t,c))||r.enumerable});return e},Nf=(e,t,o)=>(o=e!=null?H_(B_(e)):{},W_(t||!e||!e.__esModule?Aa(o,"default",{value:e,enumerable:!0}):o,e));var K_=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function Af(e){return typeof e=="string"&&K_.has(e.replace(/#$/,""))}var d={};et(d,{$brand:()=>eu,$input:()=>zp,$output:()=>vp,NEVER:()=>Vn,TimePrecision:()=>Pp,ZodAny:()=>dm,ZodArray:()=>fm,ZodBase64:()=>cl,ZodBase64URL:()=>ll,ZodBigInt:()=>yr,ZodBigIntFormat:()=>pl,ZodBoolean:()=>_r,ZodCIDRv4:()=>il,ZodCIDRv6:()=>al,ZodCUID:()=>Xc,ZodCUID2:()=>el,ZodCatch:()=>Am,ZodCodec:()=>_s,ZodCustom:()=>ys,ZodCustomStringFormat:()=>gr,ZodDate:()=>ms,ZodDefault:()=>Em,ZodDiscriminatedUnion:()=>Sm,ZodE164:()=>ul,ZodEmail:()=>Wc,ZodEmoji:()=>Yc,ZodEnum:()=>hr,ZodError:()=>Ib,ZodExactOptional:()=>Pm,ZodFile:()=>Rm,ZodFirstPartyTypeKind:()=>Bm,ZodFunction:()=>Hm,ZodGUID:()=>us,ZodIPv4:()=>nl,ZodIPv6:()=>sl,ZodISODate:()=>Vc,ZodISODateTime:()=>Dc,ZodISODuration:()=>Fc,ZodISOTime:()=>Hc,ZodIntersection:()=>_m,ZodIssueCode:()=>Gm,ZodJWT:()=>dl,ZodKSUID:()=>rl,ZodLazy:()=>Dm,ZodLiteral:()=>wm,ZodMAC:()=>am,ZodMap:()=>vm,ZodNaN:()=>qm,ZodNanoID:()=>Qc,ZodNever:()=>hm,ZodNonOptional:()=>Sl,ZodNull:()=>um,ZodNullable:()=>km,ZodNumber:()=>Sr,ZodNumberFormat:()=>ao,ZodObject:()=>fs,ZodOptional:()=>gl,ZodPipe:()=>Ss,ZodPrefault:()=>Cm,ZodPreprocess:()=>jm,ZodPromise:()=>Vm,ZodReadonly:()=>Lm,ZodRealError:()=>ve,ZodRecord:()=>pr,ZodSet:()=>zm,ZodString:()=>mr,ZodStringFormat:()=>J,ZodSuccess:()=>Nm,ZodSymbol:()=>cm,ZodTemplateLiteral:()=>Zm,ZodTransform:()=>xm,ZodTuple:()=>ym,ZodType:()=>q,ZodULID:()=>tl,ZodURL:()=>hs,ZodUUID:()=>He,ZodUndefined:()=>lm,ZodUnion:()=>gs,ZodUnknown:()=>pm,ZodVoid:()=>mm,ZodXID:()=>ol,ZodXor:()=>gm,_ZodString:()=>Gc,_default:()=>$m,_function:()=>SS,any:()=>hl,array:()=>g,base64:()=>Mg,base64url:()=>qg,bigint:()=>Gg,boolean:()=>R,catch:()=>Mm,check:()=>_S,cidrv4:()=>Ng,cidrv6:()=>Ag,clone:()=>me,codec:()=>hS,coerce:()=>bs,config:()=>Q,core:()=>rt,cuid:()=>Pg,cuid2:()=>Tg,custom:()=>yS,date:()=>eS,decode:()=>em,decodeAsync:()=>om,describe:()=>bS,discriminatedUnion:()=>kt,e164:()=>jg,email:()=>Kc,emoji:()=>Rg,encode:()=>Xh,encodeAsync:()=>tm,endsWith:()=>rr,enum:()=>I,exactOptional:()=>Tm,file:()=>lS,flattenError:()=>Yn,float32:()=>Hg,float64:()=>Fg,formatError:()=>Qn,fromJSONSchema:()=>PS,function:()=>SS,getErrorMap:()=>Ab,globalRegistry:()=>ne,gt:()=>De,gte:()=>ge,guid:()=>_g,hash:()=>Vg,hex:()=>Dg,hostname:()=>Zg,httpUrl:()=>wg,includes:()=>tr,instanceof:()=>zS,int:()=>Jc,int32:()=>Jg,int64:()=>Wg,intersection:()=>qe,invertCodec:()=>mS,ipv4:()=>Cg,ipv6:()=>Og,iso:()=>Pe,json:()=>RS,jwt:()=>Lg,keyof:()=>tS,ksuid:()=>$g,lazy:()=>Et,length:()=>so,literal:()=>S,locales:()=>ss,looseObject:()=>C,looseRecord:()=>sS,lowercase:()=>Xo,lt:()=>Ze,lte:()=>xe,mac:()=>Ig,map:()=>iS,maxLength:()=>no,maxSize:()=>Rt,meta:()=>vS,mime:()=>nr,minLength:()=>ot,minSize:()=>Ve,multipleOf:()=>wt,nan:()=>pS,nanoid:()=>xg,nativeEnum:()=>cS,negative:()=>Oc,never:()=>ml,nonnegative:()=>Ac,nonoptional:()=>Om,nonpositive:()=>Nc,normalize:()=>sr,null:()=>Fe,nullable:()=>ds,nullish:()=>uS,number:()=>b,object:()=>p,optional:()=>$,overwrite:()=>Me,parse:()=>Kh,parseAsync:()=>Yh,partialRecord:()=>nS,pipe:()=>Bc,positive:()=>Ic,prefault:()=>Im,preprocess:()=>nt,prettifyError:()=>mu,promise:()=>gS,property:()=>Mc,readonly:()=>Um,record:()=>w,refine:()=>Fm,regex:()=>Qo,regexes:()=>Re,registry:()=>dc,safeDecode:()=>nm,safeDecodeAsync:()=>im,safeEncode:()=>rm,safeEncodeAsync:()=>sm,safeParse:()=>ls,safeParseAsync:()=>Qh,set:()=>aS,setErrorMap:()=>Nb,size:()=>ro,slugify:()=>lr,startsWith:()=>or,strictObject:()=>oS,string:()=>a,stringFormat:()=>Ug,stringbool:()=>wS,success:()=>dS,superRefine:()=>Jm,symbol:()=>Yg,templateLiteral:()=>fS,toJSONSchema:()=>io,toLowerCase:()=>ar,toUpperCase:()=>cr,transform:()=>fl,treeifyError:()=>hu,trim:()=>ir,tuple:()=>bm,uint32:()=>Bg,uint64:()=>Kg,ulid:()=>kg,undefined:()=>Qg,union:()=>P,unknown:()=>E,uppercase:()=>er,url:()=>fr,util:()=>N,uuid:()=>yg,uuidv4:()=>bg,uuidv6:()=>vg,uuidv7:()=>zg,void:()=>Xg,xid:()=>Eg,xor:()=>rS});var rt={};et(rt,{$ZodAny:()=>Vd,$ZodArray:()=>Gd,$ZodAsyncError:()=>Ae,$ZodBase64:()=>Od,$ZodBase64URL:()=>Nd,$ZodBigInt:()=>sc,$ZodBigIntFormat:()=>Ld,$ZodBoolean:()=>os,$ZodCIDRv4:()=>$d,$ZodCIDRv6:()=>Cd,$ZodCUID:()=>_d,$ZodCUID2:()=>yd,$ZodCatch:()=>pp,$ZodCheck:()=>B,$ZodCheckBigIntFormat:()=>Gu,$ZodCheckEndsWith:()=>id,$ZodCheckGreaterThan:()=>Xa,$ZodCheckIncludes:()=>nd,$ZodCheckLengthEquals:()=>ed,$ZodCheckLessThan:()=>Qa,$ZodCheckLowerCase:()=>od,$ZodCheckMaxLength:()=>Qu,$ZodCheckMaxSize:()=>Wu,$ZodCheckMimeType:()=>cd,$ZodCheckMinLength:()=>Xu,$ZodCheckMinSize:()=>Ku,$ZodCheckMultipleOf:()=>Ju,$ZodCheckNumberFormat:()=>Bu,$ZodCheckOverwrite:()=>ld,$ZodCheckProperty:()=>ad,$ZodCheckRegex:()=>td,$ZodCheckSizeEquals:()=>Yu,$ZodCheckStartsWith:()=>sd,$ZodCheckStringFormat:()=>Yo,$ZodCheckUpperCase:()=>rd,$ZodCodec:()=>ns,$ZodCustom:()=>bp,$ZodCustomStringFormat:()=>qd,$ZodDate:()=>Bd,$ZodDefault:()=>cp,$ZodDiscriminatedUnion:()=>Yd,$ZodE164:()=>Ad,$ZodEmail:()=>md,$ZodEmoji:()=>gd,$ZodEncodeError:()=>_t,$ZodEnum:()=>op,$ZodError:()=>Kn,$ZodExactOptional:()=>ip,$ZodFile:()=>np,$ZodFunction:()=>Sp,$ZodGUID:()=>pd,$ZodIPv4:()=>Td,$ZodIPv6:()=>kd,$ZodISODate:()=>Rd,$ZodISODateTime:()=>wd,$ZodISODuration:()=>Pd,$ZodISOTime:()=>xd,$ZodIntersection:()=>Qd,$ZodJWT:()=>Md,$ZodKSUID:()=>zd,$ZodLazy:()=>yp,$ZodLiteral:()=>rp,$ZodMAC:()=>Ed,$ZodMap:()=>ep,$ZodNaN:()=>hp,$ZodNanoID:()=>Sd,$ZodNever:()=>Fd,$ZodNonOptional:()=>up,$ZodNull:()=>Dd,$ZodNullable:()=>ap,$ZodNumber:()=>nc,$ZodNumberFormat:()=>jd,$ZodObject:()=>pg,$ZodObjectJIT:()=>Wd,$ZodOptional:()=>ac,$ZodPipe:()=>cc,$ZodPrefault:()=>lp,$ZodPreprocess:()=>mp,$ZodPromise:()=>_p,$ZodReadonly:()=>fp,$ZodRealError:()=>be,$ZodRecord:()=>Xd,$ZodRegistry:()=>uc,$ZodSet:()=>tp,$ZodString:()=>oo,$ZodStringFormat:()=>F,$ZodSuccess:()=>dp,$ZodSymbol:()=>Ud,$ZodTemplateLiteral:()=>gp,$ZodTransform:()=>sp,$ZodTuple:()=>ic,$ZodType:()=>A,$ZodULID:()=>bd,$ZodURL:()=>fd,$ZodUUID:()=>hd,$ZodUndefined:()=>Zd,$ZodUnion:()=>rs,$ZodUnknown:()=>Hd,$ZodVoid:()=>Jd,$ZodXID:()=>vd,$ZodXor:()=>Kd,$brand:()=>eu,$constructor:()=>m,$input:()=>zp,$output:()=>vp,Doc:()=>ts,JSONSchema:()=>fg,JSONSchemaGenerator:()=>Uc,NEVER:()=>Vn,TimePrecision:()=>Pp,_any:()=>Bp,_array:()=>eh,_base64:()=>kc,_base64url:()=>Ec,_bigint:()=>Up,_boolean:()=>jp,_catch:()=>Rb,_check:()=>mg,_cidrv4:()=>Pc,_cidrv6:()=>Tc,_coercedBigint:()=>Zp,_coercedBoolean:()=>Lp,_coercedDate:()=>Qp,_coercedNumber:()=>Ip,_coercedString:()=>Rp,_cuid:()=>yc,_cuid2:()=>bc,_custom:()=>oh,_date:()=>Yp,_decode:()=>Va,_decodeAsync:()=>Fa,_default:()=>vb,_discriminatedUnion:()=>lb,_e164:()=>$c,_email:()=>pc,_emoji:()=>Sc,_encode:()=>Da,_encodeAsync:()=>Ha,_endsWith:()=>rr,_enum:()=>fb,_file:()=>th,_float32:()=>Np,_float64:()=>Ap,_gt:()=>De,_gte:()=>ge,_guid:()=>is,_includes:()=>tr,_int:()=>Op,_int32:()=>Mp,_int64:()=>Dp,_intersection:()=>ub,_ipv4:()=>Rc,_ipv6:()=>xc,_isoDate:()=>kp,_isoDateTime:()=>Tp,_isoDuration:()=>$p,_isoTime:()=>Ep,_jwt:()=>Cc,_ksuid:()=>wc,_lazy:()=>kb,_length:()=>so,_literal:()=>Sb,_lowercase:()=>Xo,_lt:()=>Ze,_lte:()=>xe,_mac:()=>xp,_map:()=>hb,_max:()=>xe,_maxLength:()=>no,_maxSize:()=>Rt,_mime:()=>nr,_min:()=>ge,_minLength:()=>ot,_minSize:()=>Ve,_multipleOf:()=>wt,_nan:()=>Xp,_nanoid:()=>_c,_nativeEnum:()=>gb,_negative:()=>Oc,_never:()=>Wp,_nonnegative:()=>Ac,_nonoptional:()=>zb,_nonpositive:()=>Nc,_normalize:()=>sr,_null:()=>Jp,_nullable:()=>bb,_number:()=>Cp,_optional:()=>yb,_overwrite:()=>Me,_parse:()=>Bo,_parseAsync:()=>Go,_pipe:()=>xb,_positive:()=>Ic,_promise:()=>Eb,_property:()=>Mc,_readonly:()=>Pb,_record:()=>pb,_refine:()=>rh,_regex:()=>Qo,_safeDecode:()=>Ba,_safeDecodeAsync:()=>Wa,_safeEncode:()=>Ja,_safeEncodeAsync:()=>Ga,_safeParse:()=>Wo,_safeParseAsync:()=>Ko,_set:()=>mb,_size:()=>ro,_slugify:()=>lr,_startsWith:()=>or,_string:()=>wp,_stringFormat:()=>ur,_stringbool:()=>ah,_success:()=>wb,_superRefine:()=>nh,_symbol:()=>Hp,_templateLiteral:()=>Tb,_toLowerCase:()=>ar,_toUpperCase:()=>cr,_transform:()=>_b,_trim:()=>ir,_tuple:()=>db,_uint32:()=>qp,_uint64:()=>Vp,_ulid:()=>vc,_undefined:()=>Fp,_union:()=>ab,_unknown:()=>Gp,_uppercase:()=>er,_url:()=>as,_uuid:()=>hc,_uuidv4:()=>mc,_uuidv6:()=>fc,_uuidv7:()=>gc,_void:()=>Kp,_xid:()=>zc,_xor:()=>cb,clone:()=>me,config:()=>Q,createStandardJSONSchemaMethod:()=>dr,createToJSONSchemaMethod:()=>ch,decode:()=>Ry,decodeAsync:()=>Py,describe:()=>sh,encode:()=>wy,encodeAsync:()=>xy,extractDefs:()=>Pt,finalize:()=>Tt,flattenError:()=>Yn,formatError:()=>Qn,globalConfig:()=>Xt,globalRegistry:()=>ne,initializeContext:()=>xt,isValidBase64:()=>Id,isValidBase64URL:()=>cg,isValidJWT:()=>lg,locales:()=>ss,meta:()=>ih,parse:()=>Ua,parseAsync:()=>Za,prettifyError:()=>mu,process:()=>H,regexes:()=>Re,registry:()=>dc,safeDecode:()=>ky,safeDecodeAsync:()=>$y,safeEncode:()=>Ty,safeEncodeAsync:()=>Ey,safeParse:()=>fu,safeParseAsync:()=>gu,toDotPath:()=>Zf,toJSONSchema:()=>io,treeifyError:()=>hu,util:()=>N,version:()=>ud});var Mf,Vn=Object.freeze({status:"aborted"});function m(e,t,o){function r(c,l){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:l,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,l);let u=i.prototype,h=Object.keys(u);for(let f=0;f<h.length;f++){let y=h[f];y in c||(c[y]=u[y].bind(c))}}let n=o?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(c){var l;let u=o?.Parent?new s:this;r(u,c),(l=u._zod).deferred??(l.deferred=[]);for(let h of u._zod.deferred)h();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>o?.Parent&&c instanceof o.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var eu=Symbol("zod_brand"),Ae=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},_t=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Mf=globalThis).__zod_globalConfig??(Mf.__zod_globalConfig={});var Xt=globalThis.__zod_globalConfig;function Q(e){return e&&Object.assign(Xt,e),Xt}var N={};et(N,{BIGINT_FORMAT_RANGES:()=>uu,Class:()=>ou,NUMBER_FORMAT_RANGES:()=>lu,aborted:()=>zt,allowsEval:()=>su,assert:()=>ty,assertEqual:()=>Y_,assertIs:()=>X_,assertNever:()=>ey,assertNotEqual:()=>Q_,assignProp:()=>bt,base64ToUint8Array:()=>jf,base64urlToUint8Array:()=>_y,cached:()=>Fo,captureStackTrace:()=>ja,cleanEnum:()=>Sy,cleanRegex:()=>Jn,clone:()=>me,cloneDef:()=>ry,createTransparentProxy:()=>ly,defineLazy:()=>L,esc:()=>qa,escapeRegex:()=>$e,explicitlyAborted:()=>du,extend:()=>py,finalizeIssue:()=>fe,floatSafeRemainder:()=>ru,getElementAtPath:()=>ny,getEnumValues:()=>Fn,getLengthableOrigin:()=>Wn,getParsedType:()=>cy,getSizableOrigin:()=>Gn,hexToUint8Array:()=>by,isObject:()=>eo,isPlainObject:()=>vt,issue:()=>Jo,joinValues:()=>Ma,jsonStringifyReplacer:()=>Ho,merge:()=>my,mergeDefs:()=>tt,normalizeParams:()=>z,nullish:()=>yt,numKeys:()=>ay,objectClone:()=>oy,omit:()=>dy,optionalKeys:()=>cu,parsedType:()=>pu,partial:()=>fy,pick:()=>uy,prefixIssues:()=>ye,primitiveTypes:()=>au,promiseAllObject:()=>sy,propertyKeyTypes:()=>Bn,randomString:()=>iy,required:()=>gy,safeExtend:()=>hy,shallowClone:()=>iu,slugify:()=>nu,stringifyPrimitive:()=>La,uint8ArrayToBase64:()=>Lf,uint8ArrayToBase64url:()=>yy,uint8ArrayToHex:()=>vy,unwrapMessage:()=>Hn});function Y_(e){return e}function Q_(e){return e}function X_(e){}function ey(e){throw new Error("Unexpected value in exhaustive check")}function ty(e){}function Fn(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function Ma(e,t="|"){return e.map(o=>La(o)).join(t)}function Ho(e,t){return typeof t=="bigint"?t.toString():t}function Fo(e){return{get value(){{let o=e();return Object.defineProperty(this,"value",{value:o}),o}throw new Error("cached value already set")}}}function yt(e){return e==null}function Jn(e){let t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function ru(e,t){let o=e/t,r=Math.round(o),n=Number.EPSILON*Math.max(Math.abs(o),1);return Math.abs(o-r)<n?0:o-r}var qf=Symbol("evaluating");function L(e,t,o){let r;Object.defineProperty(e,t,{get(){if(r!==qf)return r===void 0&&(r=qf,r=o()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function oy(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function bt(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function tt(...e){let t={};for(let o of e){let r=Object.getOwnPropertyDescriptors(o);Object.assign(t,r)}return Object.defineProperties({},t)}function ry(e){return tt(e._zod.def)}function ny(e,t){return t?t.reduce((o,r)=>o?.[r],e):e}function sy(e){let t=Object.keys(e),o=t.map(r=>e[r]);return Promise.all(o).then(r=>{let n={};for(let s=0;s<t.length;s++)n[t[s]]=r[s];return n})}function iy(e=10){let t="abcdefghijklmnopqrstuvwxyz",o="";for(let r=0;r<e;r++)o+=t[Math.floor(Math.random()*t.length)];return o}function qa(e){return JSON.stringify(e)}function nu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ja="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function eo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var su=Fo(()=>{if(Xt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function vt(e){if(eo(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let o=t.prototype;return!(eo(o)===!1||Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)}function iu(e){return vt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function ay(e){let t=0;for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&t++;return t}var cy=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Bn=new Set(["string","number","symbol"]),au=new Set(["string","number","bigint","boolean","symbol","undefined"]);function $e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function me(e,t,o){let r=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(r._zod.parent=e),r}function z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function ly(e){let t;return new Proxy({},{get(o,r,n){return t??(t=e()),Reflect.get(t,r,n)},set(o,r,n,s){return t??(t=e()),Reflect.set(t,r,n,s)},has(o,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(o,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(o){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(o,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(o,r,n){return t??(t=e()),Reflect.defineProperty(t,r,n)}})}function La(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function cu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var lu={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]},uu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function uy(e,t){let o=e._zod.def,r=o.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=tt(e._zod.def,{get shape(){let i={};for(let c in t){if(!(c in o.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(i[c]=o.shape[c])}return bt(this,"shape",i),i},checks:[]});return me(e,s)}function dy(e,t){let o=e._zod.def,r=o.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=tt(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let c in t){if(!(c in o.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete i[c]}return bt(this,"shape",i),i},checks:[]});return me(e,s)}function py(e,t){if(!vt(t))throw new Error("Invalid input to extend: expected a plain object");let o=e._zod.def.checks;if(o&&o.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=tt(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return bt(this,"shape",s),s}});return me(e,n)}function hy(e,t){if(!vt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let o=tt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return bt(this,"shape",r),r}});return me(e,o)}function my(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=tt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return bt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return me(e,o)}function fy(e,t,o){let n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=tt(t._zod.def,{get shape(){let c=t._zod.def.shape,l={...c};if(o)for(let u in o){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);o[u]&&(l[u]=e?new e({type:"optional",innerType:c[u]}):c[u])}else for(let u in c)l[u]=e?new e({type:"optional",innerType:c[u]}):c[u];return bt(this,"shape",l),l},checks:[]});return me(t,i)}function gy(e,t,o){let r=tt(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(o)for(let i in o){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);o[i]&&(s[i]=new e({type:"nonoptional",innerType:n[i]}))}else for(let i in n)s[i]=new e({type:"nonoptional",innerType:n[i]});return bt(this,"shape",s),s}});return me(t,r)}function zt(e,t=0){if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function du(e,t=0){if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue===!1)return!0;return!1}function ye(e,t){return t.map(o=>{var r;return(r=o).path??(r.path=[]),o.path.unshift(e),o})}function Hn(e){return typeof e=="string"?e:e?.message}function fe(e,t,o){let r=e.message?e.message:Hn(e.inst?._zod.def?.error?.(e))??Hn(t?.error?.(e))??Hn(o.customError?.(e))??Hn(o.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...c}=e;return c.path??(c.path=[]),c.message=r,t?.reportInput&&(c.input=i),c}function Gn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Wn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pu(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let o=e;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return t}function Jo(...e){let[t,o,r]=e;return typeof t=="string"?{message:t,code:"custom",input:o,inst:r}:{...t}}function Sy(e){return Object.entries(e).filter(([t,o])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function jf(e){let t=atob(e),o=new Uint8Array(t.length);for(let r=0;r<t.length;r++)o[r]=t.charCodeAt(r);return o}function Lf(e){let t="";for(let o=0;o<e.length;o++)t+=String.fromCharCode(e[o]);return btoa(t)}function _y(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-t.length%4)%4);return jf(t+o)}function yy(e){return Lf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function by(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let o=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)o[r/2]=Number.parseInt(t.slice(r,r+2),16);return o}function vy(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ou=class{constructor(...t){}};var Uf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ho,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Kn=m("$ZodError",Uf),be=m("$ZodError",Uf,{Parent:Error});function Yn(e,t=o=>o.message){let o={},r=[];for(let n of e.issues)n.path.length>0?(o[n.path[0]]=o[n.path[0]]||[],o[n.path[0]].push(t(n))):r.push(t(n));return{formErrors:r,fieldErrors:o}}function Qn(e,t=o=>o.message){let o={_errors:[]},r=(n,s=[])=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(c=>r({issues:c},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{let c=[...s,...i.path];if(c.length===0)o._errors.push(t(i));else{let l=o,u=0;for(;u<c.length;){let h=c[u];u===c.length-1?(l[h]=l[h]||{_errors:[]},l[h]._errors.push(t(i))):l[h]=l[h]||{_errors:[]},l=l[h],u++}}}};return r(e),o}function hu(e,t=o=>o.message){let o={errors:[]},r=(n,s=[])=>{var i,c;for(let l of n.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>r({issues:u},[...s,...l.path]));else if(l.code==="invalid_key")r({issues:l.issues},[...s,...l.path]);else if(l.code==="invalid_element")r({issues:l.issues},[...s,...l.path]);else{let u=[...s,...l.path];if(u.length===0){o.errors.push(t(l));continue}let h=o,f=0;for(;f<u.length;){let y=u[f],_=f===u.length-1;typeof y=="string"?(h.properties??(h.properties={}),(i=h.properties)[y]??(i[y]={errors:[]}),h=h.properties[y]):(h.items??(h.items=[]),(c=h.items)[y]??(c[y]={errors:[]}),h=h.items[y]),_&&h.errors.push(t(l)),f++}}};return r(e),o}function Zf(e){let t=[],o=e.map(r=>typeof r=="object"?r.key:r);for(let r of o)typeof r=="number"?t.push(`[${r}]`):typeof r=="symbol"?t.push(`[${JSON.stringify(String(r))}]`):/[^\w$]/.test(r)?t.push(`[${JSON.stringify(r)}]`):(t.length&&t.push("."),t.push(r));return t.join("")}function mu(e){let t=[],o=[...e.issues].sort((r,n)=>(r.path??[]).length-(n.path??[]).length);for(let r of o)t.push(`\u2716 ${r.message}`),r.path?.length&&t.push(` \u2192 at ${Zf(r.path)}`);return t.join(`
|
|
2
|
-
`)}var Bo=e=>(t,o,r,n)=>{let s=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:o,issues:[]},s);if(i instanceof Promise)throw new Ae;if(i.issues.length){let c=new(n?.Err??e)(i.issues.map(l=>fe(l,s,Q())));throw ja(c,n?.callee),c}return i.value},Ua=Bo(be),Go=e=>async(t,o,r,n)=>{let s=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:o,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let c=new(n?.Err??e)(i.issues.map(l=>fe(l,s,Q())));throw ja(c,n?.callee),c}return i.value},Za=Go(be),Wo=e=>(t,o,r)=>{let n=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:o,issues:[]},n);if(s instanceof Promise)throw new Ae;return s.issues.length?{success:!1,error:new(e??Kn)(s.issues.map(i=>fe(i,n,Q())))}:{success:!0,data:s.value}},fu=Wo(be),Ko=e=>async(t,o,r)=>{let n=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:o,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>fe(i,n,Q())))}:{success:!0,data:s.value}},gu=Ko(be),Da=e=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Bo(e)(t,o,n)},wy=Da(be),Va=e=>(t,o,r)=>Bo(e)(t,o,r),Ry=Va(be),Ha=e=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Go(e)(t,o,n)},xy=Ha(be),Fa=e=>async(t,o,r)=>Go(e)(t,o,r),Py=Fa(be),Ja=e=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Wo(e)(t,o,n)},Ty=Ja(be),Ba=e=>(t,o,r)=>Wo(e)(t,o,r),ky=Ba(be),Ga=e=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Ko(e)(t,o,n)},Ey=Ga(be),Wa=e=>async(t,o,r)=>Ko(e)(t,o,r),$y=Wa(be);var Re={};et(Re,{base64:()=>Iu,base64url:()=>Ka,bigint:()=>Lu,boolean:()=>Zu,browserEmail:()=>jy,cidrv4:()=>$u,cidrv6:()=>Cu,cuid:()=>Su,cuid2:()=>_u,date:()=>Au,datetime:()=>qu,domain:()=>Zy,duration:()=>wu,e164:()=>Nu,email:()=>xu,emoji:()=>Pu,extendedDuration:()=>Cy,guid:()=>Ru,hex:()=>Dy,hostname:()=>Uy,html5Email:()=>Ay,httpProtocol:()=>Ou,idnEmail:()=>qy,integer:()=>Uu,ipv4:()=>Tu,ipv6:()=>ku,ksuid:()=>vu,lowercase:()=>Hu,mac:()=>Eu,md5_base64:()=>Hy,md5_base64url:()=>Fy,md5_hex:()=>Vy,nanoid:()=>zu,null:()=>Du,number:()=>Ya,rfc5322Email:()=>My,sha1_base64:()=>By,sha1_base64url:()=>Gy,sha1_hex:()=>Jy,sha256_base64:()=>Ky,sha256_base64url:()=>Yy,sha256_hex:()=>Wy,sha384_base64:()=>Xy,sha384_base64url:()=>eb,sha384_hex:()=>Qy,sha512_base64:()=>ob,sha512_base64url:()=>rb,sha512_hex:()=>tb,string:()=>ju,time:()=>Mu,ulid:()=>yu,undefined:()=>Vu,unicodeEmail:()=>Df,uppercase:()=>Fu,uuid:()=>to,uuid4:()=>Iy,uuid6:()=>Oy,uuid7:()=>Ny,xid:()=>bu});var Su=/^[cC][0-9a-z]{6,}$/,_u=/^[0-9a-z]+$/,yu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,bu=/^[0-9a-vA-V]{20}$/,vu=/^[A-Za-z0-9]{27}$/,zu=/^[a-zA-Z0-9_-]{21}$/,wu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Cy=/^[-+]?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)?)??$/,Ru=/^([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})$/,to=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)$/,Iy=to(4),Oy=to(6),Ny=to(7),xu=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ay=/^[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])?)*$/,My=/^(([^<>()\[\]\\.,;:\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,}))$/,Df=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,qy=Df,jy=/^[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])?)*$/,Ly="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Pu(){return new RegExp(Ly,"u")}var Tu=/^(?:(?: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])$/,ku=/^(([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}|:))$/,Eu=e=>{let t=$e(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},$u=/^((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])$/,Cu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Iu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ka=/^[A-Za-z0-9_-]*$/,Uy=/^(?=.{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])?)*\.?$/,Zy=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Ou=/^https?$/,Nu=/^\+[1-9]\d{6,14}$/,Vf="(?:(?:\\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])))",Au=new RegExp(`^${Vf}$`);function Hf(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Mu(e){return new RegExp(`^${Hf(e)}$`)}function qu(e){let t=Hf({precision:e.precision}),o=["Z"];e.local&&o.push(""),e.offset&&o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${o.join("|")})`;return new RegExp(`^${Vf}T(?:${r})$`)}var ju=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Lu=/^-?\d+n?$/,Uu=/^-?\d+$/,Ya=/^-?\d+(?:\.\d+)?$/,Zu=/^(?:true|false)$/i,Du=/^null$/i;var Vu=/^undefined$/i;var Hu=/^[^A-Z]*$/,Fu=/^[^a-z]*$/,Dy=/^[0-9a-fA-F]*$/;function Xn(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function es(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Vy=/^[0-9a-fA-F]{32}$/,Hy=Xn(22,"=="),Fy=es(22),Jy=/^[0-9a-fA-F]{40}$/,By=Xn(27,"="),Gy=es(27),Wy=/^[0-9a-fA-F]{64}$/,Ky=Xn(43,"="),Yy=es(43),Qy=/^[0-9a-fA-F]{96}$/,Xy=Xn(64,""),eb=es(64),tb=/^[0-9a-fA-F]{128}$/,ob=Xn(86,"=="),rb=es(86);var B=m("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),Jf={number:"number",bigint:"bigint",object:"date"},Qa=m("$ZodCheckLessThan",(e,t)=>{B.init(e,t);let o=Jf[typeof t.value];e._zod.onattach.push(r=>{let n=r._zod.bag,s=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:o,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Xa=m("$ZodCheckGreaterThan",(e,t)=>{B.init(e,t);let o=Jf[typeof t.value];e._zod.onattach.push(r=>{let n=r._zod.bag,s=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:o,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ju=m("$ZodCheckMultipleOf",(e,t)=>{B.init(e,t),e._zod.onattach.push(o=>{var r;(r=o._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=o=>{if(typeof o.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof o.value=="bigint"?o.value%t.value===BigInt(0):ru(o.value,t.value)===0)||o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:t.value,input:o.value,inst:e,continue:!t.abort})}}),Bu=m("$ZodCheckNumberFormat",(e,t)=>{B.init(e,t),t.format=t.format||"float64";let o=t.format?.includes("int"),r=o?"int":"number",[n,s]=lu[t.format];e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,c.minimum=n,c.maximum=s,o&&(c.pattern=Uu)}),e._zod.check=i=>{let c=i.value;if(o){if(!Number.isInteger(c)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){c>0?i.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}c<n&&i.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),c>s&&i.issues.push({origin:"number",input:c,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Gu=m("$ZodCheckBigIntFormat",(e,t)=>{B.init(e,t);let[o,r]=uu[t.format];e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,s.minimum=o,s.maximum=r}),e._zod.check=n=>{let s=n.value;s<o&&n.issues.push({origin:"bigint",input:s,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),s>r&&n.issues.push({origin:"bigint",input:s,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),Wu=m("$ZodCheckMaxSize",(e,t)=>{var o;B.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!yt(n)&&n.size!==void 0}),e._zod.onattach.push(r=>{let n=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;n.size<=t.maximum||r.issues.push({origin:Gn(n),code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Ku=m("$ZodCheckMinSize",(e,t)=>{var o;B.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!yt(n)&&n.size!==void 0}),e._zod.onattach.push(r=>{let n=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;n.size>=t.minimum||r.issues.push({origin:Gn(n),code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Yu=m("$ZodCheckSizeEquals",(e,t)=>{var o;B.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!yt(n)&&n.size!==void 0}),e._zod.onattach.push(r=>{let n=r._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=r=>{let n=r.value,s=n.size;if(s===t.size)return;let i=s>t.size;r.issues.push({origin:Gn(n),...i?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Qu=m("$ZodCheckMaxLength",(e,t)=>{var o;B.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!yt(n)&&n.length!==void 0}),e._zod.onattach.push(r=>{let n=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let n=r.value;if(n.length<=t.maximum)return;let i=Wn(n);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Xu=m("$ZodCheckMinLength",(e,t)=>{var o;B.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!yt(n)&&n.length!==void 0}),e._zod.onattach.push(r=>{let n=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let n=r.value;if(n.length>=t.minimum)return;let i=Wn(n);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),ed=m("$ZodCheckLengthEquals",(e,t)=>{var o;B.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!yt(n)&&n.length!==void 0}),e._zod.onattach.push(r=>{let n=r._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=r=>{let n=r.value,s=n.length;if(s===t.length)return;let i=Wn(n),c=s>t.length;r.issues.push({origin:i,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Yo=m("$ZodCheckStringFormat",(e,t)=>{var o,r;B.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(o=e._zod).check??(o.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),td=m("$ZodCheckRegex",(e,t)=>{Yo.init(e,t),e._zod.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),od=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Hu),Yo.init(e,t)}),rd=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Fu),Yo.init(e,t)}),nd=m("$ZodCheckIncludes",(e,t)=>{B.init(e,t);let o=$e(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${o}`:o);t.pattern=r,e._zod.onattach.push(n=>{let s=n._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),sd=m("$ZodCheckStartsWith",(e,t)=>{B.init(e,t);let o=new RegExp(`^${$e(t.prefix)}.*`);t.pattern??(t.pattern=o),e._zod.onattach.push(r=>{let n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),id=m("$ZodCheckEndsWith",(e,t)=>{B.init(e,t);let o=new RegExp(`.*${$e(t.suffix)}$`);t.pattern??(t.pattern=o),e._zod.onattach.push(r=>{let n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Ff(e,t,o){e.issues.length&&t.issues.push(...ye(o,e.issues))}var ad=m("$ZodCheckProperty",(e,t)=>{B.init(e,t),e._zod.check=o=>{let r=t.schema._zod.run({value:o.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then(n=>Ff(n,o,t.property));Ff(r,o,t.property)}}),cd=m("$ZodCheckMimeType",(e,t)=>{B.init(e,t);let o=new Set(t.mime);e._zod.onattach.push(r=>{r._zod.bag.mime=t.mime}),e._zod.check=r=>{o.has(r.value.type)||r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),ld=m("$ZodCheckOverwrite",(e,t)=>{B.init(e,t),e._zod.check=o=>{o.value=t.tx(o.value)}});var ts=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split(`
|
|
3
|
-
`).filter(i=>i),n=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(n)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,o=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...o,n.join(`
|
|
4
|
-
`))}};var ud={major:4,minor:4,patch:3};var A=m("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ud;let r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(let n of r)for(let s of n._zod.onattach)s(e);if(r.length===0)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,c,l)=>{let u=zt(i),h;for(let f of c){if(f._zod.def.when){if(du(i)||!f._zod.def.when(i))continue}else if(u)continue;let y=i.issues.length,_=f._zod.check(i);if(_ instanceof Promise&&l?.async===!1)throw new Ae;if(h||_ instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await _,i.issues.length!==y&&(u||(u=zt(i,y)))});else{if(i.issues.length===y)continue;u||(u=zt(i,y))}}return h?h.then(()=>i):i},s=(i,c,l)=>{if(zt(i))return i.aborted=!0,i;let u=n(c,r,l);if(u instanceof Promise){if(l.async===!1)throw new Ae;return u.then(h=>e._zod.parse(h,l))}return e._zod.parse(u,l)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(h=>s(h,i,c)):s(u,i,c)}let l=e._zod.parse(i,c);if(l instanceof Promise){if(c.async===!1)throw new Ae;return l.then(u=>n(u,r,c))}return n(l,r,c)}}L(e,"~standard",()=>({validate:n=>{try{let s=fu(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return gu(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),oo=m("$ZodString",(e,t)=>{A.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ju(e._zod.bag),e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=String(o.value)}catch{}return typeof o.value=="string"||o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),F=m("$ZodStringFormat",(e,t)=>{Yo.init(e,t),oo.init(e,t)}),pd=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ru),F.init(e,t)}),hd=m("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=to(r))}else t.pattern??(t.pattern=to());F.init(e,t)}),md=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xu),F.init(e,t)}),fd=m("$ZodURL",(e,t)=>{F.init(e,t),e._zod.check=o=>{try{let r=o.value.trim();if(!t.normalize&&t.protocol?.source===Ou.source&&!/^https?:\/\//i.test(r)){o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:e,continue:!t.abort});return}let n=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(n.hostname)||o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:o.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol)||o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:o.value,inst:e,continue:!t.abort})),t.normalize?o.value=n.href:o.value=r;return}catch{o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:e,continue:!t.abort})}}}),gd=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Pu()),F.init(e,t)}),Sd=m("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=zu),F.init(e,t)}),_d=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Su),F.init(e,t)}),yd=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_u),F.init(e,t)}),bd=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=yu),F.init(e,t)}),vd=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=bu),F.init(e,t)}),zd=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=vu),F.init(e,t)}),wd=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=qu(t)),F.init(e,t)}),Rd=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Au),F.init(e,t)}),xd=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Mu(t)),F.init(e,t)}),Pd=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=wu),F.init(e,t)}),Td=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Tu),F.init(e,t),e._zod.bag.format="ipv4"}),kd=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=ku),F.init(e,t),e._zod.bag.format="ipv6",e._zod.check=o=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:e,continue:!t.abort})}}}),Ed=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Eu(t.delimiter)),F.init(e,t),e._zod.bag.format="mac"}),$d=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=$u),F.init(e,t)}),Cd=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Cu),F.init(e,t),e._zod.check=o=>{let r=o.value.split("/");try{if(r.length!==2)throw new Error;let[n,s]=r;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${n}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:e,continue:!t.abort})}}});function Id(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Od=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Iu),F.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=o=>{Id(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function cg(e){if(!Ka.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return Id(o)}var Nd=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ka),F.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=o=>{cg(o.value)||o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),Ad=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Nu),F.init(e,t)});function lg(e,t=null){try{let o=e.split(".");if(o.length!==3)return!1;let[r]=o;if(!r)return!1;let n=JSON.parse(atob(r));return!("typ"in n&&n?.typ!=="JWT"||!n.alg||t&&(!("alg"in n)||n.alg!==t))}catch{return!1}}var Md=m("$ZodJWT",(e,t)=>{F.init(e,t),e._zod.check=o=>{lg(o.value,t.alg)||o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}}),qd=m("$ZodCustomStringFormat",(e,t)=>{F.init(e,t),e._zod.check=o=>{t.fn(o.value)||o.issues.push({code:"invalid_format",format:t.format,input:o.value,inst:e,continue:!t.abort})}}),nc=m("$ZodNumber",(e,t)=>{A.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ya,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Number(o.value)}catch{}let n=o.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return o;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return o.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),o}}),jd=m("$ZodNumberFormat",(e,t)=>{Bu.init(e,t),nc.init(e,t)}),os=m("$ZodBoolean",(e,t)=>{A.init(e,t),e._zod.pattern=Zu,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=!!o.value}catch{}let n=o.value;return typeof n=="boolean"||o.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),o}}),sc=m("$ZodBigInt",(e,t)=>{A.init(e,t),e._zod.pattern=Lu,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=BigInt(o.value)}catch{}return typeof o.value=="bigint"||o.issues.push({expected:"bigint",code:"invalid_type",input:o.value,inst:e}),o}}),Ld=m("$ZodBigIntFormat",(e,t)=>{Gu.init(e,t),sc.init(e,t)}),Ud=m("$ZodSymbol",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;return typeof n=="symbol"||o.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:e}),o}}),Zd=m("$ZodUndefined",(e,t)=>{A.init(e,t),e._zod.pattern=Vu,e._zod.values=new Set([void 0]),e._zod.parse=(o,r)=>{let n=o.value;return typeof n>"u"||o.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),o}}),Dd=m("$ZodNull",(e,t)=>{A.init(e,t),e._zod.pattern=Du,e._zod.values=new Set([null]),e._zod.parse=(o,r)=>{let n=o.value;return n===null||o.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),o}}),Vd=m("$ZodAny",(e,t)=>{A.init(e,t),e._zod.parse=o=>o}),Hd=m("$ZodUnknown",(e,t)=>{A.init(e,t),e._zod.parse=o=>o}),Fd=m("$ZodNever",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)}),Jd=m("$ZodVoid",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;return typeof n>"u"||o.issues.push({expected:"void",code:"invalid_type",input:n,inst:e}),o}}),Bd=m("$ZodDate",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=new Date(o.value)}catch{}let n=o.value,s=n instanceof Date;return s&&!Number.isNaN(n.getTime())||o.issues.push({expected:"date",code:"invalid_type",input:n,...s?{received:"Invalid Date"}:{},inst:e}),o}});function Gf(e,t,o){e.issues.length&&t.issues.push(...ye(o,e.issues)),t.value[o]=e.value}var Gd=m("$ZodArray",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Array.isArray(n))return o.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),o;o.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let c=n[i],l=t.element._zod.run({value:c,issues:[]},r);l instanceof Promise?s.push(l.then(u=>Gf(u,o,i))):Gf(l,o,i)}return s.length?Promise.all(s).then(()=>o):o}});function rc(e,t,o,r,n,s){let i=o in r;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...ye(o,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}e.value===void 0?i&&(t.value[o]=void 0):t.value[o]=e.value}function ug(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);let o=cu(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function dg(e,t,o,r,n,s){let i=[],c=n.keySet,l=n.catchall._zod,u=l.def.type,h=l.optin==="optional",f=l.optout==="optional";for(let y in t){if(y==="__proto__"||c.has(y))continue;if(u==="never"){i.push(y);continue}let _=l.run({value:t[y],issues:[]},r);_ instanceof Promise?e.push(_.then(v=>rc(v,o,y,t,h,f))):rc(_,o,y,t,h,f)}return i.length&&o.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>o):o}var pg=m("$ZodObject",(e,t)=>{if(A.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let l={...c};return Object.defineProperty(t,"shape",{value:l}),l}})}let r=Fo(()=>ug(t));L(e._zod,"propValues",()=>{let c=t.shape,l={};for(let u in c){let h=c[u]._zod;if(h.values){l[u]??(l[u]=new Set);for(let f of h.values)l[u].add(f)}}return l});let n=eo,s=t.catchall,i;e._zod.parse=(c,l)=>{i??(i=r.value);let u=c.value;if(!n(u))return c.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),c;c.value={};let h=[],f=i.shape;for(let y of i.keys){let _=f[y],v=_._zod.optin==="optional",k=_._zod.optout==="optional",T=_._zod.run({value:u[y],issues:[]},l);T instanceof Promise?h.push(T.then(O=>rc(O,c,y,u,v,k))):rc(T,c,y,u,v,k)}return s?dg(h,u,c,l,r.value,e):h.length?Promise.all(h).then(()=>c):c}}),Wd=m("$ZodObjectJIT",(e,t)=>{pg.init(e,t);let o=e._zod.parse,r=Fo(()=>ug(t)),n=y=>{let _=new ts(["shape","payload","ctx"]),v=r.value,k=M=>{let Z=qa(M);return`shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`};_.write("const input = payload.value;");let T=Object.create(null),O=0;for(let M of v.keys)T[M]=`key_${O++}`;_.write("const newResult = {};");for(let M of v.keys){let Z=T[M],V=qa(M),D=y[M],G=D?._zod?.optin==="optional",pe=D?._zod?.optout==="optional";_.write(`const ${Z} = ${k(M)};`),G&&pe?_.write(`
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
|
|
1
|
+
var{create:Mm,defineProperty:Si,getOwnPropertyDescriptor:Am,getOwnPropertyNames:qm,getPrototypeOf:jm}=Object,Lm=Object.prototype.hasOwnProperty,fl=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gl=(e,t)=>{let o={};for(var r in e)Si(o,r,{get:e[r],enumerable:!0});if(t)Si(o,Symbol.toStringTag,{value:"Module"});return o},Um=(e,t,o,r)=>{if(t&&typeof t==="object"||typeof t==="function"){for(var n=qm(t),i=0,a=n.length,c;i<a;i++)if(c=n[i],!Lm.call(e,c)&&c!==o)Si(e,c,{get:((d)=>t[d]).bind(null,c),enumerable:!(r=Am(t,c))||r.enumerable})}return e},Sl=(e,t,o)=>(o=e!=null?Mm(jm(e)):{},Um(t||!e||!e.__esModule?Si(o,"default",{value:e,enumerable:!0}):o,e));var Zm=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function _l(e){return typeof e==="string"&&Zm.has(e.replace(/#$/,""))}var yl,wa=Object.freeze({status:"aborted"});function g(e,t,o){function r(c,d){if(!c._zod)Object.defineProperty(c,"_zod",{value:{def:d,constr:a,traits:new Set},enumerable:!1});if(c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,d);let p=a.prototype,m=Object.keys(p);for(let f=0;f<m.length;f++){let y=m[f];if(!(y in c))c[y]=p[y].bind(c)}}let n=o?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:e});function a(c){var d;let p=o?.Parent?new i:this;r(p,c),(d=p._zod).deferred??(d.deferred=[]);for(let m of p._zod.deferred)m();return p}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:(c)=>{if(o?.Parent&&c instanceof o.Parent)return!0;return c?._zod?.traits?.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}var Dm=Symbol("zod_brand");class Ae extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Zr extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(yl=globalThis).__zod_globalConfig??(yl.__zod_globalConfig={});var ho=globalThis.__zod_globalConfig;function le(e){if(e)Object.assign(ho,e);return ho}function yi(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function xa(e,t="|"){return e.map((o)=>ka(o)).join(t)}function Dr(e,t){if(typeof t==="bigint")return t.toString();return t}function Vr(e){return{get value(){{let o=e();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function bi(e){return e===null||e===void 0}function vi(e){let t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function vl(e,t){let o=e/t,r=Math.round(o),n=Number.EPSILON*Math.max(Math.abs(o),1);if(Math.abs(o-r)<n)return 0;return o-r}var bl=Symbol("evaluating");function A(e,t,o){let r=void 0;Object.defineProperty(e,t,{get(){if(r===bl)return;if(r===void 0)r=bl,r=o();return r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function xt(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function Ye(...e){let t={};for(let o of e){let r=Object.getOwnPropertyDescriptors(o);Object.assign(t,r)}return Object.defineProperties({},t)}function Pa(e){return JSON.stringify(e)}function zl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Ta="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function mo(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var wl=Vr(()=>{if(ho.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function Pt(e){if(mo(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let o=t.prototype;if(mo(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Ea(e){if(Pt(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Rl=new Set(["string","number","symbol"]);function Qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ze(e,t,o){let r=new e._zod.constr(t??e._zod.def);if(!t||o?.parent)r._zod.parent=e;return r}function T(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function ka(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function xl(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Pl={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Vm(e,t){let o=e._zod.def,r=o.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i=Ye(e._zod.def,{get shape(){let a={};for(let c in t){if(!(c in o.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;a[c]=o.shape[c]}return xt(this,"shape",a),a},checks:[]});return ze(e,i)}function Hm(e,t){let o=e._zod.def,r=o.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=Ye(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let c in t){if(!(c in o.shape))throw Error(`Unrecognized key: "${c}"`);if(!t[c])continue;delete a[c]}return xt(this,"shape",a),a},checks:[]});return ze(e,i)}function Fm(e,t){if(!Pt(t))throw Error("Invalid input to extend: expected a plain object");let o=e._zod.def.checks;if(o&&o.length>0){let i=e._zod.def.shape;for(let a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Ye(e._zod.def,{get shape(){let i={...e._zod.def.shape,...t};return xt(this,"shape",i),i}});return ze(e,n)}function Jm(e,t){if(!Pt(t))throw Error("Invalid input to safeExtend: expected a plain object");let o=Ye(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return xt(this,"shape",r),r}});return ze(e,o)}function Bm(e,t){if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let o=Ye(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return xt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ze(e,o)}function Gm(e,t,o){let n=t._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let a=Ye(t._zod.def,{get shape(){let c=t._zod.def.shape,d={...c};if(o)for(let p in o){if(!(p in c))throw Error(`Unrecognized key: "${p}"`);if(!o[p])continue;d[p]=e?new e({type:"optional",innerType:c[p]}):c[p]}else for(let p in c)d[p]=e?new e({type:"optional",innerType:c[p]}):c[p];return xt(this,"shape",d),d},checks:[]});return ze(t,a)}function Wm(e,t,o){let r=Ye(t._zod.def,{get shape(){let n=t._zod.def.shape,i={...n};if(o)for(let a in o){if(!(a in i))throw Error(`Unrecognized key: "${a}"`);if(!o[a])continue;i[a]=new e({type:"nonoptional",innerType:n[a]})}else for(let a in n)i[a]=new e({type:"nonoptional",innerType:n[a]});return xt(this,"shape",i),i}});return ze(t,r)}function Tt(e,t=0){if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue!==!0)return!0;return!1}function Tl(e,t=0){if(e.aborted===!0)return!0;for(let o=t;o<e.issues.length;o++)if(e.issues[o]?.continue===!1)return!0;return!1}function Xe(e,t){return t.map((o)=>{var r;return(r=o).path??(r.path=[]),o.path.unshift(e),o})}function _i(e){return typeof e==="string"?e:e?.message}function we(e,t,o){let r=e.message?e.message:_i(e.inst?._zod.def?.error?.(e))??_i(t?.error?.(e))??_i(o.customError?.(e))??_i(o.localeError?.(e))??"Invalid input",{inst:n,continue:i,input:a,...c}=e;if(c.path??(c.path=[]),c.message=r,t?.reportInput)c.input=a;return c}function zi(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function El(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let o=e;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return t}function Et(...e){let[t,o,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:o,inst:r};return{...t}}var kl=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Dr,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},wi=g("$ZodError",kl),$a=g("$ZodError",kl,{Parent:Error});function Ca(e,t=(o)=>o.message){let o={},r=[];for(let n of e.issues)if(n.path.length>0)o[n.path[0]]=o[n.path[0]]||[],o[n.path[0]].push(t(n));else r.push(t(n));return{formErrors:r,fieldErrors:o}}function Ia(e,t=(o)=>o.message){let o={_errors:[]},r=(n,i=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map((c)=>r({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{let c=[...i,...a.path];if(c.length===0)o._errors.push(t(a));else{let d=o,p=0;while(p<c.length){let m=c[p];if(p!==c.length-1)d[m]=d[m]||{_errors:[]};else d[m]=d[m]||{_errors:[]},d[m]._errors.push(t(a));d=d[m],p++}}}};return r(e),o}var Ri=(e)=>(t,o,r,n)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:o,issues:[]},i);if(a instanceof Promise)throw new Ae;if(a.issues.length){let c=new(n?.Err??e)(a.issues.map((d)=>we(d,i,le())));throw Ta(c,n?.callee),c}return a.value};var xi=(e)=>async(t,o,r,n)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:o,issues:[]},i);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(n?.Err??e)(a.issues.map((d)=>we(d,i,le())));throw Ta(c,n?.callee),c}return a.value};var Hr=(e)=>(t,o,r)=>{let n=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:o,issues:[]},n);if(i instanceof Promise)throw new Ae;return i.issues.length?{success:!1,error:new(e??wi)(i.issues.map((a)=>we(a,n,le())))}:{success:!0,data:i.value}},$l=Hr($a),Fr=(e)=>async(t,o,r)=>{let n=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:o,issues:[]},n);if(i instanceof Promise)i=await i;return i.issues.length?{success:!1,error:new e(i.issues.map((a)=>we(a,n,le())))}:{success:!0,data:i.value}},Cl=Fr($a),Il=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Ri(e)(t,o,n)};var Ol=(e)=>(t,o,r)=>Ri(e)(t,o,r);var Nl=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return xi(e)(t,o,n)};var Ml=(e)=>async(t,o,r)=>xi(e)(t,o,r);var Al=(e)=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Hr(e)(t,o,n)};var ql=(e)=>(t,o,r)=>Hr(e)(t,o,r);var jl=(e)=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Fr(e)(t,o,n)};var Ll=(e)=>async(t,o,r)=>Fr(e)(t,o,r);var Ul=/^[cC][0-9a-z]{6,}$/,Zl=/^[0-9a-z]+$/,Dl=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vl=/^[0-9a-vA-V]{20}$/,Hl=/^[A-Za-z0-9]{27}$/,Fl=/^[a-zA-Z0-9_-]{21}$/,Jl=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Bl=/^([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})$/,Oa=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)};var Gl=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Ym="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Wl(){return new RegExp(Ym,"u")}var Kl=/^(?:(?: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])$/,Yl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;var Ql=/^((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])$/,Xl=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,eu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Na=/^[A-Za-z0-9_-]*$/;var tu=/^https?$/,ou=/^\+[1-9]\d{6,14}$/,ru="(?:(?:\\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])))",nu=new RegExp(`^${ru}$`);function su(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function iu(e){return new RegExp(`^${su(e)}$`)}function au(e){let t=su({precision:e.precision}),o=["Z"];if(e.local)o.push("");if(e.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${o.join("|")})`;return new RegExp(`^${ru}T(?:${r})$`)}var cu=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var lu=/^-?\d+$/,Ma=/^-?\d+(?:\.\d+)?$/,uu=/^(?:true|false)$/i,du=/^null$/i;var pu=/^undefined$/i;var hu=/^[^A-Z]*$/,mu=/^[^a-z]*$/;var ee=g("$ZodCheck",(e,t)=>{var o;e._zod??(e._zod={}),e._zod.def=t,(o=e._zod).onattach??(o.onattach=[])}),fu={number:"number",bigint:"bigint",object:"date"},Aa=g("$ZodCheckLessThan",(e,t)=>{ee.init(e,t);let o=fu[typeof t.value];e._zod.onattach.push((r)=>{let n=r._zod.bag,i=(t.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(t.value<i)if(t.inclusive)n.maximum=t.value;else n.exclusiveMaximum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:o,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),qa=g("$ZodCheckGreaterThan",(e,t)=>{ee.init(e,t);let o=fu[typeof t.value];e._zod.onattach.push((r)=>{let n=r._zod.bag,i=(t.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(t.value>i)if(t.inclusive)n.minimum=t.value;else n.exclusiveMinimum=t.value}),e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:o,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),gu=g("$ZodCheckMultipleOf",(e,t)=>{ee.init(e,t),e._zod.onattach.push((o)=>{var r;(r=o._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=(o)=>{if(typeof o.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof o.value==="bigint"?o.value%t.value===BigInt(0):vl(o.value,t.value)===0)return;o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:t.value,input:o.value,inst:e,continue:!t.abort})}}),Su=g("$ZodCheckNumberFormat",(e,t)=>{ee.init(e,t),t.format=t.format||"float64";let o=t.format?.includes("int"),r=o?"int":"number",[n,i]=Pl[t.format];e._zod.onattach.push((a)=>{let c=a._zod.bag;if(c.format=t.format,c.minimum=n,c.maximum=i,o)c.pattern=lu}),e._zod.check=(a)=>{let c=a.value;if(o){if(!Number.isInteger(c)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:c,inst:e});return}if(!Number.isSafeInteger(c)){if(c>0)a.issues.push({input:c,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else a.issues.push({input:c,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(c<n)a.issues.push({origin:"number",input:c,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(c>i)a.issues.push({origin:"number",input:c,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}});var _u=g("$ZodCheckMaxLength",(e,t)=>{var o;ee.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!bi(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag.maximum??Number.POSITIVE_INFINITY;if(t.maximum<n)r._zod.bag.maximum=t.maximum}),e._zod.check=(r)=>{let n=r.value;if(n.length<=t.maximum)return;let a=zi(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),yu=g("$ZodCheckMinLength",(e,t)=>{var o;ee.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!bi(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>n)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let n=r.value;if(n.length>=t.minimum)return;let a=zi(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),bu=g("$ZodCheckLengthEquals",(e,t)=>{var o;ee.init(e,t),(o=e._zod.def).when??(o.when=(r)=>{let n=r.value;return!bi(n)&&n.length!==void 0}),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=(r)=>{let n=r.value,i=n.length;if(i===t.length)return;let a=zi(n),c=i>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Br=g("$ZodCheckStringFormat",(e,t)=>{var o,r;if(ee.init(e,t),e._zod.onattach.push((n)=>{let i=n._zod.bag;if(i.format=t.format,t.pattern)i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern)}),t.pattern)(o=e._zod).check??(o.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),vu=g("$ZodCheckRegex",(e,t)=>{Br.init(e,t),e._zod.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),zu=g("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=hu),Br.init(e,t)}),wu=g("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mu),Br.init(e,t)}),Ru=g("$ZodCheckIncludes",(e,t)=>{ee.init(e,t);let o=Qe(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position}}${o}`:o);t.pattern=r,e._zod.onattach.push((n)=>{let i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=(n)=>{if(n.value.includes(t.includes,t.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),xu=g("$ZodCheckStartsWith",(e,t)=>{ee.init(e,t);let o=new RegExp(`^${Qe(t.prefix)}.*`);t.pattern??(t.pattern=o),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Pu=g("$ZodCheckEndsWith",(e,t)=>{ee.init(e,t);let o=new RegExp(`.*${Qe(t.suffix)}$`);t.pattern??(t.pattern=o),e._zod.onattach.push((r)=>{let n=r._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var Tu=g("$ZodCheckOverwrite",(e,t)=>{ee.init(e,t),e._zod.check=(o)=>{o.value=t.tx(o.value)}});class ja{constructor(e=[]){if(this.content=[],this.indent=0,this)this.args=e}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let o=e.split(`
|
|
2
|
+
`).filter((i)=>i),r=Math.min(...o.map((i)=>i.length-i.trimStart().length)),n=o.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of n)this.content.push(i)}compile(){let e=Function,t=this?.args,r=[...(this?.content??[""]).map((n)=>` ${n}`)];return new e(...t,r.join(`
|
|
3
|
+
`))}}var ku={major:4,minor:4,patch:3};var U=g("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ku;let r=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))r.unshift(e);for(let n of r)for(let i of n._zod.onattach)i(e);if(r.length===0)(o=e._zod).deferred??(o.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(a,c,d)=>{let p=Tt(a),m;for(let f of c){if(f._zod.def.when){if(Tl(a))continue;if(!f._zod.def.when(a))continue}else if(p)continue;let y=a.issues.length,S=f._zod.check(a);if(S instanceof Promise&&d?.async===!1)throw new Ae;if(m||S instanceof Promise)m=(m??Promise.resolve()).then(async()=>{if(await S,a.issues.length===y)return;if(!p)p=Tt(a,y)});else{if(a.issues.length===y)continue;if(!p)p=Tt(a,y)}}if(m)return m.then(()=>a);return a},i=(a,c,d)=>{if(Tt(a))return a.aborted=!0,a;let p=n(c,r,d);if(p instanceof Promise){if(d.async===!1)throw new Ae;return p.then((m)=>e._zod.parse(m,d))}return e._zod.parse(p,d)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let p=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(p instanceof Promise)return p.then((m)=>i(m,a,c));return i(p,a,c)}let d=e._zod.parse(a,c);if(d instanceof Promise){if(c.async===!1)throw new Ae;return d.then((p)=>n(p,r,c))}return n(d,r,c)}}A(e,"~standard",()=>({validate:(n)=>{try{let i=$l(e,n);return i.success?{value:i.data}:{issues:i.error?.issues}}catch(i){return Cl(e,n).then((a)=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),Ei=g("$ZodString",(e,t)=>{U.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??cu(e._zod.bag),e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=String(o.value)}catch(n){}if(typeof o.value==="string")return o;return o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:e}),o}}),H=g("$ZodStringFormat",(e,t)=>{Br.init(e,t),Ei.init(e,t)}),ju=g("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Bl),H.init(e,t)}),Lu=g("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Oa(r))}else t.pattern??(t.pattern=Oa());H.init(e,t)}),Uu=g("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Gl),H.init(e,t)}),Zu=g("$ZodURL",(e,t)=>{H.init(e,t),e._zod.check=(o)=>{try{let r=o.value.trim();if(!t.normalize&&t.protocol?.source===tu.source){if(!/^https?:\/\//i.test(r)){o.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:o.value,inst:e,continue:!t.abort});return}}let n=new URL(r);if(t.hostname){if(t.hostname.lastIndex=0,!t.hostname.test(n.hostname))o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:o.value,inst:e,continue:!t.abort})}if(t.protocol){if(t.protocol.lastIndex=0,!t.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:o.value,inst:e,continue:!t.abort})}if(t.normalize)o.value=n.href;else o.value=r;return}catch(r){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:e,continue:!t.abort})}}}),Du=g("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Wl()),H.init(e,t)}),Vu=g("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Fl),H.init(e,t)}),Hu=g("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ul),H.init(e,t)}),Fu=g("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Zl),H.init(e,t)}),Ju=g("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Dl),H.init(e,t)}),Bu=g("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Vl),H.init(e,t)}),Gu=g("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Hl),H.init(e,t)}),Wu=g("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=au(t)),H.init(e,t)}),Ku=g("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=nu),H.init(e,t)}),Yu=g("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=iu(t)),H.init(e,t)}),Qu=g("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Jl),H.init(e,t)}),Xu=g("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Kl),H.init(e,t),e._zod.bag.format="ipv4"}),ed=g("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Yl),H.init(e,t),e._zod.bag.format="ipv6",e._zod.check=(o)=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:e,continue:!t.abort})}}});var td=g("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Ql),H.init(e,t)}),od=g("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Xl),H.init(e,t),e._zod.check=(o)=>{let r=o.value.split("/");try{if(r.length!==2)throw Error();let[n,i]=r;if(!i)throw Error();let a=Number(i);if(`${a}`!==i)throw Error();if(a<0||a>128)throw Error();new URL(`http://[${n}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:e,continue:!t.abort})}}});function rd(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var nd=g("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=eu),H.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=(o)=>{if(rd(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function Qm(e){if(!Na.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return rd(o)}var sd=g("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Na),H.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=(o)=>{if(Qm(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:e,continue:!t.abort})}}),id=g("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ou),H.init(e,t)});function Xm(e,t=null){try{let o=e.split(".");if(o.length!==3)return!1;let[r]=o;if(!r)return!1;let n=JSON.parse(atob(r));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(t&&(!("alg"in n)||n.alg!==t))return!1;return!0}catch{return!1}}var ad=g("$ZodJWT",(e,t)=>{H.init(e,t),e._zod.check=(o)=>{if(Xm(o.value,t.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:e,continue:!t.abort})}});var Ua=g("$ZodNumber",(e,t)=>{U.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ma,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Number(o.value)}catch(a){}let n=o.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return o;let i=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return o.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...i?{received:i}:{}}),o}}),cd=g("$ZodNumberFormat",(e,t)=>{Su.init(e,t),Ua.init(e,t)}),ld=g("$ZodBoolean",(e,t)=>{U.init(e,t),e._zod.pattern=uu,e._zod.parse=(o,r)=>{if(t.coerce)try{o.value=Boolean(o.value)}catch(i){}let n=o.value;if(typeof n==="boolean")return o;return o.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),o}});var ud=g("$ZodUndefined",(e,t)=>{U.init(e,t),e._zod.pattern=pu,e._zod.values=new Set([void 0]),e._zod.parse=(o,r)=>{let n=o.value;if(typeof n>"u")return o;return o.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:e}),o}}),dd=g("$ZodNull",(e,t)=>{U.init(e,t),e._zod.pattern=du,e._zod.values=new Set([null]),e._zod.parse=(o,r)=>{let n=o.value;if(n===null)return o;return o.issues.push({expected:"null",code:"invalid_type",input:n,inst:e}),o}}),pd=g("$ZodAny",(e,t)=>{U.init(e,t),e._zod.parse=(o)=>o}),hd=g("$ZodUnknown",(e,t)=>{U.init(e,t),e._zod.parse=(o)=>o}),md=g("$ZodNever",(e,t)=>{U.init(e,t),e._zod.parse=(o,r)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)});function $u(e,t,o){if(e.issues.length)t.issues.push(...Xe(o,e.issues));t.value[o]=e.value}var fd=g("$ZodArray",(e,t)=>{U.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Array.isArray(n))return o.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),o;o.value=Array(n.length);let i=[];for(let a=0;a<n.length;a++){let c=n[a],d=t.element._zod.run({value:c,issues:[]},r);if(d instanceof Promise)i.push(d.then((p)=>$u(p,o,a)));else $u(d,o,a)}if(i.length)return Promise.all(i).then(()=>o);return o}});function Ti(e,t,o,r,n,i){let a=o in r;if(e.issues.length){if(n&&i&&!a)return;t.issues.push(...Xe(o,e.issues))}if(!a&&!n){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}if(e.value===void 0){if(a)t.value[o]=void 0}else t.value[o]=e.value}function gd(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let o=xl(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(o)}}function Sd(e,t,o,r,n,i){let a=[],c=n.keySet,d=n.catchall._zod,p=d.def.type,m=d.optin==="optional",f=d.optout==="optional";for(let y in t){if(y==="__proto__")continue;if(c.has(y))continue;if(p==="never"){a.push(y);continue}let S=d.run({value:t[y],issues:[]},r);if(S instanceof Promise)e.push(S.then((w)=>Ti(w,o,y,t,m,f)));else Ti(S,o,y,t,m,f)}if(a.length)o.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i});if(!e.length)return o;return Promise.all(e).then(()=>o)}var ef=g("$ZodObject",(e,t)=>{if(U.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let d={...c};return Object.defineProperty(t,"shape",{value:d}),d}})}let r=Vr(()=>gd(t));A(e._zod,"propValues",()=>{let c=t.shape,d={};for(let p in c){let m=c[p]._zod;if(m.values){d[p]??(d[p]=new Set);for(let f of m.values)d[p].add(f)}}return d});let n=mo,i=t.catchall,a;e._zod.parse=(c,d)=>{a??(a=r.value);let p=c.value;if(!n(p))return c.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),c;c.value={};let m=[],f=a.shape;for(let y of a.keys){let S=f[y],w=S._zod.optin==="optional",x=S._zod.optout==="optional",R=S._zod.run({value:p[y],issues:[]},d);if(R instanceof Promise)m.push(R.then((C)=>Ti(C,c,y,p,w,x)));else Ti(R,c,y,p,w,x)}if(!i)return m.length?Promise.all(m).then(()=>c):c;return Sd(m,p,c,d,r.value,e)}}),_d=g("$ZodObjectJIT",(e,t)=>{ef.init(e,t);let o=e._zod.parse,r=Vr(()=>gd(t)),n=(y)=>{let S=new ja(["shape","payload","ctx"]),w=r.value,x=(O)=>{let q=Pa(O);return`shape[${q}]._zod.run({ value: input[${q}], issues: [] }, ctx)`};S.write("const input = payload.value;");let R=Object.create(null),C=0;for(let O of w.keys)R[O]=`key_${C++}`;S.write("const newResult = {};");for(let O of w.keys){let q=R[O],L=Pa(O),j=y[O],V=j?._zod?.optin==="optional",ae=j?._zod?.optout==="optional";if(S.write(`const ${q} = ${x(O)};`),V&&ae)S.write(`
|
|
4
|
+
if (${q}.issues.length) {
|
|
5
|
+
if (${L} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
|
|
8
7
|
...iss,
|
|
9
|
-
path: iss.path ? [${
|
|
8
|
+
path: iss.path ? [${L}, ...iss.path] : [${L}]
|
|
10
9
|
})));
|
|
11
10
|
}
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
if (${
|
|
15
|
-
if (${
|
|
16
|
-
newResult[${
|
|
13
|
+
if (${q}.value === undefined) {
|
|
14
|
+
if (${L} in input) {
|
|
15
|
+
newResult[${L}] = undefined;
|
|
17
16
|
}
|
|
18
17
|
} else {
|
|
19
|
-
newResult[${
|
|
18
|
+
newResult[${L}] = ${q}.value;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
`)
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
`);else if(!V)S.write(`
|
|
22
|
+
const ${q}_present = ${L} in input;
|
|
23
|
+
if (${q}.issues.length) {
|
|
24
|
+
payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
|
|
25
25
|
...iss,
|
|
26
|
-
path: iss.path ? [${
|
|
26
|
+
path: iss.path ? [${L}, ...iss.path] : [${L}]
|
|
27
27
|
})));
|
|
28
28
|
}
|
|
29
|
-
|
|
30
|
-
if (${Z}.value === undefined) {
|
|
31
|
-
if (${V} in input) {
|
|
32
|
-
newResult[${V}] = undefined;
|
|
33
|
-
}
|
|
34
|
-
} else {
|
|
35
|
-
newResult[${V}] = ${Z}.value;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
`):_.write(`
|
|
39
|
-
const ${Z}_present = ${V} in input;
|
|
40
|
-
if (${Z}.issues.length) {
|
|
41
|
-
payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
|
|
42
|
-
...iss,
|
|
43
|
-
path: iss.path ? [${V}, ...iss.path] : [${V}]
|
|
44
|
-
})));
|
|
45
|
-
}
|
|
46
|
-
if (!${Z}_present && !${Z}.issues.length) {
|
|
29
|
+
if (!${q}_present && !${q}.issues.length) {
|
|
47
30
|
payload.issues.push({
|
|
48
31
|
code: "invalid_type",
|
|
49
32
|
expected: "nonoptional",
|
|
50
33
|
input: undefined,
|
|
51
|
-
path: [${
|
|
34
|
+
path: [${L}]
|
|
52
35
|
});
|
|
53
36
|
}
|
|
54
37
|
|
|
55
|
-
if (${
|
|
56
|
-
if (${
|
|
57
|
-
newResult[${
|
|
38
|
+
if (${q}_present) {
|
|
39
|
+
if (${q}.value === undefined) {
|
|
40
|
+
newResult[${L}] = undefined;
|
|
58
41
|
} else {
|
|
59
|
-
newResult[${
|
|
42
|
+
newResult[${L}] = ${q}.value;
|
|
60
43
|
}
|
|
61
44
|
}
|
|
62
45
|
|
|
63
|
-
`)}_.write("payload.value = newResult;"),_.write("return payload;");let j=_.compile();return(M,Z)=>j(y,M,Z)},s,i=eo,c=!Xt.jitless,u=c&&su.value,h=t.catchall,f;e._zod.parse=(y,_)=>{f??(f=r.value);let v=y.value;return i(v)?c&&u&&_?.async===!1&&_.jitless!==!0?(s||(s=n(t.shape)),y=s(y,_),h?dg([],v,y,_,f,e):y):o(y,_):(y.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),y)}});function Wf(e,t,o,r){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let n=e.filter(s=>!zt(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map(s=>s.issues.map(i=>fe(i,r,Q())))}),t)}var rs=m("$ZodUnion",(e,t)=>{A.init(e,t),L(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),L(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),L(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),L(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(n=>n._zod.pattern);return new RegExp(`^(${r.map(n=>Jn(n.source)).join("|")})$`)}});let o=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,n)=>{if(o)return o(r,n);let s=!1,i=[];for(let c of t.options){let l=c._zod.run({value:r.value,issues:[]},n);if(l instanceof Promise)i.push(l),s=!0;else{if(l.issues.length===0)return l;i.push(l)}}return s?Promise.all(i).then(c=>Wf(c,r,e,n)):Wf(i,r,e,n)}});function Kf(e,t,o,r){let n=e.filter(s=>s.issues.length===0);return n.length===1?(t.value=n[0].value,t):(n.length===0?t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map(s=>s.issues.map(i=>fe(i,r,Q())))}):t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:[],inclusive:!1}),t)}var Kd=m("$ZodXor",(e,t)=>{rs.init(e,t),t.inclusive=!1;let o=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,n)=>{if(o)return o(r,n);let s=!1,i=[];for(let c of t.options){let l=c._zod.run({value:r.value,issues:[]},n);l instanceof Promise?(i.push(l),s=!0):i.push(l)}return s?Promise.all(i).then(c=>Kf(c,r,e,n)):Kf(i,r,e,n)}}),Yd=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,rs.init(e,t);let o=e._zod.parse;L(e._zod,"propValues",()=>{let n={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[c,l]of Object.entries(i)){n[c]||(n[c]=new Set);for(let u of l)n[c].add(u)}}return n});let r=Fo(()=>{let n=t.options,s=new Map;for(let i of n){let c=i._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let l of c){if(s.has(l))throw new Error(`Duplicate discriminator value "${String(l)}"`);s.set(l,i)}}return s});e._zod.parse=(n,s)=>{let i=n.value;if(!eo(i))return n.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),n;let c=r.value.get(i?.[t.discriminator]);return c?c._zod.run(n,s):t.unionFallback||s.direction==="backward"?o(n,s):(n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:i,path:[t.discriminator],inst:e}),n)}}),Qd=m("$ZodIntersection",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value,s=t.left._zod.run({value:n,issues:[]},r),i=t.right._zod.run({value:n,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,u])=>Yf(o,l,u)):Yf(o,s,i)}});function dd(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(vt(e)&&vt(t)){let o=Object.keys(t),r=Object.keys(e).filter(s=>o.indexOf(s)!==-1),n={...e,...t};for(let s of r){let i=dd(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let o=[];for(let r=0;r<e.length;r++){let n=e[r],s=t[r],i=dd(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};o.push(i.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Yf(e,t,o){let r=new Map,n;for(let c of t.issues)if(c.code==="unrecognized_keys"){n??(n=c);for(let l of c.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(c);for(let c of o.issues)if(c.code==="unrecognized_keys")for(let l of c.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(c);let s=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(s.length&&n&&e.issues.push({...n,keys:s}),zt(e))return e;let i=dd(t.value,o.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var ic=m("$ZodTuple",(e,t)=>{A.init(e,t);let o=t.items;e._zod.parse=(r,n)=>{let s=r.value;if(!Array.isArray(s))return r.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),r;r.value=[];let i=[],c=Qf(o,"optin"),l=Qf(o,"optout");if(!t.rest){if(s.length<c)return r.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),r;s.length>o.length&&r.issues.push({code:"too_big",maximum:o.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=new Array(o.length);for(let h=0;h<o.length;h++){let f=o[h]._zod.run({value:s[h],issues:[]},n);f instanceof Promise?i.push(f.then(y=>{u[h]=y})):u[h]=f}if(t.rest){let h=o.length-1,f=s.slice(o.length);for(let y of f){h++;let _=t.rest._zod.run({value:y,issues:[]},n);_ instanceof Promise?i.push(_.then(v=>Xf(v,r,h))):Xf(_,r,h)}}return i.length?Promise.all(i).then(()=>eg(u,r,o,s,l)):eg(u,r,o,s,l)}});function Qf(e,t){for(let o=e.length-1;o>=0;o--)if(e[o]._zod[t]!=="optional")return o+1;return 0}function Xf(e,t,o){e.issues.length&&t.issues.push(...ye(o,e.issues)),t.value[o]=e.value}function eg(e,t,o,r,n){for(let s=0;s<o.length;s++){let i=e[s],c=s<r.length;if(i.issues.length){if(!c&&s>=n){t.value.length=s;break}t.issues.push(...ye(s,i.issues))}t.value[s]=i.value}for(let s=t.value.length-1;s>=r.length&&(o[s]._zod.optout==="optional"&&t.value[s]===void 0);s--)t.value.length=s;return t}var Xd=m("$ZodRecord",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!vt(n))return o.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),o;let s=[],i=t.keyType._zod.values;if(i){o.value={};let c=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){c.add(typeof u=="number"?u.toString():u);let h=t.keyType._zod.run({value:u,issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(h.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:h.issues.map(_=>fe(_,r,Q())),input:u,path:[u],inst:e});continue}let f=h.value,y=t.valueType._zod.run({value:n[u],issues:[]},r);y instanceof Promise?s.push(y.then(_=>{_.issues.length&&o.issues.push(...ye(u,_.issues)),o.value[f]=_.value})):(y.issues.length&&o.issues.push(...ye(u,y.issues)),o.value[f]=y.value)}let l;for(let u in n)c.has(u)||(l=l??[],l.push(u));l&&l.length>0&&o.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:l})}else{o.value={};for(let c of Reflect.ownKeys(n)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,c))continue;let l=t.keyType._zod.run({value:c,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&Ya.test(c)&&l.issues.length){let f=t.keyType._zod.run({value:Number(c),issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");f.issues.length===0&&(l=f)}if(l.issues.length){t.mode==="loose"?o.value[c]=n[c]:o.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(f=>fe(f,r,Q())),input:c,path:[c],inst:e});continue}let h=t.valueType._zod.run({value:n[c],issues:[]},r);h instanceof Promise?s.push(h.then(f=>{f.issues.length&&o.issues.push(...ye(c,f.issues)),o.value[l.value]=f.value})):(h.issues.length&&o.issues.push(...ye(c,h.issues)),o.value[l.value]=h.value)}}return s.length?Promise.all(s).then(()=>o):o}}),ep=m("$ZodMap",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!(n instanceof Map))return o.issues.push({expected:"map",code:"invalid_type",input:n,inst:e}),o;let s=[];o.value=new Map;for(let[i,c]of n){let l=t.keyType._zod.run({value:i,issues:[]},r),u=t.valueType._zod.run({value:c,issues:[]},r);l instanceof Promise||u instanceof Promise?s.push(Promise.all([l,u]).then(([h,f])=>{tg(h,f,o,i,n,e,r)})):tg(l,u,o,i,n,e,r)}return s.length?Promise.all(s).then(()=>o):o}});function tg(e,t,o,r,n,s,i){e.issues.length&&(Bn.has(typeof r)?o.issues.push(...ye(r,e.issues)):o.issues.push({code:"invalid_key",origin:"map",input:n,inst:s,issues:e.issues.map(c=>fe(c,i,Q()))})),t.issues.length&&(Bn.has(typeof r)?o.issues.push(...ye(r,t.issues)):o.issues.push({origin:"map",code:"invalid_element",input:n,inst:s,key:r,issues:t.issues.map(c=>fe(c,i,Q()))})),o.value.set(e.value,t.value)}var tp=m("$ZodSet",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!(n instanceof Set))return o.issues.push({input:n,inst:e,expected:"set",code:"invalid_type"}),o;let s=[];o.value=new Set;for(let i of n){let c=t.valueType._zod.run({value:i,issues:[]},r);c instanceof Promise?s.push(c.then(l=>og(l,o))):og(c,o)}return s.length?Promise.all(s).then(()=>o):o}});function og(e,t){e.issues.length&&t.issues.push(...e.issues),t.value.add(e.value)}var op=m("$ZodEnum",(e,t)=>{A.init(e,t);let o=Fn(t.entries),r=new Set(o);e._zod.values=r,e._zod.pattern=new RegExp(`^(${o.filter(n=>Bn.has(typeof n)).map(n=>typeof n=="string"?$e(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:o,input:i,inst:e}),n}}),rp=m("$ZodLiteral",(e,t)=>{if(A.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let o=new Set(t.values);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?$e(r):r?$e(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{let s=r.value;return o.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),np=m("$ZodFile",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;return n instanceof File||o.issues.push({expected:"file",code:"invalid_type",input:n,inst:e}),o}}),sp=m("$ZodTransform",(e,t)=>{A.init(e,t),e._zod.optin="optional",e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new _t(e.constructor.name);let n=t.transform(o.value,o);if(r.async)return(n instanceof Promise?n:Promise.resolve(n)).then(i=>(o.value=i,o.fallback=!0,o));if(n instanceof Promise)throw new Ae;return o.value=n,o.fallback=!0,o}});function rg(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var ac=m("$ZodOptional",(e,t)=>{A.init(e,t),e._zod.optin="optional",e._zod.optout="optional",L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),L(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Jn(o.source)})?$`):void 0}),e._zod.parse=(o,r)=>{if(t.innerType._zod.optin==="optional"){let n=o.value,s=t.innerType._zod.run(o,r);return s instanceof Promise?s.then(i=>rg(i,n)):rg(s,n)}return o.value===void 0?o:t.innerType._zod.run(o,r)}}),ip=m("$ZodExactOptional",(e,t)=>{ac.init(e,t),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(o,r)=>t.innerType._zod.run(o,r)}),ap=m("$ZodNullable",(e,t)=>{A.init(e,t),L(e._zod,"optin",()=>t.innerType._zod.optin),L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Jn(o.source)}|null)$`):void 0}),L(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(o,r)=>o.value===null?o:t.innerType._zod.run(o,r)}),cp=m("$ZodDefault",(e,t)=>{A.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);if(o.value===void 0)return o.value=t.defaultValue,o;let n=t.innerType._zod.run(o,r);return n instanceof Promise?n.then(s=>ng(s,t)):ng(n,t)}});function ng(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var lp=m("$ZodPrefault",(e,t)=>{A.init(e,t),e._zod.optin="optional",L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>(r.direction==="backward"||o.value===void 0&&(o.value=t.defaultValue),t.innerType._zod.run(o,r))}),up=m("$ZodNonOptional",(e,t)=>{A.init(e,t),L(e._zod,"values",()=>{let o=t.innerType._zod.values;return o?new Set([...o].filter(r=>r!==void 0)):void 0}),e._zod.parse=(o,r)=>{let n=t.innerType._zod.run(o,r);return n instanceof Promise?n.then(s=>sg(s,e)):sg(n,e)}});function sg(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var dp=m("$ZodSuccess",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new _t("ZodSuccess");let n=t.innerType._zod.run(o,r);return n instanceof Promise?n.then(s=>(o.value=s.issues.length===0,o)):(o.value=n.issues.length===0,o)}}),pp=m("$ZodCatch",(e,t)=>{A.init(e,t),e._zod.optin="optional",L(e._zod,"optout",()=>t.innerType._zod.optout),L(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);let n=t.innerType._zod.run(o,r);return n instanceof Promise?n.then(s=>(o.value=s.value,s.issues.length&&(o.value=t.catchValue({...o,error:{issues:s.issues.map(i=>fe(i,r,Q()))},input:o.value}),o.issues=[],o.fallback=!0),o)):(o.value=n.value,n.issues.length&&(o.value=t.catchValue({...o,error:{issues:n.issues.map(s=>fe(s,r,Q()))},input:o.value}),o.issues=[],o.fallback=!0),o)}}),hp=m("$ZodNaN",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>((typeof o.value!="number"||!Number.isNaN(o.value))&&o.issues.push({input:o.value,inst:e,expected:"nan",code:"invalid_type"}),o)}),cc=m("$ZodPipe",(e,t)=>{A.init(e,t),L(e._zod,"values",()=>t.in._zod.values),L(e._zod,"optin",()=>t.in._zod.optin),L(e._zod,"optout",()=>t.out._zod.optout),L(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(o,r)=>{if(r.direction==="backward"){let s=t.out._zod.run(o,r);return s instanceof Promise?s.then(i=>ec(i,t.in,r)):ec(s,t.in,r)}let n=t.in._zod.run(o,r);return n instanceof Promise?n.then(s=>ec(s,t.out,r)):ec(n,t.out,r)}});function ec(e,t,o){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},o)}var ns=m("$ZodCodec",(e,t)=>{A.init(e,t),L(e._zod,"values",()=>t.in._zod.values),L(e._zod,"optin",()=>t.in._zod.optin),L(e._zod,"optout",()=>t.out._zod.optout),L(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(o,r)=>{if((r.direction||"forward")==="forward"){let s=t.in._zod.run(o,r);return s instanceof Promise?s.then(i=>tc(i,t,r)):tc(s,t,r)}else{let s=t.out._zod.run(o,r);return s instanceof Promise?s.then(i=>tc(i,t,r)):tc(s,t,r)}}});function tc(e,t,o){if(e.issues.length)return e.aborted=!0,e;if((o.direction||"forward")==="forward"){let n=t.transform(e.value,e);return n instanceof Promise?n.then(s=>oc(e,s,t.out,o)):oc(e,n,t.out,o)}else{let n=t.reverseTransform(e.value,e);return n instanceof Promise?n.then(s=>oc(e,s,t.in,o)):oc(e,n,t.in,o)}}function oc(e,t,o,r){return e.issues.length?(e.aborted=!0,e):o._zod.run({value:t,issues:e.issues},r)}var mp=m("$ZodPreprocess",(e,t)=>{cc.init(e,t)}),fp=m("$ZodReadonly",(e,t)=>{A.init(e,t),L(e._zod,"propValues",()=>t.innerType._zod.propValues),L(e._zod,"values",()=>t.innerType._zod.values),L(e._zod,"optin",()=>t.innerType?._zod?.optin),L(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);let n=t.innerType._zod.run(o,r);return n instanceof Promise?n.then(ig):ig(n)}});function ig(e){return e.value=Object.freeze(e.value),e}var gp=m("$ZodTemplateLiteral",(e,t)=>{A.init(e,t);let o=[];for(let r of t.parts)if(typeof r=="object"&&r!==null){if(!r._zod.pattern)throw new Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);let n=r._zod.pattern instanceof RegExp?r._zod.pattern.source:r._zod.pattern;if(!n)throw new Error(`Invalid template literal part: ${r._zod.traits}`);let s=n.startsWith("^")?1:0,i=n.endsWith("$")?n.length-1:n.length;o.push(n.slice(s,i))}else if(r===null||au.has(typeof r))o.push($e(`${r}`));else throw new Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${o.join("")}$`),e._zod.parse=(r,n)=>typeof r.value!="string"?(r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r):(e._zod.pattern.lastIndex=0,e._zod.pattern.test(r.value)||r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r)}),Sp=m("$ZodFunction",(e,t)=>(A.init(e,t),e._def=t,e._zod.def=t,e.implement=o=>{if(typeof o!="function")throw new Error("implement() must be called with a function");return function(...r){let n=e._def.input?Ua(e._def.input,r):r,s=Reflect.apply(o,this,n);return e._def.output?Ua(e._def.output,s):s}},e.implementAsync=o=>{if(typeof o!="function")throw new Error("implementAsync() must be called with a function");return async function(...r){let n=e._def.input?await Za(e._def.input,r):r,s=await Reflect.apply(o,this,n);return e._def.output?await Za(e._def.output,s):s}},e._zod.parse=(o,r)=>typeof o.value!="function"?(o.issues.push({code:"invalid_type",expected:"function",input:o.value,inst:e}),o):(e._def.output&&e._def.output._zod.def.type==="promise"?o.value=e.implementAsync(o.value):o.value=e.implement(o.value),o),e.input=(...o)=>{let r=e.constructor;return Array.isArray(o[0])?new r({type:"function",input:new ic({type:"tuple",items:o[0],rest:o[1]}),output:e._def.output}):new r({type:"function",input:o[0],output:e._def.output})},e.output=o=>{let r=e.constructor;return new r({type:"function",input:e._def.input,output:o})},e)),_p=m("$ZodPromise",(e,t)=>{A.init(e,t),e._zod.parse=(o,r)=>Promise.resolve(o.value).then(n=>t.innerType._zod.run({value:n,issues:[]},r))}),yp=m("$ZodLazy",(e,t)=>{A.init(e,t),L(e._zod,"innerType",()=>{let o=t;return o._cachedInner||(o._cachedInner=t.getter()),o._cachedInner}),L(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),L(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),L(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),L(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(o,r)=>e._zod.innerType._zod.run(o,r)}),bp=m("$ZodCustom",(e,t)=>{B.init(e,t),A.init(e,t),e._zod.parse=(o,r)=>o,e._zod.check=o=>{let r=o.value,n=t.fn(r);if(n instanceof Promise)return n.then(s=>ag(s,o,r,e));ag(n,o,r,e)}});function ag(e,t,o,r){if(!e){let n={code:"custom",input:o,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(n.params=r._zod.def.params),t.issues.push(Jo(n))}}var ss={};et(ss,{en:()=>lc});var sb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let o={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return n=>{switch(n.code){case"invalid_type":{let s=r[n.expected]??n.expected,i=pu(n.input),c=r[i]??i;return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${La(n.values[0])}`:`Invalid option: expected one of ${Ma(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${s}${n.minimum.toString()}`}case"invalid_format":{let s=n;return s.format==="starts_with"?`Invalid string: must start with "${s.prefix}"`:s.format==="ends_with"?`Invalid string: must end with "${s.suffix}"`:s.format==="includes"?`Invalid string: must include "${s.includes}"`:s.format==="regex"?`Invalid string: must match pattern ${s.pattern}`:`Invalid ${o[s.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${Ma(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return n.options&&Array.isArray(n.options)&&n.options.length>0?`Invalid discriminator value. Expected ${n.options.map(i=>`'${i}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function lc(){return{localeError:sb()}}var hg,vp=Symbol("ZodOutput"),zp=Symbol("ZodInput"),uc=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...o){let r=o[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let o=this._map.get(t);return o&&typeof o=="object"&&"id"in o&&this._idmap.delete(o.id),this._map.delete(t),this}get(t){let o=t._zod.parent;if(o){let r={...this.get(o)??{}};delete r.id;let n={...r,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function dc(){return new uc}(hg=globalThis).__zod_globalRegistry??(hg.__zod_globalRegistry=dc());var ne=globalThis.__zod_globalRegistry;function wp(e,t){return new e({type:"string",...z(t)})}function Rp(e,t){return new e({type:"string",coerce:!0,...z(t)})}function pc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...z(t)})}function is(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...z(t)})}function hc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...z(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...z(t)})}function fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...z(t)})}function gc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...z(t)})}function as(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...z(t)})}function Sc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...z(t)})}function _c(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...z(t)})}function yc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...z(t)})}function bc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...z(t)})}function vc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...z(t)})}function zc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...z(t)})}function wc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...z(t)})}function Rc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...z(t)})}function xc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...z(t)})}function xp(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...z(t)})}function Pc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...z(t)})}function Tc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...z(t)})}function kc(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...z(t)})}function Ec(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...z(t)})}function $c(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...z(t)})}function Cc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...z(t)})}var Pp={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Tp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...z(t)})}function kp(e,t){return new e({type:"string",format:"date",check:"string_format",...z(t)})}function Ep(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...z(t)})}function $p(e,t){return new e({type:"string",format:"duration",check:"string_format",...z(t)})}function Cp(e,t){return new e({type:"number",checks:[],...z(t)})}function Ip(e,t){return new e({type:"number",coerce:!0,checks:[],...z(t)})}function Op(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...z(t)})}function Np(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...z(t)})}function Ap(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...z(t)})}function Mp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...z(t)})}function qp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...z(t)})}function jp(e,t){return new e({type:"boolean",...z(t)})}function Lp(e,t){return new e({type:"boolean",coerce:!0,...z(t)})}function Up(e,t){return new e({type:"bigint",...z(t)})}function Zp(e,t){return new e({type:"bigint",coerce:!0,...z(t)})}function Dp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...z(t)})}function Vp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...z(t)})}function Hp(e,t){return new e({type:"symbol",...z(t)})}function Fp(e,t){return new e({type:"undefined",...z(t)})}function Jp(e,t){return new e({type:"null",...z(t)})}function Bp(e){return new e({type:"any"})}function Gp(e){return new e({type:"unknown"})}function Wp(e,t){return new e({type:"never",...z(t)})}function Kp(e,t){return new e({type:"void",...z(t)})}function Yp(e,t){return new e({type:"date",...z(t)})}function Qp(e,t){return new e({type:"date",coerce:!0,...z(t)})}function Xp(e,t){return new e({type:"nan",...z(t)})}function Ze(e,t){return new Qa({check:"less_than",...z(t),value:e,inclusive:!1})}function xe(e,t){return new Qa({check:"less_than",...z(t),value:e,inclusive:!0})}function De(e,t){return new Xa({check:"greater_than",...z(t),value:e,inclusive:!1})}function ge(e,t){return new Xa({check:"greater_than",...z(t),value:e,inclusive:!0})}function Ic(e){return De(0,e)}function Oc(e){return Ze(0,e)}function Nc(e){return xe(0,e)}function Ac(e){return ge(0,e)}function wt(e,t){return new Ju({check:"multiple_of",...z(t),value:e})}function Rt(e,t){return new Wu({check:"max_size",...z(t),maximum:e})}function Ve(e,t){return new Ku({check:"min_size",...z(t),minimum:e})}function ro(e,t){return new Yu({check:"size_equals",...z(t),size:e})}function no(e,t){return new Qu({check:"max_length",...z(t),maximum:e})}function ot(e,t){return new Xu({check:"min_length",...z(t),minimum:e})}function so(e,t){return new ed({check:"length_equals",...z(t),length:e})}function Qo(e,t){return new td({check:"string_format",format:"regex",...z(t),pattern:e})}function Xo(e){return new od({check:"string_format",format:"lowercase",...z(e)})}function er(e){return new rd({check:"string_format",format:"uppercase",...z(e)})}function tr(e,t){return new nd({check:"string_format",format:"includes",...z(t),includes:e})}function or(e,t){return new sd({check:"string_format",format:"starts_with",...z(t),prefix:e})}function rr(e,t){return new id({check:"string_format",format:"ends_with",...z(t),suffix:e})}function Mc(e,t,o){return new ad({check:"property",property:e,schema:t,...z(o)})}function nr(e,t){return new cd({check:"mime_type",mime:e,...z(t)})}function Me(e){return new ld({check:"overwrite",tx:e})}function sr(e){return Me(t=>t.normalize(e))}function ir(){return Me(e=>e.trim())}function ar(){return Me(e=>e.toLowerCase())}function cr(){return Me(e=>e.toUpperCase())}function lr(){return Me(e=>nu(e))}function eh(e,t,o){return new e({type:"array",element:t,...z(o)})}function ab(e,t,o){return new e({type:"union",options:t,...z(o)})}function cb(e,t,o){return new e({type:"union",options:t,inclusive:!1,...z(o)})}function lb(e,t,o,r){return new e({type:"union",options:o,discriminator:t,...z(r)})}function ub(e,t,o){return new e({type:"intersection",left:t,right:o})}function db(e,t,o,r){let n=o instanceof A,s=n?r:o,i=n?o:null;return new e({type:"tuple",items:t,rest:i,...z(s)})}function pb(e,t,o,r){return new e({type:"record",keyType:t,valueType:o,...z(r)})}function hb(e,t,o,r){return new e({type:"map",keyType:t,valueType:o,...z(r)})}function mb(e,t,o){return new e({type:"set",valueType:t,...z(o)})}function fb(e,t,o){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:r,...z(o)})}function gb(e,t,o){return new e({type:"enum",entries:t,...z(o)})}function Sb(e,t,o){return new e({type:"literal",values:Array.isArray(t)?t:[t],...z(o)})}function th(e,t){return new e({type:"file",...z(t)})}function _b(e,t){return new e({type:"transform",transform:t})}function yb(e,t){return new e({type:"optional",innerType:t})}function bb(e,t){return new e({type:"nullable",innerType:t})}function vb(e,t,o){return new e({type:"default",innerType:t,get defaultValue(){return typeof o=="function"?o():iu(o)}})}function zb(e,t,o){return new e({type:"nonoptional",innerType:t,...z(o)})}function wb(e,t){return new e({type:"success",innerType:t})}function Rb(e,t,o){return new e({type:"catch",innerType:t,catchValue:typeof o=="function"?o:()=>o})}function xb(e,t,o){return new e({type:"pipe",in:t,out:o})}function Pb(e,t){return new e({type:"readonly",innerType:t})}function Tb(e,t,o){return new e({type:"template_literal",parts:t,...z(o)})}function kb(e,t){return new e({type:"lazy",getter:t})}function Eb(e,t){return new e({type:"promise",innerType:t})}function oh(e,t,o){let r=z(o);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function rh(e,t,o){return new e({type:"custom",check:"custom",fn:t,...z(o)})}function nh(e,t){let o=mg(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Jo(n,r.value,o._zod.def));else{let s=n;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=o),s.continue??(s.continue=!o._zod.def.abort),r.issues.push(Jo(s))}},e(r.value,r)),t);return o}function mg(e,t){let o=new B({check:"custom",...z(t)});return o._zod.check=e,o}function sh(e){let t=new B({check:"describe"});return t._zod.onattach=[o=>{let r=ne.get(o)??{};ne.add(o,{...r,description:e})}],t._zod.check=()=>{},t}function ih(e){let t=new B({check:"meta"});return t._zod.onattach=[o=>{let r=ne.get(o)??{};ne.add(o,{...r,...e})}],t._zod.check=()=>{},t}function ah(e,t){let o=z(t),r=o.truthy??["true","1","yes","on","y","enabled"],n=o.falsy??["false","0","no","off","n","disabled"];o.case!=="sensitive"&&(r=r.map(_=>typeof _=="string"?_.toLowerCase():_),n=n.map(_=>typeof _=="string"?_.toLowerCase():_));let s=new Set(r),i=new Set(n),c=e.Codec??ns,l=e.Boolean??os,u=e.String??oo,h=new u({type:"string",error:o.error}),f=new l({type:"boolean",error:o.error}),y=new c({type:"pipe",in:h,out:f,transform:((_,v)=>{let k=_;return o.case!=="sensitive"&&(k=k.toLowerCase()),s.has(k)?!0:i.has(k)?!1:(v.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...i],input:v.value,inst:y,continue:!1}),{})}),reverseTransform:((_,v)=>_===!0?r[0]||"true":n[0]||"false"),error:o.error});return y}function ur(e,t,o,r={}){let n=z(r),s={...z(r),check:"string_format",type:"string",format:t,fn:typeof o=="function"?o:c=>o.test(c),...n};return o instanceof RegExp&&(s.pattern=o),new e(s)}function xt(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??ne,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function H(e,t,o={path:[],schemaPath:[]}){var r;let n=e._zod.def,s=t.seen.get(e);if(s)return s.count++,o.schemaPath.includes(e)&&(s.cycle=o.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:o.path};t.seen.set(e,i);let c=e._zod.toJSONSchema?.();if(c)i.schema=c;else{let h={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,h);else{let y=i.schema,_=t.processors[n.type];if(!_)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);_(e,t,y,h)}let f=e._zod.parent;f&&(i.ref||(i.ref=f),H(f,t,h),t.seen.get(f).isParent=!0)}let l=t.metadataRegistry.get(e);return l&&Object.assign(i.schema,l),t.io==="input"&&Se(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Pt(e,t){let o=e.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let i of e.seen.entries()){let c=e.metadataRegistry.get(i[0])?.id;if(c){let l=r.get(c);if(l&&l!==i[0])throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,i[0])}}let n=i=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(i[0])?.id,y=e.external.uri??(v=>v);if(f)return{ref:y(f)};let _=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=_,{defId:_,ref:`${y("__shared")}#/${c}/${_}`}}if(i[1]===o)return{ref:"#"};let u=`#/${c}/`,h=i[1].schema.id??`__schema${e.counter++}`;return{defId:h,ref:u+h}},s=i=>{if(i[1].schema.$ref)return;let c=i[1],{ref:l,defId:u}=n(i);c.def={...c.schema},u&&(c.defId=u);let h=c.schema;for(let f in h)delete h[f];h.$ref=l};if(e.cycles==="throw")for(let i of e.seen.entries()){let c=i[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
46
|
+
`);else S.write(`
|
|
47
|
+
if (${q}.issues.length) {
|
|
48
|
+
payload.issues = payload.issues.concat(${q}.issues.map(iss => ({
|
|
49
|
+
...iss,
|
|
50
|
+
path: iss.path ? [${L}, ...iss.path] : [${L}]
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (${q}.value === undefined) {
|
|
55
|
+
if (${L} in input) {
|
|
56
|
+
newResult[${L}] = undefined;
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
newResult[${L}] = ${q}.value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
`)}S.write("payload.value = newResult;"),S.write("return payload;");let N=S.compile();return(O,q)=>N(y,O,q)},i,a=mo,c=!ho.jitless,p=c&&wl.value,m=t.catchall,f;e._zod.parse=(y,S)=>{f??(f=r.value);let w=y.value;if(!a(w))return y.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),y;if(c&&p&&S?.async===!1&&S.jitless!==!0){if(!i)i=n(t.shape);if(y=i(y,S),!m)return y;return Sd([],w,y,S,f,e)}return o(y,S)}});function Cu(e,t,o,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let n=e.filter((i)=>!Tt(i));if(n.length===1)return t.value=n[0].value,n[0];return t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:e.map((i)=>i.issues.map((a)=>we(a,r,le())))}),t}var Za=g("$ZodUnion",(e,t)=>{U.init(e,t),A(e._zod,"optin",()=>t.options.some((r)=>r._zod.optin==="optional")?"optional":void 0),A(e._zod,"optout",()=>t.options.some((r)=>r._zod.optout==="optional")?"optional":void 0),A(e._zod,"values",()=>{if(t.options.every((r)=>r._zod.values))return new Set(t.options.flatMap((r)=>Array.from(r._zod.values)));return}),A(e._zod,"pattern",()=>{if(t.options.every((r)=>r._zod.pattern)){let r=t.options.map((n)=>n._zod.pattern);return new RegExp(`^(${r.map((n)=>vi(n.source)).join("|")})$`)}return});let o=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,n)=>{if(o)return o(r,n);let i=!1,a=[];for(let c of t.options){let d=c._zod.run({value:r.value,issues:[]},n);if(d instanceof Promise)a.push(d),i=!0;else{if(d.issues.length===0)return d;a.push(d)}}if(!i)return Cu(a,r,e,n);return Promise.all(a).then((c)=>Cu(c,r,e,n))}});var yd=g("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Za.init(e,t);let o=e._zod.parse;A(e._zod,"propValues",()=>{let n={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[c,d]of Object.entries(a)){if(!n[c])n[c]=new Set;for(let p of d)n[c].add(p)}}return n});let r=Vr(()=>{let n=t.options,i=new Map;for(let a of n){let c=a._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let d of c){if(i.has(d))throw Error(`Duplicate discriminator value "${String(d)}"`);i.set(d,a)}}return i});e._zod.parse=(n,i)=>{let a=n.value;if(!mo(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let c=r.value.get(a?.[t.discriminator]);if(c)return c._zod.run(n,i);if(t.unionFallback||i.direction==="backward")return o(n,i);return n.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:a,path:[t.discriminator],inst:e}),n}}),bd=g("$ZodIntersection",(e,t)=>{U.init(e,t),e._zod.parse=(o,r)=>{let n=o.value,i=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);if(i instanceof Promise||a instanceof Promise)return Promise.all([i,a]).then(([d,p])=>Iu(o,d,p));return Iu(o,i,a)}});function La(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(Pt(e)&&Pt(t)){let o=Object.keys(t),r=Object.keys(e).filter((i)=>o.indexOf(i)!==-1),n={...e,...t};for(let i of r){let a=La(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};n[i]=a.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let o=[];for(let r=0;r<e.length;r++){let n=e[r],i=t[r],a=La(n,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};o.push(a.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Iu(e,t,o){let r=new Map,n;for(let c of t.issues)if(c.code==="unrecognized_keys"){n??(n=c);for(let d of c.keys){if(!r.has(d))r.set(d,{});r.get(d).l=!0}}else e.issues.push(c);for(let c of o.issues)if(c.code==="unrecognized_keys")for(let d of c.keys){if(!r.has(d))r.set(d,{});r.get(d).r=!0}else e.issues.push(c);let i=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&n)e.issues.push({...n,keys:i});if(Tt(e))return e;let a=La(t.value,o.value);if(!a.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var vd=g("$ZodRecord",(e,t)=>{U.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Pt(n))return o.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),o;let i=[],a=t.keyType._zod.values;if(a){o.value={};let c=new Set;for(let p of a)if(typeof p==="string"||typeof p==="number"||typeof p==="symbol"){c.add(typeof p==="number"?p.toString():p);let m=t.keyType._zod.run({value:p,issues:[]},r);if(m instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(m.issues.length){o.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map((S)=>we(S,r,le())),input:p,path:[p],inst:e});continue}let f=m.value,y=t.valueType._zod.run({value:n[p],issues:[]},r);if(y instanceof Promise)i.push(y.then((S)=>{if(S.issues.length)o.issues.push(...Xe(p,S.issues));o.value[f]=S.value}));else{if(y.issues.length)o.issues.push(...Xe(p,y.issues));o.value[f]=y.value}}let d;for(let p in n)if(!c.has(p))d=d??[],d.push(p);if(d&&d.length>0)o.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:d})}else{o.value={};for(let c of Reflect.ownKeys(n)){if(c==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(n,c))continue;let d=t.keyType._zod.run({value:c,issues:[]},r);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof c==="string"&&Ma.test(c)&&d.issues.length){let f=t.keyType._zod.run({value:Number(c),issues:[]},r);if(f instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(f.issues.length===0)d=f}if(d.issues.length){if(t.mode==="loose")o.value[c]=n[c];else o.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((f)=>we(f,r,le())),input:c,path:[c],inst:e});continue}let m=t.valueType._zod.run({value:n[c],issues:[]},r);if(m instanceof Promise)i.push(m.then((f)=>{if(f.issues.length)o.issues.push(...Xe(c,f.issues));o.value[d.value]=f.value}));else{if(m.issues.length)o.issues.push(...Xe(c,m.issues));o.value[d.value]=m.value}}}if(i.length)return Promise.all(i).then(()=>o);return o}});var zd=g("$ZodEnum",(e,t)=>{U.init(e,t);let o=yi(t.entries),r=new Set(o);e._zod.values=r,e._zod.pattern=new RegExp(`^(${o.filter((n)=>Rl.has(typeof n)).map((n)=>typeof n==="string"?Qe(n):n.toString()).join("|")})$`),e._zod.parse=(n,i)=>{let a=n.value;if(r.has(a))return n;return n.issues.push({code:"invalid_value",values:o,input:a,inst:e}),n}}),wd=g("$ZodLiteral",(e,t)=>{if(U.init(e,t),t.values.length===0)throw Error("Cannot create literal schema with no valid values");let o=new Set(t.values);e._zod.values=o,e._zod.pattern=new RegExp(`^(${t.values.map((r)=>typeof r==="string"?Qe(r):r?Qe(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,n)=>{let i=r.value;if(o.has(i))return r;return r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}});var Rd=g("$ZodTransform",(e,t)=>{U.init(e,t),e._zod.optin="optional",e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Zr(e.constructor.name);let n=t.transform(o.value,o);if(r.async)return(n instanceof Promise?n:Promise.resolve(n)).then((a)=>(o.value=a,o.fallback=!0,o));if(n instanceof Promise)throw new Ae;return o.value=n,o.fallback=!0,o}});function Ou(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var Da=g("$ZodOptional",(e,t)=>{U.init(e,t),e._zod.optin="optional",e._zod.optout="optional",A(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),A(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${vi(o.source)})?$`):void 0}),e._zod.parse=(o,r)=>{if(t.innerType._zod.optin==="optional"){let n=o.value,i=t.innerType._zod.run(o,r);if(i instanceof Promise)return i.then((a)=>Ou(a,n));return Ou(i,n)}if(o.value===void 0)return o;return t.innerType._zod.run(o,r)}}),xd=g("$ZodExactOptional",(e,t)=>{Da.init(e,t),A(e._zod,"values",()=>t.innerType._zod.values),A(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(o,r)=>t.innerType._zod.run(o,r)}),Pd=g("$ZodNullable",(e,t)=>{U.init(e,t),A(e._zod,"optin",()=>t.innerType._zod.optin),A(e._zod,"optout",()=>t.innerType._zod.optout),A(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${vi(o.source)}|null)$`):void 0}),A(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(o,r)=>{if(o.value===null)return o;return t.innerType._zod.run(o,r)}}),Td=g("$ZodDefault",(e,t)=>{U.init(e,t),e._zod.optin="optional",A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);if(o.value===void 0)return o.value=t.defaultValue,o;let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>Nu(i,t));return Nu(n,t)}});function Nu(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Ed=g("$ZodPrefault",(e,t)=>{U.init(e,t),e._zod.optin="optional",A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);if(o.value===void 0)o.value=t.defaultValue;return t.innerType._zod.run(o,r)}}),kd=g("$ZodNonOptional",(e,t)=>{U.init(e,t),A(e._zod,"values",()=>{let o=t.innerType._zod.values;return o?new Set([...o].filter((r)=>r!==void 0)):void 0}),e._zod.parse=(o,r)=>{let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>Mu(i,e));return Mu(n,e)}});function Mu(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var $d=g("$ZodCatch",(e,t)=>{U.init(e,t),e._zod.optin="optional",A(e._zod,"optout",()=>t.innerType._zod.optout),A(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>{if(o.value=i.value,i.issues.length)o.value=t.catchValue({...o,error:{issues:i.issues.map((a)=>we(a,r,le()))},input:o.value}),o.issues=[],o.fallback=!0;return o});if(o.value=n.value,n.issues.length)o.value=t.catchValue({...o,error:{issues:n.issues.map((i)=>we(i,r,le()))},input:o.value}),o.issues=[],o.fallback=!0;return o}});var Va=g("$ZodPipe",(e,t)=>{U.init(e,t),A(e._zod,"values",()=>t.in._zod.values),A(e._zod,"optin",()=>t.in._zod.optin),A(e._zod,"optout",()=>t.out._zod.optout),A(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(o,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(o,r);if(i instanceof Promise)return i.then((a)=>Pi(a,t.in,r));return Pi(i,t.in,r)}let n=t.in._zod.run(o,r);if(n instanceof Promise)return n.then((i)=>Pi(i,t.out,r));return Pi(n,t.out,r)}});function Pi(e,t,o){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},o)}var Cd=g("$ZodPreprocess",(e,t)=>{Va.init(e,t)}),Id=g("$ZodReadonly",(e,t)=>{U.init(e,t),A(e._zod,"propValues",()=>t.innerType._zod.propValues),A(e._zod,"values",()=>t.innerType._zod.values),A(e._zod,"optin",()=>t.innerType?._zod?.optin),A(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(o,r)=>{if(r.direction==="backward")return t.innerType._zod.run(o,r);let n=t.innerType._zod.run(o,r);if(n instanceof Promise)return n.then(Au);return Au(n)}});function Au(e){return e.value=Object.freeze(e.value),e}var Od=g("$ZodLazy",(e,t)=>{U.init(e,t),A(e._zod,"innerType",()=>{let o=t;if(!o._cachedInner)o._cachedInner=t.getter();return o._cachedInner}),A(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),A(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),A(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),A(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(o,r)=>e._zod.innerType._zod.run(o,r)}),Nd=g("$ZodCustom",(e,t)=>{ee.init(e,t),U.init(e,t),e._zod.parse=(o,r)=>o,e._zod.check=(o)=>{let r=o.value,n=t.fn(r);if(n instanceof Promise)return n.then((i)=>qu(i,o,r,e));qu(n,o,r,e);return}});function qu(e,t,o,r){if(!e){let n={code:"custom",input:o,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)n.params=r._zod.def.params;t.issues.push(Et(n))}}var tf=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(n){return e[n]??null}let o={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return(n)=>{switch(n.code){case"invalid_type":{let i=r[n.expected]??n.expected,a=El(n.input),c=r[a]??a;return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":if(n.values.length===1)return`Invalid input: expected ${ka(n.values[0])}`;return`Invalid option: expected one of ${xa(n.values,"|")}`;case"too_big":{let i=n.inclusive?"<=":"<",a=t(n.origin);if(a)return`Too big: expected ${n.origin??"value"} to have ${i}${n.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${n.origin??"value"} to be ${i}${n.maximum.toString()}`}case"too_small":{let i=n.inclusive?">=":">",a=t(n.origin);if(a)return`Too small: expected ${n.origin} to have ${i}${n.minimum.toString()} ${a.unit}`;return`Too small: expected ${n.origin} to be ${i}${n.minimum.toString()}`}case"invalid_format":{let i=n;if(i.format==="starts_with")return`Invalid string: must start with "${i.prefix}"`;if(i.format==="ends_with")return`Invalid string: must end with "${i.suffix}"`;if(i.format==="includes")return`Invalid string: must include "${i.includes}"`;if(i.format==="regex")return`Invalid string: must match pattern ${i.pattern}`;return`Invalid ${o[i.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${xa(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":if(n.options&&Array.isArray(n.options)&&n.options.length>0)return`Invalid discriminator value. Expected ${n.options.map((a)=>`'${a}'`).join(" | ")}`;return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Ha(){return{localeError:tf()}}var Md,of=Symbol("ZodOutput"),rf=Symbol("ZodInput");class Ad{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let o=t[0];if(this._map.set(e,o),o&&typeof o==="object"&&"id"in o)this._idmap.set(o.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let o={...this.get(t)??{}};delete o.id;let r={...o,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function qd(){return new Ad}(Md=globalThis).__zod_globalRegistry??(Md.__zod_globalRegistry=qd());var et=globalThis.__zod_globalRegistry;function jd(e,t){return new e({type:"string",...T(t)})}function Fa(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...T(t)})}function Ja(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...T(t)})}function Ld(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...T(t)})}function Ud(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(t)})}function Zd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(t)})}function Dd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(t)})}function Ba(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...T(t)})}function Vd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...T(t)})}function Hd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(t)})}function Fd(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...T(t)})}function Jd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(t)})}function Bd(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...T(t)})}function Gd(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...T(t)})}function Wd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(t)})}function Kd(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(t)})}function Yd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(t)})}function Qd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(t)})}function Xd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(t)})}function ep(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...T(t)})}function tp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...T(t)})}function op(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...T(t)})}function rp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...T(t)})}function np(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(t)})}function sp(e,t){return new e({type:"string",format:"date",check:"string_format",...T(t)})}function ip(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...T(t)})}function ap(e,t){return new e({type:"string",format:"duration",check:"string_format",...T(t)})}function cp(e,t){return new e({type:"number",checks:[],...T(t)})}function lp(e,t){return new e({type:"number",coerce:!0,checks:[],...T(t)})}function up(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...T(t)})}function dp(e,t){return new e({type:"boolean",...T(t)})}function pp(e,t){return new e({type:"undefined",...T(t)})}function hp(e,t){return new e({type:"null",...T(t)})}function mp(e){return new e({type:"any"})}function fp(e){return new e({type:"unknown"})}function gp(e,t){return new e({type:"never",...T(t)})}function ki(e,t){return new Aa({check:"less_than",...T(t),value:e,inclusive:!1})}function Gr(e,t){return new Aa({check:"less_than",...T(t),value:e,inclusive:!0})}function $i(e,t){return new qa({check:"greater_than",...T(t),value:e,inclusive:!1})}function Wr(e,t){return new qa({check:"greater_than",...T(t),value:e,inclusive:!0})}function Ci(e,t){return new gu({check:"multiple_of",...T(t),value:e})}function Ii(e,t){return new _u({check:"max_length",...T(t),maximum:e})}function fo(e,t){return new yu({check:"min_length",...T(t),minimum:e})}function Oi(e,t){return new bu({check:"length_equals",...T(t),length:e})}function Ga(e,t){return new vu({check:"string_format",format:"regex",...T(t),pattern:e})}function Wa(e){return new zu({check:"string_format",format:"lowercase",...T(e)})}function Ka(e){return new wu({check:"string_format",format:"uppercase",...T(e)})}function Ya(e,t){return new Ru({check:"string_format",format:"includes",...T(t),includes:e})}function Qa(e,t){return new xu({check:"string_format",format:"starts_with",...T(t),prefix:e})}function Xa(e,t){return new Pu({check:"string_format",format:"ends_with",...T(t),suffix:e})}function tt(e){return new Tu({check:"overwrite",tx:e})}function ec(e){return tt((t)=>t.normalize(e))}function tc(){return tt((e)=>e.trim())}function oc(){return tt((e)=>e.toLowerCase())}function rc(){return tt((e)=>e.toUpperCase())}function nc(){return tt((e)=>zl(e))}function Sp(e,t,o){return new e({type:"array",element:t,...T(o)})}function _p(e,t,o){return new e({type:"custom",check:"custom",fn:t,...T(o)})}function yp(e,t){let o=nf((r)=>(r.addIssue=(n)=>{if(typeof n==="string")r.issues.push(Et(n,r.value,o._zod.def));else{let i=n;if(i.fatal)i.continue=!1;i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=o),i.continue??(i.continue=!o._zod.def.abort),r.issues.push(Et(i))}},e(r.value,r)),t);return o}function nf(e,t){let o=new ee({check:"custom",...T(t)});return o._zod.check=e,o}function Yr(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??et,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Z(e,t,o={path:[],schemaPath:[]}){var r;let n=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,o.schemaPath.includes(e))i.cycle=o.path;return i.schema}let a={schema:{},count:1,cycle:void 0,path:o.path};t.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let m={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{let y=a.schema,S=t.processors[n.type];if(!S)throw Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);S(e,t,y,m)}let f=e._zod.parent;if(f){if(!a.ref)a.ref=f;Z(f,t,m),t.seen.get(f).isParent=!0}}let d=t.metadataRegistry.get(e);if(d)Object.assign(a.schema,d);if(t.io==="input"&&ue(e))delete a.schema.examples,delete a.schema.default;if(t.io==="input"&&"_prefault"in a.schema)(r=a.schema).default??(r.default=a.schema._prefault);return delete a.schema._prefault,t.seen.get(e).schema}function Qr(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let a of e.seen.entries()){let c=e.metadataRegistry.get(a[0])?.id;if(c){let d=r.get(c);if(d&&d!==a[0])throw Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(c,a[0])}}let n=(a)=>{let c=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(a[0])?.id,y=e.external.uri??((w)=>w);if(f)return{ref:y(f)};let S=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=S,{defId:S,ref:`${y("__shared")}#/${c}/${S}`}}if(a[1]===o)return{ref:"#"};let p=`${"#"}/${c}/`,m=a[1].schema.id??`__schema${e.counter++}`;return{defId:m,ref:p+m}},i=(a)=>{if(a[1].schema.$ref)return;let c=a[1],{ref:d,defId:p}=n(a);if(c.def={...c.schema},p)c.defId=p;let m=c.schema;for(let f in m)delete m[f];m.$ref=d};if(e.cycles==="throw")for(let a of e.seen.entries()){let c=a[1];if(c.cycle)throw Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
64
63
|
|
|
65
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let c=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(c.cycle){s(i);continue}if(c.count>1&&e.reused==="ref"){s(i);continue}}}function Tt(e,t){let o=e.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=c=>{let l=e.seen.get(c);if(l.ref===null)return;let u=l.def??l.schema,h={...u},f=l.ref;if(l.ref=null,f){r(f);let _=e.seen.get(f),v=_.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(v)):Object.assign(u,v),Object.assign(u,h),c._zod.parent===f)for(let T in u)T==="$ref"||T==="allOf"||T in h||delete u[T];if(v.$ref&&_.def)for(let T in u)T==="$ref"||T==="allOf"||T in _.def&&JSON.stringify(u[T])===JSON.stringify(_.def[T])&&delete u[T]}let y=c._zod.parent;if(y&&y!==f){r(y);let _=e.seen.get(y);if(_?.schema.$ref&&(u.$ref=_.schema.$ref,_.def))for(let v in u)v==="$ref"||v==="allOf"||v in _.def&&JSON.stringify(u[v])===JSON.stringify(_.def[v])&&delete u[v]}e.override({zodSchema:c,jsonSchema:u,path:l.path??[]})};for(let c of[...e.seen.entries()].reverse())r(c[0]);let n={};if(e.target==="draft-2020-12"?n.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?n.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?n.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}Object.assign(n,o.def??o.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let i=e.external?.defs??{};for(let c of e.seen.entries()){let l=c[1];l.def&&l.defId&&(l.def.id===l.defId&&delete l.def.id,i[l.defId]=l.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?n.$defs=i:n.definitions=i);try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:dr(t,"input",e.processors),output:dr(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch{throw new Error("Error converting schema to JSON.")}}function Se(e,t){let o=t??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Se(r.element,o);if(r.type==="set")return Se(r.valueType,o);if(r.type==="lazy")return Se(r.getter(),o);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return Se(r.innerType,o);if(r.type==="intersection")return Se(r.left,o)||Se(r.right,o);if(r.type==="record"||r.type==="map")return Se(r.keyType,o)||Se(r.valueType,o);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Se(r.in,o)||Se(r.out,o);if(r.type==="object"){for(let n in r.shape)if(Se(r.shape[n],o))return!0;return!1}if(r.type==="union"){for(let n of r.options)if(Se(n,o))return!0;return!1}if(r.type==="tuple"){for(let n of r.items)if(Se(n,o))return!0;return!!(r.rest&&Se(r.rest,o))}return!1}var ch=(e,t={})=>o=>{let r=xt({...o,processors:t});return H(e,r),Pt(r,e),Tt(r,e)},dr=(e,t,o={})=>r=>{let{libraryOptions:n,target:s}=r??{},i=xt({...n??{},target:s,io:t,processors:o});return H(e,i),Pt(i,e),Tt(i,e)};var $b={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},lh=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:s,maximum:i,format:c,patterns:l,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof i=="number"&&(n.maxLength=i),c&&(n.format=$b[c]??c,n.format===""&&delete n.format,c==="time"&&delete n.format),u&&(n.contentEncoding=u),l&&l.size>0){let h=[...l];h.length===1?n.pattern=h[0].source:h.length>1&&(n.allOf=[...h.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},uh=(e,t,o,r)=>{let n=o,{minimum:s,maximum:i,format:c,multipleOf:l,exclusiveMaximum:u,exclusiveMinimum:h}=e._zod.bag;typeof c=="string"&&c.includes("int")?n.type="integer":n.type="number";let f=typeof h=="number"&&h>=(s??Number.NEGATIVE_INFINITY),y=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),_=t.target==="draft-04"||t.target==="openapi-3.0";f?_?(n.minimum=h,n.exclusiveMinimum=!0):n.exclusiveMinimum=h:typeof s=="number"&&(n.minimum=s),y?_?(n.maximum=u,n.exclusiveMaximum=!0):n.exclusiveMaximum=u:typeof i=="number"&&(n.maximum=i),typeof l=="number"&&(n.multipleOf=l)},dh=(e,t,o,r)=>{o.type="boolean"},ph=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},hh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},mh=(e,t,o,r)=>{t.target==="openapi-3.0"?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},fh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},gh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},Sh=(e,t,o,r)=>{o.not={}},_h=(e,t,o,r)=>{},yh=(e,t,o,r)=>{},bh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},vh=(e,t,o,r)=>{let n=e._zod.def,s=Fn(n.entries);s.every(i=>typeof i=="number")&&(o.type="number"),s.every(i=>typeof i=="string")&&(o.type="string"),o.enum=s},zh=(e,t,o,r)=>{let n=e._zod.def,s=[];for(let i of n.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];o.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?o.enum=[i]:o.const=i}else s.every(i=>typeof i=="number")&&(o.type="number"),s.every(i=>typeof i=="string")&&(o.type="string"),s.every(i=>typeof i=="boolean")&&(o.type="boolean"),s.every(i=>i===null)&&(o.type="null"),o.enum=s},wh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Rh=(e,t,o,r)=>{let n=o,s=e._zod.pattern;if(!s)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=s.source},xh=(e,t,o,r)=>{let n=o,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:c,mime:l}=e._zod.bag;i!==void 0&&(s.minLength=i),c!==void 0&&(s.maxLength=c),l?l.length===1?(s.contentMediaType=l[0],Object.assign(n,s)):(Object.assign(n,s),n.anyOf=l.map(u=>({contentMediaType:u}))):Object.assign(n,s)},Ph=(e,t,o,r)=>{o.type="boolean"},Th=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},kh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Eh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},$h=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Ch=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Ih=(e,t,o,r)=>{let n=o,s=e._zod.def,{minimum:i,maximum:c}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof c=="number"&&(n.maxItems=c),n.type="array",n.items=H(s.element,t,{...r,path:[...r.path,"items"]})},Oh=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="object",n.properties={};let i=s.shape;for(let u in i)n.properties[u]=H(i[u],t,{...r,path:[...r.path,"properties",u]});let c=new Set(Object.keys(i)),l=new Set([...c].filter(u=>{let h=s.shape[u]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(n.required=Array.from(l)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=H(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(n.additionalProperties=!1)},jc=(e,t,o,r)=>{let n=e._zod.def,s=n.inclusive===!1,i=n.options.map((c,l)=>H(c,t,{...r,path:[...r.path,s?"oneOf":"anyOf",l]}));s?o.oneOf=i:o.anyOf=i},Nh=(e,t,o,r)=>{let n=e._zod.def,s=H(n.left,t,{...r,path:[...r.path,"allOf",0]}),i=H(n.right,t,{...r,path:[...r.path,"allOf",1]}),c=u=>"allOf"in u&&Object.keys(u).length===1,l=[...c(s)?s.allOf:[s],...c(i)?i.allOf:[i]];o.allOf=l},Ah=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="array";let i=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",l=s.items.map((y,_)=>H(y,t,{...r,path:[...r.path,i,_]})),u=s.rest?H(s.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=l,u&&(n.items=u)):t.target==="openapi-3.0"?(n.items={anyOf:l},u&&n.items.anyOf.push(u),n.minItems=l.length,u||(n.maxItems=l.length)):(n.items=l,u&&(n.additionalItems=u));let{minimum:h,maximum:f}=e._zod.bag;typeof h=="number"&&(n.minItems=h),typeof f=="number"&&(n.maxItems=f)},Mh=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="object";let i=s.keyType,l=i._zod.bag?.patterns;if(s.mode==="loose"&&l&&l.size>0){let h=H(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let f of l)n.patternProperties[f.source]=h}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=H(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),n.additionalProperties=H(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let u=i._zod.values;if(u){let h=[...u].filter(f=>typeof f=="string"||typeof f=="number");h.length>0&&(n.required=h)}},qh=(e,t,o,r)=>{let n=e._zod.def,s=H(n.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,o.nullable=!0):o.anyOf=[s,{type:"null"}]},jh=(e,t,o,r)=>{let n=e._zod.def;H(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Lh=(e,t,o,r)=>{let n=e._zod.def;H(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType,o.default=JSON.parse(JSON.stringify(n.defaultValue))},Uh=(e,t,o,r)=>{let n=e._zod.def;H(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(o._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Zh=(e,t,o,r)=>{let n=e._zod.def;H(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}o.default=i},Dh=(e,t,o,r)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?n.out:n.in:n.out;H(i,t,r);let c=t.seen.get(e);c.ref=i},Vh=(e,t,o,r)=>{let n=e._zod.def;H(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType,o.readOnly=!0},Hh=(e,t,o,r)=>{let n=e._zod.def;H(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Lc=(e,t,o,r)=>{let n=e._zod.def;H(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Fh=(e,t,o,r)=>{let n=e._zod.innerType;H(n,t,r);let s=t.seen.get(e);s.ref=n},qc={string:lh,number:uh,boolean:dh,bigint:ph,symbol:hh,null:mh,undefined:fh,void:gh,never:Sh,any:_h,unknown:yh,date:bh,enum:vh,literal:zh,nan:wh,template_literal:Rh,file:xh,success:Ph,custom:Th,function:kh,transform:Eh,map:$h,set:Ch,array:Ih,object:Oh,union:jc,intersection:Nh,tuple:Ah,record:Mh,nullable:qh,nonoptional:jh,default:Lh,prefault:Uh,catch:Zh,pipe:Dh,readonly:Vh,promise:Hh,optional:Lc,lazy:Fh};function io(e,t){if("_idmap"in e){let r=e,n=xt({...t,processors:qc}),s={};for(let l of r._idmap.entries()){let[u,h]=l;H(h,n)}let i={},c={registry:r,uri:t?.uri,defs:s};n.external=c;for(let l of r._idmap.entries()){let[u,h]=l;Pt(n,h),i[u]=Tt(n,h)}if(Object.keys(s).length>0){let l=n.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[l]:s}}return{schemas:i}}let o=xt({...t,processors:qc});return H(e,o),Pt(o,e),Tt(o,e)}var Uc=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let o=t?.target??"draft-2020-12";o==="draft-4"&&(o="draft-04"),o==="draft-7"&&(o="draft-07"),this.ctx=xt({processors:qc,target:o,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,o={path:[],schemaPath:[]}){return H(t,this.ctx,o)}emit(t,o){o&&(o.cycles&&(this.ctx.cycles=o.cycles),o.reused&&(this.ctx.reused=o.reused),o.external&&(this.ctx.external=o.external)),Pt(this.ctx,t);let r=Tt(this.ctx,t),{"~standard":n,...s}=r;return s}};var fg={};var cs={};et(cs,{ZodAny:()=>dm,ZodArray:()=>fm,ZodBase64:()=>cl,ZodBase64URL:()=>ll,ZodBigInt:()=>yr,ZodBigIntFormat:()=>pl,ZodBoolean:()=>_r,ZodCIDRv4:()=>il,ZodCIDRv6:()=>al,ZodCUID:()=>Xc,ZodCUID2:()=>el,ZodCatch:()=>Am,ZodCodec:()=>_s,ZodCustom:()=>ys,ZodCustomStringFormat:()=>gr,ZodDate:()=>ms,ZodDefault:()=>Em,ZodDiscriminatedUnion:()=>Sm,ZodE164:()=>ul,ZodEmail:()=>Wc,ZodEmoji:()=>Yc,ZodEnum:()=>hr,ZodExactOptional:()=>Pm,ZodFile:()=>Rm,ZodFunction:()=>Hm,ZodGUID:()=>us,ZodIPv4:()=>nl,ZodIPv6:()=>sl,ZodIntersection:()=>_m,ZodJWT:()=>dl,ZodKSUID:()=>rl,ZodLazy:()=>Dm,ZodLiteral:()=>wm,ZodMAC:()=>am,ZodMap:()=>vm,ZodNaN:()=>qm,ZodNanoID:()=>Qc,ZodNever:()=>hm,ZodNonOptional:()=>Sl,ZodNull:()=>um,ZodNullable:()=>km,ZodNumber:()=>Sr,ZodNumberFormat:()=>ao,ZodObject:()=>fs,ZodOptional:()=>gl,ZodPipe:()=>Ss,ZodPrefault:()=>Cm,ZodPreprocess:()=>jm,ZodPromise:()=>Vm,ZodReadonly:()=>Lm,ZodRecord:()=>pr,ZodSet:()=>zm,ZodString:()=>mr,ZodStringFormat:()=>J,ZodSuccess:()=>Nm,ZodSymbol:()=>cm,ZodTemplateLiteral:()=>Zm,ZodTransform:()=>xm,ZodTuple:()=>ym,ZodType:()=>q,ZodULID:()=>tl,ZodURL:()=>hs,ZodUUID:()=>He,ZodUndefined:()=>lm,ZodUnion:()=>gs,ZodUnknown:()=>pm,ZodVoid:()=>mm,ZodXID:()=>ol,ZodXor:()=>gm,_ZodString:()=>Gc,_default:()=>$m,_function:()=>SS,any:()=>hl,array:()=>g,base64:()=>Mg,base64url:()=>qg,bigint:()=>Gg,boolean:()=>R,catch:()=>Mm,check:()=>_S,cidrv4:()=>Ng,cidrv6:()=>Ag,codec:()=>hS,cuid:()=>Pg,cuid2:()=>Tg,custom:()=>yS,date:()=>eS,describe:()=>bS,discriminatedUnion:()=>kt,e164:()=>jg,email:()=>Kc,emoji:()=>Rg,enum:()=>I,exactOptional:()=>Tm,file:()=>lS,float32:()=>Hg,float64:()=>Fg,function:()=>SS,guid:()=>_g,hash:()=>Vg,hex:()=>Dg,hostname:()=>Zg,httpUrl:()=>wg,instanceof:()=>zS,int:()=>Jc,int32:()=>Jg,int64:()=>Wg,intersection:()=>qe,invertCodec:()=>mS,ipv4:()=>Cg,ipv6:()=>Og,json:()=>RS,jwt:()=>Lg,keyof:()=>tS,ksuid:()=>$g,lazy:()=>Et,literal:()=>S,looseObject:()=>C,looseRecord:()=>sS,mac:()=>Ig,map:()=>iS,meta:()=>vS,nan:()=>pS,nanoid:()=>xg,nativeEnum:()=>cS,never:()=>ml,nonoptional:()=>Om,null:()=>Fe,nullable:()=>ds,nullish:()=>uS,number:()=>b,object:()=>p,optional:()=>$,partialRecord:()=>nS,pipe:()=>Bc,prefault:()=>Im,preprocess:()=>nt,promise:()=>gS,readonly:()=>Um,record:()=>w,refine:()=>Fm,set:()=>aS,strictObject:()=>oS,string:()=>a,stringFormat:()=>Ug,stringbool:()=>wS,success:()=>dS,superRefine:()=>Jm,symbol:()=>Yg,templateLiteral:()=>fS,transform:()=>fl,tuple:()=>bm,uint32:()=>Bg,uint64:()=>Kg,ulid:()=>kg,undefined:()=>Qg,union:()=>P,unknown:()=>E,url:()=>fr,uuid:()=>yg,uuidv4:()=>bg,uuidv6:()=>vg,uuidv7:()=>zg,void:()=>Xg,xid:()=>Eg,xor:()=>rS});var Zc={};et(Zc,{endsWith:()=>rr,gt:()=>De,gte:()=>ge,includes:()=>tr,length:()=>so,lowercase:()=>Xo,lt:()=>Ze,lte:()=>xe,maxLength:()=>no,maxSize:()=>Rt,mime:()=>nr,minLength:()=>ot,minSize:()=>Ve,multipleOf:()=>wt,negative:()=>Oc,nonnegative:()=>Ac,nonpositive:()=>Nc,normalize:()=>sr,overwrite:()=>Me,positive:()=>Ic,property:()=>Mc,regex:()=>Qo,size:()=>ro,slugify:()=>lr,startsWith:()=>or,toLowerCase:()=>ar,toUpperCase:()=>cr,trim:()=>ir,uppercase:()=>er});var Pe={};et(Pe,{ZodISODate:()=>Vc,ZodISODateTime:()=>Dc,ZodISODuration:()=>Fc,ZodISOTime:()=>Hc,date:()=>Bh,datetime:()=>Jh,duration:()=>Wh,time:()=>Gh});var Dc=m("ZodISODateTime",(e,t)=>{wd.init(e,t),J.init(e,t)});function Jh(e){return Tp(Dc,e)}var Vc=m("ZodISODate",(e,t)=>{Rd.init(e,t),J.init(e,t)});function Bh(e){return kp(Vc,e)}var Hc=m("ZodISOTime",(e,t)=>{xd.init(e,t),J.init(e,t)});function Gh(e){return Ep(Hc,e)}var Fc=m("ZodISODuration",(e,t)=>{Pd.init(e,t),J.init(e,t)});function Wh(e){return $p(Fc,e)}var gg=(e,t)=>{Kn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>Qn(e,o)},flatten:{value:o=>Yn(e,o)},addIssue:{value:o=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Ho,2)}},addIssues:{value:o=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Ho,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ib=m("ZodError",gg),ve=m("ZodError",gg,{Parent:Error});var Kh=Bo(ve),Yh=Go(ve),ls=Wo(ve),Qh=Ko(ve),Xh=Da(ve),em=Va(ve),tm=Ha(ve),om=Fa(ve),rm=Ja(ve),nm=Ba(ve),sm=Ga(ve),im=Wa(ve);var Sg=new WeakMap;function ps(e,t,o){let r=Object.getPrototypeOf(e),n=Sg.get(r);if(n||(n=new Set,Sg.set(r,n)),!n.has(t)){n.add(t);for(let s in o){let i=o[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let c=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}var q=m("ZodType",(e,t)=>(A.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:dr(e,"input"),output:dr(e,"output")}}),e.toJSONSchema=ch(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>Kh(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>ls(e,o,r),e.parseAsync=async(o,r)=>Yh(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>Qh(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>Xh(e,o,r),e.decode=(o,r)=>em(e,o,r),e.encodeAsync=async(o,r)=>tm(e,o,r),e.decodeAsync=async(o,r)=>om(e,o,r),e.safeEncode=(o,r)=>rm(e,o,r),e.safeDecode=(o,r)=>nm(e,o,r),e.safeEncodeAsync=async(o,r)=>sm(e,o,r),e.safeDecodeAsync=async(o,r)=>im(e,o,r),ps(e,"ZodType",{check(...o){let r=this.def;return this.clone(N.mergeDefs(r,{checks:[...r.checks??[],...o.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,r){return me(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(Fm(o,r))},superRefine(o,r){return this.check(Jm(o,r))},overwrite(o){return this.check(Me(o))},optional(){return $(this)},exactOptional(){return Tm(this)},nullable(){return ds(this)},nullish(){return $(ds(this))},nonoptional(o){return Om(this,o)},array(){return g(this)},or(o){return P([this,o])},and(o){return qe(this,o)},transform(o){return Bc(this,fl(o))},default(o){return $m(this,o)},prefault(o){return Im(this,o)},catch(o){return Mm(this,o)},pipe(o){return Bc(this,o)},readonly(){return Um(this)},describe(o){let r=this.clone();return ne.add(r,{description:o}),r},meta(...o){if(o.length===0)return ne.get(this);let r=this.clone();return ne.add(r,o[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){return ne.get(e)?.description},configurable:!0}),e)),Gc=m("_ZodString",(e,t)=>{oo.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>lh(e,r,n,s);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,ps(e,"_ZodString",{regex(...r){return this.check(Qo(...r))},includes(...r){return this.check(tr(...r))},startsWith(...r){return this.check(or(...r))},endsWith(...r){return this.check(rr(...r))},min(...r){return this.check(ot(...r))},max(...r){return this.check(no(...r))},length(...r){return this.check(so(...r))},nonempty(...r){return this.check(ot(1,...r))},lowercase(r){return this.check(Xo(r))},uppercase(r){return this.check(er(r))},trim(){return this.check(ir())},normalize(...r){return this.check(sr(...r))},toLowerCase(){return this.check(ar())},toUpperCase(){return this.check(cr())},slugify(){return this.check(lr())}})}),mr=m("ZodString",(e,t)=>{oo.init(e,t),Gc.init(e,t),e.email=o=>e.check(pc(Wc,o)),e.url=o=>e.check(as(hs,o)),e.jwt=o=>e.check(Cc(dl,o)),e.emoji=o=>e.check(Sc(Yc,o)),e.guid=o=>e.check(is(us,o)),e.uuid=o=>e.check(hc(He,o)),e.uuidv4=o=>e.check(mc(He,o)),e.uuidv6=o=>e.check(fc(He,o)),e.uuidv7=o=>e.check(gc(He,o)),e.nanoid=o=>e.check(_c(Qc,o)),e.guid=o=>e.check(is(us,o)),e.cuid=o=>e.check(yc(Xc,o)),e.cuid2=o=>e.check(bc(el,o)),e.ulid=o=>e.check(vc(tl,o)),e.base64=o=>e.check(kc(cl,o)),e.base64url=o=>e.check(Ec(ll,o)),e.xid=o=>e.check(zc(ol,o)),e.ksuid=o=>e.check(wc(rl,o)),e.ipv4=o=>e.check(Rc(nl,o)),e.ipv6=o=>e.check(xc(sl,o)),e.cidrv4=o=>e.check(Pc(il,o)),e.cidrv6=o=>e.check(Tc(al,o)),e.e164=o=>e.check($c(ul,o)),e.datetime=o=>e.check(Jh(o)),e.date=o=>e.check(Bh(o)),e.time=o=>e.check(Gh(o)),e.duration=o=>e.check(Wh(o))});function a(e){return wp(mr,e)}var J=m("ZodStringFormat",(e,t)=>{F.init(e,t),Gc.init(e,t)}),Wc=m("ZodEmail",(e,t)=>{md.init(e,t),J.init(e,t)});function Kc(e){return pc(Wc,e)}var us=m("ZodGUID",(e,t)=>{pd.init(e,t),J.init(e,t)});function _g(e){return is(us,e)}var He=m("ZodUUID",(e,t)=>{hd.init(e,t),J.init(e,t)});function yg(e){return hc(He,e)}function bg(e){return mc(He,e)}function vg(e){return fc(He,e)}function zg(e){return gc(He,e)}var hs=m("ZodURL",(e,t)=>{fd.init(e,t),J.init(e,t)});function fr(e){return as(hs,e)}function wg(e){return as(hs,{protocol:Re.httpProtocol,hostname:Re.domain,...N.normalizeParams(e)})}var Yc=m("ZodEmoji",(e,t)=>{gd.init(e,t),J.init(e,t)});function Rg(e){return Sc(Yc,e)}var Qc=m("ZodNanoID",(e,t)=>{Sd.init(e,t),J.init(e,t)});function xg(e){return _c(Qc,e)}var Xc=m("ZodCUID",(e,t)=>{_d.init(e,t),J.init(e,t)});function Pg(e){return yc(Xc,e)}var el=m("ZodCUID2",(e,t)=>{yd.init(e,t),J.init(e,t)});function Tg(e){return bc(el,e)}var tl=m("ZodULID",(e,t)=>{bd.init(e,t),J.init(e,t)});function kg(e){return vc(tl,e)}var ol=m("ZodXID",(e,t)=>{vd.init(e,t),J.init(e,t)});function Eg(e){return zc(ol,e)}var rl=m("ZodKSUID",(e,t)=>{zd.init(e,t),J.init(e,t)});function $g(e){return wc(rl,e)}var nl=m("ZodIPv4",(e,t)=>{Td.init(e,t),J.init(e,t)});function Cg(e){return Rc(nl,e)}var am=m("ZodMAC",(e,t)=>{Ed.init(e,t),J.init(e,t)});function Ig(e){return xp(am,e)}var sl=m("ZodIPv6",(e,t)=>{kd.init(e,t),J.init(e,t)});function Og(e){return xc(sl,e)}var il=m("ZodCIDRv4",(e,t)=>{$d.init(e,t),J.init(e,t)});function Ng(e){return Pc(il,e)}var al=m("ZodCIDRv6",(e,t)=>{Cd.init(e,t),J.init(e,t)});function Ag(e){return Tc(al,e)}var cl=m("ZodBase64",(e,t)=>{Od.init(e,t),J.init(e,t)});function Mg(e){return kc(cl,e)}var ll=m("ZodBase64URL",(e,t)=>{Nd.init(e,t),J.init(e,t)});function qg(e){return Ec(ll,e)}var ul=m("ZodE164",(e,t)=>{Ad.init(e,t),J.init(e,t)});function jg(e){return $c(ul,e)}var dl=m("ZodJWT",(e,t)=>{Md.init(e,t),J.init(e,t)});function Lg(e){return Cc(dl,e)}var gr=m("ZodCustomStringFormat",(e,t)=>{qd.init(e,t),J.init(e,t)});function Ug(e,t,o={}){return ur(gr,e,t,o)}function Zg(e){return ur(gr,"hostname",Re.hostname,e)}function Dg(e){return ur(gr,"hex",Re.hex,e)}function Vg(e,t){let o=t?.enc??"hex",r=`${e}_${o}`,n=Re[r];if(!n)throw new Error(`Unrecognized hash format: ${r}`);return ur(gr,r,n,t)}var Sr=m("ZodNumber",(e,t)=>{nc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>uh(e,r,n,s),ps(e,"ZodNumber",{gt(r,n){return this.check(De(r,n))},gte(r,n){return this.check(ge(r,n))},min(r,n){return this.check(ge(r,n))},lt(r,n){return this.check(Ze(r,n))},lte(r,n){return this.check(xe(r,n))},max(r,n){return this.check(xe(r,n))},int(r){return this.check(Jc(r))},safe(r){return this.check(Jc(r))},positive(r){return this.check(De(0,r))},nonnegative(r){return this.check(ge(0,r))},negative(r){return this.check(Ze(0,r))},nonpositive(r){return this.check(xe(0,r))},multipleOf(r,n){return this.check(wt(r,n))},step(r,n){return this.check(wt(r,n))},finite(){return this}});let o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??.5),e.isFinite=!0,e.format=o.format??null});function b(e){return Cp(Sr,e)}var ao=m("ZodNumberFormat",(e,t)=>{jd.init(e,t),Sr.init(e,t)});function Jc(e){return Op(ao,e)}function Hg(e){return Np(ao,e)}function Fg(e){return Ap(ao,e)}function Jg(e){return Mp(ao,e)}function Bg(e){return qp(ao,e)}var _r=m("ZodBoolean",(e,t)=>{os.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>dh(e,o,r,n)});function R(e){return jp(_r,e)}var yr=m("ZodBigInt",(e,t)=>{sc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>ph(e,r,n,s),e.gte=(r,n)=>e.check(ge(r,n)),e.min=(r,n)=>e.check(ge(r,n)),e.gt=(r,n)=>e.check(De(r,n)),e.gte=(r,n)=>e.check(ge(r,n)),e.min=(r,n)=>e.check(ge(r,n)),e.lt=(r,n)=>e.check(Ze(r,n)),e.lte=(r,n)=>e.check(xe(r,n)),e.max=(r,n)=>e.check(xe(r,n)),e.positive=r=>e.check(De(BigInt(0),r)),e.negative=r=>e.check(Ze(BigInt(0),r)),e.nonpositive=r=>e.check(xe(BigInt(0),r)),e.nonnegative=r=>e.check(ge(BigInt(0),r)),e.multipleOf=(r,n)=>e.check(wt(r,n));let o=e._zod.bag;e.minValue=o.minimum??null,e.maxValue=o.maximum??null,e.format=o.format??null});function Gg(e){return Up(yr,e)}var pl=m("ZodBigIntFormat",(e,t)=>{Ld.init(e,t),yr.init(e,t)});function Wg(e){return Dp(pl,e)}function Kg(e){return Vp(pl,e)}var cm=m("ZodSymbol",(e,t)=>{Ud.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>hh(e,o,r,n)});function Yg(e){return Hp(cm,e)}var lm=m("ZodUndefined",(e,t)=>{Zd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>fh(e,o,r,n)});function Qg(e){return Fp(lm,e)}var um=m("ZodNull",(e,t)=>{Dd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>mh(e,o,r,n)});function Fe(e){return Jp(um,e)}var dm=m("ZodAny",(e,t)=>{Vd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>_h(e,o,r,n)});function hl(){return Bp(dm)}var pm=m("ZodUnknown",(e,t)=>{Hd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>yh(e,o,r,n)});function E(){return Gp(pm)}var hm=m("ZodNever",(e,t)=>{Fd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Sh(e,o,r,n)});function ml(e){return Wp(hm,e)}var mm=m("ZodVoid",(e,t)=>{Jd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>gh(e,o,r,n)});function Xg(e){return Kp(mm,e)}var ms=m("ZodDate",(e,t)=>{Bd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>bh(e,r,n,s),e.min=(r,n)=>e.check(ge(r,n)),e.max=(r,n)=>e.check(xe(r,n));let o=e._zod.bag;e.minDate=o.minimum?new Date(o.minimum):null,e.maxDate=o.maximum?new Date(o.maximum):null});function eS(e){return Yp(ms,e)}var fm=m("ZodArray",(e,t)=>{Gd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ih(e,o,r,n),e.element=t.element,ps(e,"ZodArray",{min(o,r){return this.check(ot(o,r))},nonempty(o){return this.check(ot(1,o))},max(o,r){return this.check(no(o,r))},length(o,r){return this.check(so(o,r))},unwrap(){return this.element}})});function g(e,t){return eh(fm,e,t)}function tS(e){let t=e._zod.def.shape;return I(Object.keys(t))}var fs=m("ZodObject",(e,t)=>{Wd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Oh(e,o,r,n),N.defineLazy(e,"shape",()=>t.shape),ps(e,"ZodObject",{keyof(){return I(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:E()})},loose(){return this.clone({...this._zod.def,catchall:E()})},strict(){return this.clone({...this._zod.def,catchall:ml()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return N.extend(this,o)},safeExtend(o){return N.safeExtend(this,o)},merge(o){return N.merge(this,o)},pick(o){return N.pick(this,o)},omit(o){return N.omit(this,o)},partial(...o){return N.partial(gl,this,o[0])},required(...o){return N.required(Sl,this,o[0])}})});function p(e,t){let o={type:"object",shape:e??{},...N.normalizeParams(t)};return new fs(o)}function oS(e,t){return new fs({type:"object",shape:e,catchall:ml(),...N.normalizeParams(t)})}function C(e,t){return new fs({type:"object",shape:e,catchall:E(),...N.normalizeParams(t)})}var gs=m("ZodUnion",(e,t)=>{rs.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n),e.options=t.options});function P(e,t){return new gs({type:"union",options:e,...N.normalizeParams(t)})}var gm=m("ZodXor",(e,t)=>{gs.init(e,t),Kd.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n),e.options=t.options});function rS(e,t){return new gm({type:"union",options:e,inclusive:!1,...N.normalizeParams(t)})}var Sm=m("ZodDiscriminatedUnion",(e,t)=>{gs.init(e,t),Yd.init(e,t)});function kt(e,t,o){return new Sm({type:"union",options:t,discriminator:e,...N.normalizeParams(o)})}var _m=m("ZodIntersection",(e,t)=>{Qd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Nh(e,o,r,n)});function qe(e,t){return new _m({type:"intersection",left:e,right:t})}var ym=m("ZodTuple",(e,t)=>{ic.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ah(e,o,r,n),e.rest=o=>e.clone({...e._zod.def,rest:o})});function bm(e,t,o){let r=t instanceof A,n=r?o:t,s=r?t:null;return new ym({type:"tuple",items:e,rest:s,...N.normalizeParams(n)})}var pr=m("ZodRecord",(e,t)=>{Xd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Mh(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function w(e,t,o){return!t||!t._zod?new pr({type:"record",keyType:a(),valueType:e,...N.normalizeParams(t)}):new pr({type:"record",keyType:e,valueType:t,...N.normalizeParams(o)})}function nS(e,t,o){let r=me(e);return r._zod.values=void 0,new pr({type:"record",keyType:r,valueType:t,...N.normalizeParams(o)})}function sS(e,t,o){return new pr({type:"record",keyType:e,valueType:t,mode:"loose",...N.normalizeParams(o)})}var vm=m("ZodMap",(e,t)=>{ep.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>$h(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...o)=>e.check(Ve(...o)),e.nonempty=o=>e.check(Ve(1,o)),e.max=(...o)=>e.check(Rt(...o)),e.size=(...o)=>e.check(ro(...o))});function iS(e,t,o){return new vm({type:"map",keyType:e,valueType:t,...N.normalizeParams(o)})}var zm=m("ZodSet",(e,t)=>{tp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ch(e,o,r,n),e.min=(...o)=>e.check(Ve(...o)),e.nonempty=o=>e.check(Ve(1,o)),e.max=(...o)=>e.check(Rt(...o)),e.size=(...o)=>e.check(ro(...o))});function aS(e,t){return new zm({type:"set",valueType:e,...N.normalizeParams(t)})}var hr=m("ZodEnum",(e,t)=>{op.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>vh(e,r,n,s),e.enum=t.entries,e.options=Object.values(t.entries);let o=new Set(Object.keys(t.entries));e.extract=(r,n)=>{let s={};for(let i of r)if(o.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new hr({...t,checks:[],...N.normalizeParams(n),entries:s})},e.exclude=(r,n)=>{let s={...t.entries};for(let i of r)if(o.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new hr({...t,checks:[],...N.normalizeParams(n),entries:s})}});function I(e,t){let o=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new hr({type:"enum",entries:o,...N.normalizeParams(t)})}function cS(e,t){return new hr({type:"enum",entries:e,...N.normalizeParams(t)})}var wm=m("ZodLiteral",(e,t)=>{rp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>zh(e,o,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function S(e,t){return new wm({type:"literal",values:Array.isArray(e)?e:[e],...N.normalizeParams(t)})}var Rm=m("ZodFile",(e,t)=>{np.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>xh(e,o,r,n),e.min=(o,r)=>e.check(Ve(o,r)),e.max=(o,r)=>e.check(Rt(o,r)),e.mime=(o,r)=>e.check(nr(Array.isArray(o)?o:[o],r))});function lS(e){return th(Rm,e)}var xm=m("ZodTransform",(e,t)=>{sp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Eh(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new _t(e.constructor.name);o.addIssue=s=>{if(typeof s=="string")o.issues.push(N.issue(s,o.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=o.value),i.inst??(i.inst=e),o.issues.push(N.issue(i))}};let n=t.transform(o.value,o);return n instanceof Promise?n.then(s=>(o.value=s,o.fallback=!0,o)):(o.value=n,o.fallback=!0,o)}});function fl(e){return new xm({type:"transform",transform:e})}var gl=m("ZodOptional",(e,t)=>{ac.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Lc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function $(e){return new gl({type:"optional",innerType:e})}var Pm=m("ZodExactOptional",(e,t)=>{ip.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Lc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Tm(e){return new Pm({type:"optional",innerType:e})}var km=m("ZodNullable",(e,t)=>{ap.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>qh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function ds(e){return new km({type:"nullable",innerType:e})}function uS(e){return $(ds(e))}var Em=m("ZodDefault",(e,t)=>{cp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Lh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function $m(e,t){return new Em({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():N.shallowClone(t)}})}var Cm=m("ZodPrefault",(e,t)=>{lp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Uh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Im(e,t){return new Cm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():N.shallowClone(t)}})}var Sl=m("ZodNonOptional",(e,t)=>{up.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Om(e,t){return new Sl({type:"nonoptional",innerType:e,...N.normalizeParams(t)})}var Nm=m("ZodSuccess",(e,t)=>{dp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ph(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function dS(e){return new Nm({type:"success",innerType:e})}var Am=m("ZodCatch",(e,t)=>{pp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Zh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mm(e,t){return new Am({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var qm=m("ZodNaN",(e,t)=>{hp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>wh(e,o,r,n)});function pS(e){return Xp(qm,e)}var Ss=m("ZodPipe",(e,t)=>{cc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Dh(e,o,r,n),e.in=t.in,e.out=t.out});function Bc(e,t){return new Ss({type:"pipe",in:e,out:t})}var _s=m("ZodCodec",(e,t)=>{Ss.init(e,t),ns.init(e,t)});function hS(e,t,o){return new _s({type:"pipe",in:e,out:t,transform:o.decode,reverseTransform:o.encode})}function mS(e){let t=e._zod.def;return new _s({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var jm=m("ZodPreprocess",(e,t)=>{Ss.init(e,t),mp.init(e,t)}),Lm=m("ZodReadonly",(e,t)=>{fp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Vh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Um(e){return new Lm({type:"readonly",innerType:e})}var Zm=m("ZodTemplateLiteral",(e,t)=>{gp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Rh(e,o,r,n)});function fS(e,t){return new Zm({type:"template_literal",parts:e,...N.normalizeParams(t)})}var Dm=m("ZodLazy",(e,t)=>{yp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Fh(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function Et(e){return new Dm({type:"lazy",getter:e})}var Vm=m("ZodPromise",(e,t)=>{_p.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Hh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function gS(e){return new Vm({type:"promise",innerType:e})}var Hm=m("ZodFunction",(e,t)=>{Sp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>kh(e,o,r,n)});function SS(e){return new Hm({type:"function",input:Array.isArray(e?.input)?bm(e?.input):e?.input??g(E()),output:e?.output??E()})}var ys=m("ZodCustom",(e,t)=>{bp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Th(e,o,r,n)});function _S(e){let t=new B({check:"custom"});return t._zod.check=e,t}function yS(e,t){return oh(ys,e??(()=>!0),t)}function Fm(e,t={}){return rh(ys,e,t)}function Jm(e,t){return nh(e,t)}var bS=sh,vS=ih;function zS(e,t={}){let o=new ys({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...N.normalizeParams(t)});return o._zod.bag.Class=e,o._zod.check=r=>{r.value instanceof e||r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:o,path:[...o._zod.def.path??[]]})},o}var wS=(...e)=>ah({Codec:_s,Boolean:_r,String:mr},...e);function RS(e){let t=Et(()=>P([a(e),b(),R(),Fe(),g(t),w(a(),t)]));return t}function nt(e,t){return new jm({type:"pipe",in:fl(e),out:t})}var Gm={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 Nb(e){Q({customError:e})}function Ab(){return Q().customError}var Bm;Bm||(Bm={});var x={...cs,...Zc,iso:Pe},Mb=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 qb(e,t){let o=e.$schema;return o==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":o==="http://json-schema.org/draft-07/schema#"?"draft-7":o==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function jb(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let o=e.slice(1).split("/").filter(Boolean);if(o.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(o[0]===r){let n=o[1];if(!n||!t.defs[n])throw new Error(`Reference not found: ${e}`);return t.defs[n]}throw new Error(`Reference not found: ${e}`)}function xS(e,t){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 n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return x.lazy(()=>{if(!t.refs.has(n))throw new Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let s=jb(n,t),i=ue(s,t);return t.refs.set(n,i),t.processing.delete(n),i}if(e.enum!==void 0){let n=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&n.length===1&&n[0]===null)return x.null();if(n.length===0)return x.never();if(n.length===1)return x.literal(n[0]);if(n.every(i=>typeof i=="string"))return x.enum(n);let s=n.map(i=>x.literal(i));return s.length<2?s[0]:x.union([s[0],s[1],...s.slice(2)])}if(e.const!==void 0)return x.literal(e.const);let o=e.type;if(Array.isArray(o)){let n=o.map(s=>{let i={...e,type:s};return xS(i,t)});return n.length===0?x.never():n.length===1?n[0]:x.union(n)}if(!o)return x.any();let r;switch(o){case"string":{let n=x.string();if(e.format){let s=e.format;s==="email"?n=n.check(x.email()):s==="uri"||s==="uri-reference"?n=n.check(x.url()):s==="uuid"||s==="guid"?n=n.check(x.uuid()):s==="date-time"?n=n.check(x.iso.datetime()):s==="date"?n=n.check(x.iso.date()):s==="time"?n=n.check(x.iso.time()):s==="duration"?n=n.check(x.iso.duration()):s==="ipv4"?n=n.check(x.ipv4()):s==="ipv6"?n=n.check(x.ipv6()):s==="mac"?n=n.check(x.mac()):s==="cidr"?n=n.check(x.cidrv4()):s==="cidr-v6"?n=n.check(x.cidrv6()):s==="base64"?n=n.check(x.base64()):s==="base64url"?n=n.check(x.base64url()):s==="e164"?n=n.check(x.e164()):s==="jwt"?n=n.check(x.jwt()):s==="emoji"?n=n.check(x.emoji()):s==="nanoid"?n=n.check(x.nanoid()):s==="cuid"?n=n.check(x.cuid()):s==="cuid2"?n=n.check(x.cuid2()):s==="ulid"?n=n.check(x.ulid()):s==="xid"?n=n.check(x.xid()):s==="ksuid"&&(n=n.check(x.ksuid()))}typeof e.minLength=="number"&&(n=n.min(e.minLength)),typeof e.maxLength=="number"&&(n=n.max(e.maxLength)),e.pattern&&(n=n.regex(new RegExp(e.pattern))),r=n;break}case"number":case"integer":{let n=o==="integer"?x.number().int():x.number();typeof e.minimum=="number"&&(n=n.min(e.minimum)),typeof e.maximum=="number"&&(n=n.max(e.maximum)),typeof e.exclusiveMinimum=="number"?n=n.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(n=n.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?n=n.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(n=n.lt(e.maximum)),typeof e.multipleOf=="number"&&(n=n.multipleOf(e.multipleOf)),r=n;break}case"boolean":{r=x.boolean();break}case"null":{r=x.null();break}case"object":{let n={},s=e.properties||{},i=new Set(e.required||[]);for(let[l,u]of Object.entries(s)){let h=ue(u,t);n[l]=i.has(l)?h:h.optional()}if(e.propertyNames){let l=ue(e.propertyNames,t),u=e.additionalProperties&&typeof e.additionalProperties=="object"?ue(e.additionalProperties,t):x.any();if(Object.keys(n).length===0){r=x.record(l,u);break}let h=x.object(n).passthrough(),f=x.looseRecord(l,u);r=x.intersection(h,f);break}if(e.patternProperties){let l=e.patternProperties,u=Object.keys(l),h=[];for(let y of u){let _=ue(l[y],t),v=x.string().regex(new RegExp(y));h.push(x.looseRecord(v,_))}let f=[];if(Object.keys(n).length>0&&f.push(x.object(n).passthrough()),f.push(...h),f.length===0)r=x.object({}).passthrough();else if(f.length===1)r=f[0];else{let y=x.intersection(f[0],f[1]);for(let _=2;_<f.length;_++)y=x.intersection(y,f[_]);r=y}break}let c=x.object(n);e.additionalProperties===!1?r=c.strict():typeof e.additionalProperties=="object"?r=c.catchall(ue(e.additionalProperties,t)):r=c.passthrough();break}case"array":{let n=e.prefixItems,s=e.items;if(n&&Array.isArray(n)){let i=n.map(l=>ue(l,t)),c=s&&typeof s=="object"&&!Array.isArray(s)?ue(s,t):void 0;c?r=x.tuple(i).rest(c):r=x.tuple(i),typeof e.minItems=="number"&&(r=r.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(x.maxLength(e.maxItems)))}else if(Array.isArray(s)){let i=s.map(l=>ue(l,t)),c=e.additionalItems&&typeof e.additionalItems=="object"?ue(e.additionalItems,t):void 0;c?r=x.tuple(i).rest(c):r=x.tuple(i),typeof e.minItems=="number"&&(r=r.check(x.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(x.maxLength(e.maxItems)))}else if(s!==void 0){let i=ue(s,t),c=x.array(i);typeof e.minItems=="number"&&(c=c.min(e.minItems)),typeof e.maxItems=="number"&&(c=c.max(e.maxItems)),r=c}else r=x.array(x.any());break}default:throw new Error(`Unsupported type: ${o}`)}return r}function ue(e,t){if(typeof e=="boolean")return e?x.any():x.never();let o=xS(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let c=e.anyOf.map(u=>ue(u,t)),l=x.union(c);o=r?x.intersection(o,l):l}if(e.oneOf&&Array.isArray(e.oneOf)){let c=e.oneOf.map(u=>ue(u,t)),l=x.xor(c);o=r?x.intersection(o,l):l}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)o=r?o:x.any();else{let c=r?o:ue(e.allOf[0],t),l=r?0:1;for(let u=l;u<e.allOf.length;u++)c=x.intersection(c,ue(e.allOf[u],t));o=c}e.nullable===!0&&t.version==="openapi-3.0"&&(o=x.nullable(o)),e.readOnly===!0&&(o=x.readonly(o)),e.default!==void 0&&(o=o.default(e.default));let n={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let c of s)c in e&&(n[c]=e[c]);let i=["contentEncoding","contentMediaType","contentSchema"];for(let c of i)c in e&&(n[c]=e[c]);for(let c of Object.keys(e))Mb.has(c)||(n[c]=e[c]);return Object.keys(n).length>0&&t.registry.add(o,n),e.description&&(o=o.describe(e.description)),o}function PS(e,t){if(typeof e=="boolean")return e?x.any():x.never();let o;try{o=JSON.parse(JSON.stringify(e))}catch{throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=qb(o,t?.defaultTarget),n=o.$defs||o.definitions||{},s={version:r,defs:n,refs:new Map,processing:new Set,rootSchema:o,registry:t?.registry??ne};return ue(o,s)}var bs={};et(bs,{bigint:()=>Db,boolean:()=>Zb,date:()=>Vb,number:()=>Ub,string:()=>Lb});function Lb(e){return Rp(mr,e)}function Ub(e){return Ip(Sr,e)}function Zb(e){return Lp(_r,e)}function Db(e){return Zp(yr,e)}function Vb(e){return Qp(ms,e)}Q(lc());var _l="2025-11-25";var yl=[_l,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],bl="io.modelcontextprotocol/related-task",co="io.modelcontextprotocol/protocolVersion",br="io.modelcontextprotocol/clientInfo",Ct="io.modelcontextprotocol/serverInfo",lo="io.modelcontextprotocol/clientCapabilities",vl="io.modelcontextprotocol/subscriptionId",vr="io.modelcontextprotocol/logLevel";var uo="2.0";var st=Et(()=>P([a(),b(),R(),Fe(),w(a(),st),g(st)])),W=w(a(),st),zl=g(st),zr=P([a(),b().int()]),wr=a(),vs=p({ttl:b().optional()}),zs=p({taskId:a()}),Rr=C({progressToken:zr.optional(),[bl]:zs.optional()}),re=p({_meta:Rr.optional()}),It=re.extend({task:vs.optional()}),K=p({method:a(),params:re.loose().optional()}),de=p({_meta:Rr.optional()}),se=p({method:a(),params:de.loose().optional()}),xr=C({get[Ct](){return Be.optional().catch(void 0)}}),Y=C({_meta:xr.optional()}),je=P([a(),b().int()]),Pr=p({jsonrpc:S(uo),id:je,...K.shape}).strict(),Tr=p({jsonrpc:S(uo),...se.shape}).strict(),po=p({jsonrpc:S(uo),id:je,result:Y}).strict(),ho=p({jsonrpc:S(uo),id:je.optional(),error:p({code:b().int(),message:a(),data:E().optional()})}).strict(),mo=P([Pr,Tr,po,ho]),wl=P([po,ho]),Ot=Y.strict(),ws=de.extend({requestId:je.optional(),reason:a().optional()}),kr=se.extend({method:S("notifications/cancelled"),params:ws}),Rs=p({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:I(["light","dark"]).optional()}),it=p({icons:g(Rs).optional()}),Je=p({name:a(),title:a().optional()}),Be=Je.extend({...Je.shape,...it.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),Fb=qe(p({applyDefaults:R().optional()}),W),Jb=nt(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,qe(p({form:Fb.optional(),url:W.optional()}),W.optional())),Rl=C({list:W.optional(),cancel:W.optional(),requests:C({sampling:C({createMessage:W.optional()}).optional(),elicitation:C({create:W.optional()}).optional()}).optional()}),xl=C({list:W.optional(),cancel:W.optional(),requests:C({tools:C({call:W.optional()}).optional()}).optional()}),xs=p({experimental:w(a(),W).optional(),sampling:p({context:W.optional(),tools:W.optional()}).optional(),elicitation:Jb.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:Rl.optional(),extensions:w(a(),W).optional()}),Ps=re.extend({protocolVersion:a(),capabilities:xs,clientInfo:Be}),Ts=K.extend({method:S("initialize"),params:Ps}),Er=p({experimental:w(a(),W).optional(),logging:W.optional(),completions:W.optional(),prompts:p({listChanged:R().optional()}).optional(),resources:p({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:p({listChanged:R().optional()}).optional(),tasks:xl.optional(),extensions:w(a(),W).optional()}),ks=Y.extend({protocolVersion:a(),capabilities:Er,serverInfo:Be,instructions:a().optional()}),Es=se.extend({method:S("notifications/initialized"),params:de.optional()}),$s=K.extend({method:S("server/discover"),params:re.optional()}),$r=Y.extend({supportedVersions:g(a()),capabilities:Er,instructions:a().optional()}),Cr=K.extend({method:S("ping"),params:re.optional()}),Cs=p({progress:b(),total:$(b()),message:$(a())}),Is=p({...de.shape,...Cs.shape,progressToken:zr}),Ir=se.extend({method:S("notifications/progress"),params:Is}),Os=re.extend({cursor:wr.optional()}),at=K.extend({params:Os.optional()}),ct=Y.extend({nextCursor:wr.optional()}),Or=p({uri:a(),mimeType:$(a()),_meta:w(a(),E()).optional()}),Nr=Or.extend({text:a()}),Km=a().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),Ar=Or.extend({blob:Km}),lt=I(["user","assistant"]),Ge=p({audience:g(lt).optional(),priority:b().min(0).max(1).optional(),lastModified:Pe.datetime({offset:!0}).optional()}),Mr=p({...Je.shape,...it.shape,uri:a(),description:$(a()),mimeType:$(a()),size:$(b()),annotations:Ge.optional(),_meta:$(C({}))}),Ns=p({...Je.shape,...it.shape,uriTemplate:a(),description:$(a()),mimeType:$(a()),annotations:Ge.optional(),_meta:$(C({}))}),As=at.extend({method:S("resources/list")}),Ms=ct.extend({resources:g(Mr)}),qs=at.extend({method:S("resources/templates/list")}),js=ct.extend({resourceTemplates:g(Ns)}),fo=re.extend({uri:a()}),Ls=fo,Us=K.extend({method:S("resources/read"),params:Ls}),Zs=Y.extend({contents:g(P([Nr,Ar]))}),Ds=se.extend({method:S("notifications/resources/list_changed"),params:de.optional()}),Vs=fo,Hs=K.extend({method:S("resources/subscribe"),params:Vs}),Fs=fo,Js=K.extend({method:S("resources/unsubscribe"),params:Fs}),qr=p({toolsListChanged:R().optional(),promptsListChanged:R().optional(),resourcesListChanged:R().optional(),resourceSubscriptions:g(a()).optional()}),Bs=re.extend({notifications:qr}),Gs=K.extend({method:S("subscriptions/listen"),params:Bs}),Ws=de.extend({notifications:qr}),Ks=se.extend({method:S("notifications/subscriptions/acknowledged"),params:Ws}),Ys=xr.extend({[vl]:je}),Qs=Y.extend({_meta:Ys}),Xs=de.extend({uri:a()}),ei=se.extend({method:S("notifications/resources/updated"),params:Xs}),ti=p({name:a(),description:$(a()),required:$(R())}),oi=p({...Je.shape,...it.shape,description:$(a()),arguments:$(g(ti)),_meta:$(C({}))}),ri=at.extend({method:S("prompts/list")}),ni=ct.extend({prompts:g(oi)}),si=re.extend({name:a(),arguments:w(a(),a()).optional()}),ii=K.extend({method:S("prompts/get"),params:si}),go=p({type:S("text"),text:a(),annotations:Ge.optional(),_meta:w(a(),E()).optional()}),So=p({type:S("image"),data:Km,mimeType:a(),annotations:Ge.optional(),_meta:w(a(),E()).optional()}),_o=p({type:S("audio"),data:Km,mimeType:a(),annotations:Ge.optional(),_meta:w(a(),E()).optional()}),ai=p({type:S("tool_use"),name:a(),id:a(),input:w(a(),E()),_meta:w(a(),E()).optional()}),yo=p({type:S("resource"),resource:P([Nr,Ar]),annotations:Ge.optional(),_meta:w(a(),E()).optional()}),bo=Mr.extend({type:S("resource_link")}),We=P([go,So,_o,bo,yo]),ci=p({role:lt,content:We}),li=Y.extend({description:a().optional(),messages:g(ci)}),ui=se.extend({method:S("notifications/prompts/list_changed"),params:de.optional()}),di=p({title:a().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),pi=p({taskSupport:I(["required","optional","forbidden"]).optional()}),Nt=p({...Je.shape,...it.shape,description:a().optional(),inputSchema:p({type:S("object"),properties:w(a(),st).optional(),required:g(a()).optional()}).catchall(E()),outputSchema:C({$schema:a().optional()}).optional(),annotations:di.optional(),execution:pi.optional(),_meta:w(a(),E()).optional()}),hi=at.extend({method:S("tools/list")}),mi=ct.extend({tools:g(Nt)}),At=Y.extend({content:g(We).default([]),structuredContent:E().optional(),isError:R().optional()}),Pl=At.or(Y.extend({toolResult:E()})),fi=It.extend({name:a(),arguments:w(a(),E()).optional()}),gi=K.extend({method:S("tools/call"),params:fi}),Si=se.extend({method:S("notifications/tools/list_changed"),params:de.optional()}),Tl=p({autoRefresh:R().default(!0),debounceMs:b().int().nonnegative().default(300)}),jr=I(["debug","info","notice","warning","error","critical","alert","emergency"]),_i=re.extend({level:jr}),yi=K.extend({method:S("logging/setLevel"),params:_i}),bi=de.extend({level:jr,logger:a().optional(),data:E()}),vi=se.extend({method:S("notifications/message"),params:bi}),zi=p({name:a().optional()}),wi=p({hints:g(zi).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),Ri=p({mode:I(["auto","required","none"]).optional()}),xi=p({type:S("tool_result"),toolUseId:a().describe("The unique identifier for the corresponding tool call."),content:g(We),structuredContent:E().optional(),isError:R().optional(),_meta:w(a(),E()).optional()}),Pi=kt("type",[go,So,_o]),$t=kt("type",[go,So,_o,ai,xi]),Ti=p({role:lt,content:P([$t,g($t)]),_meta:w(a(),E()).optional()}),ki=It.extend({messages:g(Ti),modelPreferences:wi.optional(),systemPrompt:a().optional(),includeContext:I(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:g(a()).optional(),metadata:W.optional(),tools:g(Nt).optional(),toolChoice:Ri.optional()}),Ei=K.extend({method:S("sampling/createMessage"),params:ki}),$i=Y.extend({model:a(),stopReason:$(I(["endTurn","stopSequence","maxTokens"]).or(a())),role:lt,content:Pi}),Ci=Y.extend({model:a(),stopReason:$(I(["endTurn","stopSequence","maxTokens","toolUse"]).or(a())),role:lt,content:P([$t,g($t)])}),Lr=p({type:S("boolean"),title:a().optional(),description:a().optional(),default:R().optional()}),vo=p({type:S("string"),title:a().optional(),description:a().optional(),minLength:b().optional(),maxLength:b().optional(),format:I(["email","uri","date","date-time"]).optional(),default:a().optional()}),zo=p({type:I(["number","integer"]),title:a().optional(),description:a().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),Ur=p({type:S("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),Zr=p({type:S("string"),title:a().optional(),description:a().optional(),oneOf:g(p({const:a(),title:a()})),default:a().optional()}),Dr=p({type:S("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),Ii=P([Ur,Zr]),Vr=p({type:S("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:S("string"),enum:g(a())}),default:g(a()).optional()}),Hr=p({type:S("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:g(p({const:a(),title:a()}))}),default:g(a()).optional()}),Oi=P([Vr,Hr]),Ni=P([Dr,Ii,Oi]),Fr=P([Ni,Lr,vo,zo]),wo=It.extend({mode:S("form").optional(),message:a(),requestedSchema:p({type:S("object"),properties:w(a(),Fr),required:g(a()).optional()}).catchall(E())}),Ai=It.extend({mode:S("url"),message:a(),elicitationId:a(),url:a().url()}),Mi=P([wo,Ai]),qi=K.extend({method:S("elicitation/create"),params:Mi}),ji=de.extend({elicitationId:a()}),Li=se.extend({method:S("notifications/elicitation/complete"),params:ji}),Ui=Y.extend({action:I(["accept","decline","cancel"]),content:nt(e=>e===null?void 0:e,w(a(),P([a(),b(),R(),g(a())])).optional())}),Zi=p({type:S("ref/resource"),uri:a()}),Di=p({type:S("ref/prompt"),name:a()}),Vi=re.extend({ref:P([Di,Zi]),argument:p({name:a(),value:a()}),context:p({arguments:w(a(),a()).optional()}).optional()}),Hi=K.extend({method:S("completion/complete"),params:Vi}),Fi=Y.extend({completion:C({values:g(a()).max(100),total:$(b().int()),hasMore:$(R())})}),Ji=p({uri:a().startsWith("file://"),name:a().optional(),_meta:w(a(),E()).optional()}),Bi=K.extend({method:S("roots/list"),params:re.optional()}),Gi=Y.extend({roots:g(Ji)}),Wi=se.extend({method:S("notifications/roots/list_changed"),params:de.optional()}),kl=C({ttl:b().optional(),pollInterval:b().optional()}),Ki=I(["working","input_required","completed","failed","cancelled"]),ut=p({taskId:a(),status:Ki,ttl:P([b(),Fe()]),createdAt:a(),lastUpdatedAt:a(),pollInterval:$(b()),statusMessage:$(a())}),El=Y.extend({task:ut}),Yi=de.merge(ut),$l=se.extend({method:S("notifications/tasks/status"),params:Yi}),Cl=K.extend({method:S("tasks/get"),params:re.extend({taskId:a()})}),Il=Y.merge(ut),Ol=K.extend({method:S("tasks/result"),params:re.extend({taskId:a()})}),Nl=Y.loose(),Al=at.extend({method:S("tasks/list")}),Ml=ct.extend({tasks:g(ut)}),ql=K.extend({method:S("tasks/cancel"),params:re.extend({taskId:a()})}),jl=Y.merge(ut),Ll=P([Cr,Ts,$s,Hi,yi,ii,ri,As,qs,Us,Hs,Js,Gs,gi,hi]),Ul=P([kr,Ir,Es,Wi]),Zl=P([Ot,$i,Ci,Ui,Gi]),Dl=P([Cr,Ei,qi,Bi]),Vl=P([kr,Ir,vi,ei,Ds,Si,ui,Ks,Li]),Hl=P([Ot,ks,$r,Fi,li,ni,Ms,js,Zs,At,mi,Qs]),oe=fr().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Gm.custom,message:"URL must be parseable",fatal:!0}),Vn}).refine(e=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Qi=C({resource:a().url(),authorization_servers:g(oe).optional(),jwks_uri:a().url().optional(),scopes_supported:g(a()).optional(),bearer_methods_supported:g(a()).optional(),resource_signing_alg_values_supported:g(a()).optional(),resource_name:a().optional(),resource_documentation:a().optional(),resource_policy_uri:a().url().optional(),resource_tos_uri:a().url().optional(),tls_client_certificate_bound_access_tokens:R().optional(),authorization_details_types_supported:g(a()).optional(),dpop_signing_alg_values_supported:g(a()).optional(),dpop_bound_access_tokens_required:R().optional()}),Jr=C({issuer:a(),authorization_endpoint:oe,token_endpoint:oe,registration_endpoint:oe.optional(),scopes_supported:g(a()).optional(),response_types_supported:g(a()),response_modes_supported:g(a()).optional(),grant_types_supported:g(a()).optional(),token_endpoint_auth_methods_supported:g(a()).optional(),token_endpoint_auth_signing_alg_values_supported:g(a()).optional(),service_documentation:oe.optional(),revocation_endpoint:oe.optional(),revocation_endpoint_auth_methods_supported:g(a()).optional(),revocation_endpoint_auth_signing_alg_values_supported:g(a()).optional(),introspection_endpoint:a().optional(),introspection_endpoint_auth_methods_supported:g(a()).optional(),introspection_endpoint_auth_signing_alg_values_supported:g(a()).optional(),code_challenge_methods_supported:g(a()).optional(),client_id_metadata_document_supported:R().optional(),authorization_response_iss_parameter_supported:R().optional().catch(void 0),dpop_signing_alg_values_supported:g(a()).optional()}),Xi=C({issuer:a(),authorization_endpoint:oe,token_endpoint:oe,userinfo_endpoint:oe.optional(),jwks_uri:oe,registration_endpoint:oe.optional(),scopes_supported:g(a()).optional(),response_types_supported:g(a()),response_modes_supported:g(a()).optional(),grant_types_supported:g(a()).optional(),acr_values_supported:g(a()).optional(),subject_types_supported:g(a()),id_token_signing_alg_values_supported:g(a()),id_token_encryption_alg_values_supported:g(a()).optional(),id_token_encryption_enc_values_supported:g(a()).optional(),userinfo_signing_alg_values_supported:g(a()).optional(),userinfo_encryption_alg_values_supported:g(a()).optional(),userinfo_encryption_enc_values_supported:g(a()).optional(),request_object_signing_alg_values_supported:g(a()).optional(),request_object_encryption_alg_values_supported:g(a()).optional(),request_object_encryption_enc_values_supported:g(a()).optional(),token_endpoint_auth_methods_supported:g(a()).optional(),token_endpoint_auth_signing_alg_values_supported:g(a()).optional(),display_values_supported:g(a()).optional(),claim_types_supported:g(a()).optional(),claims_supported:g(a()).optional(),service_documentation:a().optional(),claims_locales_supported:g(a()).optional(),ui_locales_supported:g(a()).optional(),claims_parameter_supported:R().optional(),request_parameter_supported:R().optional(),request_uri_parameter_supported:R().optional(),require_request_uri_registration:R().optional(),op_policy_uri:oe.optional(),op_tos_uri:oe.optional(),client_id_metadata_document_supported:R().optional(),authorization_response_iss_parameter_supported:R().optional().catch(void 0)}),ea=p({...Xi.shape,...Jr.pick({code_challenge_methods_supported:!0}).shape}),ta=p({access_token:a(),id_token:a().optional(),token_type:a(),expires_in:bs.number().optional(),scope:a().optional(),refresh_token:a().optional(),issuer:a().optional().catch(void 0)}).strip(),oa=p({issued_token_type:S("urn:ietf:params:oauth:token-type:id-jag"),access_token:a(),token_type:a().optional(),expires_in:b().optional(),scope:a().optional()}).strip(),ra=p({error:a(),error_description:a().optional(),error_uri:a().optional()}),Wm=oe.optional().or(S("").transform(()=>{})),na=p({redirect_uris:g(oe),token_endpoint_auth_method:a().optional(),grant_types:g(a()).optional(),response_types:g(a()).optional(),application_type:a().optional(),client_name:a().optional(),client_uri:oe.optional(),logo_uri:Wm,scope:a().optional(),contacts:g(a()).optional(),tos_uri:Wm,policy_uri:a().optional(),jwks_uri:oe.optional(),jwks:hl().optional(),software_id:a().optional(),software_version:a().optional(),software_statement:a().optional()}).strip(),sa=p({client_id:a(),client_secret:a().optional(),client_id_issued_at:b().optional(),client_secret_expires_at:b().optional(),issuer:a().optional().catch(void 0)}).strip(),ia=na.merge(sa),Fl=p({error:a(),error_description:a().optional()}).strip(),Jl=p({token:a(),token_type_hint:a().optional()}).strip();var of=Symbol.for("mcp.sdk.errorBrands");function Ro(e,t){let o=new Set,r=t;for(;typeof r=="function";){let n=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,"mcpBrand")&&typeof n=="string"&&o.add(n),r=Object.getPrototypeOf(r)}o.size!==0&&Object.defineProperty(e,of,{value:o,enumerable:!1,configurable:!0})}function Te(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,of)){let o=t[of];if(o&&typeof o.has=="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Bb=class JS extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Te(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Te(this,t)}constructor(t,o,r){super(o),this.code=t,this.errorUri=r,this.name="OAuthError",Ro(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new JS(t.error,t.error_description??t.error,t.error_uri)}},ie=(function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e})({}),ee=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Te(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Te(this,e)}constructor(e,t,o,r){super(t,r),this.code=e,this.data=o,this.name="SdkError",Ro(this,new.target)}},Gb=class extends ee{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,o,r){super(e,t,o,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var Wb="2026-07-28";function BS(e){return e>=Wb}function GS(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(o=>o.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var WS=["task","inputRequests","requestState"];function Kb(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||WS.some(t=>t in e)?e:{...e,content:[]}}function Yb(){let e=Et(()=>P([a(),b(),R(),Fe(),w(a(),e),g(e)])),t=w(a(),e),o=P([a(),b().int()]),r=a(),n=p({ttl:b().optional()}),s=p({taskId:a()}),i=C({progressToken:o.optional(),"io.modelcontextprotocol/related-task":s.optional()}),c=p({_meta:i.optional()}),l=c.extend({task:n.optional()}),u=p({method:a(),params:c.loose().optional()}),h=p({_meta:i.optional()}),f=p({method:a(),params:h.loose().optional()}),y=C({_meta:i.optional()}),_=P([a(),b().int()]),v=y.strict(),k=h.extend({requestId:_.optional(),reason:a().optional()}),T=f.extend({method:S("notifications/cancelled"),params:k}),O=p({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:I(["light","dark"]).optional()}),j=p({icons:g(O).optional()}),M=p({name:a(),title:a().optional()}),Z=M.extend({...M.shape,...j.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),V=qe(p({applyDefaults:R().optional()}),t),D=nt(le=>le&&typeof le=="object"&&!Array.isArray(le)&&Object.keys(le).length===0?{form:{}}:le,qe(p({form:V.optional(),url:t.optional()}),t.optional())),G=C({list:t.optional(),cancel:t.optional(),requests:C({sampling:C({createMessage:t.optional()}).optional(),elicitation:C({create:t.optional()}).optional()}).optional()}),pe=C({list:t.optional(),cancel:t.optional(),requests:C({tools:C({call:t.optional()}).optional()}).optional()}),te=p({experimental:w(a(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:D.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:G.optional(),extensions:w(a(),t).optional()}),ke=c.extend({protocolVersion:a(),capabilities:te,clientInfo:Z}),Lt=u.extend({method:S("initialize"),params:ke}),Br=p({experimental:w(a(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:p({listChanged:R().optional()}).optional(),resources:p({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:p({listChanged:R().optional()}).optional(),tasks:pe.optional(),extensions:w(a(),t).optional()}),Gr=y.extend({protocolVersion:a(),capabilities:Br,serverInfo:Z,instructions:a().optional()}),To=f.extend({method:S("notifications/initialized"),params:h.optional()}),pt=u.extend({method:S("ping"),params:c.optional()}),Ut=p({progress:b(),total:$(b()),message:$(a())}),Le=p({...h.shape,...Ut.shape,progressToken:o}),ht=f.extend({method:S("notifications/progress"),params:Le}),ko=c.extend({cursor:r.optional()}),Qe=u.extend({params:ko.optional()}),Xe=y.extend({nextCursor:r.optional()}),Eo=p({uri:a(),mimeType:$(a()),_meta:w(a(),E()).optional()}),$o=Eo.extend({text:a()}),Zt=a().refine(le=>{try{return atob(le),!0}catch{return!1}},{message:"Invalid Base64 string"}),Co=Eo.extend({blob:Zt}),Ue=I(["user","assistant"]),Oe=p({audience:g(Ue).optional(),priority:b().min(0).max(1).optional(),lastModified:Pe.datetime({offset:!0}).optional()}),Dt=p({...M.shape,...j.shape,uri:a(),description:$(a()),mimeType:$(a()),size:$(b()),annotations:Oe.optional(),_meta:$(C({}))}),Wr=p({...M.shape,...j.shape,uriTemplate:a(),description:$(a()),mimeType:$(a()),annotations:Oe.optional(),_meta:$(C({}))}),Kr=Qe.extend({method:S("resources/list")}),Yr=Xe.extend({resources:g(Dt)}),mt=Qe.extend({method:S("resources/templates/list")}),Io=Xe.extend({resourceTemplates:g(Wr)}),Vt=c.extend({uri:a()}),Qr=Vt,Xr=u.extend({method:S("resources/read"),params:Qr}),en=y.extend({contents:g(P([$o,Co]))}),tn=f.extend({method:S("notifications/resources/list_changed"),params:h.optional()}),on=Vt,rn=u.extend({method:S("resources/subscribe"),params:on}),nn=Vt,sn=u.extend({method:S("resources/unsubscribe"),params:nn}),an=h.extend({uri:a()}),cn=f.extend({method:S("notifications/resources/updated"),params:an}),ln=p({name:a(),description:$(a()),required:$(R())}),un=p({...M.shape,...j.shape,description:$(a()),arguments:$(g(ln)),_meta:$(C({}))}),dn=Qe.extend({method:S("prompts/list")}),pn=Xe.extend({prompts:g(un)}),hn=c.extend({name:a(),arguments:w(a(),a()).optional()}),mn=u.extend({method:S("prompts/get"),params:hn}),Ht=p({type:S("text"),text:a(),annotations:Oe.optional(),_meta:w(a(),E()).optional()}),Ft=p({type:S("image"),data:Zt,mimeType:a(),annotations:Oe.optional(),_meta:w(a(),E()).optional()}),Jt=p({type:S("audio"),data:Zt,mimeType:a(),annotations:Oe.optional(),_meta:w(a(),E()).optional()}),fn=p({type:S("tool_use"),name:a(),id:a(),input:w(a(),E()),_meta:w(a(),E()).optional()}),ft=p({type:S("resource"),resource:P([$o,Co]),annotations:Oe.optional(),_meta:w(a(),E()).optional()}),gn=Dt.extend({type:S("resource_link")}),Ee=P([Ht,Ft,Jt,gn,ft]),Oo=p({role:Ue,content:Ee}),No=y.extend({description:a().optional(),messages:g(Oo)}),Bt=f.extend({method:S("notifications/prompts/list_changed"),params:h.optional()}),Sn=p({title:a().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),Ao=p({taskSupport:I(["required","optional","forbidden"]).optional()}),Gt=p({...M.shape,...j.shape,description:a().optional(),inputSchema:p({type:S("object"),properties:w(a(),e).optional(),required:g(a()).optional()}).catchall(E()),outputSchema:p({type:S("object"),properties:w(a(),e).optional(),required:g(a()).optional()}).catchall(E()).optional(),annotations:Sn.optional(),execution:Ao.optional(),_meta:w(a(),E()).optional()}),Mo=Qe.extend({method:S("tools/list")}),qo=Xe.extend({tools:g(Gt)}),jo=y.extend({content:g(Ee),structuredContent:w(a(),E()).optional(),isError:R().optional()}),ce=l.extend({name:a(),arguments:w(a(),E()).optional()}),_n=u.extend({method:S("tools/call"),params:ce}),ya=f.extend({method:S("notifications/tools/list_changed"),params:h.optional()}),Lo=I(["debug","info","notice","warning","error","critical","alert","emergency"]),yn=c.extend({level:Lo}),bn=u.extend({method:S("logging/setLevel"),params:yn}),vn=h.extend({level:Lo,logger:a().optional(),data:E()}),zn=f.extend({method:S("notifications/message"),params:vn}),wn=p({name:a().optional()}),Rn=p({hints:g(wn).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),xn=p({mode:I(["auto","required","none"]).optional()}),ba=p({type:S("tool_result"),toolUseId:a().describe("The unique identifier for the corresponding tool call."),content:g(Ee),structuredContent:p({}).loose().optional(),isError:R().optional(),_meta:w(a(),E()).optional()}),Pn=kt("type",[Ht,Ft,Jt]),gt=kt("type",[Ht,Ft,Jt,fn,ba]),Tn=p({role:Ue,content:P([gt,g(gt)]),_meta:w(a(),E()).optional()}),kn=l.extend({messages:g(Tn),modelPreferences:Rn.optional(),systemPrompt:a().optional(),includeContext:I(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:g(a()).optional(),metadata:t.optional(),tools:g(Gt).optional(),toolChoice:xn.optional()}),En=u.extend({method:S("sampling/createMessage"),params:kn}),$n=y.extend({model:a(),stopReason:$(I(["endTurn","stopSequence","maxTokens"]).or(a())),role:Ue,content:Pn}),Cn=y.extend({model:a(),stopReason:$(I(["endTurn","stopSequence","maxTokens","toolUse"]).or(a())),role:Ue,content:P([gt,g(gt)])}),In=p({type:S("boolean"),title:a().optional(),description:a().optional(),default:R().optional()}),On=p({type:S("string"),title:a().optional(),description:a().optional(),minLength:b().optional(),maxLength:b().optional(),format:I(["email","uri","date","date-time"]).optional(),default:a().optional()}),Nn=p({type:I(["number","integer"]),title:a().optional(),description:a().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),An=p({type:S("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),Mn=p({type:S("string"),title:a().optional(),description:a().optional(),oneOf:g(p({const:a(),title:a()})),default:a().optional()}),qn=p({type:S("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),jn=P([An,Mn]),Wt=p({type:S("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:S("string"),enum:g(a())}),default:g(a()).optional()}),Kt=p({type:S("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:g(p({const:a(),title:a()}))}),default:g(a()).optional()}),va=P([Wt,Kt]),za=P([qn,jn,va]),ze=P([za,In,On,Nn]),we=l.extend({mode:S("form").optional(),message:a(),requestedSchema:p({type:S("object"),properties:w(a(),ze),required:g(a()).optional()}).catchall(E())}),Ln=l.extend({mode:S("url"),message:a(),elicitationId:a(),url:a().url()}),Ne=P([we,Ln]),wa=u.extend({method:S("elicitation/create"),params:Ne}),Ra=h.extend({elicitationId:a()}),xa=f.extend({method:S("notifications/elicitation/complete"),params:Ra}),Pa=y.extend({action:I(["accept","decline","cancel"]),content:nt(le=>le===null?void 0:le,w(a(),P([a(),b(),R(),g(a())])).optional())}),Ta=p({type:S("ref/resource"),uri:a()}),ka=p({type:S("ref/prompt"),name:a()}),Ea=c.extend({ref:P([ka,Ta]),argument:p({name:a(),value:a()}),context:p({arguments:w(a(),a()).optional()}).optional()}),Un=u.extend({method:S("completion/complete"),params:Ea}),$a=y.extend({completion:C({values:g(a()).max(100),total:$(b().int()),hasMore:$(R())})}),Ca=p({uri:a().startsWith("file://"),name:a().optional(),_meta:w(a(),E()).optional()}),Uo=u.extend({method:S("roots/list"),params:c.optional()}),Zn=y.extend({roots:g(Ca)}),Ia=f.extend({method:S("notifications/roots/list_changed"),params:h.optional()}),Oa=C({ttl:b().optional(),pollInterval:b().optional()}),Dn=I(["working","input_required","completed","failed","cancelled"]),St=p({taskId:a(),status:Dn,ttl:P([b(),Fe()]),createdAt:a(),lastUpdatedAt:a(),pollInterval:$(b()),statusMessage:$(a())}),_e=y.extend({task:St}),Na=h.merge(St),Yt=f.extend({method:S("notifications/tasks/status"),params:Na}),Zo=u.extend({method:S("tasks/get"),params:c.extend({taskId:a()})}),Do=y.merge(St),Vo=u.extend({method:S("tasks/result"),params:c.extend({taskId:a()})}),Xl=y.loose(),he=Qe.extend({method:S("tasks/list")}),X=Xe.extend({tasks:g(St)}),Qt=u.extend({method:S("tasks/cancel"),params:c.extend({taskId:a()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:i,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:l,RequestSchema:u,NotificationsParamsSchema:h,NotificationSchema:f,ResultSchema:y,RequestIdSchema:_,EmptyResultSchema:v,CancelledNotificationParamsSchema:k,CancelledNotificationSchema:T,IconSchema:O,IconsSchema:j,BaseMetadataSchema:M,ImplementationSchema:Z,ClientTasksCapabilitySchema:G,ServerTasksCapabilitySchema:pe,ClientCapabilitiesSchema:te,InitializeRequestParamsSchema:ke,InitializeRequestSchema:Lt,ServerCapabilitiesSchema:Br,InitializeResultSchema:Gr,InitializedNotificationSchema:To,PingRequestSchema:pt,ProgressSchema:Ut,ProgressNotificationParamsSchema:Le,ProgressNotificationSchema:ht,PaginatedRequestParamsSchema:ko,PaginatedRequestSchema:Qe,PaginatedResultSchema:Xe,ResourceContentsSchema:Eo,TextResourceContentsSchema:$o,BlobResourceContentsSchema:Co,RoleSchema:Ue,AnnotationsSchema:Oe,ResourceSchema:Dt,ResourceTemplateSchema:Wr,ListResourcesRequestSchema:Kr,ListResourcesResultSchema:Yr,ListResourceTemplatesRequestSchema:mt,ListResourceTemplatesResultSchema:Io,ResourceRequestParamsSchema:Vt,ReadResourceRequestParamsSchema:Qr,ReadResourceRequestSchema:Xr,ReadResourceResultSchema:en,ResourceListChangedNotificationSchema:tn,SubscribeRequestParamsSchema:on,SubscribeRequestSchema:rn,UnsubscribeRequestParamsSchema:nn,UnsubscribeRequestSchema:sn,ResourceUpdatedNotificationParamsSchema:an,ResourceUpdatedNotificationSchema:cn,PromptArgumentSchema:ln,PromptSchema:un,ListPromptsRequestSchema:dn,ListPromptsResultSchema:pn,GetPromptRequestParamsSchema:hn,GetPromptRequestSchema:mn,TextContentSchema:Ht,ImageContentSchema:Ft,AudioContentSchema:Jt,ToolUseContentSchema:fn,EmbeddedResourceSchema:ft,ResourceLinkSchema:gn,ContentBlockSchema:Ee,PromptMessageSchema:Oo,GetPromptResultSchema:No,PromptListChangedNotificationSchema:Bt,ToolAnnotationsSchema:Sn,ToolExecutionSchema:Ao,ToolSchema:Gt,ListToolsRequestSchema:Mo,ListToolsResultSchema:qo,CallToolResultSchema:jo,CallToolRequestParamsSchema:ce,CallToolRequestSchema:_n,ToolListChangedNotificationSchema:ya,LoggingLevelSchema:Lo,SetLevelRequestParamsSchema:yn,SetLevelRequestSchema:bn,LoggingMessageNotificationParamsSchema:vn,LoggingMessageNotificationSchema:zn,ModelHintSchema:wn,ModelPreferencesSchema:Rn,ToolChoiceSchema:xn,ToolResultContentSchema:ba,SamplingContentSchema:Pn,SamplingMessageContentBlockSchema:gt,SamplingMessageSchema:Tn,CreateMessageRequestParamsSchema:kn,CreateMessageRequestSchema:En,CreateMessageResultSchema:$n,CreateMessageResultWithToolsSchema:Cn,BooleanSchemaSchema:In,StringSchemaSchema:On,NumberSchemaSchema:Nn,UntitledSingleSelectEnumSchemaSchema:An,TitledSingleSelectEnumSchemaSchema:Mn,LegacyTitledEnumSchemaSchema:qn,SingleSelectEnumSchemaSchema:jn,UntitledMultiSelectEnumSchemaSchema:Wt,TitledMultiSelectEnumSchemaSchema:Kt,MultiSelectEnumSchemaSchema:va,EnumSchemaSchema:za,PrimitiveSchemaDefinitionSchema:ze,ElicitRequestFormParamsSchema:we,ElicitRequestURLParamsSchema:Ln,ElicitRequestParamsSchema:Ne,ElicitRequestSchema:wa,ElicitationCompleteNotificationParamsSchema:Ra,ElicitationCompleteNotificationSchema:xa,ElicitResultSchema:Pa,ResourceTemplateReferenceSchema:Ta,PromptReferenceSchema:ka,CompleteRequestParamsSchema:Ea,CompleteRequestSchema:Un,CompleteResultSchema:$a,RootSchema:Ca,ListRootsRequestSchema:Uo,ListRootsResultSchema:Zn,RootsListChangedNotificationSchema:Ia,TaskCreationParamsSchema:Oa,TaskStatusSchema:Dn,TaskSchema:St,CreateTaskResultSchema:_e,TaskStatusNotificationParamsSchema:Na,TaskStatusNotificationSchema:Yt,GetTaskRequestSchema:Zo,GetTaskResultSchema:Do,GetTaskPayloadRequestSchema:Vo,GetTaskPayloadResultSchema:Xl,ListTasksRequestSchema:he,ListTasksResultSchema:X,CancelTaskRequestSchema:Qt,CancelTaskResultSchema:y.merge(St),ClientRequestSchema:P([pt,Lt,Un,bn,mn,dn,Kr,mt,Xr,rn,sn,_n,Mo,Zo,Vo,he,Qt]),ClientNotificationSchema:P([T,ht,To,Ia,Yt]),ClientResultSchema:P([v,$n,Cn,Pa,Zn,Do,X,_e]),ServerRequestSchema:P([pt,En,wa,Uo,Zo,Vo,he,Qt]),ServerNotificationSchema:P([T,ht,zn,cn,tn,ya,Bt,Yt,xa]),ServerResultSchema:P([v,Gr,$a,No,pn,Yr,Io,en,jo,qo,Do,X,_e]),CallToolResultWireSchema:E().superRefine((le,D_)=>{if(!(typeof le!="object"||le===null||Array.isArray(le)||le.content!==void 0)){for(let Cf of WS)if(Cf in le){D_.addIssue({code:"custom",message:`content is required when the body carries '${Cf}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(Kb).pipe(jo)}}var Qb;function KS(){return Qb??=Yb()}function YS(e){return e.type!=="object"}var Xb=new Set(["const","enum","default","examples"]),ev=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function MS(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function tv(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(MS(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=Af(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,s)=>{if(Array.isArray(n))return n.map(l=>r(l,!1));if(n===null||typeof n!="object"||!s&&MS(n.$id))return n;let i={},c=!1;for(let[l,u]of Object.entries(n))s?i[l]=r(u,!1):(l==="$ref"||l==="$dynamicRef")&&typeof u=="string"?i[l]=u==="#"?"#/properties/result":u.startsWith("#/")?`#/properties/result${u.slice(1)}`:u:l==="$recursiveRef"&&u==="#"&&o?c=!0:Xb.has(l)?i[l]=u:ev.has(l)?i[l]=r(u,!0):i[l]=r(u,!1);return c&&("$ref"in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:"#/properties/result"}]:i.$ref="#/properties/result"),i};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:r(e,!1)},required:["result"]}}var QS={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},XS={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},ov={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Bl;function lf(){if(Bl)return Bl;let e=KS();return Bl={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Bl}function e_(e){return Object.prototype.hasOwnProperty.call(QS,e)}function t_(e){return Object.prototype.hasOwnProperty.call(XS,e)}function rv(e){return Object.prototype.hasOwnProperty.call(ov,e)}function nv(e){return rv(e)?lf().resultSchemas[e]:void 0}function sv(e){return e_(e)?lf().requestSchemas[e]:void 0}function iv(e){return t_(e)?lf().notificationSchemas[e]:void 0}var hR=Object.keys(QS),mR=Object.keys(XS);function rf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Gl(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}var qS={ok:!1,reason:"not-in-era"};function jS(e){return rf(e)&&rf(e.outputSchema)&&YS(e.outputSchema)}var uf={era:"2025-11-25",hasRequestMethod:e_,hasNotificationMethod:t_,validateRequest:(e,t)=>Gl(sv(e),t),validateResult:(e,t)=>Gl(nv(e),t),validateNotification:(e,t)=>Gl(iv(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>qS,validateInputResponse:()=>qS,samplingResultVariant:((e,t)=>{let o=KS();return Gl(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let o=GS(e),r=o.structuredContent;if(r===void 0)return o;let n=typeof r!="object"||r===null||Array.isArray(r),s=t!==void 0&&YS(t);return!n&&!s?o:{...o,structuredContent:{result:r}}},decodeResult(e,t){if(rf(t)&&"resultType"in t){let o={...t};return delete o.resultType,{kind:"complete",result:o}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let o=t.tools;return!Array.isArray(o)||!o.some(r=>jS(r))?t:{...t,tools:o.map(r=>jS(r)?{...r,outputSchema:tv(r.outputSchema)}:r)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function av(){let e=Et(()=>P([a(),b(),R(),Fe(),w(a(),e),g(e)])),t=w(a(),e),o=P([a(),b().int()]),r=a(),n=P([a(),b().int()]),s=I(["user","assistant"]),i=I(["debug","info","notice","warning","error","critical","alert","emergency"]),c=a().refine(X=>{try{return atob(X),!0}catch{return!1}},{message:"Invalid Base64 string"}),l=p({ttl:b().optional()}),u=p({taskId:a()}),h=C({progressToken:o.optional(),"io.modelcontextprotocol/related-task":u.optional()}),f=p({_meta:h.optional()}),y=f.extend({task:l.optional()}),_=p({_meta:h.optional()}),v=p({method:a(),params:_.loose().optional()}),k=p({src:a(),mimeType:a().optional(),sizes:g(a()).optional(),theme:I(["light","dark"]).optional()}),T=p({icons:g(k).optional()}),O=p({name:a(),title:a().optional()}),j=O.extend({...O.shape,...T.shape,version:a(),websiteUrl:a().optional(),description:a().optional()}),M=qe(p({applyDefaults:R().optional()}),t),Z=nt(X=>X&&typeof X=="object"&&!Array.isArray(X)&&Object.keys(X).length===0?{form:{}}:X,qe(p({form:M.optional(),url:t.optional()}),t.optional())),V=C({list:t.optional(),cancel:t.optional(),requests:C({sampling:C({createMessage:t.optional()}).optional(),elicitation:C({create:t.optional()}).optional()}).optional()}),D=C({list:t.optional(),cancel:t.optional(),requests:C({tools:C({call:t.optional()}).optional()}).optional()}),G=p({experimental:w(a(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:Z.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:V.optional(),extensions:w(a(),t).optional()}),pe=p({experimental:w(a(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:p({listChanged:R().optional()}).optional(),resources:p({subscribe:R().optional(),listChanged:R().optional()}).optional(),tools:p({listChanged:R().optional()}).optional(),tasks:D.optional(),extensions:w(a(),t).optional()}),te=p({progress:b(),total:$(b()),message:$(a())}),ke=p({..._.shape,...te.shape,progressToken:o}),Lt=v.extend({method:S("notifications/progress"),params:ke}),Br=_.extend({level:i,logger:a().optional(),data:E()}),Gr=v.extend({method:S("notifications/message"),params:Br}),To=p({uri:a(),mimeType:$(a()),_meta:w(a(),E()).optional()}),pt=To.extend({text:a()}),Ut=To.extend({blob:c}),Le=p({audience:g(s).optional(),priority:b().min(0).max(1).optional(),lastModified:Pe.datetime({offset:!0}).optional()}),ht=p({...O.shape,...T.shape,uri:a(),description:$(a()),mimeType:$(a()),size:$(b()),annotations:Le.optional(),_meta:$(C({}))}),ko=p({...O.shape,...T.shape,uriTemplate:a(),description:$(a()),mimeType:$(a()),annotations:Le.optional(),_meta:$(C({}))}),Qe=v.extend({method:S("notifications/resources/list_changed"),params:_.optional()}),Xe=_.extend({uri:a()}),Eo=v.extend({method:S("notifications/resources/updated"),params:Xe}),$o=p({name:a(),description:$(a()),required:$(R())}),Zt=p({...O.shape,...T.shape,description:$(a()),arguments:$(g($o)),_meta:$(C({}))}),Co=v.extend({method:S("notifications/prompts/list_changed"),params:_.optional()}),Ue=p({type:S("text"),text:a(),annotations:Le.optional(),_meta:w(a(),E()).optional()}),Oe=p({type:S("image"),data:c,mimeType:a(),annotations:Le.optional(),_meta:w(a(),E()).optional()}),Dt=p({type:S("audio"),data:c,mimeType:a(),annotations:Le.optional(),_meta:w(a(),E()).optional()}),Wr=p({type:S("tool_use"),name:a(),id:a(),input:w(a(),E()),_meta:w(a(),E()).optional()}),Kr=p({type:S("resource"),resource:P([pt,Ut]),annotations:Le.optional(),_meta:w(a(),E()).optional()}),Yr=ht.extend({type:S("resource_link")}),mt=P([Ue,Oe,Dt,Yr,Kr]),Io=p({role:s,content:mt}),Vt=p({title:a().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),Qr=v.extend({method:S("notifications/tools/list_changed"),params:_.optional()}),Xr=p({name:a().optional()}),en=p({hints:g(Xr).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),tn=p({mode:I(["auto","required","none"]).optional()}),on=p({type:S("boolean"),title:a().optional(),description:a().optional(),default:R().optional()}),rn=p({type:S("string"),title:a().optional(),description:a().optional(),minLength:b().optional(),maxLength:b().optional(),format:I(["email","uri","date","date-time"]).optional(),default:a().optional()}),nn=p({type:I(["number","integer"]),title:a().optional(),description:a().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),sn=p({type:S("string"),title:a().optional(),description:a().optional(),enum:g(a()),default:a().optional()}),an=p({type:S("string"),title:a().optional(),description:a().optional(),oneOf:g(p({const:a(),title:a()})),default:a().optional()}),cn=p({type:S("string"),title:a().optional(),description:a().optional(),enum:g(a()),enumNames:g(a()).optional(),default:a().optional()}),ln=P([sn,an]),un=p({type:S("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:S("string"),enum:g(a())}),default:g(a()).optional()}),dn=p({type:S("array"),title:a().optional(),description:a().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:g(p({const:a(),title:a()}))}),default:g(a()).optional()}),pn=P([un,dn]),hn=P([cn,ln,pn]),mn=P([hn,on,rn,nn]),Ht=y.extend({mode:S("form").optional(),message:a(),requestedSchema:p({type:S("object"),properties:w(a(),mn),required:g(a()).optional()}).catchall(E())}),Ft=p({type:S("ref/resource"),uri:a()}),Jt=p({type:S("ref/prompt"),name:a()}),fn=p({uri:a().startsWith("file://"),name:a().optional(),_meta:w(a(),E()).optional()}),ft=G.shape,gn=p({experimental:ft.experimental,sampling:ft.sampling,elicitation:ft.elicitation,roots:ft.roots,extensions:ft.extensions}),Ee=pe.shape,Oo=p({experimental:Ee.experimental,logging:Ee.logging,completions:Ee.completions,prompts:Ee.prompts,resources:Ee.resources,tools:Ee.tools,extensions:Ee.extensions}),No=C({progressToken:o.optional(),[co]:a(),[br]:j.optional(),[lo]:gn,[vr]:i.optional()}),Bt=p({...O.shape,...T.shape,description:a().optional(),inputSchema:C({$schema:a().optional(),type:S("object")}),outputSchema:C({$schema:a().optional()}).optional(),annotations:Vt.optional(),_meta:w(a(),E()).optional()}),Sn=p({type:S("tool_result"),toolUseId:a(),content:g(mt),structuredContent:E().optional(),isError:R().optional(),_meta:w(a(),E()).optional()}),Ao=P([Ue,Oe,Dt,Wr,Sn]),Gt=p({role:s,content:P([Ao,g(Ao)]),_meta:w(a(),E()).optional()}),Mo=a(),qo=C({[Ct]:j.optional().catch(void 0)}),jo=qo.optional();function ce(X){return C({_meta:jo,resultType:Mo.default("complete"),...X})}let _n=ce({}),ya=ce({nextCursor:r.optional()}),Lo=ce({content:g(mt),structuredContent:E().optional(),isError:R().optional()}),yn=ce({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),tools:g(Bt),nextCursor:r.optional()}),bn=ce({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),prompts:g(Zt),nextCursor:r.optional()}),vn=ce({description:a().optional(),messages:g(Io)}),zn=ce({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),resources:g(ht),nextCursor:r.optional()}),wn=ce({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),resourceTemplates:g(ko),nextCursor:r.optional()}),Rn=ce({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),contents:g(P([pt,Ut]))}),xn=ce({completion:p({values:g(a()).max(100),total:b().int().optional(),hasMore:R().optional()}).loose()}),ba=ce({ttlMs:b().int().min(0),cacheScope:I(["public","private"])}),Pn=ce({ttlMs:b().int().min(0).catch(0),cacheScope:I(["public","private"]).catch("private"),supportedVersions:g(a()),capabilities:Oo,instructions:a().optional()}),gt=p({messages:g(Gt),modelPreferences:en.optional(),systemPrompt:a().optional(),includeContext:I(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:g(a()).optional(),metadata:t.optional(),tools:g(Bt).optional(),toolChoice:tn.optional()}),Tn=p({method:S("sampling/createMessage"),params:gt}),kn=p({method:S("roots/list"),params:p({_meta:w(a(),E()).optional()}).optional()}),En=p({...Gt.shape,model:a(),stopReason:a().optional()}),$n=p({roots:g(fn)}),Cn=p({action:I(["accept","decline","cancel"]),content:w(a(),P([a(),b(),R(),g(a())])).optional()}),In=p({mode:S("url"),message:a(),url:a().url()}),On=P([Ht,In]),Nn=p({method:S("elicitation/create"),params:On}),An=P([Tn,kn,Nn]),Mn=P([En,$n,Cn]),qn=w(a(),An),jn=w(a(),Mn),Wt=ce({inputRequests:qn.optional(),requestState:a().optional()}),Kt={inputResponses:jn.optional(),requestState:a().optional()},va=p({_meta:No,...Kt}),za=C({progressToken:o.optional()});function ze(X,Qt){return p({method:S(X),params:p({_meta:No,...Qt})})}function we(X,Qt){return p({method:S(X),params:p({_meta:za.optional(),...Qt}).optional()})}let Ln={name:a(),arguments:w(a(),E()).optional(),...Kt},Ne={cursor:r.optional()},wa=ze("tools/call",Ln),Ra=ze("tools/list",Ne),xa=ze("prompts/list",Ne),Pa=ze("prompts/get",{name:a(),arguments:w(a(),a()).optional(),...Kt}),Ta=ze("resources/list",Ne),ka=ze("resources/templates/list",Ne),Ea=ze("resources/read",{uri:a(),...Kt}),Un={ref:P([Jt,Ft]),argument:p({name:a(),value:a()}),context:p({arguments:w(a(),a()).optional()}).optional()},$a=ze("completion/complete",Un),Ca=ze("server/discover",{}),Uo=p({toolsListChanged:R().optional(),promptsListChanged:R().optional(),resourcesListChanged:R().optional(),resourceSubscriptions:g(a()).optional()}),Zn={notifications:Uo},Ia=ze("subscriptions/listen",Zn),Oa=qo.extend({"io.modelcontextprotocol/subscriptionId":n}),Dn=C({_meta:Oa,resultType:Mo.default("complete")}),St={"tools/call":we("tools/call",Ln),"tools/list":we("tools/list",Ne),"prompts/get":we("prompts/get",{name:a(),arguments:w(a(),a()).optional()}),"prompts/list":we("prompts/list",Ne),"resources/list":we("resources/list",Ne),"resources/templates/list":we("resources/templates/list",Ne),"resources/read":we("resources/read",{uri:a()}),"completion/complete":we("completion/complete",Un),"server/discover":we("server/discover",{}),"subscriptions/listen":we("subscriptions/listen",Zn)};function _e(X){return C({_meta:jo,...X})}let Na={"tools/call":_e({content:g(mt),structuredContent:E().optional(),isError:R().optional()}),"tools/list":_e({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),tools:g(Bt),nextCursor:r.optional()}),"prompts/get":_e({description:a().optional(),messages:g(Io)}),"prompts/list":_e({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),prompts:g(Zt),nextCursor:r.optional()}),"resources/list":_e({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),resources:g(ht),nextCursor:r.optional()}),"resources/templates/list":_e({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),resourceTemplates:g(ko),nextCursor:r.optional()}),"resources/read":_e({ttlMs:b().int().min(0),cacheScope:I(["public","private"]),contents:g(P([pt,Ut]))}),"completion/complete":_e({completion:p({values:g(a()).max(100),total:b().int().optional(),hasMore:R().optional()}).loose()}),"server/discover":_e({ttlMs:b().int().min(0).catch(0),cacheScope:I(["public","private"]).catch("private"),supportedVersions:g(a()),capabilities:Oo,instructions:a().optional()}),"subscriptions/listen":_e({})},Yt=C({"io.modelcontextprotocol/subscriptionId":n.optional()}),Zo=p({method:S("notifications/subscriptions/acknowledged"),params:p({_meta:Yt.optional(),notifications:Uo})}),Do=p({_meta:Yt.optional(),requestId:n,reason:a().optional()}),Vo=p({method:S("notifications/cancelled"),params:Do}),Xl={"notifications/cancelled":Vo,"notifications/progress":Lt,"notifications/message":Gr,"notifications/resources/updated":Eo,"notifications/resources/list_changed":Qe,"notifications/tools/list_changed":Qr,"notifications/prompts/list_changed":Co,"notifications/subscriptions/acknowledged":Zo},he=X=>p({jsonrpc:S("2.0"),id:P([a(),b().int()]),result:X}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:i,TaskMetadataSchema:l,RelatedTaskMetadataSchema:u,RequestMetaSchema:h,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:y,NotificationsParamsSchema:_,NotificationSchema:v,IconSchema:k,IconsSchema:T,BaseMetadataSchema:O,ImplementationSchema:j,ClientTasksCapabilitySchema:V,ServerTasksCapabilitySchema:D,ClientCapabilitiesSchema:G,ServerCapabilitiesSchema:pe,ProgressSchema:te,ProgressNotificationParamsSchema:ke,ProgressNotificationSchema:Lt,LoggingMessageNotificationParamsSchema:Br,LoggingMessageNotificationSchema:Gr,ResourceContentsSchema:To,TextResourceContentsSchema:pt,BlobResourceContentsSchema:Ut,AnnotationsSchema:Le,ResourceSchema:ht,ResourceTemplateSchema:ko,ResourceListChangedNotificationSchema:Qe,ResourceUpdatedNotificationParamsSchema:Xe,ResourceUpdatedNotificationSchema:Eo,PromptArgumentSchema:$o,PromptSchema:Zt,PromptListChangedNotificationSchema:Co,TextContentSchema:Ue,ImageContentSchema:Oe,AudioContentSchema:Dt,ToolUseContentSchema:Wr,EmbeddedResourceSchema:Kr,ResourceLinkSchema:Yr,ContentBlockSchema:mt,PromptMessageSchema:Io,ToolAnnotationsSchema:Vt,ToolListChangedNotificationSchema:Qr,ModelHintSchema:Xr,ModelPreferencesSchema:en,ToolChoiceSchema:tn,BooleanSchemaSchema:on,StringSchemaSchema:rn,NumberSchemaSchema:nn,UntitledSingleSelectEnumSchemaSchema:sn,TitledSingleSelectEnumSchemaSchema:an,LegacyTitledEnumSchemaSchema:cn,SingleSelectEnumSchemaSchema:ln,UntitledMultiSelectEnumSchemaSchema:un,TitledMultiSelectEnumSchemaSchema:dn,MultiSelectEnumSchemaSchema:pn,EnumSchemaSchema:hn,PrimitiveSchemaDefinitionSchema:mn,ElicitRequestFormParamsSchema:Ht,ResourceTemplateReferenceSchema:Ft,PromptReferenceSchema:Jt,RootSchema:fn,ClientCapabilities2026Schema:gn,ServerCapabilities2026Schema:Oo,RequestMetaEnvelopeSchema:No,ToolSchema:Bt,ToolResultContentSchema:Sn,SamplingMessageContentBlockSchema:Ao,SamplingMessageSchema:Gt,ResultTypeSchema:Mo,ResultMetaSchema:qo,ResultSchema:_n,PaginatedResultSchema:ya,CallToolResultSchema:Lo,ListToolsResultSchema:yn,ListPromptsResultSchema:bn,GetPromptResultSchema:vn,ListResourcesResultSchema:zn,ListResourceTemplatesResultSchema:wn,ReadResourceResultSchema:Rn,CompleteResultSchema:xn,CacheableResultSchema:ba,DiscoverResultSchema:Pn,CreateMessageRequestParamsSchema:gt,CreateMessageRequestSchema:Tn,ListRootsRequestSchema:kn,CreateMessageResultSchema:En,ListRootsResultSchema:$n,ElicitResultSchema:Cn,ElicitRequestURLParamsSchema:In,ElicitRequestParamsSchema:On,ElicitRequestSchema:Nn,InputRequestSchema:An,InputResponseSchema:Mn,InputRequestsSchema:qn,InputResponsesSchema:jn,InputRequiredResultSchema:Wt,InputResponseRequestParamsSchema:va,CallToolRequestSchema:wa,ListToolsRequestSchema:Ra,ListPromptsRequestSchema:xa,GetPromptRequestSchema:Pa,ListResourcesRequestSchema:Ta,ListResourceTemplatesRequestSchema:ka,ReadResourceRequestSchema:Ea,CompleteRequestSchema:$a,DiscoverRequestSchema:Ca,SubscriptionFilterSchema:Uo,SubscriptionsListenRequestSchema:Ia,SubscriptionsListenResultMetaSchema:Oa,SubscriptionsListenResultSchema:Dn,dispatchRequestSchemas:St,dispatchResultSchemas:Na,NotificationMetaSchema:Yt,SubscriptionsAcknowledgedNotificationSchema:Zo,CancelledNotificationParamsSchema:Do,CancelledNotificationSchema:Vo,notificationSchemas2026:Xl,JSONRPCResultResponseSchema:he(_n),CallToolResultResponseSchema:he(P([Lo,Wt])),ListToolsResultResponseSchema:he(yn),ListPromptsResultResponseSchema:he(bn),GetPromptResultResponseSchema:he(P([vn,Wt])),ListResourcesResultResponseSchema:he(zn),ListResourceTemplatesResultResponseSchema:he(wn),ReadResourceResultResponseSchema:he(P([Rn,Wt])),CompleteResultResponseSchema:he(xn),DiscoverResultResponseSchema:he(Pn),SubscriptionsListenResultResponseSchema:he(Dn)}}var cv;function Mt(){return cv??=av()}var lv=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function uv(e){return lv.includes(e)}var df=Symbol("modelcontextprotocol.resultCacheHintFallback");function dv(e){return e[df]}function o_(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function r_(e){return e==="public"||e==="private"}var U=(function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e})({}),ae=class n_ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Te(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Te(this,t)}constructor(t,o,r){super(o),this.code=t,this.data=r,this.name="ProtocolError",Ro(this,new.target)}static fromError(t,o,r){if(t===U.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new i_(n.elicitations,o)}if(t===U.UnsupportedProtocolVersion&&r){let n=r;if(Array.isArray(n.supported)&&typeof n.requested=="string")return new a_({supported:n.supported,requested:n.requested},o)}if(t===U.InvalidParams||t===U.ResourceNotFound){let n=r;if(typeof n?.uri=="string"&&(t===U.ResourceNotFound||Object.keys(n).length===1))return new s_(n.uri,o)}if(t===U.MissingRequiredClientCapability&&r){let n=r;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities=="object"&&!Array.isArray(n.requiredCapabilities))return new c_({requiredCapabilities:n.requiredCapabilities},o)}return new n_(t,o,r)}},s_=class extends ae{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(U.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},i_=class extends ae{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(U.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},a_=class extends ae{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(U.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},c_=class extends ae{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(U.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},pv=0,hv="private",mv=["tools/call","prompts/get","resources/read"];function fv(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete"||mv.includes(e))return t;throw new ae(U.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function gv(e,t){let o=dv(t);if(t.resultType!=="complete"||!uv(e))return o===void 0?t:vv(t);let r=t,n=o_(r.ttlMs)?r.ttlMs:yv(o),s=r_(r.cacheScope)?r.cacheScope:bv(o),i={...r,ttlMs:n,cacheScope:s};return delete i[df],i}function Sv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function _v(e,t){if(t===void 0)return e;let o=e._meta;return o===void 0?{...e,_meta:{[Ct]:t}}:!Sv(o)||o[Ct]!==void 0?e:{...e,_meta:{...o,[Ct]:t}}}function yv(e){return e!==void 0&&o_(e.ttlMs)?e.ttlMs:pv}function bv(e){return e!==void 0&&r_(e.cacheScope)?e.cacheScope:hv}function vv(e){let t={...e};return delete t[df],t}var zv=["elicitation/create","sampling/createMessage","roots/list"],Wl;function l_(){if(Wl)return Wl;let e=Mt();return Wl={request:{"elicitation/create":p({method:S("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":p({method:S("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":p({method:S("roots/list"),params:C({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Wl}function u_(e){return zv.includes(e)}function Ym(e){return u_(e)?l_().request[e]:void 0}function wv(e){return u_(e)?l_().response[e]:void 0}var pf={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},d_={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function p_(e){return Object.prototype.hasOwnProperty.call(pf,e)}function h_(e){return Object.prototype.hasOwnProperty.call(d_,e)}function Rv(e){return Object.prototype.hasOwnProperty.call(pf,e)}function xv(e){return p_(e)?Mt().dispatchRequestSchemas[e]:void 0}function Pv(e){return Rv(e)?Mt().dispatchResultSchemas[e]:void 0}function Tv(e){return h_(e)?Mt().notificationSchemas2026[e]:void 0}var fR=Object.keys(pf),gR=Object.keys(d_);function la(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function aa(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}var kv={ok:!1,reason:"not-in-era"},Ev=[co,lo];function $v(e,t){let o=t,r=!1,n=()=>(r||(o={...o},r=!0),o),s=t.tools;e==="tools/list"&&Array.isArray(s)&&s.some(c=>la(c)&&"execution"in c)&&(n().tools=s.map(c=>{if(!la(c)||!("execution"in c))return c;let l={...c};return delete l.execution,l}));let i=t.capabilities;if(la(i)&&"tasks"in i){let c={...i};delete c.tasks,n().capabilities=c}return o}var hf={era:"2026-07-28",hasRequestMethod:p_,hasNotificationMethod:h_,hasInputRequestMethod:e=>Ym(e)!==void 0,validateRequest:(e,t)=>aa(xv(e),t),validateResult:(e,t)=>aa(Pv(e),t),validateNotification:(e,t)=>aa(Tv(e),t),validateInputRequest:(e,t)=>aa(Ym(e),t),validateInputResponse:(e,t)=>aa(wv(e),t),samplingResultVariant:()=>kv,outboundEnvelope(e){return{[co]:e.protocolVersion,[br]:e.clientInfo,[lo]:e.clientCapabilities,...e.logLevel!==void 0&&{[vr]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of Ev)r in e||t.push({key:r,problem:"missing"});let o=Mt().RequestMetaEnvelopeSchema.safeParse(e);if(!o.success)for(let r of o.error.issues){let n=r.path.map(String),s=n.length>0?n.join("."):"_meta";n.length===1&&t.some(i=>i.key===s&&i.problem==="missing")||t.push({key:s,problem:r.message})}return t},projectCallToolResult:e=>GS(e),inputRequestSchema:Ym,decodeResult(e,t){if(!la(t))return{kind:"invalid",error:new ee(ie.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new ee(ie.InvalidResult,`Invalid result for ${e}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof o!="string")return{kind:"invalid",error:new ee(ie.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let i=t.inputRequests,c=la(i)?i:{},l=t.requestState,u=t._meta===void 0?void 0:Mt().ResultMetaSchema.safeParse(t._meta),h=u?.success?u.data:void 0;return Object.keys(c).length===0&&typeof l!="string"?{kind:"invalid",error:new ee(ie.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})}:{kind:"input_required",inputRequests:c,...typeof l=="string"&&{requestState:l},...h!==void 0&&{_meta:h}}}if(o!=="complete")return{kind:"invalid",error:new ee(ie.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=Cv(),n=Object.hasOwn(r,e)?r[e]:void 0;if(n!==void 0){let i=n.safeParse(t);if(!i.success)return{kind:"invalid",error:new ee(ie.InvalidResult,`Invalid result for ${e}: ${i.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,o){return _v(gv(e,fv(e,$v(e,t))),o)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=Mt().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(o=>o.message).join("; ")}`}},Kl;function Cv(){if(Kl)return Kl;let e=Mt();return Kl={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Kl}var mf="2026-07-28";function da(e){return e!==void 0&&BS(e)?hf:uf}function LS(e){return e.revision!==void 0?da(e.revision).era:e.era==="modern"?hf.era:uf.era}function Qm(e){return m_.some(t=>t.hasRequestMethod(e))}function Xm(e){return m_.some(t=>t.hasNotificationMethod(e))}function US(e){return e==="tasks/get"||e==="tasks/cancel"}var m_=[uf,hf],Iv=Of({AnnotationsSchema:()=>Ge,AudioContentSchema:()=>_o,BaseMetadataSchema:()=>Je,BaseRequestParamsSchema:()=>re,BlobResourceContentsSchema:()=>Ar,BooleanSchemaSchema:()=>Lr,CallToolRequestParamsSchema:()=>fi,CallToolRequestSchema:()=>gi,CallToolResultSchema:()=>At,CancelTaskRequestSchema:()=>ql,CancelTaskResultSchema:()=>jl,CancelledNotificationParamsSchema:()=>ws,CancelledNotificationSchema:()=>kr,ClientCapabilitiesSchema:()=>xs,ClientNotificationSchema:()=>Ul,ClientRequestSchema:()=>Ll,ClientResultSchema:()=>Zl,ClientTasksCapabilitySchema:()=>Rl,CompatibilityCallToolResultSchema:()=>Pl,CompleteRequestParamsSchema:()=>Vi,CompleteRequestSchema:()=>Hi,CompleteResultSchema:()=>Fi,ContentBlockSchema:()=>We,CreateMessageRequestParamsSchema:()=>ki,CreateMessageRequestSchema:()=>Ei,CreateMessageResultSchema:()=>$i,CreateMessageResultWithToolsSchema:()=>Ci,CreateTaskResultSchema:()=>El,CursorSchema:()=>wr,DiscoverRequestSchema:()=>$s,DiscoverResultSchema:()=>$r,ElicitRequestFormParamsSchema:()=>wo,ElicitRequestParamsSchema:()=>Mi,ElicitRequestSchema:()=>qi,ElicitRequestURLParamsSchema:()=>Ai,ElicitResultSchema:()=>Ui,ElicitationCompleteNotificationParamsSchema:()=>ji,ElicitationCompleteNotificationSchema:()=>Li,EmbeddedResourceSchema:()=>yo,EmptyResultSchema:()=>Ot,EnumSchemaSchema:()=>Ni,GetPromptRequestParamsSchema:()=>si,GetPromptRequestSchema:()=>ii,GetPromptResultSchema:()=>li,GetTaskPayloadRequestSchema:()=>Ol,GetTaskPayloadResultSchema:()=>Nl,GetTaskRequestSchema:()=>Cl,GetTaskResultSchema:()=>Il,IconSchema:()=>Rs,IconsSchema:()=>it,ImageContentSchema:()=>So,ImplementationSchema:()=>Be,InitializeRequestParamsSchema:()=>Ps,InitializeRequestSchema:()=>Ts,InitializeResultSchema:()=>ks,InitializedNotificationSchema:()=>Es,JSONArraySchema:()=>zl,JSONObjectSchema:()=>W,JSONRPCErrorResponseSchema:()=>ho,JSONRPCMessageSchema:()=>mo,JSONRPCNotificationSchema:()=>Tr,JSONRPCRequestSchema:()=>Pr,JSONRPCResponseSchema:()=>wl,JSONRPCResultResponseSchema:()=>po,JSONValueSchema:()=>st,LegacyTitledEnumSchemaSchema:()=>Dr,ListChangedOptionsBaseSchema:()=>Tl,ListPromptsRequestSchema:()=>ri,ListPromptsResultSchema:()=>ni,ListResourceTemplatesRequestSchema:()=>qs,ListResourceTemplatesResultSchema:()=>js,ListResourcesRequestSchema:()=>As,ListResourcesResultSchema:()=>Ms,ListRootsRequestSchema:()=>Bi,ListRootsResultSchema:()=>Gi,ListTasksRequestSchema:()=>Al,ListTasksResultSchema:()=>Ml,ListToolsRequestSchema:()=>hi,ListToolsResultSchema:()=>mi,LoggingLevelSchema:()=>jr,LoggingMessageNotificationParamsSchema:()=>bi,LoggingMessageNotificationSchema:()=>vi,ModelHintSchema:()=>zi,ModelPreferencesSchema:()=>wi,MultiSelectEnumSchemaSchema:()=>Oi,NotificationSchema:()=>se,NotificationsParamsSchema:()=>de,NumberSchemaSchema:()=>zo,PaginatedRequestParamsSchema:()=>Os,PaginatedRequestSchema:()=>at,PaginatedResultSchema:()=>ct,PingRequestSchema:()=>Cr,PrimitiveSchemaDefinitionSchema:()=>Fr,ProgressNotificationParamsSchema:()=>Is,ProgressNotificationSchema:()=>Ir,ProgressSchema:()=>Cs,ProgressTokenSchema:()=>zr,PromptArgumentSchema:()=>ti,PromptListChangedNotificationSchema:()=>ui,PromptMessageSchema:()=>ci,PromptReferenceSchema:()=>Di,PromptSchema:()=>oi,ReadResourceRequestParamsSchema:()=>Ls,ReadResourceRequestSchema:()=>Us,ReadResourceResultSchema:()=>Zs,RelatedTaskMetadataSchema:()=>zs,RequestIdSchema:()=>je,RequestMetaSchema:()=>Rr,RequestSchema:()=>K,ResourceContentsSchema:()=>Or,ResourceLinkSchema:()=>bo,ResourceListChangedNotificationSchema:()=>Ds,ResourceRequestParamsSchema:()=>fo,ResourceSchema:()=>Mr,ResourceTemplateReferenceSchema:()=>Zi,ResourceTemplateSchema:()=>Ns,ResourceUpdatedNotificationParamsSchema:()=>Xs,ResourceUpdatedNotificationSchema:()=>ei,ResultMetaObjectSchema:()=>xr,ResultSchema:()=>Y,RoleSchema:()=>lt,RootSchema:()=>Ji,RootsListChangedNotificationSchema:()=>Wi,SamplingContentSchema:()=>Pi,SamplingMessageContentBlockSchema:()=>$t,SamplingMessageSchema:()=>Ti,ServerCapabilitiesSchema:()=>Er,ServerNotificationSchema:()=>Vl,ServerRequestSchema:()=>Dl,ServerResultSchema:()=>Hl,ServerTasksCapabilitySchema:()=>xl,SetLevelRequestParamsSchema:()=>_i,SetLevelRequestSchema:()=>yi,SingleSelectEnumSchemaSchema:()=>Ii,StringSchemaSchema:()=>vo,SubscribeRequestParamsSchema:()=>Vs,SubscribeRequestSchema:()=>Hs,SubscriptionFilterSchema:()=>qr,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Ws,SubscriptionsAcknowledgedNotificationSchema:()=>Ks,SubscriptionsListenRequestParamsSchema:()=>Bs,SubscriptionsListenRequestSchema:()=>Gs,SubscriptionsListenResultMetaSchema:()=>Ys,SubscriptionsListenResultSchema:()=>Qs,TaskAugmentedRequestParamsSchema:()=>It,TaskCreationParamsSchema:()=>kl,TaskMetadataSchema:()=>vs,TaskSchema:()=>ut,TaskStatusNotificationParamsSchema:()=>Yi,TaskStatusNotificationSchema:()=>$l,TaskStatusSchema:()=>Ki,TextContentSchema:()=>go,TextResourceContentsSchema:()=>Nr,TitledMultiSelectEnumSchemaSchema:()=>Hr,TitledSingleSelectEnumSchemaSchema:()=>Zr,ToolAnnotationsSchema:()=>di,ToolChoiceSchema:()=>Ri,ToolExecutionSchema:()=>pi,ToolListChangedNotificationSchema:()=>Si,ToolResultContentSchema:()=>xi,ToolSchema:()=>Nt,ToolUseContentSchema:()=>ai,UnsubscribeRequestParamsSchema:()=>Fs,UnsubscribeRequestSchema:()=>Js,UntitledMultiSelectEnumSchemaSchema:()=>Vr,UntitledSingleSelectEnumSchemaSchema:()=>Ur});var f_=e=>Pr.safeParse(e).success,g_=e=>Tr.safeParse(e).success,nf=e=>po.safeParse(e).success,S_=e=>ho.safeParse(e).success;var ua=-32020,SR=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[U.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[ua,U.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[U.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[U.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[U.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[ua],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half \u2014 including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[U.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[ua],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],_R={[U.ParseError]:400,[U.InvalidRequest]:400,[U.MethodNotFound]:404,[U.UnsupportedProtocolVersion]:400,[U.MissingRequiredClientCapability]:400,[ua]:400};function ff(e,t){return ls(e,t)}function ca(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function sf(e){if(e==null)return!1;let t=typeof e;return t!=="object"&&t!=="function"||!("~standard"in e)?!1:typeof e["~standard"]?.validate=="function"}var ZS=!1,af="draft-2020-12";function Ov(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:af});else if(o.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");ZS||(ZS=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=io(e,{target:af,io:t})}else throw new Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return r.type!==void 0?r:__(r)?{type:"object",...r}:r;if(r.type!==void 0&&r.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}function __(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let o=e[t];if(Array.isArray(o)&&o.length>0)return o.every(r=>r!==null&&typeof r=="object"&&(r.type==="object"||__(r)))}return!1}function Nv(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function ef(e,t){let o=await e["~standard"].validate(t);return o.issues&&o.issues.length>0?{success:!1,error:o.issues.map(r=>Nv(r)).join(", ")}:{success:!0,data:o.value}}function Av(e){let t=io(e,{target:af,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var Mv=/\\\.\\d\{(\d+)\}/;function qv(e){let t=Mv.exec(e),o=[void 0,-1,0];return t&&o.push(Number(t[1])),[!1,!0].flatMap(r=>[!1,!0].flatMap(n=>o.map(s=>Pe.datetime({local:r,offset:n,precision:s}))))}function jv(e,t){let o;switch(e){case"email":o=[Kc()];break;case"uri":o=[fr()];break;case"date":o=[Pe.date()];break;case"date-time":o=qv(t);break}return new Set(o.map(r=>Av(r)).filter(r=>r!==void 0))}function Lv(e,t,o){return o!=="zod"?!0:jv(e,t).has(t)}function pa(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Uv(e){try{return Ov(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new ae(U.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var Zv=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function gf(e){return Zv.has(e)||e.startsWith("x-")}var Dv=new Set(["$schema",...Object.keys(wo.shape.requestedSchema.shape)]),DS={string:ca([vo,Ur,Zr,Dr]),number:ca([zo]),integer:ca([zo]),boolean:ca([Lr]),array:ca([Vr,Hr])},Vv=new Set(vo.shape.format.unwrap().options);function Hv(e,t,o,r){if(!pa(e))return e;let n=typeof e.type=="string"&&Object.hasOwn(DS,e.type)?DS[e.type]:void 0;if(n===void 0)return e;let s={};for(let[i,c]of Object.entries(e))n.has(i)||gf(i)?s[i]=c:i==="pattern"&&e.type==="string"&&typeof e.format=="string"?Vv.has(e.format)?(typeof c!="string"||!Lv(e.format,c,o))&&r.push(`${t}.${i}`):s[i]=c:r.push(`${t}.${i}`);return s}function Fv(e,t){let o={},r=[];for(let[n,s]of Object.entries(e))n==="properties"&&pa(s)?o[n]=Object.fromEntries(Object.entries(s).map(([i,c])=>[i,Hv(c,`properties.${i}`,t,r)])):Dv.has(n)?o[n]=s:gf(n)||r.push(n);if(r.length>0)throw new ae(U.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function Jv(e,t){if(!pa(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!ff(Fr,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function cf(e,t,o=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((r,n)=>cf(r,t[n],`${o}[${n}]`)):!pa(e)||!pa(t)?[]:Object.entries(e).flatMap(([r,n])=>{let s=o?`${o}.${r}`:r;return Object.prototype.hasOwnProperty.call(t,r)?cf(n,t[r],s):gf(r)?[]:[s]})}function Bv(e){if(!sf(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=Fv(Uv(e.requestedSchema),t),r=ff(wo.shape.requestedSchema,o);if(!r.success)throw new ae(U.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Jv(o,r.error.message)}`);let n=cf(o,r.data);if(n.length>0)throw new ae(U.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(r.data.required??[]).filter(i=>!Object.prototype.hasOwnProperty.call(r.data.properties,i));if(s.length>0)throw new ae(U.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function Gv(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,o=typeof e.requestState=="string";if(!t&&!o)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var yR=Object.assign(Gv,{elicit(e){try{return{method:"elicitation/create",params:Bv(e)}}catch(t){throw t instanceof ae?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var Wv=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],Kv={IdJagTokenExchangeResponseSchema:oa,OAuthClientInformationFullSchema:ia,OAuthClientInformationSchema:sa,OAuthClientMetadataSchema:na,OAuthClientRegistrationErrorSchema:Fl,OAuthErrorResponseSchema:ra,OAuthMetadataSchema:Jr,OAuthProtectedResourceMetadataSchema:Qi,OAuthTokenRevocationRequestSchema:Jl,OAuthTokensSchema:ta,OpenIdProviderDiscoveryMetadataSchema:ea,OpenIdProviderMetadataSchema:Xi},y_={},b_={};function v_(e,t){let o=e.slice(0,-6);y_[o]=t,b_[o]=r=>t.safeParse(r).success}for(let e of Wv)v_(e,Iv[e]);for(let[e,t]of Object.entries(Kv))v_(e,t);var Yv=Object.freeze(y_),Qv=Object.freeze(b_);function Xv(e){switch(e){case"initialize":case"notifications/initialized":return da(void 0);case"server/discover":return da(mf);default:return}}var z_=6e4,ez=[co,br,lo,vr],tz=["inputResponses","requestState"];function VS(e,t){let o=e.params;if(!tf(o))return{message:e,lifted:{}};let r=o._meta,n=tf(r)?ez.filter(l=>l in r):[],s=t==="request"?tz.filter(l=>l in o):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let i={},c={...o};if(n.length>0&&tf(r)){let l={},u={...r};for(let h of n)l[h]=r[h],delete u[h];i.envelope=l,Object.keys(u).length>0?c._meta=u:delete c._meta}for(let l of s)l==="inputResponses"&&(i.inputResponses=c[l]),l==="requestState"&&(i.requestState=c[l]),delete c[l];return{message:{...e,params:c},lifted:i}}function HS(e,t){let o=e.validateResult(t,void 0);if(!(!o.ok&&o.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let n=e.validateResult(t,r);return n.ok?{value:n.value}:{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function w_(e){return()=>e}var oz=w_(void 0),rz,Sf=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{rz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??yl,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let o=e.params??{};return{...e,params:{...o,_meta:{...t,...o._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new ee(ie.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,o,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:o,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let o=Date.now()-t.startTime;if(t.maxTotalTimeout&&o>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new ee(ie.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:o});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let o=this.transport?.onerror;this._transport.onerror=n=>{o?.(n),this._onerror(n)};let r=this._transport?.onmessage;this._transport.onmessage=(n,s)=>{r?.(n,s),nf(n)||S_(n)?this._onresponse(n):f_(n)?this._onrequest(n,s):g_(n)?this._onnotification(n,s):this._onerror(new Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let o=new ee(ie.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of e.values())r(o);for(let r of t.values())r.abort(o)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:o}=VS(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let i=LS(t.classification);if(i!==r.era){this._onerror(new Error(`Era mismatch on inbound notification '${o.method}': classified as ${i} but this instance serves ${r.era}`));return}}if(Xm(o.method)&&!r.hasNotificationMethod(o.method))return;let n=this._notificationHandlers.get(o.method),s=this.fallbackNotificationHandler;n===void 0&&s===void 0||Promise.resolve().then(()=>n===void 0?s(o):n(o,r)).catch(i=>this._onerror(new Error(`Uncaught error in notification handler: ${i}`)))}_onrequest(e,t){let{message:o,lifted:r}=VS(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let s=this._transport,i=(k,T,O)=>{let j={jsonrpc:"2.0",id:o.id,error:{code:k,message:T,...O!==void 0&&{data:O}}};s?.send(j).catch(M=>this._onerror(new Error(`Failed to send an error response: ${M}`)))};if(t?.classification!==void 0){let k=LS(t.classification);if(k!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${o.method}': classified as ${k} but this instance serves ${n.era}`));let T=t.classification.revision??k;i(U.UnsupportedProtocolVersion,`Unsupported protocol version: ${T}`,{supported:this._supportedProtocolVersions,requested:T});return}}if(Qm(o.method)&&!n.hasRequestMethod(o.method)&&!(US(o.method)&&this._customSchemaRequestMethods.has(o.method))){i(U.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(c===void 0){i(U.MethodNotFound,"Method not found");return}let l=n.checkInboundEnvelope(r);if(l!==void 0){i(U.InvalidParams,l);return}let u=(k,T)=>this._notificationViaCodec(this._resolveOutboundCodec(k.method),k,{...T,relatedRequestId:o.id}),h=(k,T,O)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(k.method),k,T,{...O,relatedRequestId:o.id}),f=new AbortController;this._requestHandlerAbortControllers.set(o.id,f);let y=r.inputResponses===void 0?void 0:nz(r.inputResponses),_={sessionId:s?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...y!==void 0&&{inputResponses:y.accepted},...y!==void 0&&y.droppedKeys.length>0&&{droppedInputResponseKeys:y.droppedKeys},requestState:r.requestState===void 0?oz:w_(r.requestState),signal:f.signal,send:((k,T,O)=>{let j=this._resolveOutboundCodec(k.method);if(this._assertOutboundRequestInEra(j,k.method),sf(T))return h(k,T,O);let M=HS(j,k.method);if(M===void 0)throw new TypeError(`'${k.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return h(k,M,T)}),notify:u},http:t?.authInfo?{authInfo:t.authInfo}:void 0},v=this.buildContext(_,t);Promise.resolve().then(()=>c(o,v)).then(async k=>{if(f.signal.aborted)return;let T;try{T=n.encodeResult(o.method,k,this._outboundServerInfo())}catch(j){this._onerror(new Error(`Failed to encode result for ${o.method}: ${j}`)),i(U.InternalError,"Internal error");return}let O={result:T,jsonrpc:"2.0",id:o.id};await s?.send(O)},async k=>{if(f.signal.aborted)return;let T=Number.isSafeInteger(k.code)?k.code:U.InternalError,O={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(T),message:k.message??"Internal error",...k.data!==void 0&&{data:k.data}}};await s?.send(O)}).catch(k=>this._onerror(new Error(`Failed to send response: ${k}`))).finally(()=>{this._requestHandlerAbortControllers.get(o.id)===f&&this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(e){let{progressToken:t,...o}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let s=this._responseHandlers.get(r),i=this._timeoutInfo.get(r);if(i&&s&&i.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),s(c);return}n(o)}_onresponse(e){let t=Number(e.id),o=this._responseHandlers.get(t);if(o===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),nf(e)?o(e):o(ae.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,o){let r=this._resolveOutboundCodec(e.method);if(sf(t))return US(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,o);this._assertOutboundRequestInEra(r,e.method);let n=HS(r,e.method);if(n===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,n,t)}_negotiatedWireCodec(){return da(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Xv(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Qm(t)&&!e.hasRequestMethod(t))throw new ee(ie.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,o){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,o)}_requestWithSchemaViaCodec(e,t,o,r){let{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c}=r??{},l=Date.now(),u,h;return new Promise((f,y)=>{let _=D=>{y(D)};if(!this._transport){_(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(D){_(D);return}if(r?.signal?.aborted){let D=r.signal.reason;throw D instanceof ee?D:new ee(ie.RequestTimeout,String(D))}let v=e.era===mf&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,k=this._requestMessageId++;h=k;let T={...t,jsonrpc:"2.0",id:k};r?.onprogress&&(this._progressHandlers.set(k,r.onprogress),T.params={...t.params,_meta:{...t.params?._meta,progressToken:k}});let O=this._envelopeOutbound(T),j=!1,M=D=>{j||(this._progressHandlers.delete(k),v===void 0?t.method!=="initialize"&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:k,reason:String(D)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i}).catch(G=>this._onerror(new Error(`Failed to send cancellation: ${G}`))):v.abort(),y(D instanceof ee?D:new ee(ie.RequestTimeout,String(D))))};this._responseHandlers.set(k,D=>{if(r?.signal?.aborted)return;if(j=!0,D instanceof Error)return y(D);let G;try{G=e.decodeResult(t.method,D.result)}catch(te){return y(te instanceof Error?te:new Error(String(te)))}if(G.kind==="invalid")return y(G.error);if(G.kind==="input_required"){if(r?.allowInputRequired===!0)return f(sz(G));let te={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:l,retry:(ke,Lt)=>this._requestWithSchemaViaCodec(e,ke===void 0?{method:t.method}:{method:t.method,params:ke},o,Lt)};return f(this._resolveNonCompleteResult(G,te))}let pe=G.result;ef(o,pe).then(te=>{te.success?f(te.data):y(new ee(ie.InvalidResult,`Invalid result for ${t.method}: ${te.error}`))},y)}),u=()=>M(r?.signal?.reason),r?.signal?.addEventListener("abort",u,{once:!0});let Z=r?.timeout??z_,V=()=>M(new ee(ie.RequestTimeout,"Request timed out",{timeout:Z}));this._setupTimeout(k,Z,r?.maxTotalTimeout,V,r?.resetTimeoutOnProgress??!1),this._transport.send(O,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:i,headers:c,requestSignal:v?.signal}).catch(D=>{this._progressHandlers.delete(k),y(D)})}).finally(()=>{u&&r?.signal?.removeEventListener("abort",u),h!==void 0&&(this._responseHandlers.delete(h),this._cleanupTimeout(h))})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,o){if(!this._transport)throw new ee(ie.NotConnected,"Not connected");if(Xm(t.method)&&!e.hasNotificationMethod(t.method))throw new ee(ie.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&o?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,o).catch(n=>this._onerror(n))});return}await this._transport.send(r,o)}setRequestHandler(e,t,o){this.assertRequestHandlerCapability(e);let r;if(typeof t=="function"){if(!Qm(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,s)=>{let i=this._negotiatedWireCodec(),c=i.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era"&&(c=i.validateInputRequest(e,n)),!c.ok)throw c.reason==="not-in-era"?new ae(U.InternalError,`No wire schema for ${e} in the resolved era`):new Error(c.message);return Promise.resolve(t(c.value,s))}}else if(o)r=async(n,s)=>{let i=await ef(t.params,{...n.params});if(!i.success)throw new ae(U.InvalidParams,`Invalid params for ${e}: ${i.error}`);return o(i.data,s)};else throw new TypeError("setRequestHandler: handler is required");typeof t=="function"?this._customSchemaRequestMethods.delete(e):this._customSchemaRequestMethods.add(e),this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,o){if(typeof t=="function"){if(!Xm(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,n)=>{let s=n.validateNotification(e,r);if(!s.ok)throw s.reason==="not-in-era"?new ae(U.InternalError,`No wire schema for ${e} in the resolved era`):new Error(s.message);return Promise.resolve(t(s.value))});return}if(!o)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async r=>{let n=await ef(t.params,{...r.params});if(!n.success)throw new ae(U.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function tf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function FS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function nz(e){let t={},o=[];if(!FS(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!FS(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function sz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var iz=If((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,o=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(c){if(!c)throw new TypeError("argument string is required");var l=typeof c=="object"?s(c):c;if(typeof l!="string")throw new TypeError("argument string is required to be a string");var u=l.indexOf(";"),h=u!==-1?l.slice(0,u).trim():l.trim();if(!r.test(h))throw new TypeError("invalid media type");var f=new i(h.toLowerCase());if(u!==-1){var y,_,v;for(t.lastIndex=u;_=t.exec(l);){if(_.index!==u)throw new TypeError("invalid parameter format");u+=_[0].length,y=_[1].toLowerCase(),v=_[2],v.charCodeAt(0)===34&&(v=v.slice(1,-1),v.indexOf("\\")!==-1&&(v=v.replace(o,"$1"))),f.parameters[y]=v}if(u!==l.length)throw new TypeError("invalid parameter format")}return f}function s(c){var l;if(typeof c.getHeader=="function"?l=c.getHeader("content-type"):typeof c.headers=="object"&&(l=c.headers&&c.headers["content-type"]),typeof l!="string")throw new TypeError("content-type header is missing from object");return l}function i(c){this.parameters=Object.create(null),this.type=c}})),bR=Nf(iz(),1);var az=10*1024*1024;var CR=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");var cz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,lz=[0,31,28,31,30,31,30,31,31,30,31,30,31],uz=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,dz=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,pz=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,hz=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,mz=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,fz=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,gz=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Sz=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,_z=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,yz=e=>{if(e[0]==='"')return!1;let[t,o,...r]=e.split("@");return!t||!o||r.length!==0||t.length>64||o.length>253||t[0]==="."||t.endsWith(".")||t.includes("..")||!/^[a-z0-9.-]+$/i.test(o)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t)?!1:o.split(".").every(n=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(n))},bz=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,vz=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,zz=e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Ke(e){return e.test.bind(e)}var IR={date:R_,time:x_.bind(void 0,!1),"date-time":xz,duration:zz,uri:kz,"uri-reference":Ke(pz),"uri-template":Ke(hz),url:Ke(mz),email:yz,hostname:Ke(dz),ipv4:Ke(bz),ipv6:Ke(vz),regex:$z,uuid:Ke(fz),"json-pointer":Ke(gz),"json-pointer-uri-fragment":Ke(Sz),"relative-json-pointer":Ke(_z)};function wz(e){return e%4===0&&(e%100!==0||e%400===0)}function R_(e){let t=e.match(cz);if(!t)return!1;let o=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(r==2&&wz(o)?29:lz[r])}function x_(e,t){let o=t.match(uz);if(!o)return!1;let r=+o[1],n=+o[2],s=+o[3],i=!!o[5];return(r<=23&&n<=59&&s<=59||r==23&&n==59&&s==60)&&(!e||i)}var Rz=/t|\s/i;function xz(e){let t=e.split(Rz);return t.length==2&&R_(t[0])&&x_(!0,t[1])}var Pz=/\/|:/,Tz=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function kz(e){return Pz.test(e)&&Tz.test(e)}var Ez=/[^\\]\\Z/;function $z(e){if(Ez.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var Iz;Iz=globalThis.crypto;var ha=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return Te(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Te(this,e)}constructor(e){super(e),this.name=new.target.name,Ro(this,new.target)}},Px=class extends ha{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,o){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 \xA73.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(o)}`),this.kind=e,this.expected=t,this.received=o}},Tx=class extends ha{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},kx=class extends ha{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},Ex=class extends ha{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`),this.recordedIssuer=e,this.currentIssuer=t}},$x=class extends ha{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};var Cx=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return Te(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Te(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",Ro(this,new.target)}};var Ix=Symbol.for("mcp.authSeamEscape");var Ox=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return Te(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Te(this,e)}constructor(e,t,o){super(`SSE error: ${t}`),this.code=e,this.event=o,Ro(this,new.target)}};var _f=class{_eventSlots=new Map;setHandler(t,o){let r=this._ensureEventSlot(t);r.onHandler&&o&&console.warn(`[MCP Apps] on${String(t)} handler replaced. Use addEventListener("${String(t)}", \u2026) to add multiple listeners without replacing.`),r.onHandler=o}getHandler(t){return this._eventSlots.get(t)?.onHandler}addEventListener(t,o){this._ensureEventSlot(t).listeners.push(o)}removeEventListener(t,o){let r=this._eventSlots.get(t);if(!r)return;let n=r.listeners.indexOf(o);n!==-1&&r.listeners.splice(n,1)}dispatch(t,o){let r=this._eventSlots.get(t);if(r){r.onHandler?.(o);for(let n of[...r.listeners])n(o)}}_ensureEventSlot(t){let o=this._eventSlots.get(t);return o||(o={listeners:[]},this._eventSlots.set(t,o)),o}},yf=class{_methods=new Set;claim(t,o){if(this._methods.has(t))throw Error(`Handler for "${t}" already registered (via ${o}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(t)}replace(t){this._methods.add(t)}release(t){this._methods.delete(t)}has(t){return this._methods.has(t)}},P_=new Set;function T_(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!="string")return;let s=n.method.value,i=e==="request"?"setRequestHandler":"setNotificationHandler";P_.has(i)||(P_.add(i),console.warn(`[ext-apps] ${i}(Schema, handler) is deprecated; use ${i}("${s}", { params: Schema.shape.params }, handler).`));let c=r;return[s,{params:n.params},e==="request"?(l,u)=>c({method:s,params:l},Oz(u)):l=>c({method:s,params:l})]}function Oz(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var Nz="2026-01-26";var Az="ui/notifications/tool-input-partial";var bf=class{eventTarget;eventSource;messageListener;constructor(t=window.parent,o){this.eventTarget=t,this.eventSource=o,this.messageListener=r=>{if(o&&r.source!==this.eventSource){console.debug("Ignoring message from unknown source",r);return}let n=mo.safeParse(r.data);n.success?(console.debug("Parsed message",n.data),this.onmessage?.(n.data)):r.data?.jsonrpc!=="2.0"?console.debug("Ignoring non-JSON-RPC message",n.error.message,r):(console.error("Failed to parse message",n.error.message,r),this.onerror?.(Error("Invalid JSON-RPC message received: "+n.error.message)))}}async start(){window.addEventListener("message",this.messageListener)}async send(t,o){t.method!==Az&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Mz=d.union([d.literal("light"),d.literal("dark")]).describe("Color theme preference for the host environment."),ma=d.union([d.literal("inline"),d.literal("fullscreen"),d.literal("pip")]).describe("Display mode for UI presentation."),qz=d.union([d.literal("--color-background-primary"),d.literal("--color-background-secondary"),d.literal("--color-background-tertiary"),d.literal("--color-background-inverse"),d.literal("--color-background-ghost"),d.literal("--color-background-info"),d.literal("--color-background-danger"),d.literal("--color-background-success"),d.literal("--color-background-warning"),d.literal("--color-background-disabled"),d.literal("--color-text-primary"),d.literal("--color-text-secondary"),d.literal("--color-text-tertiary"),d.literal("--color-text-inverse"),d.literal("--color-text-ghost"),d.literal("--color-text-info"),d.literal("--color-text-danger"),d.literal("--color-text-success"),d.literal("--color-text-warning"),d.literal("--color-text-disabled"),d.literal("--color-border-primary"),d.literal("--color-border-secondary"),d.literal("--color-border-tertiary"),d.literal("--color-border-inverse"),d.literal("--color-border-ghost"),d.literal("--color-border-info"),d.literal("--color-border-danger"),d.literal("--color-border-success"),d.literal("--color-border-warning"),d.literal("--color-border-disabled"),d.literal("--color-ring-primary"),d.literal("--color-ring-secondary"),d.literal("--color-ring-inverse"),d.literal("--color-ring-info"),d.literal("--color-ring-danger"),d.literal("--color-ring-success"),d.literal("--color-ring-warning"),d.literal("--font-sans"),d.literal("--font-mono"),d.literal("--font-weight-normal"),d.literal("--font-weight-medium"),d.literal("--font-weight-semibold"),d.literal("--font-weight-bold"),d.literal("--font-text-xs-size"),d.literal("--font-text-sm-size"),d.literal("--font-text-md-size"),d.literal("--font-text-lg-size"),d.literal("--font-heading-xs-size"),d.literal("--font-heading-sm-size"),d.literal("--font-heading-md-size"),d.literal("--font-heading-lg-size"),d.literal("--font-heading-xl-size"),d.literal("--font-heading-2xl-size"),d.literal("--font-heading-3xl-size"),d.literal("--font-text-xs-line-height"),d.literal("--font-text-sm-line-height"),d.literal("--font-text-md-line-height"),d.literal("--font-text-lg-line-height"),d.literal("--font-heading-xs-line-height"),d.literal("--font-heading-sm-line-height"),d.literal("--font-heading-md-line-height"),d.literal("--font-heading-lg-line-height"),d.literal("--font-heading-xl-line-height"),d.literal("--font-heading-2xl-line-height"),d.literal("--font-heading-3xl-line-height"),d.literal("--border-radius-xs"),d.literal("--border-radius-sm"),d.literal("--border-radius-md"),d.literal("--border-radius-lg"),d.literal("--border-radius-xl"),d.literal("--border-radius-full"),d.literal("--border-width-regular"),d.literal("--shadow-hairline"),d.literal("--shadow-sm"),d.literal("--shadow-md"),d.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),jz=d.record(qz.describe(`Style variables for theming MCP apps.
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let c=a[1];if(t===a[0]){i(a);continue}if(e.external){let p=e.external.registry.get(a[0])?.id;if(t!==a[0]&&p){i(a);continue}}if(e.metadataRegistry.get(a[0])?.id){i(a);continue}if(c.cycle){i(a);continue}if(c.count>1){if(e.reused==="ref"){i(a);continue}}}}function Xr(e,t){let o=e.seen.get(t);if(!o)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(c)=>{let d=e.seen.get(c);if(d.ref===null)return;let p=d.def??d.schema,m={...p},f=d.ref;if(d.ref=null,f){r(f);let S=e.seen.get(f),w=S.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))p.allOf=p.allOf??[],p.allOf.push(w);else Object.assign(p,w);if(Object.assign(p,m),c._zod.parent===f)for(let R in p){if(R==="$ref"||R==="allOf")continue;if(!(R in m))delete p[R]}if(w.$ref&&S.def)for(let R in p){if(R==="$ref"||R==="allOf")continue;if(R in S.def&&JSON.stringify(p[R])===JSON.stringify(S.def[R]))delete p[R]}}let y=c._zod.parent;if(y&&y!==f){r(y);let S=e.seen.get(y);if(S?.schema.$ref){if(p.$ref=S.schema.$ref,S.def)for(let w in p){if(w==="$ref"||w==="allOf")continue;if(w in S.def&&JSON.stringify(p[w])===JSON.stringify(S.def[w]))delete p[w]}}}e.override({zodSchema:c,jsonSchema:p,path:d.path??[]})};for(let c of[...e.seen.entries()].reverse())r(c[0]);let n={};if(e.target==="draft-2020-12")n.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")n.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")n.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let c=e.external.registry.get(t)?.id;if(!c)throw Error("Schema is missing an `id` property");n.$id=e.external.uri(c)}Object.assign(n,o.def??o.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&n.id===i)delete n.id;let a=e.external?.defs??{};for(let c of e.seen.entries()){let d=c[1];if(d.def&&d.defId){if(d.def.id===d.defId)delete d.def.id;a[d.defId]=d.def}}if(e.external);else if(Object.keys(a).length>0)if(e.target==="draft-2020-12")n.$defs=a;else n.definitions=a;try{let c=JSON.parse(JSON.stringify(n));return Object.defineProperty(c,"~standard",{value:{...t["~standard"],jsonSchema:{input:Kr(t,"input",e.processors),output:Kr(t,"output",e.processors)}},enumerable:!1,writable:!1}),c}catch(c){throw Error("Error converting schema to JSON.")}}function ue(e,t){let o=t??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return ue(r.element,o);if(r.type==="set")return ue(r.valueType,o);if(r.type==="lazy")return ue(r.getter(),o);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return ue(r.innerType,o);if(r.type==="intersection")return ue(r.left,o)||ue(r.right,o);if(r.type==="record"||r.type==="map")return ue(r.keyType,o)||ue(r.valueType,o);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return ue(r.in,o)||ue(r.out,o)}if(r.type==="object"){for(let n in r.shape)if(ue(r.shape[n],o))return!0;return!1}if(r.type==="union"){for(let n of r.options)if(ue(n,o))return!0;return!1}if(r.type==="tuple"){for(let n of r.items)if(ue(n,o))return!0;if(r.rest&&ue(r.rest,o))return!0;return!1}return!1}var bp=(e,t={})=>(o)=>{let r=Yr({...o,processors:t});return Z(e,r),Qr(r,e),Xr(r,e)},Kr=(e,t,o={})=>(r)=>{let{libraryOptions:n,target:i}=r??{},a=Yr({...n??{},target:i,io:t,processors:o});return Z(e,a),Qr(a,e),Xr(a,e)};var sf={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sc=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:i,maximum:a,format:c,patterns:d,contentEncoding:p}=e._zod.bag;if(typeof i==="number")n.minLength=i;if(typeof a==="number")n.maxLength=a;if(c){if(n.format=sf[c]??c,n.format==="")delete n.format;if(c==="time")delete n.format}if(p)n.contentEncoding=p;if(d&&d.size>0){let m=[...d];if(m.length===1)n.pattern=m[0].source;else if(m.length>1)n.allOf=[...m.map((f)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))]}},ic=(e,t,o,r)=>{let n=o,{minimum:i,maximum:a,format:c,multipleOf:d,exclusiveMaximum:p,exclusiveMinimum:m}=e._zod.bag;if(typeof c==="string"&&c.includes("int"))n.type="integer";else n.type="number";let f=typeof m==="number"&&m>=(i??Number.NEGATIVE_INFINITY),y=typeof p==="number"&&p<=(a??Number.POSITIVE_INFINITY),S=t.target==="draft-04"||t.target==="openapi-3.0";if(f)if(S)n.minimum=m,n.exclusiveMinimum=!0;else n.exclusiveMinimum=m;else if(typeof i==="number")n.minimum=i;if(y)if(S)n.maximum=p,n.exclusiveMaximum=!0;else n.exclusiveMaximum=p;else if(typeof a==="number")n.maximum=a;if(typeof d==="number")n.multipleOf=d},ac=(e,t,o,r)=>{o.type="boolean"},zp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},wp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Symbols cannot be represented in JSON Schema")},cc=(e,t,o,r)=>{if(t.target==="openapi-3.0")o.type="string",o.nullable=!0,o.enum=[null];else o.type="null"},lc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Undefined cannot be represented in JSON Schema")},Rp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Void cannot be represented in JSON Schema")},uc=(e,t,o,r)=>{o.not={}},dc=(e,t,o,r)=>{},pc=(e,t,o,r)=>{},xp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Date cannot be represented in JSON Schema")},hc=(e,t,o,r)=>{let n=e._zod.def,i=yi(n.entries);if(i.every((a)=>typeof a==="number"))o.type="number";if(i.every((a)=>typeof a==="string"))o.type="string";o.enum=i},mc=(e,t,o,r)=>{let n=e._zod.def,i=[];for(let a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a==="bigint")if(t.unrepresentable==="throw")throw Error("BigInt literals cannot be represented in JSON Schema");else i.push(Number(a));else i.push(a);if(i.length===0);else if(i.length===1){let a=i[0];if(o.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0")o.enum=[a];else o.const=a}else{if(i.every((a)=>typeof a==="number"))o.type="number";if(i.every((a)=>typeof a==="string"))o.type="string";if(i.every((a)=>typeof a==="boolean"))o.type="boolean";if(i.every((a)=>a===null))o.type="null";o.enum=i}},Pp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("NaN cannot be represented in JSON Schema")},Tp=(e,t,o,r)=>{let n=o,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");n.type="string",n.pattern=i.source},Ep=(e,t,o,r)=>{let n=o,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:d}=e._zod.bag;if(a!==void 0)i.minLength=a;if(c!==void 0)i.maxLength=c;if(d)if(d.length===1)i.contentMediaType=d[0],Object.assign(n,i);else Object.assign(n,i),n.anyOf=d.map((p)=>({contentMediaType:p}));else Object.assign(n,i)},kp=(e,t,o,r)=>{o.type="boolean"},fc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Custom types cannot be represented in JSON Schema")},$p=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Function types cannot be represented in JSON Schema")},gc=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Transforms cannot be represented in JSON Schema")},Cp=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Map cannot be represented in JSON Schema")},Ip=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw Error("Set cannot be represented in JSON Schema")},Sc=(e,t,o,r)=>{let n=o,i=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;if(typeof a==="number")n.minItems=a;if(typeof c==="number")n.maxItems=c;n.type="array",n.items=Z(i.element,t,{...r,path:[...r.path,"items"]})},_c=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object",n.properties={};let a=i.shape;for(let p in a)n.properties[p]=Z(a[p],t,{...r,path:[...r.path,"properties",p]});let c=new Set(Object.keys(a)),d=new Set([...c].filter((p)=>{let m=i.shape[p]._zod;if(t.io==="input")return m.optin===void 0;else return m.optout===void 0}));if(d.size>0)n.required=Array.from(d);if(i.catchall?._zod.def.type==="never")n.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")n.additionalProperties=!1}else if(i.catchall)n.additionalProperties=Z(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},yc=(e,t,o,r)=>{let n=e._zod.def,i=n.inclusive===!1,a=n.options.map((c,d)=>Z(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",d]}));if(i)o.oneOf=a;else o.anyOf=a},bc=(e,t,o,r)=>{let n=e._zod.def,i=Z(n.left,t,{...r,path:[...r.path,"allOf",0]}),a=Z(n.right,t,{...r,path:[...r.path,"allOf",1]}),c=(p)=>("allOf"in p)&&Object.keys(p).length===1,d=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];o.allOf=d},Op=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",d=i.items.map((y,S)=>Z(y,t,{...r,path:[...r.path,a,S]})),p=i.rest?Z(i.rest,t,{...r,path:[...r.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;if(t.target==="draft-2020-12"){if(n.prefixItems=d,p)n.items=p}else if(t.target==="openapi-3.0"){if(n.items={anyOf:d},p)n.items.anyOf.push(p);if(n.minItems=d.length,!p)n.maxItems=d.length}else if(n.items=d,p)n.additionalItems=p;let{minimum:m,maximum:f}=e._zod.bag;if(typeof m==="number")n.minItems=m;if(typeof f==="number")n.maxItems=f},vc=(e,t,o,r)=>{let n=o,i=e._zod.def;n.type="object";let a=i.keyType,d=a._zod.bag?.patterns;if(i.mode==="loose"&&d&&d.size>0){let m=Z(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let f of d)n.patternProperties[f.source]=m}else{if(t.target==="draft-07"||t.target==="draft-2020-12")n.propertyNames=Z(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});n.additionalProperties=Z(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let p=a._zod.values;if(p){let m=[...p].filter((f)=>typeof f==="string"||typeof f==="number");if(m.length>0)n.required=m}},zc=(e,t,o,r)=>{let n=e._zod.def,i=Z(n.innerType,t,r),a=t.seen.get(e);if(t.target==="openapi-3.0")a.ref=n.innerType,o.nullable=!0;else o.anyOf=[i,{type:"null"}]},wc=(e,t,o,r)=>{let n=e._zod.def;Z(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Rc=(e,t,o,r)=>{let n=e._zod.def;Z(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.default=JSON.parse(JSON.stringify(n.defaultValue))},xc=(e,t,o,r)=>{let n=e._zod.def;Z(n.innerType,t,r);let i=t.seen.get(e);if(i.ref=n.innerType,t.io==="input")o._prefault=JSON.parse(JSON.stringify(n.defaultValue))},Pc=(e,t,o,r)=>{let n=e._zod.def;Z(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw Error("Dynamic catch values are not supported in JSON Schema")}o.default=a},Tc=(e,t,o,r)=>{let n=e._zod.def,i=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?n.out:n.in:n.out;Z(a,t,r);let c=t.seen.get(e);c.ref=a},Ec=(e,t,o,r)=>{let n=e._zod.def;Z(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType,o.readOnly=!0},Np=(e,t,o,r)=>{let n=e._zod.def;Z(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},Ni=(e,t,o,r)=>{let n=e._zod.def;Z(n.innerType,t,r);let i=t.seen.get(e);i.ref=n.innerType},kc=(e,t,o,r)=>{let n=e._zod.innerType;Z(n,t,r);let i=t.seen.get(e);i.ref=n},vp={string:sc,number:ic,boolean:ac,bigint:zp,symbol:wp,null:cc,undefined:lc,void:Rp,never:uc,any:dc,unknown:pc,date:xp,enum:hc,literal:mc,nan:Pp,template_literal:Tp,file:Ep,success:kp,custom:fc,function:$p,transform:gc,map:Cp,set:Ip,array:Sc,object:_c,union:yc,intersection:bc,tuple:Op,record:vc,nullable:zc,nonoptional:wc,default:Rc,prefault:xc,catch:Pc,pipe:Tc,readonly:Ec,promise:Np,optional:Ni,lazy:kc};function Mi(e,t){if("_idmap"in e){let r=e,n=Yr({...t,processors:vp}),i={};for(let d of r._idmap.entries()){let[p,m]=d;Z(m,n)}let a={},c={registry:r,uri:t?.uri,defs:i};n.external=c;for(let d of r._idmap.entries()){let[p,m]=d;Qr(n,m),a[p]=Xr(n,m)}if(Object.keys(i).length>0){let d=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[d]:i}}return{schemas:a}}let o=Yr({...t,processors:vp});return Z(e,o),Qr(o,e),Xr(o,e)}var mf=g("ZodISODateTime",(e,t)=>{Wu.init(e,t),F.init(e,t)});function So(e){return np(mf,e)}var ff=g("ZodISODate",(e,t)=>{Ku.init(e,t),F.init(e,t)});function $c(e){return sp(ff,e)}var gf=g("ZodISOTime",(e,t)=>{Yu.init(e,t),F.init(e,t)});function Mp(e){return ip(gf,e)}var Sf=g("ZodISODuration",(e,t)=>{Qu.init(e,t),F.init(e,t)});function Ap(e){return ap(Sf,e)}var _f=(e,t)=>{wi.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:(o)=>Ia(e,o)},flatten:{value:(o)=>Ca(e,o)},addIssue:{value:(o)=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Dr,2)}},addIssues:{value:(o)=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Dr,2)}},isEmpty:{get(){return e.issues.length===0}}})};var me=g("ZodError",_f,{Parent:Error});var jp=Ri(me),Lp=xi(me),qi=Hr(me),Up=Fr(me),Zp=Il(me),Dp=Ol(me),Vp=Nl(me),Hp=Ml(me),Fp=Al(me),Jp=ql(me),Bp=jl(me),Gp=Ll(me);var Wp=new WeakMap;function en(e,t,o){let r=Object.getPrototypeOf(e),n=Wp.get(r);if(!n)n=new Set,Wp.set(r,n);if(n.has(t))return;n.add(t);for(let i in o){let a=o[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){let c=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}var D=g("ZodType",(e,t)=>(U.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Kr(e,"input"),output:Kr(e,"output")}}),e.toJSONSchema=bp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>jp(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>qi(e,o,r),e.parseAsync=async(o,r)=>Lp(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>Up(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>Zp(e,o,r),e.decode=(o,r)=>Dp(e,o,r),e.encodeAsync=async(o,r)=>Vp(e,o,r),e.decodeAsync=async(o,r)=>Hp(e,o,r),e.safeEncode=(o,r)=>Fp(e,o,r),e.safeDecode=(o,r)=>Jp(e,o,r),e.safeEncodeAsync=async(o,r)=>Bp(e,o,r),e.safeDecodeAsync=async(o,r)=>Gp(e,o,r),en(e,"ZodType",{check(...o){let r=this.def;return this.clone(Ye(r,{checks:[...r.checks??[],...o.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,r){return ze(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(ag(o,r))},superRefine(o,r){return this.check(cg(o,r))},overwrite(o){return this.check(tt(o))},optional(){return E(this)},exactOptional(){return Bf(this)},nullable(){return Xp(this)},nullish(){return E(Xp(this))},nonoptional(o){return Xf(this,o)},array(){return h(this)},or(o){return v([this,o])},and(o){return qe(this,o)},transform(o){return eh(this,lh(o))},default(o){return Kf(this,o)},prefault(o){return Qf(this,o)},catch(o){return tg(this,o)},pipe(o){return eh(this,o)},readonly(){return ng(this)},describe(o){let r=this.clone();return et.add(r,{description:o}),r},meta(...o){if(o.length===0)return et.get(this);let r=this.clone();return et.add(r,o[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){return et.get(e)?.description},configurable:!0}),e)),th=g("_ZodString",(e,t)=>{Ei.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>sc(e,r,n,i);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,en(e,"_ZodString",{regex(...r){return this.check(Ga(...r))},includes(...r){return this.check(Ya(...r))},startsWith(...r){return this.check(Qa(...r))},endsWith(...r){return this.check(Xa(...r))},min(...r){return this.check(fo(...r))},max(...r){return this.check(Ii(...r))},length(...r){return this.check(Oi(...r))},nonempty(...r){return this.check(fo(1,...r))},lowercase(r){return this.check(Wa(r))},uppercase(r){return this.check(Ka(r))},trim(){return this.check(tc())},normalize(...r){return this.check(ec(...r))},toLowerCase(){return this.check(oc())},toUpperCase(){return this.check(rc())},slugify(){return this.check(nc())}})}),oh=g("ZodString",(e,t)=>{Ei.init(e,t),th.init(e,t),e.email=(o)=>e.check(Fa(rh,o)),e.url=(o)=>e.check(Ba(sh,o)),e.jwt=(o)=>e.check(rp(Nf,o)),e.emoji=(o)=>e.check(Vd(bf,o)),e.guid=(o)=>e.check(Ja(Kp,o)),e.uuid=(o)=>e.check(Ld(ji,o)),e.uuidv4=(o)=>e.check(Ud(ji,o)),e.uuidv6=(o)=>e.check(Zd(ji,o)),e.uuidv7=(o)=>e.check(Dd(ji,o)),e.nanoid=(o)=>e.check(Hd(vf,o)),e.guid=(o)=>e.check(Ja(Kp,o)),e.cuid=(o)=>e.check(Fd(zf,o)),e.cuid2=(o)=>e.check(Jd(wf,o)),e.ulid=(o)=>e.check(Bd(Rf,o)),e.base64=(o)=>e.check(ep(Cf,o)),e.base64url=(o)=>e.check(tp(If,o)),e.xid=(o)=>e.check(Gd(xf,o)),e.ksuid=(o)=>e.check(Wd(Pf,o)),e.ipv4=(o)=>e.check(Kd(Tf,o)),e.ipv6=(o)=>e.check(Yd(Ef,o)),e.cidrv4=(o)=>e.check(Qd(kf,o)),e.cidrv6=(o)=>e.check(Xd($f,o)),e.e164=(o)=>e.check(op(Of,o)),e.datetime=(o)=>e.check(So(o)),e.date=(o)=>e.check($c(o)),e.time=(o)=>e.check(Mp(o)),e.duration=(o)=>e.check(Ap(o))});function s(e){return jd(oh,e)}var F=g("ZodStringFormat",(e,t)=>{H.init(e,t),th.init(e,t)}),rh=g("ZodEmail",(e,t)=>{Uu.init(e,t),F.init(e,t)});function nh(e){return Fa(rh,e)}var Kp=g("ZodGUID",(e,t)=>{ju.init(e,t),F.init(e,t)});var ji=g("ZodUUID",(e,t)=>{Lu.init(e,t),F.init(e,t)});var sh=g("ZodURL",(e,t)=>{Zu.init(e,t),F.init(e,t)});function Li(e){return Ba(sh,e)}var bf=g("ZodEmoji",(e,t)=>{Du.init(e,t),F.init(e,t)});var vf=g("ZodNanoID",(e,t)=>{Vu.init(e,t),F.init(e,t)});var zf=g("ZodCUID",(e,t)=>{Hu.init(e,t),F.init(e,t)});var wf=g("ZodCUID2",(e,t)=>{Fu.init(e,t),F.init(e,t)});var Rf=g("ZodULID",(e,t)=>{Ju.init(e,t),F.init(e,t)});var xf=g("ZodXID",(e,t)=>{Bu.init(e,t),F.init(e,t)});var Pf=g("ZodKSUID",(e,t)=>{Gu.init(e,t),F.init(e,t)});var Tf=g("ZodIPv4",(e,t)=>{Xu.init(e,t),F.init(e,t)});var Ef=g("ZodIPv6",(e,t)=>{ed.init(e,t),F.init(e,t)});var kf=g("ZodCIDRv4",(e,t)=>{td.init(e,t),F.init(e,t)});var $f=g("ZodCIDRv6",(e,t)=>{od.init(e,t),F.init(e,t)});var Cf=g("ZodBase64",(e,t)=>{nd.init(e,t),F.init(e,t)});var If=g("ZodBase64URL",(e,t)=>{sd.init(e,t),F.init(e,t)});var Of=g("ZodE164",(e,t)=>{id.init(e,t),F.init(e,t)});var Nf=g("ZodJWT",(e,t)=>{ad.init(e,t),F.init(e,t)});var Ui=g("ZodNumber",(e,t)=>{Ua.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>ic(e,r,n,i),en(e,"ZodNumber",{gt(r,n){return this.check($i(r,n))},gte(r,n){return this.check(Wr(r,n))},min(r,n){return this.check(Wr(r,n))},lt(r,n){return this.check(ki(r,n))},lte(r,n){return this.check(Gr(r,n))},max(r,n){return this.check(Gr(r,n))},int(r){return this.check(Yp(r))},safe(r){return this.check(Yp(r))},positive(r){return this.check($i(0,r))},nonnegative(r){return this.check(Wr(0,r))},negative(r){return this.check(ki(0,r))},nonpositive(r){return this.check(Gr(0,r))},multipleOf(r,n){return this.check(Ci(r,n))},step(r,n){return this.check(Ci(r,n))},finite(){return this}});let o=e._zod.bag;e.minValue=Math.max(o.minimum??Number.NEGATIVE_INFINITY,o.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(o.maximum??Number.POSITIVE_INFINITY,o.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(o.format??"").includes("int")||Number.isSafeInteger(o.multipleOf??0.5),e.isFinite=!0,e.format=o.format??null});function _(e){return cp(Ui,e)}var Mf=g("ZodNumberFormat",(e,t)=>{cd.init(e,t),Ui.init(e,t)});function Yp(e){return up(Mf,e)}var ih=g("ZodBoolean",(e,t)=>{ld.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>ac(e,o,r,n)});function z(e){return dp(ih,e)}var Af=g("ZodUndefined",(e,t)=>{ud.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>lc(e,o,r,n)});function Ic(e){return pp(Af,e)}var qf=g("ZodNull",(e,t)=>{dd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>cc(e,o,r,n)});function kt(e){return hp(qf,e)}var jf=g("ZodAny",(e,t)=>{pd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>dc(e,o,r,n)});function Zi(){return mp(jf)}var Lf=g("ZodUnknown",(e,t)=>{hd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>pc(e,o,r,n)});function P(){return fp(Lf)}var Uf=g("ZodNever",(e,t)=>{md.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>uc(e,o,r,n)});function Oc(e){return gp(Uf,e)}var Zf=g("ZodArray",(e,t)=>{fd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Sc(e,o,r,n),e.element=t.element,en(e,"ZodArray",{min(o,r){return this.check(fo(o,r))},nonempty(o){return this.check(fo(1,o))},max(o,r){return this.check(Ii(o,r))},length(o,r){return this.check(Oi(o,r))},unwrap(){return this.element}})});function h(e,t){return Sp(Zf,e,t)}var ah=g("ZodObject",(e,t)=>{_d.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>_c(e,o,r,n),A(e,"shape",()=>t.shape),en(e,"ZodObject",{keyof(){return I(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:P()})},loose(){return this.clone({...this._zod.def,catchall:P()})},strict(){return this.clone({...this._zod.def,catchall:Oc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return Fm(this,o)},safeExtend(o){return Jm(this,o)},merge(o){return Bm(this,o)},pick(o){return Vm(this,o)},omit(o){return Hm(this,o)},partial(...o){return Gm(uh,this,o[0])},required(...o){return Wm(dh,this,o[0])}})});function l(e,t){let o={type:"object",shape:e??{},...T(t)};return new ah(o)}function k(e,t){return new ah({type:"object",shape:e,catchall:P(),...T(t)})}var ch=g("ZodUnion",(e,t)=>{Za.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>yc(e,o,r,n),e.options=t.options});function v(e,t){return new ch({type:"union",options:e,...T(t)})}var Df=g("ZodDiscriminatedUnion",(e,t)=>{ch.init(e,t),yd.init(e,t)});function _o(e,t,o){return new Df({type:"union",options:t,discriminator:e,...T(o)})}var Vf=g("ZodIntersection",(e,t)=>{bd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>bc(e,o,r,n)});function qe(e,t){return new Vf({type:"intersection",left:e,right:t})}var Qp=g("ZodRecord",(e,t)=>{vd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>vc(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function b(e,t,o){if(!t||!t._zod)return new Qp({type:"record",keyType:s(),valueType:e,...T(t)});return new Qp({type:"record",keyType:e,valueType:t,...T(o)})}var Cc=g("ZodEnum",(e,t)=>{zd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(r,n,i)=>hc(e,r,n,i),e.enum=t.entries,e.options=Object.values(t.entries);let o=new Set(Object.keys(t.entries));e.extract=(r,n)=>{let i={};for(let a of r)if(o.has(a))i[a]=t.entries[a];else throw Error(`Key ${a} not found in enum`);return new Cc({...t,checks:[],...T(n),entries:i})},e.exclude=(r,n)=>{let i={...t.entries};for(let a of r)if(o.has(a))delete i[a];else throw Error(`Key ${a} not found in enum`);return new Cc({...t,checks:[],...T(n),entries:i})}});function I(e,t){let o=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new Cc({type:"enum",entries:o,...T(t)})}var Hf=g("ZodLiteral",(e,t)=>{wd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>mc(e,o,r,n),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function u(e,t){return new Hf({type:"literal",values:Array.isArray(e)?e:[e],...T(t)})}var Ff=g("ZodTransform",(e,t)=>{Rd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>gc(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Zr(e.constructor.name);o.addIssue=(i)=>{if(typeof i==="string")o.issues.push(Et(i,o.value,t));else{let a=i;if(a.fatal)a.continue=!1;a.code??(a.code="custom"),a.input??(a.input=o.value),a.inst??(a.inst=e),o.issues.push(Et(a))}};let n=t.transform(o.value,o);if(n instanceof Promise)return n.then((i)=>(o.value=i,o.fallback=!0,o));return o.value=n,o.fallback=!0,o}});function lh(e){return new Ff({type:"transform",transform:e})}var uh=g("ZodOptional",(e,t)=>{Da.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ni(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function E(e){return new uh({type:"optional",innerType:e})}var Jf=g("ZodExactOptional",(e,t)=>{xd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ni(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Bf(e){return new Jf({type:"optional",innerType:e})}var Gf=g("ZodNullable",(e,t)=>{Pd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>zc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Xp(e){return new Gf({type:"nullable",innerType:e})}var Wf=g("ZodDefault",(e,t)=>{Td.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Rc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Kf(e,t){return new Wf({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Ea(t)}})}var Yf=g("ZodPrefault",(e,t)=>{Ed.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>xc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Qf(e,t){return new Yf({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Ea(t)}})}var dh=g("ZodNonOptional",(e,t)=>{kd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>wc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Xf(e,t){return new dh({type:"nonoptional",innerType:e,...T(t)})}var eg=g("ZodCatch",(e,t)=>{$d.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Pc(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function tg(e,t){return new eg({type:"catch",innerType:e,catchValue:typeof t==="function"?t:()=>t})}var ph=g("ZodPipe",(e,t)=>{Va.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Tc(e,o,r,n),e.in=t.in,e.out=t.out});function eh(e,t){return new ph({type:"pipe",in:e,out:t})}var og=g("ZodPreprocess",(e,t)=>{ph.init(e,t),Cd.init(e,t)}),rg=g("ZodReadonly",(e,t)=>{Id.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ec(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function ng(e){return new rg({type:"readonly",innerType:e})}var sg=g("ZodLazy",(e,t)=>{Od.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>kc(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function tn(e){return new sg({type:"lazy",getter:e})}var ig=g("ZodCustom",(e,t)=>{Nd.init(e,t),D.init(e,t),e._zod.processJSONSchema=(o,r,n)=>fc(e,o,r,n)});function ag(e,t={}){return _p(ig,e,t)}function cg(e,t){return yp(e,t)}function $t(e,t){return new og({type:"pipe",in:lh(e),out:t})}var mh={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"};var hh;(function(e){})(hh||(hh={}));function lg(e){return lp(Ui,e)}le(Ha());var Di="2025-11-25";var Vi=[Di,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Hi="io.modelcontextprotocol/related-task",Ct="io.modelcontextprotocol/protocolVersion",yo="io.modelcontextprotocol/clientInfo",rt="io.modelcontextprotocol/serverInfo",It="io.modelcontextprotocol/clientCapabilities",Fi="io.modelcontextprotocol/subscriptionId",bo="io.modelcontextprotocol/logLevel";var Ot="2.0";var je=tn(()=>v([s(),_(),z(),kt(),b(s(),je),h(je)])),J=b(s(),je),Ji=h(je),vo=v([s(),_().int()]),zo=s(),on=l({ttl:_().optional()}),rn=l({taskId:s()}),wo=k({progressToken:vo.optional(),[Hi]:rn.optional()}),X=l({_meta:wo.optional()}),nt=X.extend({task:on.optional()}),B=l({method:s(),params:X.loose().optional()}),ie=l({_meta:wo.optional()}),te=l({method:s(),params:ie.loose().optional()}),Ro=k({get[rt](){return ke.optional().catch(void 0)}}),G=k({_meta:Ro.optional()}),Re=v([s(),_().int()]),xo=l({jsonrpc:u(Ot),id:Re,...B.shape}).strict(),Po=l({jsonrpc:u(Ot),...te.shape}).strict(),Nt=l({jsonrpc:u(Ot),id:Re,result:G}).strict(),Mt=l({jsonrpc:u(Ot),id:Re.optional(),error:l({code:_().int(),message:s(),data:P().optional()})}).strict(),At=v([xo,Po,Nt,Mt]),Bi=v([Nt,Mt]),st=G.strict(),nn=ie.extend({requestId:Re.optional(),reason:s().optional()}),To=te.extend({method:u("notifications/cancelled"),params:nn}),sn=l({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:I(["light","dark"]).optional()}),Le=l({icons:h(sn).optional()}),Ee=l({name:s(),title:s().optional()}),ke=Ee.extend({...Ee.shape,...Le.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),dg=qe(l({applyDefaults:z().optional()}),J),pg=$t((e)=>{if(e&&typeof e==="object"&&!Array.isArray(e)&&Object.keys(e).length===0)return{form:{}};return e},qe(l({form:dg.optional(),url:J.optional()}),J.optional())),Gi=k({list:J.optional(),cancel:J.optional(),requests:k({sampling:k({createMessage:J.optional()}).optional(),elicitation:k({create:J.optional()}).optional()}).optional()}),Wi=k({list:J.optional(),cancel:J.optional(),requests:k({tools:k({call:J.optional()}).optional()}).optional()}),an=l({experimental:b(s(),J).optional(),sampling:l({context:J.optional(),tools:J.optional()}).optional(),elicitation:pg.optional(),roots:l({listChanged:z().optional()}).optional(),tasks:Gi.optional(),extensions:b(s(),J).optional()}),cn=X.extend({protocolVersion:s(),capabilities:an,clientInfo:ke}),ln=B.extend({method:u("initialize"),params:cn}),Eo=l({experimental:b(s(),J).optional(),logging:J.optional(),completions:J.optional(),prompts:l({listChanged:z().optional()}).optional(),resources:l({subscribe:z().optional(),listChanged:z().optional()}).optional(),tools:l({listChanged:z().optional()}).optional(),tasks:Wi.optional(),extensions:b(s(),J).optional()}),un=G.extend({protocolVersion:s(),capabilities:Eo,serverInfo:ke,instructions:s().optional()}),dn=te.extend({method:u("notifications/initialized"),params:ie.optional()}),pn=B.extend({method:u("server/discover"),params:X.optional()}),ko=G.extend({supportedVersions:h(s()),capabilities:Eo,instructions:s().optional()}),$o=B.extend({method:u("ping"),params:X.optional()}),hn=l({progress:_(),total:E(_()),message:E(s())}),mn=l({...ie.shape,...hn.shape,progressToken:vo}),Co=te.extend({method:u("notifications/progress"),params:mn}),fn=X.extend({cursor:zo.optional()}),Ue=B.extend({params:fn.optional()}),Ze=G.extend({nextCursor:zo.optional()}),Io=l({uri:s(),mimeType:E(s()),_meta:b(s(),P()).optional()}),Oo=Io.extend({text:s()}),Ac=s().refine((e)=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),No=Io.extend({blob:Ac}),De=I(["user","assistant"]),$e=l({audience:h(De).optional(),priority:_().min(0).max(1).optional(),lastModified:So({offset:!0}).optional()}),Mo=l({...Ee.shape,...Le.shape,uri:s(),description:E(s()),mimeType:E(s()),size:E(_()),annotations:$e.optional(),_meta:E(k({}))}),gn=l({...Ee.shape,...Le.shape,uriTemplate:s(),description:E(s()),mimeType:E(s()),annotations:$e.optional(),_meta:E(k({}))}),Sn=Ue.extend({method:u("resources/list")}),_n=Ze.extend({resources:h(Mo)}),yn=Ue.extend({method:u("resources/templates/list")}),bn=Ze.extend({resourceTemplates:h(gn)}),qt=X.extend({uri:s()}),vn=qt,zn=B.extend({method:u("resources/read"),params:vn}),wn=G.extend({contents:h(v([Oo,No]))}),Rn=te.extend({method:u("notifications/resources/list_changed"),params:ie.optional()}),xn=qt,Pn=B.extend({method:u("resources/subscribe"),params:xn}),Tn=qt,En=B.extend({method:u("resources/unsubscribe"),params:Tn}),Ao=l({toolsListChanged:z().optional(),promptsListChanged:z().optional(),resourcesListChanged:z().optional(),resourceSubscriptions:h(s()).optional()}),kn=X.extend({notifications:Ao}),$n=B.extend({method:u("subscriptions/listen"),params:kn}),Cn=ie.extend({notifications:Ao}),In=te.extend({method:u("notifications/subscriptions/acknowledged"),params:Cn}),On=Ro.extend({[Fi]:Re}),Nn=G.extend({_meta:On}),Mn=ie.extend({uri:s()}),An=te.extend({method:u("notifications/resources/updated"),params:Mn}),qn=l({name:s(),description:E(s()),required:E(z())}),jn=l({...Ee.shape,...Le.shape,description:E(s()),arguments:E(h(qn)),_meta:E(k({}))}),Ln=Ue.extend({method:u("prompts/list")}),Un=Ze.extend({prompts:h(jn)}),Zn=X.extend({name:s(),arguments:b(s(),s()).optional()}),Dn=B.extend({method:u("prompts/get"),params:Zn}),jt=l({type:u("text"),text:s(),annotations:$e.optional(),_meta:b(s(),P()).optional()}),Lt=l({type:u("image"),data:Ac,mimeType:s(),annotations:$e.optional(),_meta:b(s(),P()).optional()}),Ut=l({type:u("audio"),data:Ac,mimeType:s(),annotations:$e.optional(),_meta:b(s(),P()).optional()}),Vn=l({type:u("tool_use"),name:s(),id:s(),input:b(s(),P()),_meta:b(s(),P()).optional()}),Zt=l({type:u("resource"),resource:v([Oo,No]),annotations:$e.optional(),_meta:b(s(),P()).optional()}),Dt=Mo.extend({type:u("resource_link")}),Ce=v([jt,Lt,Ut,Dt,Zt]),Hn=l({role:De,content:Ce}),Fn=G.extend({description:s().optional(),messages:h(Hn)}),Jn=te.extend({method:u("notifications/prompts/list_changed"),params:ie.optional()}),Bn=l({title:s().optional(),readOnlyHint:z().optional(),destructiveHint:z().optional(),idempotentHint:z().optional(),openWorldHint:z().optional()}),Gn=l({taskSupport:I(["required","optional","forbidden"]).optional()}),it=l({...Ee.shape,...Le.shape,description:s().optional(),inputSchema:l({type:u("object"),properties:b(s(),je).optional(),required:h(s()).optional()}).catchall(P()),outputSchema:k({$schema:s().optional()}).optional(),annotations:Bn.optional(),execution:Gn.optional(),_meta:b(s(),P()).optional()}),Wn=Ue.extend({method:u("tools/list")}),Kn=Ze.extend({tools:h(it)}),at=G.extend({content:h(Ce).default([]),structuredContent:P().optional(),isError:z().optional()}),Ki=at.or(G.extend({toolResult:P()})),Yn=nt.extend({name:s(),arguments:b(s(),P()).optional()}),Qn=B.extend({method:u("tools/call"),params:Yn}),Xn=te.extend({method:u("notifications/tools/list_changed"),params:ie.optional()}),Yi=l({autoRefresh:z().default(!0),debounceMs:_().int().nonnegative().default(300)}),qo=I(["debug","info","notice","warning","error","critical","alert","emergency"]),es=X.extend({level:qo}),ts=B.extend({method:u("logging/setLevel"),params:es}),os=ie.extend({level:qo,logger:s().optional(),data:P()}),rs=te.extend({method:u("notifications/message"),params:os}),ns=l({name:s().optional()}),ss=l({hints:h(ns).optional(),costPriority:_().min(0).max(1).optional(),speedPriority:_().min(0).max(1).optional(),intelligencePriority:_().min(0).max(1).optional()}),is=l({mode:I(["auto","required","none"]).optional()}),as=l({type:u("tool_result"),toolUseId:s().describe("The unique identifier for the corresponding tool call."),content:h(Ce),structuredContent:P().optional(),isError:z().optional(),_meta:b(s(),P()).optional()}),cs=_o("type",[jt,Lt,Ut]),ot=_o("type",[jt,Lt,Ut,Vn,as]),ls=l({role:De,content:v([ot,h(ot)]),_meta:b(s(),P()).optional()}),us=nt.extend({messages:h(ls),modelPreferences:ss.optional(),systemPrompt:s().optional(),includeContext:I(["none","thisServer","allServers"]).optional(),temperature:_().optional(),maxTokens:_().int(),stopSequences:h(s()).optional(),metadata:J.optional(),tools:h(it).optional(),toolChoice:is.optional()}),ds=B.extend({method:u("sampling/createMessage"),params:us}),ps=G.extend({model:s(),stopReason:E(I(["endTurn","stopSequence","maxTokens"]).or(s())),role:De,content:cs}),hs=G.extend({model:s(),stopReason:E(I(["endTurn","stopSequence","maxTokens","toolUse"]).or(s())),role:De,content:v([ot,h(ot)])}),jo=l({type:u("boolean"),title:s().optional(),description:s().optional(),default:z().optional()}),Vt=l({type:u("string"),title:s().optional(),description:s().optional(),minLength:_().optional(),maxLength:_().optional(),format:I(["email","uri","date","date-time"]).optional(),default:s().optional()}),Ht=l({type:I(["number","integer"]),title:s().optional(),description:s().optional(),minimum:_().optional(),maximum:_().optional(),default:_().optional()}),Lo=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),Uo=l({type:u("string"),title:s().optional(),description:s().optional(),oneOf:h(l({const:s(),title:s()})),default:s().optional()}),Zo=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),ms=v([Lo,Uo]),Do=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:_().optional(),maxItems:_().optional(),items:l({type:u("string"),enum:h(s())}),default:h(s()).optional()}),Vo=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:_().optional(),maxItems:_().optional(),items:l({anyOf:h(l({const:s(),title:s()}))}),default:h(s()).optional()}),fs=v([Do,Vo]),gs=v([Zo,ms,fs]),Ho=v([gs,jo,Vt,Ht]),Ft=nt.extend({mode:u("form").optional(),message:s(),requestedSchema:l({type:u("object"),properties:b(s(),Ho),required:h(s()).optional()}).catchall(P())}),Ss=nt.extend({mode:u("url"),message:s(),elicitationId:s(),url:s().url()}),_s=v([Ft,Ss]),ys=B.extend({method:u("elicitation/create"),params:_s}),bs=ie.extend({elicitationId:s()}),vs=te.extend({method:u("notifications/elicitation/complete"),params:bs}),zs=G.extend({action:I(["accept","decline","cancel"]),content:$t((e)=>e===null?void 0:e,b(s(),v([s(),_(),z(),h(s())])).optional())}),ws=l({type:u("ref/resource"),uri:s()}),Rs=l({type:u("ref/prompt"),name:s()}),xs=X.extend({ref:v([Rs,ws]),argument:l({name:s(),value:s()}),context:l({arguments:b(s(),s()).optional()}).optional()}),Ps=B.extend({method:u("completion/complete"),params:xs}),Ts=G.extend({completion:k({values:h(s()).max(100),total:E(_().int()),hasMore:E(z())})}),Es=l({uri:s().startsWith("file://"),name:s().optional(),_meta:b(s(),P()).optional()}),ks=B.extend({method:u("roots/list"),params:X.optional()}),$s=G.extend({roots:h(Es)}),Cs=te.extend({method:u("notifications/roots/list_changed"),params:ie.optional()}),Qi=k({ttl:_().optional(),pollInterval:_().optional()}),Is=I(["working","input_required","completed","failed","cancelled"]),Ve=l({taskId:s(),status:Is,ttl:v([_(),kt()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:E(_()),statusMessage:E(s())}),Xi=G.extend({task:Ve}),Os=ie.merge(Ve),ea=te.extend({method:u("notifications/tasks/status"),params:Os}),ta=B.extend({method:u("tasks/get"),params:X.extend({taskId:s()})}),oa=G.merge(Ve),ra=B.extend({method:u("tasks/result"),params:X.extend({taskId:s()})}),na=G.loose(),sa=Ue.extend({method:u("tasks/list")}),ia=Ze.extend({tasks:h(Ve)}),aa=B.extend({method:u("tasks/cancel"),params:X.extend({taskId:s()})}),ca=G.merge(Ve),la=v([$o,ln,pn,Ps,ts,Dn,Ln,Sn,yn,zn,Pn,En,$n,Qn,Wn]),ua=v([To,Co,dn,Cs]),da=v([st,ps,hs,zs,$s]),pa=v([$o,ds,ys,ks]),ha=v([To,Co,rs,An,Rn,Xn,Jn,In,vs]),ma=v([st,un,ko,Ts,Fn,Un,_n,bn,wn,at,Kn,Nn]),Q=Li().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:mh.custom,message:"URL must be parseable",fatal:!0}),wa}).refine((e)=>{let t=new URL(e);return t.protocol!=="javascript:"&&t.protocol!=="data:"&&t.protocol!=="vbscript:"},{message:"URL cannot use javascript:, data:, or vbscript: scheme"}),Ns=k({resource:s().url(),authorization_servers:h(Q).optional(),jwks_uri:s().url().optional(),scopes_supported:h(s()).optional(),bearer_methods_supported:h(s()).optional(),resource_signing_alg_values_supported:h(s()).optional(),resource_name:s().optional(),resource_documentation:s().optional(),resource_policy_uri:s().url().optional(),resource_tos_uri:s().url().optional(),tls_client_certificate_bound_access_tokens:z().optional(),authorization_details_types_supported:h(s()).optional(),dpop_signing_alg_values_supported:h(s()).optional(),dpop_bound_access_tokens_required:z().optional()}),Fo=k({issuer:s(),authorization_endpoint:Q,token_endpoint:Q,registration_endpoint:Q.optional(),scopes_supported:h(s()).optional(),response_types_supported:h(s()),response_modes_supported:h(s()).optional(),grant_types_supported:h(s()).optional(),token_endpoint_auth_methods_supported:h(s()).optional(),token_endpoint_auth_signing_alg_values_supported:h(s()).optional(),service_documentation:Q.optional(),revocation_endpoint:Q.optional(),revocation_endpoint_auth_methods_supported:h(s()).optional(),revocation_endpoint_auth_signing_alg_values_supported:h(s()).optional(),introspection_endpoint:s().optional(),introspection_endpoint_auth_methods_supported:h(s()).optional(),introspection_endpoint_auth_signing_alg_values_supported:h(s()).optional(),code_challenge_methods_supported:h(s()).optional(),client_id_metadata_document_supported:z().optional(),authorization_response_iss_parameter_supported:z().optional().catch(void 0),dpop_signing_alg_values_supported:h(s()).optional()}),Ms=k({issuer:s(),authorization_endpoint:Q,token_endpoint:Q,userinfo_endpoint:Q.optional(),jwks_uri:Q,registration_endpoint:Q.optional(),scopes_supported:h(s()).optional(),response_types_supported:h(s()),response_modes_supported:h(s()).optional(),grant_types_supported:h(s()).optional(),acr_values_supported:h(s()).optional(),subject_types_supported:h(s()),id_token_signing_alg_values_supported:h(s()),id_token_encryption_alg_values_supported:h(s()).optional(),id_token_encryption_enc_values_supported:h(s()).optional(),userinfo_signing_alg_values_supported:h(s()).optional(),userinfo_encryption_alg_values_supported:h(s()).optional(),userinfo_encryption_enc_values_supported:h(s()).optional(),request_object_signing_alg_values_supported:h(s()).optional(),request_object_encryption_alg_values_supported:h(s()).optional(),request_object_encryption_enc_values_supported:h(s()).optional(),token_endpoint_auth_methods_supported:h(s()).optional(),token_endpoint_auth_signing_alg_values_supported:h(s()).optional(),display_values_supported:h(s()).optional(),claim_types_supported:h(s()).optional(),claims_supported:h(s()).optional(),service_documentation:s().optional(),claims_locales_supported:h(s()).optional(),ui_locales_supported:h(s()).optional(),claims_parameter_supported:z().optional(),request_parameter_supported:z().optional(),request_uri_parameter_supported:z().optional(),require_request_uri_registration:z().optional(),op_policy_uri:Q.optional(),op_tos_uri:Q.optional(),client_id_metadata_document_supported:z().optional(),authorization_response_iss_parameter_supported:z().optional().catch(void 0)}),As=l({...Ms.shape,...Fo.pick({code_challenge_methods_supported:!0}).shape}),qs=l({access_token:s(),id_token:s().optional(),token_type:s(),expires_in:lg().optional(),scope:s().optional(),refresh_token:s().optional(),issuer:s().optional().catch(void 0)}).strip(),js=l({issued_token_type:u("urn:ietf:params:oauth:token-type:id-jag"),access_token:s(),token_type:s().optional(),expires_in:_().optional(),scope:s().optional()}).strip(),Ls=l({error:s(),error_description:s().optional(),error_uri:s().optional()}),Mc=Q.optional().or(u("").transform(()=>{return})),Us=l({redirect_uris:h(Q),token_endpoint_auth_method:s().optional(),grant_types:h(s()).optional(),response_types:h(s()).optional(),application_type:s().optional(),client_name:s().optional(),client_uri:Q.optional(),logo_uri:Mc,scope:s().optional(),contacts:h(s()).optional(),tos_uri:Mc,policy_uri:s().optional(),jwks_uri:Q.optional(),jwks:Zi().optional(),software_id:s().optional(),software_version:s().optional(),software_statement:s().optional()}).strip(),Zs=l({client_id:s(),client_secret:s().optional(),client_id_issued_at:_().optional(),client_secret_expires_at:_().optional(),issuer:s().optional().catch(void 0)}).strip(),Ds=Us.merge(Zs),fa=l({error:s(),error_description:s().optional()}).strip(),ga=l({token:s(),token_type_hint:s().optional()}).strip();var Dc=Symbol.for("mcp.sdk.errorBrands");function Jt(e,t){let o=new Set,r=t;while(typeof r==="function"){let n=r.mcpBrand;if(Object.prototype.hasOwnProperty.call(r,"mcpBrand")&&typeof n==="string")o.add(n);r=Object.getPrototypeOf(r)}if(o.size===0)return;Object.defineProperty(e,Dc,{value:o,enumerable:!1,configurable:!0})}function fe(e,t){try{if(typeof t==="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand==="string"&&Object.prototype.hasOwnProperty.call(t,Dc)){let o=t[Dc];if(o&&typeof o.has==="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var hg=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return fe(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fe(this,t)}constructor(t,o,r){super(o);this.code=t,this.errorUri=r,this.name="OAuthError",Jt(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};if(this.errorUri)t.error_uri=this.errorUri;return t}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}},oe=function(e){return e.NotConnected="NOT_CONNECTED",e.AlreadyConnected="ALREADY_CONNECTED",e.NotInitialized="NOT_INITIALIZED",e.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",e.RequestTimeout="REQUEST_TIMEOUT",e.ConnectionClosed="CONNECTION_CLOSED",e.SendFailed="SEND_FAILED",e.InvalidResult="INVALID_RESULT",e.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",e.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",e.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",e.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",e.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",e.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",e.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",e.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",e.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",e.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",e.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",e}({}),K=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return fe(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fe(this,e)}constructor(e,t,o,r){super(t,r);this.code=e,this.data=o,this.name="SdkError",Jt(this,new.target)}},mg=class extends K{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,o,r){super(e,t,o,r);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};var fg="2026-07-28";function Ah(e){return e>=fg}function qh(e){let t=e.structuredContent;if(t===void 0)return e;if(!(typeof t!=="object"||t===null||Array.isArray(t)))return e;if(e.content?.some((o)=>o.type==="text")??!1)return e;return{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var jh=["task","inputRequests","requestState"];function gg(e){if(e===null||typeof e!=="object"||Array.isArray(e)||e.content!==void 0||jh.some((t)=>(t in e)))return e;return{...e,content:[]}}function Sg(){let e=tn(()=>v([s(),_(),z(),kt(),b(s(),e),h(e)])),t=b(s(),e),o=v([s(),_().int()]),r=s(),n=l({ttl:_().optional()}),i=l({taskId:s()}),a=k({progressToken:o.optional(),"io.modelcontextprotocol/related-task":i.optional()}),c=l({_meta:a.optional()}),d=c.extend({task:n.optional()}),p=l({method:s(),params:c.loose().optional()}),m=l({_meta:a.optional()}),f=l({method:s(),params:m.loose().optional()}),y=k({_meta:a.optional()}),S=v([s(),_().int()]),w=y.strict(),x=m.extend({requestId:S.optional(),reason:s().optional()}),R=f.extend({method:u("notifications/cancelled"),params:x}),C=l({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:I(["light","dark"]).optional()}),N=l({icons:h(C).optional()}),O=l({name:s(),title:s().optional()}),q=O.extend({...O.shape,...N.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),L=qe(l({applyDefaults:z().optional()}),t),j=$t((se)=>{if(se&&typeof se==="object"&&!Array.isArray(se)&&Object.keys(se).length===0)return{form:{}};return se},qe(l({form:L.optional(),url:t.optional()}),t.optional())),V=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),ae=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),Y=l({experimental:b(s(),t).optional(),sampling:l({context:t.optional(),tools:t.optional()}).optional(),elicitation:j.optional(),roots:l({listChanged:z().optional()}).optional(),tasks:V.optional(),extensions:b(s(),t).optional()}),ge=c.extend({protocolVersion:s(),capabilities:Y,clientInfo:q}),dt=p.extend({method:u("initialize"),params:ge}),Jo=l({experimental:b(s(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:l({listChanged:z().optional()}).optional(),resources:l({subscribe:z().optional(),listChanged:z().optional()}).optional(),tools:l({listChanged:z().optional()}).optional(),tasks:ae.optional(),extensions:b(s(),t).optional()}),Bo=y.extend({protocolVersion:s(),capabilities:Jo,serverInfo:q,instructions:s().optional()}),Wt=f.extend({method:u("notifications/initialized"),params:m.optional()}),Fe=p.extend({method:u("ping"),params:c.optional()}),pt=l({progress:_(),total:E(_()),message:E(s())}),xe=l({...m.shape,...pt.shape,progressToken:o}),Je=f.extend({method:u("notifications/progress"),params:xe}),Kt=c.extend({cursor:r.optional()}),Ne=p.extend({params:Kt.optional()}),Me=y.extend({nextCursor:r.optional()}),Yt=l({uri:s(),mimeType:E(s()),_meta:b(s(),P()).optional()}),Qt=Yt.extend({text:s()}),ht=s().refine((se)=>{try{return atob(se),!0}catch{return!1}},{message:"Invalid Base64 string"}),Xt=Yt.extend({blob:ht}),Pe=I(["user","assistant"]),be=l({audience:h(Pe).optional(),priority:_().min(0).max(1).optional(),lastModified:So({offset:!0}).optional()}),mt=l({...O.shape,...N.shape,uri:s(),description:E(s()),mimeType:E(s()),size:E(_()),annotations:be.optional(),_meta:E(k({}))}),Go=l({...O.shape,...N.shape,uriTemplate:s(),description:E(s()),mimeType:E(s()),annotations:be.optional(),_meta:E(k({}))}),Wo=Ne.extend({method:u("resources/list")}),Ko=Me.extend({resources:h(mt)}),Be=Ne.extend({method:u("resources/templates/list")}),eo=Me.extend({resourceTemplates:h(Go)}),ft=c.extend({uri:s()}),Yo=ft,Qo=p.extend({method:u("resources/read"),params:Yo}),Xo=y.extend({contents:h(v([Qt,Xt]))}),er=f.extend({method:u("notifications/resources/list_changed"),params:m.optional()}),tr=ft,or=p.extend({method:u("resources/subscribe"),params:tr}),rr=ft,nr=p.extend({method:u("resources/unsubscribe"),params:rr}),sr=m.extend({uri:s()}),ir=f.extend({method:u("notifications/resources/updated"),params:sr}),ar=l({name:s(),description:E(s()),required:E(z())}),cr=l({...O.shape,...N.shape,description:E(s()),arguments:E(h(ar)),_meta:E(k({}))}),lr=Ne.extend({method:u("prompts/list")}),ur=Me.extend({prompts:h(cr)}),dr=c.extend({name:s(),arguments:b(s(),s()).optional()}),pr=p.extend({method:u("prompts/get"),params:dr}),gt=l({type:u("text"),text:s(),annotations:be.optional(),_meta:b(s(),P()).optional()}),St=l({type:u("image"),data:ht,mimeType:s(),annotations:be.optional(),_meta:b(s(),P()).optional()}),_t=l({type:u("audio"),data:ht,mimeType:s(),annotations:be.optional(),_meta:b(s(),P()).optional()}),hr=l({type:u("tool_use"),name:s(),id:s(),input:b(s(),P()),_meta:b(s(),P()).optional()}),Ge=l({type:u("resource"),resource:v([Qt,Xt]),annotations:be.optional(),_meta:b(s(),P()).optional()}),mr=mt.extend({type:u("resource_link")}),Se=v([gt,St,_t,mr,Ge]),to=l({role:Pe,content:Se}),oo=y.extend({description:s().optional(),messages:h(to)}),yt=f.extend({method:u("notifications/prompts/list_changed"),params:m.optional()}),fr=l({title:s().optional(),readOnlyHint:z().optional(),destructiveHint:z().optional(),idempotentHint:z().optional(),openWorldHint:z().optional()}),ro=l({taskSupport:I(["required","optional","forbidden"]).optional()}),bt=l({...O.shape,...N.shape,description:s().optional(),inputSchema:l({type:u("object"),properties:b(s(),e).optional(),required:h(s()).optional()}).catchall(P()),outputSchema:l({type:u("object"),properties:b(s(),e).optional(),required:h(s()).optional()}).catchall(P()).optional(),annotations:fr.optional(),execution:ro.optional(),_meta:b(s(),P()).optional()}),no=Ne.extend({method:u("tools/list")}),so=Me.extend({tools:h(bt)}),io=y.extend({content:h(Se),structuredContent:b(s(),P()).optional(),isError:z().optional()}),ne=d.extend({name:s(),arguments:b(s(),P()).optional()}),gr=p.extend({method:u("tools/call"),params:ne}),ti=f.extend({method:u("notifications/tools/list_changed"),params:m.optional()}),ao=I(["debug","info","notice","warning","error","critical","alert","emergency"]),Sr=c.extend({level:ao}),_r=p.extend({method:u("logging/setLevel"),params:Sr}),yr=m.extend({level:ao,logger:s().optional(),data:P()}),br=f.extend({method:u("notifications/message"),params:yr}),vr=l({name:s().optional()}),zr=l({hints:h(vr).optional(),costPriority:_().min(0).max(1).optional(),speedPriority:_().min(0).max(1).optional(),intelligencePriority:_().min(0).max(1).optional()}),wr=l({mode:I(["auto","required","none"]).optional()}),oi=l({type:u("tool_result"),toolUseId:s().describe("The unique identifier for the corresponding tool call."),content:h(Se),structuredContent:l({}).loose().optional(),isError:z().optional(),_meta:b(s(),P()).optional()}),Rr=_o("type",[gt,St,_t]),We=_o("type",[gt,St,_t,hr,oi]),xr=l({role:Pe,content:v([We,h(We)]),_meta:b(s(),P()).optional()}),Pr=d.extend({messages:h(xr),modelPreferences:zr.optional(),systemPrompt:s().optional(),includeContext:I(["none","thisServer","allServers"]).optional(),temperature:_().optional(),maxTokens:_().int(),stopSequences:h(s()).optional(),metadata:t.optional(),tools:h(bt).optional(),toolChoice:wr.optional()}),Tr=p.extend({method:u("sampling/createMessage"),params:Pr}),Er=y.extend({model:s(),stopReason:E(I(["endTurn","stopSequence","maxTokens"]).or(s())),role:Pe,content:Rr}),kr=y.extend({model:s(),stopReason:E(I(["endTurn","stopSequence","maxTokens","toolUse"]).or(s())),role:Pe,content:v([We,h(We)])}),$r=l({type:u("boolean"),title:s().optional(),description:s().optional(),default:z().optional()}),Cr=l({type:u("string"),title:s().optional(),description:s().optional(),minLength:_().optional(),maxLength:_().optional(),format:I(["email","uri","date","date-time"]).optional(),default:s().optional()}),Ir=l({type:I(["number","integer"]),title:s().optional(),description:s().optional(),minimum:_().optional(),maximum:_().optional(),default:_().optional()}),Or=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),Nr=l({type:u("string"),title:s().optional(),description:s().optional(),oneOf:h(l({const:s(),title:s()})),default:s().optional()}),Mr=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),Ar=v([Or,Nr]),vt=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:_().optional(),maxItems:_().optional(),items:l({type:u("string"),enum:h(s())}),default:h(s()).optional()}),zt=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:_().optional(),maxItems:_().optional(),items:l({anyOf:h(l({const:s(),title:s()}))}),default:h(s()).optional()}),ri=v([vt,zt]),ni=v([Mr,Ar,ri]),pe=v([ni,$r,Cr,Ir]),he=d.extend({mode:u("form").optional(),message:s(),requestedSchema:l({type:u("object"),properties:b(s(),pe),required:h(s()).optional()}).catchall(P())}),qr=d.extend({mode:u("url"),message:s(),elicitationId:s(),url:s().url()}),ve=v([he,qr]),si=p.extend({method:u("elicitation/create"),params:ve}),ii=m.extend({elicitationId:s()}),ai=f.extend({method:u("notifications/elicitation/complete"),params:ii}),ci=y.extend({action:I(["accept","decline","cancel"]),content:$t((se)=>se===null?void 0:se,b(s(),v([s(),_(),z(),h(s())])).optional())}),li=l({type:u("ref/resource"),uri:s()}),ui=l({type:u("ref/prompt"),name:s()}),di=c.extend({ref:v([ui,li]),argument:l({name:s(),value:s()}),context:l({arguments:b(s(),s()).optional()}).optional()}),jr=p.extend({method:u("completion/complete"),params:di}),pi=y.extend({completion:k({values:h(s()).max(100),total:E(_().int()),hasMore:E(z())})}),hi=l({uri:s().startsWith("file://"),name:s().optional(),_meta:b(s(),P()).optional()}),co=p.extend({method:u("roots/list"),params:c.optional()}),Lr=y.extend({roots:h(hi)}),mi=f.extend({method:u("notifications/roots/list_changed"),params:m.optional()}),fi=k({ttl:_().optional(),pollInterval:_().optional()}),Ur=I(["working","input_required","completed","failed","cancelled"]),Ke=l({taskId:s(),status:Ur,ttl:v([_(),kt()]),createdAt:s(),lastUpdatedAt:s(),pollInterval:E(_()),statusMessage:E(s())}),de=y.extend({task:Ke}),gi=m.merge(Ke),wt=f.extend({method:u("notifications/tasks/status"),params:gi}),lo=p.extend({method:u("tasks/get"),params:c.extend({taskId:s()})}),uo=y.merge(Ke),po=p.extend({method:u("tasks/result"),params:c.extend({taskId:s()})}),za=y.loose(),ce=Ne.extend({method:u("tasks/list")}),W=Me.extend({tasks:h(Ke)}),Rt=p.extend({method:u("tasks/cancel"),params:c.extend({taskId:s()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:i,RequestMetaSchema:a,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:d,RequestSchema:p,NotificationsParamsSchema:m,NotificationSchema:f,ResultSchema:y,RequestIdSchema:S,EmptyResultSchema:w,CancelledNotificationParamsSchema:x,CancelledNotificationSchema:R,IconSchema:C,IconsSchema:N,BaseMetadataSchema:O,ImplementationSchema:q,ClientTasksCapabilitySchema:V,ServerTasksCapabilitySchema:ae,ClientCapabilitiesSchema:Y,InitializeRequestParamsSchema:ge,InitializeRequestSchema:dt,ServerCapabilitiesSchema:Jo,InitializeResultSchema:Bo,InitializedNotificationSchema:Wt,PingRequestSchema:Fe,ProgressSchema:pt,ProgressNotificationParamsSchema:xe,ProgressNotificationSchema:Je,PaginatedRequestParamsSchema:Kt,PaginatedRequestSchema:Ne,PaginatedResultSchema:Me,ResourceContentsSchema:Yt,TextResourceContentsSchema:Qt,BlobResourceContentsSchema:Xt,RoleSchema:Pe,AnnotationsSchema:be,ResourceSchema:mt,ResourceTemplateSchema:Go,ListResourcesRequestSchema:Wo,ListResourcesResultSchema:Ko,ListResourceTemplatesRequestSchema:Be,ListResourceTemplatesResultSchema:eo,ResourceRequestParamsSchema:ft,ReadResourceRequestParamsSchema:Yo,ReadResourceRequestSchema:Qo,ReadResourceResultSchema:Xo,ResourceListChangedNotificationSchema:er,SubscribeRequestParamsSchema:tr,SubscribeRequestSchema:or,UnsubscribeRequestParamsSchema:rr,UnsubscribeRequestSchema:nr,ResourceUpdatedNotificationParamsSchema:sr,ResourceUpdatedNotificationSchema:ir,PromptArgumentSchema:ar,PromptSchema:cr,ListPromptsRequestSchema:lr,ListPromptsResultSchema:ur,GetPromptRequestParamsSchema:dr,GetPromptRequestSchema:pr,TextContentSchema:gt,ImageContentSchema:St,AudioContentSchema:_t,ToolUseContentSchema:hr,EmbeddedResourceSchema:Ge,ResourceLinkSchema:mr,ContentBlockSchema:Se,PromptMessageSchema:to,GetPromptResultSchema:oo,PromptListChangedNotificationSchema:yt,ToolAnnotationsSchema:fr,ToolExecutionSchema:ro,ToolSchema:bt,ListToolsRequestSchema:no,ListToolsResultSchema:so,CallToolResultSchema:io,CallToolRequestParamsSchema:ne,CallToolRequestSchema:gr,ToolListChangedNotificationSchema:ti,LoggingLevelSchema:ao,SetLevelRequestParamsSchema:Sr,SetLevelRequestSchema:_r,LoggingMessageNotificationParamsSchema:yr,LoggingMessageNotificationSchema:br,ModelHintSchema:vr,ModelPreferencesSchema:zr,ToolChoiceSchema:wr,ToolResultContentSchema:oi,SamplingContentSchema:Rr,SamplingMessageContentBlockSchema:We,SamplingMessageSchema:xr,CreateMessageRequestParamsSchema:Pr,CreateMessageRequestSchema:Tr,CreateMessageResultSchema:Er,CreateMessageResultWithToolsSchema:kr,BooleanSchemaSchema:$r,StringSchemaSchema:Cr,NumberSchemaSchema:Ir,UntitledSingleSelectEnumSchemaSchema:Or,TitledSingleSelectEnumSchemaSchema:Nr,LegacyTitledEnumSchemaSchema:Mr,SingleSelectEnumSchemaSchema:Ar,UntitledMultiSelectEnumSchemaSchema:vt,TitledMultiSelectEnumSchemaSchema:zt,MultiSelectEnumSchemaSchema:ri,EnumSchemaSchema:ni,PrimitiveSchemaDefinitionSchema:pe,ElicitRequestFormParamsSchema:he,ElicitRequestURLParamsSchema:qr,ElicitRequestParamsSchema:ve,ElicitRequestSchema:si,ElicitationCompleteNotificationParamsSchema:ii,ElicitationCompleteNotificationSchema:ai,ElicitResultSchema:ci,ResourceTemplateReferenceSchema:li,PromptReferenceSchema:ui,CompleteRequestParamsSchema:di,CompleteRequestSchema:jr,CompleteResultSchema:pi,RootSchema:hi,ListRootsRequestSchema:co,ListRootsResultSchema:Lr,RootsListChangedNotificationSchema:mi,TaskCreationParamsSchema:fi,TaskStatusSchema:Ur,TaskSchema:Ke,CreateTaskResultSchema:de,TaskStatusNotificationParamsSchema:gi,TaskStatusNotificationSchema:wt,GetTaskRequestSchema:lo,GetTaskResultSchema:uo,GetTaskPayloadRequestSchema:po,GetTaskPayloadResultSchema:za,ListTasksRequestSchema:ce,ListTasksResultSchema:W,CancelTaskRequestSchema:Rt,CancelTaskResultSchema:y.merge(Ke),ClientRequestSchema:v([Fe,dt,jr,_r,pr,lr,Wo,Be,Qo,or,nr,gr,no,lo,po,ce,Rt]),ClientNotificationSchema:v([R,Je,Wt,mi,wt]),ClientResultSchema:v([w,Er,kr,ci,Lr,uo,W,de]),ServerRequestSchema:v([Fe,Tr,si,co,lo,po,ce,Rt]),ServerNotificationSchema:v([R,Je,br,ir,er,ti,yt,wt,ai]),ServerResultSchema:v([w,Bo,pi,oo,ur,Ko,eo,Xo,io,so,uo,W,de]),CallToolResultWireSchema:P().superRefine((se,Nm)=>{if(typeof se!=="object"||se===null||Array.isArray(se)||se.content!==void 0)return;for(let ml of jh)if(ml in se){Nm.addIssue({code:"custom",message:`content is required when the body carries '${ml}' — another result family cannot default into an empty tools/call success`});return}}).transform(gg).pipe(io)}}var _g;function Lh(){return _g??=Sg()}function Uh(e){return e.type!=="object"}var yg=new Set(["const","enum","default","examples"]),bg=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function xh(e){return e!==void 0&&!(typeof e==="string"&&e.startsWith("#"))}function vg(e){let t=typeof e.$schema==="string"?e.$schema:void 0;if(xh(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=_l(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,i)=>{if(Array.isArray(n))return n.map((d)=>r(d,!1));if(n===null||typeof n!=="object")return n;if(!i&&xh(n.$id))return n;let a={},c=!1;for(let[d,p]of Object.entries(n))if(i)a[d]=r(p,!1);else if((d==="$ref"||d==="$dynamicRef")&&typeof p==="string")a[d]=p==="#"?"#/properties/result":p.startsWith("#/")?`#/properties/result${p.slice(1)}`:p;else if(d==="$recursiveRef"&&p==="#"&&o)c=!0;else if(yg.has(d))a[d]=p;else if(bg.has(d))a[d]=r(p,!0);else a[d]=r(p,!1);if(c)if("$ref"in a)a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}];else a.$ref="#/properties/result";return a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:r(e,!1)},required:["result"]}}var Zh={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Dh={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},zg={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Sa;function Gc(){if(Sa)return Sa;let e=Lh();return Sa={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Sa}function Vh(e){return Object.prototype.hasOwnProperty.call(Zh,e)}function Hh(e){return Object.prototype.hasOwnProperty.call(Dh,e)}function wg(e){return Object.prototype.hasOwnProperty.call(zg,e)}function Rg(e){return wg(e)?Gc().resultSchemas[e]:void 0}function xg(e){return Vh(e)?Gc().requestSchemas[e]:void 0}function Pg(e){return Hh(e)?Gc().notificationSchemas[e]:void 0}var Ob=Object.keys(Zh),Nb=Object.keys(Dh);function Vc(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function _a(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}var Ph={ok:!1,reason:"not-in-era"};function Th(e){return Vc(e)&&Vc(e.outputSchema)&&Uh(e.outputSchema)}function Eh(e){return e}var Wc={era:"2025-11-25",hasRequestMethod:Vh,hasNotificationMethod:Hh,validateRequest:(e,t)=>_a(xg(e),t),validateResult:(e,t)=>_a(Rg(e),t),validateNotification:(e,t)=>_a(Pg(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ph,validateInputResponse:()=>Ph,samplingResultVariant:(e,t)=>{let o=Lh();return _a(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)},outboundEnvelope:(e)=>{return},validateEnvelopeMeta:(e)=>[],projectCallToolResult(e,t){let o=qh(e),r=o.structuredContent;if(r===void 0)return o;let n=typeof r!=="object"||r===null||Array.isArray(r),i=t!==void 0&&Uh(t);if(!n&&!i)return o;return{...o,structuredContent:{result:r}}},decodeResult(e,t){if(Vc(t)&&"resultType"in t){let o={...t};return delete o.resultType,{kind:"complete",result:Eh(o)}}return{kind:"complete",result:Eh(t)}},encodeResult(e,t){if(e!=="tools/list")return t;let o=t.tools;if(!Array.isArray(o)||!o.some((r)=>Th(r)))return t;return{...t,tools:o.map((r)=>Th(r)?{...r,outputSchema:vg(r.outputSchema)}:r)}},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope:(e)=>{return}};function Tg(){let e=tn(()=>v([s(),_(),z(),kt(),b(s(),e),h(e)])),t=b(s(),e),o=v([s(),_().int()]),r=s(),n=v([s(),_().int()]),i=I(["user","assistant"]),a=I(["debug","info","notice","warning","error","critical","alert","emergency"]),c=s().refine((W)=>{try{return atob(W),!0}catch{return!1}},{message:"Invalid Base64 string"}),d=l({ttl:_().optional()}),p=l({taskId:s()}),m=k({progressToken:o.optional(),"io.modelcontextprotocol/related-task":p.optional()}),f=l({_meta:m.optional()}),y=f.extend({task:d.optional()}),S=l({_meta:m.optional()}),w=l({method:s(),params:S.loose().optional()}),x=l({src:s(),mimeType:s().optional(),sizes:h(s()).optional(),theme:I(["light","dark"]).optional()}),R=l({icons:h(x).optional()}),C=l({name:s(),title:s().optional()}),N=C.extend({...C.shape,...R.shape,version:s(),websiteUrl:s().optional(),description:s().optional()}),O=qe(l({applyDefaults:z().optional()}),t),q=$t((W)=>{if(W&&typeof W==="object"&&!Array.isArray(W)&&Object.keys(W).length===0)return{form:{}};return W},qe(l({form:O.optional(),url:t.optional()}),t.optional())),L=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),j=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),V=l({experimental:b(s(),t).optional(),sampling:l({context:t.optional(),tools:t.optional()}).optional(),elicitation:q.optional(),roots:l({listChanged:z().optional()}).optional(),tasks:L.optional(),extensions:b(s(),t).optional()}),ae=l({experimental:b(s(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:l({listChanged:z().optional()}).optional(),resources:l({subscribe:z().optional(),listChanged:z().optional()}).optional(),tools:l({listChanged:z().optional()}).optional(),tasks:j.optional(),extensions:b(s(),t).optional()}),Y=l({progress:_(),total:E(_()),message:E(s())}),ge=l({...S.shape,...Y.shape,progressToken:o}),dt=w.extend({method:u("notifications/progress"),params:ge}),Jo=S.extend({level:a,logger:s().optional(),data:P()}),Bo=w.extend({method:u("notifications/message"),params:Jo}),Wt=l({uri:s(),mimeType:E(s()),_meta:b(s(),P()).optional()}),Fe=Wt.extend({text:s()}),pt=Wt.extend({blob:c}),xe=l({audience:h(i).optional(),priority:_().min(0).max(1).optional(),lastModified:So({offset:!0}).optional()}),Je=l({...C.shape,...R.shape,uri:s(),description:E(s()),mimeType:E(s()),size:E(_()),annotations:xe.optional(),_meta:E(k({}))}),Kt=l({...C.shape,...R.shape,uriTemplate:s(),description:E(s()),mimeType:E(s()),annotations:xe.optional(),_meta:E(k({}))}),Ne=w.extend({method:u("notifications/resources/list_changed"),params:S.optional()}),Me=S.extend({uri:s()}),Yt=w.extend({method:u("notifications/resources/updated"),params:Me}),Qt=l({name:s(),description:E(s()),required:E(z())}),ht=l({...C.shape,...R.shape,description:E(s()),arguments:E(h(Qt)),_meta:E(k({}))}),Xt=w.extend({method:u("notifications/prompts/list_changed"),params:S.optional()}),Pe=l({type:u("text"),text:s(),annotations:xe.optional(),_meta:b(s(),P()).optional()}),be=l({type:u("image"),data:c,mimeType:s(),annotations:xe.optional(),_meta:b(s(),P()).optional()}),mt=l({type:u("audio"),data:c,mimeType:s(),annotations:xe.optional(),_meta:b(s(),P()).optional()}),Go=l({type:u("tool_use"),name:s(),id:s(),input:b(s(),P()),_meta:b(s(),P()).optional()}),Wo=l({type:u("resource"),resource:v([Fe,pt]),annotations:xe.optional(),_meta:b(s(),P()).optional()}),Ko=Je.extend({type:u("resource_link")}),Be=v([Pe,be,mt,Ko,Wo]),eo=l({role:i,content:Be}),ft=l({title:s().optional(),readOnlyHint:z().optional(),destructiveHint:z().optional(),idempotentHint:z().optional(),openWorldHint:z().optional()}),Yo=w.extend({method:u("notifications/tools/list_changed"),params:S.optional()}),Qo=l({name:s().optional()}),Xo=l({hints:h(Qo).optional(),costPriority:_().min(0).max(1).optional(),speedPriority:_().min(0).max(1).optional(),intelligencePriority:_().min(0).max(1).optional()}),er=l({mode:I(["auto","required","none"]).optional()}),tr=l({type:u("boolean"),title:s().optional(),description:s().optional(),default:z().optional()}),or=l({type:u("string"),title:s().optional(),description:s().optional(),minLength:_().optional(),maxLength:_().optional(),format:I(["email","uri","date","date-time"]).optional(),default:s().optional()}),rr=l({type:I(["number","integer"]),title:s().optional(),description:s().optional(),minimum:_().optional(),maximum:_().optional(),default:_().optional()}),nr=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),default:s().optional()}),sr=l({type:u("string"),title:s().optional(),description:s().optional(),oneOf:h(l({const:s(),title:s()})),default:s().optional()}),ir=l({type:u("string"),title:s().optional(),description:s().optional(),enum:h(s()),enumNames:h(s()).optional(),default:s().optional()}),ar=v([nr,sr]),cr=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:_().optional(),maxItems:_().optional(),items:l({type:u("string"),enum:h(s())}),default:h(s()).optional()}),lr=l({type:u("array"),title:s().optional(),description:s().optional(),minItems:_().optional(),maxItems:_().optional(),items:l({anyOf:h(l({const:s(),title:s()}))}),default:h(s()).optional()}),ur=v([cr,lr]),dr=v([ir,ar,ur]),pr=v([dr,tr,or,rr]),gt=y.extend({mode:u("form").optional(),message:s(),requestedSchema:l({type:u("object"),properties:b(s(),pr),required:h(s()).optional()}).catchall(P())}),St=l({type:u("ref/resource"),uri:s()}),_t=l({type:u("ref/prompt"),name:s()}),hr=l({uri:s().startsWith("file://"),name:s().optional(),_meta:b(s(),P()).optional()}),Ge=V.shape,mr=l({experimental:Ge.experimental,sampling:Ge.sampling,elicitation:Ge.elicitation,roots:Ge.roots,extensions:Ge.extensions}),Se=ae.shape,to=l({experimental:Se.experimental,logging:Se.logging,completions:Se.completions,prompts:Se.prompts,resources:Se.resources,tools:Se.tools,extensions:Se.extensions}),oo=k({progressToken:o.optional(),[Ct]:s(),[yo]:N.optional(),[It]:mr,[bo]:a.optional()}),yt=l({...C.shape,...R.shape,description:s().optional(),inputSchema:k({$schema:s().optional(),type:u("object")}),outputSchema:k({$schema:s().optional()}).optional(),annotations:ft.optional(),_meta:b(s(),P()).optional()}),fr=l({type:u("tool_result"),toolUseId:s(),content:h(Be),structuredContent:P().optional(),isError:z().optional(),_meta:b(s(),P()).optional()}),ro=v([Pe,be,mt,Go,fr]),bt=l({role:i,content:v([ro,h(ro)]),_meta:b(s(),P()).optional()}),no=s(),so=k({[rt]:N.optional().catch(void 0)}),io=so.optional();function ne(W){return k({_meta:io,resultType:no.default("complete"),...W})}let gr=ne({}),ti=ne({nextCursor:r.optional()}),ao=ne({content:h(Be),structuredContent:P().optional(),isError:z().optional()}),Sr=ne({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),tools:h(yt),nextCursor:r.optional()}),_r=ne({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),prompts:h(ht),nextCursor:r.optional()}),yr=ne({description:s().optional(),messages:h(eo)}),br=ne({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),resources:h(Je),nextCursor:r.optional()}),vr=ne({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),resourceTemplates:h(Kt),nextCursor:r.optional()}),zr=ne({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),contents:h(v([Fe,pt]))}),wr=ne({completion:l({values:h(s()).max(100),total:_().int().optional(),hasMore:z().optional()}).loose()}),oi=ne({ttlMs:_().int().min(0),cacheScope:I(["public","private"])}),Rr=ne({ttlMs:_().int().min(0).catch(0),cacheScope:I(["public","private"]).catch("private"),supportedVersions:h(s()),capabilities:to,instructions:s().optional()}),We=l({messages:h(bt),modelPreferences:Xo.optional(),systemPrompt:s().optional(),includeContext:I(["none","thisServer","allServers"]).optional(),temperature:_().optional(),maxTokens:_().int(),stopSequences:h(s()).optional(),metadata:t.optional(),tools:h(yt).optional(),toolChoice:er.optional()}),xr=l({method:u("sampling/createMessage"),params:We}),Pr=l({method:u("roots/list"),params:l({_meta:b(s(),P()).optional()}).optional()}),Tr=l({...bt.shape,model:s(),stopReason:s().optional()}),Er=l({roots:h(hr)}),kr=l({action:I(["accept","decline","cancel"]),content:b(s(),v([s(),_(),z(),h(s())])).optional()}),$r=l({mode:u("url"),message:s(),url:s().url()}),Cr=v([gt,$r]),Ir=l({method:u("elicitation/create"),params:Cr}),Or=v([xr,Pr,Ir]),Nr=v([Tr,Er,kr]),Mr=b(s(),Or),Ar=b(s(),Nr),vt=ne({inputRequests:Mr.optional(),requestState:s().optional()}),zt={inputResponses:Ar.optional(),requestState:s().optional()},ri=l({_meta:oo,...zt}),ni=k({progressToken:o.optional()});function pe(W,Rt){return l({method:u(W),params:l({_meta:oo,...Rt})})}function he(W,Rt){return l({method:u(W),params:l({_meta:ni.optional(),...Rt}).optional()})}let qr={name:s(),arguments:b(s(),P()).optional(),...zt},ve={cursor:r.optional()},si=pe("tools/call",qr),ii=pe("tools/list",ve),ai=pe("prompts/list",ve),ci=pe("prompts/get",{name:s(),arguments:b(s(),s()).optional(),...zt}),li=pe("resources/list",ve),ui=pe("resources/templates/list",ve),di=pe("resources/read",{uri:s(),...zt}),jr={ref:v([_t,St]),argument:l({name:s(),value:s()}),context:l({arguments:b(s(),s()).optional()}).optional()},pi=pe("completion/complete",jr),hi=pe("server/discover",{}),co=l({toolsListChanged:z().optional(),promptsListChanged:z().optional(),resourcesListChanged:z().optional(),resourceSubscriptions:h(s()).optional()}),Lr={notifications:co},mi=pe("subscriptions/listen",Lr),fi=so.extend({"io.modelcontextprotocol/subscriptionId":n}),Ur=k({_meta:fi,resultType:no.default("complete")}),Ke={"tools/call":he("tools/call",qr),"tools/list":he("tools/list",ve),"prompts/get":he("prompts/get",{name:s(),arguments:b(s(),s()).optional()}),"prompts/list":he("prompts/list",ve),"resources/list":he("resources/list",ve),"resources/templates/list":he("resources/templates/list",ve),"resources/read":he("resources/read",{uri:s()}),"completion/complete":he("completion/complete",jr),"server/discover":he("server/discover",{}),"subscriptions/listen":he("subscriptions/listen",Lr)};function de(W){return k({_meta:io,...W})}let gi={"tools/call":de({content:h(Be),structuredContent:P().optional(),isError:z().optional()}),"tools/list":de({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),tools:h(yt),nextCursor:r.optional()}),"prompts/get":de({description:s().optional(),messages:h(eo)}),"prompts/list":de({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),prompts:h(ht),nextCursor:r.optional()}),"resources/list":de({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),resources:h(Je),nextCursor:r.optional()}),"resources/templates/list":de({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),resourceTemplates:h(Kt),nextCursor:r.optional()}),"resources/read":de({ttlMs:_().int().min(0),cacheScope:I(["public","private"]),contents:h(v([Fe,pt]))}),"completion/complete":de({completion:l({values:h(s()).max(100),total:_().int().optional(),hasMore:z().optional()}).loose()}),"server/discover":de({ttlMs:_().int().min(0).catch(0),cacheScope:I(["public","private"]).catch("private"),supportedVersions:h(s()),capabilities:to,instructions:s().optional()}),"subscriptions/listen":de({})},wt=k({"io.modelcontextprotocol/subscriptionId":n.optional()}),lo=l({method:u("notifications/subscriptions/acknowledged"),params:l({_meta:wt.optional(),notifications:co})}),uo=l({_meta:wt.optional(),requestId:n,reason:s().optional()}),po=l({method:u("notifications/cancelled"),params:uo}),za={"notifications/cancelled":po,"notifications/progress":dt,"notifications/message":Bo,"notifications/resources/updated":Yt,"notifications/resources/list_changed":Ne,"notifications/tools/list_changed":Yo,"notifications/prompts/list_changed":Xt,"notifications/subscriptions/acknowledged":lo},ce=(W)=>l({jsonrpc:u("2.0"),id:v([s(),_().int()]),result:W}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:i,LoggingLevelSchema:a,TaskMetadataSchema:d,RelatedTaskMetadataSchema:p,RequestMetaSchema:m,BaseRequestParamsSchema:f,TaskAugmentedRequestParamsSchema:y,NotificationsParamsSchema:S,NotificationSchema:w,IconSchema:x,IconsSchema:R,BaseMetadataSchema:C,ImplementationSchema:N,ClientTasksCapabilitySchema:L,ServerTasksCapabilitySchema:j,ClientCapabilitiesSchema:V,ServerCapabilitiesSchema:ae,ProgressSchema:Y,ProgressNotificationParamsSchema:ge,ProgressNotificationSchema:dt,LoggingMessageNotificationParamsSchema:Jo,LoggingMessageNotificationSchema:Bo,ResourceContentsSchema:Wt,TextResourceContentsSchema:Fe,BlobResourceContentsSchema:pt,AnnotationsSchema:xe,ResourceSchema:Je,ResourceTemplateSchema:Kt,ResourceListChangedNotificationSchema:Ne,ResourceUpdatedNotificationParamsSchema:Me,ResourceUpdatedNotificationSchema:Yt,PromptArgumentSchema:Qt,PromptSchema:ht,PromptListChangedNotificationSchema:Xt,TextContentSchema:Pe,ImageContentSchema:be,AudioContentSchema:mt,ToolUseContentSchema:Go,EmbeddedResourceSchema:Wo,ResourceLinkSchema:Ko,ContentBlockSchema:Be,PromptMessageSchema:eo,ToolAnnotationsSchema:ft,ToolListChangedNotificationSchema:Yo,ModelHintSchema:Qo,ModelPreferencesSchema:Xo,ToolChoiceSchema:er,BooleanSchemaSchema:tr,StringSchemaSchema:or,NumberSchemaSchema:rr,UntitledSingleSelectEnumSchemaSchema:nr,TitledSingleSelectEnumSchemaSchema:sr,LegacyTitledEnumSchemaSchema:ir,SingleSelectEnumSchemaSchema:ar,UntitledMultiSelectEnumSchemaSchema:cr,TitledMultiSelectEnumSchemaSchema:lr,MultiSelectEnumSchemaSchema:ur,EnumSchemaSchema:dr,PrimitiveSchemaDefinitionSchema:pr,ElicitRequestFormParamsSchema:gt,ResourceTemplateReferenceSchema:St,PromptReferenceSchema:_t,RootSchema:hr,ClientCapabilities2026Schema:mr,ServerCapabilities2026Schema:to,RequestMetaEnvelopeSchema:oo,ToolSchema:yt,ToolResultContentSchema:fr,SamplingMessageContentBlockSchema:ro,SamplingMessageSchema:bt,ResultTypeSchema:no,ResultMetaSchema:so,ResultSchema:gr,PaginatedResultSchema:ti,CallToolResultSchema:ao,ListToolsResultSchema:Sr,ListPromptsResultSchema:_r,GetPromptResultSchema:yr,ListResourcesResultSchema:br,ListResourceTemplatesResultSchema:vr,ReadResourceResultSchema:zr,CompleteResultSchema:wr,CacheableResultSchema:oi,DiscoverResultSchema:Rr,CreateMessageRequestParamsSchema:We,CreateMessageRequestSchema:xr,ListRootsRequestSchema:Pr,CreateMessageResultSchema:Tr,ListRootsResultSchema:Er,ElicitResultSchema:kr,ElicitRequestURLParamsSchema:$r,ElicitRequestParamsSchema:Cr,ElicitRequestSchema:Ir,InputRequestSchema:Or,InputResponseSchema:Nr,InputRequestsSchema:Mr,InputResponsesSchema:Ar,InputRequiredResultSchema:vt,InputResponseRequestParamsSchema:ri,CallToolRequestSchema:si,ListToolsRequestSchema:ii,ListPromptsRequestSchema:ai,GetPromptRequestSchema:ci,ListResourcesRequestSchema:li,ListResourceTemplatesRequestSchema:ui,ReadResourceRequestSchema:di,CompleteRequestSchema:pi,DiscoverRequestSchema:hi,SubscriptionFilterSchema:co,SubscriptionsListenRequestSchema:mi,SubscriptionsListenResultMetaSchema:fi,SubscriptionsListenResultSchema:Ur,dispatchRequestSchemas:Ke,dispatchResultSchemas:gi,NotificationMetaSchema:wt,SubscriptionsAcknowledgedNotificationSchema:lo,CancelledNotificationParamsSchema:uo,CancelledNotificationSchema:po,notificationSchemas2026:za,JSONRPCResultResponseSchema:ce(gr),CallToolResultResponseSchema:ce(v([ao,vt])),ListToolsResultResponseSchema:ce(Sr),ListPromptsResultResponseSchema:ce(_r),GetPromptResultResponseSchema:ce(v([yr,vt])),ListResourcesResultResponseSchema:ce(br),ListResourceTemplatesResultResponseSchema:ce(vr),ReadResourceResultResponseSchema:ce(v([zr,vt])),CompleteResultResponseSchema:ce(wr),DiscoverResultResponseSchema:ce(Rr),SubscriptionsListenResultResponseSchema:ce(Ur)}}var Eg;function ct(){return Eg??=Tg()}var kg=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function $g(e){return kg.includes(e)}var Kc=Symbol("modelcontextprotocol.resultCacheHintFallback");function Cg(e){return e[Kc]}function Fh(e){return typeof e==="number"&&Number.isSafeInteger(e)&&e>=0}function Jh(e){return e==="public"||e==="private"}var M=function(e){return e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError",e[e.ResourceNotFound=-32002]="ResourceNotFound",e[e.MissingRequiredClientCapability=-32021]="MissingRequiredClientCapability",e[e.UnsupportedProtocolVersion=-32022]="UnsupportedProtocolVersion",e[e.UrlElicitationRequired=-32042]="UrlElicitationRequired",e}({}),re=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return fe(this,t)}static isInstance(t){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fe(this,t)}constructor(t,o,r){super(o);this.code=t,this.data=r,this.name="ProtocolError",Jt(this,new.target)}static fromError(t,o,r){if(t===M.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new Gh(n.elicitations,o)}if(t===M.UnsupportedProtocolVersion&&r){let n=r;if(Array.isArray(n.supported)&&typeof n.requested==="string")return new Wh({supported:n.supported,requested:n.requested},o)}if(t===M.InvalidParams||t===M.ResourceNotFound){let n=r;if(typeof n?.uri==="string"&&(t===M.ResourceNotFound||Object.keys(n).length===1))return new Bh(n.uri,o)}if(t===M.MissingRequiredClientCapability&&r){let n=r;if(n.requiredCapabilities!==null&&typeof n.requiredCapabilities==="object"&&!Array.isArray(n.requiredCapabilities))return new Kh({requiredCapabilities:n.requiredCapabilities},o)}return new e(t,o,r)}},Bh=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(M.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Gh=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(M.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Wh=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(M.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},Kh=class extends re{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(M.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},Ig=0,Og="private",Ng=["tools/call","prompts/get","resources/read"];function Mg(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete")return t;if(Ng.includes(e))return t;throw new re(M.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Ag(e,t){let o=Cg(t);if(t.resultType!=="complete"||!$g(e))return o===void 0?t:Zg(t);let r=t,n=Fh(r.ttlMs)?r.ttlMs:Lg(o),i=Jh(r.cacheScope)?r.cacheScope:Ug(o),a={...r,ttlMs:n,cacheScope:i};return delete a[Kc],a}function qg(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function jg(e,t){if(t===void 0)return e;let o=e._meta;if(o===void 0)return{...e,_meta:{[rt]:t}};if(!qg(o))return e;if(o[rt]!==void 0)return e;return{...e,_meta:{...o,[rt]:t}}}function Lg(e){return e!==void 0&&Fh(e.ttlMs)?e.ttlMs:Ig}function Ug(e){return e!==void 0&&Jh(e.cacheScope)?e.cacheScope:Og}function Zg(e){let t={...e};return delete t[Kc],t}var Dg=["elicitation/create","sampling/createMessage","roots/list"],ya;function Yh(){if(ya)return ya;let e=ct();return ya={request:{"elicitation/create":l({method:u("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":l({method:u("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":l({method:u("roots/list"),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},ya}function Qh(e){return Dg.includes(e)}function qc(e){return Qh(e)?Yh().request[e]:void 0}function Vg(e){return Qh(e)?Yh().response[e]:void 0}var Yc={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Xh={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function em(e){return Object.prototype.hasOwnProperty.call(Yc,e)}function tm(e){return Object.prototype.hasOwnProperty.call(Xh,e)}function Hg(e){return Object.prototype.hasOwnProperty.call(Yc,e)}function Fg(e){return em(e)?ct().dispatchRequestSchemas[e]:void 0}function Jg(e){return Hg(e)?ct().dispatchResultSchemas[e]:void 0}function Bg(e){return tm(e)?ct().notificationSchemas2026[e]:void 0}var Mb=Object.keys(Yc),Ab=Object.keys(Xh);function Fs(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Vs(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let o=e.safeParse(t);return o.success?{ok:!0,value:o.data}:{ok:!1,reason:"invalid",message:String(o.error)}}var Gg={ok:!1,reason:"not-in-era"},Wg=[Ct,It];function Kg(e,t){let o=t,r=!1,n=()=>{if(!r)o={...o},r=!0;return o},i=t.tools;if(e==="tools/list"&&Array.isArray(i)&&i.some((c)=>Fs(c)&&("execution"in c)))n().tools=i.map((c)=>{if(!Fs(c)||!("execution"in c))return c;let d={...c};return delete d.execution,d});let a=t.capabilities;if(Fs(a)&&"tasks"in a){let c={...a};delete c.tasks,n().capabilities=c}return o}var Qc={era:"2026-07-28",hasRequestMethod:em,hasNotificationMethod:tm,hasInputRequestMethod:(e)=>qc(e)!==void 0,validateRequest:(e,t)=>Vs(Fg(e),t),validateResult:(e,t)=>Vs(Jg(e),t),validateNotification:(e,t)=>Vs(Bg(e),t),validateInputRequest:(e,t)=>Vs(qc(e),t),validateInputResponse:(e,t)=>Vs(Vg(e),t),samplingResultVariant:()=>Gg,outboundEnvelope(e){return{[Ct]:e.protocolVersion,[yo]:e.clientInfo,[It]:e.clientCapabilities,...e.logLevel!==void 0&&{[bo]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of Wg)if(!(r in e))t.push({key:r,problem:"missing"});let o=ct().RequestMetaEnvelopeSchema.safeParse(e);if(!o.success)for(let r of o.error.issues){let n=r.path.map(String),i=n.length>0?n.join("."):"_meta";if(n.length===1&&t.some((a)=>a.key===i&&a.problem==="missing"))continue;t.push({key:i,problem:r.message})}return t},projectCallToolResult:(e)=>qh(e),inputRequestSchema:qc,decodeResult(e,t){if(!Fs(t))return{kind:"invalid",error:new K(oe.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new K(oe.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof o!=="string")return{kind:"invalid",error:new K(oe.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let a=t.inputRequests,c=Fs(a)?a:{},d=t.requestState,p=t._meta===void 0?void 0:ct().ResultMetaSchema.safeParse(t._meta),m=p?.success?p.data:void 0;if(Object.keys(c).length===0&&typeof d!=="string")return{kind:"invalid",error:new K(oe.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:"input-required-missing-both"})};return{kind:"input_required",inputRequests:c,...typeof d==="string"&&{requestState:d},...m!==void 0&&{_meta:m}}}if(o!=="complete")return{kind:"invalid",error:new K(oe.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=Yg(),n=Object.hasOwn(r,e)?r[e]:void 0;if(n!==void 0){let a=n.safeParse(t);if(!a.success)return{kind:"invalid",error:new K(oe.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,o){return jg(Ag(e,Mg(e,Kg(e,t))),o)},encodeErrorCode:(e)=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return"Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)";let t=ct().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map((o)=>o.message).join("; ")}`}},ba;function Yg(){if(ba)return ba;let e=ct();return ba={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},ba}var Xc="2026-07-28";function Bs(e){return e!==void 0&&Ah(e)?Qc:Wc}function kh(e){if(e.revision!==void 0)return Bs(e.revision).era;return e.era==="modern"?Qc.era:Wc.era}function jc(e){return om.some((t)=>t.hasRequestMethod(e))}function Lc(e){return om.some((t)=>t.hasNotificationMethod(e))}function $h(e){return e==="tasks/get"||e==="tasks/cancel"}var om=[Wc,Qc],Qg=gl({AnnotationsSchema:()=>$e,AudioContentSchema:()=>Ut,BaseMetadataSchema:()=>Ee,BaseRequestParamsSchema:()=>X,BlobResourceContentsSchema:()=>No,BooleanSchemaSchema:()=>jo,CallToolRequestParamsSchema:()=>Yn,CallToolRequestSchema:()=>Qn,CallToolResultSchema:()=>at,CancelTaskRequestSchema:()=>aa,CancelTaskResultSchema:()=>ca,CancelledNotificationParamsSchema:()=>nn,CancelledNotificationSchema:()=>To,ClientCapabilitiesSchema:()=>an,ClientNotificationSchema:()=>ua,ClientRequestSchema:()=>la,ClientResultSchema:()=>da,ClientTasksCapabilitySchema:()=>Gi,CompatibilityCallToolResultSchema:()=>Ki,CompleteRequestParamsSchema:()=>xs,CompleteRequestSchema:()=>Ps,CompleteResultSchema:()=>Ts,ContentBlockSchema:()=>Ce,CreateMessageRequestParamsSchema:()=>us,CreateMessageRequestSchema:()=>ds,CreateMessageResultSchema:()=>ps,CreateMessageResultWithToolsSchema:()=>hs,CreateTaskResultSchema:()=>Xi,CursorSchema:()=>zo,DiscoverRequestSchema:()=>pn,DiscoverResultSchema:()=>ko,ElicitRequestFormParamsSchema:()=>Ft,ElicitRequestParamsSchema:()=>_s,ElicitRequestSchema:()=>ys,ElicitRequestURLParamsSchema:()=>Ss,ElicitResultSchema:()=>zs,ElicitationCompleteNotificationParamsSchema:()=>bs,ElicitationCompleteNotificationSchema:()=>vs,EmbeddedResourceSchema:()=>Zt,EmptyResultSchema:()=>st,EnumSchemaSchema:()=>gs,GetPromptRequestParamsSchema:()=>Zn,GetPromptRequestSchema:()=>Dn,GetPromptResultSchema:()=>Fn,GetTaskPayloadRequestSchema:()=>ra,GetTaskPayloadResultSchema:()=>na,GetTaskRequestSchema:()=>ta,GetTaskResultSchema:()=>oa,IconSchema:()=>sn,IconsSchema:()=>Le,ImageContentSchema:()=>Lt,ImplementationSchema:()=>ke,InitializeRequestParamsSchema:()=>cn,InitializeRequestSchema:()=>ln,InitializeResultSchema:()=>un,InitializedNotificationSchema:()=>dn,JSONArraySchema:()=>Ji,JSONObjectSchema:()=>J,JSONRPCErrorResponseSchema:()=>Mt,JSONRPCMessageSchema:()=>At,JSONRPCNotificationSchema:()=>Po,JSONRPCRequestSchema:()=>xo,JSONRPCResponseSchema:()=>Bi,JSONRPCResultResponseSchema:()=>Nt,JSONValueSchema:()=>je,LegacyTitledEnumSchemaSchema:()=>Zo,ListChangedOptionsBaseSchema:()=>Yi,ListPromptsRequestSchema:()=>Ln,ListPromptsResultSchema:()=>Un,ListResourceTemplatesRequestSchema:()=>yn,ListResourceTemplatesResultSchema:()=>bn,ListResourcesRequestSchema:()=>Sn,ListResourcesResultSchema:()=>_n,ListRootsRequestSchema:()=>ks,ListRootsResultSchema:()=>$s,ListTasksRequestSchema:()=>sa,ListTasksResultSchema:()=>ia,ListToolsRequestSchema:()=>Wn,ListToolsResultSchema:()=>Kn,LoggingLevelSchema:()=>qo,LoggingMessageNotificationParamsSchema:()=>os,LoggingMessageNotificationSchema:()=>rs,ModelHintSchema:()=>ns,ModelPreferencesSchema:()=>ss,MultiSelectEnumSchemaSchema:()=>fs,NotificationSchema:()=>te,NotificationsParamsSchema:()=>ie,NumberSchemaSchema:()=>Ht,PaginatedRequestParamsSchema:()=>fn,PaginatedRequestSchema:()=>Ue,PaginatedResultSchema:()=>Ze,PingRequestSchema:()=>$o,PrimitiveSchemaDefinitionSchema:()=>Ho,ProgressNotificationParamsSchema:()=>mn,ProgressNotificationSchema:()=>Co,ProgressSchema:()=>hn,ProgressTokenSchema:()=>vo,PromptArgumentSchema:()=>qn,PromptListChangedNotificationSchema:()=>Jn,PromptMessageSchema:()=>Hn,PromptReferenceSchema:()=>Rs,PromptSchema:()=>jn,ReadResourceRequestParamsSchema:()=>vn,ReadResourceRequestSchema:()=>zn,ReadResourceResultSchema:()=>wn,RelatedTaskMetadataSchema:()=>rn,RequestIdSchema:()=>Re,RequestMetaSchema:()=>wo,RequestSchema:()=>B,ResourceContentsSchema:()=>Io,ResourceLinkSchema:()=>Dt,ResourceListChangedNotificationSchema:()=>Rn,ResourceRequestParamsSchema:()=>qt,ResourceSchema:()=>Mo,ResourceTemplateReferenceSchema:()=>ws,ResourceTemplateSchema:()=>gn,ResourceUpdatedNotificationParamsSchema:()=>Mn,ResourceUpdatedNotificationSchema:()=>An,ResultMetaObjectSchema:()=>Ro,ResultSchema:()=>G,RoleSchema:()=>De,RootSchema:()=>Es,RootsListChangedNotificationSchema:()=>Cs,SamplingContentSchema:()=>cs,SamplingMessageContentBlockSchema:()=>ot,SamplingMessageSchema:()=>ls,ServerCapabilitiesSchema:()=>Eo,ServerNotificationSchema:()=>ha,ServerRequestSchema:()=>pa,ServerResultSchema:()=>ma,ServerTasksCapabilitySchema:()=>Wi,SetLevelRequestParamsSchema:()=>es,SetLevelRequestSchema:()=>ts,SingleSelectEnumSchemaSchema:()=>ms,StringSchemaSchema:()=>Vt,SubscribeRequestParamsSchema:()=>xn,SubscribeRequestSchema:()=>Pn,SubscriptionFilterSchema:()=>Ao,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Cn,SubscriptionsAcknowledgedNotificationSchema:()=>In,SubscriptionsListenRequestParamsSchema:()=>kn,SubscriptionsListenRequestSchema:()=>$n,SubscriptionsListenResultMetaSchema:()=>On,SubscriptionsListenResultSchema:()=>Nn,TaskAugmentedRequestParamsSchema:()=>nt,TaskCreationParamsSchema:()=>Qi,TaskMetadataSchema:()=>on,TaskSchema:()=>Ve,TaskStatusNotificationParamsSchema:()=>Os,TaskStatusNotificationSchema:()=>ea,TaskStatusSchema:()=>Is,TextContentSchema:()=>jt,TextResourceContentsSchema:()=>Oo,TitledMultiSelectEnumSchemaSchema:()=>Vo,TitledSingleSelectEnumSchemaSchema:()=>Uo,ToolAnnotationsSchema:()=>Bn,ToolChoiceSchema:()=>is,ToolExecutionSchema:()=>Gn,ToolListChangedNotificationSchema:()=>Xn,ToolResultContentSchema:()=>as,ToolSchema:()=>it,ToolUseContentSchema:()=>Vn,UnsubscribeRequestParamsSchema:()=>Tn,UnsubscribeRequestSchema:()=>En,UntitledMultiSelectEnumSchemaSchema:()=>Do,UntitledSingleSelectEnumSchemaSchema:()=>Lo});var rm=(e)=>xo.safeParse(e).success,nm=(e)=>Po.safeParse(e).success,Hc=(e)=>Nt.safeParse(e).success,sm=(e)=>Mt.safeParse(e).success;var Js=-32020,qb=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32000],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[M.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Js,M.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[M.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope — and a missing envelope on a request whose protocol-version header names a modern revision — is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[M.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision’s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[M.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Js],conformance:["http-header-validation"],rationale:"SEP-2243 standard `MCP-Protocol-Version` / `Mcp-Method` / `Mcp-Name` headers — presence, sentinel decoding, and `Mcp-Name` ↔ body cross-check — are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The spec requires `MCP-Protocol-Version` and `Mcp-Method` on every modern *request* POST (`Mcp-Name` only for the methods that mirror `params.name` / `params.uri` / `params.taskId`, see `MCP_NAME_HEADER_SOURCE`) and names them in that order, so a request missing several is answered by the earliest. Notification POSTs are exempt: the presence half runs on requests only, so a modern-enveloped notification is dispatched even with no standard headers at all. The classifier’s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half — including the missing `MCP-Protocol-Version` cell, which cannot live on the edge rung without breaking body-primary classification. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5–6) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[M.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced — pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Js],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool’s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],jb={[M.ParseError]:400,[M.InvalidRequest]:400,[M.MethodNotFound]:404,[M.UnsupportedProtocolVersion]:400,[M.MissingRequiredClientCapability]:400,[Js]:400};function el(e,t){return qi(e,t)}function Hs(e){return new Set(e.flatMap((t)=>Object.keys(t.shape)))}function Fc(e){if(e==null)return!1;let t=typeof e;if(t!=="object"&&t!=="function")return!1;if(!("~standard"in e))return!1;return typeof e["~standard"]?.validate==="function"}var Ch=!1,Jc="draft-2020-12";function Xg(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:Jc});else if(o.vendor==="zod"){if(!("_zod"in e))throw Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");if(!Ch)Ch=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.");r=Mi(e,{target:Jc,io:t})}else throw Error(`Schema library "${o.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output"){if(r.type!==void 0)return r;return im(r)?{type:"object",...r}:r}if(r.type!==void 0&&r.type!=="object")throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...r}}function im(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let o=e[t];if(Array.isArray(o)&&o.length>0)return o.every((r)=>r!==null&&typeof r==="object"&&(r.type==="object"||im(r)))}return!1}function eS(e){if(!e.path?.length)return e.message;return`${e.path.map((t)=>String(typeof t==="object"?t.key:t)).join(".")}: ${e.message}`}async function Uc(e,t){let o=await e["~standard"].validate(t);if(o.issues&&o.issues.length>0)return{success:!1,error:o.issues.map((r)=>eS(r)).join(", ")};return{success:!0,data:o.value}}function tS(e){let t=Mi(e,{target:Jc,io:"input"});return typeof t.pattern==="string"?t.pattern:void 0}var oS=/\\\.\\d\{(\d+)\}/;function rS(e){let t=oS.exec(e),o=[void 0,-1,0];if(t)o.push(Number(t[1]));return[!1,!0].flatMap((r)=>[!1,!0].flatMap((n)=>o.map((i)=>So({local:r,offset:n,precision:i}))))}function nS(e,t){let o;switch(e){case"email":o=[nh()];break;case"uri":o=[Li()];break;case"date":o=[$c()];break;case"date-time":o=rS(t);break}return new Set(o.map((r)=>tS(r)).filter((r)=>r!==void 0))}function sS(e,t,o){if(o!=="zod")return!0;return nS(e,t).has(t)}function Gs(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function iS(e){try{return Xg(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new re(M.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var aS=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function tl(e){return aS.has(e)||e.startsWith("x-")}var cS=new Set(["$schema",...Object.keys(Ft.shape.requestedSchema.shape)]),Ih={string:Hs([Vt,Lo,Uo,Zo]),number:Hs([Ht]),integer:Hs([Ht]),boolean:Hs([jo]),array:Hs([Do,Vo])},lS=new Set(Vt.shape.format.unwrap().options);function uS(e,t,o,r){if(!Gs(e))return e;let n=typeof e.type==="string"&&Object.hasOwn(Ih,e.type)?Ih[e.type]:void 0;if(n===void 0)return e;let i={};for(let[a,c]of Object.entries(e))if(n.has(a)||tl(a))i[a]=c;else if(a==="pattern"&&e.type==="string"&&typeof e.format==="string"){if(!lS.has(e.format))i[a]=c;else if(typeof c!=="string"||!sS(e.format,c,o))r.push(`${t}.${a}`)}else r.push(`${t}.${a}`);return i}function dS(e,t){let o={},r=[];for(let[n,i]of Object.entries(e))if(n==="properties"&&Gs(i))o[n]=Object.fromEntries(Object.entries(i).map(([a,c])=>[a,uS(c,`properties.${a}`,t,r)]));else if(cS.has(n))o[n]=i;else if(!tl(n))r.push(n);if(r.length>0)throw new re(M.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function pS(e,t){if(!Gs(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!el(Ho,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function Bc(e,t,o=""){if(Array.isArray(e)&&Array.isArray(t))return e.flatMap((r,n)=>Bc(r,t[n],`${o}[${n}]`));if(!Gs(e)||!Gs(t))return[];return Object.entries(e).flatMap(([r,n])=>{let i=o?`${o}.${r}`:r;if(!Object.prototype.hasOwnProperty.call(t,r))return tl(r)?[]:[i];return Bc(n,t[r],i)})}function hS(e){if(!Fc(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=dS(iS(e.requestedSchema),t),r=el(Ft.shape.requestedSchema,o);if(!r.success)throw new re(M.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${pS(o,r.error.message)}`);let n=Bc(o,r.data);if(n.length>0)throw new re(M.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let i=(r.data.required??[]).filter((a)=>!Object.prototype.hasOwnProperty.call(r.data.properties,a));if(i.length>0)throw new re(M.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function mS(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,o=typeof e.requestState==="string";if(!t&&!o)throw TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var Lb=Object.assign(mS,{elicit(e){try{return{method:"elicitation/create",params:hS(e)}}catch(t){throw t instanceof re?TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var fS=["AnnotationsSchema","AudioContentSchema","BaseMetadataSchema","BlobResourceContentsSchema","BooleanSchemaSchema","CallToolRequestSchema","CallToolRequestParamsSchema","CallToolResultSchema","CancelledNotificationSchema","CancelledNotificationParamsSchema","CancelTaskRequestSchema","CancelTaskResultSchema","ClientCapabilitiesSchema","ClientNotificationSchema","ClientRequestSchema","ClientResultSchema","CompatibilityCallToolResultSchema","CompleteRequestSchema","CompleteRequestParamsSchema","CompleteResultSchema","ContentBlockSchema","CreateMessageRequestSchema","CreateMessageRequestParamsSchema","CreateMessageResultSchema","CreateMessageResultWithToolsSchema","CreateTaskResultSchema","CursorSchema","DiscoverRequestSchema","DiscoverResultSchema","ElicitationCompleteNotificationSchema","ElicitationCompleteNotificationParamsSchema","ElicitRequestSchema","ElicitRequestFormParamsSchema","ElicitRequestParamsSchema","ElicitRequestURLParamsSchema","ElicitResultSchema","EmbeddedResourceSchema","EmptyResultSchema","EnumSchemaSchema","GetPromptRequestSchema","GetPromptRequestParamsSchema","GetPromptResultSchema","GetTaskPayloadRequestSchema","GetTaskPayloadResultSchema","GetTaskRequestSchema","GetTaskResultSchema","IconSchema","IconsSchema","ImageContentSchema","ImplementationSchema","InitializedNotificationSchema","InitializeRequestSchema","InitializeRequestParamsSchema","InitializeResultSchema","JSONArraySchema","JSONObjectSchema","JSONRPCErrorResponseSchema","JSONRPCMessageSchema","JSONRPCNotificationSchema","JSONRPCRequestSchema","JSONRPCResponseSchema","JSONRPCResultResponseSchema","JSONValueSchema","LegacyTitledEnumSchemaSchema","ListPromptsRequestSchema","ListPromptsResultSchema","ListResourcesRequestSchema","ListResourcesResultSchema","ListResourceTemplatesRequestSchema","ListResourceTemplatesResultSchema","ListRootsRequestSchema","ListRootsResultSchema","ListTasksRequestSchema","ListTasksResultSchema","ListToolsRequestSchema","ListToolsResultSchema","LoggingLevelSchema","LoggingMessageNotificationSchema","LoggingMessageNotificationParamsSchema","ModelHintSchema","ModelPreferencesSchema","MultiSelectEnumSchemaSchema","NotificationSchema","NumberSchemaSchema","PaginatedRequestSchema","PaginatedRequestParamsSchema","PaginatedResultSchema","PingRequestSchema","PrimitiveSchemaDefinitionSchema","ProgressSchema","ProgressNotificationSchema","ProgressNotificationParamsSchema","ProgressTokenSchema","PromptSchema","PromptArgumentSchema","PromptListChangedNotificationSchema","PromptMessageSchema","PromptReferenceSchema","ReadResourceRequestSchema","ReadResourceRequestParamsSchema","ReadResourceResultSchema","RelatedTaskMetadataSchema","RequestSchema","RequestIdSchema","RequestMetaSchema","ResourceSchema","ResourceContentsSchema","ResourceLinkSchema","ResourceListChangedNotificationSchema","ResourceRequestParamsSchema","ResourceTemplateSchema","ResourceTemplateReferenceSchema","ResourceUpdatedNotificationSchema","ResourceUpdatedNotificationParamsSchema","ResultMetaObjectSchema","ResultSchema","RoleSchema","RootSchema","RootsListChangedNotificationSchema","SamplingContentSchema","SamplingMessageSchema","SamplingMessageContentBlockSchema","ServerCapabilitiesSchema","ServerNotificationSchema","ServerRequestSchema","ServerResultSchema","SetLevelRequestSchema","SetLevelRequestParamsSchema","SingleSelectEnumSchemaSchema","StringSchemaSchema","SubscribeRequestSchema","SubscribeRequestParamsSchema","SubscriptionFilterSchema","SubscriptionsAcknowledgedNotificationSchema","SubscriptionsAcknowledgedNotificationParamsSchema","SubscriptionsListenRequestSchema","SubscriptionsListenRequestParamsSchema","SubscriptionsListenResultSchema","SubscriptionsListenResultMetaSchema","TaskAugmentedRequestParamsSchema","TaskCreationParamsSchema","TaskMetadataSchema","TaskSchema","TaskStatusSchema","TaskStatusNotificationSchema","TaskStatusNotificationParamsSchema","TextContentSchema","TextResourceContentsSchema","TitledMultiSelectEnumSchemaSchema","TitledSingleSelectEnumSchemaSchema","ToolSchema","ToolAnnotationsSchema","ToolChoiceSchema","ToolExecutionSchema","ToolListChangedNotificationSchema","ToolResultContentSchema","ToolUseContentSchema","UnsubscribeRequestSchema","UnsubscribeRequestParamsSchema","UntitledMultiSelectEnumSchemaSchema","UntitledSingleSelectEnumSchemaSchema"],gS={IdJagTokenExchangeResponseSchema:js,OAuthClientInformationFullSchema:Ds,OAuthClientInformationSchema:Zs,OAuthClientMetadataSchema:Us,OAuthClientRegistrationErrorSchema:fa,OAuthErrorResponseSchema:Ls,OAuthMetadataSchema:Fo,OAuthProtectedResourceMetadataSchema:Ns,OAuthTokenRevocationRequestSchema:ga,OAuthTokensSchema:qs,OpenIdProviderDiscoveryMetadataSchema:As,OpenIdProviderMetadataSchema:Ms},am={},cm={};function lm(e,t){let o=e.slice(0,-6);am[o]=t,cm[o]=(r)=>t.safeParse(r).success}for(let e of fS)lm(e,Qg[e]);for(let[e,t]of Object.entries(gS))lm(e,t);var SS=Object.freeze(am),_S=Object.freeze(cm);function yS(e){switch(e){case"initialize":case"notifications/initialized":return Bs(void 0);case"server/discover":return Bs(Xc);default:return}}var um=60000,bS=[Ct,yo,It,bo],vS=["inputResponses","requestState"];function Oh(e,t){let o=e.params;if(!Zc(o))return{message:e,lifted:{}};let r=o._meta,n=Zc(r)?bS.filter((d)=>(d in r)):[],i=t==="request"?vS.filter((d)=>(d in o)):[];if(n.length===0&&i.length===0)return{message:e,lifted:{}};let a={},c={...o};if(n.length>0&&Zc(r)){let d={},p={...r};for(let m of n)d[m]=r[m],delete p[m];if(a.envelope=d,Object.keys(p).length>0)c._meta=p;else delete c._meta}for(let d of i){if(d==="inputResponses")a.inputResponses=c[d];if(d==="requestState")a.requestState=c[d];delete c[d]}return{message:{...e,params:c},lifted:a}}function Nh(e,t){let o=e.validateResult(t,void 0);if(!o.ok&&o.reason==="not-in-era")return;return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(r){let n=e.validateResult(t,r);if(n.ok)return{value:n.value};return{issues:[{message:n.reason==="invalid"?n.message:`not-in-era: ${t}`}]}}}}}function dm(e){return()=>e}var zS=dm(void 0),wS,ol=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_customSchemaRequestMethods=new Set;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;static{wS=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??Vi,this.setNotificationHandler("notifications/cancelled",(t)=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",(t)=>{this._onprogress(t)}),this.setRequestHandler("ping",(t)=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let o=e.params??{};return{...e,params:{...o,_meta:{...t,...o._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new K(oe.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){if(e.params.requestId===void 0)return;this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,o,r,n=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:o,resetTimeoutOnProgress:n,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let o=Date.now()-t.startTime;if(t.maxTotalTimeout&&o>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new K(oe.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:o});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);if(t)clearTimeout(t.timeoutId),this._timeoutInfo.delete(e)}async connect(e){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{this._onclose()}};let o=this.transport?.onerror;this._transport.onerror=(n)=>{o?.(n),this._onerror(n)};let r=this._transport?.onmessage;this._transport.onmessage=(n,i)=>{if(r?.(n,i),Hc(n)||sm(n))this._onresponse(n);else if(rm(n))this._onrequest(n,i);else if(nm(n))this._onnotification(n,i);else this._onerror(Error(`Unknown message type: ${JSON.stringify(n)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let r of this._timeoutInfo.values())clearTimeout(r.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let o=new K(oe.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let r of e.values())r(o);for(let r of t.values())r.abort(o)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:o}=Oh(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=kh(t.classification);if(a!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${o.method}': classified as ${a} but this instance serves ${r.era}`));return}}if(Lc(o.method)&&!r.hasNotificationMethod(o.method))return;let n=this._notificationHandlers.get(o.method),i=this.fallbackNotificationHandler;if(n===void 0&&i===void 0)return;Promise.resolve().then(()=>n===void 0?i(o):n(o,r)).catch((a)=>this._onerror(Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:o,lifted:r}=Oh(e,"request"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let i=this._transport,a=(x,R,C)=>{let N={jsonrpc:"2.0",id:o.id,error:{code:x,message:R,...C!==void 0&&{data:C}}};i?.send(N).catch((O)=>this._onerror(Error(`Failed to send an error response: ${O}`)))};if(t?.classification!==void 0){let x=kh(t.classification);if(x!==n.era){this._onerror(Error(`Era mismatch on inbound request '${o.method}': classified as ${x} but this instance serves ${n.era}`));let R=t.classification.revision??x;a(M.UnsupportedProtocolVersion,`Unsupported protocol version: ${R}`,{supported:this._supportedProtocolVersions,requested:R});return}}if(jc(o.method)&&!n.hasRequestMethod(o.method)&&!($h(o.method)&&this._customSchemaRequestMethods.has(o.method))){a(M.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(c===void 0){a(M.MethodNotFound,"Method not found");return}let d=n.checkInboundEnvelope(r);if(d!==void 0){a(M.InvalidParams,d);return}let p=(x,R)=>this._notificationViaCodec(this._resolveOutboundCodec(x.method),x,{...R,relatedRequestId:o.id}),m=(x,R,C)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(x.method),x,R,{...C,relatedRequestId:o.id}),f=new AbortController;this._requestHandlerAbortControllers.set(o.id,f);let y=r.inputResponses===void 0?void 0:RS(r.inputResponses),S={sessionId:i?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...y!==void 0&&{inputResponses:y.accepted},...y!==void 0&&y.droppedKeys.length>0&&{droppedInputResponseKeys:y.droppedKeys},requestState:r.requestState===void 0?zS:dm(r.requestState),signal:f.signal,send:(x,R,C)=>{let N=this._resolveOutboundCodec(x.method);if(this._assertOutboundRequestInEra(N,x.method),Fc(R))return m(x,R,C);let O=Nh(N,x.method);if(O===void 0)throw TypeError(`'${x.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return m(x,O,R)},notify:p},http:t?.authInfo?{authInfo:t.authInfo}:void 0},w=this.buildContext(S,t);Promise.resolve().then(()=>c(o,w)).then(async(x)=>{if(f.signal.aborted)return;let R;try{R=n.encodeResult(o.method,x,this._outboundServerInfo())}catch(N){this._onerror(Error(`Failed to encode result for ${o.method}: ${N}`)),a(M.InternalError,"Internal error");return}let C={result:R,jsonrpc:"2.0",id:o.id};await i?.send(C)},async(x)=>{if(f.signal.aborted)return;let R=Number.isSafeInteger(x.code)?x.code:M.InternalError,C={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(R),message:x.message??"Internal error",...x.data!==void 0&&{data:x.data}}};await i?.send(C)}).catch((x)=>this._onerror(Error(`Failed to send response: ${x}`))).finally(()=>{if(this._requestHandlerAbortControllers.get(o.id)===f)this._requestHandlerAbortControllers.delete(o.id)})}_onprogress(e){let{progressToken:t,...o}=e.params,r=Number(t),n=this._progressHandlers.get(r);if(!n){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(r),a=this._timeoutInfo.get(r);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(c){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),i(c);return}n(o)}_onresponse(e){let t=Number(e.id),o=this._responseHandlers.get(t);if(o===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}if(this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Hc(e))o(e);else o(re.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,o){let r=this._resolveOutboundCodec(e.method);if(Fc(t)){if(!$h(e.method))this._assertOutboundRequestInEra(r,e.method);return this._requestWithSchemaViaCodec(r,e,t,o)}this._assertOutboundRequestInEra(r,e.method);let n=Nh(r,e.method);if(n===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,n,t)}_negotiatedWireCodec(){return Bs(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=yS(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(jc(t)&&!e.hasRequestMethod(t))throw new K(oe.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,o){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,o)}_requestWithSchemaViaCodec(e,t,o,r){let{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a,headers:c}=r??{},d=Date.now(),p,m;return new Promise((f,y)=>{let S=(j)=>{y(j)};if(!this._transport){S(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(j){S(j);return}if(r?.signal?.aborted){let j=r.signal.reason;throw j instanceof K?j:new K(oe.RequestTimeout,String(j))}let w=e.era===Xc&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,x=this._requestMessageId++;m=x;let R={...t,jsonrpc:"2.0",id:x};if(r?.onprogress)this._progressHandlers.set(x,r.onprogress),R.params={...t.params,_meta:{...t.params?._meta,progressToken:x}};let C=this._envelopeOutbound(R),N=!1,O=(j)=>{if(N)return;if(this._progressHandlers.delete(x),w===void 0){if(t.method!=="initialize")this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:x,reason:String(j)}}),{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a}).catch((V)=>this._onerror(Error(`Failed to send cancellation: ${V}`)))}else w.abort();y(j instanceof K?j:new K(oe.RequestTimeout,String(j)))};this._responseHandlers.set(x,(j)=>{if(r?.signal?.aborted)return;if(N=!0,j instanceof Error)return y(j);let V;try{V=e.decodeResult(t.method,j.result)}catch(Y){return y(Y instanceof Error?Y:Error(String(Y)))}if(V.kind==="invalid")return y(V.error);if(V.kind==="input_required"){if(r?.allowInputRequired===!0)return f(xS(V));let Y={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:d,retry:(ge,dt)=>this._requestWithSchemaViaCodec(e,ge===void 0?{method:t.method}:{method:t.method,params:ge},o,dt)};return f(this._resolveNonCompleteResult(V,Y))}let ae=V.result;Uc(o,ae).then((Y)=>{if(Y.success)f(Y.data);else y(new K(oe.InvalidResult,`Invalid result for ${t.method}: ${Y.error}`))},y)}),p=()=>O(r?.signal?.reason),r?.signal?.addEventListener("abort",p,{once:!0});let q=r?.timeout??um,L=()=>O(new K(oe.RequestTimeout,"Request timed out",{timeout:q}));this._setupTimeout(x,q,r?.maxTotalTimeout,L,r?.resetTimeoutOnProgress??!1),this._transport.send(C,{relatedRequestId:n,resumptionToken:i,onresumptiontoken:a,headers:c,requestSignal:w?.signal}).catch((j)=>{this._progressHandlers.delete(x),y(j)})}).finally(()=>{if(p)r?.signal?.removeEventListener("abort",p);if(m!==void 0)this._responseHandlers.delete(m),this._cleanupTimeout(m)})}async notification(e,t){return await this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,o){if(!this._transport)throw new K(oe.NotConnected,"Not connected");if(Lc(t.method)&&!e.hasNotificationMethod(t.method))throw new K(oe.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&o?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(t.method),!this._transport)return;this._transport?.send(r,o).catch((n)=>this._onerror(n))});return}await this._transport.send(r,o)}setRequestHandler(e,t,o){this.assertRequestHandlerCapability(e);let r;if(typeof t==="function"){if(!jc(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,i)=>{let a=this._negotiatedWireCodec(),c=a.validateRequest(e,n);if(!c.ok&&c.reason==="not-in-era")c=a.validateInputRequest(e,n);if(!c.ok){if(c.reason==="not-in-era")throw new re(M.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(c.message)}return Promise.resolve(t(c.value,i))}}else if(o)r=async(n,i)=>{let a=await Uc(t.params,{...n.params});if(!a.success)throw new re(M.InvalidParams,`Invalid params for ${e}: ${a.error}`);return o(a.data,i)};else throw TypeError("setRequestHandler: handler is required");if(typeof t==="function")this._customSchemaRequestMethods.delete(e);else this._customSchemaRequestMethods.add(e);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e),this._customSchemaRequestMethods.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,o){if(typeof t==="function"){if(!Lc(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(r,n)=>{let i=n.validateNotification(e,r);if(!i.ok){if(i.reason==="not-in-era")throw new re(M.InternalError,`No wire schema for ${e} in the resolved era`);throw Error(i.message)}return Promise.resolve(t(i.value))});return}if(!o)throw TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async(r)=>{let n=await Uc(t.params,{...r.params});if(!n.success)throw new re(M.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Zc(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function Mh(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function RS(e){let t={},o=[];if(!Mh(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!Mh(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function xS(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}/*!
|
|
65
|
+
* content-type
|
|
66
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
67
|
+
* MIT Licensed
|
|
68
|
+
*/var PS=fl((e)=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,o=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=n;function n(c){if(!c)throw TypeError("argument string is required");var d=typeof c==="object"?i(c):c;if(typeof d!=="string")throw TypeError("argument string is required to be a string");var p=d.indexOf(";"),m=p!==-1?d.slice(0,p).trim():d.trim();if(!r.test(m))throw TypeError("invalid media type");var f=new a(m.toLowerCase());if(p!==-1){var y,S,w;t.lastIndex=p;while(S=t.exec(d)){if(S.index!==p)throw TypeError("invalid parameter format");if(p+=S[0].length,y=S[1].toLowerCase(),w=S[2],w.charCodeAt(0)===34){if(w=w.slice(1,-1),w.indexOf("\\")!==-1)w=w.replace(o,"$1")}f.parameters[y]=w}if(p!==d.length)throw TypeError("invalid parameter format")}return f}function i(c){var d;if(typeof c.getHeader==="function")d=c.getHeader("content-type");else if(typeof c.headers==="object")d=c.headers&&c.headers["content-type"];if(typeof d!=="string")throw TypeError("content-type header is missing from object");return d}function a(c){this.parameters=Object.create(null),this.type=c}}),Ub=Sl(PS(),1);var Yb=typeof self<"u"&&self.location&&self.location.origin!=="null"?new URL(self.location.origin+self.location.pathname+location.search):new URL("https://github.com/cfworker");var TS=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,ES=[0,31,28,31,30,31,30,31,31,30,31,30,31],kS=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,$S=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,CS=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,IS=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,OS=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,NS=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,MS=/^(?:\/(?:[^~/]|~0|~1)*)*$/,AS=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qS=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,jS=(e)=>{if(e[0]==='"')return!1;let[t,o,...r]=e.split("@");if(!t||!o||r.length!==0||t.length>64||o.length>253)return!1;if(t[0]==="."||t.endsWith(".")||t.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(o)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(t))return!1;return o.split(".").every((n)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(n))},LS=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,US=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,ZS=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Ie(e){return e.test.bind(e)}var Qb={date:pm,time:hm.bind(void 0,!1),"date-time":HS,duration:ZS,uri:BS,"uri-reference":Ie(CS),"uri-template":Ie(IS),url:Ie(OS),email:jS,hostname:Ie($S),ipv4:Ie(LS),ipv6:Ie(US),regex:WS,uuid:Ie(NS),"json-pointer":Ie(MS),"json-pointer-uri-fragment":Ie(AS),"relative-json-pointer":Ie(qS)};function DS(e){return e%4===0&&(e%100!==0||e%400===0)}function pm(e){let t=e.match(TS);if(!t)return!1;let o=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(r==2&&DS(o)?29:ES[r])}function hm(e,t){let o=t.match(kS);if(!o)return!1;let r=+o[1],n=+o[2],i=+o[3],a=!!o[5];return(r<=23&&n<=59&&i<=59||r==23&&n==59&&i==60)&&(!e||a)}var VS=/t|\s/i;function HS(e){let t=e.split(VS);return t.length==2&&pm(t[0])&&hm(!0,t[1])}var FS=/\/|:/,JS=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function BS(e){return FS.test(e)&&JS.test(e)}var GS=/[^\\]\\Z/;function WS(e){if(GS.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(t){return!1}}var YS;YS=globalThis.crypto;var Ws=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return fe(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fe(this,e)}constructor(e){super(e);this.name=new.target.name,Jt(this,new.target)}},Bv=class extends Ws{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.IssuerMismatchError"})}kind;expected;received;constructor(e,t,o){super(`Issuer mismatch in ${e==="metadata"?"authorization server metadata (RFC 8414 §3.3)":"authorization response (RFC 9207)"}: expected ${JSON.stringify(t)}, received ${JSON.stringify(o)}`);this.kind=e,this.expected=t,this.received=o}},Gv=class extends Ws{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.RegistrationRejectedError"})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`);this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},Wv=class extends Ws{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsecureTokenEndpointError"})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / *.localhost / 127.0.0.1 / ::1 are exempt).`);this.tokenEndpoint=e}},Kv=class extends Ws{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.AuthorizationServerMismatchError"})}constructor(e,t){super(`Authorization server mismatch: credentials are bound to ${JSON.stringify(e)} but this call resolved ${JSON.stringify(t)}; refusing to present them to a different authorization server`);this.recordedIssuer=e,this.currentIssuer=t}},Yv=class extends Ws{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.InsufficientScopeError"})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:""}`);this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}};var Qv=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return fe(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fe(this,e)}constructor(e){super(e??"Unauthorized");this.name="UnauthorizedError",Jt(this,new.target)}};var Xv=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return fe(this,e)}static isInstance(e){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fe(this,e)}constructor(e,t,o){super(`SSE error: ${t}`);this.code=e,this.event=o,Jt(this,new.target)}};class ym{_eventSlots=new Map;setHandler(e,t){let o=this._ensureEventSlot(e);if(o.onHandler&&t)console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`);o.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let o=this._eventSlots.get(e);if(!o)return;let r=o.listeners.indexOf(t);if(r!==-1)o.listeners.splice(r,1)}dispatch(e,t){let o=this._eventSlots.get(e);if(!o)return;o.onHandler?.(t);for(let r of[...o.listeners])r(t)}_ensureEventSlot(e){let t=this._eventSlots.get(e);if(!t)t={listeners:[]},this._eventSlots.set(e,t);return t}}class bm{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}}var mm=new Set;function fm(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!=="string")return;let i=n.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";if(!mm.has(a))mm.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${i}", { params: Schema.shape.params }, handler).`);let c=r;return[i,{params:n.params},e==="request"?(d,p)=>c({method:i,params:d},QS(p)):(d)=>c({method:i,params:d})]}function QS(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var XS="2026-01-26";var e_="ui/notifications/tool-input-partial";class vm{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=(o)=>{if(t&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let r=At.safeParse(o.data);if(r.success)console.debug("Parsed message",r.data),this.onmessage?.(r.data);else if(o.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",r.error.message,o);else console.error("Failed to parse message",r.error.message,o),this.onerror?.(Error("Invalid JSON-RPC message received: "+r.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(e,t){if(e.method!==e_)console.debug("Sending message",e);this.eventTarget.postMessage(e,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var t_=v([u("light"),u("dark")]).describe("Color theme preference for the host environment."),Ks=v([u("inline"),u("fullscreen"),u("pip")]).describe("Display mode for UI presentation."),o_=v([u("--color-background-primary"),u("--color-background-secondary"),u("--color-background-tertiary"),u("--color-background-inverse"),u("--color-background-ghost"),u("--color-background-info"),u("--color-background-danger"),u("--color-background-success"),u("--color-background-warning"),u("--color-background-disabled"),u("--color-text-primary"),u("--color-text-secondary"),u("--color-text-tertiary"),u("--color-text-inverse"),u("--color-text-ghost"),u("--color-text-info"),u("--color-text-danger"),u("--color-text-success"),u("--color-text-warning"),u("--color-text-disabled"),u("--color-border-primary"),u("--color-border-secondary"),u("--color-border-tertiary"),u("--color-border-inverse"),u("--color-border-ghost"),u("--color-border-info"),u("--color-border-danger"),u("--color-border-success"),u("--color-border-warning"),u("--color-border-disabled"),u("--color-ring-primary"),u("--color-ring-secondary"),u("--color-ring-inverse"),u("--color-ring-info"),u("--color-ring-danger"),u("--color-ring-success"),u("--color-ring-warning"),u("--font-sans"),u("--font-mono"),u("--font-weight-normal"),u("--font-weight-medium"),u("--font-weight-semibold"),u("--font-weight-bold"),u("--font-text-xs-size"),u("--font-text-sm-size"),u("--font-text-md-size"),u("--font-text-lg-size"),u("--font-heading-xs-size"),u("--font-heading-sm-size"),u("--font-heading-md-size"),u("--font-heading-lg-size"),u("--font-heading-xl-size"),u("--font-heading-2xl-size"),u("--font-heading-3xl-size"),u("--font-text-xs-line-height"),u("--font-text-sm-line-height"),u("--font-text-md-line-height"),u("--font-text-lg-line-height"),u("--font-heading-xs-line-height"),u("--font-heading-sm-line-height"),u("--font-heading-md-line-height"),u("--font-heading-lg-line-height"),u("--font-heading-xl-line-height"),u("--font-heading-2xl-line-height"),u("--font-heading-3xl-line-height"),u("--border-radius-xs"),u("--border-radius-sm"),u("--border-radius-md"),u("--border-radius-lg"),u("--border-radius-xl"),u("--border-radius-full"),u("--border-width-regular"),u("--shadow-hairline"),u("--shadow-sm"),u("--shadow-md"),u("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),r_=b(o_.describe(`Style variables for theming MCP apps.
|
|
66
69
|
|
|
67
70
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
68
71
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
69
72
|
|
|
70
73
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
71
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
74
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),v([s(),Ic()]).describe(`Style variables for theming MCP apps.
|
|
72
75
|
|
|
73
76
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
74
77
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -80,10 +83,10 @@ Individual style keys are optional - hosts may provide any subset of these value
|
|
|
80
83
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
81
84
|
|
|
82
85
|
Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
|
|
83
|
-
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),
|
|
86
|
+
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),gz=l({method:u("ui/open-link"),params:l({url:s().describe("URL to open in the host's browser")})}),n_=l({isError:z().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),s_=l({isError:z().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),i_=l({isError:z().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),Sz=l({method:u("ui/notifications/sandbox-proxy-ready"),params:l({})}),rl=l({connectDomains:h(s()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
|
|
84
87
|
|
|
85
88
|
- Maps to CSP \`connect-src\` directive
|
|
86
|
-
- Empty or omitted
|
|
89
|
+
- Empty or omitted → no network connections (secure default)`),resourceDomains:h(s()).optional().describe("Origins for static resources (images, scripts, stylesheets, fonts, media).\n\n- Maps to CSP `img-src`, `script-src`, `style-src`, `font-src`, `media-src` directives\n- Wildcard subdomains supported: `https://*.example.com`\n- Empty or omitted → no network resources (secure default)"),frameDomains:h(s()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:h(s()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),nl=l({camera:l({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:l({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:l({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:l({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),_z=l({method:u("ui/notifications/size-changed"),params:l({width:_().optional().describe("New width in pixels."),height:_().optional().describe("New height in pixels.")})}),a_=l({method:u("ui/notifications/tool-input"),params:l({arguments:b(s(),P().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),c_=l({method:u("ui/notifications/tool-input-partial"),params:l({arguments:b(s(),P().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),l_=l({method:u("ui/notifications/tool-cancelled"),params:l({reason:s().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),u_=l({fonts:s().optional()}),d_=l({variables:r_.optional().describe("CSS variables for theming the app."),css:u_.optional().describe("CSS blocks that apps can inject.")}),p_=l({method:u("ui/resource-teardown"),params:l({})}),h_=b(s(),P()),gm=l({text:l({}).optional().describe("Host supports text content blocks."),image:l({}).optional().describe("Host supports image content blocks."),audio:l({}).optional().describe("Host supports audio content blocks."),resource:l({}).optional().describe("Host supports resource content blocks."),resourceLink:l({}).optional().describe("Host supports resource link content blocks."),structuredContent:l({}).optional().describe("Host supports structured content.")}),yz=l({method:u("ui/notifications/request-teardown"),params:l({}).optional()}),m_=l({experimental:b(s(),b(s(),Zi()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:l({}).optional().describe("Host supports opening external URLs."),downloadFile:l({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:l({listChanged:z().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:l({listChanged:z().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:l({}).optional().describe("Host accepts log messages."),sandbox:l({permissions:nl.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:rl.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:gm.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:gm.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:l({tools:l({}).optional().describe("Host supports tool use via `tools` and `toolChoice` parameters.")}).optional().describe("Host supports LLM sampling (sampling/createMessage) from the view.\nMirrors the MCP `ClientCapabilities.sampling` shape so hosts can pass it through.")}),f_=l({experimental:b(s(),b(s(),Zi()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:l({listChanged:z().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:h(Ks).optional().describe("Display modes the app supports.")}),bz=l({method:u("ui/notifications/initialized"),params:l({}).optional()}),vz=l({csp:rl.optional().describe("Content Security Policy configuration for UI resources."),permissions:nl.optional().describe("Sandbox permissions requested by the UI resource."),domain:s().optional().describe(`Dedicated origin for view sandbox.
|
|
87
90
|
|
|
88
91
|
Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
|
|
89
92
|
|
|
@@ -91,28 +94,19 @@ Useful when views need stable, dedicated origins for OAuth callbacks, CORS polic
|
|
|
91
94
|
- Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
|
|
92
95
|
- URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
|
|
93
96
|
|
|
94
|
-
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:
|
|
97
|
+
If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:z().optional().describe(`Visual boundary preference - true if view prefers a visible border.
|
|
95
98
|
|
|
96
99
|
Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
|
|
97
100
|
|
|
98
101
|
- \`true\`: request visible border + background
|
|
99
102
|
- \`false\`: request no visible border + background
|
|
100
|
-
- omitted: host decides border`)}),
|
|
103
|
+
- omitted: host decides border`)}),zz=l({method:u("ui/request-display-mode"),params:l({mode:Ks.describe("The display mode being requested.")})}),g_=l({mode:Ks.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),S_=v([u("model"),u("app")]).describe("Tool visibility scope - who can access the tool."),wz=l({resourceUri:s().optional(),visibility:h(S_).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
101
104
|
- "model": Tool visible to and callable by the agent
|
|
102
|
-
- "app": Tool callable by the app from this server only`),csp:
|
|
103
|
-
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:d.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:d.string().optional().describe("User's timezone in IANA format."),userAgent:d.string().optional().describe("Host application identifier."),platform:d.union([d.literal("web"),d.literal("desktop"),d.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:d.object({touch:d.boolean().optional().describe("Whether the device supports touch input."),hover:d.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:d.object({top:d.number().describe("Top safe area inset in pixels."),right:d.number().describe("Right safe area inset in pixels."),bottom:d.number().describe("Bottom safe area inset in pixels."),left:d.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),ew=d.object({method:d.literal("ui/notifications/host-context-changed"),params:C_.describe("Partial context update containing only changed fields.")}),cP=d.object({method:d.literal("ui/update-model-context"),params:d.object({content:d.array(We).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:d.record(d.string(),d.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),lP=d.object({method:d.literal("ui/initialize"),params:d.object({appInfo:Be.describe("App identification (name and version)."),appCapabilities:Kz.describe("Features and capabilities this app provides."),protocolVersion:d.string().describe("Protocol version this app supports.")})}),tw=d.object({protocolVersion:d.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Be.describe("Host application identification and version."),hostCapabilities:Wz.describe("Features and capabilities provided by the host."),hostContext:C_.describe("Rich context about the host environment.")}).passthrough(),ow={target:"draft-2020-12"};async function E_(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](ow);throw Error(`Schema (vendor: ${o.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function $_(e,t,o=""){let r=await e["~standard"].validate(t);if(r.issues){let n=r.issues.map(s=>{let i=s.path?.map(c=>typeof c=="object"?c.key:c).join(".");return i?`${i}: ${s.message}`:s.message}).join("; ");throw Error(o+n)}return r.value}function rw(e,t){let o={...e,...t};return t.experimental!==void 0&&(o.experimental={...e.experimental,...t.experimental}),t.tools!==void 0&&(o.tools={...e.tools,...t.tools}),o}var Yl=class e extends Sf{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new _f;_methods=new yf;setRequestHandler=(...t)=>{let[o,...r]=T_("request",t)??t;this._methods.claim(o,"setRequestHandler"),super.setRequestHandler.call(this,o,...r)};setNotificationHandler=(...t)=>{let[o,...r]=T_("notification",t)??t;this._methods.claim(o,"setNotificationHandler"),super.setNotificationHandler.call(this,o,...r)};removeRequestHandler=t=>{this._methods.release(t),super.removeRequestHandler(t)};removeNotificationHandler=t=>{this._methods.release(t),super.removeNotificationHandler(t)};replaceRequestHandler=(t,...o)=>{this._methods.replace(t),super.setRequestHandler.call(this,t,...o)};_assertInitialized(t){if(this._initializedSent)return;let o=`[ext-apps] App.${t}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(o);console.warn(`${o}. This will throw in a future release.`)}eventSchemas={toolinput:Dz,toolinputpartial:Vz,toolresult:Xz,toolcancelled:Hz,hostcontextchanged:ew};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(t){if(!e.ONE_SHOT_EVENTS.has(t)||this._everHadListener.has(t)||(this._everHadListener.add(t),!this._initializedSent))return;let o=`[ext-apps] "${String(t)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(o);console.warn(o)}setEventHandler(t,o){o&&this._assertHandlerTiming(t),this._ensureEventSlot(t),this._events.setHandler(t,o)}addEventListener(t,o){this._assertHandlerTiming(t),this._ensureEventSlot(t),this._events.addEventListener(t,o)}removeEventListener(t,o){this._events.removeEventListener(t,o)}_ensureEventSlot(t){if(this._registeredEvents.has(t))return;let o=this.eventSchemas[t];if(!o)throw Error(`Unknown event: ${String(t)}`);this.setNotificationHandler(o.shape.method.value,{params:o.shape.params},r=>{let n=r;t==="hostcontextchanged"&&(this._hostContext={...this._hostContext,...n}),this._events.dispatch(t,n)}),this._registeredEvents.add(t)}getEventHandler(t){return this._events.getHandler(t)}warnIfRequestHandlerReplaced(t,o,r){o&&r&&console.warn(`[MCP Apps] ${t} handler replaced. Previous handler will no longer be called.`)}constructor(t,o={},r={autoResize:!0}){super(r),this._appInfo=t,this._appCapabilities=o,this.options=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!r.allowUnsafeEval&&d.config({jitless:!0}),this.replaceRequestHandler("ping",n=>(console.log("Received ping:",n.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(t){return t}registerAppCapabilities(t){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=rw(this._appCapabilities,t)}registerTool(t,o,r){if(this._registeredTools[t])throw Error(`Tool ${t} is already registered`);let n=this,s=()=>{n._initializedSent&&n._appCapabilities.tools?.listChanged&&n.sendToolListChanged()},i=o.inputSchema!==void 0,c={title:o.title,description:o.description,inputSchema:o.inputSchema,outputSchema:o.outputSchema,annotations:o.annotations,_meta:o._meta,enabled:!0,enable(){this.enabled=!0,s()},disable(){this.enabled=!1,s()},update(l){Object.assign(this,l),s()},remove(){n._registeredTools[t]===c&&(delete n._registeredTools[t],s())},handler:async(l,u)=>{if(!c.enabled)throw Error(`Tool ${t} is disabled`);let h;if(i){let f=c.inputSchema,y=f?await $_(f,l??{},`Invalid input for tool ${t}: `):l??{};h=await r(y,u)}else h=await r(u);return c.outputSchema&&!h.isError&&(h.structuredContent=await $_(c.outputSchema,h.structuredContent,`Invalid output for tool ${t}: `)),h}};return this._registeredTools[t]=c,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),s(),c}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){this._toolHandlersInitialized||(this._toolHandlersInitialized=!0,this.oncalltool=async(t,o)=>{let r=this._registeredTools[t.name];if(!r)throw Error(`Tool ${t.name} not found`);return r.handler(t.arguments,o)},this.onlisttools=async(t,o)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([r,n])=>n.enabled).map(async([r,n])=>{let s={name:r,title:n.title,description:n.description,inputSchema:n.inputSchema?await E_(n.inputSchema,"input"):{type:"object",properties:{}}};return n.outputSchema&&(s.outputSchema=await E_(n.outputSchema,"output")),n.annotations&&(s.annotations=n.annotations),n._meta&&(s._meta=n._meta),s}))}))}async sendToolListChanged(t={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:t})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(t){this.setEventHandler("toolinput",t)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(t){this.setEventHandler("toolinputpartial",t)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(t){this.setEventHandler("toolresult",t)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(t){this.setEventHandler("toolcancelled",t)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(t){this.setEventHandler("hostcontextchanged",t)}_onteardown;get onteardown(){return this._onteardown}set onteardown(t){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,t),this._onteardown=t,this.replaceRequestHandler("ui/resource-teardown",{params:Bz.shape.params,result:Gz},(o,r)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(o,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler("tools/call",(o,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(o.params,r)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(t){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,t),this._onlisttools=t,this.replaceRequestHandler("tools/list",(o,r)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(o.params,r)})}assertCapabilityForMethod(t){switch(t){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${t})`);break}}assertRequestHandlerCapability(t){switch(t){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${t})`);return;default:return}}assertNotificationCapability(t){}async callServerTool(t,o){if(this._assertInitialized("callServerTool"),typeof t=="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${t}"). Did you mean: callServerTool({ name: "${t}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:t},{onprogress:()=>{},resetTimeoutOnProgress:!0,...o})}async readServerResource(t,o){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:t},o)}async listServerResources(t,o){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:t},o)}async createSamplingMessage(t,o){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:t},o)}sendMessage(t,o){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:t},Zz,o)}sendLog(t){return this.notification({method:"notifications/message",params:t})}updateModelContext(t,o){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:t},Ot,o)}openLink(t,o){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},Lz,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},Uz,o)}requestTeardown(t={}){return this.notification({method:"ui/notifications/request-teardown",params:t})}requestDisplayMode(t,o){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:t},Yz,o)}sendSizeChanged(t){return this.notification({method:"ui/notifications/size-changed",params:t})}setupSizeChangedNotifications(){let t=!1,o=0,r=0,n=()=>{t||(t=!0,requestAnimationFrame(()=>{t=!1;let i=document.documentElement,c=i.style.height;i.style.height="max-content";let l=Math.ceil(i.getBoundingClientRect().height);i.style.height=c;let u=Math.ceil(window.innerWidth);(u!==o||l!==r)&&(o=u,r=l,this.sendSizeChanged({width:u,height:l}))}))};n();let s=new ResizeObserver(n);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new bf(window.parent,window.parent),o){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(t);let r=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:Nz}},tw,o);if(r===void 0)throw Error(`Server sent invalid initialize result: ${r}`);this._hostCapabilities=r.hostCapabilities,this._hostInfo=r.hostInfo,this._hostContext=r.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize&&this.setupSizeChangedNotifications()}catch(r){throw this.close(),r}}};function I_(e,t){let o=[],r=new Set;function n(s){if(r.has(s))return;r.add(s);let i=e.get(s);if(!i)throw new Error(`Missing preview dependency metadata: ${s}`);for(let c of[...i.imports,...i.styles,...i.references])n(c);o.push(s)}return n(t),o}function O_(e,t){if(!e||e.revision===t.revision)return[];let o=(r,n)=>{let s=new Map(Object.entries(r.assets));return JSON.stringify(I_(s,n.module).map(i=>[i,s.get(i)]))};return t.scenarios.filter(r=>{let n=e.scenarios.find(s=>s.id===r.id);return!n||o(e,n)!==o(t,r)}).map(r=>r.id)}var Ql=class{constructor(t){this.read=t,this.records=new Map,this.bytes=new Map,this.urls=new Map,this.styles=new Map,this.styleReady=new Map,this.revisions=new Set,this.importing=Promise.resolve(),this.generation=0,this.prefetchGeneration=0,this.closed=!1,globalThis.__dsPreviewImport=o=>this.importModule(o)}register(t){if(t.schemaVersion!==1||!Array.isArray(t.scenarios)||!t.assets||typeof t.revision!="string")throw new Error("Unsupported preview manifest. Rebuild previews with the installed ADS version.");if(this.revisions.add(t.revision),this.revisions.size>20)throw Object.assign(new Error("Reopen the preview to release modules retained across 20 build revisions."),{code:"ADS_PREVIEW_REOPEN"});for(let[o,r]of Object.entries(t.assets)){if(!/^ads:\/\/assets\/[a-f0-9]{64}\.[a-z0-9]+$/.test(o)||!/^sha256:[a-f0-9]{64}$/.test(r.digest)||!["imports","dynamicImports","styles","references"].every(n=>Array.isArray(r[n])&&r[n].every(s=>Object.hasOwn(t.assets,s))))throw new Error("Invalid preview dependency graph.");if(this.records.has(o)&&this.records.get(o).digest!==r.digest)throw new Error("An immutable preview resource changed its content.");this.records.set(o,r)}}async resource(t){if(!this.bytes.has(t)){let o=(async()=>{let r=this.records.get(t);if(!r)throw new Error(`Unknown preview dependency: ${t}`);let n;try{n=await this.read(t)}catch(u){throw Object.assign(new Error(`Preview resource read failed for ${t}: ${u.message}`,{cause:u}),{code:"ADS_RESOURCE_READ",category:"transport",resourceUri:t})}if(this.closed)throw new Error("The preview App was closed.");let s=n.contents.find(u=>u.uri===t);if(!s)throw Object.assign(new Error(`Missing preview dependency: ${t}`),{code:"ADS_RESOURCE_CONTENT",category:"build",resourceUri:t});let i=typeof s.text=="string"?new TextEncoder().encode(s.text):Uint8Array.from(atob(s.blob),u=>u.charCodeAt(0)),c=await crypto.subtle.digest("SHA-256",i),l="sha256:"+[...new Uint8Array(c)].map(u=>u.toString(16).padStart(2,"0")).join("");if(i.length!==r.size||l!==r.digest)throw Object.assign(new Error("Preview resource integrity check failed. Rebuild and reopen the preview."),{code:"ADS_RESOURCE_INTEGRITY",category:"build",resourceUri:t});return i})();this.bytes.set(t,o),o.catch(()=>this.bytes.delete(t))}return this.bytes.get(t)}closure(t){return I_(this.records,t)}async prefetch(t,o){if(this.closed)return;this.register(t);let r=++this.prefetchGeneration,n=new Set,s=[],i=0;for(let h of o){let f=t.scenarios.find(v=>v.id===h);if(!f)continue;let y=this.closure(f.module).filter(v=>!this.bytes.has(v)&&!n.has(v)),_=y.reduce((v,k)=>v+this.records.get(k).size,0);if(!(i+_>16*1024*1024||n.size+y.length>256)){i+=_,s.push(h);for(let v of y)n.add(v)}}let c=[...n],l=0,u=async()=>{for(;!this.closed&&r===this.prefetchGeneration&&l<c.length;)await this.resource(c[l++])};return await Promise.all(Array.from({length:Math.min(3,c.length)},u)),{scenarios:s,resources:c.length}}async materialize(t){let o=this.closure(t);await Promise.all(o.map(n=>this.resource(n)));let r={};for(let n of o){if(this.closed)throw new Error("The preview App was closed.");if(this.urls.has(n))continue;let s=this.records.get(n),i=await this.resource(n);if(s.kind==="module"||s.mimeType==="text/css"){let l=new TextDecoder().decode(i);for(let u of s.references){let h=this.urls.get(u);if(!h)throw new Error("Unsupported cyclic asset reference.");l=l.replaceAll(u,h)}i=l}let c=URL.createObjectURL(new Blob([i],{type:s.mimeType}));this.urls.set(n,c),s.kind==="module"&&(r[n]=c)}if(Object.keys(r).length){let n=document.createElement("script");n.type="importmap",n.textContent=JSON.stringify({imports:r}),document.head.append(n)}return o}async importModule(t){let o=this.importing.then(()=>this.materialize(t));this.importing=o.catch(()=>{});let r=await o;for(let n of r){if(this.records.get(n).mimeType!=="text/css")continue;if(this.styles.has(n)){await this.styleReady.get(n);continue}let i=document.createElement("link");i.rel="stylesheet",i.href=this.urls.get(n),this.styles.set(n,i);let c=new Promise((l,u)=>{i.onload=l,i.onerror=()=>u(new Error("The host CSP blocked a preview stylesheet."))});this.styleReady.set(n,c),document.head.append(i);try{await c}catch(l){throw i.remove(),this.styles.delete(n),this.styleReady.delete(n),l}}try{return await import(t)}catch(n){throw new Error(`Preview module import failed for ${t}: ${n.message}. Inspect the App resource bridge, browser network/CSP diagnostics and current build.`,{cause:n})}}async mount(t,o,r){let n=++this.generation;this.register(t);let s=t.scenarios.find(h=>h.id===o);if(!s)throw new Error("The selected scenario is no longer registered.");let i=JSON.stringify(this.closure(s.module).map(h=>[h,this.records.get(h)]));if(this.mounted?.id===o&&this.mounted.container===r&&this.mounted.signature===i)return!0;let c=await this.importModule(s.module);if(n!==this.generation)return!1;let l=this.unmount;if(this.unmount=void 0,this.mounted=void 0,await l?.(),n!==this.generation||this.closed)return!1;r.replaceChildren();let u=new Set(this.closure(s.module));for(let[h,f]of this.styles)u.has(h)||(f.remove(),this.styles.delete(h),this.styleReady.delete(h));for(let h of this.closure(s.module))this.styles.has(h)&&document.head.append(this.styles.get(h));if(typeof c.mount!="function")throw new Error("The compiled scenario has no mount adapter.");if(this.unmount=c.mount(r),typeof this.unmount!="function")throw new Error("The scenario mount adapter must return an unmount callback.");return this.mounted={id:o,container:r,signature:i},!0}async dispose(){if(!this.closed){this.closed=!0,++this.generation,++this.prefetchGeneration,await this.unmount?.(),this.mounted=void 0;for(let t of this.styles.values())t.remove();for(let t of this.urls.values())URL.revokeObjectURL(t);this.styles.clear(),this.styleReady.clear(),this.urls.clear(),this.bytes.clear(),this.records.clear(),delete globalThis.__dsPreviewImport}}};function N_(e){return Array.isArray(e)&&e.length>0&&e.every(t=>t&&typeof t=="object"&&typeof t.token=="string"&&/^--[\w-]+$/.test(t.token)&&typeof t.property=="string"&&/^-?[a-z][a-z0-9-]*$/.test(t.property)&&typeof t.probe=="string"&&t.probe.trim().length>0)&&new Set(e.map(t=>`${t.token}:${t.property}`)).size===e.length}function A_(e,t){let o=t.getComputedStyle(e),r=e.getBoundingClientRect();if(o.display==="none"||o.visibility!=="visible"||!e.getClientRects().length||!(r.width||r.height))return!1;for(let n=e;n;n=n.parentElement)if(Number(t.getComputedStyle(n).opacity)===0)return!1;return!0}function M_(e,t){if(!N_(t))return{ok:!1,diagnostics:["Token preview needs explicit { token, property, probe } samples from the project fixture. Rebuild with the current compiler."]};let o=e.ownerDocument,r=o.defaultView,n=o.documentElement,s=[],i=[],c=[...e.querySelectorAll("[data-ads-token], [data-ads-property]")],l=new Set(t.map(u=>`${u.token}:${u.property}`));for(let u of c)l.has(`${u.dataset.adsToken}:${u.dataset.adsProperty}`)||s.push(`Undeclared rendered token sample ${u.dataset.adsToken}:${u.dataset.adsProperty}.`);for(let u of t){if(!r.CSS.supports(u.property,u.probe)){s.push(`${u.token}: the fixture probe is invalid for ${u.property}.`);continue}let h=r.getComputedStyle(n).getPropertyValue(u.token).trim();if(!h||!r.CSS.supports(u.property,h)){s.push(`${u.token}: its current value is invalid for the fixture's ${u.property} binding.`);continue}let f=c.filter(_=>_.dataset.adsToken===u.token&&_.dataset.adsProperty===u.property);if(!f.length){s.push(`${u.token} needs a rendered ${u.property} sample, not only a name/value label.`);continue}let y=!1;for(let _ of f){let v=[];for(let O=_.parentElement;O&&O!==e;O=O.parentElement)O.tagName==="DETAILS"&&!O.open&&(O.open=!0,v.push(O));let k=n.getAttribute("style"),T=_.getAttribute("style");try{/^(?:-[a-z]+-)?transition(?:-|$)/.test(u.property)||_.style.setProperty("transition","none","important");let O=r.getComputedStyle(_).getPropertyValue(u.property),j=A_(_,r);n.style.setProperty(u.token,u.probe,"important");let M=r.getComputedStyle(_).getPropertyValue(u.property);y=!!(M&&M!==O&&(j||A_(_,r)))}finally{k===null?n.removeAttribute("style"):n.setAttribute("style",k),T===null?_.removeAttribute("style"):_.setAttribute("style",T);for(let O of v)O.open=!1}if(y)break}y?i.push(u):s.push(`${u.token} has no visible ${u.property} sample that responds to its value. Hardcoded copies do not satisfy coverage.`)}return{ok:!s.length,verified:i,diagnostics:s}}function q_({container:e=document.getElementById("root"),bindings:t=[],auditResources:o=!1}={}){let r=[],n=[],s=[];if(!e||!Array.isArray(t)||t.length>100)return{ok:!1,diagnostics:["Invalid bounded paint-audit descriptor."],verified:n};let i=e.ownerDocument,c=i.defaultView,l=["color","fill","stroke","stop-color","background-color","border-top-color","border-right-color","border-bottom-color","border-left-color"];function u(f,y,_,v=new Set){if(f=f.trim(),["none","currentColor"].includes(f))return!0;let k=/^var\(\s*(--[\w-]+)\s*\)$/.exec(f);if(k){let j=k[1];if(!_.tokens.includes(j)||v.has(j))return!1;let M=c.getComputedStyle(y).getPropertyValue(j).trim();return!!M&&c.CSS.supports("color",M)}let T=/^light-dark\(\s*(var\(\s*--[\w-]+\s*\)|currentColor)\s*,\s*(var\(\s*--[\w-]+\s*\)|currentColor)\s*\)$/.exec(f);if(T)return c.CSS.supports("color",f)&&u(T[1],y,_,v)&&u(T[2],y,_,v);let O=/^url\(\s*(["']?)#([^\s"'()#\\\p{Cc}]+)\1\s*\)$/u.exec(f);if(O&&c.CSS.supports("fill",f)){let j=[...i.querySelectorAll("[id]")].filter(M=>M.id===O[2]);return j.length===1&&["linearGradient","radialGradient","pattern"].includes(j[0].localName)&&y.contains(j[0])}return!1}for(let f of t){if(!f||typeof f.scope!="string"||!Array.isArray(f.tokens)||typeof f.prefix!="string"||typeof f.suffix!="string"){r.push("Invalid paint binding metadata; rebuild previews.");continue}let y;try{y=[...e.querySelectorAll(f.scope)]}catch{r.push(`${f.owner}: invalid binding scope.`);continue}y.length>20&&s.push(`${f.owner}: only the first 20 instances were audited; use a focused scenario for complete evidence.`);for(let _ of y.slice(0,20)){let v=[_,..._.querySelectorAll("*")];if(v.length>1e3){s.push(`${f.owner}: instance exceeds 1000 elements; paint effects are not established.`);continue}let k=[..._.style].filter(T=>T.startsWith(f.prefix)&&T.endsWith(f.suffix));k.length>100&&s.push(`${f.owner}: only the first 100 binding keys were audited.`);for(let T of k.slice(0,100)){let O=_.style.getPropertyValue(T).trim(),j=T.slice(f.prefix.length,f.suffix?-f.suffix.length:void 0);if(!/^[A-Za-z0-9_-]+$/.test(j)||!u(O,_,f)){r.push(`${f.owner}: invalid or inaccessible paint ${T}: ${O}. Use an accessible token, instance-local SVG paint server, none or currentColor.`);continue}let M=_.getAttribute("style"),Z=v.map(V=>V.getAttribute("style"));try{for(let G of v)G.style.setProperty("transition","none","important");let V=v.map(G=>l.map(pe=>c.getComputedStyle(G).getPropertyValue(pe)));_.style.setProperty(T,"rgb(17, 103, 211)","important");let D=v.some((G,pe)=>l.some((te,ke)=>c.getComputedStyle(G).getPropertyValue(te)!==V[pe][ke]));D||(_.style.setProperty(T,"rgb(211, 67, 23)","important"),D=v.some((G,pe)=>l.some((te,ke)=>c.getComputedStyle(G).getPropertyValue(te)!==V[pe][ke]))),D?n.push({owner:f.owner,binding:f.name,variable:T}):s.push(`${f.owner}: ${T} has no observed paint effect in its current instance. A written variable alone is not rendering evidence; check the relevant selected/visible consumer.`)}finally{v.forEach((V,D)=>{Z[D]===null?V.removeAttribute("style"):V.setAttribute("style",Z[D])}),M===null?_.removeAttribute("style"):_.setAttribute("style",M)}}for(let T of v)for(let O of["fill","stroke","stop-color"]){let j=T.getAttribute(O);if(!j)continue;let M=/^var\(\s*(--[\w-]+)\s*\)$/.exec(j);M&&M[1].startsWith(f.prefix)&&M[1].endsWith(f.suffix)&&!k.includes(M[1])&&r.push(`${f.owner}: ${M[1]} is consumed without a value in this instance.`),j.startsWith("url(")&&!u(j,_,f)&&r.push(`${f.owner}: missing, duplicated or out-of-instance local paint resource ${j}.`)}}}let h=o?[...e.querySelectorAll("[fill], [stroke], [style]")]:[];h.length>1e3&&s.push("Only the first 1000 potential SVG paint consumers were audited.");for(let f of h.slice(0,1e3))for(let y of["fill","stroke"]){let _=f.getAttribute(y)??f.style.getPropertyValue(y);if(!_?.startsWith("url("))continue;let v=/^url\(\s*(["']?)#([^\s"'()#\\\p{Cc}]+)\1\s*\)$/u.exec(_)?.[2],k=v?[...i.querySelectorAll("[id]")].filter(O=>O.id===v):[],T=f.ownerSVGElement??(f.localName==="svg"?f:null);(k.length!==1||!T?.contains(k[0])||!["linearGradient","radialGradient","pattern"].includes(k[0]?.localName))&&r.push(`Invalid, missing, duplicated or nonlocal SVG paint resource ${_}. Keep IDs isolated per rendered instance.`)}return{ok:!r.length,complete:!s.length,verified:n,diagnostics:r.slice(0,40),limits:s.slice(0,20),scope:"observed App instances and current input; repeat after updates"}}var Ie=new Yl({name:"ADS resource preview",version:"1.0.0"},{},{autoResize:!0}),xo=document.getElementById("root"),wf=document.getElementById("ads-preview-status"),Pf,Ef=async e=>{if(!Ie.getHostCapabilities()?.serverResources)throw new Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");try{return await Ie.readServerResource({uri:Pf?Pf+encodeURIComponent(e):e},{timeout:15e3})}catch(t){throw t.code===-32601||t.message==="Method not found"?new Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase."):t}},_a=new Ql(Ef),dt,L_,Po,Tf,$f,Rf=!1,qt=0,fa={},Ce="",ga=!1,xf,j_;function U_(e){if(Ie.getHostVersion()?.name!=="ADS showcase")return;let t=j_;if(j_=e,!t)return;let o=O_(t,e).filter(r=>r!==dt);o.length&&_a.prefetch(e,o).then(r=>jt("prefetched",{revision:e.revision,...r})).catch(r=>console.warn("ADS preview prefetch",r.message))}function Ye(e,t=!1){wf.textContent=e,wf.hidden=!e||Ie.getHostVersion()?.name==="ADS showcase",wf.setAttribute("role",t?"alert":"status")}async function jt(e,t={}){try{Ie.getHostCapabilities()?.logging&&await Ie.sendLog({level:e==="error"?"error":"info",logger:"ads-preview",data:{state:e,id:dt,...t}})}catch{}}function Z_(e){fa={...fa,...e,styles:{...fa.styles,...e.styles}},["light","dark"].includes(fa.theme)&&(document.documentElement.dataset.theme=fa.theme)}async function kf(e="ads://preview/manifest"){let t;try{t=await Ef(e)}catch(o){throw Object.assign(new Error(o.message,{cause:o}),{code:"ADS_MANIFEST_READ",category:"transport"})}return JSON.parse(t.contents.find(o=>typeof o.text=="string").text)}async function Sa(e,t,o=!1,r="",n=!1){let s=o||n;if(!r&&e===dt&&t&&t===Po&&s===ga){Ye(Ce||(s?"Checking changes\u2026":""),!!Ce),await jt(Ce?"error":s?"checking":"ready",Ce?{message:Ce}:{revision:Po});return}let i=++qt;++_a.generation,dt=e,document.documentElement.dataset.adsScenario=e,document.documentElement.dataset.adsPreviewState="loading";for(let c of["adsPreviewErrorCategory","adsPreviewErrorCode","adsPreviewResourceUri"])delete document.documentElement.dataset[c];Ce="",Ye(""),await jt(r?"reverting":"loading");try{let c=await kf(o?"ads://preview/live":"ads://preview/manifest");if(t&&c.revision!==t){i===qt&&(Ye("Updating preview\u2026"),await jt("loading",{code:"ADS_PREVIEW_CHANGED"}));return}if(i!==qt||!await _a.mount(c,e,xo)||i!==qt||(Po=c.revision,Tf=c.session,ga=s,await new Promise(h=>requestAnimationFrame(()=>requestAnimationFrame(h))),await document.fonts.ready,i!==qt))return;let u=c.scenarios.find(h=>h.id===e);if(xo.dataset.adsPaintBindings=JSON.stringify(u?.paintBindings??[]),xo.dataset.adsPaintAudit=String(!!u?.paintAudit),xo.dataset.adsPaintAuditComplete="not-requested",u?.paintBindings?.length||u?.paintAudit){let h=q_({container:xo,bindings:u.paintBindings??[],auditResources:!!u.paintAudit});if(!h.ok)throw Object.assign(new Error(`Paint binding verification failed:
|
|
104
|
-
${
|
|
105
|
-
`)}`),{code:"ADS_PAINT_BINDING",category:"assertion"});
|
|
106
|
-
${
|
|
107
|
-
`)}`,Object.assign(
|
|
108
|
-
${o}`)}
|
|
109
|
-
${o}`:"Rebuilding. This is the previous preview."
|
|
110
|
-
/*! Bundled license information:
|
|
111
|
-
|
|
112
|
-
@modelcontextprotocol/client/dist/src-WCy6ifGf.mjs:
|
|
113
|
-
(*!
|
|
114
|
-
* content-type
|
|
115
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
116
|
-
* MIT Licensed
|
|
117
|
-
*)
|
|
118
|
-
*/
|
|
105
|
+
- "app": Tool callable by the app from this server only`),csp:Oc().optional(),permissions:Oc().optional()}),Rz=l({mimeTypes:h(s()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),xz=l({method:u("ui/download-file"),params:l({contents:h(v([Zt,Dt])).describe("Resource contents to download — embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),Pz=l({method:u("ui/message"),params:l({role:u("user").describe('Message role, currently only "user" is supported.'),content:h(Ce).describe("Message content blocks (text, image, etc.).")})}),Tz=l({method:u("ui/notifications/sandbox-resource-ready"),params:l({html:s().describe("HTML content to load into the inner iframe."),sandbox:s().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:rl.optional().describe("CSP configuration from resource metadata."),permissions:nl.optional().describe("Sandbox permissions from resource metadata.")})}),__=l({method:u("ui/notifications/tool-result"),params:at.describe("Standard MCP tool execution result.")}),zm=l({toolInfo:l({id:Re.optional().describe("JSON-RPC id of the tools/call request."),tool:it.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:t_.optional().describe("Current color theme preference."),styles:d_.optional().describe("Style configuration for theming the app."),displayMode:Ks.optional().describe("How the UI is currently displayed."),availableDisplayModes:h(Ks).optional().describe("Display modes the host supports."),containerDimensions:v([l({height:_().describe("Fixed container height in pixels.")}),l({maxHeight:v([_(),Ic()]).optional().describe("Maximum container height in pixels.")})]).and(v([l({width:_().describe("Fixed container width in pixels.")}),l({maxWidth:v([_(),Ic()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
106
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:s().optional().describe("User's language and region preference in BCP 47 format."),timeZone:s().optional().describe("User's timezone in IANA format."),userAgent:s().optional().describe("Host application identifier."),platform:v([u("web"),u("desktop"),u("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:l({touch:z().optional().describe("Whether the device supports touch input."),hover:z().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:l({top:_().describe("Top safe area inset in pixels."),right:_().describe("Right safe area inset in pixels."),bottom:_().describe("Bottom safe area inset in pixels."),left:_().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),y_=l({method:u("ui/notifications/host-context-changed"),params:zm.describe("Partial context update containing only changed fields.")}),Ez=l({method:u("ui/update-model-context"),params:l({content:h(Ce).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:b(s(),P().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),kz=l({method:u("ui/initialize"),params:l({appInfo:ke.describe("App identification (name and version)."),appCapabilities:f_.describe("Features and capabilities this app provides."),protocolVersion:s().describe("Protocol version this app supports.")})}),b_=l({protocolVersion:s().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:ke.describe("Host application identification and version."),hostCapabilities:m_.describe("Features and capabilities provided by the host."),hostContext:zm.describe("Rich context about the host environment.")}).passthrough(),v_={target:"draft-2020-12"};async function Sm(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](v_);throw Error(`Schema (vendor: ${o.vendor}) does not implement Standard JSON Schema (~standard.jsonSchema). Use a library that does (zod v4, ArkType, Valibot) or wrap your schema accordingly.`)}async function _m(e,t,o=""){let r=await e["~standard"].validate(t);if(r.issues){let n=r.issues.map((i)=>{let a=i.path?.map((c)=>typeof c==="object"?c.key:c).join(".");return a?`${a}: ${i.message}`:i.message}).join("; ");throw Error(o+n)}return r.value}function z_(e,t){let o={...e,...t};if(t.experimental!==void 0)o.experimental={...e.experimental,...t.experimental};if(t.tools!==void 0)o.tools={...e.tools,...t.tools};return o}class va extends ol{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new ym;_methods=new bm;setRequestHandler=(...e)=>{let[t,...o]=fm("request",e)??e;this._methods.claim(t,"setRequestHandler"),super.setRequestHandler.call(this,t,...o)};setNotificationHandler=(...e)=>{let[t,...o]=fm("notification",e)??e;this._methods.claim(t,"setNotificationHandler"),super.setNotificationHandler.call(this,t,...o)};removeRequestHandler=(e)=>{this._methods.release(e),super.removeRequestHandler(e)};removeNotificationHandler=(e)=>{this._methods.release(e),super.removeNotificationHandler(e)};replaceRequestHandler=(e,...t)=>{this._methods.replace(e),super.setRequestHandler.call(this,e,...t)};_assertInitialized(e){if(this._initializedSent)return;let t=`[ext-apps] App.${e}() called before connect() completed the ui/initialize handshake. Await app.connect() before calling this method, or move data loading to an ontoolresult handler.`;if(this.options?.strict)throw Error(t);console.warn(`${t}. This will throw in a future release.`)}eventSchemas={toolinput:a_,toolinputpartial:c_,toolresult:__,toolcancelled:l_,hostcontextchanged:y_};static ONE_SHOT_EVENTS=new Set(["toolinput","toolinputpartial","toolresult","toolcancelled"]);_everHadListener=new Set;_assertHandlerTiming(e){if(!va.ONE_SHOT_EVENTS.has(e)||this._everHadListener.has(e))return;if(this._everHadListener.add(e),!this._initializedSent)return;let t=`[ext-apps] "${String(e)}" handler registered after connect() completed the ui/initialize handshake. The host may have already sent this notification. Register handlers before calling app.connect().`;if(this.options?.strict)throw Error(t);console.warn(t)}setEventHandler(e,t){if(t)this._assertHandlerTiming(e);this._ensureEventSlot(e),this._events.setHandler(e,t)}addEventListener(e,t){this._assertHandlerTiming(e),this._ensureEventSlot(e),this._events.addEventListener(e,t)}removeEventListener(e,t){this._events.removeEventListener(e,t)}_ensureEventSlot(e){if(this._registeredEvents.has(e))return;let t=this.eventSchemas[e];if(!t)throw Error(`Unknown event: ${String(e)}`);this.setNotificationHandler(t.shape.method.value,{params:t.shape.params},(o)=>{let r=o;if(e==="hostcontextchanged")this._hostContext={...this._hostContext,...r};this._events.dispatch(e,r)}),this._registeredEvents.add(e)}getEventHandler(e){return this._events.getHandler(e)}warnIfRequestHandlerReplaced(e,t,o){if(t&&o)console.warn(`[MCP Apps] ${e} handler replaced. Previous handler will no longer be called.`)}constructor(e,t={},o={autoResize:!0}){super(o);if(this._appInfo=e,this._appCapabilities=t,this.options=o,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),!o.allowUnsafeEval)le({jitless:!0});this.replaceRequestHandler("ping",(r)=>(console.log("Received ping:",r.params),{})),this.setEventHandler("hostcontextchanged",void 0)}buildContext(e){return e}registerAppCapabilities(e){if(this.transport)throw Error("Cannot register capabilities after transport is established");this._appCapabilities=z_(this._appCapabilities,e)}registerTool(e,t,o){if(this._registeredTools[e])throw Error(`Tool ${e} is already registered`);let r=this,n=()=>{if(r._initializedSent&&r._appCapabilities.tools?.listChanged)r.sendToolListChanged()},i=t.inputSchema!==void 0,a={title:t.title,description:t.description,inputSchema:t.inputSchema,outputSchema:t.outputSchema,annotations:t.annotations,_meta:t._meta,enabled:!0,enable(){this.enabled=!0,n()},disable(){this.enabled=!1,n()},update(c){Object.assign(this,c),n()},remove(){if(r._registeredTools[e]!==a)return;delete r._registeredTools[e],n()},handler:async(c,d)=>{if(!a.enabled)throw Error(`Tool ${e} is disabled`);let p;if(i){let m=a.inputSchema,f=m?await _m(m,c??{},`Invalid input for tool ${e}: `):c??{};p=await o(f,d)}else p=await o(d);if(a.outputSchema&&!p.isError)p.structuredContent=await _m(a.outputSchema,p.structuredContent,`Invalid output for tool ${e}: `);return p}};if(this._registeredTools[e]=a,!this._appCapabilities.tools&&!this.transport)this.registerAppCapabilities({tools:{listChanged:!0}});return this.ensureToolHandlersInitialized(),n(),a}_toolHandlersInitialized=!1;ensureToolHandlersInitialized(){if(this._toolHandlersInitialized)return;this._toolHandlersInitialized=!0,this.oncalltool=async(e,t)=>{let o=this._registeredTools[e.name];if(!o)throw Error(`Tool ${e.name} not found`);return o.handler(e.arguments,t)},this.onlisttools=async(e,t)=>({tools:await Promise.all(Object.entries(this._registeredTools).filter(([o,r])=>r.enabled).map(async([o,r])=>{let n={name:o,title:r.title,description:r.description,inputSchema:r.inputSchema?await Sm(r.inputSchema,"input"):{type:"object",properties:{}}};if(r.outputSchema)n.outputSchema=await Sm(r.outputSchema,"output");if(r.annotations)n.annotations=r.annotations;if(r._meta)n._meta=r._meta;return n}))})}async sendToolListChanged(e={}){this._assertInitialized("sendToolListChanged"),await this.notification({method:"notifications/tools/list_changed",params:e})}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}get ontoolinput(){return this.getEventHandler("toolinput")}set ontoolinput(e){this.setEventHandler("toolinput",e)}get ontoolinputpartial(){return this.getEventHandler("toolinputpartial")}set ontoolinputpartial(e){this.setEventHandler("toolinputpartial",e)}get ontoolresult(){return this.getEventHandler("toolresult")}set ontoolresult(e){this.setEventHandler("toolresult",e)}get ontoolcancelled(){return this.getEventHandler("toolcancelled")}set ontoolcancelled(e){this.setEventHandler("toolcancelled",e)}get onhostcontextchanged(){return this.getEventHandler("hostcontextchanged")}set onhostcontextchanged(e){this.setEventHandler("hostcontextchanged",e)}_onteardown;get onteardown(){return this._onteardown}set onteardown(e){this.warnIfRequestHandlerReplaced("onteardown",this._onteardown,e),this._onteardown=e,this.replaceRequestHandler("ui/resource-teardown",{params:p_.shape.params,result:h_},(t,o)=>{if(!this._onteardown)throw Error("No onteardown handler set");return this._onteardown(t,o)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(e){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,e),this._oncalltool=e,this.replaceRequestHandler("tools/call",(t,o)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(t.params,o)})}_onlisttools;get onlisttools(){return this._onlisttools}set onlisttools(e){this.warnIfRequestHandlerReplaced("onlisttools",this._onlisttools,e),this._onlisttools=e,this.replaceRequestHandler("tools/list",(t,o)=>{if(!this._onlisttools)throw Error("No onlisttools handler set");return this._onlisttools(t.params,o)})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._hostCapabilities?.sampling)throw Error(`Host does not support sampling (required for ${e})`);break}}assertRequestHandlerCapability(e){switch(e){case"tools/call":case"tools/list":if(!this._appCapabilities.tools)throw Error(`Client does not support tool capability (required for ${e})`);return;default:return}}assertNotificationCapability(e){}async callServerTool(e,t){if(this._assertInitialized("callServerTool"),typeof e==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${e}"). Did you mean: callServerTool({ name: "${e}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:e},{onprogress:()=>{},resetTimeoutOnProgress:!0,...t})}async readServerResource(e,t){return this._assertInitialized("readServerResource"),await this.request({method:"resources/read",params:e},t)}async listServerResources(e,t){return this._assertInitialized("listServerResources"),await this.request({method:"resources/list",params:e},t)}async createSamplingMessage(e,t){return this._assertInitialized("createSamplingMessage"),await this.request({method:"sampling/createMessage",params:e},t)}sendMessage(e,t){return this._assertInitialized("sendMessage"),this.request({method:"ui/message",params:e},i_,t)}sendLog(e){return this.notification({method:"notifications/message",params:e})}updateModelContext(e,t){return this._assertInitialized("updateModelContext"),this.request({method:"ui/update-model-context",params:e},st,t)}openLink(e,t){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:e},n_,t)}sendOpenLink=this.openLink;downloadFile(e,t){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:e},s_,t)}requestTeardown(e={}){return this.notification({method:"ui/notifications/request-teardown",params:e})}requestDisplayMode(e,t){return this._assertInitialized("requestDisplayMode"),this.request({method:"ui/request-display-mode",params:e},g_,t)}sendSizeChanged(e){return this.notification({method:"ui/notifications/size-changed",params:e})}setupSizeChangedNotifications(){let e=!1,t=0,o=0,r=()=>{if(e)return;e=!0,requestAnimationFrame(()=>{e=!1;let i=document.documentElement,a=i.style.height;i.style.height="max-content";let c=Math.ceil(i.getBoundingClientRect().height);i.style.height=a;let d=Math.ceil(window.innerWidth);if(d!==t||c!==o)t=d,o=c,this.sendSizeChanged({width:d,height:c})})};r();let n=new ResizeObserver(r);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(e=new vm(window.parent,window.parent),t){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");this._initializedSent=!1;try{await super.connect(e);let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._appCapabilities,appInfo:this._appInfo,protocolVersion:XS}},b_,t);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);if(this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this._initializedSent=!0,this.options?.autoResize)this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}function wm(e,t){let o=[],r=new Set;function n(i){if(r.has(i))return;r.add(i);let a=e.get(i);if(!a)throw Error(`Missing preview dependency metadata: ${i}`);for(let c of[...a.imports,...a.styles,...a.references])n(c);o.push(i)}return n(t),o}function Rm(e,t){if(!e||e.revision===t.revision)return[];let o=(r,n)=>{let i=new Map(Object.entries(r.assets));return JSON.stringify(wm(i,n.module).map((a)=>[a,i.get(a)]))};return t.scenarios.filter((r)=>{let n=e.scenarios.find((i)=>i.id===r.id);return!n||o(e,n)!==o(t,r)}).map((r)=>r.id)}class sl{constructor(e){this.read=e,this.records=new Map,this.bytes=new Map,this.urls=new Map,this.styles=new Map,this.styleReady=new Map,this.revisions=new Set,this.loadedModules=new Set,this.importing=Promise.resolve(),this.generation=0,this.prefetchGeneration=0,this.closed=!1,globalThis.__dsPreviewImport=(t)=>this.importModule(t)}register(e){if(e.schemaVersion!==1||!Array.isArray(e.scenarios)||!e.assets||typeof e.revision!=="string")throw Error("Unsupported preview manifest. Rebuild previews with the installed ADS version.");for(let[t,o]of Object.entries(e.assets)){if(!/^ads:\/\/assets\/[a-f0-9]{64}\.[a-z0-9]+$/.test(t)||!/^sha256:[a-f0-9]{64}$/.test(o.digest)||!["imports","dynamicImports","styles","references"].every((r)=>Array.isArray(o[r])&&o[r].every((n)=>Object.hasOwn(e.assets,n))))throw Error("Invalid preview dependency graph.");if(this.records.has(t)&&this.records.get(t).digest!==o.digest)throw Error("An immutable preview resource changed its content.");this.records.set(t,o)}}async resource(e){if(!this.bytes.has(e)){let t=(async()=>{let o=this.records.get(e);if(!o)throw Error(`Unknown preview dependency: ${e}`);let r;try{r=await this.read(e)}catch(d){throw Object.assign(Error(`Preview resource read failed for ${e}: ${d.message}`,{cause:d}),{code:"ADS_RESOURCE_READ",category:"transport",resourceUri:e})}if(this.closed)throw Error("The preview App was closed.");let n=r.contents.find((d)=>d.uri===e);if(!n)throw Object.assign(Error(`Missing preview dependency: ${e}`),{code:"ADS_RESOURCE_CONTENT",category:"build",resourceUri:e});let i=typeof n.text==="string"?new TextEncoder().encode(n.text):Uint8Array.from(atob(n.blob),(d)=>d.charCodeAt(0)),a=await crypto.subtle.digest("SHA-256",i),c="sha256:"+[...new Uint8Array(a)].map((d)=>d.toString(16).padStart(2,"0")).join("");if(i.length!==o.size||c!==o.digest)throw Object.assign(Error("Preview resource integrity check failed. Rebuild and reopen the preview."),{code:"ADS_RESOURCE_INTEGRITY",category:"build",resourceUri:e});return i})();this.bytes.set(e,t),t.catch(()=>this.bytes.delete(e))}return this.bytes.get(e)}closure(e){return wm(this.records,e)}async prefetch(e,t){if(this.closed)return;this.register(e);let o=++this.prefetchGeneration,r=new Set,n=[],i=0;for(let p of t){let m=e.scenarios.find((S)=>S.id===p);if(!m)continue;let f=this.closure(m.module).filter((S)=>!this.bytes.has(S)&&!r.has(S)),y=f.reduce((S,w)=>S+this.records.get(w).size,0);if(i+y>16777216||r.size+f.length>256)continue;i+=y,n.push(p);for(let S of f)r.add(S)}let a=[...r],c=0,d=async()=>{while(!this.closed&&o===this.prefetchGeneration&&c<a.length)await this.resource(a[c++])};return await Promise.all(Array.from({length:Math.min(3,a.length)},d)),{scenarios:n,resources:a.length}}async materialize(e){let t=this.closure(e);await Promise.all(t.map((r)=>this.resource(r)));let o={};for(let r of t){if(this.closed)throw Error("The preview App was closed.");if(this.urls.has(r))continue;let n=this.records.get(r),i=await this.resource(r);if(n.kind==="module"||n.mimeType==="text/css"||n.mimeType==="text/javascript"){let c=new TextDecoder().decode(i);for(let d of n.references){let p=this.urls.get(d);if(!p)throw Error("Unsupported cyclic asset reference.");c=c.replaceAll(d,p)}i=c}let a=URL.createObjectURL(new Blob([i],{type:n.mimeType}));if(this.urls.set(r,a),n.kind==="module")o[r]=a}if(Object.keys(o).length){let r=document.createElement("script");r.type="importmap",r.textContent=JSON.stringify({imports:o}),document.head.append(r)}return t}async importModule(e){let t=this.importing.then(()=>this.materialize(e));this.importing=t.catch(()=>{});let o=await t;await this.attachStyles(o);try{let r=await import(e);return this.loadedModules.add(e),r}catch(r){throw Error(`Preview module import failed for ${e}: ${r.message}. Inspect the App resource bridge, browser network/CSP diagnostics and current build.`,{cause:r})}}async attachStyles(e){for(let t of e){if(this.records.get(t).mimeType!=="text/css")continue;if(this.styles.has(t)){await this.styleReady.get(t);continue}let r=document.createElement("link");r.rel="stylesheet",r.href=this.urls.get(t),this.styles.set(t,r);let n=new Promise((i,a)=>{r.onload=i,r.onerror=()=>a(Error("The host CSP blocked a preview stylesheet."))});this.styleReady.set(t,n),document.head.append(r);try{await n}catch(i){throw r.remove(),this.styles.delete(t),this.styleReady.delete(t),i}}}async refreshStyles(e,t){let o=[e],r=new Set,n=new Set;for(let i=0;i<o.length;i++){let a=o[i];if(r.has(a))continue;r.add(a);for(let c of await this.materialize(a)){n.add(c);for(let d of this.records.get(c).dynamicImports)if(this.loadedModules.has(d))o.push(d)}}if(await this.attachStyles([...n]),t!==this.generation||this.closed)return!1;for(let[i,a]of this.styles)if(!n.has(i))a.remove(),this.styles.delete(i),this.styleReady.delete(i);for(let i of n)if(this.styles.has(i))document.head.append(this.styles.get(i));return!0}async mount(e,t,o){let r=++this.generation;this.register(e);let n=e.scenarios.find((d)=>d.id===t);if(!n)throw Error("The selected scenario is no longer registered.");let i=JSON.stringify(this.closure(n.module).map((d)=>[d,this.records.get(d)]));if(this.mounted?.id===t&&this.mounted.container===o&&this.mounted.signature===i)return this.refreshStyles(n.module,r);if(this.revisions.add(n.module),this.revisions.size>20)throw Object.assign(Error("Reopen the preview to release modules retained across 20 build revisions."),{code:"ADS_PREVIEW_REOPEN"});let a=await this.importModule(n.module);if(r!==this.generation)return!1;let c=this.unmount;if(this.unmount=void 0,this.mounted=void 0,await c?.(),r!==this.generation||this.closed)return!1;if(o.replaceChildren(),!await this.refreshStyles(n.module,r))return!1;if(typeof a.mount!=="function")throw Error("The compiled scenario has no mount adapter.");if(this.unmount=a.mount(o),typeof this.unmount!=="function")throw Error("The scenario mount adapter must return an unmount callback.");return this.mounted={id:t,container:o,signature:i},!0}async dispose(){if(this.closed)return;this.closed=!0,++this.generation,++this.prefetchGeneration,await this.unmount?.(),this.mounted=void 0;for(let e of this.styles.values())e.remove();for(let e of this.urls.values())URL.revokeObjectURL(e);this.styles.clear(),this.styleReady.clear(),this.urls.clear(),this.bytes.clear(),this.records.clear(),this.revisions.clear(),this.loadedModules.clear(),delete globalThis.__dsPreviewImport}}function xm(e){return Array.isArray(e)&&e.length>0&&e.every((t)=>t&&typeof t==="object"&&typeof t.token==="string"&&/^--[\w-]+$/.test(t.token)&&typeof t.property==="string"&&/^-?[a-z][a-z0-9-]*$/.test(t.property)&&typeof t.probe==="string"&&t.probe.trim().length>0)&&new Set(e.map((t)=>`${t.token}:${t.property}`)).size===e.length}function Pm(e,t){let o=t.getComputedStyle(e),r=e.getBoundingClientRect();if(o.display==="none"||o.visibility!=="visible"||!e.getClientRects().length||!(r.width||r.height))return!1;for(let n=e;n;n=n.parentElement)if(Number(t.getComputedStyle(n).opacity)===0)return!1;return!0}function Tm(e,t){if(!xm(t))return{ok:!1,diagnostics:["Token preview needs explicit { token, property, probe } samples from the project fixture. Rebuild with the current compiler."]};let o=e.ownerDocument,{defaultView:r,documentElement:n}=o,i=[],a=[],c=[...e.querySelectorAll("[data-ads-token], [data-ads-property]")],d=new Set(t.map((p)=>`${p.token}:${p.property}`));for(let p of c)if(!d.has(`${p.dataset.adsToken}:${p.dataset.adsProperty}`))i.push(`Undeclared rendered token sample ${p.dataset.adsToken}:${p.dataset.adsProperty}.`);for(let p of t){if(!r.CSS.supports(p.property,p.probe)){i.push(`${p.token}: the fixture probe is invalid for ${p.property}.`);continue}let m=r.getComputedStyle(n).getPropertyValue(p.token).trim();if(!m||!r.CSS.supports(p.property,m)){i.push(`${p.token}: its current value is invalid for the fixture's ${p.property} binding.`);continue}let f=c.filter((S)=>S.dataset.adsToken===p.token&&S.dataset.adsProperty===p.property);if(!f.length){i.push(`${p.token} needs a rendered ${p.property} sample, not only a name/value label.`);continue}let y=!1;for(let S of f){let w=[];for(let C=S.parentElement;C&&C!==e;C=C.parentElement)if(C.tagName==="DETAILS"&&!C.open)C.open=!0,w.push(C);let x=n.getAttribute("style"),R=S.getAttribute("style");try{if(!/^(?:-[a-z]+-)?transition(?:-|$)/.test(p.property))S.style.setProperty("transition","none","important");let C=r.getComputedStyle(S).getPropertyValue(p.property),N=Pm(S,r);n.style.setProperty(p.token,p.probe,"important");let O=r.getComputedStyle(S).getPropertyValue(p.property);y=Boolean(O&&O!==C&&(N||Pm(S,r)))}finally{if(x===null)n.removeAttribute("style");else n.setAttribute("style",x);if(R===null)S.removeAttribute("style");else S.setAttribute("style",R);for(let C of w)C.open=!1}if(y)break}if(y)a.push(p);else i.push(`${p.token} has no visible ${p.property} sample that responds to its value. Hardcoded copies do not satisfy coverage.`)}return{ok:!i.length,verified:a,diagnostics:i}}function Em({container:e=document.getElementById("root"),bindings:t=[],auditResources:o=!1}={}){let r=[],n=[],i=[];if(!e||!Array.isArray(t)||t.length>100)return{ok:!1,diagnostics:["Invalid bounded paint-audit descriptor."],verified:n};let a=e.ownerDocument,c=a.defaultView,d=["color","fill","stroke","stop-color","background-color","border-top-color","border-right-color","border-bottom-color","border-left-color"];function p(f,y,S,w=new Set){if(f=f.trim(),["none","currentColor"].includes(f))return!0;let x=/^var\(\s*(--[\w-]+)\s*\)$/.exec(f);if(x){let N=x[1];if(!S.tokens.includes(N)||w.has(N))return!1;let O=c.getComputedStyle(y).getPropertyValue(N).trim();return!!O&&c.CSS.supports("color",O)}let R=/^light-dark\(\s*(var\(\s*--[\w-]+\s*\)|currentColor)\s*,\s*(var\(\s*--[\w-]+\s*\)|currentColor)\s*\)$/.exec(f);if(R)return c.CSS.supports("color",f)&&p(R[1],y,S,w)&&p(R[2],y,S,w);let C=/^url\(\s*(["']?)#([^\s"'()#\\\p{Cc}]+)\1\s*\)$/u.exec(f);if(C&&c.CSS.supports("fill",f)){let N=[...a.querySelectorAll("[id]")].filter((O)=>O.id===C[2]);return N.length===1&&["linearGradient","radialGradient","pattern"].includes(N[0].localName)&&y.contains(N[0])}return!1}for(let f of t){if(!f||typeof f.scope!=="string"||!Array.isArray(f.tokens)||typeof f.prefix!=="string"||typeof f.suffix!=="string"){r.push("Invalid paint binding metadata; rebuild previews.");continue}let y;try{y=[...e.querySelectorAll(f.scope)]}catch{r.push(`${f.owner}: invalid binding scope.`);continue}if(y.length>20)i.push(`${f.owner}: only the first 20 instances were audited; use a focused scenario for complete evidence.`);for(let S of y.slice(0,20)){let w=[S,...S.querySelectorAll("*")];if(w.length>1000){i.push(`${f.owner}: instance exceeds 1000 elements; paint effects are not established.`);continue}let x=[...S.style].filter((R)=>R.startsWith(f.prefix)&&R.endsWith(f.suffix));if(x.length>100)i.push(`${f.owner}: only the first 100 binding keys were audited.`);for(let R of x.slice(0,100)){let C=S.style.getPropertyValue(R).trim(),N=R.slice(f.prefix.length,f.suffix?-f.suffix.length:void 0);if(!/^[A-Za-z0-9_-]+$/.test(N)||!p(C,S,f)){r.push(`${f.owner}: invalid or inaccessible paint ${R}: ${C}. Use an accessible token, instance-local SVG paint server, none or currentColor.`);continue}let O=S.getAttribute("style"),q=w.map((L)=>L.getAttribute("style"));try{for(let V of w)V.style.setProperty("transition","none","important");let L=w.map((V)=>d.map((ae)=>c.getComputedStyle(V).getPropertyValue(ae)));S.style.setProperty(R,"rgb(17, 103, 211)","important");let j=w.some((V,ae)=>d.some((Y,ge)=>c.getComputedStyle(V).getPropertyValue(Y)!==L[ae][ge]));if(!j)S.style.setProperty(R,"rgb(211, 67, 23)","important"),j=w.some((V,ae)=>d.some((Y,ge)=>c.getComputedStyle(V).getPropertyValue(Y)!==L[ae][ge]));if(!j)i.push(`${f.owner}: ${R} has no observed paint effect in its current instance. A written variable alone is not rendering evidence; check the relevant selected/visible consumer.`);else n.push({owner:f.owner,binding:f.name,variable:R})}finally{if(w.forEach((L,j)=>{if(q[j]===null)L.removeAttribute("style");else L.setAttribute("style",q[j])}),O===null)S.removeAttribute("style");else S.setAttribute("style",O)}}for(let R of w)for(let C of["fill","stroke","stop-color"]){let N=R.getAttribute(C);if(!N)continue;let O=/^var\(\s*(--[\w-]+)\s*\)$/.exec(N);if(O&&O[1].startsWith(f.prefix)&&O[1].endsWith(f.suffix)&&!x.includes(O[1]))r.push(`${f.owner}: ${O[1]} is consumed without a value in this instance.`);if(N.startsWith("url(")&&!p(N,S,f))r.push(`${f.owner}: missing, duplicated or out-of-instance local paint resource ${N}.`)}}}let m=o?[...e.querySelectorAll("[fill], [stroke], [style]")]:[];if(m.length>1000)i.push("Only the first 1000 potential SVG paint consumers were audited.");for(let f of m.slice(0,1000))for(let y of["fill","stroke"]){let S=f.getAttribute(y)??f.style.getPropertyValue(y);if(!S?.startsWith("url("))continue;let w=/^url\(\s*(["']?)#([^\s"'()#\\\p{Cc}]+)\1\s*\)$/u.exec(S)?.[2],x=w?[...a.querySelectorAll("[id]")].filter((C)=>C.id===w):[],R=f.ownerSVGElement??(f.localName==="svg"?f:null);if(x.length!==1||!R?.contains(x[0])||!["linearGradient","radialGradient","pattern"].includes(x[0]?.localName))r.push(`Invalid, missing, duplicated or nonlocal SVG paint resource ${S}. Keep IDs isolated per rendered instance.`)}return{ok:!r.length,complete:!i.length,verified:n,diagnostics:r.slice(0,40),limits:i.slice(0,20),scope:"observed App instances and current input; repeat after updates"}}var ye=new va({name:"ADS resource preview",version:"1.0.0"},{},{autoResize:!0}),Bt=document.getElementById("root"),il=document.getElementById("ads-preview-status"),ll,pl=async(e)=>{if(!ye.getHostCapabilities()?.serverResources)throw Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");try{return await ye.readServerResource({uri:ll?ll+encodeURIComponent(e):e},{timeout:15000})}catch(t){if(t.code===-32601||t.message==="Method not found")throw Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");throw t}},ei=new sl(pl),He,$m,Gt,ul,hl,al=!1,lt=0,Ys={},_e="",Qs=!1,cl,km,Cm=new Set;function Im(e){if(ye.getHostVersion()?.name!=="ADS showcase")return;let t=km;if(km=e,!t)return;let o=Rm(t,e).filter((r)=>r!==He&&Cm.has(r));if(!o.length)return;ei.prefetch(e,o).then((r)=>ut("prefetched",{revision:e.revision,...r})).catch((r)=>console.warn("ADS preview prefetch",r.message))}function Oe(e,t=!1){il.textContent=e,il.hidden=!e||ye.getHostVersion()?.name==="ADS showcase",il.setAttribute("role",t?"alert":"status")}async function ut(e,t={}){try{if(ye.getHostCapabilities()?.logging)await ye.sendLog({level:e==="error"?"error":"info",logger:"ads-preview",data:{state:e,id:He,...t}})}catch{}}function Om(e){if(Ys={...Ys,...e,styles:{...Ys.styles,...e.styles}},["light","dark"].includes(Ys.theme))document.documentElement.dataset.theme=Ys.theme}async function dl(e="ads://preview/manifest"){let t;try{t=await pl(e)}catch(o){throw Object.assign(Error(o.message,{cause:o}),{code:"ADS_MANIFEST_READ",category:"transport"})}return JSON.parse(t.contents.find((o)=>typeof o.text==="string").text)}async function Xs(e,t,o=!1,r="",n=!1){let i=o||n;if(!r&&e===He&&t&&t===Gt&&i===Qs){Oe(_e||(i?"Checking changes…":""),Boolean(_e)),await ut(_e?"error":i?"checking":"ready",_e?{message:_e}:{revision:Gt});return}let a=++lt;++ei.generation,He=e,Cm.add(e),document.documentElement.dataset.adsScenario=e,document.documentElement.dataset.adsPreviewState="loading";for(let c of["adsPreviewErrorCategory","adsPreviewErrorCode","adsPreviewResourceUri"])delete document.documentElement.dataset[c];_e="",Oe(""),await ut(r?"reverting":"loading");try{let c=await dl(o?"ads://preview/live":"ads://preview/manifest");if(t&&c.revision!==t){if(a===lt)Oe("Updating preview…"),await ut("loading",{code:"ADS_PREVIEW_CHANGED"});return}if(a!==lt)return;if(!await ei.mount(c,e,Bt)||a!==lt)return;if(Gt=c.revision,ul=c.session,Qs=i,await new Promise((m)=>requestAnimationFrame(()=>requestAnimationFrame(m))),await document.fonts.ready,a!==lt)return;let p=c.scenarios.find((m)=>m.id===e);if(Bt.dataset.adsPaintBindings=JSON.stringify(p?.paintBindings??[]),Bt.dataset.adsPaintAudit=String(Boolean(p?.paintAudit)),Bt.dataset.adsPaintAuditComplete="not-requested",p?.paintBindings?.length||p?.paintAudit){let m=Em({container:Bt,bindings:p.paintBindings??[],auditResources:Boolean(p.paintAudit)});if(!m.ok)throw Object.assign(Error(`Paint binding verification failed:
|
|
107
|
+
${m.diagnostics.join(`
|
|
108
|
+
`)}`),{code:"ADS_PAINT_BINDING",category:"assertion"});if(Bt.dataset.adsPaintAuditComplete=String(m.complete),!m.complete)await ut("audit-limited",{limits:m.limits})}if(p?.kind==="tokens"){let m=Tm(Bt,p.samples);if(!m.ok)throw _e=`Token preview verification failed:
|
|
109
|
+
${m.diagnostics.slice(0,20).join(`
|
|
110
|
+
`)}`,Object.assign(Error(_e),{code:"ADS_TOKEN_SAMPLE",category:"assertion"})}if(a===lt){if(document.documentElement.dataset.adsPreviewRevision=Gt,document.documentElement.dataset.adsPreviewState=r?"error":i?"checking":"ready",Oe(r||(i?"Checking changes…":""),Boolean(r)),await ut(r?"error":i?"checking":"ready",{revision:Gt,selectionRevision:$m,...r?{message:r}:{}}),!i&&!r)Im(c)}}catch(c){if(a===lt){if(document.documentElement.dataset.adsPreviewState="error",document.documentElement.dataset.adsPreviewErrorCategory=c.category??"runner",document.documentElement.dataset.adsPreviewErrorCode=c.code??"ADS_PREVIEW_STARTUP",c.resourceUri)document.documentElement.dataset.adsPreviewResourceUri=c.resourceUri;Oe(c.message,!0),await ut("error",{message:c.message,...c.code?{code:c.code}:{}})}}}async function w_(){if(!He||al||document.visibilityState==="hidden")return;al=!0;try{let e=JSON.parse((await pl("ads://project/build")).contents.find((o)=>typeof o.text==="string").text);cl=void 0;let t=e.previews.find((o)=>o.id===He);if(t?.live&&!t.current)if(t.live.revision!==Gt||e.session!==ul||!Qs)await Xs(He,t.live.revision,!0);else Oe(_e||"Checking changes…",Boolean(_e));else if(!t||!t.current){let o=t?.diagnostics?.[0]?.message;if(o&&Qs){let r=await dl();await Xs(He,r.revision,!1,`Build failed. Showing the previous preview.
|
|
111
|
+
${o}`)}Oe(o?`Build failed. Showing the previous preview.
|
|
112
|
+
${o}`:"Rebuilding. This is the previous preview.",Boolean(o))}else{let o=await dl();if(o.revision!==Gt||o.session!==ul||Qs)await Xs(He,o.revision);else Oe(_e,Boolean(_e)),Im(o)}}catch(e){let t=`Preview freshness unavailable: ${e.message}`;if(Oe(t,!0),cl!==t)cl=t,await ut("error",{message:t})}finally{al=!1}}ye.ontoolresult=(e)=>{ll=e.structuredContent?.draftScope;let t=e.structuredContent?.previewResult?.structuredContent??e.structuredContent;if(t?.scenario?.id)$m=t.manifestRevision,Xs(t.scenario.id,t.manifestRevision,t.manifestUri==="ads://preview/live","",t.build?.current===!1)};ye.onhostcontextchanged=Om;ye.onteardown=async()=>(++lt,clearInterval(hl),await ei.dispose(),{});try{if(await ye.connect(),Om(ye.getHostContext()??{}),!ye.getHostCapabilities()?.serverResources)throw Error("This host does not forward MCP resource reads. Open the same preview in the ADS showcase.");hl=setInterval(()=>{w_()},150);let e=document.getElementById("ads-preview-selection");if(e)Xs(JSON.parse(e.textContent).id)}catch(e){Oe(e.message,!0)}window.addEventListener("pagehide",()=>{clearInterval(hl),ei.dispose()},{once:!0});
|