@reqvire-org/ads 0.3.14 → 0.3.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- var F_=Object.defineProperty;var ot=(e,t)=>{for(var o in t)F_(e,o,{get:t[o],enumerable:!0})};var V_=Object.create,qa=Object.defineProperty,J_=Object.getOwnPropertyDescriptor,B_=Object.getOwnPropertyNames,W_=Object.getPrototypeOf,K_=Object.prototype.hasOwnProperty,If=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Of=(e,t)=>{let o={};for(var r in e)qa(o,r,{get:e[r],enumerable:!0});return t&&qa(o,Symbol.toStringTag,{value:"Module"}),o},G_=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=B_(t),s=0,a=n.length,l;s<a;s++)l=n[s],!K_.call(e,l)&&l!==o&&qa(e,l,{get:(u=>t[u]).bind(null,l),enumerable:!(r=J_(t,l))||r.enumerable});return e},Mf=(e,t,o)=>(o=e!=null?V_(W_(e)):{},G_(t||!e||!e.__esModule?qa(o,"default",{value:e,enumerable:!0}):o,e));var Y_=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function qf(e){return typeof e=="string"&&Y_.has(e.replace(/#$/,""))}var i={};ot(i,{$brand:()=>nu,$input:()=>Tp,$output:()=>xp,NEVER:()=>Vn,TimePrecision:()=>$p,ZodAny:()=>fm,ZodArray:()=>bm,ZodBase64:()=>cl,ZodBase64URL:()=>ll,ZodBigInt:()=>br,ZodBigIntFormat:()=>pl,ZodBoolean:()=>_r,ZodCIDRv4:()=>il,ZodCIDRv6:()=>al,ZodCUID:()=>Xc,ZodCUID2:()=>el,ZodCatch:()=>Lm,ZodCodec:()=>ys,ZodCustom:()=>vs,ZodCustomStringFormat:()=>gr,ZodDate:()=>gs,ZodDefault:()=>Om,ZodDiscriminatedUnion:()=>vm,ZodE164:()=>ul,ZodEmail:()=>Kc,ZodEmoji:()=>Yc,ZodEnum:()=>hr,ZodError:()=>Oy,ZodExactOptional:()=>$m,ZodFile:()=>Em,ZodFirstPartyTypeKind:()=>Ym,ZodFunction:()=>Wm,ZodGUID:()=>ps,ZodIPv4:()=>nl,ZodIPv6:()=>sl,ZodISODate:()=>Hc,ZodISODateTime:()=>Dc,ZodISODuration:()=>Vc,ZodISOTime:()=>Fc,ZodIntersection:()=>zm,ZodIssueCode:()=>Qm,ZodJWT:()=>dl,ZodKSUID:()=>rl,ZodLazy:()=>Jm,ZodLiteral:()=>Pm,ZodMAC:()=>dm,ZodMap:()=>xm,ZodNaN:()=>Zm,ZodNanoID:()=>Qc,ZodNever:()=>Sm,ZodNonOptional:()=>Sl,ZodNull:()=>mm,ZodNullable:()=>Im,ZodNumber:()=>Sr,ZodNumberFormat:()=>co,ZodObject:()=>Ss,ZodOptional:()=>gl,ZodPipe:()=>bs,ZodPrefault:()=>qm,ZodPreprocess:()=>Dm,ZodPromise:()=>Bm,ZodReadonly:()=>Hm,ZodRealError:()=>ye,ZodRecord:()=>pr,ZodSet:()=>Tm,ZodString:()=>mr,ZodStringFormat:()=>D,ZodSuccess:()=>jm,ZodSymbol:()=>pm,ZodTemplateLiteral:()=>Vm,ZodTransform:()=>km,ZodTuple:()=>Rm,ZodType:()=>q,ZodULID:()=>tl,ZodURL:()=>fs,ZodUUID:()=>Ve,ZodUndefined:()=>hm,ZodUnion:()=>_s,ZodUnknown:()=>gm,ZodVoid:()=>_m,ZodXID:()=>ol,ZodXor:()=>ym,_ZodString:()=>Wc,_default:()=>Mm,_function:()=>SS,any:()=>hl,array:()=>f,base64:()=>Ng,base64url:()=>Ag,bigint:()=>Wg,boolean:()=>R,catch:()=>Um,check:()=>_S,cidrv4:()=>Mg,cidrv6:()=>qg,clone:()=>he,codec:()=>hS,coerce:()=>zs,config:()=>Y,core:()=>st,cuid:()=>Tg,cuid2:()=>Pg,custom:()=>bS,date:()=>eS,decode:()=>nm,decodeAsync:()=>im,describe:()=>yS,discriminatedUnion:()=>Ot,e164:()=>jg,email:()=>Gc,emoji:()=>wg,encode:()=>rm,encodeAsync:()=>sm,endsWith:()=>rr,enum:()=>C,exactOptional:()=>Cm,file:()=>lS,flattenError:()=>Xn,float32:()=>Fg,float64:()=>Vg,formatError:()=>es,fromJSONSchema:()=>TS,function:()=>SS,getErrorMap:()=>Ny,globalRegistry:()=>re,gt:()=>He,gte:()=>fe,guid:()=>_g,hash:()=>Hg,hex:()=>Dg,hostname:()=>Zg,httpUrl:()=>Rg,includes:()=>tr,instanceof:()=>zS,int:()=>Jc,int32:()=>Jg,int64:()=>Kg,intersection:()=>Le,invertCodec:()=>mS,ipv4:()=>Cg,ipv6:()=>Og,iso:()=>xe,json:()=>wS,jwt:()=>Lg,keyof:()=>tS,ksuid:()=>$g,lazy:()=>Mt,length:()=>io,literal:()=>g,locales:()=>as,looseObject:()=>k,looseRecord:()=>sS,lowercase:()=>Xo,lt:()=>De,lte:()=>we,mac:()=>Ig,map:()=>iS,maxLength:()=>so,maxSize:()=>kt,meta:()=>vS,mime:()=>nr,minLength:()=>nt,minSize:()=>Fe,multipleOf:()=>Et,nan:()=>pS,nanoid:()=>xg,nativeEnum:()=>cS,negative:()=>Oc,never:()=>ml,nonnegative:()=>qc,nonoptional:()=>Am,nonpositive:()=>Mc,normalize:()=>sr,null:()=>Je,nullable:()=>hs,nullish:()=>uS,number:()=>b,object:()=>p,optional:()=>P,overwrite:()=>je,parse:()=>em,parseAsync:()=>tm,partialRecord:()=>nS,pipe:()=>Bc,positive:()=>Ic,prefault:()=>Nm,preprocess:()=>it,prettifyError:()=>_u,promise:()=>gS,property:()=>Nc,readonly:()=>Fm,record:()=>z,refine:()=>Km,regex:()=>Qo,regexes:()=>Re,registry:()=>dc,safeDecode:()=>cm,safeDecodeAsync:()=>um,safeEncode:()=>am,safeEncodeAsync:()=>lm,safeParse:()=>ds,safeParseAsync:()=>om,set:()=>aS,setErrorMap:()=>qy,size:()=>no,slugify:()=>lr,startsWith:()=>or,strictObject:()=>oS,string:()=>c,stringFormat:()=>Ug,stringbool:()=>RS,success:()=>dS,superRefine:()=>Gm,symbol:()=>Yg,templateLiteral:()=>fS,toJSONSchema:()=>ao,toLowerCase:()=>ar,toUpperCase:()=>cr,transform:()=>fl,treeifyError:()=>Su,trim:()=>ir,tuple:()=>wm,uint32:()=>Bg,uint64:()=>Gg,ulid:()=>Eg,undefined:()=>Qg,union:()=>x,unknown:()=>T,uppercase:()=>er,url:()=>fr,util:()=>O,uuid:()=>bg,uuidv4:()=>yg,uuidv6:()=>vg,uuidv7:()=>zg,void:()=>Xg,xid:()=>kg,xor:()=>rS});var st={};ot(st,{$ZodAny:()=>Bd,$ZodArray:()=>Qd,$ZodAsyncError:()=>Ae,$ZodBase64:()=>Ad,$ZodBase64URL:()=>jd,$ZodBigInt:()=>sc,$ZodBigIntFormat:()=>Hd,$ZodBoolean:()=>ns,$ZodCIDRv4:()=>Md,$ZodCIDRv6:()=>qd,$ZodCUID:()=>zd,$ZodCUID2:()=>Rd,$ZodCatch:()=>gp,$ZodCheck:()=>F,$ZodCheckBigIntFormat:()=>Qu,$ZodCheckEndsWith:()=>ud,$ZodCheckGreaterThan:()=>Xa,$ZodCheckIncludes:()=>cd,$ZodCheckLengthEquals:()=>nd,$ZodCheckLessThan:()=>Qa,$ZodCheckLowerCase:()=>id,$ZodCheckMaxLength:()=>od,$ZodCheckMaxSize:()=>Xu,$ZodCheckMimeType:()=>pd,$ZodCheckMinLength:()=>rd,$ZodCheckMinSize:()=>ed,$ZodCheckMultipleOf:()=>Gu,$ZodCheckNumberFormat:()=>Yu,$ZodCheckOverwrite:()=>hd,$ZodCheckProperty:()=>dd,$ZodCheckRegex:()=>sd,$ZodCheckSizeEquals:()=>td,$ZodCheckStartsWith:()=>ld,$ZodCheckStringFormat:()=>Yo,$ZodCheckUpperCase:()=>ad,$ZodCodec:()=>is,$ZodCustom:()=>wp,$ZodCustomStringFormat:()=>Zd,$ZodDate:()=>Yd,$ZodDefault:()=>pp,$ZodDiscriminatedUnion:()=>tp,$ZodE164:()=>Ld,$ZodEmail:()=>_d,$ZodEmoji:()=>yd,$ZodEncodeError:()=>Rt,$ZodEnum:()=>ip,$ZodError:()=>Qn,$ZodExactOptional:()=>up,$ZodFile:()=>cp,$ZodFunction:()=>vp,$ZodGUID:()=>gd,$ZodIPv4:()=>Cd,$ZodIPv6:()=>Id,$ZodISODate:()=>Ed,$ZodISODateTime:()=>Pd,$ZodISODuration:()=>$d,$ZodISOTime:()=>kd,$ZodIntersection:()=>op,$ZodJWT:()=>Ud,$ZodKSUID:()=>Td,$ZodLazy:()=>Rp,$ZodLiteral:()=>ap,$ZodMAC:()=>Od,$ZodMap:()=>np,$ZodNaN:()=>Sp,$ZodNanoID:()=>vd,$ZodNever:()=>Kd,$ZodNonOptional:()=>mp,$ZodNull:()=>Jd,$ZodNullable:()=>dp,$ZodNumber:()=>nc,$ZodNumberFormat:()=>Dd,$ZodObject:()=>pg,$ZodObjectJIT:()=>Xd,$ZodOptional:()=>ac,$ZodPipe:()=>cc,$ZodPrefault:()=>hp,$ZodPreprocess:()=>_p,$ZodPromise:()=>zp,$ZodReadonly:()=>bp,$ZodRealError:()=>be,$ZodRecord:()=>rp,$ZodRegistry:()=>uc,$ZodSet:()=>sp,$ZodString:()=>ro,$ZodStringFormat:()=>Z,$ZodSuccess:()=>fp,$ZodSymbol:()=>Fd,$ZodTemplateLiteral:()=>yp,$ZodTransform:()=>lp,$ZodTuple:()=>ic,$ZodType:()=>M,$ZodULID:()=>wd,$ZodURL:()=>bd,$ZodUUID:()=>Sd,$ZodUndefined:()=>Vd,$ZodUnion:()=>ss,$ZodUnknown:()=>Wd,$ZodVoid:()=>Gd,$ZodXID:()=>xd,$ZodXor:()=>ep,$brand:()=>nu,$constructor:()=>h,$input:()=>Tp,$output:()=>xp,Doc:()=>rs,JSONSchema:()=>fg,JSONSchemaGenerator:()=>Uc,NEVER:()=>Vn,TimePrecision:()=>$p,_any:()=>Yp,_array:()=>nh,_base64:()=>Ec,_base64url:()=>kc,_bigint:()=>Fp,_boolean:()=>Dp,_catch:()=>xy,_check:()=>mg,_cidrv4:()=>Tc,_cidrv6:()=>Pc,_coercedBigint:()=>Vp,_coercedBoolean:()=>Hp,_coercedDate:()=>oh,_coercedNumber:()=>Np,_coercedString:()=>Ep,_cuid:()=>bc,_cuid2:()=>yc,_custom:()=>ih,_date:()=>th,_decode:()=>Ha,_decodeAsync:()=>Va,_default:()=>zy,_discriminatedUnion:()=>uy,_e164:()=>$c,_email:()=>pc,_emoji:()=>Sc,_encode:()=>Da,_encodeAsync:()=>Fa,_endsWith:()=>rr,_enum:()=>gy,_file:()=>sh,_float32:()=>jp,_float64:()=>Lp,_gt:()=>He,_gte:()=>fe,_guid:()=>cs,_includes:()=>tr,_int:()=>Ap,_int32:()=>Up,_int64:()=>Jp,_intersection:()=>dy,_ipv4:()=>wc,_ipv6:()=>xc,_isoDate:()=>Ip,_isoDateTime:()=>Cp,_isoDuration:()=>Mp,_isoTime:()=>Op,_jwt:()=>Cc,_ksuid:()=>Rc,_lazy:()=>ky,_length:()=>io,_literal:()=>_y,_lowercase:()=>Xo,_lt:()=>De,_lte:()=>we,_mac:()=>kp,_map:()=>my,_max:()=>we,_maxLength:()=>so,_maxSize:()=>kt,_mime:()=>nr,_min:()=>fe,_minLength:()=>nt,_minSize:()=>Fe,_multipleOf:()=>Et,_nan:()=>rh,_nanoid:()=>_c,_nativeEnum:()=>Sy,_negative:()=>Oc,_never:()=>Xp,_nonnegative:()=>qc,_nonoptional:()=>Ry,_nonpositive:()=>Mc,_normalize:()=>sr,_null:()=>Gp,_nullable:()=>vy,_number:()=>qp,_optional:()=>yy,_overwrite:()=>je,_parse:()=>Bo,_parseAsync:()=>Wo,_pipe:()=>Ty,_positive:()=>Ic,_promise:()=>$y,_property:()=>Nc,_readonly:()=>Py,_record:()=>hy,_refine:()=>ah,_regex:()=>Qo,_safeDecode:()=>Ba,_safeDecodeAsync:()=>Ka,_safeEncode:()=>Ja,_safeEncodeAsync:()=>Wa,_safeParse:()=>Ko,_safeParseAsync:()=>Go,_set:()=>fy,_size:()=>no,_slugify:()=>lr,_startsWith:()=>or,_string:()=>Pp,_stringFormat:()=>ur,_stringbool:()=>dh,_success:()=>wy,_superRefine:()=>ch,_symbol:()=>Wp,_templateLiteral:()=>Ey,_toLowerCase:()=>ar,_toUpperCase:()=>cr,_transform:()=>by,_trim:()=>ir,_tuple:()=>py,_uint32:()=>Zp,_uint64:()=>Bp,_ulid:()=>vc,_undefined:()=>Kp,_union:()=>cy,_unknown:()=>Qp,_uppercase:()=>er,_url:()=>ls,_uuid:()=>hc,_uuidv4:()=>mc,_uuidv6:()=>fc,_uuidv7:()=>gc,_void:()=>eh,_xid:()=>zc,_xor:()=>ly,clone:()=>he,config:()=>Y,createStandardJSONSchemaMethod:()=>dr,createToJSONSchemaMethod:()=>ph,decode:()=>xb,decodeAsync:()=>Pb,describe:()=>lh,encode:()=>wb,encodeAsync:()=>Tb,extractDefs:()=>Ct,finalize:()=>It,flattenError:()=>Xn,formatError:()=>es,globalConfig:()=>eo,globalRegistry:()=>re,initializeContext:()=>$t,isValidBase64:()=>Nd,isValidBase64URL:()=>cg,isValidJWT:()=>lg,locales:()=>as,meta:()=>uh,parse:()=>Ua,parseAsync:()=>Za,prettifyError:()=>_u,process:()=>L,regexes:()=>Re,registry:()=>dc,safeDecode:()=>kb,safeDecodeAsync:()=>Cb,safeEncode:()=>Eb,safeEncodeAsync:()=>$b,safeParse:()=>bu,safeParseAsync:()=>yu,toDotPath:()=>Zf,toJSONSchema:()=>ao,treeifyError:()=>Su,util:()=>O,version:()=>md});var Nf,Vn=Object.freeze({status:"aborted"});function h(e,t,o){function r(l,u){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,u);let d=a.prototype,m=Object.keys(d);for(let S=0;S<m.length;S++){let _=m[S];_ in l||(l[_]=d[_].bind(l))}}let n=o?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function a(l){var u;let d=o?.Parent?new s:this;r(d,l),(u=d._zod).deferred??(u.deferred=[]);for(let m of d._zod.deferred)m();return d}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>o?.Parent&&l instanceof o.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var nu=Symbol("zod_brand"),Ae=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Rt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Nf=globalThis).__zod_globalConfig??(Nf.__zod_globalConfig={});var eo=globalThis.__zod_globalConfig;function Y(e){return e&&Object.assign(eo,e),eo}var O={};ot(O,{BIGINT_FORMAT_RANGES:()=>mu,Class:()=>iu,NUMBER_FORMAT_RANGES:()=>hu,aborted:()=>Pt,allowsEval:()=>lu,assert:()=>ob,assertEqual:()=>Q_,assertIs:()=>eb,assertNever:()=>tb,assertNotEqual:()=>X_,assignProp:()=>xt,base64ToUint8Array:()=>jf,base64urlToUint8Array:()=>bb,cached:()=>Vo,captureStackTrace:()=>ja,cleanEnum:()=>_b,cleanRegex:()=>Wn,clone:()=>he,cloneDef:()=>nb,createTransparentProxy:()=>ub,defineLazy:()=>N,esc:()=>Aa,escapeRegex:()=>Ie,explicitlyAborted:()=>fu,extend:()=>hb,finalizeIssue:()=>me,floatSafeRemainder:()=>au,getElementAtPath:()=>sb,getEnumValues:()=>Bn,getLengthableOrigin:()=>Yn,getParsedType:()=>lb,getSizableOrigin:()=>Gn,hexToUint8Array:()=>vb,isObject:()=>to,isPlainObject:()=>Tt,issue:()=>Jo,joinValues:()=>Na,jsonStringifyReplacer:()=>Fo,merge:()=>fb,mergeDefs:()=>rt,normalizeParams:()=>v,nullish:()=>wt,numKeys:()=>cb,objectClone:()=>rb,omit:()=>pb,optionalKeys:()=>pu,parsedType:()=>gu,partial:()=>gb,pick:()=>db,prefixIssues:()=>_e,primitiveTypes:()=>du,promiseAllObject:()=>ib,propertyKeyTypes:()=>Kn,randomString:()=>ab,required:()=>Sb,safeExtend:()=>mb,shallowClone:()=>uu,slugify:()=>cu,stringifyPrimitive:()=>La,uint8ArrayToBase64:()=>Lf,uint8ArrayToBase64url:()=>yb,uint8ArrayToHex:()=>zb,unwrapMessage:()=>Jn});function Q_(e){return e}function X_(e){return e}function eb(e){}function tb(e){throw new Error("Unexpected value in exhaustive check")}function ob(e){}function Bn(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 Na(e,t="|"){return e.map(o=>La(o)).join(t)}function Fo(e,t){return typeof t=="bigint"?t.toString():t}function Vo(e){return{get value(){{let o=e();return Object.defineProperty(this,"value",{value:o}),o}throw new Error("cached value already set")}}}function wt(e){return e==null}function Wn(e){let t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function au(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 Af=Symbol("evaluating");function N(e,t,o){let r;Object.defineProperty(e,t,{get(){if(r!==Af)return r===void 0&&(r=Af,r=o()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function rb(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function xt(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function rt(...e){let t={};for(let o of e){let r=Object.getOwnPropertyDescriptors(o);Object.assign(t,r)}return Object.defineProperties({},t)}function nb(e){return rt(e._zod.def)}function sb(e,t){return t?t.reduce((o,r)=>o?.[r],e):e}function ib(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 ab(e=10){let t="abcdefghijklmnopqrstuvwxyz",o="";for(let r=0;r<e;r++)o+=t[Math.floor(Math.random()*t.length)];return o}function Aa(e){return JSON.stringify(e)}function cu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ja="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function to(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var lu=Vo(()=>{if(eo.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Tt(e){if(to(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let o=t.prototype;return!(to(o)===!1||Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)}function uu(e){return Tt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function cb(e){let t=0;for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&t++;return t}var lb=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Kn=new Set(["string","number","symbol"]),du=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ie(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function he(e,t,o){let r=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(r._zod.parent=e),r}function v(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 ub(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 pu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var hu={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]},mu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function db(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=rt(e._zod.def,{get shape(){let a={};for(let l in t){if(!(l in o.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=o.shape[l])}return xt(this,"shape",a),a},checks:[]});return he(e,s)}function pb(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=rt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let l in t){if(!(l in o.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return xt(this,"shape",a),a},checks:[]});return he(e,s)}function hb(e,t){if(!Tt(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 a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=rt(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return xt(this,"shape",s),s}});return he(e,n)}function mb(e,t){if(!Tt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let o=rt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return xt(this,"shape",r),r}});return he(e,o)}function fb(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=rt(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 he(e,o)}function gb(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 a=rt(t._zod.def,{get shape(){let l=t._zod.def.shape,u={...l};if(o)for(let d in o){if(!(d in l))throw new Error(`Unrecognized key: "${d}"`);o[d]&&(u[d]=e?new e({type:"optional",innerType:l[d]}):l[d])}else for(let d in l)u[d]=e?new e({type:"optional",innerType:l[d]}):l[d];return xt(this,"shape",u),u},checks:[]});return he(t,a)}function Sb(e,t,o){let r=rt(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(o)for(let a in o){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);o[a]&&(s[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(let a in n)s[a]=new e({type:"nonoptional",innerType:n[a]});return xt(this,"shape",s),s}});return he(t,r)}function Pt(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 fu(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 _e(e,t){return t.map(o=>{var r;return(r=o).path??(r.path=[]),o.path.unshift(e),o})}function Jn(e){return typeof e=="string"?e:e?.message}function me(e,t,o){let r=e.message?e.message:Jn(e.inst?._zod.def?.error?.(e))??Jn(t?.error?.(e))??Jn(o.customError?.(e))??Jn(o.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:a,...l}=e;return l.path??(l.path=[]),l.message=r,t?.reportInput&&(l.input=a),l}function Gn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Yn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function gu(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 _b(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 bb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-t.length%4)%4);return jf(t+o)}function yb(e){return Lf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function vb(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 zb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var iu=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,Fo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Qn=h("$ZodError",Uf),be=h("$ZodError",Uf,{Parent:Error});function Xn(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 es(e,t=o=>o.message){let o={_errors:[]},r=(n,s=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(l=>r({issues:l},[...s,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...s,...a.path]);else{let l=[...s,...a.path];if(l.length===0)o._errors.push(t(a));else{let u=o,d=0;for(;d<l.length;){let m=l[d];d===l.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(a))):u[m]=u[m]||{_errors:[]},u=u[m],d++}}}};return r(e),o}function Su(e,t=o=>o.message){let o={errors:[]},r=(n,s=[])=>{var a,l;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>r({issues:d},[...s,...u.path]));else if(u.code==="invalid_key")r({issues:u.issues},[...s,...u.path]);else if(u.code==="invalid_element")r({issues:u.issues},[...s,...u.path]);else{let d=[...s,...u.path];if(d.length===0){o.errors.push(t(u));continue}let m=o,S=0;for(;S<d.length;){let _=d[S],y=S===d.length-1;typeof _=="string"?(m.properties??(m.properties={}),(a=m.properties)[_]??(a[_]={errors:[]}),m=m.properties[_]):(m.items??(m.items=[]),(l=m.items)[_]??(l[_]={errors:[]}),m=m.items[_]),y&&m.errors.push(t(u)),S++}}};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 _u(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},a=t._zod.run({value:o,issues:[]},s);if(a instanceof Promise)throw new Ae;if(a.issues.length){let l=new(n?.Err??e)(a.issues.map(u=>me(u,s,Y())));throw ja(l,n?.callee),l}return a.value},Ua=Bo(be),Wo=e=>async(t,o,r,n)=>{let s=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:o,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let l=new(n?.Err??e)(a.issues.map(u=>me(u,s,Y())));throw ja(l,n?.callee),l}return a.value},Za=Wo(be),Ko=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??Qn)(s.issues.map(a=>me(a,n,Y())))}:{success:!0,data:s.value}},bu=Ko(be),Go=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(a=>me(a,n,Y())))}:{success:!0,data:s.value}},yu=Go(be),Da=e=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Bo(e)(t,o,n)},wb=Da(be),Ha=e=>(t,o,r)=>Bo(e)(t,o,r),xb=Ha(be),Fa=e=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Wo(e)(t,o,n)},Tb=Fa(be),Va=e=>async(t,o,r)=>Wo(e)(t,o,r),Pb=Va(be),Ja=e=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Ko(e)(t,o,n)},Eb=Ja(be),Ba=e=>(t,o,r)=>Ko(e)(t,o,r),kb=Ba(be),Wa=e=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Go(e)(t,o,n)},$b=Wa(be),Ka=e=>async(t,o,r)=>Go(e)(t,o,r),Cb=Ka(be);var Re={};ot(Re,{base64:()=>Nu,base64url:()=>Ga,bigint:()=>Hu,boolean:()=>Vu,browserEmail:()=>Lb,cidrv4:()=>Mu,cidrv6:()=>qu,cuid:()=>vu,cuid2:()=>zu,date:()=>Lu,datetime:()=>Zu,domain:()=>Db,duration:()=>Pu,e164:()=>ju,email:()=>ku,emoji:()=>$u,extendedDuration:()=>Ib,guid:()=>Eu,hex:()=>Hb,hostname:()=>Zb,html5Email:()=>Nb,httpProtocol:()=>Au,idnEmail:()=>jb,integer:()=>Fu,ipv4:()=>Cu,ipv6:()=>Iu,ksuid:()=>xu,lowercase:()=>Wu,mac:()=>Ou,md5_base64:()=>Vb,md5_base64url:()=>Jb,md5_hex:()=>Fb,nanoid:()=>Tu,null:()=>Ju,number:()=>Ya,rfc5322Email:()=>Ab,sha1_base64:()=>Wb,sha1_base64url:()=>Kb,sha1_hex:()=>Bb,sha256_base64:()=>Yb,sha256_base64url:()=>Qb,sha256_hex:()=>Gb,sha384_base64:()=>ey,sha384_base64url:()=>ty,sha384_hex:()=>Xb,sha512_base64:()=>ry,sha512_base64url:()=>ny,sha512_hex:()=>oy,string:()=>Du,time:()=>Uu,ulid:()=>Ru,undefined:()=>Bu,unicodeEmail:()=>Df,uppercase:()=>Ku,uuid:()=>oo,uuid4:()=>Ob,uuid6:()=>Mb,uuid7:()=>qb,xid:()=>wu});var vu=/^[cC][0-9a-z]{6,}$/,zu=/^[0-9a-z]+$/,Ru=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wu=/^[0-9a-vA-V]{20}$/,xu=/^[A-Za-z0-9]{27}$/,Tu=/^[a-zA-Z0-9_-]{21}$/,Pu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ib=/^[-+]?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)?)??$/,Eu=/^([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})$/,oo=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)$/,Ob=oo(4),Mb=oo(6),qb=oo(7),ku=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Nb=/^[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])?)*$/,Ab=/^(([^<>()\[\]\\.,;:\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,jb=Df,Lb=/^[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])?)*$/,Ub="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $u(){return new RegExp(Ub,"u")}var Cu=/^(?:(?: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])$/,Iu=/^(([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}|:))$/,Ou=e=>{let t=Ie(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Mu=/^((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])$/,qu=/^(([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])$/,Nu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ga=/^[A-Za-z0-9_-]*$/,Zb=/^(?=.{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])?)*\.?$/,Db=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Au=/^https?$/,ju=/^\+[1-9]\d{6,14}$/,Hf="(?:(?:\\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])))",Lu=new RegExp(`^${Hf}$`);function Ff(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 Uu(e){return new RegExp(`^${Ff(e)}$`)}function Zu(e){let t=Ff({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(`^${Hf}T(?:${r})$`)}var Du=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Hu=/^-?\d+n?$/,Fu=/^-?\d+$/,Ya=/^-?\d+(?:\.\d+)?$/,Vu=/^(?:true|false)$/i,Ju=/^null$/i;var Bu=/^undefined$/i;var Wu=/^[^A-Z]*$/,Ku=/^[^a-z]*$/,Hb=/^[0-9a-fA-F]*$/;function ts(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function os(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Fb=/^[0-9a-fA-F]{32}$/,Vb=ts(22,"=="),Jb=os(22),Bb=/^[0-9a-fA-F]{40}$/,Wb=ts(27,"="),Kb=os(27),Gb=/^[0-9a-fA-F]{64}$/,Yb=ts(43,"="),Qb=os(43),Xb=/^[0-9a-fA-F]{96}$/,ey=ts(64,""),ty=os(64),oy=/^[0-9a-fA-F]{128}$/,ry=ts(86,"=="),ny=os(86);var F=h("$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=h("$ZodCheckLessThan",(e,t)=>{F.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=h("$ZodCheckGreaterThan",(e,t)=>{F.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})}}),Gu=h("$ZodCheckMultipleOf",(e,t)=>{F.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):au(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})}}),Yu=h("$ZodCheckNumberFormat",(e,t)=>{F.init(e,t),t.format=t.format||"float64";let o=t.format?.includes("int"),r=o?"int":"number",[n,s]=hu[t.format];e._zod.onattach.push(a=>{let l=a._zod.bag;l.format=t.format,l.minimum=n,l.maximum=s,o&&(l.pattern=Fu)}),e._zod.check=a=>{let l=a.value;if(o){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,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}):a.issues.push({input:l,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}}l<n&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Qu=h("$ZodCheckBigIntFormat",(e,t)=>{F.init(e,t);let[o,r]=mu[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})}}),Xu=h("$ZodCheckMaxSize",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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})}}),ed=h("$ZodCheckMinSize",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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})}}),td=h("$ZodCheckSizeEquals",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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 a=s>t.size;r.issues.push({origin:Gn(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),od=h("$ZodCheckMaxLength",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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 a=Yn(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),rd=h("$ZodCheckMinLength",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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 a=Yn(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),nd=h("$ZodCheckLengthEquals",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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 a=Yn(n),l=s>t.length;r.issues.push({origin:a,...l?{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=h("$ZodCheckStringFormat",(e,t)=>{var o,r;F.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=()=>{})}),sd=h("$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})}}),id=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Wu),Yo.init(e,t)}),ad=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ku),Yo.init(e,t)}),cd=h("$ZodCheckIncludes",(e,t)=>{F.init(e,t);let o=Ie(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})}}),ld=h("$ZodCheckStartsWith",(e,t)=>{F.init(e,t);let o=new RegExp(`^${Ie(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})}}),ud=h("$ZodCheckEndsWith",(e,t)=>{F.init(e,t);let o=new RegExp(`.*${Ie(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 Vf(e,t,o){e.issues.length&&t.issues.push(..._e(o,e.issues))}var dd=h("$ZodCheckProperty",(e,t)=>{F.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=>Vf(n,o,t.property));Vf(r,o,t.property)}}),pd=h("$ZodCheckMimeType",(e,t)=>{F.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})}}),hd=h("$ZodCheckOverwrite",(e,t)=>{F.init(e,t),e._zod.check=o=>{o.value=t.tx(o.value)}});var rs=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(`
1
+ var V_=Object.defineProperty;var ot=(e,t)=>{for(var o in t)V_(e,o,{get:t[o],enumerable:!0})};var J_=Object.create,qa=Object.defineProperty,B_=Object.getOwnPropertyDescriptor,W_=Object.getOwnPropertyNames,K_=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)qa(o,r,{get:e[r],enumerable:!0});return t&&qa(o,Symbol.toStringTag,{value:"Module"}),o},Y_=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var n=W_(t),s=0,a=n.length,l;s<a;s++)l=n[s],!G_.call(e,l)&&l!==o&&qa(e,l,{get:(u=>t[u]).bind(null,l),enumerable:!(r=B_(t,l))||r.enumerable});return e},Mf=(e,t,o)=>(o=e!=null?J_(K_(e)):{},Y_(t||!e||!e.__esModule?qa(o,"default",{value:e,enumerable:!0}):o,e));var Q_=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]);function qf(e){return typeof e=="string"&&Q_.has(e.replace(/#$/,""))}var i={};ot(i,{$brand:()=>nu,$input:()=>Tp,$output:()=>xp,NEVER:()=>Vn,TimePrecision:()=>$p,ZodAny:()=>fm,ZodArray:()=>bm,ZodBase64:()=>cl,ZodBase64URL:()=>ll,ZodBigInt:()=>br,ZodBigIntFormat:()=>pl,ZodBoolean:()=>_r,ZodCIDRv4:()=>il,ZodCIDRv6:()=>al,ZodCUID:()=>Xc,ZodCUID2:()=>el,ZodCatch:()=>Lm,ZodCodec:()=>ys,ZodCustom:()=>vs,ZodCustomStringFormat:()=>gr,ZodDate:()=>gs,ZodDefault:()=>Om,ZodDiscriminatedUnion:()=>vm,ZodE164:()=>ul,ZodEmail:()=>Kc,ZodEmoji:()=>Yc,ZodEnum:()=>hr,ZodError:()=>My,ZodExactOptional:()=>$m,ZodFile:()=>Em,ZodFirstPartyTypeKind:()=>Ym,ZodFunction:()=>Wm,ZodGUID:()=>ps,ZodIPv4:()=>nl,ZodIPv6:()=>sl,ZodISODate:()=>Hc,ZodISODateTime:()=>Dc,ZodISODuration:()=>Vc,ZodISOTime:()=>Fc,ZodIntersection:()=>zm,ZodIssueCode:()=>Qm,ZodJWT:()=>dl,ZodKSUID:()=>rl,ZodLazy:()=>Jm,ZodLiteral:()=>Pm,ZodMAC:()=>dm,ZodMap:()=>xm,ZodNaN:()=>Zm,ZodNanoID:()=>Qc,ZodNever:()=>Sm,ZodNonOptional:()=>Sl,ZodNull:()=>mm,ZodNullable:()=>Im,ZodNumber:()=>Sr,ZodNumberFormat:()=>co,ZodObject:()=>Ss,ZodOptional:()=>gl,ZodPipe:()=>bs,ZodPrefault:()=>qm,ZodPreprocess:()=>Dm,ZodPromise:()=>Bm,ZodReadonly:()=>Hm,ZodRealError:()=>ye,ZodRecord:()=>pr,ZodSet:()=>Tm,ZodString:()=>mr,ZodStringFormat:()=>D,ZodSuccess:()=>jm,ZodSymbol:()=>pm,ZodTemplateLiteral:()=>Vm,ZodTransform:()=>km,ZodTuple:()=>Rm,ZodType:()=>q,ZodULID:()=>tl,ZodURL:()=>fs,ZodUUID:()=>Ve,ZodUndefined:()=>hm,ZodUnion:()=>_s,ZodUnknown:()=>gm,ZodVoid:()=>_m,ZodXID:()=>ol,ZodXor:()=>ym,_ZodString:()=>Wc,_default:()=>Mm,_function:()=>SS,any:()=>hl,array:()=>f,base64:()=>Ng,base64url:()=>Ag,bigint:()=>Wg,boolean:()=>R,catch:()=>Um,check:()=>_S,cidrv4:()=>Mg,cidrv6:()=>qg,clone:()=>he,codec:()=>hS,coerce:()=>zs,config:()=>Y,core:()=>st,cuid:()=>Tg,cuid2:()=>Pg,custom:()=>bS,date:()=>eS,decode:()=>nm,decodeAsync:()=>im,describe:()=>yS,discriminatedUnion:()=>Ot,e164:()=>jg,email:()=>Gc,emoji:()=>wg,encode:()=>rm,encodeAsync:()=>sm,endsWith:()=>rr,enum:()=>C,exactOptional:()=>Cm,file:()=>lS,flattenError:()=>Xn,float32:()=>Fg,float64:()=>Vg,formatError:()=>es,fromJSONSchema:()=>TS,function:()=>SS,getErrorMap:()=>Ay,globalRegistry:()=>re,gt:()=>He,gte:()=>fe,guid:()=>_g,hash:()=>Hg,hex:()=>Dg,hostname:()=>Zg,httpUrl:()=>Rg,includes:()=>tr,instanceof:()=>zS,int:()=>Jc,int32:()=>Jg,int64:()=>Kg,intersection:()=>Le,invertCodec:()=>mS,ipv4:()=>Cg,ipv6:()=>Og,iso:()=>xe,json:()=>wS,jwt:()=>Lg,keyof:()=>tS,ksuid:()=>$g,lazy:()=>Mt,length:()=>io,literal:()=>g,locales:()=>as,looseObject:()=>k,looseRecord:()=>sS,lowercase:()=>Xo,lt:()=>De,lte:()=>we,mac:()=>Ig,map:()=>iS,maxLength:()=>so,maxSize:()=>kt,meta:()=>vS,mime:()=>nr,minLength:()=>nt,minSize:()=>Fe,multipleOf:()=>Et,nan:()=>pS,nanoid:()=>xg,nativeEnum:()=>cS,negative:()=>Oc,never:()=>ml,nonnegative:()=>qc,nonoptional:()=>Am,nonpositive:()=>Mc,normalize:()=>sr,null:()=>Je,nullable:()=>hs,nullish:()=>uS,number:()=>b,object:()=>p,optional:()=>P,overwrite:()=>je,parse:()=>em,parseAsync:()=>tm,partialRecord:()=>nS,pipe:()=>Bc,positive:()=>Ic,prefault:()=>Nm,preprocess:()=>it,prettifyError:()=>_u,promise:()=>gS,property:()=>Nc,readonly:()=>Fm,record:()=>z,refine:()=>Km,regex:()=>Qo,regexes:()=>Re,registry:()=>dc,safeDecode:()=>cm,safeDecodeAsync:()=>um,safeEncode:()=>am,safeEncodeAsync:()=>lm,safeParse:()=>ds,safeParseAsync:()=>om,set:()=>aS,setErrorMap:()=>Ny,size:()=>no,slugify:()=>lr,startsWith:()=>or,strictObject:()=>oS,string:()=>c,stringFormat:()=>Ug,stringbool:()=>RS,success:()=>dS,superRefine:()=>Gm,symbol:()=>Yg,templateLiteral:()=>fS,toJSONSchema:()=>ao,toLowerCase:()=>ar,toUpperCase:()=>cr,transform:()=>fl,treeifyError:()=>Su,trim:()=>ir,tuple:()=>wm,uint32:()=>Bg,uint64:()=>Gg,ulid:()=>Eg,undefined:()=>Qg,union:()=>x,unknown:()=>T,uppercase:()=>er,url:()=>fr,util:()=>O,uuid:()=>bg,uuidv4:()=>yg,uuidv6:()=>vg,uuidv7:()=>zg,void:()=>Xg,xid:()=>kg,xor:()=>rS});var st={};ot(st,{$ZodAny:()=>Bd,$ZodArray:()=>Qd,$ZodAsyncError:()=>Ae,$ZodBase64:()=>Ad,$ZodBase64URL:()=>jd,$ZodBigInt:()=>sc,$ZodBigIntFormat:()=>Hd,$ZodBoolean:()=>ns,$ZodCIDRv4:()=>Md,$ZodCIDRv6:()=>qd,$ZodCUID:()=>zd,$ZodCUID2:()=>Rd,$ZodCatch:()=>gp,$ZodCheck:()=>F,$ZodCheckBigIntFormat:()=>Qu,$ZodCheckEndsWith:()=>ud,$ZodCheckGreaterThan:()=>Xa,$ZodCheckIncludes:()=>cd,$ZodCheckLengthEquals:()=>nd,$ZodCheckLessThan:()=>Qa,$ZodCheckLowerCase:()=>id,$ZodCheckMaxLength:()=>od,$ZodCheckMaxSize:()=>Xu,$ZodCheckMimeType:()=>pd,$ZodCheckMinLength:()=>rd,$ZodCheckMinSize:()=>ed,$ZodCheckMultipleOf:()=>Gu,$ZodCheckNumberFormat:()=>Yu,$ZodCheckOverwrite:()=>hd,$ZodCheckProperty:()=>dd,$ZodCheckRegex:()=>sd,$ZodCheckSizeEquals:()=>td,$ZodCheckStartsWith:()=>ld,$ZodCheckStringFormat:()=>Yo,$ZodCheckUpperCase:()=>ad,$ZodCodec:()=>is,$ZodCustom:()=>wp,$ZodCustomStringFormat:()=>Zd,$ZodDate:()=>Yd,$ZodDefault:()=>pp,$ZodDiscriminatedUnion:()=>tp,$ZodE164:()=>Ld,$ZodEmail:()=>_d,$ZodEmoji:()=>yd,$ZodEncodeError:()=>Rt,$ZodEnum:()=>ip,$ZodError:()=>Qn,$ZodExactOptional:()=>up,$ZodFile:()=>cp,$ZodFunction:()=>vp,$ZodGUID:()=>gd,$ZodIPv4:()=>Cd,$ZodIPv6:()=>Id,$ZodISODate:()=>Ed,$ZodISODateTime:()=>Pd,$ZodISODuration:()=>$d,$ZodISOTime:()=>kd,$ZodIntersection:()=>op,$ZodJWT:()=>Ud,$ZodKSUID:()=>Td,$ZodLazy:()=>Rp,$ZodLiteral:()=>ap,$ZodMAC:()=>Od,$ZodMap:()=>np,$ZodNaN:()=>Sp,$ZodNanoID:()=>vd,$ZodNever:()=>Kd,$ZodNonOptional:()=>mp,$ZodNull:()=>Jd,$ZodNullable:()=>dp,$ZodNumber:()=>nc,$ZodNumberFormat:()=>Dd,$ZodObject:()=>pg,$ZodObjectJIT:()=>Xd,$ZodOptional:()=>ac,$ZodPipe:()=>cc,$ZodPrefault:()=>hp,$ZodPreprocess:()=>_p,$ZodPromise:()=>zp,$ZodReadonly:()=>bp,$ZodRealError:()=>be,$ZodRecord:()=>rp,$ZodRegistry:()=>uc,$ZodSet:()=>sp,$ZodString:()=>ro,$ZodStringFormat:()=>Z,$ZodSuccess:()=>fp,$ZodSymbol:()=>Fd,$ZodTemplateLiteral:()=>yp,$ZodTransform:()=>lp,$ZodTuple:()=>ic,$ZodType:()=>M,$ZodULID:()=>wd,$ZodURL:()=>bd,$ZodUUID:()=>Sd,$ZodUndefined:()=>Vd,$ZodUnion:()=>ss,$ZodUnknown:()=>Wd,$ZodVoid:()=>Gd,$ZodXID:()=>xd,$ZodXor:()=>ep,$brand:()=>nu,$constructor:()=>h,$input:()=>Tp,$output:()=>xp,Doc:()=>rs,JSONSchema:()=>fg,JSONSchemaGenerator:()=>Uc,NEVER:()=>Vn,TimePrecision:()=>$p,_any:()=>Yp,_array:()=>nh,_base64:()=>Ec,_base64url:()=>kc,_bigint:()=>Fp,_boolean:()=>Dp,_catch:()=>Ty,_check:()=>mg,_cidrv4:()=>Tc,_cidrv6:()=>Pc,_coercedBigint:()=>Vp,_coercedBoolean:()=>Hp,_coercedDate:()=>oh,_coercedNumber:()=>Np,_coercedString:()=>Ep,_cuid:()=>bc,_cuid2:()=>yc,_custom:()=>ih,_date:()=>th,_decode:()=>Ha,_decodeAsync:()=>Va,_default:()=>Ry,_discriminatedUnion:()=>dy,_e164:()=>$c,_email:()=>pc,_emoji:()=>Sc,_encode:()=>Da,_encodeAsync:()=>Fa,_endsWith:()=>rr,_enum:()=>Sy,_file:()=>sh,_float32:()=>jp,_float64:()=>Lp,_gt:()=>He,_gte:()=>fe,_guid:()=>cs,_includes:()=>tr,_int:()=>Ap,_int32:()=>Up,_int64:()=>Jp,_intersection:()=>py,_ipv4:()=>wc,_ipv6:()=>xc,_isoDate:()=>Ip,_isoDateTime:()=>Cp,_isoDuration:()=>Mp,_isoTime:()=>Op,_jwt:()=>Cc,_ksuid:()=>Rc,_lazy:()=>$y,_length:()=>io,_literal:()=>by,_lowercase:()=>Xo,_lt:()=>De,_lte:()=>we,_mac:()=>kp,_map:()=>fy,_max:()=>we,_maxLength:()=>so,_maxSize:()=>kt,_mime:()=>nr,_min:()=>fe,_minLength:()=>nt,_minSize:()=>Fe,_multipleOf:()=>Et,_nan:()=>rh,_nanoid:()=>_c,_nativeEnum:()=>_y,_negative:()=>Oc,_never:()=>Xp,_nonnegative:()=>qc,_nonoptional:()=>wy,_nonpositive:()=>Mc,_normalize:()=>sr,_null:()=>Gp,_nullable:()=>zy,_number:()=>qp,_optional:()=>vy,_overwrite:()=>je,_parse:()=>Bo,_parseAsync:()=>Wo,_pipe:()=>Py,_positive:()=>Ic,_promise:()=>Cy,_property:()=>Nc,_readonly:()=>Ey,_record:()=>my,_refine:()=>ah,_regex:()=>Qo,_safeDecode:()=>Ba,_safeDecodeAsync:()=>Ka,_safeEncode:()=>Ja,_safeEncodeAsync:()=>Wa,_safeParse:()=>Ko,_safeParseAsync:()=>Go,_set:()=>gy,_size:()=>no,_slugify:()=>lr,_startsWith:()=>or,_string:()=>Pp,_stringFormat:()=>ur,_stringbool:()=>dh,_success:()=>xy,_superRefine:()=>ch,_symbol:()=>Wp,_templateLiteral:()=>ky,_toLowerCase:()=>ar,_toUpperCase:()=>cr,_transform:()=>yy,_trim:()=>ir,_tuple:()=>hy,_uint32:()=>Zp,_uint64:()=>Bp,_ulid:()=>vc,_undefined:()=>Kp,_union:()=>ly,_unknown:()=>Qp,_uppercase:()=>er,_url:()=>ls,_uuid:()=>hc,_uuidv4:()=>mc,_uuidv6:()=>fc,_uuidv7:()=>gc,_void:()=>eh,_xid:()=>zc,_xor:()=>uy,clone:()=>he,config:()=>Y,createStandardJSONSchemaMethod:()=>dr,createToJSONSchemaMethod:()=>ph,decode:()=>Tb,decodeAsync:()=>Eb,describe:()=>lh,encode:()=>xb,encodeAsync:()=>Pb,extractDefs:()=>Ct,finalize:()=>It,flattenError:()=>Xn,formatError:()=>es,globalConfig:()=>eo,globalRegistry:()=>re,initializeContext:()=>$t,isValidBase64:()=>Nd,isValidBase64URL:()=>cg,isValidJWT:()=>lg,locales:()=>as,meta:()=>uh,parse:()=>Ua,parseAsync:()=>Za,prettifyError:()=>_u,process:()=>L,regexes:()=>Re,registry:()=>dc,safeDecode:()=>$b,safeDecodeAsync:()=>Ib,safeEncode:()=>kb,safeEncodeAsync:()=>Cb,safeParse:()=>bu,safeParseAsync:()=>yu,toDotPath:()=>Zf,toJSONSchema:()=>ao,treeifyError:()=>Su,util:()=>O,version:()=>md});var Nf,Vn=Object.freeze({status:"aborted"});function h(e,t,o){function r(l,u){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:u,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,u);let d=a.prototype,m=Object.keys(d);for(let S=0;S<m.length;S++){let _=m[S];_ in l||(l[_]=d[_].bind(l))}}let n=o?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function a(l){var u;let d=o?.Parent?new s:this;r(d,l),(u=d._zod).deferred??(u.deferred=[]);for(let m of d._zod.deferred)m();return d}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:l=>o?.Parent&&l instanceof o.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}var nu=Symbol("zod_brand"),Ae=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},Rt=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(Nf=globalThis).__zod_globalConfig??(Nf.__zod_globalConfig={});var eo=globalThis.__zod_globalConfig;function Y(e){return e&&Object.assign(eo,e),eo}var O={};ot(O,{BIGINT_FORMAT_RANGES:()=>mu,Class:()=>iu,NUMBER_FORMAT_RANGES:()=>hu,aborted:()=>Pt,allowsEval:()=>lu,assert:()=>rb,assertEqual:()=>X_,assertIs:()=>tb,assertNever:()=>ob,assertNotEqual:()=>eb,assignProp:()=>xt,base64ToUint8Array:()=>jf,base64urlToUint8Array:()=>yb,cached:()=>Vo,captureStackTrace:()=>ja,cleanEnum:()=>bb,cleanRegex:()=>Wn,clone:()=>he,cloneDef:()=>sb,createTransparentProxy:()=>db,defineLazy:()=>N,esc:()=>Aa,escapeRegex:()=>Ie,explicitlyAborted:()=>fu,extend:()=>mb,finalizeIssue:()=>me,floatSafeRemainder:()=>au,getElementAtPath:()=>ib,getEnumValues:()=>Bn,getLengthableOrigin:()=>Yn,getParsedType:()=>ub,getSizableOrigin:()=>Gn,hexToUint8Array:()=>zb,isObject:()=>to,isPlainObject:()=>Tt,issue:()=>Jo,joinValues:()=>Na,jsonStringifyReplacer:()=>Fo,merge:()=>gb,mergeDefs:()=>rt,normalizeParams:()=>v,nullish:()=>wt,numKeys:()=>lb,objectClone:()=>nb,omit:()=>hb,optionalKeys:()=>pu,parsedType:()=>gu,partial:()=>Sb,pick:()=>pb,prefixIssues:()=>_e,primitiveTypes:()=>du,promiseAllObject:()=>ab,propertyKeyTypes:()=>Kn,randomString:()=>cb,required:()=>_b,safeExtend:()=>fb,shallowClone:()=>uu,slugify:()=>cu,stringifyPrimitive:()=>La,uint8ArrayToBase64:()=>Lf,uint8ArrayToBase64url:()=>vb,uint8ArrayToHex:()=>Rb,unwrapMessage:()=>Jn});function X_(e){return e}function eb(e){return e}function tb(e){}function ob(e){throw new Error("Unexpected value in exhaustive check")}function rb(e){}function Bn(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 Na(e,t="|"){return e.map(o=>La(o)).join(t)}function Fo(e,t){return typeof t=="bigint"?t.toString():t}function Vo(e){return{get value(){{let o=e();return Object.defineProperty(this,"value",{value:o}),o}throw new Error("cached value already set")}}}function wt(e){return e==null}function Wn(e){let t=e.startsWith("^")?1:0,o=e.endsWith("$")?e.length-1:e.length;return e.slice(t,o)}function au(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 Af=Symbol("evaluating");function N(e,t,o){let r;Object.defineProperty(e,t,{get(){if(r!==Af)return r===void 0&&(r=Af,r=o()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function nb(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function xt(e,t,o){Object.defineProperty(e,t,{value:o,writable:!0,enumerable:!0,configurable:!0})}function rt(...e){let t={};for(let o of e){let r=Object.getOwnPropertyDescriptors(o);Object.assign(t,r)}return Object.defineProperties({},t)}function sb(e){return rt(e._zod.def)}function ib(e,t){return t?t.reduce((o,r)=>o?.[r],e):e}function ab(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 cb(e=10){let t="abcdefghijklmnopqrstuvwxyz",o="";for(let r=0;r<e;r++)o+=t[Math.floor(Math.random()*t.length)];return o}function Aa(e){return JSON.stringify(e)}function cu(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ja="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function to(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var lu=Vo(()=>{if(eo.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function Tt(e){if(to(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let o=t.prototype;return!(to(o)===!1||Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)}function uu(e){return Tt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function lb(e){let t=0;for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&t++;return t}var ub=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Kn=new Set(["string","number","symbol"]),du=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ie(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function he(e,t,o){let r=new e._zod.constr(t??e._zod.def);return(!t||o?.parent)&&(r._zod.parent=e),r}function v(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 db(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 pu(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var hu={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]},mu={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function pb(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=rt(e._zod.def,{get shape(){let a={};for(let l in t){if(!(l in o.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(a[l]=o.shape[l])}return xt(this,"shape",a),a},checks:[]});return he(e,s)}function hb(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=rt(e._zod.def,{get shape(){let a={...e._zod.def.shape};for(let l in t){if(!(l in o.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete a[l]}return xt(this,"shape",a),a},checks:[]});return he(e,s)}function mb(e,t){if(!Tt(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 a in t)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=rt(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return xt(this,"shape",s),s}});return he(e,n)}function fb(e,t){if(!Tt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let o=rt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return xt(this,"shape",r),r}});return he(e,o)}function gb(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=rt(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 he(e,o)}function Sb(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 a=rt(t._zod.def,{get shape(){let l=t._zod.def.shape,u={...l};if(o)for(let d in o){if(!(d in l))throw new Error(`Unrecognized key: "${d}"`);o[d]&&(u[d]=e?new e({type:"optional",innerType:l[d]}):l[d])}else for(let d in l)u[d]=e?new e({type:"optional",innerType:l[d]}):l[d];return xt(this,"shape",u),u},checks:[]});return he(t,a)}function _b(e,t,o){let r=rt(t._zod.def,{get shape(){let n=t._zod.def.shape,s={...n};if(o)for(let a in o){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);o[a]&&(s[a]=new e({type:"nonoptional",innerType:n[a]}))}else for(let a in n)s[a]=new e({type:"nonoptional",innerType:n[a]});return xt(this,"shape",s),s}});return he(t,r)}function Pt(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 fu(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 _e(e,t){return t.map(o=>{var r;return(r=o).path??(r.path=[]),o.path.unshift(e),o})}function Jn(e){return typeof e=="string"?e:e?.message}function me(e,t,o){let r=e.message?e.message:Jn(e.inst?._zod.def?.error?.(e))??Jn(t?.error?.(e))??Jn(o.customError?.(e))??Jn(o.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:a,...l}=e;return l.path??(l.path=[]),l.message=r,t?.reportInput&&(l.input=a),l}function Gn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function Yn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function gu(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 bb(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 yb(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-t.length%4)%4);return jf(t+o)}function vb(e){return Lf(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function zb(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 Rb(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var iu=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,Fo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Qn=h("$ZodError",Uf),be=h("$ZodError",Uf,{Parent:Error});function Xn(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 es(e,t=o=>o.message){let o={_errors:[]},r=(n,s=[])=>{for(let a of n.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(l=>r({issues:l},[...s,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...s,...a.path]);else{let l=[...s,...a.path];if(l.length===0)o._errors.push(t(a));else{let u=o,d=0;for(;d<l.length;){let m=l[d];d===l.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(a))):u[m]=u[m]||{_errors:[]},u=u[m],d++}}}};return r(e),o}function Su(e,t=o=>o.message){let o={errors:[]},r=(n,s=[])=>{var a,l;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>r({issues:d},[...s,...u.path]));else if(u.code==="invalid_key")r({issues:u.issues},[...s,...u.path]);else if(u.code==="invalid_element")r({issues:u.issues},[...s,...u.path]);else{let d=[...s,...u.path];if(d.length===0){o.errors.push(t(u));continue}let m=o,S=0;for(;S<d.length;){let _=d[S],y=S===d.length-1;typeof _=="string"?(m.properties??(m.properties={}),(a=m.properties)[_]??(a[_]={errors:[]}),m=m.properties[_]):(m.items??(m.items=[]),(l=m.items)[_]??(l[_]={errors:[]}),m=m.items[_]),y&&m.errors.push(t(u)),S++}}};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 _u(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},a=t._zod.run({value:o,issues:[]},s);if(a instanceof Promise)throw new Ae;if(a.issues.length){let l=new(n?.Err??e)(a.issues.map(u=>me(u,s,Y())));throw ja(l,n?.callee),l}return a.value},Ua=Bo(be),Wo=e=>async(t,o,r,n)=>{let s=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:o,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){let l=new(n?.Err??e)(a.issues.map(u=>me(u,s,Y())));throw ja(l,n?.callee),l}return a.value},Za=Wo(be),Ko=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??Qn)(s.issues.map(a=>me(a,n,Y())))}:{success:!0,data:s.value}},bu=Ko(be),Go=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(a=>me(a,n,Y())))}:{success:!0,data:s.value}},yu=Go(be),Da=e=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Bo(e)(t,o,n)},xb=Da(be),Ha=e=>(t,o,r)=>Bo(e)(t,o,r),Tb=Ha(be),Fa=e=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Wo(e)(t,o,n)},Pb=Fa(be),Va=e=>async(t,o,r)=>Wo(e)(t,o,r),Eb=Va(be),Ja=e=>(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Ko(e)(t,o,n)},kb=Ja(be),Ba=e=>(t,o,r)=>Ko(e)(t,o,r),$b=Ba(be),Wa=e=>async(t,o,r)=>{let n=r?{...r,direction:"backward"}:{direction:"backward"};return Go(e)(t,o,n)},Cb=Wa(be),Ka=e=>async(t,o,r)=>Go(e)(t,o,r),Ib=Ka(be);var Re={};ot(Re,{base64:()=>Nu,base64url:()=>Ga,bigint:()=>Hu,boolean:()=>Vu,browserEmail:()=>Ub,cidrv4:()=>Mu,cidrv6:()=>qu,cuid:()=>vu,cuid2:()=>zu,date:()=>Lu,datetime:()=>Zu,domain:()=>Hb,duration:()=>Pu,e164:()=>ju,email:()=>ku,emoji:()=>$u,extendedDuration:()=>Ob,guid:()=>Eu,hex:()=>Fb,hostname:()=>Db,html5Email:()=>Ab,httpProtocol:()=>Au,idnEmail:()=>Lb,integer:()=>Fu,ipv4:()=>Cu,ipv6:()=>Iu,ksuid:()=>xu,lowercase:()=>Wu,mac:()=>Ou,md5_base64:()=>Jb,md5_base64url:()=>Bb,md5_hex:()=>Vb,nanoid:()=>Tu,null:()=>Ju,number:()=>Ya,rfc5322Email:()=>jb,sha1_base64:()=>Kb,sha1_base64url:()=>Gb,sha1_hex:()=>Wb,sha256_base64:()=>Qb,sha256_base64url:()=>Xb,sha256_hex:()=>Yb,sha384_base64:()=>ty,sha384_base64url:()=>oy,sha384_hex:()=>ey,sha512_base64:()=>ny,sha512_base64url:()=>sy,sha512_hex:()=>ry,string:()=>Du,time:()=>Uu,ulid:()=>Ru,undefined:()=>Bu,unicodeEmail:()=>Df,uppercase:()=>Ku,uuid:()=>oo,uuid4:()=>Mb,uuid6:()=>qb,uuid7:()=>Nb,xid:()=>wu});var vu=/^[cC][0-9a-z]{6,}$/,zu=/^[0-9a-z]+$/,Ru=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wu=/^[0-9a-vA-V]{20}$/,xu=/^[A-Za-z0-9]{27}$/,Tu=/^[a-zA-Z0-9_-]{21}$/,Pu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ob=/^[-+]?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)?)??$/,Eu=/^([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})$/,oo=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)$/,Mb=oo(4),qb=oo(6),Nb=oo(7),ku=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ab=/^[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])?)*$/,jb=/^(([^<>()\[\]\\.,;:\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,Lb=Df,Ub=/^[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])?)*$/,Zb="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function $u(){return new RegExp(Zb,"u")}var Cu=/^(?:(?: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])$/,Iu=/^(([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}|:))$/,Ou=e=>{let t=Ie(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Mu=/^((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])$/,qu=/^(([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])$/,Nu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ga=/^[A-Za-z0-9_-]*$/,Db=/^(?=.{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])?)*\.?$/,Hb=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,Au=/^https?$/,ju=/^\+[1-9]\d{6,14}$/,Hf="(?:(?:\\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])))",Lu=new RegExp(`^${Hf}$`);function Ff(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 Uu(e){return new RegExp(`^${Ff(e)}$`)}function Zu(e){let t=Ff({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(`^${Hf}T(?:${r})$`)}var Du=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Hu=/^-?\d+n?$/,Fu=/^-?\d+$/,Ya=/^-?\d+(?:\.\d+)?$/,Vu=/^(?:true|false)$/i,Ju=/^null$/i;var Bu=/^undefined$/i;var Wu=/^[^A-Z]*$/,Ku=/^[^a-z]*$/,Fb=/^[0-9a-fA-F]*$/;function ts(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function os(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Vb=/^[0-9a-fA-F]{32}$/,Jb=ts(22,"=="),Bb=os(22),Wb=/^[0-9a-fA-F]{40}$/,Kb=ts(27,"="),Gb=os(27),Yb=/^[0-9a-fA-F]{64}$/,Qb=ts(43,"="),Xb=os(43),ey=/^[0-9a-fA-F]{96}$/,ty=ts(64,""),oy=os(64),ry=/^[0-9a-fA-F]{128}$/,ny=ts(86,"=="),sy=os(86);var F=h("$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=h("$ZodCheckLessThan",(e,t)=>{F.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=h("$ZodCheckGreaterThan",(e,t)=>{F.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})}}),Gu=h("$ZodCheckMultipleOf",(e,t)=>{F.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):au(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})}}),Yu=h("$ZodCheckNumberFormat",(e,t)=>{F.init(e,t),t.format=t.format||"float64";let o=t.format?.includes("int"),r=o?"int":"number",[n,s]=hu[t.format];e._zod.onattach.push(a=>{let l=a._zod.bag;l.format=t.format,l.minimum=n,l.maximum=s,o&&(l.pattern=Fu)}),e._zod.check=a=>{let l=a.value;if(o){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,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}):a.issues.push({input:l,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}}l<n&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort}),l>s&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),Qu=h("$ZodCheckBigIntFormat",(e,t)=>{F.init(e,t);let[o,r]=mu[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})}}),Xu=h("$ZodCheckMaxSize",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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})}}),ed=h("$ZodCheckMinSize",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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})}}),td=h("$ZodCheckSizeEquals",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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 a=s>t.size;r.issues.push({origin:Gn(n),...a?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),od=h("$ZodCheckMaxLength",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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 a=Yn(n);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),rd=h("$ZodCheckMinLength",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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 a=Yn(n);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),nd=h("$ZodCheckLengthEquals",(e,t)=>{var o;F.init(e,t),(o=e._zod.def).when??(o.when=r=>{let n=r.value;return!wt(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 a=Yn(n),l=s>t.length;r.issues.push({origin:a,...l?{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=h("$ZodCheckStringFormat",(e,t)=>{var o,r;F.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=()=>{})}),sd=h("$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})}}),id=h("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Wu),Yo.init(e,t)}),ad=h("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ku),Yo.init(e,t)}),cd=h("$ZodCheckIncludes",(e,t)=>{F.init(e,t);let o=Ie(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})}}),ld=h("$ZodCheckStartsWith",(e,t)=>{F.init(e,t);let o=new RegExp(`^${Ie(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})}}),ud=h("$ZodCheckEndsWith",(e,t)=>{F.init(e,t);let o=new RegExp(`.*${Ie(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 Vf(e,t,o){e.issues.length&&t.issues.push(..._e(o,e.issues))}var dd=h("$ZodCheckProperty",(e,t)=>{F.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=>Vf(n,o,t.property));Vf(r,o,t.property)}}),pd=h("$ZodCheckMimeType",(e,t)=>{F.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})}}),hd=h("$ZodCheckOverwrite",(e,t)=>{F.init(e,t),e._zod.check=o=>{o.value=t.tx(o.value)}});var rs=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
3
  `).filter(a=>a),n=Math.min(...r.map(a=>a.length-a.trimStart().length)),s=r.map(a=>a.slice(n)).map(a=>" ".repeat(this.indent*2)+a);for(let a of s)this.content.push(a)}compile(){let t=Function,o=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...o,n.join(`
4
4
  `))}};var md={major:4,minor:4,patch:3};var M=h("$ZodType",(e,t)=>{var o;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=md;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=(a,l,u)=>{let d=Pt(a),m;for(let S of l){if(S._zod.def.when){if(fu(a)||!S._zod.def.when(a))continue}else if(d)continue;let _=a.issues.length,y=S._zod.check(a);if(y instanceof Promise&&u?.async===!1)throw new Ae;if(m||y instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await y,a.issues.length!==_&&(d||(d=Pt(a,_)))});else{if(a.issues.length===_)continue;d||(d=Pt(a,_))}}return m?m.then(()=>a):a},s=(a,l,u)=>{if(Pt(a))return a.aborted=!0,a;let d=n(l,r,u);if(d instanceof Promise){if(u.async===!1)throw new Ae;return d.then(m=>e._zod.parse(m,u))}return e._zod.parse(d,u)};e._zod.run=(a,l)=>{if(l.skipChecks)return e._zod.parse(a,l);if(l.direction==="backward"){let d=e._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return d instanceof Promise?d.then(m=>s(m,a,l)):s(d,a,l)}let u=e._zod.parse(a,l);if(u instanceof Promise){if(l.async===!1)throw new Ae;return u.then(d=>n(d,r,l))}return n(u,r,l)}}N(e,"~standard",()=>({validate:n=>{try{let s=bu(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return yu(e,n).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),ro=h("$ZodString",(e,t)=>{M.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Du(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}}),Z=h("$ZodStringFormat",(e,t)=>{Yo.init(e,t),ro.init(e,t)}),gd=h("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Eu),Z.init(e,t)}),Sd=h("$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=oo(r))}else t.pattern??(t.pattern=oo());Z.init(e,t)}),_d=h("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ku),Z.init(e,t)}),bd=h("$ZodURL",(e,t)=>{Z.init(e,t),e._zod.check=o=>{try{let r=o.value.trim();if(!t.normalize&&t.protocol?.source===Au.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})}}}),yd=h("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=$u()),Z.init(e,t)}),vd=h("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Tu),Z.init(e,t)}),zd=h("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=vu),Z.init(e,t)}),Rd=h("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=zu),Z.init(e,t)}),wd=h("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ru),Z.init(e,t)}),xd=h("$ZodXID",(e,t)=>{t.pattern??(t.pattern=wu),Z.init(e,t)}),Td=h("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=xu),Z.init(e,t)}),Pd=h("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Zu(t)),Z.init(e,t)}),Ed=h("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Lu),Z.init(e,t)}),kd=h("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Uu(t)),Z.init(e,t)}),$d=h("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Pu),Z.init(e,t)}),Cd=h("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Cu),Z.init(e,t),e._zod.bag.format="ipv4"}),Id=h("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Iu),Z.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})}}}),Od=h("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Ou(t.delimiter)),Z.init(e,t),e._zod.bag.format="mac"}),Md=h("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Mu),Z.init(e,t)}),qd=h("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=qu),Z.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 a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>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 Nd(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var Ad=h("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Nu),Z.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=o=>{Nd(o.value)||o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:e,continue:!t.abort})}});function cg(e){if(!Ga.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),o=t.padEnd(Math.ceil(t.length/4)*4,"=");return Nd(o)}var jd=h("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Ga),Z.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})}}),Ld=h("$ZodE164",(e,t)=>{t.pattern??(t.pattern=ju),Z.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 Ud=h("$ZodJWT",(e,t)=>{Z.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})}}),Zd=h("$ZodCustomStringFormat",(e,t)=>{Z.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=h("$ZodNumber",(e,t)=>{M.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}}),Dd=h("$ZodNumberFormat",(e,t)=>{Yu.init(e,t),nc.init(e,t)}),ns=h("$ZodBoolean",(e,t)=>{M.init(e,t),e._zod.pattern=Vu,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=h("$ZodBigInt",(e,t)=>{M.init(e,t),e._zod.pattern=Hu,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}}),Hd=h("$ZodBigIntFormat",(e,t)=>{Qu.init(e,t),sc.init(e,t)}),Fd=h("$ZodSymbol",(e,t)=>{M.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}}),Vd=h("$ZodUndefined",(e,t)=>{M.init(e,t),e._zod.pattern=Bu,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}}),Jd=h("$ZodNull",(e,t)=>{M.init(e,t),e._zod.pattern=Ju,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}}),Bd=h("$ZodAny",(e,t)=>{M.init(e,t),e._zod.parse=o=>o}),Wd=h("$ZodUnknown",(e,t)=>{M.init(e,t),e._zod.parse=o=>o}),Kd=h("$ZodNever",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>(o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:e}),o)}),Gd=h("$ZodVoid",(e,t)=>{M.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}}),Yd=h("$ZodDate",(e,t)=>{M.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 Wf(e,t,o){e.issues.length&&t.issues.push(..._e(o,e.issues)),t.value[o]=e.value}var Qd=h("$ZodArray",(e,t)=>{M.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 a=0;a<n.length;a++){let l=n[a],u=t.element._zod.run({value:l,issues:[]},r);u instanceof Promise?s.push(u.then(d=>Wf(d,o,a))):Wf(u,o,a)}return s.length?Promise.all(s).then(()=>o):o}});function rc(e,t,o,r,n,s){let a=o in r;if(e.issues.length){if(n&&s&&!a)return;t.issues.push(..._e(o,e.issues))}if(!a&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[o]});return}e.value===void 0?a&&(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=pu(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 a=[],l=n.keySet,u=n.catchall._zod,d=u.def.type,m=u.optin==="optional",S=u.optout==="optional";for(let _ in t){if(_==="__proto__"||l.has(_))continue;if(d==="never"){a.push(_);continue}let y=u.run({value:t[_],issues:[]},r);y instanceof Promise?e.push(y.then(E=>rc(E,o,_,t,m,S))):rc(y,o,_,t,m,S)}return a.length&&o.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:s}),e.length?Promise.all(e).then(()=>o):o}var pg=h("$ZodObject",(e,t)=>{if(M.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let l=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...l};return Object.defineProperty(t,"shape",{value:u}),u}})}let r=Vo(()=>ug(t));N(e._zod,"propValues",()=>{let l=t.shape,u={};for(let d in l){let m=l[d]._zod;if(m.values){u[d]??(u[d]=new Set);for(let S of m.values)u[d].add(S)}}return u});let n=to,s=t.catchall,a;e._zod.parse=(l,u)=>{a??(a=r.value);let d=l.value;if(!n(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value={};let m=[],S=a.shape;for(let _ of a.keys){let y=S[_],E=y._zod.optin==="optional",$=y._zod.optout==="optional",I=y._zod.run({value:d[_],issues:[]},u);I instanceof Promise?m.push(I.then(H=>rc(H,l,_,d,E,$))):rc(I,l,_,d,E,$)}return s?dg(m,d,l,u,r.value,e):m.length?Promise.all(m).then(()=>l):l}}),Xd=h("$ZodObjectJIT",(e,t)=>{pg.init(e,t);let o=e._zod.parse,r=Vo(()=>ug(t)),n=_=>{let y=new rs(["shape","payload","ctx"]),E=r.value,$=U=>{let j=Aa(U);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};y.write("const input = payload.value;");let I=Object.create(null),H=0;for(let U of E.keys)I[U]=`key_${H++}`;y.write("const newResult = {};");for(let U of E.keys){let j=I[U],J=Aa(U),V=_[U],ee=V?._zod?.optin==="optional",Xe=V?._zod?.optout==="optional";y.write(`const ${j} = ${$(U)};`),ee&&Xe?y.write(`
5
5
  if (${j}.issues.length) {
@@ -60,9 +60,9 @@ var F_=Object.defineProperty;var ot=(e,t)=>{for(var o in t)F_(e,o,{get:t[o],enum
60
60
  }
61
61
  }
62
62
 
63
- `)}y.write("payload.value = newResult;"),y.write("return payload;");let G=y.compile();return(U,j)=>G(_,U,j)},s,a=to,l=!eo.jitless,d=l&&lu.value,m=t.catchall,S;e._zod.parse=(_,y)=>{S??(S=r.value);let E=_.value;return a(E)?l&&d&&y?.async===!1&&y.jitless!==!0?(s||(s=n(t.shape)),_=s(_,y),m?dg([],E,_,y,S,e):_):o(_,y):(_.issues.push({expected:"object",code:"invalid_type",input:E,inst:e}),_)}});function Kf(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=>!Pt(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(a=>me(a,r,Y())))}),t)}var ss=h("$ZodUnion",(e,t)=>{M.init(e,t),N(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),N(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),N(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),N(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=>Wn(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,a=[];for(let l of t.options){let u=l._zod.run({value:r.value,issues:[]},n);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(l=>Kf(l,r,e,n)):Kf(a,r,e,n)}});function Gf(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(a=>me(a,r,Y())))}):t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:[],inclusive:!1}),t)}var ep=h("$ZodXor",(e,t)=>{ss.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,a=[];for(let l of t.options){let u=l._zod.run({value:r.value,issues:[]},n);u instanceof Promise?(a.push(u),s=!0):a.push(u)}return s?Promise.all(a).then(l=>Gf(l,r,e,n)):Gf(a,r,e,n)}}),tp=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ss.init(e,t);let o=e._zod.parse;N(e._zod,"propValues",()=>{let n={};for(let s of t.options){let a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[l,u]of Object.entries(a)){n[l]||(n[l]=new Set);for(let d of u)n[l].add(d)}}return n});let r=Vo(()=>{let n=t.options,s=new Map;for(let a of n){let l=a._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let u of l){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,a)}}return s});e._zod.parse=(n,s)=>{let a=n.value;if(!to(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let l=r.value.get(a?.[t.discriminator]);return l?l._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:a,path:[t.discriminator],inst:e}),n)}}),op=h("$ZodIntersection",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>{let n=o.value,s=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([u,d])=>Yf(o,u,d)):Yf(o,s,a)}});function fd(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(Tt(e)&&Tt(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 a=fd(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=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],s=t[r],a=fd(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};o.push(a.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Yf(e,t,o){let r=new Map,n;for(let l of t.issues)if(l.code==="unrecognized_keys"){n??(n=l);for(let u of l.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(l);for(let l of o.issues)if(l.code==="unrecognized_keys")for(let u of l.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(l);let s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&n&&e.issues.push({...n,keys:s}),Pt(e))return e;let a=fd(t.value,o.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var ic=h("$ZodTuple",(e,t)=>{M.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 a=[],l=Qf(o,"optin"),u=Qf(o,"optout");if(!t.rest){if(s.length<l)return r.issues.push({code:"too_small",minimum:l,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 d=new Array(o.length);for(let m=0;m<o.length;m++){let S=o[m]._zod.run({value:s[m],issues:[]},n);S instanceof Promise?a.push(S.then(_=>{d[m]=_})):d[m]=S}if(t.rest){let m=o.length-1,S=s.slice(o.length);for(let _ of S){m++;let y=t.rest._zod.run({value:_,issues:[]},n);y instanceof Promise?a.push(y.then(E=>Xf(E,r,m))):Xf(y,r,m)}}return a.length?Promise.all(a).then(()=>eg(d,r,o,s,u)):eg(d,r,o,s,u)}});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(..._e(o,e.issues)),t.value[o]=e.value}function eg(e,t,o,r,n){for(let s=0;s<o.length;s++){let a=e[s],l=s<r.length;if(a.issues.length){if(!l&&s>=n){t.value.length=s;break}t.issues.push(..._e(s,a.issues))}t.value[s]=a.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 rp=h("$ZodRecord",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Tt(n))return o.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),o;let s=[],a=t.keyType._zod.values;if(a){o.value={};let l=new Set;for(let d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){l.add(typeof d=="number"?d.toString():d);let m=t.keyType._zod.run({value:d,issues:[]},r);if(m instanceof Promise)throw new 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(y=>me(y,r,Y())),input:d,path:[d],inst:e});continue}let S=m.value,_=t.valueType._zod.run({value:n[d],issues:[]},r);_ instanceof Promise?s.push(_.then(y=>{y.issues.length&&o.issues.push(..._e(d,y.issues)),o.value[S]=y.value})):(_.issues.length&&o.issues.push(..._e(d,_.issues)),o.value[S]=_.value)}let u;for(let d in n)l.has(d)||(u=u??[],u.push(d));u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:u})}else{o.value={};for(let l of Reflect.ownKeys(n)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Ya.test(l)&&u.issues.length){let S=t.keyType._zod.run({value:Number(l),issues:[]},r);if(S instanceof Promise)throw new Error("Async schemas not supported in object keys currently");S.issues.length===0&&(u=S)}if(u.issues.length){t.mode==="loose"?o.value[l]=n[l]:o.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(S=>me(S,r,Y())),input:l,path:[l],inst:e});continue}let m=t.valueType._zod.run({value:n[l],issues:[]},r);m instanceof Promise?s.push(m.then(S=>{S.issues.length&&o.issues.push(..._e(l,S.issues)),o.value[u.value]=S.value})):(m.issues.length&&o.issues.push(..._e(l,m.issues)),o.value[u.value]=m.value)}}return s.length?Promise.all(s).then(()=>o):o}}),np=h("$ZodMap",(e,t)=>{M.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[a,l]of n){let u=t.keyType._zod.run({value:a,issues:[]},r),d=t.valueType._zod.run({value:l,issues:[]},r);u instanceof Promise||d instanceof Promise?s.push(Promise.all([u,d]).then(([m,S])=>{tg(m,S,o,a,n,e,r)})):tg(u,d,o,a,n,e,r)}return s.length?Promise.all(s).then(()=>o):o}});function tg(e,t,o,r,n,s,a){e.issues.length&&(Kn.has(typeof r)?o.issues.push(..._e(r,e.issues)):o.issues.push({code:"invalid_key",origin:"map",input:n,inst:s,issues:e.issues.map(l=>me(l,a,Y()))})),t.issues.length&&(Kn.has(typeof r)?o.issues.push(..._e(r,t.issues)):o.issues.push({origin:"map",code:"invalid_element",input:n,inst:s,key:r,issues:t.issues.map(l=>me(l,a,Y()))})),o.value.set(e.value,t.value)}var sp=h("$ZodSet",(e,t)=>{M.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 a of n){let l=t.valueType._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(u=>og(u,o))):og(l,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 ip=h("$ZodEnum",(e,t)=>{M.init(e,t);let o=Bn(t.entries),r=new Set(o);e._zod.values=r,e._zod.pattern=new RegExp(`^(${o.filter(n=>Kn.has(typeof n)).map(n=>typeof n=="string"?Ie(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:o,input:a,inst:e}),n}}),ap=h("$ZodLiteral",(e,t)=>{if(M.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"?Ie(r):r?Ie(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}}),cp=h("$ZodFile",(e,t)=>{M.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}}),lp=h("$ZodTransform",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Rt(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 rg(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var ac=h("$ZodOptional",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),N(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Wn(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(a=>rg(a,n)):rg(s,n)}return o.value===void 0?o:t.innerType._zod.run(o,r)}}),up=h("$ZodExactOptional",(e,t)=>{ac.init(e,t),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(o,r)=>t.innerType._zod.run(o,r)}),dp=h("$ZodNullable",(e,t)=>{M.init(e,t),N(e._zod,"optin",()=>t.innerType._zod.optin),N(e._zod,"optout",()=>t.innerType._zod.optout),N(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Wn(o.source)}|null)$`):void 0}),N(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)}),pp=h("$ZodDefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",N(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 hp=h("$ZodPrefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",N(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))}),mp=h("$ZodNonOptional",(e,t)=>{M.init(e,t),N(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 fp=h("$ZodSuccess",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Rt("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)}}),gp=h("$ZodCatch",(e,t)=>{M.init(e,t),e._zod.optin="optional",N(e._zod,"optout",()=>t.innerType._zod.optout),N(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(a=>me(a,r,Y()))},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=>me(s,r,Y()))},input:o.value}),o.issues=[],o.fallback=!0),o)}}),Sp=h("$ZodNaN",(e,t)=>{M.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=h("$ZodPipe",(e,t)=>{M.init(e,t),N(e._zod,"values",()=>t.in._zod.values),N(e._zod,"optin",()=>t.in._zod.optin),N(e._zod,"optout",()=>t.out._zod.optout),N(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(a=>ec(a,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 is=h("$ZodCodec",(e,t)=>{M.init(e,t),N(e._zod,"values",()=>t.in._zod.values),N(e._zod,"optin",()=>t.in._zod.optin),N(e._zod,"optout",()=>t.out._zod.optout),N(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(a=>tc(a,t,r)):tc(s,t,r)}else{let s=t.out._zod.run(o,r);return s instanceof Promise?s.then(a=>tc(a,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 _p=h("$ZodPreprocess",(e,t)=>{cc.init(e,t)}),bp=h("$ZodReadonly",(e,t)=>{M.init(e,t),N(e._zod,"propValues",()=>t.innerType._zod.propValues),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"optin",()=>t.innerType?._zod?.optin),N(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 yp=h("$ZodTemplateLiteral",(e,t)=>{M.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,a=n.endsWith("$")?n.length-1:n.length;o.push(n.slice(s,a))}else if(r===null||du.has(typeof r))o.push(Ie(`${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)}),vp=h("$ZodFunction",(e,t)=>(M.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)),zp=h("$ZodPromise",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>Promise.resolve(o.value).then(n=>t.innerType._zod.run({value:n,issues:[]},r))}),Rp=h("$ZodLazy",(e,t)=>{M.init(e,t),N(e._zod,"innerType",()=>{let o=t;return o._cachedInner||(o._cachedInner=t.getter()),o._cachedInner}),N(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),N(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),N(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),N(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(o,r)=>e._zod.innerType._zod.run(o,r)}),wp=h("$ZodCustom",(e,t)=>{F.init(e,t),M.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 as={};ot(as,{en:()=>lc});var iy=()=>{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,a=gu(n.input),l=r[a]??a;return`Invalid input: expected ${s}, received ${l}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${La(n.values[0])}`:`Invalid option: expected one of ${Na(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",a=t(n.origin);return a?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",a=t(n.origin);return a?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${a.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":""}: ${Na(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(a=>`'${a}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function lc(){return{localeError:iy()}}var hg,xp=Symbol("ZodOutput"),Tp=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 re=globalThis.__zod_globalRegistry;function Pp(e,t){return new e({type:"string",...v(t)})}function Ep(e,t){return new e({type:"string",coerce:!0,...v(t)})}function pc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function cs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...v(t)})}function hc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...v(t)})}function fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...v(t)})}function gc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...v(t)})}function ls(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function Sc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...v(t)})}function _c(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...v(t)})}function bc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...v(t)})}function yc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...v(t)})}function vc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...v(t)})}function zc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...v(t)})}function Rc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...v(t)})}function wc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function xc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function kp(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...v(t)})}function Tc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...v(t)})}function Pc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...v(t)})}function Ec(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...v(t)})}function kc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...v(t)})}function $c(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...v(t)})}function Cc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...v(t)})}var $p={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Cp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function Ip(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function Op(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function Mp(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function qp(e,t){return new e({type:"number",checks:[],...v(t)})}function Np(e,t){return new e({type:"number",coerce:!0,checks:[],...v(t)})}function Ap(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function jp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...v(t)})}function Lp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...v(t)})}function Up(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...v(t)})}function Zp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...v(t)})}function Dp(e,t){return new e({type:"boolean",...v(t)})}function Hp(e,t){return new e({type:"boolean",coerce:!0,...v(t)})}function Fp(e,t){return new e({type:"bigint",...v(t)})}function Vp(e,t){return new e({type:"bigint",coerce:!0,...v(t)})}function Jp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...v(t)})}function Bp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...v(t)})}function Wp(e,t){return new e({type:"symbol",...v(t)})}function Kp(e,t){return new e({type:"undefined",...v(t)})}function Gp(e,t){return new e({type:"null",...v(t)})}function Yp(e){return new e({type:"any"})}function Qp(e){return new e({type:"unknown"})}function Xp(e,t){return new e({type:"never",...v(t)})}function eh(e,t){return new e({type:"void",...v(t)})}function th(e,t){return new e({type:"date",...v(t)})}function oh(e,t){return new e({type:"date",coerce:!0,...v(t)})}function rh(e,t){return new e({type:"nan",...v(t)})}function De(e,t){return new Qa({check:"less_than",...v(t),value:e,inclusive:!1})}function we(e,t){return new Qa({check:"less_than",...v(t),value:e,inclusive:!0})}function He(e,t){return new Xa({check:"greater_than",...v(t),value:e,inclusive:!1})}function fe(e,t){return new Xa({check:"greater_than",...v(t),value:e,inclusive:!0})}function Ic(e){return He(0,e)}function Oc(e){return De(0,e)}function Mc(e){return we(0,e)}function qc(e){return fe(0,e)}function Et(e,t){return new Gu({check:"multiple_of",...v(t),value:e})}function kt(e,t){return new Xu({check:"max_size",...v(t),maximum:e})}function Fe(e,t){return new ed({check:"min_size",...v(t),minimum:e})}function no(e,t){return new td({check:"size_equals",...v(t),size:e})}function so(e,t){return new od({check:"max_length",...v(t),maximum:e})}function nt(e,t){return new rd({check:"min_length",...v(t),minimum:e})}function io(e,t){return new nd({check:"length_equals",...v(t),length:e})}function Qo(e,t){return new sd({check:"string_format",format:"regex",...v(t),pattern:e})}function Xo(e){return new id({check:"string_format",format:"lowercase",...v(e)})}function er(e){return new ad({check:"string_format",format:"uppercase",...v(e)})}function tr(e,t){return new cd({check:"string_format",format:"includes",...v(t),includes:e})}function or(e,t){return new ld({check:"string_format",format:"starts_with",...v(t),prefix:e})}function rr(e,t){return new ud({check:"string_format",format:"ends_with",...v(t),suffix:e})}function Nc(e,t,o){return new dd({check:"property",property:e,schema:t,...v(o)})}function nr(e,t){return new pd({check:"mime_type",mime:e,...v(t)})}function je(e){return new hd({check:"overwrite",tx:e})}function sr(e){return je(t=>t.normalize(e))}function ir(){return je(e=>e.trim())}function ar(){return je(e=>e.toLowerCase())}function cr(){return je(e=>e.toUpperCase())}function lr(){return je(e=>cu(e))}function nh(e,t,o){return new e({type:"array",element:t,...v(o)})}function cy(e,t,o){return new e({type:"union",options:t,...v(o)})}function ly(e,t,o){return new e({type:"union",options:t,inclusive:!1,...v(o)})}function uy(e,t,o,r){return new e({type:"union",options:o,discriminator:t,...v(r)})}function dy(e,t,o){return new e({type:"intersection",left:t,right:o})}function py(e,t,o,r){let n=o instanceof M,s=n?r:o,a=n?o:null;return new e({type:"tuple",items:t,rest:a,...v(s)})}function hy(e,t,o,r){return new e({type:"record",keyType:t,valueType:o,...v(r)})}function my(e,t,o,r){return new e({type:"map",keyType:t,valueType:o,...v(r)})}function fy(e,t,o){return new e({type:"set",valueType:t,...v(o)})}function gy(e,t,o){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:r,...v(o)})}function Sy(e,t,o){return new e({type:"enum",entries:t,...v(o)})}function _y(e,t,o){return new e({type:"literal",values:Array.isArray(t)?t:[t],...v(o)})}function sh(e,t){return new e({type:"file",...v(t)})}function by(e,t){return new e({type:"transform",transform:t})}function yy(e,t){return new e({type:"optional",innerType:t})}function vy(e,t){return new e({type:"nullable",innerType:t})}function zy(e,t,o){return new e({type:"default",innerType:t,get defaultValue(){return typeof o=="function"?o():uu(o)}})}function Ry(e,t,o){return new e({type:"nonoptional",innerType:t,...v(o)})}function wy(e,t){return new e({type:"success",innerType:t})}function xy(e,t,o){return new e({type:"catch",innerType:t,catchValue:typeof o=="function"?o:()=>o})}function Ty(e,t,o){return new e({type:"pipe",in:t,out:o})}function Py(e,t){return new e({type:"readonly",innerType:t})}function Ey(e,t,o){return new e({type:"template_literal",parts:t,...v(o)})}function ky(e,t){return new e({type:"lazy",getter:t})}function $y(e,t){return new e({type:"promise",innerType:t})}function ih(e,t,o){let r=v(o);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function ah(e,t,o){return new e({type:"custom",check:"custom",fn:t,...v(o)})}function ch(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 F({check:"custom",...v(t)});return o._zod.check=e,o}function lh(e){let t=new F({check:"describe"});return t._zod.onattach=[o=>{let r=re.get(o)??{};re.add(o,{...r,description:e})}],t._zod.check=()=>{},t}function uh(e){let t=new F({check:"meta"});return t._zod.onattach=[o=>{let r=re.get(o)??{};re.add(o,{...r,...e})}],t._zod.check=()=>{},t}function dh(e,t){let o=v(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(y=>typeof y=="string"?y.toLowerCase():y),n=n.map(y=>typeof y=="string"?y.toLowerCase():y));let s=new Set(r),a=new Set(n),l=e.Codec??is,u=e.Boolean??ns,d=e.String??ro,m=new d({type:"string",error:o.error}),S=new u({type:"boolean",error:o.error}),_=new l({type:"pipe",in:m,out:S,transform:((y,E)=>{let $=y;return o.case!=="sensitive"&&($=$.toLowerCase()),s.has($)?!0:a.has($)?!1:(E.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...a],input:E.value,inst:_,continue:!1}),{})}),reverseTransform:((y,E)=>y===!0?r[0]||"true":n[0]||"false"),error:o.error});return _}function ur(e,t,o,r={}){let n=v(r),s={...v(r),check:"string_format",type:"string",format:t,fn:typeof o=="function"?o:l=>o.test(l),...n};return o instanceof RegExp&&(s.pattern=o),new e(s)}function $t(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??re,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 L(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 a={schema:{},count:1,cycle:void 0,path:o.path};t.seen.set(e,a);let l=e._zod.toJSONSchema?.();if(l)a.schema=l;else{let m={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{let _=a.schema,y=t.processors[n.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);y(e,t,_,m)}let S=e._zod.parent;S&&(a.ref||(a.ref=S),L(S,t,m),t.seen.get(S).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&ge(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Ct(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 a of e.seen.entries()){let l=e.metadataRegistry.get(a[0])?.id;if(l){let u=r.get(l);if(u&&u!==a[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,a[0])}}let n=a=>{let l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let S=e.external.registry.get(a[0])?.id,_=e.external.uri??(E=>E);if(S)return{ref:_(S)};let y=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=y,{defId:y,ref:`${_("__shared")}#/${l}/${y}`}}if(a[1]===o)return{ref:"#"};let d=`#/${l}/`,m=a[1].schema.id??`__schema${e.counter++}`;return{defId:m,ref:d+m}},s=a=>{if(a[1].schema.$ref)return;let l=a[1],{ref:u,defId:d}=n(a);l.def={...l.schema},d&&(l.defId=d);let m=l.schema;for(let S in m)delete m[S];m.$ref=u};if(e.cycles==="throw")for(let a of e.seen.entries()){let l=a[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
63
+ `)}y.write("payload.value = newResult;"),y.write("return payload;");let G=y.compile();return(U,j)=>G(_,U,j)},s,a=to,l=!eo.jitless,d=l&&lu.value,m=t.catchall,S;e._zod.parse=(_,y)=>{S??(S=r.value);let E=_.value;return a(E)?l&&d&&y?.async===!1&&y.jitless!==!0?(s||(s=n(t.shape)),_=s(_,y),m?dg([],E,_,y,S,e):_):o(_,y):(_.issues.push({expected:"object",code:"invalid_type",input:E,inst:e}),_)}});function Kf(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=>!Pt(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(a=>me(a,r,Y())))}),t)}var ss=h("$ZodUnion",(e,t)=>{M.init(e,t),N(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),N(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),N(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),N(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=>Wn(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,a=[];for(let l of t.options){let u=l._zod.run({value:r.value,issues:[]},n);if(u instanceof Promise)a.push(u),s=!0;else{if(u.issues.length===0)return u;a.push(u)}}return s?Promise.all(a).then(l=>Kf(l,r,e,n)):Kf(a,r,e,n)}});function Gf(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(a=>me(a,r,Y())))}):t.issues.push({code:"invalid_union",input:t.value,inst:o,errors:[],inclusive:!1}),t)}var ep=h("$ZodXor",(e,t)=>{ss.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,a=[];for(let l of t.options){let u=l._zod.run({value:r.value,issues:[]},n);u instanceof Promise?(a.push(u),s=!0):a.push(u)}return s?Promise.all(a).then(l=>Gf(l,r,e,n)):Gf(a,r,e,n)}}),tp=h("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,ss.init(e,t);let o=e._zod.parse;N(e._zod,"propValues",()=>{let n={};for(let s of t.options){let a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[l,u]of Object.entries(a)){n[l]||(n[l]=new Set);for(let d of u)n[l].add(d)}}return n});let r=Vo(()=>{let n=t.options,s=new Map;for(let a of n){let l=a._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let u of l){if(s.has(u))throw new Error(`Duplicate discriminator value "${String(u)}"`);s.set(u,a)}}return s});e._zod.parse=(n,s)=>{let a=n.value;if(!to(a))return n.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),n;let l=r.value.get(a?.[t.discriminator]);return l?l._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:a,path:[t.discriminator],inst:e}),n)}}),op=h("$ZodIntersection",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>{let n=o.value,s=t.left._zod.run({value:n,issues:[]},r),a=t.right._zod.run({value:n,issues:[]},r);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([u,d])=>Yf(o,u,d)):Yf(o,s,a)}});function fd(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(Tt(e)&&Tt(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 a=fd(e[s],t[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};n[s]=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],s=t[r],a=fd(n,s);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};o.push(a.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function Yf(e,t,o){let r=new Map,n;for(let l of t.issues)if(l.code==="unrecognized_keys"){n??(n=l);for(let u of l.keys)r.has(u)||r.set(u,{}),r.get(u).l=!0}else e.issues.push(l);for(let l of o.issues)if(l.code==="unrecognized_keys")for(let u of l.keys)r.has(u)||r.set(u,{}),r.get(u).r=!0;else e.issues.push(l);let s=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&n&&e.issues.push({...n,keys:s}),Pt(e))return e;let a=fd(t.value,o.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}var ic=h("$ZodTuple",(e,t)=>{M.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 a=[],l=Qf(o,"optin"),u=Qf(o,"optout");if(!t.rest){if(s.length<l)return r.issues.push({code:"too_small",minimum:l,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 d=new Array(o.length);for(let m=0;m<o.length;m++){let S=o[m]._zod.run({value:s[m],issues:[]},n);S instanceof Promise?a.push(S.then(_=>{d[m]=_})):d[m]=S}if(t.rest){let m=o.length-1,S=s.slice(o.length);for(let _ of S){m++;let y=t.rest._zod.run({value:_,issues:[]},n);y instanceof Promise?a.push(y.then(E=>Xf(E,r,m))):Xf(y,r,m)}}return a.length?Promise.all(a).then(()=>eg(d,r,o,s,u)):eg(d,r,o,s,u)}});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(..._e(o,e.issues)),t.value[o]=e.value}function eg(e,t,o,r,n){for(let s=0;s<o.length;s++){let a=e[s],l=s<r.length;if(a.issues.length){if(!l&&s>=n){t.value.length=s;break}t.issues.push(..._e(s,a.issues))}t.value[s]=a.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 rp=h("$ZodRecord",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>{let n=o.value;if(!Tt(n))return o.issues.push({expected:"record",code:"invalid_type",input:n,inst:e}),o;let s=[],a=t.keyType._zod.values;if(a){o.value={};let l=new Set;for(let d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){l.add(typeof d=="number"?d.toString():d);let m=t.keyType._zod.run({value:d,issues:[]},r);if(m instanceof Promise)throw new 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(y=>me(y,r,Y())),input:d,path:[d],inst:e});continue}let S=m.value,_=t.valueType._zod.run({value:n[d],issues:[]},r);_ instanceof Promise?s.push(_.then(y=>{y.issues.length&&o.issues.push(..._e(d,y.issues)),o.value[S]=y.value})):(_.issues.length&&o.issues.push(..._e(d,_.issues)),o.value[S]=_.value)}let u;for(let d in n)l.has(d)||(u=u??[],u.push(d));u&&u.length>0&&o.issues.push({code:"unrecognized_keys",input:n,inst:e,keys:u})}else{o.value={};for(let l of Reflect.ownKeys(n)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(n,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},r);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&Ya.test(l)&&u.issues.length){let S=t.keyType._zod.run({value:Number(l),issues:[]},r);if(S instanceof Promise)throw new Error("Async schemas not supported in object keys currently");S.issues.length===0&&(u=S)}if(u.issues.length){t.mode==="loose"?o.value[l]=n[l]:o.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(S=>me(S,r,Y())),input:l,path:[l],inst:e});continue}let m=t.valueType._zod.run({value:n[l],issues:[]},r);m instanceof Promise?s.push(m.then(S=>{S.issues.length&&o.issues.push(..._e(l,S.issues)),o.value[u.value]=S.value})):(m.issues.length&&o.issues.push(..._e(l,m.issues)),o.value[u.value]=m.value)}}return s.length?Promise.all(s).then(()=>o):o}}),np=h("$ZodMap",(e,t)=>{M.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[a,l]of n){let u=t.keyType._zod.run({value:a,issues:[]},r),d=t.valueType._zod.run({value:l,issues:[]},r);u instanceof Promise||d instanceof Promise?s.push(Promise.all([u,d]).then(([m,S])=>{tg(m,S,o,a,n,e,r)})):tg(u,d,o,a,n,e,r)}return s.length?Promise.all(s).then(()=>o):o}});function tg(e,t,o,r,n,s,a){e.issues.length&&(Kn.has(typeof r)?o.issues.push(..._e(r,e.issues)):o.issues.push({code:"invalid_key",origin:"map",input:n,inst:s,issues:e.issues.map(l=>me(l,a,Y()))})),t.issues.length&&(Kn.has(typeof r)?o.issues.push(..._e(r,t.issues)):o.issues.push({origin:"map",code:"invalid_element",input:n,inst:s,key:r,issues:t.issues.map(l=>me(l,a,Y()))})),o.value.set(e.value,t.value)}var sp=h("$ZodSet",(e,t)=>{M.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 a of n){let l=t.valueType._zod.run({value:a,issues:[]},r);l instanceof Promise?s.push(l.then(u=>og(u,o))):og(l,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 ip=h("$ZodEnum",(e,t)=>{M.init(e,t);let o=Bn(t.entries),r=new Set(o);e._zod.values=r,e._zod.pattern=new RegExp(`^(${o.filter(n=>Kn.has(typeof n)).map(n=>typeof n=="string"?Ie(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let a=n.value;return r.has(a)||n.issues.push({code:"invalid_value",values:o,input:a,inst:e}),n}}),ap=h("$ZodLiteral",(e,t)=>{if(M.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"?Ie(r):r?Ie(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}}),cp=h("$ZodFile",(e,t)=>{M.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}}),lp=h("$ZodTransform",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Rt(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 rg(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var ac=h("$ZodOptional",(e,t)=>{M.init(e,t),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),N(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Wn(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(a=>rg(a,n)):rg(s,n)}return o.value===void 0?o:t.innerType._zod.run(o,r)}}),up=h("$ZodExactOptional",(e,t)=>{ac.init(e,t),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(o,r)=>t.innerType._zod.run(o,r)}),dp=h("$ZodNullable",(e,t)=>{M.init(e,t),N(e._zod,"optin",()=>t.innerType._zod.optin),N(e._zod,"optout",()=>t.innerType._zod.optout),N(e._zod,"pattern",()=>{let o=t.innerType._zod.pattern;return o?new RegExp(`^(${Wn(o.source)}|null)$`):void 0}),N(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)}),pp=h("$ZodDefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",N(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 hp=h("$ZodPrefault",(e,t)=>{M.init(e,t),e._zod.optin="optional",N(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))}),mp=h("$ZodNonOptional",(e,t)=>{M.init(e,t),N(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 fp=h("$ZodSuccess",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Rt("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)}}),gp=h("$ZodCatch",(e,t)=>{M.init(e,t),e._zod.optin="optional",N(e._zod,"optout",()=>t.innerType._zod.optout),N(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(a=>me(a,r,Y()))},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=>me(s,r,Y()))},input:o.value}),o.issues=[],o.fallback=!0),o)}}),Sp=h("$ZodNaN",(e,t)=>{M.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=h("$ZodPipe",(e,t)=>{M.init(e,t),N(e._zod,"values",()=>t.in._zod.values),N(e._zod,"optin",()=>t.in._zod.optin),N(e._zod,"optout",()=>t.out._zod.optout),N(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(a=>ec(a,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 is=h("$ZodCodec",(e,t)=>{M.init(e,t),N(e._zod,"values",()=>t.in._zod.values),N(e._zod,"optin",()=>t.in._zod.optin),N(e._zod,"optout",()=>t.out._zod.optout),N(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(a=>tc(a,t,r)):tc(s,t,r)}else{let s=t.out._zod.run(o,r);return s instanceof Promise?s.then(a=>tc(a,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 _p=h("$ZodPreprocess",(e,t)=>{cc.init(e,t)}),bp=h("$ZodReadonly",(e,t)=>{M.init(e,t),N(e._zod,"propValues",()=>t.innerType._zod.propValues),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"optin",()=>t.innerType?._zod?.optin),N(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 yp=h("$ZodTemplateLiteral",(e,t)=>{M.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,a=n.endsWith("$")?n.length-1:n.length;o.push(n.slice(s,a))}else if(r===null||du.has(typeof r))o.push(Ie(`${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)}),vp=h("$ZodFunction",(e,t)=>(M.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)),zp=h("$ZodPromise",(e,t)=>{M.init(e,t),e._zod.parse=(o,r)=>Promise.resolve(o.value).then(n=>t.innerType._zod.run({value:n,issues:[]},r))}),Rp=h("$ZodLazy",(e,t)=>{M.init(e,t),N(e._zod,"innerType",()=>{let o=t;return o._cachedInner||(o._cachedInner=t.getter()),o._cachedInner}),N(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),N(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),N(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),N(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(o,r)=>e._zod.innerType._zod.run(o,r)}),wp=h("$ZodCustom",(e,t)=>{F.init(e,t),M.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 as={};ot(as,{en:()=>lc});var ay=()=>{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,a=gu(n.input),l=r[a]??a;return`Invalid input: expected ${s}, received ${l}`}case"invalid_value":return n.values.length===1?`Invalid input: expected ${La(n.values[0])}`:`Invalid option: expected one of ${Na(n.values,"|")}`;case"too_big":{let s=n.inclusive?"<=":"<",a=t(n.origin);return a?`Too big: expected ${n.origin??"value"} to have ${s}${n.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${s}${n.maximum.toString()}`}case"too_small":{let s=n.inclusive?">=":">",a=t(n.origin);return a?`Too small: expected ${n.origin} to have ${s}${n.minimum.toString()} ${a.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":""}: ${Na(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(a=>`'${a}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function lc(){return{localeError:ay()}}var hg,xp=Symbol("ZodOutput"),Tp=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 re=globalThis.__zod_globalRegistry;function Pp(e,t){return new e({type:"string",...v(t)})}function Ep(e,t){return new e({type:"string",coerce:!0,...v(t)})}function pc(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...v(t)})}function cs(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...v(t)})}function hc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...v(t)})}function mc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...v(t)})}function fc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...v(t)})}function gc(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...v(t)})}function ls(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...v(t)})}function Sc(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...v(t)})}function _c(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...v(t)})}function bc(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...v(t)})}function yc(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...v(t)})}function vc(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...v(t)})}function zc(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...v(t)})}function Rc(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...v(t)})}function wc(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...v(t)})}function xc(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...v(t)})}function kp(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...v(t)})}function Tc(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...v(t)})}function Pc(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...v(t)})}function Ec(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...v(t)})}function kc(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...v(t)})}function $c(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...v(t)})}function Cc(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...v(t)})}var $p={Any:null,Minute:-1,Second:0,Millisecond:3,Microsecond:6};function Cp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...v(t)})}function Ip(e,t){return new e({type:"string",format:"date",check:"string_format",...v(t)})}function Op(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...v(t)})}function Mp(e,t){return new e({type:"string",format:"duration",check:"string_format",...v(t)})}function qp(e,t){return new e({type:"number",checks:[],...v(t)})}function Np(e,t){return new e({type:"number",coerce:!0,checks:[],...v(t)})}function Ap(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...v(t)})}function jp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...v(t)})}function Lp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...v(t)})}function Up(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...v(t)})}function Zp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...v(t)})}function Dp(e,t){return new e({type:"boolean",...v(t)})}function Hp(e,t){return new e({type:"boolean",coerce:!0,...v(t)})}function Fp(e,t){return new e({type:"bigint",...v(t)})}function Vp(e,t){return new e({type:"bigint",coerce:!0,...v(t)})}function Jp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...v(t)})}function Bp(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...v(t)})}function Wp(e,t){return new e({type:"symbol",...v(t)})}function Kp(e,t){return new e({type:"undefined",...v(t)})}function Gp(e,t){return new e({type:"null",...v(t)})}function Yp(e){return new e({type:"any"})}function Qp(e){return new e({type:"unknown"})}function Xp(e,t){return new e({type:"never",...v(t)})}function eh(e,t){return new e({type:"void",...v(t)})}function th(e,t){return new e({type:"date",...v(t)})}function oh(e,t){return new e({type:"date",coerce:!0,...v(t)})}function rh(e,t){return new e({type:"nan",...v(t)})}function De(e,t){return new Qa({check:"less_than",...v(t),value:e,inclusive:!1})}function we(e,t){return new Qa({check:"less_than",...v(t),value:e,inclusive:!0})}function He(e,t){return new Xa({check:"greater_than",...v(t),value:e,inclusive:!1})}function fe(e,t){return new Xa({check:"greater_than",...v(t),value:e,inclusive:!0})}function Ic(e){return He(0,e)}function Oc(e){return De(0,e)}function Mc(e){return we(0,e)}function qc(e){return fe(0,e)}function Et(e,t){return new Gu({check:"multiple_of",...v(t),value:e})}function kt(e,t){return new Xu({check:"max_size",...v(t),maximum:e})}function Fe(e,t){return new ed({check:"min_size",...v(t),minimum:e})}function no(e,t){return new td({check:"size_equals",...v(t),size:e})}function so(e,t){return new od({check:"max_length",...v(t),maximum:e})}function nt(e,t){return new rd({check:"min_length",...v(t),minimum:e})}function io(e,t){return new nd({check:"length_equals",...v(t),length:e})}function Qo(e,t){return new sd({check:"string_format",format:"regex",...v(t),pattern:e})}function Xo(e){return new id({check:"string_format",format:"lowercase",...v(e)})}function er(e){return new ad({check:"string_format",format:"uppercase",...v(e)})}function tr(e,t){return new cd({check:"string_format",format:"includes",...v(t),includes:e})}function or(e,t){return new ld({check:"string_format",format:"starts_with",...v(t),prefix:e})}function rr(e,t){return new ud({check:"string_format",format:"ends_with",...v(t),suffix:e})}function Nc(e,t,o){return new dd({check:"property",property:e,schema:t,...v(o)})}function nr(e,t){return new pd({check:"mime_type",mime:e,...v(t)})}function je(e){return new hd({check:"overwrite",tx:e})}function sr(e){return je(t=>t.normalize(e))}function ir(){return je(e=>e.trim())}function ar(){return je(e=>e.toLowerCase())}function cr(){return je(e=>e.toUpperCase())}function lr(){return je(e=>cu(e))}function nh(e,t,o){return new e({type:"array",element:t,...v(o)})}function ly(e,t,o){return new e({type:"union",options:t,...v(o)})}function uy(e,t,o){return new e({type:"union",options:t,inclusive:!1,...v(o)})}function dy(e,t,o,r){return new e({type:"union",options:o,discriminator:t,...v(r)})}function py(e,t,o){return new e({type:"intersection",left:t,right:o})}function hy(e,t,o,r){let n=o instanceof M,s=n?r:o,a=n?o:null;return new e({type:"tuple",items:t,rest:a,...v(s)})}function my(e,t,o,r){return new e({type:"record",keyType:t,valueType:o,...v(r)})}function fy(e,t,o,r){return new e({type:"map",keyType:t,valueType:o,...v(r)})}function gy(e,t,o){return new e({type:"set",valueType:t,...v(o)})}function Sy(e,t,o){let r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new e({type:"enum",entries:r,...v(o)})}function _y(e,t,o){return new e({type:"enum",entries:t,...v(o)})}function by(e,t,o){return new e({type:"literal",values:Array.isArray(t)?t:[t],...v(o)})}function sh(e,t){return new e({type:"file",...v(t)})}function yy(e,t){return new e({type:"transform",transform:t})}function vy(e,t){return new e({type:"optional",innerType:t})}function zy(e,t){return new e({type:"nullable",innerType:t})}function Ry(e,t,o){return new e({type:"default",innerType:t,get defaultValue(){return typeof o=="function"?o():uu(o)}})}function wy(e,t,o){return new e({type:"nonoptional",innerType:t,...v(o)})}function xy(e,t){return new e({type:"success",innerType:t})}function Ty(e,t,o){return new e({type:"catch",innerType:t,catchValue:typeof o=="function"?o:()=>o})}function Py(e,t,o){return new e({type:"pipe",in:t,out:o})}function Ey(e,t){return new e({type:"readonly",innerType:t})}function ky(e,t,o){return new e({type:"template_literal",parts:t,...v(o)})}function $y(e,t){return new e({type:"lazy",getter:t})}function Cy(e,t){return new e({type:"promise",innerType:t})}function ih(e,t,o){let r=v(o);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function ah(e,t,o){return new e({type:"custom",check:"custom",fn:t,...v(o)})}function ch(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 F({check:"custom",...v(t)});return o._zod.check=e,o}function lh(e){let t=new F({check:"describe"});return t._zod.onattach=[o=>{let r=re.get(o)??{};re.add(o,{...r,description:e})}],t._zod.check=()=>{},t}function uh(e){let t=new F({check:"meta"});return t._zod.onattach=[o=>{let r=re.get(o)??{};re.add(o,{...r,...e})}],t._zod.check=()=>{},t}function dh(e,t){let o=v(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(y=>typeof y=="string"?y.toLowerCase():y),n=n.map(y=>typeof y=="string"?y.toLowerCase():y));let s=new Set(r),a=new Set(n),l=e.Codec??is,u=e.Boolean??ns,d=e.String??ro,m=new d({type:"string",error:o.error}),S=new u({type:"boolean",error:o.error}),_=new l({type:"pipe",in:m,out:S,transform:((y,E)=>{let $=y;return o.case!=="sensitive"&&($=$.toLowerCase()),s.has($)?!0:a.has($)?!1:(E.issues.push({code:"invalid_value",expected:"stringbool",values:[...s,...a],input:E.value,inst:_,continue:!1}),{})}),reverseTransform:((y,E)=>y===!0?r[0]||"true":n[0]||"false"),error:o.error});return _}function ur(e,t,o,r={}){let n=v(r),s={...v(r),check:"string_format",type:"string",format:t,fn:typeof o=="function"?o:l=>o.test(l),...n};return o instanceof RegExp&&(s.pattern=o),new e(s)}function $t(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??re,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 L(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 a={schema:{},count:1,cycle:void 0,path:o.path};t.seen.set(e,a);let l=e._zod.toJSONSchema?.();if(l)a.schema=l;else{let m={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{let _=a.schema,y=t.processors[n.type];if(!y)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${n.type}`);y(e,t,_,m)}let S=e._zod.parent;S&&(a.ref||(a.ref=S),L(S,t,m),t.seen.get(S).isParent=!0)}let u=t.metadataRegistry.get(e);return u&&Object.assign(a.schema,u),t.io==="input"&&ge(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Ct(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 a of e.seen.entries()){let l=e.metadataRegistry.get(a[0])?.id;if(l){let u=r.get(l);if(u&&u!==a[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(l,a[0])}}let n=a=>{let l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let S=e.external.registry.get(a[0])?.id,_=e.external.uri??(E=>E);if(S)return{ref:_(S)};let y=a[1].defId??a[1].schema.id??`schema${e.counter++}`;return a[1].defId=y,{defId:y,ref:`${_("__shared")}#/${l}/${y}`}}if(a[1]===o)return{ref:"#"};let d=`#/${l}/`,m=a[1].schema.id??`__schema${e.counter++}`;return{defId:m,ref:d+m}},s=a=>{if(a[1].schema.$ref)return;let l=a[1],{ref:u,defId:d}=n(a);l.def={...l.schema},d&&(l.defId=d);let m=l.schema;for(let S in m)delete m[S];m.$ref=u};if(e.cycles==="throw")for(let a of e.seen.entries()){let l=a[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/<root>
64
64
 
65
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let l=a[1];if(t===a[0]){s(a);continue}if(e.external){let d=e.external.registry.get(a[0])?.id;if(t!==a[0]&&d){s(a);continue}}if(e.metadataRegistry.get(a[0])?.id){s(a);continue}if(l.cycle){s(a);continue}if(l.count>1&&e.reused==="ref"){s(a);continue}}}function It(e,t){let o=e.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=l=>{let u=e.seen.get(l);if(u.ref===null)return;let d=u.def??u.schema,m={...d},S=u.ref;if(u.ref=null,S){r(S);let y=e.seen.get(S),E=y.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(E)):Object.assign(d,E),Object.assign(d,m),l._zod.parent===S)for(let I in d)I==="$ref"||I==="allOf"||I in m||delete d[I];if(E.$ref&&y.def)for(let I in d)I==="$ref"||I==="allOf"||I in y.def&&JSON.stringify(d[I])===JSON.stringify(y.def[I])&&delete d[I]}let _=l._zod.parent;if(_&&_!==S){r(_);let y=e.seen.get(_);if(y?.schema.$ref&&(d.$ref=y.schema.$ref,y.def))for(let E in d)E==="$ref"||E==="allOf"||E in y.def&&JSON.stringify(d[E])===JSON.stringify(y.def[E])&&delete d[E]}e.override({zodSchema:l,jsonSchema:d,path:u.path??[]})};for(let l of[...e.seen.entries()].reverse())r(l[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 l=e.external.registry.get(t)?.id;if(!l)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(l)}Object.assign(n,o.def??o.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let a=e.external?.defs??{};for(let l of e.seen.entries()){let u=l[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,a[u.defId]=u.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{let l=JSON.parse(JSON.stringify(n));return Object.defineProperty(l,"~standard",{value:{...t["~standard"],jsonSchema:{input:dr(t,"input",e.processors),output:dr(t,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function ge(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 ge(r.element,o);if(r.type==="set")return ge(r.valueType,o);if(r.type==="lazy")return ge(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 ge(r.innerType,o);if(r.type==="intersection")return ge(r.left,o)||ge(r.right,o);if(r.type==="record"||r.type==="map")return ge(r.keyType,o)||ge(r.valueType,o);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ge(r.in,o)||ge(r.out,o);if(r.type==="object"){for(let n in r.shape)if(ge(r.shape[n],o))return!0;return!1}if(r.type==="union"){for(let n of r.options)if(ge(n,o))return!0;return!1}if(r.type==="tuple"){for(let n of r.items)if(ge(n,o))return!0;return!!(r.rest&&ge(r.rest,o))}return!1}var ph=(e,t={})=>o=>{let r=$t({...o,processors:t});return L(e,r),Ct(r,e),It(r,e)},dr=(e,t,o={})=>r=>{let{libraryOptions:n,target:s}=r??{},a=$t({...n??{},target:s,io:t,processors:o});return L(e,a),Ct(a,e),It(a,e)};var Cy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hh=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:s,maximum:a,format:l,patterns:u,contentEncoding:d}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof a=="number"&&(n.maxLength=a),l&&(n.format=Cy[l]??l,n.format===""&&delete n.format,l==="time"&&delete n.format),d&&(n.contentEncoding=d),u&&u.size>0){let m=[...u];m.length===1?n.pattern=m[0].source:m.length>1&&(n.allOf=[...m.map(S=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))])}},mh=(e,t,o,r)=>{let n=o,{minimum:s,maximum:a,format:l,multipleOf:u,exclusiveMaximum:d,exclusiveMinimum:m}=e._zod.bag;typeof l=="string"&&l.includes("int")?n.type="integer":n.type="number";let S=typeof m=="number"&&m>=(s??Number.NEGATIVE_INFINITY),_=typeof d=="number"&&d<=(a??Number.POSITIVE_INFINITY),y=t.target==="draft-04"||t.target==="openapi-3.0";S?y?(n.minimum=m,n.exclusiveMinimum=!0):n.exclusiveMinimum=m:typeof s=="number"&&(n.minimum=s),_?y?(n.maximum=d,n.exclusiveMaximum=!0):n.exclusiveMaximum=d:typeof a=="number"&&(n.maximum=a),typeof u=="number"&&(n.multipleOf=u)},fh=(e,t,o,r)=>{o.type="boolean"},gh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Sh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},_h=(e,t,o,r)=>{t.target==="openapi-3.0"?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},bh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},yh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},vh=(e,t,o,r)=>{o.not={}},zh=(e,t,o,r)=>{},Rh=(e,t,o,r)=>{},wh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},xh=(e,t,o,r)=>{let n=e._zod.def,s=Bn(n.entries);s.every(a=>typeof a=="number")&&(o.type="number"),s.every(a=>typeof a=="string")&&(o.type="string"),o.enum=s},Th=(e,t,o,r)=>{let n=e._zod.def,s=[];for(let a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){let a=s[0];o.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?o.enum=[a]:o.const=a}else s.every(a=>typeof a=="number")&&(o.type="number"),s.every(a=>typeof a=="string")&&(o.type="string"),s.every(a=>typeof a=="boolean")&&(o.type="boolean"),s.every(a=>a===null)&&(o.type="null"),o.enum=s},Ph=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Eh=(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},kh=(e,t,o,r)=>{let n=o,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:l,mime:u}=e._zod.bag;a!==void 0&&(s.minLength=a),l!==void 0&&(s.maxLength=l),u?u.length===1?(s.contentMediaType=u[0],Object.assign(n,s)):(Object.assign(n,s),n.anyOf=u.map(d=>({contentMediaType:d}))):Object.assign(n,s)},$h=(e,t,o,r)=>{o.type="boolean"},Ch=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ih=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Oh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Mh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},qh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Nh=(e,t,o,r)=>{let n=o,s=e._zod.def,{minimum:a,maximum:l}=e._zod.bag;typeof a=="number"&&(n.minItems=a),typeof l=="number"&&(n.maxItems=l),n.type="array",n.items=L(s.element,t,{...r,path:[...r.path,"items"]})},Ah=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="object",n.properties={};let a=s.shape;for(let d in a)n.properties[d]=L(a[d],t,{...r,path:[...r.path,"properties",d]});let l=new Set(Object.keys(a)),u=new Set([...l].filter(d=>{let m=s.shape[d]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(n.required=Array.from(u)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=L(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,a=n.options.map((l,u)=>L(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",u]}));s?o.oneOf=a:o.anyOf=a},jh=(e,t,o,r)=>{let n=e._zod.def,s=L(n.left,t,{...r,path:[...r.path,"allOf",0]}),a=L(n.right,t,{...r,path:[...r.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,u=[...l(s)?s.allOf:[s],...l(a)?a.allOf:[a]];o.allOf=u},Lh=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",l=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=s.items.map((_,y)=>L(_,t,{...r,path:[...r.path,a,y]})),d=s.rest?L(s.rest,t,{...r,path:[...r.path,l,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=u,d&&(n.items=d)):t.target==="openapi-3.0"?(n.items={anyOf:u},d&&n.items.anyOf.push(d),n.minItems=u.length,d||(n.maxItems=u.length)):(n.items=u,d&&(n.additionalItems=d));let{minimum:m,maximum:S}=e._zod.bag;typeof m=="number"&&(n.minItems=m),typeof S=="number"&&(n.maxItems=S)},Uh=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="object";let a=s.keyType,u=a._zod.bag?.patterns;if(s.mode==="loose"&&u&&u.size>0){let m=L(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let S of u)n.patternProperties[S.source]=m}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=L(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),n.additionalProperties=L(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let d=a._zod.values;if(d){let m=[...d].filter(S=>typeof S=="string"||typeof S=="number");m.length>0&&(n.required=m)}},Zh=(e,t,o,r)=>{let n=e._zod.def,s=L(n.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,o.nullable=!0):o.anyOf=[s,{type:"null"}]},Dh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Hh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType,o.default=JSON.parse(JSON.stringify(n.defaultValue))},Fh=(e,t,o,r)=>{let n=e._zod.def;L(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)))},Vh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}o.default=a},Jh=(e,t,o,r)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?s?n.out:n.in:n.out;L(a,t,r);let l=t.seen.get(e);l.ref=a},Bh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType,o.readOnly=!0},Wh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Lc=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Kh=(e,t,o,r)=>{let n=e._zod.innerType;L(n,t,r);let s=t.seen.get(e);s.ref=n},Ac={string:hh,number:mh,boolean:fh,bigint:gh,symbol:Sh,null:_h,undefined:bh,void:yh,never:vh,any:zh,unknown:Rh,date:wh,enum:xh,literal:Th,nan:Ph,template_literal:Eh,file:kh,success:$h,custom:Ch,function:Ih,transform:Oh,map:Mh,set:qh,array:Nh,object:Ah,union:jc,intersection:jh,tuple:Lh,record:Uh,nullable:Zh,nonoptional:Dh,default:Hh,prefault:Fh,catch:Vh,pipe:Jh,readonly:Bh,promise:Wh,optional:Lc,lazy:Kh};function ao(e,t){if("_idmap"in e){let r=e,n=$t({...t,processors:Ac}),s={};for(let u of r._idmap.entries()){let[d,m]=u;L(m,n)}let a={},l={registry:r,uri:t?.uri,defs:s};n.external=l;for(let u of r._idmap.entries()){let[d,m]=u;Ct(n,m),a[d]=It(n,m)}if(Object.keys(s).length>0){let u=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:s}}return{schemas:a}}let o=$t({...t,processors:Ac});return L(e,o),Ct(o,e),It(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=$t({processors:Ac,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 L(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)),Ct(this.ctx,t);let r=It(this.ctx,t),{"~standard":n,...s}=r;return s}};var fg={};var us={};ot(us,{ZodAny:()=>fm,ZodArray:()=>bm,ZodBase64:()=>cl,ZodBase64URL:()=>ll,ZodBigInt:()=>br,ZodBigIntFormat:()=>pl,ZodBoolean:()=>_r,ZodCIDRv4:()=>il,ZodCIDRv6:()=>al,ZodCUID:()=>Xc,ZodCUID2:()=>el,ZodCatch:()=>Lm,ZodCodec:()=>ys,ZodCustom:()=>vs,ZodCustomStringFormat:()=>gr,ZodDate:()=>gs,ZodDefault:()=>Om,ZodDiscriminatedUnion:()=>vm,ZodE164:()=>ul,ZodEmail:()=>Kc,ZodEmoji:()=>Yc,ZodEnum:()=>hr,ZodExactOptional:()=>$m,ZodFile:()=>Em,ZodFunction:()=>Wm,ZodGUID:()=>ps,ZodIPv4:()=>nl,ZodIPv6:()=>sl,ZodIntersection:()=>zm,ZodJWT:()=>dl,ZodKSUID:()=>rl,ZodLazy:()=>Jm,ZodLiteral:()=>Pm,ZodMAC:()=>dm,ZodMap:()=>xm,ZodNaN:()=>Zm,ZodNanoID:()=>Qc,ZodNever:()=>Sm,ZodNonOptional:()=>Sl,ZodNull:()=>mm,ZodNullable:()=>Im,ZodNumber:()=>Sr,ZodNumberFormat:()=>co,ZodObject:()=>Ss,ZodOptional:()=>gl,ZodPipe:()=>bs,ZodPrefault:()=>qm,ZodPreprocess:()=>Dm,ZodPromise:()=>Bm,ZodReadonly:()=>Hm,ZodRecord:()=>pr,ZodSet:()=>Tm,ZodString:()=>mr,ZodStringFormat:()=>D,ZodSuccess:()=>jm,ZodSymbol:()=>pm,ZodTemplateLiteral:()=>Vm,ZodTransform:()=>km,ZodTuple:()=>Rm,ZodType:()=>q,ZodULID:()=>tl,ZodURL:()=>fs,ZodUUID:()=>Ve,ZodUndefined:()=>hm,ZodUnion:()=>_s,ZodUnknown:()=>gm,ZodVoid:()=>_m,ZodXID:()=>ol,ZodXor:()=>ym,_ZodString:()=>Wc,_default:()=>Mm,_function:()=>SS,any:()=>hl,array:()=>f,base64:()=>Ng,base64url:()=>Ag,bigint:()=>Wg,boolean:()=>R,catch:()=>Um,check:()=>_S,cidrv4:()=>Mg,cidrv6:()=>qg,codec:()=>hS,cuid:()=>Tg,cuid2:()=>Pg,custom:()=>bS,date:()=>eS,describe:()=>yS,discriminatedUnion:()=>Ot,e164:()=>jg,email:()=>Gc,emoji:()=>wg,enum:()=>C,exactOptional:()=>Cm,file:()=>lS,float32:()=>Fg,float64:()=>Vg,function:()=>SS,guid:()=>_g,hash:()=>Hg,hex:()=>Dg,hostname:()=>Zg,httpUrl:()=>Rg,instanceof:()=>zS,int:()=>Jc,int32:()=>Jg,int64:()=>Kg,intersection:()=>Le,invertCodec:()=>mS,ipv4:()=>Cg,ipv6:()=>Og,json:()=>wS,jwt:()=>Lg,keyof:()=>tS,ksuid:()=>$g,lazy:()=>Mt,literal:()=>g,looseObject:()=>k,looseRecord:()=>sS,mac:()=>Ig,map:()=>iS,meta:()=>vS,nan:()=>pS,nanoid:()=>xg,nativeEnum:()=>cS,never:()=>ml,nonoptional:()=>Am,null:()=>Je,nullable:()=>hs,nullish:()=>uS,number:()=>b,object:()=>p,optional:()=>P,partialRecord:()=>nS,pipe:()=>Bc,prefault:()=>Nm,preprocess:()=>it,promise:()=>gS,readonly:()=>Fm,record:()=>z,refine:()=>Km,set:()=>aS,strictObject:()=>oS,string:()=>c,stringFormat:()=>Ug,stringbool:()=>RS,success:()=>dS,superRefine:()=>Gm,symbol:()=>Yg,templateLiteral:()=>fS,transform:()=>fl,tuple:()=>wm,uint32:()=>Bg,uint64:()=>Gg,ulid:()=>Eg,undefined:()=>Qg,union:()=>x,unknown:()=>T,url:()=>fr,uuid:()=>bg,uuidv4:()=>yg,uuidv6:()=>vg,uuidv7:()=>zg,void:()=>Xg,xid:()=>kg,xor:()=>rS});var Zc={};ot(Zc,{endsWith:()=>rr,gt:()=>He,gte:()=>fe,includes:()=>tr,length:()=>io,lowercase:()=>Xo,lt:()=>De,lte:()=>we,maxLength:()=>so,maxSize:()=>kt,mime:()=>nr,minLength:()=>nt,minSize:()=>Fe,multipleOf:()=>Et,negative:()=>Oc,nonnegative:()=>qc,nonpositive:()=>Mc,normalize:()=>sr,overwrite:()=>je,positive:()=>Ic,property:()=>Nc,regex:()=>Qo,size:()=>no,slugify:()=>lr,startsWith:()=>or,toLowerCase:()=>ar,toUpperCase:()=>cr,trim:()=>ir,uppercase:()=>er});var xe={};ot(xe,{ZodISODate:()=>Hc,ZodISODateTime:()=>Dc,ZodISODuration:()=>Vc,ZodISOTime:()=>Fc,date:()=>Yh,datetime:()=>Gh,duration:()=>Xh,time:()=>Qh});var Dc=h("ZodISODateTime",(e,t)=>{Pd.init(e,t),D.init(e,t)});function Gh(e){return Cp(Dc,e)}var Hc=h("ZodISODate",(e,t)=>{Ed.init(e,t),D.init(e,t)});function Yh(e){return Ip(Hc,e)}var Fc=h("ZodISOTime",(e,t)=>{kd.init(e,t),D.init(e,t)});function Qh(e){return Op(Fc,e)}var Vc=h("ZodISODuration",(e,t)=>{$d.init(e,t),D.init(e,t)});function Xh(e){return Mp(Vc,e)}var gg=(e,t)=>{Qn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>es(e,o)},flatten:{value:o=>Xn(e,o)},addIssue:{value:o=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Fo,2)}},addIssues:{value:o=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Fo,2)}},isEmpty:{get(){return e.issues.length===0}}})},Oy=h("ZodError",gg),ye=h("ZodError",gg,{Parent:Error});var em=Bo(ye),tm=Wo(ye),ds=Ko(ye),om=Go(ye),rm=Da(ye),nm=Ha(ye),sm=Fa(ye),im=Va(ye),am=Ja(ye),cm=Ba(ye),lm=Wa(ye),um=Ka(ye);var Sg=new WeakMap;function ms(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 a=o[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let l=a.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}var q=h("ZodType",(e,t)=>(M.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:dr(e,"input"),output:dr(e,"output")}}),e.toJSONSchema=ph(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>em(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>ds(e,o,r),e.parseAsync=async(o,r)=>tm(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>om(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>rm(e,o,r),e.decode=(o,r)=>nm(e,o,r),e.encodeAsync=async(o,r)=>sm(e,o,r),e.decodeAsync=async(o,r)=>im(e,o,r),e.safeEncode=(o,r)=>am(e,o,r),e.safeDecode=(o,r)=>cm(e,o,r),e.safeEncodeAsync=async(o,r)=>lm(e,o,r),e.safeDecodeAsync=async(o,r)=>um(e,o,r),ms(e,"ZodType",{check(...o){let r=this.def;return this.clone(O.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 he(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(Km(o,r))},superRefine(o,r){return this.check(Gm(o,r))},overwrite(o){return this.check(je(o))},optional(){return P(this)},exactOptional(){return Cm(this)},nullable(){return hs(this)},nullish(){return P(hs(this))},nonoptional(o){return Am(this,o)},array(){return f(this)},or(o){return x([this,o])},and(o){return Le(this,o)},transform(o){return Bc(this,fl(o))},default(o){return Mm(this,o)},prefault(o){return Nm(this,o)},catch(o){return Um(this,o)},pipe(o){return Bc(this,o)},readonly(){return Fm(this)},describe(o){let r=this.clone();return re.add(r,{description:o}),r},meta(...o){if(o.length===0)return re.get(this);let r=this.clone();return re.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 re.get(e)?.description},configurable:!0}),e)),Wc=h("_ZodString",(e,t)=>{ro.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>hh(e,r,n,s);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,ms(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(nt(...r))},max(...r){return this.check(so(...r))},length(...r){return this.check(io(...r))},nonempty(...r){return this.check(nt(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=h("ZodString",(e,t)=>{ro.init(e,t),Wc.init(e,t),e.email=o=>e.check(pc(Kc,o)),e.url=o=>e.check(ls(fs,o)),e.jwt=o=>e.check(Cc(dl,o)),e.emoji=o=>e.check(Sc(Yc,o)),e.guid=o=>e.check(cs(ps,o)),e.uuid=o=>e.check(hc(Ve,o)),e.uuidv4=o=>e.check(mc(Ve,o)),e.uuidv6=o=>e.check(fc(Ve,o)),e.uuidv7=o=>e.check(gc(Ve,o)),e.nanoid=o=>e.check(_c(Qc,o)),e.guid=o=>e.check(cs(ps,o)),e.cuid=o=>e.check(bc(Xc,o)),e.cuid2=o=>e.check(yc(el,o)),e.ulid=o=>e.check(vc(tl,o)),e.base64=o=>e.check(Ec(cl,o)),e.base64url=o=>e.check(kc(ll,o)),e.xid=o=>e.check(zc(ol,o)),e.ksuid=o=>e.check(Rc(rl,o)),e.ipv4=o=>e.check(wc(nl,o)),e.ipv6=o=>e.check(xc(sl,o)),e.cidrv4=o=>e.check(Tc(il,o)),e.cidrv6=o=>e.check(Pc(al,o)),e.e164=o=>e.check($c(ul,o)),e.datetime=o=>e.check(Gh(o)),e.date=o=>e.check(Yh(o)),e.time=o=>e.check(Qh(o)),e.duration=o=>e.check(Xh(o))});function c(e){return Pp(mr,e)}var D=h("ZodStringFormat",(e,t)=>{Z.init(e,t),Wc.init(e,t)}),Kc=h("ZodEmail",(e,t)=>{_d.init(e,t),D.init(e,t)});function Gc(e){return pc(Kc,e)}var ps=h("ZodGUID",(e,t)=>{gd.init(e,t),D.init(e,t)});function _g(e){return cs(ps,e)}var Ve=h("ZodUUID",(e,t)=>{Sd.init(e,t),D.init(e,t)});function bg(e){return hc(Ve,e)}function yg(e){return mc(Ve,e)}function vg(e){return fc(Ve,e)}function zg(e){return gc(Ve,e)}var fs=h("ZodURL",(e,t)=>{bd.init(e,t),D.init(e,t)});function fr(e){return ls(fs,e)}function Rg(e){return ls(fs,{protocol:Re.httpProtocol,hostname:Re.domain,...O.normalizeParams(e)})}var Yc=h("ZodEmoji",(e,t)=>{yd.init(e,t),D.init(e,t)});function wg(e){return Sc(Yc,e)}var Qc=h("ZodNanoID",(e,t)=>{vd.init(e,t),D.init(e,t)});function xg(e){return _c(Qc,e)}var Xc=h("ZodCUID",(e,t)=>{zd.init(e,t),D.init(e,t)});function Tg(e){return bc(Xc,e)}var el=h("ZodCUID2",(e,t)=>{Rd.init(e,t),D.init(e,t)});function Pg(e){return yc(el,e)}var tl=h("ZodULID",(e,t)=>{wd.init(e,t),D.init(e,t)});function Eg(e){return vc(tl,e)}var ol=h("ZodXID",(e,t)=>{xd.init(e,t),D.init(e,t)});function kg(e){return zc(ol,e)}var rl=h("ZodKSUID",(e,t)=>{Td.init(e,t),D.init(e,t)});function $g(e){return Rc(rl,e)}var nl=h("ZodIPv4",(e,t)=>{Cd.init(e,t),D.init(e,t)});function Cg(e){return wc(nl,e)}var dm=h("ZodMAC",(e,t)=>{Od.init(e,t),D.init(e,t)});function Ig(e){return kp(dm,e)}var sl=h("ZodIPv6",(e,t)=>{Id.init(e,t),D.init(e,t)});function Og(e){return xc(sl,e)}var il=h("ZodCIDRv4",(e,t)=>{Md.init(e,t),D.init(e,t)});function Mg(e){return Tc(il,e)}var al=h("ZodCIDRv6",(e,t)=>{qd.init(e,t),D.init(e,t)});function qg(e){return Pc(al,e)}var cl=h("ZodBase64",(e,t)=>{Ad.init(e,t),D.init(e,t)});function Ng(e){return Ec(cl,e)}var ll=h("ZodBase64URL",(e,t)=>{jd.init(e,t),D.init(e,t)});function Ag(e){return kc(ll,e)}var ul=h("ZodE164",(e,t)=>{Ld.init(e,t),D.init(e,t)});function jg(e){return $c(ul,e)}var dl=h("ZodJWT",(e,t)=>{Ud.init(e,t),D.init(e,t)});function Lg(e){return Cc(dl,e)}var gr=h("ZodCustomStringFormat",(e,t)=>{Zd.init(e,t),D.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 Hg(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=h("ZodNumber",(e,t)=>{nc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>mh(e,r,n,s),ms(e,"ZodNumber",{gt(r,n){return this.check(He(r,n))},gte(r,n){return this.check(fe(r,n))},min(r,n){return this.check(fe(r,n))},lt(r,n){return this.check(De(r,n))},lte(r,n){return this.check(we(r,n))},max(r,n){return this.check(we(r,n))},int(r){return this.check(Jc(r))},safe(r){return this.check(Jc(r))},positive(r){return this.check(He(0,r))},nonnegative(r){return this.check(fe(0,r))},negative(r){return this.check(De(0,r))},nonpositive(r){return this.check(we(0,r))},multipleOf(r,n){return this.check(Et(r,n))},step(r,n){return this.check(Et(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 qp(Sr,e)}var co=h("ZodNumberFormat",(e,t)=>{Dd.init(e,t),Sr.init(e,t)});function Jc(e){return Ap(co,e)}function Fg(e){return jp(co,e)}function Vg(e){return Lp(co,e)}function Jg(e){return Up(co,e)}function Bg(e){return Zp(co,e)}var _r=h("ZodBoolean",(e,t)=>{ns.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>fh(e,o,r,n)});function R(e){return Dp(_r,e)}var br=h("ZodBigInt",(e,t)=>{sc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>gh(e,r,n,s),e.gte=(r,n)=>e.check(fe(r,n)),e.min=(r,n)=>e.check(fe(r,n)),e.gt=(r,n)=>e.check(He(r,n)),e.gte=(r,n)=>e.check(fe(r,n)),e.min=(r,n)=>e.check(fe(r,n)),e.lt=(r,n)=>e.check(De(r,n)),e.lte=(r,n)=>e.check(we(r,n)),e.max=(r,n)=>e.check(we(r,n)),e.positive=r=>e.check(He(BigInt(0),r)),e.negative=r=>e.check(De(BigInt(0),r)),e.nonpositive=r=>e.check(we(BigInt(0),r)),e.nonnegative=r=>e.check(fe(BigInt(0),r)),e.multipleOf=(r,n)=>e.check(Et(r,n));let o=e._zod.bag;e.minValue=o.minimum??null,e.maxValue=o.maximum??null,e.format=o.format??null});function Wg(e){return Fp(br,e)}var pl=h("ZodBigIntFormat",(e,t)=>{Hd.init(e,t),br.init(e,t)});function Kg(e){return Jp(pl,e)}function Gg(e){return Bp(pl,e)}var pm=h("ZodSymbol",(e,t)=>{Fd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Sh(e,o,r,n)});function Yg(e){return Wp(pm,e)}var hm=h("ZodUndefined",(e,t)=>{Vd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>bh(e,o,r,n)});function Qg(e){return Kp(hm,e)}var mm=h("ZodNull",(e,t)=>{Jd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>_h(e,o,r,n)});function Je(e){return Gp(mm,e)}var fm=h("ZodAny",(e,t)=>{Bd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>zh(e,o,r,n)});function hl(){return Yp(fm)}var gm=h("ZodUnknown",(e,t)=>{Wd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Rh(e,o,r,n)});function T(){return Qp(gm)}var Sm=h("ZodNever",(e,t)=>{Kd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>vh(e,o,r,n)});function ml(e){return Xp(Sm,e)}var _m=h("ZodVoid",(e,t)=>{Gd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>yh(e,o,r,n)});function Xg(e){return eh(_m,e)}var gs=h("ZodDate",(e,t)=>{Yd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>wh(e,r,n,s),e.min=(r,n)=>e.check(fe(r,n)),e.max=(r,n)=>e.check(we(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 th(gs,e)}var bm=h("ZodArray",(e,t)=>{Qd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Nh(e,o,r,n),e.element=t.element,ms(e,"ZodArray",{min(o,r){return this.check(nt(o,r))},nonempty(o){return this.check(nt(1,o))},max(o,r){return this.check(so(o,r))},length(o,r){return this.check(io(o,r))},unwrap(){return this.element}})});function f(e,t){return nh(bm,e,t)}function tS(e){let t=e._zod.def.shape;return C(Object.keys(t))}var Ss=h("ZodObject",(e,t)=>{Xd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ah(e,o,r,n),O.defineLazy(e,"shape",()=>t.shape),ms(e,"ZodObject",{keyof(){return C(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:T()})},loose(){return this.clone({...this._zod.def,catchall:T()})},strict(){return this.clone({...this._zod.def,catchall:ml()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return O.extend(this,o)},safeExtend(o){return O.safeExtend(this,o)},merge(o){return O.merge(this,o)},pick(o){return O.pick(this,o)},omit(o){return O.omit(this,o)},partial(...o){return O.partial(gl,this,o[0])},required(...o){return O.required(Sl,this,o[0])}})});function p(e,t){let o={type:"object",shape:e??{},...O.normalizeParams(t)};return new Ss(o)}function oS(e,t){return new Ss({type:"object",shape:e,catchall:ml(),...O.normalizeParams(t)})}function k(e,t){return new Ss({type:"object",shape:e,catchall:T(),...O.normalizeParams(t)})}var _s=h("ZodUnion",(e,t)=>{ss.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n),e.options=t.options});function x(e,t){return new _s({type:"union",options:e,...O.normalizeParams(t)})}var ym=h("ZodXor",(e,t)=>{_s.init(e,t),ep.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n),e.options=t.options});function rS(e,t){return new ym({type:"union",options:e,inclusive:!1,...O.normalizeParams(t)})}var vm=h("ZodDiscriminatedUnion",(e,t)=>{_s.init(e,t),tp.init(e,t)});function Ot(e,t,o){return new vm({type:"union",options:t,discriminator:e,...O.normalizeParams(o)})}var zm=h("ZodIntersection",(e,t)=>{op.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jh(e,o,r,n)});function Le(e,t){return new zm({type:"intersection",left:e,right:t})}var Rm=h("ZodTuple",(e,t)=>{ic.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Lh(e,o,r,n),e.rest=o=>e.clone({...e._zod.def,rest:o})});function wm(e,t,o){let r=t instanceof M,n=r?o:t,s=r?t:null;return new Rm({type:"tuple",items:e,rest:s,...O.normalizeParams(n)})}var pr=h("ZodRecord",(e,t)=>{rp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Uh(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,o){return!t||!t._zod?new pr({type:"record",keyType:c(),valueType:e,...O.normalizeParams(t)}):new pr({type:"record",keyType:e,valueType:t,...O.normalizeParams(o)})}function nS(e,t,o){let r=he(e);return r._zod.values=void 0,new pr({type:"record",keyType:r,valueType:t,...O.normalizeParams(o)})}function sS(e,t,o){return new pr({type:"record",keyType:e,valueType:t,mode:"loose",...O.normalizeParams(o)})}var xm=h("ZodMap",(e,t)=>{np.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,e.min=(...o)=>e.check(Fe(...o)),e.nonempty=o=>e.check(Fe(1,o)),e.max=(...o)=>e.check(kt(...o)),e.size=(...o)=>e.check(no(...o))});function iS(e,t,o){return new xm({type:"map",keyType:e,valueType:t,...O.normalizeParams(o)})}var Tm=h("ZodSet",(e,t)=>{sp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>qh(e,o,r,n),e.min=(...o)=>e.check(Fe(...o)),e.nonempty=o=>e.check(Fe(1,o)),e.max=(...o)=>e.check(kt(...o)),e.size=(...o)=>e.check(no(...o))});function aS(e,t){return new Tm({type:"set",valueType:e,...O.normalizeParams(t)})}var hr=h("ZodEnum",(e,t)=>{ip.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xh(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 a of r)if(o.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new hr({...t,checks:[],...O.normalizeParams(n),entries:s})},e.exclude=(r,n)=>{let s={...t.entries};for(let a of r)if(o.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new hr({...t,checks:[],...O.normalizeParams(n),entries:s})}});function C(e,t){let o=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new hr({type:"enum",entries:o,...O.normalizeParams(t)})}function cS(e,t){return new hr({type:"enum",entries:e,...O.normalizeParams(t)})}var Pm=h("ZodLiteral",(e,t)=>{ap.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Th(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 g(e,t){return new Pm({type:"literal",values:Array.isArray(e)?e:[e],...O.normalizeParams(t)})}var Em=h("ZodFile",(e,t)=>{cp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>kh(e,o,r,n),e.min=(o,r)=>e.check(Fe(o,r)),e.max=(o,r)=>e.check(kt(o,r)),e.mime=(o,r)=>e.check(nr(Array.isArray(o)?o:[o],r))});function lS(e){return sh(Em,e)}var km=h("ZodTransform",(e,t)=>{lp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Oh(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Rt(e.constructor.name);o.addIssue=s=>{if(typeof s=="string")o.issues.push(O.issue(s,o.value,t));else{let a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=o.value),a.inst??(a.inst=e),o.issues.push(O.issue(a))}};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 km({type:"transform",transform:e})}var gl=h("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 P(e){return new gl({type:"optional",innerType:e})}var $m=h("ZodExactOptional",(e,t)=>{up.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 Cm(e){return new $m({type:"optional",innerType:e})}var Im=h("ZodNullable",(e,t)=>{dp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Zh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function hs(e){return new Im({type:"nullable",innerType:e})}function uS(e){return P(hs(e))}var Om=h("ZodDefault",(e,t)=>{pp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Hh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mm(e,t){return new Om({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():O.shallowClone(t)}})}var qm=h("ZodPrefault",(e,t)=>{hp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Fh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Nm(e,t){return new qm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():O.shallowClone(t)}})}var Sl=h("ZodNonOptional",(e,t)=>{mp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Dh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Am(e,t){return new Sl({type:"nonoptional",innerType:e,...O.normalizeParams(t)})}var jm=h("ZodSuccess",(e,t)=>{fp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>$h(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function dS(e){return new jm({type:"success",innerType:e})}var Lm=h("ZodCatch",(e,t)=>{gp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Vh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Um(e,t){return new Lm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Zm=h("ZodNaN",(e,t)=>{Sp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ph(e,o,r,n)});function pS(e){return rh(Zm,e)}var bs=h("ZodPipe",(e,t)=>{cc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Jh(e,o,r,n),e.in=t.in,e.out=t.out});function Bc(e,t){return new bs({type:"pipe",in:e,out:t})}var ys=h("ZodCodec",(e,t)=>{bs.init(e,t),is.init(e,t)});function hS(e,t,o){return new ys({type:"pipe",in:e,out:t,transform:o.decode,reverseTransform:o.encode})}function mS(e){let t=e._zod.def;return new ys({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Dm=h("ZodPreprocess",(e,t)=>{bs.init(e,t),_p.init(e,t)}),Hm=h("ZodReadonly",(e,t)=>{bp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Bh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Fm(e){return new Hm({type:"readonly",innerType:e})}var Vm=h("ZodTemplateLiteral",(e,t)=>{yp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Eh(e,o,r,n)});function fS(e,t){return new Vm({type:"template_literal",parts:e,...O.normalizeParams(t)})}var Jm=h("ZodLazy",(e,t)=>{Rp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Kh(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function Mt(e){return new Jm({type:"lazy",getter:e})}var Bm=h("ZodPromise",(e,t)=>{zp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Wh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function gS(e){return new Bm({type:"promise",innerType:e})}var Wm=h("ZodFunction",(e,t)=>{vp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ih(e,o,r,n)});function SS(e){return new Wm({type:"function",input:Array.isArray(e?.input)?wm(e?.input):e?.input??f(T()),output:e?.output??T()})}var vs=h("ZodCustom",(e,t)=>{wp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ch(e,o,r,n)});function _S(e){let t=new F({check:"custom"});return t._zod.check=e,t}function bS(e,t){return ih(vs,e??(()=>!0),t)}function Km(e,t={}){return ah(vs,e,t)}function Gm(e,t){return ch(e,t)}var yS=lh,vS=uh;function zS(e,t={}){let o=new vs({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...O.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 RS=(...e)=>dh({Codec:ys,Boolean:_r,String:mr},...e);function wS(e){let t=Mt(()=>x([c(e),b(),R(),Je(),f(t),z(c(),t)]));return t}function it(e,t){return new Dm({type:"pipe",in:fl(e),out:t})}var Qm={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 qy(e){Y({customError:e})}function Ny(){return Y().customError}var Ym;Ym||(Ym={});var w={...us,...Zc,iso:xe},Ay=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function jy(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 Ly(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 w.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return w.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=Ly(n,t),a=le(s,t);return t.refs.set(n,a),t.processing.delete(n),a}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 w.null();if(n.length===0)return w.never();if(n.length===1)return w.literal(n[0]);if(n.every(a=>typeof a=="string"))return w.enum(n);let s=n.map(a=>w.literal(a));return s.length<2?s[0]:w.union([s[0],s[1],...s.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let o=e.type;if(Array.isArray(o)){let n=o.map(s=>{let a={...e,type:s};return xS(a,t)});return n.length===0?w.never():n.length===1?n[0]:w.union(n)}if(!o)return w.any();let r;switch(o){case"string":{let n=w.string();if(e.format){let s=e.format;s==="email"?n=n.check(w.email()):s==="uri"||s==="uri-reference"?n=n.check(w.url()):s==="uuid"||s==="guid"?n=n.check(w.uuid()):s==="date-time"?n=n.check(w.iso.datetime()):s==="date"?n=n.check(w.iso.date()):s==="time"?n=n.check(w.iso.time()):s==="duration"?n=n.check(w.iso.duration()):s==="ipv4"?n=n.check(w.ipv4()):s==="ipv6"?n=n.check(w.ipv6()):s==="mac"?n=n.check(w.mac()):s==="cidr"?n=n.check(w.cidrv4()):s==="cidr-v6"?n=n.check(w.cidrv6()):s==="base64"?n=n.check(w.base64()):s==="base64url"?n=n.check(w.base64url()):s==="e164"?n=n.check(w.e164()):s==="jwt"?n=n.check(w.jwt()):s==="emoji"?n=n.check(w.emoji()):s==="nanoid"?n=n.check(w.nanoid()):s==="cuid"?n=n.check(w.cuid()):s==="cuid2"?n=n.check(w.cuid2()):s==="ulid"?n=n.check(w.ulid()):s==="xid"?n=n.check(w.xid()):s==="ksuid"&&(n=n.check(w.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"?w.number().int():w.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=w.boolean();break}case"null":{r=w.null();break}case"object":{let n={},s=e.properties||{},a=new Set(e.required||[]);for(let[u,d]of Object.entries(s)){let m=le(d,t);n[u]=a.has(u)?m:m.optional()}if(e.propertyNames){let u=le(e.propertyNames,t),d=e.additionalProperties&&typeof e.additionalProperties=="object"?le(e.additionalProperties,t):w.any();if(Object.keys(n).length===0){r=w.record(u,d);break}let m=w.object(n).passthrough(),S=w.looseRecord(u,d);r=w.intersection(m,S);break}if(e.patternProperties){let u=e.patternProperties,d=Object.keys(u),m=[];for(let _ of d){let y=le(u[_],t),E=w.string().regex(new RegExp(_));m.push(w.looseRecord(E,y))}let S=[];if(Object.keys(n).length>0&&S.push(w.object(n).passthrough()),S.push(...m),S.length===0)r=w.object({}).passthrough();else if(S.length===1)r=S[0];else{let _=w.intersection(S[0],S[1]);for(let y=2;y<S.length;y++)_=w.intersection(_,S[y]);r=_}break}let l=w.object(n);e.additionalProperties===!1?r=l.strict():typeof e.additionalProperties=="object"?r=l.catchall(le(e.additionalProperties,t)):r=l.passthrough();break}case"array":{let n=e.prefixItems,s=e.items;if(n&&Array.isArray(n)){let a=n.map(u=>le(u,t)),l=s&&typeof s=="object"&&!Array.isArray(s)?le(s,t):void 0;l?r=w.tuple(a).rest(l):r=w.tuple(a),typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(Array.isArray(s)){let a=s.map(u=>le(u,t)),l=e.additionalItems&&typeof e.additionalItems=="object"?le(e.additionalItems,t):void 0;l?r=w.tuple(a).rest(l):r=w.tuple(a),typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(s!==void 0){let a=le(s,t),l=w.array(a);typeof e.minItems=="number"&&(l=l.min(e.minItems)),typeof e.maxItems=="number"&&(l=l.max(e.maxItems)),r=l}else r=w.array(w.any());break}default:throw new Error(`Unsupported type: ${o}`)}return r}function le(e,t){if(typeof e=="boolean")return e?w.any():w.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 l=e.anyOf.map(d=>le(d,t)),u=w.union(l);o=r?w.intersection(o,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let l=e.oneOf.map(d=>le(d,t)),u=w.xor(l);o=r?w.intersection(o,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)o=r?o:w.any();else{let l=r?o:le(e.allOf[0],t),u=r?0:1;for(let d=u;d<e.allOf.length;d++)l=w.intersection(l,le(e.allOf[d],t));o=l}e.nullable===!0&&t.version==="openapi-3.0"&&(o=w.nullable(o)),e.readOnly===!0&&(o=w.readonly(o)),e.default!==void 0&&(o=o.default(e.default));let n={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let l of s)l in e&&(n[l]=e[l]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let l of a)l in e&&(n[l]=e[l]);for(let l of Object.keys(e))Ay.has(l)||(n[l]=e[l]);return Object.keys(n).length>0&&t.registry.add(o,n),e.description&&(o=o.describe(e.description)),o}function TS(e,t){if(typeof e=="boolean")return e?w.any():w.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=jy(o,t?.defaultTarget),n=o.$defs||o.definitions||{},s={version:r,defs:n,refs:new Map,processing:new Set,rootSchema:o,registry:t?.registry??re};return le(o,s)}var zs={};ot(zs,{bigint:()=>Hy,boolean:()=>Dy,date:()=>Fy,number:()=>Zy,string:()=>Uy});function Uy(e){return Ep(mr,e)}function Zy(e){return Np(Sr,e)}function Dy(e){return Hp(_r,e)}function Hy(e){return Vp(br,e)}function Fy(e){return oh(gs,e)}Y(lc());var _l="2025-11-25";var bl=[_l,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],yl="io.modelcontextprotocol/related-task",lo="io.modelcontextprotocol/protocolVersion",yr="io.modelcontextprotocol/clientInfo",Nt="io.modelcontextprotocol/serverInfo",uo="io.modelcontextprotocol/clientCapabilities",vl="io.modelcontextprotocol/subscriptionId",vr="io.modelcontextprotocol/logLevel";var po="2.0";var at=Mt(()=>x([c(),b(),R(),Je(),z(c(),at),f(at)])),B=z(c(),at),zl=f(at),zr=x([c(),b().int()]),Rr=c(),Rs=p({ttl:b().optional()}),ws=p({taskId:c()}),wr=k({progressToken:zr.optional(),[yl]:ws.optional()}),oe=p({_meta:wr.optional()}),At=oe.extend({task:Rs.optional()}),W=p({method:c(),params:oe.loose().optional()}),ue=p({_meta:wr.optional()}),ne=p({method:c(),params:ue.loose().optional()}),xr=k({get[Nt](){return Pe.optional().catch(void 0)}}),K=k({_meta:xr.optional()}),Te=x([c(),b().int()]),Tr=p({jsonrpc:g(po),id:Te,...W.shape}).strict(),Pr=p({jsonrpc:g(po),...ne.shape}).strict(),ho=p({jsonrpc:g(po),id:Te,result:K}).strict(),mo=p({jsonrpc:g(po),id:Te.optional(),error:p({code:b().int(),message:c(),data:T().optional()})}).strict(),ct=x([Tr,Pr,ho,mo]),Rl=x([ho,mo]),We=K.strict(),xs=ue.extend({requestId:Te.optional(),reason:c().optional()}),Er=ne.extend({method:g("notifications/cancelled"),params:xs}),Ts=p({src:c(),mimeType:c().optional(),sizes:f(c()).optional(),theme:C(["light","dark"]).optional()}),lt=p({icons:f(Ts).optional()}),Be=p({name:c(),title:c().optional()}),Pe=Be.extend({...Be.shape,...lt.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),Jy=Le(p({applyDefaults:R().optional()}),B),By=it(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Le(p({form:Jy.optional(),url:B.optional()}),B.optional())),wl=k({list:B.optional(),cancel:B.optional(),requests:k({sampling:k({createMessage:B.optional()}).optional(),elicitation:k({create:B.optional()}).optional()}).optional()}),xl=k({list:B.optional(),cancel:B.optional(),requests:k({tools:k({call:B.optional()}).optional()}).optional()}),Ps=p({experimental:z(c(),B).optional(),sampling:p({context:B.optional(),tools:B.optional()}).optional(),elicitation:By.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:wl.optional(),extensions:z(c(),B).optional()}),Es=oe.extend({protocolVersion:c(),capabilities:Ps,clientInfo:Pe}),ks=W.extend({method:g("initialize"),params:Es}),kr=p({experimental:z(c(),B).optional(),logging:B.optional(),completions:B.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:z(c(),B).optional()}),$s=K.extend({protocolVersion:c(),capabilities:kr,serverInfo:Pe,instructions:c().optional()}),Cs=ne.extend({method:g("notifications/initialized"),params:ue.optional()}),Is=W.extend({method:g("server/discover"),params:oe.optional()}),$r=K.extend({supportedVersions:f(c()),capabilities:kr,instructions:c().optional()}),Cr=W.extend({method:g("ping"),params:oe.optional()}),Os=p({progress:b(),total:P(b()),message:P(c())}),Ms=p({...ue.shape,...Os.shape,progressToken:zr}),Ir=ne.extend({method:g("notifications/progress"),params:Ms}),qs=oe.extend({cursor:Rr.optional()}),ut=W.extend({params:qs.optional()}),dt=K.extend({nextCursor:Rr.optional()}),Or=p({uri:c(),mimeType:P(c()),_meta:z(c(),T()).optional()}),Mr=Or.extend({text:c()}),ef=c().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),qr=Or.extend({blob:ef}),pt=C(["user","assistant"]),Ke=p({audience:f(pt).optional(),priority:b().min(0).max(1).optional(),lastModified:xe.datetime({offset:!0}).optional()}),Nr=p({...Be.shape,...lt.shape,uri:c(),description:P(c()),mimeType:P(c()),size:P(b()),annotations:Ke.optional(),_meta:P(k({}))}),Ns=p({...Be.shape,...lt.shape,uriTemplate:c(),description:P(c()),mimeType:P(c()),annotations:Ke.optional(),_meta:P(k({}))}),As=ut.extend({method:g("resources/list")}),js=dt.extend({resources:f(Nr)}),Ls=ut.extend({method:g("resources/templates/list")}),Us=dt.extend({resourceTemplates:f(Ns)}),fo=oe.extend({uri:c()}),Zs=fo,Ds=W.extend({method:g("resources/read"),params:Zs}),Hs=K.extend({contents:f(x([Mr,qr]))}),Fs=ne.extend({method:g("notifications/resources/list_changed"),params:ue.optional()}),Vs=fo,Js=W.extend({method:g("resources/subscribe"),params:Vs}),Bs=fo,Ws=W.extend({method:g("resources/unsubscribe"),params:Bs}),Ar=p({toolsListChanged:R().optional(),promptsListChanged:R().optional(),resourcesListChanged:R().optional(),resourceSubscriptions:f(c()).optional()}),Ks=oe.extend({notifications:Ar}),Gs=W.extend({method:g("subscriptions/listen"),params:Ks}),Ys=ue.extend({notifications:Ar}),Qs=ne.extend({method:g("notifications/subscriptions/acknowledged"),params:Ys}),Xs=xr.extend({[vl]:Te}),ei=K.extend({_meta:Xs}),ti=ue.extend({uri:c()}),oi=ne.extend({method:g("notifications/resources/updated"),params:ti}),ri=p({name:c(),description:P(c()),required:P(R())}),ni=p({...Be.shape,...lt.shape,description:P(c()),arguments:P(f(ri)),_meta:P(k({}))}),si=ut.extend({method:g("prompts/list")}),ii=dt.extend({prompts:f(ni)}),ai=oe.extend({name:c(),arguments:z(c(),c()).optional()}),ci=W.extend({method:g("prompts/get"),params:ai}),go=p({type:g("text"),text:c(),annotations:Ke.optional(),_meta:z(c(),T()).optional()}),So=p({type:g("image"),data:ef,mimeType:c(),annotations:Ke.optional(),_meta:z(c(),T()).optional()}),_o=p({type:g("audio"),data:ef,mimeType:c(),annotations:Ke.optional(),_meta:z(c(),T()).optional()}),li=p({type:g("tool_use"),name:c(),id:c(),input:z(c(),T()),_meta:z(c(),T()).optional()}),ht=p({type:g("resource"),resource:x([Mr,qr]),annotations:Ke.optional(),_meta:z(c(),T()).optional()}),mt=Nr.extend({type:g("resource_link")}),Ee=x([go,So,_o,mt,ht]),ui=p({role:pt,content:Ee}),di=K.extend({description:c().optional(),messages:f(ui)}),pi=ne.extend({method:g("notifications/prompts/list_changed"),params:ue.optional()}),hi=p({title:c().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),mi=p({taskSupport:C(["required","optional","forbidden"]).optional()}),Ge=p({...Be.shape,...lt.shape,description:c().optional(),inputSchema:p({type:g("object"),properties:z(c(),at).optional(),required:f(c()).optional()}).catchall(T()),outputSchema:k({$schema:c().optional()}).optional(),annotations:hi.optional(),execution:mi.optional(),_meta:z(c(),T()).optional()}),fi=ut.extend({method:g("tools/list")}),gi=dt.extend({tools:f(Ge)}),Ye=K.extend({content:f(Ee).default([]),structuredContent:T().optional(),isError:R().optional()}),Tl=Ye.or(K.extend({toolResult:T()})),Si=At.extend({name:c(),arguments:z(c(),T()).optional()}),_i=W.extend({method:g("tools/call"),params:Si}),bi=ne.extend({method:g("notifications/tools/list_changed"),params:ue.optional()}),Pl=p({autoRefresh:R().default(!0),debounceMs:b().int().nonnegative().default(300)}),jr=C(["debug","info","notice","warning","error","critical","alert","emergency"]),yi=oe.extend({level:jr}),vi=W.extend({method:g("logging/setLevel"),params:yi}),zi=ue.extend({level:jr,logger:c().optional(),data:T()}),bo=ne.extend({method:g("notifications/message"),params:zi}),Ri=p({name:c().optional()}),wi=p({hints:f(Ri).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),xi=p({mode:C(["auto","required","none"]).optional()}),Ti=p({type:g("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:f(Ee),structuredContent:T().optional(),isError:R().optional(),_meta:z(c(),T()).optional()}),Pi=Ot("type",[go,So,_o]),qt=Ot("type",[go,So,_o,li,Ti]),Ei=p({role:pt,content:x([qt,f(qt)]),_meta:z(c(),T()).optional()}),ki=At.extend({messages:f(Ei),modelPreferences:wi.optional(),systemPrompt:c().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:f(c()).optional(),metadata:B.optional(),tools:f(Ge).optional(),toolChoice:xi.optional()}),$i=W.extend({method:g("sampling/createMessage"),params:ki}),Ci=K.extend({model:c(),stopReason:P(C(["endTurn","stopSequence","maxTokens"]).or(c())),role:pt,content:Pi}),Ii=K.extend({model:c(),stopReason:P(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:pt,content:x([qt,f(qt)])}),Lr=p({type:g("boolean"),title:c().optional(),description:c().optional(),default:R().optional()}),yo=p({type:g("string"),title:c().optional(),description:c().optional(),minLength:b().optional(),maxLength:b().optional(),format:C(["email","uri","date","date-time"]).optional(),default:c().optional()}),vo=p({type:C(["number","integer"]),title:c().optional(),description:c().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),Ur=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),default:c().optional()}),Zr=p({type:g("string"),title:c().optional(),description:c().optional(),oneOf:f(p({const:c(),title:c()})),default:c().optional()}),Dr=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),enumNames:f(c()).optional(),default:c().optional()}),Oi=x([Ur,Zr]),Hr=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:g("string"),enum:f(c())}),default:f(c()).optional()}),Fr=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:f(p({const:c(),title:c()}))}),default:f(c()).optional()}),Mi=x([Hr,Fr]),qi=x([Dr,Oi,Mi]),Vr=x([qi,Lr,yo,vo]),zo=At.extend({mode:g("form").optional(),message:c(),requestedSchema:p({type:g("object"),properties:z(c(),Vr),required:f(c()).optional()}).catchall(T())}),Ni=At.extend({mode:g("url"),message:c(),elicitationId:c(),url:c().url()}),Ai=x([zo,Ni]),ji=W.extend({method:g("elicitation/create"),params:Ai}),Li=ue.extend({elicitationId:c()}),Ui=ne.extend({method:g("notifications/elicitation/complete"),params:Li}),Zi=K.extend({action:C(["accept","decline","cancel"]),content:it(e=>e===null?void 0:e,z(c(),x([c(),b(),R(),f(c())])).optional())}),Di=p({type:g("ref/resource"),uri:c()}),Hi=p({type:g("ref/prompt"),name:c()}),Fi=oe.extend({ref:x([Hi,Di]),argument:p({name:c(),value:c()}),context:p({arguments:z(c(),c()).optional()}).optional()}),Vi=W.extend({method:g("completion/complete"),params:Fi}),Ji=K.extend({completion:k({values:f(c()).max(100),total:P(b().int()),hasMore:P(R())})}),Bi=p({uri:c().startsWith("file://"),name:c().optional(),_meta:z(c(),T()).optional()}),Wi=W.extend({method:g("roots/list"),params:oe.optional()}),Ki=K.extend({roots:f(Bi)}),Gi=ne.extend({method:g("notifications/roots/list_changed"),params:ue.optional()}),El=k({ttl:b().optional(),pollInterval:b().optional()}),Yi=C(["working","input_required","completed","failed","cancelled"]),ft=p({taskId:c(),status:Yi,ttl:x([b(),Je()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:P(b()),statusMessage:P(c())}),kl=K.extend({task:ft}),Qi=ue.merge(ft),$l=ne.extend({method:g("notifications/tasks/status"),params:Qi}),Cl=W.extend({method:g("tasks/get"),params:oe.extend({taskId:c()})}),Il=K.merge(ft),Ol=W.extend({method:g("tasks/result"),params:oe.extend({taskId:c()})}),Ml=K.loose(),ql=ut.extend({method:g("tasks/list")}),Nl=dt.extend({tasks:f(ft)}),Al=W.extend({method:g("tasks/cancel"),params:oe.extend({taskId:c()})}),jl=K.merge(ft),Ll=x([Cr,ks,Is,Vi,vi,ci,si,As,Ls,Ds,Js,Ws,Gs,_i,fi]),Ul=x([Er,Ir,Cs,Gi]),Zl=x([We,Ci,Ii,Zi,Ki]),Dl=x([Cr,$i,ji,Wi]),Hl=x([Er,Ir,bo,oi,Fs,bi,pi,Qs,Ui]),Fl=x([We,$s,$r,Ji,di,ii,js,Us,Hs,Ye,gi,ei]),te=fr().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Qm.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"}),Xi=k({resource:c().url(),authorization_servers:f(te).optional(),jwks_uri:c().url().optional(),scopes_supported:f(c()).optional(),bearer_methods_supported:f(c()).optional(),resource_signing_alg_values_supported:f(c()).optional(),resource_name:c().optional(),resource_documentation:c().optional(),resource_policy_uri:c().url().optional(),resource_tos_uri:c().url().optional(),tls_client_certificate_bound_access_tokens:R().optional(),authorization_details_types_supported:f(c()).optional(),dpop_signing_alg_values_supported:f(c()).optional(),dpop_bound_access_tokens_required:R().optional()}),Jr=k({issuer:c(),authorization_endpoint:te,token_endpoint:te,registration_endpoint:te.optional(),scopes_supported:f(c()).optional(),response_types_supported:f(c()),response_modes_supported:f(c()).optional(),grant_types_supported:f(c()).optional(),token_endpoint_auth_methods_supported:f(c()).optional(),token_endpoint_auth_signing_alg_values_supported:f(c()).optional(),service_documentation:te.optional(),revocation_endpoint:te.optional(),revocation_endpoint_auth_methods_supported:f(c()).optional(),revocation_endpoint_auth_signing_alg_values_supported:f(c()).optional(),introspection_endpoint:c().optional(),introspection_endpoint_auth_methods_supported:f(c()).optional(),introspection_endpoint_auth_signing_alg_values_supported:f(c()).optional(),code_challenge_methods_supported:f(c()).optional(),client_id_metadata_document_supported:R().optional(),authorization_response_iss_parameter_supported:R().optional().catch(void 0),dpop_signing_alg_values_supported:f(c()).optional()}),ea=k({issuer:c(),authorization_endpoint:te,token_endpoint:te,userinfo_endpoint:te.optional(),jwks_uri:te,registration_endpoint:te.optional(),scopes_supported:f(c()).optional(),response_types_supported:f(c()),response_modes_supported:f(c()).optional(),grant_types_supported:f(c()).optional(),acr_values_supported:f(c()).optional(),subject_types_supported:f(c()),id_token_signing_alg_values_supported:f(c()),id_token_encryption_alg_values_supported:f(c()).optional(),id_token_encryption_enc_values_supported:f(c()).optional(),userinfo_signing_alg_values_supported:f(c()).optional(),userinfo_encryption_alg_values_supported:f(c()).optional(),userinfo_encryption_enc_values_supported:f(c()).optional(),request_object_signing_alg_values_supported:f(c()).optional(),request_object_encryption_alg_values_supported:f(c()).optional(),request_object_encryption_enc_values_supported:f(c()).optional(),token_endpoint_auth_methods_supported:f(c()).optional(),token_endpoint_auth_signing_alg_values_supported:f(c()).optional(),display_values_supported:f(c()).optional(),claim_types_supported:f(c()).optional(),claims_supported:f(c()).optional(),service_documentation:c().optional(),claims_locales_supported:f(c()).optional(),ui_locales_supported:f(c()).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:te.optional(),op_tos_uri:te.optional(),client_id_metadata_document_supported:R().optional(),authorization_response_iss_parameter_supported:R().optional().catch(void 0)}),ta=p({...ea.shape,...Jr.pick({code_challenge_methods_supported:!0}).shape}),oa=p({access_token:c(),id_token:c().optional(),token_type:c(),expires_in:zs.number().optional(),scope:c().optional(),refresh_token:c().optional(),issuer:c().optional().catch(void 0)}).strip(),ra=p({issued_token_type:g("urn:ietf:params:oauth:token-type:id-jag"),access_token:c(),token_type:c().optional(),expires_in:b().optional(),scope:c().optional()}).strip(),na=p({error:c(),error_description:c().optional(),error_uri:c().optional()}),Xm=te.optional().or(g("").transform(()=>{})),sa=p({redirect_uris:f(te),token_endpoint_auth_method:c().optional(),grant_types:f(c()).optional(),response_types:f(c()).optional(),application_type:c().optional(),client_name:c().optional(),client_uri:te.optional(),logo_uri:Xm,scope:c().optional(),contacts:f(c()).optional(),tos_uri:Xm,policy_uri:c().optional(),jwks_uri:te.optional(),jwks:hl().optional(),software_id:c().optional(),software_version:c().optional(),software_statement:c().optional()}).strip(),ia=p({client_id:c(),client_secret:c().optional(),client_id_issued_at:b().optional(),client_secret_expires_at:b().optional(),issuer:c().optional().catch(void 0)}).strip(),aa=sa.merge(ia),Vl=p({error:c(),error_description:c().optional()}).strip(),Jl=p({token:c(),token_type_hint:c().optional()}).strip();var af=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,af,{value:o,enumerable:!1,configurable:!0})}function ke(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,af)){let o=t[af];if(o&&typeof o.has=="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Wy=class JS extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return ke(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 ke(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)}},se=(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})({}),X=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return ke(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 ke(this,e)}constructor(e,t,o,r){super(t,r),this.code=e,this.data=o,this.name="SdkError",Ro(this,new.target)}},Ky=class extends X{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 Gy="2026-07-28";function BS(e){return e>=Gy}function WS(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 KS=["task","inputRequests","requestState"];function Yy(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||KS.some(t=>t in e)?e:{...e,content:[]}}function Qy(){let e=Mt(()=>x([c(),b(),R(),Je(),z(c(),e),f(e)])),t=z(c(),e),o=x([c(),b().int()]),r=c(),n=p({ttl:b().optional()}),s=p({taskId:c()}),a=k({progressToken:o.optional(),"io.modelcontextprotocol/related-task":s.optional()}),l=p({_meta:a.optional()}),u=l.extend({task:n.optional()}),d=p({method:c(),params:l.loose().optional()}),m=p({_meta:a.optional()}),S=p({method:c(),params:m.loose().optional()}),_=k({_meta:a.optional()}),y=x([c(),b().int()]),E=_.strict(),$=m.extend({requestId:y.optional(),reason:c().optional()}),I=S.extend({method:g("notifications/cancelled"),params:$}),H=p({src:c(),mimeType:c().optional(),sizes:f(c()).optional(),theme:C(["light","dark"]).optional()}),G=p({icons:f(H).optional()}),U=p({name:c(),title:c().optional()}),j=U.extend({...U.shape,...G.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),J=Le(p({applyDefaults:R().optional()}),t),V=it(ce=>ce&&typeof ce=="object"&&!Array.isArray(ce)&&Object.keys(ce).length===0?{form:{}}:ce,Le(p({form:J.optional(),url:t.optional()}),t.optional())),ee=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),Xe=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),de=p({experimental:z(c(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:V.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:ee.optional(),extensions:z(c(),t).optional()}),gt=l.extend({protocolVersion:c(),capabilities:de,clientInfo:j}),Ut=d.extend({method:g("initialize"),params:gt}),Kr=p({experimental:z(c(),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:Xe.optional(),extensions:z(c(),t).optional()}),Gr=_.extend({protocolVersion:c(),capabilities:Kr,serverInfo:j,instructions:c().optional()}),Po=S.extend({method:g("notifications/initialized"),params:m.optional()}),St=d.extend({method:g("ping"),params:l.optional()}),Zt=p({progress:b(),total:P(b()),message:P(c())}),Ue=p({...m.shape,...Zt.shape,progressToken:o}),_t=S.extend({method:g("notifications/progress"),params:Ue}),Eo=l.extend({cursor:r.optional()}),et=d.extend({params:Eo.optional()}),tt=_.extend({nextCursor:r.optional()}),ko=p({uri:c(),mimeType:P(c()),_meta:z(c(),T()).optional()}),$o=ko.extend({text:c()}),Dt=c().refine(ce=>{try{return atob(ce),!0}catch{return!1}},{message:"Invalid Base64 string"}),Co=ko.extend({blob:Dt}),Ze=C(["user","assistant"]),qe=p({audience:f(Ze).optional(),priority:b().min(0).max(1).optional(),lastModified:xe.datetime({offset:!0}).optional()}),Ht=p({...U.shape,...G.shape,uri:c(),description:P(c()),mimeType:P(c()),size:P(b()),annotations:qe.optional(),_meta:P(k({}))}),Yr=p({...U.shape,...G.shape,uriTemplate:c(),description:P(c()),mimeType:P(c()),annotations:qe.optional(),_meta:P(k({}))}),Qr=et.extend({method:g("resources/list")}),Xr=tt.extend({resources:f(Ht)}),bt=et.extend({method:g("resources/templates/list")}),Io=tt.extend({resourceTemplates:f(Yr)}),Ft=l.extend({uri:c()}),en=Ft,tn=d.extend({method:g("resources/read"),params:en}),on=_.extend({contents:f(x([$o,Co]))}),rn=S.extend({method:g("notifications/resources/list_changed"),params:m.optional()}),nn=Ft,sn=d.extend({method:g("resources/subscribe"),params:nn}),an=Ft,cn=d.extend({method:g("resources/unsubscribe"),params:an}),ln=m.extend({uri:c()}),un=S.extend({method:g("notifications/resources/updated"),params:ln}),dn=p({name:c(),description:P(c()),required:P(R())}),pn=p({...U.shape,...G.shape,description:P(c()),arguments:P(f(dn)),_meta:P(k({}))}),hn=et.extend({method:g("prompts/list")}),mn=tt.extend({prompts:f(pn)}),fn=l.extend({name:c(),arguments:z(c(),c()).optional()}),gn=d.extend({method:g("prompts/get"),params:fn}),Vt=p({type:g("text"),text:c(),annotations:qe.optional(),_meta:z(c(),T()).optional()}),Jt=p({type:g("image"),data:Dt,mimeType:c(),annotations:qe.optional(),_meta:z(c(),T()).optional()}),Bt=p({type:g("audio"),data:Dt,mimeType:c(),annotations:qe.optional(),_meta:z(c(),T()).optional()}),Sn=p({type:g("tool_use"),name:c(),id:c(),input:z(c(),T()),_meta:z(c(),T()).optional()}),yt=p({type:g("resource"),resource:x([$o,Co]),annotations:qe.optional(),_meta:z(c(),T()).optional()}),_n=Ht.extend({type:g("resource_link")}),Ce=x([Vt,Jt,Bt,_n,yt]),Oo=p({role:Ze,content:Ce}),Mo=_.extend({description:c().optional(),messages:f(Oo)}),Wt=S.extend({method:g("notifications/prompts/list_changed"),params:m.optional()}),bn=p({title:c().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),qo=p({taskSupport:C(["required","optional","forbidden"]).optional()}),Kt=p({...U.shape,...G.shape,description:c().optional(),inputSchema:p({type:g("object"),properties:z(c(),e).optional(),required:f(c()).optional()}).catchall(T()),outputSchema:p({type:g("object"),properties:z(c(),e).optional(),required:f(c()).optional()}).catchall(T()).optional(),annotations:bn.optional(),execution:qo.optional(),_meta:z(c(),T()).optional()}),No=et.extend({method:g("tools/list")}),Ao=tt.extend({tools:f(Kt)}),jo=_.extend({content:f(Ce),structuredContent:z(c(),T()).optional(),isError:R().optional()}),ae=u.extend({name:c(),arguments:z(c(),T()).optional()}),yn=d.extend({method:g("tools/call"),params:ae}),ba=S.extend({method:g("notifications/tools/list_changed"),params:m.optional()}),Lo=C(["debug","info","notice","warning","error","critical","alert","emergency"]),vn=l.extend({level:Lo}),zn=d.extend({method:g("logging/setLevel"),params:vn}),Rn=m.extend({level:Lo,logger:c().optional(),data:T()}),wn=S.extend({method:g("notifications/message"),params:Rn}),xn=p({name:c().optional()}),Tn=p({hints:f(xn).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),Pn=p({mode:C(["auto","required","none"]).optional()}),ya=p({type:g("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:f(Ce),structuredContent:p({}).loose().optional(),isError:R().optional(),_meta:z(c(),T()).optional()}),En=Ot("type",[Vt,Jt,Bt]),vt=Ot("type",[Vt,Jt,Bt,Sn,ya]),kn=p({role:Ze,content:x([vt,f(vt)]),_meta:z(c(),T()).optional()}),$n=u.extend({messages:f(kn),modelPreferences:Tn.optional(),systemPrompt:c().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:f(c()).optional(),metadata:t.optional(),tools:f(Kt).optional(),toolChoice:Pn.optional()}),Cn=d.extend({method:g("sampling/createMessage"),params:$n}),In=_.extend({model:c(),stopReason:P(C(["endTurn","stopSequence","maxTokens"]).or(c())),role:Ze,content:En}),On=_.extend({model:c(),stopReason:P(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Ze,content:x([vt,f(vt)])}),Mn=p({type:g("boolean"),title:c().optional(),description:c().optional(),default:R().optional()}),qn=p({type:g("string"),title:c().optional(),description:c().optional(),minLength:b().optional(),maxLength:b().optional(),format:C(["email","uri","date","date-time"]).optional(),default:c().optional()}),Nn=p({type:C(["number","integer"]),title:c().optional(),description:c().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),An=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),default:c().optional()}),jn=p({type:g("string"),title:c().optional(),description:c().optional(),oneOf:f(p({const:c(),title:c()})),default:c().optional()}),Ln=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),enumNames:f(c()).optional(),default:c().optional()}),Un=x([An,jn]),Gt=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:g("string"),enum:f(c())}),default:f(c()).optional()}),Yt=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:f(p({const:c(),title:c()}))}),default:f(c()).optional()}),va=x([Gt,Yt]),za=x([Ln,Un,va]),ve=x([za,Mn,qn,Nn]),ze=u.extend({mode:g("form").optional(),message:c(),requestedSchema:p({type:g("object"),properties:z(c(),ve),required:f(c()).optional()}).catchall(T())}),Zn=u.extend({mode:g("url"),message:c(),elicitationId:c(),url:c().url()}),Ne=x([ze,Zn]),Ra=d.extend({method:g("elicitation/create"),params:Ne}),wa=m.extend({elicitationId:c()}),xa=S.extend({method:g("notifications/elicitation/complete"),params:wa}),Ta=_.extend({action:C(["accept","decline","cancel"]),content:it(ce=>ce===null?void 0:ce,z(c(),x([c(),b(),R(),f(c())])).optional())}),Pa=p({type:g("ref/resource"),uri:c()}),Ea=p({type:g("ref/prompt"),name:c()}),ka=l.extend({ref:x([Ea,Pa]),argument:p({name:c(),value:c()}),context:p({arguments:z(c(),c()).optional()}).optional()}),Dn=d.extend({method:g("completion/complete"),params:ka}),$a=_.extend({completion:k({values:f(c()).max(100),total:P(b().int()),hasMore:P(R())})}),Ca=p({uri:c().startsWith("file://"),name:c().optional(),_meta:z(c(),T()).optional()}),Uo=d.extend({method:g("roots/list"),params:l.optional()}),Hn=_.extend({roots:f(Ca)}),Ia=S.extend({method:g("notifications/roots/list_changed"),params:m.optional()}),Oa=k({ttl:b().optional(),pollInterval:b().optional()}),Fn=C(["working","input_required","completed","failed","cancelled"]),zt=p({taskId:c(),status:Fn,ttl:x([b(),Je()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:P(b()),statusMessage:P(c())}),Se=_.extend({task:zt}),Ma=m.merge(zt),Qt=S.extend({method:g("notifications/tasks/status"),params:Ma}),Zo=d.extend({method:g("tasks/get"),params:l.extend({taskId:c()})}),Do=_.merge(zt),Ho=d.extend({method:g("tasks/result"),params:l.extend({taskId:c()})}),ru=_.loose(),pe=et.extend({method:g("tasks/list")}),Q=tt.extend({tasks:f(zt)}),Xt=d.extend({method:g("tasks/cancel"),params:l.extend({taskId:c()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:a,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:m,NotificationSchema:S,ResultSchema:_,RequestIdSchema:y,EmptyResultSchema:E,CancelledNotificationParamsSchema:$,CancelledNotificationSchema:I,IconSchema:H,IconsSchema:G,BaseMetadataSchema:U,ImplementationSchema:j,ClientTasksCapabilitySchema:ee,ServerTasksCapabilitySchema:Xe,ClientCapabilitiesSchema:de,InitializeRequestParamsSchema:gt,InitializeRequestSchema:Ut,ServerCapabilitiesSchema:Kr,InitializeResultSchema:Gr,InitializedNotificationSchema:Po,PingRequestSchema:St,ProgressSchema:Zt,ProgressNotificationParamsSchema:Ue,ProgressNotificationSchema:_t,PaginatedRequestParamsSchema:Eo,PaginatedRequestSchema:et,PaginatedResultSchema:tt,ResourceContentsSchema:ko,TextResourceContentsSchema:$o,BlobResourceContentsSchema:Co,RoleSchema:Ze,AnnotationsSchema:qe,ResourceSchema:Ht,ResourceTemplateSchema:Yr,ListResourcesRequestSchema:Qr,ListResourcesResultSchema:Xr,ListResourceTemplatesRequestSchema:bt,ListResourceTemplatesResultSchema:Io,ResourceRequestParamsSchema:Ft,ReadResourceRequestParamsSchema:en,ReadResourceRequestSchema:tn,ReadResourceResultSchema:on,ResourceListChangedNotificationSchema:rn,SubscribeRequestParamsSchema:nn,SubscribeRequestSchema:sn,UnsubscribeRequestParamsSchema:an,UnsubscribeRequestSchema:cn,ResourceUpdatedNotificationParamsSchema:ln,ResourceUpdatedNotificationSchema:un,PromptArgumentSchema:dn,PromptSchema:pn,ListPromptsRequestSchema:hn,ListPromptsResultSchema:mn,GetPromptRequestParamsSchema:fn,GetPromptRequestSchema:gn,TextContentSchema:Vt,ImageContentSchema:Jt,AudioContentSchema:Bt,ToolUseContentSchema:Sn,EmbeddedResourceSchema:yt,ResourceLinkSchema:_n,ContentBlockSchema:Ce,PromptMessageSchema:Oo,GetPromptResultSchema:Mo,PromptListChangedNotificationSchema:Wt,ToolAnnotationsSchema:bn,ToolExecutionSchema:qo,ToolSchema:Kt,ListToolsRequestSchema:No,ListToolsResultSchema:Ao,CallToolResultSchema:jo,CallToolRequestParamsSchema:ae,CallToolRequestSchema:yn,ToolListChangedNotificationSchema:ba,LoggingLevelSchema:Lo,SetLevelRequestParamsSchema:vn,SetLevelRequestSchema:zn,LoggingMessageNotificationParamsSchema:Rn,LoggingMessageNotificationSchema:wn,ModelHintSchema:xn,ModelPreferencesSchema:Tn,ToolChoiceSchema:Pn,ToolResultContentSchema:ya,SamplingContentSchema:En,SamplingMessageContentBlockSchema:vt,SamplingMessageSchema:kn,CreateMessageRequestParamsSchema:$n,CreateMessageRequestSchema:Cn,CreateMessageResultSchema:In,CreateMessageResultWithToolsSchema:On,BooleanSchemaSchema:Mn,StringSchemaSchema:qn,NumberSchemaSchema:Nn,UntitledSingleSelectEnumSchemaSchema:An,TitledSingleSelectEnumSchemaSchema:jn,LegacyTitledEnumSchemaSchema:Ln,SingleSelectEnumSchemaSchema:Un,UntitledMultiSelectEnumSchemaSchema:Gt,TitledMultiSelectEnumSchemaSchema:Yt,MultiSelectEnumSchemaSchema:va,EnumSchemaSchema:za,PrimitiveSchemaDefinitionSchema:ve,ElicitRequestFormParamsSchema:ze,ElicitRequestURLParamsSchema:Zn,ElicitRequestParamsSchema:Ne,ElicitRequestSchema:Ra,ElicitationCompleteNotificationParamsSchema:wa,ElicitationCompleteNotificationSchema:xa,ElicitResultSchema:Ta,ResourceTemplateReferenceSchema:Pa,PromptReferenceSchema:Ea,CompleteRequestParamsSchema:ka,CompleteRequestSchema:Dn,CompleteResultSchema:$a,RootSchema:Ca,ListRootsRequestSchema:Uo,ListRootsResultSchema:Hn,RootsListChangedNotificationSchema:Ia,TaskCreationParamsSchema:Oa,TaskStatusSchema:Fn,TaskSchema:zt,CreateTaskResultSchema:Se,TaskStatusNotificationParamsSchema:Ma,TaskStatusNotificationSchema:Qt,GetTaskRequestSchema:Zo,GetTaskResultSchema:Do,GetTaskPayloadRequestSchema:Ho,GetTaskPayloadResultSchema:ru,ListTasksRequestSchema:pe,ListTasksResultSchema:Q,CancelTaskRequestSchema:Xt,CancelTaskResultSchema:_.merge(zt),ClientRequestSchema:x([St,Ut,Dn,zn,gn,hn,Qr,bt,tn,sn,cn,yn,No,Zo,Ho,pe,Xt]),ClientNotificationSchema:x([I,_t,Po,Ia,Qt]),ClientResultSchema:x([E,In,On,Ta,Hn,Do,Q,Se]),ServerRequestSchema:x([St,Cn,Ra,Uo,Zo,Ho,pe,Xt]),ServerNotificationSchema:x([I,_t,wn,un,rn,ba,Wt,Qt,xa]),ServerResultSchema:x([E,Gr,$a,Mo,mn,Xr,Io,on,jo,Ao,Do,Q,Se]),CallToolResultWireSchema:T().superRefine((ce,H_)=>{if(!(typeof ce!="object"||ce===null||Array.isArray(ce)||ce.content!==void 0)){for(let Cf of KS)if(Cf in ce){H_.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(Yy).pipe(jo)}}var Xy;function GS(){return Xy??=Qy()}function YS(e){return e.type!=="object"}var ev=new Set(["const","enum","default","examples"]),tv=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function NS(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function ov(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(NS(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=qf(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,s)=>{if(Array.isArray(n))return n.map(u=>r(u,!1));if(n===null||typeof n!="object"||!s&&NS(n.$id))return n;let a={},l=!1;for(let[u,d]of Object.entries(n))s?a[u]=r(d,!1):(u==="$ref"||u==="$dynamicRef")&&typeof d=="string"?a[u]=d==="#"?"#/properties/result":d.startsWith("#/")?`#/properties/result${d.slice(1)}`:d:u==="$recursiveRef"&&d==="#"&&o?l=!0:ev.has(u)?a[u]=d:tv.has(u)?a[u]=r(d,!0):a[u]=r(d,!1);return l&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};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},rv={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 hf(){if(Bl)return Bl;let e=GS();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 nv(e){return Object.prototype.hasOwnProperty.call(rv,e)}function sv(e){return nv(e)?hf().resultSchemas[e]:void 0}function iv(e){return e_(e)?hf().requestSchemas[e]:void 0}function av(e){return t_(e)?hf().notificationSchemas[e]:void 0}var Uw=Object.keys(QS),Zw=Object.keys(XS);function cf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Wl(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 AS={ok:!1,reason:"not-in-era"};function jS(e){return cf(e)&&cf(e.outputSchema)&&YS(e.outputSchema)}var mf={era:"2025-11-25",hasRequestMethod:e_,hasNotificationMethod:t_,validateRequest:(e,t)=>Wl(iv(e),t),validateResult:(e,t)=>Wl(sv(e),t),validateNotification:(e,t)=>Wl(av(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>AS,validateInputResponse:()=>AS,samplingResultVariant:((e,t)=>{let o=GS();return Wl(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let o=WS(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(cf(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:ov(r.outputSchema)}:r)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function cv(){let e=Mt(()=>x([c(),b(),R(),Je(),z(c(),e),f(e)])),t=z(c(),e),o=x([c(),b().int()]),r=c(),n=x([c(),b().int()]),s=C(["user","assistant"]),a=C(["debug","info","notice","warning","error","critical","alert","emergency"]),l=c().refine(Q=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),u=p({ttl:b().optional()}),d=p({taskId:c()}),m=k({progressToken:o.optional(),"io.modelcontextprotocol/related-task":d.optional()}),S=p({_meta:m.optional()}),_=S.extend({task:u.optional()}),y=p({_meta:m.optional()}),E=p({method:c(),params:y.loose().optional()}),$=p({src:c(),mimeType:c().optional(),sizes:f(c()).optional(),theme:C(["light","dark"]).optional()}),I=p({icons:f($).optional()}),H=p({name:c(),title:c().optional()}),G=H.extend({...H.shape,...I.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),U=Le(p({applyDefaults:R().optional()}),t),j=it(Q=>Q&&typeof Q=="object"&&!Array.isArray(Q)&&Object.keys(Q).length===0?{form:{}}:Q,Le(p({form:U.optional(),url:t.optional()}),t.optional())),J=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),V=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),ee=p({experimental:z(c(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:j.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:J.optional(),extensions:z(c(),t).optional()}),Xe=p({experimental:z(c(),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:V.optional(),extensions:z(c(),t).optional()}),de=p({progress:b(),total:P(b()),message:P(c())}),gt=p({...y.shape,...de.shape,progressToken:o}),Ut=E.extend({method:g("notifications/progress"),params:gt}),Kr=y.extend({level:a,logger:c().optional(),data:T()}),Gr=E.extend({method:g("notifications/message"),params:Kr}),Po=p({uri:c(),mimeType:P(c()),_meta:z(c(),T()).optional()}),St=Po.extend({text:c()}),Zt=Po.extend({blob:l}),Ue=p({audience:f(s).optional(),priority:b().min(0).max(1).optional(),lastModified:xe.datetime({offset:!0}).optional()}),_t=p({...H.shape,...I.shape,uri:c(),description:P(c()),mimeType:P(c()),size:P(b()),annotations:Ue.optional(),_meta:P(k({}))}),Eo=p({...H.shape,...I.shape,uriTemplate:c(),description:P(c()),mimeType:P(c()),annotations:Ue.optional(),_meta:P(k({}))}),et=E.extend({method:g("notifications/resources/list_changed"),params:y.optional()}),tt=y.extend({uri:c()}),ko=E.extend({method:g("notifications/resources/updated"),params:tt}),$o=p({name:c(),description:P(c()),required:P(R())}),Dt=p({...H.shape,...I.shape,description:P(c()),arguments:P(f($o)),_meta:P(k({}))}),Co=E.extend({method:g("notifications/prompts/list_changed"),params:y.optional()}),Ze=p({type:g("text"),text:c(),annotations:Ue.optional(),_meta:z(c(),T()).optional()}),qe=p({type:g("image"),data:l,mimeType:c(),annotations:Ue.optional(),_meta:z(c(),T()).optional()}),Ht=p({type:g("audio"),data:l,mimeType:c(),annotations:Ue.optional(),_meta:z(c(),T()).optional()}),Yr=p({type:g("tool_use"),name:c(),id:c(),input:z(c(),T()),_meta:z(c(),T()).optional()}),Qr=p({type:g("resource"),resource:x([St,Zt]),annotations:Ue.optional(),_meta:z(c(),T()).optional()}),Xr=_t.extend({type:g("resource_link")}),bt=x([Ze,qe,Ht,Xr,Qr]),Io=p({role:s,content:bt}),Ft=p({title:c().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),en=E.extend({method:g("notifications/tools/list_changed"),params:y.optional()}),tn=p({name:c().optional()}),on=p({hints:f(tn).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),rn=p({mode:C(["auto","required","none"]).optional()}),nn=p({type:g("boolean"),title:c().optional(),description:c().optional(),default:R().optional()}),sn=p({type:g("string"),title:c().optional(),description:c().optional(),minLength:b().optional(),maxLength:b().optional(),format:C(["email","uri","date","date-time"]).optional(),default:c().optional()}),an=p({type:C(["number","integer"]),title:c().optional(),description:c().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),cn=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),default:c().optional()}),ln=p({type:g("string"),title:c().optional(),description:c().optional(),oneOf:f(p({const:c(),title:c()})),default:c().optional()}),un=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),enumNames:f(c()).optional(),default:c().optional()}),dn=x([cn,ln]),pn=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:g("string"),enum:f(c())}),default:f(c()).optional()}),hn=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:f(p({const:c(),title:c()}))}),default:f(c()).optional()}),mn=x([pn,hn]),fn=x([un,dn,mn]),gn=x([fn,nn,sn,an]),Vt=_.extend({mode:g("form").optional(),message:c(),requestedSchema:p({type:g("object"),properties:z(c(),gn),required:f(c()).optional()}).catchall(T())}),Jt=p({type:g("ref/resource"),uri:c()}),Bt=p({type:g("ref/prompt"),name:c()}),Sn=p({uri:c().startsWith("file://"),name:c().optional(),_meta:z(c(),T()).optional()}),yt=ee.shape,_n=p({experimental:yt.experimental,sampling:yt.sampling,elicitation:yt.elicitation,roots:yt.roots,extensions:yt.extensions}),Ce=Xe.shape,Oo=p({experimental:Ce.experimental,logging:Ce.logging,completions:Ce.completions,prompts:Ce.prompts,resources:Ce.resources,tools:Ce.tools,extensions:Ce.extensions}),Mo=k({progressToken:o.optional(),[lo]:c(),[yr]:G.optional(),[uo]:_n,[vr]:a.optional()}),Wt=p({...H.shape,...I.shape,description:c().optional(),inputSchema:k({$schema:c().optional(),type:g("object")}),outputSchema:k({$schema:c().optional()}).optional(),annotations:Ft.optional(),_meta:z(c(),T()).optional()}),bn=p({type:g("tool_result"),toolUseId:c(),content:f(bt),structuredContent:T().optional(),isError:R().optional(),_meta:z(c(),T()).optional()}),qo=x([Ze,qe,Ht,Yr,bn]),Kt=p({role:s,content:x([qo,f(qo)]),_meta:z(c(),T()).optional()}),No=c(),Ao=k({[Nt]:G.optional().catch(void 0)}),jo=Ao.optional();function ae(Q){return k({_meta:jo,resultType:No.default("complete"),...Q})}let yn=ae({}),ba=ae({nextCursor:r.optional()}),Lo=ae({content:f(bt),structuredContent:T().optional(),isError:R().optional()}),vn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),tools:f(Wt),nextCursor:r.optional()}),zn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),prompts:f(Dt),nextCursor:r.optional()}),Rn=ae({description:c().optional(),messages:f(Io)}),wn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),resources:f(_t),nextCursor:r.optional()}),xn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:f(Eo),nextCursor:r.optional()}),Tn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),contents:f(x([St,Zt]))}),Pn=ae({completion:p({values:f(c()).max(100),total:b().int().optional(),hasMore:R().optional()}).loose()}),ya=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"])}),En=ae({ttlMs:b().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:f(c()),capabilities:Oo,instructions:c().optional()}),vt=p({messages:f(Kt),modelPreferences:on.optional(),systemPrompt:c().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:f(c()).optional(),metadata:t.optional(),tools:f(Wt).optional(),toolChoice:rn.optional()}),kn=p({method:g("sampling/createMessage"),params:vt}),$n=p({method:g("roots/list"),params:p({_meta:z(c(),T()).optional()}).optional()}),Cn=p({...Kt.shape,model:c(),stopReason:c().optional()}),In=p({roots:f(Sn)}),On=p({action:C(["accept","decline","cancel"]),content:z(c(),x([c(),b(),R(),f(c())])).optional()}),Mn=p({mode:g("url"),message:c(),url:c().url()}),qn=x([Vt,Mn]),Nn=p({method:g("elicitation/create"),params:qn}),An=x([kn,$n,Nn]),jn=x([Cn,In,On]),Ln=z(c(),An),Un=z(c(),jn),Gt=ae({inputRequests:Ln.optional(),requestState:c().optional()}),Yt={inputResponses:Un.optional(),requestState:c().optional()},va=p({_meta:Mo,...Yt}),za=k({progressToken:o.optional()});function ve(Q,Xt){return p({method:g(Q),params:p({_meta:Mo,...Xt})})}function ze(Q,Xt){return p({method:g(Q),params:p({_meta:za.optional(),...Xt}).optional()})}let Zn={name:c(),arguments:z(c(),T()).optional(),...Yt},Ne={cursor:r.optional()},Ra=ve("tools/call",Zn),wa=ve("tools/list",Ne),xa=ve("prompts/list",Ne),Ta=ve("prompts/get",{name:c(),arguments:z(c(),c()).optional(),...Yt}),Pa=ve("resources/list",Ne),Ea=ve("resources/templates/list",Ne),ka=ve("resources/read",{uri:c(),...Yt}),Dn={ref:x([Bt,Jt]),argument:p({name:c(),value:c()}),context:p({arguments:z(c(),c()).optional()}).optional()},$a=ve("completion/complete",Dn),Ca=ve("server/discover",{}),Uo=p({toolsListChanged:R().optional(),promptsListChanged:R().optional(),resourcesListChanged:R().optional(),resourceSubscriptions:f(c()).optional()}),Hn={notifications:Uo},Ia=ve("subscriptions/listen",Hn),Oa=Ao.extend({"io.modelcontextprotocol/subscriptionId":n}),Fn=k({_meta:Oa,resultType:No.default("complete")}),zt={"tools/call":ze("tools/call",Zn),"tools/list":ze("tools/list",Ne),"prompts/get":ze("prompts/get",{name:c(),arguments:z(c(),c()).optional()}),"prompts/list":ze("prompts/list",Ne),"resources/list":ze("resources/list",Ne),"resources/templates/list":ze("resources/templates/list",Ne),"resources/read":ze("resources/read",{uri:c()}),"completion/complete":ze("completion/complete",Dn),"server/discover":ze("server/discover",{}),"subscriptions/listen":ze("subscriptions/listen",Hn)};function Se(Q){return k({_meta:jo,...Q})}let Ma={"tools/call":Se({content:f(bt),structuredContent:T().optional(),isError:R().optional()}),"tools/list":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),tools:f(Wt),nextCursor:r.optional()}),"prompts/get":Se({description:c().optional(),messages:f(Io)}),"prompts/list":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),prompts:f(Dt),nextCursor:r.optional()}),"resources/list":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),resources:f(_t),nextCursor:r.optional()}),"resources/templates/list":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:f(Eo),nextCursor:r.optional()}),"resources/read":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),contents:f(x([St,Zt]))}),"completion/complete":Se({completion:p({values:f(c()).max(100),total:b().int().optional(),hasMore:R().optional()}).loose()}),"server/discover":Se({ttlMs:b().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:f(c()),capabilities:Oo,instructions:c().optional()}),"subscriptions/listen":Se({})},Qt=k({"io.modelcontextprotocol/subscriptionId":n.optional()}),Zo=p({method:g("notifications/subscriptions/acknowledged"),params:p({_meta:Qt.optional(),notifications:Uo})}),Do=p({_meta:Qt.optional(),requestId:n,reason:c().optional()}),Ho=p({method:g("notifications/cancelled"),params:Do}),ru={"notifications/cancelled":Ho,"notifications/progress":Ut,"notifications/message":Gr,"notifications/resources/updated":ko,"notifications/resources/list_changed":et,"notifications/tools/list_changed":en,"notifications/prompts/list_changed":Co,"notifications/subscriptions/acknowledged":Zo},pe=Q=>p({jsonrpc:g("2.0"),id:x([c(),b().int()]),result:Q}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:a,TaskMetadataSchema:u,RelatedTaskMetadataSchema:d,RequestMetaSchema:m,BaseRequestParamsSchema:S,TaskAugmentedRequestParamsSchema:_,NotificationsParamsSchema:y,NotificationSchema:E,IconSchema:$,IconsSchema:I,BaseMetadataSchema:H,ImplementationSchema:G,ClientTasksCapabilitySchema:J,ServerTasksCapabilitySchema:V,ClientCapabilitiesSchema:ee,ServerCapabilitiesSchema:Xe,ProgressSchema:de,ProgressNotificationParamsSchema:gt,ProgressNotificationSchema:Ut,LoggingMessageNotificationParamsSchema:Kr,LoggingMessageNotificationSchema:Gr,ResourceContentsSchema:Po,TextResourceContentsSchema:St,BlobResourceContentsSchema:Zt,AnnotationsSchema:Ue,ResourceSchema:_t,ResourceTemplateSchema:Eo,ResourceListChangedNotificationSchema:et,ResourceUpdatedNotificationParamsSchema:tt,ResourceUpdatedNotificationSchema:ko,PromptArgumentSchema:$o,PromptSchema:Dt,PromptListChangedNotificationSchema:Co,TextContentSchema:Ze,ImageContentSchema:qe,AudioContentSchema:Ht,ToolUseContentSchema:Yr,EmbeddedResourceSchema:Qr,ResourceLinkSchema:Xr,ContentBlockSchema:bt,PromptMessageSchema:Io,ToolAnnotationsSchema:Ft,ToolListChangedNotificationSchema:en,ModelHintSchema:tn,ModelPreferencesSchema:on,ToolChoiceSchema:rn,BooleanSchemaSchema:nn,StringSchemaSchema:sn,NumberSchemaSchema:an,UntitledSingleSelectEnumSchemaSchema:cn,TitledSingleSelectEnumSchemaSchema:ln,LegacyTitledEnumSchemaSchema:un,SingleSelectEnumSchemaSchema:dn,UntitledMultiSelectEnumSchemaSchema:pn,TitledMultiSelectEnumSchemaSchema:hn,MultiSelectEnumSchemaSchema:mn,EnumSchemaSchema:fn,PrimitiveSchemaDefinitionSchema:gn,ElicitRequestFormParamsSchema:Vt,ResourceTemplateReferenceSchema:Jt,PromptReferenceSchema:Bt,RootSchema:Sn,ClientCapabilities2026Schema:_n,ServerCapabilities2026Schema:Oo,RequestMetaEnvelopeSchema:Mo,ToolSchema:Wt,ToolResultContentSchema:bn,SamplingMessageContentBlockSchema:qo,SamplingMessageSchema:Kt,ResultTypeSchema:No,ResultMetaSchema:Ao,ResultSchema:yn,PaginatedResultSchema:ba,CallToolResultSchema:Lo,ListToolsResultSchema:vn,ListPromptsResultSchema:zn,GetPromptResultSchema:Rn,ListResourcesResultSchema:wn,ListResourceTemplatesResultSchema:xn,ReadResourceResultSchema:Tn,CompleteResultSchema:Pn,CacheableResultSchema:ya,DiscoverResultSchema:En,CreateMessageRequestParamsSchema:vt,CreateMessageRequestSchema:kn,ListRootsRequestSchema:$n,CreateMessageResultSchema:Cn,ListRootsResultSchema:In,ElicitResultSchema:On,ElicitRequestURLParamsSchema:Mn,ElicitRequestParamsSchema:qn,ElicitRequestSchema:Nn,InputRequestSchema:An,InputResponseSchema:jn,InputRequestsSchema:Ln,InputResponsesSchema:Un,InputRequiredResultSchema:Gt,InputResponseRequestParamsSchema:va,CallToolRequestSchema:Ra,ListToolsRequestSchema:wa,ListPromptsRequestSchema:xa,GetPromptRequestSchema:Ta,ListResourcesRequestSchema:Pa,ListResourceTemplatesRequestSchema:Ea,ReadResourceRequestSchema:ka,CompleteRequestSchema:$a,DiscoverRequestSchema:Ca,SubscriptionFilterSchema:Uo,SubscriptionsListenRequestSchema:Ia,SubscriptionsListenResultMetaSchema:Oa,SubscriptionsListenResultSchema:Fn,dispatchRequestSchemas:zt,dispatchResultSchemas:Ma,NotificationMetaSchema:Qt,SubscriptionsAcknowledgedNotificationSchema:Zo,CancelledNotificationParamsSchema:Do,CancelledNotificationSchema:Ho,notificationSchemas2026:ru,JSONRPCResultResponseSchema:pe(yn),CallToolResultResponseSchema:pe(x([Lo,Gt])),ListToolsResultResponseSchema:pe(vn),ListPromptsResultResponseSchema:pe(zn),GetPromptResultResponseSchema:pe(x([Rn,Gt])),ListResourcesResultResponseSchema:pe(wn),ListResourceTemplatesResultResponseSchema:pe(xn),ReadResourceResultResponseSchema:pe(x([Tn,Gt])),CompleteResultResponseSchema:pe(Pn),DiscoverResultResponseSchema:pe(En),SubscriptionsListenResultResponseSchema:pe(Fn)}}var lv;function jt(){return lv??=cv()}var uv=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function dv(e){return uv.includes(e)}var ff=Symbol("modelcontextprotocol.resultCacheHintFallback");function pv(e){return e[ff]}function o_(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function r_(e){return e==="public"||e==="private"}var A=(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})({}),ie=class n_ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return ke(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 ke(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===A.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new i_(n.elicitations,o)}if(t===A.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===A.InvalidParams||t===A.ResourceNotFound){let n=r;if(typeof n?.uri=="string"&&(t===A.ResourceNotFound||Object.keys(n).length===1))return new s_(n.uri,o)}if(t===A.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 ie{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(A.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},i_=class extends ie{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(A.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},a_=class extends ie{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(A.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},c_=class extends ie{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(A.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},hv=0,mv="private",fv=["tools/call","prompts/get","resources/read"];function gv(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete"||fv.includes(e))return t;throw new ie(A.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Sv(e,t){let o=pv(t);if(t.resultType!=="complete"||!dv(e))return o===void 0?t:zv(t);let r=t,n=o_(r.ttlMs)?r.ttlMs:yv(o),s=r_(r.cacheScope)?r.cacheScope:vv(o),a={...r,ttlMs:n,cacheScope:s};return delete a[ff],a}function _v(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function bv(e,t){if(t===void 0)return e;let o=e._meta;return o===void 0?{...e,_meta:{[Nt]:t}}:!_v(o)||o[Nt]!==void 0?e:{...e,_meta:{...o,[Nt]:t}}}function yv(e){return e!==void 0&&o_(e.ttlMs)?e.ttlMs:hv}function vv(e){return e!==void 0&&r_(e.cacheScope)?e.cacheScope:mv}function zv(e){let t={...e};return delete t[ff],t}var Rv=["elicitation/create","sampling/createMessage","roots/list"],Kl;function l_(){if(Kl)return Kl;let e=jt();return Kl={request:{"elicitation/create":p({method:g("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":p({method:g("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":p({method:g("roots/list"),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Kl}function u_(e){return Rv.includes(e)}function tf(e){return u_(e)?l_().request[e]:void 0}function wv(e){return u_(e)?l_().response[e]:void 0}var gf={"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(gf,e)}function h_(e){return Object.prototype.hasOwnProperty.call(d_,e)}function xv(e){return Object.prototype.hasOwnProperty.call(gf,e)}function Tv(e){return p_(e)?jt().dispatchRequestSchemas[e]:void 0}function Pv(e){return xv(e)?jt().dispatchResultSchemas[e]:void 0}function Ev(e){return h_(e)?jt().notificationSchemas2026[e]:void 0}var Dw=Object.keys(gf),Hw=Object.keys(d_);function ua(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ca(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"},$v=[lo,uo];function Cv(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(l=>ua(l)&&"execution"in l)&&(n().tools=s.map(l=>{if(!ua(l)||!("execution"in l))return l;let u={...l};return delete u.execution,u}));let a=t.capabilities;if(ua(a)&&"tasks"in a){let l={...a};delete l.tasks,n().capabilities=l}return o}var Sf={era:"2026-07-28",hasRequestMethod:p_,hasNotificationMethod:h_,hasInputRequestMethod:e=>tf(e)!==void 0,validateRequest:(e,t)=>ca(Tv(e),t),validateResult:(e,t)=>ca(Pv(e),t),validateNotification:(e,t)=>ca(Ev(e),t),validateInputRequest:(e,t)=>ca(tf(e),t),validateInputResponse:(e,t)=>ca(wv(e),t),samplingResultVariant:()=>kv,outboundEnvelope(e){return{[lo]:e.protocolVersion,[yr]:e.clientInfo,[uo]:e.clientCapabilities,...e.logLevel!==void 0&&{[vr]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of $v)r in e||t.push({key:r,problem:"missing"});let o=jt().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(a=>a.key===s&&a.problem==="missing")||t.push({key:s,problem:r.message})}return t},projectCallToolResult:e=>WS(e),inputRequestSchema:tf,decodeResult(e,t){if(!ua(t))return{kind:"invalid",error:new X(se.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new X(se.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 X(se.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let a=t.inputRequests,l=ua(a)?a:{},u=t.requestState,d=t._meta===void 0?void 0:jt().ResultMetaSchema.safeParse(t._meta),m=d?.success?d.data:void 0;return Object.keys(l).length===0&&typeof u!="string"?{kind:"invalid",error:new X(se.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:l,...typeof u=="string"&&{requestState:u},...m!==void 0&&{_meta:m}}}if(o!=="complete")return{kind:"invalid",error:new X(se.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=Iv(),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 X(se.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,o){return bv(Sv(e,gv(e,Cv(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=jt().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("; ")}`}},Gl;function Iv(){if(Gl)return Gl;let e=jt();return Gl={"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},Gl}var _f="2026-07-28";function pa(e){return e!==void 0&&BS(e)?Sf:mf}function LS(e){return e.revision!==void 0?pa(e.revision).era:e.era==="modern"?Sf.era:mf.era}function of(e){return m_.some(t=>t.hasRequestMethod(e))}function rf(e){return m_.some(t=>t.hasNotificationMethod(e))}function US(e){return e==="tasks/get"||e==="tasks/cancel"}var m_=[mf,Sf],Ov=Of({AnnotationsSchema:()=>Ke,AudioContentSchema:()=>_o,BaseMetadataSchema:()=>Be,BaseRequestParamsSchema:()=>oe,BlobResourceContentsSchema:()=>qr,BooleanSchemaSchema:()=>Lr,CallToolRequestParamsSchema:()=>Si,CallToolRequestSchema:()=>_i,CallToolResultSchema:()=>Ye,CancelTaskRequestSchema:()=>Al,CancelTaskResultSchema:()=>jl,CancelledNotificationParamsSchema:()=>xs,CancelledNotificationSchema:()=>Er,ClientCapabilitiesSchema:()=>Ps,ClientNotificationSchema:()=>Ul,ClientRequestSchema:()=>Ll,ClientResultSchema:()=>Zl,ClientTasksCapabilitySchema:()=>wl,CompatibilityCallToolResultSchema:()=>Tl,CompleteRequestParamsSchema:()=>Fi,CompleteRequestSchema:()=>Vi,CompleteResultSchema:()=>Ji,ContentBlockSchema:()=>Ee,CreateMessageRequestParamsSchema:()=>ki,CreateMessageRequestSchema:()=>$i,CreateMessageResultSchema:()=>Ci,CreateMessageResultWithToolsSchema:()=>Ii,CreateTaskResultSchema:()=>kl,CursorSchema:()=>Rr,DiscoverRequestSchema:()=>Is,DiscoverResultSchema:()=>$r,ElicitRequestFormParamsSchema:()=>zo,ElicitRequestParamsSchema:()=>Ai,ElicitRequestSchema:()=>ji,ElicitRequestURLParamsSchema:()=>Ni,ElicitResultSchema:()=>Zi,ElicitationCompleteNotificationParamsSchema:()=>Li,ElicitationCompleteNotificationSchema:()=>Ui,EmbeddedResourceSchema:()=>ht,EmptyResultSchema:()=>We,EnumSchemaSchema:()=>qi,GetPromptRequestParamsSchema:()=>ai,GetPromptRequestSchema:()=>ci,GetPromptResultSchema:()=>di,GetTaskPayloadRequestSchema:()=>Ol,GetTaskPayloadResultSchema:()=>Ml,GetTaskRequestSchema:()=>Cl,GetTaskResultSchema:()=>Il,IconSchema:()=>Ts,IconsSchema:()=>lt,ImageContentSchema:()=>So,ImplementationSchema:()=>Pe,InitializeRequestParamsSchema:()=>Es,InitializeRequestSchema:()=>ks,InitializeResultSchema:()=>$s,InitializedNotificationSchema:()=>Cs,JSONArraySchema:()=>zl,JSONObjectSchema:()=>B,JSONRPCErrorResponseSchema:()=>mo,JSONRPCMessageSchema:()=>ct,JSONRPCNotificationSchema:()=>Pr,JSONRPCRequestSchema:()=>Tr,JSONRPCResponseSchema:()=>Rl,JSONRPCResultResponseSchema:()=>ho,JSONValueSchema:()=>at,LegacyTitledEnumSchemaSchema:()=>Dr,ListChangedOptionsBaseSchema:()=>Pl,ListPromptsRequestSchema:()=>si,ListPromptsResultSchema:()=>ii,ListResourceTemplatesRequestSchema:()=>Ls,ListResourceTemplatesResultSchema:()=>Us,ListResourcesRequestSchema:()=>As,ListResourcesResultSchema:()=>js,ListRootsRequestSchema:()=>Wi,ListRootsResultSchema:()=>Ki,ListTasksRequestSchema:()=>ql,ListTasksResultSchema:()=>Nl,ListToolsRequestSchema:()=>fi,ListToolsResultSchema:()=>gi,LoggingLevelSchema:()=>jr,LoggingMessageNotificationParamsSchema:()=>zi,LoggingMessageNotificationSchema:()=>bo,ModelHintSchema:()=>Ri,ModelPreferencesSchema:()=>wi,MultiSelectEnumSchemaSchema:()=>Mi,NotificationSchema:()=>ne,NotificationsParamsSchema:()=>ue,NumberSchemaSchema:()=>vo,PaginatedRequestParamsSchema:()=>qs,PaginatedRequestSchema:()=>ut,PaginatedResultSchema:()=>dt,PingRequestSchema:()=>Cr,PrimitiveSchemaDefinitionSchema:()=>Vr,ProgressNotificationParamsSchema:()=>Ms,ProgressNotificationSchema:()=>Ir,ProgressSchema:()=>Os,ProgressTokenSchema:()=>zr,PromptArgumentSchema:()=>ri,PromptListChangedNotificationSchema:()=>pi,PromptMessageSchema:()=>ui,PromptReferenceSchema:()=>Hi,PromptSchema:()=>ni,ReadResourceRequestParamsSchema:()=>Zs,ReadResourceRequestSchema:()=>Ds,ReadResourceResultSchema:()=>Hs,RelatedTaskMetadataSchema:()=>ws,RequestIdSchema:()=>Te,RequestMetaSchema:()=>wr,RequestSchema:()=>W,ResourceContentsSchema:()=>Or,ResourceLinkSchema:()=>mt,ResourceListChangedNotificationSchema:()=>Fs,ResourceRequestParamsSchema:()=>fo,ResourceSchema:()=>Nr,ResourceTemplateReferenceSchema:()=>Di,ResourceTemplateSchema:()=>Ns,ResourceUpdatedNotificationParamsSchema:()=>ti,ResourceUpdatedNotificationSchema:()=>oi,ResultMetaObjectSchema:()=>xr,ResultSchema:()=>K,RoleSchema:()=>pt,RootSchema:()=>Bi,RootsListChangedNotificationSchema:()=>Gi,SamplingContentSchema:()=>Pi,SamplingMessageContentBlockSchema:()=>qt,SamplingMessageSchema:()=>Ei,ServerCapabilitiesSchema:()=>kr,ServerNotificationSchema:()=>Hl,ServerRequestSchema:()=>Dl,ServerResultSchema:()=>Fl,ServerTasksCapabilitySchema:()=>xl,SetLevelRequestParamsSchema:()=>yi,SetLevelRequestSchema:()=>vi,SingleSelectEnumSchemaSchema:()=>Oi,StringSchemaSchema:()=>yo,SubscribeRequestParamsSchema:()=>Vs,SubscribeRequestSchema:()=>Js,SubscriptionFilterSchema:()=>Ar,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Ys,SubscriptionsAcknowledgedNotificationSchema:()=>Qs,SubscriptionsListenRequestParamsSchema:()=>Ks,SubscriptionsListenRequestSchema:()=>Gs,SubscriptionsListenResultMetaSchema:()=>Xs,SubscriptionsListenResultSchema:()=>ei,TaskAugmentedRequestParamsSchema:()=>At,TaskCreationParamsSchema:()=>El,TaskMetadataSchema:()=>Rs,TaskSchema:()=>ft,TaskStatusNotificationParamsSchema:()=>Qi,TaskStatusNotificationSchema:()=>$l,TaskStatusSchema:()=>Yi,TextContentSchema:()=>go,TextResourceContentsSchema:()=>Mr,TitledMultiSelectEnumSchemaSchema:()=>Fr,TitledSingleSelectEnumSchemaSchema:()=>Zr,ToolAnnotationsSchema:()=>hi,ToolChoiceSchema:()=>xi,ToolExecutionSchema:()=>mi,ToolListChangedNotificationSchema:()=>bi,ToolResultContentSchema:()=>Ti,ToolSchema:()=>Ge,ToolUseContentSchema:()=>li,UnsubscribeRequestParamsSchema:()=>Bs,UnsubscribeRequestSchema:()=>Ws,UntitledMultiSelectEnumSchemaSchema:()=>Hr,UntitledSingleSelectEnumSchemaSchema:()=>Ur});var f_=e=>Tr.safeParse(e).success,g_=e=>Pr.safeParse(e).success,lf=e=>ho.safeParse(e).success,S_=e=>mo.safeParse(e).success;var da=-32020,Fw=[{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:[A.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:[da,A.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:[A.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:[A.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:[A.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:[da],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:[A.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:[da],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."}],Vw={[A.ParseError]:400,[A.InvalidRequest]:400,[A.MethodNotFound]:404,[A.UnsupportedProtocolVersion]:400,[A.MissingRequiredClientCapability]:400,[da]:400};function bf(e,t){return ds(e,t)}function la(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function uf(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,df="draft-2020-12";function Mv(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:df});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=ao(e,{target:df,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 qv(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function nf(e,t){let o=await e["~standard"].validate(t);return o.issues&&o.issues.length>0?{success:!1,error:o.issues.map(r=>qv(r)).join(", ")}:{success:!0,data:o.value}}function Nv(e){let t=ao(e,{target:df,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var Av=/\\\.\\d\{(\d+)\}/;function jv(e){let t=Av.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=>xe.datetime({local:r,offset:n,precision:s}))))}function Lv(e,t){let o;switch(e){case"email":o=[Gc()];break;case"uri":o=[fr()];break;case"date":o=[xe.date()];break;case"date-time":o=jv(t);break}return new Set(o.map(r=>Nv(r)).filter(r=>r!==void 0))}function Uv(e,t,o){return o!=="zod"?!0:Lv(e,t).has(t)}function ha(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Zv(e){try{return Mv(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new ie(A.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var Dv=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function yf(e){return Dv.has(e)||e.startsWith("x-")}var Hv=new Set(["$schema",...Object.keys(zo.shape.requestedSchema.shape)]),DS={string:la([yo,Ur,Zr,Dr]),number:la([vo]),integer:la([vo]),boolean:la([Lr]),array:la([Hr,Fr])},Fv=new Set(yo.shape.format.unwrap().options);function Vv(e,t,o,r){if(!ha(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[a,l]of Object.entries(e))n.has(a)||yf(a)?s[a]=l:a==="pattern"&&e.type==="string"&&typeof e.format=="string"?Fv.has(e.format)?(typeof l!="string"||!Uv(e.format,l,o))&&r.push(`${t}.${a}`):s[a]=l:r.push(`${t}.${a}`);return s}function Jv(e,t){let o={},r=[];for(let[n,s]of Object.entries(e))n==="properties"&&ha(s)?o[n]=Object.fromEntries(Object.entries(s).map(([a,l])=>[a,Vv(l,`properties.${a}`,t,r)])):Hv.has(n)?o[n]=s:yf(n)||r.push(n);if(r.length>0)throw new ie(A.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function Bv(e,t){if(!ha(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!bf(Vr,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function pf(e,t,o=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((r,n)=>pf(r,t[n],`${o}[${n}]`)):!ha(e)||!ha(t)?[]:Object.entries(e).flatMap(([r,n])=>{let s=o?`${o}.${r}`:r;return Object.prototype.hasOwnProperty.call(t,r)?pf(n,t[r],s):yf(r)?[]:[s]})}function Wv(e){if(!uf(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=Jv(Zv(e.requestedSchema),t),r=bf(zo.shape.requestedSchema,o);if(!r.success)throw new ie(A.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Bv(o,r.error.message)}`);let n=pf(o,r.data);if(n.length>0)throw new ie(A.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(r.data.required??[]).filter(a=>!Object.prototype.hasOwnProperty.call(r.data.properties,a));if(s.length>0)throw new ie(A.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${s.join(", ")}`);return{...e,mode:"form",requestedSchema:r.data}}function Kv(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 Jw=Object.assign(Kv,{elicit(e){try{return{method:"elicitation/create",params:Wv(e)}}catch(t){throw t instanceof ie?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 Gv=["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"],Yv={IdJagTokenExchangeResponseSchema:ra,OAuthClientInformationFullSchema:aa,OAuthClientInformationSchema:ia,OAuthClientMetadataSchema:sa,OAuthClientRegistrationErrorSchema:Vl,OAuthErrorResponseSchema:na,OAuthMetadataSchema:Jr,OAuthProtectedResourceMetadataSchema:Xi,OAuthTokenRevocationRequestSchema:Jl,OAuthTokensSchema:oa,OpenIdProviderDiscoveryMetadataSchema:ta,OpenIdProviderMetadataSchema:ea},b_={},y_={};function v_(e,t){let o=e.slice(0,-6);b_[o]=t,y_[o]=r=>t.safeParse(r).success}for(let e of Gv)v_(e,Ov[e]);for(let[e,t]of Object.entries(Yv))v_(e,t);var Qv=Object.freeze(b_),Xv=Object.freeze(y_);function ez(e){switch(e){case"initialize":case"notifications/initialized":return pa(void 0);case"server/discover":return pa(_f);default:return}}var z_=6e4,tz=[lo,yr,uo,vr],oz=["inputResponses","requestState"];function HS(e,t){let o=e.params;if(!sf(o))return{message:e,lifted:{}};let r=o._meta,n=sf(r)?tz.filter(u=>u in r):[],s=t==="request"?oz.filter(u=>u in o):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let a={},l={...o};if(n.length>0&&sf(r)){let u={},d={...r};for(let m of n)u[m]=r[m],delete d[m];a.envelope=u,Object.keys(d).length>0?l._meta=d:delete l._meta}for(let u of s)u==="inputResponses"&&(a.inputResponses=l[u]),u==="requestState"&&(a.requestState=l[u]),delete l[u];return{message:{...e,params:l},lifted:a}}function FS(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 R_(e){return()=>e}var rz=R_(void 0),nz,ma=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{nz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??bl,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 X(se.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 X(se.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),lf(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 X(se.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}=HS(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=LS(t.classification);if(a!==r.era){this._onerror(new Error(`Era mismatch on inbound notification '${o.method}': classified as ${a} but this instance serves ${r.era}`));return}}if(rf(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(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:o,lifted:r}=HS(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,a=($,I,H)=>{let G={jsonrpc:"2.0",id:o.id,error:{code:$,message:I,...H!==void 0&&{data:H}}};s?.send(G).catch(U=>this._onerror(new Error(`Failed to send an error response: ${U}`)))};if(t?.classification!==void 0){let $=LS(t.classification);if($!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${o.method}': classified as ${$} but this instance serves ${n.era}`));let I=t.classification.revision??$;a(A.UnsupportedProtocolVersion,`Unsupported protocol version: ${I}`,{supported:this._supportedProtocolVersions,requested:I});return}}if(of(o.method)&&!n.hasRequestMethod(o.method)&&!(US(o.method)&&this._customSchemaRequestMethods.has(o.method))){a(A.MethodNotFound,"Method not found");return}let l=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(l===void 0){a(A.MethodNotFound,"Method not found");return}let u=n.checkInboundEnvelope(r);if(u!==void 0){a(A.InvalidParams,u);return}let d=($,I)=>this._notificationViaCodec(this._resolveOutboundCodec($.method),$,{...I,relatedRequestId:o.id}),m=($,I,H)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec($.method),$,I,{...H,relatedRequestId:o.id}),S=new AbortController;this._requestHandlerAbortControllers.set(o.id,S);let _=r.inputResponses===void 0?void 0:sz(r.inputResponses),y={sessionId:s?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},..._!==void 0&&{inputResponses:_.accepted},..._!==void 0&&_.droppedKeys.length>0&&{droppedInputResponseKeys:_.droppedKeys},requestState:r.requestState===void 0?rz:R_(r.requestState),signal:S.signal,send:(($,I,H)=>{let G=this._resolveOutboundCodec($.method);if(this._assertOutboundRequestInEra(G,$.method),uf(I))return m($,I,H);let U=FS(G,$.method);if(U===void 0)throw new TypeError(`'${$.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return m($,U,I)}),notify:d},http:t?.authInfo?{authInfo:t.authInfo}:void 0},E=this.buildContext(y,t);Promise.resolve().then(()=>l(o,E)).then(async $=>{if(S.signal.aborted)return;let I;try{I=n.encodeResult(o.method,$,this._outboundServerInfo())}catch(G){this._onerror(new Error(`Failed to encode result for ${o.method}: ${G}`)),a(A.InternalError,"Internal error");return}let H={result:I,jsonrpc:"2.0",id:o.id};await s?.send(H)},async $=>{if(S.signal.aborted)return;let I=Number.isSafeInteger($.code)?$.code:A.InternalError,H={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(I),message:$.message??"Internal error",...$.data!==void 0&&{data:$.data}}};await s?.send(H)}).catch($=>this._onerror(new Error(`Failed to send response: ${$}`))).finally(()=>{this._requestHandlerAbortControllers.get(o.id)===S&&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),a=this._timeoutInfo.get(r);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(l){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),s(l);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),lf(e)?o(e):o(ie.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(uf(t))return US(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,o);this._assertOutboundRequestInEra(r,e.method);let n=FS(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 pa(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=ez(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(of(t)&&!e.hasRequestMethod(t))throw new X(se.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:a,headers:l}=r??{},u=Date.now(),d,m;return new Promise((S,_)=>{let y=V=>{_(V)};if(!this._transport){y(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(V){y(V);return}if(r?.signal?.aborted){let V=r.signal.reason;throw V instanceof X?V:new X(se.RequestTimeout,String(V))}let E=e.era===_f&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,$=this._requestMessageId++;m=$;let I={...t,jsonrpc:"2.0",id:$};r?.onprogress&&(this._progressHandlers.set($,r.onprogress),I.params={...t.params,_meta:{...t.params?._meta,progressToken:$}});let H=this._envelopeOutbound(I),G=!1,U=V=>{G||(this._progressHandlers.delete($),E===void 0?t.method!=="initialize"&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:$,reason:String(V)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:a}).catch(ee=>this._onerror(new Error(`Failed to send cancellation: ${ee}`))):E.abort(),_(V instanceof X?V:new X(se.RequestTimeout,String(V))))};this._responseHandlers.set($,V=>{if(r?.signal?.aborted)return;if(G=!0,V instanceof Error)return _(V);let ee;try{ee=e.decodeResult(t.method,V.result)}catch(de){return _(de instanceof Error?de:new Error(String(de)))}if(ee.kind==="invalid")return _(ee.error);if(ee.kind==="input_required"){if(r?.allowInputRequired===!0)return S(iz(ee));let de={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:u,retry:(gt,Ut)=>this._requestWithSchemaViaCodec(e,gt===void 0?{method:t.method}:{method:t.method,params:gt},o,Ut)};return S(this._resolveNonCompleteResult(ee,de))}let Xe=ee.result;nf(o,Xe).then(de=>{de.success?S(de.data):_(new X(se.InvalidResult,`Invalid result for ${t.method}: ${de.error}`))},_)}),d=()=>U(r?.signal?.reason),r?.signal?.addEventListener("abort",d,{once:!0});let j=r?.timeout??z_,J=()=>U(new X(se.RequestTimeout,"Request timed out",{timeout:j}));this._setupTimeout($,j,r?.maxTotalTimeout,J,r?.resetTimeoutOnProgress??!1),this._transport.send(H,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:a,headers:l,requestSignal:E?.signal}).catch(V=>{this._progressHandlers.delete($),_(V)})}).finally(()=>{d&&r?.signal?.removeEventListener("abort",d),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 X(se.NotConnected,"Not connected");if(rf(t.method)&&!e.hasNotificationMethod(t.method))throw new X(se.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(!of(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,s)=>{let a=this._negotiatedWireCodec(),l=a.validateRequest(e,n);if(!l.ok&&l.reason==="not-in-era"&&(l=a.validateInputRequest(e,n)),!l.ok)throw l.reason==="not-in-era"?new ie(A.InternalError,`No wire schema for ${e} in the resolved era`):new Error(l.message);return Promise.resolve(t(l.value,s))}}else if(o)r=async(n,s)=>{let a=await nf(t.params,{...n.params});if(!a.success)throw new ie(A.InvalidParams,`Invalid params for ${e}: ${a.error}`);return o(a.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(!rf(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 ie(A.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 nf(t.params,{...r.params});if(!n.success)throw new ie(A.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function sf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function VS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sz(e){let t={},o=[];if(!VS(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!VS(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function iz(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var az=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(l){if(!l)throw new TypeError("argument string is required");var u=typeof l=="object"?s(l):l;if(typeof u!="string")throw new TypeError("argument string is required to be a string");var d=u.indexOf(";"),m=d!==-1?u.slice(0,d).trim():u.trim();if(!r.test(m))throw new TypeError("invalid media type");var S=new a(m.toLowerCase());if(d!==-1){var _,y,E;for(t.lastIndex=d;y=t.exec(u);){if(y.index!==d)throw new TypeError("invalid parameter format");d+=y[0].length,_=y[1].toLowerCase(),E=y[2],E.charCodeAt(0)===34&&(E=E.slice(1,-1),E.indexOf("\\")!==-1&&(E=E.replace(o,"$1"))),S.parameters[_]=E}if(d!==u.length)throw new TypeError("invalid parameter format")}return S}function s(l){var u;if(typeof l.getHeader=="function"?u=l.getHeader("content-type"):typeof l.headers=="object"&&(u=l.headers&&l.headers["content-type"]),typeof u!="string")throw new TypeError("content-type header is missing from object");return u}function a(l){this.parameters=Object.create(null),this.type=l}})),Bw=Mf(az(),1);var cz=10*1024*1024;var nx=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 lz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,uz=[0,31,28,31,30,31,30,31,31,30,31,30,31],dz=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,pz=/^(?=.{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,hz=/^(?:[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,mz=/^(?:(?:[^\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,fz=/^(?:(?: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,gz=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,Sz=/^(?:\/(?:[^~/]|~0|~1)*)*$/,_z=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,bz=/^(?: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))},vz=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,zz=/^((([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,Rz=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 Qe(e){return e.test.bind(e)}var sx={date:w_,time:x_.bind(void 0,!1),"date-time":Tz,duration:Rz,uri:kz,"uri-reference":Qe(hz),"uri-template":Qe(mz),url:Qe(fz),email:yz,hostname:Qe(pz),ipv4:Qe(vz),ipv6:Qe(zz),regex:Cz,uuid:Qe(gz),"json-pointer":Qe(Sz),"json-pointer-uri-fragment":Qe(_z),"relative-json-pointer":Qe(bz)};function wz(e){return e%4===0&&(e%100!==0||e%400===0)}function w_(e){let t=e.match(lz);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:uz[r])}function x_(e,t){let o=t.match(dz);if(!o)return!1;let r=+o[1],n=+o[2],s=+o[3],a=!!o[5];return(r<=23&&n<=59&&s<=59||r==23&&n==59&&s==60)&&(!e||a)}var xz=/t|\s/i;function Tz(e){let t=e.split(xz);return t.length==2&&w_(t[0])&&x_(!0,t[1])}var Pz=/\/|:/,Ez=/^(?:[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)&&Ez.test(e)}var $z=/[^\\]\\Z/;function Cz(e){if($z.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var Oz;Oz=globalThis.crypto;var fa=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return ke(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 ke(this,e)}constructor(e){super(e),this.name=new.target.name,Ro(this,new.target)}},Xx=class extends fa{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}},eT=class extends fa{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}},tT=class extends fa{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}},oT=class extends fa{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}},rT=class extends fa{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 nT=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return ke(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 ke(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",Ro(this,new.target)}};var sT=Symbol.for("mcp.authSeamEscape");var iT=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return ke(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 ke(this,e)}constructor(e,t,o){super(`SSE error: ${t}`),this.code=e,this.event=o,Ro(this,new.target)}};var vf=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}},zf=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)}},T_=new Set;function P_(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!="string")return;let s=n.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";T_.has(a)||(T_.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${s}", { params: Schema.shape.params }, handler).`));let l=r;return[s,{params:n.params},e==="request"?(u,d)=>l({method:s,params:u},Mz(d)):u=>l({method:s,params:u})]}function Mz(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 qz="2026-01-26";var Nz="ui/notifications/tool-input-partial";var Rf=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=ct.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!==Nz&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},Az=i.union([i.literal("light"),i.literal("dark")]).describe("Color theme preference for the host environment."),ga=i.union([i.literal("inline"),i.literal("fullscreen"),i.literal("pip")]).describe("Display mode for UI presentation."),jz=i.union([i.literal("--color-background-primary"),i.literal("--color-background-secondary"),i.literal("--color-background-tertiary"),i.literal("--color-background-inverse"),i.literal("--color-background-ghost"),i.literal("--color-background-info"),i.literal("--color-background-danger"),i.literal("--color-background-success"),i.literal("--color-background-warning"),i.literal("--color-background-disabled"),i.literal("--color-text-primary"),i.literal("--color-text-secondary"),i.literal("--color-text-tertiary"),i.literal("--color-text-inverse"),i.literal("--color-text-ghost"),i.literal("--color-text-info"),i.literal("--color-text-danger"),i.literal("--color-text-success"),i.literal("--color-text-warning"),i.literal("--color-text-disabled"),i.literal("--color-border-primary"),i.literal("--color-border-secondary"),i.literal("--color-border-tertiary"),i.literal("--color-border-inverse"),i.literal("--color-border-ghost"),i.literal("--color-border-info"),i.literal("--color-border-danger"),i.literal("--color-border-success"),i.literal("--color-border-warning"),i.literal("--color-border-disabled"),i.literal("--color-ring-primary"),i.literal("--color-ring-secondary"),i.literal("--color-ring-inverse"),i.literal("--color-ring-info"),i.literal("--color-ring-danger"),i.literal("--color-ring-success"),i.literal("--color-ring-warning"),i.literal("--font-sans"),i.literal("--font-mono"),i.literal("--font-weight-normal"),i.literal("--font-weight-medium"),i.literal("--font-weight-semibold"),i.literal("--font-weight-bold"),i.literal("--font-text-xs-size"),i.literal("--font-text-sm-size"),i.literal("--font-text-md-size"),i.literal("--font-text-lg-size"),i.literal("--font-heading-xs-size"),i.literal("--font-heading-sm-size"),i.literal("--font-heading-md-size"),i.literal("--font-heading-lg-size"),i.literal("--font-heading-xl-size"),i.literal("--font-heading-2xl-size"),i.literal("--font-heading-3xl-size"),i.literal("--font-text-xs-line-height"),i.literal("--font-text-sm-line-height"),i.literal("--font-text-md-line-height"),i.literal("--font-text-lg-line-height"),i.literal("--font-heading-xs-line-height"),i.literal("--font-heading-sm-line-height"),i.literal("--font-heading-md-line-height"),i.literal("--font-heading-lg-line-height"),i.literal("--font-heading-xl-line-height"),i.literal("--font-heading-2xl-line-height"),i.literal("--font-heading-3xl-line-height"),i.literal("--border-radius-xs"),i.literal("--border-radius-sm"),i.literal("--border-radius-md"),i.literal("--border-radius-lg"),i.literal("--border-radius-xl"),i.literal("--border-radius-full"),i.literal("--border-width-regular"),i.literal("--shadow-hairline"),i.literal("--shadow-sm"),i.literal("--shadow-md"),i.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Lz=i.record(jz.describe(`Style variables for theming MCP apps.
65
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let a of e.seen.entries()){let l=a[1];if(t===a[0]){s(a);continue}if(e.external){let d=e.external.registry.get(a[0])?.id;if(t!==a[0]&&d){s(a);continue}}if(e.metadataRegistry.get(a[0])?.id){s(a);continue}if(l.cycle){s(a);continue}if(l.count>1&&e.reused==="ref"){s(a);continue}}}function It(e,t){let o=e.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=l=>{let u=e.seen.get(l);if(u.ref===null)return;let d=u.def??u.schema,m={...d},S=u.ref;if(u.ref=null,S){r(S);let y=e.seen.get(S),E=y.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(d.allOf=d.allOf??[],d.allOf.push(E)):Object.assign(d,E),Object.assign(d,m),l._zod.parent===S)for(let I in d)I==="$ref"||I==="allOf"||I in m||delete d[I];if(E.$ref&&y.def)for(let I in d)I==="$ref"||I==="allOf"||I in y.def&&JSON.stringify(d[I])===JSON.stringify(y.def[I])&&delete d[I]}let _=l._zod.parent;if(_&&_!==S){r(_);let y=e.seen.get(_);if(y?.schema.$ref&&(d.$ref=y.schema.$ref,y.def))for(let E in d)E==="$ref"||E==="allOf"||E in y.def&&JSON.stringify(d[E])===JSON.stringify(y.def[E])&&delete d[E]}e.override({zodSchema:l,jsonSchema:d,path:u.path??[]})};for(let l of[...e.seen.entries()].reverse())r(l[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 l=e.external.registry.get(t)?.id;if(!l)throw new Error("Schema is missing an `id` property");n.$id=e.external.uri(l)}Object.assign(n,o.def??o.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&n.id===s&&delete n.id;let a=e.external?.defs??{};for(let l of e.seen.entries()){let u=l[1];u.def&&u.defId&&(u.def.id===u.defId&&delete u.def.id,a[u.defId]=u.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?n.$defs=a:n.definitions=a);try{let l=JSON.parse(JSON.stringify(n));return Object.defineProperty(l,"~standard",{value:{...t["~standard"],jsonSchema:{input:dr(t,"input",e.processors),output:dr(t,"output",e.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function ge(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 ge(r.element,o);if(r.type==="set")return ge(r.valueType,o);if(r.type==="lazy")return ge(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 ge(r.innerType,o);if(r.type==="intersection")return ge(r.left,o)||ge(r.right,o);if(r.type==="record"||r.type==="map")return ge(r.keyType,o)||ge(r.valueType,o);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ge(r.in,o)||ge(r.out,o);if(r.type==="object"){for(let n in r.shape)if(ge(r.shape[n],o))return!0;return!1}if(r.type==="union"){for(let n of r.options)if(ge(n,o))return!0;return!1}if(r.type==="tuple"){for(let n of r.items)if(ge(n,o))return!0;return!!(r.rest&&ge(r.rest,o))}return!1}var ph=(e,t={})=>o=>{let r=$t({...o,processors:t});return L(e,r),Ct(r,e),It(r,e)},dr=(e,t,o={})=>r=>{let{libraryOptions:n,target:s}=r??{},a=$t({...n??{},target:s,io:t,processors:o});return L(e,a),Ct(a,e),It(a,e)};var Iy={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},hh=(e,t,o,r)=>{let n=o;n.type="string";let{minimum:s,maximum:a,format:l,patterns:u,contentEncoding:d}=e._zod.bag;if(typeof s=="number"&&(n.minLength=s),typeof a=="number"&&(n.maxLength=a),l&&(n.format=Iy[l]??l,n.format===""&&delete n.format,l==="time"&&delete n.format),d&&(n.contentEncoding=d),u&&u.size>0){let m=[...u];m.length===1?n.pattern=m[0].source:m.length>1&&(n.allOf=[...m.map(S=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:S.source}))])}},mh=(e,t,o,r)=>{let n=o,{minimum:s,maximum:a,format:l,multipleOf:u,exclusiveMaximum:d,exclusiveMinimum:m}=e._zod.bag;typeof l=="string"&&l.includes("int")?n.type="integer":n.type="number";let S=typeof m=="number"&&m>=(s??Number.NEGATIVE_INFINITY),_=typeof d=="number"&&d<=(a??Number.POSITIVE_INFINITY),y=t.target==="draft-04"||t.target==="openapi-3.0";S?y?(n.minimum=m,n.exclusiveMinimum=!0):n.exclusiveMinimum=m:typeof s=="number"&&(n.minimum=s),_?y?(n.maximum=d,n.exclusiveMaximum=!0):n.exclusiveMaximum=d:typeof a=="number"&&(n.maximum=a),typeof u=="number"&&(n.multipleOf=u)},fh=(e,t,o,r)=>{o.type="boolean"},gh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Sh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},_h=(e,t,o,r)=>{t.target==="openapi-3.0"?(o.type="string",o.nullable=!0,o.enum=[null]):o.type="null"},bh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},yh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},vh=(e,t,o,r)=>{o.not={}},zh=(e,t,o,r)=>{},Rh=(e,t,o,r)=>{},wh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},xh=(e,t,o,r)=>{let n=e._zod.def,s=Bn(n.entries);s.every(a=>typeof a=="number")&&(o.type="number"),s.every(a=>typeof a=="string")&&(o.type="string"),o.enum=s},Th=(e,t,o,r)=>{let n=e._zod.def,s=[];for(let a of n.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){let a=s[0];o.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?o.enum=[a]:o.const=a}else s.every(a=>typeof a=="number")&&(o.type="number"),s.every(a=>typeof a=="string")&&(o.type="string"),s.every(a=>typeof a=="boolean")&&(o.type="boolean"),s.every(a=>a===null)&&(o.type="null"),o.enum=s},Ph=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Eh=(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},kh=(e,t,o,r)=>{let n=o,s={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:l,mime:u}=e._zod.bag;a!==void 0&&(s.minLength=a),l!==void 0&&(s.maxLength=l),u?u.length===1?(s.contentMediaType=u[0],Object.assign(n,s)):(Object.assign(n,s),n.anyOf=u.map(d=>({contentMediaType:d}))):Object.assign(n,s)},$h=(e,t,o,r)=>{o.type="boolean"},Ch=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Ih=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Oh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Mh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},qh=(e,t,o,r)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Nh=(e,t,o,r)=>{let n=o,s=e._zod.def,{minimum:a,maximum:l}=e._zod.bag;typeof a=="number"&&(n.minItems=a),typeof l=="number"&&(n.maxItems=l),n.type="array",n.items=L(s.element,t,{...r,path:[...r.path,"items"]})},Ah=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="object",n.properties={};let a=s.shape;for(let d in a)n.properties[d]=L(a[d],t,{...r,path:[...r.path,"properties",d]});let l=new Set(Object.keys(a)),u=new Set([...l].filter(d=>{let m=s.shape[d]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));u.size>0&&(n.required=Array.from(u)),s.catchall?._zod.def.type==="never"?n.additionalProperties=!1:s.catchall?s.catchall&&(n.additionalProperties=L(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,a=n.options.map((l,u)=>L(l,t,{...r,path:[...r.path,s?"oneOf":"anyOf",u]}));s?o.oneOf=a:o.anyOf=a},jh=(e,t,o,r)=>{let n=e._zod.def,s=L(n.left,t,{...r,path:[...r.path,"allOf",0]}),a=L(n.right,t,{...r,path:[...r.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,u=[...l(s)?s.allOf:[s],...l(a)?a.allOf:[a]];o.allOf=u},Lh=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",l=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=s.items.map((_,y)=>L(_,t,{...r,path:[...r.path,a,y]})),d=s.rest?L(s.rest,t,{...r,path:[...r.path,l,...t.target==="openapi-3.0"?[s.items.length]:[]]}):null;t.target==="draft-2020-12"?(n.prefixItems=u,d&&(n.items=d)):t.target==="openapi-3.0"?(n.items={anyOf:u},d&&n.items.anyOf.push(d),n.minItems=u.length,d||(n.maxItems=u.length)):(n.items=u,d&&(n.additionalItems=d));let{minimum:m,maximum:S}=e._zod.bag;typeof m=="number"&&(n.minItems=m),typeof S=="number"&&(n.maxItems=S)},Uh=(e,t,o,r)=>{let n=o,s=e._zod.def;n.type="object";let a=s.keyType,u=a._zod.bag?.patterns;if(s.mode==="loose"&&u&&u.size>0){let m=L(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});n.patternProperties={};for(let S of u)n.patternProperties[S.source]=m}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(n.propertyNames=L(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),n.additionalProperties=L(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let d=a._zod.values;if(d){let m=[...d].filter(S=>typeof S=="string"||typeof S=="number");m.length>0&&(n.required=m)}},Zh=(e,t,o,r)=>{let n=e._zod.def,s=L(n.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=n.innerType,o.nullable=!0):o.anyOf=[s,{type:"null"}]},Dh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Hh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType,o.default=JSON.parse(JSON.stringify(n.defaultValue))},Fh=(e,t,o,r)=>{let n=e._zod.def;L(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)))},Vh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType;let a;try{a=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}o.default=a},Jh=(e,t,o,r)=>{let n=e._zod.def,s=n.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?s?n.out:n.in:n.out;L(a,t,r);let l=t.seen.get(e);l.ref=a},Bh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType,o.readOnly=!0},Wh=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Lc=(e,t,o,r)=>{let n=e._zod.def;L(n.innerType,t,r);let s=t.seen.get(e);s.ref=n.innerType},Kh=(e,t,o,r)=>{let n=e._zod.innerType;L(n,t,r);let s=t.seen.get(e);s.ref=n},Ac={string:hh,number:mh,boolean:fh,bigint:gh,symbol:Sh,null:_h,undefined:bh,void:yh,never:vh,any:zh,unknown:Rh,date:wh,enum:xh,literal:Th,nan:Ph,template_literal:Eh,file:kh,success:$h,custom:Ch,function:Ih,transform:Oh,map:Mh,set:qh,array:Nh,object:Ah,union:jc,intersection:jh,tuple:Lh,record:Uh,nullable:Zh,nonoptional:Dh,default:Hh,prefault:Fh,catch:Vh,pipe:Jh,readonly:Bh,promise:Wh,optional:Lc,lazy:Kh};function ao(e,t){if("_idmap"in e){let r=e,n=$t({...t,processors:Ac}),s={};for(let u of r._idmap.entries()){let[d,m]=u;L(m,n)}let a={},l={registry:r,uri:t?.uri,defs:s};n.external=l;for(let u of r._idmap.entries()){let[d,m]=u;Ct(n,m),a[d]=It(n,m)}if(Object.keys(s).length>0){let u=n.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[u]:s}}return{schemas:a}}let o=$t({...t,processors:Ac});return L(e,o),Ct(o,e),It(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=$t({processors:Ac,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 L(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)),Ct(this.ctx,t);let r=It(this.ctx,t),{"~standard":n,...s}=r;return s}};var fg={};var us={};ot(us,{ZodAny:()=>fm,ZodArray:()=>bm,ZodBase64:()=>cl,ZodBase64URL:()=>ll,ZodBigInt:()=>br,ZodBigIntFormat:()=>pl,ZodBoolean:()=>_r,ZodCIDRv4:()=>il,ZodCIDRv6:()=>al,ZodCUID:()=>Xc,ZodCUID2:()=>el,ZodCatch:()=>Lm,ZodCodec:()=>ys,ZodCustom:()=>vs,ZodCustomStringFormat:()=>gr,ZodDate:()=>gs,ZodDefault:()=>Om,ZodDiscriminatedUnion:()=>vm,ZodE164:()=>ul,ZodEmail:()=>Kc,ZodEmoji:()=>Yc,ZodEnum:()=>hr,ZodExactOptional:()=>$m,ZodFile:()=>Em,ZodFunction:()=>Wm,ZodGUID:()=>ps,ZodIPv4:()=>nl,ZodIPv6:()=>sl,ZodIntersection:()=>zm,ZodJWT:()=>dl,ZodKSUID:()=>rl,ZodLazy:()=>Jm,ZodLiteral:()=>Pm,ZodMAC:()=>dm,ZodMap:()=>xm,ZodNaN:()=>Zm,ZodNanoID:()=>Qc,ZodNever:()=>Sm,ZodNonOptional:()=>Sl,ZodNull:()=>mm,ZodNullable:()=>Im,ZodNumber:()=>Sr,ZodNumberFormat:()=>co,ZodObject:()=>Ss,ZodOptional:()=>gl,ZodPipe:()=>bs,ZodPrefault:()=>qm,ZodPreprocess:()=>Dm,ZodPromise:()=>Bm,ZodReadonly:()=>Hm,ZodRecord:()=>pr,ZodSet:()=>Tm,ZodString:()=>mr,ZodStringFormat:()=>D,ZodSuccess:()=>jm,ZodSymbol:()=>pm,ZodTemplateLiteral:()=>Vm,ZodTransform:()=>km,ZodTuple:()=>Rm,ZodType:()=>q,ZodULID:()=>tl,ZodURL:()=>fs,ZodUUID:()=>Ve,ZodUndefined:()=>hm,ZodUnion:()=>_s,ZodUnknown:()=>gm,ZodVoid:()=>_m,ZodXID:()=>ol,ZodXor:()=>ym,_ZodString:()=>Wc,_default:()=>Mm,_function:()=>SS,any:()=>hl,array:()=>f,base64:()=>Ng,base64url:()=>Ag,bigint:()=>Wg,boolean:()=>R,catch:()=>Um,check:()=>_S,cidrv4:()=>Mg,cidrv6:()=>qg,codec:()=>hS,cuid:()=>Tg,cuid2:()=>Pg,custom:()=>bS,date:()=>eS,describe:()=>yS,discriminatedUnion:()=>Ot,e164:()=>jg,email:()=>Gc,emoji:()=>wg,enum:()=>C,exactOptional:()=>Cm,file:()=>lS,float32:()=>Fg,float64:()=>Vg,function:()=>SS,guid:()=>_g,hash:()=>Hg,hex:()=>Dg,hostname:()=>Zg,httpUrl:()=>Rg,instanceof:()=>zS,int:()=>Jc,int32:()=>Jg,int64:()=>Kg,intersection:()=>Le,invertCodec:()=>mS,ipv4:()=>Cg,ipv6:()=>Og,json:()=>wS,jwt:()=>Lg,keyof:()=>tS,ksuid:()=>$g,lazy:()=>Mt,literal:()=>g,looseObject:()=>k,looseRecord:()=>sS,mac:()=>Ig,map:()=>iS,meta:()=>vS,nan:()=>pS,nanoid:()=>xg,nativeEnum:()=>cS,never:()=>ml,nonoptional:()=>Am,null:()=>Je,nullable:()=>hs,nullish:()=>uS,number:()=>b,object:()=>p,optional:()=>P,partialRecord:()=>nS,pipe:()=>Bc,prefault:()=>Nm,preprocess:()=>it,promise:()=>gS,readonly:()=>Fm,record:()=>z,refine:()=>Km,set:()=>aS,strictObject:()=>oS,string:()=>c,stringFormat:()=>Ug,stringbool:()=>RS,success:()=>dS,superRefine:()=>Gm,symbol:()=>Yg,templateLiteral:()=>fS,transform:()=>fl,tuple:()=>wm,uint32:()=>Bg,uint64:()=>Gg,ulid:()=>Eg,undefined:()=>Qg,union:()=>x,unknown:()=>T,url:()=>fr,uuid:()=>bg,uuidv4:()=>yg,uuidv6:()=>vg,uuidv7:()=>zg,void:()=>Xg,xid:()=>kg,xor:()=>rS});var Zc={};ot(Zc,{endsWith:()=>rr,gt:()=>He,gte:()=>fe,includes:()=>tr,length:()=>io,lowercase:()=>Xo,lt:()=>De,lte:()=>we,maxLength:()=>so,maxSize:()=>kt,mime:()=>nr,minLength:()=>nt,minSize:()=>Fe,multipleOf:()=>Et,negative:()=>Oc,nonnegative:()=>qc,nonpositive:()=>Mc,normalize:()=>sr,overwrite:()=>je,positive:()=>Ic,property:()=>Nc,regex:()=>Qo,size:()=>no,slugify:()=>lr,startsWith:()=>or,toLowerCase:()=>ar,toUpperCase:()=>cr,trim:()=>ir,uppercase:()=>er});var xe={};ot(xe,{ZodISODate:()=>Hc,ZodISODateTime:()=>Dc,ZodISODuration:()=>Vc,ZodISOTime:()=>Fc,date:()=>Yh,datetime:()=>Gh,duration:()=>Xh,time:()=>Qh});var Dc=h("ZodISODateTime",(e,t)=>{Pd.init(e,t),D.init(e,t)});function Gh(e){return Cp(Dc,e)}var Hc=h("ZodISODate",(e,t)=>{Ed.init(e,t),D.init(e,t)});function Yh(e){return Ip(Hc,e)}var Fc=h("ZodISOTime",(e,t)=>{kd.init(e,t),D.init(e,t)});function Qh(e){return Op(Fc,e)}var Vc=h("ZodISODuration",(e,t)=>{$d.init(e,t),D.init(e,t)});function Xh(e){return Mp(Vc,e)}var gg=(e,t)=>{Qn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>es(e,o)},flatten:{value:o=>Xn(e,o)},addIssue:{value:o=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Fo,2)}},addIssues:{value:o=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Fo,2)}},isEmpty:{get(){return e.issues.length===0}}})},My=h("ZodError",gg),ye=h("ZodError",gg,{Parent:Error});var em=Bo(ye),tm=Wo(ye),ds=Ko(ye),om=Go(ye),rm=Da(ye),nm=Ha(ye),sm=Fa(ye),im=Va(ye),am=Ja(ye),cm=Ba(ye),lm=Wa(ye),um=Ka(ye);var Sg=new WeakMap;function ms(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 a=o[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let l=a.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}var q=h("ZodType",(e,t)=>(M.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:dr(e,"input"),output:dr(e,"output")}}),e.toJSONSchema=ph(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(o,r)=>em(e,o,r,{callee:e.parse}),e.safeParse=(o,r)=>ds(e,o,r),e.parseAsync=async(o,r)=>tm(e,o,r,{callee:e.parseAsync}),e.safeParseAsync=async(o,r)=>om(e,o,r),e.spa=e.safeParseAsync,e.encode=(o,r)=>rm(e,o,r),e.decode=(o,r)=>nm(e,o,r),e.encodeAsync=async(o,r)=>sm(e,o,r),e.decodeAsync=async(o,r)=>im(e,o,r),e.safeEncode=(o,r)=>am(e,o,r),e.safeDecode=(o,r)=>cm(e,o,r),e.safeEncodeAsync=async(o,r)=>lm(e,o,r),e.safeDecodeAsync=async(o,r)=>um(e,o,r),ms(e,"ZodType",{check(...o){let r=this.def;return this.clone(O.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 he(this,o,r)},brand(){return this},register(o,r){return o.add(this,r),this},refine(o,r){return this.check(Km(o,r))},superRefine(o,r){return this.check(Gm(o,r))},overwrite(o){return this.check(je(o))},optional(){return P(this)},exactOptional(){return Cm(this)},nullable(){return hs(this)},nullish(){return P(hs(this))},nonoptional(o){return Am(this,o)},array(){return f(this)},or(o){return x([this,o])},and(o){return Le(this,o)},transform(o){return Bc(this,fl(o))},default(o){return Mm(this,o)},prefault(o){return Nm(this,o)},catch(o){return Um(this,o)},pipe(o){return Bc(this,o)},readonly(){return Fm(this)},describe(o){let r=this.clone();return re.add(r,{description:o}),r},meta(...o){if(o.length===0)return re.get(this);let r=this.clone();return re.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 re.get(e)?.description},configurable:!0}),e)),Wc=h("_ZodString",(e,t)=>{ro.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>hh(e,r,n,s);let o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,ms(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(nt(...r))},max(...r){return this.check(so(...r))},length(...r){return this.check(io(...r))},nonempty(...r){return this.check(nt(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=h("ZodString",(e,t)=>{ro.init(e,t),Wc.init(e,t),e.email=o=>e.check(pc(Kc,o)),e.url=o=>e.check(ls(fs,o)),e.jwt=o=>e.check(Cc(dl,o)),e.emoji=o=>e.check(Sc(Yc,o)),e.guid=o=>e.check(cs(ps,o)),e.uuid=o=>e.check(hc(Ve,o)),e.uuidv4=o=>e.check(mc(Ve,o)),e.uuidv6=o=>e.check(fc(Ve,o)),e.uuidv7=o=>e.check(gc(Ve,o)),e.nanoid=o=>e.check(_c(Qc,o)),e.guid=o=>e.check(cs(ps,o)),e.cuid=o=>e.check(bc(Xc,o)),e.cuid2=o=>e.check(yc(el,o)),e.ulid=o=>e.check(vc(tl,o)),e.base64=o=>e.check(Ec(cl,o)),e.base64url=o=>e.check(kc(ll,o)),e.xid=o=>e.check(zc(ol,o)),e.ksuid=o=>e.check(Rc(rl,o)),e.ipv4=o=>e.check(wc(nl,o)),e.ipv6=o=>e.check(xc(sl,o)),e.cidrv4=o=>e.check(Tc(il,o)),e.cidrv6=o=>e.check(Pc(al,o)),e.e164=o=>e.check($c(ul,o)),e.datetime=o=>e.check(Gh(o)),e.date=o=>e.check(Yh(o)),e.time=o=>e.check(Qh(o)),e.duration=o=>e.check(Xh(o))});function c(e){return Pp(mr,e)}var D=h("ZodStringFormat",(e,t)=>{Z.init(e,t),Wc.init(e,t)}),Kc=h("ZodEmail",(e,t)=>{_d.init(e,t),D.init(e,t)});function Gc(e){return pc(Kc,e)}var ps=h("ZodGUID",(e,t)=>{gd.init(e,t),D.init(e,t)});function _g(e){return cs(ps,e)}var Ve=h("ZodUUID",(e,t)=>{Sd.init(e,t),D.init(e,t)});function bg(e){return hc(Ve,e)}function yg(e){return mc(Ve,e)}function vg(e){return fc(Ve,e)}function zg(e){return gc(Ve,e)}var fs=h("ZodURL",(e,t)=>{bd.init(e,t),D.init(e,t)});function fr(e){return ls(fs,e)}function Rg(e){return ls(fs,{protocol:Re.httpProtocol,hostname:Re.domain,...O.normalizeParams(e)})}var Yc=h("ZodEmoji",(e,t)=>{yd.init(e,t),D.init(e,t)});function wg(e){return Sc(Yc,e)}var Qc=h("ZodNanoID",(e,t)=>{vd.init(e,t),D.init(e,t)});function xg(e){return _c(Qc,e)}var Xc=h("ZodCUID",(e,t)=>{zd.init(e,t),D.init(e,t)});function Tg(e){return bc(Xc,e)}var el=h("ZodCUID2",(e,t)=>{Rd.init(e,t),D.init(e,t)});function Pg(e){return yc(el,e)}var tl=h("ZodULID",(e,t)=>{wd.init(e,t),D.init(e,t)});function Eg(e){return vc(tl,e)}var ol=h("ZodXID",(e,t)=>{xd.init(e,t),D.init(e,t)});function kg(e){return zc(ol,e)}var rl=h("ZodKSUID",(e,t)=>{Td.init(e,t),D.init(e,t)});function $g(e){return Rc(rl,e)}var nl=h("ZodIPv4",(e,t)=>{Cd.init(e,t),D.init(e,t)});function Cg(e){return wc(nl,e)}var dm=h("ZodMAC",(e,t)=>{Od.init(e,t),D.init(e,t)});function Ig(e){return kp(dm,e)}var sl=h("ZodIPv6",(e,t)=>{Id.init(e,t),D.init(e,t)});function Og(e){return xc(sl,e)}var il=h("ZodCIDRv4",(e,t)=>{Md.init(e,t),D.init(e,t)});function Mg(e){return Tc(il,e)}var al=h("ZodCIDRv6",(e,t)=>{qd.init(e,t),D.init(e,t)});function qg(e){return Pc(al,e)}var cl=h("ZodBase64",(e,t)=>{Ad.init(e,t),D.init(e,t)});function Ng(e){return Ec(cl,e)}var ll=h("ZodBase64URL",(e,t)=>{jd.init(e,t),D.init(e,t)});function Ag(e){return kc(ll,e)}var ul=h("ZodE164",(e,t)=>{Ld.init(e,t),D.init(e,t)});function jg(e){return $c(ul,e)}var dl=h("ZodJWT",(e,t)=>{Ud.init(e,t),D.init(e,t)});function Lg(e){return Cc(dl,e)}var gr=h("ZodCustomStringFormat",(e,t)=>{Zd.init(e,t),D.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 Hg(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=h("ZodNumber",(e,t)=>{nc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>mh(e,r,n,s),ms(e,"ZodNumber",{gt(r,n){return this.check(He(r,n))},gte(r,n){return this.check(fe(r,n))},min(r,n){return this.check(fe(r,n))},lt(r,n){return this.check(De(r,n))},lte(r,n){return this.check(we(r,n))},max(r,n){return this.check(we(r,n))},int(r){return this.check(Jc(r))},safe(r){return this.check(Jc(r))},positive(r){return this.check(He(0,r))},nonnegative(r){return this.check(fe(0,r))},negative(r){return this.check(De(0,r))},nonpositive(r){return this.check(we(0,r))},multipleOf(r,n){return this.check(Et(r,n))},step(r,n){return this.check(Et(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 qp(Sr,e)}var co=h("ZodNumberFormat",(e,t)=>{Dd.init(e,t),Sr.init(e,t)});function Jc(e){return Ap(co,e)}function Fg(e){return jp(co,e)}function Vg(e){return Lp(co,e)}function Jg(e){return Up(co,e)}function Bg(e){return Zp(co,e)}var _r=h("ZodBoolean",(e,t)=>{ns.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>fh(e,o,r,n)});function R(e){return Dp(_r,e)}var br=h("ZodBigInt",(e,t)=>{sc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>gh(e,r,n,s),e.gte=(r,n)=>e.check(fe(r,n)),e.min=(r,n)=>e.check(fe(r,n)),e.gt=(r,n)=>e.check(He(r,n)),e.gte=(r,n)=>e.check(fe(r,n)),e.min=(r,n)=>e.check(fe(r,n)),e.lt=(r,n)=>e.check(De(r,n)),e.lte=(r,n)=>e.check(we(r,n)),e.max=(r,n)=>e.check(we(r,n)),e.positive=r=>e.check(He(BigInt(0),r)),e.negative=r=>e.check(De(BigInt(0),r)),e.nonpositive=r=>e.check(we(BigInt(0),r)),e.nonnegative=r=>e.check(fe(BigInt(0),r)),e.multipleOf=(r,n)=>e.check(Et(r,n));let o=e._zod.bag;e.minValue=o.minimum??null,e.maxValue=o.maximum??null,e.format=o.format??null});function Wg(e){return Fp(br,e)}var pl=h("ZodBigIntFormat",(e,t)=>{Hd.init(e,t),br.init(e,t)});function Kg(e){return Jp(pl,e)}function Gg(e){return Bp(pl,e)}var pm=h("ZodSymbol",(e,t)=>{Fd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Sh(e,o,r,n)});function Yg(e){return Wp(pm,e)}var hm=h("ZodUndefined",(e,t)=>{Vd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>bh(e,o,r,n)});function Qg(e){return Kp(hm,e)}var mm=h("ZodNull",(e,t)=>{Jd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>_h(e,o,r,n)});function Je(e){return Gp(mm,e)}var fm=h("ZodAny",(e,t)=>{Bd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>zh(e,o,r,n)});function hl(){return Yp(fm)}var gm=h("ZodUnknown",(e,t)=>{Wd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Rh(e,o,r,n)});function T(){return Qp(gm)}var Sm=h("ZodNever",(e,t)=>{Kd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>vh(e,o,r,n)});function ml(e){return Xp(Sm,e)}var _m=h("ZodVoid",(e,t)=>{Gd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>yh(e,o,r,n)});function Xg(e){return eh(_m,e)}var gs=h("ZodDate",(e,t)=>{Yd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>wh(e,r,n,s),e.min=(r,n)=>e.check(fe(r,n)),e.max=(r,n)=>e.check(we(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 th(gs,e)}var bm=h("ZodArray",(e,t)=>{Qd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Nh(e,o,r,n),e.element=t.element,ms(e,"ZodArray",{min(o,r){return this.check(nt(o,r))},nonempty(o){return this.check(nt(1,o))},max(o,r){return this.check(so(o,r))},length(o,r){return this.check(io(o,r))},unwrap(){return this.element}})});function f(e,t){return nh(bm,e,t)}function tS(e){let t=e._zod.def.shape;return C(Object.keys(t))}var Ss=h("ZodObject",(e,t)=>{Xd.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ah(e,o,r,n),O.defineLazy(e,"shape",()=>t.shape),ms(e,"ZodObject",{keyof(){return C(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:T()})},loose(){return this.clone({...this._zod.def,catchall:T()})},strict(){return this.clone({...this._zod.def,catchall:ml()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return O.extend(this,o)},safeExtend(o){return O.safeExtend(this,o)},merge(o){return O.merge(this,o)},pick(o){return O.pick(this,o)},omit(o){return O.omit(this,o)},partial(...o){return O.partial(gl,this,o[0])},required(...o){return O.required(Sl,this,o[0])}})});function p(e,t){let o={type:"object",shape:e??{},...O.normalizeParams(t)};return new Ss(o)}function oS(e,t){return new Ss({type:"object",shape:e,catchall:ml(),...O.normalizeParams(t)})}function k(e,t){return new Ss({type:"object",shape:e,catchall:T(),...O.normalizeParams(t)})}var _s=h("ZodUnion",(e,t)=>{ss.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n),e.options=t.options});function x(e,t){return new _s({type:"union",options:e,...O.normalizeParams(t)})}var ym=h("ZodXor",(e,t)=>{_s.init(e,t),ep.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jc(e,o,r,n),e.options=t.options});function rS(e,t){return new ym({type:"union",options:e,inclusive:!1,...O.normalizeParams(t)})}var vm=h("ZodDiscriminatedUnion",(e,t)=>{_s.init(e,t),tp.init(e,t)});function Ot(e,t,o){return new vm({type:"union",options:t,discriminator:e,...O.normalizeParams(o)})}var zm=h("ZodIntersection",(e,t)=>{op.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>jh(e,o,r,n)});function Le(e,t){return new zm({type:"intersection",left:e,right:t})}var Rm=h("ZodTuple",(e,t)=>{ic.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Lh(e,o,r,n),e.rest=o=>e.clone({...e._zod.def,rest:o})});function wm(e,t,o){let r=t instanceof M,n=r?o:t,s=r?t:null;return new Rm({type:"tuple",items:e,rest:s,...O.normalizeParams(n)})}var pr=h("ZodRecord",(e,t)=>{rp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Uh(e,o,r,n),e.keyType=t.keyType,e.valueType=t.valueType});function z(e,t,o){return!t||!t._zod?new pr({type:"record",keyType:c(),valueType:e,...O.normalizeParams(t)}):new pr({type:"record",keyType:e,valueType:t,...O.normalizeParams(o)})}function nS(e,t,o){let r=he(e);return r._zod.values=void 0,new pr({type:"record",keyType:r,valueType:t,...O.normalizeParams(o)})}function sS(e,t,o){return new pr({type:"record",keyType:e,valueType:t,mode:"loose",...O.normalizeParams(o)})}var xm=h("ZodMap",(e,t)=>{np.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,e.min=(...o)=>e.check(Fe(...o)),e.nonempty=o=>e.check(Fe(1,o)),e.max=(...o)=>e.check(kt(...o)),e.size=(...o)=>e.check(no(...o))});function iS(e,t,o){return new xm({type:"map",keyType:e,valueType:t,...O.normalizeParams(o)})}var Tm=h("ZodSet",(e,t)=>{sp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>qh(e,o,r,n),e.min=(...o)=>e.check(Fe(...o)),e.nonempty=o=>e.check(Fe(1,o)),e.max=(...o)=>e.check(kt(...o)),e.size=(...o)=>e.check(no(...o))});function aS(e,t){return new Tm({type:"set",valueType:e,...O.normalizeParams(t)})}var hr=h("ZodEnum",(e,t)=>{ip.init(e,t),q.init(e,t),e._zod.processJSONSchema=(r,n,s)=>xh(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 a of r)if(o.has(a))s[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new hr({...t,checks:[],...O.normalizeParams(n),entries:s})},e.exclude=(r,n)=>{let s={...t.entries};for(let a of r)if(o.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new hr({...t,checks:[],...O.normalizeParams(n),entries:s})}});function C(e,t){let o=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new hr({type:"enum",entries:o,...O.normalizeParams(t)})}function cS(e,t){return new hr({type:"enum",entries:e,...O.normalizeParams(t)})}var Pm=h("ZodLiteral",(e,t)=>{ap.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Th(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 g(e,t){return new Pm({type:"literal",values:Array.isArray(e)?e:[e],...O.normalizeParams(t)})}var Em=h("ZodFile",(e,t)=>{cp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>kh(e,o,r,n),e.min=(o,r)=>e.check(Fe(o,r)),e.max=(o,r)=>e.check(kt(o,r)),e.mime=(o,r)=>e.check(nr(Array.isArray(o)?o:[o],r))});function lS(e){return sh(Em,e)}var km=h("ZodTransform",(e,t)=>{lp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Oh(e,o,r,n),e._zod.parse=(o,r)=>{if(r.direction==="backward")throw new Rt(e.constructor.name);o.addIssue=s=>{if(typeof s=="string")o.issues.push(O.issue(s,o.value,t));else{let a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=o.value),a.inst??(a.inst=e),o.issues.push(O.issue(a))}};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 km({type:"transform",transform:e})}var gl=h("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 P(e){return new gl({type:"optional",innerType:e})}var $m=h("ZodExactOptional",(e,t)=>{up.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 Cm(e){return new $m({type:"optional",innerType:e})}var Im=h("ZodNullable",(e,t)=>{dp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Zh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function hs(e){return new Im({type:"nullable",innerType:e})}function uS(e){return P(hs(e))}var Om=h("ZodDefault",(e,t)=>{pp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Hh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Mm(e,t){return new Om({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():O.shallowClone(t)}})}var qm=h("ZodPrefault",(e,t)=>{hp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Fh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Nm(e,t){return new qm({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():O.shallowClone(t)}})}var Sl=h("ZodNonOptional",(e,t)=>{mp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Dh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Am(e,t){return new Sl({type:"nonoptional",innerType:e,...O.normalizeParams(t)})}var jm=h("ZodSuccess",(e,t)=>{fp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>$h(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function dS(e){return new jm({type:"success",innerType:e})}var Lm=h("ZodCatch",(e,t)=>{gp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Vh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Um(e,t){return new Lm({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Zm=h("ZodNaN",(e,t)=>{Sp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ph(e,o,r,n)});function pS(e){return rh(Zm,e)}var bs=h("ZodPipe",(e,t)=>{cc.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Jh(e,o,r,n),e.in=t.in,e.out=t.out});function Bc(e,t){return new bs({type:"pipe",in:e,out:t})}var ys=h("ZodCodec",(e,t)=>{bs.init(e,t),is.init(e,t)});function hS(e,t,o){return new ys({type:"pipe",in:e,out:t,transform:o.decode,reverseTransform:o.encode})}function mS(e){let t=e._zod.def;return new ys({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Dm=h("ZodPreprocess",(e,t)=>{bs.init(e,t),_p.init(e,t)}),Hm=h("ZodReadonly",(e,t)=>{bp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Bh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function Fm(e){return new Hm({type:"readonly",innerType:e})}var Vm=h("ZodTemplateLiteral",(e,t)=>{yp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Eh(e,o,r,n)});function fS(e,t){return new Vm({type:"template_literal",parts:e,...O.normalizeParams(t)})}var Jm=h("ZodLazy",(e,t)=>{Rp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Kh(e,o,r,n),e.unwrap=()=>e._zod.def.getter()});function Mt(e){return new Jm({type:"lazy",getter:e})}var Bm=h("ZodPromise",(e,t)=>{zp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Wh(e,o,r,n),e.unwrap=()=>e._zod.def.innerType});function gS(e){return new Bm({type:"promise",innerType:e})}var Wm=h("ZodFunction",(e,t)=>{vp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ih(e,o,r,n)});function SS(e){return new Wm({type:"function",input:Array.isArray(e?.input)?wm(e?.input):e?.input??f(T()),output:e?.output??T()})}var vs=h("ZodCustom",(e,t)=>{wp.init(e,t),q.init(e,t),e._zod.processJSONSchema=(o,r,n)=>Ch(e,o,r,n)});function _S(e){let t=new F({check:"custom"});return t._zod.check=e,t}function bS(e,t){return ih(vs,e??(()=>!0),t)}function Km(e,t={}){return ah(vs,e,t)}function Gm(e,t){return ch(e,t)}var yS=lh,vS=uh;function zS(e,t={}){let o=new vs({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...O.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 RS=(...e)=>dh({Codec:ys,Boolean:_r,String:mr},...e);function wS(e){let t=Mt(()=>x([c(e),b(),R(),Je(),f(t),z(c(),t)]));return t}function it(e,t){return new Dm({type:"pipe",in:fl(e),out:t})}var Qm={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 Ny(e){Y({customError:e})}function Ay(){return Y().customError}var Ym;Ym||(Ym={});var w={...us,...Zc,iso:xe},jy=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 Ly(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 Uy(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 w.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return w.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=Uy(n,t),a=le(s,t);return t.refs.set(n,a),t.processing.delete(n),a}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 w.null();if(n.length===0)return w.never();if(n.length===1)return w.literal(n[0]);if(n.every(a=>typeof a=="string"))return w.enum(n);let s=n.map(a=>w.literal(a));return s.length<2?s[0]:w.union([s[0],s[1],...s.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let o=e.type;if(Array.isArray(o)){let n=o.map(s=>{let a={...e,type:s};return xS(a,t)});return n.length===0?w.never():n.length===1?n[0]:w.union(n)}if(!o)return w.any();let r;switch(o){case"string":{let n=w.string();if(e.format){let s=e.format;s==="email"?n=n.check(w.email()):s==="uri"||s==="uri-reference"?n=n.check(w.url()):s==="uuid"||s==="guid"?n=n.check(w.uuid()):s==="date-time"?n=n.check(w.iso.datetime()):s==="date"?n=n.check(w.iso.date()):s==="time"?n=n.check(w.iso.time()):s==="duration"?n=n.check(w.iso.duration()):s==="ipv4"?n=n.check(w.ipv4()):s==="ipv6"?n=n.check(w.ipv6()):s==="mac"?n=n.check(w.mac()):s==="cidr"?n=n.check(w.cidrv4()):s==="cidr-v6"?n=n.check(w.cidrv6()):s==="base64"?n=n.check(w.base64()):s==="base64url"?n=n.check(w.base64url()):s==="e164"?n=n.check(w.e164()):s==="jwt"?n=n.check(w.jwt()):s==="emoji"?n=n.check(w.emoji()):s==="nanoid"?n=n.check(w.nanoid()):s==="cuid"?n=n.check(w.cuid()):s==="cuid2"?n=n.check(w.cuid2()):s==="ulid"?n=n.check(w.ulid()):s==="xid"?n=n.check(w.xid()):s==="ksuid"&&(n=n.check(w.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"?w.number().int():w.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=w.boolean();break}case"null":{r=w.null();break}case"object":{let n={},s=e.properties||{},a=new Set(e.required||[]);for(let[u,d]of Object.entries(s)){let m=le(d,t);n[u]=a.has(u)?m:m.optional()}if(e.propertyNames){let u=le(e.propertyNames,t),d=e.additionalProperties&&typeof e.additionalProperties=="object"?le(e.additionalProperties,t):w.any();if(Object.keys(n).length===0){r=w.record(u,d);break}let m=w.object(n).passthrough(),S=w.looseRecord(u,d);r=w.intersection(m,S);break}if(e.patternProperties){let u=e.patternProperties,d=Object.keys(u),m=[];for(let _ of d){let y=le(u[_],t),E=w.string().regex(new RegExp(_));m.push(w.looseRecord(E,y))}let S=[];if(Object.keys(n).length>0&&S.push(w.object(n).passthrough()),S.push(...m),S.length===0)r=w.object({}).passthrough();else if(S.length===1)r=S[0];else{let _=w.intersection(S[0],S[1]);for(let y=2;y<S.length;y++)_=w.intersection(_,S[y]);r=_}break}let l=w.object(n);e.additionalProperties===!1?r=l.strict():typeof e.additionalProperties=="object"?r=l.catchall(le(e.additionalProperties,t)):r=l.passthrough();break}case"array":{let n=e.prefixItems,s=e.items;if(n&&Array.isArray(n)){let a=n.map(u=>le(u,t)),l=s&&typeof s=="object"&&!Array.isArray(s)?le(s,t):void 0;l?r=w.tuple(a).rest(l):r=w.tuple(a),typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(Array.isArray(s)){let a=s.map(u=>le(u,t)),l=e.additionalItems&&typeof e.additionalItems=="object"?le(e.additionalItems,t):void 0;l?r=w.tuple(a).rest(l):r=w.tuple(a),typeof e.minItems=="number"&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems=="number"&&(r=r.check(w.maxLength(e.maxItems)))}else if(s!==void 0){let a=le(s,t),l=w.array(a);typeof e.minItems=="number"&&(l=l.min(e.minItems)),typeof e.maxItems=="number"&&(l=l.max(e.maxItems)),r=l}else r=w.array(w.any());break}default:throw new Error(`Unsupported type: ${o}`)}return r}function le(e,t){if(typeof e=="boolean")return e?w.any():w.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 l=e.anyOf.map(d=>le(d,t)),u=w.union(l);o=r?w.intersection(o,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let l=e.oneOf.map(d=>le(d,t)),u=w.xor(l);o=r?w.intersection(o,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)o=r?o:w.any();else{let l=r?o:le(e.allOf[0],t),u=r?0:1;for(let d=u;d<e.allOf.length;d++)l=w.intersection(l,le(e.allOf[d],t));o=l}e.nullable===!0&&t.version==="openapi-3.0"&&(o=w.nullable(o)),e.readOnly===!0&&(o=w.readonly(o)),e.default!==void 0&&(o=o.default(e.default));let n={},s=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let l of s)l in e&&(n[l]=e[l]);let a=["contentEncoding","contentMediaType","contentSchema"];for(let l of a)l in e&&(n[l]=e[l]);for(let l of Object.keys(e))jy.has(l)||(n[l]=e[l]);return Object.keys(n).length>0&&t.registry.add(o,n),e.description&&(o=o.describe(e.description)),o}function TS(e,t){if(typeof e=="boolean")return e?w.any():w.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=Ly(o,t?.defaultTarget),n=o.$defs||o.definitions||{},s={version:r,defs:n,refs:new Map,processing:new Set,rootSchema:o,registry:t?.registry??re};return le(o,s)}var zs={};ot(zs,{bigint:()=>Fy,boolean:()=>Hy,date:()=>Vy,number:()=>Dy,string:()=>Zy});function Zy(e){return Ep(mr,e)}function Dy(e){return Np(Sr,e)}function Hy(e){return Hp(_r,e)}function Fy(e){return Vp(br,e)}function Vy(e){return oh(gs,e)}Y(lc());var _l="2025-11-25";var bl=[_l,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],yl="io.modelcontextprotocol/related-task",lo="io.modelcontextprotocol/protocolVersion",yr="io.modelcontextprotocol/clientInfo",Nt="io.modelcontextprotocol/serverInfo",uo="io.modelcontextprotocol/clientCapabilities",vl="io.modelcontextprotocol/subscriptionId",vr="io.modelcontextprotocol/logLevel";var po="2.0";var at=Mt(()=>x([c(),b(),R(),Je(),z(c(),at),f(at)])),B=z(c(),at),zl=f(at),zr=x([c(),b().int()]),Rr=c(),Rs=p({ttl:b().optional()}),ws=p({taskId:c()}),wr=k({progressToken:zr.optional(),[yl]:ws.optional()}),oe=p({_meta:wr.optional()}),At=oe.extend({task:Rs.optional()}),W=p({method:c(),params:oe.loose().optional()}),ue=p({_meta:wr.optional()}),ne=p({method:c(),params:ue.loose().optional()}),xr=k({get[Nt](){return Pe.optional().catch(void 0)}}),K=k({_meta:xr.optional()}),Te=x([c(),b().int()]),Tr=p({jsonrpc:g(po),id:Te,...W.shape}).strict(),Pr=p({jsonrpc:g(po),...ne.shape}).strict(),ho=p({jsonrpc:g(po),id:Te,result:K}).strict(),mo=p({jsonrpc:g(po),id:Te.optional(),error:p({code:b().int(),message:c(),data:T().optional()})}).strict(),ct=x([Tr,Pr,ho,mo]),Rl=x([ho,mo]),We=K.strict(),xs=ue.extend({requestId:Te.optional(),reason:c().optional()}),Er=ne.extend({method:g("notifications/cancelled"),params:xs}),Ts=p({src:c(),mimeType:c().optional(),sizes:f(c()).optional(),theme:C(["light","dark"]).optional()}),lt=p({icons:f(Ts).optional()}),Be=p({name:c(),title:c().optional()}),Pe=Be.extend({...Be.shape,...lt.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),By=Le(p({applyDefaults:R().optional()}),B),Wy=it(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Le(p({form:By.optional(),url:B.optional()}),B.optional())),wl=k({list:B.optional(),cancel:B.optional(),requests:k({sampling:k({createMessage:B.optional()}).optional(),elicitation:k({create:B.optional()}).optional()}).optional()}),xl=k({list:B.optional(),cancel:B.optional(),requests:k({tools:k({call:B.optional()}).optional()}).optional()}),Ps=p({experimental:z(c(),B).optional(),sampling:p({context:B.optional(),tools:B.optional()}).optional(),elicitation:Wy.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:wl.optional(),extensions:z(c(),B).optional()}),Es=oe.extend({protocolVersion:c(),capabilities:Ps,clientInfo:Pe}),ks=W.extend({method:g("initialize"),params:Es}),kr=p({experimental:z(c(),B).optional(),logging:B.optional(),completions:B.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:z(c(),B).optional()}),$s=K.extend({protocolVersion:c(),capabilities:kr,serverInfo:Pe,instructions:c().optional()}),Cs=ne.extend({method:g("notifications/initialized"),params:ue.optional()}),Is=W.extend({method:g("server/discover"),params:oe.optional()}),$r=K.extend({supportedVersions:f(c()),capabilities:kr,instructions:c().optional()}),Cr=W.extend({method:g("ping"),params:oe.optional()}),Os=p({progress:b(),total:P(b()),message:P(c())}),Ms=p({...ue.shape,...Os.shape,progressToken:zr}),Ir=ne.extend({method:g("notifications/progress"),params:Ms}),qs=oe.extend({cursor:Rr.optional()}),ut=W.extend({params:qs.optional()}),dt=K.extend({nextCursor:Rr.optional()}),Or=p({uri:c(),mimeType:P(c()),_meta:z(c(),T()).optional()}),Mr=Or.extend({text:c()}),ef=c().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),qr=Or.extend({blob:ef}),pt=C(["user","assistant"]),Ke=p({audience:f(pt).optional(),priority:b().min(0).max(1).optional(),lastModified:xe.datetime({offset:!0}).optional()}),Nr=p({...Be.shape,...lt.shape,uri:c(),description:P(c()),mimeType:P(c()),size:P(b()),annotations:Ke.optional(),_meta:P(k({}))}),Ns=p({...Be.shape,...lt.shape,uriTemplate:c(),description:P(c()),mimeType:P(c()),annotations:Ke.optional(),_meta:P(k({}))}),As=ut.extend({method:g("resources/list")}),js=dt.extend({resources:f(Nr)}),Ls=ut.extend({method:g("resources/templates/list")}),Us=dt.extend({resourceTemplates:f(Ns)}),fo=oe.extend({uri:c()}),Zs=fo,Ds=W.extend({method:g("resources/read"),params:Zs}),Hs=K.extend({contents:f(x([Mr,qr]))}),Fs=ne.extend({method:g("notifications/resources/list_changed"),params:ue.optional()}),Vs=fo,Js=W.extend({method:g("resources/subscribe"),params:Vs}),Bs=fo,Ws=W.extend({method:g("resources/unsubscribe"),params:Bs}),Ar=p({toolsListChanged:R().optional(),promptsListChanged:R().optional(),resourcesListChanged:R().optional(),resourceSubscriptions:f(c()).optional()}),Ks=oe.extend({notifications:Ar}),Gs=W.extend({method:g("subscriptions/listen"),params:Ks}),Ys=ue.extend({notifications:Ar}),Qs=ne.extend({method:g("notifications/subscriptions/acknowledged"),params:Ys}),Xs=xr.extend({[vl]:Te}),ei=K.extend({_meta:Xs}),ti=ue.extend({uri:c()}),oi=ne.extend({method:g("notifications/resources/updated"),params:ti}),ri=p({name:c(),description:P(c()),required:P(R())}),ni=p({...Be.shape,...lt.shape,description:P(c()),arguments:P(f(ri)),_meta:P(k({}))}),si=ut.extend({method:g("prompts/list")}),ii=dt.extend({prompts:f(ni)}),ai=oe.extend({name:c(),arguments:z(c(),c()).optional()}),ci=W.extend({method:g("prompts/get"),params:ai}),go=p({type:g("text"),text:c(),annotations:Ke.optional(),_meta:z(c(),T()).optional()}),So=p({type:g("image"),data:ef,mimeType:c(),annotations:Ke.optional(),_meta:z(c(),T()).optional()}),_o=p({type:g("audio"),data:ef,mimeType:c(),annotations:Ke.optional(),_meta:z(c(),T()).optional()}),li=p({type:g("tool_use"),name:c(),id:c(),input:z(c(),T()),_meta:z(c(),T()).optional()}),ht=p({type:g("resource"),resource:x([Mr,qr]),annotations:Ke.optional(),_meta:z(c(),T()).optional()}),mt=Nr.extend({type:g("resource_link")}),Ee=x([go,So,_o,mt,ht]),ui=p({role:pt,content:Ee}),di=K.extend({description:c().optional(),messages:f(ui)}),pi=ne.extend({method:g("notifications/prompts/list_changed"),params:ue.optional()}),hi=p({title:c().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),mi=p({taskSupport:C(["required","optional","forbidden"]).optional()}),Ge=p({...Be.shape,...lt.shape,description:c().optional(),inputSchema:p({type:g("object"),properties:z(c(),at).optional(),required:f(c()).optional()}).catchall(T()),outputSchema:k({$schema:c().optional()}).optional(),annotations:hi.optional(),execution:mi.optional(),_meta:z(c(),T()).optional()}),fi=ut.extend({method:g("tools/list")}),gi=dt.extend({tools:f(Ge)}),Ye=K.extend({content:f(Ee).default([]),structuredContent:T().optional(),isError:R().optional()}),Tl=Ye.or(K.extend({toolResult:T()})),Si=At.extend({name:c(),arguments:z(c(),T()).optional()}),_i=W.extend({method:g("tools/call"),params:Si}),bi=ne.extend({method:g("notifications/tools/list_changed"),params:ue.optional()}),Pl=p({autoRefresh:R().default(!0),debounceMs:b().int().nonnegative().default(300)}),jr=C(["debug","info","notice","warning","error","critical","alert","emergency"]),yi=oe.extend({level:jr}),vi=W.extend({method:g("logging/setLevel"),params:yi}),zi=ue.extend({level:jr,logger:c().optional(),data:T()}),bo=ne.extend({method:g("notifications/message"),params:zi}),Ri=p({name:c().optional()}),wi=p({hints:f(Ri).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),xi=p({mode:C(["auto","required","none"]).optional()}),Ti=p({type:g("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:f(Ee),structuredContent:T().optional(),isError:R().optional(),_meta:z(c(),T()).optional()}),Pi=Ot("type",[go,So,_o]),qt=Ot("type",[go,So,_o,li,Ti]),Ei=p({role:pt,content:x([qt,f(qt)]),_meta:z(c(),T()).optional()}),ki=At.extend({messages:f(Ei),modelPreferences:wi.optional(),systemPrompt:c().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:f(c()).optional(),metadata:B.optional(),tools:f(Ge).optional(),toolChoice:xi.optional()}),$i=W.extend({method:g("sampling/createMessage"),params:ki}),Ci=K.extend({model:c(),stopReason:P(C(["endTurn","stopSequence","maxTokens"]).or(c())),role:pt,content:Pi}),Ii=K.extend({model:c(),stopReason:P(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:pt,content:x([qt,f(qt)])}),Lr=p({type:g("boolean"),title:c().optional(),description:c().optional(),default:R().optional()}),yo=p({type:g("string"),title:c().optional(),description:c().optional(),minLength:b().optional(),maxLength:b().optional(),format:C(["email","uri","date","date-time"]).optional(),default:c().optional()}),vo=p({type:C(["number","integer"]),title:c().optional(),description:c().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),Ur=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),default:c().optional()}),Zr=p({type:g("string"),title:c().optional(),description:c().optional(),oneOf:f(p({const:c(),title:c()})),default:c().optional()}),Dr=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),enumNames:f(c()).optional(),default:c().optional()}),Oi=x([Ur,Zr]),Hr=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:g("string"),enum:f(c())}),default:f(c()).optional()}),Fr=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:f(p({const:c(),title:c()}))}),default:f(c()).optional()}),Mi=x([Hr,Fr]),qi=x([Dr,Oi,Mi]),Vr=x([qi,Lr,yo,vo]),zo=At.extend({mode:g("form").optional(),message:c(),requestedSchema:p({type:g("object"),properties:z(c(),Vr),required:f(c()).optional()}).catchall(T())}),Ni=At.extend({mode:g("url"),message:c(),elicitationId:c(),url:c().url()}),Ai=x([zo,Ni]),ji=W.extend({method:g("elicitation/create"),params:Ai}),Li=ue.extend({elicitationId:c()}),Ui=ne.extend({method:g("notifications/elicitation/complete"),params:Li}),Zi=K.extend({action:C(["accept","decline","cancel"]),content:it(e=>e===null?void 0:e,z(c(),x([c(),b(),R(),f(c())])).optional())}),Di=p({type:g("ref/resource"),uri:c()}),Hi=p({type:g("ref/prompt"),name:c()}),Fi=oe.extend({ref:x([Hi,Di]),argument:p({name:c(),value:c()}),context:p({arguments:z(c(),c()).optional()}).optional()}),Vi=W.extend({method:g("completion/complete"),params:Fi}),Ji=K.extend({completion:k({values:f(c()).max(100),total:P(b().int()),hasMore:P(R())})}),Bi=p({uri:c().startsWith("file://"),name:c().optional(),_meta:z(c(),T()).optional()}),Wi=W.extend({method:g("roots/list"),params:oe.optional()}),Ki=K.extend({roots:f(Bi)}),Gi=ne.extend({method:g("notifications/roots/list_changed"),params:ue.optional()}),El=k({ttl:b().optional(),pollInterval:b().optional()}),Yi=C(["working","input_required","completed","failed","cancelled"]),ft=p({taskId:c(),status:Yi,ttl:x([b(),Je()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:P(b()),statusMessage:P(c())}),kl=K.extend({task:ft}),Qi=ue.merge(ft),$l=ne.extend({method:g("notifications/tasks/status"),params:Qi}),Cl=W.extend({method:g("tasks/get"),params:oe.extend({taskId:c()})}),Il=K.merge(ft),Ol=W.extend({method:g("tasks/result"),params:oe.extend({taskId:c()})}),Ml=K.loose(),ql=ut.extend({method:g("tasks/list")}),Nl=dt.extend({tasks:f(ft)}),Al=W.extend({method:g("tasks/cancel"),params:oe.extend({taskId:c()})}),jl=K.merge(ft),Ll=x([Cr,ks,Is,Vi,vi,ci,si,As,Ls,Ds,Js,Ws,Gs,_i,fi]),Ul=x([Er,Ir,Cs,Gi]),Zl=x([We,Ci,Ii,Zi,Ki]),Dl=x([Cr,$i,ji,Wi]),Hl=x([Er,Ir,bo,oi,Fs,bi,pi,Qs,Ui]),Fl=x([We,$s,$r,Ji,di,ii,js,Us,Hs,Ye,gi,ei]),te=fr().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Qm.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"}),Xi=k({resource:c().url(),authorization_servers:f(te).optional(),jwks_uri:c().url().optional(),scopes_supported:f(c()).optional(),bearer_methods_supported:f(c()).optional(),resource_signing_alg_values_supported:f(c()).optional(),resource_name:c().optional(),resource_documentation:c().optional(),resource_policy_uri:c().url().optional(),resource_tos_uri:c().url().optional(),tls_client_certificate_bound_access_tokens:R().optional(),authorization_details_types_supported:f(c()).optional(),dpop_signing_alg_values_supported:f(c()).optional(),dpop_bound_access_tokens_required:R().optional()}),Jr=k({issuer:c(),authorization_endpoint:te,token_endpoint:te,registration_endpoint:te.optional(),scopes_supported:f(c()).optional(),response_types_supported:f(c()),response_modes_supported:f(c()).optional(),grant_types_supported:f(c()).optional(),token_endpoint_auth_methods_supported:f(c()).optional(),token_endpoint_auth_signing_alg_values_supported:f(c()).optional(),service_documentation:te.optional(),revocation_endpoint:te.optional(),revocation_endpoint_auth_methods_supported:f(c()).optional(),revocation_endpoint_auth_signing_alg_values_supported:f(c()).optional(),introspection_endpoint:c().optional(),introspection_endpoint_auth_methods_supported:f(c()).optional(),introspection_endpoint_auth_signing_alg_values_supported:f(c()).optional(),code_challenge_methods_supported:f(c()).optional(),client_id_metadata_document_supported:R().optional(),authorization_response_iss_parameter_supported:R().optional().catch(void 0),dpop_signing_alg_values_supported:f(c()).optional()}),ea=k({issuer:c(),authorization_endpoint:te,token_endpoint:te,userinfo_endpoint:te.optional(),jwks_uri:te,registration_endpoint:te.optional(),scopes_supported:f(c()).optional(),response_types_supported:f(c()),response_modes_supported:f(c()).optional(),grant_types_supported:f(c()).optional(),acr_values_supported:f(c()).optional(),subject_types_supported:f(c()),id_token_signing_alg_values_supported:f(c()),id_token_encryption_alg_values_supported:f(c()).optional(),id_token_encryption_enc_values_supported:f(c()).optional(),userinfo_signing_alg_values_supported:f(c()).optional(),userinfo_encryption_alg_values_supported:f(c()).optional(),userinfo_encryption_enc_values_supported:f(c()).optional(),request_object_signing_alg_values_supported:f(c()).optional(),request_object_encryption_alg_values_supported:f(c()).optional(),request_object_encryption_enc_values_supported:f(c()).optional(),token_endpoint_auth_methods_supported:f(c()).optional(),token_endpoint_auth_signing_alg_values_supported:f(c()).optional(),display_values_supported:f(c()).optional(),claim_types_supported:f(c()).optional(),claims_supported:f(c()).optional(),service_documentation:c().optional(),claims_locales_supported:f(c()).optional(),ui_locales_supported:f(c()).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:te.optional(),op_tos_uri:te.optional(),client_id_metadata_document_supported:R().optional(),authorization_response_iss_parameter_supported:R().optional().catch(void 0)}),ta=p({...ea.shape,...Jr.pick({code_challenge_methods_supported:!0}).shape}),oa=p({access_token:c(),id_token:c().optional(),token_type:c(),expires_in:zs.number().optional(),scope:c().optional(),refresh_token:c().optional(),issuer:c().optional().catch(void 0)}).strip(),ra=p({issued_token_type:g("urn:ietf:params:oauth:token-type:id-jag"),access_token:c(),token_type:c().optional(),expires_in:b().optional(),scope:c().optional()}).strip(),na=p({error:c(),error_description:c().optional(),error_uri:c().optional()}),Xm=te.optional().or(g("").transform(()=>{})),sa=p({redirect_uris:f(te),token_endpoint_auth_method:c().optional(),grant_types:f(c()).optional(),response_types:f(c()).optional(),application_type:c().optional(),client_name:c().optional(),client_uri:te.optional(),logo_uri:Xm,scope:c().optional(),contacts:f(c()).optional(),tos_uri:Xm,policy_uri:c().optional(),jwks_uri:te.optional(),jwks:hl().optional(),software_id:c().optional(),software_version:c().optional(),software_statement:c().optional()}).strip(),ia=p({client_id:c(),client_secret:c().optional(),client_id_issued_at:b().optional(),client_secret_expires_at:b().optional(),issuer:c().optional().catch(void 0)}).strip(),aa=sa.merge(ia),Vl=p({error:c(),error_description:c().optional()}).strip(),Jl=p({token:c(),token_type_hint:c().optional()}).strip();var af=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,af,{value:o,enumerable:!1,configurable:!0})}function ke(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,af)){let o=t[af];if(o&&typeof o.has=="function"&&o.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var Ky=class JS extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return ke(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 ke(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)}},se=(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})({}),X=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return ke(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 ke(this,e)}constructor(e,t,o,r){super(t,r),this.code=e,this.data=o,this.name="SdkError",Ro(this,new.target)}},Gy=class extends X{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 Yy="2026-07-28";function BS(e){return e>=Yy}function WS(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 KS=["task","inputRequests","requestState"];function Qy(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||KS.some(t=>t in e)?e:{...e,content:[]}}function Xy(){let e=Mt(()=>x([c(),b(),R(),Je(),z(c(),e),f(e)])),t=z(c(),e),o=x([c(),b().int()]),r=c(),n=p({ttl:b().optional()}),s=p({taskId:c()}),a=k({progressToken:o.optional(),"io.modelcontextprotocol/related-task":s.optional()}),l=p({_meta:a.optional()}),u=l.extend({task:n.optional()}),d=p({method:c(),params:l.loose().optional()}),m=p({_meta:a.optional()}),S=p({method:c(),params:m.loose().optional()}),_=k({_meta:a.optional()}),y=x([c(),b().int()]),E=_.strict(),$=m.extend({requestId:y.optional(),reason:c().optional()}),I=S.extend({method:g("notifications/cancelled"),params:$}),H=p({src:c(),mimeType:c().optional(),sizes:f(c()).optional(),theme:C(["light","dark"]).optional()}),G=p({icons:f(H).optional()}),U=p({name:c(),title:c().optional()}),j=U.extend({...U.shape,...G.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),J=Le(p({applyDefaults:R().optional()}),t),V=it(ce=>ce&&typeof ce=="object"&&!Array.isArray(ce)&&Object.keys(ce).length===0?{form:{}}:ce,Le(p({form:J.optional(),url:t.optional()}),t.optional())),ee=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),Xe=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),de=p({experimental:z(c(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:V.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:ee.optional(),extensions:z(c(),t).optional()}),gt=l.extend({protocolVersion:c(),capabilities:de,clientInfo:j}),Ut=d.extend({method:g("initialize"),params:gt}),Kr=p({experimental:z(c(),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:Xe.optional(),extensions:z(c(),t).optional()}),Gr=_.extend({protocolVersion:c(),capabilities:Kr,serverInfo:j,instructions:c().optional()}),Po=S.extend({method:g("notifications/initialized"),params:m.optional()}),St=d.extend({method:g("ping"),params:l.optional()}),Zt=p({progress:b(),total:P(b()),message:P(c())}),Ue=p({...m.shape,...Zt.shape,progressToken:o}),_t=S.extend({method:g("notifications/progress"),params:Ue}),Eo=l.extend({cursor:r.optional()}),et=d.extend({params:Eo.optional()}),tt=_.extend({nextCursor:r.optional()}),ko=p({uri:c(),mimeType:P(c()),_meta:z(c(),T()).optional()}),$o=ko.extend({text:c()}),Dt=c().refine(ce=>{try{return atob(ce),!0}catch{return!1}},{message:"Invalid Base64 string"}),Co=ko.extend({blob:Dt}),Ze=C(["user","assistant"]),qe=p({audience:f(Ze).optional(),priority:b().min(0).max(1).optional(),lastModified:xe.datetime({offset:!0}).optional()}),Ht=p({...U.shape,...G.shape,uri:c(),description:P(c()),mimeType:P(c()),size:P(b()),annotations:qe.optional(),_meta:P(k({}))}),Yr=p({...U.shape,...G.shape,uriTemplate:c(),description:P(c()),mimeType:P(c()),annotations:qe.optional(),_meta:P(k({}))}),Qr=et.extend({method:g("resources/list")}),Xr=tt.extend({resources:f(Ht)}),bt=et.extend({method:g("resources/templates/list")}),Io=tt.extend({resourceTemplates:f(Yr)}),Ft=l.extend({uri:c()}),en=Ft,tn=d.extend({method:g("resources/read"),params:en}),on=_.extend({contents:f(x([$o,Co]))}),rn=S.extend({method:g("notifications/resources/list_changed"),params:m.optional()}),nn=Ft,sn=d.extend({method:g("resources/subscribe"),params:nn}),an=Ft,cn=d.extend({method:g("resources/unsubscribe"),params:an}),ln=m.extend({uri:c()}),un=S.extend({method:g("notifications/resources/updated"),params:ln}),dn=p({name:c(),description:P(c()),required:P(R())}),pn=p({...U.shape,...G.shape,description:P(c()),arguments:P(f(dn)),_meta:P(k({}))}),hn=et.extend({method:g("prompts/list")}),mn=tt.extend({prompts:f(pn)}),fn=l.extend({name:c(),arguments:z(c(),c()).optional()}),gn=d.extend({method:g("prompts/get"),params:fn}),Vt=p({type:g("text"),text:c(),annotations:qe.optional(),_meta:z(c(),T()).optional()}),Jt=p({type:g("image"),data:Dt,mimeType:c(),annotations:qe.optional(),_meta:z(c(),T()).optional()}),Bt=p({type:g("audio"),data:Dt,mimeType:c(),annotations:qe.optional(),_meta:z(c(),T()).optional()}),Sn=p({type:g("tool_use"),name:c(),id:c(),input:z(c(),T()),_meta:z(c(),T()).optional()}),yt=p({type:g("resource"),resource:x([$o,Co]),annotations:qe.optional(),_meta:z(c(),T()).optional()}),_n=Ht.extend({type:g("resource_link")}),Ce=x([Vt,Jt,Bt,_n,yt]),Oo=p({role:Ze,content:Ce}),Mo=_.extend({description:c().optional(),messages:f(Oo)}),Wt=S.extend({method:g("notifications/prompts/list_changed"),params:m.optional()}),bn=p({title:c().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),qo=p({taskSupport:C(["required","optional","forbidden"]).optional()}),Kt=p({...U.shape,...G.shape,description:c().optional(),inputSchema:p({type:g("object"),properties:z(c(),e).optional(),required:f(c()).optional()}).catchall(T()),outputSchema:p({type:g("object"),properties:z(c(),e).optional(),required:f(c()).optional()}).catchall(T()).optional(),annotations:bn.optional(),execution:qo.optional(),_meta:z(c(),T()).optional()}),No=et.extend({method:g("tools/list")}),Ao=tt.extend({tools:f(Kt)}),jo=_.extend({content:f(Ce),structuredContent:z(c(),T()).optional(),isError:R().optional()}),ae=u.extend({name:c(),arguments:z(c(),T()).optional()}),yn=d.extend({method:g("tools/call"),params:ae}),ba=S.extend({method:g("notifications/tools/list_changed"),params:m.optional()}),Lo=C(["debug","info","notice","warning","error","critical","alert","emergency"]),vn=l.extend({level:Lo}),zn=d.extend({method:g("logging/setLevel"),params:vn}),Rn=m.extend({level:Lo,logger:c().optional(),data:T()}),wn=S.extend({method:g("notifications/message"),params:Rn}),xn=p({name:c().optional()}),Tn=p({hints:f(xn).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),Pn=p({mode:C(["auto","required","none"]).optional()}),ya=p({type:g("tool_result"),toolUseId:c().describe("The unique identifier for the corresponding tool call."),content:f(Ce),structuredContent:p({}).loose().optional(),isError:R().optional(),_meta:z(c(),T()).optional()}),En=Ot("type",[Vt,Jt,Bt]),vt=Ot("type",[Vt,Jt,Bt,Sn,ya]),kn=p({role:Ze,content:x([vt,f(vt)]),_meta:z(c(),T()).optional()}),$n=u.extend({messages:f(kn),modelPreferences:Tn.optional(),systemPrompt:c().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:f(c()).optional(),metadata:t.optional(),tools:f(Kt).optional(),toolChoice:Pn.optional()}),Cn=d.extend({method:g("sampling/createMessage"),params:$n}),In=_.extend({model:c(),stopReason:P(C(["endTurn","stopSequence","maxTokens"]).or(c())),role:Ze,content:En}),On=_.extend({model:c(),stopReason:P(C(["endTurn","stopSequence","maxTokens","toolUse"]).or(c())),role:Ze,content:x([vt,f(vt)])}),Mn=p({type:g("boolean"),title:c().optional(),description:c().optional(),default:R().optional()}),qn=p({type:g("string"),title:c().optional(),description:c().optional(),minLength:b().optional(),maxLength:b().optional(),format:C(["email","uri","date","date-time"]).optional(),default:c().optional()}),Nn=p({type:C(["number","integer"]),title:c().optional(),description:c().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),An=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),default:c().optional()}),jn=p({type:g("string"),title:c().optional(),description:c().optional(),oneOf:f(p({const:c(),title:c()})),default:c().optional()}),Ln=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),enumNames:f(c()).optional(),default:c().optional()}),Un=x([An,jn]),Gt=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:g("string"),enum:f(c())}),default:f(c()).optional()}),Yt=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:f(p({const:c(),title:c()}))}),default:f(c()).optional()}),va=x([Gt,Yt]),za=x([Ln,Un,va]),ve=x([za,Mn,qn,Nn]),ze=u.extend({mode:g("form").optional(),message:c(),requestedSchema:p({type:g("object"),properties:z(c(),ve),required:f(c()).optional()}).catchall(T())}),Zn=u.extend({mode:g("url"),message:c(),elicitationId:c(),url:c().url()}),Ne=x([ze,Zn]),Ra=d.extend({method:g("elicitation/create"),params:Ne}),wa=m.extend({elicitationId:c()}),xa=S.extend({method:g("notifications/elicitation/complete"),params:wa}),Ta=_.extend({action:C(["accept","decline","cancel"]),content:it(ce=>ce===null?void 0:ce,z(c(),x([c(),b(),R(),f(c())])).optional())}),Pa=p({type:g("ref/resource"),uri:c()}),Ea=p({type:g("ref/prompt"),name:c()}),ka=l.extend({ref:x([Ea,Pa]),argument:p({name:c(),value:c()}),context:p({arguments:z(c(),c()).optional()}).optional()}),Dn=d.extend({method:g("completion/complete"),params:ka}),$a=_.extend({completion:k({values:f(c()).max(100),total:P(b().int()),hasMore:P(R())})}),Ca=p({uri:c().startsWith("file://"),name:c().optional(),_meta:z(c(),T()).optional()}),Uo=d.extend({method:g("roots/list"),params:l.optional()}),Hn=_.extend({roots:f(Ca)}),Ia=S.extend({method:g("notifications/roots/list_changed"),params:m.optional()}),Oa=k({ttl:b().optional(),pollInterval:b().optional()}),Fn=C(["working","input_required","completed","failed","cancelled"]),zt=p({taskId:c(),status:Fn,ttl:x([b(),Je()]),createdAt:c(),lastUpdatedAt:c(),pollInterval:P(b()),statusMessage:P(c())}),Se=_.extend({task:zt}),Ma=m.merge(zt),Qt=S.extend({method:g("notifications/tasks/status"),params:Ma}),Zo=d.extend({method:g("tasks/get"),params:l.extend({taskId:c()})}),Do=_.merge(zt),Ho=d.extend({method:g("tasks/result"),params:l.extend({taskId:c()})}),ru=_.loose(),pe=et.extend({method:g("tasks/list")}),Q=tt.extend({tasks:f(zt)}),Xt=d.extend({method:g("tasks/cancel"),params:l.extend({taskId:c()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,TaskMetadataSchema:n,RelatedTaskMetadataSchema:s,RequestMetaSchema:a,BaseRequestParamsSchema:l,TaskAugmentedRequestParamsSchema:u,RequestSchema:d,NotificationsParamsSchema:m,NotificationSchema:S,ResultSchema:_,RequestIdSchema:y,EmptyResultSchema:E,CancelledNotificationParamsSchema:$,CancelledNotificationSchema:I,IconSchema:H,IconsSchema:G,BaseMetadataSchema:U,ImplementationSchema:j,ClientTasksCapabilitySchema:ee,ServerTasksCapabilitySchema:Xe,ClientCapabilitiesSchema:de,InitializeRequestParamsSchema:gt,InitializeRequestSchema:Ut,ServerCapabilitiesSchema:Kr,InitializeResultSchema:Gr,InitializedNotificationSchema:Po,PingRequestSchema:St,ProgressSchema:Zt,ProgressNotificationParamsSchema:Ue,ProgressNotificationSchema:_t,PaginatedRequestParamsSchema:Eo,PaginatedRequestSchema:et,PaginatedResultSchema:tt,ResourceContentsSchema:ko,TextResourceContentsSchema:$o,BlobResourceContentsSchema:Co,RoleSchema:Ze,AnnotationsSchema:qe,ResourceSchema:Ht,ResourceTemplateSchema:Yr,ListResourcesRequestSchema:Qr,ListResourcesResultSchema:Xr,ListResourceTemplatesRequestSchema:bt,ListResourceTemplatesResultSchema:Io,ResourceRequestParamsSchema:Ft,ReadResourceRequestParamsSchema:en,ReadResourceRequestSchema:tn,ReadResourceResultSchema:on,ResourceListChangedNotificationSchema:rn,SubscribeRequestParamsSchema:nn,SubscribeRequestSchema:sn,UnsubscribeRequestParamsSchema:an,UnsubscribeRequestSchema:cn,ResourceUpdatedNotificationParamsSchema:ln,ResourceUpdatedNotificationSchema:un,PromptArgumentSchema:dn,PromptSchema:pn,ListPromptsRequestSchema:hn,ListPromptsResultSchema:mn,GetPromptRequestParamsSchema:fn,GetPromptRequestSchema:gn,TextContentSchema:Vt,ImageContentSchema:Jt,AudioContentSchema:Bt,ToolUseContentSchema:Sn,EmbeddedResourceSchema:yt,ResourceLinkSchema:_n,ContentBlockSchema:Ce,PromptMessageSchema:Oo,GetPromptResultSchema:Mo,PromptListChangedNotificationSchema:Wt,ToolAnnotationsSchema:bn,ToolExecutionSchema:qo,ToolSchema:Kt,ListToolsRequestSchema:No,ListToolsResultSchema:Ao,CallToolResultSchema:jo,CallToolRequestParamsSchema:ae,CallToolRequestSchema:yn,ToolListChangedNotificationSchema:ba,LoggingLevelSchema:Lo,SetLevelRequestParamsSchema:vn,SetLevelRequestSchema:zn,LoggingMessageNotificationParamsSchema:Rn,LoggingMessageNotificationSchema:wn,ModelHintSchema:xn,ModelPreferencesSchema:Tn,ToolChoiceSchema:Pn,ToolResultContentSchema:ya,SamplingContentSchema:En,SamplingMessageContentBlockSchema:vt,SamplingMessageSchema:kn,CreateMessageRequestParamsSchema:$n,CreateMessageRequestSchema:Cn,CreateMessageResultSchema:In,CreateMessageResultWithToolsSchema:On,BooleanSchemaSchema:Mn,StringSchemaSchema:qn,NumberSchemaSchema:Nn,UntitledSingleSelectEnumSchemaSchema:An,TitledSingleSelectEnumSchemaSchema:jn,LegacyTitledEnumSchemaSchema:Ln,SingleSelectEnumSchemaSchema:Un,UntitledMultiSelectEnumSchemaSchema:Gt,TitledMultiSelectEnumSchemaSchema:Yt,MultiSelectEnumSchemaSchema:va,EnumSchemaSchema:za,PrimitiveSchemaDefinitionSchema:ve,ElicitRequestFormParamsSchema:ze,ElicitRequestURLParamsSchema:Zn,ElicitRequestParamsSchema:Ne,ElicitRequestSchema:Ra,ElicitationCompleteNotificationParamsSchema:wa,ElicitationCompleteNotificationSchema:xa,ElicitResultSchema:Ta,ResourceTemplateReferenceSchema:Pa,PromptReferenceSchema:Ea,CompleteRequestParamsSchema:ka,CompleteRequestSchema:Dn,CompleteResultSchema:$a,RootSchema:Ca,ListRootsRequestSchema:Uo,ListRootsResultSchema:Hn,RootsListChangedNotificationSchema:Ia,TaskCreationParamsSchema:Oa,TaskStatusSchema:Fn,TaskSchema:zt,CreateTaskResultSchema:Se,TaskStatusNotificationParamsSchema:Ma,TaskStatusNotificationSchema:Qt,GetTaskRequestSchema:Zo,GetTaskResultSchema:Do,GetTaskPayloadRequestSchema:Ho,GetTaskPayloadResultSchema:ru,ListTasksRequestSchema:pe,ListTasksResultSchema:Q,CancelTaskRequestSchema:Xt,CancelTaskResultSchema:_.merge(zt),ClientRequestSchema:x([St,Ut,Dn,zn,gn,hn,Qr,bt,tn,sn,cn,yn,No,Zo,Ho,pe,Xt]),ClientNotificationSchema:x([I,_t,Po,Ia,Qt]),ClientResultSchema:x([E,In,On,Ta,Hn,Do,Q,Se]),ServerRequestSchema:x([St,Cn,Ra,Uo,Zo,Ho,pe,Xt]),ServerNotificationSchema:x([I,_t,wn,un,rn,ba,Wt,Qt,xa]),ServerResultSchema:x([E,Gr,$a,Mo,mn,Xr,Io,on,jo,Ao,Do,Q,Se]),CallToolResultWireSchema:T().superRefine((ce,F_)=>{if(!(typeof ce!="object"||ce===null||Array.isArray(ce)||ce.content!==void 0)){for(let Cf of KS)if(Cf in ce){F_.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(Qy).pipe(jo)}}var ev;function GS(){return ev??=Xy()}function YS(e){return e.type!=="object"}var tv=new Set(["const","enum","default","examples"]),ov=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function NS(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function rv(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(NS(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let o=qf(e.$schema)&&e.$recursiveAnchor!==!0,r=(n,s)=>{if(Array.isArray(n))return n.map(u=>r(u,!1));if(n===null||typeof n!="object"||!s&&NS(n.$id))return n;let a={},l=!1;for(let[u,d]of Object.entries(n))s?a[u]=r(d,!1):(u==="$ref"||u==="$dynamicRef")&&typeof d=="string"?a[u]=d==="#"?"#/properties/result":d.startsWith("#/")?`#/properties/result${d.slice(1)}`:d:u==="$recursiveRef"&&d==="#"&&o?l=!0:tv.has(u)?a[u]=d:ov.has(u)?a[u]=r(d,!0):a[u]=r(d,!1);return l&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};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},nv={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 hf(){if(Bl)return Bl;let e=GS();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 sv(e){return Object.prototype.hasOwnProperty.call(nv,e)}function iv(e){return sv(e)?hf().resultSchemas[e]:void 0}function av(e){return e_(e)?hf().requestSchemas[e]:void 0}function cv(e){return t_(e)?hf().notificationSchemas[e]:void 0}var Zw=Object.keys(QS),Dw=Object.keys(XS);function cf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Wl(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 AS={ok:!1,reason:"not-in-era"};function jS(e){return cf(e)&&cf(e.outputSchema)&&YS(e.outputSchema)}var mf={era:"2025-11-25",hasRequestMethod:e_,hasNotificationMethod:t_,validateRequest:(e,t)=>Wl(av(e),t),validateResult:(e,t)=>Wl(iv(e),t),validateNotification:(e,t)=>Wl(cv(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>AS,validateInputResponse:()=>AS,samplingResultVariant:((e,t)=>{let o=GS();return Wl(e?o.CreateMessageResultWithToolsSchema:o.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let o=WS(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(cf(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:rv(r.outputSchema)}:r)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function lv(){let e=Mt(()=>x([c(),b(),R(),Je(),z(c(),e),f(e)])),t=z(c(),e),o=x([c(),b().int()]),r=c(),n=x([c(),b().int()]),s=C(["user","assistant"]),a=C(["debug","info","notice","warning","error","critical","alert","emergency"]),l=c().refine(Q=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),u=p({ttl:b().optional()}),d=p({taskId:c()}),m=k({progressToken:o.optional(),"io.modelcontextprotocol/related-task":d.optional()}),S=p({_meta:m.optional()}),_=S.extend({task:u.optional()}),y=p({_meta:m.optional()}),E=p({method:c(),params:y.loose().optional()}),$=p({src:c(),mimeType:c().optional(),sizes:f(c()).optional(),theme:C(["light","dark"]).optional()}),I=p({icons:f($).optional()}),H=p({name:c(),title:c().optional()}),G=H.extend({...H.shape,...I.shape,version:c(),websiteUrl:c().optional(),description:c().optional()}),U=Le(p({applyDefaults:R().optional()}),t),j=it(Q=>Q&&typeof Q=="object"&&!Array.isArray(Q)&&Object.keys(Q).length===0?{form:{}}:Q,Le(p({form:U.optional(),url:t.optional()}),t.optional())),J=k({list:t.optional(),cancel:t.optional(),requests:k({sampling:k({createMessage:t.optional()}).optional(),elicitation:k({create:t.optional()}).optional()}).optional()}),V=k({list:t.optional(),cancel:t.optional(),requests:k({tools:k({call:t.optional()}).optional()}).optional()}),ee=p({experimental:z(c(),t).optional(),sampling:p({context:t.optional(),tools:t.optional()}).optional(),elicitation:j.optional(),roots:p({listChanged:R().optional()}).optional(),tasks:J.optional(),extensions:z(c(),t).optional()}),Xe=p({experimental:z(c(),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:V.optional(),extensions:z(c(),t).optional()}),de=p({progress:b(),total:P(b()),message:P(c())}),gt=p({...y.shape,...de.shape,progressToken:o}),Ut=E.extend({method:g("notifications/progress"),params:gt}),Kr=y.extend({level:a,logger:c().optional(),data:T()}),Gr=E.extend({method:g("notifications/message"),params:Kr}),Po=p({uri:c(),mimeType:P(c()),_meta:z(c(),T()).optional()}),St=Po.extend({text:c()}),Zt=Po.extend({blob:l}),Ue=p({audience:f(s).optional(),priority:b().min(0).max(1).optional(),lastModified:xe.datetime({offset:!0}).optional()}),_t=p({...H.shape,...I.shape,uri:c(),description:P(c()),mimeType:P(c()),size:P(b()),annotations:Ue.optional(),_meta:P(k({}))}),Eo=p({...H.shape,...I.shape,uriTemplate:c(),description:P(c()),mimeType:P(c()),annotations:Ue.optional(),_meta:P(k({}))}),et=E.extend({method:g("notifications/resources/list_changed"),params:y.optional()}),tt=y.extend({uri:c()}),ko=E.extend({method:g("notifications/resources/updated"),params:tt}),$o=p({name:c(),description:P(c()),required:P(R())}),Dt=p({...H.shape,...I.shape,description:P(c()),arguments:P(f($o)),_meta:P(k({}))}),Co=E.extend({method:g("notifications/prompts/list_changed"),params:y.optional()}),Ze=p({type:g("text"),text:c(),annotations:Ue.optional(),_meta:z(c(),T()).optional()}),qe=p({type:g("image"),data:l,mimeType:c(),annotations:Ue.optional(),_meta:z(c(),T()).optional()}),Ht=p({type:g("audio"),data:l,mimeType:c(),annotations:Ue.optional(),_meta:z(c(),T()).optional()}),Yr=p({type:g("tool_use"),name:c(),id:c(),input:z(c(),T()),_meta:z(c(),T()).optional()}),Qr=p({type:g("resource"),resource:x([St,Zt]),annotations:Ue.optional(),_meta:z(c(),T()).optional()}),Xr=_t.extend({type:g("resource_link")}),bt=x([Ze,qe,Ht,Xr,Qr]),Io=p({role:s,content:bt}),Ft=p({title:c().optional(),readOnlyHint:R().optional(),destructiveHint:R().optional(),idempotentHint:R().optional(),openWorldHint:R().optional()}),en=E.extend({method:g("notifications/tools/list_changed"),params:y.optional()}),tn=p({name:c().optional()}),on=p({hints:f(tn).optional(),costPriority:b().min(0).max(1).optional(),speedPriority:b().min(0).max(1).optional(),intelligencePriority:b().min(0).max(1).optional()}),rn=p({mode:C(["auto","required","none"]).optional()}),nn=p({type:g("boolean"),title:c().optional(),description:c().optional(),default:R().optional()}),sn=p({type:g("string"),title:c().optional(),description:c().optional(),minLength:b().optional(),maxLength:b().optional(),format:C(["email","uri","date","date-time"]).optional(),default:c().optional()}),an=p({type:C(["number","integer"]),title:c().optional(),description:c().optional(),minimum:b().optional(),maximum:b().optional(),default:b().optional()}),cn=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),default:c().optional()}),ln=p({type:g("string"),title:c().optional(),description:c().optional(),oneOf:f(p({const:c(),title:c()})),default:c().optional()}),un=p({type:g("string"),title:c().optional(),description:c().optional(),enum:f(c()),enumNames:f(c()).optional(),default:c().optional()}),dn=x([cn,ln]),pn=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({type:g("string"),enum:f(c())}),default:f(c()).optional()}),hn=p({type:g("array"),title:c().optional(),description:c().optional(),minItems:b().optional(),maxItems:b().optional(),items:p({anyOf:f(p({const:c(),title:c()}))}),default:f(c()).optional()}),mn=x([pn,hn]),fn=x([un,dn,mn]),gn=x([fn,nn,sn,an]),Vt=_.extend({mode:g("form").optional(),message:c(),requestedSchema:p({type:g("object"),properties:z(c(),gn),required:f(c()).optional()}).catchall(T())}),Jt=p({type:g("ref/resource"),uri:c()}),Bt=p({type:g("ref/prompt"),name:c()}),Sn=p({uri:c().startsWith("file://"),name:c().optional(),_meta:z(c(),T()).optional()}),yt=ee.shape,_n=p({experimental:yt.experimental,sampling:yt.sampling,elicitation:yt.elicitation,roots:yt.roots,extensions:yt.extensions}),Ce=Xe.shape,Oo=p({experimental:Ce.experimental,logging:Ce.logging,completions:Ce.completions,prompts:Ce.prompts,resources:Ce.resources,tools:Ce.tools,extensions:Ce.extensions}),Mo=k({progressToken:o.optional(),[lo]:c(),[yr]:G.optional(),[uo]:_n,[vr]:a.optional()}),Wt=p({...H.shape,...I.shape,description:c().optional(),inputSchema:k({$schema:c().optional(),type:g("object")}),outputSchema:k({$schema:c().optional()}).optional(),annotations:Ft.optional(),_meta:z(c(),T()).optional()}),bn=p({type:g("tool_result"),toolUseId:c(),content:f(bt),structuredContent:T().optional(),isError:R().optional(),_meta:z(c(),T()).optional()}),qo=x([Ze,qe,Ht,Yr,bn]),Kt=p({role:s,content:x([qo,f(qo)]),_meta:z(c(),T()).optional()}),No=c(),Ao=k({[Nt]:G.optional().catch(void 0)}),jo=Ao.optional();function ae(Q){return k({_meta:jo,resultType:No.default("complete"),...Q})}let yn=ae({}),ba=ae({nextCursor:r.optional()}),Lo=ae({content:f(bt),structuredContent:T().optional(),isError:R().optional()}),vn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),tools:f(Wt),nextCursor:r.optional()}),zn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),prompts:f(Dt),nextCursor:r.optional()}),Rn=ae({description:c().optional(),messages:f(Io)}),wn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),resources:f(_t),nextCursor:r.optional()}),xn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:f(Eo),nextCursor:r.optional()}),Tn=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),contents:f(x([St,Zt]))}),Pn=ae({completion:p({values:f(c()).max(100),total:b().int().optional(),hasMore:R().optional()}).loose()}),ya=ae({ttlMs:b().int().min(0),cacheScope:C(["public","private"])}),En=ae({ttlMs:b().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:f(c()),capabilities:Oo,instructions:c().optional()}),vt=p({messages:f(Kt),modelPreferences:on.optional(),systemPrompt:c().optional(),includeContext:C(["none","thisServer","allServers"]).optional(),temperature:b().optional(),maxTokens:b().int(),stopSequences:f(c()).optional(),metadata:t.optional(),tools:f(Wt).optional(),toolChoice:rn.optional()}),kn=p({method:g("sampling/createMessage"),params:vt}),$n=p({method:g("roots/list"),params:p({_meta:z(c(),T()).optional()}).optional()}),Cn=p({...Kt.shape,model:c(),stopReason:c().optional()}),In=p({roots:f(Sn)}),On=p({action:C(["accept","decline","cancel"]),content:z(c(),x([c(),b(),R(),f(c())])).optional()}),Mn=p({mode:g("url"),message:c(),url:c().url()}),qn=x([Vt,Mn]),Nn=p({method:g("elicitation/create"),params:qn}),An=x([kn,$n,Nn]),jn=x([Cn,In,On]),Ln=z(c(),An),Un=z(c(),jn),Gt=ae({inputRequests:Ln.optional(),requestState:c().optional()}),Yt={inputResponses:Un.optional(),requestState:c().optional()},va=p({_meta:Mo,...Yt}),za=k({progressToken:o.optional()});function ve(Q,Xt){return p({method:g(Q),params:p({_meta:Mo,...Xt})})}function ze(Q,Xt){return p({method:g(Q),params:p({_meta:za.optional(),...Xt}).optional()})}let Zn={name:c(),arguments:z(c(),T()).optional(),...Yt},Ne={cursor:r.optional()},Ra=ve("tools/call",Zn),wa=ve("tools/list",Ne),xa=ve("prompts/list",Ne),Ta=ve("prompts/get",{name:c(),arguments:z(c(),c()).optional(),...Yt}),Pa=ve("resources/list",Ne),Ea=ve("resources/templates/list",Ne),ka=ve("resources/read",{uri:c(),...Yt}),Dn={ref:x([Bt,Jt]),argument:p({name:c(),value:c()}),context:p({arguments:z(c(),c()).optional()}).optional()},$a=ve("completion/complete",Dn),Ca=ve("server/discover",{}),Uo=p({toolsListChanged:R().optional(),promptsListChanged:R().optional(),resourcesListChanged:R().optional(),resourceSubscriptions:f(c()).optional()}),Hn={notifications:Uo},Ia=ve("subscriptions/listen",Hn),Oa=Ao.extend({"io.modelcontextprotocol/subscriptionId":n}),Fn=k({_meta:Oa,resultType:No.default("complete")}),zt={"tools/call":ze("tools/call",Zn),"tools/list":ze("tools/list",Ne),"prompts/get":ze("prompts/get",{name:c(),arguments:z(c(),c()).optional()}),"prompts/list":ze("prompts/list",Ne),"resources/list":ze("resources/list",Ne),"resources/templates/list":ze("resources/templates/list",Ne),"resources/read":ze("resources/read",{uri:c()}),"completion/complete":ze("completion/complete",Dn),"server/discover":ze("server/discover",{}),"subscriptions/listen":ze("subscriptions/listen",Hn)};function Se(Q){return k({_meta:jo,...Q})}let Ma={"tools/call":Se({content:f(bt),structuredContent:T().optional(),isError:R().optional()}),"tools/list":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),tools:f(Wt),nextCursor:r.optional()}),"prompts/get":Se({description:c().optional(),messages:f(Io)}),"prompts/list":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),prompts:f(Dt),nextCursor:r.optional()}),"resources/list":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),resources:f(_t),nextCursor:r.optional()}),"resources/templates/list":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),resourceTemplates:f(Eo),nextCursor:r.optional()}),"resources/read":Se({ttlMs:b().int().min(0),cacheScope:C(["public","private"]),contents:f(x([St,Zt]))}),"completion/complete":Se({completion:p({values:f(c()).max(100),total:b().int().optional(),hasMore:R().optional()}).loose()}),"server/discover":Se({ttlMs:b().int().min(0).catch(0),cacheScope:C(["public","private"]).catch("private"),supportedVersions:f(c()),capabilities:Oo,instructions:c().optional()}),"subscriptions/listen":Se({})},Qt=k({"io.modelcontextprotocol/subscriptionId":n.optional()}),Zo=p({method:g("notifications/subscriptions/acknowledged"),params:p({_meta:Qt.optional(),notifications:Uo})}),Do=p({_meta:Qt.optional(),requestId:n,reason:c().optional()}),Ho=p({method:g("notifications/cancelled"),params:Do}),ru={"notifications/cancelled":Ho,"notifications/progress":Ut,"notifications/message":Gr,"notifications/resources/updated":ko,"notifications/resources/list_changed":et,"notifications/tools/list_changed":en,"notifications/prompts/list_changed":Co,"notifications/subscriptions/acknowledged":Zo},pe=Q=>p({jsonrpc:g("2.0"),id:x([c(),b().int()]),result:Q}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:o,CursorSchema:r,RequestIdSchema:n,RoleSchema:s,LoggingLevelSchema:a,TaskMetadataSchema:u,RelatedTaskMetadataSchema:d,RequestMetaSchema:m,BaseRequestParamsSchema:S,TaskAugmentedRequestParamsSchema:_,NotificationsParamsSchema:y,NotificationSchema:E,IconSchema:$,IconsSchema:I,BaseMetadataSchema:H,ImplementationSchema:G,ClientTasksCapabilitySchema:J,ServerTasksCapabilitySchema:V,ClientCapabilitiesSchema:ee,ServerCapabilitiesSchema:Xe,ProgressSchema:de,ProgressNotificationParamsSchema:gt,ProgressNotificationSchema:Ut,LoggingMessageNotificationParamsSchema:Kr,LoggingMessageNotificationSchema:Gr,ResourceContentsSchema:Po,TextResourceContentsSchema:St,BlobResourceContentsSchema:Zt,AnnotationsSchema:Ue,ResourceSchema:_t,ResourceTemplateSchema:Eo,ResourceListChangedNotificationSchema:et,ResourceUpdatedNotificationParamsSchema:tt,ResourceUpdatedNotificationSchema:ko,PromptArgumentSchema:$o,PromptSchema:Dt,PromptListChangedNotificationSchema:Co,TextContentSchema:Ze,ImageContentSchema:qe,AudioContentSchema:Ht,ToolUseContentSchema:Yr,EmbeddedResourceSchema:Qr,ResourceLinkSchema:Xr,ContentBlockSchema:bt,PromptMessageSchema:Io,ToolAnnotationsSchema:Ft,ToolListChangedNotificationSchema:en,ModelHintSchema:tn,ModelPreferencesSchema:on,ToolChoiceSchema:rn,BooleanSchemaSchema:nn,StringSchemaSchema:sn,NumberSchemaSchema:an,UntitledSingleSelectEnumSchemaSchema:cn,TitledSingleSelectEnumSchemaSchema:ln,LegacyTitledEnumSchemaSchema:un,SingleSelectEnumSchemaSchema:dn,UntitledMultiSelectEnumSchemaSchema:pn,TitledMultiSelectEnumSchemaSchema:hn,MultiSelectEnumSchemaSchema:mn,EnumSchemaSchema:fn,PrimitiveSchemaDefinitionSchema:gn,ElicitRequestFormParamsSchema:Vt,ResourceTemplateReferenceSchema:Jt,PromptReferenceSchema:Bt,RootSchema:Sn,ClientCapabilities2026Schema:_n,ServerCapabilities2026Schema:Oo,RequestMetaEnvelopeSchema:Mo,ToolSchema:Wt,ToolResultContentSchema:bn,SamplingMessageContentBlockSchema:qo,SamplingMessageSchema:Kt,ResultTypeSchema:No,ResultMetaSchema:Ao,ResultSchema:yn,PaginatedResultSchema:ba,CallToolResultSchema:Lo,ListToolsResultSchema:vn,ListPromptsResultSchema:zn,GetPromptResultSchema:Rn,ListResourcesResultSchema:wn,ListResourceTemplatesResultSchema:xn,ReadResourceResultSchema:Tn,CompleteResultSchema:Pn,CacheableResultSchema:ya,DiscoverResultSchema:En,CreateMessageRequestParamsSchema:vt,CreateMessageRequestSchema:kn,ListRootsRequestSchema:$n,CreateMessageResultSchema:Cn,ListRootsResultSchema:In,ElicitResultSchema:On,ElicitRequestURLParamsSchema:Mn,ElicitRequestParamsSchema:qn,ElicitRequestSchema:Nn,InputRequestSchema:An,InputResponseSchema:jn,InputRequestsSchema:Ln,InputResponsesSchema:Un,InputRequiredResultSchema:Gt,InputResponseRequestParamsSchema:va,CallToolRequestSchema:Ra,ListToolsRequestSchema:wa,ListPromptsRequestSchema:xa,GetPromptRequestSchema:Ta,ListResourcesRequestSchema:Pa,ListResourceTemplatesRequestSchema:Ea,ReadResourceRequestSchema:ka,CompleteRequestSchema:$a,DiscoverRequestSchema:Ca,SubscriptionFilterSchema:Uo,SubscriptionsListenRequestSchema:Ia,SubscriptionsListenResultMetaSchema:Oa,SubscriptionsListenResultSchema:Fn,dispatchRequestSchemas:zt,dispatchResultSchemas:Ma,NotificationMetaSchema:Qt,SubscriptionsAcknowledgedNotificationSchema:Zo,CancelledNotificationParamsSchema:Do,CancelledNotificationSchema:Ho,notificationSchemas2026:ru,JSONRPCResultResponseSchema:pe(yn),CallToolResultResponseSchema:pe(x([Lo,Gt])),ListToolsResultResponseSchema:pe(vn),ListPromptsResultResponseSchema:pe(zn),GetPromptResultResponseSchema:pe(x([Rn,Gt])),ListResourcesResultResponseSchema:pe(wn),ListResourceTemplatesResultResponseSchema:pe(xn),ReadResourceResultResponseSchema:pe(x([Tn,Gt])),CompleteResultResponseSchema:pe(Pn),DiscoverResultResponseSchema:pe(En),SubscriptionsListenResultResponseSchema:pe(Fn)}}var uv;function jt(){return uv??=lv()}var dv=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function pv(e){return dv.includes(e)}var ff=Symbol("modelcontextprotocol.resultCacheHintFallback");function hv(e){return e[ff]}function o_(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function r_(e){return e==="public"||e==="private"}var A=(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})({}),ie=class n_ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return ke(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 ke(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===A.UrlElicitationRequired&&r){let n=r;if(n.elicitations)return new i_(n.elicitations,o)}if(t===A.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===A.InvalidParams||t===A.ResourceNotFound){let n=r;if(typeof n?.uri=="string"&&(t===A.ResourceNotFound||Object.keys(n).length===1))return new s_(n.uri,o)}if(t===A.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 ie{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(A.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},i_=class extends ie{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(A.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},a_=class extends ie{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(A.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},c_=class extends ie{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(A.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},mv=0,fv="private",gv=["tools/call","prompts/get","resources/read"];function Sv(e,t){let o=t.resultType;if(o===void 0)return{...t,resultType:"complete"};if(o==="complete"||gv.includes(e))return t;throw new ie(A.InternalError,`Handler for ${e} returned resultType '${String(o)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function _v(e,t){let o=hv(t);if(t.resultType!=="complete"||!pv(e))return o===void 0?t:Rv(t);let r=t,n=o_(r.ttlMs)?r.ttlMs:vv(o),s=r_(r.cacheScope)?r.cacheScope:zv(o),a={...r,ttlMs:n,cacheScope:s};return delete a[ff],a}function bv(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function yv(e,t){if(t===void 0)return e;let o=e._meta;return o===void 0?{...e,_meta:{[Nt]:t}}:!bv(o)||o[Nt]!==void 0?e:{...e,_meta:{...o,[Nt]:t}}}function vv(e){return e!==void 0&&o_(e.ttlMs)?e.ttlMs:mv}function zv(e){return e!==void 0&&r_(e.cacheScope)?e.cacheScope:fv}function Rv(e){let t={...e};return delete t[ff],t}var wv=["elicitation/create","sampling/createMessage","roots/list"],Kl;function l_(){if(Kl)return Kl;let e=jt();return Kl={request:{"elicitation/create":p({method:g("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":p({method:g("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":p({method:g("roots/list"),params:k({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Kl}function u_(e){return wv.includes(e)}function tf(e){return u_(e)?l_().request[e]:void 0}function xv(e){return u_(e)?l_().response[e]:void 0}var gf={"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(gf,e)}function h_(e){return Object.prototype.hasOwnProperty.call(d_,e)}function Tv(e){return Object.prototype.hasOwnProperty.call(gf,e)}function Pv(e){return p_(e)?jt().dispatchRequestSchemas[e]:void 0}function Ev(e){return Tv(e)?jt().dispatchResultSchemas[e]:void 0}function kv(e){return h_(e)?jt().notificationSchemas2026[e]:void 0}var Hw=Object.keys(gf),Fw=Object.keys(d_);function ua(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function ca(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 $v={ok:!1,reason:"not-in-era"},Cv=[lo,uo];function Iv(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(l=>ua(l)&&"execution"in l)&&(n().tools=s.map(l=>{if(!ua(l)||!("execution"in l))return l;let u={...l};return delete u.execution,u}));let a=t.capabilities;if(ua(a)&&"tasks"in a){let l={...a};delete l.tasks,n().capabilities=l}return o}var Sf={era:"2026-07-28",hasRequestMethod:p_,hasNotificationMethod:h_,hasInputRequestMethod:e=>tf(e)!==void 0,validateRequest:(e,t)=>ca(Pv(e),t),validateResult:(e,t)=>ca(Ev(e),t),validateNotification:(e,t)=>ca(kv(e),t),validateInputRequest:(e,t)=>ca(tf(e),t),validateInputResponse:(e,t)=>ca(xv(e),t),samplingResultVariant:()=>$v,outboundEnvelope(e){return{[lo]:e.protocolVersion,[yr]:e.clientInfo,[uo]:e.clientCapabilities,...e.logLevel!==void 0&&{[vr]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let r of Cv)r in e||t.push({key:r,problem:"missing"});let o=jt().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(a=>a.key===s&&a.problem==="missing")||t.push({key:s,problem:r.message})}return t},projectCallToolResult:e=>WS(e),inputRequestSchema:tf,decodeResult(e,t){if(!ua(t))return{kind:"invalid",error:new X(se.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let o=t.resultType;if(o===void 0)return{kind:"invalid",error:new X(se.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 X(se.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:o})};if(o==="input_required"){let a=t.inputRequests,l=ua(a)?a:{},u=t.requestState,d=t._meta===void 0?void 0:jt().ResultMetaSchema.safeParse(t._meta),m=d?.success?d.data:void 0;return Object.keys(l).length===0&&typeof u!="string"?{kind:"invalid",error:new X(se.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:l,...typeof u=="string"&&{requestState:u},...m!==void 0&&{_meta:m}}}if(o!=="complete")return{kind:"invalid",error:new X(se.UnsupportedResultType,`Unsupported result type '${o}' for ${e}`,{resultType:o,method:e})};let r=Ov(),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 X(se.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let s={...t};return delete s.resultType,{kind:"complete",result:s}},encodeResult(e,t,o){return yv(_v(e,Sv(e,Iv(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=jt().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("; ")}`}},Gl;function Ov(){if(Gl)return Gl;let e=jt();return Gl={"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},Gl}var _f="2026-07-28";function pa(e){return e!==void 0&&BS(e)?Sf:mf}function LS(e){return e.revision!==void 0?pa(e.revision).era:e.era==="modern"?Sf.era:mf.era}function of(e){return m_.some(t=>t.hasRequestMethod(e))}function rf(e){return m_.some(t=>t.hasNotificationMethod(e))}function US(e){return e==="tasks/get"||e==="tasks/cancel"}var m_=[mf,Sf],Mv=Of({AnnotationsSchema:()=>Ke,AudioContentSchema:()=>_o,BaseMetadataSchema:()=>Be,BaseRequestParamsSchema:()=>oe,BlobResourceContentsSchema:()=>qr,BooleanSchemaSchema:()=>Lr,CallToolRequestParamsSchema:()=>Si,CallToolRequestSchema:()=>_i,CallToolResultSchema:()=>Ye,CancelTaskRequestSchema:()=>Al,CancelTaskResultSchema:()=>jl,CancelledNotificationParamsSchema:()=>xs,CancelledNotificationSchema:()=>Er,ClientCapabilitiesSchema:()=>Ps,ClientNotificationSchema:()=>Ul,ClientRequestSchema:()=>Ll,ClientResultSchema:()=>Zl,ClientTasksCapabilitySchema:()=>wl,CompatibilityCallToolResultSchema:()=>Tl,CompleteRequestParamsSchema:()=>Fi,CompleteRequestSchema:()=>Vi,CompleteResultSchema:()=>Ji,ContentBlockSchema:()=>Ee,CreateMessageRequestParamsSchema:()=>ki,CreateMessageRequestSchema:()=>$i,CreateMessageResultSchema:()=>Ci,CreateMessageResultWithToolsSchema:()=>Ii,CreateTaskResultSchema:()=>kl,CursorSchema:()=>Rr,DiscoverRequestSchema:()=>Is,DiscoverResultSchema:()=>$r,ElicitRequestFormParamsSchema:()=>zo,ElicitRequestParamsSchema:()=>Ai,ElicitRequestSchema:()=>ji,ElicitRequestURLParamsSchema:()=>Ni,ElicitResultSchema:()=>Zi,ElicitationCompleteNotificationParamsSchema:()=>Li,ElicitationCompleteNotificationSchema:()=>Ui,EmbeddedResourceSchema:()=>ht,EmptyResultSchema:()=>We,EnumSchemaSchema:()=>qi,GetPromptRequestParamsSchema:()=>ai,GetPromptRequestSchema:()=>ci,GetPromptResultSchema:()=>di,GetTaskPayloadRequestSchema:()=>Ol,GetTaskPayloadResultSchema:()=>Ml,GetTaskRequestSchema:()=>Cl,GetTaskResultSchema:()=>Il,IconSchema:()=>Ts,IconsSchema:()=>lt,ImageContentSchema:()=>So,ImplementationSchema:()=>Pe,InitializeRequestParamsSchema:()=>Es,InitializeRequestSchema:()=>ks,InitializeResultSchema:()=>$s,InitializedNotificationSchema:()=>Cs,JSONArraySchema:()=>zl,JSONObjectSchema:()=>B,JSONRPCErrorResponseSchema:()=>mo,JSONRPCMessageSchema:()=>ct,JSONRPCNotificationSchema:()=>Pr,JSONRPCRequestSchema:()=>Tr,JSONRPCResponseSchema:()=>Rl,JSONRPCResultResponseSchema:()=>ho,JSONValueSchema:()=>at,LegacyTitledEnumSchemaSchema:()=>Dr,ListChangedOptionsBaseSchema:()=>Pl,ListPromptsRequestSchema:()=>si,ListPromptsResultSchema:()=>ii,ListResourceTemplatesRequestSchema:()=>Ls,ListResourceTemplatesResultSchema:()=>Us,ListResourcesRequestSchema:()=>As,ListResourcesResultSchema:()=>js,ListRootsRequestSchema:()=>Wi,ListRootsResultSchema:()=>Ki,ListTasksRequestSchema:()=>ql,ListTasksResultSchema:()=>Nl,ListToolsRequestSchema:()=>fi,ListToolsResultSchema:()=>gi,LoggingLevelSchema:()=>jr,LoggingMessageNotificationParamsSchema:()=>zi,LoggingMessageNotificationSchema:()=>bo,ModelHintSchema:()=>Ri,ModelPreferencesSchema:()=>wi,MultiSelectEnumSchemaSchema:()=>Mi,NotificationSchema:()=>ne,NotificationsParamsSchema:()=>ue,NumberSchemaSchema:()=>vo,PaginatedRequestParamsSchema:()=>qs,PaginatedRequestSchema:()=>ut,PaginatedResultSchema:()=>dt,PingRequestSchema:()=>Cr,PrimitiveSchemaDefinitionSchema:()=>Vr,ProgressNotificationParamsSchema:()=>Ms,ProgressNotificationSchema:()=>Ir,ProgressSchema:()=>Os,ProgressTokenSchema:()=>zr,PromptArgumentSchema:()=>ri,PromptListChangedNotificationSchema:()=>pi,PromptMessageSchema:()=>ui,PromptReferenceSchema:()=>Hi,PromptSchema:()=>ni,ReadResourceRequestParamsSchema:()=>Zs,ReadResourceRequestSchema:()=>Ds,ReadResourceResultSchema:()=>Hs,RelatedTaskMetadataSchema:()=>ws,RequestIdSchema:()=>Te,RequestMetaSchema:()=>wr,RequestSchema:()=>W,ResourceContentsSchema:()=>Or,ResourceLinkSchema:()=>mt,ResourceListChangedNotificationSchema:()=>Fs,ResourceRequestParamsSchema:()=>fo,ResourceSchema:()=>Nr,ResourceTemplateReferenceSchema:()=>Di,ResourceTemplateSchema:()=>Ns,ResourceUpdatedNotificationParamsSchema:()=>ti,ResourceUpdatedNotificationSchema:()=>oi,ResultMetaObjectSchema:()=>xr,ResultSchema:()=>K,RoleSchema:()=>pt,RootSchema:()=>Bi,RootsListChangedNotificationSchema:()=>Gi,SamplingContentSchema:()=>Pi,SamplingMessageContentBlockSchema:()=>qt,SamplingMessageSchema:()=>Ei,ServerCapabilitiesSchema:()=>kr,ServerNotificationSchema:()=>Hl,ServerRequestSchema:()=>Dl,ServerResultSchema:()=>Fl,ServerTasksCapabilitySchema:()=>xl,SetLevelRequestParamsSchema:()=>yi,SetLevelRequestSchema:()=>vi,SingleSelectEnumSchemaSchema:()=>Oi,StringSchemaSchema:()=>yo,SubscribeRequestParamsSchema:()=>Vs,SubscribeRequestSchema:()=>Js,SubscriptionFilterSchema:()=>Ar,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Ys,SubscriptionsAcknowledgedNotificationSchema:()=>Qs,SubscriptionsListenRequestParamsSchema:()=>Ks,SubscriptionsListenRequestSchema:()=>Gs,SubscriptionsListenResultMetaSchema:()=>Xs,SubscriptionsListenResultSchema:()=>ei,TaskAugmentedRequestParamsSchema:()=>At,TaskCreationParamsSchema:()=>El,TaskMetadataSchema:()=>Rs,TaskSchema:()=>ft,TaskStatusNotificationParamsSchema:()=>Qi,TaskStatusNotificationSchema:()=>$l,TaskStatusSchema:()=>Yi,TextContentSchema:()=>go,TextResourceContentsSchema:()=>Mr,TitledMultiSelectEnumSchemaSchema:()=>Fr,TitledSingleSelectEnumSchemaSchema:()=>Zr,ToolAnnotationsSchema:()=>hi,ToolChoiceSchema:()=>xi,ToolExecutionSchema:()=>mi,ToolListChangedNotificationSchema:()=>bi,ToolResultContentSchema:()=>Ti,ToolSchema:()=>Ge,ToolUseContentSchema:()=>li,UnsubscribeRequestParamsSchema:()=>Bs,UnsubscribeRequestSchema:()=>Ws,UntitledMultiSelectEnumSchemaSchema:()=>Hr,UntitledSingleSelectEnumSchemaSchema:()=>Ur});var f_=e=>Tr.safeParse(e).success,g_=e=>Pr.safeParse(e).success,lf=e=>ho.safeParse(e).success,S_=e=>mo.safeParse(e).success;var da=-32020,Vw=[{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:[A.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:[da,A.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:[A.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:[A.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:[A.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:[da],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:[A.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:[da],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."}],Jw={[A.ParseError]:400,[A.InvalidRequest]:400,[A.MethodNotFound]:404,[A.UnsupportedProtocolVersion]:400,[A.MissingRequiredClientCapability]:400,[da]:400};function bf(e,t){return ds(e,t)}function la(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function uf(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,df="draft-2020-12";function qv(e,t="input"){let o=e["~standard"],r;if(o.jsonSchema)r=o.jsonSchema[t]({target:df});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=ao(e,{target:df,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 nf(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=ao(e,{target:df,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var jv=/\\\.\\d\{(\d+)\}/;function Lv(e){let t=jv.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=>xe.datetime({local:r,offset:n,precision:s}))))}function Uv(e,t){let o;switch(e){case"email":o=[Gc()];break;case"uri":o=[fr()];break;case"date":o=[xe.date()];break;case"date-time":o=Lv(t);break}return new Set(o.map(r=>Av(r)).filter(r=>r!==void 0))}function Zv(e,t,o){return o!=="zod"?!0:Uv(e,t).has(t)}function ha(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Dv(e){try{return qv(e,"input")}catch(t){let o=t instanceof Error?t.message:String(t);throw new ie(A.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${o}`)}}var Hv=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function yf(e){return Hv.has(e)||e.startsWith("x-")}var Fv=new Set(["$schema",...Object.keys(zo.shape.requestedSchema.shape)]),DS={string:la([yo,Ur,Zr,Dr]),number:la([vo]),integer:la([vo]),boolean:la([Lr]),array:la([Hr,Fr])},Vv=new Set(yo.shape.format.unwrap().options);function Jv(e,t,o,r){if(!ha(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[a,l]of Object.entries(e))n.has(a)||yf(a)?s[a]=l:a==="pattern"&&e.type==="string"&&typeof e.format=="string"?Vv.has(e.format)?(typeof l!="string"||!Zv(e.format,l,o))&&r.push(`${t}.${a}`):s[a]=l:r.push(`${t}.${a}`);return s}function Bv(e,t){let o={},r=[];for(let[n,s]of Object.entries(e))n==="properties"&&ha(s)?o[n]=Object.fromEntries(Object.entries(s).map(([a,l])=>[a,Jv(l,`properties.${a}`,t,r)])):Fv.has(n)?o[n]=s:yf(n)||r.push(n);if(r.length>0)throw new ie(A.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(", ")}`);return o}function Wv(e,t){if(!ha(e.properties))return t;let o=Object.entries(e.properties).filter(([,r])=>!bf(Vr,r).success).map(([r])=>`properties.${r}`);return o.length>0?o.join(", "):t}function pf(e,t,o=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((r,n)=>pf(r,t[n],`${o}[${n}]`)):!ha(e)||!ha(t)?[]:Object.entries(e).flatMap(([r,n])=>{let s=o?`${o}.${r}`:r;return Object.prototype.hasOwnProperty.call(t,r)?pf(n,t[r],s):yf(r)?[]:[s]})}function Kv(e){if(!uf(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,o=Bv(Dv(e.requestedSchema),t),r=bf(zo.shape.requestedSchema,o);if(!r.success)throw new ie(A.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${Wv(o,r.error.message)}`);let n=pf(o,r.data);if(n.length>0)throw new ie(A.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);let s=(r.data.required??[]).filter(a=>!Object.prototype.hasOwnProperty.call(r.data.properties,a));if(s.length>0)throw new ie(A.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 Bw=Object.assign(Gv,{elicit(e){try{return{method:"elicitation/create",params:Kv(e)}}catch(t){throw t instanceof ie?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 Yv=["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"],Qv={IdJagTokenExchangeResponseSchema:ra,OAuthClientInformationFullSchema:aa,OAuthClientInformationSchema:ia,OAuthClientMetadataSchema:sa,OAuthClientRegistrationErrorSchema:Vl,OAuthErrorResponseSchema:na,OAuthMetadataSchema:Jr,OAuthProtectedResourceMetadataSchema:Xi,OAuthTokenRevocationRequestSchema:Jl,OAuthTokensSchema:oa,OpenIdProviderDiscoveryMetadataSchema:ta,OpenIdProviderMetadataSchema:ea},b_={},y_={};function v_(e,t){let o=e.slice(0,-6);b_[o]=t,y_[o]=r=>t.safeParse(r).success}for(let e of Yv)v_(e,Mv[e]);for(let[e,t]of Object.entries(Qv))v_(e,t);var Xv=Object.freeze(b_),ez=Object.freeze(y_);function tz(e){switch(e){case"initialize":case"notifications/initialized":return pa(void 0);case"server/discover":return pa(_f);default:return}}var z_=6e4,oz=[lo,yr,uo,vr],rz=["inputResponses","requestState"];function HS(e,t){let o=e.params;if(!sf(o))return{message:e,lifted:{}};let r=o._meta,n=sf(r)?oz.filter(u=>u in r):[],s=t==="request"?rz.filter(u=>u in o):[];if(n.length===0&&s.length===0)return{message:e,lifted:{}};let a={},l={...o};if(n.length>0&&sf(r)){let u={},d={...r};for(let m of n)u[m]=r[m],delete d[m];a.envelope=u,Object.keys(d).length>0?l._meta=d:delete l._meta}for(let u of s)u==="inputResponses"&&(a.inputResponses=l[u]),u==="requestState"&&(a.requestState=l[u]),delete l[u];return{message:{...e,params:l},lifted:a}}function FS(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 R_(e){return()=>e}var nz=R_(void 0),sz,ma=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{sz=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??bl,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 X(se.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 X(se.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),lf(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 X(se.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}=HS(e,"notification"),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=LS(t.classification);if(a!==r.era){this._onerror(new Error(`Era mismatch on inbound notification '${o.method}': classified as ${a} but this instance serves ${r.era}`));return}}if(rf(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(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:o,lifted:r}=HS(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,a=($,I,H)=>{let G={jsonrpc:"2.0",id:o.id,error:{code:$,message:I,...H!==void 0&&{data:H}}};s?.send(G).catch(U=>this._onerror(new Error(`Failed to send an error response: ${U}`)))};if(t?.classification!==void 0){let $=LS(t.classification);if($!==n.era){this._onerror(new Error(`Era mismatch on inbound request '${o.method}': classified as ${$} but this instance serves ${n.era}`));let I=t.classification.revision??$;a(A.UnsupportedProtocolVersion,`Unsupported protocol version: ${I}`,{supported:this._supportedProtocolVersions,requested:I});return}}if(of(o.method)&&!n.hasRequestMethod(o.method)&&!(US(o.method)&&this._customSchemaRequestMethods.has(o.method))){a(A.MethodNotFound,"Method not found");return}let l=this._requestHandlers.get(o.method)??this.fallbackRequestHandler;if(l===void 0){a(A.MethodNotFound,"Method not found");return}let u=n.checkInboundEnvelope(r);if(u!==void 0){a(A.InvalidParams,u);return}let d=($,I)=>this._notificationViaCodec(this._resolveOutboundCodec($.method),$,{...I,relatedRequestId:o.id}),m=($,I,H)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec($.method),$,I,{...H,relatedRequestId:o.id}),S=new AbortController;this._requestHandlerAbortControllers.set(o.id,S);let _=r.inputResponses===void 0?void 0:iz(r.inputResponses),y={sessionId:s?.sessionId,mcpReq:{id:o.id,method:o.method,_meta:o.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},..._!==void 0&&{inputResponses:_.accepted},..._!==void 0&&_.droppedKeys.length>0&&{droppedInputResponseKeys:_.droppedKeys},requestState:r.requestState===void 0?nz:R_(r.requestState),signal:S.signal,send:(($,I,H)=>{let G=this._resolveOutboundCodec($.method);if(this._assertOutboundRequestInEra(G,$.method),uf(I))return m($,I,H);let U=FS(G,$.method);if(U===void 0)throw new TypeError(`'${$.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return m($,U,I)}),notify:d},http:t?.authInfo?{authInfo:t.authInfo}:void 0},E=this.buildContext(y,t);Promise.resolve().then(()=>l(o,E)).then(async $=>{if(S.signal.aborted)return;let I;try{I=n.encodeResult(o.method,$,this._outboundServerInfo())}catch(G){this._onerror(new Error(`Failed to encode result for ${o.method}: ${G}`)),a(A.InternalError,"Internal error");return}let H={result:I,jsonrpc:"2.0",id:o.id};await s?.send(H)},async $=>{if(S.signal.aborted)return;let I=Number.isSafeInteger($.code)?$.code:A.InternalError,H={jsonrpc:"2.0",id:o.id,error:{code:n.encodeErrorCode(I),message:$.message??"Internal error",...$.data!==void 0&&{data:$.data}}};await s?.send(H)}).catch($=>this._onerror(new Error(`Failed to send response: ${$}`))).finally(()=>{this._requestHandlerAbortControllers.get(o.id)===S&&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),a=this._timeoutInfo.get(r);if(a&&s&&a.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(l){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),s(l);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),lf(e)?o(e):o(ie.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(uf(t))return US(e.method)||this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,o);this._assertOutboundRequestInEra(r,e.method);let n=FS(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 pa(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=tz(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(of(t)&&!e.hasRequestMethod(t))throw new X(se.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:a,headers:l}=r??{},u=Date.now(),d,m;return new Promise((S,_)=>{let y=V=>{_(V)};if(!this._transport){y(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(V){y(V);return}if(r?.signal?.aborted){let V=r.signal.reason;throw V instanceof X?V:new X(se.RequestTimeout,String(V))}let E=e.era===_f&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,$=this._requestMessageId++;m=$;let I={...t,jsonrpc:"2.0",id:$};r?.onprogress&&(this._progressHandlers.set($,r.onprogress),I.params={...t.params,_meta:{...t.params?._meta,progressToken:$}});let H=this._envelopeOutbound(I),G=!1,U=V=>{G||(this._progressHandlers.delete($),E===void 0?t.method!=="initialize"&&this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:$,reason:String(V)}}),{relatedRequestId:n,resumptionToken:s,onresumptiontoken:a}).catch(ee=>this._onerror(new Error(`Failed to send cancellation: ${ee}`))):E.abort(),_(V instanceof X?V:new X(se.RequestTimeout,String(V))))};this._responseHandlers.set($,V=>{if(r?.signal?.aborted)return;if(G=!0,V instanceof Error)return _(V);let ee;try{ee=e.decodeResult(t.method,V.result)}catch(de){return _(de instanceof Error?de:new Error(String(de)))}if(ee.kind==="invalid")return _(ee.error);if(ee.kind==="input_required"){if(r?.allowInputRequired===!0)return S(az(ee));let de={codec:e,request:t,resultSchema:o,options:r,flowStartedAt:u,retry:(gt,Ut)=>this._requestWithSchemaViaCodec(e,gt===void 0?{method:t.method}:{method:t.method,params:gt},o,Ut)};return S(this._resolveNonCompleteResult(ee,de))}let Xe=ee.result;nf(o,Xe).then(de=>{de.success?S(de.data):_(new X(se.InvalidResult,`Invalid result for ${t.method}: ${de.error}`))},_)}),d=()=>U(r?.signal?.reason),r?.signal?.addEventListener("abort",d,{once:!0});let j=r?.timeout??z_,J=()=>U(new X(se.RequestTimeout,"Request timed out",{timeout:j}));this._setupTimeout($,j,r?.maxTotalTimeout,J,r?.resetTimeoutOnProgress??!1),this._transport.send(H,{relatedRequestId:n,resumptionToken:s,onresumptiontoken:a,headers:l,requestSignal:E?.signal}).catch(V=>{this._progressHandlers.delete($),_(V)})}).finally(()=>{d&&r?.signal?.removeEventListener("abort",d),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 X(se.NotConnected,"Not connected");if(rf(t.method)&&!e.hasNotificationMethod(t.method))throw new X(se.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(!of(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,s)=>{let a=this._negotiatedWireCodec(),l=a.validateRequest(e,n);if(!l.ok&&l.reason==="not-in-era"&&(l=a.validateInputRequest(e,n)),!l.ok)throw l.reason==="not-in-era"?new ie(A.InternalError,`No wire schema for ${e} in the resolved era`):new Error(l.message);return Promise.resolve(t(l.value,s))}}else if(o)r=async(n,s)=>{let a=await nf(t.params,{...n.params});if(!a.success)throw new ie(A.InvalidParams,`Invalid params for ${e}: ${a.error}`);return o(a.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(!rf(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 ie(A.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 nf(t.params,{...r.params});if(!n.success)throw new ie(A.InvalidParams,`Invalid params for notification ${e}: ${n.error}`);await o(n.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function sf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function VS(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function iz(e){let t={},o=[];if(!VS(e))return{accepted:t,droppedKeys:o};for(let[r,n]of Object.entries(e)){if(!VS(n)||"method"in n||"result"in n){o.push(r);continue}t[r]=n}return{accepted:t,droppedKeys:o}}function az(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState},...e._meta!==void 0&&{_meta:e._meta}}}var cz=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(l){if(!l)throw new TypeError("argument string is required");var u=typeof l=="object"?s(l):l;if(typeof u!="string")throw new TypeError("argument string is required to be a string");var d=u.indexOf(";"),m=d!==-1?u.slice(0,d).trim():u.trim();if(!r.test(m))throw new TypeError("invalid media type");var S=new a(m.toLowerCase());if(d!==-1){var _,y,E;for(t.lastIndex=d;y=t.exec(u);){if(y.index!==d)throw new TypeError("invalid parameter format");d+=y[0].length,_=y[1].toLowerCase(),E=y[2],E.charCodeAt(0)===34&&(E=E.slice(1,-1),E.indexOf("\\")!==-1&&(E=E.replace(o,"$1"))),S.parameters[_]=E}if(d!==u.length)throw new TypeError("invalid parameter format")}return S}function s(l){var u;if(typeof l.getHeader=="function"?u=l.getHeader("content-type"):typeof l.headers=="object"&&(u=l.headers&&l.headers["content-type"]),typeof u!="string")throw new TypeError("content-type header is missing from object");return u}function a(l){this.parameters=Object.create(null),this.type=l}})),Ww=Mf(cz(),1);var lz=10*1024*1024;var sx=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 uz=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,dz=[0,31,28,31,30,31,30,31,31,30,31,30,31],pz=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,hz=/^(?=.{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,mz=/^(?:[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,fz=/^(?:(?:[^\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,gz=/^(?:(?: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,Sz=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,_z=/^(?:\/(?:[^~/]|~0|~1)*)*$/,bz=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,yz=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,vz=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))},zz=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Rz=/^((([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,wz=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 Qe(e){return e.test.bind(e)}var ix={date:w_,time:x_.bind(void 0,!1),"date-time":Pz,duration:wz,uri:$z,"uri-reference":Qe(mz),"uri-template":Qe(fz),url:Qe(gz),email:vz,hostname:Qe(hz),ipv4:Qe(zz),ipv6:Qe(Rz),regex:Iz,uuid:Qe(Sz),"json-pointer":Qe(_z),"json-pointer-uri-fragment":Qe(bz),"relative-json-pointer":Qe(yz)};function xz(e){return e%4===0&&(e%100!==0||e%400===0)}function w_(e){let t=e.match(uz);if(!t)return!1;let o=+t[1],r=+t[2],n=+t[3];return r>=1&&r<=12&&n>=1&&n<=(r==2&&xz(o)?29:dz[r])}function x_(e,t){let o=t.match(pz);if(!o)return!1;let r=+o[1],n=+o[2],s=+o[3],a=!!o[5];return(r<=23&&n<=59&&s<=59||r==23&&n==59&&s==60)&&(!e||a)}var Tz=/t|\s/i;function Pz(e){let t=e.split(Tz);return t.length==2&&w_(t[0])&&x_(!0,t[1])}var Ez=/\/|:/,kz=/^(?:[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 $z(e){return Ez.test(e)&&kz.test(e)}var Cz=/[^\\]\\Z/;function Iz(e){if(Cz.test(e))return!1;try{return new RegExp(e,"u"),!0}catch{return!1}}var Mz;Mz=globalThis.crypto;var fa=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthClientFlowError"})}static[Symbol.hasInstance](e){return ke(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 ke(this,e)}constructor(e){super(e),this.name=new.target.name,Ro(this,new.target)}},eT=class extends fa{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}},tT=class extends fa{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}},oT=class extends fa{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}},rT=class extends fa{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}},nT=class extends fa{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 sT=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnauthorizedError"})}static[Symbol.hasInstance](e){return ke(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 ke(this,e)}constructor(e){super(e??"Unauthorized"),this.name="UnauthorizedError",Ro(this,new.target)}};var iT=Symbol.for("mcp.authSeamEscape");var aT=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SseError"})}static[Symbol.hasInstance](e){return ke(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 ke(this,e)}constructor(e,t,o){super(`SSE error: ${t}`),this.code=e,this.event=o,Ro(this,new.target)}};var vf=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}},zf=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)}},T_=new Set;function P_(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!="string")return;let s=n.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";T_.has(a)||(T_.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${s}", { params: Schema.shape.params }, handler).`));let l=r;return[s,{params:n.params},e==="request"?(u,d)=>l({method:s,params:u},qz(d)):u=>l({method:s,params:u})]}function qz(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 Rf=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=ct.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},jz=i.union([i.literal("light"),i.literal("dark")]).describe("Color theme preference for the host environment."),ga=i.union([i.literal("inline"),i.literal("fullscreen"),i.literal("pip")]).describe("Display mode for UI presentation."),Lz=i.union([i.literal("--color-background-primary"),i.literal("--color-background-secondary"),i.literal("--color-background-tertiary"),i.literal("--color-background-inverse"),i.literal("--color-background-ghost"),i.literal("--color-background-info"),i.literal("--color-background-danger"),i.literal("--color-background-success"),i.literal("--color-background-warning"),i.literal("--color-background-disabled"),i.literal("--color-text-primary"),i.literal("--color-text-secondary"),i.literal("--color-text-tertiary"),i.literal("--color-text-inverse"),i.literal("--color-text-ghost"),i.literal("--color-text-info"),i.literal("--color-text-danger"),i.literal("--color-text-success"),i.literal("--color-text-warning"),i.literal("--color-text-disabled"),i.literal("--color-border-primary"),i.literal("--color-border-secondary"),i.literal("--color-border-tertiary"),i.literal("--color-border-inverse"),i.literal("--color-border-ghost"),i.literal("--color-border-info"),i.literal("--color-border-danger"),i.literal("--color-border-success"),i.literal("--color-border-warning"),i.literal("--color-border-disabled"),i.literal("--color-ring-primary"),i.literal("--color-ring-secondary"),i.literal("--color-ring-inverse"),i.literal("--color-ring-info"),i.literal("--color-ring-danger"),i.literal("--color-ring-success"),i.literal("--color-ring-warning"),i.literal("--font-sans"),i.literal("--font-mono"),i.literal("--font-weight-normal"),i.literal("--font-weight-medium"),i.literal("--font-weight-semibold"),i.literal("--font-weight-bold"),i.literal("--font-text-xs-size"),i.literal("--font-text-sm-size"),i.literal("--font-text-md-size"),i.literal("--font-text-lg-size"),i.literal("--font-heading-xs-size"),i.literal("--font-heading-sm-size"),i.literal("--font-heading-md-size"),i.literal("--font-heading-lg-size"),i.literal("--font-heading-xl-size"),i.literal("--font-heading-2xl-size"),i.literal("--font-heading-3xl-size"),i.literal("--font-text-xs-line-height"),i.literal("--font-text-sm-line-height"),i.literal("--font-text-md-line-height"),i.literal("--font-text-lg-line-height"),i.literal("--font-heading-xs-line-height"),i.literal("--font-heading-sm-line-height"),i.literal("--font-heading-md-line-height"),i.literal("--font-heading-lg-line-height"),i.literal("--font-heading-xl-line-height"),i.literal("--font-heading-2xl-line-height"),i.literal("--font-heading-3xl-line-height"),i.literal("--border-radius-xs"),i.literal("--border-radius-sm"),i.literal("--border-radius-md"),i.literal("--border-radius-lg"),i.literal("--border-radius-xl"),i.literal("--border-radius-full"),i.literal("--border-width-regular"),i.literal("--shadow-hairline"),i.literal("--shadow-sm"),i.literal("--shadow-md"),i.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Uz=i.record(Lz.describe(`Style variables for theming MCP apps.
66
66
 
67
67
  Individual style keys are optional - hosts may provide any subset of these values.
68
68
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -80,10 +80,10 @@ Individual style keys are optional - hosts may provide any subset of these value
80
80
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
81
81
 
82
82
  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.`),RT=i.object({method:i.literal("ui/open-link"),params:i.object({url:i.string().describe("URL to open in the host's browser")})}),Uz=i.object({isError:i.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Zz=i.object({isError:i.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),Dz=i.object({isError:i.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),wT=i.object({method:i.literal("ui/notifications/sandbox-proxy-ready"),params:i.object({})}),wf=i.object({connectDomains:i.array(i.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
83
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),wT=i.object({method:i.literal("ui/open-link"),params:i.object({url:i.string().describe("URL to open in the host's browser")})}),Zz=i.object({isError:i.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Dz=i.object({isError:i.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),Hz=i.object({isError:i.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),xT=i.object({method:i.literal("ui/notifications/sandbox-proxy-ready"),params:i.object({})}),wf=i.object({connectDomains:i.array(i.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
84
84
 
85
85
  - Maps to CSP \`connect-src\` directive
86
- - Empty or omitted \u2192 no network connections (secure default)`),resourceDomains:i.array(i.string()).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 \u2192 no network resources (secure default)"),frameDomains:i.array(i.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted \u2192 no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:i.array(i.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted \u2192 only same origin allowed (`base-uri 'self'`)")}),xf=i.object({camera:i.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:i.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:i.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:i.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),xT=i.object({method:i.literal("ui/notifications/size-changed"),params:i.object({width:i.number().optional().describe("New width in pixels."),height:i.number().optional().describe("New height in pixels.")})}),Hz=i.object({method:i.literal("ui/notifications/tool-input"),params:i.object({arguments:i.record(i.string(),i.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Fz=i.object({method:i.literal("ui/notifications/tool-input-partial"),params:i.object({arguments:i.record(i.string(),i.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Vz=i.object({method:i.literal("ui/notifications/tool-cancelled"),params:i.object({reason:i.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Jz=i.object({fonts:i.string().optional()}),Bz=i.object({variables:Lz.optional().describe("CSS variables for theming the app."),css:Jz.optional().describe("CSS blocks that apps can inject.")}),Wz=i.object({method:i.literal("ui/resource-teardown"),params:i.object({})}),Kz=i.record(i.string(),i.unknown()),E_=i.object({text:i.object({}).optional().describe("Host supports text content blocks."),image:i.object({}).optional().describe("Host supports image content blocks."),audio:i.object({}).optional().describe("Host supports audio content blocks."),resource:i.object({}).optional().describe("Host supports resource content blocks."),resourceLink:i.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:i.object({}).optional().describe("Host supports structured content.")}),TT=i.object({method:i.literal("ui/notifications/request-teardown"),params:i.object({}).optional()}),Gz=i.object({experimental:i.record(i.string(),i.record(i.string(),i.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:i.object({}).optional().describe("Host supports opening external URLs."),downloadFile:i.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:i.object({listChanged:i.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:i.object({listChanged:i.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:i.object({}).optional().describe("Host accepts log messages."),sandbox:i.object({permissions:xf.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:wf.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:E_.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:E_.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:i.object({tools:i.object({}).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.")}),Yz=i.object({experimental:i.record(i.string(),i.record(i.string(),i.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:i.object({listChanged:i.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:i.array(ga).optional().describe("Display modes the app supports.")}),PT=i.object({method:i.literal("ui/notifications/initialized"),params:i.object({}).optional()}),ET=i.object({csp:wf.optional().describe("Content Security Policy configuration for UI resources."),permissions:xf.optional().describe("Sandbox permissions requested by the UI resource."),domain:i.string().optional().describe(`Dedicated origin for view sandbox.
86
+ - Empty or omitted \u2192 no network connections (secure default)`),resourceDomains:i.array(i.string()).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 \u2192 no network resources (secure default)"),frameDomains:i.array(i.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted \u2192 no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:i.array(i.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted \u2192 only same origin allowed (`base-uri 'self'`)")}),xf=i.object({camera:i.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:i.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:i.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:i.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),TT=i.object({method:i.literal("ui/notifications/size-changed"),params:i.object({width:i.number().optional().describe("New width in pixels."),height:i.number().optional().describe("New height in pixels.")})}),Fz=i.object({method:i.literal("ui/notifications/tool-input"),params:i.object({arguments:i.record(i.string(),i.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Vz=i.object({method:i.literal("ui/notifications/tool-input-partial"),params:i.object({arguments:i.record(i.string(),i.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),Jz=i.object({method:i.literal("ui/notifications/tool-cancelled"),params:i.object({reason:i.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Bz=i.object({fonts:i.string().optional()}),Wz=i.object({variables:Uz.optional().describe("CSS variables for theming the app."),css:Bz.optional().describe("CSS blocks that apps can inject.")}),Kz=i.object({method:i.literal("ui/resource-teardown"),params:i.object({})}),Gz=i.record(i.string(),i.unknown()),E_=i.object({text:i.object({}).optional().describe("Host supports text content blocks."),image:i.object({}).optional().describe("Host supports image content blocks."),audio:i.object({}).optional().describe("Host supports audio content blocks."),resource:i.object({}).optional().describe("Host supports resource content blocks."),resourceLink:i.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:i.object({}).optional().describe("Host supports structured content.")}),PT=i.object({method:i.literal("ui/notifications/request-teardown"),params:i.object({}).optional()}),Yz=i.object({experimental:i.record(i.string(),i.record(i.string(),i.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:i.object({}).optional().describe("Host supports opening external URLs."),downloadFile:i.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:i.object({listChanged:i.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:i.object({listChanged:i.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:i.object({}).optional().describe("Host accepts log messages."),sandbox:i.object({permissions:xf.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:wf.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:E_.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:E_.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:i.object({tools:i.object({}).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.")}),Qz=i.object({experimental:i.record(i.string(),i.record(i.string(),i.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:i.object({listChanged:i.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:i.array(ga).optional().describe("Display modes the app supports.")}),ET=i.object({method:i.literal("ui/notifications/initialized"),params:i.object({}).optional()}),kT=i.object({csp:wf.optional().describe("Content Security Policy configuration for UI resources."),permissions:xf.optional().describe("Sandbox permissions requested by the UI resource."),domain:i.string().optional().describe(`Dedicated origin for view sandbox.
87
87
 
88
88
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
89
89
 
@@ -97,10 +97,10 @@ Boolean requesting whether a visible border and background is provided by the ho
97
97
 
98
98
  - \`true\`: request visible border + background
99
99
  - \`false\`: request no visible border + background
100
- - omitted: host decides border`)}),kT=i.object({method:i.literal("ui/request-display-mode"),params:i.object({mode:ga.describe("The display mode being requested.")})}),Qz=i.object({mode:ga.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Xz=i.union([i.literal("model"),i.literal("app")]).describe("Tool visibility scope - who can access the tool."),$T=i.object({resourceUri:i.string().optional(),visibility:i.array(Xz).optional().describe(`Who can access this tool. Default: ["model", "app"]
100
+ - omitted: host decides border`)}),$T=i.object({method:i.literal("ui/request-display-mode"),params:i.object({mode:ga.describe("The display mode being requested.")})}),Xz=i.object({mode:ga.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),eR=i.union([i.literal("model"),i.literal("app")]).describe("Tool visibility scope - who can access the tool."),CT=i.object({resourceUri:i.string().optional(),visibility:i.array(eR).optional().describe(`Who can access this tool. Default: ["model", "app"]
101
101
  - "model": Tool visible to and callable by the agent
102
- - "app": Tool callable by the app from this server only`),csp:i.never().optional(),permissions:i.never().optional()}),CT=i.object({mimeTypes:i.array(i.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),IT=i.object({method:i.literal("ui/download-file"),params:i.object({contents:i.array(i.union([ht,mt])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),OT=i.object({method:i.literal("ui/message"),params:i.object({role:i.literal("user").describe('Message role, currently only "user" is supported.'),content:i.array(Ee).describe("Message content blocks (text, image, etc.).")})}),MT=i.object({method:i.literal("ui/notifications/sandbox-resource-ready"),params:i.object({html:i.string().describe("HTML content to load into the inner iframe."),sandbox:i.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:wf.optional().describe("CSP configuration from resource metadata."),permissions:xf.optional().describe("Sandbox permissions from resource metadata.")})}),eR=i.object({method:i.literal("ui/notifications/tool-result"),params:Ye.describe("Standard MCP tool execution result.")}),C_=i.object({toolInfo:i.object({id:Te.optional().describe("JSON-RPC id of the tools/call request."),tool:Ge.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Az.optional().describe("Current color theme preference."),styles:Bz.optional().describe("Style configuration for theming the app."),displayMode:ga.optional().describe("How the UI is currently displayed."),availableDisplayModes:i.array(ga).optional().describe("Display modes the host supports."),containerDimensions:i.union([i.object({height:i.number().describe("Fixed container height in pixels.")}),i.object({maxHeight:i.union([i.number(),i.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(i.union([i.object({width:i.number().describe("Fixed container width in pixels.")}),i.object({maxWidth:i.union([i.number(),i.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
103
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:i.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:i.string().optional().describe("User's timezone in IANA format."),userAgent:i.string().optional().describe("Host application identifier."),platform:i.union([i.literal("web"),i.literal("desktop"),i.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:i.object({touch:i.boolean().optional().describe("Whether the device supports touch input."),hover:i.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:i.object({top:i.number().describe("Top safe area inset in pixels."),right:i.number().describe("Right safe area inset in pixels."),bottom:i.number().describe("Bottom safe area inset in pixels."),left:i.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),tR=i.object({method:i.literal("ui/notifications/host-context-changed"),params:C_.describe("Partial context update containing only changed fields.")}),qT=i.object({method:i.literal("ui/update-model-context"),params:i.object({content:i.array(Ee).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:i.record(i.string(),i.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),NT=i.object({method:i.literal("ui/initialize"),params:i.object({appInfo:Pe.describe("App identification (name and version)."),appCapabilities:Yz.describe("Features and capabilities this app provides."),protocolVersion:i.string().describe("Protocol version this app supports.")})}),oR=i.object({protocolVersion:i.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Pe.describe("Host application identification and version."),hostCapabilities:Gz.describe("Features and capabilities provided by the host."),hostContext:C_.describe("Rich context about the host environment.")}).passthrough(),rR={target:"draft-2020-12"};async function k_(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](rR);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 a=s.path?.map(l=>typeof l=="object"?l.key:l).join(".");return a?`${a}: ${s.message}`:s.message}).join("; ");throw Error(o+n)}return r.value}function nR(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 ma{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new vf;_methods=new zf;setRequestHandler=(...t)=>{let[o,...r]=P_("request",t)??t;this._methods.claim(o,"setRequestHandler"),super.setRequestHandler.call(this,o,...r)};setNotificationHandler=(...t)=>{let[o,...r]=P_("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:Hz,toolinputpartial:Fz,toolresult:eR,toolcancelled:Vz,hostcontextchanged:tR};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&&i.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=nR(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()},a=o.inputSchema!==void 0,l={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(u){Object.assign(this,u),s()},remove(){n._registeredTools[t]===l&&(delete n._registeredTools[t],s())},handler:async(u,d)=>{if(!l.enabled)throw Error(`Tool ${t} is disabled`);let m;if(a){let S=l.inputSchema,_=S?await $_(S,u??{},`Invalid input for tool ${t}: `):u??{};m=await r(_,d)}else m=await r(d);return l.outputSchema&&!m.isError&&(m.structuredContent=await $_(l.outputSchema,m.structuredContent,`Invalid output for tool ${t}: `)),m}};return this._registeredTools[t]=l,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),s(),l}_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 k_(n.inputSchema,"input"):{type:"object",properties:{}}};return n.outputSchema&&(s.outputSchema=await k_(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:Wz.shape.params,result:Kz},(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},Dz,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},We,o)}openLink(t,o){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},Uz,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},Zz,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},Qz,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 a=document.documentElement,l=a.style.height;a.style.height="max-content";let u=Math.ceil(a.getBoundingClientRect().height);a.style.height=l;let d=Math.ceil(window.innerWidth);(d!==o||u!==r)&&(o=d,r=u,this.sendSizeChanged({width:d,height:u}))}))};n();let s=new ResizeObserver(n);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new Rf(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:qz}},oR,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}}};var Tf=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}},Pf=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)}},I_=new Set;function O_(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!="string")return;let s=n.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";I_.has(a)||(I_.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${s}", { params: Schema.shape.params }, handler).`));let l=r;return[s,{params:n.params},e==="request"?(u,d)=>l({method:s,params:u},sR(d)):u=>l({method:s,params:u})]}function sR(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 A_="2026-01-26";var iR="ui/notifications/tool-input-partial";var aR=i.union([i.literal("light"),i.literal("dark")]).describe("Color theme preference for the host environment."),Sa=i.union([i.literal("inline"),i.literal("fullscreen"),i.literal("pip")]).describe("Display mode for UI presentation."),cR=i.union([i.literal("--color-background-primary"),i.literal("--color-background-secondary"),i.literal("--color-background-tertiary"),i.literal("--color-background-inverse"),i.literal("--color-background-ghost"),i.literal("--color-background-info"),i.literal("--color-background-danger"),i.literal("--color-background-success"),i.literal("--color-background-warning"),i.literal("--color-background-disabled"),i.literal("--color-text-primary"),i.literal("--color-text-secondary"),i.literal("--color-text-tertiary"),i.literal("--color-text-inverse"),i.literal("--color-text-ghost"),i.literal("--color-text-info"),i.literal("--color-text-danger"),i.literal("--color-text-success"),i.literal("--color-text-warning"),i.literal("--color-text-disabled"),i.literal("--color-border-primary"),i.literal("--color-border-secondary"),i.literal("--color-border-tertiary"),i.literal("--color-border-inverse"),i.literal("--color-border-ghost"),i.literal("--color-border-info"),i.literal("--color-border-danger"),i.literal("--color-border-success"),i.literal("--color-border-warning"),i.literal("--color-border-disabled"),i.literal("--color-ring-primary"),i.literal("--color-ring-secondary"),i.literal("--color-ring-inverse"),i.literal("--color-ring-info"),i.literal("--color-ring-danger"),i.literal("--color-ring-success"),i.literal("--color-ring-warning"),i.literal("--font-sans"),i.literal("--font-mono"),i.literal("--font-weight-normal"),i.literal("--font-weight-medium"),i.literal("--font-weight-semibold"),i.literal("--font-weight-bold"),i.literal("--font-text-xs-size"),i.literal("--font-text-sm-size"),i.literal("--font-text-md-size"),i.literal("--font-text-lg-size"),i.literal("--font-heading-xs-size"),i.literal("--font-heading-sm-size"),i.literal("--font-heading-md-size"),i.literal("--font-heading-lg-size"),i.literal("--font-heading-xl-size"),i.literal("--font-heading-2xl-size"),i.literal("--font-heading-3xl-size"),i.literal("--font-text-xs-line-height"),i.literal("--font-text-sm-line-height"),i.literal("--font-text-md-line-height"),i.literal("--font-text-lg-line-height"),i.literal("--font-heading-xs-line-height"),i.literal("--font-heading-sm-line-height"),i.literal("--font-heading-md-line-height"),i.literal("--font-heading-lg-line-height"),i.literal("--font-heading-xl-line-height"),i.literal("--font-heading-2xl-line-height"),i.literal("--font-heading-3xl-line-height"),i.literal("--border-radius-xs"),i.literal("--border-radius-sm"),i.literal("--border-radius-md"),i.literal("--border-radius-lg"),i.literal("--border-radius-xl"),i.literal("--border-radius-full"),i.literal("--border-width-regular"),i.literal("--shadow-hairline"),i.literal("--shadow-sm"),i.literal("--shadow-md"),i.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),lR=i.record(cR.describe(`Style variables for theming MCP apps.
102
+ - "app": Tool callable by the app from this server only`),csp:i.never().optional(),permissions:i.never().optional()}),IT=i.object({mimeTypes:i.array(i.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),OT=i.object({method:i.literal("ui/download-file"),params:i.object({contents:i.array(i.union([ht,mt])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),MT=i.object({method:i.literal("ui/message"),params:i.object({role:i.literal("user").describe('Message role, currently only "user" is supported.'),content:i.array(Ee).describe("Message content blocks (text, image, etc.).")})}),qT=i.object({method:i.literal("ui/notifications/sandbox-resource-ready"),params:i.object({html:i.string().describe("HTML content to load into the inner iframe."),sandbox:i.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:wf.optional().describe("CSP configuration from resource metadata."),permissions:xf.optional().describe("Sandbox permissions from resource metadata.")})}),tR=i.object({method:i.literal("ui/notifications/tool-result"),params:Ye.describe("Standard MCP tool execution result.")}),C_=i.object({toolInfo:i.object({id:Te.optional().describe("JSON-RPC id of the tools/call request."),tool:Ge.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:jz.optional().describe("Current color theme preference."),styles:Wz.optional().describe("Style configuration for theming the app."),displayMode:ga.optional().describe("How the UI is currently displayed."),availableDisplayModes:i.array(ga).optional().describe("Display modes the host supports."),containerDimensions:i.union([i.object({height:i.number().describe("Fixed container height in pixels.")}),i.object({maxHeight:i.union([i.number(),i.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(i.union([i.object({width:i.number().describe("Fixed container width in pixels.")}),i.object({maxWidth:i.union([i.number(),i.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
103
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:i.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:i.string().optional().describe("User's timezone in IANA format."),userAgent:i.string().optional().describe("Host application identifier."),platform:i.union([i.literal("web"),i.literal("desktop"),i.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:i.object({touch:i.boolean().optional().describe("Whether the device supports touch input."),hover:i.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:i.object({top:i.number().describe("Top safe area inset in pixels."),right:i.number().describe("Right safe area inset in pixels."),bottom:i.number().describe("Bottom safe area inset in pixels."),left:i.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),oR=i.object({method:i.literal("ui/notifications/host-context-changed"),params:C_.describe("Partial context update containing only changed fields.")}),NT=i.object({method:i.literal("ui/update-model-context"),params:i.object({content:i.array(Ee).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:i.record(i.string(),i.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),AT=i.object({method:i.literal("ui/initialize"),params:i.object({appInfo:Pe.describe("App identification (name and version)."),appCapabilities:Qz.describe("Features and capabilities this app provides."),protocolVersion:i.string().describe("Protocol version this app supports.")})}),rR=i.object({protocolVersion:i.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Pe.describe("Host application identification and version."),hostCapabilities:Yz.describe("Features and capabilities provided by the host."),hostContext:C_.describe("Rich context about the host environment.")}).passthrough(),nR={target:"draft-2020-12"};async function k_(e,t){let o=e["~standard"];if(o.jsonSchema)return o.jsonSchema[t](nR);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 a=s.path?.map(l=>typeof l=="object"?l.key:l).join(".");return a?`${a}: ${s.message}`:s.message}).join("; ");throw Error(o+n)}return r.value}function sR(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 ma{_appInfo;_appCapabilities;options;_hostCapabilities;_hostInfo;_hostContext;_registeredTools={};_initializedSent=!1;_registeredEvents=new Set;_events=new vf;_methods=new zf;setRequestHandler=(...t)=>{let[o,...r]=P_("request",t)??t;this._methods.claim(o,"setRequestHandler"),super.setRequestHandler.call(this,o,...r)};setNotificationHandler=(...t)=>{let[o,...r]=P_("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:Fz,toolinputpartial:Vz,toolresult:tR,toolcancelled:Jz,hostcontextchanged:oR};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&&i.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=sR(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()},a=o.inputSchema!==void 0,l={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(u){Object.assign(this,u),s()},remove(){n._registeredTools[t]===l&&(delete n._registeredTools[t],s())},handler:async(u,d)=>{if(!l.enabled)throw Error(`Tool ${t} is disabled`);let m;if(a){let S=l.inputSchema,_=S?await $_(S,u??{},`Invalid input for tool ${t}: `):u??{};m=await r(_,d)}else m=await r(d);return l.outputSchema&&!m.isError&&(m.structuredContent=await $_(l.outputSchema,m.structuredContent,`Invalid output for tool ${t}: `)),m}};return this._registeredTools[t]=l,!this._appCapabilities.tools&&!this.transport&&this.registerAppCapabilities({tools:{listChanged:!0}}),this.ensureToolHandlersInitialized(),s(),l}_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 k_(n.inputSchema,"input"):{type:"object",properties:{}}};return n.outputSchema&&(s.outputSchema=await k_(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:Kz.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},Hz,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},We,o)}openLink(t,o){return this._assertInitialized("openLink"),this.request({method:"ui/open-link",params:t},Zz,o)}sendOpenLink=this.openLink;downloadFile(t,o){return this._assertInitialized("downloadFile"),this.request({method:"ui/download-file",params:t},Dz,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},Xz,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 a=document.documentElement,l=a.style.height;a.style.height="max-content";let u=Math.ceil(a.getBoundingClientRect().height);a.style.height=l;let d=Math.ceil(window.innerWidth);(d!==o||u!==r)&&(o=d,r=u,this.sendSizeChanged({width:d,height:u}))}))};n();let s=new ResizeObserver(n);return s.observe(document.documentElement),s.observe(document.body),()=>s.disconnect()}async connect(t=new Rf(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}},rR,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}}};var Tf=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}},Pf=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)}},I_=new Set;function O_(e,t){let[o,r]=t,n=o?.shape;if(typeof n?.method?.value!="string")return;let s=n.method.value,a=e==="request"?"setRequestHandler":"setNotificationHandler";I_.has(a)||(I_.add(a),console.warn(`[ext-apps] ${a}(Schema, handler) is deprecated; use ${a}("${s}", { params: Schema.shape.params }, handler).`));let l=r;return[s,{params:n.params},e==="request"?(u,d)=>l({method:s,params:u},iR(d)):u=>l({method:s,params:u})]}function iR(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 A_="2026-01-26";var aR="ui/notifications/tool-input-partial";var cR=i.union([i.literal("light"),i.literal("dark")]).describe("Color theme preference for the host environment."),Sa=i.union([i.literal("inline"),i.literal("fullscreen"),i.literal("pip")]).describe("Display mode for UI presentation."),lR=i.union([i.literal("--color-background-primary"),i.literal("--color-background-secondary"),i.literal("--color-background-tertiary"),i.literal("--color-background-inverse"),i.literal("--color-background-ghost"),i.literal("--color-background-info"),i.literal("--color-background-danger"),i.literal("--color-background-success"),i.literal("--color-background-warning"),i.literal("--color-background-disabled"),i.literal("--color-text-primary"),i.literal("--color-text-secondary"),i.literal("--color-text-tertiary"),i.literal("--color-text-inverse"),i.literal("--color-text-ghost"),i.literal("--color-text-info"),i.literal("--color-text-danger"),i.literal("--color-text-success"),i.literal("--color-text-warning"),i.literal("--color-text-disabled"),i.literal("--color-border-primary"),i.literal("--color-border-secondary"),i.literal("--color-border-tertiary"),i.literal("--color-border-inverse"),i.literal("--color-border-ghost"),i.literal("--color-border-info"),i.literal("--color-border-danger"),i.literal("--color-border-success"),i.literal("--color-border-warning"),i.literal("--color-border-disabled"),i.literal("--color-ring-primary"),i.literal("--color-ring-secondary"),i.literal("--color-ring-inverse"),i.literal("--color-ring-info"),i.literal("--color-ring-danger"),i.literal("--color-ring-success"),i.literal("--color-ring-warning"),i.literal("--font-sans"),i.literal("--font-mono"),i.literal("--font-weight-normal"),i.literal("--font-weight-medium"),i.literal("--font-weight-semibold"),i.literal("--font-weight-bold"),i.literal("--font-text-xs-size"),i.literal("--font-text-sm-size"),i.literal("--font-text-md-size"),i.literal("--font-text-lg-size"),i.literal("--font-heading-xs-size"),i.literal("--font-heading-sm-size"),i.literal("--font-heading-md-size"),i.literal("--font-heading-lg-size"),i.literal("--font-heading-xl-size"),i.literal("--font-heading-2xl-size"),i.literal("--font-heading-3xl-size"),i.literal("--font-text-xs-line-height"),i.literal("--font-text-sm-line-height"),i.literal("--font-text-md-line-height"),i.literal("--font-text-lg-line-height"),i.literal("--font-heading-xs-line-height"),i.literal("--font-heading-sm-line-height"),i.literal("--font-heading-md-line-height"),i.literal("--font-heading-lg-line-height"),i.literal("--font-heading-xl-line-height"),i.literal("--font-heading-2xl-line-height"),i.literal("--font-heading-3xl-line-height"),i.literal("--border-radius-xs"),i.literal("--border-radius-sm"),i.literal("--border-radius-md"),i.literal("--border-radius-lg"),i.literal("--border-radius-xl"),i.literal("--border-radius-full"),i.literal("--border-width-regular"),i.literal("--shadow-hairline"),i.literal("--shadow-sm"),i.literal("--shadow-md"),i.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),uR=i.record(lR.describe(`Style variables for theming MCP apps.
104
104
 
105
105
  Individual style keys are optional - hosts may provide any subset of these values.
106
106
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -118,10 +118,10 @@ Individual style keys are optional - hosts may provide any subset of these value
118
118
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
119
119
 
120
120
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
121
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),uR=i.object({method:i.literal("ui/open-link"),params:i.object({url:i.string().describe("URL to open in the host's browser")})}),dR=i.object({isError:i.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),pR=i.object({isError:i.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),hR=i.object({isError:i.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),mR=i.object({method:i.literal("ui/notifications/sandbox-proxy-ready"),params:i.object({})}),Ef=i.object({connectDomains:i.array(i.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
121
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),dR=i.object({method:i.literal("ui/open-link"),params:i.object({url:i.string().describe("URL to open in the host's browser")})}),pR=i.object({isError:i.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),hR=i.object({isError:i.boolean().optional().describe("True if the download failed (e.g., user cancelled or host denied).")}).passthrough(),mR=i.object({isError:i.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),fR=i.object({method:i.literal("ui/notifications/sandbox-proxy-ready"),params:i.object({})}),Ef=i.object({connectDomains:i.array(i.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
122
122
 
123
123
  - Maps to CSP \`connect-src\` directive
124
- - Empty or omitted \u2192 no network connections (secure default)`),resourceDomains:i.array(i.string()).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 \u2192 no network resources (secure default)"),frameDomains:i.array(i.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted \u2192 no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:i.array(i.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted \u2192 only same origin allowed (`base-uri 'self'`)")}),kf=i.object({camera:i.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:i.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:i.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:i.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),fR=i.object({method:i.literal("ui/notifications/size-changed"),params:i.object({width:i.number().optional().describe("New width in pixels."),height:i.number().optional().describe("New height in pixels.")})}),HT=i.object({method:i.literal("ui/notifications/tool-input"),params:i.object({arguments:i.record(i.string(),i.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),FT=i.object({method:i.literal("ui/notifications/tool-input-partial"),params:i.object({arguments:i.record(i.string(),i.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),VT=i.object({method:i.literal("ui/notifications/tool-cancelled"),params:i.object({reason:i.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),gR=i.object({fonts:i.string().optional()}),SR=i.object({variables:lR.optional().describe("CSS variables for theming the app."),css:gR.optional().describe("CSS blocks that apps can inject.")}),JT=i.object({method:i.literal("ui/resource-teardown"),params:i.object({})}),_R=i.record(i.string(),i.unknown()),M_=i.object({text:i.object({}).optional().describe("Host supports text content blocks."),image:i.object({}).optional().describe("Host supports image content blocks."),audio:i.object({}).optional().describe("Host supports audio content blocks."),resource:i.object({}).optional().describe("Host supports resource content blocks."),resourceLink:i.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:i.object({}).optional().describe("Host supports structured content.")}),bR=i.object({method:i.literal("ui/notifications/request-teardown"),params:i.object({}).optional()}),yR=i.object({experimental:i.record(i.string(),i.record(i.string(),i.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:i.object({}).optional().describe("Host supports opening external URLs."),downloadFile:i.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:i.object({listChanged:i.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:i.object({listChanged:i.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:i.object({}).optional().describe("Host accepts log messages."),sandbox:i.object({permissions:kf.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Ef.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:M_.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:M_.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:i.object({tools:i.object({}).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.")}),vR=i.object({experimental:i.record(i.string(),i.record(i.string(),i.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:i.object({listChanged:i.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:i.array(Sa).optional().describe("Display modes the app supports.")}),zR=i.object({method:i.literal("ui/notifications/initialized"),params:i.object({}).optional()}),BT=i.object({csp:Ef.optional().describe("Content Security Policy configuration for UI resources."),permissions:kf.optional().describe("Sandbox permissions requested by the UI resource."),domain:i.string().optional().describe(`Dedicated origin for view sandbox.
124
+ - Empty or omitted \u2192 no network connections (secure default)`),resourceDomains:i.array(i.string()).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 \u2192 no network resources (secure default)"),frameDomains:i.array(i.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted \u2192 no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:i.array(i.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted \u2192 only same origin allowed (`base-uri 'self'`)")}),kf=i.object({camera:i.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:i.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:i.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:i.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),gR=i.object({method:i.literal("ui/notifications/size-changed"),params:i.object({width:i.number().optional().describe("New width in pixels."),height:i.number().optional().describe("New height in pixels.")})}),FT=i.object({method:i.literal("ui/notifications/tool-input"),params:i.object({arguments:i.record(i.string(),i.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),VT=i.object({method:i.literal("ui/notifications/tool-input-partial"),params:i.object({arguments:i.record(i.string(),i.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),JT=i.object({method:i.literal("ui/notifications/tool-cancelled"),params:i.object({reason:i.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),SR=i.object({fonts:i.string().optional()}),_R=i.object({variables:uR.optional().describe("CSS variables for theming the app."),css:SR.optional().describe("CSS blocks that apps can inject.")}),BT=i.object({method:i.literal("ui/resource-teardown"),params:i.object({})}),bR=i.record(i.string(),i.unknown()),M_=i.object({text:i.object({}).optional().describe("Host supports text content blocks."),image:i.object({}).optional().describe("Host supports image content blocks."),audio:i.object({}).optional().describe("Host supports audio content blocks."),resource:i.object({}).optional().describe("Host supports resource content blocks."),resourceLink:i.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:i.object({}).optional().describe("Host supports structured content.")}),yR=i.object({method:i.literal("ui/notifications/request-teardown"),params:i.object({}).optional()}),vR=i.object({experimental:i.record(i.string(),i.record(i.string(),i.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),openLinks:i.object({}).optional().describe("Host supports opening external URLs."),downloadFile:i.object({}).optional().describe("Host supports file downloads via ui/download-file."),serverTools:i.object({listChanged:i.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:i.object({listChanged:i.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:i.object({}).optional().describe("Host accepts log messages."),sandbox:i.object({permissions:kf.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:Ef.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:M_.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:M_.optional().describe("Host supports receiving content messages (ui/message) from the view."),sampling:i.object({tools:i.object({}).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.")}),zR=i.object({experimental:i.record(i.string(),i.record(i.string(),i.any()).describe("Experimental features keyed by identifier.")).optional().describe("Experimental features keyed by identifier."),tools:i.object({listChanged:i.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:i.array(Sa).optional().describe("Display modes the app supports.")}),RR=i.object({method:i.literal("ui/notifications/initialized"),params:i.object({}).optional()}),WT=i.object({csp:Ef.optional().describe("Content Security Policy configuration for UI resources."),permissions:kf.optional().describe("Sandbox permissions requested by the UI resource."),domain:i.string().optional().describe(`Dedicated origin for view sandbox.
125
125
 
126
126
  Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
127
127
 
@@ -135,10 +135,10 @@ Boolean requesting whether a visible border and background is provided by the ho
135
135
 
136
136
  - \`true\`: request visible border + background
137
137
  - \`false\`: request no visible border + background
138
- - omitted: host decides border`)}),q_=i.object({method:i.literal("ui/request-display-mode"),params:i.object({mode:Sa.describe("The display mode being requested.")})}),N_=i.object({mode:Sa.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),RR=i.union([i.literal("model"),i.literal("app")]).describe("Tool visibility scope - who can access the tool."),WT=i.object({resourceUri:i.string().optional(),visibility:i.array(RR).optional().describe(`Who can access this tool. Default: ["model", "app"]
138
+ - omitted: host decides border`)}),q_=i.object({method:i.literal("ui/request-display-mode"),params:i.object({mode:Sa.describe("The display mode being requested.")})}),N_=i.object({mode:Sa.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),wR=i.union([i.literal("model"),i.literal("app")]).describe("Tool visibility scope - who can access the tool."),KT=i.object({resourceUri:i.string().optional(),visibility:i.array(wR).optional().describe(`Who can access this tool. Default: ["model", "app"]
139
139
  - "model": Tool visible to and callable by the agent
140
- - "app": Tool callable by the app from this server only`),csp:i.never().optional(),permissions:i.never().optional()}),KT=i.object({mimeTypes:i.array(i.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),wR=i.object({method:i.literal("ui/download-file"),params:i.object({contents:i.array(i.union([ht,mt])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),xR=i.object({method:i.literal("ui/message"),params:i.object({role:i.literal("user").describe('Message role, currently only "user" is supported.'),content:i.array(Ee).describe("Message content blocks (text, image, etc.).")})}),GT=i.object({method:i.literal("ui/notifications/sandbox-resource-ready"),params:i.object({html:i.string().describe("HTML content to load into the inner iframe."),sandbox:i.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ef.optional().describe("CSP configuration from resource metadata."),permissions:kf.optional().describe("Sandbox permissions from resource metadata.")})}),YT=i.object({method:i.literal("ui/notifications/tool-result"),params:Ye.describe("Standard MCP tool execution result.")}),j_=i.object({toolInfo:i.object({id:Te.optional().describe("JSON-RPC id of the tools/call request."),tool:Ge.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:aR.optional().describe("Current color theme preference."),styles:SR.optional().describe("Style configuration for theming the app."),displayMode:Sa.optional().describe("How the UI is currently displayed."),availableDisplayModes:i.array(Sa).optional().describe("Display modes the host supports."),containerDimensions:i.union([i.object({height:i.number().describe("Fixed container height in pixels.")}),i.object({maxHeight:i.union([i.number(),i.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(i.union([i.object({width:i.number().describe("Fixed container width in pixels.")}),i.object({maxWidth:i.union([i.number(),i.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
141
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:i.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:i.string().optional().describe("User's timezone in IANA format."),userAgent:i.string().optional().describe("Host application identifier."),platform:i.union([i.literal("web"),i.literal("desktop"),i.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:i.object({touch:i.boolean().optional().describe("Whether the device supports touch input."),hover:i.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:i.object({top:i.number().describe("Top safe area inset in pixels."),right:i.number().describe("Right safe area inset in pixels."),bottom:i.number().describe("Bottom safe area inset in pixels."),left:i.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),QT=i.object({method:i.literal("ui/notifications/host-context-changed"),params:j_.describe("Partial context update containing only changed fields.")}),TR=i.object({method:i.literal("ui/update-model-context"),params:i.object({content:i.array(Ee).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:i.record(i.string(),i.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),PR=i.object({method:i.literal("ui/initialize"),params:i.object({appInfo:Pe.describe("App identification (name and version)."),appCapabilities:vR.describe("Features and capabilities this app provides."),protocolVersion:i.string().describe("Protocol version this app supports.")})}),ER=i.object({protocolVersion:i.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Pe.describe("Host application identification and version."),hostCapabilities:yR.describe("Features and capabilities provided by the host."),hostContext:j_.describe("Rich context about the host environment.")}).passthrough();var Ql=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=ct.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!==iR&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion};var kR=[A_],Xl=class extends ma{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new Tf;_methods=new Pf;setRequestHandler=(...t)=>{let[o,...r]=O_("request",t)??t;this._methods.claim(o,"setRequestHandler"),super.setRequestHandler.call(this,o,...r)};setNotificationHandler=(...t)=>{let[o,...r]=O_("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)};_wrapHandler(t,o){let r=super._wrapHandler(t,o);return t==="ui/initialize"||t==="ping"?r:async(n,s)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${t}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),r(n,s))}eventSchemas={sizechange:fR,sandboxready:mR,initialized:zR,requestteardown:bR,loggingmessage:bo};setEventHandler(t,o){this._ensureEventSlot(t),this._events.setHandler(t,o)}getEventHandler(t){return this._events.getHandler(t)}addEventListener(t,o){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)}`);let r=n=>{t==="initialized"&&(this._initializedReceived=!0),this._events.dispatch(t,n)};t==="loggingmessage"?this.setNotificationHandler("notifications/message",n=>{r(n.params)}):this.setNotificationHandler(o.shape.method.value,{params:o.shape.params},n=>r(n)),this._registeredEvents.add(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,n){super(n),this._client=t,this._hostInfo=o,this._hostCapabilities=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=n?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:PR.shape.params,result:ER},s=>this._onAppsInitialize(s)),this.replaceRequestHandler("ping",(s,a)=>(this.onping?.(s.params,a),{})),this.replaceRequestHandler("ui/request-display-mode",{params:q_.shape.params,result:N_},()=>({mode:this._hostContext.displayMode??"inline"}))}buildContext(t){return t}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){}assertNotificationCapability(t){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(t){this.setEventHandler("sizechange",t)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(t){this.setEventHandler("sandboxready",t)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(t){this.setEventHandler("initialized",t)}_onmessage;get onmessage(){return this._onmessage}set onmessage(t){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,t),this._onmessage=t,this.replaceRequestHandler("ui/message",{params:xR.shape.params,result:hR},async(o,r)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(o,r)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(t){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,t),this._onopenlink=t,this.replaceRequestHandler("ui/open-link",{params:uR.shape.params,result:dR},async(o,r)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(o,r)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(t){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,t),this._ondownloadfile=t,this.replaceRequestHandler("ui/download-file",{params:wR.shape.params,result:pR},async(o,r)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(o,r)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(t){this.setEventHandler("requestteardown",t)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(t){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,t),this._onrequestdisplaymode=t,this.replaceRequestHandler("ui/request-display-mode",{params:q_.shape.params,result:N_},async(o,r)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(o,r)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(t){this.setEventHandler("loggingmessage",t)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(t){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,t),this._onupdatemodelcontext=t,this.replaceRequestHandler("ui/update-model-context",{params:TR.shape.params,result:We},async(o,r)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(o,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler("tools/call",async(o,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(o.params,r)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(t){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,t),this._oncreatesamplingmessage=t,this.replaceRequestHandler("sampling/createMessage",async(o,r)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(o.params,r)})}sendToolListChanged(t={}){return this.notification({method:"notifications/tools/list_changed",params:t})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(t){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,t),this._onlistresources=t,this.replaceRequestHandler("resources/list",async(o,r)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(o.params,r)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(t){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,t),this._onlistresourcetemplates=t,this.replaceRequestHandler("resources/templates/list",async(o,r)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(o.params,r)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(t){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,t),this._onreadresource=t,this.replaceRequestHandler("resources/read",async(o,r)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(o.params,r)})}sendResourceListChanged(t={}){return this.notification({method:"notifications/resources/list_changed",params:t})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(t){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,t),this._onlistprompts=t,this.replaceRequestHandler("prompts/list",async(o,r)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(o.params,r)})}sendPromptListChanged(t={}){return this.notification({method:"notifications/prompts/list_changed",params:t})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(t){let o=t.protocolVersion;return this._appInfo!==void 0&&console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values."),this._appCapabilities=t.appCapabilities,this._appInfo=t.appInfo,{protocolVersion:kR.includes(o)?o:A_,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(t){let o={},r=!1;for(let n of Object.keys(t)){let s=this._hostContext[n],a=t[n];$R(s,a)||(o[n]=a,r=!0)}r&&(this._hostContext=t,this.sendHostContextChange(o))}sendHostContextChange(t){return this.notification({method:"ui/notifications/host-context-changed",params:t})}sendToolInput(t){return this.notification({method:"ui/notifications/tool-input",params:t})}sendToolInputPartial(t){return this.notification({method:"ui/notifications/tool-input-partial",params:t})}sendToolResult(t){return this.notification({method:"ui/notifications/tool-result",params:t})}sendToolCancelled(t){return this.notification({method:"ui/notifications/tool-cancelled",params:t})}sendSandboxResourceReady(t){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:t})}teardownResource(t,o){return this.request({method:"ui/resource-teardown",params:t},_R,o)}sendResourceTeardown=this.teardownResource;callTool(t,o){return this.request({method:"tools/call",params:t},o)}listTools(t,o){return this.request({method:"tools/list",params:t},o)}async connect(t){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let o=this._client.getServerCapabilities();if(!o)throw Error("Client server capabilities not available");o.tools&&(this.oncalltool=async(r,n)=>this._client.request({method:"tools/call",params:r},{signal:n.mcpReq.signal}),o.tools.listChanged&&this._client.setNotificationHandler("notifications/tools/list_changed",r=>this.sendToolListChanged(r.params))),o.resources&&(this.onlistresources=async(r,n)=>this._client.request({method:"resources/list",params:r},{signal:n.mcpReq.signal}),this.onlistresourcetemplates=async(r,n)=>this._client.request({method:"resources/templates/list",params:r},{signal:n.mcpReq.signal}),this.onreadresource=async(r,n)=>this._client.request({method:"resources/read",params:r},{signal:n.mcpReq.signal}),o.resources.listChanged&&this._client.setNotificationHandler("notifications/resources/list_changed",r=>this.sendResourceListChanged(r.params))),o.prompts&&(this.onlistprompts=async(r,n)=>this._client.request({method:"prompts/list",params:r},{signal:n.mcpReq.signal}),o.prompts.listChanged&&this._client.setNotificationHandler("notifications/prompts/list_changed",r=>this.sendPromptListChanged(r.params)))}return super.connect(t)}};function $R(e,t){return JSON.stringify(e)===JSON.stringify(t)}var $e=new Yl({name:"ADS preview",version:"1.0.0"},{},{autoResize:!0}),Wr=document.getElementById("ads-token-root"),Lt=document.getElementById("ads-widget-status"),tu=document.getElementById("ads-token-theme"),eu=document.getElementById("ads-scenario-root"),To,Me=0,L_="",Br=30,U_=document.createElement("style");Wr&&document.head.append(U_);function ou(e){e!=="light"&&e!=="dark"||(document.documentElement.dataset.theme=e,tu&&(tu.value=e),Wr&&To&&wo())}function Oe(e,t){let o=document.createElement(e);return o.textContent=t,o}function CR(e){let t=Oe("li","");t.dataset.token=e.name;let o=getComputedStyle(document.documentElement).getPropertyValue(e.name).trim(),r=Oe("details","");r.className="token-source";let n=Oe("summary","");n.title=`${e.name}: ${o||"Conditional or unset"}. Click to inspect source definitions.`;let s=Oe("code",e.name);s.className="token-name";let a=Oe("span",o||"Conditional or unset");n.append(s,a);let l=Oe("dl","");l.append(Oe("dt","Computed in preview"),Oe("dd",o||"Conditional or unset")),e.meaning&&l.append(Oe("dt","Meaning"),Oe("dd",e.meaning));for(let u of e.definitions)l.append(Oe("dt",u.scope),Oe("dd",`${u.value} \xB7 ${u.file}:${u.line}`));return r.append(n,l),t.append(r),t}function wo(){U_.textContent=To.css;let e=To.tokens.filter(t=>`${t.name} ${t.type??""}`.toLowerCase().includes(L_.toLowerCase()));document.getElementById("ads-token-list").replaceChildren(...e.slice(Me,Me+Br).map(CR)),document.querySelector("footer").hidden=e.length<=Br,document.getElementById("ads-token-count").textContent=e.length?`${Me+1}\u2013${Math.min(Me+Br,e.length)} of ${e.length}`:"No matching tokens",document.getElementById("ads-token-prev").disabled=Me===0,document.getElementById("ads-token-next").disabled=Me+Br>=e.length,Lt.textContent=`${e.length} matching definitions \xB7 ${To.diagnostics.length} diagnostics`}Wr&&($e.ontoolinput=()=>{Me=0,To&&wo()},To=JSON.parse(document.getElementById("ads-token-seed").textContent),ou("light"),document.getElementById("ads-token-search").addEventListener("input",e=>{L_=e.target.value,Me=0,wo()}),tu.addEventListener("change",()=>ou(tu.value)),document.getElementById("ads-token-prev").addEventListener("click",()=>{Me=Math.max(0,Me-Br),wo()}),document.getElementById("ads-token-next").addEventListener("click",()=>{Me+=Br,wo()}),document.getElementById("ads-token-refresh").addEventListener("click",async()=>{try{let e=await $e.readServerResource({uri:"ads://project/tokens"});To=JSON.parse(e.contents.find(t=>"text"in t).text),Me=0,wo()}catch(e){Lt.textContent=`Refresh failed: ${e.message}`}}));var xo,$f,Z_=!1,_a=0;async function D_(e){if($f=e,!Z_||!eu)return;let t=e?.structuredContent?.scenario?.resourceUri;if(!t||!t.startsWith("ui://ads/previews/"))return;let o=++_a;Wr&&(Wr.hidden=!0,Lt=document.getElementById("ads-scenario-status")),eu.hidden=!1;try{if(!$e.getHostCapabilities()?.serverResources)throw new Error("This Apps host does not forward server resources. Use the project showcase URL from the tool result.");let n=(await $e.readServerResource({uri:t})).contents.find(u=>u.mimeType==="text/html;profile=mcp-app"&&typeof u.text=="string");if(!n)throw new Error("Scenario HTML is unavailable.");if(o!==_a)return;xo&&(await xo.close(),xo=void 0);let s=document.createElement("iframe");s.title=e.structuredContent.scenario.title,s.setAttribute("sandbox","allow-scripts"),eu.replaceChildren(s);let a=new Xl(null,{name:"ADS scenario host",version:"1.0.0"},{serverResources:{},serverTools:{}},{hostContext:$e.getHostContext()});xo=a,a.onreadresource=u=>$e.readServerResource(u),a.oncalltool=u=>$e.callServerTool(u),a.onsizechange=({height:u})=>{u&&(s.height=String(Math.min(1e4,Math.max(120,u))))},a.oninitialized=async()=>{await a.sendToolInput({arguments:{}}),await a.sendToolResult(e),o===_a&&window.parent.postMessage({type:"ads-preview-ready"},"*")},await a.connect(new Ql(s.contentWindow,s.contentWindow));let l='<meta http-equiv="Content-Security-Policy" content="default-src &#39;none&#39;; script-src &#39;unsafe-inline&#39; blob:; style-src &#39;unsafe-inline&#39;; img-src data: blob:; font-src data:; worker-src blob: data:; connect-src &#39;none&#39;">';s.srcdoc=n.text.replace(/<head\b[^>]*>/i,u=>u+l),Lt.hidden=!0}catch(r){o===_a&&(Lt.hidden=!1,Lt.textContent=r.message,window.parent.postMessage({type:"ads-preview-ready"},"*"))}}eu&&($e.ontoolresult=e=>{D_(e)},$e.onteardown=async()=>{++_a;let e=xo;xo=void 0;try{await e?.teardownResource({},{timeout:500})}catch{}return await e?.close(),{}});$e.onhostcontextchanged=e=>{ou(e.theme),xo?.setHostContext(e)};try{await $e.connect(),Z_=!0,$f&&D_($f),ou($e.getHostContext()?.theme),Wr&&(document.getElementById("ads-token-refresh").disabled=!$e.getHostCapabilities()?.serverResources,wo())}catch{Lt&&(Lt.textContent="Apps bridge unavailable. Samples remain usable; inspect project data through ADS tools/resources.")}
140
+ - "app": Tool callable by the app from this server only`),csp:i.never().optional(),permissions:i.never().optional()}),GT=i.object({mimeTypes:i.array(i.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),xR=i.object({method:i.literal("ui/download-file"),params:i.object({contents:i.array(i.union([ht,mt])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),TR=i.object({method:i.literal("ui/message"),params:i.object({role:i.literal("user").describe('Message role, currently only "user" is supported.'),content:i.array(Ee).describe("Message content blocks (text, image, etc.).")})}),YT=i.object({method:i.literal("ui/notifications/sandbox-resource-ready"),params:i.object({html:i.string().describe("HTML content to load into the inner iframe."),sandbox:i.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:Ef.optional().describe("CSP configuration from resource metadata."),permissions:kf.optional().describe("Sandbox permissions from resource metadata.")})}),QT=i.object({method:i.literal("ui/notifications/tool-result"),params:Ye.describe("Standard MCP tool execution result.")}),j_=i.object({toolInfo:i.object({id:Te.optional().describe("JSON-RPC id of the tools/call request."),tool:Ge.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:cR.optional().describe("Current color theme preference."),styles:_R.optional().describe("Style configuration for theming the app."),displayMode:Sa.optional().describe("How the UI is currently displayed."),availableDisplayModes:i.array(Sa).optional().describe("Display modes the host supports."),containerDimensions:i.union([i.object({height:i.number().describe("Fixed container height in pixels.")}),i.object({maxHeight:i.union([i.number(),i.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(i.union([i.object({width:i.number().describe("Fixed container width in pixels.")}),i.object({maxWidth:i.union([i.number(),i.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
141
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:i.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:i.string().optional().describe("User's timezone in IANA format."),userAgent:i.string().optional().describe("Host application identifier."),platform:i.union([i.literal("web"),i.literal("desktop"),i.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:i.object({touch:i.boolean().optional().describe("Whether the device supports touch input."),hover:i.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:i.object({top:i.number().describe("Top safe area inset in pixels."),right:i.number().describe("Right safe area inset in pixels."),bottom:i.number().describe("Bottom safe area inset in pixels."),left:i.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),XT=i.object({method:i.literal("ui/notifications/host-context-changed"),params:j_.describe("Partial context update containing only changed fields.")}),PR=i.object({method:i.literal("ui/update-model-context"),params:i.object({content:i.array(Ee).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:i.record(i.string(),i.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),ER=i.object({method:i.literal("ui/initialize"),params:i.object({appInfo:Pe.describe("App identification (name and version)."),appCapabilities:zR.describe("Features and capabilities this app provides."),protocolVersion:i.string().describe("Protocol version this app supports.")})}),kR=i.object({protocolVersion:i.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Pe.describe("Host application identification and version."),hostCapabilities:vR.describe("Features and capabilities provided by the host."),hostContext:j_.describe("Rich context about the host environment.")}).passthrough();var Ql=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=ct.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!==aR&&console.debug("Sending message",t),this.eventTarget.postMessage(t,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion};var $R=[A_],Xl=class extends ma{_client;_hostInfo;_hostCapabilities;_appCapabilities;_hostContext={};_appInfo;_initializedReceived=!1;_registeredEvents=new Set;_events=new Tf;_methods=new Pf;setRequestHandler=(...t)=>{let[o,...r]=O_("request",t)??t;this._methods.claim(o,"setRequestHandler"),super.setRequestHandler.call(this,o,...r)};setNotificationHandler=(...t)=>{let[o,...r]=O_("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)};_wrapHandler(t,o){let r=super._wrapHandler(t,o);return t==="ui/initialize"||t==="ping"?r:async(n,s)=>(this._initializedReceived||console.warn(`[ext-apps] AppBridge received '${t}' before ui/notifications/initialized. The View is calling host methods before completing the handshake; it should await app.connect() first.`),r(n,s))}eventSchemas={sizechange:gR,sandboxready:fR,initialized:RR,requestteardown:yR,loggingmessage:bo};setEventHandler(t,o){this._ensureEventSlot(t),this._events.setHandler(t,o)}getEventHandler(t){return this._events.getHandler(t)}addEventListener(t,o){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)}`);let r=n=>{t==="initialized"&&(this._initializedReceived=!0),this._events.dispatch(t,n)};t==="loggingmessage"?this.setNotificationHandler("notifications/message",n=>{r(n.params)}):this.setNotificationHandler(o.shape.method.value,{params:o.shape.params},n=>r(n)),this._registeredEvents.add(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,n){super(n),this._client=t,this._hostInfo=o,this._hostCapabilities=r,this._methods.replace("notifications/cancelled"),this._methods.replace("notifications/progress"),this._ensureEventSlot("initialized"),this._hostContext=n?.hostContext||{},this.replaceRequestHandler("ui/initialize",{params:ER.shape.params,result:kR},s=>this._onAppsInitialize(s)),this.replaceRequestHandler("ping",(s,a)=>(this.onping?.(s.params,a),{})),this.replaceRequestHandler("ui/request-display-mode",{params:q_.shape.params,result:N_},()=>({mode:this._hostContext.displayMode??"inline"}))}buildContext(t){return t}assertCapabilityForMethod(t){}assertRequestHandlerCapability(t){}assertNotificationCapability(t){}getAppCapabilities(){return this._appCapabilities}getAppVersion(){return this._appInfo}onping;get onsizechange(){return this.getEventHandler("sizechange")}set onsizechange(t){this.setEventHandler("sizechange",t)}get onsandboxready(){return this.getEventHandler("sandboxready")}set onsandboxready(t){this.setEventHandler("sandboxready",t)}get oninitialized(){return this.getEventHandler("initialized")}set oninitialized(t){this.setEventHandler("initialized",t)}_onmessage;get onmessage(){return this._onmessage}set onmessage(t){this.warnIfRequestHandlerReplaced("onmessage",this._onmessage,t),this._onmessage=t,this.replaceRequestHandler("ui/message",{params:TR.shape.params,result:mR},async(o,r)=>{if(!this._onmessage)throw Error("No onmessage handler set");return this._onmessage(o,r)})}_onopenlink;get onopenlink(){return this._onopenlink}set onopenlink(t){this.warnIfRequestHandlerReplaced("onopenlink",this._onopenlink,t),this._onopenlink=t,this.replaceRequestHandler("ui/open-link",{params:dR.shape.params,result:pR},async(o,r)=>{if(!this._onopenlink)throw Error("No onopenlink handler set");return this._onopenlink(o,r)})}_ondownloadfile;get ondownloadfile(){return this._ondownloadfile}set ondownloadfile(t){this.warnIfRequestHandlerReplaced("ondownloadfile",this._ondownloadfile,t),this._ondownloadfile=t,this.replaceRequestHandler("ui/download-file",{params:xR.shape.params,result:hR},async(o,r)=>{if(!this._ondownloadfile)throw Error("No ondownloadfile handler set");return this._ondownloadfile(o,r)})}get onrequestteardown(){return this.getEventHandler("requestteardown")}set onrequestteardown(t){this.setEventHandler("requestteardown",t)}_onrequestdisplaymode;get onrequestdisplaymode(){return this._onrequestdisplaymode}set onrequestdisplaymode(t){this.warnIfRequestHandlerReplaced("onrequestdisplaymode",this._onrequestdisplaymode,t),this._onrequestdisplaymode=t,this.replaceRequestHandler("ui/request-display-mode",{params:q_.shape.params,result:N_},async(o,r)=>{if(!this._onrequestdisplaymode)throw Error("No onrequestdisplaymode handler set");return this._onrequestdisplaymode(o,r)})}get onloggingmessage(){return this.getEventHandler("loggingmessage")}set onloggingmessage(t){this.setEventHandler("loggingmessage",t)}_onupdatemodelcontext;get onupdatemodelcontext(){return this._onupdatemodelcontext}set onupdatemodelcontext(t){this.warnIfRequestHandlerReplaced("onupdatemodelcontext",this._onupdatemodelcontext,t),this._onupdatemodelcontext=t,this.replaceRequestHandler("ui/update-model-context",{params:PR.shape.params,result:We},async(o,r)=>{if(!this._onupdatemodelcontext)throw Error("No onupdatemodelcontext handler set");return this._onupdatemodelcontext(o,r)})}_oncalltool;get oncalltool(){return this._oncalltool}set oncalltool(t){this.warnIfRequestHandlerReplaced("oncalltool",this._oncalltool,t),this._oncalltool=t,this.replaceRequestHandler("tools/call",async(o,r)=>{if(!this._oncalltool)throw Error("No oncalltool handler set");return this._oncalltool(o.params,r)})}_oncreatesamplingmessage;get oncreatesamplingmessage(){return this._oncreatesamplingmessage}set oncreatesamplingmessage(t){this.warnIfRequestHandlerReplaced("oncreatesamplingmessage",this._oncreatesamplingmessage,t),this._oncreatesamplingmessage=t,this.replaceRequestHandler("sampling/createMessage",async(o,r)=>{if(!this._oncreatesamplingmessage)throw Error("No oncreatesamplingmessage handler set");return this._oncreatesamplingmessage(o.params,r)})}sendToolListChanged(t={}){return this.notification({method:"notifications/tools/list_changed",params:t})}_onlistresources;get onlistresources(){return this._onlistresources}set onlistresources(t){this.warnIfRequestHandlerReplaced("onlistresources",this._onlistresources,t),this._onlistresources=t,this.replaceRequestHandler("resources/list",async(o,r)=>{if(!this._onlistresources)throw Error("No onlistresources handler set");return this._onlistresources(o.params,r)})}_onlistresourcetemplates;get onlistresourcetemplates(){return this._onlistresourcetemplates}set onlistresourcetemplates(t){this.warnIfRequestHandlerReplaced("onlistresourcetemplates",this._onlistresourcetemplates,t),this._onlistresourcetemplates=t,this.replaceRequestHandler("resources/templates/list",async(o,r)=>{if(!this._onlistresourcetemplates)throw Error("No onlistresourcetemplates handler set");return this._onlistresourcetemplates(o.params,r)})}_onreadresource;get onreadresource(){return this._onreadresource}set onreadresource(t){this.warnIfRequestHandlerReplaced("onreadresource",this._onreadresource,t),this._onreadresource=t,this.replaceRequestHandler("resources/read",async(o,r)=>{if(!this._onreadresource)throw Error("No onreadresource handler set");return this._onreadresource(o.params,r)})}sendResourceListChanged(t={}){return this.notification({method:"notifications/resources/list_changed",params:t})}_onlistprompts;get onlistprompts(){return this._onlistprompts}set onlistprompts(t){this.warnIfRequestHandlerReplaced("onlistprompts",this._onlistprompts,t),this._onlistprompts=t,this.replaceRequestHandler("prompts/list",async(o,r)=>{if(!this._onlistprompts)throw Error("No onlistprompts handler set");return this._onlistprompts(o.params,r)})}sendPromptListChanged(t={}){return this.notification({method:"notifications/prompts/list_changed",params:t})}getCapabilities(){return this._hostCapabilities}async _onAppsInitialize(t){let o=t.protocolVersion;return this._appInfo!==void 0&&console.warn("[ext-apps] AppBridge received a second ui/initialize. The View may be double-mounting (e.g. React StrictMode in dev) without closing the previous App instance. Responding normally; the latest appInfo/appCapabilities replace the previous values."),this._appCapabilities=t.appCapabilities,this._appInfo=t.appInfo,{protocolVersion:$R.includes(o)?o:A_,hostCapabilities:this.getCapabilities(),hostInfo:this._hostInfo,hostContext:this._hostContext}}setHostContext(t){let o={},r=!1;for(let n of Object.keys(t)){let s=this._hostContext[n],a=t[n];CR(s,a)||(o[n]=a,r=!0)}r&&(this._hostContext=t,this.sendHostContextChange(o))}sendHostContextChange(t){return this.notification({method:"ui/notifications/host-context-changed",params:t})}sendToolInput(t){return this.notification({method:"ui/notifications/tool-input",params:t})}sendToolInputPartial(t){return this.notification({method:"ui/notifications/tool-input-partial",params:t})}sendToolResult(t){return this.notification({method:"ui/notifications/tool-result",params:t})}sendToolCancelled(t){return this.notification({method:"ui/notifications/tool-cancelled",params:t})}sendSandboxResourceReady(t){return this.notification({method:"ui/notifications/sandbox-resource-ready",params:t})}teardownResource(t,o){return this.request({method:"ui/resource-teardown",params:t},bR,o)}sendResourceTeardown=this.teardownResource;callTool(t,o){return this.request({method:"tools/call",params:t},o)}listTools(t,o){return this.request({method:"tools/list",params:t},o)}async connect(t){if(this.transport)throw Error("AppBridge is already connected. Call close() before connecting again.");if(this._initializedReceived=!1,this._client){let o=this._client.getServerCapabilities();if(!o)throw Error("Client server capabilities not available");o.tools&&(this.oncalltool=async(r,n)=>this._client.request({method:"tools/call",params:r},{signal:n.mcpReq.signal}),o.tools.listChanged&&this._client.setNotificationHandler("notifications/tools/list_changed",r=>this.sendToolListChanged(r.params))),o.resources&&(this.onlistresources=async(r,n)=>this._client.request({method:"resources/list",params:r},{signal:n.mcpReq.signal}),this.onlistresourcetemplates=async(r,n)=>this._client.request({method:"resources/templates/list",params:r},{signal:n.mcpReq.signal}),this.onreadresource=async(r,n)=>this._client.request({method:"resources/read",params:r},{signal:n.mcpReq.signal}),o.resources.listChanged&&this._client.setNotificationHandler("notifications/resources/list_changed",r=>this.sendResourceListChanged(r.params))),o.prompts&&(this.onlistprompts=async(r,n)=>this._client.request({method:"prompts/list",params:r},{signal:n.mcpReq.signal}),o.prompts.listChanged&&this._client.setNotificationHandler("notifications/prompts/list_changed",r=>this.sendPromptListChanged(r.params)))}return super.connect(t)}};function CR(e,t){return JSON.stringify(e)===JSON.stringify(t)}function L_(e,t){let o=new DOMParser().parseFromString(e,"text/html"),r=o.createElement("meta");if(r.httpEquiv="Content-Security-Policy",r.content=t,o.head.prepend(r),!o.querySelector("base[href]")){let n=o.querySelector("base")??o.createElement("base");n.setAttribute("href","about:srcdoc"),r.after(n)}return"<!doctype html>"+o.documentElement.outerHTML}var $e=new Yl({name:"ADS preview",version:"1.0.0"},{},{autoResize:!0}),Wr=document.getElementById("ads-token-root"),Lt=document.getElementById("ads-widget-status"),tu=document.getElementById("ads-token-theme"),eu=document.getElementById("ads-scenario-root"),To,Me=0,U_="",Br=30,Z_=document.createElement("style");Wr&&document.head.append(Z_);function ou(e){e!=="light"&&e!=="dark"||(document.documentElement.dataset.theme=e,tu&&(tu.value=e),Wr&&To&&wo())}function Oe(e,t){let o=document.createElement(e);return o.textContent=t,o}function IR(e){let t=Oe("li","");t.dataset.token=e.name;let o=getComputedStyle(document.documentElement).getPropertyValue(e.name).trim(),r=Oe("details","");r.className="token-source";let n=Oe("summary","");n.title=`${e.name}: ${o||"Conditional or unset"}. Click to inspect source definitions.`;let s=Oe("code",e.name);s.className="token-name";let a=Oe("span",o||"Conditional or unset");n.append(s,a);let l=Oe("dl","");l.append(Oe("dt","Computed in preview"),Oe("dd",o||"Conditional or unset")),e.meaning&&l.append(Oe("dt","Meaning"),Oe("dd",e.meaning));for(let u of e.definitions)l.append(Oe("dt",u.scope),Oe("dd",`${u.value} \xB7 ${u.file}:${u.line}`));return r.append(n,l),t.append(r),t}function wo(){Z_.textContent=To.css;let e=To.tokens.filter(t=>`${t.name} ${t.type??""}`.toLowerCase().includes(U_.toLowerCase()));document.getElementById("ads-token-list").replaceChildren(...e.slice(Me,Me+Br).map(IR)),document.querySelector("footer").hidden=e.length<=Br,document.getElementById("ads-token-count").textContent=e.length?`${Me+1}\u2013${Math.min(Me+Br,e.length)} of ${e.length}`:"No matching tokens",document.getElementById("ads-token-prev").disabled=Me===0,document.getElementById("ads-token-next").disabled=Me+Br>=e.length,Lt.textContent=`${e.length} matching definitions \xB7 ${To.diagnostics.length} diagnostics`}Wr&&($e.ontoolinput=()=>{Me=0,To&&wo()},To=JSON.parse(document.getElementById("ads-token-seed").textContent),ou("light"),document.getElementById("ads-token-search").addEventListener("input",e=>{U_=e.target.value,Me=0,wo()}),tu.addEventListener("change",()=>ou(tu.value)),document.getElementById("ads-token-prev").addEventListener("click",()=>{Me=Math.max(0,Me-Br),wo()}),document.getElementById("ads-token-next").addEventListener("click",()=>{Me+=Br,wo()}),document.getElementById("ads-token-refresh").addEventListener("click",async()=>{try{let e=await $e.readServerResource({uri:"ads://project/tokens"});To=JSON.parse(e.contents.find(t=>"text"in t).text),Me=0,wo()}catch(e){Lt.textContent=`Refresh failed: ${e.message}`}}));var xo,$f,D_=!1,_a=0;async function H_(e){if($f=e,!D_||!eu)return;let t=e?.structuredContent?.scenario?.resourceUri;if(!t||!t.startsWith("ui://ads/previews/"))return;let o=++_a;Wr&&(Wr.hidden=!0,Lt=document.getElementById("ads-scenario-status")),eu.hidden=!1;try{if(!$e.getHostCapabilities()?.serverResources)throw new Error("This Apps host does not forward server resources. Use the project showcase URL from the tool result.");let n=(await $e.readServerResource({uri:t})).contents.find(u=>u.mimeType==="text/html;profile=mcp-app"&&typeof u.text=="string");if(!n)throw new Error("Scenario HTML is unavailable.");if(o!==_a)return;xo&&(await xo.close(),xo=void 0);let s=document.createElement("iframe");s.title=e.structuredContent.scenario.title,s.setAttribute("sandbox","allow-scripts"),eu.replaceChildren(s);let a=new Xl(null,{name:"ADS scenario host",version:"1.0.0"},{serverResources:{},serverTools:{}},{hostContext:$e.getHostContext()});xo=a,a.onreadresource=u=>$e.readServerResource(u),a.oncalltool=u=>$e.callServerTool(u),a.onsizechange=({height:u})=>{u&&(s.height=String(Math.min(1e4,Math.max(120,u))))},a.oninitialized=async()=>{await a.sendToolInput({arguments:{}}),await a.sendToolResult(e),o===_a&&window.parent.postMessage({type:"ads-preview-ready"},"*")},await a.connect(new Ql(s.contentWindow,s.contentWindow));let l="default-src 'none'; script-src 'unsafe-inline' blob:; style-src 'unsafe-inline'; img-src data: blob:; font-src data:; worker-src blob: data:; connect-src 'none'; base-uri about:; object-src 'none'";s.srcdoc=L_(n.text,l),Lt.hidden=!0}catch(r){o===_a&&(Lt.hidden=!1,Lt.textContent=r.message,window.parent.postMessage({type:"ads-preview-ready"},"*"))}}eu&&($e.ontoolresult=e=>{H_(e)},$e.onteardown=async()=>{++_a;let e=xo;xo=void 0;try{await e?.teardownResource({},{timeout:500})}catch{}return await e?.close(),{}});$e.onhostcontextchanged=e=>{ou(e.theme),xo?.setHostContext(e)};try{await $e.connect(),D_=!0,$f&&H_($f),ou($e.getHostContext()?.theme),Wr&&(document.getElementById("ads-token-refresh").disabled=!$e.getHostCapabilities()?.serverResources,wo())}catch{Lt&&(Lt.textContent="Apps bridge unavailable. Samples remain usable; inspect project data through ADS tools/resources.")}
142
142
  /*! Bundled license information:
143
143
 
144
144
  @modelcontextprotocol/client/dist/src-WCy6ifGf.mjs: