lotus-wisdom-mcp 0.8.1 → 0.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -11
- package/dist/bundle.js +1 -1
- package/dist/journey.html +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Available at: https://lotus-wisdom-mcp.linxule.workers.dev/mcp
|
|
|
24
24
|
|
|
25
25
|
This MCP server was developed from the [Lotus OS prompt](https://github.com/linxule/prompts/blob/main/cognitive-techniques/lotus_os.md), which was designed to implement a cognitive framework based on the Lotus Sutra. The MCP server format makes this framework more accessible and easier to use with Claude and other AI assistants.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
The MCP server exposes the framework through tools and prompts. How well a model follows that framework depends on the model and host.
|
|
28
28
|
|
|
29
29
|
## Implementation Details
|
|
30
30
|
|
|
@@ -84,21 +84,24 @@ A tool for problem-solving using the Lotus Sutra's wisdom framework, with variou
|
|
|
84
84
|
**Inputs:**
|
|
85
85
|
|
|
86
86
|
* `tag` (string, required): The current processing technique (must be one of the tags listed above)
|
|
87
|
-
* `content` (string, required): The content of the current processing step
|
|
88
|
-
* `stepNumber` (integer,
|
|
89
|
-
* `totalSteps` (integer,
|
|
90
|
-
* `nextStepNeeded` (boolean,
|
|
87
|
+
* `content` (non-empty string, required): The content of the current processing step, including `begin`
|
|
88
|
+
* `stepNumber` (integer, optional, default `1`): Current number in sequence
|
|
89
|
+
* `totalSteps` (integer, optional, default `5`): Estimated total steps needed
|
|
90
|
+
* `nextStepNeeded` (boolean, optional, default `true`): Whether another step is needed
|
|
91
91
|
* `isMeditation` (boolean, optional): Whether this step is a meditative pause
|
|
92
92
|
* `meditationDuration` (integer, optional): Duration for meditation in seconds (1-10)
|
|
93
93
|
* `previousJourney` (string, optional): The `journey` string from a previous response, e.g. `"begin → open → examine"`. Lets the AI carry journey continuity forward in stateless clients (such as the remote Worker), where the server keeps no session state.
|
|
94
94
|
|
|
95
|
-
**Returns:**
|
|
95
|
+
**Returns:** a JSON text block and `structuredContent` validated against the tool's `outputSchema`. For `begin`, the full framework is in the text block; structured output contains its status, welcome, and contemplation fields. Other result variants retain their fields in both representations.
|
|
96
|
+
|
|
97
|
+
Response statuses include:
|
|
98
|
+
|
|
96
99
|
- Processing status with current step information, wisdom domain, and journey tracking
|
|
97
|
-
- `FRAMEWORK_RECEIVED` status
|
|
100
|
+
- `FRAMEWORK_RECEIVED` status on a `begin` step
|
|
98
101
|
- `MEDITATION_COMPLETE` status for meditation steps
|
|
99
102
|
- `WISDOM_READY` status when the contemplative process is complete
|
|
100
103
|
|
|
101
|
-
The tool
|
|
104
|
+
The tool declares `readOnlyHint`, `idempotentHint`, `destructiveHint: false`, and `openWorldHint: false`. These are host hints, not a guarantee of zero side effects: local stdio calls update the in-memory journey, and the hosted worker records usage analytics. The tools do not modify user files or external business data.
|
|
102
105
|
|
|
103
106
|
### lotuswisdom_summary
|
|
104
107
|
|
|
@@ -211,8 +214,6 @@ When the tool returns `status: 'WISDOM_READY'`, Claude then speaks the final wis
|
|
|
211
214
|
|
|
212
215
|
## Installation
|
|
213
216
|
|
|
214
|
-
[](https://smithery.ai/server/@linxule/lotus-wisdom-mcp)
|
|
215
|
-
|
|
216
217
|
Install via [Smithery](https://smithery.ai/server/@linxule/lotus-wisdom-mcp) for one-click setup, or follow the manual instructions below.
|
|
217
218
|
|
|
218
219
|
Requires [Node.js](https://nodejs.org/) 18+. The server runs locally via `npx`.
|
|
@@ -420,6 +421,16 @@ updates include their `bun.lock` files. CI verifies all three packages on pull
|
|
|
420
421
|
requests. Merging a PR updates source only: a version tag publishes to npm and
|
|
421
422
|
the MCP Registry, and the Cloudflare Worker requires a separate deployment.
|
|
422
423
|
|
|
424
|
+
If npm publishes successfully but MCP Registry registration fails, retry only
|
|
425
|
+
registration for the existing tag:
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
gh workflow run publish-mcp.yml --ref main -f registry_tag=v0.8.1
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
This revalidates the tagged source and waits for npm availability before
|
|
432
|
+
registration. It does not republish npm or move the release tag.
|
|
433
|
+
|
|
423
434
|
Enable debug mode:
|
|
424
435
|
|
|
425
436
|
```bash
|
|
@@ -485,7 +496,8 @@ Current version: 0.8.1
|
|
|
485
496
|
- Updated dependencies and GitHub Actions, regenerated Bun lockfiles, and added
|
|
486
497
|
app and worker validation to CI.
|
|
487
498
|
- Updated vulnerable transitive dependencies across all three packages and added
|
|
488
|
-
dependency audits to CI.
|
|
499
|
+
dependency audits to CI. All three Bun audits passed during release validation
|
|
500
|
+
on September 14, 2026.
|
|
489
501
|
- Migrated the visualization to ext-apps 2 with its MCP client v2 and Zod 4
|
|
490
502
|
dependencies. The server transports remain on MCP SDK v1; the worker uses
|
|
491
503
|
the agents SDK's explicit compatibility handler and retains stateless JSON
|
package/dist/bundle.js
CHANGED
|
@@ -36709,7 +36709,7 @@ function structuredContentFor(result) {
|
|
|
36709
36709
|
}
|
|
36710
36710
|
|
|
36711
36711
|
// src/shared/version.ts
|
|
36712
|
-
var VERSION = "0.8.
|
|
36712
|
+
var VERSION = "0.8.3";
|
|
36713
36713
|
|
|
36714
36714
|
// src/shared/tool-defs.ts
|
|
36715
36715
|
var SERVER_NAME = "lotus-wisdom";
|
package/dist/journey.html
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
|
|
60
60
|
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=ce,c=!nt.jitless,u=c&&le.value,d=t.catchall,f;e._zod.parse=(i,l)=>{f??=r.value;let p=i.value;return s(p)?c&&u&&l?.async===!1&&l.jitless!==!0?(o||=a(t.shape),i=o(i,l),d?Fr([],p,i,l,f,e,l?.abortEarly===!0):i):n(i,l):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Rr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!b(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>je(e,r,rt())))}),t)}var zr=S(`$ZodUnion`,(e,t)=>{w.init(e,t),x(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),x(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),x(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),x(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>d(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Rr(t,r,e,i)):Rr(o,r,e,i)}});function Br(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var Vr=S(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,zr.init(e,t);let n=e._zod.parse;x(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||h(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=ee(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=l(()=>Br(t));e._zod.parse=(i,a)=>{let o=i.value;if(!ce(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),Hr=S(`$ZodIntersection`,(e,t)=>{w.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Wr(e,t,n)):Wr(e,i,a)}});function Ur(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ue(e)&&ue(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Ur(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ur(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Wr(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Ur(t.value,n.value);if(!c.valid){if(b(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Gr=S(`$ZodRecord`,(e,t)=>{w.init(e,t);let n=nt.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ue(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>je(e,i,rt())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Oe(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Oe(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&C.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>je(e,i,rt())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Oe(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Oe(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),Kr=S(`$ZodEnum`,(e,t)=>{w.init(e,t);let n=a(t.entries),r=new Set(n);e._zod.values=r,x(e,`pattern`,e=>{let t=a(e.def.entries).filter(e=>fe.has(typeof e));return RegExp(t.length?`^(${t.map(e=>pe(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),qr=S(`$ZodLiteral`,(e,t)=>{w.init(e,t);let n=new Set(t.values);e._zod.values=n,x(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?pe(e):e?pe(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Jr=S(`$ZodTransform`,(e,t)=>{w.init(e,t),e._zod.optin=`optional`,nt.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new et;return n.value=i,n}});function Yr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Xr=S(`$ZodOptional`,(e,t)=>{w.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,x(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),x(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${d(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>Yr(e,t)):Yr(e,r)}return t.innerType._zod.run(e,n)}}),Zr=S(`$ZodExactOptional`,(e,t)=>{Xr.init(e,t),x(e,`values`,e=>e.def.innerType._zod.values),x(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Qr=S(`$ZodNullable`,(e,t)=>{w.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin),x(e,`optout`,e=>e.def.innerType._zod.optout),x(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${d(t.source)}|null)$`):void 0}),x(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),$r=S(`$ZodDefault`,(e,t)=>{w.init(e,t),e._zod.optin=`defaulted`,x(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>ei(e,t)):ei(r,t)}});function ei(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ti=S(`$ZodPrefault`,(e,t)=>{w.init(e,t),e._zod.optin=`defaulted`,x(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ni=S(`$ZodNonOptional`,(e,t)=>{w.init(e,t),x(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ri(t,e)):ri(i,e)}});function ri(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function ii(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>je(e,r,rt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ai=S(`$ZodCatch`,(e,t)=>{w.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),x(e,`optout`,e=>e.def.innerType._zod.optout),x(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>ii(e,r,t,n)):ii(e,r,t,n)}}),oi=S(`$ZodPipe`,(e,t)=>{w.init(e,t),x(e,`values`,e=>e.def.in._zod.values),x(e,`optin`,e=>e.def.in._zod.optin),x(e,`optout`,e=>e.def.out._zod.optout),x(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>si(e,t.in,n)):si(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>si(e,t.out,n)):si(r,t.out,n)}});function si(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ci=S(`$ZodPreprocess`,(e,t)=>{oi.init(e,t)}),li=S(`$ZodReadonly`,(e,t)=>{w.init(e,t),x(e,`propValues`,e=>e.def.innerType._zod.propValues),x(e,`values`,e=>e.def.innerType._zod.values),x(e,`optin`,e=>e.def.innerType?._zod?.optin),x(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ui):ui(r)}});function ui(e){return e.memo||(e.value=Object.freeze(e.value)),e}var di=S(`$ZodLazy`,(e,t)=>{w.init(e,t),m(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),x(e,`pattern`,e=>e.innerType?._zod?.pattern),x(e,`propValues`,e=>e.innerType?._zod?.propValues),x(e,`optin`,e=>e.innerType?._zod?.optin??void 0),x(e,`optout`,e=>e.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),fi=S(`$ZodCustom`,(e,t)=>{mn.init(e,t),w.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>pi(t,n,r,e));pi(i,n,r,e)}});function pi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Ie(e))}}var mi=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},hi=`~memo`,gi=[];function _i(e){return typeof e==`object`&&!!e}function vi(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var yi=new WeakMap,bi=0,xi=1,Si=2;function Ci(e,t,n){let r=yi.get(e);if(r!==void 0)return r?Si:bi;if(t.has(e))return Si;t.add(e);let i=bi,a=e=>{if(i!==Si&&e?._zod){let r=Ci(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=bi;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?xi:o.value?._zod?Ci(o.value,t,n):bi;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ee(c);s(e?o(e,!0):xi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ci(r,t,!1):xi);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),wi(e,i)}function wi(e,t){return t!==xi&&yi.set(e,t===Si),t}function Ti(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ei,Di=[],Oi={alloc(e,t,n){let r=Ei;if(!r)return n;Ei=void 0;let i={value:n,issues:null};return r.set(t.value,i),Di.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Ai(n,e.value))throw new mi;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ci(e,new Set,!1);if(i===bi)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Si||r?n=!0:r=!0}let l=s.value;if(!_i(l))return t(s,c);let u=c[hi];u||(u={buckets:new WeakMap,backEdges:void 0},c[hi]=u);let d;i===c?d=a:(d=Ti(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...vi(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ei=d;let p=Di.length,m=t(s,c);Ei=void 0;let h=Di.length>p?Di.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?vi(e.issues):gi),e)):(h&&(h.issues=m.issues.length?vi(m.issues):gi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function ki(){return Oi}function Ai(e,t){let n=e[hi]?.backEdges;return n!==void 0&&_i(t)&&n.has(t)}var ji=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Fe(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${me(e.values[0])}`:`Invalid option: expected one of ${o(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${o(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Mi(){return{localeError:ji()}}var Ni,Pi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Fi(){return new Pi}(Ni=globalThis).__zod_globalRegistry??(Ni.__zod_globalRegistry=Fi());var Ii=globalThis.__zod_globalRegistry;function Li(e){return e.checks&&=[...e.checks],e}function Ri(e,t){return new e(Li({type:`string`,...y(t)}))}function zi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...y(t)})}function Bi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...y(t)})}function Vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...y(t)})}function Hi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...y(t)})}function Ui(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...y(t)})}function Wi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...y(t)})}function Gi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...y(t)})}function Ki(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...y(t)})}function qi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...y(t)})}function Ji(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...y(t)})}function Yi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...y(t)})}function Xi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...y(t)})}function Zi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...y(t)})}function Qi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...y(t)})}function $i(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...y(t)})}function ea(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...y(t)})}function ta(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...y(t)})}function na(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...y(t)})}function ra(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...y(t)})}function ia(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...y(t)})}function aa(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...y(t)})}function oa(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...y(t)})}function sa(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...y(t)})}function ca(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...y(t)})}function la(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...y(t)})}function ua(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...y(t)})}function da(e,t){return new e(Li({type:`number`,checks:[],...y(t)}))}function fa(e,t){return new e(Li({type:`number`,coerce:!0,checks:[],...y(t)}))}function pa(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...y(t)})}function ma(e,t){return new e({type:`boolean`,...y(t)})}function ha(e,t){return new e({type:`undefined`,...y(t)})}function ga(e,t){return new e({type:`null`,...y(t)})}function _a(e){return new e({type:`any`})}function va(e){return new e({type:`unknown`})}function ya(e,t){return new e({type:`never`,...y(t)})}function ba(e,t){return new _n({check:`less_than`,...y(t),value:e,inclusive:!1})}function xa(e,t){return new _n({check:`less_than`,...y(t),value:e,inclusive:!0})}function Sa(e,t){return new vn({check:`greater_than`,...y(t),value:e,inclusive:!1})}function Ca(e,t){return new vn({check:`greater_than`,...y(t),value:e,inclusive:!0})}function wa(e,t){return new yn({check:`multiple_of`,...y(t),value:e})}function Ta(e,t){return new xn({check:`max_length`,...y(t),maximum:e})}function Ea(e,t){return new Sn({check:`min_length`,...y(t),minimum:e})}function Da(e,t){return new Cn({check:`length_equals`,...y(t),length:e})}function Oa(e,t){return new Tn({check:`string_format`,format:`regex`,...y(t),pattern:e})}function ka(e){return new En({check:`string_format`,format:`lowercase`,...y(e)})}function Aa(e){return new Dn({check:`string_format`,format:`uppercase`,...y(e)})}function ja(e,t){return new On({check:`string_format`,format:`includes`,...y(t),includes:e})}function Ma(e,t){return new kn({check:`string_format`,format:`starts_with`,...y(t),prefix:e})}function Na(e,t){return new An({check:`string_format`,format:`ends_with`,...y(t),suffix:e})}function Pa(e){return new jn({check:`overwrite`,tx:e})}function Fa(e){return Pa(t=>t.normalize(e))}function Ia(){return Pa(e=>e.trim())}function La(){return Pa(e=>e.toLowerCase())}function Ra(){return Pa(e=>e.toUpperCase())}function za(){return Pa(e=>oe(e))}function Ba(e,t,n){return new e({type:`array`,element:t,...y(n)})}function Va(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...y(n)})}function Ha(e,t){let n=Ua(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Ie(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Ie(r))}},e(t.value,t)),t);return n}function Ua(e,t){let n=new mn({check:`custom`,...y(t)});return n._zod.check=e,n}function Wa(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&h(e,t,n[t]);return e}function Ga(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ii,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function E(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function D(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,D(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Wa(o.schema,c),t.io===`input`&&to(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Ka(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function qa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Ka(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Ka(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
61
61
|
|
|
62
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ja(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ja(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ya=new Set([`type`,`properties`,`required`,`additionalProperties`]),Xa=[`oneOf`,`anyOf`];function Za(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Qa(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ya.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Za(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}h(n,r,e.length===1?e[0]:Qa(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Za(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function $a(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ya)if(t in e)return;let n=t.filter(e=>Xa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Qa(t);else{let e=n[0],i=Xa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Qa([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Wa(e,r))}function eo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Wa(i,s),Wa(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ja(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])$a(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Wa(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,h(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ro(t,`input`,e.processors),output:ro(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function to(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return to(r.element,n);if(r.type===`set`)return to(r.valueType,n);if(r.type===`lazy`)return to(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return to(r.innerType,n);if(r.type===`intersection`)return to(r.left,n)||to(r.right,n);if(r.type===`record`||r.type===`map`)return to(r.keyType,n)||to(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:to(r.in,n)||to(r.out,n);if(r.type===`object`){for(let e in r.shape)if(to(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(to(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(to(e,n))return!0;return!!(r.rest&&to(r.rest,n))}return!1}var no=(e,t={})=>n=>{let r=Ga({...n,processors:t});return D(e,r),qa(r,e),eo(r,e)},ro=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ga({...i??{},target:a,io:t,processors:n});return D(e,o),qa(o,e),eo(o,e)},io=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},ao=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},oo=(e,t)=>{io(e,`minimum`,t),ao(e,`maximum`,t)},so=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},co=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},lo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},uo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},fo=(e,t)=>io(e,`minimum`,t.minimum),po=(e,t)=>ao(e,`maximum`,t.maximum),mo=e=>(t,n)=>{uo(t,n.format);let[r,i]=e[n.format];io(t,`minimum`,r),ao(t,`maximum`,i)},ho={greater_than:(e,t)=>io(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>ao(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>so(e,t.value),number_format:mo(ge),bigint_format:mo(_e),min_length:fo,max_length:po,length_equals:(e,t)=>oo(e,t.length),min_size:fo,max_size:po,size_equals:(e,t)=>oo(e,t.size),string_format:(e,t)=>{uo(e,t.format),t.pattern&&co(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>lo(e,t.mime)};function go(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)ho[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&io(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&io(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&ao(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&ao(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&so(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&lo(t,i.mime);for(let e of i.patterns??[])co(t,e);return t}var _o={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},vo=new Map([[mr,Xt],[gr,Zt]]),yo=e=>vo.get(e)??e,bo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=go(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=_o[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(yo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},xo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=go(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):E(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},So=(e,t,n,r)=>{n.type=`boolean`},Co=(e,t,n,r)=>{E(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{E(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Eo=(e,t,n,r)=>{E(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Do=(e,t,n,r)=>{E(e,t,n,r,`Void cannot be represented in JSON Schema`)},Oo=(e,t,n,r)=>{n.not={}},ko=(e,t,n,r)=>{},Ao=(e,t,n,r)=>{},jo=(e,t,n,r)=>{E(e,t,n,r,`Date cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{let i=e._zod.def,o=a(i.entries);if(o.length===0){n.not={};return}o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o},No=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(E(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(E(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Po=(e,t,n,r)=>{E(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Fo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Io=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=go(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},Lo=(e,t,n,r)=>{n.type=`boolean`},Ro=(e,t,n,r)=>{E(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},zo=(e,t,n,r)=>{E(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Bo=(e,t,n,r)=>{E(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Vo=(e,t,n,r)=>{E(e,t,n,r,`Map cannot be represented in JSON Schema`)},Ho=(e,t,n,r)=>{E(e,t,n,r,`Set cannot be represented in JSON Schema`)},Uo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=go(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=D(a.element,t,{...r,path:[...r.path,`items`]})};function Wo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Wo(t.out):t.type===`catch`?Wo(t.innerType):e._zod.optin}var Go=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&E(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)h(i.properties,e,D(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Wo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ko=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},qo=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Jo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>D(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?D(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Wo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=go(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Yo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Yo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Yo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?C:cn).source),p):p}var Xo=new WeakMap;function Zo(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Xo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Yo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Qo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=go(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=D(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)h(i.patternProperties,yo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=D(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Xo.get(t);n||(n=[],Xo.set(t,n),t.deferred.push(()=>Zo(t))),n.push(e)}i.additionalProperties=D(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Wo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},$o=(e,t,n,r)=>{let i=e._zod.def,a=D(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},es=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ts=Symbol();function ns(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(E(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ts):JSON.parse(o)}var rs=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=ns(i.defaultValue,e,t,n,r);o!==ts&&(n.default=o)},is=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=ns(i.defaultValue,e,t,n,r);o!==ts&&(n._prefault=o)},as=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{E(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},os=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;D(o,t,r);let s=t.seen.get(e);s.ref=o},ss=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},cs=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ls=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},us=(e,t,n,r)=>{let i=e._zod.innerType;D(i,t,r);let a=t.seen.get(e);a.ref=i},ds={string:bo,number:xo,boolean:So,bigint:Co,symbol:wo,null:To,undefined:Eo,void:Do,never:Oo,any:ko,unknown:Ao,date:jo,enum:Mo,literal:No,nan:Po,template_literal:Fo,file:Io,success:Lo,custom:Ro,function:zo,transform:Bo,map:Vo,set:Ho,array:Uo,object:Go,union:Ko,intersection:qo,tuple:Jo,record:Qo,nullable:$o,nonoptional:es,default:rs,prefault:is,catch:as,pipe:os,readonly:ss,promise:cs,optional:ls,lazy:us};function fs(e,t){if(`_idmap`in e){let n=e,r=Ga({...t,processors:ds}),i={};for(let e of n._idmap.entries()){let[t,n]=e;D(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;qa(r,n),h(a,t,eo(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ga({...t,processors:ds});return D(e,n),qa(n,e),eo(n,e)}var ps=new WeakSet([Object.prototype,Error.prototype]);function ms(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var hs=S(`ZodError`,(e,t)=>{ut.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ps.has(n)||(ps.add(n),ms(n,`format`,e=>t=>pt(e,t)),ms(n,`flatten`,e=>t=>ft(e,t)),ms(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,s,2)}),ms(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,s,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),gs=ht(hs),_s=gt(hs),vs=_t(hs),ys=yt(hs),bs=Tt(hs),xs=Et(hs),Ss=Dt(hs),Cs=Ot(hs),ws=kt(hs),Ts=At(hs),Es=jt(hs),Ds=Mt(hs);function Os(){nt.localeError||rt(Mi())}function ks(){nt.memoizer||rt({memoizer:ki()})}var O=S(`ZodType`,(e,t)=>(Os(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(_(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return v(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Yc(e,t))},superRefine(e,t){return this.check(Xc(e,t))},overwrite(e){return this.check(Pa(e))},optional(){return V(this)},exactOptional(){return Ac(this)},nullable(){return Mc(this)},nullish(){return V(Mc(this))},nonoptional(e){return Rc(this,e)},array(){return P(this)},or(e){return L([this,e])},and(e){return Sc(this,e)},transform(e){return Hc(this,Dc(e))},default(e){return Pc(this,e)},prefault(e){return Ic(this,e)},catch(e){return Bc(this,e)},pipe(e){return Hc(this,e)},readonly(){return Gc(this)},describe(e){let t=this.clone();return Ii.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ii.get(this);let t=this.clone();return Ii.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ze(this,`~standard`,{...In(this),jsonSchema:{input:ro(this,`input`),output:ro(this,`output`)}})},set"~standard"(e){Re(this,`~standard`,e)},parse:function e(t,n){return gs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await _s(this,t,n,{callee:e})},safeParse(e,t){return vs(this,e,t)},async safeParseAsync(e,t){return ys(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Re(this,`spa`,e)},validate(e,t){return St(this,e,t)},validateAsync(e,t){return wt(this,e,t)},encode:function e(t,n){return bs(this,t,n,{callee:e})},decode:function e(t,n){return xs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Ss(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Cs(this,t,n,{callee:e})},safeEncode(e,t){return ws(this,e,t)},safeDecode(e,t){return Ts(this,e,t)},async safeEncodeAsync(e,t){return Es(this,e,t)},async safeDecodeAsync(e,t){return Ds(this,e,t)},toJSONSchema(e){return no(this,{})(e)},get description(){return Ii.get(this)?.description},get _def(){return this._zod.def}}),As=S(`_ZodString`,(e,t)=>{Ln.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)},Be({format:e=>go(e).format??null,minLength:e=>go(e).minimum??null,maxLength:e=>go(e).maximum??null},{regex(...e){return this.check(Oa(...e))},includes(...e){return this.check(ja(...e))},startsWith(...e){return this.check(Ma(...e))},endsWith(...e){return this.check(Na(...e))},min(...e){return this.check(Ea(...e))},max(...e){return this.check(Ta(...e))},length(...e){return this.check(Da(...e))},nonempty(...e){return this.check(Ea(1,...e))},lowercase(e){return this.check(ka(e))},uppercase(e){return this.check(Aa(e))},trim(){return this.check(Ia())},normalize(...e){return this.check(Fa(...e))},toLowerCase(){return this.check(La())},toUpperCase(){return this.check(Ra())},slugify(){return this.check(za())}})),js=S(`ZodString`,(e,t)=>{Ln.init(e,t),As.init(e,t)},{email(e){return this.check(zi(Is,e))},url(e){return this.check(Gi(Bs,e))},jwt(e){return this.check(oa(nc,e))},emoji(e){return this.check(Ki(Hs,e))},guid(e){return this.check(Bi(Rs,e))},uuid(e){return this.check(Vi(zs,e))},uuidv4(e){return this.check(Hi(zs,e))},uuidv6(e){return this.check(Ui(zs,e))},uuidv7(e){return this.check(Wi(zs,e))},nanoid(e){return this.check(qi(Us,e))},cuid(e){return this.check(Ji(Ws,e))},cuid2(e){return this.check(Yi(Gs,e))},ulid(e){return this.check(Xi(Ks,e))},base64(e){return this.check(ra($s,e))},base64url(e){return this.check(ia(ec,e))},xid(e){return this.check(Zi(qs,e))},ksuid(e){return this.check(Qi(Js,e))},ipv4(e){return this.check($i(Ys,e))},ipv6(e){return this.check(ea(Xs,e))},cidrv4(e){return this.check(ta(Zs,e))},cidrv6(e){return this.check(na(Qs,e))},e164(e){return this.check(aa(tc,e))},datetime(e){return this.check(sa(Ms,e))},date(e){return this.check(ca(Ns,e))},time(e){return this.check(la(Ps,e))},duration(e){return this.check(ua(Fs,e))}});function k(e){return Ri(js,e)}var A=S(`ZodStringFormat`,(e,t)=>{T.init(e,t),As.init(e,t)}),Ms=S(`ZodISODateTime`,(e,t)=>{nr.init(e,t),A.init(e,t)}),Ns=S(`ZodISODate`,(e,t)=>{rr.init(e,t),A.init(e,t)}),Ps=S(`ZodISOTime`,(e,t)=>{ir.init(e,t),A.init(e,t)}),Fs=S(`ZodISODuration`,(e,t)=>{ar.init(e,t),A.init(e,t)}),Is=S(`ZodEmail`,(e,t)=>{Bn.init(e,t),A.init(e,t)});function Ls(e){return zi(Is,e)}var Rs=S(`ZodGUID`,(e,t)=>{Rn.init(e,t),A.init(e,t)}),zs=S(`ZodUUID`,(e,t)=>{zn.init(e,t),A.init(e,t)}),Bs=S(`ZodURL`,(e,t)=>{Jn.init(e,t),A.init(e,t)});function Vs(e){return Gi(Bs,e)}var Hs=S(`ZodEmoji`,(e,t)=>{Yn.init(e,t),A.init(e,t)}),Us=S(`ZodNanoID`,(e,t)=>{Xn.init(e,t),A.init(e,t)}),Ws=S(`ZodCUID`,(e,t)=>{Zn.init(e,t),A.init(e,t)}),Gs=S(`ZodCUID2`,(e,t)=>{Qn.init(e,t),A.init(e,t)}),Ks=S(`ZodULID`,(e,t)=>{$n.init(e,t),A.init(e,t)}),qs=S(`ZodXID`,(e,t)=>{er.init(e,t),A.init(e,t)}),Js=S(`ZodKSUID`,(e,t)=>{tr.init(e,t),A.init(e,t)}),Ys=S(`ZodIPv4`,(e,t)=>{or.init(e,t),A.init(e,t)}),Xs=S(`ZodIPv6`,(e,t)=>{lr.init(e,t),A.init(e,t)}),Zs=S(`ZodCIDRv4`,(e,t)=>{ur.init(e,t),A.init(e,t)}),Qs=S(`ZodCIDRv6`,(e,t)=>{fr.init(e,t),A.init(e,t)}),$s=S(`ZodBase64`,(e,t)=>{hr.init(e,t),A.init(e,t)}),ec=S(`ZodBase64URL`,(e,t)=>{vr.init(e,t),A.init(e,t)}),tc=S(`ZodE164`,(e,t)=>{yr.init(e,t),A.init(e,t)}),nc=S(`ZodJWT`,(e,t)=>{xr.init(e,t),A.init(e,t)}),rc=S(`ZodNumber`,(e,t)=>{Sr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),e.isFinite=!0},Be({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=go(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=go(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=go(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>go(e).format??null},{gt(e,t){return this.check(Sa(e,t))},gte(e,t){return this.check(Ca(e,t))},min(e,t){return this.check(Ca(e,t))},lt(e,t){return this.check(ba(e,t))},lte(e,t){return this.check(xa(e,t))},max(e,t){return this.check(xa(e,t))},int(e){return this.check(ac(e))},safe(e){return this.check(ac(e))},positive(e){return this.check(Sa(0,e))},nonnegative(e){return this.check(Ca(0,e))},negative(e){return this.check(ba(0,e))},nonpositive(e){return this.check(xa(0,e))},multipleOf(e,t){return this.check(wa(e,t))},step(e,t){return this.check(wa(e,t))},finite(){return this}}));function j(e){return da(rc,e)}var ic=S(`ZodNumberFormat`,(e,t)=>{Cr.init(e,t),rc.init(e,t)});function ac(e){return pa(ic,e)}var oc=S(`ZodBoolean`,(e,t)=>{wr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)});function M(e){return ma(oc,e)}var sc=S(`ZodUndefined`,(e,t)=>{Tr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function cc(e){return ha(sc,e)}var lc=S(`ZodNull`,(e,t)=>{Er.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function uc(e){return ga(lc,e)}var dc=S(`ZodAny`,(e,t)=>{Dr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function fc(){return _a(dc)}var pc=S(`ZodUnknown`,(e,t)=>{Or.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function N(){return va(pc)}var mc=S(`ZodNever`,(e,t)=>{kr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r)});function hc(e){return ya(mc,e)}var gc=S(`ZodArray`,(e,t)=>{ks(),jr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ea(e,t))},nonempty(e){return this.check(Ea(1,e))},max(e,t){return this.check(Ta(e,t))},length(e,t){return this.check(Da(e,t))},unwrap(){return this.element}});function P(e,t){return Ba(gc,e,t)}var _c=S(`ZodObject`,(e,t)=>{ks(),Lr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),Ke(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(_(this._zod.def,{catchall:e}))},passthrough(){return this.clone(_(this._zod.def,{catchall:N()}))},loose(){return this.clone(_(this._zod.def,{catchall:N()}))},strict(){return this.clone(_(this._zod.def,{catchall:hc()}))},strip(){return this.clone(_(this._zod.def,{catchall:void 0}))},extend(e){return xe(this,e)},safeExtend(e){return Ce(this,e)},merge(e){return we(this,e)},pick(e){return ve(this,e)},omit(e){return be(this,e)},partial(...e){return Te(Oc,this,e[0])},exactPartial(...e){return Te(kc,this,e[0],`exactPartial`)},required(...e){return Ee(Lc,this,e[0])}});function F(e,t){return new _c({type:`object`,shape:e??{},...y(t)})}function I(e,t){return new _c({type:`object`,shape:e,catchall:N(),...y(t)})}var vc=S(`ZodUnion`,(e,t)=>{zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.options=t.options});function L(e,t){return new vc({type:`union`,options:e,...y(t)})}var yc=S(`ZodDiscriminatedUnion`,(e,t)=>{vc.init(e,t),Vr.init(e,t)});function bc(e,t,n){return new yc({type:`union`,options:t,discriminator:e,...y(n)})}var xc=S(`ZodIntersection`,(e,t)=>{Hr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r)});function Sc(e,t){return new xc({type:`intersection`,left:e,right:t})}var Cc=S(`ZodRecord`,(e,t)=>{ks(),Gr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function R(e,t,n){return!t||!t._zod?new Cc({type:`record`,keyType:k(),valueType:e,...y(t)}):new Cc({type:`record`,keyType:e,valueType:t,...y(n)})}var wc=S(`ZodEnum`,(e,t)=>{Kr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new wc({...t,checks:[],...y(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new wc({...t,checks:[],...y(r),entries:i})}});function z(e,t){return new wc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...y(t)})}var Tc=S(`ZodLiteral`,(e,t)=>{qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function B(e,t){return new Tc({type:`literal`,values:Array.isArray(e)?e:[e],...y(t)})}var Ec=S(`ZodTransform`,(e,t)=>{ks(),Jr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ie(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ie(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Dc(e){return new Ec({type:`transform`,transform:e})}var Oc=S(`ZodOptional`,(e,t)=>{Xr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function V(e){return new Oc({type:`optional`,innerType:e})}var kc=S(`ZodExactOptional`,(e,t)=>{Zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ac(e){return new kc({type:`optional`,innerType:e})}var jc=S(`ZodNullable`,(e,t)=>{Qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mc(e){return new jc({type:`nullable`,innerType:e})}var Nc=S(`ZodDefault`,(e,t)=>{$r.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pc(e,t){return new Nc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var Fc=S(`ZodPrefault`,(e,t)=>{ti.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ic(e,t){return new Fc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var Lc=S(`ZodNonOptional`,(e,t)=>{ni.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rc(e,t){return new Lc({type:`nonoptional`,innerType:e,...y(t)})}var zc=S(`ZodCatch`,(e,t)=>{ai.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>as(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bc(e,t){return new zc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Je(t)})}var Vc=S(`ZodPipe`,(e,t)=>{oi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r),e.in=t.in,e.out=t.out});function Hc(e,t){return new Vc({type:`pipe`,in:e,out:t})}var Uc=S(`ZodPreprocess`,(e,t)=>{Vc.init(e,t),ci.init(e,t)}),Wc=S(`ZodReadonly`,(e,t)=>{li.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gc(e){return new Wc({type:`readonly`,innerType:e})}var Kc=S(`ZodLazy`,(e,t)=>{di.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function qc(e){return new Kc({type:`lazy`,getter:e})}var Jc=S(`ZodCustom`,(e,t)=>{fi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r)});function Yc(e,t={}){return Va(Jc,e,t)}function Xc(e,t){return Ha(e,t)}function Zc(e,t){return new Uc({type:`pipe`,in:Dc(e),out:t})}var Qc={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},$c;$c||={};function el(e){return sa(Ms,e)}function tl(e){return ca(Ns,e)}function nl(e){return fa(rc,e)}var rl=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],il=`io.modelcontextprotocol/related-task`,al=`io.modelcontextprotocol/protocolVersion`,ol=`io.modelcontextprotocol/clientInfo`,sl=`io.modelcontextprotocol/serverInfo`,cl=`io.modelcontextprotocol/clientCapabilities`,ll=`io.modelcontextprotocol/subscriptionId`,ul=`io.modelcontextprotocol/logLevel`,dl=qc(()=>L([k(),j(),M(),uc(),R(k(),dl),P(dl)])),H=R(k(),dl),fl=P(dl),pl=L([k(),j().int()]),ml=k(),hl=F({ttl:j().optional()}),gl=F({taskId:k()}),_l=I({progressToken:pl.optional(),[il]:gl.optional()}),U=F({_meta:_l.optional()}),vl=U.extend({task:hl.optional()}),W=F({method:k(),params:U.loose().optional()}),yl=F({_meta:_l.optional()}),bl=F({method:k(),params:yl.loose().optional()}),xl=I({get[sl](){return Fl.optional().catch(void 0)}}),G=I({_meta:xl.optional()}),Sl=L([k(),j().int()]),Cl=F({jsonrpc:B(`2.0`),id:Sl,...W.shape}).strict(),wl=F({jsonrpc:B(`2.0`),...bl.shape}).strict(),Tl=F({jsonrpc:B(`2.0`),id:Sl,result:G}).strict(),El=F({jsonrpc:B(`2.0`),id:Sl.optional(),error:F({code:j().int(),message:k(),data:N().optional()})}).strict(),Dl=L([Cl,wl,Tl,El]),Ol=L([Tl,El]),kl=G.strict(),Al=yl.extend({requestId:Sl.optional(),reason:k().optional()}),jl=bl.extend({method:B(`notifications/cancelled`),params:Al}),Ml=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),Nl=F({icons:P(Ml).optional()}),Pl=F({name:k(),title:k().optional()}),Fl=Pl.extend({...Pl.shape,...Nl.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),Il=Zc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Sc(F({form:Sc(F({applyDefaults:M().optional()}),H).optional(),url:H.optional()}),H.optional())),Ll=I({list:H.optional(),cancel:H.optional(),requests:I({sampling:I({createMessage:H.optional()}).optional(),elicitation:I({create:H.optional()}).optional()}).optional()}),Rl=I({list:H.optional(),cancel:H.optional(),requests:I({tools:I({call:H.optional()}).optional()}).optional()}),zl=F({experimental:R(k(),H).optional(),sampling:F({context:H.optional(),tools:H.optional()}).optional(),elicitation:Il.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:Ll.optional(),extensions:R(k(),H).optional()}),Bl=U.extend({protocolVersion:k(),capabilities:zl,clientInfo:Fl}),Vl=W.extend({method:B(`initialize`),params:Bl}),Hl=F({experimental:R(k(),H).optional(),logging:H.optional(),completions:H.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:Rl.optional(),extensions:R(k(),H).optional()}),Ul=G.extend({protocolVersion:k(),capabilities:Hl,serverInfo:Fl,instructions:k().optional()}),Wl=bl.extend({method:B(`notifications/initialized`),params:yl.optional()}),Gl=W.extend({method:B(`server/discover`),params:U.optional()}),Kl=G.extend({supportedVersions:P(k()),capabilities:Hl,instructions:k().optional()}),ql=W.extend({method:B(`ping`),params:U.optional()}),Jl=F({progress:j(),total:V(j()),message:V(k())}),Yl=F({...yl.shape,...Jl.shape,progressToken:pl}),Xl=bl.extend({method:B(`notifications/progress`),params:Yl}),Zl=U.extend({cursor:ml.optional()}),Ql=W.extend({params:Zl.optional()}),$l=G.extend({nextCursor:ml.optional()}),eu=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),tu=eu.extend({text:k()}),nu=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ru=eu.extend({blob:nu}),iu=z([`user`,`assistant`]),au=F({audience:P(iu).optional(),priority:j().min(0).max(1).optional(),lastModified:el({offset:!0}).optional()}),ou=F({...Pl.shape,...Nl.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:au.optional(),_meta:V(I({}))}),su=F({...Pl.shape,...Nl.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:au.optional(),_meta:V(I({}))}),cu=Ql.extend({method:B(`resources/list`)}),lu=$l.extend({resources:P(ou)}),uu=Ql.extend({method:B(`resources/templates/list`)}),du=$l.extend({resourceTemplates:P(su)}),fu=U.extend({uri:k()}),pu=fu,mu=W.extend({method:B(`resources/read`),params:pu}),hu=G.extend({contents:P(L([tu,ru]))}),gu=bl.extend({method:B(`notifications/resources/list_changed`),params:yl.optional()}),_u=fu,vu=W.extend({method:B(`resources/subscribe`),params:_u}),yu=fu,bu=W.extend({method:B(`resources/unsubscribe`),params:yu}),xu=F({toolsListChanged:M().optional(),promptsListChanged:M().optional(),resourcesListChanged:M().optional(),resourceSubscriptions:P(k()).optional()}),Su=U.extend({notifications:xu}),Cu=W.extend({method:B(`subscriptions/listen`),params:Su}),wu=yl.extend({notifications:xu}),Tu=bl.extend({method:B(`notifications/subscriptions/acknowledged`),params:wu}),Eu=xl.extend({[ll]:Sl}),Du=G.extend({_meta:Eu}),Ou=yl.extend({uri:k()}),ku=bl.extend({method:B(`notifications/resources/updated`),params:Ou}),Au=F({name:k(),description:V(k()),required:V(M())}),ju=F({...Pl.shape,...Nl.shape,description:V(k()),arguments:V(P(Au)),_meta:V(I({}))}),Mu=Ql.extend({method:B(`prompts/list`)}),Nu=$l.extend({prompts:P(ju)}),Pu=U.extend({name:k(),arguments:R(k(),k()).optional()}),Fu=W.extend({method:B(`prompts/get`),params:Pu}),Iu=F({type:B(`text`),text:k(),annotations:au.optional(),_meta:R(k(),N()).optional()}),Lu=F({type:B(`image`),data:nu,mimeType:k(),annotations:au.optional(),_meta:R(k(),N()).optional()}),Ru=F({type:B(`audio`),data:nu,mimeType:k(),annotations:au.optional(),_meta:R(k(),N()).optional()}),zu=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Bu=F({type:B(`resource`),resource:L([tu,ru]),annotations:au.optional(),_meta:R(k(),N()).optional()}),Vu=ou.extend({type:B(`resource_link`)}),Hu=L([Iu,Lu,Ru,Vu,Bu]),Uu=F({role:iu,content:Hu}),Wu=G.extend({description:k().optional(),messages:P(Uu)}),Gu=bl.extend({method:B(`notifications/prompts/list_changed`),params:yl.optional()}),Ku=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),qu=F({taskSupport:z([`required`,`optional`,`forbidden`]).optional()}),Ju=F({...Pl.shape,...Nl.shape,description:k().optional(),inputSchema:F({type:B(`object`),properties:R(k(),dl).optional(),required:P(k()).optional()}).catchall(N()),outputSchema:I({$schema:k().optional()}).optional(),annotations:Ku.optional(),execution:qu.optional(),_meta:R(k(),N()).optional()}),Yu=Ql.extend({method:B(`tools/list`)}),Xu=$l.extend({tools:P(Ju)}),Zu=G.extend({content:P(Hu).default([]),structuredContent:N().optional(),isError:M().optional()}),Qu=Zu.or(G.extend({toolResult:N()})),$u=vl.extend({name:k(),arguments:R(k(),N()).optional()}),ed=W.extend({method:B(`tools/call`),params:$u}),td=bl.extend({method:B(`notifications/tools/list_changed`),params:yl.optional()}),nd=F({autoRefresh:M().default(!0),debounceMs:j().int().nonnegative().default(300)}),rd=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),id=U.extend({level:rd}),ad=W.extend({method:B(`logging/setLevel`),params:id}),od=yl.extend({level:rd,logger:k().optional(),data:N()}),sd=bl.extend({method:B(`notifications/message`),params:od}),cd=F({name:k().optional()}),ld=F({hints:P(cd).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),ud=F({mode:z([`auto`,`required`,`none`]).optional()}),dd=F({type:B(`tool_result`),toolUseId:k().describe(`The unique identifier for the corresponding tool call.`),content:P(Hu),structuredContent:N().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),fd=bc(`type`,[Iu,Lu,Ru]),pd=bc(`type`,[Iu,Lu,Ru,zu,dd]),md=F({role:iu,content:L([pd,P(pd)]),_meta:R(k(),N()).optional()}),hd=vl.extend({messages:P(md),modelPreferences:ld.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:H.optional(),tools:P(Ju).optional(),toolChoice:ud.optional()}),gd=W.extend({method:B(`sampling/createMessage`),params:hd}),_d=G.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`]).or(k())),role:iu,content:fd}),vd=G.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(k())),role:iu,content:L([pd,P(pd)])}),yd=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),bd=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),xd=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Sd=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Cd=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),wd=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),Td=L([Sd,Cd]),Ed=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Dd=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),Od=L([Ed,Dd]),kd=L([wd,Td,Od]),Ad=L([kd,yd,bd,xd]),jd=vl.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),Ad),required:P(k()).optional()}).catchall(N())}),Md=vl.extend({mode:B(`url`),message:k(),elicitationId:k(),url:k().url()}),Nd=L([jd,Md]),Pd=W.extend({method:B(`elicitation/create`),params:Nd}),Fd=yl.extend({elicitationId:k()}),Id=bl.extend({method:B(`notifications/elicitation/complete`),params:Fd}),Ld=G.extend({action:z([`accept`,`decline`,`cancel`]),content:Zc(e=>e===null?void 0:e,R(k(),L([k(),j(),M(),P(k())])).optional())}),Rd=F({type:B(`ref/resource`),uri:k()}),zd=F({type:B(`ref/prompt`),name:k()}),Bd=U.extend({ref:L([zd,Rd]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()}),Vd=W.extend({method:B(`completion/complete`),params:Bd}),Hd=G.extend({completion:I({values:P(k()).max(100),total:V(j().int()),hasMore:V(M())})}),Ud=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Wd=W.extend({method:B(`roots/list`),params:U.optional()}),Gd=G.extend({roots:P(Ud)}),Kd=bl.extend({method:B(`notifications/roots/list_changed`),params:yl.optional()}),qd=I({ttl:j().optional(),pollInterval:j().optional()}),Jd=z([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Yd=F({taskId:k(),status:Jd,ttl:L([j(),uc()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:V(j()),statusMessage:V(k())}),Xd=G.extend({task:Yd}),Zd=yl.merge(Yd),Qd=bl.extend({method:B(`notifications/tasks/status`),params:Zd}),$d=W.extend({method:B(`tasks/get`),params:U.extend({taskId:k()})}),ef=G.merge(Yd),tf=W.extend({method:B(`tasks/result`),params:U.extend({taskId:k()})}),nf=G.loose(),rf=Ql.extend({method:B(`tasks/list`)}),af=$l.extend({tasks:P(Yd)}),of=W.extend({method:B(`tasks/cancel`),params:U.extend({taskId:k()})}),sf=G.merge(Yd),cf=L([ql,Vl,Gl,Vd,ad,Fu,Mu,cu,uu,mu,vu,bu,Cu,ed,Yu]),lf=L([jl,Xl,Wl,Kd]),uf=L([kl,_d,vd,Ld,Gd]),df=L([ql,gd,Pd,Wd]),ff=L([jl,Xl,sd,ku,gu,td,Gu,Tu,Id]),pf=L([kl,Ul,Kl,Hd,Wu,Nu,lu,du,hu,Zu,Xu,Du]),K=Vs().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Qc.custom,message:`URL must be parseable`,fatal:!0}),Xe}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),mf=I({resource:k().url(),authorization_servers:P(K).optional(),jwks_uri:k().url().optional(),scopes_supported:P(k()).optional(),bearer_methods_supported:P(k()).optional(),resource_signing_alg_values_supported:P(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:M().optional(),authorization_details_types_supported:P(k()).optional(),dpop_signing_alg_values_supported:P(k()).optional(),dpop_bound_access_tokens_required:M().optional()}),hf=I({issuer:k(),authorization_endpoint:K,token_endpoint:K,registration_endpoint:K.optional(),scopes_supported:P(k()).optional(),response_types_supported:P(k()),response_modes_supported:P(k()).optional(),grant_types_supported:P(k()).optional(),token_endpoint_auth_methods_supported:P(k()).optional(),token_endpoint_auth_signing_alg_values_supported:P(k()).optional(),service_documentation:K.optional(),revocation_endpoint:K.optional(),revocation_endpoint_auth_methods_supported:P(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:P(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:P(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:P(k()).optional(),code_challenge_methods_supported:P(k()).optional(),client_id_metadata_document_supported:M().optional(),authorization_response_iss_parameter_supported:M().optional().catch(void 0)}),gf=I({issuer:k(),authorization_endpoint:K,token_endpoint:K,userinfo_endpoint:K.optional(),jwks_uri:K,registration_endpoint:K.optional(),scopes_supported:P(k()).optional(),response_types_supported:P(k()),response_modes_supported:P(k()).optional(),grant_types_supported:P(k()).optional(),acr_values_supported:P(k()).optional(),subject_types_supported:P(k()),id_token_signing_alg_values_supported:P(k()),id_token_encryption_alg_values_supported:P(k()).optional(),id_token_encryption_enc_values_supported:P(k()).optional(),userinfo_signing_alg_values_supported:P(k()).optional(),userinfo_encryption_alg_values_supported:P(k()).optional(),userinfo_encryption_enc_values_supported:P(k()).optional(),request_object_signing_alg_values_supported:P(k()).optional(),request_object_encryption_alg_values_supported:P(k()).optional(),request_object_encryption_enc_values_supported:P(k()).optional(),token_endpoint_auth_methods_supported:P(k()).optional(),token_endpoint_auth_signing_alg_values_supported:P(k()).optional(),display_values_supported:P(k()).optional(),claim_types_supported:P(k()).optional(),claims_supported:P(k()).optional(),service_documentation:k().optional(),claims_locales_supported:P(k()).optional(),ui_locales_supported:P(k()).optional(),claims_parameter_supported:M().optional(),request_parameter_supported:M().optional(),request_uri_parameter_supported:M().optional(),require_request_uri_registration:M().optional(),op_policy_uri:K.optional(),op_tos_uri:K.optional(),client_id_metadata_document_supported:M().optional(),authorization_response_iss_parameter_supported:M().optional().catch(void 0)}),_f=F({...gf.shape,...hf.pick({code_challenge_methods_supported:!0}).shape}),vf=F({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:nl().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),yf=F({issued_token_type:B(`urn:ietf:params:oauth:token-type:id-jag`),access_token:k(),token_type:k().optional(),expires_in:j().optional(),scope:k().optional()}).strip(),bf=F({error:k(),error_description:k().optional(),error_uri:k().optional()}),xf=K.optional().or(B(``).transform(()=>void 0)),Sf=F({redirect_uris:P(K),token_endpoint_auth_method:k().optional(),grant_types:P(k()).optional(),response_types:P(k()).optional(),application_type:k().optional(),client_name:k().optional(),client_uri:K.optional(),logo_uri:xf,scope:k().optional(),contacts:P(k()).optional(),tos_uri:xf,policy_uri:k().optional(),jwks_uri:K.optional(),jwks:fc().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),Cf=F({client_id:k(),client_secret:k().optional(),client_id_issued_at:j().optional(),client_secret_expires_at:j().optional()}).strip(),wf=Sf.merge(Cf),Tf=F({error:k(),error_description:k().optional()}).strip(),Ef=F({token:k(),token_type_hint:k().optional()}).strip(),Df=Symbol.for(`mcp.sdk.errorBrands`);function Of(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Df,{value:n,enumerable:!1,configurable:!0})}function kf(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Df)){let n=t[Df];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Of(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var q=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),J=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`SdkError`,Of(this,new.target)}};(class extends J{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n){super(e,t,n),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Af=`2026-07-28`;function jf(e){return e>=Af}function Mf(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var Nf=[`task`,`inputRequests`,`requestState`];function Pf(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Nf.some(t=>t in e)?e:{...e,content:[]}}function Ff(){let e=qc(()=>L([k(),j(),M(),uc(),R(k(),e),P(e)])),t=R(k(),e),n=L([k(),j().int()]),r=k(),i=F({ttl:j().optional()}),a=F({taskId:k()}),o=I({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=F({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=F({method:k(),params:s.loose().optional()}),u=F({_meta:o.optional()}),d=F({method:k(),params:u.loose().optional()}),f=I({_meta:o.optional()}),p=L([k(),j().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:k().optional()}),ee=d.extend({method:B(`notifications/cancelled`),params:h}),g=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),te=F({icons:P(g).optional()}),ne=F({name:k(),title:k().optional()}),re=ne.extend({...ne.shape,...te.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),ie=Zc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Sc(F({form:Sc(F({applyDefaults:M().optional()}),t).optional(),url:t.optional()}),t.optional())),_=I({list:t.optional(),cancel:t.optional(),requests:I({sampling:I({createMessage:t.optional()}).optional(),elicitation:I({create:t.optional()}).optional()}).optional()}),ae=I({list:t.optional(),cancel:t.optional(),requests:I({tools:I({call:t.optional()}).optional()}).optional()}),oe=F({experimental:R(k(),t).optional(),sampling:F({context:t.optional(),tools:t.optional()}).optional(),elicitation:ie.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:_.optional(),extensions:R(k(),t).optional()}),se=s.extend({protocolVersion:k(),capabilities:oe,clientInfo:re}),ce=l.extend({method:B(`initialize`),params:se}),le=F({experimental:R(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:ae.optional(),extensions:R(k(),t).optional()}),ue=f.extend({protocolVersion:k(),capabilities:le,serverInfo:re,instructions:k().optional()}),de=d.extend({method:B(`notifications/initialized`),params:u.optional()}),fe=l.extend({method:B(`ping`),params:s.optional()}),pe=F({progress:j(),total:V(j()),message:V(k())}),v=F({...u.shape,...pe.shape,progressToken:n}),y=d.extend({method:B(`notifications/progress`),params:v}),me=s.extend({cursor:r.optional()}),he=l.extend({params:me.optional()}),ge=f.extend({nextCursor:r.optional()}),_e=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),ve=_e.extend({text:k()}),ye=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),be=_e.extend({blob:ye}),xe=z([`user`,`assistant`]),Se=F({audience:P(xe).optional(),priority:j().min(0).max(1).optional(),lastModified:el({offset:!0}).optional()}),Ce=F({...ne.shape,...te.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:Se.optional(),_meta:V(I({}))}),we=F({...ne.shape,...te.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:Se.optional(),_meta:V(I({}))}),Te=he.extend({method:B(`resources/list`)}),Ee=ge.extend({resources:P(Ce)}),b=he.extend({method:B(`resources/templates/list`)}),De=ge.extend({resourceTemplates:P(we)}),Oe=s.extend({uri:k()}),ke=Oe,Ae=l.extend({method:B(`resources/read`),params:ke}),je=f.extend({contents:P(L([ve,be]))}),Me=d.extend({method:B(`notifications/resources/list_changed`),params:u.optional()}),Ne=Oe,Pe=l.extend({method:B(`resources/subscribe`),params:Ne}),Fe=Oe,Ie=l.extend({method:B(`resources/unsubscribe`),params:Fe}),Le=u.extend({uri:k()}),Re=d.extend({method:B(`notifications/resources/updated`),params:Le}),ze=F({name:k(),description:V(k()),required:V(M())}),Be=F({...ne.shape,...te.shape,description:V(k()),arguments:V(P(ze)),_meta:V(I({}))}),Ve=he.extend({method:B(`prompts/list`)}),He=ge.extend({prompts:P(Be)}),Ue=s.extend({name:k(),arguments:R(k(),k()).optional()}),We=l.extend({method:B(`prompts/get`),params:Ue}),Ge=F({type:B(`text`),text:k(),annotations:Se.optional(),_meta:R(k(),N()).optional()}),x=F({type:B(`image`),data:ye,mimeType:k(),annotations:Se.optional(),_meta:R(k(),N()).optional()}),Ke=F({type:B(`audio`),data:ye,mimeType:k(),annotations:Se.optional(),_meta:R(k(),N()).optional()}),qe=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Je=F({type:B(`resource`),resource:L([ve,be]),annotations:Se.optional(),_meta:R(k(),N()).optional()}),Ye=Ce.extend({type:B(`resource_link`)}),Xe=L([Ge,x,Ke,Ye,Je]),Ze=F({role:xe,content:Xe}),Qe=f.extend({description:k().optional(),messages:P(Ze)}),$e=d.extend({method:B(`notifications/prompts/list_changed`),params:u.optional()}),S=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),et=F({taskSupport:z([`required`,`optional`,`forbidden`]).optional()}),tt=F({...ne.shape,...te.shape,description:k().optional(),inputSchema:F({type:B(`object`),properties:R(k(),e).optional(),required:P(k()).optional()}).catchall(N()),outputSchema:F({type:B(`object`),properties:R(k(),e).optional(),required:P(k()).optional()}).catchall(N()).optional(),annotations:S.optional(),execution:et.optional(),_meta:R(k(),N()).optional()}),nt=he.extend({method:B(`tools/list`)}),rt=ge.extend({tools:P(tt)}),it=f.extend({content:P(Xe),structuredContent:R(k(),N()).optional(),isError:M().optional()}),at=c.extend({name:k(),arguments:R(k(),N()).optional()}),ot=l.extend({method:B(`tools/call`),params:at}),st=d.extend({method:B(`notifications/tools/list_changed`),params:u.optional()}),ct=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),lt=s.extend({level:ct}),ut=l.extend({method:B(`logging/setLevel`),params:lt}),dt=u.extend({level:ct,logger:k().optional(),data:N()}),ft=d.extend({method:B(`notifications/message`),params:dt}),pt=F({name:k().optional()}),mt=F({hints:P(pt).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),ht=F({mode:z([`auto`,`required`,`none`]).optional()}),gt=F({type:B(`tool_result`),toolUseId:k().describe(`The unique identifier for the corresponding tool call.`),content:P(Xe),structuredContent:F({}).loose().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),_t=bc(`type`,[Ge,x,Ke]),vt=bc(`type`,[Ge,x,Ke,qe,gt]),yt=F({role:xe,content:L([vt,P(vt)]),_meta:R(k(),N()).optional()}),bt=c.extend({messages:P(yt),modelPreferences:mt.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:t.optional(),tools:P(tt).optional(),toolChoice:ht.optional()}),xt=l.extend({method:B(`sampling/createMessage`),params:bt}),St=f.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`]).or(k())),role:xe,content:_t}),Ct=f.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(k())),role:xe,content:L([vt,P(vt)])}),wt=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),Tt=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Et=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Dt=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Ot=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),kt=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),At=L([Dt,Ot]),jt=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Mt=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),Nt=L([jt,Mt]),Pt=L([kt,At,Nt]),Ft=L([Pt,wt,Tt,Et]),It=c.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),Ft),required:P(k()).optional()}).catchall(N())}),Lt=c.extend({mode:B(`url`),message:k(),elicitationId:k(),url:k().url()}),Rt=L([It,Lt]),zt=l.extend({method:B(`elicitation/create`),params:Rt}),Bt=u.extend({elicitationId:k()}),Vt=d.extend({method:B(`notifications/elicitation/complete`),params:Bt}),Ht=f.extend({action:z([`accept`,`decline`,`cancel`]),content:Zc(e=>e===null?void 0:e,R(k(),L([k(),j(),M(),P(k())])).optional())}),Ut=F({type:B(`ref/resource`),uri:k()}),Wt=F({type:B(`ref/prompt`),name:k()}),Gt=s.extend({ref:L([Wt,Ut]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()}),Kt=l.extend({method:B(`completion/complete`),params:Gt}),qt=f.extend({completion:I({values:P(k()).max(100),total:V(j().int()),hasMore:V(M())})}),Jt=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Yt=l.extend({method:B(`roots/list`),params:s.optional()}),Xt=f.extend({roots:P(Jt)}),Zt=d.extend({method:B(`notifications/roots/list_changed`),params:u.optional()}),Qt=I({ttl:j().optional(),pollInterval:j().optional()}),$t=z([`working`,`input_required`,`completed`,`failed`,`cancelled`]),en=F({taskId:k(),status:$t,ttl:L([j(),uc()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:V(j()),statusMessage:V(k())}),tn=f.extend({task:en}),nn=u.merge(en),rn=d.extend({method:B(`notifications/tasks/status`),params:nn}),an=l.extend({method:B(`tasks/get`),params:s.extend({taskId:k()})}),on=f.merge(en),sn=l.extend({method:B(`tasks/result`),params:s.extend({taskId:k()})}),cn=f.loose(),C=he.extend({method:B(`tasks/list`)}),ln=ge.extend({tasks:P(en)}),un=l.extend({method:B(`tasks/cancel`),params:s.extend({taskId:k()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:ee,IconSchema:g,IconsSchema:te,BaseMetadataSchema:ne,ImplementationSchema:re,ClientTasksCapabilitySchema:_,ServerTasksCapabilitySchema:ae,ClientCapabilitiesSchema:oe,InitializeRequestParamsSchema:se,InitializeRequestSchema:ce,ServerCapabilitiesSchema:le,InitializeResultSchema:ue,InitializedNotificationSchema:de,PingRequestSchema:fe,ProgressSchema:pe,ProgressNotificationParamsSchema:v,ProgressNotificationSchema:y,PaginatedRequestParamsSchema:me,PaginatedRequestSchema:he,PaginatedResultSchema:ge,ResourceContentsSchema:_e,TextResourceContentsSchema:ve,BlobResourceContentsSchema:be,RoleSchema:xe,AnnotationsSchema:Se,ResourceSchema:Ce,ResourceTemplateSchema:we,ListResourcesRequestSchema:Te,ListResourcesResultSchema:Ee,ListResourceTemplatesRequestSchema:b,ListResourceTemplatesResultSchema:De,ResourceRequestParamsSchema:Oe,ReadResourceRequestParamsSchema:ke,ReadResourceRequestSchema:Ae,ReadResourceResultSchema:je,ResourceListChangedNotificationSchema:Me,SubscribeRequestParamsSchema:Ne,SubscribeRequestSchema:Pe,UnsubscribeRequestParamsSchema:Fe,UnsubscribeRequestSchema:Ie,ResourceUpdatedNotificationParamsSchema:Le,ResourceUpdatedNotificationSchema:Re,PromptArgumentSchema:ze,PromptSchema:Be,ListPromptsRequestSchema:Ve,ListPromptsResultSchema:He,GetPromptRequestParamsSchema:Ue,GetPromptRequestSchema:We,TextContentSchema:Ge,ImageContentSchema:x,AudioContentSchema:Ke,ToolUseContentSchema:qe,EmbeddedResourceSchema:Je,ResourceLinkSchema:Ye,ContentBlockSchema:Xe,PromptMessageSchema:Ze,GetPromptResultSchema:Qe,PromptListChangedNotificationSchema:$e,ToolAnnotationsSchema:S,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:at,CallToolRequestSchema:ot,ToolListChangedNotificationSchema:st,LoggingLevelSchema:ct,SetLevelRequestParamsSchema:lt,SetLevelRequestSchema:ut,LoggingMessageNotificationParamsSchema:dt,LoggingMessageNotificationSchema:ft,ModelHintSchema:pt,ModelPreferencesSchema:mt,ToolChoiceSchema:ht,ToolResultContentSchema:gt,SamplingContentSchema:_t,SamplingMessageContentBlockSchema:vt,SamplingMessageSchema:yt,CreateMessageRequestParamsSchema:bt,CreateMessageRequestSchema:xt,CreateMessageResultSchema:St,CreateMessageResultWithToolsSchema:Ct,BooleanSchemaSchema:wt,StringSchemaSchema:Tt,NumberSchemaSchema:Et,UntitledSingleSelectEnumSchemaSchema:Dt,TitledSingleSelectEnumSchemaSchema:Ot,LegacyTitledEnumSchemaSchema:kt,SingleSelectEnumSchemaSchema:At,UntitledMultiSelectEnumSchemaSchema:jt,TitledMultiSelectEnumSchemaSchema:Mt,MultiSelectEnumSchemaSchema:Nt,EnumSchemaSchema:Pt,PrimitiveSchemaDefinitionSchema:Ft,ElicitRequestFormParamsSchema:It,ElicitRequestURLParamsSchema:Lt,ElicitRequestParamsSchema:Rt,ElicitRequestSchema:zt,ElicitationCompleteNotificationParamsSchema:Bt,ElicitationCompleteNotificationSchema:Vt,ElicitResultSchema:Ht,ResourceTemplateReferenceSchema:Ut,PromptReferenceSchema:Wt,CompleteRequestParamsSchema:Gt,CompleteRequestSchema:Kt,CompleteResultSchema:qt,RootSchema:Jt,ListRootsRequestSchema:Yt,ListRootsResultSchema:Xt,RootsListChangedNotificationSchema:Zt,TaskCreationParamsSchema:Qt,TaskStatusSchema:$t,TaskSchema:en,CreateTaskResultSchema:tn,TaskStatusNotificationParamsSchema:nn,TaskStatusNotificationSchema:rn,GetTaskRequestSchema:an,GetTaskResultSchema:on,GetTaskPayloadRequestSchema:sn,GetTaskPayloadResultSchema:cn,ListTasksRequestSchema:C,ListTasksResultSchema:ln,CancelTaskRequestSchema:un,CancelTaskResultSchema:f.merge(en),ClientRequestSchema:L([fe,ce,Kt,ut,We,Ve,Te,b,Ae,Pe,Ie,ot,nt,an,sn,C,un]),ClientNotificationSchema:L([ee,y,de,Zt,rn]),ClientResultSchema:L([m,St,Ct,Ht,Xt,on,ln,tn]),ServerRequestSchema:L([fe,xt,zt,Yt,an,sn,C,un]),ServerNotificationSchema:L([ee,y,ft,Re,Me,st,$e,rn,Vt]),ServerResultSchema:L([m,ue,qt,Qe,He,Ee,De,je,it,rt,on,ln,tn]),CallToolResultWireSchema:N().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Nf)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(Pf).pipe(it)}}var If;function Lf(){return If??=Ff()}function Rf(e){return e.type!==`object`}var zf=new Set([`const`,`enum`,`default`,`examples`]),Bf=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function Vf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Hf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(Vf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=i(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&Vf(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=zf.has(o)?s:Bf.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Uf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Wf={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Gf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Kf;function qf(){if(Kf)return Kf;let e=Lf();return Kf={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Kf}function Jf(e){return Object.prototype.hasOwnProperty.call(Uf,e)}function Yf(e){return Object.prototype.hasOwnProperty.call(Wf,e)}function Xf(e){return Object.prototype.hasOwnProperty.call(Gf,e)}function Zf(e){return Xf(e)?qf().resultSchemas[e]:void 0}function Qf(e){return Jf(e)?qf().requestSchemas[e]:void 0}function $f(e){return Yf(e)?qf().notificationSchemas[e]:void 0}Object.keys(Uf),Object.keys(Wf);function ep(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var np={ok:!1,reason:`not-in-era`};function rp(e){return ep(e)&&ep(e.outputSchema)&&Rf(e.outputSchema)}function ip(e){return e}var ap={era:`2025-11-25`,hasRequestMethod:Jf,hasNotificationMethod:Yf,validateRequest:(e,t)=>tp(Qf(e),t),validateResult:(e,t)=>tp(Zf(e),t),validateNotification:(e,t)=>tp($f(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>np,validateInputResponse:()=>np,samplingResultVariant:((e,t)=>{let n=Lf();return tp(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Mf(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Rf(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(ep(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:ip(e)}}return{kind:`complete`,result:ip(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>rp(e))?t:{...t,tools:n.map(e=>rp(e)?{...e,outputSchema:Hf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function op(){let e=qc(()=>L([k(),j(),M(),uc(),R(k(),e),P(e)])),t=R(k(),e),n=L([k(),j().int()]),r=k(),i=L([k(),j().int()]),a=z([`user`,`assistant`]),o=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=F({ttl:j().optional()}),l=F({taskId:k()}),u=I({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=F({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=F({_meta:u.optional()}),m=F({method:k(),params:p.loose().optional()}),h=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),ee=F({icons:P(h).optional()}),g=F({name:k(),title:k().optional()}),te=g.extend({...g.shape,...ee.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),ne=Zc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Sc(F({form:Sc(F({applyDefaults:M().optional()}),t).optional(),url:t.optional()}),t.optional())),re=I({list:t.optional(),cancel:t.optional(),requests:I({sampling:I({createMessage:t.optional()}).optional(),elicitation:I({create:t.optional()}).optional()}).optional()}),ie=I({list:t.optional(),cancel:t.optional(),requests:I({tools:I({call:t.optional()}).optional()}).optional()}),_=F({experimental:R(k(),t).optional(),sampling:F({context:t.optional(),tools:t.optional()}).optional(),elicitation:ne.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:re.optional(),extensions:R(k(),t).optional()}),ae=F({experimental:R(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:ie.optional(),extensions:R(k(),t).optional()}),oe=F({progress:j(),total:V(j()),message:V(k())}),se=F({...p.shape,...oe.shape,progressToken:n}),ce=m.extend({method:B(`notifications/progress`),params:se}),le=p.extend({level:o,logger:k().optional(),data:N()}),ue=m.extend({method:B(`notifications/message`),params:le}),de=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),fe=de.extend({text:k()}),pe=de.extend({blob:s}),v=F({audience:P(a).optional(),priority:j().min(0).max(1).optional(),lastModified:el({offset:!0}).optional()}),y=F({...g.shape,...ee.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:v.optional(),_meta:V(I({}))}),me=F({...g.shape,...ee.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:v.optional(),_meta:V(I({}))}),he=m.extend({method:B(`notifications/resources/list_changed`),params:p.optional()}),ge=p.extend({uri:k()}),_e=m.extend({method:B(`notifications/resources/updated`),params:ge}),ve=F({name:k(),description:V(k()),required:V(M())}),ye=F({...g.shape,...ee.shape,description:V(k()),arguments:V(P(ve)),_meta:V(I({}))}),be=m.extend({method:B(`notifications/prompts/list_changed`),params:p.optional()}),xe=F({type:B(`text`),text:k(),annotations:v.optional(),_meta:R(k(),N()).optional()}),Se=F({type:B(`image`),data:s,mimeType:k(),annotations:v.optional(),_meta:R(k(),N()).optional()}),Ce=F({type:B(`audio`),data:s,mimeType:k(),annotations:v.optional(),_meta:R(k(),N()).optional()}),we=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Te=F({type:B(`resource`),resource:L([fe,pe]),annotations:v.optional(),_meta:R(k(),N()).optional()}),Ee=y.extend({type:B(`resource_link`)}),b=L([xe,Se,Ce,Ee,Te]),De=F({role:a,content:b}),Oe=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),ke=m.extend({method:B(`notifications/tools/list_changed`),params:p.optional()}),Ae=F({name:k().optional()}),je=F({hints:P(Ae).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),Me=F({mode:z([`auto`,`required`,`none`]).optional()}),Ne=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),Pe=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Fe=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Ie=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Le=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),Re=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),ze=L([Ie,Le]),Be=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Ve=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),He=L([Be,Ve]),Ue=L([Re,ze,He]),We=L([Ue,Ne,Pe,Fe]),Ge=f.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),We),required:P(k()).optional()}).catchall(N())}),x=F({type:B(`ref/resource`),uri:k()}),Ke=F({type:B(`ref/prompt`),name:k()}),qe=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Je=_.shape,Ye=F({experimental:Je.experimental,sampling:Je.sampling,elicitation:Je.elicitation,roots:Je.roots,extensions:Je.extensions}),Xe=ae.shape,Ze=F({experimental:Xe.experimental,logging:Xe.logging,completions:Xe.completions,prompts:Xe.prompts,resources:Xe.resources,tools:Xe.tools,extensions:Xe.extensions}),Qe=I({progressToken:n.optional(),[al]:k(),[ol]:te.optional(),[cl]:Ye,[ul]:o.optional()}),$e=F({...g.shape,...ee.shape,description:k().optional(),inputSchema:I({$schema:k().optional(),type:B(`object`)}),outputSchema:I({$schema:k().optional()}).optional(),annotations:Oe.optional(),_meta:R(k(),N()).optional()}),S=F({type:B(`tool_result`),toolUseId:k(),content:P(b),structuredContent:N().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),et=L([xe,Se,Ce,we,S]),tt=F({role:a,content:L([et,P(et)]),_meta:R(k(),N()).optional()}),nt=k(),rt=I({[sl]:te.optional().catch(void 0)}),it=rt.optional();function at(e){return I({_meta:it,resultType:nt.default(`complete`),...e})}let ot=at({}),st=at({nextCursor:r.optional()}),ct=at({content:P(b),structuredContent:N().optional(),isError:M().optional()}),lt=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),tools:P($e),nextCursor:r.optional()}),ut=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),prompts:P(ye),nextCursor:r.optional()}),dt=at({description:k().optional(),messages:P(De)}),ft=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resources:P(y),nextCursor:r.optional()}),pt=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resourceTemplates:P(me),nextCursor:r.optional()}),mt=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),contents:P(L([fe,pe]))}),ht=at({completion:F({values:P(k()).max(100),total:j().int().optional(),hasMore:M().optional()}).loose()}),gt=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`])}),_t=at({ttlMs:j().int().min(0).catch(0),cacheScope:z([`public`,`private`]).catch(`private`),supportedVersions:P(k()),capabilities:Ze,instructions:k().optional()}),vt=F({messages:P(tt),modelPreferences:je.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:t.optional(),tools:P($e).optional(),toolChoice:Me.optional()}),yt=F({method:B(`sampling/createMessage`),params:vt}),bt=F({method:B(`roots/list`),params:F({_meta:R(k(),N()).optional()}).optional()}),xt=F({...tt.shape,model:k(),stopReason:k().optional()}),St=F({roots:P(qe)}),Ct=F({action:z([`accept`,`decline`,`cancel`]),content:R(k(),L([k(),j(),M(),P(k())])).optional()}),wt=F({mode:B(`url`),message:k(),url:k().url()}),Tt=L([Ge,wt]),Et=F({method:B(`elicitation/create`),params:Tt}),Dt=L([yt,bt,Et]),Ot=L([xt,St,Ct]),kt=R(k(),Dt),At=R(k(),Ot),jt=at({inputRequests:kt.optional(),requestState:k().optional()}),Mt={inputResponses:At.optional(),requestState:k().optional()},Nt=F({_meta:Qe,...Mt}),Pt=I({progressToken:n.optional()});function Ft(e,t){return F({method:B(e),params:F({_meta:Qe,...t})})}function It(e,t){return F({method:B(e),params:F({_meta:Pt.optional(),...t}).optional()})}let Lt={name:k(),arguments:R(k(),N()).optional(),...Mt},Rt={cursor:r.optional()},zt=Ft(`tools/call`,Lt),Bt=Ft(`tools/list`,Rt),Vt=Ft(`prompts/list`,Rt),Ht=Ft(`prompts/get`,{name:k(),arguments:R(k(),k()).optional(),...Mt}),Ut=Ft(`resources/list`,Rt),Wt=Ft(`resources/templates/list`,Rt),Gt=Ft(`resources/read`,{uri:k(),...Mt}),Kt={ref:L([Ke,x]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()},qt=Ft(`completion/complete`,Kt),Jt=Ft(`server/discover`,{}),Yt=F({toolsListChanged:M().optional(),promptsListChanged:M().optional(),resourcesListChanged:M().optional(),resourceSubscriptions:P(k()).optional()}),Xt={notifications:Yt},Zt=Ft(`subscriptions/listen`,Xt),Qt=rt.extend({"io.modelcontextprotocol/subscriptionId":i}),$t=I({_meta:Qt,resultType:nt.default(`complete`)}),en={"tools/call":It(`tools/call`,Lt),"tools/list":It(`tools/list`,Rt),"prompts/get":It(`prompts/get`,{name:k(),arguments:R(k(),k()).optional()}),"prompts/list":It(`prompts/list`,Rt),"resources/list":It(`resources/list`,Rt),"resources/templates/list":It(`resources/templates/list`,Rt),"resources/read":It(`resources/read`,{uri:k()}),"completion/complete":It(`completion/complete`,Kt),"server/discover":It(`server/discover`,{}),"subscriptions/listen":It(`subscriptions/listen`,Xt)};function tn(e){return I({_meta:it,...e})}let nn={"tools/call":tn({content:P(b),structuredContent:N().optional(),isError:M().optional()}),"tools/list":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),tools:P($e),nextCursor:r.optional()}),"prompts/get":tn({description:k().optional(),messages:P(De)}),"prompts/list":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),prompts:P(ye),nextCursor:r.optional()}),"resources/list":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resources:P(y),nextCursor:r.optional()}),"resources/templates/list":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resourceTemplates:P(me),nextCursor:r.optional()}),"resources/read":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),contents:P(L([fe,pe]))}),"completion/complete":tn({completion:F({values:P(k()).max(100),total:j().int().optional(),hasMore:M().optional()}).loose()}),"server/discover":tn({ttlMs:j().int().min(0).catch(0),cacheScope:z([`public`,`private`]).catch(`private`),supportedVersions:P(k()),capabilities:Ze,instructions:k().optional()}),"subscriptions/listen":tn({})},rn=I({"io.modelcontextprotocol/subscriptionId":i.optional()}),an=F({method:B(`notifications/subscriptions/acknowledged`),params:F({_meta:rn.optional(),notifications:Yt})}),on=F({_meta:rn.optional(),requestId:i,reason:k().optional()}),sn=F({method:B(`notifications/cancelled`),params:on}),cn={"notifications/cancelled":sn,"notifications/progress":ce,"notifications/message":ue,"notifications/resources/updated":_e,"notifications/resources/list_changed":he,"notifications/tools/list_changed":ke,"notifications/prompts/list_changed":be,"notifications/subscriptions/acknowledged":an},C=e=>F({jsonrpc:B(`2.0`),id:L([k(),j().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:ee,BaseMetadataSchema:g,ImplementationSchema:te,ClientTasksCapabilitySchema:re,ServerTasksCapabilitySchema:ie,ClientCapabilitiesSchema:_,ServerCapabilitiesSchema:ae,ProgressSchema:oe,ProgressNotificationParamsSchema:se,ProgressNotificationSchema:ce,LoggingMessageNotificationParamsSchema:le,LoggingMessageNotificationSchema:ue,ResourceContentsSchema:de,TextResourceContentsSchema:fe,BlobResourceContentsSchema:pe,AnnotationsSchema:v,ResourceSchema:y,ResourceTemplateSchema:me,ResourceListChangedNotificationSchema:he,ResourceUpdatedNotificationParamsSchema:ge,ResourceUpdatedNotificationSchema:_e,PromptArgumentSchema:ve,PromptSchema:ye,PromptListChangedNotificationSchema:be,TextContentSchema:xe,ImageContentSchema:Se,AudioContentSchema:Ce,ToolUseContentSchema:we,EmbeddedResourceSchema:Te,ResourceLinkSchema:Ee,ContentBlockSchema:b,PromptMessageSchema:De,ToolAnnotationsSchema:Oe,ToolListChangedNotificationSchema:ke,ModelHintSchema:Ae,ModelPreferencesSchema:je,ToolChoiceSchema:Me,BooleanSchemaSchema:Ne,StringSchemaSchema:Pe,NumberSchemaSchema:Fe,UntitledSingleSelectEnumSchemaSchema:Ie,TitledSingleSelectEnumSchemaSchema:Le,LegacyTitledEnumSchemaSchema:Re,SingleSelectEnumSchemaSchema:ze,UntitledMultiSelectEnumSchemaSchema:Be,TitledMultiSelectEnumSchemaSchema:Ve,MultiSelectEnumSchemaSchema:He,EnumSchemaSchema:Ue,PrimitiveSchemaDefinitionSchema:We,ElicitRequestFormParamsSchema:Ge,ResourceTemplateReferenceSchema:x,PromptReferenceSchema:Ke,RootSchema:qe,ClientCapabilities2026Schema:Ye,ServerCapabilities2026Schema:Ze,RequestMetaEnvelopeSchema:Qe,ToolSchema:$e,ToolResultContentSchema:S,SamplingMessageContentBlockSchema:et,SamplingMessageSchema:tt,ResultTypeSchema:nt,ResultMetaSchema:rt,ResultSchema:ot,PaginatedResultSchema:st,CallToolResultSchema:ct,ListToolsResultSchema:lt,ListPromptsResultSchema:ut,GetPromptResultSchema:dt,ListResourcesResultSchema:ft,ListResourceTemplatesResultSchema:pt,ReadResourceResultSchema:mt,CompleteResultSchema:ht,CacheableResultSchema:gt,DiscoverResultSchema:_t,CreateMessageRequestParamsSchema:vt,CreateMessageRequestSchema:yt,ListRootsRequestSchema:bt,CreateMessageResultSchema:xt,ListRootsResultSchema:St,ElicitResultSchema:Ct,ElicitRequestURLParamsSchema:wt,ElicitRequestParamsSchema:Tt,ElicitRequestSchema:Et,InputRequestSchema:Dt,InputResponseSchema:Ot,InputRequestsSchema:kt,InputResponsesSchema:At,InputRequiredResultSchema:jt,InputResponseRequestParamsSchema:Nt,CallToolRequestSchema:zt,ListToolsRequestSchema:Bt,ListPromptsRequestSchema:Vt,GetPromptRequestSchema:Ht,ListResourcesRequestSchema:Ut,ListResourceTemplatesRequestSchema:Wt,ReadResourceRequestSchema:Gt,CompleteRequestSchema:qt,DiscoverRequestSchema:Jt,SubscriptionFilterSchema:Yt,SubscriptionsListenRequestSchema:Zt,SubscriptionsListenResultMetaSchema:Qt,SubscriptionsListenResultSchema:$t,dispatchRequestSchemas:en,dispatchResultSchemas:nn,NotificationMetaSchema:rn,SubscriptionsAcknowledgedNotificationSchema:an,CancelledNotificationParamsSchema:on,CancelledNotificationSchema:sn,notificationSchemas2026:cn,JSONRPCResultResponseSchema:C(ot),CallToolResultResponseSchema:C(L([ct,jt])),ListToolsResultResponseSchema:C(lt),ListPromptsResultResponseSchema:C(ut),GetPromptResultResponseSchema:C(L([dt,jt])),ListResourcesResultResponseSchema:C(ft),ListResourceTemplatesResultResponseSchema:C(pt),ReadResourceResultResponseSchema:C(L([mt,jt])),CompleteResultResponseSchema:C(ht),DiscoverResultResponseSchema:C(_t)}}var sp;function cp(){return sp??=op()}var lp=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function up(e){return lp.includes(e)}var dp=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function fp(e){return e[dp]}function pp(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function mp(e){return e===`public`||e===`private`}var Y=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),X=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Of(this,new.target)}static fromError(t,n,r){if(t===Y.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new gp(e.elicitations,n)}if(t===Y.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new _p({supported:e.supported,requested:e.requested},n)}if(t===Y.InvalidParams||t===Y.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===Y.ResourceNotFound||Object.keys(e).length===1))return new hp(e.uri,n)}if(t===Y.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new vp({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},hp=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(Y.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},gp=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(Y.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},_p=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Y.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},vp=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(Y.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},yp=0,bp=`private`,xp=[`tools/call`,`prompts/get`,`resources/read`];function Sp(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||xp.includes(e))return t;throw new X(Y.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Cp(e,t){let n=fp(t);if(t.resultType!==`complete`||!up(e))return n===void 0?t:Op(t);let r=t,i=pp(r.ttlMs)?r.ttlMs:Ep(n),a=mp(r.cacheScope)?r.cacheScope:Dp(n),o={...r,ttlMs:i,cacheScope:a};return delete o[dp],o}function wp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tp(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[sl]:t}}:!wp(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[sl]:t}}}function Ep(e){return e!==void 0&&pp(e.ttlMs)?e.ttlMs:yp}function Dp(e){return e!==void 0&&mp(e.cacheScope)?e.cacheScope:bp}function Op(e){let t={...e};return delete t[dp],t}var kp=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Ap;function jp(){if(Ap)return Ap;let e=cp();return Ap={request:{"elicitation/create":F({method:B(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":F({method:B(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":F({method:B(`roots/list`),params:I({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Ap}function Mp(e){return kp.includes(e)}function Np(e){return Mp(e)?jp().request[e]:void 0}function Pp(e){return Mp(e)?jp().response[e]:void 0}var Fp={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Ip={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Lp(e){return Object.prototype.hasOwnProperty.call(Fp,e)}function Rp(e){return Object.prototype.hasOwnProperty.call(Ip,e)}function zp(e){return Object.prototype.hasOwnProperty.call(Fp,e)}function Bp(e){return Lp(e)?cp().dispatchRequestSchemas[e]:void 0}function Vp(e){return zp(e)?cp().dispatchResultSchemas[e]:void 0}function Hp(e){return Rp(e)?cp().notificationSchemas2026[e]:void 0}Object.keys(Fp),Object.keys(Ip);function Up(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Gp={ok:!1,reason:`not-in-era`},Kp=[al,cl];function qp(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Up(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Up(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Up(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Jp={era:`2026-07-28`,hasRequestMethod:Lp,hasNotificationMethod:Rp,hasInputRequestMethod:e=>Np(e)!==void 0,validateRequest:(e,t)=>Wp(Bp(e),t),validateResult:(e,t)=>Wp(Vp(e),t),validateNotification:(e,t)=>Wp(Hp(e),t),validateInputRequest:(e,t)=>Wp(Np(e),t),validateInputResponse:(e,t)=>Wp(Pp(e),t),samplingResultVariant:()=>Gp,outboundEnvelope(e){return{[al]:e.protocolVersion,[ol]:e.clientInfo,[cl]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Kp)n in e||t.push({key:n,problem:`missing`});let n=cp().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Mf(e),inputRequestSchema:Np,decodeResult(e,t){if(!Up(t))return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Up(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new J(q.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Xp(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Tp(Cp(e,Sp(e,qp(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=cp().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Yp;function Xp(){if(Yp)return Yp;let e=cp();return Yp={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Yp}var Zp=`2026-07-28`;function Qp(e){return e!==void 0&&jf(e)?Jp:ap}function $p(e){return e.revision===void 0?e.era===`modern`?Jp.era:ap.era:Qp(e.revision).era}function em(e){return nm.some(t=>t.hasRequestMethod(e))}function tm(e){return nm.some(t=>t.hasNotificationMethod(e))}var nm=[ap,Jp],rm=n({AnnotationsSchema:()=>au,AudioContentSchema:()=>Ru,BaseMetadataSchema:()=>Pl,BaseRequestParamsSchema:()=>U,BlobResourceContentsSchema:()=>ru,BooleanSchemaSchema:()=>yd,CallToolRequestParamsSchema:()=>$u,CallToolRequestSchema:()=>ed,CallToolResultSchema:()=>Zu,CancelTaskRequestSchema:()=>of,CancelTaskResultSchema:()=>sf,CancelledNotificationParamsSchema:()=>Al,CancelledNotificationSchema:()=>jl,ClientCapabilitiesSchema:()=>zl,ClientNotificationSchema:()=>lf,ClientRequestSchema:()=>cf,ClientResultSchema:()=>uf,ClientTasksCapabilitySchema:()=>Ll,CompatibilityCallToolResultSchema:()=>Qu,CompleteRequestParamsSchema:()=>Bd,CompleteRequestSchema:()=>Vd,CompleteResultSchema:()=>Hd,ContentBlockSchema:()=>Hu,CreateMessageRequestParamsSchema:()=>hd,CreateMessageRequestSchema:()=>gd,CreateMessageResultSchema:()=>_d,CreateMessageResultWithToolsSchema:()=>vd,CreateTaskResultSchema:()=>Xd,CursorSchema:()=>ml,DiscoverRequestSchema:()=>Gl,DiscoverResultSchema:()=>Kl,ElicitRequestFormParamsSchema:()=>jd,ElicitRequestParamsSchema:()=>Nd,ElicitRequestSchema:()=>Pd,ElicitRequestURLParamsSchema:()=>Md,ElicitResultSchema:()=>Ld,ElicitationCompleteNotificationParamsSchema:()=>Fd,ElicitationCompleteNotificationSchema:()=>Id,EmbeddedResourceSchema:()=>Bu,EmptyResultSchema:()=>kl,EnumSchemaSchema:()=>kd,GetPromptRequestParamsSchema:()=>Pu,GetPromptRequestSchema:()=>Fu,GetPromptResultSchema:()=>Wu,GetTaskPayloadRequestSchema:()=>tf,GetTaskPayloadResultSchema:()=>nf,GetTaskRequestSchema:()=>$d,GetTaskResultSchema:()=>ef,IconSchema:()=>Ml,IconsSchema:()=>Nl,ImageContentSchema:()=>Lu,ImplementationSchema:()=>Fl,InitializeRequestParamsSchema:()=>Bl,InitializeRequestSchema:()=>Vl,InitializeResultSchema:()=>Ul,InitializedNotificationSchema:()=>Wl,JSONArraySchema:()=>fl,JSONObjectSchema:()=>H,JSONRPCErrorResponseSchema:()=>El,JSONRPCMessageSchema:()=>Dl,JSONRPCNotificationSchema:()=>wl,JSONRPCRequestSchema:()=>Cl,JSONRPCResponseSchema:()=>Ol,JSONRPCResultResponseSchema:()=>Tl,JSONValueSchema:()=>dl,LegacyTitledEnumSchemaSchema:()=>wd,ListChangedOptionsBaseSchema:()=>nd,ListPromptsRequestSchema:()=>Mu,ListPromptsResultSchema:()=>Nu,ListResourceTemplatesRequestSchema:()=>uu,ListResourceTemplatesResultSchema:()=>du,ListResourcesRequestSchema:()=>cu,ListResourcesResultSchema:()=>lu,ListRootsRequestSchema:()=>Wd,ListRootsResultSchema:()=>Gd,ListTasksRequestSchema:()=>rf,ListTasksResultSchema:()=>af,ListToolsRequestSchema:()=>Yu,ListToolsResultSchema:()=>Xu,LoggingLevelSchema:()=>rd,LoggingMessageNotificationParamsSchema:()=>od,LoggingMessageNotificationSchema:()=>sd,ModelHintSchema:()=>cd,ModelPreferencesSchema:()=>ld,MultiSelectEnumSchemaSchema:()=>Od,NotificationSchema:()=>bl,NotificationsParamsSchema:()=>yl,NumberSchemaSchema:()=>xd,PaginatedRequestParamsSchema:()=>Zl,PaginatedRequestSchema:()=>Ql,PaginatedResultSchema:()=>$l,PingRequestSchema:()=>ql,PrimitiveSchemaDefinitionSchema:()=>Ad,ProgressNotificationParamsSchema:()=>Yl,ProgressNotificationSchema:()=>Xl,ProgressSchema:()=>Jl,ProgressTokenSchema:()=>pl,PromptArgumentSchema:()=>Au,PromptListChangedNotificationSchema:()=>Gu,PromptMessageSchema:()=>Uu,PromptReferenceSchema:()=>zd,PromptSchema:()=>ju,ReadResourceRequestParamsSchema:()=>pu,ReadResourceRequestSchema:()=>mu,ReadResourceResultSchema:()=>hu,RelatedTaskMetadataSchema:()=>gl,RequestIdSchema:()=>Sl,RequestMetaSchema:()=>_l,RequestSchema:()=>W,ResourceContentsSchema:()=>eu,ResourceLinkSchema:()=>Vu,ResourceListChangedNotificationSchema:()=>gu,ResourceRequestParamsSchema:()=>fu,ResourceSchema:()=>ou,ResourceTemplateReferenceSchema:()=>Rd,ResourceTemplateSchema:()=>su,ResourceUpdatedNotificationParamsSchema:()=>Ou,ResourceUpdatedNotificationSchema:()=>ku,ResultMetaObjectSchema:()=>xl,ResultSchema:()=>G,RoleSchema:()=>iu,RootSchema:()=>Ud,RootsListChangedNotificationSchema:()=>Kd,SamplingContentSchema:()=>fd,SamplingMessageContentBlockSchema:()=>pd,SamplingMessageSchema:()=>md,ServerCapabilitiesSchema:()=>Hl,ServerNotificationSchema:()=>ff,ServerRequestSchema:()=>df,ServerResultSchema:()=>pf,ServerTasksCapabilitySchema:()=>Rl,SetLevelRequestParamsSchema:()=>id,SetLevelRequestSchema:()=>ad,SingleSelectEnumSchemaSchema:()=>Td,StringSchemaSchema:()=>bd,SubscribeRequestParamsSchema:()=>_u,SubscribeRequestSchema:()=>vu,SubscriptionFilterSchema:()=>xu,SubscriptionsAcknowledgedNotificationParamsSchema:()=>wu,SubscriptionsAcknowledgedNotificationSchema:()=>Tu,SubscriptionsListenRequestParamsSchema:()=>Su,SubscriptionsListenRequestSchema:()=>Cu,SubscriptionsListenResultMetaSchema:()=>Eu,SubscriptionsListenResultSchema:()=>Du,TaskAugmentedRequestParamsSchema:()=>vl,TaskCreationParamsSchema:()=>qd,TaskMetadataSchema:()=>hl,TaskSchema:()=>Yd,TaskStatusNotificationParamsSchema:()=>Zd,TaskStatusNotificationSchema:()=>Qd,TaskStatusSchema:()=>Jd,TextContentSchema:()=>Iu,TextResourceContentsSchema:()=>tu,TitledMultiSelectEnumSchemaSchema:()=>Dd,TitledSingleSelectEnumSchemaSchema:()=>Cd,ToolAnnotationsSchema:()=>Ku,ToolChoiceSchema:()=>ud,ToolExecutionSchema:()=>qu,ToolListChangedNotificationSchema:()=>td,ToolResultContentSchema:()=>dd,ToolSchema:()=>Ju,ToolUseContentSchema:()=>zu,UnsubscribeRequestParamsSchema:()=>yu,UnsubscribeRequestSchema:()=>bu,UntitledMultiSelectEnumSchemaSchema:()=>Ed,UntitledSingleSelectEnumSchemaSchema:()=>Sd}),im=e=>Cl.safeParse(e).success,am=e=>wl.safeParse(e).success,om=e=>Tl.safeParse(e).success,sm=e=>El.safeParse(e).success;Y.InvalidRequest,Y.UnsupportedProtocolVersion,Y.InvalidParams,Y.MethodNotFound,Y.InvalidParams,Y.MissingRequiredClientCapability,Y.ParseError,Y.InvalidRequest,Y.MethodNotFound,Y.UnsupportedProtocolVersion,Y.MissingRequiredClientCapability;function cm(e,t){return vs(e,t)}function lm(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function um(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var dm=!1,fm=`draft-2020-12`;function pm(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:fm});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);dm||(dm=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=fs(e,{target:fm,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&mm(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function mm(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||mm(e)))}return!1}function hm(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function gm(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>hm(e)).join(`, `)}:{success:!0,data:n.value}}function _m(e){let t=fs(e,{target:fm,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var vm=/\\\.\\d\{(\d+)\}/;function ym(e){let t=vm.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>el({local:e,offset:t,precision:n}))))}function bm(e,t){let n;switch(e){case`email`:n=[Ls()];break;case`uri`:n=[Vs()];break;case`date`:n=[tl()];break;case`date-time`:n=ym(t)}return new Set(n.map(e=>_m(e)).filter(e=>e!==void 0))}function xm(e,t,n){return n!==`zod`||bm(e,t).has(t)}function Sm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Cm(e){try{return pm(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new X(Y.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var wm=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Tm(e){return wm.has(e)||e.startsWith(`x-`)}var Em=new Set([`$schema`,...Object.keys(jd.shape.requestedSchema.shape)]),Dm={string:lm([bd,Sd,Cd,wd]),number:lm([xd]),integer:lm([xd]),boolean:lm([yd]),array:lm([Ed,Dd])},Om=new Set(bd.shape.format.unwrap().options);function km(e,t,n,r){if(!Sm(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Dm,e.type)?Dm[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Tm(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Om.has(e.format)?(typeof s!=`string`||!xm(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Am(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Sm(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,km(n,`properties.${e}`,t,r)])):Em.has(i)?n[i]=a:Tm(i)||r.push(i);if(r.length>0)throw new X(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function jm(e,t){if(!Sm(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!cm(Ad,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Mm(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Mm(e,t[r],`${n}[${r}]`)):!Sm(e)||!Sm(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Mm(r,t[e],i):Tm(e)?[]:[i]})}function Nm(e){if(!um(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Am(Cm(e.requestedSchema),t),r=cm(jd.shape.requestedSchema,n);if(!r.success)throw new X(Y.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${jm(n,r.error.message)}`);let i=Mm(n,r.data);if(i.length>0)throw new X(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new X(Y.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Pm(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Pm,{elicit(e){try{return{method:`elicitation/create`,params:Nm(e)}}catch(e){throw e instanceof X?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Fm=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Im={IdJagTokenExchangeResponseSchema:yf,OAuthClientInformationFullSchema:wf,OAuthClientInformationSchema:Cf,OAuthClientMetadataSchema:Sf,OAuthClientRegistrationErrorSchema:Tf,OAuthErrorResponseSchema:bf,OAuthMetadataSchema:hf,OAuthProtectedResourceMetadataSchema:mf,OAuthTokenRevocationRequestSchema:Ef,OAuthTokensSchema:vf,OpenIdProviderDiscoveryMetadataSchema:_f,OpenIdProviderMetadataSchema:gf},Lm={},Rm={};function zm(e,t){let n=e.slice(0,-6);Lm[n]=t,Rm[n]=e=>t.safeParse(e).success}for(let e of Fm)zm(e,rm[e]);for(let[e,t]of Object.entries(Im))zm(e,t);Object.freeze(Lm),Object.freeze(Rm);function Bm(e){switch(e){case`initialize`:case`notifications/initialized`:return Qp(void 0);case`server/discover`:return Qp(Zp);default:return}}var Vm=[al,ol,cl,ul],Hm=[`inputResponses`,`requestState`];function Um(e,t){let n=e.params;if(!Jm(n))return{message:e,lifted:{}};let r=n._meta,i=Jm(r)?Vm.filter(e=>e in r):[],a=t===`request`?Hm.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Jm(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function Wm(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function Gm(e){return()=>e}var Km=Gm(void 0),qm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??rl,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new J(q.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId&&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),new J(q.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){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{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),om(e)||sm(e)?this._onresponse(e):im(e)?this._onrequest(e,t):am(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new J(q.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=Um(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=$p(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(tm(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=Um(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=$p(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(Y.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(em(n.method)&&!i.hasRequestMethod(n.method)){o(Y.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(Y.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(Y.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:Xm(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?Km:Gm(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),um(t))return u(e,t,n);let i=Wm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(Y.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:Y.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.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._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),om(e)?n(e):n(X.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),um(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=Wm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return Qp(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Bm(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(em(t)&&!e.hasRequestMethod(t))throw new J(q.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof J?e:new J(q.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let ee={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),ee.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let g=this._envelopeOutbound(ee),te=!1,ne=e=>{te||(this._progressHandlers.delete(h),m===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof J?e:new J(q.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(te=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(Zm(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;gm(n,o).then(e=>{e.success?d(e.data):f(new J(q.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>ne(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let re=r?.timeout??6e4;this._setupTimeout(h,re,r?.maxTotalTimeout,()=>ne(new J(q.RequestTimeout,`Request timed out`,{timeout:re})),r?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new J(q.NotConnected,`Not connected`);if(tm(t.method)&&!e.hasNotificationMethod(t.method))throw new J(q.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!n?.relatedRequestId){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!em(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new X(Y.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await gm(t.params,{...r.params});if(!a.success)throw new X(Y.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}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,n){if(typeof t==`function`){if(!tm(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new X(Y.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await gm(t.params,{...r.params});if(!i.success)throw new X(Y.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Jm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ym(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xm(e){let t={},n=[];if(!Ym(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!Ym(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function Zm(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}t((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);var Qm=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,$m=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,eh=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,th=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,nh=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,rh=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ih=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ah=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,oh=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,sh=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ch=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function lh(e){return e.test.bind(e)}uh.bind(void 0,!1),lh(eh),lh(th),lh(nh),lh($m),lh(sh),lh(ch),lh(rh),lh(ih),lh(ah),lh(oh);function uh(e,t){let n=t.match(Qm);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var dh=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e){super(e),this.name=new.target.name,Of(this,new.target)}};(class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Of(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Of(this,new.target)}};var fh=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},ph=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},mh=new Set;function hh(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;mh.has(o)||(mh.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},gh(t)):e=>s({method:a,params:e})]}function gh(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var _h=`2026-01-26`,vh=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=Dl.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},yh=L([B(`light`),B(`dark`)]).describe(`Color theme preference for the host environment.`),bh=L([B(`inline`),B(`fullscreen`),B(`pip`)]).describe(`Display mode for UI presentation.`),xh=R(L([B(`--color-background-primary`),B(`--color-background-secondary`),B(`--color-background-tertiary`),B(`--color-background-inverse`),B(`--color-background-ghost`),B(`--color-background-info`),B(`--color-background-danger`),B(`--color-background-success`),B(`--color-background-warning`),B(`--color-background-disabled`),B(`--color-text-primary`),B(`--color-text-secondary`),B(`--color-text-tertiary`),B(`--color-text-inverse`),B(`--color-text-ghost`),B(`--color-text-info`),B(`--color-text-danger`),B(`--color-text-success`),B(`--color-text-warning`),B(`--color-text-disabled`),B(`--color-border-primary`),B(`--color-border-secondary`),B(`--color-border-tertiary`),B(`--color-border-inverse`),B(`--color-border-ghost`),B(`--color-border-info`),B(`--color-border-danger`),B(`--color-border-success`),B(`--color-border-warning`),B(`--color-border-disabled`),B(`--color-ring-primary`),B(`--color-ring-secondary`),B(`--color-ring-inverse`),B(`--color-ring-info`),B(`--color-ring-danger`),B(`--color-ring-success`),B(`--color-ring-warning`),B(`--font-sans`),B(`--font-mono`),B(`--font-weight-normal`),B(`--font-weight-medium`),B(`--font-weight-semibold`),B(`--font-weight-bold`),B(`--font-text-xs-size`),B(`--font-text-sm-size`),B(`--font-text-md-size`),B(`--font-text-lg-size`),B(`--font-heading-xs-size`),B(`--font-heading-sm-size`),B(`--font-heading-md-size`),B(`--font-heading-lg-size`),B(`--font-heading-xl-size`),B(`--font-heading-2xl-size`),B(`--font-heading-3xl-size`),B(`--font-text-xs-line-height`),B(`--font-text-sm-line-height`),B(`--font-text-md-line-height`),B(`--font-text-lg-line-height`),B(`--font-heading-xs-line-height`),B(`--font-heading-sm-line-height`),B(`--font-heading-md-line-height`),B(`--font-heading-lg-line-height`),B(`--font-heading-xl-line-height`),B(`--font-heading-2xl-line-height`),B(`--font-heading-3xl-line-height`),B(`--border-radius-xs`),B(`--border-radius-sm`),B(`--border-radius-md`),B(`--border-radius-lg`),B(`--border-radius-xl`),B(`--border-radius-full`),B(`--border-width-regular`),B(`--shadow-hairline`),B(`--shadow-sm`),B(`--shadow-md`),B(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
|
|
62
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Ja(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Ja(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Ya=new Set([`type`,`properties`,`required`,`additionalProperties`]),Xa=[`oneOf`,`anyOf`];function Za(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Qa(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ya.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Za(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}h(n,r,e.length===1?e[0]:Qa(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Za(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function $a(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ya)if(t in e)return;let n=t.filter(e=>Xa.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Qa(t);else{let e=n[0],i=Xa.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>Qa([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Wa(e,r))}function eo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Wa(i,s),Wa(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Ja(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])$a(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Wa(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,h(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ro(t,`input`,e.processors),output:ro(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function to(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return to(r.element,n);if(r.type===`set`)return to(r.valueType,n);if(r.type===`lazy`)return to(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return to(r.innerType,n);if(r.type===`intersection`)return to(r.left,n)||to(r.right,n);if(r.type===`record`||r.type===`map`)return to(r.keyType,n)||to(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:to(r.in,n)||to(r.out,n);if(r.type===`object`){for(let e in r.shape)if(to(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(to(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(to(e,n))return!0;return!!(r.rest&&to(r.rest,n))}return!1}var no=(e,t={})=>n=>{let r=Ga({...n,processors:t});return D(e,r),qa(r,e),eo(r,e)},ro=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ga({...i??{},target:a,io:t,processors:n});return D(e,o),qa(o,e),eo(o,e)},io=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},ao=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},oo=(e,t)=>{io(e,`minimum`,t),ao(e,`maximum`,t)},so=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},co=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},lo=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},uo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},fo=(e,t)=>io(e,`minimum`,t.minimum),po=(e,t)=>ao(e,`maximum`,t.maximum),mo=e=>(t,n)=>{uo(t,n.format);let[r,i]=e[n.format];io(t,`minimum`,r),ao(t,`maximum`,i)},ho={greater_than:(e,t)=>io(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>ao(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>so(e,t.value),number_format:mo(ge),bigint_format:mo(_e),min_length:fo,max_length:po,length_equals:(e,t)=>oo(e,t.length),min_size:fo,max_size:po,size_equals:(e,t)=>oo(e,t.size),string_format:(e,t)=>{uo(e,t.format),t.pattern&&co(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>lo(e,t.mime)};function go(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)ho[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&io(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&io(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&ao(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&ao(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&so(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&lo(t,i.mime);for(let e of i.patterns??[])co(t,e);return t}var _o={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},vo=new Map([[mr,Xt],[gr,Zt]]),yo=e=>vo.get(e)??e,bo=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=go(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=_o[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(yo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},xo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=go(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):E(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},So=(e,t,n,r)=>{n.type=`boolean`},Co=(e,t,n,r)=>{E(e,t,n,r,`BigInt cannot be represented in JSON Schema`)},wo=(e,t,n,r)=>{E(e,t,n,r,`Symbols cannot be represented in JSON Schema`)},To=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Eo=(e,t,n,r)=>{E(e,t,n,r,`Undefined cannot be represented in JSON Schema`)},Do=(e,t,n,r)=>{E(e,t,n,r,`Void cannot be represented in JSON Schema`)},Oo=(e,t,n,r)=>{n.not={}},ko=(e,t,n,r)=>{},Ao=(e,t,n,r)=>{},jo=(e,t,n,r)=>{E(e,t,n,r,`Date cannot be represented in JSON Schema`)},Mo=(e,t,n,r)=>{let i=e._zod.def,o=a(i.entries);if(o.length===0){n.not={};return}o.every(e=>typeof e==`number`)&&(n.type=`number`),o.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=o},No=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(E(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(E(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Po=(e,t,n,r)=>{E(e,t,n,r,`NaN cannot be represented in JSON Schema`)},Fo=(e,t,n,r)=>{let i=n,a=e._zod.pattern;if(!a)throw Error(`Pattern not found in template literal`);i.type=`string`,i.pattern=a.source},Io=(e,t,n,r)=>{let i=n;i.type=`string`,i.format=`binary`,i.contentEncoding=`binary`;let{minimum:a,maximum:o,mime:s}=go(e);a!==void 0&&(i.minLength=a),o!==void 0&&(i.maxLength=o),s&&(s.length===0?i.not={}:s.length===1?i.contentMediaType=s[0]:i.anyOf=s.map(e=>({contentMediaType:e})))},Lo=(e,t,n,r)=>{n.type=`boolean`},Ro=(e,t,n,r)=>{E(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},zo=(e,t,n,r)=>{E(e,t,n,r,`Function types cannot be represented in JSON Schema`)},Bo=(e,t,n,r)=>{E(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Vo=(e,t,n,r)=>{E(e,t,n,r,`Map cannot be represented in JSON Schema`)},Ho=(e,t,n,r)=>{E(e,t,n,r,`Set cannot be represented in JSON Schema`)},Uo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=go(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=D(a.element,t,{...r,path:[...r.path,`items`]})};function Wo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Wo(t.out):t.type===`catch`?Wo(t.innerType):e._zod.optin}var Go=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&E(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)h(i.properties,e,D(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Wo(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=D(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ko=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>D(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},qo=(e,t,n,r)=>{let i=e._zod.def,a=D(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=D(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Jo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`array`;let o=t.target===`draft-2020-12`?`prefixItems`:`items`,s=t.target===`draft-2020-12`||t.target===`openapi-3.0`?`items`:`additionalItems`,c=a.items.map((e,n)=>D(e,t,{...r,path:[...r.path,o,n]})),l=a.rest?D(a.rest,t,{...r,path:[...r.path,s,...t.target===`openapi-3.0`?[a.items.length]:[]]}):null,u=a.items.length;for(;u>0;){let e=a.items[u-1];if(!(t.io===`input`?Wo(e)!==void 0:e._zod.optout===`optional`))break;u--}let d=a.items.length,f=!a.rest;t.target===`draft-2020-12`?(i.prefixItems=c,f?i.items=!1:l&&(i.items=l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):t.target===`openapi-3.0`?(i.items={anyOf:c},l&&i.items.anyOf.push(l),u>0&&(i.minItems=u),f&&(i.maxItems=d)):(i.items=c,f?i.additionalItems=!1:l&&(i.additionalItems=l),u>0&&(i.minItems=u),f&&(i.maxItems=d));let{minimum:p,maximum:m}=go(e);typeof p==`number`&&(i.minItems=p),typeof m==`number`&&(i.maxItems=m)};function Yo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Yo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Yo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?C:cn).source),p):p}var Xo=new WeakMap;function Zo(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Xo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Yo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Qo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=go(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=D(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)h(i.patternProperties,yo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=D(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Xo.get(t);n||(n=[],Xo.set(t,n),t.deferred.push(()=>Zo(t))),n.push(e)}i.additionalProperties=D(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Wo(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},$o=(e,t,n,r)=>{let i=e._zod.def,a=D(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},es=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ts=Symbol();function ns(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(E(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ts):JSON.parse(o)}var rs=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=ns(i.defaultValue,e,t,n,r);o!==ts&&(n.default=o)},is=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=ns(i.defaultValue,e,t,n,r);o!==ts&&(n._prefault=o)},as=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{E(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},os=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;D(o,t,r);let s=t.seen.get(e);s.ref=o},ss=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},cs=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ls=(e,t,n,r)=>{let i=e._zod.def;D(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},us=(e,t,n,r)=>{let i=e._zod.innerType;D(i,t,r);let a=t.seen.get(e);a.ref=i},ds={string:bo,number:xo,boolean:So,bigint:Co,symbol:wo,null:To,undefined:Eo,void:Do,never:Oo,any:ko,unknown:Ao,date:jo,enum:Mo,literal:No,nan:Po,template_literal:Fo,file:Io,success:Lo,custom:Ro,function:zo,transform:Bo,map:Vo,set:Ho,array:Uo,object:Go,union:Ko,intersection:qo,tuple:Jo,record:Qo,nullable:$o,nonoptional:es,default:rs,prefault:is,catch:as,pipe:os,readonly:ss,promise:cs,optional:ls,lazy:us};function fs(e,t){if(`_idmap`in e){let n=e,r=Ga({...t,processors:ds}),i={};for(let e of n._idmap.entries()){let[t,n]=e;D(n,r)}let a={};r.external={registry:n,uri:t?.uri,defs:i};for(let e of n._idmap.entries()){let[t,n]=e;qa(r,n),h(a,t,eo(r,n))}return Object.keys(i).length>0&&(a.__shared={[r.target===`draft-2020-12`?`$defs`:`definitions`]:i}),{schemas:a}}let n=Ga({...t,processors:ds});return D(e,n),qa(n,e),eo(n,e)}var ps=new WeakSet([Object.prototype,Error.prototype]);function ms(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var hs=S(`ZodError`,(e,t)=>{ut.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ps.has(n)||(ps.add(n),ms(n,`format`,e=>t=>pt(e,t)),ms(n,`flatten`,e=>t=>ft(e,t)),ms(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,s,2)}),ms(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,s,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),gs=ht(hs),_s=gt(hs),vs=_t(hs),ys=yt(hs),bs=Tt(hs),xs=Et(hs),Ss=Dt(hs),Cs=Ot(hs),ws=kt(hs),Ts=At(hs),Es=jt(hs),Ds=Mt(hs);function Os(){nt.localeError||rt(Mi())}function ks(){nt.memoizer||rt({memoizer:ki()})}var O=S(`ZodType`,(e,t)=>(Os(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(_(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return v(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Yc(e,t))},superRefine(e,t){return this.check(Xc(e,t))},overwrite(e){return this.check(Pa(e))},optional(){return V(this)},exactOptional(){return Ac(this)},nullable(){return Mc(this)},nullish(){return V(Mc(this))},nonoptional(e){return Rc(this,e)},array(){return P(this)},or(e){return L([this,e])},and(e){return Sc(this,e)},transform(e){return Hc(this,Dc(e))},default(e){return Pc(this,e)},prefault(e){return Ic(this,e)},catch(e){return Bc(this,e)},pipe(e){return Hc(this,e)},readonly(){return Gc(this)},describe(e){let t=this.clone();return Ii.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ii.get(this);let t=this.clone();return Ii.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return ze(this,`~standard`,{...In(this),jsonSchema:{input:ro(this,`input`),output:ro(this,`output`)}})},set"~standard"(e){Re(this,`~standard`,e)},parse:function e(t,n){return gs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await _s(this,t,n,{callee:e})},safeParse(e,t){return vs(this,e,t)},async safeParseAsync(e,t){return ys(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Re(this,`spa`,e)},validate(e,t){return St(this,e,t)},validateAsync(e,t){return wt(this,e,t)},encode:function e(t,n){return bs(this,t,n,{callee:e})},decode:function e(t,n){return xs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Ss(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Cs(this,t,n,{callee:e})},safeEncode(e,t){return ws(this,e,t)},safeDecode(e,t){return Ts(this,e,t)},async safeEncodeAsync(e,t){return Es(this,e,t)},async safeDecodeAsync(e,t){return Ds(this,e,t)},toJSONSchema(e){return no(this,{})(e)},get description(){return Ii.get(this)?.description},get _def(){return this._zod.def}}),As=S(`_ZodString`,(e,t)=>{Ln.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bo(e,t,n,r)},Be({format:e=>go(e).format??null,minLength:e=>go(e).minimum??null,maxLength:e=>go(e).maximum??null},{regex(...e){return this.check(Oa(...e))},includes(...e){return this.check(ja(...e))},startsWith(...e){return this.check(Ma(...e))},endsWith(...e){return this.check(Na(...e))},min(...e){return this.check(Ea(...e))},max(...e){return this.check(Ta(...e))},length(...e){return this.check(Da(...e))},nonempty(...e){return this.check(Ea(1,...e))},lowercase(e){return this.check(ka(e))},uppercase(e){return this.check(Aa(e))},trim(){return this.check(Ia())},normalize(...e){return this.check(Fa(...e))},toLowerCase(){return this.check(La())},toUpperCase(){return this.check(Ra())},slugify(){return this.check(za())}})),js=S(`ZodString`,(e,t)=>{Ln.init(e,t),As.init(e,t)},{email(e){return this.check(zi(Is,e))},url(e){return this.check(Gi(Bs,e))},jwt(e){return this.check(oa(nc,e))},emoji(e){return this.check(Ki(Hs,e))},guid(e){return this.check(Bi(Rs,e))},uuid(e){return this.check(Vi(zs,e))},uuidv4(e){return this.check(Hi(zs,e))},uuidv6(e){return this.check(Ui(zs,e))},uuidv7(e){return this.check(Wi(zs,e))},nanoid(e){return this.check(qi(Us,e))},cuid(e){return this.check(Ji(Ws,e))},cuid2(e){return this.check(Yi(Gs,e))},ulid(e){return this.check(Xi(Ks,e))},base64(e){return this.check(ra($s,e))},base64url(e){return this.check(ia(ec,e))},xid(e){return this.check(Zi(qs,e))},ksuid(e){return this.check(Qi(Js,e))},ipv4(e){return this.check($i(Ys,e))},ipv6(e){return this.check(ea(Xs,e))},cidrv4(e){return this.check(ta(Zs,e))},cidrv6(e){return this.check(na(Qs,e))},e164(e){return this.check(aa(tc,e))},datetime(e){return this.check(sa(Ms,e))},date(e){return this.check(ca(Ns,e))},time(e){return this.check(la(Ps,e))},duration(e){return this.check(ua(Fs,e))}});function k(e){return Ri(js,e)}var A=S(`ZodStringFormat`,(e,t)=>{T.init(e,t),As.init(e,t)}),Ms=S(`ZodISODateTime`,(e,t)=>{nr.init(e,t),A.init(e,t)}),Ns=S(`ZodISODate`,(e,t)=>{rr.init(e,t),A.init(e,t)}),Ps=S(`ZodISOTime`,(e,t)=>{ir.init(e,t),A.init(e,t)}),Fs=S(`ZodISODuration`,(e,t)=>{ar.init(e,t),A.init(e,t)}),Is=S(`ZodEmail`,(e,t)=>{Bn.init(e,t),A.init(e,t)});function Ls(e){return zi(Is,e)}var Rs=S(`ZodGUID`,(e,t)=>{Rn.init(e,t),A.init(e,t)}),zs=S(`ZodUUID`,(e,t)=>{zn.init(e,t),A.init(e,t)}),Bs=S(`ZodURL`,(e,t)=>{Jn.init(e,t),A.init(e,t)});function Vs(e){return Gi(Bs,e)}var Hs=S(`ZodEmoji`,(e,t)=>{Yn.init(e,t),A.init(e,t)}),Us=S(`ZodNanoID`,(e,t)=>{Xn.init(e,t),A.init(e,t)}),Ws=S(`ZodCUID`,(e,t)=>{Zn.init(e,t),A.init(e,t)}),Gs=S(`ZodCUID2`,(e,t)=>{Qn.init(e,t),A.init(e,t)}),Ks=S(`ZodULID`,(e,t)=>{$n.init(e,t),A.init(e,t)}),qs=S(`ZodXID`,(e,t)=>{er.init(e,t),A.init(e,t)}),Js=S(`ZodKSUID`,(e,t)=>{tr.init(e,t),A.init(e,t)}),Ys=S(`ZodIPv4`,(e,t)=>{or.init(e,t),A.init(e,t)}),Xs=S(`ZodIPv6`,(e,t)=>{lr.init(e,t),A.init(e,t)}),Zs=S(`ZodCIDRv4`,(e,t)=>{ur.init(e,t),A.init(e,t)}),Qs=S(`ZodCIDRv6`,(e,t)=>{fr.init(e,t),A.init(e,t)}),$s=S(`ZodBase64`,(e,t)=>{hr.init(e,t),A.init(e,t)}),ec=S(`ZodBase64URL`,(e,t)=>{vr.init(e,t),A.init(e,t)}),tc=S(`ZodE164`,(e,t)=>{yr.init(e,t),A.init(e,t)}),nc=S(`ZodJWT`,(e,t)=>{xr.init(e,t),A.init(e,t)}),rc=S(`ZodNumber`,(e,t)=>{Sr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),e.isFinite=!0},Be({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=go(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=go(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=go(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>go(e).format??null},{gt(e,t){return this.check(Sa(e,t))},gte(e,t){return this.check(Ca(e,t))},min(e,t){return this.check(Ca(e,t))},lt(e,t){return this.check(ba(e,t))},lte(e,t){return this.check(xa(e,t))},max(e,t){return this.check(xa(e,t))},int(e){return this.check(ac(e))},safe(e){return this.check(ac(e))},positive(e){return this.check(Sa(0,e))},nonnegative(e){return this.check(Ca(0,e))},negative(e){return this.check(ba(0,e))},nonpositive(e){return this.check(xa(0,e))},multipleOf(e,t){return this.check(wa(e,t))},step(e,t){return this.check(wa(e,t))},finite(){return this}}));function j(e){return da(rc,e)}var ic=S(`ZodNumberFormat`,(e,t)=>{Cr.init(e,t),rc.init(e,t)});function ac(e){return pa(ic,e)}var oc=S(`ZodBoolean`,(e,t)=>{wr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r)});function M(e){return ma(oc,e)}var sc=S(`ZodUndefined`,(e,t)=>{Tr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r)});function cc(e){return ha(sc,e)}var lc=S(`ZodNull`,(e,t)=>{Er.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>To(e,t,n,r)});function uc(e){return ga(lc,e)}var dc=S(`ZodAny`,(e,t)=>{Dr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function fc(){return _a(dc)}var pc=S(`ZodUnknown`,(e,t)=>{Or.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function N(){return va(pc)}var mc=S(`ZodNever`,(e,t)=>{kr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r)});function hc(e){return ya(mc,e)}var gc=S(`ZodArray`,(e,t)=>{ks(),jr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Ea(e,t))},nonempty(e){return this.check(Ea(1,e))},max(e,t){return this.check(Ta(e,t))},length(e,t){return this.check(Da(e,t))},unwrap(){return this.element}});function P(e,t){return Ba(gc,e,t)}var _c=S(`ZodObject`,(e,t)=>{ks(),Lr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),Ke(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(_(this._zod.def,{catchall:e}))},passthrough(){return this.clone(_(this._zod.def,{catchall:N()}))},loose(){return this.clone(_(this._zod.def,{catchall:N()}))},strict(){return this.clone(_(this._zod.def,{catchall:hc()}))},strip(){return this.clone(_(this._zod.def,{catchall:void 0}))},extend(e){return xe(this,e)},safeExtend(e){return Ce(this,e)},merge(e){return we(this,e)},pick(e){return ve(this,e)},omit(e){return be(this,e)},partial(...e){return Te(Oc,this,e[0])},exactPartial(...e){return Te(kc,this,e[0],`exactPartial`)},required(...e){return Ee(Lc,this,e[0])}});function F(e,t){return new _c({type:`object`,shape:e??{},...y(t)})}function I(e,t){return new _c({type:`object`,shape:e,catchall:N(),...y(t)})}var vc=S(`ZodUnion`,(e,t)=>{zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ko(e,t,n,r),e.options=t.options});function L(e,t){return new vc({type:`union`,options:e,...y(t)})}var yc=S(`ZodDiscriminatedUnion`,(e,t)=>{vc.init(e,t),Vr.init(e,t)});function bc(e,t,n){return new yc({type:`union`,options:t,discriminator:e,...y(n)})}var xc=S(`ZodIntersection`,(e,t)=>{Hr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qo(e,t,n,r)});function Sc(e,t){return new xc({type:`intersection`,left:e,right:t})}var Cc=S(`ZodRecord`,(e,t)=>{ks(),Gr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function R(e,t,n){return!t||!t._zod?new Cc({type:`record`,keyType:k(),valueType:e,...y(t)}):new Cc({type:`record`,keyType:e,valueType:t,...y(n)})}var wc=S(`ZodEnum`,(e,t)=>{Kr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new wc({...t,checks:[],...y(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new wc({...t,checks:[],...y(r),entries:i})}});function z(e,t){return new wc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...y(t)})}var Tc=S(`ZodLiteral`,(e,t)=>{qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function B(e,t){return new Tc({type:`literal`,values:Array.isArray(e)?e:[e],...y(t)})}var Ec=S(`ZodTransform`,(e,t)=>{ks(),Jr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new tt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Ie(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Ie(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Dc(e){return new Ec({type:`transform`,transform:e})}var Oc=S(`ZodOptional`,(e,t)=>{Xr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function V(e){return new Oc({type:`optional`,innerType:e})}var kc=S(`ZodExactOptional`,(e,t)=>{Zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ls(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ac(e){return new kc({type:`optional`,innerType:e})}var jc=S(`ZodNullable`,(e,t)=>{Qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mc(e){return new jc({type:`nullable`,innerType:e})}var Nc=S(`ZodDefault`,(e,t)=>{$r.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Pc(e,t){return new Nc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var Fc=S(`ZodPrefault`,(e,t)=>{ti.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>is(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ic(e,t){return new Fc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():de(t)}})}var Lc=S(`ZodNonOptional`,(e,t)=>{ni.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>es(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rc(e,t){return new Lc({type:`nonoptional`,innerType:e,...y(t)})}var zc=S(`ZodCatch`,(e,t)=>{ai.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>as(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Bc(e,t){return new zc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Je(t)})}var Vc=S(`ZodPipe`,(e,t)=>{oi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>os(e,t,n,r),e.in=t.in,e.out=t.out});function Hc(e,t){return new Vc({type:`pipe`,in:e,out:t})}var Uc=S(`ZodPreprocess`,(e,t)=>{Vc.init(e,t),ci.init(e,t)}),Wc=S(`ZodReadonly`,(e,t)=>{li.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ss(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gc(e){return new Wc({type:`readonly`,innerType:e})}var Kc=S(`ZodLazy`,(e,t)=>{di.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>us(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function qc(e){return new Kc({type:`lazy`,getter:e})}var Jc=S(`ZodCustom`,(e,t)=>{fi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r)});function Yc(e,t={}){return Va(Jc,e,t)}function Xc(e,t){return Ha(e,t)}function Zc(e,t){return new Uc({type:`pipe`,in:Dc(e),out:t})}var Qc={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},$c;$c||={};function el(e){return sa(Ms,e)}function tl(e){return ca(Ns,e)}function nl(e){return fa(rc,e)}var rl=[`2025-11-25`,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],il=`io.modelcontextprotocol/related-task`,al=`io.modelcontextprotocol/protocolVersion`,ol=`io.modelcontextprotocol/clientInfo`,sl=`io.modelcontextprotocol/serverInfo`,cl=`io.modelcontextprotocol/clientCapabilities`,ll=`io.modelcontextprotocol/subscriptionId`,ul=`io.modelcontextprotocol/logLevel`,dl=qc(()=>L([k(),j(),M(),uc(),R(k(),dl),P(dl)])),H=R(k(),dl),fl=P(dl),pl=L([k(),j().int()]),ml=k(),hl=F({ttl:j().optional()}),gl=F({taskId:k()}),_l=I({progressToken:pl.optional(),[il]:gl.optional()}),U=F({_meta:_l.optional()}),vl=U.extend({task:hl.optional()}),W=F({method:k(),params:U.loose().optional()}),yl=F({_meta:_l.optional()}),bl=F({method:k(),params:yl.loose().optional()}),xl=I({get[sl](){return Fl.optional().catch(void 0)}}),G=I({_meta:xl.optional()}),Sl=L([k(),j().int()]),Cl=F({jsonrpc:B(`2.0`),id:Sl,...W.shape}).strict(),wl=F({jsonrpc:B(`2.0`),...bl.shape}).strict(),Tl=F({jsonrpc:B(`2.0`),id:Sl,result:G}).strict(),El=F({jsonrpc:B(`2.0`),id:Sl.optional(),error:F({code:j().int(),message:k(),data:N().optional()})}).strict(),Dl=L([Cl,wl,Tl,El]),Ol=L([Tl,El]),kl=G.strict(),Al=yl.extend({requestId:Sl.optional(),reason:k().optional()}),jl=bl.extend({method:B(`notifications/cancelled`),params:Al}),Ml=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),Nl=F({icons:P(Ml).optional()}),Pl=F({name:k(),title:k().optional()}),Fl=Pl.extend({...Pl.shape,...Nl.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),Il=Zc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Sc(F({form:Sc(F({applyDefaults:M().optional()}),H).optional(),url:H.optional()}),H.optional())),Ll=I({list:H.optional(),cancel:H.optional(),requests:I({sampling:I({createMessage:H.optional()}).optional(),elicitation:I({create:H.optional()}).optional()}).optional()}),Rl=I({list:H.optional(),cancel:H.optional(),requests:I({tools:I({call:H.optional()}).optional()}).optional()}),zl=F({experimental:R(k(),H).optional(),sampling:F({context:H.optional(),tools:H.optional()}).optional(),elicitation:Il.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:Ll.optional(),extensions:R(k(),H).optional()}),Bl=U.extend({protocolVersion:k(),capabilities:zl,clientInfo:Fl}),Vl=W.extend({method:B(`initialize`),params:Bl}),Hl=F({experimental:R(k(),H).optional(),logging:H.optional(),completions:H.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:Rl.optional(),extensions:R(k(),H).optional()}),Ul=G.extend({protocolVersion:k(),capabilities:Hl,serverInfo:Fl,instructions:k().optional()}),Wl=bl.extend({method:B(`notifications/initialized`),params:yl.optional()}),Gl=W.extend({method:B(`server/discover`),params:U.optional()}),Kl=G.extend({supportedVersions:P(k()),capabilities:Hl,instructions:k().optional()}),ql=W.extend({method:B(`ping`),params:U.optional()}),Jl=F({progress:j(),total:V(j()),message:V(k())}),Yl=F({...yl.shape,...Jl.shape,progressToken:pl}),Xl=bl.extend({method:B(`notifications/progress`),params:Yl}),Zl=U.extend({cursor:ml.optional()}),Ql=W.extend({params:Zl.optional()}),$l=G.extend({nextCursor:ml.optional()}),eu=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),tu=eu.extend({text:k()}),nu=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),ru=eu.extend({blob:nu}),iu=z([`user`,`assistant`]),au=F({audience:P(iu).optional(),priority:j().min(0).max(1).optional(),lastModified:el({offset:!0}).optional()}),ou=F({...Pl.shape,...Nl.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:au.optional(),_meta:V(I({}))}),su=F({...Pl.shape,...Nl.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:au.optional(),_meta:V(I({}))}),cu=Ql.extend({method:B(`resources/list`)}),lu=$l.extend({resources:P(ou)}),uu=Ql.extend({method:B(`resources/templates/list`)}),du=$l.extend({resourceTemplates:P(su)}),fu=U.extend({uri:k()}),pu=fu,mu=W.extend({method:B(`resources/read`),params:pu}),hu=G.extend({contents:P(L([tu,ru]))}),gu=bl.extend({method:B(`notifications/resources/list_changed`),params:yl.optional()}),_u=fu,vu=W.extend({method:B(`resources/subscribe`),params:_u}),yu=fu,bu=W.extend({method:B(`resources/unsubscribe`),params:yu}),xu=F({toolsListChanged:M().optional(),promptsListChanged:M().optional(),resourcesListChanged:M().optional(),resourceSubscriptions:P(k()).optional()}),Su=U.extend({notifications:xu}),Cu=W.extend({method:B(`subscriptions/listen`),params:Su}),wu=yl.extend({notifications:xu}),Tu=bl.extend({method:B(`notifications/subscriptions/acknowledged`),params:wu}),Eu=xl.extend({[ll]:Sl}),Du=G.extend({_meta:Eu}),Ou=yl.extend({uri:k()}),ku=bl.extend({method:B(`notifications/resources/updated`),params:Ou}),Au=F({name:k(),description:V(k()),required:V(M())}),ju=F({...Pl.shape,...Nl.shape,description:V(k()),arguments:V(P(Au)),_meta:V(I({}))}),Mu=Ql.extend({method:B(`prompts/list`)}),Nu=$l.extend({prompts:P(ju)}),Pu=U.extend({name:k(),arguments:R(k(),k()).optional()}),Fu=W.extend({method:B(`prompts/get`),params:Pu}),Iu=F({type:B(`text`),text:k(),annotations:au.optional(),_meta:R(k(),N()).optional()}),Lu=F({type:B(`image`),data:nu,mimeType:k(),annotations:au.optional(),_meta:R(k(),N()).optional()}),Ru=F({type:B(`audio`),data:nu,mimeType:k(),annotations:au.optional(),_meta:R(k(),N()).optional()}),zu=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Bu=F({type:B(`resource`),resource:L([tu,ru]),annotations:au.optional(),_meta:R(k(),N()).optional()}),Vu=ou.extend({type:B(`resource_link`)}),Hu=L([Iu,Lu,Ru,Vu,Bu]),Uu=F({role:iu,content:Hu}),Wu=G.extend({description:k().optional(),messages:P(Uu)}),Gu=bl.extend({method:B(`notifications/prompts/list_changed`),params:yl.optional()}),Ku=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),qu=F({taskSupport:z([`required`,`optional`,`forbidden`]).optional()}),Ju=F({...Pl.shape,...Nl.shape,description:k().optional(),inputSchema:F({type:B(`object`),properties:R(k(),dl).optional(),required:P(k()).optional()}).catchall(N()),outputSchema:I({$schema:k().optional()}).optional(),annotations:Ku.optional(),execution:qu.optional(),_meta:R(k(),N()).optional()}),Yu=Ql.extend({method:B(`tools/list`)}),Xu=$l.extend({tools:P(Ju)}),Zu=G.extend({content:P(Hu).default([]),structuredContent:N().optional(),isError:M().optional()}),Qu=Zu.or(G.extend({toolResult:N()})),$u=vl.extend({name:k(),arguments:R(k(),N()).optional()}),ed=W.extend({method:B(`tools/call`),params:$u}),td=bl.extend({method:B(`notifications/tools/list_changed`),params:yl.optional()}),nd=F({autoRefresh:M().default(!0),debounceMs:j().int().nonnegative().default(300)}),rd=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),id=U.extend({level:rd}),ad=W.extend({method:B(`logging/setLevel`),params:id}),od=yl.extend({level:rd,logger:k().optional(),data:N()}),sd=bl.extend({method:B(`notifications/message`),params:od}),cd=F({name:k().optional()}),ld=F({hints:P(cd).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),ud=F({mode:z([`auto`,`required`,`none`]).optional()}),dd=F({type:B(`tool_result`),toolUseId:k().describe(`The unique identifier for the corresponding tool call.`),content:P(Hu),structuredContent:N().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),fd=bc(`type`,[Iu,Lu,Ru]),pd=bc(`type`,[Iu,Lu,Ru,zu,dd]),md=F({role:iu,content:L([pd,P(pd)]),_meta:R(k(),N()).optional()}),hd=vl.extend({messages:P(md),modelPreferences:ld.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:H.optional(),tools:P(Ju).optional(),toolChoice:ud.optional()}),gd=W.extend({method:B(`sampling/createMessage`),params:hd}),_d=G.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`]).or(k())),role:iu,content:fd}),vd=G.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(k())),role:iu,content:L([pd,P(pd)])}),yd=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),bd=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),xd=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Sd=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Cd=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),wd=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),Td=L([Sd,Cd]),Ed=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Dd=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),Od=L([Ed,Dd]),kd=L([wd,Td,Od]),Ad=L([kd,yd,bd,xd]),jd=vl.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),Ad),required:P(k()).optional()}).catchall(N())}),Md=vl.extend({mode:B(`url`),message:k(),elicitationId:k(),url:k().url()}),Nd=L([jd,Md]),Pd=W.extend({method:B(`elicitation/create`),params:Nd}),Fd=yl.extend({elicitationId:k()}),Id=bl.extend({method:B(`notifications/elicitation/complete`),params:Fd}),Ld=G.extend({action:z([`accept`,`decline`,`cancel`]),content:Zc(e=>e===null?void 0:e,R(k(),L([k(),j(),M(),P(k())])).optional())}),Rd=F({type:B(`ref/resource`),uri:k()}),zd=F({type:B(`ref/prompt`),name:k()}),Bd=U.extend({ref:L([zd,Rd]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()}),Vd=W.extend({method:B(`completion/complete`),params:Bd}),Hd=G.extend({completion:I({values:P(k()).max(100),total:V(j().int()),hasMore:V(M())})}),Ud=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Wd=W.extend({method:B(`roots/list`),params:U.optional()}),Gd=G.extend({roots:P(Ud)}),Kd=bl.extend({method:B(`notifications/roots/list_changed`),params:yl.optional()}),qd=I({ttl:j().optional(),pollInterval:j().optional()}),Jd=z([`working`,`input_required`,`completed`,`failed`,`cancelled`]),Yd=F({taskId:k(),status:Jd,ttl:L([j(),uc()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:V(j()),statusMessage:V(k())}),Xd=G.extend({task:Yd}),Zd=yl.merge(Yd),Qd=bl.extend({method:B(`notifications/tasks/status`),params:Zd}),$d=W.extend({method:B(`tasks/get`),params:U.extend({taskId:k()})}),ef=G.merge(Yd),tf=W.extend({method:B(`tasks/result`),params:U.extend({taskId:k()})}),nf=G.loose(),rf=Ql.extend({method:B(`tasks/list`)}),af=$l.extend({tasks:P(Yd)}),of=W.extend({method:B(`tasks/cancel`),params:U.extend({taskId:k()})}),sf=G.merge(Yd),cf=L([ql,Vl,Gl,Vd,ad,Fu,Mu,cu,uu,mu,vu,bu,Cu,ed,Yu]),lf=L([jl,Xl,Wl,Kd]),uf=L([kl,_d,vd,Ld,Gd]),df=L([ql,gd,Pd,Wd]),ff=L([jl,Xl,sd,ku,gu,td,Gu,Tu,Id]),pf=L([kl,Ul,Kl,Hd,Wu,Nu,lu,du,hu,Zu,Xu,Du]),K=Vs().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:Qc.custom,message:`URL must be parseable`,fatal:!0}),Xe}).refine(e=>{let t=new URL(e);return t.protocol!==`javascript:`&&t.protocol!==`data:`&&t.protocol!==`vbscript:`},{message:`URL cannot use javascript:, data:, or vbscript: scheme`}),mf=I({resource:k().url(),authorization_servers:P(K).optional(),jwks_uri:k().url().optional(),scopes_supported:P(k()).optional(),bearer_methods_supported:P(k()).optional(),resource_signing_alg_values_supported:P(k()).optional(),resource_name:k().optional(),resource_documentation:k().optional(),resource_policy_uri:k().url().optional(),resource_tos_uri:k().url().optional(),tls_client_certificate_bound_access_tokens:M().optional(),authorization_details_types_supported:P(k()).optional(),dpop_signing_alg_values_supported:P(k()).optional(),dpop_bound_access_tokens_required:M().optional()}),hf=I({issuer:k(),authorization_endpoint:K,token_endpoint:K,registration_endpoint:K.optional(),scopes_supported:P(k()).optional(),response_types_supported:P(k()),response_modes_supported:P(k()).optional(),grant_types_supported:P(k()).optional(),token_endpoint_auth_methods_supported:P(k()).optional(),token_endpoint_auth_signing_alg_values_supported:P(k()).optional(),service_documentation:K.optional(),revocation_endpoint:K.optional(),revocation_endpoint_auth_methods_supported:P(k()).optional(),revocation_endpoint_auth_signing_alg_values_supported:P(k()).optional(),introspection_endpoint:k().optional(),introspection_endpoint_auth_methods_supported:P(k()).optional(),introspection_endpoint_auth_signing_alg_values_supported:P(k()).optional(),code_challenge_methods_supported:P(k()).optional(),client_id_metadata_document_supported:M().optional(),authorization_response_iss_parameter_supported:M().optional().catch(void 0),dpop_signing_alg_values_supported:P(k()).optional()}),gf=I({issuer:k(),authorization_endpoint:K,token_endpoint:K,userinfo_endpoint:K.optional(),jwks_uri:K,registration_endpoint:K.optional(),scopes_supported:P(k()).optional(),response_types_supported:P(k()),response_modes_supported:P(k()).optional(),grant_types_supported:P(k()).optional(),acr_values_supported:P(k()).optional(),subject_types_supported:P(k()),id_token_signing_alg_values_supported:P(k()),id_token_encryption_alg_values_supported:P(k()).optional(),id_token_encryption_enc_values_supported:P(k()).optional(),userinfo_signing_alg_values_supported:P(k()).optional(),userinfo_encryption_alg_values_supported:P(k()).optional(),userinfo_encryption_enc_values_supported:P(k()).optional(),request_object_signing_alg_values_supported:P(k()).optional(),request_object_encryption_alg_values_supported:P(k()).optional(),request_object_encryption_enc_values_supported:P(k()).optional(),token_endpoint_auth_methods_supported:P(k()).optional(),token_endpoint_auth_signing_alg_values_supported:P(k()).optional(),display_values_supported:P(k()).optional(),claim_types_supported:P(k()).optional(),claims_supported:P(k()).optional(),service_documentation:k().optional(),claims_locales_supported:P(k()).optional(),ui_locales_supported:P(k()).optional(),claims_parameter_supported:M().optional(),request_parameter_supported:M().optional(),request_uri_parameter_supported:M().optional(),require_request_uri_registration:M().optional(),op_policy_uri:K.optional(),op_tos_uri:K.optional(),client_id_metadata_document_supported:M().optional(),authorization_response_iss_parameter_supported:M().optional().catch(void 0)}),_f=F({...gf.shape,...hf.pick({code_challenge_methods_supported:!0}).shape}),vf=F({access_token:k(),id_token:k().optional(),token_type:k(),expires_in:nl().optional(),scope:k().optional(),refresh_token:k().optional()}).strip(),yf=F({issued_token_type:B(`urn:ietf:params:oauth:token-type:id-jag`),access_token:k(),token_type:k().optional(),expires_in:j().optional(),scope:k().optional()}).strip(),bf=F({error:k(),error_description:k().optional(),error_uri:k().optional()}),xf=K.optional().or(B(``).transform(()=>void 0)),Sf=F({redirect_uris:P(K),token_endpoint_auth_method:k().optional(),grant_types:P(k()).optional(),response_types:P(k()).optional(),application_type:k().optional(),client_name:k().optional(),client_uri:K.optional(),logo_uri:xf,scope:k().optional(),contacts:P(k()).optional(),tos_uri:xf,policy_uri:k().optional(),jwks_uri:K.optional(),jwks:fc().optional(),software_id:k().optional(),software_version:k().optional(),software_statement:k().optional()}).strip(),Cf=F({client_id:k(),client_secret:k().optional(),client_id_issued_at:j().optional(),client_secret_expires_at:j().optional()}).strip(),wf=Sf.merge(Cf),Tf=F({error:k(),error_description:k().optional()}).strip(),Ef=F({token:k(),token_type_hint:k().optional()}).strip(),Df=Symbol.for(`mcp.sdk.errorBrands`);function Of(e,t){let n=new Set,r=t;for(;typeof r==`function`;){let e=r.mcpBrand;Object.prototype.hasOwnProperty.call(r,`mcpBrand`)&&typeof e==`string`&&n.add(e),r=Object.getPrototypeOf(r)}n.size!==0&&Object.defineProperty(e,Df,{value:n,enumerable:!1,configurable:!0})}function kf(e,t){try{if(typeof t==`object`&&t&&Object.prototype.hasOwnProperty.call(e,`mcpBrand`)&&typeof e.mcpBrand==`string`&&Object.prototype.hasOwnProperty.call(t,Df)){let n=t[Df];if(n&&typeof n.has==`function`&&n.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}(class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.errorUri=n,this.name=`OAuthError`,Of(this,new.target)}toResponseObject(){let e={error:this.code,error_description:this.message};return this.errorUri&&(e.error_uri=this.errorUri),e}static fromResponse(t){return new e(t.error,t.error_description??t.error,t.error_uri)}});var q=function(e){return e.NotConnected=`NOT_CONNECTED`,e.AlreadyConnected=`ALREADY_CONNECTED`,e.NotInitialized=`NOT_INITIALIZED`,e.CapabilityNotSupported=`CAPABILITY_NOT_SUPPORTED`,e.RequestTimeout=`REQUEST_TIMEOUT`,e.ConnectionClosed=`CONNECTION_CLOSED`,e.SendFailed=`SEND_FAILED`,e.InvalidResult=`INVALID_RESULT`,e.UnsupportedResultType=`UNSUPPORTED_RESULT_TYPE`,e.InputRequiredRoundsExceeded=`INPUT_REQUIRED_ROUNDS_EXCEEDED`,e.ListPaginationExceeded=`LIST_PAGINATION_EXCEEDED`,e.MethodNotSupportedByProtocolVersion=`METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION`,e.EraNegotiationFailed=`ERA_NEGOTIATION_FAILED`,e.ClientHttpNotImplemented=`CLIENT_HTTP_NOT_IMPLEMENTED`,e.ClientHttpAuthentication=`CLIENT_HTTP_AUTHENTICATION`,e.ClientHttpForbidden=`CLIENT_HTTP_FORBIDDEN`,e.ClientHttpUnexpectedContent=`CLIENT_HTTP_UNEXPECTED_CONTENT`,e.ClientHttpFailedToOpenStream=`CLIENT_HTTP_FAILED_TO_OPEN_STREAM`,e.ClientHttpFailedToTerminateSession=`CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION`,e}({}),J=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n,r){super(t,r),this.code=e,this.data=n,this.name=`SdkError`,Of(this,new.target)}};(class extends J{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SdkHttpError`})}constructor(e,t,n,r){super(e,t,n,r),this.name=`SdkHttpError`}get status(){return this.data.status}get statusText(){return this.data.statusText}});var Af=`2026-07-28`;function jf(e){return e>=Af}function Mf(e){let t=e.structuredContent;return t===void 0||typeof t==`object`&&t&&!Array.isArray(t)||(e.content?.some(e=>e.type===`text`)??!1)?e:{...e,content:[...e.content??[],{type:`text`,text:JSON.stringify(t)}]}}var Nf=[`task`,`inputRequests`,`requestState`];function Pf(e){return typeof e!=`object`||!e||Array.isArray(e)||e.content!==void 0||Nf.some(t=>t in e)?e:{...e,content:[]}}function Ff(){let e=qc(()=>L([k(),j(),M(),uc(),R(k(),e),P(e)])),t=R(k(),e),n=L([k(),j().int()]),r=k(),i=F({ttl:j().optional()}),a=F({taskId:k()}),o=I({progressToken:n.optional(),"io.modelcontextprotocol/related-task":a.optional()}),s=F({_meta:o.optional()}),c=s.extend({task:i.optional()}),l=F({method:k(),params:s.loose().optional()}),u=F({_meta:o.optional()}),d=F({method:k(),params:u.loose().optional()}),f=I({_meta:o.optional()}),p=L([k(),j().int()]),m=f.strict(),h=u.extend({requestId:p.optional(),reason:k().optional()}),ee=d.extend({method:B(`notifications/cancelled`),params:h}),g=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),te=F({icons:P(g).optional()}),ne=F({name:k(),title:k().optional()}),re=ne.extend({...ne.shape,...te.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),ie=Zc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Sc(F({form:Sc(F({applyDefaults:M().optional()}),t).optional(),url:t.optional()}),t.optional())),_=I({list:t.optional(),cancel:t.optional(),requests:I({sampling:I({createMessage:t.optional()}).optional(),elicitation:I({create:t.optional()}).optional()}).optional()}),ae=I({list:t.optional(),cancel:t.optional(),requests:I({tools:I({call:t.optional()}).optional()}).optional()}),oe=F({experimental:R(k(),t).optional(),sampling:F({context:t.optional(),tools:t.optional()}).optional(),elicitation:ie.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:_.optional(),extensions:R(k(),t).optional()}),se=s.extend({protocolVersion:k(),capabilities:oe,clientInfo:re}),ce=l.extend({method:B(`initialize`),params:se}),le=F({experimental:R(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:ae.optional(),extensions:R(k(),t).optional()}),ue=f.extend({protocolVersion:k(),capabilities:le,serverInfo:re,instructions:k().optional()}),de=d.extend({method:B(`notifications/initialized`),params:u.optional()}),fe=l.extend({method:B(`ping`),params:s.optional()}),pe=F({progress:j(),total:V(j()),message:V(k())}),v=F({...u.shape,...pe.shape,progressToken:n}),y=d.extend({method:B(`notifications/progress`),params:v}),me=s.extend({cursor:r.optional()}),he=l.extend({params:me.optional()}),ge=f.extend({nextCursor:r.optional()}),_e=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),ve=_e.extend({text:k()}),ye=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),be=_e.extend({blob:ye}),xe=z([`user`,`assistant`]),Se=F({audience:P(xe).optional(),priority:j().min(0).max(1).optional(),lastModified:el({offset:!0}).optional()}),Ce=F({...ne.shape,...te.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:Se.optional(),_meta:V(I({}))}),we=F({...ne.shape,...te.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:Se.optional(),_meta:V(I({}))}),Te=he.extend({method:B(`resources/list`)}),Ee=ge.extend({resources:P(Ce)}),b=he.extend({method:B(`resources/templates/list`)}),De=ge.extend({resourceTemplates:P(we)}),Oe=s.extend({uri:k()}),ke=Oe,Ae=l.extend({method:B(`resources/read`),params:ke}),je=f.extend({contents:P(L([ve,be]))}),Me=d.extend({method:B(`notifications/resources/list_changed`),params:u.optional()}),Ne=Oe,Pe=l.extend({method:B(`resources/subscribe`),params:Ne}),Fe=Oe,Ie=l.extend({method:B(`resources/unsubscribe`),params:Fe}),Le=u.extend({uri:k()}),Re=d.extend({method:B(`notifications/resources/updated`),params:Le}),ze=F({name:k(),description:V(k()),required:V(M())}),Be=F({...ne.shape,...te.shape,description:V(k()),arguments:V(P(ze)),_meta:V(I({}))}),Ve=he.extend({method:B(`prompts/list`)}),He=ge.extend({prompts:P(Be)}),Ue=s.extend({name:k(),arguments:R(k(),k()).optional()}),We=l.extend({method:B(`prompts/get`),params:Ue}),Ge=F({type:B(`text`),text:k(),annotations:Se.optional(),_meta:R(k(),N()).optional()}),x=F({type:B(`image`),data:ye,mimeType:k(),annotations:Se.optional(),_meta:R(k(),N()).optional()}),Ke=F({type:B(`audio`),data:ye,mimeType:k(),annotations:Se.optional(),_meta:R(k(),N()).optional()}),qe=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Je=F({type:B(`resource`),resource:L([ve,be]),annotations:Se.optional(),_meta:R(k(),N()).optional()}),Ye=Ce.extend({type:B(`resource_link`)}),Xe=L([Ge,x,Ke,Ye,Je]),Ze=F({role:xe,content:Xe}),Qe=f.extend({description:k().optional(),messages:P(Ze)}),$e=d.extend({method:B(`notifications/prompts/list_changed`),params:u.optional()}),S=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),et=F({taskSupport:z([`required`,`optional`,`forbidden`]).optional()}),tt=F({...ne.shape,...te.shape,description:k().optional(),inputSchema:F({type:B(`object`),properties:R(k(),e).optional(),required:P(k()).optional()}).catchall(N()),outputSchema:F({type:B(`object`),properties:R(k(),e).optional(),required:P(k()).optional()}).catchall(N()).optional(),annotations:S.optional(),execution:et.optional(),_meta:R(k(),N()).optional()}),nt=he.extend({method:B(`tools/list`)}),rt=ge.extend({tools:P(tt)}),it=f.extend({content:P(Xe),structuredContent:R(k(),N()).optional(),isError:M().optional()}),at=c.extend({name:k(),arguments:R(k(),N()).optional()}),ot=l.extend({method:B(`tools/call`),params:at}),st=d.extend({method:B(`notifications/tools/list_changed`),params:u.optional()}),ct=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),lt=s.extend({level:ct}),ut=l.extend({method:B(`logging/setLevel`),params:lt}),dt=u.extend({level:ct,logger:k().optional(),data:N()}),ft=d.extend({method:B(`notifications/message`),params:dt}),pt=F({name:k().optional()}),mt=F({hints:P(pt).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),ht=F({mode:z([`auto`,`required`,`none`]).optional()}),gt=F({type:B(`tool_result`),toolUseId:k().describe(`The unique identifier for the corresponding tool call.`),content:P(Xe),structuredContent:F({}).loose().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),_t=bc(`type`,[Ge,x,Ke]),vt=bc(`type`,[Ge,x,Ke,qe,gt]),yt=F({role:xe,content:L([vt,P(vt)]),_meta:R(k(),N()).optional()}),bt=c.extend({messages:P(yt),modelPreferences:mt.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:t.optional(),tools:P(tt).optional(),toolChoice:ht.optional()}),xt=l.extend({method:B(`sampling/createMessage`),params:bt}),St=f.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`]).or(k())),role:xe,content:_t}),Ct=f.extend({model:k(),stopReason:V(z([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(k())),role:xe,content:L([vt,P(vt)])}),wt=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),Tt=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Et=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Dt=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Ot=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),kt=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),At=L([Dt,Ot]),jt=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Mt=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),Nt=L([jt,Mt]),Pt=L([kt,At,Nt]),Ft=L([Pt,wt,Tt,Et]),It=c.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),Ft),required:P(k()).optional()}).catchall(N())}),Lt=c.extend({mode:B(`url`),message:k(),elicitationId:k(),url:k().url()}),Rt=L([It,Lt]),zt=l.extend({method:B(`elicitation/create`),params:Rt}),Bt=u.extend({elicitationId:k()}),Vt=d.extend({method:B(`notifications/elicitation/complete`),params:Bt}),Ht=f.extend({action:z([`accept`,`decline`,`cancel`]),content:Zc(e=>e===null?void 0:e,R(k(),L([k(),j(),M(),P(k())])).optional())}),Ut=F({type:B(`ref/resource`),uri:k()}),Wt=F({type:B(`ref/prompt`),name:k()}),Gt=s.extend({ref:L([Wt,Ut]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()}),Kt=l.extend({method:B(`completion/complete`),params:Gt}),qt=f.extend({completion:I({values:P(k()).max(100),total:V(j().int()),hasMore:V(M())})}),Jt=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Yt=l.extend({method:B(`roots/list`),params:s.optional()}),Xt=f.extend({roots:P(Jt)}),Zt=d.extend({method:B(`notifications/roots/list_changed`),params:u.optional()}),Qt=I({ttl:j().optional(),pollInterval:j().optional()}),$t=z([`working`,`input_required`,`completed`,`failed`,`cancelled`]),en=F({taskId:k(),status:$t,ttl:L([j(),uc()]),createdAt:k(),lastUpdatedAt:k(),pollInterval:V(j()),statusMessage:V(k())}),tn=f.extend({task:en}),nn=u.merge(en),rn=d.extend({method:B(`notifications/tasks/status`),params:nn}),an=l.extend({method:B(`tasks/get`),params:s.extend({taskId:k()})}),on=f.merge(en),sn=l.extend({method:B(`tasks/result`),params:s.extend({taskId:k()})}),cn=f.loose(),C=he.extend({method:B(`tasks/list`)}),ln=ge.extend({tasks:P(en)}),un=l.extend({method:B(`tasks/cancel`),params:s.extend({taskId:k()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,TaskMetadataSchema:i,RelatedTaskMetadataSchema:a,RequestMetaSchema:o,BaseRequestParamsSchema:s,TaskAugmentedRequestParamsSchema:c,RequestSchema:l,NotificationsParamsSchema:u,NotificationSchema:d,ResultSchema:f,RequestIdSchema:p,EmptyResultSchema:m,CancelledNotificationParamsSchema:h,CancelledNotificationSchema:ee,IconSchema:g,IconsSchema:te,BaseMetadataSchema:ne,ImplementationSchema:re,ClientTasksCapabilitySchema:_,ServerTasksCapabilitySchema:ae,ClientCapabilitiesSchema:oe,InitializeRequestParamsSchema:se,InitializeRequestSchema:ce,ServerCapabilitiesSchema:le,InitializeResultSchema:ue,InitializedNotificationSchema:de,PingRequestSchema:fe,ProgressSchema:pe,ProgressNotificationParamsSchema:v,ProgressNotificationSchema:y,PaginatedRequestParamsSchema:me,PaginatedRequestSchema:he,PaginatedResultSchema:ge,ResourceContentsSchema:_e,TextResourceContentsSchema:ve,BlobResourceContentsSchema:be,RoleSchema:xe,AnnotationsSchema:Se,ResourceSchema:Ce,ResourceTemplateSchema:we,ListResourcesRequestSchema:Te,ListResourcesResultSchema:Ee,ListResourceTemplatesRequestSchema:b,ListResourceTemplatesResultSchema:De,ResourceRequestParamsSchema:Oe,ReadResourceRequestParamsSchema:ke,ReadResourceRequestSchema:Ae,ReadResourceResultSchema:je,ResourceListChangedNotificationSchema:Me,SubscribeRequestParamsSchema:Ne,SubscribeRequestSchema:Pe,UnsubscribeRequestParamsSchema:Fe,UnsubscribeRequestSchema:Ie,ResourceUpdatedNotificationParamsSchema:Le,ResourceUpdatedNotificationSchema:Re,PromptArgumentSchema:ze,PromptSchema:Be,ListPromptsRequestSchema:Ve,ListPromptsResultSchema:He,GetPromptRequestParamsSchema:Ue,GetPromptRequestSchema:We,TextContentSchema:Ge,ImageContentSchema:x,AudioContentSchema:Ke,ToolUseContentSchema:qe,EmbeddedResourceSchema:Je,ResourceLinkSchema:Ye,ContentBlockSchema:Xe,PromptMessageSchema:Ze,GetPromptResultSchema:Qe,PromptListChangedNotificationSchema:$e,ToolAnnotationsSchema:S,ToolExecutionSchema:et,ToolSchema:tt,ListToolsRequestSchema:nt,ListToolsResultSchema:rt,CallToolResultSchema:it,CallToolRequestParamsSchema:at,CallToolRequestSchema:ot,ToolListChangedNotificationSchema:st,LoggingLevelSchema:ct,SetLevelRequestParamsSchema:lt,SetLevelRequestSchema:ut,LoggingMessageNotificationParamsSchema:dt,LoggingMessageNotificationSchema:ft,ModelHintSchema:pt,ModelPreferencesSchema:mt,ToolChoiceSchema:ht,ToolResultContentSchema:gt,SamplingContentSchema:_t,SamplingMessageContentBlockSchema:vt,SamplingMessageSchema:yt,CreateMessageRequestParamsSchema:bt,CreateMessageRequestSchema:xt,CreateMessageResultSchema:St,CreateMessageResultWithToolsSchema:Ct,BooleanSchemaSchema:wt,StringSchemaSchema:Tt,NumberSchemaSchema:Et,UntitledSingleSelectEnumSchemaSchema:Dt,TitledSingleSelectEnumSchemaSchema:Ot,LegacyTitledEnumSchemaSchema:kt,SingleSelectEnumSchemaSchema:At,UntitledMultiSelectEnumSchemaSchema:jt,TitledMultiSelectEnumSchemaSchema:Mt,MultiSelectEnumSchemaSchema:Nt,EnumSchemaSchema:Pt,PrimitiveSchemaDefinitionSchema:Ft,ElicitRequestFormParamsSchema:It,ElicitRequestURLParamsSchema:Lt,ElicitRequestParamsSchema:Rt,ElicitRequestSchema:zt,ElicitationCompleteNotificationParamsSchema:Bt,ElicitationCompleteNotificationSchema:Vt,ElicitResultSchema:Ht,ResourceTemplateReferenceSchema:Ut,PromptReferenceSchema:Wt,CompleteRequestParamsSchema:Gt,CompleteRequestSchema:Kt,CompleteResultSchema:qt,RootSchema:Jt,ListRootsRequestSchema:Yt,ListRootsResultSchema:Xt,RootsListChangedNotificationSchema:Zt,TaskCreationParamsSchema:Qt,TaskStatusSchema:$t,TaskSchema:en,CreateTaskResultSchema:tn,TaskStatusNotificationParamsSchema:nn,TaskStatusNotificationSchema:rn,GetTaskRequestSchema:an,GetTaskResultSchema:on,GetTaskPayloadRequestSchema:sn,GetTaskPayloadResultSchema:cn,ListTasksRequestSchema:C,ListTasksResultSchema:ln,CancelTaskRequestSchema:un,CancelTaskResultSchema:f.merge(en),ClientRequestSchema:L([fe,ce,Kt,ut,We,Ve,Te,b,Ae,Pe,Ie,ot,nt,an,sn,C,un]),ClientNotificationSchema:L([ee,y,de,Zt,rn]),ClientResultSchema:L([m,St,Ct,Ht,Xt,on,ln,tn]),ServerRequestSchema:L([fe,xt,zt,Yt,an,sn,C,un]),ServerNotificationSchema:L([ee,y,ft,Re,Me,st,$e,rn,Vt]),ServerResultSchema:L([m,ue,qt,Qe,He,Ee,De,je,it,rt,on,ln,tn]),CallToolResultWireSchema:N().superRefine((e,t)=>{if(typeof e==`object`&&e&&!Array.isArray(e)&&e.content===void 0){for(let n of Nf)if(n in e){t.addIssue({code:`custom`,message:`content is required when the body carries '${n}' — another result family cannot default into an empty tools/call success`});return}}}).transform(Pf).pipe(it)}}var If;function Lf(){return If??=Ff()}function Rf(e){return e.type!==`object`}var zf=new Set([`const`,`enum`,`default`,`examples`]),Bf=new Set([`properties`,`patternProperties`,`$defs`,`definitions`,`dependentSchemas`,`dependencies`]);function Vf(e){return e!==void 0&&!(typeof e==`string`&&e.startsWith(`#`))}function Hf(e){let t=typeof e.$schema==`string`?e.$schema:void 0;if(Vf(e.$id))return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:e},required:[`result`]};let n=i(e.$schema)&&e.$recursiveAnchor!==!0,r=(e,t)=>{if(Array.isArray(e))return e.map(e=>r(e,!1));if(typeof e!=`object`||!e||!t&&Vf(e.$id))return e;let i={},a=!1;for(let[o,s]of Object.entries(e))t?i[o]=r(s,!1):(o===`$ref`||o===`$dynamicRef`)&&typeof s==`string`?i[o]=s===`#`?`#/properties/result`:s.startsWith(`#/`)?`#/properties/result${s.slice(1)}`:s:o===`$recursiveRef`&&s===`#`&&n?a=!0:i[o]=zf.has(o)?s:Bf.has(o)?r(s,!0):r(s,!1);return a&&(`$ref`in i?i.allOf=[...Array.isArray(i.allOf)?i.allOf:[],{$ref:`#/properties/result`}]:i.$ref=`#/properties/result`),i};return{...t!==void 0&&{$schema:t},type:`object`,properties:{result:r(e,!1)},required:[`result`]}}var Uf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Wf={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Gf={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Kf;function qf(){if(Kf)return Kf;let e=Lf();return Kf={requestSchemas:{ping:e.PingRequestSchema,initialize:e.InitializeRequestSchema,"completion/complete":e.CompleteRequestSchema,"logging/setLevel":e.SetLevelRequestSchema,"prompts/get":e.GetPromptRequestSchema,"prompts/list":e.ListPromptsRequestSchema,"resources/list":e.ListResourcesRequestSchema,"resources/templates/list":e.ListResourceTemplatesRequestSchema,"resources/read":e.ReadResourceRequestSchema,"resources/subscribe":e.SubscribeRequestSchema,"resources/unsubscribe":e.UnsubscribeRequestSchema,"tools/call":e.CallToolRequestSchema,"tools/list":e.ListToolsRequestSchema,"tasks/get":e.GetTaskRequestSchema,"tasks/result":e.GetTaskPayloadRequestSchema,"tasks/list":e.ListTasksRequestSchema,"tasks/cancel":e.CancelTaskRequestSchema,"sampling/createMessage":e.CreateMessageRequestSchema,"elicitation/create":e.ElicitRequestSchema,"roots/list":e.ListRootsRequestSchema},notificationSchemas:{"notifications/cancelled":e.CancelledNotificationSchema,"notifications/progress":e.ProgressNotificationSchema,"notifications/initialized":e.InitializedNotificationSchema,"notifications/roots/list_changed":e.RootsListChangedNotificationSchema,"notifications/tasks/status":e.TaskStatusNotificationSchema,"notifications/message":e.LoggingMessageNotificationSchema,"notifications/resources/updated":e.ResourceUpdatedNotificationSchema,"notifications/resources/list_changed":e.ResourceListChangedNotificationSchema,"notifications/tools/list_changed":e.ToolListChangedNotificationSchema,"notifications/prompts/list_changed":e.PromptListChangedNotificationSchema,"notifications/elicitation/complete":e.ElicitationCompleteNotificationSchema},resultSchemas:{ping:e.EmptyResultSchema,initialize:e.InitializeResultSchema,"completion/complete":e.CompleteResultSchema,"logging/setLevel":e.EmptyResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"resources/subscribe":e.EmptyResultSchema,"resources/unsubscribe":e.EmptyResultSchema,"tools/call":e.CallToolResultWireSchema,"tools/list":e.ListToolsResultSchema,"sampling/createMessage":e.CreateMessageResultWithToolsSchema,"elicitation/create":e.ElicitResultSchema,"roots/list":e.ListRootsResultSchema}},Kf}function Jf(e){return Object.prototype.hasOwnProperty.call(Uf,e)}function Yf(e){return Object.prototype.hasOwnProperty.call(Wf,e)}function Xf(e){return Object.prototype.hasOwnProperty.call(Gf,e)}function Zf(e){return Xf(e)?qf().resultSchemas[e]:void 0}function Qf(e){return Jf(e)?qf().requestSchemas[e]:void 0}function $f(e){return Yf(e)?qf().notificationSchemas[e]:void 0}Object.keys(Uf),Object.keys(Wf);function ep(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var np={ok:!1,reason:`not-in-era`};function rp(e){return ep(e)&&ep(e.outputSchema)&&Rf(e.outputSchema)}function ip(e){return e}var ap={era:`2025-11-25`,hasRequestMethod:Jf,hasNotificationMethod:Yf,validateRequest:(e,t)=>tp(Qf(e),t),validateResult:(e,t)=>tp(Zf(e),t),validateNotification:(e,t)=>tp($f(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>np,validateInputResponse:()=>np,samplingResultVariant:((e,t)=>{let n=Lf();return tp(e?n.CreateMessageResultWithToolsSchema:n.CreateMessageResultSchema,t)}),outboundEnvelope:e=>void 0,validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let n=Mf(e),r=n.structuredContent;if(r===void 0)return n;let i=typeof r!=`object`||!r||Array.isArray(r),a=t!==void 0&&Rf(t);return!i&&!a?n:{...n,structuredContent:{result:r}}},decodeResult(e,t){if(ep(t)&&`resultType`in t){let e={...t};return delete e.resultType,{kind:`complete`,result:ip(e)}}return{kind:`complete`,result:ip(t)}},encodeResult(e,t){if(e!==`tools/list`)return t;let n=t.tools;return!Array.isArray(n)||!n.some(e=>rp(e))?t:{...t,tools:n.map(e=>rp(e)?{...e,outputSchema:Hf(e.outputSchema)}:e)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>void 0};function op(){let e=qc(()=>L([k(),j(),M(),uc(),R(k(),e),P(e)])),t=R(k(),e),n=L([k(),j().int()]),r=k(),i=L([k(),j().int()]),a=z([`user`,`assistant`]),o=z([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),s=k().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),c=F({ttl:j().optional()}),l=F({taskId:k()}),u=I({progressToken:n.optional(),"io.modelcontextprotocol/related-task":l.optional()}),d=F({_meta:u.optional()}),f=d.extend({task:c.optional()}),p=F({_meta:u.optional()}),m=F({method:k(),params:p.loose().optional()}),h=F({src:k(),mimeType:k().optional(),sizes:P(k()).optional(),theme:z([`light`,`dark`]).optional()}),ee=F({icons:P(h).optional()}),g=F({name:k(),title:k().optional()}),te=g.extend({...g.shape,...ee.shape,version:k(),websiteUrl:k().optional(),description:k().optional()}),ne=Zc(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,Sc(F({form:Sc(F({applyDefaults:M().optional()}),t).optional(),url:t.optional()}),t.optional())),re=I({list:t.optional(),cancel:t.optional(),requests:I({sampling:I({createMessage:t.optional()}).optional(),elicitation:I({create:t.optional()}).optional()}).optional()}),ie=I({list:t.optional(),cancel:t.optional(),requests:I({tools:I({call:t.optional()}).optional()}).optional()}),_=F({experimental:R(k(),t).optional(),sampling:F({context:t.optional(),tools:t.optional()}).optional(),elicitation:ne.optional(),roots:F({listChanged:M().optional()}).optional(),tasks:re.optional(),extensions:R(k(),t).optional()}),ae=F({experimental:R(k(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:F({listChanged:M().optional()}).optional(),resources:F({subscribe:M().optional(),listChanged:M().optional()}).optional(),tools:F({listChanged:M().optional()}).optional(),tasks:ie.optional(),extensions:R(k(),t).optional()}),oe=F({progress:j(),total:V(j()),message:V(k())}),se=F({...p.shape,...oe.shape,progressToken:n}),ce=m.extend({method:B(`notifications/progress`),params:se}),le=p.extend({level:o,logger:k().optional(),data:N()}),ue=m.extend({method:B(`notifications/message`),params:le}),de=F({uri:k(),mimeType:V(k()),_meta:R(k(),N()).optional()}),fe=de.extend({text:k()}),pe=de.extend({blob:s}),v=F({audience:P(a).optional(),priority:j().min(0).max(1).optional(),lastModified:el({offset:!0}).optional()}),y=F({...g.shape,...ee.shape,uri:k(),description:V(k()),mimeType:V(k()),size:V(j()),annotations:v.optional(),_meta:V(I({}))}),me=F({...g.shape,...ee.shape,uriTemplate:k(),description:V(k()),mimeType:V(k()),annotations:v.optional(),_meta:V(I({}))}),he=m.extend({method:B(`notifications/resources/list_changed`),params:p.optional()}),ge=p.extend({uri:k()}),_e=m.extend({method:B(`notifications/resources/updated`),params:ge}),ve=F({name:k(),description:V(k()),required:V(M())}),ye=F({...g.shape,...ee.shape,description:V(k()),arguments:V(P(ve)),_meta:V(I({}))}),be=m.extend({method:B(`notifications/prompts/list_changed`),params:p.optional()}),xe=F({type:B(`text`),text:k(),annotations:v.optional(),_meta:R(k(),N()).optional()}),Se=F({type:B(`image`),data:s,mimeType:k(),annotations:v.optional(),_meta:R(k(),N()).optional()}),Ce=F({type:B(`audio`),data:s,mimeType:k(),annotations:v.optional(),_meta:R(k(),N()).optional()}),we=F({type:B(`tool_use`),name:k(),id:k(),input:R(k(),N()),_meta:R(k(),N()).optional()}),Te=F({type:B(`resource`),resource:L([fe,pe]),annotations:v.optional(),_meta:R(k(),N()).optional()}),Ee=y.extend({type:B(`resource_link`)}),b=L([xe,Se,Ce,Ee,Te]),De=F({role:a,content:b}),Oe=F({title:k().optional(),readOnlyHint:M().optional(),destructiveHint:M().optional(),idempotentHint:M().optional(),openWorldHint:M().optional()}),ke=m.extend({method:B(`notifications/tools/list_changed`),params:p.optional()}),Ae=F({name:k().optional()}),je=F({hints:P(Ae).optional(),costPriority:j().min(0).max(1).optional(),speedPriority:j().min(0).max(1).optional(),intelligencePriority:j().min(0).max(1).optional()}),Me=F({mode:z([`auto`,`required`,`none`]).optional()}),Ne=F({type:B(`boolean`),title:k().optional(),description:k().optional(),default:M().optional()}),Pe=F({type:B(`string`),title:k().optional(),description:k().optional(),minLength:j().optional(),maxLength:j().optional(),format:z([`email`,`uri`,`date`,`date-time`]).optional(),default:k().optional()}),Fe=F({type:z([`number`,`integer`]),title:k().optional(),description:k().optional(),minimum:j().optional(),maximum:j().optional(),default:j().optional()}),Ie=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),default:k().optional()}),Le=F({type:B(`string`),title:k().optional(),description:k().optional(),oneOf:P(F({const:k(),title:k()})),default:k().optional()}),Re=F({type:B(`string`),title:k().optional(),description:k().optional(),enum:P(k()),enumNames:P(k()).optional(),default:k().optional()}),ze=L([Ie,Le]),Be=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({type:B(`string`),enum:P(k())}),default:P(k()).optional()}),Ve=F({type:B(`array`),title:k().optional(),description:k().optional(),minItems:j().optional(),maxItems:j().optional(),items:F({anyOf:P(F({const:k(),title:k()}))}),default:P(k()).optional()}),He=L([Be,Ve]),Ue=L([Re,ze,He]),We=L([Ue,Ne,Pe,Fe]),Ge=f.extend({mode:B(`form`).optional(),message:k(),requestedSchema:F({type:B(`object`),properties:R(k(),We),required:P(k()).optional()}).catchall(N())}),x=F({type:B(`ref/resource`),uri:k()}),Ke=F({type:B(`ref/prompt`),name:k()}),qe=F({uri:k().startsWith(`file://`),name:k().optional(),_meta:R(k(),N()).optional()}),Je=_.shape,Ye=F({experimental:Je.experimental,sampling:Je.sampling,elicitation:Je.elicitation,roots:Je.roots,extensions:Je.extensions}),Xe=ae.shape,Ze=F({experimental:Xe.experimental,logging:Xe.logging,completions:Xe.completions,prompts:Xe.prompts,resources:Xe.resources,tools:Xe.tools,extensions:Xe.extensions}),Qe=I({progressToken:n.optional(),[al]:k(),[ol]:te.optional(),[cl]:Ye,[ul]:o.optional()}),$e=F({...g.shape,...ee.shape,description:k().optional(),inputSchema:I({$schema:k().optional(),type:B(`object`)}),outputSchema:I({$schema:k().optional()}).optional(),annotations:Oe.optional(),_meta:R(k(),N()).optional()}),S=F({type:B(`tool_result`),toolUseId:k(),content:P(b),structuredContent:N().optional(),isError:M().optional(),_meta:R(k(),N()).optional()}),et=L([xe,Se,Ce,we,S]),tt=F({role:a,content:L([et,P(et)]),_meta:R(k(),N()).optional()}),nt=k(),rt=I({[sl]:te.optional().catch(void 0)}),it=rt.optional();function at(e){return I({_meta:it,resultType:nt.default(`complete`),...e})}let ot=at({}),st=at({nextCursor:r.optional()}),ct=at({content:P(b),structuredContent:N().optional(),isError:M().optional()}),lt=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),tools:P($e),nextCursor:r.optional()}),ut=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),prompts:P(ye),nextCursor:r.optional()}),dt=at({description:k().optional(),messages:P(De)}),ft=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resources:P(y),nextCursor:r.optional()}),pt=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resourceTemplates:P(me),nextCursor:r.optional()}),mt=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),contents:P(L([fe,pe]))}),ht=at({completion:F({values:P(k()).max(100),total:j().int().optional(),hasMore:M().optional()}).loose()}),gt=at({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`])}),_t=at({ttlMs:j().int().min(0).catch(0),cacheScope:z([`public`,`private`]).catch(`private`),supportedVersions:P(k()),capabilities:Ze,instructions:k().optional()}),vt=F({messages:P(tt),modelPreferences:je.optional(),systemPrompt:k().optional(),includeContext:z([`none`,`thisServer`,`allServers`]).optional(),temperature:j().optional(),maxTokens:j().int(),stopSequences:P(k()).optional(),metadata:t.optional(),tools:P($e).optional(),toolChoice:Me.optional()}),yt=F({method:B(`sampling/createMessage`),params:vt}),bt=F({method:B(`roots/list`),params:F({_meta:R(k(),N()).optional()}).optional()}),xt=F({...tt.shape,model:k(),stopReason:k().optional()}),St=F({roots:P(qe)}),Ct=F({action:z([`accept`,`decline`,`cancel`]),content:R(k(),L([k(),j(),M(),P(k())])).optional()}),wt=F({mode:B(`url`),message:k(),url:k().url()}),Tt=L([Ge,wt]),Et=F({method:B(`elicitation/create`),params:Tt}),Dt=L([yt,bt,Et]),Ot=L([xt,St,Ct]),kt=R(k(),Dt),At=R(k(),Ot),jt=at({inputRequests:kt.optional(),requestState:k().optional()}),Mt={inputResponses:At.optional(),requestState:k().optional()},Nt=F({_meta:Qe,...Mt}),Pt=I({progressToken:n.optional()});function Ft(e,t){return F({method:B(e),params:F({_meta:Qe,...t})})}function It(e,t){return F({method:B(e),params:F({_meta:Pt.optional(),...t}).optional()})}let Lt={name:k(),arguments:R(k(),N()).optional(),...Mt},Rt={cursor:r.optional()},zt=Ft(`tools/call`,Lt),Bt=Ft(`tools/list`,Rt),Vt=Ft(`prompts/list`,Rt),Ht=Ft(`prompts/get`,{name:k(),arguments:R(k(),k()).optional(),...Mt}),Ut=Ft(`resources/list`,Rt),Wt=Ft(`resources/templates/list`,Rt),Gt=Ft(`resources/read`,{uri:k(),...Mt}),Kt={ref:L([Ke,x]),argument:F({name:k(),value:k()}),context:F({arguments:R(k(),k()).optional()}).optional()},qt=Ft(`completion/complete`,Kt),Jt=Ft(`server/discover`,{}),Yt=F({toolsListChanged:M().optional(),promptsListChanged:M().optional(),resourcesListChanged:M().optional(),resourceSubscriptions:P(k()).optional()}),Xt={notifications:Yt},Zt=Ft(`subscriptions/listen`,Xt),Qt=rt.extend({"io.modelcontextprotocol/subscriptionId":i}),$t=I({_meta:Qt,resultType:nt.default(`complete`)}),en={"tools/call":It(`tools/call`,Lt),"tools/list":It(`tools/list`,Rt),"prompts/get":It(`prompts/get`,{name:k(),arguments:R(k(),k()).optional()}),"prompts/list":It(`prompts/list`,Rt),"resources/list":It(`resources/list`,Rt),"resources/templates/list":It(`resources/templates/list`,Rt),"resources/read":It(`resources/read`,{uri:k()}),"completion/complete":It(`completion/complete`,Kt),"server/discover":It(`server/discover`,{}),"subscriptions/listen":It(`subscriptions/listen`,Xt)};function tn(e){return I({_meta:it,...e})}let nn={"tools/call":tn({content:P(b),structuredContent:N().optional(),isError:M().optional()}),"tools/list":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),tools:P($e),nextCursor:r.optional()}),"prompts/get":tn({description:k().optional(),messages:P(De)}),"prompts/list":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),prompts:P(ye),nextCursor:r.optional()}),"resources/list":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resources:P(y),nextCursor:r.optional()}),"resources/templates/list":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),resourceTemplates:P(me),nextCursor:r.optional()}),"resources/read":tn({ttlMs:j().int().min(0),cacheScope:z([`public`,`private`]),contents:P(L([fe,pe]))}),"completion/complete":tn({completion:F({values:P(k()).max(100),total:j().int().optional(),hasMore:M().optional()}).loose()}),"server/discover":tn({ttlMs:j().int().min(0).catch(0),cacheScope:z([`public`,`private`]).catch(`private`),supportedVersions:P(k()),capabilities:Ze,instructions:k().optional()}),"subscriptions/listen":tn({})},rn=I({"io.modelcontextprotocol/subscriptionId":i.optional()}),an=F({method:B(`notifications/subscriptions/acknowledged`),params:F({_meta:rn.optional(),notifications:Yt})}),on=F({_meta:rn.optional(),requestId:i,reason:k().optional()}),sn=F({method:B(`notifications/cancelled`),params:on}),cn={"notifications/cancelled":sn,"notifications/progress":ce,"notifications/message":ue,"notifications/resources/updated":_e,"notifications/resources/list_changed":he,"notifications/tools/list_changed":ke,"notifications/prompts/list_changed":be,"notifications/subscriptions/acknowledged":an},C=e=>F({jsonrpc:B(`2.0`),id:L([k(),j().int()]),result:e}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:n,CursorSchema:r,RequestIdSchema:i,RoleSchema:a,LoggingLevelSchema:o,TaskMetadataSchema:c,RelatedTaskMetadataSchema:l,RequestMetaSchema:u,BaseRequestParamsSchema:d,TaskAugmentedRequestParamsSchema:f,NotificationsParamsSchema:p,NotificationSchema:m,IconSchema:h,IconsSchema:ee,BaseMetadataSchema:g,ImplementationSchema:te,ClientTasksCapabilitySchema:re,ServerTasksCapabilitySchema:ie,ClientCapabilitiesSchema:_,ServerCapabilitiesSchema:ae,ProgressSchema:oe,ProgressNotificationParamsSchema:se,ProgressNotificationSchema:ce,LoggingMessageNotificationParamsSchema:le,LoggingMessageNotificationSchema:ue,ResourceContentsSchema:de,TextResourceContentsSchema:fe,BlobResourceContentsSchema:pe,AnnotationsSchema:v,ResourceSchema:y,ResourceTemplateSchema:me,ResourceListChangedNotificationSchema:he,ResourceUpdatedNotificationParamsSchema:ge,ResourceUpdatedNotificationSchema:_e,PromptArgumentSchema:ve,PromptSchema:ye,PromptListChangedNotificationSchema:be,TextContentSchema:xe,ImageContentSchema:Se,AudioContentSchema:Ce,ToolUseContentSchema:we,EmbeddedResourceSchema:Te,ResourceLinkSchema:Ee,ContentBlockSchema:b,PromptMessageSchema:De,ToolAnnotationsSchema:Oe,ToolListChangedNotificationSchema:ke,ModelHintSchema:Ae,ModelPreferencesSchema:je,ToolChoiceSchema:Me,BooleanSchemaSchema:Ne,StringSchemaSchema:Pe,NumberSchemaSchema:Fe,UntitledSingleSelectEnumSchemaSchema:Ie,TitledSingleSelectEnumSchemaSchema:Le,LegacyTitledEnumSchemaSchema:Re,SingleSelectEnumSchemaSchema:ze,UntitledMultiSelectEnumSchemaSchema:Be,TitledMultiSelectEnumSchemaSchema:Ve,MultiSelectEnumSchemaSchema:He,EnumSchemaSchema:Ue,PrimitiveSchemaDefinitionSchema:We,ElicitRequestFormParamsSchema:Ge,ResourceTemplateReferenceSchema:x,PromptReferenceSchema:Ke,RootSchema:qe,ClientCapabilities2026Schema:Ye,ServerCapabilities2026Schema:Ze,RequestMetaEnvelopeSchema:Qe,ToolSchema:$e,ToolResultContentSchema:S,SamplingMessageContentBlockSchema:et,SamplingMessageSchema:tt,ResultTypeSchema:nt,ResultMetaSchema:rt,ResultSchema:ot,PaginatedResultSchema:st,CallToolResultSchema:ct,ListToolsResultSchema:lt,ListPromptsResultSchema:ut,GetPromptResultSchema:dt,ListResourcesResultSchema:ft,ListResourceTemplatesResultSchema:pt,ReadResourceResultSchema:mt,CompleteResultSchema:ht,CacheableResultSchema:gt,DiscoverResultSchema:_t,CreateMessageRequestParamsSchema:vt,CreateMessageRequestSchema:yt,ListRootsRequestSchema:bt,CreateMessageResultSchema:xt,ListRootsResultSchema:St,ElicitResultSchema:Ct,ElicitRequestURLParamsSchema:wt,ElicitRequestParamsSchema:Tt,ElicitRequestSchema:Et,InputRequestSchema:Dt,InputResponseSchema:Ot,InputRequestsSchema:kt,InputResponsesSchema:At,InputRequiredResultSchema:jt,InputResponseRequestParamsSchema:Nt,CallToolRequestSchema:zt,ListToolsRequestSchema:Bt,ListPromptsRequestSchema:Vt,GetPromptRequestSchema:Ht,ListResourcesRequestSchema:Ut,ListResourceTemplatesRequestSchema:Wt,ReadResourceRequestSchema:Gt,CompleteRequestSchema:qt,DiscoverRequestSchema:Jt,SubscriptionFilterSchema:Yt,SubscriptionsListenRequestSchema:Zt,SubscriptionsListenResultMetaSchema:Qt,SubscriptionsListenResultSchema:$t,dispatchRequestSchemas:en,dispatchResultSchemas:nn,NotificationMetaSchema:rn,SubscriptionsAcknowledgedNotificationSchema:an,CancelledNotificationParamsSchema:on,CancelledNotificationSchema:sn,notificationSchemas2026:cn,JSONRPCResultResponseSchema:C(ot),CallToolResultResponseSchema:C(L([ct,jt])),ListToolsResultResponseSchema:C(lt),ListPromptsResultResponseSchema:C(ut),GetPromptResultResponseSchema:C(L([dt,jt])),ListResourcesResultResponseSchema:C(ft),ListResourceTemplatesResultResponseSchema:C(pt),ReadResourceResultResponseSchema:C(L([mt,jt])),CompleteResultResponseSchema:C(ht),DiscoverResultResponseSchema:C(_t)}}var sp;function cp(){return sp??=op()}var lp=[`tools/list`,`prompts/list`,`resources/list`,`resources/templates/list`,`resources/read`,`server/discover`];function up(e){return lp.includes(e)}var dp=Symbol(`modelcontextprotocol.resultCacheHintFallback`);function fp(e){return e[dp]}function pp(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function mp(e){return e===`public`||e===`private`}var Y=function(e){return e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.ResourceNotFound=-32002]=`ResourceNotFound`,e[e.MissingRequiredClientCapability=-32021]=`MissingRequiredClientCapability`,e[e.UnsupportedProtocolVersion=-32022]=`UnsupportedProtocolVersion`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`,e}({}),X=class e extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ProtocolError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(t),this.code=e,this.data=n,this.name=`ProtocolError`,Of(this,new.target)}static fromError(t,n,r){if(t===Y.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new gp(e.elicitations,n)}if(t===Y.UnsupportedProtocolVersion&&r){let e=r;if(Array.isArray(e.supported)&&typeof e.requested==`string`)return new _p({supported:e.supported,requested:e.requested},n)}if(t===Y.InvalidParams||t===Y.ResourceNotFound){let e=r;if(typeof e?.uri==`string`&&(t===Y.ResourceNotFound||Object.keys(e).length===1))return new hp(e.uri,n)}if(t===Y.MissingRequiredClientCapability&&r){let e=r;if(e.requiredCapabilities!==null&&typeof e.requiredCapabilities==`object`&&!Array.isArray(e.requiredCapabilities))return new vp({requiredCapabilities:e.requiredCapabilities},n)}return new e(t,n,r)}},hp=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.ResourceNotFoundError`})}constructor(e,t=`Resource not found: ${e}`){super(Y.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},gp=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UrlElicitationRequiredError`})}constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(Y.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},_p=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnsupportedProtocolVersionError`})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(Y.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},vp=class extends X{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.MissingRequiredClientCapabilityError`})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(`, `)}`){super(Y.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},yp=0,bp=`private`,xp=[`tools/call`,`prompts/get`,`resources/read`];function Sp(e,t){let n=t.resultType;if(n===void 0)return{...t,resultType:`complete`};if(n===`complete`||xp.includes(e))return t;throw new X(Y.InternalError,`Handler for ${e} returned resultType '${String(n)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function Cp(e,t){let n=fp(t);if(t.resultType!==`complete`||!up(e))return n===void 0?t:Op(t);let r=t,i=pp(r.ttlMs)?r.ttlMs:Ep(n),a=mp(r.cacheScope)?r.cacheScope:Dp(n),o={...r,ttlMs:i,cacheScope:a};return delete o[dp],o}function wp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Tp(e,t){if(t===void 0)return e;let n=e._meta;return n===void 0?{...e,_meta:{[sl]:t}}:!wp(n)||n[`io.modelcontextprotocol/serverInfo`]!==void 0?e:{...e,_meta:{...n,[sl]:t}}}function Ep(e){return e!==void 0&&pp(e.ttlMs)?e.ttlMs:yp}function Dp(e){return e!==void 0&&mp(e.cacheScope)?e.cacheScope:bp}function Op(e){let t={...e};return delete t[dp],t}var kp=[`elicitation/create`,`sampling/createMessage`,`roots/list`],Ap;function jp(){if(Ap)return Ap;let e=cp();return Ap={request:{"elicitation/create":F({method:B(`elicitation/create`),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":F({method:B(`sampling/createMessage`),params:e.CreateMessageRequestParamsSchema}),"roots/list":F({method:B(`roots/list`),params:I({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Ap}function Mp(e){return kp.includes(e)}function Np(e){return Mp(e)?jp().request[e]:void 0}function Pp(e){return Mp(e)?jp().response[e]:void 0}var Fp={"tools/call":null,"tools/list":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"completion/complete":null,"server/discover":null,"subscriptions/listen":null},Ip={"notifications/cancelled":null,"notifications/progress":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/subscriptions/acknowledged":null};function Lp(e){return Object.prototype.hasOwnProperty.call(Fp,e)}function Rp(e){return Object.prototype.hasOwnProperty.call(Ip,e)}function zp(e){return Object.prototype.hasOwnProperty.call(Fp,e)}function Bp(e){return Lp(e)?cp().dispatchRequestSchemas[e]:void 0}function Vp(e){return zp(e)?cp().dispatchResultSchemas[e]:void 0}function Hp(e){return Rp(e)?cp().notificationSchemas2026[e]:void 0}Object.keys(Fp),Object.keys(Ip);function Up(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wp(e,t){if(e===void 0)return{ok:!1,reason:`not-in-era`};let n=e.safeParse(t);return n.success?{ok:!0,value:n.data}:{ok:!1,reason:`invalid`,message:String(n.error)}}var Gp={ok:!1,reason:`not-in-era`},Kp=[al,cl];function qp(e,t){let n=t,r=!1,i=()=>(r||=(n={...n},!0),n),a=t.tools;e===`tools/list`&&Array.isArray(a)&&a.some(e=>Up(e)&&`execution`in e)&&(i().tools=a.map(e=>{if(!Up(e)||!(`execution`in e))return e;let t={...e};return delete t.execution,t}));let o=t.capabilities;if(Up(o)&&`tasks`in o){let e={...o};delete e.tasks,i().capabilities=e}return n}var Jp={era:`2026-07-28`,hasRequestMethod:Lp,hasNotificationMethod:Rp,hasInputRequestMethod:e=>Np(e)!==void 0,validateRequest:(e,t)=>Wp(Bp(e),t),validateResult:(e,t)=>Wp(Vp(e),t),validateNotification:(e,t)=>Wp(Hp(e),t),validateInputRequest:(e,t)=>Wp(Np(e),t),validateInputResponse:(e,t)=>Wp(Pp(e),t),samplingResultVariant:()=>Gp,outboundEnvelope(e){return{[al]:e.protocolVersion,[ol]:e.clientInfo,[cl]:e.clientCapabilities,...e.logLevel!==void 0&&{"io.modelcontextprotocol/logLevel":e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of Kp)n in e||t.push({key:n,problem:`missing`});let n=cp().RequestMetaEnvelopeSchema.safeParse(e);if(!n.success)for(let e of n.error.issues){let n=e.path.map(String),r=n.length>0?n.join(`.`):`_meta`;n.length===1&&t.some(e=>e.key===r&&e.problem===`missing`)||t.push({key:r,problem:e.message})}return t},projectCallToolResult:e=>Mf(e),inputRequestSchema:Np,decodeResult(e,t){if(!Up(t))return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let n=t.resultType;if(n===void 0)return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: missing required resultType — servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:`missing-resultType`})};if(typeof n!=`string`)return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:n})};if(n===`input_required`){let n=t.inputRequests,r=Up(n)?n:{},i=t.requestState;return Object.keys(r).length===0&&typeof i!=`string`?{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: input_required carries neither inputRequests nor requestState (every input_required result must include at least one of the two)`,{method:e,violation:`input-required-missing-both`})}:{kind:`input_required`,inputRequests:r,...typeof i==`string`&&{requestState:i}}}if(n!==`complete`)return{kind:`invalid`,error:new J(q.UnsupportedResultType,`Unsupported result type '${n}' for ${e}`,{resultType:n,method:e})};let r=Xp(),i=Object.hasOwn(r,e)?r[e]:void 0;if(i!==void 0){let n=i.safeParse(t);if(!n.success)return{kind:`invalid`,error:new J(q.InvalidResult,`Invalid result for ${e}: ${n.error}`,{method:e})}}let a={...t};return delete a.resultType,{kind:`complete`,result:a}},encodeResult(e,t,n){return Tp(Cp(e,Sp(e,qp(e,t))),n)},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope(e){if(e.envelope===void 0)return`Request is missing the required _meta envelope for protocol revision 2026-07-28 (io.modelcontextprotocol/protocolVersion, io.modelcontextprotocol/clientCapabilities)`;let t=cp().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(e=>e.message).join(`; `)}`}},Yp;function Xp(){if(Yp)return Yp;let e=cp();return Yp={"tools/call":e.CallToolResultSchema,"tools/list":e.ListToolsResultSchema,"prompts/get":e.GetPromptResultSchema,"prompts/list":e.ListPromptsResultSchema,"resources/list":e.ListResourcesResultSchema,"resources/templates/list":e.ListResourceTemplatesResultSchema,"resources/read":e.ReadResourceResultSchema,"completion/complete":e.CompleteResultSchema,"server/discover":e.DiscoverResultSchema},Yp}var Zp=`2026-07-28`;function Qp(e){return e!==void 0&&jf(e)?Jp:ap}function $p(e){return e.revision===void 0?e.era===`modern`?Jp.era:ap.era:Qp(e.revision).era}function em(e){return nm.some(t=>t.hasRequestMethod(e))}function tm(e){return nm.some(t=>t.hasNotificationMethod(e))}var nm=[ap,Jp],rm=n({AnnotationsSchema:()=>au,AudioContentSchema:()=>Ru,BaseMetadataSchema:()=>Pl,BaseRequestParamsSchema:()=>U,BlobResourceContentsSchema:()=>ru,BooleanSchemaSchema:()=>yd,CallToolRequestParamsSchema:()=>$u,CallToolRequestSchema:()=>ed,CallToolResultSchema:()=>Zu,CancelTaskRequestSchema:()=>of,CancelTaskResultSchema:()=>sf,CancelledNotificationParamsSchema:()=>Al,CancelledNotificationSchema:()=>jl,ClientCapabilitiesSchema:()=>zl,ClientNotificationSchema:()=>lf,ClientRequestSchema:()=>cf,ClientResultSchema:()=>uf,ClientTasksCapabilitySchema:()=>Ll,CompatibilityCallToolResultSchema:()=>Qu,CompleteRequestParamsSchema:()=>Bd,CompleteRequestSchema:()=>Vd,CompleteResultSchema:()=>Hd,ContentBlockSchema:()=>Hu,CreateMessageRequestParamsSchema:()=>hd,CreateMessageRequestSchema:()=>gd,CreateMessageResultSchema:()=>_d,CreateMessageResultWithToolsSchema:()=>vd,CreateTaskResultSchema:()=>Xd,CursorSchema:()=>ml,DiscoverRequestSchema:()=>Gl,DiscoverResultSchema:()=>Kl,ElicitRequestFormParamsSchema:()=>jd,ElicitRequestParamsSchema:()=>Nd,ElicitRequestSchema:()=>Pd,ElicitRequestURLParamsSchema:()=>Md,ElicitResultSchema:()=>Ld,ElicitationCompleteNotificationParamsSchema:()=>Fd,ElicitationCompleteNotificationSchema:()=>Id,EmbeddedResourceSchema:()=>Bu,EmptyResultSchema:()=>kl,EnumSchemaSchema:()=>kd,GetPromptRequestParamsSchema:()=>Pu,GetPromptRequestSchema:()=>Fu,GetPromptResultSchema:()=>Wu,GetTaskPayloadRequestSchema:()=>tf,GetTaskPayloadResultSchema:()=>nf,GetTaskRequestSchema:()=>$d,GetTaskResultSchema:()=>ef,IconSchema:()=>Ml,IconsSchema:()=>Nl,ImageContentSchema:()=>Lu,ImplementationSchema:()=>Fl,InitializeRequestParamsSchema:()=>Bl,InitializeRequestSchema:()=>Vl,InitializeResultSchema:()=>Ul,InitializedNotificationSchema:()=>Wl,JSONArraySchema:()=>fl,JSONObjectSchema:()=>H,JSONRPCErrorResponseSchema:()=>El,JSONRPCMessageSchema:()=>Dl,JSONRPCNotificationSchema:()=>wl,JSONRPCRequestSchema:()=>Cl,JSONRPCResponseSchema:()=>Ol,JSONRPCResultResponseSchema:()=>Tl,JSONValueSchema:()=>dl,LegacyTitledEnumSchemaSchema:()=>wd,ListChangedOptionsBaseSchema:()=>nd,ListPromptsRequestSchema:()=>Mu,ListPromptsResultSchema:()=>Nu,ListResourceTemplatesRequestSchema:()=>uu,ListResourceTemplatesResultSchema:()=>du,ListResourcesRequestSchema:()=>cu,ListResourcesResultSchema:()=>lu,ListRootsRequestSchema:()=>Wd,ListRootsResultSchema:()=>Gd,ListTasksRequestSchema:()=>rf,ListTasksResultSchema:()=>af,ListToolsRequestSchema:()=>Yu,ListToolsResultSchema:()=>Xu,LoggingLevelSchema:()=>rd,LoggingMessageNotificationParamsSchema:()=>od,LoggingMessageNotificationSchema:()=>sd,ModelHintSchema:()=>cd,ModelPreferencesSchema:()=>ld,MultiSelectEnumSchemaSchema:()=>Od,NotificationSchema:()=>bl,NotificationsParamsSchema:()=>yl,NumberSchemaSchema:()=>xd,PaginatedRequestParamsSchema:()=>Zl,PaginatedRequestSchema:()=>Ql,PaginatedResultSchema:()=>$l,PingRequestSchema:()=>ql,PrimitiveSchemaDefinitionSchema:()=>Ad,ProgressNotificationParamsSchema:()=>Yl,ProgressNotificationSchema:()=>Xl,ProgressSchema:()=>Jl,ProgressTokenSchema:()=>pl,PromptArgumentSchema:()=>Au,PromptListChangedNotificationSchema:()=>Gu,PromptMessageSchema:()=>Uu,PromptReferenceSchema:()=>zd,PromptSchema:()=>ju,ReadResourceRequestParamsSchema:()=>pu,ReadResourceRequestSchema:()=>mu,ReadResourceResultSchema:()=>hu,RelatedTaskMetadataSchema:()=>gl,RequestIdSchema:()=>Sl,RequestMetaSchema:()=>_l,RequestSchema:()=>W,ResourceContentsSchema:()=>eu,ResourceLinkSchema:()=>Vu,ResourceListChangedNotificationSchema:()=>gu,ResourceRequestParamsSchema:()=>fu,ResourceSchema:()=>ou,ResourceTemplateReferenceSchema:()=>Rd,ResourceTemplateSchema:()=>su,ResourceUpdatedNotificationParamsSchema:()=>Ou,ResourceUpdatedNotificationSchema:()=>ku,ResultMetaObjectSchema:()=>xl,ResultSchema:()=>G,RoleSchema:()=>iu,RootSchema:()=>Ud,RootsListChangedNotificationSchema:()=>Kd,SamplingContentSchema:()=>fd,SamplingMessageContentBlockSchema:()=>pd,SamplingMessageSchema:()=>md,ServerCapabilitiesSchema:()=>Hl,ServerNotificationSchema:()=>ff,ServerRequestSchema:()=>df,ServerResultSchema:()=>pf,ServerTasksCapabilitySchema:()=>Rl,SetLevelRequestParamsSchema:()=>id,SetLevelRequestSchema:()=>ad,SingleSelectEnumSchemaSchema:()=>Td,StringSchemaSchema:()=>bd,SubscribeRequestParamsSchema:()=>_u,SubscribeRequestSchema:()=>vu,SubscriptionFilterSchema:()=>xu,SubscriptionsAcknowledgedNotificationParamsSchema:()=>wu,SubscriptionsAcknowledgedNotificationSchema:()=>Tu,SubscriptionsListenRequestParamsSchema:()=>Su,SubscriptionsListenRequestSchema:()=>Cu,SubscriptionsListenResultMetaSchema:()=>Eu,SubscriptionsListenResultSchema:()=>Du,TaskAugmentedRequestParamsSchema:()=>vl,TaskCreationParamsSchema:()=>qd,TaskMetadataSchema:()=>hl,TaskSchema:()=>Yd,TaskStatusNotificationParamsSchema:()=>Zd,TaskStatusNotificationSchema:()=>Qd,TaskStatusSchema:()=>Jd,TextContentSchema:()=>Iu,TextResourceContentsSchema:()=>tu,TitledMultiSelectEnumSchemaSchema:()=>Dd,TitledSingleSelectEnumSchemaSchema:()=>Cd,ToolAnnotationsSchema:()=>Ku,ToolChoiceSchema:()=>ud,ToolExecutionSchema:()=>qu,ToolListChangedNotificationSchema:()=>td,ToolResultContentSchema:()=>dd,ToolSchema:()=>Ju,ToolUseContentSchema:()=>zu,UnsubscribeRequestParamsSchema:()=>yu,UnsubscribeRequestSchema:()=>bu,UntitledMultiSelectEnumSchemaSchema:()=>Ed,UntitledSingleSelectEnumSchemaSchema:()=>Sd}),im=e=>Cl.safeParse(e).success,am=e=>wl.safeParse(e).success,om=e=>Tl.safeParse(e).success,sm=e=>El.safeParse(e).success;Y.InvalidRequest,Y.UnsupportedProtocolVersion,Y.InvalidParams,Y.MethodNotFound,Y.InvalidParams,Y.MissingRequiredClientCapability,Y.ParseError,Y.InvalidRequest,Y.MethodNotFound,Y.UnsupportedProtocolVersion,Y.MissingRequiredClientCapability;function cm(e,t){return vs(e,t)}function lm(e){return new Set(e.flatMap(e=>Object.keys(e.shape)))}function um(e){if(e==null)return!1;let t=typeof e;return t!==`object`&&t!==`function`||!(`~standard`in e)?!1:typeof e[`~standard`]?.validate==`function`}var dm=!1,fm=`draft-2020-12`;function pm(e,t=`input`){let n=e[`~standard`],r;if(n.jsonSchema)r=n.jsonSchema[t]({target:fm});else if(n.vendor===`zod`){if(!(`_zod`in e))throw Error(`Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().`);dm||(dm=!0,console.warn("[mcp-sdk] Your zod version does not implement `~standard.jsonSchema` (added in zod 4.2.0). Falling back to z.toJSONSchema(). Upgrade to zod >=4.2.0 to silence this warning.")),r=fs(e,{target:fm,io:t})}else throw Error(`Schema library "${n.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t===`output`)return r.type===void 0&&mm(r)?{type:`object`,...r}:r;if(r.type!==void 0&&r.type!==`object`)throw Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(r.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:`object`,...r}}function mm(e){if(`properties`in e||`patternProperties`in e||`additionalProperties`in e||`required`in e)return!0;for(let t of[`oneOf`,`anyOf`,`allOf`]){let n=e[t];if(Array.isArray(n)&&n.length>0)return n.every(e=>typeof e==`object`&&!!e&&(e.type===`object`||mm(e)))}return!1}function hm(e){return e.path?.length?`${e.path.map(e=>String(typeof e==`object`?e.key:e)).join(`.`)}: ${e.message}`:e.message}async function gm(e,t){let n=await e[`~standard`].validate(t);return n.issues&&n.issues.length>0?{success:!1,error:n.issues.map(e=>hm(e)).join(`, `)}:{success:!0,data:n.value}}function _m(e){let t=fs(e,{target:fm,io:`input`});return typeof t.pattern==`string`?t.pattern:void 0}var vm=/\\\.\\d\{(\d+)\}/;function ym(e){let t=vm.exec(e),n=[void 0,-1,0];return t&&n.push(Number(t[1])),[!1,!0].flatMap(e=>[!1,!0].flatMap(t=>n.map(n=>el({local:e,offset:t,precision:n}))))}function bm(e,t){let n;switch(e){case`email`:n=[Ls()];break;case`uri`:n=[Vs()];break;case`date`:n=[tl()];break;case`date-time`:n=ym(t)}return new Set(n.map(e=>_m(e)).filter(e=>e!==void 0))}function xm(e,t,n){return n!==`zod`||bm(e,t).has(t)}function Sm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Cm(e){try{return pm(e,`input`)}catch(e){let t=e instanceof Error?e.message:String(e);throw new X(Y.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${t}`)}}var wm=new Set([`$comment`,`deprecated`,`description`,`examples`,`readOnly`,`title`,`writeOnly`]);function Tm(e){return wm.has(e)||e.startsWith(`x-`)}var Em=new Set([`$schema`,...Object.keys(jd.shape.requestedSchema.shape)]),Dm={string:lm([bd,Sd,Cd,wd]),number:lm([xd]),integer:lm([xd]),boolean:lm([yd]),array:lm([Ed,Dd])},Om=new Set(bd.shape.format.unwrap().options);function km(e,t,n,r){if(!Sm(e))return e;let i=typeof e.type==`string`&&Object.hasOwn(Dm,e.type)?Dm[e.type]:void 0;if(i===void 0)return e;let a={};for(let[o,s]of Object.entries(e))i.has(o)||Tm(o)?a[o]=s:o===`pattern`&&e.type===`string`&&typeof e.format==`string`?Om.has(e.format)?(typeof s!=`string`||!xm(e.format,s,n))&&r.push(`${t}.${o}`):a[o]=s:r.push(`${t}.${o}`);return a}function Am(e,t){let n={},r=[];for(let[i,a]of Object.entries(e))i===`properties`&&Sm(a)?n[i]=Object.fromEntries(Object.entries(a).map(([e,n])=>[e,km(n,`properties.${e}`,t,r)])):Em.has(i)?n[i]=a:Tm(i)||r.push(i);if(r.length>0)throw new X(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${r.join(`, `)}`);return n}function jm(e,t){if(!Sm(e.properties))return t;let n=Object.entries(e.properties).filter(([,e])=>!cm(Ad,e).success).map(([e])=>`properties.${e}`);return n.length>0?n.join(`, `):t}function Mm(e,t,n=``){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((e,r)=>Mm(e,t[r],`${n}[${r}]`)):!Sm(e)||!Sm(t)?[]:Object.entries(e).flatMap(([e,r])=>{let i=n?`${n}.${e}`:e;return Object.prototype.hasOwnProperty.call(t,e)?Mm(r,t[e],i):Tm(e)?[]:[i]})}function Nm(e){if(!um(e.requestedSchema))return{...e,mode:`form`,requestedSchema:e.requestedSchema};let t=e.requestedSchema[`~standard`].vendor,n=Am(Cm(e.requestedSchema),t),r=cm(jd.shape.requestedSchema,n);if(!r.success)throw new X(Y.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${jm(n,r.error.message)}`);let i=Mm(n,r.data);if(i.length>0)throw new X(Y.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${i.join(`, `)}`);let a=(r.data.required??[]).filter(e=>!Object.prototype.hasOwnProperty.call(r.data.properties,e));if(a.length>0)throw new X(Y.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${a.join(`, `)}`);return{...e,mode:`form`,requestedSchema:r.data}}function Pm(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,n=typeof e.requestState==`string`;if(!t&&!n)throw TypeError(`inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)`);return{resultType:`input_required`,...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}Object.assign(Pm,{elicit(e){try{return{method:`elicitation/create`,params:Nm(e)}}catch(e){throw e instanceof X?TypeError(e.message,{cause:e}):e}},elicitUrl(e){return{method:`elicitation/create`,params:{...e,mode:`url`}}},createMessage(e){return{method:`sampling/createMessage`,params:e}},listRoots(){return{method:`roots/list`}}});var Fm=`AnnotationsSchema.AudioContentSchema.BaseMetadataSchema.BlobResourceContentsSchema.BooleanSchemaSchema.CallToolRequestSchema.CallToolRequestParamsSchema.CallToolResultSchema.CancelledNotificationSchema.CancelledNotificationParamsSchema.CancelTaskRequestSchema.CancelTaskResultSchema.ClientCapabilitiesSchema.ClientNotificationSchema.ClientRequestSchema.ClientResultSchema.CompatibilityCallToolResultSchema.CompleteRequestSchema.CompleteRequestParamsSchema.CompleteResultSchema.ContentBlockSchema.CreateMessageRequestSchema.CreateMessageRequestParamsSchema.CreateMessageResultSchema.CreateMessageResultWithToolsSchema.CreateTaskResultSchema.CursorSchema.DiscoverRequestSchema.DiscoverResultSchema.ElicitationCompleteNotificationSchema.ElicitationCompleteNotificationParamsSchema.ElicitRequestSchema.ElicitRequestFormParamsSchema.ElicitRequestParamsSchema.ElicitRequestURLParamsSchema.ElicitResultSchema.EmbeddedResourceSchema.EmptyResultSchema.EnumSchemaSchema.GetPromptRequestSchema.GetPromptRequestParamsSchema.GetPromptResultSchema.GetTaskPayloadRequestSchema.GetTaskPayloadResultSchema.GetTaskRequestSchema.GetTaskResultSchema.IconSchema.IconsSchema.ImageContentSchema.ImplementationSchema.InitializedNotificationSchema.InitializeRequestSchema.InitializeRequestParamsSchema.InitializeResultSchema.JSONArraySchema.JSONObjectSchema.JSONRPCErrorResponseSchema.JSONRPCMessageSchema.JSONRPCNotificationSchema.JSONRPCRequestSchema.JSONRPCResponseSchema.JSONRPCResultResponseSchema.JSONValueSchema.LegacyTitledEnumSchemaSchema.ListPromptsRequestSchema.ListPromptsResultSchema.ListResourcesRequestSchema.ListResourcesResultSchema.ListResourceTemplatesRequestSchema.ListResourceTemplatesResultSchema.ListRootsRequestSchema.ListRootsResultSchema.ListTasksRequestSchema.ListTasksResultSchema.ListToolsRequestSchema.ListToolsResultSchema.LoggingLevelSchema.LoggingMessageNotificationSchema.LoggingMessageNotificationParamsSchema.ModelHintSchema.ModelPreferencesSchema.MultiSelectEnumSchemaSchema.NotificationSchema.NumberSchemaSchema.PaginatedRequestSchema.PaginatedRequestParamsSchema.PaginatedResultSchema.PingRequestSchema.PrimitiveSchemaDefinitionSchema.ProgressSchema.ProgressNotificationSchema.ProgressNotificationParamsSchema.ProgressTokenSchema.PromptSchema.PromptArgumentSchema.PromptListChangedNotificationSchema.PromptMessageSchema.PromptReferenceSchema.ReadResourceRequestSchema.ReadResourceRequestParamsSchema.ReadResourceResultSchema.RelatedTaskMetadataSchema.RequestSchema.RequestIdSchema.RequestMetaSchema.ResourceSchema.ResourceContentsSchema.ResourceLinkSchema.ResourceListChangedNotificationSchema.ResourceRequestParamsSchema.ResourceTemplateSchema.ResourceTemplateReferenceSchema.ResourceUpdatedNotificationSchema.ResourceUpdatedNotificationParamsSchema.ResultMetaObjectSchema.ResultSchema.RoleSchema.RootSchema.RootsListChangedNotificationSchema.SamplingContentSchema.SamplingMessageSchema.SamplingMessageContentBlockSchema.ServerCapabilitiesSchema.ServerNotificationSchema.ServerRequestSchema.ServerResultSchema.SetLevelRequestSchema.SetLevelRequestParamsSchema.SingleSelectEnumSchemaSchema.StringSchemaSchema.SubscribeRequestSchema.SubscribeRequestParamsSchema.SubscriptionFilterSchema.SubscriptionsAcknowledgedNotificationSchema.SubscriptionsAcknowledgedNotificationParamsSchema.SubscriptionsListenRequestSchema.SubscriptionsListenRequestParamsSchema.SubscriptionsListenResultSchema.SubscriptionsListenResultMetaSchema.TaskAugmentedRequestParamsSchema.TaskCreationParamsSchema.TaskMetadataSchema.TaskSchema.TaskStatusSchema.TaskStatusNotificationSchema.TaskStatusNotificationParamsSchema.TextContentSchema.TextResourceContentsSchema.TitledMultiSelectEnumSchemaSchema.TitledSingleSelectEnumSchemaSchema.ToolSchema.ToolAnnotationsSchema.ToolChoiceSchema.ToolExecutionSchema.ToolListChangedNotificationSchema.ToolResultContentSchema.ToolUseContentSchema.UnsubscribeRequestSchema.UnsubscribeRequestParamsSchema.UntitledMultiSelectEnumSchemaSchema.UntitledSingleSelectEnumSchemaSchema`.split(`.`),Im={IdJagTokenExchangeResponseSchema:yf,OAuthClientInformationFullSchema:wf,OAuthClientInformationSchema:Cf,OAuthClientMetadataSchema:Sf,OAuthClientRegistrationErrorSchema:Tf,OAuthErrorResponseSchema:bf,OAuthMetadataSchema:hf,OAuthProtectedResourceMetadataSchema:mf,OAuthTokenRevocationRequestSchema:Ef,OAuthTokensSchema:vf,OpenIdProviderDiscoveryMetadataSchema:_f,OpenIdProviderMetadataSchema:gf},Lm={},Rm={};function zm(e,t){let n=e.slice(0,-6);Lm[n]=t,Rm[n]=e=>t.safeParse(e).success}for(let e of Fm)zm(e,rm[e]);for(let[e,t]of Object.entries(Im))zm(e,t);Object.freeze(Lm),Object.freeze(Rm);function Bm(e){switch(e){case`initialize`:case`notifications/initialized`:return Qp(void 0);case`server/discover`:return Qp(Zp);default:return}}var Vm=[al,ol,cl,ul],Hm=[`inputResponses`,`requestState`];function Um(e,t){let n=e.params;if(!Jm(n))return{message:e,lifted:{}};let r=n._meta,i=Jm(r)?Vm.filter(e=>e in r):[],a=t===`request`?Hm.filter(e=>e in n):[];if(i.length===0&&a.length===0)return{message:e,lifted:{}};let o={},s={...n};if(i.length>0&&Jm(r)){let e={},t={...r};for(let n of i)e[n]=r[n],delete t[n];o.envelope=e,Object.keys(t).length>0?s._meta=t:delete s._meta}for(let e of a)e===`inputResponses`&&(o.inputResponses=s[e]),e===`requestState`&&(o.requestState=s[e]),delete s[e];return{message:{...e,params:s},lifted:o}}function Wm(e,t){let n=e.validateResult(t,void 0);if(n.ok||n.reason!==`not-in-era`)return{"~standard":{version:1,vendor:`mcp-wire-codec`,validate(n){let r=e.validateResult(t,n);return r.ok?{value:r.value}:{issues:[{message:r.reason===`invalid`?r.message:`not-in-era: ${t}`}]}}}}}function Gm(e){return()=>e}var Km=Gm(void 0),qm=class{_transport;_requestMessageId=0;_requestHandlers=new Map;_requestHandlerAbortControllers=new Map;_notificationHandlers=new Map;_responseHandlers=new Map;_progressHandlers=new Map;_timeoutInfo=new Map;_pendingDebouncedNotifications=new Set;_negotiatedProtocolVersion;_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??rl,this.setNotificationHandler(`notifications/cancelled`,e=>{this._oncancel(e)}),this.setNotificationHandler(`notifications/progress`,e=>{this._onprogress(e)}),this.setRequestHandler(`ping`,e=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let n=e.params??{};return{...e,params:{...n,_meta:{...t,...n._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new J(q.UnsupportedResultType,`Unsupported result type '${e.kind}' for ${t.request.method}`,{resultType:e.kind,method:t.request.method}))}_getRequestHandler(e){return this._requestHandlers.get(e)}async _oncancel(e){e.params.requestId!==void 0&&this._requestHandlerAbortControllers.get(e.params.requestId)?.abort(e.params.reason)}_setupTimeout(e,t,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),new J(q.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){this._transport=e;let t=this.transport?.onclose;this._transport.onclose=()=>{try{t?.()}finally{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),om(e)||sm(e)?this._onresponse(e):im(e)?this._onrequest(e,t):am(e)?this._onnotification(e,t):this._onerror(Error(`Unknown message type: ${JSON.stringify(e)}`))},e.setSupportedProtocolVersions?.(this._supportedProtocolVersions),await this._transport.start()}_onclose(){let e=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._pendingDebouncedNotifications.clear();for(let e of this._timeoutInfo.values())clearTimeout(e.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let n=new J(q.ConnectionClosed,`Connection closed`);this._transport=void 0;try{this.onclose?.()}finally{for(let t of e.values())t(n);for(let e of t.values())e.abort(n)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:n}=Um(e,`notification`),r=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`)return;if(t?.classification!==void 0){let e=$p(t.classification);if(e!==r.era){this._onerror(Error(`Era mismatch on inbound notification '${n.method}': classified as ${e} but this instance serves ${r.era}`));return}}if(tm(n.method)&&!r.hasNotificationMethod(n.method))return;let i=this._notificationHandlers.get(n.method),a=this.fallbackNotificationHandler;(i!==void 0||a!==void 0)&&Promise.resolve().then(()=>i===void 0?a(n):i(n,r)).catch(e=>this._onerror(Error(`Uncaught error in notification handler: ${e}`)))}_onrequest(e,t){let{message:n,lifted:r}=Um(e,`request`),i=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)===`drop`){this._onerror(Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let a=this._transport,o=(e,t,r)=>{let i={jsonrpc:`2.0`,id:n.id,error:{code:e,message:t,...r!==void 0&&{data:r}}};a?.send(i).catch(e=>this._onerror(Error(`Failed to send an error response: ${e}`)))};if(t?.classification!==void 0){let e=$p(t.classification);if(e!==i.era){this._onerror(Error(`Era mismatch on inbound request '${n.method}': classified as ${e} but this instance serves ${i.era}`));let r=t.classification.revision??e;o(Y.UnsupportedProtocolVersion,`Unsupported protocol version: ${r}`,{supported:this._supportedProtocolVersions,requested:r});return}}if(em(n.method)&&!i.hasRequestMethod(n.method)){o(Y.MethodNotFound,`Method not found`);return}let s=this._requestHandlers.get(n.method)??this.fallbackRequestHandler;if(s===void 0){o(Y.MethodNotFound,`Method not found`);return}let c=i.checkInboundEnvelope(r);if(c!==void 0){o(Y.InvalidParams,c);return}let l=(e,t)=>this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,{...t,relatedRequestId:n.id}),u=(e,t,r)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(e.method),e,t,{...r,relatedRequestId:n.id}),d=new AbortController;this._requestHandlerAbortControllers.set(n.id,d);let f=r.inputResponses===void 0?void 0:Xm(r.inputResponses),p={sessionId:a?.sessionId,mcpReq:{id:n.id,method:n.method,_meta:n.params?._meta,...r.envelope!==void 0&&{envelope:r.envelope},...f!==void 0&&{inputResponses:f.accepted},...f!==void 0&&f.droppedKeys.length>0&&{droppedInputResponseKeys:f.droppedKeys},requestState:r.requestState===void 0?Km:Gm(r.requestState),signal:d.signal,send:((e,t,n)=>{let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),um(t))return u(e,t,n);let i=Wm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return u(e,i,t)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},m=this.buildContext(p,t);Promise.resolve().then(()=>s(n,m)).then(async e=>{if(d.signal.aborted)return;let t;try{t=i.encodeResult(n.method,e,this._outboundServerInfo())}catch(e){this._onerror(Error(`Failed to encode result for ${n.method}: ${e}`)),o(Y.InternalError,`Internal error`);return}let r={result:t,jsonrpc:`2.0`,id:n.id};await a?.send(r)},async e=>{if(d.signal.aborted)return;let t=Number.isSafeInteger(e.code)?e.code:Y.InternalError,r={jsonrpc:`2.0`,id:n.id,error:{code:i.encodeErrorCode(t),message:e.message??`Internal error`,...e.data!==void 0&&{data:e.data}}};await a?.send(r)}).catch(e=>this._onerror(Error(`Failed to send response: ${e}`))).finally(()=>{this._requestHandlerAbortControllers.get(n.id)===d&&this._requestHandlerAbortControllers.delete(n.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._responseHandlers.get(t);if(n===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),om(e)?n(e):n(X.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,n){let r=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(r,e.method),um(t))return this._requestWithSchemaViaCodec(r,e,t,n);let i=Wm(r,e.method);if(i===void 0)throw TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(r,e,i,t)}_negotiatedWireCodec(){return Qp(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=Bm(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(em(t)&&!e.hasRequestMethod(t))throw new J(q.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,n){let r=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(r,e.method),this._requestWithSchemaViaCodec(r,e,t,n)}_requestWithSchemaViaCodec(e,t,n,r){let{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s}=r??{},c=Date.now(),l,u;return new Promise((d,f)=>{let p=e=>{f(e)};if(!this._transport){p(Error(`Not connected`));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(e){p(e);return}if(r?.signal?.aborted){let e=r.signal.reason;throw e instanceof J?e:new J(q.RequestTimeout,String(e))}let m=e.era===`2026-07-28`&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,h=this._requestMessageId++;u=h;let ee={...t,jsonrpc:`2.0`,id:h};r?.onprogress&&(this._progressHandlers.set(h,r.onprogress),ee.params={...t.params,_meta:{...t.params?._meta,progressToken:h}});let g=this._envelopeOutbound(ee),te=!1,ne=e=>{te||(this._progressHandlers.delete(h),m===void 0?t.method!==`initialize`&&this._transport?.send(this._envelopeOutbound({jsonrpc:`2.0`,method:`notifications/cancelled`,params:{requestId:h,reason:String(e)}}),{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o}).catch(e=>this._onerror(Error(`Failed to send cancellation: ${e}`))):m.abort(),f(e instanceof J?e:new J(q.RequestTimeout,String(e))))};this._responseHandlers.set(h,i=>{if(r?.signal?.aborted)return;if(te=!0,i instanceof Error)return f(i);let a;try{a=e.decodeResult(t.method,i.result)}catch(e){return f(e instanceof Error?e:Error(String(e)))}if(a.kind===`invalid`)return f(a.error);if(a.kind===`input_required`){if(r?.allowInputRequired===!0)return d(Zm(a));let i={codec:e,request:t,resultSchema:n,options:r,flowStartedAt:c,retry:(r,i)=>this._requestWithSchemaViaCodec(e,r===void 0?{method:t.method}:{method:t.method,params:r},n,i)};return d(this._resolveNonCompleteResult(a,i))}let o=a.result;gm(n,o).then(e=>{e.success?d(e.data):f(new J(q.InvalidResult,`Invalid result for ${t.method}: ${e.error}`))},f)}),l=()=>ne(r?.signal?.reason),r?.signal?.addEventListener(`abort`,l,{once:!0});let re=r?.timeout??6e4;this._setupTimeout(h,re,r?.maxTotalTimeout,()=>ne(new J(q.RequestTimeout,`Request timed out`,{timeout:re})),r?.resetTimeoutOnProgress??!1),this._transport.send(g,{relatedRequestId:i,resumptionToken:a,onresumptiontoken:o,headers:s,requestSignal:m?.signal}).catch(e=>{this._progressHandlers.delete(h),f(e)})}).finally(()=>{l&&r?.signal?.removeEventListener(`abort`,l),u!==void 0&&(this._responseHandlers.delete(u),this._cleanupTimeout(u))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,n){if(!this._transport)throw new J(q.NotConnected,`Not connected`);if(tm(t.method)&&!e.hasNotificationMethod(t.method))throw new J(q.MethodNotSupportedByProtocolVersion,`Notification '${t.method}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t.method,era:e.era});this.assertNotificationCapability(t.method);let r=this._envelopeOutbound({jsonrpc:`2.0`,...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&n?.relatedRequestId===void 0){if(this._pendingDebouncedNotifications.has(t.method))return;this._pendingDebouncedNotifications.add(t.method),Promise.resolve().then(()=>{this._pendingDebouncedNotifications.delete(t.method),this._transport&&this._transport?.send(r,n).catch(e=>this._onerror(e))});return}await this._transport.send(r,n)}setRequestHandler(e,t,n){this.assertRequestHandlerCapability(e);let r;if(typeof t==`function`){if(!em(e))throw TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);r=(n,r)=>{let i=this._negotiatedWireCodec(),a=i.validateRequest(e,n);if(!a.ok&&a.reason===`not-in-era`&&(a=i.validateInputRequest(e,n)),!a.ok)throw a.reason===`not-in-era`?new X(Y.InternalError,`No wire schema for ${e} in the resolved era`):Error(a.message);return Promise.resolve(t(a.value,r))}}else if(n)r=async(r,i)=>{let a=await gm(t.params,{...r.params});if(!a.success)throw new X(Y.InvalidParams,`Invalid params for ${e}: ${a.error}`);return n(a.data,i)};else throw TypeError(`setRequestHandler: handler is required`);this._requestHandlers.set(e,this._wrapHandler(e,r))}_wrapHandler(e,t){return t}_outboundServerInfo(){}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,n){if(typeof t==`function`){if(!tm(e))throw TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,r)=>{let i=r.validateNotification(e,n);if(!i.ok)throw i.reason===`not-in-era`?new X(Y.InternalError,`No wire schema for ${e} in the resolved era`):Error(i.message);return Promise.resolve(t(i.value))});return}if(!n)throw TypeError(`setNotificationHandler: handler is required`);this._notificationHandlers.set(e,async r=>{let i=await gm(t.params,{...r.params});if(!i.success)throw new X(Y.InvalidParams,`Invalid params for notification ${e}: ${i.error}`);await n(i.data,r)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function Jm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ym(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Xm(e){let t={},n=[];if(!Ym(e))return{accepted:t,droppedKeys:n};for(let[r,i]of Object.entries(e)){if(!Ym(i)||`method`in i||`result`in i){n.push(r);continue}t[r]=i}return{accepted:t,droppedKeys:n}}function Zm(e){return{resultType:`input_required`,inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}t((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,n=/\\([\u000b\u0020-\u00ff])/g,r=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=i;function i(e){if(!e)throw TypeError(`argument string is required`);var i=typeof e==`object`?a(e):e;if(typeof i!=`string`)throw TypeError(`argument string is required to be a string`);var s=i.indexOf(`;`),c=s===-1?i.trim():i.slice(0,s).trim();if(!r.test(c))throw TypeError(`invalid media type`);var l=new o(c.toLowerCase());if(s!==-1){var u,d,f;for(t.lastIndex=s;d=t.exec(i);){if(d.index!==s)throw TypeError(`invalid parameter format`);s+=d[0].length,u=d[1].toLowerCase(),f=d[2],f.charCodeAt(0)===34&&(f=f.slice(1,-1),f.indexOf(`\\`)!==-1&&(f=f.replace(n,`$1`))),l.parameters[u]=f}if(s!==i.length)throw TypeError(`invalid parameter format`)}return l}function a(e){var t;if(typeof e.getHeader==`function`?t=e.getHeader(`content-type`):typeof e.headers==`object`&&(t=e.headers&&e.headers[`content-type`]),typeof t!=`string`)throw TypeError(`content-type header is missing from object`);return t}function o(e){this.parameters=Object.create(null),this.type=e}}))(),typeof self<`u`&&self.location&&self.location.origin!==`null`?new URL(self.location.origin+self.location.pathname+location.search):new URL(`https://github.com/cfworker`);var Qm=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,$m=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,eh=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,th=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,nh=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,rh=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,ih=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ah=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,oh=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,sh=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,ch=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i;function lh(e){return e.test.bind(e)}uh.bind(void 0,!1),lh(eh),lh(th),lh(nh),lh($m),lh(sh),lh(ch),lh(rh),lh(ih),lh(ah),lh(oh);function uh(e,t){let n=t.match(Qm);if(!n)return!1;let r=+n[1],i=+n[2],a=+n[3],o=!!n[5];return(r<=23&&i<=59&&a<=59||r==23&&i==59&&a==60)&&(!e||o)}globalThis.crypto;var dh=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.OAuthClientFlowError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e){super(e),this.name=new.target.name,Of(this,new.target)}};(class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.IssuerMismatchError`})}kind;expected;received;constructor(e,t,n){super(`Issuer mismatch in ${e===`metadata`?`authorization server metadata (RFC 8414 §3.3)`:`authorization response (RFC 9207)`}: expected ${JSON.stringify(t)}, received ${JSON.stringify(n)}`),this.kind=e,this.expected=t,this.received=n}}),class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.RegistrationRejectedError`})}status;body;submittedMetadata;constructor(e){super(`Dynamic Client Registration rejected (HTTP ${e.status}): ${e.body}`),this.status=e.status,this.body=e.body,this.submittedMetadata=e.submittedMetadata}},class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsecureTokenEndpointError`})}tokenEndpoint;constructor(e){super(`Refusing to send credentials to non-https token endpoint '${e}'. OAuth token requests MUST use TLS (localhost / 127.0.0.1 / ::1 are exempt).`),this.tokenEndpoint=e}},class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.AuthorizationServerMismatchError`})}constructor(e,t){super(`Authorization server changed between redirect and callback (redirected to ${JSON.stringify(e)}, callback resolved ${JSON.stringify(t)}); refusing to send authorization_code/code_verifier to a different token endpoint`),this.recordedIssuer=e,this.currentIssuer=t}},class extends dh{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.InsufficientScopeError`})}requiredScope;resourceMetadataUrl;errorDescription;constructor(e){super(`Insufficient scope${e.requiredScope?`: required "${e.requiredScope}"`:``}`),this.requiredScope=e.requiredScope,this.resourceMetadataUrl=e.resourceMetadataUrl,this.errorDescription=e.errorDescription}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.UnauthorizedError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e){super(e??`Unauthorized`),this.name=`UnauthorizedError`,Of(this,new.target)}},class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:`mcp.SseError`})}static[Symbol.hasInstance](e){return kf(this,e)}static isInstance(e){if(typeof this!=`function`)throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return kf(this,e)}constructor(e,t,n){super(`SSE error: ${t}`),this.code=e,this.event=n,Of(this,new.target)}};var fh=class{_eventSlots=new Map;setHandler(e,t){let n=this._ensureEventSlot(e);n.onHandler&&t&&console.warn(`[MCP Apps] on${String(e)} handler replaced. Use addEventListener("${String(e)}", …) to add multiple listeners without replacing.`),n.onHandler=t}getHandler(e){return this._eventSlots.get(e)?.onHandler}addEventListener(e,t){this._ensureEventSlot(e).listeners.push(t)}removeEventListener(e,t){let n=this._eventSlots.get(e);if(!n)return;let r=n.listeners.indexOf(t);r!==-1&&n.listeners.splice(r,1)}dispatch(e,t){let n=this._eventSlots.get(e);if(n){n.onHandler?.(t);for(let e of[...n.listeners])e(t)}}_ensureEventSlot(e){let t=this._eventSlots.get(e);return t||(t={listeners:[]},this._eventSlots.set(e,t)),t}},ph=class{_methods=new Set;claim(e,t){if(this._methods.has(e))throw Error(`Handler for "${e}" already registered (via ${t}). Use addEventListener() to attach multiple listeners, or the on* setter for replace semantics.`);this._methods.add(e)}replace(e){this._methods.add(e)}release(e){this._methods.delete(e)}has(e){return this._methods.has(e)}},mh=new Set;function hh(e,t){let[n,r]=t,i=n?.shape;if(typeof i?.method?.value!=`string`)return;let a=i.method.value,o=e===`request`?`setRequestHandler`:`setNotificationHandler`;mh.has(o)||(mh.add(o),console.warn(`[ext-apps] ${o}(Schema, handler) is deprecated; use ${o}("${a}", { params: Schema.shape.params }, handler).`));let s=r;return[a,{params:i.params},e===`request`?(e,t)=>s({method:a,params:e},gh(t)):e=>s({method:a,params:e})]}function gh(e){return{signal:e.mcpReq.signal,requestId:e.mcpReq.id,sessionId:e.sessionId,_meta:e.mcpReq._meta,sendRequest:e.mcpReq.send,sendNotification:e.mcpReq.notify,authInfo:e.http?.authInfo}}var _h=`2026-01-26`,vh=class{eventTarget;eventSource;messageListener;constructor(e=window.parent,t){this.eventTarget=e,this.eventSource=t,this.messageListener=e=>{if(t&&e.source!==this.eventSource){console.debug(`Ignoring message from unknown source`,e);return}let n=Dl.safeParse(e.data);n.success?(console.debug(`Parsed message`,n.data),this.onmessage?.(n.data)):e.data?.jsonrpc===`2.0`?(console.error(`Failed to parse message`,n.error.message,e),this.onerror?.(Error(`Invalid JSON-RPC message received: `+n.error.message))):console.debug(`Ignoring non-JSON-RPC message`,n.error.message,e)}}async start(){window.addEventListener(`message`,this.messageListener)}async send(e,t){e.method!==`ui/notifications/tool-input-partial`&&console.debug(`Sending message`,e),this.eventTarget.postMessage(e,`*`)}async close(){window.removeEventListener(`message`,this.messageListener),this.onclose?.()}onclose;onerror;onmessage;sessionId;setProtocolVersion},yh=L([B(`light`),B(`dark`)]).describe(`Color theme preference for the host environment.`),bh=L([B(`inline`),B(`fullscreen`),B(`pip`)]).describe(`Display mode for UI presentation.`),xh=R(L([B(`--color-background-primary`),B(`--color-background-secondary`),B(`--color-background-tertiary`),B(`--color-background-inverse`),B(`--color-background-ghost`),B(`--color-background-info`),B(`--color-background-danger`),B(`--color-background-success`),B(`--color-background-warning`),B(`--color-background-disabled`),B(`--color-text-primary`),B(`--color-text-secondary`),B(`--color-text-tertiary`),B(`--color-text-inverse`),B(`--color-text-ghost`),B(`--color-text-info`),B(`--color-text-danger`),B(`--color-text-success`),B(`--color-text-warning`),B(`--color-text-disabled`),B(`--color-border-primary`),B(`--color-border-secondary`),B(`--color-border-tertiary`),B(`--color-border-inverse`),B(`--color-border-ghost`),B(`--color-border-info`),B(`--color-border-danger`),B(`--color-border-success`),B(`--color-border-warning`),B(`--color-border-disabled`),B(`--color-ring-primary`),B(`--color-ring-secondary`),B(`--color-ring-inverse`),B(`--color-ring-info`),B(`--color-ring-danger`),B(`--color-ring-success`),B(`--color-ring-warning`),B(`--font-sans`),B(`--font-mono`),B(`--font-weight-normal`),B(`--font-weight-medium`),B(`--font-weight-semibold`),B(`--font-weight-bold`),B(`--font-text-xs-size`),B(`--font-text-sm-size`),B(`--font-text-md-size`),B(`--font-text-lg-size`),B(`--font-heading-xs-size`),B(`--font-heading-sm-size`),B(`--font-heading-md-size`),B(`--font-heading-lg-size`),B(`--font-heading-xl-size`),B(`--font-heading-2xl-size`),B(`--font-heading-3xl-size`),B(`--font-text-xs-line-height`),B(`--font-text-sm-line-height`),B(`--font-text-md-line-height`),B(`--font-text-lg-line-height`),B(`--font-heading-xs-line-height`),B(`--font-heading-sm-line-height`),B(`--font-heading-md-line-height`),B(`--font-heading-lg-line-height`),B(`--font-heading-xl-line-height`),B(`--font-heading-2xl-line-height`),B(`--font-heading-3xl-line-height`),B(`--border-radius-xs`),B(`--border-radius-sm`),B(`--border-radius-md`),B(`--border-radius-lg`),B(`--border-radius-xl`),B(`--border-radius-full`),B(`--border-width-regular`),B(`--shadow-hairline`),B(`--shadow-sm`),B(`--shadow-md`),B(`--shadow-lg`)]).describe(`CSS variable keys available to MCP apps for theming.`).describe(`Style variables for theming MCP apps.
|
|
63
63
|
|
|
64
64
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
65
65
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
package/package.json
CHANGED