@mcp-use/inspector 1.0.0-canary.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/inspector.css +1 -1
- package/dist/cdn/inspector.js +79424 -78744
- package/dist/client/index.js +13657 -775
- package/dist/web/assets/{browser-ctrPxPGG.js → browser-BwHKNEau.js} +4 -4
- package/dist/web/assets/{chunk-62CHIOHA-BqLxpYpN.js → chunk-BBSBHVGK-D4wCPq_w.js} +1 -1
- package/dist/web/assets/{chunk-VAZ3ORZF-xdDkmZd3.js → chunk-ECXMLUNG-CSRGaMIB.js} +1 -1
- package/dist/web/assets/{chunk-JU7W27UC-B2439jaH.js → chunk-JU7W27UC-CMTI_w7A.js} +1 -1
- package/dist/web/assets/{chunk-QWQYAQCK-CyFuZlX8.js → chunk-QWQYAQCK-BR4V0xsV.js} +1 -1
- package/dist/web/assets/{chunk-RPN2XO5I-BhkUchqc.js → chunk-RPN2XO5I-Cr13Miz-.js} +1 -1
- package/dist/web/assets/{chunk-UJPHRNQP-C5slpjuZ.js → chunk-UJPHRNQP-B14ZPq5a.js} +1 -1
- package/dist/web/assets/{chunk_array-DyR0murc.js → chunk_array-Bw1lTtex.js} +1 -1
- package/dist/web/assets/{client-SJZVAN5F-B1CFq11b.js → client-2BTCLEUX-BhvJZmo-.js} +3 -3
- package/dist/web/assets/{client-DbpdPhaZ.js → client-z1GrRUEs.js} +2 -2
- package/dist/web/assets/{display-A5IEINAP-C6oc4kO3.js → display-A5IEINAP-B8BJrcag.js} +1 -1
- package/dist/web/assets/{dist-B902efBV.js → dist-BZmXa__p.js} +1 -1
- package/dist/web/assets/{dist-CZy-FXZn.js → dist-JsQmV3pO.js} +1 -1
- package/dist/web/assets/{dist-DgSb0Sz-.js → dist-t5Yo0YiG.js} +1 -1
- package/dist/web/assets/{function_calling-BfpScnEV.js → function_calling-kK7um7Ye.js} +1 -1
- package/dist/web/assets/index-CM9P_1sf.css +2 -0
- package/dist/web/assets/index-zlrXpRSB.js +720 -0
- package/dist/web/assets/langfuse-U2OEF7K7-BF5JV8uu.js +1 -0
- package/dist/web/assets/{llms-BsPQSnXF.js → llms-ByyTYk2T.js} +1 -1
- package/dist/web/assets/{messages-CARqPn1v.js → messages-D4_mH1tk.js} +1 -1
- package/dist/web/assets/react-C6BFTceN.js +1 -0
- package/dist/web/assets/rpc-logger-TPNV75J4-CMVlzCN7.js +1 -0
- package/dist/web/assets/{schemas-R05rZMzG.js → schemas-BrqAD_Qo.js} +1 -1
- package/dist/web/assets/{stdio-LCWQPR45-CGHsqeDK.js → stdio-RWLH66ZO-C753VwJ7.js} +1 -1
- package/dist/web/assets/{tools-Dk1xpPiY.js → tools-kLe9X8V8.js} +1 -1
- package/dist/web/index.html +13 -13
- package/package.json +8 -17
- package/dist/web/assets/index-DAB6h2wg.css +0 -2
- package/dist/web/assets/index-DdgwtcKr.js +0 -430
- package/dist/web/assets/langfuse-U2OEF7K7-CXu1ftDi.js +0 -1
- package/dist/web/assets/react-CR79PxS-.js +0 -1
- package/dist/web/assets/rpc-logger-TPNV75J4-DvyEg0Mj.js +0 -1
- /package/dist/web/assets/{chunk-3GQAWCBQ-C-9Cm0Np.js → chunk-3GQAWCBQ-ntjTDD_C.js} +0 -0
- /package/dist/web/assets/{json-schema-processors-BJc5OsHH.js → json-schema-processors-DNSjFPrk.js} +0 -0
- /package/dist/web/assets/{preload-helper-7Icc4Czl.js → preload-helper-ckxxtgMM.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./chunk-zsgVPwQN.js";import{t as a}from"./chunk-3GQAWCBQ-C-9Cm0Np.js";import{n as o}from"./chunk-QWQYAQCK-CyFuZlX8.js";import{C as s,_ as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,o as v,p as y,r as b,s as x,u as ee,v as S,x as C}from"./schemas-R05rZMzG.js";import{t as te}from"./preload-helper-7Icc4Czl.js";function ne(e){return!!e._zod}function w(e,t){return ne(e),e.safeParse(t)}function re(e){if(!e)return;let t;if(t=ne(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function ie(e){if(ne(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}var ae=`2025-11-25`,oe=[ae,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],se=`io.modelcontextprotocol/related-task`,T=u(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),ce=l([S(),y().int()]),le=S();f({ttl:l([y(),h()]).optional(),pollInterval:y().optional()});var ue=_({ttl:y().optional()}),de=_({taskId:S()}),fe=f({progressToken:ce.optional(),[se]:de.optional()}),E=_({_meta:fe.optional()}),pe=E.extend({task:ue.optional()}),me=e=>pe.safeParse(e).success,D=_({method:S(),params:E.loose().optional()}),O=_({_meta:fe.optional()}),k=_({method:S(),params:O.loose().optional()}),A=f({_meta:fe.optional()}),he=l([S(),y().int()]),ge=_({jsonrpc:d(`2.0`),id:he,...D.shape}).strict(),_e=e=>ge.safeParse(e).success,ve=_({jsonrpc:d(`2.0`),...k.shape}).strict(),ye=e=>ve.safeParse(e).success,be=_({jsonrpc:d(`2.0`),id:he,result:A}).strict(),xe=e=>be.safeParse(e).success,j;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(j||={});var Se=_({jsonrpc:d(`2.0`),id:he.optional(),error:_({code:y().int(),message:S(),data:C().optional()})}).strict(),Ce=e=>Se.safeParse(e).success,we=l([ge,ve,be,Se]);l([be,Se]);var Te=A.strict(),Ee=O.extend({requestId:he.optional(),reason:S().optional()}),De=k.extend({method:d(`notifications/cancelled`),params:Ee}),Oe=_({icons:v(_({src:S(),mimeType:S().optional(),sizes:v(S()).optional(),theme:b([`light`,`dark`]).optional()})).optional()}),ke=_({name:S(),title:S().optional()}),Ae=ke.extend({...ke.shape,...Oe.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),je=p(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ee(_({form:ee(_({applyDefaults:x().optional()}),c(S(),C())).optional(),url:T.optional()}),c(S(),C()).optional())),Me=f({list:T.optional(),cancel:T.optional(),requests:f({sampling:f({createMessage:T.optional()}).optional(),elicitation:f({create:T.optional()}).optional()}).optional()}),Ne=f({list:T.optional(),cancel:T.optional(),requests:f({tools:f({call:T.optional()}).optional()}).optional()}),Pe=_({experimental:c(S(),T).optional(),extensions:c(S(),C()).optional(),sampling:_({context:T.optional(),tools:T.optional()}).optional(),elicitation:je.optional(),roots:_({listChanged:x().optional()}).optional(),tasks:Me.optional()}),Fe=E.extend({protocolVersion:S(),capabilities:Pe,clientInfo:Ae}),Ie=D.extend({method:d(`initialize`),params:Fe}),Le=_({experimental:c(S(),T).optional(),logging:T.optional(),completions:T.optional(),prompts:_({listChanged:x().optional()}).optional(),resources:_({subscribe:x().optional(),listChanged:x().optional()}).optional(),tools:_({listChanged:x().optional()}).optional(),tasks:Ne.optional()}),Re=A.extend({protocolVersion:S(),capabilities:Le,serverInfo:Ae,instructions:S().optional()}),ze=k.extend({method:d(`notifications/initialized`),params:O.optional()}),Be=e=>ze.safeParse(e).success,Ve=D.extend({method:d(`ping`),params:E.optional()}),He=_({progress:y(),total:m(y()),message:m(S())}),Ue=_({...O.shape,...He.shape,progressToken:ce}),We=k.extend({method:d(`notifications/progress`),params:Ue}),Ge=E.extend({cursor:le.optional()}),Ke=D.extend({params:Ge.optional()}),qe=A.extend({nextCursor:le.optional()}),Je=b([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Ye=_({taskId:S(),status:Je,ttl:l([y(),h()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:m(y()),statusMessage:m(S())}),Xe=A.extend({task:Ye}),Ze=O.merge(Ye),Qe=k.extend({method:d(`notifications/tasks/status`),params:Ze}),$e=D.extend({method:d(`tasks/get`),params:E.extend({taskId:S()})}),et=A.merge(Ye),tt=D.extend({method:d(`tasks/result`),params:E.extend({taskId:S()})});A.loose();var nt=Ke.extend({method:d(`tasks/list`)}),rt=qe.extend({tasks:v(Ye)}),it=D.extend({method:d(`tasks/cancel`),params:E.extend({taskId:S()})}),at=A.merge(Ye),ot=_({uri:S(),mimeType:m(S()),_meta:c(S(),C()).optional()}),st=ot.extend({text:S()}),ct=S().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),lt=ot.extend({blob:ct}),ut=b([`user`,`assistant`]),dt=_({audience:v(ut).optional(),priority:y().min(0).max(1).optional(),lastModified:s({offset:!0}).optional()}),ft=_({...ke.shape,...Oe.shape,uri:S(),description:m(S()),mimeType:m(S()),annotations:dt.optional(),_meta:m(f({}))}),pt=_({...ke.shape,...Oe.shape,uriTemplate:S(),description:m(S()),mimeType:m(S()),annotations:dt.optional(),_meta:m(f({}))}),mt=Ke.extend({method:d(`resources/list`)}),ht=qe.extend({resources:v(ft)}),gt=Ke.extend({method:d(`resources/templates/list`)}),_t=qe.extend({resourceTemplates:v(pt)}),vt=E.extend({uri:S()}),yt=vt,bt=D.extend({method:d(`resources/read`),params:yt}),xt=A.extend({contents:v(l([st,lt]))}),St=k.extend({method:d(`notifications/resources/list_changed`),params:O.optional()}),Ct=vt,wt=D.extend({method:d(`resources/subscribe`),params:Ct}),Tt=vt,Et=D.extend({method:d(`resources/unsubscribe`),params:Tt}),Dt=O.extend({uri:S()}),Ot=k.extend({method:d(`notifications/resources/updated`),params:Dt}),kt=_({name:S(),description:m(S()),required:m(x())}),At=_({...ke.shape,...Oe.shape,description:m(S()),arguments:m(v(kt)),_meta:m(f({}))}),jt=Ke.extend({method:d(`prompts/list`)}),Mt=qe.extend({prompts:v(At)}),Nt=E.extend({name:S(),arguments:c(S(),S()).optional()}),Pt=D.extend({method:d(`prompts/get`),params:Nt}),Ft=_({type:d(`text`),text:S(),annotations:dt.optional(),_meta:c(S(),C()).optional()}),It=_({type:d(`image`),data:ct,mimeType:S(),annotations:dt.optional(),_meta:c(S(),C()).optional()}),Lt=_({type:d(`audio`),data:ct,mimeType:S(),annotations:dt.optional(),_meta:c(S(),C()).optional()}),Rt=_({type:d(`tool_use`),name:S(),id:S(),input:c(S(),C()),_meta:c(S(),C()).optional()}),zt=_({type:d(`resource`),resource:l([st,lt]),annotations:dt.optional(),_meta:c(S(),C()).optional()}),Bt=l([Ft,It,Lt,ft.extend({type:d(`resource_link`)}),zt]),Vt=_({role:ut,content:Bt}),Ht=A.extend({description:S().optional(),messages:v(Vt)}),Ut=k.extend({method:d(`notifications/prompts/list_changed`),params:O.optional()}),Wt=_({title:S().optional(),readOnlyHint:x().optional(),destructiveHint:x().optional(),idempotentHint:x().optional(),openWorldHint:x().optional()}),Gt=_({taskSupport:b([`required`,`optional`,`forbidden`]).optional()}),Kt=_({...ke.shape,...Oe.shape,description:S().optional(),inputSchema:_({type:d(`object`),properties:c(S(),T).optional(),required:v(S()).optional()}).catchall(C()),outputSchema:_({type:d(`object`),properties:c(S(),T).optional(),required:v(S()).optional()}).catchall(C()).optional(),annotations:Wt.optional(),execution:Gt.optional(),_meta:c(S(),C()).optional()}),qt=Ke.extend({method:d(`tools/list`)}),Jt=qe.extend({tools:v(Kt)}),Yt=A.extend({content:v(Bt).default([]),structuredContent:c(S(),C()).optional(),isError:x().optional()});Yt.or(A.extend({toolResult:C()}));var Xt=pe.extend({name:S(),arguments:c(S(),C()).optional()}),Zt=D.extend({method:d(`tools/call`),params:Xt}),Qt=k.extend({method:d(`notifications/tools/list_changed`),params:O.optional()}),$t=_({autoRefresh:x().default(!0),debounceMs:y().int().nonnegative().default(300)}),en=b([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),tn=E.extend({level:en}),nn=D.extend({method:d(`logging/setLevel`),params:tn}),rn=O.extend({level:en,logger:S().optional(),data:C()}),an=k.extend({method:d(`notifications/message`),params:rn}),on=_({hints:v(_({name:S().optional()})).optional(),costPriority:y().min(0).max(1).optional(),speedPriority:y().min(0).max(1).optional(),intelligencePriority:y().min(0).max(1).optional()}),sn=_({mode:b([`auto`,`required`,`none`]).optional()}),cn=_({type:d(`tool_result`),toolUseId:S().describe(`The unique identifier for the corresponding tool call.`),content:v(Bt).default([]),structuredContent:_({}).loose().optional(),isError:x().optional(),_meta:c(S(),C()).optional()}),ln=g(`type`,[Ft,It,Lt]),un=g(`type`,[Ft,It,Lt,Rt,cn]),dn=_({role:ut,content:l([un,v(un)]),_meta:c(S(),C()).optional()}),fn=pe.extend({messages:v(dn),modelPreferences:on.optional(),systemPrompt:S().optional(),includeContext:b([`none`,`thisServer`,`allServers`]).optional(),temperature:y().optional(),maxTokens:y().int(),stopSequences:v(S()).optional(),metadata:T.optional(),tools:v(Kt).optional(),toolChoice:sn.optional()}),pn=D.extend({method:d(`sampling/createMessage`),params:fn}),mn=A.extend({model:S(),stopReason:m(b([`endTurn`,`stopSequence`,`maxTokens`]).or(S())),role:ut,content:ln}),hn=A.extend({model:S(),stopReason:m(b([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(S())),role:ut,content:l([un,v(un)])}),gn=_({type:d(`boolean`),title:S().optional(),description:S().optional(),default:x().optional()}),_n=_({type:d(`string`),title:S().optional(),description:S().optional(),minLength:y().optional(),maxLength:y().optional(),format:b([`email`,`uri`,`date`,`date-time`]).optional(),default:S().optional()}),vn=_({type:b([`number`,`integer`]),title:S().optional(),description:S().optional(),minimum:y().optional(),maximum:y().optional(),default:y().optional()}),yn=_({type:d(`string`),title:S().optional(),description:S().optional(),enum:v(S()),default:S().optional()}),bn=_({type:d(`string`),title:S().optional(),description:S().optional(),oneOf:v(_({const:S(),title:S()})),default:S().optional()}),xn=l([l([_({type:d(`string`),title:S().optional(),description:S().optional(),enum:v(S()),enumNames:v(S()).optional(),default:S().optional()}),l([yn,bn]),l([_({type:d(`array`),title:S().optional(),description:S().optional(),minItems:y().optional(),maxItems:y().optional(),items:_({type:d(`string`),enum:v(S())}),default:v(S()).optional()}),_({type:d(`array`),title:S().optional(),description:S().optional(),minItems:y().optional(),maxItems:y().optional(),items:_({anyOf:v(_({const:S(),title:S()}))}),default:v(S()).optional()})])]),gn,_n,vn]),Sn=l([pe.extend({mode:d(`form`).optional(),message:S(),requestedSchema:_({type:d(`object`),properties:c(S(),xn),required:v(S()).optional()})}),pe.extend({mode:d(`url`),message:S(),elicitationId:S(),url:S().url()})]),Cn=D.extend({method:d(`elicitation/create`),params:Sn}),wn=O.extend({elicitationId:S()}),Tn=k.extend({method:d(`notifications/elicitation/complete`),params:wn}),En=A.extend({action:b([`accept`,`decline`,`cancel`]),content:p(e=>e===null?void 0:e,c(S(),l([S(),y(),x(),v(S())])).optional())}),Dn=_({type:d(`ref/resource`),uri:S()}),On=_({type:d(`ref/prompt`),name:S()}),kn=E.extend({ref:l([On,Dn]),argument:_({name:S(),value:S()}),context:_({arguments:c(S(),S()).optional()}).optional()}),An=D.extend({method:d(`completion/complete`),params:kn}),jn=A.extend({completion:f({values:v(S()).max(100),total:m(y().int()),hasMore:m(x())})}),Mn=_({uri:S().startsWith(`file://`),name:S().optional(),_meta:c(S(),C()).optional()}),Nn=D.extend({method:d(`roots/list`),params:E.optional()}),Pn=A.extend({roots:v(Mn)}),Fn=k.extend({method:d(`notifications/roots/list_changed`),params:O.optional()});l([Ve,Ie,An,nn,Pt,jt,mt,gt,bt,wt,Et,Zt,qt,$e,tt,nt,it]),l([De,We,ze,Fn,Qe]),l([Te,mn,hn,En,Pn,et,rt,Xe]),l([Ve,pn,Cn,Nn,$e,tt,nt,it]),l([De,We,an,Ot,St,Qt,Ut,Qe,Tn]),l([Te,Re,jn,Ht,Mt,ht,_t,xt,Yt,Jt,et,rt,Xe]);var M=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===j.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new In(e.elicitations,n)}return new e(t,n,r)}},In=class extends M{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(j.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function Ln(e){return e===`completed`||e===`failed`||e===`cancelled`}function Rn(e){let t=re(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=ie(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function zn(e,t){let n=w(e,t);if(!n.success)throw n.error;return n.data}var Bn=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(De,e=>{this._oncancel(e)}),this.setNotificationHandler(We,e=>{this._onprogress(e)}),this.setRequestHandler(Ve,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler($e,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new M(j.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(tt,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new M(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new M(j.InvalidParams,`Task not found: ${r}`);if(!Ln(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(Ln(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[se]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(nt,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new M(j.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(it,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new M(j.InvalidParams,`Task not found: ${e.params.taskId}`);if(Ln(n.status))throw new M(j.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new M(j.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof M?e:new M(j.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),M.fromError(j.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),xe(e)||Ce(e)?this._onresponse(e):_e(e)?this._onrequest(e,t):ye(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=M.fromError(j.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[se]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:j.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=me(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new M(j.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:j.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),xe(e)?n(e):n(new M(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(xe(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),xe(e)?r(e):r(M.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof M?e:new M(j.InternalError,String(e))}}return}let i;try{let r=await this.request(e,Xe,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new M(j.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},Ln(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new M(j.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new M(j.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof M?e:new M(j.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[se]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof M?e:new M(j.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=w(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(M.fromError(j.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},et,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},rt,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},at,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[se]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[se]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[se]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=Rn(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=zn(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=Rn(e);this._notificationHandlers.set(n,n=>{let r=zn(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&_e(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new M(j.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new M(j.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new M(j.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new M(j.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=Qe.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),Ln(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new M(j.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(Ln(a.status))throw new M(j.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=Qe.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),Ln(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function Vn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hn(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];Vn(a)&&Vn(i)?n[r]={...a,...i}:n[r]=i}return n}var Un=Object.defineProperty,Wn=(e,t)=>{for(var n in t)Un(e,n,{get:t[n],enumerable:!0,configurable:!0,set:e=>t[n]=()=>e})},N={};Wn(N,{xor:()=>mh,xid:()=>tm,void:()=>th,uuidv7:()=>Bp,uuidv6:()=>zp,uuidv4:()=>Rp,uuid:()=>Lp,util:()=>I,url:()=>Hp,uppercase:()=>gd,unknown:()=>Zm,union:()=>fh,undefined:()=>Gm,ulid:()=>$p,uint64:()=>Vm,uint32:()=>Pm,tuple:()=>bh,trim:()=>wd,treeifyError:()=>oi,transform:()=>Lh,toUpperCase:()=>Ed,toLowerCase:()=>Td,toJSONSchema:()=>ep,templateLiteral:()=>ug,symbol:()=>Um,superRefine:()=>xg,success:()=>Qh,stringbool:()=>Tg,stringFormat:()=>Cm,string:()=>jp,strictObject:()=>lh,startsWith:()=>vd,slugify:()=>Dd,size:()=>ud,setErrorMap:()=>kg,set:()=>Oh,safeParseAsync:()=>bp,safeParse:()=>yp,safeEncodeAsync:()=>Dp,safeEncode:()=>Tp,safeDecodeAsync:()=>Op,safeDecode:()=>Ep,registry:()=>$l,regexes:()=>Ni,regex:()=>md,refine:()=>bg,record:()=>Sh,readonly:()=>cg,property:()=>bd,promise:()=>mg,prettifyError:()=>ci,preprocess:()=>Dg,prefault:()=>Jh,positive:()=>rd,pipe:()=>ig,partialRecord:()=>Ch,parseAsync:()=>vp,parse:()=>_p,overwrite:()=>Sd,optional:()=>zh,object:()=>ch,number:()=>Om,nullish:()=>Wh,nullable:()=>Uh,null:()=>qm,normalize:()=>Cd,nonpositive:()=>ad,nonoptional:()=>Xh,nonnegative:()=>od,never:()=>$m,negative:()=>id,nativeEnum:()=>jh,nanoid:()=>qp,nan:()=>ng,multipleOf:()=>sd,minSize:()=>ld,minLength:()=>fd,mime:()=>xd,meta:()=>Cg,maxSize:()=>cd,maxLength:()=>dd,map:()=>Eh,mac:()=>sm,lte:()=>td,lt:()=>ed,lowercase:()=>hd,looseRecord:()=>wh,looseObject:()=>uh,locales:()=>ec,literal:()=>Nh,length:()=>pd,lazy:()=>fg,ksuid:()=>rm,keyof:()=>oh,jwt:()=>xm,json:()=>Eg,iso:()=>ap,ipv6:()=>lm,ipv4:()=>am,intersection:()=>vh,int64:()=>Bm,int32:()=>Nm,int:()=>Am,instanceof:()=>wg,includes:()=>_d,httpUrl:()=>Up,hostname:()=>wm,hex:()=>Tm,hash:()=>Em,guid:()=>Fp,gte:()=>G,gt:()=>nd,globalRegistry:()=>eu,getErrorMap:()=>Ag,function:()=>gg,fromJSONSchema:()=>Ig,formatError:()=>ai,float64:()=>Mm,float32:()=>jm,flattenError:()=>ii,file:()=>Fh,exactOptional:()=>Vh,enum:()=>Ah,endsWith:()=>yd,encodeAsync:()=>Cp,encode:()=>xp,emoji:()=>Gp,email:()=>Np,e164:()=>ym,discriminatedUnion:()=>gh,describe:()=>Sg,decodeAsync:()=>wp,decode:()=>Sp,date:()=>rh,custom:()=>yg,cuid2:()=>Zp,cuid:()=>Yp,core:()=>Gn,config:()=>F,coerce:()=>Lg,codec:()=>og,clone:()=>Or,cidrv6:()=>pm,cidrv4:()=>dm,check:()=>vg,catch:()=>eg,boolean:()=>Im,bigint:()=>Rm,base64url:()=>_m,base64:()=>hm,array:()=>ah,any:()=>Ym,_function:()=>gg,_default:()=>Kh,_ZodString:()=>kp,ZodXor:()=>ph,ZodXID:()=>em,ZodVoid:()=>eh,ZodUnknown:()=>Xm,ZodUnion:()=>dh,ZodUndefined:()=>Wm,ZodUUID:()=>Ip,ZodURL:()=>Vp,ZodULID:()=>Qp,ZodType:()=>J,ZodTuple:()=>yh,ZodTransform:()=>Ih,ZodTemplateLiteral:()=>lg,ZodSymbol:()=>Hm,ZodSuccess:()=>Zh,ZodStringFormat:()=>Y,ZodString:()=>Ap,ZodSet:()=>Dh,ZodRecord:()=>xh,ZodRealError:()=>gp,ZodReadonly:()=>sg,ZodPromise:()=>pg,ZodPrefault:()=>qh,ZodPipe:()=>rg,ZodOptional:()=>Rh,ZodObject:()=>sh,ZodNumberFormat:()=>km,ZodNumber:()=>Dm,ZodNullable:()=>Hh,ZodNull:()=>Km,ZodNonOptional:()=>Yh,ZodNever:()=>Qm,ZodNanoID:()=>Kp,ZodNaN:()=>tg,ZodMap:()=>Th,ZodMAC:()=>om,ZodLiteral:()=>Mh,ZodLazy:()=>dg,ZodKSUID:()=>nm,ZodJWT:()=>bm,ZodIssueCode:()=>Og,ZodIntersection:()=>_h,ZodISOTime:()=>up,ZodISODuration:()=>fp,ZodISODateTime:()=>op,ZodISODate:()=>cp,ZodIPv6:()=>cm,ZodIPv4:()=>im,ZodGUID:()=>Pp,ZodFunction:()=>hg,ZodFirstPartyTypeKind:()=>jg,ZodFile:()=>Ph,ZodExactOptional:()=>Bh,ZodError:()=>hp,ZodEnum:()=>kh,ZodEmoji:()=>Wp,ZodEmail:()=>Mp,ZodE164:()=>vm,ZodDiscriminatedUnion:()=>hh,ZodDefault:()=>Gh,ZodDate:()=>nh,ZodCustomStringFormat:()=>Sm,ZodCustom:()=>_g,ZodCodec:()=>ag,ZodCatch:()=>$h,ZodCUID2:()=>Xp,ZodCUID:()=>Jp,ZodCIDRv6:()=>fm,ZodCIDRv4:()=>um,ZodBoolean:()=>Fm,ZodBigIntFormat:()=>zm,ZodBigInt:()=>Lm,ZodBase64URL:()=>gm,ZodBase64:()=>mm,ZodArray:()=>ih,ZodAny:()=>Jm,TimePrecision:()=>Eu,NEVER:()=>Kn,$output:()=>Xl,$input:()=>Zl,$brand:()=>qn});var Gn={};Wn(Gn,{version:()=>mo,util:()=>I,treeifyError:()=>oi,toJSONSchema:()=>ep,toDotPath:()=>si,safeParseAsync:()=>gi,safeParse:()=>mi,safeEncodeAsync:()=>Ai,safeEncode:()=>Ei,safeDecodeAsync:()=>Mi,safeDecode:()=>Oi,registry:()=>$l,regexes:()=>Ni,process:()=>K,prettifyError:()=>ci,parseAsync:()=>fi,parse:()=>ui,meta:()=>af,locales:()=>ec,isValidJWT:()=>Vo,isValidBase64URL:()=>Ro,isValidBase64:()=>Io,initializeContext:()=>cf,globalRegistry:()=>eu,globalConfig:()=>Xn,formatError:()=>ai,flattenError:()=>ii,finalize:()=>uf,extractDefs:()=>lf,encodeAsync:()=>Si,encode:()=>vi,describe:()=>rf,decodeAsync:()=>wi,decode:()=>bi,createToJSONSchemaMethod:()=>df,createStandardJSONSchemaMethod:()=>ff,config:()=>F,clone:()=>Or,_xor:()=>Ad,_xid:()=>hu,_void:()=>Xu,_uuidv7:()=>cu,_uuidv6:()=>su,_uuidv4:()=>ou,_uuid:()=>au,_url:()=>lu,_uppercase:()=>gd,_unknown:()=>Ju,_union:()=>kd,_undefined:()=>Gu,_ulid:()=>mu,_uint64:()=>Uu,_uint32:()=>Lu,_tuple:()=>Nd,_trim:()=>wd,_transform:()=>Vd,_toUpperCase:()=>Ed,_toLowerCase:()=>Td,_templateLiteral:()=>Xd,_symbol:()=>Wu,_superRefine:()=>tf,_success:()=>Kd,_stringbool:()=>of,_stringFormat:()=>sf,_string:()=>tu,_startsWith:()=>vd,_slugify:()=>Dd,_size:()=>ud,_set:()=>Id,_safeParseAsync:()=>hi,_safeParse:()=>pi,_safeEncodeAsync:()=>ki,_safeEncode:()=>Ti,_safeDecodeAsync:()=>ji,_safeDecode:()=>Di,_regex:()=>md,_refine:()=>ef,_record:()=>Pd,_readonly:()=>Yd,_property:()=>bd,_promise:()=>Qd,_positive:()=>rd,_pipe:()=>Jd,_parseAsync:()=>di,_parse:()=>li,_overwrite:()=>Sd,_optional:()=>Hd,_number:()=>ju,_nullable:()=>Ud,_null:()=>Ku,_normalize:()=>Cd,_nonpositive:()=>ad,_nonoptional:()=>Gd,_nonnegative:()=>od,_never:()=>Yu,_negative:()=>id,_nativeEnum:()=>Rd,_nanoid:()=>du,_nan:()=>$u,_multipleOf:()=>sd,_minSize:()=>ld,_minLength:()=>fd,_min:()=>G,_mime:()=>xd,_maxSize:()=>cd,_maxLength:()=>dd,_max:()=>td,_map:()=>Fd,_mac:()=>yu,_lte:()=>td,_lt:()=>ed,_lowercase:()=>hd,_literal:()=>zd,_length:()=>pd,_lazy:()=>Zd,_ksuid:()=>gu,_jwt:()=>Tu,_isoTime:()=>ku,_isoDuration:()=>Au,_isoDateTime:()=>Du,_isoDate:()=>Ou,_ipv6:()=>vu,_ipv4:()=>_u,_intersection:()=>Md,_int64:()=>Hu,_int32:()=>Iu,_int:()=>Nu,_includes:()=>_d,_guid:()=>iu,_gte:()=>G,_gt:()=>nd,_float64:()=>Fu,_float32:()=>Pu,_file:()=>Bd,_enum:()=>Ld,_endsWith:()=>yd,_encodeAsync:()=>xi,_encode:()=>_i,_emoji:()=>uu,_email:()=>ru,_e164:()=>wu,_discriminatedUnion:()=>jd,_default:()=>Wd,_decodeAsync:()=>Ci,_decode:()=>yi,_date:()=>Zu,_custom:()=>$d,_cuid2:()=>pu,_cuid:()=>fu,_coercedString:()=>nu,_coercedNumber:()=>Mu,_coercedDate:()=>Qu,_coercedBoolean:()=>zu,_coercedBigint:()=>Vu,_cidrv6:()=>xu,_cidrv4:()=>bu,_check:()=>nf,_catch:()=>qd,_boolean:()=>Ru,_bigint:()=>Bu,_base64url:()=>Cu,_base64:()=>Su,_array:()=>Od,_any:()=>qu,TimePrecision:()=>Eu,NEVER:()=>Kn,JSONSchemaGenerator:()=>tp,JSONSchema:()=>np,Doc:()=>po,$output:()=>Xl,$input:()=>Zl,$constructor:()=>P,$brand:()=>qn,$ZodXor:()=>ps,$ZodXID:()=>To,$ZodVoid:()=>ts,$ZodUnknown:()=>$o,$ZodUnion:()=>ds,$ZodUndefined:()=>Xo,$ZodUUID:()=>_o,$ZodURL:()=>yo,$ZodULID:()=>wo,$ZodType:()=>U,$ZodTuple:()=>vs,$ZodTransform:()=>Os,$ZodTemplateLiteral:()=>Js,$ZodSymbol:()=>Yo,$ZodSuccess:()=>Rs,$ZodStringFormat:()=>W,$ZodString:()=>ho,$ZodSet:()=>Cs,$ZodRegistry:()=>Ql,$ZodRecord:()=>bs,$ZodRealError:()=>ri,$ZodReadonly:()=>Ks,$ZodPromise:()=>Xs,$ZodPrefault:()=>Fs,$ZodPipe:()=>Vs,$ZodOptional:()=>As,$ZodObjectJIT:()=>ls,$ZodObject:()=>cs,$ZodNumberFormat:()=>Go,$ZodNumber:()=>Wo,$ZodNullable:()=>Ms,$ZodNull:()=>Zo,$ZodNonOptional:()=>Is,$ZodNever:()=>es,$ZodNanoID:()=>xo,$ZodNaN:()=>Bs,$ZodMap:()=>xs,$ZodMAC:()=>No,$ZodLiteral:()=>Es,$ZodLazy:()=>Zs,$ZodKSUID:()=>Eo,$ZodJWT:()=>Ho,$ZodIntersection:()=>hs,$ZodISOTime:()=>ko,$ZodISODuration:()=>Ao,$ZodISODateTime:()=>Do,$ZodISODate:()=>Oo,$ZodIPv6:()=>Mo,$ZodIPv4:()=>jo,$ZodGUID:()=>go,$ZodFunction:()=>Ys,$ZodFile:()=>Ds,$ZodExactOptional:()=>js,$ZodError:()=>ni,$ZodEnum:()=>Ts,$ZodEncodeError:()=>Yn,$ZodEmoji:()=>bo,$ZodEmail:()=>vo,$ZodE164:()=>Bo,$ZodDiscriminatedUnion:()=>ms,$ZodDefault:()=>Ns,$ZodDate:()=>ns,$ZodCustomStringFormat:()=>Uo,$ZodCustom:()=>Qs,$ZodCodec:()=>Us,$ZodCheckUpperCase:()=>io,$ZodCheckStringFormat:()=>to,$ZodCheckStartsWith:()=>oo,$ZodCheckSizeEquals:()=>Za,$ZodCheckRegex:()=>no,$ZodCheckProperty:()=>lo,$ZodCheckOverwrite:()=>fo,$ZodCheckNumberFormat:()=>qa,$ZodCheckMultipleOf:()=>Ka,$ZodCheckMinSize:()=>Xa,$ZodCheckMinLength:()=>$a,$ZodCheckMimeType:()=>uo,$ZodCheckMaxSize:()=>Ya,$ZodCheckMaxLength:()=>Qa,$ZodCheckLowerCase:()=>ro,$ZodCheckLessThan:()=>Wa,$ZodCheckLengthEquals:()=>eo,$ZodCheckIncludes:()=>ao,$ZodCheckGreaterThan:()=>Ga,$ZodCheckEndsWith:()=>so,$ZodCheckBigIntFormat:()=>Ja,$ZodCheck:()=>H,$ZodCatch:()=>zs,$ZodCUID2:()=>Co,$ZodCUID:()=>So,$ZodCIDRv6:()=>Fo,$ZodCIDRv4:()=>Po,$ZodBoolean:()=>Ko,$ZodBigIntFormat:()=>Jo,$ZodBigInt:()=>qo,$ZodBase64URL:()=>zo,$ZodBase64:()=>Lo,$ZodAsyncError:()=>Jn,$ZodArray:()=>is,$ZodAny:()=>Qo});var Kn=Object.freeze({status:`aborted`});function P(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var qn=Symbol(`zod_brand`),Jn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Yn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Xn={};function F(e){return e&&Object.assign(Xn,e),Xn}var I={};Wn(I,{unwrapMessage:()=>Hr,uint8ArrayToHex:()=>$r,uint8ArrayToBase64url:()=>Zr,uint8ArrayToBase64:()=>Yr,stringifyPrimitive:()=>B,slugify:()=>_r,shallowClone:()=>Sr,safeExtend:()=>Ir,required:()=>zr,randomString:()=>hr,propertyKeyTypes:()=>Tr,promiseAllObject:()=>mr,primitiveTypes:()=>Er,prefixIssues:()=>Vr,pick:()=>Nr,partial:()=>Rr,parsedType:()=>V,optionalKeys:()=>Ar,omit:()=>Pr,objectClone:()=>lr,numKeys:()=>Cr,nullish:()=>ar,normalizeParams:()=>z,mergeDefs:()=>dr,merge:()=>Lr,jsonStringifyReplacer:()=>rr,joinValues:()=>L,issue:()=>Kr,isPlainObject:()=>xr,isObject:()=>yr,hexToUint8Array:()=>Qr,getSizableOrigin:()=>Wr,getParsedType:()=>wr,getLengthableOrigin:()=>Gr,getEnumValues:()=>nr,getElementAtPath:()=>pr,floatSafeRemainder:()=>sr,finalizeIssue:()=>Ur,extend:()=>Fr,escapeRegex:()=>Dr,esc:()=>gr,defineLazy:()=>R,createTransparentProxy:()=>kr,cloneDef:()=>fr,clone:()=>Or,cleanRegex:()=>or,cleanEnum:()=>qr,captureStackTrace:()=>vr,cached:()=>ir,base64urlToUint8Array:()=>Xr,base64ToUint8Array:()=>Jr,assignProp:()=>ur,assertNotEqual:()=>Qn,assertNever:()=>er,assertIs:()=>$n,assertEqual:()=>Zn,assert:()=>tr,allowsEval:()=>br,aborted:()=>Br,NUMBER_FORMAT_RANGES:()=>jr,Class:()=>ei,BIGINT_FORMAT_RANGES:()=>Mr});function Zn(e){return e}function Qn(e){return e}function $n(e){}function er(e){throw Error(`Unexpected value in exhaustive check`)}function tr(e){}function nr(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function L(e,t=`|`){return e.map(e=>B(e)).join(t)}function rr(e,t){return typeof t==`bigint`?t.toString():t}function ir(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ar(e){return e==null}function or(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function sr(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var cr=Symbol(`evaluating`);function R(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==cr)return r===void 0&&(r=cr,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function lr(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ur(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function dr(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function fr(e){return dr(e._zod.def)}function pr(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function mr(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function hr(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function gr(e){return JSON.stringify(e)}function _r(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var vr=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function yr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var br=ir(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function xr(e){if(yr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(yr(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Sr(e){return xr(e)?{...e}:Array.isArray(e)?[...e]:e}function Cr(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var wr=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},Tr=new Set([`string`,`number`,`symbol`]),Er=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function Dr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Or(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function kr(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function B(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ar(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var jr={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Mr={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Nr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Or(e,dr(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ur(this,`shape`,e),e},checks:[]}))}function Pr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Or(e,dr(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ur(this,`shape`,r),r},checks:[]}))}function Fr(e,t){if(!xr(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Or(e,dr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ur(this,`shape`,n),n}}))}function Ir(e,t){if(!xr(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Or(e,dr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ur(this,`shape`,n),n}}))}function Lr(e,t){return Or(e,dr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ur(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Rr(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Or(t,dr(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ur(this,`shape`,i),i},checks:[]}))}function zr(e,t,n){return Or(t,dr(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ur(this,`shape`,i),i}}))}function Br(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Vr(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Hr(e){return typeof e==`string`?e:e?.message}function Ur(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Hr(e.inst?._zod.def?.error?.(e))??Hr(t?.error?.(e))??Hr(n.customError?.(e))??Hr(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,!t?.reportInput&&delete r.input,r}function Wr(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function Gr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function V(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Kr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function qr(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Jr(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function Yr(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Xr(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return Jr(t+`=`.repeat((4-t.length%4)%4))}function Zr(e){return Yr(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Qr(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function $r(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var ei=class{constructor(...e){}},ti=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,rr,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},ni=P(`$ZodError`,ti),ri=P(`$ZodError`,ti,{Parent:Error});function ii(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ai(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function oi(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a,o;for(let s of e.issues)if(s.code===`invalid_union`&&s.errors.length)s.errors.map(e=>r({issues:e},s.path));else if(s.code===`invalid_key`)r({issues:s.issues},s.path);else if(s.code===`invalid_element`)r({issues:s.issues},s.path);else{let e=[...i,...s.path];if(e.length===0){n.errors.push(t(s));continue}let r=n,c=0;for(;c<e.length;){let n=e[c],i=c===e.length-1;typeof n==`string`?(r.properties??={},(a=r.properties)[n]??(a[n]={errors:[]}),r=r.properties[n]):(r.items??=[],(o=r.items)[n]??(o[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(s)),c++}}};return r(e),n}function si(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ci(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${si(e.path)}`);return t.join(`
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./chunk-zsgVPwQN.js";import{t as a}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{n as o}from"./chunk-QWQYAQCK-BR4V0xsV.js";import{C as s,_ as c,b as l,c as u,d,f,g as p,h as m,i as h,l as g,m as _,o as v,p as y,r as b,s as x,u as ee,v as S,x as C}from"./schemas-BrqAD_Qo.js";import{t as te}from"./preload-helper-ckxxtgMM.js";function ne(e){return!!e._zod}function w(e,t){return ne(e),e.safeParse(t)}function re(e){if(!e)return;let t;if(t=ne(e)?e._zod?.def?.shape:e.shape,t){if(typeof t==`function`)try{return t()}catch{return}return t}}function ie(e){if(ne(e)){let t=e._zod?.def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let n=e.value;if(n!==void 0)return n}var ae=`2025-11-25`,oe=[ae,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],se=`io.modelcontextprotocol/related-task`,T=u(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),ce=l([S(),y().int()]),le=S();f({ttl:l([y(),h()]).optional(),pollInterval:y().optional()});var ue=_({ttl:y().optional()}),de=_({taskId:S()}),fe=f({progressToken:ce.optional(),[se]:de.optional()}),E=_({_meta:fe.optional()}),pe=E.extend({task:ue.optional()}),me=e=>pe.safeParse(e).success,D=_({method:S(),params:E.loose().optional()}),O=_({_meta:fe.optional()}),k=_({method:S(),params:O.loose().optional()}),A=f({_meta:fe.optional()}),he=l([S(),y().int()]),ge=_({jsonrpc:d(`2.0`),id:he,...D.shape}).strict(),_e=e=>ge.safeParse(e).success,ve=_({jsonrpc:d(`2.0`),...k.shape}).strict(),ye=e=>ve.safeParse(e).success,be=_({jsonrpc:d(`2.0`),id:he,result:A}).strict(),xe=e=>be.safeParse(e).success,j;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(j||={});var Se=_({jsonrpc:d(`2.0`),id:he.optional(),error:_({code:y().int(),message:S(),data:C().optional()})}).strict(),Ce=e=>Se.safeParse(e).success,we=l([ge,ve,be,Se]);l([be,Se]);var Te=A.strict(),Ee=O.extend({requestId:he.optional(),reason:S().optional()}),De=k.extend({method:d(`notifications/cancelled`),params:Ee}),Oe=_({icons:v(_({src:S(),mimeType:S().optional(),sizes:v(S()).optional(),theme:b([`light`,`dark`]).optional()})).optional()}),ke=_({name:S(),title:S().optional()}),Ae=ke.extend({...ke.shape,...Oe.shape,version:S(),websiteUrl:S().optional(),description:S().optional()}),je=p(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,ee(_({form:ee(_({applyDefaults:x().optional()}),c(S(),C())).optional(),url:T.optional()}),c(S(),C()).optional())),Me=f({list:T.optional(),cancel:T.optional(),requests:f({sampling:f({createMessage:T.optional()}).optional(),elicitation:f({create:T.optional()}).optional()}).optional()}),Ne=f({list:T.optional(),cancel:T.optional(),requests:f({tools:f({call:T.optional()}).optional()}).optional()}),Pe=_({experimental:c(S(),T).optional(),extensions:c(S(),C()).optional(),sampling:_({context:T.optional(),tools:T.optional()}).optional(),elicitation:je.optional(),roots:_({listChanged:x().optional()}).optional(),tasks:Me.optional()}),Fe=E.extend({protocolVersion:S(),capabilities:Pe,clientInfo:Ae}),Ie=D.extend({method:d(`initialize`),params:Fe}),Le=_({experimental:c(S(),T).optional(),logging:T.optional(),completions:T.optional(),prompts:_({listChanged:x().optional()}).optional(),resources:_({subscribe:x().optional(),listChanged:x().optional()}).optional(),tools:_({listChanged:x().optional()}).optional(),tasks:Ne.optional()}),Re=A.extend({protocolVersion:S(),capabilities:Le,serverInfo:Ae,instructions:S().optional()}),ze=k.extend({method:d(`notifications/initialized`),params:O.optional()}),Be=e=>ze.safeParse(e).success,Ve=D.extend({method:d(`ping`),params:E.optional()}),He=_({progress:y(),total:m(y()),message:m(S())}),Ue=_({...O.shape,...He.shape,progressToken:ce}),We=k.extend({method:d(`notifications/progress`),params:Ue}),Ge=E.extend({cursor:le.optional()}),Ke=D.extend({params:Ge.optional()}),qe=A.extend({nextCursor:le.optional()}),Je=b([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Ye=_({taskId:S(),status:Je,ttl:l([y(),h()]),createdAt:S(),lastUpdatedAt:S(),pollInterval:m(y()),statusMessage:m(S())}),Xe=A.extend({task:Ye}),Ze=O.merge(Ye),Qe=k.extend({method:d(`notifications/tasks/status`),params:Ze}),$e=D.extend({method:d(`tasks/get`),params:E.extend({taskId:S()})}),et=A.merge(Ye),tt=D.extend({method:d(`tasks/result`),params:E.extend({taskId:S()})});A.loose();var nt=Ke.extend({method:d(`tasks/list`)}),rt=qe.extend({tasks:v(Ye)}),it=D.extend({method:d(`tasks/cancel`),params:E.extend({taskId:S()})}),at=A.merge(Ye),ot=_({uri:S(),mimeType:m(S()),_meta:c(S(),C()).optional()}),st=ot.extend({text:S()}),ct=S().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),lt=ot.extend({blob:ct}),ut=b([`user`,`assistant`]),dt=_({audience:v(ut).optional(),priority:y().min(0).max(1).optional(),lastModified:s({offset:!0}).optional()}),ft=_({...ke.shape,...Oe.shape,uri:S(),description:m(S()),mimeType:m(S()),annotations:dt.optional(),_meta:m(f({}))}),pt=_({...ke.shape,...Oe.shape,uriTemplate:S(),description:m(S()),mimeType:m(S()),annotations:dt.optional(),_meta:m(f({}))}),mt=Ke.extend({method:d(`resources/list`)}),ht=qe.extend({resources:v(ft)}),gt=Ke.extend({method:d(`resources/templates/list`)}),_t=qe.extend({resourceTemplates:v(pt)}),vt=E.extend({uri:S()}),yt=vt,bt=D.extend({method:d(`resources/read`),params:yt}),xt=A.extend({contents:v(l([st,lt]))}),St=k.extend({method:d(`notifications/resources/list_changed`),params:O.optional()}),Ct=vt,wt=D.extend({method:d(`resources/subscribe`),params:Ct}),Tt=vt,Et=D.extend({method:d(`resources/unsubscribe`),params:Tt}),Dt=O.extend({uri:S()}),Ot=k.extend({method:d(`notifications/resources/updated`),params:Dt}),kt=_({name:S(),description:m(S()),required:m(x())}),At=_({...ke.shape,...Oe.shape,description:m(S()),arguments:m(v(kt)),_meta:m(f({}))}),jt=Ke.extend({method:d(`prompts/list`)}),Mt=qe.extend({prompts:v(At)}),Nt=E.extend({name:S(),arguments:c(S(),S()).optional()}),Pt=D.extend({method:d(`prompts/get`),params:Nt}),Ft=_({type:d(`text`),text:S(),annotations:dt.optional(),_meta:c(S(),C()).optional()}),It=_({type:d(`image`),data:ct,mimeType:S(),annotations:dt.optional(),_meta:c(S(),C()).optional()}),Lt=_({type:d(`audio`),data:ct,mimeType:S(),annotations:dt.optional(),_meta:c(S(),C()).optional()}),Rt=_({type:d(`tool_use`),name:S(),id:S(),input:c(S(),C()),_meta:c(S(),C()).optional()}),zt=_({type:d(`resource`),resource:l([st,lt]),annotations:dt.optional(),_meta:c(S(),C()).optional()}),Bt=l([Ft,It,Lt,ft.extend({type:d(`resource_link`)}),zt]),Vt=_({role:ut,content:Bt}),Ht=A.extend({description:S().optional(),messages:v(Vt)}),Ut=k.extend({method:d(`notifications/prompts/list_changed`),params:O.optional()}),Wt=_({title:S().optional(),readOnlyHint:x().optional(),destructiveHint:x().optional(),idempotentHint:x().optional(),openWorldHint:x().optional()}),Gt=_({taskSupport:b([`required`,`optional`,`forbidden`]).optional()}),Kt=_({...ke.shape,...Oe.shape,description:S().optional(),inputSchema:_({type:d(`object`),properties:c(S(),T).optional(),required:v(S()).optional()}).catchall(C()),outputSchema:_({type:d(`object`),properties:c(S(),T).optional(),required:v(S()).optional()}).catchall(C()).optional(),annotations:Wt.optional(),execution:Gt.optional(),_meta:c(S(),C()).optional()}),qt=Ke.extend({method:d(`tools/list`)}),Jt=qe.extend({tools:v(Kt)}),Yt=A.extend({content:v(Bt).default([]),structuredContent:c(S(),C()).optional(),isError:x().optional()});Yt.or(A.extend({toolResult:C()}));var Xt=pe.extend({name:S(),arguments:c(S(),C()).optional()}),Zt=D.extend({method:d(`tools/call`),params:Xt}),Qt=k.extend({method:d(`notifications/tools/list_changed`),params:O.optional()}),$t=_({autoRefresh:x().default(!0),debounceMs:y().int().nonnegative().default(300)}),en=b([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),tn=E.extend({level:en}),nn=D.extend({method:d(`logging/setLevel`),params:tn}),rn=O.extend({level:en,logger:S().optional(),data:C()}),an=k.extend({method:d(`notifications/message`),params:rn}),on=_({hints:v(_({name:S().optional()})).optional(),costPriority:y().min(0).max(1).optional(),speedPriority:y().min(0).max(1).optional(),intelligencePriority:y().min(0).max(1).optional()}),sn=_({mode:b([`auto`,`required`,`none`]).optional()}),cn=_({type:d(`tool_result`),toolUseId:S().describe(`The unique identifier for the corresponding tool call.`),content:v(Bt).default([]),structuredContent:_({}).loose().optional(),isError:x().optional(),_meta:c(S(),C()).optional()}),ln=g(`type`,[Ft,It,Lt]),un=g(`type`,[Ft,It,Lt,Rt,cn]),dn=_({role:ut,content:l([un,v(un)]),_meta:c(S(),C()).optional()}),fn=pe.extend({messages:v(dn),modelPreferences:on.optional(),systemPrompt:S().optional(),includeContext:b([`none`,`thisServer`,`allServers`]).optional(),temperature:y().optional(),maxTokens:y().int(),stopSequences:v(S()).optional(),metadata:T.optional(),tools:v(Kt).optional(),toolChoice:sn.optional()}),pn=D.extend({method:d(`sampling/createMessage`),params:fn}),mn=A.extend({model:S(),stopReason:m(b([`endTurn`,`stopSequence`,`maxTokens`]).or(S())),role:ut,content:ln}),hn=A.extend({model:S(),stopReason:m(b([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(S())),role:ut,content:l([un,v(un)])}),gn=_({type:d(`boolean`),title:S().optional(),description:S().optional(),default:x().optional()}),_n=_({type:d(`string`),title:S().optional(),description:S().optional(),minLength:y().optional(),maxLength:y().optional(),format:b([`email`,`uri`,`date`,`date-time`]).optional(),default:S().optional()}),vn=_({type:b([`number`,`integer`]),title:S().optional(),description:S().optional(),minimum:y().optional(),maximum:y().optional(),default:y().optional()}),yn=_({type:d(`string`),title:S().optional(),description:S().optional(),enum:v(S()),default:S().optional()}),bn=_({type:d(`string`),title:S().optional(),description:S().optional(),oneOf:v(_({const:S(),title:S()})),default:S().optional()}),xn=l([l([_({type:d(`string`),title:S().optional(),description:S().optional(),enum:v(S()),enumNames:v(S()).optional(),default:S().optional()}),l([yn,bn]),l([_({type:d(`array`),title:S().optional(),description:S().optional(),minItems:y().optional(),maxItems:y().optional(),items:_({type:d(`string`),enum:v(S())}),default:v(S()).optional()}),_({type:d(`array`),title:S().optional(),description:S().optional(),minItems:y().optional(),maxItems:y().optional(),items:_({anyOf:v(_({const:S(),title:S()}))}),default:v(S()).optional()})])]),gn,_n,vn]),Sn=l([pe.extend({mode:d(`form`).optional(),message:S(),requestedSchema:_({type:d(`object`),properties:c(S(),xn),required:v(S()).optional()})}),pe.extend({mode:d(`url`),message:S(),elicitationId:S(),url:S().url()})]),Cn=D.extend({method:d(`elicitation/create`),params:Sn}),wn=O.extend({elicitationId:S()}),Tn=k.extend({method:d(`notifications/elicitation/complete`),params:wn}),En=A.extend({action:b([`accept`,`decline`,`cancel`]),content:p(e=>e===null?void 0:e,c(S(),l([S(),y(),x(),v(S())])).optional())}),Dn=_({type:d(`ref/resource`),uri:S()}),On=_({type:d(`ref/prompt`),name:S()}),kn=E.extend({ref:l([On,Dn]),argument:_({name:S(),value:S()}),context:_({arguments:c(S(),S()).optional()}).optional()}),An=D.extend({method:d(`completion/complete`),params:kn}),jn=A.extend({completion:f({values:v(S()).max(100),total:m(y().int()),hasMore:m(x())})}),Mn=_({uri:S().startsWith(`file://`),name:S().optional(),_meta:c(S(),C()).optional()}),Nn=D.extend({method:d(`roots/list`),params:E.optional()}),Pn=A.extend({roots:v(Mn)}),Fn=k.extend({method:d(`notifications/roots/list_changed`),params:O.optional()});l([Ve,Ie,An,nn,Pt,jt,mt,gt,bt,wt,Et,Zt,qt,$e,tt,nt,it]),l([De,We,ze,Fn,Qe]),l([Te,mn,hn,En,Pn,et,rt,Xe]),l([Ve,pn,Cn,Nn,$e,tt,nt,it]),l([De,We,an,Ot,St,Qt,Ut,Qe,Tn]),l([Te,Re,jn,Ht,Mt,ht,_t,xt,Yt,Jt,et,rt,Xe]);var M=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===j.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new In(e.elicitations,n)}return new e(t,n,r)}},In=class extends M{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(j.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}};function Ln(e){return e===`completed`||e===`failed`||e===`cancelled`}function Rn(e){let t=re(e)?.method;if(!t)throw Error(`Schema is missing a method literal`);let n=ie(t);if(typeof n!=`string`)throw Error(`Schema method literal must be a string`);return n}function zn(e,t){let n=w(e,t);if(!n.success)throw n.error;return n.data}var Bn=class{constructor(e){this._options=e,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(De,e=>{this._oncancel(e)}),this.setNotificationHandler(We,e=>{this._onprogress(e)}),this.setRequestHandler(Ve,e=>({})),this._taskStore=e?.taskStore,this._taskMessageQueue=e?.taskMessageQueue,this._taskStore&&(this.setRequestHandler($e,async(e,t)=>{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new M(j.InvalidParams,`Failed to retrieve task: Task not found`);return{...n}}),this.setRequestHandler(tt,async(e,t)=>{let n=async()=>{let r=e.params.taskId;if(this._taskMessageQueue){let e;for(;e=await this._taskMessageQueue.dequeue(r,t.sessionId);){if(e.type===`response`||e.type===`error`){let t=e.message,n=t.id,r=this._requestResolvers.get(n);if(r)if(this._requestResolvers.delete(n),e.type===`response`)r(t);else{let e=t;r(new M(e.error.code,e.error.message,e.error.data))}else{let t=e.type===`response`?`Response`:`Error`;this._onerror(Error(`${t} handler missing for request ${n}`))}continue}await this._transport?.send(e.message,{relatedRequestId:t.requestId})}}let i=await this._taskStore.getTask(r,t.sessionId);if(!i)throw new M(j.InvalidParams,`Task not found: ${r}`);if(!Ln(i.status))return await this._waitForTaskUpdate(r,t.signal),await n();if(Ln(i.status)){let e=await this._taskStore.getTaskResult(r,t.sessionId);return this._clearTaskQueue(r),{...e,_meta:{...e._meta,[se]:{taskId:r}}}}return await n()};return await n()}),this.setRequestHandler(nt,async(e,t)=>{try{let{tasks:n,nextCursor:r}=await this._taskStore.listTasks(e.params?.cursor,t.sessionId);return{tasks:n,nextCursor:r,_meta:{}}}catch(e){throw new M(j.InvalidParams,`Failed to list tasks: ${e instanceof Error?e.message:String(e)}`)}}),this.setRequestHandler(it,async(e,t)=>{try{let n=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!n)throw new M(j.InvalidParams,`Task not found: ${e.params.taskId}`);if(Ln(n.status))throw new M(j.InvalidParams,`Cannot cancel task in terminal status: ${n.status}`);await this._taskStore.updateTaskStatus(e.params.taskId,`cancelled`,`Client cancelled task execution.`,t.sessionId),this._clearTaskQueue(e.params.taskId);let r=await this._taskStore.getTask(e.params.taskId,t.sessionId);if(!r)throw new M(j.InvalidParams,`Task not found after cancellation: ${e.params.taskId}`);return{_meta:{},...r}}catch(e){throw e instanceof M?e:new M(j.InvalidRequest,`Failed to cancel task: ${e instanceof Error?e.message:String(e)}`)}}))}async _oncancel(e){e.params.requestId&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,n,r,i=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(r,t),startTime:Date.now(),timeout:t,maxTotalTimeout:n,resetTimeoutOnProgress:i,onTimeout:r})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let n=Date.now()-t.startTime;if(t.maxTotalTimeout&&n>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),M.fromError(j.RequestTimeout,`Maximum total timeout exceeded`,{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:n});return clearTimeout(t.timeoutId),t.timeoutId=setTimeout(t.onTimeout,t.timeout),!0}_cleanupTimeout(e){let t=this._timeoutInfo.get(e);t&&(clearTimeout(t.timeoutId),this._timeoutInfo.delete(e))}async connect(e){if(this._transport)throw Error(`Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.`);this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{t?.(),this._onclose()};let n=this.transport?.onerror;this._transport.onerror=e=>{n?.(e),this._onerror(e)};let r=this._transport?.onmessage;this._transport.onmessage=(e,t)=>{r?.(e,t),xe(e)||Ce(e)?this._onresponse(e):_e(e)?this._onrequest(e,t):ye(e)?this._onnotification(e):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._requestHandlerAbortControllers.values())e.abort();this._requestHandlerAbortControllers.clear();let t=M.fromError(j.ConnectionClosed,`Connection closed`);this._transport=void 0,this.onclose?.();for(let n of e.values())n(t)}_onerror(e){this.onerror?.(e)}_onnotification(e){let t=this._notificationHandlers.get(e.method)??this.fallbackNotificationHandler;t!==void 0&&Promise.resolve().then(()=>t(e)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let n=this._requestHandlers.get(e.method)??this.fallbackRequestHandler,r=this._transport,i=e.params?._meta?.[se]?.taskId;if(n===void 0){let t={jsonrpc:`2.0`,id:e.id,error:{code:j.MethodNotFound,message:`Method not found`}};i&&this._taskMessageQueue?this._enqueueTaskMessage(i,{type:`error`,message:t,timestamp:Date.now()},r?.sessionId).catch(e=>this._onerror(Error(`Failed to enqueue error response: ${e}`))):r?.send(t).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)));return}let a=new AbortController;this._requestHandlerAbortControllers.set(e.id,a);let o=me(e.params)?e.params.task:void 0,s=this._taskStore?this.requestTaskStore(e,r?.sessionId):void 0,c={signal:a.signal,sessionId:r?.sessionId,_meta:e.params?._meta,sendNotification:async t=>{if(a.signal.aborted)return;let n={relatedRequestId:e.id};i&&(n.relatedTask={taskId:i}),await this.notification(t,n)},sendRequest:async(t,n,r)=>{if(a.signal.aborted)throw new M(j.ConnectionClosed,`Request was cancelled`);let o={...r,relatedRequestId:e.id};i&&!o.relatedTask&&(o.relatedTask={taskId:i});let c=o.relatedTask?.taskId??i;return c&&s&&await s.updateTaskStatus(c,`input_required`),await this.request(t,n,o)},authInfo:t?.authInfo,requestId:e.id,requestInfo:t?.requestInfo,taskId:i,taskStore:s,taskRequestedTtl:o?.ttl,closeSSEStream:t?.closeSSEStream,closeStandaloneSSEStream:t?.closeStandaloneSSEStream};Promise.resolve().then(()=>{o&&this.assertTaskHandlerCapability(e.method)}).then(()=>n(e,c)).then(async t=>{if(a.signal.aborted)return;let n={result:t,jsonrpc:`2.0`,id:e.id};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`response`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)},async t=>{if(a.signal.aborted)return;let n={jsonrpc:`2.0`,id:e.id,error:{code:Number.isSafeInteger(t.code)?t.code:j.InternalError,message:t.message??`Internal error`,...t.data!==void 0&&{data:t.data}}};i&&this._taskMessageQueue?await this._enqueueTaskMessage(i,{type:`error`,message:n,timestamp:Date.now()},r?.sessionId):await r?.send(n)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.delete(e.id)})}_onprogress(e){let{progressToken:t,...n}=e.params,r=Number(t),i=this._progressHandlers.get(r);if(!i){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let a=this._responseHandlers.get(r),o=this._timeoutInfo.get(r);if(o&&a&&o.resetTimeoutOnProgress)try{this._resetTimeout(r)}catch(e){this._responseHandlers.delete(r),this._progressHandlers.delete(r),this._cleanupTimeout(r),a(e);return}i(n)}_onresponse(e){let t=Number(e.id),n=this._requestResolvers.get(t);if(n){this._requestResolvers.delete(t),xe(e)?n(e):n(new M(e.error.code,e.error.message,e.error.data));return}let r=this._responseHandlers.get(t);if(r===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t);let i=!1;if(xe(e)&&e.result&&typeof e.result==`object`){let n=e.result;if(n.task&&typeof n.task==`object`){let e=n.task;typeof e.taskId==`string`&&(i=!0,this._taskProgressTokens.set(e.taskId,t))}}i||this._progressHandlers.delete(t),xe(e)?r(e):r(M.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(e,t,n){let{task:r}=n??{};if(!r){try{yield{type:`result`,result:await this.request(e,t,n)}}catch(e){yield{type:`error`,error:e instanceof M?e:new M(j.InternalError,String(e))}}return}let i;try{let r=await this.request(e,Xe,n);if(r.task)i=r.task.taskId,yield{type:`taskCreated`,task:r.task};else throw new M(j.InternalError,`Task creation did not return a task`);for(;;){let e=await this.getTask({taskId:i},n);if(yield{type:`taskStatus`,task:e},Ln(e.status)){e.status===`completed`?yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)}:e.status===`failed`?yield{type:`error`,error:new M(j.InternalError,`Task ${i} failed`)}:e.status===`cancelled`&&(yield{type:`error`,error:new M(j.InternalError,`Task ${i} was cancelled`)});return}if(e.status===`input_required`){yield{type:`result`,result:await this.getTaskResult({taskId:i},t,n)};return}let r=e.pollInterval??this._options?.defaultTaskPollInterval??1e3;await new Promise(e=>setTimeout(e,r)),n?.signal?.throwIfAborted()}}catch(e){yield{type:`error`,error:e instanceof M?e:new M(j.InternalError,String(e))}}}request(e,t,n){let{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a,task:o,relatedTask:s}=n??{};return new Promise((c,l)=>{let u=e=>{l(e)};if(!this._transport){u(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(e.method),o&&this.assertTaskCapability(e.method)}catch(e){u(e);return}n?.signal?.throwIfAborted();let d=this._requestMessageId++,f={...e,jsonrpc:`2.0`,id:d};n?.onprogress&&(this._progressHandlers.set(d,n.onprogress),f.params={...e.params,_meta:{...e.params?._meta||{},progressToken:d}}),o&&(f.params={...f.params,task:o}),s&&(f.params={...f.params,_meta:{...f.params?._meta||{},[se]:s}});let p=e=>{this._responseHandlers.delete(d),this._progressHandlers.delete(d),this._cleanupTimeout(d),this._transport?.send({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:d,reason:String(e)}},{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))),l(e instanceof M?e:new M(j.RequestTimeout,String(e)))};this._responseHandlers.set(d,e=>{if(!n?.signal?.aborted){if(e instanceof Error)return l(e);try{let n=w(t,e.result);n.success?c(n.data):l(n.error)}catch(e){l(e)}}}),n?.signal?.addEventListener(`abort`,()=>{p(n?.signal?.reason)});let m=n?.timeout??6e4;this._setupTimeout(d,m,n?.maxTotalTimeout,()=>p(M.fromError(j.RequestTimeout,`Request timed out`,{timeout:m})),n?.resetTimeoutOnProgress??!1);let h=s?.taskId;h?(this._requestResolvers.set(d,e=>{let t=this._responseHandlers.get(d);t?t(e):this._onerror(Error(`Response handler missing for side-channeled request ${d}`))}),this._enqueueTaskMessage(h,{type:`request`,message:f,timestamp:Date.now()}).catch(e=>{this._cleanupTimeout(d),l(e)})):this._transport.send(f,{relatedRequestId:r,resumptionToken:i,onresumptiontoken:a}).catch(e=>{this._cleanupTimeout(d),l(e)})})}async getTask(e,t){return this.request({method:`tasks/get`,params:e},et,t)}async getTaskResult(e,t,n){return this.request({method:`tasks/result`,params:e},t,n)}async listTasks(e,t){return this.request({method:`tasks/list`,params:e},rt,t)}async cancelTask(e,t){return this.request({method:`tasks/cancel`,params:e},at,t)}async notification(e,t){if(!this._transport)throw Error(`Not connected`);this.assertNotificationCapability(e.method);let n=t?.relatedTask?.taskId;if(n){let r={...e,jsonrpc:`2.0`,params:{...e.params,_meta:{...e.params?._meta||{},[se]:t.relatedTask}}};await this._enqueueTaskMessage(n,{type:`notification`,message:r,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(e.method)&&!e.params&&!t?.relatedRequestId&&!t?.relatedTask){if(this._pendingDebouncedNotifications.has(e.method))return;this._pendingDebouncedNotifications.add(e.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(e.method),!this._transport)return;let n={...e,jsonrpc:`2.0`};t?.relatedTask&&(n={...n,params:{...n.params,_meta:{...n.params?._meta||{},[se]:t.relatedTask}}}),this._transport?.send(n,t).catch(e=>this._onerror(e))});return}let r={...e,jsonrpc:`2.0`};t?.relatedTask&&(r={...r,params:{...r.params,_meta:{...r.params?._meta||{},[se]:t.relatedTask}}}),await this._transport.send(r,t)}setRequestHandler(e,t){let n=Rn(e);this.assertRequestHandlerCapability(n),this._requestHandlers.set(n,(n,r)=>{let i=zn(e,n);return Promise.resolve(t(i,r))})}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t){let n=Rn(e);this._notificationHandlers.set(n,n=>{let r=zn(e,n);return Promise.resolve(t(r))})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}_cleanupTaskProgressHandler(e){let t=this._taskProgressTokens.get(e);t!==void 0&&(this._progressHandlers.delete(t),this._taskProgressTokens.delete(e))}async _enqueueTaskMessage(e,t,n){if(!this._taskStore||!this._taskMessageQueue)throw Error(`Cannot enqueue task message: taskStore and taskMessageQueue are not configured`);let r=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(e,t,n,r)}async _clearTaskQueue(e,t){if(this._taskMessageQueue){let n=await this._taskMessageQueue.dequeueAll(e,t);for(let t of n)if(t.type===`request`&&_e(t.message)){let n=t.message.id,r=this._requestResolvers.get(n);r?(r(new M(j.InternalError,`Task cancelled or completed`)),this._requestResolvers.delete(n)):this._onerror(Error(`Resolver missing for request ${n} during task ${e} cleanup`))}}}async _waitForTaskUpdate(e,t){let n=this._options?.defaultTaskPollInterval??1e3;try{let t=await this._taskStore?.getTask(e);t?.pollInterval&&(n=t.pollInterval)}catch{}return new Promise((e,r)=>{if(t.aborted){r(new M(j.InvalidRequest,`Request cancelled`));return}let i=setTimeout(e,n);t.addEventListener(`abort`,()=>{clearTimeout(i),r(new M(j.InvalidRequest,`Request cancelled`))},{once:!0})})}requestTaskStore(e,t){let n=this._taskStore;if(!n)throw Error(`No task store configured`);return{createTask:async r=>{if(!e)throw Error(`No request provided`);return await n.createTask(r,e.id,{method:e.method,params:e.params},t)},getTask:async e=>{let r=await n.getTask(e,t);if(!r)throw new M(j.InvalidParams,`Failed to retrieve task: Task not found`);return r},storeTaskResult:async(e,r,i)=>{await n.storeTaskResult(e,r,i,t);let a=await n.getTask(e,t);if(a){let t=Qe.parse({method:`notifications/tasks/status`,params:a});await this.notification(t),Ln(a.status)&&this._cleanupTaskProgressHandler(e)}},getTaskResult:e=>n.getTaskResult(e,t),updateTaskStatus:async(e,r,i)=>{let a=await n.getTask(e,t);if(!a)throw new M(j.InvalidParams,`Task "${e}" not found - it may have been cleaned up`);if(Ln(a.status))throw new M(j.InvalidParams,`Cannot update task "${e}" from terminal status "${a.status}" to "${r}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await n.updateTaskStatus(e,r,i,t);let o=await n.getTask(e,t);if(o){let t=Qe.parse({method:`notifications/tasks/status`,params:o});await this.notification(t),Ln(o.status)&&this._cleanupTaskProgressHandler(e)}},listTasks:e=>n.listTasks(e,t)}}};function Vn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hn(e,t){let n={...e};for(let e in t){let r=e,i=t[r];if(i===void 0)continue;let a=n[r];Vn(a)&&Vn(i)?n[r]={...a,...i}:n[r]=i}return n}var Un=Object.defineProperty,Wn=(e,t)=>{for(var n in t)Un(e,n,{get:t[n],enumerable:!0,configurable:!0,set:e=>t[n]=()=>e})},N={};Wn(N,{xor:()=>mh,xid:()=>tm,void:()=>th,uuidv7:()=>Bp,uuidv6:()=>zp,uuidv4:()=>Rp,uuid:()=>Lp,util:()=>I,url:()=>Hp,uppercase:()=>gd,unknown:()=>Zm,union:()=>fh,undefined:()=>Gm,ulid:()=>$p,uint64:()=>Vm,uint32:()=>Pm,tuple:()=>bh,trim:()=>wd,treeifyError:()=>oi,transform:()=>Lh,toUpperCase:()=>Ed,toLowerCase:()=>Td,toJSONSchema:()=>ep,templateLiteral:()=>ug,symbol:()=>Um,superRefine:()=>xg,success:()=>Qh,stringbool:()=>Tg,stringFormat:()=>Cm,string:()=>jp,strictObject:()=>lh,startsWith:()=>vd,slugify:()=>Dd,size:()=>ud,setErrorMap:()=>kg,set:()=>Oh,safeParseAsync:()=>bp,safeParse:()=>yp,safeEncodeAsync:()=>Dp,safeEncode:()=>Tp,safeDecodeAsync:()=>Op,safeDecode:()=>Ep,registry:()=>$l,regexes:()=>Ni,regex:()=>md,refine:()=>bg,record:()=>Sh,readonly:()=>cg,property:()=>bd,promise:()=>mg,prettifyError:()=>ci,preprocess:()=>Dg,prefault:()=>Jh,positive:()=>rd,pipe:()=>ig,partialRecord:()=>Ch,parseAsync:()=>vp,parse:()=>_p,overwrite:()=>Sd,optional:()=>zh,object:()=>ch,number:()=>Om,nullish:()=>Wh,nullable:()=>Uh,null:()=>qm,normalize:()=>Cd,nonpositive:()=>ad,nonoptional:()=>Xh,nonnegative:()=>od,never:()=>$m,negative:()=>id,nativeEnum:()=>jh,nanoid:()=>qp,nan:()=>ng,multipleOf:()=>sd,minSize:()=>ld,minLength:()=>fd,mime:()=>xd,meta:()=>Cg,maxSize:()=>cd,maxLength:()=>dd,map:()=>Eh,mac:()=>sm,lte:()=>td,lt:()=>ed,lowercase:()=>hd,looseRecord:()=>wh,looseObject:()=>uh,locales:()=>ec,literal:()=>Nh,length:()=>pd,lazy:()=>fg,ksuid:()=>rm,keyof:()=>oh,jwt:()=>xm,json:()=>Eg,iso:()=>ap,ipv6:()=>lm,ipv4:()=>am,intersection:()=>vh,int64:()=>Bm,int32:()=>Nm,int:()=>Am,instanceof:()=>wg,includes:()=>_d,httpUrl:()=>Up,hostname:()=>wm,hex:()=>Tm,hash:()=>Em,guid:()=>Fp,gte:()=>G,gt:()=>nd,globalRegistry:()=>eu,getErrorMap:()=>Ag,function:()=>gg,fromJSONSchema:()=>Ig,formatError:()=>ai,float64:()=>Mm,float32:()=>jm,flattenError:()=>ii,file:()=>Fh,exactOptional:()=>Vh,enum:()=>Ah,endsWith:()=>yd,encodeAsync:()=>Cp,encode:()=>xp,emoji:()=>Gp,email:()=>Np,e164:()=>ym,discriminatedUnion:()=>gh,describe:()=>Sg,decodeAsync:()=>wp,decode:()=>Sp,date:()=>rh,custom:()=>yg,cuid2:()=>Zp,cuid:()=>Yp,core:()=>Gn,config:()=>F,coerce:()=>Lg,codec:()=>og,clone:()=>Or,cidrv6:()=>pm,cidrv4:()=>dm,check:()=>vg,catch:()=>eg,boolean:()=>Im,bigint:()=>Rm,base64url:()=>_m,base64:()=>hm,array:()=>ah,any:()=>Ym,_function:()=>gg,_default:()=>Kh,_ZodString:()=>kp,ZodXor:()=>ph,ZodXID:()=>em,ZodVoid:()=>eh,ZodUnknown:()=>Xm,ZodUnion:()=>dh,ZodUndefined:()=>Wm,ZodUUID:()=>Ip,ZodURL:()=>Vp,ZodULID:()=>Qp,ZodType:()=>J,ZodTuple:()=>yh,ZodTransform:()=>Ih,ZodTemplateLiteral:()=>lg,ZodSymbol:()=>Hm,ZodSuccess:()=>Zh,ZodStringFormat:()=>Y,ZodString:()=>Ap,ZodSet:()=>Dh,ZodRecord:()=>xh,ZodRealError:()=>gp,ZodReadonly:()=>sg,ZodPromise:()=>pg,ZodPrefault:()=>qh,ZodPipe:()=>rg,ZodOptional:()=>Rh,ZodObject:()=>sh,ZodNumberFormat:()=>km,ZodNumber:()=>Dm,ZodNullable:()=>Hh,ZodNull:()=>Km,ZodNonOptional:()=>Yh,ZodNever:()=>Qm,ZodNanoID:()=>Kp,ZodNaN:()=>tg,ZodMap:()=>Th,ZodMAC:()=>om,ZodLiteral:()=>Mh,ZodLazy:()=>dg,ZodKSUID:()=>nm,ZodJWT:()=>bm,ZodIssueCode:()=>Og,ZodIntersection:()=>_h,ZodISOTime:()=>up,ZodISODuration:()=>fp,ZodISODateTime:()=>op,ZodISODate:()=>cp,ZodIPv6:()=>cm,ZodIPv4:()=>im,ZodGUID:()=>Pp,ZodFunction:()=>hg,ZodFirstPartyTypeKind:()=>jg,ZodFile:()=>Ph,ZodExactOptional:()=>Bh,ZodError:()=>hp,ZodEnum:()=>kh,ZodEmoji:()=>Wp,ZodEmail:()=>Mp,ZodE164:()=>vm,ZodDiscriminatedUnion:()=>hh,ZodDefault:()=>Gh,ZodDate:()=>nh,ZodCustomStringFormat:()=>Sm,ZodCustom:()=>_g,ZodCodec:()=>ag,ZodCatch:()=>$h,ZodCUID2:()=>Xp,ZodCUID:()=>Jp,ZodCIDRv6:()=>fm,ZodCIDRv4:()=>um,ZodBoolean:()=>Fm,ZodBigIntFormat:()=>zm,ZodBigInt:()=>Lm,ZodBase64URL:()=>gm,ZodBase64:()=>mm,ZodArray:()=>ih,ZodAny:()=>Jm,TimePrecision:()=>Eu,NEVER:()=>Kn,$output:()=>Xl,$input:()=>Zl,$brand:()=>qn});var Gn={};Wn(Gn,{version:()=>mo,util:()=>I,treeifyError:()=>oi,toJSONSchema:()=>ep,toDotPath:()=>si,safeParseAsync:()=>gi,safeParse:()=>mi,safeEncodeAsync:()=>Ai,safeEncode:()=>Ei,safeDecodeAsync:()=>Mi,safeDecode:()=>Oi,registry:()=>$l,regexes:()=>Ni,process:()=>K,prettifyError:()=>ci,parseAsync:()=>fi,parse:()=>ui,meta:()=>af,locales:()=>ec,isValidJWT:()=>Vo,isValidBase64URL:()=>Ro,isValidBase64:()=>Io,initializeContext:()=>cf,globalRegistry:()=>eu,globalConfig:()=>Xn,formatError:()=>ai,flattenError:()=>ii,finalize:()=>uf,extractDefs:()=>lf,encodeAsync:()=>Si,encode:()=>vi,describe:()=>rf,decodeAsync:()=>wi,decode:()=>bi,createToJSONSchemaMethod:()=>df,createStandardJSONSchemaMethod:()=>ff,config:()=>F,clone:()=>Or,_xor:()=>Ad,_xid:()=>hu,_void:()=>Xu,_uuidv7:()=>cu,_uuidv6:()=>su,_uuidv4:()=>ou,_uuid:()=>au,_url:()=>lu,_uppercase:()=>gd,_unknown:()=>Ju,_union:()=>kd,_undefined:()=>Gu,_ulid:()=>mu,_uint64:()=>Uu,_uint32:()=>Lu,_tuple:()=>Nd,_trim:()=>wd,_transform:()=>Vd,_toUpperCase:()=>Ed,_toLowerCase:()=>Td,_templateLiteral:()=>Xd,_symbol:()=>Wu,_superRefine:()=>tf,_success:()=>Kd,_stringbool:()=>of,_stringFormat:()=>sf,_string:()=>tu,_startsWith:()=>vd,_slugify:()=>Dd,_size:()=>ud,_set:()=>Id,_safeParseAsync:()=>hi,_safeParse:()=>pi,_safeEncodeAsync:()=>ki,_safeEncode:()=>Ti,_safeDecodeAsync:()=>ji,_safeDecode:()=>Di,_regex:()=>md,_refine:()=>ef,_record:()=>Pd,_readonly:()=>Yd,_property:()=>bd,_promise:()=>Qd,_positive:()=>rd,_pipe:()=>Jd,_parseAsync:()=>di,_parse:()=>li,_overwrite:()=>Sd,_optional:()=>Hd,_number:()=>ju,_nullable:()=>Ud,_null:()=>Ku,_normalize:()=>Cd,_nonpositive:()=>ad,_nonoptional:()=>Gd,_nonnegative:()=>od,_never:()=>Yu,_negative:()=>id,_nativeEnum:()=>Rd,_nanoid:()=>du,_nan:()=>$u,_multipleOf:()=>sd,_minSize:()=>ld,_minLength:()=>fd,_min:()=>G,_mime:()=>xd,_maxSize:()=>cd,_maxLength:()=>dd,_max:()=>td,_map:()=>Fd,_mac:()=>yu,_lte:()=>td,_lt:()=>ed,_lowercase:()=>hd,_literal:()=>zd,_length:()=>pd,_lazy:()=>Zd,_ksuid:()=>gu,_jwt:()=>Tu,_isoTime:()=>ku,_isoDuration:()=>Au,_isoDateTime:()=>Du,_isoDate:()=>Ou,_ipv6:()=>vu,_ipv4:()=>_u,_intersection:()=>Md,_int64:()=>Hu,_int32:()=>Iu,_int:()=>Nu,_includes:()=>_d,_guid:()=>iu,_gte:()=>G,_gt:()=>nd,_float64:()=>Fu,_float32:()=>Pu,_file:()=>Bd,_enum:()=>Ld,_endsWith:()=>yd,_encodeAsync:()=>xi,_encode:()=>_i,_emoji:()=>uu,_email:()=>ru,_e164:()=>wu,_discriminatedUnion:()=>jd,_default:()=>Wd,_decodeAsync:()=>Ci,_decode:()=>yi,_date:()=>Zu,_custom:()=>$d,_cuid2:()=>pu,_cuid:()=>fu,_coercedString:()=>nu,_coercedNumber:()=>Mu,_coercedDate:()=>Qu,_coercedBoolean:()=>zu,_coercedBigint:()=>Vu,_cidrv6:()=>xu,_cidrv4:()=>bu,_check:()=>nf,_catch:()=>qd,_boolean:()=>Ru,_bigint:()=>Bu,_base64url:()=>Cu,_base64:()=>Su,_array:()=>Od,_any:()=>qu,TimePrecision:()=>Eu,NEVER:()=>Kn,JSONSchemaGenerator:()=>tp,JSONSchema:()=>np,Doc:()=>po,$output:()=>Xl,$input:()=>Zl,$constructor:()=>P,$brand:()=>qn,$ZodXor:()=>ps,$ZodXID:()=>To,$ZodVoid:()=>ts,$ZodUnknown:()=>$o,$ZodUnion:()=>ds,$ZodUndefined:()=>Xo,$ZodUUID:()=>_o,$ZodURL:()=>yo,$ZodULID:()=>wo,$ZodType:()=>U,$ZodTuple:()=>vs,$ZodTransform:()=>Os,$ZodTemplateLiteral:()=>Js,$ZodSymbol:()=>Yo,$ZodSuccess:()=>Rs,$ZodStringFormat:()=>W,$ZodString:()=>ho,$ZodSet:()=>Cs,$ZodRegistry:()=>Ql,$ZodRecord:()=>bs,$ZodRealError:()=>ri,$ZodReadonly:()=>Ks,$ZodPromise:()=>Xs,$ZodPrefault:()=>Fs,$ZodPipe:()=>Vs,$ZodOptional:()=>As,$ZodObjectJIT:()=>ls,$ZodObject:()=>cs,$ZodNumberFormat:()=>Go,$ZodNumber:()=>Wo,$ZodNullable:()=>Ms,$ZodNull:()=>Zo,$ZodNonOptional:()=>Is,$ZodNever:()=>es,$ZodNanoID:()=>xo,$ZodNaN:()=>Bs,$ZodMap:()=>xs,$ZodMAC:()=>No,$ZodLiteral:()=>Es,$ZodLazy:()=>Zs,$ZodKSUID:()=>Eo,$ZodJWT:()=>Ho,$ZodIntersection:()=>hs,$ZodISOTime:()=>ko,$ZodISODuration:()=>Ao,$ZodISODateTime:()=>Do,$ZodISODate:()=>Oo,$ZodIPv6:()=>Mo,$ZodIPv4:()=>jo,$ZodGUID:()=>go,$ZodFunction:()=>Ys,$ZodFile:()=>Ds,$ZodExactOptional:()=>js,$ZodError:()=>ni,$ZodEnum:()=>Ts,$ZodEncodeError:()=>Yn,$ZodEmoji:()=>bo,$ZodEmail:()=>vo,$ZodE164:()=>Bo,$ZodDiscriminatedUnion:()=>ms,$ZodDefault:()=>Ns,$ZodDate:()=>ns,$ZodCustomStringFormat:()=>Uo,$ZodCustom:()=>Qs,$ZodCodec:()=>Us,$ZodCheckUpperCase:()=>io,$ZodCheckStringFormat:()=>to,$ZodCheckStartsWith:()=>oo,$ZodCheckSizeEquals:()=>Za,$ZodCheckRegex:()=>no,$ZodCheckProperty:()=>lo,$ZodCheckOverwrite:()=>fo,$ZodCheckNumberFormat:()=>qa,$ZodCheckMultipleOf:()=>Ka,$ZodCheckMinSize:()=>Xa,$ZodCheckMinLength:()=>$a,$ZodCheckMimeType:()=>uo,$ZodCheckMaxSize:()=>Ya,$ZodCheckMaxLength:()=>Qa,$ZodCheckLowerCase:()=>ro,$ZodCheckLessThan:()=>Wa,$ZodCheckLengthEquals:()=>eo,$ZodCheckIncludes:()=>ao,$ZodCheckGreaterThan:()=>Ga,$ZodCheckEndsWith:()=>so,$ZodCheckBigIntFormat:()=>Ja,$ZodCheck:()=>H,$ZodCatch:()=>zs,$ZodCUID2:()=>Co,$ZodCUID:()=>So,$ZodCIDRv6:()=>Fo,$ZodCIDRv4:()=>Po,$ZodBoolean:()=>Ko,$ZodBigIntFormat:()=>Jo,$ZodBigInt:()=>qo,$ZodBase64URL:()=>zo,$ZodBase64:()=>Lo,$ZodAsyncError:()=>Jn,$ZodArray:()=>is,$ZodAny:()=>Qo});var Kn=Object.freeze({status:`aborted`});function P(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,`_zod`,{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var qn=Symbol(`zod_brand`),Jn=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Yn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},Xn={};function F(e){return e&&Object.assign(Xn,e),Xn}var I={};Wn(I,{unwrapMessage:()=>Hr,uint8ArrayToHex:()=>$r,uint8ArrayToBase64url:()=>Zr,uint8ArrayToBase64:()=>Yr,stringifyPrimitive:()=>B,slugify:()=>_r,shallowClone:()=>Sr,safeExtend:()=>Ir,required:()=>zr,randomString:()=>hr,propertyKeyTypes:()=>Tr,promiseAllObject:()=>mr,primitiveTypes:()=>Er,prefixIssues:()=>Vr,pick:()=>Nr,partial:()=>Rr,parsedType:()=>V,optionalKeys:()=>Ar,omit:()=>Pr,objectClone:()=>lr,numKeys:()=>Cr,nullish:()=>ar,normalizeParams:()=>z,mergeDefs:()=>dr,merge:()=>Lr,jsonStringifyReplacer:()=>rr,joinValues:()=>L,issue:()=>Kr,isPlainObject:()=>xr,isObject:()=>yr,hexToUint8Array:()=>Qr,getSizableOrigin:()=>Wr,getParsedType:()=>wr,getLengthableOrigin:()=>Gr,getEnumValues:()=>nr,getElementAtPath:()=>pr,floatSafeRemainder:()=>sr,finalizeIssue:()=>Ur,extend:()=>Fr,escapeRegex:()=>Dr,esc:()=>gr,defineLazy:()=>R,createTransparentProxy:()=>kr,cloneDef:()=>fr,clone:()=>Or,cleanRegex:()=>or,cleanEnum:()=>qr,captureStackTrace:()=>vr,cached:()=>ir,base64urlToUint8Array:()=>Xr,base64ToUint8Array:()=>Jr,assignProp:()=>ur,assertNotEqual:()=>Qn,assertNever:()=>er,assertIs:()=>$n,assertEqual:()=>Zn,assert:()=>tr,allowsEval:()=>br,aborted:()=>Br,NUMBER_FORMAT_RANGES:()=>jr,Class:()=>ei,BIGINT_FORMAT_RANGES:()=>Mr});function Zn(e){return e}function Qn(e){return e}function $n(e){}function er(e){throw Error(`Unexpected value in exhaustive check`)}function tr(e){}function nr(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function L(e,t=`|`){return e.map(e=>B(e)).join(t)}function rr(e,t){return typeof t==`bigint`?t.toString():t}function ir(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function ar(e){return e==null}function or(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function sr(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var cr=Symbol(`evaluating`);function R(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==cr)return r===void 0&&(r=cr,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function lr(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ur(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function dr(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function fr(e){return dr(e._zod.def)}function pr(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function mr(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function hr(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function gr(e){return JSON.stringify(e)}function _r(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var vr=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function yr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var br=ir(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function xr(e){if(yr(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(yr(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Sr(e){return xr(e)?{...e}:Array.isArray(e)?[...e]:e}function Cr(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var wr=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},Tr=new Set([`string`,`number`,`symbol`]),Er=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function Dr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Or(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function z(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function kr(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function B(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ar(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var jr={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Mr={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Nr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Or(e,dr(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return ur(this,`shape`,e),e},checks:[]}))}function Pr(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Or(e,dr(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return ur(this,`shape`,r),r},checks:[]}))}function Fr(e,t){if(!xr(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Or(e,dr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ur(this,`shape`,n),n}}))}function Ir(e,t){if(!xr(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Or(e,dr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return ur(this,`shape`,n),n}}))}function Lr(e,t){return Or(e,dr(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return ur(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Rr(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Or(t,dr(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return ur(this,`shape`,i),i},checks:[]}))}function zr(e,t,n){return Or(t,dr(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return ur(this,`shape`,i),i}}))}function Br(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Vr(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Hr(e){return typeof e==`string`?e:e?.message}function Ur(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=Hr(e.inst?._zod.def?.error?.(e))??Hr(t?.error?.(e))??Hr(n.customError?.(e))??Hr(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,!t?.reportInput&&delete r.input,r}function Wr(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}function Gr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function V(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Kr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function qr(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Jr(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function Yr(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Xr(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return Jr(t+`=`.repeat((4-t.length%4)%4))}function Zr(e){return Yr(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Qr(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function $r(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var ei=class{constructor(...e){}},ti=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),e.message=JSON.stringify(t,rr,2),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},ni=P(`$ZodError`,ti),ri=P(`$ZodError`,ti,{Parent:Error});function ii(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ai(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}function oi(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a,o;for(let s of e.issues)if(s.code===`invalid_union`&&s.errors.length)s.errors.map(e=>r({issues:e},s.path));else if(s.code===`invalid_key`)r({issues:s.issues},s.path);else if(s.code===`invalid_element`)r({issues:s.issues},s.path);else{let e=[...i,...s.path];if(e.length===0){n.errors.push(t(s));continue}let r=n,c=0;for(;c<e.length;){let n=e[c],i=c===e.length-1;typeof n==`string`?(r.properties??={},(a=r.properties)[n]??(a[n]={errors:[]}),r=r.properties[n]):(r.items??=[],(o=r.items)[n]??(o[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(s)),c++}}};return r(e),n}function si(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function ci(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${si(e.path)}`);return t.join(`
|
|
2
2
|
`)}var li=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Jn;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Ur(e,a,F())));throw vr(t,i?.callee),t}return o.value},ui=li(ri),di=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Ur(e,a,F())));throw vr(t,i?.callee),t}return o.value},fi=di(ri),pi=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Jn;return a.issues.length?{success:!1,error:new(e??ni)(a.issues.map(e=>Ur(e,i,F())))}:{success:!0,data:a.value}},mi=pi(ri),hi=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Ur(e,i,F())))}:{success:!0,data:a.value}},gi=hi(ri),_i=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return li(e)(t,n,i)},vi=_i(ri),yi=e=>(t,n,r)=>li(e)(t,n,r),bi=yi(ri),xi=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return di(e)(t,n,i)},Si=xi(ri),Ci=e=>async(t,n,r)=>di(e)(t,n,r),wi=Ci(ri),Ti=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pi(e)(t,n,i)},Ei=Ti(ri),Di=e=>(t,n,r)=>pi(e)(t,n,r),Oi=Di(ri),ki=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hi(e)(t,n,i)},Ai=ki(ri),ji=e=>async(t,n,r)=>hi(e)(t,n,r),Mi=ji(ri),Ni={};Wn(Ni,{xid:()=>Li,uuid7:()=>Ki,uuid6:()=>Gi,uuid4:()=>Wi,uuid:()=>Ui,uppercase:()=>wa,unicodeEmail:()=>Xi,undefined:()=>Sa,ulid:()=>Ii,time:()=>ma,string:()=>ga,sha512_hex:()=>Ba,sha512_base64url:()=>Ha,sha512_base64:()=>Va,sha384_hex:()=>La,sha384_base64url:()=>za,sha384_base64:()=>Ra,sha256_hex:()=>Pa,sha256_base64url:()=>Ia,sha256_base64:()=>Fa,sha1_hex:()=>ja,sha1_base64url:()=>Na,sha1_base64:()=>Ma,rfc5322Email:()=>Yi,number:()=>ya,null:()=>xa,nanoid:()=>zi,md5_hex:()=>Oa,md5_base64url:()=>Aa,md5_base64:()=>ka,mac:()=>ra,lowercase:()=>Ca,ksuid:()=>Ri,ipv6:()=>na,ipv4:()=>ta,integer:()=>va,idnEmail:()=>Zi,html5Email:()=>Ji,hostname:()=>ca,hex:()=>Ta,guid:()=>Hi,extendedDuration:()=>Vi,emoji:()=>ea,email:()=>qi,e164:()=>ua,duration:()=>Bi,domain:()=>la,datetime:()=>ha,date:()=>fa,cuid2:()=>Fi,cuid:()=>Pi,cidrv6:()=>aa,cidrv4:()=>ia,browserEmail:()=>Qi,boolean:()=>ba,bigint:()=>_a,base64url:()=>sa,base64:()=>oa});var Pi=/^[cC][^\s-]{8,}$/,Fi=/^[0-9a-z]+$/,Ii=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Li=/^[0-9a-vA-V]{20}$/,Ri=/^[A-Za-z0-9]{27}$/,zi=/^[a-zA-Z0-9_-]{21}$/,Bi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Vi=/^[-+]?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)?)??$/,Hi=/^([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})$/,Ui=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Wi=Ui(4),Gi=Ui(6),Ki=Ui(7),qi=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ji=/^[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])?)*$/,Yi=/^(([^<>()\[\]\\.,;:\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,}))$/,Xi=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Zi=Xi,Qi=/^[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])?)*$/,$i=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function ea(){return new RegExp($i,`u`)}var ta=/^(?:(?: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])$/,na=/^(([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}|:))$/,ra=e=>{let t=Dr(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},ia=/^((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])$/,aa=/^(([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])$/,oa=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,sa=/^[A-Za-z0-9_-]*$/,ca=/^(?=.{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])?)*\.?$/,la=/^([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,ua=/^\+[1-9]\d{6,14}$/,da=`(?:(?:\\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])))`,fa=RegExp(`^${da}$`);function pa(e){return typeof e.precision==`number`?e.precision===-1?`(?:[01]\\d|2[0-3]):[0-5]\\d`:e.precision===0?`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`:`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:`(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?`}function ma(e){return RegExp(`^${pa(e)}$`)}function ha(e){let t=pa({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${da}T(?:${r})$`)}var ga=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},_a=/^-?\d+n?$/,va=/^-?\d+$/,ya=/^-?\d+(?:\.\d+)?$/,ba=/^(?:true|false)$/i,xa=/^null$/i,Sa=/^undefined$/i,Ca=/^[^A-Z]*$/,wa=/^[^a-z]*$/,Ta=/^[0-9a-fA-F]*$/;function Ea(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Da(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Oa=/^[0-9a-fA-F]{32}$/,ka=Ea(22,`==`),Aa=Da(22),ja=/^[0-9a-fA-F]{40}$/,Ma=Ea(27,`=`),Na=Da(27),Pa=/^[0-9a-fA-F]{64}$/,Fa=Ea(43,`=`),Ia=Da(43),La=/^[0-9a-fA-F]{96}$/,Ra=Ea(64,``),za=Da(64),Ba=/^[0-9a-fA-F]{128}$/,Va=Ea(86,`==`),Ha=Da(86),H=P(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ua={number:`number`,bigint:`bigint`,object:`date`},Wa=P(`$ZodCheckLessThan`,(e,t)=>{H.init(e,t);let n=Ua[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ga=P(`$ZodCheckGreaterThan`,(e,t)=>{H.init(e,t);let n=Ua[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ka=P(`$ZodCheckMultipleOf`,(e,t)=>{H.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):sr(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),qa=P(`$ZodCheckNumberFormat`,(e,t)=>{H.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=jr[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=va)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ja=P(`$ZodCheckBigIntFormat`,(e,t)=>{H.init(e,t);let[n,r]=Mr[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),Ya=P(`$ZodCheckMaxSize`,(e,t)=>{var n;H.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ar(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:Wr(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Xa=P(`$ZodCheckMinSize`,(e,t)=>{var n;H.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ar(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:Wr(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Za=P(`$ZodCheckSizeEquals`,(e,t)=>{var n;H.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ar(t)&&t.size!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:Wr(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Qa=P(`$ZodCheckMaxLength`,(e,t)=>{var n;H.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ar(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Gr(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),$a=P(`$ZodCheckMinLength`,(e,t)=>{var n;H.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ar(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Gr(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),eo=P(`$ZodCheckLengthEquals`,(e,t)=>{var n;H.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!ar(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Gr(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),to=P(`$ZodCheckStringFormat`,(e,t)=>{var n,r;H.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),no=P(`$ZodCheckRegex`,(e,t)=>{to.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),ro=P(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ca,to.init(e,t)}),io=P(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=wa,to.init(e,t)}),ao=P(`$ZodCheckIncludes`,(e,t)=>{H.init(e,t);let n=Dr(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),oo=P(`$ZodCheckStartsWith`,(e,t)=>{H.init(e,t);let n=RegExp(`^${Dr(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),so=P(`$ZodCheckEndsWith`,(e,t)=>{H.init(e,t);let n=RegExp(`.*${Dr(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function co(e,t,n){e.issues.length&&t.issues.push(...Vr(n,e.issues))}var lo=P(`$ZodCheckProperty`,(e,t)=>{H.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>co(n,e,t.property));co(n,e,t.property)}}),uo=P(`$ZodCheckMimeType`,(e,t)=>{H.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),fo=P(`$ZodCheckOverwrite`,(e,t)=>{H.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),po=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
3
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
4
4
|
`))}},mo={major:4,minor:3,patch:5},U=P(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=mo;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Br(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Jn;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Br(e,t))});else{if(e.issues.length===t)continue;r||=Br(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Br(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Jn;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Jn;return o.then(e=>t(e,r,a))}return t(o,r,a)}}R(e,`~standard`,()=>({validate:t=>{try{let n=mi(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return gi(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),ho=P(`$ZodString`,(e,t)=>{U.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ga(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),W=P(`$ZodStringFormat`,(e,t)=>{to.init(e,t),ho.init(e,t)}),go=P(`$ZodGUID`,(e,t)=>{t.pattern??=Hi,W.init(e,t)}),_o=P(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Ui(e)}else t.pattern??=Ui();W.init(e,t)}),vo=P(`$ZodEmail`,(e,t)=>{t.pattern??=qi,W.init(e,t)}),yo=P(`$ZodURL`,(e,t)=>{W.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,!t.hostname.test(i.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,!t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),bo=P(`$ZodEmoji`,(e,t)=>{t.pattern??=ea(),W.init(e,t)}),xo=P(`$ZodNanoID`,(e,t)=>{t.pattern??=zi,W.init(e,t)}),So=P(`$ZodCUID`,(e,t)=>{t.pattern??=Pi,W.init(e,t)}),Co=P(`$ZodCUID2`,(e,t)=>{t.pattern??=Fi,W.init(e,t)}),wo=P(`$ZodULID`,(e,t)=>{t.pattern??=Ii,W.init(e,t)}),To=P(`$ZodXID`,(e,t)=>{t.pattern??=Li,W.init(e,t)}),Eo=P(`$ZodKSUID`,(e,t)=>{t.pattern??=Ri,W.init(e,t)}),Do=P(`$ZodISODateTime`,(e,t)=>{t.pattern??=ha(t),W.init(e,t)}),Oo=P(`$ZodISODate`,(e,t)=>{t.pattern??=fa,W.init(e,t)}),ko=P(`$ZodISOTime`,(e,t)=>{t.pattern??=ma(t),W.init(e,t)}),Ao=P(`$ZodISODuration`,(e,t)=>{t.pattern??=Bi,W.init(e,t)}),jo=P(`$ZodIPv4`,(e,t)=>{t.pattern??=ta,W.init(e,t),e._zod.bag.format=`ipv4`}),Mo=P(`$ZodIPv6`,(e,t)=>{t.pattern??=na,W.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),No=P(`$ZodMAC`,(e,t)=>{t.pattern??=ra(t.delimiter),W.init(e,t),e._zod.bag.format=`mac`}),Po=P(`$ZodCIDRv4`,(e,t)=>{t.pattern??=ia,W.init(e,t)}),Fo=P(`$ZodCIDRv6`,(e,t)=>{t.pattern??=aa,W.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Io(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Lo=P(`$ZodBase64`,(e,t)=>{t.pattern??=oa,W.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Io(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Ro(e){if(!sa.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Io(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var zo=P(`$ZodBase64URL`,(e,t)=>{t.pattern??=sa,W.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Ro(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Bo=P(`$ZodE164`,(e,t)=>{t.pattern??=ua,W.init(e,t)});function Vo(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Ho=P(`$ZodJWT`,(e,t)=>{W.init(e,t),e._zod.check=n=>{Vo(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Uo=P(`$ZodCustomStringFormat`,(e,t)=>{W.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Wo=P(`$ZodNumber`,(e,t)=>{U.init(e,t),e._zod.pattern=e._zod.bag.pattern??ya,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Go=P(`$ZodNumberFormat`,(e,t)=>{qa.init(e,t),Wo.init(e,t)}),Ko=P(`$ZodBoolean`,(e,t)=>{U.init(e,t),e._zod.pattern=ba,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),qo=P(`$ZodBigInt`,(e,t)=>{U.init(e,t),e._zod.pattern=_a,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),Jo=P(`$ZodBigIntFormat`,(e,t)=>{Ja.init(e,t),qo.init(e,t)}),Yo=P(`$ZodSymbol`,(e,t)=>{U.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),Xo=P(`$ZodUndefined`,(e,t)=>{U.init(e,t),e._zod.pattern=Sa,e._zod.values=new Set([void 0]),e._zod.optin=`optional`,e._zod.optout=`optional`,e._zod.parse=(t,n)=>{let r=t.value;return typeof r>`u`||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),Zo=P(`$ZodNull`,(e,t)=>{U.init(e,t),e._zod.pattern=xa,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Qo=P(`$ZodAny`,(e,t)=>{U.init(e,t),e._zod.parse=e=>e}),$o=P(`$ZodUnknown`,(e,t)=>{U.init(e,t),e._zod.parse=e=>e}),es=P(`$ZodNever`,(e,t)=>{U.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),ts=P(`$ZodVoid`,(e,t)=>{U.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r>`u`||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),ns=P(`$ZodDate`,(e,t)=>{U.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function rs(e,t,n){e.issues.length&&t.issues.push(...Vr(n,e.issues)),t.value[n]=e.value}var is=P(`$ZodArray`,(e,t)=>{U.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>rs(t,n,e))):rs(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function as(e,t,n,r,i){if(e.issues.length){if(i&&!(n in r))return;t.issues.push(...Vr(n,e.issues))}e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function os(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Ar(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function ss(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout===`optional`;for(let i in t){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>as(e,n,i,t,u))):as(a,n,i,t,u)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var cs=P(`$ZodObject`,(e,t)=>{if(U.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,`shape`,{get:()=>{let n={...e};return Object.defineProperty(t,`shape`,{value:n}),n}})}let n=ir(()=>os(t));R(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=yr,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optout===`optional`,i=n._zod.run({value:s[e],issues:[]},o);i instanceof Promise?c.push(i.then(n=>as(n,t,e,s,r))):as(i,t,e,s,r)}return i?ss(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),ls=P(`$ZodObjectJIT`,(e,t)=>{cs.init(e,t);let n=e._zod.parse,r=ir(()=>os(t)),i=e=>{let t=new po([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=gr(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=gr(r),s=e[r]?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),s?t.write(`
|
|
@@ -58,7 +58,7 @@ Note: This type uses \`Record<K, string | undefined>\` rather than \`Partial<Rec
|
|
|
58
58
|
for compatibility with Zod schema generation. Both are functionally equivalent for validation.`);N.object({method:N.literal(`ui/open-link`),params:N.object({url:N.string().describe(`URL to open in the host's browser`)})}),N.object({isError:N.boolean().optional().describe(`True if the host failed to open the URL (e.g., due to security policy).`)}).passthrough(),N.object({isError:N.boolean().optional().describe(`True if the host rejected or failed to deliver the message.`)}).passthrough(),N.object({method:N.literal(`ui/notifications/sandbox-proxy-ready`),params:N.object({})});var qg=N.object({connectDomains:N.array(N.string()).optional().describe(`Origins for network requests (fetch/XHR/WebSocket).`),resourceDomains:N.array(N.string()).optional().describe(`Origins for static resources (scripts, images, styles, fonts).`),frameDomains:N.array(N.string()).optional().describe(`Origins for nested iframes (frame-src directive).`),baseUriDomains:N.array(N.string()).optional().describe(`Allowed base URIs for the document (base-uri directive).`)}),Jg=N.object({camera:N.object({}).optional().describe("Request camera access (Permission Policy `camera` feature)."),microphone:N.object({}).optional().describe("Request microphone access (Permission Policy `microphone` feature)."),geolocation:N.object({}).optional().describe("Request geolocation access (Permission Policy `geolocation` feature)."),clipboardWrite:N.object({}).optional().describe("Request clipboard write access (Permission Policy `clipboard-write` feature).")});N.object({method:N.literal(`ui/notifications/size-changed`),params:N.object({width:N.number().optional().describe(`New width in pixels.`),height:N.number().optional().describe(`New height in pixels.`)})}),N.object({method:N.literal(`ui/notifications/tool-input`),params:N.object({arguments:N.record(N.string(),N.unknown().describe(`Complete tool call arguments as key-value pairs.`)).optional().describe(`Complete tool call arguments as key-value pairs.`)})}),N.object({method:N.literal(`ui/notifications/tool-input-partial`),params:N.object({arguments:N.record(N.string(),N.unknown().describe(`Partial tool call arguments (incomplete, may change).`)).optional().describe(`Partial tool call arguments (incomplete, may change).`)})}),N.object({method:N.literal(`ui/notifications/tool-cancelled`),params:N.object({reason:N.string().optional().describe(`Optional reason for the cancellation (e.g., "user action", "timeout").`)})});var Yg=N.object({fonts:N.string().optional()}),Xg=N.object({variables:Kg.optional().describe(`CSS variables for theming the app.`),css:Yg.optional().describe(`CSS blocks that apps can inject.`)});N.object({method:N.literal(`ui/resource-teardown`),params:N.object({})}),N.record(N.string(),N.unknown());var Zg=N.object({text:N.object({}).optional().describe(`Host supports text content blocks.`),image:N.object({}).optional().describe(`Host supports image content blocks.`),audio:N.object({}).optional().describe(`Host supports audio content blocks.`),resource:N.object({}).optional().describe(`Host supports resource content blocks.`),resourceLink:N.object({}).optional().describe(`Host supports resource link content blocks.`),structuredContent:N.object({}).optional().describe(`Host supports structured content.`)}),Qg=N.object({experimental:N.object({}).optional().describe(`Experimental features (structure TBD).`),openLinks:N.object({}).optional().describe(`Host supports opening external URLs.`),serverTools:N.object({listChanged:N.boolean().optional().describe(`Host supports tools/list_changed notifications.`)}).optional().describe(`Host can proxy tool calls to the MCP server.`),serverResources:N.object({listChanged:N.boolean().optional().describe(`Host supports resources/list_changed notifications.`)}).optional().describe(`Host can proxy resource reads to the MCP server.`),logging:N.object({}).optional().describe(`Host accepts log messages.`),sandbox:N.object({permissions:Jg.optional().describe(`Permissions granted by the host (camera, microphone, geolocation).`),csp:qg.optional().describe(`CSP domains approved by the host.`)}).optional().describe(`Sandbox configuration applied by the host.`),updateModelContext:Zg.optional().describe(`Host accepts context updates (ui/update-model-context) to be included in the model's context for future turns.`),message:Zg.optional().describe(`Host supports receiving content messages (ui/message) from the view.`)}),$g=N.object({experimental:N.object({}).optional().describe(`Experimental features (structure TBD).`),tools:N.object({listChanged:N.boolean().optional().describe(`App supports tools/list_changed notifications.`)}).optional().describe(`App exposes MCP-style tools that the host can call.`),availableDisplayModes:N.array(Wg).optional().describe(`Display modes the app supports.`)});N.object({method:N.literal(`ui/notifications/initialized`),params:N.object({}).optional()}),N.object({csp:qg.optional().describe(`Content Security Policy configuration.`),permissions:Jg.optional().describe(`Sandbox permissions requested by the UI.`),domain:N.string().optional().describe(`Dedicated origin for view sandbox.`),prefersBorder:N.boolean().optional().describe(`Visual boundary preference - true if UI prefers a visible border.`)}),N.object({method:N.literal(`ui/request-display-mode`),params:N.object({mode:Wg.describe(`The display mode being requested.`)})}),N.object({mode:Wg.describe(`The display mode that was actually set. May differ from requested if not supported.`)}).passthrough();var e_=N.union([N.literal(`model`),N.literal(`app`)]).describe(`Tool visibility scope - who can access the tool.`);N.object({resourceUri:N.string().optional(),visibility:N.array(e_).optional().describe(`Who can access this tool. Default: ["model", "app"]
|
|
59
59
|
- "model": Tool visible to and callable by the agent
|
|
60
60
|
- "app": Tool callable by the app from this server only`)}),N.object({mimeTypes:N.array(N.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),N.object({method:N.literal(`ui/message`),params:N.object({role:N.literal(`user`).describe(`Message role, currently only "user" is supported.`),content:N.array(Bt).describe(`Message content blocks (text, image, etc.).`)})}),N.object({method:N.literal(`ui/notifications/sandbox-resource-ready`),params:N.object({html:N.string().describe(`HTML content to load into the inner iframe.`),sandbox:N.string().optional().describe(`Optional override for the inner iframe's sandbox attribute.`),csp:qg.optional().describe(`CSP configuration from resource metadata.`),permissions:Jg.optional().describe(`Sandbox permissions from resource metadata.`)})}),N.object({method:N.literal(`ui/notifications/tool-result`),params:Yt.describe(`Standard MCP tool execution result.`)});var t_=N.object({toolInfo:N.object({id:he.optional().describe(`JSON-RPC id of the tools/call request.`),tool:Kt.describe(`Tool definition including name, inputSchema, etc.`)}).optional().describe(`Metadata of the tool call that instantiated this App.`),theme:Ug.optional().describe(`Current color theme preference.`),styles:Xg.optional().describe(`Style configuration for theming the app.`),displayMode:Wg.optional().describe(`How the UI is currently displayed.`),availableDisplayModes:N.array(Wg).optional().describe(`Display modes the host supports.`),containerDimensions:N.union([N.object({height:N.number().describe(`Fixed container height in pixels.`)}),N.object({maxHeight:N.union([N.number(),N.undefined()]).optional().describe(`Maximum container height in pixels.`)})]).and(N.union([N.object({width:N.number().describe(`Fixed container width in pixels.`)}),N.object({maxWidth:N.union([N.number(),N.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:N.string().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:N.string().optional().describe(`User's timezone in IANA format.`),userAgent:N.string().optional().describe(`Host application identifier.`),platform:N.union([N.literal(`web`),N.literal(`desktop`),N.literal(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:N.object({touch:N.boolean().optional().describe(`Whether the device supports touch input.`),hover:N.boolean().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:N.object({top:N.number().describe(`Top safe area inset in pixels.`),right:N.number().describe(`Right safe area inset in pixels.`),bottom:N.number().describe(`Bottom safe area inset in pixels.`),left:N.number().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();N.object({method:N.literal(`ui/notifications/host-context-changed`),params:t_.describe(`Partial context update containing only changed fields.`)}),N.object({method:N.literal(`ui/update-model-context`),params:N.object({content:N.array(Bt).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:N.record(N.string(),N.unknown().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),N.object({method:N.literal(`ui/initialize`),params:N.object({appInfo:Ae.describe(`App identification (name and version).`),appCapabilities:$g.describe(`Features and capabilities this app provides.`),protocolVersion:N.string().describe(`Protocol version this app supports.`)})}),N.object({protocolVersion:N.string().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Ae.describe(`Host application identification and version.`),hostCapabilities:Qg.describe(`Features and capabilities provided by the host.`),hostContext:t_.describe(`Rich context about the host environment.`)}).passthrough();var n_=`text/html;profile=mcp-app`,r_=`1.23.0-canary.9`;function i_(){return r_}a(i_,`getPackageVersion`);var a_=class{static{a(this,`BaseTelemetryEvent`)}},o_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`MCPAgentExecutionEvent`)}get name(){return`mcp_agent_execution`}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}};function s_(e,t){let n=Array.from(e.registrations.tools.values()),r=Array.from(e.registrations.prompts.values()),i=Array.from(e.registrations.resources.values()),a=Array.from(e.registrations.resourceTemplates.values()),o=i.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,uri:e.config.uri??null,mime_type:e.config.mimeType??null})),s=o.filter(e=>e.mime_type===`text/html+skybridge`),c=o.filter(e=>e.mime_type===`text/uri-list`||e.mime_type===`text/html`),l=o.filter(e=>e.mime_type===n_);return{transport:t,toolsNumber:e.registeredTools.length,resourcesNumber:e.registeredResources.length,promptsNumber:e.registeredPrompts.length,auth:!!e.oauthProvider,name:e.config.name,description:e.config.description??null,baseUrl:e.serverBaseUrl??null,toolNames:e.registeredTools.length>0?e.registeredTools:null,resourceNames:e.registeredResources.length>0?e.registeredResources:null,promptNames:e.registeredPrompts.length>0?e.registeredPrompts:null,tools:n.length>0?n.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,input_schema:e.config.schema?JSON.stringify(e.config.schema):null,output_schema:e.config.outputSchema?JSON.stringify(e.config.outputSchema):null})):null,resources:o.length>0?o:null,prompts:r.length>0?r.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,args:e.config.args?JSON.stringify(e.config.args):null})):null,templates:a.length>0?a.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null})):null,capabilities:{logging:!0,resources:{subscribe:!0,listChanged:!0}},appsSdkResources:s.length>0?s:null,appsSdkResourcesNumber:s.length,mcpUiResources:c.length>0?c:null,mcpUiResourcesNumber:c.length,mcpAppsResources:l.length>0?l:null,mcpAppsResourcesNumber:l.length}}a(s_,`createServerRunEventData`);var c_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerRunEvent`)}get name(){return`server_run`}get properties(){return{transport:this.data.transport,tools_number:this.data.toolsNumber,resources_number:this.data.resourcesNumber,prompts_number:this.data.promptsNumber,auth:this.data.auth,name:this.data.name,description:this.data.description??null,base_url:this.data.baseUrl??null,tool_names:this.data.toolNames??null,resource_names:this.data.resourceNames??null,prompt_names:this.data.promptNames??null,tools:this.data.tools??null,resources:this.data.resources??null,prompts:this.data.prompts??null,templates:this.data.templates??null,capabilities:this.data.capabilities?JSON.stringify(this.data.capabilities):null,apps_sdk_resources:this.data.appsSdkResources?JSON.stringify(this.data.appsSdkResources):null,apps_sdk_resources_number:this.data.appsSdkResourcesNumber??0,mcp_ui_resources:this.data.mcpUiResources?JSON.stringify(this.data.mcpUiResources):null,mcp_ui_resources_number:this.data.mcpUiResourcesNumber??0,mcp_apps_resources:this.data.mcpAppsResources?JSON.stringify(this.data.mcpAppsResources):null,mcp_apps_resources_number:this.data.mcpAppsResourcesNumber??0}}},l_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerInitializeEvent`)}get name(){return`server_initialize_call`}get properties(){return{protocol_version:this.data.protocolVersion,client_info:JSON.stringify(this.data.clientInfo),client_capabilities:JSON.stringify(this.data.clientCapabilities),session_id:this.data.sessionId??null}}},u_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerToolCallEvent`)}get name(){return`server_tool_call`}get properties(){return{tool_name:this.data.toolName,length_input_argument:this.data.lengthInputArgument,success:this.data.success,error_type:this.data.errorType??null,execution_time_ms:this.data.executionTimeMs??null}}},d_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerResourceCallEvent`)}get name(){return`server_resource_call`}get properties(){return{name:this.data.name,description:this.data.description,contents:this.data.contents,success:this.data.success,error_type:this.data.errorType??null}}},f_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerPromptCallEvent`)}get name(){return`server_prompt_call`}get properties(){return{name:this.data.name,description:this.data.description,success:this.data.success,error_type:this.data.errorType??null}}},p_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerContextEvent`)}get name(){return`server_context_${this.data.contextType}`}get properties(){return{context_type:this.data.contextType,notification_type:this.data.notificationType??null}}},m_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`MCPClientInitEvent`)}get name(){return`mcpclient_init`}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},h_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ConnectorInitEvent`)}get name(){return`connector_init`}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},g_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ClientAddServerEvent`)}get name(){return`client_add_server`}get properties(){let{serverName:e,serverConfig:t}=this.data,n=t.url;return{server_name:e,server_url_domain:n?this._extractHostname(n):null,transport:t.transport??null,has_auth:!!(t.authToken||t.authProvider)}}_extractHostname(e){try{return new URL(e).hostname}catch{return null}}},__=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ClientRemoveServerEvent`)}get name(){return`client_remove_server`}get properties(){return{server_name:this.data.serverName}}};function v_(e){return e._llm_type||e.constructor.name.toLowerCase()}a(v_,`getModelProvider`);function y_(e){if(`_identifyingParams`in e){let t=e._identifyingParams;if(typeof t==`object`&&t){for(let e of[`model`,`modelName`,`model_name`,`modelId`,`model_id`,`deploymentName`,`deployment_name`])if(e in t)return String(t[e])}}return e.model||e.modelName||e.constructor.name}a(y_,`getModelName`);function b_(e){return[v_(e),y_(e)]}a(b_,`extractModelInfo`);function x_(){if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.randomUUID==`function`)return globalThis.crypto.randomUUID();if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16,20)}-${t.substring(20)}`}return`${Date.now()}-${Math.random().toString(36).substring(2,15)}-${Math.random().toString(36).substring(2,15)}`}a(x_,`generateUUID`);function S_(){if(typeof window<`u`&&window.crypto&&typeof window.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return window.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).substring(2,15)}a(S_,`secureRandomString`);var C_=`mcp_use_user_id`;function w_(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`&&typeof localStorage.removeItem==`function`}a(w_,`isLocalStorageFunctional`);function T_(){try{return typeof window<`u`&&typeof document<`u`?`browser`:`unknown`}catch{return`unknown`}}a(T_,`detectRuntimeEnvironment`);function E_(e){if(e===`browser`)try{if(w_())return localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`),`localStorage`}catch{}return`session-only`}a(E_,`getStorageCapability`);var D_=null;function O_(){return D_===null&&(D_=T_()),D_}a(O_,`getRuntimeEnvironment`);var k_=class e{static{a(this,`Telemetry`)}static instance=null;PROJECT_API_KEY=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`;HOST=`https://eu.i.posthog.com`;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_posthogBrowserClient=null;_posthogLoading=null;_runtimeEnvironment;_storageCapability;_source;constructor(){this._runtimeEnvironment=O_(),this._storageCapability=E_(this._runtimeEnvironment),this._source=this._getSourceFromLocalStorage()||this._runtimeEnvironment;let e=this._checkTelemetryDisabled(),t=this._runtimeEnvironment!==`unknown`;e?(this._posthogBrowserClient=null,o.debug(`Telemetry disabled via localStorage`)):t?(o.info(`Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false in localStorage to disable.`),this._posthogLoading=this._initPostHogBrowser()):(this._posthogBrowserClient=null,o.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`))}_getSourceFromLocalStorage(){try{if(w_())return localStorage.getItem(`MCP_USE_TELEMETRY_SOURCE`)}catch{}return null}_checkTelemetryDisabled(){return!!(w_()&&localStorage.getItem(`MCP_USE_ANONYMIZED_TELEMETRY`)===`false`)}async _initPostHogBrowser(){try{let e=await te(()=>import(`./module-DbiflUeG.js`),[]),t=e.default||e.posthog;if(!t||typeof t.init!=`function`)throw Error(`posthog-js module did not export expected interface`);t.init(this.PROJECT_API_KEY,{api_host:this.HOST,persistence:`localStorage`,autocapture:!1,capture_pageview:!1,disable_session_recording:!0,loaded:a(()=>{o.debug(`PostHog browser client initialized`)},`loaded`)}),this._posthogBrowserClient=t}catch(e){o.warn(`Failed to initialize PostHog browser telemetry: ${e}`),this._posthogBrowserClient=null}}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e;try{w_()&&localStorage.setItem(`MCP_USE_TELEMETRY_SOURCE`,e)}catch{}o.debug(`Telemetry source set to: ${e}`)}getSource(){return this._source}get isEnabled(){return this._posthogBrowserClient!==null}get userId(){if(this._currUserId)return this._currUserId;try{switch(this._storageCapability){case`localStorage`:this._currUserId=this._getUserIdFromLocalStorage();break;default:try{this._currUserId=`session-${x_()}`}catch{this._currUserId=`session-${Date.now()}-${S_()}`}break}}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}_getUserIdFromLocalStorage(){try{if(!w_())throw Error(`localStorage is not available or not functional`);localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`);let e=localStorage.getItem(C_);if(!e){try{e=x_()}catch{e=`${Date.now()}-${S_()}`}localStorage.setItem(C_,e)}return e}catch(e){o.debug(`Failed to access localStorage for user ID: ${e}`);let t;try{t=`session-${x_()}`}catch{t=`session-${Date.now()}-${S_()}`}return t}}async capture(e){if(this._posthogLoading&&await this._posthogLoading,!this._posthogBrowserClient)return;let t=this.userId,n={...e.properties};if(n.mcp_use_version=i_(),n.language=`typescript`,n.source=this._source,n.runtime=this._runtimeEnvironment,this._posthogBrowserClient)try{this._posthogBrowserClient.capture(e.name,{...n,distinct_id:t})}catch(t){o.debug(`Failed to track PostHog Browser event ${e.name}: ${t}`)}}async trackAgentExecution(e){if(!this.isEnabled)return;let t=new o_(e);await this.capture(t)}async trackServerRunFromServer(e,t){if(!this.isEnabled)return;let n=new c_(s_(e,t));await this.capture(n)}async trackServerInitialize(e){if(!this.isEnabled)return;let t=new l_(e);await this.capture(t)}async trackServerToolCall(e){if(!this.isEnabled)return;let t=new u_(e);await this.capture(t)}async trackServerResourceCall(e){if(!this.isEnabled)return;let t=new d_(e);await this.capture(t)}async trackServerPromptCall(e){if(!this.isEnabled)return;let t=new f_(e);await this.capture(t)}async trackServerContext(e){if(!this.isEnabled)return;let t=new p_(e);await this.capture(t)}async trackMCPClientInit(e){if(!this.isEnabled)return;let t=new m_(e);await this.capture(t)}async trackConnectorInit(e){if(!this.isEnabled)return;let t=new h_(e);await this.capture(t)}async trackClientAddServer(e,t){if(!this.isEnabled)return;let n=new g_({serverName:e,serverConfig:t});await this.capture(n)}async trackClientRemoveServer(e){if(!this.isEnabled)return;let t=new __({serverName:e});await this.capture(t)}async trackUseMcpConnection(e){this.isEnabled&&await this.capture({name:`usemcp_connection`,properties:{url_domain:new URL(e.url).hostname,transport_type:e.transportType,success:e.success,error_type:e.errorType??null,connection_time_ms:e.connectionTimeMs??null,has_oauth:e.hasOAuth,has_sampling:e.hasSampling,has_elicitation:e.hasElicitation}})}async trackUseMcpToolCall(e){this.isEnabled&&await this.capture({name:`usemcp_tool_call`,properties:{tool_name:e.toolName,success:e.success,error_type:e.errorType??null,execution_time_ms:e.executionTimeMs??null}})}async trackUseMcpResourceRead(e){this.isEnabled&&await this.capture({name:`usemcp_resource_read`,properties:{resource_uri_scheme:e.resourceUri.split(`:`)[0],success:e.success,error_type:e.errorType??null}})}identify(e,t){if(this._posthogBrowserClient)try{this._posthogBrowserClient.identify(e,t)}catch(e){o.debug(`Failed to identify user: ${e}`)}}reset(){if(this._posthogBrowserClient)try{this._posthogBrowserClient.reset()}catch(e){o.debug(`Failed to reset user: ${e}`)}this._currUserId=null}flush(){}shutdown(){}async trackPackageDownload(e){}},A_=k_;function j_(e){A_.getInstance().setSource(e)}a(j_,`setTelemetrySource`);var M_=class{static{a(this,`BaseConnector`)}client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];constructor(e={}){let t={...e,onSampling:e.onSampling??e.samplingCallback,onElicitation:e.onElicitation??e.elicitationCallback};e.samplingCallback&&!e.onSampling&&o.warn(`[BaseConnector] The "samplingCallback" option is deprecated. Use "onSampling" instead.`),e.elicitationCallback&&!e.onElicitation&&console.warn(`[BaseConnector] The "elicitationCallback" option is deprecated. Use "onElicitation" instead.`),this.opts=t,t.roots&&(this.rootsCache=[...t.roots]),t.onNotification&&this.notificationHandlers.push(t.onNotification)}trackConnectorInit(e){let t=this.constructor.name;k_.getInstance().trackConnectorInit({connectorType:t,...e}).catch(e=>o.debug(`Failed to track connector init: ${e}`))}onNotification(e){this.notificationHandlers.push(e),this.client&&this.setupNotificationHandler()}setupNotificationHandler(){if(!this.client)return;let e=a(async e=>{for(let t of this.notificationHandlers)try{await t(e)}catch(e){o.error(`Error in notification handler:`,e)}},`forwardToUserHandlers`);this.client.fallbackNotificationHandler=async t=>{switch(t.method){case`notifications/tools/list_changed`:await this.refreshToolsCache();break;case`notifications/resources/list_changed`:await this.onResourcesListChanged();break;case`notifications/prompts/list_changed`:await this.onPromptsListChanged();break;default:break}await e(t)};let t=this.client._notificationHandlers;for(let n of[`notifications/progress`,`notifications/cancelled`]){let r=t.get(n);r&&t.set(n,async t=>{await r(t),await e(t)})}}async refreshToolsCache(){if(this.client)try{o.debug(`[Auto] Refreshing tools cache due to list_changed notification`),this.toolsCache=(await this.client.listTools()).tools??[],o.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(e){o.warn(`[Auto] Failed to refresh tools cache:`,e)}}async onResourcesListChanged(){o.debug(`[Auto] Resources list changed - clients should re-fetch if needed`)}async onPromptsListChanged(){o.debug(`[Auto] Prompts list changed - clients should re-fetch if needed`)}async setRoots(e){this.rootsCache=[...e],this.client&&(o.debug(`Sending roots/list_changed notification with ${e.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(Nn,async(e,t)=>(o.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){o.debug(`setupSamplingHandler: No client available`);return}let e=this.opts.onSampling??this.opts.samplingCallback;if(!e){o.debug(`setupSamplingHandler: No sampling callback provided`);return}o.debug(`setupSamplingHandler: Setting up sampling request handler`),this.client.setRequestHandler(pn,async(t,n)=>(o.debug(`Server requested sampling, forwarding to callback`),await e(t.params))),o.debug(`setupSamplingHandler: Sampling handler registered successfully`)}setupElicitationHandler(){if(!this.client){o.debug(`setupElicitationHandler: No client available`);return}let e=this.opts.onElicitation??this.opts.elicitationCallback;if(!e){o.debug(`setupElicitationHandler: No elicitation callback provided`);return}o.debug(`setupElicitationHandler: Setting up elicitation request handler`),this.client.setRequestHandler(Cn,async(t,n)=>(o.debug(`Server requested elicitation, forwarding to callback`),await e(t.params))),o.debug(`setupElicitationHandler: Elicitation handler registered successfully`)}async disconnect(){if(!this.connected){o.debug(`Not connected to MCP implementation`);return}o.debug(`Disconnecting from MCP implementation`),await this.cleanupResources(),this.connected=!1,o.debug(`Disconnected from MCP implementation`)}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw Error(`MCP client is not connected`);o.debug(`Caching server capabilities & tools`);let t=this.client.getServerCapabilities();this.capabilitiesCache=t||null;let n=this.client.getServerVersion();this.serverInfoCache=n||null;try{this.toolsCache=(await this.client.listTools(void 0,e)).tools??[],o.debug(`Fetched ${this.toolsCache.length} tools from server`)}catch(e){let t=e;t.code===-32601?o.debug(`Server does not implement tools/list, assuming no tools`):o.debug(`Failed to list tools, assuming empty:`,t.message),this.toolsCache=[]}return o.debug(`Server capabilities:`,t),o.debug(`Server info:`,n),t}get tools(){if(!this.toolsCache)throw Error(`MCP client is not initialized; call initialize() first`);return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}async callTool(e,t,n){if(!this.client)throw Error(`MCP client is not connected`);let r=n?{...n}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},o.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)),o.debug(`Calling tool '${e}' with args`,t);let i=await this.client.callTool({name:e,arguments:t},void 0,r);return o.debug(`Tool '${e}' returned`,i),i}async listTools(e){if(!this.client)throw Error(`MCP client is not connected`);o.debug(`[listTools] Fetching fresh tools from server...`);let t=await this.client.listTools(void 0,e),n=t.tools?[...t.tools]:[];return o.debug(`[listTools] Returned ${n.length} tools:`,n.map(e=>e.name)),n}async listResources(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Listing resources`,e?`with cursor: ${e}`:``),await this.client.listResources({cursor:e},t)}async listAllResources(e){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.resources)return o.debug(`Server does not advertise resources capability, skipping`),{resources:[]};try{o.debug(`Listing all resources (with auto-pagination)`);let t=[],n;do{let r=await this.client.listResources({cursor:n},e);t.push(...r.resources||[]),n=r.nextCursor}while(n);return{resources:t}}catch(e){if(e.code===-32601)return o.debug(`Server advertised resources but method not found`),{resources:[]};throw e}}async listResourceTemplates(e){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Listing resource templates`),await this.client.listResourceTemplates(void 0,e)}async complete(e,t){if(!this.client)throw Error(`MCP client is not connected`);o.debug(`[complete] Requesting completions for:`,e.ref);let n=await this.client.complete(e,t);return o.debug(`[complete] Received ${n.completion.values.length} suggestions`),n}async readResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},t)}async subscribeToResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},t)}async unsubscribeFromResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},t)}async listPrompts(){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.prompts)return o.debug(`Server does not advertise prompts capability, skipping`),{prompts:[]};try{return o.debug(`Listing prompts`),await this.client.listPrompts()}catch(e){if(e.code===-32601)return o.debug(`Server advertised prompts but method not found`),{prompts:[]};throw e}}async getPrompt(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:t})}async request(e,t=null,n){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Sending raw request '${e}' with params`,t),await this.client.request({method:e,params:t??{}},void 0,n)}async cleanupResources(){let e=[];if(this.client)try{typeof this.client.close==`function`&&await this.client.close()}catch(t){let n=`Error closing client: ${t}`;o.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(t){let n=`Error stopping connection manager: ${t}`;o.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&o.warn(`Resource cleanup finished with ${e.length} issue(s)`)}},N_=class{static{a(this,`ConnectionManager`)}_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),o.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw Error(`Connection was not established`);return this._connection}async stop(){if(this._task&&this._abortController){o.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(e){e instanceof Error&&e.name===`AbortError`?o.debug(`${this.constructor.name} task aborted successfully`):o.warn(`Error stopping ${this.constructor.name} task: ${e}`)}}await this._donePromise,o.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(e=>this._readyResolver=e),this._donePromise=new Promise(e=>this._doneResolver=e),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){o.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),o.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(e){this._exception=e,o.error(`Error in ${this.constructor.name} task: ${e}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(e){o.warn(`Error closing connection in ${this.constructor.name}: ${e}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((e,t)=>{if(!this._abortController)return;let n=this._abortController.signal;if(n.aborted){e();return}let r=a(()=>{n.removeEventListener(`abort`,r),e()},`onAbort`);n.addEventListener(`abort`,r)})}},P_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),F_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=P_(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),Q=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=P_(),n=F_(),r=P_();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=F_();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=ie(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ie(this.rhs,e,n),this}get names(){return re(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=ie(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(ae(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>w(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(oe(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=ie(this.condition,e,t),this}get names(){let e=super.names;return re(e,this.condition),this.else&&w(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=ie(this.iteration,e,t),this}get names(){return w(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return re(re(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=ie(this.iterable,e,t),this}get names(){return w(super.names,this.iterable.names)}},ee=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};ee.kind=`func`;var S=class extends p{render(e){return`return `+super.render(e)}};S.kind=`return`;var C=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&w(e,this.catch.names),this.finally&&w(e,this.finally.names),e}},te=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};te.kind=`catch`;var ne=class extends m{render(e){return`finally`+super.render(e)}};ne.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
61
|
+
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:N.string().optional().describe(`User's language and region preference in BCP 47 format.`),timeZone:N.string().optional().describe(`User's timezone in IANA format.`),userAgent:N.string().optional().describe(`Host application identifier.`),platform:N.union([N.literal(`web`),N.literal(`desktop`),N.literal(`mobile`)]).optional().describe(`Platform type for responsive design decisions.`),deviceCapabilities:N.object({touch:N.boolean().optional().describe(`Whether the device supports touch input.`),hover:N.boolean().optional().describe(`Whether the device supports hover interactions.`)}).optional().describe(`Device input capabilities.`),safeAreaInsets:N.object({top:N.number().describe(`Top safe area inset in pixels.`),right:N.number().describe(`Right safe area inset in pixels.`),bottom:N.number().describe(`Bottom safe area inset in pixels.`),left:N.number().describe(`Left safe area inset in pixels.`)}).optional().describe(`Mobile safe area boundaries in pixels.`)}).passthrough();N.object({method:N.literal(`ui/notifications/host-context-changed`),params:t_.describe(`Partial context update containing only changed fields.`)}),N.object({method:N.literal(`ui/update-model-context`),params:N.object({content:N.array(Bt).optional().describe(`Context content blocks (text, image, etc.).`),structuredContent:N.record(N.string(),N.unknown().describe(`Structured content for machine-readable context data.`)).optional().describe(`Structured content for machine-readable context data.`)})}),N.object({method:N.literal(`ui/initialize`),params:N.object({appInfo:Ae.describe(`App identification (name and version).`),appCapabilities:$g.describe(`Features and capabilities this app provides.`),protocolVersion:N.string().describe(`Protocol version this app supports.`)})}),N.object({protocolVersion:N.string().describe(`Negotiated protocol version string (e.g., "2025-11-21").`),hostInfo:Ae.describe(`Host application identification and version.`),hostCapabilities:Qg.describe(`Features and capabilities provided by the host.`),hostContext:t_.describe(`Rich context about the host environment.`)}).passthrough();var n_=`text/html;profile=mcp-app`,r_=`1.23.0`;function i_(){return r_}a(i_,`getPackageVersion`);var a_=class{static{a(this,`BaseTelemetryEvent`)}},o_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`MCPAgentExecutionEvent`)}get name(){return`mcp_agent_execution`}get properties(){return{execution_method:this.data.executionMethod,query:this.data.query,query_length:this.data.query.length,success:this.data.success,model_provider:this.data.modelProvider,model_name:this.data.modelName,server_count:this.data.serverCount,server_identifiers:this.data.serverIdentifiers,total_tools_available:this.data.totalToolsAvailable,tools_available_names:this.data.toolsAvailableNames,max_steps_configured:this.data.maxStepsConfigured,memory_enabled:this.data.memoryEnabled,use_server_manager:this.data.useServerManager,max_steps_used:this.data.maxStepsUsed,manage_connector:this.data.manageConnector,external_history_used:this.data.externalHistoryUsed,steps_taken:this.data.stepsTaken??null,tools_used_count:this.data.toolsUsedCount??null,tools_used_names:this.data.toolsUsedNames??null,response:this.data.response??null,response_length:this.data.response?this.data.response.length:null,execution_time_ms:this.data.executionTimeMs??null,error_type:this.data.errorType??null,conversation_history_length:this.data.conversationHistoryLength??null}}};function s_(e,t){let n=Array.from(e.registrations.tools.values()),r=Array.from(e.registrations.prompts.values()),i=Array.from(e.registrations.resources.values()),a=Array.from(e.registrations.resourceTemplates.values()),o=i.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,uri:e.config.uri??null,mime_type:e.config.mimeType??null})),s=o.filter(e=>e.mime_type===`text/html+skybridge`),c=o.filter(e=>e.mime_type===`text/uri-list`||e.mime_type===`text/html`),l=o.filter(e=>e.mime_type===n_);return{transport:t,toolsNumber:e.registeredTools.length,resourcesNumber:e.registeredResources.length,promptsNumber:e.registeredPrompts.length,auth:!!e.oauthProvider,name:e.config.name,description:e.config.description??null,baseUrl:e.serverBaseUrl??null,toolNames:e.registeredTools.length>0?e.registeredTools:null,resourceNames:e.registeredResources.length>0?e.registeredResources:null,promptNames:e.registeredPrompts.length>0?e.registeredPrompts:null,tools:n.length>0?n.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,input_schema:e.config.schema?JSON.stringify(e.config.schema):null,output_schema:e.config.outputSchema?JSON.stringify(e.config.outputSchema):null})):null,resources:o.length>0?o:null,prompts:r.length>0?r.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null,args:e.config.args?JSON.stringify(e.config.args):null})):null,templates:a.length>0?a.map(e=>({name:e.config.name,title:e.config.title??null,description:e.config.description??null})):null,capabilities:{logging:!0,resources:{subscribe:!0,listChanged:!0}},appsSdkResources:s.length>0?s:null,appsSdkResourcesNumber:s.length,mcpUiResources:c.length>0?c:null,mcpUiResourcesNumber:c.length,mcpAppsResources:l.length>0?l:null,mcpAppsResourcesNumber:l.length}}a(s_,`createServerRunEventData`);var c_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerRunEvent`)}get name(){return`server_run`}get properties(){return{transport:this.data.transport,tools_number:this.data.toolsNumber,resources_number:this.data.resourcesNumber,prompts_number:this.data.promptsNumber,auth:this.data.auth,name:this.data.name,description:this.data.description??null,base_url:this.data.baseUrl??null,tool_names:this.data.toolNames??null,resource_names:this.data.resourceNames??null,prompt_names:this.data.promptNames??null,tools:this.data.tools??null,resources:this.data.resources??null,prompts:this.data.prompts??null,templates:this.data.templates??null,capabilities:this.data.capabilities?JSON.stringify(this.data.capabilities):null,apps_sdk_resources:this.data.appsSdkResources?JSON.stringify(this.data.appsSdkResources):null,apps_sdk_resources_number:this.data.appsSdkResourcesNumber??0,mcp_ui_resources:this.data.mcpUiResources?JSON.stringify(this.data.mcpUiResources):null,mcp_ui_resources_number:this.data.mcpUiResourcesNumber??0,mcp_apps_resources:this.data.mcpAppsResources?JSON.stringify(this.data.mcpAppsResources):null,mcp_apps_resources_number:this.data.mcpAppsResourcesNumber??0}}},l_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerInitializeEvent`)}get name(){return`server_initialize_call`}get properties(){return{protocol_version:this.data.protocolVersion,client_info:JSON.stringify(this.data.clientInfo),client_capabilities:JSON.stringify(this.data.clientCapabilities),session_id:this.data.sessionId??null}}},u_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerToolCallEvent`)}get name(){return`server_tool_call`}get properties(){return{tool_name:this.data.toolName,length_input_argument:this.data.lengthInputArgument,success:this.data.success,error_type:this.data.errorType??null,execution_time_ms:this.data.executionTimeMs??null}}},d_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerResourceCallEvent`)}get name(){return`server_resource_call`}get properties(){return{name:this.data.name,description:this.data.description,contents:this.data.contents,success:this.data.success,error_type:this.data.errorType??null}}},f_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerPromptCallEvent`)}get name(){return`server_prompt_call`}get properties(){return{name:this.data.name,description:this.data.description,success:this.data.success,error_type:this.data.errorType??null}}},p_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ServerContextEvent`)}get name(){return`server_context_${this.data.contextType}`}get properties(){return{context_type:this.data.contextType,notification_type:this.data.notificationType??null}}},m_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`MCPClientInitEvent`)}get name(){return`mcpclient_init`}get properties(){return{code_mode:this.data.codeMode,sandbox:this.data.sandbox,all_callbacks:this.data.allCallbacks,verify:this.data.verify,servers:this.data.servers,num_servers:this.data.numServers,is_browser:this.data.isBrowser}}},h_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ConnectorInitEvent`)}get name(){return`connector_init`}get properties(){return{connector_type:this.data.connectorType,server_command:this.data.serverCommand??null,server_args:this.data.serverArgs??null,server_url:this.data.serverUrl??null,public_identifier:this.data.publicIdentifier??null}}},g_=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ClientAddServerEvent`)}get name(){return`client_add_server`}get properties(){let{serverName:e,serverConfig:t}=this.data,n=t.url;return{server_name:e,server_url_domain:n?this._extractHostname(n):null,transport:t.transport??null,has_auth:!!(t.authToken||t.authProvider)}}_extractHostname(e){try{return new URL(e).hostname}catch{return null}}},__=class extends a_{constructor(e){super(),this.data=e}static{a(this,`ClientRemoveServerEvent`)}get name(){return`client_remove_server`}get properties(){return{server_name:this.data.serverName}}};function v_(e){return e._llm_type||e.constructor.name.toLowerCase()}a(v_,`getModelProvider`);function y_(e){if(`_identifyingParams`in e){let t=e._identifyingParams;if(typeof t==`object`&&t){for(let e of[`model`,`modelName`,`model_name`,`modelId`,`model_id`,`deploymentName`,`deployment_name`])if(e in t)return String(t[e])}}return e.model||e.modelName||e.constructor.name}a(y_,`getModelName`);function b_(e){return[v_(e),y_(e)]}a(b_,`extractModelInfo`);function x_(){if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.randomUUID==`function`)return globalThis.crypto.randomUUID();if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(16);globalThis.crypto.getRandomValues(e);let t=Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``);return`${t.substring(0,8)}-${t.substring(8,12)}-${t.substring(12,16)}-${t.substring(16,20)}-${t.substring(20)}`}return`${Date.now()}-${Math.random().toString(36).substring(2,15)}-${Math.random().toString(36).substring(2,15)}`}a(x_,`generateUUID`);function S_(){if(typeof window<`u`&&window.crypto&&typeof window.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return window.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}if(typeof globalThis<`u`&&globalThis.crypto&&typeof globalThis.crypto.getRandomValues==`function`){let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).substring(2,15)}a(S_,`secureRandomString`);var C_=`mcp_use_user_id`;function w_(){return typeof localStorage<`u`&&typeof localStorage.getItem==`function`&&typeof localStorage.setItem==`function`&&typeof localStorage.removeItem==`function`}a(w_,`isLocalStorageFunctional`);function T_(){try{return typeof window<`u`&&typeof document<`u`?`browser`:`unknown`}catch{return`unknown`}}a(T_,`detectRuntimeEnvironment`);function E_(e){if(e===`browser`)try{if(w_())return localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`),`localStorage`}catch{}return`session-only`}a(E_,`getStorageCapability`);var D_=null;function O_(){return D_===null&&(D_=T_()),D_}a(O_,`getRuntimeEnvironment`);var k_=class e{static{a(this,`Telemetry`)}static instance=null;PROJECT_API_KEY=`phc_lyTtbYwvkdSbrcMQNPiKiiRWrrM1seyKIMjycSvItEI`;HOST=`https://eu.i.posthog.com`;UNKNOWN_USER_ID=`UNKNOWN_USER_ID`;_currUserId=null;_posthogBrowserClient=null;_posthogLoading=null;_runtimeEnvironment;_storageCapability;_source;constructor(){this._runtimeEnvironment=O_(),this._storageCapability=E_(this._runtimeEnvironment),this._source=this._getSourceFromLocalStorage()||this._runtimeEnvironment;let e=this._checkTelemetryDisabled(),t=this._runtimeEnvironment!==`unknown`;e?(this._posthogBrowserClient=null,o.debug(`Telemetry disabled via localStorage`)):t?(o.info(`Anonymized telemetry enabled. Set MCP_USE_ANONYMIZED_TELEMETRY=false in localStorage to disable.`),this._posthogLoading=this._initPostHogBrowser()):(this._posthogBrowserClient=null,o.debug(`Telemetry disabled - unknown environment: ${this._runtimeEnvironment}`))}_getSourceFromLocalStorage(){try{if(w_())return localStorage.getItem(`MCP_USE_TELEMETRY_SOURCE`)}catch{}return null}_checkTelemetryDisabled(){return!!(w_()&&localStorage.getItem(`MCP_USE_ANONYMIZED_TELEMETRY`)===`false`)}async _initPostHogBrowser(){try{let e=await te(()=>import(`./module-DbiflUeG.js`),[]),t=e.default||e.posthog;if(!t||typeof t.init!=`function`)throw Error(`posthog-js module did not export expected interface`);t.init(this.PROJECT_API_KEY,{api_host:this.HOST,persistence:`localStorage`,autocapture:!1,capture_pageview:!1,disable_session_recording:!0,loaded:a(()=>{o.debug(`PostHog browser client initialized`)},`loaded`)}),this._posthogBrowserClient=t}catch(e){o.warn(`Failed to initialize PostHog browser telemetry: ${e}`),this._posthogBrowserClient=null}}get runtimeEnvironment(){return this._runtimeEnvironment}get storageCapability(){return this._storageCapability}static getInstance(){return e.instance||=new e,e.instance}setSource(e){this._source=e;try{w_()&&localStorage.setItem(`MCP_USE_TELEMETRY_SOURCE`,e)}catch{}o.debug(`Telemetry source set to: ${e}`)}getSource(){return this._source}get isEnabled(){return this._posthogBrowserClient!==null}get userId(){if(this._currUserId)return this._currUserId;try{switch(this._storageCapability){case`localStorage`:this._currUserId=this._getUserIdFromLocalStorage();break;default:try{this._currUserId=`session-${x_()}`}catch{this._currUserId=`session-${Date.now()}-${S_()}`}break}}catch{this._currUserId=this.UNKNOWN_USER_ID}return this._currUserId}_getUserIdFromLocalStorage(){try{if(!w_())throw Error(`localStorage is not available or not functional`);localStorage.setItem(`__mcp_use_test__`,`1`),localStorage.removeItem(`__mcp_use_test__`);let e=localStorage.getItem(C_);if(!e){try{e=x_()}catch{e=`${Date.now()}-${S_()}`}localStorage.setItem(C_,e)}return e}catch(e){o.debug(`Failed to access localStorage for user ID: ${e}`);let t;try{t=`session-${x_()}`}catch{t=`session-${Date.now()}-${S_()}`}return t}}async capture(e){if(this._posthogLoading&&await this._posthogLoading,!this._posthogBrowserClient)return;let t=this.userId,n={...e.properties};if(n.mcp_use_version=i_(),n.language=`typescript`,n.source=this._source,n.runtime=this._runtimeEnvironment,this._posthogBrowserClient)try{this._posthogBrowserClient.capture(e.name,{...n,distinct_id:t})}catch(t){o.debug(`Failed to track PostHog Browser event ${e.name}: ${t}`)}}async trackAgentExecution(e){if(!this.isEnabled)return;let t=new o_(e);await this.capture(t)}async trackServerRunFromServer(e,t){if(!this.isEnabled)return;let n=new c_(s_(e,t));await this.capture(n)}async trackServerInitialize(e){if(!this.isEnabled)return;let t=new l_(e);await this.capture(t)}async trackServerToolCall(e){if(!this.isEnabled)return;let t=new u_(e);await this.capture(t)}async trackServerResourceCall(e){if(!this.isEnabled)return;let t=new d_(e);await this.capture(t)}async trackServerPromptCall(e){if(!this.isEnabled)return;let t=new f_(e);await this.capture(t)}async trackServerContext(e){if(!this.isEnabled)return;let t=new p_(e);await this.capture(t)}async trackMCPClientInit(e){if(!this.isEnabled)return;let t=new m_(e);await this.capture(t)}async trackConnectorInit(e){if(!this.isEnabled)return;let t=new h_(e);await this.capture(t)}async trackClientAddServer(e,t){if(!this.isEnabled)return;let n=new g_({serverName:e,serverConfig:t});await this.capture(n)}async trackClientRemoveServer(e){if(!this.isEnabled)return;let t=new __({serverName:e});await this.capture(t)}async trackUseMcpConnection(e){this.isEnabled&&await this.capture({name:`usemcp_connection`,properties:{url_domain:new URL(e.url).hostname,transport_type:e.transportType,success:e.success,error_type:e.errorType??null,connection_time_ms:e.connectionTimeMs??null,has_oauth:e.hasOAuth,has_sampling:e.hasSampling,has_elicitation:e.hasElicitation}})}async trackUseMcpToolCall(e){this.isEnabled&&await this.capture({name:`usemcp_tool_call`,properties:{tool_name:e.toolName,success:e.success,error_type:e.errorType??null,execution_time_ms:e.executionTimeMs??null}})}async trackUseMcpResourceRead(e){this.isEnabled&&await this.capture({name:`usemcp_resource_read`,properties:{resource_uri_scheme:e.resourceUri.split(`:`)[0],success:e.success,error_type:e.errorType??null}})}identify(e,t){if(this._posthogBrowserClient)try{this._posthogBrowserClient.identify(e,t)}catch(e){o.debug(`Failed to identify user: ${e}`)}}reset(){if(this._posthogBrowserClient)try{this._posthogBrowserClient.reset()}catch(e){o.debug(`Failed to reset user: ${e}`)}this._currUserId=null}flush(){}shutdown(){}async trackPackageDownload(e){}},A_=k_;function j_(e){A_.getInstance().setSource(e)}a(j_,`setTelemetrySource`);var M_=class{static{a(this,`BaseConnector`)}client=null;connectionManager=null;toolsCache=null;capabilitiesCache=null;serverInfoCache=null;connected=!1;opts;notificationHandlers=[];rootsCache=[];constructor(e={}){let t={...e,onSampling:e.onSampling??e.samplingCallback,onElicitation:e.onElicitation??e.elicitationCallback};e.samplingCallback&&!e.onSampling&&o.warn(`[BaseConnector] The "samplingCallback" option is deprecated. Use "onSampling" instead.`),e.elicitationCallback&&!e.onElicitation&&console.warn(`[BaseConnector] The "elicitationCallback" option is deprecated. Use "onElicitation" instead.`),this.opts=t,t.roots&&(this.rootsCache=[...t.roots]),t.onNotification&&this.notificationHandlers.push(t.onNotification)}trackConnectorInit(e){let t=this.constructor.name;k_.getInstance().trackConnectorInit({connectorType:t,...e}).catch(e=>o.debug(`Failed to track connector init: ${e}`))}onNotification(e){this.notificationHandlers.push(e),this.client&&this.setupNotificationHandler()}setupNotificationHandler(){if(!this.client)return;let e=a(async e=>{for(let t of this.notificationHandlers)try{await t(e)}catch(e){o.error(`Error in notification handler:`,e)}},`forwardToUserHandlers`);this.client.fallbackNotificationHandler=async t=>{switch(t.method){case`notifications/tools/list_changed`:await this.refreshToolsCache();break;case`notifications/resources/list_changed`:await this.onResourcesListChanged();break;case`notifications/prompts/list_changed`:await this.onPromptsListChanged();break;default:break}await e(t)};let t=this.client._notificationHandlers;for(let n of[`notifications/progress`,`notifications/cancelled`]){let r=t.get(n);r&&t.set(n,async t=>{await r(t),await e(t)})}}async refreshToolsCache(){if(this.client)try{o.debug(`[Auto] Refreshing tools cache due to list_changed notification`),this.toolsCache=(await this.client.listTools()).tools??[],o.debug(`[Auto] Refreshed tools cache: ${this.toolsCache.length} tools`)}catch(e){o.warn(`[Auto] Failed to refresh tools cache:`,e)}}async onResourcesListChanged(){o.debug(`[Auto] Resources list changed - clients should re-fetch if needed`)}async onPromptsListChanged(){o.debug(`[Auto] Prompts list changed - clients should re-fetch if needed`)}async setRoots(e){this.rootsCache=[...e],this.client&&(o.debug(`Sending roots/list_changed notification with ${e.length} root(s)`),await this.client.sendRootsListChanged())}getRoots(){return[...this.rootsCache]}setupRootsHandler(){this.client&&this.client.setRequestHandler(Nn,async(e,t)=>(o.debug(`Server requested roots list, returning ${this.rootsCache.length} root(s)`),{roots:this.rootsCache}))}setupSamplingHandler(){if(!this.client){o.debug(`setupSamplingHandler: No client available`);return}let e=this.opts.onSampling??this.opts.samplingCallback;if(!e){o.debug(`setupSamplingHandler: No sampling callback provided`);return}o.debug(`setupSamplingHandler: Setting up sampling request handler`),this.client.setRequestHandler(pn,async(t,n)=>(o.debug(`Server requested sampling, forwarding to callback`),await e(t.params))),o.debug(`setupSamplingHandler: Sampling handler registered successfully`)}setupElicitationHandler(){if(!this.client){o.debug(`setupElicitationHandler: No client available`);return}let e=this.opts.onElicitation??this.opts.elicitationCallback;if(!e){o.debug(`setupElicitationHandler: No elicitation callback provided`);return}o.debug(`setupElicitationHandler: Setting up elicitation request handler`),this.client.setRequestHandler(Cn,async(t,n)=>(o.debug(`Server requested elicitation, forwarding to callback`),await e(t.params))),o.debug(`setupElicitationHandler: Elicitation handler registered successfully`)}async disconnect(){if(!this.connected){o.debug(`Not connected to MCP implementation`);return}o.debug(`Disconnecting from MCP implementation`),await this.cleanupResources(),this.connected=!1,o.debug(`Disconnected from MCP implementation`)}get isClientConnected(){return this.client!=null}async initialize(e=this.opts.defaultRequestOptions??{}){if(!this.client)throw Error(`MCP client is not connected`);o.debug(`Caching server capabilities & tools`);let t=this.client.getServerCapabilities();this.capabilitiesCache=t||null;let n=this.client.getServerVersion();this.serverInfoCache=n||null;try{this.toolsCache=(await this.client.listTools(void 0,e)).tools??[],o.debug(`Fetched ${this.toolsCache.length} tools from server`)}catch(e){let t=e;t.code===-32601?o.debug(`Server does not implement tools/list, assuming no tools`):o.debug(`Failed to list tools, assuming empty:`,t.message),this.toolsCache=[]}return o.debug(`Server capabilities:`,t),o.debug(`Server info:`,n),t}get tools(){if(!this.toolsCache)throw Error(`MCP client is not initialized; call initialize() first`);return this.toolsCache}get serverCapabilities(){return this.capabilitiesCache||{}}get serverInfo(){return this.serverInfoCache}async callTool(e,t,n){if(!this.client)throw Error(`MCP client is not connected`);let r=n?{...n}:void 0;r?.resetTimeoutOnProgress&&!r.onprogress&&(r.onprogress=()=>{},o.debug(`[BaseConnector] Added onprogress callback for tool '${e}' to enable progressToken`)),o.debug(`Calling tool '${e}' with args`,t);let i=await this.client.callTool({name:e,arguments:t},void 0,r);return o.debug(`Tool '${e}' returned`,i),i}async listTools(e){if(!this.client)throw Error(`MCP client is not connected`);o.debug(`[listTools] Fetching fresh tools from server...`);let t=await this.client.listTools(void 0,e),n=t.tools?[...t.tools]:[];return o.debug(`[listTools] Returned ${n.length} tools:`,n.map(e=>e.name)),n}async listResources(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Listing resources`,e?`with cursor: ${e}`:``),await this.client.listResources({cursor:e},t)}async listAllResources(e){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.resources)return o.debug(`Server does not advertise resources capability, skipping`),{resources:[]};try{o.debug(`Listing all resources (with auto-pagination)`);let t=[],n;do{let r=await this.client.listResources({cursor:n},e);t.push(...r.resources||[]),n=r.nextCursor}while(n);return{resources:t}}catch(e){if(e.code===-32601)return o.debug(`Server advertised resources but method not found`),{resources:[]};throw e}}async listResourceTemplates(e){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Listing resource templates`),await this.client.listResourceTemplates(void 0,e)}async complete(e,t){if(!this.client)throw Error(`MCP client is not connected`);o.debug(`[complete] Requesting completions for:`,e.ref);let n=await this.client.complete(e,t);return o.debug(`[complete] Received ${n.completion.values.length} suggestions`),n}async readResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Reading resource ${e}`),await this.client.readResource({uri:e},t)}async subscribeToResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Subscribing to resource: ${e}`),await this.client.subscribeResource({uri:e},t)}async unsubscribeFromResource(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Unsubscribing from resource: ${e}`),await this.client.unsubscribeResource({uri:e},t)}async listPrompts(){if(!this.client)throw Error(`MCP client is not connected`);if(!this.capabilitiesCache?.prompts)return o.debug(`Server does not advertise prompts capability, skipping`),{prompts:[]};try{return o.debug(`Listing prompts`),await this.client.listPrompts()}catch(e){if(e.code===-32601)return o.debug(`Server advertised prompts but method not found`),{prompts:[]};throw e}}async getPrompt(e,t){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Getting prompt ${e}`),await this.client.getPrompt({name:e,arguments:t})}async request(e,t=null,n){if(!this.client)throw Error(`MCP client is not connected`);return o.debug(`Sending raw request '${e}' with params`,t),await this.client.request({method:e,params:t??{}},void 0,n)}async cleanupResources(){let e=[];if(this.client)try{typeof this.client.close==`function`&&await this.client.close()}catch(t){let n=`Error closing client: ${t}`;o.warn(n),e.push(n)}finally{this.client=null}if(this.connectionManager)try{await this.connectionManager.stop()}catch(t){let n=`Error stopping connection manager: ${t}`;o.warn(n),e.push(n)}finally{this.connectionManager=null}this.toolsCache=null,e.length&&o.warn(`Resource cleanup finished with ${e.length} issue(s)`)}},N_=class{static{a(this,`ConnectionManager`)}_readyPromise;_readyResolver;_donePromise;_doneResolver;_exception=null;_connection=null;_task=null;_abortController=null;constructor(){this.reset()}async start(){if(this.reset(),o.debug(`Starting ${this.constructor.name}`),this._task=this.connectionTask(),await this._readyPromise,this._exception)throw this._exception;if(this._connection===null)throw Error(`Connection was not established`);return this._connection}async stop(){if(this._task&&this._abortController){o.debug(`Cancelling ${this.constructor.name} task`),this._abortController.abort();try{await this._task}catch(e){e instanceof Error&&e.name===`AbortError`?o.debug(`${this.constructor.name} task aborted successfully`):o.warn(`Error stopping ${this.constructor.name} task: ${e}`)}}await this._donePromise,o.debug(`${this.constructor.name} task completed`)}reset(){this._readyPromise=new Promise(e=>this._readyResolver=e),this._donePromise=new Promise(e=>this._doneResolver=e),this._exception=null,this._connection=null,this._task=null,this._abortController=new AbortController}async connectionTask(){o.debug(`Running ${this.constructor.name} task`);try{this._connection=await this.establishConnection(),o.debug(`${this.constructor.name} connected successfully`),this._readyResolver(),await this.waitForAbort()}catch(e){this._exception=e,o.error(`Error in ${this.constructor.name} task: ${e}`),this._readyResolver()}finally{if(this._connection!==null){try{await this.closeConnection(this._connection)}catch(e){o.warn(`Error closing connection in ${this.constructor.name}: ${e}`)}this._connection=null}this._doneResolver()}}async waitForAbort(){return new Promise((e,t)=>{if(!this._abortController)return;let n=this._abortController.signal;if(n.aborted){e();return}let r=a(()=>{n.removeEventListener(`abort`,r),e()},`onAbort`);n.addEventListener(`abort`,r)})}},P_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var n=class extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw Error(`CodeGen: name must be a valid identifier`);this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=n;var r=class extends t{constructor(e){super(),this._items=typeof e==`string`?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===``||e===`""`}get str(){return this._str??=this._items.reduce((e,t)=>`${e}${t}`,``)}get names(){return this._names??=this._items.reduce((e,t)=>(t instanceof n&&(e[t.str]=(e[t.str]||0)+1),e),{})}};e._Code=r,e.nil=new r(``);function i(e,...t){let n=[e[0]],i=0;for(;i<t.length;)s(n,t[i]),n.push(e[++i]);return new r(n)}e._=i;var a=new r(`+`);function o(e,...t){let n=[p(e[0])],i=0;for(;i<t.length;)n.push(a),s(n,t[i]),n.push(a,p(e[++i]));return c(n),new r(n)}e.str=o;function s(e,t){t instanceof r?e.push(...t._items):t instanceof n?e.push(t):e.push(d(t))}e.addCodeArg=s;function c(e){let t=1;for(;t<e.length-1;){if(e[t]===a){let n=l(e[t-1],e[t+1]);if(n!==void 0){e.splice(t-1,3,n);continue}e[t++]=`+`}t++}}function l(e,t){if(t===`""`)return e;if(e===`""`)return t;if(typeof e==`string`)return t instanceof n||e[e.length-1]!==`"`?void 0:typeof t==`string`?t[0]===`"`?e.slice(0,-1)+t.slice(1):void 0:`${e.slice(0,-1)}${t}"`;if(typeof t==`string`&&t[0]===`"`&&!(e instanceof n))return`"${e}${t.slice(1)}`}function u(e,t){return t.emptyStr()?e:e.emptyStr()?t:o`${e}${t}`}e.strConcat=u;function d(e){return typeof e==`number`||typeof e==`boolean`||e===null?e:p(Array.isArray(e)?e.join(`,`):e)}function f(e){return new r(p(e))}e.stringify=f;function p(e){return JSON.stringify(e).replace(/\u2028/g,`\\u2028`).replace(/\u2029/g,`\\u2029`)}e.safeStringify=p;function m(t){return typeof t==`string`&&e.IDENTIFIER.test(t)?new r(`.${t}`):i`[${t}]`}e.getProperty=m;function h(t){if(typeof t==`string`&&e.IDENTIFIER.test(t))return new r(`${t}`);throw Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}e.getEsmExportName=h;function g(e){return new r(e.toString())}e.regexpCode=g})),F_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;var t=P_(),n=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},r;(function(e){e[e.Started=0]=`Started`,e[e.Completed=1]=`Completed`})(r||(e.UsedValueState=r={})),e.varKinds={const:new t.Name(`const`),let:new t.Name(`let`),var:new t.Name(`var`)};var i=class{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){let t=this._names[e]||this._nameGroup(e);return`${e}${t.index++}`}_nameGroup(e){if((this._parent?._prefixes)?.has(e)||this._prefixes&&!this._prefixes.has(e))throw Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};e.Scope=i;var a=class extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:n,itemIndex:r}){this.value=e,this.scopePath=(0,t._)`.${new t.Name(n)}[${r}]`}};e.ValueScopeName=a;var o=(0,t._)`\n`;e.ValueScope=class extends i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?o:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){if(t.ref===void 0)throw Error(`CodeGen: ref must be passed in value`);let n=this.toName(e),{prefix:r}=n,i=t.key??t.ref,a=this._values[r];if(a){let e=a.get(i);if(e)return e}else a=this._values[r]=new Map;a.set(i,n);let o=this._scope[r]||(this._scope[r]=[]),s=o.length;return o[s]=t.ref,n.setValue(t,{property:r,itemIndex:s}),n}getValue(e,t){let n=this._values[e];if(n)return n.get(t)}scopeRefs(e,n=this._values){return this._reduceValues(n,n=>{if(n.scopePath===void 0)throw Error(`CodeGen: name "${n}" has no value`);return(0,t._)`${e}${n.scopePath}`})}scopeCode(e=this._values,t,n){return this._reduceValues(e,e=>{if(e.value===void 0)throw Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,n)}_reduceValues(i,a,o={},s){let c=t.nil;for(let l in i){let u=i[l];if(!u)continue;let d=o[l]=o[l]||new Map;u.forEach(i=>{if(d.has(i))return;d.set(i,r.Started);let o=a(i);if(o){let n=this.opts.es5?e.varKinds.var:e.varKinds.const;c=(0,t._)`${c}${n} ${i} = ${o};${this.opts._n}`}else if(o=s?.(i))c=(0,t._)`${c}${o}${this.opts._n}`;else throw new n(i);d.set(i,r.Completed)})}return c}}})),Q=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;var t=P_(),n=F_(),r=P_();Object.defineProperty(e,`_`,{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,`str`,{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,`strConcat`,{enumerable:!0,get:function(){return r.strConcat}}),Object.defineProperty(e,`nil`,{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,`getProperty`,{enumerable:!0,get:function(){return r.getProperty}}),Object.defineProperty(e,`stringify`,{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,`regexpCode`,{enumerable:!0,get:function(){return r.regexpCode}}),Object.defineProperty(e,`Name`,{enumerable:!0,get:function(){return r.Name}});var i=F_();Object.defineProperty(e,`Scope`,{enumerable:!0,get:function(){return i.Scope}}),Object.defineProperty(e,`ValueScope`,{enumerable:!0,get:function(){return i.ValueScope}}),Object.defineProperty(e,`ValueScopeName`,{enumerable:!0,get:function(){return i.ValueScopeName}}),Object.defineProperty(e,`varKinds`,{enumerable:!0,get:function(){return i.varKinds}}),e.operators={GT:new t._Code(`>`),GTE:new t._Code(`>=`),LT:new t._Code(`<`),LTE:new t._Code(`<=`),EQ:new t._Code(`===`),NEQ:new t._Code(`!==`),NOT:new t._Code(`!`),OR:new t._Code(`||`),AND:new t._Code(`&&`),ADD:new t._Code(`+`)};var a=class{optimizeNodes(){return this}optimizeNames(e,t){return this}},o=class extends a{constructor(e,t,n){super(),this.varKind=e,this.name=t,this.rhs=n}render({es5:e,_n:t}){let r=e?n.varKinds.var:this.varKind,i=this.rhs===void 0?``:` = ${this.rhs}`;return`${r} ${this.name}${i};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&=ie(this.rhs,e,t),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},s=class extends a{constructor(e,t,n){super(),this.lhs=e,this.rhs=t,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,n){if(!(this.lhs instanceof t.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=ie(this.rhs,e,n),this}get names(){return re(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},c=class extends s{constructor(e,t,n,r){super(e,n,r),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},l=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},u=class extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:``};`+e}},d=class extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},f=class extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=ie(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},p=class extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,n)=>t+n.render(e),``)}optimizeNodes(){let{nodes:e}=this,t=e.length;for(;t--;){let n=e[t].optimizeNodes();Array.isArray(n)?e.splice(t,1,...n):n?e[t]=n:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){let{nodes:n}=this,r=n.length;for(;r--;){let i=n[r];i.optimizeNames(e,t)||(ae(e,i.names),n.splice(r,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>w(e,t.names),{})}},m=class extends p{render(e){return`{`+e._n+super.render(e)+`}`+e._n}},h=class extends p{},g=class extends m{};g.kind=`else`;var _=class e extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+=`else `+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();let t=this.condition;if(t===!0)return this.nodes;let n=this.else;if(n){let e=n.optimizeNodes();n=this.else=Array.isArray(e)?new g(e):e}if(n)return t===!1?n instanceof e?n:n.nodes:this.nodes.length?this:new e(oe(t),n instanceof e?[n]:n.nodes);if(!(t===!1||!this.nodes.length))return this}optimizeNames(e,t){if(this.else=this.else?.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=ie(this.condition,e,t),this}get names(){let e=super.names;return re(e,this.condition),this.else&&w(e,this.else.names),e}};_.kind=`if`;var v=class extends m{};v.kind=`for`;var y=class extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=ie(this.iteration,e,t),this}get names(){return w(super.names,this.iteration.names)}},b=class extends v{constructor(e,t,n,r){super(),this.varKind=e,this.name=t,this.from=n,this.to=r}render(e){let t=e.es5?n.varKinds.var:this.varKind,{name:r,from:i,to:a}=this;return`for(${t} ${r}=${i}; ${r}<${a}; ${r}++)`+super.render(e)}get names(){return re(re(super.names,this.from),this.to)}},x=class extends v{constructor(e,t,n,r){super(),this.loop=e,this.varKind=t,this.name=n,this.iterable=r}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=ie(this.iterable,e,t),this}get names(){return w(super.names,this.iterable.names)}},ee=class extends m{constructor(e,t,n){super(),this.name=e,this.args=t,this.async=n}render(e){return`${this.async?`async `:``}function ${this.name}(${this.args})`+super.render(e)}};ee.kind=`func`;var S=class extends p{render(e){return`return `+super.render(e)}};S.kind=`return`;var C=class extends m{render(e){let t=`try`+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),(e=this.catch)==null||e.optimizeNodes(),(t=this.finally)==null||t.optimizeNodes(),this}optimizeNames(e,t){var n,r;return super.optimizeNames(e,t),(n=this.catch)==null||n.optimizeNames(e,t),(r=this.finally)==null||r.optimizeNames(e,t),this}get names(){let e=super.names;return this.catch&&w(e,this.catch.names),this.finally&&w(e,this.finally.names),e}},te=class extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};te.kind=`catch`;var ne=class extends m{render(e){return`finally`+super.render(e)}};ne.kind=`finally`,e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?`
|
|
62
62
|
`:``},this._extScope=e,this._scope=new n.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){let n=this._extScope.value(e,t);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,n,r){let i=this._scope.toName(t);return n!==void 0&&r&&(this._constants[i.str]=n),this._leafNode(new o(e,i,n)),i}const(e,t,r){return this._def(n.varKinds.const,e,t,r)}let(e,t,r){return this._def(n.varKinds.let,e,t,r)}var(e,t,r){return this._def(n.varKinds.var,e,t,r)}assign(e,t,n){return this._leafNode(new s(e,t,n))}add(t,n){return this._leafNode(new c(t,e.operators.ADD,n))}code(e){return typeof e==`function`?e():e!==t.nil&&this._leafNode(new f(e)),this}object(...e){let n=[`{`];for(let[r,i]of e)n.length>1&&n.push(`,`),n.push(r),(r!==i||this.opts.es5)&&(n.push(`:`),(0,t.addCodeArg)(n,i));return n.push(`}`),new t._Code(n)}if(e,t,n){if(this._blockNode(new _(e)),t&&n)this.code(t).else().code(n).endIf();else if(t)this.code(t).endIf();else if(n)throw Error(`CodeGen: "else" body without "then" body`);return this}elseIf(e){return this._elseNode(new _(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(_,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new y(e),t)}forRange(e,t,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.let){let o=this._scope.toName(e);return this._for(new b(a,o,t,r),()=>i(o))}forOf(e,r,i,a=n.varKinds.const){let o=this._scope.toName(e);if(this.opts.es5){let e=r instanceof t.Name?r:this.var(`_arr`,r);return this.forRange(`_i`,0,(0,t._)`${e}.length`,n=>{this.var(o,(0,t._)`${e}[${n}]`),i(o)})}return this._for(new x(`of`,a,o,r),()=>i(o))}forIn(e,r,i,a=this.opts.es5?n.varKinds.var:n.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,t._)`Object.keys(${r})`,i);let o=this._scope.toName(e);return this._for(new x(`in`,a,o,r),()=>i(o))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new u(e))}return(e){let t=new S;if(this._blockNode(t),this.code(e),t.nodes.length!==1)throw Error(`CodeGen: "return" should have one node`);return this._endBlockNode(S)}try(e,t,n){if(!t&&!n)throw Error(`CodeGen: "try" without "catch" and "finally"`);let r=new C;if(this._blockNode(r),this.code(e),t){let e=this.name(`e`);this._currNode=r.catch=new te(e),t(e)}return n&&(this._currNode=r.finally=new ne,this.code(n)),this._endBlockNode(te,ne)}throw(e){return this._leafNode(new d(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){let t=this._blockStarts.pop();if(t===void 0)throw Error(`CodeGen: not in self-balancing block`);let n=this._nodes.length-t;if(n<0||e!==void 0&&n!==e)throw Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=t,this}func(e,n=t.nil,r,i){return this._blockNode(new ee(e,n,r)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(ee)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){let n=this._currNode;if(n instanceof e||t&&n instanceof t)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){let t=this._currNode;if(!(t instanceof _))throw Error(`CodeGen: "else" without "if"`);return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let t=this._nodes;t[t.length-1]=e}};function w(e,t){for(let n in t)e[n]=(e[n]||0)+(t[n]||0);return e}function re(e,n){return n instanceof t._CodeOrName?w(e,n.names):e}function ie(e,n,r){if(e instanceof t.Name)return i(e);if(!a(e))return e;return new t._Code(e._items.reduce((e,n)=>(n instanceof t.Name&&(n=i(n)),n instanceof t._Code?e.push(...n._items):e.push(n),e),[]));function i(e){let t=r[e.str];return t===void 0||n[e.str]!==1?e:(delete n[e.str],t)}function a(e){return e instanceof t._Code&&e._items.some(e=>e instanceof t.Name&&n[e.str]===1&&r[e.str]!==void 0)}}function ae(e,t){for(let n in t)e[n]=(e[n]||0)-(t[n]||0)}function oe(e){return typeof e==`boolean`||typeof e==`number`||e===null?!e:(0,t._)`!${de(e)}`}e.not=oe;var se=ue(e.operators.AND);function T(...e){return e.reduce(se)}e.and=T;var ce=ue(e.operators.OR);function le(...e){return e.reduce(ce)}e.or=le;function ue(e){return(n,r)=>n===t.nil?r:r===t.nil?n:(0,t._)`${de(n)} ${e} ${de(r)}`}function de(e){return e instanceof t.Name?e:(0,t._)`(${e})`}})),$=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;var t=Q(),n=P_();function r(e){let t={};for(let n of e)t[n]=!0;return t}e.toHash=r;function i(e,t){return typeof t==`boolean`?t:Object.keys(t).length===0?!0:(a(e,t),!o(t,e.self.RULES.all))}e.alwaysValidSchema=i;function a(e,t=e.schema){let{opts:n,self:r}=e;if(!n.strictSchema||typeof t==`boolean`)return;let i=r.RULES.keywords;for(let n in t)i[n]||x(e,`unknown keyword: "${n}"`)}e.checkUnknownRules=a;function o(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(t[n])return!0;return!1}e.schemaHasRules=o;function s(e,t){if(typeof e==`boolean`)return!e;for(let n in e)if(n!==`$ref`&&t.all[n])return!0;return!1}e.schemaHasRulesButRef=s;function c({topSchemaRef:e,schemaPath:n},r,i,a){if(!a){if(typeof r==`number`||typeof r==`boolean`)return r;if(typeof r==`string`)return(0,t._)`${r}`}return(0,t._)`${e}${n}${(0,t.getProperty)(i)}`}e.schemaRefOrVal=c;function l(e){return f(decodeURIComponent(e))}e.unescapeFragment=l;function u(e){return encodeURIComponent(d(e))}e.escapeFragment=u;function d(e){return typeof e==`number`?`${e}`:e.replace(/~/g,`~0`).replace(/\//g,`~1`)}e.escapeJsonPointer=d;function f(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}e.unescapeJsonPointer=f;function p(e,t){if(Array.isArray(e))for(let n of e)t(n);else t(e)}e.eachItem=p;function m({mergeNames:e,mergeToName:n,mergeValues:r,resultToName:i}){return(a,o,s,c)=>{let l=s===void 0?o:s instanceof t.Name?(o instanceof t.Name?e(a,o,s):n(a,o,s),s):o instanceof t.Name?(n(a,s,o),o):r(o,s);return c===t.Name&&!(l instanceof t.Name)?i(a,l):l}}e.mergeEvaluated={props:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>{e.if((0,t._)`${n} === true`,()=>e.assign(r,!0),()=>e.assign(r,(0,t._)`${r} || {}`).code((0,t._)`Object.assign(${r}, ${n})`))}),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>{n===!0?e.assign(r,!0):(e.assign(r,(0,t._)`${r} || {}`),g(e,r,n))}),mergeValues:(e,t)=>e===!0?!0:{...e,...t},resultToName:h}),items:m({mergeNames:(e,n,r)=>e.if((0,t._)`${r} !== true && ${n} !== undefined`,()=>e.assign(r,(0,t._)`${n} === true ? true : ${r} > ${n} ? ${r} : ${n}`)),mergeToName:(e,n,r)=>e.if((0,t._)`${r} !== true`,()=>e.assign(r,n===!0?!0:(0,t._)`${r} > ${n} ? ${r} : ${n}`)),mergeValues:(e,t)=>e===!0?!0:Math.max(e,t),resultToName:(e,t)=>e.var(`items`,t)})};function h(e,n){if(n===!0)return e.var(`props`,!0);let r=e.var(`props`,(0,t._)`{}`);return n!==void 0&&g(e,r,n),r}e.evaluatedPropsToName=h;function g(e,n,r){Object.keys(r).forEach(r=>e.assign((0,t._)`${n}${(0,t.getProperty)(r)}`,!0))}e.setEvaluated=g;var _={};function v(e,t){return e.scopeValue(`func`,{ref:t,code:_[t.code]||(_[t.code]=new n._Code(t.code))})}e.useFunc=v;var y;(function(e){e[e.Num=0]=`Num`,e[e.Str=1]=`Str`})(y||(e.Type=y={}));function b(e,n,r){if(e instanceof t.Name){let i=n===y.Num;return r?i?(0,t._)`"[" + ${e} + "]"`:(0,t._)`"['" + ${e} + "']"`:i?(0,t._)`"/" + ${e}`:(0,t._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,t.getProperty)(e).toString():`/`+d(e)}e.getErrorPath=b;function x(e,t,n=e.opts.strictSchema){if(n){if(t=`strict mode: ${t}`,n===!0)throw Error(t);e.self.logger.warn(t)}}e.checkStrictMode=x})),I_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t=Q();e.default={data:new t.Name(`data`),valCxt:new t.Name(`valCxt`),instancePath:new t.Name(`instancePath`),parentData:new t.Name(`parentData`),parentDataProperty:new t.Name(`parentDataProperty`),rootData:new t.Name(`rootData`),dynamicAnchors:new t.Name(`dynamicAnchors`),vErrors:new t.Name(`vErrors`),errors:new t.Name(`errors`),this:new t.Name(`this`),self:new t.Name(`self`),scope:new t.Name(`scope`),json:new t.Name(`json`),jsonPos:new t.Name(`jsonPos`),jsonLen:new t.Name(`jsonLen`),jsonPart:new t.Name(`jsonPart`)}})),L_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;var t=Q(),n=$(),r=I_();e.keywordError={message:({keyword:e})=>(0,t.str)`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:n})=>n?(0,t.str)`"${e}" keyword must be ${n} ($data)`:(0,t.str)`"${e}" keyword is invalid ($data)`};function i(n,r=e.keywordError,i,a){let{it:o}=n,{gen:s,compositeRule:u,allErrors:f}=o,p=d(n,r,i);a??(u||f)?c(s,p):l(o,(0,t._)`[${p}]`)}e.reportError=i;function a(t,n=e.keywordError,i){let{it:a}=t,{gen:o,compositeRule:s,allErrors:u}=a;c(o,d(t,n,i)),s||u||l(a,r.default.vErrors)}e.reportExtraError=a;function o(e,n){e.assign(r.default.errors,n),e.if((0,t._)`${r.default.vErrors} !== null`,()=>e.if(n,()=>e.assign((0,t._)`${r.default.vErrors}.length`,n),()=>e.assign(r.default.vErrors,null)))}e.resetErrorsCount=o;function s({gen:e,keyword:n,schemaValue:i,data:a,errsCount:o,it:s}){if(o===void 0)throw Error(`ajv implementation error`);let c=e.name(`err`);e.forRange(`i`,o,r.default.errors,o=>{e.const(c,(0,t._)`${r.default.vErrors}[${o}]`),e.if((0,t._)`${c}.instancePath === undefined`,()=>e.assign((0,t._)`${c}.instancePath`,(0,t.strConcat)(r.default.instancePath,s.errorPath))),e.assign((0,t._)`${c}.schemaPath`,(0,t.str)`${s.errSchemaPath}/${n}`),s.opts.verbose&&(e.assign((0,t._)`${c}.schema`,i),e.assign((0,t._)`${c}.data`,a))})}e.extendErrors=s;function c(e,n){let i=e.const(`err`,n);e.if((0,t._)`${r.default.vErrors} === null`,()=>e.assign(r.default.vErrors,(0,t._)`[${i}]`),(0,t._)`${r.default.vErrors}.push(${i})`),e.code((0,t._)`${r.default.errors}++`)}function l(e,n){let{gen:r,validateName:i,schemaEnv:a}=e;a.$async?r.throw((0,t._)`new ${e.ValidationError}(${n})`):(r.assign((0,t._)`${i}.errors`,n),r.return(!1))}var u={keyword:new t.Name(`keyword`),schemaPath:new t.Name(`schemaPath`),params:new t.Name(`params`),propertyName:new t.Name(`propertyName`),message:new t.Name(`message`),schema:new t.Name(`schema`),parentSchema:new t.Name(`parentSchema`)};function d(e,n,r){let{createErrors:i}=e.it;return i===!1?(0,t._)`{}`:f(e,n,r)}function f(e,t,n={}){let{gen:r,it:i}=e,a=[p(i,n),m(e,n)];return h(e,t,a),r.object(...a)}function p({errorPath:e},{instancePath:i}){let a=i?(0,t.str)`${e}${(0,n.getErrorPath)(i,n.Type.Str)}`:e;return[r.default.instancePath,(0,t.strConcat)(r.default.instancePath,a)]}function m({keyword:e,it:{errSchemaPath:r}},{schemaPath:i,parentSchema:a}){let o=a?r:(0,t.str)`${r}/${e}`;return i&&(o=(0,t.str)`${o}${(0,n.getErrorPath)(i,n.Type.Str)}`),[u.schemaPath,o]}function h(e,{params:n,message:i},a){let{keyword:o,data:s,schemaValue:c,it:l}=e,{opts:d,propertyName:f,topSchemaRef:p,schemaPath:m}=l;a.push([u.keyword,o],[u.params,typeof n==`function`?n(e):n||(0,t._)`{}`]),d.messages&&a.push([u.message,typeof i==`function`?i(e):i]),d.verbose&&a.push([u.schema,c],[u.parentSchema,(0,t._)`${p}${m}`],[r.default.data,s]),f&&a.push([u.propertyName,f])}})),R_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;var t=L_(),n=Q(),r=I_(),i={message:`boolean schema is false`};function a(e){let{gen:t,schema:i,validateName:a}=e;i===!1?s(e,!1):typeof i==`object`&&i.$async===!0?t.return(r.default.data):(t.assign((0,n._)`${a}.errors`,null),t.return(!0))}e.topBoolOrEmptySchema=a;function o(e,t){let{gen:n,schema:r}=e;r===!1?(n.var(t,!1),s(e)):n.var(t,!0)}e.boolOrEmptySchema=o;function s(e,n){let{gen:r,data:a}=e,o={gen:r,keyword:`false schema`,data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:e};(0,t.reportError)(o,i,void 0,n)}})),z_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getRules=e.isJSONType=void 0;var t=new Set([`string`,`number`,`integer`,`boolean`,`null`,`object`,`array`]);function n(e){return typeof e==`string`&&t.has(e)}e.isJSONType=n;function r(){let e={number:{type:`number`,rules:[]},string:{type:`string`,rules:[]},array:{type:`array`,rules:[]},object:{type:`object`,rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=r})),B_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:e,self:t},r){let i=t.RULES.types[r];return i&&i!==!0&&n(e,i)}e.schemaHasRulesForType=t;function n(e,t){return t.rules.some(t=>r(e,t))}e.shouldUseGroup=n;function r(e,t){return e[t.keyword]!==void 0||t.definition.implements?.some(t=>e[t]!==void 0)}e.shouldUseRule=r})),V_=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;var t=z_(),n=B_(),r=L_(),i=Q(),a=$(),o;(function(e){e[e.Correct=0]=`Correct`,e[e.Wrong=1]=`Wrong`})(o||(e.DataType=o={}));function s(e){let t=c(e.type);if(t.includes(`null`)){if(e.nullable===!1)throw Error(`type: null contradicts nullable: false`)}else{if(!t.length&&e.nullable!==void 0)throw Error(`"nullable" cannot be used without "type"`);e.nullable===!0&&t.push(`null`)}return t}e.getSchemaTypes=s;function c(e){let n=Array.isArray(e)?e:e?[e]:[];if(n.every(t.isJSONType))return n;throw Error(`type must be JSONType or JSONType[]: `+n.join(`,`))}e.getJSONTypes=c;function l(e,t){let{gen:r,data:i,opts:a}=e,s=d(t,a.coerceTypes),c=t.length>0&&!(s.length===0&&t.length===1&&(0,n.schemaHasRulesForType)(e,t[0]));if(c){let n=h(t,i,a.strictNumbers,o.Wrong);r.if(n,()=>{s.length?f(e,t,s):_(e)})}return c}e.coerceAndCheckDataType=l;var u=new Set([`string`,`number`,`integer`,`boolean`,`null`]);function d(e,t){return t?e.filter(e=>u.has(e)||t===`array`&&e===`array`):[]}function f(e,t,n){let{gen:r,data:a,opts:o}=e,s=r.let(`dataType`,(0,i._)`typeof ${a}`),c=r.let(`coerced`,(0,i._)`undefined`);o.coerceTypes===`array`&&r.if((0,i._)`${s} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>r.assign(a,(0,i._)`${a}[0]`).assign(s,(0,i._)`typeof ${a}`).if(h(t,a,o.strictNumbers),()=>r.assign(c,a))),r.if((0,i._)`${c} !== undefined`);for(let e of n)(u.has(e)||e===`array`&&o.coerceTypes===`array`)&&l(e);r.else(),_(e),r.endIf(),r.if((0,i._)`${c} !== undefined`,()=>{r.assign(a,c),p(e,c)});function l(e){switch(e){case`string`:r.elseIf((0,i._)`${s} == "number" || ${s} == "boolean"`).assign(c,(0,i._)`"" + ${a}`).elseIf((0,i._)`${a} === null`).assign(c,(0,i._)`""`);return;case`number`:r.elseIf((0,i._)`${s} == "boolean" || ${a} === null
|
|
63
63
|
|| (${s} == "string" && ${a} && ${a} == +${a})`).assign(c,(0,i._)`+${a}`);return;case`integer`:r.elseIf((0,i._)`${s} === "boolean" || ${a} === null
|
|
64
64
|
|| (${s} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(c,(0,i._)`+${a}`);return;case`boolean`:r.elseIf((0,i._)`${a} === "false" || ${a} === 0 || ${a} === null`).assign(c,!1).elseIf((0,i._)`${a} === "true" || ${a} === 1`).assign(c,!0);return;case`null`:r.elseIf((0,i._)`${a} === "" || ${a} === 0 || ${a} === false`),r.assign(c,null);return;case`array`:r.elseIf((0,i._)`${s} === "string" || ${s} === "number"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-DlypDwtn.js","assets/chunk-zsgVPwQN.js","assets/core-CsUyNVs5.js","assets/1c-AGlpZ3Bo.js","assets/abnf-CY04oKOo.js","assets/accesslog-BW-XYbZ-.js","assets/actionscript-CyrdwIe8.js","assets/ada-C-TrrrBy.js","assets/angelscript-CRTYantF.js","assets/apache-BtWb7jui.js","assets/applescript-B5uiivcX.js","assets/arcade-CKXflcFV.js","assets/arduino-9WdEHP7F.js","assets/armasm-B1n3-9gm.js","assets/asciidoc-DnpyabXI.js","assets/aspectj-DHfRYIO6.js","assets/autohotkey-D4kyAzbx.js","assets/autoit-Dkm5j0Id.js","assets/avrasm-DDWyveTc.js","assets/awk-0C9tJhw5.js","assets/axapta-7WyvVgTr.js","assets/bash-BU3h1nvY.js","assets/basic-cvnVWdBh.js","assets/bnf-DqQP6RvA.js","assets/brainfuck-9Gnm7MFh.js","assets/c-like-DQRMjEeJ.js","assets/c-CR0xII_C.js","assets/cal-BupHjSW7.js","assets/capnproto-BJz3QcqE.js","assets/ceylon-Cm5BiqjN.js","assets/clean-yd5cdwwQ.js","assets/clojure-repl-4mYnspW8.js","assets/clojure-BEy8uY0S.js","assets/cmake-D6UxhUeW.js","assets/coffeescript-BKMS6sen.js","assets/coq-ByIcAboL.js","assets/cos-WtGXvK46.js","assets/cpp-7GTPyvMa.js","assets/crmsh-C5mOafXq.js","assets/crystal-CDkEXhx-.js","assets/csharp-BB5evbyJ.js","assets/csp-C5gCtA0-.js","assets/css-BxJzVbPg.js","assets/d-pa4_Cp7t.js","assets/dart-BX2VLXw3.js","assets/delphi-DdHGjuIZ.js","assets/diff-CBEZzUzk.js","assets/django-D4YuT7a9.js","assets/dns-r4HMRPCv.js","assets/dockerfile-ZfcC6nOD.js","assets/dos-CIXc_2yf.js","assets/dsconfig-DlugHtUP.js","assets/dts-DaEIYGjQ.js","assets/dust-D5BPeLmO.js","assets/ebnf-FDSeI3Uq.js","assets/elixir-BW6MO0JC.js","assets/elm-DlEB7oVS.js","assets/erb-Cfqar-lN.js","assets/erlang-repl-ynjzGTyJ.js","assets/erlang-CAmVwVgE.js","assets/excel-B4xDzPh0.js","assets/fix-DrIaqPya.js","assets/flix-C1QBAYX7.js","assets/fortran-13hn1qLz.js","assets/fsharp-DsthWJmP.js","assets/gams-CCIHfrc2.js","assets/gauss-DPE0fKXo.js","assets/gcode-Cnu_Eke-.js","assets/gherkin-6DphholZ.js","assets/glsl-bxnyXALN.js","assets/gml-CNHkNLih.js","assets/go-CNn2XrbH.js","assets/golo-DiSoln2k.js","assets/gradle-DwRwgn-A.js","assets/groovy-B5vHRPUi.js","assets/haml-DyyQV85z.js","assets/handlebars-BAEJweq7.js","assets/haskell-ChxeibtB.js","assets/haxe-Bnvb8PoO.js","assets/hsp-BdBjqG0g.js","assets/htmlbars-Dco0ls0x.js","assets/http-BQrDnbm9.js","assets/hy-j_gy-_-v.js","assets/inform7-4lpsdkpY.js","assets/ini-CyoU_M9N.js","assets/irpf90-CA5ICZkt.js","assets/isbl-D5MCB9gL.js","assets/java-C_cNvtw0.js","assets/javascript-Cx9Fh-yC.js","assets/jboss-cli-n0a6upZq.js","assets/json-pS218i2Y.js","assets/julia-repl-DoKEpX79.js","assets/julia-ByIGgcyj.js","assets/kotlin-D7EVUsdH.js","assets/lasso-CfHzza_u.js","assets/latex-DEpVEzU4.js","assets/ldif-CztKIlXq.js","assets/leaf-BeXHCQvG.js","assets/less-BYuoMNFC.js","assets/lisp-DENj9Gb0.js","assets/livecodeserver-DzZuZBA6.js","assets/livescript-Dcoaf4MP.js","assets/llvm-B_NkXFs1.js","assets/lsl-sr9xRjsv.js","assets/lua-DOwApfze.js","assets/makefile-Dnbo7dYF.js","assets/markdown-DGgwjJWS.js","assets/mathematica-DvU9l120.js","assets/matlab-flr6798G.js","assets/maxima-DCd2nSGc.js","assets/mel-NmXTNXHL.js","assets/mercury-PVmYLiQ2.js","assets/mipsasm-LHYPiOXU.js","assets/mizar-BbJKfTOL.js","assets/mojolicious-Dw8SBiyk.js","assets/monkey-CYCsHKco.js","assets/moonscript-BndWJdyg.js","assets/n1ql-p64i6r1f.js","assets/nginx-Clg11n23.js","assets/nim-BF6erjkH.js","assets/nix-aqHU_7Cj.js","assets/node-repl-DuuOln4U.js","assets/nsis-BZNwabo3.js","assets/objectivec-BD-A2eRS.js","assets/ocaml-Dtfm3HD8.js","assets/openscad-3uP221Jx.js","assets/oxygene-DBIMAfJO.js","assets/parser3-C9bjRYvd.js","assets/perl-Be1CLDbh.js","assets/pf-BEYn9RX1.js","assets/pgsql-Bp-7Jjz8.js","assets/php-template-5wDTa_KR.js","assets/php-D8HtobZG.js","assets/plaintext-DF3cBN5Y.js","assets/pony-CA_LuLTd.js","assets/powershell-CfylS3qM.js","assets/processing-BOdw1uey.js","assets/profile-BMNLdTbz.js","assets/prolog-wnuVaQNI.js","assets/properties-BY2UjzIx.js","assets/protobuf-W4tuiDUG.js","assets/puppet-CcAPsi7F.js","assets/purebasic-Cx_iSilj.js","assets/python-repl-B1V7zIpU.js","assets/python-DtGc5unX.js","assets/q-DwgFecwj.js","assets/qml-CxtqwNEV.js","assets/r-Vyl1b83h.js","assets/reasonml-D1BWml10.js","assets/rib-WKK4Jb_l.js","assets/roboconf-DD9St8Le.js","assets/routeros-DIyDrw3W.js","assets/rsl-CfigMFVZ.js","assets/ruby-YHScF8rv.js","assets/ruleslanguage-BYwdQsZF.js","assets/rust-B5YXnMyV.js","assets/sas-CCTr8w16.js","assets/scala-Cbxd3VFS.js","assets/scheme-BsN3DINT.js","assets/scilab-DPKVNXPG.js","assets/scss-DbQAKOek.js","assets/shell-DWzkAqOf.js","assets/smali-BftjeLb5.js","assets/smalltalk-CRiQmXNN.js","assets/sml-StzcQc9I.js","assets/sqf-DD5HJChz.js","assets/sql-DPgh6LFW.js","assets/sql_more-CtzXbTQc.js","assets/stan-r2rUHRuO.js","assets/stata-BVbnRiot.js","assets/step21-Dq-6Zq9y.js","assets/stylus-BBnpEkBq.js","assets/subunit-ELCErEkQ.js","assets/swift-DaAs7qTh.js","assets/taggerscript-1FPav-0a.js","assets/tap-EToQ4lhN.js","assets/tcl-D3o49C6L.js","assets/thrift-CWhyiqPB.js","assets/tp-B6O9yM_7.js","assets/twig-CtXlonbL.js","assets/typescript-CCrKHjvE.js","assets/vala-DqTbJvZE.js","assets/vbnet-BIMC8kyn.js","assets/vbscript-html-6BIOjkqb.js","assets/vbscript-CwHfrTEX.js","assets/verilog-Br3eYmwZ.js","assets/vhdl-CDlnDphM.js","assets/vim-BOZojkV6.js","assets/x86asm-Br9iqCtX.js","assets/xl-eSTclZWH.js","assets/xml-C775tW_n.js","assets/xquery-DimlVJ6h.js","assets/yaml-Dnhus5cp.js","assets/zephir-j3mL6he_.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-zsgVPwQN.js";import{t}from"./chunk-3GQAWCBQ-
|
|
2
|
+
import{o as e}from"./chunk-zsgVPwQN.js";import{t}from"./chunk-3GQAWCBQ-ntjTDD_C.js";import{t as n}from"./preload-helper-ckxxtgMM.js";var r=null,i=null,a=null,o=!1,s=typeof process<`u`&&process.versions?.node;(async()=>{if(s)try{a=(await n(()=>import(`./util-_DavpSWv.js`),[])).stripVTControlCharacters}catch{}try{r=(await n(()=>import(`./source-DeHaVNLZ.js`),[])).default}catch{}try{i=(await n(()=>import(`./dist-DlypDwtn.js`).then(t=>e(t.default,1)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193]))).highlight}catch{}s&&(!r||!i)&&(o||(o=!0,console.warn(`
|
|
3
3
|
✨ For enhanced console output with colors and syntax highlighting, install:
|
|
4
4
|
|
|
5
5
|
npm install chalk cli-highlight
|