diff --git a/CHANGELOG.md b/CHANGELOG.md index 6499539..73d04cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format ## [Unreleased] +## [1.1.1] - 2026-08-12 + +### Changed + +- [#399](https://github.com/mohanagy/miftah/issues/399) Prepared the compatible v1.1.1 patch release for Claude Desktop tool-catalog compatibility. Publication remains gated on exact `development`-to-`main` promotion and protected OIDC trusted publishing, registry provenance, a fresh install, and package-signature verification. + +### Fixed + +- [#397](https://github.com/mohanagy/miftah/issues/397) Preserved valid JSON Schema objects when tool input names look credential-related, so Vercel and Firebase catalogs no longer fail MCP client validation after redaction. Distinct sensitive schema keys now receive stable collision-free aliases that remain consistent across definitions and dependent references. Client-visible schema-valued `true` is emitted as its equivalent `{}` form for Claude Desktop proxy compatibility, while `false` constraints, ordinary boolean values, configured-secret redaction, bearer redaction, and provider-token redaction remain unchanged. + ## [1.1.0] - 2026-08-12 ### Added diff --git a/README.md b/README.md index 914c56a..613399a 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Install Miftah, then choose the terminal wizard or the browser Console. Both use ### 1. Install the current release ```bash -npm install -g @lubab/miftah@1.1.0 +npm install -g @lubab/miftah@1.1.1 miftah version ``` diff --git a/docs/mcp-compatibility.md b/docs/mcp-compatibility.md index 154d911..ab39650 100644 --- a/docs/mcp-compatibility.md +++ b/docs/mcp-compatibility.md @@ -2,7 +2,7 @@ This page is the compatibility source of truth for Miftah's downstream MCP server. It records protocol-era behavior separately from generated client-configuration support and from upstream MCP transport support. A generated snippet proves only that Miftah emitted the documented JSON shape; it does not prove that an untested host completed a protocol exchange. -- Miftah baseline: `1.1.0` +- Miftah baseline: `1.1.1` - Locked MCP TypeScript packages: `@modelcontextprotocol/client`, `core`, `server`, `node`, and `server-legacy` `2.0.0` - Evidence date: 2026-08-12 - Modern protocol era: `2026-07-28` diff --git a/docs/presets-and-clients.md b/docs/presets-and-clients.md index 0c39118..23ee244 100644 --- a/docs/presets-and-clients.md +++ b/docs/presets-and-clients.md @@ -5,7 +5,7 @@ This is the compatibility source of truth for generated `miftah init` configurat For downstream protocol eras and real packaged-host evidence, see [MCP protocol and client compatibility](mcp-compatibility.md). The tables below validate generated configuration shapes; they do not by themselves establish a runtime exchange with Claude Desktop, Claude Code, Cursor, or VS Code. - Catalog version: `3` -- Miftah package version: `1.1.0` +- Miftah package version: `1.1.1` - Last tested / validation boundary: the catalog builds strict Miftah configuration that `validateConfig` accepts. The docs contract test checks generated configuration only; it does **not** construct a runtime, start, authenticate to, or smoke-test external providers. Miftah itself requires Node.js `>=20`. That does not establish an upstream server's Node requirement. diff --git a/docs/whats-new-in-0.5.md b/docs/whats-new-in-0.5.md index 14b87ae..7e54e5b 100644 --- a/docs/whats-new-in-0.5.md +++ b/docs/whats-new-in-0.5.md @@ -1,9 +1,9 @@ # What is in Miftah 0.5 -Install `@lubab/miftah@1.1.0`, the current stable release, to use the guided setup and account-management capabilities introduced in 0.5 instead of assembling a multi-account configuration by hand: +Install `@lubab/miftah@1.1.1`, the current stable release, to use the guided setup and account-management capabilities introduced in 0.5 instead of assembling a multi-account configuration by hand: ```bash -npm install -g @lubab/miftah@1.1.0 +npm install -g @lubab/miftah@1.1.1 miftah version ``` diff --git a/package-lock.json b/package-lock.json index 54a362e..0e7849d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@lubab/miftah", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@lubab/miftah", - "version": "1.1.0", + "version": "1.1.1", "license": "MIT", "dependencies": { "@hono/node-server": "2.0.10", diff --git a/package.json b/package.json index c1b9e23..975b070 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lubab/miftah", - "version": "1.1.0", + "version": "1.1.1", "description": "Wrap any MCP. Use the right account without reconnecting.", "keywords": [ "mcp", diff --git a/src/mcp/server/miftah-server.ts b/src/mcp/server/miftah-server.ts index 8e0fb0b..795a548 100644 --- a/src/mcp/server/miftah-server.ts +++ b/src/mcp/server/miftah-server.ts @@ -1071,7 +1071,10 @@ export class MiftahServer { ? tools.map(stripMcpParameterHeaderAnnotations) : tools }; - } + }, + undefined, + undefined, + (result) => redactToolListResult(result, this.redactor) ); }); @@ -3052,14 +3055,15 @@ export class MiftahServer { }, operation: (audit: AuditScope) => Promise, errorResult?: (error: MiftahError) => Result, - resultAudit?: (result: Result) => AuditScopeResult + resultAudit?: (result: Result) => AuditScopeResult, + resultRedactor?: (result: Result) => Result ): Promise { const audit = this.auditTrail.beginOperation(input); try { await this.auditTrail.ensureWritable(); const result = await operation(audit); await audit.finish(resultAudit?.(result) ?? { status: "success" }); - return this.redactor.redact(result); + return resultRedactor === undefined ? this.redactor.redact(result) : resultRedactor(result); } catch (error) { if (error instanceof ApprovalInputRequiredSignal) { if (!audit.isFinalized) { @@ -3641,6 +3645,198 @@ function stripMcpParameterHeaderAnnotations(tool: Tool): Tool { }; } +const jsonSchemaMapKeywords = new Set([ + "$defs", + "definitions", + "dependentSchemas", + "patternProperties", + "properties" +]); +const jsonSchemaArrayKeywords = new Set(["allOf", "anyOf", "oneOf", "prefixItems"]); +const jsonSchemaValueKeywords = new Set([ + "additionalItems", + "additionalProperties", + "contains", + "contentSchema", + "else", + "if", + "items", + "not", + "propertyNames", + "then", + "unevaluatedItems", + "unevaluatedProperties" +]); + +/** Redacts catalog metadata without mistaking JSON Schema property names for secret values. */ +function redactToolListResult( + result: Result, + redactor: SecretRedactor +): Result { + const { tools, ...metadata } = result; + return { + ...redactor.redact(metadata), + tools: tools.map((tool) => redactClientVisibleTool(tool, redactor)) + } as Result; +} + +function redactClientVisibleTool(tool: Tool, redactor: SecretRedactor): Tool { + const { inputSchema, outputSchema, ...metadata } = tool; + return { + ...redactor.redact(metadata), + inputSchema: redactClientVisibleSchema(inputSchema, redactor), + ...(outputSchema === undefined + ? {} + : { outputSchema: redactClientVisibleSchema(outputSchema, redactor) }) + }; +} + +/** + * Preserves schema structure while redacting known values from textual metadata. + * A boolean `true` in a schema position is normalized to its equivalent `{}` + * form for clients whose schema adapters require objects; `false` stays closed. + */ +function redactClientVisibleSchema(schema: Schema, redactor: SecretRedactor): Schema { + const context = createSchemaRedactionContext(schema, redactor); + return redactClientVisibleSchemaValue(schema, context); +} + +interface SchemaRedactionContext { + aliases: ReadonlyMap; + replacements: readonly (readonly [string, string])[]; + redactor: SecretRedactor; +} + +function createSchemaRedactionContext(schema: unknown, redactor: SecretRedactor): SchemaRedactionContext { + const names: string[] = []; + collectSchemaObjectKeys(schema, names, new Set()); + const unchangedNames = new Set(names.filter((name) => redactor.redact(name) === name)); + const usedAliases = new Set(unchangedNames); + const aliases = new Map(); + + for (const name of names) { + if (aliases.has(name)) continue; + const redactedName = redactor.redact(name); + if (redactedName === name) { + aliases.set(name, name); + continue; + } + + let alias = redactedName; + for (let suffix = 2; usedAliases.has(alias); suffix += 1) { + alias = suffixSchemaRedactionAlias(redactedName, suffix); + } + aliases.set(name, alias); + usedAliases.add(alias); + } + + return { + aliases, + replacements: [...aliases] + .filter(([name, alias]) => name !== alias) + .sort(([left], [right]) => right.length - left.length), + redactor + }; +} + +function collectSchemaObjectKeys(value: unknown, names: string[], seen: Set): void { + if (Array.isArray(value)) { + for (const entry of value) collectSchemaObjectKeys(entry, names, seen); + return; + } + if (!isRecord(value)) return; + for (const [name, entry] of Object.entries(value)) { + if (!seen.has(name)) { + seen.add(name); + names.push(name); + } + collectSchemaObjectKeys(entry, names, seen); + } +} + +function suffixSchemaRedactionAlias(alias: string, suffix: number): string { + return alias.endsWith("]") ? `${alias.slice(0, -1)}_${suffix}]` : `${alias}_${suffix}`; +} + +function redactSchemaName(name: string, context: SchemaRedactionContext): string { + return context.aliases.get(name) ?? context.redactor.redact(name); +} + +function redactSchemaString(value: string, context: SchemaRedactionContext): string { + let result = ""; + for (let offset = 0; offset < value.length; ) { + const replacement = context.replacements.find(([name]) => value.startsWith(name, offset)); + if (replacement) { + result += replacement[1]; + offset += replacement[0].length; + } else { + result += value[offset]; + offset += 1; + } + } + return context.redactor.redact(result); +} + +function redactClientVisibleSchemaValue(schema: Schema, context: SchemaRedactionContext): Schema { + if (schema === true) return {} as Schema; + if (schema === false || schema === null || typeof schema !== "object") { + return (typeof schema === "string" ? redactSchemaString(schema, context) : schema) as Schema; + } + if (Array.isArray(schema)) { + return schema.map((entry) => redactClientVisibleSchemaValue(entry, context)) as Schema; + } + + return Object.fromEntries( + Object.entries(schema).map(([keyword, value]) => { + const redactedKeyword = redactSchemaName(keyword, context); + if (jsonSchemaMapKeywords.has(keyword) && isRecord(value)) { + return [ + redactedKeyword, + Object.fromEntries( + Object.entries(value).map(([name, nestedSchema]) => [ + redactSchemaName(name, context), + redactClientVisibleSchemaValue(nestedSchema, context) + ]) + ) + ]; + } + if (jsonSchemaArrayKeywords.has(keyword) && Array.isArray(value)) { + return [redactedKeyword, value.map((nestedSchema) => redactClientVisibleSchemaValue(nestedSchema, context))]; + } + if (jsonSchemaValueKeywords.has(keyword)) { + return [redactedKeyword, redactClientVisibleSchemaValue(value, context)]; + } + if (keyword === "dependencies" && isRecord(value)) { + return [ + redactedKeyword, + Object.fromEntries( + Object.entries(value).map(([name, dependency]) => [ + redactSchemaName(name, context), + Array.isArray(dependency) + ? redactSchemaLiteral(dependency, context) + : redactClientVisibleSchemaValue(dependency, context) + ]) + ) + ]; + } + return [redactedKeyword, redactSchemaLiteral(value, context)]; + }) + ) as Schema; +} + +/** Redacts strings and object keys inside non-schema keyword values without changing booleans. */ +function redactSchemaLiteral(value: Value, context: SchemaRedactionContext): Value { + if (typeof value === "string") return redactSchemaString(value, context) as Value; + if (Array.isArray(value)) return value.map((entry) => redactSchemaLiteral(entry, context)) as Value; + if (value === null || typeof value !== "object") return value; + return Object.fromEntries( + Object.entries(value).map(([name, entry]) => [ + redactSchemaName(name, context), + redactSchemaLiteral(entry, context) + ]) + ) as Value; +} + function stripJsonSchemaKeyword(value: T, keyword: string): T { if (Array.isArray(value)) return value.map((entry) => stripJsonSchemaKeyword(entry, keyword)) as T; if (typeof value !== "object" || value === null) return value; diff --git a/tests/authenticated-request-context-docs-contract.test.ts b/tests/authenticated-request-context-docs-contract.test.ts index 600e7f3..01415c0 100644 --- a/tests/authenticated-request-context-docs-contract.test.ts +++ b/tests/authenticated-request-context-docs-contract.test.ts @@ -4,7 +4,7 @@ import { describe, expect, it } from "vitest"; const libraryApiPath = fileURLToPath(new URL("../docs/library-api.md", import.meta.url)); const changelogPath = fileURLToPath(new URL("../CHANGELOG.md", import.meta.url)); -const packageManifestPath = fileURLToPath(new URL("../package.json", import.meta.url)); +const protocolReleaseVersion = "1.1.0"; describe("authenticated request-context documentation contract", () => { it("documents the trusted host boundary and the no-fallback compatibility path", async () => { @@ -19,19 +19,18 @@ describe("authenticated request-context documentation contract", () => { expect(documentation).toContain("does not synthesize verified per-chat claims"); }); - it("records the additive security boundary under the package release", async () => { + it("records the additive security boundary under the v1.1.0 protocol release", async () => { const changelog = await readFile(changelogPath, "utf8"); - const manifest = JSON.parse(await readFile(packageManifestPath, "utf8")) as { version: string }; - const escapedVersion = manifest.version.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"); + const escapedVersion = protocolReleaseVersion.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"); const heading = changelog.match(new RegExp(`^## \\[${escapedVersion}\\] - \\d{4}-\\d{2}-\\d{2}$`, "mu")); expect(heading?.index).toBeTypeOf("number"); const releaseStart = heading?.index ?? 0; const releaseEnd = changelog.indexOf("\n## ", releaseStart + (heading?.[0].length ?? 0)); - const currentRelease = changelog.slice(releaseStart, releaseEnd < 0 ? undefined : releaseEnd); + const protocolRelease = changelog.slice(releaseStart, releaseEnd < 0 ? undefined : releaseEnd); - expect(currentRelease).toContain("[#376]"); - expect(currentRelease).toContain("for modern stateless handling"); - expect(currentRelease).toContain("never falls back to MCP `clientInfo`"); - expect(currentRelease).toContain("embedding hosts supply them through the public server factory"); + expect(protocolRelease).toContain("[#376]"); + expect(protocolRelease).toContain("for modern stateless handling"); + expect(protocolRelease).toContain("never falls back to MCP `clientInfo`"); + expect(protocolRelease).toContain("embedding hosts supply them through the public server factory"); }); }); diff --git a/tests/fixtures/fake-upstream-bundled.mjs b/tests/fixtures/fake-upstream-bundled.mjs index f5a30ed..15e52ef 100644 --- a/tests/fixtures/fake-upstream-bundled.mjs +++ b/tests/fixtures/fake-upstream-bundled.mjs @@ -19,7 +19,7 @@ var Ig=Object.defineProperty;var $s=(e,t)=>{for(var r in t)Ig(e,r,{get:t[r],enum \x20\x20\x20\x20\x20\x20\x20\x20 `)}R.write("payload.value = newResult;"),R.write("return payload;");let _=R.compile();return(p,S)=>_(z,p,S)},i,a=nr,c=!Ho.jitless,l=c&&Is.value,m=t.catchall,h;e._zod.parse=(z,R)=>{h??(h=n.value);let v=z.value;return a(v)?c&&l&&R?.async===!1&&R.jitless!==!0?(i||(i=o(t.shape)),z=i(z,R),m?zm([],v,z,R,h,e):z):r(z,R):(z.issues.push({expected:"object",code:"invalid_type",input:v,inst:e}),z)}});function qd(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter(i=>!Ct(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(i=>i.issues.map(a=>ct(a,n,We())))}),t)}var Vs=q("$ZodUnion",(e,t)=>{ye.init(e,t),Se(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),Se(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),Se(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),Se(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){let o=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${o.map(i=>On(i.source)).join("|")})$`)}});let r=t.options.length===1,n=t.options[0]._zod.run;e._zod.parse=(o,i)=>{if(r)return n(o,i);let a=!1,c=[];for(let s of t.options){let l=s._zod.run({value:o.value,issues:[]},i);if(l instanceof Promise)c.push(l),a=!0;else{if(l.issues.length===0)return l;c.push(l)}}return a?Promise.all(c).then(s=>qd(s,o,e,i)):qd(c,o,e,i)}});var wm=q("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Vs.init(e,t);let r=e._zod.parse;Se(e._zod,"propValues",()=>{let o={};for(let i of t.options){let a=i._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let[c,s]of Object.entries(a)){o[c]||(o[c]=new Set);for(let l of s)o[c].add(l)}}return o});let n=Ir(()=>{let o=t.options,i=new Map;for(let a of o){let c=a._zod.propValues?.[t.discriminator];if(!c||c.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(let s of c){if(i.has(s))throw new Error(`Duplicate discriminator value "${String(s)}"`);i.set(s,a)}}return i});e._zod.parse=(o,i)=>{let a=o.value;if(!nr(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:e}),o;let c=n.value.get(a?.[t.discriminator]);return c?c._zod.run(o,i):t.unionFallback?r(o,i):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:a,path:[t.discriminator],inst:e}),o)}}),Tm=q("$ZodIntersection",(e,t)=>{ye.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),a=t.right._zod.run({value:o,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([s,l])=>Md(r,s,l)):Md(r,i,a)}});function Us(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(xt(e)&&xt(t)){let r=Object.keys(t),n=Object.keys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let a=Us(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n{ye.init(e,t),e._zod.parse=(r,n)=>{let o=r.value;if(!xt(o))return r.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),r;let i=[],a=t.keyType._zod.values;if(a){r.value={};let c=new Set;for(let l of a)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){c.add(typeof l=="number"?l.toString():l);let m=t.valueType._zod.run({value:o[l],issues:[]},n);m instanceof Promise?i.push(m.then(h=>{h.issues.length&&r.issues.push(...yt(l,h.issues)),r.value[l]=h.value})):(m.issues.length&&r.issues.push(...yt(l,m.issues)),r.value[l]=m.value)}let s;for(let l in o)c.has(l)||(s=s??[],s.push(l));s&&s.length>0&&r.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:s})}else{r.value={};for(let c of Reflect.ownKeys(o)){if(c==="__proto__")continue;let s=t.keyType._zod.run({value:c,issues:[]},n);if(s instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(s.issues.length){t.mode==="loose"?r.value[c]=o[c]:r.issues.push({code:"invalid_key",origin:"record",issues:s.issues.map(m=>ct(m,n,We())),input:c,path:[c],inst:e});continue}let l=t.valueType._zod.run({value:o[c],issues:[]},n);l instanceof Promise?i.push(l.then(m=>{m.issues.length&&r.issues.push(...yt(c,m.issues)),r.value[s.value]=m.value})):(l.issues.length&&r.issues.push(...yt(c,l.issues)),r.value[s.value]=l.value)}}return i.length?Promise.all(i).then(()=>r):r}});var Im=q("$ZodEnum",(e,t)=>{ye.init(e,t);let r=Pn(t.entries),n=new Set(r);e._zod.values=n,e._zod.pattern=new RegExp(`^(${r.filter(o=>Ps.has(typeof o)).map(o=>typeof o=="string"?ht(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{let a=o.value;return n.has(a)||o.issues.push({code:"invalid_value",values:r,input:a,inst:e}),o}}),Pm=q("$ZodLiteral",(e,t)=>{if(ye.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let r=new Set(t.values);e._zod.values=r,e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ht(n):n?ht(n.toString()):String(n)).join("|")})$`),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});var km=q("$ZodTransform",(e,t)=>{ye.init(e,t),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tr(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(r.value=a,r));if(o instanceof Promise)throw new ft;return r.value=o,r}});function Ud(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var Om=q("$ZodOptional",(e,t)=>{ye.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Se(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${On(r.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(t.innerType._zod.optin==="optional"){let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Ud(i,r.value)):Ud(o,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,n)}}),jm=q("$ZodNullable",(e,t)=>{ye.init(e,t),Se(e._zod,"optin",()=>t.innerType._zod.optin),Se(e._zod,"optout",()=>t.innerType._zod.optout),Se(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${On(r.source)}|null)$`):void 0}),Se(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>r.value===null?r:t.innerType._zod.run(r,n)}),Nm=q("$ZodDefault",(e,t)=>{ye.init(e,t),e._zod.optin="optional",Se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Ld(i,t)):Ld(o,t)}});function Ld(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var xm=q("$ZodPrefault",(e,t)=>{ye.init(e,t),e._zod.optin="optional",Se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,n))}),Cm=q("$ZodNonOptional",(e,t)=>{ye.init(e,t),Se(e._zod,"values",()=>{let r=t.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Dd(i,e)):Dd(o,e)}});function Dd(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Am=q("$ZodCatch",(e,t)=>{ye.init(e,t),Se(e._zod,"optin",()=>t.innerType._zod.optin),Se(e._zod,"optout",()=>t.innerType._zod.optout),Se(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>(r.value=i.value,i.issues.length&&(r.value=t.catchValue({...r,error:{issues:i.issues.map(a=>ct(a,n,We()))},input:r.value}),r.issues=[]),r)):(r.value=o.value,o.issues.length&&(r.value=t.catchValue({...r,error:{issues:o.issues.map(i=>ct(i,n,We()))},input:r.value}),r.issues=[]),r)}});var qm=q("$ZodPipe",(e,t)=>{ye.init(e,t),Se(e._zod,"values",()=>t.in._zod.values),Se(e._zod,"optin",()=>t.in._zod.optin),Se(e._zod,"optout",()=>t.out._zod.optout),Se(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);return i instanceof Promise?i.then(a=>Xo(a,t.in,n)):Xo(i,t.in,n)}let o=t.in._zod.run(r,n);return o instanceof Promise?o.then(i=>Xo(i,t.out,n)):Xo(o,t.out,n)}});function Xo(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}var Mm=q("$ZodReadonly",(e,t)=>{ye.init(e,t),Se(e._zod,"propValues",()=>t.innerType._zod.propValues),Se(e._zod,"values",()=>t.innerType._zod.values),Se(e._zod,"optin",()=>t.innerType?._zod?.optin),Se(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(Vd):Vd(o)}});function Vd(e){return e.value=Object.freeze(e.value),e}var Um=q("$ZodLazy",(e,t)=>{ye.init(e,t),Se(e._zod,"innerType",()=>t.getter()),Se(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),Se(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),Se(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),Se(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(r,n)=>e._zod.innerType._zod.run(r,n)}),Lm=q("$ZodCustom",(e,t)=>{Ve.init(e,t),ye.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Zd(i,r,n,e));Zd(o,r,n,e)}});function Zd(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(Pr(o))}}var hv=e=>{let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"NaN":"number";case"object":{if(Array.isArray(e))return"array";if(e===null)return"null";if(Object.getPrototypeOf(e)!==Object.prototype&&e.constructor)return e.constructor.name}}return t},gv=()=>{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"}};function t(n){return e[n]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return n=>{switch(n.code){case"invalid_type":return`Invalid input: expected ${n.expected}, received ${hv(n.input)}`;case"invalid_value":return n.values.length===1?`Invalid input: expected ${ue(n.values[0])}`:`Invalid option: expected one of ${ce(n.values,"|")}`;case"too_big":{let o=n.inclusive?"<=":"<",i=t(n.origin);return i?`Too big: expected ${n.origin??"value"} to have ${o}${n.maximum.toString()} ${i.unit??"elements"}`:`Too big: expected ${n.origin??"value"} to be ${o}${n.maximum.toString()}`}case"too_small":{let o=n.inclusive?">=":">",i=t(n.origin);return i?`Too small: expected ${n.origin} to have ${o}${n.minimum.toString()} ${i.unit}`:`Too small: expected ${n.origin} to be ${o}${n.minimum.toString()}`}case"invalid_format":{let o=n;return o.format==="starts_with"?`Invalid string: must start with "${o.prefix}"`:o.format==="ends_with"?`Invalid string: must end with "${o.suffix}"`:o.format==="includes"?`Invalid string: must include "${o.includes}"`:o.format==="regex"?`Invalid string: must match pattern ${o.pattern}`:`Invalid ${r[o.format]??n.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${n.divisor}`;case"unrecognized_keys":return`Unrecognized key${n.keys.length>1?"s":""}: ${ce(n.keys,", ")}`;case"invalid_key":return`Invalid key in ${n.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${n.origin}`;default:return"Invalid input"}}};function Zs(){return{localeError:gv()}}var Vm;var Fs=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){let n=r[0];if(this._map.set(t,n),n&&typeof n=="object"&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){let r=t._zod.parent;if(r){let n={...this.get(r)??{}};delete n.id;let o={...n,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Zm(){return new Fs}(Vm=globalThis).__zod_globalRegistry??(Vm.__zod_globalRegistry=Zm());var bt=globalThis.__zod_globalRegistry;function Fm(e,t){return new e({type:"string",...re(t)})}function Hm(e,t){return new e({type:"string",coerce:!0,...re(t)})}function Hs(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...re(t)})}function Js(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...re(t)})}function Jm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...re(t)})}function Bm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...re(t)})}function Km(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...re(t)})}function Gm(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...re(t)})}function Bs(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...re(t)})}function Wm(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...re(t)})}function Ym(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...re(t)})}function Xm(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...re(t)})}function Qm(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...re(t)})}function ep(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...re(t)})}function tp(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...re(t)})}function rp(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...re(t)})}function np(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...re(t)})}function op(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...re(t)})}function ip(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...re(t)})}function ap(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...re(t)})}function sp(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...re(t)})}function cp(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...re(t)})}function up(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...re(t)})}function lp(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...re(t)})}function dp(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...re(t)})}function mp(e,t){return new e({type:"string",format:"date",check:"string_format",...re(t)})}function pp(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...re(t)})}function fp(e,t){return new e({type:"string",format:"duration",check:"string_format",...re(t)})}function hp(e,t){return new e({type:"number",checks:[],...re(t)})}function gp(e,t){return new e({type:"number",coerce:!0,checks:[],...re(t)})}function vp(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...re(t)})}function _p(e,t){return new e({type:"boolean",...re(t)})}function Sp(e,t){return new e({type:"boolean",coerce:!0,...re(t)})}function yp(e,t){return new e({type:"bigint",coerce:!0,...re(t)})}function bp(e,t){return new e({type:"null",...re(t)})}function $p(e){return new e({type:"any"})}function zp(e){return new e({type:"unknown"})}function Rp(e,t){return new e({type:"never",...re(t)})}function wp(e,t){return new e({type:"date",coerce:!0,...re(t)})}function kr(e,t){return new qs({check:"less_than",...re(t),value:e,inclusive:!1})}function $t(e,t){return new qs({check:"less_than",...re(t),value:e,inclusive:!0})}function Or(e,t){return new Ms({check:"greater_than",...re(t),value:e,inclusive:!1})}function ut(e,t){return new Ms({check:"greater_than",...re(t),value:e,inclusive:!0})}function Mn(e,t){return new $d({check:"multiple_of",...re(t),value:e})}function Un(e,t){return new Rd({check:"max_length",...re(t),maximum:e})}function or(e,t){return new wd({check:"min_length",...re(t),minimum:e})}function ei(e,t){return new Td({check:"length_equals",...re(t),length:e})}function Ks(e,t){return new Ed({check:"string_format",format:"regex",...re(t),pattern:e})}function Gs(e){return new Id({check:"string_format",format:"lowercase",...re(e)})}function Ws(e){return new Pd({check:"string_format",format:"uppercase",...re(e)})}function Ys(e,t){return new kd({check:"string_format",format:"includes",...re(t),includes:e})}function Xs(e,t){return new Od({check:"string_format",format:"starts_with",...re(t),prefix:e})}function Qs(e,t){return new jd({check:"string_format",format:"ends_with",...re(t),suffix:e})}function At(e){return new Nd({check:"overwrite",tx:e})}function ec(e){return At(t=>t.normalize(e))}function tc(){return At(e=>e.trim())}function rc(){return At(e=>e.toLowerCase())}function nc(){return At(e=>e.toUpperCase())}function oc(){return At(e=>Es(e))}function Tp(e,t,r){return new e({type:"array",element:t,...re(r)})}function Ep(e,t,r){return new e({type:"custom",check:"custom",fn:t,...re(r)})}function Ip(e){let t=bv(r=>(r.addIssue=n=>{if(typeof n=="string")r.issues.push(Pr(n,r.value,t._zod.def));else{let o=n;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=r.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),r.issues.push(Pr(o))}},e(r.value,r)));return t}function bv(e,t){let r=new Ve({check:"custom",...re(t)});return r._zod.check=e,r}function jr(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??bt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function be(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,r.schemaPath.includes(e)&&(i.cycle=r.path),i.schema;let a={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,a);let c=e._zod.toJSONSchema?.();if(c)a.schema=c;else{let m={...r,schemaPath:[...r.schemaPath,e],path:r.path},h=e._zod.parent;if(h)a.ref=h,be(h,t,m),t.seen.get(h).isParent=!0;else if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{let z=a.schema,R=t.processors[o.type];if(!R)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);R(e,t,z,m)}}let s=t.metadataRegistry.get(e);return s&&Object.assign(a.schema,s),t.io==="input"&&Ye(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&a.schema._prefault&&((n=a.schema).default??(n.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function Nr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let m=e.external.registry.get(i[0])?.id,h=e.external.uri??(R=>R);if(m)return{ref:h(m)};let z=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=z,{defId:z,ref:`${h("__shared")}#/${a}/${z}`}}if(i[1]===r)return{ref:"#"};let s=`#/${a}/`,l=i[1].schema.id??`__schema${e.counter++}`;return{defId:l,ref:s+l}},o=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:s}=n(i);a.def={...a.schema},s&&(a.defId=s);let l=a.schema;for(let m in l)delete l[m];l.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){o(i);continue}if(e.external){let s=e.external.registry.get(i[0])?.id;if(t!==i[0]&&s){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&e.reused==="ref"){o(i);continue}}}function xr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a),s=c.def??c.schema,l={...s};if(c.ref===null)return;let m=c.ref;if(c.ref=null,m){n(m);let h=e.seen.get(m).schema;h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(s.allOf=s.allOf??[],s.allOf.push(h)):(Object.assign(s,h),Object.assign(s,l))}c.isParent||e.override({zodSchema:a,jsonSchema:s,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ln(t,"input"),output:Ln(t,"output")}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ye(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ye(n.element,r);if(n.type==="set")return Ye(n.valueType,r);if(n.type==="lazy")return Ye(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ye(n.innerType,r);if(n.type==="intersection")return Ye(n.left,r)||Ye(n.right,r);if(n.type==="record"||n.type==="map")return Ye(n.keyType,r)||Ye(n.valueType,r);if(n.type==="pipe")return Ye(n.in,r)||Ye(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ye(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ye(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ye(o,r))return!0;return!!(n.rest&&Ye(n.rest,r))}return!1}var Pp=(e,t={})=>r=>{let n=jr({...r,processors:t});return be(e,n),Nr(n,e),xr(n,e)},Ln=(e,t)=>r=>{let{libraryOptions:n,target:o}=r??{},i=jr({...n??{},target:o,io:t,processors:{}});return be(e,i),Nr(i,e),xr(i,e)};var $v={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ac=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:c,patterns:s,contentEncoding:l}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),c&&(o.format=$v[c]??c,o.format===""&&delete o.format),l&&(o.contentEncoding=l),s&&s.size>0){let m=[...s];m.length===1?o.pattern=m[0].source:m.length>1&&(o.allOf=[...m.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},sc=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:c,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:m}=e._zod.bag;typeof c=="string"&&c.includes("int")?o.type="integer":o.type="number",typeof m=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=m,o.exclusiveMinimum=!0):o.exclusiveMinimum=m),typeof i=="number"&&(o.minimum=i,typeof m=="number"&&t.target!=="draft-04"&&(m>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l),typeof a=="number"&&(o.maximum=a,typeof l=="number"&&t.target!=="draft-04"&&(l<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof s=="number"&&(o.multipleOf=s)},cc=(e,t,r,n)=>{r.type="boolean"},uc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},kp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},lc=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Op=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},jp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},dc=(e,t,r,n)=>{r.not={}},mc=(e,t,r,n)=>{},pc=(e,t,r,n)=>{},fc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},hc=(e,t,r,n)=>{let o=e._zod.def,i=Pn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},gc=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Np=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},xp=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Cp=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:s}=e._zod.bag;a!==void 0&&(i.minLength=a),c!==void 0&&(i.maxLength=c),s?s.length===1?(i.contentMediaType=s[0],Object.assign(o,i)):o.anyOf=s.map(l=>({...i,contentMediaType:l})):Object.assign(o,i)},Ap=(e,t,r,n)=>{r.type="boolean"},vc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},qp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},_c=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Mp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Up=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Sc=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=be(i.element,t,{...n,path:[...n.path,"items"]})},yc=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let l in a)o.properties[l]=be(a[l],t,{...n,path:[...n.path,"properties",l]});let c=new Set(Object.keys(a)),s=new Set([...c].filter(l=>{let m=i.shape[l]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));s.size>0&&(o.required=Array.from(s)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=be(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},bc=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((c,s)=>be(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",s]}));i?r.oneOf=a:r.anyOf=a},$c=(e,t,r,n)=>{let o=e._zod.def,i=be(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=be(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=l=>"allOf"in l&&Object.keys(l).length===1,s=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];r.allOf=s},Lp=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",s=i.items.map((z,R)=>be(z,t,{...n,path:[...n.path,a,R]})),l=i.rest?be(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=s,l&&(o.items=l)):t.target==="openapi-3.0"?(o.items={anyOf:s},l&&o.items.anyOf.push(l),o.minItems=s.length,l||(o.maxItems=s.length)):(o.items=s,l&&(o.additionalItems=l));let{minimum:m,maximum:h}=e._zod.bag;typeof m=="number"&&(o.minItems=m),typeof h=="number"&&(o.maxItems=h)},zc=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=be(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=be(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})},Rc=(e,t,r,n)=>{let o=e._zod.def,i=be(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},wc=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Tc=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Ec=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ic=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Pc=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;be(i,t,n);let a=t.seen.get(e);a.ref=i},kc=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Dp=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Oc=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},jc=(e,t,r,n)=>{let o=e._zod.innerType;be(o,t,n);let i=t.seen.get(e);i.ref=o},ic={string:ac,number:sc,boolean:cc,bigint:uc,symbol:kp,null:lc,undefined:Op,void:jp,never:dc,any:mc,unknown:pc,date:fc,enum:hc,literal:gc,nan:Np,template_literal:xp,file:Cp,success:Ap,custom:vc,function:qp,transform:_c,map:Mp,set:Up,array:Sc,object:yc,union:bc,intersection:$c,tuple:Lp,record:zc,nullable:Rc,nonoptional:wc,default:Tc,prefault:Ec,catch:Ic,pipe:Pc,readonly:kc,promise:Dp,optional:Oc,lazy:jc};function Dn(e,t){if("_idmap"in e){let n=e,o=jr({...t,processors:ic}),i={};for(let s of n._idmap.entries()){let[l,m]=s;be(m,o)}let a={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let s of n._idmap.entries()){let[l,m]=s;Nr(o,m),a[l]=xr(o,m)}if(Object.keys(i).length>0){let s=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:i}}return{schemas:a}}let r=jr({...t,processors:ic});return be(e,r),Nr(r,e),xr(r,e)}var lt={};$s(lt,{ZodISODate:()=>Cc,ZodISODateTime:()=>Nc,ZodISODuration:()=>Uc,ZodISOTime:()=>qc,date:()=>Ac,datetime:()=>xc,duration:()=>Lc,time:()=>Mc});var Nc=q("ZodISODateTime",(e,t)=>{tm.init(e,t),Ee.init(e,t)});function xc(e){return dp(Nc,e)}var Cc=q("ZodISODate",(e,t)=>{rm.init(e,t),Ee.init(e,t)});function Ac(e){return mp(Cc,e)}var qc=q("ZodISOTime",(e,t)=>{nm.init(e,t),Ee.init(e,t)});function Mc(e){return pp(qc,e)}var Uc=q("ZodISODuration",(e,t)=>{om.init(e,t),Ee.init(e,t)});function Lc(e){return fp(Uc,e)}var Zp=(e,t)=>{Ko.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>xs(e,r)},flatten:{value:r=>Ns(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Er,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Er,2)}},isEmpty:{get(){return e.issues.length===0}}})},y0=q("ZodError",Zp),rt=q("ZodError",Zp,{Parent:Error});var Fp=Go(rt),Hp=Wo(rt),ti=Nn(rt),Jp=xn(rt),Bp=Ml(rt),Kp=Ul(rt),Gp=Ll(rt),Wp=Dl(rt),Yp=Vl(rt),Xp=Zl(rt),Qp=Fl(rt),ef=Hl(rt);var $e=q("ZodType",(e,t)=>(ye.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ln(e,"input"),output:Ln(e,"output")}}),e.toJSONSchema=Pp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(J.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>it(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Fp(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>ti(e,r,n),e.parseAsync=async(r,n)=>Hp(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Jp(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Bp(e,r,n),e.decode=(r,n)=>Kp(e,r,n),e.encodeAsync=async(r,n)=>Gp(e,r,n),e.decodeAsync=async(r,n)=>Wp(e,r,n),e.safeEncode=(r,n)=>Yp(e,r,n),e.safeDecode=(r,n)=>Xp(e,r,n),e.safeEncodeAsync=async(r,n)=>Qp(e,r,n),e.safeDecodeAsync=async(r,n)=>ef(e,r,n),e.refine=(r,n)=>e.check(f_(r,n)),e.superRefine=r=>e.check(h_(r)),e.overwrite=r=>e.check(At(r)),e.optional=()=>Q(e),e.nullable=()=>Vc(e),e.nullish=()=>Q(Vc(e)),e.nonoptional=r=>s_(e,r),e.array=()=>O(e),e.or=r=>W([e,r]),e.and=r=>gt(e,r),e.transform=r=>Zc(e,mf(r)),e.default=r=>o_(e,r),e.prefault=r=>a_(e,r),e.catch=r=>u_(e,r),e.pipe=r=>Zc(e,r),e.readonly=()=>hf(e),e.describe=r=>{let n=e.clone();return bt.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return bt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return bt.get(e);let n=e.clone();return bt.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),nf=q("_ZodString",(e,t)=>{qn.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ac(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Ks(...n)),e.includes=(...n)=>e.check(Ys(...n)),e.startsWith=(...n)=>e.check(Xs(...n)),e.endsWith=(...n)=>e.check(Qs(...n)),e.min=(...n)=>e.check(or(...n)),e.max=(...n)=>e.check(Un(...n)),e.length=(...n)=>e.check(ei(...n)),e.nonempty=(...n)=>e.check(or(1,...n)),e.lowercase=n=>e.check(Gs(n)),e.uppercase=n=>e.check(Ws(n)),e.trim=()=>e.check(tc()),e.normalize=(...n)=>e.check(ec(...n)),e.toLowerCase=()=>e.check(rc()),e.toUpperCase=()=>e.check(nc()),e.slugify=()=>e.check(oc())}),Fc=q("ZodString",(e,t)=>{qn.init(e,t),nf.init(e,t),e.email=r=>e.check(Hs(of,r)),e.url=r=>e.check(Bs(af,r)),e.jwt=r=>e.check(lp(Fv,r)),e.emoji=r=>e.check(Wm(kv,r)),e.guid=r=>e.check(Js(tf,r)),e.uuid=r=>e.check(Jm(ri,r)),e.uuidv4=r=>e.check(Bm(ri,r)),e.uuidv6=r=>e.check(Km(ri,r)),e.uuidv7=r=>e.check(Gm(ri,r)),e.nanoid=r=>e.check(Ym(Ov,r)),e.guid=r=>e.check(Js(tf,r)),e.cuid=r=>e.check(Xm(jv,r)),e.cuid2=r=>e.check(Qm(Nv,r)),e.ulid=r=>e.check(ep(xv,r)),e.base64=r=>e.check(sp(Dv,r)),e.base64url=r=>e.check(cp(Vv,r)),e.xid=r=>e.check(tp(Cv,r)),e.ksuid=r=>e.check(rp(Av,r)),e.ipv4=r=>e.check(np(qv,r)),e.ipv6=r=>e.check(op(Mv,r)),e.cidrv4=r=>e.check(ip(Uv,r)),e.cidrv6=r=>e.check(ap(Lv,r)),e.e164=r=>e.check(up(Zv,r)),e.datetime=r=>e.check(xc(r)),e.date=r=>e.check(Ac(r)),e.time=r=>e.check(Mc(r)),e.duration=r=>e.check(Lc(r))});function u(e){return Fm(Fc,e)}var Ee=q("ZodStringFormat",(e,t)=>{we.init(e,t),nf.init(e,t)}),of=q("ZodEmail",(e,t)=>{Jd.init(e,t),Ee.init(e,t)});function Hc(e){return Hs(of,e)}var tf=q("ZodGUID",(e,t)=>{Fd.init(e,t),Ee.init(e,t)});var ri=q("ZodUUID",(e,t)=>{Hd.init(e,t),Ee.init(e,t)});var af=q("ZodURL",(e,t)=>{Bd.init(e,t),Ee.init(e,t)});function Vn(e){return Bs(af,e)}var kv=q("ZodEmoji",(e,t)=>{Kd.init(e,t),Ee.init(e,t)});var Ov=q("ZodNanoID",(e,t)=>{Gd.init(e,t),Ee.init(e,t)});var jv=q("ZodCUID",(e,t)=>{Wd.init(e,t),Ee.init(e,t)});var Nv=q("ZodCUID2",(e,t)=>{Yd.init(e,t),Ee.init(e,t)});var xv=q("ZodULID",(e,t)=>{Xd.init(e,t),Ee.init(e,t)});var Cv=q("ZodXID",(e,t)=>{Qd.init(e,t),Ee.init(e,t)});var Av=q("ZodKSUID",(e,t)=>{em.init(e,t),Ee.init(e,t)});var qv=q("ZodIPv4",(e,t)=>{im.init(e,t),Ee.init(e,t)});var Mv=q("ZodIPv6",(e,t)=>{am.init(e,t),Ee.init(e,t)});var Uv=q("ZodCIDRv4",(e,t)=>{sm.init(e,t),Ee.init(e,t)});var Lv=q("ZodCIDRv6",(e,t)=>{cm.init(e,t),Ee.init(e,t)});var Dv=q("ZodBase64",(e,t)=>{lm.init(e,t),Ee.init(e,t)});var Vv=q("ZodBase64URL",(e,t)=>{dm.init(e,t),Ee.init(e,t)});var Zv=q("ZodE164",(e,t)=>{mm.init(e,t),Ee.init(e,t)});var Fv=q("ZodJWT",(e,t)=>{pm.init(e,t),Ee.init(e,t)});var ni=q("ZodNumber",(e,t)=>{Ls.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>sc(e,n,o,i),e.gt=(n,o)=>e.check(Or(n,o)),e.gte=(n,o)=>e.check(ut(n,o)),e.min=(n,o)=>e.check(ut(n,o)),e.lt=(n,o)=>e.check(kr(n,o)),e.lte=(n,o)=>e.check($t(n,o)),e.max=(n,o)=>e.check($t(n,o)),e.int=n=>e.check(rf(n)),e.safe=n=>e.check(rf(n)),e.positive=n=>e.check(Or(0,n)),e.nonnegative=n=>e.check(ut(0,n)),e.negative=n=>e.check(kr(0,n)),e.nonpositive=n=>e.check($t(0,n)),e.multipleOf=(n,o)=>e.check(Mn(n,o)),e.step=(n,o)=>e.check(Mn(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Z(e){return hp(ni,e)}var Hv=q("ZodNumberFormat",(e,t)=>{fm.init(e,t),ni.init(e,t)});function rf(e){return vp(Hv,e)}var Jc=q("ZodBoolean",(e,t)=>{Ds.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cc(e,r,n,o)});function G(e){return _p(Jc,e)}var sf=q("ZodBigInt",(e,t)=>{hm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>uc(e,n,o,i),e.gte=(n,o)=>e.check(ut(n,o)),e.min=(n,o)=>e.check(ut(n,o)),e.gt=(n,o)=>e.check(Or(n,o)),e.gte=(n,o)=>e.check(ut(n,o)),e.min=(n,o)=>e.check(ut(n,o)),e.lt=(n,o)=>e.check(kr(n,o)),e.lte=(n,o)=>e.check($t(n,o)),e.max=(n,o)=>e.check($t(n,o)),e.positive=n=>e.check(Or(BigInt(0),n)),e.negative=n=>e.check(kr(BigInt(0),n)),e.nonpositive=n=>e.check($t(BigInt(0),n)),e.nonnegative=n=>e.check(ut(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(Mn(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var Jv=q("ZodNull",(e,t)=>{gm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lc(e,r,n,o)});function qt(e){return bp(Jv,e)}var Bv=q("ZodAny",(e,t)=>{vm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mc(e,r,n,o)});function Bc(){return $p(Bv)}var Kv=q("ZodUnknown",(e,t)=>{_m.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pc(e,r,n,o)});function ee(){return zp(Kv)}var Gv=q("ZodNever",(e,t)=>{Sm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dc(e,r,n,o)});function cf(e){return Rp(Gv,e)}var uf=q("ZodDate",(e,t)=>{ym.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>fc(e,n,o,i),e.min=(n,o)=>e.check(ut(n,o)),e.max=(n,o)=>e.check($t(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var Wv=q("ZodArray",(e,t)=>{bm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sc(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(or(r,n)),e.nonempty=r=>e.check(or(1,r)),e.max=(r,n)=>e.check(Un(r,n)),e.length=(r,n)=>e.check(ei(r,n)),e.unwrap=()=>e.element});function O(e,t){return Tp(Wv,e,t)}var lf=q("ZodObject",(e,t)=>{Rm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yc(e,r,n,o),J.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>se(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ee()}),e.loose=()=>e.clone({...e._zod.def,catchall:ee()}),e.strict=()=>e.clone({...e._zod.def,catchall:cf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>J.extend(e,r),e.safeExtend=r=>J.safeExtend(e,r),e.merge=r=>J.merge(e,r),e.pick=r=>J.pick(e,r),e.omit=r=>J.omit(e,r),e.partial=(...r)=>J.partial(pf,e,r[0]),e.required=(...r)=>J.required(ff,e,r[0])});function E(e,t){let r={type:"object",shape:e??{},...J.normalizeParams(t)};return new lf(r)}function ne(e,t){return new lf({type:"object",shape:e,catchall:ee(),...J.normalizeParams(t)})}var df=q("ZodUnion",(e,t)=>{Vs.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bc(e,r,n,o),e.options=t.options});function W(e,t){return new df({type:"union",options:e,...J.normalizeParams(t)})}var Yv=q("ZodDiscriminatedUnion",(e,t)=>{df.init(e,t),wm.init(e,t)});function Cr(e,t,r){return new Yv({type:"union",options:t,discriminator:e,...J.normalizeParams(r)})}var Xv=q("ZodIntersection",(e,t)=>{Tm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$c(e,r,n,o)});function gt(e,t){return new Xv({type:"intersection",left:e,right:t})}var Qv=q("ZodRecord",(e,t)=>{Em.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zc(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,r){return new Qv({type:"record",keyType:e,valueType:t,...J.normalizeParams(r)})}var Dc=q("ZodEnum",(e,t)=>{Im.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>hc(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Dc({...t,checks:[],...J.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Dc({...t,checks:[],...J.normalizeParams(o),entries:i})}});function se(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Dc({type:"enum",entries:r,...J.normalizeParams(t)})}var e_=q("ZodLiteral",(e,t)=>{Pm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gc(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function j(e,t){return new e_({type:"literal",values:Array.isArray(e)?e:[e],...J.normalizeParams(t)})}var t_=q("ZodTransform",(e,t)=>{km.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_c(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(J.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(J.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function mf(e){return new t_({type:"transform",transform:e})}var pf=q("ZodOptional",(e,t)=>{Om.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Q(e){return new pf({type:"optional",innerType:e})}var r_=q("ZodNullable",(e,t)=>{jm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Vc(e){return new r_({type:"nullable",innerType:e})}var n_=q("ZodDefault",(e,t)=>{Nm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function o_(e,t){return new n_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():J.shallowClone(t)}})}var i_=q("ZodPrefault",(e,t)=>{xm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ec(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function a_(e,t){return new i_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():J.shallowClone(t)}})}var ff=q("ZodNonOptional",(e,t)=>{Cm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function s_(e,t){return new ff({type:"nonoptional",innerType:e,...J.normalizeParams(t)})}var c_=q("ZodCatch",(e,t)=>{Am.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ic(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function u_(e,t){return new c_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var l_=q("ZodPipe",(e,t)=>{qm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pc(e,r,n,o),e.in=t.in,e.out=t.out});function Zc(e,t){return new l_({type:"pipe",in:e,out:t})}var d_=q("ZodReadonly",(e,t)=>{Mm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hf(e){return new d_({type:"readonly",innerType:e})}var m_=q("ZodLazy",(e,t)=>{Um.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jc(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ar(e){return new m_({type:"lazy",getter:e})}var p_=q("ZodCustom",(e,t)=>{Lm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vc(e,r,n,o)});function f_(e,t={}){return Ep(p_,e,t)}function h_(e){return Ip(e)}function ar(e,t){return Zc(mf(e),t)}var vf={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"};var gf;gf||(gf={});var oi={};$s(oi,{bigint:()=>y_,boolean:()=>S_,date:()=>b_,number:()=>__,string:()=>v_});function v_(e){return Hm(Fc,e)}function __(e){return gp(ni,e)}function S_(e){return Sp(Jc,e)}function y_(e){return yp(sf,e)}function b_(e){return wp(uf,e)}We(Zs());var cr="2025-11-25";var ii=[cr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ai="io.modelcontextprotocol/related-task",ur="io.modelcontextprotocol/protocolVersion",qr="io.modelcontextprotocol/clientInfo",Rt="io.modelcontextprotocol/serverInfo",wt="io.modelcontextprotocol/clientCapabilities",Zn="io.modelcontextprotocol/subscriptionId",Ut="io.modelcontextprotocol/logLevel";var lr="2.0";var Mt=Ar(()=>W([u(),Z(),G(),qt(),B(u(),Mt),O(Mt)])),ke=B(u(),Mt),Wc=O(Mt),Fn=W([u(),Z().int()]),Hn=u(),si=E({ttl:Z().optional()}),ci=E({taskId:u()}),Jn=ne({progressToken:Fn.optional(),[ai]:ci.optional()}),De=E({_meta:Jn.optional()}),dr=De.extend({task:si.optional()}),Oe=E({method:u(),params:De.loose().optional()}),Be=E({_meta:Jn.optional()}),Ke=E({method:u(),params:Be.loose().optional()}),Bn=ne({get[Rt](){return Lr.optional().catch(void 0)}}),je=ne({_meta:Bn.optional()}),Lt=W([u(),Z().int()]),Kn=E({jsonrpc:j(lr),id:Lt,...Oe.shape}).strict(),Gn=E({jsonrpc:j(lr),...Ke.shape}).strict(),Mr=E({jsonrpc:j(lr),id:Lt,result:je}).strict(),Ur=E({jsonrpc:j(lr),id:Lt.optional(),error:E({code:Z().int(),message:u(),data:ee().optional()})}).strict(),Wn=W([Kn,Gn,Mr,Ur]),Yc=W([Mr,Ur]),Yn=je.strict(),ui=Be.extend({requestId:Lt.optional(),reason:u().optional()}),Xn=Ke.extend({method:j("notifications/cancelled"),params:ui}),li=E({src:u(),mimeType:u().optional(),sizes:O(u()).optional(),theme:se(["light","dark"]).optional()}),Dt=E({icons:O(li).optional()}),zt=E({name:u(),title:u().optional()}),Lr=zt.extend({...zt.shape,...Dt.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),z_=gt(E({applyDefaults:G().optional()}),ke),R_=ar(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,gt(E({form:z_.optional(),url:ke.optional()}),ke.optional())),di=ne({list:ke.optional(),cancel:ke.optional(),requests:ne({sampling:ne({createMessage:ke.optional()}).optional(),elicitation:ne({create:ke.optional()}).optional()}).optional()}),mi=ne({list:ke.optional(),cancel:ke.optional(),requests:ne({tools:ne({call:ke.optional()}).optional()}).optional()}),pi=E({experimental:B(u(),ke).optional(),sampling:E({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:R_.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:di.optional(),extensions:B(u(),ke).optional()}),fi=De.extend({protocolVersion:u(),capabilities:pi,clientInfo:Lr}),hi=Oe.extend({method:j("initialize"),params:fi}),Qn=E({experimental:B(u(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:mi.optional(),extensions:B(u(),ke).optional()}),gi=je.extend({protocolVersion:u(),capabilities:Qn,serverInfo:Lr,instructions:u().optional()}),vi=Ke.extend({method:j("notifications/initialized"),params:Be.optional()}),_i=Oe.extend({method:j("server/discover"),params:De.optional()}),Si=je.extend({supportedVersions:O(u()),capabilities:Qn,instructions:u().optional()}),eo=Oe.extend({method:j("ping"),params:De.optional()}),yi=E({progress:Z(),total:Q(Z()),message:Q(u())}),bi=E({...Be.shape,...yi.shape,progressToken:Fn}),to=Ke.extend({method:j("notifications/progress"),params:bi}),$i=De.extend({cursor:Hn.optional()}),Vt=Oe.extend({params:$i.optional()}),Zt=je.extend({nextCursor:Hn.optional()}),ro=E({uri:u(),mimeType:Q(u()),_meta:B(u(),ee()).optional()}),no=ro.extend({text:u()}),Xc=u().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),oo=ro.extend({blob:Xc}),Ft=se(["user","assistant"]),Tt=E({audience:O(Ft).optional(),priority:Z().min(0).max(1).optional(),lastModified:lt.datetime({offset:!0}).optional()}),io=E({...zt.shape,...Dt.shape,uri:u(),description:Q(u()),mimeType:Q(u()),size:Q(Z()),annotations:Tt.optional(),_meta:Q(ne({}))}),zi=E({...zt.shape,...Dt.shape,uriTemplate:u(),description:Q(u()),mimeType:Q(u()),annotations:Tt.optional(),_meta:Q(ne({}))}),Ri=Vt.extend({method:j("resources/list")}),wi=Zt.extend({resources:O(io)}),Ti=Vt.extend({method:j("resources/templates/list")}),Ei=Zt.extend({resourceTemplates:O(zi)}),Dr=De.extend({uri:u()}),Ii=Dr,Pi=Oe.extend({method:j("resources/read"),params:Ii}),ki=je.extend({contents:O(W([no,oo]))}),Oi=Ke.extend({method:j("notifications/resources/list_changed"),params:Be.optional()}),ji=Dr,Ni=Oe.extend({method:j("resources/subscribe"),params:ji}),xi=Dr,Ci=Oe.extend({method:j("resources/unsubscribe"),params:xi}),ao=E({toolsListChanged:G().optional(),promptsListChanged:G().optional(),resourcesListChanged:G().optional(),resourceSubscriptions:O(u()).optional()}),Ai=De.extend({notifications:ao}),qi=Oe.extend({method:j("subscriptions/listen"),params:Ai}),Mi=Be.extend({notifications:ao}),Ui=Ke.extend({method:j("notifications/subscriptions/acknowledged"),params:Mi}),Li=Bn.extend({[Zn]:Lt}),Di=je.extend({_meta:Li}),Vi=Be.extend({uri:u()}),Zi=Ke.extend({method:j("notifications/resources/updated"),params:Vi}),Fi=E({name:u(),description:Q(u()),required:Q(G())}),Hi=E({...zt.shape,...Dt.shape,description:Q(u()),arguments:Q(O(Fi)),_meta:Q(ne({}))}),Ji=Vt.extend({method:j("prompts/list")}),Bi=Zt.extend({prompts:O(Hi)}),Ki=De.extend({name:u(),arguments:B(u(),u()).optional()}),Gi=Oe.extend({method:j("prompts/get"),params:Ki}),Vr=E({type:j("text"),text:u(),annotations:Tt.optional(),_meta:B(u(),ee()).optional()}),Zr=E({type:j("image"),data:Xc,mimeType:u(),annotations:Tt.optional(),_meta:B(u(),ee()).optional()}),Fr=E({type:j("audio"),data:Xc,mimeType:u(),annotations:Tt.optional(),_meta:B(u(),ee()).optional()}),Wi=E({type:j("tool_use"),name:u(),id:u(),input:B(u(),ee()),_meta:B(u(),ee()).optional()}),Yi=E({type:j("resource"),resource:W([no,oo]),annotations:Tt.optional(),_meta:B(u(),ee()).optional()}),Xi=io.extend({type:j("resource_link")}),Hr=W([Vr,Zr,Fr,Xi,Yi]),Qi=E({role:Ft,content:Hr}),ea=je.extend({description:u().optional(),messages:O(Qi)}),ta=Ke.extend({method:j("notifications/prompts/list_changed"),params:Be.optional()}),ra=E({title:u().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),na=E({taskSupport:se(["required","optional","forbidden"]).optional()}),so=E({...zt.shape,...Dt.shape,description:u().optional(),inputSchema:E({type:j("object"),properties:B(u(),Mt).optional(),required:O(u()).optional()}).catchall(ee()),outputSchema:ne({$schema:u().optional()}).optional(),annotations:ra.optional(),execution:na.optional(),_meta:B(u(),ee()).optional()}),oa=Vt.extend({method:j("tools/list")}),ia=Zt.extend({tools:O(so)}),co=je.extend({content:O(Hr).default([]),structuredContent:ee().optional(),isError:G().optional()}),Qc=co.or(je.extend({toolResult:ee()})),aa=dr.extend({name:u(),arguments:B(u(),ee()).optional()}),sa=Oe.extend({method:j("tools/call"),params:aa}),ca=Ke.extend({method:j("notifications/tools/list_changed"),params:Be.optional()}),eu=E({autoRefresh:G().default(!0),debounceMs:Z().int().nonnegative().default(300)}),Ht=se(["debug","info","notice","warning","error","critical","alert","emergency"]),ua=De.extend({level:Ht}),la=Oe.extend({method:j("logging/setLevel"),params:ua}),da=Be.extend({level:Ht,logger:u().optional(),data:ee()}),ma=Ke.extend({method:j("notifications/message"),params:da}),pa=E({name:u().optional()}),fa=E({hints:O(pa).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),ha=E({mode:se(["auto","required","none"]).optional()}),ga=E({type:j("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:O(Hr),structuredContent:ee().optional(),isError:G().optional(),_meta:B(u(),ee()).optional()}),va=Cr("type",[Vr,Zr,Fr]),sr=Cr("type",[Vr,Zr,Fr,Wi,ga]),_a=E({role:Ft,content:W([sr,O(sr)]),_meta:B(u(),ee()).optional()}),Sa=dr.extend({messages:O(_a),modelPreferences:fa.optional(),systemPrompt:u().optional(),includeContext:se(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:O(u()).optional(),metadata:ke.optional(),tools:O(so).optional(),toolChoice:ha.optional()}),ya=Oe.extend({method:j("sampling/createMessage"),params:Sa}),ba=je.extend({model:u(),stopReason:Q(se(["endTurn","stopSequence","maxTokens"]).or(u())),role:Ft,content:va}),$a=je.extend({model:u(),stopReason:Q(se(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:Ft,content:W([sr,O(sr)])}),uo=E({type:j("boolean"),title:u().optional(),description:u().optional(),default:G().optional()}),Jr=E({type:j("string"),title:u().optional(),description:u().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:se(["email","uri","date","date-time"]).optional(),default:u().optional()}),Br=E({type:se(["number","integer"]),title:u().optional(),description:u().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),lo=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),default:u().optional()}),mo=E({type:j("string"),title:u().optional(),description:u().optional(),oneOf:O(E({const:u(),title:u()})),default:u().optional()}),po=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),enumNames:O(u()).optional(),default:u().optional()}),za=W([lo,mo]),fo=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({type:j("string"),enum:O(u())}),default:O(u()).optional()}),ho=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({anyOf:O(E({const:u(),title:u()}))}),default:O(u()).optional()}),Ra=W([fo,ho]),wa=W([po,za,Ra]),go=W([wa,uo,Jr,Br]),Kr=dr.extend({mode:j("form").optional(),message:u(),requestedSchema:E({type:j("object"),properties:B(u(),go),required:O(u()).optional()}).catchall(ee())}),Ta=dr.extend({mode:j("url"),message:u(),elicitationId:u(),url:u().url()}),Ea=W([Kr,Ta]),Ia=Oe.extend({method:j("elicitation/create"),params:Ea}),Pa=Be.extend({elicitationId:u()}),ka=Ke.extend({method:j("notifications/elicitation/complete"),params:Pa}),Oa=je.extend({action:se(["accept","decline","cancel"]),content:ar(e=>e===null?void 0:e,B(u(),W([u(),Z(),G(),O(u())])).optional())}),ja=E({type:j("ref/resource"),uri:u()}),Na=E({type:j("ref/prompt"),name:u()}),xa=De.extend({ref:W([Na,ja]),argument:E({name:u(),value:u()}),context:E({arguments:B(u(),u()).optional()}).optional()}),Ca=Oe.extend({method:j("completion/complete"),params:xa}),Aa=je.extend({completion:ne({values:O(u()).max(100),total:Q(Z().int()),hasMore:Q(G())})}),qa=E({uri:u().startsWith("file://"),name:u().optional(),_meta:B(u(),ee()).optional()}),Ma=Oe.extend({method:j("roots/list"),params:De.optional()}),Ua=je.extend({roots:O(qa)}),La=Ke.extend({method:j("notifications/roots/list_changed"),params:Be.optional()}),tu=ne({ttl:Z().optional(),pollInterval:Z().optional()}),Da=se(["working","input_required","completed","failed","cancelled"]),Jt=E({taskId:u(),status:Da,ttl:W([Z(),qt()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:Q(Z()),statusMessage:Q(u())}),ru=je.extend({task:Jt}),Va=Be.merge(Jt),nu=Ke.extend({method:j("notifications/tasks/status"),params:Va}),ou=Oe.extend({method:j("tasks/get"),params:De.extend({taskId:u()})}),iu=je.merge(Jt),au=Oe.extend({method:j("tasks/result"),params:De.extend({taskId:u()})}),su=je.loose(),cu=Vt.extend({method:j("tasks/list")}),uu=Zt.extend({tasks:O(Jt)}),lu=Oe.extend({method:j("tasks/cancel"),params:De.extend({taskId:u()})}),du=je.merge(Jt),mu=W([eo,hi,_i,Ca,la,Gi,Ji,Ri,Ti,Pi,Ni,Ci,qi,sa,oa]),pu=W([Xn,to,vi,La]),fu=W([Yn,ba,$a,Oa,Ua]),hu=W([eo,ya,Ia,Ma]),gu=W([Xn,to,ma,Zi,Oi,ca,ta,Ui,ka]),vu=W([Yn,gi,Si,Aa,ea,Bi,wi,Ei,ki,co,ia,Di]),Le=Vn().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:vf.custom,message:"URL must be parseable",fatal:!0}),zs}).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"}),_u=ne({resource:u().url(),authorization_servers:O(Le).optional(),jwks_uri:u().url().optional(),scopes_supported:O(u()).optional(),bearer_methods_supported:O(u()).optional(),resource_signing_alg_values_supported:O(u()).optional(),resource_name:u().optional(),resource_documentation:u().optional(),resource_policy_uri:u().url().optional(),resource_tos_uri:u().url().optional(),tls_client_certificate_bound_access_tokens:G().optional(),authorization_details_types_supported:O(u()).optional(),dpop_signing_alg_values_supported:O(u()).optional(),dpop_bound_access_tokens_required:G().optional()}),Za=ne({issuer:u(),authorization_endpoint:Le,token_endpoint:Le,registration_endpoint:Le.optional(),scopes_supported:O(u()).optional(),response_types_supported:O(u()),response_modes_supported:O(u()).optional(),grant_types_supported:O(u()).optional(),token_endpoint_auth_methods_supported:O(u()).optional(),token_endpoint_auth_signing_alg_values_supported:O(u()).optional(),service_documentation:Le.optional(),revocation_endpoint:Le.optional(),revocation_endpoint_auth_methods_supported:O(u()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(u()).optional(),introspection_endpoint:u().optional(),introspection_endpoint_auth_methods_supported:O(u()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(u()).optional(),code_challenge_methods_supported:O(u()).optional(),client_id_metadata_document_supported:G().optional(),authorization_response_iss_parameter_supported:G().optional().catch(void 0)}),Fa=ne({issuer:u(),authorization_endpoint:Le,token_endpoint:Le,userinfo_endpoint:Le.optional(),jwks_uri:Le,registration_endpoint:Le.optional(),scopes_supported:O(u()).optional(),response_types_supported:O(u()),response_modes_supported:O(u()).optional(),grant_types_supported:O(u()).optional(),acr_values_supported:O(u()).optional(),subject_types_supported:O(u()),id_token_signing_alg_values_supported:O(u()),id_token_encryption_alg_values_supported:O(u()).optional(),id_token_encryption_enc_values_supported:O(u()).optional(),userinfo_signing_alg_values_supported:O(u()).optional(),userinfo_encryption_alg_values_supported:O(u()).optional(),userinfo_encryption_enc_values_supported:O(u()).optional(),request_object_signing_alg_values_supported:O(u()).optional(),request_object_encryption_alg_values_supported:O(u()).optional(),request_object_encryption_enc_values_supported:O(u()).optional(),token_endpoint_auth_methods_supported:O(u()).optional(),token_endpoint_auth_signing_alg_values_supported:O(u()).optional(),display_values_supported:O(u()).optional(),claim_types_supported:O(u()).optional(),claims_supported:O(u()).optional(),service_documentation:u().optional(),claims_locales_supported:O(u()).optional(),ui_locales_supported:O(u()).optional(),claims_parameter_supported:G().optional(),request_parameter_supported:G().optional(),request_uri_parameter_supported:G().optional(),require_request_uri_registration:G().optional(),op_policy_uri:Le.optional(),op_tos_uri:Le.optional(),client_id_metadata_document_supported:G().optional(),authorization_response_iss_parameter_supported:G().optional().catch(void 0)}),Su=E({...Fa.shape,...Za.pick({code_challenge_methods_supported:!0}).shape}),yu=E({access_token:u(),id_token:u().optional(),token_type:u(),expires_in:oi.number().optional(),scope:u().optional(),refresh_token:u().optional()}).strip(),bu=E({issued_token_type:j("urn:ietf:params:oauth:token-type:id-jag"),access_token:u(),token_type:u().optional(),expires_in:Z().optional(),scope:u().optional()}).strip(),$u=E({error:u(),error_description:u().optional(),error_uri:u().optional()}),Gc=Le.optional().or(j("").transform(()=>{})),Ha=E({redirect_uris:O(Le),token_endpoint_auth_method:u().optional(),grant_types:O(u()).optional(),response_types:O(u()).optional(),application_type:u().optional(),client_name:u().optional(),client_uri:Le.optional(),logo_uri:Gc,scope:u().optional(),contacts:O(u()).optional(),tos_uri:Gc,policy_uri:u().optional(),jwks_uri:Le.optional(),jwks:Bc().optional(),software_id:u().optional(),software_version:u().optional(),software_statement:u().optional()}).strip(),Ja=E({client_id:u(),client_secret:u().optional(),client_id_issued_at:Z().optional(),client_secret_expires_at:Z().optional()}).strip(),zu=Ha.merge(Ja),Ru=E({error:u(),error_description:u().optional()}).strip(),wu=E({token:u(),token_type_hint:u().optional()}).strip();var ku=Symbol.for("mcp.sdk.errorBrands");function Cu(e,t){let r=new Set,n=t;for(;typeof n=="function";){let o=n.mcpBrand;Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&typeof o=="string"&&r.add(o),n=Object.getPrototypeOf(n)}r.size!==0&&Object.defineProperty(e,ku,{value:r,enumerable:!1,configurable:!0})}function Wr(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,ku)){let r=t[ku];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var w_=class Uf extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Wr(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Wr(this,t)}constructor(t,r,n){super(r),this.code=t,this.errorUri=n,this.name="OAuthError",Cu(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new Uf(t.error,t.error_description??t.error,t.error_uri)}},he=(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})({}),le=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Wr(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Wr(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",Cu(this,new.target)}},T_=class extends le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Ef(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function E_(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function Lf(e){switch(e.method){case"elicitation/create":return e.params?.mode==="url"?{elicitation:{url:{}}}:{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;return t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0)?{sampling:{tools:{}}}:{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function es(e,t){let r={};for(let[n,o]of Object.entries(e)){if(o===void 0)continue;let i=t===void 0?void 0:t[n];if(i===void 0){r[n]=o;continue}if(Ef(o)&&Ef(i)){let a={};for(let[c,s]of Object.entries(o))s!==void 0&&i[c]===void 0&&!E_(n,c,i)&&(a[c]=s);Object.keys(a).length>0&&(r[n]=a)}}return Object.keys(r).length>0?r:void 0}var I_="2026-07-28";function $o(e){return e>=I_}function Df(e){return e.filter(t=>!$o(t))}function Au(e){return e.filter(t=>$o(t))}function Vf(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(r=>r.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Zf=["task","inputRequests","requestState"];function qu(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||Zf.some(t=>t in e)?e:{...e,content:[]}}function P_(){let e=Ar(()=>W([u(),Z(),G(),qt(),B(u(),e),O(e)])),t=B(u(),e),r=W([u(),Z().int()]),n=u(),o=E({ttl:Z().optional()}),i=E({taskId:u()}),a=ne({progressToken:r.optional(),"io.modelcontextprotocol/related-task":i.optional()}),c=E({_meta:a.optional()}),s=c.extend({task:o.optional()}),l=E({method:u(),params:c.loose().optional()}),m=E({_meta:a.optional()}),h=E({method:u(),params:m.loose().optional()}),z=ne({_meta:a.optional()}),R=W([u(),Z().int()]),v=z.strict(),b=m.extend({requestId:R.optional(),reason:u().optional()}),g=h.extend({method:j("notifications/cancelled"),params:b}),d=E({src:u(),mimeType:u().optional(),sizes:O(u()).optional(),theme:se(["light","dark"]).optional()}),_=E({icons:O(d).optional()}),p=E({name:u(),title:u().optional()}),S=p.extend({...p.shape,..._.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),w=gt(E({applyDefaults:G().optional()}),t),y=ar(Je=>Je&&typeof Je=="object"&&!Array.isArray(Je)&&Object.keys(Je).length===0?{form:{}}:Je,gt(E({form:w.optional(),url:t.optional()}),t.optional())),f=ne({list:t.optional(),cancel:t.optional(),requests:ne({sampling:ne({createMessage:t.optional()}).optional(),elicitation:ne({create:t.optional()}).optional()}).optional()}),T=ne({list:t.optional(),cancel:t.optional(),requests:ne({tools:ne({call:t.optional()}).optional()}).optional()}),A=E({experimental:B(u(),t).optional(),sampling:E({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:f.optional(),extensions:B(u(),t).optional()}),F=c.extend({protocolVersion:u(),capabilities:A,clientInfo:S}),M=l.extend({method:j("initialize"),params:F}),D=E({experimental:B(u(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:T.optional(),extensions:B(u(),t).optional()}),Y=z.extend({protocolVersion:u(),capabilities:D,serverInfo:S,instructions:u().optional()}),K=h.extend({method:j("notifications/initialized"),params:m.optional()}),fe=l.extend({method:j("ping"),params:c.optional()}),Te=E({progress:Z(),total:Q(Z()),message:Q(u())}),ze=E({...m.shape,...Te.shape,progressToken:r}),Ce=h.extend({method:j("notifications/progress"),params:ze}),ve=c.extend({cursor:n.optional()}),k=l.extend({params:ve.optional()}),x=z.extend({nextCursor:n.optional()}),V=E({uri:u(),mimeType:Q(u()),_meta:B(u(),ee()).optional()}),$=V.extend({text:u()}),P=u().refine(Je=>{try{return atob(Je),!0}catch{return!1}},{message:"Invalid Base64 string"}),N=V.extend({blob:P}),H=se(["user","assistant"]),te=E({audience:O(H).optional(),priority:Z().min(0).max(1).optional(),lastModified:lt.datetime({offset:!0}).optional()}),pe=E({...p.shape,..._.shape,uri:u(),description:Q(u()),mimeType:Q(u()),size:Q(Z()),annotations:te.optional(),_meta:Q(ne({}))}),ae=E({...p.shape,..._.shape,uriTemplate:u(),description:Q(u()),mimeType:Q(u()),annotations:te.optional(),_meta:Q(ne({}))}),Re=k.extend({method:j("resources/list")}),Ge=x.extend({resources:O(pe)}),I=k.extend({method:j("resources/templates/list")}),C=x.extend({resourceTemplates:O(ae)}),U=c.extend({uri:u()}),oe=U,ie=l.extend({method:j("resources/read"),params:oe}),me=z.extend({contents:O(W([$,N]))}),Ne=h.extend({method:j("notifications/resources/list_changed"),params:m.optional()}),qe=U,Fe=l.extend({method:j("resources/subscribe"),params:qe}),Ae=U,Ie=l.extend({method:j("resources/unsubscribe"),params:Ae}),nt=m.extend({uri:u()}),Ue=h.extend({method:j("notifications/resources/updated"),params:nt}),_t=E({name:u(),description:Q(u()),required:Q(G())}),at=E({...p.shape,..._.shape,description:Q(u()),arguments:Q(O(_t)),_meta:Q(ne({}))}),St=k.extend({method:j("prompts/list")}),Et=x.extend({prompts:O(at)}),It=c.extend({name:u(),arguments:B(u(),u()).optional()}),Bt=l.extend({method:j("prompts/get"),params:It}),Kt=E({type:j("text"),text:u(),annotations:te.optional(),_meta:B(u(),ee()).optional()}),Gt=E({type:j("image"),data:P,mimeType:u(),annotations:te.optional(),_meta:B(u(),ee()).optional()}),Wt=E({type:j("audio"),data:P,mimeType:u(),annotations:te.optional(),_meta:B(u(),ee()).optional()}),en=E({type:j("tool_use"),name:u(),id:u(),input:B(u(),ee()),_meta:B(u(),ee()).optional()}),Pt=E({type:j("resource"),resource:W([$,N]),annotations:te.optional(),_meta:B(u(),ee()).optional()}),tn=pe.extend({type:j("resource_link")}),ot=W([Kt,Gt,Wt,tn,Pt]),hr=E({role:H,content:ot}),gr=z.extend({description:u().optional(),messages:O(hr)}),Yt=h.extend({method:j("notifications/prompts/list_changed"),params:m.optional()}),rn=E({title:u().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),vr=E({taskSupport:se(["required","optional","forbidden"]).optional()}),Xt=E({...p.shape,..._.shape,description:u().optional(),inputSchema:E({type:j("object"),properties:B(u(),e).optional(),required:O(u()).optional()}).catchall(ee()),outputSchema:E({type:j("object"),properties:B(u(),e).optional(),required:O(u()).optional()}).catchall(ee()).optional(),annotations:rn.optional(),execution:vr.optional(),_meta:B(u(),ee()).optional()}),_r=k.extend({method:j("tools/list")}),Sr=x.extend({tools:O(Xt)}),yr=z.extend({content:O(ot),structuredContent:B(u(),ee()).optional(),isError:G().optional()}),He=s.extend({name:u(),arguments:B(u(),ee()).optional()}),nn=l.extend({method:j("tools/call"),params:He}),To=h.extend({method:j("notifications/tools/list_changed"),params:m.optional()}),br=se(["debug","info","notice","warning","error","critical","alert","emergency"]),on=c.extend({level:br}),an=l.extend({method:j("logging/setLevel"),params:on}),sn=m.extend({level:br,logger:u().optional(),data:ee()}),cn=h.extend({method:j("notifications/message"),params:sn}),un=E({name:u().optional()}),ln=E({hints:O(un).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),dn=E({mode:se(["auto","required","none"]).optional()}),Eo=E({type:j("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:O(ot),structuredContent:E({}).loose().optional(),isError:G().optional(),_meta:B(u(),ee()).optional()}),mn=Cr("type",[Kt,Gt,Wt]),kt=Cr("type",[Kt,Gt,Wt,en,Eo]),pn=E({role:H,content:W([kt,O(kt)]),_meta:B(u(),ee()).optional()}),fn=s.extend({messages:O(pn),modelPreferences:ln.optional(),systemPrompt:u().optional(),includeContext:se(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:O(u()).optional(),metadata:t.optional(),tools:O(Xt).optional(),toolChoice:dn.optional()}),hn=l.extend({method:j("sampling/createMessage"),params:fn}),gn=z.extend({model:u(),stopReason:Q(se(["endTurn","stopSequence","maxTokens"]).or(u())),role:H,content:mn}),vn=z.extend({model:u(),stopReason:Q(se(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:H,content:W([kt,O(kt)])}),_n=E({type:j("boolean"),title:u().optional(),description:u().optional(),default:G().optional()}),Sn=E({type:j("string"),title:u().optional(),description:u().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:se(["email","uri","date","date-time"]).optional(),default:u().optional()}),yn=E({type:se(["number","integer"]),title:u().optional(),description:u().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),bn=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),default:u().optional()}),$n=E({type:j("string"),title:u().optional(),description:u().optional(),oneOf:O(E({const:u(),title:u()})),default:u().optional()}),zn=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),enumNames:O(u()).optional(),default:u().optional()}),Rn=W([bn,$n]),Qt=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({type:j("string"),enum:O(u())}),default:O(u()).optional()}),er=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({anyOf:O(E({const:u(),title:u()}))}),default:O(u()).optional()}),Io=W([Qt,er]),Po=W([zn,Rn,Io]),et=W([Po,_n,Sn,yn]),tt=s.extend({mode:j("form").optional(),message:u(),requestedSchema:E({type:j("object"),properties:B(u(),et),required:O(u()).optional()}).catchall(ee())}),wn=s.extend({mode:j("url"),message:u(),elicitationId:u(),url:u().url()}),st=W([tt,wn]),ko=l.extend({method:j("elicitation/create"),params:st}),Oo=m.extend({elicitationId:u()}),jo=h.extend({method:j("notifications/elicitation/complete"),params:Oo}),No=z.extend({action:se(["accept","decline","cancel"]),content:ar(Je=>Je===null?void 0:Je,B(u(),W([u(),Z(),G(),O(u())])).optional())}),xo=E({type:j("ref/resource"),uri:u()}),Co=E({type:j("ref/prompt"),name:u()}),Ao=c.extend({ref:W([Co,xo]),argument:E({name:u(),value:u()}),context:E({arguments:B(u(),u()).optional()}).optional()}),Tn=l.extend({method:j("completion/complete"),params:Ao}),qo=z.extend({completion:ne({values:O(u()).max(100),total:Q(Z().int()),hasMore:Q(G())})}),Mo=E({uri:u().startsWith("file://"),name:u().optional(),_meta:B(u(),ee()).optional()}),$r=l.extend({method:j("roots/list"),params:c.optional()}),En=z.extend({roots:O(Mo)}),Uo=h.extend({method:j("notifications/roots/list_changed"),params:m.optional()}),Lo=ne({ttl:Z().optional(),pollInterval:Z().optional()}),Do=se(["working","input_required","completed","failed","cancelled"]),Ot=E({taskId:u(),status:Do,ttl:W([Z(),qt()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:Q(Z()),statusMessage:Q(u())}),Xe=z.extend({task:Ot}),Vo=m.merge(Ot),tr=h.extend({method:j("notifications/tasks/status"),params:Vo}),zr=l.extend({method:j("tasks/get"),params:c.extend({taskId:u()})}),Rr=z.merge(Ot),wr=l.extend({method:j("tasks/result"),params:c.extend({taskId:u()})}),bs=z.loose(),Qe=k.extend({method:j("tasks/list")}),xe=x.extend({tasks:O(Ot)}),rr=l.extend({method:j("tasks/cancel"),params:c.extend({taskId:u()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:i,RequestMetaSchema:a,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:s,RequestSchema:l,NotificationsParamsSchema:m,NotificationSchema:h,ResultSchema:z,RequestIdSchema:R,EmptyResultSchema:v,CancelledNotificationParamsSchema:b,CancelledNotificationSchema:g,IconSchema:d,IconsSchema:_,BaseMetadataSchema:p,ImplementationSchema:S,ClientTasksCapabilitySchema:f,ServerTasksCapabilitySchema:T,ClientCapabilitiesSchema:A,InitializeRequestParamsSchema:F,InitializeRequestSchema:M,ServerCapabilitiesSchema:D,InitializeResultSchema:Y,InitializedNotificationSchema:K,PingRequestSchema:fe,ProgressSchema:Te,ProgressNotificationParamsSchema:ze,ProgressNotificationSchema:Ce,PaginatedRequestParamsSchema:ve,PaginatedRequestSchema:k,PaginatedResultSchema:x,ResourceContentsSchema:V,TextResourceContentsSchema:$,BlobResourceContentsSchema:N,RoleSchema:H,AnnotationsSchema:te,ResourceSchema:pe,ResourceTemplateSchema:ae,ListResourcesRequestSchema:Re,ListResourcesResultSchema:Ge,ListResourceTemplatesRequestSchema:I,ListResourceTemplatesResultSchema:C,ResourceRequestParamsSchema:U,ReadResourceRequestParamsSchema:oe,ReadResourceRequestSchema:ie,ReadResourceResultSchema:me,ResourceListChangedNotificationSchema:Ne,SubscribeRequestParamsSchema:qe,SubscribeRequestSchema:Fe,UnsubscribeRequestParamsSchema:Ae,UnsubscribeRequestSchema:Ie,ResourceUpdatedNotificationParamsSchema:nt,ResourceUpdatedNotificationSchema:Ue,PromptArgumentSchema:_t,PromptSchema:at,ListPromptsRequestSchema:St,ListPromptsResultSchema:Et,GetPromptRequestParamsSchema:It,GetPromptRequestSchema:Bt,TextContentSchema:Kt,ImageContentSchema:Gt,AudioContentSchema:Wt,ToolUseContentSchema:en,EmbeddedResourceSchema:Pt,ResourceLinkSchema:tn,ContentBlockSchema:ot,PromptMessageSchema:hr,GetPromptResultSchema:gr,PromptListChangedNotificationSchema:Yt,ToolAnnotationsSchema:rn,ToolExecutionSchema:vr,ToolSchema:Xt,ListToolsRequestSchema:_r,ListToolsResultSchema:Sr,CallToolResultSchema:yr,CallToolRequestParamsSchema:He,CallToolRequestSchema:nn,ToolListChangedNotificationSchema:To,LoggingLevelSchema:br,SetLevelRequestParamsSchema:on,SetLevelRequestSchema:an,LoggingMessageNotificationParamsSchema:sn,LoggingMessageNotificationSchema:cn,ModelHintSchema:un,ModelPreferencesSchema:ln,ToolChoiceSchema:dn,ToolResultContentSchema:Eo,SamplingContentSchema:mn,SamplingMessageContentBlockSchema:kt,SamplingMessageSchema:pn,CreateMessageRequestParamsSchema:fn,CreateMessageRequestSchema:hn,CreateMessageResultSchema:gn,CreateMessageResultWithToolsSchema:vn,BooleanSchemaSchema:_n,StringSchemaSchema:Sn,NumberSchemaSchema:yn,UntitledSingleSelectEnumSchemaSchema:bn,TitledSingleSelectEnumSchemaSchema:$n,LegacyTitledEnumSchemaSchema:zn,SingleSelectEnumSchemaSchema:Rn,UntitledMultiSelectEnumSchemaSchema:Qt,TitledMultiSelectEnumSchemaSchema:er,MultiSelectEnumSchemaSchema:Io,EnumSchemaSchema:Po,PrimitiveSchemaDefinitionSchema:et,ElicitRequestFormParamsSchema:tt,ElicitRequestURLParamsSchema:wn,ElicitRequestParamsSchema:st,ElicitRequestSchema:ko,ElicitationCompleteNotificationParamsSchema:Oo,ElicitationCompleteNotificationSchema:jo,ElicitResultSchema:No,ResourceTemplateReferenceSchema:xo,PromptReferenceSchema:Co,CompleteRequestParamsSchema:Ao,CompleteRequestSchema:Tn,CompleteResultSchema:qo,RootSchema:Mo,ListRootsRequestSchema:$r,ListRootsResultSchema:En,RootsListChangedNotificationSchema:Uo,TaskCreationParamsSchema:Lo,TaskStatusSchema:Do,TaskSchema:Ot,CreateTaskResultSchema:Xe,TaskStatusNotificationParamsSchema:Vo,TaskStatusNotificationSchema:tr,GetTaskRequestSchema:zr,GetTaskResultSchema:Rr,GetTaskPayloadRequestSchema:wr,GetTaskPayloadResultSchema:bs,ListTasksRequestSchema:Qe,ListTasksResultSchema:xe,CancelTaskRequestSchema:rr,CancelTaskResultSchema:z.merge(Ot),ClientRequestSchema:W([fe,M,Tn,an,Bt,St,Re,I,ie,Fe,Ie,nn,_r,zr,wr,Qe,rr]),ClientNotificationSchema:W([g,Ce,K,Uo,tr]),ClientResultSchema:W([v,gn,vn,No,En,Rr,xe,Xe]),ServerRequestSchema:W([fe,hn,ko,$r,zr,wr,Qe,rr]),ServerNotificationSchema:W([g,Ce,cn,Ue,Ne,To,Yt,tr,jo]),ServerResultSchema:W([v,Y,qo,gr,Et,Ge,C,me,yr,Sr,Rr,xe,Xe]),CallToolResultWireSchema:ee().superRefine((Je,Eg)=>{if(!(typeof Je!="object"||Je===null||Array.isArray(Je)||Je.content!==void 0)){for(let zl of Zf)if(zl in Je){Eg.addIssue({code:"custom",message:`content is required when the body carries '${zl}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(qu).pipe(yr)}}var k_;function Ff(){return k_??=P_()}function Hf(e){return e.type!=="object"}var O_=new Set(["const","enum","default","examples"]),j_=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function If(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function N_(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(If(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Tl(e.$schema)&&e.$recursiveAnchor!==!0,n=(o,i)=>{if(Array.isArray(o))return o.map(s=>n(s,!1));if(o===null||typeof o!="object"||!i&&If(o.$id))return o;let a={},c=!1;for(let[s,l]of Object.entries(o))i?a[s]=n(l,!1):(s==="$ref"||s==="$dynamicRef")&&typeof l=="string"?a[s]=l==="#"?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:s==="$recursiveRef"&&l==="#"&&r?c=!0:O_.has(s)?a[s]=l:j_.has(s)?a[s]=n(l,!0):a[s]=n(l,!1);return c&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:n(e,!1)},required:["result"]}}var Jf={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},Bf={"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},x_={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},Ba;function Mu(){if(Ba)return Ba;let e=Ff();return Ba={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}},Ba}function Kf(e){return Object.prototype.hasOwnProperty.call(Jf,e)}function Gf(e){return Object.prototype.hasOwnProperty.call(Bf,e)}function C_(e){return Object.prototype.hasOwnProperty.call(x_,e)}function A_(e){return C_(e)?Mu().resultSchemas[e]:void 0}function q_(e){return Kf(e)?Mu().requestSchemas[e]:void 0}function M_(e){return Gf(e)?Mu().notificationSchemas[e]:void 0}var nT=Object.keys(Jf),oT=Object.keys(Bf);function Ou(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ka(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Pf={ok:!1,reason:"not-in-era"};function kf(e){return Ou(e)&&Ou(e.outputSchema)&&Hf(e.outputSchema)}var Uu={era:"2025-11-25",hasRequestMethod:Kf,hasNotificationMethod:Gf,validateRequest:(e,t)=>Ka(q_(e),t),validateResult:(e,t)=>Ka(A_(e),t),validateNotification:(e,t)=>Ka(M_(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Pf,validateInputResponse:()=>Pf,samplingResultVariant:((e,t)=>{let r=Ff();return Ka(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=Vf(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!="object"||n===null||Array.isArray(n),i=t!==void 0&&Hf(t);return!o&&!i?r:{...r,structuredContent:{result:n}}},decodeResult(e,t){if(Ou(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:r}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;return!Array.isArray(r)||!r.some(n=>kf(n))?t:{...t,tools:r.map(n=>kf(n)?{...n,outputSchema:N_(n.outputSchema)}:n)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function U_(){let e=Ar(()=>W([u(),Z(),G(),qt(),B(u(),e),O(e)])),t=B(u(),e),r=W([u(),Z().int()]),n=u(),o=W([u(),Z().int()]),i=se(["user","assistant"]),a=se(["debug","info","notice","warning","error","critical","alert","emergency"]),c=u().refine(xe=>{try{return atob(xe),!0}catch{return!1}},{message:"Invalid Base64 string"}),s=E({ttl:Z().optional()}),l=E({taskId:u()}),m=ne({progressToken:r.optional(),"io.modelcontextprotocol/related-task":l.optional()}),h=E({_meta:m.optional()}),z=h.extend({task:s.optional()}),R=E({_meta:m.optional()}),v=E({method:u(),params:R.loose().optional()}),b=E({src:u(),mimeType:u().optional(),sizes:O(u()).optional(),theme:se(["light","dark"]).optional()}),g=E({icons:O(b).optional()}),d=E({name:u(),title:u().optional()}),_=d.extend({...d.shape,...g.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),p=gt(E({applyDefaults:G().optional()}),t),S=ar(xe=>xe&&typeof xe=="object"&&!Array.isArray(xe)&&Object.keys(xe).length===0?{form:{}}:xe,gt(E({form:p.optional(),url:t.optional()}),t.optional())),w=ne({list:t.optional(),cancel:t.optional(),requests:ne({sampling:ne({createMessage:t.optional()}).optional(),elicitation:ne({create:t.optional()}).optional()}).optional()}),y=ne({list:t.optional(),cancel:t.optional(),requests:ne({tools:ne({call:t.optional()}).optional()}).optional()}),f=E({experimental:B(u(),t).optional(),sampling:E({context:t.optional(),tools:t.optional()}).optional(),elicitation:S.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:w.optional(),extensions:B(u(),t).optional()}),T=E({experimental:B(u(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:y.optional(),extensions:B(u(),t).optional()}),A=E({progress:Z(),total:Q(Z()),message:Q(u())}),F=E({...R.shape,...A.shape,progressToken:r}),M=v.extend({method:j("notifications/progress"),params:F}),D=R.extend({level:a,logger:u().optional(),data:ee()}),Y=v.extend({method:j("notifications/message"),params:D}),K=E({uri:u(),mimeType:Q(u()),_meta:B(u(),ee()).optional()}),fe=K.extend({text:u()}),Te=K.extend({blob:c}),ze=E({audience:O(i).optional(),priority:Z().min(0).max(1).optional(),lastModified:lt.datetime({offset:!0}).optional()}),Ce=E({...d.shape,...g.shape,uri:u(),description:Q(u()),mimeType:Q(u()),size:Q(Z()),annotations:ze.optional(),_meta:Q(ne({}))}),ve=E({...d.shape,...g.shape,uriTemplate:u(),description:Q(u()),mimeType:Q(u()),annotations:ze.optional(),_meta:Q(ne({}))}),k=v.extend({method:j("notifications/resources/list_changed"),params:R.optional()}),x=R.extend({uri:u()}),V=v.extend({method:j("notifications/resources/updated"),params:x}),$=E({name:u(),description:Q(u()),required:Q(G())}),P=E({...d.shape,...g.shape,description:Q(u()),arguments:Q(O($)),_meta:Q(ne({}))}),N=v.extend({method:j("notifications/prompts/list_changed"),params:R.optional()}),H=E({type:j("text"),text:u(),annotations:ze.optional(),_meta:B(u(),ee()).optional()}),te=E({type:j("image"),data:c,mimeType:u(),annotations:ze.optional(),_meta:B(u(),ee()).optional()}),pe=E({type:j("audio"),data:c,mimeType:u(),annotations:ze.optional(),_meta:B(u(),ee()).optional()}),ae=E({type:j("tool_use"),name:u(),id:u(),input:B(u(),ee()),_meta:B(u(),ee()).optional()}),Re=E({type:j("resource"),resource:W([fe,Te]),annotations:ze.optional(),_meta:B(u(),ee()).optional()}),Ge=Ce.extend({type:j("resource_link")}),I=W([H,te,pe,Ge,Re]),C=E({role:i,content:I}),U=E({title:u().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),oe=v.extend({method:j("notifications/tools/list_changed"),params:R.optional()}),ie=E({name:u().optional()}),me=E({hints:O(ie).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),Ne=E({mode:se(["auto","required","none"]).optional()}),qe=E({type:j("boolean"),title:u().optional(),description:u().optional(),default:G().optional()}),Fe=E({type:j("string"),title:u().optional(),description:u().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:se(["email","uri","date","date-time"]).optional(),default:u().optional()}),Ae=E({type:se(["number","integer"]),title:u().optional(),description:u().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),Ie=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),default:u().optional()}),nt=E({type:j("string"),title:u().optional(),description:u().optional(),oneOf:O(E({const:u(),title:u()})),default:u().optional()}),Ue=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),enumNames:O(u()).optional(),default:u().optional()}),_t=W([Ie,nt]),at=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({type:j("string"),enum:O(u())}),default:O(u()).optional()}),St=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({anyOf:O(E({const:u(),title:u()}))}),default:O(u()).optional()}),Et=W([at,St]),It=W([Ue,_t,Et]),Bt=W([It,qe,Fe,Ae]),Kt=z.extend({mode:j("form").optional(),message:u(),requestedSchema:E({type:j("object"),properties:B(u(),Bt),required:O(u()).optional()}).catchall(ee())}),Gt=E({type:j("ref/resource"),uri:u()}),Wt=E({type:j("ref/prompt"),name:u()}),en=E({uri:u().startsWith("file://"),name:u().optional(),_meta:B(u(),ee()).optional()}),Pt=f.shape,tn=E({experimental:Pt.experimental,sampling:Pt.sampling,elicitation:Pt.elicitation,roots:Pt.roots,extensions:Pt.extensions}),ot=T.shape,hr=E({experimental:ot.experimental,logging:ot.logging,completions:ot.completions,prompts:ot.prompts,resources:ot.resources,tools:ot.tools,extensions:ot.extensions}),gr=ne({progressToken:r.optional(),[ur]:u(),[qr]:_.optional(),[wt]:tn,[Ut]:a.optional()}),Yt=E({...d.shape,...g.shape,description:u().optional(),inputSchema:ne({$schema:u().optional(),type:j("object")}),outputSchema:ne({$schema:u().optional()}).optional(),annotations:U.optional(),_meta:B(u(),ee()).optional()}),rn=E({type:j("tool_result"),toolUseId:u(),content:O(I),structuredContent:ee().optional(),isError:G().optional(),_meta:B(u(),ee()).optional()}),vr=W([H,te,pe,ae,rn]),Xt=E({role:i,content:W([vr,O(vr)]),_meta:B(u(),ee()).optional()}),_r=u(),Sr=ne({[Rt]:_.optional().catch(void 0)}),yr=Sr.optional();function He(xe){return ne({_meta:yr,resultType:_r.default("complete"),...xe})}let nn=He({}),To=He({nextCursor:n.optional()}),br=He({content:O(I),structuredContent:ee().optional(),isError:G().optional()}),on=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),tools:O(Yt),nextCursor:n.optional()}),an=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),prompts:O(P),nextCursor:n.optional()}),sn=He({description:u().optional(),messages:O(C)}),cn=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),resources:O(Ce),nextCursor:n.optional()}),un=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),resourceTemplates:O(ve),nextCursor:n.optional()}),ln=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),contents:O(W([fe,Te]))}),dn=He({completion:E({values:O(u()).max(100),total:Z().int().optional(),hasMore:G().optional()}).loose()}),Eo=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"])}),mn=He({ttlMs:Z().int().min(0).catch(0),cacheScope:se(["public","private"]).catch("private"),supportedVersions:O(u()),capabilities:hr,instructions:u().optional()}),kt=E({messages:O(Xt),modelPreferences:me.optional(),systemPrompt:u().optional(),includeContext:se(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:O(u()).optional(),metadata:t.optional(),tools:O(Yt).optional(),toolChoice:Ne.optional()}),pn=E({method:j("sampling/createMessage"),params:kt}),fn=E({method:j("roots/list"),params:E({_meta:B(u(),ee()).optional()}).optional()}),hn=E({...Xt.shape,model:u(),stopReason:u().optional()}),gn=E({roots:O(en)}),vn=E({action:se(["accept","decline","cancel"]),content:B(u(),W([u(),Z(),G(),O(u())])).optional()}),_n=E({mode:j("url"),message:u(),url:u().url()}),Sn=W([Kt,_n]),yn=E({method:j("elicitation/create"),params:Sn}),bn=W([pn,fn,yn]),$n=W([hn,gn,vn]),zn=B(u(),bn),Rn=B(u(),$n),Qt=He({inputRequests:zn.optional(),requestState:u().optional()}),er={inputResponses:Rn.optional(),requestState:u().optional()},Io=E({_meta:gr,...er}),Po=ne({progressToken:r.optional()});function et(xe,rr){return E({method:j(xe),params:E({_meta:gr,...rr})})}function tt(xe,rr){return E({method:j(xe),params:E({_meta:Po.optional(),...rr}).optional()})}let wn={name:u(),arguments:B(u(),ee()).optional(),...er},st={cursor:n.optional()},ko=et("tools/call",wn),Oo=et("tools/list",st),jo=et("prompts/list",st),No=et("prompts/get",{name:u(),arguments:B(u(),u()).optional(),...er}),xo=et("resources/list",st),Co=et("resources/templates/list",st),Ao=et("resources/read",{uri:u(),...er}),Tn={ref:W([Wt,Gt]),argument:E({name:u(),value:u()}),context:E({arguments:B(u(),u()).optional()}).optional()},qo=et("completion/complete",Tn),Mo=et("server/discover",{}),$r=E({toolsListChanged:G().optional(),promptsListChanged:G().optional(),resourcesListChanged:G().optional(),resourceSubscriptions:O(u()).optional()}),En={notifications:$r},Uo=et("subscriptions/listen",En),Lo=Sr.extend({"io.modelcontextprotocol/subscriptionId":o}),Do=ne({_meta:Lo,resultType:_r.default("complete")}),Ot={"tools/call":tt("tools/call",wn),"tools/list":tt("tools/list",st),"prompts/get":tt("prompts/get",{name:u(),arguments:B(u(),u()).optional()}),"prompts/list":tt("prompts/list",st),"resources/list":tt("resources/list",st),"resources/templates/list":tt("resources/templates/list",st),"resources/read":tt("resources/read",{uri:u()}),"completion/complete":tt("completion/complete",Tn),"server/discover":tt("server/discover",{}),"subscriptions/listen":tt("subscriptions/listen",En)};function Xe(xe){return ne({_meta:yr,...xe})}let Vo={"tools/call":Xe({content:O(I),structuredContent:ee().optional(),isError:G().optional()}),"tools/list":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),tools:O(Yt),nextCursor:n.optional()}),"prompts/get":Xe({description:u().optional(),messages:O(C)}),"prompts/list":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),prompts:O(P),nextCursor:n.optional()}),"resources/list":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),resources:O(Ce),nextCursor:n.optional()}),"resources/templates/list":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),resourceTemplates:O(ve),nextCursor:n.optional()}),"resources/read":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),contents:O(W([fe,Te]))}),"completion/complete":Xe({completion:E({values:O(u()).max(100),total:Z().int().optional(),hasMore:G().optional()}).loose()}),"server/discover":Xe({ttlMs:Z().int().min(0).catch(0),cacheScope:se(["public","private"]).catch("private"),supportedVersions:O(u()),capabilities:hr,instructions:u().optional()}),"subscriptions/listen":Xe({})},tr=ne({"io.modelcontextprotocol/subscriptionId":o.optional()}),zr=E({method:j("notifications/subscriptions/acknowledged"),params:E({_meta:tr.optional(),notifications:$r})}),Rr=E({_meta:tr.optional(),requestId:o,reason:u().optional()}),wr=E({method:j("notifications/cancelled"),params:Rr}),bs={"notifications/cancelled":wr,"notifications/progress":M,"notifications/message":Y,"notifications/resources/updated":V,"notifications/resources/list_changed":k,"notifications/tools/list_changed":oe,"notifications/prompts/list_changed":N,"notifications/subscriptions/acknowledged":zr},Qe=xe=>E({jsonrpc:j("2.0"),id:W([u(),Z().int()]),result:xe}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,RequestIdSchema:o,RoleSchema:i,LoggingLevelSchema:a,TaskMetadataSchema:s,RelatedTaskMetadataSchema:l,RequestMetaSchema:m,BaseRequestParamsSchema:h,TaskAugmentedRequestParamsSchema:z,NotificationsParamsSchema:R,NotificationSchema:v,IconSchema:b,IconsSchema:g,BaseMetadataSchema:d,ImplementationSchema:_,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:y,ClientCapabilitiesSchema:f,ServerCapabilitiesSchema:T,ProgressSchema:A,ProgressNotificationParamsSchema:F,ProgressNotificationSchema:M,LoggingMessageNotificationParamsSchema:D,LoggingMessageNotificationSchema:Y,ResourceContentsSchema:K,TextResourceContentsSchema:fe,BlobResourceContentsSchema:Te,AnnotationsSchema:ze,ResourceSchema:Ce,ResourceTemplateSchema:ve,ResourceListChangedNotificationSchema:k,ResourceUpdatedNotificationParamsSchema:x,ResourceUpdatedNotificationSchema:V,PromptArgumentSchema:$,PromptSchema:P,PromptListChangedNotificationSchema:N,TextContentSchema:H,ImageContentSchema:te,AudioContentSchema:pe,ToolUseContentSchema:ae,EmbeddedResourceSchema:Re,ResourceLinkSchema:Ge,ContentBlockSchema:I,PromptMessageSchema:C,ToolAnnotationsSchema:U,ToolListChangedNotificationSchema:oe,ModelHintSchema:ie,ModelPreferencesSchema:me,ToolChoiceSchema:Ne,BooleanSchemaSchema:qe,StringSchemaSchema:Fe,NumberSchemaSchema:Ae,UntitledSingleSelectEnumSchemaSchema:Ie,TitledSingleSelectEnumSchemaSchema:nt,LegacyTitledEnumSchemaSchema:Ue,SingleSelectEnumSchemaSchema:_t,UntitledMultiSelectEnumSchemaSchema:at,TitledMultiSelectEnumSchemaSchema:St,MultiSelectEnumSchemaSchema:Et,EnumSchemaSchema:It,PrimitiveSchemaDefinitionSchema:Bt,ElicitRequestFormParamsSchema:Kt,ResourceTemplateReferenceSchema:Gt,PromptReferenceSchema:Wt,RootSchema:en,ClientCapabilities2026Schema:tn,ServerCapabilities2026Schema:hr,RequestMetaEnvelopeSchema:gr,ToolSchema:Yt,ToolResultContentSchema:rn,SamplingMessageContentBlockSchema:vr,SamplingMessageSchema:Xt,ResultTypeSchema:_r,ResultMetaSchema:Sr,ResultSchema:nn,PaginatedResultSchema:To,CallToolResultSchema:br,ListToolsResultSchema:on,ListPromptsResultSchema:an,GetPromptResultSchema:sn,ListResourcesResultSchema:cn,ListResourceTemplatesResultSchema:un,ReadResourceResultSchema:ln,CompleteResultSchema:dn,CacheableResultSchema:Eo,DiscoverResultSchema:mn,CreateMessageRequestParamsSchema:kt,CreateMessageRequestSchema:pn,ListRootsRequestSchema:fn,CreateMessageResultSchema:hn,ListRootsResultSchema:gn,ElicitResultSchema:vn,ElicitRequestURLParamsSchema:_n,ElicitRequestParamsSchema:Sn,ElicitRequestSchema:yn,InputRequestSchema:bn,InputResponseSchema:$n,InputRequestsSchema:zn,InputResponsesSchema:Rn,InputRequiredResultSchema:Qt,InputResponseRequestParamsSchema:Io,CallToolRequestSchema:ko,ListToolsRequestSchema:Oo,ListPromptsRequestSchema:jo,GetPromptRequestSchema:No,ListResourcesRequestSchema:xo,ListResourceTemplatesRequestSchema:Co,ReadResourceRequestSchema:Ao,CompleteRequestSchema:qo,DiscoverRequestSchema:Mo,SubscriptionFilterSchema:$r,SubscriptionsListenRequestSchema:Uo,SubscriptionsListenResultMetaSchema:Lo,SubscriptionsListenResultSchema:Do,dispatchRequestSchemas:Ot,dispatchResultSchemas:Vo,NotificationMetaSchema:tr,SubscriptionsAcknowledgedNotificationSchema:zr,CancelledNotificationParamsSchema:Rr,CancelledNotificationSchema:wr,notificationSchemas2026:bs,JSONRPCResultResponseSchema:Qe(nn),CallToolResultResponseSchema:Qe(W([br,Qt])),ListToolsResultResponseSchema:Qe(on),ListPromptsResultResponseSchema:Qe(an),GetPromptResultResponseSchema:Qe(W([sn,Qt])),ListResourcesResultResponseSchema:Qe(cn),ListResourceTemplatesResultResponseSchema:Qe(un),ReadResourceResultResponseSchema:Qe(W([ln,Qt])),CompleteResultResponseSchema:Qe(dn),DiscoverResultResponseSchema:Qe(mn)}}var L_;function pr(){return L_??=U_()}var D_=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function V_(e){return D_.includes(e)}var Gr=Symbol("modelcontextprotocol.resultCacheHintFallback");function Wf(e,t){if(t===void 0)return e;let r=e[Gr];if(r===void 0)return{...e,[Gr]:t};let n={},o=r.ttlMs??t.ttlMs;o!==void 0&&(n.ttlMs=o);let i=r.cacheScope??t.cacheScope;return i!==void 0&&(n.cacheScope=i),{...e,[Gr]:n}}function Z_(e){return e[Gr]}function Lu(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Du(e){return e==="public"||e==="private"}function Yf(e,t){if(e.ttlMs!==void 0&&!Lu(e.ttlMs))throw new RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!Du(e.cacheScope))throw new RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var X=(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})({}),ge=class Xf extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Wr(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Wr(this,t)}constructor(t,r,n){super(r),this.code=t,this.data=n,this.name="ProtocolError",Cu(this,new.target)}static fromError(t,r,n){if(t===X.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Qf(o.elicitations,r)}if(t===X.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested=="string")return new Zu({supported:o.supported,requested:o.requested},r)}if(t===X.InvalidParams||t===X.ResourceNotFound){let o=n;if(typeof o?.uri=="string"&&(t===X.ResourceNotFound||Object.keys(o).length===1))return new Vu(o.uri,r)}if(t===X.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities=="object"&&!Array.isArray(o.requiredCapabilities))return new ts({requiredCapabilities:o.requiredCapabilities},r)}return new Xf(t,r,n)}},Vu=class extends ge{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Qf=class extends ge{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Zu=class extends ge{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ts=class extends ge{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},F_=0,H_="private",J_=["tools/call","prompts/get","resources/read"];function B_(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete"||J_.includes(e))return t;throw new ge(X.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function K_(e,t){let r=Z_(t);if(t.resultType!=="complete"||!V_(e))return r===void 0?t:Q_(t);let n=t,o=Lu(n.ttlMs)?n.ttlMs:Y_(r),i=Du(n.cacheScope)?n.cacheScope:X_(r),a={...n,ttlMs:o,cacheScope:i};return delete a[Gr],a}function G_(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function W_(e,t){if(t===void 0)return e;let r=e._meta;return r===void 0?{...e,_meta:{[Rt]:t}}:!G_(r)||r[Rt]!==void 0?e:{...e,_meta:{...r,[Rt]:t}}}function Y_(e){return e!==void 0&&Lu(e.ttlMs)?e.ttlMs:F_}function X_(e){return e!==void 0&&Du(e.cacheScope)?e.cacheScope:H_}function Q_(e){let t={...e};return delete t[Gr],t}var eS=["elicitation/create","sampling/createMessage","roots/list"],Ga;function eh(){if(Ga)return Ga;let e=pr();return Ga={request:{"elicitation/create":E({method:j("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":E({method:j("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":E({method:j("roots/list"),params:ne({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Ga}function th(e){return eS.includes(e)}function Tu(e){return th(e)?eh().request[e]:void 0}function tS(e){return th(e)?eh().response[e]:void 0}var Fu={"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},rh={"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 nh(e){return Object.prototype.hasOwnProperty.call(Fu,e)}function oh(e){return Object.prototype.hasOwnProperty.call(rh,e)}function rS(e){return Object.prototype.hasOwnProperty.call(Fu,e)}function nS(e){return nh(e)?pr().dispatchRequestSchemas[e]:void 0}function oS(e){return rS(e)?pr().dispatchResultSchemas[e]:void 0}function iS(e){return oh(e)?pr().notificationSchemas2026[e]:void 0}var iT=Object.keys(Fu),aT=Object.keys(rh);function So(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function vo(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var aS={ok:!1,reason:"not-in-era"},sS=[ur,wt];function cS(e,t){let r=t,n=!1,o=()=>(n||(r={...r},n=!0),r),i=t.tools;e==="tools/list"&&Array.isArray(i)&&i.some(c=>So(c)&&"execution"in c)&&(o().tools=i.map(c=>{if(!So(c)||!("execution"in c))return c;let s={...c};return delete s.execution,s}));let a=t.capabilities;if(So(a)&&"tasks"in a){let c={...a};delete c.tasks,o().capabilities=c}return r}var Hu={era:"2026-07-28",hasRequestMethod:nh,hasNotificationMethod:oh,hasInputRequestMethod:e=>Tu(e)!==void 0,validateRequest:(e,t)=>vo(nS(e),t),validateResult:(e,t)=>vo(oS(e),t),validateNotification:(e,t)=>vo(iS(e),t),validateInputRequest:(e,t)=>vo(Tu(e),t),validateInputResponse:(e,t)=>vo(tS(e),t),samplingResultVariant:()=>aS,outboundEnvelope(e){return{[ur]:e.protocolVersion,[qr]:e.clientInfo,[wt]:e.clientCapabilities,...e.logLevel!==void 0&&{[Ut]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of sS)n in e||t.push({key:n,problem:"missing"});let r=pr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let n of r.error.issues){let o=n.path.map(String),i=o.length>0?o.join("."):"_meta";o.length===1&&t.some(a=>a.key===i&&a.problem==="missing")||t.push({key:i,problem:n.message})}return t},projectCallToolResult:e=>Vf(e),inputRequestSchema:Tu,decodeResult(e,t){if(!So(t))return{kind:"invalid",error:new le(he.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new le(he.InvalidResult,`Invalid result for ${e}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!="string")return{kind:"invalid",error:new le(he.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let a=t.inputRequests,c=So(a)?a:{},s=t.requestState;return Object.keys(c).length===0&&typeof s!="string"?{kind:"invalid",error:new le(he.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:c,...typeof s=="string"&&{requestState:s}}}if(r!=="complete")return{kind:"invalid",error:new le(he.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let n=uS(),o=Object.hasOwn(n,e)?n[e]:void 0;if(o!==void 0){let a=o.safeParse(t);if(!a.success)return{kind:"invalid",error:new le(he.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,r){return W_(K_(e,B_(e,cS(e,t))),r)},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=pr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(r=>r.message).join("; ")}`}},Wa;function uS(){if(Wa)return Wa;let e=pr();return Wa={"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},Wa}var Ju="2026-07-28";function Yr(e){return e!==void 0&&$o(e)?Hu:Uu}function Of(e){return e.revision!==void 0?Yr(e.revision).era:e.era==="modern"?Hu.era:Uu.era}function Eu(e){return ih.some(t=>t.hasRequestMethod(e))}function Iu(e){return ih.some(t=>t.hasNotificationMethod(e))}var ih=[Uu,Hu];var lS=Rl({AnnotationsSchema:()=>Tt,AudioContentSchema:()=>Fr,BaseMetadataSchema:()=>zt,BaseRequestParamsSchema:()=>De,BlobResourceContentsSchema:()=>oo,BooleanSchemaSchema:()=>uo,CallToolRequestParamsSchema:()=>aa,CallToolRequestSchema:()=>sa,CallToolResultSchema:()=>co,CancelTaskRequestSchema:()=>lu,CancelTaskResultSchema:()=>du,CancelledNotificationParamsSchema:()=>ui,CancelledNotificationSchema:()=>Xn,ClientCapabilitiesSchema:()=>pi,ClientNotificationSchema:()=>pu,ClientRequestSchema:()=>mu,ClientResultSchema:()=>fu,ClientTasksCapabilitySchema:()=>di,CompatibilityCallToolResultSchema:()=>Qc,CompleteRequestParamsSchema:()=>xa,CompleteRequestSchema:()=>Ca,CompleteResultSchema:()=>Aa,ContentBlockSchema:()=>Hr,CreateMessageRequestParamsSchema:()=>Sa,CreateMessageRequestSchema:()=>ya,CreateMessageResultSchema:()=>ba,CreateMessageResultWithToolsSchema:()=>$a,CreateTaskResultSchema:()=>ru,CursorSchema:()=>Hn,DiscoverRequestSchema:()=>_i,DiscoverResultSchema:()=>Si,ElicitRequestFormParamsSchema:()=>Kr,ElicitRequestParamsSchema:()=>Ea,ElicitRequestSchema:()=>Ia,ElicitRequestURLParamsSchema:()=>Ta,ElicitResultSchema:()=>Oa,ElicitationCompleteNotificationParamsSchema:()=>Pa,ElicitationCompleteNotificationSchema:()=>ka,EmbeddedResourceSchema:()=>Yi,EmptyResultSchema:()=>Yn,EnumSchemaSchema:()=>wa,GetPromptRequestParamsSchema:()=>Ki,GetPromptRequestSchema:()=>Gi,GetPromptResultSchema:()=>ea,GetTaskPayloadRequestSchema:()=>au,GetTaskPayloadResultSchema:()=>su,GetTaskRequestSchema:()=>ou,GetTaskResultSchema:()=>iu,IconSchema:()=>li,IconsSchema:()=>Dt,ImageContentSchema:()=>Zr,ImplementationSchema:()=>Lr,InitializeRequestParamsSchema:()=>fi,InitializeRequestSchema:()=>hi,InitializeResultSchema:()=>gi,InitializedNotificationSchema:()=>vi,JSONArraySchema:()=>Wc,JSONObjectSchema:()=>ke,JSONRPCErrorResponseSchema:()=>Ur,JSONRPCMessageSchema:()=>Wn,JSONRPCNotificationSchema:()=>Gn,JSONRPCRequestSchema:()=>Kn,JSONRPCResponseSchema:()=>Yc,JSONRPCResultResponseSchema:()=>Mr,JSONValueSchema:()=>Mt,LegacyTitledEnumSchemaSchema:()=>po,ListChangedOptionsBaseSchema:()=>eu,ListPromptsRequestSchema:()=>Ji,ListPromptsResultSchema:()=>Bi,ListResourceTemplatesRequestSchema:()=>Ti,ListResourceTemplatesResultSchema:()=>Ei,ListResourcesRequestSchema:()=>Ri,ListResourcesResultSchema:()=>wi,ListRootsRequestSchema:()=>Ma,ListRootsResultSchema:()=>Ua,ListTasksRequestSchema:()=>cu,ListTasksResultSchema:()=>uu,ListToolsRequestSchema:()=>oa,ListToolsResultSchema:()=>ia,LoggingLevelSchema:()=>Ht,LoggingMessageNotificationParamsSchema:()=>da,LoggingMessageNotificationSchema:()=>ma,ModelHintSchema:()=>pa,ModelPreferencesSchema:()=>fa,MultiSelectEnumSchemaSchema:()=>Ra,NotificationSchema:()=>Ke,NotificationsParamsSchema:()=>Be,NumberSchemaSchema:()=>Br,PaginatedRequestParamsSchema:()=>$i,PaginatedRequestSchema:()=>Vt,PaginatedResultSchema:()=>Zt,PingRequestSchema:()=>eo,PrimitiveSchemaDefinitionSchema:()=>go,ProgressNotificationParamsSchema:()=>bi,ProgressNotificationSchema:()=>to,ProgressSchema:()=>yi,ProgressTokenSchema:()=>Fn,PromptArgumentSchema:()=>Fi,PromptListChangedNotificationSchema:()=>ta,PromptMessageSchema:()=>Qi,PromptReferenceSchema:()=>Na,PromptSchema:()=>Hi,ReadResourceRequestParamsSchema:()=>Ii,ReadResourceRequestSchema:()=>Pi,ReadResourceResultSchema:()=>ki,RelatedTaskMetadataSchema:()=>ci,RequestIdSchema:()=>Lt,RequestMetaSchema:()=>Jn,RequestSchema:()=>Oe,ResourceContentsSchema:()=>ro,ResourceLinkSchema:()=>Xi,ResourceListChangedNotificationSchema:()=>Oi,ResourceRequestParamsSchema:()=>Dr,ResourceSchema:()=>io,ResourceTemplateReferenceSchema:()=>ja,ResourceTemplateSchema:()=>zi,ResourceUpdatedNotificationParamsSchema:()=>Vi,ResourceUpdatedNotificationSchema:()=>Zi,ResultMetaObjectSchema:()=>Bn,ResultSchema:()=>je,RoleSchema:()=>Ft,RootSchema:()=>qa,RootsListChangedNotificationSchema:()=>La,SamplingContentSchema:()=>va,SamplingMessageContentBlockSchema:()=>sr,SamplingMessageSchema:()=>_a,ServerCapabilitiesSchema:()=>Qn,ServerNotificationSchema:()=>gu,ServerRequestSchema:()=>hu,ServerResultSchema:()=>vu,ServerTasksCapabilitySchema:()=>mi,SetLevelRequestParamsSchema:()=>ua,SetLevelRequestSchema:()=>la,SingleSelectEnumSchemaSchema:()=>za,StringSchemaSchema:()=>Jr,SubscribeRequestParamsSchema:()=>ji,SubscribeRequestSchema:()=>Ni,SubscriptionFilterSchema:()=>ao,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Mi,SubscriptionsAcknowledgedNotificationSchema:()=>Ui,SubscriptionsListenRequestParamsSchema:()=>Ai,SubscriptionsListenRequestSchema:()=>qi,SubscriptionsListenResultMetaSchema:()=>Li,SubscriptionsListenResultSchema:()=>Di,TaskAugmentedRequestParamsSchema:()=>dr,TaskCreationParamsSchema:()=>tu,TaskMetadataSchema:()=>si,TaskSchema:()=>Jt,TaskStatusNotificationParamsSchema:()=>Va,TaskStatusNotificationSchema:()=>nu,TaskStatusSchema:()=>Da,TextContentSchema:()=>Vr,TextResourceContentsSchema:()=>no,TitledMultiSelectEnumSchemaSchema:()=>ho,TitledSingleSelectEnumSchemaSchema:()=>mo,ToolAnnotationsSchema:()=>ra,ToolChoiceSchema:()=>ha,ToolExecutionSchema:()=>na,ToolListChangedNotificationSchema:()=>ca,ToolResultContentSchema:()=>ga,ToolSchema:()=>so,ToolUseContentSchema:()=>Wi,UnsubscribeRequestParamsSchema:()=>xi,UnsubscribeRequestSchema:()=>Ci,UntitledMultiSelectEnumSchemaSchema:()=>fo,UntitledSingleSelectEnumSchemaSchema:()=>lo});var Bu=e=>Kn.safeParse(e).success,Ku=e=>Gn.safeParse(e).success,Qa=e=>Mr.safeParse(e).success,Gu=e=>Ur.safeParse(e).success;var fr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var Ya=-32020,sT=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[X.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Ya,X.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[X.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[X.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[X.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Ya],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[X.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Ya],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],dS={[X.ParseError]:400,[X.InvalidRequest]:400,[X.MethodNotFound]:404,[X.UnsupportedProtocolVersion]:400,[X.MissingRequiredClientCapability]:400,[Ya]:400};function rs(e,t){return ti(e,t)}function _o(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function ju(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 jf=!1,Nu="draft-2020-12";function ah(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:Nu});else if(r.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");jf||(jf=!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.")),n=Dn(e,{target:Nu,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return n.type!==void 0?n:sh(n)?{type:"object",...n}:n;if(n.type!==void 0&&n.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(n.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...n}}function sh(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every(n=>n!==null&&typeof n=="object"&&(n.type==="object"||sh(n)))}return!1}function mS(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function Xa(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(n=>mS(n)).join(", ")}:{success:!0,data:r.value}}function pS(e){let t=Dn(e,{target:Nu,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var fS=/\\\.\\d\{(\d+)\}/;function hS(e){let t=fS.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(n=>[!1,!0].flatMap(o=>r.map(i=>lt.datetime({local:n,offset:o,precision:i}))))}function gS(e,t){let r;switch(e){case"email":r=[Hc()];break;case"uri":r=[Vn()];break;case"date":r=[lt.date()];break;case"date-time":r=hS(t);break}return new Set(r.map(n=>pS(n)).filter(n=>n!==void 0))}function vS(e,t,r){return r!=="zod"?!0:gS(e,t).has(t)}function bo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _S(e){try{return ah(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new ge(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var SS=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Wu(e){return SS.has(e)||e.startsWith("x-")}var yS=new Set(["$schema",...Object.keys(Kr.shape.requestedSchema.shape)]),Nf={string:_o([Jr,lo,mo,po]),number:_o([Br]),integer:_o([Br]),boolean:_o([uo]),array:_o([fo,ho])},bS=new Set(Jr.shape.format.unwrap().options);function $S(e,t,r,n){if(!bo(e))return e;let o=typeof e.type=="string"&&Object.hasOwn(Nf,e.type)?Nf[e.type]:void 0;if(o===void 0)return e;let i={};for(let[a,c]of Object.entries(e))o.has(a)||Wu(a)?i[a]=c:a==="pattern"&&e.type==="string"&&typeof e.format=="string"?bS.has(e.format)?(typeof c!="string"||!vS(e.format,c,r))&&n.push(`${t}.${a}`):i[a]=c:n.push(`${t}.${a}`);return i}function zS(e,t){let r={},n=[];for(let[o,i]of Object.entries(e))o==="properties"&&bo(i)?r[o]=Object.fromEntries(Object.entries(i).map(([a,c])=>[a,$S(c,`properties.${a}`,t,n)])):yS.has(o)?r[o]=i:Wu(o)||n.push(o);if(n.length>0)throw new ge(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function RS(e,t){if(!bo(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!rs(go,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function xu(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((n,o)=>xu(n,t[o],`${r}[${o}]`)):!bo(e)||!bo(t)?[]:Object.entries(e).flatMap(([n,o])=>{let i=r?`${r}.${n}`:n;return Object.prototype.hasOwnProperty.call(t,n)?xu(o,t[n],i):Wu(n)?[]:[i]})}function wS(e){if(!ju(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=zS(_S(e.requestedSchema),t),n=rs(Kr.shape.requestedSchema,r);if(!n.success)throw new ge(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${RS(r,n.error.message)}`);let o=xu(r,n.data);if(o.length>0)throw new ge(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let i=(n.data.required??[]).filter(a=>!Object.prototype.hasOwnProperty.call(n.data.properties,a));if(i.length>0)throw new ge(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function TS(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var ES=Object.assign(TS,{elicit(e){try{return{method:"elicitation/create",params:wS(e)}}catch(t){throw t instanceof ge?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var ch=250;function uh(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function lh(e,t){return new Promise((r,n)=>{if(t?.aborted){n(t.reason instanceof le?t.reason:new le(he.RequestTimeout,String(t.reason)));return}let o=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e),i=()=>{clearTimeout(o),n(t?.reason instanceof le?t.reason:new le(he.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}function dh(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:n=>t.abort(n),dispose:()=>e?.removeEventListener("abort",r)}}var IS=["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"],PS={IdJagTokenExchangeResponseSchema:bu,OAuthClientInformationFullSchema:zu,OAuthClientInformationSchema:Ja,OAuthClientMetadataSchema:Ha,OAuthClientRegistrationErrorSchema:Ru,OAuthErrorResponseSchema:$u,OAuthMetadataSchema:Za,OAuthProtectedResourceMetadataSchema:_u,OAuthTokenRevocationRequestSchema:wu,OAuthTokensSchema:yu,OpenIdProviderDiscoveryMetadataSchema:Su,OpenIdProviderMetadataSchema:Fa},mh={},ph={};function fh(e,t){let r=e.slice(0,-6);mh[r]=t,ph[r]=n=>t.safeParse(n).success}for(let e of IS)fh(e,lS[e]);for(let[e,t]of Object.entries(PS))fh(e,t);var kS=Object.freeze(mh),OS=Object.freeze(ph);function jS(e){switch(e){case"initialize":case"notifications/initialized":return Yr(void 0);case"server/discover":return Yr(Ju);default:return}}var hh=6e4,NS=[ur,qr,wt,Ut],xS=["inputResponses","requestState"];function xf(e,t){let r=e.params;if(!yo(r))return{message:e,lifted:{}};let n=r._meta,o=yo(n)?NS.filter(s=>s in n):[],i=t==="request"?xS.filter(s=>s in r):[];if(o.length===0&&i.length===0)return{message:e,lifted:{}};let a={},c={...r};if(o.length>0&&yo(n)){let s={},l={...n};for(let m of o)s[m]=n[m],delete l[m];a.envelope=s,Object.keys(l).length>0?c._meta=l:delete c._meta}for(let s of i)s==="inputResponses"&&(a.inputResponses=c[s]),s==="requestState"&&(a.requestState=c[s]),delete c[s];return{message:{...e,params:c},lifted:a}}function Cf(e,t){let r=e.validateResult(t,void 0);if(!(!r.ok&&r.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(n){let o=e.validateResult(t,n);return o.ok?{value:o.value}:{issues:[{message:o.reason==="invalid"?o.message:`not-in-era: ${t}`}]}}}}}function zo(e){return()=>e}var CS=zo(void 0);function Yu(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:zo(t)}}}var AS;var Xu=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;static{AS=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??ii,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new le(he.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,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new le(he.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});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 r=this.transport?.onerror;this._transport.onerror=o=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,i)=>{n?.(o,i),Qa(o)||Gu(o)?this._onresponse(o):Bu(o)?this._onrequest(o,i):Ku(o)?this._onnotification(o,i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},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 n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new le(he.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let n of e.values())n(r);for(let n of t.values())n.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=xf(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=Of(t.classification);if(a!==n.era){this._onerror(new Error(`Era mismatch on inbound notification '${r.method}': classified as ${a} but this instance serves ${n.era}`));return}}if(Iu(r.method)&&!n.hasNotificationMethod(r.method))return;let o=this._notificationHandlers.get(r.method),i=this.fallbackNotificationHandler;o===void 0&&i===void 0||Promise.resolve().then(()=>o===void 0?i(r):o(r,n)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:r,lifted:n}=xf(e,"request"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let i=this._transport,a=(b,g,d)=>{let _={jsonrpc:"2.0",id:r.id,error:{code:b,message:g,...d!==void 0&&{data:d}}};i?.send(_).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)))};if(t?.classification!==void 0){let b=Of(t.classification);if(b!==o.era){this._onerror(new Error(`Era mismatch on inbound request '${r.method}': classified as ${b} but this instance serves ${o.era}`));let g=t.classification.revision??b;a(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${g}`,{supported:this._supportedProtocolVersions,requested:g});return}}if(Eu(r.method)&&!o.hasRequestMethod(r.method)){a(X.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(c===void 0){a(X.MethodNotFound,"Method not found");return}let s=o.checkInboundEnvelope(n);if(s!==void 0){a(X.InvalidParams,s);return}let l=(b,g)=>this._notificationViaCodec(this._resolveOutboundCodec(b.method),b,{...g,relatedRequestId:r.id}),m=(b,g,d)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(b.method),b,g,{...d,relatedRequestId:r.id}),h=new AbortController;this._requestHandlerAbortControllers.set(r.id,h);let z=n.inputResponses===void 0?void 0:qS(n.inputResponses),R={sessionId:i?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...n.envelope!==void 0&&{envelope:n.envelope},...z!==void 0&&{inputResponses:z.accepted},...z!==void 0&&z.droppedKeys.length>0&&{droppedInputResponseKeys:z.droppedKeys},requestState:n.requestState===void 0?CS:zo(n.requestState),signal:h.signal,send:((b,g,d)=>{let _=this._resolveOutboundCodec(b.method);if(this._assertOutboundRequestInEra(_,b.method),ju(g))return m(b,g,d);let p=Cf(_,b.method);if(p===void 0)throw new TypeError(`'${b.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return m(b,p,g)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},v=this.buildContext(R,t);Promise.resolve().then(()=>c(r,v)).then(async b=>{if(h.signal.aborted)return;let g;try{g=o.encodeResult(r.method,b,this._outboundServerInfo())}catch(_){this._onerror(new Error(`Failed to encode result for ${r.method}: ${_}`)),a(X.InternalError,"Internal error");return}let d={result:g,jsonrpc:"2.0",id:r.id};await i?.send(d)},async b=>{if(h.signal.aborted)return;let g=Number.isSafeInteger(b.code)?b.code:X.InternalError,d={jsonrpc:"2.0",id:r.id,error:{code:o.encodeErrorCode(g),message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};await i?.send(d)}).catch(b=>this._onerror(new Error(`Failed to send response: ${b}`))).finally(()=>{this._requestHandlerAbortControllers.get(r.id)===h&&this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Qa(e)?r(e):r(ge.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let n=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(n,e.method),ju(t))return this._requestWithSchemaViaCodec(n,e,t,r);let o=Cf(n,e.method);if(o===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(n,e,o,t)}_negotiatedWireCodec(){return Yr(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=jS(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Eu(t)&&!e.hasRequestMethod(t))throw new le(he.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let n=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(n,e.method),this._requestWithSchemaViaCodec(n,e,t,r)}_requestWithSchemaViaCodec(e,t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,headers:c}=n??{},s=Date.now(),l,m;return new Promise((h,z)=>{let R=y=>{z(y)};if(!this._transport){R(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(y){R(y);return}if(n?.signal?.aborted){let y=n.signal.reason;throw y instanceof le?y:new le(he.RequestTimeout,String(y))}let v=e.era===Ju&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,b=this._requestMessageId++;m=b;let g={...t,jsonrpc:"2.0",id:b};n?.onprogress&&(this._progressHandlers.set(b,n.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:b}});let d=this._envelopeOutbound(g),_=!1,p=y=>{_||(this._progressHandlers.delete(b),v===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(y)}}),{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(f=>this._onerror(new Error(`Failed to send cancellation: ${f}`))):v.abort(),z(y instanceof le?y:new le(he.RequestTimeout,String(y))))};this._responseHandlers.set(b,y=>{if(n?.signal?.aborted)return;if(_=!0,y instanceof Error)return z(y);let f;try{f=e.decodeResult(t.method,y.result)}catch(A){return z(A instanceof Error?A:new Error(String(A)))}if(f.kind==="invalid")return z(f.error);if(f.kind==="input_required"){if(n?.allowInputRequired===!0)return h(MS(f));let A={codec:e,request:t,resultSchema:r,options:n,flowStartedAt:s,retry:(F,M)=>this._requestWithSchemaViaCodec(e,F===void 0?{method:t.method}:{method:t.method,params:F},r,M)};return h(this._resolveNonCompleteResult(f,A))}let T=f.result;Xa(r,T).then(A=>{A.success?h(A.data):z(new le(he.InvalidResult,`Invalid result for ${t.method}: ${A.error}`))},z)}),l=()=>p(n?.signal?.reason),n?.signal?.addEventListener("abort",l,{once:!0});let S=n?.timeout??hh,w=()=>p(new le(he.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(b,S,n?.maxTotalTimeout,w,n?.resetTimeoutOnProgress??!1),this._transport.send(d,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,headers:c,requestSignal:v?.signal}).catch(y=>{this._progressHandlers.delete(b),z(y)})}).finally(()=>{l&&n?.signal?.removeEventListener("abort",l),m!==void 0&&(this._responseHandlers.delete(m),this._cleanupTimeout(m))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new le(he.NotConnected,"Not connected");if(Iu(t.method)&&!e.hasNotificationMethod(t.method))throw new le(he.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 n=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.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(n,r).catch(o=>this._onerror(o))});return}await this._transport.send(n,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let n;if(typeof t=="function"){if(!Eu(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);n=(o,i)=>{let a=this._negotiatedWireCodec(),c=a.validateRequest(e,o);if(!c.ok&&c.reason==="not-in-era"&&(c=a.validateInputRequest(e,o)),!c.ok)throw c.reason==="not-in-era"?new ge(X.InternalError,`No wire schema for ${e} in the resolved era`):new Error(c.message);return Promise.resolve(t(c.value,i))}}else if(r)n=async(o,i)=>{let a=await Xa(t.params,{...o.params});if(!a.success)throw new ge(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return r(a.data,i)};else throw new TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,n))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t=="function"){if(!Iu(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,o)=>{let i=o.validateNotification(e,n);if(!i.ok)throw i.reason==="not-in-era"?new ge(X.InternalError,`No wire schema for ${e} in the resolved era`):new Error(i.message);return Promise.resolve(t(i.value))});return}if(!r)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async n=>{let o=await Xa(t.params,{...n.params});if(!o.success)throw new ge(X.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await r(o.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function yo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qu(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];r[o]=yo(a)&&yo(i)?{...a,...i}:i}return r}function Af(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qS(e){let t={},r=[];if(!Af(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!Af(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function MS(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}var US=L((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=o;function o(c){if(!c)throw new TypeError("argument string is required");var s=typeof c=="object"?i(c):c;if(typeof s!="string")throw new TypeError("argument string is required to be a string");var l=s.indexOf(";"),m=l!==-1?s.slice(0,l).trim():s.trim();if(!n.test(m))throw new TypeError("invalid media type");var h=new a(m.toLowerCase());if(l!==-1){var z,R,v;for(t.lastIndex=l;R=t.exec(s);){if(R.index!==l)throw new TypeError("invalid parameter format");l+=R[0].length,z=R[1].toLowerCase(),v=R[2],v.charCodeAt(0)===34&&(v=v.slice(1,-1),v.indexOf("\\")!==-1&&(v=v.replace(r,"$1"))),h.parameters[z]=v}if(l!==s.length)throw new TypeError("invalid parameter format")}return h}function i(c){var s;if(typeof c.getHeader=="function"?s=c.getHeader("content-type"):typeof c.headers=="object"&&(s=c.headers&&c.headers["content-type"]),typeof s!="string")throw new TypeError("content-type header is missing from object");return s}function a(c){this.parameters=Object.create(null),this.type=c}})),cT=Fo(US(),1);var gh=10*1024*1024,el=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??gh}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(` +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){o(i);continue}if(e.external){let s=e.external.registry.get(i[0])?.id;if(t!==i[0]&&s){o(i);continue}}if(e.metadataRegistry.get(i[0])?.id){o(i);continue}if(a.cycle){o(i);continue}if(a.count>1&&e.reused==="ref"){o(i);continue}}}function xr(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=a=>{let c=e.seen.get(a),s=c.def??c.schema,l={...s};if(c.ref===null)return;let m=c.ref;if(c.ref=null,m){n(m);let h=e.seen.get(m).schema;h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(s.allOf=s.allOf??[],s.allOf.push(h)):(Object.assign(s,h),Object.assign(s,l))}c.isParent||e.override({zodSchema:a,jsonSchema:s,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())n(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,r.def??r.schema);let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Ln(t,"input"),output:Ln(t,"output")}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function Ye(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return Ye(n.element,r);if(n.type==="set")return Ye(n.valueType,r);if(n.type==="lazy")return Ye(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return Ye(n.innerType,r);if(n.type==="intersection")return Ye(n.left,r)||Ye(n.right,r);if(n.type==="record"||n.type==="map")return Ye(n.keyType,r)||Ye(n.valueType,r);if(n.type==="pipe")return Ye(n.in,r)||Ye(n.out,r);if(n.type==="object"){for(let o in n.shape)if(Ye(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(Ye(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(Ye(o,r))return!0;return!!(n.rest&&Ye(n.rest,r))}return!1}var Pp=(e,t={})=>r=>{let n=jr({...r,processors:t});return be(e,n),Nr(n,e),xr(n,e)},Ln=(e,t)=>r=>{let{libraryOptions:n,target:o}=r??{},i=jr({...n??{},target:o,io:t,processors:{}});return be(e,i),Nr(i,e),xr(i,e)};var $v={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},ac=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:a,format:c,patterns:s,contentEncoding:l}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),c&&(o.format=$v[c]??c,o.format===""&&delete o.format),l&&(o.contentEncoding=l),s&&s.size>0){let m=[...s];m.length===1?o.pattern=m[0].source:m.length>1&&(o.allOf=[...m.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},sc=(e,t,r,n)=>{let o=r,{minimum:i,maximum:a,format:c,multipleOf:s,exclusiveMaximum:l,exclusiveMinimum:m}=e._zod.bag;typeof c=="string"&&c.includes("int")?o.type="integer":o.type="number",typeof m=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=m,o.exclusiveMinimum=!0):o.exclusiveMinimum=m),typeof i=="number"&&(o.minimum=i,typeof m=="number"&&t.target!=="draft-04"&&(m>=i?delete o.minimum:delete o.exclusiveMinimum)),typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=l,o.exclusiveMaximum=!0):o.exclusiveMaximum=l),typeof a=="number"&&(o.maximum=a,typeof l=="number"&&t.target!=="draft-04"&&(l<=a?delete o.maximum:delete o.exclusiveMaximum)),typeof s=="number"&&(o.multipleOf=s)},cc=(e,t,r,n)=>{r.type="boolean"},uc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},kp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},lc=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},Op=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},jp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},dc=(e,t,r,n)=>{r.not={}},mc=(e,t,r,n)=>{},pc=(e,t,r,n)=>{},fc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},hc=(e,t,r,n)=>{let o=e._zod.def,i=Pn(o.entries);i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),r.enum=i},gc=(e,t,r,n)=>{let o=e._zod.def,i=[];for(let a of o.values)if(a===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(a))}else i.push(a);if(i.length!==0)if(i.length===1){let a=i[0];r.type=a===null?"null":typeof a,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[a]:r.const=a}else i.every(a=>typeof a=="number")&&(r.type="number"),i.every(a=>typeof a=="string")&&(r.type="string"),i.every(a=>typeof a=="boolean")&&(r.type="boolean"),i.every(a=>a===null)&&(r.type="null"),r.enum=i},Np=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},xp=(e,t,r,n)=>{let o=r,i=e._zod.pattern;if(!i)throw new Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Cp=(e,t,r,n)=>{let o=r,i={type:"string",format:"binary",contentEncoding:"binary"},{minimum:a,maximum:c,mime:s}=e._zod.bag;a!==void 0&&(i.minLength=a),c!==void 0&&(i.maxLength=c),s?s.length===1?(i.contentMediaType=s[0],Object.assign(o,i)):o.anyOf=s.map(l=>({...i,contentMediaType:l})):Object.assign(o,i)},Ap=(e,t,r,n)=>{r.type="boolean"},vc=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},qp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},_c=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Mp=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Up=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Sc=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=be(i.element,t,{...n,path:[...n.path,"items"]})},yc=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",o.properties={};let a=i.shape;for(let l in a)o.properties[l]=be(a[l],t,{...n,path:[...n.path,"properties",l]});let c=new Set(Object.keys(a)),s=new Set([...c].filter(l=>{let m=i.shape[l]._zod;return t.io==="input"?m.optin===void 0:m.optout===void 0}));s.size>0&&(o.required=Array.from(s)),i.catchall?._zod.def.type==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=be(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},bc=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,a=o.options.map((c,s)=>be(c,t,{...n,path:[...n.path,i?"oneOf":"anyOf",s]}));i?r.oneOf=a:r.anyOf=a},$c=(e,t,r,n)=>{let o=e._zod.def,i=be(o.left,t,{...n,path:[...n.path,"allOf",0]}),a=be(o.right,t,{...n,path:[...n.path,"allOf",1]}),c=l=>"allOf"in l&&Object.keys(l).length===1,s=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];r.allOf=s},Lp=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="array";let a=t.target==="draft-2020-12"?"prefixItems":"items",c=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",s=i.items.map((z,R)=>be(z,t,{...n,path:[...n.path,a,R]})),l=i.rest?be(i.rest,t,{...n,path:[...n.path,c,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null;t.target==="draft-2020-12"?(o.prefixItems=s,l&&(o.items=l)):t.target==="openapi-3.0"?(o.items={anyOf:s},l&&o.items.anyOf.push(l),o.minItems=s.length,l||(o.maxItems=s.length)):(o.items=s,l&&(o.additionalItems=l));let{minimum:m,maximum:h}=e._zod.bag;typeof m=="number"&&(o.minItems=m),typeof h=="number"&&(o.maxItems=h)},zc=(e,t,r,n)=>{let o=r,i=e._zod.def;o.type="object",(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=be(i.keyType,t,{...n,path:[...n.path,"propertyNames"]})),o.additionalProperties=be(i.valueType,t,{...n,path:[...n.path,"additionalProperties"]})},Rc=(e,t,r,n)=>{let o=e._zod.def,i=be(o.innerType,t,n),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,r.nullable=!0):r.anyOf=[i,{type:"null"}]},wc=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Tc=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.default=JSON.parse(JSON.stringify(o.defaultValue))},Ec=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ic=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=a},Pc=(e,t,r,n)=>{let o=e._zod.def,i=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;be(i,t,n);let a=t.seen.get(e);a.ref=i},kc=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},Dp=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},Oc=(e,t,r,n)=>{let o=e._zod.def;be(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},jc=(e,t,r,n)=>{let o=e._zod.innerType;be(o,t,n);let i=t.seen.get(e);i.ref=o},ic={string:ac,number:sc,boolean:cc,bigint:uc,symbol:kp,null:lc,undefined:Op,void:jp,never:dc,any:mc,unknown:pc,date:fc,enum:hc,literal:gc,nan:Np,template_literal:xp,file:Cp,success:Ap,custom:vc,function:qp,transform:_c,map:Mp,set:Up,array:Sc,object:yc,union:bc,intersection:$c,tuple:Lp,record:zc,nullable:Rc,nonoptional:wc,default:Tc,prefault:Ec,catch:Ic,pipe:Pc,readonly:kc,promise:Dp,optional:Oc,lazy:jc};function Dn(e,t){if("_idmap"in e){let n=e,o=jr({...t,processors:ic}),i={};for(let s of n._idmap.entries()){let[l,m]=s;be(m,o)}let a={},c={registry:n,uri:t?.uri,defs:i};o.external=c;for(let s of n._idmap.entries()){let[l,m]=s;Nr(o,m),a[l]=xr(o,m)}if(Object.keys(i).length>0){let s=o.target==="draft-2020-12"?"$defs":"definitions";a.__shared={[s]:i}}return{schemas:a}}let r=jr({...t,processors:ic});return be(e,r),Nr(r,e),xr(r,e)}var lt={};$s(lt,{ZodISODate:()=>Cc,ZodISODateTime:()=>Nc,ZodISODuration:()=>Uc,ZodISOTime:()=>qc,date:()=>Ac,datetime:()=>xc,duration:()=>Lc,time:()=>Mc});var Nc=q("ZodISODateTime",(e,t)=>{tm.init(e,t),Ee.init(e,t)});function xc(e){return dp(Nc,e)}var Cc=q("ZodISODate",(e,t)=>{rm.init(e,t),Ee.init(e,t)});function Ac(e){return mp(Cc,e)}var qc=q("ZodISOTime",(e,t)=>{nm.init(e,t),Ee.init(e,t)});function Mc(e){return pp(qc,e)}var Uc=q("ZodISODuration",(e,t)=>{om.init(e,t),Ee.init(e,t)});function Lc(e){return fp(Uc,e)}var Zp=(e,t)=>{Ko.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>xs(e,r)},flatten:{value:r=>Ns(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,Er,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,Er,2)}},isEmpty:{get(){return e.issues.length===0}}})},b0=q("ZodError",Zp),rt=q("ZodError",Zp,{Parent:Error});var Fp=Go(rt),Hp=Wo(rt),ti=Nn(rt),Jp=xn(rt),Bp=Ml(rt),Kp=Ul(rt),Gp=Ll(rt),Wp=Dl(rt),Yp=Vl(rt),Xp=Zl(rt),Qp=Fl(rt),ef=Hl(rt);var $e=q("ZodType",(e,t)=>(ye.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Ln(e,"input"),output:Ln(e,"output")}}),e.toJSONSchema=Pp(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(J.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]})),e.clone=(r,n)=>it(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>Fp(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>ti(e,r,n),e.parseAsync=async(r,n)=>Hp(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>Jp(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>Bp(e,r,n),e.decode=(r,n)=>Kp(e,r,n),e.encodeAsync=async(r,n)=>Gp(e,r,n),e.decodeAsync=async(r,n)=>Wp(e,r,n),e.safeEncode=(r,n)=>Yp(e,r,n),e.safeDecode=(r,n)=>Xp(e,r,n),e.safeEncodeAsync=async(r,n)=>Qp(e,r,n),e.safeDecodeAsync=async(r,n)=>ef(e,r,n),e.refine=(r,n)=>e.check(f_(r,n)),e.superRefine=r=>e.check(h_(r)),e.overwrite=r=>e.check(At(r)),e.optional=()=>Q(e),e.nullable=()=>Vc(e),e.nullish=()=>Q(Vc(e)),e.nonoptional=r=>s_(e,r),e.array=()=>O(e),e.or=r=>W([e,r]),e.and=r=>gt(e,r),e.transform=r=>Zc(e,mf(r)),e.default=r=>o_(e,r),e.prefault=r=>a_(e,r),e.catch=r=>u_(e,r),e.pipe=r=>Zc(e,r),e.readonly=()=>hf(e),e.describe=r=>{let n=e.clone();return bt.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return bt.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return bt.get(e);let n=e.clone();return bt.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),nf=q("_ZodString",(e,t)=>{qn.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>ac(e,n,o,i);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(Ks(...n)),e.includes=(...n)=>e.check(Ys(...n)),e.startsWith=(...n)=>e.check(Xs(...n)),e.endsWith=(...n)=>e.check(Qs(...n)),e.min=(...n)=>e.check(or(...n)),e.max=(...n)=>e.check(Un(...n)),e.length=(...n)=>e.check(ei(...n)),e.nonempty=(...n)=>e.check(or(1,...n)),e.lowercase=n=>e.check(Gs(n)),e.uppercase=n=>e.check(Ws(n)),e.trim=()=>e.check(tc()),e.normalize=(...n)=>e.check(ec(...n)),e.toLowerCase=()=>e.check(rc()),e.toUpperCase=()=>e.check(nc()),e.slugify=()=>e.check(oc())}),Fc=q("ZodString",(e,t)=>{qn.init(e,t),nf.init(e,t),e.email=r=>e.check(Hs(of,r)),e.url=r=>e.check(Bs(af,r)),e.jwt=r=>e.check(lp(Fv,r)),e.emoji=r=>e.check(Wm(kv,r)),e.guid=r=>e.check(Js(tf,r)),e.uuid=r=>e.check(Jm(ri,r)),e.uuidv4=r=>e.check(Bm(ri,r)),e.uuidv6=r=>e.check(Km(ri,r)),e.uuidv7=r=>e.check(Gm(ri,r)),e.nanoid=r=>e.check(Ym(Ov,r)),e.guid=r=>e.check(Js(tf,r)),e.cuid=r=>e.check(Xm(jv,r)),e.cuid2=r=>e.check(Qm(Nv,r)),e.ulid=r=>e.check(ep(xv,r)),e.base64=r=>e.check(sp(Dv,r)),e.base64url=r=>e.check(cp(Vv,r)),e.xid=r=>e.check(tp(Cv,r)),e.ksuid=r=>e.check(rp(Av,r)),e.ipv4=r=>e.check(np(qv,r)),e.ipv6=r=>e.check(op(Mv,r)),e.cidrv4=r=>e.check(ip(Uv,r)),e.cidrv6=r=>e.check(ap(Lv,r)),e.e164=r=>e.check(up(Zv,r)),e.datetime=r=>e.check(xc(r)),e.date=r=>e.check(Ac(r)),e.time=r=>e.check(Mc(r)),e.duration=r=>e.check(Lc(r))});function u(e){return Fm(Fc,e)}var Ee=q("ZodStringFormat",(e,t)=>{we.init(e,t),nf.init(e,t)}),of=q("ZodEmail",(e,t)=>{Jd.init(e,t),Ee.init(e,t)});function Hc(e){return Hs(of,e)}var tf=q("ZodGUID",(e,t)=>{Fd.init(e,t),Ee.init(e,t)});var ri=q("ZodUUID",(e,t)=>{Hd.init(e,t),Ee.init(e,t)});var af=q("ZodURL",(e,t)=>{Bd.init(e,t),Ee.init(e,t)});function Vn(e){return Bs(af,e)}var kv=q("ZodEmoji",(e,t)=>{Kd.init(e,t),Ee.init(e,t)});var Ov=q("ZodNanoID",(e,t)=>{Gd.init(e,t),Ee.init(e,t)});var jv=q("ZodCUID",(e,t)=>{Wd.init(e,t),Ee.init(e,t)});var Nv=q("ZodCUID2",(e,t)=>{Yd.init(e,t),Ee.init(e,t)});var xv=q("ZodULID",(e,t)=>{Xd.init(e,t),Ee.init(e,t)});var Cv=q("ZodXID",(e,t)=>{Qd.init(e,t),Ee.init(e,t)});var Av=q("ZodKSUID",(e,t)=>{em.init(e,t),Ee.init(e,t)});var qv=q("ZodIPv4",(e,t)=>{im.init(e,t),Ee.init(e,t)});var Mv=q("ZodIPv6",(e,t)=>{am.init(e,t),Ee.init(e,t)});var Uv=q("ZodCIDRv4",(e,t)=>{sm.init(e,t),Ee.init(e,t)});var Lv=q("ZodCIDRv6",(e,t)=>{cm.init(e,t),Ee.init(e,t)});var Dv=q("ZodBase64",(e,t)=>{lm.init(e,t),Ee.init(e,t)});var Vv=q("ZodBase64URL",(e,t)=>{dm.init(e,t),Ee.init(e,t)});var Zv=q("ZodE164",(e,t)=>{mm.init(e,t),Ee.init(e,t)});var Fv=q("ZodJWT",(e,t)=>{pm.init(e,t),Ee.init(e,t)});var ni=q("ZodNumber",(e,t)=>{Ls.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>sc(e,n,o,i),e.gt=(n,o)=>e.check(Or(n,o)),e.gte=(n,o)=>e.check(ut(n,o)),e.min=(n,o)=>e.check(ut(n,o)),e.lt=(n,o)=>e.check(kr(n,o)),e.lte=(n,o)=>e.check($t(n,o)),e.max=(n,o)=>e.check($t(n,o)),e.int=n=>e.check(rf(n)),e.safe=n=>e.check(rf(n)),e.positive=n=>e.check(Or(0,n)),e.nonnegative=n=>e.check(ut(0,n)),e.negative=n=>e.check(kr(0,n)),e.nonpositive=n=>e.check($t(0,n)),e.multipleOf=(n,o)=>e.check(Mn(n,o)),e.step=(n,o)=>e.check(Mn(n,o)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function Z(e){return hp(ni,e)}var Hv=q("ZodNumberFormat",(e,t)=>{fm.init(e,t),ni.init(e,t)});function rf(e){return vp(Hv,e)}var Jc=q("ZodBoolean",(e,t)=>{Ds.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cc(e,r,n,o)});function G(e){return _p(Jc,e)}var sf=q("ZodBigInt",(e,t)=>{hm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>uc(e,n,o,i),e.gte=(n,o)=>e.check(ut(n,o)),e.min=(n,o)=>e.check(ut(n,o)),e.gt=(n,o)=>e.check(Or(n,o)),e.gte=(n,o)=>e.check(ut(n,o)),e.min=(n,o)=>e.check(ut(n,o)),e.lt=(n,o)=>e.check(kr(n,o)),e.lte=(n,o)=>e.check($t(n,o)),e.max=(n,o)=>e.check($t(n,o)),e.positive=n=>e.check(Or(BigInt(0),n)),e.negative=n=>e.check(kr(BigInt(0),n)),e.nonpositive=n=>e.check($t(BigInt(0),n)),e.nonnegative=n=>e.check(ut(BigInt(0),n)),e.multipleOf=(n,o)=>e.check(Mn(n,o));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});var Jv=q("ZodNull",(e,t)=>{gm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lc(e,r,n,o)});function qt(e){return bp(Jv,e)}var Bv=q("ZodAny",(e,t)=>{vm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mc(e,r,n,o)});function Bc(){return $p(Bv)}var Kv=q("ZodUnknown",(e,t)=>{_m.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pc(e,r,n,o)});function ee(){return zp(Kv)}var Gv=q("ZodNever",(e,t)=>{Sm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dc(e,r,n,o)});function cf(e){return Rp(Gv,e)}var uf=q("ZodDate",(e,t)=>{ym.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>fc(e,n,o,i),e.min=(n,o)=>e.check(ut(n,o)),e.max=(n,o)=>e.check($t(n,o));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});var Wv=q("ZodArray",(e,t)=>{bm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sc(e,r,n,o),e.element=t.element,e.min=(r,n)=>e.check(or(r,n)),e.nonempty=r=>e.check(or(1,r)),e.max=(r,n)=>e.check(Un(r,n)),e.length=(r,n)=>e.check(ei(r,n)),e.unwrap=()=>e.element});function O(e,t){return Tp(Wv,e,t)}var lf=q("ZodObject",(e,t)=>{Rm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yc(e,r,n,o),J.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>se(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ee()}),e.loose=()=>e.clone({...e._zod.def,catchall:ee()}),e.strict=()=>e.clone({...e._zod.def,catchall:cf()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>J.extend(e,r),e.safeExtend=r=>J.safeExtend(e,r),e.merge=r=>J.merge(e,r),e.pick=r=>J.pick(e,r),e.omit=r=>J.omit(e,r),e.partial=(...r)=>J.partial(pf,e,r[0]),e.required=(...r)=>J.required(ff,e,r[0])});function E(e,t){let r={type:"object",shape:e??{},...J.normalizeParams(t)};return new lf(r)}function ne(e,t){return new lf({type:"object",shape:e,catchall:ee(),...J.normalizeParams(t)})}var df=q("ZodUnion",(e,t)=>{Vs.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bc(e,r,n,o),e.options=t.options});function W(e,t){return new df({type:"union",options:e,...J.normalizeParams(t)})}var Yv=q("ZodDiscriminatedUnion",(e,t)=>{df.init(e,t),wm.init(e,t)});function Cr(e,t,r){return new Yv({type:"union",options:t,discriminator:e,...J.normalizeParams(r)})}var Xv=q("ZodIntersection",(e,t)=>{Tm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$c(e,r,n,o)});function gt(e,t){return new Xv({type:"intersection",left:e,right:t})}var Qv=q("ZodRecord",(e,t)=>{Em.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>zc(e,r,n,o),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,r){return new Qv({type:"record",keyType:e,valueType:t,...J.normalizeParams(r)})}var Dc=q("ZodEnum",(e,t)=>{Im.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(n,o,i)=>hc(e,n,o,i),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let a of n)if(r.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Dc({...t,checks:[],...J.normalizeParams(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let a of n)if(r.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Dc({...t,checks:[],...J.normalizeParams(o),entries:i})}});function se(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new Dc({type:"enum",entries:r,...J.normalizeParams(t)})}var e_=q("ZodLiteral",(e,t)=>{Pm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gc(e,r,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function j(e,t){return new e_({type:"literal",values:Array.isArray(e)?e:[e],...J.normalizeParams(t)})}var t_=q("ZodTransform",(e,t)=>{km.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_c(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Tr(e.constructor.name);r.addIssue=i=>{if(typeof i=="string")r.issues.push(J.issue(i,r.value,t));else{let a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=r.value),a.inst??(a.inst=e),r.issues.push(J.issue(a))}};let o=t.transform(r.value,r);return o instanceof Promise?o.then(i=>(r.value=i,r)):(r.value=o,r)}});function mf(e){return new t_({type:"transform",transform:e})}var pf=q("ZodOptional",(e,t)=>{Om.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Oc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Q(e){return new pf({type:"optional",innerType:e})}var r_=q("ZodNullable",(e,t)=>{jm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Rc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function Vc(e){return new r_({type:"nullable",innerType:e})}var n_=q("ZodDefault",(e,t)=>{Nm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Tc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function o_(e,t){return new n_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():J.shallowClone(t)}})}var i_=q("ZodPrefault",(e,t)=>{xm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ec(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function a_(e,t){return new i_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():J.shallowClone(t)}})}var ff=q("ZodNonOptional",(e,t)=>{Cm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function s_(e,t){return new ff({type:"nonoptional",innerType:e,...J.normalizeParams(t)})}var c_=q("ZodCatch",(e,t)=>{Am.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ic(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function u_(e,t){return new c_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var l_=q("ZodPipe",(e,t)=>{qm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Pc(e,r,n,o),e.in=t.in,e.out=t.out});function Zc(e,t){return new l_({type:"pipe",in:e,out:t})}var d_=q("ZodReadonly",(e,t)=>{Mm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kc(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});function hf(e){return new d_({type:"readonly",innerType:e})}var m_=q("ZodLazy",(e,t)=>{Um.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>jc(e,r,n,o),e.unwrap=()=>e._zod.def.getter()});function Ar(e){return new m_({type:"lazy",getter:e})}var p_=q("ZodCustom",(e,t)=>{Lm.init(e,t),$e.init(e,t),e._zod.processJSONSchema=(r,n,o)=>vc(e,r,n,o)});function f_(e,t={}){return Ep(p_,e,t)}function h_(e){return Ip(e)}function ar(e,t){return Zc(mf(e),t)}var vf={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"};var gf;gf||(gf={});var oi={};$s(oi,{bigint:()=>y_,boolean:()=>S_,date:()=>b_,number:()=>__,string:()=>v_});function v_(e){return Hm(Fc,e)}function __(e){return gp(ni,e)}function S_(e){return Sp(Jc,e)}function y_(e){return yp(sf,e)}function b_(e){return wp(uf,e)}We(Zs());var cr="2025-11-25";var ii=[cr,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],ai="io.modelcontextprotocol/related-task",ur="io.modelcontextprotocol/protocolVersion",qr="io.modelcontextprotocol/clientInfo",Rt="io.modelcontextprotocol/serverInfo",wt="io.modelcontextprotocol/clientCapabilities",Zn="io.modelcontextprotocol/subscriptionId",Ut="io.modelcontextprotocol/logLevel";var lr="2.0";var Mt=Ar(()=>W([u(),Z(),G(),qt(),B(u(),Mt),O(Mt)])),ke=B(u(),Mt),Wc=O(Mt),Fn=W([u(),Z().int()]),Hn=u(),si=E({ttl:Z().optional()}),ci=E({taskId:u()}),Jn=ne({progressToken:Fn.optional(),[ai]:ci.optional()}),De=E({_meta:Jn.optional()}),dr=De.extend({task:si.optional()}),Oe=E({method:u(),params:De.loose().optional()}),Be=E({_meta:Jn.optional()}),Ke=E({method:u(),params:Be.loose().optional()}),Bn=ne({get[Rt](){return Lr.optional().catch(void 0)}}),je=ne({_meta:Bn.optional()}),Lt=W([u(),Z().int()]),Kn=E({jsonrpc:j(lr),id:Lt,...Oe.shape}).strict(),Gn=E({jsonrpc:j(lr),...Ke.shape}).strict(),Mr=E({jsonrpc:j(lr),id:Lt,result:je}).strict(),Ur=E({jsonrpc:j(lr),id:Lt.optional(),error:E({code:Z().int(),message:u(),data:ee().optional()})}).strict(),Wn=W([Kn,Gn,Mr,Ur]),Yc=W([Mr,Ur]),Yn=je.strict(),ui=Be.extend({requestId:Lt.optional(),reason:u().optional()}),Xn=Ke.extend({method:j("notifications/cancelled"),params:ui}),li=E({src:u(),mimeType:u().optional(),sizes:O(u()).optional(),theme:se(["light","dark"]).optional()}),Dt=E({icons:O(li).optional()}),zt=E({name:u(),title:u().optional()}),Lr=zt.extend({...zt.shape,...Dt.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),z_=gt(E({applyDefaults:G().optional()}),ke),R_=ar(e=>e&&typeof e=="object"&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,gt(E({form:z_.optional(),url:ke.optional()}),ke.optional())),di=ne({list:ke.optional(),cancel:ke.optional(),requests:ne({sampling:ne({createMessage:ke.optional()}).optional(),elicitation:ne({create:ke.optional()}).optional()}).optional()}),mi=ne({list:ke.optional(),cancel:ke.optional(),requests:ne({tools:ne({call:ke.optional()}).optional()}).optional()}),pi=E({experimental:B(u(),ke).optional(),sampling:E({context:ke.optional(),tools:ke.optional()}).optional(),elicitation:R_.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:di.optional(),extensions:B(u(),ke).optional()}),fi=De.extend({protocolVersion:u(),capabilities:pi,clientInfo:Lr}),hi=Oe.extend({method:j("initialize"),params:fi}),Qn=E({experimental:B(u(),ke).optional(),logging:ke.optional(),completions:ke.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:mi.optional(),extensions:B(u(),ke).optional()}),gi=je.extend({protocolVersion:u(),capabilities:Qn,serverInfo:Lr,instructions:u().optional()}),vi=Ke.extend({method:j("notifications/initialized"),params:Be.optional()}),_i=Oe.extend({method:j("server/discover"),params:De.optional()}),Si=je.extend({supportedVersions:O(u()),capabilities:Qn,instructions:u().optional()}),eo=Oe.extend({method:j("ping"),params:De.optional()}),yi=E({progress:Z(),total:Q(Z()),message:Q(u())}),bi=E({...Be.shape,...yi.shape,progressToken:Fn}),to=Ke.extend({method:j("notifications/progress"),params:bi}),$i=De.extend({cursor:Hn.optional()}),Vt=Oe.extend({params:$i.optional()}),Zt=je.extend({nextCursor:Hn.optional()}),ro=E({uri:u(),mimeType:Q(u()),_meta:B(u(),ee()).optional()}),no=ro.extend({text:u()}),Xc=u().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:"Invalid Base64 string"}),oo=ro.extend({blob:Xc}),Ft=se(["user","assistant"]),Tt=E({audience:O(Ft).optional(),priority:Z().min(0).max(1).optional(),lastModified:lt.datetime({offset:!0}).optional()}),io=E({...zt.shape,...Dt.shape,uri:u(),description:Q(u()),mimeType:Q(u()),size:Q(Z()),annotations:Tt.optional(),_meta:Q(ne({}))}),zi=E({...zt.shape,...Dt.shape,uriTemplate:u(),description:Q(u()),mimeType:Q(u()),annotations:Tt.optional(),_meta:Q(ne({}))}),Ri=Vt.extend({method:j("resources/list")}),wi=Zt.extend({resources:O(io)}),Ti=Vt.extend({method:j("resources/templates/list")}),Ei=Zt.extend({resourceTemplates:O(zi)}),Dr=De.extend({uri:u()}),Ii=Dr,Pi=Oe.extend({method:j("resources/read"),params:Ii}),ki=je.extend({contents:O(W([no,oo]))}),Oi=Ke.extend({method:j("notifications/resources/list_changed"),params:Be.optional()}),ji=Dr,Ni=Oe.extend({method:j("resources/subscribe"),params:ji}),xi=Dr,Ci=Oe.extend({method:j("resources/unsubscribe"),params:xi}),ao=E({toolsListChanged:G().optional(),promptsListChanged:G().optional(),resourcesListChanged:G().optional(),resourceSubscriptions:O(u()).optional()}),Ai=De.extend({notifications:ao}),qi=Oe.extend({method:j("subscriptions/listen"),params:Ai}),Mi=Be.extend({notifications:ao}),Ui=Ke.extend({method:j("notifications/subscriptions/acknowledged"),params:Mi}),Li=Bn.extend({[Zn]:Lt}),Di=je.extend({_meta:Li}),Vi=Be.extend({uri:u()}),Zi=Ke.extend({method:j("notifications/resources/updated"),params:Vi}),Fi=E({name:u(),description:Q(u()),required:Q(G())}),Hi=E({...zt.shape,...Dt.shape,description:Q(u()),arguments:Q(O(Fi)),_meta:Q(ne({}))}),Ji=Vt.extend({method:j("prompts/list")}),Bi=Zt.extend({prompts:O(Hi)}),Ki=De.extend({name:u(),arguments:B(u(),u()).optional()}),Gi=Oe.extend({method:j("prompts/get"),params:Ki}),Vr=E({type:j("text"),text:u(),annotations:Tt.optional(),_meta:B(u(),ee()).optional()}),Zr=E({type:j("image"),data:Xc,mimeType:u(),annotations:Tt.optional(),_meta:B(u(),ee()).optional()}),Fr=E({type:j("audio"),data:Xc,mimeType:u(),annotations:Tt.optional(),_meta:B(u(),ee()).optional()}),Wi=E({type:j("tool_use"),name:u(),id:u(),input:B(u(),ee()),_meta:B(u(),ee()).optional()}),Yi=E({type:j("resource"),resource:W([no,oo]),annotations:Tt.optional(),_meta:B(u(),ee()).optional()}),Xi=io.extend({type:j("resource_link")}),Hr=W([Vr,Zr,Fr,Xi,Yi]),Qi=E({role:Ft,content:Hr}),ea=je.extend({description:u().optional(),messages:O(Qi)}),ta=Ke.extend({method:j("notifications/prompts/list_changed"),params:Be.optional()}),ra=E({title:u().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),na=E({taskSupport:se(["required","optional","forbidden"]).optional()}),so=E({...zt.shape,...Dt.shape,description:u().optional(),inputSchema:E({type:j("object"),properties:B(u(),Mt).optional(),required:O(u()).optional()}).catchall(ee()),outputSchema:ne({$schema:u().optional()}).optional(),annotations:ra.optional(),execution:na.optional(),_meta:B(u(),ee()).optional()}),oa=Vt.extend({method:j("tools/list")}),ia=Zt.extend({tools:O(so)}),co=je.extend({content:O(Hr).default([]),structuredContent:ee().optional(),isError:G().optional()}),Qc=co.or(je.extend({toolResult:ee()})),aa=dr.extend({name:u(),arguments:B(u(),ee()).optional()}),sa=Oe.extend({method:j("tools/call"),params:aa}),ca=Ke.extend({method:j("notifications/tools/list_changed"),params:Be.optional()}),eu=E({autoRefresh:G().default(!0),debounceMs:Z().int().nonnegative().default(300)}),Ht=se(["debug","info","notice","warning","error","critical","alert","emergency"]),ua=De.extend({level:Ht}),la=Oe.extend({method:j("logging/setLevel"),params:ua}),da=Be.extend({level:Ht,logger:u().optional(),data:ee()}),ma=Ke.extend({method:j("notifications/message"),params:da}),pa=E({name:u().optional()}),fa=E({hints:O(pa).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),ha=E({mode:se(["auto","required","none"]).optional()}),ga=E({type:j("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:O(Hr),structuredContent:ee().optional(),isError:G().optional(),_meta:B(u(),ee()).optional()}),va=Cr("type",[Vr,Zr,Fr]),sr=Cr("type",[Vr,Zr,Fr,Wi,ga]),_a=E({role:Ft,content:W([sr,O(sr)]),_meta:B(u(),ee()).optional()}),Sa=dr.extend({messages:O(_a),modelPreferences:fa.optional(),systemPrompt:u().optional(),includeContext:se(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:O(u()).optional(),metadata:ke.optional(),tools:O(so).optional(),toolChoice:ha.optional()}),ya=Oe.extend({method:j("sampling/createMessage"),params:Sa}),ba=je.extend({model:u(),stopReason:Q(se(["endTurn","stopSequence","maxTokens"]).or(u())),role:Ft,content:va}),$a=je.extend({model:u(),stopReason:Q(se(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:Ft,content:W([sr,O(sr)])}),uo=E({type:j("boolean"),title:u().optional(),description:u().optional(),default:G().optional()}),Jr=E({type:j("string"),title:u().optional(),description:u().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:se(["email","uri","date","date-time"]).optional(),default:u().optional()}),Br=E({type:se(["number","integer"]),title:u().optional(),description:u().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),lo=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),default:u().optional()}),mo=E({type:j("string"),title:u().optional(),description:u().optional(),oneOf:O(E({const:u(),title:u()})),default:u().optional()}),po=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),enumNames:O(u()).optional(),default:u().optional()}),za=W([lo,mo]),fo=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({type:j("string"),enum:O(u())}),default:O(u()).optional()}),ho=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({anyOf:O(E({const:u(),title:u()}))}),default:O(u()).optional()}),Ra=W([fo,ho]),wa=W([po,za,Ra]),go=W([wa,uo,Jr,Br]),Kr=dr.extend({mode:j("form").optional(),message:u(),requestedSchema:E({type:j("object"),properties:B(u(),go),required:O(u()).optional()}).catchall(ee())}),Ta=dr.extend({mode:j("url"),message:u(),elicitationId:u(),url:u().url()}),Ea=W([Kr,Ta]),Ia=Oe.extend({method:j("elicitation/create"),params:Ea}),Pa=Be.extend({elicitationId:u()}),ka=Ke.extend({method:j("notifications/elicitation/complete"),params:Pa}),Oa=je.extend({action:se(["accept","decline","cancel"]),content:ar(e=>e===null?void 0:e,B(u(),W([u(),Z(),G(),O(u())])).optional())}),ja=E({type:j("ref/resource"),uri:u()}),Na=E({type:j("ref/prompt"),name:u()}),xa=De.extend({ref:W([Na,ja]),argument:E({name:u(),value:u()}),context:E({arguments:B(u(),u()).optional()}).optional()}),Ca=Oe.extend({method:j("completion/complete"),params:xa}),Aa=je.extend({completion:ne({values:O(u()).max(100),total:Q(Z().int()),hasMore:Q(G())})}),qa=E({uri:u().startsWith("file://"),name:u().optional(),_meta:B(u(),ee()).optional()}),Ma=Oe.extend({method:j("roots/list"),params:De.optional()}),Ua=je.extend({roots:O(qa)}),La=Ke.extend({method:j("notifications/roots/list_changed"),params:Be.optional()}),tu=ne({ttl:Z().optional(),pollInterval:Z().optional()}),Da=se(["working","input_required","completed","failed","cancelled"]),Jt=E({taskId:u(),status:Da,ttl:W([Z(),qt()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:Q(Z()),statusMessage:Q(u())}),ru=je.extend({task:Jt}),Va=Be.merge(Jt),nu=Ke.extend({method:j("notifications/tasks/status"),params:Va}),ou=Oe.extend({method:j("tasks/get"),params:De.extend({taskId:u()})}),iu=je.merge(Jt),au=Oe.extend({method:j("tasks/result"),params:De.extend({taskId:u()})}),su=je.loose(),cu=Vt.extend({method:j("tasks/list")}),uu=Zt.extend({tasks:O(Jt)}),lu=Oe.extend({method:j("tasks/cancel"),params:De.extend({taskId:u()})}),du=je.merge(Jt),mu=W([eo,hi,_i,Ca,la,Gi,Ji,Ri,Ti,Pi,Ni,Ci,qi,sa,oa]),pu=W([Xn,to,vi,La]),fu=W([Yn,ba,$a,Oa,Ua]),hu=W([eo,ya,Ia,Ma]),gu=W([Xn,to,ma,Zi,Oi,ca,ta,Ui,ka]),vu=W([Yn,gi,Si,Aa,ea,Bi,wi,Ei,ki,co,ia,Di]),Le=Vn().superRefine((e,t)=>{if(!URL.canParse(e))return t.addIssue({code:vf.custom,message:"URL must be parseable",fatal:!0}),zs}).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"}),_u=ne({resource:u().url(),authorization_servers:O(Le).optional(),jwks_uri:u().url().optional(),scopes_supported:O(u()).optional(),bearer_methods_supported:O(u()).optional(),resource_signing_alg_values_supported:O(u()).optional(),resource_name:u().optional(),resource_documentation:u().optional(),resource_policy_uri:u().url().optional(),resource_tos_uri:u().url().optional(),tls_client_certificate_bound_access_tokens:G().optional(),authorization_details_types_supported:O(u()).optional(),dpop_signing_alg_values_supported:O(u()).optional(),dpop_bound_access_tokens_required:G().optional()}),Za=ne({issuer:u(),authorization_endpoint:Le,token_endpoint:Le,registration_endpoint:Le.optional(),scopes_supported:O(u()).optional(),response_types_supported:O(u()),response_modes_supported:O(u()).optional(),grant_types_supported:O(u()).optional(),token_endpoint_auth_methods_supported:O(u()).optional(),token_endpoint_auth_signing_alg_values_supported:O(u()).optional(),service_documentation:Le.optional(),revocation_endpoint:Le.optional(),revocation_endpoint_auth_methods_supported:O(u()).optional(),revocation_endpoint_auth_signing_alg_values_supported:O(u()).optional(),introspection_endpoint:u().optional(),introspection_endpoint_auth_methods_supported:O(u()).optional(),introspection_endpoint_auth_signing_alg_values_supported:O(u()).optional(),code_challenge_methods_supported:O(u()).optional(),client_id_metadata_document_supported:G().optional(),authorization_response_iss_parameter_supported:G().optional().catch(void 0)}),Fa=ne({issuer:u(),authorization_endpoint:Le,token_endpoint:Le,userinfo_endpoint:Le.optional(),jwks_uri:Le,registration_endpoint:Le.optional(),scopes_supported:O(u()).optional(),response_types_supported:O(u()),response_modes_supported:O(u()).optional(),grant_types_supported:O(u()).optional(),acr_values_supported:O(u()).optional(),subject_types_supported:O(u()),id_token_signing_alg_values_supported:O(u()),id_token_encryption_alg_values_supported:O(u()).optional(),id_token_encryption_enc_values_supported:O(u()).optional(),userinfo_signing_alg_values_supported:O(u()).optional(),userinfo_encryption_alg_values_supported:O(u()).optional(),userinfo_encryption_enc_values_supported:O(u()).optional(),request_object_signing_alg_values_supported:O(u()).optional(),request_object_encryption_alg_values_supported:O(u()).optional(),request_object_encryption_enc_values_supported:O(u()).optional(),token_endpoint_auth_methods_supported:O(u()).optional(),token_endpoint_auth_signing_alg_values_supported:O(u()).optional(),display_values_supported:O(u()).optional(),claim_types_supported:O(u()).optional(),claims_supported:O(u()).optional(),service_documentation:u().optional(),claims_locales_supported:O(u()).optional(),ui_locales_supported:O(u()).optional(),claims_parameter_supported:G().optional(),request_parameter_supported:G().optional(),request_uri_parameter_supported:G().optional(),require_request_uri_registration:G().optional(),op_policy_uri:Le.optional(),op_tos_uri:Le.optional(),client_id_metadata_document_supported:G().optional(),authorization_response_iss_parameter_supported:G().optional().catch(void 0)}),Su=E({...Fa.shape,...Za.pick({code_challenge_methods_supported:!0}).shape}),yu=E({access_token:u(),id_token:u().optional(),token_type:u(),expires_in:oi.number().optional(),scope:u().optional(),refresh_token:u().optional()}).strip(),bu=E({issued_token_type:j("urn:ietf:params:oauth:token-type:id-jag"),access_token:u(),token_type:u().optional(),expires_in:Z().optional(),scope:u().optional()}).strip(),$u=E({error:u(),error_description:u().optional(),error_uri:u().optional()}),Gc=Le.optional().or(j("").transform(()=>{})),Ha=E({redirect_uris:O(Le),token_endpoint_auth_method:u().optional(),grant_types:O(u()).optional(),response_types:O(u()).optional(),application_type:u().optional(),client_name:u().optional(),client_uri:Le.optional(),logo_uri:Gc,scope:u().optional(),contacts:O(u()).optional(),tos_uri:Gc,policy_uri:u().optional(),jwks_uri:Le.optional(),jwks:Bc().optional(),software_id:u().optional(),software_version:u().optional(),software_statement:u().optional()}).strip(),Ja=E({client_id:u(),client_secret:u().optional(),client_id_issued_at:Z().optional(),client_secret_expires_at:Z().optional()}).strip(),zu=Ha.merge(Ja),Ru=E({error:u(),error_description:u().optional()}).strip(),wu=E({token:u(),token_type_hint:u().optional()}).strip();var ku=Symbol.for("mcp.sdk.errorBrands");function Cu(e,t){let r=new Set,n=t;for(;typeof n=="function";){let o=n.mcpBrand;Object.prototype.hasOwnProperty.call(n,"mcpBrand")&&typeof o=="string"&&r.add(o),n=Object.getPrototypeOf(n)}r.size!==0&&Object.defineProperty(e,ku,{value:r,enumerable:!1,configurable:!0})}function Wr(e,t){try{if(typeof t=="object"&&t!==null&&Object.prototype.hasOwnProperty.call(e,"mcpBrand")&&typeof e.mcpBrand=="string"&&Object.prototype.hasOwnProperty.call(t,ku)){let r=t[ku];if(r&&typeof r.has=="function"&&r.has(e.mcpBrand))return!0}}catch{}return Function.prototype[Symbol.hasInstance].call(e,t)}var w_=class Uf extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](t){return Wr(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Wr(this,t)}constructor(t,r,n){super(r),this.code=t,this.errorUri=n,this.name="OAuthError",Cu(this,new.target)}toResponseObject(){let t={error:this.code,error_description:this.message};return this.errorUri&&(t.error_uri=this.errorUri),t}static fromResponse(t){return new Uf(t.error,t.error_description??t.error,t.error_uri)}},he=(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})({}),le=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance](e){return Wr(this,e)}static isInstance(e){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Wr(this,e)}constructor(e,t,r){super(t),this.code=e,this.data=r,this.name="SdkError",Cu(this,new.target)}},T_=class extends le{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor(e,t,r){super(e,t,r),this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};function Ef(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function E_(e,t,r){return e==="elicitation"&&t==="form"&&r.form===void 0&&r.url===void 0}function Lf(e){switch(e.method){case"elicitation/create":return e.params?.mode==="url"?{elicitation:{url:{}}}:{elicitation:{form:{}}};case"sampling/createMessage":{let t=e.params;return t!==void 0&&(t.tools!==void 0||t.toolChoice!==void 0)?{sampling:{tools:{}}}:{sampling:{}}}case"roots/list":return{roots:{}};default:return}}function es(e,t){let r={};for(let[n,o]of Object.entries(e)){if(o===void 0)continue;let i=t===void 0?void 0:t[n];if(i===void 0){r[n]=o;continue}if(Ef(o)&&Ef(i)){let a={};for(let[c,s]of Object.entries(o))s!==void 0&&i[c]===void 0&&!E_(n,c,i)&&(a[c]=s);Object.keys(a).length>0&&(r[n]=a)}}return Object.keys(r).length>0?r:void 0}var I_="2026-07-28";function $o(e){return e>=I_}function Df(e){return e.filter(t=>!$o(t))}function Au(e){return e.filter(t=>$o(t))}function Vf(e){let t=e.structuredContent;return t===void 0||!(typeof t!="object"||t===null||Array.isArray(t))||(e.content?.some(r=>r.type==="text")??!1)?e:{...e,content:[...e.content??[],{type:"text",text:JSON.stringify(t)}]}}var Zf=["task","inputRequests","requestState"];function qu(e){return e===null||typeof e!="object"||Array.isArray(e)||e.content!==void 0||Zf.some(t=>t in e)?e:{...e,content:[]}}function P_(){let e=Ar(()=>W([u(),Z(),G(),qt(),B(u(),e),O(e)])),t=B(u(),e),r=W([u(),Z().int()]),n=u(),o=E({ttl:Z().optional()}),i=E({taskId:u()}),a=ne({progressToken:r.optional(),"io.modelcontextprotocol/related-task":i.optional()}),c=E({_meta:a.optional()}),s=c.extend({task:o.optional()}),l=E({method:u(),params:c.loose().optional()}),m=E({_meta:a.optional()}),h=E({method:u(),params:m.loose().optional()}),z=ne({_meta:a.optional()}),R=W([u(),Z().int()]),v=z.strict(),b=m.extend({requestId:R.optional(),reason:u().optional()}),g=h.extend({method:j("notifications/cancelled"),params:b}),d=E({src:u(),mimeType:u().optional(),sizes:O(u()).optional(),theme:se(["light","dark"]).optional()}),_=E({icons:O(d).optional()}),p=E({name:u(),title:u().optional()}),S=p.extend({...p.shape,..._.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),w=gt(E({applyDefaults:G().optional()}),t),y=ar(Je=>Je&&typeof Je=="object"&&!Array.isArray(Je)&&Object.keys(Je).length===0?{form:{}}:Je,gt(E({form:w.optional(),url:t.optional()}),t.optional())),f=ne({list:t.optional(),cancel:t.optional(),requests:ne({sampling:ne({createMessage:t.optional()}).optional(),elicitation:ne({create:t.optional()}).optional()}).optional()}),T=ne({list:t.optional(),cancel:t.optional(),requests:ne({tools:ne({call:t.optional()}).optional()}).optional()}),A=E({experimental:B(u(),t).optional(),sampling:E({context:t.optional(),tools:t.optional()}).optional(),elicitation:y.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:f.optional(),extensions:B(u(),t).optional()}),F=c.extend({protocolVersion:u(),capabilities:A,clientInfo:S}),M=l.extend({method:j("initialize"),params:F}),D=E({experimental:B(u(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:T.optional(),extensions:B(u(),t).optional()}),Y=z.extend({protocolVersion:u(),capabilities:D,serverInfo:S,instructions:u().optional()}),K=h.extend({method:j("notifications/initialized"),params:m.optional()}),fe=l.extend({method:j("ping"),params:c.optional()}),Te=E({progress:Z(),total:Q(Z()),message:Q(u())}),ze=E({...m.shape,...Te.shape,progressToken:r}),Ce=h.extend({method:j("notifications/progress"),params:ze}),ve=c.extend({cursor:n.optional()}),k=l.extend({params:ve.optional()}),x=z.extend({nextCursor:n.optional()}),V=E({uri:u(),mimeType:Q(u()),_meta:B(u(),ee()).optional()}),$=V.extend({text:u()}),P=u().refine(Je=>{try{return atob(Je),!0}catch{return!1}},{message:"Invalid Base64 string"}),N=V.extend({blob:P}),H=se(["user","assistant"]),te=E({audience:O(H).optional(),priority:Z().min(0).max(1).optional(),lastModified:lt.datetime({offset:!0}).optional()}),pe=E({...p.shape,..._.shape,uri:u(),description:Q(u()),mimeType:Q(u()),size:Q(Z()),annotations:te.optional(),_meta:Q(ne({}))}),ae=E({...p.shape,..._.shape,uriTemplate:u(),description:Q(u()),mimeType:Q(u()),annotations:te.optional(),_meta:Q(ne({}))}),Re=k.extend({method:j("resources/list")}),Ge=x.extend({resources:O(pe)}),I=k.extend({method:j("resources/templates/list")}),C=x.extend({resourceTemplates:O(ae)}),U=c.extend({uri:u()}),oe=U,ie=l.extend({method:j("resources/read"),params:oe}),me=z.extend({contents:O(W([$,N]))}),Ne=h.extend({method:j("notifications/resources/list_changed"),params:m.optional()}),qe=U,Fe=l.extend({method:j("resources/subscribe"),params:qe}),Ae=U,Ie=l.extend({method:j("resources/unsubscribe"),params:Ae}),nt=m.extend({uri:u()}),Ue=h.extend({method:j("notifications/resources/updated"),params:nt}),_t=E({name:u(),description:Q(u()),required:Q(G())}),at=E({...p.shape,..._.shape,description:Q(u()),arguments:Q(O(_t)),_meta:Q(ne({}))}),St=k.extend({method:j("prompts/list")}),Et=x.extend({prompts:O(at)}),It=c.extend({name:u(),arguments:B(u(),u()).optional()}),Bt=l.extend({method:j("prompts/get"),params:It}),Kt=E({type:j("text"),text:u(),annotations:te.optional(),_meta:B(u(),ee()).optional()}),Gt=E({type:j("image"),data:P,mimeType:u(),annotations:te.optional(),_meta:B(u(),ee()).optional()}),Wt=E({type:j("audio"),data:P,mimeType:u(),annotations:te.optional(),_meta:B(u(),ee()).optional()}),en=E({type:j("tool_use"),name:u(),id:u(),input:B(u(),ee()),_meta:B(u(),ee()).optional()}),Pt=E({type:j("resource"),resource:W([$,N]),annotations:te.optional(),_meta:B(u(),ee()).optional()}),tn=pe.extend({type:j("resource_link")}),ot=W([Kt,Gt,Wt,tn,Pt]),hr=E({role:H,content:ot}),gr=z.extend({description:u().optional(),messages:O(hr)}),Yt=h.extend({method:j("notifications/prompts/list_changed"),params:m.optional()}),rn=E({title:u().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),vr=E({taskSupport:se(["required","optional","forbidden"]).optional()}),Xt=E({...p.shape,..._.shape,description:u().optional(),inputSchema:E({type:j("object"),properties:B(u(),e).optional(),required:O(u()).optional()}).catchall(ee()),outputSchema:E({type:j("object"),properties:B(u(),e).optional(),required:O(u()).optional()}).catchall(ee()).optional(),annotations:rn.optional(),execution:vr.optional(),_meta:B(u(),ee()).optional()}),_r=k.extend({method:j("tools/list")}),Sr=x.extend({tools:O(Xt)}),yr=z.extend({content:O(ot),structuredContent:B(u(),ee()).optional(),isError:G().optional()}),He=s.extend({name:u(),arguments:B(u(),ee()).optional()}),nn=l.extend({method:j("tools/call"),params:He}),To=h.extend({method:j("notifications/tools/list_changed"),params:m.optional()}),br=se(["debug","info","notice","warning","error","critical","alert","emergency"]),on=c.extend({level:br}),an=l.extend({method:j("logging/setLevel"),params:on}),sn=m.extend({level:br,logger:u().optional(),data:ee()}),cn=h.extend({method:j("notifications/message"),params:sn}),un=E({name:u().optional()}),ln=E({hints:O(un).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),dn=E({mode:se(["auto","required","none"]).optional()}),Eo=E({type:j("tool_result"),toolUseId:u().describe("The unique identifier for the corresponding tool call."),content:O(ot),structuredContent:E({}).loose().optional(),isError:G().optional(),_meta:B(u(),ee()).optional()}),mn=Cr("type",[Kt,Gt,Wt]),kt=Cr("type",[Kt,Gt,Wt,en,Eo]),pn=E({role:H,content:W([kt,O(kt)]),_meta:B(u(),ee()).optional()}),fn=s.extend({messages:O(pn),modelPreferences:ln.optional(),systemPrompt:u().optional(),includeContext:se(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:O(u()).optional(),metadata:t.optional(),tools:O(Xt).optional(),toolChoice:dn.optional()}),hn=l.extend({method:j("sampling/createMessage"),params:fn}),gn=z.extend({model:u(),stopReason:Q(se(["endTurn","stopSequence","maxTokens"]).or(u())),role:H,content:mn}),vn=z.extend({model:u(),stopReason:Q(se(["endTurn","stopSequence","maxTokens","toolUse"]).or(u())),role:H,content:W([kt,O(kt)])}),_n=E({type:j("boolean"),title:u().optional(),description:u().optional(),default:G().optional()}),Sn=E({type:j("string"),title:u().optional(),description:u().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:se(["email","uri","date","date-time"]).optional(),default:u().optional()}),yn=E({type:se(["number","integer"]),title:u().optional(),description:u().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),bn=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),default:u().optional()}),$n=E({type:j("string"),title:u().optional(),description:u().optional(),oneOf:O(E({const:u(),title:u()})),default:u().optional()}),zn=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),enumNames:O(u()).optional(),default:u().optional()}),Rn=W([bn,$n]),Qt=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({type:j("string"),enum:O(u())}),default:O(u()).optional()}),er=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({anyOf:O(E({const:u(),title:u()}))}),default:O(u()).optional()}),Io=W([Qt,er]),Po=W([zn,Rn,Io]),et=W([Po,_n,Sn,yn]),tt=s.extend({mode:j("form").optional(),message:u(),requestedSchema:E({type:j("object"),properties:B(u(),et),required:O(u()).optional()}).catchall(ee())}),wn=s.extend({mode:j("url"),message:u(),elicitationId:u(),url:u().url()}),st=W([tt,wn]),ko=l.extend({method:j("elicitation/create"),params:st}),Oo=m.extend({elicitationId:u()}),jo=h.extend({method:j("notifications/elicitation/complete"),params:Oo}),No=z.extend({action:se(["accept","decline","cancel"]),content:ar(Je=>Je===null?void 0:Je,B(u(),W([u(),Z(),G(),O(u())])).optional())}),xo=E({type:j("ref/resource"),uri:u()}),Co=E({type:j("ref/prompt"),name:u()}),Ao=c.extend({ref:W([Co,xo]),argument:E({name:u(),value:u()}),context:E({arguments:B(u(),u()).optional()}).optional()}),Tn=l.extend({method:j("completion/complete"),params:Ao}),qo=z.extend({completion:ne({values:O(u()).max(100),total:Q(Z().int()),hasMore:Q(G())})}),Mo=E({uri:u().startsWith("file://"),name:u().optional(),_meta:B(u(),ee()).optional()}),$r=l.extend({method:j("roots/list"),params:c.optional()}),En=z.extend({roots:O(Mo)}),Uo=h.extend({method:j("notifications/roots/list_changed"),params:m.optional()}),Lo=ne({ttl:Z().optional(),pollInterval:Z().optional()}),Do=se(["working","input_required","completed","failed","cancelled"]),Ot=E({taskId:u(),status:Do,ttl:W([Z(),qt()]),createdAt:u(),lastUpdatedAt:u(),pollInterval:Q(Z()),statusMessage:Q(u())}),Xe=z.extend({task:Ot}),Vo=m.merge(Ot),tr=h.extend({method:j("notifications/tasks/status"),params:Vo}),zr=l.extend({method:j("tasks/get"),params:c.extend({taskId:u()})}),Rr=z.merge(Ot),wr=l.extend({method:j("tasks/result"),params:c.extend({taskId:u()})}),bs=z.loose(),Qe=k.extend({method:j("tasks/list")}),xe=x.extend({tasks:O(Ot)}),rr=l.extend({method:j("tasks/cancel"),params:c.extend({taskId:u()})});return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,TaskMetadataSchema:o,RelatedTaskMetadataSchema:i,RequestMetaSchema:a,BaseRequestParamsSchema:c,TaskAugmentedRequestParamsSchema:s,RequestSchema:l,NotificationsParamsSchema:m,NotificationSchema:h,ResultSchema:z,RequestIdSchema:R,EmptyResultSchema:v,CancelledNotificationParamsSchema:b,CancelledNotificationSchema:g,IconSchema:d,IconsSchema:_,BaseMetadataSchema:p,ImplementationSchema:S,ClientTasksCapabilitySchema:f,ServerTasksCapabilitySchema:T,ClientCapabilitiesSchema:A,InitializeRequestParamsSchema:F,InitializeRequestSchema:M,ServerCapabilitiesSchema:D,InitializeResultSchema:Y,InitializedNotificationSchema:K,PingRequestSchema:fe,ProgressSchema:Te,ProgressNotificationParamsSchema:ze,ProgressNotificationSchema:Ce,PaginatedRequestParamsSchema:ve,PaginatedRequestSchema:k,PaginatedResultSchema:x,ResourceContentsSchema:V,TextResourceContentsSchema:$,BlobResourceContentsSchema:N,RoleSchema:H,AnnotationsSchema:te,ResourceSchema:pe,ResourceTemplateSchema:ae,ListResourcesRequestSchema:Re,ListResourcesResultSchema:Ge,ListResourceTemplatesRequestSchema:I,ListResourceTemplatesResultSchema:C,ResourceRequestParamsSchema:U,ReadResourceRequestParamsSchema:oe,ReadResourceRequestSchema:ie,ReadResourceResultSchema:me,ResourceListChangedNotificationSchema:Ne,SubscribeRequestParamsSchema:qe,SubscribeRequestSchema:Fe,UnsubscribeRequestParamsSchema:Ae,UnsubscribeRequestSchema:Ie,ResourceUpdatedNotificationParamsSchema:nt,ResourceUpdatedNotificationSchema:Ue,PromptArgumentSchema:_t,PromptSchema:at,ListPromptsRequestSchema:St,ListPromptsResultSchema:Et,GetPromptRequestParamsSchema:It,GetPromptRequestSchema:Bt,TextContentSchema:Kt,ImageContentSchema:Gt,AudioContentSchema:Wt,ToolUseContentSchema:en,EmbeddedResourceSchema:Pt,ResourceLinkSchema:tn,ContentBlockSchema:ot,PromptMessageSchema:hr,GetPromptResultSchema:gr,PromptListChangedNotificationSchema:Yt,ToolAnnotationsSchema:rn,ToolExecutionSchema:vr,ToolSchema:Xt,ListToolsRequestSchema:_r,ListToolsResultSchema:Sr,CallToolResultSchema:yr,CallToolRequestParamsSchema:He,CallToolRequestSchema:nn,ToolListChangedNotificationSchema:To,LoggingLevelSchema:br,SetLevelRequestParamsSchema:on,SetLevelRequestSchema:an,LoggingMessageNotificationParamsSchema:sn,LoggingMessageNotificationSchema:cn,ModelHintSchema:un,ModelPreferencesSchema:ln,ToolChoiceSchema:dn,ToolResultContentSchema:Eo,SamplingContentSchema:mn,SamplingMessageContentBlockSchema:kt,SamplingMessageSchema:pn,CreateMessageRequestParamsSchema:fn,CreateMessageRequestSchema:hn,CreateMessageResultSchema:gn,CreateMessageResultWithToolsSchema:vn,BooleanSchemaSchema:_n,StringSchemaSchema:Sn,NumberSchemaSchema:yn,UntitledSingleSelectEnumSchemaSchema:bn,TitledSingleSelectEnumSchemaSchema:$n,LegacyTitledEnumSchemaSchema:zn,SingleSelectEnumSchemaSchema:Rn,UntitledMultiSelectEnumSchemaSchema:Qt,TitledMultiSelectEnumSchemaSchema:er,MultiSelectEnumSchemaSchema:Io,EnumSchemaSchema:Po,PrimitiveSchemaDefinitionSchema:et,ElicitRequestFormParamsSchema:tt,ElicitRequestURLParamsSchema:wn,ElicitRequestParamsSchema:st,ElicitRequestSchema:ko,ElicitationCompleteNotificationParamsSchema:Oo,ElicitationCompleteNotificationSchema:jo,ElicitResultSchema:No,ResourceTemplateReferenceSchema:xo,PromptReferenceSchema:Co,CompleteRequestParamsSchema:Ao,CompleteRequestSchema:Tn,CompleteResultSchema:qo,RootSchema:Mo,ListRootsRequestSchema:$r,ListRootsResultSchema:En,RootsListChangedNotificationSchema:Uo,TaskCreationParamsSchema:Lo,TaskStatusSchema:Do,TaskSchema:Ot,CreateTaskResultSchema:Xe,TaskStatusNotificationParamsSchema:Vo,TaskStatusNotificationSchema:tr,GetTaskRequestSchema:zr,GetTaskResultSchema:Rr,GetTaskPayloadRequestSchema:wr,GetTaskPayloadResultSchema:bs,ListTasksRequestSchema:Qe,ListTasksResultSchema:xe,CancelTaskRequestSchema:rr,CancelTaskResultSchema:z.merge(Ot),ClientRequestSchema:W([fe,M,Tn,an,Bt,St,Re,I,ie,Fe,Ie,nn,_r,zr,wr,Qe,rr]),ClientNotificationSchema:W([g,Ce,K,Uo,tr]),ClientResultSchema:W([v,gn,vn,No,En,Rr,xe,Xe]),ServerRequestSchema:W([fe,hn,ko,$r,zr,wr,Qe,rr]),ServerNotificationSchema:W([g,Ce,cn,Ue,Ne,To,Yt,tr,jo]),ServerResultSchema:W([v,Y,qo,gr,Et,Ge,C,me,yr,Sr,Rr,xe,Xe]),CallToolResultWireSchema:ee().superRefine((Je,Eg)=>{if(!(typeof Je!="object"||Je===null||Array.isArray(Je)||Je.content!==void 0)){for(let zl of Zf)if(zl in Je){Eg.addIssue({code:"custom",message:`content is required when the body carries '${zl}' \u2014 another result family cannot default into an empty tools/call success`});return}}}).transform(qu).pipe(yr)}}var k_;function Ff(){return k_??=P_()}function Hf(e){return e.type!=="object"}var O_=new Set(["const","enum","default","examples"]),j_=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);function If(e){return e!==void 0&&!(typeof e=="string"&&e.startsWith("#"))}function N_(e){let t=typeof e.$schema=="string"?e.$schema:void 0;if(If(e.$id))return{...t!==void 0&&{$schema:t},type:"object",properties:{result:e},required:["result"]};let r=Tl(e.$schema)&&e.$recursiveAnchor!==!0,n=(o,i)=>{if(Array.isArray(o))return o.map(s=>n(s,!1));if(o===null||typeof o!="object"||!i&&If(o.$id))return o;let a={},c=!1;for(let[s,l]of Object.entries(o))i?a[s]=n(l,!1):(s==="$ref"||s==="$dynamicRef")&&typeof l=="string"?a[s]=l==="#"?"#/properties/result":l.startsWith("#/")?`#/properties/result${l.slice(1)}`:l:s==="$recursiveRef"&&l==="#"&&r?c=!0:O_.has(s)?a[s]=l:j_.has(s)?a[s]=n(l,!0):a[s]=n(l,!1);return c&&("$ref"in a?a.allOf=[...Array.isArray(a.allOf)?a.allOf:[],{$ref:"#/properties/result"}]:a.$ref="#/properties/result"),a};return{...t!==void 0&&{$schema:t},type:"object",properties:{result:n(e,!1)},required:["result"]}}var Jf={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},Bf={"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},x_={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},Ba;function Mu(){if(Ba)return Ba;let e=Ff();return Ba={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}},Ba}function Kf(e){return Object.prototype.hasOwnProperty.call(Jf,e)}function Gf(e){return Object.prototype.hasOwnProperty.call(Bf,e)}function C_(e){return Object.prototype.hasOwnProperty.call(x_,e)}function A_(e){return C_(e)?Mu().resultSchemas[e]:void 0}function q_(e){return Kf(e)?Mu().requestSchemas[e]:void 0}function M_(e){return Gf(e)?Mu().notificationSchemas[e]:void 0}var oT=Object.keys(Jf),iT=Object.keys(Bf);function Ou(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ka(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var Pf={ok:!1,reason:"not-in-era"};function kf(e){return Ou(e)&&Ou(e.outputSchema)&&Hf(e.outputSchema)}var Uu={era:"2025-11-25",hasRequestMethod:Kf,hasNotificationMethod:Gf,validateRequest:(e,t)=>Ka(q_(e),t),validateResult:(e,t)=>Ka(A_(e),t),validateNotification:(e,t)=>Ka(M_(e),t),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Pf,validateInputResponse:()=>Pf,samplingResultVariant:((e,t)=>{let r=Ff();return Ka(e?r.CreateMessageResultWithToolsSchema:r.CreateMessageResultSchema,t)}),outboundEnvelope:e=>{},validateEnvelopeMeta:e=>[],projectCallToolResult(e,t){let r=Vf(e),n=r.structuredContent;if(n===void 0)return r;let o=typeof n!="object"||n===null||Array.isArray(n),i=t!==void 0&&Hf(t);return!o&&!i?r:{...r,structuredContent:{result:n}}},decodeResult(e,t){if(Ou(t)&&"resultType"in t){let r={...t};return delete r.resultType,{kind:"complete",result:r}}return{kind:"complete",result:t}},encodeResult(e,t){if(e!=="tools/list")return t;let r=t.tools;return!Array.isArray(r)||!r.some(n=>kf(n))?t:{...t,tools:r.map(n=>kf(n)?{...n,outputSchema:N_(n.outputSchema)}:n)}},encodeErrorCode:e=>e===-32002?-32602:e,checkInboundEnvelope:e=>{}};function U_(){let e=Ar(()=>W([u(),Z(),G(),qt(),B(u(),e),O(e)])),t=B(u(),e),r=W([u(),Z().int()]),n=u(),o=W([u(),Z().int()]),i=se(["user","assistant"]),a=se(["debug","info","notice","warning","error","critical","alert","emergency"]),c=u().refine(xe=>{try{return atob(xe),!0}catch{return!1}},{message:"Invalid Base64 string"}),s=E({ttl:Z().optional()}),l=E({taskId:u()}),m=ne({progressToken:r.optional(),"io.modelcontextprotocol/related-task":l.optional()}),h=E({_meta:m.optional()}),z=h.extend({task:s.optional()}),R=E({_meta:m.optional()}),v=E({method:u(),params:R.loose().optional()}),b=E({src:u(),mimeType:u().optional(),sizes:O(u()).optional(),theme:se(["light","dark"]).optional()}),g=E({icons:O(b).optional()}),d=E({name:u(),title:u().optional()}),_=d.extend({...d.shape,...g.shape,version:u(),websiteUrl:u().optional(),description:u().optional()}),p=gt(E({applyDefaults:G().optional()}),t),S=ar(xe=>xe&&typeof xe=="object"&&!Array.isArray(xe)&&Object.keys(xe).length===0?{form:{}}:xe,gt(E({form:p.optional(),url:t.optional()}),t.optional())),w=ne({list:t.optional(),cancel:t.optional(),requests:ne({sampling:ne({createMessage:t.optional()}).optional(),elicitation:ne({create:t.optional()}).optional()}).optional()}),y=ne({list:t.optional(),cancel:t.optional(),requests:ne({tools:ne({call:t.optional()}).optional()}).optional()}),f=E({experimental:B(u(),t).optional(),sampling:E({context:t.optional(),tools:t.optional()}).optional(),elicitation:S.optional(),roots:E({listChanged:G().optional()}).optional(),tasks:w.optional(),extensions:B(u(),t).optional()}),T=E({experimental:B(u(),t).optional(),logging:t.optional(),completions:t.optional(),prompts:E({listChanged:G().optional()}).optional(),resources:E({subscribe:G().optional(),listChanged:G().optional()}).optional(),tools:E({listChanged:G().optional()}).optional(),tasks:y.optional(),extensions:B(u(),t).optional()}),A=E({progress:Z(),total:Q(Z()),message:Q(u())}),F=E({...R.shape,...A.shape,progressToken:r}),M=v.extend({method:j("notifications/progress"),params:F}),D=R.extend({level:a,logger:u().optional(),data:ee()}),Y=v.extend({method:j("notifications/message"),params:D}),K=E({uri:u(),mimeType:Q(u()),_meta:B(u(),ee()).optional()}),fe=K.extend({text:u()}),Te=K.extend({blob:c}),ze=E({audience:O(i).optional(),priority:Z().min(0).max(1).optional(),lastModified:lt.datetime({offset:!0}).optional()}),Ce=E({...d.shape,...g.shape,uri:u(),description:Q(u()),mimeType:Q(u()),size:Q(Z()),annotations:ze.optional(),_meta:Q(ne({}))}),ve=E({...d.shape,...g.shape,uriTemplate:u(),description:Q(u()),mimeType:Q(u()),annotations:ze.optional(),_meta:Q(ne({}))}),k=v.extend({method:j("notifications/resources/list_changed"),params:R.optional()}),x=R.extend({uri:u()}),V=v.extend({method:j("notifications/resources/updated"),params:x}),$=E({name:u(),description:Q(u()),required:Q(G())}),P=E({...d.shape,...g.shape,description:Q(u()),arguments:Q(O($)),_meta:Q(ne({}))}),N=v.extend({method:j("notifications/prompts/list_changed"),params:R.optional()}),H=E({type:j("text"),text:u(),annotations:ze.optional(),_meta:B(u(),ee()).optional()}),te=E({type:j("image"),data:c,mimeType:u(),annotations:ze.optional(),_meta:B(u(),ee()).optional()}),pe=E({type:j("audio"),data:c,mimeType:u(),annotations:ze.optional(),_meta:B(u(),ee()).optional()}),ae=E({type:j("tool_use"),name:u(),id:u(),input:B(u(),ee()),_meta:B(u(),ee()).optional()}),Re=E({type:j("resource"),resource:W([fe,Te]),annotations:ze.optional(),_meta:B(u(),ee()).optional()}),Ge=Ce.extend({type:j("resource_link")}),I=W([H,te,pe,Ge,Re]),C=E({role:i,content:I}),U=E({title:u().optional(),readOnlyHint:G().optional(),destructiveHint:G().optional(),idempotentHint:G().optional(),openWorldHint:G().optional()}),oe=v.extend({method:j("notifications/tools/list_changed"),params:R.optional()}),ie=E({name:u().optional()}),me=E({hints:O(ie).optional(),costPriority:Z().min(0).max(1).optional(),speedPriority:Z().min(0).max(1).optional(),intelligencePriority:Z().min(0).max(1).optional()}),Ne=E({mode:se(["auto","required","none"]).optional()}),qe=E({type:j("boolean"),title:u().optional(),description:u().optional(),default:G().optional()}),Fe=E({type:j("string"),title:u().optional(),description:u().optional(),minLength:Z().optional(),maxLength:Z().optional(),format:se(["email","uri","date","date-time"]).optional(),default:u().optional()}),Ae=E({type:se(["number","integer"]),title:u().optional(),description:u().optional(),minimum:Z().optional(),maximum:Z().optional(),default:Z().optional()}),Ie=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),default:u().optional()}),nt=E({type:j("string"),title:u().optional(),description:u().optional(),oneOf:O(E({const:u(),title:u()})),default:u().optional()}),Ue=E({type:j("string"),title:u().optional(),description:u().optional(),enum:O(u()),enumNames:O(u()).optional(),default:u().optional()}),_t=W([Ie,nt]),at=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({type:j("string"),enum:O(u())}),default:O(u()).optional()}),St=E({type:j("array"),title:u().optional(),description:u().optional(),minItems:Z().optional(),maxItems:Z().optional(),items:E({anyOf:O(E({const:u(),title:u()}))}),default:O(u()).optional()}),Et=W([at,St]),It=W([Ue,_t,Et]),Bt=W([It,qe,Fe,Ae]),Kt=z.extend({mode:j("form").optional(),message:u(),requestedSchema:E({type:j("object"),properties:B(u(),Bt),required:O(u()).optional()}).catchall(ee())}),Gt=E({type:j("ref/resource"),uri:u()}),Wt=E({type:j("ref/prompt"),name:u()}),en=E({uri:u().startsWith("file://"),name:u().optional(),_meta:B(u(),ee()).optional()}),Pt=f.shape,tn=E({experimental:Pt.experimental,sampling:Pt.sampling,elicitation:Pt.elicitation,roots:Pt.roots,extensions:Pt.extensions}),ot=T.shape,hr=E({experimental:ot.experimental,logging:ot.logging,completions:ot.completions,prompts:ot.prompts,resources:ot.resources,tools:ot.tools,extensions:ot.extensions}),gr=ne({progressToken:r.optional(),[ur]:u(),[qr]:_.optional(),[wt]:tn,[Ut]:a.optional()}),Yt=E({...d.shape,...g.shape,description:u().optional(),inputSchema:ne({$schema:u().optional(),type:j("object")}),outputSchema:ne({$schema:u().optional()}).optional(),annotations:U.optional(),_meta:B(u(),ee()).optional()}),rn=E({type:j("tool_result"),toolUseId:u(),content:O(I),structuredContent:ee().optional(),isError:G().optional(),_meta:B(u(),ee()).optional()}),vr=W([H,te,pe,ae,rn]),Xt=E({role:i,content:W([vr,O(vr)]),_meta:B(u(),ee()).optional()}),_r=u(),Sr=ne({[Rt]:_.optional().catch(void 0)}),yr=Sr.optional();function He(xe){return ne({_meta:yr,resultType:_r.default("complete"),...xe})}let nn=He({}),To=He({nextCursor:n.optional()}),br=He({content:O(I),structuredContent:ee().optional(),isError:G().optional()}),on=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),tools:O(Yt),nextCursor:n.optional()}),an=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),prompts:O(P),nextCursor:n.optional()}),sn=He({description:u().optional(),messages:O(C)}),cn=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),resources:O(Ce),nextCursor:n.optional()}),un=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),resourceTemplates:O(ve),nextCursor:n.optional()}),ln=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),contents:O(W([fe,Te]))}),dn=He({completion:E({values:O(u()).max(100),total:Z().int().optional(),hasMore:G().optional()}).loose()}),Eo=He({ttlMs:Z().int().min(0),cacheScope:se(["public","private"])}),mn=He({ttlMs:Z().int().min(0).catch(0),cacheScope:se(["public","private"]).catch("private"),supportedVersions:O(u()),capabilities:hr,instructions:u().optional()}),kt=E({messages:O(Xt),modelPreferences:me.optional(),systemPrompt:u().optional(),includeContext:se(["none","thisServer","allServers"]).optional(),temperature:Z().optional(),maxTokens:Z().int(),stopSequences:O(u()).optional(),metadata:t.optional(),tools:O(Yt).optional(),toolChoice:Ne.optional()}),pn=E({method:j("sampling/createMessage"),params:kt}),fn=E({method:j("roots/list"),params:E({_meta:B(u(),ee()).optional()}).optional()}),hn=E({...Xt.shape,model:u(),stopReason:u().optional()}),gn=E({roots:O(en)}),vn=E({action:se(["accept","decline","cancel"]),content:B(u(),W([u(),Z(),G(),O(u())])).optional()}),_n=E({mode:j("url"),message:u(),url:u().url()}),Sn=W([Kt,_n]),yn=E({method:j("elicitation/create"),params:Sn}),bn=W([pn,fn,yn]),$n=W([hn,gn,vn]),zn=B(u(),bn),Rn=B(u(),$n),Qt=He({inputRequests:zn.optional(),requestState:u().optional()}),er={inputResponses:Rn.optional(),requestState:u().optional()},Io=E({_meta:gr,...er}),Po=ne({progressToken:r.optional()});function et(xe,rr){return E({method:j(xe),params:E({_meta:gr,...rr})})}function tt(xe,rr){return E({method:j(xe),params:E({_meta:Po.optional(),...rr}).optional()})}let wn={name:u(),arguments:B(u(),ee()).optional(),...er},st={cursor:n.optional()},ko=et("tools/call",wn),Oo=et("tools/list",st),jo=et("prompts/list",st),No=et("prompts/get",{name:u(),arguments:B(u(),u()).optional(),...er}),xo=et("resources/list",st),Co=et("resources/templates/list",st),Ao=et("resources/read",{uri:u(),...er}),Tn={ref:W([Wt,Gt]),argument:E({name:u(),value:u()}),context:E({arguments:B(u(),u()).optional()}).optional()},qo=et("completion/complete",Tn),Mo=et("server/discover",{}),$r=E({toolsListChanged:G().optional(),promptsListChanged:G().optional(),resourcesListChanged:G().optional(),resourceSubscriptions:O(u()).optional()}),En={notifications:$r},Uo=et("subscriptions/listen",En),Lo=Sr.extend({"io.modelcontextprotocol/subscriptionId":o}),Do=ne({_meta:Lo,resultType:_r.default("complete")}),Ot={"tools/call":tt("tools/call",wn),"tools/list":tt("tools/list",st),"prompts/get":tt("prompts/get",{name:u(),arguments:B(u(),u()).optional()}),"prompts/list":tt("prompts/list",st),"resources/list":tt("resources/list",st),"resources/templates/list":tt("resources/templates/list",st),"resources/read":tt("resources/read",{uri:u()}),"completion/complete":tt("completion/complete",Tn),"server/discover":tt("server/discover",{}),"subscriptions/listen":tt("subscriptions/listen",En)};function Xe(xe){return ne({_meta:yr,...xe})}let Vo={"tools/call":Xe({content:O(I),structuredContent:ee().optional(),isError:G().optional()}),"tools/list":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),tools:O(Yt),nextCursor:n.optional()}),"prompts/get":Xe({description:u().optional(),messages:O(C)}),"prompts/list":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),prompts:O(P),nextCursor:n.optional()}),"resources/list":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),resources:O(Ce),nextCursor:n.optional()}),"resources/templates/list":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),resourceTemplates:O(ve),nextCursor:n.optional()}),"resources/read":Xe({ttlMs:Z().int().min(0),cacheScope:se(["public","private"]),contents:O(W([fe,Te]))}),"completion/complete":Xe({completion:E({values:O(u()).max(100),total:Z().int().optional(),hasMore:G().optional()}).loose()}),"server/discover":Xe({ttlMs:Z().int().min(0).catch(0),cacheScope:se(["public","private"]).catch("private"),supportedVersions:O(u()),capabilities:hr,instructions:u().optional()}),"subscriptions/listen":Xe({})},tr=ne({"io.modelcontextprotocol/subscriptionId":o.optional()}),zr=E({method:j("notifications/subscriptions/acknowledged"),params:E({_meta:tr.optional(),notifications:$r})}),Rr=E({_meta:tr.optional(),requestId:o,reason:u().optional()}),wr=E({method:j("notifications/cancelled"),params:Rr}),bs={"notifications/cancelled":wr,"notifications/progress":M,"notifications/message":Y,"notifications/resources/updated":V,"notifications/resources/list_changed":k,"notifications/tools/list_changed":oe,"notifications/prompts/list_changed":N,"notifications/subscriptions/acknowledged":zr},Qe=xe=>E({jsonrpc:j("2.0"),id:W([u(),Z().int()]),result:xe}).strict();return{JSONValueSchema:e,JSONObjectSchema:t,ProgressTokenSchema:r,CursorSchema:n,RequestIdSchema:o,RoleSchema:i,LoggingLevelSchema:a,TaskMetadataSchema:s,RelatedTaskMetadataSchema:l,RequestMetaSchema:m,BaseRequestParamsSchema:h,TaskAugmentedRequestParamsSchema:z,NotificationsParamsSchema:R,NotificationSchema:v,IconSchema:b,IconsSchema:g,BaseMetadataSchema:d,ImplementationSchema:_,ClientTasksCapabilitySchema:w,ServerTasksCapabilitySchema:y,ClientCapabilitiesSchema:f,ServerCapabilitiesSchema:T,ProgressSchema:A,ProgressNotificationParamsSchema:F,ProgressNotificationSchema:M,LoggingMessageNotificationParamsSchema:D,LoggingMessageNotificationSchema:Y,ResourceContentsSchema:K,TextResourceContentsSchema:fe,BlobResourceContentsSchema:Te,AnnotationsSchema:ze,ResourceSchema:Ce,ResourceTemplateSchema:ve,ResourceListChangedNotificationSchema:k,ResourceUpdatedNotificationParamsSchema:x,ResourceUpdatedNotificationSchema:V,PromptArgumentSchema:$,PromptSchema:P,PromptListChangedNotificationSchema:N,TextContentSchema:H,ImageContentSchema:te,AudioContentSchema:pe,ToolUseContentSchema:ae,EmbeddedResourceSchema:Re,ResourceLinkSchema:Ge,ContentBlockSchema:I,PromptMessageSchema:C,ToolAnnotationsSchema:U,ToolListChangedNotificationSchema:oe,ModelHintSchema:ie,ModelPreferencesSchema:me,ToolChoiceSchema:Ne,BooleanSchemaSchema:qe,StringSchemaSchema:Fe,NumberSchemaSchema:Ae,UntitledSingleSelectEnumSchemaSchema:Ie,TitledSingleSelectEnumSchemaSchema:nt,LegacyTitledEnumSchemaSchema:Ue,SingleSelectEnumSchemaSchema:_t,UntitledMultiSelectEnumSchemaSchema:at,TitledMultiSelectEnumSchemaSchema:St,MultiSelectEnumSchemaSchema:Et,EnumSchemaSchema:It,PrimitiveSchemaDefinitionSchema:Bt,ElicitRequestFormParamsSchema:Kt,ResourceTemplateReferenceSchema:Gt,PromptReferenceSchema:Wt,RootSchema:en,ClientCapabilities2026Schema:tn,ServerCapabilities2026Schema:hr,RequestMetaEnvelopeSchema:gr,ToolSchema:Yt,ToolResultContentSchema:rn,SamplingMessageContentBlockSchema:vr,SamplingMessageSchema:Xt,ResultTypeSchema:_r,ResultMetaSchema:Sr,ResultSchema:nn,PaginatedResultSchema:To,CallToolResultSchema:br,ListToolsResultSchema:on,ListPromptsResultSchema:an,GetPromptResultSchema:sn,ListResourcesResultSchema:cn,ListResourceTemplatesResultSchema:un,ReadResourceResultSchema:ln,CompleteResultSchema:dn,CacheableResultSchema:Eo,DiscoverResultSchema:mn,CreateMessageRequestParamsSchema:kt,CreateMessageRequestSchema:pn,ListRootsRequestSchema:fn,CreateMessageResultSchema:hn,ListRootsResultSchema:gn,ElicitResultSchema:vn,ElicitRequestURLParamsSchema:_n,ElicitRequestParamsSchema:Sn,ElicitRequestSchema:yn,InputRequestSchema:bn,InputResponseSchema:$n,InputRequestsSchema:zn,InputResponsesSchema:Rn,InputRequiredResultSchema:Qt,InputResponseRequestParamsSchema:Io,CallToolRequestSchema:ko,ListToolsRequestSchema:Oo,ListPromptsRequestSchema:jo,GetPromptRequestSchema:No,ListResourcesRequestSchema:xo,ListResourceTemplatesRequestSchema:Co,ReadResourceRequestSchema:Ao,CompleteRequestSchema:qo,DiscoverRequestSchema:Mo,SubscriptionFilterSchema:$r,SubscriptionsListenRequestSchema:Uo,SubscriptionsListenResultMetaSchema:Lo,SubscriptionsListenResultSchema:Do,dispatchRequestSchemas:Ot,dispatchResultSchemas:Vo,NotificationMetaSchema:tr,SubscriptionsAcknowledgedNotificationSchema:zr,CancelledNotificationParamsSchema:Rr,CancelledNotificationSchema:wr,notificationSchemas2026:bs,JSONRPCResultResponseSchema:Qe(nn),CallToolResultResponseSchema:Qe(W([br,Qt])),ListToolsResultResponseSchema:Qe(on),ListPromptsResultResponseSchema:Qe(an),GetPromptResultResponseSchema:Qe(W([sn,Qt])),ListResourcesResultResponseSchema:Qe(cn),ListResourceTemplatesResultResponseSchema:Qe(un),ReadResourceResultResponseSchema:Qe(W([ln,Qt])),CompleteResultResponseSchema:Qe(dn),DiscoverResultResponseSchema:Qe(mn)}}var L_;function pr(){return L_??=U_()}var D_=["tools/list","prompts/list","resources/list","resources/templates/list","resources/read","server/discover"];function V_(e){return D_.includes(e)}var Gr=Symbol("modelcontextprotocol.resultCacheHintFallback");function Wf(e,t){if(t===void 0)return e;let r=e[Gr];if(r===void 0)return{...e,[Gr]:t};let n={},o=r.ttlMs??t.ttlMs;o!==void 0&&(n.ttlMs=o);let i=r.cacheScope??t.cacheScope;return i!==void 0&&(n.cacheScope=i),{...e,[Gr]:n}}function Z_(e){return e[Gr]}function Lu(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function Du(e){return e==="public"||e==="private"}function Yf(e,t){if(e.ttlMs!==void 0&&!Lu(e.ttlMs))throw new RangeError(`Invalid cache hint for ${t}: ttlMs must be a non-negative safe integer (got ${String(e.ttlMs)})`);if(e.cacheScope!==void 0&&!Du(e.cacheScope))throw new RangeError(`Invalid cache hint for ${t}: cacheScope must be 'public' or 'private' (got ${String(e.cacheScope)})`)}var X=(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})({}),ge=class Xf extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ProtocolError"})}static[Symbol.hasInstance](t){return Wr(this,t)}static isInstance(t){if(typeof this!="function")throw new TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return Wr(this,t)}constructor(t,r,n){super(r),this.code=t,this.data=n,this.name="ProtocolError",Cu(this,new.target)}static fromError(t,r,n){if(t===X.UrlElicitationRequired&&n){let o=n;if(o.elicitations)return new Qf(o.elicitations,r)}if(t===X.UnsupportedProtocolVersion&&n){let o=n;if(Array.isArray(o.supported)&&typeof o.requested=="string")return new Zu({supported:o.supported,requested:o.requested},r)}if(t===X.InvalidParams||t===X.ResourceNotFound){let o=n;if(typeof o?.uri=="string"&&(t===X.ResourceNotFound||Object.keys(o).length===1))return new Vu(o.uri,r)}if(t===X.MissingRequiredClientCapability&&n){let o=n;if(o.requiredCapabilities!==null&&typeof o.requiredCapabilities=="object"&&!Array.isArray(o.requiredCapabilities))return new ts({requiredCapabilities:o.requiredCapabilities},r)}return new Xf(t,r,n)}},Vu=class extends ge{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.ResourceNotFoundError"})}constructor(e,t=`Resource not found: ${e}`){super(X.InvalidParams,t,{uri:e})}get uri(){return this.data.uri}},Qf=class extends ge{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UrlElicitationRequiredError"})}constructor(e,t=`URL elicitation${e.length>1?"s":""} required`){super(X.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},Zu=class extends ge{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.UnsupportedProtocolVersionError"})}constructor(e,t=`Unsupported protocol version: ${e.requested}`){super(X.UnsupportedProtocolVersion,t,e)}get supported(){return this.data.supported}get requested(){return this.data.requested}},ts=class extends ge{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.MissingRequiredClientCapabilityError"})}constructor(e,t=`Missing required client capabilities: ${Object.keys(e.requiredCapabilities).join(", ")}`){super(X.MissingRequiredClientCapability,t,e)}get requiredCapabilities(){return this.data.requiredCapabilities}},F_=0,H_="private",J_=["tools/call","prompts/get","resources/read"];function B_(e,t){let r=t.resultType;if(r===void 0)return{...t,resultType:"complete"};if(r==="complete"||J_.includes(e))return t;throw new ge(X.InternalError,`Handler for ${e} returned resultType '${String(r)}', but results of ${e} only support 'complete' on protocol revision 2026-07-28`)}function K_(e,t){let r=Z_(t);if(t.resultType!=="complete"||!V_(e))return r===void 0?t:Q_(t);let n=t,o=Lu(n.ttlMs)?n.ttlMs:Y_(r),i=Du(n.cacheScope)?n.cacheScope:X_(r),a={...n,ttlMs:o,cacheScope:i};return delete a[Gr],a}function G_(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function W_(e,t){if(t===void 0)return e;let r=e._meta;return r===void 0?{...e,_meta:{[Rt]:t}}:!G_(r)||r[Rt]!==void 0?e:{...e,_meta:{...r,[Rt]:t}}}function Y_(e){return e!==void 0&&Lu(e.ttlMs)?e.ttlMs:F_}function X_(e){return e!==void 0&&Du(e.cacheScope)?e.cacheScope:H_}function Q_(e){let t={...e};return delete t[Gr],t}var eS=["elicitation/create","sampling/createMessage","roots/list"],Ga;function eh(){if(Ga)return Ga;let e=pr();return Ga={request:{"elicitation/create":E({method:j("elicitation/create"),params:e.ElicitRequestParamsSchema}),"sampling/createMessage":E({method:j("sampling/createMessage"),params:e.CreateMessageRequestParamsSchema}),"roots/list":E({method:j("roots/list"),params:ne({}).optional()})},response:{"elicitation/create":e.ElicitResultSchema,"sampling/createMessage":e.CreateMessageResultSchema,"roots/list":e.ListRootsResultSchema}},Ga}function th(e){return eS.includes(e)}function Tu(e){return th(e)?eh().request[e]:void 0}function tS(e){return th(e)?eh().response[e]:void 0}var Fu={"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},rh={"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 nh(e){return Object.prototype.hasOwnProperty.call(Fu,e)}function oh(e){return Object.prototype.hasOwnProperty.call(rh,e)}function rS(e){return Object.prototype.hasOwnProperty.call(Fu,e)}function nS(e){return nh(e)?pr().dispatchRequestSchemas[e]:void 0}function oS(e){return rS(e)?pr().dispatchResultSchemas[e]:void 0}function iS(e){return oh(e)?pr().notificationSchemas2026[e]:void 0}var aT=Object.keys(Fu),sT=Object.keys(rh);function So(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function vo(e,t){if(e===void 0)return{ok:!1,reason:"not-in-era"};let r=e.safeParse(t);return r.success?{ok:!0,value:r.data}:{ok:!1,reason:"invalid",message:String(r.error)}}var aS={ok:!1,reason:"not-in-era"},sS=[ur,wt];function cS(e,t){let r=t,n=!1,o=()=>(n||(r={...r},n=!0),r),i=t.tools;e==="tools/list"&&Array.isArray(i)&&i.some(c=>So(c)&&"execution"in c)&&(o().tools=i.map(c=>{if(!So(c)||!("execution"in c))return c;let s={...c};return delete s.execution,s}));let a=t.capabilities;if(So(a)&&"tasks"in a){let c={...a};delete c.tasks,o().capabilities=c}return r}var Hu={era:"2026-07-28",hasRequestMethod:nh,hasNotificationMethod:oh,hasInputRequestMethod:e=>Tu(e)!==void 0,validateRequest:(e,t)=>vo(nS(e),t),validateResult:(e,t)=>vo(oS(e),t),validateNotification:(e,t)=>vo(iS(e),t),validateInputRequest:(e,t)=>vo(Tu(e),t),validateInputResponse:(e,t)=>vo(tS(e),t),samplingResultVariant:()=>aS,outboundEnvelope(e){return{[ur]:e.protocolVersion,[qr]:e.clientInfo,[wt]:e.clientCapabilities,...e.logLevel!==void 0&&{[Ut]:e.logLevel}}},validateEnvelopeMeta(e){let t=[];for(let n of sS)n in e||t.push({key:n,problem:"missing"});let r=pr().RequestMetaEnvelopeSchema.safeParse(e);if(!r.success)for(let n of r.error.issues){let o=n.path.map(String),i=o.length>0?o.join("."):"_meta";o.length===1&&t.some(a=>a.key===i&&a.problem==="missing")||t.push({key:i,problem:n.message})}return t},projectCallToolResult:e=>Vf(e),inputRequestSchema:Tu,decodeResult(e,t){if(!So(t))return{kind:"invalid",error:new le(he.InvalidResult,`Invalid result for ${e}: not an object`,{method:e})};let r=t.resultType;if(r===void 0)return{kind:"invalid",error:new le(he.InvalidResult,`Invalid result for ${e}: missing required resultType \u2014 servers implementing protocol revision 2026-07-28 MUST include it (the absent-means-complete bridge applies only to earlier-revision servers)`,{method:e,violation:"missing-resultType"})};if(typeof r!="string")return{kind:"invalid",error:new le(he.InvalidResult,`Invalid result for ${e}: non-string resultType`,{method:e,resultType:r})};if(r==="input_required"){let a=t.inputRequests,c=So(a)?a:{},s=t.requestState;return Object.keys(c).length===0&&typeof s!="string"?{kind:"invalid",error:new le(he.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:c,...typeof s=="string"&&{requestState:s}}}if(r!=="complete")return{kind:"invalid",error:new le(he.UnsupportedResultType,`Unsupported result type '${r}' for ${e}`,{resultType:r,method:e})};let n=uS(),o=Object.hasOwn(n,e)?n[e]:void 0;if(o!==void 0){let a=o.safeParse(t);if(!a.success)return{kind:"invalid",error:new le(he.InvalidResult,`Invalid result for ${e}: ${a.error}`,{method:e})}}let i={...t};return delete i.resultType,{kind:"complete",result:i}},encodeResult(e,t,r){return W_(K_(e,B_(e,cS(e,t))),r)},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=pr().RequestMetaEnvelopeSchema.safeParse(e.envelope);if(!t.success)return`Invalid _meta envelope for protocol revision 2026-07-28: ${t.error.issues.map(r=>r.message).join("; ")}`}},Wa;function uS(){if(Wa)return Wa;let e=pr();return Wa={"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},Wa}var Ju="2026-07-28";function Yr(e){return e!==void 0&&$o(e)?Hu:Uu}function Of(e){return e.revision!==void 0?Yr(e.revision).era:e.era==="modern"?Hu.era:Uu.era}function Eu(e){return ih.some(t=>t.hasRequestMethod(e))}function Iu(e){return ih.some(t=>t.hasNotificationMethod(e))}var ih=[Uu,Hu];var lS=Rl({AnnotationsSchema:()=>Tt,AudioContentSchema:()=>Fr,BaseMetadataSchema:()=>zt,BaseRequestParamsSchema:()=>De,BlobResourceContentsSchema:()=>oo,BooleanSchemaSchema:()=>uo,CallToolRequestParamsSchema:()=>aa,CallToolRequestSchema:()=>sa,CallToolResultSchema:()=>co,CancelTaskRequestSchema:()=>lu,CancelTaskResultSchema:()=>du,CancelledNotificationParamsSchema:()=>ui,CancelledNotificationSchema:()=>Xn,ClientCapabilitiesSchema:()=>pi,ClientNotificationSchema:()=>pu,ClientRequestSchema:()=>mu,ClientResultSchema:()=>fu,ClientTasksCapabilitySchema:()=>di,CompatibilityCallToolResultSchema:()=>Qc,CompleteRequestParamsSchema:()=>xa,CompleteRequestSchema:()=>Ca,CompleteResultSchema:()=>Aa,ContentBlockSchema:()=>Hr,CreateMessageRequestParamsSchema:()=>Sa,CreateMessageRequestSchema:()=>ya,CreateMessageResultSchema:()=>ba,CreateMessageResultWithToolsSchema:()=>$a,CreateTaskResultSchema:()=>ru,CursorSchema:()=>Hn,DiscoverRequestSchema:()=>_i,DiscoverResultSchema:()=>Si,ElicitRequestFormParamsSchema:()=>Kr,ElicitRequestParamsSchema:()=>Ea,ElicitRequestSchema:()=>Ia,ElicitRequestURLParamsSchema:()=>Ta,ElicitResultSchema:()=>Oa,ElicitationCompleteNotificationParamsSchema:()=>Pa,ElicitationCompleteNotificationSchema:()=>ka,EmbeddedResourceSchema:()=>Yi,EmptyResultSchema:()=>Yn,EnumSchemaSchema:()=>wa,GetPromptRequestParamsSchema:()=>Ki,GetPromptRequestSchema:()=>Gi,GetPromptResultSchema:()=>ea,GetTaskPayloadRequestSchema:()=>au,GetTaskPayloadResultSchema:()=>su,GetTaskRequestSchema:()=>ou,GetTaskResultSchema:()=>iu,IconSchema:()=>li,IconsSchema:()=>Dt,ImageContentSchema:()=>Zr,ImplementationSchema:()=>Lr,InitializeRequestParamsSchema:()=>fi,InitializeRequestSchema:()=>hi,InitializeResultSchema:()=>gi,InitializedNotificationSchema:()=>vi,JSONArraySchema:()=>Wc,JSONObjectSchema:()=>ke,JSONRPCErrorResponseSchema:()=>Ur,JSONRPCMessageSchema:()=>Wn,JSONRPCNotificationSchema:()=>Gn,JSONRPCRequestSchema:()=>Kn,JSONRPCResponseSchema:()=>Yc,JSONRPCResultResponseSchema:()=>Mr,JSONValueSchema:()=>Mt,LegacyTitledEnumSchemaSchema:()=>po,ListChangedOptionsBaseSchema:()=>eu,ListPromptsRequestSchema:()=>Ji,ListPromptsResultSchema:()=>Bi,ListResourceTemplatesRequestSchema:()=>Ti,ListResourceTemplatesResultSchema:()=>Ei,ListResourcesRequestSchema:()=>Ri,ListResourcesResultSchema:()=>wi,ListRootsRequestSchema:()=>Ma,ListRootsResultSchema:()=>Ua,ListTasksRequestSchema:()=>cu,ListTasksResultSchema:()=>uu,ListToolsRequestSchema:()=>oa,ListToolsResultSchema:()=>ia,LoggingLevelSchema:()=>Ht,LoggingMessageNotificationParamsSchema:()=>da,LoggingMessageNotificationSchema:()=>ma,ModelHintSchema:()=>pa,ModelPreferencesSchema:()=>fa,MultiSelectEnumSchemaSchema:()=>Ra,NotificationSchema:()=>Ke,NotificationsParamsSchema:()=>Be,NumberSchemaSchema:()=>Br,PaginatedRequestParamsSchema:()=>$i,PaginatedRequestSchema:()=>Vt,PaginatedResultSchema:()=>Zt,PingRequestSchema:()=>eo,PrimitiveSchemaDefinitionSchema:()=>go,ProgressNotificationParamsSchema:()=>bi,ProgressNotificationSchema:()=>to,ProgressSchema:()=>yi,ProgressTokenSchema:()=>Fn,PromptArgumentSchema:()=>Fi,PromptListChangedNotificationSchema:()=>ta,PromptMessageSchema:()=>Qi,PromptReferenceSchema:()=>Na,PromptSchema:()=>Hi,ReadResourceRequestParamsSchema:()=>Ii,ReadResourceRequestSchema:()=>Pi,ReadResourceResultSchema:()=>ki,RelatedTaskMetadataSchema:()=>ci,RequestIdSchema:()=>Lt,RequestMetaSchema:()=>Jn,RequestSchema:()=>Oe,ResourceContentsSchema:()=>ro,ResourceLinkSchema:()=>Xi,ResourceListChangedNotificationSchema:()=>Oi,ResourceRequestParamsSchema:()=>Dr,ResourceSchema:()=>io,ResourceTemplateReferenceSchema:()=>ja,ResourceTemplateSchema:()=>zi,ResourceUpdatedNotificationParamsSchema:()=>Vi,ResourceUpdatedNotificationSchema:()=>Zi,ResultMetaObjectSchema:()=>Bn,ResultSchema:()=>je,RoleSchema:()=>Ft,RootSchema:()=>qa,RootsListChangedNotificationSchema:()=>La,SamplingContentSchema:()=>va,SamplingMessageContentBlockSchema:()=>sr,SamplingMessageSchema:()=>_a,ServerCapabilitiesSchema:()=>Qn,ServerNotificationSchema:()=>gu,ServerRequestSchema:()=>hu,ServerResultSchema:()=>vu,ServerTasksCapabilitySchema:()=>mi,SetLevelRequestParamsSchema:()=>ua,SetLevelRequestSchema:()=>la,SingleSelectEnumSchemaSchema:()=>za,StringSchemaSchema:()=>Jr,SubscribeRequestParamsSchema:()=>ji,SubscribeRequestSchema:()=>Ni,SubscriptionFilterSchema:()=>ao,SubscriptionsAcknowledgedNotificationParamsSchema:()=>Mi,SubscriptionsAcknowledgedNotificationSchema:()=>Ui,SubscriptionsListenRequestParamsSchema:()=>Ai,SubscriptionsListenRequestSchema:()=>qi,SubscriptionsListenResultMetaSchema:()=>Li,SubscriptionsListenResultSchema:()=>Di,TaskAugmentedRequestParamsSchema:()=>dr,TaskCreationParamsSchema:()=>tu,TaskMetadataSchema:()=>si,TaskSchema:()=>Jt,TaskStatusNotificationParamsSchema:()=>Va,TaskStatusNotificationSchema:()=>nu,TaskStatusSchema:()=>Da,TextContentSchema:()=>Vr,TextResourceContentsSchema:()=>no,TitledMultiSelectEnumSchemaSchema:()=>ho,TitledSingleSelectEnumSchemaSchema:()=>mo,ToolAnnotationsSchema:()=>ra,ToolChoiceSchema:()=>ha,ToolExecutionSchema:()=>na,ToolListChangedNotificationSchema:()=>ca,ToolResultContentSchema:()=>ga,ToolSchema:()=>so,ToolUseContentSchema:()=>Wi,UnsubscribeRequestParamsSchema:()=>xi,UnsubscribeRequestSchema:()=>Ci,UntitledMultiSelectEnumSchemaSchema:()=>fo,UntitledSingleSelectEnumSchemaSchema:()=>lo});var Bu=e=>Kn.safeParse(e).success,Ku=e=>Gn.safeParse(e).success,Qa=e=>Mr.safeParse(e).success,Gu=e=>Ur.safeParse(e).success;var fr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&e.resultType==="input_required";var Ya=-32020,cT=[{rung:"http-method",order:1,evaluatedAt:"edge",codes:[-32e3],conformance:[],rationale:"The modern era is POST-only; GET/DELETE are body-less 2025-era session operations and are method-routed to legacy serving (405 when legacy serving is not configured), before any body is read."},{rung:"jsonrpc-shape",order:2,evaluatedAt:"edge",codes:[X.InvalidRequest],conformance:["server-stateless"],rationale:"The body must be a JSON-RPC request or notification: posted responses and batch arrays containing a modern or invalid element are rejected before classification (element-wise batch rule); all-legacy arrays stay legacy traffic."},{rung:"era-classification",order:3,evaluatedAt:"edge",codes:[Ya,X.UnsupportedProtocolVersion],conformance:["server-stateless","http-header-validation","http-custom-header-server-validation"],rationale:"Body-primary era classification with the protocol-version header as a cross-check; a header/body disagreement is rejected with -32020 (HeaderMismatch), and an envelope-less request on a modern-only endpoint is answered with the unsupported-protocol-version error naming the supported revisions."},{rung:"envelope",order:4,evaluatedAt:"edge",codes:[X.InvalidParams],conformance:["server-stateless"],rationale:"A present envelope claim with a malformed envelope \u2014 and a missing envelope on a request whose protocol-version header names a modern revision \u2014 is an invalid-params rejection naming the offending or missing key(s); never a silent fall back to legacy handling. This is the only place an invalid-params rejection maps to HTTP 400."},{rung:"method-registry",order:5,evaluatedAt:"dispatch",codes:[X.MethodNotFound],conformance:["server-stateless"],rationale:"Method existence outranks parameter validity: a method absent from the negotiated revision\u2019s registry (or with no handler installed) answers method-not-found before params or capabilities are looked at."},{rung:"request-params",order:6,evaluatedAt:"dispatch",codes:[X.InvalidParams],conformance:[],rationale:"Per-method params validation; emitted in-band by the dispatch layer (HTTP 200), never via the ladder status table."},{rung:"standard-header-validation",order:7,evaluatedAt:"pre-dispatch",codes:[Ya],conformance:["http-header-validation"],rationale:"SEP-2243 standard `Mcp-Method` / `Mcp-Name` headers \u2014 presence, sentinel decoding, and `Mcp-Name` \u2194 body cross-check \u2014 are validated by the HTTP entry on a modern-classified request after the supported-revision gate and before dispatch. The classifier\u2019s own header-mismatch cells (protocol-version, `Mcp-Method` mismatch) stay on the edge `era-classification` rung; this rung carries the entry-layer presence/`Mcp-Name` half. Evaluated before the capability gate, the factory call, and the `Mcp-Param-*` rung so a request that fails several rungs is answered by the standard-header rung first. The documented order (after method-registry 5 and request-params 6) is NOT the observed precedence: serveModern evaluates this rung immediately after the supported-revision gate, so a request that also fails a dispatch rung is answered here before the dispatch rungs (5\u20136) are consulted."},{rung:"client-capabilities",order:8,evaluatedAt:"pre-dispatch",codes:[X.MissingRequiredClientCapability],conformance:["server-stateless"],rationale:"The capability requirement is checked by the HTTP entry, pre-dispatch, against the validated envelope the classifier produced \u2014 pinning the spec-mandated HTTP 400 independently of how dispatch- and handler-produced errors are mapped. The documented order (after method resolution and params validation) is preserved observably only while the requirement table is empty: once a served method gains a requirement entry, a request that is missing the capability and would also fail a dispatch rung is answered by this gate first, so the entry must consult the method registry before the gate if the documented precedence is to stay observable."},{rung:"param-header-validation",order:9,evaluatedAt:"pre-dispatch",codes:[Ya],conformance:["http-custom-header-server-validation"],rationale:"SEP-2243 `Mcp-Param-*` headers are validated against the named tool\u2019s `x-mcp-header` declarations and the body `arguments` after the tool registry is known and before dispatch reaches the handler; a missing/disagreeing/malformed header is rejected 400 / -32020 with the same shape as the standard-header cross-checks. The documented order (after method resolution and params validation) is preserved observably only when the body `arguments` would otherwise validate: the check runs pre-dispatch, so a `tools/call` that fails BOTH this rung and a dispatch-time rung (e.g. order-6 `request-params`, -32602) is answered by this gate first with 400 / -32020, not by the earlier-ordered rung."}],dS={[X.ParseError]:400,[X.InvalidRequest]:400,[X.MethodNotFound]:404,[X.UnsupportedProtocolVersion]:400,[X.MissingRequiredClientCapability]:400,[Ya]:400};function rs(e,t){return ti(e,t)}function _o(e){return new Set(e.flatMap(t=>Object.keys(t.shape)))}function ju(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 jf=!1,Nu="draft-2020-12";function ah(e,t="input"){let r=e["~standard"],n;if(r.jsonSchema)n=r.jsonSchema[t]({target:Nu});else if(r.vendor==="zod"){if(!("_zod"in e))throw new Error("Schema appears to be from zod 3, which the SDK cannot convert to JSON Schema. Upgrade to zod >=4.2.0, or wrap your JSON Schema with fromJsonSchema().");jf||(jf=!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.")),n=Dn(e,{target:Nu,io:t})}else throw new Error(`Schema library "${r.vendor}" does not implement StandardJSONSchemaV1 (\`~standard.jsonSchema\`). Upgrade to a version that does, or wrap your JSON Schema with fromJsonSchema().`);if(t==="output")return n.type!==void 0?n:sh(n)?{type:"object",...n}:n;if(n.type!==void 0&&n.type!=="object")throw new Error(`MCP tool and prompt schemas must describe objects (got type: ${JSON.stringify(n.type)}). Wrap your schema in z.object({...}) or equivalent.`);return{type:"object",...n}}function sh(e){if("properties"in e||"patternProperties"in e||"additionalProperties"in e||"required"in e)return!0;for(let t of["oneOf","anyOf","allOf"]){let r=e[t];if(Array.isArray(r)&&r.length>0)return r.every(n=>n!==null&&typeof n=="object"&&(n.type==="object"||sh(n)))}return!1}function mS(e){return e.path?.length?`${e.path.map(t=>String(typeof t=="object"?t.key:t)).join(".")}: ${e.message}`:e.message}async function Xa(e,t){let r=await e["~standard"].validate(t);return r.issues&&r.issues.length>0?{success:!1,error:r.issues.map(n=>mS(n)).join(", ")}:{success:!0,data:r.value}}function pS(e){let t=Dn(e,{target:Nu,io:"input"});return typeof t.pattern=="string"?t.pattern:void 0}var fS=/\\\.\\d\{(\d+)\}/;function hS(e){let t=fS.exec(e),r=[void 0,-1,0];return t&&r.push(Number(t[1])),[!1,!0].flatMap(n=>[!1,!0].flatMap(o=>r.map(i=>lt.datetime({local:n,offset:o,precision:i}))))}function gS(e,t){let r;switch(e){case"email":r=[Hc()];break;case"uri":r=[Vn()];break;case"date":r=[lt.date()];break;case"date-time":r=hS(t);break}return new Set(r.map(n=>pS(n)).filter(n=>n!==void 0))}function vS(e,t,r){return r!=="zod"?!0:gS(e,t).has(t)}function bo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function _S(e){try{return ah(e,"input")}catch(t){let r=t instanceof Error?t.message:String(t);throw new ge(X.InvalidParams,`Elicitation requestedSchema must describe an object with flat primitive properties: ${r}`)}}var SS=new Set(["$comment","deprecated","description","examples","readOnly","title","writeOnly"]);function Wu(e){return SS.has(e)||e.startsWith("x-")}var yS=new Set(["$schema",...Object.keys(Kr.shape.requestedSchema.shape)]),Nf={string:_o([Jr,lo,mo,po]),number:_o([Br]),integer:_o([Br]),boolean:_o([uo]),array:_o([fo,ho])},bS=new Set(Jr.shape.format.unwrap().options);function $S(e,t,r,n){if(!bo(e))return e;let o=typeof e.type=="string"&&Object.hasOwn(Nf,e.type)?Nf[e.type]:void 0;if(o===void 0)return e;let i={};for(let[a,c]of Object.entries(e))o.has(a)||Wu(a)?i[a]=c:a==="pattern"&&e.type==="string"&&typeof e.format=="string"?bS.has(e.format)?(typeof c!="string"||!vS(e.format,c,r))&&n.push(`${t}.${a}`):i[a]=c:n.push(`${t}.${a}`);return i}function zS(e,t){let r={},n=[];for(let[o,i]of Object.entries(e))o==="properties"&&bo(i)?r[o]=Object.fromEntries(Object.entries(i).map(([a,c])=>[a,$S(c,`properties.${a}`,t,n)])):yS.has(o)?r[o]=i:Wu(o)||n.push(o);if(n.length>0)throw new ge(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${n.join(", ")}`);return r}function RS(e,t){if(!bo(e.properties))return t;let r=Object.entries(e.properties).filter(([,n])=>!rs(go,n).success).map(([n])=>`properties.${n}`);return r.length>0?r.join(", "):t}function xu(e,t,r=""){return Array.isArray(e)&&Array.isArray(t)?e.flatMap((n,o)=>xu(n,t[o],`${r}[${o}]`)):!bo(e)||!bo(t)?[]:Object.entries(e).flatMap(([n,o])=>{let i=r?`${r}.${n}`:n;return Object.prototype.hasOwnProperty.call(t,n)?xu(o,t[n],i):Wu(n)?[]:[i]})}function wS(e){if(!ju(e.requestedSchema))return{...e,mode:"form",requestedSchema:e.requestedSchema};let t=e.requestedSchema["~standard"].vendor,r=zS(_S(e.requestedSchema),t),n=rs(Kr.shape.requestedSchema,r);if(!n.success)throw new ge(X.InvalidParams,`Elicitation requestedSchema only supports flat primitive properties (string, number, integer, boolean, and string enums): ${RS(r,n.error.message)}`);let o=xu(r,n.data);if(o.length>0)throw new ge(X.InvalidParams,`Elicitation requestedSchema contains unsupported JSON Schema constraint(s) after Standard Schema conversion: ${o.join(", ")}`);let i=(n.data.required??[]).filter(a=>!Object.prototype.hasOwnProperty.call(n.data.properties,a));if(i.length>0)throw new ge(X.InvalidParams,`Elicitation requestedSchema lists required properties that are not defined in properties: ${i.join(", ")}`);return{...e,mode:"form",requestedSchema:n.data}}function TS(e){let t=e.inputRequests!==void 0&&Object.keys(e.inputRequests).length>0,r=typeof e.requestState=="string";if(!t&&!r)throw new TypeError("inputRequired() requires at least one of inputRequests (with at least one entry) or requestState (spec: every InputRequiredResult MUST include at least one of the two)");return{resultType:"input_required",...e.inputRequests!==void 0&&{inputRequests:e.inputRequests},...e.requestState!==void 0&&{requestState:e.requestState}}}var ES=Object.assign(TS,{elicit(e){try{return{method:"elicitation/create",params:wS(e)}}catch(t){throw t instanceof ge?new TypeError(t.message,{cause:t}):t}},elicitUrl(e){return{method:"elicitation/create",params:{...e,mode:"url"}}},createMessage(e){return{method:"sampling/createMessage",params:e}},listRoots(){return{method:"roots/list"}}});var ch=250;function uh(e,t){return`Multi-round-trip request '${e}' still required input after ${t} rounds (inputRequired.maxRounds)`}function lh(e,t){return new Promise((r,n)=>{if(t?.aborted){n(t.reason instanceof le?t.reason:new le(he.RequestTimeout,String(t.reason)));return}let o=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e),i=()=>{clearTimeout(o),n(t?.reason instanceof le?t.reason:new le(he.RequestTimeout,String(t?.reason)))};t?.addEventListener("abort",i,{once:!0})})}function dh(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.addEventListener("abort",r,{once:!0}),e?.aborted&&t.abort(e.reason),{signal:t.signal,abort:n=>t.abort(n),dispose:()=>e?.removeEventListener("abort",r)}}var IS=["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"],PS={IdJagTokenExchangeResponseSchema:bu,OAuthClientInformationFullSchema:zu,OAuthClientInformationSchema:Ja,OAuthClientMetadataSchema:Ha,OAuthClientRegistrationErrorSchema:Ru,OAuthErrorResponseSchema:$u,OAuthMetadataSchema:Za,OAuthProtectedResourceMetadataSchema:_u,OAuthTokenRevocationRequestSchema:wu,OAuthTokensSchema:yu,OpenIdProviderDiscoveryMetadataSchema:Su,OpenIdProviderMetadataSchema:Fa},mh={},ph={};function fh(e,t){let r=e.slice(0,-6);mh[r]=t,ph[r]=n=>t.safeParse(n).success}for(let e of IS)fh(e,lS[e]);for(let[e,t]of Object.entries(PS))fh(e,t);var kS=Object.freeze(mh),OS=Object.freeze(ph);function jS(e){switch(e){case"initialize":case"notifications/initialized":return Yr(void 0);case"server/discover":return Yr(Ju);default:return}}var hh=6e4,NS=[ur,qr,wt,Ut],xS=["inputResponses","requestState"];function xf(e,t){let r=e.params;if(!yo(r))return{message:e,lifted:{}};let n=r._meta,o=yo(n)?NS.filter(s=>s in n):[],i=t==="request"?xS.filter(s=>s in r):[];if(o.length===0&&i.length===0)return{message:e,lifted:{}};let a={},c={...r};if(o.length>0&&yo(n)){let s={},l={...n};for(let m of o)s[m]=n[m],delete l[m];a.envelope=s,Object.keys(l).length>0?c._meta=l:delete c._meta}for(let s of i)s==="inputResponses"&&(a.inputResponses=c[s]),s==="requestState"&&(a.requestState=c[s]),delete c[s];return{message:{...e,params:c},lifted:a}}function Cf(e,t){let r=e.validateResult(t,void 0);if(!(!r.ok&&r.reason==="not-in-era"))return{"~standard":{version:1,vendor:"mcp-wire-codec",validate(n){let o=e.validateResult(t,n);return o.ok?{value:o.value}:{issues:[{message:o.reason==="invalid"?o.message:`not-in-era: ${t}`}]}}}}}function zo(e){return()=>e}var CS=zo(void 0);function Yu(e,t){return{...e,mcpReq:{...e.mcpReq,requestState:zo(t)}}}var AS;var Xu=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;static{AS=(e,t)=>{e._negotiatedProtocolVersion=t}}_supportedProtocolVersions;onclose;onerror;fallbackRequestHandler;fallbackNotificationHandler;constructor(e){this._options=e,this._supportedProtocolVersions=e?.supportedProtocolVersions??ii,this.setNotificationHandler("notifications/cancelled",t=>{this._oncancel(t)}),this.setNotificationHandler("notifications/progress",t=>{this._onprogress(t)}),this.setRequestHandler("ping",t=>({}))}_shouldDropInbound(e){}_outboundMetaEnvelope(){}_envelopeOutbound(e){let t=this._outboundMetaEnvelope();if(t===void 0)return e;let r=e.params??{};return{...e,params:{...r,_meta:{...t,...r._meta}}}}_resolveNonCompleteResult(e,t){return Promise.reject(new le(he.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,r,n,o=!1){this._timeoutInfo.set(e,{timeoutId:setTimeout(n,t),startTime:Date.now(),timeout:t,maxTotalTimeout:r,resetTimeoutOnProgress:o,onTimeout:n})}_resetTimeout(e){let t=this._timeoutInfo.get(e);if(!t)return!1;let r=Date.now()-t.startTime;if(t.maxTotalTimeout&&r>=t.maxTotalTimeout)throw this._timeoutInfo.delete(e),new le(he.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:t.maxTotalTimeout,totalElapsed:r});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 r=this.transport?.onerror;this._transport.onerror=o=>{r?.(o),this._onerror(o)};let n=this._transport?.onmessage;this._transport.onmessage=(o,i)=>{n?.(o,i),Qa(o)||Gu(o)?this._onresponse(o):Bu(o)?this._onrequest(o,i):Ku(o)?this._onnotification(o,i):this._onerror(new Error(`Unknown message type: ${JSON.stringify(o)}`))},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 n of this._timeoutInfo.values())clearTimeout(n.timeoutId);this._timeoutInfo.clear();let t=this._requestHandlerAbortControllers;this._requestHandlerAbortControllers=new Map;let r=new le(he.ConnectionClosed,"Connection closed");this._transport=void 0;try{this.onclose?.()}finally{for(let n of e.values())n(r);for(let n of t.values())n.abort(r)}}_onerror(e){this.onerror?.(e)}_onnotification(e,t){let{message:r}=xf(e,"notification"),n=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop")return;if(t?.classification!==void 0){let a=Of(t.classification);if(a!==n.era){this._onerror(new Error(`Era mismatch on inbound notification '${r.method}': classified as ${a} but this instance serves ${n.era}`));return}}if(Iu(r.method)&&!n.hasNotificationMethod(r.method))return;let o=this._notificationHandlers.get(r.method),i=this.fallbackNotificationHandler;o===void 0&&i===void 0||Promise.resolve().then(()=>o===void 0?i(r):o(r,n)).catch(a=>this._onerror(new Error(`Uncaught error in notification handler: ${a}`)))}_onrequest(e,t){let{message:r,lifted:n}=xf(e,"request"),o=this._negotiatedWireCodec();if(t?.classification===void 0&&this._shouldDropInbound(e)==="drop"){this._onerror(new Error(`Dropped inbound request '${e.method}': not servable on this connection's protocol era`));return}let i=this._transport,a=(b,g,d)=>{let _={jsonrpc:"2.0",id:r.id,error:{code:b,message:g,...d!==void 0&&{data:d}}};i?.send(_).catch(p=>this._onerror(new Error(`Failed to send an error response: ${p}`)))};if(t?.classification!==void 0){let b=Of(t.classification);if(b!==o.era){this._onerror(new Error(`Era mismatch on inbound request '${r.method}': classified as ${b} but this instance serves ${o.era}`));let g=t.classification.revision??b;a(X.UnsupportedProtocolVersion,`Unsupported protocol version: ${g}`,{supported:this._supportedProtocolVersions,requested:g});return}}if(Eu(r.method)&&!o.hasRequestMethod(r.method)){a(X.MethodNotFound,"Method not found");return}let c=this._requestHandlers.get(r.method)??this.fallbackRequestHandler;if(c===void 0){a(X.MethodNotFound,"Method not found");return}let s=o.checkInboundEnvelope(n);if(s!==void 0){a(X.InvalidParams,s);return}let l=(b,g)=>this._notificationViaCodec(this._resolveOutboundCodec(b.method),b,{...g,relatedRequestId:r.id}),m=(b,g,d)=>this._requestWithSchemaViaCodec(this._resolveOutboundCodec(b.method),b,g,{...d,relatedRequestId:r.id}),h=new AbortController;this._requestHandlerAbortControllers.set(r.id,h);let z=n.inputResponses===void 0?void 0:qS(n.inputResponses),R={sessionId:i?.sessionId,mcpReq:{id:r.id,method:r.method,_meta:r.params?._meta,...n.envelope!==void 0&&{envelope:n.envelope},...z!==void 0&&{inputResponses:z.accepted},...z!==void 0&&z.droppedKeys.length>0&&{droppedInputResponseKeys:z.droppedKeys},requestState:n.requestState===void 0?CS:zo(n.requestState),signal:h.signal,send:((b,g,d)=>{let _=this._resolveOutboundCodec(b.method);if(this._assertOutboundRequestInEra(_,b.method),ju(g))return m(b,g,d);let p=Cf(_,b.method);if(p===void 0)throw new TypeError(`'${b.method}' is not a spec method; pass a result schema as the second argument to ctx.mcpReq.send().`);return m(b,p,g)}),notify:l},http:t?.authInfo?{authInfo:t.authInfo}:void 0},v=this.buildContext(R,t);Promise.resolve().then(()=>c(r,v)).then(async b=>{if(h.signal.aborted)return;let g;try{g=o.encodeResult(r.method,b,this._outboundServerInfo())}catch(_){this._onerror(new Error(`Failed to encode result for ${r.method}: ${_}`)),a(X.InternalError,"Internal error");return}let d={result:g,jsonrpc:"2.0",id:r.id};await i?.send(d)},async b=>{if(h.signal.aborted)return;let g=Number.isSafeInteger(b.code)?b.code:X.InternalError,d={jsonrpc:"2.0",id:r.id,error:{code:o.encodeErrorCode(g),message:b.message??"Internal error",...b.data!==void 0&&{data:b.data}}};await i?.send(d)}).catch(b=>this._onerror(new Error(`Failed to send response: ${b}`))).finally(()=>{this._requestHandlerAbortControllers.get(r.id)===h&&this._requestHandlerAbortControllers.delete(r.id)})}_onprogress(e){let{progressToken:t,...r}=e.params,n=Number(t),o=this._progressHandlers.get(n);if(!o){this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(e)}`));return}let i=this._responseHandlers.get(n),a=this._timeoutInfo.get(n);if(a&&i&&a.resetTimeoutOnProgress)try{this._resetTimeout(n)}catch(c){this._responseHandlers.delete(n),this._progressHandlers.delete(n),this._cleanupTimeout(n),i(c);return}o(r)}_onresponse(e){let t=Number(e.id),r=this._responseHandlers.get(t);if(r===void 0){this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(e)}`));return}this._responseHandlers.delete(t),this._cleanupTimeout(t),this._progressHandlers.delete(t),Qa(e)?r(e):r(ge.fromError(e.error.code,e.error.message,e.error.data))}get transport(){return this._transport}async close(){await this._transport?.close()}request(e,t,r){let n=this._resolveOutboundCodec(e.method);if(this._assertOutboundRequestInEra(n,e.method),ju(t))return this._requestWithSchemaViaCodec(n,e,t,r);let o=Cf(n,e.method);if(o===void 0)throw new TypeError(`'${e.method}' is not a spec method; pass a result schema as the second argument to request().`);return this._requestWithSchemaViaCodec(n,e,o,t)}_negotiatedWireCodec(){return Yr(this._negotiatedProtocolVersion)}_wireCodec(){return this._negotiatedWireCodec()}_resolveOutboundCodec(e){if(this._negotiatedProtocolVersion===void 0){let t=jS(e);if(t)return t}return this._negotiatedWireCodec()}_assertOutboundRequestInEra(e,t){if(Eu(t)&&!e.hasRequestMethod(t))throw new le(he.MethodNotSupportedByProtocolVersion,`Method '${t}' is not supported by the negotiated protocol version (wire era ${e.era})`,{method:t,era:e.era})}_requestWithSchema(e,t,r){let n=this._resolveOutboundCodec(e.method);return this._assertOutboundRequestInEra(n,e.method),this._requestWithSchemaViaCodec(n,e,t,r)}_requestWithSchemaViaCodec(e,t,r,n){let{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,headers:c}=n??{},s=Date.now(),l,m;return new Promise((h,z)=>{let R=y=>{z(y)};if(!this._transport){R(new Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{this.assertCapabilityForMethod(t.method)}catch(y){R(y);return}if(n?.signal?.aborted){let y=n.signal.reason;throw y instanceof le?y:new le(he.RequestTimeout,String(y))}let v=e.era===Ju&&this._transport.hasPerRequestStream===!0?new AbortController:void 0,b=this._requestMessageId++;m=b;let g={...t,jsonrpc:"2.0",id:b};n?.onprogress&&(this._progressHandlers.set(b,n.onprogress),g.params={...t.params,_meta:{...t.params?._meta,progressToken:b}});let d=this._envelopeOutbound(g),_=!1,p=y=>{_||(this._progressHandlers.delete(b),v===void 0?this._transport?.send(this._envelopeOutbound({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:b,reason:String(y)}}),{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a}).catch(f=>this._onerror(new Error(`Failed to send cancellation: ${f}`))):v.abort(),z(y instanceof le?y:new le(he.RequestTimeout,String(y))))};this._responseHandlers.set(b,y=>{if(n?.signal?.aborted)return;if(_=!0,y instanceof Error)return z(y);let f;try{f=e.decodeResult(t.method,y.result)}catch(A){return z(A instanceof Error?A:new Error(String(A)))}if(f.kind==="invalid")return z(f.error);if(f.kind==="input_required"){if(n?.allowInputRequired===!0)return h(MS(f));let A={codec:e,request:t,resultSchema:r,options:n,flowStartedAt:s,retry:(F,M)=>this._requestWithSchemaViaCodec(e,F===void 0?{method:t.method}:{method:t.method,params:F},r,M)};return h(this._resolveNonCompleteResult(f,A))}let T=f.result;Xa(r,T).then(A=>{A.success?h(A.data):z(new le(he.InvalidResult,`Invalid result for ${t.method}: ${A.error}`))},z)}),l=()=>p(n?.signal?.reason),n?.signal?.addEventListener("abort",l,{once:!0});let S=n?.timeout??hh,w=()=>p(new le(he.RequestTimeout,"Request timed out",{timeout:S}));this._setupTimeout(b,S,n?.maxTotalTimeout,w,n?.resetTimeoutOnProgress??!1),this._transport.send(d,{relatedRequestId:o,resumptionToken:i,onresumptiontoken:a,headers:c,requestSignal:v?.signal}).catch(y=>{this._progressHandlers.delete(b),z(y)})}).finally(()=>{l&&n?.signal?.removeEventListener("abort",l),m!==void 0&&(this._responseHandlers.delete(m),this._cleanupTimeout(m))})}async notification(e,t){return this._notificationViaCodec(this._resolveOutboundCodec(e.method),e,t)}async _notificationViaCodec(e,t,r){if(!this._transport)throw new le(he.NotConnected,"Not connected");if(Iu(t.method)&&!e.hasNotificationMethod(t.method))throw new le(he.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 n=this._envelopeOutbound({jsonrpc:"2.0",...t});if((this._options?.debouncedNotificationMethods??[]).includes(t.method)&&!t.params&&!r?.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(n,r).catch(o=>this._onerror(o))});return}await this._transport.send(n,r)}setRequestHandler(e,t,r){this.assertRequestHandlerCapability(e);let n;if(typeof t=="function"){if(!Eu(e))throw new TypeError(`'${e}' is not a spec request method; pass schemas as the second argument to setRequestHandler().`);n=(o,i)=>{let a=this._negotiatedWireCodec(),c=a.validateRequest(e,o);if(!c.ok&&c.reason==="not-in-era"&&(c=a.validateInputRequest(e,o)),!c.ok)throw c.reason==="not-in-era"?new ge(X.InternalError,`No wire schema for ${e} in the resolved era`):new Error(c.message);return Promise.resolve(t(c.value,i))}}else if(r)n=async(o,i)=>{let a=await Xa(t.params,{...o.params});if(!a.success)throw new ge(X.InvalidParams,`Invalid params for ${e}: ${a.error}`);return r(a.data,i)};else throw new TypeError("setRequestHandler: handler is required");this._requestHandlers.set(e,this._wrapHandler(e,n))}_wrapHandler(e,t){return t}_outboundServerInfo(){}removeRequestHandler(e){this._requestHandlers.delete(e)}assertCanSetRequestHandler(e){if(this._requestHandlers.has(e))throw new Error(`A request handler for ${e} already exists, which would be overridden`)}setNotificationHandler(e,t,r){if(typeof t=="function"){if(!Iu(e))throw new TypeError(`'${e}' is not a spec notification method; pass schemas as the second argument to setNotificationHandler().`);this._notificationHandlers.set(e,(n,o)=>{let i=o.validateNotification(e,n);if(!i.ok)throw i.reason==="not-in-era"?new ge(X.InternalError,`No wire schema for ${e} in the resolved era`):new Error(i.message);return Promise.resolve(t(i.value))});return}if(!r)throw new TypeError("setNotificationHandler: handler is required");this._notificationHandlers.set(e,async n=>{let o=await Xa(t.params,{...n.params});if(!o.success)throw new ge(X.InvalidParams,`Invalid params for notification ${e}: ${o.error}`);await r(o.data,n)})}removeNotificationHandler(e){this._notificationHandlers.delete(e)}};function yo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Qu(e,t){let r={...e};for(let n in t){let o=n,i=t[o];if(i===void 0)continue;let a=r[o];r[o]=yo(a)&&yo(i)?{...a,...i}:i}return r}function Af(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function qS(e){let t={},r=[];if(!Af(e))return{accepted:t,droppedKeys:r};for(let[n,o]of Object.entries(e)){if(!Af(o)||"method"in o||"result"in o){r.push(n);continue}t[n]=o}return{accepted:t,droppedKeys:r}}function MS(e){return{resultType:"input_required",inputRequests:e.inputRequests,...e.requestState!==void 0&&{requestState:e.requestState}}}var US=L((e=>{var t=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,r=/\\([\u000b\u0020-\u00ff])/g,n=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;e.parse=o;function o(c){if(!c)throw new TypeError("argument string is required");var s=typeof c=="object"?i(c):c;if(typeof s!="string")throw new TypeError("argument string is required to be a string");var l=s.indexOf(";"),m=l!==-1?s.slice(0,l).trim():s.trim();if(!n.test(m))throw new TypeError("invalid media type");var h=new a(m.toLowerCase());if(l!==-1){var z,R,v;for(t.lastIndex=l;R=t.exec(s);){if(R.index!==l)throw new TypeError("invalid parameter format");l+=R[0].length,z=R[1].toLowerCase(),v=R[2],v.charCodeAt(0)===34&&(v=v.slice(1,-1),v.indexOf("\\")!==-1&&(v=v.replace(r,"$1"))),h.parameters[z]=v}if(l!==s.length)throw new TypeError("invalid parameter format")}return h}function i(c){var s;if(typeof c.getHeader=="function"?s=c.getHeader("content-type"):typeof c.headers=="object"&&(s=c.headers&&c.headers["content-type"]),typeof s!="string")throw new TypeError("content-type header is missing from object");return s}function a(c){this.parameters=Object.create(null),this.type=c}})),uT=Fo(US(),1);var gh=10*1024*1024,el=class{_buffer;_maxBufferSize;constructor(e){this._maxBufferSize=e?.maxBufferSize??gh}append(e){if((this._buffer?.length??0)+e.length>this._maxBufferSize)throw this.clear(),new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,e]):e}readMessage(){for(;this._buffer;){let e=this._buffer.indexOf(` `);if(e===-1)return null;let t=this._buffer.toString("utf8",0,e).replace(/\r$/,"");this._buffer=this._buffer.subarray(e+1);try{return vh(t)}catch(r){if(r instanceof SyntaxError)continue;throw r}}return null}clear(){this._buffer=void 0}};function vh(e){return Wn.parse(JSON.parse(e))}function tl(e){return JSON.stringify(e)+` `}var qf=1e6,Pu=1e6,Mf=1e4,LS=1e6,ns=class mr{static isTemplate(t){return/\{[^}\s]+\}/.test(t)}static validateLength(t,r,n){if(t.length>r)throw new Error(`${n} exceeds maximum length of ${r} characters (got ${t.length})`)}template;parts;get variableNames(){return this.parts.flatMap(t=>typeof t=="string"?[]:t.names)}constructor(t){mr.validateLength(t,qf,"Template"),this.template=t,this.parts=this.parse(t)}toString(){return this.template}parse(t){let r=[],n="",o=0,i=0;for(;oMf)throw new Error(`Template contains too many expressions (max ${Mf})`);let c=t.slice(o+1,a),s=this.getOperator(c),l=c.includes("*"),m=this.getNames(c),h=m[0];for(let z of m)mr.validateLength(z,Pu,"Variable name");r.push({name:h,operator:s,names:m,exploded:l}),o=a+1}else n+=t[o],o++;return n&&r.push(n),r}getOperator(t){return["+","#",".","/","?","&"].find(r=>t.startsWith(r))||""}getNames(t){let r=this.getOperator(t);return t.slice(r.length).split(",").map(n=>n.replace("*","").trim()).filter(n=>n.length>0)}encodeValue(t,r){return mr.validateLength(t,Pu,"Variable value"),r==="+"||r==="#"?encodeURI(t):encodeURIComponent(t)}expandPart(t,r){if(t.operator==="?"||t.operator==="&"){let i=t.names.map(a=>{let c=r[a];return c===void 0?"":`${a}=${Array.isArray(c)?c.map(s=>this.encodeValue(s,t.operator)).join(","):this.encodeValue(c.toString(),t.operator)}`}).filter(a=>a.length>0);return i.length===0?"":(t.operator==="?"?"?":"&")+i.join("&")}if(t.names.length>1){let i=t.names.map(a=>r[a]).filter(a=>a!==void 0);return i.length===0?"":i.map(a=>Array.isArray(a)?a[0]:a).join(",")}let n=r[t.name];if(n===void 0)return"";let o=(Array.isArray(n)?n:[n]).map(i=>this.encodeValue(i,t.operator));switch(t.operator){case"":return o.join(",");case"+":return o.join(",");case"#":return"#"+o.join(",");case".":return"."+o.join(".");case"/":return"/"+o.join("/");default:return o.join(",")}}expand(t){let r="",n=!1;for(let o of this.parts){if(typeof o=="string"){r+=o;continue}let i=this.expandPart(o,t);i&&(r+=(o.operator==="?"||o.operator==="&")&&n?i.replace("?","&"):i,(o.operator==="?"||o.operator==="&")&&(n=!0))}return r}escapeRegExp(t){return t.replaceAll(/[.*+?^${}()|[\]\\]/g,String.raw`\$&`)}partToRegExp(t){let r=[];for(let i of t.names)mr.validateLength(i,Pu,"Variable name");if(t.operator==="?"||t.operator==="&"){for(let i=0;i{Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;var t=class{};e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var r=class extends t{constructor(d){if(super(),!e.IDENTIFIER.test(d))throw new Error("CodeGen: name must be a valid identifier");this.str=d}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};e.Name=r;var n=class extends t{constructor(d){super(),this._items=typeof d=="string"?[d]:d}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let d=this._items[0];return d===""||d==='""'}get str(){var d;return(d=this._str)!==null&&d!==void 0?d:this._str=this._items.reduce((_,p)=>`${_}${p}`,"")}get names(){var d;return(d=this._names)!==null&&d!==void 0?d:this._names=this._items.reduce((_,p)=>(p instanceof r&&(_[p.str]=(_[p.str]||0)+1),_),{})}};e._Code=n,e.nil=new n("");function o(d,..._){let p=[d[0]],S=0;for(;S<_.length;)c(p,_[S]),p.push(d[++S]);return new n(p)}e._=o;let i=new n("+");function a(d,..._){let p=[R(d[0])],S=0;for(;S<_.length;)p.push(i),c(p,_[S]),p.push(i,R(d[++S]));return s(p),new n(p)}e.str=a;function c(d,_){_ instanceof n?d.push(..._._items):_ instanceof r?d.push(_):d.push(h(_))}e.addCodeArg=c;function s(d){let _=1;for(;_{Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;let t=is();var r=class extends Error{constructor(s){super(`CodeGen: "code" for ${s} not defined`),this.value=s.value}},n;(function(s){s[s.Started=0]="Started",s[s.Completed=1]="Completed"})(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};var o=class{constructor({prefixes:s,parent:l}={}){this._names={},this._prefixes=s,this._parent=l}toName(s){return s instanceof t.Name?s:this.name(s)}name(s){return new t.Name(this._newName(s))}_newName(s){let l=this._names[s]||this._nameGroup(s);return`${s}${l.index++}`}_nameGroup(s){var l,m;if(!((m=(l=this._parent)===null||l===void 0?void 0:l._prefixes)===null||m===void 0)&&m.has(s)||this._prefixes&&!this._prefixes.has(s))throw new Error(`CodeGen: prefix "${s}" is not allowed in this scope`);return this._names[s]={prefix:s,index:0}}};e.Scope=o;var i=class extends t.Name{constructor(s,l){super(l),this.prefix=s}setValue(s,{property:l,itemIndex:m}){this.value=s,this.scopePath=(0,t._)`.${new t.Name(l)}[${m}]`}};e.ValueScopeName=i;let a=(0,t._)`\n`;var c=class extends o{constructor(s){super(s),this._values={},this._scope=s.scope,this.opts={...s,_n:s.lines?a:t.nil}}get(){return this._scope}name(s){return new i(s,this._newName(s))}value(s,l){var m;if(l.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let h=this.toName(s),{prefix:z}=h,R=(m=l.key)!==null&&m!==void 0?m:l.ref,v=this._values[z];if(v){let d=v.get(R);if(d)return d}else v=this._values[z]=new Map;v.set(R,h);let b=this._scope[z]||(this._scope[z]=[]),g=b.length;return b[g]=l.ref,h.setValue(l,{property:z,itemIndex:g}),h}getValue(s,l){let m=this._values[s];if(m)return m.get(l)}scopeRefs(s,l=this._values){return this._reduceValues(l,m=>{if(m.scopePath===void 0)throw new Error(`CodeGen: name "${m}" has no value`);return(0,t._)`${s}${m.scopePath}`})}scopeCode(s=this._values,l,m){return this._reduceValues(s,h=>{if(h.value===void 0)throw new Error(`CodeGen: name "${h}" has no value`);return h.value.code},l,m)}_reduceValues(s,l,m={},h){let z=t.nil;for(let R in s){let v=s[R];if(!v)continue;let b=m[R]=m[R]||new Map;v.forEach(g=>{if(b.has(g))return;b.set(g,n.Started);let d=l(g);if(d){let _=this.opts.es5?e.varKinds.var:e.varKinds.const;z=(0,t._)`${z}${_} ${g} = ${d};${this.opts._n}`}else if(d=h?.(g))z=(0,t._)`${z}${d}${this.opts._n}`;else throw new r(g);b.set(g,n.Completed)})}return z}};e.ValueScope=c})),de=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;let t=is(),r=_h();var n=is();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=_h();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};var i=class{optimizeNodes(){return this}optimizeNames($,P){return this}},a=class extends i{constructor($,P,N){super(),this.varKind=$,this.name=P,this.rhs=N}render({es5:$,_n:P}){let N=$?r.varKinds.var:this.varKind,H=this.rhs===void 0?"":` = ${this.rhs}`;return`${N} ${this.name}${H};`+P}optimizeNames($,P){if($[this.name.str])return this.rhs&&(this.rhs=K(this.rhs,$,P)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}},c=class extends i{constructor($,P,N){super(),this.lhs=$,this.rhs=P,this.sideEffects=N}render({_n:$}){return`${this.lhs} = ${this.rhs};`+$}optimizeNames($,P){if(!(this.lhs instanceof t.Name&&!$[this.lhs.str]&&!this.sideEffects))return this.rhs=K(this.rhs,$,P),this}get names(){return Y(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}},s=class extends c{constructor($,P,N,H){super($,N,H),this.op=P}render({_n:$}){return`${this.lhs} ${this.op}= ${this.rhs};`+$}},l=class extends i{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`${this.label}:`+$}},m=class extends i{constructor($){super(),this.label=$,this.names={}}render({_n:$}){return`break${this.label?` ${this.label}`:""};`+$}},h=class extends i{constructor($){super(),this.error=$}render({_n:$}){return`throw ${this.error};`+$}get names(){return this.error.names}},z=class extends i{constructor($){super(),this.code=$}render({_n:$}){return`${this.code};`+$}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames($,P){return this.code=K(this.code,$,P),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}},R=class extends i{constructor($=[]){super(),this.nodes=$}render($){return this.nodes.reduce((P,N)=>P+N.render($),"")}optimizeNodes(){let{nodes:$}=this,P=$.length;for(;P--;){let N=$[P].optimizeNodes();Array.isArray(N)?$.splice(P,1,...N):N?$[P]=N:$.splice(P,1)}return $.length>0?this:void 0}optimizeNames($,P){let{nodes:N}=this,H=N.length;for(;H--;){let te=N[H];te.optimizeNames($,P)||(fe($,te.names),N.splice(H,1))}return N.length>0?this:void 0}get names(){return this.nodes.reduce(($,P)=>D($,P.names),{})}},v=class extends R{render($){return"{"+$._n+super.render($)+"}"+$._n}},b=class extends R{},g=class extends v{};g.kind="else";var d=class os extends v{constructor(P,N){super(N),this.condition=P}render(P){let N=`if(${this.condition})`+super.render(P);return this.else&&(N+="else "+this.else.render(P)),N}optimizeNodes(){super.optimizeNodes();let P=this.condition;if(P===!0)return this.nodes;let N=this.else;if(N){let H=N.optimizeNodes();N=this.else=Array.isArray(H)?new g(H):H}if(N)return P===!1?N instanceof os?N:N.nodes:this.nodes.length?this:new os(Te(P),N instanceof os?[N]:N.nodes);if(!(P===!1||!this.nodes.length))return this}optimizeNames(P,N){var H;if(this.else=(H=this.else)===null||H===void 0?void 0:H.optimizeNames(P,N),!!(super.optimizeNames(P,N)||this.else))return this.condition=K(this.condition,P,N),this}get names(){let P=super.names;return Y(P,this.condition),this.else&&D(P,this.else.names),P}};d.kind="if";var _=class extends v{};_.kind="for";var p=class extends _{constructor($){super(),this.iteration=$}render($){return`for(${this.iteration})`+super.render($)}optimizeNames($,P){if(super.optimizeNames($,P))return this.iteration=K(this.iteration,$,P),this}get names(){return D(super.names,this.iteration.names)}},S=class extends _{constructor($,P,N,H){super(),this.varKind=$,this.name=P,this.from=N,this.to=H}render($){let P=$.es5?r.varKinds.var:this.varKind,{name:N,from:H,to:te}=this;return`for(${P} ${N}=${H}; ${N}<${te}; ${N}++)`+super.render($)}get names(){return Y(Y(super.names,this.from),this.to)}},w=class extends _{constructor($,P,N,H){super(),this.loop=$,this.varKind=P,this.name=N,this.iterable=H}render($){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render($)}optimizeNames($,P){if(super.optimizeNames($,P))return this.iterable=K(this.iterable,$,P),this}get names(){return D(super.names,this.iterable.names)}},y=class extends v{constructor($,P,N){super(),this.name=$,this.args=P,this.async=N}render($){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render($)}};y.kind="func";var f=class extends R{render($){return"return "+super.render($)}};f.kind="return";var T=class extends v{render($){let P="try"+super.render($);return this.catch&&(P+=this.catch.render($)),this.finally&&(P+=this.finally.render($)),P}optimizeNodes(){var $,P;return super.optimizeNodes(),($=this.catch)===null||$===void 0||$.optimizeNodes(),(P=this.finally)===null||P===void 0||P.optimizeNodes(),this}optimizeNames($,P){var N,H;return super.optimizeNames($,P),(N=this.catch)===null||N===void 0||N.optimizeNames($,P),(H=this.finally)===null||H===void 0||H.optimizeNames($,P),this}get names(){let $=super.names;return this.catch&&D($,this.catch.names),this.finally&&D($,this.finally.names),$}},A=class extends v{constructor($){super(),this.error=$}render($){return`catch(${this.error})`+super.render($)}};A.kind="catch";var F=class extends v{render($){return"finally"+super.render($)}};F.kind="finally";var M=class{constructor($,P={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...P,_n:P.lines?` `:""},this._extScope=$,this._scope=new r.Scope({parent:$}),this._nodes=[new b]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,P){let N=this._extScope.value($,P);return(this._values[N.prefix]||(this._values[N.prefix]=new Set)).add(N),N}getScopeValue($,P){return this._extScope.getValue($,P)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,P,N,H){let te=this._scope.toName(P);return N!==void 0&&H&&(this._constants[te.str]=N),this._leafNode(new a($,te,N)),te}const($,P,N){return this._def(r.varKinds.const,$,P,N)}let($,P,N){return this._def(r.varKinds.let,$,P,N)}var($,P,N){return this._def(r.varKinds.var,$,P,N)}assign($,P,N){return this._leafNode(new c($,P,N))}add($,P){return this._leafNode(new s($,e.operators.ADD,P))}code($){return typeof $=="function"?$():$!==t.nil&&this._leafNode(new z($)),this}object(...$){let P=["{"];for(let[N,H]of $)P.length>1&&P.push(","),P.push(N),(N!==H||this.opts.es5)&&(P.push(":"),(0,t.addCodeArg)(P,H));return P.push("}"),new t._Code(P)}if($,P,N){if(this._blockNode(new d($)),P&&N)this.code(P).else().code(N).endIf();else if(P)this.code(P).endIf();else if(N)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new d($))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(d,g)}_for($,P){return this._blockNode($),P&&this.code(P).endFor(),this}for($,P){return this._for(new p($),P)}forRange($,P,N,H,te=this.opts.es5?r.varKinds.var:r.varKinds.let){let pe=this._scope.toName($);return this._for(new S(te,pe,P,N),()=>H(pe))}forOf($,P,N,H=r.varKinds.const){let te=this._scope.toName($);if(this.opts.es5){let pe=P instanceof t.Name?P:this.var("_arr",P);return this.forRange("_i",0,(0,t._)`${pe}.length`,ae=>{this.var(te,(0,t._)`${pe}[${ae}]`),N(te)})}return this._for(new w("of",H,te,P),()=>N(te))}forIn($,P,N,H=this.opts.es5?r.varKinds.var:r.varKinds.const){if(this.opts.ownProperties)return this.forOf($,(0,t._)`Object.keys(${P})`,N);let te=this._scope.toName($);return this._for(new w("in",H,te,P),()=>N(te))}endFor(){return this._endBlockNode(_)}label($){return this._leafNode(new l($))}break($){return this._leafNode(new m($))}return($){let P=new f;if(this._blockNode(P),this.code($),P.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(f)}try($,P,N){if(!P&&!N)throw new Error('CodeGen: "try" without "catch" and "finally"');let H=new T;if(this._blockNode(H),this.code($),P){let te=this.name("e");this._currNode=H.catch=new A(te),P(te)}return N&&(this._currNode=H.finally=new F,this.code(N)),this._endBlockNode(A,F)}throw($){return this._leafNode(new h($))}block($,P){return this._blockStarts.push(this._nodes.length),$&&this.code($).endBlock(P),this}endBlock($){let P=this._blockStarts.pop();if(P===void 0)throw new Error("CodeGen: not in self-balancing block");let N=this._nodes.length-P;if(N<0||$!==void 0&&N!==$)throw new Error(`CodeGen: wrong number of nodes: ${N} vs ${$} expected`);return this._nodes.length=P,this}func($,P=t.nil,N,H){return this._blockNode(new y($,P,N)),H&&this.code(H).endFunc(),this}endFunc(){return this._endBlockNode(y)}optimize($=1){for(;$-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,P){let N=this._currNode;if(N instanceof $||P&&N instanceof P)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${P?`${$.kind}/${P.kind}`:$.kind}"`)}_elseNode($){let P=this._currNode;if(!(P instanceof d))throw new Error('CodeGen: "else" without "if"');return this._currNode=P.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let P=this._nodes;P[P.length-1]=$}};e.CodeGen=M;function D($,P){for(let N in P)$[N]=($[N]||0)+(P[N]||0);return $}function Y($,P){return P instanceof t._CodeOrName?D($,P.names):$}function K($,P,N){if($ instanceof t.Name)return H($);if(!te($))return $;return new t._Code($._items.reduce((pe,ae)=>(ae instanceof t.Name&&(ae=H(ae)),ae instanceof t._Code?pe.push(...ae._items):pe.push(ae),pe),[]));function H(pe){let ae=N[pe.str];return ae===void 0||P[pe.str]!==1?pe:(delete P[pe.str],ae)}function te(pe){return pe instanceof t._Code&&pe._items.some(ae=>ae instanceof t.Name&&P[ae.str]===1&&N[ae.str]!==void 0)}}function fe($,P){for(let N in P)$[N]=($[N]||0)-(P[N]||0)}function Te($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:(0,t._)`!${V($)}`}e.not=Te;let ze=x(e.operators.AND);function Ce(...$){return $.reduce(ze)}e.and=Ce;let ve=x(e.operators.OR);function k(...$){return $.reduce(ve)}e.or=k;function x($){return(P,N)=>P===t.nil?N:N===t.nil?P:(0,t._)`${V(P)} ${$} ${V(N)}`}function V($){return $ instanceof t.Name?$:(0,t._)`(${$})`}})),_e=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.checkStrictMode=e.getErrorPath=e.Type=e.useFunc=e.setEvaluated=e.evaluatedPropsToName=e.mergeEvaluated=e.eachItem=e.unescapeJsonPointer=e.escapeJsonPointer=e.escapeFragment=e.unescapeFragment=e.schemaRefOrVal=e.schemaHasRulesButRef=e.schemaHasRules=e.checkUnknownRules=e.alwaysValidSchema=e.toHash=void 0;let t=de(),r=is();function n(y){let f={};for(let T of y)f[T]=!0;return f}e.toHash=n;function o(y,f){return typeof f=="boolean"?f:Object.keys(f).length===0?!0:(i(y,f),!a(f,y.self.RULES.all))}e.alwaysValidSchema=o;function i(y,f=y.schema){let{opts:T,self:A}=y;if(!T.strictSchema||typeof f=="boolean")return;let F=A.RULES.keywords;for(let M in f)F[M]||w(y,`unknown keyword: "${M}"`)}e.checkUnknownRules=i;function a(y,f){if(typeof y=="boolean")return!y;for(let T in y)if(f[T])return!0;return!1}e.schemaHasRules=a;function c(y,f){if(typeof y=="boolean")return!y;for(let T in y)if(T!=="$ref"&&f.all[T])return!0;return!1}e.schemaHasRulesButRef=c;function s({topSchemaRef:y,schemaPath:f},T,A,F){if(!F){if(typeof T=="number"||typeof T=="boolean")return T;if(typeof T=="string")return(0,t._)`${T}`}return(0,t._)`${y}${f}${(0,t.getProperty)(A)}`}e.schemaRefOrVal=s;function l(y){return z(decodeURIComponent(y))}e.unescapeFragment=l;function m(y){return encodeURIComponent(h(y))}e.escapeFragment=m;function h(y){return typeof y=="number"?`${y}`:y.replace(/~/g,"~0").replace(/\//g,"~1")}e.escapeJsonPointer=h;function z(y){return y.replace(/~1/g,"/").replace(/~0/g,"~")}e.unescapeJsonPointer=z;function R(y,f){if(Array.isArray(y))for(let T of y)f(T);else f(y)}e.eachItem=R;function v({mergeNames:y,mergeToName:f,mergeValues:T,resultToName:A}){return(F,M,D,Y)=>{let K=D===void 0?M:D instanceof t.Name?(M instanceof t.Name?y(F,M,D):f(F,M,D),D):M instanceof t.Name?(f(F,D,M),M):T(M,D);return Y===t.Name&&!(K instanceof t.Name)?A(F,K):K}}e.mergeEvaluated={props:v({mergeNames:(y,f,T)=>y.if((0,t._)`${T} !== true && ${f} !== undefined`,()=>{y.if((0,t._)`${f} === true`,()=>y.assign(T,!0),()=>y.assign(T,(0,t._)`${T} || {}`).code((0,t._)`Object.assign(${T}, ${f})`))}),mergeToName:(y,f,T)=>y.if((0,t._)`${T} !== true`,()=>{f===!0?y.assign(T,!0):(y.assign(T,(0,t._)`${T} || {}`),g(y,T,f))}),mergeValues:(y,f)=>y===!0?!0:{...y,...f},resultToName:b}),items:v({mergeNames:(y,f,T)=>y.if((0,t._)`${T} !== true && ${f} !== undefined`,()=>y.assign(T,(0,t._)`${f} === true ? true : ${T} > ${f} ? ${T} : ${f}`)),mergeToName:(y,f,T)=>y.if((0,t._)`${T} !== true`,()=>y.assign(T,f===!0?!0:(0,t._)`${T} > ${f} ? ${T} : ${f}`)),mergeValues:(y,f)=>y===!0?!0:Math.max(y,f),resultToName:(y,f)=>y.var("items",f)})};function b(y,f){if(f===!0)return y.var("props",!0);let T=y.var("props",(0,t._)`{}`);return f!==void 0&&g(y,T,f),T}e.evaluatedPropsToName=b;function g(y,f,T){Object.keys(T).forEach(A=>y.assign((0,t._)`${f}${(0,t.getProperty)(A)}`,!0))}e.setEvaluated=g;let d={};function _(y,f){return y.scopeValue("func",{ref:f,code:d[f.code]||(d[f.code]=new r._Code(f.code))})}e.useFunc=_;var p;(function(y){y[y.Num=0]="Num",y[y.Str=1]="Str"})(p||(e.Type=p={}));function S(y,f,T){if(y instanceof t.Name){let A=f===p.Num;return T?A?(0,t._)`"[" + ${y} + "]"`:(0,t._)`"['" + ${y} + "']"`:A?(0,t._)`"/" + ${y}`:(0,t._)`"/" + ${y}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return T?(0,t.getProperty)(y).toString():"/"+h(y)}e.getErrorPath=S;function w(y,f,T=y.opts.strictSchema){if(T){if(f=`strict mode: ${f}`,T===!0)throw new Error(f);y.self.logger.warn(f)}}e.checkStrictMode=w})),dt=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={data:new t.Name("data"),valCxt:new t.Name("valCxt"),instancePath:new t.Name("instancePath"),parentData:new t.Name("parentData"),parentDataProperty:new t.Name("parentDataProperty"),rootData:new t.Name("rootData"),dynamicAnchors:new t.Name("dynamicAnchors"),vErrors:new t.Name("vErrors"),errors:new t.Name("errors"),this:new t.Name("this"),self:new t.Name("self"),scope:new t.Name("scope"),json:new t.Name("json"),jsonPos:new t.Name("jsonPos"),jsonLen:new t.Name("jsonLen"),jsonPart:new t.Name("jsonPart")};e.default=r})),ss=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;let t=de(),r=_e(),n=dt();e.keywordError={message:({keyword:g})=>(0,t.str)`must pass "${g}" keyword validation`},e.keyword$DataError={message:({keyword:g,schemaType:d})=>d?(0,t.str)`"${g}" keyword must be ${d} ($data)`:(0,t.str)`"${g}" keyword is invalid ($data)`};function o(g,d=e.keywordError,_,p){let{it:S}=g,{gen:w,compositeRule:y,allErrors:f}=S,T=h(g,d,_);p??(y||f)?s(w,T):l(S,(0,t._)`[${T}]`)}e.reportError=o;function i(g,d=e.keywordError,_){let{it:p}=g,{gen:S,compositeRule:w,allErrors:y}=p;s(S,h(g,d,_)),w||y||l(p,n.default.vErrors)}e.reportExtraError=i;function a(g,d){g.assign(n.default.errors,d),g.if((0,t._)`${n.default.vErrors} !== null`,()=>g.if(d,()=>g.assign((0,t._)`${n.default.vErrors}.length`,d),()=>g.assign(n.default.vErrors,null)))}e.resetErrorsCount=a;function c({gen:g,keyword:d,schemaValue:_,data:p,errsCount:S,it:w}){if(S===void 0)throw new Error("ajv implementation error");let y=g.name("err");g.forRange("i",S,n.default.errors,f=>{g.const(y,(0,t._)`${n.default.vErrors}[${f}]`),g.if((0,t._)`${y}.instancePath === undefined`,()=>g.assign((0,t._)`${y}.instancePath`,(0,t.strConcat)(n.default.instancePath,w.errorPath))),g.assign((0,t._)`${y}.schemaPath`,(0,t.str)`${w.errSchemaPath}/${d}`),w.opts.verbose&&(g.assign((0,t._)`${y}.schema`,_),g.assign((0,t._)`${y}.data`,p))})}e.extendErrors=c;function s(g,d){let _=g.const("err",d);g.if((0,t._)`${n.default.vErrors} === null`,()=>g.assign(n.default.vErrors,(0,t._)`[${_}]`),(0,t._)`${n.default.vErrors}.push(${_})`),g.code((0,t._)`${n.default.errors}++`)}function l(g,d){let{gen:_,validateName:p,schemaEnv:S}=g;S.$async?_.throw((0,t._)`new ${g.ValidationError}(${d})`):(_.assign((0,t._)`${p}.errors`,d),_.return(!1))}let m={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function h(g,d,_){let{createErrors:p}=g.it;return p===!1?(0,t._)`{}`:z(g,d,_)}function z(g,d,_={}){let{gen:p,it:S}=g,w=[R(S,_),v(g,_)];return b(g,d,w),p.object(...w)}function R({errorPath:g},{instancePath:d}){let _=d?(0,t.str)`${g}${(0,r.getErrorPath)(d,r.Type.Str)}`:g;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,_)]}function v({keyword:g,it:{errSchemaPath:d}},{schemaPath:_,parentSchema:p}){let S=p?d:(0,t.str)`${d}/${g}`;return _&&(S=(0,t.str)`${S}${(0,r.getErrorPath)(_,r.Type.Str)}`),[m.schemaPath,S]}function b(g,{params:d,message:_},p){let{keyword:S,data:w,schemaValue:y,it:f}=g,{opts:T,propertyName:A,topSchemaRef:F,schemaPath:M}=f;p.push([m.keyword,S],[m.params,typeof d=="function"?d(g):d||(0,t._)`{}`]),T.messages&&p.push([m.message,typeof _=="function"?_(g):_]),T.verbose&&p.push([m.schema,y],[m.parentSchema,(0,t._)`${F}${M}`],[n.default.data,w]),A&&p.push([m.propertyName,A])}})),DS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.boolOrEmptySchema=e.topBoolOrEmptySchema=void 0;let t=ss(),r=de(),n=dt(),o={message:"boolean schema is false"};function i(s){let{gen:l,schema:m,validateName:h}=s;m===!1?c(s,!1):typeof m=="object"&&m.$async===!0?l.return(n.default.data):(l.assign((0,r._)`${h}.errors`,null),l.return(!0))}e.topBoolOrEmptySchema=i;function a(s,l){let{gen:m,schema:h}=s;h===!1?(m.var(l,!1),c(s)):m.var(l,!0)}e.boolOrEmptySchema=a;function c(s,l){let{gen:m,data:h}=s,z={gen:m,keyword:"false schema",data:h,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:s};(0,t.reportError)(z,o,void 0,l)}})),Sh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getRules=e.isJSONType=void 0;let t=new Set(["string","number","integer","boolean","null","object","array"]);function r(o){return typeof o=="string"&&t.has(o)}e.isJSONType=r;function n(){let o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}e.getRules=n})),yh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.shouldUseRule=e.shouldUseGroup=e.schemaHasRulesForType=void 0;function t({schema:o,self:i},a){let c=i.RULES.types[a];return c&&c!==!0&&r(o,c)}e.schemaHasRulesForType=t;function r(o,i){return i.rules.some(a=>n(o,a))}e.shouldUseGroup=r;function n(o,i){var a;return o[i.keyword]!==void 0||((a=i.definition.implements)===null||a===void 0?void 0:a.some(c=>o[c]!==void 0))}e.shouldUseRule=n})),as=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.reportTypeError=e.checkDataTypes=e.checkDataType=e.coerceAndCheckDataType=e.getJSONTypes=e.getSchemaTypes=e.DataType=void 0;let t=Sh(),r=yh(),n=ss(),o=de(),i=_e();var a;(function(p){p[p.Correct=0]="Correct",p[p.Wrong=1]="Wrong"})(a||(e.DataType=a={}));function c(p){let S=s(p.type);if(S.includes("null")){if(p.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!S.length&&p.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');p.nullable===!0&&S.push("null")}return S}e.getSchemaTypes=c;function s(p){let S=Array.isArray(p)?p:p?[p]:[];if(S.every(t.isJSONType))return S;throw new Error("type must be JSONType or JSONType[]: "+S.join(","))}e.getJSONTypes=s;function l(p,S){let{gen:w,data:y,opts:f}=p,T=h(S,f.coerceTypes),A=S.length>0&&!(T.length===0&&S.length===1&&(0,r.schemaHasRulesForType)(p,S[0]));if(A){let F=b(S,y,f.strictNumbers,a.Wrong);w.if(F,()=>{T.length?z(p,S,T):d(p)})}return A}e.coerceAndCheckDataType=l;let m=new Set(["string","number","integer","boolean","null"]);function h(p,S){return S?p.filter(w=>m.has(w)||S==="array"&&w==="array"):[]}function z(p,S,w){let{gen:y,data:f,opts:T}=p,A=y.let("dataType",(0,o._)`typeof ${f}`),F=y.let("coerced",(0,o._)`undefined`);T.coerceTypes==="array"&&y.if((0,o._)`${A} == 'object' && Array.isArray(${f}) && ${f}.length == 1`,()=>y.assign(f,(0,o._)`${f}[0]`).assign(A,(0,o._)`typeof ${f}`).if(b(S,f,T.strictNumbers),()=>y.assign(F,f))),y.if((0,o._)`${F} !== undefined`);for(let D of w)(m.has(D)||D==="array"&&T.coerceTypes==="array")&&M(D);y.else(),d(p),y.endIf(),y.if((0,o._)`${F} !== undefined`,()=>{y.assign(f,F),R(p,F)});function M(D){switch(D){case"string":y.elseIf((0,o._)`${A} == "number" || ${A} == "boolean"`).assign(F,(0,o._)`"" + ${f}`).elseIf((0,o._)`${f} === null`).assign(F,(0,o._)`""`);return;case"number":y.elseIf((0,o._)`${A} == "boolean" || ${f} === null @@ -28,15 +28,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. || ${A} === "boolean" || ${f} === null`).assign(F,(0,o._)`[${f}]`)}}}function R({gen:p,parentData:S,parentDataProperty:w},y){p.if((0,o._)`${S} !== undefined`,()=>p.assign((0,o._)`${S}[${w}]`,y))}function v(p,S,w,y=a.Correct){let f=y===a.Correct?o.operators.EQ:o.operators.NEQ,T;switch(p){case"null":return(0,o._)`${S} ${f} null`;case"array":T=(0,o._)`Array.isArray(${S})`;break;case"object":T=(0,o._)`${S} && typeof ${S} == "object" && !Array.isArray(${S})`;break;case"integer":T=A((0,o._)`!(${S} % 1) && !isNaN(${S})`);break;case"number":T=A();break;default:return(0,o._)`typeof ${S} ${f} ${p}`}return y===a.Correct?T:(0,o.not)(T);function A(F=o.nil){return(0,o.and)((0,o._)`typeof ${S} == "number"`,F,w?(0,o._)`isFinite(${S})`:o.nil)}}e.checkDataType=v;function b(p,S,w,y){if(p.length===1)return v(p[0],S,w,y);let f,T=(0,i.toHash)(p);if(T.array&&T.object){let A=(0,o._)`typeof ${S} != "object"`;f=T.null?A:(0,o._)`!${S} || ${A}`,delete T.null,delete T.array,delete T.object}else f=o.nil;T.number&&delete T.integer;for(let A in T)f=(0,o.and)(f,v(A,S,w,y));return f}e.checkDataTypes=b;let g={message:({schema:p})=>`must be ${p}`,params:({schema:p,schemaValue:S})=>typeof p=="string"?(0,o._)`{type: ${p}}`:(0,o._)`{type: ${S}}`};function d(p){let S=_(p);(0,n.reportError)(S,g)}e.reportTypeError=d;function _(p){let{gen:S,data:w,schema:y}=p,f=(0,i.schemaRefOrVal)(p,y,"type");return{gen:S,keyword:"type",data:w,schema:y.type,schemaCode:f,schemaValue:f,parentSchema:y,params:{},it:p}}})),VS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.assignDefaults=void 0;let t=de(),r=_e();function n(i,a){let{properties:c,items:s}=i.schema;if(a==="object"&&c)for(let l in c)o(i,l,c[l].default);else a==="array"&&Array.isArray(s)&&s.forEach((l,m)=>o(i,m,l.default))}e.assignDefaults=n;function o(i,a,c){let{gen:s,compositeRule:l,data:m,opts:h}=i;if(c===void 0)return;let z=(0,t._)`${m}${(0,t.getProperty)(a)}`;if(l){(0,r.checkStrictMode)(i,`default is ignored for: ${z}`);return}let R=(0,t._)`${z} === undefined`;h.useDefaults==="empty"&&(R=(0,t._)`${R} || ${z} === null || ${z} === ""`),s.if(R,(0,t._)`${z} = ${(0,t.stringify)(c)}`)}})),mt=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateUnion=e.validateArray=e.usePattern=e.callValidateCode=e.schemaProperties=e.allSchemaProperties=e.noPropertyInData=e.propertyInData=e.isOwnProperty=e.hasPropFunc=e.reportMissingProp=e.checkMissingProp=e.checkReportMissingProp=void 0;let t=de(),r=_e(),n=dt(),o=_e();function i(p,S){let{gen:w,data:y,it:f}=p;w.if(h(w,y,S,f.opts.ownProperties),()=>{p.setParams({missingProperty:(0,t._)`${S}`},!0),p.error()})}e.checkReportMissingProp=i;function a({gen:p,data:S,it:{opts:w}},y,f){return(0,t.or)(...y.map(T=>(0,t.and)(h(p,S,T,w.ownProperties),(0,t._)`${f} = ${T}`)))}e.checkMissingProp=a;function c(p,S){p.setParams({missingProperty:S},!0),p.error()}e.reportMissingProp=c;function s(p){return p.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,t._)`Object.prototype.hasOwnProperty`})}e.hasPropFunc=s;function l(p,S,w){return(0,t._)`${s(p)}.call(${S}, ${w})`}e.isOwnProperty=l;function m(p,S,w,y){let f=(0,t._)`${S}${(0,t.getProperty)(w)} !== undefined`;return y?(0,t._)`${f} && ${l(p,S,w)}`:f}e.propertyInData=m;function h(p,S,w,y){let f=(0,t._)`${S}${(0,t.getProperty)(w)} === undefined`;return y?(0,t.or)(f,(0,t.not)(l(p,S,w))):f}e.noPropertyInData=h;function z(p){return p?Object.keys(p).filter(S=>S!=="__proto__"):[]}e.allSchemaProperties=z;function R(p,S){return z(S).filter(w=>!(0,r.alwaysValidSchema)(p,S[w]))}e.schemaProperties=R;function v({schemaCode:p,data:S,it:{gen:w,topSchemaRef:y,schemaPath:f,errorPath:T},it:A},F,M,D){let Y=D?(0,t._)`${p}, ${S}, ${y}${f}`:S,K=[[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,T)],[n.default.parentData,A.parentData],[n.default.parentDataProperty,A.parentDataProperty],[n.default.rootData,n.default.rootData]];A.opts.dynamicRef&&K.push([n.default.dynamicAnchors,n.default.dynamicAnchors]);let fe=(0,t._)`${Y}, ${w.object(...K)}`;return M!==t.nil?(0,t._)`${F}.call(${M}, ${fe})`:(0,t._)`${F}(${fe})`}e.callValidateCode=v;let b=(0,t._)`new RegExp`;function g({gen:p,it:{opts:S}},w){let y=S.unicodeRegExp?"u":"",{regExp:f}=S.code,T=f(w,y);return p.scopeValue("pattern",{key:T.toString(),ref:T,code:(0,t._)`${f.code==="new RegExp"?b:(0,o.useFunc)(p,f)}(${w}, ${y})`})}e.usePattern=g;function d(p){let{gen:S,data:w,keyword:y,it:f}=p,T=S.name("valid");if(f.allErrors){let F=S.let("valid",!0);return A(()=>S.assign(F,!1)),F}return S.var(T,!0),A(()=>S.break()),T;function A(F){let M=S.const("len",(0,t._)`${w}.length`);S.forRange("i",0,M,D=>{p.subschema({keyword:y,dataProp:D,dataPropType:r.Type.Num},T),S.if((0,t.not)(T),F)})}}e.validateArray=d;function _(p){let{gen:S,schema:w,keyword:y,it:f}=p;if(!Array.isArray(w))throw new Error("ajv implementation error");if(w.some(F=>(0,r.alwaysValidSchema)(f,F))&&!f.opts.unevaluated)return;let T=S.let("valid",!1),A=S.name("_valid");S.block(()=>w.forEach((F,M)=>{let D=p.subschema({keyword:y,schemaProp:M,compositeRule:!0},A);S.assign(T,(0,t._)`${T} || ${A}`),p.mergeValidEvaluated(D,A)||S.if((0,t.not)(T))})),p.result(T,()=>p.reset(),()=>p.error(!0))}e.validateUnion=_})),ZS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateKeywordUsage=e.validSchemaType=e.funcKeywordCode=e.macroKeywordCode=void 0;let t=de(),r=dt(),n=mt(),o=ss();function i(R,v){let{gen:b,keyword:g,schema:d,parentSchema:_,it:p}=R,S=v.macro.call(p.self,d,_,p),w=m(b,g,S);p.opts.validateSchema!==!1&&p.self.validateSchema(S,!0);let y=b.name("valid");R.subschema({schema:S,schemaPath:t.nil,errSchemaPath:`${p.errSchemaPath}/${g}`,topSchemaRef:w,compositeRule:!0},y),R.pass(y,()=>R.error(!0))}e.macroKeywordCode=i;function a(R,v){var b;let{gen:g,keyword:d,schema:_,parentSchema:p,$data:S,it:w}=R;l(w,v);let y=m(g,d,!S&&v.compile?v.compile.call(w.self,_,p,w):v.validate),f=g.let("valid");R.block$data(f,T),R.ok((b=v.valid)!==null&&b!==void 0?b:f);function T(){if(v.errors===!1)M(),v.modifying&&c(R),D(()=>R.error());else{let Y=v.async?A():F();v.modifying&&c(R),D(()=>s(R,Y))}}function A(){let Y=g.let("ruleErrs",null);return g.try(()=>M((0,t._)`await `),K=>g.assign(f,!1).if((0,t._)`${K} instanceof ${w.ValidationError}`,()=>g.assign(Y,(0,t._)`${K}.errors`),()=>g.throw(K))),Y}function F(){let Y=(0,t._)`${y}.errors`;return g.assign(Y,null),M(t.nil),Y}function M(Y=v.async?(0,t._)`await `:t.nil){let K=w.opts.passContext?r.default.this:r.default.self,fe=!("compile"in v&&!S||v.schema===!1);g.assign(f,(0,t._)`${Y}${(0,n.callValidateCode)(R,y,K,fe)}`,v.modifying)}function D(Y){var K;g.if((0,t.not)((K=v.valid)!==null&&K!==void 0?K:f),Y)}}e.funcKeywordCode=a;function c(R){let{gen:v,data:b,it:g}=R;v.if(g.parentData,()=>v.assign(b,(0,t._)`${g.parentData}[${g.parentDataProperty}]`))}function s(R,v){let{gen:b}=R;b.if((0,t._)`Array.isArray(${v})`,()=>{b.assign(r.default.vErrors,(0,t._)`${r.default.vErrors} === null ? ${v} : ${r.default.vErrors}.concat(${v})`).assign(r.default.errors,(0,t._)`${r.default.vErrors}.length`),(0,o.extendErrors)(R)},()=>R.error())}function l({schemaEnv:R},v){if(v.async&&!R.$async)throw new Error("async keyword in sync schema")}function m(R,v,b){if(b===void 0)throw new Error(`keyword "${v}" failed to compile`);return R.scopeValue("keyword",typeof b=="function"?{ref:b}:{ref:b,code:(0,t.stringify)(b)})}function h(R,v,b=!1){return!v.length||v.some(g=>g==="array"?Array.isArray(R):g==="object"?R&&typeof R=="object"&&!Array.isArray(R):typeof R==g||b&&typeof R>"u")}e.validSchemaType=h;function z({schema:R,opts:v,self:b,errSchemaPath:g},d,_){if(Array.isArray(d.keyword)?!d.keyword.includes(_):d.keyword!==_)throw new Error("ajv implementation error");let p=d.dependencies;if(p?.some(S=>!Object.prototype.hasOwnProperty.call(R,S)))throw new Error(`parent schema must have dependencies of ${_}: ${p.join(",")}`);if(d.validateSchema&&!d.validateSchema(R[_])){let S=`keyword "${_}" value is invalid at path "${g}": `+b.errorsText(d.validateSchema.errors);if(v.validateSchema==="log")b.logger.error(S);else throw new Error(S)}}e.validateKeywordUsage=z})),FS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.extendSubschemaMode=e.extendSubschemaData=e.getSubschema=void 0;let t=de(),r=_e();function n(a,{keyword:c,schemaProp:s,schema:l,schemaPath:m,errSchemaPath:h,topSchemaRef:z}){if(c!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(c!==void 0){let R=a.schema[c];return s===void 0?{schema:R,schemaPath:(0,t._)`${a.schemaPath}${(0,t.getProperty)(c)}`,errSchemaPath:`${a.errSchemaPath}/${c}`}:{schema:R[s],schemaPath:(0,t._)`${a.schemaPath}${(0,t.getProperty)(c)}${(0,t.getProperty)(s)}`,errSchemaPath:`${a.errSchemaPath}/${c}/${(0,r.escapeFragment)(s)}`}}if(l!==void 0){if(m===void 0||h===void 0||z===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:m,topSchemaRef:z,errSchemaPath:h}}throw new Error('either "keyword" or "schema" must be passed')}e.getSubschema=n;function o(a,c,{dataProp:s,dataPropType:l,data:m,dataTypes:h,propertyName:z}){if(m!==void 0&&s!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:R}=c;if(s!==void 0){let{errorPath:b,dataPathArr:g,opts:d}=c;v(R.let("data",(0,t._)`${c.data}${(0,t.getProperty)(s)}`,!0)),a.errorPath=(0,t.str)`${b}${(0,r.getErrorPath)(s,l,d.jsPropertySyntax)}`,a.parentDataProperty=(0,t._)`${s}`,a.dataPathArr=[...g,a.parentDataProperty]}m!==void 0&&(v(m instanceof t.Name?m:R.let("data",m,!0)),z!==void 0&&(a.propertyName=z)),h&&(a.dataTypes=h);function v(b){a.data=b,a.dataLevel=c.dataLevel+1,a.dataTypes=[],c.definedProperties=new Set,a.parentData=c.data,a.dataNames=[...c.dataNames,b]}}e.extendSubschemaData=o;function i(a,{jtdDiscriminator:c,jtdMetadata:s,compositeRule:l,createErrors:m,allErrors:h}){l!==void 0&&(a.compositeRule=l),m!==void 0&&(a.createErrors=m),h!==void 0&&(a.allErrors=h),a.jtdDiscriminator=c,a.jtdMetadata=s}e.extendSubschemaMode=i})),bh=L(((e,t)=>{t.exports=function r(n,o){if(n===o)return!0;if(n&&o&&typeof n=="object"&&typeof o=="object"){if(n.constructor!==o.constructor)return!1;var i,a,c;if(Array.isArray(n)){if(i=n.length,i!=o.length)return!1;for(a=i;a--!==0;)if(!r(n[a],o[a]))return!1;return!0}if(n.constructor===RegExp)return n.source===o.source&&n.flags===o.flags;if(n.valueOf!==Object.prototype.valueOf)return n.valueOf()===o.valueOf();if(n.toString!==Object.prototype.toString)return n.toString()===o.toString();if(c=Object.keys(n),i=c.length,i!==Object.keys(o).length)return!1;for(a=i;a--!==0;)if(!Object.prototype.hasOwnProperty.call(o,c[a]))return!1;for(a=i;a--!==0;){var s=c[a];if(!r(n[s],o[s]))return!1}return!0}return n!==n&&o!==o}})),HS=L(((e,t)=>{var r=t.exports=function(i,a,c){typeof a=="function"&&(c=a,a={}),c=a.cb||c;var s=typeof c=="function"?c:c.pre||function(){},l=c.post||function(){};n(a,s,l,i,"",i)};r.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},r.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},r.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},r.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function n(i,a,c,s,l,m,h,z,R,v){if(s&&typeof s=="object"&&!Array.isArray(s)){a(s,l,m,h,z,R,v);for(var b in s){var g=s[b];if(Array.isArray(g)){if(b in r.arrayKeywords)for(var d=0;d{Object.defineProperty(e,"__esModule",{value:!0}),e.getSchemaRefs=e.resolveUrl=e.normalizeId=e._getFullPath=e.getFullPath=e.inlineRef=void 0;let t=_e(),r=bh(),n=HS(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function i(g,d=!0){return typeof g=="boolean"?!0:d===!0?!c(g):d?s(g)<=d:!1}e.inlineRef=i;let a=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function c(g){for(let d in g){if(a.has(d))return!0;let _=g[d];if(Array.isArray(_)&&_.some(c)||typeof _=="object"&&c(_))return!0}return!1}function s(g){let d=0;for(let _ in g){if(_==="$ref")return 1/0;if(d++,!o.has(_)&&(typeof g[_]=="object"&&(0,t.eachItem)(g[_],p=>d+=s(p)),d===1/0))return 1/0}return d}function l(g,d="",_){return _!==!1&&(d=z(d)),m(g,g.parse(d))}e.getFullPath=l;function m(g,d){return g.serialize(d).split("#")[0]+"#"}e._getFullPath=m;let h=/#\/?$/;function z(g){return g?g.replace(h,""):""}e.normalizeId=z;function R(g,d,_){return _=z(_),g.resolve(d,_)}e.resolveUrl=R;let v=/^[a-z_][-a-z0-9._]*$/i;function b(g,d){if(typeof g=="boolean")return{};let{schemaId:_,uriResolver:p}=this.opts,S=z(g[_]||d),w={"":S},y=l(p,S,!1),f={},T=new Set;return n(g,{allKeys:!0},(M,D,Y,K)=>{if(K===void 0)return;let fe=y+D,Te=w[K];typeof M[_]=="string"&&(Te=ze.call(this,M[_])),Ce.call(this,M.$anchor),Ce.call(this,M.$dynamicAnchor),w[D]=Te;function ze(ve){let k=this.opts.uriResolver.resolve;if(ve=z(Te?k(Te,ve):ve),T.has(ve))throw F(ve);T.add(ve);let x=this.refs[ve];return typeof x=="string"&&(x=this.refs[x]),typeof x=="object"?A(M,x.schema,ve):ve!==z(fe)&&(ve[0]==="#"?(A(M,f[ve],ve),f[ve]=M):this.refs[ve]=fe),ve}function Ce(ve){if(typeof ve=="string"){if(!v.test(ve))throw new Error(`invalid anchor "${ve}"`);ze.call(this,`#${ve}`)}}}),f;function A(M,D,Y){if(D!==void 0&&!r(M,D))throw F(Y)}function F(M){return new Error(`reference "${M}" resolves to more than one schema`)}}e.getSchemaRefs=b})),Xr=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getData=e.KeywordCxt=e.validateFunctionCode=void 0;let t=DS(),r=as(),n=yh(),o=as(),i=VS(),a=ZS(),c=FS(),s=de(),l=dt(),m=cs(),h=_e(),z=ss();function R(I){if(y(I)&&(T(I),w(I))){d(I);return}v(I,()=>(0,t.topBoolOrEmptySchema)(I))}e.validateFunctionCode=R;function v({gen:I,validateName:C,schema:U,schemaEnv:oe,opts:ie},me){ie.code.es5?I.func(C,(0,s._)`${l.default.data}, ${l.default.valCxt}`,oe.$async,()=>{I.code((0,s._)`"use strict"; ${p(U,ie)}`),g(I,ie),I.code(me)}):I.func(C,(0,s._)`${l.default.data}, ${b(ie)}`,oe.$async,()=>I.code(p(U,ie)).code(me))}function b(I){return(0,s._)`{${l.default.instancePath}="", ${l.default.parentData}, ${l.default.parentDataProperty}, ${l.default.rootData}=${l.default.data}${I.dynamicRef?(0,s._)`, ${l.default.dynamicAnchors}={}`:s.nil}}={}`}function g(I,C){I.if(l.default.valCxt,()=>{I.var(l.default.instancePath,(0,s._)`${l.default.valCxt}.${l.default.instancePath}`),I.var(l.default.parentData,(0,s._)`${l.default.valCxt}.${l.default.parentData}`),I.var(l.default.parentDataProperty,(0,s._)`${l.default.valCxt}.${l.default.parentDataProperty}`),I.var(l.default.rootData,(0,s._)`${l.default.valCxt}.${l.default.rootData}`),C.dynamicRef&&I.var(l.default.dynamicAnchors,(0,s._)`${l.default.valCxt}.${l.default.dynamicAnchors}`)},()=>{I.var(l.default.instancePath,(0,s._)`""`),I.var(l.default.parentData,(0,s._)`undefined`),I.var(l.default.parentDataProperty,(0,s._)`undefined`),I.var(l.default.rootData,l.default.data),C.dynamicRef&&I.var(l.default.dynamicAnchors,(0,s._)`{}`)})}function d(I){let{schema:C,opts:U,gen:oe}=I;v(I,()=>{U.$comment&&C.$comment&&K(I),M(I),oe.let(l.default.vErrors,null),oe.let(l.default.errors,0),U.unevaluated&&_(I),A(I),fe(I)})}function _(I){let{gen:C,validateName:U}=I;I.evaluated=C.const("evaluated",(0,s._)`${U}.evaluated`),C.if((0,s._)`${I.evaluated}.dynamicProps`,()=>C.assign((0,s._)`${I.evaluated}.props`,(0,s._)`undefined`)),C.if((0,s._)`${I.evaluated}.dynamicItems`,()=>C.assign((0,s._)`${I.evaluated}.items`,(0,s._)`undefined`))}function p(I,C){let U=typeof I=="object"&&I[C.schemaId];return U&&(C.code.source||C.code.process)?(0,s._)`/*# sourceURL=${U} */`:s.nil}function S(I,C){if(y(I)&&(T(I),w(I))){f(I,C);return}(0,t.boolOrEmptySchema)(I,C)}function w({schema:I,self:C}){if(typeof I=="boolean")return!I;for(let U in I)if(C.RULES.all[U])return!0;return!1}function y(I){return typeof I.schema!="boolean"}function f(I,C){let{schema:U,gen:oe,opts:ie}=I;ie.$comment&&U.$comment&&K(I),D(I),Y(I);let me=oe.const("_errs",l.default.errors);A(I,me),oe.var(C,(0,s._)`${me} === ${l.default.errors}`)}function T(I){(0,h.checkUnknownRules)(I),F(I)}function A(I,C){if(I.opts.jtd)return ze(I,[],!1,C);let U=(0,r.getSchemaTypes)(I.schema);ze(I,U,!(0,r.coerceAndCheckDataType)(I,U),C)}function F(I){let{schema:C,errSchemaPath:U,opts:oe,self:ie}=I;C.$ref&&oe.ignoreKeywordsWithRef&&(0,h.schemaHasRulesButRef)(C,ie.RULES)&&ie.logger.warn(`$ref: keywords ignored in schema at path "${U}"`)}function M(I){let{schema:C,opts:U}=I;C.default!==void 0&&U.useDefaults&&U.strictSchema&&(0,h.checkStrictMode)(I,"default is ignored in the schema root")}function D(I){let C=I.schema[I.opts.schemaId];C&&(I.baseId=(0,m.resolveUrl)(I.opts.uriResolver,I.baseId,C))}function Y(I){if(I.schema.$async&&!I.schemaEnv.$async)throw new Error("async schema in sync schema")}function K({gen:I,schemaEnv:C,schema:U,errSchemaPath:oe,opts:ie}){let me=U.$comment;if(ie.$comment===!0)I.code((0,s._)`${l.default.self}.logger.log(${me})`);else if(typeof ie.$comment=="function"){let Ne=(0,s.str)`${oe}/$comment`,qe=I.scopeValue("root",{ref:C.root});I.code((0,s._)`${l.default.self}.opts.$comment(${me}, ${Ne}, ${qe}.schema)`)}}function fe(I){let{gen:C,schemaEnv:U,validateName:oe,ValidationError:ie,opts:me}=I;U.$async?C.if((0,s._)`${l.default.errors} === 0`,()=>C.return(l.default.data),()=>C.throw((0,s._)`new ${ie}(${l.default.vErrors})`)):(C.assign((0,s._)`${oe}.errors`,l.default.vErrors),me.unevaluated&&Te(I),C.return((0,s._)`${l.default.errors} === 0`))}function Te({gen:I,evaluated:C,props:U,items:oe}){U instanceof s.Name&&I.assign((0,s._)`${C}.props`,U),oe instanceof s.Name&&I.assign((0,s._)`${C}.items`,oe)}function ze(I,C,U,oe){let{gen:ie,schema:me,data:Ne,allErrors:qe,opts:Fe,self:Ae}=I,{RULES:Ie}=Ae;if(me.$ref&&(Fe.ignoreKeywordsWithRef||!(0,h.schemaHasRulesButRef)(me,Ie))){ie.block(()=>pe(I,"$ref",Ie.all.$ref.definition));return}Fe.jtd||ve(I,C),ie.block(()=>{for(let Ue of Ie.rules)nt(Ue);nt(Ie.post)});function nt(Ue){(0,n.shouldUseGroup)(me,Ue)&&(Ue.type?(ie.if((0,o.checkDataType)(Ue.type,Ne,Fe.strictNumbers)),Ce(I,Ue),C.length===1&&C[0]===Ue.type&&U&&(ie.else(),(0,o.reportTypeError)(I)),ie.endIf()):Ce(I,Ue),qe||ie.if((0,s._)`${l.default.errors} === ${oe||0}`))}}function Ce(I,C){let{gen:U,schema:oe,opts:{useDefaults:ie}}=I;ie&&(0,i.assignDefaults)(I,C.type),U.block(()=>{for(let me of C.rules)(0,n.shouldUseRule)(oe,me)&&pe(I,me.keyword,me.definition,C.type)})}function ve(I,C){I.schemaEnv.meta||!I.opts.strictTypes||(k(I,C),I.opts.allowUnionTypes||x(I,C),V(I,I.dataTypes))}function k(I,C){if(C.length){if(!I.dataTypes.length){I.dataTypes=C;return}C.forEach(U=>{P(I.dataTypes,U)||H(I,`type "${U}" not allowed by context "${I.dataTypes.join(",")}"`)}),N(I,C)}}function x(I,C){C.length>1&&!(C.length===2&&C.includes("null"))&&H(I,"use allowUnionTypes to allow union type keyword")}function V(I,C){let U=I.self.RULES.all;for(let oe in U){let ie=U[oe];if(typeof ie=="object"&&(0,n.shouldUseRule)(I.schema,ie)){let{type:me}=ie.definition;me.length&&!me.some(Ne=>$(C,Ne))&&H(I,`missing type "${me.join(",")}" for keyword "${oe}"`)}}}function $(I,C){return I.includes(C)||C==="number"&&I.includes("integer")}function P(I,C){return I.includes(C)||C==="integer"&&I.includes("number")}function N(I,C){let U=[];for(let oe of I.dataTypes)P(C,oe)?U.push(oe):C.includes("integer")&&oe==="number"&&U.push("integer");I.dataTypes=U}function H(I,C){let U=I.schemaEnv.baseId+I.errSchemaPath;C+=` at "${U}" (strictTypes)`,(0,h.checkStrictMode)(I,C,I.opts.strictTypes)}var te=class{constructor(I,C,U){if((0,a.validateKeywordUsage)(I,C,U),this.gen=I.gen,this.allErrors=I.allErrors,this.keyword=U,this.data=I.data,this.schema=I.schema[U],this.$data=C.$data&&I.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,h.schemaRefOrVal)(I,this.schema,U,this.$data),this.schemaType=C.schemaType,this.parentSchema=I.schema,this.params={},this.it=I,this.def=C,this.$data)this.schemaCode=I.gen.const("vSchema",Ge(this.$data,I));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,C.schemaType,C.allowUndefined))throw new Error(`${U} value must be ${JSON.stringify(C.schemaType)}`);("code"in C?C.trackErrors:C.errors!==!1)&&(this.errsCount=I.gen.const("_errs",l.default.errors))}result(I,C,U){this.failResult((0,s.not)(I),C,U)}failResult(I,C,U){this.gen.if(I),U?U():this.error(),C?(this.gen.else(),C(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(I,C){this.failResult((0,s.not)(I),void 0,C)}fail(I){if(I===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(I),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(I){if(!this.$data)return this.fail(I);let{schemaCode:C}=this;this.fail((0,s._)`${C} !== undefined && (${(0,s.or)(this.invalid$data(),I)})`)}error(I,C,U){if(C){this.setParams(C),this._error(I,U),this.setParams({});return}this._error(I,U)}_error(I,C){(I?z.reportExtraError:z.reportError)(this,this.def.error,C)}$dataError(){(0,z.reportError)(this,this.def.$dataError||z.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,z.resetErrorsCount)(this.gen,this.errsCount)}ok(I){this.allErrors||this.gen.if(I)}setParams(I,C){C?Object.assign(this.params,I):this.params=I}block$data(I,C,U=s.nil){this.gen.block(()=>{this.check$data(I,U),C()})}check$data(I=s.nil,C=s.nil){if(!this.$data)return;let{gen:U,schemaCode:oe,schemaType:ie,def:me}=this;U.if((0,s.or)((0,s._)`${oe} === undefined`,C)),I!==s.nil&&U.assign(I,!0),(ie.length||me.validateSchema)&&(U.elseIf(this.invalid$data()),this.$dataError(),I!==s.nil&&U.assign(I,!1)),U.else()}invalid$data(){let{gen:I,schemaCode:C,schemaType:U,def:oe,it:ie}=this;return(0,s.or)(me(),Ne());function me(){if(U.length){if(!(C instanceof s.Name))throw new Error("ajv implementation error");let qe=Array.isArray(U)?U:[U];return(0,s._)`${(0,o.checkDataTypes)(qe,C,ie.opts.strictNumbers,o.DataType.Wrong)}`}return s.nil}function Ne(){if(oe.validateSchema){let qe=I.scopeValue("validate$data",{ref:oe.validateSchema});return(0,s._)`!${qe}(${C})`}return s.nil}}subschema(I,C){let U=(0,c.getSubschema)(this.it,I);(0,c.extendSubschemaData)(U,this.it,I),(0,c.extendSubschemaMode)(U,I);let oe={...this.it,...U,items:void 0,props:void 0};return S(oe,C),oe}mergeEvaluated(I,C){let{it:U,gen:oe}=this;U.opts.unevaluated&&(U.props!==!0&&I.props!==void 0&&(U.props=h.mergeEvaluated.props(oe,I.props,U.props,C)),U.items!==!0&&I.items!==void 0&&(U.items=h.mergeEvaluated.items(oe,I.items,U.items,C)))}mergeValidEvaluated(I,C){let{it:U,gen:oe}=this;if(U.opts.unevaluated&&(U.props!==!0||U.items!==!0))return oe.if(C,()=>this.mergeEvaluated(I,s.Name)),!0}};e.KeywordCxt=te;function pe(I,C,U,oe){let ie=new te(I,U,C);"code"in U?U.code(ie,oe):ie.$data&&U.validate?(0,a.funcKeywordCode)(ie,U):"macro"in U?(0,a.macroKeywordCode)(ie,U):(U.compile||U.validate)&&(0,a.funcKeywordCode)(ie,U)}let ae=/^\/(?:[^~]|~0|~1)*$/,Re=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ge(I,{dataLevel:C,dataNames:U,dataPathArr:oe}){let ie,me;if(I==="")return l.default.rootData;if(I[0]==="/"){if(!ae.test(I))throw new Error(`Invalid JSON-pointer: ${I}`);ie=I,me=l.default.rootData}else{let Ae=Re.exec(I);if(!Ae)throw new Error(`Invalid JSON-pointer: ${I}`);let Ie=+Ae[1];if(ie=Ae[2],ie==="#"){if(Ie>=C)throw new Error(Fe("property/index",Ie));return oe[C-Ie]}if(Ie>C)throw new Error(Fe("data",Ie));if(me=U[C-Ie],!ie)return me}let Ne=me,qe=ie.split("/");for(let Ae of qe)Ae&&(me=(0,s._)`${me}${(0,s.getProperty)((0,h.unescapeJsonPointer)(Ae))}`,Ne=(0,s._)`${Ne} && ${me}`);return Ne;function Fe(Ae,Ie){return`Cannot access ${Ae} ${Ie} levels up, current level is ${C}`}}e.getData=Ge})),Ro=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}};e.default=t})),Qr=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=cs();var r=class extends Error{constructor(n,o,i,a){super(a||`can't resolve reference ${i} from id ${o}`),this.missingRef=(0,t.resolveUrl)(n,o,i),this.missingSchema=(0,t.normalizeId)((0,t.getFullPath)(n,this.missingRef))}};e.default=r})),us=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveSchema=e.getCompilingSchema=e.resolveRef=e.compileSchema=e.SchemaEnv=void 0;let t=de(),r=Ro(),n=dt(),o=cs(),i=_e(),a=Xr();var c=class{constructor(d){var _;this.refs={},this.dynamicAnchors={};let p;typeof d.schema=="object"&&(p=d.schema),this.schema=d.schema,this.schemaId=d.schemaId,this.root=d.root||this,this.baseId=(_=d.baseId)!==null&&_!==void 0?_:(0,o.normalizeId)(p?.[d.schemaId||"$id"]),this.schemaPath=d.schemaPath,this.localRefs=d.localRefs,this.meta=d.meta,this.$async=p?.$async,this.refs={}}};e.SchemaEnv=c;function s(d){let _=h.call(this,d);if(_)return _;let p=(0,o.getFullPath)(this.opts.uriResolver,d.root.baseId),{es5:S,lines:w}=this.opts.code,{ownProperties:y}=this.opts,f=new t.CodeGen(this.scope,{es5:S,lines:w,ownProperties:y}),T;d.$async&&(T=f.scopeValue("Error",{ref:r.default,code:(0,t._)`require("ajv/dist/runtime/validation_error").default`}));let A=f.scopeName("validate");d.validateName=A;let F={gen:f,allErrors:this.opts.allErrors,data:n.default.data,parentData:n.default.parentData,parentDataProperty:n.default.parentDataProperty,dataNames:[n.default.data],dataPathArr:[t.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:f.scopeValue("schema",this.opts.code.source===!0?{ref:d.schema,code:(0,t.stringify)(d.schema)}:{ref:d.schema}),validateName:A,ValidationError:T,schema:d.schema,schemaEnv:d,rootId:p,baseId:d.baseId||p,schemaPath:t.nil,errSchemaPath:d.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,t._)`""`,opts:this.opts,self:this},M;try{this._compilations.add(d),(0,a.validateFunctionCode)(F),f.optimize(this.opts.code.optimize);let D=f.toString();M=`${f.scopeRefs(n.default.scope)}return ${D}`,this.opts.code.process&&(M=this.opts.code.process(M,d));let Y=new Function(`${n.default.self}`,`${n.default.scope}`,M)(this,this.scope.get());if(this.scope.value(A,{ref:Y}),Y.errors=null,Y.schema=d.schema,Y.schemaEnv=d,d.$async&&(Y.$async=!0),this.opts.code.source===!0&&(Y.source={validateName:A,validateCode:D,scopeValues:f._values}),this.opts.unevaluated){let{props:K,items:fe}=F;Y.evaluated={props:K instanceof t.Name?void 0:K,items:fe instanceof t.Name?void 0:fe,dynamicProps:K instanceof t.Name,dynamicItems:fe instanceof t.Name},Y.source&&(Y.source.evaluated=(0,t.stringify)(Y.evaluated))}return d.validate=Y,d}catch(D){throw delete d.validate,delete d.validateName,M&&this.logger.error("Error compiling schema, function code:",M),D}finally{this._compilations.delete(d)}}e.compileSchema=s;function l(d,_,p){var S;p=(0,o.resolveUrl)(this.opts.uriResolver,_,p);let w=d.refs[p];if(w)return w;let y=R.call(this,d,p);if(y===void 0){let f=(S=d.localRefs)===null||S===void 0?void 0:S[p],{schemaId:T}=this.opts;f&&(y=new c({schema:f,schemaId:T,root:d,baseId:_}))}if(y!==void 0)return d.refs[p]=m.call(this,y)}e.resolveRef=l;function m(d){return(0,o.inlineRef)(d.schema,this.opts.inlineRefs)?d.schema:d.validate?d:s.call(this,d)}function h(d){for(let _ of this._compilations)if(z(_,d))return _}e.getCompilingSchema=h;function z(d,_){return d.schema===_.schema&&d.root===_.root&&d.baseId===_.baseId}function R(d,_){let p;for(;typeof(p=this.refs[_])=="string";)_=p;return p||this.schemas[_]||v.call(this,d,_)}function v(d,_){let p=this.opts.uriResolver.parse(_),S=(0,o._getFullPath)(this.opts.uriResolver,p),w=(0,o.getFullPath)(this.opts.uriResolver,d.baseId,void 0);if(Object.keys(d.schema).length>0&&S===w)return g.call(this,p,d);let y=(0,o.normalizeId)(S),f=this.refs[y]||this.schemas[y];if(typeof f=="string"){let T=v.call(this,d,f);return typeof T?.schema!="object"?void 0:g.call(this,p,T)}if(typeof f?.schema=="object"){if(f.validate||s.call(this,f),y===(0,o.normalizeId)(_)){let{schema:T}=f,{schemaId:A}=this.opts,F=T[A];return F&&(w=(0,o.resolveUrl)(this.opts.uriResolver,w,F)),new c({schema:T,schemaId:A,root:d,baseId:w})}return g.call(this,p,f)}}e.resolveSchema=v;let b=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function g(d,{baseId:_,schema:p,root:S}){var w;if(((w=d.fragment)===null||w===void 0?void 0:w[0])!=="/")return;for(let T of d.fragment.slice(1).split("/")){if(typeof p=="boolean")return;let A=p[(0,i.unescapeFragment)(T)];if(A===void 0)return;p=A;let F=typeof p=="object"&&p[this.opts.schemaId];!b.has(T)&&F&&(_=(0,o.resolveUrl)(this.opts.uriResolver,_,F))}let y;if(typeof p!="boolean"&&p.$ref&&!(0,i.schemaHasRulesButRef)(p,this.RULES)){let T=(0,o.resolveUrl)(this.opts.uriResolver,_,p.$ref);y=v.call(this,S,T)}let{schemaId:f}=this.opts;if(y=y||new c({schema:p,schemaId:f,root:S,baseId:_}),y.schema!==y.root.schema)return y}})),JS=L(((e,t)=>{t.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}})),$h=L(((e,t)=>{let r=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),n=RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);function o(v){let b="",g=0,d=0;for(d=0;d=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102))return"";b+=v[d];break}for(d+=1;d=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102))return"";b+=v[d]}return b}let i=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function a(v){return v.length=0,!0}function c(v,b,g){if(v.length){let d=o(v);if(d!=="")b.push(d);else return g.error=!0,!1;v.length=0}return!0}function s(v){let b=0,g={error:!1,address:"",zone:""},d=[],_=[],p=!1,S=!1,w=c;for(let y=0;y7){g.error=!0;break}y>0&&v[y-1]===":"&&(p=!0),d.push(":");continue}else if(f==="%"){if(!w(_,d,g))break;w=a}else{_.push(f);continue}}return _.length&&(w===a?g.zone=_.join(""):S?d.push(_.join("")):d.push(o(_))),g.address=d.join(""),g}function l(v){if(m(v,":")<2)return{host:v,isIPV6:!1};let b=s(v);if(b.error)return{host:v,isIPV6:!1};{let g=b.address,d=b.address;return b.zone&&(g+="%"+b.zone,d+="%25"+b.zone),{host:g,isIPV6:!0,escapedHost:d}}}function m(v,b){let g=0;for(let d=0;d{let{isUUID:r}=$h(),n=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,o=["http","https","ws","wss","urn","urn:uuid"];function i(f){return o.indexOf(f)!==-1}function a(f){return f.secure===!0?!0:f.secure===!1?!1:f.scheme?f.scheme.length===3&&(f.scheme[0]==="w"||f.scheme[0]==="W")&&(f.scheme[1]==="s"||f.scheme[1]==="S")&&(f.scheme[2]==="s"||f.scheme[2]==="S"):!1}function c(f){return f.host||(f.error=f.error||"HTTP URIs must have a host."),f}function s(f){let T=String(f.scheme).toLowerCase()==="https";return(f.port===(T?443:80)||f.port==="")&&(f.port=void 0),f.path||(f.path="/"),f}function l(f){return f.secure=a(f),f.resourceName=(f.path||"/")+(f.query?"?"+f.query:""),f.path=void 0,f.query=void 0,f}function m(f){if((f.port===(a(f)?443:80)||f.port==="")&&(f.port=void 0),typeof f.secure=="boolean"&&(f.scheme=f.secure?"wss":"ws",f.secure=void 0),f.resourceName){let[T,A]=f.resourceName.split("?");f.path=T&&T!=="/"?T:void 0,f.query=A,f.resourceName=void 0}return f.fragment=void 0,f}function h(f,T){if(!f.path)return f.error="URN can not be parsed",f;let A=f.path.match(n);if(A){let F=T.scheme||f.scheme||"urn";f.nid=A[1].toLowerCase(),f.nss=A[2];let M=y(`${F}:${T.nid||f.nid}`);f.path=void 0,M&&(f=M.parse(f,T))}else f.error=f.error||"URN can not be parsed.";return f}function z(f,T){if(f.nid===void 0)throw new Error("URN without nid cannot be serialized");let A=T.scheme||f.scheme||"urn",F=f.nid.toLowerCase(),M=y(`${A}:${T.nid||F}`);M&&(f=M.serialize(f,T));let D=f,Y=f.nss;return D.path=`${F||T.nid}:${Y}`,T.skipEscape=!0,D}function R(f,T){let A=f;return A.uuid=A.nss,A.nss=void 0,!T.tolerant&&(!A.uuid||!r(A.uuid))&&(A.error=A.error||"UUID is not valid."),A}function v(f){let T=f;return T.nss=(f.uuid||"").toLowerCase(),T}let b={scheme:"http",domainHost:!0,parse:c,serialize:s},g={scheme:"https",domainHost:b.domainHost,parse:c,serialize:s},d={scheme:"ws",domainHost:!0,parse:l,serialize:m},_={scheme:"wss",domainHost:d.domainHost,parse:d.parse,serialize:d.serialize},w={http:b,https:g,ws:d,wss:_,urn:{scheme:"urn",parse:h,serialize:z,skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:R,serialize:v,skipNormalize:!0}};Object.setPrototypeOf(w,null);function y(f){return f&&(w[f]||w[f.toLowerCase()])||void 0}t.exports={wsIsSecure:a,SCHEMES:w,isValidSchemeName:i,getSchemeHandler:y}})),KS=L(((e,t)=>{let{normalizeIPv6:r,removeDotSegments:n,recomposeAuthority:o,normalizeComponentEncoding:i,isIPv4:a,nonSimpleDomain:c}=$h(),{SCHEMES:s,getSchemeHandler:l}=BS();function m(_,p){return typeof _=="string"?_=v(g(_,p),p):typeof _=="object"&&(_=g(v(_,p),p)),_}function h(_,p,S){let w=S?Object.assign({scheme:"null"},S):{scheme:"null"},y=z(g(_,w),g(p,w),w,!0);return w.skipEscape=!0,v(y,w)}function z(_,p,S,w){let y={};return w||(_=g(v(_,S),S),p=g(v(p,S),S)),S=S||{},!S.tolerant&&p.scheme?(y.scheme=p.scheme,y.userinfo=p.userinfo,y.host=p.host,y.port=p.port,y.path=n(p.path||""),y.query=p.query):(p.userinfo!==void 0||p.host!==void 0||p.port!==void 0?(y.userinfo=p.userinfo,y.host=p.host,y.port=p.port,y.path=n(p.path||""),y.query=p.query):(p.path?(p.path[0]==="/"?y.path=n(p.path):((_.userinfo!==void 0||_.host!==void 0||_.port!==void 0)&&!_.path?y.path="/"+p.path:_.path?y.path=_.path.slice(0,_.path.lastIndexOf("/")+1)+p.path:y.path=p.path,y.path=n(y.path)),y.query=p.query):(y.path=_.path,p.query!==void 0?y.query=p.query:y.query=_.query),y.userinfo=_.userinfo,y.host=_.host,y.port=_.port),y.scheme=_.scheme),y.fragment=p.fragment,y}function R(_,p,S){return typeof _=="string"?(_=unescape(_),_=v(i(g(_,S),!0),{...S,skipEscape:!0})):typeof _=="object"&&(_=v(i(_,!0),{...S,skipEscape:!0})),typeof p=="string"?(p=unescape(p),p=v(i(g(p,S),!0),{...S,skipEscape:!0})):typeof p=="object"&&(p=v(i(p,!0),{...S,skipEscape:!0})),_.toLowerCase()===p.toLowerCase()}function v(_,p){let S={host:_.host,scheme:_.scheme,userinfo:_.userinfo,port:_.port,path:_.path,query:_.query,nid:_.nid,nss:_.nss,uuid:_.uuid,fragment:_.fragment,reference:_.reference,resourceName:_.resourceName,secure:_.secure,error:""},w=Object.assign({},p),y=[],f=l(w.scheme||S.scheme);f&&f.serialize&&f.serialize(S,w),S.path!==void 0&&(w.skipEscape?S.path=unescape(S.path):(S.path=escape(S.path),S.scheme!==void 0&&(S.path=S.path.split("%3A").join(":")))),w.reference!=="suffix"&&S.scheme&&y.push(S.scheme,":");let T=o(S);if(T!==void 0&&(w.reference!=="suffix"&&y.push("//"),y.push(T),S.path&&S.path[0]!=="/"&&y.push("/")),S.path!==void 0){let A=S.path;!w.absolutePath&&(!f||!f.absolutePath)&&(A=n(A)),T===void 0&&A[0]==="/"&&A[1]==="/"&&(A="/%2F"+A.slice(2)),y.push(A)}return S.query!==void 0&&y.push("?",S.query),S.fragment!==void 0&&y.push("#",S.fragment),y.join("")}let b=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function g(_,p){let S=Object.assign({},p),w={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},y=!1;S.reference==="suffix"&&(S.scheme?_=S.scheme+":"+_:_="//"+_);let f=_.match(b);if(f){if(w.scheme=f[1],w.userinfo=f[3],w.host=f[4],w.port=parseInt(f[5],10),w.path=f[6]||"",w.query=f[7],w.fragment=f[8],isNaN(w.port)&&(w.port=f[5]),w.host)if(a(w.host)===!1){let A=r(w.host);w.host=A.host.toLowerCase(),y=A.isIPV6}else y=!0;w.scheme===void 0&&w.userinfo===void 0&&w.host===void 0&&w.port===void 0&&w.query===void 0&&!w.path?w.reference="same-document":w.scheme===void 0?w.reference="relative":w.fragment===void 0?w.reference="absolute":w.reference="uri",S.reference&&S.reference!=="suffix"&&S.reference!==w.reference&&(w.error=w.error||"URI is not a "+S.reference+" reference.");let T=l(S.scheme||w.scheme);if(!S.unicodeSupport&&(!T||!T.unicodeSupport)&&w.host&&(S.domainHost||T&&T.domainHost)&&y===!1&&c(w.host))try{w.host=URL.domainToASCII(w.host.toLowerCase())}catch(A){w.error=w.error||"Host's domain name can not be converted to ASCII: "+A}(!T||T&&!T.skipNormalize)&&(_.indexOf("%")!==-1&&(w.scheme!==void 0&&(w.scheme=unescape(w.scheme)),w.host!==void 0&&(w.host=unescape(w.host))),w.path&&(w.path=escape(unescape(w.path))),w.fragment&&(w.fragment=encodeURI(decodeURIComponent(w.fragment)))),T&&T.parse&&T.parse(w,S)}else w.error=w.error||"URI can not be parsed.";return w}let d={SCHEMES:s,normalize:m,resolve:h,resolveComponent:z,equal:R,serialize:v,parse:g};t.exports=d,t.exports.default=d,t.exports.fastUri=d})),GS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=KS();t.code='require("ajv/dist/runtime/uri").default',e.default=t})),nl=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Xr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});let n=Ro(),o=Qr(),i=Sh(),a=us(),c=de(),s=cs(),l=as(),m=_e(),h=JS(),z=GS(),R=(k,x)=>new RegExp(k,x);R.code="new RegExp";let v=["removeAdditional","useDefaults","coerceTypes"],b=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},d={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},_=200;function p(k){var x,V,$,P,N,H,te,pe,ae,Re,Ge,I,C,U,oe,ie,me,Ne,qe,Fe,Ae,Ie,nt,Ue,_t;let at=k.strict,St=(x=k.code)===null||x===void 0?void 0:x.optimize,Et=St===!0||St===void 0?1:St||0,It=($=(V=k.code)===null||V===void 0?void 0:V.regExp)!==null&&$!==void 0?$:R,Bt=(P=k.uriResolver)!==null&&P!==void 0?P:z.default;return{strictSchema:(H=(N=k.strictSchema)!==null&&N!==void 0?N:at)!==null&&H!==void 0?H:!0,strictNumbers:(pe=(te=k.strictNumbers)!==null&&te!==void 0?te:at)!==null&&pe!==void 0?pe:!0,strictTypes:(Re=(ae=k.strictTypes)!==null&&ae!==void 0?ae:at)!==null&&Re!==void 0?Re:"log",strictTuples:(I=(Ge=k.strictTuples)!==null&&Ge!==void 0?Ge:at)!==null&&I!==void 0?I:"log",strictRequired:(U=(C=k.strictRequired)!==null&&C!==void 0?C:at)!==null&&U!==void 0?U:!1,code:k.code?{...k.code,optimize:Et,regExp:It}:{optimize:Et,regExp:It},loopRequired:(oe=k.loopRequired)!==null&&oe!==void 0?oe:_,loopEnum:(ie=k.loopEnum)!==null&&ie!==void 0?ie:_,meta:(me=k.meta)!==null&&me!==void 0?me:!0,messages:(Ne=k.messages)!==null&&Ne!==void 0?Ne:!0,inlineRefs:(qe=k.inlineRefs)!==null&&qe!==void 0?qe:!0,schemaId:(Fe=k.schemaId)!==null&&Fe!==void 0?Fe:"$id",addUsedSchema:(Ae=k.addUsedSchema)!==null&&Ae!==void 0?Ae:!0,validateSchema:(Ie=k.validateSchema)!==null&&Ie!==void 0?Ie:!0,validateFormats:(nt=k.validateFormats)!==null&&nt!==void 0?nt:!0,unicodeRegExp:(Ue=k.unicodeRegExp)!==null&&Ue!==void 0?Ue:!0,int32range:(_t=k.int32range)!==null&&_t!==void 0?_t:!0,uriResolver:Bt}}var S=class{constructor(k={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,k=this.opts={...k,...p(k)};let{es5:x,lines:V}=this.opts.code;this.scope=new c.ValueScope({scope:{},prefixes:b,es5:x,lines:V}),this.logger=D(k.logger);let $=k.validateFormats;k.validateFormats=!1,this.RULES=(0,i.getRules)(),w.call(this,g,k,"NOT SUPPORTED"),w.call(this,d,k,"DEPRECATED","warn"),this._metaOpts=F.call(this),k.formats&&T.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),k.keywords&&A.call(this,k.keywords),typeof k.meta=="object"&&this.addMetaSchema(k.meta),f.call(this),k.validateFormats=$}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:k,meta:x,schemaId:V}=this.opts,$=h;V==="id"&&($={...h},$.id=$.$id,delete $.$id),x&&k&&this.addMetaSchema($,$[V],!1)}defaultMeta(){let{meta:k,schemaId:x}=this.opts;return this.opts.defaultMeta=typeof k=="object"?k[x]||k:void 0}validate(k,x){let V;if(typeof k=="string"){if(V=this.getSchema(k),!V)throw new Error(`no schema with key or ref "${k}"`)}else V=this.compile(k);let $=V(x);return"$async"in V||(this.errors=V.errors),$}compile(k,x){let V=this._addSchema(k,x);return V.validate||this._compileSchemaEnv(V)}compileAsync(k,x){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:V}=this.opts;return $.call(this,k,x);async function $(ae,Re){await P.call(this,ae.$schema);let Ge=this._addSchema(ae,Re);return Ge.validate||N.call(this,Ge)}async function P(ae){ae&&!this.getSchema(ae)&&await $.call(this,{$ref:ae},!0)}async function N(ae){try{return this._compileSchemaEnv(ae)}catch(Re){if(!(Re instanceof o.default))throw Re;return H.call(this,Re),await te.call(this,Re.missingSchema),N.call(this,ae)}}function H({missingSchema:ae,missingRef:Re}){if(this.refs[ae])throw new Error(`AnySchema ${ae} is loaded but ${Re} cannot be resolved`)}async function te(ae){let Re=await pe.call(this,ae);this.refs[ae]||await P.call(this,Re.$schema),this.refs[ae]||this.addSchema(Re,ae,x)}async function pe(ae){let Re=this._loading[ae];if(Re)return Re;try{return await(this._loading[ae]=V(ae))}finally{delete this._loading[ae]}}}addSchema(k,x,V,$=this.opts.validateSchema){if(Array.isArray(k)){for(let N of k)this.addSchema(N,void 0,V,$);return this}let P;if(typeof k=="object"){let{schemaId:N}=this.opts;if(P=k[N],P!==void 0&&typeof P!="string")throw new Error(`schema ${N} must be string`)}return x=(0,s.normalizeId)(x||P),this._checkUnique(x),this.schemas[x]=this._addSchema(k,V,x,$,!0),this}addMetaSchema(k,x,V=this.opts.validateSchema){return this.addSchema(k,x,!0,V),this}validateSchema(k,x){if(typeof k=="boolean")return!0;let V;if(V=k.$schema,V!==void 0&&typeof V!="string")throw new Error("$schema must be a string");if(V=V||this.opts.defaultMeta||this.defaultMeta(),!V)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let $=this.validate(V,k);if(!$&&x){let P="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(P);else throw new Error(P)}return $}getSchema(k){let x;for(;typeof(x=y.call(this,k))=="string";)k=x;if(x===void 0){let{schemaId:V}=this.opts,$=new a.SchemaEnv({schema:{},schemaId:V});if(x=a.resolveSchema.call(this,$,k),!x)return;this.refs[k]=x}return x.validate||this._compileSchemaEnv(x)}removeSchema(k){if(k instanceof RegExp)return this._removeAllSchemas(this.schemas,k),this._removeAllSchemas(this.refs,k),this;switch(typeof k){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let x=y.call(this,k);return typeof x=="object"&&this._cache.delete(x.schema),delete this.schemas[k],delete this.refs[k],this}case"object":{let x=k;this._cache.delete(x);let V=k[this.opts.schemaId];return V&&(V=(0,s.normalizeId)(V),delete this.schemas[V],delete this.refs[V]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(k){for(let x of k)this.addKeyword(x);return this}addKeyword(k,x){let V;if(typeof k=="string")V=k,typeof x=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),x.keyword=V);else if(typeof k=="object"&&x===void 0){if(x=k,V=x.keyword,Array.isArray(V)&&!V.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(K.call(this,V,x),!x)return(0,m.eachItem)(V,P=>fe.call(this,P)),this;ze.call(this,x);let $={...x,type:(0,l.getJSONTypes)(x.type),schemaType:(0,l.getJSONTypes)(x.schemaType)};return(0,m.eachItem)(V,$.type.length===0?P=>fe.call(this,P,$):P=>$.type.forEach(N=>fe.call(this,P,$,N))),this}getKeyword(k){let x=this.RULES.all[k];return typeof x=="object"?x.definition:!!x}removeKeyword(k){let{RULES:x}=this;delete x.keywords[k],delete x.all[k];for(let V of x.rules){let $=V.rules.findIndex(P=>P.keyword===k);$>=0&&V.rules.splice($,1)}return this}addFormat(k,x){return typeof x=="string"&&(x=new RegExp(x)),this.formats[k]=x,this}errorsText(k=this.errors,{separator:x=", ",dataVar:V="data"}={}){return!k||k.length===0?"No errors":k.map($=>`${V}${$.instancePath} ${$.message}`).reduce(($,P)=>$+x+P)}$dataMetaSchema(k,x){let V=this.RULES.all;k=JSON.parse(JSON.stringify(k));for(let $ of x){let P=$.split("/").slice(1),N=k;for(let H of P)N=N[H];for(let H in V){let te=V[H];if(typeof te!="object")continue;let{$data:pe}=te.definition,ae=N[H];pe&&ae&&(N[H]=ve(ae))}}return k}_removeAllSchemas(k,x){for(let V in k){let $=k[V];(!x||x.test(V))&&(typeof $=="string"?delete k[V]:$&&!$.meta&&(this._cache.delete($.schema),delete k[V]))}}_addSchema(k,x,V,$=this.opts.validateSchema,P=this.opts.addUsedSchema){let N,{schemaId:H}=this.opts;if(typeof k=="object")N=k[H];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof k!="boolean")throw new Error("schema must be object or boolean")}let te=this._cache.get(k);if(te!==void 0)return te;V=(0,s.normalizeId)(N||V);let pe=s.getSchemaRefs.call(this,k,V);return te=new a.SchemaEnv({schema:k,schemaId:H,meta:x,baseId:V,localRefs:pe}),this._cache.set(te.schema,te),P&&!V.startsWith("#")&&(V&&this._checkUnique(V),this.refs[V]=te),$&&this.validateSchema(k,!0),te}_checkUnique(k){if(this.schemas[k]||this.refs[k])throw new Error(`schema with key or id "${k}" already exists`)}_compileSchemaEnv(k){if(k.meta?this._compileMetaSchema(k):a.compileSchema.call(this,k),!k.validate)throw new Error("ajv implementation error");return k.validate}_compileMetaSchema(k){let x=this.opts;this.opts=this._metaOpts;try{a.compileSchema.call(this,k)}finally{this.opts=x}}};S.ValidationError=n.default,S.MissingRefError=o.default,e.default=S;function w(k,x,V,$="error"){for(let P in k){let N=P;N in x&&this.logger[$](`${V}: option ${P}. ${k[N]}`)}}function y(k){return k=(0,s.normalizeId)(k),this.schemas[k]||this.refs[k]}function f(){let k=this.opts.schemas;if(k)if(Array.isArray(k))this.addSchema(k);else for(let x in k)this.addSchema(k[x],x)}function T(){for(let k in this.opts.formats){let x=this.opts.formats[k];x&&this.addFormat(k,x)}}function A(k){if(Array.isArray(k)){this.addVocabulary(k);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let x in k){let V=k[x];V.keyword||(V.keyword=x),this.addKeyword(V)}}function F(){let k={...this.opts};for(let x of v)delete k[x];return k}let M={log(){},warn(){},error(){}};function D(k){if(k===!1)return M;if(k===void 0)return console;if(k.log&&k.warn&&k.error)return k;throw new Error("logger must implement log, warn and error methods")}let Y=/^[a-z_$][a-z0-9_$:-]*$/i;function K(k,x){let{RULES:V}=this;if((0,m.eachItem)(k,$=>{if(V.keywords[$])throw new Error(`Keyword ${$} is already defined`);if(!Y.test($))throw new Error(`Keyword ${$} has invalid name`)}),!!x&&x.$data&&!("code"in x||"validate"in x))throw new Error('$data keyword must have "code" or "validate" function')}function fe(k,x,V){var $;let P=x?.post;if(V&&P)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:N}=this,H=P?N.post:N.rules.find(({type:pe})=>pe===V);if(H||(H={type:V,rules:[]},N.rules.push(H)),N.keywords[k]=!0,!x)return;let te={keyword:k,definition:{...x,type:(0,l.getJSONTypes)(x.type),schemaType:(0,l.getJSONTypes)(x.schemaType)}};x.before?Te.call(this,H,te,x.before):H.rules.push(te),N.all[k]=te,($=x.implements)===null||$===void 0||$.forEach(pe=>this.addKeyword(pe))}function Te(k,x,V){let $=k.rules.findIndex(P=>P.keyword===V);$>=0?k.rules.splice($,0,x):(k.rules.push(x),this.logger.warn(`rule ${V} is not defined`))}function ze(k){let{metaSchema:x}=k;x!==void 0&&(k.$data&&this.opts.$data&&(x=ve(x)),k.validateSchema=this.compile(x,!0))}let Ce={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function ve(k){return{anyOf:[k,Ce]}}})),WS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};e.default=t})),ol=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.callRef=e.getValidate=void 0;let t=Qr(),r=mt(),n=de(),o=dt(),i=us(),a=_e(),c={keyword:"$ref",schemaType:"string",code(m){let{gen:h,schema:z,it:R}=m,{baseId:v,schemaEnv:b,validateName:g,opts:d,self:_}=R,{root:p}=b;if((z==="#"||z==="#/")&&v===p.baseId)return w();let S=i.resolveRef.call(_,p,v,z);if(S===void 0)throw new t.default(R.opts.uriResolver,v,z);if(S instanceof i.SchemaEnv)return y(S);return f(S);function w(){if(b===p)return l(m,g,b,b.$async);let T=h.scopeValue("root",{ref:p});return l(m,(0,n._)`${T}.validate`,p,p.$async)}function y(T){l(m,s(m,T),T,T.$async)}function f(T){let A=h.scopeValue("schema",d.code.source===!0?{ref:T,code:(0,n.stringify)(T)}:{ref:T}),F=h.name("valid"),M=m.subschema({schema:T,dataTypes:[],schemaPath:n.nil,topSchemaRef:A,errSchemaPath:z},F);m.mergeEvaluated(M),m.ok(F)}}};function s(m,h){let{gen:z}=m;return h.validate?z.scopeValue("validate",{ref:h.validate}):(0,n._)`${z.scopeValue("wrapper",{ref:h})}.validate`}e.getValidate=s;function l(m,h,z,R){let{gen:v,it:b}=m,{allErrors:g,schemaEnv:d,opts:_}=b,p=_.passContext?o.default.this:n.nil;R?S():w();function S(){if(!d.$async)throw new Error("async schema referenced by sync schema");let T=v.let("valid");v.try(()=>{v.code((0,n._)`await ${(0,r.callValidateCode)(m,h,p)}`),f(h),g||v.assign(T,!0)},A=>{v.if((0,n._)`!(${A} instanceof ${b.ValidationError})`,()=>v.throw(A)),y(A),g||v.assign(T,!1)}),m.ok(T)}function w(){m.result((0,r.callValidateCode)(m,h,p),()=>f(h),()=>y(h))}function y(T){let A=(0,n._)`${T}.errors`;v.assign(o.default.vErrors,(0,n._)`${o.default.vErrors} === null ? ${A} : ${o.default.vErrors}.concat(${A})`),v.assign(o.default.errors,(0,n._)`${o.default.vErrors}.length`)}function f(T){var A;if(!b.opts.unevaluated)return;let F=(A=z?.validate)===null||A===void 0?void 0:A.evaluated;if(b.props!==!0)if(F&&!F.dynamicProps)F.props!==void 0&&(b.props=a.mergeEvaluated.props(v,F.props,b.props));else{let M=v.var("props",(0,n._)`${T}.evaluated.props`);b.props=a.mergeEvaluated.props(v,M,b.props,n.Name)}if(b.items!==!0)if(F&&!F.dynamicItems)F.items!==void 0&&(b.items=a.mergeEvaluated.items(v,F.items,b.items));else{let M=v.var("items",(0,n._)`${T}.evaluated.items`);b.items=a.mergeEvaluated.items(v,M,b.items,n.Name)}}}e.callRef=l,e.default=c})),zh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=WS(),r=ol(),n=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",t.default,r.default];e.default=n})),YS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=t.operators,n={maximum:{okStr:"<=",ok:r.LTE,fail:r.GT},minimum:{okStr:">=",ok:r.GTE,fail:r.LT},exclusiveMaximum:{okStr:"<",ok:r.LT,fail:r.GTE},exclusiveMinimum:{okStr:">",ok:r.GT,fail:r.LTE}},o={keyword:Object.keys(n),type:"number",schemaType:"number",$data:!0,error:{message:({keyword:i,schemaCode:a})=>(0,t.str)`must be ${n[i].okStr} ${a}`,params:({keyword:i,schemaCode:a})=>(0,t._)`{comparison: ${n[i].okStr}, limit: ${a}}`},code(i){let{keyword:a,data:c,schemaCode:s}=i;i.fail$data((0,t._)`${c} ${n[a].fail} ${s} || isNaN(${c})`)}};e.default=o})),XS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must be multiple of ${n}`,params:({schemaCode:n})=>(0,t._)`{multipleOf: ${n}}`},code(n){let{gen:o,data:i,schemaCode:a,it:c}=n,s=c.opts.multipleOfPrecision,l=o.let("res"),m=s?(0,t._)`Math.abs(Math.round(${l}) - ${l}) > 1e-${s}`:(0,t._)`${l} !== parseInt(${l})`;n.fail$data((0,t._)`(${a} === 0 || (${l} = ${i}/${a}, ${m}))`)}};e.default=r})),QS=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});function t(r){let n=r.length,o=0,i=0,a;for(;i=55296&&a<=56319&&i{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n=QS(),o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:{message({keyword:i,schemaCode:a}){let c=i==="maxLength"?"more":"fewer";return(0,t.str)`must NOT have ${c} than ${a} characters`},params:({schemaCode:i})=>(0,t._)`{limit: ${i}}`},code(i){let{keyword:a,data:c,schemaCode:s,it:l}=i,m=a==="maxLength"?t.operators.GT:t.operators.LT,h=l.opts.unicode===!1?(0,t._)`${c}.length`:(0,t._)`${(0,r.useFunc)(i.gen,n.default)}(${c})`;i.fail$data((0,t._)`${h} ${m} ${s}`)}};e.default=o})),ty=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=_e(),n=de(),o={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:i})=>(0,n.str)`must match pattern "${i}"`,params:({schemaCode:i})=>(0,n._)`{pattern: ${i}}`},code(i){let{gen:a,data:c,$data:s,schema:l,schemaCode:m,it:h}=i,z=h.opts.unicodeRegExp?"u":"";if(s){let{regExp:R}=h.opts.code,v=R.code==="new RegExp"?(0,n._)`new RegExp`:(0,r.useFunc)(a,R),b=a.let("valid");a.try(()=>a.assign(b,(0,n._)`${v}(${m}, ${z}).test(${c})`),()=>a.assign(b,!1)),i.fail$data((0,n._)`!${b}`)}else{let R=(0,t.usePattern)(i,l);i.fail$data((0,n._)`!${R}.test(${c})`)}}};e.default=o})),ry=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let i=n==="maxProperties"?"more":"fewer";return(0,t.str)`must NOT have ${i} than ${o} properties`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){let{keyword:o,data:i,schemaCode:a}=n,c=o==="maxProperties"?t.operators.GT:t.operators.LT;n.fail$data((0,t._)`Object.keys(${i}).length ${c} ${a}`)}};e.default=r})),ny=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=de(),n=_e(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:i}})=>(0,r.str)`must have required property '${i}'`,params:({params:{missingProperty:i}})=>(0,r._)`{missingProperty: ${i}}`},code(i){let{gen:a,schema:c,schemaCode:s,data:l,$data:m,it:h}=i,{opts:z}=h;if(!m&&c.length===0)return;let R=c.length>=z.loopRequired;if(h.allErrors?v():b(),z.strictRequired){let _=i.parentSchema.properties,{definedProperties:p}=i.it;for(let S of c)if(_?.[S]===void 0&&!p.has(S)){let w=`required property "${S}" is not defined at "${h.schemaEnv.baseId+h.errSchemaPath}" (strictRequired)`;(0,n.checkStrictMode)(h,w,h.opts.strictRequired)}}function v(){if(R||m)i.block$data(r.nil,g);else for(let _ of c)(0,t.checkReportMissingProp)(i,_)}function b(){let _=a.let("missing");if(R||m){let p=a.let("valid",!0);i.block$data(p,()=>d(_,p)),i.ok(p)}else a.if((0,t.checkMissingProp)(i,c,_)),(0,t.reportMissingProp)(i,_),a.else()}function g(){a.forOf("prop",s,_=>{i.setParams({missingProperty:_}),a.if((0,t.noPropertyInData)(a,l,_,z.ownProperties),()=>i.error())})}function d(_,p){i.setParams({missingProperty:_}),a.forOf(_,s,()=>{a.assign(p,(0,t.propertyInData)(a,l,_,z.ownProperties)),a.if((0,r.not)(p),()=>{i.error(),a.break()})},r.nil)}}};e.default=o})),oy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:{message({keyword:n,schemaCode:o}){let i=n==="maxItems"?"more":"fewer";return(0,t.str)`must NOT have ${i} than ${o} items`},params:({schemaCode:n})=>(0,t._)`{limit: ${n}}`},code(n){let{keyword:o,data:i,schemaCode:a}=n,c=o==="maxItems"?t.operators.GT:t.operators.LT;n.fail$data((0,t._)`${i}.length ${c} ${a}`)}};e.default=r})),il=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=bh();t.code='require("ajv/dist/runtime/equal").default',e.default=t})),iy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=as(),r=de(),n=_e(),o=il(),i={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:a,j:c}})=>(0,r.str)`must NOT have duplicate items (items ## ${c} and ${a} are identical)`,params:({params:{i:a,j:c}})=>(0,r._)`{i: ${a}, j: ${c}}`},code(a){let{gen:c,data:s,$data:l,schema:m,parentSchema:h,schemaCode:z,it:R}=a;if(!l&&!m)return;let v=c.let("valid"),b=h.items?(0,t.getSchemaTypes)(h.items):[];a.block$data(v,g,(0,r._)`${z} === false`),a.ok(v);function g(){let S=c.let("i",(0,r._)`${s}.length`),w=c.let("j");a.setParams({i:S,j:w}),c.assign(v,!0),c.if((0,r._)`${S} > 1`,()=>(d()?_:p)(S,w))}function d(){return b.length>0&&!b.some(S=>S==="object"||S==="array")}function _(S,w){let y=c.name("item"),f=(0,t.checkDataTypes)(b,y,R.opts.strictNumbers,t.DataType.Wrong),T=c.const("indices",(0,r._)`{}`);c.for((0,r._)`;${S}--;`,()=>{c.let(y,(0,r._)`${s}[${S}]`),c.if(f,(0,r._)`continue`),b.length>1&&c.if((0,r._)`typeof ${y} == "string"`,(0,r._)`${y} += "_"`),c.if((0,r._)`typeof ${T}[${y}] == "number"`,()=>{c.assign(w,(0,r._)`${T}[${y}]`),a.error(),c.assign(v,!1).break()}).code((0,r._)`${T}[${y}] = ${S}`)})}function p(S,w){let y=(0,n.useFunc)(c,o.default),f=c.name("outer");c.label(f).for((0,r._)`;${S}--;`,()=>c.for((0,r._)`${w} = ${S}; ${w}--;`,()=>c.if((0,r._)`${y}(${s}[${S}], ${s}[${w}])`,()=>{a.error(),c.assign(v,!1).break(f)})))}}};e.default=i})),ay=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n=il(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:i})=>(0,t._)`{allowedValue: ${i}}`},code(i){let{gen:a,data:c,$data:s,schemaCode:l,schema:m}=i;s||m&&typeof m=="object"?i.fail$data((0,t._)`!${(0,r.useFunc)(a,n.default)}(${c}, ${l})`):i.fail((0,t._)`${m} !== ${c}`)}};e.default=o})),sy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n=il(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:i})=>(0,t._)`{allowedValues: ${i}}`},code(i){let{gen:a,data:c,$data:s,schema:l,schemaCode:m,it:h}=i;if(!s&&l.length===0)throw new Error("enum must have non-empty array");let z=l.length>=h.opts.loopEnum,R,v=()=>R??(R=(0,r.useFunc)(a,n.default)),b;if(z||s)b=a.let("valid"),i.block$data(b,g);else{if(!Array.isArray(l))throw new Error("ajv implementation error");let _=a.const("vSchema",m);b=(0,t.or)(...l.map((p,S)=>d(_,S)))}i.pass(b);function g(){a.assign(b,!1),a.forOf("v",m,_=>a.if((0,t._)`${v()}(${c}, ${_})`,()=>a.assign(b,!0).break()))}function d(_,p){let S=l[p];return typeof S=="object"&&S!==null?(0,t._)`${v()}(${c}, ${_}[${p}])`:(0,t._)`${c} === ${S}`}}};e.default=o})),Rh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=YS(),r=XS(),n=ey(),o=ty(),i=ry(),a=ny(),c=oy(),s=iy(),l=ay(),m=sy(),h=[t.default,r.default,n.default,o.default,i.default,a.default,c.default,s.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},l.default,m.default];e.default=h})),wh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateAdditionalItems=void 0;let t=de(),r=_e(),n={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:i}})=>(0,t.str)`must NOT have more than ${i} items`,params:({params:{len:i}})=>(0,t._)`{limit: ${i}}`},code(i){let{parentSchema:a,it:c}=i,{items:s}=a;if(!Array.isArray(s)){(0,r.checkStrictMode)(c,'"additionalItems" is ignored when "items" is not an array of schemas');return}o(i,s)}};function o(i,a){let{gen:c,schema:s,data:l,keyword:m,it:h}=i;h.items=!0;let z=c.const("len",(0,t._)`${l}.length`);if(s===!1)i.setParams({len:a.length}),i.pass((0,t._)`${z} <= ${a.length}`);else if(typeof s=="object"&&!(0,r.alwaysValidSchema)(h,s)){let v=c.var("valid",(0,t._)`${z} <= ${a.length}`);c.if((0,t.not)(v),()=>R(v)),i.ok(v)}function R(v){c.forRange("i",a.length,z,b=>{i.subschema({keyword:m,dataProp:b,dataPropType:r.Type.Num},v),h.allErrors||c.if((0,t.not)(v),()=>c.break())})}}e.validateAdditionalItems=o,e.default=n})),Th=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateTuple=void 0;let t=de(),r=_e(),n=mt(),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(a){let{schema:c,it:s}=a;if(Array.isArray(c))return i(a,"additionalItems",c);s.items=!0,!(0,r.alwaysValidSchema)(s,c)&&a.ok((0,n.validateArray)(a))}};function i(a,c,s=a.schema){let{gen:l,parentSchema:m,data:h,keyword:z,it:R}=a;g(m),R.opts.unevaluated&&s.length&&R.items!==!0&&(R.items=r.mergeEvaluated.items(l,s.length,R.items));let v=l.name("valid"),b=l.const("len",(0,t._)`${h}.length`);s.forEach((d,_)=>{(0,r.alwaysValidSchema)(R,d)||(l.if((0,t._)`${b} > ${_}`,()=>a.subschema({keyword:z,schemaProp:_,dataProp:_},v)),a.ok(v))});function g(d){let{opts:_,errSchemaPath:p}=R,S=s.length,w=S===d.minItems&&(S===d.maxItems||d[c]===!1);if(_.strictTuples&&!w){let y=`"${z}" is ${S}-tuple, but minItems or maxItems/${c} are not specified or different at path "${p}"`;(0,r.checkStrictMode)(R,y,_.strictTuples)}}}e.validateTuple=i,e.default=o})),cy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Th(),r={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:n=>(0,t.validateTuple)(n,"items")};e.default=r})),uy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n=mt(),o=wh(),i={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:a}})=>(0,t.str)`must NOT have more than ${a} items`,params:({params:{len:a}})=>(0,t._)`{limit: ${a}}`},code(a){let{schema:c,parentSchema:s,it:l}=a,{prefixItems:m}=s;l.items=!0,!(0,r.alwaysValidSchema)(l,c)&&(m?(0,o.validateAdditionalItems)(a,m):a.ok((0,n.validateArray)(a)))}};e.default=i})),ly=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:o,max:i}})=>i===void 0?(0,t.str)`must contain at least ${o} valid item(s)`:(0,t.str)`must contain at least ${o} and no more than ${i} valid item(s)`,params:({params:{min:o,max:i}})=>i===void 0?(0,t._)`{minContains: ${o}}`:(0,t._)`{minContains: ${o}, maxContains: ${i}}`},code(o){let{gen:i,schema:a,parentSchema:c,data:s,it:l}=o,m,h,{minContains:z,maxContains:R}=c;l.opts.next?(m=z===void 0?1:z,h=R):m=1;let v=i.const("len",(0,t._)`${s}.length`);if(o.setParams({min:m,max:h}),h===void 0&&m===0){(0,r.checkStrictMode)(l,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(h!==void 0&&m>h){(0,r.checkStrictMode)(l,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,r.alwaysValidSchema)(l,a)){let p=(0,t._)`${v} >= ${m}`;h!==void 0&&(p=(0,t._)`${p} && ${v} <= ${h}`),o.pass(p);return}l.items=!0;let b=i.name("valid");h===void 0&&m===1?d(b,()=>i.if(b,()=>i.break())):m===0?(i.let(b,!0),h!==void 0&&i.if((0,t._)`${s}.length > 0`,g)):(i.let(b,!1),g()),o.result(b,()=>o.reset());function g(){let p=i.name("_valid"),S=i.let("count",0);d(p,()=>i.if(p,()=>_(S)))}function d(p,S){i.forRange("i",0,v,w=>{o.subschema({keyword:"contains",dataProp:w,dataPropType:r.Type.Num,compositeRule:!0},p),S()})}function _(p){i.code((0,t._)`${p}++`),h===void 0?i.if((0,t._)`${p} >= ${m}`,()=>i.assign(b,!0).break()):(i.if((0,t._)`${p} > ${h}`,()=>i.assign(b,!1).break()),m===1?i.assign(b,!0):i.if((0,t._)`${p} >= ${m}`,()=>i.assign(b,!0)))}}};e.default=n})),al=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;let t=de(),r=_e(),n=mt();e.error={message:({params:{property:s,depsCount:l,deps:m}})=>{let h=l===1?"property":"properties";return(0,t.str)`must have ${h} ${m} when property ${s} is present`},params:({params:{property:s,depsCount:l,deps:m,missingProperty:h}})=>(0,t._)`{property: ${s}, missingProperty: ${h}, depsCount: ${l}, - deps: ${m}}`};let o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(s){let[l,m]=i(s);a(s,l),c(s,m)}};function i({schema:s}){let l={},m={};for(let h in s){if(h==="__proto__")continue;let z=Array.isArray(s[h])?l:m;z[h]=s[h]}return[l,m]}function a(s,l=s.schema){let{gen:m,data:h,it:z}=s;if(Object.keys(l).length===0)return;let R=m.let("missing");for(let v in l){let b=l[v];if(b.length===0)continue;let g=(0,n.propertyInData)(m,h,v,z.opts.ownProperties);s.setParams({property:v,depsCount:b.length,deps:b.join(", ")}),z.allErrors?m.if(g,()=>{for(let d of b)(0,n.checkReportMissingProp)(s,d)}):(m.if((0,t._)`${g} && (${(0,n.checkMissingProp)(s,b,R)})`),(0,n.reportMissingProp)(s,R),m.else())}}e.validatePropertyDeps=a;function c(s,l=s.schema){let{gen:m,data:h,keyword:z,it:R}=s,v=m.name("valid");for(let b in l)(0,r.alwaysValidSchema)(R,l[b])||(m.if((0,n.propertyInData)(m,h,b,R.opts.ownProperties),()=>{let g=s.subschema({keyword:z,schemaProp:b},v);s.mergeValidEvaluated(g,v)},()=>m.var(v,!0)),s.ok(v))}e.validateSchemaDeps=c,e.default=o})),dy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>(0,t._)`{propertyName: ${o.propertyName}}`},code(o){let{gen:i,schema:a,data:c,it:s}=o;if((0,r.alwaysValidSchema)(s,a))return;let l=i.name("valid");i.forIn("key",c,m=>{o.setParams({propertyName:m}),o.subschema({keyword:"propertyNames",data:m,dataTypes:["string"],propertyName:m,compositeRule:!0},l),i.if((0,t.not)(l),()=>{o.error(!0),s.allErrors||i.break()})}),o.ok(l)}};e.default=n})),Eh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=de(),n=dt(),o=_e(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>(0,r._)`{additionalProperty: ${a.additionalProperty}}`},code(a){let{gen:c,schema:s,parentSchema:l,data:m,errsCount:h,it:z}=a;if(!h)throw new Error("ajv implementation error");let{allErrors:R,opts:v}=z;if(z.props=!0,v.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(z,s))return;let b=(0,t.allSchemaProperties)(l.properties),g=(0,t.allSchemaProperties)(l.patternProperties);d(),a.ok((0,r._)`${h} === ${n.default.errors}`);function d(){c.forIn("key",m,y=>{!b.length&&!g.length?S(y):c.if(_(y),()=>S(y))})}function _(y){let f;if(b.length>8){let T=(0,o.schemaRefOrVal)(z,l.properties,"properties");f=(0,t.isOwnProperty)(c,T,y)}else b.length?f=(0,r.or)(...b.map(T=>(0,r._)`${y} === ${T}`)):f=r.nil;return g.length&&(f=(0,r.or)(f,...g.map(T=>(0,r._)`${(0,t.usePattern)(a,T)}.test(${y})`))),(0,r.not)(f)}function p(y){c.code((0,r._)`delete ${m}[${y}]`)}function S(y){if(v.removeAdditional==="all"||v.removeAdditional&&s===!1){p(y);return}if(s===!1){a.setParams({additionalProperty:y}),a.error(),R||c.break();return}if(typeof s=="object"&&!(0,o.alwaysValidSchema)(z,s)){let f=c.name("valid");v.removeAdditional==="failing"?(w(y,f,!1),c.if((0,r.not)(f),()=>{a.reset(),p(y)})):(w(y,f),R||c.if((0,r.not)(f),()=>c.break()))}}function w(y,f,T){let A={keyword:"additionalProperties",dataProp:y,dataPropType:o.Type.Str};T===!1&&Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(A,f)}}};e.default=i})),my=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xr(),r=mt(),n=_e(),o=Eh(),i={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:c,schema:s,parentSchema:l,data:m,it:h}=a;h.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&o.default.code(new t.KeywordCxt(h,o.default,"additionalProperties"));let z=(0,r.allSchemaProperties)(s);for(let d of z)h.definedProperties.add(d);h.opts.unevaluated&&z.length&&h.props!==!0&&(h.props=n.mergeEvaluated.props(c,(0,n.toHash)(z),h.props));let R=z.filter(d=>!(0,n.alwaysValidSchema)(h,s[d]));if(R.length===0)return;let v=c.name("valid");for(let d of R)b(d)?g(d):(c.if((0,r.propertyInData)(c,m,d,h.opts.ownProperties)),g(d),h.allErrors||c.else().var(v,!0),c.endIf()),a.it.definedProperties.add(d),a.ok(v);function b(d){return h.opts.useDefaults&&!h.compositeRule&&s[d].default!==void 0}function g(d){a.subschema({keyword:"properties",schemaProp:d,dataProp:d},v)}}};e.default=i})),py=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=de(),n=_e(),o=_e(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:c,schema:s,data:l,parentSchema:m,it:h}=a,{opts:z}=h,R=(0,t.allSchemaProperties)(s),v=R.filter(w=>(0,n.alwaysValidSchema)(h,s[w]));if(R.length===0||v.length===R.length&&(!h.opts.unevaluated||h.props===!0))return;let b=z.strictSchema&&!z.allowMatchingProperties&&m.properties,g=c.name("valid");h.props!==!0&&!(h.props instanceof r.Name)&&(h.props=(0,o.evaluatedPropsToName)(c,h.props));let{props:d}=h;_();function _(){for(let w of R)b&&p(w),h.allErrors?S(w):(c.var(g,!0),S(w),c.if(g))}function p(w){for(let y in b)new RegExp(w).test(y)&&(0,n.checkStrictMode)(h,`property ${y} matches pattern ${w} (use allowMatchingProperties)`)}function S(w){c.forIn("key",l,y=>{c.if((0,r._)`${(0,t.usePattern)(a,w)}.test(${y})`,()=>{let f=v.includes(w);f||a.subschema({keyword:"patternProperties",schemaProp:w,dataProp:y,dataPropType:o.Type.Str},g),h.opts.unevaluated&&d!==!0?c.assign((0,r._)`${d}[${y}]`,!0):!f&&!h.allErrors&&c.if((0,r.not)(g),()=>c.break())})})}}};e.default=i})),fy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:o,schema:i,it:a}=n;if((0,t.alwaysValidSchema)(a,i)){n.fail();return}let c=o.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),n.failResult(c,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r})),hy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:mt().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t})),gy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>(0,t._)`{passingSchemas: ${o.passing}}`},code(o){let{gen:i,schema:a,parentSchema:c,it:s}=o;if(!Array.isArray(a))throw new Error("ajv implementation error");if(s.opts.discriminator&&c.discriminator)return;let l=a,m=i.let("valid",!1),h=i.let("passing",null),z=i.name("_valid");o.setParams({passing:h}),i.block(R),o.result(m,()=>o.reset(),()=>o.error(!0));function R(){l.forEach((v,b)=>{let g;(0,r.alwaysValidSchema)(s,v)?i.var(z,!0):g=o.subschema({keyword:"oneOf",schemaProp:b,compositeRule:!0},z),b>0&&i.if((0,t._)`${z} && ${m}`).assign(m,!1).assign(h,(0,t._)`[${h}, ${b}]`).else(),i.if(z,()=>{i.assign(m,!0),i.assign(h,b),g&&o.mergeEvaluated(g,t.Name)})})}}};e.default=n})),vy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:o,schema:i,it:a}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");let c=o.name("valid");i.forEach((s,l)=>{if((0,t.alwaysValidSchema)(a,s))return;let m=n.subschema({keyword:"allOf",schemaProp:l},c);n.ok(c),n.mergeEvaluated(m)})}};e.default=r})),_y=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,t.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,t._)`{failingKeyword: ${i.ifClause}}`},code(i){let{gen:a,parentSchema:c,it:s}=i;c.then===void 0&&c.else===void 0&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');let l=o(s,"then"),m=o(s,"else");if(!l&&!m)return;let h=a.let("valid",!0),z=a.name("_valid");if(R(),i.reset(),l&&m){let b=a.let("ifClause");i.setParams({ifClause:b}),a.if(z,v("then",b),v("else",b))}else l?a.if(z,v("then")):a.if((0,t.not)(z),v("else"));i.pass(h,()=>i.error(!0));function R(){let b=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);i.mergeEvaluated(b)}function v(b,g){return()=>{let d=i.subschema({keyword:b},z);a.assign(h,z),i.mergeValidEvaluated(d,h),g?a.assign(g,(0,t._)`${b}`):i.setParams({ifClause:b})}}}};function o(i,a){let c=i.schema[a];return c!==void 0&&!(0,r.alwaysValidSchema)(i,c)}e.default=n})),Sy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:o,it:i}){o.if===void 0&&(0,t.checkStrictMode)(i,`"${n}" without "if" is ignored`)}};e.default=r})),Ih=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=wh(),r=cy(),n=Th(),o=uy(),i=ly(),a=al(),c=dy(),s=Eh(),l=my(),m=py(),h=fy(),z=hy(),R=gy(),v=vy(),b=_y(),g=Sy();function d(_=!1){let p=[h.default,z.default,R.default,v.default,b.default,g.default,c.default,s.default,a.default,l.default,m.default];return _?p.push(r.default,o.default):p.push(t.default,n.default),p.push(i.default),p}e.default=d})),yy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must match format "${n}"`,params:({schemaCode:n})=>(0,t._)`{format: ${n}}`},code(n,o){let{gen:i,data:a,$data:c,schema:s,schemaCode:l,it:m}=n,{opts:h,errSchemaPath:z,schemaEnv:R,self:v}=m;if(!h.validateFormats)return;c?b():g();function b(){let d=i.scopeValue("formats",{ref:v.formats,code:h.code.formats}),_=i.const("fDef",(0,t._)`${d}[${l}]`),p=i.let("fType"),S=i.let("format");i.if((0,t._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>i.assign(p,(0,t._)`${_}.type || "string"`).assign(S,(0,t._)`${_}.validate`),()=>i.assign(p,(0,t._)`"string"`).assign(S,_)),n.fail$data((0,t.or)(w(),y()));function w(){return h.strictSchema===!1?t.nil:(0,t._)`${l} && !${S}`}function y(){let f=R.$async?(0,t._)`(${_}.async ? await ${S}(${a}) : ${S}(${a}))`:(0,t._)`${S}(${a})`,T=(0,t._)`(typeof ${S} == "function" ? ${f} : ${S}.test(${a}))`;return(0,t._)`${S} && ${S} !== true && ${p} === ${o} && !${T}`}}function g(){let d=v.formats[s];if(!d){w();return}if(d===!0)return;let[_,p,S]=y(d);_===o&&n.pass(f());function w(){if(h.strictSchema===!1){v.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${s}" ignored in schema at path "${z}"`}}function y(T){let A=T instanceof RegExp?(0,t.regexpCode)(T):h.code.formats?(0,t._)`${h.code.formats}${(0,t.getProperty)(s)}`:void 0,F=i.scopeValue("formats",{key:s,ref:T,code:A});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,t._)`${F}.validate`]:["string",T,F]}function f(){if(typeof d=="object"&&!(d instanceof RegExp)&&d.async){if(!R.$async)throw new Error("async format in sync schema");return(0,t._)`await ${S}(${a})`}return typeof p=="function"?(0,t._)`${S}(${a})`:(0,t._)`${S}.test(${a})`}}}};e.default=r})),Ph=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[yy().default];e.default=t})),kh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]})),Oh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zh(),r=Rh(),n=Ih(),o=Ph(),i=kh(),a=[t.default,r.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];e.default=a})),by=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))})),sl=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=by(),n=us(),o=Qr(),i=_e(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:s}})=>c===r.DiscrError.Tag?`tag "${s}" must be string`:`value of tag "${s}" must be in oneOf`,params:({params:{discrError:c,tag:s,tagName:l}})=>(0,t._)`{error: ${c}, tag: ${l}, tagValue: ${s}}`},code(c){let{gen:s,data:l,schema:m,parentSchema:h,it:z}=c,{oneOf:R}=h;if(!z.opts.discriminator)throw new Error("discriminator: requires discriminator option");let v=m.propertyName;if(typeof v!="string")throw new Error("discriminator: requires propertyName");if(m.mapping)throw new Error("discriminator: mapping is not supported");if(!R)throw new Error("discriminator: requires oneOf keyword");let b=s.let("valid",!1),g=s.const("tag",(0,t._)`${l}${(0,t.getProperty)(v)}`);s.if((0,t._)`typeof ${g} == "string"`,()=>d(),()=>c.error(!1,{discrError:r.DiscrError.Tag,tag:g,tagName:v})),c.ok(b);function d(){let S=p();s.if(!1);for(let w in S)s.elseIf((0,t._)`${g} === ${w}`),s.assign(b,_(S[w]));s.else(),c.error(!1,{discrError:r.DiscrError.Mapping,tag:g,tagName:v}),s.endIf()}function _(S){let w=s.name("valid"),y=c.subschema({keyword:"oneOf",schemaProp:S},w);return c.mergeEvaluated(y,t.Name),w}function p(){var S;let w={},y=T(h),f=!0;for(let M=0;M{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}})),jh=L(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=nl(),n=Oh(),o=sl(),i=$y(),a=["/properties"],c="http://json-schema.org/draft-07/schema";var s=class extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(R=>this.addVocabulary(R)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let R=this.opts.$data?this.$dataMetaSchema(i,a):i;this.addMetaSchema(R,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=s,t.exports=e=s,t.exports.Ajv=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var l=Xr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var m=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=Ro();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return h.default}});var z=Qr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return z.default}})})),Nh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=de(),r=dt(),n=us(),o=ol(),i={keyword:"$dynamicAnchor",schemaType:"string",code:s=>a(s,s.schema)};function a(s,l){let{gen:m,it:h}=s;h.schemaEnv.root.dynamicAnchors[l]=!0;let z=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`,R=h.errSchemaPath==="#"?h.validateName:c(s);m.if((0,t._)`!${z}`,()=>m.assign(z,R))}e.dynamicAnchor=a;function c(s){let{schemaEnv:l,schema:m,self:h}=s.it,{root:z,baseId:R,localRefs:v,meta:b}=l.root,{schemaId:g}=h.opts,d=new n.SchemaEnv({schema:m,schemaId:g,root:z,baseId:R,localRefs:v,meta:b});return n.compileSchema.call(h,d),(0,o.getValidate)(s,d)}e.default=i})),xh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=de(),r=dt(),n=ol(),o={keyword:"$dynamicRef",schemaType:"string",code:a=>i(a,a.schema)};function i(a,c){let{gen:s,keyword:l,it:m}=a;if(c[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);let h=c.slice(1);if(m.allErrors)z();else{let v=s.let("valid",!1);z(v),a.ok(v)}function z(v){if(m.schemaEnv.root.dynamicAnchors[h]){let b=s.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(h)}`);s.if(b,R(b,v),R(m.validateName,v))}else R(m.validateName,v)()}function R(v,b){return b?()=>s.block(()=>{(0,n.callRef)(a,v),s.let(b,!0)}):()=>(0,n.callRef)(a,v)}}e.dynamicRef=i,e.default=o})),zy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Nh(),r=_e(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(o){o.schema?(0,t.dynamicAnchor)(o,""):(0,r.checkStrictMode)(o.it,"$recursiveAnchor: false is ignored")}};e.default=n})),Ry=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xh(),r={keyword:"$recursiveRef",schemaType:"string",code:n=>(0,t.dynamicRef)(n,n.schema)};e.default=r})),Ch=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Nh(),r=xh(),n=zy(),o=Ry(),i=[t.default,r.default,n.default,o.default];e.default=i})),wy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=al(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:n=>(0,t.validatePropertyDeps)(n)};e.default=r})),Ty=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=al(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:n=>(0,t.validateSchemaDeps)(n)};e.default=r})),Ey=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:o,it:i}){o.contains===void 0&&(0,t.checkStrictMode)(i,`"${n}" without "contains" is ignored`)}};e.default=r})),Ah=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=wy(),r=Ty(),n=Ey(),o=[t.default,r.default,n.default];e.default=o})),Iy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n=dt(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>(0,t._)`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){let{gen:a,schema:c,data:s,errsCount:l,it:m}=i;if(!l)throw new Error("ajv implementation error");let{allErrors:h,props:z}=m;z instanceof t.Name?a.if((0,t._)`${z} !== true`,()=>a.forIn("key",s,g=>a.if(v(z,g),()=>R(g)))):z!==!0&&a.forIn("key",s,g=>z===void 0?R(g):a.if(b(z,g),()=>R(g))),m.props=!0,i.ok((0,t._)`${l} === ${n.default.errors}`);function R(g){if(c===!1){i.setParams({unevaluatedProperty:g}),i.error(),h||a.break();return}if(!(0,r.alwaysValidSchema)(m,c)){let d=a.name("valid");i.subschema({keyword:"unevaluatedProperties",dataProp:g,dataPropType:r.Type.Str},d),h||a.if((0,t.not)(d),()=>a.break())}}function v(g,d){return(0,t._)`!${g} || !${g}[${d}]`}function b(g,d){let _=[];for(let p in g)g[p]===!0&&_.push((0,t._)`${d} !== ${p}`);return(0,t.and)(..._)}}};e.default=o})),Py=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>(0,t.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,t._)`{limit: ${o}}`},code(o){let{gen:i,schema:a,data:c,it:s}=o,l=s.items||0;if(l===!0)return;let m=i.const("len",(0,t._)`${c}.length`);if(a===!1)o.setParams({len:l}),o.fail((0,t._)`${m} > ${l}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(s,a)){let z=i.var("valid",(0,t._)`${m} <= ${l}`);i.if((0,t.not)(z),()=>h(z,l)),o.ok(z)}s.items=!0;function h(z,R){i.forRange("i",R,m,v=>{o.subschema({keyword:"unevaluatedItems",dataProp:v,dataPropType:r.Type.Num},z),s.allErrors||i.if((0,t.not)(z),()=>i.break())})}}};e.default=n})),qh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Iy(),r=Py(),n=[t.default,r.default];e.default=n})),ky=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}})),Oy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}})),jy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}})),Ny=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}})),xy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}})),Cy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),Ay=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),qy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ky(),r=Oy(),n=jy(),o=Ny(),i=xy(),a=Cy(),c=Ay(),s=["/properties"];function l(m){return[t,r,n,o,h(this,i),a,h(this,c)].forEach(z=>this.addMetaSchema(z,void 0,!1)),this;function h(z,R){return m?z.$dataMetaSchema(R,s):R}}e.default=l})),My=L(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=nl(),n=Oh(),o=Ch(),i=Ah(),a=qh(),c=sl(),s=qy(),l="https://json-schema.org/draft/2019-09/schema";var m=class extends r.default{constructor(b={}){super({...b,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(o.default),n.default.forEach(b=>this.addVocabulary(b)),this.addVocabulary(i.default),this.addVocabulary(a.default),this.opts.discriminator&&this.addKeyword(c.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:b,meta:g}=this.opts;g&&(s.default.call(this,b),this.refs["http://json-schema.org/schema"]=l)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};e.Ajv2019=m,t.exports=e=m,t.exports.Ajv2019=m,Object.defineProperty(e,"__esModule",{value:!0}),e.default=m;var h=Xr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var z=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return z._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return z.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return z.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return z.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return z.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return z.CodeGen}});var R=Ro();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return R.default}});var v=Qr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return v.default}})})),Uy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zh(),r=Rh(),n=Ih(),o=Ch(),i=Ah(),a=qh(),c=Ph(),s=kh(),l=[o.default,t.default,r.default,(0,n.default)(!0),c.default,s.metadataVocabulary,s.contentVocabulary,i.default,a.default];e.default=l})),Ly=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}})),Dy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}})),Vy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}})),Zy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}})),Fy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}})),Hy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}})),Jy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),By=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),Ky=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ly(),r=Dy(),n=Vy(),o=Zy(),i=Fy(),a=Hy(),c=Jy(),s=By(),l=["/properties"];function m(h){return[t,r,n,o,i,z(this,a),c,z(this,s)].forEach(R=>this.addMetaSchema(R,void 0,!1)),this;function z(R,v){return h?R.$dataMetaSchema(v,l):v}}e.default=m})),Gy=L(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=nl(),n=Uy(),o=sl(),i=Ky(),a="https://json-schema.org/draft/2020-12/schema";var c=class extends r.default{constructor(z={}){super({...z,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(z=>this.addVocabulary(z)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:z,meta:R}=this.opts;R&&(i.default.call(this,z),this.refs["http://json-schema.org/schema"]=a)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv2020=c,t.exports=e=c,t.exports.Ajv2020=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var s=Xr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var l=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var m=Ro();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=Qr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})})),Wy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(M,D){return{validate:M,compare:D}}e.fullFormats={date:t(i,a),time:t(s(!0),l),"date-time":t(z(!0),R),"iso-time":t(s(),m),"iso-date-time":t(z(),v),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:d,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:F,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:p,int32:{type:"number",validate:y},int64:{type:"number",validate:f},float:{type:"number",validate:T},double:{type:"number",validate:T},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,R),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,v),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(M){return M%4===0&&(M%100!==0||M%400===0)}let n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(M){let D=n.exec(M);if(!D)return!1;let Y=+D[1],K=+D[2],fe=+D[3];return K>=1&&K<=12&&fe>=1&&fe<=(K===2&&r(Y)?29:o[K])}function a(M,D){if(M&&D)return M>D?1:M23||x>59||M&&!Ce)return!1;if(fe<=23&&Te<=59&&ze<60)return!0;let V=Te-x*ve,$=fe-k*ve-(V<0?1:0);return($===23||$===-1)&&(V===59||V===-1)&&ze<61}}function l(M,D){if(!(M&&D))return;let Y=new Date("2020-01-01T"+M).valueOf(),K=new Date("2020-01-01T"+D).valueOf();if(Y&&K)return Y-K}function m(M,D){if(!(M&&D))return;let Y=c.exec(M),K=c.exec(D);if(Y&&K)return M=Y[1]+Y[2]+Y[3],D=K[1]+K[2]+K[3],M>D?1:M=S}function f(M){return Number.isInteger(M)}function T(){return!0}let A=/[^\\]\\Z/;function F(M){if(A.test(M))return!1;try{return new RegExp(M),!0}catch{return!1}}})),Yy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=jh(),r=de(),n=r.operators,o={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},i={message:({keyword:c,schemaCode:s})=>(0,r.str)`should be ${o[c].okStr} ${s}`,params:({keyword:c,schemaCode:s})=>(0,r._)`{comparison: ${o[c].okStr}, limit: ${s}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:i,code(c){let{gen:s,data:l,schemaCode:m,keyword:h,it:z}=c,{opts:R,self:v}=z;if(!R.validateFormats)return;let b=new t.KeywordCxt(z,v.RULES.all.format.definition,"format");b.$data?g():d();function g(){let p=s.scopeValue("formats",{ref:v.formats,code:R.code.formats}),S=s.const("fmt",(0,r._)`${p}[${b.schemaCode}]`);c.fail$data((0,r.or)((0,r._)`typeof ${S} != "object"`,(0,r._)`${S} instanceof RegExp`,(0,r._)`typeof ${S}.compare != "function"`,_(S)))}function d(){let p=b.schema,S=v.formats[p];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${h}": format "${p}" does not define "compare" function`);let w=s.scopeValue("formats",{key:p,ref:S,code:R.code.formats?(0,r._)`${R.code.formats}${(0,r.getProperty)(p)}`:void 0});c.fail$data(_(w))}function _(p){return(0,r._)`${p}.compare(${l}, ${m}) ${o[h].fail} 0`}},dependencies:["format"]};let a=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=a})),Xy=L(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=Wy(),n=Yy(),o=de(),i=new o.Name("fullFormats"),a=new o.Name("fastFormats"),c=(l,m={keywords:!0})=>{if(Array.isArray(m))return s(l,m,r.fullFormats,i),l;let[h,z]=m.mode==="fast"?[r.fastFormats,a]:[r.fullFormats,i];return s(l,m.formats||r.formatNames,h,z),m.keywords&&(0,n.default)(l),l};c.get=(l,m="full")=>{let h=(m==="fast"?r.fastFormats:r.fullFormats)[l];if(!h)throw new Error(`Unknown format "${l}"`);return h};function s(l,m,h,z){var R,v;(R=(v=l.opts.code).formats)!==null&&R!==void 0||(v.formats=(0,o._)`require("ajv-formats/dist/formats").${z}`);for(let b of m)l.addFormat(b,h[b])}t.exports=e=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c})),Mh=jh(),Qy=My(),eb=Gy(),tb=Fo(Xy(),1),rb=tb.default;function rl(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return rb(t),t}var ls=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=rl(eb.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=El(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return t==="2020-12"?this.ajv:t==="2019-09"?this._ajv2019??=rl(Qy.Ajv2019):this._ajvDraft7??=rl(Mh.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},yT=Mh.Ajv;import cl from"node:process";var fE=2**31-1;var ab=8,sb=6e5;function cb(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw new RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw new RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??ab,roundTimeoutMs:e?.roundTimeoutMs??sb,legacyShim:e?.legacyShim??!0}}function Uh(e,t,r){if(r===null||typeof r!="object"||typeof r.method!="string")throw new ge(X.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let n=r,o=Lf(n);if(o===void 0)throw new ge(X.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${n.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:n,required:o}}function ub(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map(n=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function ul(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new ge(X.InternalError,t)}var lb=class{constructor(e){this._host=e}async fulfill(e,t,r,n,o){let{maxRounds:i,roundTimeoutMs:a}=this._host,c=n.mcpReq.signal,s=o,l=0;for(;;){if(l+=1,l>i)return ul(e,uh(e,i));let m=s.inputRequests,h=m!=null&&Object.keys(m).length>0,z=typeof s.requestState=="string"?s.requestState:void 0;if(!h&&z===void 0)throw new ge(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let R;if(h){let g=this._host.resolvedClientCapabilities(n),d=[];for(let[p,S]of Object.entries(m)){let{embedded:w,required:y}=Uh(e,p,S);if(w.method!=="roots/list"&&w.params===void 0)throw new ge(X.InternalError,`Handler for ${e} returned an input request '${p}' of kind '${w.method}' without params`);if(es(y,g)!==void 0)return ul(e,`Cannot request input '${p}' (${w.method}): the client on this 2025-era connection did not declare the required capability${g===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);d.push([p,w])}let _=dh(c);try{let p={relatedRequestId:n.mcpReq.id,timeout:a,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:_.signal},S=await Promise.all(d.map(async([w,y])=>{try{return[w,await this._dispatchLeg(y,p)]}catch(f){throw _.abort(f),f}}));R=Object.fromEntries(S)}catch(p){if(c.aborted)throw p;return ul(e,`Fulfilling input required by '${e}' failed: ${p instanceof Error?p.message:String(p)}`)}finally{_.dispose()}}else await lh(ch,c);let v={...n,mcpReq:{...n.mcpReq,inputResponses:R,droppedInputResponseKeys:void 0,requestState:zo(z)}};if(z!==void 0){let g=await this._host.verifyRequestState(z,v,e);g!==void 0&&(v=Yu(v,g))}let b=await t(r,v);if(!fr(b))return b;s=b}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return r.mode==="url"&&r.elicitationId===void 0&&(r={...r,elicitationId:ub()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},db=new Set(["tools/call","prompts/get","resources/read"]),mb,pb,fb;var ll=class extends Xu{_clientCapabilities;_clientVersion;static{mb=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},pb=(e,t)=>{let r=t.filter(n=>!e._supportedProtocolVersions.includes(n));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},fb=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new lb({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new ls,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=cb(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))n!==void 0&&Yf(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",r=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Au(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:n}=e.params,o=rs(Ht,n);return o.success&&this._loggingLevels.set(r,o.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(n,o,i)=>{if(!this._capabilities.logging)return Promise.resolve();let a;if(this._servedModernEra()){if(a=e.mcpReq.envelope?.[Ut],a===void 0)return Promise.resolve()}else a=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return a!==void 0&&this.LOG_LEVEL_SEVERITY.get(n)this.elicitInput(n,o),requestSampling:(n,o)=>this.createMessage(n,o)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Ht.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e){let a=await t(o,i);if(fr(a))throw new ge(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}:async(o,i)=>{let a=n?await this._invokeInputRequiredCapableHandler(e,t,o,i):await t(o,i);if(fr(a)){if(!n)throw new ge(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}return r===void 0?a:Wf(a,r)}}return async(r,n)=>{let o=Yr(this._negotiatedProtocolVersion),i=o.validateRequest("tools/call",r);if(!i.ok)throw new ge(i.reason==="not-in-era"?X.InternalError:X.InvalidParams,i.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let a=await this._invokeInputRequiredCapableHandler("tools/call",t,r,n);if(fr(a))return a;let c=qu(a),s=o.validateResult("tools/call",c);if(!s.ok)throw new ge(s.reason==="not-in-era"?X.InternalError:X.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${s.message}`);return s.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&$o(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,n){let o=this._servedModernEra(),i=n.mcpReq.requestState();if(i!==void 0&&typeof i!="string")throw new ge(X.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let a=n;if(typeof i=="string"){let h=await this._verifyRequestState(i,n,e);h!==void 0&&(a=Yu(n,h))}let c;try{c=await t(r,a)}catch(h){throw h instanceof ge&&h.code===X.UrlElicitationRequired&&o?new ge(X.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { \u2026: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`):h}if(!fr(c))return c;if(!o){if(!this._inputRequiredServing.legacyShim)throw new ge(X.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??cr}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,a,c)}let s=c.inputRequests,l=s!=null&&Object.keys(s).length>0,m=typeof c.requestState=="string";if(!l&&!m)throw new ge(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(l){let h=this._inputRequestCapabilityView(n);for(let[z,R]of Object.entries(s)){let{embedded:v,required:b}=Uh(e,z,R),g=es(b,h);if(g!==void 0)throw new ts({requiredCapabilities:g},`Cannot request input '${z}' (${v.method}): the request's client capabilities do not declare the required capability`)}}return c}async _verifyRequestState(e,t,r){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(n){throw this.onerror?.(new Error(`requestState verification rejected ${r}: ${n instanceof Error?n.message:String(n)}`)),new ge(X.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[wt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new le(he.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead \u2014 the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new le(he.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new le(he.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new le(he.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new le(he.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new le(he.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new le(he.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new le(he.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new le(he.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new le(he.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new le(he.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new le(he.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new le(he.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new le(he.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=Df(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??cr;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Au(this._supportedProtocolVersions),capabilities:hb(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new le(he.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages.at(-1),a=Array.isArray(i.content)?i.content:[i.content],c=a.some(h=>h.type==="tool_result"),s=e.messages.length>1?e.messages.at(-2):void 0,l=s?Array.isArray(s.content)?s.content:[s.content]:[],m=l.some(h=>h.type==="tool_use");if(c){if(a.some(h=>h.type!=="tool_result"))throw new ge(X.InvalidParams,"The last message must contain only tool_result content if any is present");if(!m)throw new ge(X.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(m){let h=new Set(l.filter(R=>R.type==="tool_use").map(R=>R.id)),z=new Set(a.filter(R=>R.type==="tool_result").map(R=>R.toolUseId));if(h.size!==z.size||![...h].every(R=>z.has(R)))throw new ge(X.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),n=await this.request({method:"sampling/createMessage",params:e},t),o=this._wireCodec().samplingResultVariant(r,n);if(!o.ok)throw new le(he.InvalidResult,`Invalid sampling/createMessage result: ${o.reason==="invalid"?o.message:o.reason}`);return o.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new le(he.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new le(he.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let n=e.mode??"form",o=r?.validateAcceptedContent??!0;switch(n){case"url":{let i=e;return this.request({method:"elicitation/create",params:i},t)}case"form":{let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},t);if(o&&a.action==="accept"&&a.content&&i.requestedSchema)try{let c=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!c.valid)throw new ge(X.InvalidParams,`Elicitation response content does not match requested schema: ${c.errorMessage}`)}catch(c){throw c instanceof ge?c:new ge(X.InternalError,`Error validating elicitation response: ${c instanceof Error?c.message:String(c)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new le(he.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function hb(e){return{...e}}var Lh=class{_readBuffer;_started=!1;_closed=!1;constructor(e=cl.stdin,t=cl.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new el({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(new Error("StdioServerTransport is closed")):new Promise((t,r)=>{let n=tl(e),o=!1,i=c=>{o||(o=!0,this._stdout.off("error",i),this._stdout.off("drain",a),r(c))},a=()=>{o||(o=!0,this._stdout.off("error",i),this._stdout.off("drain",a),t())};if(this._stdout.once("error",i),this._stdout.write(n)){if(o)return;o=!0,this._stdout.off("error",i),t()}else o||this._stdout.once("drain",a)})}};import{appendFileSync as pt,existsSync as vt,readFileSync as Rb,writeFileSync as Ze}from"node:fs";import{setTimeout as Me}from"node:timers/promises";var fs=process.env.TEST_ACCOUNT_NAME??"unknown",hs=process.env.TEST_INCLUDE_RESPONSE_TOKEN==="true"?`${fs}:${process.env.API_TOKEN??""}`:fs,Dh=Number(process.env.TEST_LIST_TOOLS_DELAY_MS??"0"),Vh=Number(process.env.TEST_LIST_TOOLS_START_DELAY_MS??"0"),Zh=Number(process.env.TEST_LIST_TOOLS_DELAY_AFTER_NOTIFICATION_MS??"0"),Fh=Number(process.env.TEST_LIST_RESOURCES_DELAY_MS??"0"),Hh=Number(process.env.TEST_LIST_PROMPTS_DELAY_MS??"0"),wb=process.env.TEST_LIST_TOOLS_PROGRESS==="true",Tb=process.env.TEST_LIST_RESOURCES_PROGRESS==="true",Eb=process.env.TEST_LIST_RESOURCE_TEMPLATES_PROGRESS==="true",Ib=process.env.TEST_LIST_PROMPTS_PROGRESS==="true",Jh=Number(process.env.TEST_CALL_TOOL_DELAY_MS??"0"),Pb=process.env.TEST_CALL_TOOL_PROGRESS==="true",Bh=process.env.TEST_CALL_TOOL_PROGRESS_MESSAGE,Kh=Number(process.env.TEST_READ_RESOURCE_DELAY_MS??"0"),Gh=Number(process.env.TEST_GET_PROMPT_DELAY_MS??"0"),kb=process.env.TEST_RESOURCE_NAME??"Current account",zg=process.env.TEST_RESOURCE_URI??"account://current",Ob=process.env.TEST_RESOURCE_TEMPLATE_NAME??"account",gs=process.env.TEST_RESOURCE_TEMPLATE_URI,jb=process.env.TEST_RESOURCE_TEMPLATES_UNSUPPORTED==="true",ys=process.env.TEST_RESOURCE_SUBSCRIPTIONS==="true",ps=process.env.TEST_RESOURCE_SUBSCRIPTION_STATEFUL_UPDATES==="true",Nb=process.env.TEST_FAIL_SUBSCRIBE==="true",Wh=process.env.TEST_RESOURCE_UPDATE_URI,Yh=Number(process.env.TEST_RESOURCE_UPDATE_DELAY_MS??"0"),Xh=Number(process.env.TEST_SUBSCRIBE_START_DELAY_MS??"0"),Qh=Number(process.env.TEST_SUBSCRIBE_DELAY_MS??"0"),eg=Number(process.env.TEST_UNSUBSCRIBE_DELAY_MS??"0"),tg=process.env.TEST_SUBSCRIBE_COUNT_PATH,rg=process.env.TEST_UNSUBSCRIBE_COUNT_PATH,ng=process.env.TEST_SUBSCRIBE_STARTED_PATH,xb=process.env.TEST_NOTIFY_TOOL_LIST_CHANGE_ON_LIST_TOOLS==="true",Cb=process.env.TEST_NOTIFY_TOOL_LIST_CHANGE_ON_FIRST_LIST_TOOLS==="true",Ab=process.env.TEST_TOOL_LIST_CHANGES_AFTER_FIRST_REQUEST==="true",qb=process.env.TEST_NOTIFY_LIST_CHANGES_ON_CALL_TOOL==="true",Rg=process.env.TEST_PROMPT_NAME??"account_prompt",Sl=!1,yl=0,vs=process.env.TEST_PAGINATE_CAPABILITIES==="true",og=process.env.TEST_PAGINATE_TOOLS==="true",Mb=process.env.TEST_SECOND_RESOURCE_NAME??"Second account",Ub=process.env.TEST_SECOND_RESOURCE_URI??"account://second",Lb=process.env.TEST_SECOND_PROMPT_NAME??"second_prompt",ig=process.env.TEST_ADDITIONAL_RESOURCE_URI,ag=process.env.TEST_RESOURCE_ICON_URI,_s=process.env.TEST_PROMPT_ICON_URI,dl=process.env.TEST_PROMPT_RESOURCE_URI,ml=process.env.TEST_FAIL_ON_RESTART_PATH,sg=process.env.TEST_FAIL_LIST_RESOURCES_PATH,cg=process.env.TEST_FAIL_LIST_PROMPTS_PATH,Ss=process.env.TEST_CRASH_ON_CALL_TOOL_PATH,ug=process.env.TEST_CRASH_ON_CALL_TOOL_OBSERVED_PATH,lg=process.env.TEST_CRASH_AFTER_INITIALIZED_PATH,dg=process.env.TEST_START_COUNT_PATH,mg=process.env.TEST_INITIALIZED_PATH,pg=process.env.TEST_CREATE_ITEM_COUNT_PATH,fg=process.env.TEST_CALL_TOOL_STARTED_PATH,hg=process.env.TEST_CANCELLED_PATH,gg=process.env.TEST_FAIL_INITIALIZE==="true",pl=process.env.TEST_CLIENT_INFO_PATH,wo=process.env.TEST_STDERR_MESSAGE,ds=Number(process.env.TEST_STDERR_SPLIT_AT??"0"),ms=process.env.TEST_HANG_ON_START_PATH,vg=process.env.TEST_HANG_ON_START_READY_PATH,fl=Number(process.env.TEST_SHUTDOWN_DELAY_MS??"0"),hl=process.env.TEST_SHUTDOWN_END_PATH,Db=process.env.TEST_INCLUDE_IDENTITY_TOOL==="true",gl=Number(process.env.TEST_OVERSIZED_IDENTITY_RESPONSE_REPEAT??"0"),bl=Number.isSafeInteger(gl)&&gl>0?"identity-response-secret".repeat(gl):void 0,Vb=bl===void 0?process.env.TEST_IDENTITY_RESPONSE??JSON.stringify({login:fs}):JSON.stringify({login:bl}),Zb=process.env.TEST_IDENTITY_SCHEMA==="min-properties"?{type:"object",properties:{account:{type:"string"}},minProperties:1}:process.env.TEST_IDENTITY_SCHEMA==="all-of-required"?{type:"object",properties:{account:{type:"string"}},allOf:[{required:["account"]}]}:process.env.TEST_IDENTITY_SCHEMA==="additional-properties-false"?{type:"object",properties:{},additionalProperties:!1}:{type:"object",properties:{}},$l=process.env.TEST_INCLUDE_SAFE_READ_TOOL==="true"?"get_capabilities":void 0,_g=process.env.TEST_SAFE_READ_CALL_PATH,Fb=process.env.TEST_SAFE_READ_RESPONSE??"safe-read",Sg=Tg(process.env.TEST_SAFE_READ_ANNOTATIONS,"TEST_SAFE_READ_ANNOTATIONS"),Hb=process.env.TEST_SAFE_READ_SCHEMA==="required"?{type:"object",properties:{account:{type:"string"}},required:["account"]}:process.env.TEST_SAFE_READ_SCHEMA==="all-of-required"?{type:"object",properties:{},allOf:[{required:["account"]}]}:{type:"object",properties:{}},vl=0,yg=process.env.TEST_ISOLATION_REPORT_PATH;if(yg){let e=process.env.OAUTH_CREDENTIAL_PATH;if(!e)throw new Error("test isolation fixture requires OAUTH_CREDENTIAL_PATH");let t=Rb(e,"utf8");Ze(yg,JSON.stringify({home:process.env.HOME,xdgConfigHome:process.env.XDG_CONFIG_HOME,xdgCacheHome:process.env.XDG_CACHE_HOME,xdgDataHome:process.env.XDG_DATA_HOME,xdgStateHome:process.env.XDG_STATE_HOME,xdgRuntimeDir:process.env.XDG_RUNTIME_DIR,credentialPath:e,credential:t})),process.env.TEST_ISOLATION_EMIT_CREDENTIAL==="true"&&process.stderr.write(`test isolated credential: ${t} + deps: ${m}}`};let o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(s){let[l,m]=i(s);a(s,l),c(s,m)}};function i({schema:s}){let l={},m={};for(let h in s){if(h==="__proto__")continue;let z=Array.isArray(s[h])?l:m;z[h]=s[h]}return[l,m]}function a(s,l=s.schema){let{gen:m,data:h,it:z}=s;if(Object.keys(l).length===0)return;let R=m.let("missing");for(let v in l){let b=l[v];if(b.length===0)continue;let g=(0,n.propertyInData)(m,h,v,z.opts.ownProperties);s.setParams({property:v,depsCount:b.length,deps:b.join(", ")}),z.allErrors?m.if(g,()=>{for(let d of b)(0,n.checkReportMissingProp)(s,d)}):(m.if((0,t._)`${g} && (${(0,n.checkMissingProp)(s,b,R)})`),(0,n.reportMissingProp)(s,R),m.else())}}e.validatePropertyDeps=a;function c(s,l=s.schema){let{gen:m,data:h,keyword:z,it:R}=s,v=m.name("valid");for(let b in l)(0,r.alwaysValidSchema)(R,l[b])||(m.if((0,n.propertyInData)(m,h,b,R.opts.ownProperties),()=>{let g=s.subschema({keyword:z,schemaProp:b},v);s.mergeValidEvaluated(g,v)},()=>m.var(v,!0)),s.ok(v))}e.validateSchemaDeps=c,e.default=o})),dy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:o})=>(0,t._)`{propertyName: ${o.propertyName}}`},code(o){let{gen:i,schema:a,data:c,it:s}=o;if((0,r.alwaysValidSchema)(s,a))return;let l=i.name("valid");i.forIn("key",c,m=>{o.setParams({propertyName:m}),o.subschema({keyword:"propertyNames",data:m,dataTypes:["string"],propertyName:m,compositeRule:!0},l),i.if((0,t.not)(l),()=>{o.error(!0),s.allErrors||i.break()})}),o.ok(l)}};e.default=n})),Eh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=de(),n=dt(),o=_e(),i={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:a})=>(0,r._)`{additionalProperty: ${a.additionalProperty}}`},code(a){let{gen:c,schema:s,parentSchema:l,data:m,errsCount:h,it:z}=a;if(!h)throw new Error("ajv implementation error");let{allErrors:R,opts:v}=z;if(z.props=!0,v.removeAdditional!=="all"&&(0,o.alwaysValidSchema)(z,s))return;let b=(0,t.allSchemaProperties)(l.properties),g=(0,t.allSchemaProperties)(l.patternProperties);d(),a.ok((0,r._)`${h} === ${n.default.errors}`);function d(){c.forIn("key",m,y=>{!b.length&&!g.length?S(y):c.if(_(y),()=>S(y))})}function _(y){let f;if(b.length>8){let T=(0,o.schemaRefOrVal)(z,l.properties,"properties");f=(0,t.isOwnProperty)(c,T,y)}else b.length?f=(0,r.or)(...b.map(T=>(0,r._)`${y} === ${T}`)):f=r.nil;return g.length&&(f=(0,r.or)(f,...g.map(T=>(0,r._)`${(0,t.usePattern)(a,T)}.test(${y})`))),(0,r.not)(f)}function p(y){c.code((0,r._)`delete ${m}[${y}]`)}function S(y){if(v.removeAdditional==="all"||v.removeAdditional&&s===!1){p(y);return}if(s===!1){a.setParams({additionalProperty:y}),a.error(),R||c.break();return}if(typeof s=="object"&&!(0,o.alwaysValidSchema)(z,s)){let f=c.name("valid");v.removeAdditional==="failing"?(w(y,f,!1),c.if((0,r.not)(f),()=>{a.reset(),p(y)})):(w(y,f),R||c.if((0,r.not)(f),()=>c.break()))}}function w(y,f,T){let A={keyword:"additionalProperties",dataProp:y,dataPropType:o.Type.Str};T===!1&&Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1}),a.subschema(A,f)}}};e.default=i})),my=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Xr(),r=mt(),n=_e(),o=Eh(),i={keyword:"properties",type:"object",schemaType:"object",code(a){let{gen:c,schema:s,parentSchema:l,data:m,it:h}=a;h.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&o.default.code(new t.KeywordCxt(h,o.default,"additionalProperties"));let z=(0,r.allSchemaProperties)(s);for(let d of z)h.definedProperties.add(d);h.opts.unevaluated&&z.length&&h.props!==!0&&(h.props=n.mergeEvaluated.props(c,(0,n.toHash)(z),h.props));let R=z.filter(d=>!(0,n.alwaysValidSchema)(h,s[d]));if(R.length===0)return;let v=c.name("valid");for(let d of R)b(d)?g(d):(c.if((0,r.propertyInData)(c,m,d,h.opts.ownProperties)),g(d),h.allErrors||c.else().var(v,!0),c.endIf()),a.it.definedProperties.add(d),a.ok(v);function b(d){return h.opts.useDefaults&&!h.compositeRule&&s[d].default!==void 0}function g(d){a.subschema({keyword:"properties",schemaProp:d,dataProp:d},v)}}};e.default=i})),py=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=mt(),r=de(),n=_e(),o=_e(),i={keyword:"patternProperties",type:"object",schemaType:"object",code(a){let{gen:c,schema:s,data:l,parentSchema:m,it:h}=a,{opts:z}=h,R=(0,t.allSchemaProperties)(s),v=R.filter(w=>(0,n.alwaysValidSchema)(h,s[w]));if(R.length===0||v.length===R.length&&(!h.opts.unevaluated||h.props===!0))return;let b=z.strictSchema&&!z.allowMatchingProperties&&m.properties,g=c.name("valid");h.props!==!0&&!(h.props instanceof r.Name)&&(h.props=(0,o.evaluatedPropsToName)(c,h.props));let{props:d}=h;_();function _(){for(let w of R)b&&p(w),h.allErrors?S(w):(c.var(g,!0),S(w),c.if(g))}function p(w){for(let y in b)new RegExp(w).test(y)&&(0,n.checkStrictMode)(h,`property ${y} matches pattern ${w} (use allowMatchingProperties)`)}function S(w){c.forIn("key",l,y=>{c.if((0,r._)`${(0,t.usePattern)(a,w)}.test(${y})`,()=>{let f=v.includes(w);f||a.subschema({keyword:"patternProperties",schemaProp:w,dataProp:y,dataPropType:o.Type.Str},g),h.opts.unevaluated&&d!==!0?c.assign((0,r._)`${d}[${y}]`,!0):!f&&!h.allErrors&&c.if((0,r.not)(g),()=>c.break())})})}}};e.default=i})),fy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(n){let{gen:o,schema:i,it:a}=n;if((0,t.alwaysValidSchema)(a,i)){n.fail();return}let c=o.name("valid");n.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),n.failResult(c,()=>n.reset(),()=>n.error())},error:{message:"must NOT be valid"}};e.default=r})),hy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:mt().validateUnion,error:{message:"must match a schema in anyOf"}};e.default=t})),gy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:o})=>(0,t._)`{passingSchemas: ${o.passing}}`},code(o){let{gen:i,schema:a,parentSchema:c,it:s}=o;if(!Array.isArray(a))throw new Error("ajv implementation error");if(s.opts.discriminator&&c.discriminator)return;let l=a,m=i.let("valid",!1),h=i.let("passing",null),z=i.name("_valid");o.setParams({passing:h}),i.block(R),o.result(m,()=>o.reset(),()=>o.error(!0));function R(){l.forEach((v,b)=>{let g;(0,r.alwaysValidSchema)(s,v)?i.var(z,!0):g=o.subschema({keyword:"oneOf",schemaProp:b,compositeRule:!0},z),b>0&&i.if((0,t._)`${z} && ${m}`).assign(m,!1).assign(h,(0,t._)`[${h}, ${b}]`).else(),i.if(z,()=>{i.assign(m,!0),i.assign(h,b),g&&o.mergeEvaluated(g,t.Name)})})}}};e.default=n})),vy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:"allOf",schemaType:"array",code(n){let{gen:o,schema:i,it:a}=n;if(!Array.isArray(i))throw new Error("ajv implementation error");let c=o.name("valid");i.forEach((s,l)=>{if((0,t.alwaysValidSchema)(a,s))return;let m=n.subschema({keyword:"allOf",schemaProp:l},c);n.ok(c),n.mergeEvaluated(m)})}};e.default=r})),_y=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:i})=>(0,t.str)`must match "${i.ifClause}" schema`,params:({params:i})=>(0,t._)`{failingKeyword: ${i.ifClause}}`},code(i){let{gen:a,parentSchema:c,it:s}=i;c.then===void 0&&c.else===void 0&&(0,r.checkStrictMode)(s,'"if" without "then" and "else" is ignored');let l=o(s,"then"),m=o(s,"else");if(!l&&!m)return;let h=a.let("valid",!0),z=a.name("_valid");if(R(),i.reset(),l&&m){let b=a.let("ifClause");i.setParams({ifClause:b}),a.if(z,v("then",b),v("else",b))}else l?a.if(z,v("then")):a.if((0,t.not)(z),v("else"));i.pass(h,()=>i.error(!0));function R(){let b=i.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},z);i.mergeEvaluated(b)}function v(b,g){return()=>{let d=i.subschema({keyword:b},z);a.assign(h,z),i.mergeValidEvaluated(d,h),g?a.assign(g,(0,t._)`${b}`):i.setParams({ifClause:b})}}}};function o(i,a){let c=i.schema[a];return c!==void 0&&!(0,r.alwaysValidSchema)(i,c)}e.default=n})),Sy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:n,parentSchema:o,it:i}){o.if===void 0&&(0,t.checkStrictMode)(i,`"${n}" without "if" is ignored`)}};e.default=r})),Ih=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=wh(),r=cy(),n=Th(),o=uy(),i=ly(),a=al(),c=dy(),s=Eh(),l=my(),m=py(),h=fy(),z=hy(),R=gy(),v=vy(),b=_y(),g=Sy();function d(_=!1){let p=[h.default,z.default,R.default,v.default,b.default,g.default,c.default,s.default,a.default,l.default,m.default];return _?p.push(r.default,o.default):p.push(t.default,n.default),p.push(i.default),p}e.default=d})),yy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:n})=>(0,t.str)`must match format "${n}"`,params:({schemaCode:n})=>(0,t._)`{format: ${n}}`},code(n,o){let{gen:i,data:a,$data:c,schema:s,schemaCode:l,it:m}=n,{opts:h,errSchemaPath:z,schemaEnv:R,self:v}=m;if(!h.validateFormats)return;c?b():g();function b(){let d=i.scopeValue("formats",{ref:v.formats,code:h.code.formats}),_=i.const("fDef",(0,t._)`${d}[${l}]`),p=i.let("fType"),S=i.let("format");i.if((0,t._)`typeof ${_} == "object" && !(${_} instanceof RegExp)`,()=>i.assign(p,(0,t._)`${_}.type || "string"`).assign(S,(0,t._)`${_}.validate`),()=>i.assign(p,(0,t._)`"string"`).assign(S,_)),n.fail$data((0,t.or)(w(),y()));function w(){return h.strictSchema===!1?t.nil:(0,t._)`${l} && !${S}`}function y(){let f=R.$async?(0,t._)`(${_}.async ? await ${S}(${a}) : ${S}(${a}))`:(0,t._)`${S}(${a})`,T=(0,t._)`(typeof ${S} == "function" ? ${f} : ${S}.test(${a}))`;return(0,t._)`${S} && ${S} !== true && ${p} === ${o} && !${T}`}}function g(){let d=v.formats[s];if(!d){w();return}if(d===!0)return;let[_,p,S]=y(d);_===o&&n.pass(f());function w(){if(h.strictSchema===!1){v.logger.warn(T());return}throw new Error(T());function T(){return`unknown format "${s}" ignored in schema at path "${z}"`}}function y(T){let A=T instanceof RegExp?(0,t.regexpCode)(T):h.code.formats?(0,t._)`${h.code.formats}${(0,t.getProperty)(s)}`:void 0,F=i.scopeValue("formats",{key:s,ref:T,code:A});return typeof T=="object"&&!(T instanceof RegExp)?[T.type||"string",T.validate,(0,t._)`${F}.validate`]:["string",T,F]}function f(){if(typeof d=="object"&&!(d instanceof RegExp)&&d.async){if(!R.$async)throw new Error("async format in sync schema");return(0,t._)`await ${S}(${a})`}return typeof p=="function"?(0,t._)`${S}(${a})`:(0,t._)`${S}.test(${a})`}}}};e.default=r})),Ph=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=[yy().default];e.default=t})),kh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contentVocabulary=e.metadataVocabulary=void 0,e.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],e.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]})),Oh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zh(),r=Rh(),n=Ih(),o=Ph(),i=kh(),a=[t.default,r.default,(0,n.default)(),o.default,i.metadataVocabulary,i.contentVocabulary];e.default=a})),by=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DiscrError=void 0;var t;(function(r){r.Tag="tag",r.Mapping="mapping"})(t||(e.DiscrError=t={}))})),sl=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=by(),n=us(),o=Qr(),i=_e(),a={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:c,tagName:s}})=>c===r.DiscrError.Tag?`tag "${s}" must be string`:`value of tag "${s}" must be in oneOf`,params:({params:{discrError:c,tag:s,tagName:l}})=>(0,t._)`{error: ${c}, tag: ${l}, tagValue: ${s}}`},code(c){let{gen:s,data:l,schema:m,parentSchema:h,it:z}=c,{oneOf:R}=h;if(!z.opts.discriminator)throw new Error("discriminator: requires discriminator option");let v=m.propertyName;if(typeof v!="string")throw new Error("discriminator: requires propertyName");if(m.mapping)throw new Error("discriminator: mapping is not supported");if(!R)throw new Error("discriminator: requires oneOf keyword");let b=s.let("valid",!1),g=s.const("tag",(0,t._)`${l}${(0,t.getProperty)(v)}`);s.if((0,t._)`typeof ${g} == "string"`,()=>d(),()=>c.error(!1,{discrError:r.DiscrError.Tag,tag:g,tagName:v})),c.ok(b);function d(){let S=p();s.if(!1);for(let w in S)s.elseIf((0,t._)`${g} === ${w}`),s.assign(b,_(S[w]));s.else(),c.error(!1,{discrError:r.DiscrError.Mapping,tag:g,tagName:v}),s.endIf()}function _(S){let w=s.name("valid"),y=c.subschema({keyword:"oneOf",schemaProp:S},w);return c.mergeEvaluated(y,t.Name),w}function p(){var S;let w={},y=T(h),f=!0;for(let M=0;M{t.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}})),jh=L(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv=void 0;let r=nl(),n=Oh(),o=sl(),i=$y(),a=["/properties"],c="http://json-schema.org/draft-07/schema";var s=class extends r.default{_addVocabularies(){super._addVocabularies(),n.default.forEach(R=>this.addVocabulary(R)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let R=this.opts.$data?this.$dataMetaSchema(i,a):i;this.addMetaSchema(R,c,!1),this.refs["http://json-schema.org/schema"]=c}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(c)?c:void 0)}};e.Ajv=s,t.exports=e=s,t.exports.Ajv=s,Object.defineProperty(e,"__esModule",{value:!0}),e.default=s;var l=Xr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return l.KeywordCxt}});var m=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return m._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return m.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return m.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return m.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return m.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return m.CodeGen}});var h=Ro();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return h.default}});var z=Qr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return z.default}})})),Nh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicAnchor=void 0;let t=de(),r=dt(),n=us(),o=ol(),i={keyword:"$dynamicAnchor",schemaType:"string",code:s=>a(s,s.schema)};function a(s,l){let{gen:m,it:h}=s;h.schemaEnv.root.dynamicAnchors[l]=!0;let z=(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(l)}`,R=h.errSchemaPath==="#"?h.validateName:c(s);m.if((0,t._)`!${z}`,()=>m.assign(z,R))}e.dynamicAnchor=a;function c(s){let{schemaEnv:l,schema:m,self:h}=s.it,{root:z,baseId:R,localRefs:v,meta:b}=l.root,{schemaId:g}=h.opts,d=new n.SchemaEnv({schema:m,schemaId:g,root:z,baseId:R,localRefs:v,meta:b});return n.compileSchema.call(h,d),(0,o.getValidate)(s,d)}e.default=i})),xh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.dynamicRef=void 0;let t=de(),r=dt(),n=ol(),o={keyword:"$dynamicRef",schemaType:"string",code:a=>i(a,a.schema)};function i(a,c){let{gen:s,keyword:l,it:m}=a;if(c[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);let h=c.slice(1);if(m.allErrors)z();else{let v=s.let("valid",!1);z(v),a.ok(v)}function z(v){if(m.schemaEnv.root.dynamicAnchors[h]){let b=s.let("_v",(0,t._)`${r.default.dynamicAnchors}${(0,t.getProperty)(h)}`);s.if(b,R(b,v),R(m.validateName,v))}else R(m.validateName,v)()}function R(v,b){return b?()=>s.block(()=>{(0,n.callRef)(a,v),s.let(b,!0)}):()=>(0,n.callRef)(a,v)}}e.dynamicRef=i,e.default=o})),zy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Nh(),r=_e(),n={keyword:"$recursiveAnchor",schemaType:"boolean",code(o){o.schema?(0,t.dynamicAnchor)(o,""):(0,r.checkStrictMode)(o.it,"$recursiveAnchor: false is ignored")}};e.default=n})),Ry=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=xh(),r={keyword:"$recursiveRef",schemaType:"string",code:n=>(0,t.dynamicRef)(n,n.schema)};e.default=r})),Ch=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Nh(),r=xh(),n=zy(),o=Ry(),i=[t.default,r.default,n.default,o.default];e.default=i})),wy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=al(),r={keyword:"dependentRequired",type:"object",schemaType:"object",error:t.error,code:n=>(0,t.validatePropertyDeps)(n)};e.default=r})),Ty=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=al(),r={keyword:"dependentSchemas",type:"object",schemaType:"object",code:n=>(0,t.validateSchemaDeps)(n)};e.default=r})),Ey=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=_e(),r={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:n,parentSchema:o,it:i}){o.contains===void 0&&(0,t.checkStrictMode)(i,`"${n}" without "contains" is ignored`)}};e.default=r})),Ah=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=wy(),r=Ty(),n=Ey(),o=[t.default,r.default,n.default];e.default=o})),Iy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n=dt(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:i})=>(0,t._)`{unevaluatedProperty: ${i.unevaluatedProperty}}`},code(i){let{gen:a,schema:c,data:s,errsCount:l,it:m}=i;if(!l)throw new Error("ajv implementation error");let{allErrors:h,props:z}=m;z instanceof t.Name?a.if((0,t._)`${z} !== true`,()=>a.forIn("key",s,g=>a.if(v(z,g),()=>R(g)))):z!==!0&&a.forIn("key",s,g=>z===void 0?R(g):a.if(b(z,g),()=>R(g))),m.props=!0,i.ok((0,t._)`${l} === ${n.default.errors}`);function R(g){if(c===!1){i.setParams({unevaluatedProperty:g}),i.error(),h||a.break();return}if(!(0,r.alwaysValidSchema)(m,c)){let d=a.name("valid");i.subschema({keyword:"unevaluatedProperties",dataProp:g,dataPropType:r.Type.Str},d),h||a.if((0,t.not)(d),()=>a.break())}}function v(g,d){return(0,t._)`!${g} || !${g}[${d}]`}function b(g,d){let _=[];for(let p in g)g[p]===!0&&_.push((0,t._)`${d} !== ${p}`);return(0,t.and)(..._)}}};e.default=o})),Py=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=de(),r=_e(),n={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:o}})=>(0,t.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,t._)`{limit: ${o}}`},code(o){let{gen:i,schema:a,data:c,it:s}=o,l=s.items||0;if(l===!0)return;let m=i.const("len",(0,t._)`${c}.length`);if(a===!1)o.setParams({len:l}),o.fail((0,t._)`${m} > ${l}`);else if(typeof a=="object"&&!(0,r.alwaysValidSchema)(s,a)){let z=i.var("valid",(0,t._)`${m} <= ${l}`);i.if((0,t.not)(z),()=>h(z,l)),o.ok(z)}s.items=!0;function h(z,R){i.forRange("i",R,m,v=>{o.subschema({keyword:"unevaluatedItems",dataProp:v,dataPropType:r.Type.Num},z),s.allErrors||i.if((0,t.not)(z),()=>i.break())})}}};e.default=n})),qh=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Iy(),r=Py(),n=[t.default,r.default];e.default=n})),ky=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}})),Oy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}})),jy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}})),Ny=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}})),xy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}})),Cy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),Ay=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),qy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=ky(),r=Oy(),n=jy(),o=Ny(),i=xy(),a=Cy(),c=Ay(),s=["/properties"];function l(m){return[t,r,n,o,h(this,i),a,h(this,c)].forEach(z=>this.addMetaSchema(z,void 0,!1)),this;function h(z,R){return m?z.$dataMetaSchema(R,s):R}}e.default=l})),My=L(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2019=void 0;let r=nl(),n=Oh(),o=Ch(),i=Ah(),a=qh(),c=sl(),s=qy(),l="https://json-schema.org/draft/2019-09/schema";var m=class extends r.default{constructor(b={}){super({...b,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(o.default),n.default.forEach(b=>this.addVocabulary(b)),this.addVocabulary(i.default),this.addVocabulary(a.default),this.opts.discriminator&&this.addKeyword(c.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:b,meta:g}=this.opts;g&&(s.default.call(this,b),this.refs["http://json-schema.org/schema"]=l)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(l)?l:void 0)}};e.Ajv2019=m,t.exports=e=m,t.exports.Ajv2019=m,Object.defineProperty(e,"__esModule",{value:!0}),e.default=m;var h=Xr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return h.KeywordCxt}});var z=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return z._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return z.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return z.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return z.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return z.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return z.CodeGen}});var R=Ro();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return R.default}});var v=Qr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return v.default}})})),Uy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=zh(),r=Rh(),n=Ih(),o=Ch(),i=Ah(),a=qh(),c=Ph(),s=kh(),l=[o.default,t.default,r.default,(0,n.default)(!0),c.default,s.metadataVocabulary,s.contentVocabulary,i.default,a.default];e.default=l})),Ly=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}}})),Dy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}}})),Vy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}}})),Zy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}}})),Fy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}}})),Hy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}}})),Jy=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}})),By=L(((e,t)=>{t.exports={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}})),Ky=L((e=>{Object.defineProperty(e,"__esModule",{value:!0});let t=Ly(),r=Dy(),n=Vy(),o=Zy(),i=Fy(),a=Hy(),c=Jy(),s=By(),l=["/properties"];function m(h){return[t,r,n,o,i,z(this,a),c,z(this,s)].forEach(R=>this.addMetaSchema(R,void 0,!1)),this;function z(R,v){return h?R.$dataMetaSchema(v,l):v}}e.default=m})),Gy=L(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MissingRefError=e.ValidationError=e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=e.Ajv2020=void 0;let r=nl(),n=Uy(),o=sl(),i=Ky(),a="https://json-schema.org/draft/2020-12/schema";var c=class extends r.default{constructor(z={}){super({...z,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(z=>this.addVocabulary(z)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:z,meta:R}=this.opts;R&&(i.default.call(this,z),this.refs["http://json-schema.org/schema"]=a)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(a)?a:void 0)}};e.Ajv2020=c,t.exports=e=c,t.exports.Ajv2020=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c;var s=Xr();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return s.KeywordCxt}});var l=de();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var m=Ro();Object.defineProperty(e,"ValidationError",{enumerable:!0,get:function(){return m.default}});var h=Qr();Object.defineProperty(e,"MissingRefError",{enumerable:!0,get:function(){return h.default}})})),Wy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatNames=e.fastFormats=e.fullFormats=void 0;function t(M,D){return{validate:M,compare:D}}e.fullFormats={date:t(i,a),time:t(s(!0),l),"date-time":t(z(!0),R),"iso-time":t(s(),m),"iso-date-time":t(z(),v),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:d,"uri-reference":/^(?:[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,"uri-template":/^(?:(?:[^\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,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|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-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{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,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([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,regex:F,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:p,int32:{type:"number",validate:y},int64:{type:"number",validate:f},float:{type:"number",validate:T},double:{type:"number",validate:T},password:!0,binary:!0},e.fastFormats={...e.fullFormats,date:t(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,a),time:t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,l),"date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,R),"iso-time":t(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,m),"iso-date-time":t(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,v),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i},e.formatNames=Object.keys(e.fullFormats);function r(M){return M%4===0&&(M%100!==0||M%400===0)}let n=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,o=[0,31,28,31,30,31,30,31,31,30,31,30,31];function i(M){let D=n.exec(M);if(!D)return!1;let Y=+D[1],K=+D[2],fe=+D[3];return K>=1&&K<=12&&fe>=1&&fe<=(K===2&&r(Y)?29:o[K])}function a(M,D){if(M&&D)return M>D?1:M23||x>59||M&&!Ce)return!1;if(fe<=23&&Te<=59&&ze<60)return!0;let V=Te-x*ve,$=fe-k*ve-(V<0?1:0);return($===23||$===-1)&&(V===59||V===-1)&&ze<61}}function l(M,D){if(!(M&&D))return;let Y=new Date("2020-01-01T"+M).valueOf(),K=new Date("2020-01-01T"+D).valueOf();if(Y&&K)return Y-K}function m(M,D){if(!(M&&D))return;let Y=c.exec(M),K=c.exec(D);if(Y&&K)return M=Y[1]+Y[2]+Y[3],D=K[1]+K[2]+K[3],M>D?1:M=S}function f(M){return Number.isInteger(M)}function T(){return!0}let A=/[^\\]\\Z/;function F(M){if(A.test(M))return!1;try{return new RegExp(M),!0}catch{return!1}}})),Yy=L((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatLimitDefinition=void 0;let t=jh(),r=de(),n=r.operators,o={formatMaximum:{okStr:"<=",ok:n.LTE,fail:n.GT},formatMinimum:{okStr:">=",ok:n.GTE,fail:n.LT},formatExclusiveMaximum:{okStr:"<",ok:n.LT,fail:n.GTE},formatExclusiveMinimum:{okStr:">",ok:n.GT,fail:n.LTE}},i={message:({keyword:c,schemaCode:s})=>(0,r.str)`should be ${o[c].okStr} ${s}`,params:({keyword:c,schemaCode:s})=>(0,r._)`{comparison: ${o[c].okStr}, limit: ${s}}`};e.formatLimitDefinition={keyword:Object.keys(o),type:"string",schemaType:"string",$data:!0,error:i,code(c){let{gen:s,data:l,schemaCode:m,keyword:h,it:z}=c,{opts:R,self:v}=z;if(!R.validateFormats)return;let b=new t.KeywordCxt(z,v.RULES.all.format.definition,"format");b.$data?g():d();function g(){let p=s.scopeValue("formats",{ref:v.formats,code:R.code.formats}),S=s.const("fmt",(0,r._)`${p}[${b.schemaCode}]`);c.fail$data((0,r.or)((0,r._)`typeof ${S} != "object"`,(0,r._)`${S} instanceof RegExp`,(0,r._)`typeof ${S}.compare != "function"`,_(S)))}function d(){let p=b.schema,S=v.formats[p];if(!S||S===!0)return;if(typeof S!="object"||S instanceof RegExp||typeof S.compare!="function")throw new Error(`"${h}": format "${p}" does not define "compare" function`);let w=s.scopeValue("formats",{key:p,ref:S,code:R.code.formats?(0,r._)`${R.code.formats}${(0,r.getProperty)(p)}`:void 0});c.fail$data(_(w))}function _(p){return(0,r._)`${p}.compare(${l}, ${m}) ${o[h].fail} 0`}},dependencies:["format"]};let a=c=>(c.addKeyword(e.formatLimitDefinition),c);e.default=a})),Xy=L(((e,t)=>{Object.defineProperty(e,"__esModule",{value:!0});let r=Wy(),n=Yy(),o=de(),i=new o.Name("fullFormats"),a=new o.Name("fastFormats"),c=(l,m={keywords:!0})=>{if(Array.isArray(m))return s(l,m,r.fullFormats,i),l;let[h,z]=m.mode==="fast"?[r.fastFormats,a]:[r.fullFormats,i];return s(l,m.formats||r.formatNames,h,z),m.keywords&&(0,n.default)(l),l};c.get=(l,m="full")=>{let h=(m==="fast"?r.fastFormats:r.fullFormats)[l];if(!h)throw new Error(`Unknown format "${l}"`);return h};function s(l,m,h,z){var R,v;(R=(v=l.opts.code).formats)!==null&&R!==void 0||(v.formats=(0,o._)`require("ajv-formats/dist/formats").${z}`);for(let b of m)l.addFormat(b,h[b])}t.exports=e=c,Object.defineProperty(e,"__esModule",{value:!0}),e.default=c})),Mh=jh(),Qy=My(),eb=Gy(),tb=Fo(Xy(),1),rb=tb.default;function rl(e){let t=new e({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return rb(t),t}var ls=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor(e){this._userAjv=e!==void 0,this._ajv=e}get ajv(){return this._ajv??=rl(eb.Ajv2020)}_engineFor(e){if(this._userAjv)return this.ajv;let t=El(e,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");return t==="2020-12"?this.ajv:t==="2019-09"?this._ajv2019??=rl(Qy.Ajv2019):this._ajvDraft7??=rl(Mh.Ajv)}getValidator(e){let t=this._engineFor(e),r="$id"in e&&typeof e.$id=="string"?t.getSchema(e.$id)??t.compile(e):t.compile(e);return n=>r(n)?{valid:!0,data:n,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:t.errorsText(r.errors)}}},bT=Mh.Ajv;import cl from"node:process";var hE=2**31-1;var ab=8,sb=6e5;function cb(e){if(e?.maxRounds!==void 0&&(!Number.isInteger(e.maxRounds)||e.maxRounds<1))throw new RangeError(`inputRequired.maxRounds must be a positive integer (got ${e.maxRounds})`);if(e?.roundTimeoutMs!==void 0&&(!Number.isFinite(e.roundTimeoutMs)||e.roundTimeoutMs<=0))throw new RangeError(`inputRequired.roundTimeoutMs must be a positive number (got ${e.roundTimeoutMs})`);return{maxRounds:e?.maxRounds??ab,roundTimeoutMs:e?.roundTimeoutMs??sb,legacyShim:e?.legacyShim??!0}}function Uh(e,t,r){if(r===null||typeof r!="object"||typeof r.method!="string")throw new ge(X.InternalError,`Handler for ${e} returned an invalid input request '${t}': each inputRequests entry must be an embedded elicitation/create, sampling/createMessage, or roots/list request`);let n=r,o=Lf(n);if(o===void 0)throw new ge(X.InternalError,`Handler for ${e} returned an input request '${t}' of kind '${n.method}', which is not an embedded request the 2026-07-28 revision defines`);return{embedded:n,required:o}}function ub(){let e=globalThis.crypto;if(e?.randomUUID!==void 0)return e.randomUUID();let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let r=[...t].map(n=>n.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}function ul(e,t){if(e==="tools/call")return{content:[{type:"text",text:t}],isError:!0};throw new ge(X.InternalError,t)}var lb=class{constructor(e){this._host=e}async fulfill(e,t,r,n,o){let{maxRounds:i,roundTimeoutMs:a}=this._host,c=n.mcpReq.signal,s=o,l=0;for(;;){if(l+=1,l>i)return ul(e,uh(e,i));let m=s.inputRequests,h=m!=null&&Object.keys(m).length>0,z=typeof s.requestState=="string"?s.requestState:void 0;if(!h&&z===void 0)throw new ge(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);let R;if(h){let g=this._host.resolvedClientCapabilities(n),d=[];for(let[p,S]of Object.entries(m)){let{embedded:w,required:y}=Uh(e,p,S);if(w.method!=="roots/list"&&w.params===void 0)throw new ge(X.InternalError,`Handler for ${e} returned an input request '${p}' of kind '${w.method}' without params`);if(es(y,g)!==void 0)return ul(e,`Cannot request input '${p}' (${w.method}): the client on this 2025-era connection did not declare the required capability${g===void 0?" (no client capabilities are available on this connection \u2014 per-request legacy serving cannot receive server-to-client requests)":""}`);d.push([p,w])}let _=dh(c);try{let p={relatedRequestId:n.mcpReq.id,timeout:a,resetTimeoutOnProgress:!0,onprogress:()=>{},signal:_.signal},S=await Promise.all(d.map(async([w,y])=>{try{return[w,await this._dispatchLeg(y,p)]}catch(f){throw _.abort(f),f}}));R=Object.fromEntries(S)}catch(p){if(c.aborted)throw p;return ul(e,`Fulfilling input required by '${e}' failed: ${p instanceof Error?p.message:String(p)}`)}finally{_.dispose()}}else await lh(ch,c);let v={...n,mcpReq:{...n.mcpReq,inputResponses:R,droppedInputResponseKeys:void 0,requestState:zo(z)}};if(z!==void 0){let g=await this._host.verifyRequestState(z,v,e);g!==void 0&&(v=Yu(v,g))}let b=await t(r,v);if(!fr(b))return b;s=b}}async _dispatchLeg(e,t){switch(e.method){case"elicitation/create":{let r=e.params;return r.mode==="url"&&r.elicitationId===void 0&&(r={...r,elicitationId:ub()}),await this._host.sendElicitation(r,t)}case"sampling/createMessage":return await this._host.sendSampling(e.params,t);case"roots/list":return await this._host.listRoots(e.params,t)}}},db=new Set(["tools/call","prompts/get","resources/read"]),mb,pb,fb;var ll=class extends Xu{_clientCapabilities;_clientVersion;static{mb=(e,t)=>{t.clientCapabilities!==void 0&&(e._clientCapabilities=t.clientCapabilities),t.clientInfo!==void 0&&(e._clientVersion=t.clientInfo)},pb=(e,t)=>{let r=t.filter(n=>!e._supportedProtocolVersions.includes(n));r.length>0&&(e._supportedProtocolVersions=[...e._supportedProtocolVersions,...r]),e.setRequestHandler("server/discover",()=>e._ondiscover())},fb=e=>e._serverInfo}_capabilities;_instructions;_jsonSchemaValidator;_cacheHints;_requestStateVerify;_inputRequiredServing;_legacyShim;_legacyInputRequiredShim(){return this._legacyShim??=new lb({maxRounds:this._inputRequiredServing.maxRounds,roundTimeoutMs:this._inputRequiredServing.roundTimeoutMs,resolvedClientCapabilities:e=>this._inputRequestCapabilityView(e),verifyRequestState:(e,t,r)=>this._verifyRequestState(e,t,r),sendElicitation:(e,t)=>this._sendElicitationLeg(e,t,{validateAcceptedContent:!1}),sendSampling:(e,t)=>this.createMessage(e,t),listRoots:(e,t)=>this.listRoots(e,t)})}oninitialized;constructor(e,t){if(super(t),this._serverInfo=e,this._capabilities=t?.capabilities?{...t.capabilities}:{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new ls,this._requestStateVerify=t?.requestState?.verify,this._inputRequiredServing=cb(t?.inputRequired),t?.cacheHints!==void 0){for(let[r,n]of Object.entries(t.cacheHints))n!==void 0&&Yf(n,`cacheHints['${r}']`);this._cacheHints=t.cacheHints}this.setRequestHandler("initialize",r=>this._oninitialize(r)),this.setNotificationHandler("notifications/initialized",()=>this.oninitialized?.()),Au(this._supportedProtocolVersions).length>0&&this.setRequestHandler("server/discover",()=>this._ondiscover()),this._capabilities.logging&&this._registerLoggingHandler()}_registerLoggingHandler(){this.setRequestHandler("logging/setLevel",async(e,t)=>{let r=t.sessionId||t.http?.req?.headers.get("mcp-session-id")||void 0,{level:n}=e.params,o=rs(Ht,n);return o.success&&this._loggingLevels.set(r,o.data),{}})}buildContext(e,t){let r=e.http||t?.request||t?.closeSSEStream||t?.closeStandaloneSSEStream;return{...e,mcpReq:{...e.mcpReq,log:(n,o,i)=>{if(!this._capabilities.logging)return Promise.resolve();let a;if(this._servedModernEra()){if(a=e.mcpReq.envelope?.[Ut],a===void 0)return Promise.resolve()}else a=this._loggingLevels.get(e.sessionId)??this._loggingLevels.get(void 0);return a!==void 0&&this.LOG_LEVEL_SEVERITY.get(n)this.elicitInput(n,o),requestSampling:(n,o)=>this.createMessage(n,o)},http:r?{...e.http,req:t?.request,closeSSE:t?.closeSSEStream,closeStandaloneSSE:t?.closeStandaloneSSEStream}:void 0}}_loggingLevels=new Map;LOG_LEVEL_SEVERITY=new Map(Ht.options.map((e,t)=>[e,t]));isMessageIgnored=(e,t)=>{let r=this._loggingLevels.get(t);return r?this.LOG_LEVEL_SEVERITY.get(e){let a=await t(o,i);if(fr(a))throw new ge(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}:async(o,i)=>{let a=n?await this._invokeInputRequiredCapableHandler(e,t,o,i):await t(o,i);if(fr(a)){if(!n)throw new ge(X.InternalError,`Handler for ${e} returned an input-required result, but only tools/call, prompts/get and resources/read support input_required (protocol revision 2026-07-28)`);return a}return r===void 0?a:Wf(a,r)}}return async(r,n)=>{let o=Yr(this._negotiatedProtocolVersion),i=o.validateRequest("tools/call",r);if(!i.ok)throw new ge(i.reason==="not-in-era"?X.InternalError:X.InvalidParams,i.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call request: ${i.message}`);let a=await this._invokeInputRequiredCapableHandler("tools/call",t,r,n);if(fr(a))return a;let c=qu(a),s=o.validateResult("tools/call",c);if(!s.ok)throw new ge(s.reason==="not-in-era"?X.InternalError:X.InvalidParams,s.reason==="not-in-era"?"No wire schema for tools/call in the resolved era":`Invalid tools/call result: ${s.message}`);return s.value}}_servedModernEra(){return this._negotiatedProtocolVersion!==void 0&&$o(this._negotiatedProtocolVersion)}async _invokeInputRequiredCapableHandler(e,t,r,n){let o=this._servedModernEra(),i=n.mcpReq.requestState();if(i!==void 0&&typeof i!="string")throw new ge(X.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"});let a=n;if(typeof i=="string"){let h=await this._verifyRequestState(i,n,e);h!==void 0&&(a=Yu(n,h))}let c;try{c=await t(r,a)}catch(h){throw h instanceof ge&&h.code===X.UrlElicitationRequired&&o?new ge(X.InternalError,`URL elicitation cannot be signalled by throwing UrlElicitationRequiredError on protocol revision ${this._negotiatedProtocolVersion}: return inputRequired({ inputRequests: { \u2026: inputRequired.elicitUrl(...) } }) from the handler instead. The urlElicitationRequired error (-32042) of earlier revisions is not available on this revision.`):h}if(!fr(c))return c;if(!o){if(!this._inputRequiredServing.legacyShim)throw new ge(X.InternalError,`Handler for ${e} returned an input-required result, but this request is served on protocol revision ${this._negotiatedProtocolVersion??cr}, which has no input_required vocabulary`);return await this._legacyInputRequiredShim().fulfill(e,t,r,a,c)}let s=c.inputRequests,l=s!=null&&Object.keys(s).length>0,m=typeof c.requestState=="string";if(!l&&!m)throw new ge(X.InternalError,`Handler for ${e} returned an input-required result with neither inputRequests nor requestState (every InputRequiredResult must include at least one of the two)`);if(l){let h=this._inputRequestCapabilityView(n);for(let[z,R]of Object.entries(s)){let{embedded:v,required:b}=Uh(e,z,R),g=es(b,h);if(g!==void 0)throw new ts({requiredCapabilities:g},`Cannot request input '${z}' (${v.method}): the request's client capabilities do not declare the required capability`)}}return c}async _verifyRequestState(e,t,r){if(this._requestStateVerify!==void 0)try{return await this._requestStateVerify(e,t)}catch(n){throw this.onerror?.(new Error(`requestState verification rejected ${r}: ${n instanceof Error?n.message:String(n)}`)),new ge(X.InvalidParams,"Invalid or expired requestState",{reason:"invalid_request_state"})}}_inputRequestCapabilityView(e){return this._servedModernEra()?e.mcpReq.envelope?.[wt]:this._clientCapabilities}_assertPushApiInServedEra(e){if(this._servedModernEra())throw new le(he.MethodNotSupportedByProtocolVersion,`Server-to-client requests are not available on protocol revision ${this._negotiatedProtocolVersion}: '${e}' cannot be sent while serving a request on that revision. Return inputRequired({ ... }) from the handler instead \u2014 the client fulfils the embedded requests and retries the original request (multi round-trip requests).`,{method:e,era:"2026-07-28"})}assertCapabilityForMethod(e){switch(e){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw new le(he.CapabilityNotSupported,`Client does not support sampling (required for ${e})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw new le(he.CapabilityNotSupported,`Client does not support elicitation (required for ${e})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw new le(he.CapabilityNotSupported,`Client does not support listing roots (required for ${e})`);break;case"ping":break}}assertNotificationCapability(e){switch(e){case"notifications/message":if(!this._capabilities.logging)throw new le(he.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw new le(he.CapabilityNotSupported,`Server does not support notifying about resources (required for ${e})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw new le(he.CapabilityNotSupported,`Server does not support notifying of tool list changes (required for ${e})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw new le(he.CapabilityNotSupported,`Server does not support notifying of prompt list changes (required for ${e})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw new le(he.CapabilityNotSupported,`Client does not support URL elicitation (required for ${e})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(e){switch(e){case"completion/complete":if(!this._capabilities.completions)throw new le(he.CapabilityNotSupported,`Server does not support completions (required for ${e})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw new le(he.CapabilityNotSupported,`Server does not support logging (required for ${e})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw new le(he.CapabilityNotSupported,`Server does not support prompts (required for ${e})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw new le(he.CapabilityNotSupported,`Server does not support resources (required for ${e})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw new le(he.CapabilityNotSupported,`Server does not support tools (required for ${e})`);break;case"ping":case"initialize":break}}async _oninitialize(e){let t=e.params.protocolVersion;this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo;let r=Df(this._supportedProtocolVersions),n=r.includes(t)?t:r[0]??cr;return this._negotiatedProtocolVersion=n,this.transport?.setProtocolVersion?.(n),{protocolVersion:n,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}_ondiscover(){return{supportedVersions:Au(this._supportedProtocolVersions),capabilities:hb(this.getCapabilities()),...this._instructions&&{instructions:this._instructions}}}_outboundServerInfo(){return this._serverInfo}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getNegotiatedProtocolVersion(){return this._negotiatedProtocolVersion}projectCallToolResult(e,t){return this._wireCodec().projectCallToolResult(e,t)}getCapabilities(){return this._capabilities}async ping(){return this._assertPushApiInServedEra("ping"),this.request({method:"ping"})}async createMessage(e,t){if(this._assertPushApiInServedEra("sampling/createMessage"),(e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw new le(he.CapabilityNotSupported,"Client does not support sampling tools capability.");if(e.messages.length>0){let i=e.messages.at(-1),a=Array.isArray(i.content)?i.content:[i.content],c=a.some(h=>h.type==="tool_result"),s=e.messages.length>1?e.messages.at(-2):void 0,l=s?Array.isArray(s.content)?s.content:[s.content]:[],m=l.some(h=>h.type==="tool_use");if(c){if(a.some(h=>h.type!=="tool_result"))throw new ge(X.InvalidParams,"The last message must contain only tool_result content if any is present");if(!m)throw new ge(X.InvalidParams,"tool_result blocks are not matching any tool_use from the previous message")}if(m){let h=new Set(l.filter(R=>R.type==="tool_use").map(R=>R.id)),z=new Set(a.filter(R=>R.type==="tool_result").map(R=>R.toolUseId));if(h.size!==z.size||![...h].every(R=>z.has(R)))throw new ge(X.InvalidParams,"ids of tool_result blocks and tool_use blocks from previous message do not match")}}let r=!!(e.tools||e.toolChoice),n=await this.request({method:"sampling/createMessage",params:e},t),o=this._wireCodec().samplingResultVariant(r,n);if(!o.ok)throw new le(he.InvalidResult,`Invalid sampling/createMessage result: ${o.reason==="invalid"?o.message:o.reason}`);return o.value}async elicitInput(e,t){switch(this._assertPushApiInServedEra("elicitation/create"),e.mode??"form"){case"url":if(!this._clientCapabilities?.elicitation?.url)throw new le(he.CapabilityNotSupported,"Client does not support url elicitation.");break;case"form":if(!this._clientCapabilities?.elicitation?.form)throw new le(he.CapabilityNotSupported,"Client does not support form elicitation.");break}return this._sendElicitationLeg(e,t)}async _sendElicitationLeg(e,t,r){let n=e.mode??"form",o=r?.validateAcceptedContent??!0;switch(n){case"url":{let i=e;return this.request({method:"elicitation/create",params:i},t)}case"form":{let i=e.mode==="form"?e:{...e,mode:"form"},a=await this.request({method:"elicitation/create",params:i},t);if(o&&a.action==="accept"&&a.content&&i.requestedSchema)try{let c=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!c.valid)throw new ge(X.InvalidParams,`Elicitation response content does not match requested schema: ${c.errorMessage}`)}catch(c){throw c instanceof ge?c:new ge(X.InternalError,`Error validating elicitation response: ${c instanceof Error?c.message:String(c)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw new le(he.CapabilityNotSupported,"Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:e}},t)}async listRoots(e,t){return this._assertPushApiInServedEra("roots/list"),this.request({method:"roots/list",params:e},t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:"notifications/message",params:e})}async sendResourceUpdated(e){return this.notification({method:"notifications/resources/updated",params:e})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}};function hb(e){return{...e}}var Lh=class{_readBuffer;_started=!1;_closed=!1;constructor(e=cl.stdin,t=cl.stdout,r){this._stdin=e,this._stdout=t,this._readBuffer=new el({maxBufferSize:r?.maxBufferSize})}onclose;onerror;onmessage;_ondata=e=>{try{this._readBuffer.append(e),this.processReadBuffer()}catch(t){this.onerror?.(t),this.close().catch(()=>{})}};_onerror=e=>{this.onerror?.(e)};_onstdouterror=e=>{this.onerror?.(e),this.close().catch(()=>{})};async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror),this._stdout.on("error",this._onstdouterror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._closed||(this._closed=!0,this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdout.off("error",this._onstdouterror),this._stdin.listenerCount("data")===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.())}send(e){return this._closed?Promise.reject(new Error("StdioServerTransport is closed")):new Promise((t,r)=>{let n=tl(e),o=!1,i=c=>{o||(o=!0,this._stdout.off("error",i),this._stdout.off("drain",a),r(c))},a=()=>{o||(o=!0,this._stdout.off("error",i),this._stdout.off("drain",a),t())};if(this._stdout.once("error",i),this._stdout.write(n)){if(o)return;o=!0,this._stdout.off("error",i),t()}else o||this._stdout.once("drain",a)})}};import{appendFileSync as pt,existsSync as vt,readFileSync as Rb,writeFileSync as Ze}from"node:fs";import{setTimeout as Me}from"node:timers/promises";var fs=process.env.TEST_ACCOUNT_NAME??"unknown",hs=process.env.TEST_INCLUDE_RESPONSE_TOKEN==="true"?`${fs}:${process.env.API_TOKEN??""}`:fs,Dh=Number(process.env.TEST_LIST_TOOLS_DELAY_MS??"0"),Vh=Number(process.env.TEST_LIST_TOOLS_START_DELAY_MS??"0"),Zh=Number(process.env.TEST_LIST_TOOLS_DELAY_AFTER_NOTIFICATION_MS??"0"),Fh=Number(process.env.TEST_LIST_RESOURCES_DELAY_MS??"0"),Hh=Number(process.env.TEST_LIST_PROMPTS_DELAY_MS??"0"),wb=process.env.TEST_LIST_TOOLS_PROGRESS==="true",Tb=process.env.TEST_LIST_RESOURCES_PROGRESS==="true",Eb=process.env.TEST_LIST_RESOURCE_TEMPLATES_PROGRESS==="true",Ib=process.env.TEST_LIST_PROMPTS_PROGRESS==="true",Jh=Number(process.env.TEST_CALL_TOOL_DELAY_MS??"0"),Pb=process.env.TEST_CALL_TOOL_PROGRESS==="true",Bh=process.env.TEST_CALL_TOOL_PROGRESS_MESSAGE,Kh=Number(process.env.TEST_READ_RESOURCE_DELAY_MS??"0"),Gh=Number(process.env.TEST_GET_PROMPT_DELAY_MS??"0"),kb=process.env.TEST_RESOURCE_NAME??"Current account",zg=process.env.TEST_RESOURCE_URI??"account://current",Ob=process.env.TEST_RESOURCE_TEMPLATE_NAME??"account",gs=process.env.TEST_RESOURCE_TEMPLATE_URI,jb=process.env.TEST_RESOURCE_TEMPLATES_UNSUPPORTED==="true",ys=process.env.TEST_RESOURCE_SUBSCRIPTIONS==="true",ps=process.env.TEST_RESOURCE_SUBSCRIPTION_STATEFUL_UPDATES==="true",Nb=process.env.TEST_FAIL_SUBSCRIBE==="true",Wh=process.env.TEST_RESOURCE_UPDATE_URI,Yh=Number(process.env.TEST_RESOURCE_UPDATE_DELAY_MS??"0"),Xh=Number(process.env.TEST_SUBSCRIBE_START_DELAY_MS??"0"),Qh=Number(process.env.TEST_SUBSCRIBE_DELAY_MS??"0"),eg=Number(process.env.TEST_UNSUBSCRIBE_DELAY_MS??"0"),tg=process.env.TEST_SUBSCRIBE_COUNT_PATH,rg=process.env.TEST_UNSUBSCRIBE_COUNT_PATH,ng=process.env.TEST_SUBSCRIBE_STARTED_PATH,xb=process.env.TEST_NOTIFY_TOOL_LIST_CHANGE_ON_LIST_TOOLS==="true",Cb=process.env.TEST_NOTIFY_TOOL_LIST_CHANGE_ON_FIRST_LIST_TOOLS==="true",Ab=process.env.TEST_TOOL_LIST_CHANGES_AFTER_FIRST_REQUEST==="true",qb=process.env.TEST_NOTIFY_LIST_CHANGES_ON_CALL_TOOL==="true",Rg=process.env.TEST_PROMPT_NAME??"account_prompt",Sl=!1,yl=0,vs=process.env.TEST_PAGINATE_CAPABILITIES==="true",og=process.env.TEST_PAGINATE_TOOLS==="true",Mb=process.env.TEST_SECOND_RESOURCE_NAME??"Second account",Ub=process.env.TEST_SECOND_RESOURCE_URI??"account://second",Lb=process.env.TEST_SECOND_PROMPT_NAME??"second_prompt",ig=process.env.TEST_ADDITIONAL_RESOURCE_URI,ag=process.env.TEST_RESOURCE_ICON_URI,_s=process.env.TEST_PROMPT_ICON_URI,dl=process.env.TEST_PROMPT_RESOURCE_URI,ml=process.env.TEST_FAIL_ON_RESTART_PATH,sg=process.env.TEST_FAIL_LIST_RESOURCES_PATH,cg=process.env.TEST_FAIL_LIST_PROMPTS_PATH,Ss=process.env.TEST_CRASH_ON_CALL_TOOL_PATH,ug=process.env.TEST_CRASH_ON_CALL_TOOL_OBSERVED_PATH,lg=process.env.TEST_CRASH_AFTER_INITIALIZED_PATH,dg=process.env.TEST_START_COUNT_PATH,mg=process.env.TEST_INITIALIZED_PATH,pg=process.env.TEST_CREATE_ITEM_COUNT_PATH,fg=process.env.TEST_CALL_TOOL_STARTED_PATH,hg=process.env.TEST_CANCELLED_PATH,gg=process.env.TEST_FAIL_INITIALIZE==="true",pl=process.env.TEST_CLIENT_INFO_PATH,wo=process.env.TEST_STDERR_MESSAGE,ds=Number(process.env.TEST_STDERR_SPLIT_AT??"0"),ms=process.env.TEST_HANG_ON_START_PATH,vg=process.env.TEST_HANG_ON_START_READY_PATH,fl=Number(process.env.TEST_SHUTDOWN_DELAY_MS??"0"),hl=process.env.TEST_SHUTDOWN_END_PATH,Db=process.env.TEST_INCLUDE_IDENTITY_TOOL==="true",Vb=process.env.TEST_INCLUDE_SCHEMA_COMPAT_TOOLS==="true",gl=Number(process.env.TEST_OVERSIZED_IDENTITY_RESPONSE_REPEAT??"0"),bl=Number.isSafeInteger(gl)&&gl>0?"identity-response-secret".repeat(gl):void 0,Zb=bl===void 0?process.env.TEST_IDENTITY_RESPONSE??JSON.stringify({login:fs}):JSON.stringify({login:bl}),Fb=process.env.TEST_IDENTITY_SCHEMA==="min-properties"?{type:"object",properties:{account:{type:"string"}},minProperties:1}:process.env.TEST_IDENTITY_SCHEMA==="all-of-required"?{type:"object",properties:{account:{type:"string"}},allOf:[{required:["account"]}]}:process.env.TEST_IDENTITY_SCHEMA==="additional-properties-false"?{type:"object",properties:{},additionalProperties:!1}:{type:"object",properties:{}},$l=process.env.TEST_INCLUDE_SAFE_READ_TOOL==="true"?"get_capabilities":void 0,_g=process.env.TEST_SAFE_READ_CALL_PATH,Hb=process.env.TEST_SAFE_READ_RESPONSE??"safe-read",Sg=Tg(process.env.TEST_SAFE_READ_ANNOTATIONS,"TEST_SAFE_READ_ANNOTATIONS"),Jb=process.env.TEST_SAFE_READ_SCHEMA==="required"?{type:"object",properties:{account:{type:"string"}},required:["account"]}:process.env.TEST_SAFE_READ_SCHEMA==="all-of-required"?{type:"object",properties:{},allOf:[{required:["account"]}]}:{type:"object",properties:{}},vl=0,yg=process.env.TEST_ISOLATION_REPORT_PATH;if(yg){let e=process.env.OAUTH_CREDENTIAL_PATH;if(!e)throw new Error("test isolation fixture requires OAUTH_CREDENTIAL_PATH");let t=Rb(e,"utf8");Ze(yg,JSON.stringify({home:process.env.HOME,xdgConfigHome:process.env.XDG_CONFIG_HOME,xdgCacheHome:process.env.XDG_CACHE_HOME,xdgDataHome:process.env.XDG_DATA_HOME,xdgStateHome:process.env.XDG_STATE_HOME,xdgRuntimeDir:process.env.XDG_RUNTIME_DIR,credentialPath:e,credential:t})),process.env.TEST_ISOLATION_EMIT_CREDENTIAL==="true"&&process.stderr.write(`test isolated credential: ${t} `);let r=process.env.TEST_ISOLATION_EMIT_CREDENTIAL_FIELD;if(r){let n=JSON.parse(t)[r];if(typeof n!="string")throw new Error("test isolation fixture requires a string credential field");process.stderr.write(`test isolated credential field: ${n} `)}}dg&&pt(dg,`1 `);if(process.env.TEST_HANG_ON_START==="true"||ms&&vt(ms))if(vg&&Ze(vg,"ready"),ms)for(;vt(ms);)await Me(5);else for(;;)await Me(1e3);(hl||fl>0)&&process.stdin.once("end",()=>{hl&&Ze(hl,"ended"),fl>0&&Me(fl).then(()=>process.exit(0))});process.env.TEST_IGNORE_SIGTERM==="true"&&process.on("SIGTERM",()=>{});wo&&(ds>0&&ds{mg&&Ze(mg,"initialized"),lg&&vt(lg)&&Me(0).then(()=>process.exit(1))};function Tg(e,t){if(e!==void 0)try{return JSON.parse(e)}catch{throw new Error(`${t} must contain valid JSON`)}}(gg||pl)&&Pe.setRequestHandler("initialize",async e=>{if(pl&&Ze(pl,JSON.stringify(e.params.clientInfo)),gg)throw new Error(`test initialize failure: ${process.env.API_TOKEN}`);return{protocolVersion:e.params.protocolVersion,capabilities:{tools:{},resources:ys?{subscribe:!0}:{},prompts:{}},serverInfo:{name:"fake-upstream",version:"1.0.0"}}});Pe.setRequestHandler("tools/list",async e=>{vl+=1;let t=Ab&&vl>1;if(Vh>0&&await Me(Vh),process.env.TEST_LIST_TOOLS_STARTED_PATH&&Ze(process.env.TEST_LIST_TOOLS_STARTED_PATH,"started"),process.env.TEST_LIST_TOOLS_COUNT_PATH&&pt(process.env.TEST_LIST_TOOLS_COUNT_PATH,`1 -`),Dh>0&&await Me(Dh),wb&&e.params._meta?.progressToken!==void 0&&await Pe.notification({method:"notifications/progress",params:{progressToken:e.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_TOOLS==="true")throw new Error(`test tool list failure: ${process.env.TEST_ERROR_MESSAGE??process.env.API_TOKEN}`);(xb||Cb&&vl===1)&&await Pe.sendToolListChanged(),Zh>0&&await Me(Zh);let r=og&&e.params?.cursor==="next";return{tools:[...wg?[{name:"exec",description:"Execute a PostHog command.",inputSchema:{type:"object",properties:{command:{type:"string"},context:{type:"string"}},required:["command","context"],additionalProperties:!1}}]:r?[{name:"whoami_second",description:"Return the second injected account.",inputSchema:bg},{name:"echo_second",description:"Echo a second message.",inputSchema:{type:"object",properties:{message:{type:"string"}},required:["message"]}},{name:"create_second_item",description:"Create a second item.",inputSchema:{type:"object",properties:{name:{type:"string"}},required:["name"]}}]:[{name:t?"whoami_reloaded":"whoami",description:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Return the injected account ${process.env.API_TOKEN}`:"Return the injected account.",inputSchema:bg},{name:t?"echo_reloaded":"echo",description:"Echo a message.",inputSchema:{type:"object",properties:{message:{type:"string"}},required:["message"]}},{name:t?"create_reloaded_item":"create_item",description:"Create an item.",inputSchema:{type:"object",properties:{name:{type:"string"}},required:["name"]},...$g===void 0?{}:{annotations:$g}}],...Db&&!r?[{name:"identity",description:"Return the configured account identity.",inputSchema:Zb}]:[],...$l&&!r?[{name:$l,description:"Run the provider-declared empty-object readiness probe.",inputSchema:Hb,...Sg===void 0?{}:{annotations:Sg}}]:[],...process.env.TEST_INCLUDE_MANAGEMENT_TOOL==="true"?[{name:"miftah_health",description:"Collides with a reserved Miftah management tool.",inputSchema:{type:"object",properties:{}}}]:[],...process.env.TEST_INCLUDE_MIFTAH_PREFIX_TOOL==="true"?[{name:"miftah_custom",description:"An upstream tool with a Miftah-looking name.",inputSchema:{type:"object",properties:{}}}]:[]],...og&&!r?{nextCursor:"next"}:{}}});Pe.setRequestHandler("tools/call",async e=>{if(fg&&Ze(fg,"started"),Ss&&vt(Ss))return Me(0).then(()=>process.exit(1)),new Promise(()=>{});if(process.env.TEST_CALL_TOOL_COUNT_PATH&&pt(process.env.TEST_CALL_TOOL_COUNT_PATH,`1 +`),Dh>0&&await Me(Dh),wb&&e.params._meta?.progressToken!==void 0&&await Pe.notification({method:"notifications/progress",params:{progressToken:e.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_TOOLS==="true")throw new Error(`test tool list failure: ${process.env.TEST_ERROR_MESSAGE??process.env.API_TOKEN}`);(xb||Cb&&vl===1)&&await Pe.sendToolListChanged(),Zh>0&&await Me(Zh);let r=og&&e.params?.cursor==="next";return{tools:[...wg?[{name:"exec",description:"Execute a PostHog command.",inputSchema:{type:"object",properties:{command:{type:"string"},context:{type:"string"}},required:["command","context"],additionalProperties:!1}}]:r?[{name:"whoami_second",description:"Return the second injected account.",inputSchema:bg},{name:"echo_second",description:"Echo a second message.",inputSchema:{type:"object",properties:{message:{type:"string"}},required:["message"]}},{name:"create_second_item",description:"Create a second item.",inputSchema:{type:"object",properties:{name:{type:"string"}},required:["name"]}}]:[{name:t?"whoami_reloaded":"whoami",description:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Return the injected account ${process.env.API_TOKEN}`:"Return the injected account.",inputSchema:bg},{name:t?"echo_reloaded":"echo",description:"Echo a message.",inputSchema:{type:"object",properties:{message:{type:"string"}},required:["message"]}},{name:t?"create_reloaded_item":"create_item",description:"Create an item.",inputSchema:{type:"object",properties:{name:{type:"string"}},required:["name"]},...$g===void 0?{}:{annotations:$g}}],...Db&&!r?[{name:"identity",description:"Return the configured account identity.",inputSchema:Fb}]:[],...$l&&!r?[{name:$l,description:"Run the provider-declared empty-object readiness probe.",inputSchema:Jb,...Sg===void 0?{}:{annotations:Sg}}]:[],...Vb&&!r?[{name:"vercel_schema_fixture",description:"Expose Vercel-compatible input schemas.",inputSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{[process.env.API_TOKEN??"missing-schema-secret"]:{$ref:`#/$defs/${process.env.API_TOKEN??"missing-schema-secret"}`},github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP:{$ref:"#/$defs/github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP"},tokens:{type:"integer",description:`Configured ${process.env.API_TOKEN}; Bearer not-a-real-bearer-value`},passwordProtection:{type:"boolean",default:!0,description:"Provider github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP"}},$defs:{[process.env.API_TOKEN??"missing-schema-secret"]:{type:"string"},github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP:{type:"integer"}},dependencies:{[process.env.API_TOKEN??"missing-schema-secret"]:["github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP"],github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP:[process.env.API_TOKEN??"missing-schema-secret"]},required:[process.env.API_TOKEN??"missing-schema-secret","github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP"],default:{[process.env.API_TOKEN??"missing-schema-secret"]:"configured-key","Bearer not-a-real-bearer-value":"bearer-key",github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP:"provider-key"},examples:[{[process.env.API_TOKEN??"missing-schema-secret"]:"configured-key",github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP:"provider-key"}],additionalProperties:!1}},{name:"firebase_schema_fixture",description:"Expose Firebase-compatible pagination schemas.",inputSchema:{type:"object",properties:{page_token:{type:"string"}}}},{name:"stripe_schema_fixture",description:"Expose Stripe-compatible open output schemas.",inputSchema:{type:"object",properties:{}},outputSchema:{type:"object",properties:{archived:{type:"boolean",default:!0}},additionalProperties:!0}}]:[],...process.env.TEST_INCLUDE_MANAGEMENT_TOOL==="true"?[{name:"miftah_health",description:"Collides with a reserved Miftah management tool.",inputSchema:{type:"object",properties:{}}}]:[],...process.env.TEST_INCLUDE_MIFTAH_PREFIX_TOOL==="true"?[{name:"miftah_custom",description:"An upstream tool with a Miftah-looking name.",inputSchema:{type:"object",properties:{}}}]:[]],...og&&!r?{nextCursor:"next"}:{}}});Pe.setRequestHandler("tools/call",async e=>{if(fg&&Ze(fg,"started"),Ss&&vt(Ss))return Me(0).then(()=>process.exit(1)),new Promise(()=>{});if(process.env.TEST_CALL_TOOL_COUNT_PATH&&pt(process.env.TEST_CALL_TOOL_COUNT_PATH,`1 `),e.params.name==="create_item"&&pg&&pt(pg,`1 -`),process.env.TEST_FAIL_CALL_TOOL==="true")throw new Error(`test tool call failure: ${process.env.API_TOKEN}`);return process.env.TEST_RETURN_CALL_TOOL_ERROR==="true"?{content:[{type:"text",text:"test tool returned an error result"}],isError:!0}:(Pb&&e.params._meta?.progressToken!==void 0&&await Pe.notification({method:"notifications/progress",params:{progressToken:e.params._meta.progressToken,progress:1,total:2,...Bh===void 0?{}:{message:Bh}}}),qb&&await Promise.all([Pe.sendToolListChanged(),Pe.sendResourceListChanged(),Pe.sendPromptListChanged()]),Jh>0&&await Me(Jh),wg&&e.params.name==="exec"?{content:[{type:"text",text:`exec:${String(e.params.arguments?.command??"")}`}]}:e.params.name==="whoami"?{content:[{type:"text",text:bl??fs}]}:e.params.name==="identity"?{content:[{type:"text",text:Vb}]}:e.params.name===$l?(_g&&Ze(_g,JSON.stringify({name:e.params.name,arguments:e.params.arguments??{}})),{content:[{type:"text",text:Fb}]}):e.params.name==="echo"?{content:[{type:"text",text:String(e.params.arguments?.message??"")}]}:{content:[{type:"text",text:`created:${String(e.params.arguments?.name??"")}`}]})});Pe.setNotificationHandler("notifications/cancelled",e=>{hg&&pt(hg,`${e.params.requestId} +`),process.env.TEST_FAIL_CALL_TOOL==="true")throw new Error(`test tool call failure: ${process.env.API_TOKEN}`);return process.env.TEST_RETURN_CALL_TOOL_ERROR==="true"?{content:[{type:"text",text:"test tool returned an error result"}],isError:!0}:(Pb&&e.params._meta?.progressToken!==void 0&&await Pe.notification({method:"notifications/progress",params:{progressToken:e.params._meta.progressToken,progress:1,total:2,...Bh===void 0?{}:{message:Bh}}}),qb&&await Promise.all([Pe.sendToolListChanged(),Pe.sendResourceListChanged(),Pe.sendPromptListChanged()]),Jh>0&&await Me(Jh),wg&&e.params.name==="exec"?{content:[{type:"text",text:`exec:${String(e.params.arguments?.command??"")}`}]}:e.params.name==="whoami"?{content:[{type:"text",text:bl??fs}]}:e.params.name==="identity"?{content:[{type:"text",text:Zb}]}:e.params.name===$l?(_g&&Ze(_g,JSON.stringify({name:e.params.name,arguments:e.params.arguments??{}})),{content:[{type:"text",text:Hb}]}):e.params.name==="echo"?{content:[{type:"text",text:String(e.params.arguments?.message??"")}]}:{content:[{type:"text",text:`created:${String(e.params.arguments?.name??"")}`}]})});Pe.setNotificationHandler("notifications/cancelled",e=>{hg&&pt(hg,`${e.params.requestId} `)});Pe.setRequestHandler("resources/list",async e=>{if(process.env.TEST_LIST_RESOURCES_COUNT_PATH&&pt(process.env.TEST_LIST_RESOURCES_COUNT_PATH,`1 `),process.env.TEST_LIST_RESOURCES_STARTED_PATH&&Ze(process.env.TEST_LIST_RESOURCES_STARTED_PATH,"started"),Fh>0&&await Me(Fh),Tb&&e.params._meta?.progressToken!==void 0&&await Pe.notification({method:"notifications/progress",params:{progressToken:e.params._meta.progressToken,progress:1,total:2}}),process.env.TEST_FAIL_LIST_RESOURCES==="true"||sg&&vt(sg))throw new Error(`test resource discovery failure: ${process.env.API_TOKEN}`);let t=vs&&e.params?.cursor==="next";return{resources:[{uri:t?Ub:zg,name:process.env.TEST_INCLUDE_DISCOVERY_TOKEN==="true"?`Current account ${process.env.API_TOKEN}`:t?Mb:kb,mimeType:"text/plain",...ag?{icons:[{src:ag}]}:{}}],...vs&&!t?{nextCursor:"next"}:{}}});jb||Pe.setRequestHandler("resources/templates/list",async e=>(Eb&&e.params._meta?.progressToken!==void 0&&await Pe.notification({method:"notifications/progress",params:{progressToken:e.params._meta.progressToken,progress:1,total:2}}),{resourceTemplates:gs===void 0?[]:[{uriTemplate:gs,name:Ob,mimeType:"text/plain"}]}));Pe.setRequestHandler("resources/read",async e=>{if(process.env.TEST_READ_RESOURCE_COUNT_PATH&&pt(process.env.TEST_READ_RESOURCE_COUNT_PATH,`1 `),process.env.TEST_READ_RESOURCE_STARTED_PATH&&Ze(process.env.TEST_READ_RESOURCE_STARTED_PATH,"started"),Kh>0&&await Me(Kh),process.env.TEST_FAIL_READ_RESOURCE==="true")throw new Error(`test resource read failure: ${process.env.TEST_ERROR_URI??process.env.API_TOKEN}`);return{contents:[{uri:gs!==void 0&&new ns(gs).match(e.params.uri)!==null?e.params.uri:zg,text:hs,mimeType:"text/plain"},...ig?[{uri:ig,text:hs,mimeType:"text/plain"}]:[]]}});Pe.setRequestHandler("resources/subscribe",async()=>{if(!ys)throw new Error("test upstream does not support resource subscriptions");if(Xh>0&&await Me(Xh),ng&&Ze(ng,"started"),tg&&pt(tg,`1 diff --git a/tests/fixtures/fake-upstream-runtime.mjs b/tests/fixtures/fake-upstream-runtime.mjs index b3dc680..d88fba4 100644 --- a/tests/fixtures/fake-upstream-runtime.mjs +++ b/tests/fixtures/fake-upstream-runtime.mjs @@ -71,6 +71,7 @@ const hangOnStartReadyPath = process.env.TEST_HANG_ON_START_READY_PATH; const shutdownDelayMs = Number(process.env.TEST_SHUTDOWN_DELAY_MS ?? "0"); const shutdownEndPath = process.env.TEST_SHUTDOWN_END_PATH; const includeIdentityTool = process.env.TEST_INCLUDE_IDENTITY_TOOL === "true"; +const includeSchemaCompatibilityTools = process.env.TEST_INCLUDE_SCHEMA_COMPAT_TOOLS === "true"; const oversizedIdentityResponseRepeat = Number(process.env.TEST_OVERSIZED_IDENTITY_RESPONSE_REPEAT ?? "0"); const oversizedIdentityLogin = Number.isSafeInteger(oversizedIdentityResponseRepeat) && oversizedIdentityResponseRepeat > 0 @@ -377,6 +378,85 @@ server.setRequestHandler('tools/list', async (request) => { } ] : []), + ...(includeSchemaCompatibilityTools && !secondPage + ? [ + { + name: "vercel_schema_fixture", + description: "Expose Vercel-compatible input schemas.", + inputSchema: { + $schema: "https://json-schema.org/draft/2020-12/schema", + type: "object", + properties: { + [process.env.API_TOKEN ?? "missing-schema-secret"]: { + $ref: `#/$defs/${process.env.API_TOKEN ?? "missing-schema-secret"}` + }, + github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP: { + $ref: "#/$defs/github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" + }, + tokens: { + type: "integer", + description: `Configured ${process.env.API_TOKEN}; Bearer not-a-real-bearer-value` + }, + passwordProtection: { + type: "boolean", + default: true, + description: "Provider github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" + } + }, + $defs: { + [process.env.API_TOKEN ?? "missing-schema-secret"]: { type: "string" }, + github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP: { type: "integer" } + }, + dependencies: { + [process.env.API_TOKEN ?? "missing-schema-secret"]: [ + "github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" + ], + github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP: [ + process.env.API_TOKEN ?? "missing-schema-secret" + ] + }, + required: [ + process.env.API_TOKEN ?? "missing-schema-secret", + "github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP" + ], + default: { + [process.env.API_TOKEN ?? "missing-schema-secret"]: "configured-key", + "Bearer not-a-real-bearer-value": "bearer-key", + github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP: "provider-key" + }, + examples: [ + { + [process.env.API_TOKEN ?? "missing-schema-secret"]: "configured-key", + github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP: "provider-key" + } + ], + additionalProperties: false + } + }, + { + name: "firebase_schema_fixture", + description: "Expose Firebase-compatible pagination schemas.", + inputSchema: { + type: "object", + properties: { + page_token: { type: "string" } + } + } + }, + { + name: "stripe_schema_fixture", + description: "Expose Stripe-compatible open output schemas.", + inputSchema: { type: "object", properties: {} }, + outputSchema: { + type: "object", + properties: { + archived: { type: "boolean", default: true } + }, + additionalProperties: true + } + } + ] + : []), ...(process.env.TEST_INCLUDE_MANAGEMENT_TOOL === "true" ? [ { diff --git a/tests/mcp-wrapper.test.ts b/tests/mcp-wrapper.test.ts index 7149da4..7332fb5 100644 --- a/tests/mcp-wrapper.test.ts +++ b/tests/mcp-wrapper.test.ts @@ -3864,6 +3864,77 @@ describe("Miftah MCP wrapper", () => { } }); + it("preserves valid secret-looking tool schemas and normalizes open boolean schemas", async () => { + const secret = "configured-schema-secret"; + const config = validateConfig({ + version: "1", + name: "accounts", + defaultProfile: "work", + upstream: { transport: "stdio", command: process.execPath, args: [fixture] }, + profiles: { + work: { + env: { + TEST_ACCOUNT_NAME: "work", + TEST_INCLUDE_SCHEMA_COMPAT_TOOLS: "true", + API_TOKEN: secret + } + } + } + }); + const manager = new UpstreamProcessManager(config.upstream!, config.profiles, { startupTimeoutMs: 5_000 }); + const wrapper = new MiftahServer(config, new ProfileManager(config), manager); + const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); + const client = new Client({ name: "schema-compatibility-client", version: "1.0.0" }); + + try { + await Promise.all([wrapper.connect(serverTransport), client.connect(clientTransport)]); + + const result = await client.listTools(); + const vercel = result.tools.find((tool) => tool.name === "vercel_schema_fixture"); + const firebase = result.tools.find((tool) => tool.name === "firebase_schema_fixture"); + const stripe = result.tools.find((tool) => tool.name === "stripe_schema_fixture"); + + expect(vercel?.inputSchema).toMatchObject({ + properties: { + "[REDACTED]": { $ref: "#/$defs/[REDACTED]" }, + "[REDACTED_2]": { $ref: "#/$defs/[REDACTED_2]" }, + tokens: { type: "integer" }, + passwordProtection: { type: "boolean", default: true } + }, + $defs: { + "[REDACTED]": { type: "string" }, + "[REDACTED_2]": { type: "integer" } + }, + dependencies: { + "[REDACTED]": ["[REDACTED_2]"], + "[REDACTED_2]": ["[REDACTED]"] + }, + required: ["[REDACTED]", "[REDACTED_2]"], + default: { + "[REDACTED]": "configured-key", + "Bearer [REDACTED]": "bearer-key", + "[REDACTED_2]": "provider-key" + }, + examples: [{ "[REDACTED]": "configured-key", "[REDACTED_2]": "provider-key" }] + }); + expect(vercel?.inputSchema.additionalProperties).toBe(false); + expect(firebase?.inputSchema.properties).toMatchObject({ page_token: { type: "string" } }); + expect(stripe?.outputSchema).toMatchObject({ + properties: { archived: { type: "boolean", default: true } }, + additionalProperties: {} + }); + + const serialized = JSON.stringify(result); + expect(serialized).not.toContain(secret); + expect(serialized).not.toContain("not-a-real-bearer-value"); + expect(serialized).not.toContain("github_pat_11ABCDEF_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOP"); + expect(serialized).toContain("[REDACTED]"); + } finally { + await client.close(); + await wrapper.close(); + } + }); + it("refreshes the advertised tool schema after a profile switch", async () => { const config = validateConfig({ version: "1", diff --git a/tests/profile-context-handle-docs-contract.test.ts b/tests/profile-context-handle-docs-contract.test.ts index 725752e..d2d4c62 100644 --- a/tests/profile-context-handle-docs-contract.test.ts +++ b/tests/profile-context-handle-docs-contract.test.ts @@ -4,7 +4,7 @@ import { describe, expect, it } from "vitest"; const libraryApiPath = fileURLToPath(new URL("../docs/library-api.md", import.meta.url)); const changelogPath = fileURLToPath(new URL("../CHANGELOG.md", import.meta.url)); -const packageManifestPath = fileURLToPath(new URL("../package.json", import.meta.url)); +const protocolReleaseVersion = "1.1.0"; describe("profile-context handle documentation contract", () => { it("documents the trusted modern host and deployment-wide fail-closed boundary", async () => { @@ -22,16 +22,15 @@ describe("profile-context handle documentation contract", () => { it("records the production boundary alongside protocol negotiation", async () => { const changelog = await readFile(changelogPath, "utf8"); - const manifest = JSON.parse(await readFile(packageManifestPath, "utf8")) as { version: string }; - const escapedVersion = manifest.version.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"); + const escapedVersion = protocolReleaseVersion.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&"); const heading = changelog.match(new RegExp(`^## \\[${escapedVersion}\\] - \\d{4}-\\d{2}-\\d{2}$`, "mu")); expect(heading?.index).toBeTypeOf("number"); const releaseStart = heading?.index ?? 0; const releaseEnd = changelog.indexOf("\n## ", releaseStart + (heading?.[0].length ?? 0)); - const currentRelease = changelog.slice(releaseStart, releaseEnd < 0 ? undefined : releaseEnd); + const protocolRelease = changelog.slice(releaseStart, releaseEnd < 0 ? undefined : releaseEnd); - expect(currentRelease).toContain("[#377]"); - expect(currentRelease).toContain("opt-in production profile-context boundary"); - expect(currentRelease).toContain("an embedding host enables the boundary through `createMiftahServerFactory`"); + expect(protocolRelease).toContain("[#377]"); + expect(protocolRelease).toContain("opt-in production profile-context boundary"); + expect(protocolRelease).toContain("an embedding host enables the boundary through `createMiftahServerFactory`"); }); }); diff --git a/tests/release-version.test.ts b/tests/release-version.test.ts index c461d8f..8a259ae 100644 --- a/tests/release-version.test.ts +++ b/tests/release-version.test.ts @@ -1,7 +1,7 @@ import { readFileSync } from "node:fs"; import { describe, expect, it } from "vitest"; -const releaseVersion = "1.1.0"; +const releaseVersion = "1.1.1"; function readRepositoryFile(path: string): string { return readFileSync(new URL(`../${path}`, import.meta.url), "utf8"); @@ -21,15 +21,15 @@ function releaseNotes(changelog: string, version: string): string { return changelog.slice(match.index, end < 0 ? undefined : end); } -describe("v1.1.0 release artifacts", () => { +describe("v1.1.1 release artifacts", () => { it.each([ { name: "a non-zero-padded date", - changelog: "## [1.1.0] - 2026-8-12\n\n### Changed\n" + changelog: "## [1.1.1] - 2026-8-12\n\n### Changed\n" }, { name: "a heading that does not start its line", - changelog: "Release candidate: ## [1.1.0] - 2026-08-12\n\n### Changed\n" + changelog: "Release candidate: ## [1.1.1] - 2026-08-12\n\n### Changed\n" } ])("rejects $name", ({ changelog }) => { expect(() => releaseNotes(changelog, releaseVersion)).toThrow( @@ -71,18 +71,17 @@ describe("v1.1.0 release artifacts", () => { } }); - it("documents the v1.1 MCP compatibility release and its evidence boundary", () => { + it("documents the v1.1.1 Claude compatibility patch and its evidence boundary", () => { const changelog = readRepositoryFile("CHANGELOG.md"); const notes = releaseNotes(changelog, releaseVersion); - expect(notes).toContain("### Added"); expect(notes).toContain("### Changed"); expect(notes).toContain("### Fixed"); - expect(notes).toContain("### Security"); - for (const issue of [363, 365, 366, 367, 368, 376, 377, 391, 393]) { + for (const issue of [397, 399]) { expect(notes).toContain(`[#${issue}](https://github.com/mohanagy/miftah/issues/${issue})`); } - expect(notes).toContain("named desktop-host claims remain explicitly unverified"); + expect(notes).toContain("Claude Desktop tool-catalog compatibility"); + expect(notes).toContain("schema-valued `true`"); expect(notes).toContain("protected OIDC trusted publishing"); expect(notes).toContain("registry provenance");