@opentiny/next-sdk 0.1.14 → 0.1.15-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/AgentModelProvider.ts +539 -21
- package/agent/type.ts +12 -6
- package/agent/utils/generateReActPrompt.ts +55 -0
- package/agent/utils/parseReActAction.ts +34 -0
- package/dist/McpSdk.d.ts +14 -0
- package/dist/WebAgent.d.ts +5 -0
- package/dist/WebMcp.d.ts +20 -0
- package/dist/WebMcpClient.d.ts +389 -1152
- package/dist/WebMcpServer.d.ts +79 -78
- package/dist/Zod.d.ts +1 -0
- package/dist/agent/AgentModelProvider.d.ts +40 -4
- package/dist/agent/type.d.ts +13 -3
- package/dist/agent/utils/generateReActPrompt.d.ts +9 -0
- package/dist/agent/utils/getAISDKTools.d.ts +1 -0
- package/dist/agent/utils/parseReActAction.d.ts +14 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.es.dev.js +36351 -34349
- package/dist/index.es.js +28821 -25466
- package/dist/index.js +3880 -25
- package/dist/index.umd.dev.js +34228 -32226
- package/dist/index.umd.js +220 -128
- package/dist/mcpsdk@1.24.3.dev.js +22539 -0
- package/dist/mcpsdk@1.24.3.es.dev.js +22537 -0
- package/dist/mcpsdk@1.24.3.es.js +16781 -0
- package/dist/mcpsdk@1.24.3.js +43 -0
- package/dist/remoter/createRemoter.d.ts +9 -0
- package/dist/remoter/tooltips.d.ts +36 -0
- package/dist/script/utils.d.ts +1 -0
- package/dist/transport/ExtensionClientTransport.d.ts +3 -2
- package/dist/transport/ExtensionContentServerTransport.d.ts +3 -2
- package/dist/transport/ExtensionPageServerTransport.d.ts +4 -4
- package/dist/vite-build-tsc.d.ts +2 -0
- package/dist/vite.config.d.ts +2 -0
- package/dist/vite.config.mcpSdk.d.ts +2 -0
- package/dist/vite.config.webAgent.d.ts +2 -0
- package/dist/vite.config.webMcp.d.ts +2 -0
- package/dist/vite.config.webMcpFull.d.ts +2 -0
- package/dist/vite.config.zod.d.ts +2 -0
- package/dist/webagent.dev.js +24690 -20960
- package/dist/webagent.es.dev.js +24032 -20302
- package/dist/webagent.es.js +25326 -20723
- package/dist/webagent.js +209 -110
- package/dist/webmcp-full.dev.js +21225 -20021
- package/dist/webmcp-full.es.dev.js +21223 -20019
- package/dist/webmcp-full.es.js +16710 -14437
- package/dist/webmcp-full.js +42 -15
- package/dist/webmcp.dev.js +14 -22
- package/dist/webmcp.es.dev.js +12 -20
- package/dist/webmcp.es.js +172 -179
- package/dist/webmcp.js +1 -1
- package/dist/zod@3.25.76.dev.js +30 -32
- package/dist/zod@3.25.76.es.dev.js +28 -30
- package/dist/zod@3.25.76.es.js +143 -145
- package/dist/zod@3.25.76.js +1 -1
- package/package.json +11 -9
- package/remoter/createRemoter.ts +126 -71
- package/remoter/tooltips.ts +260 -0
- package/transport/ExtensionPageServerTransport.ts +2 -4
- package/tsconfig.json +5 -3
- package/vite-build-tsc.ts +60 -0
- package/vite-env.d.ts +5 -0
- package/dist/WebMcpClient.js +0 -363
- package/dist/WebMcpServer.js +0 -283
- package/dist/agent/AgentModelProvider.js +0 -293
- package/dist/agent/type.js +0 -1
- package/dist/agent/utils/getAISDKTools.js +0 -36
- package/dist/mcpsdk@1.17.0.dev.js +0 -21391
- package/dist/mcpsdk@1.17.0.es.dev.js +0 -21389
- package/dist/mcpsdk@1.17.0.es.js +0 -14505
- package/dist/mcpsdk@1.17.0.js +0 -16
- package/dist/remoter/QrCode.js +0 -55
- package/dist/remoter/createRemoter.js +0 -743
- package/dist/transport/ExtensionClientTransport.js +0 -81
- package/dist/transport/ExtensionContentServerTransport.js +0 -128
- package/dist/transport/ExtensionPageServerTransport.js +0 -118
- package/dist/transport/messages.js +0 -51
- package/dist/utils/uuid.js +0 -10
package/dist/webmcp.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(p,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("ajv"),require("@modelcontextprotocol/sdk/types.js"),require("@modelcontextprotocol/sdk/client/index.js"),require("@modelcontextprotocol/sdk/client/sse.js"),require("@modelcontextprotocol/sdk/client/streamableHttp.js"),require("@modelcontextprotocol/sdk/client/websocket.js"),require("@modelcontextprotocol/sdk/client/auth.js"),require("@modelcontextprotocol/sdk/server/mcp.js"),require("zod"),require("@modelcontextprotocol/sdk/shared/uriTemplate.js"),require("@modelcontextprotocol/sdk/server/completable.js"),require("@modelcontextprotocol/sdk/shared/metadataUtils.js")):typeof define=="function"&&define.amd?define(["exports","ajv","@modelcontextprotocol/sdk/types.js","@modelcontextprotocol/sdk/client/index.js","@modelcontextprotocol/sdk/client/sse.js","@modelcontextprotocol/sdk/client/streamableHttp.js","@modelcontextprotocol/sdk/client/websocket.js","@modelcontextprotocol/sdk/client/auth.js","@modelcontextprotocol/sdk/server/mcp.js","zod","@modelcontextprotocol/sdk/shared/uriTemplate.js","@modelcontextprotocol/sdk/server/completable.js","@modelcontextprotocol/sdk/shared/metadataUtils.js"],O):(p=typeof globalThis<"u"?globalThis:p||self,O(p.WebMCP={},p.MCPSDK,p.MCPSDK,p.MCPSDK,p.MCPSDK,p.MCPSDK,p.websocket_js,p.MCPSDK,p.MCPSDK,p.Zod,p.MCPSDK,p.MCPSDK,p.MCPSDK))})(this,function(p,O,w,F,N,z,oe,he,$,fe,pe,xe,_e){"use strict";function W(){const r=["224340fQYLJj","function","onmessage","port2","341XVdnBD","313767JEBgqL","950bpstaX","1354759gUhUbE","wRKyh","onclose","2044SvCTUj","endpoint","24msSkHx","164VuWYGY","mOWMr","EkZCC","addEventListener","postMessage","120705iyGzUz","8878392ivIdKn","close","_listen","3619482FaLQHc","start","_endpoint","kgkem","bzNYT","MessageChannel transport error: ","stringify","onmessageerror","HvyCv","undefined","Jwyua","message","_globalObject","parse","authInfo","thraG","220pGvxgp","_port","EGhzU","onerror","data","MhriV"];return W=function(){return r},W()}(function(r,e){const t=y,n=y,s=r();for(;;)try{if(parseInt(t(417))/1*(parseInt(t(421))/2)+parseInt(t(433))/3+parseInt(t(424))/4*(-parseInt(n(429))/5)+parseInt(n(423))/6*(-parseInt(n(418))/7)+-parseInt(n(430))/8+-parseInt(t(416))/9*(-parseInt(t(405))/10)+-parseInt(t(415))/11*(-parseInt(t(411))/12)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(W,650197);const ie=()=>{const r=y,e={EGhzU:function(t,n){return t!==n},kIrDB:"undefined",llYQe:function(t,n){return t!==n},PZfJg:function(t,n){return t(n)},Jwyua:"return this"};return typeof globalThis<"u"?globalThis:e[r(407)](typeof window,e.kIrDB)?window:e.llYQe(typeof global,e.kIrDB)?global:typeof self!==r(398)?self:e.PZfJg(Function,e[r(399)])()},ve=(r,e,t)=>{const n=y,s=y,o={};o[n(410)]=s(398),o.dBkaX=function(i,c){return i===c},o[s(393)]="function";const a=o;typeof window!==a[s(410)]?r.postMessage(e,"*",t):s(428)in r&&a.dBkaX(typeof r.postMessage,a[n(393)])&&r.postMessage(e,t)},ge=(r,e)=>{const t=y,n=y,s={};s.MbsGh="addEventListener",s.PPniK=function(a,i){return a===i},s[t(419)]=n(412),s[n(404)]="onmessage",s[t(397)]="undefined";const o=s;o.MbsGh in r&&o.PPniK(typeof r[t(427)],o.wRKyh)?r[t(427)](t(400),e):o.thraG in r&&typeof r[n(413)]!==o[n(397)]&&(r.onmessage=e)};class A{constructor(e){const t=y;this[t(406)]=e}async start(){const e=y,t=y;this[e(406)]&&(this[e(406)][e(413)]=n=>{var s,o;const a=e,i=t;try{const c=w.JSONRPCMessageSchema[a(402)](n.data[a(400)]);(s=this[a(413)])==null||s.call(this,c,n[i(409)].extra)}catch(c){const l=new Error("MessageChannel failed to parse message: "+c);(o=this[i(408)])==null||o.call(this,l)}},this._port[e(396)]=n=>{var s;const o=t,a=t,i=new Error(o(394)+JSON[a(395)](n));(s=this.onerror)==null||s.call(this,i)},this[e(406)][e(434)]())}async send(e,t){const n={lEyuq:function(s){return s()},YihNw:function(s,o){return s(o)}};return new Promise((s,o)=>{var a;const i=y,c=y;try{const l={};l[i(403)]=t==null?void 0:t[i(403)];const d={};d[c(400)]=e,d.extra=l,this[c(406)]&&this[i(406)].postMessage(d),n.lEyuq(s)}catch(l){const d=l instanceof Error?l:new Error(n.YihNw(String,l));(a=this[c(408)])==null||a.call(this,d),o(d)}})}async close(){var e,t;const n=y,s=y;(e=this._port)==null||e[n(431)](),this._port=void 0,(t=this[s(420)])==null||t.call(this)}}class ee extends A{constructor(e,t=ie()){const n=y,s=y,o={EkZCC:function(i,c,l,d){return i(c,l,d)}};super(),this[n(391)]=e,this[s(401)]=t;const a=new MessageChannel;this[s(406)]=a.port1,o[s(426)](ve,this[n(401)],{endpoint:this[s(391)]},[a[s(414)]])}}class te extends A{constructor(e,t=ie()){const n=y,s={mOWMr:function(o,a){return o===a},kgkem:function(o,a,i){return o(a,i)}};super(),this._endpoint=e,this._globalObject=t,this[n(432)]=new Promise(o=>{const a=n,i=n;s[a(392)](ge,this[i(401)],c=>{const l=i,d=i;c.data&&s[l(425)](c.data[d(422)],this[d(391)])&&(this[d(406)]=c.ports[-1*4852+1*1601+3251],o())})})}async listen(){return this[y(432)]}}function y(r,e){const t=W();return y=function(n,s){return n=n-(17*-491+-669+9407),t[n]},y(r,e)}const be=()=>{const r=new MessageChannel;return[new A(r.port1),new A(r.port2)]};(function(r,e){const t=b,n=b,s=r();for(;;)try{if(parseInt(t(355))/1+-parseInt(t(356))/2*(-parseInt(t(373))/3)+-parseInt(t(337))/4+parseInt(n(357))/5+-parseInt(n(389))/6*(-parseInt(t(396))/7)+parseInt(n(325))/8*(parseInt(t(382))/9)+-parseInt(t(366))/10===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(B,-763475+-52067*10+1724410);const me=async(r,e,t)=>{var n;const s=b,o=b,a={};a[s(345)]="tools/list",a.rqstG="tools/call",a.WqUnk="resources/list",a[s(329)]=o(358),a[s(365)]=s(335),a.ookoz="resources/unsubscribe",a[s(385)]=s(340),a.VTIWq="prompts/list",a.SkoRK=s(376),a.QUtUV=s(388),a.XtowM=o(332);const i=a,{id:c,method:l,params:d}=t;let u={};switch(l){case i[o(345)]:u=await e.listTools(d);break;case i.rqstG:u=await e.callTool(d);break;case i[s(334)]:u=await e[s(350)](d);break;case i[o(329)]:u=await e.listResourceTemplates(d);break;case s(372):u=await e[s(383)](d);break;case i.HgYgW:u=await e.subscribeResource(d);break;case i.ookoz:u=await e.unsubscribeResource(d);break;case i[s(385)]:u=await e.getPrompt(d);break;case i.VTIWq:u=await e.listPrompts(d);break;case i[s(344)]:u=await e[s(376)]();break;case i.QUtUV:u=await e.complete(d);break;case s(390):u=await e[s(336)](d==null?void 0:d.level);break}const h={};h[s(361)]=u,h[s(394)]=i[s(364)],h.id=c,await((n=r==null?void 0:r.transport)==null?void 0:n[s(392)](h))},we=async(r,e,t)=>{var n;const s=b,o=b,a={};a.jQBBS="sampling/createMessage",a.EZqgC="elicitation/create",a[s(370)]=o(376),a.aVeaL=o(332);const i=a,{id:c,method:l,params:d}=t;let u={};switch(l){case s(368):const f={};f.method=l,f[o(367)]=d,u=await e.request(f,w.ListRootsResultSchema);break;case i[o(391)]:const _={};_.method=l,_[o(367)]=d,u=await e[o(381)](_,w.CreateMessageResultSchema);break;case i.EZqgC:const x={};x.method=l,x.params=d,u=await e.request(x,w.ElicitResultSchema);break;case i[o(370)]:const v={};v.method=l,u=await e[o(381)](v,w.EmptyResultSchema);break}const h={};return h[o(361)]=u,h.jsonrpc=i[o(387)],h.id=c,await((n=r==null?void 0:r[s(371)])==null?void 0:n.send(h)),u},ye=(r,e)=>{const t=b,n={gXsjT:function(o,a){return o===a},oegpC:t(351),lZOUC:function(o,a,i,c){return o(a,i,c)},ifIKG:"2.0"},s=r._onrequest;r._onrequest=async(o,a)=>{var i,c,l,d,u;const h=t,f=t,{id:_,method:x}=o;try{n[h(333)](x,n.oegpC)?await s[h(386)](r,o,a):await n.lZOUC(me,r,e,o)}catch(v){const{code:g,message:R,data:P}=v;try{if(g){const I={};I.code=g,I.message=R,I.data=P;const k={};k.error=I,k[h(394)]=n[f(331)],k.id=_,await((i=r==null?void 0:r.transport)==null?void 0:i.send(k))}else(l=(c=r==null?void 0:r[f(371)])==null?void 0:c.onerror)==null||l.call(c,v)}catch(I){(u=(d=r==null?void 0:r[h(371)])==null?void 0:d.onerror)==null||u.call(d,I)}}}},Ce=(r,e)=>{const t=b,n=b,s={};s[t(363)]=function(a,i){return a!==i},s[t(398)]=t(353),s.hzhyg="notifications/cancelled";const o=s;r._onnotification=async a=>{var i,c;const l=t,d=n,{method:u,params:h}=a;if(o[l(363)](u,o[d(398)])&&(o[l(363)](u,o.hzhyg)||h!=null&&h.forward))try{await e.notification(a)}catch(f){(c=(i=r==null?void 0:r.transport)==null?void 0:i.onerror)==null||c.call(i,f)}}},Ie=(r,e)=>async t=>{var n,s,o,a,i;const c=b,l=b,d={};d.SEmWX=c(332);const u=d;try{return await we(r,e,t)}catch(h){const{code:f,message:_,data:x}=h;try{if(f){const v={};v[l(377)]=f,v.message=_,v.data=x;const g={};g[l(348)]=v,g.jsonrpc=u[c(338)],g.id=t.id,await((n=r==null?void 0:r.transport)==null?void 0:n[l(392)](g))}else(o=(s=r==null?void 0:r.transport)==null?void 0:s[l(339)])==null||o.call(s,h)}catch(v){(i=(a=r==null?void 0:r[c(371)])==null?void 0:a[l(339)])==null||i.call(a,v)}}},Se=(r,e)=>async t=>{var n,s,o;const a=b,i=b,c={};c.dtUgZ=function(h,f){return h!==f},c.jgCIb=a(353),c.uUjKY="2.0";const l=c,{method:d,params:u}=t;if(l.dtUgZ(d,l.jgCIb)&&(d!==a(400)||u!=null&&u.forward))try{const h={...t};h[a(394)]=l[i(352)],await((n=e==null?void 0:e[a(371)])==null?void 0:n[a(392)](h))}catch(h){(o=(s=r==null?void 0:r[a(371)])==null?void 0:s[i(339)])==null||o.call(s,h)}};function b(r,e){const t=B();return b=function(n,s){return n=n-(9*-113+-1439*-1+-97),t[n]},b(r,e)}const Re=(r,e)=>async t=>{var n,s,o,a,i,c;const l=b,d=b,u={};u[l(401)]=d(332);const h=u;try{await((n=e==null?void 0:e.transport)==null?void 0:n.send(t))}catch(f){const{code:_,message:x,data:v}=f;try{if(_){const g={};g.code=_,g[l(399)]=x,g.data=v;const R={};R[l(348)]=g,R[l(394)]=h.OhJjz,R.id=t.id,await((s=r==null?void 0:r[l(371)])==null?void 0:s.send(R))}else(a=(o=r==null?void 0:r.transport)==null?void 0:o[d(339)])==null||a.call(o,f)}catch(g){(c=(i=r==null?void 0:r.transport)==null?void 0:i.onerror)==null||c.call(i,g)}}},ne=()=>{const r=b,e=b,t={vnkqu:function(l,d){return l!==d},wxDWr:function(l,d){return l(d)},GdkkV:function(l,d){return l===d}},n=[],s=(l,d)=>{const u=b,h=b;if(d){const f=[];for(const _ of n)try{f.push(_(l,d))}catch{}for(const _ of f)if(t[u(379)](_,null))return _}else for(const f of n)try{t[h(343)](f,l)}catch{}},o=l=>{const d=b;t[d(384)](typeof l,d(369))&&!n.includes(l)&&n.push(l)},a=l=>{const d=n.indexOf(l);d!==-1&&n.splice(d,1*-6854+8*-33+7119)},i=()=>{const l=b;n[l(374)]=7102*1+5522+-526*24},c={};return c[r(346)]=s,c[e(330)]=o,c.removeListener=a,c[r(359)]=i,c},Te=r=>{const e=b,t=b,n={xwPeb:function(s){return s()},Mfvzm:function(s){return s()}};{const{handleListener:s,addListener:o,removeListener:a,clearListener:i}=n[e(326)](ne);r._onresponse=s,r[e(395)]=o,r.removeResponseListener=a,r.clearResponseListener=i}{const{handleListener:s,addListener:o,removeListener:a,clearListener:i}=n[t(326)](ne);r[t(328)]=s,r.addRequestListener=o,r[t(354)]=a,r[t(341)]=i}{const{handleListener:s,addListener:o,removeListener:a,clearListener:i}=n[e(375)](ne);r[e(342)]=s,r[e(327)]=o,r.removeNotificationListener=a,r.clearNotificationListener=i}};function B(){const r=["uUjKY","notifications/initialized","removeRequestListener","96194JysfjF","36346SGEWAV","1357830AJaOeY","resources/templates/list","clearListener","iQqcJ","result","tqDZP","sSeCz","XtowM","HgYgW","3913230mjiatC","params","roots/list","function","bfmJT","transport","resources/read","27FNuDmk","length","Mfvzm","ping","code","_onresponse","vnkqu","cjSoZ","request","9gIMIPC","readResource","GdkkV","ptMjy","call","aVeaL","completion/complete","5035122lFbpzR","logging/setLevel","jQBBS","send","_requestHandlers","jsonrpc","addResponseListener","7SpcenI","ElOQH","MDIkN","message","notifications/cancelled","OhJjz","clear","672216JzFEyR","xwPeb","addNotificationListener","fallbackRequestHandler","sYzPD","addListener","ifIKG","2.0","gXsjT","WqUnk","resources/subscribe","setLoggingLevel","2491772kFUWFh","SEmWX","onerror","prompts/get","clearRequestListener","fallbackNotificationHandler","wxDWr","SkoRK","uTeHc","handleListener","Zybtx","error","originalOnResponse","listResources","initialize"];return B=function(){return r},B()}const ke=(r,{beforeInit:e,afterInit:t}={})=>{const n=b,s=b,o={tqDZP:function(i,c){return i===c},cjSoZ:"function",iQqcJ:n(378),Zybtx:function(i,c){return i(c)},ElOQH:function(i){return i()}},a=new Map(r._notificationHandlers);r[n(393)][n(402)](),r._notificationHandlers[n(402)](),o.tqDZP(typeof e,o[n(380)])&&e(),o[n(362)](r._onresponse.name,o[n(360)])&&(r[s(349)]=r._onresponse),o[n(347)](Te,r),r.addResponseListener(i=>{const c=s;r.originalOnResponse[c(386)](r,i)}),o.tqDZP(typeof t,o[s(380)])&&o[n(397)](t),r[s(327)](i=>{const{method:c}=i,l=a.get(c);o.tqDZP(typeof l,o.cjSoZ)&&l(i)})},Pe=q,qe=q;(function(r,e){const t=q,n=q,s=r();for(;;)try{if(-parseInt(t(393))/1+parseInt(t(397))/2*(-parseInt(t(400))/3)+-parseInt(n(398))/4+parseInt(t(390))/5*(parseInt(n(388))/6)+-parseInt(t(389))/7+-parseInt(t(402))/8*(-parseInt(n(395))/9)+parseInt(n(399))/10*(parseInt(n(385))/11)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Z,-1*-881393+2*180895+1*-644809);function q(r,e){const t=Z();return q=function(n,s){return n=n-(-1861+-499*4+4241),t[n]},q(r,e)}function Z(){const r=["toString","getRandomValues","2101mUsYMI","EQHzo","padStart","30UvDAkd","1609706yzlqYx","974735GrhZVO","randomUUID","REzPF","562771BvAnoG","dHTfU","2047455boiYXf","randomBytes","14664qHAdbF","3772144jLpQch","52310AkWksx","318MkjaVb","from","40WRwnSc"];return Z=function(){return r},Z()}const Le=()=>{const r=q,e=q,t={};t.REzPF=function(s,o){return s&o},t.suJHI=function(s,o){return s===o},t[r(386)]=function(s,o){return s&o},t[e(394)]="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";const n=t;return n.suJHI(typeof crypto,"object")&&crypto.randomUUID?crypto[e(391)]():n.dHTfU.replace(/[xy]/g,s=>{const o=r,a=r,i=n[o(392)](crypto[o(384)](new Uint8Array(-25*-62+7113+2*-4331))[741*2+-1385*-2+4252*-1],8648+-107*62+-1999);return(n.suJHI(s,"x")?i:n[a(386)](i,-4377+4*1095)|5079+461*-11).toString(9449+4*-461+-7589)})},Me=r=>{const e=q,t=q,n=new Uint8Array(r);return crypto.getRandomValues(n),Array[e(401)](n,s=>s[t(403)](-3*1739+-6509+2*5871)[e(387)](2,"0")).join("")},U={};U[Pe(391)]=Le,U[qe(396)]=Me;const S=L;(function(r,e){const t=L,n=L,s=r();for(;;)try{if(parseInt(t(521))/1*(parseInt(n(499))/2)+parseInt(n(543))/3*(parseInt(n(514))/4)+parseInt(t(502))/5*(parseInt(n(539))/6)+parseInt(t(553))/7+parseInt(t(516))/8*(-parseInt(t(518))/9)+-parseInt(t(531))/10+-parseInt(t(545))/11*(parseInt(t(541))/12)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Y,1472653*1+-2*-897917+-2275789);const He=(r,e)=>{const t=L,n=L,s={FyYHt:function(c,l,d){return c(l,d)},Fxtoq:function(c,l,d){return c(l,d)}};ye(r,e),Ce(r,e);const o=Ie(e,r),a=s[t(510)](Re,e,r),i=s[n(549)](Se,e,r);e[n(537)](o),e[t(519)](a),e.addNotificationListener(i),r[n(556)]=()=>{const c=n;e.removeRequestListener(o),e[c(530)](a),e[c(529)](i)}},se=(r,e,t)=>{const n=L,s={pMiva:function(i,c){return i instanceof c},TeTEy:n(546),fyZbd:function(i,c,l){return i(c,l)}},o=()=>{var i;const c=n;s.pMiva(t,N.SSEClientTransport)&&((i=t._eventSource)==null||i.addEventListener(s[c(547)],()=>{var l;const d=c;(l=t[d(509)])==null||l[d(546)]()})),He(r,e)},a={};a.afterInit=o,s.fyZbd(ke,e,a)},ae=(r,e=U.randomUUID())=>{const t=L,n=L,s={OfssH:function(d,u,h){return d(u,h)}},o={};o[t(528)]=e;const a=o,i={};i[t(528)]=e;const c={};c[n(558)]=i,c[t(534)]=t(524);const l={requestInit:c,eventSourceInit:{async fetch(d,u){const h=t,f=n,_=new Headers((u==null?void 0:u[h(558)])||{});Object.entries(a)[f(498)](([v,g])=>{_[f(527)](v,g)});const x={...u};return x[f(558)]=_,s.OfssH(fetch,d,x)},withCredentials:!0}};return r&&(l.requestInit[t(558)].Authorization=t(533)+r,a.Authorization="Bearer "+r),l},ce=(r,e=U[S(517)]())=>{const t=S,n=S,s={};s.nwQhY="include";const o=s,a={};a["stream-session-id"]=e;const i={};i.headers=a,i.credentials=o[t(520)];const c={};c[t(544)]=i;const l=c;return r&&(l.requestInit.headers[n(552)]=n(533)+r),l},re=async(r,e,t)=>{const n=S,s=S,o={CFfFC:function(i){return i()},egwVO:function(i,c,l,d){return i(c,l,d)}},a=o.CFfFC(t);try{return await r[n(538)](a),a}catch(i){if(i instanceof he.UnauthorizedError){const c=await e();return await a[s(505)](c),await o[n(525)](re,r,e,t)}else throw i}};function L(r,e){const t=Y();return L=function(n,s){return n=n-(74*-67+-8341+-73*-189),t[n]},L(r,e)}const le=(r,e)=>{const t=S,n=S,s={};s.RsKXs=function(a,i){return a in i},s.PBhps="waitForOAuthCode",s[t(535)]="function",s[t(507)]="waitForOAuthCode need to be provided when authProvider is provided";const o=s;if(o.RsKXs(o[n(551)],r))return r[n(523)];if(typeof e===o.yTKoP)return e;throw new Error(o.RZhOv)},Ue=async r=>{const e=S,t=S,n={TFSRn:function(m,M,H){return m(M,H)},HwvVa:"mcp-sse-proxy-client",ufTHS:function(m){return m()},WIVYl:function(m,M,H,V){return m(M,H,V)},jniGY:"sessionId"},{client:s,url:o,token:a,sessionId:i,authProvider:c,requestInit:l,eventSourceInit:d,waitForOAuthCode:u}=r,h={};h.authProvider=c,h.requestInit=l,h.eventSourceInit=d;const f=h,_=i||U.randomUUID(),x=n[e(506)](ae,a,_);if(l){const m={...x.requestInit,...l};m.headers={...x[e(544)].headers,...l.headers},f.requestInit=m}else f[t(544)]=x.requestInit;if(d){const m={...x[e(559)],...d};f.eventSourceInit=m}else f.eventSourceInit=x.eventSourceInit;const v={};v.listChanged=!0;const g={};g.roots=v,g.sampling={},g[e(511)]={};const R=g,P={};P[t(536)]=n.HwvVa,P.version=e(526);const I={};I.capabilities=R;const k=new F.Client(P,I),j=()=>new N.SSEClientTransport(new URL(o),f);let T=n[t(504)](j);if(c){const m=n[e(506)](le,c,u);T=await n[t(513)](re,k,m,j)}else await k[e(538)](T);n[t(513)](se,k,s,T),T[t(557)]=T[t(542)].searchParams[t(532)](n.jniGY);const E={};return E.transport=T,E.sessionId=T[e(557)],E};function Y(){const r=["ufTHS","finishAuth","TFSRn","RZhOv","Vajmx","_eventSource","FyYHt","elicitation","transport","WIVYl","13320uyrBtN","sampling","8WTwLJD","randomUUID","6438654bkJHij","addResponseListener","nwQhY","11721GVgRMJ","?sessionId=","waitForOAuthCode","include","egwVO","1.0.0","set","sse-session-id","removeNotificationListener","removeResponseListener","11838520fNkjrV","get","Bearer ","credentials","yTKoP","name","addRequestListener","connect","18VhCgQv","mcp-socket-proxy-client","2819364JNqkQZ","_endpoint","699JyrxCR","requestInit","44ofbsvb","close","TeTEy","QgzDy","Fxtoq","roots","PBhps","Authorization","11309130xGCFwl","&token=","version","onclose","sessionId","headers","eventSourceInit","forEach","62FcOkCa","mcp-stream-proxy-client","zXcpO","1794855cQEXDT","biJOc"];return Y=function(){return r},Y()}const Ee=async r=>{const e=S,t=S,n={Vajmx:e(500),biJOc:function(m){return m()},zXcpO:function(m,M,H){return m(M,H)},zDnjZ:function(m,M,H,V){return m(M,H,V)},FQMAh:function(m,M,H,V){return m(M,H,V)}},{client:s,url:o,token:a,sessionId:i,authProvider:c,requestInit:l,reconnectionOptions:d,waitForOAuthCode:u}=r,h={};h.authProvider=c,h.requestInit=l,h.reconnectionOptions=d;const f=h,_=i||U.randomUUID(),x=ce(a,_);if(l){const m={...x.requestInit,...l};m.headers={...x.requestInit.headers,...l.headers},f[e(544)]=m}else f.requestInit=x.requestInit;const v={};v.listChanged=!0;const g={};g[t(550)]=v,g.sampling={},g.elicitation={};const R=g,P={};P[e(536)]=n[t(508)],P[e(555)]="1.0.0";const I={};I.capabilities=R;const k=new F.Client(P,I),j=()=>new z.StreamableHTTPClientTransport(new URL(o),f);let T=n[e(503)](j);if(c){const m=n[e(501)](le,c,u);T=await n.zDnjZ(re,k,m,j)}else await k.connect(T);n.FQMAh(se,k,s,T);const E={};return E.transport=T,E[t(557)]=T.sessionId,E},Oe=async r=>{const e=S,t=S,n={QgzDy:e(540),jkaVB:function(g,R,P,I){return g(R,P,I)}},{client:s,url:o,token:a,sessionId:i}=r,c={};c.listChanged=!0;const l={};l[e(550)]=c,l[e(515)]={},l[t(511)]={};const d=l,u={};u.name=n[t(548)],u[t(555)]=t(526);const h={};h.capabilities=d;const f=new F.Client(u,h),_=i||U[t(517)](),x=new oe.WebSocketClientTransport(new URL(o+e(522)+_+t(554)+a));await f.connect(x),n.jkaVB(se,f,s,x);const v={};return v[e(512)]=x,v[t(557)]=_,v},D=C,J=C;function C(r,e){const t=G();return C=function(n,s){return n=n-(-16761+51*337),t[n]},C(r,e)}(function(r,e){const t=C,n=C,s=r();for(;;)try{if(-parseInt(t(440))/1+-parseInt(t(458))/2*(parseInt(t(448))/3)+-parseInt(t(451))/4*(parseInt(n(449))/5)+-parseInt(n(455))/6+-parseInt(t(427))/7+-parseInt(n(438))/8*(parseInt(n(459))/9)+parseInt(t(430))/10*(parseInt(n(436))/11)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(G,-220880+1*-333337+-2*-384996);function G(){const r=["650XPHLhD","redirectToAuthorization","10856jPvMVb","GET","qcFPW","_redirectUrl","2187414WnlGuZ","resolve","tokens","3976YyOqUl","27ejNHsa","Content-Type","waitForOAuthCode","2903796yvWZFa","_clientMetadata","application/x-www-form-urlencoded","10beEWJk","json","code","_callBackPromise","reject","saveClientInformation","20776349mLNCcF","_codeVerifier","629912aTknXq","_tokens","52074GwcpRo","state","_state","_redirectCallback","_clientInformation","redirect_uris","Failed to redirect: ","clientInformation","381aduWsB"];return G=function(){return r},G()}const Fe=()=>U.randomBytes(3485*1+-261+-3184);class Ne{constructor(e){const t=C,n=C;this._callBackPromise={};const{clientMetadata:s,state:o,redirectCallback:a,getAuthCodeByState:i,waitForOAuthCode:c}=e;this[t(428)]=s,this[t(454)]=s[t(445)][0],this._state=o||Fe(),this._redirectCallback=a||this.redirectCallbackFunction,this._getAuthCodeByState=i||this.getAuthCodeByStateFunction,this[n(426)]=c||this.waitForOAuthCodeFunction()}async redirectCallbackFunction(e){var t,n,s,o,a,i;const c=C,l=C,d={qITTp:function(_,x,v){return _(x,v)},qcFPW:c(452)},u=await d.qITTp(fetch,e,{method:d[c(453)]});!u.ok&&((n=(t=this._callBackPromise).reject)==null||n.call(t,l(446)+u.statusText));const h=await this._getAuthCodeByState(this[l(454)],this[c(442)]);if(!h.ok){(o=(s=this[c(433)]).reject)==null||o.call(s,"Failed to fetch auth code: "+h.statusText);return}const f=await h[c(431)]();(i=(a=this[l(433)])[c(456)])==null||i.call(a,f[c(432)])}async getAuthCodeByStateFunction(e,t){const n=C,s=C,o={};o.tuSmb=n(429);const a=o,i={};i[n(460)]=a.tuSmb;const c={};return c[s(441)]=t,fetch(e,{method:"POST",headers:i,body:new URLSearchParams(c)})}waitForOAuthCodeFunction(){const e=C,t=this[e(433)];return()=>new Promise((n,s)=>{const o=e;t.resolve=n,t[o(434)]=s})}get redirectUrl(){return this[C(454)]}get clientMetadata(){return this._clientMetadata}state(){return this._state}[D(447)](){return this[D(444)]}[J(435)](e){const t=D;this[t(444)]=e}[J(457)](){return this[J(439)]}saveTokens(e){this._tokens=e}[J(450)](e){this[D(443)](e)}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this[D(437)])throw new Error("No code verifier saved");return this._codeVerifier}}(function(r,e){for(var t=Q,n=Q,s=r();;)try{var o=parseInt(t(361))/1*(parseInt(n(363))/2)+-parseInt(t(358))/3+parseInt(t(359))/4*(parseInt(t(357))/5)+parseInt(n(354))/6*(parseInt(t(360))/7)+parseInt(n(362))/8+parseInt(n(364))/9+-parseInt(n(356))/10*(parseInt(t(355))/11);if(o===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(K,-73523*-3+1*-407717+530518);function K(){var r=["40ecBYYe","1095owKKYD","486870YOVwZy","5752xWiyTO","561484biNVMw","1fWJmxQ","1866064SPnyhb","1109522vMiuMX","1602351pPEGwH","12sVyMLL","2573296LTwOhv"];return K=function(){return r},K()}function Q(r,e){var t=K();return Q=function(n,s){n=n-(-1*-642+503*-5+2227);var o=t[n];return o},Q(r,e)}class De{constructor(e,t){const n={name:"web-mcp-server",version:"1.0.0"},s={prompts:{listChanged:!0},resources:{subscribe:!0,listChanged:!0},tools:{listChanged:!0},completions:{},logging:{}};this.server=new $.McpServer(e||n,t||{capabilities:s}),this.server.server.oninitialized=()=>{var o;(o=this.oninitialized)==null||o.call(this)},this.server.server.onclose=()=>{var o;(o=this.onclose)==null||o.call(this)},this.server.server.onerror=o=>{var a;(a=this.onerror)==null||a.call(this,o)},this.server.server.setRequestHandler(w.SetLevelRequestSchema,async()=>({}))}async connect(e){return typeof e.start=="function"?(this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0):(this.transport=new te(e),await this.transport.listen()),await this.server.connect(this.transport),this.transport}async close(){await this.server.close()}registerTool(e,t,n){return this.server.registerTool(e,t,n)}registerPrompt(e,t,n){return this.server.registerPrompt(e,t,n)}registerResource(e,t,n,s){return typeof t=="string"?this.server.registerResource(e,t,n,s):this.server.registerResource(e,t,n,s)}isConnected(){return this.server.isConnected()}sendResourceListChanged(){this.server.sendResourceListChanged()}sendToolListChanged(){this.server.sendToolListChanged()}sendPromptListChanged(){this.server.sendPromptListChanged()}getClientCapabilities(){return this.server.server.getClientCapabilities()}getClientVersion(){return this.server.server.getClientVersion()}async ping(){return await this.server.server.ping()}async createMessage(e,t){return await this.server.server.createMessage(e,t)}async elicitInput(e,t){return await this.server.server.elicitInput(e,t)}async listRoots(e,t){return await this.server.server.listRoots(e,t)}async sendLoggingMessage(e){return await this.server.server.sendLoggingMessage(e)}async sendResourceUpdated(e){return await this.server.server.sendResourceUpdated(e)}request(e,t,n){return this.server.server.request(e,t,n)}async notification(e,t){return await this.server.server.notification(e,t)}setRequestHandler(e,t){this.server.server.setRequestHandler(e,t)}removeRequestHandler(e){this.server.server.removeRequestHandler(e)}setNotificationHandler(e,t){this.server.server.setNotificationHandler(e,t)}removeNotificationHandler(e){this.server.server.removeNotificationHandler(e)}onSubscribe(e){this.server.server.setRequestHandler(w.SubscribeRequestSchema,e)}onUnsubscribe(e){this.server.server.setRequestHandler(w.UnsubscribeRequestSchema,e)}onSetLogLevel(e){this.server.server.setRequestHandler(w.SetLevelRequestSchema,e)}onListResources(e){this.server.server.setRequestHandler(w.ListResourcesRequestSchema,e)}onRootsListChanged(e){this.server.server.setNotificationHandler(w.RootsListChangedNotificationSchema,e)}async onPagehide(e){e.persisted||this.transport&&typeof this.transport.close=="function"&&await this.transport.close()}}const je=(r,e)=>new te(r,e),Ve=()=>be(),ze=r=>r instanceof te,We=r=>r instanceof $.McpServer;class Ae{constructor(e,t){const n={name:"web-mcp-client",version:"1.0.0"},s={roots:{listChanged:!0},sampling:{},elicitation:{}};this.client=new F.Client(e||n,t||{capabilities:s}),this.client.onclose=()=>{var o;(o=this.onclose)==null||o.call(this)},this.client.onerror=o=>{var a;(a=this.onerror)==null||a.call(this,o)}}async connect(e){if(typeof e.start=="function")return this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0,await this.client.connect(this.transport),{transport:this.transport,sessionId:this.transport.sessionId};const{url:t,token:n,sessionId:s,type:o,agent:a,onError:i}=e;if(a===!0){const d={client:this.client,url:t,token:n,sessionId:s};let u;return await(async()=>{const{transport:f,sessionId:_}=o==="sse"?await Ue(d):o==="socket"?await Oe(d):await Ee(d);f.onerror=async x=>{i==null||i(x)},u={transport:f,sessionId:_}})(),u}const c=new URL(t);let l;if(o==="channel"&&(l=new ee(t),await this.client.connect(l)),o==="sse"){const d=ae(n,s);l=new N.SSEClientTransport(c,d),await this.client.connect(l)}if(o==="socket"&&(l=new oe.WebSocketClientTransport(new URL(`${t}?sessionId=${s}&token=${n}`)),l.sessionId=s,await this.client.connect(l)),typeof l>"u"){const d=ce(n,s);l=new z.StreamableHTTPClientTransport(c,d),await this.client.connect(l)}return this.transport=l,{transport:this.transport,sessionId:this.transport.sessionId}}async close(){await this.client.close()}getServerCapabilities(){return this.client.getServerCapabilities()}getServerVersion(){return this.client.getServerVersion()}getInstructions(){return this.client.getInstructions()}async ping(e){return await this.client.ping(e)}async complete(e,t){return await this.client.complete(e,t)}async setLoggingLevel(e,t){return await this.client.setLoggingLevel(e,t)}async getPrompt(e,t){return await this.client.getPrompt(e,t)}async listPrompts(e,t){return await this.client.listPrompts(e,t)}async listResources(e,t){return await this.client.listResources(e,t)}async listResourceTemplates(e,t){return await this.client.listResourceTemplates(e,t)}async readResource(e,t){return await this.client.readResource(e,t)}async subscribeResource(e,t){return await this.client.subscribeResource(e,t)}async unsubscribeResource(e,t){return await this.client.unsubscribeResource(e,t)}async callTool(e,t){return await this.client.callTool(e,w.CallToolResultSchema,t)}async listTools(e,t){return await this.client.listTools(e,t)}async sendRootsListChanged(){return await this.client.sendRootsListChanged()}request(e,t,n){return this.client.request(e,t,n)}async notification(e,t){return await this.client.notification(e,t)}setRequestHandler(e,t){this.client.setRequestHandler(e,t)}removeRequestHandler(e){this.client.removeRequestHandler(e)}setNotificationHandler(e,t){this.client.setNotificationHandler(e,t)}removeNotificationHandler(e){this.client.removeNotificationHandler(e)}onElicit(e){this.client.setRequestHandler(w.ElicitRequestSchema,e)}onCreateMessage(e){this.client.setRequestHandler(w.CreateMessageRequestSchema,e)}onListRoots(e){this.client.setRequestHandler(w.ListRootsRequestSchema,e)}onToolListChanged(e){this.client.setNotificationHandler(w.ToolListChangedNotificationSchema,e)}onPromptListChanged(e){this.client.setNotificationHandler(w.PromptListChangedNotificationSchema,e)}onResourceListChanged(e){this.client.setNotificationHandler(w.ResourceListChangedNotificationSchema,e)}onResourceUpdated(e){this.client.setNotificationHandler(w.ResourceUpdatedNotificationSchema,e)}onLoggingMessage(e){this.client.setNotificationHandler(w.LoggingMessageNotificationSchema,e)}async onPagehide(e){e.persisted||(de(this.transport)?await this.transport.terminateSession():this.transport&&typeof this.transport.close=="function"&&await this.transport.close())}}const Be=(r,e)=>new N.SSEClientTransport(r,e),Ze=(r,e)=>new z.StreamableHTTPClientTransport(r,e),Ye=(r,e)=>new ee(r,e),Je=r=>r instanceof N.SSEClientTransport,de=r=>r instanceof z.StreamableHTTPClientTransport,Ge=r=>r instanceof ee,Ke=r=>r instanceof F.Client,Qe=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)}),X=(r,e,t)=>{window.postMessage({type:r,direction:t,data:e},"*")},ue=(r,e,t)=>{const n=async function(s){s.source===window&&s.data.type===r&&s.data.direction===t&&await e(s.data.data)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)};class Xe{constructor(e=null,t){this._isStarted=!1,this._isClosed=!1,this._lastRegistration=null,this.sessionId=e||Qe(),this.tabId=t,this._messageListener1=ue("sidepanel-ready-to-page",()=>{this._lastRegistration&&this._isStarted&&this.notifyRegistration(this._lastRegistration).catch(n=>{console.error("【Page Svr Transport】 notifyRegistration失败:",n)})},"content->page"),this._messageListener2=ue("mcp-client-to-server-to-page",n=>{var a,i,c;if(n.sessionId!==this.sessionId||n.tabId!==this.tabId)return;console.log("【Page Svr Transport】 即将处理 mcpMessage",n.mcpMessage);const s=w.JSONRPCMessageSchema.parse(n.mcpMessage);(a=this.onmessage)==null||a.call(this,s),((i=n.mcpMessage.params)==null?void 0:i.name)&&X("update-page-app-message",{status:"run",message:(c=n.mcpMessage.params)==null?void 0:c.name},"page->content")},"content->page")}_throwError(e,t){if(e()){const n=new Error(t);throw console.log(t,n),this.onerror&&this.onerror(n),n}}async start(){if(!this._isStarted){if(this._isClosed)throw new Error("【Page Svr Transport】 已关闭,无法重新启动");this._isStarted=!0}}async send(e,t){var n;this._throwError(()=>!this._isStarted,"【Page Svr Transport】 未启动,无法发送消息"),this._throwError(()=>this._isClosed,"【Page Svr Transport】 已关闭,无法发送消息"),X("mcp-server-to-client-from-page",{sessionId:this.sessionId,mcpMessage:e},"page->content"),"result"in e&&((n=e.result)!=null&&n.content)&&X("update-page-app-message",{status:"ready",message:""},"page->content")}async notifyRegistration(e){this._throwError(()=>!this._isStarted,"【Page Svr Transport】 未启动,无法注册消息"),this._lastRegistration=e;try{X("mcp-server-register-from-page",{sessionId:this.sessionId,serverInfo:{...e,url:window.location.origin,title:document.title}},"page->content")}catch(t){this._throwError(()=>!0,"【Page Svr Transport】 注册 server 失败"+String(t))}}async close(){if(!this._isClosed)try{this._messageListener1&&this._messageListener1(),this._messageListener2&&this._messageListener2(),this._isClosed=!0,this._isStarted=!1,this.onclose&&this.onclose()}catch(e){this._throwError(()=>!0,"【Page Svr Transport】 关闭时发生错误"+String(e))}}}p.Ajv=O,Object.defineProperty(p,"ResourceTemplate",{enumerable:!0,get:()=>$.ResourceTemplate}),Object.defineProperty(p,"z",{enumerable:!0,get:()=>fe.z}),Object.defineProperty(p,"UriTemplate",{enumerable:!0,get:()=>pe.UriTemplate}),Object.defineProperty(p,"completable",{enumerable:!0,get:()=>xe.completable}),Object.defineProperty(p,"getDisplayName",{enumerable:!0,get:()=>_e.getDisplayName}),p.AuthClientProvider=Ne,p.ExtensionPageServerTransport=Xe,p.WebMcpClient=Ae,p.WebMcpServer=De,p.createMessageChannelClientTransport=Ye,p.createMessageChannelPairTransport=Ve,p.createMessageChannelServerTransport=je,p.createSSEClientTransport=Be,p.createStreamableHTTPClientTransport=Ze,p.isMcpClient=Ke,p.isMcpServer=We,p.isMessageChannelClientTransport=Ge,p.isMessageChannelServerTransport=ze,p.isSSEClientTransport=Je,p.isStreamableHTTPClientTransport=de,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(p,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("ajv"),require("@modelcontextprotocol/sdk/types.js"),require("@modelcontextprotocol/sdk/client/index.js"),require("@modelcontextprotocol/sdk/client/sse.js"),require("@modelcontextprotocol/sdk/client/streamableHttp.js"),require("@modelcontextprotocol/sdk/client/websocket.js"),require("@modelcontextprotocol/sdk/client/auth.js"),require("@modelcontextprotocol/sdk/server/mcp.js"),require("zod"),require("@modelcontextprotocol/sdk/shared/uriTemplate.js"),require("@modelcontextprotocol/sdk/server/completable.js"),require("@modelcontextprotocol/sdk/shared/metadataUtils.js")):typeof define=="function"&&define.amd?define(["exports","ajv","@modelcontextprotocol/sdk/types.js","@modelcontextprotocol/sdk/client/index.js","@modelcontextprotocol/sdk/client/sse.js","@modelcontextprotocol/sdk/client/streamableHttp.js","@modelcontextprotocol/sdk/client/websocket.js","@modelcontextprotocol/sdk/client/auth.js","@modelcontextprotocol/sdk/server/mcp.js","zod","@modelcontextprotocol/sdk/shared/uriTemplate.js","@modelcontextprotocol/sdk/server/completable.js","@modelcontextprotocol/sdk/shared/metadataUtils.js"],O):(p=typeof globalThis<"u"?globalThis:p||self,O(p.WebMCP={},p.MCPSDK,p.MCPSDK,p.MCPSDK,p.MCPSDK,p.MCPSDK,p.websocket_js,p.MCPSDK,p.MCPSDK,p.Zod,p.MCPSDK,p.MCPSDK,p.MCPSDK))})(this,(function(p,O,w,F,N,z,oe,he,$,fe,pe,xe,_e){"use strict";function W(){const r=["224340fQYLJj","function","onmessage","port2","341XVdnBD","313767JEBgqL","950bpstaX","1354759gUhUbE","wRKyh","onclose","2044SvCTUj","endpoint","24msSkHx","164VuWYGY","mOWMr","EkZCC","addEventListener","postMessage","120705iyGzUz","8878392ivIdKn","close","_listen","3619482FaLQHc","start","_endpoint","kgkem","bzNYT","MessageChannel transport error: ","stringify","onmessageerror","HvyCv","undefined","Jwyua","message","_globalObject","parse","authInfo","thraG","220pGvxgp","_port","EGhzU","onerror","data","MhriV"];return W=function(){return r},W()}(function(r,e){const t=y,n=y,s=r();for(;;)try{if(parseInt(t(417))/1*(parseInt(t(421))/2)+parseInt(t(433))/3+parseInt(t(424))/4*(-parseInt(n(429))/5)+parseInt(n(423))/6*(-parseInt(n(418))/7)+-parseInt(n(430))/8+-parseInt(t(416))/9*(-parseInt(t(405))/10)+-parseInt(t(415))/11*(-parseInt(t(411))/12)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(W,650197);const ie=()=>{const r=y,e={EGhzU:function(t,n){return t!==n},kIrDB:"undefined",llYQe:function(t,n){return t!==n},PZfJg:function(t,n){return t(n)},Jwyua:"return this"};return typeof globalThis<"u"?globalThis:e[r(407)](typeof window,e.kIrDB)?window:e.llYQe(typeof global,e.kIrDB)?global:typeof self!==r(398)?self:e.PZfJg(Function,e[r(399)])()},ve=(r,e,t)=>{const n=y,s=y,o={};o[n(410)]=s(398),o.dBkaX=function(i,l){return i===l},o[s(393)]="function";const a=o;typeof window!==a[s(410)]?r.postMessage(e,"*",t):s(428)in r&&a.dBkaX(typeof r.postMessage,a[n(393)])&&r.postMessage(e,t)},ge=(r,e)=>{const t=y,n=y,s={};s.MbsGh="addEventListener",s.PPniK=function(a,i){return a===i},s[t(419)]=n(412),s[n(404)]="onmessage",s[t(397)]="undefined";const o=s;o.MbsGh in r&&o.PPniK(typeof r[t(427)],o.wRKyh)?r[t(427)](t(400),e):o.thraG in r&&typeof r[n(413)]!==o[n(397)]&&(r.onmessage=e)};class A{constructor(e){const t=y;this[t(406)]=e}async start(){const e=y,t=y;this[e(406)]&&(this[e(406)][e(413)]=n=>{var s,o;const a=e,i=t;try{const l=w.JSONRPCMessageSchema[a(402)](n.data[a(400)]);(s=this[a(413)])==null||s.call(this,l,n[i(409)].extra)}catch(l){const c=new Error("MessageChannel failed to parse message: "+l);(o=this[i(408)])==null||o.call(this,c)}},this._port[e(396)]=n=>{var s;const o=t,a=t,i=new Error(o(394)+JSON[a(395)](n));(s=this.onerror)==null||s.call(this,i)},this[e(406)][e(434)]())}async send(e,t){const n={lEyuq:function(s){return s()},YihNw:function(s,o){return s(o)}};return new Promise((s,o)=>{var a;const i=y,l=y;try{const c={};c[i(403)]=t?.[i(403)];const d={};d[l(400)]=e,d.extra=c,this[l(406)]&&this[i(406)].postMessage(d),n.lEyuq(s)}catch(c){const d=c instanceof Error?c:new Error(n.YihNw(String,c));(a=this[l(408)])==null||a.call(this,d),o(d)}})}async close(){var e,t;const n=y,s=y;(e=this._port)==null||e[n(431)](),this._port=void 0,(t=this[s(420)])==null||t.call(this)}}class ee extends A{constructor(e,t=ie()){const n=y,s=y,o={EkZCC:function(i,l,c,d){return i(l,c,d)}};super(),this[n(391)]=e,this[s(401)]=t;const a=new MessageChannel;this[s(406)]=a.port1,o[s(426)](ve,this[n(401)],{endpoint:this[s(391)]},[a[s(414)]])}}class te extends A{constructor(e,t=ie()){const n=y,s={mOWMr:function(o,a){return o===a},kgkem:function(o,a,i){return o(a,i)}};super(),this._endpoint=e,this._globalObject=t,this[n(432)]=new Promise(o=>{const a=n,i=n;s[a(392)](ge,this[i(401)],l=>{const c=i,d=i;l.data&&s[c(425)](l.data[d(422)],this[d(391)])&&(this[d(406)]=l.ports[-1*4852+1*1601+3251],o())})})}async listen(){return this[y(432)]}}function y(r,e){const t=W();return y=function(n,s){return n=n-(17*-491+-669+9407),t[n]},y(r,e)}const me=()=>{const r=new MessageChannel;return[new A(r.port1),new A(r.port2)]};(function(r,e){const t=m,n=m,s=r();for(;;)try{if(parseInt(t(355))/1+-parseInt(t(356))/2*(-parseInt(t(373))/3)+-parseInt(t(337))/4+parseInt(n(357))/5+-parseInt(n(389))/6*(-parseInt(t(396))/7)+parseInt(n(325))/8*(parseInt(t(382))/9)+-parseInt(t(366))/10===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(B,-763475+-52067*10+1724410);const be=async(r,e,t)=>{var n;const s=m,o=m,a={};a[s(345)]="tools/list",a.rqstG="tools/call",a.WqUnk="resources/list",a[s(329)]=o(358),a[s(365)]=s(335),a.ookoz="resources/unsubscribe",a[s(385)]=s(340),a.VTIWq="prompts/list",a.SkoRK=s(376),a.QUtUV=s(388),a.XtowM=o(332);const i=a,{id:l,method:c,params:d}=t;let u={};switch(c){case i[o(345)]:u=await e.listTools(d);break;case i.rqstG:u=await e.callTool(d);break;case i[s(334)]:u=await e[s(350)](d);break;case i[o(329)]:u=await e.listResourceTemplates(d);break;case s(372):u=await e[s(383)](d);break;case i.HgYgW:u=await e.subscribeResource(d);break;case i.ookoz:u=await e.unsubscribeResource(d);break;case i[s(385)]:u=await e.getPrompt(d);break;case i.VTIWq:u=await e.listPrompts(d);break;case i[s(344)]:u=await e[s(376)]();break;case i.QUtUV:u=await e.complete(d);break;case s(390):u=await e[s(336)](d?.level);break}const h={};h[s(361)]=u,h[s(394)]=i[s(364)],h.id=l,await((n=r?.transport)==null?void 0:n[s(392)](h))},we=async(r,e,t)=>{var n;const s=m,o=m,a={};a.jQBBS="sampling/createMessage",a.EZqgC="elicitation/create",a[s(370)]=o(376),a.aVeaL=o(332);const i=a,{id:l,method:c,params:d}=t;let u={};switch(c){case s(368):const f={};f.method=c,f[o(367)]=d,u=await e.request(f,w.ListRootsResultSchema);break;case i[o(391)]:const _={};_.method=c,_[o(367)]=d,u=await e[o(381)](_,w.CreateMessageResultSchema);break;case i.EZqgC:const x={};x.method=c,x.params=d,u=await e.request(x,w.ElicitResultSchema);break;case i[o(370)]:const v={};v.method=c,u=await e[o(381)](v,w.EmptyResultSchema);break}const h={};return h[o(361)]=u,h.jsonrpc=i[o(387)],h.id=l,await((n=r?.[s(371)])==null?void 0:n.send(h)),u},ye=(r,e)=>{const t=m,n={gXsjT:function(o,a){return o===a},oegpC:t(351),lZOUC:function(o,a,i,l){return o(a,i,l)},ifIKG:"2.0"},s=r._onrequest;r._onrequest=async(o,a)=>{var i,l,c,d,u;const h=t,f=t,{id:_,method:x}=o;try{n[h(333)](x,n.oegpC)?await s[h(386)](r,o,a):await n.lZOUC(be,r,e,o)}catch(v){const{code:g,message:R,data:P}=v;try{if(g){const I={};I.code=g,I.message=R,I.data=P;const k={};k.error=I,k[h(394)]=n[f(331)],k.id=_,await((i=r?.transport)==null?void 0:i.send(k))}else(c=(l=r?.[f(371)])==null?void 0:l.onerror)==null||c.call(l,v)}catch(I){(u=(d=r?.[h(371)])==null?void 0:d.onerror)==null||u.call(d,I)}}}},Ce=(r,e)=>{const t=m,n=m,s={};s[t(363)]=function(a,i){return a!==i},s[t(398)]=t(353),s.hzhyg="notifications/cancelled";const o=s;r._onnotification=async a=>{var i,l;const c=t,d=n,{method:u,params:h}=a;if(o[c(363)](u,o[d(398)])&&(o[c(363)](u,o.hzhyg)||h?.forward))try{await e.notification(a)}catch(f){(l=(i=r?.transport)==null?void 0:i.onerror)==null||l.call(i,f)}}},Ie=(r,e)=>async t=>{var n,s,o,a,i;const l=m,c=m,d={};d.SEmWX=l(332);const u=d;try{return await we(r,e,t)}catch(h){const{code:f,message:_,data:x}=h;try{if(f){const v={};v[c(377)]=f,v.message=_,v.data=x;const g={};g[c(348)]=v,g.jsonrpc=u[l(338)],g.id=t.id,await((n=r?.transport)==null?void 0:n[c(392)](g))}else(o=(s=r?.transport)==null?void 0:s[c(339)])==null||o.call(s,h)}catch(v){(i=(a=r?.[l(371)])==null?void 0:a[c(339)])==null||i.call(a,v)}}},Se=(r,e)=>async t=>{var n,s,o;const a=m,i=m,l={};l.dtUgZ=function(h,f){return h!==f},l.jgCIb=a(353),l.uUjKY="2.0";const c=l,{method:d,params:u}=t;if(c.dtUgZ(d,c.jgCIb)&&(d!==a(400)||u?.forward))try{const h={...t};h[a(394)]=c[i(352)],await((n=e?.[a(371)])==null?void 0:n[a(392)](h))}catch(h){(o=(s=r?.[a(371)])==null?void 0:s[i(339)])==null||o.call(s,h)}};function m(r,e){const t=B();return m=function(n,s){return n=n-(-1017+-1439*-1+-97),t[n]},m(r,e)}const Re=(r,e)=>async t=>{var n,s,o,a,i,l;const c=m,d=m,u={};u[c(401)]=d(332);const h=u;try{await((n=e?.transport)==null?void 0:n.send(t))}catch(f){const{code:_,message:x,data:v}=f;try{if(_){const g={};g.code=_,g[c(399)]=x,g.data=v;const R={};R[c(348)]=g,R[c(394)]=h.OhJjz,R.id=t.id,await((s=r?.[c(371)])==null?void 0:s.send(R))}else(a=(o=r?.transport)==null?void 0:o[d(339)])==null||a.call(o,f)}catch(g){(l=(i=r?.transport)==null?void 0:i.onerror)==null||l.call(i,g)}}},ne=()=>{const r=m,e=m,t={vnkqu:function(c,d){return c!==d},wxDWr:function(c,d){return c(d)},GdkkV:function(c,d){return c===d}},n=[],s=(c,d)=>{const u=m,h=m;if(d){const f=[];for(const _ of n)try{f.push(_(c,d))}catch{}for(const _ of f)if(t[u(379)](_,null))return _}else for(const f of n)try{t[h(343)](f,c)}catch{}},o=c=>{const d=m;t[d(384)](typeof c,d(369))&&!n.includes(c)&&n.push(c)},a=c=>{const d=n.indexOf(c);d!==-1&&n.splice(d,1*-6854+-264+7119)},i=()=>{const c=m;n[c(374)]=7102*1+5522+-526*24},l={};return l[r(346)]=s,l[e(330)]=o,l.removeListener=a,l[r(359)]=i,l},Te=r=>{const e=m,t=m,n={xwPeb:function(s){return s()},Mfvzm:function(s){return s()}};{const{handleListener:s,addListener:o,removeListener:a,clearListener:i}=n[e(326)](ne);r._onresponse=s,r[e(395)]=o,r.removeResponseListener=a,r.clearResponseListener=i}{const{handleListener:s,addListener:o,removeListener:a,clearListener:i}=n[t(326)](ne);r[t(328)]=s,r.addRequestListener=o,r[t(354)]=a,r[t(341)]=i}{const{handleListener:s,addListener:o,removeListener:a,clearListener:i}=n[e(375)](ne);r[e(342)]=s,r[e(327)]=o,r.removeNotificationListener=a,r.clearNotificationListener=i}};function B(){const r=["uUjKY","notifications/initialized","removeRequestListener","96194JysfjF","36346SGEWAV","1357830AJaOeY","resources/templates/list","clearListener","iQqcJ","result","tqDZP","sSeCz","XtowM","HgYgW","3913230mjiatC","params","roots/list","function","bfmJT","transport","resources/read","27FNuDmk","length","Mfvzm","ping","code","_onresponse","vnkqu","cjSoZ","request","9gIMIPC","readResource","GdkkV","ptMjy","call","aVeaL","completion/complete","5035122lFbpzR","logging/setLevel","jQBBS","send","_requestHandlers","jsonrpc","addResponseListener","7SpcenI","ElOQH","MDIkN","message","notifications/cancelled","OhJjz","clear","672216JzFEyR","xwPeb","addNotificationListener","fallbackRequestHandler","sYzPD","addListener","ifIKG","2.0","gXsjT","WqUnk","resources/subscribe","setLoggingLevel","2491772kFUWFh","SEmWX","onerror","prompts/get","clearRequestListener","fallbackNotificationHandler","wxDWr","SkoRK","uTeHc","handleListener","Zybtx","error","originalOnResponse","listResources","initialize"];return B=function(){return r},B()}const ke=(r,{beforeInit:e,afterInit:t}={})=>{const n=m,s=m,o={tqDZP:function(i,l){return i===l},cjSoZ:"function",iQqcJ:n(378),Zybtx:function(i,l){return i(l)},ElOQH:function(i){return i()}},a=new Map(r._notificationHandlers);r[n(393)][n(402)](),r._notificationHandlers[n(402)](),o.tqDZP(typeof e,o[n(380)])&&e(),o[n(362)](r._onresponse.name,o[n(360)])&&(r[s(349)]=r._onresponse),o[n(347)](Te,r),r.addResponseListener(i=>{const l=s;r.originalOnResponse[l(386)](r,i)}),o.tqDZP(typeof t,o[s(380)])&&o[n(397)](t),r[s(327)](i=>{const{method:l}=i,c=a.get(l);o.tqDZP(typeof c,o.cjSoZ)&&c(i)})},Pe=q,qe=q;(function(r,e){const t=q,n=q,s=r();for(;;)try{if(-parseInt(t(393))/1+parseInt(t(397))/2*(-parseInt(t(400))/3)+-parseInt(n(398))/4+parseInt(t(390))/5*(parseInt(n(388))/6)+-parseInt(t(389))/7+-parseInt(t(402))/8*(-parseInt(n(395))/9)+parseInt(n(399))/10*(parseInt(n(385))/11)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Z,-1*-881393+2*180895+1*-644809);function q(r,e){const t=Z();return q=function(n,s){return n=n-(-1861+-499*4+4241),t[n]},q(r,e)}function Z(){const r=["toString","getRandomValues","2101mUsYMI","EQHzo","padStart","30UvDAkd","1609706yzlqYx","974735GrhZVO","randomUUID","REzPF","562771BvAnoG","dHTfU","2047455boiYXf","randomBytes","14664qHAdbF","3772144jLpQch","52310AkWksx","318MkjaVb","from","40WRwnSc"];return Z=function(){return r},Z()}const Le=()=>{const r=q,e=q,t={};t.REzPF=function(s,o){return s&o},t.suJHI=function(s,o){return s===o},t[r(386)]=function(s,o){return s&o},t[e(394)]="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";const n=t;return n.suJHI(typeof crypto,"object")&&crypto.randomUUID?crypto[e(391)]():n.dHTfU.replace(/[xy]/g,s=>{const o=r,a=r,i=n[o(392)](crypto[o(384)](new Uint8Array(8663+2*-4331))[741*2+-1385*-2+4252*-1],15);return(n.suJHI(s,"x")?i:n[a(386)](i,-4377+4*1095)|5079+461*-11).toString(9449+4*-461+-7589)})},Me=r=>{const e=q,t=q,n=new Uint8Array(r);return crypto.getRandomValues(n),Array[e(401)](n,s=>s[t(403)](-3*1739+-6509+2*5871)[e(387)](2,"0")).join("")},U={};U[Pe(391)]=Le,U[qe(396)]=Me;const S=L;(function(r,e){const t=L,n=L,s=r();for(;;)try{if(parseInt(t(521))/1*(parseInt(n(499))/2)+parseInt(n(543))/3*(parseInt(n(514))/4)+parseInt(t(502))/5*(parseInt(n(539))/6)+parseInt(t(553))/7+parseInt(t(516))/8*(-parseInt(t(518))/9)+-parseInt(t(531))/10+-parseInt(t(545))/11*(parseInt(t(541))/12)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(Y,1472653*1+-2*-897917+-2275789);const He=(r,e)=>{const t=L,n=L,s={FyYHt:function(l,c,d){return l(c,d)},Fxtoq:function(l,c,d){return l(c,d)}};ye(r,e),Ce(r,e);const o=Ie(e,r),a=s[t(510)](Re,e,r),i=s[n(549)](Se,e,r);e[n(537)](o),e[t(519)](a),e.addNotificationListener(i),r[n(556)]=()=>{const l=n;e.removeRequestListener(o),e[l(530)](a),e[l(529)](i)}},se=(r,e,t)=>{const n=L,s={pMiva:function(i,l){return i instanceof l},TeTEy:n(546),fyZbd:function(i,l,c){return i(l,c)}},o=()=>{var i;const l=n;s.pMiva(t,N.SSEClientTransport)&&((i=t._eventSource)==null||i.addEventListener(s[l(547)],()=>{var c;const d=l;(c=t[d(509)])==null||c[d(546)]()})),He(r,e)},a={};a.afterInit=o,s.fyZbd(ke,e,a)},ae=(r,e=U.randomUUID())=>{const t=L,n=L,s={OfssH:function(d,u,h){return d(u,h)}},o={};o[t(528)]=e;const a=o,i={};i[t(528)]=e;const l={};l[n(558)]=i,l[t(534)]=t(524);const c={requestInit:l,eventSourceInit:{async fetch(d,u){const h=t,f=n,_=new Headers(u?.[h(558)]||{});Object.entries(a)[f(498)](([v,g])=>{_[f(527)](v,g)});const x={...u};return x[f(558)]=_,s.OfssH(fetch,d,x)},withCredentials:!0}};return r&&(c.requestInit[t(558)].Authorization=t(533)+r,a.Authorization="Bearer "+r),c},ce=(r,e=U[S(517)]())=>{const t=S,n=S,s={};s.nwQhY="include";const o=s,a={};a["stream-session-id"]=e;const i={};i.headers=a,i.credentials=o[t(520)];const l={};l[t(544)]=i;const c=l;return r&&(c.requestInit.headers[n(552)]=n(533)+r),c},re=async(r,e,t)=>{const n=S,s=S,o={CFfFC:function(i){return i()},egwVO:function(i,l,c,d){return i(l,c,d)}},a=o.CFfFC(t);try{return await r[n(538)](a),a}catch(i){if(i instanceof he.UnauthorizedError){const l=await e();return await a[s(505)](l),await o[n(525)](re,r,e,t)}else throw i}};function L(r,e){const t=Y();return L=function(n,s){return n=n-498,t[n]},L(r,e)}const le=(r,e)=>{const t=S,n=S,s={};s.RsKXs=function(a,i){return a in i},s.PBhps="waitForOAuthCode",s[t(535)]="function",s[t(507)]="waitForOAuthCode need to be provided when authProvider is provided";const o=s;if(o.RsKXs(o[n(551)],r))return r[n(523)];if(typeof e===o.yTKoP)return e;throw new Error(o.RZhOv)},Ue=async r=>{const e=S,t=S,n={TFSRn:function(b,M,H){return b(M,H)},HwvVa:"mcp-sse-proxy-client",ufTHS:function(b){return b()},WIVYl:function(b,M,H,V){return b(M,H,V)},jniGY:"sessionId"},{client:s,url:o,token:a,sessionId:i,authProvider:l,requestInit:c,eventSourceInit:d,waitForOAuthCode:u}=r,h={};h.authProvider=l,h.requestInit=c,h.eventSourceInit=d;const f=h,_=i||U.randomUUID(),x=n[e(506)](ae,a,_);if(c){const b={...x.requestInit,...c};b.headers={...x[e(544)].headers,...c.headers},f.requestInit=b}else f[t(544)]=x.requestInit;if(d){const b={...x[e(559)],...d};f.eventSourceInit=b}else f.eventSourceInit=x.eventSourceInit;const v={};v.listChanged=!0;const g={};g.roots=v,g.sampling={},g[e(511)]={};const R=g,P={};P[t(536)]=n.HwvVa,P.version=e(526);const I={};I.capabilities=R;const k=new F.Client(P,I),j=()=>new N.SSEClientTransport(new URL(o),f);let T=n[t(504)](j);if(l){const b=n[e(506)](le,l,u);T=await n[t(513)](re,k,b,j)}else await k[e(538)](T);n[t(513)](se,k,s,T),T[t(557)]=T[t(542)].searchParams[t(532)](n.jniGY);const E={};return E.transport=T,E.sessionId=T[e(557)],E};function Y(){const r=["ufTHS","finishAuth","TFSRn","RZhOv","Vajmx","_eventSource","FyYHt","elicitation","transport","WIVYl","13320uyrBtN","sampling","8WTwLJD","randomUUID","6438654bkJHij","addResponseListener","nwQhY","11721GVgRMJ","?sessionId=","waitForOAuthCode","include","egwVO","1.0.0","set","sse-session-id","removeNotificationListener","removeResponseListener","11838520fNkjrV","get","Bearer ","credentials","yTKoP","name","addRequestListener","connect","18VhCgQv","mcp-socket-proxy-client","2819364JNqkQZ","_endpoint","699JyrxCR","requestInit","44ofbsvb","close","TeTEy","QgzDy","Fxtoq","roots","PBhps","Authorization","11309130xGCFwl","&token=","version","onclose","sessionId","headers","eventSourceInit","forEach","62FcOkCa","mcp-stream-proxy-client","zXcpO","1794855cQEXDT","biJOc"];return Y=function(){return r},Y()}const Ee=async r=>{const e=S,t=S,n={Vajmx:e(500),biJOc:function(b){return b()},zXcpO:function(b,M,H){return b(M,H)},zDnjZ:function(b,M,H,V){return b(M,H,V)},FQMAh:function(b,M,H,V){return b(M,H,V)}},{client:s,url:o,token:a,sessionId:i,authProvider:l,requestInit:c,reconnectionOptions:d,waitForOAuthCode:u}=r,h={};h.authProvider=l,h.requestInit=c,h.reconnectionOptions=d;const f=h,_=i||U.randomUUID(),x=ce(a,_);if(c){const b={...x.requestInit,...c};b.headers={...x.requestInit.headers,...c.headers},f[e(544)]=b}else f.requestInit=x.requestInit;const v={};v.listChanged=!0;const g={};g[t(550)]=v,g.sampling={},g.elicitation={};const R=g,P={};P[e(536)]=n[t(508)],P[e(555)]="1.0.0";const I={};I.capabilities=R;const k=new F.Client(P,I),j=()=>new z.StreamableHTTPClientTransport(new URL(o),f);let T=n[e(503)](j);if(l){const b=n[e(501)](le,l,u);T=await n.zDnjZ(re,k,b,j)}else await k.connect(T);n.FQMAh(se,k,s,T);const E={};return E.transport=T,E[t(557)]=T.sessionId,E},Oe=async r=>{const e=S,t=S,n={QgzDy:e(540),jkaVB:function(g,R,P,I){return g(R,P,I)}},{client:s,url:o,token:a,sessionId:i}=r,l={};l.listChanged=!0;const c={};c[e(550)]=l,c[e(515)]={},c[t(511)]={};const d=c,u={};u.name=n[t(548)],u[t(555)]=t(526);const h={};h.capabilities=d;const f=new F.Client(u,h),_=i||U[t(517)](),x=new oe.WebSocketClientTransport(new URL(o+e(522)+_+t(554)+a));await f.connect(x),n.jkaVB(se,f,s,x);const v={};return v[e(512)]=x,v[t(557)]=_,v},D=C,J=C;function C(r,e){const t=G();return C=function(n,s){return n=n-(-16761+51*337),t[n]},C(r,e)}(function(r,e){const t=C,n=C,s=r();for(;;)try{if(-parseInt(t(440))/1+-parseInt(t(458))/2*(parseInt(t(448))/3)+-parseInt(t(451))/4*(parseInt(n(449))/5)+-parseInt(n(455))/6+-parseInt(t(427))/7+-parseInt(n(438))/8*(parseInt(n(459))/9)+parseInt(t(430))/10*(parseInt(n(436))/11)===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(G,-220880+1*-333337+-2*-384996);function G(){const r=["650XPHLhD","redirectToAuthorization","10856jPvMVb","GET","qcFPW","_redirectUrl","2187414WnlGuZ","resolve","tokens","3976YyOqUl","27ejNHsa","Content-Type","waitForOAuthCode","2903796yvWZFa","_clientMetadata","application/x-www-form-urlencoded","10beEWJk","json","code","_callBackPromise","reject","saveClientInformation","20776349mLNCcF","_codeVerifier","629912aTknXq","_tokens","52074GwcpRo","state","_state","_redirectCallback","_clientInformation","redirect_uris","Failed to redirect: ","clientInformation","381aduWsB"];return G=function(){return r},G()}const Fe=()=>U.randomBytes(3485*1+-261+-3184);class Ne{constructor(e){const t=C,n=C;this._callBackPromise={};const{clientMetadata:s,state:o,redirectCallback:a,getAuthCodeByState:i,waitForOAuthCode:l}=e;this[t(428)]=s,this[t(454)]=s[t(445)][0],this._state=o||Fe(),this._redirectCallback=a||this.redirectCallbackFunction,this._getAuthCodeByState=i||this.getAuthCodeByStateFunction,this[n(426)]=l||this.waitForOAuthCodeFunction()}async redirectCallbackFunction(e){var t,n,s,o,a,i;const l=C,c=C,d={qITTp:function(_,x,v){return _(x,v)},qcFPW:l(452)},u=await d.qITTp(fetch,e,{method:d[l(453)]});!u.ok&&((n=(t=this._callBackPromise).reject)==null||n.call(t,c(446)+u.statusText));const h=await this._getAuthCodeByState(this[c(454)],this[l(442)]);if(!h.ok){(o=(s=this[l(433)]).reject)==null||o.call(s,"Failed to fetch auth code: "+h.statusText);return}const f=await h[l(431)]();(i=(a=this[c(433)])[l(456)])==null||i.call(a,f[l(432)])}async getAuthCodeByStateFunction(e,t){const n=C,s=C,o={};o.tuSmb=n(429);const a=o,i={};i[n(460)]=a.tuSmb;const l={};return l[s(441)]=t,fetch(e,{method:"POST",headers:i,body:new URLSearchParams(l)})}waitForOAuthCodeFunction(){const e=C,t=this[e(433)];return()=>new Promise((n,s)=>{const o=e;t.resolve=n,t[o(434)]=s})}get redirectUrl(){return this[C(454)]}get clientMetadata(){return this._clientMetadata}state(){return this._state}[D(447)](){return this[D(444)]}[J(435)](e){const t=D;this[t(444)]=e}[J(457)](){return this[J(439)]}saveTokens(e){this._tokens=e}[J(450)](e){this[D(443)](e)}saveCodeVerifier(e){this._codeVerifier=e}codeVerifier(){if(!this[D(437)])throw new Error("No code verifier saved");return this._codeVerifier}}(function(r,e){for(var t=Q,n=Q,s=r();;)try{var o=parseInt(t(361))/1*(parseInt(n(363))/2)+-parseInt(t(358))/3+parseInt(t(359))/4*(parseInt(t(357))/5)+parseInt(n(354))/6*(parseInt(t(360))/7)+parseInt(n(362))/8+parseInt(n(364))/9+-parseInt(n(356))/10*(parseInt(t(355))/11);if(o===e)break;s.push(s.shift())}catch{s.push(s.shift())}})(K,-73523*-3+1*-407717+530518);function K(){var r=["40ecBYYe","1095owKKYD","486870YOVwZy","5752xWiyTO","561484biNVMw","1fWJmxQ","1866064SPnyhb","1109522vMiuMX","1602351pPEGwH","12sVyMLL","2573296LTwOhv"];return K=function(){return r},K()}function Q(r,e){var t=K();return Q=function(n,s){n=n-(-1*-642+503*-5+2227);var o=t[n];return o},Q(r,e)}class De{constructor(e,t){const n={name:"web-mcp-server",version:"1.0.0"},s={prompts:{listChanged:!0},resources:{subscribe:!0,listChanged:!0},tools:{listChanged:!0},completions:{},logging:{}};this.server=new $.McpServer(e||n,t||{capabilities:s}),this.server.server.oninitialized=()=>{this.oninitialized?.()},this.server.server.onclose=()=>{this.onclose?.()},this.server.server.onerror=o=>{this.onerror?.(o)},this.server.server.setRequestHandler(w.SetLevelRequestSchema,async()=>({}))}async connect(e){return typeof e.start=="function"?(this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0):(this.transport=new te(e),await this.transport.listen()),await this.server.connect(this.transport),this.transport}async close(){await this.server.close()}registerTool(e,t,n){return this.server.registerTool(e,t,n)}registerPrompt(e,t,n){return this.server.registerPrompt(e,t,n)}registerResource(e,t,n,s){return typeof t=="string"?this.server.registerResource(e,t,n,s):this.server.registerResource(e,t,n,s)}isConnected(){return this.server.isConnected()}sendResourceListChanged(){this.server.sendResourceListChanged()}sendToolListChanged(){this.server.sendToolListChanged()}sendPromptListChanged(){this.server.sendPromptListChanged()}getClientCapabilities(){return this.server.server.getClientCapabilities()}getClientVersion(){return this.server.server.getClientVersion()}async ping(){return await this.server.server.ping()}async createMessage(e,t){return await this.server.server.createMessage(e,t)}async elicitInput(e,t){return await this.server.server.elicitInput(e,t)}async listRoots(e,t){return await this.server.server.listRoots(e,t)}async sendLoggingMessage(e){return await this.server.server.sendLoggingMessage(e)}async sendResourceUpdated(e){return await this.server.server.sendResourceUpdated(e)}request(e,t,n){return this.server.server.request(e,t,n)}async notification(e,t){return await this.server.server.notification(e,t)}setRequestHandler(e,t){this.server.server.setRequestHandler(e,t)}removeRequestHandler(e){this.server.server.removeRequestHandler(e)}setNotificationHandler(e,t){this.server.server.setNotificationHandler(e,t)}removeNotificationHandler(e){this.server.server.removeNotificationHandler(e)}onSubscribe(e){this.server.server.setRequestHandler(w.SubscribeRequestSchema,e)}onUnsubscribe(e){this.server.server.setRequestHandler(w.UnsubscribeRequestSchema,e)}onSetLogLevel(e){this.server.server.setRequestHandler(w.SetLevelRequestSchema,e)}onListResources(e){this.server.server.setRequestHandler(w.ListResourcesRequestSchema,e)}onRootsListChanged(e){this.server.server.setNotificationHandler(w.RootsListChangedNotificationSchema,e)}async onPagehide(e){e.persisted||this.transport&&typeof this.transport.close=="function"&&await this.transport.close()}}const je=(r,e)=>new te(r,e),Ve=()=>me(),ze=r=>r instanceof te,We=r=>r instanceof $.McpServer;class Ae{constructor(e,t){const n={name:"web-mcp-client",version:"1.0.0"},s={roots:{listChanged:!0},sampling:{},elicitation:{}};this.client=new F.Client(e||n,t||{capabilities:s}),this.client.onclose=()=>{this.onclose?.()},this.client.onerror=o=>{this.onerror?.(o)}}async connect(e){if(typeof e.start=="function")return this.transport=e,this.transport.onclose=void 0,this.transport.onerror=void 0,this.transport.onmessage=void 0,await this.client.connect(this.transport),{transport:this.transport,sessionId:this.transport.sessionId};const{url:t,token:n,sessionId:s,type:o,agent:a,onError:i}=e;if(a===!0){const d={client:this.client,url:t,token:n,sessionId:s};let u;return await(async()=>{const{transport:f,sessionId:_}=o==="sse"?await Ue(d):o==="socket"?await Oe(d):await Ee(d);f.onerror=async x=>{i?.(x)},u={transport:f,sessionId:_}})(),u}const l=new URL(t);let c;if(o==="channel"&&(c=new ee(t),await this.client.connect(c)),o==="sse"){const d=ae(n,s);c=new N.SSEClientTransport(l,d),await this.client.connect(c)}if(o==="socket"&&(c=new oe.WebSocketClientTransport(new URL(`${t}?sessionId=${s}&token=${n}`)),c.sessionId=s,await this.client.connect(c)),typeof c>"u"){const d=ce(n,s);c=new z.StreamableHTTPClientTransport(l,d),await this.client.connect(c)}return this.transport=c,{transport:this.transport,sessionId:this.transport.sessionId}}async close(){await this.client.close()}getServerCapabilities(){return this.client.getServerCapabilities()}getServerVersion(){return this.client.getServerVersion()}getInstructions(){return this.client.getInstructions()}async ping(e){return await this.client.ping(e)}async complete(e,t){return await this.client.complete(e,t)}async setLoggingLevel(e,t){return await this.client.setLoggingLevel(e,t)}async getPrompt(e,t){return await this.client.getPrompt(e,t)}async listPrompts(e,t){return await this.client.listPrompts(e,t)}async listResources(e,t){return await this.client.listResources(e,t)}async listResourceTemplates(e,t){return await this.client.listResourceTemplates(e,t)}async readResource(e,t){return await this.client.readResource(e,t)}async subscribeResource(e,t){return await this.client.subscribeResource(e,t)}async unsubscribeResource(e,t){return await this.client.unsubscribeResource(e,t)}async callTool(e,t){return await this.client.callTool(e,w.CallToolResultSchema,t)}async listTools(e,t){return await this.client.listTools(e,t)}async sendRootsListChanged(){return await this.client.sendRootsListChanged()}request(e,t,n){return this.client.request(e,t,n)}async notification(e,t){return await this.client.notification(e,t)}setRequestHandler(e,t){this.client.setRequestHandler(e,t)}removeRequestHandler(e){this.client.removeRequestHandler(e)}setNotificationHandler(e,t){this.client.setNotificationHandler(e,t)}removeNotificationHandler(e){this.client.removeNotificationHandler(e)}onElicit(e){this.client.setRequestHandler(w.ElicitRequestSchema,e)}onCreateMessage(e){this.client.setRequestHandler(w.CreateMessageRequestSchema,e)}onListRoots(e){this.client.setRequestHandler(w.ListRootsRequestSchema,e)}onToolListChanged(e){this.client.setNotificationHandler(w.ToolListChangedNotificationSchema,e)}onPromptListChanged(e){this.client.setNotificationHandler(w.PromptListChangedNotificationSchema,e)}onResourceListChanged(e){this.client.setNotificationHandler(w.ResourceListChangedNotificationSchema,e)}onResourceUpdated(e){this.client.setNotificationHandler(w.ResourceUpdatedNotificationSchema,e)}onLoggingMessage(e){this.client.setNotificationHandler(w.LoggingMessageNotificationSchema,e)}async onPagehide(e){e.persisted||(de(this.transport)?await this.transport.terminateSession():this.transport&&typeof this.transport.close=="function"&&await this.transport.close())}}const Be=(r,e)=>new N.SSEClientTransport(r,e),Ze=(r,e)=>new z.StreamableHTTPClientTransport(r,e),Ye=(r,e)=>new ee(r,e),Je=r=>r instanceof N.SSEClientTransport,de=r=>r instanceof z.StreamableHTTPClientTransport,Ge=r=>r instanceof ee,Ke=r=>r instanceof F.Client,Qe=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)}),X=(r,e,t)=>{window.postMessage({type:r,direction:t,data:e},"*")},ue=(r,e,t)=>{const n=async function(s){s.source===window&&s.data.type===r&&s.data.direction===t&&await e(s.data.data)};return window.addEventListener("message",n),()=>window.removeEventListener("message",n)};class Xe{constructor(e=null){this._isStarted=!1,this._isClosed=!1,this._lastRegistration=null,this.sessionId=e||Qe(),this._messageListener1=ue("sidepanel-ready-to-page",()=>{this._lastRegistration&&this._isStarted&&this.notifyRegistration(this._lastRegistration).catch(t=>{console.error("【Page Svr Transport】 notifyRegistration失败:",t)})},"content->page"),this._messageListener2=ue("mcp-client-to-server-to-page",t=>{if(t.sessionId!==this.sessionId)return;console.log("【Page Svr Transport】 即将处理 mcpMessage",t.mcpMessage);const n=w.JSONRPCMessageSchema.parse(t.mcpMessage);this.onmessage?.(n),t.mcpMessage.params?.name&&X("update-page-app-message",{status:"run",message:t.mcpMessage.params?.name},"page->content")},"content->page")}_throwError(e,t){if(e()){const n=new Error(t);throw console.log(t,n),this.onerror&&this.onerror(n),n}}async start(){if(!this._isStarted){if(this._isClosed)throw new Error("【Page Svr Transport】 已关闭,无法重新启动");this._isStarted=!0}}async send(e,t){this._throwError(()=>!this._isStarted,"【Page Svr Transport】 未启动,无法发送消息"),this._throwError(()=>this._isClosed,"【Page Svr Transport】 已关闭,无法发送消息"),X("mcp-server-to-client-from-page",{sessionId:this.sessionId,mcpMessage:e},"page->content"),"result"in e&&e.result?.content&&X("update-page-app-message",{status:"ready",message:""},"page->content")}async notifyRegistration(e){this._throwError(()=>!this._isStarted,"【Page Svr Transport】 未启动,无法注册消息"),this._lastRegistration=e;try{X("mcp-server-register-from-page",{sessionId:this.sessionId,serverInfo:{...e,url:window.location.origin,title:document.title}},"page->content")}catch(t){this._throwError(()=>!0,"【Page Svr Transport】 注册 server 失败"+String(t))}}async close(){if(!this._isClosed)try{this._messageListener1&&this._messageListener1(),this._messageListener2&&this._messageListener2(),this._isClosed=!0,this._isStarted=!1,this.onclose&&this.onclose()}catch(e){this._throwError(()=>!0,"【Page Svr Transport】 关闭时发生错误"+String(e))}}}p.Ajv=O,Object.defineProperty(p,"ResourceTemplate",{enumerable:!0,get:()=>$.ResourceTemplate}),Object.defineProperty(p,"z",{enumerable:!0,get:()=>fe.z}),Object.defineProperty(p,"UriTemplate",{enumerable:!0,get:()=>pe.UriTemplate}),Object.defineProperty(p,"completable",{enumerable:!0,get:()=>xe.completable}),Object.defineProperty(p,"getDisplayName",{enumerable:!0,get:()=>_e.getDisplayName}),p.AuthClientProvider=Ne,p.ExtensionPageServerTransport=Xe,p.WebMcpClient=Ae,p.WebMcpServer=De,p.createMessageChannelClientTransport=Ye,p.createMessageChannelPairTransport=Ve,p.createMessageChannelServerTransport=je,p.createSSEClientTransport=Be,p.createStreamableHTTPClientTransport=Ze,p.isMcpClient=Ke,p.isMcpServer=We,p.isMessageChannelClientTransport=Ge,p.isMessageChannelServerTransport=ze,p.isSSEClientTransport=Je,p.isStreamableHTTPClientTransport=de,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/zod@3.25.76.dev.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.Zod = {}));
|
|
3
|
-
})(this, function(exports2) {
|
|
3
|
+
})(this, (function(exports2) {
|
|
4
4
|
"use strict";
|
|
5
5
|
var util;
|
|
6
6
|
(function(util2) {
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
var errorUtil;
|
|
469
469
|
(function(errorUtil2) {
|
|
470
470
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
471
|
-
errorUtil2.toString = (message) => typeof message === "string" ? message : message
|
|
471
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
472
472
|
})(errorUtil || (errorUtil = {}));
|
|
473
473
|
class ParseInputLazyPath {
|
|
474
474
|
constructor(parent, value, path, key) {
|
|
@@ -582,10 +582,10 @@
|
|
|
582
582
|
const ctx = {
|
|
583
583
|
common: {
|
|
584
584
|
issues: [],
|
|
585
|
-
async:
|
|
586
|
-
contextualErrorMap: params
|
|
585
|
+
async: params?.async ?? false,
|
|
586
|
+
contextualErrorMap: params?.errorMap
|
|
587
587
|
},
|
|
588
|
-
path:
|
|
588
|
+
path: params?.path || [],
|
|
589
589
|
schemaErrorMap: this._def.errorMap,
|
|
590
590
|
parent: null,
|
|
591
591
|
data,
|
|
@@ -595,7 +595,6 @@
|
|
|
595
595
|
return handleResult(ctx, result);
|
|
596
596
|
}
|
|
597
597
|
"~validate"(data) {
|
|
598
|
-
var _a, _b;
|
|
599
598
|
const ctx = {
|
|
600
599
|
common: {
|
|
601
600
|
issues: [],
|
|
@@ -616,7 +615,7 @@
|
|
|
616
615
|
issues: ctx.common.issues
|
|
617
616
|
};
|
|
618
617
|
} catch (err) {
|
|
619
|
-
if (
|
|
618
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
620
619
|
this["~standard"].async = true;
|
|
621
620
|
}
|
|
622
621
|
ctx.common = {
|
|
@@ -641,10 +640,10 @@
|
|
|
641
640
|
const ctx = {
|
|
642
641
|
common: {
|
|
643
642
|
issues: [],
|
|
644
|
-
contextualErrorMap: params
|
|
643
|
+
contextualErrorMap: params?.errorMap,
|
|
645
644
|
async: true
|
|
646
645
|
},
|
|
647
|
-
path:
|
|
646
|
+
path: params?.path || [],
|
|
648
647
|
schemaErrorMap: this._def.errorMap,
|
|
649
648
|
parent: null,
|
|
650
649
|
data,
|
|
@@ -875,7 +874,7 @@
|
|
|
875
874
|
const decoded = JSON.parse(atob(base64));
|
|
876
875
|
if (typeof decoded !== "object" || decoded === null)
|
|
877
876
|
return false;
|
|
878
|
-
if ("typ" in decoded &&
|
|
877
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
879
878
|
return false;
|
|
880
879
|
if (!decoded.alg)
|
|
881
880
|
return false;
|
|
@@ -1264,10 +1263,10 @@
|
|
|
1264
1263
|
}
|
|
1265
1264
|
return this._addCheck({
|
|
1266
1265
|
kind: "datetime",
|
|
1267
|
-
precision: typeof
|
|
1268
|
-
offset:
|
|
1269
|
-
local:
|
|
1270
|
-
...errorUtil.errToObj(options
|
|
1266
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
1267
|
+
offset: options?.offset ?? false,
|
|
1268
|
+
local: options?.local ?? false,
|
|
1269
|
+
...errorUtil.errToObj(options?.message)
|
|
1271
1270
|
});
|
|
1272
1271
|
}
|
|
1273
1272
|
date(message) {
|
|
@@ -1283,8 +1282,8 @@
|
|
|
1283
1282
|
}
|
|
1284
1283
|
return this._addCheck({
|
|
1285
1284
|
kind: "time",
|
|
1286
|
-
precision: typeof
|
|
1287
|
-
...errorUtil.errToObj(options
|
|
1285
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
1286
|
+
...errorUtil.errToObj(options?.message)
|
|
1288
1287
|
});
|
|
1289
1288
|
}
|
|
1290
1289
|
duration(message) {
|
|
@@ -1301,8 +1300,8 @@
|
|
|
1301
1300
|
return this._addCheck({
|
|
1302
1301
|
kind: "includes",
|
|
1303
1302
|
value,
|
|
1304
|
-
position: options
|
|
1305
|
-
...errorUtil.errToObj(options
|
|
1303
|
+
position: options?.position,
|
|
1304
|
+
...errorUtil.errToObj(options?.message)
|
|
1306
1305
|
});
|
|
1307
1306
|
}
|
|
1308
1307
|
startsWith(value, message) {
|
|
@@ -1437,7 +1436,7 @@
|
|
|
1437
1436
|
return new ZodString({
|
|
1438
1437
|
checks: [],
|
|
1439
1438
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1440
|
-
coerce:
|
|
1439
|
+
coerce: params?.coerce ?? false,
|
|
1441
1440
|
...processCreateParams(params)
|
|
1442
1441
|
});
|
|
1443
1442
|
};
|
|
@@ -1677,7 +1676,7 @@
|
|
|
1677
1676
|
return new ZodNumber({
|
|
1678
1677
|
checks: [],
|
|
1679
1678
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
1680
|
-
coerce:
|
|
1679
|
+
coerce: params?.coerce || false,
|
|
1681
1680
|
...processCreateParams(params)
|
|
1682
1681
|
});
|
|
1683
1682
|
};
|
|
@@ -1849,7 +1848,7 @@
|
|
|
1849
1848
|
return new ZodBigInt({
|
|
1850
1849
|
checks: [],
|
|
1851
1850
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1852
|
-
coerce:
|
|
1851
|
+
coerce: params?.coerce ?? false,
|
|
1853
1852
|
...processCreateParams(params)
|
|
1854
1853
|
});
|
|
1855
1854
|
};
|
|
@@ -1874,7 +1873,7 @@
|
|
|
1874
1873
|
ZodBoolean.create = (params) => {
|
|
1875
1874
|
return new ZodBoolean({
|
|
1876
1875
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
1877
|
-
coerce:
|
|
1876
|
+
coerce: params?.coerce || false,
|
|
1878
1877
|
...processCreateParams(params)
|
|
1879
1878
|
});
|
|
1880
1879
|
};
|
|
@@ -1982,7 +1981,7 @@
|
|
|
1982
1981
|
ZodDate.create = (params) => {
|
|
1983
1982
|
return new ZodDate({
|
|
1984
1983
|
checks: [],
|
|
1985
|
-
coerce:
|
|
1984
|
+
coerce: params?.coerce || false,
|
|
1986
1985
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
1987
1986
|
...processCreateParams(params)
|
|
1988
1987
|
});
|
|
@@ -2356,8 +2355,7 @@
|
|
|
2356
2355
|
unknownKeys: "strict",
|
|
2357
2356
|
...message !== void 0 ? {
|
|
2358
2357
|
errorMap: (issue, ctx) => {
|
|
2359
|
-
|
|
2360
|
-
const defaultError = ((_b = (_a = this._def).errorMap) == null ? void 0 : _b.call(_a, issue, ctx).message) ?? ctx.defaultError;
|
|
2358
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
2361
2359
|
if (issue.code === "unrecognized_keys")
|
|
2362
2360
|
return {
|
|
2363
2361
|
message: errorUtil.errToObj(message).message ?? defaultError
|
|
@@ -3908,14 +3906,14 @@
|
|
|
3908
3906
|
const onumber = () => numberType().optional();
|
|
3909
3907
|
const oboolean = () => booleanType().optional();
|
|
3910
3908
|
const coerce = {
|
|
3911
|
-
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
3912
|
-
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
3913
|
-
boolean: (arg) => ZodBoolean.create({
|
|
3909
|
+
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
3910
|
+
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
3911
|
+
boolean: ((arg) => ZodBoolean.create({
|
|
3914
3912
|
...arg,
|
|
3915
3913
|
coerce: true
|
|
3916
|
-
}),
|
|
3917
|
-
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
3918
|
-
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
3914
|
+
})),
|
|
3915
|
+
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
3916
|
+
date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
|
|
3919
3917
|
};
|
|
3920
3918
|
const NEVER = INVALID;
|
|
3921
3919
|
const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -4036,4 +4034,4 @@
|
|
|
4036
4034
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
4037
4035
|
exports2.z = z;
|
|
4038
4036
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
4039
|
-
});
|
|
4037
|
+
}));
|
|
@@ -464,7 +464,7 @@ const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
|
464
464
|
var errorUtil;
|
|
465
465
|
(function(errorUtil2) {
|
|
466
466
|
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
467
|
-
errorUtil2.toString = (message) => typeof message === "string" ? message : message
|
|
467
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
468
468
|
})(errorUtil || (errorUtil = {}));
|
|
469
469
|
class ParseInputLazyPath {
|
|
470
470
|
constructor(parent, value, path, key) {
|
|
@@ -578,10 +578,10 @@ class ZodType {
|
|
|
578
578
|
const ctx = {
|
|
579
579
|
common: {
|
|
580
580
|
issues: [],
|
|
581
|
-
async:
|
|
582
|
-
contextualErrorMap: params
|
|
581
|
+
async: params?.async ?? false,
|
|
582
|
+
contextualErrorMap: params?.errorMap
|
|
583
583
|
},
|
|
584
|
-
path:
|
|
584
|
+
path: params?.path || [],
|
|
585
585
|
schemaErrorMap: this._def.errorMap,
|
|
586
586
|
parent: null,
|
|
587
587
|
data,
|
|
@@ -591,7 +591,6 @@ class ZodType {
|
|
|
591
591
|
return handleResult(ctx, result);
|
|
592
592
|
}
|
|
593
593
|
"~validate"(data) {
|
|
594
|
-
var _a, _b;
|
|
595
594
|
const ctx = {
|
|
596
595
|
common: {
|
|
597
596
|
issues: [],
|
|
@@ -612,7 +611,7 @@ class ZodType {
|
|
|
612
611
|
issues: ctx.common.issues
|
|
613
612
|
};
|
|
614
613
|
} catch (err) {
|
|
615
|
-
if (
|
|
614
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
616
615
|
this["~standard"].async = true;
|
|
617
616
|
}
|
|
618
617
|
ctx.common = {
|
|
@@ -637,10 +636,10 @@ class ZodType {
|
|
|
637
636
|
const ctx = {
|
|
638
637
|
common: {
|
|
639
638
|
issues: [],
|
|
640
|
-
contextualErrorMap: params
|
|
639
|
+
contextualErrorMap: params?.errorMap,
|
|
641
640
|
async: true
|
|
642
641
|
},
|
|
643
|
-
path:
|
|
642
|
+
path: params?.path || [],
|
|
644
643
|
schemaErrorMap: this._def.errorMap,
|
|
645
644
|
parent: null,
|
|
646
645
|
data,
|
|
@@ -871,7 +870,7 @@ function isValidJWT(jwt, alg) {
|
|
|
871
870
|
const decoded = JSON.parse(atob(base64));
|
|
872
871
|
if (typeof decoded !== "object" || decoded === null)
|
|
873
872
|
return false;
|
|
874
|
-
if ("typ" in decoded &&
|
|
873
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
875
874
|
return false;
|
|
876
875
|
if (!decoded.alg)
|
|
877
876
|
return false;
|
|
@@ -1260,10 +1259,10 @@ class ZodString extends ZodType {
|
|
|
1260
1259
|
}
|
|
1261
1260
|
return this._addCheck({
|
|
1262
1261
|
kind: "datetime",
|
|
1263
|
-
precision: typeof
|
|
1264
|
-
offset:
|
|
1265
|
-
local:
|
|
1266
|
-
...errorUtil.errToObj(options
|
|
1262
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
1263
|
+
offset: options?.offset ?? false,
|
|
1264
|
+
local: options?.local ?? false,
|
|
1265
|
+
...errorUtil.errToObj(options?.message)
|
|
1267
1266
|
});
|
|
1268
1267
|
}
|
|
1269
1268
|
date(message) {
|
|
@@ -1279,8 +1278,8 @@ class ZodString extends ZodType {
|
|
|
1279
1278
|
}
|
|
1280
1279
|
return this._addCheck({
|
|
1281
1280
|
kind: "time",
|
|
1282
|
-
precision: typeof
|
|
1283
|
-
...errorUtil.errToObj(options
|
|
1281
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
1282
|
+
...errorUtil.errToObj(options?.message)
|
|
1284
1283
|
});
|
|
1285
1284
|
}
|
|
1286
1285
|
duration(message) {
|
|
@@ -1297,8 +1296,8 @@ class ZodString extends ZodType {
|
|
|
1297
1296
|
return this._addCheck({
|
|
1298
1297
|
kind: "includes",
|
|
1299
1298
|
value,
|
|
1300
|
-
position: options
|
|
1301
|
-
...errorUtil.errToObj(options
|
|
1299
|
+
position: options?.position,
|
|
1300
|
+
...errorUtil.errToObj(options?.message)
|
|
1302
1301
|
});
|
|
1303
1302
|
}
|
|
1304
1303
|
startsWith(value, message) {
|
|
@@ -1433,7 +1432,7 @@ ZodString.create = (params) => {
|
|
|
1433
1432
|
return new ZodString({
|
|
1434
1433
|
checks: [],
|
|
1435
1434
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1436
|
-
coerce:
|
|
1435
|
+
coerce: params?.coerce ?? false,
|
|
1437
1436
|
...processCreateParams(params)
|
|
1438
1437
|
});
|
|
1439
1438
|
};
|
|
@@ -1673,7 +1672,7 @@ ZodNumber.create = (params) => {
|
|
|
1673
1672
|
return new ZodNumber({
|
|
1674
1673
|
checks: [],
|
|
1675
1674
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
1676
|
-
coerce:
|
|
1675
|
+
coerce: params?.coerce || false,
|
|
1677
1676
|
...processCreateParams(params)
|
|
1678
1677
|
});
|
|
1679
1678
|
};
|
|
@@ -1845,7 +1844,7 @@ ZodBigInt.create = (params) => {
|
|
|
1845
1844
|
return new ZodBigInt({
|
|
1846
1845
|
checks: [],
|
|
1847
1846
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1848
|
-
coerce:
|
|
1847
|
+
coerce: params?.coerce ?? false,
|
|
1849
1848
|
...processCreateParams(params)
|
|
1850
1849
|
});
|
|
1851
1850
|
};
|
|
@@ -1870,7 +1869,7 @@ class ZodBoolean extends ZodType {
|
|
|
1870
1869
|
ZodBoolean.create = (params) => {
|
|
1871
1870
|
return new ZodBoolean({
|
|
1872
1871
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
1873
|
-
coerce:
|
|
1872
|
+
coerce: params?.coerce || false,
|
|
1874
1873
|
...processCreateParams(params)
|
|
1875
1874
|
});
|
|
1876
1875
|
};
|
|
@@ -1978,7 +1977,7 @@ class ZodDate extends ZodType {
|
|
|
1978
1977
|
ZodDate.create = (params) => {
|
|
1979
1978
|
return new ZodDate({
|
|
1980
1979
|
checks: [],
|
|
1981
|
-
coerce:
|
|
1980
|
+
coerce: params?.coerce || false,
|
|
1982
1981
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
1983
1982
|
...processCreateParams(params)
|
|
1984
1983
|
});
|
|
@@ -2352,8 +2351,7 @@ class ZodObject extends ZodType {
|
|
|
2352
2351
|
unknownKeys: "strict",
|
|
2353
2352
|
...message !== void 0 ? {
|
|
2354
2353
|
errorMap: (issue, ctx) => {
|
|
2355
|
-
|
|
2356
|
-
const defaultError = ((_b = (_a = this._def).errorMap) == null ? void 0 : _b.call(_a, issue, ctx).message) ?? ctx.defaultError;
|
|
2354
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
2357
2355
|
if (issue.code === "unrecognized_keys")
|
|
2358
2356
|
return {
|
|
2359
2357
|
message: errorUtil.errToObj(message).message ?? defaultError
|
|
@@ -3904,14 +3902,14 @@ const ostring = () => stringType().optional();
|
|
|
3904
3902
|
const onumber = () => numberType().optional();
|
|
3905
3903
|
const oboolean = () => booleanType().optional();
|
|
3906
3904
|
const coerce = {
|
|
3907
|
-
string: (arg) => ZodString.create({ ...arg, coerce: true }),
|
|
3908
|
-
number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
|
|
3909
|
-
boolean: (arg) => ZodBoolean.create({
|
|
3905
|
+
string: ((arg) => ZodString.create({ ...arg, coerce: true })),
|
|
3906
|
+
number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
|
|
3907
|
+
boolean: ((arg) => ZodBoolean.create({
|
|
3910
3908
|
...arg,
|
|
3911
3909
|
coerce: true
|
|
3912
|
-
}),
|
|
3913
|
-
bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
|
|
3914
|
-
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
3910
|
+
})),
|
|
3911
|
+
bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
|
|
3912
|
+
date: ((arg) => ZodDate.create({ ...arg, coerce: true }))
|
|
3915
3913
|
};
|
|
3916
3914
|
const NEVER = INVALID;
|
|
3917
3915
|
const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|