@modelcontextprotocol/ext-apps 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var Me=Object.defineProperty;var s=(r,i)=>{for(var o in i)Me(r,o,{get:i[o],enumerable:!0,configurable:!0,set:($)=>i[o]=()=>$})};import{useEffect as cb,useState as Xl}from"react";import{Protocol as ub}from"@modelcontextprotocol/sdk/shared/protocol.js";import{CallToolRequestSchema as tb,CallToolResultSchema as gb,EmptyResultSchema as lb,ListToolsRequestSchema as Ib,PingRequestSchema as eb}from"@modelcontextprotocol/sdk/types.js";import{JSONRPCMessageSchema as Re}from"@modelcontextprotocol/sdk/types.js";class zr{eventTarget;eventSource;messageListener;constructor(r=window.parent,i){this.eventTarget=r;this.eventSource=i;this.messageListener=(o)=>{if(i&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let $=Re.safeParse(o.data);if($.success)console.debug("Parsed message",$.data),this.onmessage?.($.data);else console.error("Failed to parse message",$.error.message,o),this.onerror?.(Error("Invalid JSON-RPC message received: "+$.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(r,i){console.debug("Sending message",r),this.eventTarget.postMessage(r,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Pv="2026-01-26",me="ui/open-link",xe="ui/message",Ze="ui/notifications/sandbox-proxy-ready",Ce="ui/notifications/sandbox-resource-ready",de="ui/notifications/size-changed",fe="ui/notifications/tool-input",ye="ui/notifications/tool-input-partial",he="ui/notifications/tool-result",ae="ui/notifications/tool-cancelled",pe="ui/notifications/host-context-changed",se="ui/resource-teardown",r4="ui/initialize",n4="ui/notifications/initialized",i4="ui/request-display-mode";var g={};s(g,{xor:()=>ve,xid:()=>LI,void:()=>aI,uuidv7:()=>wI,uuidv6:()=>DI,uuidv4:()=>kI,uuid:()=>UI,util:()=>D,url:()=>NI,uppercase:()=>Yr,unknown:()=>Nr,union:()=>lv,undefined:()=>yI,ulid:()=>JI,uint64:()=>dI,uint32:()=>xI,tuple:()=>Mg,trim:()=>Hr,treeifyError:()=>Av,transform:()=>ev,toUpperCase:()=>Rr,toLowerCase:()=>Mr,toJSONSchema:()=>Qi,templateLiteral:()=>ke,symbol:()=>fI,superRefine:()=>_l,success:()=>be,stringbool:()=>je,stringFormat:()=>FI,string:()=>Ri,strictObject:()=>ne,startsWith:()=>Qr,slugify:()=>mr,size:()=>kr,setErrorMap:()=>qc,set:()=>ge,safeParseAsync:()=>Ug,safeParse:()=>_g,safeEncodeAsync:()=>zg,safeEncode:()=>Og,safeDecodeAsync:()=>Pg,safeDecode:()=>Sg,registry:()=>ti,regexes:()=>x,regex:()=>Kr,refine:()=>bl,record:()=>Rg,readonly:()=>tl,property:()=>Ki,promise:()=>De,prettifyError:()=>Qv,preprocess:()=>Le,prefault:()=>rl,positive:()=>Ei,pipe:()=>En,partialRecord:()=>$e,parseAsync:()=>bg,parse:()=>cg,overwrite:()=>C,optional:()=>Ln,object:()=>re,number:()=>Jg,nullish:()=>ce,nullable:()=>Gn,null:()=>Xg,normalize:()=>Tr,nonpositive:()=>Xi,nonoptional:()=>nl,nonnegative:()=>Vi,never:()=>gv,negative:()=>Wi,nativeEnum:()=>le,nanoid:()=>zI,nan:()=>_e,multipleOf:()=>tr,minSize:()=>a,minLength:()=>nr,mime:()=>Br,meta:()=>ze,maxSize:()=>gr,maxLength:()=>Dr,map:()=>te,mac:()=>WI,lte:()=>R,lt:()=>y,lowercase:()=>qr,looseRecord:()=>ue,looseObject:()=>ie,locales:()=>Sn,literal:()=>Ie,length:()=>wr,lazy:()=>Il,ksuid:()=>GI,keyof:()=>sI,jwt:()=>QI,json:()=>Je,iso:()=>Cr,ipv6:()=>XI,ipv4:()=>EI,intersection:()=>Tg,int64:()=>CI,int32:()=>mI,int:()=>mi,instanceof:()=>Pe,includes:()=>Ar,httpUrl:()=>OI,hostname:()=>BI,hex:()=>TI,hash:()=>HI,guid:()=>_I,gte:()=>A,gt:()=>h,globalRegistry:()=>K,getErrorMap:()=>Yc,function:()=>we,fromJSONSchema:()=>Ee,formatError:()=>In,float64:()=>RI,float32:()=>MI,flattenError:()=>ln,file:()=>ee,exactOptional:()=>yg,enum:()=>Iv,endsWith:()=>Fr,encodeAsync:()=>wg,encode:()=>kg,emoji:()=>SI,email:()=>bI,e164:()=>AI,discriminatedUnion:()=>oe,describe:()=>Se,decodeAsync:()=>Ng,decode:()=>Dg,date:()=>pI,custom:()=>Oe,cuid2:()=>jI,cuid:()=>PI,core:()=>ir,config:()=>V,coerce:()=>kl,codec:()=>Ue,clone:()=>Y,cidrv6:()=>KI,cidrv4:()=>VI,check:()=>Ne,catch:()=>ol,boolean:()=>Lg,bigint:()=>ZI,base64url:()=>YI,base64:()=>qI,array:()=>Vn,any:()=>hI,_function:()=>we,_default:()=>pg,_ZodString:()=>xi,ZodXor:()=>Qg,ZodXID:()=>ai,ZodVoid:()=>Yg,ZodUnknown:()=>Kg,ZodUnion:()=>qn,ZodUndefined:()=>Eg,ZodUUID:()=>p,ZodURL:()=>Wn,ZodULID:()=>hi,ZodType:()=>P,ZodTuple:()=>Hg,ZodTransform:()=>dg,ZodTemplateLiteral:()=>gl,ZodSymbol:()=>Gg,ZodSuccess:()=>il,ZodStringFormat:()=>E,ZodString:()=>fr,ZodSet:()=>xg,ZodRecord:()=>Yn,ZodRealError:()=>H,ZodReadonly:()=>ul,ZodPromise:()=>el,ZodPrefault:()=>sg,ZodPipe:()=>_v,ZodOptional:()=>cv,ZodObject:()=>Kn,ZodNumberFormat:()=>Or,ZodNumber:()=>hr,ZodNullable:()=>hg,ZodNull:()=>Wg,ZodNonOptional:()=>bv,ZodNever:()=>qg,ZodNanoID:()=>di,ZodNaN:()=>$l,ZodMap:()=>mg,ZodMAC:()=>jg,ZodLiteral:()=>Zg,ZodLazy:()=>ll,ZodKSUID:()=>pi,ZodJWT:()=>uv,ZodIssueCode:()=>Kc,ZodIntersection:()=>Bg,ZodISOTime:()=>Hi,ZodISODuration:()=>Mi,ZodISODateTime:()=>Bi,ZodISODate:()=>Ti,ZodIPv6:()=>rv,ZodIPv4:()=>si,ZodGUID:()=>Jn,ZodFunction:()=>cl,ZodFirstPartyTypeKind:()=>Ul,ZodFile:()=>Cg,ZodExactOptional:()=>fg,ZodError:()=>Xc,ZodEnum:()=>dr,ZodEmoji:()=>Ci,ZodEmail:()=>Zi,ZodE164:()=>$v,ZodDiscriminatedUnion:()=>Fg,ZodDefault:()=>ag,ZodDate:()=>Xn,ZodCustomStringFormat:()=>yr,ZodCustom:()=>An,ZodCodec:()=>Uv,ZodCatch:()=>vl,ZodCUID2:()=>yi,ZodCUID:()=>fi,ZodCIDRv6:()=>iv,ZodCIDRv4:()=>nv,ZodBoolean:()=>ar,ZodBigIntFormat:()=>tv,ZodBigInt:()=>pr,ZodBase64URL:()=>ov,ZodBase64:()=>vv,ZodArray:()=>Ag,ZodAny:()=>Vg,TimePrecision:()=>Mu,NEVER:()=>jv,$output:()=>Au,$input:()=>Qu,$brand:()=>Jv});var ir={};s(ir,{version:()=>Vo,util:()=>D,treeifyError:()=>Av,toJSONSchema:()=>Qi,toDotPath:()=>Ql,safeParseAsync:()=>Bv,safeParse:()=>Fv,safeEncodeAsync:()=>A4,safeEncode:()=>q4,safeDecodeAsync:()=>Q4,safeDecode:()=>Y4,registry:()=>ti,regexes:()=>x,process:()=>L,prettifyError:()=>Qv,parseAsync:()=>Tn,parse:()=>Bn,meta:()=>St,locales:()=>Sn,isValidJWT:()=>nI,isValidBase64URL:()=>rI,isValidBase64:()=>r$,initializeContext:()=>lr,globalRegistry:()=>K,globalConfig:()=>rn,formatError:()=>In,flattenError:()=>ln,finalize:()=>er,extractDefs:()=>Ir,encodeAsync:()=>V4,encode:()=>W4,describe:()=>Ot,decodeAsync:()=>K4,decode:()=>X4,createToJSONSchemaMethod:()=>Pt,createStandardJSONSchemaMethod:()=>Zr,config:()=>V,clone:()=>Y,_xor:()=>uc,_xid:()=>wi,_void:()=>et,_uuidv7:()=>ci,_uuidv6:()=>ei,_uuidv4:()=>Ii,_uuid:()=>li,_url:()=>Pn,_uppercase:()=>Yr,_unknown:()=>lt,_union:()=>$c,_undefined:()=>ut,_ulid:()=>Di,_uint64:()=>ot,_uint32:()=>pu,_tuple:()=>lc,_trim:()=>Hr,_transform:()=>kc,_toUpperCase:()=>Rr,_toLowerCase:()=>Mr,_templateLiteral:()=>Jc,_symbol:()=>$t,_superRefine:()=>Nt,_success:()=>Sc,_stringbool:()=>zt,_stringFormat:()=>xr,_string:()=>Bu,_startsWith:()=>Qr,_slugify:()=>mr,_size:()=>kr,_set:()=>cc,_safeParseAsync:()=>Wr,_safeParse:()=>Er,_safeEncodeAsync:()=>Cn,_safeEncode:()=>xn,_safeDecodeAsync:()=>dn,_safeDecode:()=>Zn,_regex:()=>Kr,_refine:()=>wt,_record:()=>Ic,_readonly:()=>jc,_property:()=>Ki,_promise:()=>Gc,_positive:()=>Ei,_pipe:()=>Pc,_parseAsync:()=>Gr,_parse:()=>Lr,_overwrite:()=>C,_optional:()=>Dc,_number:()=>Cu,_nullable:()=>wc,_null:()=>tt,_normalize:()=>Tr,_nonpositive:()=>Xi,_nonoptional:()=>Oc,_nonnegative:()=>Vi,_never:()=>It,_negative:()=>Wi,_nativeEnum:()=>_c,_nanoid:()=>_i,_nan:()=>_t,_multipleOf:()=>tr,_minSize:()=>a,_minLength:()=>nr,_min:()=>A,_mime:()=>Br,_maxSize:()=>gr,_maxLength:()=>Dr,_max:()=>R,_map:()=>ec,_mac:()=>Hu,_lte:()=>R,_lt:()=>y,_lowercase:()=>qr,_literal:()=>Uc,_length:()=>wr,_lazy:()=>Lc,_ksuid:()=>Ni,_jwt:()=>Gi,_isoTime:()=>xu,_isoDuration:()=>Zu,_isoDateTime:()=>Ru,_isoDate:()=>mu,_ipv6:()=>Si,_ipv4:()=>Oi,_intersection:()=>gc,_int64:()=>vt,_int32:()=>au,_int:()=>fu,_includes:()=>Ar,_guid:()=>zn,_gte:()=>A,_gt:()=>h,_float64:()=>hu,_float32:()=>yu,_file:()=>kt,_enum:()=>bc,_endsWith:()=>Fr,_encodeAsync:()=>Rn,_encode:()=>Hn,_emoji:()=>bi,_email:()=>gi,_e164:()=>Li,_discriminatedUnion:()=>tc,_default:()=>Nc,_decodeAsync:()=>mn,_decode:()=>Mn,_date:()=>ct,_custom:()=>Dt,_cuid2:()=>ki,_cuid:()=>Ui,_coercedString:()=>Tu,_coercedNumber:()=>du,_coercedDate:()=>bt,_coercedBoolean:()=>rt,_coercedBigint:()=>it,_cidrv6:()=>Pi,_cidrv4:()=>zi,_check:()=>II,_catch:()=>zc,_boolean:()=>su,_bigint:()=>nt,_base64url:()=>Ji,_base64:()=>ji,_array:()=>Ut,_any:()=>gt,TimePrecision:()=>Mu,NEVER:()=>jv,JSONSchemaGenerator:()=>tg,JSONSchema:()=>eI,Doc:()=>an,$output:()=>Au,$input:()=>Qu,$constructor:()=>e,$brand:()=>Jv,$ZodXor:()=>w$,$ZodXID:()=>Ro,$ZodVoid:()=>_$,$ZodUnknown:()=>c$,$ZodUnion:()=>Un,$ZodUndefined:()=>l$,$ZodUUID:()=>Yo,$ZodURL:()=>Qo,$ZodULID:()=>Mo,$ZodType:()=>z,$ZodTuple:()=>$i,$ZodTransform:()=>G$,$ZodTemplateLiteral:()=>B$,$ZodSymbol:()=>g$,$ZodSuccess:()=>q$,$ZodStringFormat:()=>G,$ZodString:()=>Ur,$ZodSet:()=>P$,$ZodRegistry:()=>Fu,$ZodRecord:()=>S$,$ZodRealError:()=>T,$ZodReadonly:()=>F$,$ZodPromise:()=>H$,$ZodPrefault:()=>V$,$ZodPipe:()=>Q$,$ZodOptional:()=>ui,$ZodObjectJIT:()=>D$,$ZodObject:()=>oI,$ZodNumberFormat:()=>u$,$ZodNumber:()=>vi,$ZodNullable:()=>W$,$ZodNull:()=>I$,$ZodNonOptional:()=>K$,$ZodNever:()=>b$,$ZodNanoID:()=>Bo,$ZodNaN:()=>A$,$ZodMap:()=>z$,$ZodMAC:()=>ao,$ZodLiteral:()=>J$,$ZodLazy:()=>M$,$ZodKSUID:()=>mo,$ZodJWT:()=>o$,$ZodIntersection:()=>O$,$ZodISOTime:()=>Co,$ZodISODuration:()=>fo,$ZodISODateTime:()=>xo,$ZodISODate:()=>Zo,$ZodIPv6:()=>ho,$ZodIPv4:()=>yo,$ZodGUID:()=>qo,$ZodFunction:()=>T$,$ZodFile:()=>L$,$ZodExactOptional:()=>E$,$ZodError:()=>gn,$ZodEnum:()=>j$,$ZodEncodeError:()=>cr,$ZodEmoji:()=>Fo,$ZodEmail:()=>Ao,$ZodE164:()=>v$,$ZodDiscriminatedUnion:()=>N$,$ZodDefault:()=>X$,$ZodDate:()=>U$,$ZodCustomStringFormat:()=>$$,$ZodCustom:()=>R$,$ZodCodec:()=>kn,$ZodCheckUpperCase:()=>jo,$ZodCheckStringFormat:()=>Xr,$ZodCheckStartsWith:()=>Lo,$ZodCheckSizeEquals:()=>wo,$ZodCheckRegex:()=>zo,$ZodCheckProperty:()=>Eo,$ZodCheckOverwrite:()=>Xo,$ZodCheckNumberFormat:()=>_o,$ZodCheckMultipleOf:()=>bo,$ZodCheckMinSize:()=>Do,$ZodCheckMinLength:()=>Oo,$ZodCheckMimeType:()=>Wo,$ZodCheckMaxSize:()=>ko,$ZodCheckMaxLength:()=>No,$ZodCheckLowerCase:()=>Po,$ZodCheckLessThan:()=>yn,$ZodCheckLengthEquals:()=>So,$ZodCheckIncludes:()=>Jo,$ZodCheckGreaterThan:()=>hn,$ZodCheckEndsWith:()=>Go,$ZodCheckBigIntFormat:()=>Uo,$ZodCheck:()=>W,$ZodCatch:()=>Y$,$ZodCUID2:()=>Ho,$ZodCUID:()=>To,$ZodCIDRv6:()=>so,$ZodCIDRv4:()=>po,$ZodBoolean:()=>_n,$ZodBigIntFormat:()=>t$,$ZodBigInt:()=>oi,$ZodBase64URL:()=>i$,$ZodBase64:()=>n$,$ZodAsyncError:()=>f,$ZodArray:()=>k$,$ZodAny:()=>e$});var jv=Object.freeze({status:"aborted"});function e(r,i,o){function $(t,I){if(!t._zod)Object.defineProperty(t,"_zod",{value:{def:I,constr:u,traits:new Set},enumerable:!1});if(t._zod.traits.has(r))return;t._zod.traits.add(r),i(t,I);let l=u.prototype,c=Object.keys(l);for(let _=0;_<c.length;_++){let N=c[_];if(!(N in t))t[N]=l[N].bind(t)}}let n=o?.Parent??Object;class v extends n{}Object.defineProperty(v,"name",{value:r});function u(t){var I;let l=o?.Parent?new v:this;$(l,t),(I=l._zod).deferred??(I.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(u,"init",{value:$}),Object.defineProperty(u,Symbol.hasInstance,{value:(t)=>{if(o?.Parent&&t instanceof o.Parent)return!0;return t?._zod?.traits?.has(r)}}),Object.defineProperty(u,"name",{value:r}),u}var Jv=Symbol("zod_brand");class f extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class cr extends Error{constructor(r){super(`Encountered unidirectional transform during encode: ${r}`);this.name="ZodEncodeError"}}var rn={};function V(r){if(r)Object.assign(rn,r);return rn}var D={};s(D,{unwrapMessage:()=>nn,uint8ArrayToHex:()=>G4,uint8ArrayToBase64url:()=>J4,uint8ArrayToBase64:()=>ql,stringifyPrimitive:()=>U,slugify:()=>Ev,shallowClone:()=>Xv,safeExtend:()=>N4,required:()=>z4,randomString:()=>c4,propertyKeyTypes:()=>$n,promiseAllObject:()=>e4,primitiveTypes:()=>Vv,prefixIssues:()=>M,pick:()=>k4,partial:()=>S4,parsedType:()=>k,optionalKeys:()=>Kv,omit:()=>D4,objectClone:()=>g4,numKeys:()=>b4,nullish:()=>vr,normalizeParams:()=>w,mergeDefs:()=>rr,merge:()=>O4,jsonStringifyReplacer:()=>Pr,joinValues:()=>b,issue:()=>Jr,isPlainObject:()=>$r,isObject:()=>br,hexToUint8Array:()=>L4,getSizableOrigin:()=>un,getParsedType:()=>_4,getLengthableOrigin:()=>tn,getEnumValues:()=>vn,getElementAtPath:()=>I4,floatSafeRemainder:()=>Gv,finalizeIssue:()=>B,extend:()=>w4,escapeRegex:()=>m,esc:()=>Qn,defineLazy:()=>j,createTransparentProxy:()=>U4,cloneDef:()=>l4,clone:()=>Y,cleanRegex:()=>on,cleanEnum:()=>P4,captureStackTrace:()=>Fn,cached:()=>jr,base64urlToUint8Array:()=>j4,base64ToUint8Array:()=>Kl,assignProp:()=>or,assertNotEqual:()=>o4,assertNever:()=>u4,assertIs:()=>$4,assertEqual:()=>v4,assert:()=>t4,allowsEval:()=>Wv,aborted:()=>ur,NUMBER_FORMAT_RANGES:()=>qv,Class:()=>Yl,BIGINT_FORMAT_RANGES:()=>Yv});function v4(r){return r}function o4(r){return r}function $4(r){}function u4(r){throw Error("Unexpected value in exhaustive check")}function t4(r){}function vn(r){let i=Object.values(r).filter(($)=>typeof $==="number");return Object.entries(r).filter(([$,n])=>i.indexOf(+$)===-1).map(([$,n])=>n)}function b(r,i="|"){return r.map((o)=>U(o)).join(i)}function Pr(r,i){if(typeof i==="bigint")return i.toString();return i}function jr(r){return{get value(){{let o=r();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function vr(r){return r===null||r===void 0}function on(r){let i=r.startsWith("^")?1:0,o=r.endsWith("$")?r.length-1:r.length;return r.slice(i,o)}function Gv(r,i){let o=(r.toString().split(".")[1]||"").length,$=i.toString(),n=($.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test($)){let I=$.match(/\d?e-(\d?)/);if(I?.[1])n=Number.parseInt(I[1])}let v=o>n?o:n,u=Number.parseInt(r.toFixed(v).replace(".","")),t=Number.parseInt(i.toFixed(v).replace(".",""));return u%t/10**v}var Vl=Symbol("evaluating");function j(r,i,o){let $=void 0;Object.defineProperty(r,i,{get(){if($===Vl)return;if($===void 0)$=Vl,$=o();return $},set(n){Object.defineProperty(r,i,{value:n})},configurable:!0})}function g4(r){return Object.create(Object.getPrototypeOf(r),Object.getOwnPropertyDescriptors(r))}function or(r,i,o){Object.defineProperty(r,i,{value:o,writable:!0,enumerable:!0,configurable:!0})}function rr(...r){let i={};for(let o of r){let $=Object.getOwnPropertyDescriptors(o);Object.assign(i,$)}return Object.defineProperties({},i)}function l4(r){return rr(r._zod.def)}function I4(r,i){if(!i)return r;return i.reduce((o,$)=>o?.[$],r)}function e4(r){let i=Object.keys(r),o=i.map(($)=>r[$]);return Promise.all(o).then(($)=>{let n={};for(let v=0;v<i.length;v++)n[i[v]]=$[v];return n})}function c4(r=10){let o="";for(let $=0;$<r;$++)o+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return o}function Qn(r){return JSON.stringify(r)}function Ev(r){return r.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Fn="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function br(r){return typeof r==="object"&&r!==null&&!Array.isArray(r)}var Wv=jr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(r){return!1}});function $r(r){if(br(r)===!1)return!1;let i=r.constructor;if(i===void 0)return!0;if(typeof i!=="function")return!0;let o=i.prototype;if(br(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Xv(r){if($r(r))return{...r};if(Array.isArray(r))return[...r];return r}function b4(r){let i=0;for(let o in r)if(Object.prototype.hasOwnProperty.call(r,o))i++;return i}var _4=(r)=>{let i=typeof r;switch(i){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(r)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(r))return"array";if(r===null)return"null";if(r.then&&typeof r.then==="function"&&r.catch&&typeof r.catch==="function")return"promise";if(typeof Map<"u"&&r instanceof Map)return"map";if(typeof Set<"u"&&r instanceof Set)return"set";if(typeof Date<"u"&&r instanceof Date)return"date";if(typeof File<"u"&&r instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${i}`)}},$n=new Set(["string","number","symbol"]),Vv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function m(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(r,i,o){let $=new r._zod.constr(i??r._zod.def);if(!i||o?.parent)$._zod.parent=r;return $}function w(r){let i=r;if(!i)return{};if(typeof i==="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");i.error=i.message}if(delete i.message,typeof i.error==="string")return{...i,error:()=>i.error};return i}function U4(r){let i;return new Proxy({},{get(o,$,n){return i??(i=r()),Reflect.get(i,$,n)},set(o,$,n,v){return i??(i=r()),Reflect.set(i,$,n,v)},has(o,$){return i??(i=r()),Reflect.has(i,$)},deleteProperty(o,$){return i??(i=r()),Reflect.deleteProperty(i,$)},ownKeys(o){return i??(i=r()),Reflect.ownKeys(i)},getOwnPropertyDescriptor(o,$){return i??(i=r()),Reflect.getOwnPropertyDescriptor(i,$)},defineProperty(o,$,n){return i??(i=r()),Reflect.defineProperty(i,$,n)}})}function U(r){if(typeof r==="bigint")return r.toString()+"n";if(typeof r==="string")return`"${r}"`;return`${r}`}function Kv(r){return Object.keys(r).filter((i)=>{return r[i]._zod.optin==="optional"&&r[i]._zod.optout==="optional"})}var qv={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Yv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function k4(r,i){let o=r._zod.def,$=o.checks;if($&&$.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let v=rr(r._zod.def,{get shape(){let u={};for(let t in i){if(!(t in o.shape))throw Error(`Unrecognized key: "${t}"`);if(!i[t])continue;u[t]=o.shape[t]}return or(this,"shape",u),u},checks:[]});return Y(r,v)}function D4(r,i){let o=r._zod.def,$=o.checks;if($&&$.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let v=rr(r._zod.def,{get shape(){let u={...r._zod.def.shape};for(let t in i){if(!(t in o.shape))throw Error(`Unrecognized key: "${t}"`);if(!i[t])continue;delete u[t]}return or(this,"shape",u),u},checks:[]});return Y(r,v)}function w4(r,i){if(!$r(i))throw Error("Invalid input to extend: expected a plain object");let o=r._zod.def.checks;if(o&&o.length>0){let v=r._zod.def.shape;for(let u in i)if(Object.getOwnPropertyDescriptor(v,u)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=rr(r._zod.def,{get shape(){let v={...r._zod.def.shape,...i};return or(this,"shape",v),v}});return Y(r,n)}function N4(r,i){if(!$r(i))throw Error("Invalid input to safeExtend: expected a plain object");let o=rr(r._zod.def,{get shape(){let $={...r._zod.def.shape,...i};return or(this,"shape",$),$}});return Y(r,o)}function O4(r,i){let o=rr(r._zod.def,{get shape(){let $={...r._zod.def.shape,...i._zod.def.shape};return or(this,"shape",$),$},get catchall(){return i._zod.def.catchall},checks:[]});return Y(r,o)}function S4(r,i,o){let n=i._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let u=rr(i._zod.def,{get shape(){let t=i._zod.def.shape,I={...t};if(o)for(let l in o){if(!(l in t))throw Error(`Unrecognized key: "${l}"`);if(!o[l])continue;I[l]=r?new r({type:"optional",innerType:t[l]}):t[l]}else for(let l in t)I[l]=r?new r({type:"optional",innerType:t[l]}):t[l];return or(this,"shape",I),I},checks:[]});return Y(i,u)}function z4(r,i,o){let $=rr(i._zod.def,{get shape(){let n=i._zod.def.shape,v={...n};if(o)for(let u in o){if(!(u in v))throw Error(`Unrecognized key: "${u}"`);if(!o[u])continue;v[u]=new r({type:"nonoptional",innerType:n[u]})}else for(let u in n)v[u]=new r({type:"nonoptional",innerType:n[u]});return or(this,"shape",v),v}});return Y(i,$)}function ur(r,i=0){if(r.aborted===!0)return!0;for(let o=i;o<r.issues.length;o++)if(r.issues[o]?.continue!==!0)return!0;return!1}function M(r,i){return i.map((o)=>{var $;return($=o).path??($.path=[]),o.path.unshift(r),o})}function nn(r){return typeof r==="string"?r:r?.message}function B(r,i,o){let $={...r,path:r.path??[]};if(!r.message){let n=nn(r.inst?._zod.def?.error?.(r))??nn(i?.error?.(r))??nn(o.customError?.(r))??nn(o.localeError?.(r))??"Invalid input";$.message=n}if(delete $.inst,delete $.continue,!i?.reportInput)delete $.input;return $}function un(r){if(r instanceof Set)return"set";if(r instanceof Map)return"map";if(r instanceof File)return"file";return"unknown"}function tn(r){if(Array.isArray(r))return"array";if(typeof r==="string")return"string";return"unknown"}function k(r){let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"nan":"number";case"object":{if(r===null)return"null";if(Array.isArray(r))return"array";let o=r;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return i}function Jr(...r){let[i,o,$]=r;if(typeof i==="string")return{message:i,code:"custom",input:o,inst:$};return{...i}}function P4(r){return Object.entries(r).filter(([i,o])=>{return Number.isNaN(Number.parseInt(i,10))}).map((i)=>i[1])}function Kl(r){let i=atob(r),o=new Uint8Array(i.length);for(let $=0;$<i.length;$++)o[$]=i.charCodeAt($);return o}function ql(r){let i="";for(let o=0;o<r.length;o++)i+=String.fromCharCode(r[o]);return btoa(i)}function j4(r){let i=r.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-i.length%4)%4);return Kl(i+o)}function J4(r){return ql(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function L4(r){let i=r.replace(/^0x/,"");if(i.length%2!==0)throw Error("Invalid hex string length");let o=new Uint8Array(i.length/2);for(let $=0;$<i.length;$+=2)o[$/2]=Number.parseInt(i.slice($,$+2),16);return o}function G4(r){return Array.from(r).map((i)=>i.toString(16).padStart(2,"0")).join("")}class Yl{constructor(...r){}}var Al=(r,i)=>{r.name="$ZodError",Object.defineProperty(r,"_zod",{value:r._zod,enumerable:!1}),Object.defineProperty(r,"issues",{value:i,enumerable:!1}),r.message=JSON.stringify(i,Pr,2),Object.defineProperty(r,"toString",{value:()=>r.message,enumerable:!1})},gn=e("$ZodError",Al),T=e("$ZodError",Al,{Parent:Error});function ln(r,i=(o)=>o.message){let o={},$=[];for(let n of r.issues)if(n.path.length>0)o[n.path[0]]=o[n.path[0]]||[],o[n.path[0]].push(i(n));else $.push(i(n));return{formErrors:$,fieldErrors:o}}function In(r,i=(o)=>o.message){let o={_errors:[]},$=(n)=>{for(let v of n.issues)if(v.code==="invalid_union"&&v.errors.length)v.errors.map((u)=>$({issues:u}));else if(v.code==="invalid_key")$({issues:v.issues});else if(v.code==="invalid_element")$({issues:v.issues});else if(v.path.length===0)o._errors.push(i(v));else{let u=o,t=0;while(t<v.path.length){let I=v.path[t];if(t!==v.path.length-1)u[I]=u[I]||{_errors:[]};else u[I]=u[I]||{_errors:[]},u[I]._errors.push(i(v));u=u[I],t++}}};return $(r),o}function Av(r,i=(o)=>o.message){let o={errors:[]},$=(n,v=[])=>{var u,t;for(let I of n.issues)if(I.code==="invalid_union"&&I.errors.length)I.errors.map((l)=>$({issues:l},I.path));else if(I.code==="invalid_key")$({issues:I.issues},I.path);else if(I.code==="invalid_element")$({issues:I.issues},I.path);else{let l=[...v,...I.path];if(l.length===0){o.errors.push(i(I));continue}let c=o,_=0;while(_<l.length){let N=l[_],O=_===l.length-1;if(typeof N==="string")c.properties??(c.properties={}),(u=c.properties)[N]??(u[N]={errors:[]}),c=c.properties[N];else c.items??(c.items=[]),(t=c.items)[N]??(t[N]={errors:[]}),c=c.items[N];if(O)c.errors.push(i(I));_++}}};return $(r),o}function Ql(r){let i=[],o=r.map(($)=>typeof $==="object"?$.key:$);for(let $ of o)if(typeof $==="number")i.push(`[${$}]`);else if(typeof $==="symbol")i.push(`[${JSON.stringify(String($))}]`);else if(/[^\w$]/.test($))i.push(`[${JSON.stringify($)}]`);else{if(i.length)i.push(".");i.push($)}return i.join("")}function Qv(r){let i=[],o=[...r.issues].sort(($,n)=>($.path??[]).length-(n.path??[]).length);for(let $ of o)if(i.push(`✖ ${$.message}`),$.path?.length)i.push(` → at ${Ql($.path)}`);return i.join(`
1
+ var Me=Object.defineProperty;var s=(r,i)=>{for(var o in i)Me(r,o,{get:i[o],enumerable:!0,configurable:!0,set:($)=>i[o]=()=>$})};import{useEffect as cb,useState as Xl}from"react";import{Protocol as ub}from"@modelcontextprotocol/sdk/shared/protocol.js";import{CallToolRequestSchema as tb,CallToolResultSchema as gb,EmptyResultSchema as lb,ListToolsRequestSchema as Ib,PingRequestSchema as eb}from"@modelcontextprotocol/sdk/types.js";import{JSONRPCMessageSchema as Re}from"@modelcontextprotocol/sdk/types.js";class zr{eventTarget;eventSource;messageListener;constructor(r=window.parent,i){this.eventTarget=r;this.eventSource=i;this.messageListener=(o)=>{if(i&&o.source!==this.eventSource){console.debug("Ignoring message from unknown source",o);return}let $=Re.safeParse(o.data);if($.success)console.debug("Parsed message",$.data),this.onmessage?.($.data);else if(o.data?.jsonrpc!=="2.0")console.debug("Ignoring non-JSON-RPC message",$.error.message,o);else console.error("Failed to parse message",$.error.message,o),this.onerror?.(Error("Invalid JSON-RPC message received: "+$.error.message))}}async start(){window.addEventListener("message",this.messageListener)}async send(r,i){console.debug("Sending message",r),this.eventTarget.postMessage(r,"*")}async close(){window.removeEventListener("message",this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion}var Pv="2026-01-26",me="ui/open-link",xe="ui/message",Ze="ui/notifications/sandbox-proxy-ready",Ce="ui/notifications/sandbox-resource-ready",de="ui/notifications/size-changed",fe="ui/notifications/tool-input",ye="ui/notifications/tool-input-partial",he="ui/notifications/tool-result",ae="ui/notifications/tool-cancelled",pe="ui/notifications/host-context-changed",se="ui/resource-teardown",r4="ui/initialize",n4="ui/notifications/initialized",i4="ui/request-display-mode";var g={};s(g,{xor:()=>ve,xid:()=>LI,void:()=>aI,uuidv7:()=>wI,uuidv6:()=>DI,uuidv4:()=>kI,uuid:()=>UI,util:()=>D,url:()=>NI,uppercase:()=>Yr,unknown:()=>Nr,union:()=>lv,undefined:()=>yI,ulid:()=>JI,uint64:()=>dI,uint32:()=>xI,tuple:()=>Mg,trim:()=>Hr,treeifyError:()=>Av,transform:()=>ev,toUpperCase:()=>Rr,toLowerCase:()=>Mr,toJSONSchema:()=>Qi,templateLiteral:()=>ke,symbol:()=>fI,superRefine:()=>_l,success:()=>be,stringbool:()=>je,stringFormat:()=>FI,string:()=>Ri,strictObject:()=>ne,startsWith:()=>Qr,slugify:()=>mr,size:()=>kr,setErrorMap:()=>qc,set:()=>ge,safeParseAsync:()=>Ug,safeParse:()=>_g,safeEncodeAsync:()=>zg,safeEncode:()=>Og,safeDecodeAsync:()=>Pg,safeDecode:()=>Sg,registry:()=>ti,regexes:()=>x,regex:()=>Kr,refine:()=>bl,record:()=>Rg,readonly:()=>tl,property:()=>Ki,promise:()=>De,prettifyError:()=>Qv,preprocess:()=>Le,prefault:()=>rl,positive:()=>Ei,pipe:()=>En,partialRecord:()=>$e,parseAsync:()=>bg,parse:()=>cg,overwrite:()=>C,optional:()=>Ln,object:()=>re,number:()=>Jg,nullish:()=>ce,nullable:()=>Gn,null:()=>Xg,normalize:()=>Tr,nonpositive:()=>Xi,nonoptional:()=>nl,nonnegative:()=>Vi,never:()=>gv,negative:()=>Wi,nativeEnum:()=>le,nanoid:()=>zI,nan:()=>_e,multipleOf:()=>tr,minSize:()=>a,minLength:()=>nr,mime:()=>Br,meta:()=>ze,maxSize:()=>gr,maxLength:()=>Dr,map:()=>te,mac:()=>WI,lte:()=>R,lt:()=>y,lowercase:()=>qr,looseRecord:()=>ue,looseObject:()=>ie,locales:()=>Sn,literal:()=>Ie,length:()=>wr,lazy:()=>Il,ksuid:()=>GI,keyof:()=>sI,jwt:()=>QI,json:()=>Je,iso:()=>Cr,ipv6:()=>XI,ipv4:()=>EI,intersection:()=>Tg,int64:()=>CI,int32:()=>mI,int:()=>mi,instanceof:()=>Pe,includes:()=>Ar,httpUrl:()=>OI,hostname:()=>BI,hex:()=>TI,hash:()=>HI,guid:()=>_I,gte:()=>A,gt:()=>h,globalRegistry:()=>K,getErrorMap:()=>Yc,function:()=>we,fromJSONSchema:()=>Ee,formatError:()=>In,float64:()=>RI,float32:()=>MI,flattenError:()=>ln,file:()=>ee,exactOptional:()=>yg,enum:()=>Iv,endsWith:()=>Fr,encodeAsync:()=>wg,encode:()=>kg,emoji:()=>SI,email:()=>bI,e164:()=>AI,discriminatedUnion:()=>oe,describe:()=>Se,decodeAsync:()=>Ng,decode:()=>Dg,date:()=>pI,custom:()=>Oe,cuid2:()=>jI,cuid:()=>PI,core:()=>ir,config:()=>V,coerce:()=>kl,codec:()=>Ue,clone:()=>Y,cidrv6:()=>KI,cidrv4:()=>VI,check:()=>Ne,catch:()=>ol,boolean:()=>Lg,bigint:()=>ZI,base64url:()=>YI,base64:()=>qI,array:()=>Vn,any:()=>hI,_function:()=>we,_default:()=>pg,_ZodString:()=>xi,ZodXor:()=>Qg,ZodXID:()=>ai,ZodVoid:()=>Yg,ZodUnknown:()=>Kg,ZodUnion:()=>qn,ZodUndefined:()=>Eg,ZodUUID:()=>p,ZodURL:()=>Wn,ZodULID:()=>hi,ZodType:()=>P,ZodTuple:()=>Hg,ZodTransform:()=>dg,ZodTemplateLiteral:()=>gl,ZodSymbol:()=>Gg,ZodSuccess:()=>il,ZodStringFormat:()=>E,ZodString:()=>fr,ZodSet:()=>xg,ZodRecord:()=>Yn,ZodRealError:()=>H,ZodReadonly:()=>ul,ZodPromise:()=>el,ZodPrefault:()=>sg,ZodPipe:()=>_v,ZodOptional:()=>cv,ZodObject:()=>Kn,ZodNumberFormat:()=>Or,ZodNumber:()=>hr,ZodNullable:()=>hg,ZodNull:()=>Wg,ZodNonOptional:()=>bv,ZodNever:()=>qg,ZodNanoID:()=>di,ZodNaN:()=>$l,ZodMap:()=>mg,ZodMAC:()=>jg,ZodLiteral:()=>Zg,ZodLazy:()=>ll,ZodKSUID:()=>pi,ZodJWT:()=>uv,ZodIssueCode:()=>Kc,ZodIntersection:()=>Bg,ZodISOTime:()=>Hi,ZodISODuration:()=>Mi,ZodISODateTime:()=>Bi,ZodISODate:()=>Ti,ZodIPv6:()=>rv,ZodIPv4:()=>si,ZodGUID:()=>Jn,ZodFunction:()=>cl,ZodFirstPartyTypeKind:()=>Ul,ZodFile:()=>Cg,ZodExactOptional:()=>fg,ZodError:()=>Xc,ZodEnum:()=>dr,ZodEmoji:()=>Ci,ZodEmail:()=>Zi,ZodE164:()=>$v,ZodDiscriminatedUnion:()=>Fg,ZodDefault:()=>ag,ZodDate:()=>Xn,ZodCustomStringFormat:()=>yr,ZodCustom:()=>An,ZodCodec:()=>Uv,ZodCatch:()=>vl,ZodCUID2:()=>yi,ZodCUID:()=>fi,ZodCIDRv6:()=>iv,ZodCIDRv4:()=>nv,ZodBoolean:()=>ar,ZodBigIntFormat:()=>tv,ZodBigInt:()=>pr,ZodBase64URL:()=>ov,ZodBase64:()=>vv,ZodArray:()=>Ag,ZodAny:()=>Vg,TimePrecision:()=>Mu,NEVER:()=>jv,$output:()=>Au,$input:()=>Qu,$brand:()=>Jv});var ir={};s(ir,{version:()=>Vo,util:()=>D,treeifyError:()=>Av,toJSONSchema:()=>Qi,toDotPath:()=>Ql,safeParseAsync:()=>Bv,safeParse:()=>Fv,safeEncodeAsync:()=>A4,safeEncode:()=>q4,safeDecodeAsync:()=>Q4,safeDecode:()=>Y4,registry:()=>ti,regexes:()=>x,process:()=>L,prettifyError:()=>Qv,parseAsync:()=>Tn,parse:()=>Bn,meta:()=>St,locales:()=>Sn,isValidJWT:()=>nI,isValidBase64URL:()=>rI,isValidBase64:()=>r$,initializeContext:()=>lr,globalRegistry:()=>K,globalConfig:()=>rn,formatError:()=>In,flattenError:()=>ln,finalize:()=>er,extractDefs:()=>Ir,encodeAsync:()=>V4,encode:()=>W4,describe:()=>Ot,decodeAsync:()=>K4,decode:()=>X4,createToJSONSchemaMethod:()=>Pt,createStandardJSONSchemaMethod:()=>Zr,config:()=>V,clone:()=>Y,_xor:()=>uc,_xid:()=>wi,_void:()=>et,_uuidv7:()=>ci,_uuidv6:()=>ei,_uuidv4:()=>Ii,_uuid:()=>li,_url:()=>Pn,_uppercase:()=>Yr,_unknown:()=>lt,_union:()=>$c,_undefined:()=>ut,_ulid:()=>Di,_uint64:()=>ot,_uint32:()=>pu,_tuple:()=>lc,_trim:()=>Hr,_transform:()=>kc,_toUpperCase:()=>Rr,_toLowerCase:()=>Mr,_templateLiteral:()=>Jc,_symbol:()=>$t,_superRefine:()=>Nt,_success:()=>Sc,_stringbool:()=>zt,_stringFormat:()=>xr,_string:()=>Bu,_startsWith:()=>Qr,_slugify:()=>mr,_size:()=>kr,_set:()=>cc,_safeParseAsync:()=>Wr,_safeParse:()=>Er,_safeEncodeAsync:()=>Cn,_safeEncode:()=>xn,_safeDecodeAsync:()=>dn,_safeDecode:()=>Zn,_regex:()=>Kr,_refine:()=>wt,_record:()=>Ic,_readonly:()=>jc,_property:()=>Ki,_promise:()=>Gc,_positive:()=>Ei,_pipe:()=>Pc,_parseAsync:()=>Gr,_parse:()=>Lr,_overwrite:()=>C,_optional:()=>Dc,_number:()=>Cu,_nullable:()=>wc,_null:()=>tt,_normalize:()=>Tr,_nonpositive:()=>Xi,_nonoptional:()=>Oc,_nonnegative:()=>Vi,_never:()=>It,_negative:()=>Wi,_nativeEnum:()=>_c,_nanoid:()=>_i,_nan:()=>_t,_multipleOf:()=>tr,_minSize:()=>a,_minLength:()=>nr,_min:()=>A,_mime:()=>Br,_maxSize:()=>gr,_maxLength:()=>Dr,_max:()=>R,_map:()=>ec,_mac:()=>Hu,_lte:()=>R,_lt:()=>y,_lowercase:()=>qr,_literal:()=>Uc,_length:()=>wr,_lazy:()=>Lc,_ksuid:()=>Ni,_jwt:()=>Gi,_isoTime:()=>xu,_isoDuration:()=>Zu,_isoDateTime:()=>Ru,_isoDate:()=>mu,_ipv6:()=>Si,_ipv4:()=>Oi,_intersection:()=>gc,_int64:()=>vt,_int32:()=>au,_int:()=>fu,_includes:()=>Ar,_guid:()=>zn,_gte:()=>A,_gt:()=>h,_float64:()=>hu,_float32:()=>yu,_file:()=>kt,_enum:()=>bc,_endsWith:()=>Fr,_encodeAsync:()=>Rn,_encode:()=>Hn,_emoji:()=>bi,_email:()=>gi,_e164:()=>Li,_discriminatedUnion:()=>tc,_default:()=>Nc,_decodeAsync:()=>mn,_decode:()=>Mn,_date:()=>ct,_custom:()=>Dt,_cuid2:()=>ki,_cuid:()=>Ui,_coercedString:()=>Tu,_coercedNumber:()=>du,_coercedDate:()=>bt,_coercedBoolean:()=>rt,_coercedBigint:()=>it,_cidrv6:()=>Pi,_cidrv4:()=>zi,_check:()=>II,_catch:()=>zc,_boolean:()=>su,_bigint:()=>nt,_base64url:()=>Ji,_base64:()=>ji,_array:()=>Ut,_any:()=>gt,TimePrecision:()=>Mu,NEVER:()=>jv,JSONSchemaGenerator:()=>tg,JSONSchema:()=>eI,Doc:()=>an,$output:()=>Au,$input:()=>Qu,$constructor:()=>e,$brand:()=>Jv,$ZodXor:()=>w$,$ZodXID:()=>Ro,$ZodVoid:()=>_$,$ZodUnknown:()=>c$,$ZodUnion:()=>Un,$ZodUndefined:()=>l$,$ZodUUID:()=>Yo,$ZodURL:()=>Qo,$ZodULID:()=>Mo,$ZodType:()=>z,$ZodTuple:()=>$i,$ZodTransform:()=>G$,$ZodTemplateLiteral:()=>B$,$ZodSymbol:()=>g$,$ZodSuccess:()=>q$,$ZodStringFormat:()=>G,$ZodString:()=>Ur,$ZodSet:()=>P$,$ZodRegistry:()=>Fu,$ZodRecord:()=>S$,$ZodRealError:()=>T,$ZodReadonly:()=>F$,$ZodPromise:()=>H$,$ZodPrefault:()=>V$,$ZodPipe:()=>Q$,$ZodOptional:()=>ui,$ZodObjectJIT:()=>D$,$ZodObject:()=>oI,$ZodNumberFormat:()=>u$,$ZodNumber:()=>vi,$ZodNullable:()=>W$,$ZodNull:()=>I$,$ZodNonOptional:()=>K$,$ZodNever:()=>b$,$ZodNanoID:()=>Bo,$ZodNaN:()=>A$,$ZodMap:()=>z$,$ZodMAC:()=>ao,$ZodLiteral:()=>J$,$ZodLazy:()=>M$,$ZodKSUID:()=>mo,$ZodJWT:()=>o$,$ZodIntersection:()=>O$,$ZodISOTime:()=>Co,$ZodISODuration:()=>fo,$ZodISODateTime:()=>xo,$ZodISODate:()=>Zo,$ZodIPv6:()=>ho,$ZodIPv4:()=>yo,$ZodGUID:()=>qo,$ZodFunction:()=>T$,$ZodFile:()=>L$,$ZodExactOptional:()=>E$,$ZodError:()=>gn,$ZodEnum:()=>j$,$ZodEncodeError:()=>cr,$ZodEmoji:()=>Fo,$ZodEmail:()=>Ao,$ZodE164:()=>v$,$ZodDiscriminatedUnion:()=>N$,$ZodDefault:()=>X$,$ZodDate:()=>U$,$ZodCustomStringFormat:()=>$$,$ZodCustom:()=>R$,$ZodCodec:()=>kn,$ZodCheckUpperCase:()=>jo,$ZodCheckStringFormat:()=>Xr,$ZodCheckStartsWith:()=>Lo,$ZodCheckSizeEquals:()=>wo,$ZodCheckRegex:()=>zo,$ZodCheckProperty:()=>Eo,$ZodCheckOverwrite:()=>Xo,$ZodCheckNumberFormat:()=>_o,$ZodCheckMultipleOf:()=>bo,$ZodCheckMinSize:()=>Do,$ZodCheckMinLength:()=>Oo,$ZodCheckMimeType:()=>Wo,$ZodCheckMaxSize:()=>ko,$ZodCheckMaxLength:()=>No,$ZodCheckLowerCase:()=>Po,$ZodCheckLessThan:()=>yn,$ZodCheckLengthEquals:()=>So,$ZodCheckIncludes:()=>Jo,$ZodCheckGreaterThan:()=>hn,$ZodCheckEndsWith:()=>Go,$ZodCheckBigIntFormat:()=>Uo,$ZodCheck:()=>W,$ZodCatch:()=>Y$,$ZodCUID2:()=>Ho,$ZodCUID:()=>To,$ZodCIDRv6:()=>so,$ZodCIDRv4:()=>po,$ZodBoolean:()=>_n,$ZodBigIntFormat:()=>t$,$ZodBigInt:()=>oi,$ZodBase64URL:()=>i$,$ZodBase64:()=>n$,$ZodAsyncError:()=>f,$ZodArray:()=>k$,$ZodAny:()=>e$});var jv=Object.freeze({status:"aborted"});function e(r,i,o){function $(t,I){if(!t._zod)Object.defineProperty(t,"_zod",{value:{def:I,constr:u,traits:new Set},enumerable:!1});if(t._zod.traits.has(r))return;t._zod.traits.add(r),i(t,I);let l=u.prototype,c=Object.keys(l);for(let _=0;_<c.length;_++){let N=c[_];if(!(N in t))t[N]=l[N].bind(t)}}let n=o?.Parent??Object;class v extends n{}Object.defineProperty(v,"name",{value:r});function u(t){var I;let l=o?.Parent?new v:this;$(l,t),(I=l._zod).deferred??(I.deferred=[]);for(let c of l._zod.deferred)c();return l}return Object.defineProperty(u,"init",{value:$}),Object.defineProperty(u,Symbol.hasInstance,{value:(t)=>{if(o?.Parent&&t instanceof o.Parent)return!0;return t?._zod?.traits?.has(r)}}),Object.defineProperty(u,"name",{value:r}),u}var Jv=Symbol("zod_brand");class f extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class cr extends Error{constructor(r){super(`Encountered unidirectional transform during encode: ${r}`);this.name="ZodEncodeError"}}var rn={};function V(r){if(r)Object.assign(rn,r);return rn}var D={};s(D,{unwrapMessage:()=>nn,uint8ArrayToHex:()=>G4,uint8ArrayToBase64url:()=>J4,uint8ArrayToBase64:()=>ql,stringifyPrimitive:()=>U,slugify:()=>Ev,shallowClone:()=>Xv,safeExtend:()=>N4,required:()=>z4,randomString:()=>c4,propertyKeyTypes:()=>$n,promiseAllObject:()=>e4,primitiveTypes:()=>Vv,prefixIssues:()=>M,pick:()=>k4,partial:()=>S4,parsedType:()=>k,optionalKeys:()=>Kv,omit:()=>D4,objectClone:()=>g4,numKeys:()=>b4,nullish:()=>vr,normalizeParams:()=>w,mergeDefs:()=>rr,merge:()=>O4,jsonStringifyReplacer:()=>Pr,joinValues:()=>b,issue:()=>Jr,isPlainObject:()=>$r,isObject:()=>br,hexToUint8Array:()=>L4,getSizableOrigin:()=>un,getParsedType:()=>_4,getLengthableOrigin:()=>tn,getEnumValues:()=>vn,getElementAtPath:()=>I4,floatSafeRemainder:()=>Gv,finalizeIssue:()=>B,extend:()=>w4,escapeRegex:()=>m,esc:()=>Qn,defineLazy:()=>j,createTransparentProxy:()=>U4,cloneDef:()=>l4,clone:()=>Y,cleanRegex:()=>on,cleanEnum:()=>P4,captureStackTrace:()=>Fn,cached:()=>jr,base64urlToUint8Array:()=>j4,base64ToUint8Array:()=>Kl,assignProp:()=>or,assertNotEqual:()=>o4,assertNever:()=>u4,assertIs:()=>$4,assertEqual:()=>v4,assert:()=>t4,allowsEval:()=>Wv,aborted:()=>ur,NUMBER_FORMAT_RANGES:()=>qv,Class:()=>Yl,BIGINT_FORMAT_RANGES:()=>Yv});function v4(r){return r}function o4(r){return r}function $4(r){}function u4(r){throw Error("Unexpected value in exhaustive check")}function t4(r){}function vn(r){let i=Object.values(r).filter(($)=>typeof $==="number");return Object.entries(r).filter(([$,n])=>i.indexOf(+$)===-1).map(([$,n])=>n)}function b(r,i="|"){return r.map((o)=>U(o)).join(i)}function Pr(r,i){if(typeof i==="bigint")return i.toString();return i}function jr(r){return{get value(){{let o=r();return Object.defineProperty(this,"value",{value:o}),o}throw Error("cached value already set")}}}function vr(r){return r===null||r===void 0}function on(r){let i=r.startsWith("^")?1:0,o=r.endsWith("$")?r.length-1:r.length;return r.slice(i,o)}function Gv(r,i){let o=(r.toString().split(".")[1]||"").length,$=i.toString(),n=($.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test($)){let I=$.match(/\d?e-(\d?)/);if(I?.[1])n=Number.parseInt(I[1])}let v=o>n?o:n,u=Number.parseInt(r.toFixed(v).replace(".","")),t=Number.parseInt(i.toFixed(v).replace(".",""));return u%t/10**v}var Vl=Symbol("evaluating");function j(r,i,o){let $=void 0;Object.defineProperty(r,i,{get(){if($===Vl)return;if($===void 0)$=Vl,$=o();return $},set(n){Object.defineProperty(r,i,{value:n})},configurable:!0})}function g4(r){return Object.create(Object.getPrototypeOf(r),Object.getOwnPropertyDescriptors(r))}function or(r,i,o){Object.defineProperty(r,i,{value:o,writable:!0,enumerable:!0,configurable:!0})}function rr(...r){let i={};for(let o of r){let $=Object.getOwnPropertyDescriptors(o);Object.assign(i,$)}return Object.defineProperties({},i)}function l4(r){return rr(r._zod.def)}function I4(r,i){if(!i)return r;return i.reduce((o,$)=>o?.[$],r)}function e4(r){let i=Object.keys(r),o=i.map(($)=>r[$]);return Promise.all(o).then(($)=>{let n={};for(let v=0;v<i.length;v++)n[i[v]]=$[v];return n})}function c4(r=10){let o="";for(let $=0;$<r;$++)o+="abcdefghijklmnopqrstuvwxyz"[Math.floor(Math.random()*26)];return o}function Qn(r){return JSON.stringify(r)}function Ev(r){return r.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var Fn="captureStackTrace"in Error?Error.captureStackTrace:(...r)=>{};function br(r){return typeof r==="object"&&r!==null&&!Array.isArray(r)}var Wv=jr(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(r){return!1}});function $r(r){if(br(r)===!1)return!1;let i=r.constructor;if(i===void 0)return!0;if(typeof i!=="function")return!0;let o=i.prototype;if(br(o)===!1)return!1;if(Object.prototype.hasOwnProperty.call(o,"isPrototypeOf")===!1)return!1;return!0}function Xv(r){if($r(r))return{...r};if(Array.isArray(r))return[...r];return r}function b4(r){let i=0;for(let o in r)if(Object.prototype.hasOwnProperty.call(r,o))i++;return i}var _4=(r)=>{let i=typeof r;switch(i){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(r)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":if(Array.isArray(r))return"array";if(r===null)return"null";if(r.then&&typeof r.then==="function"&&r.catch&&typeof r.catch==="function")return"promise";if(typeof Map<"u"&&r instanceof Map)return"map";if(typeof Set<"u"&&r instanceof Set)return"set";if(typeof Date<"u"&&r instanceof Date)return"date";if(typeof File<"u"&&r instanceof File)return"file";return"object";default:throw Error(`Unknown data type: ${i}`)}},$n=new Set(["string","number","symbol"]),Vv=new Set(["string","number","bigint","boolean","symbol","undefined"]);function m(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(r,i,o){let $=new r._zod.constr(i??r._zod.def);if(!i||o?.parent)$._zod.parent=r;return $}function w(r){let i=r;if(!i)return{};if(typeof i==="string")return{error:()=>i};if(i?.message!==void 0){if(i?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");i.error=i.message}if(delete i.message,typeof i.error==="string")return{...i,error:()=>i.error};return i}function U4(r){let i;return new Proxy({},{get(o,$,n){return i??(i=r()),Reflect.get(i,$,n)},set(o,$,n,v){return i??(i=r()),Reflect.set(i,$,n,v)},has(o,$){return i??(i=r()),Reflect.has(i,$)},deleteProperty(o,$){return i??(i=r()),Reflect.deleteProperty(i,$)},ownKeys(o){return i??(i=r()),Reflect.ownKeys(i)},getOwnPropertyDescriptor(o,$){return i??(i=r()),Reflect.getOwnPropertyDescriptor(i,$)},defineProperty(o,$,n){return i??(i=r()),Reflect.defineProperty(i,$,n)}})}function U(r){if(typeof r==="bigint")return r.toString()+"n";if(typeof r==="string")return`"${r}"`;return`${r}`}function Kv(r){return Object.keys(r).filter((i)=>{return r[i]._zod.optin==="optional"&&r[i]._zod.optout==="optional"})}var qv={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Yv={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function k4(r,i){let o=r._zod.def,$=o.checks;if($&&$.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let v=rr(r._zod.def,{get shape(){let u={};for(let t in i){if(!(t in o.shape))throw Error(`Unrecognized key: "${t}"`);if(!i[t])continue;u[t]=o.shape[t]}return or(this,"shape",u),u},checks:[]});return Y(r,v)}function D4(r,i){let o=r._zod.def,$=o.checks;if($&&$.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let v=rr(r._zod.def,{get shape(){let u={...r._zod.def.shape};for(let t in i){if(!(t in o.shape))throw Error(`Unrecognized key: "${t}"`);if(!i[t])continue;delete u[t]}return or(this,"shape",u),u},checks:[]});return Y(r,v)}function w4(r,i){if(!$r(i))throw Error("Invalid input to extend: expected a plain object");let o=r._zod.def.checks;if(o&&o.length>0){let v=r._zod.def.shape;for(let u in i)if(Object.getOwnPropertyDescriptor(v,u)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=rr(r._zod.def,{get shape(){let v={...r._zod.def.shape,...i};return or(this,"shape",v),v}});return Y(r,n)}function N4(r,i){if(!$r(i))throw Error("Invalid input to safeExtend: expected a plain object");let o=rr(r._zod.def,{get shape(){let $={...r._zod.def.shape,...i};return or(this,"shape",$),$}});return Y(r,o)}function O4(r,i){let o=rr(r._zod.def,{get shape(){let $={...r._zod.def.shape,...i._zod.def.shape};return or(this,"shape",$),$},get catchall(){return i._zod.def.catchall},checks:[]});return Y(r,o)}function S4(r,i,o){let n=i._zod.def.checks;if(n&&n.length>0)throw Error(".partial() cannot be used on object schemas containing refinements");let u=rr(i._zod.def,{get shape(){let t=i._zod.def.shape,I={...t};if(o)for(let l in o){if(!(l in t))throw Error(`Unrecognized key: "${l}"`);if(!o[l])continue;I[l]=r?new r({type:"optional",innerType:t[l]}):t[l]}else for(let l in t)I[l]=r?new r({type:"optional",innerType:t[l]}):t[l];return or(this,"shape",I),I},checks:[]});return Y(i,u)}function z4(r,i,o){let $=rr(i._zod.def,{get shape(){let n=i._zod.def.shape,v={...n};if(o)for(let u in o){if(!(u in v))throw Error(`Unrecognized key: "${u}"`);if(!o[u])continue;v[u]=new r({type:"nonoptional",innerType:n[u]})}else for(let u in n)v[u]=new r({type:"nonoptional",innerType:n[u]});return or(this,"shape",v),v}});return Y(i,$)}function ur(r,i=0){if(r.aborted===!0)return!0;for(let o=i;o<r.issues.length;o++)if(r.issues[o]?.continue!==!0)return!0;return!1}function M(r,i){return i.map((o)=>{var $;return($=o).path??($.path=[]),o.path.unshift(r),o})}function nn(r){return typeof r==="string"?r:r?.message}function B(r,i,o){let $={...r,path:r.path??[]};if(!r.message){let n=nn(r.inst?._zod.def?.error?.(r))??nn(i?.error?.(r))??nn(o.customError?.(r))??nn(o.localeError?.(r))??"Invalid input";$.message=n}if(delete $.inst,delete $.continue,!i?.reportInput)delete $.input;return $}function un(r){if(r instanceof Set)return"set";if(r instanceof Map)return"map";if(r instanceof File)return"file";return"unknown"}function tn(r){if(Array.isArray(r))return"array";if(typeof r==="string")return"string";return"unknown"}function k(r){let i=typeof r;switch(i){case"number":return Number.isNaN(r)?"nan":"number";case"object":{if(r===null)return"null";if(Array.isArray(r))return"array";let o=r;if(o&&Object.getPrototypeOf(o)!==Object.prototype&&"constructor"in o&&o.constructor)return o.constructor.name}}return i}function Jr(...r){let[i,o,$]=r;if(typeof i==="string")return{message:i,code:"custom",input:o,inst:$};return{...i}}function P4(r){return Object.entries(r).filter(([i,o])=>{return Number.isNaN(Number.parseInt(i,10))}).map((i)=>i[1])}function Kl(r){let i=atob(r),o=new Uint8Array(i.length);for(let $=0;$<i.length;$++)o[$]=i.charCodeAt($);return o}function ql(r){let i="";for(let o=0;o<r.length;o++)i+=String.fromCharCode(r[o]);return btoa(i)}function j4(r){let i=r.replace(/-/g,"+").replace(/_/g,"/"),o="=".repeat((4-i.length%4)%4);return Kl(i+o)}function J4(r){return ql(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function L4(r){let i=r.replace(/^0x/,"");if(i.length%2!==0)throw Error("Invalid hex string length");let o=new Uint8Array(i.length/2);for(let $=0;$<i.length;$+=2)o[$/2]=Number.parseInt(i.slice($,$+2),16);return o}function G4(r){return Array.from(r).map((i)=>i.toString(16).padStart(2,"0")).join("")}class Yl{constructor(...r){}}var Al=(r,i)=>{r.name="$ZodError",Object.defineProperty(r,"_zod",{value:r._zod,enumerable:!1}),Object.defineProperty(r,"issues",{value:i,enumerable:!1}),r.message=JSON.stringify(i,Pr,2),Object.defineProperty(r,"toString",{value:()=>r.message,enumerable:!1})},gn=e("$ZodError",Al),T=e("$ZodError",Al,{Parent:Error});function ln(r,i=(o)=>o.message){let o={},$=[];for(let n of r.issues)if(n.path.length>0)o[n.path[0]]=o[n.path[0]]||[],o[n.path[0]].push(i(n));else $.push(i(n));return{formErrors:$,fieldErrors:o}}function In(r,i=(o)=>o.message){let o={_errors:[]},$=(n)=>{for(let v of n.issues)if(v.code==="invalid_union"&&v.errors.length)v.errors.map((u)=>$({issues:u}));else if(v.code==="invalid_key")$({issues:v.issues});else if(v.code==="invalid_element")$({issues:v.issues});else if(v.path.length===0)o._errors.push(i(v));else{let u=o,t=0;while(t<v.path.length){let I=v.path[t];if(t!==v.path.length-1)u[I]=u[I]||{_errors:[]};else u[I]=u[I]||{_errors:[]},u[I]._errors.push(i(v));u=u[I],t++}}};return $(r),o}function Av(r,i=(o)=>o.message){let o={errors:[]},$=(n,v=[])=>{var u,t;for(let I of n.issues)if(I.code==="invalid_union"&&I.errors.length)I.errors.map((l)=>$({issues:l},I.path));else if(I.code==="invalid_key")$({issues:I.issues},I.path);else if(I.code==="invalid_element")$({issues:I.issues},I.path);else{let l=[...v,...I.path];if(l.length===0){o.errors.push(i(I));continue}let c=o,_=0;while(_<l.length){let N=l[_],O=_===l.length-1;if(typeof N==="string")c.properties??(c.properties={}),(u=c.properties)[N]??(u[N]={errors:[]}),c=c.properties[N];else c.items??(c.items=[]),(t=c.items)[N]??(t[N]={errors:[]}),c=c.items[N];if(O)c.errors.push(i(I));_++}}};return $(r),o}function Ql(r){let i=[],o=r.map(($)=>typeof $==="object"?$.key:$);for(let $ of o)if(typeof $==="number")i.push(`[${$}]`);else if(typeof $==="symbol")i.push(`[${JSON.stringify(String($))}]`);else if(/[^\w$]/.test($))i.push(`[${JSON.stringify($)}]`);else{if(i.length)i.push(".");i.push($)}return i.join("")}function Qv(r){let i=[],o=[...r.issues].sort(($,n)=>($.path??[]).length-(n.path??[]).length);for(let $ of o)if(i.push(`✖ ${$.message}`),$.path?.length)i.push(` → at ${Ql($.path)}`);return i.join(`
2
2
  `)}var Lr=(r)=>(i,o,$,n)=>{let v=$?Object.assign($,{async:!1}):{async:!1},u=i._zod.run({value:o,issues:[]},v);if(u instanceof Promise)throw new f;if(u.issues.length){let t=new(n?.Err??r)(u.issues.map((I)=>B(I,v,V())));throw Fn(t,n?.callee),t}return u.value},Bn=Lr(T),Gr=(r)=>async(i,o,$,n)=>{let v=$?Object.assign($,{async:!0}):{async:!0},u=i._zod.run({value:o,issues:[]},v);if(u instanceof Promise)u=await u;if(u.issues.length){let t=new(n?.Err??r)(u.issues.map((I)=>B(I,v,V())));throw Fn(t,n?.callee),t}return u.value},Tn=Gr(T),Er=(r)=>(i,o,$)=>{let n=$?{...$,async:!1}:{async:!1},v=i._zod.run({value:o,issues:[]},n);if(v instanceof Promise)throw new f;return v.issues.length?{success:!1,error:new(r??gn)(v.issues.map((u)=>B(u,n,V())))}:{success:!0,data:v.value}},Fv=Er(T),Wr=(r)=>async(i,o,$)=>{let n=$?Object.assign($,{async:!0}):{async:!0},v=i._zod.run({value:o,issues:[]},n);if(v instanceof Promise)v=await v;return v.issues.length?{success:!1,error:new r(v.issues.map((u)=>B(u,n,V())))}:{success:!0,data:v.value}},Bv=Wr(T),Hn=(r)=>(i,o,$)=>{let n=$?Object.assign($,{direction:"backward"}):{direction:"backward"};return Lr(r)(i,o,n)},W4=Hn(T),Mn=(r)=>(i,o,$)=>{return Lr(r)(i,o,$)},X4=Mn(T),Rn=(r)=>async(i,o,$)=>{let n=$?Object.assign($,{direction:"backward"}):{direction:"backward"};return Gr(r)(i,o,n)},V4=Rn(T),mn=(r)=>async(i,o,$)=>{return Gr(r)(i,o,$)},K4=mn(T),xn=(r)=>(i,o,$)=>{let n=$?Object.assign($,{direction:"backward"}):{direction:"backward"};return Er(r)(i,o,n)},q4=xn(T),Zn=(r)=>(i,o,$)=>{return Er(r)(i,o,$)},Y4=Zn(T),Cn=(r)=>async(i,o,$)=>{let n=$?Object.assign($,{direction:"backward"}):{direction:"backward"};return Wr(r)(i,o,n)},A4=Cn(T),dn=(r)=>async(i,o,$)=>{return Wr(r)(i,o,$)},Q4=dn(T);var x={};s(x,{xid:()=>Rv,uuid7:()=>H4,uuid6:()=>T4,uuid4:()=>B4,uuid:()=>_r,uppercase:()=>co,unicodeEmail:()=>Fl,undefined:()=>Io,ulid:()=>Mv,time:()=>vo,string:()=>$o,sha512_hex:()=>t6,sha512_base64url:()=>l6,sha512_base64:()=>g6,sha384_hex:()=>o6,sha384_base64url:()=>u6,sha384_base64:()=>$6,sha256_hex:()=>n6,sha256_base64url:()=>v6,sha256_base64:()=>i6,sha1_hex:()=>p4,sha1_base64url:()=>r6,sha1_base64:()=>s4,rfc5322Email:()=>R4,number:()=>en,null:()=>lo,nanoid:()=>xv,md5_hex:()=>y4,md5_base64url:()=>a4,md5_base64:()=>h4,mac:()=>av,lowercase:()=>eo,ksuid:()=>mv,ipv6:()=>hv,ipv4:()=>yv,integer:()=>to,idnEmail:()=>m4,html5Email:()=>M4,hostname:()=>C4,hex:()=>f4,guid:()=>Cv,extendedDuration:()=>F4,emoji:()=>fv,email:()=>dv,e164:()=>no,duration:()=>Zv,domain:()=>d4,datetime:()=>oo,date:()=>io,cuid2:()=>Hv,cuid:()=>Tv,cidrv6:()=>sv,cidrv4:()=>pv,browserEmail:()=>x4,boolean:()=>go,bigint:()=>uo,base64url:()=>fn,base64:()=>ro});var Tv=/^[cC][^\s-]{8,}$/,Hv=/^[0-9a-z]+$/,Mv=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Rv=/^[0-9a-vA-V]{20}$/,mv=/^[A-Za-z0-9]{27}$/,xv=/^[a-zA-Z0-9_-]{21}$/,Zv=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,F4=/^[-+]?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)?)??$/,Cv=/^([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})$/,_r=(r)=>{if(!r)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${r}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},B4=_r(4),T4=_r(6),H4=_r(7),dv=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,M4=/^[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])?)*$/,R4=/^(([^<>()\[\]\\.,;:\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,}))$/,Fl=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,m4=Fl,x4=/^[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])?)*$/,Z4="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function fv(){return new RegExp(Z4,"u")}var yv=/^(?:(?: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])$/,hv=/^(([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}|:))$/,av=(r)=>{let i=m(r??":");return new RegExp(`^(?:[0-9A-F]{2}${i}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${i}){5}[0-9a-f]{2}$`)},pv=/^((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])$/,sv=/^(([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])$/,ro=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,fn=/^[A-Za-z0-9_-]*$/,C4=/^(?=.{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])?)*\.?$/,d4=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,no=/^\+[1-9]\d{6,14}$/,Bl="(?:(?:\\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])))",io=new RegExp(`^${Bl}$`);function Tl(r){return typeof r.precision==="number"?r.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":r.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${r.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function vo(r){return new RegExp(`^${Tl(r)}$`)}function oo(r){let i=Tl({precision:r.precision}),o=["Z"];if(r.local)o.push("");if(r.offset)o.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let $=`${i}(?:${o.join("|")})`;return new RegExp(`^${Bl}T(?:${$})$`)}var $o=(r)=>{let i=r?`[\\s\\S]{${r?.minimum??0},${r?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${i}$`)},uo=/^-?\d+n?$/,to=/^-?\d+$/,en=/^-?\d+(?:\.\d+)?$/,go=/^(?:true|false)$/i,lo=/^null$/i;var Io=/^undefined$/i;var eo=/^[^A-Z]*$/,co=/^[^a-z]*$/,f4=/^[0-9a-fA-F]*$/;function cn(r,i){return new RegExp(`^[A-Za-z0-9+/]{${r}}${i}$`)}function bn(r){return new RegExp(`^[A-Za-z0-9_-]{${r}}$`)}var y4=/^[0-9a-fA-F]{32}$/,h4=cn(22,"=="),a4=bn(22),p4=/^[0-9a-fA-F]{40}$/,s4=cn(27,"="),r6=bn(27),n6=/^[0-9a-fA-F]{64}$/,i6=cn(43,"="),v6=bn(43),o6=/^[0-9a-fA-F]{96}$/,$6=cn(64,""),u6=bn(64),t6=/^[0-9a-fA-F]{128}$/,g6=cn(86,"=="),l6=bn(86);var W=e("$ZodCheck",(r,i)=>{var o;r._zod??(r._zod={}),r._zod.def=i,(o=r._zod).onattach??(o.onattach=[])}),Ml={number:"number",bigint:"bigint",object:"date"},yn=e("$ZodCheckLessThan",(r,i)=>{W.init(r,i);let o=Ml[typeof i.value];r._zod.onattach.push(($)=>{let n=$._zod.bag,v=(i.inclusive?n.maximum:n.exclusiveMaximum)??Number.POSITIVE_INFINITY;if(i.value<v)if(i.inclusive)n.maximum=i.value;else n.exclusiveMaximum=i.value}),r._zod.check=($)=>{if(i.inclusive?$.value<=i.value:$.value<i.value)return;$.issues.push({origin:o,code:"too_big",maximum:typeof i.value==="object"?i.value.getTime():i.value,input:$.value,inclusive:i.inclusive,inst:r,continue:!i.abort})}}),hn=e("$ZodCheckGreaterThan",(r,i)=>{W.init(r,i);let o=Ml[typeof i.value];r._zod.onattach.push(($)=>{let n=$._zod.bag,v=(i.inclusive?n.minimum:n.exclusiveMinimum)??Number.NEGATIVE_INFINITY;if(i.value>v)if(i.inclusive)n.minimum=i.value;else n.exclusiveMinimum=i.value}),r._zod.check=($)=>{if(i.inclusive?$.value>=i.value:$.value>i.value)return;$.issues.push({origin:o,code:"too_small",minimum:typeof i.value==="object"?i.value.getTime():i.value,input:$.value,inclusive:i.inclusive,inst:r,continue:!i.abort})}}),bo=e("$ZodCheckMultipleOf",(r,i)=>{W.init(r,i),r._zod.onattach.push((o)=>{var $;($=o._zod.bag).multipleOf??($.multipleOf=i.value)}),r._zod.check=(o)=>{if(typeof o.value!==typeof i.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof o.value==="bigint"?o.value%i.value===BigInt(0):Gv(o.value,i.value)===0)return;o.issues.push({origin:typeof o.value,code:"not_multiple_of",divisor:i.value,input:o.value,inst:r,continue:!i.abort})}}),_o=e("$ZodCheckNumberFormat",(r,i)=>{W.init(r,i),i.format=i.format||"float64";let o=i.format?.includes("int"),$=o?"int":"number",[n,v]=qv[i.format];r._zod.onattach.push((u)=>{let t=u._zod.bag;if(t.format=i.format,t.minimum=n,t.maximum=v,o)t.pattern=to}),r._zod.check=(u)=>{let t=u.value;if(o){if(!Number.isInteger(t)){u.issues.push({expected:$,format:i.format,code:"invalid_type",continue:!1,input:t,inst:r});return}if(!Number.isSafeInteger(t)){if(t>0)u.issues.push({input:t,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:$,inclusive:!0,continue:!i.abort});else u.issues.push({input:t,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:r,origin:$,inclusive:!0,continue:!i.abort});return}}if(t<n)u.issues.push({origin:"number",input:t,code:"too_small",minimum:n,inclusive:!0,inst:r,continue:!i.abort});if(t>v)u.issues.push({origin:"number",input:t,code:"too_big",maximum:v,inclusive:!0,inst:r,continue:!i.abort})}}),Uo=e("$ZodCheckBigIntFormat",(r,i)=>{W.init(r,i);let[o,$]=Yv[i.format];r._zod.onattach.push((n)=>{let v=n._zod.bag;v.format=i.format,v.minimum=o,v.maximum=$}),r._zod.check=(n)=>{let v=n.value;if(v<o)n.issues.push({origin:"bigint",input:v,code:"too_small",minimum:o,inclusive:!0,inst:r,continue:!i.abort});if(v>$)n.issues.push({origin:"bigint",input:v,code:"too_big",maximum:$,inclusive:!0,inst:r,continue:!i.abort})}}),ko=e("$ZodCheckMaxSize",(r,i)=>{var o;W.init(r,i),(o=r._zod.def).when??(o.when=($)=>{let n=$.value;return!vr(n)&&n.size!==void 0}),r._zod.onattach.push(($)=>{let n=$._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<n)$._zod.bag.maximum=i.maximum}),r._zod.check=($)=>{let n=$.value;if(n.size<=i.maximum)return;$.issues.push({origin:un(n),code:"too_big",maximum:i.maximum,inclusive:!0,input:n,inst:r,continue:!i.abort})}}),Do=e("$ZodCheckMinSize",(r,i)=>{var o;W.init(r,i),(o=r._zod.def).when??(o.when=($)=>{let n=$.value;return!vr(n)&&n.size!==void 0}),r._zod.onattach.push(($)=>{let n=$._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>n)$._zod.bag.minimum=i.minimum}),r._zod.check=($)=>{let n=$.value;if(n.size>=i.minimum)return;$.issues.push({origin:un(n),code:"too_small",minimum:i.minimum,inclusive:!0,input:n,inst:r,continue:!i.abort})}}),wo=e("$ZodCheckSizeEquals",(r,i)=>{var o;W.init(r,i),(o=r._zod.def).when??(o.when=($)=>{let n=$.value;return!vr(n)&&n.size!==void 0}),r._zod.onattach.push(($)=>{let n=$._zod.bag;n.minimum=i.size,n.maximum=i.size,n.size=i.size}),r._zod.check=($)=>{let n=$.value,v=n.size;if(v===i.size)return;let u=v>i.size;$.issues.push({origin:un(n),...u?{code:"too_big",maximum:i.size}:{code:"too_small",minimum:i.size},inclusive:!0,exact:!0,input:$.value,inst:r,continue:!i.abort})}}),No=e("$ZodCheckMaxLength",(r,i)=>{var o;W.init(r,i),(o=r._zod.def).when??(o.when=($)=>{let n=$.value;return!vr(n)&&n.length!==void 0}),r._zod.onattach.push(($)=>{let n=$._zod.bag.maximum??Number.POSITIVE_INFINITY;if(i.maximum<n)$._zod.bag.maximum=i.maximum}),r._zod.check=($)=>{let n=$.value;if(n.length<=i.maximum)return;let u=tn(n);$.issues.push({origin:u,code:"too_big",maximum:i.maximum,inclusive:!0,input:n,inst:r,continue:!i.abort})}}),Oo=e("$ZodCheckMinLength",(r,i)=>{var o;W.init(r,i),(o=r._zod.def).when??(o.when=($)=>{let n=$.value;return!vr(n)&&n.length!==void 0}),r._zod.onattach.push(($)=>{let n=$._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(i.minimum>n)$._zod.bag.minimum=i.minimum}),r._zod.check=($)=>{let n=$.value;if(n.length>=i.minimum)return;let u=tn(n);$.issues.push({origin:u,code:"too_small",minimum:i.minimum,inclusive:!0,input:n,inst:r,continue:!i.abort})}}),So=e("$ZodCheckLengthEquals",(r,i)=>{var o;W.init(r,i),(o=r._zod.def).when??(o.when=($)=>{let n=$.value;return!vr(n)&&n.length!==void 0}),r._zod.onattach.push(($)=>{let n=$._zod.bag;n.minimum=i.length,n.maximum=i.length,n.length=i.length}),r._zod.check=($)=>{let n=$.value,v=n.length;if(v===i.length)return;let u=tn(n),t=v>i.length;$.issues.push({origin:u,...t?{code:"too_big",maximum:i.length}:{code:"too_small",minimum:i.length},inclusive:!0,exact:!0,input:$.value,inst:r,continue:!i.abort})}}),Xr=e("$ZodCheckStringFormat",(r,i)=>{var o,$;if(W.init(r,i),r._zod.onattach.push((n)=>{let v=n._zod.bag;if(v.format=i.format,i.pattern)v.patterns??(v.patterns=new Set),v.patterns.add(i.pattern)}),i.pattern)(o=r._zod).check??(o.check=(n)=>{if(i.pattern.lastIndex=0,i.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:i.format,input:n.value,...i.pattern?{pattern:i.pattern.toString()}:{},inst:r,continue:!i.abort})});else($=r._zod).check??($.check=()=>{})}),zo=e("$ZodCheckRegex",(r,i)=>{Xr.init(r,i),r._zod.check=(o)=>{if(i.pattern.lastIndex=0,i.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:"regex",input:o.value,pattern:i.pattern.toString(),inst:r,continue:!i.abort})}}),Po=e("$ZodCheckLowerCase",(r,i)=>{i.pattern??(i.pattern=eo),Xr.init(r,i)}),jo=e("$ZodCheckUpperCase",(r,i)=>{i.pattern??(i.pattern=co),Xr.init(r,i)}),Jo=e("$ZodCheckIncludes",(r,i)=>{W.init(r,i);let o=m(i.includes),$=new RegExp(typeof i.position==="number"?`^.{${i.position}}${o}`:o);i.pattern=$,r._zod.onattach.push((n)=>{let v=n._zod.bag;v.patterns??(v.patterns=new Set),v.patterns.add($)}),r._zod.check=(n)=>{if(n.value.includes(i.includes,i.position))return;n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:i.includes,input:n.value,inst:r,continue:!i.abort})}}),Lo=e("$ZodCheckStartsWith",(r,i)=>{W.init(r,i);let o=new RegExp(`^${m(i.prefix)}.*`);i.pattern??(i.pattern=o),r._zod.onattach.push(($)=>{let n=$._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),r._zod.check=($)=>{if($.value.startsWith(i.prefix))return;$.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:i.prefix,input:$.value,inst:r,continue:!i.abort})}}),Go=e("$ZodCheckEndsWith",(r,i)=>{W.init(r,i);let o=new RegExp(`.*${m(i.suffix)}$`);i.pattern??(i.pattern=o),r._zod.onattach.push(($)=>{let n=$._zod.bag;n.patterns??(n.patterns=new Set),n.patterns.add(o)}),r._zod.check=($)=>{if($.value.endsWith(i.suffix))return;$.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:i.suffix,input:$.value,inst:r,continue:!i.abort})}});function Hl(r,i,o){if(r.issues.length)i.issues.push(...M(o,r.issues))}var Eo=e("$ZodCheckProperty",(r,i)=>{W.init(r,i),r._zod.check=(o)=>{let $=i.schema._zod.run({value:o.value[i.property],issues:[]},{});if($ instanceof Promise)return $.then((n)=>Hl(n,o,i.property));Hl($,o,i.property);return}}),Wo=e("$ZodCheckMimeType",(r,i)=>{W.init(r,i);let o=new Set(i.mime);r._zod.onattach.push(($)=>{$._zod.bag.mime=i.mime}),r._zod.check=($)=>{if(o.has($.value.type))return;$.issues.push({code:"invalid_value",values:i.mime,input:$.value.type,inst:r,continue:!i.abort})}}),Xo=e("$ZodCheckOverwrite",(r,i)=>{W.init(r,i),r._zod.check=(o)=>{o.value=i.tx(o.value)}});class an{constructor(r=[]){if(this.content=[],this.indent=0,this)this.args=r}indented(r){this.indent+=1,r(this),this.indent-=1}write(r){if(typeof r==="function"){r(this,{execution:"sync"}),r(this,{execution:"async"});return}let o=r.split(`
3
3
  `).filter((v)=>v),$=Math.min(...o.map((v)=>v.length-v.trimStart().length)),n=o.map((v)=>v.slice($)).map((v)=>" ".repeat(this.indent*2)+v);for(let v of n)this.content.push(v)}compile(){let r=Function,i=this?.args,$=[...(this?.content??[""]).map((n)=>` ${n}`)];return new r(...i,$.join(`
4
4
  `))}}var Vo={major:4,minor:3,patch:5};var z=e("$ZodType",(r,i)=>{var o;r??(r={}),r._zod.def=i,r._zod.bag=r._zod.bag||{},r._zod.version=Vo;let $=[...r._zod.def.checks??[]];if(r._zod.traits.has("$ZodCheck"))$.unshift(r);for(let n of $)for(let v of n._zod.onattach)v(r);if($.length===0)(o=r._zod).deferred??(o.deferred=[]),r._zod.deferred?.push(()=>{r._zod.run=r._zod.parse});else{let n=(u,t,I)=>{let l=ur(u),c;for(let _ of t){if(_._zod.def.when){if(!_._zod.def.when(u))continue}else if(l)continue;let N=u.issues.length,O=_._zod.check(u);if(O instanceof Promise&&I?.async===!1)throw new f;if(c||O instanceof Promise)c=(c??Promise.resolve()).then(async()=>{if(await O,u.issues.length===N)return;if(!l)l=ur(u,N)});else{if(u.issues.length===N)continue;if(!l)l=ur(u,N)}}if(c)return c.then(()=>{return u});return u},v=(u,t,I)=>{if(ur(u))return u.aborted=!0,u;let l=n(t,$,I);if(l instanceof Promise){if(I.async===!1)throw new f;return l.then((c)=>r._zod.parse(c,I))}return r._zod.parse(l,I)};r._zod.run=(u,t)=>{if(t.skipChecks)return r._zod.parse(u,t);if(t.direction==="backward"){let l=r._zod.parse({value:u.value,issues:[]},{...t,skipChecks:!0});if(l instanceof Promise)return l.then((c)=>{return v(c,u,t)});return v(l,u,t)}let I=r._zod.parse(u,t);if(I instanceof Promise){if(t.async===!1)throw new f;return I.then((l)=>n(l,$,t))}return n(I,$,t)}}j(r,"~standard",()=>({validate:(n)=>{try{let v=Fv(r,n);return v.success?{value:v.data}:{issues:v.error?.issues}}catch(v){return Bv(r,n).then((u)=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),Ur=e("$ZodString",(r,i)=>{z.init(r,i),r._zod.pattern=[...r?._zod.bag?.patterns??[]].pop()??$o(r._zod.bag),r._zod.parse=(o,$)=>{if(i.coerce)try{o.value=String(o.value)}catch(n){}if(typeof o.value==="string")return o;return o.issues.push({expected:"string",code:"invalid_type",input:o.value,inst:r}),o}}),G=e("$ZodStringFormat",(r,i)=>{Xr.init(r,i),Ur.init(r,i)}),qo=e("$ZodGUID",(r,i)=>{i.pattern??(i.pattern=Cv),G.init(r,i)}),Yo=e("$ZodUUID",(r,i)=>{if(i.version){let $={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[i.version];if($===void 0)throw Error(`Invalid UUID version: "${i.version}"`);i.pattern??(i.pattern=_r($))}else i.pattern??(i.pattern=_r());G.init(r,i)}),Ao=e("$ZodEmail",(r,i)=>{i.pattern??(i.pattern=dv),G.init(r,i)}),Qo=e("$ZodURL",(r,i)=>{G.init(r,i),r._zod.check=(o)=>{try{let $=o.value.trim(),n=new URL($);if(i.hostname){if(i.hostname.lastIndex=0,!i.hostname.test(n.hostname))o.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:i.hostname.source,input:o.value,inst:r,continue:!i.abort})}if(i.protocol){if(i.protocol.lastIndex=0,!i.protocol.test(n.protocol.endsWith(":")?n.protocol.slice(0,-1):n.protocol))o.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:i.protocol.source,input:o.value,inst:r,continue:!i.abort})}if(i.normalize)o.value=n.href;else o.value=$;return}catch($){o.issues.push({code:"invalid_format",format:"url",input:o.value,inst:r,continue:!i.abort})}}}),Fo=e("$ZodEmoji",(r,i)=>{i.pattern??(i.pattern=fv()),G.init(r,i)}),Bo=e("$ZodNanoID",(r,i)=>{i.pattern??(i.pattern=xv),G.init(r,i)}),To=e("$ZodCUID",(r,i)=>{i.pattern??(i.pattern=Tv),G.init(r,i)}),Ho=e("$ZodCUID2",(r,i)=>{i.pattern??(i.pattern=Hv),G.init(r,i)}),Mo=e("$ZodULID",(r,i)=>{i.pattern??(i.pattern=Mv),G.init(r,i)}),Ro=e("$ZodXID",(r,i)=>{i.pattern??(i.pattern=Rv),G.init(r,i)}),mo=e("$ZodKSUID",(r,i)=>{i.pattern??(i.pattern=mv),G.init(r,i)}),xo=e("$ZodISODateTime",(r,i)=>{i.pattern??(i.pattern=oo(i)),G.init(r,i)}),Zo=e("$ZodISODate",(r,i)=>{i.pattern??(i.pattern=io),G.init(r,i)}),Co=e("$ZodISOTime",(r,i)=>{i.pattern??(i.pattern=vo(i)),G.init(r,i)}),fo=e("$ZodISODuration",(r,i)=>{i.pattern??(i.pattern=Zv),G.init(r,i)}),yo=e("$ZodIPv4",(r,i)=>{i.pattern??(i.pattern=yv),G.init(r,i),r._zod.bag.format="ipv4"}),ho=e("$ZodIPv6",(r,i)=>{i.pattern??(i.pattern=hv),G.init(r,i),r._zod.bag.format="ipv6",r._zod.check=(o)=>{try{new URL(`http://[${o.value}]`)}catch{o.issues.push({code:"invalid_format",format:"ipv6",input:o.value,inst:r,continue:!i.abort})}}}),ao=e("$ZodMAC",(r,i)=>{i.pattern??(i.pattern=av(i.delimiter)),G.init(r,i),r._zod.bag.format="mac"}),po=e("$ZodCIDRv4",(r,i)=>{i.pattern??(i.pattern=pv),G.init(r,i)}),so=e("$ZodCIDRv6",(r,i)=>{i.pattern??(i.pattern=sv),G.init(r,i),r._zod.check=(o)=>{let $=o.value.split("/");try{if($.length!==2)throw Error();let[n,v]=$;if(!v)throw Error();let u=Number(v);if(`${u}`!==v)throw Error();if(u<0||u>128)throw Error();new URL(`http://[${n}]`)}catch{o.issues.push({code:"invalid_format",format:"cidrv6",input:o.value,inst:r,continue:!i.abort})}}});function r$(r){if(r==="")return!0;if(r.length%4!==0)return!1;try{return atob(r),!0}catch{return!1}}var n$=e("$ZodBase64",(r,i)=>{i.pattern??(i.pattern=ro),G.init(r,i),r._zod.bag.contentEncoding="base64",r._zod.check=(o)=>{if(r$(o.value))return;o.issues.push({code:"invalid_format",format:"base64",input:o.value,inst:r,continue:!i.abort})}});function rI(r){if(!fn.test(r))return!1;let i=r.replace(/[-_]/g,($)=>$==="-"?"+":"/"),o=i.padEnd(Math.ceil(i.length/4)*4,"=");return r$(o)}var i$=e("$ZodBase64URL",(r,i)=>{i.pattern??(i.pattern=fn),G.init(r,i),r._zod.bag.contentEncoding="base64url",r._zod.check=(o)=>{if(rI(o.value))return;o.issues.push({code:"invalid_format",format:"base64url",input:o.value,inst:r,continue:!i.abort})}}),v$=e("$ZodE164",(r,i)=>{i.pattern??(i.pattern=no),G.init(r,i)});function nI(r,i=null){try{let o=r.split(".");if(o.length!==3)return!1;let[$]=o;if(!$)return!1;let n=JSON.parse(atob($));if("typ"in n&&n?.typ!=="JWT")return!1;if(!n.alg)return!1;if(i&&(!("alg"in n)||n.alg!==i))return!1;return!0}catch{return!1}}var o$=e("$ZodJWT",(r,i)=>{G.init(r,i),r._zod.check=(o)=>{if(nI(o.value,i.alg))return;o.issues.push({code:"invalid_format",format:"jwt",input:o.value,inst:r,continue:!i.abort})}}),$$=e("$ZodCustomStringFormat",(r,i)=>{G.init(r,i),r._zod.check=(o)=>{if(i.fn(o.value))return;o.issues.push({code:"invalid_format",format:i.format,input:o.value,inst:r,continue:!i.abort})}}),vi=e("$ZodNumber",(r,i)=>{z.init(r,i),r._zod.pattern=r._zod.bag.pattern??en,r._zod.parse=(o,$)=>{if(i.coerce)try{o.value=Number(o.value)}catch(u){}let n=o.value;if(typeof n==="number"&&!Number.isNaN(n)&&Number.isFinite(n))return o;let v=typeof n==="number"?Number.isNaN(n)?"NaN":!Number.isFinite(n)?"Infinity":void 0:void 0;return o.issues.push({expected:"number",code:"invalid_type",input:n,inst:r,...v?{received:v}:{}}),o}}),u$=e("$ZodNumberFormat",(r,i)=>{_o.init(r,i),vi.init(r,i)}),_n=e("$ZodBoolean",(r,i)=>{z.init(r,i),r._zod.pattern=go,r._zod.parse=(o,$)=>{if(i.coerce)try{o.value=Boolean(o.value)}catch(v){}let n=o.value;if(typeof n==="boolean")return o;return o.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:r}),o}}),oi=e("$ZodBigInt",(r,i)=>{z.init(r,i),r._zod.pattern=uo,r._zod.parse=(o,$)=>{if(i.coerce)try{o.value=BigInt(o.value)}catch(n){}if(typeof o.value==="bigint")return o;return o.issues.push({expected:"bigint",code:"invalid_type",input:o.value,inst:r}),o}}),t$=e("$ZodBigIntFormat",(r,i)=>{Uo.init(r,i),oi.init(r,i)}),g$=e("$ZodSymbol",(r,i)=>{z.init(r,i),r._zod.parse=(o,$)=>{let n=o.value;if(typeof n==="symbol")return o;return o.issues.push({expected:"symbol",code:"invalid_type",input:n,inst:r}),o}}),l$=e("$ZodUndefined",(r,i)=>{z.init(r,i),r._zod.pattern=Io,r._zod.values=new Set([void 0]),r._zod.optin="optional",r._zod.optout="optional",r._zod.parse=(o,$)=>{let n=o.value;if(typeof n>"u")return o;return o.issues.push({expected:"undefined",code:"invalid_type",input:n,inst:r}),o}}),I$=e("$ZodNull",(r,i)=>{z.init(r,i),r._zod.pattern=lo,r._zod.values=new Set([null]),r._zod.parse=(o,$)=>{let n=o.value;if(n===null)return o;return o.issues.push({expected:"null",code:"invalid_type",input:n,inst:r}),o}}),e$=e("$ZodAny",(r,i)=>{z.init(r,i),r._zod.parse=(o)=>o}),c$=e("$ZodUnknown",(r,i)=>{z.init(r,i),r._zod.parse=(o)=>o}),b$=e("$ZodNever",(r,i)=>{z.init(r,i),r._zod.parse=(o,$)=>{return o.issues.push({expected:"never",code:"invalid_type",input:o.value,inst:r}),o}}),_$=e("$ZodVoid",(r,i)=>{z.init(r,i),r._zod.parse=(o,$)=>{let n=o.value;if(typeof n>"u")return o;return o.issues.push({expected:"void",code:"invalid_type",input:n,inst:r}),o}}),U$=e("$ZodDate",(r,i)=>{z.init(r,i),r._zod.parse=(o,$)=>{if(i.coerce)try{o.value=new Date(o.value)}catch(t){}let n=o.value,v=n instanceof Date;if(v&&!Number.isNaN(n.getTime()))return o;return o.issues.push({expected:"date",code:"invalid_type",input:n,...v?{received:"Invalid Date"}:{},inst:r}),o}});function ml(r,i,o){if(r.issues.length)i.issues.push(...M(o,r.issues));i.value[o]=r.value}var k$=e("$ZodArray",(r,i)=>{z.init(r,i),r._zod.parse=(o,$)=>{let n=o.value;if(!Array.isArray(n))return o.issues.push({expected:"array",code:"invalid_type",input:n,inst:r}),o;o.value=Array(n.length);let v=[];for(let u=0;u<n.length;u++){let t=n[u],I=i.element._zod.run({value:t,issues:[]},$);if(I instanceof Promise)v.push(I.then((l)=>ml(l,o,u)));else ml(I,o,u)}if(v.length)return Promise.all(v).then(()=>o);return o}});function ii(r,i,o,$,n){if(r.issues.length){if(n&&!(o in $))return;i.issues.push(...M(o,r.issues))}if(r.value===void 0){if(o in $)i.value[o]=void 0}else i.value[o]=r.value}function iI(r){let i=Object.keys(r.shape);for(let $ of i)if(!r.shape?.[$]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${$}": expected a Zod schema`);let o=Kv(r.shape);return{...r,keys:i,keySet:new Set(i),numKeys:i.length,optionalKeys:new Set(o)}}function vI(r,i,o,$,n,v){let u=[],t=n.keySet,I=n.catchall._zod,l=I.def.type,c=I.optout==="optional";for(let _ in i){if(t.has(_))continue;if(l==="never"){u.push(_);continue}let N=I.run({value:i[_],issues:[]},$);if(N instanceof Promise)r.push(N.then((O)=>ii(O,o,_,i,c)));else ii(N,o,_,i,c)}if(u.length)o.issues.push({code:"unrecognized_keys",keys:u,input:i,inst:v});if(!r.length)return o;return Promise.all(r).then(()=>{return o})}var oI=e("$ZodObject",(r,i)=>{if(z.init(r,i),!Object.getOwnPropertyDescriptor(i,"shape")?.get){let t=i.shape;Object.defineProperty(i,"shape",{get:()=>{let I={...t};return Object.defineProperty(i,"shape",{value:I}),I}})}let $=jr(()=>iI(i));j(r._zod,"propValues",()=>{let t=i.shape,I={};for(let l in t){let c=t[l]._zod;if(c.values){I[l]??(I[l]=new Set);for(let _ of c.values)I[l].add(_)}}return I});let n=br,v=i.catchall,u;r._zod.parse=(t,I)=>{u??(u=$.value);let l=t.value;if(!n(l))return t.issues.push({expected:"object",code:"invalid_type",input:l,inst:r}),t;t.value={};let c=[],_=u.shape;for(let N of u.keys){let O=_[N],J=O._zod.optout==="optional",X=O._zod.run({value:l[N],issues:[]},I);if(X instanceof Promise)c.push(X.then((Sr)=>ii(Sr,t,N,l,J)));else ii(X,t,N,l,J)}if(!v)return c.length?Promise.all(c).then(()=>t):t;return vI(c,l,t,I,$.value,r)}}),D$=e("$ZodObjectJIT",(r,i)=>{oI.init(r,i);let o=r._zod.parse,$=jr(()=>iI(i)),n=(N)=>{let O=new an(["shape","payload","ctx"]),J=$.value,X=(d)=>{let F=Qn(d);return`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`};O.write("const input = payload.value;");let Sr=Object.create(null),Be=0;for(let d of J.keys)Sr[d]=`key_${Be++}`;O.write("const newResult = {};");for(let d of J.keys){let F=Sr[d],Z=Qn(d),He=N[d]?._zod?.optout==="optional";if(O.write(`const ${F} = ${X(d)};`),He)O.write(`
@@ -55,7 +55,24 @@ Individual style keys are optional - hosts may provide any subset of these value
55
55
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
56
56
 
57
57
  Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Record<K, string>>\`
58
- for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),fc=g.object({method:g.literal("ui/open-link"),params:g.object({url:g.string().describe("URL to open in the host's browser")})}),wl=g.object({isError:g.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Nl=g.object({isError:g.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),yc=g.object({method:g.literal("ui/notifications/sandbox-proxy-ready"),params:g.object({})}),kv=g.object({connectDomains:g.array(g.string()).optional().describe("Origins for network requests (fetch/XHR/WebSocket)."),resourceDomains:g.array(g.string()).optional().describe("Origins for static resources (scripts, images, styles, fonts)."),frameDomains:g.array(g.string()).optional().describe("Origins for nested iframes (frame-src directive)."),baseUriDomains:g.array(g.string()).optional().describe("Allowed base URIs for the document (base-uri directive).")}),Dv=g.object({camera:g.object({}).optional().describe("Request camera access (Permission Policy `camera` feature)."),microphone:g.object({}).optional().describe("Request microphone access (Permission Policy `microphone` feature)."),geolocation:g.object({}).optional().describe("Request geolocation access (Permission Policy `geolocation` feature)."),clipboardWrite:g.object({}).optional().describe("Request clipboard write access (Permission Policy `clipboard-write` feature).")}),hc=g.object({method:g.literal("ui/notifications/size-changed"),params:g.object({width:g.number().optional().describe("New width in pixels."),height:g.number().optional().describe("New height in pixels.")})}),Ol=g.object({method:g.literal("ui/notifications/tool-input"),params:g.object({arguments:g.record(g.string(),g.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Sl=g.object({method:g.literal("ui/notifications/tool-input-partial"),params:g.object({arguments:g.record(g.string(),g.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),zl=g.object({method:g.literal("ui/notifications/tool-cancelled"),params:g.object({reason:g.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Ke=g.object({fonts:g.string().optional()}),qe=g.object({variables:dc.optional().describe("CSS variables for theming the app."),css:Ke.optional().describe("CSS blocks that apps can inject.")}),Pl=g.object({method:g.literal("ui/resource-teardown"),params:g.object({})}),ac=g.record(g.string(),g.unknown()),Dl=g.object({text:g.object({}).optional().describe("Host supports text content blocks."),image:g.object({}).optional().describe("Host supports image content blocks."),audio:g.object({}).optional().describe("Host supports audio content blocks."),resource:g.object({}).optional().describe("Host supports resource content blocks."),resourceLink:g.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:g.object({}).optional().describe("Host supports structured content.")}),Ye=g.object({experimental:g.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:g.object({}).optional().describe("Host supports opening external URLs."),serverTools:g.object({listChanged:g.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:g.object({listChanged:g.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:g.object({}).optional().describe("Host accepts log messages."),sandbox:g.object({permissions:Dv.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:kv.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Dl.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Dl.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),Ae=g.object({experimental:g.object({}).optional().describe("Experimental features (structure TBD)."),tools:g.object({listChanged:g.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:g.array(sr).optional().describe("Display modes the app supports.")}),pc=g.object({method:g.literal("ui/notifications/initialized"),params:g.object({}).optional()}),sc=g.object({csp:kv.optional().describe("Content Security Policy configuration."),permissions:Dv.optional().describe("Sandbox permissions requested by the UI."),domain:g.string().optional().describe("Dedicated origin for view sandbox."),prefersBorder:g.boolean().optional().describe("Visual boundary preference - true if UI prefers a visible border.")}),rb=g.object({method:g.literal("ui/request-display-mode"),params:g.object({mode:sr.describe("The display mode being requested.")})}),jl=g.object({mode:sr.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Qe=g.union([g.literal("model"),g.literal("app")]).describe("Tool visibility scope - who can access the tool."),nb=g.object({resourceUri:g.string().optional(),visibility:g.array(Qe).optional().describe(`Who can access this tool. Default: ["model", "app"]
58
+ for compatibility with Zod schema generation. Both are functionally equivalent for validation.`),fc=g.object({method:g.literal("ui/open-link"),params:g.object({url:g.string().describe("URL to open in the host's browser")})}),wl=g.object({isError:g.boolean().optional().describe("True if the host failed to open the URL (e.g., due to security policy).")}).passthrough(),Nl=g.object({isError:g.boolean().optional().describe("True if the host rejected or failed to deliver the message.")}).passthrough(),yc=g.object({method:g.literal("ui/notifications/sandbox-proxy-ready"),params:g.object({})}),kv=g.object({connectDomains:g.array(g.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).
59
+
60
+ - Maps to CSP \`connect-src\` directive
61
+ - Empty or omitted → no network connections (secure default)`),resourceDomains:g.array(g.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 → no network resources (secure default)"),frameDomains:g.array(g.string()).optional().describe("Origins for nested iframes.\n\n- Maps to CSP `frame-src` directive\n- Empty or omitted → no nested iframes allowed (`frame-src 'none'`)"),baseUriDomains:g.array(g.string()).optional().describe("Allowed base URIs for the document.\n\n- Maps to CSP `base-uri` directive\n- Empty or omitted → only same origin allowed (`base-uri 'self'`)")}),Dv=g.object({camera:g.object({}).optional().describe("Request camera access.\n\nMaps to Permission Policy `camera` feature."),microphone:g.object({}).optional().describe("Request microphone access.\n\nMaps to Permission Policy `microphone` feature."),geolocation:g.object({}).optional().describe("Request geolocation access.\n\nMaps to Permission Policy `geolocation` feature."),clipboardWrite:g.object({}).optional().describe("Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.")}),hc=g.object({method:g.literal("ui/notifications/size-changed"),params:g.object({width:g.number().optional().describe("New width in pixels."),height:g.number().optional().describe("New height in pixels.")})}),Ol=g.object({method:g.literal("ui/notifications/tool-input"),params:g.object({arguments:g.record(g.string(),g.unknown().describe("Complete tool call arguments as key-value pairs.")).optional().describe("Complete tool call arguments as key-value pairs.")})}),Sl=g.object({method:g.literal("ui/notifications/tool-input-partial"),params:g.object({arguments:g.record(g.string(),g.unknown().describe("Partial tool call arguments (incomplete, may change).")).optional().describe("Partial tool call arguments (incomplete, may change).")})}),zl=g.object({method:g.literal("ui/notifications/tool-cancelled"),params:g.object({reason:g.string().optional().describe('Optional reason for the cancellation (e.g., "user action", "timeout").')})}),Ke=g.object({fonts:g.string().optional()}),qe=g.object({variables:dc.optional().describe("CSS variables for theming the app."),css:Ke.optional().describe("CSS blocks that apps can inject.")}),Pl=g.object({method:g.literal("ui/resource-teardown"),params:g.object({})}),ac=g.record(g.string(),g.unknown()),Dl=g.object({text:g.object({}).optional().describe("Host supports text content blocks."),image:g.object({}).optional().describe("Host supports image content blocks."),audio:g.object({}).optional().describe("Host supports audio content blocks."),resource:g.object({}).optional().describe("Host supports resource content blocks."),resourceLink:g.object({}).optional().describe("Host supports resource link content blocks."),structuredContent:g.object({}).optional().describe("Host supports structured content.")}),Ye=g.object({experimental:g.object({}).optional().describe("Experimental features (structure TBD)."),openLinks:g.object({}).optional().describe("Host supports opening external URLs."),serverTools:g.object({listChanged:g.boolean().optional().describe("Host supports tools/list_changed notifications.")}).optional().describe("Host can proxy tool calls to the MCP server."),serverResources:g.object({listChanged:g.boolean().optional().describe("Host supports resources/list_changed notifications.")}).optional().describe("Host can proxy resource reads to the MCP server."),logging:g.object({}).optional().describe("Host accepts log messages."),sandbox:g.object({permissions:Dv.optional().describe("Permissions granted by the host (camera, microphone, geolocation)."),csp:kv.optional().describe("CSP domains approved by the host.")}).optional().describe("Sandbox configuration applied by the host."),updateModelContext:Dl.optional().describe("Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns."),message:Dl.optional().describe("Host supports receiving content messages (ui/message) from the view.")}),Ae=g.object({experimental:g.object({}).optional().describe("Experimental features (structure TBD)."),tools:g.object({listChanged:g.boolean().optional().describe("App supports tools/list_changed notifications.")}).optional().describe("App exposes MCP-style tools that the host can call."),availableDisplayModes:g.array(sr).optional().describe("Display modes the app supports.")}),pc=g.object({method:g.literal("ui/notifications/initialized"),params:g.object({}).optional()}),sc=g.object({csp:kv.optional().describe("Content Security Policy configuration for UI resources."),permissions:Dv.optional().describe("Sandbox permissions requested by the UI resource."),domain:g.string().optional().describe(`Dedicated origin for view sandbox.
62
+
63
+ Useful when views need stable, dedicated origins for OAuth callbacks, CORS policies, or API key allowlists.
64
+
65
+ **Host-dependent:** The format and validation rules for this field are determined by each host. Servers MUST consult host-specific documentation for the expected domain format. Common patterns include:
66
+ - Hash-based subdomains (e.g., \`{hash}.claudemcpcontent.com\`)
67
+ - URL-derived subdomains (e.g., \`www-example-com.oaiusercontent.com\`)
68
+
69
+ If omitted, host uses default sandbox origin (typically per-conversation).`),prefersBorder:g.boolean().optional().describe(`Visual boundary preference - true if view prefers a visible border.
70
+
71
+ Boolean requesting whether a visible border and background is provided by the host. Specifying an explicit value for this is recommended because hosts' defaults may vary.
72
+
73
+ - \`true\`: request visible border + background
74
+ - \`false\`: request no visible border + background
75
+ - omitted: host decides border`)}),rb=g.object({method:g.literal("ui/request-display-mode"),params:g.object({mode:sr.describe("The display mode being requested.")})}),jl=g.object({mode:sr.describe("The display mode that was actually set. May differ from requested if not supported.")}).passthrough(),Qe=g.union([g.literal("model"),g.literal("app")]).describe("Tool visibility scope - who can access the tool."),nb=g.object({resourceUri:g.string().optional(),visibility:g.array(Qe).optional().describe(`Who can access this tool. Default: ["model", "app"]
59
76
  - "model": Tool visible to and callable by the agent
60
77
  - "app": Tool callable by the app from this server only`)}),Uk=g.object({mimeTypes:g.array(g.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),ib=g.object({method:g.literal("ui/message"),params:g.object({role:g.literal("user").describe('Message role, currently only "user" is supported.'),content:g.array(We).describe("Message content blocks (text, image, etc.).")})}),vb=g.object({method:g.literal("ui/notifications/sandbox-resource-ready"),params:g.object({html:g.string().describe("HTML content to load into the inner iframe."),sandbox:g.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:kv.optional().describe("CSP configuration from resource metadata."),permissions:Dv.optional().describe("Sandbox permissions from resource metadata.")})}),Jl=g.object({method:g.literal("ui/notifications/tool-result"),params:mc.describe("Standard MCP tool execution result.")}),Ll=g.object({toolInfo:g.object({id:xc.optional().describe("JSON-RPC id of the tools/call request."),tool:Zc.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Ve.optional().describe("Current color theme preference."),styles:qe.optional().describe("Style configuration for theming the app."),displayMode:sr.optional().describe("How the UI is currently displayed."),availableDisplayModes:g.array(sr).optional().describe("Display modes the host supports."),containerDimensions:g.union([g.object({height:g.number().describe("Fixed container height in pixels.")}),g.object({maxHeight:g.union([g.number(),g.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(g.union([g.object({width:g.number().describe("Fixed container width in pixels.")}),g.object({maxWidth:g.union([g.number(),g.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
61
- container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:g.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:g.string().optional().describe("User's timezone in IANA format."),userAgent:g.string().optional().describe("Host application identifier."),platform:g.union([g.literal("web"),g.literal("desktop"),g.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:g.object({touch:g.boolean().optional().describe("Whether the device supports touch input."),hover:g.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:g.object({top:g.number().describe("Top safe area inset in pixels."),right:g.number().describe("Right safe area inset in pixels."),bottom:g.number().describe("Bottom safe area inset in pixels."),left:g.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Gl=g.object({method:g.literal("ui/notifications/host-context-changed"),params:Ll.describe("Partial context update containing only changed fields.")}),ob=g.object({method:g.literal("ui/update-model-context"),params:g.object({content:g.array(We).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:g.record(g.string(),g.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),$b=g.object({method:g.literal("ui/initialize"),params:g.object({appInfo:Xe.describe("App identification (name and version)."),appCapabilities:Ae.describe("Features and capabilities this app provides."),protocolVersion:g.string().describe("Protocol version this app supports.")})}),El=g.object({protocolVersion:g.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Xe.describe("Host application identification and version."),hostCapabilities:Ye.describe("Features and capabilities provided by the host."),hostContext:Ll.describe("Rich context about the host environment.")}).passthrough();function wv(){let r=document.documentElement.getAttribute("data-theme");if(r==="dark"||r==="light")return r;return document.documentElement.classList.contains("dark")?"dark":"light"}function Nv(r){let i=document.documentElement;i.setAttribute("data-theme",r),i.style.colorScheme=r}function Ov(r,i=document.documentElement){for(let[o,$]of Object.entries(r))if($!==void 0)i.style.setProperty(o,$)}function Sv(r){if(document.getElementById("__mcp-host-fonts"))return;let o=document.createElement("style");o.id="__mcp-host-fonts",o.textContent=r,document.head.appendChild(o)}var fk="ui/resourceUri",yk="text/html;profile=mcp-app";class Wl extends ub{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(r,i={},o={autoResize:!0}){super(o);this._appInfo=r;this._capabilities=i;this.options=o;this.setRequestHandler(eb,($)=>{return console.log("Received ping:",$.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(r){this.setNotificationHandler(Ol,(i)=>r(i.params))}set ontoolinputpartial(r){this.setNotificationHandler(Sl,(i)=>r(i.params))}set ontoolresult(r){this.setNotificationHandler(Jl,(i)=>r(i.params))}set ontoolcancelled(r){this.setNotificationHandler(zl,(i)=>r(i.params))}set onhostcontextchanged(r){this.setNotificationHandler(Gl,(i)=>{this._hostContext={...this._hostContext,...i.params},r(i.params)})}set onteardown(r){this.setRequestHandler(Pl,(i,o)=>r(i.params,o))}set oncalltool(r){this.setRequestHandler(tb,(i,o)=>r(i.params,o))}set onlisttools(r){this.setRequestHandler(Ib,(i,o)=>r(i.params,o))}assertCapabilityForMethod(r){}assertRequestHandlerCapability(r){switch(r){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${r})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${r} registered`)}}assertNotificationCapability(r){}assertTaskCapability(r){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(r){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(r,i){return await this.request({method:"tools/call",params:r},gb,i)}sendMessage(r,i){return this.request({method:"ui/message",params:r},Nl,i)}sendLog(r){return this.notification({method:"notifications/message",params:r})}updateModelContext(r,i){return this.request({method:"ui/update-model-context",params:r},lb,i)}openLink(r,i){return this.request({method:"ui/open-link",params:r},wl,i)}sendOpenLink=this.openLink;requestDisplayMode(r,i){return this.request({method:"ui/request-display-mode",params:r},jl,i)}sendSizeChanged(r){return this.notification({method:"ui/notifications/size-changed",params:r})}setupSizeChangedNotifications(){let r=!1,i=0,o=0,$=()=>{if(r)return;r=!0,requestAnimationFrame(()=>{r=!1;let v=document.documentElement,u=v.style.width,t=v.style.height;v.style.width="fit-content",v.style.height="fit-content";let I=v.getBoundingClientRect();v.style.width=u,v.style.height=t;let l=window.innerWidth-v.clientWidth,c=Math.ceil(I.width+l),_=Math.ceil(I.height);if(c!==i||_!==o)i=c,o=_,this.sendSizeChanged({width:c,height:_})})};$();let n=new ResizeObserver($);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(r=new zr(window.parent,window.parent),i){await super.connect(r);try{let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Pv}},El,i);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);if(this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}function vD({appInfo:r,capabilities:i,onAppCreated:o}){let[$,n]=Xl(null),[v,u]=Xl(!1),[t,I]=Xl(null);return cb(()=>{let l=!0;async function c(){try{let _=new zr(window.parent,window.parent),N=new Wl(r,i);if(o?.(N),await N.connect(_),l)n(N),u(!0),I(null)}catch(_){if(l)n(null),u(!1),I(_ instanceof Error?_:Error("Failed to connect"))}}return c(),()=>{l=!1}},[]),{app:$,isConnected:v,error:t}}import{useEffect as bb}from"react";function gD(r,i){bb(()=>{if(!r)return;return r.setupSizeChangedNotifications()},[r,i])}import{useEffect as _b,useState as Ub}from"react";function cD(){let[r,i]=Ub(wv);return _b(()=>{let o=new MutationObserver(()=>{i(wv())});return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"],characterData:!1,childList:!1,subtree:!1}),()=>o.disconnect()},[]),r}import{useEffect as zv,useRef as Fe}from"react";function kb(r,i){let o=Fe(!1);zv(()=>{if(o.current)return;if(i?.theme)Nv(i.theme);if(i?.styles?.variables)Ov(i.styles.variables);if(i?.theme||i?.styles?.variables)o.current=!0},[i]),zv(()=>{if(!r)return;r.onhostcontextchanged=($)=>{if($.theme)Nv($.theme);if($.styles?.variables)Ov($.styles.variables)}},[r])}function Db(r,i){let o=Fe(!1);zv(()=>{if(o.current)return;if(i?.styles?.css?.fonts)Sv(i.styles.css.fonts),o.current=!0},[i]),zv(()=>{if(!r)return;r.onhostcontextchanged=($)=>{if($.styles?.css?.fonts)Sv($.styles.css.fonts)}},[r])}function kD(r,i){kb(r,i),Db(r,i)}export{kD as useHostStyles,kb as useHostStyleVariables,Db as useHostFonts,cD as useDocumentTheme,gD as useAutoResize,vD as useApp,wv as getDocumentTheme,Ov as applyHostStyleVariables,Sv as applyHostFonts,Nv as applyDocumentTheme,he as TOOL_RESULT_METHOD,ye as TOOL_INPUT_PARTIAL_METHOD,fe as TOOL_INPUT_METHOD,ae as TOOL_CANCELLED_METHOD,de as SIZE_CHANGED_METHOD,Ce as SANDBOX_RESOURCE_READY_METHOD,Ze as SANDBOX_PROXY_READY_METHOD,fk as RESOURCE_URI_META_KEY,se as RESOURCE_TEARDOWN_METHOD,yk as RESOURCE_MIME_TYPE,i4 as REQUEST_DISPLAY_MODE_METHOD,zr as PostMessageTransport,me as OPEN_LINK_METHOD,ob as McpUiUpdateModelContextRequestSchema,Qe as McpUiToolVisibilitySchema,Jl as McpUiToolResultNotificationSchema,nb as McpUiToolMetaSchema,Sl as McpUiToolInputPartialNotificationSchema,Ol as McpUiToolInputNotificationSchema,zl as McpUiToolCancelledNotificationSchema,Ve as McpUiThemeSchema,Dl as McpUiSupportedContentBlockModalitiesSchema,hc as McpUiSizeChangedNotificationSchema,vb as McpUiSandboxResourceReadyNotificationSchema,yc as McpUiSandboxProxyReadyNotificationSchema,ac as McpUiResourceTeardownResultSchema,Pl as McpUiResourceTeardownRequestSchema,Dv as McpUiResourcePermissionsSchema,sc as McpUiResourceMetaSchema,kv as McpUiResourceCspSchema,jl as McpUiRequestDisplayModeResultSchema,rb as McpUiRequestDisplayModeRequestSchema,wl as McpUiOpenLinkResultSchema,fc as McpUiOpenLinkRequestSchema,Nl as McpUiMessageResultSchema,ib as McpUiMessageRequestSchema,pc as McpUiInitializedNotificationSchema,El as McpUiInitializeResultSchema,$b as McpUiInitializeRequestSchema,qe as McpUiHostStylesSchema,Ke as McpUiHostCssSchema,Ll as McpUiHostContextSchema,Gl as McpUiHostContextChangedNotificationSchema,Ye as McpUiHostCapabilitiesSchema,sr as McpUiDisplayModeSchema,Ae as McpUiAppCapabilitiesSchema,xe as MESSAGE_METHOD,Pv as LATEST_PROTOCOL_VERSION,r4 as INITIALIZE_METHOD,n4 as INITIALIZED_METHOD,pe as HOST_CONTEXT_CHANGED_METHOD,Wl as App};
78
+ container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:g.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:g.string().optional().describe("User's timezone in IANA format."),userAgent:g.string().optional().describe("Host application identifier."),platform:g.union([g.literal("web"),g.literal("desktop"),g.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:g.object({touch:g.boolean().optional().describe("Whether the device supports touch input."),hover:g.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:g.object({top:g.number().describe("Top safe area inset in pixels."),right:g.number().describe("Right safe area inset in pixels."),bottom:g.number().describe("Bottom safe area inset in pixels."),left:g.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),Gl=g.object({method:g.literal("ui/notifications/host-context-changed"),params:Ll.describe("Partial context update containing only changed fields.")}),ob=g.object({method:g.literal("ui/update-model-context"),params:g.object({content:g.array(We).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:g.record(g.string(),g.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),$b=g.object({method:g.literal("ui/initialize"),params:g.object({appInfo:Xe.describe("App identification (name and version)."),appCapabilities:Ae.describe("Features and capabilities this app provides."),protocolVersion:g.string().describe("Protocol version this app supports.")})}),El=g.object({protocolVersion:g.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:Xe.describe("Host application identification and version."),hostCapabilities:Ye.describe("Features and capabilities provided by the host."),hostContext:Ll.describe("Rich context about the host environment.")}).passthrough();function wv(){let r=document.documentElement.getAttribute("data-theme");if(r==="dark"||r==="light")return r;return document.documentElement.classList.contains("dark")?"dark":"light"}function Nv(r){let i=document.documentElement;i.setAttribute("data-theme",r),i.style.colorScheme=r}function Ov(r,i=document.documentElement){for(let[o,$]of Object.entries(r))if($!==void 0)i.style.setProperty(o,$)}function Sv(r){if(document.getElementById("__mcp-host-fonts"))return;let o=document.createElement("style");o.id="__mcp-host-fonts",o.textContent=r,document.head.appendChild(o)}var fk="ui/resourceUri",yk="text/html;profile=mcp-app";class Wl extends ub{_appInfo;_capabilities;options;_hostCapabilities;_hostInfo;_hostContext;constructor(r,i={},o={autoResize:!0}){super(o);this._appInfo=r;this._capabilities=i;this.options=o;this.setRequestHandler(eb,($)=>{return console.log("Received ping:",$.params),{}}),this.onhostcontextchanged=()=>{}}getHostCapabilities(){return this._hostCapabilities}getHostVersion(){return this._hostInfo}getHostContext(){return this._hostContext}set ontoolinput(r){this.setNotificationHandler(Ol,(i)=>r(i.params))}set ontoolinputpartial(r){this.setNotificationHandler(Sl,(i)=>r(i.params))}set ontoolresult(r){this.setNotificationHandler(Jl,(i)=>r(i.params))}set ontoolcancelled(r){this.setNotificationHandler(zl,(i)=>r(i.params))}set onhostcontextchanged(r){this.setNotificationHandler(Gl,(i)=>{this._hostContext={...this._hostContext,...i.params},r(i.params)})}set onteardown(r){this.setRequestHandler(Pl,(i,o)=>r(i.params,o))}set oncalltool(r){this.setRequestHandler(tb,(i,o)=>r(i.params,o))}set onlisttools(r){this.setRequestHandler(Ib,(i,o)=>r(i.params,o))}assertCapabilityForMethod(r){}assertRequestHandlerCapability(r){switch(r){case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Client does not support tool capability (required for ${r})`);return;case"ping":case"ui/resource-teardown":return;default:throw Error(`No handler for method ${r} registered`)}}assertNotificationCapability(r){}assertTaskCapability(r){throw Error("Tasks are not supported in MCP Apps")}assertTaskHandlerCapability(r){throw Error("Task handlers are not supported in MCP Apps")}async callServerTool(r,i){if(typeof r==="string")throw Error(`callServerTool() expects an object as its first argument, but received a string ("${r}"). Did you mean: callServerTool({ name: "${r}", arguments: { ... } })?`);return await this.request({method:"tools/call",params:r},gb,i)}sendMessage(r,i){return this.request({method:"ui/message",params:r},Nl,i)}sendLog(r){return this.notification({method:"notifications/message",params:r})}updateModelContext(r,i){return this.request({method:"ui/update-model-context",params:r},lb,i)}openLink(r,i){return this.request({method:"ui/open-link",params:r},wl,i)}sendOpenLink=this.openLink;requestDisplayMode(r,i){return this.request({method:"ui/request-display-mode",params:r},jl,i)}sendSizeChanged(r){return this.notification({method:"ui/notifications/size-changed",params:r})}setupSizeChangedNotifications(){let r=!1,i=0,o=0,$=()=>{if(r)return;r=!0,requestAnimationFrame(()=>{r=!1;let v=document.documentElement,u=v.style.width,t=v.style.height;v.style.width="fit-content",v.style.height="fit-content";let I=v.getBoundingClientRect();v.style.width=u,v.style.height=t;let l=window.innerWidth-v.clientWidth,c=Math.ceil(I.width+l),_=Math.ceil(I.height);if(c!==i||_!==o)i=c,o=_,this.sendSizeChanged({width:c,height:_})})};$();let n=new ResizeObserver($);return n.observe(document.documentElement),n.observe(document.body),()=>n.disconnect()}async connect(r=new zr(window.parent,window.parent),i){if(this.transport)throw Error("App is already connected. Call close() before connecting again.");await super.connect(r);try{let o=await this.request({method:"ui/initialize",params:{appCapabilities:this._capabilities,appInfo:this._appInfo,protocolVersion:Pv}},El,i);if(o===void 0)throw Error(`Server sent invalid initialize result: ${o}`);if(this._hostCapabilities=o.hostCapabilities,this._hostInfo=o.hostInfo,this._hostContext=o.hostContext,await this.notification({method:"ui/notifications/initialized"}),this.options?.autoResize)this.setupSizeChangedNotifications()}catch(o){throw this.close(),o}}}function vD({appInfo:r,capabilities:i,onAppCreated:o}){let[$,n]=Xl(null),[v,u]=Xl(!1),[t,I]=Xl(null);return cb(()=>{let l=!0;async function c(){try{let _=new zr(window.parent,window.parent),N=new Wl(r,i);if(o?.(N),await N.connect(_),l)n(N),u(!0),I(null)}catch(_){if(l)n(null),u(!1),I(_ instanceof Error?_:Error("Failed to connect"))}}return c(),()=>{l=!1}},[]),{app:$,isConnected:v,error:t}}import{useEffect as bb}from"react";function gD(r,i){bb(()=>{if(!r)return;return r.setupSizeChangedNotifications()},[r,i])}import{useEffect as _b,useState as Ub}from"react";function cD(){let[r,i]=Ub(wv);return _b(()=>{let o=new MutationObserver(()=>{i(wv())});return o.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"],characterData:!1,childList:!1,subtree:!1}),()=>o.disconnect()},[]),r}import{useEffect as zv,useRef as Fe}from"react";function kb(r,i){let o=Fe(!1);zv(()=>{if(o.current)return;if(i?.theme)Nv(i.theme);if(i?.styles?.variables)Ov(i.styles.variables);if(i?.theme||i?.styles?.variables)o.current=!0},[i]),zv(()=>{if(!r)return;r.onhostcontextchanged=($)=>{if($.theme)Nv($.theme);if($.styles?.variables)Ov($.styles.variables)}},[r])}function Db(r,i){let o=Fe(!1);zv(()=>{if(o.current)return;if(i?.styles?.css?.fonts)Sv(i.styles.css.fonts),o.current=!0},[i]),zv(()=>{if(!r)return;r.onhostcontextchanged=($)=>{if($.styles?.css?.fonts)Sv($.styles.css.fonts)}},[r])}function kD(r,i){kb(r,i),Db(r,i)}export{kD as useHostStyles,kb as useHostStyleVariables,Db as useHostFonts,cD as useDocumentTheme,gD as useAutoResize,vD as useApp,wv as getDocumentTheme,Ov as applyHostStyleVariables,Sv as applyHostFonts,Nv as applyDocumentTheme,he as TOOL_RESULT_METHOD,ye as TOOL_INPUT_PARTIAL_METHOD,fe as TOOL_INPUT_METHOD,ae as TOOL_CANCELLED_METHOD,de as SIZE_CHANGED_METHOD,Ce as SANDBOX_RESOURCE_READY_METHOD,Ze as SANDBOX_PROXY_READY_METHOD,fk as RESOURCE_URI_META_KEY,se as RESOURCE_TEARDOWN_METHOD,yk as RESOURCE_MIME_TYPE,i4 as REQUEST_DISPLAY_MODE_METHOD,zr as PostMessageTransport,me as OPEN_LINK_METHOD,ob as McpUiUpdateModelContextRequestSchema,Qe as McpUiToolVisibilitySchema,Jl as McpUiToolResultNotificationSchema,nb as McpUiToolMetaSchema,Sl as McpUiToolInputPartialNotificationSchema,Ol as McpUiToolInputNotificationSchema,zl as McpUiToolCancelledNotificationSchema,Ve as McpUiThemeSchema,Dl as McpUiSupportedContentBlockModalitiesSchema,hc as McpUiSizeChangedNotificationSchema,vb as McpUiSandboxResourceReadyNotificationSchema,yc as McpUiSandboxProxyReadyNotificationSchema,ac as McpUiResourceTeardownResultSchema,Pl as McpUiResourceTeardownRequestSchema,Dv as McpUiResourcePermissionsSchema,sc as McpUiResourceMetaSchema,kv as McpUiResourceCspSchema,jl as McpUiRequestDisplayModeResultSchema,rb as McpUiRequestDisplayModeRequestSchema,wl as McpUiOpenLinkResultSchema,fc as McpUiOpenLinkRequestSchema,Nl as McpUiMessageResultSchema,ib as McpUiMessageRequestSchema,pc as McpUiInitializedNotificationSchema,El as McpUiInitializeResultSchema,$b as McpUiInitializeRequestSchema,qe as McpUiHostStylesSchema,Ke as McpUiHostCssSchema,Ll as McpUiHostContextSchema,Gl as McpUiHostContextChangedNotificationSchema,Ye as McpUiHostCapabilitiesSchema,sr as McpUiDisplayModeSchema,Ae as McpUiAppCapabilitiesSchema,xe as MESSAGE_METHOD,Pv as LATEST_PROTOCOL_VERSION,r4 as INITIALIZE_METHOD,n4 as INITIALIZED_METHOD,pe as HOST_CONTEXT_CHANGED_METHOD,Wl as App};
@@ -97,8 +97,8 @@ export interface AppState {
97
97
  * app.onerror = (error) => {
98
98
  * console.log("Error:", error);
99
99
  * };
100
- * app.onhostcontextchanged = (params) => {
101
- * setHostContext((prev) => ({ ...prev, ...params }));
100
+ * app.onhostcontextchanged = (ctx) => {
101
+ * setHostContext((prev) => ({ ...prev, ...ctx }));
102
102
  * };
103
103
  * },
104
104
  * });
@@ -31,11 +31,11 @@
31
31
  * ```
32
32
  */
33
33
  import { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE, McpUiResourceMeta, McpUiToolMeta, McpUiClientCapabilities } from "../app.js";
34
- import type { McpServer, RegisteredTool, ResourceMetadata, ToolCallback, ReadResourceCallback } from "@modelcontextprotocol/sdk/server/mcp.js";
34
+ import type { McpServer, RegisteredTool, ResourceMetadata, ToolCallback, ReadResourceCallback as _ReadResourceCallback, RegisteredResource } from "@modelcontextprotocol/sdk/server/mcp.js";
35
35
  import type { AnySchema, ZodRawShapeCompat } from "@modelcontextprotocol/sdk/server/zod-compat.js";
36
- import type { ClientCapabilities, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
36
+ import type { ClientCapabilities, ReadResourceResult, ToolAnnotations } from "@modelcontextprotocol/sdk/types.js";
37
37
  export { RESOURCE_URI_META_KEY, RESOURCE_MIME_TYPE };
38
- export type { ResourceMetadata, ToolCallback, ReadResourceCallback };
38
+ export type { ResourceMetadata, ToolCallback };
39
39
  /**
40
40
  * Base tool configuration matching the standard MCP server tool options.
41
41
  * Extended by {@link McpUiAppToolConfig `McpUiAppToolConfig`} to add UI metadata requirements.
@@ -81,12 +81,19 @@ export interface McpUiAppToolConfig extends ToolConfig {
81
81
  * Extends the base MCP SDK `ResourceMetadata` with optional UI metadata
82
82
  * for configuring security policies and rendering preferences.
83
83
  *
84
+ * The `_meta.ui` field here is included in the `resources/list` response and serves as
85
+ * a static default for hosts to review at connection time. When the `resources/read`
86
+ * content item also includes `_meta.ui`, the content-item value takes precedence.
87
+ *
84
88
  * @see {@link registerAppResource `registerAppResource`} for usage
85
89
  */
86
90
  export interface McpUiAppResourceConfig extends ResourceMetadata {
87
91
  /**
88
92
  * Optional UI metadata for the resource.
89
- * Used to configure security policies (CSP) and rendering preferences.
93
+ *
94
+ * This appears on the resource entry in `resources/list` and acts as a listing-level
95
+ * fallback. Individual content items returned by `resources/read` may include their
96
+ * own `_meta.ui` which takes precedence over this value.
90
97
  */
91
98
  _meta?: {
92
99
  /**
@@ -177,6 +184,14 @@ export declare function registerAppTool<OutputArgs extends ZodRawShapeCompat | A
177
184
  inputSchema?: InputArgs;
178
185
  outputSchema?: OutputArgs;
179
186
  }, cb: ToolCallback<InputArgs>): RegisteredTool;
187
+ export type McpUiReadResourceResult = ReadResourceResult & {
188
+ _meta?: {
189
+ ui?: McpUiResourceMeta;
190
+ [key: string]: unknown;
191
+ };
192
+ };
193
+ export type McpUiReadResourceCallback = (uri: URL, extra: Parameters<_ReadResourceCallback>[1]) => McpUiReadResourceResult | Promise<McpUiReadResourceResult>;
194
+ export type ReadResourceCallback = McpUiReadResourceCallback;
180
195
  /**
181
196
  * Register an app resource with the MCP server.
182
197
  *
@@ -211,7 +226,7 @@ export declare function registerAppTool<OutputArgs extends ZodRawShapeCompat | A
211
226
  * );
212
227
  * ```
213
228
  *
214
- * @example With CSP configuration for external domains
229
+ * @example With CSP configuration for network access
215
230
  * ```ts source="./index.examples.ts#registerAppResource_withCsp"
216
231
  * registerAppResource(
217
232
  * server,
@@ -240,9 +255,57 @@ export declare function registerAppTool<OutputArgs extends ZodRawShapeCompat | A
240
255
  * );
241
256
  * ```
242
257
  *
258
+ * @example With stable origin for external API CORS allowlists
259
+ * ```ts source="./index.examples.ts#registerAppResource_withDomain"
260
+ * // Computes a stable origin from an MCP server URL for hosting in Claude.
261
+ * function computeAppDomainForClaude(mcpServerUrl: string): string {
262
+ * const hash = crypto
263
+ * .createHash("sha256")
264
+ * .update(mcpServerUrl)
265
+ * .digest("hex")
266
+ * .slice(0, 32);
267
+ * return `${hash}.claudemcpcontent.com`;
268
+ * }
269
+ *
270
+ * const APP_DOMAIN = computeAppDomainForClaude("https://example.com/mcp");
271
+ *
272
+ * registerAppResource(
273
+ * server,
274
+ * "Company Dashboard",
275
+ * "ui://dashboard/view.html",
276
+ * {
277
+ * description: "Internal dashboard with company data",
278
+ * },
279
+ * async () => ({
280
+ * contents: [
281
+ * {
282
+ * uri: "ui://dashboard/view.html",
283
+ * mimeType: RESOURCE_MIME_TYPE,
284
+ * text: dashboardHtml,
285
+ * _meta: {
286
+ * ui: {
287
+ * // CSP: tell browser the app is allowed to make requests
288
+ * csp: {
289
+ * connectDomains: ["https://api.example.com"],
290
+ * },
291
+ * // CORS: give app a stable origin for the API server to allowlist
292
+ * //
293
+ * // (Public APIs that use `Access-Control-Allow-Origin: *` or API
294
+ * // key auth don't need this.)
295
+ * domain: APP_DOMAIN,
296
+ * },
297
+ * },
298
+ * },
299
+ * ],
300
+ * }),
301
+ * );
302
+ * ```
303
+ *
304
+ * @see {@link McpUiResourceMeta `McpUiResourceMeta`} for `_meta.ui` configuration options
305
+ * @see {@link McpUiResourceCsp `McpUiResourceCsp`} for CSP domain allowlist configuration
243
306
  * @see {@link registerAppTool `registerAppTool`} to register tools that reference this resource
244
307
  */
245
- export declare function registerAppResource(server: Pick<McpServer, "registerResource">, name: string, uri: string, config: McpUiAppResourceConfig, readCallback: ReadResourceCallback): void;
308
+ export declare function registerAppResource(server: Pick<McpServer, "registerResource">, name: string, uri: string, config: McpUiAppResourceConfig, readCallback: McpUiReadResourceCallback): RegisteredResource;
246
309
  /**
247
310
  * Extension identifier for MCP Apps capability negotiation.
248
311
  *
@@ -263,21 +326,31 @@ export declare const EXTENSION_ID = "io.modelcontextprotocol/ui";
263
326
  * @returns The MCP Apps capability settings, or `undefined` if not supported
264
327
  *
265
328
  * @example Check for MCP Apps support in server initialization
266
- * ```typescript
267
- * import { getUiCapability, RESOURCE_MIME_TYPE, registerAppTool } from "@modelcontextprotocol/ext-apps/server";
268
- *
269
- * server.oninitialized = ({ clientCapabilities }) => {
329
+ * ```ts source="./index.examples.ts#getUiCapability_checkSupport"
330
+ * server.server.oninitialized = () => {
331
+ * const clientCapabilities = server.server.getClientCapabilities();
270
332
  * const uiCap = getUiCapability(clientCapabilities);
333
+ *
271
334
  * if (uiCap?.mimeTypes?.includes(RESOURCE_MIME_TYPE)) {
272
- * registerAppTool(server, "weather", {
273
- * description: "Get weather with interactive dashboard",
274
- * _meta: { ui: { resourceUri: "ui://weather/dashboard" } },
275
- * }, weatherHandler);
335
+ * // App-enhanced tool
336
+ * registerAppTool(
337
+ * server,
338
+ * "weather",
339
+ * {
340
+ * description: "Get weather information with interactive dashboard",
341
+ * _meta: { ui: { resourceUri: "ui://weather/dashboard" } },
342
+ * },
343
+ * weatherHandler,
344
+ * );
276
345
  * } else {
277
- * // Register text-only fallback
278
- * server.registerTool("weather", {
279
- * description: "Get weather as text",
280
- * }, textWeatherHandler);
346
+ * // Text-only fallback
347
+ * server.registerTool(
348
+ * "weather",
349
+ * {
350
+ * description: "Get weather information",
351
+ * },
352
+ * textWeatherHandler,
353
+ * );
281
354
  * }
282
355
  * };
283
356
  * ```